diff --git a/Documentation/Books/Users/Administration/Sharding/HowTo.mdpp b/Documentation/Books/Users/Administration/Sharding/HowTo.mdpp index d69ff01029..fc7419c920 100644 --- a/Documentation/Books/Users/Administration/Sharding/HowTo.mdpp +++ b/Documentation/Books/Users/Administration/Sharding/HowTo.mdpp @@ -103,7 +103,7 @@ shell window): ```js $ arangosh --server.endpoint tcp://localhost:8530 [... some output omitted] -arangosh [_system]> db._listDatabases(); +arangosh [_system]> db._databases(); [ "_system" ] diff --git a/Documentation/Books/Users/DataModeling/Databases/WorkingWith.mdpp b/Documentation/Books/Users/DataModeling/Databases/WorkingWith.mdpp index 57e90fcf1d..ec63ecf09b 100644 --- a/Documentation/Books/Users/DataModeling/Databases/WorkingWith.mdpp +++ b/Documentation/Books/Users/DataModeling/Databases/WorkingWith.mdpp @@ -107,7 +107,7 @@ endpoint data. return the list of all existing databases -`db._listDatabases()` +`db._databases()` Returns the list of all databases. This method can only be used from within the *_system* database. diff --git a/Documentation/Books/Users/GettingStarted/CollectionsAndDocuments.mdpp b/Documentation/Books/Users/GettingStarted/CollectionsAndDocuments.mdpp index 047bad6192..bfd42f83b4 100644 --- a/Documentation/Books/Users/GettingStarted/CollectionsAndDocuments.mdpp +++ b/Documentation/Books/Users/GettingStarted/CollectionsAndDocuments.mdpp @@ -61,7 +61,7 @@ advantage that you can use autocompletion. > db._query().toArray() execute an AQL query > db._useDatabase() switch database > db._createDatabase() create a new database - > db._listDatabases() list existing databases + > db._databases() list existing databases > help show help pages > exit arangosh> diff --git a/Documentation/DocuBlocks/databaseListDatabase.md b/Documentation/DocuBlocks/databaseListDatabase.md index bf19bedf02..5692f374d2 100644 --- a/Documentation/DocuBlocks/databaseListDatabase.md +++ b/Documentation/DocuBlocks/databaseListDatabase.md @@ -1,7 +1,7 @@ @brief return the list of all existing databases -`db._listDatabases()` +`db._databases()` Returns the list of all databases. This method can only be used from within the *_system* database. diff --git a/arangod/Cluster/ClusterInfo.cpp b/arangod/Cluster/ClusterInfo.cpp index 9f94120606..4693069bd8 100644 --- a/arangod/Cluster/ClusterInfo.cpp +++ b/arangod/Cluster/ClusterInfo.cpp @@ -370,7 +370,7 @@ bool ClusterInfo::doesDatabaseExist(DatabaseID const& databaseID, bool reload) { /// @brief get list of databases in the cluster //////////////////////////////////////////////////////////////////////////////// -std::vector ClusterInfo::listDatabases(bool reload) { +std::vector ClusterInfo::databases(bool reload) { std::vector result; if (reload || !_planProt.isValid || diff --git a/arangod/Cluster/ClusterInfo.h b/arangod/Cluster/ClusterInfo.h index ed496220f3..7844873ed5 100644 --- a/arangod/Cluster/ClusterInfo.h +++ b/arangod/Cluster/ClusterInfo.h @@ -600,7 +600,7 @@ class ClusterInfo { /// @brief get list of databases in the cluster ////////////////////////////////////////////////////////////////////////////// - std::vector listDatabases(bool = false); + std::vector databases(bool = false); ////////////////////////////////////////////////////////////////////////////// /// @brief (re-)load the information about our plan diff --git a/arangod/Cluster/HeartbeatThread.cpp b/arangod/Cluster/HeartbeatThread.cpp index 63cb512163..d473e070f2 100644 --- a/arangod/Cluster/HeartbeatThread.cpp +++ b/arangod/Cluster/HeartbeatThread.cpp @@ -360,7 +360,7 @@ void HeartbeatThread::runCoordinator() { if (userVersion > 0 && userVersion != oldUserVersion) { // reload user cache for all databases std::vector dbs = - ClusterInfo::instance()->listDatabases(true); + ClusterInfo::instance()->databases(true); std::vector::iterator i; bool allOK = true; for (i = dbs.begin(); i != dbs.end(); ++i) { diff --git a/arangod/Cluster/v8-cluster.cpp b/arangod/Cluster/v8-cluster.cpp index bad9f094df..95716b7a88 100644 --- a/arangod/Cluster/v8-cluster.cpp +++ b/arangod/Cluster/v8-cluster.cpp @@ -612,15 +612,15 @@ static void JS_DoesDatabaseExistClusterInfo( /// @brief get the list of databases in the cluster //////////////////////////////////////////////////////////////////////////////// -static void JS_ListDatabases(v8::FunctionCallbackInfo const& args) { +static void JS_Databases(v8::FunctionCallbackInfo const& args) { TRI_V8_TRY_CATCH_BEGIN(isolate); v8::HandleScope scope(isolate); if (args.Length() != 0) { - TRI_V8_THROW_EXCEPTION_USAGE("listDatabases()"); + TRI_V8_THROW_EXCEPTION_USAGE("databases()"); } - std::vector res = ClusterInfo::instance()->listDatabases(true); + std::vector res = ClusterInfo::instance()->databases(true); v8::Handle a = v8::Array::New(isolate, (int)res.size()); std::vector::iterator it; int count = 0; @@ -1988,8 +1988,8 @@ void TRI_InitV8Cluster(v8::Isolate* isolate, v8::Handle context) { TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("doesDatabaseExist"), JS_DoesDatabaseExistClusterInfo); - TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("listDatabases"), - JS_ListDatabases); + TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("databases"), + JS_Databases); TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("flush"), JS_FlushClusterInfo, true); TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("getCollectionInfo"), diff --git a/arangod/V8Server/v8-collection.cpp b/arangod/V8Server/v8-collection.cpp index 9b5af59b9a..08447507d5 100644 --- a/arangod/V8Server/v8-collection.cpp +++ b/arangod/V8Server/v8-collection.cpp @@ -2783,7 +2783,7 @@ static void JS_CompletionsVocbase( result->Set(j++, TRI_V8_ASCII_STRING("_exists()")); result->Set(j++, TRI_V8_ASCII_STRING("_id")); result->Set(j++, TRI_V8_ASCII_STRING("_isSystem()")); - result->Set(j++, TRI_V8_ASCII_STRING("_listDatabases()")); + result->Set(j++, TRI_V8_ASCII_STRING("_databases()")); result->Set(j++, TRI_V8_ASCII_STRING("_name()")); result->Set(j++, TRI_V8_ASCII_STRING("_path()")); result->Set(j++, TRI_V8_ASCII_STRING("_query()")); diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index 6787b99a32..971316bf49 100644 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -2801,7 +2801,7 @@ static void ListDatabasesCoordinator( ClusterInfo* ci = ClusterInfo::instance(); if (args.Length() == 0) { - std::vector list = ci->listDatabases(true); + std::vector list = ci->databases(true); v8::Handle result = v8::Array::New(isolate); for (size_t i = 0; i < list.size(); ++i) { result->Set((uint32_t)i, TRI_V8_STD_STRING(list[i])); @@ -2860,13 +2860,13 @@ static void ListDatabasesCoordinator( /// @brief was docuBlock databaseListDatabase //////////////////////////////////////////////////////////////////////////////// -static void JS_ListDatabases(v8::FunctionCallbackInfo const& args) { +static void JS_Databases(v8::FunctionCallbackInfo const& args) { v8::Isolate* isolate = args.GetIsolate(); v8::HandleScope scope(isolate); uint32_t const argc = args.Length(); if (argc > 1) { - TRI_V8_THROW_EXCEPTION_USAGE("db._listDatabases()"); + TRI_V8_THROW_EXCEPTION_USAGE("db._databases()"); } TRI_vocbase_t* vocbase = GetContextVocBase(isolate); @@ -3492,8 +3492,8 @@ void TRI_InitV8VocBridge(v8::Isolate* isolate, v8::Handle context, JS_CreateDatabase); TRI_AddMethodVocbase(isolate, ArangoNS, TRI_V8_ASCII_STRING("_dropDatabase"), JS_DropDatabase); - TRI_AddMethodVocbase(isolate, ArangoNS, TRI_V8_ASCII_STRING("_listDatabases"), - JS_ListDatabases); + TRI_AddMethodVocbase(isolate, ArangoNS, TRI_V8_ASCII_STRING("_databases"), + JS_Databases); TRI_AddMethodVocbase(isolate, ArangoNS, TRI_V8_ASCII_STRING("_useDatabase"), JS_UseDatabase); diff --git a/js/actions/api-database.js b/js/actions/api-database.js index bf7ef2afc5..682c9dfe9c 100644 --- a/js/actions/api-database.js +++ b/js/actions/api-database.js @@ -57,13 +57,13 @@ function get_api_database (req, res) { var result; if (req.suffix.length === 0) { // list of all databases - result = arangodb.db._listDatabases(); + result = arangodb.db._databases(); } else { if (req.suffix[0] === 'user') { // fetch all databases for the current user // note: req.user may be null if authentication is turned off - result = arangodb.db._listDatabases(req.user); + result = arangodb.db._databases(req.user); } else if (req.suffix[0] === 'current') { if (cluster.isCoordinator()) { diff --git a/js/apps/system/_admin/aardvark/APP/frontend/build/app.js b/js/apps/system/_admin/aardvark/APP/frontend/build/app.js index f33c178e2f..670fa78677 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/build/app.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/build/app.js @@ -14207,7 +14207,7 @@ ArangoDatabase.prototype._createDatabase = function(name,options,users){var data ArangoDatabase.prototype._dropDatabase = function(name){var requestResult=this._connection.DELETE("/_api/database/" + encodeURIComponent(name));if(requestResult !== null && requestResult.error === true){throw new ArangoError(requestResult);}arangosh.checkRequestResult(requestResult);return requestResult.result;}; //////////////////////////////////////////////////////////////////////////////// /// @brief list all existing databases //////////////////////////////////////////////////////////////////////////////// -ArangoDatabase.prototype._listDatabases = function(){var requestResult=this._connection.GET("/_api/database");if(requestResult !== null && requestResult.error === true){throw new ArangoError(requestResult);}arangosh.checkRequestResult(requestResult);return requestResult.result;}; //////////////////////////////////////////////////////////////////////////////// +ArangoDatabase.prototype._databases = function(){var requestResult=this._connection.GET("/_api/database");if(requestResult !== null && requestResult.error === true){throw new ArangoError(requestResult);}arangosh.checkRequestResult(requestResult);return requestResult.result;}; //////////////////////////////////////////////////////////////////////////////// /// @brief uses a database //////////////////////////////////////////////////////////////////////////////// ArangoDatabase.prototype._useDatabase = function(name){if(internal.printBrowser){throw new ArangoError({error:true,code:internal.errors.ERROR_NOT_IMPLEMENTED.code,errorNum:internal.errors.ERROR_NOT_IMPLEMENTED.code,errorMessage:"_useDatabase() is not supported in the web interface"});}var old=this._connection.getDatabaseName(); // no change diff --git a/js/apps/system/_admin/aardvark/APP/frontend/build/app.min.js b/js/apps/system/_admin/aardvark/APP/frontend/build/app.min.js index 8117c84747..57a7ee83f3 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/build/app.min.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/build/app.min.js @@ -4,7 +4,7 @@ text:"Select existing graph",isDefault:void 0!==b.getGraphName(),interior:[{type var a=$("#"+d+"expanded").attr("value"),c=$("#"+d+"collapsed").attr("value");b.changeTo({color:{type:"expand",expanded:a,collapsed:c}})})})},this.addControlOpticLabelAndColour=function(e){var f="control_node_labelandcolour",g=f+"_";uiComponentsHelper.createButton(a,"Configure Label",f,function(){modalDialogHelper.createModalChangeDialog("Change label attribute",g,[{type:"text",id:"label-attribute",text:"Vertex label attribute",value:b.getLabel()||""},{type:"decission",id:"samecolour",group:"colour",text:"Use this attribute for coloring, too",isDefault:b.getLabel()===b.getColor()},{type:"decission",id:"othercolour",group:"colour",text:"Use different attribute for coloring",isDefault:b.getLabel()!==b.getColor(),interior:[{type:"text",id:"colour-attribute",text:"Color attribute",value:b.getColor()||""}]}],function(){var a=$("#"+g+"label-attribute").attr("value"),e=$("#"+g+"colour-attribute").attr("value"),f=$("input[type='radio'][name='colour']:checked").attr("id");f===g+"samecolour"&&(e=a);var h={label:a,color:{type:"attribute",key:e}};d.applyLocalStorage(h),b.changeTo(h),void 0===c&&(c=d.createColourMappingList())})})},this.addControlOpticLabelAndColourList=function(e){var f="control_node_labelandcolourlist",g=f+"_";uiComponentsHelper.createButton(a,"Configure Label",f,function(){modalDialogHelper.createModalChangeDialog("Change label attribute",g,[{type:"extendable",id:"label",text:"Vertex label attribute",objects:b.getLabel()},{type:"decission",id:"samecolour",group:"colour",text:"Use this attribute for coloring, too",isDefault:b.getLabel()===b.getColor()},{type:"decission",id:"othercolour",group:"colour",text:"Use different attribute for coloring",isDefault:b.getLabel()!==b.getColor(),interior:[{type:"extendable",id:"colour",text:"Color attribute",objects:b.getColor()||""}]}],function(){var a=$("input[id^="+g+"label_]"),e=$("input[id^="+g+"colour_]"),f=$("input[type='radio'][name='colour']:checked").attr("id"),h=[],i=[];a.each(function(a,b){var c=$(b).val();""!==c&&h.push(c)}),e.each(function(a,b){var c=$(b).val();""!==c&&i.push(c)}),f===g+"samecolour"&&(i=h);var j={label:h,color:{type:"attribute",key:i}};d.applyLocalStorage(j),b.changeTo(j),void 0===c&&(c=d.createColourMappingList())})})},this.addAllOptics=function(){d.addControlOpticShapeNone(),d.addControlOpticShapeCircle(),d.addControlOpticShapeRect(),d.addControlOpticLabel(),d.addControlOpticSingleColour(),d.addControlOpticAttributeColour(),d.addControlOpticExpandColour()},this.addAllActions=function(){},this.addAll=function(){d.addAllOptics(),d.addAllActions()},this.createColourMappingList=function(){return void 0!==c?c:(c=document.createElement("div"),c.id="node_colour_list",e(b.getColourMapping()),b.setColourMappingListener(e),c)}}function GraphViewer(a,b,c,d,e){"use strict";if($("html").attr("xmlns:xlink","http://www.w3.org/1999/xlink"),void 0===a||void 0===a.append)throw"SVG has to be given and has to be selected using d3.select";if(void 0===b||0>=b)throw"A width greater 0 has to be given";if(void 0===c||0>=c)throw"A height greater 0 has to be given";if(void 0===d||void 0===d.type)throw"An adapter configuration has to be given";var f,g,h,i,j,k,l,m,n=this,o=[],p=[],q=function(a){if(!a)return a={},a.nodes=p,a.links=o,a.width=b,a.height=c,void(i=new ForceLayouter(a));switch(a.type.toLowerCase()){case"force":a.nodes=p,a.links=o,a.width=b,a.height=c,i=new ForceLayouter(a);break;default:throw"Sorry unknown layout type."}},r=function(a){f.setNodeLimit(a,n.start)},s=function(d){d&&(j=new ZoomManager(b,c,a,k,g,h,{},r))},t=function(a){var b=a.edgeShaper||{},c=a.nodeShaper||{},d=c.idfunc||void 0,e=a.zoom||!1;b.shape=b.shape||{type:EdgeShaper.shapes.ARROW},q(a.layouter),m=k.append("g"),h=new EdgeShaper(m,b),l=k.append("g"),g=new NodeShaper(l,c,d),i.setCombinedUpdateFunction(g,h),s(e)};switch(d.type.toLowerCase()){case"arango":d.width=b,d.height=c,f=new ArangoAdapter(p,o,this,d),f.setChildLimit(10);break;case"gharial":d.width=b,d.height=c,f=new GharialAdapter(p,o,this,d),f.setChildLimit(10);break;case"foxx":d.width=b,d.height=c,f=new FoxxAdapter(p,o,d.route,this,d);break;case"json":f=new JSONAdapter(d.path,p,o,this,b,c);break;case"preview":d.width=b,d.height=c,f=new PreviewAdapter(p,o,this,d);break;default:throw"Sorry unknown adapter type."}k=a.append("g"),t(e||{}),this.start=function(a){i.stop(),a&&(""!==$(".infoField").text()?_.each(p,function(a){_.each(f.randomNodes,function(b){a._id===b._id&&(a._expanded=!0)})}):_.each(p,function(a){a._expanded=!0})),g.drawNodes(p),h.drawEdges(o),i.start()},this.loadGraph=function(a,b){f.loadInitialNode(a,function(a){return a.errorCode?void b(a):(a._expanded=!0,n.start(),void(_.isFunction(b)&&b()))})},this.loadGraphWithRandomStart=function(a,b){f.loadRandomNode(function(b){return b.errorCode&&404===b.errorCode?void a(b):(b._expanded=!0,n.start(!0),void(_.isFunction(a)&&a()))},b)},this.loadGraphWithAdditionalNode=function(a,b,c){f.loadAdditionalNodeByAttributeValue(a,b,function(a){return a.errorCode?void c(a):(a._expanded=!0,n.start(),void(_.isFunction(c)&&c()))})},this.loadGraphWithAttributeValue=function(a,b,c){f.randomNodes=[],f.definedNodes=[],f.loadInitialNodeByAttributeValue(a,b,function(a){return a.errorCode?void c(a):(a._expanded=!0,n.start(),void(_.isFunction(c)&&c()))})},this.cleanUp=function(){g.resetColourMap(),h.resetColourMap()},this.changeWidth=function(a){i.changeWidth(a),j.changeWidth(a),f.setWidth(a)},this.dispatcherConfig={expand:{edges:o,nodes:p,startCallback:n.start,adapter:f,reshapeNodes:g.reshapeNodes},drag:{layouter:i},nodeEditor:{nodes:p,adapter:f},edgeEditor:{edges:o,adapter:f}},this.adapter=f,this.nodeShaper=g,this.edgeShaper=h,this.layouter=i,this.zoomManager=j}function Module(a){this.id=a,this.exports={},this.definition=null}function require(a){return global.module.require(a)}function print(){var a=require("internal");a.print.apply(a.print,arguments)}function ArangoConnection(){this._databaseName="_system";var a=global.document.location.pathname;if("/_db/"===a.substr(0,5)){for(var b=5,c=a.length;c>b&&"/"!==a[b];)b++;b>5&&(this._databaseName=a.substring(5,b))}}EdgeShaper.shapes=Object.freeze({NONE:0,ARROW:1}),NodeShaper.shapes=Object.freeze({NONE:0,CIRCLE:1,RECT:2,IMAGE:3});var modalDialogHelper=modalDialogHelper||{};!function(){"use strict";var a,b=function(a){$(document).bind("keypress.key13",function(b){b.which&&13===b.which&&$(a).click()})},c=function(){$(document).unbind("keypress.key13")},d=function(a,b,c,d,e){var f,g,h=function(){e(f)},i=modalDialogHelper.modalDivTemplate(a,b,c,h),j=document.createElement("tr"),k=document.createElement("th"),l=document.createElement("th"),m=document.createElement("th"),n=document.createElement("button"),o=1;f=function(){var a={};return _.each($("#"+c+"table tr:not(#first_row)"),function(b){var c=$(".keyCell input",b).val(),d=$(".valueCell input",b).val();a[c]=d}),a},i.appendChild(j),j.id="first_row",j.appendChild(k),k.className="keyCell",j.appendChild(l),l.className="valueCell",j.appendChild(m),m.className="actionCell",m.appendChild(n),n.id=c+"new",n.className="graphViewer-icon-button gv-icon-small add",g=function(a,b){var d,e,f,g=/^_(id|rev|key|from|to)/,h=document.createElement("tr"),j=document.createElement("th"),k=document.createElement("th"),l=document.createElement("th");g.test(b)||(i.appendChild(h),h.appendChild(k),k.className="keyCell",e=document.createElement("input"),e.type="text",e.id=c+b+"_key",e.value=b,k.appendChild(e),h.appendChild(l),l.className="valueCell",f=document.createElement("input"),f.type="text",f.id=c+b+"_value","object"==typeof a?f.value=JSON.stringify(a):f.value=a,l.appendChild(f),h.appendChild(j),j.className="actionCell",d=document.createElement("button"),d.id=c+b+"_delete",d.className="graphViewer-icon-button gv-icon-small delete",j.appendChild(d),d.onclick=function(){i.removeChild(h)})},n.onclick=function(){g("","new_"+o),o++},_.each(d,g),$("#"+c+"modal").modal("show")},e=function(a,b,c,d,e){var f=modalDialogHelper.modalDivTemplate(a,b,c,e),g=document.createElement("tr"),h=document.createElement("th"),i=document.createElement("pre");f.appendChild(g),g.appendChild(h),h.appendChild(i),i.className="gv-object-view",i.innerHTML=JSON.stringify(d,null,2),$("#"+c+"modal").modal("show")},f=function(a,b){var c=document.createElement("input");return c.type="text",c.id=a,c.value=b,c},g=function(a,b){var c=document.createElement("input");return c.type="checkbox",c.id=a,c.checked=b,c},h=function(a,b,c){var d=document.createElement("select");return d.id=a,_.each(_.sortBy(b,function(a){return a.toLowerCase()}),function(a){var b=document.createElement("option");b.value=a,b.selected=a===c,b.appendChild(document.createTextNode(a)),d.appendChild(b)}),d},i=function(a){var b=$(".decission_"+a),c=$("input[type='radio'][name='"+a+"']:checked").attr("id");b.each(function(){$(this).attr("decider")===c?$(this).css("display",""):$(this).css("display","none")})},j=function(b,c,d,e,f,g,h,j){var k=document.createElement("input"),l=b+c,m=document.createElement("label"),n=document.createElement("tbody");k.id=l,k.type="radio",k.name=d,k.className="gv-radio-button",m.className="radio",h.appendChild(m),m.appendChild(k),m.appendChild(document.createTextNode(e)),j.appendChild(n),$(n).toggleClass("decission_"+d,!0),$(n).attr("decider",l),_.each(g,function(c){a(n,b,c)}),f?k.checked=!0:k.checked=!1,m.onclick=function(a){i(d),a.stopPropagation()},i(d)},k=function(a,b,c,d,e,f){var g,h=[],i=a+b,j=1,k=document.createElement("th"),l=document.createElement("button"),m=document.createElement("input"),n=function(a){j++;var c,d=document.createElement("tr"),g=document.createElement("th"),k=document.createElement("th"),l=document.createElement("th"),m=document.createElement("input"),n=document.createElement("button");m.type="text",m.id=i+"_"+j,m.value=a||"",c=0===h.length?$(f):$(h[h.length-1]),c.after(d),d.appendChild(g),g.className="collectionTh capitalize",g.appendChild(document.createTextNode(b+" "+j+":")),d.appendChild(k),k.className="collectionTh",k.appendChild(m),n.id=i+"_"+j+"_remove",n.className="graphViewer-icon-button gv-icon-small delete",n.onclick=function(){e.removeChild(d),h.splice(h.indexOf(d),1)},l.appendChild(n),d.appendChild(l),h.push(d)};for(m.type="text",m.id=i+"_1",d.appendChild(m),k.appendChild(l),f.appendChild(k),l.onclick=function(){n()},l.id=i+"_addLine",l.className="graphViewer-icon-button gv-icon-small add","string"==typeof c&&c.length>0&&(c=[c]),c.length>0&&(m.value=c[0]),g=1;g'+c+""),a.disabled||$("#subNavigationBar .bottom").children().last().bind("click",function(){window.App.navigate(a.route,{trigger:!0})})})},buildNodeSubNav:function(a,b,c){var d={Dashboard:{route:"#node/"+encodeURIComponent(a)},Logs:{route:"#nLogs/"+encodeURIComponent(a),disabled:!0}};d[b].active=!0,d[c].disabled=!0,this.buildSubNavBar(d)},buildNodesSubNav:function(a){var b={Coordinators:{route:"#cNodes"},DBServers:{route:"#dNodes"}};"coordinator"===a?b.Coordinators.active=!0:b.DBServers.active=!0,this.buildSubNavBar(b)},buildCollectionSubNav:function(a,b){var c="#collection/"+encodeURIComponent(a),d={Content:{route:c+"/documents/1"},Indices:{route:"#cIndices/"+encodeURIComponent(a)},Info:{route:"#cInfo/"+encodeURIComponent(a)},Settings:{route:"#cSettings/"+encodeURIComponent(a)}};d[b].active=!0,this.buildSubNavBar(d)},enableKeyboardHotkeys:function(a){var b=window.arangoHelper.hotkeysFunctions;a===!0&&($(document).on("keydown",null,"j",b.scrollDown),$(document).on("keydown",null,"k",b.scrollUp))},databaseAllowed:function(a){var b=function(b,c){b?arangoHelper.arangoError("",""):$.ajax({type:"GET",cache:!1,url:"/_db/"+encodeURIComponent(c)+"/_api/database/",contentType:"application/json",processData:!1,success:function(){a(!1,!0)},error:function(){a(!0,!1)}})}.bind(this);this.currentDatabase(b)},arangoNotification:function(a,b,c){window.App.notificationList.add({title:a,content:b,info:c,type:"success"})},arangoError:function(a,b,c){window.App.notificationList.add({title:a,content:b,info:c,type:"error"})},hideArangoNotifications:function(){$.noty.clearQueue(),$.noty.closeAll()},openDocEditor:function(a,b,c){var d=a.split("/"),e=this,f=new window.DocumentView({collection:window.App.arangoDocumentStore});f.breadcrumb=function(){},f.colid=d[0],f.docid=d[1],f.el=".arangoFrame .innerDiv",f.render(),f.setType(b),$(".arangoFrame .headerBar").remove(),$(".arangoFrame .outerDiv").prepend(''),$(".arangoFrame .outerDiv").click(function(){e.closeDocEditor()}),$(".arangoFrame .innerDiv").click(function(a){a.stopPropagation()}),$(".fa-times").click(function(){e.closeDocEditor()}),$(".arangoFrame").show(),f.customView=!0,f.customDeleteFunction=function(){window.modalView.hide(),$(".arangoFrame").hide()},$(".arangoFrame #deleteDocumentButton").click(function(){f.deleteDocumentModal()}),$(".arangoFrame #saveDocumentButton").click(function(){f.saveDocument()}),$(".arangoFrame #deleteDocumentButton").css("display","none")},closeDocEditor:function(){$(".arangoFrame .outerDiv .fa-times").remove(),$(".arangoFrame").hide()},addAardvarkJob:function(a,b){$.ajax({cache:!1,type:"POST",url:"/_admin/aardvark/job",data:JSON.stringify(a),contentType:"application/json",processData:!1,success:function(a){b&&b(!1,a)},error:function(a){b&&b(!0,a)}})},deleteAardvarkJob:function(a,b){$.ajax({cache:!1,type:"DELETE",url:"/_admin/aardvark/job/"+encodeURIComponent(a),contentType:"application/json",processData:!1,success:function(a){b&&b(!1,a)},error:function(a){b&&b(!0,a)}})},deleteAllAardvarkJobs:function(a){$.ajax({cache:!1,type:"DELETE",url:"/_admin/aardvark/job",contentType:"application/json",processData:!1,success:function(b){a&&a(!1,b)},error:function(b){a&&a(!0,b)}})},getAardvarkJobs:function(a){$.ajax({cache:!1,type:"GET",url:"/_admin/aardvark/job",contentType:"application/json",processData:!1,success:function(b){a&&a(!1,b)},error:function(b){a&&a(!0,b)}})},getPendingJobs:function(a){$.ajax({cache:!1,type:"GET",url:"/_api/job/pending",contentType:"application/json",processData:!1,success:function(b){a(!1,b)},error:function(b){a(!0,b)}})},syncAndReturnUninishedAardvarkJobs:function(a,b){var c=function(c,d){if(c)b(!0);else{var e=function(c,e){if(c)arangoHelper.arangoError("","");else{var f=[];e.length>0?_.each(d,function(b){if(b.type===a||void 0===b.type){var c=!1;_.each(e,function(a){b.id===a&&(c=!0)}),c?f.push({collection:b.collection,id:b.id,type:b.type,desc:b.desc}):window.arangoHelper.deleteAardvarkJob(b.id)}}):d.length>0&&this.deleteAllAardvarkJobs(),b(!1,f)}}.bind(this);this.getPendingJobs(e)}}.bind(this);this.getAardvarkJobs(c)},getRandomToken:function(){return Math.round((new Date).getTime())},isSystemAttribute:function(a){var b=this.systemAttributes();return b[a]},isSystemCollection:function(a){return"_"===a.name.substr(0,1)},setDocumentStore:function(a){this.arangoDocumentStore=a},collectionApiType:function(a,b,c){if(b||void 0===this.CollectionTypes[a]){var d=function(b,c,d){b?arangoHelper.arangoError("Error","Could not detect collection type"):(this.CollectionTypes[a]=c.type,3===this.CollectionTypes[a]?d(!1,"edge"):d(!1,"document"))}.bind(this);this.arangoDocumentStore.getCollectionInfo(a,d,c)}else c(!1,this.CollectionTypes[a])},collectionType:function(a){if(!a||""===a.name)return"-";var b;return b=2===a.type?"document":3===a.type?"edge":"unknown",this.isSystemCollection(a)&&(b+=" (system)"),b},formatDT:function(a){var b=function(a){return 10>a?"0"+a:a};return a.getUTCFullYear()+"-"+b(a.getUTCMonth()+1)+"-"+b(a.getUTCDate())+" "+b(a.getUTCHours())+":"+b(a.getUTCMinutes())+":"+b(a.getUTCSeconds())},escapeHtml:function(a){return String(a).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}}}(),function(){"use strict";if(!window.hasOwnProperty("TEST_BUILD")){var a=function(){var a={};return a.createTemplate=function(a){var b=$("#"+a.replace(".","\\.")).html();return{render:function(a){var c=_.template(b);return c=c(a)}}},a};window.templateEngine=new a}}(),Module.prototype.moduleCache={},Module.prototype.moduleCache["/internal"]=new Module("/internal"),"undefined"==typeof global&&"undefined"!=typeof window&&(global=window),global.module=Module.prototype.moduleCache["/"]=new Module("/"),Module.prototype.normalise=function(a){var b,c,d,e,f;if(""===a)return this.id;for(d=a.split("/"),"."===d[0]||".."===d[0]?(e=this.id.split("/"),e.pop(),e=e.concat(d)):e=d,c=[],b=0;b "+require("internal").browserOutputBuffer,"jssuccess"),require("internal").browserOutputBuffer=""},$(global.document).ajaxSend(function(a,b,c){c.url=require("internal").arango.databasePrefix(c.url)}),global.DEFINE_MODULE=function(a,b){var c=Module.prototype.normalise(a),d=Module.prototype.moduleCache[c];d?Object.keys(d.exports).forEach(function(a){b[a]=d.exports[a]}):(d=new Module(c),Module.prototype.moduleCache[c]=d),d.exports=b}}(),module.define("underscore",function(a,b){(function(){function c(a){function b(b,c,d,e,f,g){for(;f>=0&&g>f;f+=a){var h=e?e[f]:f;d=c(d,b[h],h,b)}return d}return function(c,d,e,f){d=v(d,f,4);var g=!C(c)&&u.keys(c),h=(g||c).length,i=a>0?0:h-1;return arguments.length<3&&(e=c[g?g[i]:i],i+=a),b(c,d,e,g,i,h)}}function d(a){return function(b,c,d){c=w(c,d);for(var e=B(b),f=a>0?0:e-1;f>=0&&e>f;f+=a)if(c(b[f],f,b))return f;return-1}}function e(a,b,c){return function(d,e,f){var g=0,h=B(d);if("number"==typeof f)a>0?g=f>=0?f:Math.max(f+h,g):h=f>=0?Math.min(f+1,h):f+h+1;else if(c&&f&&h)return f=c(d,e),d[f]===e?f:-1;if(e!==e)return f=b(m.call(d,g,h),u.isNaN),f>=0?f+g:-1;for(f=a>0?g:h-1;f>=0&&h>f;f+=a)if(d[f]===e)return f;return-1}}function f(a,b){var c=H.length,d=a.constructor,e=u.isFunction(d)&&d.prototype||j,f="constructor";for(u.has(a,f)&&!u.contains(b,f)&&b.push(f);c--;)f=H[c],f in a&&a[f]!==e[f]&&!u.contains(b,f)&&b.push(f)}var g=this,h=g._,i=Array.prototype,j=Object.prototype,k=Function.prototype,l=i.push,m=i.slice,n=j.toString,o=j.hasOwnProperty,p=Array.isArray,q=Object.keys,r=k.bind,s=Object.create,t=function(){},u=function(a){return a instanceof u?a:this instanceof u?void(this._wrapped=a):new u(a)};"undefined"!=typeof a?("undefined"!=typeof b&&b.exports&&(a=b.exports=u),a._=u):g._=u,u.VERSION="1.8.3";var v=function(a,b,c){if(void 0===b)return a;switch(null==c?3:c){case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)}}return function(){return a.apply(b,arguments)}},w=function(a,b,c){return null==a?u.identity:u.isFunction(a)?v(a,b,c):u.isObject(a)?u.matcher(a):u.property(a)};u.iteratee=function(a,b){return w(a,b,1/0)};var x=function(a,b){return function(c){var d=arguments.length;if(2>d||null==c)return c;for(var e=1;d>e;e++)for(var f=arguments[e],g=a(f),h=g.length,i=0;h>i;i++){var j=g[i];b&&void 0!==c[j]||(c[j]=f[j])}return c}},y=function(a){if(!u.isObject(a))return{};if(s)return s(a);t.prototype=a;var b=new t;return t.prototype=null,b},z=function(a){return function(b){return null==b?void 0:b[a]}},A=Math.pow(2,53)-1,B=z("length"),C=function(a){var b=B(a);return"number"==typeof b&&b>=0&&A>=b};u.each=u.forEach=function(a,b,c){b=v(b,c);var d,e;if(C(a))for(d=0,e=a.length;e>d;d++)b(a[d],d,a);else{var f=u.keys(a);for(d=0,e=f.length;e>d;d++)b(a[f[d]],f[d],a)}return a},u.map=u.collect=function(a,b,c){b=w(b,c);for(var d=!C(a)&&u.keys(a),e=(d||a).length,f=Array(e),g=0;e>g;g++){var h=d?d[g]:g;f[g]=b(a[h],h,a)}return f},u.reduce=u.foldl=u.inject=c(1),u.reduceRight=u.foldr=c(-1),u.find=u.detect=function(a,b,c){var d;return d=C(a)?u.findIndex(a,b,c):u.findKey(a,b,c),void 0!==d&&-1!==d?a[d]:void 0},u.filter=u.select=function(a,b,c){var d=[];return b=w(b,c),u.each(a,function(a,c,e){b(a,c,e)&&d.push(a)}),d},u.reject=function(a,b,c){return u.filter(a,u.negate(w(b)),c)},u.every=u.all=function(a,b,c){b=w(b,c);for(var d=!C(a)&&u.keys(a),e=(d||a).length,f=0;e>f;f++){var g=d?d[f]:f;if(!b(a[g],g,a))return!1}return!0},u.some=u.any=function(a,b,c){b=w(b,c);for(var d=!C(a)&&u.keys(a),e=(d||a).length,f=0;e>f;f++){var g=d?d[f]:f;if(b(a[g],g,a))return!0}return!1},u.contains=u.includes=u.include=function(a,b,c,d){return C(a)||(a=u.values(a)),("number"!=typeof c||d)&&(c=0),u.indexOf(a,b,c)>=0},u.invoke=function(a,b){var c=m.call(arguments,2),d=u.isFunction(b);return u.map(a,function(a){var e=d?b:a[b];return null==e?e:e.apply(a,c)})},u.pluck=function(a,b){ return u.map(a,u.property(b))},u.where=function(a,b){return u.filter(a,u.matcher(b))},u.findWhere=function(a,b){return u.find(a,u.matcher(b))},u.max=function(a,b,c){var d,e,f=-(1/0),g=-(1/0);if(null==b&&null!=a){a=C(a)?a:u.values(a);for(var h=0,i=a.length;i>h;h++)d=a[h],d>f&&(f=d)}else b=w(b,c),u.each(a,function(a,c,d){e=b(a,c,d),(e>g||e===-(1/0)&&f===-(1/0))&&(f=a,g=e)});return f},u.min=function(a,b,c){var d,e,f=1/0,g=1/0;if(null==b&&null!=a){a=C(a)?a:u.values(a);for(var h=0,i=a.length;i>h;h++)d=a[h],f>d&&(f=d)}else b=w(b,c),u.each(a,function(a,c,d){e=b(a,c,d),(g>e||e===1/0&&f===1/0)&&(f=a,g=e)});return f},u.shuffle=function(a){for(var b,c=C(a)?a:u.values(a),d=c.length,e=Array(d),f=0;d>f;f++)b=u.random(0,f),b!==f&&(e[f]=e[b]),e[b]=c[f];return e},u.sample=function(a,b,c){return null==b||c?(C(a)||(a=u.values(a)),a[u.random(a.length-1)]):u.shuffle(a).slice(0,Math.max(0,b))},u.sortBy=function(a,b,c){return b=w(b,c),u.pluck(u.map(a,function(a,c,d){return{value:a,index:c,criteria:b(a,c,d)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var D=function(a){return function(b,c,d){var e={};return c=w(c,d),u.each(b,function(d,f){var g=c(d,f,b);a(e,d,g)}),e}};u.groupBy=D(function(a,b,c){u.has(a,c)?a[c].push(b):a[c]=[b]}),u.indexBy=D(function(a,b,c){a[c]=b}),u.countBy=D(function(a,b,c){u.has(a,c)?a[c]++:a[c]=1}),u.toArray=function(a){return a?u.isArray(a)?m.call(a):C(a)?u.map(a,u.identity):u.values(a):[]},u.size=function(a){return null==a?0:C(a)?a.length:u.keys(a).length},u.partition=function(a,b,c){b=w(b,c);var d=[],e=[];return u.each(a,function(a,c,f){(b(a,c,f)?d:e).push(a)}),[d,e]},u.first=u.head=u.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:u.initial(a,a.length-b)},u.initial=function(a,b,c){return m.call(a,0,Math.max(0,a.length-(null==b||c?1:b)))},u.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:u.rest(a,Math.max(0,a.length-b))},u.rest=u.tail=u.drop=function(a,b,c){return m.call(a,null==b||c?1:b)},u.compact=function(a){return u.filter(a,u.identity)};var E=function(a,b,c,d){for(var e=[],f=0,g=d||0,h=B(a);h>g;g++){var i=a[g];if(C(i)&&(u.isArray(i)||u.isArguments(i))){b||(i=E(i,b,c));var j=0,k=i.length;for(e.length+=k;k>j;)e[f++]=i[j++]}else c||(e[f++]=i)}return e};u.flatten=function(a,b){return E(a,b,!1)},u.without=function(a){return u.difference(a,m.call(arguments,1))},u.uniq=u.unique=function(a,b,c,d){u.isBoolean(b)||(d=c,c=b,b=!1),null!=c&&(c=w(c,d));for(var e=[],f=[],g=0,h=B(a);h>g;g++){var i=a[g],j=c?c(i,g,a):i;b?(g&&f===j||e.push(i),f=j):c?u.contains(f,j)||(f.push(j),e.push(i)):u.contains(e,i)||e.push(i)}return e},u.union=function(){return u.uniq(E(arguments,!0,!0))},u.intersection=function(a){for(var b=[],c=arguments.length,d=0,e=B(a);e>d;d++){var f=a[d];if(!u.contains(b,f)){for(var g=1;c>g&&u.contains(arguments[g],f);g++);g===c&&b.push(f)}}return b},u.difference=function(a){var b=E(arguments,!0,!0,1);return u.filter(a,function(a){return!u.contains(b,a)})},u.zip=function(){return u.unzip(arguments)},u.unzip=function(a){for(var b=a&&u.max(a,B).length||0,c=Array(b),d=0;b>d;d++)c[d]=u.pluck(a,d);return c},u.object=function(a,b){for(var c={},d=0,e=B(a);e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},u.findIndex=d(1),u.findLastIndex=d(-1),u.sortedIndex=function(a,b,c,d){c=w(c,d,1);for(var e=c(b),f=0,g=B(a);g>f;){var h=Math.floor((f+g)/2);c(a[h])f;f++,a+=c)e[f]=a;return e};var F=function(a,b,c,d,e){if(!(d instanceof b))return a.apply(c,e);var f=y(a.prototype),g=a.apply(f,e);return u.isObject(g)?g:f};u.bind=function(a,b){if(r&&a.bind===r)return r.apply(a,m.call(arguments,1));if(!u.isFunction(a))throw new TypeError("Bind must be called on a function");var c=m.call(arguments,2),d=function(){return F(a,d,b,this,c.concat(m.call(arguments)))};return d},u.partial=function(a){var b=m.call(arguments,1),c=function(){for(var d=0,e=b.length,f=Array(e),g=0;e>g;g++)f[g]=b[g]===u?arguments[d++]:b[g];for(;d=d)throw new Error("bindAll must be passed function names");for(b=1;d>b;b++)c=arguments[b],a[c]=u.bind(a[c],a);return a},u.memoize=function(a,b){var c=function(d){var e=c.cache,f=""+(b?b.apply(this,arguments):d);return u.has(e,f)||(e[f]=a.apply(this,arguments)),e[f]};return c.cache={},c},u.delay=function(a,b){var c=m.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},u.defer=u.partial(u.delay,u,1),u.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:u.now(),g=null,f=a.apply(d,e),g||(d=e=null)};return function(){var j=u.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k||k>b?(g&&(clearTimeout(g),g=null),h=j,f=a.apply(d,e),g||(d=e=null)):g||c.trailing===!1||(g=setTimeout(i,k)),f}},u.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=u.now()-g;b>j&&j>=0?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),d||(f=e=null)))};return function(){f=this,e=arguments,g=u.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},u.wrap=function(a,b){return u.partial(b,a)},u.negate=function(a){return function(){return!a.apply(this,arguments)}},u.compose=function(){var a=arguments,b=a.length-1;return function(){for(var c=b,d=a[b].apply(this,arguments);c--;)d=a[c].call(this,d);return d}},u.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},u.before=function(a,b){var c;return function(){return--a>0&&(c=b.apply(this,arguments)),1>=a&&(b=null),c}},u.once=u.partial(u.before,2);var G=!{toString:null}.propertyIsEnumerable("toString"),H=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];u.keys=function(a){if(!u.isObject(a))return[];if(q)return q(a);var b=[];for(var c in a)u.has(a,c)&&b.push(c);return G&&f(a,b),b},u.allKeys=function(a){if(!u.isObject(a))return[];var b=[];for(var c in a)b.push(c);return G&&f(a,b),b},u.values=function(a){for(var b=u.keys(a),c=b.length,d=Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},u.mapObject=function(a,b,c){b=w(b,c);for(var d,e=u.keys(a),f=e.length,g={},h=0;f>h;h++)d=e[h],g[d]=b(a[d],d,a);return g},u.pairs=function(a){for(var b=u.keys(a),c=b.length,d=Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},u.invert=function(a){for(var b={},c=u.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},u.functions=u.methods=function(a){var b=[];for(var c in a)u.isFunction(a[c])&&b.push(c);return b.sort()},u.extend=x(u.allKeys),u.extendOwn=u.assign=x(u.keys),u.findKey=function(a,b,c){b=w(b,c);for(var d,e=u.keys(a),f=0,g=e.length;g>f;f++)if(d=e[f],b(a[d],d,a))return d},u.pick=function(a,b,c){var d,e,f={},g=a;if(null==g)return f;u.isFunction(b)?(e=u.allKeys(g),d=v(b,c)):(e=E(arguments,!1,!1,1),d=function(a,b,c){return b in c},g=Object(g));for(var h=0,i=e.length;i>h;h++){var j=e[h],k=g[j];d(k,j,g)&&(f[j]=k)}return f},u.omit=function(a,b,c){if(u.isFunction(b))b=u.negate(b);else{var d=u.map(E(arguments,!1,!1,1),String);b=function(a,b){return!u.contains(d,b)}}return u.pick(a,b,c)},u.defaults=x(u.allKeys,!0),u.create=function(a,b){var c=y(a);return b&&u.extendOwn(c,b),c},u.clone=function(a){return u.isObject(a)?u.isArray(a)?a.slice():u.extend({},a):a},u.tap=function(a,b){return b(a),a},u.isMatch=function(a,b){var c=u.keys(b),d=c.length;if(null==a)return!d;for(var e=Object(a),f=0;d>f;f++){var g=c[f];if(b[g]!==e[g]||!(g in e))return!1}return!0};var I=function(a,b,c,d){if(a===b)return 0!==a||1/a===1/b;if(null==a||null==b)return a===b;a instanceof u&&(a=a._wrapped),b instanceof u&&(b=b._wrapped);var e=n.call(a);if(e!==n.call(b))return!1;switch(e){case"[object RegExp]":case"[object String]":return""+a==""+b;case"[object Number]":return+a!==+a?+b!==+b:0===+a?1/+a===1/b:+a===+b;case"[object Date]":case"[object Boolean]":return+a===+b}var f="[object Array]"===e;if(!f){if("object"!=typeof a||"object"!=typeof b)return!1;var g=a.constructor,h=b.constructor;if(g!==h&&!(u.isFunction(g)&&g instanceof g&&u.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1}c=c||[],d=d||[];for(var i=c.length;i--;)if(c[i]===a)return d[i]===b;if(c.push(a),d.push(b),f){if(i=a.length,i!==b.length)return!1;for(;i--;)if(!I(a[i],b[i],c,d))return!1}else{var j,k=u.keys(a);if(i=k.length,u.keys(b).length!==i)return!1;for(;i--;)if(j=k[i],!u.has(b,j)||!I(a[j],b[j],c,d))return!1}return c.pop(),d.pop(),!0};u.isEqual=function(a,b){return I(a,b)},u.isEmpty=function(a){return null==a?!0:C(a)&&(u.isArray(a)||u.isString(a)||u.isArguments(a))?0===a.length:0===u.keys(a).length},u.isElement=function(a){return!(!a||1!==a.nodeType)},u.isArray=p||function(a){return"[object Array]"===n.call(a)},u.isObject=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a},u.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(a){u["is"+a]=function(b){return n.call(b)==="[object "+a+"]"}}),u.isArguments(arguments)||(u.isArguments=function(a){return u.has(a,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(u.isFunction=function(a){return"function"==typeof a||!1}),u.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},u.isNaN=function(a){return u.isNumber(a)&&a!==+a},u.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"===n.call(a)},u.isNull=function(a){return null===a},u.isUndefined=function(a){return void 0===a},u.has=function(a,b){return null!=a&&o.call(a,b)},u.noConflict=function(){return g._=h,this},u.identity=function(a){return a},u.constant=function(a){return function(){return a}},u.noop=function(){},u.property=z,u.propertyOf=function(a){return null==a?function(){}:function(b){return a[b]}},u.matcher=u.matches=function(a){return a=u.extendOwn({},a),function(b){return u.isMatch(b,a)}},u.times=function(a,b,c){var d=Array(Math.max(0,a));b=v(b,c,1);for(var e=0;a>e;e++)d[e]=b(e);return d},u.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},u.now=Date.now||function(){return(new Date).getTime()};var J={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},K=u.invert(J),L=function(a){var b=function(b){return a[b]},c="(?:"+u.keys(a).join("|")+")",d=RegExp(c),e=RegExp(c,"g");return function(a){return a=null==a?"":""+a,d.test(a)?a.replace(e,b):a}};u.escape=L(J),u.unescape=L(K),u.result=function(a,b,c){var d=null==a?void 0:a[b];return void 0===d&&(d=c),u.isFunction(d)?d.call(a):d};var M=0;u.uniqueId=function(a){var b=++M+"";return a?a+b:b},u.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var N=/(.)^/,O={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},P=/\\|'|\r|\n|\u2028|\u2029/g,Q=function(a){return"\\"+O[a]};u.template=function(a,b,c){!b&&c&&(b=c),b=u.defaults({},b,u.templateSettings);var d=RegExp([(b.escape||N).source,(b.interpolate||N).source,(b.evaluate||N).source].join("|")+"|$","g"),e=0,f="__p+='";a.replace(d,function(b,c,d,g,h){return f+=a.slice(e,h).replace(P,Q),e=h+b.length,c?f+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'":d?f+="'+\n((__t=("+d+"))==null?'':__t)+\n'":g&&(f+="';\n"+g+"\n__p+='"),b}),f+="';\n",b.variable||(f="with(obj||{}){\n"+f+"}\n"),f="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+f+"return __p;\n";try{var g=new Function(b.variable||"obj","_",f)}catch(h){throw h.source=f,h}var i=function(a){return g.call(this,a,u)},j=b.variable||"obj";return i.source="function("+j+"){\n"+f+"}",i},u.chain=function(a){var b=u(a);return b._chain=!0,b};var R=function(a,b){return a._chain?u(b).chain():b};u.mixin=function(a){u.each(u.functions(a),function(b){var c=u[b]=a[b];u.prototype[b]=function(){var a=[this._wrapped];return l.apply(a,arguments),R(this,c.apply(u,a))}})},u.mixin(u),u.each(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=i[a];u.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!==a&&"splice"!==a||0!==c.length||delete c[0],R(this,c)}}),u.each(["concat","join","slice"],function(a){var b=i[a];u.prototype[a]=function(){return R(this,b.apply(this._wrapped,arguments))}}),u.prototype.value=function(){return this._wrapped},u.prototype.valueOf=u.prototype.toJSON=u.prototype.value,u.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return u})}).call(this)}),global.DEFINE_MODULE("internal",function(){"use strict";function a(a){if(i.hasOwnProperty(a))return i[a];var b,c=a.charCodeAt(0);return b=16>c?"\\u000":256>c?"\\u00":4096>c?"\\u0":"\\u",b+=c.toString(16),i[a]=b,b}function b(b){return'"'+b.replace(n,a)+'"'}function c(a){var b,c="";if(a.prettyPrint)for(c+="\n",b=0;b=b.emit&&(h.output(b.output),b.output=""),b.path=i,f=", "}b.level=e-1,b.output+=" ",c(b),d&&(b.output+=j.COLOR_PUNCTUATION),b.output+="]",d&&(b.output+=j.COLOR_RESET)}}function e(a,d){var e=d.useColor,f=" ";e&&(d.output+=j.COLOR_PUNCTUATION),d.output+="{",e&&(d.output+=j.COLOR_RESET);var g=d.level+1;d.level=g;var i;try{i=Object.keys(a)}catch(k){i=[]}for(var l=0,n=i.length;n>l;++l){var o=i[l],p=a[o];e&&(d.output+=j.COLOR_PUNCTUATION),d.output+=f,e&&(d.output+=j.COLOR_RESET),c(d),e&&(d.output+=j.COLOR_INDEX),d.output+=b(o),e&&(d.output+=j.COLOR_RESET),d.output+=" : ";var q=d.path;d.path+="["+o+"]",m(p,d),d.path=q,f=", ",d.emit&&d.output.length>=d.emit&&(h.output(d.output),d.output="")}d.level=g-1,d.output+=" ",c(d),e&&(d.output+=j.COLOR_PUNCTUATION),d.output+="}",e&&(d.output+=j.COLOR_RESET)}function f(){for(var a=0;a0&&a(" "),"string"==typeof arguments[b])a(arguments[b]);else{var c={customInspect:!0,emit:16384,level:0,limitString:g.limitString,names:[],output:"",path:"~",prettyPrint:l,seen:[],showFunction:!1,useColor:k,useToString:!0};m(arguments[b],c),a(c.output)}a("\n")}var h={};global.ArangoError?(h.ArangoError=global.ArangoError,delete global.ArangoError):(h.ArangoError=function(a){void 0!==a&&(this.error=a.error,this.code=a.code,this.errorNum=a.errorNum,this.errorMessage=a.errorMessage)},h.ArangoError.prototype=new Error),h.ArangoError.prototype.isArangoError=!0,Object.defineProperty(h.ArangoError.prototype,"message",{configurable:!0,enumerable:!0,get:function(){return this.errorMessage}}),h.ArangoError.prototype.name="ArangoError",h.ArangoError.prototype._PRINT=function(a){a.output+="["+this.toString()+"]"},h.ArangoError.prototype.toString=function(){return this.name+" "+this.errorNum+": "+this.message},h.threadNumber=0,global.THREAD_NUMBER&&(h.threadNumber=global.THREAD_NUMBER,delete global.THREAD_NUMBER),h.developmentMode=!1,h.quiet=!1,global.ARANGO_QUIET&&(h.quiet=global.ARANGO_QUIET,delete global.ARANGO_QUIET),h.valgrind=!1,global.VALGRIND&&(h.valgrind=global.VALGRIND,delete global.VALGRIND),h.coverage=!1,global.COVERAGE&&(h.coverage=global.COVERAGE,delete global.COVERAGE),h.version="unknown",global.VERSION&&(h.version=global.VERSION,delete global.VERSION),h.platform="unknown",global.SYS_PLATFORM&&(h.platform=global.SYS_PLATFORM,delete global.SYS_PLATFORM),h.bytesSentDistribution=[],global.BYTES_SENT_DISTRIBUTION&&(h.bytesSentDistribution=global.BYTES_SENT_DISTRIBUTION,delete global.BYTES_SENT_DISTRIBUTION),h.bytesReceivedDistribution=[],global.BYTES_RECEIVED_DISTRIBUTION&&(h.bytesReceivedDistribution=global.BYTES_RECEIVED_DISTRIBUTION,delete global.BYTES_RECEIVED_DISTRIBUTION),h.connectionTimeDistribution=[],global.CONNECTION_TIME_DISTRIBUTION&&(h.connectionTimeDistribution=global.CONNECTION_TIME_DISTRIBUTION,delete global.CONNECTION_TIME_DISTRIBUTION),h.requestTimeDistribution=[],global.REQUEST_TIME_DISTRIBUTION&&(h.requestTimeDistribution=global.REQUEST_TIME_DISTRIBUTION,delete global.REQUEST_TIME_DISTRIBUTION),h.startupPath="",global.STARTUP_PATH&&(h.startupPath=global.STARTUP_PATH,delete global.STARTUP_PATH),""===h.startupPath&&(h.startupPath="."),global.CONFIGURE_ENDPOINT&&(h.configureEndpoint=global.CONFIGURE_ENDPOINT,delete global.CONFIGURE_ENDPOINT),global.REMOVE_ENDPOINT&&(h.removeEndpoint=global.REMOVE_ENDPOINT,delete global.REMOVE_ENDPOINT),global.LIST_ENDPOINTS&&(h.listEndpoints=global.LIST_ENDPOINTS,delete global.LIST_ENDPOINTS),global.SYS_BASE64DECODE&&(h.base64Decode=global.SYS_BASE64DECODE,delete global.SYS_BASE64DECODE),global.SYS_BASE64ENCODE&&(h.base64Encode=global.SYS_BASE64ENCODE,delete global.SYS_BASE64ENCODE),global.SYS_DEBUG_SEGFAULT&&(h.debugSegfault=global.SYS_DEBUG_SEGFAULT,delete global.SYS_DEBUG_SEGFAULT),global.SYS_DEBUG_SET_FAILAT&&(h.debugSetFailAt=global.SYS_DEBUG_SET_FAILAT,delete global.SYS_DEBUG_SET_FAILAT),global.SYS_DEBUG_REMOVE_FAILAT&&(h.debugRemoveFailAt=global.SYS_DEBUG_REMOVE_FAILAT,delete global.SYS_DEBUG_REMOVE_FAILAT),global.SYS_DEBUG_CLEAR_FAILAT&&(h.debugClearFailAt=global.SYS_DEBUG_CLEAR_FAILAT,delete global.SYS_DEBUG_CLEAR_FAILAT),global.SYS_DEBUG_CAN_USE_FAILAT&&(h.debugCanUseFailAt=global.SYS_DEBUG_CAN_USE_FAILAT,delete global.SYS_DEBUG_CAN_USE_FAILAT),global.SYS_DOWNLOAD&&(h.download=global.SYS_DOWNLOAD,delete global.SYS_DOWNLOAD),global.SYS_EXECUTE&&(h.executeScript=global.SYS_EXECUTE,delete global.SYS_EXECUTE),global.SYS_GET_CURRENT_REQUEST&&(h.getCurrentRequest=global.SYS_GET_CURRENT_REQUEST,delete global.SYS_GET_CURRENT_REQUEST),global.SYS_GET_CURRENT_RESPONSE&&(h.getCurrentResponse=global.SYS_GET_CURRENT_RESPONSE,delete global.SYS_GET_CURRENT_RESPONSE),h.extend=function(a,b){return Object.getOwnPropertyNames(b).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))}),a},global.SYS_LOAD&&(h.load=global.SYS_LOAD,delete global.SYS_LOAD),global.SYS_LOG_LEVEL&&(h.logLevel=global.SYS_LOG_LEVEL,delete global.SYS_LOG_LEVEL),global.SYS_MD5&&(h.md5=global.SYS_MD5,delete global.SYS_MD5),global.SYS_GEN_RANDOM_NUMBERS&&(h.genRandomNumbers=global.SYS_GEN_RANDOM_NUMBERS,delete global.SYS_GEN_RANDOM_NUMBERS),global.SYS_GEN_RANDOM_ALPHA_NUMBERS&&(h.genRandomAlphaNumbers=global.SYS_GEN_RANDOM_ALPHA_NUMBERS,delete global.SYS_GEN_RANDOM_ALPHA_NUMBERS),global.SYS_GEN_RANDOM_SALT&&(h.genRandomSalt=global.SYS_GEN_RANDOM_SALT,delete global.SYS_GEN_RANDOM_SALT),global.SYS_HMAC&&(h.hmac=global.SYS_HMAC,delete global.SYS_HMAC),global.SYS_PBKDF2&&(h.pbkdf2=global.SYS_PBKDF2,delete global.SYS_PBKDF2),global.SYS_CREATE_NONCE&&(h.createNonce=global.SYS_CREATE_NONCE,delete global.SYS_CREATE_NONCE),global.SYS_CHECK_AND_MARK_NONCE&&(h.checkAndMarkNonce=global.SYS_CHECK_AND_MARK_NONCE,delete global.SYS_CHECK_AND_MARK_NONCE),global.SYS_OUTPUT&&(h.stdOutput=global.SYS_OUTPUT,h.output=h.stdOutput,delete global.SYS_OUTPUT),global.SYS_PARSE&&(h.parse=global.SYS_PARSE,delete global.SYS_PARSE),global.SYS_PARSE_FILE&&(h.parseFile=global.SYS_PARSE_FILE,delete global.SYS_PARSE_FILE),global.SYS_PROCESS_STATISTICS&&(h.processStatistics=global.SYS_PROCESS_STATISTICS,delete global.SYS_PROCESS_STATISTICS),global.SYS_RAND&&(h.rand=global.SYS_RAND,delete global.SYS_RAND),global.SYS_SHA512&&(h.sha512=global.SYS_SHA512,delete global.SYS_SHA512),global.SYS_SHA384&&(h.sha384=global.SYS_SHA384,delete global.SYS_SHA384),global.SYS_SHA256&&(h.sha256=global.SYS_SHA256,delete global.SYS_SHA256),global.SYS_SHA224&&(h.sha224=global.SYS_SHA224,delete global.SYS_SHA224),global.SYS_SHA1&&(h.sha1=global.SYS_SHA1,delete global.SYS_SHA1),global.SYS_SERVER_STATISTICS&&(h.serverStatistics=global.SYS_SERVER_STATISTICS,delete global.SYS_SERVER_STATISTICS),global.SYS_SLEEP&&(h.sleep=global.SYS_SLEEP,delete global.SYS_SLEEP),global.SYS_TIME&&(h.time=global.SYS_TIME,delete global.SYS_TIME),global.SYS_WAIT&&(h.wait=global.SYS_WAIT,delete global.SYS_WAIT),global.SYS_IMPORT_CSV_FILE&&(h.importCsvFile=global.SYS_IMPORT_CSV_FILE,delete global.SYS_IMPORT_CSV_FILE),global.SYS_IMPORT_JSON_FILE&&(h.importJsonFile=global.SYS_IMPORT_JSON_FILE,delete global.SYS_IMPORT_JSON_FILE),global.SYS_PROCESS_CSV_FILE&&(h.processCsvFile=global.SYS_PROCESS_CSV_FILE,delete global.SYS_PROCESS_CSV_FILE),global.SYS_PROCESS_JSON_FILE&&(h.processJsonFile=global.SYS_PROCESS_JSON_FILE,delete global.SYS_PROCESS_JSON_FILE),global.SYS_CLIENT_STATISTICS&&(h.clientStatistics=global.SYS_CLIENT_STATISTICS,delete global.SYS_CLIENT_STATISTICS),global.SYS_HTTP_STATISTICS&&(h.httpStatistics=global.SYS_HTTP_STATISTICS,delete global.SYS_HTTP_STATISTICS),global.SYS_EXECUTE_EXTERNAL&&(h.executeExternal=global.SYS_EXECUTE_EXTERNAL,delete global.SYS_EXECUTE_EXTERNAL),global.SYS_EXECUTE_EXTERNAL_AND_WAIT&&(h.executeExternalAndWait=global.SYS_EXECUTE_EXTERNAL_AND_WAIT,delete global.SYS_EXECUTE_EXTERNAL_AND_WAIT),global.SYS_KILL_EXTERNAL&&(h.killExternal=global.SYS_KILL_EXTERNAL,delete global.SYS_KILL_EXTERNAL),global.SYS_STATUS_EXTERNAL&&(h.statusExternal=global.SYS_STATUS_EXTERNAL,delete global.SYS_STATUS_EXTERNAL),global.SYS_REGISTER_TASK&&(h.registerTask=global.SYS_REGISTER_TASK,delete global.SYS_REGISTER_TASK),global.SYS_UNREGISTER_TASK&&(h.unregisterTask=global.SYS_UNREGISTER_TASK,delete global.SYS_UNREGISTER_TASK),global.SYS_GET_TASK&&(h.getTask=global.SYS_GET_TASK,delete global.SYS_GET_TASK),global.SYS_TEST_PORT&&(h.testPort=global.SYS_TEST_PORT,delete global.SYS_TEST_PORT),global.SYS_IS_IP&&(h.isIP=global.SYS_IS_IP,delete global.SYS_IS_IP),h.unitTests=function(){return global.SYS_UNIT_TESTS},h.setUnitTestsResult=function(a){global.SYS_UNIT_TESTS_RESULT=a},h.toArgv=function(a,b){"undefined"==typeof b&&(b=!1);var c=[];for(var d in a)if(a.hasOwnProperty(d))if("commandSwitches"===d){for(var e="",f=0;f1?c.push(a[d][f]):e+=a[d][f];e.length>0&&c.push(e)}else"flatCommands"===d?c=c.concat(a[d]):b?c.push("--"+d+"="+a[d]):(c.push("--"+d),a[d]!==!1?a[d]!==!0?c.push(a[d]):c.push("true"):c.push("false"));return c},h.parseArgv=function(a,b){function c(b,d,e){if(d.indexOf(":")>0){var f=d.indexOf(":"),h=d.slice(0,f);b.hasOwnProperty(h)||(b[h]={}),c(b[h],d.slice(f+1,d.length),e)}else"true"===a[g+1]?b[d]=!0:"false"===a[g+1]?b[d]=!1:isNaN(a[g+1])?b[d]=a[g+1]:b[d]=parseInt(a[g+1])}function d(a,b){a.hasOwnProperty("commandSwitches")||(a.commandSwitches=[]),a.commandSwitches.push(b)}function e(a,b){for(var c=0;c2&&"--"===j.slice(0,2)){var k=j.slice(2,j.length);a.length>g&&"-"!==a[g+1].slice(0,1)?(c(i,k,a[g+1]),g++):d(i,k)}else"--"===j?h=!0:j.length>1&&"-"===j.slice(0,1)?e(i,j.slice(1,j.length)):f(i,j)}return i},h.COLORS={},global.COLORS?(h.COLORS=global.COLORS,delete global.COLORS):["COLOR_RED","COLOR_BOLD_RED","COLOR_GREEN","COLOR_BOLD_GREEN","COLOR_BLUE","COLOR_BOLD_BLUE","COLOR_YELLOW","COLOR_BOLD_YELLOW","COLOR_WHITE","COLOR_BOLD_WHITE","COLOR_CYAN","COLOR_BOLD_CYAN","COLOR_MAGENTA","COLOR_BOLD_MAGENTA","COLOR_BLACK","COLOR_BOLD_BLACK","COLOR_BLINK","COLOR_BRIGHT","COLOR_RESET"].forEach(function(a){h.COLORS[a]=""}),h.COLORS.COLOR_PUNCTUATION=h.COLORS.COLOR_RESET,h.COLORS.COLOR_STRING=h.COLORS.COLOR_BRIGHT,h.COLORS.COLOR_NUMBER=h.COLORS.COLOR_BRIGHT,h.COLORS.COLOR_INDEX=h.COLORS.COLOR_BRIGHT,h.COLORS.COLOR_TRUE=h.COLORS.COLOR_BRIGHT,h.COLORS.COLOR_FALSE=h.COLORS.COLOR_BRIGHT,h.COLORS.COLOR_NULL=h.COLORS.COLOR_BRIGHT,h.COLORS.COLOR_UNDEFINED=h.COLORS.COLOR_BRIGHT;var i={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},j=h.COLORS,k=!1;global.COLOR_OUTPUT&&(k=global.COLOR_OUTPUT,delete global.COLOR_OUTPUT);var l=!1;global.PRETTY_PRINT&&(l=global.PRETTY_PRINT,delete global.PRETTY_PRINT);var m,n=/[\\\"\x00-\x1f]/g,o=/function ([^\(]*)?\(\) \{ \[native code\] \}/,p=/function ([^\(]*)?\((.*)\) \{/;h.printRecursive=m=function(a,c){var f=c.useColor,g=c.customInspect,i=c.useToString,k=c.limitString,l=c.showFunction;"undefined"==typeof c.seen&&(c.seen=[],c.names=[]);var m=c.seen.indexOf(a);if(m>=0)c.output+=c.names[m];else if(a&&(a instanceof Object||"object"==typeof a&&null===Object.getPrototypeOf(a)))if(c.seen.push(a),c.names.push(c.path),g&&"function"==typeof a._PRINT)a._PRINT(c),c.emit&&c.output.length>=c.emit&&(h.output(c.output),c.output="");else if(a instanceof Array)d(a,c);else if(a.toString===Object.prototype.toString||"object"==typeof a&&null===Object.getPrototypeOf(a)){var n=!1;try{(a instanceof Set||a instanceof Map||a instanceof WeakSet||a instanceof WeakMap||"function"==typeof a[Symbol.iterator])&&(c.output+=a.toString(),n=!0)}catch(q){}n||e(a,c),c.emit&&c.output.length>=c.emit&&(h.output(c.output),c.output="")}else if("function"==typeof a)try{var r=a.toString();if(c.level>0&&!l){var s=r.split("\n"),t=s[0],u=o.exec(t);null!==u?void 0===u[1]?c.output+="function { [native code] }":c.output+="function "+u[1]+" { [native code] }":(u=p.exec(t),null!==u?void 0===u[1]?c.output+="function ("+u[2]+") { ... }":c.output+="function "+u[1]+" ("+u[2]+") { ... }":(t=t.substr(8,t.length-10).trim(),c.output+='[Function "'+t+'" ...]'))}else c.output+=r}catch(v){h.stdOutput(String(v)),c.output+="[Function]"}else if(i&&"function"==typeof a.toString)try{c.output+=a.toString()}catch(w){c.output+="[Object ",e(a,c),c.output+="]"}else c.output+="[Object ",e(a,c),c.output+="]";else void 0===a?(f&&(c.output+=j.COLOR_UNDEFINED),c.output+="undefined",f&&(c.output+=j.COLOR_RESET)):"string"==typeof a?(f&&(c.output+=j.COLOR_STRING),k&&k0&&a(" "),"string"==typeof arguments[c])a(arguments[c]);else{var d={names:[],seen:[],path:"~",level:0,output:"",prettyPrint:!1,useColor:!1,customInspect:!0};b(arguments[c],d),a(d.output)}a("\n")},global.start_pretty_print=function(){require("internal").startPrettyPrint()},global.stop_pretty_print=function(){require("internal").stopPrettyPrint()},global.start_color_print=function(a){require("internal").startColorPrint(a,!1)},global.stop_color_print=function(){require("internal").stopColorPrint()},global.EXPORTS_SLOW_BUFFER&&(Object.keys(global.EXPORTS_SLOW_BUFFER).forEach(function(a){h[a]=global.EXPORTS_SLOW_BUFFER[a]}),delete global.EXPORTS_SLOW_BUFFER),global.APP_PATH&&(h.appPath=global.APP_PATH,delete global.APP_PATH),h}()),function(){"use strict";var a=require("internal");a.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:1e3,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:2e3,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:3e3,message:"malformed manifest file"},ERROR_INVALID_APPLICATION_MANIFEST:{code:3001,message:"manifest file is invalid"},ERROR_INVALID_FOXX_OPTIONS:{code:3004,message:"invalid foxx options"},ERROR_INVALID_MOUNTPOINT:{code:3007,message:"mountpoint is invalid"},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_FAILURE:{code:3103,message:"failed to invoke module"},RESULT_ELEMENT_EXISTS:{code:1e4,message:"element not inserted into structure, because it already exists"},RESULT_ELEMENT_NOT_FOUND:{code:10001,message:"element not found in structure"},ERROR_QUEUE_ALREADY_EXISTS:{code:21e3,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"}}}(),global.DEFINE_MODULE("console",function(){"use strict";function a(a,b){j(a,h+b)}function b(a){var b=require("internal").ShapedJson,c=[];a.length>0&&"string"!=typeof a[0]&&c.push("%s");for(var d=0;d curl ","POST"===e?(i=a.arango.POST_RAW(f,g,h),j+="-X "+e+" "):"PUT"===e?(i=a.arango.PUT_RAW(f,g,h),j+="-X "+e+" "):"GET"===e?i=a.arango.GET_RAW(f,h):"DELETE"===e?(i=a.arango.DELETE_RAW(f,h),j+="-X "+e+" "):"PATCH"===e?(i=a.arango.PATCH_RAW(f,g,h),j+="-X "+e+" "):"HEAD"===e?(i=a.arango.HEAD_RAW(f,h),j+="-X "+e+" "):"OPTION"===e&&(i=a.arango.OPTION_RAW(f,g,h),j+="-X "+e+" "),void 0!==h&&""!==h)for(k in h)h.hasOwnProperty(k)&&(j+="--header '"+k+": "+h[k]+"' ");return void 0!==g&&""!==g&&(j+="--data-binary @- "),j+="--dump - http://localhost:8529"+f,b(j),void 0!==g&&""!==g&&g&&(d(" <<EOF\n"),l?c(g):d(g),d("\nEOF")),d("\n\n"),i}},a.appendRawResponse=function(b,c){return function(d){var e,f=d.headers;b("HTTP/1.1 "+f["http/1.1"]+"\n");for(e in f)f.hasOwnProperty(e)&&"http/1.1"!==e&&"server"!==e&&"connection"!==e&&"content-length"!==e&&b(e+": "+f[e]+"\n");b("\n"),void 0!==d.body&&(c(a.inspect(d.body)),b("\n"))}},a.appendJsonResponse=function(b,c){return function(b){var d=a.appendRawResponse(c,c),e=b.body;b.body=JSON.parse(b.body),d(b),b.body=e}},a.log=function(b,c){a.output(b,": ",c,"\n")};try{"undefined"!=typeof window&&(a.sprintf=function(a){var b=arguments.length;if(0===b)return"";if(1>=b)return String(a);var c,d=[];for(c=1;c col = db.mycoll; \n > col = db._create("mycoll"); \n \nAdministration Functions: \n name() collection name \n status() status of the collection \n type() type of the collection \n truncate() delete all documents \n properties() show collection properties \n drop() delete a collection \n load() load a collection \n unload() unload a collection \n rename() renames a collection \n getIndexes() return defined indexes \n refresh() refreshes the status and name \n _help() this help \n \nDocument Functions: \n count() return number of documents \n save() create document and return handle \n document() get document by handle (_id or _key)\n replace(, , ) overwrite document \n update(, , , partially update document \n ) \n remove() delete document \n exists() checks whether a document exists \n first() first inserted/updated document \n last() last inserted/updated document \n \nAttributes: \n _database database object \n _id collection identifier ';d.prototype._help=function(){e.print(h)},d.prototype.name=function(){return null===this._name&&this.refresh(),this._name},d.prototype.status=function(){var a;return null===this._status&&this.refresh(),a=this._status,this._status===d.STATUS_UNLOADING&&(this._status=null),a},d.prototype.type=function(){return null===this._type&&this.refresh(),this._type},d.prototype.properties=function(a){var b,c,d={doCompact:!0,journalSize:!0,isSystem:!1,isVolatile:!1,waitForSync:!0,shardKeys:!1,numberOfShards:!1,keyOptions:!1,indexBuckets:!0};if(void 0===a)c=this._database._connection.GET(this._baseurl("properties")),f.checkRequestResult(c);else{var e={};for(b in d)d.hasOwnProperty(b)&&d[b]&&a.hasOwnProperty(b)&&(e[b]=a[b]);c=this._database._connection.PUT(this._baseurl("properties"),JSON.stringify(e)),f.checkRequestResult(c)}var g={};for(b in d)d.hasOwnProperty(b)&&c.hasOwnProperty(b)&&void 0!==c[b]&&(g[b]=c[b]);return g},d.prototype.rotate=function(){var a=this._database._connection.PUT(this._baseurl("rotate"),"");return f.checkRequestResult(a),a.result},d.prototype.figures=function(){var a=this._database._connection.GET(this._baseurl("figures"));return f.checkRequestResult(a),a.figures},d.prototype.checksum=function(a,b){var c="";a&&(c+="?withRevisions=true"),b&&(c+=(""===c?"?":"&")+"withData=true");var d=this._database._connection.GET(this._baseurl("checksum")+c);return f.checkRequestResult(d),{checksum:d.checksum,revision:d.revision}},d.prototype.revision=function(){var a=this._database._connection.GET(this._baseurl("revision")); -return f.checkRequestResult(a),a.revision},d.prototype.drop=function(){var a=this._database._connection.DELETE(this._baseurl());null!==a&&a.error===!0&&a.errorNum!==e.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code&&f.checkRequestResult(a),this._status=d.STATUS_DELETED;var b,c=this._database;for(b in c)if(c.hasOwnProperty(b)){var g=c[b];g instanceof d&&g.name()===this.name()&&delete c[b]}},d.prototype.truncate=function(){var a=this._database._connection.PUT(this._baseurl("truncate"),"");f.checkRequestResult(a),this._status=null},d.prototype.load=function(a){var b={count:!0};void 0!==a&&(b.count=a);var c=this._database._connection.PUT(this._baseurl("load"),JSON.stringify(b));f.checkRequestResult(c),this._status=null},d.prototype.unload=function(){var a=this._database._connection.PUT(this._baseurl("unload"),"");f.checkRequestResult(a),this._status=null},d.prototype.rename=function(a){var b={name:a},c=this._database._connection.PUT(this._baseurl("rename"),JSON.stringify(b));f.checkRequestResult(c),delete this._database[this._name],this._database[a]=this,this._status=null,this._name=null},d.prototype.refresh=function(){var a=this._database._connection.GET(this._database._collectionurl(this._id)+"?useId=true");f.checkRequestResult(a),this._name=a.name,this._status=a.status,this._type=a.type},d.prototype.getIndexes=function(a){var b=this._database._connection.GET(this._indexurl()+"&withStats="+(a||!1));return f.checkRequestResult(b),b.indexes},d.prototype.index=function(a){a.hasOwnProperty("id")&&(a=a.id);var b=this._database._connection.GET(this._database._indexurl(a,this.name()));return f.checkRequestResult(b),b},d.prototype.dropIndex=function(a){a.hasOwnProperty("id")&&(a=a.id);var b=this._database._connection.DELETE(this._database._indexurl(a,this.name()));return null!==b&&b.error===!0&&b.errorNum===e.errors.ERROR_ARANGO_INDEX_NOT_FOUND.code?!1:(f.checkRequestResult(b),!0)},d.prototype.ensureCapConstraint=function(a,b){var c={type:"cap",size:a||void 0,byteSize:b||void 0},d=this._database._connection.POST(this._indexurl(),JSON.stringify(c));return f.checkRequestResult(d),d},d.prototype.ensureUniqueSkiplist=function(){var a=c({type:"skiplist",unique:!0},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureSkiplist=function(){var a=c({type:"skiplist",unique:!1},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureFulltextIndex=function(a,b){var c={type:"fulltext",minLength:b||void 0,fields:[a]},d=this._database._connection.POST(this._indexurl(),JSON.stringify(c));return f.checkRequestResult(d),d},d.prototype.ensureUniqueConstraint=function(){var a=c({type:"hash",unique:!0},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureHashIndex=function(){var a=c({type:"hash",unique:!1},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureGeoIndex=function(a,b){var c;if("string"!=typeof a)throw"usage: ensureGeoIndex(, ) or ensureGeoIndex([, ])";c="boolean"==typeof b?{type:"geo",fields:[a],geoJson:b}:void 0===b?{type:"geo",fields:[a],geoJson:!1}:{type:"geo",fields:[a,b],geoJson:!1};var d=this._database._connection.POST(this._indexurl(),JSON.stringify(c));return f.checkRequestResult(d),d},d.prototype.ensureGeoConstraint=function(a,b){return this.ensureGeoIndex(a,b)},d.prototype.ensureIndex=function(a){if("object"!=typeof a||Array.isArray(a))throw"usage: ensureIndex()";var b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.count=function(){var a=this._database._connection.GET(this._baseurl("count"));return f.checkRequestResult(a),a.count},d.prototype.document=function(a){var b,c=null;if(a.hasOwnProperty("_id")&&(a.hasOwnProperty("_rev")&&(c=a._rev),a=a._id),b=null===c?this._database._connection.GET(this._documenturl(a)):this._database._connection.GET(this._documenturl(a),{"if-match":JSON.stringify(c)}),null!==b&&b.error===!0&&b.errorNum===e.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code)throw new g(b);return f.checkRequestResult(b),b},d.prototype.exists=function(a){var b,c=null;if(void 0===a||null===a)throw new g({errorNum:e.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.code,errorMessage:e.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.message});return a.hasOwnProperty("_id")&&(a.hasOwnProperty("_rev")&&(c=a._rev),a=a._id),b=null===c?this._database._connection.HEAD(this._documenturl(a)):this._database._connection.HEAD(this._documenturl(a),{"if-match":JSON.stringify(c)}),null===b||b.error!==!0||b.errorNum!==e.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code&&b.errorNum!==e.errors.ERROR_HTTP_NOT_FOUND.code&&b.errorNum!==e.errors.ERROR_HTTP_PRECONDITION_FAILED.code?(f.checkRequestResult(b),!0):!1},d.prototype.any=function(){var a=this._database._connection.PUT(this._prefixurl("/_api/simple/any"),JSON.stringify({collection:this._name}));return f.checkRequestResult(a),a.document},d.prototype.firstExample=function(a){var b,c;if(1===arguments.length)b=a;else for(b={},c=0;c) get collection by identifier/name \n _create(, ) creates a new collection \n _createEdgeCollection() creates a new edge collection \n _drop() delete a collection \n \nDocument Functions: \n _document() get document by handle (_id) \n _replace(, , ) overwrite document \n _update(, , , partially update document \n ) \n _remove() delete document \n _exists() checks whether a document exists \n _truncate() delete all documents \n \nDatabase Management Functions: \n _createDatabase() creates a new database \n _dropDatabase() drops an existing database \n _useDatabase() switches into an existing database\n _drop() delete a collection \n _name() name of the current database \n \nQuery / Transaction Functions: \n _executeTransaction() execute transaction \n _query() execute AQL query \n _createStatement() create and return AQL query ";c.prototype._help=function(){e.print(i)},c.prototype.toString=function(){return'[object ArangoDatabase "'+this._name()+'"]'},c.prototype._collections=function(){var a=this._connection.GET(this._collectionurl());if(f.checkRequestResult(a),void 0!==a.collections){var b,c=a.collections,d=[];for(b=0;b1&&(a={query:a,bindVars:b,options:c}),require("@arangodb/aql/explainer").explain(a)},c.prototype._createDatabase=function(a,b,c){var d={name:a,options:b||{},users:c||[]},e=this._connection.POST("/_api/database",JSON.stringify(d));if(null!==e&&e.error===!0)throw new g(e);return f.checkRequestResult(e),e.result},c.prototype._dropDatabase=function(a){var b=this._connection.DELETE("/_api/database/"+encodeURIComponent(a));if(null!==b&&b.error===!0)throw new g(b);return f.checkRequestResult(b),b.result},c.prototype._listDatabases=function(){var a=this._connection.GET("/_api/database");if(null!==a&&a.error===!0)throw new g(a);return f.checkRequestResult(a),a.result},c.prototype._useDatabase=function(a){if(e.printBrowser)throw new g({error:!0,code:e.errors.ERROR_NOT_IMPLEMENTED.code,errorNum:e.errors.ERROR_NOT_IMPLEMENTED.code,errorMessage:"_useDatabase() is not supported in the web interface"});var b=this._connection.getDatabaseName();if(a===b)return!0;this._connection.setDatabaseName(a);try{this._queryProperties(!0),this._flushCache()}catch(c){if(this._connection.setDatabaseName(b),c.hasOwnProperty("errorNum"))throw c;throw new g({error:!0,code:e.errors.ERROR_BAD_PARAMETER.code,errorNum:e.errors.ERROR_BAD_PARAMETER.code,errorMessage:"cannot use database '"+a+"'"})}return!0},c.prototype._listEndpoints=function(){var a=this._connection.GET("/_api/endpoint");if(null!==a&&a.error===!0)throw new g(a);return f.checkRequestResult(a),a},c.prototype._executeTransaction=function(a){if(!a||"object"!=typeof a)throw new g({error:!0,code:e.errors.ERROR_HTTP_BAD_PARAMETER.code,errorNum:e.errors.ERROR_BAD_PARAMETER.code,errorMessage:"usage: _executeTransaction()"});if(!a.collections||"object"!=typeof a.collections)throw new g({error:!0,code:e.errors.ERROR_HTTP_BAD_PARAMETER.code,errorNum:e.errors.ERROR_BAD_PARAMETER.code,errorMessage:"missing/invalid collections definition for transaction"});if(!a.action||"string"!=typeof a.action&&"function"!=typeof a.action)throw new g({error:!0,code:e.errors.ERROR_HTTP_BAD_PARAMETER.code,errorNum:e.errors.ERROR_BAD_PARAMETER.code,errorMessage:"missing/invalid action definition for transaction"});"function"==typeof a.action&&(a.action=String(a.action));var b=this._connection.POST("/_api/transaction",JSON.stringify(a));if(null!==b&&b.error===!0)throw new g(b);return f.checkRequestResult(b),b.result}}),module.define("@arangodb/arango-query-cursor",function(a,b){function c(a,b){this._database=a,this._dbName=a._name(),this.data=b,this._hasNext=!1,this._hasMore=!1,this._pos=0,this._count=0,this._total=0,void 0!==b.result&&(this._count=b.result.length,this._pos0){if(a)d.print(b);else{var g=d.startCaptureMode();d.print(b),e+="\n\n"+d.stopCaptureMode(g)}this.hasNext()&&(e+="\ntype 'more' to show more documents\n",more=this)}return a||(d.print(e),e=""),e},c.prototype.toArray=function(){for(var a=[];this.hasNext();)a.push(this.next());return a};var f=e.createHelpHeadline("ArangoQueryCursor help")+'ArangoQueryCursor constructor: \n > cursor = stmt.execute() \nFunctions: \n hasNext() returns true if there are \n more results to fetch \n next() returns the next document \n toArray() returns all data from the cursor\n _help() this help \nAttributes: \n _database database object \nExample: \n > stmt = db._createStatement({ "query": "FOR c IN coll RETURN c" })\n > cursor = stmt.execute() \n > documents = cursor.toArray() \n > cursor = stmt.execute() \n > while (cursor.hasNext()) { print(cursor.next()) } ';c.prototype._help=function(){d.print(f)},c.prototype.hasNext=function(){return this._hasNext},c.prototype.next=function(){if(!this._hasNext)throw"No more results";var a=this.data.result[this._pos];if(this._pos++,this._pos===this._count&&(this._hasNext=!1,this._pos=0,this._hasMore&&this.data.id)){this._hasMore=!1;var b=this._database._connection.PUT(this._baseurl(),"");e.checkRequestResult(b),this.data=b,this._count=b.result.length,this._pos stmt = new ArangoStatement(db, { "query": "FOR..." }) \n > stmt = db._createStatement({ "query": "FOR..." }) \nSet query options: \n > stmt.setBatchSize() set the max. number of results \n to be transferred per roundtrip \n > stmt.setCount() set count flag (return number of\n results in "count" attribute) \nGet query options: \n > stmt.setBatchSize() return the max. number of results\n to be transferred per roundtrip \n > stmt.getCount() return count flag (return number\n of results in "count" attribute)\n > stmt.getQuery() return query string \n results in "count" attribute) \nBind parameters to a query: \n > stmt.bind(, ) bind single variable \n > stmt.bind() bind multiple variables \nExecute query: \n > cursor = stmt.execute() returns a cursor \nGet all results in an array: \n > docs = cursor.toArray() \nOr loop over the result set: \n > while (cursor.hasNext()) { print(cursor.next()) } ';e.prototype._help=function(){c.print(g)},e.prototype.parse=function(){var a={query:this._query},b=this._database._connection.POST("/_api/query",JSON.stringify(a));d.checkRequestResult(b);var c={bindVars:b.bindVars,collections:b.collections,ast:b.ast};return c},e.prototype.explain=function(a){var b=this._options||{};"object"==typeof b&&"object"==typeof a&&Object.keys(a).forEach(function(c){b[c]=a[c]});var c={query:this._query,bindVars:this._bindVars,options:b},e=this._database._connection.POST("/_api/explain",JSON.stringify(c));return d.checkRequestResult(e),b&&b.allPlans?{plans:e.plans,warnings:e.warnings,stats:e.stats}:{plan:e.plan,warnings:e.warnings,stats:e.stats,cacheable:e.cacheable}},e.prototype.execute=function(){var a={query:this._query,count:this._doCount,bindVars:this._bindVars};this._batchSize&&(a.batchSize=this._batchSize),this._options&&(a.options=this._options),void 0!==this._cache&&(a.cache=this._cache);var b=this._database._connection.POST("/_api/cursor",JSON.stringify(a));return d.checkRequestResult(b),new f(this._database,b)},a.ArangoStatement=e}),module.define("@arangodb/arangosh",function(a,b){var c=require("internal");a.getIdString=function(a,b){var c="[object "+b;return a._id?c+=":"+a._id:a.data&&a.data._id&&(c+=":"+a.data._id),c+="]"},a.createHelpHeadline=function(a){var b,c="",d=Math.abs(78-a.length)/2;for(b=0;d>b;++b)c+="-";return"\n"+c+" "+a+" "+c+"\n"};var d=require("@arangodb"),e=d.ArangoError;a.checkRequestResult=function(a){if(void 0===a)throw new e({error:!0,code:500,errorNum:d.ERROR_INTERNAL,errorMessage:"Unknown error. Request result is empty" +return f.checkRequestResult(a),a.revision},d.prototype.drop=function(){var a=this._database._connection.DELETE(this._baseurl());null!==a&&a.error===!0&&a.errorNum!==e.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code&&f.checkRequestResult(a),this._status=d.STATUS_DELETED;var b,c=this._database;for(b in c)if(c.hasOwnProperty(b)){var g=c[b];g instanceof d&&g.name()===this.name()&&delete c[b]}},d.prototype.truncate=function(){var a=this._database._connection.PUT(this._baseurl("truncate"),"");f.checkRequestResult(a),this._status=null},d.prototype.load=function(a){var b={count:!0};void 0!==a&&(b.count=a);var c=this._database._connection.PUT(this._baseurl("load"),JSON.stringify(b));f.checkRequestResult(c),this._status=null},d.prototype.unload=function(){var a=this._database._connection.PUT(this._baseurl("unload"),"");f.checkRequestResult(a),this._status=null},d.prototype.rename=function(a){var b={name:a},c=this._database._connection.PUT(this._baseurl("rename"),JSON.stringify(b));f.checkRequestResult(c),delete this._database[this._name],this._database[a]=this,this._status=null,this._name=null},d.prototype.refresh=function(){var a=this._database._connection.GET(this._database._collectionurl(this._id)+"?useId=true");f.checkRequestResult(a),this._name=a.name,this._status=a.status,this._type=a.type},d.prototype.getIndexes=function(a){var b=this._database._connection.GET(this._indexurl()+"&withStats="+(a||!1));return f.checkRequestResult(b),b.indexes},d.prototype.index=function(a){a.hasOwnProperty("id")&&(a=a.id);var b=this._database._connection.GET(this._database._indexurl(a,this.name()));return f.checkRequestResult(b),b},d.prototype.dropIndex=function(a){a.hasOwnProperty("id")&&(a=a.id);var b=this._database._connection.DELETE(this._database._indexurl(a,this.name()));return null!==b&&b.error===!0&&b.errorNum===e.errors.ERROR_ARANGO_INDEX_NOT_FOUND.code?!1:(f.checkRequestResult(b),!0)},d.prototype.ensureCapConstraint=function(a,b){var c={type:"cap",size:a||void 0,byteSize:b||void 0},d=this._database._connection.POST(this._indexurl(),JSON.stringify(c));return f.checkRequestResult(d),d},d.prototype.ensureUniqueSkiplist=function(){var a=c({type:"skiplist",unique:!0},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureSkiplist=function(){var a=c({type:"skiplist",unique:!1},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureFulltextIndex=function(a,b){var c={type:"fulltext",minLength:b||void 0,fields:[a]},d=this._database._connection.POST(this._indexurl(),JSON.stringify(c));return f.checkRequestResult(d),d},d.prototype.ensureUniqueConstraint=function(){var a=c({type:"hash",unique:!0},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureHashIndex=function(){var a=c({type:"hash",unique:!1},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureGeoIndex=function(a,b){var c;if("string"!=typeof a)throw"usage: ensureGeoIndex(, ) or ensureGeoIndex([, ])";c="boolean"==typeof b?{type:"geo",fields:[a],geoJson:b}:void 0===b?{type:"geo",fields:[a],geoJson:!1}:{type:"geo",fields:[a,b],geoJson:!1};var d=this._database._connection.POST(this._indexurl(),JSON.stringify(c));return f.checkRequestResult(d),d},d.prototype.ensureGeoConstraint=function(a,b){return this.ensureGeoIndex(a,b)},d.prototype.ensureIndex=function(a){if("object"!=typeof a||Array.isArray(a))throw"usage: ensureIndex()";var b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.count=function(){var a=this._database._connection.GET(this._baseurl("count"));return f.checkRequestResult(a),a.count},d.prototype.document=function(a){var b,c=null;if(a.hasOwnProperty("_id")&&(a.hasOwnProperty("_rev")&&(c=a._rev),a=a._id),b=null===c?this._database._connection.GET(this._documenturl(a)):this._database._connection.GET(this._documenturl(a),{"if-match":JSON.stringify(c)}),null!==b&&b.error===!0&&b.errorNum===e.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code)throw new g(b);return f.checkRequestResult(b),b},d.prototype.exists=function(a){var b,c=null;if(void 0===a||null===a)throw new g({errorNum:e.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.code,errorMessage:e.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.message});return a.hasOwnProperty("_id")&&(a.hasOwnProperty("_rev")&&(c=a._rev),a=a._id),b=null===c?this._database._connection.HEAD(this._documenturl(a)):this._database._connection.HEAD(this._documenturl(a),{"if-match":JSON.stringify(c)}),null===b||b.error!==!0||b.errorNum!==e.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code&&b.errorNum!==e.errors.ERROR_HTTP_NOT_FOUND.code&&b.errorNum!==e.errors.ERROR_HTTP_PRECONDITION_FAILED.code?(f.checkRequestResult(b),!0):!1},d.prototype.any=function(){var a=this._database._connection.PUT(this._prefixurl("/_api/simple/any"),JSON.stringify({collection:this._name}));return f.checkRequestResult(a),a.document},d.prototype.firstExample=function(a){var b,c;if(1===arguments.length)b=a;else for(b={},c=0;c) get collection by identifier/name \n _create(, ) creates a new collection \n _createEdgeCollection() creates a new edge collection \n _drop() delete a collection \n \nDocument Functions: \n _document() get document by handle (_id) \n _replace(, , ) overwrite document \n _update(, , , partially update document \n ) \n _remove() delete document \n _exists() checks whether a document exists \n _truncate() delete all documents \n \nDatabase Management Functions: \n _createDatabase() creates a new database \n _dropDatabase() drops an existing database \n _useDatabase() switches into an existing database\n _drop() delete a collection \n _name() name of the current database \n \nQuery / Transaction Functions: \n _executeTransaction() execute transaction \n _query() execute AQL query \n _createStatement() create and return AQL query ";c.prototype._help=function(){e.print(i)},c.prototype.toString=function(){return'[object ArangoDatabase "'+this._name()+'"]'},c.prototype._collections=function(){var a=this._connection.GET(this._collectionurl());if(f.checkRequestResult(a),void 0!==a.collections){var b,c=a.collections,d=[];for(b=0;b1&&(a={query:a,bindVars:b,options:c}),require("@arangodb/aql/explainer").explain(a)},c.prototype._createDatabase=function(a,b,c){var d={name:a,options:b||{},users:c||[]},e=this._connection.POST("/_api/database",JSON.stringify(d));if(null!==e&&e.error===!0)throw new g(e);return f.checkRequestResult(e),e.result},c.prototype._dropDatabase=function(a){var b=this._connection.DELETE("/_api/database/"+encodeURIComponent(a));if(null!==b&&b.error===!0)throw new g(b);return f.checkRequestResult(b),b.result},c.prototype._databases=function(){var a=this._connection.GET("/_api/database");if(null!==a&&a.error===!0)throw new g(a);return f.checkRequestResult(a),a.result},c.prototype._useDatabase=function(a){if(e.printBrowser)throw new g({error:!0,code:e.errors.ERROR_NOT_IMPLEMENTED.code,errorNum:e.errors.ERROR_NOT_IMPLEMENTED.code,errorMessage:"_useDatabase() is not supported in the web interface"});var b=this._connection.getDatabaseName();if(a===b)return!0;this._connection.setDatabaseName(a);try{this._queryProperties(!0),this._flushCache()}catch(c){if(this._connection.setDatabaseName(b),c.hasOwnProperty("errorNum"))throw c;throw new g({error:!0,code:e.errors.ERROR_BAD_PARAMETER.code,errorNum:e.errors.ERROR_BAD_PARAMETER.code,errorMessage:"cannot use database '"+a+"'"})}return!0},c.prototype._listEndpoints=function(){var a=this._connection.GET("/_api/endpoint");if(null!==a&&a.error===!0)throw new g(a);return f.checkRequestResult(a),a},c.prototype._executeTransaction=function(a){if(!a||"object"!=typeof a)throw new g({error:!0,code:e.errors.ERROR_HTTP_BAD_PARAMETER.code,errorNum:e.errors.ERROR_BAD_PARAMETER.code,errorMessage:"usage: _executeTransaction()"});if(!a.collections||"object"!=typeof a.collections)throw new g({error:!0,code:e.errors.ERROR_HTTP_BAD_PARAMETER.code,errorNum:e.errors.ERROR_BAD_PARAMETER.code,errorMessage:"missing/invalid collections definition for transaction"});if(!a.action||"string"!=typeof a.action&&"function"!=typeof a.action)throw new g({error:!0,code:e.errors.ERROR_HTTP_BAD_PARAMETER.code,errorNum:e.errors.ERROR_BAD_PARAMETER.code,errorMessage:"missing/invalid action definition for transaction"});"function"==typeof a.action&&(a.action=String(a.action));var b=this._connection.POST("/_api/transaction",JSON.stringify(a));if(null!==b&&b.error===!0)throw new g(b);return f.checkRequestResult(b),b.result}}),module.define("@arangodb/arango-query-cursor",function(a,b){function c(a,b){this._database=a,this._dbName=a._name(),this.data=b,this._hasNext=!1,this._hasMore=!1,this._pos=0,this._count=0,this._total=0,void 0!==b.result&&(this._count=b.result.length,this._pos0){if(a)d.print(b);else{var g=d.startCaptureMode();d.print(b),e+="\n\n"+d.stopCaptureMode(g)}this.hasNext()&&(e+="\ntype 'more' to show more documents\n",more=this)}return a||(d.print(e),e=""),e},c.prototype.toArray=function(){for(var a=[];this.hasNext();)a.push(this.next());return a};var f=e.createHelpHeadline("ArangoQueryCursor help")+'ArangoQueryCursor constructor: \n > cursor = stmt.execute() \nFunctions: \n hasNext() returns true if there are \n more results to fetch \n next() returns the next document \n toArray() returns all data from the cursor\n _help() this help \nAttributes: \n _database database object \nExample: \n > stmt = db._createStatement({ "query": "FOR c IN coll RETURN c" })\n > cursor = stmt.execute() \n > documents = cursor.toArray() \n > cursor = stmt.execute() \n > while (cursor.hasNext()) { print(cursor.next()) } ';c.prototype._help=function(){d.print(f)},c.prototype.hasNext=function(){return this._hasNext},c.prototype.next=function(){if(!this._hasNext)throw"No more results";var a=this.data.result[this._pos];if(this._pos++,this._pos===this._count&&(this._hasNext=!1,this._pos=0,this._hasMore&&this.data.id)){this._hasMore=!1;var b=this._database._connection.PUT(this._baseurl(),"");e.checkRequestResult(b),this.data=b,this._count=b.result.length,this._pos stmt = new ArangoStatement(db, { "query": "FOR..." }) \n > stmt = db._createStatement({ "query": "FOR..." }) \nSet query options: \n > stmt.setBatchSize() set the max. number of results \n to be transferred per roundtrip \n > stmt.setCount() set count flag (return number of\n results in "count" attribute) \nGet query options: \n > stmt.setBatchSize() return the max. number of results\n to be transferred per roundtrip \n > stmt.getCount() return count flag (return number\n of results in "count" attribute)\n > stmt.getQuery() return query string \n results in "count" attribute) \nBind parameters to a query: \n > stmt.bind(, ) bind single variable \n > stmt.bind() bind multiple variables \nExecute query: \n > cursor = stmt.execute() returns a cursor \nGet all results in an array: \n > docs = cursor.toArray() \nOr loop over the result set: \n > while (cursor.hasNext()) { print(cursor.next()) } ';e.prototype._help=function(){c.print(g)},e.prototype.parse=function(){var a={query:this._query},b=this._database._connection.POST("/_api/query",JSON.stringify(a));d.checkRequestResult(b);var c={bindVars:b.bindVars,collections:b.collections,ast:b.ast};return c},e.prototype.explain=function(a){var b=this._options||{};"object"==typeof b&&"object"==typeof a&&Object.keys(a).forEach(function(c){b[c]=a[c]});var c={query:this._query,bindVars:this._bindVars,options:b},e=this._database._connection.POST("/_api/explain",JSON.stringify(c));return d.checkRequestResult(e),b&&b.allPlans?{plans:e.plans,warnings:e.warnings,stats:e.stats}:{plan:e.plan,warnings:e.warnings,stats:e.stats,cacheable:e.cacheable}},e.prototype.execute=function(){var a={query:this._query,count:this._doCount,bindVars:this._bindVars};this._batchSize&&(a.batchSize=this._batchSize),this._options&&(a.options=this._options),void 0!==this._cache&&(a.cache=this._cache);var b=this._database._connection.POST("/_api/cursor",JSON.stringify(a));return d.checkRequestResult(b),new f(this._database,b)},a.ArangoStatement=e}),module.define("@arangodb/arangosh",function(a,b){var c=require("internal");a.getIdString=function(a,b){var c="[object "+b;return a._id?c+=":"+a._id:a.data&&a.data._id&&(c+=":"+a.data._id),c+="]"},a.createHelpHeadline=function(a){var b,c="",d=Math.abs(78-a.length)/2;for(b=0;d>b;++b)c+="-";return"\n"+c+" "+a+" "+c+"\n"};var d=require("@arangodb"),e=d.ArangoError;a.checkRequestResult=function(a){if(void 0===a)throw new e({error:!0,code:500,errorNum:d.ERROR_INTERNAL,errorMessage:"Unknown error. Request result is empty" });if(a.hasOwnProperty("error")){if(a.error){if(a.errorNum===d.ERROR_TYPE_ERROR)throw new TypeError(a.errorMessage);var b=new e(a);throw b.message=a.message,b}delete a.error}return a},a.HELP=a.createHelpHeadline("Help")+"Predefined objects: \n arango: ArangoConnection \n db: ArangoDatabase \n"+(c.printBrowser?"":" fm: FoxxManager \n")+"Examples: \n > db._collections() list all collections \n > db._query().toArray() execute an AQL query \n > db._explain() explain an AQL query \n > help show help pages \n > exit \nNote: collection names and statuses may be cached in arangosh. \nTo refresh the list of collections and their statuses, issue: \n > db._collections(); \n \n"+(c.printBrowser?"To cancel the current prompt, press CTRL + z. \n \nPlease note that all variables defined with the var keyword will \ndisappear when the command is finished. To introduce variables that\nare persisting until the next command, omit the var keyword. \n\nType 'tutorial' for a tutorial or 'help' to see common examples":"To cancel the current prompt, press CTRL + d. \n"),a.helpExtended=a.createHelpHeadline("More help")+"Pager: \n > stop_pager() stop the pager output \n > start_pager() start the pager \nPretty printing: \n > stop_pretty_print() stop pretty printing \n > start_pretty_print() start pretty printing \nColor output: \n > stop_color_print() stop color printing \n > start_color_print() start color printing \nPrint function: \n > print(x) std. print function \n > print_plain(x) print without prettifying \n and without colors \n > clear() clear screen "}),module.define("@arangodb/graph-blueprint",function(a,b){var c=require("@arangodb"),d=require("@arangodb/is"),e=require("@arangodb/graph-common"),f=e.Edge,g=e.Graph,h=e.Vertex,i=e.GraphArray,j=e.Iterator,k=require("@arangodb/api/graph").GraphAPI;f.prototype.setProperty=function(a,b){var c,d=this._properties;return d[a]=b,this._graph.emptyCachedPredecessors(),c=k.putEdge(this._graph._properties._key,this._properties._key,d),this._properties=c.edge,a},h.prototype.edges=function(a,b){var c,d,e=new i;for(d=k.postEdges(this._graph._vertices._database,this._graph._properties._key,this,{filter:{direction:a,labels:b}});d.hasNext();)c=new f(this._graph,d.next()),e.push(c);return e},h.prototype.getInEdges=function(){var a=Array.prototype.slice.call(arguments);return this.edges("in",a)},h.prototype.getOutEdges=function(){var a=Array.prototype.slice.call(arguments);return this.edges("out",a)},h.prototype.getEdges=function(){var a=Array.prototype.slice.call(arguments);return this.edges("any",a)},h.prototype.inbound=function(){return this.getInEdges()},h.prototype.outbound=function(){return this.getOutEdges()},h.prototype.setProperty=function(a,b){var c,d=this._properties;return d[a]=b,c=k.putVertex(this._graph._properties._key,this._properties._key,d),this._properties=c.vertex,a},g.prototype.initialize=function(a,b,e){var f;return d.notExisty(b)&&d.notExisty(e)?f=k.getGraph(a):("object"==typeof b&&"function"==typeof b.name&&(b=b.name()),"object"==typeof e&&"function"==typeof e.name&&(e=e.name()),f=k.postGraph({_key:a,vertices:b,edges:e})),this._properties=f.graph,this._vertices=c.db._collection(this._properties.edgeDefinitions[0].from[0]),this._edges=c.db._collection(this._properties.edgeDefinitions[0].collection),this._verticesCache={},this._edgesCache={},this.predecessors={},this.distances={},this},g.getAll=function(){return k.getAllGraphs()},g.drop=function(a){k.deleteGraph(a)},g.prototype.drop=function(){k.deleteGraph(this._properties._key)},g.prototype._saveEdge=function(a,b,c,d){var e;return this.emptyCachedPredecessors(),d._key=a,d._from=b,d._to=c,e=k.postEdge(this._properties._key,d),new f(this,e.edge)},g.prototype._saveVertex=function(a,b){var c;return d.existy(a)&&(b._key=a),c=k.postVertex(this._properties._key,b),new h(this,c.vertex)},g.prototype._replaceVertex=function(a,b){k.putVertex(this._properties._key,a,b)},g.prototype._replaceEdge=function(a,b){k.putEdge(this._properties._key,a,b)},g.prototype.getVertex=function(a){var b=k.getVertex(this._properties._key,a);return d.notExisty(b)?null:new h(this,b.vertex)},g.prototype.getVertices=function(){var a=k.getVertices(this._vertices._database,this._properties._key,{}),b=this,c=function(a){return new h(b,a)};return new j(c,a,"[vertex iterator]")},g.prototype.getEdge=function(a){var b=k.getEdge(this._properties._key,a);return d.notExisty(b)?null:new f(this,b.edge)},g.prototype.getEdges=function(){var a=k.getEdges(this._vertices._database,this._properties._key,{}),b=this,c=function(a){return new f(b,a)};return new j(c,a,"[edge iterator]")},g.prototype.removeVertex=function(a){this.emptyCachedPredecessors(),k.deleteVertex(this._properties._key,a._properties._key),a._properties=void 0},g.prototype.removeEdge=function(a){this.emptyCachedPredecessors(),k.deleteEdge(this._properties._key,a._properties._key),this._edgesCache[a._properties._id]=void 0,a._properties=void 0},a.Edge=f,a.Graph=g,a.Vertex=h,a.GraphArray=i,require("@arangodb/graph/algorithms-common")}),module.define("@arangodb/index",function(a,b){"use strict";var c=require("internal"),d=require("@arangodb/common");if(Object.keys(d).forEach(function(b){a[b]=d[b]}),a.isServer=!1,a.isClient=!0,a.ArangoCollection=require("@arangodb/arango-collection").ArangoCollection,a.ArangoConnection=c.ArangoConnection,a.ArangoDatabase=require("@arangodb/arango-database").ArangoDatabase,a.ArangoStatement=require("@arangodb/arango-statement").ArangoStatement,a.ArangoQueryCursor=require("@arangodb/arango-query-cursor").ArangoQueryCursor,"undefined"!=typeof c.arango)try{a.arango=c.arango,a.db=new a.ArangoDatabase(c.arango),c.db=a.db}catch(e){c.print("cannot connect to server: "+String(e))}a.plainServerVersion=function(){if(c.arango){var a=c.arango.getVersion(),b=a.match(/(.*)-((alpha|beta|devel|rc)[0-9]*)$/);return null!==b&&(a=b[1]),a}return void 0}}),module.define("@arangodb/replication",function(a,b){"use strict";var c=require("internal"),d=require("@arangodb/arangosh"),e={},f={};e.state=function(){var a=c.db,b=a._connection.GET("/_api/replication/logger-state");return d.checkRequestResult(b),b},e.tickRanges=function(){var a=c.db,b=a._connection.GET("/_api/replication/logger-tick-ranges");return d.checkRequestResult(b),b},e.firstTick=function(){var a=c.db,b=a._connection.GET("/_api/replication/logger-first-tick");return d.checkRequestResult(b),b.firstTick},f.start=function(a,b){var e=c.db,f="";void 0!==a&&(f="?from="+encodeURIComponent(a)),void 0!==b&&(f+=""===f?"?":"&",f+="barrierId="+encodeURIComponent(b));var g=e._connection.PUT("/_api/replication/applier-start"+f,"");return d.checkRequestResult(g),g},f.stop=f.shutdown=function(){var a=c.db,b=a._connection.PUT("/_api/replication/applier-stop","");return d.checkRequestResult(b),b},f.state=function(){var a=c.db,b=a._connection.GET("/_api/replication/applier-state");return d.checkRequestResult(b),b},f.forget=function(){var a=c.db,b=a._connection.DELETE("/_api/replication/applier-state");return d.checkRequestResult(b),b},f.properties=function(a){var b,e=c.db;return b=void 0===a?e._connection.GET("/_api/replication/applier-config"):e._connection.PUT("/_api/replication/applier-config",JSON.stringify(a)),d.checkRequestResult(b),b};var g=function(a,b){var e=c.db;a.hasOwnProperty("progress")||(a.progress=!0),c.sleep(1);for(var g=0;;){var h=e._connection.PUT("/_api/job/"+encodeURIComponent(b),"");if(d.checkRequestResult(h),204!==h.code)return h;if(++g,6>g?c.sleep(2):c.sleep(3),a.progress&&g%3===0)try{var i=f.state().state.progress,j=i.time+": "+i.message;c.print("still sychronizing... last received status: "+j)}catch(k){}}},h=function(a){var b=c.db,e=JSON.stringify(a||{}),f={"X-Arango-Async":"store"},h=b._connection.PUT_RAW("/_api/replication/sync",e,f);return d.checkRequestResult(h),a.async?h.headers["x-arango-async-id"]:g(a,h.headers["x-arango-async-id"])},i=function(a,b){return b=b||{},b.restrictType="include",b.restrictCollections=[a],b.includeSystem=!0,h(b)},j=function(a){a=a||{},a.hasOwnProperty("autoStart")||(a.autoStart=!0),a.hasOwnProperty("includeSystem")||(a.includeSystem=!0),a.hasOwnProperty("verbose")||(a.verbose=!1);var b=c.db,e=JSON.stringify(a),f={"X-Arango-Async":"store"},h=b._connection.PUT_RAW("/_api/replication/make-slave",e,f);return d.checkRequestResult(h),a.async?h.headers["x-arango-async-id"]:g(a,h.headers["x-arango-async-id"])},k=function(a){var b=c.db,e=b._connection.PUT_RAW("/_api/job/"+encodeURIComponent(a),"");return d.checkRequestResult(e),e.headers.hasOwnProperty("x-arango-async-id")?JSON.parse(e.body):!1},l=function(){var a=c.db,b=a._connection.GET("/_api/replication/server-id");return d.checkRequestResult(b),b.serverId};a.logger=e,a.applier=f,a.sync=h,a.syncCollection=i,a.setupReplication=j,a.getSyncResult=k,a.serverId=l}),module.define("@arangodb/simple-query",function(a,b){var c=require("@arangodb/arangosh"),d=require("@arangodb/arango-query-cursor").ArangoQueryCursor,e=require("@arangodb/simple-query-common"),f=e.GeneralArrayCursor,g=e.SimpleQueryAll,h=e.SimpleQueryArray,i=e.SimpleQueryByExample,j=e.SimpleQueryByCondition,k=e.SimpleQueryFulltext,l=e.SimpleQueryGeo,m=e.SimpleQueryNear,n=e.SimpleQueryRange,o=e.SimpleQueryWithin,p=e.SimpleQueryWithinRectangle;g.prototype.execute=function(a){if(null===this._execution){void 0!==a&&a>0&&(this._batchSize=a);var b={collection:this._collection.name()};null!==this._limit&&(b.limit=this._limit),null!==this._skip&&(b.skip=this._skip),null!==this._batchSize&&(b.batchSize=this._batchSize);var e=this._collection._database._connection.PUT("/_api/simple/all",JSON.stringify(b));c.checkRequestResult(e),this._execution=new d(this._collection._database,e),e.hasOwnProperty("count")&&(this._countQuery=e.count)}},i.prototype.execute=function(a){if(null===this._execution){void 0!==a&&a>0&&(this._batchSize=a);var b={collection:this._collection.name(),example:this._example};null!==this._limit&&(b.limit=this._limit),null!==this._skip&&(b.skip=this._skip),null!==this._batchSize&&(b.batchSize=this._batchSize);var e="by-example";if(this.hasOwnProperty("_type"))switch(b.index=this._index,this._type){case"hash":e="by-example-hash";break;case"skiplist":e="by-example-skiplist"}var f=this._collection._database._connection.PUT("/_api/simple/"+e,JSON.stringify(b));c.checkRequestResult(f),this._execution=new d(this._collection._database,f),f.hasOwnProperty("count")&&(this._countQuery=f.count,this._countTotal=f.count)}},j.prototype.execute=function(a){if(null===this._execution){void 0!==a&&a>0&&(this._batchSize=a);var b={collection:this._collection.name(),condition:this._condition};null!==this._limit&&(b.limit=this._limit),null!==this._skip&&(b.skip=this._skip),null!==this._batchSize&&(b.batchSize=this._batchSize);var e="by-condition";if(this.hasOwnProperty("_type"))switch(b.index=this._index,this._type){case"skiplist":e="by-condition-skiplist"}var f=this._collection._database._connection.PUT("/_api/simple/"+e,JSON.stringify(b));c.checkRequestResult(f),this._execution=new d(this._collection._database,f),f.hasOwnProperty("count")&&(this._countQuery=f.count,this._countTotal=f.count)}},n.prototype.execute=function(a){if(null===this._execution){void 0!==a&&a>0&&(this._batchSize=a);var b={collection:this._collection.name(),attribute:this._attribute,right:this._right,left:this._left,closed:1===this._type};null!==this._limit&&(b.limit=this._limit),null!==this._skip&&(b.skip=this._skip),null!==this._batchSize&&(b.batchSize=this._batchSize);var e=this._collection._database._connection.PUT("/_api/simple/range",JSON.stringify(b));c.checkRequestResult(e),this._execution=new d(this._collection._database,e),e.hasOwnProperty("count")&&(this._countQuery=e.count)}},m.prototype.execute=function(a){if(null===this._execution){void 0!==a&&a>0&&(this._batchSize=a);var b={collection:this._collection.name(),latitude:this._latitude,longitude:this._longitude};null!==this._limit&&(b.limit=this._limit),null!==this._skip&&(b.skip=this._skip),null!==this._index&&(b.geo=this._index),null!==this._distance&&(b.distance=this._distance),null!==this._batchSize&&(b.batchSize=this._batchSize);var e=this._collection._database._connection.PUT("/_api/simple/near",JSON.stringify(b));c.checkRequestResult(e),this._execution=new d(this._collection._database,e),e.hasOwnProperty("count")&&(this._countQuery=e.count)}},o.prototype.execute=function(a){if(null===this._execution){void 0!==a&&a>0&&(this._batchSize=a);var b={collection:this._collection.name(),latitude:this._latitude,longitude:this._longitude,radius:this._radius};null!==this._limit&&(b.limit=this._limit),null!==this._skip&&(b.skip=this._skip),null!==this._index&&(b.geo=this._index),null!==this._distance&&(b.distance=this._distance),null!==this._batchSize&&(b.batchSize=this._batchSize);var e=this._collection._database._connection.PUT("/_api/simple/within",JSON.stringify(b));c.checkRequestResult(e),this._execution=new d(this._collection._database,e),e.hasOwnProperty("count")&&(this._countQuery=e.count)}},p.prototype.execute=function(a){if(null===this._execution){void 0!==a&&a>0&&(this._batchSize=a);var b={collection:this._collection.name(),latitude1:this._latitude1,longitude1:this._longitude1,latitude2:this._latitude2,longitude2:this._longitude2};null!==this._limit&&(b.limit=this._limit),null!==this._skip&&(b.skip=this._skip),null!==this._index&&(b.geo=this._index),null!==this._distance&&(b.distance=this._distance),null!==this._batchSize&&(b.batchSize=this._batchSize);var e=this._collection._database._connection.PUT("/_api/simple/within-rectangle",JSON.stringify(b));c.checkRequestResult(e),this._execution=new d(this._collection._database,e),e.hasOwnProperty("count")&&(this._countQuery=e.count)}},k.prototype.execute=function(a){if(null===this._execution){void 0!==a&&a>0&&(this._batchSize=a);var b={collection:this._collection.name(),attribute:this._attribute,query:this._query};null!==this._limit&&(b.limit=this._limit),null!==this._index&&(b.index=this._index),null!==this._skip&&(b.skip=this._skip),null!==this._batchSize&&(b.batchSize=this._batchSize);var e=this._collection._database._connection.PUT("/_api/simple/fulltext",JSON.stringify(b));c.checkRequestResult(e),this._execution=new d(this._collection._database,e),e.hasOwnProperty("count")&&(this._countQuery=e.count)}},a.GeneralArrayCursor=f,a.SimpleQueryAll=g,a.SimpleQueryArray=h,a.SimpleQueryByExample=i,a.SimpleQueryByCondition=j,a.SimpleQueryFulltext=k,a.SimpleQueryGeo=l,a.SimpleQueryNear=m,a.SimpleQueryRange=n,a.SimpleQueryWithin=o,a.SimpleQueryWithinRectangle=p}),module.define("@arangodb/tutorial",function(a,b){var c=0,d="Type 'tutorial' again to get to the next chapter.",e=[{title:"Welcome to the tutorial!",text:"This is a user-interactive tutorial on ArangoDB and the ArangoDB shell.\nIt 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.\nSo 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\nNote: 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\nPlease 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'.\nThe '_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.\nThe '_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\nNote 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\");"}];a._PRINT=function(a){function b(a){return a.replace(/\n {2}(.+?)(?=\n)/g,"\n "+f.COLOR_MAGENTA+"$1"+f.COLOR_RESET)}var f=require("internal").COLORS,g=f.COLOR_BOLD_BLUE+(c+1)+". "+e[c].title+f.COLOR_RESET;a.output+="\n\n"+g+"\n\n"+b(e[c].text+"\n")+"\n",++c,c>=e.length?(a.output+="Congratulations! You finished the tutorial.\n",c=0):a.output+=d+"\n"}}),module.define("@arangodb/aql/explainer",function(a,b){function c(a){"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(b){C[b]=a?A[b]:""})}function d(a,b){"use strict";return a&&a.subNodes&&a.subNodes.length>1?"("+b+")":b}function e(a){"use strict";return"`"+a+"`"}function f(a){"use strict";return C.COLOR_CYAN+a+C.COLOR_RESET}function g(a){"use strict";return C.COLOR_BLUE+a+C.COLOR_RESET}function h(a){"use strict";return"string"==typeof a&&a.length>1024?C.COLOR_GREEN+a.substr(0,1024)+"..."+C.COLOR_RESET:C.COLOR_GREEN+a+C.COLOR_RESET}function i(a){"use strict";return"#"===a[0]?C.COLOR_MAGENTA+a+C.COLOR_RESET:C.COLOR_YELLOW+a+C.COLOR_RESET}function j(a){"use strict";return C.COLOR_GREEN+a+C.COLOR_RESET}function k(a){"use strict";return C.COLOR_RED+a+C.COLOR_RESET}function l(a){"use strict";return"`"+C.COLOR_YELLOW+a+C.COLOR_RESET+"`"}function m(a){"use strict";return C.COLOR_MAGENTA+a+C.COLOR_RESET}function n(a){"use strict";return C.COLOR_BOLD_BLUE+a+C.COLOR_RESET}function o(a){"use strict";return 0>a&&(a=0),new Array(a).join(" ")}function p(a,b){"use strict";var c=".{1,"+b+"}(\\s|$)|\\S+?(\\s|$)";return a.match(new RegExp(c,"g")).join("\n")}function q(a){"use strict";var b=4096;a.length>b?(D.appendLine(n("Query string (truncated):")),a=a.substr(0,b/2)+" ... "+a.substr(a.length-b/2)):D.appendLine(n("Query string:")),D.appendLine(" "+h(p(a,100).replace(/\n+/g,"\n ",a))),D.appendLine()}function r(a){"use strict";if(void 0!==a){D.appendLine(n("Write query options:"));var b=Object.keys(a),c="Option".length;b.forEach(function(a){a.length>c&&(c=a.length)}),D.appendLine(" "+m("Option")+o(1+c-"Option".length)+" "+m("Value")),b.forEach(function(b){D.appendLine(" "+f(b)+o(1+c-b.length)+" "+h(JSON.stringify(a[b])))}),D.appendLine()}}function s(a){"use strict";if(D.appendLine(n("Optimization rules applied:")),0===a.length)D.appendLine(" "+h("none"));else{var b=String("Id").length;D.appendLine(" "+o(1+b-String("Id").length)+m("Id")+" "+m("RuleName"));for(var c=0;cb&&(b=d),d=a.type.length,d>j&&(j=d),d=a.fields.map(e).join(", ").length+"[ ]".length,d>q&&(q=d),d=a.collection.length,d>c&&(c=d)});var r=" "+o(1+b-String("By").length)+m("By")+" "+m("Type")+o(1+j-"Type".length)+" "+m("Collection")+o(1+c-"Collection".length)+" "+m("Unique")+o(1+d-"Unique".length)+" "+m("Sparse")+o(1+g-"Sparse".length)+" "+m("Selectivity")+" "+m("Fields")+o(1+q-"Fields".length)+" "+m("Ranges");D.appendLine(r);for(var s=0;sb&&(b=g),a.minMaxDepthLen>c&&(c=a.minMaxDepthLen),a.hasOwnProperty("ConditionStr")&&a.ConditionStr.length>f&&(f=a.ConditionStr.length),a.hasOwnProperty("vertexCollectionNameStr")&&a.vertexCollectionNameStrLen>d&&(d=a.vertexCollectionNameStrLen),a.hasOwnProperty("edgeCollectionNameStr")&&a.edgeCollectionNameStrLen>e&&(e=a.edgeCollectionNameStrLen)});var g=" "+o(1+b-String("Id").length)+m("Id")+" "+m("Depth")+o(1+c-String("Depth").length)+" "+m("Vertex collections")+o(1+d-"Vertex collections".length)+" "+m("Edge collections")+o(1+e-"Edge collections".length)+" "+m("Filter conditions");D.appendLine(g);for(var h=0;hz&&(z=String(a.id).length),String(a.type).length>w&&(w=String(a.type).length),String(a.site).length>x&&(x=String(a.site).length),String(a.estimatedNrItems).length>A&&(A=String(a.estimatedNrItems).length)});for(var d=a.length,f="COOR";d>0;){--d;var g=a[d];g.site=f,"RemoteNode"===g.type&&(f="COOR"===f?"DBS":"COOR")}};F(C.nodes,0);var G,H={},I={},J={},K=[],L=[],M=!0,N=null,O=function(a){try{if(/^[0-9_]/.test(a.name))return i("#"+a.name)}catch(b){throw B(a),b}return I.hasOwnProperty(a.id)&&(J[a.name]=I[a.id]),i(a.name)},P=function(){},Q=function ga(a){var c=!0;a:for(;c;){var e=a;c=!1;var i=function(a,b){var c=ga(a.subNodes[0]),d=ga(a.subNodes[1]);return 3===a.subNodes.length&&(b=a.subNodes[2].quantifier+" "+b),a.sorted?c+" "+b+" "+g("/* sorted */")+" "+d:c+" "+b+" "+d};if(M=M&&-1!==["value","object","object element","array"].indexOf(e.type),"attribute access"!==e.type&&e.hasOwnProperty("subNodes"))for(var m=0;m20?"{ "+e.subNodes.slice(0,20).map(ga).join(", ")+", ... }":"{ "+e.subNodes.map(ga).join(", ")+" }":"{ }";case"object element":return h(JSON.stringify(e.name))+" : "+ga(e.subNodes[0]);case"calculated object element":return"[ "+ga(e.subNodes[0])+" ] : "+ga(e.subNodes[1]);case"array":return e.hasOwnProperty("subNodes")?e.subNodes.length>20?"[ "+e.subNodes.slice(0,20).map(ga).join(", ")+", ... ]":"[ "+e.subNodes.map(ga).join(", ")+" ]":"[ ]";case"unary not":return"! "+ga(e.subNodes[0]);case"unary plus":return"+ "+ga(e.subNodes[0]);case"unary minus":return"- "+ga(e.subNodes[0]);case"array limit":return ga(e.subNodes[0])+", "+ga(e.subNodes[1]);case"attribute access":if("reference"===e.subNodes[0].type&&I.hasOwnProperty(e.subNodes[0].id)){var p=I[e.subNodes[0].id],q=y._collection(p);if(null!==q){var r=3===q.type(),s="_"===e.name[0];(s&&-1===["_key","_id","_rev"].concat(r?["_from","_to"]:[]).indexOf(e.name)||!s&&r&&-1!==["from","to"].indexOf(e.name))&&P(b.warnings,N,"reference to potentially non-existing attribute '"+e.name+"'")}}return ga(e.subNodes[0])+"."+l(e.name);case"indexed access":return ga(e.subNodes[0])+"["+ga(e.subNodes[1])+"]";case"range":return ga(e.subNodes[0])+" .. "+ga(e.subNodes[1])+" "+g("/* range */");case"expand":case"expansion":e.subNodes.length>2?H[e.subNodes[0].subNodes[0].name]=[e.levels,e.subNodes[0].subNodes[1],e.subNodes[2],e.subNodes[3],e.subNodes[4]]:H[e.subNodes[0].subNodes[0].name]=e.subNodes[0].subNodes[1],a=e.subNodes[1],c=!0,i=m=n=o=p=q=r=s=void 0;continue a;case"user function call":return j(e.name)+"("+(e.subNodes&&e.subNodes[0].subNodes||[]).map(ga).join(", ")+") "+g("/* user-defined function */");case"function call":return j(e.name)+"("+(e.subNodes&&e.subNodes[0].subNodes||[]).map(ga).join(", ")+")";case"plus":return"("+i(e,"+")+")";case"minus":return"("+i(e,"-")+")";case"times":return"("+i(e,"*")+")";case"division":return"("+i(e,"/")+")";case"modulus":return"("+i(e,"%")+")";case"compare not in":case"array compare not in":return"("+i(e,"not in")+")";case"compare in":case"array compare in":return"("+i(e,"in")+")";case"compare ==":case"array compare ==":return"("+i(e,"==")+")";case"compare !=":case"array compare !=":return"("+i(e,"!=")+")";case"compare >":case"array compare >":return"("+i(e,">")+")";case"compare >=":case"array compare >=":return"("+i(e,">=")+")";case"compare <":case"array compare <":return"("+i(e,"<")+")";case"compare <=":case"array compare <=":return"("+i(e,"<=")+")";case"logical or":return"("+i(e,"||")+")";case"logical and":return"("+i(e,"&&")+")";case"ternary":return"("+ga(e.subNodes[0])+" ? "+ga(e.subNodes[1])+" : "+ga(e.subNodes[2])+")";case"n-ary or":return e.hasOwnProperty("subNodes")?d(e,e.subNodes.map(function(a){return ga(a)}).join(" || ")):"";case"n-ary and":return e.hasOwnProperty("subNodes")?d(e,e.subNodes.map(function(a){return ga(a)}).join(" && ")):"";default:return"unhandled node type ("+e.type+")"}}},R=function(a){var b="";for(var c in a)if(a.hasOwnProperty(c)){b.length>0&&(b+=" AND ");for(var d=0;d ",b+=Q(e.varAccess),b+=" "+e.comparisonTypeStr+" ",b+=Q(e.compareTo)}}return b},S=function(a,b,c){var d=c.isConstant?h(JSON.stringify(c.bound)):Q(c.bound);return l(a)+" "+b[c.include?1:0]+" "+d},T=function(a){var b=[];return a.forEach(function(a){var c=a.attr;a.lowConst.hasOwnProperty("bound")&&a.highConst.hasOwnProperty("bound")&&JSON.stringify(a.lowConst.bound)===JSON.stringify(a.highConst.bound)&&(a.equality=!0), a.equality?a.lowConst.hasOwnProperty("bound")?b.push(S(c,["==","=="],a.lowConst)):a.hasOwnProperty("lows")&&a.lows.forEach(function(a){b.push(S(c,["==","=="],a))}):(a.lowConst.hasOwnProperty("bound")&&b.push(S(c,[">",">="],a.lowConst)),a.highConst.hasOwnProperty("bound")&&b.push(S(c,["<","<="],a.highConst)),a.hasOwnProperty("lows")&&a.lows.forEach(function(a){b.push(S(c,[">",">="],a))}),a.hasOwnProperty("highs")&&a.highs.forEach(function(a){b.push(S(c,["<","<="],a))}))}),b.length>1?"("+b.join(" && ")+")":b[0]},U=function(a){switch(a.type){case"SingletonNode":return f("ROOT");case"NoResultsNode":return f("EMPTY")+" "+g("/* empty result set */");case"EnumerateCollectionNode":return I[a.outVariable.id]=a.collection,f("FOR")+" "+O(a.outVariable)+" "+f("IN")+" "+k(a.collection)+" "+g("/* full collection scan"+(a.random?", random order":"")+" */");case"EnumerateListNode":return f("FOR")+" "+O(a.outVariable)+" "+f("IN")+" "+O(a.inVariable)+" "+g("/* list iteration */");case"IndexNode":I[a.outVariable.id]=a.collection;var b=[];return a.indexes.forEach(function(c,d){var e=(a.reverse?"reverse ":"")+c.type+" index scan";(0===b.length||e!==b[b.length-1])&&b.push(e),c.collection=a.collection,c.node=a.id,a.condition.type&&"n-ary or"===a.condition.type?c.condition=Q(a.condition.subNodes[d]):c.condition="*",K.push(c)}),f("FOR")+" "+O(a.outVariable)+" "+f("IN")+" "+k(a.collection)+" "+g("/* "+b.join(", ")+" */");case"IndexRangeNode":I[a.outVariable.id]=a.collection;var c=a.index;return c.ranges=a.ranges.map(T).join(" || "),c.collection=a.collection,c.node=a.id,K.push(c),f("FOR")+" "+O(a.outVariable)+" "+f("IN")+" "+k(a.collection)+" "+g("/* "+(a.reverse?"reverse ":"")+a.index.type+" index scan */");case"TraversalNode":a.minMaxDepth=a.minDepth+".."+a.maxDepth,a.minMaxDepthLen=a.minMaxDepth.length;var d=f("FOR ")+O(a.vertexOutVariable)+" "+g("/* vertex */");a.hasOwnProperty("edgeOutVariable")&&(d+=" , "+O(a.edgeOutVariable)+" "+g("/* edge */")),a.hasOwnProperty("pathOutVariable")&&(d+=" , "+O(a.pathOutVariable)+" "+g("/* paths */")),d+=" "+f("IN")+" "+h(a.minMaxDepth)+" "+g("/* min..maxPathDepth */")+" ";var e=["ANY","INBOUND","OUTBOUND"],i=a.directions[0];d+=f(e[i]),d+=a.hasOwnProperty("vertexId")?" '"+h(a.vertexId)+"' ":" "+O(a.inVariable)+" ",d+=g("/* startnode */")+" ",d+=Array.isArray(a.graph)?a.graph.map(function(b,c){var d="";return a.directions[c]!==i&&(d+=f(e[a.directions[c]]),d+=" "),d+k(b)}).join(", "):f("GRAPH")+" '"+h(a.graph)+"'",L.push(a),a.hasOwnProperty("simpleExpressions")&&(a.ConditionStr=R(a.simpleExpressions));var l=[];if(a.hasOwnProperty("graphDefinition")){var m=[];a.graphDefinition.vertexCollectionNames.forEach(function(a){m.push(k(a))}),a.vertexCollectionNameStr=m.join(", "),a.vertexCollectionNameStrLen=a.graphDefinition.vertexCollectionNames.join(", ").length,a.graphDefinition.edgeCollectionNames.forEach(function(a){l.push(k(a))}),a.edgeCollectionNameStr=l.join(", "),a.edgeCollectionNameStrLen=a.graphDefinition.edgeCollectionNames.join(", ").length}else{var n=a.graph||[];n.forEach(function(a){l.push(k(a))}),a.edgeCollectionNameStr=l.join(", "),a.edgeCollectionNameStrLen=n.join(", ").length,a.graph=""}return d;case"CalculationNode":return f("LET")+" "+O(a.outVariable)+" = "+Q(a.expression)+" "+g("/* "+a.expressionType+" expression */");case"FilterNode":return f("FILTER")+" "+O(a.inVariable);case"AggregateNode":return f("COLLECT")+" "+a.aggregates.map(function(a){return O(a.outVariable)+" = "+O(a.inVariable)}).join(", ")+(a.count?" "+f("WITH COUNT"):"")+(a.outVariable?" "+f("INTO")+" "+O(a.outVariable):"")+(a.keepVariables?" "+f("KEEP")+" "+a.keepVariables.map(function(a){return O(a)}).join(", "):"")+" "+g("/* "+a.aggregationOptions.method+" */");case"CollectNode":var o=f("COLLECT")+" "+a.groups.map(function(a){return O(a.outVariable)+" = "+O(a.inVariable)}).join(", ");return a.hasOwnProperty("aggregates")&&a.aggregates.length>0&&(a.groups.length>0&&(o+=" "),o+=f("AGGREGATE")+" "+a.aggregates.map(function(a){return O(a.outVariable)+" = "+j(a.type)+"("+O(a.inVariable)+")"}).join(", ")),o+=(a.count?" "+f("WITH COUNT"):"")+(a.outVariable?" "+f("INTO")+" "+O(a.outVariable):"")+(a.keepVariables?" "+f("KEEP")+" "+a.keepVariables.map(function(a){return O(a)}).join(", "):"")+" "+g("/* "+a.collectOptions.method+"*/");case"SortNode":return f("SORT")+" "+a.elements.map(function(a){return O(a.inVariable)+" "+f(a.ascending?"ASC":"DESC")}).join(", ");case"LimitNode":return f("LIMIT")+" "+h(JSON.stringify(a.offset))+", "+h(JSON.stringify(a.limit));case"ReturnNode":return f("RETURN")+" "+O(a.inVariable);case"SubqueryNode":return f("LET")+" "+O(a.outVariable)+" = ... "+g("/* subquery */");case"InsertNode":return G=a.modificationFlags,f("INSERT")+" "+O(a.inVariable)+" "+f("IN")+" "+k(a.collection);case"UpdateNode":return G=a.modificationFlags,a.hasOwnProperty("inKeyVariable")?f("UPDATE")+" "+O(a.inKeyVariable)+" "+f("WITH")+" "+O(a.inDocVariable)+" "+f("IN")+" "+k(a.collection):f("UPDATE")+" "+O(a.inDocVariable)+" "+f("IN")+" "+k(a.collection);case"ReplaceNode":return G=a.modificationFlags,a.hasOwnProperty("inKeyVariable")?f("REPLACE")+" "+O(a.inKeyVariable)+" "+f("WITH")+" "+O(a.inDocVariable)+" "+f("IN")+" "+k(a.collection):f("REPLACE")+" "+O(a.inDocVariable)+" "+f("IN")+" "+k(a.collection);case"UpsertNode":return G=a.modificationFlags,f("UPSERT")+" "+O(a.inDocVariable)+" "+f("INSERT")+" "+O(a.insertVariable)+" "+f(a.isReplace?"REPLACE":"UPDATE")+" "+O(a.updateVariable)+" "+f("IN")+" "+k(a.collection);case"RemoveNode":return G=a.modificationFlags,f("REMOVE")+" "+O(a.inVariable)+" "+f("IN")+" "+k(a.collection);case"RemoteNode":return f("REMOTE");case"DistributeNode":return f("DISTRIBUTE");case"ScatterNode":return f("SCATTER");case"GatherNode":return f("GATHER")}return"unhandled node type ("+a.type+")"},V=0,W=[],X=function(a,b){return o(1+a+a)+(b?"* ":"- ")},Y=function(a){J={},N=a.id,M=!0,"SubqueryNode"===a.type&&W.push(V)},Z=function(a){var b=!e.hasOwnProperty(a.id);-1!==["EnumerateCollectionNode","EnumerateListNode","IndexRangeNode","IndexNode","SubqueryNode"].indexOf(a.type)?V++:b&&W.length>0?V=W.pop():"SingletonNode"===a.type&&V++},$=function(){return M?" "+g("/* const assignment */"):""},_=function(){var a=[];for(var b in J)J.hasOwnProperty(b)&&a.push(i(b)+" : "+k(J[b]));return a.length>0?" "+g("/* collections used:")+" "+a.join(", ")+" "+g("*/"):""},aa=function(a){Y(a);var b=" "+o(1+z-String(a.id).length)+i(a.id)+" "+f(a.type)+o(1+w-String(a.type).length)+" ";E&&E.isCluster&&E.isCluster()&&(b+=i(a.site)+o(1+x-String(a.site).length)+" "),b+=o(1+A-String(a.estimatedNrItems).length)+h(a.estimatedNrItems)+" "+X(V,"SingletonNode"===a.type)+U(a),"CalculationNode"===a.type&&(b+=_()+$()),D.appendLine(b),Z(a)};q(a),D.appendLine(n("Execution plan:"));var ba=" "+o(1+z-String("Id").length)+m("Id")+" "+m("NodeType")+o(1+w-String("NodeType").length)+" ";E&&E.isCluster&&E.isCluster()&&(ba+=m("Site")+o(1+x-String("Site").length)+" "),ba+=o(1+A-String("Est.").length)+m("Est.")+" "+m("Comment"),D.appendLine(ba);for(var ca=[p];ca.length>0;){var da=ca.pop(),ea=c[da];aa(ea),e.hasOwnProperty(da)&&(ca=ca.concat(e[da])),"SubqueryNode"===ea.type&&(ca=ca.concat([ea.subquery.nodes[0].id]))}D.appendLine(),u(K),v(L),D.appendLine(),s(C.rules),r(G),t(b.warnings)}function x(a,b,d){"use strict";if("string"==typeof a&&(a={query:a}),!(a instanceof Object))throw"ArangoStatement needs initial data";void 0===b&&(b=a.options),b=b||{},c(void 0===b.colors?!0:b.colors);var e=y._createStatement(a),f=e.explain(b);return D.clearOutput(),w(a.query,f,!0),void 0===d||d?void B(D.getOutput()):D.getOutput()}var y=require("@arangodb").db,z=require("internal"),A=z.COLORS,B=z.print,C={};"function"==typeof z.printBrowser&&(B=z.printBrowser);var D={output:"",appendLine:function(a){a?this.output+=a+"\n":this.output+="\n"},getOutput:function(){return this.output},clearOutput:function(){this.output=""}};a.explain=x}),module.define("@arangodb/aql/functions",function(a,b){var c=require("internal"),d=require("@arangodb"),e=d.db,f=d.ArangoError,g=function(){"use strict";var a=e._collection("_aqlfunctions");if(null===a){var b=new f;throw b.errorNum=d.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code,b.errorMessage="collection '_aqlfunctions' not found",b}return a},h=function(a){"use strict";var b=[];if(null!==a&&void 0!==a&&a.length>0){var c=a.toUpperCase();a.length>1&&"::"!==a.substr(a.length-2,2)&&(c+="::"),g().toArray().forEach(function(a){a.name.toUpperCase().substr(0,c.length)===c&&b.push(a)})}else b=g().toArray();return b},i=function(a){"use strict";if("string"!=typeof a||!a.match(/^[a-zA-Z0-9_]+(::[a-zA-Z0-9_]+)+$/)||"_"===a.substr(0,1)){var b=new f;throw b.errorNum=d.errors.ERROR_QUERY_FUNCTION_INVALID_NAME.code,b.errorMessage=d.errors.ERROR_QUERY_FUNCTION_INVALID_NAME.message,b}},j=function(a,b){"use strict";if("function"==typeof a&&(a=String(a)+"\n"),"string"==typeof a){if(a="("+a+"\n)",!c.parse)return a;try{if(c.parse(a,b))return a}catch(e){}}var g=new f;throw g.errorNum=d.errors.ERROR_QUERY_FUNCTION_INVALID_CODE.code,g.errorMessage=d.errors.ERROR_QUERY_FUNCTION_INVALID_CODE.message,g},k=function(a){"use strict";var b=null;i(a);try{b=g().document(a.toUpperCase())}catch(e){}if(null===b){var h=new f;throw h.errorNum=d.errors.ERROR_QUERY_FUNCTION_NOT_FOUND.code,h.errorMessage=c.sprintf(d.errors.ERROR_QUERY_FUNCTION_NOT_FOUND.message,a),h}return g().remove(b._id),c.reloadAqlFunctions(),!0},l=function(a){"use strict";if(0===a.length){var b=new f;throw b.errorNum=d.errors.ERROR_BAD_PARAMETER.code,b.errorMessage=d.errors.ERROR_BAD_PARAMETER.message,b}var e=0;return h(a).forEach(function(a){g().remove(a._id),e++}),e>0&&c.reloadAqlFunctions(),e},m=function(a,b,h){i(a),b=j(b,a);var k,l="(function() { var callback = "+b+"; return callback; })()";try{if(c&&c.hasOwnProperty("executeScript")){var m=c.executeScript(l,void 0,"(user function "+a+")");if("function"!=typeof m)throw k=new f,k.errorNum=d.errors.ERROR_QUERY_FUNCTION_INVALID_CODE.code,k.errorMessage=d.errors.ERROR_QUERY_FUNCTION_INVALID_CODE.message+": code must be contained in function",k}}catch(n){throw k=new f,k.errorNum=d.errors.ERROR_QUERY_FUNCTION_INVALID_CODE.code,k.errorMessage=d.errors.ERROR_QUERY_FUNCTION_INVALID_CODE.message,k}var o=e._executeTransaction({collections:{write:g().name()},action:function(a){var b=!1,c=require("internal").db._collection(a.collection),d=a.name;try{var e=c.document(d.toUpperCase());null!==e&&(c.remove(e._key),b=!0)}catch(f){}var g={_key:d.toUpperCase(),name:d,code:a.code,isDeterministic:a.isDeterministic||!1};return c.save(g),b},params:{name:a,code:b,isDeterministic:h,collection:g().name()}});return c.reloadAqlFunctions(),o},n=function(a){"use strict";var b=[];return h(a).forEach(function(a){b.push({name:a.name,code:a.code.substr(1,a.code.length-2).trim()})}),b};a.unregister=k,a.unregisterGroup=l,a.register=m,a.toArray=n}),module.define("@arangodb/arango-collection-common",function(a,b){var c=require("@arangodb/arango-collection").ArangoCollection,d=require("@arangodb"),e=d.ArangoError,f=d.sprintf,g=d.db,h=require("@arangodb/simple-query"),i=h.SimpleQueryAll,j=h.SimpleQueryByExample,k=h.SimpleQueryByCondition,l=h.SimpleQueryRange,m=h.SimpleQueryGeo,n=h.SimpleQueryNear,o=h.SimpleQueryWithin,p=h.SimpleQueryWithinRectangle,q=h.SimpleQueryFulltext;c.STATUS_CORRUPTED=0,c.STATUS_NEW_BORN=1,c.STATUS_UNLOADED=2,c.STATUS_LOADED=3,c.STATUS_UNLOADING=4,c.STATUS_DELETED=5,c.STATUS_LOADING=6,c.TYPE_DOCUMENT=2,c.TYPE_EDGE=3,c.prototype._PRINT=function(a){var b="unknown",d="unknown",e=this.name();switch(this.status()){case c.STATUS_NEW_BORN:b="new born";break;case c.STATUS_UNLOADED:b="unloaded";break;case c.STATUS_UNLOADING:b="unloading";break;case c.STATUS_LOADED:b="loaded";break;case c.STATUS_CORRUPTED:b="corrupted";break;case c.STATUS_DELETED:b="deleted"}switch(this.type()){case c.TYPE_DOCUMENT:d="document";break;case c.TYPE_EDGE:d="edge"}var f=require("internal").COLORS,g=a.useColor;a.output+="[ArangoCollection ",g&&(a.output+=f.COLOR_NUMBER),a.output+=this._id,g&&(a.output+=f.COLOR_RESET),a.output+=', "',g&&(a.output+=f.COLOR_STRING),a.output+=e||"unknown",g&&(a.output+=f.COLOR_RESET),a.output+='" (type '+d+", status "+b+")]"},c.prototype.toString=function(){return"[ArangoCollection: "+this._id+"]"},c.prototype.all=function(){return new i(this)},c.prototype.byExample=function(a){var b,c;if(1===arguments.length)b=a;else for(b={},c=0;c=1?h=this.all():(c=f("FOR d IN %s FILTER rand() >= @prob RETURN d",this.name()),c=g._createStatement({query:c}),1>j&&c.bind("prob",j),h=c.execute());else{if("number"!=typeof k){var l=new e;throw l.errorNum=d.errors.ERROR_ILLEGAL_NUMBER.code,l.errorMessage="expecting a number, got "+String(k),l}j>=1?h=this.all().limit(k):(c=f("FOR d IN %s FILTER rand() >= @prob LIMIT %d RETURN d",this.name(),k),c=g._createStatement({query:c}),1>j&&c.bind("prob",j),h=c.execute())}for(i=0;h.hasNext();){var m=h.next();a(m,i),i++}},c.prototype.removeByExample=function(a,b,c){throw"cannot call abstract removeByExample function"},c.prototype.replaceByExample=function(a,b,c,d){throw"cannot call abstract replaceByExample function"},c.prototype.updateByExample=function(a,b,c,d,e){throw"cannot call abstract updateExample function"}}),module.define("@arangodb/arango-statement-common",function(a,b){function c(a,b){if(this._database=a,this._doCount=!1,this._batchSize=null,this._bindVars={},this._options=void 0,this._cache=void 0,!b)throw"ArangoStatement needs initial data";if("string"==typeof b?b={query:b}:"object"==typeof b&&"function"==typeof b.toAQL&&(b={query:b.toAQL()}),!(b instanceof Object))throw"ArangoStatement needs initial data";if(void 0===b.query||""===b.query)throw"ArangoStatement needs a valid query attribute";this.setQuery(b.query),b.bindVars instanceof Object&&this.bind(b.bindVars),b.options instanceof Object&&this.setOptions(b.options),void 0!==b.count&&this.setCount(b.count),void 0!==b.batchSize&&this.setBatchSize(b.batchSize),void 0!==b.cache&&this.setCache(b.cache)}c.prototype.bind=function(a,b){if(a instanceof Object){if(void 0!==b)throw"invalid bind parameter declaration";this._bindVars=a}else if("string"==typeof a)this._bindVars[a]=b;else{if("number"!=typeof a)throw"invalid bind parameter declaration";var c=String(parseInt(a,10));if(c!==String(a))throw"invalid bind parameter declaration";this._bindVars[c]=b}},c.prototype.getBindVariables=function(){return this._bindVars},c.prototype.getCache=function(){return this._cache},c.prototype.getCount=function(){return this._doCount},c.prototype.getBatchSize=function(){return this._batchSize},c.prototype.getOptions=function(){return this._options},c.prototype.getQuery=function(){return this._query},c.prototype.setCache=function(a){this._cache=a?!0:!1},c.prototype.setCount=function(a){this._doCount=a?!0:!1},c.prototype.setBatchSize=function(a){var b=parseInt(a,10);b>0&&(this._batchSize=b)},c.prototype.setOptions=function(a){this._options=a},c.prototype.setQuery=function(a){this._query=a&&"function"==typeof a.toAQL?a.toAQL():a},c.prototype.parse=function(){throw"cannot call abstract method parse()"},c.prototype.explain=function(){throw"cannot call abstract method explain()"},c.prototype.execute=function(){throw"cannot call abstract method execute()"},a.ArangoStatement=c}),module.define("@arangodb/common",function(a,b){"use strict";var c=require("internal"),d=require("fs");Object.keys(c.errors).forEach(function(b){a[b]=c.errors[b].code}),a.errors=c.errors,a.ArangoError=c.ArangoError,a.defineModule=function(a,e){var f,g,h;f=d.read(e),h=c.db._collection("_modules"),null===h&&(h=c.db._create("_modules",{isSystem:!0})),a=b.normalize(a),g=h.firstExample({path:a}),null===g?h.save({path:a,content:f}):h.replace(g,{path:a,content:f})},a.normalizeURL=function(a){var b,c,d,e,f,g;if(""===a)return"./";for(d=a.split("/"),"."===d[0]||".."===d[0]?(f=d[0]+"/",d.shift(),e=d):""===d[0]?(f="/",d.shift(),e=d):(f="./",e=d),c=[],b=0;b0&&(l=d[h]>=k.length?d[h]:k.length);var m=h;e.hasOwnProperty("rename")&&e.rename.hasOwnProperty(h)&&(m=e.rename[h]),f.push({id:h,fixedLength:l,length:l||m.length}),g[0][j++]=m}b.forEach(function(a,b){g[b+1]=[],f.forEach(function(c){if(a.hasOwnProperty(c.id)){var d;d=e.prettyStrings&&"string"==typeof a[c.id]?a[c.id]:JSON.stringify(a[c.id])||"",g[b+1].push(d),d.length>c.length&&!c.fixedLength&&(c.length=Math.min(d.length,100))}else g[b+1].push("")})});var n=function(){var b=[];return f.forEach(function(c){b.push(a.stringPadding("",c.length,"-","r"))}),e.framed?"+-"+b.join("-+-")+"-+\n":b.join(" ")+"\n"},o=function(){var d="";return e.framed&&(d+=n()),g.forEach(function(b,c){var g=[];b.forEach(function(c,d){var e=f[d].length,h=b[d];h.length>e&&(h=h.substr(0,e-k.length)+k),g.push(a.stringPadding(h,e," ","r"))}),d+=e.framed?"| "+g.join(" | ")+" |\n":g.join(" ")+"\n",0===c&&(d+=n())}),d+=n(),e.hideTotal||(d+=c.sprintf(e.totalString,String(b.length))),d};Array.isArray(b)&&(0===b.length?a.print(e.emptyString||"no document(s)"):a.print(o()))},a.stringPadding=function(a,b,c,d){function e(a,b){var c,d="";for(c=0;a>c;++c)d+=b;return d}if("undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=" "),b+1>=a.length)switch(d||"r"){case"l":a=e(b+1-a.length,c)+a;break;case"b":var f=b-a.length,g=Math.ceil(f/2),h=f-g;a=e(h+1,c)+a+e(g+1,c);break;default:a+=e(b+1-a.length,c)}return a},a.throwDownloadError=function(b){throw new a.ArangoError({errorNum:a.errors.ERROR_APPLICATION_DOWNLOAD_FAILED.code,errorMessage:a.errors.ERROR_APPLICATION_DOWNLOAD_FAILED.message+": "+String(b)})},a.throwFileNotFound=function(b){throw new a.ArangoError({errorNum:a.errors.ERROR_FILE_NOT_FOUND.code,errorMessage:a.errors.ERROR_FILE_NOT_FOUND.message+": "+String(b)})},a.throwBadParameter=function(b){throw new a.ArangoError({errorNum:a.errors.ERROR_BAD_PARAMETER.code,errorMessage:a.errors.ERROR_BAD_PARAMETER.message+": "+String(b)})},a.checkParameter=function(b,c,d){var e;for(e=0;e0){var h=new f;throw h.errorNum=c.errors.ERROR_BAD_PARAMETER.code,h.errorMessage=d+": "+e.join(" and ")+" are not known to the graph",h}return!0},s=function(a,b){this.query=a,b&&(this.type=b)};s.prototype.printQuery=function(){return this.query},s.prototype.isPathQuery=function(){return"path"===this.type},s.prototype.isPathVerticesQuery=function(){return"pathVertices"===this.type},s.prototype.isPathEdgesQuery=function(){return"pathEdges"===this.type},s.prototype.isEdgeQuery=function(){return"edge"===this.type},s.prototype.isVertexQuery=function(){return"vertex"===this.type},s.prototype.isNeighborQuery=function(){return"neighbor"===this.type},s.prototype.allowsRestrict=function(){return this.isEdgeQuery()||this.isVertexQuery()||this.isNeighborQuery()};var t=function(a){this.stack=[],this.callStack=[],this.bindVars={graphName:a.__name},this.graph=a,this.cursor=null,this.lastVar="",this._path=[],this._pathVertices=[],this._pathEdges=[],this._getPath=!1};t.prototype._addToPrint=function(a){var b=Array.prototype.slice.call(arguments);b.shift();var c={};c.name=a,b.length>0&&void 0!==b[0]?c.params=b:c.params=[],this.callStack.push(c)},t.prototype._PRINT=function(a){a.output="[ GraphAQL ",a.output+=this.graph.__name,i.each(this.callStack,function(b){a.prettyPrint&&(a.output+="\n"),a.output+=".",a.output+=b.name,a.output+="(";var c=0;for(c=0;c0&&(a.output+=", "),d.printRecursive(b.params[c],a);a.output+=")"}),a.output+=" ] "},t.prototype._clearCursor=function(){this.cursor&&(this.cursor.dispose(),this.cursor=null)},t.prototype._createCursor=function(){this.cursor||(this.cursor=this.execute())},t.prototype._edges=function(a,b){this._clearCursor(),this.options=b||{};var c=q(a),d="edges_"+this.stack.length,e="FOR "+d+" IN GRAPH_EDGES(@graphName";e+=this.getLastVar()?","+this.getLastVar():",{}",e+=",@options_"+this.stack.length+")",Array.isArray(c)||(c=[c]),this.options.edgeExamples=c,this.options.includeData=!0,this.bindVars["options_"+this.stack.length]=this.options;var f=new s(e,"edge");return this.stack.push(f),this.lastVar=d,this._path.push(d),this._pathEdges.push(d),this},t.prototype.edges=function(a){return this._addToPrint("edges",a),this._edges(a,{direction:"any"})},t.prototype.outEdges=function(a){return this._addToPrint("outEdges",a),this._edges(a,{direction:"outbound"})},t.prototype.inEdges=function(a){return this._addToPrint("inEdges",a),this._edges(a,{direction:"inbound"})},t.prototype._vertices=function(a,b,c){this._clearCursor(),this.options=b||{};var d=q(a),e="vertices_"+this.stack.length,f="FOR "+e+" IN GRAPH_VERTICES(@graphName,";if(void 0!==c)if(Array.isArray(c)){var g;for(f+="[",g=0;g0&&(f+=","),f+="MERGE(@vertexExample_"+this.stack.length+","+c[g]+")";f+="]"}else f+=Array.isArray(d)?"@vertexExample_"+this.stack.length+" [ * RETURN MERGE(CURRENT,"+c+")]":"MERGE(@vertexExample_"+this.stack.length+","+c+")";else f+="@vertexExample_"+this.stack.length;f+=",@options_"+this.stack.length+")",this.bindVars["vertexExample_"+this.stack.length]=d,this.bindVars["options_"+this.stack.length]=this.options;var h=new s(f,"vertex");return this.stack.push(h),this.lastVar=e,this._path.push(e),this._pathVertices.push(e),this},t.prototype.vertices=function(a){if(this._addToPrint("vertices",a),!this.getLastVar())return this._vertices(a);var b=this.getLastVar();return this._vertices(a,void 0,["{'_id': "+b+"._from}","{'_id': "+b+"._to}"])},t.prototype.fromVertices=function(a){if(this._addToPrint("fromVertices",a),!this.getLastVar())return this._vertices(a);var b=this.getLastVar();return this._vertices(a,void 0,"{'_id': "+b+"._from}")},t.prototype.toVertices=function(a){if(this._addToPrint("toVertices",a),!this.getLastVar())return this._vertices(a);var b=this.getLastVar();return this._vertices(a,void 0,"{'_id': "+b+"._to}")},t.prototype.getLastVar=function(){return""===this.lastVar?!1:this.lastVar},t.prototype.path=function(){this._clearCursor();var a=new s("","path");return this.stack.push(a),this},t.prototype.pathVertices=function(){this._clearCursor();var a=new s("","pathVertices");return this.stack.push(a),this},t.prototype.pathEdges=function(){this._clearCursor();var a=new s("","pathEdges");return this.stack.push(a),this},t.prototype.neighbors=function(a,b){this._addToPrint("neighbors",a,b);var c,d=q(a),e="neighbors_"+this.stack.length,f="FOR "+e+" IN GRAPH_NEIGHBORS(@graphName,"+this.getLastVar()+",@options_"+this.stack.length+")";c=b?i.extend({},b):{},c.neighborExamples=d,c.includeData=!0,this.bindVars["options_"+this.stack.length]=c;var g=new s(f,"neighbor");return this.stack.push(g),this.lastVar=e,this._path.push(e),this._pathVertices.push(e),this},t.prototype._getLastRestrictableStatementInfo=function(){for(var a=this.stack.length-1;!this.stack[a].allowsRestrict();)a--;return{statement:this.stack[a],options:this.bindVars["options_"+a]}},t.prototype.restrict=function(a){var b=j(a);if(0===b.length)return this;this._addToPrint("restrict",a),this._clearCursor();var c,d=this._getLastRestrictableStatementInfo(),e=d.statement,f=d.options;return e.isEdgeQuery()?(r(this.graph._edgeCollections(),b,"edge collections"),c=f.edgeCollectionRestriction||[],f.edgeCollectionRestriction=c.concat(a)):(e.isVertexQuery()||e.isNeighborQuery())&&(r(this.graph._vertexCollections(),b,"vertex collections"),c=f.vertexCollectionRestriction||[],f.vertexCollectionRestriction=c.concat(a)),this},t.prototype.filter=function(a){this._addToPrint("filter",a),this._clearCursor();var b=[];if("[object Array]"!==Object.prototype.toString.call(a)){if("[object Object]"!==Object.prototype.toString.call(a)){var d=new f;throw d.errorNum=c.errors.ERROR_GRAPH_INVALID_EXAMPLE_ARRAY_OBJECT.code,d.errorMessage=c.errors.ERROR_GRAPH_INVALID_EXAMPLE_ARRAY_OBJECT.message,d}b=[a]}else b=a;var e="FILTER MATCHES("+this.getLastVar()+","+JSON.stringify(b)+")";return this.stack.push(new s(e)),this},t.prototype.printQuery=function(){return this.stack.map(function(a){return a.printQuery()}).join(" ")},t.prototype.execute=function(){this._clearCursor();var a=this.printQuery(),b=this.bindVars;return a+=this.stack[this.stack.length-1].isPathQuery()?" RETURN ["+this._path+"]":this.stack[this.stack.length-1].isPathVerticesQuery()?" RETURN FLATTEN(["+this._pathVertices+"])":this.stack[this.stack.length-1].isPathEdgesQuery()?" RETURN FLATTEN(["+this._pathEdges+"])":" RETURN "+this.getLastVar(),g._query(a,b,{count:!0})},t.prototype.toArray=function(){return this._createCursor(),this.cursor.toArray()},t.prototype.count=function(){return this._createCursor(),this.cursor.count()},t.prototype.hasNext=function(){return this._createCursor(),this.cursor.hasNext()},t.prototype.next=function(){return this._createCursor(),this.cursor.next()};var u=function(a,b){var d;if(arguments.length<2)throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_INVALID_NUMBER_OF_ARGUMENTS.code,d.errorMessage=c.errors.ERROR_GRAPH_INVALID_NUMBER_OF_ARGUMENTS.message+"2",d;if("string"!=typeof a||""===a)throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_INVALID_PARAMETER.code,d.errorMessage=c.errors.ERROR_GRAPH_INVALID_PARAMETER.message+" arg1 must not be empty",d;if(!k(b))throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_INVALID_PARAMETER.code,d.errorMessage=c.errors.ERROR_GRAPH_INVALID_PARAMETER.message+" arg2 must not be empty",d;return{collection:a,from:j(b),to:j(b)}},v=function(a,b,d){var e;if(arguments.length<3)throw e=new f,e.errorNum=c.errors.ERROR_GRAPH_INVALID_NUMBER_OF_ARGUMENTS.code,e.errorMessage=c.errors.ERROR_GRAPH_INVALID_NUMBER_OF_ARGUMENTS.message+"3",e;if("string"!=typeof a||""===a)throw e=new f,e.errorNum=c.errors.ERROR_GRAPH_INVALID_PARAMETER.code,e.errorMessage=c.errors.ERROR_GRAPH_INVALID_PARAMETER.message+" arg1 must be non empty string",e;if(!k(b))throw e=new f,e.errorNum=c.errors.ERROR_GRAPH_INVALID_PARAMETER.code,e.errorMessage=c.errors.ERROR_GRAPH_INVALID_PARAMETER.message+" arg2 must be non empty string or array",e;if(!k(d))throw e=new f,e.errorNum=c.errors.ERROR_GRAPH_INVALID_PARAMETER.code,e.errorMessage=c.errors.ERROR_GRAPH_INVALID_PARAMETER.message+" arg3 must be non empty string or array",e;return{collection:a,from:j(b),to:j(d)}},w=function(){var a=n();return i.pluck(a.toArray(),"_key")},x=function(){return n().toArray()},y=function(){var a=[],b=arguments;return Object.keys(b).forEach(function(c){a.push(b[c])}),a},z=function(a){var b=arguments,c=0;Object.keys(b).forEach(function(d){c++,1!==c&&a.push(b[d])})},A=function(a){return a.from=a.from.sort(),a.to=a.to.sort(),a},B=function(a,b,d,g){Array.isArray(d)||(d=[]);var i,j,k,o=n(),p=!0;if(!a)throw i=new f,i.errorNum=c.errors.ERROR_GRAPH_CREATE_MISSING_NAME.code,i.errorMessage=c.errors.ERROR_GRAPH_CREATE_MISSING_NAME.message,i;if(b=b||[], !Array.isArray(b))throw i=new f,i.errorNum=c.errors.ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION.code,i.errorMessage=c.errors.ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION.message,i;var q=[],r={};b.forEach(function(a){var b=a.collection;if(-1!==q.indexOf(b))throw i=new f,i.errorNum=c.errors.ERROR_GRAPH_COLLECTION_MULTI_USE.code,i.errorMessage=c.errors.ERROR_GRAPH_COLLECTION_MULTI_USE.message,i;q.push(b),r[b]=a}),o.toArray().forEach(function(a){var b=a.edgeDefinitions;b.forEach(function(a){var b=a.collection;if(-1!==q.indexOf(b)&&JSON.stringify(a)!==JSON.stringify(r[b]))throw i=new f,i.errorNum=c.errors.ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS.code,i.errorMessage=b+" "+c.errors.ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS.message,i})});try{o.document(a)}catch(s){if(s.errorNum!==h.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code)throw s;p=!1}if(p)throw i=new f,i.errorNum=c.errors.ERROR_GRAPH_DUPLICATE.code,i.errorMessage=c.errors.ERROR_GRAPH_DUPLICATE.message,i;j=m(b,!1),d.forEach(function(a){l(a,e.TYPE_DOCUMENT)}),b.forEach(function(a,c){var d=A(a);b[c]=d}),d=d.sort();var t=o.save({orphanCollections:d,edgeDefinitions:b,_key:a},g);return k=new H(a,b,j[0],j[1],d,t._rev,t._id)},C=function(a,b,c){Object.defineProperty(a,b,{enumerable:!1,writable:!0}),a[b]=c},D=function O(a,b,c,d){d.__idsToRemove[c]=1,a.forEach(function(e){var f=e.edgeDefinitions;e.edgeDefinitions&&f.forEach(function(e){var f=e.from,h=e.to,i=e.collection;if(-1!==f.indexOf(b)||-1!==h.indexOf(b)){var j=g._collection(i).edges(c);j.forEach(function(b){d.__idsToRemove.hasOwnProperty(b._id)||(d.__collectionsToLock[i]=1,O(a,i,b._id,d))})}})})},E=function(a,b){i.each(b,function(b){var d=g._collection(b),e=p(d),h=e.save;e.save=function(d,e,g){if("string"!=typeof d||-1===d.indexOf("/")||"string"!=typeof e||-1===e.indexOf("/")){var j=new f;throw j.errorNum=c.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.code,j.errorMessage=c.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.message,j}return a.__edgeDefinitions.forEach(function(a){if(a.collection===b){var g=d.split("/")[0],h=e.split("/")[0];if(!i.contains(a.from,g)||!i.contains(a.to,h)){var j=new f;throw j.errorNum=c.errors.ERROR_GRAPH_INVALID_EDGE.code,j.errorMessage=c.errors.ERROR_GRAPH_INVALID_EDGE.message+" between "+d+" and "+e+".",j}}}),h(d,e,g)},e.remove=function(c,d){-1===c.indexOf("/")&&(c=b+"/"+c);var e=n().toArray(),f=c.split("/")[0];a.__collectionsToLock[f]=1,D(e,f,c,a);try{g._executeTransaction({collections:{write:Object.keys(a.__collectionsToLock)},embed:!0,action:function(a){var b=require("internal").db;a.ids.forEach(function(c){a.options?b._remove(c,a.options):b._remove(c)})},params:{ids:Object.keys(a.__idsToRemove),options:d}})}catch(h){throw a.__idsToRemove={},a.__collectionsToLock={},h}return a.__idsToRemove={},a.__collectionsToLock={},!0},a[b]=e})},F=function(a,b){i.each(b,function(b){var c=g._collection(b),d=p(c);d.remove=function(c,d){var e=n().toArray(),f=b;-1===c.indexOf("/")&&(c=b+"/"+c),a.__collectionsToLock[f]=1,e.forEach(function(b){var d=b.edgeDefinitions;b.edgeDefinitions&&d.forEach(function(b){var d=b.from,h=b.to,i=b.collection;if(-1!==d.indexOf(f)||-1!==h.indexOf(f)){var j=g._collection(i).edges(c);j.length>0&&(a.__collectionsToLock[i]=1,j.forEach(function(b){D(e,i,b._id,a)}))}})});try{g._executeTransaction({collections:{write:Object.keys(a.__collectionsToLock)},embed:!0,action:function(a){var b=require("internal").db;a.ids.forEach(function(c){a.options?b._remove(c,a.options):b._remove(c)}),a.options?b._remove(a.vertexId,a.options):b._remove(a.vertexId)},params:{ids:Object.keys(a.__idsToRemove),options:d,vertexId:c}})}catch(h){throw a.__idsToRemove={},a.__collectionsToLock={},h}return a.__idsToRemove={},a.__collectionsToLock={},!0},a[b]=d})},G=function(a){Object.keys(a).forEach(function(b){"_"!==b.substring(0,1)&&delete a[b]}),a.__edgeDefinitions.forEach(function(b){E(a,[b.collection]),F(a,b.from),F(a,b.to)}),F(a,a.__orphanCollections)},H=function(a,b,c,d,e,f,g){b.forEach(function(a,c){var d=A(a);b[c]=d}),e||(e=[]);var h="object"==typeof ArangoClusterComm;h&&require("@arangodb/cluster").isCoordinator()&&(h=!1);var i=this;C(this,"__useBuiltIn",h),C(this,"__name",a),C(this,"__vertexCollections",c),C(this,"__edgeCollections",d),C(this,"__edgeDefinitions",b),C(this,"__idsToRemove",{}),C(this,"__collectionsToLock",{}),C(this,"__id",g),C(this,"__rev",f),C(this,"__orphanCollections",e),G(i)},I=function(a){var b,d,e,g=n();try{b=g.document(a)}catch(i){if(i.errorNum!==h.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code)throw i;var j=new f;throw j.errorNum=c.errors.ERROR_GRAPH_NOT_FOUND.code,j.errorMessage=c.errors.ERROR_GRAPH_NOT_FOUND.message,j}return d=m(b.edgeDefinitions,!0),e=b.orphanCollections,e||(e=[]),new H(a,b.edgeDefinitions,d[0],d[1],e,b._rev,b._id)},J=function(a){var b=n();return b.exists(a)},K=function(a,b){g._executeTransaction({collections:{write:"_graphs"},action:function(a){var b=n();b&&b.toArray().forEach(function(c){var d,e,f=i.extend({},c),g=!1;if(f.edgeDefinitions)for(d=0;dc;c++)this.hasOwnProperty(c)&&(e[c]=a.call(b,this[c],c,this));return e},f.prototype.getInVertex=function(){return this.map(function(a){return a.getInVertex()})},f.prototype.getOutVertex=function(){return this.map(function(a){return a.getOutVertex()})},f.prototype.getPeerVertex=function(a){return this.map(function(b){return b.getPeerVertex(a)})},f.prototype.setProperty=function(a,b){return this.map(function(c){return c.setProperty(a,b)})},f.prototype.edges=function(){return this.map(function(a){return a.edges()})},f.prototype.outbound=function(){return this.map(function(a){return a.outbound()})},f.prototype.inbound=function(){return this.map(function(a){return a.inbound()})},f.prototype.getInEdges=function(){var a=arguments;return this.map(function(b){return b.getInEdges.apply(b,a)})},f.prototype.getOutEdges=function(){var a=arguments;return this.map(function(b){return b.getOutEdges.apply(b,a)})},f.prototype.getEdges=function(){var a=arguments;return this.map(function(b){return b.getEdges.apply(b,a)})},f.prototype.degree=function(){return this.map(function(a){return a.degree()})},f.prototype.inDegree=function(){return this.map(function(a){return a.inDegree()})},f.prototype.inDegree=function(){return this.map(function(a){return a.outDegree()})},f.prototype.properties=function(){return this.map(function(a){return a.properties()})},c=function(a,b){this._graph=a,this._id=b._key,this._properties=b},c.prototype.getId=function(){return this._properties._key},c.prototype.getLabel=function(){return this._properties.$label},c.prototype.getProperty=function(a){return this._properties[a]},c.prototype.getPropertyKeys=function(){return this._properties.propertyKeys},c.prototype.properties=function(){return this._properties._shallowCopy},c.prototype.getInVertex=function(){return this._graph.getVertex(this._properties._to)},c.prototype.getOutVertex=function(){return this._graph.getVertex(this._properties._from)},c.prototype.getPeerVertex=function(a){return a._properties._id===this._properties._to?this._graph.getVertex(this._properties._from):a._properties._id===this._properties._from?this._graph.getVertex(this._properties._to):null},c.prototype._PRINT=function(a){this._properties._id?void 0!==this._properties._key?"string"==typeof this._properties._key?a.output+='Edge("'+this._properties._key+'")':a.output+="Edge("+this._properties._key+")":a.output+="Edge(<"+this._id+">)":a.output+="[deleted Edge]"},e=function(a,b){this._graph=a,this._id=b._key,this._properties=b},e.prototype.addInEdge=function(a,b,c,d){return this._graph.addEdge(a,this,b,c,d)},e.prototype.addOutEdge=function(a,b,c,d){return this._graph.addEdge(this,a,b,c,d)},e.prototype.degree=function(){return this.getEdges().length},e.prototype.inDegree=function(){return this.getInEdges().length},e.prototype.outDegree=function(){return this.getOutEdges().length},e.prototype.getId=function(){return this._properties._key},e.prototype.getProperty=function(a){return this._properties[a]},e.prototype.getPropertyKeys=function(){return this._properties.propertyKeys},e.prototype.properties=function(){return this._properties._shallowCopy},e.prototype._PRINT=function(a){this._properties._id?void 0!==this._properties._key?"string"==typeof this._properties._key?a.output+='Vertex("'+this._properties._key+'")':a.output+="Vertex("+this._properties._key+")":a.output+="Vertex(<"+this._id+">)":a.output+="[deleted Vertex]"},d=function(a,b,c,d){this.initialize(a,b,c,d)},d.prototype._prepareEdgeData=function(a,b){var c;return h.notExisty(a)&&h.object(b)&&(a=b,b=null),h.notExisty(b)&&h.existy(a)&&h.existy(a.$label)&&(b=a.$label),c=h.notExisty(a)||h.noObject(a)?{}:a._shallowCopy||{},c.$label=b,c},d.prototype._prepareVertexData=function(a){var b;return b=h.notExisty(a)||h.noObject(a)?{}:a._shallowCopy||{}},d.prototype.getOrAddVertex=function(a){var b=this.getVertex(a);return null===b&&(b=this.addVertex(a)),b},d.prototype.addEdge=function(a,b,c,d,e,f){var g,i;return g=h.string(a)?a:a._properties._id,i=h.string(b)?b:b._properties._id,this._saveEdge(c,g,i,this._prepareEdgeData(e,d),f)},d.prototype.addVertex=function(a,b,c){return this._saveVertex(a,this._prepareVertexData(b),c)},d.prototype.replaceVertex=function(a,b){this._replaceVertex(a,b)},d.prototype.replaceEdge=function(a,b){this._replaceEdge(a,b)},d.prototype.order=function(){return this._vertices.count()},d.prototype.size=function(){return this._edges.count()},d.prototype.emptyCachedPredecessors=function(){this.predecessors={}},d.prototype.getCachedPredecessors=function(a,b){var c;return this.predecessors[a.getId()]&&(c=this.predecessors[a.getId()][b.getId()]),c},d.prototype.setCachedPredecessors=function(a,b,c){this.predecessors[a.getId()]||(this.predecessors[a.getId()]={}),this.predecessors[a.getId()][b.getId()]=c},d.prototype.constructVertex=function(a){var b,c;"string"==typeof a?b=a:(b=a._id,c=a._rev);var d=this._verticesCache[b];if(void 0===d||d._rev!==c){var f=this._vertices.document(b);if(!f)throw"accessing a deleted vertex";this._verticesCache[b]=d=new e(this,f)}return d},d.prototype.constructEdge=function(a){var b,d,e,f;if("string"==typeof a?b=a:(b=a._id,d=a._rev),e=this._edgesCache[b],void 0===e||e._rev!==d){if(f=this._edges.document(b),!f)throw"accessing a deleted edge";this._edgesCache[b]=e=new c(this,f)}return e},d.prototype._PRINT=function(a){a.output+='Graph("'+this._properties._key+'")'},a.Edge=c,a.Graph=d,a.Vertex=e,a.GraphArray=f,a.Iterator=g}),module.define("@arangodb/graph",function(a,b){var c=require("@arangodb/graph-blueprint");Object.keys(c).forEach(function(b){a[b]=c[b]})}),module.define("@arangodb/graph/traversal",function(a,b){function c(a){if(null===a||"object"!=typeof a)return a;var b;if(Array.isArray(a))b=[],a.forEach(function(a){b.push(c(a))});else if(a instanceof Object){if(J&&a instanceof J)return a;b={},Object.keys(a).forEach(function(d){b[d]=c(a[d])})}return b}function d(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}function e(a){var b=a;"string"==typeof b&&(b=K._collection(b));var c="object"==typeof ArangoClusterComm;return c&&require("@arangodb/cluster").isCoordinator()&&(c=!1),{edgeCollection:b,useBuiltIn:c,getVertexId:function(a){return a._id},getPeerVertex:function(a,b){return a._from===b._id?K._document(a._to):a._to===b._id?K._document(a._from):null},getInVertex:function(a){return K._document(a._to)},getOutVertex:function(a){return K._document(a._from)},getEdgeId:function(a){return a._id},getEdgeFrom:function(a){return a._from},getEdgeTo:function(a){return a._to},getLabel:function(a){return a.$label},getAllEdges:function(a){return this.useBuiltIn?this.edgeCollection.EDGES(a._id):this.edgeCollection.edges(a._id)},getInEdges:function(a){return this.useBuiltIn?this.edgeCollection.INEDGES(a._id):this.edgeCollection.inEdges(a._id)},getOutEdges:function(a){return this.useBuiltIn?this.edgeCollection.OUTEDGES(a._id):this.edgeCollection.outEdges(a._id)}}}function f(a){var b=a;return"string"==typeof b&&(b=F._graph(b)),{graph:b,getVertexId:function(a){return a._id},getPeerVertex:function(a,b){return a._from===b._id?K._document(a._to):a._to===b._id?K._document(a._from):null},getInVertex:function(a){return K._document(a._to)},getOutVertex:function(a){return K._document(a._from)},getEdgeId:function(a){return a._id},getEdgeFrom:function(a){return a._from},getEdgeTo:function(a){return a._to},getLabel:function(a){return a.$label},getAllEdges:function(a){return this.graph._EDGES(a._id)},getInEdges:function(a){return this.graph._INEDGES(a._id)},getOutEdges:function(a){return this.graph._OUTEDGES(a._id)}}}function g(a){return{graph:new E.Graph(a),getVertexId:function(a){return a.getId()},getPeerVertex:function(a,b){return a.getPeerVertex(b)},getInVertex:function(a){return a.getInVertex()},getOutVertex:function(a){return a.getOutVertex()},getEdgeId:function(a){return a.getId()},getEdgeFrom:function(a){return a._properties._from},getEdgeTo:function(a){return a._properties._to},getLabel:function(a){return a.getLabel()},getAllEdges:function(a){return a.edges()},getInEdges:function(a){return a.inbound()},getOutEdges:function(a){return a.outbound()}}}function h(a,b,c){var d,e=a.datasource,f=[],g=e.getOutEdges(b);return g.length>1&&a.sort&&g.sort(a.sort),d=a.buildVertices?a.expandFilter?function(b){try{var d=e.getInVertex(b);a.expandFilter(a,d,b,c)&&f.push({edge:b,vertex:d})}catch(g){}}:function(a){try{var b=e.getInVertex(a);f.push({edge:a,vertex:b})}catch(c){}}:a.expandFilter?function(b){var d=e.getEdgeTo(b),g={_id:d,_key:d.substr(d.indexOf("/")+1)};a.expandFilter(a,g,b,c)&&f.push({edge:b,vertex:g})}:function(a){var b=e.getEdgeTo(a),c={_id:b,_key:b.substr(b.indexOf("/")+1)};f.push({edge:a,vertex:c})},g.forEach(d),f}function i(a,b,c){var d=a.datasource,e=[],f=d.getInEdges(b);f.length>1&&a.sort&&f.sort(a.sort);var g;return g=a.buildVertices?a.expandFilter?function(b){try{var f=d.getOutVertex(b);a.expandFilter(a,f,b,c)&&e.push({edge:b,vertex:f})}catch(g){}}:function(a){try{var b=d.getOutVertex(a);e.push({edge:a,vertex:b})}catch(c){}}:a.expandFilter?function(b){var f=d.getEdgeFrom(b),g={_id:f,_key:f.substr(f.indexOf("/")+1)};a.expandFilter(a,g,b,c)&&e.push({edge:b,vertex:g})}:function(a){var b=d.getEdgeFrom(a),c={_id:b,_key:b.substr(b.indexOf("/")+1)};e.push({edge:a,vertex:c})},f.forEach(g),e}function j(a,b,c){var d=a.datasource,e=[],f=d.getAllEdges(b);f.length>1&&a.sort&&f.sort(a.sort);var g;return g=a.buildVertices?a.expandFilter?function(f){try{var g=d.getPeerVertex(f,b);a.expandFilter(a,g,f,c)&&e.push({edge:f,vertex:g})}catch(h){}}:function(a){try{var c=d.getPeerVertex(a,b);e.push({edge:a,vertex:c})}catch(f){}}:a.expandFilter?function(f){var g=d.getEdgeFrom(f);g===b._id&&(g=d.getEdgeTo(f));var h={_id:g,_key:g.substr(g.indexOf("/")+1)};a.expandFilter(a,h,f,c)&&e.push({edge:f,vertex:h})}:function(a){var c=d.getEdgeFrom(a);c===b._id&&(c=d.getEdgeTo(a));var f={_id:c,_key:c.substr(c.indexOf("/")+1)};e.push({edge:a,vertex:f})},f.forEach(g),e}function k(a,b,c){var d,e=a.datasource,f=[];Array.isArray(a.labels)||(a.labels=[a.labels]);var g=e.getOutEdges(b);if(void 0!==g)for(d=0;d=0&&f.push({edge:h,vertex:e.getInVertex(h)})}return f}function l(a,b,c){var d,e=a.datasource,f=[];Array.isArray(a.labels)||(a.labels=[a.labels]);var g=a.datasource.getInEdges(b);if(void 0!==g)for(d=0;d=0&&f.push({edge:h,vertex:e.getOutVertex(h)})}return f}function m(a,b,c){var d,e=a.datasource,f=[];Array.isArray(a.labels)||(a.labels=[a.labels]);var g=a.datasource.getAllEdges(b);if(void 0!==g)for(d=0;d=0&&f.push({edge:h,vertex:e.getPeerVertex(h,b)})}return f}function n(a,b,d,e){b&&b.visited&&(b.visited.vertices&&b.visited.vertices.push(c(d)),b.visited.paths&&b.visited.paths.push(c(e)))}function o(a,b,c,d){b&&(b.hasOwnProperty("count")?++b.count:b.count=1)}function p(){}function q(){return""}function r(a,b,c){return c&&c.vertices&&c.vertices.length>a.maxDepth?D.PRUNE:void 0}function s(a,b,c){return c&&c.vertices&&c.vertices.length<=a.minDepth?D.EXCLUDE:void 0}function t(a,b,c){Array.isArray(a.matchingAttributes)||(a.matchingAttributes=[a.matchingAttributes]);var d=!1;a.matchingAttributes.forEach(function(a){var c=0,e=Object.keys(a);e.forEach(function(d){b[d]&&b[d]===a[d]&&c++}),c>0&&c===e.length&&(d=!0)});var e;return d||(e="exclude"),e}function u(a,b,c,d){var e=[];return a.forEach(function(a){var f=a(b,c,d);Array.isArray(f)||(f=[f]),e=e.concat(f)}),e}function v(a){function b(a){if(void 0!==a&&null!==a){var d=!1;if("string"==typeof a)a===D.EXCLUDE?(c.visit=!1,d=!0):a===D.PRUNE?(c.expand=!1,d=!0):""===a&&(d=!0);else if(Array.isArray(a)){var e;for(e=0;e
',maxVisible:1,closeWith:["click"],type:e.get("type"),layout:"bottom",timeout:g,buttons:d,animation:{open:{height:"show"},close:{height:"hide"},easing:"swing",speed:200,closeWith:h}}),"success"===e.get("type"))return void e.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(){"function"==typeof this.action&&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"),active:!0,shouldRender:!0,timer:0,refreshRate:2e3,initialize:function(){var a=this;this.activeCollection=new window.QueryManagementActive,this.slowCollection=new window.QueryManagementSlow,this.convertModelToJSON(!0),window.setInterval(function(){"#queries"===window.location.hash&&window.VISIBLE&&a.shouldRender&&"queryManagement"===arangoHelper.getCurrentSub().route&&(a.active?$("#arangoQueryManagementTable").is(":visible")&&a.convertModelToJSON(!0):$("#arangoQueryManagementTable").is(":visible")&&a.convertModelToJSON(!1))},a.refreshRate)},events:{"click #deleteSlowQueryHistory":"deleteSlowQueryHistoryModal","click #arangoQueryManagementTable .fa-minus-circle":"deleteRunningQueryModal"},tableDescription:{id:"arangoQueryManagementTable",titles:["ID","Query String","Runtime","Started",""],rows:[],unescaped:[!1,!1,!1,!1,!0]},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(){var a=arangoHelper.getCurrentSub();a.params.active?(this.active=!0,this.convertModelToJSON(!0)):(this.active=!1,this.convertModelToJSON(!1))},addEvents:function(){var a=this;$("#queryManagementContent tbody").on("mousedown",function(){clearTimeout(a.timer),a.shouldRender=!1}),$("#queryManagementContent tbody").on("mouseup",function(){a.timer=window.setTimeout(function(){a.shouldRender=!0},3e3)})},renderActive:function(){this.$el.html(this.templateActive.render({})),$(this.id).append(this.table.render({content:this.tableDescription})),$("#activequeries").addClass("arango-active-tab"),this.addEvents()},renderSlow:function(){this.$el.html(this.templateSlow.render({})),$(this.id).append(this.table.render({content:this.tableDescription})),$("#slowqueries").addClass("arango-active-tab"),this.addEvents()},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({success:function(){a.updateLocalQueries(),a.renderSelectboxes(),a.updateTable(),a.allowUpload=!1,$("#customs-switch").click(),$("#confirmQueryImport").addClass("disabled"),$("#queryImportDialog").modal("hide")},error:function(a){arangoHelper.arangoError("Custom Queries",a.responseText)}})}.bind(this);a.collection.saveImportQueries(a.file,b.bind(this))}},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()).success(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(a){var b=this;this.collection.fetch({success:function(){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})});var e=function(a,b){a?arangoHelper.arangoError("Custom Queries","Could not import old local storage queries"):localStorage.removeItem("customQueries")}.bind(b);b.collection.saveCollectionQueries(e)}b.updateLocalQueries(),a&&a()}})},deleteAQL:function(a){var b=function(a){a?arangoHelper.arangoError("Query","Could not delete query."):(this.updateLocalQueries(),this.renderSelectboxes(),this.updateTable())}.bind(this),c=$(a.target).parent().parent().parent().children().first().text(),d=this.collection.findWhere({name:c});this.collection.remove(d),this.collection.saveCollectionQueries(b)},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})}var i=function(a){if(a)arangoHelper.arangoError("Query","Could not save query");else{var b=this;this.collection.fetch({success:function(){b.updateLocalQueries(),b.renderSelectboxes(),$("#querySelect").val(d)}})}}.bind(this);this.collection.saveCollectionQueries(i),window.modalView.hide()}},getSystemQueries:function(a){var b=this;$.ajax({type:"GET",cache:!1,url:"js/arango/aqltemplates.json",contentType:"application/json",processData:!1,success:function(c){a&&a(!1),b.queries=c},error:function(){a&&a(!0),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){var b=this,c=function(c){if(c)arangoHelper.arangoError("Query","Could not reload Queries");else if(b.updateLocalQueries(),a){var d=$("#querySelect").val();b.renderSelectboxes(),$("#querySelect").val(d)}}.bind(b),d=function(){b.getSystemQueries(c)}.bind(b);this.getAQL(d)},importSelected:function(a){var b=ace.edit("aqlEditor"),c=ace.edit("varsEditor");_.each(this.queries,function(d){$("#"+a.currentTarget.id).val()===d.name&&(b.setValue(d.value),d.hasOwnProperty("parameter")?((""===d.parameter||void 0===d.parameter)&&(d.parameter="{}"),"object"==typeof d.parameter?c.setValue(JSON.stringify(d.parameter)):c.setValue(d.parameter)):c.setValue("{}"))}),_.each(this.customQueries,function(d){$("#"+a.currentTarget.id).val()===d.name&&(b.setValue(d.value),d.hasOwnProperty("parameter")?((""===d.parameter||void 0===d.parameter||"{}"===JSON.stringify(d.parameter))&&(d.parameter="{}"),c.setValue(d.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(''),jQuery.each(this.queries,function(b,c){$(a).append('")}),$(a).append(""),this.customQueries.length>0&&($(a).append(''),jQuery.each(this.customQueries,function(b,c){$(a).append('")}),$(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="-";a&&a.extra&&a.extra.stats&&(e=a.extra.stats.executionTime.toFixed(3)+" s"),$(".queryExecutionTime").text("Execution time: "+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),$.noty.clearQueue(),$.noty.closeAll()},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.queryView2=Backbone.View.extend({el:"#content",bindParamId:"#bindParamEditor",myQueriesId:"#queryTable",template:templateEngine.createTemplate("queryView2.ejs"),table:templateEngine.createTemplate("arangoTable.ejs"),outputDiv:"#outputEditors",outputTemplate:templateEngine.createTemplate("queryViewOutput.ejs"),outputCounter:0,allowUpload:!1,customQueries:[],queries:[],state:{lastQuery:{query:void 0,bindParam:void 0}},settings:{aqlWidth:void 0},currentQuery:{},initDone:!1,bindParamRegExp:/@(@?\w+\d*)/,bindParamTableObj:{},bindParamTableDesc:{id:"arangoBindParamTable",titles:["Key","Value"],rows:[]},myQueriesTableDesc:{id:"arangoMyQueriesTable",titles:["Name","Actions"],rows:[]},execPending:!1,aqlEditor:null,queryPreview:null,initialize:function(){this.refreshAQL()},allowParamToggle:!0,events:{"click #executeQuery":"executeQuery","click #explainQuery":"explainQuery","click #clearQuery":"clearQuery","click .outputEditorWrapper #downloadQueryResult":"downloadQueryResult","click .outputEditorWrapper .switchAce":"switchAce","click .outputEditorWrapper .fa-close":"closeResult","click #toggleQueries1":"toggleQueries","click #toggleQueries2":"toggleQueries","click #saveCurrentQuery":"addAQL","click #exportQuery":"exportCustomQueries","click #importQuery":"openImportDialog","click #removeResults":"removeResults","click #querySpotlight":"showSpotlight","click #deleteQuery":"selectAndDeleteQueryFromTable","click #explQuery":"selectAndExplainQueryFromTable","keydown #arangoBindParamTable input":"updateBindParams","change #arangoBindParamTable input":"updateBindParams","click #arangoMyQueriesTable tbody tr":"showQueryPreview","dblclick #arangoMyQueriesTable tbody tr":"selectQueryFromTable","click #arangoMyQueriesTable #copyQuery":"selectQueryFromTable","click #closeQueryModal":"closeExportDialog","click #confirmQueryImport":"importCustomQueries","click #switchTypes":"toggleBindParams","click #arangoMyQueriesTable #runQuery":"selectAndRunQueryFromTable"},clearQuery:function(){this.aqlEditor.setValue("",1)},toggleBindParams:function(){this.allowParamToggle?($("#bindParamEditor").toggle(),$("#bindParamAceEditor").toggle(),"JSON"===$("#switchTypes").text()?($("#switchTypes").text("Table"),this.updateQueryTable(),this.bindParamAceEditor.setValue(JSON.stringify(this.bindParamTableObj,null," "),1),this.deselect(this.bindParamAceEditor)):($("#switchTypes").text("JSON"),this.renderBindParamTable())):arangoHelper.arangoError("Bind parameter","Could not parse bind parameter"),this.resize()},openExportDialog:function(){$("#queryImportDialog").modal("show")},closeExportDialog:function(){$("#queryImportDialog").modal("hide")},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({success:function(){a.updateLocalQueries(),a.updateQueryTable(),a.resize(),a.allowUpload=!1,$("#confirmQueryImport").addClass("disabled"),$("#queryImportDialog").modal("hide")},error:function(a){arangoHelper.arangoError("Custom Queries",a.responseText)}})}.bind(this);a.collection.saveImportQueries(a.file,b.bind(this))}},removeResults:function(){$(".outputEditorWrapper").hide("fast",function(){$(".outputEditorWrapper").remove()}),$("#removeResults").hide()},getCustomQueryParameterByName:function(a){return this.collection.findWhere({name:a}).get("parameter")},getCustomQueryValueByName:function(a){var b;return a&&(b=this.collection.findWhere({name:a})),b?b=b.get("value"):_.each(this.queries,function(c){c.name===a&&(b=c.value)}),b},openImportDialog:function(){$("#queryImportDialog").modal("show")},closeImportDialog:function(){$("#queryImportDialog").modal("hide")},exportCustomQueries:function(){var a;$.ajax("whoAmI?_="+Date.now()).success(function(b){a=b.user,(null===a||a===!1)&&(a="root"),window.open("query/download/"+encodeURIComponent(a))})},toggleQueries:function(a){a&&"toggleQueries1"===a.currentTarget.id?(this.updateQueryTable(),$("#bindParamAceEditor").hide(),$("#bindParamEditor").show(),$("#switchTypes").text("JSON"),$(".aqlEditorWrapper").first().width(.33*$(window).width()),this.queryPreview.setValue("No query selected.",1),this.deselect(this.queryPreview)):void 0===this.settings.aqlWidth?$(".aqlEditorWrapper").first().width(.33*$(window).width()):$(".aqlEditorWrapper").first().width(this.settings.aqlWidth),this.resize();var b=["aqlEditor","queryTable","previewWrapper","querySpotlight","bindParamEditor","toggleQueries1","toggleQueries2","saveCurrentQuery","querySize","executeQuery","switchTypes","explainQuery","importQuery","exportQuery"];_.each(b,function(a){$("#"+a).toggle()}),this.resize()},showQueryPreview:function(a){$("#arangoMyQueriesTable tr").removeClass("selected"),$(a.currentTarget).addClass("selected");var b=this.getQueryNameFromTable(a);this.queryPreview.setValue(this.getCustomQueryValueByName(b),1),this.deselect(this.queryPreview)},getQueryNameFromTable:function(a){var b;return $(a.currentTarget).is("tr")?b=$(a.currentTarget).children().first().text():$(a.currentTarget).is("span")&&(b=$(a.currentTarget).parent().parent().prev().text()),b},deleteQueryModal:function(a){var b=[],c=[];c.push(window.modalView.createReadOnlyEntry(void 0,a,"Do you want to delete the query?",void 0,void 0,!1,void 0)),b.push(window.modalView.createDeleteButton("Delete",this.deleteAQL.bind(this,a))),window.modalView.show("modalTable.ejs","Delete Query",b,c)},selectAndDeleteQueryFromTable:function(a){var b=this.getQueryNameFromTable(a);this.deleteQueryModal(b)},selectAndExplainQueryFromTable:function(a){this.selectQueryFromTable(a,!1),this.explainQuery()},selectAndRunQueryFromTable:function(a){this.selectQueryFromTable(a,!1),this.executeQuery()},selectQueryFromTable:function(a,b){ var c=this.getQueryNameFromTable(a),d=this;void 0===b&&this.toggleQueries(),this.state.lastQuery.query=this.aqlEditor.getValue(),this.state.lastQuery.bindParam=this.bindParamTableObj,this.aqlEditor.setValue(this.getCustomQueryValueByName(c),1),this.fillBindParamTable(this.getCustomQueryParameterByName(c)),this.updateBindParams(),$("#lastQuery").remove(),$("#queryContent .arangoToolbarTop .pull-left").append('Previous Query'),$("#lastQuery").hide().fadeIn(500).on("click",function(){d.aqlEditor.setValue(d.state.lastQuery.query,1),d.fillBindParamTable(d.state.lastQuery.bindParam),d.updateBindParams(),$("#lastQuery").fadeOut(500,function(){$(this).remove()})})},deleteAQL:function(a){var b=function(a){a?arangoHelper.arangoError("Query","Could not delete query."):(this.updateLocalQueries(),this.updateQueryTable(),this.resize(),window.modalView.hide())}.bind(this),c=this.collection.findWhere({name:a});this.collection.remove(c),this.collection.saveCollectionQueries(b)},switchAce:function(a){var b=$(a.currentTarget).attr("counter");"Result"===$(a.currentTarget).text()?$(a.currentTarget).text("AQL"):$(a.currentTarget).text("Result"),$("#outputEditor"+b).toggle(),$("#sentWrapper"+b).toggle(),this.deselect(ace.edit("outputEditor"+b)),this.deselect(ace.edit("sentQueryEditor"+b)),this.deselect(ace.edit("sentBindParamEditor"+b))},downloadQueryResult:function(a){var b=$(a.currentTarget).attr("counter"),c=ace.edit("sentQueryEditor"+b),d=c.getValue();""!==d||void 0!==d||null!==d?0===Object.keys(this.bindParamTableObj).length?window.open("query/result/download/"+encodeURIComponent(btoa(JSON.stringify({query:d})))):window.open("query/result/download/"+encodeURIComponent(btoa(JSON.stringify({query:d,bindVars:this.bindParamTableObj})))):arangoHelper.arangoError("Query error","could not query result.")},explainQuery:function(){if(!this.verifyQueryAndParams()){this.$(this.outputDiv).prepend(this.outputTemplate.render({counter:this.outputCounter,type:"Explain"}));var a=this.outputCounter,b=ace.edit("outputEditor"+a),c=ace.edit("sentQueryEditor"+a),d=ace.edit("sentBindParamEditor"+a);c.getSession().setMode("ace/mode/aql"),c.setOption("vScrollBarAlwaysVisible",!0),c.setReadOnly(!0),this.setEditorAutoHeight(c),b.setReadOnly(!0),b.getSession().setMode("ace/mode/json"),b.setOption("vScrollBarAlwaysVisible",!0),this.setEditorAutoHeight(b),d.setValue(JSON.stringify(this.bindParamTableObj),1),d.setOption("vScrollBarAlwaysVisible",!0),d.getSession().setMode("ace/mode/json"),d.setReadOnly(!0),this.setEditorAutoHeight(d),this.fillExplain(b,c,a),this.outputCounter++}},fillExplain:function(a,b,c){b.setValue(this.aqlEditor.getValue(),1);var d=this,e=this.readQueryData();if($("#outputEditorWrapper"+c+" .queryExecutionTime").text(""),this.execPending=!1,e){var f=function(){$("#outputEditorWrapper"+c+" #spinner").remove(),$("#outputEditor"+c).css("opacity","1"),$("#outputEditorWrapper"+c+" .fa-close").show(),$("#outputEditorWrapper"+c+" .switchAce").show()};$.ajax({type:"POST",url:"/_admin/aardvark/query/explain/",data:e,contentType:"application/json",processData:!1,success:function(b){b.msg.includes("errorMessage")?(d.removeOutputEditor(c),arangoHelper.arangoError("Explain",b.msg)):(a.setValue(b.msg,1),d.deselect(a),$.noty.clearQueue(),$.noty.closeAll(),d.handleResult(c)),f()},error:function(a){try{var b=JSON.parse(a.responseText);arangoHelper.arangoError("Explain",b.errorMessage)}catch(e){arangoHelper.arangoError("Explain","ERROR")}d.handleResult(c),d.removeOutputEditor(c),f()}})}},removeOutputEditor:function(a){$("#outputEditorWrapper"+a).hide(),$("#outputEditorWrapper"+a).remove(),0===$(".outputEditorWrapper").length&&$("#removeResults").hide()},getCachedQueryAfterRender:function(){var a=this.getCachedQuery(),b=this;if(null!==a&&void 0!==a&&""!==a&&(this.aqlEditor.setValue(a.query,1),this.aqlEditor.getSession().setUndoManager(new ace.UndoManager),""!==a.parameter||void 0!==a))try{b.bindParamTableObj=JSON.parse(a.parameter);var c;_.each($("#arangoBindParamTable input"),function(a){c=$(a).attr("name"),$(a).val(b.bindParamTableObj[c])}),b.setCachedQuery(b.aqlEditor.getValue(),JSON.stringify(b.bindParamTableObj))}catch(d){}},getCachedQuery:function(){if("undefined"!==Storage){var a=localStorage.getItem("cachedQuery");if(void 0!==a){var b=JSON.parse(a);this.currentQuery=b;try{this.bindParamTableObj=JSON.parse(b.parameter)}catch(c){}return b}}},setCachedQuery:function(a,b){if("undefined"!==Storage){var c={query:a,parameter:b};this.currentQuery=c,localStorage.setItem("cachedQuery",JSON.stringify(c))}},closeResult:function(a){var b=$("#"+$(a.currentTarget).attr("element")).parent();$(b).hide("fast",function(){$(b).remove(),0===$(".outputEditorWrapper").length&&$("#removeResults").hide()})},fillSelectBoxes:function(){var a=1e3,b=$("#querySize");b.empty(),[100,250,500,1e3,2500,5e3,1e4,"all"].forEach(function(c){b.append('")})},render:function(){this.$el.html(this.template.render({})),this.afterRender(),this.initDone||(this.settings.aqlWidth=$(".aqlEditorWrapper").width()),this.initDone=!0,this.renderBindParamTable(!0)},afterRender:function(){var a=this;this.initAce(),this.initTables(),this.fillSelectBoxes(),this.makeResizeable(),this.initQueryImport(),this.getCachedQueryAfterRender(),$(".inputEditorWrapper").height($(window).height()/10*5+25),window.setTimeout(function(){a.resize()},10),a.deselect(a.aqlEditor)},showSpotlight:function(a){var b,c;if((void 0===a||"click"===a.type)&&(a="aql"),"aql"===a)b=function(a){this.aqlEditor.insert(a),$("#aqlEditor .ace_text-input").focus()}.bind(this),c=function(){$("#aqlEditor .ace_text-input").focus()};else{var d=$(":focus");b=function(a){var b=$(d).val();$(d).val(b+a),$(d).focus()}.bind(this),c=function(){$(d).focus()}}window.spotlightView.show(b,c,a)},resize:function(){this.resizeFunction()},resizeFunction:function(){$("#toggleQueries1").is(":visible")?(this.aqlEditor.resize(),$("#arangoBindParamTable thead").css("width",$("#bindParamEditor").width()),$("#arangoBindParamTable thead th").css("width",$("#bindParamEditor").width()/2),$("#arangoBindParamTable tr").css("width",$("#bindParamEditor").width()),$("#arangoBindParamTable tbody").css("height",$("#aqlEditor").height()-35),$("#arangoBindParamTable tbody").css("width",$("#bindParamEditor").width()),$("#arangoBindParamTable tbody tr").css("width",$("#bindParamEditor").width()),$("#arangoBindParamTable tbody td").css("width",$("#bindParamEditor").width()/2)):(this.queryPreview.resize(),$("#arangoMyQueriesTable thead").css("width",$("#queryTable").width()),$("#arangoMyQueriesTable thead th").css("width",$("#queryTable").width()/2),$("#arangoMyQueriesTable tr").css("width",$("#queryTable").width()),$("#arangoMyQueriesTable tbody").css("height",$("#queryTable").height()-35),$("#arangoMyQueriesTable tbody").css("width",$("#queryTable").width()),$("#arangoMyQueriesTable tbody td").css("width",$("#queryTable").width()/2))},makeResizeable:function(){var a=this;$(".aqlEditorWrapper").resizable({resize:function(){a.resizeFunction(),a.settings.aqlWidth=$(".aqlEditorWrapper").width()},handles:"e"}),$(".inputEditorWrapper").resizable({resize:function(){a.resizeFunction()},handles:"s"}),this.resizeFunction()},initTables:function(){this.$(this.bindParamId).html(this.table.render({content:this.bindParamTableDesc})),this.$(this.myQueriesId).html(this.table.render({content:this.myQueriesTableDesc}))},checkType:function(a){var b="stringtype";try{a=JSON.parse(a),b=a instanceof Array?"arraytype":typeof a+"type"}catch(c){}return b},updateBindParams:function(a){var b,c=this;if(a){b=$(a.currentTarget).attr("name"),this.bindParamTableObj[b]=arangoHelper.parseInput(a.currentTarget);var d=["arraytype","objecttype","booleantype","numbertype","stringtype"];_.each(d,function(b){$(a.currentTarget).removeClass(b)}),$(a.currentTarget).addClass(c.checkType($(a.currentTarget).val()))}else _.each($("#arangoBindParamTable input"),function(a){b=$(a).attr("name"),c.bindParamTableObj[b]=arangoHelper.parseInput(a)});this.setCachedQuery(this.aqlEditor.getValue(),JSON.stringify(this.bindParamTableObj)),a&&((a.ctrlKey||a.metaKey)&&13===a.keyCode&&(a.preventDefault(),this.executeQuery()),(a.ctrlKey||a.metaKey)&&32===a.keyCode&&(a.preventDefault(),this.showSpotlight("bind")))},parseQuery:function(a){var b=0,c=1,d=2,e=3,f=4,g=5,h=6,i=7;a+=" ";var j,k,l,m=this,n=b,o=a.length,p=[];for(k=0;o>k;++k)switch(l=a.charAt(k),n){case b:"@"===l?(n=h,j=k):"'"===l?n=c:'"'===l?n=d:"`"===l?n=e:"´"===l?n=i:"/"===l&&o>k+1&&("/"===a.charAt(k+1)?(n=f,++k):"*"===a.charAt(k+1)&&(n=g,++k));break;case f:("\r"===l||"\n"===l)&&(n=b);break;case g:"*"===l&&o>=k+1&&"/"===a.charAt(k+1)&&(n=b,++k);break;case c:"\\"===l?++k:"'"===l&&(n=b);break;case d:"\\"===l?++k:'"'===l&&(n=b);break;case e:"`"===l&&(n=b);break;case i:"´"===l&&(n=b);break;case h:/^[@a-zA-Z0-9_]+$/.test(l)||(p.push(a.substring(j,k)),n=b,j=void 0)}var q;return _.each(p,function(a,b){q=a.match(m.bindParamRegExp),q&&(p[b]=q[1])}),{query:a,bindParams:p}},checkForNewBindParams:function(){var a=this,b=this.parseQuery(this.aqlEditor.getValue()).bindParams,c={};_.each(b,function(b){a.bindParamTableObj[b]?c[b]=a.bindParamTableObj[b]:c[b]=""}),Object.keys(b).forEach(function(b){Object.keys(a.bindParamTableObj).forEach(function(d){b===d&&(c[b]=a.bindParamTableObj[d])})}),a.bindParamTableObj=c},renderBindParamTable:function(a){$("#arangoBindParamTable tbody").html(""),a&&this.getCachedQuery();var b=0;_.each(this.bindParamTableObj,function(a,c){$("#arangoBindParamTable tbody").append(""+c+"'),b++,_.each($("#arangoBindParamTable input"),function(b){$(b).attr("name")===c&&(a instanceof Array?$(b).val(JSON.stringify(a)).addClass("arraytype"):"object"==typeof a?$(b).val(JSON.stringify(a)).addClass(typeof a+"type"):$(b).val(a).addClass(typeof a+"type"))})}),0===b&&$("#arangoBindParamTable tbody").append('No bind parameters defined.')},fillBindParamTable:function(a){_.each(a,function(a,b){_.each($("#arangoBindParamTable input"),function(c){$(c).attr("name")===b&&$(c).val(a)})})},initAce:function(){var a=this;this.aqlEditor=ace.edit("aqlEditor"),this.aqlEditor.getSession().setMode("ace/mode/aql"),this.aqlEditor.setFontSize("10pt"),this.bindParamAceEditor=ace.edit("bindParamAceEditor"),this.bindParamAceEditor.getSession().setMode("ace/mode/json"),this.bindParamAceEditor.setFontSize("10pt"),this.bindParamAceEditor.getSession().on("change",function(){try{a.bindParamTableObj=JSON.parse(a.bindParamAceEditor.getValue()),a.allowParamToggle=!0,a.setCachedQuery(a.aqlEditor.getValue(),JSON.stringify(a.bindParamTableObj))}catch(b){""===a.bindParamAceEditor.getValue()?(_.each(a.bindParamTableObj,function(b,c){a.bindParamTableObj[c]=""}),a.allowParamToggle=!0):a.allowParamToggle=!1}}),this.aqlEditor.getSession().on("change",function(){a.checkForNewBindParams(),a.renderBindParamTable(),a.initDone&&a.setCachedQuery(a.aqlEditor.getValue(),JSON.stringify(a.bindParamTableObj)),a.bindParamAceEditor.setValue(JSON.stringify(a.bindParamTableObj,null," "),1),$("#aqlEditor .ace_text-input").focus(),a.resize()}),this.aqlEditor.commands.addCommand({name:"togglecomment",bindKey:{win:"Ctrl-Shift-C",linux:"Ctrl-Shift-C",mac:"Command-Shift-C"},exec:function(a){a.toggleCommentLines()},multiSelectAction:"forEach"}),this.aqlEditor.commands.addCommand({name:"executeQuery",bindKey:{win:"Ctrl-Return",mac:"Command-Return",linux:"Ctrl-Return"},exec:function(){a.executeQuery()}}),this.aqlEditor.commands.addCommand({name:"saveQuery",bindKey:{win:"Ctrl-Shift-S",mac:"Command-Shift-S",linux:"Ctrl-Shift-S"},exec:function(){a.addAQL()}}),this.aqlEditor.commands.addCommand({name:"explainQuery",bindKey:{win:"Ctrl-Shift-Return",mac:"Command-Shift-Return",linux:"Ctrl-Shift-Return"},exec:function(){a.explainQuery()}}),this.aqlEditor.commands.addCommand({name:"togglecomment",bindKey:{win:"Ctrl-Shift-C",linux:"Ctrl-Shift-C",mac:"Command-Shift-C"},exec:function(a){a.toggleCommentLines()},multiSelectAction:"forEach"}),this.aqlEditor.commands.addCommand({name:"showSpotlight",bindKey:{win:"Ctrl-Space",mac:"Ctrl-Space",linux:"Ctrl-Space"},exec:function(){a.showSpotlight()}}),this.queryPreview=ace.edit("queryPreview"),this.queryPreview.getSession().setMode("ace/mode/aql"),this.queryPreview.setReadOnly(!0),this.queryPreview.setFontSize("13px"),$("#aqlEditor .ace_text-input").focus()},updateQueryTable:function(){function a(a,b){var c;return c=a.nameb.name?1:0}var b=this;this.updateLocalQueries(),this.myQueriesTableDesc.rows=this.customQueries,_.each(this.myQueriesTableDesc.rows,function(a){a.secondRow='',a.hasOwnProperty("parameter")&&delete a.parameter,delete a.value}),this.myQueriesTableDesc.rows.sort(a),_.each(this.queries,function(a){a.hasOwnProperty("parameter")&&delete a.parameter,b.myQueriesTableDesc.rows.push({name:a.name,thirdRow:''})}),this.myQueriesTableDesc.unescaped=[!1,!0,!0],this.$(this.myQueriesId).html(this.table.render({content:this.myQueriesTableDesc}))},listenKey:function(a){13===a.keyCode&&this.saveAQL(a),this.checkSaveName()},addAQL:function(){this.refreshAQL(!0),this.createCustomQueryModal(),setTimeout(function(){$("#new-query-name").focus()},500)},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)})},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"))},saveAQL:function(a){a.stopPropagation(),this.refreshAQL();var b=$("#new-query-name").val(),c=this.bindParamTableObj;if(!$("#new-query-name").hasClass("invalid-input")&&""!==b.trim()){var d=this.aqlEditor.getValue(),e=!1;if(_.each(this.customQueries,function(a){return a.name===b?(a.value=d,void(e=!0)):void 0}),e===!0)this.collection.findWhere({name:b}).set("value",d);else{if((""===c||void 0===c)&&(c="{}"),"string"==typeof c)try{c=JSON.parse(c)}catch(f){arangoHelper.arangoError("Query","Could not parse bind parameter")}this.collection.add({name:b,parameter:c,value:d})}var g=function(a){if(a)arangoHelper.arangoError("Query","Could not save query");else{var b=this;this.collection.fetch({success:function(){b.updateLocalQueries()}})}}.bind(this);this.collection.saveCollectionQueries(g),window.modalView.hide()}},verifyQueryAndParams:function(){var a=!1;0===this.aqlEditor.getValue().length&&(arangoHelper.arangoError("Query","Your query is empty"),a=!0);var b=[];return _.each(this.bindParamTableObj,function(c,d){""===c&&(a=!0,b.push(d))}),b.length>0&&arangoHelper.arangoError("Bind Parameter",JSON.stringify(b)+" not defined."),a},executeQuery:function(){if(!this.verifyQueryAndParams()){this.$(this.outputDiv).prepend(this.outputTemplate.render({counter:this.outputCounter,type:"Query"})),$("#outputEditorWrapper"+this.outputCounter).hide(),$("#outputEditorWrapper"+this.outputCounter).show("fast");var a=this.outputCounter,b=ace.edit("outputEditor"+a),c=ace.edit("sentQueryEditor"+a),d=ace.edit("sentBindParamEditor"+a);c.getSession().setMode("ace/mode/aql"),c.setOption("vScrollBarAlwaysVisible",!0),c.setFontSize("13px"),c.setReadOnly(!0),this.setEditorAutoHeight(c),b.setFontSize("13px"),b.getSession().setMode("ace/mode/json"),b.setReadOnly(!0),b.setOption("vScrollBarAlwaysVisible",!0),this.setEditorAutoHeight(b),d.setValue(JSON.stringify(this.bindParamTableObj),1),d.setOption("vScrollBarAlwaysVisible",!0),d.getSession().setMode("ace/mode/json"),d.setReadOnly(!0),this.setEditorAutoHeight(d),this.fillResult(b,c,a),this.outputCounter++}},readQueryData:function(){var a=this.aqlEditor.session.getTextRange(this.aqlEditor.getSelectionRange()),b=$("#querySize"),c={query:a||this.aqlEditor.getValue(),id:"currentFrontendQuery"};return"all"!==b.val()&&(c.batchSize=parseInt(b.val(),10)),Object.keys(this.bindParamTableObj).length>0&&(c.bindVars=this.bindParamTableObj),JSON.stringify(c)},fillResult:function(a,b,c){var d=this,e=this.readQueryData();e&&(b.setValue(d.aqlEditor.getValue(),1),$.ajax({type:"POST",url:"/_api/cursor",headers:{"x-arango-async":"store"},data:e,contentType:"application/json",processData:!1,success:function(b,e,f){f.getResponseHeader("x-arango-async-id")&&d.queryCallbackFunction(f.getResponseHeader("x-arango-async-id"),a,c),$.noty.clearQueue(),$.noty.closeAll(),d.handleResult(c)},error:function(a){try{var b=JSON.parse(a.responseText);arangoHelper.arangoError("["+b.errorNum+"]",b.errorMessage)}catch(e){arangoHelper.arangoError("Query error","ERROR")}d.handleResult(c)}}))},handleResult:function(){window.progressView.hide(),$("#removeResults").show(),$(".centralRow").animate({scrollTop:$("#queryContent").height()},"fast")},setEditorAutoHeight:function(a){a.setOptions({maxLines:100,minLines:10})},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()},queryCallbackFunction:function(a,b,c){var d=this,e=function(a,b){$.ajax({url:"/_api/job/"+encodeURIComponent(a)+"/cancel",type:"PUT",success:function(){window.clearTimeout(d.checkQueryTimer),$("#outputEditorWrapper"+b).remove(),arangoHelper.arangoNotification("Query","Query canceled.")}})};$("#outputEditorWrapper"+c+" #cancelCurrentQuery").bind("click",function(){e(a,c)}),$("#outputEditorWrapper"+c+" #copy2aqlEditor").bind("click",function(){$("#toggleQueries1").is(":visible")||d.toggleQueries();var a=ace.edit("sentQueryEditor"+c).getValue(),b=JSON.parse(ace.edit("sentBindParamEditor"+c).getValue());d.aqlEditor.setValue(a,1),d.deselect(d.aqlEditor),Object.keys(b).length>0&&(d.bindParamTableObj=b,d.setCachedQuery(d.aqlEditor.getValue(),JSON.stringify(d.bindParamTableObj)),$("#bindParamEditor").is(":visible")?d.renderBindParamTable():(d.bindParamAceEditor.setValue(JSON.stringify(b),1),d.deselect(d.bindParamAceEditor))),$(".centralRow").animate({scrollTop:0},"fast"),d.resize()}),this.execPending=!1;var f=function(a){var c="";a.extra&&a.extra.warnings&&a.extra.warnings.length>0&&(c+="Warnings:\r\n\r\n",a.extra.warnings.forEach(function(a){c+="["+a.code+"], '"+a.message+"'\r\n"})),""!==c&&(c+="\r\nResult:\r\n\r\n"),b.setValue(c+JSON.stringify(a.result,void 0,2),1),b.getSession().setScrollTop(0)},g=function(a){f(a),window.progressView.hide();var e=function(a,b){$("#outputEditorWrapper"+c+" .arangoToolbarTop .pull-left").append(''+a+"")};$("#outputEditorWrapper"+c+" .pull-left #spinner").remove();var g="-";a&&a.extra&&a.extra.stats&&(g=a.extra.stats.executionTime.toFixed(3)+" s"),e(g,"fa-clock-o"),a.extra&&a.extra.stats&&((a.extra.stats.writesExecuted>0||a.extra.stats.writesIgnored>0)&&(e(a.extra.stats.writesExecuted+" writes","fa-check-circle positive"),0===a.extra.stats.writesIgnored?e(a.extra.stats.writesIgnored+" writes ignored","fa-check-circle positive"):e(a.extra.stats.writesIgnored+" writes ignored","fa-exclamation-circle warning")),a.extra.stats.scannedFull>0?e(a.extra.stats.scannedFull+" full collection scan","fa-exclamation-circle warning"):e(a.extra.stats.scannedFull+" full collection scan","fa-check-circle positive")),$("#outputEditorWrapper"+c+" .switchAce").show(),$("#outputEditorWrapper"+c+" .fa-close").show(),$("#outputEditor"+c).css("opacity","1"),$("#outputEditorWrapper"+c+" #downloadQueryResult").show(),$("#outputEditorWrapper"+c+" #copy2aqlEditor").show(),$("#outputEditorWrapper"+c+" #cancelCurrentQuery").remove(),d.setEditorAutoHeight(b),d.deselect(b)},h=function(){$.ajax({type:"PUT",url:"/_api/job/"+encodeURIComponent(a),contentType:"application/json",processData:!1,success:function(a,b,c){201===c.status?g(a):204===c.status&&(d.checkQueryTimer=window.setTimeout(function(){h()},500))},error:function(a){var b;try{if("Gone"===a.statusText)return arangoHelper.arangoNotification("Query","Query execution aborted."),void d.removeOutputEditor(c);b=JSON.parse(a.responseText),arangoHelper.arangoError("Query",b.errorMessage),b.errorMessage&&(null!==b.errorMessage.match(/\d+:\d+/g)?d.markPositionError(b.errorMessage.match(/'.*'/g)[0],b.errorMessage.match(/\d+:\d+/g)[0]):d.markPositionError(b.errorMessage.match(/\(\w+\)/g)[0]),d.removeOutputEditor(c))}catch(e){console.log(b),400!==b.code&&arangoHelper.arangoError("Query","Successfully aborted."),d.removeOutputEditor(c)}window.progressView.hide()}})};h()},markPositionError:function(a,b){var c;b&&(c=b.split(":")[0],a=a.substr(1,a.length-2));var d=this.aqlEditor.find(a);!d&&b&&(this.aqlEditor.selection.moveCursorToPosition({row:c,column:0}),this.aqlEditor.selection.selectLine()),window.setTimeout(function(){$(".ace_start").first().css("background","rgba(255, 129, 129, 0.7)")},100)},refreshAQL:function(){var a=this,b=function(b){b?arangoHelper.arangoError("Query","Could not reload Queries"):(a.updateLocalQueries(),a.updateQueryTable())}.bind(a),c=function(){a.getSystemQueries(b)}.bind(a);this.getAQL(c)},getSystemQueries:function(a){var b=this;$.ajax({type:"GET",cache:!1,url:"js/arango/aqltemplates.json",contentType:"application/json",processData:!1,success:function(c){a&&a(!1),b.queries=c},error:function(){a&&a(!0),arangoHelper.arangoNotification("Query","Error while loading system templates")}})},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")})})},getAQL:function(a){var b=this;this.collection.fetch({success:function(){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})});var e=function(a){a?arangoHelper.arangoError("Custom Queries","Could not import old local storage queries"):localStorage.removeItem("customQueries")}.bind(b);b.collection.saveCollectionQueries(e)}b.updateLocalQueries(),a&&a()}})}})}(),function(){"use strict";window.SettingsView=Backbone.View.extend({el:"#content",initialize:function(a){this.collectionName=a.collectionName,this.model=this.collection},events:{},render:function(){this.breadcrumb(),window.arangoHelper.buildCollectionSubNav(this.collectionName,"Settings"),this.renderSettings()},breadcrumb:function(){$("#subNavigationBar .breadcrumb").html("Collection: "+this.collectionName)},unloadCollection:function(){var a=function(a){a?arangoHelper.arangoError("Collection error",this.model.get("name")+" could not be unloaded."):void 0===a?(this.model.set("status","unloading"),this.render()):"#collections"===window.location.hash?(this.model.set("status","unloaded"),this.render()):arangoHelper.arangoNotification("Collection "+this.model.get("name")+" unloaded.")}.bind(this);this.model.unloadCollection(a),window.modalView.hide()},loadCollection:function(){var a=function(a){a?arangoHelper.arangoError("Collection error",this.model.get("name")+" could not be loaded."):void 0===a?(this.model.set("status","loading"),this.render()):"#collections"===window.location.hash?(this.model.set("status","loaded"),this.render()):arangoHelper.arangoNotification("Collection "+this.model.get("name")+" loaded.")}.bind(this);this.model.loadCollection(a),window.modalView.hide()},truncateCollection:function(){this.model.truncateCollection(),window.modalView.hide()},deleteCollection:function(){this.model.destroy({error:function(){arangoHelper.arangoError("Could not delete collection.")},success:function(){window.App.navigate("#collections",{trigger:!0})}})},saveModifiedCollection:function(){var a=function(a,b){if(a)arangoHelper.arangoError("Error","Could not get coordinator info");else{var c;c=b?this.model.get("name"):$("#change-collection-name").val();var d=this.model.get("status");if("loaded"===d){var e;try{e=JSON.parse(1024*$("#change-collection-size").val()*1024)}catch(f){return arangoHelper.arangoError("Please enter a valid number"),0}var g;try{if(g=JSON.parse($("#change-index-buckets").val()),1>g||parseInt(g)!==Math.pow(2,Math.log2(g)))throw"invalid indexBuckets value"}catch(f){return arangoHelper.arangoError("Please enter a valid number of index buckets"),0}var h=function(a){a?arangoHelper.arangoError("Collection error: "+a.responseText):(this.collectionsView.render(),window.modalView.hide())}.bind(this),i=function(a){if(a)arangoHelper.arangoError("Collection error: "+a.responseText);else{var b=$("#change-collection-sync").val();this.model.changeCollection(b,e,g,h)}}.bind(this);this.model.renameCollection(c,i)}else if("unloaded"===d)if(this.model.get("name")!==c){var j=function(a,b){a?arangoHelper.arangoError("Collection error: "+b.responseText):(this.collectionsView.render(),window.modalView.hide())}.bind(this);this.model.renameCollection(c,j)}else window.modalView.hide()}}.bind(this);window.isCoordinator(a)},renderSettings:function(){var a=function(a,b){if(a)arangoHelper.arangoError("Error","Could not get coordinator info");else{var c=!1;"loaded"===this.model.get("status")&&(c=!0);var d=[],e=[];b||e.push(window.modalView.createTextEntry("change-collection-name","Name",this.model.get("name"),!1,"",!0,[{rule:Joi.string().regex(/^[a-zA-Z]/),msg:"Collection name must always start with a letter."},{rule:Joi.string().regex(/^[a-zA-Z0-9\-_]*$/),msg:'Only Symbols "_" and "-" are allowed.'},{rule:Joi.string().required(),msg:"No collection name given."}]));var f=function(){e.push(window.modalView.createReadOnlyEntry("change-collection-id","ID",this.model.get("id"),"")),e.push(window.modalView.createReadOnlyEntry("change-collection-type","Type",this.model.get("type"),"")),e.push(window.modalView.createReadOnlyEntry("change-collection-status","Status",this.model.get("status"),"")),d.push(window.modalView.createDeleteButton("Delete",this.deleteCollection.bind(this))),d.push(window.modalView.createDeleteButton("Truncate",this.truncateCollection.bind(this))),c?d.push(window.modalView.createNotificationButton("Unload",this.unloadCollection.bind(this))):d.push(window.modalView.createNotificationButton("Load",this.loadCollection.bind(this))),d.push(window.modalView.createSuccessButton("Save",this.saveModifiedCollection.bind(this)));var a=["General","Indices"],b=["modalTable.ejs","indicesView.ejs"];window.modalView.show(b,"Modify Collection",d,e,null,null,this.events,null,a,"content"),$($("#infoTab").children()[1]).remove()}.bind(this);if(c){var g=function(a,b){if(a)arangoHelper.arangoError("Collection","Could not fetch properties");else{var c=b.journalSize/1048576,d=b.indexBuckets,g=b.waitForSync;e.push(window.modalView.createTextEntry("change-collection-size","Journal size",c,"The maximal size of a journal or datafile (in MB). Must be at least 1.","",!0,[{rule:Joi.string().allow("").optional().regex(/^[0-9]*$/),msg:"Must be a number."}])),e.push(window.modalView.createTextEntry("change-index-buckets","Index buckets",d,"The number of index buckets for this collection. Must be at least 1 and a power of 2.","",!0,[{rule:Joi.string().allow("").optional().regex(/^[1-9][0-9]*$/),msg:"Must be a number greater than 1 and a power of 2."}])),e.push(window.modalView.createSelectEntry("change-collection-sync","Wait for sync",g,"Synchronize to disk before returning from a create or update of a document.",[{value:!1,label:"No"},{value:!0,label:"Yes"}]))}f()}.bind(this);this.model.getProperties(g)}else f()}}.bind(this);window.isCoordinator(a)}})}(),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.ShowClusterView=Backbone.View.extend({detailEl:"#modalPlaceholder",el:"#content",defaultFrame:12e5,template:templateEngine.createTemplate("showCluster.ejs"),modal:templateEngine.createTemplate("waitModal.ejs"),detailTemplate:templateEngine.createTemplate("detailView.ejs"),events:{"change #selectDB":"updateCollections","change #selectCol":"updateShards","click .dbserver.success":"dashboard","click .coordinator.success":"dashboard"},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","icon").removeAttr("xmlns:a"),a.replaceWith(d)},"xml")})},updateServerTime:function(){this.serverTime=(new Date).getTime()},setShowAll:function(){this.graphShowAll=!0},resetShowAll:function(){this.graphShowAll=!1,this.renderLineChart()},initialize:function(a){this.options=a,this.interval=1e4,this.isUpdating=!1,this.timer=null,this.knownServers=[],this.graph=void 0,this.graphShowAll=!1,this.updateServerTime(),this.dygraphConfig=this.options.dygraphConfig,this.dbservers=new window.ClusterServers([],{interval:this.interval}),this.coordinators=new window.ClusterCoordinators([],{interval:this.interval}),this.documentStore=new window.arangoDocuments,this.statisticsDescription=new window.StatisticsDescription,this.statisticsDescription.fetch({async:!1}),this.dbs=new window.ClusterDatabases([],{interval:this.interval}),this.cols=new window.ClusterCollections,this.shards=new window.ClusterShards,this.startUpdating()},listByAddress:function(a){var b={},c=this;this.dbservers.byAddress(b,function(b){c.coordinators.byAddress(b,a)})},updateCollections:function(){var a=this,b=$("#selectCol"),c=$("#selectDB").find(":selected").attr("id");if(c){var d=b.find(":selected").attr("id");b.html(""), this.cols.getList(c,function(c){_.each(_.pluck(c,"name"),function(a){b.append('")});var e=$("#"+d,b);1===e.length&&e.prop("selected",!0),a.updateShards()})}},updateShards:function(){var a=$("#selectDB").find(":selected").attr("id"),b=$("#selectCol").find(":selected").attr("id");this.shards.getList(a,b,function(a){$(".shardCounter").html("0"),_.each(a,function(a){$("#"+a.server+"Shards").html(a.shards.length)})})},updateServerStatus:function(a){var b=this,c=function(a,b,c){var d,e,f=c;f=f.replace(/\./g,"-"),f=f.replace(/\:/g,"_"),e=$("#id"+f),e.length<1||(d=e.attr("class").split(/\s+/)[1],e.attr("class",a+" "+d+" "+b),"coordinator"===a&&("success"===b?$(".button-gui",e.closest(".tile")).toggleClass("button-gui-disabled",!1):$(".button-gui",e.closest(".tile")).toggleClass("button-gui-disabled",!0)))};this.coordinators.getStatuses(c.bind(this,"coordinator"),function(){b.dbservers.getStatuses(c.bind(b,"dbserver")),a()})},updateDBDetailList:function(){var a=this,b=$("#selectDB"),c=b.find(":selected").attr("id");b.html(""),this.dbs.getList(function(d){_.each(_.pluck(d,"name"),function(a){b.append('")});var e=$("#"+c,b);1===e.length&&e.prop("selected",!0),a.updateCollections()})},rerender:function(){var a=this;this.updateServerStatus(function(){a.getServerStatistics(function(){a.updateServerTime(),a.data=a.generatePieData(),a.renderPieChart(a.data),a.renderLineChart(),a.updateDBDetailList()})})},render:function(){this.knownServers=[],delete this.hist;var a=this;this.listByAddress(function(b){1===Object.keys(b).length?a.type="testPlan":a.type="other",a.updateDBDetailList(),a.dbs.getList(function(c){$(a.el).html(a.template.render({dbs:_.pluck(c,"name"),byAddress:b,type:a.type})),$(a.el).append(a.modal.render({})),a.replaceSVGs(),a.getServerStatistics(function(){a.data=a.generatePieData(),a.renderPieChart(a.data),a.renderLineChart(),a.updateDBDetailList(),a.startUpdating()})})})},generatePieData:function(){var a=[],b=this;return this.data.forEach(function(c){a.push({key:c.get("name"),value:c.get("system").virtualSize,time:b.serverTime})}),a},addStatisticsItem:function(a,b,c,d){var e=this;e.hasOwnProperty("hist")||(e.hist={}),e.hist.hasOwnProperty(a)||(e.hist[a]=[]);var f=e.hist[a],g=f.length;if(0===g)f.push({time:b,snap:d,requests:c,requestsPerSecond:0});else{var h=f[g-1].time,i=f[g-1].requests;if(c>i){var j=b-h,k=0;j>0&&(k=(c-i)/j),f.push({time:b,snap:d,requests:c,requestsPerSecond:k})}}},getServerStatistics:function(a){var b=this,c=Math.round(b.serverTime/1e3);this.data=void 0;var d=new window.ClusterStatisticsCollection,e=this.coordinators.first();this.dbservers.forEach(function(a){if("ok"===a.get("status")){-1===b.knownServers.indexOf(a.id)&&b.knownServers.push(a.id);var c=new window.Statistics({name:a.id});c.url=e.get("protocol")+"://"+e.get("address")+"/_admin/clusterStatistics?DBserver="+a.get("name"),d.add(c)}}),this.coordinators.forEach(function(a){if("ok"===a.get("status")){-1===b.knownServers.indexOf(a.id)&&b.knownServers.push(a.id);var c=new window.Statistics({name:a.id});c.url=a.get("protocol")+"://"+a.get("address")+"/_admin/statistics",d.add(c)}});var f=d.size();this.data=[];var g=function(d){f--;var e=d.get("time"),g=d.get("name"),h=d.get("http").requestsTotal;b.addStatisticsItem(g,e,h,c),b.data.push(d),0===f&&a()},h=function(){f--,0===f&&a()};d.fetch(g,h)},renderPieChart:function(a){var b=$("#clusterGraphs svg").width(),c=$("#clusterGraphs svg").height(),d=Math.min(b,c)/2,e=this.dygraphConfig.colors,f=d3.svg.arc().outerRadius(d-20).innerRadius(0),g=d3.layout.pie().sort(function(a){return a.value}).value(function(a){return a.value});d3.select("#clusterGraphs").select("svg").remove();var h=d3.select("#clusterGraphs").append("svg").attr("class","clusterChart").append("g").attr("transform","translate("+b/2+","+(c/2-10)+")"),i=d3.svg.arc().outerRadius(d-2).innerRadius(d-2),j=h.selectAll(".arc").data(g(a)).enter().append("g").attr("class","slice");j.append("path").attr("d",f).style("fill",function(a,b){return e[b%e.length]}).style("stroke",function(a,b){return e[b%e.length]}),j.append("text").attr("transform",function(a){return"translate("+f.centroid(a)+")"}).style("text-anchor","middle").text(function(a){var b=a.data.value/1024/1024/1024;return b.toFixed(2)}),j.append("text").attr("transform",function(a){return"translate("+i.centroid(a)+")"}).style("text-anchor","middle").text(function(a){return a.data.key})},renderLineChart:function(){var a,b,c,d,e,f,g=this,h=1200,i=[],j=[],k=Math.round((new Date).getTime()/1e3)-h,l=g.knownServers,m=function(){return null};for(c=0;cf||(j.hasOwnProperty(f)?a=j[f]:(e=new Date(1e3*f),a=j[f]=[e].concat(l.map(m))),a[c+1]=b[d].requestsPerSecond);i=[],Object.keys(j).sort().forEach(function(a){i.push(j[a])});var n=this.dygraphConfig.getDefaultConfig("clusterRequestsPerSecond");n.labelsDiv=$("#lineGraphLegend")[0],n.labels=["datetime"].concat(l),g.graph=new Dygraph(document.getElementById("lineGraph"),i,n)},stopUpdating:function(){window.clearTimeout(this.timer),delete this.graph,this.isUpdating=!1},startUpdating:function(){if(!this.isUpdating){this.isUpdating=!0;var a=this;this.timer=window.setInterval(function(){a.rerender()},this.interval)}},dashboard:function(a){this.stopUpdating();var b,c,d=$(a.currentTarget),e={},f=d.attr("id");f=f.replace(/\-/g,"."),f=f.replace(/\_/g,":"),f=f.substr(2),e.raw=f,e.isDBServer=d.hasClass("dbserver"),e.isDBServer?(b=this.dbservers.findWhere({address:e.raw}),c=this.coordinators.findWhere({status:"ok"}),e.endpoint=c.get("protocol")+"://"+c.get("address")):(b=this.coordinators.findWhere({address:e.raw}),e.endpoint=b.get("protocol")+"://"+b.get("address")),e.target=encodeURIComponent(b.get("name")),window.App.serverToShow=e,window.App.dashboard()},getCurrentSize:function(a){"#"!==a.substr(0,1)&&(a="#"+a);var b,c;return $(a).attr("style",""),b=$(a).height(),c=$(a).width(),{height:b,width:c}},resize:function(){var a;this.graph&&(a=this.getCurrentSize(this.graph.maindiv_.id),this.graph.resize(a.width,a.height))}})}(),function(){"use strict";window.SpotlightView=Backbone.View.extend({template:templateEngine.createTemplate("spotlightView.ejs"),el:"#spotlightPlaceholder",displayLimit:8,typeahead:null,callbackSuccess:null,callbackCancel:null,collections:{system:[],doc:[],edge:[]},events:{"focusout #spotlight .tt-input":"hide","keyup #spotlight .typeahead":"listenKey"},aqlKeywordsArray:[],aqlBuiltinFunctionsArray:[],aqlKeywords:"for|return|filter|sort|limit|let|collect|asc|desc|in|into|insert|update|remove|replace|upsert|options|with|and|or|not|distinct|graph|outbound|inbound|any|all|none|aggregate|like|count",aqlBuiltinFunctions:"to_bool|to_number|to_string|to_list|is_null|is_bool|is_number|is_string|is_list|is_document|concat|concat_separator|char_length|lower|upper|substring|left|right|trim|reverse|contains|like|floor|ceil|round|abs|rand|sqrt|pow|length|min|max|average|sum|median|variance_population|variance_sample|first|last|unique|matches|merge|merge_recursive|has|attributes|values|unset|unset_recursive|keep|near|within|within_rectangle|is_in_polygon|fulltext|paths|traversal|traversal_tree|edges|stddev_sample|stddev_population|slice|nth|position|translate|zip|call|apply|push|append|pop|shift|unshift|remove_valueremove_nth|graph_paths|shortest_path|graph_shortest_path|graph_distance_to|graph_traversal|graph_traversal_tree|graph_edges|graph_vertices|neighbors|graph_neighbors|graph_common_neighbors|graph_common_properties|graph_eccentricity|graph_betweenness|graph_closeness|graph_absolute_eccentricity|remove_values|graph_absolute_betweenness|graph_absolute_closeness|graph_diameter|graph_radius|date_now|date_timestamp|date_iso8601|date_dayofweek|date_year|date_month|date_day|date_hour|date_minute|date_second|date_millisecond|date_dayofyear|date_isoweek|date_leapyear|date_quarter|date_days_in_month|date_add|date_subtract|date_diff|date_compare|date_format|fail|passthru|sleep|not_null|first_list|first_document|parse_identifier|current_user|current_database|collections|document|union|union_distinct|intersection|flatten|ltrim|rtrim|find_first|find_last|split|substitute|md5|sha1|random_token|AQL_LAST_ENTRY",listenKey:function(a){27===a.keyCode?(this.callbackSuccess&&this.callbackCancel(),this.hide()):13===a.keyCode&&this.callbackSuccess&&(this.callbackSuccess($(this.typeahead).val()),this.hide())},substringMatcher:function(a){return function(b,c){var d,e;d=[],e=new RegExp(b,"i"),_.each(a,function(a){e.test(a)&&d.push(a)}),c(d)}},updateDatasets:function(){var a=this;this.collections={system:[],doc:[],edge:[]},window.App.arangoCollectionsStore.each(function(b){b.get("isSystem")?a.collections.system.push(b.get("name")):"document"===b.get("type")?a.collections.doc.push(b.get("name")):a.collections.edge.push(b.get("name"))})},stringToArray:function(){var a=this;_.each(this.aqlKeywords.split("|"),function(b){a.aqlKeywordsArray.push(b.toUpperCase())}),_.each(this.aqlBuiltinFunctions.split("|"),function(b){a.aqlBuiltinFunctionsArray.push(b.toUpperCase())}),a.aqlKeywordsArray.push(!0),a.aqlKeywordsArray.push(!1),a.aqlKeywordsArray.push(null)},show:function(a,b,c){this.callbackSuccess=a,this.callbackCancel=b,this.stringToArray(),this.updateDatasets();var d=function(a,b,c){var d='

'+a+"

";return b&&(d+=''),c&&(d+=''+c.toUpperCase()+""),d+="
"};$(this.el).html(this.template.render({})),$(this.el).show(),"aql"===c?this.typeahead=$("#spotlight .typeahead").typeahead({hint:!0,highlight:!0,minLength:1},{name:"Functions",source:this.substringMatcher(this.aqlBuiltinFunctionsArray),limit:this.displayLimit,templates:{header:d("Functions","fa-code","aql")}},{name:"Keywords",source:this.substringMatcher(this.aqlKeywordsArray),limit:this.displayLimit,templates:{header:d("Keywords","fa-code","aql")}},{name:"Documents",source:this.substringMatcher(this.collections.doc),limit:this.displayLimit,templates:{header:d("Documents","fa-file-text-o","Collection")}},{name:"Edges",source:this.substringMatcher(this.collections.edge),limit:this.displayLimit,templates:{header:d("Edges","fa-share-alt","Collection")}},{name:"System",limit:this.displayLimit,source:this.substringMatcher(this.collections.system),templates:{header:d("System","fa-cogs","Collection")}}):this.typeahead=$("#spotlight .typeahead").typeahead({hint:!0,highlight:!0,minLength:1},{name:"Documents",source:this.substringMatcher(this.collections.doc),limit:this.displayLimit,templates:{header:d("Documents","fa-file-text-o","Collection")}},{name:"Edges",source:this.substringMatcher(this.collections.edge),limit:this.displayLimit,templates:{header:d("Edges","fa-share-alt","Collection")}},{name:"System",limit:this.displayLimit,source:this.substringMatcher(this.collections.system),templates:{header:d("System","fa-cogs","Collection")}}),$("#spotlight .typeahead").focus()},hide:function(){$(this.el).hide()}})}(),function(){"use strict";window.StatisticBarView=Backbone.View.extend({el:"#statisticBar",events:{"change #arangoCollectionSelect":"navigateBySelect","click .tab":"navigateByTab"},template:templateEngine.createTemplate("statisticBarView.ejs"),initialize:function(a){this.currentDB=a.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(a){this.rowClickCallback=a.rowClick},events:{"click .pure-table-body .pure-table-row":"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(a){this.userCollection=a.userCollection,this.userCollection.fetch({async:!0}),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())},toggleUserMenu:function(){$("#userBar .subBarDropdown").toggle()},showDropdown:function(){$("#user_dropdown").fadeIn(1)},hideDropdown:function(){$("#user_dropdown").fadeOut(1)},render:function(){var a=this,b=function(a,b){if(a)arangoHelper.arangoErro("User","Could not fetch user.");else{var c=null,d=null,e=!1,f=null;if(b!==!1)return f=this.userCollection.findWhere({user:b}),f.set({loggedIn:!0}),d=f.get("extra").name,c=f.get("extra").img,e=f.get("active"),c=c?"https://s.gravatar.com/avatar/"+c+"?s=80":"img/default_user.png",d||(d=""),this.$el=$("#userBar"),this.$el.html(this.template.render({img:c,name:d,username:b,active:e})),this.delegateEvents(),this.$el}}.bind(this);$("#userBar").on("click",function(){a.toggleUserMenu()}),this.userCollection.whoAmI(b)},userLogout:function(){var a=function(a){a?arangoHelper.arangoError("User","Logout error"):this.userCollection.logout()}.bind(this);this.userCollection.whoAmI(a)}})}(),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(){var a=this,b=function(a,b){a||null===b?arangoHelper.arangoError("User","Could not fetch user data"):this.currentUser=this.collection.findWhere({user:b})}.bind(this);this.collection.fetch({success:function(){a.collection.whoAmI(b)}})},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){arangoHelper.parseError("User",b,a)},success:function(){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){if("createUser"!==$(a.currentTarget).find("a").attr("id")){$(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){if(a){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,e=function(a,e){a?arangoHelper.arangoError("User","Could not verify old password"):e&&(b!==c&&(arangoHelper.arangoError("User","New passwords do not match"),d=!0),d||(this.currentUser.setPassword(b),arangoHelper.arangoNotification("User","Password changed"),window.modalView.hide()))}.bind(this);this.currentUser.checkPassword(a,e)},submitEditCurrentUserProfile:function(){var a=$("#editCurrentName").val(),b=$("#editCurrentUserProfileImg").val();b=this.parseImgString(b);var c=function(a){a?arangoHelper.arangoError("User","Could not edit user settings"):(arangoHelper.arangoNotification("User","Changes confirmed."),this.updateUserProfile())}.bind(this);this.currentUser.setExtras(a,b,c),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({toUpdate:[],dbServers:[],isCluster:void 0,routes:{"":"cluster",dashboard:"dashboard",collections:"collections","new":"newCollection",login:"login","collection/:colid/documents/:pageid":"documents","cIndices/:colname":"cIndices","cSettings/:colname":"cSettings","cInfo/:colname":"cInfo","collection/:colid/:docid":"document",shell:"shell",queries:"query",workMonitor:"workMonitor",databases:"databases",settings:"databases",services:"applications","service/:mount":"applicationDetail",graphs:"graphManagement","graphs/:name":"showGraph",users:"userManagement",userProfile:"userProfile",cluster:"cluster",nodes:"cNodes",cNodes:"cNodes",dNodes:"dNodes","node/:name":"node",logs:"logs",helpus:"helpUs"},execute:function(a,b){$("#subNavigationBar .breadcrumb").html(""),$("#subNavigationBar .bottom").html(""),$("#loadingScreen").hide(),a&&a.apply(this,b)},checkUser:function(){var a=function(a,b){a||null===b?this.navigate("login",{trigger:!0}):this.initOnce()}.bind(this);this.userCollection.whoAmI(a)},waitForInit:function(a,b,c){this.initFinished?(b||a(!0),b&&!c&&a(b,!0),b&&c&&a(b,c,!0)):setTimeout(function(){b||a(!1),b&&!c&&a(b,!1),b&&c&&a(b,c,!1)},250)},initFinished:!1,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(){};var b=function(b,c){a=this,c?(a.isCluster=!0,a.coordinatorCollection.fetch({success:function(){a.fetchDBS()}})):a.isCluster=!1}.bind(this);window.isCoordinator(b),this.initFinished=!0,this.arangoDatabase=new window.ArangoDatabase,this.currentDB=new window.CurrentDatabase,this.arangoCollectionsStore=new window.arangoCollections,this.arangoDocumentStore=new window.arangoDocument,this.coordinatorCollection=new window.ClusterCoordinators,arangoHelper.setDocumentStore(this.arangoDocumentStore),this.arangoCollectionsStore.fetch(),window.spotlightView=new window.SpotlightView({collection:this.arangoCollectionsStore}),this.footerView=new window.FooterView({collection:a.coordinatorCollection}),this.notificationList=new window.NotificationCollection,this.currentDB.fetch({success:function(){a.naviView=new window.NavigationView({database:a.arangoDatabase,currentDB:a.currentDB,notificationCollection:a.notificationList,userCollection:a.userCollection,isCluster:a.isCluster}),a.naviView.render()}}),this.queryCollection=new window.ArangoQueries,this.footerView.render(),window.checkVersion()}.bind(this),$(window).resize(function(){a.handleResize()}),$(window).scroll(function(){})},handleScroll:function(){$(window).scrollTop()>50?($(".navbar > .secondary").css("top",$(window).scrollTop()),$(".navbar > .secondary").css("position","absolute"),$(".navbar > .secondary").css("z-index","10"),$(".navbar > .secondary").css("width",$(window).width())):($(".navbar > .secondary").css("top","0"),$(".navbar > .secondary").css("position","relative"),$(".navbar > .secondary").css("width",""))},cluster:function(a){return this.checkUser(),a&&void 0!==this.isCluster?this.isCluster===!1?void("_system"===this.currentDB.get("name")?(this.routes[""]="dashboard",this.navigate("#dashboard",{trigger:!0})):(this.routes[""]="collections",this.navigate("#collections",{trigger:!0}))):(this.clusterView||(this.clusterView=new window.ClusterView({coordinators:this.coordinatorCollection,dbServers:this.dbServers})),void this.clusterView.render()):void this.waitForInit(this.cluster.bind(this))},node:function(a,b){return this.checkUser(),b&&void 0!==this.isCluster?this.isCluster===!1?(this.routes[""]="dashboard",void this.navigate("#dashboard",{trigger:!0})):(this.nodeView||(this.nodeView=new window.NodeView({coordname:a,coordinators:this.coordinatorCollection,dbServers:this.dbServers})),void this.nodeView.render()):void this.waitForInit(this.node.bind(this),a)},cNodes:function(a){return this.checkUser(),a&&void 0!==this.isCluster?this.isCluster===!1?(this.routes[""]="dashboard",void this.navigate("#dashboard",{trigger:!0})):(this.nodesView=new window.NodesView({coordinators:this.coordinatorCollection,dbServers:this.dbServers[0],toRender:"coordinator"}),void this.nodesView.render()):void this.waitForInit(this.cNodes.bind(this))},dNodes:function(a){return this.checkUser(),a&&void 0!==this.isCluster?this.isCluster===!1?(this.routes[""]="dashboard",void this.navigate("#dashboard",{trigger:!0})):(this.nodesView=new window.NodesView({coordinators:this.coordinatorCollection,dbServers:this.dbServers[0],toRender:"dbserver"}),void this.nodesView.render()):void this.waitForInit(this.dNodes.bind(this))},addAuth:function(a){var b=this.clusterPlan.get("user");if(!b)return a.abort(),void(this.isCheckingUser||this.requestAuth());var c=b.name,d=b.passwd,e=c.concat(":",d);a.setRequestHeader("Authorization","Basic "+btoa(e))},logs:function(a,b){if(this.checkUser(),!b)return void this.waitForInit(this.logs.bind(this),a);if(!this.logsView){var c=new window.ArangoLogs({upto:!0,loglevel:4}),d=new window.ArangoLogs({loglevel:4}),e=new window.ArangoLogs({loglevel:3}),f=new window.ArangoLogs({loglevel:2}),g=new window.ArangoLogs({loglevel:1});this.logsView=new window.LogsView({logall:c,logdebug:d,loginfo:e,logwarning:f,logerror:g})}this.logsView.render()},applicationDetail:function(a,b){if(this.checkUser(),!b)return void this.waitForInit(this.applicationDetail.bind(this),a);var c=function(){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")}.bind(this);0===this.foxxList.length?this.foxxList.fetch({success:function(){c()}}):c()},login:function(a){var b=function(a,b){a||null===b?(this.loginView||(this.loginView=new window.loginView({collection:this.userCollection})),this.loginView.render()):this.navigate("",{trigger:!0})}.bind(this);this.userCollection.whoAmI(b)},collections:function(a){if(this.checkUser(),!a)return void this.waitForInit(this.collections.bind(this));var b=this;this.collectionsView||(this.collectionsView=new window.CollectionsView({collection:this.arangoCollectionsStore})),this.arangoCollectionsStore.fetch({success:function(){b.collectionsView.render()}})},cIndices:function(a,b){var c=this;return this.checkUser(),b?void this.arangoCollectionsStore.fetch({success:function(){c.indicesView=new window.IndicesView({collectionName:a,collection:c.arangoCollectionsStore.findWhere({name:a})}),c.indicesView.render()}}):void this.waitForInit(this.cIndices.bind(this),a)},cSettings:function(a,b){var c=this;return this.checkUser(),b?void this.arangoCollectionsStore.fetch({success:function(){c.settingsView=new window.SettingsView({collectionName:a,collection:c.arangoCollectionsStore.findWhere({name:a})}),c.settingsView.render()}}):void this.waitForInit(this.cSettings.bind(this),a)},cInfo:function(a,b){var c=this;return this.checkUser(),b?void this.arangoCollectionsStore.fetch({success:function(){c.infoView=new window.InfoView({collectionName:a,collection:c.arangoCollectionsStore.findWhere({name:a})}),c.infoView.render()}}):void this.waitForInit(this.cInfo.bind(this),a)},documents:function(a,b,c){return this.checkUser(),c?(this.documentsView||(this.documentsView=new window.DocumentsView({collection:new window.arangoDocuments,documentStore:this.arangoDocumentStore,collectionsStore:this.arangoCollectionsStore})),this.documentsView.setCollectionId(a,b),void this.documentsView.render()):void this.waitForInit(this.documents.bind(this),a,b)},document:function(a,b,c){if(this.checkUser(),!c)return void this.waitForInit(this.document.bind(this),a,b);this.documentView||(this.documentView=new window.DocumentView({collection:this.arangoDocumentStore})),this.documentView.colid=a;var d=window.location.hash.split("/")[2],e=(d.split("%").length-1)%3;decodeURI(d)!==d&&0!==e&&(d=decodeURIComponent(d)),this.documentView.docid=d,this.documentView.render();var f=function(a,b){a?console.log("Error","Could not fetch collection type"):this.documentView.setType(b)}.bind(this);arangoHelper.collectionApiType(a,null,f)},shell:function(a){return this.checkUser(),a?(this.shellView||(this.shellView=new window.shellView),void this.shellView.render()):void this.waitForInit(this.shell.bind(this))},query:function(a){return this.checkUser(),a?(this.queryView2||(this.queryView2=new window.queryView2({collection:this.queryCollection})),void this.queryView2.render()):void this.waitForInit(this.query.bind(this))},helpUs:function(a){return this.checkUser(),a?(this.testView||(this.helpUsView=new window.HelpUsView({})),void this.helpUsView.render()):void this.waitForInit(this.helpUs.bind(this))},workMonitor:function(a){return this.checkUser(),a?(this.workMonitorCollection||(this.workMonitorCollection=new window.WorkMonitorCollection),this.workMonitorView||(this.workMonitorView=new window.workMonitorView({collection:this.workMonitorCollection})),void this.workMonitorView.render()):void this.waitForInit(this.workMonitor.bind(this))},queryManagement:function(a){return this.checkUser(),a?(this.queryManagementView||(this.queryManagementView=new window.queryManagementView({collection:void 0})),void this.queryManagementView.render()):void this.waitForInit(this.queryManagement.bind(this))},databases:function(a){if(this.checkUser(),!a)return void this.waitForInit(this.databases.bind(this));var b=function(a){a?(arangoHelper.arangoError("DB","Could not get list of allowed databases"),this.navigate("#",{trigger:!0}),$("#databaseNavi").css("display","none"),$("#databaseNaviSelect").css("display","none")):(this.databaseView||(this.databaseView=new window.databaseView({users:this.userCollection,collection:this.arangoDatabase})),this.databaseView.render())}.bind(this);arangoHelper.databaseAllowed(b)},dashboard:function(a){return this.checkUser(),a?(void 0===this.dashboardView&&(this.dashboardView=new window.DashboardView({dygraphConfig:window.dygraphConfig,database:this.arangoDatabase})),void this.dashboardView.render()):void this.waitForInit(this.dashboard.bind(this))},graphManagement:function(a){return this.checkUser(),a?(this.graphManagementView||(this.graphManagementView=new window.GraphManagementView({collection:new window.GraphCollection,collectionCollection:this.arangoCollectionsStore})),void this.graphManagementView.render()):void this.waitForInit(this.graphManagement.bind(this))},showGraph:function(a,b){return this.checkUser(),b?void(this.graphManagementView?this.graphManagementView.loadGraphViewer(a):(this.graphManagementView=new window.GraphManagementView({collection:new window.GraphCollection,collectionCollection:this.arangoCollectionsStore}),this.graphManagementView.render(a,!0))):void this.waitForInit(this.showGraph.bind(this),a)},applications:function(a){return this.checkUser(),a?(void 0===this.applicationsView&&(this.applicationsView=new window.ApplicationsView({collection:this.foxxList})),void this.applicationsView.reload()):void this.waitForInit(this.applications.bind(this))},handleSelectDatabase:function(a){return this.checkUser(),a?void this.naviView.handleSelectDatabase():void this.waitForInit(this.handleSelectDatabase.bind(this))},handleResize:function(){this.dashboardView&&this.dashboardView.resize(),this.graphManagementView&&this.graphManagementView.handleResize($("#content").width()),this.queryView&&this.queryView.resize(),this.queryView2&&this.queryView2.resize(),this.documentsView&&this.documentsView.resize(),this.documentView&&this.documentView.resize()},userManagement:function(a){return this.checkUser(),a?(this.userManagementView||(this.userManagementView=new window.userManagementView({collection:this.userCollection})),void this.userManagementView.render()):void this.waitForInit(this.userManagement.bind(this))},userProfile:function(a){return this.checkUser(),a?(this.userManagementView||(this.userManagementView=new window.userManagementView({collection:this.userCollection})),void this.userManagementView.render(!0)):void this.waitForInit(this.userProfile.bind(this))},fetchDBS:function(){var a=this;this.coordinatorCollection.each(function(b){a.dbServers.push(new window.ClusterServers([],{host:b.get("address")}))}),_.each(this.dbServers,function(a){a.fetch()})},getNewRoute:function(a){return"http://"+a},registerForUpdate:function(a){this.toUpdate.push(a),a.updateUrl()}})}(),function(){"use strict";var a=function(a,b){var c=[];c.push(window.modalView.createSuccessButton("Download Page",function(){window.open("https://www.arangodb.com/download","_blank"),window.modalView.hide()}));var d=[],e=window.modalView.createReadOnlyEntry.bind(window.modalView);d.push(e("current","Current",a.toString())),b.major&&d.push(e("major","Major",b.major.version)),b.minor&&d.push(e("minor","Minor",b.minor.version)),b.bugfix&&d.push(e("bugfix","Bugfix",b.bugfix.version)),window.modalView.show("modalTable.ejs","New Version Available",c,d)};window.checkVersion=function(){$.ajax({type:"GET",cache:!1,url:"/_api/version",contentType:"application/json",processData:!1,async:!0,success:function(b){var c=window.versionHelper.fromString(b.version);$(".navbar #currentVersion").text(b.version.substr(0,3)),window.parseVersions=function(b){return _.isEmpty(b)?void $("#currentVersion").addClass("up-to-date"):($("#currentVersion").addClass("out-of-date"),void $("#currentVersion").click(function(){a(c,b)}))},$.ajax({type:"GET",async:!0,crossDomain:!0,timeout:3e3,dataType:"jsonp",url:"https://www.arangodb.com/repositories/versions.php?jsonp=parseVersions&version="+encodeURIComponent(c.toString())})}})}}(),function(){"use strict";window.hasOwnProperty("TEST_BUILD")||($(document).ready(function(){window.App=new window.Router,Backbone.history.start(),window.App.handleResize()}),$(document).click(function(a){a.stopPropagation(),$(a.target).hasClass("subBarDropdown")||$(a.target).hasClass("dropdown-header")||$(a.target).hasClass("dropdown-footer")||$(a.target).hasClass("toggle")||$("#userInfo").is(":visible")&&$(".subBarDropdown").hide()}))}(); \ No newline at end of file +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({toUpdate:[],dbServers:[],isCluster:void 0,routes:{"":"cluster",dashboard:"dashboard",collections:"collections","new":"newCollection",login:"login","collection/:colid/documents/:pageid":"documents","cIndices/:colname":"cIndices","cSettings/:colname":"cSettings","cInfo/:colname":"cInfo","collection/:colid/:docid":"document",shell:"shell",queries:"query",workMonitor:"workMonitor",databases:"databases",settings:"databases",services:"applications","service/:mount":"applicationDetail",graphs:"graphManagement","graphs/:name":"showGraph",users:"userManagement",userProfile:"userProfile",cluster:"cluster",nodes:"cNodes",cNodes:"cNodes",dNodes:"dNodes","node/:name":"node",logs:"logs",helpus:"helpUs"},execute:function(a,b){$("#subNavigationBar .breadcrumb").html(""),$("#subNavigationBar .bottom").html(""),$("#loadingScreen").hide(),a&&a.apply(this,b)},checkUser:function(){var a=function(a,b){a||null===b?this.navigate("login",{trigger:!0}):this.initOnce()}.bind(this);this.userCollection.whoAmI(a)},waitForInit:function(a,b,c){this.initFinished?(b||a(!0),b&&!c&&a(b,!0),b&&c&&a(b,c,!0)):setTimeout(function(){b||a(!1),b&&!c&&a(b,!1),b&&c&&a(b,c,!1)},250)},initFinished:!1,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(){};var b=function(b,c){a=this,c?(a.isCluster=!0,a.coordinatorCollection.fetch({success:function(){a.fetchDBS()}})):a.isCluster=!1}.bind(this);window.isCoordinator(b),this.initFinished=!0,this.arangoDatabase=new window.ArangoDatabase,this.currentDB=new window.CurrentDatabase,this.arangoCollectionsStore=new window.arangoCollections,this.arangoDocumentStore=new window.arangoDocument,this.coordinatorCollection=new window.ClusterCoordinators,arangoHelper.setDocumentStore(this.arangoDocumentStore),this.arangoCollectionsStore.fetch(),window.spotlightView=new window.SpotlightView({collection:this.arangoCollectionsStore}),this.footerView=new window.FooterView({collection:a.coordinatorCollection}),this.notificationList=new window.NotificationCollection,this.currentDB.fetch({success:function(){a.naviView=new window.NavigationView({database:a.arangoDatabase,currentDB:a.currentDB,notificationCollection:a.notificationList,userCollection:a.userCollection,isCluster:a.isCluster}),a.naviView.render()}}),this.queryCollection=new window.ArangoQueries,this.footerView.render(),window.checkVersion()}.bind(this),$(window).resize(function(){a.handleResize()}),$(window).scroll(function(){})},handleScroll:function(){$(window).scrollTop()>50?($(".navbar > .secondary").css("top",$(window).scrollTop()),$(".navbar > .secondary").css("position","absolute"),$(".navbar > .secondary").css("z-index","10"),$(".navbar > .secondary").css("width",$(window).width())):($(".navbar > .secondary").css("top","0"),$(".navbar > .secondary").css("position","relative"),$(".navbar > .secondary").css("width",""))},cluster:function(a){return this.checkUser(),a&&void 0!==this.isCluster?this.isCluster===!1?void("_system"===this.currentDB.get("name")?(this.routes[""]="dashboard",this.navigate("#dashboard",{trigger:!0})):(this.routes[""]="collections",this.navigate("#collections",{trigger:!0}))):(this.clusterView||(this.clusterView=new window.ClusterView({coordinators:this.coordinatorCollection,dbServers:this.dbServers})),void this.clusterView.render()):void this.waitForInit(this.cluster.bind(this))},node:function(a,b){return this.checkUser(),b&&void 0!==this.isCluster?this.isCluster===!1?(this.routes[""]="dashboard",void this.navigate("#dashboard",{trigger:!0})):(this.nodeView||(this.nodeView=new window.NodeView({coordname:a,coordinators:this.coordinatorCollection,dbServers:this.dbServers})),void this.nodeView.render()):void this.waitForInit(this.node.bind(this),a)},cNodes:function(a){return this.checkUser(),a&&void 0!==this.isCluster?this.isCluster===!1?(this.routes[""]="dashboard",void this.navigate("#dashboard",{trigger:!0})):(this.nodesView=new window.NodesView({coordinators:this.coordinatorCollection,dbServers:this.dbServers[0],toRender:"coordinator"}),void this.nodesView.render()):void this.waitForInit(this.cNodes.bind(this))},dNodes:function(a){return this.checkUser(),a&&void 0!==this.isCluster?this.isCluster===!1?(this.routes[""]="dashboard",void this.navigate("#dashboard",{trigger:!0})):(this.nodesView=new window.NodesView({coordinators:this.coordinatorCollection,dbServers:this.dbServers[0],toRender:"dbserver"}),void this.nodesView.render()):void this.waitForInit(this.dNodes.bind(this))},addAuth:function(a){var b=this.clusterPlan.get("user");if(!b)return a.abort(),void(this.isCheckingUser||this.requestAuth());var c=b.name,d=b.passwd,e=c.concat(":",d);a.setRequestHeader("Authorization","Basic "+btoa(e))},logs:function(a,b){if(this.checkUser(),!b)return void this.waitForInit(this.logs.bind(this),a);if(!this.logsView){var c=new window.ArangoLogs({upto:!0,loglevel:4}),d=new window.ArangoLogs({loglevel:4}),e=new window.ArangoLogs({loglevel:3}),f=new window.ArangoLogs({loglevel:2}),g=new window.ArangoLogs({loglevel:1});this.logsView=new window.LogsView({logall:c,logdebug:d,loginfo:e,logwarning:f,logerror:g})}this.logsView.render()},applicationDetail:function(a,b){if(this.checkUser(),!b)return void this.waitForInit(this.applicationDetail.bind(this),a);var c=function(){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")}.bind(this);0===this.foxxList.length?this.foxxList.fetch({success:function(){c()}}):c()},login:function(a){var b=function(a,b){a||null===b?(this.loginView||(this.loginView=new window.loginView({collection:this.userCollection})),this.loginView.render()):this.navigate("",{trigger:!0})}.bind(this);this.userCollection.whoAmI(b)},collections:function(a){if(this.checkUser(),!a)return void this.waitForInit(this.collections.bind(this));var b=this;this.collectionsView||(this.collectionsView=new window.CollectionsView({collection:this.arangoCollectionsStore})),this.arangoCollectionsStore.fetch({success:function(){b.collectionsView.render()}})},cIndices:function(a,b){var c=this;return this.checkUser(),b?void this.arangoCollectionsStore.fetch({success:function(){c.indicesView=new window.IndicesView({collectionName:a,collection:c.arangoCollectionsStore.findWhere({name:a})}),c.indicesView.render()}}):void this.waitForInit(this.cIndices.bind(this),a)},cSettings:function(a,b){var c=this;return this.checkUser(),b?void this.arangoCollectionsStore.fetch({success:function(){c.settingsView=new window.SettingsView({collectionName:a,collection:c.arangoCollectionsStore.findWhere({name:a})}),c.settingsView.render()}}):void this.waitForInit(this.cSettings.bind(this),a)},cInfo:function(a,b){var c=this;return this.checkUser(),b?void this.arangoCollectionsStore.fetch({success:function(){c.infoView=new window.InfoView({collectionName:a,collection:c.arangoCollectionsStore.findWhere({name:a})}),c.infoView.render()}}):void this.waitForInit(this.cInfo.bind(this),a)},documents:function(a,b,c){return this.checkUser(),c?(this.documentsView||(this.documentsView=new window.DocumentsView({collection:new window.arangoDocuments,documentStore:this.arangoDocumentStore,collectionsStore:this.arangoCollectionsStore})),this.documentsView.setCollectionId(a,b),void this.documentsView.render()):void this.waitForInit(this.documents.bind(this),a,b)},document:function(a,b,c){if(this.checkUser(),!c)return void this.waitForInit(this.document.bind(this),a,b);this.documentView||(this.documentView=new window.DocumentView({collection:this.arangoDocumentStore})),this.documentView.colid=a;var d=window.location.hash.split("/")[2],e=(d.split("%").length-1)%3;decodeURI(d)!==d&&0!==e&&(d=decodeURIComponent(d)),this.documentView.docid=d,this.documentView.render();var f=function(a,b){a?console.log("Error","Could not fetch collection type"):this.documentView.setType(b)}.bind(this);arangoHelper.collectionApiType(a,null,f)},shell:function(a){return this.checkUser(),a?(this.shellView||(this.shellView=new window.shellView),void this.shellView.render()):void this.waitForInit(this.shell.bind(this))},query:function(a){return this.checkUser(),a?(this.queryView2||(this.queryView2=new window.queryView2({collection:this.queryCollection})),void this.queryView2.render()):void this.waitForInit(this.query.bind(this))},helpUs:function(a){return this.checkUser(),a?(this.testView||(this.helpUsView=new window.HelpUsView({})),void this.helpUsView.render()):void this.waitForInit(this.helpUs.bind(this))},workMonitor:function(a){return this.checkUser(),a?(this.workMonitorCollection||(this.workMonitorCollection=new window.WorkMonitorCollection),this.workMonitorView||(this.workMonitorView=new window.workMonitorView({collection:this.workMonitorCollection})),void this.workMonitorView.render()):void this.waitForInit(this.workMonitor.bind(this))},queryManagement:function(a){return this.checkUser(),a?(this.queryManagementView||(this.queryManagementView=new window.queryManagementView({collection:void 0})),void this.queryManagementView.render()):void this.waitForInit(this.queryManagement.bind(this))},databases:function(a){if(this.checkUser(),!a)return void this.waitForInit(this.databases.bind(this));var b=function(a){a?(arangoHelper.arangoError("DB","Could not get list of allowed databases"),this.navigate("#",{trigger:!0}),$("#databaseNavi").css("display","none"),$("#databaseNaviSelect").css("display","none")):(this.databaseView||(this.databaseView=new window.databaseView({users:this.userCollection,collection:this.arangoDatabase})),this.databaseView.render())}.bind(this);arangoHelper.databaseAllowed(b)},dashboard:function(a){return this.checkUser(),a?(void 0===this.dashboardView&&(this.dashboardView=new window.DashboardView({dygraphConfig:window.dygraphConfig,database:this.arangoDatabase})),void this.dashboardView.render()):void this.waitForInit(this.dashboard.bind(this))},graphManagement:function(a){return this.checkUser(),a?(this.graphManagementView||(this.graphManagementView=new window.GraphManagementView({collection:new window.GraphCollection,collectionCollection:this.arangoCollectionsStore})),void this.graphManagementView.render()):void this.waitForInit(this.graphManagement.bind(this))},showGraph:function(a,b){return this.checkUser(),b?void(this.graphManagementView?this.graphManagementView.loadGraphViewer(a):(this.graphManagementView=new window.GraphManagementView({collection:new window.GraphCollection,collectionCollection:this.arangoCollectionsStore}),this.graphManagementView.render(a,!0))):void this.waitForInit(this.showGraph.bind(this),a)},applications:function(a){return this.checkUser(),a?(void 0===this.applicationsView&&(this.applicationsView=new window.ApplicationsView({collection:this.foxxList})),void this.applicationsView.reload()):void this.waitForInit(this.applications.bind(this))},handleSelectDatabase:function(a){return this.checkUser(),a?void this.naviView.handleSelectDatabase():void this.waitForInit(this.handleSelectDatabase.bind(this))},handleResize:function(){this.dashboardView&&this.dashboardView.resize(),this.graphManagementView&&this.graphManagementView.handleResize($("#content").width()),this.queryView&&this.queryView.resize(),this.queryView2&&this.queryView2.resize(),this.documentsView&&this.documentsView.resize(),this.documentView&&this.documentView.resize()},userManagement:function(a){return this.checkUser(),a?(this.userManagementView||(this.userManagementView=new window.userManagementView({collection:this.userCollection})),void this.userManagementView.render()):void this.waitForInit(this.userManagement.bind(this))},userProfile:function(a){return this.checkUser(),a?(this.userManagementView||(this.userManagementView=new window.userManagementView({collection:this.userCollection})),void this.userManagementView.render(!0)):void this.waitForInit(this.userProfile.bind(this))},fetchDBS:function(){var a=this;this.coordinatorCollection.each(function(b){a.dbServers.push(new window.ClusterServers([],{host:b.get("address")}))}),_.each(this.dbServers,function(a){a.fetch()})},getNewRoute:function(a){return"http://"+a},registerForUpdate:function(a){this.toUpdate.push(a),a.updateUrl()}})}(),function(){"use strict";var a=function(a,b){var c=[];c.push(window.modalView.createSuccessButton("Download Page",function(){window.open("https://www.arangodb.com/download","_blank"),window.modalView.hide()}));var d=[],e=window.modalView.createReadOnlyEntry.bind(window.modalView);d.push(e("current","Current",a.toString())),b.major&&d.push(e("major","Major",b.major.version)),b.minor&&d.push(e("minor","Minor",b.minor.version)),b.bugfix&&d.push(e("bugfix","Bugfix",b.bugfix.version)),window.modalView.show("modalTable.ejs","New Version Available",c,d)};window.checkVersion=function(){$.ajax({type:"GET",cache:!1,url:"/_api/version",contentType:"application/json",processData:!1,async:!0,success:function(b){var c=window.versionHelper.fromString(b.version);$(".navbar #currentVersion").text(b.version.substr(0,3)),window.parseVersions=function(b){return _.isEmpty(b)?void $("#currentVersion").addClass("up-to-date"):($("#currentVersion").addClass("out-of-date"),void $("#currentVersion").click(function(){a(c,b)}))},$.ajax({type:"GET",async:!0,crossDomain:!0,timeout:3e3,dataType:"jsonp",url:"https://www.arangodb.com/repositories/versions.php?jsonp=parseVersions&version="+encodeURIComponent(c.toString())})}})}}(),function(){"use strict";window.hasOwnProperty("TEST_BUILD")||($(document).ready(function(){window.App=new window.Router,Backbone.history.start(),window.App.handleResize()}),$(document).click(function(a){a.stopPropagation(),$(a.target).hasClass("subBarDropdown")||$(a.target).hasClass("dropdown-header")||$(a.target).hasClass("dropdown-footer")||$(a.target).hasClass("toggle")||$("#userInfo").is(":visible")&&$(".subBarDropdown").hide()}))}(); 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 f65b678142..af3ca5c406 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes5.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes5.js @@ -1006,7 +1006,7 @@ ArangoDatabase.prototype._createDatabase = function(name,options,users){var data ArangoDatabase.prototype._dropDatabase = function(name){var requestResult=this._connection.DELETE("/_api/database/" + encodeURIComponent(name));if(requestResult !== null && requestResult.error === true){throw new ArangoError(requestResult);}arangosh.checkRequestResult(requestResult);return requestResult.result;}; //////////////////////////////////////////////////////////////////////////////// /// @brief list all existing databases //////////////////////////////////////////////////////////////////////////////// -ArangoDatabase.prototype._listDatabases = function(){var requestResult=this._connection.GET("/_api/database");if(requestResult !== null && requestResult.error === true){throw new ArangoError(requestResult);}arangosh.checkRequestResult(requestResult);return requestResult.result;}; //////////////////////////////////////////////////////////////////////////////// +ArangoDatabase.prototype._databases = function(){var requestResult=this._connection.GET("/_api/database");if(requestResult !== null && requestResult.error === true){throw new ArangoError(requestResult);}arangosh.checkRequestResult(requestResult);return requestResult.result;}; //////////////////////////////////////////////////////////////////////////////// /// @brief uses a database //////////////////////////////////////////////////////////////////////////////// ArangoDatabase.prototype._useDatabase = function(name){if(internal.printBrowser){throw new ArangoError({error:true,code:internal.errors.ERROR_NOT_IMPLEMENTED.code,errorNum:internal.errors.ERROR_NOT_IMPLEMENTED.code,errorMessage:"_useDatabase() is not supported in the web interface"});}var old=this._connection.getDatabaseName(); // no change diff --git a/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes5.min.js b/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes5.min.js index 3784cb3f6e..fcd0f29144 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes5.min.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes5.min.js @@ -1,7 +1,7 @@ "use strict";module.define("@arangodb/common",function(a,b){var c=require("internal"),d=require("fs"),e=require("@arangodb/mimetypes").mimeTypes;Object.keys(c.errors).forEach(function(b){a[b]=c.errors[b].code}),a.errors=c.errors,a.ArangoError=c.ArangoError,a.defineModule=function(a,e){var f,g,h;f=d.read(e),h=c.db._collection("_modules"),null===h&&(h=c.db._create("_modules",{isSystem:!0})),a=b.normalize(a),g=h.firstExample({path:a}),null===g?h.save({path:a,content:f}):h.replace(g,{path:a,content:f})},a.guessContentType=function(a,b){var c=/\.([a-zA-Z0-9]+)$/,d=c.exec(a);if(null!==d){var f=d[1];if(e.hasOwnProperty(f)){var g=e[f];return g[1]?g[0]+"; charset=utf-8":g[0]}}return b?b:"text/plain; charset=utf-8"},a.normalizeURL=function(a){var b,c,d,e,f,g;if(""===a)return"./";for(d=a.split("/"),"."===d[0]||".."===d[0]?(f=d[0]+"/",d.shift(),e=d):""===d[0]?(f="/",d.shift(),e=d):(f="./",e=d),c=[],b=0;b0&&(l=d[h]>=k.length?d[h]:k.length);var m=h;e.hasOwnProperty("rename")&&e.rename.hasOwnProperty(h)&&(m=e.rename[h]),f.push({id:h,fixedLength:l,length:l||m.length}),g[0][j++]=m}b.forEach(function(a,b){g[b+1]=[],f.forEach(function(c){if(a.hasOwnProperty(c.id)){var d;d=e.prettyStrings&&"string"==typeof a[c.id]?a[c.id]:JSON.stringify(a[c.id])||"",g[b+1].push(d),d.length>c.length&&!c.fixedLength&&(c.length=Math.min(d.length,100))}else g[b+1].push("")})});var n=function(){var b=[];return f.forEach(function(c){b.push(a.stringPadding("",c.length,"-","r"))}),e.framed?"+-"+b.join("-+-")+"-+\n":b.join(" ")+"\n"},o=function(){var d="";return e.framed&&(d+=n()),g.forEach(function(b,c){var g=[];b.forEach(function(c,d){var e=f[d].length,h=b[d];h.length>e&&(h=h.substr(0,e-k.length)+k),g.push(a.stringPadding(h,e," ","r"))}),d+=e.framed?"| "+g.join(" | ")+" |\n":g.join(" ")+"\n",0===c&&(d+=n())}),d+=n(),e.hideTotal||(d+=c.sprintf(e.totalString,String(b.length))),d};Array.isArray(b)&&(0===b.length?a.print(e.emptyString||"no document(s)"):a.print(o()))},a.stringPadding=function(a,b,c,d){function e(a,b){var c,d="";for(c=0;a>c;++c)d+=b;return d}if("undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=" "),b+1>=a.length)switch(d||"r"){case"l":a=e(b+1-a.length,c)+a;break;case"b":var f=b-a.length,g=Math.ceil(f/2),h=f-g;a=e(h+1,c)+a+e(g+1,c);break;default:a+=e(b+1-a.length,c)}return a},a.throwDownloadError=function(b){throw new a.ArangoError({errorNum:a.errors.ERROR_APPLICATION_DOWNLOAD_FAILED.code,errorMessage:a.errors.ERROR_APPLICATION_DOWNLOAD_FAILED.message+": "+String(b)})},a.throwFileNotFound=function(b){throw new a.ArangoError({errorNum:a.errors.ERROR_FILE_NOT_FOUND.code,errorMessage:a.errors.ERROR_FILE_NOT_FOUND.message+": "+String(b)})},a.throwBadParameter=function(b){throw new a.ArangoError({errorNum:a.errors.ERROR_BAD_PARAMETER.code,errorMessage:a.errors.ERROR_BAD_PARAMETER.message+": "+String(b)})},a.checkParameter=function(b,c,d){var e;for(e=0;ea&&(a=0),new Array(a).join(" ")}function o(a,b){var c=".{1,"+b+"}(\\s|$)|\\S+?(\\s|$)";return a.match(new RegExp(c,"g")).join("\n")}function p(a){B.appendLine(m("Query string:")),B.appendLine(" "+g(o(a,100).replace(/\n+/g,"\n ",a))),B.appendLine()}function q(a){if(void 0!==a){B.appendLine(m("Write query options:"));var b=Object.keys(a),c="Option".length;b.forEach(function(a){a.length>c&&(c=a.length)}),B.appendLine(" "+l("Option")+n(1+c-"Option".length)+" "+l("Value")),b.forEach(function(b){B.appendLine(" "+e(b)+n(1+c-b.length)+" "+g(JSON.stringify(a[b])))}),B.appendLine()}}function r(a){if(B.appendLine(m("Optimization rules applied:")),0===a.length)B.appendLine(" "+g("none"));else{var b=String("Id").length;B.appendLine(" "+n(1+b-String("Id").length)+l("Id")+" "+l("RuleName"));for(var c=0;cb&&(b=e),e=a.type.length,e>o&&(o=e),e=a.fields.map(d).join(", ").length,e>q&&(q=e),e=a.collection.length,e>c&&(c=e)});var r=" "+n(1+b-String("Id").length)+l("Id")+" "+l("Type")+n(1+o-"Type".length)+" "+l("Collection")+n(1+c-"Collection".length)+" "+l("Unique")+n(1+f-"Unique".length)+" "+l("Sparse")+n(1+i-"Sparse".length)+" "+l("Selectivity Est.")+" "+l("Fields")+n(1+q-"Fields".length)+" "+l("Ranges");B.appendLine(r);for(var s=0;sv&&(v=String(a.id).length),String(a.type).length>u&&(u=String(a.type).length),String(a.estimatedNrItems).length>w&&(w=String(a.estimatedNrItems).length)})};y(x.nodes,0);var z,A={},C={},D={},E=[],F=!0,G=function(a){return/^[0-9_]/.test(a.name)?h("#"+a.name):(C.hasOwnProperty(a.id)&&(D[a.name]=C[a.id]),h(a.name))},H=function Y(a){var b=!0;a:for(;b;){var c=a;switch(d=h=void 0,b=!1,F=F&&-1!==["value","object","object element","array"].indexOf(c.type),c.type){case"reference":if(A.hasOwnProperty(c.name)){var d=A[c.name];if(delete A[c.name],Array.isArray(d)){var h=Y(d[1])+"["+new Array(d[0]+1).join("*");return"no-op"!==d[2].type&&(h+=" "+e("FILTER")+" "+Y(d[2])),"no-op"!==d[3].type&&(h+=" "+e("LIMIT ")+" "+Y(d[3])),"no-op"!==d[4].type&&(h+=" "+e("RETURN ")+" "+Y(d[4])),h+="]"}return Y(d)+"[*]"}return G(c);case"collection":return j(c.name)+" "+f("/* all collection documents */");case"value":return g(JSON.stringify(c.value));case"object":return c.hasOwnProperty("subNodes")?"{ "+c.subNodes.map(Y).join(", ")+" }":"{ }";case"object element":return g(JSON.stringify(c.name))+" : "+Y(c.subNodes[0]);case"calculated object element":return"[ "+Y(c.subNodes[0])+" ] : "+Y(c.subNodes[1]);case"array":return c.hasOwnProperty("subNodes")?"[ "+c.subNodes.map(Y).join(", ")+" ]":"[ ]";case"unary not":return"! "+Y(c.subNodes[0]);case"unary plus":return"+ "+Y(c.subNodes[0]);case"unary minus":return"- "+Y(c.subNodes[0]);case"array limit":return Y(c.subNodes[0])+", "+Y(c.subNodes[1]);case"attribute access":return Y(c.subNodes[0])+"."+k(c.name);case"indexed access":return Y(c.subNodes[0])+"["+Y(c.subNodes[1])+"]";case"range":return Y(c.subNodes[0])+" .. "+Y(c.subNodes[1])+" "+f("/* range */");case"expand":case"expansion":c.subNodes.length>2?A[c.subNodes[0].subNodes[0].name]=[c.levels,c.subNodes[0].subNodes[1],c.subNodes[2],c.subNodes[3],c.subNodes[4]]:A[c.subNodes[0].subNodes[0].name]=c.subNodes[0].subNodes[1],a=c.subNodes[1],b=!0;continue a;case"verticalizer":a=c.subNodes[0],b=!0;continue a;case"user function call":return i(c.name)+"("+(c.subNodes&&c.subNodes[0].subNodes||[]).map(Y).join(", ")+") "+f("/* user-defined function */");case"function call":return i(c.name)+"("+(c.subNodes&&c.subNodes[0].subNodes||[]).map(Y).join(", ")+")";case"plus":return Y(c.subNodes[0])+" + "+Y(c.subNodes[1]);case"minus":return Y(c.subNodes[0])+" - "+Y(c.subNodes[1]);case"times":return Y(c.subNodes[0])+" * "+Y(c.subNodes[1]);case"division":return Y(c.subNodes[0])+" / "+Y(c.subNodes[1]);case"modulus":return Y(c.subNodes[0])+" % "+Y(c.subNodes[1]);case"compare not in":return Y(c.subNodes[0])+" not in "+Y(c.subNodes[1]);case"compare in":return Y(c.subNodes[0])+" in "+Y(c.subNodes[1]);case"compare ==":return Y(c.subNodes[0])+" == "+Y(c.subNodes[1]);case"compare !=":return Y(c.subNodes[0])+" != "+Y(c.subNodes[1]);case"compare >":return Y(c.subNodes[0])+" > "+Y(c.subNodes[1]);case"compare >=":return Y(c.subNodes[0])+" >= "+Y(c.subNodes[1]);case"compare <":return Y(c.subNodes[0])+" < "+Y(c.subNodes[1]);case"compare <=":return Y(c.subNodes[0])+" <= "+Y(c.subNodes[1]);case"logical or":return Y(c.subNodes[0])+" || "+Y(c.subNodes[1]);case"logical and":return Y(c.subNodes[0])+" && "+Y(c.subNodes[1]);case"ternary":return Y(c.subNodes[0])+" ? "+Y(c.subNodes[1])+" : "+Y(c.subNodes[2]);default:return"unhandled node type ("+c.type+")"}}},I=function(a,b,c){var d=c.isConstant?g(JSON.stringify(c.bound)):H(c.bound);return k(a)+" "+b[c.include?1:0]+" "+d},J=function(a){var b=[];return a.forEach(function(a){var c=a.attr;a.lowConst.hasOwnProperty("bound")&&a.highConst.hasOwnProperty("bound")&&JSON.stringify(a.lowConst.bound)===JSON.stringify(a.highConst.bound)&&(a.equality=!0),a.equality?a.lowConst.hasOwnProperty("bound")?b.push(I(c,["==","=="],a.lowConst)):a.hasOwnProperty("lows")&&a.lows.forEach(function(a){b.push(I(c,["==","=="],a))}):(a.lowConst.hasOwnProperty("bound")&&b.push(I(c,[">",">="],a.lowConst)),a.highConst.hasOwnProperty("bound")&&b.push(I(c,["<","<="],a.highConst)),a.hasOwnProperty("lows")&&a.lows.forEach(function(a){b.push(I(c,[">",">="],a))}),a.hasOwnProperty("highs")&&a.highs.forEach(function(a){b.push(I(c,["<","<="],a))}))}),b.length>1?"("+b.join(" && ")+")":b[0]},K=function(a){switch(a.type){case"SingletonNode":return e("ROOT");case"NoResultsNode":return e("EMPTY")+" "+f("/* empty result set */");case"EnumerateCollectionNode":return C[a.outVariable.id]=a.collection,e("FOR")+" "+G(a.outVariable)+" "+e("IN")+" "+j(a.collection)+" "+f("/* full collection scan"+(a.random?", random order":"")+" */");case"EnumerateListNode":return e("FOR")+" "+G(a.outVariable)+" "+e("IN")+" "+G(a.inVariable)+" "+f("/* list iteration */");case"IndexRangeNode":C[a.outVariable.id]=a.collection;var b=a.index;return b.ranges=a.ranges.map(J).join(" || "),b.collection=a.collection,b.node=a.id,E.push(b),e("FOR")+" "+G(a.outVariable)+" "+e("IN")+" "+j(a.collection)+" "+f("/* "+(a.reverse?"reverse ":"")+a.index.type+" index scan */");case"CalculationNode":return e("LET")+" "+G(a.outVariable)+" = "+H(a.expression)+" "+f("/* "+a.expressionType+" expression */");case"FilterNode":return e("FILTER")+" "+G(a.inVariable);case"AggregateNode":return e("COLLECT")+" "+a.aggregates.map(function(a){return G(a.outVariable)+" = "+G(a.inVariable)}).join(", ")+(a.count?" "+e("WITH COUNT"):"")+(a.outVariable?" "+e("INTO")+" "+G(a.outVariable):"")+(a.keepVariables?" "+e("KEEP")+" "+a.keepVariables.map(function(a){return G(a)}).join(", "):"")+" "+f("/* "+a.aggregationOptions.method+"*/");case"SortNode":return e("SORT")+" "+a.elements.map(function(a){return G(a.inVariable)+" "+e(a.ascending?"ASC":"DESC")}).join(", ");case"LimitNode":return e("LIMIT")+" "+g(JSON.stringify(a.offset))+", "+g(JSON.stringify(a.limit));case"ReturnNode":return e("RETURN")+" "+G(a.inVariable);case"SubqueryNode":return e("LET")+" "+G(a.outVariable)+" = ... "+f("/* subquery */");case"InsertNode":return z=a.modificationFlags,e("INSERT")+" "+G(a.inVariable)+" "+e("IN")+" "+j(a.collection);case"UpdateNode":return z=a.modificationFlags,a.hasOwnProperty("inKeyVariable")?e("UPDATE")+" "+G(a.inKeyVariable)+" "+e("WITH")+" "+G(a.inDocVariable)+" "+e("IN")+" "+j(a.collection):e("UPDATE")+" "+G(a.inDocVariable)+" "+e("IN")+" "+j(a.collection);case"ReplaceNode":return z=a.modificationFlags,a.hasOwnProperty("inKeyVariable")?e("REPLACE")+" "+G(a.inKeyVariable)+" "+e("WITH")+" "+G(a.inDocVariable)+" "+e("IN")+" "+j(a.collection):e("REPLACE")+" "+G(a.inDocVariable)+" "+e("IN")+" "+j(a.collection);case"UpsertNode":return z=a.modificationFlags,e("UPSERT")+" "+G(a.inDocVariable)+" "+e("INSERT")+" "+G(a.insertVariable)+" "+e(a.isReplace?"REPLACE":"UPDATE")+" "+G(a.updateVariable)+" "+e("IN")+" "+j(a.collection);case"RemoveNode":return z=a.modificationFlags,e("REMOVE")+" "+G(a.inVariable)+" "+e("IN")+" "+j(a.collection);case"RemoteNode":return e("REMOTE");case"DistributeNode":return e("DISTRIBUTE");case"ScatterNode":return e("SCATTER");case"GatherNode":return e("GATHER")}return"unhandled node type ("+a.type+")"},L=0,M=[],N=function(a,b){return n(1+a+a)+(b?"* ":"- ")},O=function(a){D={},F=!0,"SubqueryNode"===a.type&&M.push(L)},P=function(a){-1!==["EnumerateCollectionNode","EnumerateListNode","IndexRangeNode","SubqueryNode"].indexOf(a.type)?L++:"ReturnNode"===a.type&&M.length>0?L=M.pop():"SingletonNode"===a.type&&L++},Q=function(){return F?" "+f("/* const assignment */"):""},R=function(){var a=[];for(var b in D)D.hasOwnProperty(b)&&a.push(h(b)+" : "+j(D[b]));return a.length>0?" "+f("/* collections used:")+" "+a.join(", ")+" "+f("*/"):""},S=function(a){O(a);var b=" "+n(1+v-String(a.id).length)+h(a.id)+" "+e(a.type)+n(1+u-String(a.type).length)+" "+n(1+w-String(a.estimatedNrItems).length)+g(a.estimatedNrItems)+" "+N(L,"SingletonNode"===a.type)+K(a);"CalculationNode"===a.type&&(b+=R()+Q()),B.appendLine(b),P(a)};p(a),B.appendLine(m("Execution plan:"));var T=" "+n(1+v-String("Id").length)+l("Id")+" "+l("NodeType")+n(1+u-String("NodeType").length)+" "+n(1+w-String("Est.").length)+l("Est.")+" "+l("Comment");B.appendLine(T);for(var U=[o];U.length>0;){var V=U.pop(),W=c[V];S(W),d.hasOwnProperty(V)&&(U=U.concat(d[V])),"SubqueryNode"===W.type&&(U=U.concat([W.subquery.nodes[0].id]))}B.appendLine(),t(E),B.appendLine(),r(x.rules),q(z),s(b.warnings)}function v(a,b,d){if("string"==typeof a&&(a={query:a}),!(a instanceof Object))throw"ArangoStatement needs initial data";b=b||{},c(void 0===b.colors?!0:b.colors);var e=w._createStatement(a),f=e.explain(b);return B.clearOutput(),u(a.query,f,!0),void 0===d||d?void z(B.getOutput()):B.getOutput()}var w=require("@arangodb").db,x=require("internal"),y=x.COLORS,z=x.print,A={};"function"==typeof x.printBrowser&&(z=x.printBrowser);var B={output:"",appendLine:function(a){a?this.output+=a+"\n":this.output+="\n"},getOutput:function(){return this.output},clearOutput:function(){this.output=""}};a.explain=v}),module.define("@arangodb/aql/functions",function(a,b){var c=require("internal"),d=require("@arangodb"),e=d.db,f=d.ArangoError,g=function(){var a=e._collection("_aqlfunctions");if(null===a){var b=new f;throw b.errorNum=d.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code,b.errorMessage="collection '_aqlfunctions' not found",b}return a},h=function(a){var b=[];if(null!==a&&void 0!==a&&a.length>0){var c=a.toUpperCase();a.length>1&&"::"!==a.substr(a.length-2,2)&&(c+="::"),g().toArray().forEach(function(a){a.name.toUpperCase().substr(0,c.length)===c&&b.push(a)})}else b=g().toArray();return b},i=function(a){if("string"!=typeof a||!a.match(/^[a-zA-Z0-9_]+(::[a-zA-Z0-9_]+)+$/)||"_"===a.substr(0,1)){var b=new f;throw b.errorNum=d.errors.ERROR_QUERY_FUNCTION_INVALID_NAME.code,b.errorMessage=d.errors.ERROR_QUERY_FUNCTION_INVALID_NAME.message,b}},j=function(a,b){if("function"==typeof a&&(a=String(a)+"\n"),"string"==typeof a){if(a="("+a+"\n)",!c.parse)return a;try{if(c.parse(a,b))return a}catch(e){}}var g=new f;throw g.errorNum=d.errors.ERROR_QUERY_FUNCTION_INVALID_CODE.code,g.errorMessage=d.errors.ERROR_QUERY_FUNCTION_INVALID_CODE.message,g},k=function(a){var b=null;i(a);try{b=g().document(a.toUpperCase())}catch(e){}if(null===b){var h=new f;throw h.errorNum=d.errors.ERROR_QUERY_FUNCTION_NOT_FOUND.code,h.errorMessage=c.sprintf(d.errors.ERROR_QUERY_FUNCTION_NOT_FOUND.message,a),h}return g().remove(b._id),c.reloadAqlFunctions(),!0},l=function(a){if(0===a.length){var b=new f;throw b.errorNum=d.errors.ERROR_BAD_PARAMETER.code,b.errorMessage=d.errors.ERROR_BAD_PARAMETER.message,b}var e=0;return h(a).forEach(function(a){g().remove(a._id),e++}),e>0&&c.reloadAqlFunctions(),e},m=function(a,b,h){i(a),b=j(b,a);var k,l="(function() { var callback = "+b+"; return callback; })()";try{if(c&&c.hasOwnProperty("executeScript")){var m=c.executeScript(l,void 0,"(user function "+a+")");if("function"!=typeof m)throw k=new f,k.errorNum=d.errors.ERROR_QUERY_FUNCTION_INVALID_CODE.code,k.errorMessage=d.errors.ERROR_QUERY_FUNCTION_INVALID_CODE.message+": code must be contained in function",k}}catch(n){throw k=new f,k.errorNum=d.errors.ERROR_QUERY_FUNCTION_INVALID_CODE.code,k.errorMessage=d.errors.ERROR_QUERY_FUNCTION_INVALID_CODE.message,k}var o=e._executeTransaction({collections:{write:g().name()},action:function(a){var b=!1,c=require("internal").db._collection(a.collection),d=a.name;try{var e=c.document(d.toUpperCase());null!==e&&(c.remove(e._key),b=!0)}catch(f){}var g={_key:d.toUpperCase(),name:d,code:a.code,isDeterministic:a.isDeterministic||!1};return c.save(g),b},params:{name:a,code:b,isDeterministic:h,collection:g().name()}});return c.reloadAqlFunctions(),o},n=function(a){var b=[];return h(a).forEach(function(a){b.push({name:a.name,code:a.code.substr(1,a.code.length-2).trim()})}),b};a.unregister=k,a.unregisterGroup=l,a.register=m,a.toArray=n}),module.define("@arangodb/aql/queries",function(a,b){var c=require("internal"),d=require("@arangodb/arangosh");a.clearSlow=function(){var a=c.db,b=a._connection.DELETE("/_api/query/slow","");return d.checkRequestResult(b),b},a.slow=function(){var a=c.db,b=a._connection.GET("/_api/query/slow","");return d.checkRequestResult(b),b},a.current=function(){var a=c.db,b=a._connection.GET("/_api/query/current","");return d.checkRequestResult(b),b},a.properties=function(a){var b,e=c.db;return b=void 0===a?e._connection.GET("/_api/query/properties"):e._connection.PUT("/_api/query/properties",JSON.stringify(a)),d.checkRequestResult(b),b},a.kill=function(a){"object"==typeof a&&a.hasOwnProperty("id")&&(a=a.id);var b=c.db,e=b._connection.DELETE("/_api/query/"+encodeURIComponent(a),"");return d.checkRequestResult(e),e}}),module.define("@arangodb/arango-collection-common",function(a,b){var c=require("@arangodb/arango-collection").ArangoCollection,d=require("@arangodb"),e=d.ArangoError,f=d.sprintf,g=d.db,h=require("@arangodb/simple-query"),i=h.SimpleQueryAll,j=h.SimpleQueryByExample,k=h.SimpleQueryByCondition,l=h.SimpleQueryRange,m=h.SimpleQueryGeo,n=h.SimpleQueryNear,o=h.SimpleQueryWithin,p=h.SimpleQueryWithinRectangle,q=h.SimpleQueryFulltext;c.STATUS_CORRUPTED=0,c.STATUS_NEW_BORN=1,c.STATUS_UNLOADED=2,c.STATUS_LOADED=3,c.STATUS_UNLOADING=4,c.STATUS_DELETED=5,c.STATUS_LOADING=6,c.TYPE_DOCUMENT=2,c.TYPE_EDGE=3,c.prototype._PRINT=function(a){var b="unknown",d="unknown",e=this.name();switch(this.status()){case c.STATUS_NEW_BORN:b="new born";break;case c.STATUS_UNLOADED:b="unloaded";break;case c.STATUS_UNLOADING:b="unloading";break;case c.STATUS_LOADED:b="loaded";break;case c.STATUS_CORRUPTED:b="corrupted";break;case c.STATUS_DELETED:b="deleted"}switch(this.type()){case c.TYPE_DOCUMENT:d="document";break;case c.TYPE_EDGE:d="edge"}var f=require("internal").COLORS,g=a.useColor;a.output+="[ArangoCollection ",g&&(a.output+=f.COLOR_NUMBER),a.output+=this._id,g&&(a.output+=f.COLOR_RESET),a.output+=', "',g&&(a.output+=f.COLOR_STRING),a.output+=e||"unknown",g&&(a.output+=f.COLOR_RESET),a.output+='" (type '+d+", status "+b+")]"},c.prototype.toString=function(){return"[ArangoCollection: "+this._id+"]"},c.prototype.all=function(){return new i(this)},c.prototype.byExample=function(a){var b,c;if(1===arguments.length)b=a;else for(b={},c=0;c=1?h=this.all():(c=f("FOR d IN %s FILTER rand() >= @prob RETURN d",this.name()),c=g._createStatement({query:c}),1>j&&c.bind("prob",j),h=c.execute());else{if("number"!=typeof k){var l=new e;throw l.errorNum=d.errors.ERROR_ILLEGAL_NUMBER.code,l.errorMessage="expecting a number, got "+String(k),l}j>=1?h=this.all().limit(k):(c=f("FOR d IN %s FILTER rand() >= @prob LIMIT %d RETURN d",this.name(),k),c=g._createStatement({query:c}),1>j&&c.bind("prob",j),h=c.execute())}for(i=0;h.hasNext();){var m=h.next();a(m,i),i++}},c.prototype.removeByExample=function(a,b,c){throw"cannot call abstract removeByExample function"},c.prototype.replaceByExample=function(a,b,c,d){throw"cannot call abstract replaceByExample function"},c.prototype.updateByExample=function(a,b,c,d,e){throw"cannot call abstract updateExample function"}}),module.define("@arangodb/arango-collection",function(a,b){function c(a,b){a.fields=[];var c,d=function(d){a.hasOwnProperty(d)||(a[d]=b[c][d])};for(c=0;c col = db.mycoll; \n > col = db._create("mycoll"); \n \nAdministration Functions: \n name() collection name \n status() status of the collection \n type() type of the collection \n truncate() delete all documents \n properties() show collection properties \n drop() delete a collection \n load() load a collection into memory \n unload() unload a collection from memory \n rename() renames a collection \n getIndexes() return defined indexes \n refresh() refreshes the status and name \n _help() this help \n \nDocument Functions: \n count() return number of documents \n save() create document and return handle \n document() get document by handle (_id or _key)\n replace(, , ) overwrite document \n update(, , , partially update document \n ) \n remove() delete document \n exists() checks whether a document exists \n first() first inserted/updated document \n last() last inserted/updated document \n \nAttributes: \n _database database object \n _id collection identifier ';d.prototype._help=function(){e.print(h)},d.prototype.name=function(){return null===this._name&&this.refresh(),this._name},d.prototype.status=function(){var a;return null===this._status&&this.refresh(),a=this._status,this._status===d.STATUS_UNLOADING&&(this._status=null),a},d.prototype.type=function(){return null===this._type&&this.refresh(),this._type},d.prototype.properties=function(a){var b,c,d={doCompact:!0,journalSize:!0,isSystem:!1,isVolatile:!1,waitForSync:!0,shardKeys:!1,numberOfShards:!1,keyOptions:!1,indexBuckets:!0};if(void 0===a)c=this._database._connection.GET(this._baseurl("properties")),f.checkRequestResult(c);else{var e={};for(b in d)d.hasOwnProperty(b)&&d[b]&&a.hasOwnProperty(b)&&(e[b]=a[b]);c=this._database._connection.PUT(this._baseurl("properties"),JSON.stringify(e)),f.checkRequestResult(c)}var g={};for(b in d)d.hasOwnProperty(b)&&c.hasOwnProperty(b)&&void 0!==c[b]&&(g[b]=c[b]);return g},d.prototype.rotate=function(){var a=this._database._connection.PUT(this._baseurl("rotate"),"");return f.checkRequestResult(a),a.result},d.prototype.figures=function(){var a=this._database._connection.GET(this._baseurl("figures"));return f.checkRequestResult(a),a.figures},d.prototype.checksum=function(a,b){var c="";a&&(c+="?withRevisions=true"),b&&(c+=(""===c?"?":"&")+"withData=true");var d=this._database._connection.GET(this._baseurl("checksum")+c);return f.checkRequestResult(d),{checksum:d.checksum,revision:d.revision}},d.prototype.revision=function(){var a=this._database._connection.GET(this._baseurl("revision"));return f.checkRequestResult(a),a.revision},d.prototype.drop=function(){var a=this._database._connection.DELETE(this._baseurl());f.checkRequestResult(a),this._status=d.STATUS_DELETED; -var b,c=this._database;for(b in c)if(c.hasOwnProperty(b)){var e=c[b];e instanceof d&&e.name()===this.name()&&delete c[b]}},d.prototype.truncate=function(){var a=this._database._connection.PUT(this._baseurl("truncate"),"");f.checkRequestResult(a),this._status=null},d.prototype.load=function(a){var b={count:!0};void 0!==a&&(b.count=a);var c=this._database._connection.PUT(this._baseurl("load"),JSON.stringify(b));f.checkRequestResult(c),this._status=null},d.prototype.unload=function(){var a=this._database._connection.PUT(this._baseurl("unload"),"");f.checkRequestResult(a),this._status=null},d.prototype.rename=function(a){var b={name:a},c=this._database._connection.PUT(this._baseurl("rename"),JSON.stringify(b));f.checkRequestResult(c),delete this._database[this._name],this._database[a]=this,this._status=null,this._name=null},d.prototype.refresh=function(){var a=this._database._connection.GET(this._database._collectionurl(this._id)+"?useId=true");f.checkRequestResult(a),this._name=a.name,this._status=a.status,this._type=a.type},d.prototype.getIndexes=function(a){var b=this._database._connection.GET(this._indexurl()+"&withStats="+(a||!1));return f.checkRequestResult(b),b.indexes},d.prototype.index=function(a){a.hasOwnProperty("id")&&(a=a.id);var b=this._database._connection.GET(this._database._indexurl(a,this.name()));return f.checkRequestResult(b),b},d.prototype.dropIndex=function(a){a.hasOwnProperty("id")&&(a=a.id);var b=this._database._connection.DELETE(this._database._indexurl(a,this.name()));return null!==b&&b.error===!0&&b.errorNum===e.errors.ERROR_ARANGO_INDEX_NOT_FOUND.code?!1:(f.checkRequestResult(b),!0)},d.prototype.ensureCapConstraint=function(a,b){var c={type:"cap",size:a||void 0,byteSize:b||void 0},d=this._database._connection.POST(this._indexurl(),JSON.stringify(c));return f.checkRequestResult(d),d},d.prototype.ensureUniqueSkiplist=function(){var a=c({type:"skiplist",unique:!0},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureSkiplist=function(){var a=c({type:"skiplist",unique:!1},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureFulltextIndex=function(a,b){var c={type:"fulltext",minLength:b||void 0,fields:[a]},d=this._database._connection.POST(this._indexurl(),JSON.stringify(c));return f.checkRequestResult(d),d},d.prototype.ensureUniqueConstraint=function(){var a=c({type:"hash",unique:!0},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureHashIndex=function(){var a=c({type:"hash",unique:!1},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureGeoIndex=function(a,b){var c;if("string"!=typeof a)throw"usage: ensureGeoIndex(, ) or ensureGeoIndex([, ])";c="boolean"==typeof b?{type:"geo",fields:[a],geoJson:b}:void 0===b?{type:"geo",fields:[a],geoJson:!1}:{type:"geo",fields:[a,b],geoJson:!1};var d=this._database._connection.POST(this._indexurl(),JSON.stringify(c));return f.checkRequestResult(d),d},d.prototype.ensureGeoConstraint=function(a,b){return this.ensureGeoIndex(a,b)},d.prototype.ensureIndex=function(a){if("object"!=typeof a||Array.isArray(a))throw"usage: ensureIndex()";var b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.count=function(){var a=this._database._connection.GET(this._baseurl("count"));return f.checkRequestResult(a),a.count},d.prototype.document=function(a){var b,c=null;if(a.hasOwnProperty("_id")&&(a.hasOwnProperty("_rev")&&(c=a._rev),a=a._id),b=null===c?this._database._connection.GET(this._documenturl(a)):this._database._connection.GET(this._documenturl(a),{"if-match":JSON.stringify(c)}),null!==b&&b.error===!0&&b.errorNum===e.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code)throw new g(b);return f.checkRequestResult(b),b},d.prototype.exists=function(a){var b,c=null;if(void 0===a||null===a)throw new g({errorNum:e.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.code,errorMessage:e.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.message});return a.hasOwnProperty("_id")&&(a.hasOwnProperty("_rev")&&(c=a._rev),a=a._id),b=null===c?this._database._connection.HEAD(this._documenturl(a)):this._database._connection.HEAD(this._documenturl(a),{"if-match":JSON.stringify(c)}),null===b||b.error!==!0||b.errorNum!==e.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code&&b.errorNum!==e.errors.ERROR_HTTP_NOT_FOUND.code&&b.errorNum!==e.errors.ERROR_HTTP_PRECONDITION_FAILED.code?(f.checkRequestResult(b),!0):!1},d.prototype.any=function(){var a=this._database._connection.PUT(this._prefixurl("/_api/simple/any"),JSON.stringify({collection:this._name}));return f.checkRequestResult(a),a.document},d.prototype.firstExample=function(a){var b,c;if(1===arguments.length)b=a;else for(b={},c=0;c) get collection by identifier/name \n _create(, ) creates a new collection \n _createEdgeCollection() creates a new edge collection \n _drop() delete a collection \n \nDocument Functions: \n _document() get document by handle (_id) \n _replace(, , ) overwrite document \n _update(, , , partially update document \n ) \n _remove() delete document \n _exists() checks whether a document exists \n _truncate() delete all documents \n \nDatabase Management Functions: \n _createDatabase() creates a new database \n _dropDatabase() drops an existing database \n _useDatabase() switches into an existing database\n _drop() delete a collection \n _name() name of the current database \n \nQuery / Transaction Functions: \n _executeTransaction() execute transaction \n _query() execute AQL query \n _createStatement() create and return AQL query ";c.prototype._help=function(){e.print(i)},c.prototype.toString=function(){return'[object ArangoDatabase "'+this._name()+'"]'},c.prototype._collections=function(){var a=this._connection.GET(this._collectionurl());if(f.checkRequestResult(a),void 0!==a.collections){var b,c=a.collections,d=[];for(b=0;b)"});if(!a.collections||"object"!=typeof a.collections)throw new g({error:!0,code:e.errors.ERROR_HTTP_BAD_PARAMETER.code,errorNum:e.errors.ERROR_BAD_PARAMETER.code,errorMessage:"missing/invalid collections definition for transaction"});if(!a.action||"string"!=typeof a.action&&"function"!=typeof a.action)throw new g({error:!0,code:e.errors.ERROR_HTTP_BAD_PARAMETER.code,errorNum:e.errors.ERROR_BAD_PARAMETER.code,errorMessage:"missing/invalid action definition for transaction"});"function"==typeof a.action&&(a.action=String(a.action));var b=this._connection.POST("/_api/transaction",JSON.stringify(a));if(null!==b&&b.error===!0)throw new g(b);return f.checkRequestResult(b),b.result}}),module.define("@arangodb/arango-query-cursor",function(a,b){function c(a,b){this._database=a,this._dbName=a._name(),this.data=b,this._hasNext=!1,this._hasMore=!1,this._pos=0,this._count=0,this._total=0,void 0!==b.result&&(this._count=b.result.length,this._pos0){if(a)d.print(b);else{var f=d.startCaptureMode();d.print(b),e+="\n\n"+d.stopCaptureMode(f)}this.hasNext()&&(e+="\ntype 'more' to show more documents\n",more=this)}return a||(d.print(e),e=""),e},c.prototype.toArray=function(){for(var a=[];this.hasNext();)a.push(this.next());return a};var f=e.createHelpHeadline("ArangoQueryCursor help")+'ArangoQueryCursor constructor: \n > cursor = stmt.execute() \nFunctions: \n hasNext() returns true if there are \n more results to fetch \n next() returns the next document \n toArray() returns all data from the cursor\n _help() this help \nAttributes: \n _database database object \nExample: \n > stmt = db._createStatement({ "query": "FOR c IN coll RETURN c" })\n > cursor = stmt.execute() \n > documents = cursor.toArray() \n > cursor = stmt.execute() \n > while (cursor.hasNext()) { print(cursor.next()) } ';c.prototype._help=function(){d.print(f)},c.prototype.hasNext=function(){return this._hasNext},c.prototype.next=function(){if(!this._hasNext)throw"No more results";var a=this.data.result[this._pos];if(this._pos++,this._pos===this._count&&(this._hasNext=!1,this._pos=0,this._hasMore&&this.data.id)){this._hasMore=!1;var b=this._database._connection.PUT(this._baseurl(),"");e.checkRequestResult(b),this.data=b,this._count=b.result.length,this._pos0&&(this._batchSize=b)},c.prototype.setOptions=function(a){this._options=a},c.prototype.setQuery=function(a){this._query=a&&"function"==typeof a.toAQL?a.toAQL():a},c.prototype.parse=function(){throw"cannot call abstract method parse()"},c.prototype.explain=function(){throw"cannot call abstract method explain()"},c.prototype.execute=function(){throw"cannot call abstract method execute()"},a.ArangoStatement=c}),module.define("@arangodb/arango-statement",function(a,b){var c=require("internal"),d=require("@arangodb/arangosh"),e=require("@arangodb/arango-statement-common").ArangoStatement,f=require("@arangodb/arango-query-cursor").ArangoQueryCursor;e.prototype.toString=function(){return d.getIdString(this,"ArangoStatement")};var g=d.createHelpHeadline("ArangoStatement help")+'Create an AQL query: \n > stmt = new ArangoStatement(db, { "query": "FOR..." }) \n > stmt = db._createStatement({ "query": "FOR..." }) \nSet query options: \n > stmt.setBatchSize() set the max. number of results \n to be transferred per roundtrip \n > stmt.setCount() set count flag (return number of\n results in "count" attribute) \nGet query options: \n > stmt.setBatchSize() return the max. number of results\n to be transferred per roundtrip \n > stmt.getCount() return count flag (return number\n of results in "count" attribute)\n > stmt.getQuery() return query string \n results in "count" attribute) \nBind parameters to a query: \n > stmt.bind(, ) bind single variable \n > stmt.bind() bind multiple variables \nExecute query: \n > cursor = stmt.execute() returns a cursor \nGet all results in an array: \n > docs = cursor.toArray() \nOr loop over the result set: \n > while (cursor.hasNext()) { print(cursor.next()) } ';e.prototype._help=function(){c.print(g)},e.prototype.parse=function(){var a={query:this._query},b=this._database._connection.POST("/_api/query",JSON.stringify(a));d.checkRequestResult(b);var c={bindVars:b.bindVars,collections:b.collections, -ast:b.ast};return c},e.prototype.explain=function(a){var b=this._options||{};"object"==typeof b&&"object"==typeof a&&Object.keys(a).forEach(function(c){b[c]=a[c]});var c={query:this._query,bindVars:this._bindVars,options:b},e=this._database._connection.POST("/_api/explain",JSON.stringify(c));return d.checkRequestResult(e),b&&b.allPlans?{plans:e.plans,warnings:e.warnings,stats:e.stats}:{plan:e.plan,warnings:e.warnings,stats:e.stats}},e.prototype.execute=function(){var a={query:this._query,count:this._doCount,bindVars:this._bindVars};this._batchSize&&(a.batchSize=this._batchSize),this._options&&(a.options=this._options),void 0!==this._cache&&(a.cache=this._cache);var b=this._database._connection.POST("/_api/cursor",JSON.stringify(a));return d.checkRequestResult(b),new f(this._database,b)},a.ArangoStatement=e}),module.define("@arangodb/arangosh",function(a,b){var c=require("internal");a.getIdString=function(a,b){var c="[object "+b;return a._id?c+=":"+a._id:a.data&&a.data._id&&(c+=":"+a.data._id),c+="]"},a.createHelpHeadline=function(a){var b,c="",d=Math.abs(78-a.length)/2;for(b=0;d>b;++b)c+="-";return"\n"+c+" "+a+" "+c+"\n"};var d=require("@arangodb"),e=d.ArangoError;a.checkRequestResult=function(a){if(void 0===a)throw new e({error:!0,code:500,errorNum:d.ERROR_INTERNAL,errorMessage:"Unknown error. Request result is empty"});if(a.hasOwnProperty("error")){if(a.error){if(a.errorNum===d.ERROR_TYPE_ERROR)throw new TypeError(a.errorMessage);throw new e(a)}delete a.error}return a},a.HELP=a.createHelpHeadline("Help")+"Predefined objects: \n arango: ArangoConnection \n db: ArangoDatabase \n fm: FoxxManager \nExamples: \n > db._collections() list all collections \n > db._create() create a new collection \n > db._drop() drop a collection \n > db..toArray() list all documents \n > id = db..save({ ... }) save a document \n > db..remove(<_id>) delete a document \n > db..document(<_id>) retrieve a document \n > db..replace(<_id>, {...}) overwrite a document \n > db..update(<_id>, {...}) partially update a document\n > db..exists(<_id>) check if document exists \n > db._query().toArray() execute an AQL query \n > db._useDatabase() switch database \n > db._createDatabase() create a new database \n > db._listDatabases() list existing databases \n > help show help pages \n > exit \nNote: collection names and statuses may be cached in arangosh. \nTo refresh the list of collections and their statuses, issue: \n > db._collections(); \n \n"+(c.printBrowser?"To cancel the current prompt, press CTRL + z. \n \nPlease note that all variables defined with the var keyword will \ndisappear when the command is finished. To introduce variables that\nare persisting until the next command, omit the var keyword. \n\nType 'tutorial' for a tutorial or 'help' to see common examples":"To cancel the current prompt, press CTRL + d. \n"),a.helpExtended=a.createHelpHeadline("More help")+"Pager: \n > stop_pager() stop the pager output \n > start_pager() start the pager \nPretty printing: \n > stop_pretty_print() stop pretty printing \n > start_pretty_print() start pretty printing \nColor output: \n > stop_color_print() stop color printing \n > start_color_print() start color printing \nPrint function: \n > print(x) std. print function \n > print_plain(x) print without prettifying \n and without colors \n > clear() clear screen "}),module.define("@arangodb/general-graph",function(a,b){var c=require("@arangodb"),d=require("internal"),e=c.ArangoCollection,f=c.ArangoError,g=c.db,h=c.errors,i=require("underscore"),j=function(a){return"string"==typeof a?[a]:i.clone(a)},k=function(a){return a?Array.isArray(a)&&0===a.length?!1:"string"==typeof a||Array.isArray(a)?!0:!1:!1},l=function(a,b,d){var h=g._collection(a),i=!1;if(null!==h||d){if(!(h instanceof e)){var j=new f;throw j.errorNum=c.errors.ERROR_GRAPH_NOT_AN_ARANGO_COLLECTION.code,j.errorMessage=a+c.errors.ERROR_GRAPH_NOT_AN_ARANGO_COLLECTION.message,j}}else h=b===e.TYPE_DOCUMENT?g._create(a):g._createEdgeCollection(a),i=!0;return i},m=function(a,b){var d={},h={};return a.forEach(function(a){if(!(a.hasOwnProperty("collection")&&a.hasOwnProperty("from")&&a.hasOwnProperty("to")&&Array.isArray(a.from)&&Array.isArray(a.to))){var i=new f;throw i.errorNum=c.errors.ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION.code,i.errorMessage=c.errors.ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION.message,i}a.from.concat(a.to).forEach(function(a){l(a,e.TYPE_DOCUMENT,b),d[a]=g[a]}),l(a.collection,e.TYPE_EDGE,b),h[a.collection]=g[a.collection]}),[d,h]},n=function(){var a=g._graphs;if(null===a||void 0===a){var b=new f;throw b.errorNum=c.errors.ERROR_GRAPH_NO_GRAPH_COLLECTION.code,b.errorMessage=c.errors.ERROR_GRAPH_NO_GRAPH_COLLECTION.message,b}return a},o=function(a){return i.map(a,function(a){var b=a.collection;return b+=": [",b+=a.from.join(", "),b+="] -> [",b+=a.to.join(", "),b+="]"})},p=function(a){var b={};return i.each(i.functions(a),function(c){b[c]=function(){return a[c].apply(a,arguments)}}),b},q=function(a){if(void 0===a)return{};if("string"==typeof a)return{_id:a};if("object"==typeof a)return Array.isArray(a)?i.map(a,function(a){return"string"==typeof a?{_id:a}:a}):a;var b=new f;throw b.errorNum=c.errors.ERROR_GRAPH_INVALID_EXAMPLE_ARRAY_OBJECT_STRING.code,b.errorMessage=c.errors.ERROR_GRAPH_INVALID_EXAMPLE_ARRAY_OBJECT_STRING.message,b},r=function(a,b,d){var e=[],g=i.map(a,function(a){return a.name()});if(i.each(b,function(a){i.contains(g,a)||e.push(a)}),e.length>0){var h=new f;throw h.errorNum=c.errors.ERROR_BAD_PARAMETER.code,h.errorMessage=d+": "+e.join(" and ")+" are not known to the graph",h}return!0},s=function(a,b){this.query=a,b&&(this.type=b)};s.prototype.printQuery=function(){return this.query},s.prototype.isPathQuery=function(){return"path"===this.type},s.prototype.isPathVerticesQuery=function(){return"pathVertices"===this.type},s.prototype.isPathEdgesQuery=function(){return"pathEdges"===this.type},s.prototype.isEdgeQuery=function(){return"edge"===this.type},s.prototype.isVertexQuery=function(){return"vertex"===this.type},s.prototype.isNeighborQuery=function(){return"neighbor"===this.type},s.prototype.allowsRestrict=function(){return this.isEdgeQuery()||this.isVertexQuery()||this.isNeighborQuery()};var t=function(a){this.stack=[],this.callStack=[],this.bindVars={graphName:a.__name},this.graph=a,this.cursor=null,this.lastVar="",this._path=[],this._pathVertices=[],this._pathEdges=[],this._getPath=!1};t.prototype._addToPrint=function(a){var b=Array.prototype.slice.call(arguments);b.shift();var c={};c.name=a,b.length>0&&void 0!==b[0]?c.params=b:c.params=[],this.callStack.push(c)},t.prototype._PRINT=function(a){a.output="[ GraphAQL ",a.output+=this.graph.__name,i.each(this.callStack,function(b){a.prettyPrint&&(a.output+="\n"),a.output+=".",a.output+=b.name,a.output+="(";var c=0;for(c=0;c0&&(a.output+=", "),d.printRecursive(b.params[c],a);a.output+=")"}),a.output+=" ] "},t.prototype._clearCursor=function(){this.cursor&&(this.cursor.dispose(),this.cursor=null)},t.prototype._createCursor=function(){this.cursor||(this.cursor=this.execute())},t.prototype._edges=function(a,b){this._clearCursor(),this.options=b||{};var c=q(a),d="edges_"+this.stack.length,e="FOR "+d+" IN GRAPH_EDGES(@graphName";e+=this.getLastVar()?","+this.getLastVar():",{}",e+=",@options_"+this.stack.length+")",Array.isArray(c)||(c=[c]),this.options.edgeExamples=c,this.options.includeData=!0,this.bindVars["options_"+this.stack.length]=this.options;var f=new s(e,"edge");return this.stack.push(f),this.lastVar=d,this._path.push(d),this._pathEdges.push(d),this},t.prototype.edges=function(a){return this._addToPrint("edges",a),this._edges(a,{direction:"any"})},t.prototype.outEdges=function(a){return this._addToPrint("outEdges",a),this._edges(a,{direction:"outbound"})},t.prototype.inEdges=function(a){return this._addToPrint("inEdges",a),this._edges(a,{direction:"inbound"})},t.prototype._vertices=function(a,b,c){this._clearCursor(),this.options=b||{};var d=q(a),e="vertices_"+this.stack.length,f="FOR "+e+" IN GRAPH_VERTICES(@graphName,";if(void 0!==c)if(Array.isArray(c)){var g;for(f+="[",g=0;g0&&(f+=","),f+="MERGE(@vertexExample_"+this.stack.length+","+c[g]+")";f+="]"}else f+="MERGE(@vertexExample_"+this.stack.length+","+c+")";else f+="@vertexExample_"+this.stack.length;f+=",@options_"+this.stack.length+")",this.bindVars["vertexExample_"+this.stack.length]=d,this.bindVars["options_"+this.stack.length]=this.options;var h=new s(f,"vertex");return this.stack.push(h),this.lastVar=e,this._path.push(e),this._pathVertices.push(e),this},t.prototype.vertices=function(a){if(this._addToPrint("vertices",a),!this.getLastVar())return this._vertices(a);var b=this.getLastVar();return this._vertices(a,void 0,["{'_id': "+b+"._from}","{'_id': "+b+"._to}"])},t.prototype.fromVertices=function(a){if(this._addToPrint("fromVertices",a),!this.getLastVar())return this._vertices(a);var b=this.getLastVar();return this._vertices(a,void 0,"{'_id': "+b+"._from}")},t.prototype.toVertices=function(a){if(this._addToPrint("toVertices",a),!this.getLastVar())return this._vertices(a);var b=this.getLastVar();return this._vertices(a,void 0,"{'_id': "+b+"._to}")},t.prototype.getLastVar=function(){return""===this.lastVar?!1:this.lastVar},t.prototype.path=function(){this._clearCursor();var a=new s("","path");return this.stack.push(a),this},t.prototype.pathVertices=function(){this._clearCursor();var a=new s("","pathVertices");return this.stack.push(a),this},t.prototype.pathEdges=function(){this._clearCursor();var a=new s("","pathEdges");return this.stack.push(a),this},t.prototype.neighbors=function(a,b){this._addToPrint("neighbors",a,b);var c,d=q(a),e="neighbors_"+this.stack.length,f="FOR "+e+" IN GRAPH_NEIGHBORS(@graphName,"+this.getLastVar()+",@options_"+this.stack.length+")";c=b?i.clone(b):{},c.neighborExamples=d,c.includeData=!0,this.bindVars["options_"+this.stack.length]=c;var g=new s(f,"neighbor");return this.stack.push(g),this.lastVar=e,this._path.push(e),this._pathVertices.push(e),this},t.prototype._getLastRestrictableStatementInfo=function(){for(var a=this.stack.length-1;!this.stack[a].allowsRestrict();)a--;return{statement:this.stack[a],options:this.bindVars["options_"+a]}},t.prototype.restrict=function(a){var b=j(a);if(0===b.length)return this;this._addToPrint("restrict",a),this._clearCursor();var c,d=this._getLastRestrictableStatementInfo(),e=d.statement,f=d.options;return e.isEdgeQuery()?(r(this.graph._edgeCollections(),b,"edge collections"),c=f.edgeCollectionRestriction||[],f.edgeCollectionRestriction=c.concat(a)):(e.isVertexQuery()||e.isNeighborQuery())&&(r(this.graph._vertexCollections(),b,"vertex collections"),c=f.vertexCollectionRestriction||[],f.vertexCollectionRestriction=c.concat(a)),this},t.prototype.filter=function(a){this._addToPrint("filter",a),this._clearCursor();var b=[];if("[object Array]"!==Object.prototype.toString.call(a)){if("[object Object]"!==Object.prototype.toString.call(a)){var d=new f;throw d.errorNum=c.errors.ERROR_GRAPH_INVALID_EXAMPLE_ARRAY_OBJECT.code,d.errorMessage=c.errors.ERROR_GRAPH_INVALID_EXAMPLE_ARRAY_OBJECT.message,d}b=[a]}else b=a;var e="FILTER MATCHES("+this.getLastVar()+","+JSON.stringify(b)+")";return this.stack.push(new s(e)),this},t.prototype.printQuery=function(){return this.stack.map(function(a){return a.printQuery()}).join(" ")},t.prototype.execute=function(){this._clearCursor();var a=this.printQuery(),b=this.bindVars;return a+=this.stack[this.stack.length-1].isPathQuery()?" RETURN ["+this._path+"]":this.stack[this.stack.length-1].isPathVerticesQuery()?" RETURN FLATTEN(["+this._pathVertices+"])":this.stack[this.stack.length-1].isPathEdgesQuery()?" RETURN FLATTEN(["+this._pathEdges+"])":" RETURN "+this.getLastVar(),g._query(a,b,{count:!0})},t.prototype.toArray=function(){return this._createCursor(),this.cursor.toArray()},t.prototype.count=function(){return this._createCursor(),this.cursor.count()},t.prototype.hasNext=function(){return this._createCursor(),this.cursor.hasNext()},t.prototype.next=function(){return this._createCursor(),this.cursor.next()};var u=function(a,b){var d;if(arguments.length<2)throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_INVALID_NUMBER_OF_ARGUMENTS.code,d.errorMessage=c.errors.ERROR_GRAPH_INVALID_NUMBER_OF_ARGUMENTS.message+"2",d;if("string"!=typeof a||""===a)throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_INVALID_PARAMETER.code,d.errorMessage=c.errors.ERROR_GRAPH_INVALID_PARAMETER.message+" arg1 must not be empty",d;if(!k(b))throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_INVALID_PARAMETER.code,d.errorMessage=c.errors.ERROR_GRAPH_INVALID_PARAMETER.message+" arg2 must not be empty",d;return{collection:a,from:j(b),to:j(b)}},v=function(a,b,d){var e;if(arguments.length<3)throw e=new f,e.errorNum=c.errors.ERROR_GRAPH_INVALID_NUMBER_OF_ARGUMENTS.code,e.errorMessage=c.errors.ERROR_GRAPH_INVALID_NUMBER_OF_ARGUMENTS.message+"3",e;if("string"!=typeof a||""===a)throw e=new f,e.errorNum=c.errors.ERROR_GRAPH_INVALID_PARAMETER.code,e.errorMessage=c.errors.ERROR_GRAPH_INVALID_PARAMETER.message+" arg1 must be non empty string",e;if(!k(b))throw e=new f,e.errorNum=c.errors.ERROR_GRAPH_INVALID_PARAMETER.code,e.errorMessage=c.errors.ERROR_GRAPH_INVALID_PARAMETER.message+" arg2 must be non empty string or array",e;if(!k(d))throw e=new f,e.errorNum=c.errors.ERROR_GRAPH_INVALID_PARAMETER.code,e.errorMessage=c.errors.ERROR_GRAPH_INVALID_PARAMETER.message+" arg3 must be non empty string or array",e;return{collection:a,from:j(b),to:j(d)}},w=function(){var a=n();return i.pluck(a.toArray(),"_key")},x=function(){return n().toArray()},y=function(){var a=[],b=arguments;return Object.keys(b).forEach(function(c){a.push(b[c])}),a},z=function(a){var b=arguments,c=0;Object.keys(b).forEach(function(d){c++,1!==c&&a.push(b[d])})},A=function(a){return a.from=a.from.sort(),a.to=a.to.sort(),a},B=function(a,b,d,g){Array.isArray(d)||(d=[]);var i,j,k,o=n(),p=!0;if(!a)throw i=new f,i.errorNum=c.errors.ERROR_GRAPH_CREATE_MISSING_NAME.code,i.errorMessage=c.errors.ERROR_GRAPH_CREATE_MISSING_NAME.message,i;if(b=b||[],!Array.isArray(b))throw i=new f,i.errorNum=c.errors.ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION.code,i.errorMessage=c.errors.ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION.message,i;var q=[],r={};b.forEach(function(a){var b=a.collection;if(-1!==q.indexOf(b))throw i=new f,i.errorNum=c.errors.ERROR_GRAPH_COLLECTION_MULTI_USE.code,i.errorMessage=c.errors.ERROR_GRAPH_COLLECTION_MULTI_USE.message,i;q.push(b),r[b]=a}),o.toArray().forEach(function(a){var b=a.edgeDefinitions;b.forEach(function(a){var b=a.collection;if(-1!==q.indexOf(b)&&JSON.stringify(a)!==JSON.stringify(r[b]))throw i=new f,i.errorNum=c.errors.ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS.code,i.errorMessage=b+" "+c.errors.ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS.message,i})});try{o.document(a)}catch(s){if(s.errorNum!==h.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code)throw s;p=!1}if(p)throw i=new f,i.errorNum=c.errors.ERROR_GRAPH_DUPLICATE.code,i.errorMessage=c.errors.ERROR_GRAPH_DUPLICATE.message,i;j=m(b,!1),d.forEach(function(a){l(a,e.TYPE_DOCUMENT)}),b.forEach(function(a,c){var d=A(a);b[c]=d}),d=d.sort();var t=o.save({orphanCollections:d,edgeDefinitions:b,_key:a},g);return k=new H(a,b,j[0],j[1],d,t._rev,t._id)},C=function(a,b,c){Object.defineProperty(a,b,{enumerable:!1,writable:!0}),a[b]=c},D=function N(a,b,c,d){d.__idsToRemove[c]=1,a.forEach(function(e){var f=e.edgeDefinitions;e.edgeDefinitions&&f.forEach(function(e){var f=e.from,h=e.to,i=e.collection;if(-1!==f.indexOf(b)||-1!==h.indexOf(b)){var j=g._collection(i).edges(c);j.forEach(function(b){d.__idsToRemove.hasOwnProperty(b._id)||(d.__collectionsToLock[i]=1,N(a,i,b._id,d))})}})})},E=function(a,b){i.each(b,function(b){var d=g._collection(b),e=p(d),h=e.save;e.save=function(d,e,g){if("string"!=typeof d||-1===d.indexOf("/")||"string"!=typeof e||-1===e.indexOf("/")){var j=new f;throw j.errorNum=c.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.code,j.errorMessage=c.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.message,j}return a.__edgeDefinitions.forEach(function(a){if(a.collection===b){var g=d.split("/")[0],h=e.split("/")[0];if(!i.contains(a.from,g)||!i.contains(a.to,h)){var j=new f;throw j.errorNum=c.errors.ERROR_GRAPH_INVALID_EDGE.code,j.errorMessage=c.errors.ERROR_GRAPH_INVALID_EDGE.message+" between "+d+" and "+e+".",j}}}),h(d,e,g)},e.remove=function(c,d){-1===c.indexOf("/")&&(c=b+"/"+c);var e=n().toArray(),f=c.split("/")[0];a.__collectionsToLock[f]=1,D(e,f,c,a);try{g._executeTransaction({collections:{write:Object.keys(a.__collectionsToLock)},embed:!0,action:function(a){var b=require("internal").db;a.ids.forEach(function(c){a.options?b._remove(c,a.options):b._remove(c)})},params:{ids:Object.keys(a.__idsToRemove),options:d}})}catch(h){throw a.__idsToRemove={},a.__collectionsToLock={},h}return a.__idsToRemove={},a.__collectionsToLock={},!0},a[b]=e})},F=function(a,b){i.each(b,function(b){var c=g._collection(b),d=p(c);d.remove=function(c,d){var e=n().toArray(),f=b;-1===c.indexOf("/")&&(c=b+"/"+c),a.__collectionsToLock[f]=1,e.forEach(function(b){var d=b.edgeDefinitions;b.edgeDefinitions&&d.forEach(function(b){var d=b.from,h=b.to,i=b.collection;if(-1!==d.indexOf(f)||-1!==h.indexOf(f)){var j=g._collection(i).edges(c);j.length>0&&(a.__collectionsToLock[i]=1,j.forEach(function(b){D(e,i,b._id,a)}))}})});try{g._executeTransaction({collections:{write:Object.keys(a.__collectionsToLock)},embed:!0,action:function(a){var b=require("internal").db;a.ids.forEach(function(c){a.options?b._remove(c,a.options):b._remove(c)}),a.options?b._remove(a.vertexId,a.options):b._remove(a.vertexId)},params:{ids:Object.keys(a.__idsToRemove),options:d,vertexId:c}})}catch(h){throw a.__idsToRemove={},a.__collectionsToLock={},h}return a.__idsToRemove={},a.__collectionsToLock={},!0},a[b]=d})},G=function(a){Object.keys(a).forEach(function(b){"_"!==b.substring(0,1)&&delete a[b]}),a.__edgeDefinitions.forEach(function(b){E(a,[b.collection]),F(a,b.from),F(a,b.to)}),F(a,a.__orphanCollections)},H=function(a,b,c,d,e,f,g){b.forEach(function(a,c){var d=A(a);b[c]=d}),e||(e=[]);var h="object"==typeof ArangoClusterComm;h&&require("@arangodb/cluster").isCoordinator()&&(h=!1);var i=this;C(this,"__useBuiltIn",h),C(this,"__name",a),C(this,"__vertexCollections",c),C(this,"__edgeCollections",d),C(this,"__edgeDefinitions",b),C(this,"__idsToRemove",{}),C(this,"__collectionsToLock",{}),C(this,"__id",g),C(this,"__rev",f),C(this,"__orphanCollections",e),G(i)},I=function(a){var b,d,e,g=n();try{b=g.document(a)}catch(i){if(i.errorNum!==h.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code)throw i;var j=new f;throw j.errorNum=c.errors.ERROR_GRAPH_NOT_FOUND.code,j.errorMessage=c.errors.ERROR_GRAPH_NOT_FOUND.message,j}return d=m(b.edgeDefinitions,!0),e=b.orphanCollections,e||(e=[]),new H(a,b.edgeDefinitions,d[0],d[1],e,b._rev,b._id)},J=function(a){var b=n();return b.exists(a)},K=function(a,b,c){var d=!0;return c.forEach(function(c){if(c._key!==b){var e=c.edgeDefinitions;e&&e.forEach(function(b){var c=b.from,e=b.to,f=b.collection;(f===a||-1!==c.indexOf(a)||-1!==e.indexOf(a))&&(d=!1)});var f=c.orphanCollections;f&&-1!==f.indexOf(a)&&(d=!1)}}),d},L=function(a,b){var d,e=n();if(!e.exists(a)){var h=new f;throw h.errorNum=c.errors.ERROR_GRAPH_NOT_FOUND.code,h.errorMessage=c.errors.ERROR_GRAPH_NOT_FOUND.message,h}if(b===!0){var i=e.document(a),j=i.edgeDefinitions;j.forEach(function(a){var b=a.from,c=a.to,e=a.collection;d=n().toArray(),K(e,i._key,d)&&g._drop(e),b.forEach(function(a){K(a,i._key,d)&&g._drop(a)}),c.forEach(function(a){K(a,i._key,d)&&g._drop(a)})}),d=n().toArray(),i.orphanCollections||(i.orphanCollections=[]),i.orphanCollections.forEach(function(a){if(K(a,i._key,d))try{g._drop(a)}catch(b){}})}return e.remove(a),!0};H.prototype._edgeCollections=function(){return i.values(this.__edgeCollections)},H.prototype._vertexCollections=function(){var a=[];return i.each(this.__orphanCollections,function(b){a.push(g[b])}),i.union(i.values(this.__vertexCollections),a)},H.prototype._EDGES=function(a){var b;if(-1===a.indexOf("/"))throw b=new f,b.errorNum=c.errors.ERROR_GRAPH_NOT_FOUND.code,b.errorMessage=c.errors.ERROR_GRAPH_NOT_FOUND.message+": "+a,b;var d,e=[];for(d in this.__edgeCollections)this.__edgeCollections.hasOwnProperty(d)&&(e=this.__useBuiltIn?e.concat(this.__edgeCollections[d].EDGES(a)):e.concat(this.__edgeCollections[d].edges(a)));return e},H.prototype._INEDGES=function(a){var b;if(-1===a.indexOf("/"))throw b=new f,b.errorNum=c.errors.ERROR_GRAPH_NOT_FOUND.code,b.errorMessage=c.errors.ERROR_GRAPH_NOT_FOUND.message+": "+a,b;var d,e=[];for(d in this.__edgeCollections)this.__edgeCollections.hasOwnProperty(d)&&(e=this.__useBuiltIn?e.concat(this.__edgeCollections[d].INEDGES(a)):e.concat(this.__edgeCollections[d].inEdges(a)));return e},H.prototype._OUTEDGES=function(a){var b;if(-1===a.indexOf("/"))throw b=new f,b.errorNum=c.errors.ERROR_GRAPH_NOT_FOUND.code,b.errorMessage=c.errors.ERROR_GRAPH_NOT_FOUND.message+": "+a,b;var d,e=[];for(d in this.__edgeCollections)this.__edgeCollections.hasOwnProperty(d)&&(e=this.__useBuiltIn?e.concat(this.__edgeCollections[d].OUTEDGES(a)):e.concat(this.__edgeCollections[d].outEdges(a)));return e},H.prototype._edges=function(a){var b=new t(this);return b.outEdges(a)},H.prototype._vertices=function(a){var b=new t(this);return b.vertices(a)},H.prototype._fromVertex=function(a){if("string"!=typeof a||-1===a.indexOf("/")){var b=new f;throw b.errorNum=c.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.code,b.errorMessage=c.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.message,b}var d=this._getEdgeCollectionByName(a.split("/")[0]),e=d.document(a);if(e){var g=e._from,h=this._getVertexCollectionByName(g.split("/")[0]);return h.document(g)}},H.prototype._toVertex=function(a){if("string"!=typeof a||-1===a.indexOf("/")){var b=new f;throw b.errorNum=c.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.code,b.errorMessage=c.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.message,b}var d=this._getEdgeCollectionByName(a.split("/")[0]),e=d.document(a);if(e){var g=e._to,h=this._getVertexCollectionByName(g.split("/")[0]);return h.document(g)}},H.prototype._getEdgeCollectionByName=function(a){if(this.__edgeCollections[a])return this.__edgeCollections[a];var b=new f;throw b.errorNum=c.errors.ERROR_GRAPH_EDGE_COL_DOES_NOT_EXIST.code,b.errorMessage=c.errors.ERROR_GRAPH_EDGE_COL_DOES_NOT_EXIST.message+": "+a,b},H.prototype._getVertexCollectionByName=function(a){if(this.__vertexCollections[a])return this.__vertexCollections[a];var b=new f;throw b.errorNum=c.errors.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.code,b.errorMessage=c.errors.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.message+": "+a,b},H.prototype._neighbors=function(a,b){var c=new t(this);return b||(b={}),c.vertices(a).neighbors(b.neighborExamples,b).toArray()},H.prototype._commonNeighbors=function(a,b,c,d){var e=q(a),f=q(b),h="FOR e IN GRAPH_COMMON_NEIGHBORS(@graphName,@ex1,@ex2,@options1,@options2) RETURN e";c=c||{},d=d||{};var i={graphName:this.__name,options1:c,options2:d,ex1:e,ex2:f};return g._query(h,i,{count:!0}).toArray()},H.prototype._countCommonNeighbors=function(a,b,c,d){var e=q(a),f=q(b),h="FOR e IN GRAPH_COMMON_NEIGHBORS(@graphName,@ex1,@ex2,@options1,@options2) RETURN [e.left, e.right, LENGTH(e.neighbors)]";c=c||{},d=d||{};var i={graphName:this.__name,options1:c,options2:d,ex1:e,ex2:f},j=g._query(h,i,{count:!0}).toArray(),k={},l={},m=[];return j.forEach(function(a){k[a[0]]||(k[a[0]]=[]),l={},l[a[1]]=a[2],k[a[0]].push(l)}),Object.keys(k).forEach(function(a){l={},l[a]=k[a],m.push(l)}),m},H.prototype._commonProperties=function(a,b,c){var d=q(a),e=q(b),f="FOR e IN GRAPH_COMMON_PROPERTIES(@graphName,@ex1,@ex2,@options) SORT ATTRIBUTES(e)[0] RETURN e";c=c||{};var h={graphName:this.__name,options:c,ex1:d,ex2:e};return g._query(f,h,{count:!0}).toArray()},H.prototype._countCommonProperties=function(a,b,c){var d=q(a),e=q(b),f="FOR e IN GRAPH_COMMON_PROPERTIES(@graphName,@ex1,@ex2,@options) FOR a in ATTRIBUTES(e) SORT ATTRIBUTES(e)[0] RETURN [ ATTRIBUTES(e)[0], LENGTH(e[a]) ]";c=c||{};var h={graphName:this.__name,options:c,ex1:d,ex2:e},i=g._query(f,h,{count:!0}).toArray(),j=[];return i.forEach(function(a){var b={};b[a[0]]=a[1],j.push(b)}),j},H.prototype._paths=function(a){var b="RETURN GRAPH_PATHS(@graphName,@options)";a=a||{};var c={graphName:this.__name,options:a},d=g._query(b,c).toArray();return d},H.prototype._shortestPath=function(a,b,c){var d=q(a),e=q(b),f="RETURN GRAPH_SHORTEST_PATH(@graphName,@ex1,@ex2,@options)";c=c||{};var h={graphName:this.__name,options:c,ex1:d,ex2:e},i=g._query(f,h).toArray();return i},H.prototype._distanceTo=function(a,b,c){var d=q(a),e=q(b),f="RETURN GRAPH_DISTANCE_TO(@graphName,@ex1,@ex2,@options)";c=c||{};var h={graphName:this.__name,options:c,ex1:d,ex2:e},i=g._query(f,h).toArray();return i[0]},H.prototype._absoluteEccentricity=function(a,b){var c=q(a),d="RETURN GRAPH_ABSOLUTE_ECCENTRICITY(@graphName,@ex1,@options)";b=b||{};var e={graphName:this.__name,options:b,ex1:c},f=g._query(d,e).toArray();return 1===f.length?f[0]:f},H.prototype._eccentricity=function(a){var b="RETURN GRAPH_ECCENTRICITY(@graphName,@options)";a=a||{};var c={graphName:this.__name,options:a},d=g._query(b,c).toArray();return 1===d.length?d[0]:d},H.prototype._absoluteCloseness=function(a,b){var c=q(a),d="RETURN GRAPH_ABSOLUTE_CLOSENESS(@graphName,@ex1,@options)";b=b||{};var e={graphName:this.__name,options:b,ex1:c},f=g._query(d,e).toArray();return 1===f.length?f[0]:f},H.prototype._closeness=function(a){var b="RETURN GRAPH_CLOSENESS(@graphName,@options)";a=a||{};var c={graphName:this.__name,options:a},d=g._query(b,c).toArray();return 1===d.length?d[0]:d},H.prototype._absoluteBetweenness=function(a,b){var c="RETURN GRAPH_ABSOLUTE_BETWEENNESS(@graphName,@example,@options)";b=b||{};var d={example:a,graphName:this.__name,options:b},e=g._query(c,d).toArray();return 1===e.length?e[0]:e},H.prototype._betweenness=function(a){var b="RETURN GRAPH_BETWEENNESS(@graphName,@options)";a=a||{};var c={graphName:this.__name,options:a},d=g._query(b,c).toArray();return 1===d.length?d[0]:d},H.prototype._radius=function(a){var b="RETURN GRAPH_RADIUS(@graphName,@options)";a=a||{};var c={graphName:this.__name,options:a},d=g._query(b,c).toArray();return 1===d.length?d[0]:d},H.prototype._diameter=function(a){var b="RETURN GRAPH_DIAMETER(@graphName,@options)";a=a||{};var c={graphName:this.__name,options:a},d=g._query(b,c).toArray();return 1===d.length?d[0]:d},H.prototype._extendEdgeDefinitions=function(a){a=A(a);var b,d=this,e=a.collection;if(void 0!==this.__edgeCollections[e])throw b=new f,b.errorNum=c.errors.ERROR_GRAPH_COLLECTION_MULTI_USE.code,b.errorMessage=c.errors.ERROR_GRAPH_COLLECTION_MULTI_USE.message,b;g._graphs.toArray().forEach(function(d){var g=d.edgeDefinitions;g.forEach(function(d){var g=d.collection;if(g===e&&JSON.stringify(d)!==JSON.stringify(a))throw b=new f,b.errorNum=c.errors.ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS.code,b.errorMessage=g+" "+c.errors.ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS.message,b})}),m([a]),this.__edgeDefinitions.push(a),g._graphs.update(this.__name,{edgeDefinitions:this.__edgeDefinitions}),this.__edgeCollections[a.collection]=g[a.collection],a.from.forEach(function(a){d[a]=g[a];var b=d.__orphanCollections.indexOf(a);-1!==b&&d.__orphanCollections.splice(b,1),void 0===d.__vertexCollections[a]&&(d.__vertexCollections[a]=g[a])}),a.to.forEach(function(a){d[a]=g[a];var b=d.__orphanCollections.indexOf(a);-1!==b&&d.__orphanCollections.splice(b,1),void 0===d.__vertexCollections[a]&&(d.__vertexCollections[a]=g[a])}),G(this)};var M=function(a,b,c,d,e){var f=[],h=I(a._key),j=a.edgeDefinitions,k=!1;j.forEach(function(c,d){c.collection===b.collection?(k=!0,j[d].from=b.from,j[d].to=b.to,g._graphs.update(a._key,{edgeDefinitions:j}),a._key===e.__name&&(e.__edgeDefinitions[d].from=b.from,e.__edgeDefinitions[d].to=b.to)):(f=i.union(f,c.from),f=i.union(f,c.to))}),k&&(a._key===e.__name?(c.forEach(function(a){void 0===e.__vertexCollections[a]&&(e.__vertexCollections[a]=g[a]);try{e._removeVertexCollection(a,!1)}catch(b){}}),d.forEach(function(a){-1===f.indexOf(a)&&(delete e.__vertexCollections[a],e._addVertexCollection(a))})):(c.forEach(function(a){try{h._removeVertexCollection(a,!1)}catch(b){}}),d.forEach(function(a){-1===f.indexOf(a)&&(delete h.__vertexCollections[a],h._addVertexCollection(a))})))};H.prototype._editEdgeDefinitions=function(a){a=A(a);var b=this;if(void 0===this.__edgeCollections[a.collection]){var d=new f;throw d.errorNum=c.errors.ERROR_GRAPH_EDGE_COLLECTION_NOT_USED.code,d.errorMessage=c.errors.ERROR_GRAPH_EDGE_COLLECTION_NOT_USED.message,d}m([a]);var e,g=[];this.__edgeDefinitions.forEach(function(b){a.collection===b.collection&&(e=b)});var h=i.union(e.from,e.to),j=i.union(a.from,a.to);h.forEach(function(a){-1===j.indexOf(a)&&g.push(a)});var k=n().toArray();k.forEach(function(c){M(c,a,j,g,b)}),G(this)},H.prototype._deleteEdgeDefinition=function(a,b){if(void 0===this.__edgeCollections[a]){var d=new f;throw d.errorNum=c.errors.ERROR_GRAPH_EDGE_COLLECTION_NOT_USED.code,d.errorMessage=c.errors.ERROR_GRAPH_EDGE_COLLECTION_NOT_USED.message,d}var e,h=this.__edgeDefinitions,j=this,k=[],l=[];h.forEach(function(b,c){b.collection===a?(e=c,l=b.from,l=i.union(l,b.to)):(k=i.union(k,b.from),k=i.union(k,b.to))}),this.__edgeDefinitions.splice(e,1),l.forEach(function(a){-1===k.indexOf(a)&&j.__orphanCollections.push(a)}),G(this),g._graphs.update(this.__name,{orphanCollections:this.__orphanCollections,edgeDefinitions:this.__edgeDefinitions}),b&&g._drop(a)},H.prototype._addVertexCollection=function(a,b){var d,e=g._collection(a);if(null===e){if(b===!1)throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.code,d.errorMessage=a+c.errors.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.message,d;g._create(a)}else if(2!==e.type())throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_WRONG_COLLECTION_TYPE_VERTEX.code,d.errorMessage=c.errors.ERROR_GRAPH_WRONG_COLLECTION_TYPE_VERTEX.message,d;if(void 0!==this.__vertexCollections[a])throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_COLLECTION_USED_IN_EDGE_DEF.code,d.errorMessage=c.errors.ERROR_GRAPH_COLLECTION_USED_IN_EDGE_DEF.message,d;if(i.contains(this.__orphanCollections,a))throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_COLLECTION_USED_IN_ORPHANS.code,d.errorMessage=c.errors.ERROR_GRAPH_COLLECTION_USED_IN_ORPHANS.message,d;this.__orphanCollections.push(a),G(this),g._graphs.update(this.__name,{orphanCollections:this.__orphanCollections})},H.prototype._orphanCollections=function(){return this.__orphanCollections},H.prototype._removeVertexCollection=function(a,b){var d;if(null===g._collection(a))throw d=new f, +var b,c=this._database;for(b in c)if(c.hasOwnProperty(b)){var e=c[b];e instanceof d&&e.name()===this.name()&&delete c[b]}},d.prototype.truncate=function(){var a=this._database._connection.PUT(this._baseurl("truncate"),"");f.checkRequestResult(a),this._status=null},d.prototype.load=function(a){var b={count:!0};void 0!==a&&(b.count=a);var c=this._database._connection.PUT(this._baseurl("load"),JSON.stringify(b));f.checkRequestResult(c),this._status=null},d.prototype.unload=function(){var a=this._database._connection.PUT(this._baseurl("unload"),"");f.checkRequestResult(a),this._status=null},d.prototype.rename=function(a){var b={name:a},c=this._database._connection.PUT(this._baseurl("rename"),JSON.stringify(b));f.checkRequestResult(c),delete this._database[this._name],this._database[a]=this,this._status=null,this._name=null},d.prototype.refresh=function(){var a=this._database._connection.GET(this._database._collectionurl(this._id)+"?useId=true");f.checkRequestResult(a),this._name=a.name,this._status=a.status,this._type=a.type},d.prototype.getIndexes=function(a){var b=this._database._connection.GET(this._indexurl()+"&withStats="+(a||!1));return f.checkRequestResult(b),b.indexes},d.prototype.index=function(a){a.hasOwnProperty("id")&&(a=a.id);var b=this._database._connection.GET(this._database._indexurl(a,this.name()));return f.checkRequestResult(b),b},d.prototype.dropIndex=function(a){a.hasOwnProperty("id")&&(a=a.id);var b=this._database._connection.DELETE(this._database._indexurl(a,this.name()));return null!==b&&b.error===!0&&b.errorNum===e.errors.ERROR_ARANGO_INDEX_NOT_FOUND.code?!1:(f.checkRequestResult(b),!0)},d.prototype.ensureCapConstraint=function(a,b){var c={type:"cap",size:a||void 0,byteSize:b||void 0},d=this._database._connection.POST(this._indexurl(),JSON.stringify(c));return f.checkRequestResult(d),d},d.prototype.ensureUniqueSkiplist=function(){var a=c({type:"skiplist",unique:!0},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureSkiplist=function(){var a=c({type:"skiplist",unique:!1},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureFulltextIndex=function(a,b){var c={type:"fulltext",minLength:b||void 0,fields:[a]},d=this._database._connection.POST(this._indexurl(),JSON.stringify(c));return f.checkRequestResult(d),d},d.prototype.ensureUniqueConstraint=function(){var a=c({type:"hash",unique:!0},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureHashIndex=function(){var a=c({type:"hash",unique:!1},arguments),b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.ensureGeoIndex=function(a,b){var c;if("string"!=typeof a)throw"usage: ensureGeoIndex(, ) or ensureGeoIndex([, ])";c="boolean"==typeof b?{type:"geo",fields:[a],geoJson:b}:void 0===b?{type:"geo",fields:[a],geoJson:!1}:{type:"geo",fields:[a,b],geoJson:!1};var d=this._database._connection.POST(this._indexurl(),JSON.stringify(c));return f.checkRequestResult(d),d},d.prototype.ensureGeoConstraint=function(a,b){return this.ensureGeoIndex(a,b)},d.prototype.ensureIndex=function(a){if("object"!=typeof a||Array.isArray(a))throw"usage: ensureIndex()";var b=this._database._connection.POST(this._indexurl(),JSON.stringify(a));return f.checkRequestResult(b),b},d.prototype.count=function(){var a=this._database._connection.GET(this._baseurl("count"));return f.checkRequestResult(a),a.count},d.prototype.document=function(a){var b,c=null;if(a.hasOwnProperty("_id")&&(a.hasOwnProperty("_rev")&&(c=a._rev),a=a._id),b=null===c?this._database._connection.GET(this._documenturl(a)):this._database._connection.GET(this._documenturl(a),{"if-match":JSON.stringify(c)}),null!==b&&b.error===!0&&b.errorNum===e.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code)throw new g(b);return f.checkRequestResult(b),b},d.prototype.exists=function(a){var b,c=null;if(void 0===a||null===a)throw new g({errorNum:e.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.code,errorMessage:e.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.message});return a.hasOwnProperty("_id")&&(a.hasOwnProperty("_rev")&&(c=a._rev),a=a._id),b=null===c?this._database._connection.HEAD(this._documenturl(a)):this._database._connection.HEAD(this._documenturl(a),{"if-match":JSON.stringify(c)}),null===b||b.error!==!0||b.errorNum!==e.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code&&b.errorNum!==e.errors.ERROR_HTTP_NOT_FOUND.code&&b.errorNum!==e.errors.ERROR_HTTP_PRECONDITION_FAILED.code?(f.checkRequestResult(b),!0):!1},d.prototype.any=function(){var a=this._database._connection.PUT(this._prefixurl("/_api/simple/any"),JSON.stringify({collection:this._name}));return f.checkRequestResult(a),a.document},d.prototype.firstExample=function(a){var b,c;if(1===arguments.length)b=a;else for(b={},c=0;c) get collection by identifier/name \n _create(, ) creates a new collection \n _createEdgeCollection() creates a new edge collection \n _drop() delete a collection \n \nDocument Functions: \n _document() get document by handle (_id) \n _replace(, , ) overwrite document \n _update(, , , partially update document \n ) \n _remove() delete document \n _exists() checks whether a document exists \n _truncate() delete all documents \n \nDatabase Management Functions: \n _createDatabase() creates a new database \n _dropDatabase() drops an existing database \n _useDatabase() switches into an existing database\n _drop() delete a collection \n _name() name of the current database \n \nQuery / Transaction Functions: \n _executeTransaction() execute transaction \n _query() execute AQL query \n _createStatement() create and return AQL query ";c.prototype._help=function(){e.print(i)},c.prototype.toString=function(){return'[object ArangoDatabase "'+this._name()+'"]'},c.prototype._collections=function(){var a=this._connection.GET(this._collectionurl());if(f.checkRequestResult(a),void 0!==a.collections){var b,c=a.collections,d=[];for(b=0;b)"});if(!a.collections||"object"!=typeof a.collections)throw new g({error:!0,code:e.errors.ERROR_HTTP_BAD_PARAMETER.code,errorNum:e.errors.ERROR_BAD_PARAMETER.code,errorMessage:"missing/invalid collections definition for transaction"});if(!a.action||"string"!=typeof a.action&&"function"!=typeof a.action)throw new g({error:!0,code:e.errors.ERROR_HTTP_BAD_PARAMETER.code,errorNum:e.errors.ERROR_BAD_PARAMETER.code,errorMessage:"missing/invalid action definition for transaction"});"function"==typeof a.action&&(a.action=String(a.action));var b=this._connection.POST("/_api/transaction",JSON.stringify(a));if(null!==b&&b.error===!0)throw new g(b);return f.checkRequestResult(b),b.result}}),module.define("@arangodb/arango-query-cursor",function(a,b){function c(a,b){this._database=a,this._dbName=a._name(),this.data=b,this._hasNext=!1,this._hasMore=!1,this._pos=0,this._count=0,this._total=0,void 0!==b.result&&(this._count=b.result.length,this._pos0){if(a)d.print(b);else{var f=d.startCaptureMode();d.print(b),e+="\n\n"+d.stopCaptureMode(f)}this.hasNext()&&(e+="\ntype 'more' to show more documents\n",more=this)}return a||(d.print(e),e=""),e},c.prototype.toArray=function(){for(var a=[];this.hasNext();)a.push(this.next());return a};var f=e.createHelpHeadline("ArangoQueryCursor help")+'ArangoQueryCursor constructor: \n > cursor = stmt.execute() \nFunctions: \n hasNext() returns true if there are \n more results to fetch \n next() returns the next document \n toArray() returns all data from the cursor\n _help() this help \nAttributes: \n _database database object \nExample: \n > stmt = db._createStatement({ "query": "FOR c IN coll RETURN c" })\n > cursor = stmt.execute() \n > documents = cursor.toArray() \n > cursor = stmt.execute() \n > while (cursor.hasNext()) { print(cursor.next()) } ';c.prototype._help=function(){d.print(f)},c.prototype.hasNext=function(){return this._hasNext},c.prototype.next=function(){if(!this._hasNext)throw"No more results";var a=this.data.result[this._pos];if(this._pos++,this._pos===this._count&&(this._hasNext=!1,this._pos=0,this._hasMore&&this.data.id)){this._hasMore=!1;var b=this._database._connection.PUT(this._baseurl(),"");e.checkRequestResult(b),this.data=b,this._count=b.result.length,this._pos0&&(this._batchSize=b)},c.prototype.setOptions=function(a){this._options=a},c.prototype.setQuery=function(a){this._query=a&&"function"==typeof a.toAQL?a.toAQL():a},c.prototype.parse=function(){throw"cannot call abstract method parse()"},c.prototype.explain=function(){throw"cannot call abstract method explain()"},c.prototype.execute=function(){throw"cannot call abstract method execute()"},a.ArangoStatement=c}),module.define("@arangodb/arango-statement",function(a,b){var c=require("internal"),d=require("@arangodb/arangosh"),e=require("@arangodb/arango-statement-common").ArangoStatement,f=require("@arangodb/arango-query-cursor").ArangoQueryCursor;e.prototype.toString=function(){return d.getIdString(this,"ArangoStatement")};var g=d.createHelpHeadline("ArangoStatement help")+'Create an AQL query: \n > stmt = new ArangoStatement(db, { "query": "FOR..." }) \n > stmt = db._createStatement({ "query": "FOR..." }) \nSet query options: \n > stmt.setBatchSize() set the max. number of results \n to be transferred per roundtrip \n > stmt.setCount() set count flag (return number of\n results in "count" attribute) \nGet query options: \n > stmt.setBatchSize() return the max. number of results\n to be transferred per roundtrip \n > stmt.getCount() return count flag (return number\n of results in "count" attribute)\n > stmt.getQuery() return query string \n results in "count" attribute) \nBind parameters to a query: \n > stmt.bind(, ) bind single variable \n > stmt.bind() bind multiple variables \nExecute query: \n > cursor = stmt.execute() returns a cursor \nGet all results in an array: \n > docs = cursor.toArray() \nOr loop over the result set: \n > while (cursor.hasNext()) { print(cursor.next()) } ';e.prototype._help=function(){c.print(g)},e.prototype.parse=function(){var a={query:this._query},b=this._database._connection.POST("/_api/query",JSON.stringify(a));d.checkRequestResult(b);var c={bindVars:b.bindVars,collections:b.collections, +ast:b.ast};return c},e.prototype.explain=function(a){var b=this._options||{};"object"==typeof b&&"object"==typeof a&&Object.keys(a).forEach(function(c){b[c]=a[c]});var c={query:this._query,bindVars:this._bindVars,options:b},e=this._database._connection.POST("/_api/explain",JSON.stringify(c));return d.checkRequestResult(e),b&&b.allPlans?{plans:e.plans,warnings:e.warnings,stats:e.stats}:{plan:e.plan,warnings:e.warnings,stats:e.stats}},e.prototype.execute=function(){var a={query:this._query,count:this._doCount,bindVars:this._bindVars};this._batchSize&&(a.batchSize=this._batchSize),this._options&&(a.options=this._options),void 0!==this._cache&&(a.cache=this._cache);var b=this._database._connection.POST("/_api/cursor",JSON.stringify(a));return d.checkRequestResult(b),new f(this._database,b)},a.ArangoStatement=e}),module.define("@arangodb/arangosh",function(a,b){var c=require("internal");a.getIdString=function(a,b){var c="[object "+b;return a._id?c+=":"+a._id:a.data&&a.data._id&&(c+=":"+a.data._id),c+="]"},a.createHelpHeadline=function(a){var b,c="",d=Math.abs(78-a.length)/2;for(b=0;d>b;++b)c+="-";return"\n"+c+" "+a+" "+c+"\n"};var d=require("@arangodb"),e=d.ArangoError;a.checkRequestResult=function(a){if(void 0===a)throw new e({error:!0,code:500,errorNum:d.ERROR_INTERNAL,errorMessage:"Unknown error. Request result is empty"});if(a.hasOwnProperty("error")){if(a.error){if(a.errorNum===d.ERROR_TYPE_ERROR)throw new TypeError(a.errorMessage);throw new e(a)}delete a.error}return a},a.HELP=a.createHelpHeadline("Help")+"Predefined objects: \n arango: ArangoConnection \n db: ArangoDatabase \n fm: FoxxManager \nExamples: \n > db._collections() list all collections \n > db._create() create a new collection \n > db._drop() drop a collection \n > db..toArray() list all documents \n > id = db..save({ ... }) save a document \n > db..remove(<_id>) delete a document \n > db..document(<_id>) retrieve a document \n > db..replace(<_id>, {...}) overwrite a document \n > db..update(<_id>, {...}) partially update a document\n > db..exists(<_id>) check if document exists \n > db._query().toArray() execute an AQL query \n > db._useDatabase() switch database \n > db._createDatabase() create a new database \n > db._databases() list existing databases \n > help show help pages \n > exit \nNote: collection names and statuses may be cached in arangosh. \nTo refresh the list of collections and their statuses, issue: \n > db._collections(); \n \n"+(c.printBrowser?"To cancel the current prompt, press CTRL + z. \n \nPlease note that all variables defined with the var keyword will \ndisappear when the command is finished. To introduce variables that\nare persisting until the next command, omit the var keyword. \n\nType 'tutorial' for a tutorial or 'help' to see common examples":"To cancel the current prompt, press CTRL + d. \n"),a.helpExtended=a.createHelpHeadline("More help")+"Pager: \n > stop_pager() stop the pager output \n > start_pager() start the pager \nPretty printing: \n > stop_pretty_print() stop pretty printing \n > start_pretty_print() start pretty printing \nColor output: \n > stop_color_print() stop color printing \n > start_color_print() start color printing \nPrint function: \n > print(x) std. print function \n > print_plain(x) print without prettifying \n and without colors \n > clear() clear screen "}),module.define("@arangodb/general-graph",function(a,b){var c=require("@arangodb"),d=require("internal"),e=c.ArangoCollection,f=c.ArangoError,g=c.db,h=c.errors,i=require("underscore"),j=function(a){return"string"==typeof a?[a]:i.clone(a)},k=function(a){return a?Array.isArray(a)&&0===a.length?!1:"string"==typeof a||Array.isArray(a)?!0:!1:!1},l=function(a,b,d){var h=g._collection(a),i=!1;if(null!==h||d){if(!(h instanceof e)){var j=new f;throw j.errorNum=c.errors.ERROR_GRAPH_NOT_AN_ARANGO_COLLECTION.code,j.errorMessage=a+c.errors.ERROR_GRAPH_NOT_AN_ARANGO_COLLECTION.message,j}}else h=b===e.TYPE_DOCUMENT?g._create(a):g._createEdgeCollection(a),i=!0;return i},m=function(a,b){var d={},h={};return a.forEach(function(a){if(!(a.hasOwnProperty("collection")&&a.hasOwnProperty("from")&&a.hasOwnProperty("to")&&Array.isArray(a.from)&&Array.isArray(a.to))){var i=new f;throw i.errorNum=c.errors.ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION.code,i.errorMessage=c.errors.ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION.message,i}a.from.concat(a.to).forEach(function(a){l(a,e.TYPE_DOCUMENT,b),d[a]=g[a]}),l(a.collection,e.TYPE_EDGE,b),h[a.collection]=g[a.collection]}),[d,h]},n=function(){var a=g._graphs;if(null===a||void 0===a){var b=new f;throw b.errorNum=c.errors.ERROR_GRAPH_NO_GRAPH_COLLECTION.code,b.errorMessage=c.errors.ERROR_GRAPH_NO_GRAPH_COLLECTION.message,b}return a},o=function(a){return i.map(a,function(a){var b=a.collection;return b+=": [",b+=a.from.join(", "),b+="] -> [",b+=a.to.join(", "),b+="]"})},p=function(a){var b={};return i.each(i.functions(a),function(c){b[c]=function(){return a[c].apply(a,arguments)}}),b},q=function(a){if(void 0===a)return{};if("string"==typeof a)return{_id:a};if("object"==typeof a)return Array.isArray(a)?i.map(a,function(a){return"string"==typeof a?{_id:a}:a}):a;var b=new f;throw b.errorNum=c.errors.ERROR_GRAPH_INVALID_EXAMPLE_ARRAY_OBJECT_STRING.code,b.errorMessage=c.errors.ERROR_GRAPH_INVALID_EXAMPLE_ARRAY_OBJECT_STRING.message,b},r=function(a,b,d){var e=[],g=i.map(a,function(a){return a.name()});if(i.each(b,function(a){i.contains(g,a)||e.push(a)}),e.length>0){var h=new f;throw h.errorNum=c.errors.ERROR_BAD_PARAMETER.code,h.errorMessage=d+": "+e.join(" and ")+" are not known to the graph",h}return!0},s=function(a,b){this.query=a,b&&(this.type=b)};s.prototype.printQuery=function(){return this.query},s.prototype.isPathQuery=function(){return"path"===this.type},s.prototype.isPathVerticesQuery=function(){return"pathVertices"===this.type},s.prototype.isPathEdgesQuery=function(){return"pathEdges"===this.type},s.prototype.isEdgeQuery=function(){return"edge"===this.type},s.prototype.isVertexQuery=function(){return"vertex"===this.type},s.prototype.isNeighborQuery=function(){return"neighbor"===this.type},s.prototype.allowsRestrict=function(){return this.isEdgeQuery()||this.isVertexQuery()||this.isNeighborQuery()};var t=function(a){this.stack=[],this.callStack=[],this.bindVars={graphName:a.__name},this.graph=a,this.cursor=null,this.lastVar="",this._path=[],this._pathVertices=[],this._pathEdges=[],this._getPath=!1};t.prototype._addToPrint=function(a){var b=Array.prototype.slice.call(arguments);b.shift();var c={};c.name=a,b.length>0&&void 0!==b[0]?c.params=b:c.params=[],this.callStack.push(c)},t.prototype._PRINT=function(a){a.output="[ GraphAQL ",a.output+=this.graph.__name,i.each(this.callStack,function(b){a.prettyPrint&&(a.output+="\n"),a.output+=".",a.output+=b.name,a.output+="(";var c=0;for(c=0;c0&&(a.output+=", "),d.printRecursive(b.params[c],a);a.output+=")"}),a.output+=" ] "},t.prototype._clearCursor=function(){this.cursor&&(this.cursor.dispose(),this.cursor=null)},t.prototype._createCursor=function(){this.cursor||(this.cursor=this.execute())},t.prototype._edges=function(a,b){this._clearCursor(),this.options=b||{};var c=q(a),d="edges_"+this.stack.length,e="FOR "+d+" IN GRAPH_EDGES(@graphName";e+=this.getLastVar()?","+this.getLastVar():",{}",e+=",@options_"+this.stack.length+")",Array.isArray(c)||(c=[c]),this.options.edgeExamples=c,this.options.includeData=!0,this.bindVars["options_"+this.stack.length]=this.options;var f=new s(e,"edge");return this.stack.push(f),this.lastVar=d,this._path.push(d),this._pathEdges.push(d),this},t.prototype.edges=function(a){return this._addToPrint("edges",a),this._edges(a,{direction:"any"})},t.prototype.outEdges=function(a){return this._addToPrint("outEdges",a),this._edges(a,{direction:"outbound"})},t.prototype.inEdges=function(a){return this._addToPrint("inEdges",a),this._edges(a,{direction:"inbound"})},t.prototype._vertices=function(a,b,c){this._clearCursor(),this.options=b||{};var d=q(a),e="vertices_"+this.stack.length,f="FOR "+e+" IN GRAPH_VERTICES(@graphName,";if(void 0!==c)if(Array.isArray(c)){var g;for(f+="[",g=0;g0&&(f+=","),f+="MERGE(@vertexExample_"+this.stack.length+","+c[g]+")";f+="]"}else f+="MERGE(@vertexExample_"+this.stack.length+","+c+")";else f+="@vertexExample_"+this.stack.length;f+=",@options_"+this.stack.length+")",this.bindVars["vertexExample_"+this.stack.length]=d,this.bindVars["options_"+this.stack.length]=this.options;var h=new s(f,"vertex");return this.stack.push(h),this.lastVar=e,this._path.push(e),this._pathVertices.push(e),this},t.prototype.vertices=function(a){if(this._addToPrint("vertices",a),!this.getLastVar())return this._vertices(a);var b=this.getLastVar();return this._vertices(a,void 0,["{'_id': "+b+"._from}","{'_id': "+b+"._to}"])},t.prototype.fromVertices=function(a){if(this._addToPrint("fromVertices",a),!this.getLastVar())return this._vertices(a);var b=this.getLastVar();return this._vertices(a,void 0,"{'_id': "+b+"._from}")},t.prototype.toVertices=function(a){if(this._addToPrint("toVertices",a),!this.getLastVar())return this._vertices(a);var b=this.getLastVar();return this._vertices(a,void 0,"{'_id': "+b+"._to}")},t.prototype.getLastVar=function(){return""===this.lastVar?!1:this.lastVar},t.prototype.path=function(){this._clearCursor();var a=new s("","path");return this.stack.push(a),this},t.prototype.pathVertices=function(){this._clearCursor();var a=new s("","pathVertices");return this.stack.push(a),this},t.prototype.pathEdges=function(){this._clearCursor();var a=new s("","pathEdges");return this.stack.push(a),this},t.prototype.neighbors=function(a,b){this._addToPrint("neighbors",a,b);var c,d=q(a),e="neighbors_"+this.stack.length,f="FOR "+e+" IN GRAPH_NEIGHBORS(@graphName,"+this.getLastVar()+",@options_"+this.stack.length+")";c=b?i.clone(b):{},c.neighborExamples=d,c.includeData=!0,this.bindVars["options_"+this.stack.length]=c;var g=new s(f,"neighbor");return this.stack.push(g),this.lastVar=e,this._path.push(e),this._pathVertices.push(e),this},t.prototype._getLastRestrictableStatementInfo=function(){for(var a=this.stack.length-1;!this.stack[a].allowsRestrict();)a--;return{statement:this.stack[a],options:this.bindVars["options_"+a]}},t.prototype.restrict=function(a){var b=j(a);if(0===b.length)return this;this._addToPrint("restrict",a),this._clearCursor();var c,d=this._getLastRestrictableStatementInfo(),e=d.statement,f=d.options;return e.isEdgeQuery()?(r(this.graph._edgeCollections(),b,"edge collections"),c=f.edgeCollectionRestriction||[],f.edgeCollectionRestriction=c.concat(a)):(e.isVertexQuery()||e.isNeighborQuery())&&(r(this.graph._vertexCollections(),b,"vertex collections"),c=f.vertexCollectionRestriction||[],f.vertexCollectionRestriction=c.concat(a)),this},t.prototype.filter=function(a){this._addToPrint("filter",a),this._clearCursor();var b=[];if("[object Array]"!==Object.prototype.toString.call(a)){if("[object Object]"!==Object.prototype.toString.call(a)){var d=new f;throw d.errorNum=c.errors.ERROR_GRAPH_INVALID_EXAMPLE_ARRAY_OBJECT.code,d.errorMessage=c.errors.ERROR_GRAPH_INVALID_EXAMPLE_ARRAY_OBJECT.message,d}b=[a]}else b=a;var e="FILTER MATCHES("+this.getLastVar()+","+JSON.stringify(b)+")";return this.stack.push(new s(e)),this},t.prototype.printQuery=function(){return this.stack.map(function(a){return a.printQuery()}).join(" ")},t.prototype.execute=function(){this._clearCursor();var a=this.printQuery(),b=this.bindVars;return a+=this.stack[this.stack.length-1].isPathQuery()?" RETURN ["+this._path+"]":this.stack[this.stack.length-1].isPathVerticesQuery()?" RETURN FLATTEN(["+this._pathVertices+"])":this.stack[this.stack.length-1].isPathEdgesQuery()?" RETURN FLATTEN(["+this._pathEdges+"])":" RETURN "+this.getLastVar(),g._query(a,b,{count:!0})},t.prototype.toArray=function(){return this._createCursor(),this.cursor.toArray()},t.prototype.count=function(){return this._createCursor(),this.cursor.count()},t.prototype.hasNext=function(){return this._createCursor(),this.cursor.hasNext()},t.prototype.next=function(){return this._createCursor(),this.cursor.next()};var u=function(a,b){var d;if(arguments.length<2)throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_INVALID_NUMBER_OF_ARGUMENTS.code,d.errorMessage=c.errors.ERROR_GRAPH_INVALID_NUMBER_OF_ARGUMENTS.message+"2",d;if("string"!=typeof a||""===a)throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_INVALID_PARAMETER.code,d.errorMessage=c.errors.ERROR_GRAPH_INVALID_PARAMETER.message+" arg1 must not be empty",d;if(!k(b))throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_INVALID_PARAMETER.code,d.errorMessage=c.errors.ERROR_GRAPH_INVALID_PARAMETER.message+" arg2 must not be empty",d;return{collection:a,from:j(b),to:j(b)}},v=function(a,b,d){var e;if(arguments.length<3)throw e=new f,e.errorNum=c.errors.ERROR_GRAPH_INVALID_NUMBER_OF_ARGUMENTS.code,e.errorMessage=c.errors.ERROR_GRAPH_INVALID_NUMBER_OF_ARGUMENTS.message+"3",e;if("string"!=typeof a||""===a)throw e=new f,e.errorNum=c.errors.ERROR_GRAPH_INVALID_PARAMETER.code,e.errorMessage=c.errors.ERROR_GRAPH_INVALID_PARAMETER.message+" arg1 must be non empty string",e;if(!k(b))throw e=new f,e.errorNum=c.errors.ERROR_GRAPH_INVALID_PARAMETER.code,e.errorMessage=c.errors.ERROR_GRAPH_INVALID_PARAMETER.message+" arg2 must be non empty string or array",e;if(!k(d))throw e=new f,e.errorNum=c.errors.ERROR_GRAPH_INVALID_PARAMETER.code,e.errorMessage=c.errors.ERROR_GRAPH_INVALID_PARAMETER.message+" arg3 must be non empty string or array",e;return{collection:a,from:j(b),to:j(d)}},w=function(){var a=n();return i.pluck(a.toArray(),"_key")},x=function(){return n().toArray()},y=function(){var a=[],b=arguments;return Object.keys(b).forEach(function(c){a.push(b[c])}),a},z=function(a){var b=arguments,c=0;Object.keys(b).forEach(function(d){c++,1!==c&&a.push(b[d])})},A=function(a){return a.from=a.from.sort(),a.to=a.to.sort(),a},B=function(a,b,d,g){Array.isArray(d)||(d=[]);var i,j,k,o=n(),p=!0;if(!a)throw i=new f,i.errorNum=c.errors.ERROR_GRAPH_CREATE_MISSING_NAME.code,i.errorMessage=c.errors.ERROR_GRAPH_CREATE_MISSING_NAME.message,i;if(b=b||[],!Array.isArray(b))throw i=new f,i.errorNum=c.errors.ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION.code,i.errorMessage=c.errors.ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION.message,i;var q=[],r={};b.forEach(function(a){var b=a.collection;if(-1!==q.indexOf(b))throw i=new f,i.errorNum=c.errors.ERROR_GRAPH_COLLECTION_MULTI_USE.code,i.errorMessage=c.errors.ERROR_GRAPH_COLLECTION_MULTI_USE.message,i;q.push(b),r[b]=a}),o.toArray().forEach(function(a){var b=a.edgeDefinitions;b.forEach(function(a){var b=a.collection;if(-1!==q.indexOf(b)&&JSON.stringify(a)!==JSON.stringify(r[b]))throw i=new f,i.errorNum=c.errors.ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS.code,i.errorMessage=b+" "+c.errors.ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS.message,i})});try{o.document(a)}catch(s){if(s.errorNum!==h.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code)throw s;p=!1}if(p)throw i=new f,i.errorNum=c.errors.ERROR_GRAPH_DUPLICATE.code,i.errorMessage=c.errors.ERROR_GRAPH_DUPLICATE.message,i;j=m(b,!1),d.forEach(function(a){l(a,e.TYPE_DOCUMENT)}),b.forEach(function(a,c){var d=A(a);b[c]=d}),d=d.sort();var t=o.save({orphanCollections:d,edgeDefinitions:b,_key:a},g);return k=new H(a,b,j[0],j[1],d,t._rev,t._id)},C=function(a,b,c){Object.defineProperty(a,b,{enumerable:!1,writable:!0}),a[b]=c},D=function N(a,b,c,d){d.__idsToRemove[c]=1,a.forEach(function(e){var f=e.edgeDefinitions;e.edgeDefinitions&&f.forEach(function(e){var f=e.from,h=e.to,i=e.collection;if(-1!==f.indexOf(b)||-1!==h.indexOf(b)){var j=g._collection(i).edges(c);j.forEach(function(b){d.__idsToRemove.hasOwnProperty(b._id)||(d.__collectionsToLock[i]=1,N(a,i,b._id,d))})}})})},E=function(a,b){i.each(b,function(b){var d=g._collection(b),e=p(d),h=e.save;e.save=function(d,e,g){if("string"!=typeof d||-1===d.indexOf("/")||"string"!=typeof e||-1===e.indexOf("/")){var j=new f;throw j.errorNum=c.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.code,j.errorMessage=c.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.message,j}return a.__edgeDefinitions.forEach(function(a){if(a.collection===b){var g=d.split("/")[0],h=e.split("/")[0];if(!i.contains(a.from,g)||!i.contains(a.to,h)){var j=new f;throw j.errorNum=c.errors.ERROR_GRAPH_INVALID_EDGE.code,j.errorMessage=c.errors.ERROR_GRAPH_INVALID_EDGE.message+" between "+d+" and "+e+".",j}}}),h(d,e,g)},e.remove=function(c,d){-1===c.indexOf("/")&&(c=b+"/"+c);var e=n().toArray(),f=c.split("/")[0];a.__collectionsToLock[f]=1,D(e,f,c,a);try{g._executeTransaction({collections:{write:Object.keys(a.__collectionsToLock)},embed:!0,action:function(a){var b=require("internal").db;a.ids.forEach(function(c){a.options?b._remove(c,a.options):b._remove(c)})},params:{ids:Object.keys(a.__idsToRemove),options:d}})}catch(h){throw a.__idsToRemove={},a.__collectionsToLock={},h}return a.__idsToRemove={},a.__collectionsToLock={},!0},a[b]=e})},F=function(a,b){i.each(b,function(b){var c=g._collection(b),d=p(c);d.remove=function(c,d){var e=n().toArray(),f=b;-1===c.indexOf("/")&&(c=b+"/"+c),a.__collectionsToLock[f]=1,e.forEach(function(b){var d=b.edgeDefinitions;b.edgeDefinitions&&d.forEach(function(b){var d=b.from,h=b.to,i=b.collection;if(-1!==d.indexOf(f)||-1!==h.indexOf(f)){var j=g._collection(i).edges(c);j.length>0&&(a.__collectionsToLock[i]=1,j.forEach(function(b){D(e,i,b._id,a)}))}})});try{g._executeTransaction({collections:{write:Object.keys(a.__collectionsToLock)},embed:!0,action:function(a){var b=require("internal").db;a.ids.forEach(function(c){a.options?b._remove(c,a.options):b._remove(c)}),a.options?b._remove(a.vertexId,a.options):b._remove(a.vertexId)},params:{ids:Object.keys(a.__idsToRemove),options:d,vertexId:c}})}catch(h){throw a.__idsToRemove={},a.__collectionsToLock={},h}return a.__idsToRemove={},a.__collectionsToLock={},!0},a[b]=d})},G=function(a){Object.keys(a).forEach(function(b){"_"!==b.substring(0,1)&&delete a[b]}),a.__edgeDefinitions.forEach(function(b){E(a,[b.collection]),F(a,b.from),F(a,b.to)}),F(a,a.__orphanCollections)},H=function(a,b,c,d,e,f,g){b.forEach(function(a,c){var d=A(a);b[c]=d}),e||(e=[]);var h="object"==typeof ArangoClusterComm;h&&require("@arangodb/cluster").isCoordinator()&&(h=!1);var i=this;C(this,"__useBuiltIn",h),C(this,"__name",a),C(this,"__vertexCollections",c),C(this,"__edgeCollections",d),C(this,"__edgeDefinitions",b),C(this,"__idsToRemove",{}),C(this,"__collectionsToLock",{}),C(this,"__id",g),C(this,"__rev",f),C(this,"__orphanCollections",e),G(i)},I=function(a){var b,d,e,g=n();try{b=g.document(a)}catch(i){if(i.errorNum!==h.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code)throw i;var j=new f;throw j.errorNum=c.errors.ERROR_GRAPH_NOT_FOUND.code,j.errorMessage=c.errors.ERROR_GRAPH_NOT_FOUND.message,j}return d=m(b.edgeDefinitions,!0),e=b.orphanCollections,e||(e=[]),new H(a,b.edgeDefinitions,d[0],d[1],e,b._rev,b._id)},J=function(a){var b=n();return b.exists(a)},K=function(a,b,c){var d=!0;return c.forEach(function(c){if(c._key!==b){var e=c.edgeDefinitions;e&&e.forEach(function(b){var c=b.from,e=b.to,f=b.collection;(f===a||-1!==c.indexOf(a)||-1!==e.indexOf(a))&&(d=!1)});var f=c.orphanCollections;f&&-1!==f.indexOf(a)&&(d=!1)}}),d},L=function(a,b){var d,e=n();if(!e.exists(a)){var h=new f;throw h.errorNum=c.errors.ERROR_GRAPH_NOT_FOUND.code,h.errorMessage=c.errors.ERROR_GRAPH_NOT_FOUND.message,h}if(b===!0){var i=e.document(a),j=i.edgeDefinitions;j.forEach(function(a){var b=a.from,c=a.to,e=a.collection;d=n().toArray(),K(e,i._key,d)&&g._drop(e),b.forEach(function(a){K(a,i._key,d)&&g._drop(a)}),c.forEach(function(a){K(a,i._key,d)&&g._drop(a)})}),d=n().toArray(),i.orphanCollections||(i.orphanCollections=[]),i.orphanCollections.forEach(function(a){if(K(a,i._key,d))try{g._drop(a)}catch(b){}})}return e.remove(a),!0};H.prototype._edgeCollections=function(){return i.values(this.__edgeCollections)},H.prototype._vertexCollections=function(){var a=[];return i.each(this.__orphanCollections,function(b){a.push(g[b])}),i.union(i.values(this.__vertexCollections),a)},H.prototype._EDGES=function(a){var b;if(-1===a.indexOf("/"))throw b=new f,b.errorNum=c.errors.ERROR_GRAPH_NOT_FOUND.code,b.errorMessage=c.errors.ERROR_GRAPH_NOT_FOUND.message+": "+a,b;var d,e=[];for(d in this.__edgeCollections)this.__edgeCollections.hasOwnProperty(d)&&(e=this.__useBuiltIn?e.concat(this.__edgeCollections[d].EDGES(a)):e.concat(this.__edgeCollections[d].edges(a)));return e},H.prototype._INEDGES=function(a){var b;if(-1===a.indexOf("/"))throw b=new f,b.errorNum=c.errors.ERROR_GRAPH_NOT_FOUND.code,b.errorMessage=c.errors.ERROR_GRAPH_NOT_FOUND.message+": "+a,b;var d,e=[];for(d in this.__edgeCollections)this.__edgeCollections.hasOwnProperty(d)&&(e=this.__useBuiltIn?e.concat(this.__edgeCollections[d].INEDGES(a)):e.concat(this.__edgeCollections[d].inEdges(a)));return e},H.prototype._OUTEDGES=function(a){var b;if(-1===a.indexOf("/"))throw b=new f,b.errorNum=c.errors.ERROR_GRAPH_NOT_FOUND.code,b.errorMessage=c.errors.ERROR_GRAPH_NOT_FOUND.message+": "+a,b;var d,e=[];for(d in this.__edgeCollections)this.__edgeCollections.hasOwnProperty(d)&&(e=this.__useBuiltIn?e.concat(this.__edgeCollections[d].OUTEDGES(a)):e.concat(this.__edgeCollections[d].outEdges(a)));return e},H.prototype._edges=function(a){var b=new t(this);return b.outEdges(a)},H.prototype._vertices=function(a){var b=new t(this);return b.vertices(a)},H.prototype._fromVertex=function(a){if("string"!=typeof a||-1===a.indexOf("/")){var b=new f;throw b.errorNum=c.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.code,b.errorMessage=c.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.message,b}var d=this._getEdgeCollectionByName(a.split("/")[0]),e=d.document(a);if(e){var g=e._from,h=this._getVertexCollectionByName(g.split("/")[0]);return h.document(g)}},H.prototype._toVertex=function(a){if("string"!=typeof a||-1===a.indexOf("/")){var b=new f;throw b.errorNum=c.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.code,b.errorMessage=c.errors.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.message,b}var d=this._getEdgeCollectionByName(a.split("/")[0]),e=d.document(a);if(e){var g=e._to,h=this._getVertexCollectionByName(g.split("/")[0]);return h.document(g)}},H.prototype._getEdgeCollectionByName=function(a){if(this.__edgeCollections[a])return this.__edgeCollections[a];var b=new f;throw b.errorNum=c.errors.ERROR_GRAPH_EDGE_COL_DOES_NOT_EXIST.code,b.errorMessage=c.errors.ERROR_GRAPH_EDGE_COL_DOES_NOT_EXIST.message+": "+a,b},H.prototype._getVertexCollectionByName=function(a){if(this.__vertexCollections[a])return this.__vertexCollections[a];var b=new f;throw b.errorNum=c.errors.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.code,b.errorMessage=c.errors.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.message+": "+a,b},H.prototype._neighbors=function(a,b){var c=new t(this);return b||(b={}),c.vertices(a).neighbors(b.neighborExamples,b).toArray()},H.prototype._commonNeighbors=function(a,b,c,d){var e=q(a),f=q(b),h="FOR e IN GRAPH_COMMON_NEIGHBORS(@graphName,@ex1,@ex2,@options1,@options2) RETURN e";c=c||{},d=d||{};var i={graphName:this.__name,options1:c,options2:d,ex1:e,ex2:f};return g._query(h,i,{count:!0}).toArray()},H.prototype._countCommonNeighbors=function(a,b,c,d){var e=q(a),f=q(b),h="FOR e IN GRAPH_COMMON_NEIGHBORS(@graphName,@ex1,@ex2,@options1,@options2) RETURN [e.left, e.right, LENGTH(e.neighbors)]";c=c||{},d=d||{};var i={graphName:this.__name,options1:c,options2:d,ex1:e,ex2:f},j=g._query(h,i,{count:!0}).toArray(),k={},l={},m=[];return j.forEach(function(a){k[a[0]]||(k[a[0]]=[]),l={},l[a[1]]=a[2],k[a[0]].push(l)}),Object.keys(k).forEach(function(a){l={},l[a]=k[a],m.push(l)}),m},H.prototype._commonProperties=function(a,b,c){var d=q(a),e=q(b),f="FOR e IN GRAPH_COMMON_PROPERTIES(@graphName,@ex1,@ex2,@options) SORT ATTRIBUTES(e)[0] RETURN e";c=c||{};var h={graphName:this.__name,options:c,ex1:d,ex2:e};return g._query(f,h,{count:!0}).toArray()},H.prototype._countCommonProperties=function(a,b,c){var d=q(a),e=q(b),f="FOR e IN GRAPH_COMMON_PROPERTIES(@graphName,@ex1,@ex2,@options) FOR a in ATTRIBUTES(e) SORT ATTRIBUTES(e)[0] RETURN [ ATTRIBUTES(e)[0], LENGTH(e[a]) ]";c=c||{};var h={graphName:this.__name,options:c,ex1:d,ex2:e},i=g._query(f,h,{count:!0}).toArray(),j=[];return i.forEach(function(a){var b={};b[a[0]]=a[1],j.push(b)}),j},H.prototype._paths=function(a){var b="RETURN GRAPH_PATHS(@graphName,@options)";a=a||{};var c={graphName:this.__name,options:a},d=g._query(b,c).toArray();return d},H.prototype._shortestPath=function(a,b,c){var d=q(a),e=q(b),f="RETURN GRAPH_SHORTEST_PATH(@graphName,@ex1,@ex2,@options)";c=c||{};var h={graphName:this.__name,options:c,ex1:d,ex2:e},i=g._query(f,h).toArray();return i},H.prototype._distanceTo=function(a,b,c){var d=q(a),e=q(b),f="RETURN GRAPH_DISTANCE_TO(@graphName,@ex1,@ex2,@options)";c=c||{};var h={graphName:this.__name,options:c,ex1:d,ex2:e},i=g._query(f,h).toArray();return i[0]},H.prototype._absoluteEccentricity=function(a,b){var c=q(a),d="RETURN GRAPH_ABSOLUTE_ECCENTRICITY(@graphName,@ex1,@options)";b=b||{};var e={graphName:this.__name,options:b,ex1:c},f=g._query(d,e).toArray();return 1===f.length?f[0]:f},H.prototype._eccentricity=function(a){var b="RETURN GRAPH_ECCENTRICITY(@graphName,@options)";a=a||{};var c={graphName:this.__name,options:a},d=g._query(b,c).toArray();return 1===d.length?d[0]:d},H.prototype._absoluteCloseness=function(a,b){var c=q(a),d="RETURN GRAPH_ABSOLUTE_CLOSENESS(@graphName,@ex1,@options)";b=b||{};var e={graphName:this.__name,options:b,ex1:c},f=g._query(d,e).toArray();return 1===f.length?f[0]:f},H.prototype._closeness=function(a){var b="RETURN GRAPH_CLOSENESS(@graphName,@options)";a=a||{};var c={graphName:this.__name,options:a},d=g._query(b,c).toArray();return 1===d.length?d[0]:d},H.prototype._absoluteBetweenness=function(a,b){var c="RETURN GRAPH_ABSOLUTE_BETWEENNESS(@graphName,@example,@options)";b=b||{};var d={example:a,graphName:this.__name,options:b},e=g._query(c,d).toArray();return 1===e.length?e[0]:e},H.prototype._betweenness=function(a){var b="RETURN GRAPH_BETWEENNESS(@graphName,@options)";a=a||{};var c={graphName:this.__name,options:a},d=g._query(b,c).toArray();return 1===d.length?d[0]:d},H.prototype._radius=function(a){var b="RETURN GRAPH_RADIUS(@graphName,@options)";a=a||{};var c={graphName:this.__name,options:a},d=g._query(b,c).toArray();return 1===d.length?d[0]:d},H.prototype._diameter=function(a){var b="RETURN GRAPH_DIAMETER(@graphName,@options)";a=a||{};var c={graphName:this.__name,options:a},d=g._query(b,c).toArray();return 1===d.length?d[0]:d},H.prototype._extendEdgeDefinitions=function(a){a=A(a);var b,d=this,e=a.collection;if(void 0!==this.__edgeCollections[e])throw b=new f,b.errorNum=c.errors.ERROR_GRAPH_COLLECTION_MULTI_USE.code,b.errorMessage=c.errors.ERROR_GRAPH_COLLECTION_MULTI_USE.message,b;g._graphs.toArray().forEach(function(d){var g=d.edgeDefinitions;g.forEach(function(d){var g=d.collection;if(g===e&&JSON.stringify(d)!==JSON.stringify(a))throw b=new f,b.errorNum=c.errors.ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS.code,b.errorMessage=g+" "+c.errors.ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS.message,b})}),m([a]),this.__edgeDefinitions.push(a),g._graphs.update(this.__name,{edgeDefinitions:this.__edgeDefinitions}),this.__edgeCollections[a.collection]=g[a.collection],a.from.forEach(function(a){d[a]=g[a];var b=d.__orphanCollections.indexOf(a);-1!==b&&d.__orphanCollections.splice(b,1),void 0===d.__vertexCollections[a]&&(d.__vertexCollections[a]=g[a])}),a.to.forEach(function(a){d[a]=g[a];var b=d.__orphanCollections.indexOf(a);-1!==b&&d.__orphanCollections.splice(b,1),void 0===d.__vertexCollections[a]&&(d.__vertexCollections[a]=g[a])}),G(this)};var M=function(a,b,c,d,e){var f=[],h=I(a._key),j=a.edgeDefinitions,k=!1;j.forEach(function(c,d){c.collection===b.collection?(k=!0,j[d].from=b.from,j[d].to=b.to,g._graphs.update(a._key,{edgeDefinitions:j}),a._key===e.__name&&(e.__edgeDefinitions[d].from=b.from,e.__edgeDefinitions[d].to=b.to)):(f=i.union(f,c.from),f=i.union(f,c.to))}),k&&(a._key===e.__name?(c.forEach(function(a){void 0===e.__vertexCollections[a]&&(e.__vertexCollections[a]=g[a]);try{e._removeVertexCollection(a,!1)}catch(b){}}),d.forEach(function(a){-1===f.indexOf(a)&&(delete e.__vertexCollections[a],e._addVertexCollection(a))})):(c.forEach(function(a){try{h._removeVertexCollection(a,!1)}catch(b){}}),d.forEach(function(a){-1===f.indexOf(a)&&(delete h.__vertexCollections[a],h._addVertexCollection(a))})))};H.prototype._editEdgeDefinitions=function(a){a=A(a);var b=this;if(void 0===this.__edgeCollections[a.collection]){var d=new f;throw d.errorNum=c.errors.ERROR_GRAPH_EDGE_COLLECTION_NOT_USED.code,d.errorMessage=c.errors.ERROR_GRAPH_EDGE_COLLECTION_NOT_USED.message,d}m([a]);var e,g=[];this.__edgeDefinitions.forEach(function(b){a.collection===b.collection&&(e=b)});var h=i.union(e.from,e.to),j=i.union(a.from,a.to);h.forEach(function(a){-1===j.indexOf(a)&&g.push(a)});var k=n().toArray();k.forEach(function(c){M(c,a,j,g,b)}),G(this)},H.prototype._deleteEdgeDefinition=function(a,b){if(void 0===this.__edgeCollections[a]){var d=new f;throw d.errorNum=c.errors.ERROR_GRAPH_EDGE_COLLECTION_NOT_USED.code,d.errorMessage=c.errors.ERROR_GRAPH_EDGE_COLLECTION_NOT_USED.message,d}var e,h=this.__edgeDefinitions,j=this,k=[],l=[];h.forEach(function(b,c){b.collection===a?(e=c,l=b.from,l=i.union(l,b.to)):(k=i.union(k,b.from),k=i.union(k,b.to))}),this.__edgeDefinitions.splice(e,1),l.forEach(function(a){-1===k.indexOf(a)&&j.__orphanCollections.push(a)}),G(this),g._graphs.update(this.__name,{orphanCollections:this.__orphanCollections,edgeDefinitions:this.__edgeDefinitions}),b&&g._drop(a)},H.prototype._addVertexCollection=function(a,b){var d,e=g._collection(a);if(null===e){if(b===!1)throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.code,d.errorMessage=a+c.errors.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.message,d;g._create(a)}else if(2!==e.type())throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_WRONG_COLLECTION_TYPE_VERTEX.code,d.errorMessage=c.errors.ERROR_GRAPH_WRONG_COLLECTION_TYPE_VERTEX.message,d;if(void 0!==this.__vertexCollections[a])throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_COLLECTION_USED_IN_EDGE_DEF.code,d.errorMessage=c.errors.ERROR_GRAPH_COLLECTION_USED_IN_EDGE_DEF.message,d;if(i.contains(this.__orphanCollections,a))throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_COLLECTION_USED_IN_ORPHANS.code,d.errorMessage=c.errors.ERROR_GRAPH_COLLECTION_USED_IN_ORPHANS.message,d;this.__orphanCollections.push(a),G(this),g._graphs.update(this.__name,{orphanCollections:this.__orphanCollections})},H.prototype._orphanCollections=function(){return this.__orphanCollections},H.prototype._removeVertexCollection=function(a,b){var d;if(null===g._collection(a))throw d=new f, d.errorNum=c.errors.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.code,d.errorMessage=c.errors.ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST.message,d;var e=this.__orphanCollections.indexOf(a);if(-1===e)throw d=new f,d.errorNum=c.errors.ERROR_GRAPH_NOT_IN_ORPHAN_COLLECTION.code,d.errorMessage=c.errors.ERROR_GRAPH_NOT_IN_ORPHAN_COLLECTION.message,d;if(this.__orphanCollections.splice(e,1),delete this[a],g._graphs.update(this.__name,{orphanCollections:this.__orphanCollections}),b===!0){var h=n().toArray();K(a,null,h)&&g._drop(a)}G(this)},H.prototype._getConnectingEdges=function(a,b,c){c=c||{};var d={includeData:!0};c.vertex1CollectionRestriction&&(d.startVertexCollectionRestriction=c.vertex1CollectionRestriction),c.vertex2CollectionRestriction&&(d.endVertexCollectionRestriction=c.vertex2CollectionRestriction),c.edgeCollectionRestriction&&(d.edgeCollectionRestriction=c.edgeCollectionRestriction),c.edgeExamples&&(d.edgeExamples=c.edgeExamples),b&&(d.neighborExamples=b);var e="RETURN GRAPH_EDGES(@graphName,@vertexExample,@options)",f={graphName:this.__name,vertexExample:a,options:d},h=g._query(e,f).toArray();return h[0]},H.prototype._PRINT=function(a){var b=this.__name,c=o(this.__edgeDefinitions);a.output+="[ Graph ",a.output+=b,a.output+=" EdgeDefinitions: ",d.printRecursive(c,a),a.output+=" VertexCollections: ",d.printRecursive(this.__orphanCollections,a),a.output+=" ]"},a._undirectedRelation=u,a._directedRelation=function(){return v.apply(this,arguments)},a._relation=v,a._graph=I,a._edgeDefinitions=y,a._extendEdgeDefinitions=z,a._create=B,a._drop=L,a._exists=J,a._list=w,a._listObjects=x}),module.define("@arangodb/graph-blueprint",function(a,b){var c=require("@arangodb"),d=require("@arangodb/is"),e=require("@arangodb/graph-common"),f=e.Edge,g=e.Graph,h=e.Vertex,i=e.GraphArray,j=e.Iterator,k=require("@arangodb/api/graph").GraphAPI;f.prototype.setProperty=function(a,b){var c,d=this._properties;return d[a]=b,this._graph.emptyCachedPredecessors(),c=k.putEdge(this._graph._properties._key,this._properties._key,d),this._properties=c.edge,a},h.prototype.edges=function(a,b){var c,d,e=new i;for(d=k.postEdges(this._graph._vertices._database,this._graph._properties._key,this,{filter:{direction:a,labels:b}});d.hasNext();)c=new f(this._graph,d.next()),e.push(c);return e},h.prototype.getInEdges=function(){var a=Array.prototype.slice.call(arguments);return this.edges("in",a)},h.prototype.getOutEdges=function(){var a=Array.prototype.slice.call(arguments);return this.edges("out",a)},h.prototype.getEdges=function(){var a=Array.prototype.slice.call(arguments);return this.edges("any",a)},h.prototype.inbound=function(){return this.getInEdges()},h.prototype.outbound=function(){return this.getOutEdges()},h.prototype.setProperty=function(a,b){var c,d=this._properties;return d[a]=b,c=k.putVertex(this._graph._properties._key,this._properties._key,d),this._properties=c.vertex,a},g.prototype.initialize=function(a,b,e){var f;return d.notExisty(b)&&d.notExisty(e)?f=k.getGraph(a):("object"==typeof b&&"function"==typeof b.name&&(b=b.name()),"object"==typeof e&&"function"==typeof e.name&&(e=e.name()),f=k.postGraph({_key:a,vertices:b,edges:e})),this._properties=f.graph,this._vertices=c.db._collection(this._properties.edgeDefinitions[0].from[0]),this._edges=c.db._collection(this._properties.edgeDefinitions[0].collection),this._verticesCache={},this._edgesCache={},this.predecessors={},this.distances={},this},g.getAll=function(){return k.getAllGraphs()},g.drop=function(a){k.deleteGraph(a)},g.prototype.drop=function(){k.deleteGraph(this._properties._key)},g.prototype._saveEdge=function(a,b,c,d){var e;return this.emptyCachedPredecessors(),d._key=a,d._from=b,d._to=c,e=k.postEdge(this._properties._key,d),new f(this,e.edge)},g.prototype._saveVertex=function(a,b){var c;return d.existy(a)&&(b._key=a),c=k.postVertex(this._properties._key,b),new h(this,c.vertex)},g.prototype._replaceVertex=function(a,b){k.putVertex(this._properties._key,a,b)},g.prototype._replaceEdge=function(a,b){k.putEdge(this._properties._key,a,b)},g.prototype.getVertex=function(a){var b=k.getVertex(this._properties._key,a);return d.notExisty(b)?null:new h(this,b.vertex)},g.prototype.getVertices=function(){var a=k.getVertices(this._vertices._database,this._properties._key,{}),b=this,c=function(a){return new h(b,a)};return new j(c,a,"[vertex iterator]")},g.prototype.getEdge=function(a){var b=k.getEdge(this._properties._key,a);return d.notExisty(b)?null:new f(this,b.edge)},g.prototype.getEdges=function(){var a=k.getEdges(this._vertices._database,this._properties._key,{}),b=this,c=function(a){return new f(b,a)};return new j(c,a,"[edge iterator]")},g.prototype.removeVertex=function(a){this.emptyCachedPredecessors(),k.deleteVertex(this._properties._key,a._properties._key),a._properties=void 0},g.prototype.removeEdge=function(a){this.emptyCachedPredecessors(),k.deleteEdge(this._properties._key,a._properties._key),this._edgesCache[a._properties._id]=void 0,a._properties=void 0},a.Edge=f,a.Graph=g,a.Vertex=h,a.GraphArray=i,require("@arangodb/graph/algorithms-common")}),module.define("@arangodb/graph-common",function(a,b){var c,d,e,f,g,h=require("@arangodb/is");g=function(a,b,c){this.next=function(){return b.hasNext()?a(b.next()):void 0},this.hasNext=function(){return b.hasNext()},this._PRINT=function(a){a.output+=c}},f=function(a){void 0!==a&&(this.length=a)},f.prototype=new Array(0),f.prototype.map=function(a,b){var c,d=this.length;if("function"!=typeof a)throw new TypeError;var e=new f(d);for(c=0;d>c;c++)this.hasOwnProperty(c)&&(e[c]=a.call(b,this[c],c,this));return e},f.prototype.getInVertex=function(){return this.map(function(a){return a.getInVertex()})},f.prototype.getOutVertex=function(){return this.map(function(a){return a.getOutVertex()})},f.prototype.getPeerVertex=function(a){return this.map(function(b){return b.getPeerVertex(a)})},f.prototype.setProperty=function(a,b){return this.map(function(c){return c.setProperty(a,b)})},f.prototype.edges=function(){return this.map(function(a){return a.edges()})},f.prototype.outbound=function(){return this.map(function(a){return a.outbound()})},f.prototype.inbound=function(){return this.map(function(a){return a.inbound()})},f.prototype.getInEdges=function(){var a=arguments;return this.map(function(b){return b.getInEdges.apply(b,a)})},f.prototype.getOutEdges=function(){var a=arguments;return this.map(function(b){return b.getOutEdges.apply(b,a)})},f.prototype.getEdges=function(){var a=arguments;return this.map(function(b){return b.getEdges.apply(b,a)})},f.prototype.degree=function(){return this.map(function(a){return a.degree()})},f.prototype.inDegree=function(){return this.map(function(a){return a.inDegree()})},f.prototype.inDegree=function(){return this.map(function(a){return a.outDegree()})},f.prototype.properties=function(){return this.map(function(a){return a.properties()})},c=function(a,b){this._graph=a,this._id=b._key,this._properties=b},c.prototype.getId=function(){return this._properties._key},c.prototype.getLabel=function(){return this._properties.$label},c.prototype.getProperty=function(a){return this._properties[a]},c.prototype.getPropertyKeys=function(){return this._properties.propertyKeys},c.prototype.properties=function(){return this._properties._shallowCopy},c.prototype.getInVertex=function(){return this._graph.getVertex(this._properties._to)},c.prototype.getOutVertex=function(){return this._graph.getVertex(this._properties._from)},c.prototype.getPeerVertex=function(a){return a._properties._id===this._properties._to?this._graph.getVertex(this._properties._from):a._properties._id===this._properties._from?this._graph.getVertex(this._properties._to):null},c.prototype._PRINT=function(a){this._properties._id?void 0!==this._properties._key?"string"==typeof this._properties._key?a.output+='Edge("'+this._properties._key+'")':a.output+="Edge("+this._properties._key+")":a.output+="Edge(<"+this._id+">)":a.output+="[deleted Edge]"},e=function(a,b){this._graph=a,this._id=b._key,this._properties=b},e.prototype.addInEdge=function(a,b,c,d){return this._graph.addEdge(a,this,b,c,d)},e.prototype.addOutEdge=function(a,b,c,d){return this._graph.addEdge(this,a,b,c,d)},e.prototype.degree=function(){return this.getEdges().length},e.prototype.inDegree=function(){return this.getInEdges().length},e.prototype.outDegree=function(){return this.getOutEdges().length},e.prototype.getId=function(){return this._properties._key},e.prototype.getProperty=function(a){return this._properties[a]},e.prototype.getPropertyKeys=function(){return this._properties.propertyKeys},e.prototype.properties=function(){return this._properties._shallowCopy},e.prototype._PRINT=function(a){this._properties._id?void 0!==this._properties._key?"string"==typeof this._properties._key?a.output+='Vertex("'+this._properties._key+'")':a.output+="Vertex("+this._properties._key+")":a.output+="Vertex(<"+this._id+">)":a.output+="[deleted Vertex]"},d=function(a,b,c,d){this.initialize(a,b,c,d)},d.prototype._prepareEdgeData=function(a,b){var c;return h.notExisty(a)&&h.object(b)&&(a=b,b=null),h.notExisty(b)&&h.existy(a)&&h.existy(a.$label)&&(b=a.$label),c=h.notExisty(a)||h.noObject(a)?{}:a._shallowCopy||{},c.$label=b,c},d.prototype._prepareVertexData=function(a){var b;return b=h.notExisty(a)||h.noObject(a)?{}:a._shallowCopy||{}},d.prototype.getOrAddVertex=function(a){var b=this.getVertex(a);return null===b&&(b=this.addVertex(a)),b},d.prototype.addEdge=function(a,b,c,d,e,f){var g,i;return g=h.string(a)?a:a._properties._id,i=h.string(b)?b:b._properties._id,this._saveEdge(c,g,i,this._prepareEdgeData(e,d),f)},d.prototype.addVertex=function(a,b,c){return this._saveVertex(a,this._prepareVertexData(b),c)},d.prototype.replaceVertex=function(a,b){this._replaceVertex(a,b)},d.prototype.replaceEdge=function(a,b){this._replaceEdge(a,b)},d.prototype.order=function(){return this._vertices.count()},d.prototype.size=function(){return this._edges.count()},d.prototype.emptyCachedPredecessors=function(){this.predecessors={}},d.prototype.getCachedPredecessors=function(a,b){var c;return this.predecessors[a.getId()]&&(c=this.predecessors[a.getId()][b.getId()]),c},d.prototype.setCachedPredecessors=function(a,b,c){this.predecessors[a.getId()]||(this.predecessors[a.getId()]={}),this.predecessors[a.getId()][b.getId()]=c},d.prototype.constructVertex=function(a){var b,c;"string"==typeof a?b=a:(b=a._id,c=a._rev);var d=this._verticesCache[b];if(void 0===d||d._rev!==c){var f=this._vertices.document(b);if(!f)throw"accessing a deleted vertex";this._verticesCache[b]=d=new e(this,f)}return d},d.prototype.constructEdge=function(a){var b,d,e,f;if("string"==typeof a?b=a:(b=a._id,d=a._rev),e=this._edgesCache[b],void 0===e||e._rev!==d){if(f=this._edges.document(b),!f)throw"accessing a deleted edge";this._edgesCache[b]=e=new c(this,f)}return e},d.prototype._PRINT=function(a){a.output+='Graph("'+this._properties._key+'")'},a.Edge=c,a.Graph=d,a.Vertex=e,a.GraphArray=f,a.Iterator=g}),module.define("@arangodb/graph",function(a,b){var c=require("@arangodb/graph-blueprint");Object.keys(c).forEach(function(b){a[b]=c[b]})}),module.define("@arangodb/graph/traversal",function(a,b){function c(a){if(null===a||"object"!=typeof a)return a;var b;if(Array.isArray(a))b=[],a.forEach(function(a){b.push(c(a))});else if(a instanceof Object){if(J&&a instanceof J)return a;b={},Object.keys(a).forEach(function(d){b[d]=c(a[d])})}return b}function d(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}function e(a){var b=a;"string"==typeof b&&(b=K._collection(b));var c="object"==typeof ArangoClusterComm;return c&&require("@arangodb/cluster").isCoordinator()&&(c=!1),{edgeCollection:b,useBuiltIn:c,getVertexId:function(a){return a._id},getPeerVertex:function(a,b){return a._from===b._id?K._document(a._to):a._to===b._id?K._document(a._from):null},getInVertex:function(a){return K._document(a._to)},getOutVertex:function(a){return K._document(a._from)},getEdgeId:function(a){return a._id},getEdgeFrom:function(a){return a._from},getEdgeTo:function(a){return a._to},getLabel:function(a){return a.$label},getAllEdges:function(a){return this.useBuiltIn?this.edgeCollection.EDGES(a._id):this.edgeCollection.edges(a._id)},getInEdges:function(a){return this.useBuiltIn?this.edgeCollection.INEDGES(a._id):this.edgeCollection.inEdges(a._id)},getOutEdges:function(a){return this.useBuiltIn?this.edgeCollection.OUTEDGES(a._id):this.edgeCollection.outEdges(a._id)}}}function f(a){var b=a;return"string"==typeof b&&(b=F._graph(b)),{graph:b,getVertexId:function(a){return a._id},getPeerVertex:function(a,b){return a._from===b._id?K._document(a._to):a._to===b._id?K._document(a._from):null},getInVertex:function(a){return K._document(a._to)},getOutVertex:function(a){return K._document(a._from)},getEdgeId:function(a){return a._id},getEdgeFrom:function(a){return a._from},getEdgeTo:function(a){return a._to},getLabel:function(a){return a.$label},getAllEdges:function(a){return this.graph._EDGES(a._id)},getInEdges:function(a){return this.graph._INEDGES(a._id)},getOutEdges:function(a){return this.graph._OUTEDGES(a._id)}}}function g(a){return{graph:new E.Graph(a),getVertexId:function(a){return a.getId()},getPeerVertex:function(a,b){return a.getPeerVertex(b)},getInVertex:function(a){return a.getInVertex()},getOutVertex:function(a){return a.getOutVertex()},getEdgeId:function(a){return a.getId()},getEdgeFrom:function(a){return a._properties._from},getEdgeTo:function(a){return a._properties._to},getLabel:function(a){return a.getLabel()},getAllEdges:function(a){return a.edges()},getInEdges:function(a){return a.inbound()},getOutEdges:function(a){return a.outbound()}}}function h(a,b,c){var d,e=a.datasource,f=[],g=e.getOutEdges(b);return g.length>1&&a.sort&&g.sort(a.sort),d=a.buildVertices?a.expandFilter?function(b){try{var d=e.getInVertex(b);a.expandFilter(a,d,b,c)&&f.push({edge:b,vertex:d})}catch(g){}}:function(a){try{var b=e.getInVertex(a);f.push({edge:a,vertex:b})}catch(c){}}:a.expandFilter?function(b){var d=e.getEdgeTo(b),g={_id:d,_key:d.substr(d.indexOf("/")+1)};a.expandFilter(a,g,b,c)&&f.push({edge:b,vertex:g})}:function(a){var b=e.getEdgeTo(a),c={_id:b,_key:b.substr(b.indexOf("/")+1)};f.push({edge:a,vertex:c})},g.forEach(d),f}function i(a,b,c){var d=a.datasource,e=[],f=d.getInEdges(b);f.length>1&&a.sort&&f.sort(a.sort);var g;return g=a.buildVertices?a.expandFilter?function(b){try{var f=d.getOutVertex(b);a.expandFilter(a,f,b,c)&&e.push({edge:b,vertex:f})}catch(g){}}:function(a){try{var b=d.getOutVertex(a);e.push({edge:a,vertex:b})}catch(c){}}:a.expandFilter?function(b){var f=d.getEdgeFrom(b),g={_id:f,_key:f.substr(f.indexOf("/")+1)};a.expandFilter(a,g,b,c)&&e.push({edge:b,vertex:g})}:function(a){var b=d.getEdgeFrom(a),c={_id:b,_key:b.substr(b.indexOf("/")+1)};e.push({edge:a,vertex:c})},f.forEach(g),e}function j(a,b,c){var d=a.datasource,e=[],f=d.getAllEdges(b);f.length>1&&a.sort&&f.sort(a.sort);var g;return g=a.buildVertices?a.expandFilter?function(f){try{var g=d.getPeerVertex(f,b);a.expandFilter(a,g,f,c)&&e.push({edge:f,vertex:g})}catch(h){}}:function(a){try{var c=d.getPeerVertex(a,b);e.push({edge:a,vertex:c})}catch(f){}}:a.expandFilter?function(f){var g=d.getEdgeFrom(f);g===b._id&&(g=d.getEdgeTo(f));var h={_id:g,_key:g.substr(g.indexOf("/")+1)};a.expandFilter(a,h,f,c)&&e.push({edge:f,vertex:h})}:function(a){var c=d.getEdgeFrom(a);c===b._id&&(c=d.getEdgeTo(a));var f={_id:c,_key:c.substr(c.indexOf("/")+1)};e.push({edge:a,vertex:f})},f.forEach(g),e}function k(a,b,c){var d,e=a.datasource,f=[];Array.isArray(a.labels)||(a.labels=[a.labels]);var g=e.getOutEdges(b);if(void 0!==g)for(d=0;d=0&&f.push({edge:h,vertex:e.getInVertex(h)})}return f}function l(a,b,c){var d,e=a.datasource,f=[];Array.isArray(a.labels)||(a.labels=[a.labels]);var g=a.datasource.getInEdges(b);if(void 0!==g)for(d=0;d=0&&f.push({edge:h,vertex:e.getOutVertex(h)})}return f}function m(a,b,c){var d,e=a.datasource,f=[];Array.isArray(a.labels)||(a.labels=[a.labels]);var g=a.datasource.getAllEdges(b);if(void 0!==g)for(d=0;d=0&&f.push({edge:h,vertex:e.getPeerVertex(h,b)})}return f}function n(a,b,d,e){b&&b.visited&&(b.visited.vertices&&b.visited.vertices.push(c(d)),b.visited.paths&&b.visited.paths.push(c(e)))}function o(a,b,c,d){b&&(b.hasOwnProperty("count")?++b.count:b.count=1)}function p(){}function q(){return""}function r(a,b,c){return c&&c.vertices&&c.vertices.length>a.maxDepth?D.PRUNE:void 0}function s(a,b,c){return c&&c.vertices&&c.vertices.length<=a.minDepth?D.EXCLUDE:void 0}function t(a,b,c){Array.isArray(a.matchingAttributes)||(a.matchingAttributes=[a.matchingAttributes]);var d=!1;a.matchingAttributes.forEach(function(a){var c=0,e=Object.keys(a);e.forEach(function(d){b[d]&&b[d]===a[d]&&c++}),c>0&&c===e.length&&(d=!0)});var e;return d||(e="exclude"),e}function u(a,b,c,d){var e=[];return a.forEach(function(a){var f=a(b,c,d);Array.isArray(f)||(f=[f]),e=e.concat(f)}),e}function v(a){function b(a){if(void 0!==a&&null!==a){var d=!1;if("string"==typeof a)a===D.EXCLUDE?(c.visit=!1,d=!0):a===D.PRUNE?(c.expand=!1,d=!0):""===a&&(d=!0);else if(Array.isArray(a)){var e;for(e=0;eb)break;d=a[b]}return c},run:function(a,b,c){for(var d=a.maxIterations,e=0,f=[{edge:null,vertex:c,parentIndex:-1}],g={edges:{},vertices:{}},h=0,i=1,j=x(a);1===i&&h=0;){var k,l=f[h],m=l.vertex,n=l.edge;if(e++>d){var o=new I;throw o.errorNum=G.errors.ERROR_GRAPH_TOO_MANY_ITERATIONS.code,o.errorMessage=G.errors.ERROR_GRAPH_TOO_MANY_ITERATIONS.message,o}if(L(),null===l.visit||void 0===l.visit){if(l.visit=!1,k=this.createPath(f,h),a.uniqueness.vertices===D.UNIQUE_PATH&&(g.vertices=this.getPathItems(a.datasource.getVertexId,k.vertices)),a.uniqueness.edges===D.UNIQUE_PATH&&(g.edges=this.getPathItems(a.datasource.getEdgeId,k.edges)),!w(a,g,m,n)){h0;){if(e++>d){var l=new I;throw l.errorNum=G.errors.ERROR_GRAPH_TOO_MANY_ITERATIONS.code,l.errorMessage=G.errors.ERROR_GRAPH_TOO_MANY_ITERATIONS.message,l}L();var m=f[f.length-1],n=m.vertex,o=m.edge;if(null===m.visit||void 0===m.visit){if(m.visit=!1,k&&(j.vertices===D.UNIQUE_PATH&&(h.vertices=this.getPathItems(a.datasource.getVertexId,g.vertices)),j.edges===D.UNIQUE_PATH&&(h.edges=this.getPathItems(a.datasource.getEdgeId,g.edges)),!w(a,h,n,o))){f.pop();continue}null!==o&&g.edges.push(o),g.vertices.push(n);var p=v(a.filter(a,n,g));if(a.order===D.PRE_ORDER&&p.visit?a.visitor(a,b,n,g):m.visit=p.visit||!1,p.expand){var q,r=a.expander(a,n,g);for(i&&r.reverse(),a.order===D.PRE_ORDER_EXPANDER&&p.visit&&a.visitor(a,b,n,g,r),q=0;q0&&g.edges.pop(),g.vertices.pop()}}}}function A(){return{nodes:{},requiresEndVertex:function(){return!0},makeNode:function(a){var b=a._id;return this.nodes.hasOwnProperty(b)||(this.nodes[b]={vertex:a,dist:1/0}),this.nodes[b]},vertexList:function(a){for(var b=[];a;)b.push(a),a=a.parent;return b},buildPath:function(a){for(var b={vertices:[a.vertex],edges:[]},c=a;c.parent;)b.vertices.unshift(c.parent.vertex),b.edges.unshift(c.parentEdge),c=c.parent;return b},run:function(a,b,c,d){var e=a.maxIterations,f=0,g=new H(function(a){return a.dist}),h=this.makeNode(c);for(h.dist=0,g.push(h);g.size()>0;){if(f++>e){var i=new I;throw i.errorNum=G.errors.ERROR_GRAPH_TOO_MANY_ITERATIONS.code,i.errorMessage=G.errors.ERROR_GRAPH_TOO_MANY_ITERATIONS.message,i}L();var j,k,l=g.pop();if(l.vertex._id===d._id){var m=this.vertexList(l).reverse();for(k=m.length,j=0;k>j;++j)m[j].hide||a.visitor(a,b,m[j].vertex,this.buildPath(m[j]));return}if(!l.visited){if(l.dist===1/0)break;l.visited=!0;var n=this.buildPath(l),o=v(a.filter(a,l.vertex,n));if(o.visit||(l.hide=!0),o.expand){var p=l.dist,q=a.expander(a,l.vertex,n);for(k=q.length,j=0;k>j;++j){var r=this.makeNode(q[j].vertex);if(!r.visited){var s=q[j].edge,t=1;a.distance?t=a.distance(a,l.vertex,r.vertex,s):a.weight&&(t="number"==typeof s[a.weight]?s[a.weight]:a.defaultWeight?a.defaultWeight:1/0);var u=p+t;u0;){if(g++>f){var j=new I;throw j.errorNum=G.errors.ERROR_GRAPH_TOO_MANY_ITERATIONS.code,j.errorMessage=G.errors.ERROR_GRAPH_TOO_MANY_ITERATIONS.message,j}var k,l,m=h.pop();if(e.hasOwnProperty(m.vertex._id)&&(delete e[m.vertex._id],a.visitor(a,b,m,this.buildPath(m)),d(e)))return;if(!m.visited){if(m.dist===1/0)break;m.visited=!0;var n=this.buildPath(m),o=v(a.filter(a,m.vertex,n));if(o.visit||(m.hide=!0),o.expand){var p=m.dist,q=a.expander(a,m.vertex,n);for(l=q.length,k=0;l>k;++k){var r=this.makeNode(q[k].vertex);if(!r.visited){var s=q[k].edge,t=1;a.distance?t=a.distance(a,m.vertex,r.vertex,s):a.weight&&(t="number"==typeof s[a.weight]?s[a.weight]:a.defaultWeight?a.defaultWeight:1/0);var u=p+t;u0;){if(f++>e){var h=new I;throw h.errorNum=G.errors.ERROR_GRAPH_TOO_MANY_ITERATIONS.code,h.errorMessage=G.errors.ERROR_GRAPH_TOO_MANY_ITERATIONS.message,h}L();var i,j,k=g.pop();if(k.vertex._id===d._id){var l=this.vertexList(k);for(a.order!==D.PRE_ORDER&&l.reverse(),j=l.length,i=0;j>i;++i)a.visitor(a,b,l[i].vertex,this.buildPath(l[i]));return}k.closed=!0;var m=this.buildPath(k),n=a.expander(a,k.vertex,m);for(j=n.length,i=0;j>i;++i){var o=this.makeNode(n[i].vertex);if(!o.closed){var p=k.g+1,q=o.visited;if(!q||p0&&f.push(s),void 0!==a.maxDepth&&null!==a.maxDepth&&a.maxDepth>0&&f.push(r),Array.isArray(a.filter)||("function"==typeof a.filter?a.filter=[a.filter]:a.filter=[]),a.filter.forEach(function(a){if("function"!=typeof a)throw d=new I,d.errorNum=G.errors.ERROR_BAD_PARAMETER.code,d.errorMessage="invalid filter function",d;f.push(a)}),f.length>1?a.filter=function(a,b,c){return u(f,a,b,c)}:1===f.length?a.filter=f[0]:a.filter=q,"function"!=typeof a.expander&&(a.expander=b(a.expander,{outbound:h,inbound:i,any:j},"expander")),"function"!=typeof a.expander)throw d=new I,d.errorNum=G.errors.ERROR_BAD_PARAMETER.code,d.errorMessage="invalid expander function",d;if("object"!=typeof a.datasource)throw d=new I,d.errorNum=G.errors.ERROR_BAD_PARAMETER.code,d.errorMessage="invalid datasource",d;this.config=a},D.prototype.traverse=function(a,b,c){var d;if(d=this.config.strategy===D.ASTAR_SEARCH?C():this.config.strategy===D.DIJKSTRA_SEARCH?A():this.config.strategy===D.DIJKSTRA_SEARCH_MULTI?B():this.config.strategy===D.BREADTH_FIRST?y():z(),void 0===b||null===b||"object"!=typeof b){var e=new I;throw e.errorNum=G.errors.ERROR_BAD_PARAMETER.code,e.errorMessage=G.errors.ERROR_BAD_PARAMETER.message+": invalid startVertex specified for traversal",e}if(d.requiresEndVertex()&&(void 0===c||null===c||"object"!=typeof c)){var f=new I;throw f.errorNum=G.errors.ERROR_BAD_PARAMETER.code,f.errorMessage=G.errors.ERROR_BAD_PARAMETER.message+": invalid endVertex specified for traversal",f}try{d.run(this.config,a,b,c)}catch(g){if("object"!=typeof g||!g._intentionallyAborted)throw g}},D.UNIQUE_NONE=0,D.UNIQUE_PATH=1,D.UNIQUE_GLOBAL=2,D.BREADTH_FIRST=0,D.DEPTH_FIRST=1,D.ASTAR_SEARCH=2,D.DIJKSTRA_SEARCH=3,D.DIJKSTRA_SEARCH_MULTI=4,D.PRE_ORDER=0,D.POST_ORDER=1,D.PRE_ORDER_EXPANDER=2,D.FORWARD=0,D.BACKWARD=1,D.PRUNE="prune",D.EXCLUDE="exclude",a.collectionDatasourceFactory=e,a.generalGraphDatasourceFactory=f,a.graphDatasourceFactory=g,a.outboundExpander=h,a.inboundExpander=i,a.anyExpander=j,a.expandOutEdgesWithLabels=k,a.expandInEdgesWithLabels=l,a.expandEdgesWithLabels=m,a.trackingVisitor=n,a.countingVisitor=o,a.doNothingVisitor=p,a.visitAllFilter=q,a.maxDepthFilter=r,a.minDepthFilter=s,a.includeMatchingAttributesFilter=t,a.abortedException=N,a.Traverser=D}),module.define("@arangodb/is",function(a,b){function c(a){return null!==a&&void 0!==a}function d(a){return!c(a)}function e(a){return a!==!1&&c(a)}function f(a){return!e(a)}["Object","Array","Boolean","Date","Function","Number","String","RegExp"].forEach(function(b){a[b.toLowerCase()]=function(a){return Object.prototype.toString.call(a)==="[object "+b+"]"},a["no"+b]=function(a){return Object.prototype.toString.call(a)!=="[object "+b+"]"}}),a.existy=c,a.notExisty=d,a.truthy=e,a.falsy=f}),module.define("@arangodb/mimetypes",function(a,b){a.mimeTypes={gif:["image/gif",!1],jpg:["image/jpg",!1],png:["image/png",!1],tiff:["image/tiff",!1],ico:["image/x-icon",!1],css:["text/css",!0],js:["text/javascript",!0],json:["application/json",!0],html:["text/html",!0],htm:["text/html",!0],pdf:["application/pdf",!1],ps:["application/postscript",!1],txt:["text/plain",!0],text:["text/plain",!0],xml:["application/xml",!0],dtd:["application/xml-dtd",!0],svg:["image/svg+xml",!0],ttf:["application/x-font-ttf",!1],otf:["application/x-font-opentype",!1],woff:["application/font-woff",!1],eot:["application/vnd.ms-fontobject",!1],bz2:["application/x-bzip2",!1],gz:["application/x-gzip",!1],tgz:["application/x-tar",!1],zip:["application/x-compressed-zip",!1],doc:["application/msword",!1],docx:["application/vnd.openxmlformats-officedocument.wordprocessingml.document",!1],dotx:["application/vnd.openxmlformats-officedocument.wordprocessingml.template",!1],potx:["application/vnd.openxmlformats-officedocument.presentationml.template",!1],ppsx:["application/vnd.openxmlformats-officedocument.presentationml.slideshow",!1],ppt:["application/vnd.ms-powerpoint",!1],pptx:["application/vnd.openxmlformats-officedocument.presentationml.presentation",!1],xls:["application/vnd.ms-excel",!1],xlsb:["application/vnd.ms-excel.sheet.binary.macroEnabled.12",!1],xlsx:["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",!1],xltx:["application/vnd.openxmlformats-officedocument.spreadsheetml.template",!1],swf:["application/x-shockwave-flash",!1]},a.extensions={"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"image/svg+xml":["svg"],"application/postscript":["ps"],"image/png":["png"],"application/x-font-ttf":["ttf"],"application/vnd.ms-excel.sheet.binary.macroEnabled.12":["xlsb"],"application/x-font-opentype":["otf"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/x-bzip2":["bz2"],"application/json":["json"],"application/pdf":["pdf"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.ms-fontobject":["eot"],"application/xml-dtd":["dtd"],"application/x-shockwave-flash":["swf"],"image/gif":["gif"],"image/jpg":["jpg"],"application/xml":["xml"], "application/vnd.ms-excel":["xls"],"image/tiff":["tiff"],"application/vnd.ms-powerpoint":["ppt"],"application/font-woff":["woff"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"text/plain":["txt","text"],"application/x-tar":["tgz"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/x-gzip":["gz"],"text/javascript":["js"],"text/html":["html","htm"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"image/x-icon":["ico"],"application/x-compressed-zip":["zip"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"text/css":["css"],"application/msword":["doc"]}}),module.define("@arangodb/replication",function(a,b){var c=require("internal"),d=require("@arangodb/arangosh"),e={},f={};e.state=function(){var a=c.db,b=a._connection.GET("/_api/replication/logger-state");return d.checkRequestResult(b),b},e.tickRanges=function(){var a=c.db,b=a._connection.GET("/_api/replication/logger-tick-ranges");return d.checkRequestResult(b),b},e.firstTick=function(){var a=c.db,b=a._connection.GET("/_api/replication/logger-first-tick");return d.checkRequestResult(b),b.firstTick},f.start=function(a){var b=c.db,e="";void 0!==a&&(e="?from="+encodeURIComponent(a));var f=b._connection.PUT("/_api/replication/applier-start"+e,"");return d.checkRequestResult(f),f},f.stop=f.shutdown=function(){var a=c.db,b=a._connection.PUT("/_api/replication/applier-stop","");return d.checkRequestResult(b),b},f.state=function(){var a=c.db,b=a._connection.GET("/_api/replication/applier-state");return d.checkRequestResult(b),b},f.forget=function(){var a=c.db,b=a._connection.DELETE("/_api/replication/applier-state");return d.checkRequestResult(b),b},f.properties=function(a){var b,e=c.db;return b=void 0===a?e._connection.GET("/_api/replication/applier-config"):e._connection.PUT("/_api/replication/applier-config",JSON.stringify(a)),d.checkRequestResult(b),b};var g=function(a){var b=c.db,e=JSON.stringify(a||{}),f=b._connection.PUT("/_api/replication/sync",e);return d.checkRequestResult(f),f},h=function(a,b){var e=c.db;b=b||{},b.restrictType="include",b.restrictCollections=[a],b.includeSystem=!0,b.incremental=!0;var f=JSON.stringify(b),g=e._connection.PUT("/_api/replication/sync",f);return d.checkRequestResult(g),g},i=function(){var a=c.db,b=a._connection.GET("/_api/replication/server-id");return d.checkRequestResult(b),b.serverId};a.logger=e,a.applier=f,a.sync=g,a.syncCollection=h,a.serverId=i}),module.define("@arangodb/simple-query-common",function(a,b){function c(a,b,c,d){this._documents=a,this._countTotal=a.length,this._skip=b,this._limit=c,this._cached=!1,this._extra={};var e=this;null!==d&&void 0!==d&&"object"==typeof d&&(["stats","warnings","profile"].forEach(function(a){d.hasOwnProperty(a)&&(e._extra[a]=d[a])}),this._cached=d.cached||!1),this.execute()}function d(){this._execution=null,this._skip=0,this._limit=null,this._countQuery=null,this._countTotal=null,this._batchSize=null}function e(a,b){return 0===a._limit?a=a.clone():0===b?(a=a.clone(),a._limit=0):null===a._limit?(a=a.clone(),a._limit=b):(a=a.clone(),bc&&(b=c);else if(this._skip<0){var d=-this._skip;c>d&&(b=c-d)}null!==this._limit&&b+this._limita){var b=new q;throw b.errorNum=p.ERROR_BAD_PARAMETER,b.errorMessage="limit must be non-negative",b}return e(this,a)},d.prototype.skip=function(a){var b,c;if((void 0===a||null===a)&&(a=0),null!==this._execution)throw"query is already executing";return null===this._limit?(b=this.clone(),null===this._skip||0===this._skip?b._skip=a:b._skip+=a):(c=this.clone().toArray(),b=new l(c),b._skip=a,b._countTotal=c._countTotal),b},d.prototype.toArray=function(){var a;for(this.execute(),a=[];this.hasNext();)a.push(this.next());return a},d.prototype.getBatchSize=function(){return this._batchSize},d.prototype.setBatchSize=function(a){a>=1&&(this._batchSize=a)},d.prototype.count=function(a){return this.execute(),void 0!==a&&a?this._countQuery:this._countTotal},d.prototype.hasNext=function(){return this.execute(),this._execution.hasNext()},d.prototype.next=function(){return this.execute(),this._execution.next()},d.prototype.dispose=function(){null!==this._execution&&this._execution.dispose(),this._execution=null,this._countQuery=null,this._countTotal=null},f.prototype=new d,f.prototype.constructor=f,f.prototype.clone=function(){var a;return a=new f(this._collection),a._skip=this._skip,a._limit=this._limit,a},f.prototype._PRINT=function(a){var b;b="SimpleQueryAll("+this._collection.name()+")",null!==this._skip&&0!==this._skip&&(b+=".skip("+this._skip+")"),null!==this._limit&&(b+=".limit("+this._limit+")"),a.output+=b},l=function(a){this._documents=a},l.prototype=new d,l.prototype.constructor=l,l.prototype.clone=function(){var a;return a=new l(this._documents),a._skip=this._skip,a._limit=this._limit,a},l.prototype.execute=function(){null===this._execution&&(null===this._skip&&(this._skip=0),this._execution=new c(this._documents,this._skip,this._limit))},l.prototype._PRINT=function(a){var b;b="SimpleQueryArray(documents)",null!==this._skip&&0!==this._skip&&(b+=".skip("+this._skip+")"),null!==this._limit&&(b+=".limit("+this._limit+")"),a.output+=b},g.prototype=new d,g.prototype.constructor=g,g.prototype.clone=function(){var a;return a=new g(this._collection,this._example),a._skip=this._skip,a._limit=this._limit,a._type=this._type,a._index=this._index,a},g.prototype._PRINT=function(a){var b;b="SimpleQueryByExample("+this._collection.name()+")",null!==this._skip&&0!==this._skip&&(b+=".skip("+this._skip+")"),null!==this._limit&&(b+=".limit("+this._limit+")"),a.output+=b},h.prototype=new d,h.prototype.constructor=h,h.prototype.clone=function(){var a;return a=new h(this._collection,this._condition),a._skip=this._skip,a._limit=this._limit,a._type=this._type,a._index=this._index,a},h.prototype._PRINT=function(a){var b;b="SimpleQueryByCondition("+this._collection.name()+")",null!==this._skip&&0!==this._skip&&(b+=".skip("+this._skip+")"),null!==this._limit&&(b+=".limit("+this._limit+")"),a.output+=b},i.prototype=new d,i.prototype.constructor=i,i.prototype.clone=function(){var a;return a=new i(this._collection,this._attribute,this._left,this._right,this._type),a._skip=this._skip,a._limit=this._limit,a},i.prototype._PRINT=function(a){var b;b="SimpleQueryRange("+this._collection.name()+")",null!==this._skip&&0!==this._skip&&(b+=".skip("+this._skip+")"),null!==this._limit&&(b+=".limit("+this._limit+")"),a.output+=b},j.prototype._PRINT=function(a){var b;b="GeoIndex("+this._collection.name()+", "+this._index+")",a.output+=b},j.prototype.near=function(a,b){return new m(this._collection,a,b,this._index)},j.prototype.within=function(a,b,c){return new n(this._collection,a,b,c,this._index)},j.prototype.withinRectangle=function(a,b,c,d){return new o(this._collection,a,b,c,d,this._index)},m=function(a,b,c,d){var e,f;if(this._collection=a,this._latitude=b,this._longitude=c,this._index=void 0===d?null:d,this._distance=null,void 0===d)for(e=a.getIndexes(),f=0;f0&&(this._batchSize=a);var b={collection:this._collection.name()};null!==this._limit&&(b.limit=this._limit),null!==this._skip&&(b.skip=this._skip),null!==this._batchSize&&(b.batchSize=this._batchSize);var e=this._collection._database._connection.PUT("/_api/simple/all",JSON.stringify(b));c.checkRequestResult(e),this._execution=new d(this._collection._database,e),e.hasOwnProperty("count")&&(this._countQuery=e.count)}},i.prototype.execute=function(a){if(null===this._execution){void 0!==a&&a>0&&(this._batchSize=a);var b={collection:this._collection.name(),example:this._example};null!==this._limit&&(b.limit=this._limit),null!==this._skip&&(b.skip=this._skip),null!==this._batchSize&&(b.batchSize=this._batchSize);var e="by-example";if(this.hasOwnProperty("_type"))switch(b.index=this._index,this._type){case"hash":e="by-example-hash";break;case"skiplist":e="by-example-skiplist"}var f=this._collection._database._connection.PUT("/_api/simple/"+e,JSON.stringify(b));c.checkRequestResult(f),this._execution=new d(this._collection._database,f),f.hasOwnProperty("count")&&(this._countQuery=f.count,this._countTotal=f.count)}},j.prototype.execute=function(a){if(null===this._execution){void 0!==a&&a>0&&(this._batchSize=a);var b={collection:this._collection.name(),condition:this._condition};null!==this._limit&&(b.limit=this._limit),null!==this._skip&&(b.skip=this._skip),null!==this._batchSize&&(b.batchSize=this._batchSize);var e="by-condition";if(this.hasOwnProperty("_type"))switch(b.index=this._index,this._type){case"skiplist":e="by-condition-skiplist"}var f=this._collection._database._connection.PUT("/_api/simple/"+e,JSON.stringify(b));c.checkRequestResult(f),this._execution=new d(this._collection._database,f),f.hasOwnProperty("count")&&(this._countQuery=f.count,this._countTotal=f.count)}},n.prototype.execute=function(a){if(null===this._execution){void 0!==a&&a>0&&(this._batchSize=a);var b={collection:this._collection.name(),attribute:this._attribute,right:this._right,left:this._left,closed:1===this._type};null!==this._limit&&(b.limit=this._limit),null!==this._skip&&(b.skip=this._skip),null!==this._batchSize&&(b.batchSize=this._batchSize);var e=this._collection._database._connection.PUT("/_api/simple/range",JSON.stringify(b));c.checkRequestResult(e),this._execution=new d(this._collection._database,e),e.hasOwnProperty("count")&&(this._countQuery=e.count)}},m.prototype.execute=function(a){if(null===this._execution){void 0!==a&&a>0&&(this._batchSize=a);var b={collection:this._collection.name(),latitude:this._latitude,longitude:this._longitude};null!==this._limit&&(b.limit=this._limit),null!==this._skip&&(b.skip=this._skip),null!==this._index&&(b.geo=this._index),null!==this._distance&&(b.distance=this._distance),null!==this._batchSize&&(b.batchSize=this._batchSize);var e=this._collection._database._connection.PUT("/_api/simple/near",JSON.stringify(b));c.checkRequestResult(e),this._execution=new d(this._collection._database,e),e.hasOwnProperty("count")&&(this._countQuery=e.count)}},o.prototype.execute=function(a){if(null===this._execution){void 0!==a&&a>0&&(this._batchSize=a);var b={collection:this._collection.name(),latitude:this._latitude,longitude:this._longitude,radius:this._radius};null!==this._limit&&(b.limit=this._limit),null!==this._skip&&(b.skip=this._skip),null!==this._index&&(b.geo=this._index),null!==this._distance&&(b.distance=this._distance),null!==this._batchSize&&(b.batchSize=this._batchSize);var e=this._collection._database._connection.PUT("/_api/simple/within",JSON.stringify(b));c.checkRequestResult(e),this._execution=new d(this._collection._database,e),e.hasOwnProperty("count")&&(this._countQuery=e.count)}},p.prototype.execute=function(a){if(null===this._execution){void 0!==a&&a>0&&(this._batchSize=a);var b={collection:this._collection.name(),latitude1:this._latitude1,longitude1:this._longitude1,latitude2:this._latitude2,longitude2:this._longitude2};null!==this._limit&&(b.limit=this._limit),null!==this._skip&&(b.skip=this._skip),null!==this._index&&(b.geo=this._index),null!==this._distance&&(b.distance=this._distance),null!==this._batchSize&&(b.batchSize=this._batchSize);var e=this._collection._database._connection.PUT("/_api/simple/within-rectangle",JSON.stringify(b));c.checkRequestResult(e),this._execution=new d(this._collection._database,e),e.hasOwnProperty("count")&&(this._countQuery=e.count)}},k.prototype.execute=function(a){if(null===this._execution){void 0!==a&&a>0&&(this._batchSize=a);var b={collection:this._collection.name(),attribute:this._attribute,query:this._query};null!==this._limit&&(b.limit=this._limit),null!==this._index&&(b.index=this._index),null!==this._skip&&(b.skip=this._skip),null!==this._batchSize&&(b.batchSize=this._batchSize);var e=this._collection._database._connection.PUT("/_api/simple/fulltext",JSON.stringify(b));c.checkRequestResult(e),this._execution=new d(this._collection._database,e),e.hasOwnProperty("count")&&(this._countQuery=e.count)}},a.GeneralArrayCursor=f,a.SimpleQueryAll=g,a.SimpleQueryArray=h,a.SimpleQueryByExample=i,a.SimpleQueryByCondition=j,a.SimpleQueryFulltext=k,a.SimpleQueryGeo=l,a.SimpleQueryNear=m,a.SimpleQueryRange=n,a.SimpleQueryWithin=o,a.SimpleQueryWithinRectangle=p}),module.define("@arangodb/tutorial",function(a,b){var c=0,d="Type 'tutorial' again to get to the next chapter.",e=[{title:"Welcome to the tutorial!",text:"This is a user-interactive tutorial on ArangoDB and the ArangoDB shell.\nIt 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.\nSo 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\nNote: 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\nPlease 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 still 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'.\nThe '_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.\nThe '_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\nNote 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\");"}];a._PRINT=function(a){function b(a){return a.replace(/\n {2}(.+?)(?=\n)/g,"\n "+f.COLOR_MAGENTA+"$1"+f.COLOR_RESET)}var f=require("internal").COLORS,g=f.COLOR_BOLD_BLUE+(c+1)+". "+e[c].title+f.COLOR_RESET;a.output+="\n\n"+g+"\n\n"+b(e[c].text+"\n")+"\n",++c,c>=e.length?(a.output+="Congratulations! You finished the tutorial.\n",c=0):a.output+=d+"\n"}}),module.define("underscore",function(a,b){(function(){function c(a){function b(b,c,d,e,f,g){for(;f>=0&&g>f;f+=a){var h=e?e[f]:f;d=c(d,b[h],h,b)}return d}return function(c,d,e,f){d=v(d,f,4);var g=!C(c)&&u.keys(c),h=(g||c).length,i=a>0?0:h-1;return arguments.length<3&&(e=c[g?g[i]:i],i+=a),b(c,d,e,g,i,h)}}function d(a){return function(b,c,d){c=w(c,d);for(var e=B(b),f=a>0?0:e-1;f>=0&&e>f;f+=a)if(c(b[f],f,b))return f;return-1}}function e(a,b,c){return function(d,e,f){var g=0,h=B(d);if("number"==typeof f)a>0?g=f>=0?f:Math.max(f+h,g):h=f>=0?Math.min(f+1,h):f+h+1;else if(c&&f&&h)return f=c(d,e),d[f]===e?f:-1;if(e!==e)return f=b(m.call(d,g,h),u.isNaN),f>=0?f+g:-1;for(f=a>0?g:h-1;f>=0&&h>f;f+=a)if(d[f]===e)return f;return-1}}function f(a,b){var c=H.length,d=a.constructor,e=u.isFunction(d)&&d.prototype||j,f="constructor";for(u.has(a,f)&&!u.contains(b,f)&&b.push(f);c--;)f=H[c],f in a&&a[f]!==e[f]&&!u.contains(b,f)&&b.push(f)}var g=this,h=g._,i=Array.prototype,j=Object.prototype,k=Function.prototype,l=i.push,m=i.slice,n=j.toString,o=j.hasOwnProperty,p=Array.isArray,q=Object.keys,r=k.bind,s=Object.create,t=function(){},u=function S(a){return a instanceof S?a:this instanceof S?void(this._wrapped=a):new S(a)};"undefined"!=typeof a?("undefined"!=typeof b&&b.exports&&(a=b.exports=u),a._=u):g._=u,u.VERSION="1.8.3";var v=function(a,b,c){if(void 0===b)return a;switch(null==c?3:c){case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)}}return function(){return a.apply(b,arguments)}},w=function(a,b,c){return null==a?u.identity:u.isFunction(a)?v(a,b,c):u.isObject(a)?u.matcher(a):u.property(a)};u.iteratee=function(a,b){return w(a,b,1/0)};var x=function(a,b){return function(c){var d=arguments.length;if(2>d||null==c)return c;for(var e=1;d>e;e++)for(var f=arguments[e],g=a(f),h=g.length,i=0;h>i;i++){var j=g[i];b&&void 0!==c[j]||(c[j]=f[j])}return c}},y=function(a){if(!u.isObject(a))return{};if(s)return s(a);t.prototype=a;var b=new t;return t.prototype=null,b},z=function(a){return function(b){return null==b?void 0:b[a]}},A=Math.pow(2,53)-1,B=z("length"),C=function(a){var b=B(a);return"number"==typeof b&&b>=0&&A>=b};u.each=u.forEach=function(a,b,c){b=v(b,c);var d,e;if(C(a))for(d=0,e=a.length;e>d;d++)b(a[d],d,a);else{var f=u.keys(a);for(d=0,e=f.length;e>d;d++)b(a[f[d]],f[d],a)}return a},u.map=u.collect=function(a,b,c){b=w(b,c);for(var d=!C(a)&&u.keys(a),e=(d||a).length,f=Array(e),g=0;e>g;g++){var h=d?d[g]:g;f[g]=b(a[h],h,a)}return f},u.reduce=u.foldl=u.inject=c(1),u.reduceRight=u.foldr=c(-1),u.find=u.detect=function(a,b,c){var d;return d=C(a)?u.findIndex(a,b,c):u.findKey(a,b,c),void 0!==d&&-1!==d?a[d]:void 0},u.filter=u.select=function(a,b,c){var d=[];return b=w(b,c),u.each(a,function(a,c,e){b(a,c,e)&&d.push(a)}),d},u.reject=function(a,b,c){return u.filter(a,u.negate(w(b)),c)},u.every=u.all=function(a,b,c){b=w(b,c);for(var d=!C(a)&&u.keys(a),e=(d||a).length,f=0;e>f;f++){var g=d?d[f]:f;if(!b(a[g],g,a))return!1}return!0},u.some=u.any=function(a,b,c){b=w(b,c);for(var d=!C(a)&&u.keys(a),e=(d||a).length,f=0;e>f;f++){var g=d?d[f]:f;if(b(a[g],g,a))return!0}return!1},u.contains=u.includes=u.include=function(a,b,c,d){return C(a)||(a=u.values(a)),("number"!=typeof c||d)&&(c=0),u.indexOf(a,b,c)>=0},u.invoke=function(a,b){var c=m.call(arguments,2),d=u.isFunction(b);return u.map(a,function(a){var e=d?b:a[b];return null==e?e:e.apply(a,c)})},u.pluck=function(a,b){return u.map(a,u.property(b))},u.where=function(a,b){return u.filter(a,u.matcher(b))},u.findWhere=function(a,b){return u.find(a,u.matcher(b))},u.max=function(a,b,c){var d,e,f=-(1/0),g=-(1/0);if(null==b&&null!=a){a=C(a)?a:u.values(a);for(var h=0,i=a.length;i>h;h++)d=a[h],d>f&&(f=d)}else b=w(b,c),u.each(a,function(a,c,d){e=b(a,c,d),(e>g||e===-(1/0)&&f===-(1/0))&&(f=a,g=e)});return f},u.min=function(a,b,c){var d,e,f=1/0,g=1/0;if(null==b&&null!=a){a=C(a)?a:u.values(a);for(var h=0,i=a.length;i>h;h++)d=a[h],f>d&&(f=d)}else b=w(b,c),u.each(a,function(a,c,d){e=b(a,c,d),(g>e||e===1/0&&f===1/0)&&(f=a,g=e)});return f},u.shuffle=function(a){for(var b,c=C(a)?a:u.values(a),d=c.length,e=Array(d),f=0;d>f;f++)b=u.random(0,f),b!==f&&(e[f]=e[b]),e[b]=c[f];return e},u.sample=function(a,b,c){return null==b||c?(C(a)||(a=u.values(a)),a[u.random(a.length-1)]):u.shuffle(a).slice(0,Math.max(0,b))},u.sortBy=function(a,b,c){return b=w(b,c),u.pluck(u.map(a,function(a,c,d){return{value:a,index:c,criteria:b(a,c,d)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var D=function(a){return function(b,c,d){var e={};return c=w(c,d),u.each(b,function(d,f){var g=c(d,f,b);a(e,d,g)}),e}};u.groupBy=D(function(a,b,c){u.has(a,c)?a[c].push(b):a[c]=[b]}),u.indexBy=D(function(a,b,c){a[c]=b}),u.countBy=D(function(a,b,c){u.has(a,c)?a[c]++:a[c]=1}),u.toArray=function(a){return a?u.isArray(a)?m.call(a):C(a)?u.map(a,u.identity):u.values(a):[]},u.size=function(a){return null==a?0:C(a)?a.length:u.keys(a).length},u.partition=function(a,b,c){b=w(b,c);var d=[],e=[];return u.each(a,function(a,c,f){(b(a,c,f)?d:e).push(a)}),[d,e]},u.first=u.head=u.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:u.initial(a,a.length-b)},u.initial=function(a,b,c){return m.call(a,0,Math.max(0,a.length-(null==b||c?1:b)))},u.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:u.rest(a,Math.max(0,a.length-b))},u.rest=u.tail=u.drop=function(a,b,c){return m.call(a,null==b||c?1:b)},u.compact=function(a){return u.filter(a,u.identity)};var E=function T(a,b,c,d){for(var e=[],f=0,g=d||0,h=B(a);h>g;g++){var i=a[g];if(C(i)&&(u.isArray(i)||u.isArguments(i))){b||(i=T(i,b,c));var j=0,k=i.length;for(e.length+=k;k>j;)e[f++]=i[j++]}else c||(e[f++]=i)}return e};u.flatten=function(a,b){return E(a,b,!1)},u.without=function(a){return u.difference(a,m.call(arguments,1))},u.uniq=u.unique=function(a,b,c,d){u.isBoolean(b)||(d=c,c=b,b=!1),null!=c&&(c=w(c,d));for(var e=[],f=[],g=0,h=B(a);h>g;g++){var i=a[g],j=c?c(i,g,a):i;b?(g&&f===j||e.push(i),f=j):c?u.contains(f,j)||(f.push(j),e.push(i)):u.contains(e,i)||e.push(i)}return e},u.union=function(){return u.uniq(E(arguments,!0,!0))},u.intersection=function(a){for(var b=[],c=arguments.length,d=0,e=B(a);e>d;d++){var f=a[d];if(!u.contains(b,f)){for(var g=1;c>g&&u.contains(arguments[g],f);g++);g===c&&b.push(f)}}return b},u.difference=function(a){var b=E(arguments,!0,!0,1);return u.filter(a,function(a){return!u.contains(b,a)})},u.zip=function(){return u.unzip(arguments)},u.unzip=function(a){for(var b=a&&u.max(a,B).length||0,c=Array(b),d=0;b>d;d++)c[d]=u.pluck(a,d);return c},u.object=function(a,b){for(var c={},d=0,e=B(a);e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},u.findIndex=d(1),u.findLastIndex=d(-1),u.sortedIndex=function(a,b,c,d){c=w(c,d,1);for(var e=c(b),f=0,g=B(a);g>f;){var h=Math.floor((f+g)/2);c(a[h])f;f++,a+=c)e[f]=a;return e};var F=function(a,b,c,d,e){if(!(d instanceof b))return a.apply(c,e);var f=y(a.prototype),g=a.apply(f,e);return u.isObject(g)?g:f};u.bind=function(a,b){if(r&&a.bind===r)return r.apply(a,m.call(arguments,1));if(!u.isFunction(a))throw new TypeError("Bind must be called on a function");var c=m.call(arguments,2),d=function e(){return F(a,e,b,this,c.concat(m.call(arguments)))};return d},u.partial=function(a){var b=m.call(arguments,1),c=function d(){for(var c=0,e=b.length,f=Array(e),g=0;e>g;g++)f[g]=b[g]===u?arguments[c++]:b[g];for(;c=d)throw new Error("bindAll must be passed function names");for(b=1;d>b;b++)c=arguments[b],a[c]=u.bind(a[c],a);return a},u.memoize=function(a,b){var c=function d(c){var e=d.cache,f=""+(b?b.apply(this,arguments):c);return u.has(e,f)||(e[f]=a.apply(this,arguments)),e[f]};return c.cache={},c; },u.delay=function(a,b){var c=m.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},u.defer=u.partial(u.delay,u,1),u.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:u.now(),g=null,f=a.apply(d,e),g||(d=e=null)};return function(){var j=u.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k||k>b?(g&&(clearTimeout(g),g=null),h=j,f=a.apply(d,e),g||(d=e=null)):g||c.trailing===!1||(g=setTimeout(i,k)),f}},u.debounce=function(a,b,c){var d,e,f,g,h,i=function j(){var i=u.now()-g;b>i&&i>=0?d=setTimeout(j,b-i):(d=null,c||(h=a.apply(f,e),d||(f=e=null)))};return function(){f=this,e=arguments,g=u.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},u.wrap=function(a,b){return u.partial(b,a)},u.negate=function(a){return function(){return!a.apply(this,arguments)}},u.compose=function(){var a=arguments,b=a.length-1;return function(){for(var c=b,d=a[b].apply(this,arguments);c--;)d=a[c].call(this,d);return d}},u.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},u.before=function(a,b){var c;return function(){return--a>0&&(c=b.apply(this,arguments)),1>=a&&(b=null),c}},u.once=u.partial(u.before,2);var G=!{toString:null}.propertyIsEnumerable("toString"),H=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];u.keys=function(a){if(!u.isObject(a))return[];if(q)return q(a);var b=[];for(var c in a)u.has(a,c)&&b.push(c);return G&&f(a,b),b},u.allKeys=function(a){if(!u.isObject(a))return[];var b=[];for(var c in a)b.push(c);return G&&f(a,b),b},u.values=function(a){for(var b=u.keys(a),c=b.length,d=Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},u.mapObject=function(a,b,c){b=w(b,c);for(var d,e=u.keys(a),f=e.length,g={},h=0;f>h;h++)d=e[h],g[d]=b(a[d],d,a);return g},u.pairs=function(a){for(var b=u.keys(a),c=b.length,d=Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},u.invert=function(a){for(var b={},c=u.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},u.functions=u.methods=function(a){var b=[];for(var c in a)u.isFunction(a[c])&&b.push(c);return b.sort()},u.extend=x(u.allKeys),u.extendOwn=u.assign=x(u.keys),u.findKey=function(a,b,c){b=w(b,c);for(var d,e=u.keys(a),f=0,g=e.length;g>f;f++)if(d=e[f],b(a[d],d,a))return d},u.pick=function(a,b,c){var d,e,f={},g=a;if(null==g)return f;u.isFunction(b)?(e=u.allKeys(g),d=v(b,c)):(e=E(arguments,!1,!1,1),d=function(a,b,c){return b in c},g=Object(g));for(var h=0,i=e.length;i>h;h++){var j=e[h],k=g[j];d(k,j,g)&&(f[j]=k)}return f},u.omit=function(a,b,c){if(u.isFunction(b))b=u.negate(b);else{var d=u.map(E(arguments,!1,!1,1),String);b=function(a,b){return!u.contains(d,b)}}return u.pick(a,b,c)},u.defaults=x(u.allKeys,!0),u.create=function(a,b){var c=y(a);return b&&u.extendOwn(c,b),c},u.clone=function(a){return u.isObject(a)?u.isArray(a)?a.slice():u.extend({},a):a},u.tap=function(a,b){return b(a),a},u.isMatch=function(a,b){var c=u.keys(b),d=c.length;if(null==a)return!d;for(var e=Object(a),f=0;d>f;f++){var g=c[f];if(b[g]!==e[g]||!(g in e))return!1}return!0};var I=function U(a,b,c,d){if(a===b)return 0!==a||1/a===1/b;if(null==a||null==b)return a===b;a instanceof u&&(a=a._wrapped),b instanceof u&&(b=b._wrapped);var e=n.call(a);if(e!==n.call(b))return!1;switch(e){case"[object RegExp]":case"[object String]":return""+a==""+b;case"[object Number]":return+a!==+a?+b!==+b:0===+a?1/+a===1/b:+a===+b;case"[object Date]":case"[object Boolean]":return+a===+b}var f="[object Array]"===e;if(!f){if("object"!=typeof a||"object"!=typeof b)return!1;var g=a.constructor,h=b.constructor;if(g!==h&&!(u.isFunction(g)&&g instanceof g&&u.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1}c=c||[],d=d||[];for(var i=c.length;i--;)if(c[i]===a)return d[i]===b;if(c.push(a),d.push(b),f){if(i=a.length,i!==b.length)return!1;for(;i--;)if(!U(a[i],b[i],c,d))return!1}else{var j,k=u.keys(a);if(i=k.length,u.keys(b).length!==i)return!1;for(;i--;)if(j=k[i],!u.has(b,j)||!U(a[j],b[j],c,d))return!1}return c.pop(),d.pop(),!0};u.isEqual=function(a,b){return I(a,b)},u.isEmpty=function(a){return null==a?!0:C(a)&&(u.isArray(a)||u.isString(a)||u.isArguments(a))?0===a.length:0===u.keys(a).length},u.isElement=function(a){return!(!a||1!==a.nodeType)},u.isArray=p||function(a){return"[object Array]"===n.call(a)},u.isObject=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a},u.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(a){u["is"+a]=function(b){return n.call(b)==="[object "+a+"]"}}),u.isArguments(arguments)||(u.isArguments=function(a){return u.has(a,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(u.isFunction=function(a){return"function"==typeof a||!1}),u.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},u.isNaN=function(a){return u.isNumber(a)&&a!==+a},u.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"===n.call(a)},u.isNull=function(a){return null===a},u.isUndefined=function(a){return void 0===a},u.has=function(a,b){return null!=a&&o.call(a,b)},u.noConflict=function(){return g._=h,this},u.identity=function(a){return a},u.constant=function(a){return function(){return a}},u.noop=function(){},u.property=z,u.propertyOf=function(a){return null==a?function(){}:function(b){return a[b]}},u.matcher=u.matches=function(a){return a=u.extendOwn({},a),function(b){return u.isMatch(b,a)}},u.times=function(a,b,c){var d=Array(Math.max(0,a));b=v(b,c,1);for(var e=0;a>e;e++)d[e]=b(e);return d},u.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},u.now=Date.now||function(){return(new Date).getTime()};var J={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},K=u.invert(J),L=function(a){var b=function(b){return a[b]},c="(?:"+u.keys(a).join("|")+")",d=RegExp(c),e=RegExp(c,"g");return function(a){return a=null==a?"":""+a,d.test(a)?a.replace(e,b):a}};u.escape=L(J),u.unescape=L(K),u.result=function(a,b,c){var d=null==a?void 0:a[b];return void 0===d&&(d=c),u.isFunction(d)?d.call(a):d};var M=0;u.uniqueId=function(a){var b=++M+"";return a?a+b:b},u.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var N=/(.)^/,O={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},P=/\\|'|\r|\n|\u2028|\u2029/g,Q=function(a){return"\\"+O[a]};u.template=function(a,b,c){!b&&c&&(b=c),b=u.defaults({},b,u.templateSettings);var d=RegExp([(b.escape||N).source,(b.interpolate||N).source,(b.evaluate||N).source].join("|")+"|$","g"),e=0,f="__p+='";a.replace(d,function(b,c,d,g,h){return f+=a.slice(e,h).replace(P,Q),e=h+b.length,c?f+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'":d?f+="'+\n((__t=("+d+"))==null?'':__t)+\n'":g&&(f+="';\n"+g+"\n__p+='"),b}),f+="';\n",b.variable||(f="with(obj||{}){\n"+f+"}\n"),f="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+f+"return __p;\n";try{var g=new Function(b.variable||"obj","_",f)}catch(h){throw h.source=f,h}var i=function(a){return g.call(this,a,u)},j=b.variable||"obj";return i.source="function("+j+"){\n"+f+"}",i},u.chain=function(a){var b=u(a);return b._chain=!0,b};var R=function(a,b){return a._chain?u(b).chain():b};u.mixin=function(a){u.each(u.functions(a),function(b){var c=u[b]=a[b];u.prototype[b]=function(){var a=[this._wrapped];return l.apply(a,arguments),R(this,c.apply(u,a))}})},u.mixin(u),u.each(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=i[a];u.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!==a&&"splice"!==a||0!==c.length||delete c[0],R(this,c)}}),u.each(["concat","join","slice"],function(a){var b=i[a];u.prototype[a]=function(){return R(this,b.apply(this._wrapped,arguments))}}),u.prototype.value=function(){return this._wrapped},u.prototype.valueOf=u.prototype.toJSON=u.prototype.value,u.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return u})}).call(this)}),global.DEFINE_MODULE("internal",function(){function a(a){if(i.hasOwnProperty(a))return i[a];var b,c=a.charCodeAt(0);return b=16>c?"\\u000":256>c?"\\u00":4096>c?"\\u0":"\\u",b+=c.toString(16),i[a]=b,b}function b(b){return'"'+b.replace(n,a)+'"'}function c(a){var b,c="";if(a.prettyPrint)for(c+="\n",b=0;b=b.emit&&(h.output(b.output),b.output=""),b.path=i,f=", "}b.level=e-1,b.output+=" ",c(b),d&&(b.output+=j.COLOR_PUNCTUATION),b.output+="]",d&&(b.output+=j.COLOR_RESET)}}function e(a,d){var e=d.useColor,f=" ";e&&(d.output+=j.COLOR_PUNCTUATION),d.output+="{",e&&(d.output+=j.COLOR_RESET);var g=d.level+1;d.level=g;var i;try{i=Object.keys(a)}catch(k){i=[]}for(var l=0,n=i.length;n>l;++l){var o=i[l],p=a[o];e&&(d.output+=j.COLOR_PUNCTUATION),d.output+=f,e&&(d.output+=j.COLOR_RESET),c(d),e&&(d.output+=j.COLOR_INDEX),d.output+=b(o),e&&(d.output+=j.COLOR_RESET),d.output+=" : ";var q=d.path;d.path+="["+o+"]",m(p,d),d.path=q,f=", ",d.emit&&d.output.length>=d.emit&&(h.output(d.output),d.output="")}d.level=g-1,d.output+=" ",c(d),e&&(d.output+=j.COLOR_PUNCTUATION),d.output+="}",e&&(d.output+=j.COLOR_RESET)}function f(){for(var a=0;a0&&a(" "),"string"==typeof arguments[b])a(arguments[b]);else{var c={customInspect:!0,emit:16384,level:0,limitString:80,names:[],output:"",path:"~",prettyPrint:l,seen:[],showFunction:!1,useColor:k,useToString:!0};m(arguments[b],c),a(c.output)}a("\n")}var h={};global.ArangoError?(h.ArangoError=global.ArangoError,delete global.ArangoError):(h.ArangoError=function(a){void 0!==a&&(this.error=a.error,this.code=a.code,this.errorNum=a.errorNum,this.errorMessage=a.errorMessage),this.message=this.toString()},h.ArangoError.prototype=new Error),h.ArangoError.prototype._PRINT=function(a){a.output+=this.toString()},h.ArangoError.prototype.toString=function(){var a=this.errorNum,b=this.errorMessage||this.message;return"[ArangoError "+a+": "+b+"]"},global.SleepAndRequeue&&(h.SleepAndRequeue=global.SleepAndRequeue,delete global.SleepAndRequeue,h.SleepAndRequeue.prototype._PRINT=function(a){a.output+=this.toString()},h.SleepAndRequeue.prototype.toString=function(){return"[SleepAndRequeue sleep: "+this.sleep+"]"}),h.threadNumber=0,global.THREAD_NUMBER&&(h.threadNumber=global.THREAD_NUMBER,delete global.THREAD_NUMBER),h.developmentMode=!1,global.LOGFILE_PATH&&(h.logfilePath=global.LOGFILE_PATH,delete global.LOGFILE_PATH),h.quiet=!1,global.ARANGO_QUIET&&(h.quiet=global.ARANGO_QUIET,delete global.ARANGO_QUIET),h.valgrind=!1,global.VALGRIND&&(h.valgrind=global.VALGRIND,delete global.VALGRIND),h.coverage=!1,global.COVERAGE&&(h.coverage=global.COVERAGE,delete global.COVERAGE),h.version="unknown",global.VERSION&&(h.version=global.VERSION,delete global.VERSION),h.platform="unknown",global.SYS_PLATFORM&&(h.platform=global.SYS_PLATFORM,delete global.SYS_PLATFORM),h.bytesSentDistribution=[],global.BYTES_SENT_DISTRIBUTION&&(h.bytesSentDistribution=global.BYTES_SENT_DISTRIBUTION,delete global.BYTES_SENT_DISTRIBUTION),h.bytesReceivedDistribution=[],global.BYTES_RECEIVED_DISTRIBUTION&&(h.bytesReceivedDistribution=global.BYTES_RECEIVED_DISTRIBUTION,delete global.BYTES_RECEIVED_DISTRIBUTION),h.connectionTimeDistribution=[],global.CONNECTION_TIME_DISTRIBUTION&&(h.connectionTimeDistribution=global.CONNECTION_TIME_DISTRIBUTION,delete global.CONNECTION_TIME_DISTRIBUTION),h.requestTimeDistribution=[],global.REQUEST_TIME_DISTRIBUTION&&(h.requestTimeDistribution=global.REQUEST_TIME_DISTRIBUTION,delete global.REQUEST_TIME_DISTRIBUTION),h.startupPath="",global.STARTUP_PATH&&(h.startupPath=global.STARTUP_PATH,delete global.STARTUP_PATH),""===h.startupPath&&(h.startupPath="."),global.CONFIGURE_ENDPOINT&&(h.configureEndpoint=global.CONFIGURE_ENDPOINT,delete global.CONFIGURE_ENDPOINT),global.REMOVE_ENDPOINT&&(h.removeEndpoint=global.REMOVE_ENDPOINT,delete global.REMOVE_ENDPOINT),global.LIST_ENDPOINTS&&(h.listEndpoints=global.LIST_ENDPOINTS,delete global.LIST_ENDPOINTS),global.SYS_BASE64DECODE&&(h.base64Decode=global.SYS_BASE64DECODE,delete global.SYS_BASE64DECODE),global.SYS_BASE64ENCODE&&(h.base64Encode=global.SYS_BASE64ENCODE,delete global.SYS_BASE64ENCODE),global.SYS_DEBUG_SEGFAULT&&(h.debugSegfault=global.SYS_DEBUG_SEGFAULT,delete global.SYS_DEBUG_SEGFAULT),global.SYS_DEBUG_SET_FAILAT&&(h.debugSetFailAt=global.SYS_DEBUG_SET_FAILAT,delete global.SYS_DEBUG_SET_FAILAT),global.SYS_DEBUG_REMOVE_FAILAT&&(h.debugRemoveFailAt=global.SYS_DEBUG_REMOVE_FAILAT,delete global.SYS_DEBUG_REMOVE_FAILAT),global.SYS_DEBUG_CLEAR_FAILAT&&(h.debugClearFailAt=global.SYS_DEBUG_CLEAR_FAILAT,delete global.SYS_DEBUG_CLEAR_FAILAT),global.SYS_DEBUG_CAN_USE_FAILAT&&(h.debugCanUseFailAt=global.SYS_DEBUG_CAN_USE_FAILAT,delete global.SYS_DEBUG_CAN_USE_FAILAT),global.SYS_DOWNLOAD&&(h.download=global.SYS_DOWNLOAD,delete global.SYS_DOWNLOAD),global.SYS_EXECUTE&&(h.executeScript=global.SYS_EXECUTE,delete global.SYS_EXECUTE),global.SYS_GET_CURRENT_REQUEST&&(h.getCurrentRequest=global.SYS_GET_CURRENT_REQUEST,delete global.SYS_GET_CURRENT_REQUEST),global.SYS_GET_CURRENT_RESPONSE&&(h.getCurrentResponse=global.SYS_GET_CURRENT_RESPONSE,delete global.SYS_GET_CURRENT_RESPONSE),h.extend=function(a,b){return Object.getOwnPropertyNames(b).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))}),a},global.SYS_LOAD&&(h.load=global.SYS_LOAD,delete global.SYS_LOAD),global.SYS_LOG_LEVEL&&(h.logLevel=global.SYS_LOG_LEVEL,delete global.SYS_LOG_LEVEL),global.SYS_MD5&&(h.md5=global.SYS_MD5,delete global.SYS_MD5),global.SYS_GEN_RANDOM_NUMBERS&&(h.genRandomNumbers=global.SYS_GEN_RANDOM_NUMBERS,delete global.SYS_GEN_RANDOM_NUMBERS),global.SYS_GEN_RANDOM_ALPHA_NUMBERS&&(h.genRandomAlphaNumbers=global.SYS_GEN_RANDOM_ALPHA_NUMBERS,delete global.SYS_GEN_RANDOM_ALPHA_NUMBERS),global.SYS_GEN_RANDOM_SALT&&(h.genRandomSalt=global.SYS_GEN_RANDOM_SALT,delete global.SYS_GEN_RANDOM_SALT),global.SYS_HMAC&&(h.hmac=global.SYS_HMAC,delete global.SYS_HMAC),global.SYS_PBKDF2&&(h.pbkdf2=global.SYS_PBKDF2,delete global.SYS_PBKDF2),global.SYS_CREATE_NONCE&&(h.createNonce=global.SYS_CREATE_NONCE,delete global.SYS_CREATE_NONCE),global.SYS_CHECK_AND_MARK_NONCE&&(h.checkAndMarkNonce=global.SYS_CHECK_AND_MARK_NONCE,delete global.SYS_CHECK_AND_MARK_NONCE),global.SYS_OUTPUT&&(h.stdOutput=global.SYS_OUTPUT,h.output=h.stdOutput,delete global.SYS_OUTPUT),global.SYS_PARSE&&(h.parse=global.SYS_PARSE,delete global.SYS_PARSE),global.SYS_PARSE_FILE&&(h.parseFile=global.SYS_PARSE_FILE,delete global.SYS_PARSE_FILE),global.SYS_PROCESS_STATISTICS&&(h.processStatistics=global.SYS_PROCESS_STATISTICS,delete global.SYS_PROCESS_STATISTICS),global.SYS_RAND&&(h.rand=global.SYS_RAND,delete global.SYS_RAND),global.SYS_SHA512&&(h.sha512=global.SYS_SHA512,delete global.SYS_SHA512),global.SYS_SHA384&&(h.sha384=global.SYS_SHA384,delete global.SYS_SHA384),global.SYS_SHA256&&(h.sha256=global.SYS_SHA256,delete global.SYS_SHA256),global.SYS_SHA224&&(h.sha224=global.SYS_SHA224,delete global.SYS_SHA224),global.SYS_SHA1&&(h.sha1=global.SYS_SHA1,delete global.SYS_SHA1),global.SYS_SERVER_STATISTICS&&(h.serverStatistics=global.SYS_SERVER_STATISTICS,delete global.SYS_SERVER_STATISTICS),global.SYS_SLEEP&&(h.sleep=global.SYS_SLEEP,delete global.SYS_SLEEP),global.SYS_TIME&&(h.time=global.SYS_TIME,delete global.SYS_TIME),global.SYS_WAIT&&(h.wait=global.SYS_WAIT,delete global.SYS_WAIT),global.SYS_IMPORT_CSV_FILE&&(h.importCsvFile=global.SYS_IMPORT_CSV_FILE,delete global.SYS_IMPORT_CSV_FILE),global.SYS_IMPORT_JSON_FILE&&(h.importJsonFile=global.SYS_IMPORT_JSON_FILE,delete global.SYS_IMPORT_JSON_FILE),global.SYS_PROCESS_CSV_FILE&&(h.processCsvFile=global.SYS_PROCESS_CSV_FILE,delete global.SYS_PROCESS_CSV_FILE),global.SYS_PROCESS_JSON_FILE&&(h.processJsonFile=global.SYS_PROCESS_JSON_FILE,delete global.SYS_PROCESS_JSON_FILE),global.SYS_CLIENT_STATISTICS&&(h.clientStatistics=global.SYS_CLIENT_STATISTICS,delete global.SYS_CLIENT_STATISTICS),global.SYS_HTTP_STATISTICS&&(h.httpStatistics=global.SYS_HTTP_STATISTICS,delete global.SYS_HTTP_STATISTICS),global.SYS_EXECUTE_EXTERNAL&&(h.executeExternal=global.SYS_EXECUTE_EXTERNAL,delete global.SYS_EXECUTE_EXTERNAL),global.SYS_EXECUTE_EXTERNAL_AND_WAIT&&(h.executeExternalAndWait=global.SYS_EXECUTE_EXTERNAL_AND_WAIT,delete global.SYS_EXECUTE_EXTERNAL_AND_WAIT),global.SYS_KILL_EXTERNAL&&(h.killExternal=global.SYS_KILL_EXTERNAL,delete global.SYS_KILL_EXTERNAL),global.SYS_STATUS_EXTERNAL&&(h.statusExternal=global.SYS_STATUS_EXTERNAL,delete global.SYS_STATUS_EXTERNAL),global.SYS_REGISTER_TASK&&(h.registerTask=global.SYS_REGISTER_TASK,delete global.SYS_REGISTER_TASK),global.SYS_UNREGISTER_TASK&&(h.unregisterTask=global.SYS_UNREGISTER_TASK,delete global.SYS_UNREGISTER_TASK),global.SYS_GET_TASK&&(h.getTask=global.SYS_GET_TASK,delete global.SYS_GET_TASK),global.SYS_TEST_PORT&&(h.testPort=global.SYS_TEST_PORT,delete global.SYS_TEST_PORT),global.SYS_IS_IP&&(h.isIP=global.SYS_IS_IP,delete global.SYS_IS_IP),h.unitTests=function(){return global.SYS_UNIT_TESTS},h.setUnitTestsResult=function(a){global.SYS_UNIT_TESTS_RESULT=a},h.toArgv=function(a,b){"undefined"==typeof b&&(b=!1);var c=[];for(var d in a)if(a.hasOwnProperty(d))if("commandSwitches"===d){for(var e="",f=0;f1?c.push(a[d][f]):e+=a[d][f];e.length>0&&c.push(e)}else"flatCommands"===d?c=c.concat(a[d]):b?c.push("--"+d+"="+a[d]):(c.push("--"+d),a[d]!==!1?a[d]!==!0?c.push(a[d]):c.push("true"):c.push("false"));return c},h.parseArgv=function(a,b){function c(b,d,e){if(d.indexOf(":")>0){var f=d.indexOf(":"),h=d.slice(0,f);b.hasOwnProperty(h)||(b[h]={}),c(b[h],d.slice(f+1,d.length),e)}else"true"===a[g+1]?b[d]=!0:"false"===a[g+1]?b[d]=!1:isNaN(a[g+1])?b[d]=a[g+1]:b[d]=parseInt(a[g+1])}function d(a,b){a.hasOwnProperty("commandSwitches")||(a.commandSwitches=[]),a.commandSwitches.push(b)}function e(a,b){for(var c=0;c2&&"--"===j.slice(0,2)){var k=j.slice(2,j.length);a.length>g&&"-"!==a[g+1].slice(0,1)?(c(i,k,a[g+1]),g++):d(i,k)}else"--"===j?h=!0:j.length>1&&"-"===j.slice(0,1)?e(i,j.slice(1,j.length)):f(i,j)}return i},h.COLORS={},global.COLORS?(h.COLORS=global.COLORS,delete global.COLORS):["COLOR_RED","COLOR_BOLD_RED","COLOR_GREEN","COLOR_BOLD_GREEN","COLOR_BLUE","COLOR_BOLD_BLUE","COLOR_YELLOW","COLOR_BOLD_YELLOW","COLOR_WHITE","COLOR_BOLD_WHITE","COLOR_CYAN","COLOR_BOLD_CYAN","COLOR_MAGENTA","COLOR_BOLD_MAGENTA","COLOR_BLACK","COLOR_BOLD_BLACK","COLOR_BLINK","COLOR_BRIGHT","COLOR_RESET"].forEach(function(a){h.COLORS[a]=""}),h.COLORS.COLOR_PUNCTUATION=h.COLORS.COLOR_RESET,h.COLORS.COLOR_STRING=h.COLORS.COLOR_BRIGHT,h.COLORS.COLOR_NUMBER=h.COLORS.COLOR_BRIGHT,h.COLORS.COLOR_INDEX=h.COLORS.COLOR_BRIGHT,h.COLORS.COLOR_TRUE=h.COLORS.COLOR_BRIGHT,h.COLORS.COLOR_FALSE=h.COLORS.COLOR_BRIGHT,h.COLORS.COLOR_NULL=h.COLORS.COLOR_BRIGHT,h.COLORS.COLOR_UNDEFINED=h.COLORS.COLOR_BRIGHT;var i={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},j=h.COLORS,k=!1;global.COLOR_OUTPUT&&(k=global.COLOR_OUTPUT,delete global.COLOR_OUTPUT);var l=!1;global.PRETTY_PRINT&&(l=global.PRETTY_PRINT,delete global.PRETTY_PRINT);var m,n=/[\\\"\x00-\x1f]/g,o=/function ([^\(]*)?\(\) \{ \[native code\] \}/,p=/function ([^\(]*)?\((.*)\) \{/;h.printRecursive=m=function(a,c){var f=c.useColor,g=c.customInspect,i=c.useToString,k=c.limitString,l=c.showFunction;"undefined"==typeof c.seen&&(c.seen=[],c.names=[]);var m=c.seen.indexOf(a);if(m>=0)c.output+=c.names[m];else if(a&&(a instanceof Object||"object"==typeof a&&null===Object.getPrototypeOf(a)))if(c.seen.push(a),c.names.push(c.path),g&&"function"==typeof a._PRINT)a._PRINT(c),c.emit&&c.output.length>=c.emit&&(h.output(c.output),c.output="");else if(a instanceof Array)d(a,c);else if(a.toString===Object.prototype.toString||"object"==typeof a&&null===Object.getPrototypeOf(a)){var n=!1;try{(a instanceof Set||a instanceof Map||a instanceof WeakSet||a instanceof WeakMap||"function"==typeof a[Symbol.iterator])&&(c.output+=a.toString(),n=!0)}catch(q){}n||e(a,c),c.emit&&c.output.length>=c.emit&&(h.output(c.output),c.output="")}else if("function"==typeof a)try{var r=a.toString();if(c.level>0&&!l){var s=r.split("\n"),t=s[0],u=o.exec(t);null!==u?void 0===u[1]?c.output+="function { [native code] }":c.output+="function "+u[1]+" { [native code] }":(u=p.exec(t),null!==u?void 0===u[1]?c.output+="function ("+u[2]+") { ... }":c.output+="function "+u[1]+" ("+u[2]+") { ... }":(t=t.substr(8,t.length-10).trim(),c.output+='[Function "'+t+'" ...]'))}else c.output+=r}catch(v){h.stdOutput(String(v)),c.output+="[Function]"}else if(i&&"function"==typeof a.toString)try{c.output+=a.toString()}catch(w){c.output+="[Object ",e(a,c),c.output+="]"}else c.output+="[Object ",e(a,c),c.output+="]";else void 0===a?(f&&(c.output+=j.COLOR_UNDEFINED),c.output+="undefined",f&&(c.output+=j.COLOR_RESET)):"string"==typeof a?(f&&(c.output+=j.COLOR_STRING),k&&k0&&a(" "),"string"==typeof arguments[c])a(arguments[c]);else{var d={names:[],seen:[],path:"~",level:0,output:"",prettyPrint:!1,useColor:!1,customInspect:!0};b(arguments[c],d),a(d.output)}a("\n")},global.start_pretty_print=function(){require("internal").startPrettyPrint()},global.stop_pretty_print=function(){require("internal").stopPrettyPrint()},global.start_color_print=function(a){require("internal").startColorPrint(a,!1)},global.stop_color_print=function(){require("internal").stopColorPrint()},global.EXPORTS_SLOW_BUFFER&&(Object.keys(global.EXPORTS_SLOW_BUFFER).forEach(function(a){h[a]=global.EXPORTS_SLOW_BUFFER[a]}),delete global.EXPORTS_SLOW_BUFFER),global.APP_PATH&&(h.appPath=global.APP_PATH,delete global.APP_PATH),global.DEV_APP_PATH&&(h.devAppPath=global.APP_PATH,delete global.DEV_APP_PATH),h}()),function(){var a=require("internal");a.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_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:1e3,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_PARSER_FAILED:{code:1220,message:"parser 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_MODIFY_IN_SUBQUERY:{code:1574,message:"modify operation in subquery"},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_SESSION_UNKNOWN:{code:1950,message:"unknown session"},ERROR_SESSION_EXPIRED:{code:1951,message:"session expired"},SIMPLE_CLIENT_UNKNOWN_ERROR:{code:2e3,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:3e3,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:1e4,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:2e4,message:"newest version of app already installed"},ERROR_QUEUE_ALREADY_EXISTS:{code:21e3,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"}}}(),global.DEFINE_MODULE("console",function(){function a(a,b){j(a,h+b)}function b(a){var b=require("internal").ShapedJson,c=[];a.length>0&&"string"!=typeof a[0]&&c.push("%s");for(var d=0;d curl ","POST"===e?(i=a.arango.POST_RAW(f,g,h),j+="-X "+e+" "):"PUT"===e?(i=a.arango.PUT_RAW(f,g,h),j+="-X "+e+" "):"GET"===e?i=a.arango.GET_RAW(f,h):"DELETE"===e?(i=a.arango.DELETE_RAW(f,h),j+="-X "+e+" "):"PATCH"===e?(i=a.arango.PATCH_RAW(f,g,h),j+="-X "+e+" "):"HEAD"===e?(i=a.arango.HEAD_RAW(f,h),j+="-X "+e+" "):"OPTION"===e&&(i=a.arango.OPTION_RAW(f,g,h),j+="-X "+e+" "),void 0!==h&&""!==h)for(k in h)h.hasOwnProperty(k)&&(j+="--header '"+k+": "+h[k]+"' ");return void 0!==g&&""!==g&&(j+="--data-binary @- "),j+="--dump - http://localhost:8529"+f,b(j),void 0!==g&&""!==g&&g&&(d(" <<EOF\n"),l?c(g):d(g),d("\nEOF")),d("\n\n"),i}},a.appendRawResponse=function(b,c){return function(d){var e,f=d.headers;b("HTTP/1.1 "+f["http/1.1"]+"\n");for(e in f)f.hasOwnProperty(e)&&"http/1.1"!==e&&"server"!==e&&"connection"!==e&&"content-length"!==e&&b(e+": "+f[e]+"\n");b("\n"),void 0!==d.body&&(c(a.inspect(d.body)),b("\n"))}},a.appendJsonResponse=function(b,c){return function(b){var d=a.appendRawResponse(c,c),e=b.body;b.body=JSON.parse(b.body),d(b),b.body=e}},a.log=function(b,c){a.output(b,": ",c,"\n")};try{"undefined"!=typeof window&&(a.sprintf=function(a){var b=arguments.length;if(0===b)return"";if(1>=b)return String(a);var c,d=[];for(c=1;cc;++c)b+="\n";a.print(b)},global.console=global.console||require("console"),global.db=require("@arangodb").db,global.arango=require("@arangodb").arango,global.fm=require("@arangodb/foxx/manager"),global.ArangoStatement=require("@arangodb/arango-statement").ArangoStatement,global.tutorial=require("@arangodb/tutorial");var initHelp=function(){var a=require("internal");if(a.db)try{a.db._collections()}catch(b){}a.quiet!==!0&&(require("@arangodb").checkAvailableVersions(),a.arango&&a.arango.isConnected&&a.arango.isConnected()&&a.print("Type 'tutorial' for a tutorial or 'help' to see common examples"))};if("undefined"==typeof window){if(initHelp(),global.IS_EXECUTE_SCRIPT||global.IS_EXECUTE_STRING||global.IS_CHECK_SCRIPT||global.IS_UNIT_TESTS||global.IS_JS_LINT)try{var __fs__=require("fs"),__rcf__=__fs__.join(__fs__.home(),".arangosh.rc");if(__fs__.exists(__rcf__)){var __content__=__fs__.read(__rcf__);eval(__content__)}}catch(e){require("console").warn("arangosh.rc: %s",String(e))}try{delete global.IS_EXECUTE_SCRIPT,delete global.IS_EXECUTE_STRING,delete global.IS_CHECK_SCRIPT,delete global.IS_UNIT_TESTS,delete global.IS_JS_LINT}catch(e){}} \ No newline at end of file +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_MODIFY_IN_SUBQUERY:{code:1574,message:"modify operation in subquery"},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_SESSION_UNKNOWN:{code:1950,message:"unknown session"},ERROR_SESSION_EXPIRED:{code:1951,message:"session expired"},SIMPLE_CLIENT_UNKNOWN_ERROR:{code:2e3,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:3e3,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:1e4,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:2e4,message:"newest version of app already installed"},ERROR_QUEUE_ALREADY_EXISTS:{code:21e3,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"}}}(),global.DEFINE_MODULE("console",function(){function a(a,b){j(a,h+b)}function b(a){var b=require("internal").ShapedJson,c=[];a.length>0&&"string"!=typeof a[0]&&c.push("%s");for(var d=0;d curl ","POST"===e?(i=a.arango.POST_RAW(f,g,h),j+="-X "+e+" "):"PUT"===e?(i=a.arango.PUT_RAW(f,g,h),j+="-X "+e+" "):"GET"===e?i=a.arango.GET_RAW(f,h):"DELETE"===e?(i=a.arango.DELETE_RAW(f,h),j+="-X "+e+" "):"PATCH"===e?(i=a.arango.PATCH_RAW(f,g,h),j+="-X "+e+" "):"HEAD"===e?(i=a.arango.HEAD_RAW(f,h),j+="-X "+e+" "):"OPTION"===e&&(i=a.arango.OPTION_RAW(f,g,h),j+="-X "+e+" "),void 0!==h&&""!==h)for(k in h)h.hasOwnProperty(k)&&(j+="--header '"+k+": "+h[k]+"' ");return void 0!==g&&""!==g&&(j+="--data-binary @- "),j+="--dump - http://localhost:8529"+f,b(j),void 0!==g&&""!==g&&g&&(d(" <<EOF\n"),l?c(g):d(g),d("\nEOF")),d("\n\n"),i}},a.appendRawResponse=function(b,c){return function(d){var e,f=d.headers;b("HTTP/1.1 "+f["http/1.1"]+"\n");for(e in f)f.hasOwnProperty(e)&&"http/1.1"!==e&&"server"!==e&&"connection"!==e&&"content-length"!==e&&b(e+": "+f[e]+"\n");b("\n"),void 0!==d.body&&(c(a.inspect(d.body)),b("\n"))}},a.appendJsonResponse=function(b,c){return function(b){var d=a.appendRawResponse(c,c),e=b.body;b.body=JSON.parse(b.body),d(b),b.body=e}},a.log=function(b,c){a.output(b,": ",c,"\n")};try{"undefined"!=typeof window&&(a.sprintf=function(a){var b=arguments.length;if(0===b)return"";if(1>=b)return String(a);var c,d=[];for(c=1;cc;++c)b+="\n";a.print(b)},global.console=global.console||require("console"),global.db=require("@arangodb").db,global.arango=require("@arangodb").arango,global.fm=require("@arangodb/foxx/manager"),global.ArangoStatement=require("@arangodb/arango-statement").ArangoStatement,global.tutorial=require("@arangodb/tutorial");var initHelp=function(){var a=require("internal");if(a.db)try{a.db._collections()}catch(b){}a.quiet!==!0&&(require("@arangodb").checkAvailableVersions(),a.arango&&a.arango.isConnected&&a.arango.isConnected()&&a.print("Type 'tutorial' for a tutorial or 'help' to see common examples"))};if("undefined"==typeof window){if(initHelp(),global.IS_EXECUTE_SCRIPT||global.IS_EXECUTE_STRING||global.IS_CHECK_SCRIPT||global.IS_UNIT_TESTS||global.IS_JS_LINT)try{var __fs__=require("fs"),__rcf__=__fs__.join(__fs__.home(),".arangosh.rc");if(__fs__.exists(__rcf__)){var __content__=__fs__.read(__rcf__);eval(__content__)}}catch(e){require("console").warn("arangosh.rc: %s",String(e))}try{delete global.IS_EXECUTE_SCRIPT,delete global.IS_EXECUTE_STRING,delete global.IS_CHECK_SCRIPT,delete global.IS_UNIT_TESTS,delete global.IS_JS_LINT}catch(e){}} 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 0b39af5afb..9191ef25bf 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes6.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes6.js @@ -5304,7 +5304,7 @@ ArangoDatabase.prototype._dropDatabase = function (name) { /// @brief list all existing databases //////////////////////////////////////////////////////////////////////////////// -ArangoDatabase.prototype._listDatabases = function () { +ArangoDatabase.prototype._databases = function () { var requestResult = this._connection.GET("/_api/database"); if (requestResult !== null && requestResult.error === true) { diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/modules/client/@arangodb/arango-database.js b/js/apps/system/_admin/aardvark/APP/frontend/js/modules/client/@arangodb/arango-database.js index f69180fe4b..0f0b6c0a46 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/modules/client/@arangodb/arango-database.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/modules/client/@arangodb/arango-database.js @@ -869,7 +869,7 @@ ArangoDatabase.prototype._dropDatabase = function (name) { /// @brief list all existing databases //////////////////////////////////////////////////////////////////////////////// -ArangoDatabase.prototype._listDatabases = function () { +ArangoDatabase.prototype._databases = function () { var requestResult = this._connection.GET("/_api/database"); if (requestResult !== null && requestResult.error === true) { diff --git a/js/client/modules/@arangodb/arango-database.js b/js/client/modules/@arangodb/arango-database.js index a8b94002b5..ad1e79f0b3 100644 --- a/js/client/modules/@arangodb/arango-database.js +++ b/js/client/modules/@arangodb/arango-database.js @@ -928,7 +928,7 @@ ArangoDatabase.prototype._dropDatabase = function (name) { /// @brief list all existing databases //////////////////////////////////////////////////////////////////////////////// -ArangoDatabase.prototype._listDatabases = function () { +ArangoDatabase.prototype._databases = function () { var requestResult = this._connection.GET("/_api/database"); if (requestResult !== null && requestResult.error === true) { diff --git a/js/common/tests/shell/shell-database.js b/js/common/tests/shell/shell-database.js index ac6686376a..586fe1d947 100644 --- a/js/common/tests/shell/shell-database.js +++ b/js/common/tests/shell/shell-database.js @@ -171,7 +171,7 @@ function DatabaseSuite () { }, //////////////////////////////////////////////////////////////////////////////// -/// @brief test _listDatabases function +/// @brief test _databases function //////////////////////////////////////////////////////////////////////////////// testListDatabases : function () { @@ -179,7 +179,7 @@ function DatabaseSuite () { assertEqual("_system", internal.db._name()); - actual = internal.db._listDatabases(); + actual = internal.db._databases(); assertTrue(Array.isArray(actual)); n = actual.length; assertTrue(n > 0); @@ -200,7 +200,7 @@ function DatabaseSuite () { internal.db._createDatabase("UnitTestsDatabase0"); - actual = internal.db._listDatabases(); + actual = internal.db._databases(); assertTrue(Array.isArray(actual)); assertEqual(n + 1, actual.length); assertTrue( ( function () { @@ -550,7 +550,7 @@ function DatabaseSuite () { } var isContained = function (name) { - var l = internal.db._listDatabases(); + var l = internal.db._databases(); for (var i = 0; i < l.length; ++i) { if (l[i] === name) { return true; diff --git a/js/server/arango-dfdb.js b/js/server/arango-dfdb.js index e245bb5ee6..878cff86fe 100644 --- a/js/server/arango-dfdb.js +++ b/js/server/arango-dfdb.js @@ -490,7 +490,7 @@ function CheckCollection (collection, issues, details) { //////////////////////////////////////////////////////////////////////////////// function main (argv) { - var databases = internal.db._listDatabases(); + var databases = internal.db._databases(); var i; var collectionSorter = function (l, r) { diff --git a/js/server/bootstrap/autoload.js b/js/server/bootstrap/autoload.js index a6c5e21e94..d01367e8c9 100644 --- a/js/server/bootstrap/autoload.js +++ b/js/server/bootstrap/autoload.js @@ -42,7 +42,7 @@ var dbName = db._name(); db._useDatabase("_system"); - var databases = db._listDatabases(); + var databases = db._databases(); for (var i = 0; i < databases.length; ++i) { var name = databases[i]; diff --git a/js/server/bootstrap/foxxes.js b/js/server/bootstrap/foxxes.js index 099c7d1671..a5747fc1f0 100644 --- a/js/server/bootstrap/foxxes.js +++ b/js/server/bootstrap/foxxes.js @@ -48,7 +48,7 @@ try { db._useDatabase('_system'); - const databases = db._listDatabases(); + const databases = db._databases(); // loop over all databases for (const database of databases) { diff --git a/js/server/bootstrap/routing.js b/js/server/bootstrap/routing.js index f8f0d1bbb6..e34156f174 100644 --- a/js/server/bootstrap/routing.js +++ b/js/server/bootstrap/routing.js @@ -41,7 +41,7 @@ var dbName = db._name(); db._useDatabase("_system"); - var databases = db._listDatabases(); + var databases = db._databases(); for (var i = 0; i < databases.length; ++i) { var name = databases[i]; diff --git a/js/server/modules/@arangodb/cluster.js b/js/server/modules/@arangodb/cluster.js index e243ddd778..2ede5bf5a0 100644 --- a/js/server/modules/@arangodb/cluster.js +++ b/js/server/modules/@arangodb/cluster.js @@ -233,7 +233,7 @@ function getLocalDatabases () { var result = { }; var db = require("internal").db; - db._listDatabases().forEach(function (database) { + db._databases().forEach(function (database) { result[database] = { name: database }; }); @@ -1035,7 +1035,7 @@ function setupReplication () { var db = require("internal").db; var rep = require("@arangodb/replication"); - var dbs = db._listDatabases(); + var dbs = db._databases(); var i; var ok = true; for (i = 0; i < dbs.length; i++) { @@ -1077,7 +1077,7 @@ function secondaryToPrimary () { console.info("Switching role from secondary to primary..."); var db = require("internal").db; var rep = require("@arangodb/replication"); - var dbs = db._listDatabases(); + var dbs = db._databases(); var i; try { for (i = 0; i < dbs.length; i++) { diff --git a/js/server/modules/@arangodb/foxx/queues/manager.js b/js/server/modules/@arangodb/foxx/queues/manager.js index 7fc73ba57b..cf393888af 100644 --- a/js/server/modules/@arangodb/foxx/queues/manager.js +++ b/js/server/modules/@arangodb/foxx/queues/manager.js @@ -110,7 +110,7 @@ exports.manage = function() { var expires = global.KEY_GET('queue-control', 'databases-expire') || 0; if (expires < now || databases.length === 0) { - databases = db._listDatabases(); + databases = db._databases(); global.KEY_SET('queue-control', 'databases', databases); // make list of databases expire in 30 seconds from now global.KEY_SET('queue-control', 'databases-expire', Date.now() + 30 * 1000); @@ -163,7 +163,7 @@ exports.run = function() { global.KEYSPACE_CREATE('queue-control', 1, true); var initialDatabase = db._name(); - db._listDatabases().forEach(function(name) { + db._databases().forEach(function(name) { try { db._useDatabase(name); db._jobs.updateByExample({ diff --git a/js/server/tests/recovery/create-database-fail.js b/js/server/tests/recovery/create-database-fail.js index eb7ca716ce..00e5e30f95 100644 --- a/js/server/tests/recovery/create-database-fail.js +++ b/js/server/tests/recovery/create-database-fail.js @@ -88,10 +88,10 @@ function recoverySuite () { //////////////////////////////////////////////////////////////////////////////// testCreateDatabaseFail : function () { - assertEqual(-1, db._listDatabases().indexOf("UnitTestsRecovery1")); - assertEqual(-1, db._listDatabases().indexOf("UnitTestsRecovery2")); - assertNotEqual(-1, db._listDatabases().indexOf("UnitTestsRecovery3")); - assertNotEqual(-1, db._listDatabases().indexOf("UnitTestsRecovery4")); + assertEqual(-1, db._databases().indexOf("UnitTestsRecovery1")); + assertEqual(-1, db._databases().indexOf("UnitTestsRecovery2")); + assertNotEqual(-1, db._databases().indexOf("UnitTestsRecovery3")); + assertNotEqual(-1, db._databases().indexOf("UnitTestsRecovery4")); } }; diff --git a/js/server/tests/recovery/leftover-database-directory.js b/js/server/tests/recovery/leftover-database-directory.js index 4ef814f928..b0ec5c8b79 100644 --- a/js/server/tests/recovery/leftover-database-directory.js +++ b/js/server/tests/recovery/leftover-database-directory.js @@ -108,7 +108,7 @@ function recoverySuite () { //////////////////////////////////////////////////////////////////////////////// testLeftoverDatabaseDirectory : function () { - assertEqual([ "_system" ], db._listDatabases()); + assertEqual([ "_system" ], db._databases()); } }; diff --git a/js/server/tests/shell/shell-database-noncluster.js b/js/server/tests/shell/shell-database-noncluster.js index 2caefa31e3..62c57cab6f 100644 --- a/js/server/tests/shell/shell-database-noncluster.js +++ b/js/server/tests/shell/shell-database-noncluster.js @@ -81,7 +81,7 @@ function DatabaseSuite () { // drop the database internal.db._dropDatabase("UnitTestsDatabase0"); // should be dropped - internal.db._listDatabases().forEach(function (d) { + internal.db._databases().forEach(function (d) { if (d === "UnitTestsDatabase0") { fail(); } @@ -133,7 +133,7 @@ function DatabaseSuite () { // drop the database internal.db._dropDatabase("UnitTestsDatabase0"); // should be dropped - internal.db._listDatabases().forEach(function (d) { + internal.db._databases().forEach(function (d) { if (d === "UnitTestsDatabase0") { fail(); } diff --git a/js/server/tests/shell/shell-readonly-noncluster-disabled.js b/js/server/tests/shell/shell-readonly-noncluster-disabled.js index ced54b898e..ab0b7870e5 100644 --- a/js/server/tests/shell/shell-readonly-noncluster-disabled.js +++ b/js/server/tests/shell/shell-readonly-noncluster-disabled.js @@ -93,7 +93,7 @@ function databaseTestSuite () { testDropDatabase: function () { try { db._dropDatabase("testDB"); - assertEqual(-1, db._listDatabases().indexOf("testDb")); + assertEqual(-1, db._databases().indexOf("testDb")); } catch (e) { fail();