diff
stringlengths 41
2.03M
| msg
stringlengths 1
1.5k
⌀ | repo
stringlengths 5
40
| sha
stringlengths 40
40
| time
stringlengths 20
20
|
---|---|---|---|---|
mmm a / src / mongo / db / repl / SConscript <nl> ppp b / src / mongo / db / repl / SConscript <nl> env . Library ( ' replmocks ' , <nl> env . Library ( ' replica_set_config ' , <nl> [ <nl> ' member_config . cpp ' , <nl> - ' replica_set_tag . cpp ' <nl> + ' replica_set_config . cpp ' , <nl> + ' replica_set_tag . cpp ' , <nl> ] , <nl> LIBDEPS = [ <nl> ' $ BUILD_DIR / mongo / bson ' , <nl> ' $ BUILD_DIR / mongo / hostandport ' , <nl> + ' $ BUILD_DIR / mongo / db / common ' , <nl> ] ) <nl> <nl> env . CppUnitTest ( ' replica_set_config_test ' , <nl> [ <nl> ' member_config_test . cpp ' , <nl> + ' replica_set_config_test . cpp ' , <nl> ' replica_set_tag_test . cpp ' , <nl> ] , <nl> LIBDEPS = [ ' replica_set_config ' ] ) <nl> new file mode 100644 <nl> index 000000000000 . . 0fb16f1bd467 <nl> mmm / dev / null <nl> ppp b / src / mongo / db / repl / replica_set_config . cpp <nl> <nl> + / * * <nl> + * Copyright 2014 MongoDB Inc . <nl> + * <nl> + * This program is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU Affero General Public License , version 3 , <nl> + * as published by the Free Software Foundation . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU Affero General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU Affero General Public License <nl> + * along with this program . If not , see < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * As a special exception , the copyright holders give permission to link the <nl> + * code of portions of this program with the OpenSSL library under certain <nl> + * conditions as described in each individual source file and distribute <nl> + * linked combinations including the program with the OpenSSL library . You <nl> + * must comply with the GNU Affero General Public License in all respects for <nl> + * all of the code used other than as permitted herein . If you modify file ( s ) <nl> + * with this exception , you may extend this exception to your version of the <nl> + * file ( s ) , but you are not obligated to do so . If you do not wish to do so , <nl> + * delete this exception statement from your version . If you delete this <nl> + * exception statement from all source files in the program , then also delete <nl> + * it in the license file . <nl> + * / <nl> + <nl> + # include " mongo / platform / basic . h " <nl> + <nl> + # include " mongo / db / repl / replica_set_config . h " <nl> + <nl> + # include < algorithm > <nl> + <nl> + # include " mongo / bson / util / bson_check . h " <nl> + # include " mongo / bson / util / bson_extract . h " <nl> + # include " mongo / db / jsobj . h " <nl> + # include " mongo / stdx / functional . h " <nl> + <nl> + namespace mongo { <nl> + namespace repl { <nl> + <nl> + # ifndef _MSC_VER <nl> + const size_t ReplicaSetConfig : : kMaxMembers ; <nl> + const size_t ReplicaSetConfig : : kMaxVotingMembers ; <nl> + # endif <nl> + <nl> + const Seconds ReplicaSetConfig : : kDefaultHeartbeatTimeoutPeriod ( 10 ) ; <nl> + <nl> + namespace { <nl> + <nl> + const std : : string kIdFieldName = " _id " ; <nl> + const std : : string kVersionFieldName = " version " ; <nl> + const std : : string kMembersFieldName = " members " ; <nl> + const std : : string kSettingsFieldName = " settings " ; <nl> + <nl> + const std : : string kLegalConfigTopFieldNames [ ] = { <nl> + kIdFieldName , <nl> + kVersionFieldName , <nl> + kMembersFieldName , <nl> + kSettingsFieldName <nl> + } ; <nl> + <nl> + const std : : string kHeartbeatTimeoutFieldName = " heartbeatTimeoutSecs " ; <nl> + const std : : string kChainingAllowedFieldName = " chainingAllowed " ; <nl> + const std : : string kGetLastErrorDefaultsFieldName = " getLastErrorDefaults " ; <nl> + const std : : string kGetLastErrorModesFieldName = " getLastErrorModes " ; <nl> + <nl> + } / / namespace <nl> + <nl> + ReplicaSetConfig : : ReplicaSetConfig ( ) : _heartbeatTimeoutPeriod ( 0 ) { } <nl> + <nl> + Status ReplicaSetConfig : : initialize ( const BSONObj & cfg ) { <nl> + _members . clear ( ) ; <nl> + Status status = bsonCheckOnlyHasFields ( <nl> + " replica set configuration " , cfg , kLegalConfigTopFieldNames ) ; <nl> + if ( ! status . isOK ( ) ) <nl> + return status ; <nl> + <nl> + / / <nl> + / / Parse replSetName <nl> + / / <nl> + status = bsonExtractStringField ( cfg , kIdFieldName , & _replSetName ) ; <nl> + if ( ! status . isOK ( ) ) <nl> + return status ; <nl> + <nl> + / / <nl> + / / Parse version <nl> + / / <nl> + status = bsonExtractIntegerField ( cfg , kVersionFieldName , & _version ) ; <nl> + if ( ! status . isOK ( ) ) <nl> + return status ; <nl> + <nl> + / / <nl> + / / Parse members <nl> + / / <nl> + BSONElement membersElement ; <nl> + status = bsonExtractTypedField ( cfg , kMembersFieldName , Array , & membersElement ) ; <nl> + if ( ! status . isOK ( ) ) <nl> + return status ; <nl> + <nl> + for ( BSONObj : : iterator membersIterator ( membersElement . Obj ( ) ) ; membersIterator . more ( ) ; ) { <nl> + BSONElement memberElement = membersIterator . next ( ) ; <nl> + if ( memberElement . type ( ) ! = Object ) { <nl> + return Status ( ErrorCodes : : TypeMismatch , str : : stream ( ) < < <nl> + " Expected type of " < < kMembersFieldName < < " . " < < <nl> + memberElement . fieldName ( ) < < " to be Object , but found " < < <nl> + typeName ( memberElement . type ( ) ) ) ; <nl> + } <nl> + _members . resize ( _members . size ( ) + 1 ) ; <nl> + status = _members . back ( ) . initialize ( memberElement . Obj ( ) , & _tagConfig ) ; <nl> + if ( ! status . isOK ( ) ) <nl> + return status ; <nl> + } <nl> + <nl> + / / <nl> + / / Parse settings <nl> + / / <nl> + BSONElement settingsElement ; <nl> + status = bsonExtractTypedField ( cfg , kSettingsFieldName , Object , & settingsElement ) ; <nl> + BSONObj settings ; <nl> + if ( status . isOK ( ) ) { <nl> + settings = settingsElement . Obj ( ) ; <nl> + } <nl> + else if ( status ! = ErrorCodes : : NoSuchKey ) { <nl> + return status ; <nl> + } <nl> + status = _parseSettingsSubdocument ( settings ) ; <nl> + if ( ! status . isOK ( ) ) <nl> + return status ; <nl> + <nl> + _calculateMajorityNumber ( ) ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status ReplicaSetConfig : : _parseSettingsSubdocument ( const BSONObj & settings ) { <nl> + / / <nl> + / / Parse heartbeatTimeoutSecs <nl> + / / <nl> + BSONElement hbTimeoutSecsElement = settings [ kHeartbeatTimeoutFieldName ] ; <nl> + if ( hbTimeoutSecsElement . eoo ( ) ) { <nl> + _heartbeatTimeoutPeriod = Seconds ( kDefaultHeartbeatTimeoutPeriod ) ; <nl> + } <nl> + else if ( hbTimeoutSecsElement . isNumber ( ) ) { <nl> + _heartbeatTimeoutPeriod = Seconds ( hbTimeoutSecsElement . numberInt ( ) ) ; <nl> + } <nl> + else { <nl> + return Status ( ErrorCodes : : TypeMismatch , str : : stream ( ) < < " Expected type of " < < <nl> + kSettingsFieldName < < " . " < < kHeartbeatTimeoutFieldName < < <nl> + " to be a number , but found a value of type " < < <nl> + typeName ( hbTimeoutSecsElement . type ( ) ) ) ; <nl> + } <nl> + <nl> + / / <nl> + / / Parse chainingAllowed <nl> + / / <nl> + Status status = bsonExtractBooleanFieldWithDefault ( settings , <nl> + kChainingAllowedFieldName , <nl> + true , <nl> + & _chainingAllowed ) ; <nl> + if ( ! status . isOK ( ) ) <nl> + return status ; <nl> + <nl> + / / <nl> + / / Parse getLastErrorDefaults <nl> + / / <nl> + BSONElement gleDefaultsElement ; <nl> + status = bsonExtractTypedField ( settings , <nl> + kGetLastErrorDefaultsFieldName , <nl> + Object , <nl> + & gleDefaultsElement ) ; <nl> + if ( status . isOK ( ) ) { <nl> + status = _defaultWriteConcern . parse ( gleDefaultsElement . Obj ( ) ) ; <nl> + if ( ! status . isOK ( ) ) <nl> + return status ; <nl> + } <nl> + else if ( status = = ErrorCodes : : NoSuchKey ) { <nl> + / / Default write concern is w : 1 . <nl> + _defaultWriteConcern . reset ( ) ; <nl> + _defaultWriteConcern . wNumNodes = 1 ; <nl> + } <nl> + else { <nl> + return status ; <nl> + } <nl> + <nl> + / / <nl> + / / Parse getLastErrorModes <nl> + / / <nl> + BSONElement gleModesElement ; <nl> + status = bsonExtractTypedField ( settings , <nl> + kGetLastErrorModesFieldName , <nl> + Object , <nl> + & gleModesElement ) ; <nl> + BSONObj gleModes ; <nl> + if ( status . isOK ( ) ) { <nl> + gleModes = gleModesElement . Obj ( ) ; <nl> + } <nl> + else if ( status ! = ErrorCodes : : NoSuchKey ) { <nl> + return status ; <nl> + } <nl> + <nl> + for ( BSONObj : : iterator gleModeIter ( gleModes ) ; gleModeIter . more ( ) ; ) { <nl> + const BSONElement modeElement = gleModeIter . next ( ) ; <nl> + if ( _customWriteConcernModes . find ( modeElement . fieldNameStringData ( ) ) ! = <nl> + _customWriteConcernModes . end ( ) ) { <nl> + <nl> + return Status ( ErrorCodes : : DuplicateKey , str : : stream ( ) < < kSettingsFieldName < < <nl> + ' . ' < < kGetLastErrorModesFieldName < < <nl> + " contains multiple fields named " < < modeElement . fieldName ( ) ) ; <nl> + } <nl> + if ( modeElement . type ( ) ! = Object ) { <nl> + return Status ( ErrorCodes : : TypeMismatch , str : : stream ( ) < < " Expected " < < <nl> + kSettingsFieldName < < ' . ' < < kGetLastErrorModesFieldName < < ' . ' < < <nl> + modeElement . fieldName ( ) < < " to be an Object , not " < < <nl> + typeName ( modeElement . type ( ) ) ) ; <nl> + } <nl> + ReplicaSetTagPattern pattern = _tagConfig . makePattern ( ) ; <nl> + for ( BSONObj : : iterator constraintIter ( modeElement . Obj ( ) ) ; constraintIter . more ( ) ; ) { <nl> + const BSONElement constraintElement = constraintIter . next ( ) ; <nl> + if ( ! constraintElement . isNumber ( ) ) { <nl> + return Status ( ErrorCodes : : TypeMismatch , str : : stream ( ) < < " Expected " < < <nl> + kSettingsFieldName < < ' . ' < < kGetLastErrorModesFieldName < < ' . ' < < <nl> + modeElement . fieldName ( ) < < ' . ' < < constraintElement . fieldName ( ) < < <nl> + " to be a number , not " < < typeName ( constraintElement . type ( ) ) ) ; <nl> + } <nl> + const int minCount = constraintElement . numberInt ( ) ; <nl> + if ( minCount < = 0 ) { <nl> + return Status ( ErrorCodes : : BadValue , str : : stream ( ) < < " Value of " < < <nl> + kSettingsFieldName < < ' . ' < < kGetLastErrorModesFieldName < < ' . ' < < <nl> + modeElement . fieldName ( ) < < ' . ' < < constraintElement . fieldName ( ) < < <nl> + " must be positive , but found " < < minCount ) ; <nl> + } <nl> + status = _tagConfig . addTagCountConstraintToPattern ( <nl> + & pattern , <nl> + constraintElement . fieldNameStringData ( ) , <nl> + minCount ) ; <nl> + if ( ! status . isOK ( ) ) { <nl> + return status ; <nl> + } <nl> + } <nl> + _customWriteConcernModes [ modeElement . fieldNameStringData ( ) ] = pattern ; <nl> + } <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status ReplicaSetConfig : : validate ( ) const { <nl> + if ( _version < = 0 | | _version > std : : numeric_limits < int > : : max ( ) ) { <nl> + return Status ( ErrorCodes : : BadValue , str : : stream ( ) < < kVersionFieldName < < <nl> + " field value of " < < _version < < " is out of range " ) ; <nl> + } <nl> + if ( _replSetName . empty ( ) ) { <nl> + return Status ( ErrorCodes : : BadValue , str : : stream ( ) < < <nl> + " Replica set configuration must have non - empty " < < kIdFieldName < < <nl> + " field " ) ; <nl> + } <nl> + if ( _heartbeatTimeoutPeriod < Seconds ( 0 ) ) { <nl> + return Status ( ErrorCodes : : BadValue , str : : stream ( ) < < kSettingsFieldName < < ' . ' < < <nl> + kHeartbeatTimeoutFieldName < < " field value must be non - negative , " <nl> + " but found " < < _heartbeatTimeoutPeriod . total_seconds ( ) ) ; <nl> + } <nl> + if ( _members . size ( ) > kMaxMembers | | _members . empty ( ) ) { <nl> + return Status ( ErrorCodes : : BadValue , str : : stream ( ) < < <nl> + " Replica set configuration contains " < < _members . size ( ) < < <nl> + " members , but must have at least 1 and no more than " < < kMaxMembers ) ; <nl> + } <nl> + <nl> + size_t localhostCount = 0 ; <nl> + size_t voterCount = 0 ; <nl> + size_t arbiterCount = 0 ; <nl> + size_t electableCount = 0 ; <nl> + for ( size_t i = 0 ; i < _members . size ( ) ; + + i ) { <nl> + const MemberConfig & memberI = _members [ i ] ; <nl> + Status status = memberI . validate ( ) ; <nl> + if ( ! status . isOK ( ) ) <nl> + return status ; <nl> + if ( memberI . getHostAndPort ( ) . isLocalHost ( ) ) { <nl> + + + localhostCount ; <nl> + } <nl> + if ( memberI . isVoter ( ) ) { <nl> + + + voterCount ; <nl> + } <nl> + / / Nodes may be arbiters or electable , or neither , but never both . <nl> + if ( memberI . isArbiter ( ) ) { <nl> + + + arbiterCount ; <nl> + } <nl> + else if ( memberI . getPriority ( ) > 0 ) { <nl> + + + electableCount ; <nl> + } <nl> + for ( size_t j = 0 ; j < _members . size ( ) ; + + j ) { <nl> + if ( i = = j ) <nl> + continue ; <nl> + const MemberConfig & memberJ = _members [ j ] ; <nl> + if ( memberI . getId ( ) = = memberJ . getId ( ) ) { <nl> + return Status ( <nl> + ErrorCodes : : BadValue , str : : stream ( ) < < <nl> + " Found two member configurations with same " < < <nl> + MemberConfig : : kIdFieldName < < " field , " < < <nl> + kMembersFieldName < < " . " < < i < < " . " < < MemberConfig : : kIdFieldName < < <nl> + " = = " < < <nl> + kMembersFieldName < < " . " < < j < < " . " < < MemberConfig : : kIdFieldName < < <nl> + " = = " < < memberI . getId ( ) ) ; <nl> + } <nl> + if ( memberI . getHostAndPort ( ) = = memberJ . getHostAndPort ( ) ) { <nl> + return Status ( <nl> + ErrorCodes : : BadValue , str : : stream ( ) < < <nl> + " Found two member configurations with same " < < <nl> + MemberConfig : : kHostFieldName < < " field , " < < <nl> + kMembersFieldName < < " . " < < i < < " . " < < MemberConfig : : kHostFieldName < < <nl> + " = = " < < <nl> + kMembersFieldName < < " . " < < j < < " . " < < MemberConfig : : kHostFieldName < < <nl> + " = = " < < memberI . getHostAndPort ( ) . toString ( ) ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( localhostCount ! = 0 & & localhostCount ! = _members . size ( ) ) { <nl> + return Status ( ErrorCodes : : BadValue , str : : stream ( ) < < <nl> + " Either all host names in a replica set configuration must be localhost " <nl> + " references , or none must be ; found " < < localhostCount < < " out of " < < <nl> + _members . size ( ) ) ; <nl> + } <nl> + <nl> + if ( voterCount > kMaxVotingMembers | | voterCount = = 0 ) { <nl> + return Status ( ErrorCodes : : BadValue , str : : stream ( ) < < <nl> + " Replica set configuration contains " < < voterCount < < <nl> + " voting members , but must be between 0 and " < < kMaxVotingMembers ) ; <nl> + } <nl> + <nl> + if ( electableCount = = 0 ) { <nl> + return Status ( ErrorCodes : : BadValue , " Replica set configuration must contain at least " <nl> + " one non - arbiter member with priority > 0 " ) ; <nl> + } <nl> + <nl> + / / TODO ( schwerin ) : Validate satisfiability of write modes ? Omitting for backwards <nl> + / / compatibility . <nl> + if ( ! _defaultWriteConcern . wMode . empty ( ) & & " majority " ! = _defaultWriteConcern . wMode ) { <nl> + if ( ! findCustomWriteMode ( _defaultWriteConcern . wMode ) . isOK ( ) ) { <nl> + return Status ( ErrorCodes : : BadValue , str : : stream ( ) < < <nl> + " Default write concern requires undefined write mode " < < <nl> + _defaultWriteConcern . wMode ) ; <nl> + } <nl> + } <nl> + <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + ReplicaSetTag ReplicaSetConfig : : findTag ( const StringData & key , const StringData & value ) const { <nl> + return _tagConfig . findTag ( key , value ) ; <nl> + } <nl> + <nl> + StatusWith < ReplicaSetTagPattern > ReplicaSetConfig : : findCustomWriteMode ( <nl> + const StringData & patternName ) const { <nl> + <nl> + const StringMap < ReplicaSetTagPattern > : : const_iterator iter = _customWriteConcernModes . find ( <nl> + patternName ) ; <nl> + if ( iter = = _customWriteConcernModes . end ( ) ) { <nl> + return StatusWith < ReplicaSetTagPattern > ( <nl> + ErrorCodes : : NoSuchKey , <nl> + str : : stream ( ) < < <nl> + " No write concern mode named \ " " < < escape ( patternName . toString ( ) ) < < <nl> + " found in replica set configuration " ) ; <nl> + } <nl> + return StatusWith < ReplicaSetTagPattern > ( iter - > second ) ; <nl> + } <nl> + <nl> + void ReplicaSetConfig : : _calculateMajorityNumber ( ) { <nl> + const size_t total = getNumMembers ( ) ; <nl> + const size_t strictMajority = total / 2 + 1 ; <nl> + const size_t nonArbiters = total - std : : count_if ( <nl> + _members . begin ( ) , <nl> + _members . end ( ) , <nl> + stdx : : bind ( & MemberConfig : : isArbiter , stdx : : placeholders : : _1 ) ) ; <nl> + <nl> + / / majority should be all " normal " members if we have something like 4 <nl> + / / arbiters & 3 normal members <nl> + / / <nl> + / / TODO ( SERVER - 14403 ) : Should majority exclude hidden nodes ? non - voting nodes ? unelectable <nl> + / / nodes ? <nl> + _majorityNumber = ( strictMajority > nonArbiters ) ? nonArbiters : strictMajority ; <nl> + } <nl> + <nl> + } / / namespace repl <nl> + } / / namespace mongo <nl> new file mode 100644 <nl> index 000000000000 . . edbc493f82d2 <nl> mmm / dev / null <nl> ppp b / src / mongo / db / repl / replica_set_config . h <nl> <nl> + / * * <nl> + * Copyright 2014 MongoDB Inc . <nl> + * <nl> + * This program is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU Affero General Public License , version 3 , <nl> + * as published by the Free Software Foundation . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU Affero General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU Affero General Public License <nl> + * along with this program . If not , see < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * As a special exception , the copyright holders give permission to link the <nl> + * code of portions of this program with the OpenSSL library under certain <nl> + * conditions as described in each individual source file and distribute <nl> + * linked combinations including the program with the OpenSSL library . You <nl> + * must comply with the GNU Affero General Public License in all respects for <nl> + * all of the code used other than as permitted herein . If you modify file ( s ) <nl> + * with this exception , you may extend this exception to your version of the <nl> + * file ( s ) , but you are not obligated to do so . If you do not wish to do so , <nl> + * delete this exception statement from your version . If you delete this <nl> + * exception statement from all source files in the program , then also delete <nl> + * it in the license file . <nl> + * / <nl> + <nl> + # pragma once <nl> + <nl> + # include < string > <nl> + # include < vector > <nl> + <nl> + # include " mongo / base / status . h " <nl> + # include " mongo / base / status_with . h " <nl> + # include " mongo / db / repl / member_config . h " <nl> + # include " mongo / db / repl / replica_set_tag . h " <nl> + # include " mongo / db / write_concern_options . h " <nl> + # include " mongo / util / string_map . h " <nl> + # include " mongo / util / time_support . h " <nl> + <nl> + namespace mongo { <nl> + <nl> + class BSONObj ; <nl> + <nl> + namespace repl { <nl> + <nl> + / * * <nl> + * Representation of the configuration information about a particular replica set . <nl> + * / <nl> + class ReplicaSetConfig { <nl> + public : <nl> + typedef std : : vector < MemberConfig > : : const_iterator MemberIterator ; <nl> + <nl> + static const size_t kMaxMembers = 12 ; <nl> + static const size_t kMaxVotingMembers = 7 ; <nl> + static const Seconds kDefaultHeartbeatTimeoutPeriod ; <nl> + <nl> + ReplicaSetConfig ( ) ; <nl> + <nl> + / * * <nl> + * Initializes this ReplicaSetConfig from the contents of " cfg " . <nl> + * / <nl> + Status initialize ( const BSONObj & cfg ) ; <nl> + <nl> + / * * <nl> + * Performs basic consistency checks on the replica set configuration . <nl> + * / <nl> + Status validate ( ) const ; <nl> + <nl> + / * * <nl> + * Gets the version of this configuration . <nl> + * <nl> + * The version number sequences configurations of the replica set , so that <nl> + * nodes may distinguish between " older " and " newer " configurations . <nl> + * / <nl> + long long getConfigVersion ( ) const { return _version ; } <nl> + <nl> + / * * <nl> + * Gets the name ( _id field value ) of the replica set described by this configuration . <nl> + * / <nl> + const std : : string & getReplSetName ( ) const { return _replSetName ; } <nl> + <nl> + / * * <nl> + * Gets the number of members in this configuration . <nl> + * / <nl> + size_t getNumMembers ( ) const { return _members . size ( ) ; } <nl> + <nl> + / * * <nl> + * Gets a begin iterator over the MemberConfigs stored in this ReplicaSetConfig . <nl> + * / <nl> + MemberIterator membersBegin ( ) const { return _members . begin ( ) ; } <nl> + <nl> + / * * <nl> + * Gets an end iterator over the MemberConfigs stored in this ReplicaSetConfig . <nl> + * / <nl> + MemberIterator membersEnd ( ) const { return _members . end ( ) ; } <nl> + <nl> + / * * <nl> + * Gets the default write concern for the replica set described by this configuration . <nl> + * / <nl> + const WriteConcernOptions & getDefaultWriteConcern ( ) const { return _defaultWriteConcern ; } <nl> + <nl> + / * * <nl> + * Gets the amount of time to wait for a response to hearbeats sent to other <nl> + * nodes in the replica set . <nl> + * / <nl> + Seconds getHeartbeatTimeoutPeriod ( ) const { return _heartbeatTimeoutPeriod ; } <nl> + <nl> + / * * <nl> + * Gets the number of nodes that constitutes a " majority " in this replica set , <nl> + * for purposes of replicating data . <nl> + * / <nl> + size_t getMajorityNumber ( ) const { return _majorityNumber ; } <nl> + <nl> + / * * <nl> + * Returns true if automatic ( not explicitly set ) chaining is allowed . <nl> + * / <nl> + bool isChainingAllowed ( ) const { return _chainingAllowed ; } <nl> + <nl> + / * * <nl> + * Returns a ReplicaSetTag with the given " key " and " value " , or an invalid <nl> + * tag if the configuration describes no such tag . <nl> + * / <nl> + ReplicaSetTag findTag ( const StringData & key , const StringData & value ) const ; <nl> + <nl> + / * * <nl> + * Returns the pattern corresponding to " patternName " in this configuration . <nl> + * If " patternName " is not a valid pattern in this configuration , returns <nl> + * ErrorCodes : : NoSuchKey . <nl> + * / <nl> + StatusWith < ReplicaSetTagPattern > findCustomWriteMode ( const StringData & patternName ) const ; <nl> + <nl> + / * * <nl> + * Returns the " tags configuration " for this replicaset . <nl> + * <nl> + * NOTE ( schwerin ) : Not clear if this should be used other than for reporting / debugging . <nl> + * / <nl> + const ReplicaSetTagConfig & getTagConfig ( ) const { return _tagConfig ; } <nl> + <nl> + private : <nl> + / * * <nl> + * Parses the " settings " subdocument of a replica set configuration . <nl> + * / <nl> + Status _parseSettingsSubdocument ( const BSONObj & settings ) ; <nl> + <nl> + / * * <nl> + * Calculates majority number based on current config and stores in _majorityNumber . <nl> + * Called during initialize ( ) . <nl> + * / <nl> + void _calculateMajorityNumber ( ) ; <nl> + <nl> + long long _version ; <nl> + std : : string _replSetName ; <nl> + std : : vector < MemberConfig > _members ; <nl> + WriteConcernOptions _defaultWriteConcern ; <nl> + Seconds _heartbeatTimeoutPeriod ; <nl> + bool _chainingAllowed ; <nl> + size_t _majorityNumber ; <nl> + ReplicaSetTagConfig _tagConfig ; <nl> + StringMap < ReplicaSetTagPattern > _customWriteConcernModes ; <nl> + } ; <nl> + <nl> + <nl> + } / / namespace repl <nl> + } / / namespace mongo <nl> new file mode 100644 <nl> index 000000000000 . . 0bf3dfdc9e99 <nl> mmm / dev / null <nl> ppp b / src / mongo / db / repl / replica_set_config_test . cpp <nl> <nl> + / * * <nl> + * Copyright 2014 MongoDB Inc . <nl> + * <nl> + * This program is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU Affero General Public License , version 3 , <nl> + * as published by the Free Software Foundation . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU Affero General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU Affero General Public License <nl> + * along with this program . If not , see < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * As a special exception , the copyright holders give permission to link the <nl> + * code of portions of this program with the OpenSSL library under certain <nl> + * conditions as described in each individual source file and distribute <nl> + * linked combinations including the program with the OpenSSL library . You <nl> + * must comply with the GNU Affero General Public License in all respects for <nl> + * all of the code used other than as permitted herein . If you modify file ( s ) <nl> + * with this exception , you may extend this exception to your version of the <nl> + * file ( s ) , but you are not obligated to do so . If you do not wish to do so , <nl> + * delete this exception statement from your version . If you delete this <nl> + * exception statement from all source files in the program , then also delete <nl> + * it in the license file . <nl> + * / <nl> + <nl> + # include " mongo / bson / mutable / document . h " <nl> + # include " mongo / bson / mutable / element . h " <nl> + # include " mongo / db / jsobj . h " <nl> + # include " mongo / db / repl / replica_set_config . h " <nl> + # include " mongo / unittest / unittest . h " <nl> + <nl> + namespace mongo { <nl> + namespace repl { <nl> + namespace { <nl> + <nl> + TEST ( ReplicaSetConfig , ParseMinimalConfigAndCheckDefaults ) { <nl> + ReplicaSetConfig config ; <nl> + ASSERT_OK ( config . initialize ( <nl> + BSON ( " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) ) ) ) ) ; <nl> + ASSERT_OK ( config . validate ( ) ) ; <nl> + ASSERT_EQUALS ( " rs0 " , config . getReplSetName ( ) ) ; <nl> + ASSERT_EQUALS ( 1 , config . getConfigVersion ( ) ) ; <nl> + ASSERT_EQUALS ( 1U , config . getNumMembers ( ) ) ; <nl> + ASSERT_EQUALS ( 0 , config . membersBegin ( ) - > getId ( ) ) ; <nl> + ASSERT_EQUALS ( 1 , config . getDefaultWriteConcern ( ) . wNumNodes ) ; <nl> + ASSERT_EQUALS ( " " , config . getDefaultWriteConcern ( ) . wMode ) ; <nl> + ASSERT_EQUALS ( 10 , config . getHeartbeatTimeoutPeriod ( ) . total_seconds ( ) ) ; <nl> + ASSERT_EQUALS ( 1U , config . getMajorityNumber ( ) ) ; <nl> + ASSERT_TRUE ( config . isChainingAllowed ( ) ) ; <nl> + } <nl> + <nl> + TEST ( ReplicaSetConfig , ParseFailsWithBadOrMissingIdField ) { <nl> + ReplicaSetConfig config ; <nl> + / / Replica set name must be a string . <nl> + ASSERT_EQUALS ( <nl> + ErrorCodes : : TypeMismatch , <nl> + config . initialize ( <nl> + BSON ( " _id " < < 1 < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) ) ) ) ) ; <nl> + <nl> + / / Replica set name must be present . <nl> + ASSERT_EQUALS ( <nl> + ErrorCodes : : NoSuchKey , <nl> + config . initialize ( <nl> + BSON ( " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) ) ) ) ) ; <nl> + <nl> + / / Empty repl set name parses , but does not validate . <nl> + ASSERT_OK ( config . initialize ( <nl> + BSON ( " _id " < < " " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) ) ) ) ) ; <nl> + <nl> + ASSERT_EQUALS ( ErrorCodes : : BadValue , config . validate ( ) ) ; <nl> + } <nl> + <nl> + TEST ( ReplicaSetConfig , ParseFailsWithBadOrMissingVersionField ) { <nl> + ReplicaSetConfig config ; <nl> + / / Config version field must be present . <nl> + ASSERT_EQUALS ( <nl> + ErrorCodes : : NoSuchKey , <nl> + config . initialize ( <nl> + BSON ( " _id " < < " rs0 " < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) ) ) ) ) ; <nl> + ASSERT_EQUALS ( <nl> + ErrorCodes : : TypeMismatch , <nl> + config . initialize ( <nl> + BSON ( " _id " < < " rs0 " < < <nl> + " version " < < " 1 " < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) ) ) ) ) ; <nl> + <nl> + ASSERT_OK ( config . initialize ( <nl> + BSON ( " _id " < < " rs0 " < < <nl> + " version " < < 1 . 0 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) ) ) ) ) ; <nl> + ASSERT_OK ( config . validate ( ) ) ; <nl> + ASSERT_OK ( config . initialize ( <nl> + BSON ( " _id " < < " rs0 " < < <nl> + " version " < < 0 . 0 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) ) ) ) ) ; <nl> + ASSERT_EQUALS ( ErrorCodes : : BadValue , config . validate ( ) ) ; <nl> + ASSERT_OK ( config . initialize ( <nl> + BSON ( " _id " < < " rs0 " < < <nl> + " version " < < <nl> + static_cast < long long > ( std : : numeric_limits < int > : : max ( ) ) + 1 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) ) ) ) ) ; <nl> + ASSERT_EQUALS ( ErrorCodes : : BadValue , config . validate ( ) ) ; <nl> + } <nl> + <nl> + TEST ( ReplicaSetConfig , ParseFailsWithBadMembers ) { <nl> + ReplicaSetConfig config ; <nl> + ASSERT_EQUALS ( ErrorCodes : : TypeMismatch , <nl> + config . initialize ( <nl> + BSON ( " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) < < <nl> + " localhost : 23456 " ) ) ) ) ; <nl> + ASSERT_EQUALS ( ErrorCodes : : NoSuchKey , <nl> + config . initialize ( <nl> + BSON ( " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " host " < < " localhost : 12345 " ) ) ) ) ) ; <nl> + } <nl> + <nl> + TEST ( ReplicaSetConfig , ParseFailsWithLocalNonLocalHostMix ) { <nl> + ReplicaSetConfig config ; <nl> + ASSERT_OK ( config . initialize ( BSON ( " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost " ) < < <nl> + BSON ( " _id " < < 1 < < <nl> + " host " < < " otherhost " ) ) ) ) ) ; <nl> + ASSERT_EQUALS ( ErrorCodes : : BadValue , config . validate ( ) ) ; <nl> + } <nl> + <nl> + TEST ( ReplicaSetConfig , ParseFailsWithNoElectableNodes ) { <nl> + ReplicaSetConfig config ; <nl> + const BSONObj configBsonNoElectableNodes = BSON ( <nl> + " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( <nl> + BSON ( " _id " < < 0 < < " host " < < " localhost : 1 " < < " priority " < < 0 ) < < <nl> + BSON ( " _id " < < 1 < < " host " < < " localhost : 2 " < < " priority " < < 0 ) ) ) ; <nl> + <nl> + ASSERT_OK ( config . initialize ( configBsonNoElectableNodes ) ) ; <nl> + ASSERT_EQUALS ( ErrorCodes : : BadValue , config . validate ( ) ) ; <nl> + <nl> + const BSONObj configBsonNoElectableNodesOneArbiter = BSON ( <nl> + " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( <nl> + BSON ( " _id " < < 0 < < " host " < < " localhost : 1 " < < " arbiterOnly " < < 1 ) < < <nl> + BSON ( " _id " < < 1 < < " host " < < " localhost : 2 " < < " priority " < < 0 ) ) ) ; <nl> + <nl> + ASSERT_OK ( config . initialize ( configBsonNoElectableNodesOneArbiter ) ) ; <nl> + ASSERT_EQUALS ( ErrorCodes : : BadValue , config . validate ( ) ) ; <nl> + <nl> + const BSONObj configBsonNoElectableNodesTwoArbiters = BSON ( <nl> + " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( <nl> + BSON ( " _id " < < 0 < < " host " < < " localhost : 1 " < < " arbiterOnly " < < 1 ) < < <nl> + BSON ( " _id " < < 1 < < " host " < < " localhost : 2 " < < " arbiterOnly " < < 1 ) ) ) ; <nl> + <nl> + ASSERT_OK ( config . initialize ( configBsonNoElectableNodesOneArbiter ) ) ; <nl> + ASSERT_EQUALS ( ErrorCodes : : BadValue , config . validate ( ) ) ; <nl> + <nl> + const BSONObj configBsonOneElectableNode = BSON ( <nl> + " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( <nl> + BSON ( " _id " < < 0 < < " host " < < " localhost : 1 " < < " priority " < < 0 ) < < <nl> + BSON ( " _id " < < 1 < < " host " < < " localhost : 2 " < < " priority " < < 1 ) ) ) ; <nl> + ASSERT_OK ( config . initialize ( configBsonOneElectableNode ) ) ; <nl> + ASSERT_OK ( config . validate ( ) ) ; <nl> + } <nl> + <nl> + TEST ( ReplicaSetConfig , ParseFailsWithTooFewVoters ) { <nl> + ReplicaSetConfig config ; <nl> + const BSONObj configBsonNoVoters = BSON ( <nl> + " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( <nl> + BSON ( " _id " < < 0 < < " host " < < " localhost : 1 " < < " votes " < < 0 ) < < <nl> + BSON ( " _id " < < 1 < < " host " < < " localhost : 2 " < < " votes " < < 0 ) ) ) ; <nl> + <nl> + ASSERT_OK ( config . initialize ( configBsonNoVoters ) ) ; <nl> + ASSERT_EQUALS ( ErrorCodes : : BadValue , config . validate ( ) ) ; <nl> + <nl> + const BSONObj configBsonOneVoter = BSON ( <nl> + " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( <nl> + BSON ( " _id " < < 0 < < " host " < < " localhost : 1 " < < " votes " < < 0 ) < < <nl> + BSON ( " _id " < < 1 < < " host " < < " localhost : 2 " < < " votes " < < 1 ) ) ) ; <nl> + ASSERT_OK ( config . initialize ( configBsonOneVoter ) ) ; <nl> + ASSERT_OK ( config . validate ( ) ) ; <nl> + } <nl> + <nl> + TEST ( ReplicaSetConfig , ParseFailsWithTooManyVoters ) { <nl> + ReplicaSetConfig config ; <nl> + namespace mmb = mutablebson ; <nl> + mmb : : Document configDoc ; <nl> + mmb : : Element configDocRoot = configDoc . root ( ) ; <nl> + ASSERT_OK ( configDocRoot . appendString ( " _id " , " rs0 " ) ) ; <nl> + ASSERT_OK ( configDocRoot . appendInt ( " version " , 1 ) ) ; <nl> + mmb : : Element membersArray = configDoc . makeElementArray ( " members " ) ; <nl> + ASSERT_OK ( configDocRoot . pushBack ( membersArray ) ) ; <nl> + for ( size_t i = 0 ; i < ReplicaSetConfig : : kMaxVotingMembers + 1 ; + + i ) { <nl> + mmb : : Element memberElement = configDoc . makeElementObject ( " " ) ; <nl> + ASSERT_OK ( membersArray . pushBack ( memberElement ) ) ; <nl> + ASSERT_OK ( memberElement . appendInt ( " _id " , i ) ) ; <nl> + ASSERT_OK ( memberElement . appendString ( <nl> + " host " , std : : string ( str : : stream ( ) < < " localhost " < < i + 1 ) ) ) ; <nl> + ASSERT_OK ( memberElement . appendInt ( " votes " , 1 ) ) ; <nl> + } <nl> + <nl> + const BSONObj configBsonTooManyVoters = configDoc . getObject ( ) ; <nl> + <nl> + membersArray . leftChild ( ) . findFirstChildNamed ( " votes " ) . setValueInt ( 0 ) ; <nl> + const BSONObj configBsonMaxVoters = configDoc . getObject ( ) ; <nl> + <nl> + <nl> + ASSERT_OK ( config . initialize ( configBsonMaxVoters ) ) ; <nl> + ASSERT_OK ( config . validate ( ) ) ; <nl> + ASSERT_OK ( config . initialize ( configBsonTooManyVoters ) ) ; <nl> + ASSERT_EQUALS ( ErrorCodes : : BadValue , config . validate ( ) ) ; <nl> + } <nl> + <nl> + TEST ( ReplicaSetConfig , ParseFailsWithDuplicateHost ) { <nl> + ReplicaSetConfig config ; <nl> + const BSONObj configBson = BSON ( <nl> + " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( <nl> + BSON ( " _id " < < 0 < < " host " < < " localhost : 1 " ) < < <nl> + BSON ( " _id " < < 1 < < " host " < < " localhost : 1 " ) ) ) ; <nl> + ASSERT_OK ( config . initialize ( configBson ) ) ; <nl> + ASSERT_EQUALS ( ErrorCodes : : BadValue , config . validate ( ) ) ; <nl> + } <nl> + <nl> + TEST ( ReplicaSetConfig , ParseFailsWithTooManyNodes ) { <nl> + ReplicaSetConfig config ; <nl> + namespace mmb = mutablebson ; <nl> + mmb : : Document configDoc ; <nl> + mmb : : Element configDocRoot = configDoc . root ( ) ; <nl> + ASSERT_OK ( configDocRoot . appendString ( " _id " , " rs0 " ) ) ; <nl> + ASSERT_OK ( configDocRoot . appendInt ( " version " , 1 ) ) ; <nl> + mmb : : Element membersArray = configDoc . makeElementArray ( " members " ) ; <nl> + ASSERT_OK ( configDocRoot . pushBack ( membersArray ) ) ; <nl> + for ( size_t i = 0 ; i < ReplicaSetConfig : : kMaxMembers ; + + i ) { <nl> + mmb : : Element memberElement = configDoc . makeElementObject ( " " ) ; <nl> + ASSERT_OK ( membersArray . pushBack ( memberElement ) ) ; <nl> + ASSERT_OK ( memberElement . appendInt ( " _id " , i ) ) ; <nl> + ASSERT_OK ( memberElement . appendString ( <nl> + " host " , std : : string ( str : : stream ( ) < < " localhost " < < i + 1 ) ) ) ; <nl> + if ( i > = ReplicaSetConfig : : kMaxVotingMembers ) { <nl> + ASSERT_OK ( memberElement . appendInt ( " votes " , 0 ) ) ; <nl> + } <nl> + } <nl> + const BSONObj configBsonMaxNodes = configDoc . getObject ( ) ; <nl> + <nl> + mmb : : Element memberElement = configDoc . makeElementObject ( " " ) ; <nl> + ASSERT_OK ( membersArray . pushBack ( memberElement ) ) ; <nl> + ASSERT_OK ( memberElement . appendInt ( " _id " , ReplicaSetConfig : : kMaxMembers ) ) ; <nl> + ASSERT_OK ( memberElement . appendString ( <nl> + " host " , std : : string ( str : : stream ( ) < < <nl> + " localhost " < < ReplicaSetConfig : : kMaxMembers + 1 ) ) ) ; <nl> + ASSERT_OK ( memberElement . appendInt ( " votes " , 0 ) ) ; <nl> + const BSONObj configBsonTooManyNodes = configDoc . getObject ( ) ; <nl> + <nl> + <nl> + ASSERT_OK ( config . initialize ( configBsonMaxNodes ) ) ; <nl> + ASSERT_OK ( config . validate ( ) ) ; <nl> + ASSERT_OK ( config . initialize ( configBsonTooManyNodes ) ) ; <nl> + ASSERT_EQUALS ( ErrorCodes : : BadValue , config . validate ( ) ) ; <nl> + } <nl> + <nl> + TEST ( ReplicaSetConfig , ChainingAllowedField ) { <nl> + ReplicaSetConfig config ; <nl> + ASSERT_OK ( config . initialize ( <nl> + BSON ( " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) ) < < <nl> + " settings " < < BSON ( " chainingAllowed " < < true ) ) ) ) ; <nl> + ASSERT_OK ( config . validate ( ) ) ; <nl> + ASSERT_TRUE ( config . isChainingAllowed ( ) ) ; <nl> + <nl> + ASSERT_OK ( config . initialize ( <nl> + BSON ( " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) ) < < <nl> + " settings " < < BSON ( " chainingAllowed " < < false ) ) ) ) ; <nl> + ASSERT_OK ( config . validate ( ) ) ; <nl> + ASSERT_FALSE ( config . isChainingAllowed ( ) ) ; <nl> + } <nl> + <nl> + TEST ( ReplicaSetConfig , HeartbeatTimeoutField ) { <nl> + ReplicaSetConfig config ; <nl> + ASSERT_OK ( config . initialize ( <nl> + BSON ( " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) ) < < <nl> + " settings " < < BSON ( " heartbeatTimeoutSecs " < < 20 ) ) ) ) ; <nl> + ASSERT_OK ( config . validate ( ) ) ; <nl> + ASSERT_EQUALS ( 20 , config . getHeartbeatTimeoutPeriod ( ) . total_seconds ( ) ) ; <nl> + <nl> + ASSERT_OK ( config . initialize ( <nl> + BSON ( " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) ) < < <nl> + " settings " < < BSON ( " heartbeatTimeoutSecs " < < - 20 ) ) ) ) ; <nl> + ASSERT_EQUALS ( ErrorCodes : : BadValue , config . validate ( ) ) ; <nl> + } <nl> + <nl> + TEST ( ReplicaSetConfig , GleDefaultField ) { <nl> + ReplicaSetConfig config ; <nl> + ASSERT_OK ( config . initialize ( <nl> + BSON ( " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) ) < < <nl> + " settings " < < BSON ( <nl> + " getLastErrorDefaults " < < BSON ( " w " < < " majority " ) ) ) ) ) ; <nl> + ASSERT_OK ( config . validate ( ) ) ; <nl> + ASSERT_EQUALS ( " majority " , config . getDefaultWriteConcern ( ) . wMode ) ; <nl> + <nl> + ASSERT_OK ( config . initialize ( <nl> + BSON ( " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " ) ) < < <nl> + " settings " < < BSON ( <nl> + " getLastErrorDefaults " < < BSON ( " w " < < " frim " ) ) ) ) ) ; <nl> + ASSERT_EQUALS ( ErrorCodes : : BadValue , config . validate ( ) ) ; <nl> + <nl> + ASSERT_OK ( config . initialize ( <nl> + BSON ( " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( BSON ( " _id " < < 0 < < <nl> + " host " < < " localhost : 12345 " < < <nl> + " tags " < < BSON ( " a " < < " v " ) ) ) < < <nl> + " settings " < < BSON ( <nl> + " getLastErrorDefaults " < < BSON ( " w " < < " frim " ) < < <nl> + " getLastErrorModes " < < BSON ( " frim " < < BSON ( " a " < < 1 ) ) ) ) ) ) ; <nl> + ASSERT_OK ( config . validate ( ) ) ; <nl> + ASSERT_EQUALS ( " frim " , config . getDefaultWriteConcern ( ) . wMode ) ; <nl> + ASSERT_OK ( config . findCustomWriteMode ( " frim " ) . getStatus ( ) ) ; <nl> + } <nl> + <nl> + } / / namespace <nl> + } / / namespace repl <nl> + } / / namespace mongo <nl>
|
SERVER - 14436 Introduce ReplicaSetConfig type , with validation tests .
|
mongodb/mongo
|
deeb8bc5d608cc42300ff4407f3c4dac69e73d17
|
2014-07-16T21:16:05Z
|
mmm a / docs / Quick - Start . rst <nl> ppp b / docs / Quick - Start . rst <nl> Some important parameters : <nl> <nl> - path to config file <nl> <nl> - - ` ` task ` ` , default = \ ` ` train ` ` , type = enum , options = \ ` ` train ` ` , ` ` prediction ` ` <nl> + - ` ` task ` ` , default = \ ` ` train ` ` , type = enum , options = \ ` ` train ` ` , ` ` predict ` ` , ` ` convert_model ` ` <nl> <nl> - - ` ` train ` ` for training <nl> + - ` ` train ` ` , alias = \ ` ` training ` ` , for training <nl> <nl> - - ` ` prediction ` ` for prediction <nl> + - ` ` predict ` ` , alias = \ ` ` prediction ` ` , ` ` test ` ` , for prediction . <nl> <nl> - - ` ` application ` ` , default = \ ` ` regression ` ` , type = enum , <nl> - options = \ ` ` regression ` ` , ` ` regression_l2 ` ` , ` ` regression_l1 ` ` , ` ` huber ` ` , ` ` fair ` ` , ` ` poisson ` ` , ` ` binary ` ` , ` ` lambdarank ` ` , ` ` multiclass ` ` , <nl> - alias = \ ` ` objective ` ` , ` ` app ` ` <nl> + - ` ` convert_model ` ` , for converting model file into if - else format , see more information in ` Convert model parameters < . / Parameters . rst # convert - model - parameters > ` __ <nl> <nl> - - ` ` regression ` ` , regression application <nl> + - ` ` application ` ` , default = \ ` ` regression ` ` , type = enum , <nl> + options = \ ` ` regression ` ` , ` ` regression_l1 ` ` , ` ` huber ` ` , ` ` fair ` ` , ` ` poisson ` ` , ` ` quantile ` ` , ` ` quantile_l2 ` ` , <nl> + ` ` binary ` ` , ` ` multiclass ` ` , ` ` multiclassova ` ` , ` ` xentropy ` ` , ` ` xentlambda ` ` , ` ` lambdarank ` ` , <nl> + alias = \ ` ` objective ` ` , ` ` app ` ` <nl> <nl> - - ` ` regression_l2 ` ` , L2 loss , alias = \ ` ` mean_squared_error ` ` , ` ` mse ` ` <nl> + - regression application <nl> <nl> - - ` ` regression_l1 ` ` , L1 loss , alias = \ ` ` mean_absolute_error ` ` , ` ` mae ` ` <nl> + - ` ` regression_l2 ` ` , L2 loss , alias = \ ` ` regression ` ` , ` ` mean_squared_error ` ` , ` ` mse ` ` <nl> <nl> - - ` ` huber ` ` , ` Huber loss ` _ <nl> + - ` ` regression_l1 ` ` , L1 loss , alias = \ ` ` mean_absolute_error ` ` , ` ` mae ` ` <nl> <nl> - - ` ` fair ` ` , ` Fair loss ` _ <nl> + - ` ` huber ` ` , ` Huber loss ` _ <nl> <nl> - - ` ` poisson ` ` , ` Poisson regression ` _ <nl> + - ` ` fair ` ` , ` Fair loss ` _ <nl> <nl> - - ` ` binary ` ` , binary classification application <nl> + - ` ` poisson ` ` , ` Poisson regression ` _ <nl> <nl> - - ` ` lambdarank ` ` , ` lambdarank ` _ application <nl> + - ` ` quantile ` ` , ` Quantile regression ` _ <nl> <nl> - - the label should be ` ` int ` ` type in lambdarank tasks , <nl> - and larger number represent the higher relevance ( e . g . 0 : bad , 1 : fair , 2 : good , 3 : perfect ) <nl> + - ` ` quantile_l2 ` ` , like the ` ` quantile ` ` , but L2 loss is used instead <nl> <nl> - - ` ` label_gain ` ` can be used to set the gain ( weight ) of ` ` int ` ` label . <nl> + - ` ` binary ` ` , binary ` log loss ` _ classification application <nl> <nl> - - ` ` multiclass ` ` , multi - class classification application , ` ` num_class ` ` should be set as well <nl> + - multi - class classification application <nl> + <nl> + - ` ` multiclass ` ` , ` softmax ` _ objective function , ` ` num_class ` ` should be set as well <nl> + <nl> + - ` ` multiclassova ` ` , ` One - vs - All ` _ binary objective function , ` ` num_class ` ` should be set as well <nl> + <nl> + - cross - entropy application <nl> + <nl> + - ` ` xentropy ` ` , objective function for cross - entropy ( with optional linear weights ) , alias = \ ` ` cross_entropy ` ` <nl> + <nl> + - ` ` xentlambda ` ` , alternative parameterization of cross - entropy , alias = \ ` ` cross_entropy_lambda ` ` <nl> + <nl> + - the label is anything in interval [ 0 , 1 ] <nl> + <nl> + - ` ` lambdarank ` ` , ` lambdarank ` _ application <nl> + <nl> + - the label should be ` ` int ` ` type in lambdarank tasks , and larger number represent the higher relevance ( e . g . 0 : bad , 1 : fair , 2 : good , 3 : perfect ) <nl> + <nl> + - ` ` label_gain ` ` can be used to set the gain ( weight ) of ` ` int ` ` label <nl> <nl> - ` ` boosting ` ` , default = \ ` ` gbdt ` ` , type = enum , <nl> options = \ ` ` gbdt ` ` , ` ` rf ` ` , ` ` dart ` ` , ` ` goss ` ` , <nl> Some important parameters : <nl> <nl> - number of leaves in one tree <nl> <nl> - - ` ` tree_learner ` ` , default = \ ` ` serial ` ` , type = enum , options = \ ` ` serial ` ` , ` ` feature ` ` , ` ` data ` ` , alias = \ ` ` tree ` ` <nl> + - ` ` tree_learner ` ` , default = \ ` ` serial ` ` , type = enum , options = \ ` ` serial ` ` , ` ` feature ` ` , ` ` data ` ` , ` ` voting ` ` , alias = \ ` ` tree ` ` <nl> <nl> - - ` ` serial ` ` , single machine tree learner <nl> + - ` ` serial ` ` , single machine tree learner <nl> <nl> - - ` ` feature ` ` , feature parallel tree learner <nl> + - ` ` feature ` ` , alias = \ ` ` feature_parallel ` ` , feature parallel tree learner <nl> <nl> - - ` ` data ` ` , data parallel tree learner <nl> + - ` ` data ` ` , alias = \ ` ` data_parallel ` ` , data parallel tree learner <nl> <nl> - - refer to ` Parallel Learning Guide < . / Parallel - Learning - Guide . rst > ` __ to get more details <nl> + - ` ` voting ` ` , alias = \ ` ` voting_parallel ` ` , voting parallel tree learner <nl> + <nl> + - refer to ` Parallel Learning Guide < . / Parallel - Learning - Guide . rst > ` __ to get more details <nl> <nl> - ` ` num_threads ` ` , default = \ ` ` OpenMP_default ` ` , type = int , alias = \ ` ` num_thread ` ` , ` ` nthread ` ` <nl> <nl> Some important parameters : <nl> - ` ` min_sum_hessian_in_leaf ` ` , default = \ ` ` 1e - 3 ` ` , type = double , <nl> alias = \ ` ` min_sum_hessian_per_leaf ` ` , ` ` min_sum_hessian ` ` , ` ` min_hessian ` ` , ` ` min_child_weight ` ` <nl> <nl> - - minimal sum hessian in one leaf . Like ` ` min_data_in_leaf ` ` , can be used to deal with over - fitting <nl> + - minimal sum hessian in one leaf . Like ` ` min_data_in_leaf ` ` , it can be used to deal with over - fitting <nl> <nl> For all parameters , please refer to ` Parameters < . / Parameters . rst > ` __ . <nl> <nl> Examples <nl> <nl> . . _Poisson regression : https : / / en . wikipedia . org / wiki / Poisson_regression <nl> <nl> + . . _Quantile regression : https : / / en . wikipedia . org / wiki / Quantile_regression <nl> + <nl> + . . _log loss : https : / / www . kaggle . com / wiki / LogLoss <nl> + <nl> + . . _softmax : https : / / en . wikipedia . org / wiki / Softmax_function <nl> + <nl> + . . _One - vs - All : https : / / en . wikipedia . org / wiki / Multiclass_classification # One - vs . - rest <nl> + <nl> . . _lambdarank : https : / / papers . nips . cc / paper / 2971 - learning - to - rank - with - nonsmooth - cost - functions . pdf <nl> <nl> . . _Dropouts meet Multiple Additive Regression Trees : https : / / arxiv . org / abs / 1505 . 01866 <nl>
|
[ docs ] updated Quick Start according to the last changes in Parameters ( )
|
microsoft/LightGBM
|
0ac24779eb3ad5735c064ddd01ad9d070ec80558
|
2017-11-19T01:59:12Z
|
mmm a / Marlin / Marlin_main . cpp <nl> ppp b / Marlin / Marlin_main . cpp <nl> void kill ( const char * lcd_msg ) { <nl> SERIAL_ERROR_START ; <nl> SERIAL_ERRORLNPGM ( MSG_ERR_KILLED ) ; <nl> <nl> + thermalManager . disable_all_heaters ( ) ; <nl> + disable_all_steppers ( ) ; <nl> + <nl> # if ENABLED ( ULTRA_LCD ) <nl> kill_screen ( lcd_msg ) ; <nl> # else <nl> UNUSED ( lcd_msg ) ; <nl> # endif <nl> <nl> - delay ( 500 ) ; / / Wait a short time <nl> - <nl> + _delay_ms ( 250 ) ; / / Wait a short time <nl> cli ( ) ; / / Stop interrupts <nl> - thermalManager . disable_all_heaters ( ) ; <nl> - disable_all_steppers ( ) ; <nl> + <nl> + _delay_ms ( 250 ) ; / / Wait to ensure all interrupts routines stopped <nl> + thermalManager . disable_all_heaters ( ) ; / / turn off heaters again <nl> <nl> # if HAS_POWER_SWITCH <nl> SET_INPUT ( PS_ON_PIN ) ; <nl>
|
Merge pull request from rafaljot / patch - 3
|
MarlinFirmware/Marlin
|
8f9face9569f6eb39370a369ea6fb198fb662aea
|
2017-03-23T06:51:51Z
|
mmm a / src / wasm / wasm - interpreter . cc <nl> ppp b / src / wasm / wasm - interpreter . cc <nl> class ThreadImpl { <nl> EXTRACT_LANE_EXTEND_CASE ( I8x16 , i8x16 , S , int32_t ) <nl> EXTRACT_LANE_EXTEND_CASE ( I8x16 , i8x16 , U , uint32_t ) <nl> # undef EXTRACT_LANE_EXTEND_CASE <nl> - # define BINOP_CASE ( op , name , stype , count , expr ) \ <nl> - case kExpr # # op : { \ <nl> - WasmValue v2 = Pop ( ) ; \ <nl> - WasmValue v1 = Pop ( ) ; \ <nl> - stype s1 = v1 . to_s128 ( ) . to_ # # name ( ) ; \ <nl> - stype s2 = v2 . to_s128 ( ) . to_ # # name ( ) ; \ <nl> - stype res ; \ <nl> - for ( size_t i = 0 ; i < count ; + + i ) { \ <nl> - auto a = s1 . val [ LANE ( i , s1 ) ] ; \ <nl> - auto b = s2 . val [ LANE ( i , s1 ) ] ; \ <nl> - res . val [ LANE ( i , s1 ) ] = expr ; \ <nl> - } \ <nl> - Push ( WasmValue ( Simd128 ( res ) ) ) ; \ <nl> - return true ; \ <nl> + # define BINOP_CASE ( op , name , stype , count , expr ) \ <nl> + case kExpr # # op : { \ <nl> + WasmValue v2 = Pop ( ) ; \ <nl> + WasmValue v1 = Pop ( ) ; \ <nl> + stype s1 = v1 . to_s128 ( ) . to_ # # name ( ) ; \ <nl> + stype s2 = v2 . to_s128 ( ) . to_ # # name ( ) ; \ <nl> + stype res ; \ <nl> + for ( size_t i = 0 ; i < count ; + + i ) { \ <nl> + auto a = s1 . val [ LANE ( i , s1 ) ] ; \ <nl> + auto b = s2 . val [ LANE ( i , s1 ) ] ; \ <nl> + auto result = expr ; \ <nl> + possible_nondeterminism_ | = has_nondeterminism ( result ) ; \ <nl> + res . val [ LANE ( i , s1 ) ] = expr ; \ <nl> + } \ <nl> + Push ( WasmValue ( Simd128 ( res ) ) ) ; \ <nl> + return true ; \ <nl> } <nl> BINOP_CASE ( F64x2Add , f64x2 , float2 , 2 , a + b ) <nl> BINOP_CASE ( F64x2Sub , f64x2 , float2 , 2 , a - b ) <nl> class ThreadImpl { <nl> BINOP_CASE ( I8x16RoundingAverageU , i8x16 , int16 , 16 , <nl> base : : RoundingAverageUnsigned < uint8_t > ( a , b ) ) <nl> # undef BINOP_CASE <nl> - # define UNOP_CASE ( op , name , stype , count , expr ) \ <nl> - case kExpr # # op : { \ <nl> - WasmValue v = Pop ( ) ; \ <nl> - stype s = v . to_s128 ( ) . to_ # # name ( ) ; \ <nl> - stype res ; \ <nl> - for ( size_t i = 0 ; i < count ; + + i ) { \ <nl> - auto a = s . val [ i ] ; \ <nl> - res . val [ i ] = expr ; \ <nl> - } \ <nl> - Push ( WasmValue ( Simd128 ( res ) ) ) ; \ <nl> - return true ; \ <nl> + # define UNOP_CASE ( op , name , stype , count , expr ) \ <nl> + case kExpr # # op : { \ <nl> + WasmValue v = Pop ( ) ; \ <nl> + stype s = v . to_s128 ( ) . to_ # # name ( ) ; \ <nl> + stype res ; \ <nl> + for ( size_t i = 0 ; i < count ; + + i ) { \ <nl> + auto a = s . val [ i ] ; \ <nl> + auto result = expr ; \ <nl> + possible_nondeterminism_ | = has_nondeterminism ( result ) ; \ <nl> + res . val [ i ] = result ; \ <nl> + } \ <nl> + Push ( WasmValue ( Simd128 ( res ) ) ) ; \ <nl> + return true ; \ <nl> } <nl> UNOP_CASE ( F64x2Abs , f64x2 , float2 , 2 , std : : abs ( a ) ) <nl> UNOP_CASE ( F64x2Neg , f64x2 , float2 , 2 , - a ) <nl> class ThreadImpl { <nl> BITMASK_CASE ( I32x4BitMask , i32x4 , int4 , 4 ) <nl> # undef BITMASK_CASE <nl> <nl> - # define CMPOP_CASE ( op , name , stype , out_stype , count , expr ) \ <nl> - case kExpr # # op : { \ <nl> - WasmValue v2 = Pop ( ) ; \ <nl> - WasmValue v1 = Pop ( ) ; \ <nl> - stype s1 = v1 . to_s128 ( ) . to_ # # name ( ) ; \ <nl> - stype s2 = v2 . to_s128 ( ) . to_ # # name ( ) ; \ <nl> - out_stype res ; \ <nl> - for ( size_t i = 0 ; i < count ; + + i ) { \ <nl> - auto a = s1 . val [ i ] ; \ <nl> - auto b = s2 . val [ i ] ; \ <nl> - res . val [ i ] = expr ? - 1 : 0 ; \ <nl> - } \ <nl> - Push ( WasmValue ( Simd128 ( res ) ) ) ; \ <nl> - return true ; \ <nl> + # define CMPOP_CASE ( op , name , stype , out_stype , count , expr ) \ <nl> + case kExpr # # op : { \ <nl> + WasmValue v2 = Pop ( ) ; \ <nl> + WasmValue v1 = Pop ( ) ; \ <nl> + stype s1 = v1 . to_s128 ( ) . to_ # # name ( ) ; \ <nl> + stype s2 = v2 . to_s128 ( ) . to_ # # name ( ) ; \ <nl> + out_stype res ; \ <nl> + for ( size_t i = 0 ; i < count ; + + i ) { \ <nl> + auto a = s1 . val [ i ] ; \ <nl> + auto b = s2 . val [ i ] ; \ <nl> + auto result = expr ; \ <nl> + possible_nondeterminism_ | = has_nondeterminism ( result ) ; \ <nl> + res . val [ i ] = result ? - 1 : 0 ; \ <nl> + } \ <nl> + Push ( WasmValue ( Simd128 ( res ) ) ) ; \ <nl> + return true ; \ <nl> } <nl> CMPOP_CASE ( F64x2Eq , f64x2 , float2 , int2 , 2 , a = = b ) <nl> CMPOP_CASE ( F64x2Ne , f64x2 , float2 , int2 , 2 , a ! = b ) <nl> class ThreadImpl { <nl> dst_type res ; \ <nl> for ( size_t i = 0 ; i < count ; + + i ) { \ <nl> ctype a = s . val [ LANE ( start_index + i , s ) ] ; \ <nl> + auto result = expr ; \ <nl> + possible_nondeterminism_ | = has_nondeterminism ( result ) ; \ <nl> res . val [ LANE ( i , res ) ] = expr ; \ <nl> } \ <nl> Push ( WasmValue ( Simd128 ( res ) ) ) ; \ <nl> class ThreadImpl { <nl> Push ( WasmValue ( Simd128 ( res ) ) ) ; <nl> return true ; <nl> } <nl> - # define ADD_HORIZ_CASE ( op , name , stype , count ) \ <nl> - case kExpr # # op : { \ <nl> - WasmValue v2 = Pop ( ) ; \ <nl> - WasmValue v1 = Pop ( ) ; \ <nl> - stype s1 = v1 . to_s128 ( ) . to_ # # name ( ) ; \ <nl> - stype s2 = v2 . to_s128 ( ) . to_ # # name ( ) ; \ <nl> - stype res ; \ <nl> - for ( size_t i = 0 ; i < count / 2 ; + + i ) { \ <nl> - res . val [ LANE ( i , s1 ) ] = \ <nl> - s1 . val [ LANE ( i * 2 , s1 ) ] + s1 . val [ LANE ( i * 2 + 1 , s1 ) ] ; \ <nl> - res . val [ LANE ( i + count / 2 , s1 ) ] = \ <nl> - s2 . val [ LANE ( i * 2 , s1 ) ] + s2 . val [ LANE ( i * 2 + 1 , s1 ) ] ; \ <nl> - } \ <nl> - Push ( WasmValue ( Simd128 ( res ) ) ) ; \ <nl> - return true ; \ <nl> + # define ADD_HORIZ_CASE ( op , name , stype , count ) \ <nl> + case kExpr # # op : { \ <nl> + WasmValue v2 = Pop ( ) ; \ <nl> + WasmValue v1 = Pop ( ) ; \ <nl> + stype s1 = v1 . to_s128 ( ) . to_ # # name ( ) ; \ <nl> + stype s2 = v2 . to_s128 ( ) . to_ # # name ( ) ; \ <nl> + stype res ; \ <nl> + for ( size_t i = 0 ; i < count / 2 ; + + i ) { \ <nl> + auto result1 = s1 . val [ LANE ( i * 2 , s1 ) ] + s1 . val [ LANE ( i * 2 + 1 , s1 ) ] ; \ <nl> + possible_nondeterminism_ | = has_nondeterminism ( result1 ) ; \ <nl> + res . val [ LANE ( i , s1 ) ] = result1 ; \ <nl> + auto result2 = s2 . val [ LANE ( i * 2 , s1 ) ] + s2 . val [ LANE ( i * 2 + 1 , s1 ) ] ; \ <nl> + possible_nondeterminism_ | = has_nondeterminism ( result2 ) ; \ <nl> + res . val [ LANE ( i + count / 2 , s1 ) ] = result2 ; \ <nl> + } \ <nl> + Push ( WasmValue ( Simd128 ( res ) ) ) ; \ <nl> + return true ; \ <nl> } <nl> ADD_HORIZ_CASE ( I32x4AddHoriz , i32x4 , int4 , 4 ) <nl> ADD_HORIZ_CASE ( F32x4AddHoriz , f32x4 , float4 , 4 ) <nl>
|
[ wasm - simd ] Indicate possible non - determinism in the interpreter
|
v8/v8
|
4ca768db8f96a2964e49424211e83493de891cb1
|
2020-05-05T19:12:29Z
|
mmm a / src / Dictionaries / TrieDictionary . cpp <nl> ppp b / src / Dictionaries / TrieDictionary . cpp <nl> void TrieDictionary : : loadData ( ) <nl> { <nl> if ( a . addr . family ( ) ! = b . addr . family ( ) ) <nl> return a . addr . family ( ) < b . addr . family ( ) ; <nl> + <nl> + / / prefer IPs with more narrow subnet <nl> if ( a . addr = = b . addr ) <nl> - return a . prefix > b . prefix ; <nl> + return a . prefix < b . prefix ; <nl> return a . addr < b . addr ; <nl> } ) ; <nl> <nl>
|
Fix ip subnet comparison
|
ClickHouse/ClickHouse
|
c306902fdf2fe778dbe9d82063631814541855f6
|
2020-11-08T20:21:13Z
|
mmm a / fdbclient / DatabaseConfiguration . cpp <nl> ppp b / fdbclient / DatabaseConfiguration . cpp <nl> void DatabaseConfiguration : : fromKeyValues ( Standalone < VectorRef < KeyValueRef > > raw <nl> bool DatabaseConfiguration : : isOverridden ( std : : string key ) const { <nl> key = configKeysPrefix . toString ( ) + key ; <nl> <nl> - if ( mutableConfiguration . present ( ) & & mutableConfiguration . get ( ) . find ( key ) ! = mutableConfiguration . get ( ) . end ( ) ) { <nl> - return true ; <nl> + if ( mutableConfiguration . present ( ) ) { <nl> + return mutableConfiguration . get ( ) . find ( key ) ! = mutableConfiguration . get ( ) . end ( ) ; <nl> } <nl> <nl> const int keyLen = key . size ( ) ; <nl>
|
If mutableConfiguration exists , skip checking rawConfiguration in DatabaseConfiguration
|
apple/foundationdb
|
8e50b51fbd8aa84a7b8ac2b7a4c626894d27a608
|
2020-08-10T05:12:42Z
|
mmm a / src / Formats / FormatFactory . cpp <nl> ppp b / src / Formats / FormatFactory . cpp <nl> BlockOutputStreamPtr FormatFactory : : getOutput ( const String & name , <nl> / * * TODO : Materialization is needed , because formats can use the functions ` IDataType ` , <nl> * which only work with full columns . <nl> * / <nl> - auto formatter_creator = [ output_getter , sample , callback , format_settings ] <nl> + <nl> + RowOutputFormatParams row_output_format_params { callback , ignore_no_row_delimiter } ; <nl> + <nl> + auto formatter_creator = [ output_getter , sample , row_output_format_params , format_settings ] <nl> ( WriteBuffer & output ) - > OutputFormatPtr <nl> - { return output_getter ( output , sample , std : : move ( callback ) , format_settings ) ; } ; <nl> + { return output_getter ( output , sample , row_output_format_params , format_settings ) ; } ; / / / FIXME <nl> <nl> ParallelFormattingOutputFormat : : Params params { buf , sample , formatter_creator , settings . max_threads } ; <nl> auto format = std : : make_shared < ParallelFormattingOutputFormat > ( params ) ; <nl> BlockOutputStreamPtr FormatFactory : : getOutput ( const String & name , <nl> } <nl> <nl> <nl> - auto format = getOutputFormat ( name , buf , sample , context , std : : move ( callback ) ) ; <nl> + auto format = getOutputFormat ( name , buf , sample , context , std : : move ( callback ) , ignore_no_row_delimiter ) ; <nl> return std : : make_shared < MaterializingBlockOutputStream > ( std : : make_shared < OutputStreamToOutputFormat > ( format ) , sample ) ; <nl> } <nl> <nl>
|
better
|
ClickHouse/ClickHouse
|
3c683b1d8620dbb8b396b7e89ba06713bfeb4e1f
|
2020-12-14T21:56:47Z
|
mmm a / example / rcnn / tools / test_rpn . py <nl> ppp b / example / rcnn / tools / test_rpn . py <nl> def test_rpn ( image_set , year , root_path , devkit_path , prefix , epoch , ctx , vis = Fa <nl> test_data = ROIIter ( roidb , batch_size = 1 , shuffle = False , mode = ' test ' ) <nl> <nl> # load model <nl> - args , auxs = load_param ( prefix , epoch , convert = True , ctx = ctx ) <nl> + args , auxs , _ = load_param ( prefix , epoch , convert = True , ctx = ctx ) <nl> <nl> # start testing <nl> detector = Detector ( sym , ctx , args , auxs ) <nl> mmm a / example / rcnn / tools / train_rcnn . py <nl> ppp b / example / rcnn / tools / train_rcnn . py <nl> def train_rcnn ( image_set , year , root_path , devkit_path , pretrained , epoch , <nl> max_data_shape = [ ( ' data ' , ( config . TRAIN . BATCH_IMAGES , 3 , 1000 , 1000 ) ) ] <nl> <nl> # load pretrained <nl> - args , auxs = load_param ( pretrained , epoch , convert = True ) <nl> + args , auxs , _ = load_param ( pretrained , epoch , convert = True ) <nl> <nl> # initialize params <nl> if not resume : <nl> mmm a / example / rcnn / tools / train_rpn . py <nl> ppp b / example / rcnn / tools / train_rpn . py <nl> def train_rpn ( image_set , year , root_path , devkit_path , pretrained , epoch , <nl> print ' providing maximum shape ' , max_data_shape , max_label_shape <nl> <nl> # load pretrained <nl> - args , auxs = load_param ( pretrained , epoch , convert = True ) <nl> + args , auxs , _ = load_param ( pretrained , epoch , convert = True ) <nl> <nl> # initialize params <nl> if not resume : <nl>
|
Fixed an inconsistency between the load_param return value and the received value ( )
|
apache/incubator-mxnet
|
abbb5b97af173daab182201f0bb54e75af9255bd
|
2016-11-24T21:10:08Z
|
mmm a / . gitignore <nl> ppp b / . gitignore <nl> CMakeLists . txt . user <nl> CMakeScripts / * * <nl> build / Xcode / FlatBuffers . xcodeproj / project . xcworkspace / * * <nl> build / Xcode / FlatBuffers . xcodeproj / xcuserdata / * * <nl> + java / . idea <nl> + java / * . iml <nl> + java / target <nl>
|
Ignore intellij files
|
google/flatbuffers
|
f5132b9ee190695de4fbfa833722ac4e016ba2cd
|
2015-01-16T19:09:06Z
|
mmm a / tests / runner . py <nl> ppp b / tests / runner . py <nl> <nl> import os , unittest , tempfile , shutil , time , inspect , sys , math , glob , tempfile , re , difflib , webbrowser , hashlib , threading , platform , BaseHTTPServer , multiprocessing <nl> <nl> <nl> + if len ( sys . argv ) = = 1 : <nl> + print ' ' ' <nl> + Running the main part of the test suite . Don ' t forget to run the other parts ! <nl> + <nl> + sanity - tests for first run , etc . , modifies ~ / . emscripten <nl> + benchmark - run before and after each set of changes before pushing to master , verify no regressions <nl> + browser - TODO <nl> + ' ' ' <nl> + time . sleep ( 2 ) <nl> + <nl> # Setup <nl> <nl> __rootpath__ = os . path . dirname ( os . path . dirname ( os . path . abspath ( __file__ ) ) ) <nl>
|
test runner message about non - main parts
|
emscripten-core/emscripten
|
5495f8c61797173b6e9e0b505c9a426399d2bfb1
|
2012-03-31T05:37:13Z
|
mmm a / caffe2 / operators / recurrent_network_op . h <nl> ppp b / caffe2 / operators / recurrent_network_op . h <nl> class RecurrentNetworkOp final : public Operator < Context > { <nl> OperatorBase : : Output < std : : vector < std : : shared_ptr < Workspace > > > ( <nl> OutputSize ( ) - 1 ) ; <nl> <nl> - if ( stepWorkspaces - > size ( ) < seqLen ) { <nl> - stepWorkspaces - > clear ( ) ; <nl> - stepWorkspaces - > resize ( seqLen ) ; <nl> - } <nl> + stepWorkspaces - > resize ( seqLen ) ; <nl> <nl> for ( auto t = 0 ; t < seqLen ; + + t ) { <nl> if ( ! ( * stepWorkspaces ) [ t ] . get ( ) ) { <nl>
|
Backed out changeset 35c70e825855
|
pytorch/pytorch
|
25bbd632e3534893ac25bd7fc52307b46b35b64e
|
2017-03-19T05:31:39Z
|
mmm a / Telegram / SourceFiles / apiwrap . cpp <nl> ppp b / Telegram / SourceFiles / apiwrap . cpp <nl> void ApiWrap : : requestMoreDialogs ( Data : : Folder * folder ) { <nl> } ) ; <nl> <nl> if ( ! folder ) { <nl> - requestDialogs ( folder ) ; <nl> - requestContacts ( ) ; <nl> - if ( ! _dialogsLoadState <nl> - | | ( ! _dialogsLoadState - > listReceived <nl> - & & ! _dialogsLoadState - > requestId ) ) { <nl> + if ( ! _dialogsLoadState | | ! _dialogsLoadState - > listReceived ) { <nl> refreshDialogsLoadBlocked ( ) ; <nl> } <nl> + requestDialogs ( folder ) ; <nl> + requestContacts ( ) ; <nl> } <nl> _session - > data ( ) . chatsListChanged ( folder ) ; <nl> } ) . fail ( [ = ] ( const RPCError & error ) { <nl> void ApiWrap : : requestMoreBlockedByDateDialogs ( ) { <nl> _dialogsLoadTill = _dialogsLoadState - > offsetDate <nl> ? ( _dialogsLoadState - > offsetDate - max ) <nl> : ( unixtime ( ) - max ) ; <nl> + refreshDialogsLoadBlocked ( ) ; <nl> requestDialogs ( ) ; <nl> } <nl> <nl> mmm a / Telegram / SourceFiles / dialogs / dialogs_widget . cpp <nl> ppp b / Telegram / SourceFiles / dialogs / dialogs_widget . cpp <nl> void Widget : : refreshLoadMoreButton ( bool mayBlock , bool isBlocked ) { <nl> st : : dialogsLoadMoreButton , <nl> st : : dialogsLoadMore , <nl> st : : dialogsLoadMore ) ; <nl> + _loadMoreChats - > show ( ) ; <nl> _loadMoreChats - > addClickHandler ( [ = ] { <nl> loadMoreBlockedByDate ( ) ; <nl> } ) ; <nl>
|
Fix block chat list loading by date .
|
telegramdesktop/tdesktop
|
db35c3de3bc03fbb6bbc57f055ac443919783cb7
|
2019-05-01T12:11:45Z
|
mmm a / lib / Sema / BuilderTransform . cpp <nl> ppp b / lib / Sema / BuilderTransform . cpp <nl> class BuilderClosureRewriter <nl> const Solution & solution ; <nl> DeclContext * dc ; <nl> AppliedBuilderTransform builderTransform ; <nl> - std : : function < Expr * ( Expr * ) > rewriteExpr ; <nl> - std : : function < Expr * ( Expr * , Type , ConstraintLocator * ) > coerceToType ; <nl> + std : : function < <nl> + Optional < SolutionApplicationTarget > ( SolutionApplicationTarget ) > <nl> + rewriteTarget ; <nl> <nl> / / / Retrieve the temporary variable that will be used to capture the <nl> / / / value of the given expression . <nl> class BuilderClosureRewriter <nl> return recorded ; <nl> } <nl> <nl> + / / / Rewrite an expression without any particularly special context . <nl> + Expr * rewriteExpr ( Expr * expr ) { <nl> + auto result = rewriteTarget ( <nl> + SolutionApplicationTarget ( expr , dc , CTP_Unused , Type ( ) , <nl> + / * isDiscarded = * / false ) ) ; <nl> + if ( result ) <nl> + return result - > getAsExpr ( ) ; <nl> + <nl> + return nullptr ; <nl> + } <nl> + <nl> public : <nl> / / / Retrieve information about a captured statement . <nl> std : : pair < VarDecl * , llvm : : TinyPtrVector < Expr * > > <nl> class BuilderClosureRewriter <nl> ASTNode initializeTarget ( FunctionBuilderTarget target ) { <nl> assert ( target . captured . second . size ( ) = = 1 ) ; <nl> auto capturedExpr = target . captured . second . front ( ) ; <nl> - auto finalCapturedExpr = rewriteExpr ( capturedExpr ) ; <nl> SourceLoc implicitLoc = capturedExpr - > getEndLoc ( ) ; <nl> switch ( target . kind ) { <nl> case FunctionBuilderTarget : : ReturnValue : { <nl> / / Return the expression . <nl> - ConstraintSystem & cs = solution . getConstraintSystem ( ) ; <nl> Type bodyResultType = <nl> solution . simplifyType ( builderTransform . bodyResultType ) ; <nl> - finalCapturedExpr = coerceToType ( <nl> - finalCapturedExpr , <nl> - bodyResultType , <nl> - cs . getConstraintLocator ( capturedExpr ) ) ; <nl> - return new ( ctx ) ReturnStmt ( implicitLoc , finalCapturedExpr ) ; <nl> + <nl> + SolutionApplicationTarget returnTarget ( <nl> + capturedExpr , dc , CTP_ReturnStmt , bodyResultType , <nl> + / * isDiscarded = * / false ) ; <nl> + Expr * resultExpr = nullptr ; <nl> + if ( auto resultTarget = rewriteTarget ( returnTarget ) ) <nl> + resultExpr = resultTarget - > getAsExpr ( ) ; <nl> + <nl> + return new ( ctx ) ReturnStmt ( implicitLoc , resultExpr ) ; <nl> } <nl> <nl> case FunctionBuilderTarget : : TemporaryVar : { <nl> class BuilderClosureRewriter <nl> declRef - > setType ( LValueType : : get ( temporaryVar - > getType ( ) ) ) ; <nl> <nl> / / Load the right - hand side if needed . <nl> + auto finalCapturedExpr = rewriteExpr ( capturedExpr ) ; <nl> if ( finalCapturedExpr - > getType ( ) - > hasLValueType ( ) ) { <nl> finalCapturedExpr = <nl> TypeChecker : : addImplicitLoadExpr ( ctx , finalCapturedExpr ) ; <nl> class BuilderClosureRewriter <nl> const Solution & solution , <nl> DeclContext * dc , <nl> const AppliedBuilderTransform & builderTransform , <nl> - std : : function < Expr * ( Expr * ) > rewriteExpr , <nl> - std : : function < Expr * ( Expr * , Type , ConstraintLocator * ) > coerceToType <nl> + std : : function < <nl> + Optional < SolutionApplicationTarget > ( SolutionApplicationTarget ) > <nl> + rewriteTarget <nl> ) : ctx ( solution . getConstraintSystem ( ) . getASTContext ( ) ) , <nl> solution ( solution ) , dc ( dc ) , builderTransform ( builderTransform ) , <nl> - rewriteExpr ( rewriteExpr ) , <nl> - coerceToType ( coerceToType ) { } <nl> + rewriteTarget ( rewriteTarget ) { } <nl> <nl> Stmt * visitBraceStmt ( BraceStmt * braceStmt , FunctionBuilderTarget target , <nl> Optional < FunctionBuilderTarget > innerTarget = None ) { <nl> BraceStmt * swift : : applyFunctionBuilderTransform ( <nl> AppliedBuilderTransform applied , <nl> BraceStmt * body , <nl> DeclContext * dc , <nl> - std : : function < Expr * ( Expr * ) > rewriteExpr , <nl> - std : : function < Expr * ( Expr * , Type , ConstraintLocator * ) > coerceToType ) { <nl> - BuilderClosureRewriter rewriter ( solution , dc , applied , rewriteExpr , coerceToType ) ; <nl> + std : : function < <nl> + Optional < SolutionApplicationTarget > ( SolutionApplicationTarget ) > <nl> + rewriteTarget ) { <nl> + BuilderClosureRewriter rewriter ( solution , dc , applied , rewriteTarget ) ; <nl> auto captured = rewriter . takeCapturedStmt ( body ) ; <nl> return cast < BraceStmt > ( <nl> rewriter . visitBraceStmt ( <nl> mmm a / lib / Sema / CSApply . cpp <nl> ppp b / lib / Sema / CSApply . cpp <nl> namespace { <nl> llvm : : SaveAndRestore < DeclContext * > savedDC ( Rewriter . dc , closure ) ; <nl> auto newBody = applyFunctionBuilderTransform ( <nl> Rewriter . solution , * transform , closure - > getBody ( ) , closure , <nl> - [ & ] ( Expr * expr ) { <nl> - Expr * result = expr - > walk ( * this ) ; <nl> - if ( result ) <nl> - Rewriter . solution . setExprTypes ( result ) ; <nl> - return result ; <nl> - } , <nl> - [ & ] ( Expr * expr , Type toType , ConstraintLocator * locator ) { <nl> - return Rewriter . coerceToType ( expr , toType , locator ) ; <nl> + [ & ] ( SolutionApplicationTarget target ) { <nl> + auto resultTarget = rewriteTarget ( target ) ; <nl> + if ( resultTarget ) { <nl> + if ( auto expr = resultTarget - > getAsExpr ( ) ) <nl> + Rewriter . solution . setExprTypes ( expr ) ; <nl> + } <nl> + <nl> + return resultTarget ; <nl> } ) ; <nl> closure - > setBody ( newBody , / * isSingleExpression = * / false ) ; <nl> closure - > setAppliedFunctionBuilder ( ) ; <nl> ExprWalker : : rewriteTarget ( SolutionApplicationTarget target ) { <nl> <nl> auto newBody = applyFunctionBuilderTransform ( <nl> solution , * transform , fn . getBody ( ) , fn . getAsDeclContext ( ) , <nl> - [ & ] ( Expr * expr ) { <nl> - Expr * result = expr - > walk ( * this ) ; <nl> - if ( result ) <nl> - solution . setExprTypes ( result ) ; <nl> - return result ; <nl> - } , <nl> - [ & ] ( Expr * expr , Type toType , ConstraintLocator * locator ) { <nl> - return Rewriter . coerceToType ( expr , toType , locator ) ; <nl> + [ & ] ( SolutionApplicationTarget target ) { <nl> + auto resultTarget = rewriteTarget ( target ) ; <nl> + if ( resultTarget ) { <nl> + if ( auto expr = resultTarget - > getAsExpr ( ) ) <nl> + Rewriter . solution . setExprTypes ( expr ) ; <nl> + } <nl> + <nl> + return resultTarget ; <nl> } ) ; <nl> <nl> if ( ! newBody ) <nl> mmm a / lib / Sema / ConstraintSystem . h <nl> ppp b / lib / Sema / ConstraintSystem . h <nl> bool isSIMDOperator ( ValueDecl * value ) ; <nl> / / / \ param applied The applied builder transform . <nl> / / / \ param body The body to transform <nl> / / / \ param dc The context in which the transform occurs . <nl> - / / / \ param rewriteExpr Rewrites expressions that show up in the transform <nl> - / / / to their final , type - checked versions . <nl> - / / / \ param coerceToType Coerce the given expression to the specified type , <nl> - / / / which may introduce implicit conversions . <nl> + / / / \ param rewriteTarget Rewrites a solution application target to its final , <nl> + / / / type - checked version . <nl> / / / <nl> / / / \ returns the transformed body <nl> BraceStmt * applyFunctionBuilderTransform ( <nl> BraceStmt * applyFunctionBuilderTransform ( <nl> constraints : : AppliedBuilderTransform applied , <nl> BraceStmt * body , <nl> DeclContext * dc , <nl> - std : : function < Expr * ( Expr * ) > rewriteExpr , <nl> - std : : function < Expr * ( Expr * , Type , constraints : : ConstraintLocator * ) > <nl> - coerceToType ) ; <nl> + std : : function < <nl> + Optional < constraints : : SolutionApplicationTarget > ( <nl> + constraints : : SolutionApplicationTarget ) > <nl> + rewriteTarget ) ; <nl> <nl> } / / end namespace swift <nl> <nl>
|
[ Constraint system ] Adopt rewriteTarget for function builder transform .
|
apple/swift
|
7f9029071d734670834a1cff06537ef376fbc4c8
|
2020-02-13T01:51:47Z
|
mmm a / docs / OwnershipManifesto . md <nl> ppp b / docs / OwnershipManifesto . md <nl> we mean a specific instance of a semantic , user - language value . <nl> For example , consider the following Swift code : <nl> <nl> ` ` ` <nl> - var x = [ 1 , 2 , 3 ] <nl> - var y = x <nl> + var x = [ 1 , 2 , 3 ] <nl> + var y = x <nl> ` ` ` <nl> <nl> People would often say that ` x ` and ` y ` have the same value <nl> the callee loads a value from its argument , then calls <nl> a function which the optimizer cannot reason about : <nl> <nl> ` ` ` <nl> - extension Array { <nl> - mutating func organize ( _ predicate : ( Element ) - > Bool ) { <nl> - let first = self [ 0 ] <nl> - if ! predicate ( first ) { return } <nl> - . . . <nl> - / / something here uses first <nl> - } <nl> + extension Array { <nl> + mutating func organize ( _ predicate : ( Element ) - > Bool ) { <nl> + let first = self [ 0 ] <nl> + if ! predicate ( first ) { return } <nl> + . . . <nl> + / / something here uses first <nl> } <nl> + } <nl> ` ` ` <nl> <nl> Under a callee - side rule , the optimizer must copy ` self [ 0 ] ` <nl> semantically necessary when working with non - copyable types . <nl> We propose to remove this limitation in a straightforward way : <nl> <nl> ` ` ` <nl> - inout root = & tree . root <nl> + inout root = & tree . root <nl> <nl> - shared elements = self . queue <nl> + shared elements = self . queue <nl> ` ` ` <nl> <nl> The initializer is required and must be a storage reference <nl> cases to be spelled explicitly : <nl> - A function argument can be explicitly declared ` owned ` : <nl> <nl> ` ` ` <nl> - func append ( _ values : owned [ Element ] ) { <nl> - . . . <nl> - } <nl> + func append ( _ values : owned [ Element ] ) { <nl> + . . . <nl> + } <nl> ` ` ` <nl> <nl> This cannot be combined with ` shared ` or ` inout ` . <nl> cases to be spelled explicitly : <nl> - A function argument can be explicitly declared ` shared ` . <nl> <nl> ` ` ` <nl> - func = = ( left : shared String , right : shared String ) - > Bool { <nl> - . . . <nl> - } <nl> + func = = ( left : shared String , right : shared String ) - > Bool { <nl> + . . . <nl> + } <nl> ` ` ` <nl> <nl> This cannot be combined with ` owned ` or ` inout ` . <nl> cases to be spelled explicitly : <nl> - A method can be explicitly declared ` consuming ` . <nl> <nl> ` ` ` <nl> - consuming func moveElements ( into collection : inout [ Element ] ) { <nl> - . . . <nl> - } <nl> + consuming func moveElements ( into collection : inout [ Element ] ) { <nl> + . . . <nl> + } <nl> ` ` ` <nl> <nl> This causes ` self ` to be passed as an owned value and therefore <nl> This can be explicitly requested by declaring the iteration <nl> variable ` owned ` : <nl> <nl> ` ` ` <nl> - for owned employee in company . employees { <nl> - newCompany . employees . append ( employee ) <nl> - } <nl> + for owned employee in company . employees { <nl> + newCompany . employees . append ( employee ) <nl> + } <nl> ` ` ` <nl> <nl> It is also used implicitly when the requirements for a <nl> This can be explicitly requested by declaring the iteration <nl> variable ` shared ` : <nl> <nl> ` ` ` <nl> - for shared employee in company . employees { <nl> - if ! employee . respected { throw CatastrophicHRFailure ( ) } <nl> - } <nl> + for shared employee in company . employees { <nl> + if ! employee . respected { throw CatastrophicHRFailure ( ) } <nl> + } <nl> ` ` ` <nl> <nl> It is also used by default when the sequence type is known to <nl> conform to ` Collection ` , since this is the optimal way of <nl> iterating over a collection . <nl> <nl> ` ` ` <nl> - for employee in company . employees { <nl> - if ! employee . respected { throw CatastrophicHRFailure ( ) } <nl> - } <nl> + for employee in company . employees { <nl> + if ! employee . respected { throw CatastrophicHRFailure ( ) } <nl> + } <nl> ` ` ` <nl> <nl> If the sequence operand is a storage reference expression , <nl> This must be explicitly requested by declaring the <nl> iteration variable ` inout ` : <nl> <nl> ` ` ` <nl> - for inout employee in company . employees { <nl> - employee . respected = true <nl> - } <nl> + for inout employee in company . employees { <nl> + employee . respected = true <nl> + } <nl> ` ` ` <nl> <nl> The sequence operand must be a storage reference expression . <nl> to follow this pattern , we would need to allow the definition <nl> of generator functions , e . g . : <nl> <nl> ` ` ` <nl> - mutating generator iterateMutable ( ) - > inout Element { <nl> - var i = startIndex , e = endIndex <nl> - while i ! = e { <nl> - yield & self [ i ] <nl> - self . formIndex ( after : & i ) <nl> - } <nl> + mutating generator iterateMutable ( ) - > inout Element { <nl> + var i = startIndex , e = endIndex <nl> + while i ! = e { <nl> + yield & self [ i ] <nl> + self . formIndex ( after : & i ) <nl> } <nl> + } <nl> ` ` ` <nl> <nl> On the client side , it is clear how this could be used to <nl> The idea is that , instead of defining ` get ` and ` set ` , <nl> a storage declaration could define ` read ` and ` modify ` : <nl> <nl> ` ` ` <nl> - var x : String <nl> - var y : String <nl> - var first : String { <nl> - read { <nl> - if x < y { yield x } <nl> - else { yield y } <nl> - } <nl> - modify { <nl> - if x < y { yield & x } <nl> - else { yield & y } <nl> - } <nl> + var x : String <nl> + var y : String <nl> + var first : String { <nl> + read { <nl> + if x < y { yield x } <nl> + else { yield y } <nl> } <nl> + modify { <nl> + if x < y { yield & x } <nl> + else { yield & y } <nl> + } <nl> + } <nl> ` ` ` <nl> <nl> A storage declaration must define either a ` get ` or a ` read ` <nl> For this reason , we propose the ` move ` function . Conceptually , <nl> library : <nl> <nl> ` ` ` <nl> - func move < T > ( _ value : T ) - > T { <nl> - return value <nl> - } <nl> + func move < T > ( _ value : T ) - > T { <nl> + return value <nl> + } <nl> ` ` ` <nl> <nl> However , it is blessed with some special semantics . It cannot <nl> variables are initialized before use . <nl> ` copy ` is a top - level function in the Swift standard library : <nl> <nl> ` ` ` <nl> - func copy < T > ( _ value : T ) - > T { <nl> - return value <nl> - } <nl> + func copy < T > ( _ value : T ) - > T { <nl> + return value <nl> + } <nl> ` ` ` <nl> <nl> The argument must be a storage reference expression . The <nl> value is returned . This is useful for several reasons : <nl> ` endScope ` is a top - level function in the Swift standard library : <nl> <nl> ` ` ` <nl> - func endScope < T > ( _ value : T ) - > ( ) { } <nl> + func endScope < T > ( _ value : T ) - > ( ) { } <nl> ` ` ` <nl> <nl> The argument must be a reference to a local ` let ` , ` var ` , or <nl> There is some recurring interest in the community in allowing programs <nl> to abstract over storage , so that you might say : <nl> <nl> ` ` ` <nl> - let prop = Widget . weight <nl> + let prop = Widget . weight <nl> ` ` ` <nl> <nl> and then ` prop ` would be an abstract reference to the ` weight ` <nl> a ` moveonly ` context are also implicitly ` moveonly ` . <nl> A type can be a ` moveonly ` context : <nl> <nl> ` ` ` <nl> - moveonly struct Array < Element > { <nl> - / / Element and Array < Element > are not assumed to be copyable here <nl> - } <nl> + moveonly struct Array < Element > { <nl> + / / Element and Array < Element > are not assumed to be copyable here <nl> + } <nl> ` ` ` <nl> <nl> This suppresses the ` Copyable ` assumption for the type <nl> hierarchies of associated types . <nl> An extension can be a ` moveonly ` context : <nl> <nl> ` ` ` <nl> - moveonly extension Array { <nl> - / / Element and Array < Element > are not assumed to be copyable here <nl> - } <nl> + moveonly extension Array { <nl> + / / Element and Array < Element > are not assumed to be copyable here <nl> + } <nl> ` ` ` <nl> <nl> A type can declare conditional copyability using a conditional <nl> conformance : <nl> <nl> ` ` ` <nl> - moveonly extension Array : Copyable where Element : Copyable { <nl> - . . . <nl> - } <nl> + moveonly extension Array : Copyable where Element : Copyable { <nl> + . . . <nl> + } <nl> ` ` ` <nl> <nl> Conformance to ` Copyable ` , conditional or not , is an <nl> it a non - ` moveonly ` extension is an error . <nl> A function can be a ` moveonly ` context : <nl> <nl> ` ` ` <nl> - extension Array { <nl> - moveonly func report < U > ( _ u : U ) <nl> - } <nl> + extension Array { <nl> + moveonly func report < U > ( _ u : U ) <nl> + } <nl> ` ` ` <nl> <nl> This suppresses the copyability assumption for any new <nl> example , here is a simple file - handle type that ensures <nl> that the handle is closed when the value is destroyed : <nl> <nl> ` ` ` <nl> - moveonly struct File { <nl> - var descriptor : Int32 <nl> + moveonly struct File { <nl> + var descriptor : Int32 <nl> <nl> - init ( filename : String ) throws { <nl> - descriptor = Darwin . open ( filename , O_RDONLY ) <nl> + init ( filename : String ) throws { <nl> + descriptor = Darwin . open ( filename , O_RDONLY ) <nl> <nl> - / / Abnormally exiting ' init ' at any point prevents deinit <nl> - / / from being called . <nl> - if descriptor = = - 1 { throw . . . } <nl> - } <nl> + / / Abnormally exiting ' init ' at any point prevents deinit <nl> + / / from being called . <nl> + if descriptor = = - 1 { throw . . . } <nl> + } <nl> <nl> - deinit { <nl> - _ = Darwin . close ( descriptor ) <nl> - } <nl> + deinit { <nl> + _ = Darwin . close ( descriptor ) <nl> + } <nl> <nl> - consuming func close ( ) throws { <nl> - if Darwin . fsync ( descriptor ) ! = 0 { throw . . . } <nl> + consuming func close ( ) throws { <nl> + if Darwin . fsync ( descriptor ) ! = 0 { throw . . . } <nl> <nl> - / / This is a consuming function , so it has ownership of self . <nl> - / / It doesn ' t consume self in any other way , so it will <nl> - / / destroy it when it exits by calling deinit . deinit <nl> - / / will then handle actually closing the descriptor . <nl> - } <nl> + / / This is a consuming function , so it has ownership of self . <nl> + / / It doesn ' t consume self in any other way , so it will <nl> + / / destroy it when it exits by calling deinit . deinit <nl> + / / will then handle actually closing the descriptor . <nl> } <nl> + } <nl> ` ` ` <nl> <nl> Swift is permitted to destroy a value ( and thus call ` deinit ` ) <nl>
|
Merge remote - tracking branch ' origin / master ' into master - next
|
apple/swift
|
8ed3a7180b2faf726f6ddfc7ca351681d11b7572
|
2017-03-06T15:48:50Z
|
mmm a / editor / project_settings_editor . cpp <nl> ppp b / editor / project_settings_editor . cpp <nl> ProjectSettingsEditor : : ProjectSettingsEditor ( EditorData * p_data ) { <nl> tab_container - > add_child ( plugin_settings ) ; <nl> <nl> timer = memnew ( Timer ) ; <nl> - timer - > set_wait_time ( 0 . 1 ) ; <nl> + timer - > set_wait_time ( 1 . 5 ) ; <nl> timer - > connect ( " timeout " , ProjectSettings : : get_singleton ( ) , " save " ) ; <nl> timer - > set_one_shot ( true ) ; <nl> add_child ( timer ) ; <nl> mmm a / editor / settings_config_dialog . cpp <nl> ppp b / editor / settings_config_dialog . cpp <nl> EditorSettingsDialog : : EditorSettingsDialog ( ) { <nl> / / get_cancel ( ) - > set_text ( " Close " ) ; <nl> <nl> timer = memnew ( Timer ) ; <nl> - timer - > set_wait_time ( 0 . 1 ) ; <nl> + timer - > set_wait_time ( 1 . 5 ) ; <nl> timer - > connect ( " timeout " , this , " _settings_save " ) ; <nl> timer - > set_one_shot ( true ) ; <nl> add_child ( timer ) ; <nl>
|
Fix button regression
|
godotengine/godot
|
a28494c962a59e7ce136ec2cf31a386066a39569
|
2018-07-03T17:44:18Z
|
mmm a / code / cryptography / src / morse_cipher / morse_code_generator . c <nl> ppp b / code / cryptography / src / morse_cipher / morse_code_generator . c <nl> encrypt ( char * msg ) <nl> char * letters [ ] = { " . - " , " - . . . " , " - . - . " , " - . . " , " . " , " . . - . " , " - - . " , " . . . . " , " . . " , " . mmm " , " - . - " , " . - . . " , <nl> " - - " , " - . " , " mmm " , " . - - . " , " - - . - " , " . - . " , " . . . " , " - " , " . . - " , " . . . - " , " . - - " , " - . . - " , " - . - - " , " - - . . " } ; <nl> <nl> - for ( i = 0 ; i < size ; i + + ) <nl> - if ( msg [ i ] ! = ' ' ) <nl> - if ( msg [ i ] > = ' 0 ' & & msg [ i ] < = ' 9 ' ) <nl> + for ( i = 0 ; i < size ; i + + ) <nl> + if ( msg [ i ] ! = ' ' ) <nl> + if ( msg [ i ] > = ' 0 ' & & msg [ i ] < = ' 9 ' ) <nl> strcat ( morse_code , num [ msg [ i ] - 48 ] ) ; <nl> else <nl> strcat ( morse_code , letters [ msg [ i ] - 65 ] ) ; <nl>
|
added spaces
|
OpenGenus/cosmos
|
2960ed99b40980fc7c9aca33d422460afc87f20d
|
2018-05-11T16:22:34Z
|
mmm a / src / ruby / end2end / multiple_killed_watching_threads_driver . rb <nl> ppp b / src / ruby / end2end / multiple_killed_watching_threads_driver . rb <nl> def run_multiple_killed_watches ( num_threads , sleep_time ) <nl> end <nl> <nl> def main <nl> + STDERR . puts ' 10 iterations , sleep 0 . 1 before killing thread ' <nl> run_multiple_killed_watches ( 10 , 0 . 1 ) <nl> + STDERR . puts ' 1000 iterations , sleep 0 . 001 before killing thread ' <nl> run_multiple_killed_watches ( 1000 , 0 . 001 ) <nl> + STDERR . puts ' 10000 iterations , sleep 0 . 00001 before killing thread ' <nl> + run_multiple_killed_watches ( 10_000 , 0 . 00001 ) <nl> + STDERR . puts ' 20000 iterations , sleep 0 . 00001 before killing thread ' <nl> + run_multiple_killed_watches ( 20_000 , 0 . 00001 ) <nl> end <nl> <nl> main <nl> mmm a / src / ruby / ext / grpc / extconf . rb <nl> ppp b / src / ruby / ext / grpc / extconf . rb <nl> <nl> end <nl> <nl> if grpc_config = = ' dbg ' <nl> - $ CFLAGS < < ' - O0 ' <nl> + $ CFLAGS < < ' - O0 - ggdb3 ' <nl> end <nl> <nl> $ LDFLAGS < < ' - Wl , - wrap , memcpy ' if RUBY_PLATFORM = ~ / linux / <nl> mmm a / src / ruby / ext / grpc / rb_channel . c <nl> ppp b / src / ruby / ext / grpc / rb_channel . c <nl> static VALUE grpc_rb_channel_get_connectivity_state ( int argc , VALUE * argv , <nl> } <nl> <nl> typedef struct watch_state_stack { <nl> - grpc_channel * channel ; <nl> + bg_watched_channel * bg_wrapped ; <nl> gpr_timespec deadline ; <nl> int last_state ; <nl> } watch_state_stack ; <nl> static void * wait_for_watch_state_op_complete_without_gvl ( void * arg ) { <nl> gpr_mu_lock ( & global_connection_polling_mu ) ; <nl> / / its unsafe to do a " watch " after " channel polling abort " because the cq has <nl> / / been shut down . <nl> - if ( abort_channel_polling ) { <nl> + if ( abort_channel_polling | | stack - > bg_wrapped - > channel_destroyed ) { <nl> gpr_mu_unlock ( & global_connection_polling_mu ) ; <nl> return ( void * ) 0 ; <nl> } <nl> op = gpr_zalloc ( sizeof ( watch_state_op ) ) ; <nl> op - > op_type = WATCH_STATE_API ; <nl> - grpc_channel_watch_connectivity_state ( stack - > channel , stack - > last_state , <nl> - stack - > deadline , channel_polling_cq , <nl> - op ) ; <nl> + grpc_channel_watch_connectivity_state ( stack - > bg_wrapped - > channel , <nl> + stack - > last_state , stack - > deadline , <nl> + channel_polling_cq , op ) ; <nl> <nl> while ( ! op - > op . api_callback_args . called_back ) { <nl> gpr_cv_wait ( & global_connection_polling_cv , & global_connection_polling_mu , <nl> static VALUE grpc_rb_channel_watch_connectivity_state ( VALUE self , <nl> return Qnil ; <nl> } <nl> <nl> - stack . channel = wrapper - > bg_wrapped - > channel ; <nl> + stack . bg_wrapped = wrapper - > bg_wrapped ; <nl> stack . deadline = grpc_rb_time_timeval ( deadline , 0 ) , <nl> stack . last_state = NUM2LONG ( last_state ) ; <nl> <nl>
|
Merge pull request from apolcyn / backport_race_fix
|
grpc/grpc
|
1834a628782ec867279622644a5953987aa96d38
|
2018-04-05T23:22:26Z
|
mmm a / src / core / lib / slice / percent_encoding . c <nl> ppp b / src / core / lib / slice / percent_encoding . c <nl> <nl> <nl> # include < grpc / support / log . h > <nl> <nl> - const uint8_t gpr_url_percent_encoding_unreserved_bytes [ 256 / 8 ] = { <nl> + const uint8_t grpc_url_percent_encoding_unreserved_bytes [ 256 / 8 ] = { <nl> 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x60 , 0xff , 0x03 , 0xfe , 0xff , 0xff , <nl> 0x87 , 0xfe , 0xff , 0xff , 0x47 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , <nl> 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 } ; <nl> - const uint8_t gpr_compatible_percent_encoding_unreserved_bytes [ 256 / 8 ] = { <nl> + const uint8_t grpc_compatible_percent_encoding_unreserved_bytes [ 256 / 8 ] = { <nl> 0x00 , 0x00 , 0x00 , 0x00 , 0xdf , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , <nl> 0xff , 0xff , 0xff , 0xff , 0x7f , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , <nl> 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 } ; <nl> static bool is_unreserved_character ( uint8_t c , <nl> return ( ( unreserved_bytes [ c / 8 ] > > ( c % 8 ) ) & 1 ) ! = 0 ; <nl> } <nl> <nl> - grpc_slice gpr_percent_encode_slice ( grpc_slice slice , <nl> - const uint8_t * unreserved_bytes ) { <nl> + grpc_slice grpc_percent_encode_slice ( grpc_slice slice , <nl> + const uint8_t * unreserved_bytes ) { <nl> static const uint8_t hex [ ] = " 0123456789ABCDEF " ; <nl> <nl> / / first pass : count the number of bytes needed to output this string <nl> static uint8_t dehex ( uint8_t c ) { <nl> GPR_UNREACHABLE_CODE ( return 255 ) ; <nl> } <nl> <nl> - bool gpr_strict_percent_decode_slice ( grpc_slice slice_in , <nl> - const uint8_t * unreserved_bytes , <nl> - grpc_slice * slice_out ) { <nl> + bool grpc_strict_percent_decode_slice ( grpc_slice slice_in , <nl> + const uint8_t * unreserved_bytes , <nl> + grpc_slice * slice_out ) { <nl> const uint8_t * p = GPR_SLICE_START_PTR ( slice_in ) ; <nl> const uint8_t * in_end = GPR_SLICE_END_PTR ( slice_in ) ; <nl> size_t out_length = 0 ; <nl> bool gpr_strict_percent_decode_slice ( grpc_slice slice_in , <nl> return true ; <nl> } <nl> <nl> - grpc_slice gpr_permissive_percent_decode_slice ( grpc_slice slice_in ) { <nl> + grpc_slice grpc_permissive_percent_decode_slice ( grpc_slice slice_in ) { <nl> const uint8_t * p = GPR_SLICE_START_PTR ( slice_in ) ; <nl> const uint8_t * in_end = GPR_SLICE_END_PTR ( slice_in ) ; <nl> size_t out_length = 0 ; <nl> mmm a / src / core / lib / slice / percent_encoding . h <nl> ppp b / src / core / lib / slice / percent_encoding . h <nl> <nl> # include < grpc / slice . h > <nl> <nl> / * URL percent encoding spec bitfield ( usabel as ' unreserved_bytes ' in <nl> - gpr_percent_encode_slice , gpr_strict_percent_decode_slice ) . <nl> + grpc_percent_encode_slice , grpc_strict_percent_decode_slice ) . <nl> Flags [ A - Za - z0 - 9 - _ . ~ ] as unreserved bytes for the percent encoding routines <nl> * / <nl> - extern const uint8_t gpr_url_percent_encoding_unreserved_bytes [ 256 / 8 ] ; <nl> + extern const uint8_t grpc_url_percent_encoding_unreserved_bytes [ 256 / 8 ] ; <nl> / * URL percent encoding spec bitfield ( usabel as ' unreserved_bytes ' in <nl> - gpr_percent_encode_slice , gpr_strict_percent_decode_slice ) . <nl> + grpc_percent_encode_slice , grpc_strict_percent_decode_slice ) . <nl> Flags ascii7 non - control characters excluding ' % ' as unreserved bytes for the <nl> percent encoding routines * / <nl> - extern const uint8_t gpr_compatible_percent_encoding_unreserved_bytes [ 256 / 8 ] ; <nl> + extern const uint8_t grpc_compatible_percent_encoding_unreserved_bytes [ 256 / 8 ] ; <nl> <nl> / * Percent - encode a slice , returning the new slice ( this cannot fail ) : <nl> unreserved_bytes is a bitfield indicating which bytes are considered <nl> unreserved and thus do not need percent encoding * / <nl> - grpc_slice gpr_percent_encode_slice ( grpc_slice slice , <nl> - const uint8_t * unreserved_bytes ) ; <nl> + grpc_slice grpc_percent_encode_slice ( grpc_slice slice , <nl> + const uint8_t * unreserved_bytes ) ; <nl> / * Percent - decode a slice , strictly . <nl> If the input is legal ( contains no unreserved bytes , and legal % encodings ) , <nl> returns true and sets * slice_out to the decoded slice . <nl> If the input is not legal , returns false and leaves * slice_out untouched . <nl> unreserved_bytes is a bitfield indicating which bytes are considered <nl> unreserved and thus do not need percent encoding * / <nl> - bool gpr_strict_percent_decode_slice ( grpc_slice slice_in , <nl> - const uint8_t * unreserved_bytes , <nl> - grpc_slice * slice_out ) ; <nl> + bool grpc_strict_percent_decode_slice ( grpc_slice slice_in , <nl> + const uint8_t * unreserved_bytes , <nl> + grpc_slice * slice_out ) ; <nl> / * Percent - decode a slice , permissively . <nl> If a % triplet can not be decoded , pass it through verbatim . <nl> This cannot fail . * / <nl> - grpc_slice gpr_permissive_percent_decode_slice ( grpc_slice slice_in ) ; <nl> + grpc_slice grpc_permissive_percent_decode_slice ( grpc_slice slice_in ) ; <nl> <nl> # endif / * GRPC_CORE_LIB_SUPPORT_PERCENT_ENCODING_H * / <nl> mmm a / test / core / end2end / bad_server_response_test . c <nl> ppp b / test / core / end2end / bad_server_response_test . c <nl> <nl> # include < string . h > <nl> <nl> # include < grpc / grpc . h > <nl> + # include < grpc / slice . h > <nl> # include < grpc / support / alloc . h > <nl> # include < grpc / support / host_port . h > <nl> # include < grpc / support / log . h > <nl> - # include < grpc / slice . h > <nl> # include < grpc / support / thd . h > <nl> <nl> / / # include " src / core / ext / transport / chttp2 / transport / internal . h " <nl> # include " src / core / lib / iomgr / sockaddr . h " <nl> + # include " src / core / lib / slice / slice_string_helpers . h " <nl> # include " src / core / lib / support / string . h " <nl> # include " test / core / end2end / cq_verifier . h " <nl> # include " test / core / util / port . h " <nl> static void done_write ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * error ) { <nl> } <nl> <nl> static void handle_write ( grpc_exec_ctx * exec_ctx ) { <nl> - grpc_slice slice = grpc_slice_from_copied_buffer ( state . response_payload , <nl> - state . response_payload_length ) ; <nl> + grpc_slice slice = grpc_slice_from_copied_buffer ( <nl> + state . response_payload , state . response_payload_length ) ; <nl> <nl> grpc_slice_buffer_reset_and_unref ( & state . outgoing_buffer ) ; <nl> grpc_slice_buffer_add ( & state . outgoing_buffer , slice ) ; <nl> static void handle_read ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * error ) { <nl> size_t i ; <nl> for ( i = 0 ; i < state . temp_incoming_buffer . count ; i + + ) { <nl> char * dump = grpc_dump_slice ( state . temp_incoming_buffer . slices [ i ] , <nl> - GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> + GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> gpr_log ( GPR_DEBUG , " Server received : % s " , dump ) ; <nl> gpr_free ( dump ) ; <nl> } <nl> mmm a / test / core / end2end / dualstack_socket_test . c <nl> ppp b / test / core / end2end / dualstack_socket_test . c <nl> <nl> <nl> # include " src / core / lib / iomgr / resolve_address . h " <nl> # include " src / core / lib / iomgr / socket_utils_posix . h " <nl> + # include " src / core / lib / slice / slice_string_helpers . h " <nl> # include " src / core / lib / support / string . h " <nl> - <nl> # include " test / core / end2end / cq_verifier . h " <nl> # include " test / core / util / port . h " <nl> # include " test / core / util / test_config . h " <nl> mmm a / test / core / security / security_connector_test . c <nl> ppp b / test / core / security / security_connector_test . c <nl> <nl> <nl> # include " src / core / lib / security / context / security_context . h " <nl> # include " src / core / lib / security / transport / security_connector . h " <nl> + # include " src / core / lib / slice / slice_string_helpers . h " <nl> # include " src / core / lib / support / env . h " <nl> # include " src / core / lib / support / string . h " <nl> # include " src / core / lib / support / tmpfile . h " <nl> mmm a / test / core / slice / percent_decode_fuzzer . c <nl> ppp b / test / core / slice / percent_decode_fuzzer . c <nl> int LLVMFuzzerTestOneInput ( const uint8_t * data , size_t size ) { <nl> grpc_memory_counters_init ( ) ; <nl> grpc_slice input = grpc_slice_from_copied_buffer ( ( const char * ) data , size ) ; <nl> grpc_slice output ; <nl> - if ( gpr_strict_percent_decode_slice ( <nl> - input , gpr_url_percent_encoding_unreserved_bytes , & output ) ) { <nl> + if ( grpc_strict_percent_decode_slice ( <nl> + input , grpc_url_percent_encoding_unreserved_bytes , & output ) ) { <nl> grpc_slice_unref ( output ) ; <nl> } <nl> - if ( gpr_strict_percent_decode_slice ( <nl> - input , gpr_compatible_percent_encoding_unreserved_bytes , & output ) ) { <nl> + if ( grpc_strict_percent_decode_slice ( <nl> + input , grpc_compatible_percent_encoding_unreserved_bytes , & output ) ) { <nl> grpc_slice_unref ( output ) ; <nl> } <nl> - grpc_slice_unref ( gpr_permissive_percent_decode_slice ( input ) ) ; <nl> + grpc_slice_unref ( grpc_permissive_percent_decode_slice ( input ) ) ; <nl> grpc_slice_unref ( input ) ; <nl> counters = grpc_memory_counters_snapshot ( ) ; <nl> grpc_memory_counters_destroy ( ) ; <nl> mmm a / test / core / slice / percent_encode_fuzzer . c <nl> ppp b / test / core / slice / percent_encode_fuzzer . c <nl> static void test ( const uint8_t * data , size_t size , const uint8_t * dict ) { <nl> struct grpc_memory_counters counters ; <nl> grpc_memory_counters_init ( ) ; <nl> grpc_slice input = grpc_slice_from_copied_buffer ( ( const char * ) data , size ) ; <nl> - grpc_slice output = gpr_percent_encode_slice ( input , dict ) ; <nl> + grpc_slice output = grpc_percent_encode_slice ( input , dict ) ; <nl> grpc_slice decoded_output ; <nl> / / encoder must always produce decodable output <nl> - GPR_ASSERT ( gpr_strict_percent_decode_slice ( output , dict , & decoded_output ) ) ; <nl> + GPR_ASSERT ( grpc_strict_percent_decode_slice ( output , dict , & decoded_output ) ) ; <nl> grpc_slice permissive_decoded_output = <nl> - gpr_permissive_percent_decode_slice ( output ) ; <nl> + grpc_permissive_percent_decode_slice ( output ) ; <nl> / / and decoded output must always match the input <nl> GPR_ASSERT ( grpc_slice_cmp ( input , decoded_output ) = = 0 ) ; <nl> GPR_ASSERT ( grpc_slice_cmp ( input , permissive_decoded_output ) = = 0 ) ; <nl> static void test ( const uint8_t * data , size_t size , const uint8_t * dict ) { <nl> } <nl> <nl> int LLVMFuzzerTestOneInput ( const uint8_t * data , size_t size ) { <nl> - test ( data , size , gpr_url_percent_encoding_unreserved_bytes ) ; <nl> - test ( data , size , gpr_compatible_percent_encoding_unreserved_bytes ) ; <nl> + test ( data , size , grpc_url_percent_encoding_unreserved_bytes ) ; <nl> + test ( data , size , grpc_compatible_percent_encoding_unreserved_bytes ) ; <nl> return 0 ; <nl> } <nl> mmm a / test / core / slice / percent_encoding_test . c <nl> ppp b / test / core / slice / percent_encoding_test . c <nl> static void test_vector ( const char * raw , size_t raw_length , const char * encoded , <nl> grpc_slice raw_slice = grpc_slice_from_copied_buffer ( raw , raw_length ) ; <nl> grpc_slice encoded_slice = <nl> grpc_slice_from_copied_buffer ( encoded , encoded_length ) ; <nl> - grpc_slice raw2encoded_slice = gpr_percent_encode_slice ( raw_slice , dict ) ; <nl> + grpc_slice raw2encoded_slice = grpc_percent_encode_slice ( raw_slice , dict ) ; <nl> grpc_slice encoded2raw_slice ; <nl> - GPR_ASSERT ( <nl> - gpr_strict_percent_decode_slice ( encoded_slice , dict , & encoded2raw_slice ) ) ; <nl> + GPR_ASSERT ( grpc_strict_percent_decode_slice ( encoded_slice , dict , <nl> + & encoded2raw_slice ) ) ; <nl> grpc_slice encoded2raw_permissive_slice = <nl> - gpr_permissive_percent_decode_slice ( encoded_slice ) ; <nl> + grpc_permissive_percent_decode_slice ( encoded_slice ) ; <nl> <nl> char * raw2encoded_msg = <nl> grpc_dump_slice ( raw2encoded_slice , GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> static void test_nonconformant_vector ( const char * encoded , <nl> grpc_slice encoded_slice = <nl> grpc_slice_from_copied_buffer ( encoded , encoded_length ) ; <nl> grpc_slice encoded2raw_slice ; <nl> - GPR_ASSERT ( ! gpr_strict_percent_decode_slice ( encoded_slice , dict , <nl> - & encoded2raw_slice ) ) ; <nl> + GPR_ASSERT ( ! grpc_strict_percent_decode_slice ( encoded_slice , dict , <nl> + & encoded2raw_slice ) ) ; <nl> grpc_slice encoded2raw_permissive_slice = <nl> - gpr_permissive_percent_decode_slice ( encoded_slice ) ; <nl> + grpc_permissive_percent_decode_slice ( encoded_slice ) ; <nl> <nl> char * encoded2raw_permissive_msg = grpc_dump_slice ( <nl> encoded2raw_permissive_slice , GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> int main ( int argc , char * * argv ) { <nl> TEST_VECTOR ( <nl> " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 - _ . ~ " , <nl> " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 - _ . ~ " , <nl> - gpr_url_percent_encoding_unreserved_bytes ) ; <nl> - TEST_VECTOR ( " \ x00 " , " % 00 " , gpr_url_percent_encoding_unreserved_bytes ) ; <nl> - TEST_VECTOR ( " \ x01 " , " % 01 " , gpr_url_percent_encoding_unreserved_bytes ) ; <nl> - TEST_VECTOR ( " a b " , " a % 20b " , gpr_url_percent_encoding_unreserved_bytes ) ; <nl> - TEST_VECTOR ( " b " , " % 20b " , gpr_url_percent_encoding_unreserved_bytes ) ; <nl> - TEST_VECTOR ( " a b " , " a b " , gpr_compatible_percent_encoding_unreserved_bytes ) ; <nl> - TEST_VECTOR ( " b " , " b " , gpr_compatible_percent_encoding_unreserved_bytes ) ; <nl> - TEST_VECTOR ( " \ x0f " , " % 0F " , gpr_url_percent_encoding_unreserved_bytes ) ; <nl> - TEST_VECTOR ( " \ xff " , " % FF " , gpr_url_percent_encoding_unreserved_bytes ) ; <nl> - TEST_VECTOR ( " \ xee " , " % EE " , gpr_url_percent_encoding_unreserved_bytes ) ; <nl> + grpc_url_percent_encoding_unreserved_bytes ) ; <nl> + TEST_VECTOR ( " \ x00 " , " % 00 " , grpc_url_percent_encoding_unreserved_bytes ) ; <nl> + TEST_VECTOR ( " \ x01 " , " % 01 " , grpc_url_percent_encoding_unreserved_bytes ) ; <nl> + TEST_VECTOR ( " a b " , " a % 20b " , grpc_url_percent_encoding_unreserved_bytes ) ; <nl> + TEST_VECTOR ( " b " , " % 20b " , grpc_url_percent_encoding_unreserved_bytes ) ; <nl> + TEST_VECTOR ( " a b " , " a b " , grpc_compatible_percent_encoding_unreserved_bytes ) ; <nl> + TEST_VECTOR ( " b " , " b " , grpc_compatible_percent_encoding_unreserved_bytes ) ; <nl> + TEST_VECTOR ( " \ x0f " , " % 0F " , grpc_url_percent_encoding_unreserved_bytes ) ; <nl> + TEST_VECTOR ( " \ xff " , " % FF " , grpc_url_percent_encoding_unreserved_bytes ) ; <nl> + TEST_VECTOR ( " \ xee " , " % EE " , grpc_url_percent_encoding_unreserved_bytes ) ; <nl> TEST_NONCONFORMANT_VECTOR ( " % " , " % " , <nl> - gpr_url_percent_encoding_unreserved_bytes ) ; <nl> + grpc_url_percent_encoding_unreserved_bytes ) ; <nl> TEST_NONCONFORMANT_VECTOR ( " % A " , " % A " , <nl> - gpr_url_percent_encoding_unreserved_bytes ) ; <nl> + grpc_url_percent_encoding_unreserved_bytes ) ; <nl> TEST_NONCONFORMANT_VECTOR ( " % AG " , " % AG " , <nl> - gpr_url_percent_encoding_unreserved_bytes ) ; <nl> + grpc_url_percent_encoding_unreserved_bytes ) ; <nl> TEST_NONCONFORMANT_VECTOR ( " \ 0 " , " \ 0 " , <nl> - gpr_url_percent_encoding_unreserved_bytes ) ; <nl> + grpc_url_percent_encoding_unreserved_bytes ) ; <nl> return 0 ; <nl> } <nl> mmm a / test / core / transport / chttp2 / bin_encoder_test . c <nl> ppp b / test / core / transport / chttp2 / bin_encoder_test . c <nl> <nl> # include < grpc / grpc . h > <nl> # include < grpc / support / alloc . h > <nl> # include < grpc / support / log . h > <nl> + # include " src / core / lib / slice / slice_string_helpers . h " <nl> # include " src / core / lib / support / string . h " <nl> <nl> static int all_ok = 1 ; <nl> static grpc_slice HUFF ( const char * s ) { <nl> return out ; <nl> } <nl> <nl> - # define EXPECT_SLICE_EQ ( expected , slice ) \ <nl> - expect_slice_eq ( \ <nl> + # define EXPECT_SLICE_EQ ( expected , slice ) \ <nl> + expect_slice_eq ( \ <nl> grpc_slice_from_copied_buffer ( expected , sizeof ( expected ) - 1 ) , slice , \ <nl> # slice , __LINE__ ) ; <nl> <nl> mmm a / test / core / transport / chttp2 / hpack_encoder_test . c <nl> ppp b / test / core / transport / chttp2 / hpack_encoder_test . c <nl> <nl> # include < grpc / support / string_util . h > <nl> <nl> # include " src / core / ext / transport / chttp2 / transport / hpack_parser . h " <nl> + # include " src / core / lib / slice / slice_string_helpers . h " <nl> # include " src / core / lib / support / string . h " <nl> # include " src / core / lib / transport / metadata . h " <nl> # include " test / core / util / parse_hexstring . h " <nl> mmm a / tools / codegen / core / gen_percent_encoding_tables . c <nl> ppp b / tools / codegen / core / gen_percent_encoding_tables . c <nl> int main ( void ) { <nl> legal ( ' _ ' ) ; <nl> legal ( ' . ' ) ; <nl> legal ( ' ~ ' ) ; <nl> - dump ( " gpr_url_percent_encoding_unreserved_bytes " ) ; <nl> + dump ( " grpc_url_percent_encoding_unreserved_bytes " ) ; <nl> <nl> clear ( ) ; <nl> for ( i = 32 ; i < = 126 ; i + + ) { <nl> if ( i = = ' % ' ) continue ; <nl> legal ( i ) ; <nl> } <nl> - dump ( " gpr_compatible_percent_encoding_unreserved_bytes " ) ; <nl> + dump ( " grpc_compatible_percent_encoding_unreserved_bytes " ) ; <nl> <nl> return 0 ; <nl> } <nl>
|
Add incldues , fix function names
|
grpc/grpc
|
e4222b4cbdc8ff1d128d35a55c2309f3e029483a
|
2016-10-27T00:15:30Z
|
mmm a / templates / vsprojects / vs2013 / grpc_csharp_ext_shared . vcxproj . template <nl> ppp b / templates / vsprojects / vs2013 / grpc_csharp_ext_shared . vcxproj . template <nl> <nl> < % namespace file = " vcxproj_defs . include " import = " gen_project " / > \ <nl> - $ { gen_project ( ' grpc_csharp_ext ' , libs , targets , configuration_type = ' DynamicLibrary ' , project_guid = ' { C26D04A8 - 37C6 - 44C7 - B458 - 906C9FCE928C } ' ) } <nl> + $ { gen_project ( ' grpc_csharp_ext ' , libs , targets , configuration_type = ' DynamicLibrary ' , project_guid = ' { C26D04A8 - 37C6 - 44C7 - B458 - 906C9FCE928C } ' , additional_props = [ ' winsock ' ] ) } <nl> mmm a / templates / vsprojects / vs2013 / grpc_shared . vcxproj . template <nl> ppp b / templates / vsprojects / vs2013 / grpc_shared . vcxproj . template <nl> <nl> < % namespace file = " vcxproj_defs . include " import = " gen_project " / > \ <nl> - $ { gen_project ( ' grpc ' , libs , targets , configuration_type = ' DynamicLibrary ' , project_guid = ' { F2EE8FDB - F1E0 - 43A0 - A297 - 6F255BB52AAA } ' , additional_props = [ ' ssl ' , ' winsock ' ] ) } <nl> + $ { gen_project ( ' grpc ' , libs , targets , configuration_type = ' DynamicLibrary ' , project_guid = ' { F2EE8FDB - F1E0 - 43A0 - A297 - 6F255BB52AAA } ' , additional_props = [ ' ssl ' , ' winsock ' ] , depends_on_zlib = True ) } <nl> mmm a / templates / vsprojects / vs2013 / vcxproj_defs . include <nl> ppp b / templates / vsprojects / vs2013 / vcxproj_defs . include <nl> <nl> < % def name = " to_windows_path ( path ) " > $ { path . replace ( ' / ' , ' \ \ ' ) } < / % def > \ <nl> < % def name = " get_subsystem ( is_library ) " > $ { ' Windows ' if is_library else ' Console ' } < / % def > \ <nl> - < % def name = " gen_project ( name , libs , targets , configuration_type = ' StaticLibrary ' , project_guid = None , additional_props = [ ] ) " > \ <nl> + < % def name = " gen_project ( name , libs , targets , configuration_type = ' StaticLibrary ' , project_guid = None , additional_props = [ ] , depends_on_zlib = False ) " > \ <nl> % for project in vsprojects : <nl> % if project . name = = name : <nl> < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> <nl> < Project > $ { vsproject_dict [ dep ] . vs_project_guid } < / Project > <nl> < / ProjectReference > <nl> % endfor <nl> + % if depends_on_zlib : <nl> + < ProjectReference Include = " third_party \ zlibvc . vcxproj " > <nl> + < Project > { 8fd826f8 - 3739 - 44e6 - 8cc8 - 997122e53b8d } < / Project > <nl> + < / ProjectReference > <nl> + % endif <nl> < / ItemGroup > <nl> % endif <nl> < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . targets " / > <nl> mmm a / vsprojects / vs2013 / grpc_csharp_ext_shared . vcxproj <nl> ppp b / vsprojects / vs2013 / grpc_csharp_ext_shared . vcxproj <nl> <nl> < ImportGroup Label = " PropertySheets " Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > <nl> < Import Project = " $ ( UserRootDir ) \ Microsoft . Cpp . $ ( Platform ) . user . props " Condition = " exists ( ' $ ( UserRootDir ) \ Microsoft . Cpp . $ ( Platform ) . user . props ' ) " Label = " LocalAppDataPlatform " / > <nl> < Import Project = " global . props " / > <nl> + < Import Project = " winsock . props " / > <nl> < / ImportGroup > <nl> < ImportGroup Label = " PropertySheets " Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > <nl> < Import Project = " $ ( UserRootDir ) \ Microsoft . Cpp . $ ( Platform ) . user . props " Condition = " exists ( ' $ ( UserRootDir ) \ Microsoft . Cpp . $ ( Platform ) . user . props ' ) " Label = " LocalAppDataPlatform " / > <nl> < Import Project = " global . props " / > <nl> + < Import Project = " winsock . props " / > <nl> < / ImportGroup > <nl> < PropertyGroup Label = " UserMacros " / > <nl> < PropertyGroup / > <nl> mmm a / vsprojects / vs2013 / grpc_shared . vcxproj <nl> ppp b / vsprojects / vs2013 / grpc_shared . vcxproj <nl> <nl> < ProjectReference Include = " gpr . vcxproj " > <nl> < Project > { B23D3D1A - 9438 - 4EDA - BEB6 - 9A0A03D17792 } < / Project > <nl> < / ProjectReference > <nl> + < ProjectReference Include = " third_party \ zlibvc . vcxproj " > <nl> + < Project > { 8fd826f8 - 3739 - 44e6 - 8cc8 - 997122e53b8d } < / Project > <nl> + < / ProjectReference > <nl> < / ItemGroup > <nl> < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . targets " / > <nl> < ImportGroup Label = " ExtensionTargets " > <nl>
|
fixes to make shared libraries build
|
grpc/grpc
|
31e40652a975c8b633224d0bba3f90a840b9d693
|
2015-02-11T22:23:38Z
|
mmm a / hphp / test / slow / program_functions / ini_get_all_second_third . php . expectf <nl> ppp b / hphp / test / slow / program_functions / ini_get_all_second_third . php . expectf <nl> <nl> - array ( 168 ) { <nl> + array ( 169 ) { <nl> [ " hhvm . jit_profile_requests " ] = > <nl> array ( 3 ) { <nl> [ " global_value " ] = > <nl> array ( 168 ) { <nl> [ " access " ] = > <nl> int ( 4 ) <nl> } <nl> + [ " hhvm . pcre_expire_interval " ] = > <nl> + array ( 3 ) { <nl> + [ " global_value " ] = > <nl> + string ( % d ) " % s " <nl> + [ " local_value " ] = > <nl> + string ( % d ) " % s " <nl> + [ " access " ] = > <nl> + int ( % d ) <nl> + } <nl> [ " hhvm . pcre_table_size " ] = > <nl> array ( 3 ) { <nl> [ " global_value " ] = > <nl>
|
Fix test / slow / program_functions / ini_get_all_second_third . php . expectf
|
facebook/hhvm
|
5787ec32b46d63c897f57f6de7a76aaea729abbb
|
2014-10-09T14:00:21Z
|
mmm a / modules / core / include / opencv2 / core . hpp <nl> ppp b / modules / core / include / opencv2 / core . hpp <nl> typedef Vec < double , 4 > Vec4d ; <nl> typedef Vec < double , 6 > Vec6d ; <nl> <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / Size_ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / * ! <nl> - The 2D size class <nl> - <nl> - The class represents the size of a 2D rectangle , image size , matrix size etc . <nl> - Normally , cv : : Size ~ cv : : Size_ < int > is used . <nl> - * / <nl> - template < typename _Tp > class CV_EXPORTS Size_ <nl> - { <nl> - public : <nl> - typedef _Tp value_type ; <nl> - <nl> - / / ! various constructors <nl> - Size_ ( ) ; <nl> - Size_ ( _Tp _width , _Tp _height ) ; <nl> - Size_ ( const Size_ & sz ) ; <nl> - Size_ ( const CvSize & sz ) ; <nl> - Size_ ( const CvSize2D32f & sz ) ; <nl> - Size_ ( const Point_ < _Tp > & pt ) ; <nl> - <nl> - Size_ & operator = ( const Size_ & sz ) ; <nl> - / / ! the area ( width * height ) <nl> - _Tp area ( ) const ; <nl> - <nl> - / / ! conversion of another data type . <nl> - template < typename _Tp2 > operator Size_ < _Tp2 > ( ) const ; <nl> - <nl> - / / ! conversion to the old - style OpenCV types <nl> - operator CvSize ( ) const ; <nl> - operator CvSize2D32f ( ) const ; <nl> - <nl> - _Tp width , height ; / / the width and the height <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / Rect_ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> / * ! <nl> template < typename _Tp > class CV_EXPORTS Rect_ <nl> <nl> shorter aliases for the most popular cv : : Point_ < > , cv : : Size_ < > and cv : : Rect_ < > specializations <nl> * / <nl> - typedef Size_ < int > Size2i ; <nl> - typedef Size2i Size ; <nl> typedef Rect_ < int > Rect ; <nl> - typedef Size_ < float > Size2f ; <nl> <nl> <nl> / * ! <nl> mmm a / modules / core / include / opencv2 / core / operations . hpp <nl> ppp b / modules / core / include / opencv2 / core / operations . hpp <nl> template < typename _Tp > inline Size_ < _Tp > : : Size_ ( _Tp _width , _Tp _height ) <nl> : width ( _width ) , height ( _height ) { } <nl> template < typename _Tp > inline Size_ < _Tp > : : Size_ ( const Size_ & sz ) <nl> : width ( sz . width ) , height ( sz . height ) { } <nl> - template < typename _Tp > inline Size_ < _Tp > : : Size_ ( const CvSize & sz ) <nl> - : width ( saturate_cast < _Tp > ( sz . width ) ) , height ( saturate_cast < _Tp > ( sz . height ) ) { } <nl> - template < typename _Tp > inline Size_ < _Tp > : : Size_ ( const CvSize2D32f & sz ) <nl> - : width ( saturate_cast < _Tp > ( sz . width ) ) , height ( saturate_cast < _Tp > ( sz . height ) ) { } <nl> template < typename _Tp > inline Size_ < _Tp > : : Size_ ( const Point_ < _Tp > & pt ) : width ( pt . x ) , height ( pt . y ) { } <nl> <nl> template < typename _Tp > template < typename _Tp2 > inline Size_ < _Tp > : : operator Size_ < _Tp2 > ( ) const <nl> { return Size_ < _Tp2 > ( saturate_cast < _Tp2 > ( width ) , saturate_cast < _Tp2 > ( height ) ) ; } <nl> - template < typename _Tp > inline Size_ < _Tp > : : operator CvSize ( ) const <nl> - { return cvSize ( saturate_cast < int > ( width ) , saturate_cast < int > ( height ) ) ; } <nl> - template < typename _Tp > inline Size_ < _Tp > : : operator CvSize2D32f ( ) const <nl> - { return cvSize2D32f ( ( float ) width , ( float ) height ) ; } <nl> <nl> template < typename _Tp > inline Size_ < _Tp > & Size_ < _Tp > : : operator = ( const Size_ < _Tp > & sz ) <nl> { width = sz . width ; height = sz . height ; return * this ; } <nl> mmm a / modules / core / include / opencv2 / core / types . hpp <nl> ppp b / modules / core / include / opencv2 / core / types . hpp <nl> typedef Point3_ < int > Point3i ; <nl> typedef Point3_ < float > Point3f ; <nl> typedef Point3_ < double > Point3d ; <nl> <nl> + <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / Size_ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + / * ! <nl> + The 2D size class <nl> + <nl> + The class represents the size of a 2D rectangle , image size , matrix size etc . <nl> + Normally , cv : : Size ~ cv : : Size_ < int > is used . <nl> + * / <nl> + template < typename _Tp > class CV_EXPORTS Size_ <nl> + { <nl> + public : <nl> + typedef _Tp value_type ; <nl> + <nl> + / / ! various constructors <nl> + Size_ ( ) ; <nl> + Size_ ( _Tp _width , _Tp _height ) ; <nl> + Size_ ( const Size_ & sz ) ; <nl> + Size_ ( const Point_ < _Tp > & pt ) ; <nl> + <nl> + Size_ & operator = ( const Size_ & sz ) ; <nl> + / / ! the area ( width * height ) <nl> + _Tp area ( ) const ; <nl> + <nl> + / / ! conversion of another data type . <nl> + template < typename _Tp2 > operator Size_ < _Tp2 > ( ) const ; <nl> + <nl> + _Tp width , height ; / / the width and the height <nl> + } ; <nl> + <nl> + / * ! <nl> + \ typedef <nl> + * / <nl> + typedef Size_ < int > Size2i ; <nl> + typedef Size_ < float > Size2f ; <nl> + typedef Size2i Size ; <nl> + <nl> } / / cv <nl> <nl> # endif / / __OPENCV_CORE_TYPES_HPP__ <nl> \ No newline at end of file <nl> mmm a / modules / core / include / opencv2 / core / types_c . h <nl> ppp b / modules / core / include / opencv2 / core / types_c . h <nl> typedef struct CvSize <nl> { <nl> int width ; <nl> int height ; <nl> + <nl> + # ifdef __cplusplus <nl> + CvSize ( int w = 0 , int h = 0 ) : width ( w ) , height ( h ) { } <nl> + template < typename _Tp > <nl> + CvSize ( const cv : : Size_ < _Tp > & sz ) : width ( cv : : saturate_cast < int > ( sz . width ) ) , height ( cv : : saturate_cast < int > ( sz . height ) ) { } <nl> + template < typename _Tp > <nl> + operator cv : : Size_ < _Tp > ( ) const { return cv : : Size_ < _Tp > ( cv : : saturate_cast < _Tp > ( width ) , cv : : saturate_cast < _Tp > ( height ) ) ; } <nl> + # endif <nl> } <nl> CvSize ; <nl> <nl> typedef struct CvSize2D32f <nl> { <nl> float width ; <nl> float height ; <nl> + <nl> + # ifdef __cplusplus <nl> + CvSize2D32f ( float w = 0 , float h = 0 ) : width ( w ) , height ( h ) { } <nl> + template < typename _Tp > <nl> + CvSize2D32f ( const cv : : Size_ < _Tp > & sz ) : width ( cv : : saturate_cast < float > ( sz . width ) ) , height ( cv : : saturate_cast < float > ( sz . height ) ) { } <nl> + template < typename _Tp > <nl> + operator cv : : Size_ < _Tp > ( ) const { return cv : : Size_ < _Tp > ( cv : : saturate_cast < _Tp > ( width ) , cv : : saturate_cast < _Tp > ( height ) ) ; } <nl> + # endif <nl> } <nl> CvSize2D32f ; <nl> <nl> mmm a / modules / core / src / array . cpp <nl> ppp b / modules / core / src / array . cpp <nl> cvGetDimSize ( const CvArr * arr , int index ) <nl> CV_IMPL CvSize <nl> cvGetSize ( const CvArr * arr ) <nl> { <nl> - CvSize size = { 0 , 0 } ; <nl> + CvSize size ; <nl> <nl> if ( CV_IS_MAT_HDR_Z ( arr ) ) <nl> { <nl> mmm a / modules / highgui / src / utils . cpp <nl> ppp b / modules / highgui / src / utils . cpp <nl> cvConvertImage ( const CvArr * srcarr , CvArr * dstarr , int flags ) <nl> uchar * s = src - > data . ptr , * d = dst - > data . ptr ; <nl> int s_step = src - > step , d_step = dst - > step ; <nl> int code = src_cn * 10 + dst_cn ; <nl> - CvSize size = { src - > cols , src - > rows } ; <nl> + CvSize size ( src - > cols , src - > rows ) ; <nl> <nl> if ( CV_IS_MAT_CONT ( src - > type & dst - > type ) ) <nl> { <nl> mmm a / modules / legacy / src / optflowbm . cpp <nl> ppp b / modules / legacy / src / optflowbm . cpp <nl> cvCalcOpticalFlowBM ( const void * srcarrA , const void * srcarrB , <nl> if ( ! CV_ARE_TYPES_EQ ( velx , vely ) ) <nl> CV_Error ( CV_StsUnmatchedFormats , " Destination images have different formats " ) ; <nl> <nl> - CvSize velSize = <nl> - { <nl> + CvSize velSize ( <nl> ( srcA - > width - blockSize . width + shiftSize . width ) / shiftSize . width , <nl> ( srcA - > height - blockSize . height + shiftSize . height ) / shiftSize . height <nl> - } ; <nl> + ) ; <nl> <nl> if ( ! CV_ARE_SIZES_EQ ( srcA , srcB ) | | <nl> ! CV_ARE_SIZES_EQ ( velx , vely ) | | <nl> mmm a / modules / legacy / src / pyrsegmentation . cpp <nl> ppp b / modules / legacy / src / pyrsegmentation . cpp <nl> icvPyrSegmentation8uC1R ( uchar * src_image , int src_step , <nl> / * calculate initial pyramid * / <nl> for ( l = 1 ; l < = level ; l + + ) <nl> { <nl> - CvSize dst_size = { size . width / 2 + 1 , size . height / 2 + 1 } ; <nl> + CvSize dst_size ( size . width / 2 + 1 , size . height / 2 + 1 ) ; <nl> CvMat prev_level = cvMat ( size . height , size . width , CV_32FC1 ) ; <nl> CvMat next_level = cvMat ( dst_size . height , dst_size . width , CV_32FC1 ) ; <nl> <nl> icvPyrSegmentation8uC3R ( uchar * src_image , int src_step , <nl> / * calculate initial pyramid * / <nl> for ( l = 1 ; l < = level ; l + + ) <nl> { <nl> - CvSize dst_size = { size . width / 2 + 1 , size . height / 2 + 1 } ; <nl> + CvSize dst_size ( size . width / 2 + 1 , size . height / 2 + 1 ) ; <nl> CvMat prev_level = cvMat ( size . height , size . width , CV_32FC3 ) ; <nl> CvMat next_level = cvMat ( dst_size . height , dst_size . width , CV_32FC3 ) ; <nl> <nl> mmm a / modules / legacy / src / testseq . cpp <nl> ppp b / modules / legacy / src / testseq . cpp <nl> CvTestSeq * cvCreateTestSeq ( char * pConfigfile , char * * videos , int numvideo , float <nl> { / * Calculate elements and image size and video length : * / <nl> CvTestSeqElem * p = pTS - > pElemList ; <nl> int num = 0 ; <nl> - CvSize MaxSize = { 0 , 0 } ; <nl> + CvSize MaxSize ; <nl> int MaxFN = 0 ; <nl> <nl> for ( p = pTS - > pElemList ; p ; p = p - > next , num + + ) <nl> { <nl> int FN = p - > FrameBegin + p - > FrameNum ; <nl> - CvSize S = { 0 , 0 } ; <nl> + CvSize S ; <nl> <nl> if ( p - > pImg & & p - > BG ) <nl> { <nl> mmm a / modules / legacy / src / vecfacetracking . cpp <nl> ppp b / modules / legacy / src / vecfacetracking . cpp <nl> struct CvFaceTracker <nl> } ; <nl> int InitNextImage ( IplImage * img ) <nl> { <nl> - CvSize sz = { img - > width , img - > height } ; <nl> + CvSize sz ( img - > width , img - > height ) ; <nl> ReallocImage ( & imgGray , sz , 1 ) ; <nl> ReallocImage ( & imgThresh , sz , 1 ) ; <nl> ptRotate = face [ MOUTH ] . ptCenter ; <nl> mmm a / modules / legacy / test / test_pyrsegmentation . cpp <nl> ppp b / modules / legacy / test / test_pyrsegmentation . cpp <nl> void CV_PyrSegmentationTest : : run ( int / * start_from * / ) <nl> int i , j , iter ; <nl> <nl> IplImage * image , * image_f , * image_s ; <nl> - CvSize size = { 128 , 128 } ; <nl> + CvSize size ( 128 , 128 ) ; <nl> const int threshold1 = 50 , threshold2 = 50 ; <nl> <nl> rect [ 1 ] . width = size . width ; <nl> mmm a / modules / objdetect / src / haar . cpp <nl> ppp b / modules / objdetect / src / haar . cpp <nl> cvHaarDetectObjectsForROC ( const CvArr * _img , <nl> <nl> for ( factor = 1 ; ; factor * = scaleFactor ) <nl> { <nl> - CvSize winSize = { cvRound ( winSize0 . width * factor ) , <nl> - cvRound ( winSize0 . height * factor ) } ; <nl> - CvSize sz = { cvRound ( img - > cols / factor ) , cvRound ( img - > rows / factor ) } ; <nl> - CvSize sz1 = { sz . width - winSize0 . width + 1 , sz . height - winSize0 . height + 1 } ; <nl> + CvSize winSize ( cvRound ( winSize0 . width * factor ) , <nl> + cvRound ( winSize0 . height * factor ) ) ; <nl> + CvSize sz ( cvRound ( img - > cols / factor ) , cvRound ( img - > rows / factor ) ) ; <nl> + CvSize sz1 ( sz . width - winSize0 . width + 1 , sz . height - winSize0 . height + 1 ) ; <nl> <nl> CvRect equRect = { icv_object_win_border , icv_object_win_border , <nl> winSize0 . width - icv_object_win_border * 2 , <nl> cvHaarDetectObjectsForROC ( const CvArr * _img , <nl> for ( ; n_factors - - > 0 ; factor * = scaleFactor ) <nl> { <nl> const double ystep = std : : max ( 2 . , factor ) ; <nl> - CvSize winSize = { cvRound ( cascade - > orig_window_size . width * factor ) , <nl> - cvRound ( cascade - > orig_window_size . height * factor ) } ; <nl> + CvSize winSize ( cvRound ( cascade - > orig_window_size . width * factor ) , <nl> + cvRound ( cascade - > orig_window_size . height * factor ) ) ; <nl> CvRect equRect = { 0 , 0 , 0 , 0 } ; <nl> int * p [ 4 ] = { 0 , 0 , 0 , 0 } ; <nl> int * pq [ 4 ] = { 0 , 0 , 0 , 0 } ; <nl>
|
Move cv : : Size_
|
opencv/opencv
|
addf0309ec0e59ad47d27599e85e778cb4c65cfc
|
2013-04-01T11:24:32Z
|
mmm a / tensorflow / lite / delegates / gpu / cl / kernels / convolution_transposed . cc <nl> ppp b / tensorflow / lite / delegates / gpu / cl / kernels / convolution_transposed . cc <nl> std : : string GenerateConvolutionTransposedCode ( <nl> const OperationDef & op_def , const LinearStorage & biases , <nl> const CLDevice & device , <nl> const std : : vector < ElementwiseOperation * > & linked_operations ) { <nl> - TensorCodeGenerator src_tensor ( " src_data " , " src_size " , op_def . src_tensors [ 0 ] ) ; <nl> - TensorCodeGenerator dst_tensor ( " dst_data " , " dst_size " , op_def . dst_tensors [ 0 ] ) ; <nl> + const TensorCodeGenerator : : SizeVariablesNames src_size ( <nl> + " src_size . x " , " src_size . y " , " src_size . z " , " src_size . w " ) ; <nl> + const TensorCodeGenerator : : SizeVariablesNames dst_size ( <nl> + " dst_size . x " , " dst_size . y " , " dst_size . z " , " dst_size . w " ) ; <nl> + TensorCodeGenerator src_tensor ( " src_data " , src_size , op_def . src_tensors [ 0 ] ) ; <nl> + TensorCodeGenerator dst_tensor ( " dst_data " , dst_size , op_def . dst_tensors [ 0 ] ) ; <nl> const auto src_tensor_type = op_def . src_tensors [ 0 ] . storage_type ; <nl> + <nl> + const std : : string batch_id = op_def . batch_support ? " B " : " " ; <nl> std : : string c = GetCommonDefines ( op_def . precision ) ; <nl> <nl> switch ( op_def . precision ) { <nl> std : : string GenerateConvolutionTransposedCode ( <nl> c + = " int4 src_size , \ n " ; <nl> c + = " int4 dst_size \ n " ; <nl> c + = " ) { \ n " ; <nl> - c + = " int X = get_global_id ( 0 ) ; \ n " ; <nl> + if ( op_def . batch_support ) { <nl> + c + = " int X = get_global_id ( 0 ) / dst_size . w ; \ n " ; <nl> + c + = " int B = get_global_id ( 0 ) % dst_size . w ; \ n " ; <nl> + } else { <nl> + c + = " int X = get_global_id ( 0 ) ; \ n " ; <nl> + } <nl> c + = " int Y = get_global_id ( 1 ) ; \ n " ; <nl> c + = " int Z = get_global_id ( 2 ) ; \ n " ; <nl> - c + = " if ( X > = dst_size . x | | Y > = dst_size . y | | Z > = dst_size . w ) return ; \ n " ; <nl> + c + = " if ( X > = dst_size . x | | Y > = dst_size . y | | Z > = dst_size . z ) return ; \ n " ; <nl> if ( src_tensor_type = = TensorStorageType : : BUFFER ) { <nl> - c + = " int f_base = Z * src_size . w * kernel_size . x * kernel_size . y ; \ n " ; <nl> + c + = " int f_base = Z * src_size . z * kernel_size . x * kernel_size . y ; \ n " ; <nl> } <nl> c + = " int2 offset = ( int2 ) ( X , Y ) + padding - k_offset ; \ n " ; <nl> c + = " offset . x = offset . x % stride . x ; \ n " ; <nl> std : : string GenerateConvolutionTransposedCode ( <nl> c + = " int kernel_index = index_y * kernel_size . x + index_x ; \ n " ; <nl> c + = " if ( inside_kernel & & ! ( out_x | | out_y ) ) { \ n " ; <nl> if ( src_tensor_type = = TensorStorageType : : BUFFER ) { <nl> - c + = " int f_offset = f_base + kernel_index * src_size . w ; \ n " ; <nl> + c + = " int f_offset = f_base + kernel_index * src_size . z ; \ n " ; <nl> } else { <nl> - c + = " int x_c = kernel_index * src_size . w * 4 ; \ n " ; <nl> + c + = " int x_c = kernel_index * src_size . z * 4 ; \ n " ; <nl> } <nl> - c + = " for ( int l = 0 ; l < src_size . w ; + + l ) { \ n " ; <nl> - c + = " FLT4 src = " + src_tensor . Read3D ( " s_x " , " s_y " , " l " ) + " ; \ n " ; <nl> + c + = " for ( int l = 0 ; l < src_size . z ; + + l ) { \ n " ; <nl> + c + = " FLT4 src = " + src_tensor . Read4D ( " s_x " , " s_y " , " l " , batch_id ) + <nl> + " ; \ n " ; <nl> if ( src_tensor_type = = TensorStorageType : : BUFFER ) { <nl> c + = " FLT16 f0 = filters [ f_offset ] ; f_offset + + ; \ n " ; <nl> } else { <nl> std : : string GenerateConvolutionTransposedCode ( <nl> c + = " } \ n " ; <nl> c + = " FLT4 bias_val = " + biases . ReadLinearFLT4 ( " Z " ) + " ; \ n " ; <nl> c + = " FLT4 res0 = TO_FLT4 ( r0 ) + bias_val ; \ n " ; <nl> - const LinkingContext context { " res0 " , " X " , " Y " , " Z " } ; <nl> + std : : string x_3dcoord = op_def . batch_support ? " X * dst_size . w + B " : " X " ; <nl> + const LinkingContext context { " res0 " , x_3dcoord , " Y " , " Z " } ; <nl> c + = PostProcess ( linked_operations , context ) ; <nl> - c + = " " + dst_tensor . Write3D ( " res0 " , " X " , " Y " , " Z " ) + " \ n " ; <nl> + c + = " " + dst_tensor . Write4D ( " res0 " , " X " , " Y " , " Z " , batch_id ) + " \ n " ; <nl> c + = " } \ n " ; <nl> <nl> return c ; <nl> Status ConvolutionTransposed : : BindArguments ( ) { <nl> RETURN_IF_ERROR ( kernel_ . SetBytesAuto ( padding_ ) ) ; <nl> RETURN_IF_ERROR ( kernel_ . SetBytesAuto ( kernel_offset_ ) ) ; <nl> RETURN_IF_ERROR ( kernel_ . SetBytesAuto ( inner_size_ ) ) ; <nl> - RETURN_IF_ERROR ( kernel_ . SetBytesAuto ( src_ [ 0 ] - > GetSizeWithDepth ( ) ) ) ; <nl> - RETURN_IF_ERROR ( kernel_ . SetBytesAuto ( dst_ [ 0 ] - > GetSizeWithDepth ( ) ) ) ; <nl> + RETURN_IF_ERROR ( kernel_ . SetBytesAuto ( src_ [ 0 ] - > GetWHDB ( ) ) ) ; <nl> + RETURN_IF_ERROR ( kernel_ . SetBytesAuto ( dst_ [ 0 ] - > GetWHDB ( ) ) ) ; <nl> return OkStatus ( ) ; <nl> } <nl> <nl> int3 ConvolutionTransposed : : GetGridSize ( ) const { <nl> - const int grid_x = dst_ [ 0 ] - > Width ( ) ; <nl> + const int grid_x = dst_ [ 0 ] - > Width ( ) * dst_ [ 0 ] - > Batch ( ) ; <nl> const int grid_y = dst_ [ 0 ] - > Height ( ) ; <nl> const int grid_z = dst_ [ 0 ] - > Depth ( ) ; <nl> return int3 ( grid_x , grid_y , grid_z ) ; <nl>
|
Batch support for ConvolutionTransposed .
|
tensorflow/tensorflow
|
bb4d50f8dc4fb15b185a348ff868db1898992710
|
2019-10-08T17:20:42Z
|
mmm a / src / webui / www / public / downloadlimit . html <nl> ppp b / src / webui / www / public / downloadlimit . html <nl> <nl> ' limit ' : limit <nl> } , <nl> onComplete : function ( ) { <nl> + window . parent . updateTransferInfo ( ) ; <nl> window . parent . closeWindows ( ) ; <nl> } <nl> } ) . send ( ) ; <nl> mmm a / src / webui / www / public / uploadlimit . html <nl> ppp b / src / webui / www / public / uploadlimit . html <nl> <nl> ' limit ' : limit <nl> } , <nl> onComplete : function ( ) { <nl> + window . parent . updateTransferInfo ( ) ; <nl> window . parent . closeWindows ( ) ; <nl> } <nl> } ) . send ( ) ; <nl>
|
WebUI : Update transfer info when speed limits are changed
|
qbittorrent/qBittorrent
|
25e8cad16c3277812c5e151c70241ce478bbe63e
|
2014-12-14T15:20:37Z
|
mmm a / src / model . jl <nl> ppp b / src / model . jl <nl> function fit ( self : : FeedForward , optimizer : : AbstractOptimizer , data : : Abstra <nl> <nl> # get grad attribute to allow for freezing <nl> freeze_names = Symbol [ ] <nl> - for ( attr , value ) in list_attr ( self . arch ) <nl> + for ( attr , value ) in list_all_attr ( self . arch ) <nl> sattr = string ( attr ) <nl> if endswith ( sattr , " grad " ) & & value = = " freeze " <nl> push ! ( freeze_names , symbol ( sattr [ 1 : end - 5 ] ) ) <nl> mmm a / src / symbolic - node . jl <nl> ppp b / src / symbolic - node . jl <nl> end <nl> # = doc <nl> . . function : list_attr ( self : : SymbolicNode ) <nl> <nl> - Get all attributes from symbol . <nl> + Get all attributes from a symbol . <nl> : return : Dictionary of attributes . <nl> = # <nl> function list_attr ( self : : SymbolicNode ) <nl> + ref_sz = Ref { MX_uint } ( 0 ) <nl> + ref_strings = Ref { char_pp } ( 0 ) <nl> + @ mxcall ( : MXSymbolListAttrShallow , ( MX_handle , Ref { MX_uint } , Ref { char_pp } ) , <nl> + self , ref_sz , ref_strings ) <nl> + narg = 2 * ref_sz [ ] <nl> + strings = pointer_to_array ( ref_strings [ ] , narg ) <nl> + out = Dict { Symbol , ByteString } ( ) <nl> + for i in 1 : 2 : narg <nl> + key = symbol ( bytestring ( strings [ i ] ) ) <nl> + value = bytestring ( strings [ i + 1 ] ) <nl> + out [ key ] = value <nl> + end <nl> + return out <nl> + end <nl> + <nl> + # = doc <nl> + . . function : list_all_attr ( self : : SymbolicNode ) <nl> + <nl> + Get all attributes from the symbol graph . <nl> + : return : Dictionary of attributes . <nl> + = # <nl> + function list_all_attr ( self : : SymbolicNode ) <nl> ref_sz = Ref { MX_uint } ( 0 ) <nl> ref_strings = Ref { char_pp } ( 0 ) <nl> @ mxcall ( : MXSymbolListAttr , ( MX_handle , Ref { MX_uint } , Ref { char_pp } ) , <nl>
|
Merge pull request from vchuravy / vc / fixup
|
apache/incubator-mxnet
|
e7cd13588d4c2db9a5905d24d4e080365afd0944
|
2016-05-09T03:21:24Z
|
mmm a / modules / prediction / container / obstacles / obstacles_container . cc <nl> ppp b / modules / prediction / container / obstacles / obstacles_container . cc <nl> bool ObstaclesContainer : : IsMovable ( <nl> double ObstaclesContainer : : timestamp ( ) const { return timestamp_ ; } <nl> <nl> SubmoduleOutput ObstaclesContainer : : GetSubmoduleOutput ( <nl> - const size_t history_size , const absl : : Time & frame_start_time ) { <nl> + const size_t history_size , const apollo : : cyber : : Time & frame_start_time ) { <nl> SubmoduleOutput container_output ; <nl> for ( int id : curr_frame_considered_obstacle_ids_ ) { <nl> Obstacle * obstacle = GetObstacle ( id ) ; <nl> mmm a / modules / prediction / container / obstacles / obstacles_container . h <nl> ppp b / modules / prediction / container / obstacles / obstacles_container . h <nl> <nl> # include < vector > <nl> <nl> # include " modules / common / util / lru_cache . h " <nl> + # include " modules / prediction / common / junction_analyzer . h " <nl> # include " modules / prediction / container / container . h " <nl> # include " modules / prediction / container / obstacles / obstacle . h " <nl> # include " modules / prediction / container / obstacles / obstacle_clusters . h " <nl> # include " modules / prediction / proto / prediction_obstacle . pb . h " <nl> # include " modules / prediction / submodules / submodule_output . h " <nl> - # include " modules / prediction / common / junction_analyzer . h " <nl> <nl> namespace apollo { <nl> namespace prediction { <nl> class ObstaclesContainer : public Container { <nl> <nl> double timestamp ( ) const ; <nl> <nl> - SubmoduleOutput GetSubmoduleOutput ( const size_t history_size , <nl> - const absl : : Time & frame_start_time ) ; <nl> + SubmoduleOutput GetSubmoduleOutput ( <nl> + const size_t history_size , const apollo : : cyber : : Time & frame_start_time ) ; <nl> <nl> / * * <nl> * @ brief Get current scenario <nl> mmm a / modules / prediction / prediction_component . cc <nl> ppp b / modules / prediction / prediction_component . cc <nl> <nl> <nl> # include " cyber / common / file . h " <nl> # include " cyber / record / record_reader . h " <nl> + # include " cyber / time / clock . h " <nl> # include " modules / common / adapters / adapter_gflags . h " <nl> # include " modules / common / util / message_util . h " <nl> <nl> namespace apollo { <nl> namespace prediction { <nl> <nl> using apollo : : common : : adapter : : AdapterConfig ; <nl> - using apollo : : common : : time : : Clock ; <nl> + using apollo : : cyber : : Clock ; <nl> using apollo : : perception : : PerceptionObstacles ; <nl> using apollo : : planning : : ADCTrajectory ; <nl> <nl> bool PredictionComponent : : Proc ( <nl> bool PredictionComponent : : ContainerSubmoduleProcess ( <nl> const std : : shared_ptr < PerceptionObstacles > & perception_obstacles ) { <nl> constexpr static size_t kHistorySize = 10 ; <nl> - const auto frame_start_time = absl : : Now ( ) ; <nl> + const auto frame_start_time = Clock : : Now ( ) ; <nl> / / Read localization info . and call OnLocalization to update <nl> / / the PoseContainer . <nl> localization_reader_ - > Observe ( ) ; <nl> mmm a / modules / prediction / prediction_component . h <nl> ppp b / modules / prediction / prediction_component . h <nl> <nl> # include < memory > <nl> # include < string > <nl> <nl> - # include " absl / time / time . h " <nl> + # include " cyber / time / time . h " <nl> <nl> # include " cyber / component / component . h " <nl> # include " modules / prediction / common / message_process . h " <nl> mmm a / modules / prediction / submodules / BUILD <nl> ppp b / modules / prediction / submodules / BUILD <nl> cc_library ( <nl> " / / modules / perception / proto : perception_obstacle_cc_proto " , <nl> " / / modules / prediction / common : prediction_gflags " , <nl> " / / modules / prediction / container / obstacles : obstacle " , <nl> - " @ com_google_absl / / absl / time " , <nl> ] , <nl> ) <nl> <nl> cc_library ( <nl> ] , <nl> deps = [ <nl> " / / cyber " , <nl> + " / / cyber / time : clock " , <nl> " / / modules / common / adapters : adapter_gflags " , <nl> " / / modules / common / adapters / proto : adapter_config_cc_proto " , <nl> - " / / modules / common / time " , <nl> " / / modules / perception / proto : perception_obstacle_cc_proto " , <nl> " / / modules / prediction / common : message_process " , <nl> " / / modules / prediction / common : prediction_gflags " , <nl> cc_library ( <nl> ] , <nl> deps = [ <nl> " / / cyber " , <nl> + " / / cyber / time : clock " , <nl> " / / modules / common / adapters : adapter_gflags " , <nl> " / / modules / common / adapters / proto : adapter_config_cc_proto " , <nl> - " / / modules / common / time " , <nl> " / / modules / common / util : message_util " , <nl> " / / modules / perception / proto : perception_obstacle_cc_proto " , <nl> " / / modules / prediction / common : message_process " , <nl> mmm a / modules / prediction / submodules / evaluator_submodule . cc <nl> ppp b / modules / prediction / submodules / evaluator_submodule . cc <nl> <nl> <nl> # include " modules / prediction / submodules / evaluator_submodule . h " <nl> <nl> + # include " cyber / time / clock . h " <nl> # include " modules / common / adapters / adapter_gflags . h " <nl> # include " modules / common / adapters / proto / adapter_config . pb . h " <nl> - # include " modules / common / time / time . h " <nl> # include " modules / prediction / common / message_process . h " <nl> # include " modules / prediction / common / prediction_system_gflags . h " <nl> <nl> mmm a / modules / prediction / submodules / predictor_submodule . cc <nl> ppp b / modules / prediction / submodules / predictor_submodule . cc <nl> <nl> <nl> # include " modules / prediction / submodules / predictor_submodule . h " <nl> <nl> - # include " absl / time / time . h " <nl> + # include " cyber / time / time . h " <nl> <nl> + # include " cyber / time / clock . h " <nl> # include " modules / common / adapters / adapter_gflags . h " <nl> # include " modules / common / adapters / proto / adapter_config . pb . h " <nl> - # include " modules / common / time / time . h " <nl> # include " modules / common / util / message_util . h " <nl> # include " modules / prediction / common / prediction_system_gflags . h " <nl> <nl> namespace apollo { <nl> namespace prediction { <nl> <nl> - using apollo : : common : : time : : Clock ; <nl> + using apollo : : cyber : : Clock ; <nl> using apollo : : perception : : PerceptionObstacles ; <nl> <nl> std : : string PredictorSubmodule : : Name ( ) const { <nl> bool PredictorSubmodule : : Proc ( <nl> perception_obstacles - > header ( ) ; <nl> const apollo : : common : : ErrorCode & perception_error_code = <nl> perception_obstacles - > error_code ( ) ; <nl> - const absl : : Time & frame_start_time = submodule_output - > frame_start_time ( ) ; <nl> + const apollo : : cyber : : Time & frame_start_time = <nl> + submodule_output - > frame_start_time ( ) ; <nl> ObstaclesContainer obstacles_container ( * submodule_output ) ; <nl> predictor_manager_ - > Run ( * perception_obstacles , adc_trajectory_container . get ( ) , <nl> & obstacles_container ) ; <nl> bool PredictorSubmodule : : Proc ( <nl> common : : util : : FillHeader ( node_ - > Name ( ) , & prediction_obstacles ) ; <nl> predictor_writer_ - > Write ( prediction_obstacles ) ; <nl> <nl> - const absl : : Time & end_time = absl : : Now ( ) ; <nl> + const apollo : : cyber : : Time & end_time = Clock : : Now ( ) ; <nl> ADEBUG < < " End to end time = " <nl> - < < absl : : ToDoubleMilliseconds ( end_time - frame_start_time ) < < " ms " ; <nl> + < < ( end_time - frame_start_time ) . ToSecond ( ) * 1000 < < " ms " ; <nl> <nl> return true ; <nl> } <nl> mmm a / modules / prediction / submodules / submodule_output . cc <nl> ppp b / modules / prediction / submodules / submodule_output . cc <nl> void SubmoduleOutput : : set_curr_frame_considered_obstacle_ids ( <nl> curr_frame_considered_obstacle_ids_ = curr_frame_considered_obstacle_ids ; <nl> } <nl> <nl> - void SubmoduleOutput : : set_frame_start_time ( const absl : : Time & frame_start_time ) { <nl> + void SubmoduleOutput : : set_frame_start_time ( <nl> + const apollo : : cyber : : Time & frame_start_time ) { <nl> frame_start_time_ = frame_start_time ; <nl> } <nl> <nl> std : : vector < int > SubmoduleOutput : : curr_frame_considered_obstacle_ids ( ) const { <nl> return curr_frame_considered_obstacle_ids_ ; <nl> } <nl> <nl> - const absl : : Time & SubmoduleOutput : : frame_start_time ( ) const { <nl> + const apollo : : cyber : : Time & SubmoduleOutput : : frame_start_time ( ) const { <nl> return frame_start_time_ ; <nl> } <nl> <nl> mmm a / modules / prediction / submodules / submodule_output . h <nl> ppp b / modules / prediction / submodules / submodule_output . h <nl> <nl> <nl> # include < vector > <nl> <nl> - # include " absl / time / time . h " <nl> + # include " cyber / time / time . h " <nl> <nl> # include " modules / common / util / lru_cache . h " <nl> # include " modules / perception / proto / perception_obstacle . pb . h " <nl> class SubmoduleOutput { <nl> void set_curr_frame_considered_obstacle_ids ( <nl> const std : : vector < int > & curr_frame_considered_obstacle_ids ) ; <nl> <nl> - void set_frame_start_time ( const absl : : Time & frame_start_time ) ; <nl> + void set_frame_start_time ( const apollo : : cyber : : Time & frame_start_time ) ; <nl> <nl> void set_curr_scenario ( const Scenario & scenario ) ; <nl> <nl> class SubmoduleOutput { <nl> <nl> std : : vector < int > curr_frame_considered_obstacle_ids ( ) const ; <nl> <nl> - const absl : : Time & frame_start_time ( ) const ; <nl> + const apollo : : cyber : : Time & frame_start_time ( ) const ; <nl> <nl> const Scenario & curr_scenario ( ) const { return curr_scenario_ ; } <nl> <nl> class SubmoduleOutput { <nl> std : : vector < int > curr_frame_movable_obstacle_ids_ ; <nl> std : : vector < int > curr_frame_unmovable_obstacle_ids_ ; <nl> std : : vector < int > curr_frame_considered_obstacle_ids_ ; <nl> - absl : : Time frame_start_time_ ; <nl> + apollo : : cyber : : Time frame_start_time_ ; <nl> Scenario curr_scenario_ ; <nl> } ; <nl> <nl>
|
prediction : mock time support
|
ApolloAuto/apollo
|
103b93019c94202175b3a1250cae6e1dc61103ab
|
2020-08-10T18:08:18Z
|
mmm a / src / flag - definitions . h <nl> ppp b / src / flag - definitions . h <nl> DEFINE_bool ( pretenuring , true , " allocate objects in old space " ) <nl> / / TODO ( hpayer ) : We will remove this flag as soon as we have pretenuring <nl> / / support for specific allocation sites . <nl> DEFINE_bool ( pretenuring_call_new , false , " pretenure call new " ) <nl> - DEFINE_bool ( allocation_site_pretenuring , false , <nl> + DEFINE_bool ( allocation_site_pretenuring , true , <nl> " pretenure with allocation sites " ) <nl> DEFINE_bool ( trace_pretenuring , false , <nl> " trace pretenuring decisions of HAllocate instructions " ) <nl> mmm a / src / objects . cc <nl> ppp b / src / objects . cc <nl> void AllocationSite : : AddDependentCompilationInfo ( Handle < AllocationSite > site , <nl> Handle < DependentCode > codes = <nl> DependentCode : : Insert ( dep , group , info - > object_wrapper ( ) ) ; <nl> if ( * codes ! = site - > dependent_code ( ) ) site - > set_dependent_code ( * codes ) ; <nl> - info - > dependencies ( group ) - > Add ( Handle < HeapObject > ( site ) , info - > zone ( ) ) ; <nl> + info - > dependencies ( group ) - > Add ( Handle < HeapObject > ( * site ) , info - > zone ( ) ) ; <nl> } <nl> <nl> <nl> mmm a / test / cctest / test - heap . cc <nl> ppp b / test / cctest / test - heap . cc <nl> TEST ( OptimizedPretenuringAllocationFoldingBlocks ) { <nl> CcTest : : heap ( ) - > SetNewSpaceHighPromotionModeActive ( true ) ; <nl> <nl> v8 : : Local < v8 : : Value > res = CompileRun ( <nl> - " var number_elements = 3000 ; " <nl> + " var number_elements = 30000 ; " <nl> " var elements = new Array ( number_elements ) ; " <nl> " function DataObject ( ) { " <nl> " this . a = [ { } ] ; " <nl> TEST ( OptimizedPretenuringDoubleArrayProperties ) { <nl> v8 : : HandleScope scope ( CcTest : : isolate ( ) ) ; <nl> <nl> v8 : : Local < v8 : : Value > res = CompileRun ( <nl> - " var number_elements = 20000 ; " <nl> + " var number_elements = 30000 ; " <nl> " var elements = new Array ( number_elements ) ; " <nl> " function f ( ) { " <nl> " for ( var i = 0 ; i < number_elements ; i + + ) { " <nl> mmm a / test / mjsunit / elements - kind . js <nl> ppp b / test / mjsunit / elements - kind . js <nl> <nl> / / OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> <nl> / / Flags : - - allow - natives - syntax - - smi - only - arrays - - expose - gc <nl> - / / Flags : - - nostress - opt <nl> + / / Flags : - - nostress - opt - - nostress - compaction - - gc - interval = - 1 <nl> <nl> / / Test element kind of objects . <nl> / / Since - - smi - only - arrays affects builtins , its default setting at compile <nl>
|
Enable allocation site pretenuring .
|
v8/v8
|
dcf7f73ec02e00bb5883c8b16aebecfed4b9f69e
|
2014-01-13T17:11:36Z
|
mmm a / drivers / java / convert_tests . py <nl> ppp b / drivers / java / convert_tests . py <nl> <nl> - # ! / usr / bin / env python3 <nl> + # ! / usr / bin / env python3 . 4 <nl> # - * - coding : utf - 8 - * - <nl> ' ' ' Finds yaml tests , converts them to Java tests . ' ' ' <nl> from __future__ import print_function <nl> mmm a / drivers / java / src / test / java / com / rethinkdb / gen / MetaTable . java <nl> ppp b / drivers / java / src / test / java / com / rethinkdb / gen / MetaTable . java <nl> public void test ( ) throws Exception { <nl> } <nl> } <nl> <nl> - { <nl> - / / meta / table . yaml line # 251 <nl> - / * partial ( { ' ready ' : 1 } ) * / <nl> - Partial expected_ = partial ( r . hashMap ( " ready " , 1L ) ) ; <nl> - / * r . wait ( ) * / <nl> - logger . info ( " About to run line # 251 : r . wait_ ( ) " ) ; <nl> - Object obtained = runOrCatch ( r . wait_ ( ) , <nl> - new OptArgs ( ) <nl> - , conn ) ; <nl> - try { <nl> - assertEquals ( expected_ , obtained ) ; <nl> - logger . info ( " Finished running line # 251 " ) ; <nl> - } catch ( Throwable ae ) { <nl> - logger . error ( " Whoops , got exception on line # 251 : " + ae . toString ( ) ) ; <nl> - if ( obtained instanceof Throwable ) { <nl> - ae . addSuppressed ( ( Throwable ) obtained ) ; <nl> - } <nl> - throw ae ; <nl> - } <nl> - } <nl> - <nl> - { <nl> - / / meta / table . yaml line # 253 <nl> - / * partial ( { ' rebalanced ' : 1 } ) * / <nl> - Partial expected_ = partial ( r . hashMap ( " rebalanced " , 1L ) ) ; <nl> - / * r . rebalance ( ) * / <nl> - logger . info ( " About to run line # 253 : r . rebalance ( ) " ) ; <nl> - Object obtained = runOrCatch ( r . rebalance ( ) , <nl> - new OptArgs ( ) <nl> - , conn ) ; <nl> - try { <nl> - assertEquals ( expected_ , obtained ) ; <nl> - logger . info ( " Finished running line # 253 " ) ; <nl> - } catch ( Throwable ae ) { <nl> - logger . error ( " Whoops , got exception on line # 253 : " + ae . toString ( ) ) ; <nl> - if ( obtained instanceof Throwable ) { <nl> - ae . addSuppressed ( ( Throwable ) obtained ) ; <nl> - } <nl> - throw ae ; <nl> - } <nl> - } <nl> - <nl> { <nl> / / meta / table . yaml line # 256 <nl> / * partial ( { ' tables_dropped ' : 1 } ) * / <nl> public void test ( ) throws Exception { <nl> } <nl> } <nl> <nl> - { <nl> - / / meta / table . yaml line # 334 <nl> - / * partial ( { ' ready ' : 2 } ) * / <nl> - Partial expected_ = partial ( r . hashMap ( " ready " , 2L ) ) ; <nl> - / * r . wait ( wait_for = ' all_replicas_ready ' , timeout = 5 ) * / <nl> - logger . info ( " About to run line # 334 : r . wait_ ( ) . optArg ( ' wait_for ' , ' all_replicas_ready ' ) . optArg ( ' timeout ' , 5L ) " ) ; <nl> - Object obtained = runOrCatch ( r . wait_ ( ) . optArg ( " wait_for " , " all_replicas_ready " ) . optArg ( " timeout " , 5L ) , <nl> - new OptArgs ( ) <nl> - , conn ) ; <nl> - try { <nl> - assertEquals ( expected_ , obtained ) ; <nl> - logger . info ( " Finished running line # 334 " ) ; <nl> - } catch ( Throwable ae ) { <nl> - logger . error ( " Whoops , got exception on line # 334 : " + ae . toString ( ) ) ; <nl> - if ( obtained instanceof Throwable ) { <nl> - ae . addSuppressed ( ( Throwable ) obtained ) ; <nl> - } <nl> - throw ae ; <nl> - } <nl> - } <nl> - <nl> { <nl> / / meta / table . yaml line # 339 <nl> / * partial ( { ' tables_dropped ' : 1 } ) * / <nl> mmm a / drivers / java / term_info . json <nl> ppp b / drivers / java / term_info . json <nl> <nl> " WAIT " : { <nl> " side_effect " : true , <nl> " include_in " : [ <nl> - " T_TOP_LEVEL " , <nl> " T_DB " , <nl> " T_TABLE " <nl> ] , <nl> <nl> " RECONFIGURE " : { <nl> " side_effect " : true , <nl> " include_in " : [ <nl> - " T_TOP_LEVEL " , <nl> " T_DB " , <nl> " T_TABLE " <nl> ] , <nl> <nl> " REBALANCE " : { <nl> " side_effect " : true , <nl> " include_in " : [ <nl> - " T_TOP_LEVEL " , <nl> " T_DB " , <nl> " T_TABLE " <nl> ] , <nl> mmm a / drivers / javascript / ast . coffee <nl> ppp b / drivers / javascript / ast . coffee <nl> rethinkdb . tableCreate = aropt ( tblName , opts ) - > new TableCreate opts , tblName <nl> rethinkdb . tableDrop = ( args . . . ) - > new TableDrop { } , args . . . <nl> rethinkdb . tableList = ( args . . . ) - > new TableList { } , args . . . <nl> <nl> - rethinkdb . wait = aropt ( opts ) - > new Wait opts <nl> - rethinkdb . reconfigure = ( opts ) - > new Reconfigure opts <nl> - rethinkdb . rebalance = ( ) - > new Rebalance { } <nl> - <nl> rethinkdb . do = varar 1 , null , ( args . . . ) - > <nl> new FunCall { } , funcWrap ( args [ - 1 . . ] [ 0 ] ) , args [ . . . - 1 ] . . . <nl> <nl> mmm a / drivers / python / rethinkdb / query . py <nl> ppp b / drivers / python / rethinkdb / query . py <nl> <nl> ' literal ' , ' asc ' , ' desc ' , <nl> ' db ' , ' db_create ' , ' db_drop ' , ' db_list ' , <nl> ' table ' , ' table_create ' , ' table_drop ' , ' table_list ' , <nl> - ' wait ' , ' reconfigure ' , ' rebalance ' , <nl> ' group ' , ' reduce ' , ' count ' , ' sum ' , ' avg ' , ' min ' , ' max ' , ' distinct ' , <nl> ' contains ' , ' eq ' , ' ne ' , ' le ' , ' ge ' , ' lt ' , ' gt ' , ' and_ ' , ' or_ ' , ' not_ ' , <nl> ' add ' , ' sub ' , ' mul ' , ' div ' , ' mod ' , ' floor ' , ' ceil ' , ' round ' , <nl> def table_drop ( * args ) : <nl> def table_list ( * args ) : <nl> return ast . TableListTL ( * args ) <nl> <nl> - <nl> - def wait ( * args , * * kwargs ) : <nl> - return ast . WaitTL ( * args , * * kwargs ) <nl> - <nl> - <nl> - def reconfigure ( * args , * * kwargs ) : <nl> - return ast . ReconfigureTL ( * args , * * kwargs ) <nl> - <nl> - <nl> - def rebalance ( * args , * * kwargs ) : <nl> - return ast . RebalanceTL ( * args , * * kwargs ) <nl> - <nl> - <nl> def branch ( * args ) : <nl> return ast . Branch ( * args ) <nl> <nl> mmm a / src / rdb_protocol / terms / db_table . cc <nl> ppp b / src / rdb_protocol / terms / db_table . cc <nl> void get_replicas_and_primary ( const scoped_ptr_t < val_t > & replicas , <nl> } <nl> } <nl> <nl> - / / Meta operations ( BUT NOT TABLE TERMS ) should inherit from this . <nl> + / / Meta operations ( BUT NOT TABLE TERMS ) should inherit from this . <nl> class meta_op_term_t : public op_term_t { <nl> public : <nl> meta_op_term_t ( compile_env_t * env , const raw_term_t & term , <nl> class wait_term_t : public table_or_db_meta_term_t { <nl> scope_env_t * env , args_t * args , eval_flags_t , <nl> const counted_t < const ql : : db_t > & db , <nl> const boost : : optional < name_string_t > & name_if_table ) const { <nl> - / / Handle ' wait_for ' optarg <nl> + / / Don ' t allow a wait call without explicit database <nl> + if ( args - > num_args ( ) = = 0 ) { <nl> + rfail ( base_exc_t : : LOGIC , " ` wait ` can only be called on a table or database . " ) ; <nl> + } <nl> + <nl> + / / Handle ' wait_for ' optarg <nl> table_readiness_t readiness = table_readiness_t : : finished ; <nl> if ( scoped_ptr_t < val_t > wait_for = args - > optarg ( env , " wait_for " ) ) { <nl> if ( wait_for - > as_str ( ) = = wait_outdated_str ) { <nl> class reconfigure_term_t : public table_or_db_meta_term_t { <nl> scope_env_t * env , args_t * args , eval_flags_t , <nl> const counted_t < const ql : : db_t > & db , <nl> const boost : : optional < name_string_t > & name_if_table ) const { <nl> + / / Don ' t allow a reconfigure call without explicit database <nl> + if ( args - > num_args ( ) = = 0 ) { <nl> + rfail ( base_exc_t : : LOGIC , " ` reconfigure ` can only be called on a table or database . " ) ; <nl> + } <nl> <nl> / / Parse the ' dry_run ' optarg <nl> bool dry_run = false ; <nl> class rebalance_term_t : public table_or_db_meta_term_t { <nl> : table_or_db_meta_term_t ( env , term , optargspec_t ( { } ) ) { } <nl> private : <nl> virtual scoped_ptr_t < val_t > eval_impl_on_table_or_db ( <nl> - scope_env_t * env , UNUSED args_t * args , eval_flags_t , <nl> + scope_env_t * env , args_t * args , eval_flags_t , <nl> const counted_t < const ql : : db_t > & db , <nl> const boost : : optional < name_string_t > & name_if_table ) const { <nl> + / / Don ' t allow a rebalance call without explicit database <nl> + if ( args - > num_args ( ) = = 0 ) { <nl> + rfail ( base_exc_t : : LOGIC , " ` rebalance ` can only be called on a table or database . " ) ; <nl> + } <nl> + <nl> ql : : datum_t result ; <nl> bool success ; <nl> admin_err_t error ; <nl> mmm a / test / rql_test / connections / tt . mocha <nl> ppp b / test / rql_test / connections / tt . mocha <nl> var ttToExampleTerm = { <nl> TABLE_LIST : r . tableList ( ) , <nl> CONFIG : r ( [ ] ) . config ( ) , <nl> STATUS : r ( [ ] ) . status ( ) , <nl> - WAIT : r . wait ( ) , <nl> - RECONFIGURE : r . reconfigure ( ) , <nl> - REBALANCE : r . rebalance ( ) , <nl> SYNC : r ( [ ] ) . sync ( ) , <nl> INDEX_CREATE : r ( [ ] ) . indexCreate ( ' ' ) , <nl> INDEX_DROP : r ( [ ] ) . indexDrop ( ' ' ) , <nl> mmm a / test / rql_test / drivers / driver . js <nl> ppp b / test / rql_test / drivers / driver . js <nl> function err_predicate ( err_name , err_pred , err_frames , desc ) { <nl> err_class = err_name <nl> } else if ( r . Error [ err_name ] ) { <nl> err_class = r . Error [ err_name ] <nl> + } else if ( typeof ( err_name ) = = = ' string ' ) { <nl> + / / try it as a generic error <nl> + try { <nl> + if ( eval ( err_name ) . prototype instanceof Error ) { <nl> + err_class = eval ( err_name ) <nl> + } <nl> + } catch ( e ) { } <nl> } <nl> + <nl> assert ( err_class . prototype instanceof Error , ' err_name must be the name of an error class ' ) ; <nl> <nl> var fun = function err_predicate_return ( other ) { <nl> mmm a / test / rql_test / src / meta / table . yaml <nl> ppp b / test / rql_test / src / meta / table . yaml <nl> tests : <nl> ot : partial ( { ' rebalanced ' : 1 } ) <nl> <nl> - cd : r . wait ( ) <nl> - ot : partial ( { ' ready ' : 1 } ) <nl> + ot : <nl> + py : err ( ' AttributeError ' , " ' module ' object has no attribute ' wait ' " , [ ] ) <nl> + js : err ( ' TypeError ' , " Object function ( ) { \ n var args ; \ n args = 1 < = arguments . length ? slice . call ( arguments , 0 ) : [ ] ; \ n return rethinkdb . expr . apply ( rethinkdb , args ) ; \ n } has no method ' wait ' " ) <nl> + rb : err ( ' ReqlQueryLogicError ' , ' ` wait ` can only be called on a table or database . ' , [ ] ) <nl> - cd : r . rebalance ( ) <nl> - ot : partial ( { ' rebalanced ' : 1 } ) <nl> + ot : <nl> + py : err ( ' AttributeError ' , " ' module ' object has no attribute ' rebalance ' " , [ ] ) <nl> + js : err ( ' TypeError ' , " Object function ( ) { \ n var args ; \ n args = 1 < = arguments . length ? slice . call ( arguments , 0 ) : [ ] ; \ n return rethinkdb . expr . apply ( rethinkdb , args ) ; \ n } has no method ' rebalance ' " ) <nl> + rb : err ( ' ReqlQueryLogicError ' , ' ` rebalance ` can only be called on a table or database . ' , [ ] ) <nl> <nl> - cd : db . table_drop ( ' a ' ) <nl> ot : partial ( { ' tables_dropped ' : 1 } ) <nl> tests : <nl> - py : r . wait ( wait_for = ' all_replicas_ready ' , timeout = 5 ) <nl> js : r . wait ( { waitFor : ' all_replicas_ready ' , timeout : 5 } ) <nl> rb : r . wait ( : wait_for = > ' all_replicas_ready ' , : timeout = > 5 ) <nl> - ot : partial ( { ' ready ' : 2 } ) <nl> + ot : <nl> + py : err ( ' AttributeError ' , " ' module ' object has no attribute ' wait ' " , [ ] ) <nl> + js : err ( ' TypeError ' , " Object function ( ) { \ n var args ; \ n args = 1 < = arguments . length ? slice . call ( arguments , 0 ) : [ ] ; \ n return rethinkdb . expr . apply ( rethinkdb , args ) ; \ n } has no method ' wait ' " ) <nl> + rb : err ( ' ReqlQueryLogicError ' , ' ` wait ` can only be called on a table or database . ' , [ ] ) <nl> <nl> - cd : db . table_drop ( ' testA ' ) <nl> ot : partial ( { ' tables_dropped ' : 1 } ) <nl> mmm a / test / rql_test / test - runner <nl> ppp b / test / rql_test / test - runner <nl> class WorkerThread ( threading . Thread ) : <nl> <nl> if self . existingServer is None : <nl> r . db ( ' rethinkdb ' ) . table ( ' server_config ' ) . filter ( r . row [ ' id ' ] ! = self . server . uuid ) . delete ( ) . run ( self . reqlConnection ) <nl> - r . wait ( ) . run ( self . reqlConnection ) <nl> + r . db ( ' test ' ) . wait ( ) . run ( self . reqlConnection ) <nl> <nl> except Exception as e : <nl> if self . existingServer : <nl> mmm a / test / scenarios / restart . py <nl> ppp b / test / scenarios / restart . py <nl> def test_workload ( self ) : <nl> server . check_and_stop ( ) <nl> server . start ( ) <nl> self . cluster . check ( ) <nl> - self . r . wait ( ) . run ( self . conn ) <nl> + self . r . db ( self . dbName ) . wait ( ) . run ( self . conn ) <nl> <nl> utils . print_with_time ( " Running second workload " ) <nl> workload_runner . run ( opts [ " workload2 " ] , server , opts [ " timeout " ] , db_name = self . dbName , table_name = self . tableName ) <nl>
|
Disallow wait , rebalance , and reconfigure without explicit db or table arg for
|
rethinkdb/rethinkdb
|
37014e97b657657b1b7d47b733456b6459ace6e4
|
2016-01-27T00:05:11Z
|
mmm a / tests / js - tests / src / Particle3DTest / Particle3DTest . js <nl> ppp b / tests / js - tests / src / Particle3DTest / Particle3DTest . js <nl> if ( cc . sys . isNative ) ( function ( ) { <nl> <nl> var Particle3DTestIdx = - 1 ; <nl> <nl> - const PARTICLE_SYSTEM_TAG = 0x0001 ; <nl> + var PARTICLE_SYSTEM_TAG = 0x0001 ; <nl> <nl> jsb . fileUtils . addSearchPath ( " res / Sprite3DTest " ) ; <nl> jsb . fileUtils . addSearchPath ( " res / Particle3D / materials " ) ; <nl> mmm a / tests / js - tests / src / Physics3DTest / Physics3DTest . js <nl> ppp b / tests / js - tests / src / Physics3DTest / Physics3DTest . js <nl> var Physics3DTestIdx = - 1 ; <nl> <nl> var physicsScene = null ; <nl> <nl> - const START_POS_X = - 0 . 5 ; <nl> - const START_POS_Y = - 2 . 5 ; <nl> - const START_POS_Z = - 0 . 5 ; <nl> + var START_POS_X = - 0 . 5 ; <nl> + var START_POS_Y = - 2 . 5 ; <nl> + var START_POS_Z = - 0 . 5 ; <nl> <nl> - const ARRAY_SIZE_X = 4 ; <nl> - const ARRAY_SIZE_Y = 3 ; <nl> - const ARRAY_SIZE_Z = 4 ; <nl> + var ARRAY_SIZE_X = 4 ; <nl> + var ARRAY_SIZE_Y = 3 ; <nl> + var ARRAY_SIZE_Z = 4 ; <nl> <nl> var Physics3DTestDemo = cc . Layer . extend ( { <nl> _title : " Physics3D Test " , <nl> mmm a / tests / js - tests / src / TerrainTest / TerrainTest . js <nl> ppp b / tests / js - tests / src / TerrainTest / TerrainTest . js <nl> var TerrainSimple = TerrainTestDemo . extend ( { <nl> } ) ; <nl> <nl> var TerrainWalkThru = ( function ( ) { <nl> - const PlayerState = { <nl> + var PlayerState = { <nl> LEFT : 0 , <nl> RIGHT : 1 , <nl> IDLE : 2 , <nl> var TerrainWalkThru = ( function ( ) { <nl> BACKWARD : 4 <nl> } ; <nl> <nl> - const PLAYER_HEIGHT = 0 ; <nl> - const camera_offset = cc . math . vec3 ( 0 , 45 , 60 ) ; <nl> + var PLAYER_HEIGHT = 0 ; <nl> + var camera_offset = cc . math . vec3 ( 0 , 45 , 60 ) ; <nl> <nl> var Player = jsb . Sprite3D . extend ( { <nl> _targetPos : null , <nl>
|
[ JS ] Revert const to var to avoid issues on web compilation
|
cocos2d/cocos2d-x
|
c260783fd0ee0b1143b1602f069579af524cba5d
|
2015-07-21T10:23:57Z
|
mmm a / Code / Sandbox / EditorQt / Objects / SplineObject . cpp <nl> ppp b / Code / Sandbox / EditorQt / Objects / SplineObject . cpp <nl> <nl> <nl> # include " StdAfx . h " <nl> # include " SplineObject . h " <nl> - # include " SelectionGroup . h " <nl> + <nl> + # include " Objects / SelectionGroup . h " <nl> # include " IEditorImpl . h " <nl> <nl> # include < Controls / DynamicPopupMenu . h > <nl> + # include < Gizmos / IGizmoManager . h > <nl> # include < Objects / ObjectLoader . h > <nl> # include < Objects / InspectorWidgetCreator . h > <nl> - # include < Gizmos / IGizmoManager . h > <nl> # include < Preferences / SnappingPreferences . h > <nl> # include < Serialization / Decorators / EditToolButton . h > <nl> + # include < Util / Math . h > <nl> + # include < Util / Variable . h > <nl> + # include < IObjectManager . h > <nl> # include < Viewport . h > <nl> <nl> - # include < IObjectManager . h > <nl> # include < Util / MFCUtil . h > <nl> - # include < Util / Math . h > <nl> - # include < Util / Variable . h > <nl> + <nl> + # include < CryPhysics / physinterface . h > <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / CEditSplineObjectTool <nl> class CEditSplineObjectTool : public CEditTool , public ITransformManipulatorOwne <nl> <nl> / / Overrides from CEditTool <nl> virtual string GetDisplayName ( ) const override { return " Edit Spline " ; } <nl> - bool MouseCallback ( CViewport * view , EMouseEvent event , CPoint & point , int flags ) ; <nl> - void OnManipulatorDrag ( IDisplayViewport * pView , ITransformManipulator * pManipulator , const Vec2i & point0 , const Vec3 & value , int flags ) ; <nl> - void OnManipulatorBegin ( IDisplayViewport * view , ITransformManipulator * pManipulator , const Vec2i & point , int flags ) ; <nl> - void OnManipulatorEnd ( IDisplayViewport * view , ITransformManipulator * pManipulator ) ; <nl> - <nl> - virtual void SetUserData ( const char * key , void * userData ) ; <nl> - <nl> - virtual void Display ( SDisplayContext & dc ) { } <nl> + virtual bool MouseCallback ( CViewport * view , EMouseEvent event , CPoint & point , int flags ) override ; <nl> + virtual void SetUserData ( const char * key , void * userData ) override ; <nl> + virtual void Display ( SDisplayContext & dc ) override { } <nl> virtual bool OnKeyDown ( CViewport * view , uint32 nChar , uint32 nRepCnt , uint32 nFlags ) ; <nl> - <nl> - bool IsNeedMoveTool ( ) override { return true ; } <nl> - <nl> - void OnSplineEvent ( const CBaseObject * pObject , const CObjectEvent & event ) ; <nl> + virtual bool IsNeedMoveTool ( ) override { return true ; } <nl> <nl> / / ITransformManipulatorOwner <nl> virtual void GetManipulatorPosition ( Vec3 & position ) override ; <nl> virtual bool IsManipulatorVisible ( ) override ; <nl> <nl> - protected : <nl> + void OnManipulatorDrag ( IDisplayViewport * pView , ITransformManipulator * pManipulator , const Vec2i & point0 , const Vec3 & value , int flags ) ; <nl> + void OnManipulatorBegin ( IDisplayViewport * view , ITransformManipulator * pManipulator , const Vec2i & point , int flags ) ; <nl> + void OnManipulatorEnd ( IDisplayViewport * view , ITransformManipulator * pManipulator ) ; <nl> + void OnSplineEvent ( const CBaseObject * pObject , const CObjectEvent & event ) ; <nl> + <nl> + private : <nl> virtual ~ CEditSplineObjectTool ( ) ; <nl> void DeleteThis ( ) { delete this ; } <nl> <nl> void SelectPoint ( int index ) ; <nl> void SetCursor ( EStdCursor cursor , bool bForce = false ) ; <nl> + bool HandleSelectedPointMove ( CViewport * pView , CPoint & point ) ; <nl> <nl> private : <nl> CSplineObject * m_pSpline ; <nl> bool CEditSplineObjectTool : : MouseCallback ( CViewport * view , EMouseEvent event , CP <nl> if ( ! m_pSpline ) <nl> return false ; <nl> <nl> + if ( ( event = = eMouseLDown ) & & ( flags & MK_CONTROL ) & & ( flags & MK_SHIFT ) ) <nl> + { <nl> + return HandleSelectedPointMove ( view , point ) ; <nl> + } <nl> + <nl> if ( event = = eMouseLDown ) <nl> { <nl> m_mouseDownPos = point ; <nl> bool CEditSplineObjectTool : : MouseCallback ( CViewport * view , EMouseEvent event , CP <nl> <nl> if ( event = = eMouseLDown | | event = = eMouseMove | | event = = eMouseLDblClick | | event = = eMouseLUp ) <nl> { <nl> - <nl> const Matrix34 & splineTM = m_pSpline - > GetWorldTM ( ) ; <nl> <nl> Vec3 raySrc , rayDir ; <nl> bool CEditSplineObjectTool : : MouseCallback ( CViewport * view , EMouseEvent event , CP <nl> { <nl> SelectPoint ( index ) ; <nl> <nl> - / / Set construction plance for view . <nl> + / / Set construction plane for view <nl> m_pointPos = splineTM . TransformPoint ( m_pSpline - > GetPoint ( index ) ) ; <nl> Matrix34 tm ; <nl> tm . SetIdentity ( ) ; <nl> void CEditSplineObjectTool : : SetCursor ( EStdCursor cursor , bool bForce ) <nl> } <nl> } <nl> <nl> + bool CEditSplineObjectTool : : HandleSelectedPointMove ( CViewport * pView , CPoint & point ) <nl> + { <nl> + CRY_ASSERT ( m_pSpline ) ; <nl> + <nl> + const int pointIndex = m_pSpline - > GetSelectedPoint ( ) ; <nl> + if ( pointIndex = = - 1 ) <nl> + { <nl> + return false ; <nl> + } <nl> + <nl> + Vec3 raySrc , rayDir ; <nl> + pView - > ViewToWorldRay ( point , raySrc , rayDir ) ; <nl> + <nl> + IPhysicalWorld * pWorld = GetIEditor ( ) - > GetSystem ( ) - > GetIPhysicalWorld ( ) ; <nl> + CRY_ASSERT ( pWorld ) ; <nl> + <nl> + ray_hit hit { } ; <nl> + int col = pWorld - > RayWorldIntersection ( raySrc , rayDir * 1000 . 0f , ent_all , 0 , & hit , 1 ) ; <nl> + if ( col = = 0 ) <nl> + { <nl> + return false ; <nl> + } <nl> + <nl> + CUndo undo ( " Spline Move Point " ) ; <nl> + m_pSpline - > StoreUndo ( " Move Point " ) ; <nl> + <nl> + m_pSpline - > SetPoint ( pointIndex , hit . pt - m_pSpline - > GetWorldPos ( ) ) ; <nl> + <nl> + return true ; <nl> + } <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / CSplitSplineObjectTool <nl> class CSplitSplineObjectTool : public CEditTool <nl>
|
! F ( Sandbox ) ( DEV - 6994 ) As a User , I want to be able to snap Spline points to terrain and objects
|
CRYTEK/CRYENGINE
|
9046fb65347cb7bdb7fe7271a41b0a6230493782
|
2018-12-07T16:40:24Z
|
mmm a / folly / portability / GMock . h <nl> ppp b / folly / portability / GMock . h <nl> <nl> # include < folly / portability / Unistd . h > <nl> # include < folly / portability / Windows . h > <nl> <nl> + # include < folly / Portability . h > <nl> + <nl> + / / Disable a couple of warnings due to GMock exporting classes <nl> + / / that derive from stdlib classes which aren ' t explicitly exported . <nl> + FOLLY_PUSH_WARNING <nl> + FOLLY_MSVC_DISABLE_WARNING ( 4251 ) <nl> + FOLLY_MSVC_DISABLE_WARNING ( 4275 ) <nl> # include < gmock / gmock . h > <nl> + FOLLY_POP_WARNING <nl> mmm a / folly / portability / GTest . h <nl> ppp b / folly / portability / GTest . h <nl> <nl> # include < folly / portability / Unistd . h > <nl> # include < folly / portability / Windows . h > <nl> <nl> + # include < folly / Portability . h > <nl> + <nl> + / / Disable a couple of warnings due to GTest exporting classes <nl> + / / that derive from stdlib classes which aren ' t explicitly exported . <nl> + FOLLY_PUSH_WARNING <nl> + FOLLY_MSVC_DISABLE_WARNING ( 4251 ) <nl> + FOLLY_MSVC_DISABLE_WARNING ( 4275 ) <nl> # include < gtest / gtest . h > <nl> + FOLLY_POP_WARNING <nl>
|
Disable a couple of warnings generated by the GTest and GMock headers
|
facebook/folly
|
1dcc41cf51197f9497b5e24f2f310a39649f3132
|
2016-11-09T23:23:36Z
|
mmm a / MachineLearning / cn / SimpleNetworkBuilder . cpp <nl> ppp b / MachineLearning / cn / SimpleNetworkBuilder . cpp <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> return ( ComputationNode < ElemType > * ) output ; <nl> } <nl> <nl> + / * * <nl> + This is encoder LSTM described in the following papers : <nl> + H . Sutskever , O . Vinyals and Q . V . Le , " Sequence to sequence learning with neural networks " , http : / / arxiv . org / abs / 1409 . 3215 <nl> + <nl> + The following code constructs the encoder and , to construct decoder , use BuildLSTMNetworkFromDescription <nl> + <nl> + Developed by Kaisheng Yao <nl> + This is used in the following works : <nl> + K . Yao , G . Zweig , " Sequence - to - sequence neural net models for grapheme - to - phoneme conversion , submitted to Interspeech 2015 <nl> + * / <nl> template < class ElemType > <nl> ComputationNetwork < ElemType > & SimpleNetworkBuilder < ElemType > : : BuildLSTMEncoderNetworkFromDescription ( size_t mbSize ) <nl> { <nl>
|
Update the description of the encoder LSTM network builder
|
microsoft/CNTK
|
0916e2b9275466702b21512586aeed6de6558c61
|
2015-03-31T18:33:55Z
|
mmm a / Telegram / SourceFiles / boxes / peer_list_box . cpp <nl> ppp b / Telegram / SourceFiles / boxes / peer_list_box . cpp <nl> bool PeerListRow : : checked ( ) const { <nl> return _checkbox & & _checkbox - > checked ( ) ; <nl> } <nl> <nl> - void PeerListRow : : setCustomStatus ( const QString & status ) { <nl> + void PeerListRow : : setCustomStatus ( const QString & status , bool active ) { <nl> setStatusText ( status ) ; <nl> - _statusType = StatusType : : Custom ; <nl> + _statusType = active ? StatusType : : CustomActive : StatusType : : Custom ; <nl> _statusValidTill = 0 ; <nl> } <nl> <nl> void PeerListRow : : clearCustomStatus ( ) { <nl> } <nl> <nl> void PeerListRow : : refreshStatus ( ) { <nl> - if ( ! _initialized | | special ( ) | | _statusType = = StatusType : : Custom ) { <nl> + if ( ! _initialized <nl> + | | special ( ) <nl> + | | _statusType = = StatusType : : Custom <nl> + | | _statusType = = StatusType : : CustomActive ) { <nl> return ; <nl> } <nl> _statusType = StatusType : : LastSeen ; <nl> void PeerListRow : : paintStatusText ( <nl> int availableWidth , <nl> int outerWidth , <nl> bool selected ) { <nl> - auto statusHasOnlineColor = ( _statusType = = PeerListRow : : StatusType : : Online ) ; <nl> + auto statusHasOnlineColor = ( _statusType = = PeerListRow : : StatusType : : Online ) <nl> + | | ( _statusType = = PeerListRow : : StatusType : : CustomActive ) ; <nl> p . setFont ( st : : contactsStatusFont ) ; <nl> p . setPen ( statusHasOnlineColor ? st . statusFgActive : ( selected ? st . statusFgOver : st . statusFg ) ) ; <nl> _status . drawLeftElided ( p , x , y , availableWidth , outerWidth ) ; <nl> mmm a / Telegram / SourceFiles / boxes / peer_list_box . h <nl> ppp b / Telegram / SourceFiles / boxes / peer_list_box . h <nl> class PeerListRow { <nl> [ [ nodiscard ] ] virtual auto generatePaintUserpicCallback ( ) <nl> - > PaintRoundImageCallback ; <nl> <nl> - void setCustomStatus ( const QString & status ) ; <nl> + void setCustomStatus ( const QString & status , bool active = false ) ; <nl> void clearCustomStatus ( ) ; <nl> <nl> / / Box interface . <nl> class PeerListRow { <nl> Online , <nl> LastSeen , <nl> Custom , <nl> + CustomActive , <nl> } ; <nl> virtual void refreshStatus ( ) ; <nl> crl : : time refreshStatusTime ( ) const ; <nl> mmm a / Telegram / SourceFiles / calls / calls_group_call . cpp <nl> ppp b / Telegram / SourceFiles / calls / calls_group_call . cpp <nl> For license and copyright information please follow this link : <nl> # include " apiwrap . h " <nl> # include " lang / lang_keys . h " <nl> # include " boxes / confirm_box . h " <nl> + # include " base / unixtime . h " <nl> # include " core / application . h " <nl> # include " core / core_settings . h " <nl> # include " data / data_changes . h " <nl> void GroupCall : : start ( ) { <nl> <nl> void GroupCall : : join ( const MTPInputGroupCall & inputCall ) { <nl> setState ( State : : Joining ) ; <nl> + _channel - > setCall ( inputCall ) ; <nl> + <nl> inputCall . match ( [ & ] ( const MTPDinputGroupCall & data ) { <nl> _id = data . vid ( ) . v ; <nl> _accessHash = data . vaccess_hash ( ) . v ; <nl> createAndStartController ( ) ; <nl> rejoin ( ) ; <nl> } ) ; <nl> - _channel - > setCall ( inputCall ) ; <nl> <nl> - _channel - > session ( ) . changes ( ) . peerFlagsValue ( <nl> - _channel , <nl> - Data : : PeerUpdate : : Flag : : GroupCall <nl> - ) | rpl : : start_with_next ( [ = ] { <nl> - checkParticipants ( ) ; <nl> + using Update = Data : : GroupCall : : ParticipantUpdate ; <nl> + _channel - > call ( ) - > participantUpdated ( <nl> + ) | rpl : : filter ( [ = ] ( const Update & update ) { <nl> + return ( _instance ! = nullptr ) & & update . removed ; <nl> + } ) | rpl : : start_with_next ( [ = ] ( const Update & update ) { <nl> + _instance - > removeSsrcs ( { update . participant . source } ) ; <nl> } , _lifetime ) ; <nl> } <nl> <nl> void GroupCall : : rejoin ( ) { <nl> Expects ( _state . current ( ) = = State : : Joining ) ; <nl> <nl> _mySsrc = 0 ; <nl> + applySelfInCallLocally ( ) ; <nl> + LOG ( ( " Call Info : Requesting join payload . " ) ) ; <nl> + <nl> const auto weak = base : : make_weak ( this ) ; <nl> _instance - > emitJoinPayload ( [ = ] ( tgcalls : : GroupJoinPayload payload ) { <nl> crl : : on_main ( weak , [ = , payload = std : : move ( payload ) ] { <nl> void GroupCall : : rejoin ( ) { <nl> root . insert ( " fingerprints " , fingerprints ) ; <nl> root . insert ( " ssrc " , double ( payload . ssrc ) ) ; <nl> <nl> + LOG ( ( " Call Info : Join payload received , joining with source : % 1 . " <nl> + ) . arg ( ssrc ) ) ; <nl> + <nl> const auto json = QJsonDocument ( root ) . toJson ( <nl> QJsonDocument : : Compact ) ; <nl> const auto muted = _muted . current ( ) ; <nl> void GroupCall : : rejoin ( ) { <nl> ) ) . done ( [ = ] ( const MTPUpdates & updates ) { <nl> _mySsrc = ssrc ; <nl> setState ( State : : Joined ) ; <nl> + applySelfInCallLocally ( ) ; <nl> <nl> if ( _muted . current ( ) ! = muted ) { <nl> sendMutedUpdate ( ) ; <nl> void GroupCall : : rejoin ( ) { <nl> } ) ; <nl> } <nl> <nl> - void GroupCall : : checkParticipants ( ) { <nl> - if ( ! joined ( ) ) { <nl> - return ; <nl> - } <nl> + void GroupCall : : applySelfInCallLocally ( ) { <nl> const auto call = _channel - > call ( ) ; <nl> if ( ! call | | call - > id ( ) ! = _id ) { <nl> - finish ( FinishType : : Ended ) ; <nl> - return ; <nl> - } <nl> - const auto & sources = call - > sources ( ) ; <nl> - if ( sources . size ( ) ! = call - > fullCount ( ) | | sources . empty ( ) ) { <nl> - call - > reload ( ) ; <nl> return ; <nl> } <nl> - auto ssrcs = std : : vector < uint32_t > ( ) ; <nl> - ssrcs . reserve ( sources . size ( ) ) ; <nl> - for ( const auto source : sources ) { <nl> - if ( source ! = _mySsrc ) { <nl> - ssrcs . push_back ( source ) ; <nl> - } <nl> - } <nl> - / / _instance - > setSsrcs ( std : : move ( ssrcs ) ) ; <nl> + const auto my = [ & ] { <nl> + const auto self = _channel - > session ( ) . userId ( ) ; <nl> + const auto now = base : : unixtime : : now ( ) ; <nl> + using Flag = MTPDgroupCallParticipant : : Flag ; <nl> + return MTP_groupCallParticipant ( <nl> + MTP_flags ( ( _mySsrc ? Flag ( 0 ) : Flag : : f_left ) <nl> + | ( _muted . current ( ) ? Flag : : f_muted : Flag ( 0 ) ) ) , <nl> + MTP_int ( self ) , <nl> + MTP_int ( now ) , <nl> + MTP_int ( 0 ) , <nl> + MTP_int ( _mySsrc ) ) ; <nl> + } ; <nl> + call - > applyUpdateChecked ( <nl> + MTP_updateGroupCallParticipants ( <nl> + inputCall ( ) , <nl> + MTP_vector < MTPGroupCallParticipant > ( 1 , my ( ) ) , <nl> + MTP_int ( 0 ) ) . c_updateGroupCallParticipants ( ) ) ; <nl> } <nl> <nl> void GroupCall : : hangup ( ) { <nl> void GroupCall : : handleUpdate ( const MTPGroupCall & call ) { <nl> } ) ; <nl> } <nl> _instance - > setJoinResponsePayload ( payload ) ; <nl> - checkParticipants ( ) ; <nl> } ) ; <nl> } <nl> } , [ & ] ( const MTPDgroupCallDiscarded & data ) { <nl> mmm a / Telegram / SourceFiles / calls / calls_group_call . h <nl> ppp b / Telegram / SourceFiles / calls / calls_group_call . h <nl> class GroupCall final : public base : : has_weak_ptr { <nl> const MTPInputGroupCall & inputCall ) ; <nl> ~ GroupCall ( ) ; <nl> <nl> + [ [ nodiscard ] ] uint64 id ( ) const { <nl> + return _id ; <nl> + } <nl> [ [ nodiscard ] ] not_null < ChannelData * > channel ( ) const { <nl> return _channel ; <nl> } <nl> class GroupCall final : public base : : has_weak_ptr { <nl> void handleControllerError ( const QString & error ) ; <nl> void createAndStartController ( ) ; <nl> void destroyController ( ) ; <nl> - void checkParticipants ( ) ; <nl> <nl> void setState ( State state ) ; <nl> void finish ( FinishType type ) ; <nl> void sendMutedUpdate ( ) ; <nl> + void applySelfInCallLocally ( ) ; <nl> void rejoin ( ) ; <nl> <nl> [ [ nodiscard ] ] MTPInputGroupCall inputCall ( ) const ; <nl> mmm a / Telegram / SourceFiles / calls / calls_group_members . cpp <nl> ppp b / Telegram / SourceFiles / calls / calls_group_members . cpp <nl> For license and copyright information please follow this link : <nl> namespace Calls { <nl> namespace { <nl> <nl> - class MembersController final <nl> - : public PeerListController <nl> - , public base : : has_weak_ptr { <nl> - public : <nl> - explicit MembersController ( not_null < GroupCall * > call ) ; <nl> - <nl> - Main : : Session & session ( ) const override ; <nl> - void prepare ( ) override ; <nl> - void rowClicked ( not_null < PeerListRow * > row ) override ; <nl> - void rowActionClicked ( not_null < PeerListRow * > row ) override ; <nl> - base : : unique_qptr < Ui : : PopupMenu > rowContextMenu ( <nl> - QWidget * parent , <nl> - not_null < PeerListRow * > row ) override ; <nl> - void loadMoreRows ( ) override ; <nl> - <nl> - private : <nl> - [ [ nodiscard ] ] std : : unique_ptr < PeerListRow > createRow ( <nl> - not_null < UserData * > user ) const ; <nl> - <nl> - void prepareRows ( ) ; <nl> - <nl> - void setupListChangeViewers ( ) ; <nl> - bool appendRow ( not_null < UserData * > user ) ; <nl> - bool prependRow ( not_null < UserData * > user ) ; <nl> - bool removeRow ( not_null < UserData * > user ) ; <nl> - <nl> - const base : : weak_ptr < GroupCall > _call ; <nl> - const not_null < ChannelData * > _channel ; <nl> - <nl> - Ui : : BoxPointer _addBox ; <nl> - rpl : : lifetime _lifetime ; <nl> - <nl> - } ; <nl> - <nl> class Row final : public PeerListRow { <nl> public : <nl> Row ( not_null < ChannelData * > channel , not_null < UserData * > user ) ; <nl> class Row final : public PeerListRow { <nl> Muted , <nl> } ; <nl> <nl> + void updateState ( const Data : : GroupCall : : Participant * participant ) ; <nl> + <nl> void addActionRipple ( QPoint point , Fn < void ( ) > updateCallback ) override ; <nl> void stopLastActionRipple ( ) override ; <nl> <nl> class Row final : public PeerListRow { <nl> <nl> } ; <nl> <nl> + class MembersController final <nl> + : public PeerListController <nl> + , public base : : has_weak_ptr { <nl> + public : <nl> + explicit MembersController ( not_null < GroupCall * > call ) ; <nl> + <nl> + Main : : Session & session ( ) const override ; <nl> + void prepare ( ) override ; <nl> + void rowClicked ( not_null < PeerListRow * > row ) override ; <nl> + void rowActionClicked ( not_null < PeerListRow * > row ) override ; <nl> + base : : unique_qptr < Ui : : PopupMenu > rowContextMenu ( <nl> + QWidget * parent , <nl> + not_null < PeerListRow * > row ) override ; <nl> + void loadMoreRows ( ) override ; <nl> + <nl> + [ [ nodiscard ] ] rpl : : producer < int > fullCountValue ( ) const { <nl> + return _fullCount . value ( ) ; <nl> + } <nl> + <nl> + private : <nl> + <nl> + [ [ nodiscard ] ] std : : unique_ptr < PeerListRow > createSelfRow ( ) const ; <nl> + [ [ nodiscard ] ] std : : unique_ptr < PeerListRow > createRow ( <nl> + const Data : : GroupCall : : Participant & participant ) const ; <nl> + <nl> + void prepareRows ( not_null < Data : : GroupCall * > real ) ; <nl> + <nl> + void setupListChangeViewers ( not_null < GroupCall * > call ) ; <nl> + void subscribeToChanges ( not_null < Data : : GroupCall * > real ) ; <nl> + void updateRow ( <nl> + const Data : : GroupCall : : Participant & participant ) ; <nl> + void updateRow ( <nl> + not_null < Row * > row , <nl> + const Data : : GroupCall : : Participant * participant ) const ; <nl> + <nl> + const base : : weak_ptr < GroupCall > _call ; <nl> + const not_null < ChannelData * > _channel ; <nl> + <nl> + rpl : : variable < int > _fullCount = 1 ; <nl> + Ui : : BoxPointer _addBox ; <nl> + rpl : : lifetime _lifetime ; <nl> + <nl> + } ; <nl> + <nl> Row : : Row ( not_null < ChannelData * > channel , not_null < UserData * > user ) <nl> : PeerListRow ( user ) <nl> , _state ( ComputeState ( channel , user ) ) <nl> Row : : Row ( not_null < ChannelData * > channel , not_null < UserData * > user ) <nl> refreshStatus ( ) ; <nl> } <nl> <nl> + void Row : : updateState ( const Data : : GroupCall : : Participant * participant ) { <nl> + if ( ! participant ) { <nl> + if ( peer ( ) - > isSelf ( ) ) { <nl> + setCustomStatus ( tr : : lng_group_call_connecting ( tr : : now ) ) ; <nl> + } else { <nl> + setCustomStatus ( QString ( ) ) ; <nl> + } <nl> + _state = State : : Inactive ; <nl> + } else if ( ! participant - > muted ) { <nl> + _state = State : : Active ; <nl> + } else if ( participant - > canSelfUnmute ) { <nl> + _state = State : : Inactive ; <nl> + } else { <nl> + _state = State : : Muted ; <nl> + } <nl> + _st = ComputeIconStyle ( _state ) ; <nl> + } <nl> + <nl> void Row : : paintAction ( <nl> Painter & p , <nl> int x , <nl> void Row : : refreshStatus ( ) { <nl> case State : : Active : return tr : : lng_group_call_active ( tr : : now ) ; <nl> } <nl> Unexpected ( " State in Row : : refreshStatus . " ) ; <nl> - } ( ) ) ; <nl> + } ( ) , ( _state = = State : : Active ) ) ; <nl> } <nl> <nl> Row : : State Row : : ComputeState ( <nl> void Row : : stopLastActionRipple ( ) { <nl> MembersController : : MembersController ( not_null < GroupCall * > call ) <nl> : _call ( call ) <nl> , _channel ( call - > channel ( ) ) { <nl> - setupListChangeViewers ( ) ; <nl> + setupListChangeViewers ( call ) ; <nl> } <nl> <nl> - void MembersController : : setupListChangeViewers ( ) { <nl> - const auto call = _call . get ( ) ; <nl> + void MembersController : : setupListChangeViewers ( not_null < GroupCall * > call ) { <nl> const auto channel = call - > channel ( ) ; <nl> - channel - > session ( ) . changes ( ) . peerUpdates ( <nl> + channel - > session ( ) . changes ( ) . peerFlagsValue ( <nl> channel , <nl> Data : : PeerUpdate : : Flag : : GroupCall <nl> + ) | rpl : : map ( [ = ] { <nl> + return channel - > call ( ) ; <nl> + } ) | rpl : : filter ( [ = ] ( Data : : GroupCall * real ) { <nl> + const auto call = _call . get ( ) ; <nl> + return call & & real & & ( real - > id ( ) = = call - > id ( ) ) ; <nl> + } ) | rpl : : take ( <nl> + 1 <nl> + ) | rpl : : start_with_next ( [ = ] ( not_null < Data : : GroupCall * > real ) { <nl> + subscribeToChanges ( real ) ; <nl> + } , _lifetime ) ; <nl> + <nl> + call - > stateValue ( <nl> ) | rpl : : start_with_next ( [ = ] { <nl> - prepareRows ( ) ; <nl> + const auto call = _call . get ( ) ; <nl> + const auto real = channel - > call ( ) ; <nl> + if ( call & & real & & ( real - > id ( ) = = call - > id ( ) ) ) { <nl> + / / updateRow ( channel - > session ( ) . user ( ) ) ; <nl> + } <nl> + } , _lifetime ) ; <nl> + } <nl> + <nl> + void MembersController : : subscribeToChanges ( not_null < Data : : GroupCall * > real ) { <nl> + _fullCount = real - > fullCountValue ( <nl> + ) | rpl : : map ( [ ] ( int value ) { <nl> + return std : : max ( value , 1 ) ; <nl> + } ) ; <nl> + <nl> + real - > participantsSliceAdded ( <nl> + ) | rpl : : start_with_next ( [ = ] { <nl> + prepareRows ( real ) ; <nl> + } , _lifetime ) ; <nl> + <nl> + using Update = Data : : GroupCall : : ParticipantUpdate ; <nl> + real - > participantUpdated ( <nl> + ) | rpl : : start_with_next ( [ = ] ( const Update & update ) { <nl> + const auto user = update . participant . user ; <nl> + if ( update . removed ) { <nl> + if ( auto row = delegate ( ) - > peerListFindRow ( user - > id ) ) { <nl> + if ( user - > isSelf ( ) ) { <nl> + static_cast < Row * > ( row ) - > updateState ( nullptr ) ; <nl> + delegate ( ) - > peerListUpdateRow ( row ) ; <nl> + } else { <nl> + delegate ( ) - > peerListRemoveRow ( row ) ; <nl> + delegate ( ) - > peerListRefreshRows ( ) ; <nl> + } <nl> + } <nl> + } else { <nl> + updateRow ( update . participant ) ; <nl> + } <nl> } , _lifetime ) ; <nl> } <nl> <nl> + void MembersController : : updateRow ( <nl> + const Data : : GroupCall : : Participant & participant ) { <nl> + if ( auto row = delegate ( ) - > peerListFindRow ( participant . user - > id ) ) { <nl> + updateRow ( static_cast < Row * > ( row ) , & participant ) ; <nl> + } else if ( auto row = createRow ( participant ) ) { <nl> + delegate ( ) - > peerListAppendRow ( std : : move ( row ) ) ; <nl> + delegate ( ) - > peerListRefreshRows ( ) ; <nl> + } <nl> + } <nl> + <nl> + void MembersController : : updateRow ( <nl> + not_null < Row * > row , <nl> + const Data : : GroupCall : : Participant * participant ) const { <nl> + row - > updateState ( participant ) ; <nl> + delegate ( ) - > peerListUpdateRow ( row ) ; <nl> + } <nl> + <nl> Main : : Session & MembersController : : session ( ) const { <nl> return _call - > channel ( ) - > session ( ) ; <nl> } <nl> void MembersController : : prepare ( ) { <nl> setDescriptionText ( tr : : lng_contacts_loading ( tr : : now ) ) ; <nl> setSearchNoResultsText ( tr : : lng_blocked_list_not_found ( tr : : now ) ) ; <nl> <nl> - prepareRows ( ) ; <nl> - delegate ( ) - > peerListRefreshRows ( ) ; <nl> - <nl> + const auto call = _call . get ( ) ; <nl> + if ( const auto real = _channel - > call ( ) ; <nl> + real & & call & & real - > id ( ) = = call - > id ( ) ) { <nl> + prepareRows ( real ) ; <nl> + } else if ( auto row = createSelfRow ( ) ) { <nl> + delegate ( ) - > peerListAppendRow ( std : : move ( row ) ) ; <nl> + delegate ( ) - > peerListRefreshRows ( ) ; <nl> + } <nl> loadMoreRows ( ) ; <nl> } <nl> <nl> - void MembersController : : prepareRows ( ) { <nl> - const auto real = _channel - > call ( ) ; <nl> - if ( ! real ) { <nl> - return ; <nl> - } <nl> + void MembersController : : prepareRows ( not_null < Data : : GroupCall * > real ) { <nl> auto foundSelf = false ; <nl> auto changed = false ; <nl> const auto & participants = real - > participants ( ) ; <nl> void MembersController : : prepareRows ( ) { <nl> } <nl> } <nl> if ( ! foundSelf ) { <nl> - if ( auto row = createRow ( _channel - > session ( ) . user ( ) ) ) { <nl> + const auto self = _channel - > session ( ) . user ( ) ; <nl> + const auto i = ranges : : find ( <nl> + participants , <nl> + _channel - > session ( ) . user ( ) , <nl> + & Data : : GroupCall : : Participant : : user ) ; <nl> + auto row = ( i ! = end ( participants ) ) ? createRow ( * i ) : createSelfRow ( ) ; <nl> + if ( row ) { <nl> changed = true ; <nl> delegate ( ) - > peerListAppendRow ( std : : move ( row ) ) ; <nl> } <nl> } <nl> for ( const auto & participant : participants ) { <nl> - if ( auto row = createRow ( participant . user ) ) { <nl> + if ( auto row = createRow ( participant ) ) { <nl> changed = true ; <nl> delegate ( ) - > peerListAppendRow ( std : : move ( row ) ) ; <nl> } <nl> void MembersController : : prepareRows ( ) { <nl> } <nl> <nl> void MembersController : : loadMoreRows ( ) { <nl> - if ( const auto call = _call . get ( ) ) { <nl> - if ( const auto real = call - > channel ( ) - > call ( ) ) { <nl> - real - > requestParticipants ( ) ; <nl> - } <nl> + if ( const auto real = _channel - > call ( ) ) { <nl> + real - > requestParticipants ( ) ; <nl> } <nl> } <nl> <nl> base : : unique_qptr < Ui : : PopupMenu > MembersController : : rowContextMenu ( <nl> return nullptr ; <nl> } <nl> <nl> - bool MembersController : : appendRow ( not_null < UserData * > user ) { <nl> - if ( delegate ( ) - > peerListFindRow ( user - > id ) ) { <nl> - return false ; <nl> - } <nl> - delegate ( ) - > peerListAppendRow ( createRow ( user ) ) ; <nl> - return true ; <nl> - } <nl> - <nl> - bool MembersController : : prependRow ( not_null < UserData * > user ) { <nl> - if ( auto row = delegate ( ) - > peerListFindRow ( user - > id ) ) { <nl> - return false ; <nl> - } <nl> - delegate ( ) - > peerListPrependRow ( createRow ( user ) ) ; <nl> - return true ; <nl> - } <nl> - <nl> - bool MembersController : : removeRow ( not_null < UserData * > user ) { <nl> - if ( auto row = delegate ( ) - > peerListFindRow ( user - > id ) ) { <nl> - delegate ( ) - > peerListRemoveRow ( row ) ; <nl> - return true ; <nl> - } <nl> - return false ; <nl> + std : : unique_ptr < PeerListRow > MembersController : : createSelfRow ( ) const { <nl> + const auto self = _channel - > session ( ) . user ( ) ; <nl> + auto result = std : : make_unique < Row > ( _channel , self ) ; <nl> + updateRow ( result . get ( ) , nullptr ) ; <nl> + return result ; <nl> } <nl> <nl> std : : unique_ptr < PeerListRow > MembersController : : createRow ( <nl> - not_null < UserData * > user ) const { <nl> - return std : : make_unique < Row > ( _channel , user ) ; <nl> + const Data : : GroupCall : : Participant & participant ) const { <nl> + auto result = std : : make_unique < Row > ( _channel , participant . user ) ; <nl> + updateRow ( result . get ( ) , & participant ) ; <nl> + return result ; <nl> } <nl> <nl> } / / namespace <nl> void GroupMembers : : setupHeader ( not_null < GroupCall * > call ) { <nl> <nl> object_ptr < Ui : : FlatLabel > GroupMembers : : setupTitle ( <nl> not_null < GroupCall * > call ) { <nl> - const auto channel = call - > channel ( ) ; <nl> - auto count = channel - > session ( ) . changes ( ) . peerFlagsValue ( <nl> - channel , <nl> - Data : : PeerUpdate : : Flag : : GroupCall <nl> - ) | rpl : : map ( [ = ] { <nl> - const auto call = channel - > call ( ) ; <nl> - return std : : max ( call ? call - > fullCount ( ) : 0 , 1 ) ; <nl> - } ) ; <nl> + const auto controller = static_cast < MembersController * > ( <nl> + _listController . get ( ) ) ; <nl> auto result = object_ptr < Ui : : FlatLabel > ( <nl> _titleWrap , <nl> tr : : lng_chat_status_members ( <nl> lt_count_decimal , <nl> - std : : move ( count ) | tr : : to_count ( ) , <nl> + controller - > fullCountValue ( ) | tr : : to_count ( ) , <nl> Ui : : Text : : Upper <nl> ) , <nl> st : : groupCallHeaderLabel ) ; <nl> mmm a / Telegram / SourceFiles / calls / calls_group_members . h <nl> ppp b / Telegram / SourceFiles / calls / calls_group_members . h <nl> namespace Ui { <nl> class ScrollArea ; <nl> } / / namespace Ui <nl> <nl> + namespace Data { <nl> + class GroupCall ; <nl> + } / / namespace Data <nl> + <nl> namespace Calls { <nl> <nl> class GroupCall ; <nl> class GroupMembers final <nl> void setupButtons ( ) ; <nl> <nl> void addMember ( ) ; <nl> - void showMembersWithSearch ( bool withSearch ) ; <nl> void updateHeaderControlsGeometry ( int newWidth ) ; <nl> <nl> base : : weak_ptr < GroupCall > _call ; <nl> mmm a / Telegram / SourceFiles / calls / calls_group_panel . cpp <nl> ppp b / Telegram / SourceFiles / calls / calls_group_panel . cpp <nl> For license and copyright information please follow this link : <nl> # include " ui / widgets / buttons . h " <nl> # include " ui / widgets / window . h " <nl> # include " ui / effects / ripple_animation . h " <nl> + # include " ui / layers / layer_manager . h " <nl> + # include " boxes / confirm_box . h " <nl> # include " core / application . h " <nl> # include " lang / lang_keys . h " <nl> # include " base / event_filter . h " <nl> GroupPanel : : GroupPanel ( not_null < GroupCall * > call ) <nl> : _call ( call ) <nl> , _channel ( call - > channel ( ) ) <nl> , _window ( std : : make_unique < Ui : : Window > ( Core : : App ( ) . getModalParent ( ) ) ) <nl> + , _layerBg ( std : : make_unique < Ui : : LayerManager > ( _window - > body ( ) ) ) <nl> # ifdef Q_OS_WIN <nl> , _controls ( std : : make_unique < Ui : : Platform : : TitleControls > ( <nl> _window . get ( ) , <nl> void GroupPanel : : initControls ( ) { <nl> } <nl> } ) ; <nl> _hangup - > setClickedCallback ( [ = ] { <nl> - if ( _call ) { <nl> - _call - > hangup ( ) ; <nl> - } <nl> + _layerBg - > showBox ( Box < ConfirmBox > ( <nl> + tr : : lng_group_call_leave_sure ( tr : : now ) , <nl> + tr : : lng_group_call_leave ( tr : : now ) , <nl> + [ = ] { if ( _call ) _call - > hangup ( ) ; } ) ) ; <nl> } ) ; <nl> _settings - > setClickedCallback ( [ = ] { <nl> } ) ; <nl> void GroupPanel : : updateControlsGeometry ( ) { <nl> - membersTop <nl> - st : : groupCallMembersMargin . bottom ( ) ; <nl> _members - > setGeometry ( <nl> - st : : groupCallMembersMargin . left ( ) , <nl> + ( widget ( ) - > width ( ) - membersWidth ) / 2 , <nl> membersTop , <nl> membersWidth , <nl> std : : min ( desiredHeight , availableHeight ) ) ; <nl> void GroupPanel : : refreshTitle ( ) { <nl> widget ( ) , <nl> tr : : lng_group_call_title ( ) , <nl> st : : groupCallHeaderLabel ) ; <nl> + _title - > setAttribute ( Qt : : WA_TransparentForMouseEvents ) ; <nl> _window - > setTitle ( u " " _q ) ; <nl> } <nl> const auto best = _title - > naturalWidth ( ) ; <nl> mmm a / Telegram / SourceFiles / calls / calls_group_panel . h <nl> ppp b / Telegram / SourceFiles / calls / calls_group_panel . h <nl> template < typename Widget > <nl> class PaddingWrap ; <nl> class Window ; <nl> class ScrollArea ; <nl> + class LayerManager ; <nl> namespace Platform { <nl> class TitleControls ; <nl> } / / namespace Platform <nl> class GroupPanel final { <nl> not_null < ChannelData * > _channel ; <nl> <nl> const std : : unique_ptr < Ui : : Window > _window ; <nl> + const std : : unique_ptr < Ui : : LayerManager > _layerBg ; <nl> <nl> # ifdef Q_OS_WIN <nl> std : : unique_ptr < Ui : : Platform : : TitleControls > _controls ; <nl> mmm a / Telegram / SourceFiles / data / data_group_call . cpp <nl> ppp b / Telegram / SourceFiles / data / data_group_call . cpp <nl> auto GroupCall : : participants ( ) const <nl> return _participants ; <nl> } <nl> <nl> - const base : : flat_set < uint32 > & GroupCall : : sources ( ) const { <nl> - return _sources ; <nl> - } <nl> - <nl> void GroupCall : : requestParticipants ( ) { <nl> if ( _participantsRequestId | | _reloadRequestId ) { <nl> return ; <nl> - } else if ( _participants . size ( ) > = _fullCount & & _allReceived ) { <nl> + } else if ( _participants . size ( ) > = _fullCount . current ( ) & & _allReceived ) { <nl> return ; <nl> } else if ( _allReceived ) { <nl> reload ( ) ; <nl> void GroupCall : : requestParticipants ( ) { <nl> _fullCount = _participants . size ( ) ; <nl> } <nl> } ) ; <nl> - _channel - > session ( ) . changes ( ) . peerUpdated ( <nl> - _channel , <nl> - PeerUpdate : : Flag : : GroupCall ) ; <nl> + _participantsSliceAdded . fire ( { } ) ; <nl> _participantsRequestId = 0 ; <nl> } ) . fail ( [ = ] ( const RPCError & error ) { <nl> _fullCount = _participants . size ( ) ; <nl> void GroupCall : : requestParticipants ( ) { <nl> } <nl> <nl> int GroupCall : : fullCount ( ) const { <nl> - return _fullCount ; <nl> + return _fullCount . current ( ) ; <nl> + } <nl> + <nl> + rpl : : producer < int > GroupCall : : fullCountValue ( ) const { <nl> + return _fullCount . value ( ) ; <nl> } <nl> <nl> bool GroupCall : : participantsLoaded ( ) const { <nl> return _allReceived ; <nl> } <nl> <nl> + rpl : : producer < > GroupCall : : participantsSliceAdded ( ) { <nl> + return _participantsSliceAdded . events ( ) ; <nl> + } <nl> + <nl> + auto GroupCall : : participantUpdated ( ) const <nl> + - > rpl : : producer < ParticipantUpdate > { <nl> + return _participantUpdates . events ( ) ; <nl> + } <nl> + <nl> void GroupCall : : applyUpdate ( const MTPGroupCall & update ) { <nl> applyCall ( update , false ) ; <nl> } <nl> void GroupCall : : applyUpdate ( const MTPGroupCall & update ) { <nl> void GroupCall : : applyCall ( const MTPGroupCall & call , bool force ) { <nl> call . match ( [ & ] ( const MTPDgroupCall & data ) { <nl> const auto changed = ( _version ! = data . vversion ( ) . v ) <nl> - | | ( _fullCount ! = data . vparticipants_count ( ) . v ) ; <nl> + | | ( _fullCount . current ( ) ! = data . vparticipants_count ( ) . v ) ; <nl> if ( ! force & & ! changed ) { <nl> return ; <nl> } else if ( ! force & & _version > data . vversion ( ) . v ) { <nl> void GroupCall : : applyCall ( const MTPGroupCall & call , bool force ) { <nl> _finished = true ; <nl> _duration = data . vduration ( ) . v ; <nl> } ) ; <nl> - _channel - > session ( ) . changes ( ) . peerUpdated ( <nl> - _channel , <nl> - PeerUpdate : : Flag : : GroupCall ) ; <nl> } <nl> <nl> void GroupCall : : reload ( ) { <nl> void GroupCall : : reload ( ) { <nl> result . match ( [ & ] ( const MTPDphone_groupCall & data ) { <nl> _channel - > owner ( ) . processUsers ( data . vusers ( ) ) ; <nl> _participants . clear ( ) ; <nl> - _sources . clear ( ) ; <nl> applyParticipantsSlice ( data . vparticipants ( ) . v ) ; <nl> - for ( const auto & source : data . vsources ( ) . v ) { <nl> - _sources . emplace ( source . v ) ; <nl> - } <nl> - _fullCount = _sources . size ( ) ; <nl> - if ( _participants . size ( ) > _fullCount ) { <nl> - _fullCount = _participants . size ( ) ; <nl> - } <nl> - _allReceived = ( _fullCount = = _participants . size ( ) ) ; <nl> applyCall ( data . vcall ( ) , true ) ; <nl> + _allReceived = ( _fullCount . current ( ) = = _participants . size ( ) ) ; <nl> + _participantsSliceAdded . fire ( { } ) ; <nl> } ) ; <nl> _reloadRequestId = 0 ; <nl> } ) . fail ( [ = ] ( const RPCError & error ) { <nl> void GroupCall : : reload ( ) { <nl> } <nl> <nl> void GroupCall : : applyParticipantsSlice ( <nl> - const QVector < MTPGroupCallParticipant > & list ) { <nl> + const QVector < MTPGroupCallParticipant > & list , <nl> + bool sendIndividualUpdates ) { <nl> + auto fullCount = _fullCount . current ( ) ; <nl> for ( const auto & participant : list ) { <nl> participant . match ( [ & ] ( const MTPDgroupCallParticipant & data ) { <nl> const auto userId = data . vuser_id ( ) . v ; <nl> void GroupCall : : applyParticipantsSlice ( <nl> & Participant : : user ) ; <nl> if ( data . is_left ( ) ) { <nl> if ( i ! = end ( _participants ) ) { <nl> - _sources . remove ( i - > source ) ; <nl> + auto update = ParticipantUpdate { <nl> + . participant = * i , <nl> + . removed = true , <nl> + } ; <nl> _participants . erase ( i ) ; <nl> + if ( sendIndividualUpdates ) { <nl> + _participantUpdates . fire ( std : : move ( update ) ) ; <nl> + } <nl> } <nl> - if ( _fullCount > _participants . size ( ) ) { <nl> - - - _fullCount ; <nl> + if ( fullCount > _participants . size ( ) ) { <nl> + - - fullCount ; <nl> } <nl> return ; <nl> } <nl> void GroupCall : : applyParticipantsSlice ( <nl> } ; <nl> if ( i = = end ( _participants ) ) { <nl> _participants . push_back ( value ) ; <nl> - + + _fullCount ; <nl> + + + fullCount ; <nl> } else { <nl> * i = value ; <nl> } <nl> - _sources . emplace ( uint32 ( data . vsource ( ) . v ) ) ; <nl> + _participantUpdates . fire ( { <nl> + . participant = value , <nl> + } ) ; <nl> + } ) ; <nl> + } <nl> + ranges : : sort ( _participants , std : : greater < > ( ) , [ ] ( const Participant & p ) { <nl> + return p . lastActivePrecise <nl> + ? p . lastActivePrecise <nl> + : p . lastActive <nl> + ? p . lastActive <nl> + : p . date ; <nl> + } ) ; <nl> + _fullCount = fullCount ; <nl> + } <nl> + <nl> + void GroupCall : : applyParticipantsMutes ( <nl> + const MTPDupdateGroupCallParticipants & update ) { <nl> + for ( const auto & participant : update . vparticipants ( ) . v ) { <nl> + participant . match ( [ & ] ( const MTPDgroupCallParticipant & data ) { <nl> + if ( data . is_left ( ) ) { <nl> + return ; <nl> + } <nl> + const auto userId = data . vuser_id ( ) . v ; <nl> + const auto user = _channel - > owner ( ) . user ( userId ) ; <nl> + const auto i = ranges : : find ( <nl> + _participants , <nl> + user , <nl> + & Participant : : user ) ; <nl> + if ( i ! = end ( _participants ) ) { <nl> + i - > muted = data . is_muted ( ) ; <nl> + i - > canSelfUnmute = data . is_can_self_unmute ( ) ; <nl> + _participantUpdates . fire ( { <nl> + . participant = * i , <nl> + } ) ; <nl> + } <nl> } ) ; <nl> } <nl> - ranges : : sort ( _participants , std : : greater < > ( ) , & Participant : : date ) ; <nl> + <nl> } <nl> <nl> void GroupCall : : applyUpdate ( const MTPDupdateGroupCallParticipants & update ) { <nl> - if ( update . vversion ( ) . v < = _version ) { <nl> + const auto version = update . vversion ( ) . v ; <nl> + if ( version < _version ) { <nl> + return ; <nl> + } else if ( version = = _version ) { <nl> + applyParticipantsMutes ( update ) ; <nl> return ; <nl> - } else if ( update . vversion ( ) . v ! = _version + 1 ) { <nl> + } else if ( version ! = _version + 1 ) { <nl> + applyParticipantsMutes ( update ) ; <nl> reload ( ) ; <nl> return ; <nl> } <nl> _version = update . vversion ( ) . v ; <nl> - applyParticipantsSlice ( update . vparticipants ( ) . v ) ; <nl> - _channel - > session ( ) . changes ( ) . peerUpdated ( <nl> - _channel , <nl> - PeerUpdate : : Flag : : GroupCall ) ; <nl> + applyUpdateChecked ( update ) ; <nl> + } <nl> + <nl> + void GroupCall : : applyUpdateChecked ( <nl> + const MTPDupdateGroupCallParticipants & update ) { <nl> + applyParticipantsSlice ( update . vparticipants ( ) . v , true ) ; <nl> } <nl> <nl> } / / namespace Data <nl> mmm a / Telegram / SourceFiles / data / data_group_call . h <nl> ppp b / Telegram / SourceFiles / data / data_group_call . h <nl> class GroupCall final { <nl> struct Participant { <nl> not_null < UserData * > user ; <nl> TimeId date = 0 ; <nl> + TimeId lastActive = 0 ; <nl> + TimeId lastActivePrecise = 0 ; <nl> uint32 source = 0 ; <nl> bool muted = false ; <nl> bool canSelfUnmute = false ; <nl> } ; <nl> + struct ParticipantUpdate { <nl> + Participant participant ; <nl> + bool removed = false ; <nl> + } ; <nl> <nl> [ [ nodiscard ] ] auto participants ( ) const <nl> - > const std : : vector < Participant > & ; <nl> - [ [ nodiscard ] ] const base : : flat_set < uint32 > & sources ( ) const ; <nl> void requestParticipants ( ) ; <nl> [ [ nodiscard ] ] bool participantsLoaded ( ) const ; <nl> <nl> + [ [ nodiscard ] ] rpl : : producer < > participantsSliceAdded ( ) ; <nl> + [ [ nodiscard ] ] rpl : : producer < ParticipantUpdate > participantUpdated ( ) const ; <nl> + <nl> void applyUpdate ( const MTPGroupCall & update ) ; <nl> void applyUpdate ( const MTPDupdateGroupCallParticipants & update ) ; <nl> + void applyUpdateChecked ( <nl> + const MTPDupdateGroupCallParticipants & update ) ; <nl> <nl> [ [ nodiscard ] ] int fullCount ( ) const ; <nl> + [ [ nodiscard ] ] rpl : : producer < int > fullCountValue ( ) const ; <nl> <nl> void reload ( ) ; <nl> [ [ nodiscard ] ] bool finished ( ) const ; <nl> class GroupCall final { <nl> <nl> private : <nl> void applyCall ( const MTPGroupCall & call , bool force ) ; <nl> - void applyParticipantsSlice ( const QVector < MTPGroupCallParticipant > & list ) ; <nl> + void applyParticipantsSlice ( <nl> + const QVector < MTPGroupCallParticipant > & list , <nl> + bool sendIndividualUpdates = false ) ; <nl> + void applyParticipantsMutes ( <nl> + const MTPDupdateGroupCallParticipants & update ) ; <nl> <nl> const not_null < ChannelData * > _channel ; <nl> const uint64 _id = 0 ; <nl> class GroupCall final { <nl> mtpRequestId _reloadRequestId = 0 ; <nl> <nl> std : : vector < Participant > _participants ; <nl> - base : : flat_set < uint32 > _sources ; <nl> QString _nextOffset ; <nl> - int _fullCount = 0 ; <nl> + rpl : : variable < int > _fullCount = 0 ; <nl> + <nl> + rpl : : event_stream < ParticipantUpdate > _participantUpdates ; <nl> + rpl : : event_stream < > _participantsSliceAdded ; <nl> + <nl> int _duration = 0 ; <nl> bool _finished = false ; <nl> bool _allReceived = false ; <nl> mmm a / Telegram / ThirdParty / tgcalls <nl> ppp b / Telegram / ThirdParty / tgcalls <nl> @ @ - 1 + 1 @ @ <nl> - Subproject commit d2c6ad40d717e604859589d854b81229abd11763 <nl> + Subproject commit ac86c0ee86293d6fced7dcb48a8c93657f18a7f3 <nl>
|
Improve group call members list updating .
|
telegramdesktop/tdesktop
|
a6b4cdd62dccd35d07b792a139e979872be6ca5d
|
2020-12-01T06:45:22Z
|
mmm a / src / builtins / arm / builtins - arm . cc <nl> ppp b / src / builtins / arm / builtins - arm . cc <nl> static void CheckSpreadAndPushToStack ( MacroAssembler * masm ) { <nl> / / Check that the ArrayPrototype hasn ' t been modified in a way that would <nl> / / affect iteration . <nl> __ LoadRoot ( scratch , Heap : : kArrayIteratorProtectorRootIndex ) ; <nl> - __ ldr ( scratch , FieldMemOperand ( scratch , Cell : : kValueOffset ) ) ; <nl> + __ ldr ( scratch , FieldMemOperand ( scratch , PropertyCell : : kValueOffset ) ) ; <nl> __ cmp ( scratch , Operand ( Smi : : FromInt ( Isolate : : kProtectorValid ) ) ) ; <nl> __ b ( ne , & runtime_call ) ; <nl> <nl> mmm a / src / builtins / arm64 / builtins - arm64 . cc <nl> ppp b / src / builtins / arm64 / builtins - arm64 . cc <nl> static void CheckSpreadAndPushToStack ( MacroAssembler * masm ) { <nl> / / Check that the ArrayPrototype hasn ' t been modified in a way that would <nl> / / affect iteration . <nl> __ LoadRoot ( scratch , Heap : : kArrayIteratorProtectorRootIndex ) ; <nl> - __ Ldr ( scratch , FieldMemOperand ( scratch , Cell : : kValueOffset ) ) ; <nl> + __ Ldr ( scratch , FieldMemOperand ( scratch , PropertyCell : : kValueOffset ) ) ; <nl> __ Cmp ( scratch , Smi : : FromInt ( Isolate : : kProtectorValid ) ) ; <nl> __ B ( ne , & runtime_call ) ; <nl> <nl> mmm a / src / builtins / ia32 / builtins - ia32 . cc <nl> ppp b / src / builtins / ia32 / builtins - ia32 . cc <nl> static void CheckSpreadAndPushToStack ( MacroAssembler * masm ) { <nl> / / Check that the ArrayPrototype hasn ' t been modified in a way that would <nl> / / affect iteration . <nl> __ LoadRoot ( scratch , Heap : : kArrayIteratorProtectorRootIndex ) ; <nl> - __ cmp ( FieldOperand ( scratch , Cell : : kValueOffset ) , <nl> + __ cmp ( FieldOperand ( scratch , PropertyCell : : kValueOffset ) , <nl> Immediate ( Smi : : FromInt ( Isolate : : kProtectorValid ) ) ) ; <nl> __ j ( not_equal , & runtime_call ) ; <nl> <nl> mmm a / src / builtins / mips / builtins - mips . cc <nl> ppp b / src / builtins / mips / builtins - mips . cc <nl> static void CheckSpreadAndPushToStack ( MacroAssembler * masm ) { <nl> / / Check that the ArrayPrototype hasn ' t been modified in a way that would <nl> / / affect iteration . <nl> __ LoadRoot ( scratch , Heap : : kArrayIteratorProtectorRootIndex ) ; <nl> - __ lw ( scratch , FieldMemOperand ( scratch , Cell : : kValueOffset ) ) ; <nl> + __ lw ( scratch , FieldMemOperand ( scratch , PropertyCell : : kValueOffset ) ) ; <nl> __ Branch ( & runtime_call , ne , scratch , <nl> Operand ( Smi : : FromInt ( Isolate : : kProtectorValid ) ) ) ; <nl> <nl> mmm a / src / builtins / mips64 / builtins - mips64 . cc <nl> ppp b / src / builtins / mips64 / builtins - mips64 . cc <nl> static void CheckSpreadAndPushToStack ( MacroAssembler * masm ) { <nl> / / Check that the ArrayPrototype hasn ' t been modified in a way that would <nl> / / affect iteration . <nl> __ LoadRoot ( scratch , Heap : : kArrayIteratorProtectorRootIndex ) ; <nl> - __ lw ( scratch , FieldMemOperand ( scratch , Cell : : kValueOffset ) ) ; <nl> + __ lw ( scratch , FieldMemOperand ( scratch , PropertyCell : : kValueOffset ) ) ; <nl> __ Branch ( & runtime_call , ne , scratch , <nl> Operand ( Smi : : FromInt ( Isolate : : kProtectorValid ) ) ) ; <nl> <nl> mmm a / src / builtins / ppc / builtins - ppc . cc <nl> ppp b / src / builtins / ppc / builtins - ppc . cc <nl> static void CheckSpreadAndPushToStack ( MacroAssembler * masm ) { <nl> / / Check that the ArrayPrototype hasn ' t been modified in a way that would <nl> / / affect iteration . <nl> __ LoadRoot ( scratch , Heap : : kArrayIteratorProtectorRootIndex ) ; <nl> - __ LoadP ( scratch , FieldMemOperand ( scratch , Cell : : kValueOffset ) ) ; <nl> + __ LoadP ( scratch , FieldMemOperand ( scratch , PropertyCell : : kValueOffset ) ) ; <nl> __ CmpSmiLiteral ( scratch , Smi : : FromInt ( Isolate : : kProtectorValid ) , r0 ) ; <nl> __ bne ( & runtime_call ) ; <nl> <nl> mmm a / src / builtins / s390 / builtins - s390 . cc <nl> ppp b / src / builtins / s390 / builtins - s390 . cc <nl> static void CheckSpreadAndPushToStack ( MacroAssembler * masm ) { <nl> / / Check that the ArrayPrototype hasn ' t been modified in a way that would <nl> / / affect iteration . <nl> __ LoadRoot ( scratch , Heap : : kArrayIteratorProtectorRootIndex ) ; <nl> - __ LoadP ( scratch , FieldMemOperand ( scratch , Cell : : kValueOffset ) ) ; <nl> + __ LoadP ( scratch , FieldMemOperand ( scratch , PropertyCell : : kValueOffset ) ) ; <nl> __ CmpSmiLiteral ( scratch , Smi : : FromInt ( Isolate : : kProtectorValid ) , r0 ) ; <nl> __ bne ( & runtime_call ) ; <nl> <nl> mmm a / src / builtins / x64 / builtins - x64 . cc <nl> ppp b / src / builtins / x64 / builtins - x64 . cc <nl> static void CheckSpreadAndPushToStack ( MacroAssembler * masm ) { <nl> / / Check that the ArrayPrototype hasn ' t been modified in a way that would <nl> / / affect iteration . <nl> __ LoadRoot ( rcx , Heap : : kArrayIteratorProtectorRootIndex ) ; <nl> - __ Cmp ( FieldOperand ( rcx , Cell : : kValueOffset ) , <nl> + __ Cmp ( FieldOperand ( rcx , PropertyCell : : kValueOffset ) , <nl> Smi : : FromInt ( Isolate : : kProtectorValid ) ) ; <nl> __ j ( not_equal , & runtime_call ) ; <nl> <nl> mmm a / src / builtins / x87 / builtins - x87 . cc <nl> ppp b / src / builtins / x87 / builtins - x87 . cc <nl> static void CheckSpreadAndPushToStack ( MacroAssembler * masm ) { <nl> / / Check that the ArrayPrototype hasn ' t been modified in a way that would <nl> / / affect iteration . <nl> __ LoadRoot ( scratch , Heap : : kArrayIteratorProtectorRootIndex ) ; <nl> - __ cmp ( FieldOperand ( scratch , Cell : : kValueOffset ) , <nl> + __ cmp ( FieldOperand ( scratch , PropertyCell : : kValueOffset ) , <nl> Immediate ( Smi : : FromInt ( Isolate : : kProtectorValid ) ) ) ; <nl> __ j ( not_equal , & runtime_call ) ; <nl> <nl> mmm a / src / heap / heap . cc <nl> ppp b / src / heap / heap . cc <nl> void Heap : : CreateInitialObjects ( ) { <nl> cell - > set_value ( Smi : : FromInt ( Isolate : : kProtectorValid ) ) ; <nl> set_has_instance_protector ( * cell ) ; <nl> <nl> + cell = factory - > NewPropertyCell ( ) ; <nl> + cell - > set_value ( Smi : : FromInt ( Isolate : : kProtectorValid ) ) ; <nl> + set_array_iterator_protector ( * cell ) ; <nl> + <nl> Handle < Cell > is_concat_spreadable_cell = factory - > NewCell ( <nl> handle ( Smi : : FromInt ( Isolate : : kProtectorValid ) , isolate ( ) ) ) ; <nl> set_is_concat_spreadable_protector ( * is_concat_spreadable_cell ) ; <nl> void Heap : : CreateInitialObjects ( ) { <nl> handle ( Smi : : FromInt ( Isolate : : kProtectorValid ) , isolate ( ) ) ) ; <nl> set_fast_array_iteration_protector ( * fast_array_iteration_cell ) ; <nl> <nl> - Handle < Cell > array_iterator_cell = factory - > NewCell ( <nl> - handle ( Smi : : FromInt ( Isolate : : kProtectorValid ) , isolate ( ) ) ) ; <nl> - set_array_iterator_protector ( * array_iterator_cell ) ; <nl> - <nl> cell = factory - > NewPropertyCell ( ) ; <nl> cell - > set_value ( Smi : : FromInt ( Isolate : : kProtectorValid ) ) ; <nl> set_array_buffer_neutering_protector ( * cell ) ; <nl> mmm a / src / heap / heap . h <nl> ppp b / src / heap / heap . h <nl> using v8 : : MemoryPressureLevel ; <nl> V ( Cell , species_protector , SpeciesProtector ) \ <nl> V ( PropertyCell , string_length_protector , StringLengthProtector ) \ <nl> V ( Cell , fast_array_iteration_protector , FastArrayIterationProtector ) \ <nl> - V ( Cell , array_iterator_protector , ArrayIteratorProtector ) \ <nl> + V ( PropertyCell , array_iterator_protector , ArrayIteratorProtector ) \ <nl> V ( PropertyCell , array_buffer_neutering_protector , \ <nl> ArrayBufferNeuteringProtector ) \ <nl> / * Special numbers * / \ <nl> mmm a / src / isolate - inl . h <nl> ppp b / src / isolate - inl . h <nl> bool Isolate : : IsHasInstanceLookupChainIntact ( ) { <nl> } <nl> <nl> bool Isolate : : IsStringLengthOverflowIntact ( ) { <nl> - PropertyCell * has_instance_cell = heap ( ) - > string_length_protector ( ) ; <nl> - return has_instance_cell - > value ( ) = = Smi : : FromInt ( kProtectorValid ) ; <nl> + PropertyCell * string_length_cell = heap ( ) - > string_length_protector ( ) ; <nl> + return string_length_cell - > value ( ) = = Smi : : FromInt ( kProtectorValid ) ; <nl> } <nl> <nl> bool Isolate : : IsFastArrayIterationIntact ( ) { <nl> - Cell * fast_iteration = heap ( ) - > fast_array_iteration_protector ( ) ; <nl> - return fast_iteration - > value ( ) = = Smi : : FromInt ( kProtectorValid ) ; <nl> + Cell * fast_iteration_cell = heap ( ) - > fast_array_iteration_protector ( ) ; <nl> + return fast_iteration_cell - > value ( ) = = Smi : : FromInt ( kProtectorValid ) ; <nl> } <nl> <nl> bool Isolate : : IsArrayBufferNeuteringIntact ( ) { <nl> - PropertyCell * fast_iteration = heap ( ) - > array_buffer_neutering_protector ( ) ; <nl> - return fast_iteration - > value ( ) = = Smi : : FromInt ( kProtectorValid ) ; <nl> + PropertyCell * buffer_neutering = heap ( ) - > array_buffer_neutering_protector ( ) ; <nl> + return buffer_neutering - > value ( ) = = Smi : : FromInt ( kProtectorValid ) ; <nl> } <nl> <nl> bool Isolate : : IsArrayIteratorLookupChainIntact ( ) { <nl> - Cell * array_iterator_cell = heap ( ) - > array_iterator_protector ( ) ; <nl> + PropertyCell * array_iterator_cell = heap ( ) - > array_iterator_protector ( ) ; <nl> return array_iterator_cell - > value ( ) = = Smi : : FromInt ( kProtectorValid ) ; <nl> } <nl> <nl> mmm a / src / isolate . cc <nl> ppp b / src / isolate . cc <nl> void Isolate : : InvalidateStringLengthOverflowProtector ( ) { <nl> void Isolate : : InvalidateArrayIteratorProtector ( ) { <nl> DCHECK ( factory ( ) - > array_iterator_protector ( ) - > value ( ) - > IsSmi ( ) ) ; <nl> DCHECK ( IsArrayIteratorLookupChainIntact ( ) ) ; <nl> - factory ( ) - > array_iterator_protector ( ) - > set_value ( <nl> - Smi : : FromInt ( kProtectorInvalid ) ) ; <nl> + PropertyCell : : SetValueWithInvalidation ( <nl> + factory ( ) - > array_iterator_protector ( ) , <nl> + handle ( Smi : : FromInt ( kProtectorInvalid ) , this ) ) ; <nl> DCHECK ( ! IsArrayIteratorLookupChainIntact ( ) ) ; <nl> } <nl> <nl>
|
Convert the array iterator protector to a PropertyCell .
|
v8/v8
|
ccf428bb0473cf894bf1adae286917ba6156d376
|
2017-01-30T09:55:21Z
|
mmm a / UnitTests / Basics / AttributeNameParserTest . cpp <nl> ppp b / UnitTests / Basics / AttributeNameParserTest . cpp <nl> BOOST_AUTO_TEST_CASE ( test_simpleString ) { <nl> <nl> TRI_ParseAttributeString ( input , result ) ; <nl> <nl> - BOOST_CHECK_EQUAL ( result . size ( ) , 1 ) ; <nl> + BOOST_CHECK_EQUAL ( result . size ( ) , static_cast < size_t > ( 1 ) ) ; <nl> BOOST_CHECK_EQUAL ( result [ 0 ] . name , input ) ; <nl> BOOST_CHECK_EQUAL ( result [ 0 ] . shouldExpand , false ) ; <nl> } <nl> BOOST_AUTO_TEST_CASE ( test_subAttribute ) { <nl> <nl> TRI_ParseAttributeString ( input , result ) ; <nl> <nl> - BOOST_CHECK_EQUAL ( result . size ( ) , 2 ) ; <nl> + BOOST_CHECK_EQUAL ( result . size ( ) , static_cast < size_t > ( 2 ) ) ; <nl> BOOST_CHECK_EQUAL ( result [ 0 ] . name , " foo " ) ; <nl> BOOST_CHECK_EQUAL ( result [ 0 ] . shouldExpand , false ) ; <nl> BOOST_CHECK_EQUAL ( result [ 1 ] . name , " bar " ) ; <nl> BOOST_AUTO_TEST_CASE ( test_subsubAttribute ) { <nl> <nl> TRI_ParseAttributeString ( input , result ) ; <nl> <nl> - BOOST_CHECK_EQUAL ( result . size ( ) , 3 ) ; <nl> + BOOST_CHECK_EQUAL ( result . size ( ) , static_cast < size_t > ( 3 ) ) ; <nl> BOOST_CHECK_EQUAL ( result [ 0 ] . name , " foo " ) ; <nl> BOOST_CHECK_EQUAL ( result [ 0 ] . shouldExpand , false ) ; <nl> BOOST_CHECK_EQUAL ( result [ 1 ] . name , " bar " ) ; <nl> BOOST_AUTO_TEST_CASE ( test_expandAttribute ) { <nl> <nl> TRI_ParseAttributeString ( input , result ) ; <nl> <nl> - BOOST_CHECK_EQUAL ( result . size ( ) , 1 ) ; <nl> + BOOST_CHECK_EQUAL ( result . size ( ) , static_cast < size_t > ( 1 ) ) ; <nl> BOOST_CHECK_EQUAL ( result [ 0 ] . name , " foo " ) ; <nl> BOOST_CHECK_EQUAL ( result [ 0 ] . shouldExpand , true ) ; <nl> } <nl> BOOST_AUTO_TEST_CASE ( test_expandSubAttribute ) { <nl> <nl> TRI_ParseAttributeString ( input , result ) ; <nl> <nl> - BOOST_CHECK_EQUAL ( result . size ( ) , 2 ) ; <nl> + BOOST_CHECK_EQUAL ( result . size ( ) , static_cast < size_t > ( 2 ) ) ; <nl> BOOST_CHECK_EQUAL ( result [ 0 ] . name , " foo " ) ; <nl> BOOST_CHECK_EQUAL ( result [ 0 ] . shouldExpand , false ) ; <nl> BOOST_CHECK_EQUAL ( result [ 1 ] . name , " bar " ) ; <nl> BOOST_AUTO_TEST_CASE ( test_expandedSubAttribute ) { <nl> <nl> TRI_ParseAttributeString ( input , result ) ; <nl> <nl> - BOOST_CHECK_EQUAL ( result . size ( ) , 2 ) ; <nl> + BOOST_CHECK_EQUAL ( result . size ( ) , static_cast < size_t > ( 2 ) ) ; <nl> BOOST_CHECK_EQUAL ( result [ 0 ] . name , " foo " ) ; <nl> BOOST_CHECK_EQUAL ( result [ 0 ] . shouldExpand , true ) ; <nl> BOOST_CHECK_EQUAL ( result [ 1 ] . name , " bar " ) ; <nl>
|
Fixed CLANG compiler warnings in UnitTests
|
arangodb/arangodb
|
5049c1dd23096ad20e8adcc81545398b85fb87bf
|
2015-08-19T13:25:41Z
|
mmm a / atom / browser / api / atom_api_web_contents . cc <nl> ppp b / atom / browser / api / atom_api_web_contents . cc <nl> struct Converter < PrintSettings > { <nl> <nl> template < > <nl> struct Converter < printing : : PrinterBasicInfo > { <nl> - static v8 : : Local < v8 : : Value > <nl> - ToV8 ( v8 : : Isolate * isolate , const printing : : PrinterBasicInfo & val ) { <nl> - mate : : Dictionary dict ( isolate , v8 : : Object : : New ( isolate ) ) ; <nl> - dict . Set ( " name " , val . printer_name ) ; <nl> - dict . Set ( " description " , val . printer_description ) ; <nl> - dict . Set ( " status " , val . printer_status ) ; <nl> - dict . Set ( " isDefault " , val . is_default ) ; <nl> - dict . Set ( " options " , val . options ) ; <nl> - return dict . GetHandle ( ) ; <nl> - } <nl> + static v8 : : Local < v8 : : Value > ToV8 ( v8 : : Isolate * isolate , <nl> + const printing : : PrinterBasicInfo & val ) { <nl> + mate : : Dictionary dict ( isolate , v8 : : Object : : New ( isolate ) ) ; <nl> + dict . Set ( " name " , val . printer_name ) ; <nl> + dict . Set ( " description " , val . printer_description ) ; <nl> + dict . Set ( " status " , val . printer_status ) ; <nl> + dict . Set ( " isDefault " , val . is_default ) ; <nl> + dict . Set ( " options " , val . options ) ; <nl> + return dict . GetHandle ( ) ; <nl> + } <nl> } ; <nl> <nl> template < > <nl> void WebContents : : Print ( mate : : Arguments * args ) { <nl> settings . device_name ) ; <nl> } <nl> <nl> - <nl> - std : : vector < printing : : PrinterBasicInfo > WebContents : : GetPrinterList ( <nl> - mate : : Arguments * args ) { <nl> + std : : vector < printing : : PrinterBasicInfo > WebContents : : GetPrinterList ( ) { <nl> std : : vector < printing : : PrinterBasicInfo > printers ; <nl> auto print_backend = printing : : PrintBackend : : CreateInstance ( nullptr ) ; <nl> print_backend - > EnumeratePrinters ( & printers ) ; <nl> mmm a / atom / browser / api / atom_api_web_contents . h <nl> ppp b / atom / browser / api / atom_api_web_contents . h <nl> class WebContents : public mate : : TrackableObject < WebContents > , <nl> void SetAudioMuted ( bool muted ) ; <nl> bool IsAudioMuted ( ) ; <nl> void Print ( mate : : Arguments * args ) ; <nl> - std : : vector < printing : : PrinterBasicInfo > GetPrinterList ( mate : : Arguments * args ) ; <nl> + std : : vector < printing : : PrinterBasicInfo > GetPrinterList ( ) ; <nl> void SetEmbedder ( const WebContents * embedder ) ; <nl> <nl> / / Print current page as PDF . <nl> mmm a / chromium_src / chrome / browser / printing / print_view_manager_base . h <nl> ppp b / chromium_src / chrome / browser / printing / print_view_manager_base . h <nl> class PrintViewManagerBase : public content : : NotificationObserver , <nl> / / this function . Returns false if printing is impossible at the moment . <nl> virtual bool PrintNow ( content : : RenderFrameHost * rfh , <nl> bool silent , bool print_background , <nl> - const base : : string16 & ) ; <nl> + const base : : string16 & device_name ) ; <nl> # endif / / ! DISABLE_BASIC_PRINTING <nl> <nl> / / PrintedPagesSource implementation . <nl> mmm a / chromium_src / chrome / browser / printing / printing_message_filter . cc <nl> ppp b / chromium_src / chrome / browser / printing / printing_message_filter . cc <nl> bool PrintingMessageFilter : : OnMessageReceived ( const IPC : : Message & message ) { <nl> # endif <nl> IPC_MESSAGE_HANDLER_DELAY_REPLY ( PrintHostMsg_GetDefaultPrintSettings , <nl> OnGetDefaultPrintSettings ) <nl> - <nl> IPC_MESSAGE_HANDLER_DELAY_REPLY ( PrintHostMsg_InitSettingWithDeviceName , <nl> - OnInitSettingWithDeviceName ) <nl> + OnInitSettingWithDeviceName ) <nl> IPC_MESSAGE_HANDLER_DELAY_REPLY ( PrintHostMsg_ScriptedPrint , OnScriptedPrint ) <nl> IPC_MESSAGE_HANDLER_DELAY_REPLY ( PrintHostMsg_UpdatePrintSettings , <nl> OnUpdatePrintSettings ) <nl> mmm a / chromium_src / chrome / browser / printing / printing_message_filter . h <nl> ppp b / chromium_src / chrome / browser / printing / printing_message_filter . h <nl> class PrintingMessageFilter : public content : : BrowserMessageFilter { <nl> <nl> / / Set deviceName <nl> void OnInitSettingWithDeviceName ( const base : : string16 & device_name , <nl> - IPC : : Message * reply_msg ) ; <nl> + IPC : : Message * reply_msg ) ; <nl> <nl> void OnGetDefaultPrintSettingsReply ( scoped_refptr < PrinterQuery > printer_query , <nl> IPC : : Message * reply_msg ) ; <nl> mmm a / chromium_src / chrome / renderer / printing / print_web_view_helper . cc <nl> ppp b / chromium_src / chrome / renderer / printing / print_web_view_helper . cc <nl> bool PrintWebViewHelper : : InitPrintSettings ( bool fit_to_paper_size , <nl> } <nl> <nl> bool PrintWebViewHelper : : CalculateNumberOfPages ( blink : : WebLocalFrame * frame , <nl> - const blink : : WebNode & node , int * number_of_pages , <nl> + const blink : : WebNode & node , <nl> + int * number_of_pages , <nl> const base : : string16 & device_name ) { <nl> DCHECK ( frame ) ; <nl> bool fit_to_paper_size = ! ( PrintingNodeOrPdfFrame ( frame , node ) ) ; <nl>
|
: art :
|
electron/electron
|
aa29bf8019571205989623f9a129b2d89b40b575
|
2017-05-18T17:26:22Z
|
mmm a / src / cascadia / CascadiaPackage / CascadiaPackage . wapproj <nl> ppp b / src / cascadia / CascadiaPackage / CascadiaPackage . wapproj <nl> <nl> < PropertyGroup Label = " Version " > <nl> < ! - - These fields are picked up by PackageES - - > <nl> < VersionMajor > 0 < / VersionMajor > <nl> - < VersionMinor > 2 < / VersionMinor > <nl> + < VersionMinor > 3 < / VersionMinor > <nl> < / PropertyGroup > <nl> < PropertyGroup Label = " Configuration " > <nl> < TargetPlatformVersion > 10 . 0 . 18362 . 0 < / TargetPlatformVersion > <nl> <nl> < / ItemGroup > <nl> < / Target > <nl> <nl> - < / Project > <nl> \ No newline at end of file <nl> + < / Project > <nl>
|
Update the package version to v0 . 3
|
microsoft/terminal
|
1afab788ab1d745159b0556a3f9d09eabe74cb9c
|
2019-07-30T23:35:08Z
|
mmm a / src / core / lib / surface / server . c <nl> ppp b / src / core / lib / surface / server . c <nl> void grpc_server_setup_transport ( grpc_exec_ctx * exec_ctx , grpc_server * s , <nl> crm - > server_registered_method = rm ; <nl> crm - > flags = rm - > flags ; <nl> crm - > has_host = has_host ; <nl> - if ( has_host ) { <nl> + if ( has_host ) { <nl> crm - > host = host ; <nl> } <nl> crm - > method = method ; <nl>
|
Correct formatting
|
grpc/grpc
|
a2b0e56823f0415912f964bff6a4ce02002dcb33
|
2017-02-21T19:33:40Z
|
mmm a / . ci / scripts / linux / docker . sh <nl> ppp b / . ci / scripts / linux / docker . sh <nl> ninja <nl> <nl> ccache - s <nl> <nl> - ctest - VV - C Release <nl> + # Ignore zlib ' s tests , since they aren ' t gated behind a CMake option . <nl> + ctest - VV - E " ( example | example64 ) " - C Release <nl> mmm a / . gitmodules <nl> ppp b / . gitmodules <nl> <nl> path = externals / sirit <nl> url = https : / / github . com / ReinUsesLisp / sirit <nl> [ submodule " libzip " ] <nl> - path = externals / libzip <nl> - url = https : / / github . com / DarkLordZach / libzip <nl> + path = externals / libzip <nl> + url = https : / / github . com / DarkLordZach / libzip <nl> [ submodule " zlib " ] <nl> - path = externals / zlib <nl> - url = https : / / github . com / DarkLordZach / zlib <nl> + path = externals / zlib <nl> + url = https : / / github . com / madler / zlib <nl> mmm a / externals / CMakeLists . txt <nl> ppp b / externals / CMakeLists . txt <nl> if ( ENABLE_VULKAN ) <nl> add_subdirectory ( sirit ) <nl> endif ( ) <nl> <nl> + # zlib <nl> + add_subdirectory ( zlib EXCLUDE_FROM_ALL ) <nl> + <nl> # libzip <nl> add_subdirectory ( libzip ) <nl> <nl> - # zlib <nl> - add_subdirectory ( zlib ) <nl> - <nl> if ( ENABLE_WEB_SERVICE ) <nl> # LibreSSL <nl> set ( LIBRESSL_SKIP_INSTALL ON CACHE BOOL " " ) <nl> mmm a / externals / zlib <nl> ppp b / externals / zlib <nl> @ @ - 1 + 1 @ @ <nl> - Subproject commit 094ed57db392170130bc710293568de7b576306d <nl> + Subproject commit cacf7f1d4e3d44d871b605da3b647f07d718623f <nl>
|
externals : Use upstream zlib
|
yuzu-emu/yuzu
|
80bdb44ead002e37eec935fb905c604e7d7a1d43
|
2019-10-04T09:01:57Z
|
mmm a / . cicd / platforms / pinned / amazon_linux - 2 - pinned . dockerfile <nl> ppp b / . cicd / platforms / pinned / amazon_linux - 2 - pinned . dockerfile <nl> RUN curl - L https : / / github . com / mongodb / mongo - cxx - driver / archive / r3 . 4 . 0 . tar . gz - o <nl> # add mongodb to path <nl> ENV PATH = $ { PATH } : / mongodb - linux - x86_64 - amazon - 3 . 6 . 3 / bin <nl> # install ccache <nl> - RUN yum install - y https : / / dl . fedoraproject . org / pub / epel / epel - release - latest - 7 . noarch . rpm & & yum install ccache <nl> \ No newline at end of file <nl> + RUN yum install - y https : / / dl . fedoraproject . org / pub / epel / epel - release - latest - 7 . noarch . rpm & & yum install - y ccache <nl> \ No newline at end of file <nl> mmm a / . cicd / platforms / unpinned / amazon_linux - 2 - unpinned . dockerfile <nl> ppp b / . cicd / platforms / unpinned / amazon_linux - 2 - unpinned . dockerfile <nl> RUN curl - L https : / / github . com / mongodb / mongo - cxx - driver / archive / r3 . 4 . 0 . tar . gz - o <nl> # add mongodb to path <nl> ENV PATH = $ { PATH } : / mongodb - linux - x86_64 - amazon - 3 . 6 . 3 / bin <nl> # install ccache <nl> - RUN yum install - y https : / / dl . fedoraproject . org / pub / epel / epel - release - latest - 7 . noarch . rpm & & yum install ccache <nl> \ No newline at end of file <nl> + RUN yum install - y https : / / dl . fedoraproject . org / pub / epel / epel - release - latest - 7 . noarch . rpm & & yum install - y ccache <nl> \ No newline at end of file <nl>
|
added - y to install
|
EOSIO/eos
|
d18bdbcd43dd188fb0589489898d700e800e7e67
|
2020-01-07T19:47:23Z
|
mmm a / src / Processors / QueryPlan / ITransformingStep . h <nl> ppp b / src / Processors / QueryPlan / ITransformingStep . h <nl> class ITransformingStep : public IQueryPlanStep <nl> struct TransformTraits <nl> { <nl> / / / Won ' t change the total number of rows . <nl> - / / / Examples : true ExpressionStep ( without join or array join ) , false for FilterStep <nl> + / / / Examples : true for ExpressionStep ( without join or array join ) , false for FilterStep <nl> bool preserves_number_of_rows ; <nl> } ; <nl> <nl>
|
Update ITransformingStep . h
|
ClickHouse/ClickHouse
|
b0b27e687f8486c432aac08e77b6043573ab79d9
|
2020-08-01T22:21:50Z
|
mmm a / lib / SILGen / SILGenDecl . cpp <nl> ppp b / lib / SILGen / SILGenDecl . cpp <nl> namespace { <nl> / / / An initialization of a local ' var ' . <nl> class LocalVariableInitialization : public SingleBufferInitialization { <nl> / / / The local variable decl being initialized . <nl> - VarDecl * Var ; <nl> - SILGenFunction & Gen ; <nl> + VarDecl * decl ; <nl> + SILGenFunction & SGF ; <nl> <nl> / / / The cleanup we pushed to deallocate the local variable before it <nl> / / / gets initialized . <nl> class LocalVariableInitialization : public SingleBufferInitialization { <nl> / / / Sets up an initialization for the allocated box . This pushes a <nl> / / / CleanupUninitializedBox cleanup that will be replaced when <nl> / / / initialization is completed . <nl> - LocalVariableInitialization ( VarDecl * var , SILGenFunction & gen ) <nl> - : Var ( var ) , Gen ( gen ) { <nl> + LocalVariableInitialization ( VarDecl * decl , bool NeedsMarkUninit , <nl> + SILGenFunction & SGF ) <nl> + : decl ( decl ) , SGF ( SGF ) { <nl> + assert ( decl - > getDeclContext ( ) - > isLocalContext ( ) & & <nl> + " can ' t emit a local var for a non - local var decl " ) ; <nl> + assert ( decl - > hasStorage ( ) & & " can ' t emit storage for a computed variable " ) ; <nl> + assert ( ! SGF . VarLocs . count ( decl ) & & " Already have an entry for this decl ? " ) ; <nl> + <nl> + SILType lType = SGF . getLoweredType ( decl - > getType ( ) - > getRValueType ( ) ) ; <nl> + <nl> + / / The variable may have its lifetime extended by a closure , heap - allocate <nl> + / / it using a box . <nl> + AllocBoxInst * allocBox = SGF . B . createAllocBox ( decl , lType ) ; <nl> + auto box = SILValue ( allocBox , 0 ) ; <nl> + auto addr = SILValue ( allocBox , 1 ) ; <nl> + <nl> + / / Mark the memory as uninitialized , so DI will track it for us . <nl> + if ( NeedsMarkUninit ) <nl> + addr = SGF . B . createMarkUninitializedVar ( decl , addr ) ; <nl> + <nl> + / / / Remember that this is the memory location that we ' re emitting the <nl> + / / / decl to . <nl> + SGF . VarLocs [ decl ] = SILGenFunction : : VarLoc : : get ( addr , box ) ; <nl> + <nl> / / Push a cleanup to destroy the local variable . This has to be <nl> / / inactive until the variable is initialized . <nl> - gen . Cleanups . pushCleanupInState < DestroyLocalVariable > ( CleanupState : : Dormant , <nl> - var ) ; <nl> - ReleaseCleanup = gen . Cleanups . getTopCleanup ( ) ; <nl> + SGF . Cleanups . pushCleanupInState < DestroyLocalVariable > ( CleanupState : : Dormant , <nl> + decl ) ; <nl> + ReleaseCleanup = SGF . Cleanups . getTopCleanup ( ) ; <nl> <nl> / / Push a cleanup to deallocate the local variable . <nl> - gen . Cleanups . pushCleanup < DeallocateUninitializedLocalVariable > ( var ) ; <nl> - DeallocCleanup = gen . Cleanups . getTopCleanup ( ) ; <nl> + SGF . Cleanups . pushCleanup < DeallocateUninitializedLocalVariable > ( decl ) ; <nl> + DeallocCleanup = SGF . Cleanups . getTopCleanup ( ) ; <nl> } <nl> <nl> ~ LocalVariableInitialization ( ) override { <nl> class LocalVariableInitialization : public SingleBufferInitialization { <nl> } <nl> <nl> SILValue getAddressOrNull ( ) const override { <nl> - assert ( Gen . VarLocs . count ( Var ) & & " did not emit var ? ! " ) ; <nl> - return Gen . VarLocs [ Var ] . value ; <nl> + assert ( SGF . VarLocs . count ( decl ) & & " did not emit var ? ! " ) ; <nl> + return SGF . VarLocs [ decl ] . value ; <nl> } <nl> <nl> - void finishInitialization ( SILGenFunction & gen ) override { <nl> + void finishInitialization ( SILGenFunction & SGF ) override { <nl> assert ( ! DidFinish & & <nl> " called LocalVariableInitialization : : finishInitialization twice ! " ) ; <nl> - Gen . Cleanups . setCleanupState ( DeallocCleanup , CleanupState : : Dead ) ; <nl> - Gen . Cleanups . setCleanupState ( ReleaseCleanup , CleanupState : : Active ) ; <nl> + SGF . Cleanups . setCleanupState ( DeallocCleanup , CleanupState : : Dead ) ; <nl> + SGF . Cleanups . setCleanupState ( ReleaseCleanup , CleanupState : : Active ) ; <nl> DidFinish = true ; <nl> } <nl> } ; <nl> void SILGenModule : : emitExternalDefinition ( Decl * d ) { <nl> / / / Create a LocalVariableInitialization for the uninitialized var . <nl> InitializationPtr SILGenFunction : : <nl> emitLocalVariableWithCleanup ( VarDecl * vd , bool NeedsMarkUninit ) { <nl> - assert ( vd - > getDeclContext ( ) - > isLocalContext ( ) & & <nl> - " can ' t emit a local var for a non - local var decl " ) ; <nl> - assert ( vd - > hasStorage ( ) & & " can ' t emit storage for a computed variable " ) ; <nl> - assert ( ! VarLocs . count ( vd ) & & " Already have an entry for this decl ? " ) ; <nl> - <nl> - SILType lType = getLoweredType ( vd - > getType ( ) - > getRValueType ( ) ) ; <nl> - <nl> - / / The variable may have its lifetime extended by a closure , heap - allocate it <nl> - / / using a box . <nl> - AllocBoxInst * allocBox = B . createAllocBox ( vd , lType ) ; <nl> - auto box = SILValue ( allocBox , 0 ) ; <nl> - auto addr = SILValue ( allocBox , 1 ) ; <nl> - <nl> - / / Mark the memory as uninitialized , so DI will track it for us . <nl> - if ( NeedsMarkUninit ) <nl> - addr = B . createMarkUninitializedVar ( vd , addr ) ; <nl> - <nl> - / / / Remember that this is the memory location that we ' re emitting the <nl> - / / / decl to . <nl> - VarLocs [ vd ] = SILGenFunction : : VarLoc : : get ( addr , box ) ; <nl> - <nl> - return InitializationPtr ( new LocalVariableInitialization ( vd , * this ) ) ; <nl> + return InitializationPtr ( new LocalVariableInitialization ( vd , NeedsMarkUninit , <nl> + * this ) ) ; <nl> } <nl> <nl> / / / Create an Initialization for an uninitialized temporary . <nl>
|
Now that emitLocalVariable is gone , we can merge all the complexity of
|
apple/swift
|
c41969809370750a15cadeca126cf31b9a6571d5
|
2015-04-22T00:25:43Z
|
mmm a / tensorflow / core / util / gpu_kernel_helper . h <nl> ppp b / tensorflow / core / util / gpu_kernel_helper . h <nl> __device__ EIGEN_ALWAYS_INLINE Eigen : : half GpuShuffleXorSync ( <nl> / / Aliased in gpu_device_functions . h <nl> # endif <nl> <nl> - namespace cuda_helper { <nl> + namespace gpu_helper { <nl> template < typename T , typename OutType = int32 > <nl> __device__ OutType upper_bound ( const T * first , OutType count , T val ) { <nl> const T * orig = first ; <nl> __device__ OutType lower_bound ( const T * first , OutType count , T val ) { <nl> return first - orig ; <nl> } <nl> <nl> - } / / namespace cuda_helper <nl> + } / / namespace gpu_helper <nl> + <nl> + # ifndef TENSORFLOW_USE_ROCM <nl> + namespace cuda_helper = gpu_helper ; <nl> + # endif <nl> + <nl> } / / namespace tensorflow <nl> <nl> # endif / / GOOGLE_CUDA | | TENSORFLOW_USE_ROCM <nl> mmm a / tensorflow / core / util / gpu_launch_config . h <nl> ppp b / tensorflow / core / util / gpu_launch_config . h <nl> inline GpuLaunchConfig GetGpuLaunchConfig ( int work_element_count , <nl> config . block_count = block_count ; <nl> return config ; <nl> } <nl> + # ifndef TENSORFLOW_USE_ROCM <nl> inline CudaLaunchConfig GetCudaLaunchConfig ( int work_element_count , <nl> const Eigen : : GpuDevice & d ) { <nl> return GetGpuLaunchConfig ( work_element_count , d ) ; <nl> } <nl> + # endif <nl> <nl> / / Calculate the GPU launch config we should use for a kernel launch . This <nl> / / variant takes the resource limits of func into account to maximize occupancy . <nl> inline Gpu2DLaunchConfig GetGpu2DLaunchConfig ( int xdim , int ydim , <nl> grid_x , std : : min ( max_blocks / grid_x , std : : max ( ydim / block_rows , 1 ) ) , 1 ) ; <nl> return config ; <nl> } <nl> + # ifndef TENSORFLOW_USE_ROCM <nl> inline Cuda2DLaunchConfig GetCuda2DLaunchConfig ( int xdim , int ydim , <nl> const Eigen : : GpuDevice & d ) { <nl> return GetGpu2DLaunchConfig ( xdim , ydim , d ) ; <nl> } <nl> + # endif <nl> <nl> / / Calculate the GPU 2D and 3D launch config we should use for a kernel launch . <nl> / / This variant takes the resource limits of func into account to maximize <nl>
|
Merge pull request from ROCmSoftwarePlatform : google_upstream_rocm_platform_fix_190518
|
tensorflow/tensorflow
|
bb6eee97e0181f432289f6355d6b766702865e61
|
2019-05-24T10:59:39Z
|
mmm a / Source / Common / Include / MultiversoWrapper . h <nl> ppp b / Source / Common / Include / MultiversoWrapper . h <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> <nl> ElemType * px = m_deltaArray + m_tableOffsets [ i ] ; <nl> mat . CopyToArray ( px , m_tableLength [ i ] ) ; <nl> + # pragma warning ( push ) <nl> + # pragma warning ( disable : 4244 ) <nl> <nl> + if ( m_traceLevel > 3 ) <nl> + { <nl> + int countnum = std : : count ( px , px + m_tableLength [ i ] , 0 . 0f ) ; <nl> + fprintf ( stderr , " \ t \ t ( model averaging ) zero number = % d \ n " , ( int ) countnum ) ; <nl> + fflush ( stderr ) ; <nl> + } <nl> + # pragma warning ( pop ) <nl> if ( m_isSparseArray [ i ] ) <nl> { <nl> size_t layerRowSize = mat . GetNumRows ( ) ; <nl> mmm a / Source / Readers / LibSVMBinaryReader / LibSVMBinaryReader . cpp <nl> ppp b / Source / Readers / LibSVMBinaryReader / LibSVMBinaryReader . cpp <nl> size_t SparseBinaryInput < ElemType > : : ReadMinibatch ( void * data_buffer , std : : map < st <nl> <nl> for ( int32_t c = 0 ; c < m_features . size ( ) ; c + + ) <nl> { <nl> + / / fprintf ( stderr , " read features % d . \ n " , c ) ; <nl> nnz = * ( int32_t * ) ( ( char * ) data_buffer + buffer_offset ) ; <nl> buffer_offset + = sizeof ( int32_t ) ; <nl> - fprintf ( stderr , " read features % d nnz = % d . \ n " , c , nnz ) ; <nl> <nl> ElemType * vals = ( ElemType * ) ( ( char * ) data_buffer + buffer_offset ) ; <nl> buffer_offset + = sizeof ( ElemType ) * nnz ; <nl>
|
Revert " adding debug info "
|
microsoft/CNTK
|
66995edf39fa58d4b8fabc1046487fb544c5df56
|
2016-05-24T12:51:32Z
|
mmm a / include / swift / SIL / SILConstants . h <nl> ppp b / include / swift / SIL / SILConstants . h <nl> <nl> # define SWIFT_SIL_CONSTANTS_H <nl> <nl> # include " swift / AST / SubstitutionMap . h " <nl> + # include " swift / SIL / SILInstruction . h " <nl> # include " swift / SIL / SILValue . h " <nl> # include " llvm / Support / CommandLine . h " <nl> <nl> class SymbolicValue { <nl> static SymbolicValue makeClosure ( <nl> SILFunction * target , <nl> ArrayRef < std : : pair < SILValue , Optional < SymbolicValue > > > capturedArguments , <nl> - SubstitutionMap substMap , SILType closureType , <nl> + SubstitutionMap substMap , SingleValueInstruction * closureInst , <nl> SymbolicValueAllocator & allocator ) ; <nl> <nl> SymbolicClosure * getClosure ( ) const { <nl> struct SymbolicClosure final <nl> / / applied function to the generic arguments of passed to the call . <nl> SubstitutionMap substitutionMap ; <nl> <nl> - SILType closureType ; <nl> + / / The closure instruction such as partial apply that resulted in this <nl> + / / symbolic value . This is tracked to obtain SILType and other SIL - level <nl> + / / information of the symbolic closure . <nl> + SingleValueInstruction * closureInst ; <nl> <nl> SymbolicClosure ( ) = delete ; <nl> SymbolicClosure ( const SymbolicClosure & ) = delete ; <nl> SymbolicClosure ( SILFunction * callee , unsigned numArguments , <nl> - SubstitutionMap substMap , SILType closureType , <nl> + SubstitutionMap substMap , SingleValueInstruction * inst , <nl> bool nonConstantCaptures ) <nl> : target ( callee ) , numCaptures ( numArguments ) , <nl> hasNonConstantCaptures ( nonConstantCaptures ) , substitutionMap ( substMap ) , <nl> - closureType ( closureType ) { } <nl> + closureInst ( inst ) { } <nl> <nl> public : <nl> static SymbolicClosure * create ( SILFunction * callee , <nl> ArrayRef < SymbolicClosureArgument > args , <nl> - SubstitutionMap substMap , SILType closureType , <nl> + SubstitutionMap substMap , <nl> + SingleValueInstruction * closureInst , <nl> SymbolicValueAllocator & allocator ) ; <nl> <nl> ArrayRef < SymbolicClosureArgument > getCaptures ( ) const { <nl> struct SymbolicClosure final <nl> return target ; <nl> } <nl> <nl> - SILType getClosureType ( ) { return closureType ; } <nl> + SingleValueInstruction * getClosureInst ( ) { return closureInst ; } <nl> + <nl> + SILType getClosureType ( ) { return closureInst - > getType ( ) ; } <nl> <nl> SubstitutionMap getCallSubstitutionMap ( ) { return substitutionMap ; } <nl> } ; <nl> mmm a / lib / SIL / SILConstants . cpp <nl> ppp b / lib / SIL / SILConstants . cpp <nl> SymbolicValue : : cloneInto ( SymbolicValueAllocator & allocator ) const { <nl> ArrayRef < SymbolicClosureArgument > closureArgs = clo - > getCaptures ( ) ; <nl> return SymbolicValue : : makeClosure ( clo - > getTarget ( ) , closureArgs , <nl> clo - > getCallSubstitutionMap ( ) , <nl> - clo - > getClosureType ( ) , allocator ) ; <nl> + clo - > getClosureInst ( ) , allocator ) ; <nl> } <nl> } <nl> llvm_unreachable ( " covered switch " ) ; <nl> Type SymbolicValue : : getArrayType ( ) const { <nl> SymbolicValue SymbolicValue : : makeClosure ( SILFunction * target , <nl> ArrayRef < SymbolicClosureArgument > args , <nl> SubstitutionMap substMap , <nl> - SILType closureType , <nl> + SingleValueInstruction * closureInst , <nl> SymbolicValueAllocator & allocator ) { <nl> auto clo = <nl> - SymbolicClosure : : create ( target , args , substMap , closureType , allocator ) ; <nl> + SymbolicClosure : : create ( target , args , substMap , closureInst , allocator ) ; <nl> SymbolicValue result ; <nl> result . representationKind = RK_Closure ; <nl> result . value . closure = clo ; <nl> SymbolicValue SymbolicValue : : makeClosure ( SILFunction * target , <nl> SymbolicClosure * SymbolicClosure : : create ( SILFunction * target , <nl> ArrayRef < SymbolicClosureArgument > args , <nl> SubstitutionMap substMap , <nl> - SILType closureType , <nl> + SingleValueInstruction * closureInst , <nl> SymbolicValueAllocator & allocator ) { <nl> / / Determine whether there are captured arguments without a symbolic value . <nl> bool hasNonConstantCapture = false ; <nl> SymbolicClosure * SymbolicClosure : : create ( SILFunction * target , <nl> auto rawMem = allocator . allocate ( byteSizeOfArgs , alignof ( SymbolicClosure ) ) ; <nl> / / Placement initialize the object . <nl> auto closure = : : new ( rawMem ) SymbolicClosure ( <nl> - target , args . size ( ) , substMap , closureType , hasNonConstantCapture ) ; <nl> + target , args . size ( ) , substMap , closureInst , hasNonConstantCapture ) ; <nl> std : : uninitialized_copy ( <nl> args . begin ( ) , args . end ( ) , <nl> closure - > getTrailingObjects < SymbolicClosureArgument > ( ) ) ; <nl> mmm a / lib / SILOptimizer / Utils / ConstExpr . cpp <nl> ppp b / lib / SILOptimizer / Utils / ConstExpr . cpp <nl> ConstExprFunctionState : : computeCallResult ( ApplyInst * apply ) { <nl> calleeFnType - > getWitnessMethodConformanceOrInvalid ( ) . getRequirement ( ) ; <nl> / / Compute a mapping that maps the Self type of the protocol given by <nl> / / ' requirement ' to the concrete type available in the substitutionMap . <nl> - auto protoSelfToConcreteType = <nl> - apply - > getSubstitutionMap ( ) . subst ( substitutionMap ) ; <nl> + SubstitutionMap applySubstMap = apply - > getSubstitutionMap ( ) ; <nl> + auto protoSelfToConcreteType = substitutionMap . empty ( ) <nl> + ? applySubstMap <nl> + : applySubstMap . subst ( substitutionMap ) ; <nl> / / Get a concrete protocol conformance by using the mapping for the <nl> / / Self type of the requirement . <nl> auto conf = protoSelfToConcreteType . lookupConformance ( <nl> ConstExprFunctionState : : computeCallResult ( ApplyInst * apply ) { <nl> / / or conformance , with the mapping introduced by the call itself . This <nl> / / ensures that the callee ' s substitution map can map from its type <nl> / / namespace back to concrete types and conformances . <nl> - calleeSubMap = callSubMap . subst ( substitutionMap ) ; <nl> + calleeSubMap = substitutionMap . empty ( ) ? callSubMap <nl> + : callSubMap . subst ( substitutionMap ) ; <nl> } <nl> <nl> / / Now that we have successfully folded all of the parameters , we can evaluate <nl> llvm : : Optional < SymbolicValue > ConstExprFunctionState : : evaluateClosureCreation ( <nl> } <nl> captures . push_back ( { capturedSILValue , capturedSymbolicValue } ) ; <nl> } <nl> - callSubstMap = papply - > getSubstitutionMap ( ) . subst ( this - > substitutionMap ) ; <nl> + SubstitutionMap applySubstMap = papply - > getSubstitutionMap ( ) ; <nl> + callSubstMap = substitutionMap . empty ( ) <nl> + ? applySubstMap <nl> + : applySubstMap . subst ( substitutionMap ) ; <nl> } <nl> <nl> - SILType closureType = closureInst - > getType ( ) ; <nl> - assert ( closureType . is < SILFunctionType > ( ) ) ; <nl> auto closureVal = SymbolicValue : : makeClosure ( <nl> - target , captures , callSubstMap , closureType , evaluator . getAllocator ( ) ) ; <nl> + target , captures , callSubstMap , closureInst , evaluator . getAllocator ( ) ) ; <nl> setValue ( closureInst , closureVal ) ; <nl> return None ; <nl> } <nl> mmm a / test / stdlib / OSLogPrototypeExecTest . swift <nl> ppp b / test / stdlib / OSLogPrototypeExecTest . swift <nl> InterpolationTestSuite . test ( " NSObject " ) { <nl> } ) <nl> } <nl> } <nl> + <nl> + / / A generic function . <nl> + func toString < T > ( _ subject : T ? ) - > String { <nl> + return " " <nl> + } <nl> + <nl> + protocol TestProto { <nl> + } <nl> + <nl> + InterpolationTestSuite . test ( " Interpolation of complex expressions " ) { <nl> + class TestClass < T : TestProto > : NSObject { <nl> + func testFunction ( ) { <nl> + / / The following call should no crash . <nl> + _checkFormatStringAndBuffer ( " A complex expression \ ( toString ( self ) ) " ) { <nl> + ( formatString , _ ) in <nl> + expectEqual ( " A complex expression % s " , formatString ) <nl> + } <nl> + } <nl> + } <nl> + } <nl>
|
Merge remote - tracking branch ' origin / master ' into master - next
|
apple/swift
|
702a96fd9b13fe40e9668cb239501bc2539f096c
|
2019-12-11T17:41:08Z
|
mmm a / tensorflow / compiler / xla / tests / BUILD <nl> ppp b / tensorflow / compiler / xla / tests / BUILD <nl> load ( " / / tensorflow / compiler / xla / tests : build_defs . bzl " , " generate_backend_test_ma <nl> # Generate test_suites for all backends , named " $ { backend } _tests " . <nl> generate_backend_suites ( ) <nl> <nl> + # Target to add main for tests . Do not link this target and <nl> + # / / third_party / tensorflow / core : test_main into the same target . <nl> + cc_library ( <nl> + name = " xla_internal_test_main " , <nl> + testonly = True , <nl> + srcs = [ " xla_internal_test_main . cc " ] , <nl> + deps = [ <nl> + " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> + " / / tensorflow / core : test " , <nl> + ] , <nl> + ) <nl> + <nl> cc_library ( <nl> name = " test_macros_header " , <nl> testonly = True , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> ) <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : xla_data_proto " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> ) <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> " / / tensorflow / compiler / xla / client / lib : arithmetic " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / service : platform_util " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> deps = [ <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> ) <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> " / / tensorflow / compiler / xla / client / lib : arithmetic " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> " / / tensorflow / compiler / xla / tests : test_utils " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : stream_executor_no_cuda " , <nl> " / / tensorflow / core : test " , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> " / / tensorflow / compiler / xla / client / lib : arithmetic " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> ) <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> " / / tensorflow / compiler / xla / client / lib : arithmetic " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> ] , <nl> ) <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> ] , <nl> ) <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : shape_util " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> " / / tensorflow / compiler / xla / tests : test_utils " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : framework_internal " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : shape_util " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> " / / tensorflow / compiler / xla / tests : test_utils " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : framework_internal " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : shape_util " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> " / / tensorflow / compiler / xla / tests : test_utils " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : framework_internal " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : xla_data_proto " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : hlo_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> ) <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : xla_data_proto " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> " / / tensorflow / compiler / xla / client : padding " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> " / / tensorflow / compiler / xla / client : padding " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> " / / tensorflow / compiler / xla / client : padding " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> " / / tensorflow / compiler / xla / client / lib : arithmetic " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / service : hlo " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : hlo_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : reference_util " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : array3d " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> ) <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / service : computation_placer " , <nl> " / / tensorflow / compiler / xla / service : device_memory_allocator " , <nl> " / / tensorflow / compiler / xla / service : local_service " , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / service : transfer_manager " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : stream_executor_no_cuda " , <nl> " / / tensorflow / core : test " , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> ) <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> " / / tensorflow / compiler / xla / client / lib : arithmetic " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> ) <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> " / / tensorflow / compiler / xla / client / lib : arithmetic " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test_library ( <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> " / / tensorflow / compiler / xla / client : padding " , <nl> " / / tensorflow / compiler / xla / client / lib : arithmetic " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> " / / tensorflow / compiler / xla / client : padding " , <nl> " / / tensorflow / compiler / xla / client / lib : arithmetic " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : literal_util " , <nl> " / / tensorflow / compiler / xla : util " , <nl> " / / tensorflow / compiler / xla : xla_data_proto " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / service : hlo " , <nl> " / / tensorflow / compiler / xla / tests : hlo_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : xla_data_proto " , <nl> " / / tensorflow / compiler / xla / client : computation " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : shape_util " , <nl> " / / tensorflow / compiler / xla : util " , <nl> " / / tensorflow / compiler / xla : xla_data_proto " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / service : hlo " , <nl> " / / tensorflow / compiler / xla / tests : hlo_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : reference_util " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> ) <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : test " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> ] , <nl> ) <nl> <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> " / / tensorflow / compiler / xla / client / lib : arithmetic " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> deps = [ <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> ) <nl> xla_test ( <nl> deps = [ <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> ) <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : xla_data_proto " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : array4d " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> " / / tensorflow / compiler / xla / client / lib : arithmetic " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : stream_executor_no_cuda " , <nl> " / / tensorflow / core : test " , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> ) <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : xla_data_proto " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : stream_executor_no_cuda " , <nl> " / / tensorflow / core : test " , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> " / / tensorflow / compiler / xla / tests : test_utils " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> deps = [ <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> " / / tensorflow / compiler / xla / tests : test_utils " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> " / / tensorflow / compiler / xla / tests : test_utils " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / service : session_proto " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : shape_util " , <nl> " / / tensorflow / compiler / xla : util " , <nl> " / / tensorflow / compiler / xla : xla_data_proto " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / service : hlo " , <nl> " / / tensorflow / compiler / xla / tests : hlo_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> ) <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : xla_data_proto " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / service : hlo " , <nl> " / / tensorflow / compiler / xla / service : platform_util " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : hlo_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / service : hlo " , <nl> " / / tensorflow / compiler / xla / service : platform_util " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : hlo_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> " / / tensorflow / compiler / xla / tests : test_utils " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : xla_data_proto " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : hlo_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla : shape_util " , <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : hlo_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> " / / tensorflow / compiler / xla / client : computation_builder " , <nl> " / / tensorflow / compiler / xla / client : global_data " , <nl> " / / tensorflow / compiler / xla / client : local_client " , <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> " / / tensorflow / compiler / xla / tests : literal_test_util " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : test " , <nl> ] , <nl> xla_test ( <nl> name = " deep_graph_test " , <nl> srcs = [ " deep_graph_test . cc " ] , <nl> deps = [ <nl> - " / / tensorflow / compiler / xla / legacy_flags : debug_options_flags " , <nl> " / / tensorflow / compiler / xla / tests : client_library_test_base " , <nl> + " / / tensorflow / compiler / xla / tests : xla_internal_test_main " , <nl> ] , <nl> ) <nl> <nl> mmm a / tensorflow / compiler / xla / tests / array_elementwise_ops_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / array_elementwise_ops_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> # include " tensorflow / compiler / xla / layout_util . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> # include " tensorflow / compiler / xla / test . h " <nl> INSTANTIATE_TEST_CASE_P ( ArrayElementwiseOpTestParamCount , <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / axpy_simple_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / axpy_simple_test . cc <nl> limitations under the License . <nl> <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / compiler / xla / tests / literal_test_util . h " <nl> # include " tensorflow / compiler / xla / tests / test_macros . h " <nl> TEST_F ( AxpySimpleTest , AxpyTenValues ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / bad_rng_shape_validation_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / bad_rng_shape_validation_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> # include " tensorflow / compiler / xla / test . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> TEST_F ( BadRngShapeValidationTest , ShapeWithoutLayoutIsOk ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / batch_normalization_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / batch_normalization_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / lib / arithmetic . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> # include " tensorflow / compiler / xla / service / hlo_computation . h " <nl> XLA_TEST_F ( BatchNormTest , DISABLED_ON_CPU_PARALLEL ( DISABLED_ON_CPU ( <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / binop_scaling_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / binop_scaling_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / array4d . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / compiler / xla / tests / literal_test_util . h " <nl> TEST_F ( BinopScalingTest , R4PlusR0S32 ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / broadcast_simple_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / broadcast_simple_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / array4d . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> # include " tensorflow / compiler / xla / test . h " <nl> XLA_TEST_F ( BroadcastSimpleTest , InvalidDegenerateBroadcasting ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / broadcast_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / broadcast_test . cc <nl> limitations under the License . <nl> # include < memory > <nl> # include < utility > <nl> <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / ptr_util . h " <nl> # include " tensorflow / compiler / xla / service / hlo_computation . h " <nl> TEST_F ( BroadcastTest , Broadcast_R3_2x3x4_to_R4_2x3x4x5 ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / call_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / call_test . cc <nl> limitations under the License . <nl> <nl> # include " tensorflow / compiler / xla / client / computation . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> # include " tensorflow / compiler / xla / test_helpers . h " <nl> XLA_TEST_F ( CallOpTest , DISABLED_ON_GPU ( CallR0F32Tuple ) ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / check_execution_arity_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / check_execution_arity_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> XLA_TEST_F ( CheckExecutionArityTest , CheckArgumentShapes ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / client_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / client_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> # include " tensorflow / compiler / xla / test_helpers . h " <nl> TEST_F ( ClientTest , ExecuteWithTupleLayout ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / compilation_cache_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / compilation_cache_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> XLA_TEST_F ( CompilationCacheTest , MutatedComputation ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / compute_constant_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / compute_constant_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / layout_util . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> # include " tensorflow / compiler / xla / status_macros . h " <nl> TEST_F ( ComputeConstantTest , DISABLED_ON_CPU ( ReuseComputedConstant ) ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / concat_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / concat_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> # include " tensorflow / compiler / xla / test . h " <nl> INSTANTIATE_TEST_CASE_P ( ConcatR2BinaryTestInstantiation , ConcatR2BinaryTest , <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / constants_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / constants_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / array4d . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / compiler / xla / tests / literal_test_util . h " <nl> TEST_F ( ConstantsTest , DISABLED_TupleConstant ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / convert_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / convert_test . cc <nl> limitations under the License . <nl> <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / compiler / xla / tests / literal_test_util . h " <nl> TEST_F ( ConvertTest , ConvertReshape ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / convolution_dimension_numbers_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / convolution_dimension_numbers_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> # include " tensorflow / compiler / xla / client / padding . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / ptr_util . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> XLA_TEST_F ( ConvolutionDimensionNumbersTest , <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / convolution_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / convolution_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> # include " tensorflow / compiler / xla / client / padding . h " <nl> # include " tensorflow / compiler / xla / layout_util . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / ptr_util . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> XLA_TEST_F ( ConvolutionTest , Convolve3D_1x4x2x3x3_2x2x2x3x3_Valid ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / convolution_variants_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / convolution_variants_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> # include " tensorflow / compiler / xla / client / padding . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> TEST_F ( ConvolutionVariantsTest , BackwardFilterEvenPadding3D ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / copy_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / copy_test . cc <nl> limitations under the License . <nl> # include < utility > <nl> <nl> # include " tensorflow / compiler / xla / array2d . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / ptr_util . h " <nl> # include " tensorflow / compiler / xla / service / hlo_computation . h " <nl> XLA_TEST_F ( CopyOpClientTest , Copy0x0 ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / custom_call_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / custom_call_test . cc <nl> limitations under the License . <nl> # include < memory > <nl> # include < utility > <nl> <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / ptr_util . h " <nl> # include " tensorflow / compiler / xla / service / hlo_computation . h " <nl> XLA_TEST_F ( CustomCallTest , <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / deallocation_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / deallocation_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> # include " tensorflow / compiler / xla / test . h " <nl> # include " tensorflow / compiler / xla / test_helpers . h " <nl> XLA_TEST_F ( DeallocationTest , DeallocateNestedTuple ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / deconstruct_tuple_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / deconstruct_tuple_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> XLA_TEST_F ( DeconstructTupleTest , DeconstructNestedTuple ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / deep_graph_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / deep_graph_test . cc <nl> See the License for the specific language governing permissions and <nl> limitations under the License . <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> <nl> namespace xla { <nl> TEST_F ( ClientLibraryTestBase , DeepGraph ) { <nl> } <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / dot_operation_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / dot_operation_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / array3d . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / primitive_util . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> TEST_F ( DotOperationTest , TransposeFolding ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / dynamic_ops_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / dynamic_ops_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> # include " tensorflow / compiler / xla / service / device_memory_allocator . h " <nl> # include " tensorflow / compiler / xla / service / local_service . h " <nl> BENCHMARK ( BM_DynamicSlice ) ; <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / floor_ceil_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / floor_ceil_test . cc <nl> limitations under the License . <nl> <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / compiler / xla / tests / literal_test_util . h " <nl> # include " tensorflow / compiler / xla / tests / test_macros . h " <nl> TEST_F ( FloorCeilTest , R0Ceil ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / fmax_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / fmax_test . cc <nl> limitations under the License . <nl> <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / compiler / xla / tests / literal_test_util . h " <nl> # include " tensorflow / core / platform / test . h " <nl> TEST_F ( FmaxSimpleTest , FmaxTenValues ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / fusion_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / fusion_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / client_library . h " <nl> # include " tensorflow / compiler / xla / client / computation . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / primitive_util . h " <nl> # include " tensorflow / compiler / xla / ptr_util . h " <nl> BENCHMARK ( BM_ParallelFusion ) ; <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - tensorflow : : testing : : RunBenchmarks ( ) ; <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / log_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / log_test . cc <nl> limitations under the License . <nl> <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / compiler / xla / tests / literal_test_util . h " <nl> # include " tensorflow / compiler / xla / tests / test_macros . h " <nl> TEST_F ( LogTest , LogTenValues ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / map_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / map_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / lib / arithmetic . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> TEST_F ( MapTestWithFullOpt , MapSquare ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / matrix_ops_simple_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / matrix_ops_simple_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / ptr_util . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> INSTANTIATE_TEST_CASE_P ( MatOpsDotAddTestInstances , MatOpsDotAddTest , <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / multidimensional_slice_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / multidimensional_slice_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / array3d . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / compiler / xla / tests / literal_test_util . h " <nl> # include " tensorflow / compiler / xla / tests / test_macros . h " <nl> XLA_TEST_F ( SliceTest , Slice3D ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / multioutput_fusion_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / multioutput_fusion_test . cc <nl> limitations under the License . <nl> <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / primitive_util . h " <nl> # include " tensorflow / compiler / xla / ptr_util . h " <nl> XLA_TEST_F ( MultiOutputFusionTest , DiffentTypesFusion ) { RunTest1D ( true , 8 ) ; } <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / pad_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / pad_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / lib / arithmetic . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / ptr_util . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> XLA_TEST_F ( PadTest , ReducePad ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / params_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / params_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> # include " tensorflow / compiler / xla / layout_util . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> XLA_TEST_F ( ParamsTest , R2_2x2_TryToPassReverseLayoutToParameter ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / pred_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / pred_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / lib / arithmetic . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / core / lib / core / status_test_util . h " <nl> # include " tensorflow / core / platform / test . h " <nl> TEST_F ( PredTest , AnyR2False ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / prng_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / prng_test . cc <nl> limitations under the License . <nl> <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / primitive_util . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> XLA_TEST_F ( PrngTest , RngUniformCrash ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / query_inferred_shape_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / query_inferred_shape_test . cc <nl> limitations under the License . <nl> <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> # include " tensorflow / compiler / xla / test_helpers . h " <nl> TEST_F ( QueryInferredShapeTest , OnePlusOneShape ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / reduce_precision_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / reduce_precision_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> # include " tensorflow / compiler / xla / layout_util . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / service / reduce_precision_insertion . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> XLA_TEST_F ( ReducePrecisionInsertionTest , ReducePrecisionAddedAfterFusion ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / reduce_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / reduce_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / lib / arithmetic . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> # include " tensorflow / compiler / xla / layout_util . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> XLA_TEST_F ( ReduceTest , DISABLED_ON_GPU ( OperationOnConstantAsInitValue ) ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / reduce_window_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / reduce_window_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / lib / arithmetic . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> # include " tensorflow / compiler / xla / client / padding . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> INSTANTIATE_TEST_CASE_P ( R1ReduceWindowTestInstantiation , R1ReduceWindowTest , <nl> R1ReduceWindowTestDataToString ) ; <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / replay_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / replay_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / protobuf_util . h " <nl> # include " tensorflow / compiler / xla / service / session . pb . h " <nl> TEST_F ( ReplayTest , MapPlusTwoOverR1 ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / reshape_motion_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / reshape_motion_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> # include " tensorflow / compiler / xla / layout_util . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> TEST_F ( ReshapeMotionTest , ElementwiseOfReshapesWithNonSameInputShapes ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / reshape_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / reshape_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> # include " tensorflow / compiler / xla / layout_util . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> XLA_TEST_F ( ReshapeTest , R4TwoMinorTransposeTrivialR2 ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / reverse_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / reverse_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / array4d . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / compiler / xla / tests / literal_test_util . h " <nl> # include " tensorflow / compiler / xla / tests / test_macros . h " <nl> TEST_F ( ReverseTest , Reverse4DFloatArrayOnDim01 ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / round_trip_packed_literal_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / round_trip_packed_literal_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> # include " tensorflow / compiler / xla / layout_util . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / packed_literal_reader . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> TEST_F ( RoundTripPackedLiteralTest , RoundTripsR2F32Size2x2Dim1Minor ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / round_trip_transfer_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / round_trip_transfer_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / array4d . h " <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> TEST_F ( RoundTripTransferTest , R4F32_Large ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / scalar_computations_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / scalar_computations_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / status_macros . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> TEST_F ( ScalarComputationsTest , SqrtF320 ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / select_and_scatter_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / select_and_scatter_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> # include " tensorflow / compiler / xla / client / padding . h " <nl> # include " tensorflow / compiler / xla / layout_util . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> # include " tensorflow / compiler / xla / status_macros . h " <nl> XLA_TEST_F ( SelectAndScatterTest , R1F32OverlappingWindowMinScatter ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / select_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / select_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / compiler / xla / tests / literal_test_util . h " <nl> # include " tensorflow / compiler / xla / tests / test_macros . h " <nl> TEST_F ( SelectTest , SelectR1F32WithScalarPredicateFalse ) { <nl> } <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / set_return_value_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / set_return_value_test . cc <nl> limitations under the License . <nl> <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / compiler / xla / tests / literal_test_util . h " <nl> # include " tensorflow / core / lib / core / status . h " <nl> TEST_F ( SetReturnValueTest , SetValueMultipleTimesAndModify ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / slice_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / slice_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / array2d . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / compiler / xla / tests / literal_test_util . h " <nl> INSTANTIATE_TEST_CASE_P ( <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / transpose_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / transpose_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / array2d . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / reference_util . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / compiler / xla / tests / hlo_test_base . h " <nl> TEST_F ( TransposeTest , TransposeConstant021_MultipleTilesPerLayer ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / tuple_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / tuple_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> XLA_TEST_F ( TupleTest , GetTupleElementOfNestedTuple ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / unary_op_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / unary_op_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / compiler / xla / tests / literal_test_util . h " <nl> # include " tensorflow / compiler / xla / tests / test_macros . h " <nl> TEST_F ( UnaryOpTest , SignAbsTestR2 ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / vector_ops_reduce_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / vector_ops_reduce_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / lib / arithmetic . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / tests / client_library_test_base . h " <nl> # include " tensorflow / compiler / xla / tests / literal_test_util . h " <nl> # include " tensorflow / compiler / xla / tests / test_macros . h " <nl> TEST_F ( VecOpsReduceTest , AddReduceR3F32AllDims ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / vector_ops_simple_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / vector_ops_simple_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / global_data . h " <nl> # include " tensorflow / compiler / xla / client / lib / arithmetic . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> # include " tensorflow / compiler / xla / statusor . h " <nl> # include " tensorflow / compiler / xla / test_helpers . h " <nl> XLA_TEST_F ( VecOpsSimpleTest , VectorPredicateNotEqual ) { <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / tensorflow / compiler / xla / tests / while_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / while_test . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> # include " tensorflow / compiler / xla / client / lib / arithmetic . h " <nl> # include " tensorflow / compiler / xla / client / local_client . h " <nl> - # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / service / platform_util . h " <nl> # include " tensorflow / compiler / xla / shape_util . h " <nl> BENCHMARK ( BM_WhileLoop ) ; <nl> <nl> } / / namespace <nl> } / / namespace xla <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - std : : vector < tensorflow : : Flag > flag_list ; <nl> - xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> - xla : : string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> - const bool parse_result = tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ; <nl> - if ( ! parse_result ) { <nl> - LOG ( ERROR ) < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - testing : : InitGoogleTest ( & argc , argv ) ; <nl> - if ( argc > 1 ) { <nl> - LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> - return 2 ; <nl> - } <nl> - tensorflow : : testing : : RunBenchmarks ( ) ; <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> new file mode 100644 <nl> index 0000000000000 . . c72245509fe2e <nl> mmm / dev / null <nl> ppp b / tensorflow / compiler / xla / tests / xla_internal_test_main . cc <nl> <nl> + / * Copyright 2017 The TensorFlow Authors . All Rights Reserved . <nl> + <nl> + Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + you may not use this file except in compliance with the License . <nl> + You may obtain a copy of the License at <nl> + <nl> + http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + <nl> + Unless required by applicable law or agreed to in writing , software <nl> + distributed under the License is distributed on an " AS IS " BASIS , <nl> + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + See the License for the specific language governing permissions and <nl> + limitations under the License . <nl> + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> + # include " tensorflow / compiler / xla / legacy_flags / debug_options_flags . h " <nl> + # include " tensorflow / core / platform / test . h " <nl> + <nl> + GTEST_API_ int main ( int argc , char * * argv ) { <nl> + std : : vector < tensorflow : : Flag > flag_list ; <nl> + xla : : legacy_flags : : AppendDebugOptionsFlags ( & flag_list ) ; <nl> + string usage = tensorflow : : Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> + if ( ! tensorflow : : Flags : : Parse ( & argc , argv , flag_list ) ) { <nl> + LOG ( ERROR ) < < " \ n " < < usage ; <nl> + return 2 ; <nl> + } <nl> + <nl> + testing : : InitGoogleTest ( & argc , argv ) ; <nl> + if ( argc > 1 ) { <nl> + LOG ( ERROR ) < < " Unknown argument " < < argv [ 1 ] < < " \ n " < < usage ; <nl> + return 2 ; <nl> + } <nl> + return RUN_ALL_TESTS ( ) ; <nl> + } <nl>
|
[ XLA ] Consolidate all similar main ( ) s in tests into a single target .
|
tensorflow/tensorflow
|
ddd8e21b7c1d23bf80ddf0141b44e168c17647f3
|
2017-07-27T17:12:25Z
|
mmm a / admin / static / js / reql_docs . json <nl> ppp b / admin / static / js / reql_docs . json <nl> <nl> " examples " : [ <nl> { <nl> " description " : " Call run on the connection with a query to execute the query . Run will return a cursor from which results may be retrieved . " , <nl> - " code " : " var cursor = conn . run ( r . table ( ' marvel ' ) ) ; " <nl> + " code " : " var cursor = conn . run ( r . table ( ' marvel ' ) , { } ) ; " <nl> } , { <nl> " description " : " You can pass a callback function to run which is invoked for each row . If the callback returns true , it gets called again for the next row . If the callback returns false , it will not be invoked again . " , <nl> " code " : " conn . run ( r . table ( ' marvel ' ) , function ( hero ) { \ n . . . \ n return true ; / / callback gets called again ; return false to stop being invoked \ n } ) " <nl>
|
Fixing js docs in reql doc
|
rethinkdb/rethinkdb
|
cf3f8ebff05d91047b4e754aae36d9b74d6fe1eb
|
2013-01-17T12:42:12Z
|
mmm a / hphp / doc / ir . specification <nl> ppp b / hphp / doc / ir . specification <nl> Instruction set <nl> <nl> 3 . Type conversions <nl> <nl> - To array conversions : <nl> - <nl> - | ConvBoolToArr , D ( PArr ) , S ( Bool ) , PRc <nl> - <nl> - | ConvDblToArr , D ( PArr ) , S ( Dbl ) , PRc <nl> - <nl> - | ConvIntToArr , D ( PArr ) , S ( Int ) , PRc <nl> - <nl> - | ConvObjToArr , D ( PArr ) , S ( Obj ) , PRc | CRc <nl> - <nl> - | ConvStrToArr , D ( PArr ) , S ( Str ) , PRc | CRc <nl> - <nl> - | ConvVecToArr , D ( PArr ) , S ( Vec ) , PRc | CRc <nl> - <nl> - | ConvDictToArr , D ( PArr ) , S ( Dict ) , PRc | CRc <nl> - <nl> - | ConvKeysetToArr , D ( PArr ) , S ( Keyset ) , PRc | CRc <nl> - <nl> - | ConvFuncToArr , D ( PArr ) , S ( Func ) , PRc <nl> - <nl> - | ConvClsMethToArr , D ( PArr ) , S ( ClsMeth ) , PRc | CRc <nl> - <nl> - | ConvTVToArr , D ( PArr ) , S ( Cell ) , PRc | CRc <nl> - <nl> - | ConvArrToNonDVArr , D ( PArr ) , S ( Arr ) , PRc | CRc <nl> - <nl> - <nl> To vec conversions : <nl> <nl> | ConvArrToVec , D ( Vec ) , S ( Arr ) , PRc | CRc <nl> To string conversions : <nl> <nl> Clear the IsBeingConstructed flag on the object . <nl> <nl> - | NewPlainArray , D ( PArr ) , C ( Int ) , PRc <nl> - <nl> - Allocate a new plain array ( that is , a non - dvarray ) with expected capacity S0 . <nl> - <nl> | NewDArray , DDArr , C ( Int ) , PRc <nl> <nl> Allocate a new dict - like array with the expected capacity S0 . <nl> To string conversions : <nl> array . Used to initialize an array allocated with AllocPackedArray or <nl> AllocVec that was too big to use a series of InitPackedLayoutArray ops . <nl> <nl> - | AllocStructArray < keys . . . > , D ( PArr ) , NA , PRc <nl> - <nl> | AllocStructDArray < keys . . . > , DDArr , NA , PRc <nl> <nl> | AllocStructDict < keys . . . > , D ( Dict ) , NA , PRc <nl> To string conversions : <nl> immediates for keys . This op initializes the header and hash table of the <nl> new array - like , but does not its elements ; use InitMixedLayoutArray for that . <nl> <nl> - | InitMixedLayoutArray < index , key > , ND , S ( Arr , Dict ) S ( Cell ) , NF <nl> + | InitMixedLayoutArray < index , key > , ND , S ( DArr , Dict ) S ( Cell ) , NF <nl> <nl> Initialize the element at position ` index ` in array S0 to have the string <nl> literal ` key ` as its key and S1 as its value . This instruction assumes that <nl> To string conversions : <nl> This instruction assumes it can take the values from the stack <nl> without increfing them . <nl> <nl> - | NewStructArray < offset , keys . . . > , D ( PArr ) , S ( StkPtr ) , PRc | CRc <nl> - <nl> | NewStructDArray < offset , keys . . . > , DDArr , S ( StkPtr ) , PRc | CRc <nl> <nl> | NewStructDict < offset , keys . . . > , D ( Dict ) , S ( StkPtr ) , PRc | CRc <nl> To string conversions : <nl> <nl> Concatenate S0 , S1 , S2 , and S3 . <nl> <nl> - | AddNewElem , DArrSet , S ( PArr , VArr , DArr ) S ( Cell ) , CRc | PRc <nl> + | AddNewElem , DArrSet , S ( VArr , DArr ) S ( Cell ) , CRc | PRc <nl> <nl> | AddNewElemKeyset , D ( Keyset ) , S ( Keyset ) S ( Cell ) , CRc | PRc <nl> <nl> mmm a / hphp / hack / src / hhbc / ast_constant_folder . ml <nl> ppp b / hphp / hack / src / hhbc / ast_constant_folder . ml <nl> let rec expr_to_typed_value ? ( allow_maps = false ) ns ( ( _ , expr_ ) as expr ) = <nl> | A . Call ( _ , ( _ , A . Id ( _ , id ) ) , _ , [ ( _ , A . String data ) ] , None ) <nl> when String . equal id SN . SpecialFunctions . hhas_adata - > <nl> TV . HhasAdata data <nl> - | A . Array fields - > array_to_typed_value ns fields <nl> | A . Varray ( _ , fields ) - > varray_to_typed_value ns fields pos <nl> | A . Darray ( _ , fields ) - > darray_to_typed_value ns fields pos <nl> ( * A . Id * ) <nl> and class_const_to_typed_value cid id = <nl> else <nl> raise UserDefinedConstant <nl> <nl> - and array_to_typed_value ns fields = <nl> - let update_max_index newindex maxindex = <nl> - if Int64 . compare newindex maxindex > = 0 then <nl> - Int64 . ( + ) newindex Int64 . one <nl> - else <nl> - maxindex <nl> - in <nl> - let default key value pairs maxindex = <nl> - let k_tv = key_expr_to_typed_value ns key in <nl> - let maxindex = <nl> - match k_tv with <nl> - | TV . Int newindex - > update_max_index newindex maxindex <nl> - | _ - > maxindex <nl> - in <nl> - ( ( k_tv , expr_to_typed_value ns value ) : : pairs , maxindex ) <nl> - in <nl> - let ( pairs , _ ) = <nl> - List . fold_left <nl> - fields <nl> - ~ init : ( [ ] , Int64 . zero ) <nl> - ~ f : ( fun ( pairs , maxindex ) afield - > <nl> - match afield with <nl> - | A . AFkvalue ( key , value ) - > default key value pairs maxindex <nl> - | A . AFvalue value - > <nl> - ( ( TV . Int maxindex , expr_to_typed_value ns value ) : : pairs , <nl> - Int64 . ( + ) maxindex Int64 . one ) ) <nl> - in <nl> - let a = update_duplicates_in_map @ @ List . rev pairs in <nl> - TV . Array a <nl> - <nl> and varray_to_typed_value ns fields pos = <nl> let tv_fields = List . map fields ~ f : ( expr_to_typed_value ns ) in <nl> TV . VArray ( tv_fields , Some pos ) <nl> let rec value_to_expr_ p v = <nl> | TV . Vec _ - > failwith " value_to_expr : vec NYI " <nl> | TV . Keyset _ - > failwith " value_to_expr : keyset NYI " <nl> | TV . HhasAdata _ - > failwith " value_to_expr : HhasAdata NYI " <nl> - | TV . Array pairs - > A . Array ( List . map pairs ( value_pair_to_afield p ) ) <nl> | TV . VArray ( values , _ ) - > A . Varray ( None , List . map values ( value_to_expr p ) ) <nl> | TV . DArray ( pairs , _ ) - > <nl> A . Darray <nl> mmm a / hphp / hack / src / hhbc / ast_constant_folder . rs <nl> ppp b / hphp / hack / src / hhbc / ast_constant_folder . rs <nl> <nl> / / This source code is licensed under the MIT license found in the <nl> / / LICENSE file in the " hack " directory of this source tree . <nl> use indexmap : : IndexMap ; <nl> - use std : : { cell : : Cell , collections : : hash_map : : RandomState , fmt , iter : : FromIterator } ; <nl> + use std : : { collections : : hash_map : : RandomState , fmt , iter : : FromIterator } ; <nl> <nl> use ast_class_expr_rust as ast_class_expr ; <nl> use ast_scope_rust as ast_scope ; <nl> fn class_const_to_typed_value ( <nl> Err ( Error : : UserDefinedConstant ) <nl> } <nl> <nl> - fn array_to_typed_value ( <nl> - emitter : & Emitter , <nl> - ns : & Namespace , <nl> - fields : & Vec < tast : : Afield > , <nl> - ) - > Result < TypedValue , Error > { <nl> - Ok ( TypedValue : : Array ( if fields . is_empty ( ) { <nl> - vec ! [ ] <nl> - } else { <nl> - let mut res = vec ! [ ] ; <nl> - let maxindex = Cell : : new ( 0 ) ; <nl> - <nl> - let update_max_index = | mut newindex | { <nl> - if newindex > = maxindex . get ( ) { <nl> - newindex + = 1 ; <nl> - maxindex . set ( newindex ) ; <nl> - } <nl> - } ; <nl> - let default = | key , value | { <nl> - let k_tv = key_expr_to_typed_value ( emitter , ns , key ) ? ; <nl> - if let TypedValue : : Int ( newindex ) = k_tv { <nl> - update_max_index ( newindex ) <nl> - } <nl> - Ok ( ( k_tv , expr_to_typed_value ( emitter , ns , value ) ? ) ) <nl> - } ; <nl> - for field in fields { <nl> - res . push ( match field { <nl> - tast : : Afield : : AFkvalue ( key , value ) = > default ( key , value ) ? , <nl> - tast : : Afield : : AFvalue ( value ) = > { <nl> - let index = maxindex . get ( ) ; <nl> - maxindex . set ( index + 1 ) ; <nl> - ( <nl> - TypedValue : : Int ( index ) , <nl> - expr_to_typed_value ( emitter , ns , value ) ? , <nl> - ) <nl> - } <nl> - } ) <nl> - } <nl> - res <nl> - } ) ) <nl> - } <nl> - <nl> fn varray_to_typed_value ( <nl> emitter : & Emitter , <nl> ns : & Namespace , <nl> pub fn expr_to_typed_value_ ( <nl> } <nl> } <nl> <nl> - Array ( fields ) = > array_to_typed_value ( emitter , ns , & fields ) , <nl> Varray ( fields ) = > varray_to_typed_value ( emitter , ns , & fields . 1 , pos ) , <nl> Darray ( fields ) = > darray_to_typed_value ( emitter , ns , & fields . 1 , pos ) , <nl> <nl> fn value_to_expr_ ( v : TypedValue ) - > Result < tast : : Expr_ , Error > { <nl> Vec ( _ ) = > return Err ( Error : : unrecoverable ( " value_to_expr : vec NYI " ) ) , <nl> Keyset ( _ ) = > return Err ( Error : : unrecoverable ( " value_to_expr : keyset NYI " ) ) , <nl> HhasAdata ( _ ) = > return Err ( Error : : unrecoverable ( " value_to_expr : HhasAdata NYI " ) ) , <nl> - Array ( pairs ) = > Expr_ : : Array ( <nl> - pairs <nl> - . into_iter ( ) <nl> - . map ( | ( v1 , v2 ) | Ok ( Afield : : AFkvalue ( value_to_expr ( v1 ) ? , value_to_expr ( v2 ) ? ) ) ) <nl> - . collect : : < Result < std : : vec : : Vec < _ > , Error > > ( ) ? , <nl> - ) , <nl> VArray ( ( values , _ ) ) = > Expr_ : : mk_varray ( <nl> None , <nl> values <nl> mmm a / hphp / hack / src / hhbc / emit_adata . ml <nl> ppp b / hphp / hack / src / hhbc / emit_adata . ml <nl> let rec adata_to_buffer b argument = <nl> | TV . Bool true - > Acc . add b " b : 1 ; " <nl> | TV . Int i - > Acc . add b @ @ " i : " ^ Int64 . to_string i ^ " ; " <nl> | TV . HhasAdata data - > Acc . add b ( String . escaped data ) <nl> - | TV . Array pairs - > <nl> - adata_dict_collection_argument_to_buffer b adata_array_prefix None pairs <nl> | TV . VArray ( values , loc ) - > <nl> adata_collection_argument_to_buffer b adata_varray_prefix loc values <nl> | TV . Vec ( values , loc ) - > <nl> let rewrite_typed_value tv = <nl> | s when String . equal s adata_dict_prefix - > Dict identifier <nl> | _ - > failwith ( " Unknown HhasAdata data : " ^ d ) <nl> end <nl> - | TV . Array _ - > Array ( get_array_identifier tv ) <nl> | TV . VArray _ when hack_arr_dv_arrs ( ) - > Vec ( get_array_identifier tv ) <nl> | TV . VArray _ - > Array ( get_array_identifier tv ) <nl> | TV . DArray _ when hack_arr_dv_arrs ( ) - > Dict ( get_array_identifier tv ) <nl> mmm a / hphp / hack / src / hhbc / emit_adata . rs <nl> ppp b / hphp / hack / src / hhbc / emit_adata . rs <nl> fn rewrite_typed_value ( e : & mut Emitter , instr : & mut Instruct ) - > Result < ( ) > { <nl> TV : : String ( s ) = > String ( s . to_owned ( ) ) , <nl> TV : : Float ( f ) = > Double ( string_utils : : float : : to_string ( * f ) ) , <nl> TV : : Keyset ( _ ) = > Keyset ( get_array_identifier ( e , tv ) ) , <nl> - TV : : Array ( _ ) = > Array ( get_array_identifier ( e , tv ) ) , <nl> TV : : VArray ( _ ) | TV : : DArray ( _ ) if ! hack_arr_dv_arrs = > { <nl> Array ( get_array_identifier ( e , tv ) ) <nl> } <nl> mmm a / hphp / hack / src / hhbc / emit_expression . ml <nl> ppp b / hphp / hack / src / hhbc / emit_expression . ml <nl> and emit_cast env pos hint expr = <nl> | _ when String . equal id SN . Typehints . int - > instr ( IOp CastInt ) <nl> | _ when String . equal id SN . Typehints . bool - > instr ( IOp CastBool ) <nl> | _ when String . equal id SN . Typehints . string - > instr ( IOp CastString ) <nl> - | _ when String . equal id SN . Typehints . array - > instr ( IOp CastArray ) <nl> | _ when String . equal id SN . Typehints . float - > instr ( IOp CastDouble ) <nl> | _ - > <nl> Emit_fatal . raise_fatal_parse <nl> and emit_struct_array env pos es ctor = <nl> gather <nl> [ gather @ @ List . map es ~ f : snd ; emit_pos pos ; ctor @ @ List . map es ~ f : fst ] <nl> <nl> - ( * isPackedInit ( ) returns true if this expression list looks like an <nl> - * array with no keys and no ref values * ) <nl> - and is_packed_init ? ( hack_arr_compat = true ) es = <nl> - let is_only_values = <nl> - List . for_all es ~ f : ( function <nl> - | A . AFkvalue _ - > false <nl> - | _ - > true ) <nl> - in <nl> - let keys_are_zero_indexed_properly_formed = <nl> - List . foldi es ~ init : true ~ f : ( fun i b f - > <nl> - b <nl> - & & <nl> - match f with <nl> - | A . AFkvalue ( ( _ , A . Int k ) , _ ) - > int_of_string k = i <nl> - ( * arrays with int - like string keys are still considered packed <nl> - and should be emitted via NewArray * ) <nl> - | A . AFkvalue ( ( _ , A . String k ) , _ ) when not hack_arr_compat - > <nl> - ( try int_of_string k = i with Failure _ - > false ) <nl> - ( * True and False are considered 1 and 0 , respectively * ) <nl> - | A . AFkvalue ( ( _ , A . True ) , _ ) - > i = 1 <nl> - | A . AFkvalue ( ( _ , A . False ) , _ ) - > i = 0 <nl> - | A . AFvalue _ - > true <nl> - | _ - > false ) <nl> - in <nl> - let has_bool_keys = <nl> - List . exists es ~ f : ( function <nl> - | A . AFkvalue ( ( _ , ( A . True | A . False ) ) , _ ) - > true <nl> - | _ - > false ) <nl> - in <nl> - ( is_only_values | | keys_are_zero_indexed_properly_formed ) <nl> - & & ( not ( has_bool_keys & & hack_arr_compat & & hack_arr_compat_notices ( ) ) ) <nl> - & & List . length es > 0 <nl> - <nl> and is_struct_init env es allow_numerics = <nl> let keys = ULS . empty in <nl> let ( are_all_keys_non_numeric_strings , keys ) = <nl> and emit_dynamic_collection env ( expr : Tast . expr ) es = <nl> NewDictArray count <nl> else <nl> NewDArray count ) <nl> - | _ - > <nl> - ( * From here on , we ' re only dealing with PHP arrays * ) <nl> - if is_packed_init es then <nl> - emit_value_only_collection env pos es ( fun n - > NewPackedArray n ) <nl> - else if is_struct_init env es false then <nl> - emit_struct_array env pos es instr_newstructarray <nl> - else if is_packed_init ~ hack_arr_compat : false es then <nl> - emit_keyvalue_collection CollectionType . Array env pos es ( NewArray count ) <nl> - else <nl> - emit_keyvalue_collection <nl> - CollectionType . Array <nl> - env <nl> - pos <nl> - es <nl> - ( NewMixedArray count ) <nl> + | _ - > failwith @ @ " plain PHP arrays cannot be constructed " <nl> <nl> and emit_named_collection_str env ( expr : Tast . expr ) pos name fields = <nl> let name = SU . Types . fix_casing @ @ SU . strip_ns name in <nl> mmm a / hphp / hack / src / hhbc / emit_expression . rs <nl> ppp b / hphp / hack / src / hhbc / emit_expression . rs <nl> use naming_special_names_rust : : { <nl> emitter_special_functions , fb , pseudo_consts , pseudo_functions , special_functions , <nl> special_idents , superglobals , typehints , user_attributes , <nl> } ; <nl> - use ocaml_helper : : int_of_str_opt ; <nl> - use options : : { CompilerFlags , HhvmFlags , LangFlags , Options } ; <nl> + use options : : { CompilerFlags , HhvmFlags , Options } ; <nl> use oxidized : : { <nl> aast , aast_defs , <nl> aast_visitor : : { visit , visit_mut , AstParams , Node , NodeMut , Visitor , VisitorMut } , <nl> fn emit_dynamic_collection ( <nl> Ok ( wrap_array_mark_legacy ( e , instrs ? ) ) <nl> } <nl> } <nl> - _ = > { <nl> - if is_packed_init ( e . options ( ) , fields , true / * hack_arr_compat * / ) { <nl> - emit_value_only_collection ( e , env , pos , fields , InstructLitConst : : NewPackedArray ) <nl> - } else if is_struct_init ( e , env , fields , false / * allow_numerics * / ) ? { <nl> - emit_struct_array ( e , env , pos , fields , | _ , x | Ok ( instr : : newstructarray ( x ) ) ) <nl> - } else if is_packed_init ( e . options ( ) , fields , false / * hack_arr_compat * / ) { <nl> - let constr = InstructLitConst : : NewArray ( count as isize ) ; <nl> - emit_keyvalue_collection ( e , env , pos , fields , CollectionType : : Array , constr ) <nl> - } else { <nl> - let constr = InstructLitConst : : NewMixedArray ( count as isize ) ; <nl> - emit_keyvalue_collection ( e , env , pos , fields , CollectionType : : Array , constr ) <nl> - } <nl> - } <nl> + _ = > Err ( unrecoverable ( " plain PHP arrays cannot be constructed " ) ) , <nl> } <nl> } <nl> <nl> - / / / is_packed_init ( ) returns true if this expression list looks like an <nl> - / / / array with no keys and no ref values <nl> - fn is_packed_init ( opts : & Options , es : & [ tast : : Afield ] , hack_arr_compat : bool ) - > bool { <nl> - let is_only_values = es . iter ( ) . all ( | f | ! f . is_afkvalue ( ) ) ; <nl> - let has_bool_keys = es . iter ( ) . any ( | f | { <nl> - f . as_afkvalue ( ) <nl> - . map ( | ( tast : : Expr ( _ , k ) , _ ) | k . is_true ( ) | | k . is_false ( ) ) <nl> - . is_some ( ) <nl> - } ) ; <nl> - let keys_are_zero_indexed_properly_formed = es . iter ( ) . enumerate ( ) . all ( | ( i , f ) | { <nl> - use tast : : { Afield as A , Expr as E , Expr_ as E_ } ; <nl> - match f { <nl> - A : : AFkvalue ( E ( _ , E_ : : Int ( k ) ) , _ ) = > int_of_str_opt ( k ) . unwrap ( ) = = i as i64 , / / already checked in lowerer <nl> - / / arrays with int - like string keys are still considered packed <nl> - / / and should be emitted via NewArray <nl> - A : : AFkvalue ( E ( _ , E_ : : String ( s ) ) , _ ) = > { <nl> - int_of_str_opt ( s ) . map_or ( false , | s | s = = i as i64 ) <nl> - } <nl> - A : : AFkvalue ( E ( _ , E_ : : True ) , _ ) = > i = = 1 , <nl> - A : : AFkvalue ( E ( _ , E_ : : False ) , _ ) = > i = = 0 , <nl> - A : : AFvalue ( _ ) = > true , <nl> - _ = > false , <nl> - } <nl> - } ) ; <nl> - ( is_only_values | | keys_are_zero_indexed_properly_formed ) <nl> - & & ( ! ( has_bool_keys <nl> - & & hack_arr_compat <nl> - & & opts . hhvm . flags . contains ( HhvmFlags : : HACK_ARR_COMPAT_NOTICES ) ) ) <nl> - & & ! es . is_empty ( ) <nl> - } <nl> - <nl> fn emit_value_only_collection < F : FnOnce ( isize ) - > InstructLitConst > ( <nl> e : & mut Emitter , <nl> env : & Env , <nl> fn emit_cast ( <nl> typehints : : BOOL = > instr : : cast_bool ( ) , <nl> typehints : : STRING = > instr : : cast_string ( ) , <nl> typehints : : FLOAT = > instr : : cast_double ( ) , <nl> - typehints : : ARRAY = > { <nl> - let disable_array_cast = e <nl> - . options ( ) <nl> - . hhvm <nl> - . hack_lang <nl> - . flags <nl> - . contains ( LangFlags : : DISABLE_ARRAY_CAST ) ; <nl> - if disable_array_cast { <nl> - return Err ( emit_fatal : : raise_fatal_parse ( <nl> - pos , <nl> - " ( array ) cast is no longer supported " , <nl> - ) ) ; <nl> - } else { <nl> - instr : : cast_array ( ) <nl> - } <nl> - } <nl> _ = > { <nl> return Err ( emit_fatal : : raise_fatal_parse ( <nl> pos , <nl> mmm a / hphp / hack / src / hhbc / hhbc_ast . ml <nl> ppp b / hphp / hack / src / hhbc / hhbc_ast . ml <nl> type instruct_lit_const = <nl> | Vec of adata_id <nl> | Dict of adata_id <nl> | Keyset of adata_id <nl> - | NewArray of int ( * capacity hint * ) <nl> - | NewMixedArray of int ( * capacity hint * ) <nl> | NewDictArray of int ( * capacity hint * ) <nl> | NewDArray of int ( * capacity hint * ) <nl> - | NewPackedArray of int <nl> - | NewStructArray of string list <nl> | NewStructDArray of string list <nl> | NewStructDict of string list <nl> | NewVArray of int <nl> type instruct_operator = <nl> | CastInt <nl> | CastDouble <nl> | CastString <nl> - | CastArray <nl> | CastVec <nl> | CastDict <nl> | CastKeyset <nl> mmm a / hphp / hack / src / hhbc / hhbc_ast . rs <nl> ppp b / hphp / hack / src / hhbc / hhbc_ast . rs <nl> pub enum InstructLitConst { <nl> Vec ( AdataId ) , <nl> Dict ( AdataId ) , <nl> Keyset ( AdataId ) , <nl> - NewArray ( isize ) , <nl> - / / / capacity hint <nl> - NewMixedArray ( isize ) , <nl> / / / capacity hint <nl> NewDictArray ( isize ) , <nl> / / / capacity hint <nl> NewDArray ( isize ) , <nl> - / / / capacity hint <nl> - NewPackedArray ( isize ) , <nl> - NewStructArray ( Vec < String > ) , <nl> NewStructDArray ( Vec < String > ) , <nl> NewStructDict ( Vec < String > ) , <nl> NewVArray ( isize ) , <nl> pub enum InstructOperator { <nl> CastInt , <nl> CastDouble , <nl> CastString , <nl> - CastArray , <nl> CastVec , <nl> CastDict , <nl> CastKeyset , <nl> mmm a / hphp / hack / src / hhbc / hhbc_hhas . ml <nl> ppp b / hphp / hack / src / hhbc / hhbc_hhas . ml <nl> let string_of_lit_const instruction = <nl> | NewVec i - > sep [ " NewVec " ; string_of_int i ] <nl> | NewVArray i - > sep [ " NewVArray " ; string_of_int i ] <nl> | NewDArray i - > sep [ " NewDArray " ; string_of_int i ] <nl> - | NewMixedArray i - > sep [ " NewMixedArray " ; string_of_int i ] <nl> - | NewPackedArray i - > sep [ " NewPackedArray " ; string_of_int i ] <nl> - | NewStructArray l - > <nl> - sep [ " NewStructArray " ; " < " ^ string_of_list_of_shape_fields l ^ " > " ] <nl> | NewStructDArray l - > <nl> sep [ " NewStructDArray " ; " < " ^ string_of_list_of_shape_fields l ^ " > " ] <nl> | NewStructDict l - > <nl> let string_of_lit_const instruction = <nl> | FuncCred - > " FuncCred " <nl> | NullUninit - > " NullUninit " <nl> | Method - > " Method " <nl> - | NewArray n - > sep [ " NewArray " ; string_of_int n ] <nl> | CnsE cnsid - > sep [ " CnsE " ; string_of_const_id cnsid ] <nl> <nl> let string_of_typestruct_resolve_op = function <nl> let string_of_operator instruction = <nl> | CastInt - > " CastInt " <nl> | CastDouble - > " CastDouble " <nl> | CastString - > " CastString " <nl> - | CastArray - > " CastArray " <nl> | CastVec - > " CastVec " <nl> | CastDict - > " CastDict " <nl> | CastKeyset - > " CastKeyset " <nl> mmm a / hphp / hack / src / hhbc / instruction_sequence . ml <nl> ppp b / hphp / hack / src / hhbc / instruction_sequence . ml <nl> let instr_clone = instr ( IOp Clone ) <nl> <nl> let instr_new_record id keys = instr ( ILitConst ( NewRecord ( id , keys ) ) ) <nl> <nl> - let instr_newstructarray keys = instr ( ILitConst ( NewStructArray keys ) ) <nl> - <nl> let instr_newstructdarray keys = instr ( ILitConst ( NewStructDArray keys ) ) <nl> <nl> let instr_newstructdict keys = instr ( ILitConst ( NewStructDict keys ) ) <nl> mmm a / hphp / hack / src / hhbc / instruction_sequence . rs <nl> ppp b / hphp / hack / src / hhbc / instruction_sequence . rs <nl> pub mod instr { <nl> instr ( Instruct : : IOp ( InstructOperator : : CastDArray ) ) <nl> } <nl> <nl> - pub fn cast_array ( ) - > InstrSeq { <nl> - instr ( Instruct : : IOp ( InstructOperator : : CastArray ) ) <nl> - } <nl> - <nl> pub fn cast_dict ( ) - > InstrSeq { <nl> instr ( Instruct : : IOp ( InstructOperator : : CastDict ) ) <nl> } <nl> pub mod instr { <nl> instr ( Instruct : : ILitConst ( InstructLitConst : : NewRecord ( id , keys ) ) ) <nl> } <nl> <nl> - pub fn newstructarray ( keys : Vec < String > ) - > InstrSeq { <nl> - instr ( Instruct : : ILitConst ( InstructLitConst : : NewStructArray ( keys ) ) ) <nl> - } <nl> - <nl> pub fn newstructdarray ( keys : Vec < String > ) - > InstrSeq { <nl> instr ( Instruct : : ILitConst ( InstructLitConst : : NewStructDArray ( keys ) ) ) <nl> } <nl> mmm a / hphp / hack / src / hhbc / print . rs <nl> ppp b / hphp / hack / src / hhbc / print . rs <nl> use env : : { iterator : : Id as IterId , local : : Type as Local , Env as BodyEnv } ; <nl> use escaper : : { escape , escape_by , is_lit_printable } ; <nl> use hhas_adata_rust : : HhasAdata ; <nl> use hhas_adata_rust : : { <nl> - ARRAY_PREFIX , DARRAY_PREFIX , DICT_PREFIX , KEYSET_PREFIX , LEGACY_DICT_PREFIX , LEGACY_VEC_PREFIX , <nl> + DARRAY_PREFIX , DICT_PREFIX , KEYSET_PREFIX , LEGACY_DICT_PREFIX , LEGACY_VEC_PREFIX , <nl> VARRAY_PREFIX , VEC_PREFIX , <nl> } ; <nl> use hhas_attribute_rust : : { self as hhas_attribute , HhasAttribute } ; <nl> fn print_adata < W : Write > ( ctx : & mut Context , w : & mut W , tv : & TypedValue ) - > Resul <nl> TypedValue : : DArray ( ( pairs , loc ) ) = > { <nl> print_adata_dict_collection_argument ( ctx , w , DARRAY_PREFIX , loc , pairs ) <nl> } <nl> - TypedValue : : Array ( pairs ) = > { <nl> - print_adata_dict_collection_argument ( ctx , w , ARRAY_PREFIX , & None , pairs ) <nl> - } <nl> TypedValue : : Keyset ( values ) = > { <nl> print_adata_collection_argument ( ctx , w , KEYSET_PREFIX , & None , values ) <nl> } <nl> fn print_lit_const < W : Write > ( w : & mut W , lit : & InstructLitConst ) - > Result < ( ) , W : <nl> w . write ( " Vec " ) ? ; <nl> print_adata_id ( w , id ) <nl> } <nl> - LC : : NewArray ( i ) = > concat_str_by ( w , " " , [ " NewArray " , i . to_string ( ) . as_str ( ) ] ) , <nl> - LC : : NewMixedArray ( i ) = > concat_str_by ( w , " " , [ " NewMixedArray " , i . to_string ( ) . as_str ( ) ] ) , <nl> LC : : NewDictArray ( i ) = > concat_str_by ( w , " " , [ " NewDictArray " , i . to_string ( ) . as_str ( ) ] ) , <nl> LC : : NewDArray ( i ) = > concat_str_by ( w , " " , [ " NewDArray " , i . to_string ( ) . as_str ( ) ] ) , <nl> - LC : : NewPackedArray ( i ) = > concat_str_by ( w , " " , [ " NewPackedArray " , i . to_string ( ) . as_str ( ) ] ) , <nl> LC : : NewVArray ( i ) = > concat_str_by ( w , " " , [ " NewVArray " , i . to_string ( ) . as_str ( ) ] ) , <nl> LC : : NewVec ( i ) = > concat_str_by ( w , " " , [ " NewVec " , i . to_string ( ) . as_str ( ) ] ) , <nl> LC : : NewKeysetArray ( i ) = > concat_str_by ( w , " " , [ " NewKeysetArray " , i . to_string ( ) . as_str ( ) ] ) , <nl> - LC : : NewStructArray ( l ) = > { <nl> - w . write ( " NewStructArray " ) ? ; <nl> - angle ( w , | w | print_shape_fields ( w , l ) ) <nl> - } <nl> LC : : NewStructDArray ( l ) = > { <nl> w . write ( " NewStructDArray " ) ? ; <nl> angle ( w , | w | print_shape_fields ( w , l ) ) <nl> fn print_op < W : Write > ( w : & mut W , op : & InstructOperator ) - > Result < ( ) , W : : Error > <nl> I : : CastInt = > w . write ( " CastInt " ) , <nl> I : : CastDouble = > w . write ( " CastDouble " ) , <nl> I : : CastString = > w . write ( " CastString " ) , <nl> - I : : CastArray = > w . write ( " CastArray " ) , <nl> I : : CastVec = > w . write ( " CastVec " ) , <nl> I : : CastDict = > w . write ( " CastDict " ) , <nl> I : : CastKeyset = > w . write ( " CastKeyset " ) , <nl> mmm a / hphp / hack / src / hhbc / typed_value . ml <nl> ppp b / hphp / hack / src / hhbc / typed_value . ml <nl> type t = <nl> | Null <nl> ( * Classic PHP arrays with explicit ( key , value ) entries * ) <nl> | HhasAdata of string <nl> - | Array of ( t * t ) list <nl> | VArray of t list * prov_tag <nl> | DArray of ( t * t ) list * prov_tag <nl> ( * Hack arrays : vectors , keysets , and dictionaries * ) <nl> let to_bool v = <nl> | Float f - > Float . ( f < > 0 . 0 ) <nl> ( * Empty collections cast to false * ) <nl> | Dict ( [ ] , _ ) <nl> - | Array [ ] <nl> | VArray ( [ ] , _ ) <nl> | DArray ( [ ] , _ ) <nl> | Keyset [ ] <nl> let to_bool v = <nl> ( * Non - empty collections cast to true * ) <nl> | HhasAdata _ <nl> | Dict ( _ , _ ) <nl> - | Array _ <nl> | VArray _ <nl> | DArray _ <nl> | Keyset _ <nl> let cast_to_arraykey v = <nl> | String s - > Some ( String s ) <nl> | Null - > Some ( String " " ) <nl> | Uninit <nl> - | Array _ <nl> | VArray _ <nl> | DArray _ <nl> | Vec _ <nl> mmm a / hphp / hack / src / hhbc / typed_value . rs <nl> ppp b / hphp / hack / src / hhbc / typed_value . rs <nl> pub enum TypedValue { <nl> Null , <nl> / / Classic PHP arrays with explicit ( key , value ) entries <nl> HhasAdata ( String ) , <nl> - Array ( Vec < ( TypedValue , TypedValue ) > ) , <nl> VArray ( ( Vec < Self > , ProvTag ) ) , <nl> DArray ( ( Vec < ( TypedValue , TypedValue ) > , ProvTag ) ) , <nl> / / Hack arrays : vectors , keysets , and dictionaries <nl> impl From < TypedValue > for bool { <nl> TypedValue : : Int ( i ) = > i ! = 0 , <nl> TypedValue : : Float ( f ) = > f . to_f64 ( ) ! = 0 . 0 , <nl> / / Empty collections cast to false if empty , otherwise true <nl> - TypedValue : : Array ( v ) = > ! v . is_empty ( ) , <nl> TypedValue : : VArray ( ( v , _ ) ) = > ! v . is_empty ( ) , <nl> TypedValue : : DArray ( ( v , _ ) ) = > ! v . is_empty ( ) , <nl> TypedValue : : Vec ( ( v , _ , _ ) ) = > ! v . is_empty ( ) , <nl> impl TypedValue { <nl> TypedValue : : String ( s ) = > Some ( Self : : String ( s ) ) , <nl> TypedValue : : Null = > Some ( Self : : String ( " " . into ( ) ) ) , <nl> TypedValue : : Uninit <nl> - | TypedValue : : Array ( _ ) <nl> | TypedValue : : VArray ( _ ) <nl> | TypedValue : : DArray ( _ ) <nl> | TypedValue : : Vec ( _ ) <nl> mmm a / hphp / hhbbc / dce . cpp <nl> ppp b / hphp / hhbbc / dce . cpp <nl> enum class Use { <nl> / * <nl> * Indicates that the stack slot contains an array - like being <nl> * constructed by AddElemCs , which looks like it can be optimized to <nl> - * a NewStructArray , NewPackedArray , or NewVec . <nl> + * a NewStructDArray , NewPackedVArray , or NewVec . <nl> * / <nl> AddElemC = 3 , <nl> <nl> void dce ( Env & env , const bc : : NullUninit & ) { pushRemovable ( env ) ; } <nl> void dce ( Env & env , const bc : : File & ) { pushRemovable ( env ) ; } <nl> void dce ( Env & env , const bc : : Dir & ) { pushRemovable ( env ) ; } <nl> void dce ( Env & env , const bc : : FuncCred & ) { pushRemovable ( env ) ; } <nl> - void dce ( Env & env , const bc : : NewArray & ) { pushRemovable ( env ) ; } <nl> void dce ( Env & env , const bc : : NewCol & ) { pushRemovable ( env ) ; } <nl> void dce ( Env & env , const bc : : CheckProp & ) { pushRemovable ( env ) ; } <nl> <nl> void dce ( Env & env , const bc : : Array & op ) { <nl> } ) ; <nl> } <nl> <nl> - void dce ( Env & env , const bc : : NewMixedArray & ) { <nl> - stack_ops ( env , [ & ] ( const UseInfo & ui ) { <nl> - if ( ui . usage = = Use : : AddElemC | | allUnused ( ui ) ) { <nl> - env . dceState . didAddOpts = true ; <nl> - return PushFlags : : MarkUnused ; <nl> - } <nl> - <nl> - return PushFlags : : MarkLive ; <nl> - } ) ; <nl> - } <nl> - <nl> void dce ( Env & env , const bc : : NewDictArray & ) { <nl> stack_ops ( env , [ & ] ( const UseInfo & ui ) { <nl> if ( ui . usage = = Use : : AddElemC | | allUnused ( ui ) ) { <nl> void dce ( Env & env , const bc : : AddElemC & / * op * / ) { <nl> CompactVector < Bytecode > bcs ; <nl> if ( cat . cat = = Type : : ArrayCat : : Struct & & <nl> * postSize < = ArrayData : : MaxElemsOnStack ) { <nl> - if ( arrPost . subtypeOf ( BPArrN ) ) { <nl> - bcs . emplace_back ( bc : : NewStructArray { get_string_keys ( arrPost ) } ) ; <nl> - } else if ( arrPost . subtypeOf ( BDArrN ) ) { <nl> + if ( arrPost . subtypeOf ( BDArrN ) ) { <nl> bcs . emplace_back ( bc : : NewStructDArray { get_string_keys ( arrPost ) } ) ; <nl> } else { <nl> return PushFlags : : MarkLive ; <nl> } <nl> } else if ( cat . cat = = Type : : ArrayCat : : Packed & & <nl> * postSize < = ArrayData : : MaxElemsOnStack ) { <nl> - if ( arrPost . subtypeOf ( BPArrN ) ) { <nl> - bcs . emplace_back ( <nl> - bc : : NewPackedArray { static_cast < uint32_t > ( * postSize ) } <nl> - ) ; <nl> - } else if ( arrPost . subtypeOf ( BVArrN ) ) { <nl> + if ( arrPost . subtypeOf ( BVArrN ) ) { <nl> bcs . emplace_back ( <nl> bc : : NewVArray { static_cast < uint32_t > ( * postSize ) } <nl> ) ; <nl> void dceNewArrayLike ( Env & env , const Op & op ) { <nl> pushRemovableIfNoThrow ( env ) ; <nl> } <nl> <nl> - void dce ( Env & env , const bc : : NewPackedArray & op ) { dceNewArrayLike ( env , op ) ; } <nl> - void dce ( Env & env , const bc : : NewStructArray & op ) { dceNewArrayLike ( env , op ) ; } <nl> void dce ( Env & env , const bc : : NewStructDArray & op ) { dceNewArrayLike ( env , op ) ; } <nl> void dce ( Env & env , const bc : : NewStructDict & op ) { dceNewArrayLike ( env , op ) ; } <nl> void dce ( Env & env , const bc : : NewVec & op ) { dceNewArrayLike ( env , op ) ; } <nl> void dce ( Env & env , const bc : : BitAnd & ) { pushRemovableIfNoThrow ( env ) ; } <nl> void dce ( Env & env , const bc : : BitNot & ) { pushRemovableIfNoThrow ( env ) ; } <nl> void dce ( Env & env , const bc : : BitOr & ) { pushRemovableIfNoThrow ( env ) ; } <nl> void dce ( Env & env , const bc : : BitXor & ) { pushRemovableIfNoThrow ( env ) ; } <nl> - void dce ( Env & env , const bc : : CastArray & ) { pushRemovableIfNoThrow ( env ) ; } <nl> void dce ( Env & env , const bc : : CastBool & ) { pushRemovableIfNoThrow ( env ) ; } <nl> void dce ( Env & env , const bc : : CastDArray & ) { pushRemovableIfNoThrow ( env ) ; } <nl> void dce ( Env & env , const bc : : CastDict & ) { pushRemovableIfNoThrow ( env ) ; } <nl> mmm a / hphp / hhbbc / interp . cpp <nl> ppp b / hphp / hhbbc / interp . cpp <nl> bool poppable ( Op op ) { <nl> case Op : : Vec : <nl> case Op : : Dict : <nl> case Op : : Keyset : <nl> - case Op : : NewArray : <nl> case Op : : NewDArray : <nl> - case Op : : NewMixedArray : <nl> case Op : : NewDictArray : <nl> case Op : : NewCol : <nl> return true ; <nl> void in ( ISS & env , const bc : : Keyset & op ) { <nl> push ( env , keyset_val ( op . arr1 ) ) ; <nl> } <nl> <nl> - void in ( ISS & env , const bc : : NewArray & op ) { <nl> - effect_free ( env ) ; <nl> - push ( env , op . arg1 = = 0 ? aempty ( ) : some_aempty ( ) ) ; <nl> - } <nl> - <nl> void in ( ISS & env , const bc : : NewDictArray & op ) { <nl> effect_free ( env ) ; <nl> push ( env , op . arg1 = = 0 ? dict_empty ( provTagHere ( env ) ) <nl> : some_dict_empty ( provTagHere ( env ) ) ) ; <nl> } <nl> <nl> - void in ( ISS & env , const bc : : NewMixedArray & op ) { <nl> - effect_free ( env ) ; <nl> - push ( env , op . arg1 = = 0 ? aempty ( ) : some_aempty ( ) ) ; <nl> - } <nl> - <nl> - void in ( ISS & env , const bc : : NewPackedArray & op ) { <nl> - auto elems = std : : vector < Type > { } ; <nl> - elems . reserve ( op . arg1 ) ; <nl> - for ( auto i = uint32_t { 0 } ; i < op . arg1 ; + + i ) { <nl> - elems . push_back ( std : : move ( topC ( env , op . arg1 - i - 1 ) ) ) ; <nl> - } <nl> - discard ( env , op . arg1 ) ; <nl> - push ( env , arr_packed ( std : : move ( elems ) ) ) ; <nl> - constprop ( env ) ; <nl> - } <nl> - <nl> void in ( ISS & env , const bc : : NewVArray & op ) { <nl> assertx ( ! RuntimeOption : : EvalHackArrDVArrs ) ; <nl> auto elems = std : : vector < Type > { } ; <nl> void in ( ISS & env , const bc : : NewRecord & op ) { <nl> push ( env , rrec ? exactRecord ( * rrec ) : TRecord ) ; <nl> } <nl> <nl> - void in ( ISS & env , const bc : : NewStructArray & op ) { <nl> - auto map = MapElems { } ; <nl> - for ( auto it = op . keys . end ( ) ; it ! = op . keys . begin ( ) ; ) { <nl> - map . emplace_front ( make_tv < KindOfPersistentString > ( * - - it ) , popC ( env ) ) ; <nl> - } <nl> - push ( env , arr_map ( std : : move ( map ) ) ) ; <nl> - effect_free ( env ) ; <nl> - constprop ( env ) ; <nl> - } <nl> - <nl> void in ( ISS & env , const bc : : NewStructDArray & op ) { <nl> assertx ( ! RuntimeOption : : EvalHackArrDVArrs ) ; <nl> auto map = MapElems { } ; <nl> void in ( ISS & env , const bc : : CastString & ) { <nl> castImpl ( env , TStr , tvCastToStringInPlace ) ; <nl> } <nl> <nl> - void in ( ISS & env , const bc : : CastArray & ) { <nl> - castImpl ( env , TPArr , tvCastToArrayInPlace ) ; <nl> - } <nl> - <nl> void in ( ISS & env , const bc : : CastDict & ) { <nl> arrprov : : TagOverride tag_override { provTagHere ( env ) . get ( ) } ; <nl> castImpl ( env , TDict , tvCastToDictInPlace ) ; <nl> mmm a / hphp / hhbbc / optimize . cpp <nl> ppp b / hphp / hhbbc / optimize . cpp <nl> bool hasObviousStackOutput ( const Bytecode & op , const Interp & interp ) { <nl> case Op : : Dict : <nl> case Op : : Vec : <nl> case Op : : Keyset : <nl> - case Op : : NewArray : <nl> case Op : : NewDArray : <nl> case Op : : NewDictArray : <nl> - case Op : : NewPackedArray : <nl> case Op : : NewVArray : <nl> - case Op : : NewStructArray : <nl> case Op : : NewStructDArray : <nl> case Op : : NewStructDict : <nl> case Op : : NewVec : <nl> bool hasObviousStackOutput ( const Bytecode & op , const Interp & interp ) { <nl> case Op : : CastInt : <nl> case Op : : CastDouble : <nl> case Op : : CastString : <nl> - case Op : : CastArray : <nl> case Op : : CastDict : <nl> case Op : : CastVec : <nl> case Op : : CastKeyset : <nl> mmm a / hphp / runtime / base / mixed - array . cpp <nl> ppp b / hphp / runtime / base / mixed - array . cpp <nl> MixedArray * MixedArray : : MakeStructImpl ( uint32_t size , <nl> return ad ; <nl> } <nl> <nl> - MixedArray * MixedArray : : MakeStruct ( uint32_t size , <nl> - const StringData * const * keys , <nl> - const TypedValue * values ) { <nl> - return MakeStructImpl ( size , keys , values , HeaderKind : : Plain ) ; <nl> - } <nl> - <nl> MixedArray * MixedArray : : MakeStructDict ( uint32_t size , <nl> const StringData * const * keys , <nl> const TypedValue * values ) { <nl> MixedArray * MixedArray : : AllocStructImpl ( uint32_t size , <nl> return ad ; <nl> } <nl> <nl> - MixedArray * MixedArray : : AllocStruct ( uint32_t size , const int32_t * hash ) { <nl> - return AllocStructImpl ( size , hash , HeaderKind : : Plain ) ; <nl> - } <nl> - <nl> MixedArray * MixedArray : : AllocStructDict ( uint32_t size , const int32_t * hash ) { <nl> auto const ad = AllocStructImpl ( size , hash , HeaderKind : : Dict ) ; <nl> return asMixed ( tagArrProv ( ad ) ) ; <nl> MixedArray * MixedArray : : MakeMixedImpl ( uint32_t size , const TypedValue * kvs ) { <nl> return ad ; <nl> } <nl> <nl> - MixedArray * MixedArray : : MakeMixed ( uint32_t size , const TypedValue * kvs ) { <nl> - auto const ad = MakeMixedImpl < HeaderKind : : Plain > ( size , kvs ) ; <nl> - assertx ( ad = = nullptr | | ad - > kind ( ) = = kMixedKind ) ; <nl> - assertx ( ad = = nullptr | | ad - > isNotDVArray ( ) ) ; <nl> - return ad ; <nl> - } <nl> - <nl> MixedArray * MixedArray : : MakeDArray ( uint32_t size , const TypedValue * kvs ) { <nl> if ( RuntimeOption : : EvalHackArrDVArrs ) return MakeDict ( size , kvs ) ; <nl> <nl> mmm a / hphp / runtime / base / mixed - array . h <nl> ppp b / hphp / runtime / base / mixed - array . h <nl> struct MixedArray final : ArrayData , <nl> * natural order . Returns nullptr if there are duplicate keys . Does not check <nl> * for integer - like keys . Takes ownership of keys and values iff successful . <nl> * / <nl> - static MixedArray * MakeMixed ( uint32_t size , const TypedValue * kvs ) ; <nl> static MixedArray * MakeDArray ( uint32_t size , const TypedValue * kvs ) ; <nl> static MixedArray * MakeDict ( uint32_t size , const TypedValue * kvs ) ; <nl> private : <nl> struct MixedArray final : ArrayData , <nl> * Like MakePacked , but given static strings , make a struct - like array . <nl> * Also requires size > 0 . <nl> * / <nl> - static MixedArray * MakeStruct ( uint32_t size , const StringData * const * keys , <nl> - const TypedValue * values ) ; <nl> static MixedArray * MakeStructDict ( uint32_t size , <nl> const StringData * const * keys , <nl> const TypedValue * values ) ; <nl> struct MixedArray final : ArrayData , <nl> * Allocate a struct - like array ( with string literal keys ) , but only init <nl> * the hash table and the header , leaving elms uninit . Requires size > 0 . <nl> * / <nl> - static MixedArray * AllocStruct ( uint32_t size , const int32_t * hash ) ; <nl> static MixedArray * AllocStructDict ( uint32_t size , const int32_t * hash ) ; <nl> static MixedArray * AllocStructDArray ( uint32_t size , const int32_t * hash ) ; <nl> <nl> mmm a / hphp / runtime / vm / bytecode . cpp <nl> ppp b / hphp / runtime / vm / bytecode . cpp <nl> OPTBLD_INLINE void iopKeyset ( const ArrayData * a ) { <nl> vmStack ( ) . pushStaticKeyset ( bespoke : : maybeEnableLogging ( a ) ) ; <nl> } <nl> <nl> - OPTBLD_INLINE void iopNewArray ( uint32_t capacity ) { <nl> - auto const ad = capacity ? MixedArray : : MakeReserveMixed ( capacity ) <nl> - : ArrayData : : Create ( ) ; <nl> - vmStack ( ) . pushArrayNoRc ( bespoke : : maybeEnableLogging ( ad ) ) ; <nl> - } <nl> - <nl> - OPTBLD_INLINE void iopNewMixedArray ( uint32_t capacity ) { <nl> - iopNewArray ( capacity ) ; <nl> - } <nl> - <nl> OPTBLD_INLINE void iopNewDictArray ( uint32_t capacity ) { <nl> auto const ad = capacity ? MixedArray : : MakeReserveDict ( capacity ) <nl> : ArrayData : : CreateDict ( ) ; <nl> vmStack ( ) . pushDictNoRc ( bespoke : : maybeEnableLogging ( ad ) ) ; <nl> } <nl> <nl> - OPTBLD_INLINE void iopNewPackedArray ( uint32_t n ) { <nl> - / / This constructor moves values , no inc / decref is necessary . <nl> - auto vec = PackedArray : : MakeVec ( n , vmStack ( ) . topC ( ) ) ; <nl> - auto arr = PackedArray : : ToPHPArrayVec ( vec , vec - > cowCheck ( ) ) ; <nl> - if ( arr ! = vec ) decRefArr ( vec ) ; <nl> - vmStack ( ) . ndiscard ( n ) ; <nl> - vmStack ( ) . pushArrayNoRc ( bespoke : : maybeEnableLogging ( arr ) ) ; <nl> - } <nl> - <nl> namespace { <nl> <nl> template < typename F > <nl> ArrayData * newStructArrayImpl ( imm_array < int32_t > ids , F f ) { <nl> <nl> } <nl> <nl> - OPTBLD_INLINE void iopNewStructArray ( imm_array < int32_t > ids ) { <nl> - auto const ad = newStructArrayImpl ( ids , MixedArray : : MakeStruct ) ; <nl> - vmStack ( ) . pushArrayNoRc ( bespoke : : maybeEnableLogging ( ad ) ) ; <nl> - } <nl> - <nl> OPTBLD_INLINE void iopNewStructDArray ( imm_array < int32_t > ids ) { <nl> assertx ( ! RuntimeOption : : EvalHackArrDVArrs ) ; <nl> auto const ad = newStructArrayImpl ( ids , MixedArray : : MakeStructDArray ) ; <nl> OPTBLD_INLINE void iopCastString ( ) { <nl> tvCastToStringInPlace ( c1 ) ; <nl> } <nl> <nl> - OPTBLD_INLINE void iopCastArray ( ) { <nl> - TypedValue * c1 = vmStack ( ) . topC ( ) ; <nl> - tvCastToArrayInPlace ( c1 ) ; <nl> - } <nl> - <nl> OPTBLD_INLINE void iopCastDict ( ) { <nl> TypedValue * c1 = vmStack ( ) . topC ( ) ; <nl> tvCastToDictInPlace ( c1 ) ; <nl> mmm a / hphp / runtime / vm / hhbc . h <nl> ppp b / hphp / runtime / vm / hhbc . h <nl> constexpr uint32_t kMaxConcatN = 4 ; <nl> O ( Dict , ONE ( AA ) , NOV , ONE ( CV ) , NF ) \ <nl> O ( Keyset , ONE ( AA ) , NOV , ONE ( CV ) , NF ) \ <nl> O ( Vec , ONE ( AA ) , NOV , ONE ( CV ) , NF ) \ <nl> - O ( NewArray , ONE ( IVA ) , NOV , ONE ( CV ) , NF ) \ <nl> - O ( NewMixedArray , ONE ( IVA ) , NOV , ONE ( CV ) , NF ) \ <nl> O ( NewDictArray , ONE ( IVA ) , NOV , ONE ( CV ) , NF ) \ <nl> - O ( NewPackedArray , ONE ( IVA ) , CMANY , ONE ( CV ) , NF ) \ <nl> - O ( NewStructArray , ONE ( VSA ) , SMANY , ONE ( CV ) , NF ) \ <nl> O ( NewStructDArray , ONE ( VSA ) , SMANY , ONE ( CV ) , NF ) \ <nl> O ( NewStructDict , ONE ( VSA ) , SMANY , ONE ( CV ) , NF ) \ <nl> O ( NewVec , ONE ( IVA ) , CMANY , ONE ( CV ) , NF ) \ <nl> constexpr uint32_t kMaxConcatN = 4 ; <nl> O ( CastInt , NA , ONE ( CV ) , ONE ( CV ) , NF ) \ <nl> O ( CastDouble , NA , ONE ( CV ) , ONE ( CV ) , NF ) \ <nl> O ( CastString , NA , ONE ( CV ) , ONE ( CV ) , NF ) \ <nl> - O ( CastArray , NA , ONE ( CV ) , ONE ( CV ) , NF ) \ <nl> O ( CastDict , NA , ONE ( CV ) , ONE ( CV ) , NF ) \ <nl> O ( CastKeyset , NA , ONE ( CV ) , ONE ( CV ) , NF ) \ <nl> O ( CastVec , NA , ONE ( CV ) , ONE ( CV ) , NF ) \ <nl> constexpr bool isCast ( Op opcode ) { <nl> opcode = = Op : : CastInt | | <nl> opcode = = Op : : CastDouble | | <nl> opcode = = Op : : CastString | | <nl> - opcode = = Op : : CastArray | | <nl> opcode = = Op : : CastDict | | <nl> opcode = = Op : : CastKeyset | | <nl> opcode = = Op : : CastVec | | <nl> mmm a / hphp / runtime / vm / jit / dce . cpp <nl> ppp b / hphp / runtime / vm / jit / dce . cpp <nl> bool canDCE ( IRInstruction * inst ) { <nl> case Ceil : <nl> case XorBool : <nl> case Mod : <nl> - case ConvBoolToArr : <nl> - case ConvDblToArr : <nl> - case ConvIntToArr : <nl> - case ConvFuncToArr : <nl> case ConvDblToBool : <nl> case ConvIntToBool : <nl> case ConvStrToBool : <nl> bool canDCE ( IRInstruction * inst ) { <nl> case NewInstanceRaw : <nl> case NewDArray : <nl> case NewDictArray : <nl> - case NewPlainArray : <nl> case NewCol : <nl> case NewPair : <nl> case NewRFunc : <nl> bool canDCE ( IRInstruction * inst ) { <nl> case GetMemoKeyScalar : <nl> case LookupSPropSlot : <nl> case ConstructClosure : <nl> - case AllocStructArray : <nl> case AllocStructDArray : <nl> case AllocStructDict : <nl> case AllocVArray : <nl> bool canDCE ( IRInstruction * inst ) { <nl> return true ; <nl> <nl> / / Some of these conversion functions can run arbitrary PHP code . <nl> - case ConvObjToArr : <nl> - case ConvTVToArr : <nl> - case ConvStrToArr : <nl> - case ConvVecToArr : <nl> - case ConvDictToArr : <nl> - case ConvKeysetToArr : <nl> - case ConvArrToNonDVArr : <nl> case ConvObjToDbl : <nl> case ConvTVToDbl : <nl> case ConvObjToInt : <nl> bool canDCE ( IRInstruction * inst ) { <nl> return ! opcodeMayRaise ( inst - > op ( ) ) & & <nl> ( ! inst - > consumesReferences ( ) | | inst - > producesReference ( ) ) ; <nl> <nl> - case ConvClsMethToArr : <nl> case ConvClsMethToDArr : <nl> case ConvClsMethToDict : <nl> case ConvClsMethToKeyset : <nl> bool canDCE ( IRInstruction * inst ) { <nl> case InitPackedLayoutArrayLoop : <nl> case NewKeysetArray : <nl> case NewRecord : <nl> - case NewStructArray : <nl> case NewStructDArray : <nl> case NewStructDict : <nl> case Clone : <nl> mmm a / hphp / runtime / vm / jit / extra - data . h <nl> ppp b / hphp / runtime / vm / jit / extra - data . h <nl> X ( StClosureArg , IndexData ) ; <nl> X ( RBTraceEntry , RBEntryData ) ; <nl> X ( RBTraceMsg , RBMsgData ) ; <nl> X ( OODeclExists , ClassKindData ) ; <nl> - X ( NewStructArray , NewStructData ) ; <nl> X ( NewStructDArray , NewStructData ) ; <nl> X ( NewStructDict , NewStructData ) ; <nl> X ( NewRecord , NewStructData ) ; <nl> - X ( AllocStructArray , NewStructData ) ; <nl> X ( AllocStructDArray , NewStructData ) ; <nl> X ( AllocStructDict , NewStructData ) ; <nl> X ( AllocVArray , PackedArrayData ) ; <nl> mmm a / hphp / runtime / vm / jit / gvn . cpp <nl> ppp b / hphp / runtime / vm / jit / gvn . cpp <nl> bool supportsGVN ( const IRInstruction * inst ) { <nl> case SubIntO : <nl> case MulIntO : <nl> case XorBool : <nl> - case ConvBoolToArr : <nl> - case ConvDblToArr : <nl> - case ConvFuncToArr : <nl> - case ConvIntToArr : <nl> case ConvDblToBool : <nl> case ConvIntToBool : <nl> case ConvBoolToDbl : <nl> mmm a / hphp / runtime / vm / jit / ir - opcode . cpp <nl> ppp b / hphp / runtime / vm / jit / ir - opcode . cpp <nl> bool opcodeMayRaise ( Opcode opc ) { <nl> case ConvArrToDict : <nl> case ConvArrToKeyset : <nl> case ConvArrToVec : <nl> - case ConvTVToArr : <nl> case ConvTVToBool : <nl> case ConvTVToDbl : <nl> case ConvTVToInt : <nl> case ConvTVToStr : <nl> - case ConvClsMethToArr : <nl> case ConvClsMethToDArr : <nl> case ConvClsMethToDict : <nl> case ConvClsMethToKeyset : <nl> case ConvClsMethToVArr : <nl> case ConvClsMethToVec : <nl> - case ConvDictToArr : <nl> case ConvDictToDArr : <nl> case ConvDictToKeyset : <nl> - case ConvKeysetToArr : <nl> case ConvKeysetToDArr : <nl> - case ConvObjToArr : <nl> case ConvObjToBool : <nl> case ConvObjToDArr : <nl> case ConvObjToDbl : <nl> bool opcodeMayRaise ( Opcode opc ) { <nl> case AKExistsArr : <nl> case AKExistsDict : <nl> case AKExistsKeyset : <nl> - case AllocStructArray : <nl> case AllocStructDArray : <nl> case AllocStructDict : <nl> case AllocVArray : <nl> bool opcodeMayRaise ( Opcode opc ) { <nl> case ContValid : <nl> case ConvArrToDArr : <nl> case ConvArrToDbl : <nl> - case ConvArrToNonDVArr : <nl> case ConvArrToVArr : <nl> - case ConvBoolToArr : <nl> case ConvBoolToDbl : <nl> case ConvBoolToInt : <nl> - case ConvDblToArr : <nl> case ConvDblToBool : <nl> case ConvDblToInt : <nl> case ConvDblToStr : <nl> case ConvDictToVArr : <nl> case ConvDictToVec : <nl> - case ConvFuncToArr : <nl> - case ConvIntToArr : <nl> case ConvIntToBool : <nl> case ConvIntToDbl : <nl> case ConvIntToStr : <nl> bool opcodeMayRaise ( Opcode opc ) { <nl> case ConvKeysetToVec : <nl> case ConvResToDbl : <nl> case ConvResToInt : <nl> - case ConvStrToArr : <nl> case ConvStrToBool : <nl> case ConvStrToDbl : <nl> case ConvStrToInt : <nl> - case ConvVecToArr : <nl> case ConvVecToDArr : <nl> case ConvVecToDict : <nl> case ConvVecToVArr : <nl> bool opcodeMayRaise ( Opcode opc ) { <nl> case NewDictArray : <nl> case NewInstanceRaw : <nl> case NewPair : <nl> - case NewPlainArray : <nl> case NewRFunc : <nl> - case NewStructArray : <nl> case NewStructDArray : <nl> case NewStructDict : <nl> case NInstanceOfBitmask : <nl> mmm a / hphp / runtime / vm / jit / irgen - basic . cpp <nl> ppp b / hphp / runtime / vm / jit / irgen - basic . cpp <nl> void emitClassName ( IRGS & env ) { <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - void emitCastArray ( IRGS & env ) { <nl> - auto const src = popC ( env ) ; <nl> - push ( env , gen ( env , ConvTVToArr , src ) ) ; <nl> - } <nl> - <nl> void emitCastVArray ( IRGS & env ) { <nl> assertx ( ! RuntimeOption : : EvalHackArrDVArrs ) ; <nl> <nl> mmm a / hphp / runtime / vm / jit / irgen - create . cpp <nl> ppp b / hphp / runtime / vm / jit / irgen - create . cpp <nl> void emitCreateCl ( IRGS & env , uint32_t numParams , uint32_t clsIx ) { <nl> push ( env , closure ) ; <nl> } <nl> <nl> - void emitNewArray ( IRGS & env , uint32_t capacity ) { <nl> - if ( capacity = = 0 ) { <nl> - push ( env , cns ( env , ArrayData : : Create ( ) ) ) ; <nl> - } else { <nl> - push ( env , gen ( env , NewPlainArray , cns ( env , capacity ) ) ) ; <nl> - } <nl> - } <nl> - <nl> - void emitNewMixedArray ( IRGS & env , uint32_t capacity ) { <nl> - emitNewArray ( env , capacity ) ; <nl> - } <nl> - <nl> void emitNewDArray ( IRGS & env , uint32_t capacity ) { <nl> assertx ( ! RuntimeOption : : EvalHackArrDVArrs ) ; <nl> if ( capacity = = 0 ) { <nl> void emitNewPackedLayoutArray ( IRGS & env , uint32_t numArgs , Opcode op ) { <nl> <nl> } <nl> <nl> - void emitNewPackedArray ( IRGS & env , uint32_t numArgs ) { <nl> - emitNewPackedLayoutArray ( env , numArgs , AllocVec ) ; <nl> - push ( env , gen ( env , ConvVecToArr , pop ( env ) ) ) ; <nl> - } <nl> - <nl> void emitNewVec ( IRGS & env , uint32_t numArgs ) { <nl> emitNewPackedLayoutArray ( env , numArgs , AllocVec ) ; <nl> } <nl> void newStructImpl ( IRGS & env , const ImmVector & immVec , <nl> <nl> } <nl> <nl> - void emitNewStructArray ( IRGS & env , const ImmVector & immVec ) { <nl> - newStructImpl ( env , immVec , NewStructArray , AllocStructArray ) ; <nl> - } <nl> - <nl> void emitNewStructDArray ( IRGS & env , const ImmVector & immVec ) { <nl> assertx ( ! RuntimeOption : : EvalHackArrDVArrs ) ; <nl> newStructImpl ( env , immVec , NewStructDArray , AllocStructDArray ) ; <nl> mmm a / hphp / runtime / vm / jit / irgen - interpone . cpp <nl> ppp b / hphp / runtime / vm / jit / irgen - interpone . cpp <nl> folly : : Optional < Type > interpOutputType ( IRGS & env , <nl> case OutPredBool : <nl> case OutBooleanImm : return TBool ; <nl> case OutInt64 : return TInt ; <nl> - case OutArray : return TArr ; <nl> case OutArrayImm : return TArr ; / / Should be StaticArr / Vec / Dict : t2124292 <nl> case OutVArray : return RuntimeOption : : EvalHackArrDVArrs ? TVec : TVArr ; <nl> case OutDArray : return RuntimeOption : : EvalHackArrDVArrs ? TDict : TDArr ; <nl> mmm a / hphp / runtime / vm / jit / irlower - array . cpp <nl> ppp b / hphp / runtime / vm / jit / irlower - array . cpp <nl> void implAllocArray ( IRLS & env , const IRInstruction * inst , MakeArrayFn target , <nl> <nl> } <nl> <nl> - void cgNewPlainArray ( IRLS & env , const IRInstruction * inst ) { <nl> - implNewArray ( env , inst , MixedArray : : MakeReserveMixed ) ; <nl> - } <nl> void cgNewDictArray ( IRLS & env , const IRInstruction * inst ) { <nl> implNewArray ( env , inst , MixedArray : : MakeReserveDict ) ; <nl> } <nl> void newStructImpl ( <nl> <nl> } <nl> <nl> - void cgNewStructArray ( IRLS & env , const IRInstruction * inst ) { <nl> - newStructImpl ( env , inst , MixedArray : : MakeStruct ) ; <nl> - } <nl> - <nl> void cgNewStructDArray ( IRLS & env , const IRInstruction * inst ) { <nl> newStructImpl ( env , inst , MixedArray : : MakeStructDArray ) ; <nl> } <nl> void allocStructImpl ( <nl> <nl> } <nl> <nl> - void cgAllocStructArray ( IRLS & env , const IRInstruction * inst ) { <nl> - allocStructImpl < MixedArrayInit > ( env , inst , MixedArray : : AllocStruct ) ; <nl> - } <nl> - <nl> void cgAllocStructDArray ( IRLS & env , const IRInstruction * inst ) { <nl> allocStructImpl < DArrayInit > ( env , inst , MixedArray : : AllocStructDArray ) ; <nl> } <nl> mmm a / hphp / runtime / vm / jit / irlower - conv . cpp <nl> ppp b / hphp / runtime / vm / jit / irlower - conv . cpp <nl> IMPL_OPCODE_CALL ( ConvTVToStr ) ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - IMPL_OPCODE_CALL ( ConvBoolToArr ) ; <nl> - IMPL_OPCODE_CALL ( ConvIntToArr ) ; <nl> - IMPL_OPCODE_CALL ( ConvDblToArr ) ; <nl> - IMPL_OPCODE_CALL ( ConvStrToArr ) ; <nl> - IMPL_OPCODE_CALL ( ConvFuncToArr ) ; <nl> - IMPL_OPCODE_CALL ( ConvVecToArr ) ; <nl> - IMPL_OPCODE_CALL ( ConvDictToArr ) ; <nl> - IMPL_OPCODE_CALL ( ConvKeysetToArr ) ; <nl> - IMPL_OPCODE_CALL ( ConvClsMethToArr ) ; <nl> - IMPL_OPCODE_CALL ( ConvObjToArr ) ; <nl> - IMPL_OPCODE_CALL ( ConvTVToArr ) ; <nl> - IMPL_OPCODE_CALL ( ConvArrToNonDVArr ) ; <nl> - <nl> IMPL_OPCODE_CALL ( ConvClsMethToVArr ) ; <nl> IMPL_OPCODE_CALL ( ConvClsMethToDArr ) ; <nl> <nl> mmm a / hphp / runtime / vm / jit / memory - effects . cpp <nl> ppp b / hphp / runtime / vm / jit / memory - effects . cpp <nl> MemEffects memory_effects_impl ( const IRInstruction & inst ) { <nl> return may_load_store_move ( stack_in , AEmpty , stack_in ) ; <nl> } <nl> <nl> - case NewStructArray : <nl> case NewStructDArray : <nl> case NewStructDict : <nl> { <nl> MemEffects memory_effects_impl ( const IRInstruction & inst ) { <nl> case NewInstanceRaw : <nl> case NewDArray : <nl> case NewDictArray : <nl> - case NewPlainArray : <nl> case NewRFunc : <nl> case FuncCred : <nl> case AllocVArray : <nl> case AllocVec : <nl> - case AllocStructArray : <nl> case AllocStructDArray : <nl> case AllocStructDict : <nl> - case ConvBoolToArr : <nl> case ConvDblToStr : <nl> - case ConvDblToArr : <nl> - case ConvFuncToArr : <nl> - case ConvIntToArr : <nl> case ConvIntToStr : <nl> return IrrelevantEffects { } ; <nl> <nl> MemEffects memory_effects_impl ( const IRInstruction & inst ) { <nl> case RBTraceMsg : <nl> case ConvIntToBool : <nl> case ConvIntToDbl : <nl> - case ConvStrToArr : / / decrefs src , but src is a string <nl> case ConvStrToBool : <nl> case ConvStrToDbl : <nl> case ConvResToDbl : <nl> MemEffects memory_effects_impl ( const IRInstruction & inst ) { <nl> case CmpVec : <nl> case EqDict : <nl> case NeqDict : <nl> - case ConvTVToArr : / / decrefs src , may read obj props <nl> - case ConvObjToArr : / / decrefs src <nl> case ConvObjToVArr : / / can invoke PHP <nl> case ConvObjToDArr : / / can invoke PHP <nl> case OODeclExists : <nl> MemEffects memory_effects_impl ( const IRInstruction & inst ) { <nl> case ConvDictToKeyset : <nl> case ConvDictToDArr : / / These 4 may raise Hack array compat notices <nl> case ConvKeysetToDArr : <nl> - case ConvDictToArr : <nl> - case ConvKeysetToArr : <nl> - case ConvClsMethToArr : <nl> case ConvClsMethToDArr : <nl> case ConvClsMethToDict : <nl> case ConvClsMethToKeyset : <nl> MemEffects memory_effects_impl ( const IRInstruction & inst ) { <nl> case ConvClsMethToVec : <nl> return may_load_store ( AElemAny , AEmpty ) ; <nl> <nl> - case ConvVecToArr : <nl> - case ConvArrToNonDVArr : <nl> case ConvDictToVec : <nl> case ConvKeysetToVec : <nl> case ConvVecToDict : <nl> mmm a / hphp / runtime / vm / jit / native - calls . cpp <nl> ppp b / hphp / runtime / vm / jit / native - calls . cpp <nl> static auto c_AsyncFunctionWaitHandle_Create_false = <nl> * / <nl> static CallMap s_callMap { <nl> / * Opcode , Func , Dest , SyncPoint , Args * / <nl> - { ConvBoolToArr , convTVToArrHelper , DSSA , SNone , <nl> - { { TV , 0 } } } , <nl> - { ConvDblToArr , convTVToArrHelper , DSSA , SNone , <nl> - { { TV , 0 } } } , <nl> - { ConvIntToArr , convTVToArrHelper , DSSA , SNone , <nl> - { { TV , 0 } } } , <nl> - { ConvObjToArr , convTVToArrHelper , DSSA , SSync , <nl> - { { TV , 0 } } } , <nl> - { ConvStrToArr , convTVToArrHelper , DSSA , SNone , <nl> - { { TV , 0 } } } , <nl> - { ConvFuncToArr , convTVToArrHelper , DSSA , SNone , <nl> - { { TV , 0 } } } , <nl> - { ConvVecToArr , convVecToArrHelper , DSSA , SNone , <nl> - { { SSA , 0 } } } , <nl> - / / These two need to sync because of Hack array compat notices <nl> - { ConvDictToArr , convDictToArrHelper , DSSA , SSync , <nl> - { { SSA , 0 } } } , <nl> - { ConvKeysetToArr , convKeysetToArrHelper , DSSA , SSync , <nl> - { { SSA , 0 } } } , <nl> - { ConvTVToArr , convTVToArrHelper , DSSA , SSync , <nl> - { { TV , 0 } } } , <nl> - { ConvArrToNonDVArr , convArrToNonDVArrHelper , DSSA , SSync , <nl> - { { SSA , 0 } } } , <nl> - / / ConvClsMethTo # # T to sync due to clsmeth conversion notices <nl> - { ConvClsMethToArr , convClsMethToArrHelper , DSSA , SSync , <nl> - { { SSA , 0 } } } , <nl> { ConvClsMethToVArr , convClsMethToVArrHelper , DSSA , SSync , <nl> { { SSA , 0 } } } , <nl> { ConvClsMethToDArr , convClsMethToDArrHelper , DSSA , SSync , <nl> mmm a / hphp / runtime / vm / jit / simplify . cpp <nl> ppp b / hphp / runtime / vm / jit / simplify . cpp <nl> SSATmp * arrayLikeConvImpl ( State & env , const IRInstruction * inst , C convert ) { <nl> return cns ( env , converted ) ; <nl> } <nl> <nl> - SSATmp * convToArrImpl ( State & env , const IRInstruction * inst ) { <nl> - return arrayLikeConvImpl ( <nl> - env , inst , <nl> - [ & ] ( ArrayData * a ) { return a - > toPHPArray ( true ) ; } <nl> - ) ; <nl> - } <nl> - <nl> SSATmp * convToVecImpl ( State & env , const IRInstruction * inst ) { <nl> return arrayLikeConvImpl ( <nl> env , inst , <nl> SSATmp * convToDArrImpl ( State & env , const IRInstruction * inst ) { <nl> ) ; <nl> } <nl> <nl> - SSATmp * convNonArrToArrImpl ( State & env , const IRInstruction * inst ) { <nl> - auto const src = inst - > src ( 0 ) ; <nl> - if ( src - > hasConstVal ( ) ) { <nl> - auto arr = Array : : attach ( ArrayData : : Create ( src - > variantVal ( ) ) ) ; <nl> - return cns ( env , ArrayData : : GetScalarArray ( std : : move ( arr ) ) ) ; <nl> - } <nl> - return nullptr ; <nl> - } <nl> - <nl> } <nl> <nl> # define X ( FromTy , ToTy ) \ <nl> simplifyConv # # FromTy # # To # # ToTy ( State & env , const IRInstruction * inst ) { \ <nl> return convTo # # ToTy # # Impl ( env , inst ) ; \ <nl> } <nl> <nl> - X ( Vec , Arr ) <nl> - X ( Dict , Arr ) <nl> - X ( Keyset , Arr ) <nl> - <nl> X ( Arr , Vec ) <nl> X ( Dict , Vec ) <nl> X ( Keyset , Vec ) <nl> X ( Arr , NonDVArr ) <nl> <nl> # undef X <nl> <nl> - SSATmp * simplifyConvTVToArr ( State & env , const IRInstruction * inst ) { <nl> - auto const src = inst - > src ( 0 ) ; <nl> - if ( src - > isA ( TArr ) ) return gen ( env , ConvArrToNonDVArr , src ) ; <nl> - if ( src - > isA ( TVec ) ) return gen ( env , ConvVecToArr , src ) ; <nl> - if ( src - > isA ( TDict ) ) return gen ( env , ConvDictToArr , inst - > taken ( ) , src ) ; <nl> - if ( src - > isA ( TKeyset ) ) return gen ( env , ConvKeysetToArr , inst - > taken ( ) , src ) ; <nl> - if ( src - > isA ( TNull ) ) return cns ( env , ArrayData : : Create ( ) ) ; <nl> - if ( src - > isA ( TBool ) ) return gen ( env , ConvBoolToArr , src ) ; <nl> - if ( src - > isA ( TDbl ) ) return gen ( env , ConvDblToArr , src ) ; <nl> - if ( src - > isA ( TInt ) ) return gen ( env , ConvIntToArr , src ) ; <nl> - if ( src - > isA ( TStr ) ) return gen ( env , ConvStrToArr , src ) ; <nl> - if ( src - > isA ( TObj ) ) return gen ( env , ConvObjToArr , inst - > taken ( ) , src ) ; <nl> - if ( src - > isA ( TFunc ) ) return gen ( env , ConvFuncToArr , src ) ; <nl> - if ( src - > isA ( TClsMeth ) ) return gen ( env , ConvClsMethToArr , inst - > taken ( ) , src ) ; <nl> - return nullptr ; <nl> - } <nl> - <nl> - SSATmp * simplifyConvBoolToArr ( State & env , const IRInstruction * inst ) { <nl> - return convNonArrToArrImpl ( env , inst ) ; <nl> - } <nl> - <nl> - SSATmp * simplifyConvIntToArr ( State & env , const IRInstruction * inst ) { <nl> - return convNonArrToArrImpl ( env , inst ) ; <nl> - } <nl> - <nl> - SSATmp * simplifyConvDblToArr ( State & env , const IRInstruction * inst ) { <nl> - return convNonArrToArrImpl ( env , inst ) ; <nl> - } <nl> - <nl> - SSATmp * simplifyConvStrToArr ( State & env , const IRInstruction * inst ) { <nl> - return convNonArrToArrImpl ( env , inst ) ; <nl> - } <nl> - <nl> - SSATmp * simplifyConvFuncToArr ( State & env , const IRInstruction * inst ) { <nl> - return convNonArrToArrImpl ( env , inst ) ; <nl> - } <nl> - <nl> - SSATmp * simplifyConvClsMethToArr ( State & env , const IRInstruction * inst ) { <nl> - auto const src = inst - > src ( 0 ) ; <nl> - if ( src - > hasConstVal ( ) ) { <nl> - auto const clsmeth = src - > clsmethVal ( ) ; <nl> - auto arr = make_map_array ( 0 , clsmeth - > getClsStr ( ) , <nl> - 1 , clsmeth - > getFuncStr ( ) ) ; <nl> - return cns ( env , ArrayData : : GetScalarArray ( std : : move ( arr ) ) ) ; <nl> - } <nl> - return nullptr ; <nl> - } <nl> - <nl> SSATmp * simplifyConvClsMethToVArr ( State & env , const IRInstruction * inst ) { <nl> auto const src = inst - > src ( 0 ) ; <nl> if ( src - > hasConstVal ( ) ) { <nl> SSATmp * simplifyWork ( State & env , const IRInstruction * inst ) { <nl> X ( ConcatIntStr ) <nl> X ( ConcatStrInt ) <nl> X ( ConvArrToDbl ) <nl> - X ( ConvBoolToArr ) <nl> X ( ConvBoolToDbl ) <nl> X ( ConvBoolToInt ) <nl> X ( ConvTVToBool ) <nl> X ( ConvTVToDbl ) <nl> X ( ConvTVToInt ) <nl> X ( ConvTVToStr ) <nl> - X ( ConvTVToArr ) <nl> - X ( ConvDblToArr ) <nl> X ( ConvDblToBool ) <nl> X ( ConvDblToInt ) <nl> X ( ConvDblToStr ) <nl> - X ( ConvIntToArr ) <nl> X ( ConvIntToBool ) <nl> X ( ConvIntToDbl ) <nl> X ( ConvIntToStr ) <nl> X ( ConvObjToBool ) <nl> - X ( ConvStrToArr ) <nl> - X ( ConvFuncToArr ) <nl> - X ( ConvVecToArr ) <nl> - X ( ConvDictToArr ) <nl> - X ( ConvKeysetToArr ) <nl> - X ( ConvClsMethToArr ) <nl> X ( ConvClsMethToVArr ) <nl> X ( ConvClsMethToDArr ) <nl> X ( ConvClsMethToVec ) <nl> mmm a / hphp / runtime / vm / jit / translator - runtime . cpp <nl> ppp b / hphp / runtime / vm / jit / translator - runtime . cpp <nl> TypedValue arrayAdd ( ArrayData * a1 , ArrayData * a2 ) { <nl> return make_array_like_tv ( a1 ) ; <nl> } <nl> <nl> - ArrayData * convTVToArrHelper ( TypedValue tv ) { <nl> - / / Note : the call sites of this function all assume that <nl> - / / no user code will run and no recoverable exceptions will <nl> - / / occur while running this code . This seems trivially true <nl> - / / in all cases but converting objects to arrays . It also <nl> - / / seems true for that case as well , since the resulting array <nl> - / / is essentially metadata for the object . If that is not true , <nl> - / / you might end up looking at this code in a debugger and now <nl> - / / you know why . <nl> - tvCastToArrayInPlace ( & tv ) ; / / consumes a ref on counted values <nl> - return tv . m_data . parr ; <nl> - } <nl> - <nl> - ArrayData * convArrToNonDVArrHelper ( ArrayData * adIn ) { <nl> - assertx ( adIn - > isPHPArrayType ( ) ) ; <nl> - if ( adIn - > isNotDVArray ( ) ) return adIn ; <nl> - auto a = adIn - > toPHPArray ( adIn - > cowCheck ( ) ) ; <nl> - if ( a ! = adIn ) decRefArr ( adIn ) ; <nl> - assertx ( a - > isNotDVArray ( ) ) ; <nl> - return a ; <nl> - } <nl> - <nl> - ArrayData * convVecToArrHelper ( ArrayData * adIn ) { <nl> - assertx ( adIn - > isVecKind ( ) ) ; <nl> - auto a = PackedArray : : ToPHPArrayVec ( adIn , adIn - > cowCheck ( ) ) ; <nl> - if ( a ! = adIn ) decRefArr ( adIn ) ; <nl> - assertx ( a - > isPHPArrayType ( ) ) ; <nl> - assertx ( a - > isNotDVArray ( ) ) ; <nl> - return a ; <nl> - } <nl> - <nl> - ArrayData * convDictToArrHelper ( ArrayData * adIn ) { <nl> - assertx ( adIn - > isDictKind ( ) ) ; <nl> - auto a = MixedArray : : ToPHPArrayDict ( adIn , adIn - > cowCheck ( ) ) ; <nl> - if ( a ! = adIn ) decRefArr ( adIn ) ; <nl> - assertx ( a - > isPHPArrayType ( ) ) ; <nl> - assertx ( a - > isNotDVArray ( ) ) ; <nl> - return a ; <nl> - } <nl> - <nl> - ArrayData * convKeysetToArrHelper ( ArrayData * adIn ) { <nl> - assertx ( adIn - > isKeysetKind ( ) ) ; <nl> - auto a = SetArray : : ToPHPArray ( adIn , adIn - > cowCheck ( ) ) ; <nl> - if ( a ! = adIn ) decRefArr ( adIn ) ; <nl> - assertx ( a - > isPHPArrayType ( ) ) ; <nl> - assertx ( a - > isNotDVArray ( ) ) ; <nl> - return a ; <nl> - } <nl> - <nl> ArrayData * convArrToVecHelper ( ArrayData * adIn ) { <nl> assertx ( adIn - > isPHPArrayType ( ) ) ; <nl> auto a = adIn - > toVec ( adIn - > cowCheck ( ) ) ; <nl> ArrayData * convObjToKeysetHelper ( ObjectData * obj ) { <nl> return a ; <nl> } <nl> <nl> - ArrayData * convClsMethToArrHelper ( ClsMethDataRef clsmeth ) { <nl> - raiseClsMethConvertWarningHelper ( " array " ) ; <nl> - auto a = make_map_array ( <nl> - 0 , clsmeth - > getClsStr ( ) , 1 , clsmeth - > getFuncStr ( ) ) . detach ( ) ; <nl> - decRefClsMeth ( clsmeth ) ; <nl> - return a ; <nl> - } <nl> - <nl> ArrayData * convClsMethToVArrHelper ( ClsMethDataRef clsmeth ) { <nl> raiseClsMethConvertWarningHelper ( " varray " ) ; <nl> auto a = make_varray ( clsmeth - > getClsStr ( ) , clsmeth - > getFuncStr ( ) ) . detach ( ) ; <nl> mmm a / hphp / runtime / vm / jit / translator - runtime . h <nl> ppp b / hphp / runtime / vm / jit / translator - runtime . h <nl> TypedValue arrayAdd ( ArrayData * a1 , ArrayData * a2 ) ; <nl> / * Helper functions for conversion instructions that are too <nl> * complicated to inline <nl> * / <nl> - ArrayData * convTVToArrHelper ( TypedValue tv ) ; <nl> - ArrayData * convArrToNonDVArrHelper ( ArrayData * a ) ; <nl> - ArrayData * convVecToArrHelper ( ArrayData * a ) ; <nl> - ArrayData * convDictToArrHelper ( ArrayData * a ) ; <nl> - ArrayData * convKeysetToArrHelper ( ArrayData * a ) ; <nl> ArrayData * convArrToVecHelper ( ArrayData * a ) ; <nl> ArrayData * convDictToVecHelper ( ArrayData * a ) ; <nl> ArrayData * convKeysetToVecHelper ( ArrayData * a ) ; <nl> ArrayData * convArrToKeysetHelper ( ArrayData * a ) ; <nl> ArrayData * convVecToKeysetHelper ( ArrayData * a ) ; <nl> ArrayData * convDictToKeysetHelper ( ArrayData * a ) ; <nl> ArrayData * convObjToKeysetHelper ( ObjectData * o ) ; <nl> - ArrayData * convClsMethToArrHelper ( ClsMethDataRef clsmeth ) ; <nl> ArrayData * convClsMethToVArrHelper ( ClsMethDataRef clsmeth ) ; <nl> ArrayData * convClsMethToVecHelper ( ClsMethDataRef clsmeth ) ; <nl> ArrayData * convClsMethToDArrHelper ( ClsMethDataRef clsmeth ) ; <nl> mmm a / hphp / runtime / vm / jit / translator . cpp <nl> ppp b / hphp / runtime / vm / jit / translator . cpp <nl> static const struct { <nl> { OpDict , { None , Stack1 , OutDictImm } } , <nl> { OpKeyset , { None , Stack1 , OutKeysetImm } } , <nl> { OpVec , { None , Stack1 , OutVecImm } } , <nl> - { OpNewArray , { None , Stack1 , OutArray } } , <nl> - { OpNewMixedArray , { None , Stack1 , OutArray } } , <nl> { OpNewDictArray , { None , Stack1 , OutDict } } , <nl> - { OpNewPackedArray , { StackN , Stack1 , OutArray } } , <nl> - { OpNewStructArray , { StackN , Stack1 , OutArray } } , <nl> { OpNewStructDArray , { StackN , Stack1 , OutDArray } } , <nl> { OpNewStructDict , { StackN , Stack1 , OutDict } } , <nl> { OpNewVec , { StackN , Stack1 , OutVec } } , <nl> static const struct { <nl> { OpCastInt , { Stack1 , Stack1 , OutInt64 } } , <nl> { OpCastDouble , { Stack1 , Stack1 , OutDouble } } , <nl> { OpCastString , { Stack1 , Stack1 , OutString } } , <nl> - { OpCastArray , { Stack1 , Stack1 , OutArray } } , <nl> { OpCastDict , { Stack1 , Stack1 , OutDict } } , <nl> { OpCastKeyset , { Stack1 , Stack1 , OutKeyset } } , <nl> { OpCastVec , { Stack1 , Stack1 , OutVec } } , <nl> int64_t getStackPopped ( PC pc ) { <nl> case Op : : QueryM : <nl> case Op : : IncDecM : <nl> case Op : : UnsetM : <nl> - case Op : : NewPackedArray : <nl> case Op : : NewVec : <nl> case Op : : NewKeysetArray : <nl> case Op : : NewVArray : <nl> int64_t getStackPopped ( PC pc ) { <nl> return getImm ( pc , 0 ) . u_IVA + 1 ; <nl> <nl> case Op : : NewRecord : <nl> - case Op : : NewStructArray : <nl> case Op : : NewStructDArray : <nl> case Op : : NewStructDict : <nl> return getImmVector ( pc ) . size ( ) ; <nl> InputInfoVec getInputs ( const NormalizedInstruction & ni , FPInvOffset bcSPOff ) { <nl> if ( flags & StackN ) { <nl> int numArgs = [ & ] ( ) - > int { <nl> switch ( ni . op ( ) ) { <nl> - case Op : : NewPackedArray : <nl> case Op : : NewVec : <nl> case Op : : NewKeysetArray : <nl> case Op : : NewVArray : <nl> bool dontGuardAnyInputs ( const NormalizedInstruction & ni ) { <nl> case Op : : JmpNS : <nl> case Op : : ClsCnsD : <nl> case Op : : FCallBuiltin : <nl> - case Op : : NewStructArray : <nl> case Op : : NewStructDArray : <nl> case Op : : NewStructDict : <nl> case Op : : Switch : <nl> bool dontGuardAnyInputs ( const NormalizedInstruction & ni ) { <nl> case Op : : CGetL2 : <nl> case Op : : CGetS : <nl> case Op : : CUGetL : <nl> - case Op : : CastArray : <nl> case Op : : CastDouble : <nl> case Op : : CastInt : <nl> case Op : : CastString : <nl> bool dontGuardAnyInputs ( const NormalizedInstruction & ni ) { <nl> case Op : : Pow : <nl> case Op : : ClassName : <nl> case Op : : NativeImpl : <nl> - case Op : : NewArray : <nl> case Op : : NewCol : <nl> case Op : : NewPair : <nl> - case Op : : NewMixedArray : <nl> case Op : : NewDictArray : <nl> - case Op : : NewPackedArray : <nl> case Op : : NewVec : <nl> case Op : : NewKeysetArray : <nl> case Op : : NewVArray : <nl> mmm a / hphp / runtime / vm / jit / translator . h <nl> ppp b / hphp / runtime / vm / jit / translator . h <nl> enum OutTypeConstraints { <nl> OutBoolean , <nl> OutBooleanImm , <nl> OutInt64 , <nl> - OutArray , <nl> OutArrayImm , <nl> OutVArray , <nl> OutDArray , <nl> mmm a / hphp / runtime / vm / verifier / check - func . cpp <nl> ppp b / hphp / runtime / vm / verifier / check - func . cpp <nl> const FlavorDesc * FuncChecker : : sig ( PC pc ) { <nl> m_tmp_sig [ i ] = CUV ; <nl> } <nl> return m_tmp_sig ; <nl> - case Op : : NewPackedArray : / / ONE ( IVA ) , CMANY , ONE ( CV ) <nl> - case Op : : NewStructArray : / / ONE ( VSA ) , SMANY , ONE ( CV ) <nl> case Op : : NewStructDArray : / / ONE ( VSA ) , SMANY , ONE ( CV ) <nl> case Op : : NewStructDict : / / ONE ( VSA ) , SMANY , ONE ( CV ) <nl> case Op : : NewVec : / / ONE ( IVA ) , CMANY , ONE ( CV ) <nl> bool FuncChecker : : checkOp ( State * cur , PC pc , Op op , Block * b , PC prev_pc ) { <nl> cur - > silences . clear ( ) ; <nl> break ; <nl> <nl> - case Op : : NewPackedArray : <nl> case Op : : NewVArray : <nl> case Op : : NewVec : <nl> case Op : : NewKeysetArray : { <nl> bool FuncChecker : : checkRxOp ( State * cur , PC pc , Op op ) { <nl> case Op : : Dict : <nl> case Op : : Keyset : <nl> case Op : : Vec : <nl> - case Op : : NewArray : <nl> - case Op : : NewMixedArray : <nl> case Op : : NewDictArray : <nl> - case Op : : NewPackedArray : <nl> case Op : : NewRecord : <nl> - case Op : : NewStructArray : <nl> case Op : : NewStructDArray : <nl> case Op : : NewStructDict : <nl> case Op : : NewVec : <nl> bool FuncChecker : : checkRxOp ( State * cur , PC pc , Op op ) { <nl> case Op : : CastInt : <nl> case Op : : CastDouble : <nl> case Op : : CastString : <nl> - case Op : : CastArray : <nl> case Op : : CastDict : <nl> case Op : : CastKeyset : <nl> case Op : : CastVec : <nl> mmm a / hphp / runtime / vm / verifier / fuzzer / instr_utils . ml <nl> ppp b / hphp / runtime / vm / verifier / fuzzer / instr_utils . ml <nl> let stk_data : instruct - > stack_sig = function <nl> | IFinal QueryM ( n , _ , _ ) <nl> | IFinal IncDecM ( n , _ , _ ) <nl> | IMisc CreateCl ( n , _ ) <nl> - | ILitConst NewPackedArray n - > produce " C " n , [ " C " ] <nl> | IFinal SetOpM ( n , _ , _ ) <nl> | IFinal SetM ( n , _ ) - > produce " C " ( n + 1 ) , [ " C " ] <nl> | IFinal UnsetM ( n , _ ) - > produce " C " n , [ ] <nl> - | ILitConst NewStructArray v - > produce " C " ( List . length v ) , [ " C " ] <nl> | IMisc Idx <nl> | IMisc ArrayIdx <nl> | ILitConst AddElemC - > [ " C " ; " C " ; " C " ] , [ " C " ] <nl> let stk_data : instruct - > stack_sig = function <nl> | IOp CastInt <nl> | IOp CastDouble <nl> | IOp CastString <nl> - | IOp CastArray <nl> | IOp CastVec <nl> | IOp CastDict <nl> | IOp CastKeyset <nl> mmm a / hphp / runtime / vm / verifier / fuzzer / random_utils . ml <nl> ppp b / hphp / runtime / vm / verifier / fuzzer / random_utils . ml <nl> let rec random_typed_value ( ) : Typed_value . t = <nl> ( fun ( ) - > Typed_value . Float ( Random . float 100 . 0 ) ) ; <nl> ( fun ( ) - > Typed_value . String " " ) ; <nl> ( fun ( ) - > Typed_value . Null ) ; <nl> - ( fun ( ) - > Typed_value . Array [ random_typed_value ( ) , random_typed_value ( ) ] ) ; <nl> ( fun ( ) - > Typed_value . Vec ( [ random_typed_value ( ) ] , None ) ) ; <nl> ( fun ( ) - > Typed_value . Keyset [ random_typed_value ( ) ] ) ; <nl> ( fun ( ) - > Typed_value . Dict ( [ random_typed_value ( ) , random_typed_value ( ) ] , None ) ) ] <nl> let all_instrs ( _ : IS . t ) : lazy_instruct list = <nl> ( fun ( ) - > ILitConst ( Vec ( random_adata_id ( ) ) ) ) ; <nl> ( fun ( ) - > ILitConst ( Dict ( random_adata_id ( ) ) ) ) ; <nl> ( fun ( ) - > ILitConst ( Keyset ( random_adata_id ( ) ) ) ) ; <nl> - ( fun ( ) - > ILitConst ( NewArray ( Random . int 1000 ) ) ) ; <nl> - ( fun ( ) - > ILitConst ( NewMixedArray ( Random . int 1000 ) ) ) ; <nl> ( fun ( ) - > ILitConst ( NewDictArray ( Random . int 1000 ) ) ) ; <nl> ( fun ( ) - > ILitConst ( NewCol ( random_collection_type ( ) ) ) ) ; <nl> ( fun ( ) - > ILitConst ( CnsE ( Const . from_raw_string " " ) ) ) ; <nl> let all_instrs ( _ : IS . t ) : lazy_instruct list = <nl> ( fun ( ) - > IOp CastInt ) ; <nl> ( fun ( ) - > IOp CastDouble ) ; <nl> ( fun ( ) - > IOp CastString ) ; <nl> - ( fun ( ) - > IOp CastArray ) ; <nl> ( fun ( ) - > IOp CastVec ) ; <nl> ( fun ( ) - > IOp CastDict ) ; <nl> ( fun ( ) - > IOp CastKeyset ) ; <nl> mmm a / hphp / test / quick / asm_array . hhas <nl> ppp b / hphp / test / quick / asm_array . hhas <nl> <nl> RetC <nl> } <nl> <nl> - . adata my_array = " " " a : 2 : { s : 3 : " foo " ; s : 3 : " bar " ; s : 3 : " baz " ; s : 4 : " blah " ; } " " " ; <nl> + . adata my_array = " " " Y : 2 : { s : 3 : " foo " ; s : 3 : " bar " ; s : 3 : " baz " ; s : 4 : " blah " ; } " " " ; <nl> <nl> . class ClassWithArray { <nl> . property [ static public ] arr = <nl> - " " " a : 4 : { i : 0 ; i : 1 ; i : 1 ; i : 2 ; i : 2 ; i : 3 ; i : 3 ; i : 4 ; } " " " ; <nl> + " " " Y : 4 : { i : 0 ; i : 1 ; i : 1 ; i : 2 ; i : 2 ; i : 3 ; i : 3 ; i : 4 ; } " " " ; <nl> } <nl> <nl> . function ArrayMember ( ) { <nl> unset_label : String " win \ n " <nl> NullUninit <nl> Int 1 <nl> String " b " <nl> - NewPackedArray 2 <nl> + NewVArray 2 <nl> FCallFuncD < > 1 1 " " - " " " var_dump " <nl> PopC <nl> <nl> mmm a / hphp / test / quick / asm_array_elem . hhas <nl> ppp b / hphp / test / quick / asm_array_elem . hhas <nl> <nl> } <nl> <nl> . function main ( ) { <nl> - NewArray 3 <nl> + NewDArray 3 <nl> String " asd " <nl> AddNewElemC <nl> SetL $ foo <nl> mmm a / hphp / test / quick / asm_array_packed . hhas <nl> ppp b / hphp / test / quick / asm_array_packed . hhas <nl> <nl> Int 62 <nl> Int 63 <nl> Int 64 <nl> - NewPackedArray 64 <nl> + NewVArray 64 <nl> <nl> FCallFuncD < > 1 1 " " - " " " var_dump " <nl> PopC <nl> mmm a / hphp / test / quick / asm_iterbreak . hhas <nl> ppp b / hphp / test / quick / asm_iterbreak . hhas <nl> <nl> <nl> . function main ( ) { <nl> . numiters 2 ; <nl> - NewArray 3 <nl> + NewDArray 3 <nl> <nl> String " hello " <nl> String " world " <nl> mmm a / hphp / test / quick / asm_newstructarray . hhas <nl> ppp b / hphp / test / quick / asm_newstructarray . hhas <nl> <nl> String " two " <nl> Double 3 . 1415 <nl> Int 4 <nl> - NewStructArray < " one " " two " " three " " four " > <nl> + NewStructDArray < " one " " two " " three " " four " > <nl> SetL $ arr <nl> PopC <nl> <nl> mmm a / hphp / test / quick / asm_ret_type . hhas <nl> ppp b / hphp / test / quick / asm_ret_type . hhas <nl> <nl> . hh_file 1 ; <nl> # Test for hhas return types <nl> <nl> - . adata A_0 = " " " a : 0 : { } " " " ; <nl> + . adata A_0 = " " " Y : 0 : { } " " " ; <nl> <nl> . main { <nl> NullUninit <nl> mmm a / hphp / test / quick / asm_ret_type . hhas . expectf <nl> ppp b / hphp / test / quick / asm_ret_type . hhas . expectf <nl> @ @ - 1 + 1 @ @ <nl> - Catchable fatal error : Value returned from function fail ( ) must be of type int , array given in % s on line - 1 <nl> + Catchable fatal error : Value returned from function fail ( ) must be of type int , darray given in % s on line - 1 <nl> mmm a / hphp / test / quick / asm_sswitch . hhas <nl> ppp b / hphp / test / quick / asm_sswitch . hhas <nl> <nl> } <nl> <nl> # array ( 0 , 1 , 2 , 3 , 4 ) <nl> - . adata my_array = " " " a : 6 : { i : 0 ; s : 7 : " label_0 " ; i : 1 ; s : 7 : " label_1 " ; i : 2 ; s : 7 : " label_2 " ; i : 3 ; s : 7 : " label_3 " ; i : 4 ; s : 7 : " label_4 " ; i : 5 ; s : 7 : " default " ; } " " " ; <nl> + . adata my_array = " " " Y : 6 : { i : 0 ; s : 7 : " label_0 " ; i : 1 ; s : 7 : " label_1 " ; i : 2 ; s : 7 : " label_2 " ; i : 3 ; s : 7 : " label_3 " ; i : 4 ; s : 7 : " label_4 " ; i : 5 ; s : 7 : " default " ; } " " " ; <nl> <nl> . function main ( ) { <nl> . numiters 1 ; <nl> mmm a / hphp / test / quick / asm_switch . hhas <nl> ppp b / hphp / test / quick / asm_switch . hhas <nl> <nl> } <nl> <nl> # array ( 0 , 1 , 2 , 3 , 4 ) <nl> - . adata my_array = " " " a : 5 : { i : 0 ; i : 0 ; i : 1 ; i : 1 ; i : 2 ; i : 2 ; i : 3 ; i : 3 ; i : 4 ; i : 4 ; } " " " ; <nl> + . adata my_array = " " " Y : 5 : { i : 0 ; i : 0 ; i : 1 ; i : 1 ; i : 2 ; i : 2 ; i : 3 ; i : 3 ; i : 4 ; i : 4 ; } " " " ; <nl> <nl> . function main ( ) { <nl> . numiters 1 ; <nl> mmm a / hphp / test / quick / asm_types . hhas <nl> ppp b / hphp / test / quick / asm_types . hhas <nl> <nl> . hh_file 1 ; <nl> # Test type annotations for hhas <nl> <nl> - . adata A_0 = " " " a : 0 : { } " " " ; <nl> + . adata A_0 = " " " Y : 0 : { } " " " ; <nl> <nl> . main { <nl> DefCls 0 <nl> mmm a / hphp / test / quick / asm_types . hhas . expectf <nl> ppp b / hphp / test / quick / asm_types . hhas . expectf <nl> <nl> Warning : Argument 1 to use_class ( ) must be of type @ C , null given in % s on line - 1 <nl> <nl> - Warning : Argument 1 to use_int_soft ( ) must be of type @ int , array given in % s on line - 1 <nl> + Warning : Argument 1 to use_int_soft ( ) must be of type @ int , darray given in % s on line - 1 <nl> <nl> Warning : Argument 1 to use_int_soft ( ) must be of type @ int , null given in % s on line - 1 <nl> <nl> - Catchable fatal error : Argument 1 passed to use_int ( ) must be an instance of int , array given in % s on line - 1 <nl> + Catchable fatal error : Argument 1 passed to use_int ( ) must be an instance of int , darray given in % s on line - 1 <nl> mmm a / hphp / test / quick / asm_unusual_lifetimes . hhas <nl> ppp b / hphp / test / quick / asm_unusual_lifetimes . hhas <nl> <nl> Int 1 <nl> Int 2 <nl> Int 3 <nl> - NewPackedArray 3 <nl> + NewVArray 3 <nl> SetL $ a <nl> PopC <nl> Int 1 <nl> Int 2 <nl> Int 3 <nl> - NewPackedArray 3 <nl> + NewVArray 3 <nl> SetL $ b <nl> PopC <nl> <nl> mmm a / hphp / test / slow / array / ban_cast . php . expectf <nl> ppp b / hphp / test / slow / array / ban_cast . php . expectf <nl> @ @ - 1 + 1 @ @ <nl> - Fatal error : ( array ) cast is no longer supported in % s / ban_cast . php on line 5 <nl> + Fatal error : Invalid cast type : array in % s / ban_cast . php on line 5 <nl> mmm a / hphp / test / slow / hhas_adata / hhas_adata_dict_like_array . php <nl> ppp b / hphp / test / slow / hhas_adata / hhas_adata_dict_like_array . php <nl> <nl> < ? hh <nl> <nl> function provide_constant_dict_like_array ( ) { <nl> - return __hhvm_intrinsics \ dummy_cast_to_kindofarray ( darray [ <nl> + return darray [ <nl> ' first key ' = > ' first value ' , <nl> ' second key ' = > ' second value ' , <nl> - ] ) ; <nl> + ] ; <nl> } <nl> <nl> / / Provides the same as the above , but using __hhas_adata with a nowdoc . <nl> function provide_hhas_adata_nowdoc ( ) { <nl> return __hhas_adata ( < < < ' NOWDOC ' <nl> - a : 2 : { s : 9 : " first key " ; s : 11 : " first value " ; s : 10 : " second key " ; s : 12 : " second value " ; } <nl> + Y : 2 : { s : 9 : " first key " ; s : 11 : " first value " ; s : 10 : " second key " ; s : 12 : " second value " ; } <nl> NOWDOC <nl> ) ; <nl> } <nl> function provide_hhas_adata_nowdoc ( ) { <nl> / / string . <nl> function provide_hhas_adata_single_quoted ( ) { <nl> return __hhas_adata ( <nl> - ' a : 2 : { s : 9 : " first key " ; s : 11 : " first value " ; s : 10 : " second key " ; s : 12 : " second value " ; } ' <nl> + ' Y : 2 : { s : 9 : " first key " ; s : 11 : " first value " ; s : 10 : " second key " ; s : 12 : " second value " ; } ' <nl> ) ; <nl> } <nl> <nl> function provide_hhas_adata_single_quoted ( ) { <nl> / / string . <nl> function provide_hhas_adata_double_quoted ( ) { <nl> return __hhas_adata ( <nl> - " a : 2 : { s : 9 : \ " first key \ " ; s : 11 : \ " first value \ " ; s : 10 : \ " second key \ " ; s : 12 : \ " second value \ " ; } " <nl> + " Y : 2 : { s : 9 : \ " first key \ " ; s : 11 : \ " first value \ " ; s : 10 : \ " second key \ " ; s : 12 : \ " second value \ " ; } " <nl> ) ; <nl> } <nl> <nl> mmm a / hphp / test / slow / hhas_adata / hhas_adata_vec_like_array . php <nl> ppp b / hphp / test / slow / hhas_adata / hhas_adata_vec_like_array . php <nl> <nl> < ? hh <nl> <nl> function provide_constant_vec_like_array ( ) { <nl> - return __hhvm_intrinsics \ dummy_cast_to_kindofarray ( varray [ <nl> - ' first value ' , <nl> - ' second value ' , <nl> - ] ) ; <nl> + return darray [ <nl> + 0 = > ' first value ' , <nl> + 1 = > ' second value ' , <nl> + ] ; <nl> } <nl> <nl> / / Provides the same as the above , but using __hhas_adata with a nowdoc . <nl> function provide_hhas_adata_nowdoc ( ) { <nl> return __hhas_adata ( < < < ' NOWDOC ' <nl> - a : 2 : { i : 0 ; s : 11 : " first value " ; i : 1 ; s : 12 : " second value " ; } <nl> + Y : 2 : { i : 0 ; s : 11 : " first value " ; i : 1 ; s : 12 : " second value " ; } <nl> NOWDOC <nl> ) ; <nl> } <nl> function provide_hhas_adata_nowdoc ( ) { <nl> / / string . <nl> function provide_hhas_adata_single_quoted ( ) { <nl> return __hhas_adata ( <nl> - ' a : 2 : { i : 0 ; s : 11 : " first value " ; i : 1 ; s : 12 : " second value " ; } ' <nl> + ' Y : 2 : { i : 0 ; s : 11 : " first value " ; i : 1 ; s : 12 : " second value " ; } ' <nl> ) ; <nl> } <nl> <nl> function provide_hhas_adata_single_quoted ( ) { <nl> / / string . <nl> function provide_hhas_adata_double_quoted ( ) { <nl> return __hhas_adata ( <nl> - " a : 2 : { i : 0 ; s : 11 : \ " first value \ " ; i : 1 ; s : 12 : \ " second value \ " ; } " <nl> + " Y : 2 : { i : 0 ; s : 11 : \ " first value \ " ; i : 1 ; s : 12 : \ " second value \ " ; } " <nl> ) ; <nl> } <nl> <nl> mmm a / hphp / tools / gdb / gdb - test / quick_asm_iterbreak . hhas . expect <nl> ppp b / hphp / tools / gdb / gdb - test / quick_asm_iterbreak . hhas . expect <nl> <nl> 0xXX + 10 : PopC <nl> 0xXX + 11 : Int 1 <nl> 0xXX + 20 : RetC <nl> - 0xXX + 21 : NewArray 3 <nl> + 0xXX + 21 : NewDArray 3 <nl> 0xXX + 23 : String hello <nl> 0xXX + 28 : String world <nl> 0xXX + 33 : AddElemC <nl> <nl> 0xXX + 58 : PopC <nl> 0xXX + 59 : CGetL 0 ( name : 0 ) <nl> 0xXX + 62 : IterInit 0 k : 1 v : 2 108 <nl> - 0xXX + 71 : String <nl> + 0xXX + 71 : String <nl> <nl> 0xXX + 76 : CGetL2 2 ( name : 2 ) <nl> 0xXX + 79 : Concat <nl> 0xXX + 80 : Print <nl> 0xXX + 81 : PopC <nl> - 0xXX + 82 : String <nl> + 0xXX + 82 : String <nl> <nl> 0xXX + 87 : CGetL2 1 ( name : 1 ) <nl> 0xXX + 90 : Concat <nl> <nl> 0xXX + 92 : PopC <nl> 0xXX + 93 : CGetL 0 ( name : 0 ) <nl> 0xXX + 96 : IterInit 1 k : 3 v : 4 57 <nl> - 0xXX + 105 : String <nl> + 0xXX + 105 : String <nl> <nl> 0xXX + 110 : CGetL2 4 ( name : 4 ) <nl> 0xXX + 113 : Concat <nl> 0xXX + 114 : Print <nl> 0xXX + 115 : PopC <nl> - 0xXX + 116 : String <nl> + 0xXX + 116 : String <nl> <nl> 0xXX + 121 : CGetL2 3 ( name : 3 ) <nl> 0xXX + 124 : Concat <nl>
|
Rip out plain array bytecodes
|
facebook/hhvm
|
f1cec044cbf3958fbbaa7de43dad9d0fee92236a
|
2020-07-08T08:01:10Z
|
mmm a / lib / Sema / CSSimplify . cpp <nl> ppp b / lib / Sema / CSSimplify . cpp <nl> matchCallArguments ( ConstraintSystem & cs , TypeMatchKind kind , <nl> <nl> <nl> auto isOptionalConversion = false ; <nl> - auto tryUser = false ; <nl> + auto notTyVarMatch = false ; <nl> <nl> if ( ! haveOneNonUserConversion ) { <nl> - tryUser = ! ( isa < TypeVariableType > ( argTy - > getDesugaredType ( ) ) | | <nl> - isa < TypeVariableType > ( paramTy - > getDesugaredType ( ) ) ) ; <nl> + notTyVarMatch = ! ( isa < TypeVariableType > ( argTy - > getDesugaredType ( ) ) | | <nl> + isa < TypeVariableType > ( paramTy - > getDesugaredType ( ) ) ) ; <nl> <nl> / / We ' ll bypass optional conversions because of the implicit conversions <nl> / / that take place - there will always be a ValueToOptional disjunctive <nl> / / choice . <nl> - if ( tryUser ) { <nl> + if ( notTyVarMatch ) { <nl> if ( auto boundGenericType = paramTy - > getAs < BoundGenericType > ( ) ) { <nl> auto typeDecl = boundGenericType - > getDecl ( ) ; <nl> - isOptionalConversion = typeDecl - > classifyAsOptionalType ( ) ; <nl> + isOptionalConversion = <nl> + typeDecl - > classifyAsOptionalType ( ) = = <nl> + OTK_ImplicitlyUnwrappedOptional ; <nl> } <nl> } <nl> <nl> - haveOneNonUserConversion = ! tryUser | | <nl> + haveOneNonUserConversion = ( ! notTyVarMatch & & ! paramIdx ) | | <nl> isOptionalConversion | | <nl> haveOneNonUserConversion ; <nl> } <nl> <nl> / / If at least one operator argument can be applied to without a user <nl> / / conversion , there ' s no need to check the others . <nl> - if ( ! haveOneNonUserConversion ) { <nl> + if ( ! haveOneNonUserConversion & & notTyVarMatch ) { <nl> auto applyFlags = subflags | <nl> ConstraintSystem : : TMF_ApplyingOperatorParameter ; <nl> auto nonConversionResult = cs . matchTypes ( argTy , <nl> ConstraintSystem : : matchTypes ( Type type1 , Type type2 , TypeMatchKind kind , <nl> } <nl> <nl> conversionsOrFixes . push_back ( <nl> - ConversionRestrictionKind : : ValueToOptional ) ; <nl> + ConversionRestrictionKind : : ValueToOptional ) ; <nl> } <nl> } <nl> } <nl> mmm a / lib / Sema / TypeCheckConstraints . cpp <nl> ppp b / lib / Sema / TypeCheckConstraints . cpp <nl> bool TypeChecker : : typeCheckBinding ( PatternBindingDecl * binding ) { <nl> / / prior to coercion . <nl> if ( Binding - > isConditional ( ) ) { <nl> auto exprType = solution . simplifyType ( tc , expr - > getType ( ) ) ; <nl> - if ( ! exprType - > getAnyOptionalObjectType ( ) ) { <nl> + auto exprNominalType = exprType - > getNominalOrBoundGenericNominal ( ) ; <nl> + if ( ! ( exprType - > getAnyOptionalObjectType ( ) | | <nl> + ( exprNominalType & & <nl> + exprNominalType - > getNameStr ( ) . equals ( " _Nil " ) ) ) ) { <nl> tc . diagnose ( expr - > getLoc ( ) , <nl> diag : : non_optional_in_conditional_binding ) ; <nl> } <nl> mmm a / stdlib / core / Nil . swift <nl> ppp b / stdlib / core / Nil . swift <nl> struct _NilMirror : Mirror { <nl> var disposition : MirrorDisposition { return . Aggregate } <nl> } <nl> <nl> + / / / FIXME : _NilOptionalComparator is used to influence equality comparison <nl> + / / / operations between values of type _Nil and values of type Optional < T > . <nl> + / / / Specifically , the existence of the overload for ' = = ' below will short - circuit <nl> + / / / the overload resolution process when type checking the expressions " . None = = nil " <nl> + / / / and " nil = = . None " . <nl> + struct _NilOptionalComparator : Equatable { <nl> + } <nl> + <nl> + func = = ( lhs : _NilOptionalComparator , rhs : _NilOptionalComparator ) - > Bool { <nl> + return false <nl> + } <nl> <nl> + extension _Nil { <nl> + @ conversion func __conversion ( ) - > _NilOptionalComparator ? { <nl> + return . None <nl> + } <nl> + } <nl> \ No newline at end of file <nl> mmm a / stdlib / core / Optional . swift <nl> ppp b / stdlib / core / Optional . swift <nl> func ! = < T : Equatable > ( lhs : T ? , rhs : T ? ) - > Bool { <nl> return ! ( lhs = = rhs ) <nl> } <nl> <nl> + @ transparent <nl> + func = = < T > ( lhs : T ? , rhs : _Nil ) - > Bool { <nl> + return ! lhs <nl> + } <nl> + <nl> + @ transparent <nl> + func = = < T > ( lhs : _Nil , rhs : T ? ) - > Bool { <nl> + return ! rhs <nl> + } <nl> + <nl> + @ transparent <nl> + func ! = < T > ( lhs : T ? , rhs : _Nil ) - > Bool { <nl> + return ! ( lhs = = rhs ) <nl> + } <nl> + <nl> + @ transparent <nl> + func ! = < T > ( lhs : _Nil , rhs : T ? ) - > Bool { <nl> + return ! ( lhs = = rhs ) <nl> + } <nl> + <nl> struct _OptionalMirror < T > : Mirror { <nl> let _value : Optional < T > <nl> <nl> mmm a / test / Interpreter / arrays . swift <nl> ppp b / test / Interpreter / arrays . swift <nl> let afd : Float [ ] = [ <nl> 0 . 5 , 0 . 5 , - 0 . 5 , 0 . 0 , 1 . 0 , 0 . 0 , <nl> - 0 . 5 , 0 . 5 , - 0 . 5 , 0 . 0 , 1 . 0 , 2 . 0 <nl> ] <nl> + <nl> + / / Check equality on arrays <nl> + func test ( ) { <nl> + var a = [ 42 ] <nl> + println ( a = = [ 42 ] ) <nl> + } <nl> + test ( ) <nl> + / / CHECK : true <nl> mmm a / test / Interpreter / optional . swift <nl> ppp b / test / Interpreter / optional . swift <nl> test ( . None , { $ 0 as B ? ? } ) <nl> / / CHECK : . Some ( . None ) as B ? ? : . None <nl> / / CHECK : . None as B ? ? : . None <nl> <nl> + class Foo { } <nl> + var x_foo : Foo ! = nil <nl> + if x_foo = = nil { println ( " x_foo is nil " ) } <nl> + / / CHECK : x_foo is nil <nl> + if x_foo ! = nil { println ( " x_foo is not nil " ) } else { println ( " x_foo is nil " ) } <nl> + / / CHECK : x_foo is nil <nl> + if nil = = x_foo { println ( " x_foo is nil " ) } <nl> + / / CHECK : x_foo is nil <nl> + if nil ! = x_foo { println ( " x_foo is not nil " ) } else { println ( " x_foo is nil " ) } <nl> + / / CHECK : x_foo is nil <nl> + <nl> + var y_foo : Foo ? = nil <nl> + if y_foo = = nil { println ( " y_foo is nil " ) } <nl> + / / CHECK : y_foo is nil <nl> + if y_foo ! = nil { println ( " y_foo is not nil " ) } else { println ( " y_foo is nil " ) } <nl> + / / CHECK : y_foo is nil <nl> + if nil = = y_foo { println ( " y_foo is nil " ) } <nl> + / / CHECK : y_foo is nil <nl> + if nil ! = y_foo { println ( " y_foo is not nil " ) } else { println ( " y_foo is nil " ) } <nl> + / / CHECK : y_foo is nil <nl> mmm a / test / expr / expressions . swift <nl> ppp b / test / expr / expressions . swift <nl> func invalidDictionaryLiteral ( ) { <nl> var g = [ 1 : " one " , 2 : ? ? ? ] / / expected - error { { expected value in dictionary literal } } expected - error 2 { { expected ' , ' separator } } expected - error { { expected key expression in dictionary literal } } <nl> } <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / nil / . None comparisons <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + . None = = nil / / expected - error { { could not find member ' None ' } } <nl> + nil = = . None / / expected - error { { could not find member ' None ' } } <nl> mmm a / test / stdlib / NewString . swift <nl> ppp b / test / stdlib / NewString . swift <nl> func ascii ( ) { <nl> / / treating it as an opaque NSString . <nl> var nsASCII = NSString ( UTF8String : " foobar " ) <nl> / / CHECK - NEXT : has UTF16 : false <nl> - println ( " has UTF16 : \ ( CFStringGetCharactersPtr ( reinterpretCast ( nsASCII ) ) ! = nil ) " ) <nl> + println ( " has UTF16 : \ ( CFStringGetCharactersPtr ( reinterpretCast ( nsASCII ) ) ! = ( nil as UnsafePointer < UniChar > ) ) " ) <nl> <nl> / / CHECK : mmm ASCII basic round - tripping mmm <nl> println ( " mmm ASCII basic round - tripping mmm " ) <nl> mmm a / test / stdlib / Nil . swift <nl> ppp b / test / stdlib / Nil . swift <nl> if opaqueNil = = nil { <nl> } <nl> <nl> let unsafeNil : UnsafePointer < Int > = nil <nl> - if unsafeNil = = nil { <nl> - println ( " ok unsafeNil = = nil " ) <nl> - / / CHECK : ok unsafeNil = = nil <nl> + if unsafeNil = = ( nil as UnsafePointer < Int > ) { <nl> + println ( " ok unsafeNil = = ( nil as UnsafePointer < Int > ) " ) <nl> + / / CHECK : ok unsafeNil = = ( nil as UnsafePointer < Int > ) <nl> } <nl> <nl> let removed = NSFileManager . defaultManager ( ) . removeItemAtURL ( NSURL ( string : " / this / file / does / not / exist " ) , error : nil ) <nl>
|
Again , fix two problems with implicit conversions :
|
apple/swift
|
1c53181667a5cfedef9920204794e585ba7e32d2
|
2014-05-21T18:56:35Z
|
new file mode 100644 <nl> index 000000000000 . . ba1dc19173b0 <nl> mmm / dev / null <nl> ppp b / jstests / auth / getMore . js <nl> <nl> + / / Tests that a user can only run a getMore on a cursor that they created . <nl> + ( function ( ) { <nl> + " use strict " ; <nl> + <nl> + function runTest ( conn ) { <nl> + let adminDB = conn . getDB ( " admin " ) ; <nl> + let isMaster = adminDB . runCommand ( " ismaster " ) ; <nl> + assert . commandWorked ( isMaster ) ; <nl> + const isMongos = ( isMaster . msg = = = " isdbgrid " ) ; <nl> + <nl> + / / Create the admin user . <nl> + assert . commandWorked ( <nl> + adminDB . runCommand ( { createUser : " admin " , pwd : " admin " , roles : [ " root " ] } ) ) ; <nl> + assert . eq ( 1 , adminDB . auth ( " admin " , " admin " ) ) ; <nl> + <nl> + let ismmap = false ; <nl> + if ( ! isMongos ) { <nl> + ismmap = assert . commandWorked ( adminDB . serverStatus ( ) ) . storageEngine . name = = " mmapv1 " ; <nl> + } <nl> + <nl> + / / Set up the test database . <nl> + const testDBName = " auth_getMore " ; <nl> + let testDB = adminDB . getSiblingDB ( testDBName ) ; <nl> + testDB . dropDatabase ( ) ; <nl> + assert . writeOK ( testDB . foo . insert ( { _id : 0 } ) ) ; <nl> + assert . writeOK ( testDB . foo . insert ( { _id : 1 } ) ) ; <nl> + assert . writeOK ( testDB . foo . insert ( { _id : 2 } ) ) ; <nl> + <nl> + / / <nl> + / / Test that a user can only run a getMore on a cursor that they created . <nl> + / / <nl> + <nl> + / / Create two users , " Alice " and " Mallory " . <nl> + assert . commandWorked ( <nl> + testDB . runCommand ( { createUser : " Alice " , pwd : " pwd " , roles : [ " readWrite " ] } ) ) ; <nl> + assert . commandWorked ( <nl> + testDB . runCommand ( { createUser : " Mallory " , pwd : " pwd " , roles : [ " readWrite " ] } ) ) ; <nl> + adminDB . logout ( ) ; <nl> + <nl> + / / Test that " Mallory " cannot use a find cursor created by " Alice " . <nl> + assert . eq ( 1 , testDB . auth ( " Alice " , " pwd " ) ) ; <nl> + let res = assert . commandWorked ( testDB . runCommand ( { find : " foo " , batchSize : 0 } ) ) ; <nl> + let cursorId = res . cursor . id ; <nl> + testDB . logout ( ) ; <nl> + assert . eq ( 1 , testDB . auth ( " Mallory " , " pwd " ) ) ; <nl> + assert . commandFailedWithCode ( testDB . runCommand ( { getMore : cursorId , collection : " foo " } ) , <nl> + ErrorCodes . Unauthorized , <nl> + " read from another user ' s find cursor " ) ; <nl> + testDB . logout ( ) ; <nl> + <nl> + / / Test that " Mallory " cannot use a legacy find cursor created by " Alice " . <nl> + testDB . getMongo ( ) . forceReadMode ( " legacy " ) ; <nl> + assert . eq ( 1 , testDB . auth ( " Alice " , " pwd " ) ) ; <nl> + let cursor = testDB . foo . find ( ) . batchSize ( 2 ) ; <nl> + cursor . next ( ) ; <nl> + cursor . next ( ) ; <nl> + testDB . logout ( ) ; <nl> + assert . eq ( 1 , testDB . auth ( " Mallory " , " pwd " ) ) ; <nl> + assert . throws ( function ( ) { <nl> + cursor . next ( ) ; <nl> + } , [ ] , " read from another user ' s legacy find cursor " ) ; <nl> + testDB . logout ( ) ; <nl> + testDB . getMongo ( ) . forceReadMode ( " commands " ) ; <nl> + <nl> + / / Test that " Mallory " cannot use an aggregation cursor created by " Alice " . <nl> + assert . eq ( 1 , testDB . auth ( " Alice " , " pwd " ) ) ; <nl> + res = assert . commandWorked ( <nl> + testDB . runCommand ( { aggregate : " foo " , pipeline : [ ] , cursor : { batchSize : 0 } } ) ) ; <nl> + cursorId = res . cursor . id ; <nl> + testDB . logout ( ) ; <nl> + assert . eq ( 1 , testDB . auth ( " Mallory " , " pwd " ) ) ; <nl> + assert . commandFailedWithCode ( testDB . runCommand ( { getMore : cursorId , collection : " foo " } ) , <nl> + ErrorCodes . Unauthorized , <nl> + " read from another user ' s aggregate cursor " ) ; <nl> + testDB . logout ( ) ; <nl> + <nl> + / / Test that " Mallory " cannot use a listCollections cursor created by " Alice " . <nl> + assert . eq ( 1 , testDB . auth ( " Alice " , " pwd " ) ) ; <nl> + res = assert . commandWorked ( testDB . runCommand ( { listCollections : 1 , cursor : { batchSize : 0 } } ) ) ; <nl> + cursorId = res . cursor . id ; <nl> + testDB . logout ( ) ; <nl> + assert . eq ( 1 , testDB . auth ( " Mallory " , " pwd " ) ) ; <nl> + assert . commandFailedWithCode ( <nl> + testDB . runCommand ( { getMore : cursorId , collection : " $ cmd . listCollections " } ) , <nl> + ErrorCodes . Unauthorized , <nl> + " read from another user ' s listCollections cursor " ) ; <nl> + testDB . logout ( ) ; <nl> + <nl> + / / Test that " Mallory " cannot use a listIndexes cursor created by " Alice " . <nl> + assert . eq ( 1 , testDB . auth ( " Alice " , " pwd " ) ) ; <nl> + res = assert . commandWorked ( testDB . runCommand ( { listIndexes : " foo " , cursor : { batchSize : 0 } } ) ) ; <nl> + cursorId = res . cursor . id ; <nl> + testDB . logout ( ) ; <nl> + assert . eq ( 1 , testDB . auth ( " Mallory " , " pwd " ) ) ; <nl> + assert . commandFailedWithCode ( <nl> + testDB . runCommand ( { getMore : cursorId , collection : " $ cmd . listIndexes . foo " } ) , <nl> + ErrorCodes . Unauthorized , <nl> + " read from another user ' s listIndexes cursor " ) ; <nl> + testDB . logout ( ) ; <nl> + <nl> + / / Test that " Mallory " cannot use a parallelCollectionScan cursor created by " Alice " . <nl> + if ( ! isMongos ) { <nl> + assert . eq ( 1 , testDB . auth ( " Alice " , " pwd " ) ) ; <nl> + res = assert . commandWorked ( <nl> + testDB . runCommand ( { parallelCollectionScan : " foo " , numCursors : 1 } ) ) ; <nl> + assert . eq ( res . cursors . length , 1 , tojson ( res ) ) ; <nl> + cursorId = res . cursors [ 0 ] . cursor . id ; <nl> + testDB . logout ( ) ; <nl> + assert . eq ( 1 , testDB . auth ( " Mallory " , " pwd " ) ) ; <nl> + assert . commandFailedWithCode ( testDB . runCommand ( { getMore : cursorId , collection : " foo " } ) , <nl> + ErrorCodes . Unauthorized , <nl> + " read from another user ' s parallelCollectionScan cursor " ) ; <nl> + testDB . logout ( ) ; <nl> + } <nl> + <nl> + / / Test that " Mallory " cannot use a repairCursor cursor created by " Alice " . <nl> + if ( ! isMongos & & ismmap ) { <nl> + assert . eq ( 1 , testDB . auth ( " Alice " , " pwd " ) ) ; <nl> + res = assert . commandWorked ( testDB . runCommand ( { repairCursor : " foo " } ) ) ; <nl> + cursorId = res . cursor . id ; <nl> + testDB . logout ( ) ; <nl> + assert . eq ( 1 , testDB . auth ( " Mallory " , " pwd " ) ) ; <nl> + assert . commandFailedWithCode ( testDB . runCommand ( { getMore : cursorId , collection : " foo " } ) , <nl> + ErrorCodes . Unauthorized , <nl> + " read from another user ' s repairCursor cursor " ) ; <nl> + testDB . logout ( ) ; <nl> + } <nl> + <nl> + / / <nl> + / / Test that a user can run a getMore on an aggregate cursor they created , even if some <nl> + / / privileges required for the pipeline have been revoked in the meantime . <nl> + / / <nl> + <nl> + assert . eq ( 1 , testDB . auth ( " Alice " , " pwd " ) ) ; <nl> + res = assert . commandWorked ( testDB . runCommand ( { <nl> + aggregate : " foo " , <nl> + pipeline : [ { $ match : { _id : 0 } } , { $ out : " out " } ] , <nl> + cursor : { batchSize : 0 } <nl> + } ) ) ; <nl> + cursorId = res . cursor . id ; <nl> + testDB . logout ( ) ; <nl> + assert . eq ( 1 , adminDB . auth ( " admin " , " admin " ) ) ; <nl> + testDB . revokeRolesFromUser ( " Alice " , [ " readWrite " ] ) ; <nl> + testDB . grantRolesToUser ( " Alice " , [ " read " ] ) ; <nl> + adminDB . logout ( ) ; <nl> + assert . eq ( 1 , testDB . auth ( " Alice " , " pwd " ) ) ; <nl> + assert . commandFailedWithCode ( <nl> + testDB . runCommand ( { aggregate : " foo " , pipeline : [ { $ match : { _id : 0 } } , { $ out : " out " } ] } ) , <nl> + ErrorCodes . Unauthorized , <nl> + " user should no longer have write privileges " ) ; <nl> + res = assert . commandWorked ( testDB . runCommand ( { getMore : cursorId , collection : " foo " } ) ) ; <nl> + assert . eq ( 1 , testDB . out . find ( ) . itcount ( ) ) ; <nl> + <nl> + / / <nl> + / / Test that if there were multiple users authenticated when the cursor was created , then at <nl> + / / least one of them must be authenticated in order to run getMore on the cursor . <nl> + / / <nl> + <nl> + assert . eq ( 1 , adminDB . auth ( " admin " , " admin " ) ) ; <nl> + assert . writeOK ( testDB . bar . insert ( { _id : 0 } ) ) ; <nl> + <nl> + / / Create a user " fooUser " on the test database that can read the " foo " collection . <nl> + assert . commandWorked ( testDB . runCommand ( { <nl> + createRole : " readFoo " , <nl> + privileges : [ { resource : { db : testDBName , collection : " foo " } , actions : [ " find " ] } ] , <nl> + roles : [ ] <nl> + } ) ) ; <nl> + assert . commandWorked ( <nl> + testDB . runCommand ( { createUser : " fooUser " , pwd : " pwd " , roles : [ " readFoo " ] } ) ) ; <nl> + <nl> + / / Create a user " fooBarUser " on the admin database that can read the " foo " and " bar " <nl> + / / collections . <nl> + assert . commandWorked ( adminDB . runCommand ( { <nl> + createRole : " readFooBar " , <nl> + privileges : [ <nl> + { resource : { db : testDBName , collection : " foo " } , actions : [ " find " ] } , <nl> + { resource : { db : testDBName , collection : " bar " } , actions : [ " find " ] } <nl> + ] , <nl> + roles : [ ] <nl> + } ) ) ; <nl> + assert . commandWorked ( <nl> + adminDB . runCommand ( { createUser : " fooBarUser " , pwd : " pwd " , roles : [ " readFooBar " ] } ) ) ; <nl> + <nl> + adminDB . logout ( ) ; <nl> + <nl> + / / Test that a cursor created by " fooUser " and " fooBarUser " can be used by " fooUser " . <nl> + assert . eq ( 1 , testDB . auth ( " fooUser " , " pwd " ) ) ; <nl> + assert . eq ( 1 , adminDB . auth ( " fooBarUser " , " pwd " ) ) ; <nl> + res = assert . commandWorked ( testDB . runCommand ( { find : " foo " , batchSize : 0 } ) ) ; <nl> + cursorId = res . cursor . id ; <nl> + adminDB . logout ( ) ; <nl> + assert . commandWorked ( testDB . runCommand ( { getMore : cursorId , collection : " foo " } ) ) ; <nl> + testDB . logout ( ) ; <nl> + <nl> + / / Test that a cursor created by " fooUser " and " fooBarUser " cannot be used by " fooUser " if <nl> + / / " fooUser " does not have the privilege to read the collection . <nl> + assert . eq ( 1 , testDB . auth ( " fooUser " , " pwd " ) ) ; <nl> + assert . eq ( 1 , adminDB . auth ( " fooBarUser " , " pwd " ) ) ; <nl> + res = assert . commandWorked ( testDB . runCommand ( { find : " bar " , batchSize : 0 } ) ) ; <nl> + cursorId = res . cursor . id ; <nl> + adminDB . logout ( ) ; <nl> + assert . commandFailedWithCode ( testDB . runCommand ( { getMore : cursorId , collection : " bar " } ) , <nl> + ErrorCodes . Unauthorized , <nl> + " ' fooUser ' should not be able to read ' bar ' collection " ) ; <nl> + testDB . logout ( ) ; <nl> + <nl> + / / Test that an aggregate cursor created by " fooUser " and " fooBarUser " can be used by <nl> + / / " fooUser " , even if " fooUser " does not have all privileges required by the pipeline . This <nl> + / / is not desirable behavior , but it will be resolved when we require that only one user be <nl> + / / authenticated at a time . <nl> + assert . eq ( 1 , testDB . auth ( " fooUser " , " pwd " ) ) ; <nl> + assert . eq ( 1 , adminDB . auth ( " fooBarUser " , " pwd " ) ) ; <nl> + res = assert . commandWorked ( testDB . runCommand ( { <nl> + aggregate : " foo " , <nl> + pipeline : [ <nl> + { $ match : { _id : 0 } } , <nl> + { $ lookup : { from : " bar " , localField : " _id " , foreignField : " _id " , as : " bar " } } <nl> + ] , <nl> + cursor : { batchSize : 0 } <nl> + } ) ) ; <nl> + cursorId = res . cursor . id ; <nl> + adminDB . logout ( ) ; <nl> + res = assert . commandWorked ( testDB . runCommand ( { getMore : cursorId , collection : " foo " } ) ) ; <nl> + assert . eq ( res . cursor . nextBatch , [ { _id : 0 , bar : [ { _id : 0 } ] } ] , tojson ( res ) ) ; <nl> + testDB . logout ( ) ; <nl> + } <nl> + <nl> + / / Run the test on a standalone . <nl> + let mongod = MongoRunner . runMongod ( { auth : " " , bind_ip : " 127 . 0 . 0 . 1 " } ) ; <nl> + runTest ( mongod ) ; <nl> + MongoRunner . stopMongod ( mongod ) ; <nl> + <nl> + / / Run the test on a sharded cluster . <nl> + let cluster = new ShardingTest ( <nl> + { shards : 1 , mongos : 1 , keyFile : " jstests / libs / key1 " , other : { shardOptions : { auth : " " } } } ) ; <nl> + runTest ( cluster ) ; <nl> + cluster . stop ( ) ; <nl> + } ( ) ) ; <nl> mmm a / src / mongo / db / auth / authorization_session . cpp <nl> ppp b / src / mongo / db / auth / authorization_session . cpp <nl> <nl> # include " mongo / db / jsobj . h " <nl> # include " mongo / db / namespace_string . h " <nl> # include " mongo / db / pipeline / pipeline . h " <nl> + # include " mongo / db / server_options . h " <nl> # include " mongo / util / assert_util . h " <nl> # include " mongo / util / log . h " <nl> # include " mongo / util / mongoutils / str . h " <nl> bool AuthorizationSession : : isCoauthorizedWithClient ( Client * opClient ) { <nl> return false ; <nl> } <nl> <nl> + bool AuthorizationSession : : isCoauthorizedWith ( UserNameIterator userNameIter ) { <nl> + if ( ! getAuthorizationManager ( ) . isAuthEnabled ( ) ) { <nl> + return true ; <nl> + } <nl> + if ( ! userNameIter . more ( ) & & ! getAuthenticatedUserNames ( ) . more ( ) ) { <nl> + return true ; <nl> + } <nl> + <nl> + for ( ; userNameIter . more ( ) ; userNameIter . next ( ) ) { <nl> + for ( UserNameIterator thisUserNameIter = getAuthenticatedUserNames ( ) ; <nl> + thisUserNameIter . more ( ) ; <nl> + thisUserNameIter . next ( ) ) { <nl> + if ( * userNameIter = = * thisUserNameIter ) { <nl> + return true ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + return false ; <nl> + } <nl> + <nl> UserNameIterator AuthorizationSession : : getImpersonatedUserNames ( ) { <nl> return makeUserNameIterator ( _impersonatedUserNames . begin ( ) , _impersonatedUserNames . end ( ) ) ; <nl> } <nl> mmm a / src / mongo / db / auth / authorization_session . h <nl> ppp b / src / mongo / db / auth / authorization_session . h <nl> class AuthorizationSession { <nl> / / The existence of ' opClient ' must be guaranteed through locks taken by the caller . <nl> bool isCoauthorizedWithClient ( Client * opClient ) ; <nl> <nl> + / / Returns true if the session and ' userNameIter ' share an authenticated user , or if both have <nl> + / / no authenticated users . Impersonated users are not considered as ' authenticated ' for the <nl> + / / purpose of this check . This always returns true if auth is not enabled . <nl> + bool isCoauthorizedWith ( UserNameIterator userNameIter ) ; <nl> + <nl> / / Tells whether impersonation is active or not . This state is set when <nl> / / setImpersonatedUserData is called and cleared when clearImpersonatedUserData is <nl> / / called . <nl> mmm a / src / mongo / db / auth / authorization_session_test . cpp <nl> ppp b / src / mongo / db / auth / authorization_session_test . cpp <nl> TEST_F ( AuthorizationSessionTest , <nl> BSONObj cmdObj = BSON ( " aggregate " < < testFooNss . coll ( ) < < " pipeline " < < pipeline ) ; <nl> ASSERT_OK ( authzSession - > checkAuthForAggregate ( testFooNss , cmdObj ) ) ; <nl> } <nl> + <nl> + TEST_F ( AuthorizationSessionTest , UnauthorizedSessionIsCoauthorizedWithEmptyUserSet ) { <nl> + std : : vector < UserName > userSet ; <nl> + ASSERT_TRUE ( <nl> + authzSession - > isCoauthorizedWith ( makeUserNameIterator ( userSet . begin ( ) , userSet . end ( ) ) ) ) ; <nl> + } <nl> + <nl> + TEST_F ( AuthorizationSessionTest , UnauthorizedSessionIsNotCoauthorizedWithNonemptyUserSet ) { <nl> + std : : vector < UserName > userSet ; <nl> + userSet . emplace_back ( " spencer " , " test " ) ; <nl> + ASSERT_FALSE ( <nl> + authzSession - > isCoauthorizedWith ( makeUserNameIterator ( userSet . begin ( ) , userSet . end ( ) ) ) ) ; <nl> + } <nl> + <nl> + TEST_F ( AuthorizationSessionTest , <nl> + UnauthorizedSessionIsCoauthorizedWithNonemptyUserSetWhenAuthIsDisabled ) { <nl> + authzManager - > setAuthEnabled ( false ) ; <nl> + std : : vector < UserName > userSet ; <nl> + userSet . emplace_back ( " spencer " , " test " ) ; <nl> + ASSERT_TRUE ( <nl> + authzSession - > isCoauthorizedWith ( makeUserNameIterator ( userSet . begin ( ) , userSet . end ( ) ) ) ) ; <nl> + } <nl> + <nl> + TEST_F ( AuthorizationSessionTest , AuthorizedSessionIsNotCoauthorizedWithEmptyUserSet ) { <nl> + ASSERT_OK ( managerState - > insertPrivilegeDocument ( & _opCtx , <nl> + BSON ( " user " <nl> + < < " spencer " <nl> + < < " db " <nl> + < < " test " <nl> + < < " credentials " <nl> + < < BSON ( " MONGODB - CR " <nl> + < < " a " ) <nl> + < < " roles " <nl> + < < BSONArray ( ) ) , <nl> + BSONObj ( ) ) ) ; <nl> + ASSERT_OK ( authzSession - > addAndAuthorizeUser ( & _opCtx , UserName ( " spencer " , " test " ) ) ) ; <nl> + std : : vector < UserName > userSet ; <nl> + ASSERT_FALSE ( <nl> + authzSession - > isCoauthorizedWith ( makeUserNameIterator ( userSet . begin ( ) , userSet . end ( ) ) ) ) ; <nl> + } <nl> + <nl> + TEST_F ( AuthorizationSessionTest , <nl> + AuthorizedSessionIsCoauthorizedWithEmptyUserSetWhenAuthIsDisabled ) { <nl> + authzManager - > setAuthEnabled ( false ) ; <nl> + ASSERT_OK ( managerState - > insertPrivilegeDocument ( & _opCtx , <nl> + BSON ( " user " <nl> + < < " spencer " <nl> + < < " db " <nl> + < < " test " <nl> + < < " credentials " <nl> + < < BSON ( " MONGODB - CR " <nl> + < < " a " ) <nl> + < < " roles " <nl> + < < BSONArray ( ) ) , <nl> + BSONObj ( ) ) ) ; <nl> + ASSERT_OK ( authzSession - > addAndAuthorizeUser ( & _opCtx , UserName ( " spencer " , " test " ) ) ) ; <nl> + std : : vector < UserName > userSet ; <nl> + ASSERT_TRUE ( <nl> + authzSession - > isCoauthorizedWith ( makeUserNameIterator ( userSet . begin ( ) , userSet . end ( ) ) ) ) ; <nl> + } <nl> + <nl> + TEST_F ( AuthorizationSessionTest , AuthorizedSessionIsCoauthorizedWithIntersectingUserSet ) { <nl> + ASSERT_OK ( managerState - > insertPrivilegeDocument ( & _opCtx , <nl> + BSON ( " user " <nl> + < < " spencer " <nl> + < < " db " <nl> + < < " test " <nl> + < < " credentials " <nl> + < < BSON ( " MONGODB - CR " <nl> + < < " a " ) <nl> + < < " roles " <nl> + < < BSONArray ( ) ) , <nl> + BSONObj ( ) ) ) ; <nl> + ASSERT_OK ( managerState - > insertPrivilegeDocument ( & _opCtx , <nl> + BSON ( " user " <nl> + < < " admin " <nl> + < < " db " <nl> + < < " test " <nl> + < < " credentials " <nl> + < < BSON ( " MONGODB - CR " <nl> + < < " a " ) <nl> + < < " roles " <nl> + < < BSONArray ( ) ) , <nl> + BSONObj ( ) ) ) ; <nl> + ASSERT_OK ( authzSession - > addAndAuthorizeUser ( & _opCtx , UserName ( " spencer " , " test " ) ) ) ; <nl> + ASSERT_OK ( authzSession - > addAndAuthorizeUser ( & _opCtx , UserName ( " admin " , " test " ) ) ) ; <nl> + std : : vector < UserName > userSet ; <nl> + userSet . emplace_back ( " admin " , " test " ) ; <nl> + userSet . emplace_back ( " tess " , " test " ) ; <nl> + ASSERT_TRUE ( <nl> + authzSession - > isCoauthorizedWith ( makeUserNameIterator ( userSet . begin ( ) , userSet . end ( ) ) ) ) ; <nl> + } <nl> + <nl> + TEST_F ( AuthorizationSessionTest , AuthorizedSessionIsNotCoauthorizedWithNonintersectingUserSet ) { <nl> + ASSERT_OK ( managerState - > insertPrivilegeDocument ( & _opCtx , <nl> + BSON ( " user " <nl> + < < " spencer " <nl> + < < " db " <nl> + < < " test " <nl> + < < " credentials " <nl> + < < BSON ( " MONGODB - CR " <nl> + < < " a " ) <nl> + < < " roles " <nl> + < < BSONArray ( ) ) , <nl> + BSONObj ( ) ) ) ; <nl> + ASSERT_OK ( managerState - > insertPrivilegeDocument ( & _opCtx , <nl> + BSON ( " user " <nl> + < < " admin " <nl> + < < " db " <nl> + < < " test " <nl> + < < " credentials " <nl> + < < BSON ( " MONGODB - CR " <nl> + < < " a " ) <nl> + < < " roles " <nl> + < < BSONArray ( ) ) , <nl> + BSONObj ( ) ) ) ; <nl> + ASSERT_OK ( authzSession - > addAndAuthorizeUser ( & _opCtx , UserName ( " spencer " , " test " ) ) ) ; <nl> + ASSERT_OK ( authzSession - > addAndAuthorizeUser ( & _opCtx , UserName ( " admin " , " test " ) ) ) ; <nl> + std : : vector < UserName > userSet ; <nl> + userSet . emplace_back ( " tess " , " test " ) ; <nl> + ASSERT_FALSE ( <nl> + authzSession - > isCoauthorizedWith ( makeUserNameIterator ( userSet . begin ( ) , userSet . end ( ) ) ) ) ; <nl> + } <nl> + <nl> + TEST_F ( AuthorizationSessionTest , <nl> + AuthorizedSessionIsCoauthorizedWithNonintersectingUserSetWhenAuthIsDisabled ) { <nl> + authzManager - > setAuthEnabled ( false ) ; <nl> + ASSERT_OK ( managerState - > insertPrivilegeDocument ( & _opCtx , <nl> + BSON ( " user " <nl> + < < " spencer " <nl> + < < " db " <nl> + < < " test " <nl> + < < " credentials " <nl> + < < BSON ( " MONGODB - CR " <nl> + < < " a " ) <nl> + < < " roles " <nl> + < < BSONArray ( ) ) , <nl> + BSONObj ( ) ) ) ; <nl> + ASSERT_OK ( managerState - > insertPrivilegeDocument ( & _opCtx , <nl> + BSON ( " user " <nl> + < < " admin " <nl> + < < " db " <nl> + < < " test " <nl> + < < " credentials " <nl> + < < BSON ( " MONGODB - CR " <nl> + < < " a " ) <nl> + < < " roles " <nl> + < < BSONArray ( ) ) , <nl> + BSONObj ( ) ) ) ; <nl> + ASSERT_OK ( authzSession - > addAndAuthorizeUser ( & _opCtx , UserName ( " spencer " , " test " ) ) ) ; <nl> + ASSERT_OK ( authzSession - > addAndAuthorizeUser ( & _opCtx , UserName ( " admin " , " test " ) ) ) ; <nl> + std : : vector < UserName > userSet ; <nl> + userSet . emplace_back ( " tess " , " test " ) ; <nl> + ASSERT_TRUE ( <nl> + authzSession - > isCoauthorizedWith ( makeUserNameIterator ( userSet . begin ( ) , userSet . end ( ) ) ) ) ; <nl> + } <nl> } / / namespace <nl> } / / namespace mongo <nl> mmm a / src / mongo / db / clientcursor . cpp <nl> ppp b / src / mongo / db / clientcursor . cpp <nl> ClientCursor : : ClientCursor ( ClientCursorParams & & params , <nl> CursorId cursorId ) <nl> : _cursorid ( cursorId ) , <nl> _nss ( std : : move ( params . nss ) ) , <nl> + _authenticatedUsers ( std : : move ( params . authenticatedUsers ) ) , <nl> _isReadCommitted ( params . isReadCommitted ) , <nl> _cursorManager ( cursorManager ) , <nl> _originatingCommand ( params . originatingCommandObj ) , <nl> mmm a / src / mongo / db / clientcursor . h <nl> ppp b / src / mongo / db / clientcursor . h <nl> <nl> # pragma once <nl> <nl> # include " mongo / client / dbclientinterface . h " <nl> + # include " mongo / db / auth / user_name . h " <nl> # include " mongo / db / cursor_id . h " <nl> # include " mongo / db / jsobj . h " <nl> # include " mongo / db / query / plan_executor . h " <nl> class RecoveryUnit ; <nl> struct ClientCursorParams { <nl> ClientCursorParams ( std : : unique_ptr < PlanExecutor > planExecutor , <nl> NamespaceString nss , <nl> + UserNameIterator authenticatedUsersIter , <nl> bool isReadCommitted , <nl> BSONObj originatingCommandObj ) <nl> : exec ( std : : move ( planExecutor ) ) , <nl> struct ClientCursorParams { <nl> queryOptions ( exec - > getCanonicalQuery ( ) <nl> ? exec - > getCanonicalQuery ( ) - > getQueryRequest ( ) . getOptions ( ) <nl> : 0 ) , <nl> - originatingCommandObj ( originatingCommandObj . getOwned ( ) ) { } <nl> + originatingCommandObj ( originatingCommandObj . getOwned ( ) ) { <nl> + while ( authenticatedUsersIter . more ( ) ) { <nl> + authenticatedUsers . emplace_back ( authenticatedUsersIter . next ( ) ) ; <nl> + } <nl> + } <nl> <nl> std : : unique_ptr < PlanExecutor > exec ; <nl> const NamespaceString nss ; <nl> + std : : vector < UserName > authenticatedUsers ; <nl> bool isReadCommitted = false ; <nl> int queryOptions = 0 ; <nl> BSONObj originatingCommandObj ; <nl> class ClientCursor { <nl> return _nss ; <nl> } <nl> <nl> + UserNameIterator getAuthenticatedUsers ( ) const { <nl> + return makeUserNameIterator ( _authenticatedUsers . begin ( ) , _authenticatedUsers . end ( ) ) ; <nl> + } <nl> + <nl> bool isReadCommitted ( ) const { <nl> return _isReadCommitted ; <nl> } <nl> class ClientCursor { <nl> / / The namespace we ' re operating on . <nl> const NamespaceString _nss ; <nl> <nl> + / / The set of authenticated users when this cursor was created . <nl> + std : : vector < UserName > _authenticatedUsers ; <nl> + <nl> const bool _isReadCommitted = false ; <nl> <nl> / / A pointer to the CursorManager which owns this cursor . This must be filled out when the <nl> mmm a / src / mongo / db / commands / find_cmd . cpp <nl> ppp b / src / mongo / db / commands / find_cmd . cpp <nl> class FindCmd : public Command { <nl> ClientCursorPin pinnedCursor = collection - > getCursorManager ( ) - > registerCursor ( <nl> { std : : move ( exec ) , <nl> nss , <nl> + AuthorizationSession : : get ( opCtx - > getClient ( ) ) - > getAuthenticatedUserNames ( ) , <nl> opCtx - > recoveryUnit ( ) - > isReadingFromMajorityCommittedSnapshot ( ) , <nl> cmdObj } ) ; <nl> cursorId = pinnedCursor . getCursor ( ) - > cursorid ( ) ; <nl> mmm a / src / mongo / db / commands / getmore_cmd . cpp <nl> ppp b / src / mongo / db / commands / getmore_cmd . cpp <nl> class GetMoreCmd : public Command { <nl> } <nl> } <nl> <nl> + / / A user can only call getMore on their own cursor . If there were multiple users <nl> + / / authenticated when the cursor was created , then at least one of them must be <nl> + / / authenticated in order to run getMore on the cursor . <nl> + if ( ! AuthorizationSession : : get ( opCtx - > getClient ( ) ) <nl> + - > isCoauthorizedWith ( cursor - > getAuthenticatedUsers ( ) ) ) { <nl> + return appendCommandStatus ( <nl> + result , <nl> + Status ( ErrorCodes : : Unauthorized , <nl> + str : : stream ( ) < < " cursor id " < < request . cursorid <nl> + < < " was not created by the authenticated user " ) ) ; <nl> + } <nl> + <nl> if ( request . nss ! = cursor - > nss ( ) ) { <nl> return appendCommandStatus ( <nl> result , <nl> mmm a / src / mongo / db / commands / list_collections . cpp <nl> ppp b / src / mongo / db / commands / list_collections . cpp <nl> class CmdListCollections : public Command { <nl> auto pinnedCursor = CursorManager : : getGlobalCursorManager ( ) - > registerCursor ( <nl> { std : : move ( exec ) , <nl> cursorNss , <nl> + AuthorizationSession : : get ( opCtx - > getClient ( ) ) - > getAuthenticatedUserNames ( ) , <nl> opCtx - > recoveryUnit ( ) - > isReadingFromMajorityCommittedSnapshot ( ) , <nl> jsobj } ) ; <nl> cursorId = pinnedCursor . getCursor ( ) - > cursorid ( ) ; <nl> mmm a / src / mongo / db / commands / list_indexes . cpp <nl> ppp b / src / mongo / db / commands / list_indexes . cpp <nl> class CmdListIndexes : public Command { <nl> auto pinnedCursor = CursorManager : : getGlobalCursorManager ( ) - > registerCursor ( <nl> { std : : move ( exec ) , <nl> cursorNss , <nl> + AuthorizationSession : : get ( opCtx - > getClient ( ) ) - > getAuthenticatedUserNames ( ) , <nl> opCtx - > recoveryUnit ( ) - > isReadingFromMajorityCommittedSnapshot ( ) , <nl> cmdObj } ) ; <nl> cursorId = pinnedCursor . getCursor ( ) - > cursorid ( ) ; <nl> mmm a / src / mongo / db / commands / parallel_collection_scan . cpp <nl> ppp b / src / mongo / db / commands / parallel_collection_scan . cpp <nl> class ParallelCollectionScanCmd : public Command { <nl> auto pinnedCursor = collection - > getCursorManager ( ) - > registerCursor ( <nl> { std : : move ( exec ) , <nl> ns , <nl> + AuthorizationSession : : get ( opCtx - > getClient ( ) ) - > getAuthenticatedUserNames ( ) , <nl> opCtx - > recoveryUnit ( ) - > isReadingFromMajorityCommittedSnapshot ( ) , <nl> cmdObj } ) ; <nl> pinnedCursor . getCursor ( ) - > setLeftoverMaxTimeMicros ( <nl> mmm a / src / mongo / db / commands / repair_cursor . cpp <nl> ppp b / src / mongo / db / commands / repair_cursor . cpp <nl> class RepairCursorCmd : public Command { <nl> auto pinnedCursor = collection - > getCursorManager ( ) - > registerCursor ( <nl> { std : : move ( exec ) , <nl> ns , <nl> + AuthorizationSession : : get ( opCtx - > getClient ( ) ) - > getAuthenticatedUserNames ( ) , <nl> opCtx - > recoveryUnit ( ) - > isReadingFromMajorityCommittedSnapshot ( ) , <nl> cmdObj } ) ; <nl> <nl> mmm a / src / mongo / db / commands / run_aggregate . cpp <nl> ppp b / src / mongo / db / commands / run_aggregate . cpp <nl> <nl> # include < boost / optional . hpp > <nl> # include < vector > <nl> <nl> + # include " mongo / db / auth / authorization_session . h " <nl> # include " mongo / db / catalog / database . h " <nl> # include " mongo / db / curop . h " <nl> # include " mongo / db / db_raii . h " <nl> Status runAggregate ( OperationContext * opCtx , <nl> auto pin = CursorManager : : getGlobalCursorManager ( ) - > registerCursor ( <nl> { std : : move ( exec ) , <nl> origNss , <nl> + AuthorizationSession : : get ( opCtx - > getClient ( ) ) - > getAuthenticatedUserNames ( ) , <nl> opCtx - > recoveryUnit ( ) - > isReadingFromMajorityCommittedSnapshot ( ) , <nl> cmdObj } ) ; <nl> ScopeGuard cursorFreer = MakeGuard ( & ClientCursorPin : : deleteUnderlying , & pin ) ; <nl> mmm a / src / mongo / db / query / find . cpp <nl> ppp b / src / mongo / db / query / find . cpp <nl> <nl> # include " mongo / db / query / find . h " <nl> <nl> # include " mongo / client / dbclientinterface . h " <nl> + # include " mongo / db / auth / authorization_session . h " <nl> # include " mongo / db / catalog / collection . h " <nl> # include " mongo / db / catalog / database_holder . h " <nl> # include " mongo / db / client . h " <nl> Message getMore ( OperationContext * opCtx , <nl> < < " belongs to namespace " <nl> < < cc - > nss ( ) . ns ( ) , <nl> nss = = cc - > nss ( ) ) ; <nl> + <nl> + / / A user can only call getMore on their own cursor . If there were multiple users <nl> + / / authenticated when the cursor was created , then at least one of them must be <nl> + / / authenticated in order to run getMore on the cursor . <nl> + uassert ( ErrorCodes : : Unauthorized , <nl> + str : : stream ( ) < < " cursor id " < < cursorid <nl> + < < " was not created by the authenticated user " , <nl> + AuthorizationSession : : get ( opCtx - > getClient ( ) ) <nl> + - > isCoauthorizedWith ( cc - > getAuthenticatedUsers ( ) ) ) ; <nl> + <nl> * isCursorAuthorized = true ; <nl> <nl> if ( cc - > isReadCommitted ( ) ) <nl> std : : string runQuery ( OperationContext * opCtx , <nl> ClientCursorPin pinnedCursor = collection - > getCursorManager ( ) - > registerCursor ( <nl> { std : : move ( exec ) , <nl> nss , <nl> + AuthorizationSession : : get ( opCtx - > getClient ( ) ) - > getAuthenticatedUserNames ( ) , <nl> opCtx - > recoveryUnit ( ) - > isReadingFromMajorityCommittedSnapshot ( ) , <nl> upconvertQueryEntry ( q . query , qr . nss ( ) , q . ntoreturn , q . ntoskip ) } ) ; <nl> ccId = pinnedCursor . getCursor ( ) - > cursorid ( ) ; <nl> mmm a / src / mongo / dbtests / query_plan_executor . cpp <nl> ppp b / src / mongo / dbtests / query_plan_executor . cpp <nl> class Invalidate : public PlanExecutorBase { <nl> auto exec = makeCollScanExec ( coll , filterObj ) ; <nl> <nl> / / Make a client cursor from the plan executor . <nl> - coll - > getCursorManager ( ) - > registerCursor ( { std : : move ( exec ) , nss , false , BSONObj ( ) } ) ; <nl> + coll - > getCursorManager ( ) - > registerCursor ( { std : : move ( exec ) , nss , { } , false , BSONObj ( ) } ) ; <nl> <nl> / / There should be one cursor before invalidation , <nl> / / and zero cursors after invalidation . <nl> class InvalidatePinned : public PlanExecutorBase { <nl> <nl> / / Make a client cursor from the plan executor . <nl> auto ccPin = collection - > getCursorManager ( ) - > registerCursor ( <nl> - { std : : move ( exec ) , nss , false , BSONObj ( ) } ) ; <nl> + { std : : move ( exec ) , nss , { } , false , BSONObj ( ) } ) ; <nl> <nl> / / If the cursor is pinned , it sticks around , even after invalidation . <nl> ASSERT_EQUALS ( 1U , numCursors ( ) ) ; <nl> class Timeout : public PlanExecutorBase { <nl> <nl> / / Make a client cursor from the plan executor . <nl> collection - > getCursorManager ( ) - > registerCursor ( <nl> - { std : : move ( exec ) , nss , false , BSONObj ( ) } ) ; <nl> + { std : : move ( exec ) , nss , { } , false , BSONObj ( ) } ) ; <nl> } <nl> <nl> / / There should be one cursor before timeout , <nl> mmm a / src / mongo / dbtests / querytests . cpp <nl> ppp b / src / mongo / dbtests / querytests . cpp <nl> class GlobalCursorManagerShouldReportOwnershipOfCursorsItCreated : public Cursor <nl> for ( int i = 0 ; i < 1000 ; i + + ) { <nl> auto exec = makeFakePlanExecutor ( opCtx . get ( ) ) ; <nl> auto cursorPin = CursorManager : : getGlobalCursorManager ( ) - > registerCursor ( <nl> - { std : : move ( exec ) , NamespaceString { " test . collection " } , false , BSONObj ( ) } ) ; <nl> + { std : : move ( exec ) , NamespaceString { " test . collection " } , { } , false , BSONObj ( ) } ) ; <nl> ASSERT_TRUE ( CursorManager : : isGloballyManagedCursor ( cursorPin . getCursor ( ) - > cursorid ( ) ) ) ; <nl> } <nl> } <nl> class CursorsFromCollectionCursorManagerShouldNotReportBeingManagedByGlobalCurso <nl> for ( int i = 0 ; i < 1000 ; i + + ) { <nl> auto exec = makeFakePlanExecutor ( opCtx . get ( ) ) ; <nl> auto cursorPin = testManager . registerCursor ( <nl> - { std : : move ( exec ) , NamespaceString { " test . collection " } , false , BSONObj ( ) } ) ; <nl> + { std : : move ( exec ) , NamespaceString { " test . collection " } , { } , false , BSONObj ( ) } ) ; <nl> ASSERT_FALSE ( CursorManager : : isGloballyManagedCursor ( cursorPin . getCursor ( ) - > cursorid ( ) ) ) ; <nl> } <nl> } <nl> class AllCursorsFromCollectionCursorManagerShouldContainIdentical32BitPrefixes <nl> for ( int i = 0 ; i < 1000 ; i + + ) { <nl> auto exec = makeFakePlanExecutor ( opCtx . get ( ) ) ; <nl> auto cursorPin = testManager . registerCursor ( <nl> - { std : : move ( exec ) , NamespaceString { " test . collection " } , false , BSONObj ( ) } ) ; <nl> + { std : : move ( exec ) , NamespaceString { " test . collection " } , { } , false , BSONObj ( ) } ) ; <nl> auto cursorId = cursorPin . getCursor ( ) - > cursorid ( ) ; <nl> if ( prefix ) { <nl> ASSERT_EQ ( * prefix , extractLeading32Bits ( cursorId ) ) ; <nl> mmm a / src / mongo / s / query / async_results_merger_test . cpp <nl> ppp b / src / mongo / s / query / async_results_merger_test . cpp <nl> class AsyncResultsMergerTest : public ShardingTestFixture { <nl> const auto qr = <nl> unittest : : assertGet ( QueryRequest : : makeFromFindCommand ( _nss , findCmd , isExplain ) ) ; <nl> <nl> - _params = stdx : : make_unique < ClusterClientCursorParams > ( _nss , readPref ) ; <nl> + _params = stdx : : make_unique < ClusterClientCursorParams > ( _nss , UserNameIterator ( ) , readPref ) ; <nl> _params - > sort = qr - > getSort ( ) ; <nl> _params - > limit = qr - > getLimit ( ) ; <nl> _params - > batchSize = getMoreBatchSize ? getMoreBatchSize : qr - > getBatchSize ( ) ; <nl> class AsyncResultsMergerTest : public ShardingTestFixture { <nl> * / <nl> void makeCursorFromExistingCursors ( <nl> const std : : vector < std : : pair < HostAndPort , CursorId > > & remotes ) { <nl> - _params = stdx : : make_unique < ClusterClientCursorParams > ( _nss ) ; <nl> + _params = stdx : : make_unique < ClusterClientCursorParams > ( _nss , UserNameIterator ( ) ) ; <nl> <nl> for ( const auto & hostIdPair : remotes ) { <nl> _params - > remotes . emplace_back ( hostIdPair . first , hostIdPair . second ) ; <nl> mmm a / src / mongo / s / query / cluster_client_cursor . h <nl> ppp b / src / mongo / s / query / cluster_client_cursor . h <nl> <nl> <nl> # include < boost / optional . hpp > <nl> <nl> + # include " mongo / db / auth / user_name . h " <nl> # include " mongo / db / jsobj . h " <nl> # include " mongo / s / query / cluster_query_result . h " <nl> # include " mongo / util / time_support . h " <nl> class ClusterClientCursor { <nl> * / <nl> virtual bool isTailable ( ) const = 0 ; <nl> <nl> + / * * <nl> + * Returns the set of authenticated users when this cursor was created . <nl> + * / <nl> + virtual UserNameIterator getAuthenticatedUsers ( ) const = 0 ; <nl> + <nl> / * * <nl> * Returns the view definition associated with this cursor , if any . <nl> * / <nl> mmm a / src / mongo / s / query / cluster_client_cursor_impl . cpp <nl> ppp b / src / mongo / s / query / cluster_client_cursor_impl . cpp <nl> bool ClusterClientCursorImpl : : isTailable ( ) const { <nl> return _params . isTailable ; <nl> } <nl> <nl> + UserNameIterator ClusterClientCursorImpl : : getAuthenticatedUsers ( ) const { <nl> + return makeUserNameIterator ( _params . authenticatedUsers . begin ( ) , <nl> + _params . authenticatedUsers . end ( ) ) ; <nl> + } <nl> + <nl> boost : : optional < BSONObj > ClusterClientCursorImpl : : viewDefinition ( ) const { <nl> return _params . viewDefinition ; <nl> } <nl> mmm a / src / mongo / s / query / cluster_client_cursor_impl . h <nl> ppp b / src / mongo / s / query / cluster_client_cursor_impl . h <nl> class ClusterClientCursorImpl final : public ClusterClientCursor { <nl> <nl> bool isTailable ( ) const final ; <nl> <nl> + UserNameIterator getAuthenticatedUsers ( ) const final ; <nl> + <nl> boost : : optional < BSONObj > viewDefinition ( ) const final ; <nl> <nl> long long getNumReturnedSoFar ( ) const final ; <nl> mmm a / src / mongo / s / query / cluster_client_cursor_impl_test . cpp <nl> ppp b / src / mongo / s / query / cluster_client_cursor_impl_test . cpp <nl> TEST ( ClusterClientCursorImpl , NumReturnedSoFar ) { <nl> } <nl> <nl> ClusterClientCursorImpl cursor ( std : : move ( mockStage ) , <nl> - ClusterClientCursorParams ( NamespaceString ( " unused " ) ) ) ; <nl> + ClusterClientCursorParams ( NamespaceString ( " unused " ) , { } ) ) ; <nl> <nl> ASSERT_EQ ( cursor . getNumReturnedSoFar ( ) , 0 ) ; <nl> <nl> TEST ( ClusterClientCursorImpl , QueueResult ) { <nl> mockStage - > queueResult ( BSON ( " a " < < 4 ) ) ; <nl> <nl> ClusterClientCursorImpl cursor ( std : : move ( mockStage ) , <nl> - ClusterClientCursorParams ( NamespaceString ( " unused " ) ) ) ; <nl> + ClusterClientCursorParams ( NamespaceString ( " unused " ) , { } ) ) ; <nl> <nl> auto firstResult = cursor . next ( nullptr ) ; <nl> ASSERT_OK ( firstResult . getStatus ( ) ) ; <nl> TEST ( ClusterClientCursorImpl , RemotesExhausted ) { <nl> mockStage - > markRemotesExhausted ( ) ; <nl> <nl> ClusterClientCursorImpl cursor ( std : : move ( mockStage ) , <nl> - ClusterClientCursorParams ( NamespaceString ( " unused " ) ) ) ; <nl> + ClusterClientCursorParams ( NamespaceString ( " unused " ) , { } ) ) ; <nl> ASSERT_TRUE ( cursor . remotesExhausted ( ) ) ; <nl> <nl> auto firstResult = cursor . next ( nullptr ) ; <nl> TEST ( ClusterClientCursorImpl , ForwardsAwaitDataTimeout ) { <nl> ASSERT_NOT_OK ( mockStage - > getAwaitDataTimeout ( ) . getStatus ( ) ) ; <nl> <nl> ClusterClientCursorImpl cursor ( std : : move ( mockStage ) , <nl> - ClusterClientCursorParams ( NamespaceString ( " unused " ) ) ) ; <nl> + ClusterClientCursorParams ( NamespaceString ( " unused " ) , { } ) ) ; <nl> ASSERT_OK ( cursor . setAwaitDataTimeout ( Milliseconds ( 789 ) ) ) ; <nl> <nl> auto awaitDataTimeout = mockStagePtr - > getAwaitDataTimeout ( ) ; <nl> mmm a / src / mongo / s / query / cluster_client_cursor_mock . cpp <nl> ppp b / src / mongo / s / query / cluster_client_cursor_mock . cpp <nl> bool ClusterClientCursorMock : : isTailable ( ) const { <nl> return false ; <nl> } <nl> <nl> + namespace { <nl> + const std : : vector < UserName > emptyAuthenticatedUsers { } ; <nl> + } / / namespace <nl> + <nl> + UserNameIterator ClusterClientCursorMock : : getAuthenticatedUsers ( ) const { <nl> + return makeUserNameIterator ( emptyAuthenticatedUsers . begin ( ) , emptyAuthenticatedUsers . end ( ) ) ; <nl> + } <nl> + <nl> boost : : optional < BSONObj > ClusterClientCursorMock : : viewDefinition ( ) const { <nl> return boost : : none ; <nl> } <nl> mmm a / src / mongo / s / query / cluster_client_cursor_mock . h <nl> ppp b / src / mongo / s / query / cluster_client_cursor_mock . h <nl> class ClusterClientCursorMock final : public ClusterClientCursor { <nl> <nl> bool isTailable ( ) const final ; <nl> <nl> + UserNameIterator getAuthenticatedUsers ( ) const final ; <nl> + <nl> boost : : optional < BSONObj > viewDefinition ( ) const final ; <nl> <nl> long long getNumReturnedSoFar ( ) const final ; <nl> mmm a / src / mongo / s / query / cluster_client_cursor_params . h <nl> ppp b / src / mongo / s / query / cluster_client_cursor_params . h <nl> <nl> <nl> # include " mongo / bson / bsonobj . h " <nl> # include " mongo / client / read_preference . h " <nl> + # include " mongo / db / auth / user_name . h " <nl> # include " mongo / db / cursor_id . h " <nl> # include " mongo / db / namespace_string . h " <nl> # include " mongo / s / client / shard . h " <nl> struct ClusterClientCursorParams { <nl> } ; <nl> <nl> / * * <nl> - * Constructor used for cases where initial shard host targeting is necessary ( i . e . , we don ' t <nl> + * Read preference must be provided if initial shard host targeting is necessary ( i . e . , we don ' t <nl> * know yet the remote cursor id ) . <nl> * / <nl> - ClusterClientCursorParams ( NamespaceString nss , ReadPreferenceSetting readPref ) <nl> - : nsString ( std : : move ( nss ) ) , readPreference ( std : : move ( readPref ) ) { } <nl> - <nl> - / * * <nl> - * Constructor used for cases , where the remote cursor ids are already known and no resolution <nl> - * or retargeting needs to happen . <nl> - * / <nl> - ClusterClientCursorParams ( NamespaceString nss ) : nsString ( std : : move ( nss ) ) { } <nl> + ClusterClientCursorParams ( NamespaceString nss , <nl> + UserNameIterator authenticatedUsersIter , <nl> + boost : : optional < ReadPreferenceSetting > readPref = boost : : none ) <nl> + : nsString ( std : : move ( nss ) ) { <nl> + while ( authenticatedUsersIter . more ( ) ) { <nl> + authenticatedUsers . emplace_back ( authenticatedUsersIter . next ( ) ) ; <nl> + } <nl> + if ( readPref ) { <nl> + readPreference = std : : move ( readPref . get ( ) ) ; <nl> + } <nl> + } <nl> <nl> / / Namespace against which to query . <nl> NamespaceString nsString ; <nl> <nl> + / / The set of authenticated users when this cursor was created . <nl> + std : : vector < UserName > authenticatedUsers ; <nl> + <nl> / / Per - remote node data . <nl> std : : vector < Remote > remotes ; <nl> <nl> mmm a / src / mongo / s / query / cluster_cursor_manager . cpp <nl> ppp b / src / mongo / s / query / cluster_cursor_manager . cpp <nl> bool ClusterCursorManager : : PinnedCursor : : isTailable ( ) const { <nl> return _cursor - > isTailable ( ) ; <nl> } <nl> <nl> + UserNameIterator ClusterCursorManager : : PinnedCursor : : getAuthenticatedUsers ( ) const { <nl> + invariant ( _cursor ) ; <nl> + return _cursor - > getAuthenticatedUsers ( ) ; <nl> + } <nl> + <nl> void ClusterCursorManager : : PinnedCursor : : returnCursor ( CursorState cursorState ) { <nl> invariant ( _cursor ) ; <nl> / / Note that unpinning a cursor transfers ownership of the underlying ClusterClientCursor object <nl> mmm a / src / mongo / s / query / cluster_cursor_manager . h <nl> ppp b / src / mongo / s / query / cluster_cursor_manager . h <nl> class ClusterCursorManager { <nl> * / <nl> bool isTailable ( ) const ; <nl> <nl> + / * * <nl> + * Returns the set of authenticated users when this cursor was created . Cannot be called <nl> + * after returnCursor ( ) is called . A cursor must be owned . <nl> + * / <nl> + UserNameIterator getAuthenticatedUsers ( ) const ; <nl> + <nl> / * * <nl> * Transfers ownership of the underlying cursor back to the manager . A cursor must be <nl> * owned , and a cursor will no longer be owned after this method completes . <nl> mmm a / src / mongo / s / query / cluster_find . cpp <nl> ppp b / src / mongo / s / query / cluster_find . cpp <nl> <nl> # include " mongo / bson / util / bson_extract . h " <nl> # include " mongo / client / connpool . h " <nl> # include " mongo / client / read_preference . h " <nl> + # include " mongo / db / auth / authorization_session . h " <nl> # include " mongo / db / commands . h " <nl> # include " mongo / db / query / canonical_query . h " <nl> # include " mongo / db / query / find_common . h " <nl> StatusWith < CursorId > runQueryWithoutRetrying ( OperationContext * opCtx , <nl> } <nl> } <nl> <nl> - ClusterClientCursorParams params ( query . nss ( ) , readPref ) ; <nl> + ClusterClientCursorParams params ( <nl> + query . nss ( ) , <nl> + AuthorizationSession : : get ( opCtx - > getClient ( ) ) - > getAuthenticatedUserNames ( ) , <nl> + readPref ) ; <nl> params . limit = query . getQueryRequest ( ) . getLimit ( ) ; <nl> params . batchSize = query . getQueryRequest ( ) . getEffectiveBatchSize ( ) ; <nl> params . skip = query . getQueryRequest ( ) . getSkip ( ) ; <nl> StatusWith < CursorResponse > ClusterFind : : runGetMore ( OperationContext * opCtx , <nl> while ( MONGO_FAIL_POINT ( keepCursorPinnedDuringGetMore ) ) { <nl> } <nl> <nl> + / / A user can only call getMore on their own cursor . If there were multiple users authenticated <nl> + / / when the cursor was created , then at least one of them must be authenticated in order to run <nl> + / / getMore on the cursor . <nl> + if ( ! AuthorizationSession : : get ( opCtx - > getClient ( ) ) <nl> + - > isCoauthorizedWith ( pinnedCursor . getValue ( ) . getAuthenticatedUsers ( ) ) ) { <nl> + return { ErrorCodes : : Unauthorized , <nl> + str : : stream ( ) < < " cursor id " < < request . cursorid <nl> + < < " was not created by the authenticated user " } ; <nl> + } <nl> + <nl> if ( request . awaitDataTimeout ) { <nl> auto status = pinnedCursor . getValue ( ) . setAwaitDataTimeout ( * request . awaitDataTimeout ) ; <nl> if ( ! status . isOK ( ) ) { <nl> mmm a / src / mongo / s / query / store_possible_cursor . cpp <nl> ppp b / src / mongo / s / query / store_possible_cursor . cpp <nl> <nl> <nl> # include " mongo / base / status_with . h " <nl> # include " mongo / bson / bsonobj . h " <nl> + # include " mongo / db / auth / authorization_session . h " <nl> # include " mongo / db / query / cursor_response . h " <nl> # include " mongo / s / query / cluster_client_cursor_impl . h " <nl> # include " mongo / s / query / cluster_client_cursor_params . h " <nl> StatusWith < BSONObj > storePossibleCursor ( OperationContext * opCtx , <nl> return cmdResult ; <nl> } <nl> <nl> - ClusterClientCursorParams params ( incomingCursorResponse . getValue ( ) . getNSS ( ) ) ; <nl> + ClusterClientCursorParams params ( <nl> + incomingCursorResponse . getValue ( ) . getNSS ( ) , <nl> + AuthorizationSession : : get ( opCtx - > getClient ( ) ) - > getAuthenticatedUserNames ( ) ) ; <nl> params . remotes . emplace_back ( server , incomingCursorResponse . getValue ( ) . getCursorId ( ) ) ; <nl> <nl> <nl>
|
SERVER - 9609 Ensure users can only call getMore on cursors they created
|
mongodb/mongo
|
d66405f651b0a49a06aacb286e3d1740a0b020af
|
2017-03-22T17:09:21Z
|
mmm a / src / heap / heap . cc <nl> ppp b / src / heap / heap . cc <nl> Heap : : Heap ( ) <nl> deserialization_complete_ ( false ) , <nl> concurrent_sweeping_enabled_ ( false ) , <nl> strong_roots_list_ ( NULL ) , <nl> - array_buffer_tracker_ ( NULL ) { <nl> + array_buffer_tracker_ ( NULL ) , <nl> + force_oom_ ( false ) { <nl> / / Allow build - time customization of the max semispace size . Building <nl> / / V8 with snapshots and a non - default max semispace size is much <nl> / / easier if you can define it as part of the build environment . <nl> mmm a / src / heap / heap . h <nl> ppp b / src / heap / heap . h <nl> class Heap { <nl> / / TODO ( hpayer ) : There is still a missmatch between capacity and actual <nl> / / committed memory size . <nl> bool CanExpandOldGeneration ( int size ) { <nl> + if ( force_oom_ ) return false ; <nl> return ( CommittedOldGenerationMemory ( ) + size ) < MaxOldGenerationSize ( ) ; <nl> } <nl> <nl> class Heap { <nl> <nl> MUST_USE_RESULT AllocationResult InternalizeString ( String * str ) ; <nl> <nl> + void set_force_oom ( bool value ) { force_oom_ = value ; } <nl> + <nl> / / The amount of external memory registered through the API kept alive <nl> / / by global handles <nl> int64_t amount_of_external_allocated_memory_ ; <nl> class Heap { <nl> <nl> ArrayBufferTracker * array_buffer_tracker_ ; <nl> <nl> + / / Used for testing purposes . <nl> + bool force_oom_ ; <nl> + <nl> / / Classes in " heap " can be friends . <nl> friend class AlwaysAllocateScope ; <nl> friend class GCCallbacksScope ; <nl> mmm a / test / cctest / cctest . gyp <nl> ppp b / test / cctest / cctest . gyp <nl> <nl> ' gay - shortest . cc ' , <nl> ' heap / heap - tester . h ' , <nl> ' heap / test - alloc . cc ' , <nl> + ' heap / test - compaction . cc ' , <nl> ' heap / test - heap . cc ' , <nl> ' heap / test - incremental - marking . cc ' , <nl> ' heap / test - mark - compact . cc ' , <nl> mmm a / test / cctest / heap / heap - tester . h <nl> ppp b / test / cctest / heap / heap - tester . h <nl> <nl> <nl> / / Tests that should have access to private methods of { v8 : : internal : : Heap } . <nl> / / Those tests need to be defined using HEAP_TEST ( Name ) { . . . } . <nl> - # define HEAP_TEST_METHODS ( V ) \ <nl> - V ( CompactionSpaceDivideMultiplePages ) \ <nl> - V ( CompactionSpaceDivideSinglePage ) \ <nl> - V ( GCFlags ) \ <nl> - V ( MarkCompactCollector ) \ <nl> - V ( NoPromotion ) \ <nl> - V ( NumberStringCacheSize ) \ <nl> - V ( ObjectGroups ) \ <nl> - V ( Promotion ) \ <nl> - V ( Regression39128 ) \ <nl> - V ( ResetWeakHandle ) \ <nl> - V ( StressHandles ) \ <nl> - V ( TestMemoryReducerSampleJsCalls ) \ <nl> - V ( TestSizeOfObjects ) \ <nl> + # define HEAP_TEST_METHODS ( V ) \ <nl> + V ( CompactionFullAbortedPage ) \ <nl> + V ( CompactionPartiallyAbortedPage ) \ <nl> + V ( CompactionPartiallyAbortedPageIntraAbortedPointers ) \ <nl> + V ( CompactionPartiallyAbortedPageWithStoreBufferEntries ) \ <nl> + V ( CompactionSpaceDivideMultiplePages ) \ <nl> + V ( CompactionSpaceDivideSinglePage ) \ <nl> + V ( GCFlags ) \ <nl> + V ( MarkCompactCollector ) \ <nl> + V ( NoPromotion ) \ <nl> + V ( NumberStringCacheSize ) \ <nl> + V ( ObjectGroups ) \ <nl> + V ( Promotion ) \ <nl> + V ( Regression39128 ) \ <nl> + V ( ResetWeakHandle ) \ <nl> + V ( StressHandles ) \ <nl> + V ( TestMemoryReducerSampleJsCalls ) \ <nl> + V ( TestSizeOfObjects ) \ <nl> V ( WriteBarriersInCopyJSObject ) <nl> <nl> <nl> new file mode 100644 <nl> index 00000000000 . . fec5ecc40b2 <nl> mmm / dev / null <nl> ppp b / test / cctest / heap / test - compaction . cc <nl> <nl> + / / Copyright 2015 the V8 project authors . All rights reserved . <nl> + / / Use of this source code is governed by a BSD - style license that can be <nl> + / / found in the LICENSE file . <nl> + <nl> + # include " test / cctest / cctest . h " <nl> + # include " test / cctest / heap / heap - tester . h " <nl> + # include " test / cctest / heap / utils - inl . h " <nl> + <nl> + namespace v8 { <nl> + namespace internal { <nl> + <nl> + static std : : vector < Handle < FixedArray > > FillUpFirstOldSpacePage ( Heap * heap ) { <nl> + / / This functions assumes that old space top is still on the first page <nl> + heap - > old_space ( ) - > EmptyAllocationInfo ( ) ; <nl> + int free_on_first_page = static_cast < int > ( heap - > old_space ( ) - > Available ( ) ) ; <nl> + return CreatePadding ( heap , free_on_first_page , TENURED ) ; <nl> + } <nl> + <nl> + <nl> + static void CheckInvariantsOfAbortedPage ( Page * page ) { <nl> + / / Check invariants : <nl> + / / 1 ) Markbits are cleared <nl> + / / 2 ) The page is not marked as evacuation candidate anymore <nl> + / / 3 ) The page is not marked as aborted compaction anymore . <nl> + CHECK ( page - > markbits ( ) - > IsClean ( ) ) ; <nl> + CHECK ( ! page - > IsEvacuationCandidate ( ) ) ; <nl> + CHECK ( ! page - > IsFlagSet ( Page : : COMPACTION_WAS_ABORTED ) ) ; <nl> + } <nl> + <nl> + <nl> + HEAP_TEST ( CompactionFullAbortedPage ) { <nl> + / / Test the scenario where we reach OOM during compaction and the whole page <nl> + / / is aborted . <nl> + <nl> + FLAG_manual_evacuation_candidates_selection = true ; <nl> + CcTest : : InitializeVM ( ) ; <nl> + Isolate * isolate = CcTest : : i_isolate ( ) ; <nl> + Heap * heap = isolate - > heap ( ) ; <nl> + / / Disable concurrent sweeping to ensure memory is in an expected state , i . e . , <nl> + / / we can reach the state of a half aborted page . We cannot just set <nl> + / / { FLAG_concurrent_sweeping } because the flag is cached in heap , which is <nl> + / / initialized earlier . <nl> + heap - > concurrent_sweeping_enabled_ = false ; <nl> + { <nl> + HandleScope scope1 ( isolate ) ; <nl> + / / Fill up the first page since it cannot be evacuated . <nl> + auto first_page_handles = FillUpFirstOldSpacePage ( heap ) ; <nl> + <nl> + { <nl> + HandleScope scope2 ( isolate ) ; <nl> + heap - > old_space ( ) - > EmptyAllocationInfo ( ) ; <nl> + auto second_page_handles = <nl> + CreatePadding ( heap , Page : : kAllocatableMemory , TENURED ) ; <nl> + Page * to_be_aborted_page = <nl> + Page : : FromAddress ( second_page_handles . front ( ) - > address ( ) ) ; <nl> + to_be_aborted_page - > SetFlag ( <nl> + MemoryChunk : : FORCE_EVACUATION_CANDIDATE_FOR_TESTING ) ; <nl> + heap - > set_force_oom ( true ) ; <nl> + heap - > CollectAllGarbage ( ) ; <nl> + <nl> + / / Check that all handles still point to the same page , i . e . , compaction <nl> + / / has been aborted on the page . <nl> + for ( Handle < FixedArray > object : second_page_handles ) { <nl> + CHECK_EQ ( to_be_aborted_page , Page : : FromAddress ( object - > address ( ) ) ) ; <nl> + } <nl> + CheckInvariantsOfAbortedPage ( to_be_aborted_page ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + <nl> + HEAP_TEST ( CompactionPartiallyAbortedPage ) { <nl> + / / Test the scenario where we reach OOM during compaction and parts of the <nl> + / / page have already been migrated to a new one . <nl> + <nl> + FLAG_manual_evacuation_candidates_selection = true ; <nl> + <nl> + const int object_size = 128 * KB ; <nl> + <nl> + CcTest : : InitializeVM ( ) ; <nl> + Isolate * isolate = CcTest : : i_isolate ( ) ; <nl> + Heap * heap = isolate - > heap ( ) ; <nl> + / / Disable concurrent sweeping to ensure memory is in an expected state , i . e . , <nl> + / / we can reach the state of a half aborted page . We cannot just set <nl> + / / { FLAG_concurrent_sweeping } because the flag is cached in heap , which is <nl> + / / initialized earlier . <nl> + heap - > concurrent_sweeping_enabled_ = false ; <nl> + { <nl> + HandleScope scope1 ( isolate ) ; <nl> + / / Fill up the first page since it cannot be evacuated . <nl> + auto first_page_handles = FillUpFirstOldSpacePage ( heap ) ; <nl> + <nl> + { <nl> + HandleScope scope2 ( isolate ) ; <nl> + / / Fill the second page with objects of size { object_size } ( last one is <nl> + / / properly adjusted ) . <nl> + heap - > old_space ( ) - > EmptyAllocationInfo ( ) ; <nl> + auto second_page_handles = <nl> + CreatePadding ( heap , Page : : kAllocatableMemory , TENURED , object_size ) ; <nl> + / / Mark the second page for evacuation . <nl> + Page * to_be_aborted_page = <nl> + Page : : FromAddress ( second_page_handles . front ( ) - > address ( ) ) ; <nl> + to_be_aborted_page - > SetFlag ( <nl> + MemoryChunk : : FORCE_EVACUATION_CANDIDATE_FOR_TESTING ) ; <nl> + <nl> + { <nl> + / / Add a third page that is filled with { num_objects } objects of size <nl> + / / { object_size } . <nl> + HandleScope scope3 ( isolate ) ; <nl> + heap - > old_space ( ) - > EmptyAllocationInfo ( ) ; <nl> + const int num_objects = 3 ; <nl> + std : : vector < Handle < FixedArray > > third_page_handles = CreatePadding ( <nl> + heap , object_size * num_objects , TENURED , object_size ) ; <nl> + Page * third_page = <nl> + Page : : FromAddress ( third_page_handles . front ( ) - > address ( ) ) ; <nl> + heap - > set_force_oom ( true ) ; <nl> + heap - > CollectAllGarbage ( ) ; <nl> + <nl> + bool migration_aborted = false ; <nl> + for ( Handle < FixedArray > object : second_page_handles ) { <nl> + / / Once compaction has been aborted , all following objects still have <nl> + / / to be on the initial page . <nl> + CHECK ( ! migration_aborted | | <nl> + ( Page : : FromAddress ( object - > address ( ) ) = = to_be_aborted_page ) ) ; <nl> + if ( Page : : FromAddress ( object - > address ( ) ) = = to_be_aborted_page ) { <nl> + / / This object has not been migrated . <nl> + migration_aborted = true ; <nl> + } else { <nl> + CHECK_EQ ( Page : : FromAddress ( object - > address ( ) ) , third_page ) ; <nl> + } <nl> + } <nl> + / / Check that we actually created a scenario with a partially aborted <nl> + / / page . <nl> + CHECK ( migration_aborted ) ; <nl> + CheckInvariantsOfAbortedPage ( to_be_aborted_page ) ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + <nl> + HEAP_TEST ( CompactionPartiallyAbortedPageIntraAbortedPointers ) { <nl> + / / Test the scenario where we reach OOM during compaction and parts of the <nl> + / / page have already been migrated to a new one . Objects on the aborted page <nl> + / / are linked together . This test makes sure that intra - aborted page pointers <nl> + / / get properly updated . <nl> + <nl> + FLAG_manual_evacuation_candidates_selection = true ; <nl> + <nl> + const int object_size = 128 * KB ; <nl> + <nl> + CcTest : : InitializeVM ( ) ; <nl> + Isolate * isolate = CcTest : : i_isolate ( ) ; <nl> + Heap * heap = isolate - > heap ( ) ; <nl> + / / Disable concurrent sweeping to ensure memory is in an expected state , i . e . , <nl> + / / we can reach the state of a half aborted page . We cannot just set <nl> + / / { FLAG_concurrent_sweeping } because the flag is cached in heap , which is <nl> + / / initialized earlier . <nl> + heap - > concurrent_sweeping_enabled_ = false ; <nl> + { <nl> + HandleScope scope1 ( isolate ) ; <nl> + / / Fill up the first page since it cannot be evacuated . <nl> + auto first_page_handles = FillUpFirstOldSpacePage ( heap ) ; <nl> + <nl> + Page * to_be_aborted_page = nullptr ; <nl> + { <nl> + HandleScope temporary_scope ( isolate ) ; <nl> + / / Fill the second page with objects of size { object_size } ( last one is <nl> + / / properly adjusted ) . <nl> + heap - > old_space ( ) - > EmptyAllocationInfo ( ) ; <nl> + const int free_on_second_page = Page : : kAllocatableMemory ; <nl> + std : : vector < Handle < FixedArray > > second_page_handles = <nl> + CreatePadding ( heap , free_on_second_page , TENURED , object_size ) ; <nl> + / / Mark the second page for evacuation . <nl> + to_be_aborted_page = <nl> + Page : : FromAddress ( second_page_handles . front ( ) - > address ( ) ) ; <nl> + to_be_aborted_page - > SetFlag ( <nl> + MemoryChunk : : FORCE_EVACUATION_CANDIDATE_FOR_TESTING ) ; <nl> + <nl> + for ( size_t i = second_page_handles . size ( ) - 1 ; i > 0 ; i - - ) { <nl> + second_page_handles [ i ] - > set ( 0 , * second_page_handles [ i - 1 ] ) ; <nl> + } <nl> + first_page_handles . front ( ) - > set ( 0 , * second_page_handles . back ( ) ) ; <nl> + } <nl> + <nl> + { <nl> + / / Add a third page that is filled with { num_objects } objects of size <nl> + / / { object_size } . <nl> + HandleScope scope3 ( isolate ) ; <nl> + heap - > old_space ( ) - > EmptyAllocationInfo ( ) ; <nl> + const int num_objects = 2 ; <nl> + int used_memory = object_size * num_objects ; <nl> + std : : vector < Handle < FixedArray > > third_page_handles = <nl> + CreatePadding ( heap , used_memory , TENURED , object_size ) ; <nl> + Page * third_page = <nl> + Page : : FromAddress ( third_page_handles . front ( ) - > address ( ) ) ; <nl> + heap - > set_force_oom ( true ) ; <nl> + heap - > CollectAllGarbage ( ) ; <nl> + <nl> + / / The following check makes sure that we compacted " some " objects , while <nl> + / / leaving others in place . <nl> + bool in_place = true ; <nl> + Handle < FixedArray > current = first_page_handles . front ( ) ; <nl> + while ( current - > get ( 0 ) ! = heap - > undefined_value ( ) ) { <nl> + current = Handle < FixedArray > ( FixedArray : : cast ( current - > get ( 0 ) ) ) ; <nl> + CHECK ( current - > IsFixedArray ( ) ) ; <nl> + if ( Page : : FromAddress ( current - > address ( ) ) ! = to_be_aborted_page ) { <nl> + in_place = false ; <nl> + } <nl> + bool on_aborted_page = <nl> + Page : : FromAddress ( current - > address ( ) ) = = to_be_aborted_page ; <nl> + bool on_third_page = <nl> + Page : : FromAddress ( current - > address ( ) ) = = third_page ; <nl> + CHECK ( ( in_place & & on_aborted_page ) | | ( ! in_place & & on_third_page ) ) ; <nl> + } <nl> + / / Check that we at least migrated one object , as otherwise the test would <nl> + / / not trigger . <nl> + CHECK ( ! in_place ) ; <nl> + <nl> + CheckInvariantsOfAbortedPage ( to_be_aborted_page ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + <nl> + HEAP_TEST ( CompactionPartiallyAbortedPageWithStoreBufferEntries ) { <nl> + / / Test the scenario where we reach OOM during compaction and parts of the <nl> + / / page have already been migrated to a new one . Objects on the aborted page <nl> + / / are linked together and the very first object on the aborted page points <nl> + / / into new space . The test verifies that the store buffer entries are <nl> + / / properly cleared and rebuilt after aborting a page . Failing to do so can <nl> + / / result in other objects being allocated in the free space where their <nl> + / / payload looks like a valid new space pointer . <nl> + <nl> + FLAG_manual_evacuation_candidates_selection = true ; <nl> + <nl> + const int object_size = 128 * KB ; <nl> + <nl> + CcTest : : InitializeVM ( ) ; <nl> + Isolate * isolate = CcTest : : i_isolate ( ) ; <nl> + Heap * heap = isolate - > heap ( ) ; <nl> + / / Disable concurrent sweeping to ensure memory is in an expected state , i . e . , <nl> + / / we can reach the state of a half aborted page . We cannot just set <nl> + / / { FLAG_concurrent_sweeping } because the flag is cached in heap , which is <nl> + / / initialized earlier . <nl> + heap - > concurrent_sweeping_enabled_ = false ; <nl> + { <nl> + HandleScope scope1 ( isolate ) ; <nl> + / / Fill up the first page since it cannot be evacuated . <nl> + auto first_page_handles = FillUpFirstOldSpacePage ( heap ) ; <nl> + <nl> + Page * to_be_aborted_page = nullptr ; <nl> + { <nl> + HandleScope temporary_scope ( isolate ) ; <nl> + / / Fill the second page with objects of size { object_size } ( last one is <nl> + / / properly adjusted ) . <nl> + heap - > old_space ( ) - > EmptyAllocationInfo ( ) ; <nl> + auto second_page_handles = <nl> + CreatePadding ( heap , Page : : kAllocatableMemory , TENURED , object_size ) ; <nl> + / / Mark the second page for evacuation . <nl> + to_be_aborted_page = <nl> + Page : : FromAddress ( second_page_handles . front ( ) - > address ( ) ) ; <nl> + to_be_aborted_page - > SetFlag ( <nl> + MemoryChunk : : FORCE_EVACUATION_CANDIDATE_FOR_TESTING ) ; <nl> + <nl> + for ( size_t i = second_page_handles . size ( ) - 1 ; i > 0 ; i - - ) { <nl> + second_page_handles [ i ] - > set ( 0 , * second_page_handles [ i - 1 ] ) ; <nl> + } <nl> + first_page_handles . front ( ) - > set ( 0 , * second_page_handles . back ( ) ) ; <nl> + Handle < FixedArray > new_space_array = <nl> + isolate - > factory ( ) - > NewFixedArray ( 1 , NOT_TENURED ) ; <nl> + CHECK ( heap - > InNewSpace ( * new_space_array ) ) ; <nl> + second_page_handles . front ( ) - > set ( 1 , * new_space_array ) ; <nl> + } <nl> + <nl> + { <nl> + / / Add a third page that is filled with { num_objects } objects of size <nl> + / / { object_size } . <nl> + HandleScope scope3 ( isolate ) ; <nl> + heap - > old_space ( ) - > EmptyAllocationInfo ( ) ; <nl> + const int num_objects = 2 ; <nl> + int used_memory = object_size * num_objects ; <nl> + std : : vector < Handle < FixedArray > > third_page_handles = <nl> + CreatePadding ( heap , used_memory , TENURED , object_size ) ; <nl> + Page * third_page = <nl> + Page : : FromAddress ( third_page_handles . front ( ) - > address ( ) ) ; <nl> + heap - > set_force_oom ( true ) ; <nl> + heap - > CollectAllGarbage ( ) ; <nl> + <nl> + / / The following check makes sure that we compacted " some " objects , while <nl> + / / leaving others in place . <nl> + bool in_place = true ; <nl> + Handle < FixedArray > current = first_page_handles . front ( ) ; <nl> + while ( current - > get ( 0 ) ! = heap - > undefined_value ( ) ) { <nl> + current = Handle < FixedArray > ( FixedArray : : cast ( current - > get ( 0 ) ) ) ; <nl> + CHECK ( ! heap - > InNewSpace ( * current ) ) ; <nl> + CHECK ( current - > IsFixedArray ( ) ) ; <nl> + if ( Page : : FromAddress ( current - > address ( ) ) ! = to_be_aborted_page ) { <nl> + in_place = false ; <nl> + } <nl> + bool on_aborted_page = <nl> + Page : : FromAddress ( current - > address ( ) ) = = to_be_aborted_page ; <nl> + bool on_third_page = <nl> + Page : : FromAddress ( current - > address ( ) ) = = third_page ; <nl> + CHECK ( ( in_place & & on_aborted_page ) | | ( ! in_place & & on_third_page ) ) ; <nl> + } <nl> + / / Check that we at least migrated one object , as otherwise the test would <nl> + / / not trigger . <nl> + CHECK ( ! in_place ) ; <nl> + <nl> + CheckInvariantsOfAbortedPage ( to_be_aborted_page ) ; <nl> + <nl> + / / Allocate a new object in new space . <nl> + Handle < FixedArray > holder = <nl> + isolate - > factory ( ) - > NewFixedArray ( 10 , NOT_TENURED ) ; <nl> + / / Create a broken address that looks like a tagged pointer to a new space <nl> + / / object . <nl> + Address broken_address = holder - > address ( ) + 2 * kPointerSize + 1 ; <nl> + / / Convert it to a vector to create a string from it . <nl> + Vector < const uint8_t > string_to_broken_addresss ( <nl> + reinterpret_cast < const uint8_t * > ( & broken_address ) , 8 ) ; <nl> + <nl> + Handle < String > string ; <nl> + do { <nl> + / / We know that the interesting slot will be on the aborted page and <nl> + / / hence we allocate until we get our string on the aborted page . <nl> + / / We used slot 1 in the fixed size array which corresponds to the <nl> + / / the first word in the string . Since the first object definitely <nl> + / / migrated we can just allocate until we hit the aborted page . <nl> + string = isolate - > factory ( ) <nl> + - > NewStringFromOneByte ( string_to_broken_addresss , TENURED ) <nl> + . ToHandleChecked ( ) ; <nl> + } while ( Page : : FromAddress ( string - > address ( ) ) ! = to_be_aborted_page ) ; <nl> + <nl> + / / If store buffer entries are not properly filtered / reset for aborted <nl> + / / pages we have now a broken address at an object slot in old space and <nl> + / / the following scavenge will crash . <nl> + heap - > CollectGarbage ( NEW_SPACE ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + } / / namespace internal <nl> + } / / namespace v8 <nl> mmm a / test / cctest / heap / utils - inl . h <nl> ppp b / test / cctest / heap / utils - inl . h <nl> namespace v8 { <nl> namespace internal { <nl> <nl> static int LenFromSize ( int size ) { <nl> - return ( size - i : : FixedArray : : kHeaderSize ) / i : : kPointerSize ; <nl> + return ( size - FixedArray : : kHeaderSize ) / kPointerSize ; <nl> } <nl> <nl> <nl> - static inline void CreatePadding ( i : : Heap * heap , int padding_size , <nl> - i : : PretenureFlag tenure ) { <nl> - const int max_number_of_objects = 20 ; <nl> - v8 : : internal : : Handle < v8 : : internal : : FixedArray > <nl> - big_objects [ max_number_of_objects ] ; <nl> - i : : Isolate * isolate = heap - > isolate ( ) ; <nl> + static inline std : : vector < Handle < FixedArray > > CreatePadding ( <nl> + Heap * heap , int padding_size , PretenureFlag tenure , <nl> + int object_size = Page : : kMaxRegularHeapObjectSize ) { <nl> + std : : vector < Handle < FixedArray > > handles ; <nl> + Isolate * isolate = heap - > isolate ( ) ; <nl> int allocate_memory ; <nl> int length ; <nl> int free_memory = padding_size ; <nl> static inline void CreatePadding ( i : : Heap * heap , int padding_size , <nl> * heap - > new_space ( ) - > allocation_top_address ( ) ) ; <nl> CHECK ( padding_size < = current_free_memory | | current_free_memory = = 0 ) ; <nl> } <nl> - for ( int i = 0 ; i < max_number_of_objects & & free_memory > 0 ; i + + ) { <nl> - if ( free_memory > i : : Page : : kMaxRegularHeapObjectSize ) { <nl> - allocate_memory = i : : Page : : kMaxRegularHeapObjectSize ; <nl> + while ( free_memory > 0 ) { <nl> + / / for ( int i = 0 ; i < max_number_of_objects & & free_memory > 0 ; i + + ) { <nl> + if ( free_memory > object_size ) { <nl> + allocate_memory = object_size ; <nl> length = LenFromSize ( allocate_memory ) ; <nl> } else { <nl> allocate_memory = free_memory ; <nl> static inline void CreatePadding ( i : : Heap * heap , int padding_size , <nl> break ; <nl> } <nl> } <nl> - big_objects [ i ] = isolate - > factory ( ) - > NewFixedArray ( length , tenure ) ; <nl> - CHECK ( ( tenure = = i : : NOT_TENURED & & heap - > InNewSpace ( * big_objects [ i ] ) ) | | <nl> - ( tenure = = i : : TENURED & & heap - > InOldSpace ( * big_objects [ i ] ) ) ) ; <nl> + handles . push_back ( isolate - > factory ( ) - > NewFixedArray ( length , tenure ) ) ; <nl> + CHECK ( ( tenure = = NOT_TENURED & & heap - > InNewSpace ( * handles . back ( ) ) ) | | <nl> + ( tenure = = TENURED & & heap - > InOldSpace ( * handles . back ( ) ) ) ) ; <nl> free_memory - = allocate_memory ; <nl> } <nl> + return handles ; <nl> } <nl> <nl> <nl>
|
[ cctest ] Add tests for aborting compaction of pages
|
v8/v8
|
161a0e00519a63672d93c36c5d3854c8ccb0030f
|
2015-12-11T09:14:46Z
|
mmm a / PowerEditor / src / Parameters . cpp <nl> ppp b / PowerEditor / src / Parameters . cpp <nl> bool NppParameters : : getSessionFromXmlTree ( TiXmlDocument * pSessionDoc , Session * p <nl> { <nl> ( * ptrSession ) . _actifIndex = index ; <nl> } <nl> + <nl> for ( TiXmlNode * childNode = sessionRoot - > FirstChildElement ( " File " ) ; <nl> childNode ; <nl> childNode = childNode - > NextSibling ( " File " ) ) <nl> { <nl> TiXmlNode * fnNode = childNode - > FirstChild ( ) ; <nl> - const char * fileName = fnNode - > Value ( ) ; <nl> - Position position ; <nl> - ( childNode - > ToElement ( ) ) - > Attribute ( " firstVisibleLine " , & position . _firstVisibleLine ) ; <nl> - ( childNode - > ToElement ( ) ) - > Attribute ( " xOffset " , & position . _xOffset ) ; <nl> - ( childNode - > ToElement ( ) ) - > Attribute ( " startPos " , & position . _startPos ) ; <nl> - ( childNode - > ToElement ( ) ) - > Attribute ( " endPos " , & position . _endPos ) ; <nl> - <nl> - sessionFileInfo sfi ( fileName , position ) ; <nl> - <nl> - for ( TiXmlNode * markNode = fnNode - > NextSibling ( " Mark " ) ; <nl> - markNode ; <nl> - markNode = markNode - > NextSibling ( " Mark " ) ) <nl> - { <nl> - int lineNumber ; <nl> - const char * lineNumberStr = ( markNode - > ToElement ( ) ) - > Attribute ( " line " , & lineNumber ) ; <nl> - if ( lineNumberStr ) <nl> + if ( fnNode ) <nl> + { <nl> + const char * fileName = fnNode - > Value ( ) ; <nl> + <nl> + if ( fileName ) <nl> { <nl> - sfi . marks . push_back ( lineNumber ) ; <nl> - / / : : MessageBox ( NULL , " coucou " , " " , MB_OK ) ; <nl> + Position position ; <nl> + ( childNode - > ToElement ( ) ) - > Attribute ( " firstVisibleLine " , & position . _firstVisibleLine ) ; <nl> + ( childNode - > ToElement ( ) ) - > Attribute ( " xOffset " , & position . _xOffset ) ; <nl> + ( childNode - > ToElement ( ) ) - > Attribute ( " startPos " , & position . _startPos ) ; <nl> + ( childNode - > ToElement ( ) ) - > Attribute ( " endPos " , & position . _endPos ) ; <nl> + <nl> + sessionFileInfo sfi ( fileName , position ) ; <nl> + <nl> + for ( TiXmlNode * markNode = fnNode - > NextSibling ( " Mark " ) ; <nl> + markNode ; <nl> + markNode = markNode - > NextSibling ( " Mark " ) ) <nl> + { <nl> + int lineNumber ; <nl> + const char * lineNumberStr = ( markNode - > ToElement ( ) ) - > Attribute ( " line " , & lineNumber ) ; <nl> + if ( lineNumberStr ) <nl> + { <nl> + sfi . marks . push_back ( lineNumber ) ; <nl> + / / : : MessageBox ( NULL , " coucou " , " " , MB_OK ) ; <nl> + } <nl> + } <nl> + ( * ptrSession ) . _files . push_back ( sfi ) ; <nl> } <nl> } <nl> - <nl> - if ( fileName ) <nl> - ( * ptrSession ) . _files . push_back ( sfi ) ; <nl> } <nl> <nl> return true ; <nl> void NppParameters : : feedUserCmds ( TiXmlNode * node ) <nl> TiXmlNode * aNode = childNode - > FirstChild ( ) ; <nl> if ( aNode ) <nl> { <nl> - uc . _cmd = aNode - > Value ( ) ; <nl> - if ( uc . isValid ( ) ) <nl> - _userCommands . push_back ( uc ) ; <nl> + const char * cmdStr = aNode - > Value ( ) ; <nl> + if ( cmdStr ) <nl> + { <nl> + uc . _cmd = cmdStr ; <nl> + if ( uc . isValid ( ) ) <nl> + _userCommands . push_back ( uc ) ; <nl> + } <nl> } <nl> } <nl> } <nl> void NppParameters : : feedUserKeywordList ( TiXmlNode * node ) <nl> if ( i ! = - 1 ) <nl> { <nl> TiXmlNode * valueNode = childNode - > FirstChild ( ) ; <nl> - const char * kwl = ( valueNode ) ? valueNode - > Value ( ) : ( strcmp ( keywordsName , " Delimiters " ) ? " " : " 000000 " ) ; <nl> - strcpy ( _userLangArray [ _nbUserLang - 1 ] - > _keywordLists [ i ] , kwl ) ; <nl> + if ( valueNode ) <nl> + { <nl> + const char * kwl = ( valueNode ) ? valueNode - > Value ( ) : ( strcmp ( keywordsName , " Delimiters " ) ? " " : " 000000 " ) ; <nl> + strcpy ( _userLangArray [ _nbUserLang - 1 ] - > _keywordLists [ i ] , kwl ) ; <nl> + } <nl> } <nl> } <nl> } <nl> void StyleArray : : addStyler ( int styleID , TiXmlNode * styleNode ) <nl> TiXmlNode * v = styleNode - > FirstChild ( ) ; <nl> if ( v ) <nl> { <nl> - / / const char * keyWords = v - > Value ( ) ; <nl> - / / if ( keyWords ) <nl> - _styleArray [ _nbStyler ] . _keywords = new string ( v - > Value ( ) ) ; <nl> + _styleArray [ _nbStyler ] . _keywords = new string ( v - > Value ( ) ) ; <nl> } <nl> } <nl> _nbStyler + + ; <nl>
|
[ BUG_FIX ] Fix the crash problem while session . xml is corrupted .
|
notepad-plus-plus/notepad-plus-plus
|
20f8196bec82cc7e7914ce58a68284bbbbd40d13
|
2007-09-15T11:09:25Z
|
mmm a / ChangeLog . md <nl> ppp b / ChangeLog . md <nl> See docs / process . md for how version tagging works . <nl> <nl> Current Trunk <nl> mmmmmmmmmmmm - <nl> + - Add ` getentropy ` in ` sys / random . h ` , and use that from libc + + ' s <nl> + ` random_device ` . This is more efficient , see # 12240 . <nl> <nl> 2 . 0 . 4 : 09 / 16 / 2020 <nl> mmmmmmmmmmmmmmm - - <nl> mmm a / src / library . js <nl> ppp b / src / library . js <nl> LibraryManager . library = { <nl> endgrent : function ( ) { throw ' endgrent : TODO ' } , <nl> setgrent : function ( ) { throw ' setgrent : TODO ' } , <nl> <nl> + / / random . h <nl> + <nl> + / / TODO : consider allowing the API to get a parameter for the number of <nl> + / / bytes . <nl> + $ getRandomDevice : function ( ) { <nl> + if ( typeof crypto = = = ' object ' & & typeof crypto [ ' getRandomValues ' ] = = = ' function ' ) { <nl> + / / for modern web browsers <nl> + var randomBuffer = new Uint8Array ( 1 ) ; <nl> + return function ( ) { crypto . getRandomValues ( randomBuffer ) ; return randomBuffer [ 0 ] ; } ; <nl> + } else <nl> + # if ENVIRONMENT_MAY_BE_NODE <nl> + if ( ENVIRONMENT_IS_NODE ) { <nl> + / / for nodejs with or without crypto support included <nl> + try { <nl> + var crypto_module = require ( ' crypto ' ) ; <nl> + / / nodejs has crypto support <nl> + return function ( ) { return crypto_module [ ' randomBytes ' ] ( 1 ) [ 0 ] ; } ; <nl> + } catch ( e ) { <nl> + / / nodejs doesn ' t have crypto support <nl> + } <nl> + } <nl> + # endif / / ENVIRONMENT_MAY_BE_NODE <nl> + / / we couldn ' t find a proper implementation , as Math . random ( ) is not suitable for / dev / random , see emscripten - core / emscripten / pull / 7096 <nl> + # if ASSERTIONS <nl> + return function ( ) { abort ( " no cryptographic support found for randomDevice . consider polyfilling it if you want to use something insecure like Math . random ( ) , e . g . put this in a - - pre - js : var crypto = { getRandomValues : function ( array ) { for ( var i = 0 ; i < array . length ; i + + ) array [ i ] = ( Math . random ( ) * 256 ) | 0 } } ; " ) ; } ; <nl> + # else <nl> + return function ( ) { abort ( " randomDevice " ) ; } ; <nl> + # endif <nl> + } , <nl> + <nl> + getentropy__deps : [ ' $ getRandomDevice ' ] , <nl> + getentropy : function ( buffer , size ) { <nl> + if ( ! _getentropy . randomDevice ) { <nl> + _getentropy . randomDevice = getRandomDevice ( ) ; <nl> + } <nl> + for ( var i = 0 ; i < size ; i + + ) { <nl> + { { { makeSetValue ( ' buffer ' , ' i ' , ' _getentropy . randomDevice ( ) ' , ' i8 ' ) } } } <nl> + } <nl> + return 0 ; <nl> + } , <nl> + <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> / / emscripten . h <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> mmm a / src / library_fs . js <nl> ppp b / src / library_fs . js <nl> <nl> * / <nl> <nl> mergeInto ( LibraryManager . library , { <nl> - $ FS__deps : [ ' $ setErrNo ' , ' $ PATH ' , ' $ PATH_FS ' , ' $ TTY ' , ' $ MEMFS ' , <nl> + $ FS__deps : [ ' $ setErrNo ' , ' $ getRandomDevice ' , ' $ PATH ' , ' $ PATH_FS ' , ' $ TTY ' , ' $ MEMFS ' , <nl> # if LibraryManager . has ( ' library_idbfs . js ' ) <nl> ' $ IDBFS ' , <nl> # endif <nl> FS . staticInit ( ) ; ` + <nl> FS . mkdev ( ' / dev / tty ' , FS . makedev ( 5 , 0 ) ) ; <nl> FS . mkdev ( ' / dev / tty1 ' , FS . makedev ( 6 , 0 ) ) ; <nl> / / setup / dev / [ u ] random <nl> - var random_device ; <nl> - if ( typeof crypto = = = ' object ' & & typeof crypto [ ' getRandomValues ' ] = = = ' function ' ) { <nl> - / / for modern web browsers <nl> - var randomBuffer = new Uint8Array ( 1 ) ; <nl> - random_device = function ( ) { crypto . getRandomValues ( randomBuffer ) ; return randomBuffer [ 0 ] ; } ; <nl> - } else <nl> - # if ENVIRONMENT_MAY_BE_NODE <nl> - if ( ENVIRONMENT_IS_NODE ) { <nl> - / / for nodejs with or without crypto support included <nl> - try { <nl> - var crypto_module = require ( ' crypto ' ) ; <nl> - / / nodejs has crypto support <nl> - random_device = function ( ) { return crypto_module [ ' randomBytes ' ] ( 1 ) [ 0 ] ; } ; <nl> - } catch ( e ) { <nl> - / / nodejs doesn ' t have crypto support <nl> - } <nl> - } else <nl> - # endif / / ENVIRONMENT_MAY_BE_NODE <nl> - { } <nl> - if ( ! random_device ) { <nl> - / / we couldn ' t find a proper implementation , as Math . random ( ) is not suitable for / dev / random , see emscripten - core / emscripten / pull / 7096 <nl> - # if ASSERTIONS <nl> - random_device = function ( ) { abort ( " no cryptographic support found for random_device . consider polyfilling it if you want to use something insecure like Math . random ( ) , e . g . put this in a - - pre - js : var crypto = { getRandomValues : function ( array ) { for ( var i = 0 ; i < array . length ; i + + ) array [ i ] = ( Math . random ( ) * 256 ) | 0 } } ; " ) ; } ; <nl> - # else <nl> - random_device = function ( ) { abort ( " random_device " ) ; } ; <nl> - # endif <nl> - } <nl> + var random_device = getRandomDevice ( ) ; <nl> FS . createDevice ( ' / dev ' , ' random ' , random_device ) ; <nl> FS . createDevice ( ' / dev ' , ' urandom ' , random_device ) ; <nl> / / we ' re not going to emulate the actual shm device , <nl> new file mode 100644 <nl> index 00000000000 . . 72f3bf7a26b <nl> mmm / dev / null <nl> ppp b / system / include / compat / sys / random . h <nl> <nl> + # ifdef __cplusplus <nl> + extern " C " { <nl> + # endif <nl> + <nl> + / / This is used by libc + + as an efficient way to get high - quality random data <nl> + / / ( more efficiently than via the filesystem using / dev / urandom ) . <nl> + / / Upstream musl added support for this , so we can switch to that , but it isn ' t <nl> + / / where libc + + looks for it ( which is here and not unistd . h ) , and it uses a <nl> + / / syscall which is unnecessary indirection for us . <nl> + int getentropy ( void * buffer , size_t length ) ; <nl> + <nl> + # ifdef __cplusplus <nl> + } <nl> + # endif <nl> mmm a / system / include / libcxx / __config <nl> ppp b / system / include / libcxx / __config <nl> <nl> / / random data even when using sandboxing mechanisms such as chroots , <nl> / / Capsicum , etc . <nl> # define _LIBCPP_USING_ARC4_RANDOM <nl> - # elif defined ( __Fuchsia__ ) | | defined ( __wasi__ ) <nl> + # elif defined ( __Fuchsia__ ) | | defined ( __wasi__ ) | | defined ( __EMSCRIPTEN__ ) <nl> # define _LIBCPP_USING_GETENTROPY <nl> # elif defined ( __native_client__ ) <nl> / / NaCl ' s sandbox ( which PNaCl also runs in ) doesn ' t allow filesystem access , <nl> mmm a / system / lib / libcxx / readme . txt <nl> ppp b / system / lib / libcxx / readme . txt <nl> Local modifications are marked with the comment : ' XXX EMSCRIPTEN ' <nl> 3 . Define _LIBCPP_ELAST in libcxx / include / config_elast . h <nl> <nl> 4 . Set init_priority of __start_std_streams in libcxx / iostream . cpp <nl> + <nl> + 5 . Use _LIBCPP_USING_GETENTROPY ( like wasi ) <nl> mmm a / tests / core / test_random_device . cpp <nl> ppp b / tests / core / test_random_device . cpp <nl> auto main ( ) <nl> try <nl> { <nl> std : : random_device rd ; <nl> - std : : cout < < " random was read " < < " \ n " ; <nl> + std : : cout < < rd ( ) < < " , a random was read \ n " ; <nl> } <nl> catch ( const std : : exception & e ) <nl> { <nl>
|
Use getentropy from std : : random_device , avoiding FS usage of / dev / urandom ( )
|
emscripten-core/emscripten
|
048f028cded452f610a7ec879883510692102f6e
|
2020-09-17T23:32:54Z
|
mmm a / dlib / image_transforms / image_pyramid . h <nl> ppp b / dlib / image_transforms / image_pyramid . h <nl> namespace dlib <nl> COMPILE_TIME_ASSERT ( pixel_traits < in_pixel_type > : : has_alpha = = false ) ; <nl> COMPILE_TIME_ASSERT ( pixel_traits < out_pixel_type > : : has_alpha = = false ) ; <nl> <nl> - down . clear ( ) ; <nl> + set_image_size ( down , 0 , 0 ) ; <nl> + } <nl> + <nl> + template < <nl> + typename image_type <nl> + > <nl> + void operator ( ) ( <nl> + image_type & img <nl> + ) const <nl> + { <nl> + typedef typename image_traits < image_type > : : pixel_type pixel_type ; <nl> + COMPILE_TIME_ASSERT ( pixel_traits < pixel_type > : : has_alpha = = false ) ; <nl> + set_image_size ( img , 0 , 0 ) ; <nl> } <nl> } ; <nl> <nl> namespace dlib <nl> <nl> } <nl> <nl> + template < <nl> + typename image_type <nl> + > <nl> + void operator ( ) ( <nl> + image_type & img <nl> + ) const <nl> + { <nl> + image_type temp ; <nl> + ( * this ) ( img , temp ) ; <nl> + swap ( temp , img ) ; <nl> + } <nl> + <nl> private : <nl> <nl> <nl> namespace dlib <nl> } <nl> } <nl> <nl> + template < <nl> + typename image_type <nl> + > <nl> + void operator ( ) ( <nl> + image_type & img <nl> + ) const <nl> + { <nl> + image_type temp ; <nl> + ( * this ) ( img , temp ) ; <nl> + swap ( temp , img ) ; <nl> + } <nl> private : <nl> <nl> <nl> namespace dlib <nl> set_image_size ( down , ( ( N - 1 ) * num_rows ( original ) ) / N , ( ( N - 1 ) * num_columns ( original ) ) / N ) ; <nl> resize_image ( original , down ) ; <nl> } <nl> + <nl> + template < <nl> + typename image_type <nl> + > <nl> + void operator ( ) ( <nl> + image_type & img <nl> + ) const <nl> + { <nl> + image_type temp ; <nl> + ( * this ) ( img , temp ) ; <nl> + swap ( temp , img ) ; <nl> + } <nl> } ; <nl> <nl> template < > <nl> mmm a / dlib / image_transforms / image_pyramid_abstract . h <nl> ppp b / dlib / image_transforms / image_pyramid_abstract . h <nl> namespace dlib <nl> points outside the # down image . <nl> ! * / <nl> <nl> + template < <nl> + typename image_type <nl> + > <nl> + void operator ( ) ( <nl> + image_type & img <nl> + ) const ; <nl> + / * ! <nl> + requires <nl> + - image_type = = an image object that implements the interface defined in <nl> + dlib / image_processing / generic_image . h <nl> + - pixel_traits < typename image_traits < image_type > : : pixel_type > : : has_alpha = = false <nl> + ensures <nl> + - This function downsamples the given image and stores the results in # img . <nl> + In particular , it is equivalent to performing : <nl> + ( * this ) ( img , temp ) ; <nl> + swap ( img , temp ) ; <nl> + ! * / <nl> + <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> <nl> template < typename T > <nl>
|
Made the disabled version of pyramid_down support the new image interface .
|
davisking/dlib
|
6d55fcc260d0a2e48aed5f03b6bfdb55a86bd3bc
|
2014-07-20T12:07:59Z
|
mmm a / src / operator / convolution - inl . h <nl> ppp b / src / operator / convolution - inl . h <nl> struct ConvolutionParam : public dmlc : : Parameter < ConvolutionParam > { <nl> . describe ( " Number of groups partition . " <nl> " This option is not supported by CuDNN , you can use SliceChannel to num_group , " <nl> " apply convolution and concat instead to achieve the same need . " ) ; <nl> - DMLC_DECLARE_FIELD ( workspace ) . set_default ( 512 ) . set_range ( 128 , 4096 ) <nl> + DMLC_DECLARE_FIELD ( workspace ) . set_default ( 512 ) . set_range ( 0 , 4096 ) <nl> . describe ( " Tmp workspace for convolution ( MB ) . " ) ; <nl> DMLC_DECLARE_FIELD ( no_bias ) . set_default ( false ) <nl> . describe ( " Whether to disable bias parameter . " ) ; <nl> mmm a / src / operator / cudnn_batch_norm . cu <nl> ppp b / src / operator / cudnn_batch_norm . cu <nl> class CuDNNBatchNormOp : public Operator { <nl> Tensor < gpu , 4 > x = in_data [ cudnnbatchnorm : : kData ] . get_with_shape < gpu , 4 , real_t > ( shape_ , s ) ; <nl> Tensor < gpu , 4 > dx = in_grad [ cudnnbatchnorm : : kData ] . get_with_shape < gpu , 4 , real_t > ( shape_ , s ) ; <nl> Tensor < gpu , 4 > dy = out_grad [ cudnnbatchnorm : : kOut ] . get_with_shape < gpu , 4 , real_t > ( shape_ , s ) ; <nl> - Tensor < gpu , 1 > gamma = in_data [ cudnnbatchnorm : : kBeta ] . get_with_shape < gpu , 1 , real_t > ( Shape1 ( shape_ [ 1 ] ) , s ) ; <nl> + Tensor < gpu , 1 > gamma = in_data [ cudnnbatchnorm : : kGamma ] . get_with_shape < gpu , 1 , real_t > ( Shape1 ( shape_ [ 1 ] ) , s ) ; <nl> Tensor < gpu , 1 > dbeta = in_grad [ cudnnbatchnorm : : kBeta ] . get_with_shape < gpu , 1 , real_t > ( Shape1 ( shape_ [ 1 ] ) , s ) ; <nl> Tensor < gpu , 1 > dgamma = in_grad [ cudnnbatchnorm : : kGamma ] . get_with_shape < gpu , 1 , real_t > ( Shape1 ( shape_ [ 1 ] ) , s ) ; <nl> Tensor < gpu , 1 > save_mean = out_data [ cudnnbatchnorm : : kMean ] . get_with_shape < gpu , 1 , real_t > ( Shape1 ( shape_ [ 1 ] ) , s ) ; <nl> mmm a / src / operator / deconvolution - inl . h <nl> ppp b / src / operator / deconvolution - inl . h <nl> struct DeconvolutionParam : public dmlc : : Parameter < DeconvolutionParam > { <nl> . describe ( " deconvolution filter ( channel ) number " ) ; <nl> DMLC_DECLARE_FIELD ( num_group ) . set_default ( 1 ) <nl> . describe ( " number of groups partition " ) ; <nl> - DMLC_DECLARE_FIELD ( workspace ) . set_default ( 512 ) . set_range ( 128 , 4096 ) <nl> + DMLC_DECLARE_FIELD ( workspace ) . set_default ( 512 ) . set_range ( 0 , 4096 ) <nl> . describe ( " Tmp workspace for deconvolution ( MB ) " ) ; <nl> DMLC_DECLARE_FIELD ( no_bias ) . set_default ( true ) <nl> . describe ( " Whether to disable bias parameter . " ) ; <nl>
|
Merge pull request from piiswrong / master
|
apache/incubator-mxnet
|
590a7b7d54a77348a9e1b148669c0d1c5961c902
|
2016-02-05T20:47:52Z
|
mmm a / docs / LangRef . html <nl> ppp b / docs / LangRef . html <nl> < h4 id = " expr - ternary " > Ternary operator < / h4 > <nl> <nl> < p > The subexpression to the left of the <nl> ' ? ' is evaluated , and is converted to ' Bool ' using the result ' s <nl> - ' getLogicValue ' method if it is not already ' Bool ' . If the condition is <nl> + ' boolValue ' property if it is not already ' Bool ' . If the condition is <nl> true , the subexpression to the right of ' ? ' is evaluated , and its result <nl> becomes the result of the expression . If the <nl> condition is false , the subexpression to the right of ' : ' is evaluated , and <nl> < h3 id = " stmt - if " > ' if ' Statement < / h3 > <nl> < / pre > <nl> <nl> < p > ' if ' statements provide a simple control transfer operations that evaluates <nl> - the condition , invokes the ' getLogicValue ' member of the result if the result <nl> + the condition , gets the ' boolValue ' property of the result if the result <nl> not a ' Bool ' , then determines the direction of the branch based on the result . <nl> - ( Internally , the standard library type ' Bool ' has a getLogicValue member that <nl> + ( Internally , the standard library type ' Bool ' has a boolValue property that <nl> returns a ' Builtin . Int1 ' . ) It is an error if the type of the expression is <nl> context - dependent or some non - Bool type . <nl> < / p > <nl> < h3 id = " stmt - while " > ' while ' Statement < / h3 > <nl> < / pre > <nl> <nl> < p > ' while ' statements provide simple loop construct which ( on each iteration <nl> - of the loop ) evalutes the condition , invokes the ' getLogicValue ' member of <nl> + of the loop ) evalutes the condition , gets the ' boolValue ' property of <nl> the result if the result not a ' Bool ' , then determines whether to keep <nl> - looping . ( Internally , the standard library type ' Bool ' has a getLogicValue <nl> - member that returns a ' Builtin . Int1 ' . ) It is an error if the type of <nl> + looping . ( Internally , the standard library type ' Bool ' has a boolValue <nl> + property that yields a ' Builtin . Int1 ' . ) It is an error if the type of <nl> the expression is context - dependent or some non - Bool type . <nl> < / p > <nl> <nl> < h3 id = " stmt - do - while " > ' do - while ' Statement < / h3 > <nl> <nl> < p > ' do - while ' statements provide simple loop construct which ( on each <nl> iteration of the loop ) evaluates the body , then evaluates the condition , <nl> - invoking the ' getLogicValue ' member of the result if the result not a ' Bool ' , <nl> + getting the ' boolValue ' property of the result if the result not a ' Bool ' , <nl> then determines whether to keep looping . ( Internally , the standard library <nl> - type ' Bool ' has a getLogicValue member that returns a ' Builtin . Int1 ' ) . It is <nl> + type ' Bool ' has a boolValue property that yields a ' Builtin . Int1 ' ) . It is <nl> an error if the type of the expression is context - dependent or some non - Bool <nl> type . <nl> < / p > <nl> mmm a / include / swift / AST / Decl . h <nl> ppp b / include / swift / AST / Decl . h <nl> enum PointerTypeKind : unsigned { <nl> <nl> / / / An implicitly created member decl , used when importing a Clang enum type . <nl> / / / These are not added to their enclosing type unless forced . <nl> - typedef std : : function < Decl * ( ) > DelayedDecl ; <nl> + typedef std : : function < void ( SmallVectorImpl < Decl * > & ) > DelayedDecl ; <nl> <nl> / / / An implicitly created protocol decl , used when importing a Clang enum type . <nl> / / / These are not added to their enclosing type unless forced . <nl> mmm a / include / swift / AST / KnownIdentifiers . def <nl> ppp b / include / swift / AST / KnownIdentifiers . def <nl> IDENTIFIER_WITH_NAME ( NotEqualsOperator , " ! = " ) <nl> / / Built - in identifiers <nl> IDENTIFIER ( MaxBuiltinIntegerType ) <nl> IDENTIFIER ( IntegerLiteralType ) <nl> + IDENTIFIER_WITH_NAME ( BoolValue , " boolValue " ) <nl> IDENTIFIER_WITH_NAME ( ConvertFromNilLiteral , " convertFromNilLiteral " ) <nl> IDENTIFIER_WITH_NAME ( ConvertFromIntegerLiteral , " convertFromIntegerLiteral " ) <nl> IDENTIFIER_WITH_NAME ( ConvertFromBuiltinIntegerLiteral , <nl> IDENTIFIER_WITH_NAME ( ConvertFromStringInterpolationSegment , <nl> IDENTIFIER_WITH_NAME ( ConvertFromArrayLiteral , " convertFromArrayLiteral " ) <nl> IDENTIFIER_WITH_NAME ( ConvertFromDictionaryLiteral , <nl> " convertFromDictionaryLiteral " ) <nl> - IDENTIFIER_WITH_NAME ( GetLogicValue , " getLogicValue " ) <nl> IDENTIFIER_WITH_NAME ( GetBuiltinLogicValue , " _getBuiltinLogicValue " ) <nl> - IDENTIFIER_WITH_NAME ( GetArrayBoundValue , " getArrayBoundValue " ) <nl> + IDENTIFIER_WITH_NAME ( ArrayBoundValue , " arrayBoundValue " ) <nl> IDENTIFIER_WITH_NAME ( GetBuiltinArrayBoundValue , " _getBuiltinArrayBoundValue " ) <nl> IDENTIFIER_WITH_NAME ( Conversion , " __conversion " ) <nl> <nl> mmm a / lib / AST / NameLookup . cpp <nl> ppp b / lib / AST / NameLookup . cpp <nl> void NominalTypeDecl : : forceDelayedMemberDecls ( ) { <nl> return ; <nl> <nl> / / Grab the delayed members and then empty the list so we don ' t recurse . <nl> - auto delayedMembers = DelayedMembers ; <nl> + auto OldDelayedMembers = DelayedMembers ; <nl> DelayedMembers = { } ; <nl> <nl> - for ( auto delayedDeclCreator : delayedMembers ) { <nl> - addMember ( delayedDeclCreator ( ) ) ; <nl> + SmallVector < Decl * , 4 > NewDecls ; <nl> + for ( auto DelayedDeclCreator : OldDelayedMembers ) { <nl> + DelayedDeclCreator ( NewDecls ) ; <nl> + for ( auto * D : NewDecls ) { <nl> + addMember ( D ) ; <nl> + } <nl> + NewDecls . clear ( ) ; <nl> } <nl> } <nl> <nl> mmm a / lib / ClangImporter / ImportDecl . cpp <nl> ppp b / lib / ClangImporter / ImportDecl . cpp <nl> getOperatorRef ( ASTContext & C , Identifier name ) { <nl> } <nl> <nl> <nl> - / / Build the ' getLogicValue ' method for an option set . <nl> - / / struct NSSomeOptionSet : RawOptionSet { <nl> - / / var value : RawType <nl> - / / func getLogicValue ( ) - > Bool { <nl> - / / return self . value ! = 0 <nl> - / / } <nl> - / / } <nl> - static FuncDecl * makeOptionSetGetLogicValueMethod ( StructDecl * optionSetDecl , <nl> - ValueDecl * valueDecl ) { <nl> + / / / Build the ' boolValue ' property for an option set . <nl> + / / / \ code <nl> + / / / struct NSSomeOptionSet : RawOptionSet { <nl> + / / / var value : RawType <nl> + / / / var boolValue : Bool { <nl> + / / / return self . value ! = 0 <nl> + / / / } <nl> + / / / } <nl> + / / / \ endcode <nl> + static void makeOptionSetBoolValueProperty ( StructDecl * optionSetDecl , <nl> + ValueDecl * valueDecl , <nl> + SmallVectorImpl < Decl * > & NewDecls ) { <nl> ASTContext & C = optionSetDecl - > getASTContext ( ) ; <nl> - auto boolType = C . getGetBoolDecl ( nullptr ) - > getType ( ) <nl> - - > castTo < AnyFunctionType > ( ) - > getResult ( ) ; <nl> + auto boolType = C . getGetBoolDecl ( nullptr ) <nl> + - > getType ( ) <nl> + - > castTo < AnyFunctionType > ( ) <nl> + - > getResult ( ) ; <nl> <nl> - VarDecl * selfDecl = createSelfDecl ( optionSetDecl , / * NotStaticMethod * / false ) ; <nl> + / / Create the getter . <nl> + VarDecl * selfDecl = createSelfDecl ( optionSetDecl , / * NotStaticMethod * / false ) ; <nl> Pattern * selfParam = createTypedNamedPattern ( selfDecl ) ; <nl> - Pattern * methodParam = TuplePattern : : create ( C , SourceLoc ( ) , { } , SourceLoc ( ) ) ; <nl> + Pattern * methodParam = TuplePattern : : create ( C , SourceLoc ( ) , { } , SourceLoc ( ) ) ; <nl> methodParam - > setType ( TupleType : : getEmpty ( C ) ) ; <nl> Pattern * params [ ] = { selfParam , methodParam } ; <nl> - <nl> - DeclName name ( C , C . Id_GetLogicValue , { } ) ; <nl> - FuncDecl * getLVDecl = FuncDecl : : create ( <nl> - C , SourceLoc ( ) , StaticSpellingKind : : None , SourceLoc ( ) , <nl> - name , SourceLoc ( ) , nullptr , Type ( ) , <nl> - params , TypeLoc : : withoutLoc ( boolType ) , optionSetDecl ) ; <nl> - getLVDecl - > setImplicit ( ) ; <nl> - <nl> - auto toRawArgType = TupleType : : getEmpty ( C ) ; <nl> - Type toRawType = FunctionType : : get ( toRawArgType , boolType ) ; <nl> - toRawType = FunctionType : : get ( optionSetDecl - > getDeclaredTypeInContext ( ) , <nl> - toRawType ) ; <nl> - getLVDecl - > setType ( toRawType ) ; <nl> - getLVDecl - > setBodyResultType ( boolType ) ; <nl> - getLVDecl - > setAccessibility ( Accessibility : : Public ) ; <nl> <nl> - auto selfRef = new ( C ) DeclRefExpr ( selfDecl , SourceLoc ( ) , / * implicit * / true ) ; <nl> - auto valueRef = new ( C ) MemberRefExpr ( selfRef , SourceLoc ( ) , <nl> - valueDecl , SourceLoc ( ) , <nl> - / * implicit * / true ) ; <nl> + auto * getterDecl = <nl> + FuncDecl : : create ( C , SourceLoc ( ) , StaticSpellingKind : : None , SourceLoc ( ) , <nl> + Identifier ( ) , SourceLoc ( ) , nullptr , Type ( ) , params , <nl> + TypeLoc : : withoutLoc ( boolType ) , optionSetDecl ) ; <nl> + getterDecl - > setImplicit ( ) ; <nl> <nl> - auto zero = new ( C ) IntegerLiteralExpr ( " 0 " , SourceLoc ( ) , / * implicit * / true ) ; <nl> + Type GetterType = FunctionType : : get ( TupleType : : getEmpty ( C ) , boolType ) ; <nl> + GetterType = <nl> + FunctionType : : get ( optionSetDecl - > getDeclaredTypeInContext ( ) , GetterType ) ; <nl> + getterDecl - > setType ( GetterType ) ; <nl> + getterDecl - > setBodyResultType ( boolType ) ; <nl> + getterDecl - > setAccessibility ( Accessibility : : Public ) ; <nl> <nl> - auto neRef = getOperatorRef ( C , C . Id_NotEqualsOperator ) ; <nl> - <nl> - Expr * args [ ] = { valueRef , zero } ; <nl> - auto argsTuple = TupleExpr : : createImplicit ( C , args , { } ) ; <nl> - auto apply = new ( C ) BinaryExpr ( neRef , argsTuple , / * implicit * / true ) ; <nl> - auto ret = new ( C ) ReturnStmt ( SourceLoc ( ) , apply ) ; <nl> + / / Fill in the body of the getter . <nl> + { <nl> + auto selfRef = <nl> + new ( C ) DeclRefExpr ( selfDecl , SourceLoc ( ) , / * Implicit = * / true ) ; <nl> + auto valueRef = <nl> + new ( C ) MemberRefExpr ( selfRef , SourceLoc ( ) , valueDecl , SourceLoc ( ) , <nl> + / * Implicit = * / true ) ; <nl> + <nl> + auto zero = new ( C ) IntegerLiteralExpr ( " 0 " , SourceLoc ( ) , / * Implicit = * / true ) ; <nl> + <nl> + auto neRef = getOperatorRef ( C , C . Id_NotEqualsOperator ) ; <nl> + <nl> + Expr * args [ ] = { valueRef , zero } ; <nl> + auto argsTuple = TupleExpr : : createImplicit ( C , args , { } ) ; <nl> + auto apply = new ( C ) BinaryExpr ( neRef , argsTuple , / * Implicit = * / true ) ; <nl> + auto ret = new ( C ) ReturnStmt ( SourceLoc ( ) , apply ) ; <nl> + <nl> + auto body = BraceStmt : : create ( C , SourceLoc ( ) , ASTNode ( ret ) , SourceLoc ( ) , <nl> + / * Implicit = * / true ) ; <nl> + getterDecl - > setBody ( body ) ; <nl> + } <nl> <nl> - auto body = BraceStmt : : create ( C , SourceLoc ( ) , ASTNode ( ret ) , <nl> - SourceLoc ( ) , <nl> - / * implicit * / true ) ; <nl> - getLVDecl - > setBody ( body ) ; <nl> - <nl> / / Add as an external definition . <nl> - C . addedExternalDecl ( getLVDecl ) ; <nl> - <nl> - return getLVDecl ; <nl> + C . addedExternalDecl ( getterDecl ) ; <nl> + <nl> + NewDecls . push_back ( getterDecl ) ; <nl> + <nl> + / / Create the property . <nl> + auto * PropertyDecl = <nl> + new ( C ) VarDecl ( / * IsStatic = * / false , / * IsLet = * / false , SourceLoc ( ) , <nl> + C . Id_BoolValue , boolType , optionSetDecl ) ; <nl> + PropertyDecl - > setImplicit ( ) ; <nl> + PropertyDecl - > makeComputed ( SourceLoc ( ) , getterDecl , nullptr , SourceLoc ( ) ) ; <nl> + PropertyDecl - > setAccessibility ( optionSetDecl - > getAccessibility ( ) ) ; <nl> + NewDecls . push_back ( PropertyDecl ) ; <nl> + <nl> + Pattern * PropertyPattern = <nl> + new ( C ) NamedPattern ( PropertyDecl , / * Implicit = * / true ) ; <nl> + PropertyPattern - > setType ( boolType ) ; <nl> + PropertyPattern = new ( C ) TypedPattern ( <nl> + PropertyPattern , TypeLoc : : withoutLoc ( boolType ) , / * Implicit = * / true ) ; <nl> + PropertyPattern - > setType ( boolType ) ; <nl> + <nl> + auto * PatternBinding = new ( C ) PatternBindingDecl ( <nl> + SourceLoc ( ) , StaticSpellingKind : : None , SourceLoc ( ) , PropertyPattern , <nl> + nullptr , / * IsConditional = * / false , optionSetDecl ) ; <nl> + PatternBinding - > setImplicit ( ) ; <nl> + NewDecls . push_back ( PatternBinding ) ; <nl> } <nl> <nl> / / Build the NilLiteralConvertible conformance : <nl> namespace { <nl> <nl> / / Add delayed implicit members to the type . <nl> DelayedDecl delayedMembers [ ] = { <nl> - [ = ] ( ) { return makeOptionSetFactoryMethod ( structDecl , var , <nl> - OptionSetFactoryMethod : : FromMask ) ; } , <nl> - [ = ] ( ) { return makeOptionSetFactoryMethod ( structDecl , var , <nl> - OptionSetFactoryMethod : : FromRaw ) ; } , <nl> - [ = ] ( ) { return makeOptionSetToRawMethod ( structDecl , var ) ; } , <nl> - [ = ] ( ) { return makeOptionSetGetLogicValueMethod ( structDecl , var ) ; } , <nl> - [ = ] ( ) { return makeNilLiteralConformance ( structDecl , var ) ; } <nl> + [ = ] ( SmallVectorImpl < Decl * > & NewDecls ) { <nl> + NewDecls . push_back ( <nl> + makeOptionSetFactoryMethod ( structDecl , var , <nl> + OptionSetFactoryMethod : : FromMask ) ) ; <nl> + NewDecls . push_back ( <nl> + makeOptionSetFactoryMethod ( structDecl , var , <nl> + OptionSetFactoryMethod : : FromRaw ) ) ; <nl> + NewDecls . push_back ( makeOptionSetToRawMethod ( structDecl , var ) ) ; <nl> + makeOptionSetBoolValueProperty ( structDecl , var , NewDecls ) ; <nl> + NewDecls . push_back ( makeNilLiteralConformance ( structDecl , var ) ) ; <nl> + } <nl> } ; <nl> <nl> - structDecl - > setDelayedMemberDecls ( Impl . SwiftContext . AllocateCopy ( <nl> - delayedMembers ) ) ; <nl> + structDecl - > setDelayedMemberDecls ( <nl> + Impl . SwiftContext . AllocateCopy ( delayedMembers ) ) ; <nl> <nl> / / Set the members of the struct . <nl> structDecl - > addMember ( defaultConstructor ) ; <nl> mmm a / lib / SILPasses / Devirtualizer . cpp <nl> ppp b / lib / SILPasses / Devirtualizer . cpp <nl> processSpecializedProtocolConformance ( SpecializedProtocolConformance * SPC , <nl> <nl> / / / Devirtualize apply instructions that call witness_method instructions : <nl> / / / <nl> - / / / % 8 = witness_method $ Optional < UInt16 > , # LogicValue . getLogicValue ! 1 <nl> + / / / % 8 = witness_method $ Optional < UInt16 > , # LogicValue . boolValue ! getter . 1 <nl> / / / % 9 = apply % 8 < Self = CodeUnit ? > ( % 6 # 1 ) : . . . <nl> / / / <nl> static bool optimizeWitnessMethod ( ApplyInst * AI , WitnessMethodInst * WMI ) { <nl> static bool optimizeApplyInst ( ApplyInst * AI ) { <nl> <nl> / / Devirtualize apply instructions that call witness_method instructions : <nl> / / <nl> - / / % 8 = witness_method $ Optional < UInt16 > , # LogicValue . getLogicValue ! 1 <nl> + / / % 8 = witness_method $ Optional < UInt16 > , # LogicValue . boolValue ! getter . 1 <nl> / / % 9 = apply % 8 < Self = CodeUnit ? > ( % 6 # 1 ) : . . . <nl> / / <nl> if ( auto * AMI = dyn_cast < WitnessMethodInst > ( AI - > getCallee ( ) ) ) <nl> mmm a / lib / Sema / CSApply . cpp <nl> ppp b / lib / Sema / CSApply . cpp <nl> Type Solution : : computeSubstitutions ( Type origType , DeclContext * dc , <nl> / / / have a requirement with the given name . <nl> / / / <nl> / / / \ returns The named witness . <nl> - static FuncDecl * findNamedWitness ( TypeChecker & tc , DeclContext * dc , <nl> - Type type , ProtocolDecl * proto , <nl> - Identifier name , <nl> - Diag < > diag ) { <nl> + template < typename DeclTy > <nl> + static DeclTy * findNamedWitnessImpl ( TypeChecker & tc , DeclContext * dc , Type type , <nl> + ProtocolDecl * proto , Identifier name , <nl> + Diag < > diag ) { <nl> / / Find the named requirement . <nl> - FuncDecl * requirement = nullptr ; <nl> + DeclTy * requirement = nullptr ; <nl> for ( auto member : proto - > getMembers ( ) ) { <nl> - auto fd = dyn_cast < FuncDecl > ( member ) ; <nl> - if ( ! fd | | ! fd - > hasName ( ) ) <nl> + auto d = dyn_cast < DeclTy > ( member ) ; <nl> + if ( ! d | | ! d - > hasName ( ) ) <nl> continue ; <nl> <nl> - if ( fd - > getName ( ) = = name ) { <nl> - requirement = fd ; <nl> + if ( d - > getName ( ) = = name ) { <nl> + requirement = d ; <nl> break ; <nl> } <nl> } <nl> - <nl> + <nl> if ( ! requirement | | requirement - > isInvalid ( ) ) { <nl> tc . diagnose ( proto - > getLoc ( ) , diag ) ; <nl> return nullptr ; <nl> static FuncDecl * findNamedWitness ( TypeChecker & tc , DeclContext * dc , <nl> <nl> assert ( conformance & & " Missing conformance information " ) ; <nl> / / FIXME : Dropping substitutions here . <nl> - return cast < FuncDecl > ( conformance - > getWitness ( requirement , & tc ) . getDecl ( ) ) ; <nl> + return cast < DeclTy > ( conformance - > getWitness ( requirement , & tc ) . getDecl ( ) ) ; <nl> + } <nl> + <nl> + static FuncDecl * findNamedWitness ( TypeChecker & tc , DeclContext * dc , Type type , <nl> + ProtocolDecl * proto , Identifier name , <nl> + Diag < > diag ) { <nl> + return findNamedWitnessImpl < FuncDecl > ( tc , dc , type , proto , name , diag ) ; <nl> + } <nl> + <nl> + static VarDecl * findNamedPropertyWitness ( TypeChecker & tc , DeclContext * dc , <nl> + Type type , ProtocolDecl * proto , <nl> + Identifier name , Diag < > diag ) { <nl> + return findNamedWitnessImpl < VarDecl > ( tc , dc , type , proto , name , diag ) ; <nl> } <nl> <nl> / / / Adjust the given type to become the self type when referring to <nl> static Expr * convertViaBuiltinProtocol ( const Solution & solution , <nl> auto witnesses = tc . lookupMember ( type - > getRValueType ( ) , builtinName , cs . DC ) ; <nl> if ( ! witnesses ) { <nl> / / Find the witness we need to use . <nl> - auto witness = findNamedWitness ( tc , cs . DC , type - > getRValueType ( ) , protocol , <nl> - generalName , brokenProtocolDiag ) ; <nl> - <nl> + auto witness = <nl> + findNamedPropertyWitness ( tc , cs . DC , type - > getRValueType ( ) , protocol , <nl> + generalName , brokenProtocolDiag ) ; <nl> / / Form a reference to this member . <nl> Expr * memberRef = new ( ctx ) MemberRefExpr ( expr , expr - > getStartLoc ( ) , <nl> witness , expr - > getEndLoc ( ) , <nl> static Expr * convertViaBuiltinProtocol ( const Solution & solution , <nl> protocol - > getType ( ) ) ; <nl> return nullptr ; <nl> } <nl> - <nl> - / / Call the witness . <nl> - Expr * arg = TupleExpr : : createEmpty ( ctx , expr - > getStartLoc ( ) , <nl> - expr - > getEndLoc ( ) , / * Implicit = * / true ) ; <nl> - expr = new ( ctx ) CallExpr ( memberRef , arg , / * Implicit = * / true ) ; <nl> - failed = tc . typeCheckExpressionShallow ( expr , cs . DC ) ; <nl> - assert ( ! failed & & " Could not call witness ? " ) ; <nl> - ( void ) failed ; <nl> + expr = memberRef ; <nl> <nl> / / At this point , we must have a type with the builtin member . <nl> type = expr - > getType ( ) ; <nl> Solution : : convertToLogicValue ( Expr * expr , ConstraintLocator * locator ) const { <nl> * this , expr , locator , <nl> tc . getProtocol ( expr - > getLoc ( ) , <nl> KnownProtocolKind : : BooleanType ) , <nl> - tc . Context . Id_GetLogicValue , <nl> + tc . Context . Id_BoolValue , <nl> tc . Context . Id_GetBuiltinLogicValue , <nl> diag : : condition_broken_proto , <nl> diag : : broken_bool ) ; <nl> Solution : : convertOptionalToBool ( Expr * expr , ConstraintLocator * locator ) const { <nl> <nl> / / Find the witness we need to use . <nl> Type type = expr - > getType ( ) ; <nl> - auto witness = findNamedWitness ( tc , cs . DC , type - > getRValueType ( ) , proto , <nl> - tc . Context . Id_GetLogicValue , <nl> - diag : : condition_broken_proto ) ; <nl> + auto witness = findNamedPropertyWitness ( tc , cs . DC , type - > getRValueType ( ) , <nl> + proto , tc . Context . Id_BoolValue , <nl> + diag : : condition_broken_proto ) ; <nl> <nl> / / Form a reference to this member . <nl> auto & ctx = tc . Context ; <nl> Solution : : convertOptionalToBool ( Expr * expr , ConstraintLocator * locator ) const { <nl> return nullptr ; <nl> } <nl> <nl> - / / Call the witness . <nl> - Expr * arg = TupleExpr : : createEmpty ( ctx , expr - > getStartLoc ( ) , <nl> - expr - > getEndLoc ( ) , / * Implicit = * / true ) ; <nl> - expr = new ( ctx ) CallExpr ( memberRef , arg , / * Implicit = * / true ) ; <nl> - failed = tc . typeCheckExpressionShallow ( expr , cs . DC ) ; <nl> - assert ( ! failed & & " Could not call witness ? " ) ; <nl> - ( void ) failed ; <nl> - return expr ; <nl> + return memberRef ; <nl> } <nl> <nl> Expr * <nl> Solution : : convertToArrayBound ( Expr * expr , ConstraintLocator * locator ) const { <nl> - / / FIXME : Cache names . <nl> auto & tc = getConstraintSystem ( ) . getTypeChecker ( ) ; <nl> auto result = convertViaBuiltinProtocol ( <nl> * this , expr , locator , <nl> tc . getProtocol ( expr - > getLoc ( ) , <nl> KnownProtocolKind : : ArrayBoundType ) , <nl> - tc . Context . Id_GetArrayBoundValue , <nl> + tc . Context . Id_ArrayBoundValue , <nl> tc . Context . Id_GetBuiltinArrayBoundValue , <nl> diag : : broken_array_bound_proto , <nl> diag : : broken_builtin_array_bound ) ; <nl> Solution : : convertToArrayBound ( Expr * expr , ConstraintLocator * locator ) const { <nl> tc . diagnose ( expr - > getLoc ( ) , diag : : broken_builtin_array_bound ) ; <nl> return nullptr ; <nl> } <nl> - <nl> + <nl> return result ; <nl> } <nl> mmm a / stdlib / core / Algorithm . swift <nl> ppp b / stdlib / core / Algorithm . swift <nl> public func lexicographicalCompare < <nl> } <nl> return false <nl> } <nl> - return e2_ . getLogicValue ( ) <nl> + return e2_ . boolValue <nl> } <nl> } <nl> <nl> public func lexicographicalCompare < <nl> } <nl> return false <nl> } <nl> - return e2_ . getLogicValue ( ) <nl> + return e2_ . boolValue <nl> } <nl> } <nl> <nl> mmm a / stdlib / core / Assert . swift <nl> ppp b / stdlib / core / Assert . swift <nl> func _precondition < T : BooleanType > ( <nl> _fatalErrorMessage ( " fatal error " , message , file , line ) <nl> } <nl> } else if _isReleaseAssertConfiguration ( ) { <nl> - let error = ! condition ( ) . getLogicValue ( ) ; <nl> + let error = ! condition ( ) . boolValue ; <nl> Builtin . condfail ( error . value ) <nl> } <nl> } <nl> mmm a / stdlib / core / Bool . swift <nl> ppp b / stdlib / core / Bool . swift <nl> extension Bool : BooleanType { <nl> return value <nl> } <nl> <nl> - @ transparent public func getLogicValue ( ) - > Bool { return self } <nl> + @ transparent public var boolValue : Bool { return self } <nl> <nl> / / Bool can be constructed from BooleanType <nl> public init ( _ v : BooleanType ) { <nl> - self = v . getLogicValue ( ) <nl> + self = v . boolValue <nl> } <nl> } <nl> <nl> mmm a / stdlib / core / BridgeObjectiveC . swift <nl> ppp b / stdlib / core / BridgeObjectiveC . swift <nl> public struct AutoreleasingUnsafePointer < T / * TODO : class * / > <nl> return UnsafePointer < T > ( self ) . _isNull <nl> } <nl> <nl> - @ transparent public <nl> - func getLogicValue ( ) - > Bool { <nl> + @ transparent <nl> + public var boolValue : Bool { <nl> return ! _isNull <nl> } <nl> <nl> mmm a / stdlib / core / Builtin . swift <nl> ppp b / stdlib / core / Builtin . swift <nl> internal func _isClassOrObjCExistential < T > ( x : T . Type ) - > Bool { <nl> <nl> @ transparent @ semantics ( " branchhint " ) internal <nl> func _branchHint < C : BooleanType > ( actual : C , expected : Bool ) - > Bool { <nl> - return Bool ( Builtin . int_expect_Int1 ( actual . getLogicValue ( ) . value , expected . value ) ) <nl> + return Bool ( Builtin . int_expect_Int1 ( actual . boolValue . value , expected . value ) ) <nl> } <nl> <nl> @ transparent @ semantics ( " fastpath " ) public <nl> func _fastPath < C : BooleanType > ( x : C ) - > Bool { <nl> - return _branchHint ( x . getLogicValue ( ) , true ) <nl> + return _branchHint ( x . boolValue , true ) <nl> } <nl> <nl> @ transparent @ semantics ( " slowpath " ) public <nl> func _slowPath < C : BooleanType > ( x : C ) - > Bool { <nl> - return _branchHint ( x . getLogicValue ( ) , false ) <nl> + return _branchHint ( x . boolValue , false ) <nl> } <nl> <nl> mmm a / stdlib / core / CompilerProtocols . swift <nl> ppp b / stdlib / core / CompilerProtocols . swift <nl> <nl> / / / Protocol describing types that can be used as array bounds . <nl> / / / <nl> / / / Types that conform to the ` ArrayBoundType ` protocol can be used as <nl> - / / / array bounds by providing an operation ( ` getArrayBoundValue ` ) that <nl> + / / / array bounds by providing a property ( ` arrayBoundValue ` ) that <nl> / / / produces an integral value . <nl> public protocol ArrayBoundType { <nl> typealias ArrayBound <nl> - func getArrayBoundValue ( ) - > ArrayBound <nl> + var arrayBoundValue : ArrayBound { get } <nl> } <nl> <nl> / / / Protocol describing types that can be used as logical values within <nl> public protocol ArrayBoundType { <nl> / / / ` for ` ) as well as other logical value contexts ( e . g . , ` case ` <nl> / / / statement guards ) . <nl> public protocol BooleanType { <nl> - func getLogicValue ( ) - > Bool <nl> + var boolValue : Bool { get } <nl> } <nl> <nl> / / / A ` GeneratorType ` is a ` SequenceType ` that is consumed when iterated . <nl> mmm a / stdlib / core / FixedPoint . swift . gyb <nl> ppp b / stdlib / core / FixedPoint . swift . gyb <nl> public struct $ { Self } <nl> } <nl> <nl> public typealias ArrayBound = $ { Self } <nl> - public func getArrayBoundValue ( ) - > $ { Self } { <nl> + public var arrayBoundValue : $ { Self } { <nl> return self <nl> } <nl> <nl> mmm a / stdlib / core / HeapBuffer . swift <nl> ppp b / stdlib / core / HeapBuffer . swift <nl> public struct HeapBuffer < Value , Element > : Equatable { <nl> } <nl> <nl> public var hasStorage : Bool { <nl> - return storage . getLogicValue ( ) <nl> + return storage . boolValue <nl> } <nl> <nl> subscript ( i : Int ) - > Element { <nl> mmm a / stdlib / core / ImplicitlyUnwrappedOptional . swift <nl> ppp b / stdlib / core / ImplicitlyUnwrappedOptional . swift <nl> public enum ImplicitlyUnwrappedOptional < T > <nl> } <nl> <nl> / / / Allow use in a Boolean context . <nl> - @ transparent public <nl> - func getLogicValue ( ) - > Bool { <nl> + @ transparent <nl> + public var boolValue : Bool { <nl> switch self { <nl> case . Some : <nl> return true <nl> extension ImplicitlyUnwrappedOptional : Printable { <nl> / / Intrinsics for use by language features . <nl> @ transparent internal <nl> func _doesImplicitlyUnwrappedOptionalHaveValue < T > ( inout v : T ! ) - > Builtin . Int1 { <nl> - return v . getLogicValue ( ) . value <nl> + return v . boolValue . value <nl> } <nl> <nl> @ transparent internal <nl> func _preconditionImplicitlyUnwrappedOptionalHasValue < T > ( inout v : T ! ) { <nl> - _precondition ( v . getLogicValue ( ) , <nl> + _precondition ( v . boolValue , <nl> " unexpectedly found nil while unwrapping an Optional value " ) <nl> } <nl> <nl> mmm a / stdlib / core / LogicValue . swift <nl> ppp b / stdlib / core / LogicValue . swift <nl> <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> public prefix func ! < T : BooleanType > ( a : T ) - > Bool { <nl> - return ! a . getLogicValue ( ) <nl> + return ! a . boolValue <nl> } <nl> <nl> / / Short circuiting logical operators . <nl> public prefix func ! < T : BooleanType > ( a : T ) - > Bool { <nl> <nl> @ transparent public <nl> func & & ( lhs : BooleanType , rhs : @ autoclosure ( ) - > BooleanType ) - > Bool { <nl> - return lhs . getLogicValue ( ) ? rhs ( ) . getLogicValue ( ) : false <nl> + return lhs . boolValue ? rhs ( ) . boolValue : false <nl> } <nl> <nl> @ transparent public <nl> func | | ( lhs : BooleanType , rhs : @ autoclosure ( ) - > BooleanType ) - > Bool { <nl> - return lhs . getLogicValue ( ) ? true : rhs ( ) . getLogicValue ( ) <nl> + return lhs . boolValue ? true : rhs ( ) . boolValue <nl> } <nl> mmm a / stdlib / core / Optional . swift <nl> ppp b / stdlib / core / Optional . swift <nl> public enum Optional < T > : BooleanType , Reflectable , NilLiteralConvertible { <nl> public init ( _ some : T ) { self = . Some ( some ) } <nl> <nl> / / / Allow use in a Boolean context . <nl> - @ transparent public <nl> - func getLogicValue ( ) - > Bool { <nl> + @ transparent <nl> + public var boolValue : Bool { <nl> switch self { <nl> case . Some : <nl> return true <nl> public func map < T , U > ( x : T ? , f : ( T ) - > U ) - > U ? { <nl> / / Intrinsics for use by language features . <nl> @ transparent internal <nl> func _doesOptionalHaveValue < T > ( inout v : T ? ) - > Builtin . Int1 { <nl> - return v . getLogicValue ( ) . value <nl> + return v . boolValue . value <nl> } <nl> <nl> @ transparent internal <nl> func _preconditionOptionalHasValue < T > ( inout v : T ? ) { <nl> - _precondition ( v . getLogicValue ( ) , <nl> + _precondition ( v . boolValue , <nl> " unexpectedly found nil while unwrapping an Optional value " ) <nl> } <nl> <nl> public struct _OptionalNilComparisonType : NilLiteralConvertible { <nl> } <nl> @ transparent public <nl> func ~ = < T > ( lhs : _OptionalNilComparisonType , rhs : T ? ) - > Bool { <nl> - return ! rhs . getLogicValue ( ) <nl> + return ! rhs . boolValue <nl> } <nl> <nl> internal struct _OptionalMirror < T > : MirrorType { <nl> mmm a / stdlib / core / SliceBuffer . swift <nl> ppp b / stdlib / core / SliceBuffer . swift <nl> struct _SliceBuffer < T > : _ArrayBufferType { <nl> func _invariantCheck ( ) { <nl> let isNative = _hasNativeBuffer <nl> _sanityCheck ( <nl> - ( owner as ? NativeStorage ) . getLogicValue ( ) = = isNative <nl> + ( owner as ? NativeStorage ) . boolValue = = isNative <nl> ) <nl> if isNative { <nl> _sanityCheck ( count < = nativeBuffer . count ) <nl> mmm a / stdlib / objc / ObjectiveC . swift <nl> ppp b / stdlib / objc / ObjectiveC . swift <nl> public struct ObjCBool : BooleanType , BooleanLiteralConvertible { <nl> # endif <nl> <nl> / / / Allow use in a Boolean context . <nl> - public func getLogicValue ( ) - > Bool { <nl> + public var boolValue : Bool { <nl> # if os ( OSX ) | | ( os ( iOS ) & & ( arch ( i386 ) | | arch ( arm ) ) ) <nl> return value ! = 0 <nl> # else <nl> public struct ObjCBool : BooleanType , BooleanLiteralConvertible { <nl> <nl> extension ObjCBool : Reflectable { <nl> public func getMirror ( ) - > MirrorType { <nl> - return reflect ( getLogicValue ( ) ) <nl> + return reflect ( boolValue ) <nl> } <nl> } <nl> <nl> extension ObjCBool : Printable { <nl> public var description : String { <nl> - return self . getLogicValue ( ) . description <nl> + return self . boolValue . description <nl> } <nl> } <nl> <nl> mmm a / stdlib / objc / XCTest / XCTest . swift <nl> ppp b / stdlib / objc / XCTest / XCTest . swift <nl> public func XCTAssertTrue ( expression : @ autoclosure ( ) - > BooleanType , _ message : <nl> let assertionType = _XCTAssertionType . True <nl> <nl> / / evaluate the expression exactly once <nl> - let expressionValue = expression ( ) . getLogicValue ( ) <nl> + let expressionValue = expression ( ) . boolValue <nl> <nl> if ! expressionValue { <nl> / / TODO : @ auto_string expression <nl> public func XCTAssertFalse ( expression : @ autoclosure ( ) - > BooleanType , _ message <nl> let assertionType = _XCTAssertionType . False <nl> <nl> / / evaluate the expression exactly once <nl> - let expressionValue = expression ( ) . getLogicValue ( ) <nl> + let expressionValue = expression ( ) . boolValue <nl> <nl> if expressionValue { <nl> / / TODO : @ auto_string expression <nl> mmm a / stdlib / unittest / StdlibUnittest . swift . gyb <nl> ppp b / stdlib / unittest / StdlibUnittest . swift . gyb <nl> public struct AssertionResult : Printable , BooleanType { <nl> self . _isPass = isPass <nl> } <nl> <nl> - public func getLogicValue ( ) - > Bool { <nl> + public var boolValue : Bool { <nl> return _isPass <nl> } <nl> <nl> mmm a / test / Constraints / condition . swift <nl> ppp b / test / Constraints / condition . swift <nl> func simpleIf ( b : Bool ) { <nl> <nl> / / Support for non - Bool logic values <nl> struct OtherLogicValue : BooleanType { <nl> - func getLogicValue ( ) - > Bool { return true } <nl> + var boolValue : Bool { return true } <nl> } <nl> <nl> func otherIf ( b : OtherLogicValue ) { <nl> mmm a / test / Constraints / if_expr . swift <nl> ppp b / test / Constraints / if_expr . swift <nl> <nl> / / RUN : % swift - parse % s - verify <nl> <nl> struct MyLogicValue : BooleanType { <nl> - func getLogicValue ( ) - > Bool { <nl> + var boolValue : Bool { <nl> return true <nl> } <nl> } <nl> mmm a / test / Constraints / members . swift <nl> ppp b / test / Constraints / members . swift <nl> format . _splitFirstIf ( { $ 0 . isASCII ( ) } ) <nl> <nl> / / Archetypes <nl> func doGetLogicValue < T : BooleanType > ( t : T ) { <nl> - t . getLogicValue ( ) <nl> + t . boolValue <nl> } <nl> <nl> / / Members referenced from inside the class <nl> mmm a / test / DebugInfo / autoclosure . swift <nl> ppp b / test / DebugInfo / autoclosure . swift <nl> infix operator & & & & & { <nl> } <nl> <nl> func & & & & & ( lhs : BooleanType , rhs : @ autoclosure ( ) - > BooleanType ) - > Bool { <nl> - return lhs . getLogicValue ( ) ? rhs ( ) . getLogicValue ( ) : false <nl> + return lhs . boolValue ? rhs ( ) . boolValue : false <nl> } <nl> <nl> func call_me ( var input : Int ) - > Void { <nl> mmm a / test / IDE / Inputs / mock - sdk / Foo . annotated . txt <nl> ppp b / test / IDE / Inputs / mock - sdk / Foo . annotated . txt <nl> struct < loc > FooRuncingOptions < / loc > : < ref : Protocol > RawOptionSetType < / ref > { <nl> < decl : Func > static func < loc > fromMask ( raw : < ref : Struct > Int < / ref > ) < / loc > - > < ref : Struct > FooRuncingOptions < / ref > < / decl > <nl> < decl : Func > static func < loc > fromRaw ( raw : < ref : Struct > Int < / ref > ) < / loc > - > < ref : Struct > FooRuncingOptions < / ref > ? < / decl > <nl> < decl : Func > func < loc > toRaw ( ) < / loc > - > < ref : Struct > Int < / ref > < / decl > <nl> - < decl : Func > func < loc > getLogicValue ( ) < / loc > - > < ref : Struct > Bool < / ref > < / decl > <nl> + < decl : Var > var < loc > boolValue < / loc > : < ref : Struct > Bool < / ref > { get } < / decl > <nl> < decl : Func > static func < loc > convertFromNilLiteral ( ) < / loc > - > < ref : Struct > FooRuncingOptions < / ref > < / decl > <nl> } < / decl > <nl> < decl : Struct > struct < loc > FooStruct1 < / loc > { <nl> mmm a / test / IDE / Inputs / mock - sdk / Foo . printed . recursive . txt <nl> ppp b / test / IDE / Inputs / mock - sdk / Foo . printed . recursive . txt <nl> struct FooRuncingOptions : RawOptionSetType { <nl> static func fromMask ( raw : Int ) - > FooRuncingOptions <nl> static func fromRaw ( raw : Int ) - > FooRuncingOptions ? <nl> func toRaw ( ) - > Int <nl> - func getLogicValue ( ) - > Bool <nl> + var boolValue : Bool { get } <nl> static func convertFromNilLiteral ( ) - > FooRuncingOptions <nl> } <nl> struct FooStruct1 { <nl> mmm a / test / IDE / Inputs / mock - sdk / Foo . printed . txt <nl> ppp b / test / IDE / Inputs / mock - sdk / Foo . printed . txt <nl> struct FooRuncingOptions : RawOptionSetType { <nl> static func fromMask ( raw : Int ) - > FooRuncingOptions <nl> static func fromRaw ( raw : Int ) - > FooRuncingOptions ? <nl> func toRaw ( ) - > Int <nl> - func getLogicValue ( ) - > Bool <nl> + var boolValue : Bool { get } <nl> static func convertFromNilLiteral ( ) - > FooRuncingOptions <nl> } <nl> <nl> mmm a / test / IDE / print_clang_decls . swift <nl> ppp b / test / IDE / print_clang_decls . swift <nl> <nl> / / FOUNDATION - NEXT : { { ^ } } static func fromMask ( raw : UInt ) - > NSRuncingOptions { { $ } } <nl> / / FOUNDATION - NEXT : { { ^ } } static func fromRaw ( raw : UInt ) - > NSRuncingOptions ? { { $ } } <nl> / / FOUNDATION - NEXT : { { ^ } } func toRaw ( ) - > UInt { { $ } } <nl> - / / FOUNDATION - NEXT : { { ^ } } func getLogicValue ( ) - > Bool { { $ } } <nl> + / / FOUNDATION - NEXT : { { ^ } } var boolValue : Bool { get } { { $ } } <nl> / / FOUNDATION - NEXT : { { ^ } } static func convertFromNilLiteral ( ) - > NSRuncingOptions { { $ } } <nl> / / FOUNDATION - NEXT : { { ^ } } } { { $ } } <nl> <nl> mmm a / test / IRGen / Inputs / ObjectiveC . swift <nl> ppp b / test / IRGen / Inputs / ObjectiveC . swift <nl> public struct ObjCBool : Printable { <nl> private var value : UInt8 <nl> <nl> / / / \ brief Allow use in a Boolean context . <nl> - public func getLogicValue ( ) - > Bool { <nl> + public var boolValue : Bool { <nl> return value ! = 0 <nl> } <nl> <nl> public var description : String { <nl> / / Dispatch to Bool . <nl> - return self . getLogicValue ( ) . description <nl> + return self . boolValue . description <nl> } <nl> } <nl> <nl> mmm a / test / Inputs / clang - importer - sdk / swift - modules / ObjectiveC . swift <nl> ppp b / test / Inputs / clang - importer - sdk / swift - modules / ObjectiveC . swift <nl> public struct ObjCBool : BooleanType { <nl> } <nl> <nl> / / / \ brief Allow use in a Boolean context . <nl> - public func getLogicValue ( ) - > Bool { <nl> + public var boolValue : Bool { <nl> return value <nl> } <nl> } <nl> public struct ObjCBool : BooleanType { <nl> } <nl> <nl> / / / \ brief Allow use in a Boolean context . <nl> - public func getLogicValue ( ) - > Bool { <nl> + public var boolValue : Bool { <nl> if value = = 0 { return false } <nl> return true <nl> } <nl> mmm a / test / Interpreter / SDK / Cocoa_enums . swift <nl> ppp b / test / Interpreter / SDK / Cocoa_enums . swift <nl> let opts : NSBinarySearchingOptions = . FirstEqual | . InsertionIndex <nl> / / CHECK : true <nl> println ( opts & ( . LastEqual | . InsertionIndex ) = = . InsertionIndex ) <nl> / / CHECK : false <nl> - println ( ( opts & . LastEqual ) . getLogicValue ( ) ) <nl> + println ( ( opts & . LastEqual ) . boolValue ) <nl> mmm a / test / Interpreter / bool_as_generic . swift <nl> ppp b / test / Interpreter / bool_as_generic . swift <nl> prefix operator ! ! { } <nl> infix operator & & & { } <nl> <nl> prefix func ! ! < T : BooleanType > ( x : T ) - > Bool { <nl> - return x . getLogicValue ( ) <nl> + return x . boolValue <nl> } <nl> <nl> func & & & ( x : BooleanType , y : @ autoclosure ( ) - > BooleanType ) - > Bool { <nl> - return x . getLogicValue ( ) ? y ( ) . getLogicValue ( ) : false <nl> + return x . boolValue ? y ( ) . boolValue : false <nl> } <nl> <nl> println ( ! ! true ) / / CHECK : true <nl> mmm a / test / Interpreter / generic_implicit_closure . swift <nl> ppp b / test / Interpreter / generic_implicit_closure . swift <nl> <nl> / / RUN : % target - run - simple - swift | FileCheck % s <nl> <nl> func andc < T : BooleanType > ( x : Bool , y : T ) - > Bool { <nl> - return x & & ! y . getLogicValue ( ) <nl> + return x & & ! y . boolValue <nl> } <nl> <nl> struct Truthy : BooleanType { <nl> - func getLogicValue ( ) - > Bool { <nl> + var boolValue : Bool { <nl> return true <nl> } <nl> } <nl> <nl> struct Falselike : BooleanType { <nl> - func getLogicValue ( ) - > Bool { <nl> + var boolValue : Bool { <nl> return false <nl> } <nl> } <nl> println ( andc ( true , Falselike ( ) ) ) / / CHECK : true <nl> println ( andc ( false , Falselike ( ) ) ) / / CHECK : false <nl> <nl> func must < T : BooleanType > ( x : T ) { <nl> - assert ( x . getLogicValue ( ) ) <nl> + assert ( x . boolValue ) <nl> } <nl> func shant < T : BooleanType > ( x : T ) { <nl> - assert ( ! x . getLogicValue ( ) ) <nl> + assert ( ! x . boolValue ) <nl> } <nl> <nl> must ( Truthy ( ) ) <nl> mmm a / test / SILGen / Inputs / ObjectiveC . swift <nl> ppp b / test / SILGen / Inputs / ObjectiveC . swift <nl> public struct ObjCBool : BooleanType { <nl> var value : UInt8 <nl> <nl> / / / \ brief Allow use in a Boolean context . <nl> - public func getLogicValue ( ) - > Bool { <nl> + public var boolValue : Bool { <nl> if value = = 0 { return false } <nl> return true <nl> } <nl> mmm a / test / SILGen / break_continue . swift <nl> ppp b / test / SILGen / break_continue . swift <nl> <nl> / / RUN : % swift - module - name = Swift - parse - stdlib - emit - silgen % s | FileCheck % s <nl> <nl> protocol BooleanType { <nl> - func getLogicValue ( ) - > Bool <nl> + var boolValue : Bool { get } <nl> } <nl> <nl> struct Bool : BooleanType { <nl> var value : Builtin . Int1 <nl> func _getBuiltinLogicValue ( ) - > Builtin . Int1 { return value } <nl> - func getLogicValue ( ) - > Bool { return self } <nl> + var boolValue : Bool { return self } <nl> } <nl> <nl> / / CHECK - LABEL : sil @ _TFSs5test1 <nl> mmm a / test / SILPasses / performance_inliner . sil <nl> ppp b / test / SILPasses / performance_inliner . sil <nl> bb0 : <nl> / / Generic call to " branchHint " for use in specialized @ slowPath <nl> sil public_external [ transparent ] [ semantics " branchhint " ] @ _TFSs11_branchHintUSs11BooleanType__FTQ_Sb_Sb : $ @ thin < C where C : BooleanType > ( @ in C , Bool ) - > Bool { <nl> bb0 ( % 0 : $ * C , % 1 : $ Bool ) : <nl> - % 2 = witness_method $ C , # BooleanType . getLogicValue ! 1 : $ @ cc ( witness_method ) @ thin < τ_0_0 where τ_0_0 : BooleanType > ( @ inout τ_0_0 ) - > Bool / / user : % 4 <nl> + % 2 = witness_method $ C , # BooleanType . boolValue ! getter . 1 : $ @ cc ( witness_method ) @ thin < τ_0_0 where τ_0_0 : BooleanType > ( @ inout τ_0_0 ) - > Bool / / user : % 4 <nl> % 3 = apply % 2 < C > ( % 0 ) : $ @ cc ( witness_method ) @ thin < τ_0_0 where τ_0_0 : BooleanType > ( @ inout τ_0_0 ) - > Bool <nl> return % 3 : $ Bool <nl> } <nl> mmm a / test / decl / overload . swift <nl> ppp b / test / decl / overload . swift <nl> func ! = < T > ( lhs : T , rhs : NoneType ) - > Bool { / / expected - error { { invalid redecl <nl> <nl> / / < rdar : / / problem / 15082356 > <nl> func & & ( lhs : BooleanType , rhs : @ autoclosure ( ) - > BooleanType ) - > Bool { / / expected - note { { previously declared } } <nl> - return lhs . getLogicValue ( ) & & rhs ( ) . getLogicValue ( ) <nl> + return lhs . boolValue & & rhs ( ) . boolValue <nl> } <nl> <nl> func & & ( lhs : BooleanType , rhs : @ autoclosure ( ) - > BooleanType ) - > Bool { / / expected - error { { invalid redeclaration of ' & & ' } } <nl> - return lhs . getLogicValue ( ) | | rhs ( ) . getLogicValue ( ) <nl> + return lhs . boolValue | | rhs ( ) . boolValue <nl> } <nl> <nl> / / @ noreturn <nl> mmm a / test / stdlib / Assert . swift <nl> ppp b / test / stdlib / Assert . swift <nl> import Darwin <nl> <nl> struct Truthiness : BooleanType { <nl> init ( _ value : Bool ) { self . value = value } <nl> - func getLogicValue ( ) - > Bool { return value } <nl> + var boolValue : Bool { return value } <nl> <nl> - var value : Bool ; <nl> + var value : Bool <nl> } <nl> var falsie = Truthiness ( false ) <nl> var truthie = Truthiness ( true ) <nl> mmm a / test / stdlib / AssertDebug . swift <nl> ppp b / test / stdlib / AssertDebug . swift <nl> if ( Process . arguments [ 1 ] = = " debugTrapBool " ) { <nl> <nl> struct Truthiness : BooleanType { <nl> init ( _ value : Bool ) { self . value = value } <nl> - func getLogicValue ( ) - > Bool { return value } <nl> + var boolValue : Bool { return value } <nl> <nl> var value : Bool <nl> } <nl> mmm a / test / stdlib / Dictionary . swift <nl> ppp b / test / stdlib / Dictionary . swift <nl> print ( " \ " Swift \ " = > " + String ( dict [ " Swift " ] ! ) + " \ n " ) <nl> / / CHECK - NEXT : " World " = > 2 <nl> print ( " \ " World \ " = > " + String ( dict [ " World " ] ! ) + " \ n " ) <nl> / / CHECK - NEXT : " World " = > true <nl> - print ( " \ " World \ " = > " + String ( dict [ " World " ] . getLogicValue ( ) ) + " \ n " ) <nl> + print ( " \ " World \ " = > " + String ( dict [ " World " ] . boolValue ) + " \ n " ) <nl> / / CHECK - NEXT : " Universe " = > false <nl> - print ( " \ " Universe \ " = > " + String ( dict [ " Universe " ] . getLogicValue ( ) ) + " \ n " ) <nl> + print ( " \ " Universe \ " = > " + String ( dict [ " Universe " ] . boolValue ) + " \ n " ) <nl> <nl> / / Overwriting existing value <nl> dict [ " Hello " ] = 0 <nl> mmm a / test / stdlib / HeapBuffer . swift <nl> ppp b / test / stdlib / HeapBuffer . swift <nl> for x in 0 . . < 10 { <nl> ( a . elementStorage + x ) . initialize ( x ) <nl> } <nl> <nl> - println ( " buffer has storage : \ ( a . storage . getLogicValue ( ) ) " ) <nl> + println ( " buffer has storage : \ ( a . storage . boolValue ) " ) <nl> / / CHECK - NEXT : buffer has storage : true <nl> <nl> func testUnique ( ) { <nl> mmm a / test / stdlib / LogicValue . swift <nl> ppp b / test / stdlib / LogicValue . swift <nl> <nl> enum Bewl : BooleanType { <nl> case False , True <nl> <nl> - func getLogicValue ( ) - > Bool { <nl> + var boolValue : Bool { <nl> switch self { <nl> case . False : <nl> return false <nl> func falsy ( ) - > Bewl { <nl> func logicValueTests ( ) { <nl> / / Logic values should convert to bool . <nl> struct X : BooleanType { <nl> - func getLogicValue ( ) - > Bool { return false } <nl> + var boolValue : Bool { return false } <nl> } <nl> var anX = X ( ) <nl> println ( " BooleanType Bool = \ ( Bool ( anX ) ) " ) / / CHECK : BooleanType Bool = false <nl> mmm a / test / stdlib / Reflection . swift <nl> ppp b / test / stdlib / Reflection . swift <nl> dump ( Matte ( " 456 " ) ) <nl> <nl> / / Structs have no identity and thus no object identifier <nl> / / CHECK - NEXT : false <nl> - println ( reflect ( Matte ( " " ) ) . objectIdentifier . getLogicValue ( ) ) <nl> + println ( reflect ( Matte ( " " ) ) . objectIdentifier . boolValue ) <nl> / / The default mirror provides no quick look object <nl> / / CHECK - NEXT : false <nl> - println ( reflect ( Matte ( " " ) ) . quickLookObject . getLogicValue ( ) ) <nl> + println ( reflect ( Matte ( " " ) ) . quickLookObject . boolValue ) <nl> / / CHECK - NEXT : true <nl> println ( reflect ( Matte ( " " ) ) . disposition = = . Struct ) <nl> <nl> println ( " Tuple : " ) <nl> / / CHECK - NEXT : s : nine <nl> dump ( tuple ) <nl> / / CHECK - NEXT : false <nl> - println ( reflect ( tuple ) . quickLookObject . getLogicValue ( ) ) <nl> + println ( reflect ( tuple ) . quickLookObject . boolValue ) <nl> / / CHECK - NEXT : true <nl> println ( reflect ( tuple ) . disposition = = . Tuple ) <nl> <nl> println ( reflect ( x ) . objectIdentifier ! = = reflect ( x ) . objectIdentifier ! ) <nl> / / CHECK - NEXT : false <nl> println ( reflect ( x ) . objectIdentifier ! = = reflect ( y ) . objectIdentifier ! ) <nl> / / CHECK - NEXT : false <nl> - println ( reflect ( x ) . quickLookObject . getLogicValue ( ) ) <nl> + println ( reflect ( x ) . quickLookObject . boolValue ) <nl> / / CHECK - NEXT : true <nl> println ( reflect ( x ) . disposition = = . Class ) <nl> <nl> mmm a / test / stdlib / Runtime . swift <nl> ppp b / test / stdlib / Runtime . swift <nl> protocol Q1 { } <nl> <nl> / / A small struct that can be stored inline in an opaque buffer . <nl> struct StructConformsToP1 : BooleanType , Q1 { <nl> - func getLogicValue ( ) - > Bool { <nl> + var boolValue : Bool { <nl> return true <nl> } <nl> } <nl> struct Struct2ConformsToP1 < T : BooleanType > : BooleanType , Q1 { <nl> init ( _ value : T ) { <nl> self . value = value <nl> } <nl> - func getLogicValue ( ) - > Bool { <nl> - return value . getLogicValue ( ) <nl> + var boolValue : Bool { <nl> + return value . boolValue <nl> } <nl> var value : T <nl> } <nl> struct Struct4ConformsToP2 < T : Printable > : Printable , Q1 { <nl> struct StructDoesNotConformToP1 : Q1 { } <nl> <nl> class ClassConformsToP1 : BooleanType , Q1 { <nl> - func getLogicValue ( ) - > Bool { <nl> + var boolValue : Bool { <nl> return true <nl> } <nl> } <nl> class Class2ConformsToP1 < T : BooleanType > : BooleanType , Q1 { <nl> init ( _ value : T ) { <nl> self . value = [ value ] <nl> } <nl> - func getLogicValue ( ) - > Bool { <nl> - return value [ 0 ] . getLogicValue ( ) <nl> + var boolValue : Bool { <nl> + return value [ 0 ] . boolValue <nl> } <nl> / / FIXME : should be " var value : T " , but we don ' t support it now . <nl> var value : Array < T > <nl> RuntimeBridging . test ( " dynamicCastToExistential1 " ) { <nl> expectTrue ( _stdlib_conformsToProtocol ( someP1Ref2 as AnyObject , P1 . self ) ) <nl> expectFalse ( _stdlib_conformsToProtocol ( someNotP1Ref as AnyObject , P1 . self ) ) <nl> <nl> - expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Value , P1 . self ) . getLogicValue ( ) ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Value2 , P1 . self ) . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Value , P1 . self ) . boolValue ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Value2 , P1 . self ) . boolValue ) <nl> expectEqual ( " 10 20 30 40 " , <nl> _stdlib_dynamicCastToExistential1Unconditional ( someP2Value , P2 . self ) . description ) <nl> expectEqual ( " 10 20 30 40 50 60 70 80 " , <nl> _stdlib_dynamicCastToExistential1Unconditional ( someP2Value2 , P2 . self ) . description ) <nl> <nl> - expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Ref , P1 . self ) . getLogicValue ( ) ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Ref2 , P1 . self ) . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Ref , P1 . self ) . boolValue ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Ref2 , P1 . self ) . boolValue ) <nl> <nl> - expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Value as Q1 , P1 . self ) . getLogicValue ( ) ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Value2 as Q1 , P1 . self ) . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Value as Q1 , P1 . self ) . boolValue ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Value2 as Q1 , P1 . self ) . boolValue ) <nl> expectEqual ( " 10 20 30 40 " , <nl> _stdlib_dynamicCastToExistential1Unconditional ( someP2Value as Q1 , P2 . self ) . description ) <nl> expectEqual ( " 10 20 30 40 50 60 70 80 " , <nl> _stdlib_dynamicCastToExistential1Unconditional ( someP2Value2 as Q1 , P2 . self ) . description ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Ref as Q1 , P1 . self ) . getLogicValue ( ) ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Ref2 as Q1 , P1 . self ) . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Ref as Q1 , P1 . self ) . boolValue ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Ref2 as Q1 , P1 . self ) . boolValue ) <nl> <nl> - expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Value as Any , P1 . self ) . getLogicValue ( ) ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Value2 as Any , P1 . self ) . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Value as Any , P1 . self ) . boolValue ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Value2 as Any , P1 . self ) . boolValue ) <nl> expectEqual ( " 10 20 30 40 " , <nl> _stdlib_dynamicCastToExistential1Unconditional ( someP2Value as Any , P2 . self ) . description ) <nl> expectEqual ( " 10 20 30 40 50 60 70 80 " , <nl> _stdlib_dynamicCastToExistential1Unconditional ( someP2Value2 as Any , P2 . self ) . description ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Ref as Any , P1 . self ) . getLogicValue ( ) ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Ref2 as Any , P1 . self ) . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Ref as Any , P1 . self ) . boolValue ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Ref2 as Any , P1 . self ) . boolValue ) <nl> <nl> - expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Ref as AnyObject , P1 . self ) . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1Unconditional ( someP1Ref as AnyObject , P1 . self ) . boolValue ) <nl> <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value , P1 . self ) ! . getLogicValue ( ) ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value2 , P1 . self ) ! . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value , P1 . self ) ! . boolValue ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value2 , P1 . self ) ! . boolValue ) <nl> expectEmpty ( _stdlib_dynamicCastToExistential1 ( someNotP1Value , P1 . self ) ) <nl> expectEqual ( " 10 20 30 40 " , <nl> _stdlib_dynamicCastToExistential1 ( someP2Value , P2 . self ) ! . description ) <nl> expectEqual ( " 10 20 30 40 50 60 70 80 " , <nl> _stdlib_dynamicCastToExistential1 ( someP2Value2 , P2 . self ) ! . description ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref , P1 . self ) ! . getLogicValue ( ) ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref2 , P1 . self ) ! . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref , P1 . self ) ! . boolValue ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref2 , P1 . self ) ! . boolValue ) <nl> expectEmpty ( _stdlib_dynamicCastToExistential1 ( someNotP1Ref , P1 . self ) ) <nl> <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value as P1 , P1 . self ) ! . getLogicValue ( ) ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value2 as P1 , P1 . self ) ! . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value as P1 , P1 . self ) ! . boolValue ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value2 as P1 , P1 . self ) ! . boolValue ) <nl> expectEqual ( " 10 20 30 40 " , <nl> _stdlib_dynamicCastToExistential1 ( someP2Value as P2 , P2 . self ) ! . description ) <nl> expectEqual ( " 10 20 30 40 50 60 70 80 " , <nl> _stdlib_dynamicCastToExistential1 ( someP2Value2 as P2 , P2 . self ) ! . description ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref as P1 , P1 . self ) ! . getLogicValue ( ) ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref2 as P1 , P1 . self ) ! . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref as P1 , P1 . self ) ! . boolValue ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref2 as P1 , P1 . self ) ! . boolValue ) <nl> <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value as Q1 , P1 . self ) ! . getLogicValue ( ) ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value2 as Q1 , P1 . self ) ! . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value as Q1 , P1 . self ) ! . boolValue ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value2 as Q1 , P1 . self ) ! . boolValue ) <nl> expectEmpty ( _stdlib_dynamicCastToExistential1 ( someNotP1Value as Q1 , P1 . self ) ) <nl> expectEqual ( " 10 20 30 40 " , <nl> _stdlib_dynamicCastToExistential1 ( someP2Value as Q1 , P2 . self ) ! . description ) <nl> expectEqual ( " 10 20 30 40 50 60 70 80 " , <nl> _stdlib_dynamicCastToExistential1 ( someP2Value2 as Q1 , P2 . self ) ! . description ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref as Q1 , P1 . self ) ! . getLogicValue ( ) ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref2 as Q1 , P1 . self ) ! . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref as Q1 , P1 . self ) ! . boolValue ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref2 as Q1 , P1 . self ) ! . boolValue ) <nl> expectEmpty ( _stdlib_dynamicCastToExistential1 ( someNotP1Ref as Q1 , P1 . self ) ) <nl> <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value as Any , P1 . self ) ! . getLogicValue ( ) ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value2 as Any , P1 . self ) ! . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value as Any , P1 . self ) ! . boolValue ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Value2 as Any , P1 . self ) ! . boolValue ) <nl> expectEmpty ( _stdlib_dynamicCastToExistential1 ( someNotP1Value as Any , P1 . self ) ) <nl> expectEqual ( " 10 20 30 40 " , <nl> _stdlib_dynamicCastToExistential1 ( someP2Value as Any , P2 . self ) ! . description ) <nl> expectEqual ( " 10 20 30 40 50 60 70 80 " , <nl> _stdlib_dynamicCastToExistential1 ( someP2Value2 as Any , P2 . self ) ! . description ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref as Any , P1 . self ) ! . getLogicValue ( ) ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref2 as Any , P1 . self ) ! . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref as Any , P1 . self ) ! . boolValue ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref2 as Any , P1 . self ) ! . boolValue ) <nl> expectEmpty ( _stdlib_dynamicCastToExistential1 ( someNotP1Ref as Any , P1 . self ) ) <nl> <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref as AnyObject , P1 . self ) ! . getLogicValue ( ) ) <nl> - expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref2 as AnyObject , P1 . self ) ! . getLogicValue ( ) ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref as AnyObject , P1 . self ) ! . boolValue ) <nl> + expectTrue ( _stdlib_dynamicCastToExistential1 ( someP1Ref2 as AnyObject , P1 . self ) ! . boolValue ) <nl> expectEmpty ( _stdlib_dynamicCastToExistential1 ( someNotP1Ref as AnyObject , P1 . self ) ) <nl> } <nl> <nl> mmm a / test / stmt / statements . swift <nl> ppp b / test / stmt / statements . swift <nl> func funcdecl5 ( a : Int , y : Int ) { <nl> } <nl> <nl> struct infloopbool { <nl> - func getLogicValue ( ) - > infloopbool { <nl> + var boolValue : infloopbool { <nl> return self <nl> } <nl> } <nl>
|
Change ' getLogicValue ( ) ' into a property ' boolValue ' ; change
|
apple/swift
|
d14f17beefa61c2cfe687845473e89e1c37391b2
|
2014-07-22T12:08:10Z
|
mmm a / docs / root / configuration / overview / v2_overview . rst <nl> ppp b / docs / root / configuration / overview / v2_overview . rst <nl> A minimal fully static bootstrap config is provided below : <nl> type : STATIC <nl> lb_policy : ROUND_ROBIN <nl> load_assignment : <nl> + cluster_name : some_service <nl> endpoints : <nl> - lb_endpoints : <nl> - endpoint : <nl> on 127 . 0 . 0 . 3 : 5678 is provided below : <nl> lb_policy : ROUND_ROBIN <nl> http2_protocol_options : { } <nl> load_assignment : <nl> + cluster_name : xds_cluster <nl> endpoints : <nl> - lb_endpoints : <nl> - endpoint : <nl>
|
Added cluster_name to load assignment config for static cluster ( )
|
envoyproxy/envoy
|
794a001266c2fb1e64bb353f080babeb120d1083
|
2018-08-13T21:20:45Z
|
mmm a / tools / swift - api - digester / swift - api - digester . cpp <nl> ppp b / tools / swift - api - digester / swift - api - digester . cpp <nl> struct SDKNodeInitInfo { <nl> StringRef SuperclassUsr ; <nl> SDKNodeInitInfo ( SDKContext & Ctx ) : Ctx ( Ctx ) { } <nl> SDKNodeInitInfo ( SDKContext & Ctx , ValueDecl * VD ) ; <nl> - SDKNodeInitInfo ( SDKContext & Ctx , Type Ty ) ; <nl> + SDKNodeInitInfo ( SDKContext & Ctx , Type Ty , <nl> + bool IsImplicitlyUnwrappedOptional = false ) ; <nl> SDKNode * createSDKNode ( SDKNodeKind Kind ) ; <nl> } ; <nl> <nl> class SDKNodeDumpVisitor : public SDKNodeVisitor { <nl> SDKNodeDumpVisitor ( ) { } ; <nl> } ; <nl> <nl> - static StringRef getPrintedName ( SDKContext & Ctx , Type Ty ) { <nl> + static StringRef getPrintedName ( SDKContext & Ctx , Type Ty , <nl> + bool IsImplicitlyUnwrappedOptional ) { <nl> std : : string S ; <nl> llvm : : raw_string_ostream OS ( S ) ; <nl> PrintOptions PO ; <nl> PO . SkipAttributes = true ; <nl> + if ( IsImplicitlyUnwrappedOptional ) <nl> + PO . PrintOptionalAsImplicitlyUnwrapped = true ; <nl> + <nl> Ty . print ( OS , PO ) ; <nl> return Ctx . buffer ( OS . str ( ) ) ; <nl> } <nl> <nl> - static StringRef getTypeName ( SDKContext & Ctx , Type Ty ) { <nl> + static StringRef getTypeName ( SDKContext & Ctx , Type Ty , <nl> + bool IsImplicitlyUnwrappedOptional ) { <nl> if ( Ty - > getKind ( ) = = TypeKind : : Paren ) { <nl> return Ctx . buffer ( " Paren " ) ; <nl> } <nl> static StringRef getTypeName ( SDKContext & Ctx , Type Ty ) { <nl> return NAT - > getDecl ( ) - > getNameStr ( ) ; <nl> } <nl> if ( Ty - > getAnyNominal ( ) ) { <nl> + if ( IsImplicitlyUnwrappedOptional ) { <nl> + assert ( Ty - > getAnyOptionalObjectType ( ) ) ; <nl> + return StringRef ( " ImplicitlyUnwrappedOptional " ) ; <nl> + } <nl> return Ty - > getAnyNominal ( ) - > getNameStr ( ) ; <nl> } <nl> # define TYPE ( id , parent ) \ <nl> static Ownership getOwnership ( ValueDecl * VD ) { <nl> return Ownership : : Strong ; <nl> } <nl> <nl> - SDKNodeInitInfo : : SDKNodeInitInfo ( SDKContext & Ctx , Type Ty ) : <nl> - Ctx ( Ctx ) , Name ( getTypeName ( Ctx , Ty ) ) , PrintedName ( getPrintedName ( Ctx , Ty ) ) { <nl> + SDKNodeInitInfo : : SDKNodeInitInfo ( SDKContext & Ctx , Type Ty , <nl> + bool IsImplicitlyUnwrappedOptional ) : <nl> + Ctx ( Ctx ) , Name ( getTypeName ( Ctx , Ty , IsImplicitlyUnwrappedOptional ) ) , <nl> + PrintedName ( getPrintedName ( Ctx , Ty , IsImplicitlyUnwrappedOptional ) ) { <nl> if ( isFunctionTypeNoEscape ( Ty ) ) <nl> TypeAttrs . push_back ( TypeAttrKind : : TAK_noescape ) ; <nl> } <nl> case SDKNodeKind : : X : \ <nl> <nl> / / Recursively construct a node that represents a type , for instance , <nl> / / representing the return value type of a function decl . <nl> - static SDKNode * constructTypeNode ( SDKContext & Ctx , Type T ) { <nl> - SDKNode * Root = SDKNodeInitInfo ( Ctx , T ) . createSDKNode ( SDKNodeKind : : TypeNominal ) ; <nl> + static SDKNode * constructTypeNode ( SDKContext & Ctx , Type T , <nl> + bool IsImplicitlyUnwrappedOptional = false ) { <nl> + SDKNode * Root = SDKNodeInitInfo ( Ctx , T , IsImplicitlyUnwrappedOptional ) <nl> + . createSDKNode ( SDKNodeKind : : TypeNominal ) ; <nl> <nl> if ( auto NAT = dyn_cast < NameAliasType > ( T . getPointer ( ) ) ) { <nl> SDKNode * Root = SDKNodeInitInfo ( Ctx , T ) . createSDKNode ( SDKNodeKind : : TypeNameAlias ) ; <nl> static SDKNode * constructTypeNode ( SDKContext & Ctx , Type T ) { <nl> static SDKNode * constructFunctionNode ( SDKContext & Ctx , FuncDecl * FD , <nl> SDKNodeKind Kind ) { <nl> auto Func = SDKNodeInitInfo ( Ctx , FD ) . createSDKNode ( Kind ) ; <nl> - Func - > addChild ( constructTypeNode ( Ctx , FD - > getResultInterfaceType ( ) ) ) ; <nl> + bool resultIsImplicitlyUnwrappedOptional = false ; <nl> + if ( FD - > getAttrs ( ) . hasAttribute < ImplicitlyUnwrappedOptionalAttr > ( ) ) <nl> + resultIsImplicitlyUnwrappedOptional = true ; <nl> + Func - > addChild ( constructTypeNode ( Ctx , FD - > getResultInterfaceType ( ) , <nl> + resultIsImplicitlyUnwrappedOptional ) ) ; <nl> for ( auto * paramList : FD - > getParameterLists ( ) ) { <nl> for ( auto param : * paramList ) { <nl> + bool paramIsImplicitlyUnwrappedOptional = false ; <nl> + if ( param - > getAttrs ( ) . hasAttribute < ImplicitlyUnwrappedOptionalAttr > ( ) ) <nl> + paramIsImplicitlyUnwrappedOptional = true ; <nl> + <nl> if ( ! param - > isSelfParameter ( ) ) <nl> - Func - > addChild ( constructTypeNode ( Ctx , param - > getInterfaceType ( ) ) ) ; <nl> + Func - > addChild ( constructTypeNode ( Ctx , param - > getInterfaceType ( ) , <nl> + paramIsImplicitlyUnwrappedOptional ) ) ; <nl> } <nl> } <nl> return Func ; <nl> static SDKNode * constructTypeDeclNode ( SDKContext & Ctx , NominalTypeDecl * NTD ) { <nl> <nl> static SDKNode * constructVarNode ( SDKContext & Ctx , ValueDecl * VD ) { <nl> auto Var = SDKNodeInitInfo ( Ctx , VD ) . createSDKNode ( SDKNodeKind : : Var ) ; <nl> - Var - > addChild ( constructTypeNode ( Ctx , VD - > getInterfaceType ( ) ) ) ; <nl> + auto isImplicitlyUnwrappedOptional = false ; <nl> + if ( VD - > getAttrs ( ) . hasAttribute < ImplicitlyUnwrappedOptionalAttr > ( ) ) <nl> + isImplicitlyUnwrappedOptional = true ; <nl> + Var - > addChild ( constructTypeNode ( Ctx , VD - > getInterfaceType ( ) , <nl> + isImplicitlyUnwrappedOptional ) ) ; <nl> if ( auto VAD = dyn_cast < AbstractStorageDecl > ( VD ) ) { <nl> if ( auto Getter = VAD - > getGetter ( ) ) <nl> Var - > addChild ( constructFunctionNode ( Ctx , Getter , SDKNodeKind : : Getter ) ) ; <nl>
|
Merge pull request from rudkx / iuo - update - api - digester
|
apple/swift
|
209cd2e0bff69db871af0630dabcd80d6de63165
|
2018-01-14T21:32:36Z
|
mmm a / CNTK . sln <nl> ppp b / CNTK . sln <nl> Global <nl> { 1C6E6C53 - 1AA7 - 4B69 - 913E - B97BB5A872CF } = { 3385EBEA - 5F97 - 4B2B - 9F30 - 0E6D7F91B9CA } <nl> { CCC07E8E - F33A - 4AF7 - 9F60 - 93E2AA61C75E } = { 3385EBEA - 5F97 - 4B2B - 9F30 - 0E6D7F91B9CA } <nl> EndGlobalSection <nl> - GlobalSection ( Performance ) = preSolution <nl> - HasPerformanceSessions = true <nl> - EndGlobalSection <nl> EndGlobal <nl> mmm a / Examples / Evaluation / CSEvalClient / Program . cs <nl> ppp b / Examples / Evaluation / CSEvalClient / Program . cs <nl> <nl> <nl> using System ; <nl> using System . Collections . Generic ; <nl> - using System . Diagnostics ; <nl> using System . IO ; <nl> using System . Linq ; <nl> using System . Linq . Expressions ; <nl> namespace Microsoft . MSR . CNTK . Extensibility . Managed . CSEvalClient <nl> / / / This program is a managed client using the CLIWrapper to run the model evaluator in CNTK . <nl> / / / There are four cases shown in this program related to model loading , network creation and evaluation . <nl> / / / <nl> + / / / To run this program from the CNTK binary drop , you must add the Evaluation NuGet package first . <nl> + / / / Refer to < see cref = " https : / / github . com / Microsoft / CNTK / wiki / Eval - Nuget " / > for information regarding the Evalution NuGet package . <nl> + / / / <nl> / / / EvaluateModelSingleLayer and EvaluateModelMultipleLayers <nl> / / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / / These two cases require the 01_OneHidden model which is part of the < CNTK > / Examples / Image / MNIST example . <nl> private static void EvaluateNetworkSingleLayer ( ) <nl> model . CreateNetwork ( networkDescription , deviceId : - 1 ) ; <nl> <nl> / / Prepare input value in the appropriate structure and size <nl> - var inputs = new Dictionary < string , List < float > > ( ) { { " features1 " , new List < float > ( ) { 1 . 0f } } } ; <nl> + var inputs = new Dictionary < string , List < float > > ( ) { { " features " , new List < float > ( ) { 1 . 0f } } } ; <nl> <nl> / / We can call the evaluate method and get back the results ( single layer output ) . . . <nl> var outDims = model . GetNodeDimensions ( NodeGroup . Output ) ; <nl>
|
Fixes typo in CS example
|
microsoft/CNTK
|
1855bab4d93de965a4666eff2e843790978345d4
|
2016-06-20T15:14:46Z
|
mmm a / lib / IDE / ReconstructType . cpp <nl> ppp b / lib / IDE / ReconstructType . cpp <nl> static void VisitNodeConstructor ( <nl> case TypeKind : : Function : { <nl> const AnyFunctionType * identifier_func = <nl> identifier_type - > getAs < AnyFunctionType > ( ) ; <nl> + <nl> + / / inits are typed as ( Foo . Type ) - > ( args . . . ) - > Foo , but don ' t <nl> + / / assert that in case we ' re dealing with broken code . <nl> + if ( identifier_func - > getInput ( ) - > is < AnyMetatypeType > ( ) & & <nl> + identifier_func - > getResult ( ) - > is < AnyFunctionType > ( ) ) { <nl> + identifier_func = <nl> + identifier_func - > getResult ( ) - > getAs < AnyFunctionType > ( ) ; <nl> + } <nl> + <nl> const AnyFunctionType * type_func = <nl> type_result . _types . front ( ) - > getAs < AnyFunctionType > ( ) ; <nl> if ( CanType ( identifier_func - > getResult ( ) <nl> mmm a / test / IDE / reconstruct_type_from_mangled_name . swift <nl> ppp b / test / IDE / reconstruct_type_from_mangled_name . swift <nl> struct Mystruct1 { <nl> var intField = 3 <nl> / / CHECK : decl : var intField : Int <nl> } <nl> + struct MyStruct2 { <nl> + / / CHECK : decl : struct MyStruct2 <nl> + init ( ) { } <nl> + / / CHECK : decl : init ( ) <nl> + init ( x : Int ) { } <nl> + / / CHECK : decl : init ( x : Int ) <nl> + init ( x : Int , y : Int ) { } <nl> + / / CHECK : decl : init ( x : Int , y : Int ) <nl> + } <nl> <nl> class Myclass1 { <nl> / / CHECK : decl : class Myclass1 <nl> class Myclass1 { <nl> <nl> func f1 ( ) { <nl> / / CHECK : decl : func f1 ( ) <nl> - var s1ins = Mystruct1 ( ) <nl> + var s1ins = Mystruct1 ( ) / / Implicit ctor <nl> / / CHECK : decl : var s1ins : Mystruct1 <nl> - / / FIXME : missing init ( ) ? <nl> - / / CHECK : dref : FAILURE for ' Mystruct1 ' usr = s : FV14swift_ide_test9Mystruct1cFT_S0_ <nl> - / / CHECK : type : Mystruct1 <nl> + / / CHECK : dref : init ( ) for ' Mystruct1 ' <nl> + _ = Mystruct1 ( intField : 1 ) / / Implicit ctor <nl> + / / CHECK : dref : init ( intField : Int ) for ' Mystruct1 ' <nl> <nl> s1ins . intField = 34 <nl> + / / CHECK : type : Mystruct1 <nl> / / CHECK : type : Int <nl> <nl> var c1ins = Myclass1 ( ) <nl> class Myclass2 { <nl> <nl> arr3 . append ( Myclass1 ( ) ) <nl> / / CHECK : type : @ lvalue Array < Myclass1 > - > Myclass1 - > ( ) <nl> + <nl> + _ = Myclass2 . init ( ) <nl> + / / CHECK : dref : init ( ) <nl> } <nl> } <nl> <nl>
|
[ ReconstructType ] Fix decl lookup when there are multiple constructors
|
apple/swift
|
65c86b713d687e94b30eba69f2d7bb26a9d01386
|
2016-03-18T21:15:24Z
|
mmm a / lib / ClangImporter / ImportDecl . cpp <nl> ppp b / lib / ClangImporter / ImportDecl . cpp <nl> ClangImporter : : Implementation : : importDeclContextOf ( <nl> auto importedDecl = importDecl ( context . getTypedefName ( ) , CurrentVersion ) ; <nl> if ( ! importedDecl ) return nullptr ; <nl> <nl> - importedDC = dyn_cast_or_null < DeclContext > ( importedDecl ) ; <nl> + / / Dig out the imported DeclContext . <nl> + importedDC = dynCastIgnoringCompatibilityAlias < NominalTypeDecl > ( importedDecl ) ; <nl> break ; <nl> } <nl> <nl> mmm a / test / APINotes / Inputs / custom - frameworks / APINotesFrameworkTest . framework / Headers / APINotesFrameworkTest . apinotes <nl> ppp b / test / APINotes / Inputs / custom - frameworks / APINotesFrameworkTest . framework / Headers / APINotesFrameworkTest . apinotes <nl> SwiftVersions : <nl> Typedefs : <nl> - Name : SomeCAlias <nl> SwiftName : ImportantCAlias <nl> - <nl> + - Name : EnclosingStructIdentifier <nl> + SwiftName : EnclosingStructIdentifier <nl> mmm a / test / APINotes / Inputs / custom - frameworks / APINotesFrameworkTest . framework / Headers / APINotesFrameworkTest . h <nl> ppp b / test / APINotes / Inputs / custom - frameworks / APINotesFrameworkTest . framework / Headers / APINotesFrameworkTest . h <nl> __attribute__ ( ( objc_root_class ) ) <nl> # import < APINotesFrameworkTest / Properties . h > <nl> # import < APINotesFrameworkTest / Protocols . h > <nl> # import < APINotesFrameworkTest / Types . h > <nl> + # import < APINotesFrameworkTest / SwiftWrapper . h > <nl> new file mode 100644 <nl> index 000000000000 . . 249e337f1bb6 <nl> mmm / dev / null <nl> ppp b / test / APINotes / Inputs / custom - frameworks / APINotesFrameworkTest . framework / Headers / SwiftWrapper . h <nl> <nl> + typedef _Bool EnclosingStructIdentifier <nl> + __attribute__ ( ( swift_wrapper ( struct ) ) ) __attribute__ ( ( swift_name ( " EnclosingStruct . Identifier " ) ) ) ; <nl> + <nl> + struct EnclosingStruct { } ; <nl> + <nl> + extern const EnclosingStructIdentifier EnclosingStructIdentifierMember ; <nl> mmm a / test / APINotes / versioned . swift <nl> ppp b / test / APINotes / versioned . swift <nl> func testAKA ( structValue : ImportantCStruct , aliasValue : ImportantCAlias ) { <nl> let _ : Int = optAliasValue <nl> / / CHECK - DIAGS - 3 : versioned . swift : [ [ @ LINE - 1 ] ] : 16 : error : cannot convert value of type ' Optional < ImportantCAlias > ' ( aka ' Optional < Int32 > ' ) to specified type ' Int ' <nl> } <nl> + <nl> # endif <nl> <nl> # if ! swift ( > = 4 ) <nl> + <nl> func useSwift3Name ( _ : ImportantCStruct ) { } <nl> / / CHECK - SILGEN - 3 : sil hidden @ _T09versioned13useSwift3NameySC20VeryImportantCStructVF <nl> <nl> func useNewlyNested ( _ : InnerInSwift4 ) { } <nl> func useSwift4Name ( _ : VeryImportantCStruct ) { } <nl> / / CHECK - SILGEN : sil hidden @ _T09versioned13useSwift4NameySC20VeryImportantCStructVF <nl> <nl> + <nl> + <nl> + # if swift ( > = 4 ) <nl> + func testSwiftWrapperInSwift4 ( ) { <nl> + _ = EnclosingStruct . Identifier . member <nl> + let _ : EnclosingStruct . Identifier = . member <nl> + } <nl> + <nl> + # else <nl> + func testSwiftWrapperInSwift3 ( ) { <nl> + _ = EnclosingStruct . Identifier . member <nl> + let _ : EnclosingStruct . Identifier = . member <nl> + } <nl> + # endif <nl>
|
Merge remote - tracking branch ' origin / master ' into master - next
|
apple/swift
|
fb0de23ac1120abcb11f9332da1eb905102bd5b8
|
2017-05-05T04:28:34Z
|
mmm a / . travis . yml <nl> ppp b / . travis . yml <nl> matrix : <nl> - os : linux <nl> group : deprecated - 2017Q4 <nl> compiler : gcc <nl> - sudo = true <nl> + sudo : true <nl> install : . / ci / install - linux . sh & & . / ci / log - config . sh <nl> script : . / ci / build - linux - bazel . sh <nl> - os : linux <nl> group : deprecated - 2017Q4 <nl> compiler : clang <nl> - sudo = true <nl> + sudo : true <nl> install : . / ci / install - linux . sh & & . / ci / log - config . sh <nl> script : . / ci / build - linux - bazel . sh <nl> - os : linux <nl>
|
Update . travis . yml
|
google/googletest
|
73d1251fe9a923c8bbae4b253fbb6ac9a2170d7d
|
2018-01-11T21:57:44Z
|
mmm a / tensorflow / tools / api / lib / python_object_to_proto_visitor . py <nl> ppp b / tensorflow / tools / api / lib / python_object_to_proto_visitor . py <nl> <nl> from __future__ import division <nl> from __future__ import print_function <nl> <nl> + import re <nl> + import sys <nl> from google . protobuf import message <nl> from tensorflow . python . platform import tf_logging as logging <nl> from tensorflow . python . util import tf_decorator <nl> <nl> } <nl> <nl> <nl> + # Python 2 vs . 3 differences <nl> + if sys . version_info . major = = 3 : <nl> + _CODE_ATTR = ' __code__ ' <nl> + _CLASS_TO_TYPE = { } <nl> + for t in ( ' property ' , ' object ' , ' getset_descriptor ' , ' int ' , ' str ' , ' type ' , <nl> + ' tuple ' , ' module ' , ' collections . defaultdict ' , ' set ' , ' dict ' , <nl> + ' NoneType ' , ' frozenset ' ) : <nl> + _CLASS_TO_TYPE [ " < class ' % s ' > " % t ] = " < type ' % s ' > " % t <nl> + for e in ' Exception ' , ' RuntimeError ' : <nl> + _CLASS_TO_TYPE [ " < class ' % s ' > " % e ] = " < type ' exceptions . % s ' > " % e <nl> + _NORMALIZE_ISINSTANCE = { <nl> + " < class ' tensorflow . python . training . monitored_session . _MonitoredSession . StepContext ' > " : <nl> + " < class ' tensorflow . python . training . monitored_session . StepContext ' > " , <nl> + " < class ' tensorflow . python . ops . variables . Variable . SaveSliceInfo ' > " : <nl> + " < class ' tensorflow . python . ops . variables . SaveSliceInfo ' > " } <nl> + <nl> + def _normalize_type ( ty ) : <nl> + return _CLASS_TO_TYPE . get ( ty , ty ) <nl> + <nl> + def _normalize_isinstance ( ty ) : <nl> + return _NORMALIZE_ISINSTANCE . get ( ty , ty ) <nl> + <nl> + def _skip_member ( cls , member ) : <nl> + if member = = ' with_traceback ' : <nl> + return True <nl> + if ( cls in ( ' VariableSynchronization ' , ' UnconnectedGradients ' , ' VariableAggregation ' ) and <nl> + member in ( ' name ' , ' value ' ) ) : <nl> + return True <nl> + <nl> + def normalize_proto ( proto ) : <nl> + for kind in ' tf_module ' , ' tf_class ' : <nl> + if proto . HasField ( kind ) : <nl> + for member in getattr ( proto , kind ) . member : <nl> + if member . mtype = = " < class ' abc . ABCMeta ' > " : <nl> + member . mtype = " < type ' type ' > " <nl> + if proto . path = = ' tensorflow . train . NanLossDuringTrainingError ' : <nl> + del proto . tf_class . member [ 1 ] <nl> + else : <nl> + _CODE_ATTR = ' func_code ' <nl> + <nl> + def _normalize_type ( ty ) : <nl> + return ty <nl> + <nl> + def _normalize_isinstance ( ty ) : <nl> + return ty <nl> + <nl> + def _skip_member ( cls , member ) : <nl> + return False <nl> + <nl> + def normalize_proto ( proto ) : <nl> + pass <nl> + <nl> + <nl> def _SanitizedArgSpec ( obj ) : <nl> " " " Get an ArgSpec string that is free of addresses . <nl> <nl> def _SanitizedMRO ( obj ) : <nl> if cls . __name__ = = ' _NewClass ' : <nl> # Ignore class created by @ deprecated_alias decorator . <nl> continue <nl> - str_repr = str ( cls ) <nl> + str_repr = _normalize_type ( str ( cls ) ) <nl> return_list . append ( str_repr ) <nl> if ' tensorflow ' not in str_repr : <nl> break <nl> def __call__ ( self , path , parent , children ) : <nl> def _AddMember ( member_name , member_obj , proto ) : <nl> " " " Add the child object to the object being constructed . " " " <nl> _ , member_obj = tf_decorator . unwrap ( member_obj ) <nl> + if _skip_member ( parent . __name__ , member_name ) : <nl> + return <nl> if member_name = = ' __init__ ' or not member_name . startswith ( ' _ ' ) : <nl> if tf_inspect . isroutine ( member_obj ) : <nl> new_method = proto . member_method . add ( ) <nl> def _AddMember ( member_name , member_obj , proto ) : <nl> # If member_obj is a python builtin , there is no way to get its <nl> # argspec , because it is implemented on the C side . It also has no <nl> # func_code . <nl> - if getattr ( member_obj , ' func_code ' , None ) : <nl> + if hasattr ( member_obj , _CODE_ATTR ) : <nl> new_method . argspec = _SanitizedArgSpec ( member_obj ) <nl> else : <nl> new_member = proto . member . add ( ) <nl> new_member . name = member_name <nl> - new_member . mtype = str ( type ( member_obj ) ) <nl> + new_member . mtype = _normalize_type ( str ( type ( member_obj ) ) ) <nl> <nl> parent_corner_cases = _CORNER_CASES . get ( path , { } ) <nl> <nl> def _AddMember ( member_name , member_obj , proto ) : <nl> elif tf_inspect . isclass ( parent ) : <nl> # Construct a class . <nl> class_obj = api_objects_pb2 . TFAPIClass ( ) <nl> - class_obj . is_instance . extend ( _SanitizedMRO ( parent ) ) <nl> + class_obj . is_instance . extend ( _normalize_isinstance ( i ) for i in _SanitizedMRO ( parent ) ) <nl> for name , child in children : <nl> if name in parent_corner_cases : <nl> # If we have an empty entry , skip this object . <nl> mmm a / tensorflow / tools / api / tests / api_compatibility_test . py <nl> ppp b / tensorflow / tools / api / tests / api_compatibility_test . py <nl> def _ReadFileToProto ( filename ) : <nl> " " " Read a filename , create a protobuf from its contents . " " " <nl> ret_val = api_objects_pb2 . TFAPIObject ( ) <nl> text_format . Merge ( file_io . read_file_to_string ( filename ) , ret_val ) <nl> + python_object_to_proto_visitor . normalize_proto ( ret_val ) <nl> return ret_val <nl> <nl> golden_proto_dict = { <nl> def _ReadFileToProto ( filename ) : <nl> update_goldens = FLAGS . update_goldens , <nl> api_version = api_version ) <nl> <nl> - @ unittest . skipUnless ( <nl> - sys . version_info . major = = 2 , <nl> - ' API compabitility test goldens are generated using python2 . ' ) <nl> def testAPIBackwardsCompatibility ( self ) : <nl> api_version = 1 <nl> golden_file_pattern = os . path . join ( <nl> def testAPIBackwardsCompatibility ( self ) : <nl> # in separate tests . <nl> additional_private_map = { ' tf . compat ' : [ ' v1 ' , ' v2 ' ] } ) <nl> <nl> - @ unittest . skipUnless ( <nl> - sys . version_info . major = = 2 , <nl> - ' API compabitility test goldens are generated using python2 . ' ) <nl> def testAPIBackwardsCompatibilityV1 ( self ) : <nl> api_version = 1 <nl> golden_file_pattern = os . path . join ( <nl> def testAPIBackwardsCompatibilityV1 ( self ) : <nl> self . _checkBackwardsCompatibility ( <nl> tf_v2 . compat . v1 , golden_file_pattern , api_version ) <nl> <nl> - @ unittest . skipUnless ( <nl> - sys . version_info . major = = 2 , <nl> - ' API compabitility test goldens are generated using python2 . ' ) <nl> def testAPIBackwardsCompatibilityV2 ( self ) : <nl> api_version = 2 <nl> golden_file_pattern = os . path . join ( <nl>
|
Make api_compatibility_test pass in Python 3
|
tensorflow/tensorflow
|
6687a0bcd059f8cefca7a669dcfb54b19423f07b
|
2018-10-16T04:35:17Z
|
mmm a / include / osquery / enroll . h <nl> ppp b / include / osquery / enroll . h <nl> <nl> # include < set > <nl> # include < string > <nl> <nl> - # include < boost / property_tree / ptree . hpp > <nl> - <nl> + # include < osquery / core / json . h > <nl> # include < osquery / flags . h > <nl> # include < osquery / registry . h > <nl> <nl> class EnrollPlugin : public Plugin { <nl> virtual std : : string enroll ( ) = 0 ; <nl> <nl> / * * <nl> - * @ brief Populate a property tree with host details . <nl> + * @ brief Populate a JSON object with host details . <nl> * <nl> * This will use kEnrollHostDetails to select from each table and <nl> - * construct a property tree from the results of the first row of each . <nl> - * The input property tree will have a key set for each table . <nl> + * construct a JSON object from the results of the first row of each . <nl> + * The input JSON object will have a key set for each table . <nl> * <nl> - * @ param host_details An output property tree containing each table . <nl> + * @ param host_details An output JSON object containing each table . <nl> * / <nl> - void genHostDetails ( boost : : property_tree : : ptree & host_details ) ; <nl> + void genHostDetails ( JSON & host_details ) ; <nl> } ; <nl> <nl> / * * <nl> mmm a / osquery / carver / carver . cpp <nl> ppp b / osquery / carver / carver . cpp <nl> <nl> # endif <nl> <nl> # include < boost / algorithm / string . hpp > <nl> - # include < boost / property_tree / ptree . hpp > <nl> <nl> # include < osquery / database . h > <nl> # include < osquery / distributed . h > <nl> void updateCarveValue ( const std : : string & guid , <nl> return ; <nl> } <nl> <nl> - pt : : ptree tree ; <nl> - try { <nl> - std : : stringstream ss ( carve ) ; <nl> - pt : : read_json ( ss , tree ) ; <nl> - } catch ( const pt : : ptree_error & e ) { <nl> - VLOG ( 1 ) < < " Failed to parse carve entries : " < < e . what ( ) ; <nl> + JSON tree ; <nl> + s = tree . fromString ( carve ) ; <nl> + if ( ! s . ok ( ) ) { <nl> + VLOG ( 1 ) < < " Failed to parse carve entries : " < < s . what ( ) ; <nl> return ; <nl> } <nl> <nl> - tree . put ( key , value ) ; <nl> + tree . add ( key , value ) ; <nl> + <nl> + std : : string out ; <nl> + s = tree . toString ( out ) ; <nl> + if ( ! s . ok ( ) ) { <nl> + VLOG ( 1 ) < < " Failed to serialize carve entries : " < < s . what ( ) ; <nl> + } <nl> <nl> - std : : ostringstream os ; <nl> - pt : : write_json ( os , tree , false ) ; <nl> - s = setDatabaseValue ( kCarveDbDomain , kCarverDBPrefix + guid , os . str ( ) ) ; <nl> + s = setDatabaseValue ( kCarveDbDomain , kCarverDBPrefix + guid , out ) ; <nl> if ( ! s . ok ( ) ) { <nl> VLOG ( 1 ) < < " Failed to update status of carve in database " < < guid ; <nl> } <nl> Status Carver : : carve ( const boost : : filesystem : : path & path ) { <nl> } ; <nl> <nl> Status Carver : : postCarve ( const boost : : filesystem : : path & path ) { <nl> - auto startRequest = Request < TLSTransport , JSONSerializer > ( startUri_ ) ; <nl> + Request < TLSTransport , JSONSerializer > startRequest ( startUri_ ) ; <nl> startRequest . setOption ( " hostname " , FLAGS_tls_hostname ) ; <nl> <nl> / / Perform the start request to get the session id <nl> Status Carver : : postCarve ( const boost : : filesystem : : path & path ) { <nl> auto blkCount = <nl> static_cast < size_t > ( ceil ( static_cast < double > ( pFile . size ( ) ) / <nl> static_cast < double > ( FLAGS_carver_block_size ) ) ) ; <nl> - pt : : ptree startParams ; <nl> + JSON startParams ; <nl> <nl> - startParams . put < size_t > ( " block_count " , blkCount ) ; <nl> - startParams . put < size_t > ( " block_size " , FLAGS_carver_block_size ) ; <nl> - startParams . put < size_t > ( " carve_size " , pFile . size ( ) ) ; <nl> - startParams . put < std : : string > ( " carve_id " , carveGuid_ ) ; <nl> - startParams . put < std : : string > ( " request_id " , requestId_ ) ; <nl> - startParams . put < std : : string > ( " node_key " , getNodeKey ( " tls " ) ) ; <nl> + startParams . add ( " block_count " , blkCount ) ; <nl> + startParams . add ( " block_size " , size_t ( FLAGS_carver_block_size ) ) ; <nl> + startParams . add ( " carve_size " , pFile . size ( ) ) ; <nl> + startParams . add ( " carve_id " , carveGuid_ ) ; <nl> + startParams . add ( " request_id " , requestId_ ) ; <nl> + startParams . add ( " node_key " , getNodeKey ( " tls " ) ) ; <nl> <nl> auto status = startRequest . call ( startParams ) ; <nl> if ( ! status . ok ( ) ) { <nl> Status Carver : : postCarve ( const boost : : filesystem : : path & path ) { <nl> } <nl> <nl> / / The call succeeded , store the session id for future posts <nl> - boost : : property_tree : : ptree startRecv ; <nl> + JSON startRecv ; <nl> status = startRequest . getResponse ( startRecv ) ; <nl> if ( ! status . ok ( ) ) { <nl> return status ; <nl> } <nl> <nl> - auto session_id = startRecv . get ( " session_id " , " " ) ; <nl> - if ( session_id . empty ( ) ) { <nl> + auto it = startRecv . doc ( ) . FindMember ( " session_id " ) ; <nl> + if ( it = = startRecv . doc ( ) . MemberEnd ( ) ) { <nl> return Status ( 1 , " No session_id received from remote endpoint " ) ; <nl> } <nl> + if ( ! it - > value . IsString ( ) ) { <nl> + return Status ( 1 , " Invalid session_id received from remote endpoint " ) ; <nl> + } <nl> <nl> - auto contRequest = Request < TLSTransport , JSONSerializer > ( contUri_ ) ; <nl> + std : : string session_id = it - > value . GetString ( ) ; <nl> + if ( session_id . empty ( ) ) { <nl> + return Status ( 1 , " Empty session_id received from remote endpoint " ) ; <nl> + } <nl> + <nl> + Request < TLSTransport , JSONSerializer > contRequest ( contUri_ ) ; <nl> contRequest . setOption ( " hostname " , FLAGS_tls_hostname ) ; <nl> for ( size_t i = 0 ; i < blkCount ; i + + ) { <nl> std : : vector < char > block ( FLAGS_carver_block_size , 0 ) ; <nl> Status Carver : : postCarve ( const boost : : filesystem : : path & path ) { <nl> block . resize ( r ) ; <nl> } <nl> <nl> - pt : : ptree params ; <nl> - params . put < size_t > ( " block_id " , i ) ; <nl> - params . put < std : : string > ( " session_id " , session_id ) ; <nl> - params . put < std : : string > ( " request_id " , requestId_ ) ; <nl> - params . put < std : : string > ( <nl> - " data " , base64Encode ( std : : string ( block . begin ( ) , block . end ( ) ) ) ) ; <nl> + JSON params ; <nl> + params . add ( " block_id " , i ) ; <nl> + params . add ( " session_id " , session_id ) ; <nl> + params . add ( " request_id " , requestId_ ) ; <nl> + params . add ( " data " , base64Encode ( std : : string ( block . begin ( ) , block . end ( ) ) ) ) ; <nl> <nl> / / TODO : Error sending files . <nl> status = contRequest . call ( params ) ; <nl> Status Carver : : postCarve ( const boost : : filesystem : : path & path ) { <nl> } ; <nl> <nl> Status carvePaths ( const std : : set < std : : string > & paths ) { <nl> + Status s ; <nl> auto guid = generateNewUUID ( ) ; <nl> <nl> - pt : : ptree tree ; <nl> - tree . put ( " carve_guid " , guid ) ; <nl> - tree . put ( " time " , getUnixTime ( ) ) ; <nl> - tree . put ( " status " , " STARTING " ) ; <nl> - tree . put ( " sha256 " , " " ) ; <nl> - tree . put ( " size " , - 1 ) ; <nl> + JSON tree ; <nl> + tree . add ( " carve_guid " , guid ) ; <nl> + tree . add ( " time " , getUnixTime ( ) ) ; <nl> + tree . add ( " status " , " STARTING " ) ; <nl> + tree . add ( " sha256 " , " " ) ; <nl> + tree . add ( " size " , - 1 ) ; <nl> <nl> if ( paths . size ( ) > 1 ) { <nl> - tree . put ( " path " , boost : : algorithm : : join ( paths , " , " ) ) ; <nl> + tree . add ( " path " , boost : : algorithm : : join ( paths , " , " ) ) ; <nl> } else { <nl> - tree . put ( " path " , * ( paths . begin ( ) ) ) ; <nl> + tree . add ( " path " , * ( paths . begin ( ) ) ) ; <nl> + } <nl> + <nl> + std : : string out ; <nl> + s = tree . toString ( out ) ; <nl> + if ( ! s . ok ( ) ) { <nl> + VLOG ( 1 ) < < " Failed to serialize carve paths : " < < s . what ( ) ; <nl> + return s ; <nl> } <nl> <nl> - std : : ostringstream os ; <nl> - pt : : write_json ( os , tree , false ) ; <nl> - auto s = setDatabaseValue ( kCarveDbDomain , kCarverDBPrefix + guid , os . str ( ) ) ; <nl> + s = setDatabaseValue ( kCarveDbDomain , kCarverDBPrefix + guid , out ) ; <nl> if ( ! s . ok ( ) ) { <nl> return s ; <nl> } else { <nl> mmm a / osquery / config / plugins / tests / tls_config_tests . cpp <nl> ppp b / osquery / config / plugins / tests / tls_config_tests . cpp <nl> TEST_F ( TLSConfigTests , test_retrieve_config ) { <nl> Config c ; <nl> c . load ( ) ; <nl> <nl> - EXPECT_EQ ( " d9b4a05d914c81a1ed4ce129928e2d9a0309c753 " , <nl> + EXPECT_EQ ( " 6f1980704cb3fd0c902a8a1107f65c59016c5dd2 " , <nl> c . getHash ( " tls_plugin " ) ) ; <nl> <nl> / / Configure the plugin to use the node API . <nl> TEST_F ( TLSConfigTests , test_setup ) { <nl> ASSERT_TRUE ( status . ok ( ) ) ; <nl> <nl> / / Verify that the setup call resulted in no remote requests . <nl> - pt : : ptree response_tree ; <nl> + JSON response_tree ; <nl> std : : string test_read_uri = <nl> " https : / / " + Flag : : getValue ( " tls_hostname " ) + " / test_read_requests " ; <nl> <nl> - auto request = Request < TLSTransport , JSONSerializer > ( test_read_uri ) ; <nl> + Request < TLSTransport , JSONSerializer > request ( test_read_uri ) ; <nl> request . setOption ( " hostname " , Flag : : getValue ( " tls_hostname " ) ) ; <nl> <nl> - status = request . call ( pt : : ptree ( ) ) ; <nl> + status = request . call ( JSON ( ) ) ; <nl> ASSERT_TRUE ( status . ok ( ) ) ; <nl> <nl> status = request . getResponse ( response_tree ) ; <nl> TEST_F ( TLSConfigTests , test_setup ) { <nl> <nl> / / TLSConfigPlugin should * not * have sent an enroll or any other TLS request <nl> / / It should have used the cached - key <nl> - EXPECT_EQ ( response_tree . size ( ) , 0UL ) ; <nl> + EXPECT_EQ ( response_tree . doc ( ) . Size ( ) , 0UL ) ; <nl> <nl> status = getDatabaseValue ( kPersistentSettings , " nodeKey " , db_value ) ; <nl> ASSERT_TRUE ( status . ok ( ) ) ; <nl> TEST_F ( TLSConfigTests , test_setup ) { <nl> EXPECT_STRNE ( db_value . c_str ( ) , " CachedKey " ) ; <nl> <nl> / / Make sure TLSConfigPlugin called enroll <nl> - status = request . call ( pt : : ptree ( ) ) ; <nl> + status = request . call ( JSON ( ) ) ; <nl> ASSERT_TRUE ( status . ok ( ) ) ; <nl> <nl> status = request . getResponse ( response_tree ) ; <nl> ASSERT_TRUE ( status . ok ( ) ) ; <nl> <nl> / / There should only be one command that should have been posted - an enroll <nl> - EXPECT_EQ ( response_tree . size ( ) , 1UL ) ; <nl> + EXPECT_EQ ( response_tree . doc ( ) . Size ( ) , 1UL ) ; <nl> + <nl> + auto const & obj = response_tree . doc ( ) [ 0 ] ; <nl> + ASSERT_TRUE ( obj . IsObject ( ) ) ; <nl> + <nl> + ASSERT_TRUE ( obj . HasMember ( " command " ) ) ; <nl> + ASSERT_TRUE ( obj [ " command " ] . IsString ( ) ) ; <nl> <nl> / / Verify that it is indeed Enroll <nl> - db_value = response_tree . get < std : : string > ( " . command " ) ; <nl> + db_value = obj [ " command " ] . GetString ( ) ; <nl> EXPECT_STREQ ( db_value . c_str ( ) , " enroll " ) ; <nl> } <nl> } <nl> mmm a / osquery / config / plugins / tls_config . cpp <nl> ppp b / osquery / config / plugins / tls_config . cpp <nl> <nl> # include < sstream > <nl> # include < vector > <nl> <nl> - # include < boost / property_tree / ptree . hpp > <nl> - <nl> # include < osquery / config . h > <nl> # include < osquery / dispatcher . h > <nl> # include < osquery / enroll . h > <nl> Status TLSConfigPlugin : : setUp ( ) { <nl> <nl> Status TLSConfigPlugin : : genConfig ( std : : map < std : : string , std : : string > & config ) { <nl> std : : string json ; <nl> - pt : : ptree params ; <nl> + JSON params ; <nl> if ( FLAGS_tls_node_api ) { <nl> / / The TLS node API morphs some verbs and variables . <nl> - params . put ( " _get " , true ) ; <nl> + params . add ( " _get " , true ) ; <nl> } <nl> <nl> auto s = TLSRequestHelper : : go < JSONSerializer > ( <nl> Status TLSConfigPlugin : : genConfig ( std : : map < std : : string , std : : string > & config ) { <nl> if ( s . ok ( ) ) { <nl> if ( FLAGS_tls_node_api ) { <nl> / / The node API embeds configuration data ( JSON escaped ) . <nl> - pt : : ptree tree ; <nl> - try { <nl> - std : : stringstream input ; <nl> - input < < json ; <nl> - pt : : read_json ( input , tree ) ; <nl> - } catch ( const pt : : json_parser : : json_parser_error & / * e * / ) { <nl> + <nl> + JSON tree ; <nl> + Status parse_status = tree . fromString ( json ) ; <nl> + if ( ! parse_status . ok ( ) ) { <nl> VLOG ( 1 ) < < " Could not parse JSON from TLS node API " ; <nl> } <nl> <nl> / / Re - encode the config key into JSON . <nl> - config [ " tls_plugin " ] = unescapeUnicode ( tree . get ( " config " , " " ) ) ; <nl> + auto it = tree . doc ( ) . FindMember ( " config " ) ; <nl> + config [ " tls_plugin " ] = <nl> + unescapeUnicode ( it ! = tree . doc ( ) . MemberEnd ( ) & & it - > value . IsString ( ) <nl> + ? it - > value . GetString ( ) <nl> + : " " ) ; <nl> } else { <nl> config [ " tls_plugin " ] = json ; <nl> } <nl> mmm a / osquery / core / conversions . cpp <nl> ppp b / osquery / core / conversions . cpp <nl> void JSON : : pushCopy ( const std : : string & value , rj : : Value & arr ) { <nl> arr . PushBack ( sc . Move ( ) , doc_ . GetAllocator ( ) ) ; <nl> } <nl> <nl> - void JSON : : add ( const std : : string & key , rj : : Value & value ) { <nl> + void JSON : : add ( const std : : string & key , const rj : : Value & value ) { <nl> add ( key , value , doc ( ) ) ; <nl> } <nl> <nl> - void JSON : : add ( const std : : string & key , rj : : Value & value , rj : : Value & obj ) { <nl> + void JSON : : add ( const std : : string & key , const rj : : Value & value , rj : : Value & obj ) { <nl> assert ( obj . IsObject ( ) ) ; <nl> auto itr = obj . FindMember ( key ) ; <nl> if ( itr ! = obj . MemberEnd ( ) ) { <nl> void JSON : : addRef ( const std : : string & key , const std : : string & value ) { <nl> addRef ( key , value , doc ( ) ) ; <nl> } <nl> <nl> + void JSON : : add ( const std : : string & key , const std : : string & value ) { <nl> + addCopy ( key , value ) ; <nl> + } <nl> + <nl> + void JSON : : add ( const std : : string & key , <nl> + const std : : string & value , <nl> + rj : : Value & obj ) { <nl> + addCopy ( key , value , obj ) ; <nl> + } <nl> + <nl> + void JSON : : add ( const std : : string & key , const char * value , rj : : Value & obj ) { <nl> + assert ( obj . IsObject ( ) ) ; <nl> + auto itr = obj . FindMember ( key ) ; <nl> + if ( itr ! = obj . MemberEnd ( ) ) { <nl> + obj . RemoveMember ( itr ) ; <nl> + } <nl> + <nl> + obj . AddMember ( rj : : Value ( rj : : StringRef ( key ) , doc_ . GetAllocator ( ) ) . Move ( ) , <nl> + rj : : Value ( value , strlen ( value ) ) . Move ( ) , <nl> + doc_ . GetAllocator ( ) ) ; <nl> + } <nl> + void JSON : : add ( const std : : string & key , const char * value ) { <nl> + add ( key , value , doc ( ) ) ; <nl> + } <nl> + <nl> void JSON : : add ( const std : : string & key , size_t value , rj : : Value & obj ) { <nl> assert ( obj . IsObject ( ) ) ; <nl> auto itr = obj . FindMember ( key ) ; <nl> void JSON : : add ( const std : : string & key , int value ) { <nl> add ( key , value , doc ( ) ) ; <nl> } <nl> <nl> + void JSON : : add ( const std : : string & key , bool value , rj : : Value & obj ) { <nl> + assert ( obj . IsObject ( ) ) ; <nl> + auto itr = obj . FindMember ( key ) ; <nl> + if ( itr ! = obj . MemberEnd ( ) ) { <nl> + obj . RemoveMember ( itr ) ; <nl> + } <nl> + <nl> + obj . AddMember ( rj : : Value ( rj : : StringRef ( key ) , doc_ . GetAllocator ( ) ) . Move ( ) , <nl> + rj : : Value ( value ) . Move ( ) , <nl> + doc_ . GetAllocator ( ) ) ; <nl> + } <nl> + <nl> + void JSON : : add ( const std : : string & key , bool value ) { <nl> + add ( key , value , doc ( ) ) ; <nl> + } <nl> + <nl> Status JSON : : toString ( std : : string & str ) const { <nl> rj : : StringBuffer sb ; <nl> rj : : Writer < rj : : StringBuffer > writer ( sb ) ; <nl> void JSON : : mergeArray ( rj : : Value & target_arr , rj : : Value & source_arr ) { <nl> } <nl> } <nl> <nl> - JSON JSON : : newFromValue ( const rapidjson : : Value & value ) { <nl> + JSON JSON : : newFromValue ( const rj : : Value & value ) { <nl> assert ( value . IsObject ( ) | | value . IsArray ( ) ) ; <nl> <nl> JSON doc ; <nl> void JSON : : copyFrom ( const rapidjson : : Value & value , rj : : Value & target ) { <nl> target . CopyFrom ( value , doc ( ) . GetAllocator ( ) ) ; <nl> } <nl> <nl> + void JSON : : copyFrom ( const rj : : Value & value ) { <nl> + copyFrom ( value , doc ( ) ) ; <nl> + } <nl> + <nl> rj : : Document & JSON : : doc ( ) { <nl> return doc_ ; <nl> } <nl> mmm a / osquery / core / json . h <nl> ppp b / osquery / core / json . h <nl> <nl> # pragma once <nl> <nl> # include < osquery / core . h > <nl> + / / Make sure system is included to work around the GetObject problem on Windows <nl> + # include < osquery / system . h > <nl> <nl> # ifdef WIN32 <nl> # pragma warning ( push , 3 ) <nl> class JSON : private only_movable { <nl> / * * <nl> * @ brief Add a string value to a JSON object by copying the contents . <nl> * <nl> - * This will add the key and value to an input document . <nl> + * This will add the key and value to an input document . If the key exists <nl> + * the value will be replaced . <nl> * The input document must be an object type . <nl> * / <nl> void addCopy ( const std : : string & key , <nl> class JSON : private only_movable { <nl> / * * <nl> * @ brief Add a string value to a JSON object by copying the contents . <nl> * <nl> - * This will add the key and value to the JSON document . <nl> + * This will add the key and value to the JSON document . If the key exists <nl> + * the value will be replaced . <nl> * The document must be an object type . <nl> * / <nl> void addCopy ( const std : : string & key , const std : : string & value ) ; <nl> class JSON : private only_movable { <nl> * <nl> * The string value must live longer than the document ' s use . <nl> * <nl> - * This will add the key and value to an input document . <nl> + * This will add the key and value to an input document . If the key exists <nl> + * the value will be replaced . <nl> * The input document must be an object type . <nl> * / <nl> void addRef ( const std : : string & key , <nl> class JSON : private only_movable { <nl> * <nl> * The string value must live longer than the document ' s use . <nl> * <nl> - * This will add the key and value to the JSON document . <nl> + * This will add the key and value to the JSON document . If the key exists <nl> + * the value will be replaced . <nl> * The input document must be an object type . <nl> * / <nl> void addRef ( const std : : string & key , const std : : string & value ) ; <nl> <nl> + / * * <nl> + * @ brief Add a string value to a JSON object by copying the contents . <nl> + * <nl> + * This is basically and alias for addCopy ( ) <nl> + * <nl> + * This will add the key and value to an input document . If the key exists <nl> + * the value will be replaced . <nl> + * The input document must be an object type . <nl> + * / <nl> + void add ( const std : : string & key , <nl> + const std : : string & value , <nl> + rapidjson : : Value & obj ) ; <nl> + <nl> + / * * <nl> + * @ brief Add a string value to a JSON object by copying the contents . <nl> + * <nl> + * This is basically and alias for addCopy ( ) . <nl> + * <nl> + * This will add the key and value to the JSON document . If the key exists <nl> + * the value will be replaced . <nl> + * The document must be an object type . <nl> + * / <nl> + void add ( const std : : string & key , const std : : string & value ) ; <nl> + <nl> + / * * <nl> + * @ brief Add a char * value to a JSON object by copying the contents . <nl> + * <nl> + * This will add the key and value to an input document . If the key exists <nl> + * the value will be replaced . <nl> + * The input document must be an object type . <nl> + * / <nl> + void add ( const std : : string & key , const char * value , rapidjson : : Value & obj ) ; <nl> + <nl> + / * * <nl> + * @ brief Add a char * value to a JSON object by copying the contents . <nl> + * <nl> + * This will add the key and value to the JSON document . If the key exists <nl> + * the value will be replaced . <nl> + * The document must be an object type . <nl> + * / <nl> + void add ( const std : : string & key , const char * value ) ; <nl> + <nl> / * * <nl> * @ brief Add a size_t value to a JSON object by copying the contents . <nl> * <nl> - * This will add the key and value to an input document . <nl> + * This will add the key and value to an input document . If the key exists <nl> + * the value will be replaced . <nl> * The input document must be an object type . <nl> * / <nl> void add ( const std : : string & key , size_t value , rapidjson : : Value & obj ) ; <nl> class JSON : private only_movable { <nl> / * * <nl> * @ brief Add a size_t value to a JSON object by copying the contents . <nl> * <nl> - * This will add the key and value to the JSON document . <nl> + * This will add the key and value to the JSON document . If the key exists <nl> + * the value will be replaced . <nl> * The document must be an object type . <nl> * / <nl> void add ( const std : : string & key , size_t value ) ; <nl> class JSON : private only_movable { <nl> / * * <nl> * @ brief Add an int value to a JSON object by copying the contents . <nl> * <nl> - * This will add the key and value to an input document . <nl> + * This will add the key and value to an input document . If the key exists <nl> + * the value will be replaced . <nl> * The input document must be an object type . <nl> * / <nl> void add ( const std : : string & key , int value , rapidjson : : Value & obj ) ; <nl> class JSON : private only_movable { <nl> / * * <nl> * @ brief Add an int value to a JSON object by copying the contents . <nl> * <nl> - * This will add the key and value to the JSON document . <nl> + * This will add the key and value to the JSON document . If the key exists <nl> + * the value will be replaced . <nl> * The document must be an object type . <nl> * / <nl> void add ( const std : : string & key , int value ) ; <nl> <nl> + / * * <nl> + * @ brief Add a bool value to a JSON object by copying the contents . <nl> + * <nl> + * This will add the key and value to an input document . If the key exists <nl> + * the value will be replaced . <nl> + * The input document must be an object type . <nl> + * / <nl> + void add ( const std : : string & key , bool value , rapidjson : : Value & obj ) ; <nl> + <nl> + / * * <nl> + * @ brief Add a bool value to a JSON object by copying the contents . <nl> + * <nl> + * This will add the key and value to the JSON document . If the key exists <nl> + * the value will be replaced . <nl> + * The document must be an object type . <nl> + * / <nl> + void add ( const std : : string & key , bool value ) ; <nl> + <nl> / / / Add a JSON document as a member . <nl> - void add ( const std : : string & key , rapidjson : : Value & value ) ; <nl> + void add ( const std : : string & key , const rapidjson : : Value & value ) ; <nl> <nl> / / / Add a JSON document as a member of another document . <nl> void add ( const std : : string & key , <nl> - rapidjson : : Value & value , <nl> + const rapidjson : : Value & value , <nl> rapidjson : : Value & obj ) ; <nl> <nl> / * * <nl> class JSON : private only_movable { <nl> * / <nl> void copyFrom ( const rapidjson : : Value & value , rapidjson : : Value & target ) ; <nl> <nl> + / * * <nl> + * @ brief Copy a JSON object / array into the document . <nl> + * <nl> + * The type of the base document may change , be careful . <nl> + * / <nl> + void copyFrom ( const rapidjson : : Value & value ) ; <nl> + <nl> / / / Convert this document to a JSON string . <nl> Status toString ( std : : string & str ) const ; <nl> <nl> mmm a / osquery / distributed / plugins / tls_distributed . cpp <nl> ppp b / osquery / distributed / plugins / tls_distributed . cpp <nl> <nl> # include < vector > <nl> # include < sstream > <nl> <nl> - # include < boost / property_tree / ptree . hpp > <nl> - <nl> # include < osquery / distributed . h > <nl> # include < osquery / enroll . h > <nl> # include < osquery / flags . h > <nl> Status TLSDistributedPlugin : : setUp ( ) { <nl> } <nl> <nl> Status TLSDistributedPlugin : : getQueries ( std : : string & json ) { <nl> - pt : : ptree params ; <nl> - params . put ( " _verb " , " POST " ) ; <nl> + JSON params ; <nl> + params . add ( " _verb " , " POST " ) ; <nl> return TLSRequestHelper : : go < JSONSerializer > ( <nl> read_uri_ , params , json , FLAGS_distributed_tls_max_attempts ) ; <nl> } <nl> <nl> Status TLSDistributedPlugin : : writeResults ( const std : : string & json ) { <nl> - pt : : ptree params ; <nl> - try { <nl> - std : : stringstream ss ( json ) ; <nl> - pt : : read_json ( ss , params ) ; <nl> - } catch ( const pt : : ptree_error & e ) { <nl> - return Status ( 1 , " Error parsing JSON : " + std : : string ( e . what ( ) ) ) ; <nl> + JSON params ; <nl> + Status s = params . fromString ( json ) ; <nl> + <nl> + if ( ! s . ok ( ) ) { <nl> + return s ; <nl> } <nl> <nl> / / The response is ignored . <nl> mmm a / osquery / distributed / tests / distributed_tests . cpp <nl> ppp b / osquery / distributed / tests / distributed_tests . cpp <nl> <nl> # include " osquery / tests / test_additional_util . h " <nl> # include " osquery / tests / test_util . h " <nl> <nl> - # include < rapidjson / prettywriter . h > <nl> - <nl> - / / distributed . cpp for why this is undefed <nl> - # undef GetObject <nl> - <nl> namespace pt = boost : : property_tree ; <nl> <nl> DECLARE_string ( distributed_tls_read_endpoint ) ; <nl> mmm a / osquery / logger / plugins / tls_logger . cpp <nl> ppp b / osquery / logger / plugins / tls_logger . cpp <nl> <nl> * You may select , at your option , one of the above - listed licenses . <nl> * / <nl> <nl> - # include < boost / property_tree / ptree . hpp > <nl> - <nl> # include < osquery / enroll . h > <nl> # include < osquery / flags . h > <nl> # include < osquery / registry . h > <nl> void TLSLoggerPlugin : : init ( const std : : string & name , <nl> <nl> Status TLSLogForwarder : : send ( std : : vector < std : : string > & log_data , <nl> const std : : string & log_type ) { <nl> - pt : : ptree params ; <nl> - params . put < std : : string > ( " node_key " , getNodeKey ( " tls " ) ) ; <nl> - params . put < std : : string > ( " log_type " , log_type ) ; <nl> + JSON params ; <nl> + params . add ( " node_key " , getNodeKey ( " tls " ) ) ; <nl> + params . add ( " log_type " , log_type ) ; <nl> <nl> { <nl> / / Read each logged line into JSON and populate a list of lines . <nl> / / The result list will use the ' data ' key . <nl> - pt : : ptree children ; <nl> - iterate ( log_data , ( [ & children ] ( std : : string & item ) { <nl> + auto children = params . newArray ( ) ; <nl> + iterate ( log_data , ( [ & params , & children ] ( std : : string & item ) { <nl> / / Enforce a max log line size for TLS logging . <nl> if ( item . size ( ) > FLAGS_logger_tls_max ) { <nl> LOG ( WARNING ) < < " Line exceeds TLS logger max : " < < item . size ( ) ; <nl> return ; <nl> } <nl> <nl> - pt : : ptree child ; <nl> - try { <nl> - std : : stringstream input ; <nl> - input < < item ; <nl> - std : : string ( ) . swap ( item ) ; <nl> - pt : : read_json ( input , child ) ; <nl> - } catch ( const pt : : json_parser : : json_parser_error & / * e * / ) { <nl> + JSON child ; <nl> + Status s = child . fromString ( item ) ; <nl> + if ( ! s . ok ( ) ) { <nl> / / The log line entered was not valid JSON , skip it . <nl> return ; <nl> } <nl> - children . push_back ( std : : make_pair ( " " , std : : move ( child ) ) ) ; <nl> + std : : string ( ) . swap ( item ) ; <nl> + params . push ( child . doc ( ) , children . doc ( ) ) ; <nl> } ) ) ; <nl> - params . add_child ( " data " , std : : move ( children ) ) ; <nl> + params . add ( " data " , children . doc ( ) ) ; <nl> } <nl> <nl> / / The response body is ignored ( status is set appropriately by <nl> / / TLSRequestHelper : : go ( ) ) <nl> std : : string response ; <nl> if ( FLAGS_logger_tls_compress ) { <nl> - params . put ( " _compress " , true ) ; <nl> + params . add ( " _compress " , true ) ; <nl> } <nl> return TLSRequestHelper : : go < JSONSerializer > ( uri_ , params , response ) ; <nl> } <nl> mmm a / osquery / remote / enroll / enroll . cpp <nl> ppp b / osquery / remote / enroll / enroll . cpp <nl> <nl> * / <nl> <nl> # include < boost / algorithm / string / trim . hpp > <nl> - # include < boost / property_tree / ptree . hpp > <nl> <nl> # include < osquery / core . h > <nl> # include < osquery / database . h > <nl> const std : : string getEnrollSecret ( ) { <nl> return enrollment_secret ; <nl> } <nl> <nl> - void EnrollPlugin : : genHostDetails ( pt : : ptree & host_details ) { <nl> + void EnrollPlugin : : genHostDetails ( JSON & host_details ) { <nl> / / Select from each table describing host details . <nl> for ( const auto & table : kEnrollHostDetails ) { <nl> auto results = SQL : : selectAllFrom ( table ) ; <nl> if ( ! results . empty ( ) ) { <nl> - pt : : ptree details ; <nl> + JSON details ; <nl> for ( const auto & detail : results [ 0 ] ) { <nl> - details . put < std : : string > ( detail . first , detail . second ) ; <nl> + details . add ( detail . first , detail . second ) ; <nl> } <nl> - host_details . put_child ( table , details ) ; <nl> + host_details . add ( table , details . doc ( ) ) ; <nl> } <nl> } <nl> } <nl> mmm a / osquery / remote / enroll / plugins / tests / tls_enroll_tests . cpp <nl> ppp b / osquery / remote / enroll / plugins / tests / tls_enroll_tests . cpp <nl> <nl> <nl> # include < vector > <nl> <nl> - # include < boost / property_tree / ptree . hpp > <nl> - <nl> # include < osquery / config . h > <nl> # include < osquery / database . h > <nl> # include < osquery / flags . h > <nl> class TLSEnrollTests : public testing : : Test { <nl> void SetUp ( ) override ; <nl> void TearDown ( ) override ; <nl> <nl> - Status testReadRequests ( pt : : ptree & response_tree ) ; <nl> + Status testReadRequests ( JSON & response_tree ) ; <nl> <nl> private : <nl> std : : string test_read_uri_ ; <nl> void TLSEnrollTests : : TearDown ( ) { <nl> TLSServerRunner : : stop ( ) ; <nl> } <nl> <nl> - Status TLSEnrollTests : : testReadRequests ( pt : : ptree & response_tree ) { <nl> - auto request_ = Request < TLSTransport , JSONSerializer > ( test_read_uri_ ) ; <nl> + Status TLSEnrollTests : : testReadRequests ( JSON & response_tree ) { <nl> + Request < TLSTransport , JSONSerializer > request_ ( test_read_uri_ ) ; <nl> request_ . setOption ( " hostname " , Flag : : getValue ( " tls_hostname " ) ) ; <nl> - auto status = request_ . call ( pt : : ptree ( ) ) ; <nl> + auto status = request_ . call ( JSON ( ) ) ; <nl> if ( status . ok ( ) ) { <nl> status = request_ . getResponse ( response_tree ) ; <nl> } <nl> Status TLSEnrollTests : : testReadRequests ( pt : : ptree & response_tree ) { <nl> TEST_F ( TLSEnrollTests , test_tls_enroll ) { <nl> auto node_key = getNodeKey ( " tls " ) ; <nl> <nl> - pt : : ptree response ; <nl> + JSON response ; <nl> + std : : string value ; <nl> + <nl> auto status = testReadRequests ( response ) ; <nl> EXPECT_TRUE ( status . ok ( ) ) ; <nl> - EXPECT_EQ ( response . size ( ) , 1U ) ; <nl> + EXPECT_EQ ( response . doc ( ) . Size ( ) , 1U ) ; <nl> <nl> - auto value = response . get < std : : string > ( " . command " ) ; <nl> + auto const & obj = response . doc ( ) [ 0 ] ; <nl> + EXPECT_TRUE ( obj . IsObject ( ) ) ; <nl> + EXPECT_TRUE ( obj . HasMember ( " command " ) ) ; <nl> + EXPECT_TRUE ( obj [ " command " ] . IsString ( ) ) ; <nl> + value = obj [ " command " ] . GetString ( ) ; <nl> EXPECT_EQ ( value , " enroll " ) ; <nl> <nl> - value = response . get < std : : string > ( " . host_identifier " ) ; <nl> + EXPECT_TRUE ( obj . HasMember ( " host_identifier " ) ) ; <nl> + EXPECT_TRUE ( obj [ " host_identifier " ] . IsString ( ) ) ; <nl> + value = obj [ " host_identifier " ] . GetString ( ) ; <nl> EXPECT_EQ ( value , getHostIdentifier ( ) ) ; <nl> <nl> / / Check that osquery_info exists in the host_details . <nl> TEST_F ( TLSEnrollTests , test_tls_enroll ) { <nl> ASSERT_EQ ( osquery_info . size ( ) , 1U ) ; <nl> ASSERT_EQ ( osquery_info [ 0 ] . count ( " uuid " ) , 1U ) ; <nl> <nl> - value = response . get < std : : string > ( " . host_details . osquery_info . uuid " ) ; <nl> + EXPECT_TRUE ( obj . HasMember ( " host_details " ) ) ; <nl> + EXPECT_TRUE ( obj [ " host_details " ] . HasMember ( " osquery_info " ) ) ; <nl> + EXPECT_TRUE ( obj [ " host_details " ] [ " osquery_info " ] . HasMember ( " uuid " ) ) ; <nl> + <nl> + EXPECT_TRUE ( obj [ " host_details " ] [ " osquery_info " ] [ " uuid " ] . IsString ( ) ) ; <nl> + value = obj [ " host_details " ] [ " osquery_info " ] [ " uuid " ] . GetString ( ) ; <nl> EXPECT_EQ ( osquery_info [ 0 ] [ " uuid " ] , value ) ; <nl> } <nl> } <nl> mmm a / osquery / remote / enroll / plugins / tls_enroll . cpp <nl> ppp b / osquery / remote / enroll / plugins / tls_enroll . cpp <nl> <nl> * You may select , at your option , one of the above - listed licenses . <nl> * / <nl> <nl> - # include < boost / property_tree / ptree . hpp > <nl> - <nl> # include < osquery / enroll . h > <nl> # include < osquery / flags . h > <nl> # include < osquery / logger . h > <nl> <nl> <nl> # include " osquery / remote / enroll / plugins / tls_enroll . h " <nl> <nl> - namespace pt = boost : : property_tree ; <nl> - <nl> namespace osquery { <nl> <nl> DECLARE_string ( enroll_secret_path ) ; <nl> std : : string TLSEnrollPlugin : : enroll ( ) { <nl> Status TLSEnrollPlugin : : requestKey ( const std : : string & uri , <nl> std : : string & node_key ) { <nl> / / Read the optional enrollment secret data ( sent with an enrollment request ) . <nl> - pt : : ptree params ; <nl> - params . put < std : : string > ( FLAGS_tls_enroll_override , getEnrollSecret ( ) ) ; <nl> - params . put < std : : string > ( " host_identifier " , getHostIdentifier ( ) ) ; <nl> - params . put < std : : string > ( " platform_type " , <nl> + JSON params ; <nl> + params . add ( FLAGS_tls_enroll_override , getEnrollSecret ( ) ) ; <nl> + params . add ( " host_identifier " , getHostIdentifier ( ) ) ; <nl> + params . add ( <nl> + " platform_type " , <nl> boost : : lexical_cast < std : : string > ( static_cast < uint64_t > ( kPlatformType ) ) ) ; <nl> <nl> / / Select from each table describing host details . <nl> - pt : : ptree host_details ; <nl> + JSON host_details ; <nl> genHostDetails ( host_details ) ; <nl> - params . put_child ( " host_details " , host_details ) ; <nl> + params . add ( " host_details " , host_details . doc ( ) ) ; <nl> <nl> - auto request = Request < TLSTransport , JSONSerializer > ( uri ) ; <nl> + Request < TLSTransport , JSONSerializer > request ( uri ) ; <nl> request . setOption ( " hostname " , FLAGS_tls_hostname ) ; <nl> auto status = request . call ( params ) ; <nl> if ( ! status . ok ( ) ) { <nl> Status TLSEnrollPlugin : : requestKey ( const std : : string & uri , <nl> } <nl> <nl> / / The call succeeded , store the node secret key ( the enrollment response ) . <nl> - boost : : property_tree : : ptree recv ; <nl> + JSON recv ; <nl> status = request . getResponse ( recv ) ; <nl> if ( ! status . ok ( ) ) { <nl> return status ; <nl> } <nl> <nl> / / Support multiple response keys as a node key ( identifier ) . <nl> - if ( recv . count ( " node_key " ) > 0 ) { <nl> - node_key = recv . get ( " node_key " , " " ) ; <nl> - } else if ( recv . count ( " id " ) > 0 ) { <nl> - node_key = recv . get ( " id " , " " ) ; <nl> + auto it = recv . doc ( ) . FindMember ( " node_key " ) ; <nl> + if ( it = = recv . doc ( ) . MemberEnd ( ) ) { <nl> + it = recv . doc ( ) . FindMember ( " id " ) ; <nl> + } <nl> + <nl> + if ( it ! = recv . doc ( ) . MemberEnd ( ) ) { <nl> + node_key = it - > value . IsString ( ) ? it - > value . GetString ( ) : " " ; <nl> } <nl> <nl> if ( node_key . empty ( ) ) { <nl> mmm a / osquery / remote / requests . h <nl> ppp b / osquery / remote / requests . h <nl> <nl> # include < utility > <nl> # include < string > <nl> <nl> - # include < boost / property_tree / ptree . hpp > <nl> - <nl> # include < osquery / logger . h > <nl> # include < osquery / status . h > <nl> <nl> class Transport { <nl> * <nl> * @ return The parameters <nl> * / <nl> - const boost : : property_tree : : ptree & getResponseParams ( ) const { <nl> + const JSON & getResponseParams ( ) const { <nl> return response_params_ ; <nl> } <nl> <nl> template < typename T > <nl> void setOption ( const std : : string & name , const T & value ) { <nl> - options_ . put ( name , value ) ; <nl> + options_ . add ( name , value ) ; <nl> } <nl> <nl> / * * <nl> class Transport { <nl> Status response_status_ ; <nl> <nl> / / / storage for response parameters <nl> - boost : : property_tree : : ptree response_params_ ; <nl> + JSON response_params_ ; <nl> <nl> / / / options from request call ( use defined by specific transport ) <nl> - boost : : property_tree : : ptree options_ ; <nl> + JSON options_ ; <nl> } ; <nl> <nl> / * * <nl> class Serializer { <nl> virtual std : : string getContentType ( ) const = 0 ; <nl> <nl> / * * <nl> - * @ brief Serialize a property tree into a string <nl> + * @ brief Serialize a JSON object into a string <nl> * <nl> - * @ param params A property tree of parameters <nl> - * @ param serialized the output serialized params <nl> + * @ param params a JSON object to be serialized <nl> + * @ param serialized the output serialized string <nl> * @ return success or failure of the operation <nl> * / <nl> - virtual Status serialize ( const boost : : property_tree : : ptree & params , <nl> - std : : string & serialized ) = 0 ; <nl> + virtual Status serialize ( const JSON & json , std : : string & serialized ) = 0 ; <nl> <nl> / * * <nl> - * @ brief Deserialize a property tree into a property tree <nl> + * @ brief Deserialize a JSON string into a JSON object <nl> * <nl> - * @ param params A string of serialized parameters <nl> - * @ param serialized the output deserialized parameters <nl> + * @ param params a string of JSON <nl> + * @ param serialized the deserialized JSON object <nl> * @ return success or failure of the operation <nl> * / <nl> - virtual Status deserialize ( const std : : string & serialized , <nl> - boost : : property_tree : : ptree & params ) = 0 ; <nl> + virtual Status deserialize ( const std : : string & serialized , JSON & params ) = 0 ; <nl> <nl> / * * <nl> * @ brief Virtual destructor <nl> class Request { <nl> / * * <nl> * @ brief Send a simple request to the destination with parameters <nl> * <nl> - * @ param params A property tree representing the parameters <nl> + * @ param params a JSON object representing the parameters <nl> * <nl> * @ return success or failure of the operation <nl> * / <nl> - Status call ( const boost : : property_tree : : ptree & params ) { <nl> + Status call ( const JSON & params ) { <nl> std : : string serialized ; <nl> auto s = serializer_ - > serialize ( params , serialized ) ; <nl> if ( ! s . ok ( ) ) { <nl> return s ; <nl> } <nl> <nl> - return transport_ - > sendRequest ( serialized , options_ . get ( " compress " , false ) ) ; <nl> + bool compress = false ; <nl> + auto it = options_ . doc ( ) . FindMember ( " compress " ) ; <nl> + if ( it ! = options_ . doc ( ) . MemberEnd ( ) & & it - > value . IsBool ( ) ) { <nl> + compress = it - > value . GetBool ( ) ; <nl> + } <nl> + <nl> + return transport_ - > sendRequest ( serialized , compress ) ; <nl> } <nl> <nl> / * * <nl> * @ brief Get the request response <nl> * <nl> - * @ return A pair of a Status and a property tree of response params <nl> + * @ return A pair of a Status and a JSON object of response params <nl> * / <nl> - Status getResponse ( boost : : property_tree : : ptree & params ) { <nl> - params = transport_ - > getResponseParams ( ) ; <nl> + Status getResponse ( JSON & params ) { <nl> + params . copyFrom ( transport_ - > getResponseParams ( ) . doc ( ) ) ; <nl> return transport_ - > getResponseStatus ( ) ; <nl> } <nl> <nl> template < typename T > <nl> void setOption ( const std : : string & name , const T & value ) { <nl> - options_ . put ( name , value ) ; <nl> + options_ . add ( name , value ) ; <nl> transport_ - > setOption ( name , value ) ; <nl> } <nl> <nl> class Request { <nl> std : : shared_ptr < TTransport > transport_ { nullptr } ; <nl> <nl> / / / options from request call ( duplicated in transport ) <nl> - boost : : property_tree : : ptree options_ ; <nl> + JSON options_ ; <nl> <nl> private : <nl> FRIEND_TEST ( TLSTransportsTests , test_call ) ; <nl> mmm a / osquery / remote / serializers / json . cpp <nl> ppp b / osquery / remote / serializers / json . cpp <nl> <nl> # include " osquery / core / json . h " <nl> # include " osquery / remote / serializers / json . h " <nl> <nl> - namespace pt = boost : : property_tree ; <nl> - <nl> namespace osquery { <nl> <nl> - Status JSONSerializer : : serialize ( const pt : : ptree & params , <nl> - std : : string & serialized ) { <nl> - std : : ostringstream output ; <nl> - try { <nl> - pt : : write_json ( output , params , false ) ; <nl> - } catch ( const pt : : json_parser : : json_parser_error & e ) { <nl> - return Status ( 1 , std : : string ( " JSON serialize error : " ) + e . what ( ) ) ; <nl> - } <nl> - serialized = output . str ( ) ; <nl> - return Status ( 0 , " OK " ) ; <nl> + Status JSONSerializer : : serialize ( const JSON & json , std : : string & serialized ) { <nl> + return json . toString ( serialized ) ; <nl> } <nl> <nl> - Status JSONSerializer : : deserialize ( const std : : string & serialized , <nl> - pt : : ptree & params ) { <nl> + Status JSONSerializer : : deserialize ( const std : : string & serialized , JSON & json ) { <nl> if ( serialized . empty ( ) ) { <nl> / / Prevent errors from being thrown when a TLS endpoint accepts the JSON <nl> / / payload , but doesn ' t respond with anything . This has been seen in the <nl> / / wild , for example with Sumo Logic . <nl> - params = pt : : ptree ( ) ; <nl> + json = JSON ( ) ; <nl> return Status ( 0 , " OK " ) ; <nl> } <nl> - try { <nl> - std : : stringstream input ; <nl> - input < < serialized ; <nl> - pt : : read_json ( input , params ) ; <nl> - } catch ( const pt : : json_parser : : json_parser_error & e ) { <nl> - return Status ( 1 , std : : string ( " JSON deserialize error : " ) + e . what ( ) ) ; <nl> - } <nl> - return Status ( 0 , " OK " ) ; <nl> + <nl> + return json . fromString ( serialized ) ; <nl> } <nl> } <nl> mmm a / osquery / remote / serializers / json . h <nl> ppp b / osquery / remote / serializers / json . h <nl> namespace osquery { <nl> class JSONSerializer : public Serializer { <nl> public : <nl> / * * <nl> - * @ brief Serialize a property tree into a string <nl> - * <nl> - * @ param params A property tree of parameters <nl> - * <nl> - * @ param serialized The string to populate the final serialized params into <nl> - * <nl> - * @ return An instance of osquery : : Status indicating the success or failure <nl> - * of the operation <nl> + * @ brief See Serializer : : serialize <nl> * / <nl> - Status serialize ( const boost : : property_tree : : ptree & params , <nl> - std : : string & serialized ) ; <nl> + Status serialize ( const JSON & json , std : : string & serialized ) ; <nl> <nl> / * * <nl> - * @ brief Deerialize a property tree into a property tree <nl> - * <nl> - * @ param params A string of serialized parameters <nl> - * <nl> - * @ param serialized The property tree to populate the final serialized <nl> - * params into <nl> - * <nl> - * @ return An instance of osquery : : Status indicating the success or failure <nl> - * of the operation <nl> + * @ brief See Serializer : : desiralize <nl> * / <nl> - Status deserialize ( const std : : string & serialized , <nl> - boost : : property_tree : : ptree & params ) ; <nl> + Status deserialize ( const std : : string & serialized , JSON & json ) ; <nl> <nl> / * * <nl> - * @ brief Returns the HTTP content type , for HTTP / TLS transport <nl> + * @ brief See Serializer : : getContentType <nl> * <nl> * @ return The content type <nl> * / <nl> mmm a / osquery / remote / serializers / tests / json_serializers_tests . cpp <nl> ppp b / osquery / remote / serializers / tests / json_serializers_tests . cpp <nl> class JSONSerializersTests : public testing : : Test { } ; <nl> <nl> TEST_F ( JSONSerializersTests , test_serialize ) { <nl> auto json = JSONSerializer ( ) ; <nl> - boost : : property_tree : : ptree params ; <nl> - params . put < std : : string > ( " foo " , " bar " ) ; <nl> + JSON params ; <nl> + params . add ( " foo " , " bar " ) ; <nl> <nl> std : : string serialized ; <nl> auto s = json . serialize ( params , serialized ) ; <nl> EXPECT_TRUE ( s . ok ( ) ) ; <nl> - EXPECT_EQ ( serialized , " { \ " foo \ " : \ " bar \ " } \ n " ) ; <nl> + EXPECT_EQ ( serialized , " { \ " foo \ " : \ " bar \ " } " ) ; <nl> } <nl> <nl> TEST_F ( JSONSerializersTests , test_deserialize ) { <nl> auto json = JSONSerializer ( ) ; <nl> - boost : : property_tree : : ptree params ; <nl> - std : : string serialized = " { \ " foo \ " : \ " bar \ " } \ n " ; <nl> + JSON params ; <nl> + std : : string serialized = " { \ " foo \ " : \ " bar \ " } " ; <nl> auto s = json . deserialize ( serialized , params ) ; <nl> <nl> - boost : : property_tree : : ptree expected ; <nl> - expected . put < std : : string > ( " foo " , " bar " ) ; <nl> + JSON expected ; <nl> + expected . add ( " foo " , " bar " ) ; <nl> <nl> EXPECT_TRUE ( s . ok ( ) ) ; <nl> - EXPECT_EQ ( params , expected ) ; <nl> + EXPECT_EQ ( params . doc ( ) , expected . doc ( ) ) ; <nl> } <nl> } <nl> mmm a / osquery / remote / tests / requests_tests . cpp <nl> ppp b / osquery / remote / tests / requests_tests . cpp <nl> class MockTransport : public Transport { <nl> } <nl> <nl> Status sendRequest ( const std : : string & params , bool compress ) override { <nl> - response_params_ . put < std : : string > ( " foo " , " baz " ) ; <nl> + response_params_ . add ( " foo " , " baz " ) ; <nl> response_status_ = Status ( 0 , " OK " ) ; <nl> return response_status_ ; <nl> } <nl> class MockSerializer : public Serializer { <nl> return " mock " ; <nl> } <nl> <nl> - Status serialize ( const boost : : property_tree : : ptree & params , <nl> - std : : string & serialized ) { <nl> + Status serialize ( const JSON & params , std : : string & serialized ) { <nl> return Status ( 0 , " OK " ) ; <nl> } <nl> <nl> - Status deserialize ( const std : : string & serialized , <nl> - boost : : property_tree : : ptree & params ) { <nl> + Status deserialize ( const std : : string & serialized , JSON & params ) { <nl> return Status ( 0 , " OK " ) ; <nl> } <nl> } ; <nl> TEST_F ( RequestsTests , test_url ) { <nl> } <nl> <nl> TEST_F ( RequestsTests , test_call ) { <nl> - auto req = Request < MockTransport , MockSerializer > ( " foobar " ) ; <nl> + Request < MockTransport , MockSerializer > req ( " foobar " ) ; <nl> auto s1 = req . call ( ) ; <nl> EXPECT_TRUE ( s1 . ok ( ) ) ; <nl> <nl> - boost : : property_tree : : ptree params ; <nl> + JSON params ; <nl> auto s2 = req . getResponse ( params ) ; <nl> EXPECT_TRUE ( s2 . ok ( ) ) ; <nl> - boost : : property_tree : : ptree empty_ptree ; <nl> - EXPECT_EQ ( params , empty_ptree ) ; <nl> + JSON empty ; <nl> + EXPECT_EQ ( params . doc ( ) , empty . doc ( ) ) ; <nl> } <nl> <nl> TEST_F ( RequestsTests , test_call_with_params ) { <nl> - auto req = Request < MockTransport , MockSerializer > ( " foobar " ) ; <nl> - boost : : property_tree : : ptree params ; <nl> - params . put < std : : string > ( " foo " , " bar " ) ; <nl> + Request < MockTransport , MockSerializer > req ( " foobar " ) ; <nl> + JSON params ; <nl> + params . add ( " foo " , " bar " ) ; <nl> auto s1 = req . call ( params ) ; <nl> EXPECT_TRUE ( s1 . ok ( ) ) ; <nl> <nl> - boost : : property_tree : : ptree recv ; <nl> + JSON recv ; <nl> auto s2 = req . getResponse ( recv ) ; <nl> EXPECT_TRUE ( s2 . ok ( ) ) ; <nl> <nl> - boost : : property_tree : : ptree expected ; <nl> - expected . put < std : : string > ( " foo " , " baz " ) ; <nl> - EXPECT_EQ ( recv , expected ) ; <nl> + JSON expected ; <nl> + expected . add ( " foo " , " baz " ) ; <nl> + EXPECT_EQ ( recv . doc ( ) , expected . doc ( ) ) ; <nl> } <nl> <nl> class CopyTransport : public Transport { <nl> class CopySerializer : public Serializer { <nl> return " copy " ; <nl> } <nl> <nl> - Status serialize ( const boost : : property_tree : : ptree & params , <nl> - std : : string & serialized ) { <nl> - serialized = params . get ( " copy " , " " ) ; <nl> + Status serialize ( const JSON & params , std : : string & serialized ) { <nl> + auto it = params . doc ( ) . FindMember ( " copy " ) ; <nl> + serialized = ( it ! = params . doc ( ) . MemberEnd ( ) & & it - > value . IsString ( ) <nl> + ? it - > value . GetString ( ) <nl> + : " " ) ; <nl> + <nl> return Status ( 0 , " OK " ) ; <nl> } <nl> <nl> - Status deserialize ( const std : : string & serialized , <nl> - boost : : property_tree : : ptree & params ) { <nl> + Status deserialize ( const std : : string & serialized , JSON & params ) { <nl> return Status ( 0 , " OK " ) ; <nl> } <nl> } ; <nl> <nl> TEST_F ( RequestsTests , test_compression ) { <nl> - auto req = Request < CopyTransport , CopySerializer > ( " foobar " ) ; <nl> + Request < CopyTransport , CopySerializer > req ( " foobar " ) ; <nl> <nl> / / Ask the request to compress the output from serialization . <nl> req . setOption ( " compress " , true ) ; <nl> TEST_F ( RequestsTests , test_compression ) { <nl> } <nl> <nl> / / Our special ' copy ' serializer copies input from the ' copy ' key in params . <nl> - boost : : property_tree : : ptree params ; <nl> - params . put < std : : string > ( " copy " , uncompressed ) ; <nl> + JSON params ; <nl> + params . add ( " copy " , uncompressed ) ; <nl> <nl> / / Similarly , the ' copy ' transport copies the request params into the <nl> / / response status . <nl> mmm a / osquery / remote / transports / tests / tls_transports_tests . cpp <nl> ppp b / osquery / remote / transports / tests / tls_transports_tests . cpp <nl> <nl> # include " osquery / tests / test_additional_util . h " <nl> # include " osquery / tests / test_util . h " <nl> <nl> - namespace pt = boost : : property_tree ; <nl> - <nl> namespace osquery { <nl> <nl> DECLARE_string ( tls_server_certs ) ; <nl> TEST_F ( TLSTransportsTests , test_call ) { <nl> <nl> / / Create a request using a TLSTransport and JSONSerializer . <nl> auto url = " https : / / localhost : " + port_ ; <nl> - auto r = Request < TLSTransport , JSONSerializer > ( url , t ) ; <nl> + Request < TLSTransport , JSONSerializer > r ( url , t ) ; <nl> <nl> / / Use the ' call ' method on the request without any input parameters . <nl> / / This will use a GET for the URI given in the Request constructor . <nl> Status status ; <nl> ASSERT_NO_THROW ( status = r . call ( ) ) ; <nl> if ( verify ( status ) ) { <nl> - pt : : ptree recv ; <nl> + JSON recv ; <nl> status = r . getResponse ( recv ) ; <nl> EXPECT_TRUE ( status . ok ( ) ) ; <nl> } <nl> TEST_F ( TLSTransportsTests , test_call_with_params ) { <nl> t - > disableVerifyPeer ( ) ; <nl> <nl> auto url = " https : / / localhost : " + port_ ; <nl> - auto r = Request < TLSTransport , JSONSerializer > ( url , t ) ; <nl> + Request < TLSTransport , JSONSerializer > r ( url , t ) ; <nl> <nl> / / This time we ' ll construct a request parameter . <nl> - pt : : ptree params ; <nl> - params . put < std : : string > ( " foo " , " bar " ) ; <nl> + JSON params ; <nl> + params . add ( " foo " , " bar " ) ; <nl> <nl> / / The call with a set of a params will push this " JSONSerializer " - serialized <nl> / / data into the body of the request and issue a POST to the URI . <nl> Status status ; <nl> ASSERT_NO_THROW ( status = r . call ( params ) ) ; <nl> if ( verify ( status ) ) { <nl> - pt : : ptree recv ; <nl> + JSON recv ; <nl> status = r . getResponse ( recv ) ; <nl> EXPECT_TRUE ( status . ok ( ) ) ; <nl> - EXPECT_EQ ( params , recv ) ; <nl> + EXPECT_EQ ( params . doc ( ) , recv . doc ( ) ) ; <nl> } <nl> } <nl> <nl> TEST_F ( TLSTransportsTests , test_call_verify_peer ) { <nl> / / Create a default request without a transport that accepts invalid peers . <nl> auto url = " https : / / localhost : " + port_ ; <nl> - auto r = Request < TLSTransport , JSONSerializer > ( url ) ; <nl> + Request < TLSTransport , JSONSerializer > r ( url ) ; <nl> <nl> / / The status / call will fail TLS negotiation because our client is trying <nl> / / to verify the fake server , CA , commonName . <nl> TEST_F ( TLSTransportsTests , test_call_server_cert_pinning ) { <nl> t - > setPeerCertificate ( kTestDataPath + " test_server_ca . pem " ) ; <nl> <nl> auto url = " https : / / localhost : " + port_ ; <nl> - auto r = Request < TLSTransport , JSONSerializer > ( url , t ) ; <nl> + Request < TLSTransport , JSONSerializer > r1 ( url , t ) ; <nl> <nl> Status status ; <nl> - ASSERT_NO_THROW ( status = r . call ( ) ) ; <nl> + ASSERT_NO_THROW ( status = r1 . call ( ) ) ; <nl> if ( verify ( status ) ) { <nl> EXPECT_TRUE ( status . ok ( ) ) ; <nl> } <nl> TEST_F ( TLSTransportsTests , test_call_server_cert_pinning ) { <nl> / / Now try with a path that is not a filename . <nl> t = std : : make_shared < TLSTransport > ( ) ; <nl> t - > setPeerCertificate ( kTestDataPath ) ; <nl> - r = Request < TLSTransport , JSONSerializer > ( url , t ) ; <nl> + Request < TLSTransport , JSONSerializer > r2 ( url , t ) ; <nl> <nl> - ASSERT_NO_THROW ( status = r . call ( ) ) ; <nl> + ASSERT_NO_THROW ( status = r2 . call ( ) ) ; <nl> if ( verify ( status ) ) { <nl> EXPECT_FALSE ( status . ok ( ) ) ; <nl> } <nl> TEST_F ( TLSTransportsTests , test_call_client_auth ) { <nl> kTestDataPath + " test_client . key " ) ; <nl> <nl> auto url = " https : / / localhost : " + port_ ; <nl> - auto r = Request < TLSTransport , JSONSerializer > ( url , t ) ; <nl> + Request < TLSTransport , JSONSerializer > r ( url , t ) ; <nl> <nl> Status status ; <nl> ASSERT_NO_THROW ( status = r . call ( ) ) ; <nl> mmm a / osquery / remote / transports / tls . cpp <nl> ppp b / osquery / remote / transports / tls . cpp <nl> http : : Client : : Options TLSTransport : : getOptions ( ) { <nl> <nl> / / ' Optionally ' , though all TLS plugins should set a hostname , supply an SNI <nl> / / hostname . This will reveal the requested domain . <nl> - if ( options_ . count ( " hostname " ) ) { <nl> - options . openssl_sni_hostname ( options_ . get < std : : string > ( " hostname " ) ) ; <nl> + auto it = options_ . doc ( ) . FindMember ( " hostname " ) ; <nl> + if ( it ! = options_ . doc ( ) . MemberEnd ( ) & & it - > value . IsString ( ) ) { <nl> + options . openssl_sni_hostname ( it - > value . GetString ( ) ) ; <nl> } <nl> <nl> return options ; <nl> Status TLSTransport : : sendRequest ( const std : : string & params , bool compress ) { <nl> } <nl> <nl> / / Allow request calls to override the default HTTP POST verb . <nl> - HTTPVerb verb = HTTP_POST ; <nl> - if ( options_ . count ( " _verb " ) > 0 ) { <nl> - verb = ( HTTPVerb ) options_ . get < int > ( " _verb " , HTTP_POST ) ; <nl> - } <nl> + HTTPVerb verb ; <nl> + auto it = options_ . doc ( ) . FindMember ( " _verb " ) ; <nl> + <nl> + verb = ( HTTPVerb ) ( it ! = options_ . doc ( ) . MemberEnd ( ) & & it - > value . IsInt ( ) <nl> + ? it - > value . GetInt ( ) <nl> + : HTTP_POST ) ; <nl> <nl> VLOG ( 1 ) < < " TLS / HTTPS " < < ( ( verb = = HTTP_POST ) ? " POST " : " PUT " ) <nl> < < " request to URI : " < < destination_ ; <nl> mmm a / osquery / remote / utility . h <nl> ppp b / osquery / remote / utility . h <nl> <nl> <nl> # include < osquery / enroll . h > <nl> # include < osquery / flags . h > <nl> + # include < osquery / system . h > <nl> <nl> # include " osquery / remote / requests . h " <nl> # include " osquery / remote / transports / tls . h " <nl> DECLARE_bool ( disable_reenrollment ) ; <nl> * There are many static functions in this class that have very similar <nl> * behavior , which allow them to be used in many context . Some methods accept <nl> * parameters , some don ' t require them . Some have built - in retry logic , some <nl> - * don ' t . Some return results in a ptree , some return results in JSON , etc . <nl> + * don ' t . <nl> * / <nl> class TLSRequestHelper : private boost : : noncopyable { <nl> public : <nl> class TLSRequestHelper : private boost : : noncopyable { <nl> * @ brief Send a TLS request <nl> * <nl> * @ param uri is the URI to send the request to <nl> - * @ param params is a ptree of the params to send to the server . This isn ' t <nl> - * const because it will be modified to include node_key . <nl> - * @ param output is the ptree which will be populated with the deserialized <nl> + * @ param params is a JSON object containing the params to send to the server . <nl> + * This isn ' t const because it will be modified to include node_key . <nl> + * @ param output is the JSON which will be populated with the deserialized <nl> * results <nl> * <nl> * @ return a Status object indicating the success or failure of the operation <nl> * / <nl> template < class TSerializer > <nl> - static Status go ( const std : : string & uri , <nl> - boost : : property_tree : : ptree & params , <nl> - boost : : property_tree : : ptree & output ) { <nl> + static Status go ( const std : : string & uri , JSON & params , JSON & output ) { <nl> + auto & params_doc = params . doc ( ) ; <nl> + auto & output_doc = output . doc ( ) ; <nl> + <nl> auto node_key = getNodeKey ( " tls " ) ; <nl> <nl> / / If using a GET request , append the node_key to the URI variables . <nl> class TLSRequestHelper : private boost : : noncopyable { <nl> if ( FLAGS_tls_node_api ) { <nl> uri_suffix = " & node_key = " + node_key ; <nl> } else { <nl> - params . put < std : : string > ( " node_key " , node_key ) ; <nl> + params . add ( " node_key " , node_key ) ; <nl> } <nl> <nl> / / Again check for GET to call with / without parameters . <nl> - auto request = Request < TLSTransport , TSerializer > ( uri + uri_suffix ) ; <nl> + Request < TLSTransport , TSerializer > request ( uri + uri_suffix ) ; <nl> request . setOption ( " hostname " , FLAGS_tls_hostname ) ; <nl> <nl> bool compress = false ; <nl> - if ( params . count ( " _compress " ) ) { <nl> + auto it = params_doc . FindMember ( " _compress " ) ; <nl> + if ( it ! = params_doc . MemberEnd ( ) ) { <nl> compress = true ; <nl> - request . setOption ( " compress " , true ) ; <nl> - params . erase ( " _compress " ) ; <nl> + request . setOption ( " compress " , compress ) ; <nl> + params_doc . RemoveMember ( " _compress " ) ; <nl> } <nl> <nl> / / The caller - supplied parameters may force a POST request . <nl> bool force_post = false ; <nl> - if ( params . count ( " _verb " ) ) { <nl> - force_post = ( params . get < std : : string > ( " _verb " ) = = " POST " ) ; <nl> - params . erase ( " _verb " ) ; <nl> + it = params_doc . FindMember ( " _verb " ) ; <nl> + if ( it ! = params_doc . MemberEnd ( ) ) { <nl> + assert ( it - > value . IsString ( ) ) ; <nl> + <nl> + force_post = std : : string ( it - > value . GetString ( ) ) = = " POST " ; <nl> + params_doc . RemoveMember ( " _verb " ) ; <nl> } <nl> <nl> bool use_post = true ; <nl> - if ( params . count ( " _get " ) ) { <nl> + it = params_doc . FindMember ( " _get " ) ; <nl> + if ( it ! = params_doc . MemberEnd ( ) ) { <nl> use_post = false ; <nl> - params . erase ( " _get " ) ; <nl> + params_doc . RemoveMember ( " _get " ) ; <nl> } <nl> bool should_post = ( use_post | | force_post ) ; <nl> auto status = ( should_post ) ? request . call ( params ) : request . call ( ) ; <nl> <nl> / / Restore caller - supplied parameters . <nl> if ( force_post ) { <nl> - params . put ( " _verb " , " POST " ) ; <nl> + params . add ( " _verb " , " POST " ) ; <nl> } <nl> <nl> if ( compress ) { <nl> - params . put ( " _compress " , true ) ; <nl> + params . add ( " _compress " , true ) ; <nl> } <nl> <nl> if ( ! status . ok ( ) ) { <nl> class TLSRequestHelper : private boost : : noncopyable { <nl> } <nl> <nl> / / Receive config or key rejection <nl> - if ( output . count ( " node_invalid " ) > 0 ) { <nl> - auto invalid = output . get ( " node_invalid " , " " ) ; <nl> - if ( invalid = = " 1 " | | invalid = = " true " | | invalid = = " True " ) { <nl> + it = output_doc . FindMember ( " node_invalid " ) ; <nl> + if ( it ! = output_doc . MemberEnd ( ) ) { <nl> + assert ( it - > value . IsBool ( ) ) ; <nl> + <nl> + if ( it - > value . GetBool ( ) ) { <nl> if ( ! FLAGS_disable_reenrollment ) { <nl> clearNodeKey ( ) ; <nl> } <nl> <nl> std : : string message = " Request failed : Invalid node key " ; <nl> - if ( output . count ( " error " ) > 0 ) { <nl> - message + = " : " + output . get ( " error " , " < unknown > " ) ; <nl> + <nl> + it = output_doc . FindMember ( " error " ) ; <nl> + if ( it ! = output_doc . MemberEnd ( ) ) { <nl> + message + = <nl> + " : " + std : : string ( it - > value . IsString ( ) ? it - > value . GetString ( ) <nl> + : " < unknown > " ) ; <nl> } <nl> + <nl> return Status ( 1 , message ) ; <nl> } <nl> } <nl> <nl> - if ( output . count ( " error " ) > 0 ) { <nl> - return Status ( 1 , " Request failed : " + output . get ( " error " , " < unknown > " ) ) ; <nl> + it = output_doc . FindMember ( " error " ) ; <nl> + if ( it ! = output_doc . MemberEnd ( ) ) { <nl> + std : : string message = <nl> + " Request failed : " + std : : string ( it - > value . IsString ( ) <nl> + ? it - > value . GetString ( ) <nl> + : " < unknown > " ) ; <nl> + <nl> + return Status ( 1 , message ) ; <nl> } <nl> <nl> return Status ( 0 , " OK " ) ; <nl> class TLSRequestHelper : private boost : : noncopyable { <nl> * @ brief Send a TLS request <nl> * <nl> * @ param uri is the URI to send the request to <nl> - * @ param output is a ptree of the output from the server <nl> + * @ param output is a JSON object containing the output from the server <nl> * <nl> * @ return a Status object indicating the success or failure of the operation <nl> * / <nl> template < class TSerializer > <nl> - static Status go ( const std : : string & uri , <nl> - boost : : property_tree : : ptree & output ) { <nl> - boost : : property_tree : : ptree params ; <nl> - params . put ( " _get " , true ) ; <nl> + static Status go ( const std : : string & uri , JSON & output ) { <nl> + JSON params ; <nl> + params . add ( " _get " , true ) ; <nl> return TLSRequestHelper : : go < TSerializer > ( uri , params , output ) ; <nl> } <nl> <nl> class TLSRequestHelper : private boost : : noncopyable { <nl> * @ brief Send a TLS request <nl> * <nl> * @ param uri is the URI to send the request to <nl> - * @ param params is a ptree of the params to send to the server . This isn ' t <nl> - * const because it will be modified to include node_key . <nl> + * @ param params is a JSON object containing the params to send to the server . <nl> + * This isn ' t const because it will be modified to include node_key . <nl> * @ param output is the string which will be populated with the deserialized <nl> * results <nl> * <nl> * @ return a Status object indicating the success or failure of the operation <nl> * / <nl> template < class TSerializer > <nl> - static Status go ( const std : : string & uri , <nl> - boost : : property_tree : : ptree & params , <nl> - std : : string & output ) { <nl> - boost : : property_tree : : ptree recv ; <nl> + static Status go ( const std : : string & uri , JSON & params , std : : string & output ) { <nl> + JSON recv ; <nl> auto s = TLSRequestHelper : : go < TSerializer > ( uri , params , recv ) ; <nl> if ( s . ok ( ) ) { <nl> auto serializer = TSerializer ( ) ; <nl> class TLSRequestHelper : private boost : : noncopyable { <nl> * / <nl> template < class TSerializer > <nl> static Status go ( const std : : string & uri , std : : string & output ) { <nl> - boost : : property_tree : : ptree params ; <nl> - params . put ( " _get " , true ) ; <nl> + JSON params ; <nl> + params . add ( " _get " , true ) ; <nl> return TLSRequestHelper : : go < TSerializer > ( uri , params , output ) ; <nl> } <nl> <nl> class TLSRequestHelper : private boost : : noncopyable { <nl> * @ brief Send a TLS request <nl> * <nl> * @ param uri is the URI to send the request to <nl> - * @ param params is a ptree of the params to send to the server . This isn ' t <nl> - * const because it will be modified to include node_key . <nl> + * @ param params is a JSON object containing the params to send to the server . <nl> + * This isn ' t const because it will be modified to include node_key . <nl> * @ param output is the string which will be populated with the deserialized <nl> * results <nl> * @ param attempts is the number of attempts to make if the request fails <nl> class TLSRequestHelper : private boost : : noncopyable { <nl> * / <nl> template < class TSerializer > <nl> static Status go ( const std : : string & uri , <nl> - boost : : property_tree : : ptree & params , <nl> + JSON & params , <nl> std : : string & output , <nl> const size_t attempts ) { <nl> Status s ; <nl> + JSON override_params ; <nl> + const auto & params_doc = params . doc ( ) ; <nl> + const auto & override_params_doc = override_params . doc ( ) ; <nl> <nl> - boost : : property_tree : : ptree override_params ; <nl> - for ( const auto & param : params ) { <nl> - if ( param . first . find ( ' _ ' ) = = 0 ) { <nl> - override_params . put ( param . first , param . second . data ( ) ) ; <nl> + for ( auto & m : params_doc . GetObject ( ) ) { <nl> + std : : string name = m . name . GetString ( ) ; <nl> + if ( name . find ( ' _ ' ) = = 0 ) { <nl> + override_params . add ( name , m . value ) ; <nl> } <nl> } <nl> <nl> class TLSRequestHelper : private boost : : noncopyable { <nl> if ( i = = attempts ) { <nl> break ; <nl> } <nl> - for ( const auto & param : override_params ) { <nl> - params . put ( param . first , param . second . data ( ) ) ; <nl> + for ( auto & m : override_params_doc . GetObject ( ) ) { <nl> + params . add ( m . name . GetString ( ) , m . value ) ; <nl> } <nl> sleepFor ( i * i * 1000 ) ; <nl> } <nl> class TLSRequestHelper : private boost : : noncopyable { <nl> static Status go ( const std : : string & uri , <nl> std : : string & output , <nl> const size_t attempts ) { <nl> - boost : : property_tree : : ptree params ; <nl> - params . put ( " _get " , true ) ; <nl> + JSON params ; <nl> + params . add ( " _get " , true ) ; <nl> return TLSRequestHelper : : go < TSerializer > ( uri , params , output , attempts ) ; <nl> } <nl> } ; <nl>
|
Replace ptree with JSON on serialization code ( )
|
osquery/osquery
|
1bbdff8c7a6a966671f2cd598626acdd5702e39f
|
2018-03-01T00:36:24Z
|
mmm a / test / quantization / test_quantize . py <nl> ppp b / test / quantization / test_quantize . py <nl> <nl> float_qparams_dynamic_qconfig , <nl> register_observed_custom_module_mapping , <nl> register_quantized_custom_module_mapping , <nl> + PerChannelMinMaxObserver , <nl> + QConfigDynamic , <nl> + default_dynamic_quant_observer <nl> ) <nl> <nl> from torch . testing . _internal . common_quantization import ( <nl> def test_quantized_embedding_bag ( self ) : <nl> r " " " Test the post - training quantization flow , serialization and scripting <nl> of embedding_bag modules <nl> " " " <nl> - model = EmbeddingBagModule ( ) . eval ( ) <nl> indices = torch . tensor ( [ 9 , 6 , 5 , 7 , 8 , 8 , 9 , 2 , 8 , 6 , 6 , 9 , 1 , 6 , 8 , 8 , 3 , 2 , 3 , 6 , 3 , 6 , 5 , 7 , 0 , 8 , 4 , 6 , 5 , 8 , 2 , 3 ] ) <nl> offsets = torch . tensor ( [ 0 , 19 , 20 , 28 , 28 , 32 ] ) <nl> weights = torch . randn ( 10 , 12 , dtype = torch . float32 ) <nl> <nl> - model . qconfig = float_qparams_dynamic_qconfig <nl> - prepare ( model , inplace = True ) <nl> - quantized_model = convert ( model ) <nl> - <nl> - per_sample_weights = torch . from_numpy ( np . random . uniform ( <nl> - low = 0 . 01 , high = 0 . 5 , size = [ len ( indices ) ] ) . astype ( np . float32 ) ) <nl> - <nl> - # Test to make sure module is quantized correctly . <nl> - self . assertTrue ( ' QuantizedEmbeddingBag ' in str ( quantized_model ) ) <nl> - self . checkDynamicQuantizedModule ( quantized_model . emb , torch . nn . quantized . EmbeddingBag , torch . quint8 ) <nl> - self . checkScriptable ( quantized_model , [ [ indices , offsets , per_sample_weights ] ] , check_save_load = True ) <nl> + for dtype in [ torch . quint8 , torch . quint4x2 ] : <nl> + model = EmbeddingBagModule ( ) . eval ( ) <nl> + float_qparams_observer = PerChannelMinMaxObserver . with_args ( dtype = dtype , <nl> + qscheme = torch . per_channel_affine_float_qparams , <nl> + ch_axis = 0 ) <nl> + float_qparams_qconfig = QConfigDynamic ( activation = default_dynamic_quant_observer , <nl> + weight = float_qparams_observer ) <nl> + model . qconfig = float_qparams_qconfig <nl> <nl> - class EmbeddingBagWithLinear ( torch . nn . Module ) : <nl> - def __init__ ( self ) : <nl> - super ( ) . __init__ ( ) <nl> - self . emb = torch . nn . EmbeddingBag ( num_embeddings = 10 , embedding_dim = 12 , <nl> - include_last_offset = True , scale_grad_by_freq = False , mode = ' sum ' ) <nl> - self . fc = torch . nn . Linear ( 5 , 5 ) <nl> + prepare ( model , inplace = True ) <nl> + quantized_model = convert ( model ) <nl> <nl> - def forward ( self , indices , offsets , per_sample_weights , linear_in ) : <nl> - return self . emb ( indices , offsets , per_sample_weights ) , self . fc ( linear_in ) <nl> + per_sample_weights = torch . from_numpy ( np . random . uniform ( <nl> + low = 0 . 01 , high = 0 . 5 , size = [ len ( indices ) ] ) . astype ( np . float32 ) ) <nl> <nl> - # Test quantization of embedding_bag layer only <nl> - model = EmbeddingBagWithLinear ( ) . eval ( ) <nl> - model . emb . qconfig = float_qparams_dynamic_qconfig <nl> - prepare ( model , inplace = True ) <nl> - quantized_model = convert ( model ) <nl> + # Test to make sure module is quantized correctly . <nl> + self . assertTrue ( ' QuantizedEmbeddingBag ' in str ( quantized_model ) ) <nl> + self . checkDynamicQuantizedModule ( quantized_model . emb , torch . nn . quantized . EmbeddingBag , torch . quint8 ) <nl> + self . checkScriptable ( quantized_model , [ [ indices , offsets , per_sample_weights ] ] , check_save_load = True ) <nl> <nl> - self . assertTrue ( ' QuantizedEmbeddingBag ' in str ( quantized_model ) ) <nl> - self . checkLinear ( model . fc ) <nl> - self . checkDynamicQuantizedModule ( quantized_model . emb , torch . nn . quantized . EmbeddingBag , torch . quint8 ) <nl> + class EmbeddingBagWithLinear ( torch . nn . Module ) : <nl> + def __init__ ( self ) : <nl> + super ( ) . __init__ ( ) <nl> + self . emb = torch . nn . EmbeddingBag ( num_embeddings = 10 , embedding_dim = 12 , <nl> + include_last_offset = True , scale_grad_by_freq = False , mode = ' sum ' ) <nl> + self . fc = torch . nn . Linear ( 5 , 5 ) <nl> + <nl> + def forward ( self , indices , offsets , per_sample_weights , linear_in ) : <nl> + return self . emb ( indices , offsets , per_sample_weights ) , self . fc ( linear_in ) <nl> + <nl> + # Test quantization of embedding_bag layer only <nl> + model2 = EmbeddingBagWithLinear ( ) . eval ( ) <nl> + model2 . emb . qconfig = float_qparams_qconfig <nl> + prepare ( model2 , inplace = True ) <nl> + quantized_model = convert ( model2 ) <nl> + <nl> + self . assertTrue ( ' QuantizedEmbeddingBag ' in str ( quantized_model ) ) <nl> + self . checkLinear ( model2 . fc ) <nl> + self . checkDynamicQuantizedModule ( quantized_model . emb , torch . nn . quantized . EmbeddingBag , torch . quint8 ) <nl> <nl> @ skipIfNoFBGEMM <nl> def test_custom_module_class ( self ) : <nl> mmm a / test / quantization / test_quantized_module . py <nl> ppp b / test / quantization / test_quantized_module . py <nl> <nl> import torch . quantization <nl> <nl> from torch . quantization import ( <nl> - default_float_qparams_observer <nl> + default_float_qparams_observer , <nl> + PerChannelMinMaxObserver <nl> ) <nl> from torch . testing . _internal . common_quantization import ( <nl> QuantizationTestCase , <nl> def test_embedding_api ( self , num_embeddings , embedding_dim , set_qconfig ) : <nl> w_packed = qemb . _packed_params . _packed_weight <nl> module_out = qemb ( indices ) <nl> <nl> - # Call the qembedding_bag operator directly <nl> + # Call the qembedding operator directly <nl> ref = torch . ops . quantized . embedding_byte ( w_packed , indices , sparse = False ) <nl> self . assertEqual ( module_out , ref ) <nl> self . checkEmbeddingSerialization ( qemb , num_embeddings , embedding_dim , indices , None , set_qconfig = False , is_emb_bag = False ) <nl> def test_embedding_api ( self , num_embeddings , embedding_dim , set_qconfig ) : <nl> def test_embedding_bag_api ( self , num_embeddings , embedding_dim , num_offsets , set_qconfig ) : <nl> r " " " Test execution and serialization for dynamic quantized embedding_bag modules on int8 <nl> " " " <nl> + <nl> num_lengths = np . random . randint ( 1 , 6 ) <nl> lengths = np . random . randint ( 0 , 21 , size = num_lengths ) . astype ( np . int32 ) <nl> num_indices = np . sum ( lengths ) <nl> def test_embedding_bag_api ( self , num_embeddings , embedding_dim , num_offsets , set <nl> offsets = torch . cat ( ( offsets , torch . tensor ( [ indices . size ( 0 ) ] , dtype = torch . long ) ) , 0 ) <nl> weights = torch . from_numpy ( ( np . random . random_sample ( ( num_embeddings , embedding_dim ) ) + 1 ) . astype ( np . float32 ) ) <nl> <nl> - obs = default_float_qparams_observer ( ) <nl> - obs ( weights ) <nl> - # Get the scale and zero point for the weight tensor <nl> - qparams = obs . calculate_qparams ( ) <nl> - # Quantize the weights to 8bits <nl> - qweight = torch . quantize_per_channel ( weights , qparams [ 0 ] , qparams [ 1 ] , axis = 0 , dtype = torch . quint8 ) <nl> - qemb = nnq . EmbeddingBag ( num_embeddings = num_embeddings , embedding_dim = embedding_dim , <nl> - include_last_offset = True , mode = ' sum ' , _weight = qweight ) <nl> - qemb ( indices , offsets ) <nl> - <nl> - # Ensure the module has the correct weights <nl> - self . assertEqual ( qweight , qemb . weight ( ) ) <nl> - <nl> - w_packed = qemb . _packed_params . _packed_weight <nl> - module_out = qemb ( indices , offsets ) <nl> + for qdtype in [ torch . quint8 , torch . quint4x2 ] : <nl> + obs = PerChannelMinMaxObserver ( dtype = qdtype , qscheme = torch . per_channel_affine_float_qparams , ch_axis = 0 ) <nl> + obs ( weights ) <nl> + # Get the scale and zero point for the weight tensor <nl> + qparams = obs . calculate_qparams ( ) <nl> + # Quantize the weights to 8bits <nl> + qweight = torch . quantize_per_channel ( weights , qparams [ 0 ] , qparams [ 1 ] , axis = 0 , dtype = qdtype ) <nl> + qemb = nnq . EmbeddingBag ( num_embeddings = num_embeddings , embedding_dim = embedding_dim , <nl> + include_last_offset = True , mode = ' sum ' , _weight = qweight , dtype = qdtype ) <nl> + qemb ( indices , offsets ) <nl> + <nl> + # Ensure the module has the correct weights <nl> + self . assertEqual ( qweight , qemb . weight ( ) ) <nl> + <nl> + w_packed = qemb . _packed_params . _packed_weight <nl> + module_out = qemb ( indices , offsets ) <nl> + <nl> + # Call the qembedding_bag operator directly <nl> + if qdtype = = torch . quint8 : <nl> + ref = torch . ops . quantized . embedding_bag_byte ( w_packed , indices , offsets , mode = 0 , <nl> + per_sample_weights = None , <nl> + include_last_offset = True ) <nl> + else : <nl> + ref = torch . ops . quantized . embedding_bag_4bit ( w_packed , indices , offsets , mode = 0 , <nl> + per_sample_weights = None , <nl> + include_last_offset = True ) <nl> <nl> - # Call the qembedding_bag operator directly <nl> - ref = torch . ops . quantized . embedding_bag_byte ( w_packed , indices , offsets , mode = 0 , <nl> - per_sample_weights = None , <nl> - include_last_offset = True ) <nl> - self . assertEqual ( module_out , ref ) <nl> - self . checkEmbeddingSerialization ( qemb , num_embeddings , embedding_dim , indices , offsets , set_qconfig , is_emb_bag = True ) <nl> + self . assertEqual ( module_out , ref ) <nl> + self . checkEmbeddingSerialization ( qemb , num_embeddings , embedding_dim , indices , <nl> + offsets , set_qconfig , is_emb_bag = True , dtype = qdtype ) <nl> <nl> class TestDynamicQuantizedModule ( QuantizationTestCase ) : <nl> @ given ( <nl> mmm a / torch / nn / quantized / modules / embedding_ops . py <nl> ppp b / torch / nn / quantized / modules / embedding_ops . py <nl> class EmbeddingPackedParams ( torch . nn . Module ) : <nl> def __init__ ( self , num_embeddings , embedding_dim , dtype = torch . quint8 ) : <nl> super ( EmbeddingPackedParams , self ) . __init__ ( ) <nl> self . dtype = dtype <nl> - if self . dtype = = torch . quint8 : <nl> + if self . dtype in [ torch . quint8 , torch . quint4x2 ] : <nl> scales = torch . ones ( num_embeddings , dtype = torch . float ) <nl> zero_points = torch . zeros ( num_embeddings , dtype = torch . float ) <nl> wq = torch . _empty_per_channel_affine_quantized ( [ num_embeddings , embedding_dim ] , scales = scales , <nl> zero_points = zero_points , <nl> - axis = 0 , dtype = torch . quint8 ) <nl> + axis = 0 , dtype = self . dtype ) <nl> self . set_weight ( wq ) <nl> else : <nl> - raise RuntimeError ( ' Unsupported dtype on quantized embedding ! ' ) <nl> + raise NotImplementedError ( ' Unsupported dtype on quantized embedding ! Supports quint8 and quint4x2 . ' ) <nl> <nl> @ torch . jit . export <nl> def set_weight ( self , weight ) : <nl> # type : ( torch . Tensor ) - > None <nl> - if self . dtype = = torch . quint8 : <nl> + if self . dtype in [ torch . quint8 , torch . quint4x2 ] : <nl> self . _packed_weight = torch . ops . quantized . embedding_bag_prepack ( weight ) <nl> else : <nl> - raise RuntimeError ( ' Unsupported dtype on quantized embedding ! ' ) <nl> + raise NotImplementedError ( ' Unsupported dtype for quantized embedding prepack ! Supports quint8 and quint4x2 . ' ) <nl> <nl> <nl> @ torch . jit . export <nl> def _weight ( self ) : <nl> - if self . dtype = = torch . quint8 : <nl> + if self . dtype in [ torch . quint8 , torch . quint4x2 ] : <nl> return torch . ops . quantized . embedding_bag_unpack ( self . _packed_weight ) <nl> else : <nl> - raise RuntimeError ( ' Unsupported dtype on quantized embedding ! ' ) <nl> + raise NotImplementedError ( ' Unsupported dtype for quantized embedding unpack ! Supports quint8 and quint4x2 . ' ) <nl> <nl> def forward ( self , x ) : <nl> return x <nl> def __init__ ( self , num_embeddings : int , embedding_dim : int , <nl> max_norm : Optional [ float ] = None , norm_type : float = 2 . , scale_grad_by_freq : bool = False , <nl> mode : str = ' sum ' , sparse : bool = False , _weight : Optional [ Tensor ] = None , <nl> include_last_offset : bool = False , dtype = torch . quint8 ) - > None : <nl> - super ( EmbeddingBag , self ) . __init__ ( num_embeddings , embedding_dim , _weight = _weight ) <nl> + super ( EmbeddingBag , self ) . __init__ ( num_embeddings , embedding_dim , _weight = _weight , dtype = dtype ) <nl> <nl> self . mode = mode <nl> self . sparse = sparse <nl> self . include_last_offset = include_last_offset <nl> + self . dtype = dtype <nl> <nl> def forward ( self , indices : Tensor , offsets : Optional [ Tensor ] = None , per_sample_weights : Optional [ Tensor ] = None , <nl> compressed_indices_mapping : Optional [ Tensor ] = None ) - > Tensor : <nl> - return torch . ops . quantized . embedding_bag_byte ( self . _packed_params . _packed_weight , indices , offsets , False , 0 , <nl> - self . sparse , per_sample_weights , compressed_indices_mapping , <nl> - self . include_last_offset ) <nl> + if self . dtype = = torch . quint4x2 : <nl> + return torch . ops . quantized . embedding_bag_4bit ( self . _packed_params . _packed_weight , indices , offsets , False , 0 , <nl> + self . sparse , per_sample_weights , compressed_indices_mapping , <nl> + self . include_last_offset ) <nl> + else : <nl> + return torch . ops . quantized . embedding_bag_byte ( self . _packed_params . _packed_weight , indices , offsets , False , 0 , <nl> + self . sparse , per_sample_weights , compressed_indices_mapping , <nl> + self . include_last_offset ) <nl> <nl> def _get_name ( self ) : <nl> return ' QuantizedEmbeddingBag ' <nl> def from_float ( cls , mod ) : <nl> <nl> dtype = weight_observer . dtype <nl> <nl> - assert dtype = = torch . quint8 , ' The only supported dtype for nnq . EmbeddingBag is torch . quint8 ' <nl> + assert dtype = = torch . quint8 or dtype = = torch . quint4x2 , \ <nl> + ' The only supported dtype for nnq . EmbeddingBag is torch . quint8 and torch . quint4x2 ' <nl> <nl> # Run the observer to calculate qparams . <nl> weight_observer ( mod . weight ) <nl> qweight = _quantize_weight ( mod . weight . float ( ) , weight_observer ) <nl> <nl> # Create quantized EmbeddingBag module and pass in the quantized weight <nl> - qembedding_bag = EmbeddingBag ( mod . num_embeddings , mod . embedding_dim ) <nl> + qembedding_bag = EmbeddingBag ( mod . num_embeddings , mod . embedding_dim , dtype = dtype ) <nl> qembedding_bag . set_weight ( qweight ) <nl> return qembedding_bag <nl> mmm a / torch / nn / quantized / modules / utils . py <nl> ppp b / torch / nn / quantized / modules / utils . py <nl> def _quantize_weight ( float_wt , observer ) : <nl> elif observer . qscheme in [ torch . per_channel_affine_float_qparams ] : <nl> qweight = torch . quantize_per_channel ( <nl> float_wt , <nl> - wt_scale . to ( torch . float ) , wt_zp . to ( torch . float ) , observer . ch_axis , torch . quint8 ) <nl> + wt_scale . to ( torch . float ) , wt_zp . to ( torch . float ) , observer . ch_axis , observer . dtype ) <nl> else : <nl> raise ValueError ( " Unexpected qscheme " + observer . qscheme ) <nl> return qweight <nl> mmm a / torch / testing / _internal / common_quantization . py <nl> ppp b / torch / testing / _internal / common_quantization . py <nl> <nl> from torch . quantization import QuantWrapper , QuantStub , DeQuantStub , \ <nl> default_qconfig , default_dynamic_qconfig , default_per_channel_qconfig , QConfig , default_observer , default_weight_observer , \ <nl> propagate_qconfig_ , convert , get_default_qconfig , quantize_dynamic_jit , quantize_jit , float_qparams_dynamic_qconfig , \ <nl> - get_default_qat_qconfig <nl> + get_default_qat_qconfig , PerChannelMinMaxObserver , default_dynamic_quant_observer , QConfigDynamic <nl> from torch . quantization import ( <nl> is_custom_module_class , <nl> is_observed_custom_module , <nl> def checkGraphModeFxOp ( self , model , inputs , quant_type , <nl> qgraph_to_check , expected_node , expected_node_occurrence , expected_node_list ) <nl> <nl> <nl> - def checkEmbeddingSerialization ( self , qemb , num_embeddings , embedding_dim , indices , offsets , set_qconfig , is_emb_bag ) : <nl> + def checkEmbeddingSerialization ( self , qemb , num_embeddings , embedding_dim , indices , offsets , <nl> + set_qconfig , is_emb_bag , dtype = torch . quint8 ) : <nl> # Test serialization of dynamic EmbeddingBag module using state_dict <nl> if is_emb_bag : <nl> inputs = [ indices , offsets ] <nl> def checkEmbeddingSerialization ( self , qemb , num_embeddings , embedding_dim , indic <nl> # Check state dict serialization and torch . save APIs <nl> if is_emb_bag : <nl> loaded_qemb = nnq . EmbeddingBag ( num_embeddings = num_embeddings , embedding_dim = embedding_dim , <nl> - include_last_offset = True , mode = ' sum ' ) <nl> + include_last_offset = True , mode = ' sum ' , dtype = dtype ) <nl> else : <nl> - loaded_qemb = nnq . Embedding ( num_embeddings = num_embeddings , embedding_dim = embedding_dim ) <nl> + loaded_qemb = nnq . Embedding ( num_embeddings = num_embeddings , embedding_dim = embedding_dim , dtype = dtype ) <nl> self . check_eager_serialization ( qemb , loaded_qemb , inputs ) <nl> <nl> loaded_qemb . load_state_dict ( loaded_dict ) <nl> def checkEmbeddingSerialization ( self , qemb , num_embeddings , embedding_dim , indic <nl> float_embedding = torch . nn . Embedding ( num_embeddings = num_embeddings , embedding_dim = embedding_dim ) <nl> <nl> if set_qconfig : <nl> - float_embedding . qconfig = float_qparams_dynamic_qconfig <nl> + float_qparams_observer = PerChannelMinMaxObserver . with_args ( dtype = dtype , <nl> + qscheme = torch . per_channel_affine_float_qparams , <nl> + ch_axis = 0 ) <nl> + float_embedding . qconfig = QConfigDynamic ( activation = default_dynamic_quant_observer , <nl> + weight = float_qparams_observer ) <nl> <nl> prepare_dynamic ( float_embedding ) <nl> <nl>
|
[ quant ] Support for 4 - bit quantized EmbeddingBag module ( )
|
pytorch/pytorch
|
43dc7ef9335158fbdb124e5fc0952789e528d06e
|
2020-10-07T04:11:52Z
|
mmm a / lib / AST / GenericSignatureBuilder . cpp <nl> ppp b / lib / AST / GenericSignatureBuilder . cpp <nl> PotentialArchetype * GenericSignatureBuilder : : realizePotentialArchetype ( <nl> <nl> static Type getStructuralType ( TypeDecl * typeDecl ) { <nl> if ( auto typealias = dyn_cast < TypeAliasDecl > ( typeDecl ) ) { <nl> - return typealias - > getStructuralType ( ) ; <nl> + / / When we ' re computing requirement signatures , the structural type <nl> + / / suffices . Otherwise we ' ll potentially try to validate incomplete <nl> + / / requirements . <nl> + auto * proto = dyn_cast_or_null < ProtocolDecl > ( typealias - > getDeclContext ( ) - > getAsDecl ( ) ) ; <nl> + if ( proto & & proto - > isComputingRequirementSignature ( ) ) <nl> + return typealias - > getStructuralType ( ) ; <nl> + return typealias - > getUnderlyingType ( ) ; <nl> } <nl> <nl> return typeDecl - > getDeclaredInterfaceType ( ) ; <nl> mmm a / test / Generics / protocol_type_aliases . swift <nl> ppp b / test / Generics / protocol_type_aliases . swift <nl> func concreteRequirementOnConcreteNestedTypeAlias < T > ( _ : T ) where T : Q2 , S < T . C > = <nl> protocol P3 { <nl> typealias T = Int <nl> } <nl> - protocol Q3 : P3 { / / expected - error { { generic signature requires types ' P3 . T ' ( aka ' Int ' ) } } <nl> + protocol Q3 : P3 { / / expected - error { { generic signature requires types ' Int ' } } <nl> typealias T = Float <nl> } <nl> <nl> protocol P3_1 { <nl> typealias T = Float <nl> } <nl> - protocol Q3_1 : P3 , P3_1 { } / / expected - error { { generic signature requires types ' P3_1 . T ' ( aka ' Float ' ) } } <nl> + protocol Q3_1 : P3 , P3_1 { } / / expected - error { { generic signature requires types ' Float ' } } <nl> <nl> <nl> / / Subprotocols can force associated types in their parents to be concrete , and <nl> mmm a / validation - test / compiler_crashers_2_fixed / 0145 - sr7097 . swift <nl> ppp b / validation - test / compiler_crashers_2_fixed / 0145 - sr7097 . swift <nl> protocol P2 { <nl> } <nl> <nl> / / CHECK - LABEL : . P3 @ <nl> - / / CHECK - NEXT : Requirement signature : < Self where Self : P2 , Self . Assoc = = P3 . Assoc > <nl> + / / CHECK - NEXT : Requirement signature : < Self where Self : P2 , Self . Assoc = = ConformsToP1 > <nl> protocol P3 : P2 { } <nl> <nl> struct S0 < M : P3 > where M . Assoc : P1 { } / / expected - warning { { redundant conformance constraint ' M . Assoc ' : ' P1 ' } } <nl>
|
Break some cycles
|
apple/swift
|
6b7fbc9a2bdc3b192d5bf5c6ea2daaecf384660b
|
2019-09-18T01:29:40Z
|
mmm a / doc / manual - src / en / aria2c . rst <nl> ppp b / doc / manual - src / en / aria2c . rst <nl> HTTP / FTP / SFTP Options <nl> 1 source . You can append ` ` K ` ` or ` ` M ` ` ( 1K = 1024 , 1M = 1024K ) . <nl> Possible Values : ` ` 1M ` ` - ` ` 1024M ` ` Default : ` ` 20M ` ` <nl> <nl> + <nl> + . . option : : - - netrc - path = < FILE > <nl> + <nl> + Specify the path to the netrc file . <nl> + Default : ` ` $ ( HOME ) / . netrc ` ` <nl> + <nl> + . . note : : <nl> + <nl> + Permission of the . netrc file must be 600 . Otherwise , the file <nl> + will be ignored . <nl> + <nl> . . option : : - n , - - no - netrc [ = true | false ] <nl> <nl> Disables netrc support . netrc support is enabled by default . <nl>
|
Document - - netrc - path option
|
aria2/aria2
|
4273885f1677579675f71667d933bd308a020fdd
|
2015-05-14T12:26:38Z
|
mmm a / src / arm / codegen - arm . cc <nl> ppp b / src / arm / codegen - arm . cc <nl> void CodeGenerator : : VisitUnaryOperation ( UnaryOperation * node ) { <nl> } <nl> <nl> <nl> + class DeferredCountOperation : public DeferredCode { <nl> + public : <nl> + DeferredCountOperation ( Register value , <nl> + bool is_increment , <nl> + bool is_postfix , <nl> + int target_size ) <nl> + : value_ ( value ) , <nl> + is_increment_ ( is_increment ) , <nl> + is_postfix_ ( is_postfix ) , <nl> + target_size_ ( target_size ) { } <nl> + <nl> + virtual void Generate ( ) { <nl> + VirtualFrame copied_frame ( * frame_state ( ) - > frame ( ) ) ; <nl> + <nl> + Label slow ; <nl> + / / Check for smi operand . <nl> + __ tst ( value_ , Operand ( kSmiTagMask ) ) ; <nl> + __ b ( ne , & slow ) ; <nl> + <nl> + / / Revert optimistic increment / decrement . <nl> + if ( is_increment_ ) { <nl> + __ sub ( value_ , value_ , Operand ( Smi : : FromInt ( 1 ) ) ) ; <nl> + } else { <nl> + __ add ( value_ , value_ , Operand ( Smi : : FromInt ( 1 ) ) ) ; <nl> + } <nl> + <nl> + / / Slow case : Convert to number . At this point the <nl> + / / value to be incremented is in the value register . . <nl> + __ bind ( & slow ) ; <nl> + <nl> + / / Convert the operand to a number . <nl> + copied_frame . EmitPush ( value_ ) ; <nl> + <nl> + copied_frame . InvokeBuiltin ( Builtins : : TO_NUMBER , CALL_JS , 1 ) ; <nl> + <nl> + if ( is_postfix_ ) { <nl> + / / Postfix : store to result ( on the stack ) . <nl> + __ str ( r0 , MemOperand ( sp , target_size_ * kPointerSize ) ) ; <nl> + } <nl> + <nl> + copied_frame . EmitPush ( r0 ) ; <nl> + copied_frame . EmitPush ( Operand ( Smi : : FromInt ( 1 ) ) ) ; <nl> + <nl> + if ( is_increment_ ) { <nl> + copied_frame . CallRuntime ( Runtime : : kNumberAdd , 2 ) ; <nl> + } else { <nl> + copied_frame . CallRuntime ( Runtime : : kNumberSub , 2 ) ; <nl> + } <nl> + <nl> + __ Move ( value_ , r0 ) ; <nl> + <nl> + copied_frame . MergeTo ( frame_state ( ) - > frame ( ) ) ; <nl> + } <nl> + <nl> + private : <nl> + Register value_ ; <nl> + bool is_increment_ ; <nl> + bool is_postfix_ ; <nl> + int target_size_ ; <nl> + } ; <nl> + <nl> + <nl> void CodeGenerator : : VisitCountOperation ( CountOperation * node ) { <nl> # ifdef DEBUG <nl> int original_height = frame_ - > height ( ) ; <nl> void CodeGenerator : : VisitCountOperation ( CountOperation * node ) { <nl> / / the target . It also pushes the current value of the target . <nl> target . GetValue ( ) ; <nl> <nl> - JumpTarget slow ; <nl> - JumpTarget exit ; <nl> - <nl> + bool value_is_known_smi = frame_ - > KnownSmiAt ( 0 ) ; <nl> Register value = frame_ - > PopToRegister ( ) ; <nl> <nl> / / Postfix : Store the old value as the result . <nl> void CodeGenerator : : VisitCountOperation ( CountOperation * node ) { <nl> value = VirtualFrame : : scratch0 ( ) ; <nl> } <nl> <nl> - / / Check for smi operand . <nl> - __ tst ( value , Operand ( kSmiTagMask ) ) ; <nl> - slow . Branch ( ne ) ; <nl> + / / We can ' t use any type information here since the virtual frame from the <nl> + / / deferred code may have lost information and we can ' t merge a virtual <nl> + / / frame with less specific type knowledge to a virtual frame with more <nl> + / / specific knowledge that has already used that specific knowledge to <nl> + / / generate code . <nl> + frame_ - > ForgetTypeInfo ( ) ; <nl> + <nl> + / / The constructor here will capture the current virtual frame and use it to <nl> + / / merge to after the deferred code has run . No virtual frame changes are <nl> + / / allowed from here until the ' BindExit ' below . <nl> + DeferredCode * deferred = <nl> + new DeferredCountOperation ( value , <nl> + is_increment , <nl> + is_postfix , <nl> + target . size ( ) ) ; <nl> + if ( ! value_is_known_smi ) { <nl> + / / Check for smi operand . <nl> + __ tst ( value , Operand ( kSmiTagMask ) ) ; <nl> + <nl> + deferred - > Branch ( ne ) ; <nl> + } <nl> <nl> / / Perform optimistic increment / decrement . <nl> if ( is_increment ) { <nl> void CodeGenerator : : VisitCountOperation ( CountOperation * node ) { <nl> __ sub ( value , value , Operand ( Smi : : FromInt ( 1 ) ) , SetCC ) ; <nl> } <nl> <nl> - / / If the increment / decrement didn ' t overflow , we ' re done . <nl> - exit . Branch ( vc ) ; <nl> - <nl> - / / Revert optimistic increment / decrement . <nl> - if ( is_increment ) { <nl> - __ sub ( value , value , Operand ( Smi : : FromInt ( 1 ) ) ) ; <nl> - } else { <nl> - __ add ( value , value , Operand ( Smi : : FromInt ( 1 ) ) ) ; <nl> - } <nl> + / / If increment / decrement overflows , go to deferred code . <nl> + deferred - > Branch ( vs ) ; <nl> <nl> - / / Slow case : Convert to number . At this point the <nl> - / / value to be incremented is in the value register . . <nl> - slow . Bind ( ) ; <nl> - <nl> - / / Convert the operand to a number . <nl> - frame_ - > EmitPush ( value ) ; <nl> - <nl> - { <nl> - VirtualFrame : : SpilledScope spilled ( frame_ ) ; <nl> - frame_ - > InvokeBuiltin ( Builtins : : TO_NUMBER , CALL_JS , 1 ) ; <nl> - <nl> - if ( is_postfix ) { <nl> - / / Postfix : store to result ( on the stack ) . <nl> - __ str ( r0 , frame_ - > ElementAt ( target . size ( ) ) ) ; <nl> - } <nl> - <nl> - / / Compute the new value . <nl> - frame_ - > EmitPush ( r0 ) ; <nl> - frame_ - > EmitPush ( Operand ( Smi : : FromInt ( 1 ) ) ) ; <nl> - if ( is_increment ) { <nl> - frame_ - > CallRuntime ( Runtime : : kNumberAdd , 2 ) ; <nl> - } else { <nl> - frame_ - > CallRuntime ( Runtime : : kNumberSub , 2 ) ; <nl> - } <nl> - } <nl> + deferred - > BindExit ( ) ; <nl> <nl> - __ Move ( value , r0 ) ; <nl> / / Store the new value in the target if not const . <nl> / / At this point the answer is in the value register . <nl> - exit . Bind ( ) ; <nl> frame_ - > EmitPush ( value ) ; <nl> / / Set the target with the result , leaving the result on <nl> / / top of the stack . Removes the target from the stack if <nl>
|
ARM : Defer the prefix / postfix code generation . This is a fixed
|
v8/v8
|
72de9278d5b01489c62b96c234d32ec56b4a497b
|
2010-11-24T09:55:58Z
|
mmm a / modules / gdscript / gdscript_function . cpp <nl> ppp b / modules / gdscript / gdscript_function . cpp <nl> Variant GDScriptFunctionState : : _signal_callback ( const Variant * * p_args , int p_ar <nl> / / then the function did yield again after resuming . <nl> if ( ret . is_ref ( ) ) { <nl> GDScriptFunctionState * gdfs = Object : : cast_to < GDScriptFunctionState > ( ret ) ; <nl> - if ( gdfs & & gdfs - > function = = function ) <nl> + if ( gdfs & & gdfs - > function = = function ) { <nl> completed = false ; <nl> + gdfs - > previous_state = Ref < GDScriptFunctionState > ( this ) ; <nl> + } <nl> } <nl> <nl> function = NULL ; / / cleaned up ; <nl> state . result = Variant ( ) ; <nl> <nl> if ( completed ) { <nl> - emit_signal ( " completed " , ret ) ; <nl> + GDScriptFunctionState * state = this ; <nl> + while ( state ! = NULL ) { <nl> + state - > emit_signal ( " completed " , ret ) ; <nl> + state = * ( state - > previous_state ) ; <nl> + } <nl> } <nl> <nl> return ret ; <nl> Variant GDScriptFunctionState : : resume ( const Variant & p_arg ) { <nl> / / then the function did yield again after resuming . <nl> if ( ret . is_ref ( ) ) { <nl> GDScriptFunctionState * gdfs = Object : : cast_to < GDScriptFunctionState > ( ret ) ; <nl> - if ( gdfs & & gdfs - > function = = function ) <nl> + if ( gdfs & & gdfs - > function = = function ) { <nl> completed = false ; <nl> + gdfs - > previous_state = Ref < GDScriptFunctionState > ( this ) ; <nl> + } <nl> } <nl> <nl> function = NULL ; / / cleaned up ; <nl> state . result = Variant ( ) ; <nl> <nl> if ( completed ) { <nl> - emit_signal ( " completed " , ret ) ; <nl> + GDScriptFunctionState * state = this ; <nl> + while ( state ! = NULL ) { <nl> + state - > emit_signal ( " completed " , ret ) ; <nl> + state = * ( state - > previous_state ) ; <nl> + } <nl> } <nl> <nl> return ret ; <nl> mmm a / modules / gdscript / gdscript_function . h <nl> ppp b / modules / gdscript / gdscript_function . h <nl> class GDScriptFunctionState : public Reference { <nl> GDScriptFunction * function ; <nl> GDScriptFunction : : CallState state ; <nl> Variant _signal_callback ( const Variant * * p_args , int p_argcount , Variant : : CallError & r_error ) ; <nl> + Ref < GDScriptFunctionState > previous_state ; <nl> <nl> protected : <nl> static void _bind_methods ( ) ; <nl>
|
completed - signal is emitted by all GDScriptFunctionStates of a coroutine now , allowing to yield for completion of a function with more than one yield inside .
|
godotengine/godot
|
3dfef37628a3b17cca4ce5370631fb572376ed98
|
2018-03-14T15:42:13Z
|
mmm a / src / hydrogen - instructions . cc <nl> ppp b / src / hydrogen - instructions . cc <nl> void HConstant : : PrintDataTo ( StringStream * stream ) { <nl> <nl> <nl> bool HArrayLiteral : : IsCopyOnWrite ( ) const { <nl> - return boilerplate_object_ - > elements ( ) - > map ( ) = = HEAP - > fixed_cow_array_map ( ) ; <nl> + if ( ! boilerplate_object_ - > IsJSObject ( ) ) return false ; <nl> + return Handle < JSObject > : : cast ( boilerplate_object_ ) - > elements ( ) - > map ( ) = = <nl> + HEAP - > fixed_cow_array_map ( ) ; <nl> } <nl> <nl> <nl> mmm a / src / hydrogen - instructions . h <nl> ppp b / src / hydrogen - instructions . h <nl> class HMaterializedLiteral : public HTemplateInstruction < V > { <nl> class HArrayLiteral : public HMaterializedLiteral < 1 > { <nl> public : <nl> HArrayLiteral ( HValue * context , <nl> - Handle < JSObject > boilerplate_object , <nl> + Handle < HeapObject > boilerplate_object , <nl> int length , <nl> int literal_index , <nl> int depth ) <nl> class HArrayLiteral : public HMaterializedLiteral < 1 > { <nl> <nl> HValue * context ( ) { return OperandAt ( 0 ) ; } <nl> ElementsKind boilerplate_elements_kind ( ) const { <nl> - return boilerplate_object_ - > GetElementsKind ( ) ; <nl> + if ( ! boilerplate_object_ - > IsJSObject ( ) ) { <nl> + return FAST_ELEMENTS ; <nl> + } <nl> + return Handle < JSObject > : : cast ( boilerplate_object_ ) - > GetElementsKind ( ) ; <nl> } <nl> - Handle < JSObject > boilerplate_object ( ) const { return boilerplate_object_ ; } <nl> + Handle < HeapObject > boilerplate_object ( ) const { return boilerplate_object_ ; } <nl> int length ( ) const { return length_ ; } <nl> <nl> bool IsCopyOnWrite ( ) const ; <nl> class HArrayLiteral : public HMaterializedLiteral < 1 > { <nl> <nl> private : <nl> int length_ ; <nl> - Handle < JSObject > boilerplate_object_ ; <nl> + Handle < HeapObject > boilerplate_object_ ; <nl> } ; <nl> <nl> <nl> mmm a / src / hydrogen . cc <nl> ppp b / src / hydrogen . cc <nl> void HGraphBuilder : : VisitArrayLiteral ( ArrayLiteral * expr ) { <nl> Handle < FixedArray > literals ( environment ( ) - > closure ( ) - > literals ( ) ) ; <nl> Handle < Object > raw_boilerplate ( literals - > get ( expr - > literal_index ( ) ) ) ; <nl> <nl> - / / For now , no boilerplate causes a deopt . <nl> if ( raw_boilerplate - > IsUndefined ( ) ) { <nl> - AddInstruction ( new ( zone ( ) ) HSoftDeoptimize ) ; <nl> - return ast_context ( ) - > ReturnValue ( graph ( ) - > GetConstantUndefined ( ) ) ; <nl> + raw_boilerplate = Runtime : : CreateArrayLiteralBoilerplate ( <nl> + isolate ( ) , literals , expr - > constant_elements ( ) ) ; <nl> + if ( raw_boilerplate . is_null ( ) ) { <nl> + return Bailout ( " array boilerplate creation failed " ) ; <nl> + } <nl> + literals - > set ( expr - > literal_index ( ) , * raw_boilerplate ) ; <nl> + if ( JSObject : : cast ( * raw_boilerplate ) - > elements ( ) - > map ( ) = = <nl> + isolate ( ) - > heap ( ) - > fixed_cow_array_map ( ) ) { <nl> + isolate ( ) - > counters ( ) - > cow_arrays_created_runtime ( ) - > Increment ( ) ; <nl> + } <nl> } <nl> <nl> - Handle < JSObject > boilerplate ( Handle < JSObject > : : cast ( raw_boilerplate ) ) ; <nl> - ElementsKind boilerplate_elements_kind = boilerplate - > GetElementsKind ( ) ; <nl> + Handle < JSObject > boilerplate = Handle < JSObject > : : cast ( raw_boilerplate ) ; <nl> + ElementsKind boilerplate_elements_kind = <nl> + Handle < JSObject > : : cast ( boilerplate ) - > GetElementsKind ( ) ; <nl> <nl> HArrayLiteral * literal = new ( zone ( ) ) HArrayLiteral ( <nl> context , <nl> mmm a / src / runtime . cc <nl> ppp b / src / runtime . cc <nl> static Handle < Object > CreateObjectLiteralBoilerplate ( <nl> static const int kSmiOnlyLiteralMinimumLength = 1024 ; <nl> <nl> <nl> - static Handle < Object > CreateArrayLiteralBoilerplate ( <nl> + / / static <nl> + Handle < Object > Runtime : : CreateArrayLiteralBoilerplate ( <nl> Isolate * isolate , <nl> Handle < FixedArray > literals , <nl> Handle < FixedArray > elements ) { <nl> static Handle < Object > CreateLiteralBoilerplate ( <nl> false , <nl> kHasNoFunctionLiteral ) ; <nl> case CompileTimeValue : : ARRAY_LITERAL : <nl> - return CreateArrayLiteralBoilerplate ( isolate , literals , elements ) ; <nl> + return Runtime : : CreateArrayLiteralBoilerplate ( <nl> + isolate , literals , elements ) ; <nl> default : <nl> UNREACHABLE ( ) ; <nl> return Handle < Object > : : null ( ) ; <nl> RUNTIME_FUNCTION ( MaybeObject * , Runtime_CreateArrayLiteral ) { <nl> / / Check if boilerplate exists . If not , create it first . <nl> Handle < Object > boilerplate ( literals - > get ( literals_index ) , isolate ) ; <nl> if ( * boilerplate = = isolate - > heap ( ) - > undefined_value ( ) ) { <nl> - boilerplate = CreateArrayLiteralBoilerplate ( isolate , literals , elements ) ; <nl> + boilerplate = <nl> + Runtime : : CreateArrayLiteralBoilerplate ( isolate , literals , elements ) ; <nl> if ( boilerplate . is_null ( ) ) return Failure : : Exception ( ) ; <nl> / / Update the functions literal and return the boilerplate . <nl> literals - > set ( literals_index , * boilerplate ) ; <nl> RUNTIME_FUNCTION ( MaybeObject * , Runtime_CreateArrayLiteralShallow ) { <nl> Handle < Object > boilerplate ( literals - > get ( literals_index ) , isolate ) ; <nl> if ( * boilerplate = = isolate - > heap ( ) - > undefined_value ( ) ) { <nl> ASSERT ( * elements ! = isolate - > heap ( ) - > empty_fixed_array ( ) ) ; <nl> - boilerplate = CreateArrayLiteralBoilerplate ( isolate , literals , elements ) ; <nl> + boilerplate = <nl> + Runtime : : CreateArrayLiteralBoilerplate ( isolate , literals , elements ) ; <nl> if ( boilerplate . is_null ( ) ) return Failure : : Exception ( ) ; <nl> / / Update the functions literal and return the boilerplate . <nl> literals - > set ( literals_index , * boilerplate ) ; <nl> mmm a / src / runtime . h <nl> ppp b / src / runtime . h <nl> class Runtime : public AllStatic { <nl> <nl> / / Helper functions used stubs . <nl> static void PerformGC ( Object * result ) ; <nl> + <nl> + / / Used in runtime . cc and hydrogen ' s VisitArrayLiteral . <nl> + static Handle < Object > CreateArrayLiteralBoilerplate ( <nl> + Isolate * isolate , <nl> + Handle < FixedArray > literals , <nl> + Handle < FixedArray > elements ) ; <nl> } ; <nl> <nl> <nl> mmm a / test / mjsunit / array - literal - transitions . js <nl> ppp b / test / mjsunit / array - literal - transitions . js <nl> if ( support_smi_only_arrays ) { <nl> assertEquals ( 1 , array [ 1 ] ) ; <nl> assertEquals ( foo , array [ 2 ] ) ; <nl> } <nl> + <nl> + ( function literals_after_osr ( ) { <nl> + var color = [ 0 ] ; <nl> + / / Trigger OSR . <nl> + while ( % GetOptimizationStatus ( literals_after_osr ) = = 2 ) { } <nl> + return [ color [ 0 ] ] ; <nl> + } ) ( ) ; <nl>
|
Create missing boilerplate for array literals instead of deoptimizing
|
v8/v8
|
106973c3d2c582595827166e07b927c1032ad95e
|
2011-12-14T13:01:27Z
|
mmm a / doc / base / classes . xml <nl> ppp b / doc / base / classes . xml <nl> <nl> Axis - Aligned Bounding Box . <nl> < / brief_description > <nl> < description > <nl> - AABB provides an 3D Axis - Aligned Bounding Box . It consists of a position and a size , and several utility functions . It is typically used for simple ( fast ) overlap tests . <nl> + AABB provides an 3D Axis - Aligned Bounding Box . It consists of a position , a size , and several utility functions . It is typically used for simple ( fast ) overlap tests . <nl> < / description > <nl> < methods > <nl> < method name = " encloses " > <nl> <nl> < return type = " float " > <nl> < / return > <nl> < description > <nl> - Get the area inside the [ AABB ] . <nl> + Get the area of the [ AABB ] . <nl> < / description > <nl> < / method > <nl> < method name = " get_endpoint " > <nl> <nl> < argument index = " 0 " name = " by " type = " float " > <nl> < / argument > <nl> < description > <nl> - Return a copy of the AABB grown a given a mount of units towards all the sides . <nl> + Return a copy of the [ AABB ] grown a given amount of units towards all the sides . <nl> < / description > <nl> < / method > <nl> < method name = " has_no_area " > <nl> <nl> < argument index = " 0 " name = " plane " type = " Plane " > <nl> < / argument > <nl> < description > <nl> - Return true if the AABB is at both sides of a plane . <nl> + Return true if the [ AABB ] is at both sides of a plane . <nl> < / description > <nl> < / method > <nl> < method name = " intersects_segment " > <nl> <nl> < argument index = " 0 " name = " with " type = " AABB " > <nl> < / argument > <nl> < description > <nl> - Combine this [ AABB ] with another one , a larger one is returned that contains both . <nl> + Combine this [ AABB ] with another , a larger one is returned that contains both . <nl> < / description > <nl> < / method > <nl> < method name = " AABB " > <nl> This method controls whether the position between two cached points is interpola <nl> < / class > <nl> < class name = " Rect2 " category = " Built - In Types " > <nl> < brief_description > <nl> + 2D Axis - aligned bounding box . <nl> < / brief_description > <nl> < description > <nl> + Rect2 provides an 2D Axis - Aligned Bounding Box . It consists of a position , a size , and several utility functions . It is typically used for fast overlap tests . <nl> < / description > <nl> < methods > <nl> < method name = " clip " > <nl> This method controls whether the position between two cached points is interpola <nl> < argument index = " 0 " name = " b " type = " Rect2 " > <nl> < / argument > <nl> < description > <nl> + Returns the intersection of this [ Rect2 ] and b . <nl> < / description > <nl> < / method > <nl> < method name = " encloses " > <nl> This method controls whether the position between two cached points is interpola <nl> < argument index = " 0 " name = " b " type = " Rect2 " > <nl> < / argument > <nl> < description > <nl> + Returns true if this [ Rect2 ] completely encloses another one . <nl> < / description > <nl> < / method > <nl> < method name = " expand " > <nl> This method controls whether the position between two cached points is interpola <nl> < argument index = " 0 " name = " to " type = " Vector2 " > <nl> < / argument > <nl> < description > <nl> + Return this [ Rect2 ] expanded to include a given point . <nl> < / description > <nl> < / method > <nl> < method name = " get_area " > <nl> < return type = " float " > <nl> < / return > <nl> < description > <nl> + Get the area of the [ Rect2 ] . <nl> < / description > <nl> < / method > <nl> < method name = " grow " > <nl> This method controls whether the position between two cached points is interpola <nl> < argument index = " 0 " name = " by " type = " float " > <nl> < / argument > <nl> < description > <nl> + Return a copy of the [ Rect2 ] grown a given amount of units towards all the sides . <nl> < / description > <nl> < / method > <nl> < method name = " has_no_area " > <nl> < return type = " bool " > <nl> < / return > <nl> < description > <nl> + Return true if the [ Rect2 ] is flat or empty . <nl> < / description > <nl> < / method > <nl> < method name = " has_point " > <nl> This method controls whether the position between two cached points is interpola <nl> < argument index = " 0 " name = " point " type = " Vector2 " > <nl> < / argument > <nl> < description > <nl> + Return true if the [ Rect2 ] contains a point . <nl> < / description > <nl> < / method > <nl> < method name = " intersects " > <nl> This method controls whether the position between two cached points is interpola <nl> < argument index = " 0 " name = " b " type = " Rect2 " > <nl> < / argument > <nl> < description > <nl> + Return true if the [ Rect2 ] overlaps with another . <nl> < / description > <nl> < / method > <nl> < method name = " merge " > <nl> This method controls whether the position between two cached points is interpola <nl> < argument index = " 0 " name = " b " type = " Rect2 " > <nl> < / argument > <nl> < description > <nl> + Combine this [ Rect2 ] with another , a larger one is returned that contains both . <nl> < / description > <nl> < / method > <nl> < method name = " Rect2 " > <nl> This method controls whether the position between two cached points is interpola <nl> < argument index = " 1 " name = " size " type = " Vector2 " > <nl> < / argument > <nl> < description > <nl> + Construct a [ Rect2 ] by position and size . <nl> < / description > <nl> < / method > <nl> < method name = " Rect2 " > <nl> This method controls whether the position between two cached points is interpola <nl> < argument index = " 3 " name = " height " type = " float " > <nl> < / argument > <nl> < description > <nl> + Construct a [ Rect2 ] by x , y , width and height . <nl> < / description > <nl> < / method > <nl> < / methods > <nl>
|
Edit documentation for AABB and Rect2 .
|
godotengine/godot
|
12f2c1378a5e9eac91efb1ddd451e3255add3244
|
2015-11-29T13:56:40Z
|
mmm a / src / core / lib / iomgr / udp_server . c <nl> ppp b / src / core / lib / iomgr / udp_server . c <nl> struct grpc_udp_listener { <nl> grpc_udp_server * server ; <nl> grpc_resolved_address addr ; <nl> grpc_closure read_closure ; <nl> + grpc_closure write_closure ; <nl> grpc_closure destroyed_closure ; <nl> grpc_udp_server_read_cb read_cb ; <nl> + grpc_udp_server_write_cb write_cb ; <nl> grpc_udp_server_orphan_cb orphan_cb ; <nl> <nl> struct grpc_udp_listener * next ; <nl> static void on_read ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * error ) { <nl> gpr_mu_unlock ( & sp - > server - > mu ) ; <nl> } <nl> <nl> + static void on_write ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * error ) { <nl> + grpc_udp_listener * sp = arg ; <nl> + <nl> + gpr_mu_lock ( & ( sp - > server - > mu ) ) ; <nl> + if ( error ! = GRPC_ERROR_NONE ) { <nl> + if ( 0 = = - - sp - > server - > active_ports ) { <nl> + gpr_mu_unlock ( & sp - > server - > mu ) ; <nl> + deactivated_all_ports ( exec_ctx , sp - > server ) ; <nl> + } else { <nl> + gpr_mu_unlock ( & sp - > server - > mu ) ; <nl> + } <nl> + return ; <nl> + } <nl> + <nl> + / * Tell the registered callback that the socket is writeable . * / <nl> + GPR_ASSERT ( sp - > write_cb ) ; <nl> + sp - > write_cb ( exec_ctx , sp - > emfd ) ; <nl> + <nl> + / * Re - arm the notification event so we get another chance to write . * / <nl> + grpc_fd_notify_on_write ( exec_ctx , sp - > emfd , & sp - > write_closure ) ; <nl> + gpr_mu_unlock ( & sp - > server - > mu ) ; <nl> + } <nl> + <nl> static int add_socket_to_server ( grpc_udp_server * s , int fd , <nl> const grpc_resolved_address * addr , <nl> grpc_udp_server_read_cb read_cb , <nl> + grpc_udp_server_write_cb write_cb , <nl> grpc_udp_server_orphan_cb orphan_cb ) { <nl> grpc_udp_listener * sp ; <nl> int port ; <nl> static int add_socket_to_server ( grpc_udp_server * s , int fd , <nl> sp - > emfd = grpc_fd_create ( fd , name ) ; <nl> memcpy ( & sp - > addr , addr , sizeof ( grpc_resolved_address ) ) ; <nl> sp - > read_cb = read_cb ; <nl> + sp - > write_cb = write_cb ; <nl> sp - > orphan_cb = orphan_cb ; <nl> GPR_ASSERT ( sp - > emfd ) ; <nl> gpr_mu_unlock ( & s - > mu ) ; <nl> static int add_socket_to_server ( grpc_udp_server * s , int fd , <nl> int grpc_udp_server_add_port ( grpc_udp_server * s , <nl> const grpc_resolved_address * addr , <nl> grpc_udp_server_read_cb read_cb , <nl> + grpc_udp_server_write_cb write_cb , <nl> grpc_udp_server_orphan_cb orphan_cb ) { <nl> grpc_udp_listener * sp ; <nl> int allocated_port1 = - 1 ; <nl> int grpc_udp_server_add_port ( grpc_udp_server * s , <nl> / / TODO ( rjshade ) : Test and propagate the returned grpc_error * : <nl> GRPC_ERROR_UNREF ( grpc_create_dualstack_socket ( addr , SOCK_DGRAM , IPPROTO_UDP , <nl> & dsmode , & fd ) ) ; <nl> - allocated_port1 = add_socket_to_server ( s , fd , addr , read_cb , orphan_cb ) ; <nl> + allocated_port1 = <nl> + add_socket_to_server ( s , fd , addr , read_cb , write_cb , orphan_cb ) ; <nl> if ( fd > = 0 & & dsmode = = GRPC_DSMODE_DUALSTACK ) { <nl> goto done ; <nl> } <nl> int grpc_udp_server_add_port ( grpc_udp_server * s , <nl> grpc_sockaddr_is_v4mapped ( addr , & addr4_copy ) ) { <nl> addr = & addr4_copy ; <nl> } <nl> - allocated_port2 = add_socket_to_server ( s , fd , addr , read_cb , orphan_cb ) ; <nl> + allocated_port2 = <nl> + add_socket_to_server ( s , fd , addr , read_cb , write_cb , orphan_cb ) ; <nl> <nl> done : <nl> gpr_free ( allocated_addr ) ; <nl> void grpc_udp_server_start ( grpc_exec_ctx * exec_ctx , grpc_udp_server * s , <nl> grpc_schedule_on_exec_ctx ) ; <nl> grpc_fd_notify_on_read ( exec_ctx , sp - > emfd , & sp - > read_closure ) ; <nl> <nl> + grpc_closure_init ( & sp - > write_closure , on_write , sp , <nl> + grpc_schedule_on_exec_ctx ) ; <nl> + grpc_fd_notify_on_write ( exec_ctx , sp - > emfd , & sp - > write_closure ) ; <nl> + <nl> s - > active_ports + + ; <nl> sp = sp - > next ; <nl> } <nl> mmm a / src / core / lib / iomgr / udp_server . h <nl> ppp b / src / core / lib / iomgr / udp_server . h <nl> typedef struct grpc_udp_server grpc_udp_server ; <nl> typedef void ( * grpc_udp_server_read_cb ) ( grpc_exec_ctx * exec_ctx , grpc_fd * emfd , <nl> struct grpc_server * server ) ; <nl> <nl> + / * Called when the socket is writeable . * / <nl> + typedef void ( * grpc_udp_server_write_cb ) ( grpc_exec_ctx * exec_ctx , <nl> + grpc_fd * emfd ) ; <nl> + <nl> / * Called when the grpc_fd is about to be orphaned ( and the FD closed ) . * / <nl> typedef void ( * grpc_udp_server_orphan_cb ) ( grpc_fd * emfd ) ; <nl> <nl> int grpc_udp_server_get_fd ( grpc_udp_server * s , unsigned port_index ) ; <nl> int grpc_udp_server_add_port ( grpc_udp_server * s , <nl> const grpc_resolved_address * addr , <nl> grpc_udp_server_read_cb read_cb , <nl> + grpc_udp_server_write_cb write_cb , <nl> grpc_udp_server_orphan_cb orphan_cb ) ; <nl> <nl> void grpc_udp_server_destroy ( grpc_exec_ctx * exec_ctx , grpc_udp_server * server , <nl> mmm a / test / core / iomgr / udp_server_test . c <nl> ppp b / test / core / iomgr / udp_server_test . c <nl> <nl> static grpc_pollset * g_pollset ; <nl> static gpr_mu * g_mu ; <nl> static int g_number_of_reads = 0 ; <nl> + static int g_number_of_writes = 0 ; <nl> static int g_number_of_bytes_read = 0 ; <nl> static int g_number_of_orphan_calls = 0 ; <nl> <nl> static void on_read ( grpc_exec_ctx * exec_ctx , grpc_fd * emfd , <nl> gpr_mu_unlock ( g_mu ) ; <nl> } <nl> <nl> + static void on_write ( grpc_exec_ctx * exec_ctx , grpc_fd * emfd ) { <nl> + gpr_mu_lock ( g_mu ) ; <nl> + g_number_of_writes + + ; <nl> + <nl> + GPR_ASSERT ( <nl> + GRPC_LOG_IF_ERROR ( " pollset_kick " , grpc_pollset_kick ( g_pollset , NULL ) ) ) ; <nl> + gpr_mu_unlock ( g_mu ) ; <nl> + } <nl> + <nl> static void on_fd_orphaned ( grpc_fd * emfd ) { <nl> gpr_log ( GPR_INFO , " gRPC FD about to be orphaned : % d " , <nl> grpc_fd_wrapped_fd ( emfd ) ) ; <nl> static void test_no_op_with_port ( void ) { <nl> memset ( & resolved_addr , 0 , sizeof ( resolved_addr ) ) ; <nl> resolved_addr . len = sizeof ( struct sockaddr_in ) ; <nl> addr - > sin_family = AF_INET ; <nl> - GPR_ASSERT ( <nl> - grpc_udp_server_add_port ( s , & resolved_addr , on_read , on_fd_orphaned ) ) ; <nl> + GPR_ASSERT ( grpc_udp_server_add_port ( s , & resolved_addr , on_read , on_write , <nl> + on_fd_orphaned ) ) ; <nl> <nl> grpc_udp_server_destroy ( & exec_ctx , s , NULL ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> static void test_no_op_with_port_and_start ( void ) { <nl> memset ( & resolved_addr , 0 , sizeof ( resolved_addr ) ) ; <nl> resolved_addr . len = sizeof ( struct sockaddr_in ) ; <nl> addr - > sin_family = AF_INET ; <nl> - GPR_ASSERT ( <nl> - grpc_udp_server_add_port ( s , & resolved_addr , on_read , on_fd_orphaned ) ) ; <nl> + GPR_ASSERT ( grpc_udp_server_add_port ( s , & resolved_addr , on_read , on_write , <nl> + on_fd_orphaned ) ) ; <nl> <nl> grpc_udp_server_start ( & exec_ctx , s , NULL , 0 , NULL ) ; <nl> <nl> static void test_receive ( int number_of_clients ) { <nl> memset ( & resolved_addr , 0 , sizeof ( resolved_addr ) ) ; <nl> resolved_addr . len = sizeof ( struct sockaddr_storage ) ; <nl> addr - > ss_family = AF_INET ; <nl> - GPR_ASSERT ( <nl> - grpc_udp_server_add_port ( s , & resolved_addr , on_read , on_fd_orphaned ) ) ; <nl> + GPR_ASSERT ( grpc_udp_server_add_port ( s , & resolved_addr , on_read , on_write , <nl> + on_fd_orphaned ) ) ; <nl> <nl> svrfd = grpc_udp_server_get_fd ( s , 0 ) ; <nl> GPR_ASSERT ( svrfd > = 0 ) ; <nl> static void test_receive ( int number_of_clients ) { <nl> / * The server had a single FD , which is orphaned once in * <nl> * deactivated_all_ports , and once in grpc_udp_server_destroy . * / <nl> GPR_ASSERT ( g_number_of_orphan_calls = = 2 ) ; <nl> + <nl> + / * The write callback should have fired a few times . * / <nl> + GPR_ASSERT ( g_number_of_writes > 0 ) ; <nl> } <nl> <nl> static void destroy_pollset ( grpc_exec_ctx * exec_ctx , void * p , <nl>
|
Add an on_write callback to the UDP server .
|
grpc/grpc
|
c23feddd2cc4d48b9dc5b1d4d89afd6aceca5677
|
2017-02-02T16:32:30Z
|
mmm a / src / mongo / db / commands / storage_details . cpp <nl> ppp b / src / mongo / db / commands / storage_details . cpp <nl> namespace { <nl> DiskStorageData & slice = sliceData [ it - > sliceNum ] ; <nl> slice . numEntries + = it - > ratioHere ; <nl> slice . recBytes + = it - > sizeHere ; <nl> - slice . bsonBytes + = it - > ratioHere * obj . objsize ( ) ; <nl> + slice . bsonBytes + = static_cast < long long > ( it - > ratioHere * obj . objsize ( ) ) ; <nl> if ( hasCharacteristicField ) { <nl> slice . characteristicCount + = it - > ratioHere ; <nl> slice . characteristicSum + = it - > ratioHere * characteristicFieldValue ; <nl> namespace { <nl> errmsg = " extent number must be a number , e . g . { . . . , extent : 3 , . . . } " ; <nl> return false ; <nl> } <nl> - int extentNum = extentElm . Number ( ) ; <nl> + int extentNum = extentElm . numberInt ( ) ; <nl> extent = getNthExtent ( extentNum , nsd ) ; <nl> if ( extent = = NULL ) { <nl> errmsg = str : : stream ( ) < < " extent " < < extentNum < < " does not exist " ; <nl> namespace { <nl> errmsg = " range must be an array with exactly two numeric elements " ; <nl> return false ; <nl> } <nl> - params . startOfs = rangeElm [ " 0 " ] . Number ( ) ; <nl> - params . endOfs = rangeElm [ " 1 " ] . Number ( ) ; <nl> + params . startOfs = rangeElm [ " 0 " ] . numberInt ( ) ; <nl> + params . endOfs = rangeElm [ " 1 " ] . numberInt ( ) ; <nl> } <nl> <nl> / / { granularity : bytes } <nl> namespace { <nl> errmsg = " granularity must be a number " ; <nl> return false ; <nl> } <nl> - params . granularity = granularityElm . number ( ) ; <nl> + params . granularity = granularityElm . numberInt ( ) ; <nl> <nl> / / { numberOfSlices : num } <nl> BSONElement numberOfSlicesElm = cmdObj [ " numberOfSlices " ] ; <nl> namespace { <nl> errmsg = " numberOfSlices must be a number " ; <nl> return false ; <nl> } <nl> - params . numberOfSlices = numberOfSlicesElm . number ( ) ; <nl> + params . numberOfSlices = numberOfSlicesElm . numberInt ( ) ; <nl> <nl> BSONElement characteristicFieldElm = cmdObj [ " characteristicField " ] ; <nl> if ( characteristicFieldElm . ok ( ) ) { <nl>
|
Fix narrowing conversion warnings
|
mongodb/mongo
|
27a846ff3112521e0e0a58ea902d962663e67597
|
2012-11-16T05:55:10Z
|
mmm a / atom / common / api / atom_api_clipboard . cc <nl> ppp b / atom / common / api / atom_api_clipboard . cc <nl> void WriteHtml ( const base : : string16 & html , mate : : Arguments * args ) { <nl> writer . WriteHTML ( html , std : : string ( ) ) ; <nl> } <nl> <nl> + v8 : : Local < v8 : : Value > ReadBookmark ( mate : : Arguments * args ) { <nl> + base : : string16 title ; <nl> + std : : string url ; <nl> + mate : : Dictionary dict = mate : : Dictionary : : CreateEmpty ( args - > isolate ( ) ) ; <nl> + ui : : Clipboard * clipboard = ui : : Clipboard : : GetForCurrentThread ( ) ; <nl> + clipboard - > ReadBookmark ( & title , & url ) ; <nl> + dict . Set ( " title " , title ) ; <nl> + dict . Set ( " url " , url ) ; <nl> + return dict . GetHandle ( ) ; <nl> + } <nl> + <nl> + void WriteBookmark ( const base : : string16 & title , const std : : string & url , <nl> + mate : : Arguments * args ) { <nl> + ui : : ScopedClipboardWriter writer ( GetClipboardType ( args ) ) ; <nl> + writer . WriteBookmark ( title , url ) ; <nl> + } <nl> + <nl> gfx : : Image ReadImage ( mate : : Arguments * args ) { <nl> ui : : Clipboard * clipboard = ui : : Clipboard : : GetForCurrentThread ( ) ; <nl> SkBitmap bitmap = clipboard - > ReadImage ( GetClipboardType ( args ) ) ; <nl> void Initialize ( v8 : : Local < v8 : : Object > exports , v8 : : Local < v8 : : Value > unused , <nl> dict . SetMethod ( " writeRTF " , & WriteRtf ) ; <nl> dict . SetMethod ( " readHTML " , & ReadHtml ) ; <nl> dict . SetMethod ( " writeHTML " , & WriteHtml ) ; <nl> + dict . SetMethod ( " readBookmark " , & ReadBookmark ) ; <nl> + dict . SetMethod ( " writeBookmark " , & WriteBookmark ) ; <nl> dict . SetMethod ( " readImage " , & ReadImage ) ; <nl> dict . SetMethod ( " writeImage " , & WriteImage ) ; <nl> dict . SetMethod ( " clear " , & Clear ) ; <nl>
|
Support reading / writing bookmarks to clipboard
|
electron/electron
|
271808b2780feb0872e29bc8ac47457cb671fc5d
|
2016-06-24T22:08:12Z
|
mmm a / folly / futures / detail / Core . h <nl> ppp b / folly / futures / detail / Core . h <nl> static_assert ( sizeof ( SpinLock ) = = 1 , " missized " ) ; <nl> / / / | / \ | <nl> / / / | ( setResult ( ) ) ( setCallback ( ) ) | <nl> / / / | / \ | <nl> - / / / | mmm > Start mmm > mmmmmm > Done | <nl> - / / / | \ \ / | <nl> - / / / | \ ( setCallback ( ) ) ( setResult ( ) ) | <nl> - / / / | \ \ / | <nl> - / / / | \ mmm > OnlyCallback mmm | <nl> - / / / | \ / | <nl> - / / / | < - - ( stealCallback ( ) ) - | <nl> + / / / | Start mmmmmmmmm > mmmmmm > Done | <nl> + / / / | \ \ / | <nl> + / / / | \ ( setCallback ( ) ) ( setResult ( ) ) | <nl> + / / / | \ \ / | <nl> + / / / | \ mmm > OnlyCallback mmm | <nl> + / / / | \ / | <nl> + / / / | < - ( stealCallback ( ) ) - | <nl> / / / + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> / / / <nl> / / / States and the corresponding producer - to - consumer data status & ownership : <nl>
|
Tweak Futures Core ASCII art
|
facebook/folly
|
36bad07f9d38e4aa8d0a5c868bd7f055356787dd
|
2018-10-19T00:59:31Z
|
mmm a / src / messages . js <nl> ppp b / src / messages . js <nl> function ScriptLineCount ( ) { <nl> <nl> <nl> / * * <nl> - * If sourceURL comment is available and script starts at zero returns sourceURL <nl> - * comment contents . Otherwise , script name is returned . See <nl> + * If sourceURL comment is available returns sourceURL comment contents . <nl> + * Otherwise , script name is returned . See <nl> * http : / / fbug . googlecode . com / svn / branches / firebug1 . 1 / docs / ReleaseNotes_1 . 1 . txt <nl> * and Source Map Revision 3 proposal for details on using / / # sourceURL and <nl> * deprecated / / @ sourceURL comment to identify scripts that don ' t have name . <nl> function ScriptLineCount ( ) { <nl> * deprecated / / @ sourceURL comment otherwise . <nl> * / <nl> function ScriptNameOrSourceURL ( ) { <nl> - if ( this . line_offset > 0 | | this . column_offset > 0 ) { <nl> - return this . name ; <nl> - } <nl> - if ( this . source_url ) { <nl> - return this . source_url ; <nl> - } <nl> + if ( this . source_url ) return this . source_url ; <nl> return this . name ; <nl> } <nl> <nl> mmm a / test / cctest / test - api . cc <nl> ppp b / test / cctest / test - api . cc <nl> void AnalyzeStackOfInlineScriptWithSourceURL ( <nl> v8 : : Handle < v8 : : StackTrace > stackTrace = v8 : : StackTrace : : CurrentStackTrace ( <nl> args . GetIsolate ( ) , 10 , v8 : : StackTrace : : kDetailed ) ; <nl> CHECK_EQ ( 4 , stackTrace - > GetFrameCount ( ) ) ; <nl> - v8 : : Handle < v8 : : String > url = v8_str ( " url " ) ; <nl> + v8 : : Handle < v8 : : String > url = v8_str ( " source_url " ) ; <nl> for ( int i = 0 ; i < 3 ; i + + ) { <nl> v8 : : Handle < v8 : : String > name = <nl> stackTrace - > GetFrame ( i ) - > GetScriptNameOrSourceURL ( ) ; <nl>
|
[ V8 ] Don ' t ignore sourceURL comment in inline scripts in . stack
|
v8/v8
|
9f6b1333a10ba27cfb59dedc705cd5917ca702cd
|
2015-03-31T19:36:06Z
|
mmm a / folly / Portability . h <nl> ppp b / folly / Portability . h <nl> constexpr auto kIsObjC = true ; <nl> constexpr auto kIsObjC = false ; <nl> # endif <nl> <nl> + # if FOLLY_MOBILE <nl> + constexpr auto kIsMobile = true ; <nl> + # else <nl> + constexpr auto kIsMobile = false ; <nl> + # endif <nl> + <nl> # if defined ( __linux__ ) & & ! FOLLY_MOBILE <nl> constexpr auto kIsLinux = true ; <nl> # else <nl> mmm a / folly / detail / Futex . cpp <nl> ppp b / folly / detail / Futex . cpp <nl> <nl> <nl> # include < folly / detail / Futex . h > <nl> # include < boost / intrusive / list . hpp > <nl> + # include < folly / Indestructible . h > <nl> # include < folly / ScopeGuard . h > <nl> # include < folly / hash / Hash . h > <nl> # include < folly / portability / SysSyscall . h > <nl> # include < stdint . h > <nl> # include < string . h > <nl> + # include < array > <nl> # include < cerrno > <nl> # include < condition_variable > <nl> # include < mutex > <nl> struct EmulatedFutexBucket { <nl> std : : mutex mutex_ ; <nl> boost : : intrusive : : list < EmulatedFutexWaitNode > waiters_ ; <nl> <nl> - static const size_t kNumBuckets = 4096 ; <nl> + static constexpr size_t const kNumBuckets = kIsMobile ? 256 : 4096 ; <nl> <nl> static EmulatedFutexBucket & bucketFor ( void * addr ) { <nl> - static auto gBuckets = new EmulatedFutexBucket [ kNumBuckets ] ; <nl> - uint64_t mixedBits = folly : : hash : : twang_mix64 ( <nl> - reinterpret_cast < uintptr_t > ( addr ) ) ; <nl> - return gBuckets [ mixedBits % kNumBuckets ] ; <nl> + / / Statically allocating this lets us use this in allocation - sensitive <nl> + / / contexts . This relies on the assumption that std : : mutex won ' t dynamically <nl> + / / allocate memory , which we assume to be the case on Linux and iOS . <nl> + static Indestructible < std : : array < EmulatedFutexBucket , kNumBuckets > > <nl> + gBuckets ; <nl> + uint64_t mixedBits = <nl> + folly : : hash : : twang_mix64 ( reinterpret_cast < uintptr_t > ( addr ) ) ; <nl> + return ( * gBuckets ) [ mixedBits % kNumBuckets ] ; <nl> } <nl> } ; <nl> <nl>
|
Statically allocate futex array
|
facebook/folly
|
0d13183a2c02539d216e6f16f8b27a8ffb359190
|
2017-12-03T01:51:46Z
|
mmm a / src / ast . cc <nl> ppp b / src / ast . cc <nl> void AstConstructionVisitor : : VisitCallRuntime ( CallRuntime * node ) { <nl> / / Don ' t try to inline JS runtime calls because we don ' t ( currently ) even <nl> / / optimize them . <nl> add_flag ( kDontInline ) ; <nl> - } else if ( node - > function ( ) - > intrinsic_type = = Runtime : : INLINE & & <nl> - node - > raw_name ( ) - > IsOneByteEqualTo ( " _Arguments " ) ) { <nl> - / / Don ' t inline the % _Arguments because it ' s implementation will not work . <nl> - / / There is no stack frame to get them from . <nl> - add_flag ( kDontInline ) ; <nl> } <nl> } <nl> <nl> mmm a / src / hydrogen . cc <nl> ppp b / src / hydrogen . cc <nl> bool HOptimizedGraphBuilder : : TryInline ( Handle < JSFunction > target , <nl> HConstant * context = Add < HConstant > ( Handle < Context > ( target - > context ( ) ) ) ; <nl> inner_env - > BindContext ( context ) ; <nl> <nl> - HArgumentsObject * arguments_object = NULL ; <nl> - <nl> - / / If the function uses arguments object create and bind one , also copy <nl> + / / Create a dematerialized arguments object for the function , also copy the <nl> / / current arguments values to use them for materialization . <nl> + HEnvironment * arguments_env = inner_env - > arguments_environment ( ) ; <nl> + int parameter_count = arguments_env - > parameter_count ( ) ; <nl> + HArgumentsObject * arguments_object = Add < HArgumentsObject > ( parameter_count ) ; <nl> + for ( int i = 0 ; i < parameter_count ; i + + ) { <nl> + arguments_object - > AddArgument ( arguments_env - > Lookup ( i ) , zone ( ) ) ; <nl> + } <nl> + <nl> + / / If the function uses arguments object then bind bind one . <nl> if ( function - > scope ( ) - > arguments ( ) ! = NULL ) { <nl> ASSERT ( function - > scope ( ) - > arguments ( ) - > IsStackAllocated ( ) ) ; <nl> - HEnvironment * arguments_env = inner_env - > arguments_environment ( ) ; <nl> - int arguments_count = arguments_env - > parameter_count ( ) ; <nl> - arguments_object = Add < HArgumentsObject > ( arguments_count ) ; <nl> inner_env - > Bind ( function - > scope ( ) - > arguments ( ) , arguments_object ) ; <nl> - for ( int i = 0 ; i < arguments_count ; i + + ) { <nl> - arguments_object - > AddArgument ( arguments_env - > Lookup ( i ) , zone ( ) ) ; <nl> - } <nl> } <nl> <nl> / / Capture the state before invoking the inlined function for deopt in the <nl> void HOptimizedGraphBuilder : : GenerateArgumentsLength ( CallRuntime * call ) { <nl> <nl> <nl> void HOptimizedGraphBuilder : : GenerateArguments ( CallRuntime * call ) { <nl> - / / Our implementation of arguments ( based on this stack frame or an <nl> - / / adapter below it ) does not work for inlined functions . This runtime <nl> - / / function is blacklisted by AstNode : : IsInlineable . <nl> - ASSERT ( function_state ( ) - > outer ( ) = = NULL ) ; <nl> ASSERT ( call - > arguments ( ) - > length ( ) = = 1 ) ; <nl> CHECK_ALIVE ( VisitForValue ( call - > arguments ( ) - > at ( 0 ) ) ) ; <nl> HValue * index = Pop ( ) ; <nl> - HInstruction * elements = Add < HArgumentsElements > ( false ) ; <nl> - HInstruction * length = Add < HArgumentsLength > ( elements ) ; <nl> - HInstruction * checked_index = Add < HBoundsCheck > ( index , length ) ; <nl> - HAccessArgumentsAt * result = New < HAccessArgumentsAt > ( <nl> - elements , length , checked_index ) ; <nl> + HInstruction * result = NULL ; <nl> + if ( function_state ( ) - > outer ( ) = = NULL ) { <nl> + HInstruction * elements = Add < HArgumentsElements > ( false ) ; <nl> + HInstruction * length = Add < HArgumentsLength > ( elements ) ; <nl> + HInstruction * checked_index = Add < HBoundsCheck > ( index , length ) ; <nl> + result = New < HAccessArgumentsAt > ( elements , length , checked_index ) ; <nl> + } else { <nl> + EnsureArgumentsArePushedForAccess ( ) ; <nl> + <nl> + / / Number of arguments without receiver . <nl> + HInstruction * elements = function_state ( ) - > arguments_elements ( ) ; <nl> + int argument_count = environment ( ) - > <nl> + arguments_environment ( ) - > parameter_count ( ) - 1 ; <nl> + HInstruction * length = Add < HConstant > ( argument_count ) ; <nl> + HInstruction * checked_key = Add < HBoundsCheck > ( index , length ) ; <nl> + result = New < HAccessArgumentsAt > ( elements , length , checked_key ) ; <nl> + } <nl> return ast_context ( ) - > ReturnInstruction ( result , call - > id ( ) ) ; <nl> } <nl> <nl> mmm a / test / mjsunit / compiler / inline - arguments . js <nl> ppp b / test / mjsunit / compiler / inline - arguments . js <nl> test_toarr ( toarr2 ) ; <nl> delete forceDeopt . deopt ; <nl> outer ( ) ; <nl> } ) ( ) ; <nl> + <nl> + <nl> + / / Test inlining of functions with % _Arguments and % _ArgumentsLength intrinsic . <nl> + ( function ( ) { <nl> + function inner ( len , a , b , c ) { <nl> + assertSame ( len , % _ArgumentsLength ( ) ) ; <nl> + for ( var i = 1 ; i < len ; + + i ) { <nl> + var c = String . fromCharCode ( 96 + i ) ; <nl> + assertSame ( c , % _Arguments ( i ) ) ; <nl> + } <nl> + } <nl> + <nl> + function outer ( ) { <nl> + inner ( 1 ) ; <nl> + inner ( 2 , ' a ' ) ; <nl> + inner ( 3 , ' a ' , ' b ' ) ; <nl> + inner ( 4 , ' a ' , ' b ' , ' c ' ) ; <nl> + inner ( 5 , ' a ' , ' b ' , ' c ' , ' d ' ) ; <nl> + inner ( 6 , ' a ' , ' b ' , ' c ' , ' d ' , ' e ' ) ; <nl> + } <nl> + <nl> + outer ( ) ; <nl> + outer ( ) ; <nl> + % OptimizeFunctionOnNextCall ( outer ) ; <nl> + outer ( ) ; <nl> + } ) ( ) ; <nl>
|
Allow inlining of functions containing % _Arguments .
|
v8/v8
|
7a4054b7d7db60d7031736ea0fabc24950c68a72
|
2014-06-27T11:04:35Z
|
mmm a / hphp / hack / src / decl / direct_decl_smart_constructors . rs <nl> ppp b / hphp / hack / src / decl / direct_decl_smart_constructors . rs <nl> impl < ' a > DirectDeclSmartConstructors < ' a > { <nl> self . convert_tapply_to_tgeneric ( tk ) , <nl> self . convert_tapply_to_tgeneric ( tv ) , <nl> ) ) ) , <nl> + Ty_ : : Ttuple ( tys ) = > Ty_ : : Ttuple ( <nl> + self . slice_from_iter ( <nl> + tys . iter ( ) <nl> + . map ( | & targ | self . convert_tapply_to_tgeneric ( targ ) ) , <nl> + ) , <nl> + ) , <nl> _ = > return ty , <nl> } ; <nl> Ty ( ty . 0 , self . alloc ( ty_ ) ) <nl> mmm a / hphp / hack / test / decl / constraints_mentioning_tparams_in_same_list . php <nl> ppp b / hphp / hack / test / decl / constraints_mentioning_tparams_in_same_list . php <nl> <nl> - < ? hh <nl> + < ? hh / / strict <nl> + <nl> + class E < Ta , Tb > { } <nl> <nl> interface I < <nl> Ta as arraykey , <nl> interface I < <nl> Tdarr as darray < Ta , Tb > , <nl> Tvarr as varray < Ta > , <nl> Tvdarr as varray_or_darray < Ta , Tb > , <nl> - > { } <nl> + Ttuple as ( Ta , Tb ) , <nl> + > { } <nl> mmm a / hphp / hack / test / decl / constraints_mentioning_tparams_in_same_list . php . exp <nl> ppp b / hphp / hack / test / decl / constraints_mentioning_tparams_in_same_list . php . exp <nl> <nl> Parsed decls : <nl> <nl> { Direct_decl_parser . classes = <nl> - { " \ \ I " - > <nl> + { " \ \ E " - > <nl> + { Shallow_decl_defs . sc_mode = Mstrict ; sc_final = false ; <nl> + sc_is_xhp = false ; sc_has_xhp_keyword = false ; sc_kind = Cnormal ; <nl> + sc_name = ( [ 3 : 7 - 8 ] , " \ \ E " ) ; <nl> + sc_tparams = <nl> + [ ( Invariant , ( [ 3 : 9 - 11 ] , " Ta " ) , [ ] , Erased ) ; <nl> + ( Invariant , ( [ 3 : 13 - 15 ] , " Tb " ) , [ ] , Erased ) ] ; <nl> + sc_where_constraints = [ ] ; sc_extends = [ ] ; sc_uses = [ ] ; <nl> + sc_xhp_attr_uses = [ ] ; sc_req_extends = [ ] ; sc_req_implements = [ ] ; <nl> + sc_implements = [ ] ; sc_consts = [ ] ; sc_typeconsts = [ ] ; <nl> + sc_pu_enums = [ ] ; sc_props = [ ] ; sc_sprops = [ ] ; sc_constructor = None ; <nl> + sc_static_methods = [ ] ; sc_methods = [ ] ; sc_user_attributes = [ ] ; <nl> + sc_enum_type = None ; sc_decl_errors = < opaque > } ; <nl> + " \ \ I " - > <nl> { Shallow_decl_defs . sc_mode = Mstrict ; sc_final = false ; <nl> sc_is_xhp = false ; sc_has_xhp_keyword = false ; sc_kind = Cinterface ; <nl> - sc_name = ( [ 3 : 11 - 12 ] , " \ \ I " ) ; <nl> + sc_name = ( [ 5 : 11 - 12 ] , " \ \ I " ) ; <nl> sc_tparams = <nl> - [ ( Invariant , ( [ 4 : 3 - 5 ] , " Ta " ) , <nl> + [ ( Invariant , ( [ 6 : 3 - 5 ] , " Ta " ) , <nl> [ ( Constraint_as , <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 4 , characters 9 - 16 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 6 , characters 9 - 16 ) , <nl> ( Tprim Tarraykey ) ) ) <nl> ] , <nl> Erased ) ; <nl> - ( Invariant , ( [ 5 : 3 - 5 ] , " Tb " ) , <nl> + ( Invariant , ( [ 7 : 3 - 5 ] , " Tb " ) , <nl> [ ( Constraint_as , <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 5 , characters 9 - 10 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 7 , characters 9 - 10 ) , <nl> ( Tgeneric ( " Ta " , [ ] ) ) ) ) <nl> ] , <nl> Erased ) ; <nl> - ( Invariant , ( [ 6 : 3 - 5 ] , " Tc " ) , <nl> + ( Invariant , ( [ 8 : 3 - 5 ] , " Tc " ) , <nl> [ ( Constraint_as , <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 6 , characters 9 - 10 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 8 , characters 9 - 10 ) , <nl> ( Tgeneric ( " Td " , [ ] ) ) ) ) <nl> ] , <nl> Erased ) ; <nl> - ( Invariant , ( [ 7 : 3 - 5 ] , " Td " ) , <nl> + ( Invariant , ( [ 9 : 3 - 5 ] , " Td " ) , <nl> [ ( Constraint_as , <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 7 , characters 9 - 17 ) , <nl> - ( Tapply ( ( [ 7 : 9 - 10 ] , " \ \ E " ) , <nl> - [ ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 7 , characters 11 - 12 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 9 , characters 9 - 17 ) , <nl> + ( Tapply ( ( [ 9 : 9 - 10 ] , " \ \ E " ) , <nl> + [ ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 9 , characters 11 - 12 ) , <nl> ( Tgeneric ( " Ta " , [ ] ) ) ) ; <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 7 , characters 15 - 16 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 9 , characters 15 - 16 ) , <nl> ( Tgeneric ( " Tf " , [ ] ) ) ) <nl> ] <nl> ) ) ) ) <nl> ] , <nl> Erased ) ; <nl> - ( Invariant , ( [ 8 : 3 - 5 ] , " Tf " ) , [ ] , Erased ) ; <nl> - ( Invariant , ( [ 9 : 3 - 7 ] , " Tarr " ) , <nl> + ( Invariant , ( [ 10 : 3 - 5 ] , " Tf " ) , [ ] , Erased ) ; <nl> + ( Invariant , ( [ 11 : 3 - 7 ] , " Tarr " ) , <nl> [ ( Constraint_as , <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 9 , characters 11 - 19 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 11 , characters 11 - 19 ) , <nl> ( Tarray ( <nl> - ( Some ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 9 , characters 17 - 18 ) , <nl> + ( Some ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 11 , characters 17 - 18 ) , <nl> ( Tgeneric ( " Ta " , [ ] ) ) ) ) , <nl> None ) ) ) ) <nl> ] , <nl> Erased ) ; <nl> - ( Invariant , ( [ 10 : 3 - 8 ] , " Tlike " ) , <nl> + ( Invariant , ( [ 12 : 3 - 8 ] , " Tlike " ) , <nl> [ ( Constraint_as , <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 10 , characters 12 - 14 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 12 , characters 12 - 14 ) , <nl> ( Tlike <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 10 , characters 13 - 14 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 12 , characters 13 - 14 ) , <nl> ( Tgeneric ( " Ta " , [ ] ) ) ) ) ) ) <nl> ] , <nl> Erased ) ; <nl> - ( Invariant , ( [ 11 : 3 - 7 ] , " Topt " ) , <nl> + ( Invariant , ( [ 13 : 3 - 7 ] , " Topt " ) , <nl> [ ( Constraint_as , <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 11 , characters 11 - 13 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 13 , characters 11 - 13 ) , <nl> ( Toption <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 11 , characters 12 - 13 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 13 , characters 12 - 13 ) , <nl> ( Tgeneric ( " Ta " , [ ] ) ) ) ) ) ) <nl> ] , <nl> Erased ) ; <nl> - ( Invariant , ( [ 12 : 3 - 7 ] , " Tfun " ) , <nl> + ( Invariant , ( [ 14 : 3 - 7 ] , " Tfun " ) , <nl> [ ( Constraint_as , <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 12 , characters 11 - 28 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 14 , characters 11 - 28 ) , <nl> ( Tfun <nl> { ft_arity = ( Fstandard ( ) ) ; ft_tparams = [ ] ; <nl> ft_where_constraints = [ ] ; <nl> ft_params = <nl> - [ { fp_pos = [ 12 : 21 - 23 ] ; fp_name = None ; <nl> + [ { fp_pos = [ 14 : 21 - 23 ] ; fp_name = None ; <nl> fp_type = <nl> { et_enforced = false ; <nl> et_type = <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 12 , characters 21 - 22 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 14 , characters 21 - 22 ) , <nl> ( Tgeneric ( " Ta " , [ ] ) ) ) <nl> } ; <nl> fp_flags = <nl> Parsed decls : <nl> ft_ret = <nl> { et_enforced = false ; <nl> et_type = <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 12 , characters 26 - 27 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 14 , characters 26 - 27 ) , <nl> ( Tgeneric ( " Tb " , [ ] ) ) ) <nl> } ; <nl> ft_flags = <nl> ( make_ft_flags sync none ~ return_disposable : false ~ returns_mutable : false <nl> ~ returns_void_to_rx : false ) ; <nl> ft_reactive = Nonreactive } ) ) ) ] , Erased ) ; <nl> - ( Invariant , ( [ 13 : 3 - 9 ] , " Tshape " ) , <nl> + ( Invariant , ( [ 15 : 3 - 9 ] , " Tshape " ) , <nl> [ ( Constraint_as , <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 13 , characters 13 - 28 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 15 , characters 13 - 28 ) , <nl> ( Tshape ( Closed_shape , <nl> - { ( SFlit_str ( [ 13 : 19 - 22 ] , " a " ) ) - > <nl> + { ( SFlit_str ( [ 15 : 19 - 22 ] , " a " ) ) - > <nl> { sft_optional = false ; <nl> sft_ty = <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 13 , characters 26 - 27 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 15 , characters 26 - 27 ) , <nl> ( Tgeneric ( " Ta " , [ ] ) ) ) <nl> } } <nl> ) ) ) ) <nl> ] , Erased ) ; <nl> - ( Invariant , ( [ 14 : 3 - 8 ] , " Tdarr " ) , <nl> + ( Invariant , ( [ 16 : 3 - 8 ] , " Tdarr " ) , <nl> [ ( Constraint_as , <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 14 , characters 12 - 25 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 16 , characters 12 - 25 ) , <nl> ( Tdarray ( <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 14 , characters 19 - 20 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 16 , characters 19 - 20 ) , <nl> ( Tgeneric ( " Ta " , [ ] ) ) ) , <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 14 , characters 23 - 24 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 16 , characters 23 - 24 ) , <nl> ( Tgeneric ( " Tb " , [ ] ) ) ) <nl> ) ) ) ) ] , Erased ) ; <nl> - ( Invariant , ( [ 15 : 3 - 8 ] , " Tvarr " ) , <nl> + ( Invariant , ( [ 17 : 3 - 8 ] , " Tvarr " ) , <nl> [ ( Constraint_as , <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 15 , characters 12 - 21 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 17 , characters 12 - 21 ) , <nl> ( Tvarray <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 15 , characters 19 - 20 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 17 , characters 19 - 20 ) , <nl> ( Tgeneric ( " Ta " , [ ] ) ) ) ) ) ) <nl> ] , Erased ) ; <nl> - ( Invariant , ( [ 16 : 3 - 9 ] , " Tvdarr " ) , <nl> + ( Invariant , ( [ 18 : 3 - 9 ] , " Tvdarr " ) , <nl> [ ( Constraint_as , <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 16 , characters 13 - 36 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 18 , characters 13 - 36 ) , <nl> ( Tvarray_or_darray <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 16 , characters 30 - 31 ) , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 18 , characters 30 - 31 ) , <nl> ( Tgeneric ( " Ta " , [ ] ) ) ) , <nl> - ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 16 , characters 34 - 35 ) , <nl> - ( Tgeneric ( " Tb " , [ ] ) ) ) ) ) ) ] , Erased ) ] ; sc_where_constraints = [ ] ; <nl> - sc_extends = [ ] ; sc_uses = [ ] ; sc_xhp_attr_uses = [ ] ; sc_req_extends = [ ] ; <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 18 , characters 34 - 35 ) , <nl> + ( Tgeneric ( " Tb " , [ ] ) ) ) ) ) ) ] , Erased ) ; <nl> + ( Invariant , ( [ 19 : 3 - 9 ] , " Ttuple " ) , <nl> + [ ( Constraint_as , <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 19 , characters 13 - 20 ) , <nl> + ( Ttuple <nl> + [ ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 19 , characters 14 - 15 ) , <nl> + ( Tgeneric ( " Ta " , [ ] ) ) ) ; <nl> + ( Rhint ( root | constraints_mentioning_tparams_in_same_list . php line 19 , characters 18 - 19 ) , <nl> + ( Tgeneric ( " Tb " , [ ] ) ) ) <nl> + ] ) ) ) ] , Erased ) ] ; sc_where_constraints = [ ] ; sc_extends = [ ] ; <nl> + sc_uses = [ ] ; sc_xhp_attr_uses = [ ] ; sc_req_extends = [ ] ; <nl> sc_req_implements = [ ] ; sc_implements = [ ] ; sc_consts = [ ] ; <nl> sc_typeconsts = [ ] ; sc_pu_enums = [ ] ; sc_props = [ ] ; sc_sprops = [ ] ; <nl> sc_constructor = None ; sc_static_methods = [ ] ; sc_methods = [ ] ; <nl> mmm a / hphp / hack / test / decl / constraints_mentioning_tparams_in_same_list . php . typecheck . exp <nl> ppp b / hphp / hack / test / decl / constraints_mentioning_tparams_in_same_list . php . typecheck . exp <nl> <nl> - File " constraints_mentioning_tparams_in_same_list . php " , line 10 , characters 12 - 14 : <nl> + File " constraints_mentioning_tparams_in_same_list . php " , line 12 , characters 12 - 14 : <nl> Cannot use experimental feature : like - types ( Other [ 0000 ] ) <nl> - File " constraints_mentioning_tparams_in_same_list . php " , line 7 , characters 9 - 9 : <nl> - Unbound name : ` E ` ( Naming [ 2049 ] ) <nl>
|
Missing tuple case in convert_tapply_to_tgeneric
|
facebook/hhvm
|
892417851eeaba906bc732e112ef712bfff814dd
|
2020-09-03T00:42:08Z
|
mmm a / test / unittests / compiler - dispatcher / compiler - dispatcher - unittest . cc <nl> ppp b / test / unittests / compiler - dispatcher / compiler - dispatcher - unittest . cc <nl> TEST_F ( CompilerDispatcherTest , FinishNowDuringAbortAll ) { <nl> / / Force the compilation to finish , even while aborting . <nl> ASSERT_TRUE ( dispatcher . FinishNow ( shared ) ) ; <nl> ASSERT_TRUE ( dispatcher . jobs_ . empty ( ) ) ; <nl> - { <nl> + for ( ; ; ) { <nl> base : : LockGuard < base : : Mutex > lock ( & dispatcher . mutex_ ) ; <nl> - ASSERT_FALSE ( dispatcher . abort_ ) ; <nl> + if ( dispatcher . num_background_tasks_ = = 0 ) { <nl> + ASSERT_FALSE ( dispatcher . abort_ ) ; <nl> + break ; <nl> + } <nl> } <nl> <nl> ASSERT_TRUE ( platform . ForegroundTasksPending ( ) ) ; <nl>
|
Next attempt to deflake CompilerDispatcherTest
|
v8/v8
|
7bd0c1d5bb899d67b8a785ee4821e5a30c3bc24b
|
2017-03-17T16:23:03Z
|
mmm a / fdbclient / MasterProxyInterface . h <nl> ppp b / fdbclient / MasterProxyInterface . h <nl> struct CommitTransactionRequest : TimedRequest { <nl> ReplyPromise < CommitID > reply ; <nl> uint32_t flags ; <nl> Optional < UID > debugID ; <nl> + Optional < TransactionCommitCostEstimation > commitCostEstimation ; <nl> + Optional < TagSet > tagSet ; <nl> <nl> CommitTransactionRequest ( ) : flags ( 0 ) { } <nl> <nl> template < class Ar > <nl> void serialize ( Ar & ar ) { <nl> - serializer ( ar , transaction , reply , arena , flags , debugID , spanContext ) ; <nl> + serializer ( ar , transaction , reply , arena , flags , debugID , commitCostEstimation , tagSet , spanContext ) ; <nl> } <nl> } ; <nl> <nl> mmm a / fdbclient / NativeAPI . actor . cpp <nl> ppp b / fdbclient / NativeAPI . actor . cpp <nl> void TransactionOptions : : clear ( ) { <nl> tags = TagSet { } ; <nl> readTags = TagSet { } ; <nl> priority = TransactionPriority : : DEFAULT ; <nl> + expensiveClearCostEstimation = false ; <nl> } <nl> <nl> TransactionOptions : : TransactionOptions ( ) { <nl> void Transaction : : setupWatches ( ) { <nl> } <nl> } <nl> <nl> + ACTOR Future < TransactionCommitCostEstimation > estimateCommitCosts ( Transaction * self , <nl> + CommitTransactionRef * transaction ) { <nl> + state MutationRef * it = transaction - > mutations . begin ( ) ; <nl> + state MutationRef * end = transaction - > mutations . end ( ) ; <nl> + state TransactionCommitCostEstimation trCommitCosts ; <nl> + state KeyRange keyRange ; <nl> + for ( ; it ! = end ; + + it ) { <nl> + if ( it - > type = = MutationRef : : Type : : SetValue ) { <nl> + trCommitCosts . bytesWrite + = it - > expectedSize ( ) ; <nl> + trCommitCosts . numWrite + + ; <nl> + } else if ( it - > isAtomicOp ( ) ) { <nl> + trCommitCosts . bytesAtomicWrite + = it - > expectedSize ( ) ; <nl> + trCommitCosts . numAtomicWrite + + ; <nl> + } else if ( it - > type = = MutationRef : : Type : : ClearRange ) { <nl> + trCommitCosts . numClear + + ; <nl> + keyRange = KeyRange ( KeyRangeRef ( it - > param1 , it - > param2 ) ) ; <nl> + if ( self - > options . expensiveClearCostEstimation ) { <nl> + StorageMetrics m = wait ( self - > getStorageMetrics ( keyRange , std : : numeric_limits < int > : : max ( ) ) ) ; <nl> + trCommitCosts . bytesClearEst + = m . bytes ; <nl> + } <nl> + else { <nl> + std : : vector < pair < KeyRange , Reference < LocationInfo > > > locations = wait ( getKeyRangeLocations ( <nl> + self - > getDatabase ( ) , keyRange , std : : numeric_limits < int > : : max ( ) , false , & StorageServerInterface : : getShardState , self - > info ) ) ; <nl> + trCommitCosts . numClearShards + = locations . size ( ) ; <nl> + } <nl> + } <nl> + } <nl> + return trCommitCosts ; <nl> + } <nl> + <nl> ACTOR static Future < Void > tryCommit ( Database cx , Reference < TransactionLogInfo > trLogInfo , CommitTransactionRequest req , Future < Version > readVersion , TransactionInfo info , Version * pCommittedVersion , Transaction * tr , TransactionOptions options ) { <nl> state TraceInterval interval ( " TransactionCommit " ) ; <nl> state double startTime = now ( ) ; <nl> ACTOR static Future < Void > tryCommit ( Database cx , Reference < TransactionLogInfo > <nl> commit_unknown_result ( ) } ) ; <nl> } <nl> <nl> - Version v = wait ( readVersion ) ; <nl> - req . transaction . read_snapshot = v ; <nl> + if ( ! req . tagSet . present ( ) ) { <nl> + wait ( store ( req . transaction . read_snapshot , readVersion ) ) ; <nl> + } else { <nl> + req . commitCostEstimation = TransactionCommitCostEstimation ( ) ; <nl> + wait ( store ( req . transaction . read_snapshot , readVersion ) & & store ( req . commitCostEstimation . get ( ) , estimateCommitCosts ( tr , & req . transaction ) ) ) ; <nl> + } <nl> <nl> startTime = now ( ) ; <nl> state Optional < UID > commitID = Optional < UID > ( ) ; <nl> ACTOR static Future < Void > tryCommit ( Database cx , Reference < TransactionLogInfo > <nl> } <nl> } <nl> <nl> + <nl> Future < Void > Transaction : : commitMutations ( ) { <nl> try { <nl> / / if this is a read - only transaction return immediately <nl> Future < Void > Transaction : : commitMutations ( ) { <nl> <nl> cx - > mutationsPerCommit . addSample ( tr . transaction . mutations . size ( ) ) ; <nl> cx - > bytesPerCommit . addSample ( tr . transaction . mutations . expectedSize ( ) ) ; <nl> + if ( options . tags . size ( ) ) <nl> + tr . tagSet = options . tags ; <nl> <nl> size_t transactionSize = getSize ( ) ; <nl> if ( transactionSize > ( uint64_t ) FLOW_KNOBS - > PACKET_WARNING ) { <nl> void Transaction : : setOption ( FDBTransactionOptions : : Option option , Optional < Stri <nl> span . addParent ( BinaryReader : : fromStringRef < UID > ( value . get ( ) , Unversioned ( ) ) ) ; <nl> break ; <nl> <nl> - case FDBTransactionOptions : : REPORT_CONFLICTING_KEYS : <nl> - validateOptionValue ( value , false ) ; <nl> - options . reportConflictingKeys = true ; <nl> - break ; <nl> + case FDBTransactionOptions : : REPORT_CONFLICTING_KEYS : <nl> + validateOptionValue ( value , false ) ; <nl> + options . reportConflictingKeys = true ; <nl> + break ; <nl> + <nl> + case FDBTransactionOptions : : EXPENSIVE_CLEAR_COST_ESTIMATION_ENABLE : <nl> + validateOptionValue ( value , false ) ; <nl> + options . expensiveClearCostEstimation = true ; <nl> + break ; <nl> <nl> - default : <nl> + default : <nl> break ; <nl> } <nl> } <nl> mmm a / fdbclient / NativeAPI . actor . h <nl> ppp b / fdbclient / NativeAPI . actor . h <nl> struct TransactionOptions { <nl> bool firstInBatch : 1 ; <nl> bool includePort : 1 ; <nl> bool reportConflictingKeys : 1 ; <nl> + bool expensiveClearCostEstimation : 1 ; <nl> <nl> TransactionPriority priority ; <nl> <nl> mmm a / fdbclient / vexillographer / fdb . options <nl> ppp b / fdbclient / vexillographer / fdb . options <nl> description is not currently required but encouraged . <nl> description = " Adds a tag to the transaction that can be used to apply manual or automatic targeted throttling . At most 5 tags can be set on a transaction . " / > <nl> < Option name = " span_parent " code = " 900 " paramType = " Bytes " paramDescription = " A byte string of length 16 used to associate the span of this transaction with a parent " <nl> description = " Adds a parent to the Span of this transaction . Used for transaction tracing . A span can be identified with any 16 bytes " / > <nl> + < Option name = " expensive_clear_cost_estimation_enable " code = " 1000 " <nl> + description = " Asks storage servers for how many bytes a clear key range contains . Otherwise uses the location cache to roughly estimate this . " / > <nl> < / Scope > <nl> <nl> < ! - - The enumeration values matter - do not change them without <nl> mmm a / fdbserver / MasterProxyServer . actor . cpp <nl> ppp b / fdbserver / MasterProxyServer . actor . cpp <nl> struct TransactionRateInfo { <nl> } <nl> } ; <nl> <nl> - <nl> - ACTOR Future < Void > getRate ( UID myID , Reference < AsyncVar < ServerDBInfo > > db , int64_t * inTransactionCount , int64_t * inBatchTransactionCount , TransactionRateInfo * transactionRateInfo , <nl> - TransactionRateInfo * batchTransactionRateInfo , GetHealthMetricsReply * healthMetricsReply , GetHealthMetricsReply * detailedHealthMetricsReply , <nl> - TransactionTagMap < uint64_t > * transactionTagCounter , PrioritizedTransactionTagMap < ClientTagThrottleLimits > * throttledTags ) { <nl> + ACTOR Future < Void > getRate ( UID myID , Reference < AsyncVar < ServerDBInfo > > db , int64_t * inTransactionCount , <nl> + int64_t * inBatchTransactionCount , TransactionRateInfo * transactionRateInfo , <nl> + TransactionRateInfo * batchTransactionRateInfo , GetHealthMetricsReply * healthMetricsReply , <nl> + GetHealthMetricsReply * detailedHealthMetricsReply , <nl> + TransactionTagMap < uint64_t > * transactionTagCounter , <nl> + PrioritizedTransactionTagMap < ClientTagThrottleLimits > * throttledTags , <nl> + TransactionTagMap < TransactionCommitCostEstimation > * transactionTagCommitCostEst ) { <nl> state Future < Void > nextRequestTimer = Never ( ) ; <nl> state Future < Void > leaseTimeout = Never ( ) ; <nl> state Future < GetRateInfoReply > reply = Never ( ) ; <nl> ACTOR Future < Void > getRate ( UID myID , Reference < AsyncVar < ServerDBInfo > > db , int64 <nl> when ( wait ( nextRequestTimer ) ) { <nl> nextRequestTimer = Never ( ) ; <nl> bool detailed = now ( ) - lastDetailedReply > SERVER_KNOBS - > DETAILED_METRIC_UPDATE_RATE ; <nl> - <nl> + <nl> TransactionTagMap < uint64_t > tagCounts ; <nl> for ( auto itr : * throttledTags ) { <nl> for ( auto priorityThrottles : itr . second ) { <nl> tagCounts [ priorityThrottles . first ] = ( * transactionTagCounter ) [ priorityThrottles . first ] ; <nl> } <nl> } <nl> - reply = brokenPromiseToNever ( db - > get ( ) . ratekeeper . get ( ) . getRateInfo . getReply ( GetRateInfoRequest ( myID , * inTransactionCount , * inBatchTransactionCount , tagCounts , detailed ) ) ) ; <nl> + reply = brokenPromiseToNever ( db - > get ( ) . ratekeeper . get ( ) . getRateInfo . getReply ( <nl> + GetRateInfoRequest ( myID , * inTransactionCount , * inBatchTransactionCount , * transactionTagCounter , <nl> + * transactionTagCommitCostEst , detailed ) ) ) ; <nl> transactionTagCounter - > clear ( ) ; <nl> + transactionTagCommitCostEst - > clear ( ) ; <nl> expectingDetailedReply = detailed ; <nl> } <nl> when ( GetRateInfoReply rep = wait ( reply ) ) { <nl> struct ProxyCommitData { <nl> NotifiedDouble lastCommitTime ; <nl> <nl> vector < double > commitComputePerOperation ; <nl> + TransactionTagMap < TransactionCommitCostEstimation > transactionTagCommitCostEst ; <nl> <nl> / / The tag related to a storage server rarely change , so we keep a vector of tags for each key range to be slightly more CPU efficient . <nl> / / When a tag related to a storage server does change , we empty out all of these vectors to signify they must be repopulated . <nl> ACTOR Future < Void > commitBatch ( <nl> if ( committed [ t ] = = ConflictBatch : : TransactionCommitted & & ( ! locked | | trs [ t ] . isLockAware ( ) ) ) { <nl> ASSERT_WE_THINK ( commitVersion ! = invalidVersion ) ; <nl> trs [ t ] . reply . send ( CommitID ( commitVersion , t , metadataVersionAfter ) ) ; <nl> + / / aggregate commit cost estimation if committed <nl> + ASSERT ( trs [ t ] . commitCostEstimation . present ( ) = = trs [ t ] . tagSet . present ( ) ) ; <nl> + if ( trs [ t ] . tagSet . present ( ) ) { <nl> + TransactionCommitCostEstimation & costEstimation = trs [ t ] . commitCostEstimation . get ( ) ; <nl> + for ( auto & tag : trs [ t ] . tagSet . get ( ) ) { <nl> + self - > transactionTagCommitCostEst [ tag ] + = costEstimation ; <nl> + } <nl> + } <nl> } <nl> else if ( committed [ t ] = = ConflictBatch : : TransactionTooOld ) { <nl> trs [ t ] . reply . sendError ( transaction_too_old ( ) ) ; <nl> ACTOR static Future < Void > transactionStarter ( <nl> state PromiseStream < double > replyTimes ; <nl> state Span span ; <nl> <nl> - addActor . send ( getRate ( proxy . id ( ) , db , & transactionCount , & batchTransactionCount , & normalRateInfo , & batchRateInfo , healthMetricsReply , detailedHealthMetricsReply , & transactionTagCounter , & throttledTags ) ) ; <nl> + addActor . send ( getRate ( proxy . id ( ) , db , & transactionCount , & batchTransactionCount , & normalRateInfo , & batchRateInfo , <nl> + healthMetricsReply , detailedHealthMetricsReply , & transactionTagCounter , & throttledTags , <nl> + & ( commitData - > transactionTagCommitCostEst ) ) ) ; <nl> addActor . send ( queueTransactionStartRequests ( db , & systemQueue , & defaultQueue , & batchQueue , proxy . getConsistentReadVersion . getFuture ( ) , <nl> GRVTimer , & lastGRVTime , & GRVBatchTime , replyTimes . getFuture ( ) , & commitData - > stats , & batchRateInfo , <nl> & transactionTagCounter ) ) ; <nl> mmm a / fdbserver / Ratekeeper . actor . cpp <nl> ppp b / fdbserver / Ratekeeper . actor . cpp <nl> ACTOR Future < Void > ratekeeper ( RatekeeperInterface rkInterf , Reference < AsyncVar < S <nl> for ( auto tag : req . throttledTagCounts ) { <nl> self . throttledTags . addRequests ( tag . first , tag . second ) ; <nl> } <nl> + / / TODO process commitCostEstimation <nl> + / / for ( const auto & [ tagName , cost ] : req . throttledTagCommitCostEst ) { <nl> + / / <nl> + / / } <nl> } <nl> if ( p . batchTransactions > 0 ) { <nl> self . smoothBatchReleasedTransactions . addDelta ( req . batchReleasedTransactions - p . batchTransactions ) ; <nl> mmm a / fdbserver / RatekeeperInterface . h <nl> ppp b / fdbserver / RatekeeperInterface . h <nl> struct ClientTagThrottleLimits { <nl> } <nl> } ; <nl> <nl> + struct TransactionCommitCostEstimation { <nl> + int numWrite = 0 ; <nl> + int numAtomicWrite = 0 ; <nl> + int numClear = 0 ; <nl> + int numClearShards = 0 ; <nl> + uint64_t bytesWrite = 0 ; <nl> + uint64_t bytesAtomicWrite = 0 ; <nl> + uint64_t bytesClearEst = 0 ; <nl> + <nl> + template < class Ar > <nl> + void serialize ( Ar & ar ) { <nl> + serializer ( ar , bytesWrite , bytesClearEst , bytesAtomicWrite , numWrite , numAtomicWrite , numClear , numClearShards ) ; <nl> + } <nl> + <nl> + TransactionCommitCostEstimation & operator + = ( const TransactionCommitCostEstimation & other ) { <nl> + numWrite + = other . numWrite ; <nl> + numAtomicWrite + = other . numAtomicWrite ; <nl> + numClear + = other . numClear ; <nl> + bytesWrite + = other . bytesWrite ; <nl> + bytesAtomicWrite + = other . numAtomicWrite ; <nl> + numClearShards + = other . numClearShards ; <nl> + bytesClearEst + = other . bytesClearEst ; <nl> + return * this ; <nl> + } <nl> + } ; <nl> + <nl> struct GetRateInfoReply { <nl> constexpr static FileIdentifier file_identifier = 7845006 ; <nl> double transactionRate ; <nl> struct GetRateInfoRequest { <nl> int64_t batchReleasedTransactions ; <nl> <nl> TransactionTagMap < uint64_t > throttledTagCounts ; <nl> + TransactionTagMap < TransactionCommitCostEstimation > throttledTagCommitCostEst ; <nl> bool detailed ; <nl> ReplyPromise < struct GetRateInfoReply > reply ; <nl> <nl> GetRateInfoRequest ( ) { } <nl> - GetRateInfoRequest ( UID const & requesterID , int64_t totalReleasedTransactions , int64_t batchReleasedTransactions , TransactionTagMap < uint64_t > throttledTagCounts , bool detailed ) <nl> - : requesterID ( requesterID ) , totalReleasedTransactions ( totalReleasedTransactions ) , batchReleasedTransactions ( batchReleasedTransactions ) , throttledTagCounts ( throttledTagCounts ) , detailed ( detailed ) { } <nl> + GetRateInfoRequest ( UID const & requesterID , int64_t totalReleasedTransactions , int64_t batchReleasedTransactions , <nl> + TransactionTagMap < uint64_t > throttledTagCounts , <nl> + TransactionTagMap < TransactionCommitCostEstimation > throttledTagCommitCostEst , bool detailed ) <nl> + : requesterID ( requesterID ) , totalReleasedTransactions ( totalReleasedTransactions ) , <nl> + batchReleasedTransactions ( batchReleasedTransactions ) , throttledTagCounts ( throttledTagCounts ) , <nl> + throttledTagCommitCostEst ( throttledTagCommitCostEst ) , detailed ( detailed ) { } <nl> <nl> template < class Ar > <nl> void serialize ( Ar & ar ) { <nl> - serializer ( ar , requesterID , totalReleasedTransactions , batchReleasedTransactions , throttledTagCounts , detailed , reply ) ; <nl> + serializer ( ar , requesterID , totalReleasedTransactions , batchReleasedTransactions , throttledTagCounts , detailed , reply , throttledTagCommitCostEst ) ; <nl> } <nl> } ; <nl> <nl>
|
Merge pull request from sfc - gh - xwang / master
|
apple/foundationdb
|
f22a6c2bcf88a44f53103103c09a76274ff1a296
|
2020-07-18T03:19:09Z
|
mmm a / Makefile . am <nl> ppp b / Makefile . am <nl> MAJOR_MINOR : = $ ( subst $ ( space ) , . , $ ( wordlist 1 , 2 , $ ( subst . , , $ ( VERSION ) ) ) ) <nl> # # # @ brief source to build before compile <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> <nl> - BUILT_SOURCES = build_posix . h <nl> + BUILT_SOURCES = build . h <nl> <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> # # # @ brief man pages to install <nl> install - data - local : <nl> # # # @ brief version number <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> <nl> - build_posix . h : configure . ac <nl> - @ echo ' # define TRIAGENS_VERSION " @ PACKAGE_VERSION @ " ' > build_posix . h <nl> + build . h : configure . ac <nl> + @ echo ' # ifdef _DEBUG ' > build . h <nl> + @ echo ' # define TRI_VERSION " @ PACKAGE_VERSION @ [ " TRI_PLATFORM " - DEBUG ] " ' > > build . h <nl> + @ echo ' # else ' > > build . h <nl> + @ echo ' # define TRI_VERSION " @ PACKAGE_VERSION @ [ " TRI_PLATFORM " ] " ' > > build . h <nl> + @ echo ' # endif ' > > build . h <nl> + @ echo ' ' > > build . h <nl> <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> # # # @ brief source files <nl> clean - local : <nl> . PHONY : built - sources <nl> <nl> built - sources : \ <nl> - build_posix . h \ <nl> + build . h \ <nl> @ top_srcdir @ / js / common / bootstrap / errors . js \ <nl> @ top_srcdir @ / js / common / modules / org / arangodb / mimetypes . js <nl> <nl> mmm a / arangod / RestHandler / RestReplicationHandler . cpp <nl> ppp b / arangod / RestHandler / RestReplicationHandler . cpp <nl> <nl> <nl> # include " RestReplicationHandler . h " <nl> <nl> - # include " build . h " <nl> + # include " BasicsC / common . h " <nl> + <nl> # include " Basics / JsonHelper . h " <nl> # include " BasicsC / conversions . h " <nl> # include " BasicsC / files . h " <nl> mmm a / arangod / RestServer / ArangoServer . cpp <nl> ppp b / arangod / RestServer / ArangoServer . cpp <nl> <nl> <nl> # include < v8 . h > <nl> <nl> + # include " BasicsC / common . h " <nl> + <nl> # ifdef TRI_ENABLE_MRUBY <nl> # include " mruby . h " <nl> # include " mruby / compile . h " <nl> <nl> # include " mruby / variable . h " <nl> # endif <nl> <nl> - # include " build . h " <nl> - <nl> # include " Utils / DocumentWrapper . h " <nl> <nl> # include " Actions / RestActionHandler . h " <nl> void ArangoServer : : buildApplicationServer ( ) { <nl> _applicationServer - > addFeature ( _applicationAdminServer ) ; <nl> <nl> _applicationAdminServer - > allowLogViewer ( ) ; <nl> - _applicationAdminServer - > allowVersion ( " arango " , TRIAGENS_VERSION ) ; <nl> + _applicationAdminServer - > allowVersion ( " arango " , TRI_VERSION ) ; <nl> _applicationAdminServer - > allowAdminDirectory ( ) ; / / might be changed later <nl> <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> int ArangoServer : : startupServer ( ) { <nl> LOGGER_FATAL_AND_EXIT ( " could not load required authentication information " ) ; <nl> } <nl> <nl> - LOGGER_INFO ( " ArangoDB ( version " < < TRIAGENS_VERSION < < " ) is ready for business . Have fun ! " ) ; <nl> + LOGGER_INFO ( " ArangoDB ( version " < < TRI_VERSION < < " ) is ready for business . Have fun ! " ) ; <nl> <nl> _applicationServer - > wait ( ) ; <nl> <nl> mmm a / arangod / RestServer / VocbaseContext . cpp <nl> ppp b / arangod / RestServer / VocbaseContext . cpp <nl> <nl> <nl> # include " VocbaseContext . h " <nl> <nl> - # include " build . h " <nl> + # include " BasicsC / common . h " <nl> <nl> # include " BasicsC / tri - strings . h " <nl> # include " VocBase / auth . h " <nl> mmm a / arangod / RestServer / VocbaseManager . cpp <nl> ppp b / arangod / RestServer / VocbaseManager . cpp <nl> <nl> <nl> # include " RestServer / VocbaseManager . h " <nl> <nl> - # include " build . h " <nl> + # include " BasicsC / common . h " <nl> <nl> # include " Logger / Logger . h " <nl> # include " Rest / ConnectionInfo . h " <nl> mmm a / arangod / V8Server / v8 - vocbase . cpp <nl> ppp b / arangod / V8Server / v8 - vocbase . cpp <nl> <nl> <nl> # include " v8 - vocbase . h " <nl> <nl> - # include " build . h " <nl> + # include " BasicsC / common . h " <nl> <nl> # include " Logger / Logger . h " <nl> # include " Ahuacatl / ahuacatl - codegen . h " <nl> static v8 : : Handle < v8 : : Value > JS_UpdateVocbase ( v8 : : Arguments const & argv ) { <nl> static v8 : : Handle < v8 : : Value > JS_VersionVocbase ( v8 : : Arguments const & argv ) { <nl> v8 : : HandleScope scope ; <nl> <nl> - return scope . Close ( v8 : : String : : New ( TRIAGENS_VERSION ) ) ; <nl> + return scope . Close ( v8 : : String : : New ( TRI_VERSION ) ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / arangod / VocBase / replication - applier . c <nl> ppp b / arangod / VocBase / replication - applier . c <nl> TRI_json_t * TRI_JsonReplicationApplier ( TRI_replication_applier_t * applier ) { <nl> if ( server ! = NULL ) { <nl> TRI_server_id_t serverId ; <nl> <nl> - TRI_Insert3ArrayJson ( TRI_CORE_MEM_ZONE , server , " version " , TRI_CreateStringCopyJson ( TRI_CORE_MEM_ZONE , TRIAGENS_VERSION ) ) ; <nl> + TRI_Insert3ArrayJson ( TRI_CORE_MEM_ZONE , server , " version " , TRI_CreateStringCopyJson ( TRI_CORE_MEM_ZONE , TRI_VERSION ) ) ; <nl> <nl> serverId = TRI_GetServerId ( ) ; <nl> TRI_Insert3ArrayJson ( TRI_CORE_MEM_ZONE , server , " serverId " , TRI_CreateStringJson ( TRI_CORE_MEM_ZONE , TRI_StringUInt64 ( serverId ) ) ) ; <nl> mmm a / arangod / VocBase / replication - common . h <nl> ppp b / arangod / VocBase / replication - common . h <nl> <nl> # ifndef TRIAGENS_VOC_BASE_REPLICATION_COMMON_H <nl> # define TRIAGENS_VOC_BASE_REPLICATION_COMMON_H 1 <nl> <nl> - # include " build . h " <nl> # include " BasicsC / common . h " <nl> <nl> # include " VocBase / voc - types . h " <nl> mmm a / arangod / VocBase / replication - logger . c <nl> ppp b / arangod / VocBase / replication - logger . c <nl> TRI_json_t * TRI_JsonReplicationLogger ( TRI_replication_logger_t * logger ) { <nl> if ( server ! = NULL ) { <nl> TRI_server_id_t serverId ; <nl> <nl> - TRI_Insert3ArrayJson ( TRI_CORE_MEM_ZONE , server , " version " , TRI_CreateStringCopyJson ( TRI_CORE_MEM_ZONE , TRIAGENS_VERSION ) ) ; <nl> + TRI_Insert3ArrayJson ( TRI_CORE_MEM_ZONE , server , " version " , TRI_CreateStringCopyJson ( TRI_CORE_MEM_ZONE , TRI_VERSION ) ) ; <nl> <nl> serverId = TRI_GetServerId ( ) ; <nl> TRI_Insert3ArrayJson ( TRI_CORE_MEM_ZONE , server , " serverId " , TRI_CreateStringJson ( TRI_CORE_MEM_ZONE , TRI_StringUInt64 ( serverId ) ) ) ; <nl> mmm a / arangoirb / MRClient / arangoirb . cpp <nl> ppp b / arangoirb / MRClient / arangoirb . cpp <nl> <nl> # include < stdio . h > <nl> # include < fstream > <nl> <nl> - # include " build . h " <nl> + # include " BasicsC / common . h " <nl> <nl> # include " ArangoShell / ArangoClient . h " <nl> # include " Basics / FileUtils . h " <nl> int main ( int argc , char * argv [ ] ) { <nl> printf ( " % s \ \ __ , _ | _ | \ \ __ , _ | _ | | _ | \ \ __ , | \ \ ___ / % s | _ | _ | | _ . __ / % s \ n " , g , r , z ) ; <nl> printf ( " % s | ___ / % s % s \ n " , g , r , z ) ; <nl> <nl> - cout < < endl < < " Welcome to arangosh " < < TRIAGENS_VERSION < < " . Copyright ( c ) 2012 triAGENS GmbH " < < endl ; <nl> + cout < < endl < < " Welcome to arangosh " < < TRI_VERSION < < " . Copyright ( c ) 2012 triAGENS GmbH " < < endl ; <nl> <nl> # ifdef TRI_V8_VERSION <nl> cout < < " Using MRUBY " < < TRI_MRUBY_VERSION < < " engine . Copyright ( c ) 2012 mruby developers . " < < endl ; <nl> mmm a / arangosh / Benchmark / arangob . cpp <nl> ppp b / arangosh / Benchmark / arangob . cpp <nl> <nl> # include " Benchmark / BenchmarkOperation . h " <nl> # include " Benchmark / BenchmarkThread . h " <nl> <nl> - # include " build . h " <nl> <nl> using namespace std ; <nl> using namespace triagens : : basics ; <nl> mmm a / arangosh / V8Client / arangoimp . cpp <nl> ppp b / arangosh / V8Client / arangoimp . cpp <nl> <nl> # include " SimpleHttpClient / SimpleHttpResult . h " <nl> # include " V8Client / V8ClientConnection . h " <nl> <nl> - # include " build . h " <nl> <nl> using namespace std ; <nl> using namespace triagens : : basics ; <nl> mmm a / arangosh / V8Client / arangosh . cpp <nl> ppp b / arangosh / V8Client / arangosh . cpp <nl> <nl> # include " V8Client / ImportHelper . h " <nl> # include " V8Client / V8ClientConnection . h " <nl> <nl> - # include " build . h " <nl> - <nl> # include " 3rdParty / valgrind / valgrind . h " <nl> <nl> using namespace std ; <nl> int main ( int argc , char * argv [ ] ) { <nl> <nl> # endif <nl> <nl> - cout < < endl < < " Welcome to arangosh " < < TRIAGENS_VERSION < < " . Copyright ( c ) triAGENS GmbH " < < endl ; <nl> + cout < < endl < < " Welcome to arangosh " < < TRI_VERSION < < " . Copyright ( c ) triAGENS GmbH " < < endl ; <nl> <nl> ostringstream info ; <nl> <nl> mmm a / build . h <nl> ppp b / build . h <nl> <nl> - # ifdef _WIN32 <nl> - # include " build_win . h " <nl> + # ifdef _DEBUG <nl> + # define TRI_VERSION " 1 . 4 . devel [ " TRI_PLATFORM " - DEBUG ] " <nl> # else <nl> - # include " build_posix . h " <nl> - # endif <nl> + # define TRI_VERSION " 1 . 4 . devel [ " TRI_PLATFORM " ] " <nl> + # endif <nl> + <nl> deleted file mode 100644 <nl> index b89b9932843 . . 00000000000 <nl> mmm a / build_posix . h <nl> ppp / dev / null <nl> @ @ - 1 + 0 , 0 @ @ <nl> - # define TRIAGENS_VERSION " 1 . 4 . devel " <nl> deleted file mode 100755 <nl> index c4a5f677e43 . . 00000000000 <nl> mmm a / build_win . h <nl> ppp / dev / null <nl> <nl> - # ifdef _WIN64 <nl> - # define WINDOWS_ARRANGO_VERSION_NUMBER 1 . 4 <nl> - # ifdef _DEBUG <nl> - # define TRIAGENS_VERSION " 1 . 4 [ WIN64 - DEBUG DEVEL ] " <nl> - # else <nl> - # define TRIAGENS_VERSION " 1 . 4 [ WIN64 - RELEASE DEVEL ] " <nl> - # endif <nl> - # else <nl> - # ifdef _DEBUG <nl> - # define TRIAGENS_VERSION " 1 . 4 [ WIN32 - DEBUG DEVEL ] " <nl> - # else <nl> - # define TRIAGENS_VERSION " 1 . 4 [ WIN32 - RELEASE DEVEL ] " <nl> - # endif <nl> - # endif <nl> mmm a / configure . ac <nl> ppp b / configure . ac <nl> dnl = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> dnl - - SECTION - - GENERATE FILES <nl> dnl = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> - BUILD_H = " \ $ ( top_srcdir ) / build_posix . h " <nl> + BUILD_H = " \ $ ( top_srcdir ) / build . h " <nl> AC_SUBST ( BUILD_H ) <nl> <nl> AC_CONFIG_FILES ( [ Makefile Documentation / arango . template ] ) <nl> mmm a / lib / Admin / ApplicationAdminServer . cpp <nl> ppp b / lib / Admin / ApplicationAdminServer . cpp <nl> <nl> <nl> # include " ApplicationAdminServer . h " <nl> <nl> - # include " build . h " <nl> + # include " BasicsC / common . h " <nl> <nl> # include " Admin / RestAdminLogHandler . h " <nl> # include " Admin / RestHandlerCreator . h " <nl> void ApplicationAdminServer : : allowAdminDirectory ( string const & adminDirectory ) <nl> <nl> void ApplicationAdminServer : : allowVersion ( ) { <nl> _allowVersion = true ; <nl> - _version = TRIAGENS_VERSION ; <nl> + _version = TRI_VERSION ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / lib / ApplicationServer / ApplicationServer . cpp <nl> ppp b / lib / ApplicationServer / ApplicationServer . cpp <nl> <nl> <nl> # include " ApplicationServer . h " <nl> <nl> + # include " BasicsC / common . h " <nl> + <nl> # ifdef TRI_HAVE_POSIX_PWD_GRP <nl> # include < pwd . h > <nl> # include < grp . h > <nl> <nl> # include " BasicsC / conversions . h " <nl> # include " Logger / Logger . h " <nl> <nl> - # include " build . h " <nl> - <nl> using namespace triagens : : basics ; <nl> using namespace triagens : : rest ; <nl> using namespace std ; <nl> void ApplicationServer : : prepare2 ( ) { <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> void ApplicationServer : : start ( ) { <nl> - LOGGER_DEBUG ( " ApplicationServer version " < < TRIAGENS_VERSION ) ; <nl> + LOGGER_DEBUG ( " ApplicationServer version " < < TRI_VERSION ) ; <nl> <nl> # ifdef TRI_HAVE_POSIX_THREADS <nl> sigset_t all ; <nl> mmm a / lib / Basics / InitialiseBasics . cpp <nl> ppp b / lib / Basics / InitialiseBasics . cpp <nl> <nl> # include < pthread . h > <nl> # endif <nl> <nl> - # include < build . h > <nl> <nl> namespace triagens { <nl> namespace basics { <nl> namespace triagens { <nl> random . random ( ) ; <nl> Random : : selectVersion ( v ) ; <nl> <nl> - string revision = " $ Revision : BASICS " TRIAGENS_VERSION " ( c ) triAGENS GmbH $ " ; <nl> + string revision = " $ Revision : BASICS " TRI_VERSION " ( c ) triAGENS GmbH $ " ; <nl> LOGGER_TRACE ( revision ) ; <nl> <nl> # ifdef TRI_BROKEN_CXA_GUARD <nl> mmm a / lib / BasicsC / common . h <nl> ppp b / lib / BasicsC / common . h <nl> <nl> # include " BasicsC / operating - system . h " <nl> # include " BasicsC / local - configuration . h " <nl> # include " BasicsC / application - exit . h " <nl> + <nl> + # include " build . h " <nl> # undef TRI_WITHIN_COMMON <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / lib / BasicsC / init . c <nl> ppp b / lib / BasicsC / init . c <nl> <nl> # include " BasicsC / random . h " <nl> # include " BasicsC / socket - utils . h " <nl> <nl> - # include " build . h " <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / - - SECTION - - public functions <nl> void TRI_InitialiseC ( int argc , char * argv [ ] ) { <nl> TRI_InitialiseProcess ( argc , argv ) ; <nl> TRI_InitialiseSockets ( ) ; <nl> <nl> - LOG_TRACE ( " % s " , " $ Revision : BASICS - C " TRIAGENS_VERSION " ( c ) triAGENS GmbH $ " ) ; <nl> + LOG_TRACE ( " % s " , " $ Revision : BASICS - C " TRI_VERSION " ( c ) triAGENS GmbH $ " ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / lib / BasicsC / operating - system . h <nl> ppp b / lib / BasicsC / operating - system . h <nl> <nl> <nl> # if defined ( _WIN32 ) & & defined ( _MSC_VER ) <nl> <nl> + # ifdef _WIN64 <nl> + # define TRI_PLATFORM " win64 " <nl> + # else <nl> # define TRI_PLATFORM " win32 " <nl> + # endif <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief necessary defines and includes <nl> mmm a / lib / Rest / InitialiseRest . cpp <nl> ppp b / lib / Rest / InitialiseRest . cpp <nl> <nl> # error missing thread support for openssl , please recomple OpenSSL with threads <nl> # endif <nl> <nl> - # include " build . h " <nl> + # include " BasicsC / common . h " <nl> <nl> # include " Basics / InitialiseBasics . h " <nl> # include " Logger / Logger . h " <nl> namespace triagens { <nl> TRI_InitialiseUrl ( ) ; <nl> TRI_InitialiseStatistics ( ) ; <nl> <nl> - string revision = " $ Revision : REST " TRIAGENS_VERSION " ( c ) triAGENS GmbH $ " ; <nl> + string revision = " $ Revision : REST " TRI_VERSION " ( c ) triAGENS GmbH $ " ; <nl> LOGGER_TRACE ( revision ) ; <nl> <nl> SSL_library_init ( ) ; <nl> mmm a / lib / Rest / Version . cpp <nl> ppp b / lib / Rest / Version . cpp <nl> <nl> # include " BasicsC / win - utils . h " <nl> # endif <nl> <nl> - # include " build . h " <nl> + # include " BasicsC / common . h " <nl> # include " Basics / Common . h " <nl> # include " Basics / Utf8Helper . h " <nl> # include " BasicsC / json . h " <nl> # include " HttpServer / ApplicationEndpointServer . h " <nl> <nl> + <nl> # include < v8 . h > <nl> # include < openssl / ssl . h > <nl> <nl> void Version : : initialise ( ) { <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> std : : string Version : : getServerVersion ( ) { <nl> - return std : : string ( TRIAGENS_VERSION ) ; <nl> + return std : : string ( TRI_VERSION ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / lib / V8 / v8 - utils . cpp <nl> ppp b / lib / V8 / v8 - utils . cpp <nl> <nl> <nl> # include " v8 - utils . h " <nl> <nl> - # include " build . h " <nl> + # include " BasicsC / common . h " <nl> <nl> # include < fstream > <nl> # include < locale > <nl> void TRI_InitV8Utils ( v8 : : Handle < v8 : : Context > context , <nl> TRI_AddGlobalVariableVocbase ( context , " PACKAGE_PATH " , TRI_V8PathList ( packages ) ) ; <nl> TRI_AddGlobalVariableVocbase ( context , " PATH_SEPARATOR " , v8 : : String : : New ( TRI_DIR_SEPARATOR_STR ) ) ; <nl> TRI_AddGlobalVariableVocbase ( context , " VALGRIND " , RUNNING_ON_VALGRIND > 0 ? v8 : : True ( ) : v8 : : False ( ) ) ; <nl> - TRI_AddGlobalVariableVocbase ( context , " VERSION " , v8 : : String : : New ( TRIAGENS_VERSION ) ) ; <nl> + TRI_AddGlobalVariableVocbase ( context , " VERSION " , v8 : : String : : New ( TRI_VERSION ) ) ; <nl> <nl> TRI_AddGlobalVariableVocbase ( context , " CONNECTION_TIME_DISTRIBUTION " , DistributionList ( ConnectionTimeDistributionVector ) ) ; <nl> TRI_AddGlobalVariableVocbase ( context , " REQUEST_TIME_DISTRIBUTION " , DistributionList ( RequestTimeDistributionVector ) ) ; <nl>
|
simplified build . h stuff
|
arangodb/arangodb
|
7cb6b7d92244c0fe9e8a6e45eecd4ca59081e81a
|
2013-08-28T17:57:07Z
|
mmm a / test / SILOptimizer / pound_assert . swift <nl> ppp b / test / SILOptimizer / pound_assert . swift <nl> <nl> / / RUN : % target - swift - frontend - enable - experimental - static - assert - emit - sil % s - verify - Xllvm - debug - Xllvm - debug - only - Xllvm ConstExpr <nl> <nl> + / / REQUIRES : asserts <nl> + <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> / / Basic function calls and control flow <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl>
|
tests : require an assert build for a test which uses - debug
|
apple/swift
|
c5dd77d2311f4a8f813b91ef7f0c19a45e40a122
|
2018-12-04T17:57:52Z
|
mmm a / js / apps / system / _admin / aardvark / APP / frontend / build / app . min . js <nl> ppp b / js / apps / system / _admin / aardvark / APP / frontend / build / app . min . js <nl> <nl> - function AbstractAdapter ( a , b , c , d , e ) { " use strict " ; if ( void 0 = = = a ) throw " The nodes have to be given . " ; if ( void 0 = = = b ) throw " The edges have to be given . " ; if ( void 0 = = = c ) throw " An inheriting class has to be given . " ; if ( void 0 = = = d ) throw " A reference to the graph viewer has to be given . " ; e = e | | { } ; var f , g , h , i , j , k = this , l = ! 1 , m = { } , n = { } , o = { } , p = { } , q = 0 , r = { } , s = { } , t = function ( a ) { void 0 ! = = a . prioList & & g . changePrioList ( a . prioList | | [ ] ) } , u = function ( a ) { m . range = a / 2 , m . start = a / 4 , m . getStart = function ( ) { return this . start + Math . random ( ) * this . range } } , v = function ( a ) { n . range = a / 2 , n . start = a / 4 , n . getStart = function ( ) { return this . start + Math . random ( ) * this . range } } , w = function ( b ) { var c = p [ b ] | | b , d = $ . grep ( a , function ( a ) { return a . _id = = = c } ) ; if ( 0 = = = d . length ) return ! 1 ; if ( 1 = = = d . length ) return d [ 0 ] ; throw " Too many nodes with the same ID , should never happen " } , x = function ( a ) { var c = $ . grep ( b , function ( b ) { return b . _id = = = a } ) ; if ( 0 = = = c . length ) return ! 1 ; if ( 1 = = = c . length ) return c [ 0 ] ; throw " Too many edges with the same ID , should never happen " } , y = function ( b , c , d ) { var e = { _data : b , _id : b . _id } , f = w ( e . _id ) ; return f ? f : ( e . x = c | | m . getStart ( ) , e . y = d | | n . getStart ( ) , e . weight = 1 , a . push ( e ) , e . _outboundCounter = 0 , e . _inboundCounter = 0 , e ) } , z = function ( a ) { var b = y ( a ) ; return b . x = 2 * m . start , b . y = 2 * n . start , b . fixed = ! 0 , b } , A = function ( ) { a . length = 0 , b . length = 0 , p = { } , o = { } , d . cleanUp ( ) } , B = function ( a ) { var c , d , e , f = ! 0 , g = { _data : a , _id : a . _id } , i = x ( g . _id ) ; if ( i ) return i ; if ( c = w ( a . _from ) , d = w ( a . _to ) , ! c ) throw " Unable to insert Edge , source node not existing " + a . _from ; if ( ! d ) throw " Unable to insert Edge , target node not existing " + a . _to ; return g . source = c , g . source . _isCommunity ? ( e = o [ g . source . _id ] , g . source = e . getNode ( a . _from ) , g . source . _outboundCounter + + , e . insertOutboundEdge ( g ) , f = ! 1 ) : c . _outboundCounter + + , g . target = d , g . target . _isCommunity ? ( e = o [ g . target . _id ] , g . target = e . getNode ( a . _to ) , g . target . _inboundCounter + + , e . insertInboundEdge ( g ) , f = ! 1 ) : d . _inboundCounter + + , b . push ( g ) , f & & h . call ( " insertEdge " , c . _id , d . _id ) , g } , C = function ( b ) { var c ; for ( c = 0 ; c < a . length ; c + + ) if ( a [ c ] = = = b ) return void a . splice ( c , 1 ) } , D = function ( a , c ) { var d = b [ a ] , e = d . source . _id , f = d . target . _id ; b . splice ( a , 1 ) , c | | h . call ( " deleteEdge " , e , f ) } , E = function ( a , c ) { var d ; for ( d = 0 ; d < b . length ; d + + ) if ( b [ d ] = = = a ) return void D ( d , c ) } , F = function ( a ) { var c ; for ( c = 0 ; c < b . length ; c + + ) b [ c ] . source = = = a ? ( a . _outboundCounter - - , b [ c ] . target . _inboundCounter - - , D ( c ) , c - - ) : b [ c ] . target = = = a & & ( a . _inboundCounter - - , b [ c ] . source . _outboundCounter - - , D ( c ) , c - - ) } , G = function ( a , c ) { var d , e , f , g , i ; for ( d = 0 ; d < b . length ; d + + ) for ( f = b [ d ] . source , g = b [ d ] . target , e = 0 ; e < a . length ; e + + ) i = ! 1 , f = = = a [ e ] & & ( i = c . insertOutboundEdge ( b [ d ] ) , g . _isCommunity | | h . call ( " deleteEdge " , f . _id , g . _id ) , f = b [ d ] . source ) , g = = = a [ e ] & & ( i = c . insertInboundEdge ( b [ d ] ) , f . _isCommunity | | h . call ( " deleteEdge " , f . _id , g . _id ) , g = b [ d ] . target ) , i & & ( b . splice ( d , 1 ) , d - - ) } , H = function ( a ) { if ( a . _outboundCounter > 0 ) { var c , d = [ ] ; for ( c = 0 ; c < b . length ; c + + ) if ( b [ c ] . source = = = a ) { if ( d . push ( b [ c ] ) , a . _outboundCounter - - , D ( c , b [ c ] . target . _isCommunity ) , 0 = = = a . _outboundCounter ) break ; c - - } return d } } , I = function ( b , c ) { if ( b & & 0 ! = = b . length ) { var d = _ . map ( b , function ( a ) { return w ( a ) } ) , e = new CommunityNode ( k , d ) , f = e . _id ; c & & ( e . _reason = c ) , o [ f ] = e , G ( d , e ) , _ . each ( d , function ( a ) { p [ a . _id ] = f , C ( a ) } ) , a . push ( e ) , l = ! 1 } } , J = function ( a ) { var b = a . data ; if ( b . error ) return console . log ( b . cmd ) , void console . log ( b . error ) ; switch ( b . cmd ) { case " debug " : break ; case " getCommunity " : I ( b . result ) } } , K = function ( a ) { l | | ( l = ! 0 , a ? h . call ( " getCommunity " , f , a . _id ) : h . call ( " getCommunity " , f ) ) } , L = function ( b ) { var c , d = a . length , e = - ( 1 / 0 ) ; _ . each ( o , function ( a ) { a . _expanded = = = ! 0 & & ( e < a . _size & & a ! = = b & & ( c = a , e = a . _size ) , d + = a . _size ) } ) , d > f & & ( c ? c . collapse ( ) : K ( b ) ) } , M = function ( c ) { var d = c . getDissolveInfo ( ) , e = d . nodes , g = d . edges . both , i = d . edges . inbound , j = d . edges . outbound ; C ( c ) , f < a . length + e . length & & K ( ) , _ . each ( e , function ( b ) { delete p [ b . _id ] , a . push ( b ) } ) , _ . each ( i , function ( a ) { a . target = a . _target , delete a . _target , a . source . _isCommunity | | h . call ( " insertEdge " , a . source . _id , a . target . _id ) } ) , _ . each ( j , function ( a ) { a . source = a . _source , delete a . _source , a . target . _isCommunity | | h . call ( " insertEdge " , a . source . _id , a . target . _id ) } ) , _ . each ( g , function ( a ) { a . source = a . _source , delete a . _source , a . target = a . _target , delete a . _target , b . push ( a ) , h . call ( " insertEdge " , a . source . _id , a . target . _id ) } ) , delete o [ c . _id ] } , N = function ( a ) { a . expand ( ) , L ( a ) } , O = function ( a ) { if ( _ . size ( a ) > i ) { var b = g . bucketNodes ( _ . values ( a ) , i ) ; _ . each ( b , function ( a ) { if ( a . nodes . length > 1 ) { var b = _ . map ( a . nodes , function ( a ) { return a . _id } ) ; I ( b , a . reason ) } } ) } } , P = function ( a , b ) { f = a , L ( ) , void 0 ! = = b & & b ( ) } , Q = function ( a ) { i = a } , R = function ( a , b ) { a . _expanded = ! 1 ; var c = b . removeOutboundEdgesFromNode ( a ) ; _ . each ( c , function ( a ) { j ( a ) , E ( a , ! 0 ) } ) } , S = function ( a ) { a . _expanded = ! 1 , p [ a . _id ] & & o [ p [ a . _id ] ] . collapseNode ( a ) ; var b = H ( a ) , c = [ ] ; _ . each ( b , function ( b ) { 0 = = = q ? ( r = b , s = a , c . push ( b ) ) : void 0 ! = = a & & ( a . _id = = = r . target . _id ? b . target . _id = = = s . _id & & c . push ( r ) : c . push ( b ) , r = b , s = a ) , q + + } ) , _ . each ( c , j ) , q = 0 } , T = function ( a ) { var b = a . getDissolveInfo ( ) ; C ( a ) , _ . each ( b . nodes , function ( a ) { delete p [ a . _id ] } ) , _ . each ( b . edges . outbound , function ( a ) { j ( a ) , E ( a , ! 0 ) } ) , delete o [ a . _id ] } , U = function ( a , b ) { a . _isCommunity ? k . expandCommunity ( a , b ) : ( a . _expanded = ! 0 , c . loadNode ( a . _id , b ) ) } , V = function ( a , b ) { a . _expanded ? S ( a ) : U ( a , b ) } ; j = function ( a ) { var b , c = a . target ; return c . _isCommunity ? ( b = a . _target , c . removeInboundEdge ( a ) , b . _inboundCounter - - , 0 = = = b . _inboundCounter & & ( R ( b , c ) , c . removeNode ( b ) , delete p [ b . _id ] ) , void ( 0 = = = c . _inboundCounter & & T ( c ) ) ) : ( c . _inboundCounter - - , void ( 0 = = = c . _inboundCounter & & ( S ( c ) , C ( c ) ) ) ) } , i = Number . POSITIVE_INFINITY , g = e . prioList ? new NodeReducer ( e . prioList ) : new NodeReducer , h = new WebWorkerWrapper ( ModularityJoiner , J ) , m . getStart = function ( ) { return 0 } , n . getStart = function ( ) { return 0 } , this . cleanUp = A , this . setWidth = u , this . setHeight = v , this . insertNode = y , this . insertInitialNode = z , this . insertEdge = B , this . removeNode = C , this . removeEdge = E , this . removeEdgesForNode = F , this . expandCommunity = N , this . setNodeLimit = P , this . setChildLimit = Q , this . checkSizeOfInserted = O , this . checkNodeLimit = L , this . explore = V , this . changeTo = t , this . getPrioList = g . getPrioList , this . dissolveCommunity = M } function ArangoAdapter ( a , b , c , d ) { " use strict " ; if ( void 0 = = = a ) throw " The nodes have to be given . " ; if ( void 0 = = = b ) throw " The edges have to be given . " ; if ( void 0 = = = c ) throw " A reference to the graph viewer has to be given . " ; if ( void 0 = = = d ) throw " A configuration with node - and edgeCollection has to be given . " ; if ( void 0 = = = d . graph ) { if ( void 0 = = = d . nodeCollection ) throw " The nodeCollection or a graphname has to be given . " ; if ( void 0 = = = d . edgeCollection ) throw " The edgeCollection or a graphname has to be given . " } var e , f , g , h , i , j = this , k = { } , l = { } , m = { } , n = function ( a ) { h = a } , o = function ( a ) { f = a , l . node = l . base + " document ? collection = " + f } , p = function ( a ) { g = a , l . edge = l . base + " edge ? collection = " + g } , q = function ( a ) { $ . ajax ( { cache : ! 1 , type : " GET " , async : ! 1 , url : l . graph + " / " + a , contentType : " application / json " , success : function ( a ) { o ( a . graph . vertices ) , p ( a . graph . edges ) } } ) } , r = function ( a ) { console . log ( a . baseUrl ) ; var b = a . baseUrl | | " " ; void 0 ! = = a . width & & e . setWidth ( a . width ) , void 0 ! = = a . height & & e . setHeight ( a . height ) , i = void 0 ! = = a . undirected & & a . undirected = = = ! 0 ? " any " : " outbound " , l . base = b + " _api / " , l . cursor = l . base + " cursor " , l . graph = l . base + " graph " , l . collection = l . base + " collection / " , l . document = l . base + " document / " , l . any = l . base + " simple / any " , a . graph ? ( q ( a . graph ) , n ( a . graph ) ) : ( o ( a . nodeCollection ) , p ( a . edgeCollection ) , n ( void 0 ) ) } , s = function ( a , b , c ) { a ! = = m . getAllGraphs & & ( a ! = = m . connectedEdges & & ( b [ " @ nodes " ] = f , a ! = = m . childrenCentrality & & ( b . dir = i ) ) , b [ " @ edges " ] = g ) ; var d = { query : a , bindVars : b } ; $ . ajax ( { type : " POST " , url : l . cursor , data : JSON . stringify ( d ) , contentType : " application / json " , dataType : " json " , processData : ! 1 , success : function ( a ) { c ( a . result ) } , error : function ( a ) { try { throw console . log ( a . statusText ) , " [ " + a . errorNum + " ] " + a . errorMessage } catch ( b ) { throw " Undefined ERROR " } } } ) } , t = function ( a , b ) { var c = [ ] , d = 0 , e = function ( d ) { c . push ( d . document | | { } ) , c . length = = = a & & b ( c ) } ; for ( d = 0 ; a > d ; d + + ) $ . ajax ( { cache : ! 1 , type : " PUT " , url : l . any , data : JSON . stringify ( { collection : f } ) , contentType : " application / json " , success : e } ) } , u = function ( b , c ) { if ( 0 = = = b . length ) return void ( c & & c ( { errorCode : 404 } ) ) ; b = b [ 0 ] ; var d = { } , f = e . insertNode ( b [ 0 ] . vertex ) , g = a . length ; _ . each ( b , function ( b ) { var c = e . insertNode ( b . vertex ) , f = b . path ; g < a . length & & ( d [ c . _id ] = c , g = a . length ) , _ . each ( f . vertices , function ( b ) { var c = e . insertNode ( b ) ; g < a . length & & ( d [ c . _id ] = c , g = a . length ) } ) , _ . each ( f . edges , function ( a ) { e . insertEdge ( a ) } ) } ) , delete d [ f . _id ] , e . checkSizeOfInserted ( d ) , e . checkNodeLimit ( f ) , c & & c ( f ) } , v = function ( a ) { return function ( b ) { return b & & b . errorCode ? void a ( b ) : void a ( e . insertInitialNode ( b ) ) } } , w = function ( a ) { s ( m . connectedEdges , { id : a } , function ( a ) { _ . each ( a , j . deleteEdge ) } ) } ; d . prioList & & ( k . prioList = d . prioList ) , e = new AbstractAdapter ( a , b , this , c , k ) , r ( d ) , m . getAllGraphs = " FOR g IN _graphs return g . _key " , m . randomDocuments = " FOR u IN @ @ nodes sort rand ( ) limit 10 return u " , m . nodeById = ' FOR n IN @ @ nodes FILTER n . _id = = @ id LET links = ( FOR l IN @ @ edges FILTER n . _id = = l . _from FOR t IN @ @ nodes FILTER t . _id = = l . _to RETURN t . _id ) RETURN MERGE ( n , { " children " : links } ) ' , m . traversalById = ' RETURN TRAVERSAL ( @ @ nodes , @ @ edges , @ id , @ dir , { strategy : " depthfirst " , maxDepth : 1 , paths : true } ) ' , m . traversalByAttribute = function ( a ) { return " FOR n IN @ @ nodes FILTER n . " + a + ' = = @ value RETURN TRAVERSAL ( @ @ nodes , @ @ edges , n . _id , @ dir , { strategy : " depthfirst " , maxDepth : 1 , paths : true } ) ' } , m . childrenCentrality = " FOR u IN @ @ nodes FILTER u . _id = = @ id LET g = ( FOR l in @ @ edges FILTER l . _from = = u . _id RETURN 1 ) RETURN length ( g ) " , m . connectedEdges = " FOR e IN @ @ edges FILTER e . _to = = @ id | | e . _from = = @ id RETURN e " , j . explore = e . explore , j . loadNode = function ( a , b ) { j . loadNodeFromTreeById ( a , b ) } , j . loadRandomNode = function ( a ) { var b = this ; t ( 1 , function ( c ) { var d = c [ 0 ] ; return d . _id ? void b . loadInitialNode ( d . _id , a ) : void 0 } ) } , j . loadInitialNode = function ( a , b ) { e . cleanUp ( ) , j . loadNode ( a , v ( b ) ) } , j . loadNodeFromTreeById = function ( a , b ) { s ( m . traversalById , { id : a } , function ( a ) { u ( a , b ) } ) } , j . loadNodeFromTreeByAttributeValue = function ( a , b , c ) { s ( m . traversalByAttribute ( a ) , { value : b } , function ( a ) { u ( a , c ) } ) } , j . loadInitialNodeByAttributeValue = function ( a , b , c ) { e . cleanUp ( ) , j . loadNodeFromTreeByAttributeValue ( a , b , v ( c ) ) } , j . requestCentralityChildren = function ( a , b ) { s ( m . childrenCentrality , { id : a } , function ( a ) { b ( a [ 0 ] ) } ) } , j . createEdge = function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " POST " , url : l . edge + " & from = " + a . source . _id + " & to = " + a . target . _id , data : JSON . stringify ( { } ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( c ) { c . _from = a . source . _id , c . _to = a . target . _id , delete c . error ; var d = e . insertEdge ( c ) ; b ( d ) } , error : function ( a ) { throw a . statusText } } ) } , j . deleteEdge = function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " DELETE " , url : l . document + a . _id , contentType : " application / json " , dataType : " json " , processData : ! 1 , success : function ( ) { e . removeEdge ( a ) , void 0 ! = = b & & _ . isFunction ( b ) & & b ( ) } , error : function ( a ) { throw a . statusText } } ) } , j . patchEdge = function ( a , b , c ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : l . document + a . _id , data : JSON . stringify ( b ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( d ) { a . _data = $ . extend ( a . _data , b ) , c ( ) } , error : function ( a ) { throw a . statusText } } ) } , j . createNode = function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " POST " , url : l . node , data : JSON . stringify ( a ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( c ) { c . error = = = ! 1 & & ( a . _key = c . _key , a . _id = c . _id , a . _rev = c . _rev , e . insertNode ( a ) , b ( a ) ) } , error : function ( a ) { throw a . statusText } } ) } , j . deleteNode = function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " DELETE " , url : l . document + a . _id , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( ) { e . removeEdgesForNode ( a ) , w ( a . _id ) , e . removeNode ( a ) , void 0 ! = = b & & _ . isFunction ( b ) & & b ( ) } , error : function ( a ) { throw a . statusText } } ) } , j . patchNode = function ( a , b , c ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : l . document + a . _id , data : JSON . stringify ( b ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( d ) { a . _data = $ . extend ( a . _data , b ) , c ( a ) } , error : function ( a ) { throw a . statusText } } ) } , j . changeToCollections = function ( a , b , c ) { e . cleanUp ( ) , o ( a ) , p ( b ) , void 0 ! = = c & & ( i = c = = = ! 0 ? " any " : " outbound " ) , n ( void 0 ) } , j . changeToGraph = function ( a , b ) { e . cleanUp ( ) , q ( a ) , void 0 ! = = b & & ( i = b = = = ! 0 ? " any " : " outbound " ) , n ( a ) } , j . setNodeLimit = function ( a , b ) { e . setNodeLimit ( a , b ) } , j . setChildLimit = function ( a ) { e . setChildLimit ( a ) } , j . expandCommunity = function ( a , b ) { e . expandCommunity ( a ) , void 0 ! = = b & & b ( ) } , j . getCollections = function ( a ) { a & & a . length > = 2 & & $ . ajax ( { cache : ! 1 , type : " GET " , url : l . collection , contentType : " application / json " , dataType : " json " , processData : ! 1 , success : function ( b ) { var c = b . collections , d = [ ] , e = [ ] ; _ . each ( c , function ( a ) { a . name . match ( / ^ _ / ) | | ( 3 = = = a . type ? e . push ( a . name ) : 2 = = = a . type & & d . push ( a . name ) ) } ) , a ( d , e ) } , error : function ( a ) { throw a . statusText } } ) } , j . getGraphs = function ( a ) { a & & a . length > = 1 & & s ( m . getAllGraphs , { } , a ) } , j . getAttributeExamples = function ( a ) { a & & a . length > = 1 & & t ( 10 , function ( b ) { var c = _ . sortBy ( _ . uniq ( _ . flatten ( _ . map ( b , function ( a ) { return _ . keys ( a ) } ) ) ) , function ( a ) { return a . toLowerCase ( ) } ) ; a ( c ) } ) } , j . getNodeCollection = function ( ) { return f } , j . getEdgeCollection = function ( ) { return g } , j . getDirection = function ( ) { return i } , j . getGraphName = function ( ) { return h } , j . setWidth = e . setWidth , j . changeTo = e . changeTo , j . getPrioList = e . getPrioList } function ColourMapper ( ) { " use strict " ; var a , b = { } , c = { } , d = [ ] , e = this , f = 0 ; d . push ( { back : " # C8E6C9 " , front : " black " } ) , d . push ( { back : " # 8aa249 " , front : " white " } ) , d . push ( { back : " # 8BC34A " , front : " black " } ) , d . push ( { back : " # 388E3C " , front : " white " } ) , d . push ( { back : " # 4CAF50 " , front : " white " } ) , d . push ( { back : " # 212121 " , front : " white " } ) , d . push ( { back : " # 727272 " , front : " white " } ) , d . push ( { back : " # B6B6B6 " , front : " black " } ) , d . push ( { back : " # e5f0a3 " , front : " black " } ) , d . push ( { back : " # 6c4313 " , front : " white " } ) , d . push ( { back : " # 9d8564 " , front : " white " } ) , this . getColour = function ( g ) { return void 0 = = = b [ g ] & & ( b [ g ] = d [ f ] , void 0 = = = c [ d [ f ] . back ] & & ( c [ d [ f ] . back ] = { front : d [ f ] . front , list : [ ] } ) , c [ d [ f ] . back ] . list . push ( g ) , f + + , f = = = d . length & & ( f = 0 ) ) , void 0 ! = = a & & a ( e . getList ( ) ) , b [ g ] . back } , this . getCommunityColour = function ( ) { return " # 333333 " } , this . getForegroundColour = function ( g ) { return void 0 = = = b [ g ] & & ( b [ g ] = d [ f ] , void 0 = = = c [ d [ f ] . back ] & & ( c [ d [ f ] . back ] = { front : d [ f ] . front , list : [ ] } ) , c [ d [ f ] . back ] . list . push ( g ) , f + + , f = = = d . length & & ( f = 0 ) ) , void 0 ! = = a & & a ( e . getList ( ) ) , b [ g ] . front } , this . getForegroundCommunityColour = function ( ) { return " white " } , this . reset = function ( ) { b = { } , c = { } , f = 0 , void 0 ! = = a & & a ( e . getList ( ) ) } , this . getList = function ( ) { return c } , this . setChangeListener = function ( b ) { a = b } , this . reset ( ) } function CommunityNode ( a , b ) { " use strict " ; if ( _ . isUndefined ( a ) | | ! _ . isFunction ( a . dissolveCommunity ) | | ! _ . isFunction ( a . checkNodeLimit ) ) throw " A parent element has to be given . " ; b = b | | [ ] ; var c , d , e , f , g , h = this , i = { } , j = [ ] , k = [ ] , l = { } , m = { } , n = { } , o = { } , p = function ( a ) { return h . _expanded ? 2 * a * Math . sqrt ( j . length ) : a } , q = function ( a ) { return h . _expanded ? 4 * a * Math . sqrt ( j . length ) : a } , r = function ( a ) { var b = h . position , c = a . x * b . z + b . x , d = a . y * b . z + b . y , e = a . z * b . z ; return { x : c , y : d , z : e } } , s = function ( a ) { return h . _expanded ? r ( a . _source . position ) : h . position } , t = function ( a ) { return h . _expanded ? r ( a . _target . position ) : h . position } , u = function ( ) { var a = document . getElementById ( h . _id ) . getBBox ( ) ; c . attr ( " transform " , " translate ( " + ( a . x - 5 ) + " , " + ( a . y - 25 ) + " ) " ) , d . attr ( " width " , a . width + 10 ) . attr ( " height " , a . height + 30 ) , e . attr ( " width " , a . width + 10 ) } , v = function ( ) { if ( ! f ) { var a = new DomObserverFactory ; f = a . createObserver ( function ( a ) { _ . any ( a , function ( a ) { return " transform " = = = a . attributeName } ) & & ( u ( ) , f . disconnect ( ) ) } ) } return f } , w = function ( ) { g . stop ( ) , j . length = 0 , _ . each ( i , function ( a ) { j . push ( a ) } ) , g . start ( ) } , x = function ( ) { g . stop ( ) , k . length = 0 , _ . each ( l , function ( a ) { k . push ( a ) } ) , g . start ( ) } , y = function ( a ) { var b = [ ] ; return _ . each ( a , function ( a ) { b . push ( a ) } ) , b } , z = function ( a ) { return ! ! i [ a ] } , A = function ( ) { return j } , B = function ( a ) { return i [ a ] } , C = function ( a ) { i [ a . _id ] = a , w ( ) , h . _size + + } , D = function ( a ) { _ . each ( a , function ( a ) { i [ a . _id ] = a , h . _size + + } ) , w ( ) } , E = function ( a ) { var b = a . _id | | a ; delete i [ b ] , w ( ) , h . _size - - } , F = function ( a ) { var b ; return _ . has ( a , " _id " ) ? b = a . _id : ( b = a , a = l [ b ] | | m [ b ] ) , a . target = a . _target , delete a . _target , l [ b ] ? ( delete l [ b ] , h . _outboundCounter + + , n [ b ] = a , void x ( ) ) : ( delete m [ b ] , void h . _inboundCounter - - ) } , G = function ( a ) { var b ; return _ . has ( a , " _id " ) ? b = a . _id : ( b = a , a = l [ b ] | | n [ b ] ) , a . source = a . _source , delete a . _source , delete o [ a . source . _id ] [ b ] , l [ b ] ? ( delete l [ b ] , h . _inboundCounter + + , m [ b ] = a , void x ( ) ) : ( delete n [ b ] , void h . _outboundCounter - - ) } , H = function ( a ) { var b = a . _id | | a , c = [ ] ; return _ . each ( o [ b ] , function ( a ) { G ( a ) , c . push ( a ) } ) , delete o [ b ] , c } , I = function ( a ) { return a . _target = a . target , a . target = h , n [ a . _id ] ? ( delete n [ a . _id ] , h . _outboundCounter - - , l [ a . _id ] = a , x ( ) , ! 0 ) : ( m [ a . _id ] = a , h . _inboundCounter + + , ! 1 ) } , J = function ( a ) { var b = a . source . _id ; return a . _source = a . source , a . source = h , o [ b ] = o [ b ] | | { } , o [ b ] [ a . _id ] = a , m [ a . _id ] ? ( delete m [ a . _id ] , h . _inboundCounter - - , l [ a . _id ] = a , x ( ) , ! 0 ) : ( h . _outboundCounter + + , n [ a . _id ] = a , ! 1 ) } , K = function ( ) { return { nodes : j , edges : { both : k , inbound : y ( m ) , outbound : y ( n ) } } } , L = function ( ) { this . _expanded = ! 0 } , M = function ( ) { a . dissolveCommunity ( h ) } , N = function ( ) { this . _expanded = ! 1 } , O = function ( a , b ) { var c = a . select ( " rect " ) . attr ( " width " ) , d = a . append ( " text " ) . attr ( " text - anchor " , " middle " ) . attr ( " fill " , b . getForegroundCommunityColour ( ) ) . attr ( " stroke " , " none " ) ; c * = 2 , c / = 3 , h . _reason & & h . _reason . key & & ( d . append ( " tspan " ) . attr ( " x " , " 0 " ) . attr ( " dy " , " - 4 " ) . text ( h . _reason . key + " : " ) , d . append ( " tspan " ) . attr ( " x " , " 0 " ) . attr ( " dy " , " 16 " ) . text ( h . _reason . value ) ) , d . append ( " tspan " ) . attr ( " x " , c ) . attr ( " y " , " 0 " ) . attr ( " fill " , b . getCommunityColour ( ) ) . text ( h . _size ) } , P = function ( b , c , d , e ) { var f = b . append ( " g " ) . attr ( " stroke " , e . getForegroundCommunityColour ( ) ) . attr ( " fill " , e . getCommunityColour ( ) ) ; c ( f , 9 ) , c ( f , 6 ) , c ( f , 3 ) , c ( f ) , f . on ( " click " , function ( ) { h . expand ( ) , a . checkNodeLimit ( h ) , d ( ) } ) , O ( f , e ) } , Q = function ( a , b ) { var c = a . selectAll ( " . node " ) . data ( j , function ( a ) { return a . _id } ) ; c . enter ( ) . append ( " g " ) . attr ( " class " , " node " ) . attr ( " id " , function ( a ) { return a . _id } ) , c . exit ( ) . remove ( ) , c . selectAll ( " * > * " ) . remove ( ) , b ( c ) } , R = function ( a , b ) { c = a . append ( " g " ) , d = c . append ( " rect " ) . attr ( " rx " , " 8 " ) . attr ( " ry " , " 8 " ) . attr ( " fill " , " none " ) . attr ( " stroke " , " black " ) , e = c . append ( " rect " ) . attr ( " rx " , " 8 " ) . attr ( " ry " , " 8 " ) . attr ( " height " , " 20 " ) . attr ( " fill " , " # 686766 " ) . attr ( " stroke " , " none " ) , c . append ( " image " ) . attr ( " id " , h . _id + " _dissolve " ) . attr ( " xlink : href " , " img / icon_delete . png " ) . attr ( " width " , " 16 " ) . attr ( " height " , " 16 " ) . attr ( " x " , " 5 " ) . attr ( " y " , " 2 " ) . attr ( " style " , " cursor : pointer " ) . on ( " click " , function ( ) { h . dissolve ( ) , b ( ) } ) , c . append ( " image " ) . attr ( " id " , h . _id + " _collapse " ) . attr ( " xlink : href " , " img / gv_collapse . png " ) . attr ( " width " , " 16 " ) . attr ( " height " , " 16 " ) . attr ( " x " , " 25 " ) . attr ( " y " , " 2 " ) . attr ( " style " , " cursor : pointer " ) . on ( " click " , function ( ) { h . collapse ( ) , b ( ) } ) ; var f = c . append ( " text " ) . attr ( " x " , " 45 " ) . attr ( " y " , " 15 " ) . attr ( " fill " , " white " ) . attr ( " stroke " , " none " ) . attr ( " text - anchor " , " left " ) ; h . _reason & & f . text ( h . _reason . text ) , v ( ) . observe ( document . getElementById ( h . _id ) , { subtree : ! 0 , attributes : ! 0 } ) } , S = function ( a ) { if ( h . _expanded ) { var b = a . focus ( ) , c = [ b [ 0 ] - h . position . x , b [ 1 ] - h . position . y ] ; a . focus ( c ) , _ . each ( j , function ( b ) { b . position = a ( b ) , b . position . x / = h . position . z , b . position . y / = h . position . z , b . position . z / = h . position . z } ) , a . focus ( b ) } } , T = function ( a , b , c , d , e ) { return a . on ( " click " , null ) , h . _expanded ? ( R ( a , d ) , void Q ( a , c , d , e ) ) : void P ( a , b , d , e ) } , U = function ( a , b , c ) { if ( h . _expanded ) { var d = a . selectAll ( " . link " ) , e = d . select ( " line " ) ; b ( e , d ) , c ( d ) } } , V = function ( a , b ) { var c , d , e = function ( a ) { return a . _id } ; h . _expanded & & ( d = a . selectAll ( " . link " ) . data ( k , e ) , d . enter ( ) . append ( " g " ) . attr ( " class " , " link " ) . attr ( " id " , e ) , d . exit ( ) . remove ( ) , d . selectAll ( " * > * " ) . remove ( ) , c = d . append ( " line " ) , b ( c , d ) ) } , W = function ( a ) { H ( a ) } ; g = new ForceLayouter ( { distance : 100 , gravity : . 1 , charge : - 500 , width : 1 , height : 1 , nodes : j , links : k } ) , this . _id = " * community_ " + Math . floor ( 1e6 * Math . random ( ) ) , b . length > 0 ? ( this . x = b [ 0 ] . x , this . y = b [ 0 ] . y ) : ( this . x = 0 , this . y = 0 ) , this . _size = 0 , this . _inboundCounter = 0 , this . _outboundCounter = 0 , this . _expanded = ! 1 , this . _isCommunity = ! 0 , D ( b ) , this . hasNode = z , this . getNodes = A , this . getNode = B , this . getDistance = p , this . getCharge = q , this . insertNode = C , this . insertInboundEdge = I , this . insertOutboundEdge = J , this . removeNode = E , this . removeInboundEdge = F , this . removeOutboundEdge = G , this . removeOutboundEdgesFromNode = H , this . collapseNode = W , this . dissolve = M , this . getDissolveInfo = K , this . collapse = N , this . expand = L , this . shapeNodes = T , this . shapeInnerEdges = V , this . updateInnerEdges = U , this . addDistortion = S , this . getSourcePosition = s , this . getTargetPosition = t } function DomObserverFactory ( ) { " use strict " ; var a = window . WebKitMutationObserver | | window . MutationObserver ; this . createObserver = function ( b ) { if ( ! a ) throw " Observer not supported " ; return new a ( b ) } } function EdgeShaper ( a , b , c ) { " use strict " ; var d , e , f , g = this , h = [ ] , i = { } , j = new ContextMenu ( " gv_edge_cm " ) , k = function ( a , b ) { return _ . isArray ( a ) ? b [ _ . find ( a , function ( a ) { return b [ a ] } ) ] : b [ a ] } , l = function ( a ) { if ( void 0 = = = a ) return [ " " ] ; " string " ! = typeof a & & ( a = String ( a ) ) ; var b = a . match ( / [ \ w \ W ] { 1 , 10 } ( \ s | $ ) | \ S + ? ( \ s | $ ) / g ) ; return b [ 0 ] = $ . trim ( b [ 0 ] ) , b [ 1 ] = $ . trim ( b [ 1 ] ) , b [ 0 ] . length > 12 & & ( b [ 0 ] = $ . trim ( a . substring ( 0 , 10 ) ) + " - " , b [ 1 ] = $ . trim ( a . substring ( 10 ) ) , b [ 1 ] . length > 12 & & ( b [ 1 ] = b [ 1 ] . split ( / \ W / ) [ 0 ] , b [ 1 ] . length > 12 & & ( b [ 1 ] = b [ 1 ] . substring ( 0 , 10 ) + " . . . " ) ) , b . length = 2 ) , b . length > 2 & & ( b . length = 2 , b [ 1 ] + = " . . . " ) , b } , m = ! 0 , n = { } , o = function ( a ) { return a . _id } , p = function ( a , b ) { } , q = new ColourMapper , r = function ( ) { q . reset ( ) } , s = p , t = p , u = p , v = p , w = function ( ) { f = { click : p , dblclick : p , mousedown : p , mouseup : p , mousemove : p , mouseout : p , mouseover : p } } , x = function ( a , b ) { return 180 * Math . atan2 ( b . y - a . y , b . x - a . x ) / Math . PI } , y = function ( a , b ) { var c , d = Math . sqrt ( ( b . y - a . y ) * ( b . y - a . y ) + ( b . x - a . x ) * ( b . x - a . x ) ) ; return a . x = = = b . x ? d - = 18 * b . z : ( c = Math . abs ( ( b . y - a . y ) / ( b . x - a . x ) ) , d - = . 4 > c ? Math . abs ( d * b . z * 45 / ( b . x - a . x ) ) : Math . abs ( d * b . z * 18 / ( b . y - a . y ) ) ) , d } , z = function ( a , b ) { _ . each ( f , function ( a , c ) { b . on ( c , a ) } ) } , A = function ( a , b ) { if ( " update " = = = a ) s = b ; else { if ( void 0 = = = f [ a ] ) throw " Sorry Unknown Event " + a + " cannot be bound . " ; f [ a ] = b } } , B = function ( a ) { var b , c , d , e ; return d = a . source , e = a . target , d . _isCommunity ? ( i [ d . _id ] = d , b = d . getSourcePosition ( a ) ) : b = d . position , e . _isCommunity ? ( i [ e . _id ] = e , c = e . getTargetPosition ( a ) ) : c = e . position , { s : b , t : c } } , C = function ( a , b ) { i = { } , b . attr ( " transform " , function ( a ) { var b = B ( a ) ; return " translate ( " + b . s . x + " , " + b . s . y + " ) rotate ( " + x ( b . s , b . t ) + " ) " } ) , a . attr ( " x2 " , function ( a ) { var b = B ( a ) ; return y ( b . s , b . t ) } ) } , D = function ( a , b ) { t ( a , b ) , m & & u ( a , b ) , v ( a , b ) , z ( a , b ) , C ( a , b ) } , E = function ( a ) { void 0 ! = = a & & ( h = a ) ; var b , c = g . parent . selectAll ( " . link " ) . data ( h , o ) ; c . enter ( ) . append ( " g " ) . attr ( " class " , " link " ) . attr ( " id " , o ) , c . exit ( ) . remove ( ) , c . selectAll ( " * > * " ) . remove ( ) , b = c . append ( " line " ) , D ( b , c ) , _ . each ( i , function ( a ) { a . shapeInnerEdges ( d3 . select ( this ) , D ) } ) , j . bindMenu ( $ ( " . link " ) ) } , F = function ( ) { var a = g . parent . selectAll ( " . link " ) , b = a . select ( " line " ) ; C ( b , a ) , s ( a ) , _ . each ( i , function ( a ) { a . updateInnerEdges ( d3 . select ( this ) , C , s ) } ) } , G = function ( a ) { switch ( $ ( " svg defs marker # arrow " ) . remove ( ) , a . type ) { case EdgeShaper . shapes . NONE : t = p ; break ; case EdgeShaper . shapes . ARROW : t = function ( a , b ) { a . attr ( " marker - end " , " url ( # arrow ) " ) } , 0 = = = d . selectAll ( " defs " ) [ 0 ] . length & & d . append ( " defs " ) , d . select ( " defs " ) . append ( " marker " ) . attr ( " id " , " arrow " ) . attr ( " refX " , " 10 " ) . attr ( " refY " , " 5 " ) . attr ( " markerUnits " , " strokeWidth " ) . attr ( " markerHeight " , " 10 " ) . attr ( " markerWidth " , " 10 " ) . attr ( " orient " , " auto " ) . append ( " path " ) . attr ( " d " , " M 0 0 L 10 5 L 0 10 z " ) ; break ; default : throw " Sorry given Shape not known ! " } } , H = function ( a ) { u = _ . isFunction ( a ) ? function ( b , c ) { c . append ( " text " ) . attr ( " text - anchor " , " middle " ) . text ( a ) } : function ( b , c ) { c . append ( " text " ) . attr ( " text - anchor " , " middle " ) . text ( function ( b ) { var c = l ( k ( a , b . _data ) ) ; return c [ 0 ] | | " " } ) } , s = function ( a ) { a . select ( " text " ) . attr ( " transform " , function ( a ) { var b = B ( a ) ; return " translate ( " + y ( b . s , b . t ) / 2 + " , - 3 ) " } ) } } , I = function ( a ) { void 0 ! = = a . reset & & a . reset & & w ( ) , _ . each ( a , function ( a , b ) { " reset " ! = = b & & A ( b , a ) } ) } , J = function ( a ) { switch ( $ ( " svg defs # gradientEdgeColor " ) . remove ( ) , r ( ) , a . type ) { case " single " : v = function ( b , c ) { b . attr ( " stroke " , a . stroke ) } ; break ; case " gradient " : 0 = = = d . selectAll ( " defs " ) [ 0 ] . length & & d . append ( " defs " ) ; var b = d . select ( " defs " ) . append ( " linearGradient " ) . attr ( " id " , " gradientEdgeColor " ) ; b . append ( " stop " ) . attr ( " offset " , " 0 " ) . attr ( " stop - color " , a . source ) , b . append ( " stop " ) . attr ( " offset " , " 0 . 4 " ) . attr ( " stop - color " , a . source ) , b . append ( " stop " ) . attr ( " offset " , " 0 . 6 " ) . attr ( " stop - color " , a . target ) , b . append ( " stop " ) . attr ( " offset " , " 1 " ) . attr ( " stop - color " , a . target ) , v = function ( a , b ) { a . attr ( " stroke " , " url ( # gradientEdgeColor ) " ) , a . attr ( " y2 " , " 0 . 0000000000000001 " ) } ; break ; case " attribute " : v = function ( b , c ) { c . attr ( " stroke " , function ( b ) { return q . getColour ( b . _data [ a . key ] ) } ) } ; break ; default : throw " Sorry given colour - scheme not known " } } , K = function ( a ) { void 0 ! = = a . shape & & G ( a . shape ) , void 0 ! = = a . label & & ( H ( a . label ) , g . label = a . label ) , void 0 ! = = a . actions & & I ( a . actions ) , void 0 ! = = a . color & & J ( a . color ) } ; for ( g . parent = a , w ( ) , d = a ; d [ 0 ] [ 0 ] & & d [ 0 ] [ 0 ] . ownerSVGElement ; ) d = d3 . select ( d [ 0 ] [ 0 ] . ownerSVGElement ) ; void 0 = = = b & & ( b = { color : { type : " single " , stroke : " # 686766 " } } ) , void 0 = = = b . color & & ( b . color = { type : " single " , stroke : " # 686766 " } ) , K ( b ) , _ . isFunction ( c ) & & ( o = c ) , e = d . append ( " g " ) , g . changeTo = function ( a ) { K ( a ) , E ( ) , F ( ) } , g . drawEdges = function ( a ) { E ( a ) , F ( ) } , g . updateEdges = function ( ) { F ( ) } , g . reshapeEdges = function ( ) { E ( ) } , g . activateLabel = function ( a ) { m = ! ! a , E ( ) } , g . addAnEdgeFollowingTheCursor = function ( a , b ) { return n = e . append ( " line " ) , n . attr ( " stroke " , " black " ) . attr ( " id " , " connectionLine " ) . attr ( " x1 " , a ) . attr ( " y1 " , b ) . attr ( " x2 " , a ) . attr ( " y2 " , b ) , function ( a , b ) { n . attr ( " x2 " , a ) . attr ( " y2 " , b ) } } , g . removeCursorFollowingEdge = function ( ) { n . remove & & ( n . remove ( ) , n = { } ) } , g . addMenuEntry = function ( a , b ) { j . addEntry ( a , b ) } , g . getLabel = function ( ) { return g . label | | " " } , g . resetColourMap = r } function EventDispatcher ( a , b , c ) { " use strict " ; var d , e , f , g , h = this , i = function ( b ) { if ( void 0 = = = b . shaper & & ( b . shaper = a ) , d . checkNodeEditorConfig ( b ) ) { var c = new d . InsertNode ( b ) , e = new d . PatchNode ( b ) , f = new d . DeleteNode ( b ) ; h . events . CREATENODE = function ( a , b , d , e ) { var f ; return f = _ . isFunction ( a ) ? a ( ) : a , function ( ) { c ( f , b , d , e ) } } , h . events . PATCHNODE = function ( a , b , c ) { if ( ! _ . isFunction ( b ) ) throw " Please give a function to extract the new node data " ; return function ( ) { e ( a , b ( ) , c ) } } , h . events . DELETENODE = function ( a ) { return function ( b ) { f ( b , a ) } } } } , j = function ( a ) { if ( void 0 = = = a . shaper & & ( a . shaper = b ) , d . checkEdgeEditorConfig ( a ) ) { var c = new d . InsertEdge ( a ) , e = new d . PatchEdge ( a ) , f = new d . DeleteEdge ( a ) , g = null , i = ! 1 ; h . events . STARTCREATEEDGE = function ( a ) { return function ( b ) { var c = d3 . event | | window . event ; g = b , i = ! 1 , void 0 ! = = a & & a ( b , c ) , c . stopPropagation ( ) } } , h . events . CANCELCREATEEDGE = function ( a ) { return function ( ) { g = null , void 0 = = = a | | i | | a ( ) } } , h . events . FINISHCREATEEDGE = function ( a ) { return function ( b ) { null ! = = g & & b ! = = g & & ( c ( g , b , a ) , i = ! 0 ) } } , h . events . PATCHEDGE = function ( a , b , c ) { if ( ! _ . isFunction ( b ) ) throw " Please give a function to extract the new node data " ; return function ( ) { e ( a , b ( ) , c ) } } , h . events . DELETEEDGE = function ( a ) { return function ( b ) { f ( b , a ) } } } } , k = function ( ) { g = g | | $ ( " svg " ) , g . unbind ( ) , _ . each ( e , function ( a , b ) { g . bind ( b , function ( c ) { _ . each ( a , function ( a ) { a ( c ) } ) , f [ b ] & & f [ b ] ( c ) } ) } ) } ; if ( void 0 = = = a ) throw " NodeShaper has to be given . " ; if ( void 0 = = = b ) throw " EdgeShaper has to be given . " ; d = new EventLibrary , e = { click : [ ] , dblclick : [ ] , mousedown : [ ] , mouseup : [ ] , mousemove : [ ] , mouseout : [ ] , mouseover : [ ] } , f = { } , h . events = { } , void 0 ! = = c & & ( void 0 ! = = c . expand & & d . checkExpandConfig ( c . expand ) & & ( h . events . EXPAND = new d . Expand ( c . expand ) , a . setGVStartFunction ( function ( ) { c . expand . reshapeNodes ( ) , c . expand . startCallback ( ) } ) ) , void 0 ! = = c . drag & & d . checkDragConfig ( c . drag ) & & ( h . events . DRAG = d . Drag ( c . drag ) ) , void 0 ! = = c . nodeEditor & & i ( c . nodeEditor ) , void 0 ! = = c . edgeEditor & & j ( c . edgeEditor ) ) , Object . freeze ( h . events ) , h . bind = function ( c , d , e ) { if ( void 0 = = = e | | ! _ . isFunction ( e ) ) throw " You have to give a function that should be bound as a third argument " ; var g = { } ; switch ( c ) { case " nodes " : g [ d ] = e , a . changeTo ( { actions : g } ) ; break ; case " edges " : g [ d ] = e , b . changeTo ( { actions : g } ) ; break ; case " svg " : f [ d ] = e , k ( ) ; break ; default : if ( void 0 = = = c . bind ) throw ' Sorry cannot bind to object . Please give either " nodes " , " edges " or a jQuery - selected DOM - Element ' ; c . unbind ( d ) , c . bind ( d , e ) } } , h . rebind = function ( c , d ) { switch ( d = d | | { } , d . reset = ! 0 , c ) { case " nodes " : a . changeTo ( { actions : d } ) ; break ; case " edges " : b . changeTo ( { actions : d } ) ; break ; case " svg " : f = { } , _ . each ( d , function ( a , b ) { " reset " ! = = b & & ( f [ b ] = a ) } ) , k ( ) ; break ; default : throw ' Sorry cannot rebind to object . Please give either " nodes " , " edges " or " svg " ' } } , h . fixSVG = function ( a , b ) { if ( void 0 = = = e [ a ] ) throw " Sorry unkown event " ; e [ a ] . push ( b ) , k ( ) } , Object . freeze ( h . events ) } function EventLibrary ( ) { " use strict " ; var a = this ; this . checkExpandConfig = function ( a ) { if ( void 0 = = = a . startCallback ) throw " A callback to the Start - method has to be defined " ; if ( void 0 = = = a . adapter | | void 0 = = = a . adapter . explore ) throw " An adapter to load data has to be defined " ; if ( void 0 = = = a . reshapeNodes ) throw " A callback to reshape nodes has to be defined " ; return ! 0 } , this . Expand = function ( b ) { a . checkExpandConfig ( b ) ; var c = b . startCallback , d = b . adapter . explore , e = b . reshapeNodes ; return function ( a ) { d ( a , c ) , e ( ) , c ( ) } } , this . checkDragConfig = function ( a ) { if ( void 0 = = = a . layouter ) throw " A layouter has to be defined " ; if ( void 0 = = = a . layouter . drag | | ! _ . isFunction ( a . layouter . drag ) ) throw " The layouter has to offer a drag function " ; return ! 0 } , this . Drag = function ( b ) { return a . checkDragConfig ( b ) , b . layouter . drag } , this . checkNodeEditorConfig = function ( a ) { if ( void 0 = = = a . adapter ) throw " An adapter has to be defined " ; if ( void 0 = = = a . shaper ) throw " A node shaper has to be defined " ; return ! 0 } , this . checkEdgeEditorConfig = function ( a ) { if ( void 0 = = = a . adapter ) throw " An adapter has to be defined " ; if ( void 0 = = = a . shaper ) throw " An edge Shaper has to be defined " ; return ! 0 } , this . InsertNode = function ( b ) { a . checkNodeEditorConfig ( b ) ; var c = b . adapter , d = b . shaper ; return function ( a , b , e , f ) { var g , h ; _ . isFunction ( a ) & & ! b ? ( g = a , h = { } ) : ( g = b , h = a ) , c . createNode ( h , function ( a ) { d . reshapeNodes ( ) , g ( a ) } , e , f ) } } , this . PatchNode = function ( b ) { a . checkNodeEditorConfig ( b ) ; var c = b . adapter , d = b . shaper ; return function ( a , b , e ) { c . patchNode ( a , b , function ( a ) { d . reshapeNodes ( ) , e ( a ) } ) } } , this . DeleteNode = function ( b ) { a . checkNodeEditorConfig ( b ) ; var c = b . adapter , d = b . shaper ; return function ( a , b ) { c . deleteNode ( a , function ( ) { d . reshapeNodes ( ) , b ( ) } ) } } , this . SelectNodeCollection = function ( b ) { a . checkNodeEditorConfig ( b ) ; var c = b . adapter ; if ( ! _ . isFunction ( c . useNodeCollection ) ) throw " The adapter has to support collection changes " ; return function ( a , b ) { c . useNodeCollection ( a ) , b ( ) } } , this . InsertEdge = function ( b ) { a . checkEdgeEditorConfig ( b ) ; var c = b . adapter , d = b . shaper ; return function ( a , b , e ) { c . createEdge ( { source : a , target : b } , function ( a ) { d . reshapeEdges ( ) , e ( a ) } ) } } , this . PatchEdge = function ( b ) { a . checkEdgeEditorConfig ( b ) ; var c = b . adapter , d = b . shaper ; return function ( a , b , e ) { c . patchEdge ( a , b , function ( a ) { d . reshapeEdges ( ) , e ( a ) } ) } } , this . DeleteEdge = function ( b ) { a . checkEdgeEditorConfig ( b ) ; var c = b . adapter , d = b . shaper ; return function ( a , b ) { c . deleteEdge ( a , function ( ) { d . reshapeEdges ( ) , b ( ) } ) } } } function ForceLayouter ( a ) { " use strict " ; var b = this , c = d3 . layout . force ( ) , d = a . charge | | - 600 , e = a . distance | | 80 , f = a . gravity | | . 01 , g = function ( a ) { var b = 0 ; return b + = a . source . _isCommunity ? a . source . getDistance ( e ) : e , b + = a . target . _isCommunity ? a . target . getDistance ( e ) : e } , h = function ( a ) { return a . _isCommunity ? a . getCharge ( d ) : d } , i = a . onUpdate | | function ( ) { } , j = a . width | | 880 , k = a . height | | 680 , l = function ( a ) { a . distance & & ( e = a . distance ) , a . gravity & & c . gravity ( a . gravity ) , a . charge & & ( d = a . charge ) } ; if ( void 0 = = = a . nodes ) throw " No nodes defined " ; if ( void 0 = = = a . links ) throw " No links defined " ; c . nodes ( a . nodes ) , c . links ( a . links ) , c . size ( [ j , k ] ) , c . linkDistance ( g ) , c . gravity ( f ) , c . charge ( h ) , c . on ( " tick " , function ( ) { } ) , b . start = function ( ) { c . start ( ) } , b . stop = function ( ) { c . stop ( ) } , b . drag = c . drag , b . setCombinedUpdateFunction = function ( a , d , e ) { void 0 ! = = e ? ( i = function ( ) { c . alpha ( ) < . 1 & & ( a . updateNodes ( ) , d . updateEdges ( ) , e ( ) , c . alpha ( ) < . 05 & & b . stop ( ) ) } , c . on ( " tick " , i ) ) : ( i = function ( ) { c . alpha ( ) < . 1 & & ( a . updateNodes ( ) , d . updateEdges ( ) , c . alpha ( ) < . 05 & & b . stop ( ) ) } , c . on ( " tick " , i ) ) } , b . changeTo = function ( a ) { l ( a ) } , b . changeWidth = function ( a ) { j = a , c . size ( [ j , k ] ) } } function FoxxAdapter ( a , b , c , d , e ) { " use strict " ; if ( void 0 = = = a ) throw " The nodes have to be given . " ; if ( void 0 = = = b ) throw " The edges have to be given . " ; if ( void 0 = = = c ) throw " The route has to be given . " ; if ( void 0 = = = d ) throw " A reference to the graph viewer has to be given . " ; e = e | | { } ; var f , g = this , h = { } , i = { } , j = c , k = { cache : ! 1 , contentType : " application / json " , dataType : " json " , processData : ! 1 , error : function ( a ) { try { throw console . log ( a . statusText ) , " [ " + a . errorNum + " ] " + a . errorMessage } catch ( b ) { throw console . log ( b ) , " Undefined ERROR " } } } , l = function ( ) { i . query = { get : function ( a , b ) { var c = $ . extend ( k , { type : " GET " , url : j + " / query / " + a , success : b } ) ; $ . ajax ( c ) } } , i . nodes = { post : function ( a , b ) { var c = $ . extend ( k , { type : " POST " , url : j + " / nodes " , data : JSON . stringify ( a ) , success : b } ) ; $ . ajax ( c ) } , put : function ( a , b , c ) { var d = $ . extend ( k , { type : " PUT " , url : j + " / nodes / " + a , data : JSON . stringify ( b ) , success : c } ) ; $ . ajax ( d ) } , del : function ( a , b ) { var c = $ . extend ( k , { type : " DELETE " , url : j + " / nodes / " + a , success : b } ) ; $ . ajax ( c ) } } , i . edges = { post : function ( a , b ) { var c = $ . extend ( k , { type : " POST " , url : j + " / edges " , data : JSON . stringify ( a ) , success : b } ) ; $ . ajax ( c ) } , put : function ( a , b , c ) { var d = $ . extend ( k , { type : " PUT " , <nl> - url : j + " / edges / " + a , data : JSON . stringify ( b ) , success : c } ) ; $ . ajax ( d ) } , del : function ( a , b ) { var c = $ . extend ( k , { type : " DELETE " , url : j + " / edges / " + a , success : b } ) ; $ . ajax ( c ) } } , i . forNode = { del : function ( a , b ) { var c = $ . extend ( k , { type : " DELETE " , url : j + " / edges / forNode / " + a , success : b } ) ; $ . ajax ( c ) } } } , m = function ( a , b , c ) { i [ a ] . get ( b , c ) } , n = function ( a , b , c ) { i [ a ] . post ( b , c ) } , o = function ( a , b , c ) { i [ a ] . del ( b , c ) } , p = function ( a , b , c , d ) { i [ a ] . put ( b , c , d ) } , q = function ( a ) { void 0 ! = = a . width & & f . setWidth ( a . width ) , void 0 ! = = a . height & & f . setHeight ( a . height ) } , r = function ( b , c ) { var d = { } , e = b . first , g = a . length ; e = f . insertNode ( e ) , _ . each ( b . nodes , function ( b ) { b = f . insertNode ( b ) , g < a . length & & ( d [ b . _id ] = b , g = a . length ) } ) , _ . each ( b . edges , function ( a ) { f . insertEdge ( a ) } ) , delete d [ e . _id ] , f . checkSizeOfInserted ( d ) , f . checkNodeLimit ( e ) , void 0 ! = = c & & _ . isFunction ( c ) & & c ( e ) } ; e . prioList & & ( h . prioList = e . prioList ) , f = new AbstractAdapter ( a , b , this , d , h ) , q ( e ) , l ( ) , g . explore = f . explore , g . loadNode = function ( a , b ) { m ( " query " , a , function ( a ) { r ( a , b ) } ) } , g . loadInitialNode = function ( a , b ) { f . cleanUp ( ) ; var c = function ( a ) { b ( f . insertInitialNode ( a ) ) } ; g . loadNode ( a , c ) } , g . requestCentralityChildren = function ( a , b ) { } , g . createEdge = function ( a , b ) { var c = _ . clone ( a ) ; c . _from = a . source . _id , c . _to = a . target . _id , delete c . source , delete c . target , n ( " edges " , c , function ( c ) { c . _from = a . source . _id , c . _to = a . target . _id , delete c . error ; var d = f . insertEdge ( c ) ; void 0 ! = = b & & _ . isFunction ( b ) & & b ( d ) } ) } , g . deleteEdge = function ( a , b ) { o ( " edges " , a . _id , function ( ) { f . removeEdge ( a ) , void 0 ! = = b & & _ . isFunction ( b ) & & b ( ) } ) } , g . patchEdge = function ( a , b , c ) { p ( " edges " , a . _id , b , function ( d ) { a . _data = $ . extend ( a . _data , b ) , void 0 ! = = c & & _ . isFunction ( c ) & & c ( ) } ) } , g . createNode = function ( a , b ) { n ( " nodes " , a , function ( a ) { f . insertNode ( a ) , void 0 ! = = b & & _ . isFunction ( b ) & & b ( a ) } ) } , g . deleteNode = function ( a , b ) { o ( " nodes " , a . _id , function ( ) { f . removeEdgesForNode ( a ) , o ( " forNode " , a . _id , function ( ) { } ) , f . removeNode ( a ) , void 0 ! = = b & & _ . isFunction ( b ) & & b ( ) } ) } , g . patchNode = function ( a , b , c ) { p ( " nodes " , a . _id , b , function ( d ) { a . _data = $ . extend ( a . _data , b ) , void 0 ! = = c & & _ . isFunction ( c ) & & c ( a ) } ) } , g . setNodeLimit = function ( a , b ) { f . setNodeLimit ( a , b ) } , g . setChildLimit = function ( a ) { f . setChildLimit ( a ) } , g . expandCommunity = function ( a , b ) { f . expandCommunity ( a ) , void 0 ! = = b & & b ( ) } , g . setWidth = f . setWidth , g . changeTo = f . changeTo , g . getPrioList = f . getPrioList } function GharialAdapter ( a , b , c , d ) { " use strict " ; if ( void 0 = = = a ) throw " The nodes have to be given . " ; if ( void 0 = = = b ) throw " The edges have to be given . " ; if ( void 0 = = = c ) throw " A reference to the graph viewer has to be given . " ; if ( void 0 = = = d ) throw " A configuration with graphName has to be given . " ; if ( void 0 = = = d . graphName ) throw " The graphname has to be given . " ; var e , f , g , h , i , j , k , l = this , m = { } , n = { } , o = { } , p = function ( a ) { $ . ajax ( { cache : ! 1 , type : " GET " , async : ! 1 , url : n . graph + " / " + a + " / edge " , contentType : " application / json " , success : function ( a ) { h = a . collections , i = h [ 0 ] } } ) , $ . ajax ( { cache : ! 1 , type : " GET " , async : ! 1 , url : n . graph + " / " + a + " / vertex " , contentType : " application / json " , success : function ( a ) { f = a . collections , g = f [ 0 ] } } ) } , q = function ( a ) { j = a , p ( a ) , n . edges = n . graph + " / " + j + " / edge / " , n . vertices = n . graph + " / " + j + " / vertex / " , n . any = n . base + " simple / any " } , r = function ( a ) { var b = a . baseUrl | | " " ; void 0 ! = = a . width & & e . setWidth ( a . width ) , void 0 ! = = a . height & & e . setHeight ( a . height ) , k = void 0 ! = = a . undirected ? a . undirected = = = ! 0 ? " any " : " outbound " : " any " , n . base = b + " _api / " , n . cursor = n . base + " cursor " , n . graph = n . base + " gharial " , a . graphName & & q ( a . graphName ) } , s = function ( a , b , c ) { a ! = = o . getAllGraphs & & ( b . graph = j ) ; var d = { query : a , bindVars : b } ; $ . ajax ( { type : " POST " , url : n . cursor , data : JSON . stringify ( d ) , contentType : " application / json " , dataType : " json " , processData : ! 1 , success : function ( a ) { c ( a . result ) } , error : function ( a ) { try { throw console . log ( a . statusText ) , " [ " + a . errorNum + " ] " + a . errorMessage } catch ( b ) { throw " Undefined ERROR " } } } ) } , t = function ( a , b ) { var c , d = { query : o . randomVertices , bindVars : { " @ collection " : b , limit : a } } ; return $ . ajax ( { type : " POST " , url : n . cursor , data : JSON . stringify ( d ) , contentType : " application / json " , dataType : " json " , processData : ! 1 , async : ! 1 , success : function ( a ) { c = a . result } , error : function ( a ) { try { throw console . log ( a . statusText ) , " [ " + a . errorNum + " ] " + a . errorMessage } catch ( b ) { throw " Undefined ERROR " } } } ) , c } , u = function ( b , c ) { 0 ! = = b . length & & null ! = = b [ 0 ] . vertex | | c & & c ( { errorCode : 404 } ) ; var d = { } , f = e . insertNode ( b [ 0 ] . vertex ) , g = a . length ; b . shift ( ) , _ . each ( b , function ( b ) { if ( null ! = = b . vertex ) { var c = e . insertNode ( b . vertex ) ; g < a . length & & ( d [ c . _id ] = c , g = a . length ) , null ! = = b . edge & & e . insertEdge ( b . edge ) } } ) , delete d [ f . _id ] , e . checkSizeOfInserted ( d ) , e . checkNodeLimit ( f ) , c & & c ( f ) } , v = function ( a ) { return function ( b ) { return b & & b . errorCode ? void a ( b ) : void a ( e . insertInitialNode ( b ) ) } } ; d . prioList & & ( m . prioList = d . prioList ) , e = new AbstractAdapter ( a , b , this , c , m ) , r ( d ) , o . getAllGraphs = " FOR g IN _graphs return g . _key " , o . traversal = function ( a ) { return " FOR vertex , edge IN 0 . . 1 " + a + " @ example GRAPH @ graph RETURN { vertex , edge } " } , o . oneNodeByAttributeValue = function ( a , b , c , d ) { if ( a . attr = c , a . value = d , 1 = = = b . length ) return a [ " @ collection " ] = b [ 0 ] , " FOR node IN @ @ collection FILTER node [ @ attr ] = = @ value LIMIT 1 " ; var e = " FOR node IN UNION ( " , f = 0 ; for ( f = 0 ; f < b . length ; + + f ) e + = " ( FOR node IN @ @ collection " + f + " FILTER node [ @ attr ] = = @ value LIMIT 1 RETURN node ) " , a [ " @ collection " + f ] = b [ f ] ; return e + = " ) LIMIT 1 " } , o . traversalAttributeValue = function ( a , b , c , d , e ) { return o . oneNodeByAttributeValue ( b , c , d , e ) + " FOR vertex , edge IN 0 . . 1 " + a + " node GRAPH @ graph RETURN { vertex , edge } " } , o . childrenCentrality = " RETURN SUM ( FOR v IN ANY @ id GRAPH @ graph RETURN 1 ) " , o . connectedEdges = " FOR v , e IN ANY @ id GRAPH @ graph RETURN e " , o . randomVertices = " FOR x IN @ @ collection SORT RAND ( ) LIMIT @ limit RETURN x " , l . explore = e . explore , l . loadNode = function ( a , b ) { l . loadNodeFromTreeById ( a , b ) } , l . NODES_TO_DISPLAY = 19 , l . TOTAL_NODES = 0 , l . definedNodes = [ ] , l . randomNodes = [ ] , l . loadRandomNode = function ( a , b ) { var c , d = _ . shuffle ( l . getNodeCollections ( ) ) ; for ( c = 0 ; c < d . length ; + + c ) { void 0 ! = = b & & ( " all " = = = b ? l . NODES_TO_DISPLAY = l . TOTAL_NODES : l . NODES_TO_DISPLAY = parseInt ( b , 10 ) - 1 , l . NODES_TO_DISPLAY > = l . TOTAL_NODES ? $ ( " . infoField " ) . hide ( ) : $ ( " . infoField " ) . show ( ) ) ; var e = t ( l . NODES_TO_DISPLAY , d [ c ] ) ; if ( e . length > 0 ) return _ . each ( e , function ( a ) { l . randomNodes . push ( a ) } ) , void l . loadInitialNode ( e [ 0 ] . _id , a ) } a ( { errorCode : 404 } ) } , l . loadInitialNode = function ( a , b ) { e . cleanUp ( ) , l . loadNode ( a , v ( b ) ) } , l . getRandomNodes = function ( ) { var a = [ ] , b = [ ] ; l . definedNodes . length > 0 & & _ . each ( l . definedNodes , function ( a ) { b . push ( a ) } ) , l . randomNodes . length > 0 & & _ . each ( l . randomNodes , function ( a ) { b . push ( a ) } ) ; var c = 0 ; return _ . each ( b , function ( b ) { c < l . NODES_TO_DISPLAY & & ( a . push ( { vertex : b , path : { edges : [ ] , vertices : [ b ] } } ) , c + + ) } ) , a } , l . loadNodeFromTreeById = function ( a , b ) { s ( o . traversal ( k ) , { example : a } , function ( c ) { var d = [ ] ; d = l . getRandomNodes ( ) , d . length > 0 ? _ . each ( d , function ( a ) { s ( o . traversal ( k ) , { example : a . vertex . _id } , function ( a ) { _ . each ( a , function ( a ) { c . push ( a ) } ) , u ( c , b ) } ) } ) : s ( o . traversal ( k ) , { example : a } , function ( a ) { u ( a , b ) } ) } ) } , l . loadNodeFromTreeByAttributeValue = function ( a , b , c ) { var d = { } , e = o . traversalAttributeValue ( k , d , f , a , b ) ; s ( e , d , function ( a ) { u ( a , c ) } ) } , l . getNodeExampleFromTreeByAttributeValue = function ( a , b , c ) { var d , g = o . travesalAttributeValue ( k , d , f , a , b ) ; s ( g , d , function ( d ) { if ( 0 = = = d . length ) throw arangoHelper . arangoError ( " Graph error " , " no nodes found " ) , " No suitable nodes have been found . " ; _ . each ( d , function ( d ) { if ( d . vertex [ a ] = = = b ) { var f = { } ; f . _key = d . vertex . _key , f . _id = d . vertex . _id , f . _rev = d . vertex . _rev , e . insertNode ( f ) , c ( f ) } } ) } ) } , l . loadAdditionalNodeByAttributeValue = function ( a , b , c ) { l . getNodeExampleFromTreeByAttributeValue ( a , b , c ) } , l . loadInitialNodeByAttributeValue = function ( a , b , c ) { e . cleanUp ( ) , l . loadNodeFromTreeByAttributeValue ( a , b , v ( c ) ) } , l . requestCentralityChildren = function ( a , b ) { s ( o . childrenCentrality , { id : a } , function ( a ) { b ( a [ 0 ] ) } ) } , l . createEdge = function ( a , b ) { var c = { } ; c . _from = a . source . _id , c . _to = a . target . _id , $ . ajax ( { cache : ! 1 , type : " POST " , url : n . edges + i , data : JSON . stringify ( c ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( a ) { if ( a . error = = = ! 1 ) { var d , f = a . edge ; f . _from = c . _from , f . _to = c . _to , d = e . insertEdge ( f ) , b ( d ) } } , error : function ( a ) { var b = " " ; try { b = JSON . parse ( a . responseText ) . errorMessage + " ( " + JSON . parse ( a . responseText ) . errorNum + " ) " , arangoHelper . arangoError ( a . statusText , b ) } catch ( c ) { throw a . statusText } } } ) } , l . deleteEdge = function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " DELETE " , url : n . edges + a . _id , contentType : " application / json " , dataType : " json " , processData : ! 1 , success : function ( ) { e . removeEdge ( a ) , void 0 ! = = b & & _ . isFunction ( b ) & & b ( ) } , error : function ( a ) { var b = " " ; try { b = JSON . parse ( a . responseText ) . errorMessage + " ( " + JSON . parse ( a . responseText ) . errorNum + " ) " , arangoHelper . arangoError ( a . statusText , b ) } catch ( c ) { throw a . statusText } } } ) } , l . patchEdge = function ( a , b , c ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : n . edges + a . _id , data : JSON . stringify ( b ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( ) { a . _data = $ . extend ( a . _data , b ) , c ( ) } , error : function ( a ) { var b = " " ; try { b = JSON . parse ( a . responseText ) . errorMessage + " ( " + JSON . parse ( a . responseText ) . errorNum + " ) " , arangoHelper . arangoError ( a . statusText , b ) } catch ( c ) { throw a . statusText } } } ) } , l . createNode = function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " POST " , url : n . vertices + g , data : JSON . stringify ( a ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( c ) { c . error = = = ! 1 & & ( a . _key = c . vertex . _key , a . _id = c . vertex . _id , a . _rev = c . vertex . _rev , e . insertNode ( a ) , b ( a ) ) } , error : function ( a ) { var b = " " ; try { b = JSON . parse ( a . responseText ) . errorMessage + " ( " + JSON . parse ( a . responseText ) . errorNum + " ) " , arangoHelper . arangoError ( a . statusText , b ) } catch ( c ) { throw a . statusText } } } ) } , l . deleteNode = function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " DELETE " , url : n . vertices + a . _id , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( ) { e . removeEdgesForNode ( a ) , e . removeNode ( a ) , void 0 ! = = b & & _ . isFunction ( b ) & & b ( ) } , error : function ( a ) { var b = " " ; try { b = JSON . parse ( a . responseText ) . errorMessage + " ( " + JSON . parse ( a . responseText ) . errorNum + " ) " , arangoHelper . arangoError ( a . statusText , b ) } catch ( c ) { throw a . statusText } } } ) } , l . patchNode = function ( a , b , c ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : n . vertices + a . _id , data : JSON . stringify ( b ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( ) { a . _data = $ . extend ( a . _data , b ) , c ( a ) } , error : function ( a ) { throw a . statusText } } ) } , l . changeToGraph = function ( a , b ) { e . cleanUp ( ) , q ( a ) , void 0 ! = = b & & ( k = b = = = ! 0 ? " any " : " outbound " ) } , l . setNodeLimit = function ( a , b ) { e . setNodeLimit ( a , b ) } , l . setChildLimit = function ( a ) { e . setChildLimit ( a ) } , l . expandCommunity = function ( a , b ) { e . expandCommunity ( a ) , void 0 ! = = b & & b ( ) } , l . getGraphs = function ( a ) { a & & a . length > = 1 & & s ( o . getAllGraphs , { } , a ) } , l . getAttributeExamples = function ( a ) { if ( a & & a . length > = 1 ) { var b , c = [ ] , d = _ . shuffle ( l . getNodeCollections ( ) ) ; for ( b = 0 ; b < d . length ; + + b ) { var e = t ( 10 , d [ b ] ) ; $ . ajax ( { cache : ! 1 , type : " GET " , async : ! 1 , url : arangoHelper . databaseUrl ( " / _api / collection / " + encodeURIComponent ( d [ b ] ) + " / count " ) , contentType : " application / json " , success : function ( a ) { l . TOTAL_NODES = l . TOTAL_NODES + a . count } } ) , e . length > 0 & & ( c = c . concat ( _ . flatten ( _ . map ( e , function ( a ) { return _ . keys ( a ) } ) ) ) ) } c = _ . sortBy ( _ . uniq ( c ) , function ( a ) { return a . toLowerCase ( ) } ) , a ( c ) } } , l . getEdgeCollections = function ( ) { return h } , l . getSelectedEdgeCollection = function ( ) { return i } , l . useEdgeCollection = function ( a ) { if ( ! _ . contains ( h , a ) ) throw " Collection " + a + " is not available in the graph . " ; i = a } , l . getNodeCollections = function ( ) { return f } , l . getSelectedNodeCollection = function ( ) { return g } , l . useNodeCollection = function ( a ) { if ( ! _ . contains ( f , a ) ) throw " Collection " + a + " is not available in the graph . " ; g = a } , l . getDirection = function ( ) { return k } , l . getGraphName = function ( ) { return j } , l . setWidth = e . setWidth , l . changeTo = e . changeTo , l . getPrioList = e . getPrioList } function JSONAdapter ( a , b , c , d , e , f ) { " use strict " ; var g = this , h = { } , i = { } , j = new AbstractAdapter ( b , c , this , d ) ; h . range = e / 2 , h . start = e / 4 , h . getStart = function ( ) { return this . start + Math . random ( ) * this . range } , i . range = f / 2 , i . start = f / 4 , i . getStart = function ( ) { return this . start + Math . random ( ) * this . range } , g . loadNode = function ( a , b ) { g . loadNodeFromTreeById ( a , b ) } , g . loadInitialNode = function ( b , c ) { var d = a + b + " . json " ; j . cleanUp ( ) , d3 . json ( d , function ( a , d ) { void 0 ! = = a & & null ! = = a & & console . log ( a ) ; var e = j . insertInitialNode ( d ) ; g . requestCentralityChildren ( b , function ( a ) { e . _centrality = a } ) , _ . each ( d . children , function ( a ) { var b = j . insertNode ( a ) , c = { _from : e . _id , _to : b . _id , _id : e . _id + " - " + b . _id } ; j . insertEdge ( c ) , g . requestCentralityChildren ( b . _id , function ( a ) { b . _centrality = a } ) , delete b . _data . children } ) , delete e . _data . children , c & & c ( e ) } ) } , g . loadNodeFromTreeById = function ( b , c ) { var d = a + b + " . json " ; d3 . json ( d , function ( a , d ) { void 0 ! = = a & & null ! = = a & & console . log ( a ) ; var e = j . insertNode ( d ) ; g . requestCentralityChildren ( b , function ( a ) { e . _centrality = a } ) , _ . each ( d . children , function ( a ) { var b = j . insertNode ( a ) , c = { _from : e . _id , _to : b . _id , _id : e . _id + " - " + b . _id } ; j . insertEdge ( c ) , g . requestCentralityChildren ( b . _id , function ( a ) { e . _centrality = a } ) , delete b . _data . children } ) , delete e . _data . children , c & & c ( e ) } ) } , g . requestCentralityChildren = function ( b , c ) { var d = a + b + " . json " ; d3 . json ( d , function ( a , b ) { void 0 ! = = a & & null ! = = a & & console . log ( a ) , void 0 ! = = c & & c ( void 0 ! = = b . children ? b . children . length : 0 ) } ) } , g . loadNodeFromTreeByAttributeValue = function ( a , b , c ) { throw " Sorry this adapter is read - only " } , g . loadInitialNodeByAttributeValue = function ( a , b , c ) { throw " Sorry this adapter is read - only " } , g . createEdge = function ( a , b ) { throw " Sorry this adapter is read - only " } , g . deleteEdge = function ( a , b ) { throw " Sorry this adapter is read - only " } , g . patchEdge = function ( a , b , c ) { throw " Sorry this adapter is read - only " } , g . createNode = function ( a , b ) { throw " Sorry this adapter is read - only " } , g . deleteNode = function ( a , b ) { throw " Sorry this adapter is read - only " } , g . patchNode = function ( a , b , c ) { throw " Sorry this adapter is read - only " } , g . setNodeLimit = function ( a , b ) { } , g . setChildLimit = function ( a ) { } , g . expandCommunity = function ( a , b ) { } , g . setWidth = function ( ) { } , g . explore = j . explore } function ModularityJoiner ( ) { " use strict " ; var a = { } , b = Array . prototype . forEach , c = Object . keys , d = Array . isArray , e = Object . prototype . toString , f = Array . prototype . indexOf , g = Array . prototype . map , h = Array . prototype . some , i = { isArray : d | | function ( a ) { return " [ object Array ] " = = = e . call ( a ) } , isFunction : function ( a ) { return " function " = = typeof a } , isString : function ( a ) { return " [ object String ] " = = = e . call ( a ) } , each : function ( c , d , e ) { if ( null ! = = c & & void 0 ! = = c ) { var f , g , h ; if ( b & & c . forEach = = = b ) c . forEach ( d , e ) ; else if ( c . length = = = + c . length ) { for ( f = 0 , g = c . length ; g > f ; f + + ) if ( d . call ( e , c [ f ] , f , c ) = = = a ) return } else for ( h in c ) if ( c . hasOwnProperty ( h ) & & d . call ( e , c [ h ] , h , c ) = = = a ) return } } , keys : c | | function ( a ) { if ( " object " ! = typeof a | | Array . isArray ( a ) ) throw new TypeError ( " Invalid object " ) ; var b , c = [ ] ; for ( b in a ) a . hasOwnProperty ( b ) & & ( c [ c . length ] = b ) ; return c } , min : function ( a , b , c ) { if ( ! b & & i . isArray ( a ) & & a [ 0 ] = = = + a [ 0 ] & & a . length < 65535 ) return Math . min . apply ( Math , a ) ; if ( ! b & & i . isEmpty ( a ) ) return 1 / 0 ; var d = { computed : 1 / 0 , value : 1 / 0 } ; return i . each ( a , function ( a , e , f ) { var g = b ? b . call ( c , a , e , f ) : a ; g < d . computed & & ( d = { value : a , computed : g } ) } ) , d . value } , map : function ( a , b , c ) { var d = [ ] ; return null = = = a ? d : g & & a . map = = = g ? a . map ( b , c ) : ( i . each ( a , function ( a , e , f ) { d [ d . length ] = b . call ( c , a , e , f ) } ) , d ) } , pluck : function ( a , b ) { return i . map ( a , function ( a ) { return a [ b ] } ) } , uniq : function ( a , b , c , d ) { i . isFunction ( b ) & & ( d = c , c = b , b = ! 1 ) ; var e = c ? i . map ( a , c , d ) : a , f = [ ] , g = [ ] ; return i . each ( e , function ( c , d ) { b ? d & & g [ g . length - 1 ] = = = c | | ( g . push ( c ) , f . push ( a [ d ] ) ) : i . contains ( g , c ) | | ( g . push ( c ) , f . push ( a [ d ] ) ) } ) , f } , union : function ( ) { return i . uniq ( Array . prototype . concat . apply ( Array . prototype , arguments ) ) } , isEmpty : function ( a ) { var b ; if ( null = = = a ) return ! 0 ; if ( i . isArray ( a ) | | i . isString ( a ) ) return 0 = = = a . length ; for ( b in a ) if ( a . hasOwnProperty ( b ) ) return ! 1 ; return ! 0 } , any : function ( b , c , d ) { c = c | | i . identity ; var e = ! 1 ; return null = = = b ? e : h & & b . some = = = h ? b . some ( c , d ) : ( i . each ( b , function ( b , f , g ) { return e ? a : ( e = c . call ( d , b , f , g ) , a ) } ) , ! ! e ) } , contains : function ( a , b ) { return null = = = a ? ! 1 : f & & a . indexOf = = = f ? - 1 ! = = a . indexOf ( b ) : i . any ( a , function ( a ) { return a = = = b } ) } , values : function ( a ) { var b , c = [ ] ; for ( b in a ) a . hasOwnProperty ( b ) & & c . push ( a [ b ] ) ; return c } } , j = { } , k = { } , l = { } , m = 0 , n = 0 , o = null , p = null , q = null , r = { } , s = function ( a ) { var b , c = Number . NEGATIVE_INFINITY ; return i . each ( p [ a ] , function ( a , d ) { a > c & & ( c = a , b = d ) } ) , 0 > c ? void delete q [ a ] : void ( q [ a ] = b ) } , t = function ( a , b ) { s ( b ) } , u = function ( a , b ) { return b > a ? p [ a ] & & p [ a ] [ b ] : p [ b ] & & p [ b ] [ a ] } , v = function ( a , b ) { return b > a ? p [ a ] [ b ] : p [ b ] [ a ] } , w = function ( a , b , c ) { return b > a ? ( p [ a ] = p [ a ] | | { } , void ( p [ a ] [ b ] = c ) ) : ( p [ b ] = p [ b ] | | { } , void ( p [ b ] [ a ] = c ) ) } , x = function ( a , b ) { if ( b > a ) { if ( ! p [ a ] ) return ; return delete p [ a ] [ b ] , void ( i . isEmpty ( p [ a ] ) & & delete p [ a ] ) } a ! = = b & & x ( b , a ) } , y = function ( a , b ) { var c , d ; return b > a ? u ( a , b ) ? ( d = v ( a , b ) , q [ a ] = = = b ? void s ( a ) : u ( a , q [ a ] ) ? ( c = v ( a , q [ a ] ) , void ( d > c & & ( q [ a ] = b ) ) ) : void s ( a ) ) : void s ( a ) : void ( a ! = = b & & y ( b , a ) ) } , z = function ( a , b ) { o [ a ] . _in + = o [ b ] . _in , o [ a ] . _out + = o [ b ] . _out , delete o [ b ] } , A = function ( a , b ) { j [ a ] = j [ a ] | | { } , j [ a ] [ b ] = ( j [ a ] [ b ] | | 0 ) + 1 , k [ b ] = k [ b ] | | { } , k [ b ] [ a ] = ( k [ b ] [ a ] | | 0 ) + 1 , l [ a ] = l [ a ] | | { _in : 0 , _out : 0 } , l [ b ] = l [ b ] | | { _in : 0 , _out : 0 } , l [ a ] . _out + + , l [ b ] . _in + + , m + + , n = Math . pow ( m , - 1 ) } , B = function ( a , b ) { j [ a ] & & ( j [ a ] [ b ] - - , 0 = = = j [ a ] [ b ] & & delete j [ a ] [ b ] , k [ b ] [ a ] - - , 0 = = = k [ b ] [ a ] & & delete k [ b ] [ a ] , l [ a ] . _out - - , l [ b ] . _in - - , m - - , n = m > 0 ? Math . pow ( m , - 1 ) : 0 , i . isEmpty ( j [ a ] ) & & delete j [ a ] , i . isEmpty ( k [ b ] ) & & delete k [ b ] , 0 = = = l [ a ] . _in & & 0 = = = l [ a ] . _out & & delete l [ a ] , 0 = = = l [ b ] . _in & & 0 = = = l [ b ] . _out & & delete l [ b ] ) } , C = function ( ) { return o = { } , i . each ( l , function ( a , b ) { o [ b ] = { _in : a . _in / m , _out : a . _out / m } } ) , o } , D = function ( a , b ) { return o [ a ] . _out * o [ b ] . _in + o [ a ] . _in * o [ b ] . _out } , E = function ( a ) { var b = i . keys ( j [ a ] | | { } ) , c = i . keys ( k [ a ] | | { } ) ; return i . union ( b , c ) } , F = function ( ) { p = { } , i . each ( j , function ( a , b ) { var c = k [ b ] | | { } , d = E ( b ) ; i . each ( d , function ( d ) { var e , f = a [ d ] | | 0 ; f + = c [ d ] | | 0 , e = f * n - D ( b , d ) , e > 0 & & w ( b , d , e ) } ) } ) } , G = function ( ) { return q = { } , i . each ( p , t ) , q } , H = function ( a , b , c ) { var d ; return u ( c , a ) ? ( d = v ( c , a ) , u ( c , b ) ? ( d + = v ( c , b ) , w ( c , a , d ) , x ( c , b ) , y ( c , a ) , void y ( c , b ) ) : ( d - = D ( c , b ) , 0 > d & & x ( c , a ) , void y ( c , a ) ) ) : void ( u ( c , b ) & & ( d = v ( c , b ) , d - = D ( c , a ) , d > 0 & & w ( c , a , d ) , y ( c , a ) , x ( c , b ) , y ( c , b ) ) ) } , I = function ( a , b ) { i . each ( p , function ( c , d ) { return d = = = a | | d = = = b ? void i . each ( c , function ( c , d ) { return d = = = b ? ( x ( a , b ) , void y ( a , b ) ) : void H ( a , b , d ) } ) : void H ( a , b , d ) } ) } , J = function ( ) { return j } , K = function ( ) { return q } , L = function ( ) { return p } , M = function ( ) { return o } , N = function ( ) { return r } , O = function ( ) { var a , b , c = Number . NEGATIVE_INFINITY ; return i . each ( q , function ( d , e ) { c < p [ e ] [ d ] & & ( a = d , b = e , c = p [ e ] [ d ] ) } ) , 0 > = c ? null : { sID : b , lID : a , val : c } } , P = function ( a ) { var b , c = Number . NEGATIVE_INFINITY ; return i . each ( a , function ( a ) { a . q > c & & ( c = a . q , b = a . nodes ) } ) , b } , Q = function ( ) { C ( ) , F ( ) , G ( ) , r = { } } , R = function ( a ) { var b = a . sID , c = a . lID , d = a . val ; r [ b ] = r [ b ] | | { nodes : [ b ] , q : 0 } , r [ c ] ? ( r [ b ] . nodes = r [ b ] . nodes . concat ( r [ c ] . nodes ) , r [ b ] . q + = r [ c ] . q , delete r [ c ] ) : r [ b ] . nodes . push ( c ) , r [ b ] . q + = d , I ( b , c ) , z ( b , c ) } , S = function ( a , b , c ) { if ( 0 = = = c . length ) return ! 0 ; var d = [ ] ; return i . each ( c , function ( c ) { a [ c ] = = = Number . POSITIVE_INFINITY & & ( a [ c ] = b , d = d . concat ( E ( c ) ) ) } ) , S ( a , b + 1 , d ) } , T = function ( a ) { var b = { } ; if ( i . each ( j , function ( a , c ) { b [ c ] = Number . POSITIVE_INFINITY } ) , b [ a ] = 0 , S ( b , 1 , E ( a ) ) ) return b ; throw " FAIL ! " } , U = function ( a ) { return function ( b ) { return a [ b ] } } , V = function ( a , b ) { var c , d = { } , e = [ ] , f = { } , g = function ( a , b ) { var c = f [ i . min ( a , U ( f ) ) ] , e = f [ i . min ( b , U ( f ) ) ] , g = e - c ; return 0 = = = g & & ( g = d [ b [ b . length - 1 ] ] . q - d [ a [ a . length - 1 ] ] . q ) , g } ; for ( Q ( ) , c = O ( ) ; null ! = = c ; ) R ( c ) , c = O ( ) ; return d = N ( ) , void 0 ! = = b ? ( i . each ( d , function ( a , c ) { i . contains ( a . nodes , b ) & & delete d [ c ] } ) , e = i . pluck ( i . values ( d ) , " nodes " ) , f = T ( b ) , e . sort ( g ) , e [ 0 ] ) : P ( d ) } ; this . insertEdge = A , this . deleteEdge = B , this . getAdjacencyMatrix = J , this . getHeap = K , this . getDQ = L , this . getDegrees = M , this . getCommunities = N , this . getBest = O , this . setup = Q , this . joinCommunity = R , this . getCommunity = V } function NodeReducer ( a ) { " use strict " ; a = a | | [ ] ; var b = function ( a , b ) { a . push ( b ) } , c = function ( a , b ) { if ( ! a . reason . example ) return a . reason . example = b , 1 ; var c = b . _data | | { } , d = a . reason . example . _data | | { } , e = _ . union ( _ . keys ( d ) , _ . keys ( c ) ) , f = 0 , g = 0 ; return _ . each ( e , function ( a ) { void 0 ! = = d [ a ] & & void 0 ! = = c [ a ] & & ( f + + , d [ a ] = = = c [ a ] & & ( f + = 4 ) ) } ) , g = 5 * e . length , g + + , f + + , f / g } , d = function ( ) { return a } , e = function ( b ) { a = b } , f = function ( b , c ) { var d = { } , e = [ ] ; return _ . each ( b , function ( b ) { var c , e , f = b . _data , g = 0 ; for ( g = 0 ; g < a . length ; g + + ) if ( c = a [ g ] , void 0 ! = = f [ c ] ) return e = f [ c ] , d [ c ] = d [ c ] | | { } , d [ c ] [ e ] = d [ c ] [ e ] | | [ ] , void d [ c ] [ e ] . push ( b ) ; e = " default " , d [ e ] = d [ e ] | | [ ] , d [ e ] . push ( b ) } ) , _ . each ( d , function ( a , b ) { _ . each ( a , function ( a , c ) { var d = { key : b , value : c , text : b + " : " + c } ; e . push ( { reason : d , nodes : a } ) } ) } ) , e } , g = function ( d , e ) { var g = [ ] , h = . 5 ; return d . length < = e ? g = _ . map ( d , function ( a ) { return { reason : { type : " single " , text : " One Node " } , nodes : [ a ] } } ) : _ . isEmpty ( a ) ? ( _ . each ( d , function ( a ) { var d , f , i ; for ( f = 0 , i = Number . POSITIVE_INFINITY , d = 0 ; e > d ; d + + ) { if ( g [ d ] = g [ d ] | | { reason : { type : " similar " , text : " Similar Nodes " } , nodes : [ ] } , c ( g [ d ] , a ) > h ) return void b ( g [ d ] . nodes , a ) ; i > g [ d ] . nodes . length & & ( f = d , i = g [ d ] . nodes . length ) } b ( g [ f ] . nodes , a ) } ) , g ) : f ( d , e ) } ; this . bucketNodes = g , this . changePrioList = e , this . getPrioList = d } function NodeShaper ( a , b , c ) { " use strict " ; var d , e , f = this , g = [ ] , h = ! 0 , i = new ContextMenu ( " gv_node_cm " ) , j = function ( a , b ) { return _ . isArray ( a ) ? b [ _ . find ( a , function ( a ) { return b [ a ] } ) ] : b [ a ] } , k = function ( a ) { if ( void 0 = = = a ) return [ " " ] ; " string " ! = typeof a & & ( a = String ( a ) ) ; var b = a . match ( / [ \ w \ W ] { 1 , 10 } ( \ s | $ ) | \ S + ? ( \ s | $ ) / g ) ; return b [ 0 ] = $ . trim ( b [ 0 ] ) , b [ 1 ] = $ . trim ( b [ 1 ] ) , b [ 0 ] . length > 12 & & ( b [ 0 ] = $ . trim ( a . substring ( 0 , 10 ) ) , b [ 1 ] = $ . trim ( a . substring ( 10 ) ) , b [ 1 ] . length > 12 & & ( b [ 1 ] = b [ 1 ] . split ( / \ W / ) [ 0 ] , b [ 1 ] . length > 2 & & ( b [ 1 ] = b [ 1 ] . substring ( 0 , 5 ) + " . . . " ) ) , b . length = 2 ) , b . length > 2 & & ( b . length = 2 , b [ 1 ] + = " . . . " ) , b } , l = function ( a ) { } , m = l , n = function ( a ) { return { x : a . x , y : a . y , z : 1 } } , o = n , p = function ( ) { _ . each ( g , function ( a ) { a . position = o ( a ) , a . _isCommunity & & a . addDistortion ( o ) } ) } , q = new ColourMapper , r = function ( ) { q . reset ( ) } , s = function ( a ) { return a . _id } , t = l , u = l , v = l , w = function ( ) { return " black " } , x = function ( ) { f . parent . selectAll ( " . node " ) . on ( " mousedown . drag " , null ) , d = { click : l , dblclick : l , drag : l , mousedown : l , mouseup : l , mousemove : l , mouseout : l , mouseover : l } , e = l } , y = function ( a ) { _ . each ( d , function ( b , c ) { " drag " = = = c ? a . call ( b ) : a . on ( c , b ) } ) } , z = function ( a ) { var b = a . filter ( function ( a ) { return a . _isCommunity } ) , c = a . filter ( function ( a ) { return ! a . _isCommunity } ) ; u ( c ) , b . each ( function ( a ) { a . shapeNodes ( d3 . select ( this ) , u , z , m , q ) } ) , h & & v ( c ) , t ( c ) , y ( c ) , p ( ) } , A = function ( a , b ) { if ( " update " = = = a ) e = b ; else { if ( void 0 = = = d [ a ] ) throw " Sorry Unknown Event " + a + " cannot be bound . " ; d [ a ] = b } } , B = function ( ) { var a = f . parent . selectAll ( " . node " ) ; p ( ) , a . attr ( " transform " , function ( a ) { return " translate ( " + a . position . x + " , " + a . position . y + " ) scale ( " + a . position . z + " ) " } ) , e ( a ) } , C = function ( a ) { void 0 ! = = a & & ( g = a ) ; var b = f . parent . selectAll ( " . node " ) . data ( g , s ) ; b . enter ( ) . append ( " g " ) . attr ( " class " , function ( a ) { return a . _isCommunity ? " node communitynode " : " node " } ) . attr ( " id " , s ) , b . exit ( ) . remove ( ) , b . selectAll ( " * > * " ) . remove ( ) , z ( b ) , B ( ) , i . bindMenu ( $ ( " . node " ) ) } , D = function ( a ) { var b , c , d , e , f , g , h ; switch ( a . type ) { case NodeShaper . shapes . NONE : u = l ; break ; case NodeShaper . shapes . CIRCLE : b = a . radius | | 25 , u = function ( a , c ) { a . append ( " circle " ) . attr ( " r " , b ) , c & & a . attr ( " cx " , - c ) . attr ( " cy " , - c ) } ; break ; case NodeShaper . shapes . RECT : c = a . width | | 90 , d = a . height | | 36 , e = _ . isFunction ( c ) ? function ( a ) { return - ( c ( a ) / 2 ) } : function ( a ) { return - ( c / 2 ) } , f = _ . isFunction ( d ) ? function ( a ) { return - ( d ( a ) / 2 ) } : function ( ) { return - ( d / 2 ) } , u = function ( a , b ) { b = b | | 0 , a . append ( " rect " ) . attr ( " width " , c ) . attr ( " height " , d ) . attr ( " x " , function ( a ) { return e ( a ) - b } ) . attr ( " y " , function ( a ) { return f ( a ) - b } ) . attr ( " rx " , " 8 " ) . attr ( " ry " , " 8 " ) } ; break ; case NodeShaper . shapes . IMAGE : c = a . width | | 32 , d = a . height | | 32 , g = a . fallback | | " " , h = a . source | | g , e = _ . isFunction ( c ) ? function ( a ) { return - ( c ( a ) / 2 ) } : - ( c / 2 ) , f = _ . isFunction ( d ) ? function ( a ) { return - ( d ( a ) / 2 ) } : - ( d / 2 ) , u = function ( a ) { var b = a . append ( " image " ) . attr ( " width " , c ) . attr ( " height " , d ) . attr ( " x " , e ) . attr ( " y " , f ) ; _ . isFunction ( h ) ? b . attr ( " xlink : href " , h ) : b . attr ( " xlink : href " , function ( a ) { return a . _data [ h ] ? a . _data [ h ] : g } ) } ; break ; case void 0 : break ; default : throw " Sorry given Shape not known ! " } } , E = function ( a ) { var b = [ ] ; _ . each ( a , function ( a ) { b = $ ( a ) . find ( " text " ) , $ ( a ) . css ( " width " , " 90px " ) , $ ( a ) . css ( " height " , " 36px " ) , $ ( a ) . textfill ( { innerTag : " text " , maxFontPixels : 16 , minFontPixels : 10 , explicitWidth : 90 , explicitHeight : 36 } ) } ) } , F = function ( a ) { v = _ . isFunction ( a ) ? function ( b ) { var c = b . append ( " text " ) . attr ( " text - anchor " , " middle " ) . attr ( " fill " , w ) . attr ( " stroke " , " none " ) ; c . each ( function ( b ) { var c = k ( a ( b ) ) , d = c [ 0 ] ; 2 = = = c . length & & ( d + = c [ 1 ] ) , d . length > 15 & & ( d = d . substring ( 0 , 13 ) + " . . . " ) , void 0 ! = = d & & " " ! = = d | | ( d = " ATTR NOT SET " ) , d3 . select ( this ) . append ( " tspan " ) . attr ( " x " , " 0 " ) . attr ( " dy " , " 5 " ) . text ( d ) } ) , E ( b ) } : function ( b ) { var c = b . append ( " text " ) . attr ( " text - anchor " , " middle " ) . attr ( " fill " , w ) . attr ( " stroke " , " none " ) ; c . each ( function ( b ) { var c = k ( j ( a , b . _data ) ) , d = c [ 0 ] ; 2 = = = c . length & & ( d + = c [ 1 ] ) , d . length > 15 & & ( d = d . substring ( 0 , 13 ) + " . . . " ) , void 0 ! = = d & & " " ! = = d | | ( d = " ATTR NOT SET " ) , d3 . select ( this ) . append ( " tspan " ) . attr ( " x " , " 0 " ) . attr ( " dy " , " 5 " ) . text ( d ) } ) , E ( b ) } } , G = function ( a ) { void 0 ! = = a . reset & & a . reset & & x ( ) , _ . each ( a , function ( a , b ) { " reset " ! = = b & & A ( b , a ) } ) } , H = function ( a ) { switch ( r ( ) , a . type ) { case " single " : t = function ( b ) { b . attr ( " fill " , a . fill ) } , w = function ( b ) { return a . stroke } ; break ; case " expand " : t = function ( b ) { b . attr ( " fill " , function ( b ) { return b . _expanded ? a . expanded : a . collapsed } ) } , w = function ( a ) { return " white " } ; break ; case " attribute " : t = function ( b ) { b . attr ( " fill " , function ( b ) { return void 0 = = = b . _data ? q . getCommunityColour ( ) : q . getColour ( j ( a . key , b . _data ) ) } ) . attr ( " stroke " , function ( a ) { return a . _expanded ? " # fff " : " transparent " } ) . attr ( " fill - opacity " , function ( a ) { return a . _expanded ? " 1 " : " 0 . 3 " } ) } , w = function ( b ) { return void 0 = = = b . _data ? q . getForegroundCommunityColour ( ) : q . getForegroundColour ( j ( a . key , b . _data ) ) } ; break ; default : throw " Sorry given colour - scheme not known " } } , I = function ( a ) { if ( " reset " = = = a ) o = n ; else { if ( ! _ . isFunction ( a ) ) throw " Sorry distortion cannot be parsed . " ; o = a } } , J = function ( a ) { void 0 ! = = a . shape & & D ( a . shape ) , void 0 ! = = a . label & & ( F ( a . label ) , f . label = a . label ) , void 0 ! = = a . actions & & G ( a . actions ) , void 0 ! = = a . color & & ( H ( a . color ) , f . color = a . color ) , void 0 ! = = a . distortion & & I ( a . distortion ) } ; f . parent = a , x ( ) , void 0 = = = b & & ( b = { } ) , void 0 = = = b . shape & & ( b . shape = { type : NodeShaper . shapes . RECT } ) , void 0 = = = b . color & & ( b . color = { type : " single " , fill : " # 333333 " , stroke : " white " } ) , void 0 = = = b . distortion & & ( b . distortion = " reset " ) , J ( b ) , _ . isFunction ( c ) & & ( s = c ) , f . changeTo = function ( a ) { J ( a ) , C ( ) } , f . drawNodes = function ( a ) { C ( a ) } , f . updateNodes = function ( ) { B ( ) } , f . reshapeNodes = function ( ) { C ( ) } , f . activateLabel = function ( a ) { h = ! ! a , C ( ) } , f . getColourMapping = function ( ) { return q . getList ( ) } , f . setColourMappingListener = function ( a ) { q . setChangeListener ( a ) } , f . setGVStartFunction = function ( a ) { m = a } , f . getLabel = function ( ) { return f . label | | " " } , f . getColor = function ( ) { return f . color . key | | " " } , f . addMenuEntry = function ( a , b ) { i . addEntry ( a , b ) } , f . resetColourMap = r } function PreviewAdapter ( a , b , c , d ) { " use strict " ; if ( void 0 = = = a ) throw " The nodes have to be given . " ; if ( void 0 = = = b ) throw " The edges have to be given . " ; if ( void 0 = = = c ) throw " A reference to the graph viewer has to be given . " ; var e = this , f = new AbstractAdapter ( a , b , this , c ) , g = function ( a ) { void 0 ! = = a . width & & f . setWidth ( a . width ) , void 0 ! = = a . height & & f . setHeight ( a . height ) } , h = function ( a , b ) { var c = { } , d = a . first ; d = f . insertNode ( d ) , _ . each ( a . nodes , function ( a ) { a = f . insertNode ( a ) , c [ a . _id ] = a } ) , _ . each ( a . edges , function ( a ) { f . insertEdge ( a ) } ) , delete c [ d . _id ] , void 0 ! = = b & & _ . isFunction ( b ) & & b ( d ) } ; d = d | | { } , g ( d ) , e . loadInitialNode = function ( a , b ) { f . cleanUp ( ) ; var c = function ( a ) { b ( f . insertInitialNode ( a ) ) } ; e . loadNode ( a , c ) } , e . loadNode = function ( a , b ) { var c = [ ] , d = [ ] , e = { } , f = { _id : 1 , label : " Node 1 " , image : " img / stored . png " } , g = { _id : 2 , label : " Node 2 " } , i = { _id : 3 , label : " Node 3 " } , j = { _id : 4 , label : " Node 4 " } , k = { _id : 5 , label : " Node 5 " } , l = { _id : " 1 - 2 " , _from : 1 , _to : 2 , label : " Edge 1 " } , m = { _id : " 1 - 3 " , _from : 1 , _to : 3 , label : " Edge 2 " } , n = { _id : " 1 - 4 " , _from : 1 , _to : 4 , label : " Edge 3 " } , o = { _id : " 1 - 5 " , _from : 1 , _to : 5 , label : " Edge 4 " } , p = { _id : " 2 - 3 " , _from : 2 , _to : 3 , label : " Edge 5 " } ; c . push ( f ) , c . push ( g ) , c . push ( i ) , c . push ( j ) , c . push ( k ) , d . push ( l ) , d . push ( m ) , d . push ( n ) , d . push ( o ) , d . push ( p ) , e . first = f , e . nodes = c , e . edges = d , h ( e , b ) } , e . explore = f . explore , e . requestCentralityChildren = function ( a , b ) { } , e . createEdge = function ( a , b ) { arangoHelper . arangoError ( " Server - side " , " createEdge was triggered . " ) } , e . deleteEdge = function ( a , b ) { arangoHelper . arangoError ( " Server - side " , " deleteEdge was triggered . " ) } , e . patchEdge = function ( a , b , c ) { arangoHelper . arangoError ( " Server - side " , " patchEdge was triggered . " ) } , e . createNode = function ( a , b ) { arangoHelper . arangoError ( " Server - side " , " createNode was triggered . " ) } , e . deleteNode = function ( a , b ) { arangoHelper . arangoError ( " Server - side " , " deleteNode was triggered . " ) , arangoHelper . arangoError ( " Server - side " , " onNodeDelete was triggered . " ) } , e . patchNode = function ( a , b , c ) { arangoHelper . arangoError ( " Server - side " , " patchNode was triggered . " ) } , e . setNodeLimit = function ( a , b ) { f . setNodeLimit ( a , b ) } , e . setChildLimit = function ( a ) { f . setChildLimit ( a ) } , e . setWidth = f . setWidth , e . expandCommunity = function ( a , b ) { f . expandCommunity ( a ) , void 0 ! = = b & & b ( ) } } function WebWorkerWrapper ( a , b ) { " use strict " ; if ( void 0 = = = a ) throw " A class has to be given . " ; if ( void 0 = = = b ) throw " A callback has to be given . " ; var c , d = Array . prototype . slice . call ( arguments ) , e = { } , f = function ( ) { var c , d = function ( a ) { switch ( a . data . cmd ) { case " construct " : try { w = new ( Function . prototype . bind . apply ( Construct , [ null ] . concat ( a . data . args ) ) ) , w ? self . postMessage ( { cmd : " construct " , result : ! 0 } ) : self . postMessage ( { cmd : " construct " , result : ! 1 } ) } catch ( b ) { self . postMessage ( { cmd : " construct " , result : ! 1 , error : b . message | | b } ) } break ; default : var c , d = { cmd : a . data . cmd } ; if ( w & & " function " = = typeof w [ a . data . cmd ] ) try { c = w [ a . data . cmd ] . apply ( w , a . data . args ) , c & & ( d . result = c ) , self . postMessage ( d ) } catch ( e ) { d . error = e . message | | e , self . postMessage ( d ) } else d . error = " Method not known " , self . postMessage ( d ) } } , e = function ( a ) { var b = " var w , Construct = " + a . toString ( ) + " ; self . onmessage = " + d . toString ( ) ; return new window . Blob ( b . split ( ) ) } , f = window . URL , g = new e ( a ) ; return c = new window . Worker ( f . createObjectURL ( g ) ) , c . onmessage = b , c } , g = function ( ) { return a . apply ( this , d ) } ; try { return c = f ( ) , e . call = function ( a ) { var b = Array . prototype . slice . call ( arguments ) ; b . shift ( ) , c . postMessage ( { cmd : a , args : b } ) } , d . shift ( ) , d . shift ( ) , d . unshift ( " construct " ) , e . call . apply ( this , d ) , e } catch ( h ) { d . shift ( ) , d . shift ( ) , g . prototype = a . prototype ; try { c = new g } catch ( i ) { return void b ( { data : { cmd : " construct " , error : i } } ) } return e . call = function ( a ) { var d = Array . prototype . slice . call ( arguments ) , e = { data : { cmd : a } } ; if ( ! _ . isFunction ( c [ a ] ) ) return e . data . error = " Method not known " , void b ( e ) ; d . shift ( ) ; try { e . data . result = c [ a ] . apply ( c , d ) , b ( e ) } catch ( f ) { e . data . error = f , b ( e ) } } , b ( { data : { cmd : " construct " , result : ! 0 } } ) , e } } function ZoomManager ( a , b , c , d , e , f , g , h ) { " use strict " ; if ( void 0 = = = a | | 0 > a ) throw " A width has to be given . " ; if ( void 0 = = = b | | 0 > b ) throw " A height has to be given . " ; if ( void 0 = = = c | | void 0 = = = c . node | | " svg " ! = = c . node ( ) . tagName . toLowerCase ( ) ) throw " A svg has to be given . " ; if ( void 0 = = = d | | void 0 = = = d . node | | " g " ! = = d . node ( ) . tagName . toLowerCase ( ) ) throw " A group has to be given . " ; if ( void 0 = = = e | | void 0 = = = e . activateLabel | | void 0 = = = e . changeTo | | void 0 = = = e . updateNodes ) throw " The Node shaper has to be given . " ; if ( void 0 = = = f | | void 0 = = = f . activateLabel | | void 0 = = = f . updateEdges ) throw " The Edge shaper has to be given . " ; var i , j , k , l , m , n , o , p , q , r , s , t , u , v , w , x = this , y = a * b , z = h | | function ( ) { } , A = function ( ) { var a , b ; return l > = k ? ( b = i * l , b * = b , a = 60 * b ) : ( b = j * l , b * = b , a = 4 * Math . PI * b ) , Math . floor ( y / a ) } , B = function ( ) { q = s / l - . 99999999 , r = t / l , p . distortion ( q ) , p . radius ( r ) } , C = function ( a , b , c , g ) { g ? null ! = = a & & ( l = a ) : l = a , null ! = = b & & ( m [ 0 ] + = b ) , null ! = = c & & ( m [ 1 ] + = c ) , o = A ( ) , z ( o ) , e . activateLabel ( l > = k ) , f . activateLabel ( l > = k ) , B ( ) ; var h = " translate ( " + m + " ) " , i = " scale ( " + l + " ) " ; d . _isCommunity ? d . attr ( " transform " , h ) : d . attr ( " transform " , h + i ) , v & & v . slider ( " option " , " value " , l ) } , D = function ( a ) { var b = [ ] ; return b [ 0 ] = a [ 0 ] - n [ 0 ] , b [ 1 ] = a [ 1 ] - n [ 1 ] , n [ 0 ] = a [ 0 ] , n [ 1 ] = a [ 1 ] , b } , E = function ( a ) { void 0 = = = a & & ( a = { } ) ; var b = a . maxFont | | 16 , c = a . minFont | | 6 , d = a . maxRadius | | 25 , e = a . minRadius | | 4 ; s = a . focusZoom | | 1 , t = a . focusRadius | | 100 , w = e / d , i = b , j = d , k = c / b , l = 1 , m = [ 0 , 0 ] , n = [ 0 , 0 ] , B ( ) , o = A ( ) , u = d3 . behavior . zoom ( ) . scaleExtent ( [ w , 1 ] ) . on ( " zoom " , function ( ) { var a , b = d3 . event . sourceEvent , c = l ; " mousewheel " = = = b . type | | " DOMMouseScroll " = = = b . type ? ( b . wheelDelta ? b . wheelDelta > 0 ? ( c + = . 01 , c > 1 & & ( c = 1 ) ) : ( c - = . 01 , w > c & & ( c = w ) ) : b . detail > 0 ? ( c + = . 01 , c > 1 & & ( c = 1 ) ) : ( c - = . 01 , w > c & & ( c = w ) ) , a = [ 0 , 0 ] ) : a = D ( d3 . event . translate ) , C ( c , a [ 0 ] , a [ 1 ] ) } ) } , F = function ( ) { } ; p = d3 . fisheye . circular ( ) , E ( g ) , c . call ( u ) , e . changeTo ( { distortion : p } ) , c . on ( " mousemove " , F ) , x . translation = function ( ) { return null } , x . scaleFactor = function ( ) { return l } , x . scaledMouse = function ( ) { return null } , x . getDistortion = function ( ) { return q } , x . getDistortionRadius = function ( ) { return r } , x . getNodeLimit = function ( ) { return o } , x . getMinimalZoomFactor = function ( ) { return w } , x . registerSlider = function ( a ) { v = a } , x . triggerScale = function ( a ) { C ( a , null , null , ! 0 ) } , x . triggerTranslation = function ( a , b ) { C ( null , a , b , ! 0 ) } , x . changeWidth = function ( c ) { y = a * b } } function ArangoAdapterControls ( a , b ) { " use strict " ; if ( void 0 = = = a ) throw " A list element has to be given . " ; if ( void 0 = = = b ) throw " The ArangoAdapter has to be given . " ; this . addControlChangeCollections = function ( c ) { var d = " control_adapter_collections " , e = d + " _ " ; b . getCollections ( function ( f , g ) { b . getGraphs ( function ( h ) { uiComponentsHelper . createButton ( a , " Collections " , d , function ( ) { modalDialogHelper . createModalDialog ( " Switch Collections " , e , [ { <nl> - type : " decission " , id : " collections " , group : " loadtype " , text : " Select existing collections " , isDefault : void 0 = = = b . getGraphName ( ) , interior : [ { type : " list " , id : " node_collection " , text : " Vertex collection " , objects : f , selected : b . getNodeCollection ( ) } , { type : " list " , id : " edge_collection " , text : " Edge collection " , objects : g , selected : b . getEdgeCollection ( ) } ] } , { type : " decission " , id : " graphs " , group : " loadtype " , text : " Select existing graph " , isDefault : void 0 ! = = b . getGraphName ( ) , interior : [ { type : " list " , id : " graph " , objects : h , selected : b . getGraphName ( ) } ] } , { type : " checkbox " , text : " Start with random vertex " , id : " random " , selected : ! 0 } , { type : " checkbox " , id : " undirected " , selected : " any " = = = b . getDirection ( ) } ] , function ( ) { var a = $ ( " # " + e + " node_collection " ) . children ( " option " ) . filter ( " : selected " ) . text ( ) , d = $ ( " # " + e + " edge_collection " ) . children ( " option " ) . filter ( " : selected " ) . text ( ) , f = $ ( " # " + e + " graph " ) . children ( " option " ) . filter ( " : selected " ) . text ( ) , g = ! ! $ ( " # " + e + " undirected " ) . prop ( " checked " ) , h = ! ! $ ( " # " + e + " random " ) . prop ( " checked " ) , i = $ ( " input [ type = ' radio ' ] [ name = ' loadtype ' ] : checked " ) . prop ( " id " ) ; return i = = = e + " collections " ? b . changeToCollections ( a , d , g ) : b . changeToGraph ( f , g ) , h ? void b . loadRandomNode ( c ) : void ( _ . isFunction ( c ) & & c ( ) ) } ) } ) } ) } ) } , this . addControlChangePriority = function ( ) { var c = " control_adapter_priority " , d = c + " _ " , e = ( b . getPrioList ( ) , " Group vertices " ) ; uiComponentsHelper . createButton ( a , e , c , function ( ) { modalDialogHelper . createModalChangeDialog ( e , d , [ { type : " extendable " , id : " attribute " , objects : b . getPrioList ( ) } ] , function ( ) { var a = $ ( " input [ id ^ = " + d + " attribute_ ] " ) , c = [ ] ; a . each ( function ( a , b ) { var d = $ ( b ) . val ( ) ; " " ! = = d & & c . push ( d ) } ) , b . changeTo ( { prioList : c } ) } ) } ) } , this . addAll = function ( ) { this . addControlChangeCollections ( ) , this . addControlChangePriority ( ) } } function ContextMenu ( a ) { " use strict " ; if ( void 0 = = = a ) throw " An id has to be given . " ; var b , c , d = " # " + a , e = function ( a , d ) { var e , f ; e = document . createElement ( " div " ) , e . className = " context - menu - item " , f = document . createElement ( " div " ) , f . className = " context - menu - item - inner " , f . appendChild ( document . createTextNode ( a ) ) , f . onclick = function ( ) { d ( d3 . select ( c . target ) . data ( ) [ 0 ] ) } , e . appendChild ( f ) , b . appendChild ( e ) } , f = function ( a ) { c = $ . contextMenu . create ( d , { shadow : ! 1 } ) , a . each ( function ( ) { $ ( this ) . bind ( " contextmenu " , function ( a ) { return c . show ( this , a ) , ! 1 } ) } ) } , g = function ( ) { return b = document . getElementById ( a ) , b & & b . parentElement . removeChild ( b ) , b = document . createElement ( " div " ) , b . className = " context - menu context - menu - theme - osx " , b . id = a , document . body . appendChild ( b ) , b } ; g ( ) , this . addEntry = e , this . bindMenu = f } function EdgeShaperControls ( a , b ) { " use strict " ; if ( void 0 = = = a ) throw " A list element has to be given . " ; if ( void 0 = = = b ) throw " The EdgeShaper has to be given . " ; var c = this ; this . addControlOpticShapeNone = function ( ) { var c = " control_edge_none " ; uiComponentsHelper . createButton ( a , " None " , c , function ( ) { b . changeTo ( { shape : { type : EdgeShaper . shapes . NONE } } ) } ) } , this . addControlOpticShapeArrow = function ( ) { var c = " control_edge_arrow " ; uiComponentsHelper . createButton ( a , " Arrow " , c , function ( ) { b . changeTo ( { shape : { type : EdgeShaper . shapes . ARROW } } ) } ) } , this . addControlOpticLabel = function ( ) { var c = " control_edge_label " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Configure Label " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch Label Attribute " , d , [ { type : " text " , id : " key " , text : " Edge label attribute " , value : b . getLabel ( ) } ] , function ( ) { var a = $ ( " # " + d + " key " ) . attr ( " value " ) ; b . changeTo ( { label : a } ) } ) } ) } , this . addControlOpticLabelList = function ( ) { var d = " control_edge_label " , e = d + " _ " ; uiComponentsHelper . createButton ( a , " Configure Label " , d , function ( ) { modalDialogHelper . createModalDialog ( " Change Label Attribute " , e , [ { type : " extendable " , id : " label " , text : " Edge label attribute " , objects : b . getLabel ( ) } ] , function ( ) { var a = $ ( " input [ id ^ = " + e + " label_ ] " ) , d = [ ] ; a . each ( function ( a , b ) { var c = $ ( b ) . val ( ) ; " " ! = = c & & d . push ( c ) } ) ; var f = { label : d } ; c . applyLocalStorage ( f ) , b . changeTo ( f ) } ) } ) } , this . applyLocalStorage = function ( a ) { if ( " undefined " ! = = Storage ) try { var b = JSON . parse ( localStorage . getItem ( " graphSettings " ) ) , c = window . location . hash . split ( " / " ) [ 1 ] , d = window . location . pathname . split ( " / " ) [ 2 ] , e = c + d ; _ . each ( a , function ( a , c ) { void 0 ! = = c & & ( b [ e ] . viewer . hasOwnProperty ( " edgeShaper " ) | | ( b [ e ] . viewer . edgeShaper = { } ) , b [ e ] . viewer . edgeShaper [ c ] = a ) } ) , localStorage . setItem ( " graphSettings " , JSON . stringify ( b ) ) } catch ( f ) { console . log ( f ) } } , this . addControlOpticSingleColour = function ( ) { var c = " control_edge_singlecolour " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Single Colour " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch to Colour " , d , [ { type : " text " , id : " stroke " } ] , function ( ) { var a = $ ( " # " + d + " stroke " ) . attr ( " value " ) ; b . changeTo ( { color : { type : " single " , stroke : a } } ) } ) } ) } , this . addControlOpticAttributeColour = function ( ) { var c = " control_edge_attributecolour " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Colour by Attribute " , c , function ( ) { modalDialogHelper . createModalDialog ( " Display colour by attribute " , d , [ { type : " text " , id : " key " } ] , function ( ) { var a = $ ( " # " + d + " key " ) . attr ( " value " ) ; b . changeTo ( { color : { type : " attribute " , key : a } } ) } ) } ) } , this . addControlOpticGradientColour = function ( ) { var c = " control_edge_gradientcolour " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Gradient Colour " , c , function ( ) { modalDialogHelper . createModalDialog ( " Change colours for gradient " , d , [ { type : " text " , id : " source " } , { type : " text " , id : " target " } ] , function ( ) { var a = $ ( " # " + d + " source " ) . attr ( " value " ) , c = $ ( " # " + d + " target " ) . attr ( " value " ) ; b . changeTo ( { color : { type : " gradient " , source : a , target : c } } ) } ) } ) } , this . addAllOptics = function ( ) { c . addControlOpticShapeNone ( ) , c . addControlOpticShapeArrow ( ) , c . addControlOpticLabel ( ) , c . addControlOpticSingleColour ( ) , c . addControlOpticAttributeColour ( ) , c . addControlOpticGradientColour ( ) } , this . addAllActions = function ( ) { } , this . addAll = function ( ) { c . addAllOptics ( ) , c . addAllActions ( ) } } function EventDispatcherControls ( a , b , c , d , e ) { " use strict " ; if ( void 0 = = = a ) throw " A list element has to be given . " ; if ( void 0 = = = b ) throw " The NodeShaper has to be given . " ; if ( void 0 = = = c ) throw " The EdgeShaper has to be given . " ; if ( void 0 = = = d ) throw " The Start callback has to be given . " ; var f = this , g = { expand : { icon : " hand - pointer - o " , title : " Expand a node . " } , add : { icon : " plus - square " , title : " Add a node . " } , trash : { icon : " minus - square " , title : " Remove a node / edge . " } , drag : { icon : " hand - rock - o " , title : " Drag a node . " } , edge : { icon : " external - link - square " , title : " Create an edge between two nodes . " } , edit : { icon : " pencil - square " , title : " Edit attributes of a node . " } , view : { icon : " search " , title : " View attributes of a node . " } } , h = new EventDispatcher ( b , c , e ) , i = e . edgeEditor . adapter , j = ! ! i & & _ . isFunction ( i . useNodeCollection ) & & _ . isFunction ( i . useEdgeCollection ) , k = function ( b ) { a . appendChild ( b ) } , l = function ( a , b , c ) { var d = uiComponentsHelper . createIconButton ( a , " control_event_ " + b , c ) ; k ( d ) } , m = function ( a ) { h . rebind ( " nodes " , a ) } , n = function ( a ) { h . rebind ( " edges " , a ) } , o = function ( a ) { h . rebind ( " svg " , a ) } , p = function ( a ) { var b = a | | window . event , c = { } ; return c . x = b . clientX , c . y = b . clientY , c . x + = document . body . scrollLeft , c . y + = document . body . scrollTop , c } , q = function ( a ) { var b , c , d , e = p ( a ) , f = $ ( " svg # graphViewerSVG " ) . offset ( ) ; return b = d3 . select ( " svg # graphViewerSVG " ) . node ( ) , d = b . getBoundingClientRect ( ) , $ ( " svg # graphViewerSVG " ) . height ( ) < = d . height ? { x : e . x - f . left , y : e . y - f . top } : ( c = b . getBBox ( ) , { x : e . x - ( d . left - c . x ) , y : e . y - ( d . top - c . y ) } ) } , r = { nodes : { } , edges : { } , svg : { } } , s = function ( ) { var a = " control_event_new_node " , c = a + " _ " , e = function ( a ) { var e = q ( a ) ; modalDialogHelper . createModalCreateDialog ( " Create New Node " , c , { } , function ( a ) { h . events . CREATENODE ( a , function ( a ) { $ ( " # " + c + " modal " ) . modal ( " hide " ) , b . reshapeNodes ( ) , d ( ) } , e . x , e . y ) ( ) } ) } ; r . nodes . newNode = e } , t = function ( ) { var a = function ( a ) { modalDialogHelper . createModalViewDialog ( " View Node " + a . _id , " control_event_node_view_ " , a . _data , function ( ) { modalDialogHelper . createModalEditDialog ( " Edit Node " + a . _id , " control_event_node_edit_ " , a . _data , function ( b ) { h . events . PATCHNODE ( a , b , function ( ) { $ ( " # control_event_node_edit_modal " ) . modal ( " hide " ) } ) ( ) } ) } ) } , b = function ( a ) { modalDialogHelper . createModalViewDialog ( " View Edge " + a . _id , " control_event_edge_view_ " , a . _data , function ( ) { modalDialogHelper . createModalEditDialog ( " Edit Edge " + a . _id , " control_event_edge_edit_ " , a . _data , function ( b ) { h . events . PATCHEDGE ( a , b , function ( ) { $ ( " # control_event_edge_edit_modal " ) . modal ( " hide " ) } ) ( ) } ) } ) } ; r . nodes . view = a , r . edges . view = b } , u = function ( ) { var a = h . events . STARTCREATEEDGE ( function ( a , b ) { var d = q ( b ) , e = c . addAnEdgeFollowingTheCursor ( d . x , d . y ) ; h . bind ( " svg " , " mousemove " , function ( a ) { var b = q ( a ) ; e ( b . x , b . y ) } ) } ) , b = h . events . FINISHCREATEEDGE ( function ( a ) { c . removeCursorFollowingEdge ( ) , h . bind ( " svg " , " mousemove " , function ( ) { } ) , d ( ) } ) , e = function ( ) { h . events . CANCELCREATEEDGE ( ) , c . removeCursorFollowingEdge ( ) , h . bind ( " svg " , " mousemove " , function ( ) { } ) } ; r . nodes . startEdge = a , r . nodes . endEdge = b , r . svg . cancelEdge = e } , v = function ( ) { var a = function ( a ) { arangoHelper . openDocEditor ( a . _id , " document " ) } , b = function ( a ) { arangoHelper . openDocEditor ( a . _id , " edge " ) } ; r . nodes . edit = a , r . edges . edit = b } , w = function ( ) { var a = function ( a ) { modalDialogHelper . createModalDeleteDialog ( " Delete Node " + a . _id , " control_event_node_delete_ " , a , function ( a ) { h . events . DELETENODE ( function ( ) { $ ( " # control_event_node_delete_modal " ) . modal ( " hide " ) , b . reshapeNodes ( ) , c . reshapeEdges ( ) , d ( ) } ) ( a ) } ) } , e = function ( a ) { modalDialogHelper . createModalDeleteDialog ( " Delete Edge " + a . _id , " control_event_edge_delete_ " , a , function ( a ) { h . events . DELETEEDGE ( function ( ) { $ ( " # control_event_edge_delete_modal " ) . modal ( " hide " ) , b . reshapeNodes ( ) , c . reshapeEdges ( ) , d ( ) } ) ( a ) } ) } ; r . nodes . del = a , r . edges . del = e } , x = function ( ) { r . nodes . spot = h . events . EXPAND } ; s ( ) , t ( ) , u ( ) , v ( ) , w ( ) , x ( ) , this . dragRebinds = function ( ) { return { nodes : { drag : h . events . DRAG } } } , this . newNodeRebinds = function ( ) { return { svg : { click : r . nodes . newNode } } } , this . viewRebinds = function ( ) { return { nodes : { click : r . nodes . view } , edges : { click : r . edges . view } } } , this . connectNodesRebinds = function ( ) { return { nodes : { mousedown : r . nodes . startEdge , mouseup : r . nodes . endEdge } , svg : { mouseup : r . svg . cancelEdge } } } , this . editRebinds = function ( ) { return { nodes : { click : r . nodes . edit } , edges : { click : r . edges . edit } } } , this . expandRebinds = function ( ) { return { nodes : { click : r . nodes . spot } } } , this . deleteRebinds = function ( ) { return { nodes : { click : r . nodes . del } , edges : { click : r . edges . del } } } , this . rebindAll = function ( a ) { m ( a . nodes ) , n ( a . edges ) , o ( a . svg ) } , b . addMenuEntry ( " Edit " , r . nodes . edit ) , b . addMenuEntry ( " Spot " , r . nodes . spot ) , b . addMenuEntry ( " Trash " , r . nodes . del ) , c . addMenuEntry ( " Edit " , r . edges . edit ) , c . addMenuEntry ( " Trash " , r . edges . del ) , this . addControlNewNode = function ( ) { var a = g . add , b = " select_node_collection " , c = function ( ) { j & & i . getNodeCollections ( ) . length > 1 & & modalDialogHelper . createModalDialog ( " Select Vertex Collection " , b , [ { type : " list " , id : " vertex " , objects : i . getNodeCollections ( ) , text : " Select collection " , selected : i . getSelectedNodeCollection ( ) } ] , function ( ) { var a = $ ( " # " + b + " vertex " ) . children ( " option " ) . filter ( " : selected " ) . text ( ) ; i . useNodeCollection ( a ) } , " Select " ) , f . rebindAll ( f . newNodeRebinds ( ) ) } ; l ( a , " new_node " , c ) } , this . addControlView = function ( ) { var a = g . view , b = function ( ) { f . rebindAll ( f . viewRebinds ( ) ) } ; l ( a , " view " , b ) } , this . addControlDrag = function ( ) { var a = g . drag , b = function ( ) { f . rebindAll ( f . dragRebinds ( ) ) } ; l ( a , " drag " , b ) } , this . addControlEdit = function ( ) { var a = g . edit , b = function ( ) { f . rebindAll ( f . editRebinds ( ) ) } ; l ( a , " edit " , b ) } , this . addControlExpand = function ( ) { var a = g . expand , b = function ( ) { f . rebindAll ( f . expandRebinds ( ) ) } ; l ( a , " expand " , b ) } , this . addControlDelete = function ( ) { var a = g . trash , b = function ( ) { f . rebindAll ( f . deleteRebinds ( ) ) } ; l ( a , " delete " , b ) } , this . addControlConnect = function ( ) { var a = g . edge , b = " select_edge_collection " , c = function ( ) { j & & i . getEdgeCollections ( ) . length > 1 & & modalDialogHelper . createModalDialog ( " Select Edge Collection " , b , [ { type : " list " , id : " edge " , objects : i . getEdgeCollections ( ) , text : " Select collection " , selected : i . getSelectedEdgeCollection ( ) } ] , function ( ) { var a = $ ( " # " + b + " edge " ) . children ( " option " ) . filter ( " : selected " ) . text ( ) ; i . useEdgeCollection ( a ) } , " Select " ) , f . rebindAll ( f . connectNodesRebinds ( ) ) } ; l ( a , " connect " , c ) } , this . addAll = function ( ) { f . addControlExpand ( ) , f . addControlDrag ( ) , f . addControlEdit ( ) , f . addControlConnect ( ) , f . addControlNewNode ( ) , f . addControlDelete ( ) } } function GharialAdapterControls ( a , b ) { " use strict " ; if ( void 0 = = = a ) throw " A list element has to be given . " ; if ( void 0 = = = b ) throw " The GharialAdapter has to be given . " ; this . addControlChangeGraph = function ( c ) { var d = " control_adapter_graph " , e = d + " _ " ; b . getGraphs ( function ( f ) { uiComponentsHelper . createButton ( a , " Switch Graph " , d , function ( ) { modalDialogHelper . createModalDialog ( " Switch Graph " , e , [ { type : " list " , id : " graph " , objects : f , text : " Select graph " , selected : b . getGraphName ( ) } , { type : " checkbox " , text : " Start with random vertex " , id : " random " , selected : ! 0 } ] , function ( ) { var a = $ ( " # " + e + " graph " ) . children ( " option " ) . filter ( " : selected " ) . text ( ) , d = ! ! $ ( " # " + e + " undirected " ) . prop ( " checked " ) , f = ! ! $ ( " # " + e + " random " ) . prop ( " checked " ) ; return b . changeToGraph ( a , d ) , f ? void b . loadRandomNode ( c ) : void ( _ . isFunction ( c ) & & c ( ) ) } ) } ) } ) } , this . addControlChangePriority = function ( ) { var c = " control_adapter_priority " , d = c + " _ " , e = " Group vertices " ; uiComponentsHelper . createButton ( a , e , c , function ( ) { modalDialogHelper . createModalChangeDialog ( e + " by attribute " , d , [ { type : " extendable " , id : " attribute " , objects : b . getPrioList ( ) } ] , function ( ) { var a = $ ( " input [ id ^ = " + d + " attribute_ ] " ) , c = [ ] ; _ . each ( a , function ( a ) { var b = $ ( a ) . val ( ) ; " " ! = = b & & c . push ( b ) } ) , b . changeTo ( { prioList : c } ) } ) } ) } , this . addAll = function ( ) { this . addControlChangeGraph ( ) , this . addControlChangePriority ( ) } } function GraphViewerPreview ( a , b ) { " use strict " ; var c , d , e , f , g , h , i , j = function ( ) { return d3 . select ( a ) . append ( " svg " ) . attr ( " id " , " graphViewerSVG " ) . attr ( " width " , d ) . attr ( " height " , e ) . attr ( " class " , " graph - viewer " ) . attr ( " style " , " width : " + d + " px ; height : " + e + " ; " ) } , k = function ( a ) { var b = 0 ; return _ . each ( a , function ( c , d ) { c = = = ! 1 ? delete a [ d ] : b + + } ) , b > 0 } , l = function ( a , b ) { _ . each ( b , function ( b , c ) { a [ c ] = a [ c ] | | { } , _ . each ( b , function ( b , d ) { a [ c ] [ d ] = b } ) } ) } , m = function ( a ) { if ( a ) { var b = { } ; a . drag & & l ( b , i . dragRebinds ( ) ) , a . create & & ( l ( b , i . newNodeRebinds ( ) ) , l ( b , i . connectNodesRebinds ( ) ) ) , a . remove & & l ( b , i . deleteRebinds ( ) ) , a . expand & & l ( b , i . expandRebinds ( ) ) , a . edit & & l ( b , i . editRebinds ( ) ) , i . rebindAll ( b ) } } , n = function ( b ) { var c = document . createElement ( " div " ) ; i = new EventDispatcherControls ( c , f . nodeShaper , f . edgeShaper , f . start , f . dispatcherConfig ) , c . id = " toolbox " , c . className = " btn - group btn - group - vertical pull - left toolbox " , a . appendChild ( c ) , _ . each ( b , function ( a , b ) { switch ( b ) { case " expand " : i . addControlExpand ( ) ; break ; case " create " : i . addControlNewNode ( ) , i . addControlConnect ( ) ; break ; case " drag " : i . addControlDrag ( ) ; break ; case " edit " : i . addControlEdit ( ) ; break ; case " remove " : i . addControlDelete ( ) } } ) } , o = function ( a ) { var b = document . createElement ( " div " ) ; i = new EventDispatcherControls ( b , f . nodeShaper , f . edgeShaper , f . start , f . dispatcherConfig ) } , p = function ( ) { b & & ( b . nodeShaper & & ( b . nodeShaper . label & & ( b . nodeShaper . label = " label " ) , b . nodeShaper . shape & & b . nodeShaper . shape . type = = = NodeShaper . shapes . IMAGE & & b . nodeShaper . shape . source & & ( b . nodeShaper . shape . source = " image " ) ) , b . edgeShaper & & b . edgeShaper . label & & ( b . edgeShaper . label = " label " ) ) } , q = function ( ) { return p ( ) , new GraphViewer ( c , d , e , h , b ) } ; d = a . getBoundingClientRect ( ) . width , e = a . getBoundingClientRect ( ) . height , h = { type : " preview " } , b = b | | { } , g = k ( b . toolbox ) , g & & ( d - = 43 ) , c = j ( ) , f = q ( ) , g ? n ( b . toolbox ) : o ( ) , f . loadGraph ( " 1 " ) , m ( b . actions ) } function GraphViewerUI ( a , b , c , d , e , f ) { " use strict " ; if ( void 0 = = = a ) throw " A parent element has to be given . " ; if ( ! a . id ) throw " The parent element needs an unique id . " ; if ( void 0 = = = b ) throw " An adapter configuration has to be given " ; var g , h , i , j , k , l , m , n , o , p = c + 20 | | a . getBoundingClientRect ( ) . width - 81 + 20 , q = d | | a . getBoundingClientRect ( ) . height , r = document . createElement ( " ul " ) , s = document . createElement ( " div " ) , t = function ( ) { g . adapter . NODES_TO_DISPLAY < g . adapter . TOTAL_NODES & & ( $ ( " . headerBar " ) . append ( ' < div class = " infoField " > Graph too big . A random section is rendered . < div class = " fa fa - info - circle " > < / div > < / div > ' ) , $ ( " . infoField . fa - info - circle " ) . attr ( " title " , " You can display additional / other vertices by using the toolbar buttons . " ) . tooltip ( ) ) } , u = function ( ) { var a , b = document . createElement ( " div " ) , c = document . createElement ( " div " ) , d = document . createElement ( " div " ) , e = document . createElement ( " div " ) , f = document . createElement ( " button " ) , h = document . createElement ( " span " ) , i = document . createElement ( " input " ) , j = document . createElement ( " i " ) , k = document . createElement ( " span " ) , l = function ( ) { $ ( s ) . css ( " cursor " , " progress " ) } , n = function ( ) { $ ( s ) . css ( " cursor " , " " ) } , o = function ( a ) { return n ( ) , a & & a . errorCode & & 404 = = = a . errorCode ? void arangoHelper . arangoError ( " Graph error " , " could not find a matching node . " ) : void 0 } , p = function ( ) { l ( ) , " " = = = a . value | | void 0 = = = a . value ? g . loadGraph ( i . value , o ) : g . loadGraphWithAttributeValue ( a . value , i . value , o ) } ; b . id = " filterDropdown " , b . className = " headerDropdown smallDropdown " , c . className = " dropdownInner " , d . className = " queryline " , a = document . createElement ( " input " ) , m = document . createElement ( " ul " ) , e . className = " pull - left input - append searchByAttribute " , a . id = " attribute " , a . type = " text " , a . placeholder = " Attribute name " , f . id = " attribute_example_toggle " , f . className = " button - neutral gv_example_toggle " , h . className = " caret gv_caret " , m . className = " gv - dropdown - menu " , i . id = " value " , i . className = " searchInput gv_searchInput " , i . type = " text " , i . placeholder = " Attribute value " , j . id = " loadnode " , j . className = " fa fa - search " , k . className = " searchEqualsLabel " , k . appendChild ( document . createTextNode ( " = = " ) ) , c . appendChild ( d ) , d . appendChild ( e ) , e . appendChild ( a ) , e . appendChild ( f ) , e . appendChild ( m ) , f . appendChild ( h ) , d . appendChild ( k ) , d . appendChild ( i ) , d . appendChild ( j ) , j . onclick = p , $ ( i ) . keypress ( function ( a ) { return 13 = = = a . keyCode | | 13 = = = a . which ? ( p ( ) , ! 1 ) : void 0 } ) , f . onclick = function ( ) { $ ( m ) . slideToggle ( 200 ) } ; var q = document . createElement ( " p " ) ; return q . className = " dropdown - title " , q . innerHTML = " Filter graph by attribute : " , b . appendChild ( q ) , b . appendChild ( c ) , b } , v = function ( ) { var a , b = document . createElement ( " div " ) , c = document . createElement ( " div " ) , d = document . createElement ( " div " ) , e = document . createElement ( " div " ) , f = document . createElement ( " button " ) , h = document . createElement ( " span " ) , i = document . createElement ( " input " ) , j = document . createElement ( " i " ) , k = document . createElement ( " span " ) , l = function ( ) { $ ( s ) . css ( " cursor " , " progress " ) } , m = function ( ) { $ ( s ) . css ( " cursor " , " " ) } , o = function ( a ) { return m ( ) , a & & a . errorCode & & 404 = = = a . errorCode ? void arangoHelper . arangoError ( " Graph error " , " could not find a matching node . " ) : void 0 } , p = function ( ) { l ( ) , " " ! = = a . value & & g . loadGraphWithAdditionalNode ( a . value , i . value , o ) } ; b . id = " nodeDropdown " , b . className = " headerDropdown smallDropdown " , c . className = " dropdownInner " , d . className = " queryline " , a = document . createElement ( " input " ) , n = document . createElement ( " ul " ) , e . className = " pull - left input - append searchByAttribute " , a . id = " attribute " , a . type = " text " , a . placeholder = " Attribute name " , f . id = " attribute_example_toggle2 " , f . className = " button - neutral gv_example_toggle " , h . className = " caret gv_caret " , n . className = " gv - dropdown - menu " , i . id = " value " , i . className = " searchInput gv_searchInput " , i . type = " text " , i . placeholder = " Attribute value " , j . id = " loadnode " , j . className = " fa fa - search " , k . className = " searchEqualsLabel " , k . appendChild ( document . createTextNode ( " = = " ) ) , c . appendChild ( d ) , d . appendChild ( e ) , e . appendChild ( a ) , e . appendChild ( f ) , e . appendChild ( n ) , f . appendChild ( h ) , d . appendChild ( k ) , d . appendChild ( i ) , d . appendChild ( j ) , C ( n ) , j . onclick = p , $ ( i ) . keypress ( function ( a ) { return 13 = = = a . keyCode | | 13 = = = a . which ? ( p ( ) , ! 1 ) : void 0 } ) , f . onclick = function ( ) { $ ( n ) . slideToggle ( 200 ) } ; var q = document . createElement ( " p " ) ; return q . className = " dropdown - title " , q . innerHTML = " Add specific node by attribute : " , b . appendChild ( q ) , b . appendChild ( c ) , b } , w = function ( ) { var a , b , c , d , e , f , g , h ; return a = document . createElement ( " div " ) , a . id = " configureDropdown " , a . className = " headerDropdown " , b = document . createElement ( " div " ) , b . className = " dropdownInner " , c = document . createElement ( " ul " ) , d = document . createElement ( " li " ) , d . className = " nav - header " , d . appendChild ( document . createTextNode ( " Vertices " ) ) , g = document . createElement ( " ul " ) , h = document . createElement ( " li " ) , h . className = " nav - header " , h . appendChild ( document . createTextNode ( " Edges " ) ) , e = document . createElement ( " ul " ) , f = document . createElement ( " li " ) , f . className = " nav - header " , f . appendChild ( document . createTextNode ( " Connection " ) ) , c . appendChild ( d ) , g . appendChild ( h ) , e . appendChild ( f ) , b . appendChild ( c ) , b . appendChild ( g ) , b . appendChild ( e ) , a . appendChild ( b ) , { configure : a , nodes : c , edges : g , col : e } } , x = function ( a , b , c , d ) { var e , f , g , h , i , j , k , l , m , n , o ; return a . className = " headerButtonBar " , e = document . createElement ( " ul " ) , e . className = " headerButtonList " , a . appendChild ( e ) , g = document . createElement ( " li " ) , g . className = " enabled " , h = document . createElement ( " a " ) , h . id = b , h . className = " headerButton " , i = document . createElement ( " span " ) , i . className = " icon_arangodb_settings2 " , $ ( i ) . attr ( " title " , " Configure " ) , e . appendChild ( g ) , g . appendChild ( h ) , h . appendChild ( i ) , j = document . createElement ( " li " ) , j . className = " enabled " , k = document . createElement ( " a " ) , k . id = d , k . className = " headerButton " , l = document . createElement ( " span " ) , l . className = " fa fa - search - plus " , $ ( l ) . attr ( " title " , " Show additional vertices " ) , e . appendChild ( j ) , j . appendChild ( k ) , k . appendChild ( l ) , m = document . createElement ( " li " ) , m . className = " enabled " , n = document . createElement ( " a " ) , n . id = c , n . className = " headerButton " , o = document . createElement ( " span " ) , o . className = " icon_arangodb_filter " , $ ( o ) . attr ( " title " , " Filter " ) , e . appendChild ( m ) , m . appendChild ( n ) , n . appendChild ( o ) , f = w ( ) , f . filter = u ( ) , f . node = v ( ) , h . onclick = function ( ) { $ ( " # filterdropdown " ) . removeClass ( " activated " ) , $ ( " # nodedropdown " ) . removeClass ( " activated " ) , $ ( " # configuredropdown " ) . toggleClass ( " activated " ) , $ ( f . configure ) . slideToggle ( 200 ) , $ ( f . filter ) . hide ( ) , $ ( f . node ) . hide ( ) } , k . onclick = function ( ) { $ ( " # filterdropdown " ) . removeClass ( " activated " ) , $ ( " # configuredropdown " ) . removeClass ( " activated " ) , $ ( " # nodedropdown " ) . toggleClass ( " activated " ) , $ ( f . node ) . slideToggle ( 200 ) , $ ( f . filter ) . hide ( ) , $ ( f . configure ) . hide ( ) } , n . onclick = function ( ) { $ ( " # configuredropdown " ) . removeClass ( " activated " ) , $ ( " # nodedropdown " ) . removeClass ( " activated " ) , $ ( " # filterdropdown " ) . toggleClass ( " activated " ) , $ ( f . filter ) . slideToggle ( 200 ) , $ ( f . node ) . hide ( ) , $ ( f . configure ) . hide ( ) } , f } , y = function ( ) { return d3 . select ( " # " + a . id + " # background " ) . append ( " svg " ) . attr ( " id " , " graphViewerSVG " ) . attr ( " width " , p ) . attr ( " height " , q ) . attr ( " class " , " graph - viewer " ) . style ( " width " , p + " px " ) . style ( " height " , q + " px " ) } , z = function ( ) { var a = document . createElement ( " div " ) , b = document . createElement ( " div " ) , c = document . createElement ( " button " ) , d = document . createElement ( " button " ) , e = document . createElement ( " button " ) , f = document . createElement ( " button " ) ; a . className = " gv_zoom_widget " , b . className = " gv_zoom_buttons_bg " , c . className = " btn btn - icon btn - zoom btn - zoom - top gv - zoom - btn pan - top " , d . className = " btn btn - icon btn - zoom btn - zoom - left gv - zoom - btn pan - left " , e . className = " btn btn - icon btn - zoom btn - zoom - right gv - zoom - btn pan - right " , f . className = " btn btn - icon btn - zoom btn - zoom - bottom gv - zoom - btn pan - bottom " , c . onclick = function ( ) { g . zoomManager . triggerTranslation ( 0 , - 10 ) } , d . onclick = function ( ) { g . zoomManager . triggerTranslation ( - 10 , 0 ) } , e . onclick = function ( ) { g . zoomManager . triggerTranslation ( 10 , 0 ) } , f . onclick = function ( ) { g . zoomManager . triggerTranslation ( 0 , 10 ) } , b . appendChild ( c ) , b . appendChild ( d ) , b . appendChild ( e ) , b . appendChild ( f ) , l = document . createElement ( " div " ) , l . id = " gv_zoom_slider " , l . className = " gv_zoom_slider " , s . appendChild ( a ) , s . insertBefore ( a , o [ 0 ] [ 0 ] ) , a . appendChild ( b ) , a . appendChild ( l ) , $ ( " # gv_zoom_slider " ) . slider ( { orientation : " vertical " , min : g . zoomManager . getMinimalZoomFactor ( ) , max : 1 , value : 1 , step : . 01 , slide : function ( a , b ) { g . zoomManager . triggerScale ( b . value ) } } ) , g . zoomManager . registerSlider ( $ ( " # gv_zoom_slider " ) ) } , A = function ( ) { var a = document . createElement ( " div " ) , b = new EventDispatcherControls ( a , g . nodeShaper , g . edgeShaper , g . start , g . dispatcherConfig ) ; a . id = " toolbox " , a . className = " btn - group btn - group - vertical toolbox " , s . insertBefore ( a , o [ 0 ] [ 0 ] ) , b . addAll ( ) , $ ( " # control_event_expand " ) . click ( ) } , B = function ( ) { var a = ' < li class = " enabled " style = " float : right " > < select id = " graphSize " class = " documents - size " > < optgroup label = " Starting points : " > < option value = " 5 " selected = " " > 5 vertices < / option > < option value = " 10 " > 10 vertices < / option > < option value = " 20 " > 20 vertices < / option > < option value = " 50 " > 50 vertices < / option > < option value = " 100 " > 100 vertices < / option > < option value = " 500 " > 500 vertices < / option > < option value = " 1000 " > 1000 vertices < / option > < option value = " 2500 " > 2500 vertices < / option > < option value = " 5000 " > 5000 vertices < / option > < option value = " all " > All vertices < / option > < / select > < / optgroup > < / li > ' ; $ ( " . headerBar . headerButtonList " ) . prepend ( a ) } , C = function ( a ) { var b ; b = a ? $ ( a ) : $ ( m ) , b . innerHTML = " " ; var c = document . createElement ( " li " ) , d = document . createElement ( " img " ) ; $ ( c ) . append ( d ) , d . className = " gv - throbber " , b . append ( c ) , g . adapter . getAttributeExamples ( function ( a ) { $ ( b ) . html ( " " ) , _ . each ( a , function ( a ) { var c = document . createElement ( " li " ) , d = document . createElement ( " a " ) , e = document . createElement ( " label " ) ; $ ( c ) . append ( d ) , $ ( d ) . append ( e ) , $ ( e ) . append ( document . createTextNode ( a ) ) , e . className = " gv_dropdown_label " , b . append ( c ) , c . onclick = function ( ) { b . value = a , $ ( b ) . parent ( ) . find ( " input " ) . val ( a ) , $ ( b ) . slideToggle ( 200 ) } } ) } ) } , D = function ( ) { var a = document . createElement ( " div " ) , b = document . createElement ( " div " ) , c = ( document . createElement ( " a " ) , x ( b , " configuredropdown " , " filterdropdown " , " nodedropdown " ) ) ; i = new NodeShaperControls ( c . nodes , g . nodeShaper ) , j = new EdgeShaperControls ( c . edges , g . edgeShaper ) , k = new GharialAdapterControls ( c . col , g . adapter ) , r . id = " menubar " , a . className = " headerBar " , b . id = " modifiers " , r . appendChild ( a ) , r . appendChild ( c . configure ) , r . appendChild ( c . filter ) , r . appendChild ( c . node ) , a . appendChild ( b ) , k . addControlChangeGraph ( function ( ) { C ( ) , g . start ( ! 0 ) } ) , k . addControlChangePriority ( ) , i . addControlOpticLabelAndColourList ( g . adapter ) , j . addControlOpticLabelList ( ) , C ( ) } , E = function ( ) { h = i . createColourMappingList ( ) , h . className = " gv - colour - list " , s . insertBefore ( h , o [ 0 ] [ 0 ] ) } ; a . appendChild ( r ) , a . appendChild ( s ) , s . className = " contentDiv gv - background " , s . id = " background " , e = e | | { } , e . zoom = ! 0 , $ ( " # subNavigationBar . breadcrumb " ) . html ( " Graph : " + b . graphName ) , o = y ( ) , " undefined " ! = = Storage & & ( this . graphSettings = { } , this . loadLocalStorage = function ( ) { var a = b . baseUrl . split ( " / " ) [ 2 ] , c = b . graphName + a ; if ( null = = = localStorage . getItem ( " graphSettings " ) | | " null " = = = localStorage . getItem ( " graphSettings " ) ) { var d = { } ; d [ c ] = { viewer : e , adapter : b } , localStorage . setItem ( " graphSettings " , JSON . stringify ( d ) ) } else try { var f = JSON . parse ( localStorage . getItem ( " graphSettings " ) ) ; this . graphSettings = f , void 0 ! = = f [ c ] . viewer & & ( e = f [ c ] . viewer ) , void 0 ! = = f [ c ] . adapter & & ( b = f [ c ] . adapter ) } catch ( g ) { console . log ( " Could not load graph settings , resetting graph settings . " ) , this . graphSettings [ c ] = { viewer : e , adapter : b } , localStorage . setItem ( " graphSettings " , JSON . stringify ( this . graphSettings ) ) } } , this . loadLocalStorage ( ) , this . writeLocalStorage = function ( ) { } ) , g = new GraphViewer ( o , p , q , b , e ) , A ( ) , z ( ) , D ( ) , E ( ) , t ( ) , B ( ) , $ ( " # graphSize " ) . on ( " change " , function ( ) { var a = $ ( " # graphSize " ) . find ( " : selected " ) . val ( ) ; g . loadGraphWithRandomStart ( function ( a ) { a & & a . errorCode & & arangoHelper . arangoError ( " Graph " , " Sorry your graph seems to be empty " ) } , a ) } ) , f & & ( " string " = = typeof f ? g . loadGraph ( f ) : g . loadGraphWithRandomStart ( function ( a ) { a & & a . errorCode & & arangoHelper . arangoError ( " Graph " , " Sorry your graph seems to be empty " ) } ) ) , this . changeWidth = function ( a ) { g . changeWidth ( a ) ; var b = a - 55 ; o . attr ( " width " , b ) . style ( " width " , b + " px " ) } } function GraphViewerWidget ( a , b ) { " use strict " ; var c , d , e , f , g , h , i , j , k = function ( ) { return d3 . select ( d ) . append ( " svg " ) . attr ( " id " , " graphViewerSVG " ) . attr ( " width " , e ) . attr ( " height " , f ) . attr ( " class " , " graph - viewer " ) . attr ( " style " , " width : " + e + " px ; height : " + f + " px ; " ) } , l = function ( a ) { var b = 0 ; return _ . each ( a , function ( c , d ) { c = = = ! 1 ? delete a [ d ] : b + + } ) , b > 0 } , m = function ( a , b ) { _ . each ( b , function ( b , c ) { a [ c ] = a [ c ] | | { } , _ . each ( b , function ( b , d ) { a [ c ] [ d ] = b } ) } ) } , n = function ( a ) { if ( a ) { var b = { } ; a . drag & & m ( b , j . dragRebinds ( ) ) , a . create & & ( m ( b , j . newNodeRebinds ( ) ) , m ( b , j . connectNodesRebinds ( ) ) ) , a . remove & & m ( b , j . deleteRebinds ( ) ) , a . expand & & m ( b , j . expandRebinds ( ) ) , a . edit & & m ( b , j . editRebinds ( ) ) , j . rebindAll ( b ) } } , o = function ( a ) { var b = document . createElement ( " div " ) ; j = new EventDispatcherControls ( b , g . nodeShaper , g . edgeShaper , g . start , g . dispatcherConfig ) , b . id = " toolbox " , b . className = " btn - group btn - group - vertical pull - left toolbox " , d . appendChild ( b ) , _ . each ( a , function ( a , b ) { switch ( b ) { case " expand " : j . addControlExpand ( ) ; break ; case " create " : j . addControlNewNode ( ) , j . addControlConnect ( ) ; break ; case " drag " : j . addControlDrag ( ) ; break ; case " edit " : j . addControlEdit ( ) ; break ; case " remove " : j . addControlDelete ( ) } } ) } , p = function ( a ) { var b = document . createElement ( " div " ) ; j = new EventDispatcherControls ( b , g . nodeShaper , g . edgeShaper , g . start , g . dispatcherConfig ) } , q = function ( ) { return new GraphViewer ( c , e , f , i , a ) } ; d = document . body , e = d . getBoundingClientRect ( ) . width , f = d . getBoundingClientRect ( ) . height , i = { type : " foxx " , route : " . " } , a = a | | { } , h = l ( a . toolbox ) , h & & ( e - = 43 ) , c = k ( ) , g = q ( ) , h ? o ( a . toolbox ) : p ( ) , b & & g . loadGraph ( b ) , n ( a . actions ) } function LayouterControls ( a , b ) { " use strict " ; if ( void 0 = = = a ) throw " A list element has to be given . " ; if ( void 0 = = = b ) throw " The Layouter has to be given . " ; var c = this ; this . addControlGravity = function ( ) { var c = " control_layout_gravity " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Gravity " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch Gravity Strength " , d , [ { type : " text " , id : " value " } ] , function ( ) { var a = $ ( " # " + d + " value " ) . attr ( " value " ) ; b . changeTo ( { gravity : a } ) } ) } ) } , this . addControlCharge = function ( ) { var c = " control_layout_charge " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Charge " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch Charge Strength " , d , [ { type : " text " , id : " value " } ] , function ( ) { var a = $ ( " # " + d + " value " ) . attr ( " value " ) ; b . changeTo ( { charge : a } ) } ) } ) } , this . addControlDistance = function ( ) { var c = " control_layout_distance " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Distance " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch Distance Strength " , d , [ { type : " text " , id : " value " } ] , function ( ) { var a = $ ( " # " + d + " value " ) . attr ( " value " ) ; b . changeTo ( { distance : a } ) } ) } ) } , this . addAll = function ( ) { c . addControlDistance ( ) , c . addControlGravity ( ) , c . addControlCharge ( ) } } function NodeShaperControls ( a , b ) { " use strict " ; if ( void 0 = = = a ) throw " A list element has to be given . " ; if ( void 0 = = = b ) throw " The NodeShaper has to be given . " ; var c , d = this , e = function ( a ) { for ( ; c . hasChildNodes ( ) ; ) c . removeChild ( c . lastChild ) ; var b = document . createElement ( " ul " ) ; c . appendChild ( b ) , _ . each ( a , function ( a , c ) { var d = document . createElement ( " ul " ) , e = a . list , f = a . front ; d . style . backgroundColor = c , d . style . color = f , _ . each ( e , function ( a ) { var b = document . createElement ( " li " ) ; b . appendChild ( document . createTextNode ( a ) ) , d . appendChild ( b ) } ) , b . appendChild ( d ) } ) } ; this . addControlOpticShapeNone = function ( ) { uiComponentsHelper . createButton ( a , " None " , " control_node_none " , function ( ) { b . changeTo ( { shape : { type : NodeShaper . shapes . NONE } } ) } ) } , this . applyLocalStorage = function ( a ) { if ( " undefined " ! = = Storage ) try { var b = JSON . parse ( localStorage . getItem ( " graphSettings " ) ) , c = window . location . hash . split ( " / " ) [ 1 ] , d = window . location . pathname . split ( " / " ) [ 2 ] , e = c + d ; _ . each ( a , function ( a , c ) { void 0 ! = = c & & ( b [ e ] . viewer . nodeShaper [ c ] = a ) } ) , localStorage . setItem ( " graphSettings " , JSON . stringify ( b ) ) } catch ( f ) { console . log ( f ) } } , this . addControlOpticShapeCircle = function ( ) { var c = " control_node_circle " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Circle " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch to Circle " , d , [ { type : " text " , id : " radius " } ] , function ( ) { var a = $ ( " # " + d + " radius " ) . attr ( " value " ) ; b . changeTo ( { shape : { type : NodeShaper . shapes . CIRCLE , radius : a } } ) } ) } ) } , this . addControlOpticShapeRect = function ( ) { var c = " control_node_rect " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Rectangle " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch to Rectangle " , " control_node_rect_ " , [ { type : " text " , id : " width " } , { type : " text " , id : " height " } ] , function ( ) { var a = $ ( " # " + d + " width " ) . attr ( " value " ) , c = $ ( " # " + d + " height " ) . attr ( " value " ) ; b . changeTo ( { shape : { type : NodeShaper . shapes . RECT , width : a , height : c } } ) } ) } ) } , this . addControlOpticLabel = function ( ) { var c = " control_node_label " , e = c + " _ " ; uiComponentsHelper . createButton ( a , " Configure Label " , c , function ( ) { modalDialogHelper . createModalChangeDialog ( " Change label attribute " , e , [ { type : " text " , id : " key " } ] , function ( ) { var a = $ ( " # " + e + " key " ) . attr ( " value " ) , c = { label : a } ; d . applyLocalStorage ( c ) , b . changeTo ( c ) } ) } ) } , this . addControlOpticSingleColour = function ( ) { var c = " control_node_singlecolour " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Single Colour " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch to Colour " , d , [ { type : " text " , id : " fill " } , { type : " text " , id : " stroke " } ] , function ( ) { var a = $ ( " # " + d + " fill " ) . attr ( " value " ) , c = $ ( " # " + d + " stroke " ) . attr ( " value " ) ; b . changeTo ( { color : { type : " single " , fill : a , stroke : c } } ) } ) } ) } , this . addControlOpticAttributeColour = function ( ) { var c = " control_node_attributecolour " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Colour by Attribute " , c , function ( ) { modalDialogHelper . createModalDialog ( " Display colour by attribute " , d , [ { <nl> - type : " text " , id : " key " } ] , function ( ) { var a = $ ( " # " + d + " key " ) . attr ( " value " ) ; b . changeTo ( { color : { type : " attribute " , key : a } } ) } ) } ) } , this . addControlOpticExpandColour = function ( ) { var c = " control_node_expandcolour " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Expansion Colour " , c , function ( ) { modalDialogHelper . createModalDialog ( " Display colours for expansion " , d , [ { type : " text " , id : " expanded " } , { type : " text " , id : " collapsed " } ] , function ( ) { 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 } 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 . length ; g + + ) n ( c [ g ] ) } , l = function ( a , b ) { var d = document . createElement ( " div " ) , e = document . createElement ( " div " ) , f = document . createElement ( " button " ) , g = document . createElement ( " a " ) , h = document . createElement ( " div " ) , i = document . createElement ( " table " ) ; return d . id = b + " modal " , d . className = " modal hide fade createModalDialog " , d . setAttribute ( " tabindex " , " - 1 " ) , d . setAttribute ( " role " , " dialog " ) , d . setAttribute ( " aria - labelledby " , " myModalLabel " ) , d . setAttribute ( " aria - hidden " , ! 0 ) , d . style . display = " none " , d . onhidden = function ( ) { c ( ) , document . body . removeChild ( d ) } , e . className = " modal - header " , g . className = " arangoHeader " , f . id = b + " modal_dismiss " , f . className = " close " , f . dataDismiss = " modal " , f . ariaHidden = " true " , f . appendChild ( document . createTextNode ( " × " ) ) , g . appendChild ( document . createTextNode ( a ) ) , h . className = " modal - body " , i . id = b + " table " , d . appendChild ( e ) , d . appendChild ( h ) , e . appendChild ( f ) , e . appendChild ( g ) , h . appendChild ( i ) , document . body . appendChild ( d ) , f . onclick = function ( ) { c ( ) , $ ( " # " + b + " modal " ) . modal ( " hide " ) } , { div : d , bodyTable : i } } ; a = function ( a , b , c ) { var d = document . createElement ( " tr " ) , e = document . createElement ( " th " ) , i = document . createElement ( " th " ) ; switch ( a . appendChild ( d ) , d . appendChild ( e ) , e . className = " collectionTh " , c . text ? e . appendChild ( document . createTextNode ( c . text + " : " ) ) : ( e . className + = " capitalize " , c . type & & " extenadable " = = = c . type ? e . appendChild ( document . createTextNode ( c . id + " : " ) ) : e . appendChild ( document . createTextNode ( c . id + " : " ) ) ) , d . appendChild ( i ) , i . className = " collectionTh " , c . type ) { case " text " : i . appendChild ( f ( b + c . id , c . value | | " " ) ) ; break ; case " checkbox " : i . appendChild ( g ( b + c . id , c . selected | | ! 1 ) ) ; break ; case " list " : i . appendChild ( h ( b + c . id , c . objects , c . selected | | void 0 ) ) ; break ; case " extendable " : k ( b , c . id , c . objects , i , a , d ) ; break ; case " decission " : j ( b , c . id , c . group , c . text , c . isDefault , c . interior , i , a ) , e . innerHTML = " " ; break ; default : a . removeChild ( d ) } return d } , modalDialogHelper . modalDivTemplate = function ( a , d , e , f ) { d = d | | " Switch " ; var g = document . createElement ( " div " ) , h = document . createElement ( " button " ) , i = document . createElement ( " button " ) , j = l ( a , e ) ; return g . className = " modal - footer " , h . id = e + " cancel " , h . className = " button - close btn - margin " , h . appendChild ( document . createTextNode ( " Close " ) ) , i . id = e + " submit " , i . className = " button - success " , i . style . marginRight = " 8px " , i . appendChild ( document . createTextNode ( d ) ) , j . div . appendChild ( g ) , g . appendChild ( i ) , g . appendChild ( h ) , h . onclick = function ( ) { c ( ) , $ ( " # " + e + " modal " ) . modal ( " hide " ) } , i . onclick = function ( ) { c ( ) , f ( ) , $ ( " # " + e + " modal " ) . modal ( " hide " ) } , b ( i ) , j . bodyTable } , modalDialogHelper . createModalDialog = function ( b , c , d , e , f ) { var g = modalDialogHelper . modalDivTemplate ( b , f , c , e ) ; _ . each ( d , function ( b ) { a ( g , c , b ) } ) , $ ( " # " + c + " modal " ) . modal ( " show " ) } , modalDialogHelper . createModalChangeDialog = function ( b , c , d , e ) { var f = modalDialogHelper . modalDivTemplate ( b , " Change " , c , e ) ; _ . each ( d , function ( b ) { a ( f , c , b ) } ) , $ ( " # " + c + " modal " ) . modal ( " show " ) } , modalDialogHelper . createModalEditDialog = function ( a , b , c , e ) { d ( a , " Save " , b , c , e ) } , modalDialogHelper . createModalCreateDialog = function ( a , b , c , e ) { d ( a , " Create " , b , c , e ) } , modalDialogHelper . createModalViewDialog = function ( a , b , c , d ) { e ( a , " Edit " , b , c , d ) } , modalDialogHelper . createModalDeleteDialog = function ( a , d , e , f ) { var g = document . createElement ( " div " ) , h = document . createElement ( " button " ) , i = document . createElement ( " button " ) , j = l ( a , d ) ; g . className = " modal - footer " , h . id = d + " cancel " , h . className = " button - close btn - margin " , h . appendChild ( document . createTextNode ( " Close " ) ) , i . id = d + " submit " , i . className = " button - danger " , i . style . marginRight = " 8px " , i . appendChild ( document . createTextNode ( " Delete " ) ) , j . div . appendChild ( g ) , g . appendChild ( i ) , g . appendChild ( h ) , h . onclick = function ( ) { c ( ) , $ ( " # " + d + " modal " ) . modal ( " hide " ) } , i . onclick = function ( ) { c ( ) , f ( e ) , $ ( " # " + d + " modal " ) . modal ( " hide " ) } , b ( i ) , $ ( " # " + d + " modal " ) . modal ( " show " ) } } ( ) ; var uiComponentsHelper = uiComponentsHelper | | { } ; ! function ( ) { " use strict " ; uiComponentsHelper . createButton = function ( a , b , c , d ) { var e = document . createElement ( " li " ) , f = document . createElement ( " button " ) ; e . className = " graph_control " + c , e . id = c , e . appendChild ( f ) , f . className = " button - primary gv_dropdown_entry " , f . appendChild ( document . createTextNode ( b ) ) , a . appendChild ( e ) , f . id = c + " _button " , f . onclick = d } , uiComponentsHelper . createIconButton = function ( a , b , c ) { var d = document . createElement ( " div " ) , e = document . createElement ( " h6 " ) , f = document . createElement ( " h6 " ) ; return d . className = " gv_action_button " , d . id = b , d . onclick = function ( ) { $ ( " . gv_action_button " ) . each ( function ( a , b ) { $ ( b ) . toggleClass ( " active " , ! 1 ) } ) , " control_event_new_node " = = = d . id ? ( $ ( " . node " ) . css ( " cursor " , " pointer " ) , $ ( " . gv - background " ) . css ( " cursor " , " copy " ) ) : " control_event_drag " = = = d . id ? ( $ ( " . node " ) . css ( " cursor " , " - webkit - grabbing " ) , $ ( " . gv - background " ) . css ( " cursor " , " default " ) ) : " control_event_expand " = = = d . id ? ( $ ( " . node " ) . css ( " cursor " , " grabbing " ) , $ ( " . gv - background " ) . css ( " cursor " , " default " ) ) : " control_event_view " = = = d . id ? ( $ ( " . node " ) . css ( " cursor " , " - webkit - zoom - in " ) , $ ( " . gv - background " ) . css ( " cursor " , " default " ) ) : " control_event_edit " = = = d . id ? ( $ ( " . gv - background . node " ) . css ( " cursor " , " context - menu " ) , $ ( " . gv - background " ) . css ( " cursor " , " default " ) ) : " control_event_connect " = = = d . id ? ( $ ( " . node " ) . css ( " cursor " , " ne - resize " ) , $ ( " . gv - background " ) . css ( " cursor " , " default " ) ) : " control_event_delete " = = = d . id & & ( $ ( " . node " ) . css ( " cursor " , " pointer " ) , $ ( " . gv - background " ) . css ( " cursor " , " default " ) ) , $ ( d ) . toggleClass ( " active " , ! 0 ) , c ( ) } , e . className = " fa gv_icon_icon fa - " + a . icon , e . title = a . title , f . className = " gv_button_title " , d . appendChild ( e ) , d . appendChild ( f ) , f . appendChild ( document . createTextNode ( a . title ) ) , d } } ( ) , function ( ) { " use strict " ; var a = null ; window . isCoordinator = function ( b ) { null = = = a ? $ . ajax ( " cluster / amICoordinator " , { async : ! 0 , success : function ( c ) { a = c , b ( ! 1 , c ) } , error : function ( c ) { a = c , b ( ! 0 , c ) } } ) : b ( ! 1 , a ) } , window . versionHelper = { fromString : function ( a ) { var b = a . replace ( / - [ a - zA - Z0 - 9_ \ - ] * $ / g , " " ) . split ( " . " ) ; return { major : parseInt ( b [ 0 ] , 10 ) | | 0 , minor : parseInt ( b [ 1 ] , 10 ) | | 0 , patch : parseInt ( b [ 2 ] , 10 ) | | 0 , toString : function ( ) { return this . major + " . " + this . minor + " . " + this . patch } } } , toString : function ( a ) { return a . major + " . " + a . minor + " . " + a . patch } } , window . arangoHelper = { getCurrentJwt : function ( ) { return localStorage . getItem ( " jwt " ) } , setCurrentJwt : function ( a ) { localStorage . setItem ( " jwt " , a ) } , lastNotificationMessage : null , CollectionTypes : { } , systemAttributes : function ( ) { return { _id : ! 0 , _rev : ! 0 , _key : ! 0 , _bidirectional : ! 0 , _vertices : ! 0 , _from : ! 0 , _to : ! 0 , $ id : ! 0 } } , getCurrentSub : function ( ) { return window . App . naviView . activeSubMenu } , parseError : function ( a , b ) { var c ; try { c = JSON . parse ( b . responseText ) . errorMessage } catch ( d ) { c = d } this . arangoError ( a , c ) } , setCheckboxStatus : function ( a ) { _ . each ( $ ( a ) . find ( " ul " ) . find ( " li " ) , function ( a ) { $ ( a ) . hasClass ( " nav - header " ) | | ( $ ( a ) . find ( " input " ) . attr ( " checked " ) ? $ ( a ) . find ( " i " ) . hasClass ( " css - round - label " ) ? $ ( a ) . find ( " i " ) . addClass ( " fa - dot - circle - o " ) : $ ( a ) . find ( " i " ) . addClass ( " fa - check - square - o " ) : $ ( a ) . find ( " i " ) . hasClass ( " css - round - label " ) ? $ ( a ) . find ( " i " ) . addClass ( " fa - circle - o " ) : $ ( a ) . find ( " i " ) . addClass ( " fa - square - o " ) ) } ) } , parseInput : function ( a ) { var b , c = $ ( a ) . val ( ) ; try { b = JSON . parse ( c ) } catch ( d ) { b = c } return b } , calculateCenterDivHeight : function ( ) { var a = $ ( " . navbar " ) . height ( ) , b = $ ( " . footer " ) . height ( ) , c = $ ( window ) . height ( ) ; return c - b - a - 110 } , fixTooltips : function ( a , b ) { $ ( a ) . tooltip ( { placement : b , hide : ! 1 , show : ! 1 } ) } , currentDatabase : function ( a ) { return frontendConfig . db ? a ( ! 1 , frontendConfig . db ) : a ( ! 0 , void 0 ) , frontendConfig . db } , allHotkeys : { jsoneditor : { name : " AQL editor " , content : [ { label : " Execute Query " , letter : " Ctrl / Cmd + Return " } , { label : " Explain Query " , letter : " Ctrl / Cmd + Shift + Return " } , { label : " Save Query " , letter : " Ctrl / Cmd + Shift + S " } , { label : " Open search " , letter : " Ctrl + Space " } , { label : " Toggle comments " , letter : " Ctrl / Cmd + Shift + C " } , { label : " Undo " , letter : " Ctrl / Cmd + Z " } , { label : " Redo " , letter : " Ctrl / Cmd + Shift + Z " } ] } , doceditor : { name : " Document editor " , content : [ { label : " Insert " , letter : " Ctrl + Insert " } , { label : " Save " , letter : " Ctrl + Return , Cmd + Return " } , { label : " Append " , letter : " Ctrl + Shift + Insert " } , { label : " Duplicate " , letter : " Ctrl + D " } , { label : " Remove " , letter : " Ctrl + Delete " } ] } , modals : { name : " Modal " , content : [ { label : " Submit " , letter : " Return " } , { label : " Close " , letter : " Esc " } , { label : " Navigate buttons " , letter : " Arrow keys " } , { label : " Navigate content " , letter : " Tab " } ] } } , hotkeysFunctions : { scrollDown : function ( ) { window . scrollBy ( 0 , 180 ) } , scrollUp : function ( ) { window . scrollBy ( 0 , - 180 ) } , showHotkeysModal : function ( ) { var a = [ ] , b = window . arangoHelper . allHotkeys ; window . modalView . show ( " modalHotkeys . ejs " , " Keyboard Shortcuts " , a , b ) } } , buildSubNavBar : function ( a ) { $ ( " # subNavigationBar . bottom " ) . html ( " " ) ; var b ; _ . each ( a , function ( a , c ) { b = " " , a . active & & ( b + = " active " ) , a . disabled & & ( b + = " disabled " ) , $ ( " # subNavigationBar . bottom " ) . append ( ' < li class = " subMenuEntry ' + b + ' " > < a > ' + c + " < / a > < / li > " ) , a . disabled | | $ ( " # subNavigationBar . bottom " ) . children ( ) . last ( ) . bind ( " click " , function ( ) { window . App . navigate ( a . route , { trigger : ! 0 } ) } ) } ) } , buildUserSubNav : function ( a , b ) { var c = { General : { route : " # user / " + encodeURIComponent ( a ) } , Permissions : { route : " # user / " + encodeURIComponent ( a ) + " / permission " } } ; c [ b ] . active = ! 0 , this . buildSubNavBar ( c ) } , buildGraphSubNav : function ( a , b ) { var c = { Content : { route : " # graph2 / " + encodeURIComponent ( a ) } , Settings : { route : " # graph2 / " + encodeURIComponent ( a ) + " / settings " } } ; c [ b ] . active = ! 0 , this . buildSubNavBar ( c ) } , buildNodeSubNav : function ( a , b , c ) { var d = { Dashboard : { route : " # node / " + encodeURIComponent ( a ) } } ; d [ b ] . active = ! 0 , d [ c ] . disabled = ! 0 , this . buildSubNavBar ( d ) } , buildNodesSubNav : function ( a , b ) { var c = { Overview : { route : " # nodes " } , Shards : { route : " # shards " } } ; c [ a ] . active = ! 0 , b & & ( c [ b ] . disabled = ! 0 ) , this . buildSubNavBar ( c ) } , scaleability : void 0 , 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 : this . databaseUrl ( " / _api / database / " , c ) , 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 " } ) } , arangoWarning : function ( a , b , c ) { window . App . notificationList . add ( { title : a , content : b , info : c , type : " warning " } ) } , arangoMessage : function ( a , b , c ) { window . App . notificationList . add ( { title : a , content : b , info : c , type : " message " } ) } , 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 ( ' < i class = " fa fa - times " > < / i > ' ) , $ ( " . 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 : this . databaseUrl ( " / _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 : this . databaseUrl ( " / _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 : this . databaseUrl ( " / _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 : this . databaseUrl ( " / _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 : this . databaseUrl ( " / _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 , " & amp ; " ) . replace ( / < / g , " & lt ; " ) . replace ( / > / g , " & gt ; " ) . replace ( / " / g , " & quot ; " ) . replace ( / ' / g , " & # 39 ; " ) } , backendUrl : function ( a ) { return frontendConfig . basePath + a } , databaseUrl : function ( a , b ) { if ( " / _db / " = = = a . substr ( 0 , 5 ) ) throw new Error ( " Calling databaseUrl with a databased url ( " + a + " ) doesn ' t make any sense " ) ; return b | | ( b = " _system " , frontendConfig . db & & ( b = frontendConfig . db ) ) , this . backendUrl ( " / _db / " + encodeURIComponent ( b ) + a ) } , showAuthDialog : function ( ) { var a = ! 0 , b = localStorage . getItem ( " authenticationNotification " ) ; return " false " = = = b & & ( a = ! 1 ) , a } , doNotShowAgain : function ( ) { localStorage . setItem ( " authenticationNotification " , ! 1 ) } , renderEmpty : function ( a ) { $ ( " # content " ) . html ( ' < div class = " noContent " > < p > ' + a + " < / p > < / div > " ) } , download : function ( a , b ) { $ . ajax ( a ) . success ( function ( a , c , d ) { if ( b ) return void b ( a ) ; var e = new Blob ( [ JSON . stringify ( a ) ] , { type : d . getResponseHeader ( " Content - Type " ) | | " application / octet - stream " } ) , f = window . URL . createObjectURL ( e ) , g = document . createElement ( " a " ) ; document . body . appendChild ( g ) , g . style = " display : none " , g . href = f , g . download = d . getResponseHeader ( " Content - Disposition " ) . replace ( / . * filename = " ( [ ^ " ) ] * ) " / , " $ 1 " ) , g . click ( ) , window . URL . revokeObjectURL ( f ) , document . body . removeChild ( 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 } } ( ) , function ( ) { " use strict " ; window . dygraphConfig = { defaultFrame : 12e5 , zeropad : function ( a ) { return 10 > a ? " 0 " + a : a } , xAxisFormat : function ( a ) { if ( - 1 = = = a ) return " " ; var b = new Date ( a ) ; return this . zeropad ( b . getHours ( ) ) + " : " + this . zeropad ( b . getMinutes ( ) ) + " : " + this . zeropad ( b . getSeconds ( ) ) } , mergeObjects : function ( a , b , c ) { c | | ( c = [ ] ) ; var d , e = { } ; return c . forEach ( function ( c ) { var d = a [ c ] , f = b [ c ] ; void 0 = = = d & & ( d = { } ) , void 0 = = = f & & ( f = { } ) , e [ c ] = _ . extend ( d , f ) } ) , d = _ . extend ( a , b ) , Object . keys ( e ) . forEach ( function ( a ) { d [ a ] = e [ a ] } ) , d } , mapStatToFigure : { pageFaults : [ " times " , " majorPageFaultsPerSecond " , " minorPageFaultsPerSecond " ] , systemUserTime : [ " times " , " systemTimePerSecond " , " userTimePerSecond " ] , totalTime : [ " times " , " avgQueueTime " , " avgRequestTime " , " avgIoTime " ] , dataTransfer : [ " times " , " bytesSentPerSecond " , " bytesReceivedPerSecond " ] , requests : [ " times " , " getsPerSecond " , " putsPerSecond " , " postsPerSecond " , " deletesPerSecond " , " patchesPerSecond " , " headsPerSecond " , " optionsPerSecond " , " othersPerSecond " ] } , colors : [ " rgb ( 95 , 194 , 135 ) " , " rgb ( 238 , 190 , 77 ) " , " # 81ccd8 " , " # 7ca530 " , " # 3c3c3c " , " # aa90bd " , " # e1811d " , " # c7d4b2 " , " # d0b2d4 " ] , figureDependedOptions : { clusterRequestsPerSecond : { showLabelsOnHighlight : ! 0 , title : " " , header : " Cluster Requests per Second " , stackedGraph : ! 0 , div : " lineGraphLegend " , labelsKMG2 : ! 1 , axes : { y : { valueFormatter : function ( a ) { return parseFloat ( a . toPrecision ( 3 ) ) } , axisLabelFormatter : function ( a ) { return 0 = = = a ? 0 : parseFloat ( a . toPrecision ( 3 ) ) } } } } , pageFaults : { header : " Page Faults " , visibility : [ ! 0 , ! 1 ] , labels : [ " datetime " , " Major Page " , " Minor Page " ] , div : " pageFaultsChart " , labelsKMG2 : ! 1 , axes : { y : { valueFormatter : function ( a ) { return parseFloat ( a . toPrecision ( 3 ) ) } , axisLabelFormatter : function ( a ) { return 0 = = = a ? 0 : parseFloat ( a . toPrecision ( 3 ) ) } } } } , systemUserTime : { div : " systemUserTimeChart " , header : " System and User Time " , labels : [ " datetime " , " System Time " , " User Time " ] , stackedGraph : ! 0 , labelsKMG2 : ! 1 , axes : { y : { valueFormatter : function ( a ) { return parseFloat ( a . toPrecision ( 3 ) ) } , axisLabelFormatter : function ( a ) { return 0 = = = a ? 0 : parseFloat ( a . toPrecision ( 3 ) ) } } } } , totalTime : { div : " totalTimeChart " , header : " Total Time " , labels : [ " datetime " , " Queue " , " Computation " , " I / O " ] , labelsKMG2 : ! 1 , axes : { y : { valueFormatter : function ( a ) { return parseFloat ( a . toPrecision ( 3 ) ) } , axisLabelFormatter : function ( a ) { return 0 = = = a ? 0 : parseFloat ( a . toPrecision ( 3 ) ) } } } , stackedGraph : ! 0 } , dataTransfer : { header : " Data Transfer " , labels : [ " datetime " , " Bytes sent " , " Bytes received " ] , stackedGraph : ! 0 , div : " dataTransferChart " } , requests : { header : " Requests " , labels : [ " datetime " , " Reads " , " Writes " ] , stackedGraph : ! 0 , div : " requestsChart " , axes : { y : { valueFormatter : function ( a ) { return parseFloat ( a . toPrecision ( 3 ) ) } , axisLabelFormatter : function ( a ) { return 0 = = = a ? 0 : parseFloat ( a . toPrecision ( 3 ) ) } } } } } , getDashBoardFigures : function ( a ) { var b = [ ] , c = this ; return Object . keys ( this . figureDependedOptions ) . forEach ( function ( d ) { " clusterRequestsPerSecond " ! = = d & & ( c . figureDependedOptions [ d ] . div | | a ) & & b . push ( d ) } ) , b } , getDefaultConfig : function ( a ) { var b = this , c = { digitsAfterDecimal : 1 , drawGapPoints : ! 0 , fillGraph : ! 0 , fillAlpha : . 85 , showLabelsOnHighlight : ! 1 , strokeWidth : 0 , lineWidth : 0 , strokeBorderWidth : 0 , includeZero : ! 0 , highlightCircleSize : 2 . 5 , labelsSeparateLines : ! 0 , strokeBorderColor : " rgba ( 0 , 0 , 0 , 0 ) " , interactionModel : { } , maxNumberWidth : 10 , colors : [ this . colors [ 0 ] ] , xAxisLabelWidth : " 50 " , rightGap : 15 , showRangeSelector : ! 1 , rangeSelectorHeight : 50 , rangeSelectorPlotStrokeColor : " # 365300 " , rangeSelectorPlotFillColor : " " , pixelsPerLabel : 50 , labelsKMG2 : ! 0 , dateWindow : [ ( new Date ) . getTime ( ) - this . defaultFrame , ( new Date ) . getTime ( ) ] , axes : { x : { valueFormatter : function ( a ) { return b . xAxisFormat ( a ) } } , y : { ticker : Dygraph . numericLinearTicks } } } ; return this . figureDependedOptions [ a ] & & ( c = this . mergeObjects ( c , this . figureDependedOptions [ a ] , [ " axes " ] ) , c . div & & c . labels & & ( c . colors = this . getColors ( c . labels ) , c . labelsDiv = document . getElementById ( c . div + " Legend " ) , c . legend = " always " , c . showLabelsOnHighlight = ! 0 ) ) , c } , getDetailChartConfig : function ( a ) { var b = _ . extend ( this . getDefaultConfig ( a ) , { showRangeSelector : ! 0 , interactionModel : null , showLabelsOnHighlight : ! 0 , highlightCircleSize : 2 . 5 , legend : " always " , labelsDiv : " div # detailLegend . dashboard - legend - inner " } ) ; return " pageFaults " = = = a & & ( b . visibility = [ ! 0 , ! 0 ] ) , b . labels | | ( b . labels = [ " datetime " , b . header ] , b . colors = this . getColors ( b . labels ) ) , b } , getColors : function ( a ) { var b ; return b = this . colors . concat ( [ ] ) , b . slice ( 0 , a . length - 1 ) } } } ( ) , function ( ) { " use strict " ; window . arangoCollectionModel = Backbone . Model . extend ( { idAttribute : " name " , urlRoot : arangoHelper . databaseUrl ( " / _api / collection " ) , defaults : { id : " " , name : " " , status : " " , type : " " , isSystem : ! 1 , picture : " " , locked : ! 1 , desc : void 0 } , getProperties : function ( a ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / collection / " + encodeURIComponent ( this . get ( " id " ) ) + " / properties " ) , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b ) } , error : function ( b ) { a ( ! 0 , b ) } } ) } , getFigures : function ( a ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . get ( " id " ) + " / figures " ) , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b ) } , error : function ( ) { a ( ! 0 ) } } ) } , getRevision : function ( a , b ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . get ( " id " ) + " / revision " ) , contentType : " application / json " , processData : ! 1 , success : function ( c ) { a ( ! 1 , c , b ) } , error : function ( ) { a ( ! 0 ) } } ) } , getIndex : function ( a ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / index / ? collection = " + this . get ( " id " ) ) , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b ) } , error : function ( b ) { a ( ! 0 , b ) } } ) } , createIndex : function ( a , b ) { var c = this ; $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / index ? collection = " + c . get ( " id " ) ) , headers : { " x - arango - async " : " store " } , data : JSON . stringify ( a ) , contentType : " application / json " , processData : ! 1 , success : function ( a , d , e ) { e . getResponseHeader ( " x - arango - async - id " ) ? ( window . arangoHelper . addAardvarkJob ( { id : e . getResponseHeader ( " x - arango - async - id " ) , type : " index " , desc : " Creating Index " , collection : c . get ( " id " ) } ) , b ( ! 1 , a ) ) : b ( ! 0 , a ) } , error : function ( a ) { b ( ! 0 , a ) } } ) } , deleteIndex : function ( a , b ) { <nl> - var c = this ; $ . ajax ( { cache : ! 1 , type : " DELETE " , url : arangoHelper . databaseUrl ( " / _api / index / " + this . get ( " name " ) + " / " + encodeURIComponent ( a ) ) , headers : { " x - arango - async " : " store " } , success : function ( a , d , e ) { e . getResponseHeader ( " x - arango - async - id " ) ? ( window . arangoHelper . addAardvarkJob ( { id : e . getResponseHeader ( " x - arango - async - id " ) , type : " index " , desc : " Removing Index " , collection : c . get ( " id " ) } ) , b ( ! 1 , a ) ) : b ( ! 0 , a ) } , error : function ( a ) { b ( ! 0 , a ) } } ) , b ( ) } , truncateCollection : function ( ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . get ( " id " ) + " / truncate " ) , success : function ( ) { arangoHelper . arangoNotification ( " Collection truncated . " ) } , error : function ( ) { arangoHelper . arangoError ( " Collection error . " ) } } ) } , loadCollection : function ( a ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . get ( " id " ) + " / load " ) , success : function ( ) { a ( ! 1 ) } , error : function ( ) { a ( ! 0 ) } } ) , a ( ) } , unloadCollection : function ( a ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . get ( " id " ) + " / unload ? flush = true " ) , success : function ( ) { a ( ! 1 ) } , error : function ( ) { a ( ! 0 ) } } ) , a ( ) } , renameCollection : function ( a , b ) { var c = this ; $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . get ( " id " ) + " / rename " ) , data : JSON . stringify ( { name : a } ) , contentType : " application / json " , processData : ! 1 , success : function ( ) { c . set ( " name " , a ) , b ( ! 1 ) } , error : function ( a ) { b ( ! 0 , a ) } } ) } , changeCollection : function ( a , b , c , d ) { var e = ! 1 ; " true " = = = a ? a = ! 0 : " false " = = = a & & ( a = ! 1 ) ; var f = { waitForSync : a , journalSize : parseInt ( b , 10 ) , indexBuckets : parseInt ( c , 10 ) } ; return $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . get ( " id " ) + " / properties " ) , data : JSON . stringify ( f ) , contentType : " application / json " , processData : ! 1 , success : function ( ) { d ( ! 1 ) } , error : function ( a ) { d ( ! 1 , a ) } } ) , e } } ) } ( ) , window . DatabaseModel = Backbone . Model . extend ( { idAttribute : " name " , initialize : function ( ) { " use strict " } , isNew : function ( ) { " use strict " ; return ! 1 } , sync : function ( a , b , c ) { " use strict " ; return " update " = = = a & & ( a = " create " ) , Backbone . sync ( a , b , c ) } , url : arangoHelper . databaseUrl ( " / _api / database " ) , defaults : { } } ) , window . arangoDocumentModel = Backbone . Model . extend ( { initialize : function ( ) { " use strict " } , urlRoot : arangoHelper . databaseUrl ( " / _api / document " ) , defaults : { _id : " " , _rev : " " , _key : " " } , getSorted : function ( ) { " use strict " ; var a = this , b = Object . keys ( a . attributes ) . sort ( function ( a , b ) { var c = arangoHelper . isSystemAttribute ( a ) , d = arangoHelper . isSystemAttribute ( b ) ; return c ! = = d ? c ? - 1 : 1 : b > a ? - 1 : 1 } ) , c = { } ; return _ . each ( b , function ( b ) { c [ b ] = a . attributes [ b ] } ) , c } } ) , function ( ) { " use strict " ; window . ArangoQuery = Backbone . Model . extend ( { urlRoot : arangoHelper . databaseUrl ( " / _api / user " ) , defaults : { name : " " , type : " custom " , value : " " } } ) } ( ) , window . Replication = Backbone . Model . extend ( { defaults : { state : { } , server : { } } , initialize : function ( ) { } } ) , window . Statistics = Backbone . Model . extend ( { defaults : { } , url : function ( ) { " use strict " ; return " / _admin / statistics " } } ) , window . StatisticsDescription = Backbone . Model . extend ( { defaults : { figures : " " , groups : " " } , url : function ( ) { " use strict " ; return " / _admin / statistics - description " } } ) , window . Users = Backbone . Model . extend ( { defaults : { user : " " , active : ! 1 , extra : { } } , idAttribute : " user " , parse : function ( a ) { return this . isNotNew = ! 0 , a } , isNew : function ( ) { return ! this . isNotNew } , url : function ( ) { return this . isNew ( ) ? arangoHelper . databaseUrl ( " / _api / user " ) : " " ! = = this . get ( " user " ) ? arangoHelper . databaseUrl ( " / _api / user / " + this . get ( " user " ) ) : arangoHelper . databaseUrl ( " / _api / user " ) } , checkPassword : function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / user / " + this . get ( " user " ) ) , data : JSON . stringify ( { passwd : a } ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { b ( ! 1 , a ) } , error : function ( a ) { b ( ! 0 , a ) } } ) } , setPassword : function ( a ) { $ . ajax ( { cache : ! 1 , type : " PATCH " , url : arangoHelper . databaseUrl ( " / _api / user / " + this . get ( " user " ) ) , data : JSON . stringify ( { passwd : a } ) , contentType : " application / json " , processData : ! 1 } ) } , setExtras : function ( a , b , c ) { $ . ajax ( { cache : ! 1 , type : " PATCH " , url : arangoHelper . databaseUrl ( " / _api / user / " + this . get ( " user " ) ) , data : JSON . stringify ( { extra : { name : a , img : b } } ) , contentType : " application / json " , processData : ! 1 , success : function ( ) { c ( ! 1 ) } , error : function ( ) { c ( ! 0 ) } } ) } } ) , function ( ) { " use strict " ; window . ClusterCoordinator = Backbone . Model . extend ( { defaults : { name : " " , status : " ok " , address : " " , protocol : " " } , idAttribute : " name " , forList : function ( ) { return { name : this . get ( " name " ) , status : this . get ( " status " ) , url : this . get ( " url " ) } } } ) } ( ) , function ( ) { " use strict " ; window . ClusterServer = Backbone . Model . extend ( { defaults : { name : " " , address : " " , role : " " , status : " ok " } , idAttribute : " name " , forList : function ( ) { return { name : this . get ( " name " ) , address : this . get ( " address " ) , status : this . get ( " status " ) } } } ) } ( ) , function ( ) { " use strict " ; window . Coordinator = Backbone . Model . extend ( { defaults : { address : " " , protocol : " " , name : " " , status : " " } } ) } ( ) , function ( ) { " use strict " ; window . CurrentDatabase = Backbone . Model . extend ( { url : arangoHelper . databaseUrl ( " / _api / database / current " , frontendConfig . db ) , parse : function ( a ) { return a . result } } ) } ( ) , function ( ) { " use strict " ; var a = function ( a , b , c , d , e , f ) { var g = { contentType : " application / json " , processData : ! 1 , type : c } ; b = b | | function ( ) { } , f = _ . extend ( { mount : a . encodedMount ( ) } , f ) ; var h = _ . reduce ( f , function ( a , b , c ) { return a + encodeURIComponent ( c ) + " = " + encodeURIComponent ( b ) + " & " } , " ? " ) ; g . url = arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes " + ( d ? " / " + d : " " ) + h . slice ( 0 , h . length - 1 ) ) , void 0 ! = = e & & ( g . data = JSON . stringify ( e ) ) , $ . ajax ( g ) . then ( function ( a ) { b ( null , a ) } , function ( a ) { window . xhr = a , b ( _ . extend ( a . status ? new Error ( a . responseJSON ? a . responseJSON . errorMessage : a . responseText ) : new Error ( " Network Error " ) , { statusCode : a . status } ) ) } ) } ; window . Foxx = Backbone . Model . extend ( { idAttribute : " mount " , defaults : { author : " Unknown Author " , name : " " , version : " Unknown Version " , description : " No description " , license : " Unknown License " , contributors : [ ] , scripts : { } , config : { } , deps : { } , git : " " , system : ! 1 , development : ! 1 } , isNew : function ( ) { return ! 1 } , encodedMount : function ( ) { return encodeURIComponent ( this . get ( " mount " ) ) } , destroy : function ( b , c ) { a ( this , c , " DELETE " , void 0 , void 0 , b ) } , isBroken : function ( ) { return ! 1 } , needsAttention : function ( ) { return this . isBroken ( ) | | this . needsConfiguration ( ) | | this . hasUnconfiguredDependencies ( ) } , needsConfiguration : function ( ) { return _ . any ( this . get ( " config " ) , function ( a ) { return void 0 = = = a . current & & a . required ! = = ! 1 } ) } , hasUnconfiguredDependencies : function ( ) { return _ . any ( this . get ( " deps " ) , function ( a ) { return void 0 = = = a . current & & a . definition . required ! = = ! 1 } ) } , getConfiguration : function ( b ) { a ( this , function ( a , c ) { a | | this . set ( " config " , c ) , " function " = = typeof b & & b ( a , c ) } . bind ( this ) , " GET " , " config " ) } , setConfiguration : function ( b , c ) { a ( this , c , " PATCH " , " config " , b ) } , getDependencies : function ( b ) { a ( this , function ( a , c ) { a | | this . set ( " deps " , c ) , " function " = = typeof b & & b ( a , c ) } . bind ( this ) , " GET " , " deps " ) } , setDependencies : function ( b , c ) { a ( this , c , " PATCH " , " deps " , b ) } , toggleDevelopment : function ( b , c ) { a ( this , function ( a , d ) { a | | this . set ( " development " , b ) , " function " = = typeof c & & c ( a , d ) } . bind ( this ) , " PATCH " , " devel " , b ) } , runScript : function ( b , c , d ) { a ( this , d , " POST " , " scripts / " + b , c ) } , runTests : function ( b , c ) { a ( this , function ( a , b ) { " function " = = typeof c & & c ( a ? a . responseJSON : a , b ) } , " POST " , " tests " , b ) } , isSystem : function ( ) { return this . get ( " system " ) } , isDevelopment : function ( ) { return this . get ( " development " ) } , download : function ( ) { a ( this , function ( a , b ) { return a ? void console . error ( a . responseJSON ) : void ( window . location . href = arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes / download / zip ? mount = " + this . encodedMount ( ) + " & nonce = " + b . nonce ) ) } . bind ( this ) , " POST " , " download / nonce " ) } , fetchThumbnail : function ( a ) { var b = new XMLHttpRequest ; b . responseType = " blob " , b . onload = function ( ) { this . thumbnailUrl = URL . createObjectURL ( b . response ) , a ( ) } . bind ( this ) , b . onerror = a , b . open ( " GET " , " foxxes / thumbnail ? mount = " + this . encodedMount ( ) ) , window . arangoHelper . getCurrentJwt ( ) & & b . setRequestHeader ( " Authorization " , " bearer " + window . arangoHelper . getCurrentJwt ( ) ) , b . send ( ) } } ) } ( ) , function ( ) { " use strict " ; window . Graph = Backbone . Model . extend ( { idAttribute : " _key " , urlRoot : arangoHelper . databaseUrl ( " / _api / gharial " ) , isNew : function ( ) { return ! this . get ( " _id " ) } , parse : function ( a ) { return a . graph | | a } , addEdgeDefinition : function ( a ) { $ . ajax ( { async : ! 1 , type : " POST " , url : this . urlRoot + " / " + this . get ( " _key " ) + " / edge " , data : JSON . stringify ( a ) } ) } , deleteEdgeDefinition : function ( a ) { $ . ajax ( { async : ! 1 , type : " DELETE " , url : this . urlRoot + " / " + this . get ( " _key " ) + " / edge / " + a } ) } , modifyEdgeDefinition : function ( a ) { $ . ajax ( { async : ! 1 , type : " PUT " , url : this . urlRoot + " / " + this . get ( " _key " ) + " / edge / " + a . collection , data : JSON . stringify ( a ) } ) } , addVertexCollection : function ( a ) { $ . ajax ( { async : ! 1 , type : " POST " , url : this . urlRoot + " / " + this . get ( " _key " ) + " / vertex " , data : JSON . stringify ( { collection : a } ) } ) } , deleteVertexCollection : function ( a ) { $ . ajax ( { async : ! 1 , type : " DELETE " , url : this . urlRoot + " / " + this . get ( " _key " ) + " / vertex / " + a } ) } , defaults : { name : " " , edgeDefinitions : [ ] , orphanCollections : [ ] } } ) } ( ) , function ( ) { " use strict " ; window . newArangoLog = Backbone . Model . extend ( { defaults : { lid : " " , level : " " , timestamp : " " , text : " " , totalAmount : " " } , getLogStatus : function ( ) { switch ( this . get ( " level " ) ) { case 1 : return " Error " ; case 2 : return " Warning " ; case 3 : return " Info " ; case 4 : return " Debug " ; default : return " Unknown " } } } ) } ( ) , function ( ) { " use strict " ; window . Notification = Backbone . Model . extend ( { defaults : { title : " " , date : 0 , content : " " , priority : " " , tags : " " , seen : ! 1 } } ) } ( ) , function ( ) { " use strict " ; window . queryManagementModel = Backbone . Model . extend ( { defaults : { id : " " , query : " " , started : " " , runTime : " " } } ) } ( ) , window . UserConfig = Backbone . Model . extend ( { defaults : { graphs : " " , queries : [ ] } , model : window . UserConfigModel , parse : function ( a ) { return a . result } , url : function ( ) { return window . App . currentUser ? this . username = window . App . currentUser : this . username = " root " , arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( this . username ) + " / config " ) } , setItem : function ( a , b , c ) { var d = this ; $ . ajax ( { type : " PUT " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( this . username ) + " / config / " + encodeURIComponent ( a ) ) , contentType : " application / json " , processData : ! 1 , data : JSON . stringify ( { value : b } ) , async : ! 0 , success : function ( ) { d . set ( a , b ) , c & & c ( ) } , error : function ( ) { arangoHelper . arangoError ( " User configuration " , " Could not update user configuration for key : " + a ) } } ) } , getItem : function ( a , b ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( this . username ) + " / config / " + encodeURIComponent ( a ) ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( a ) { b ( a ) } , error : function ( ) { arangoHelper . arangoError ( " User configuration " , " Could not fetch user configuration for key : " + a ) } } ) } } ) , function ( ) { " use strict " ; window . workMonitorModel = Backbone . Model . extend ( { defaults : { name : " " , number : " " , status : " " , type : " " } } ) } ( ) , function ( ) { " use strict " ; window . AutomaticRetryCollection = Backbone . Collection . extend ( { _retryCount : 0 , checkRetries : function ( ) { var a = this ; return this . updateUrl ( ) , this . _retryCount > 10 ? ( window . setTimeout ( function ( ) { a . _retryCount = 0 } , 1e4 ) , window . App . clusterUnreachable ( ) , ! 1 ) : ! 0 } , successFullTry : function ( ) { this . _retryCount = 0 } , failureTry : function ( a , b , c ) { 401 = = = c . status ? window . App . requestAuth ( ) : ( window . App . clusterPlan . rotateCoordinator ( ) , this . _retryCount + + , a ( ) ) } } ) } ( ) , function ( ) { " use strict " ; window . PaginatedCollection = Backbone . Collection . extend ( { page : 0 , pagesize : 10 , totalAmount : 0 , getPage : function ( ) { return this . page + 1 } , setPage : function ( a ) { return a > = this . getLastPageNumber ( ) ? void ( this . page = this . getLastPageNumber ( ) - 1 ) : 1 > a ? void ( this . page = 0 ) : void ( this . page = a - 1 ) } , getLastPageNumber : function ( ) { return Math . max ( Math . ceil ( this . totalAmount / this . pagesize ) , 1 ) } , getOffset : function ( ) { return this . page * this . pagesize } , getPageSize : function ( ) { return this . pagesize } , setPageSize : function ( a ) { if ( " all " = = = a ) this . pagesize = " all " ; else try { a = parseInt ( a , 10 ) , this . pagesize = a } catch ( b ) { } } , setToFirst : function ( ) { this . page = 0 } , setToLast : function ( ) { this . setPage ( this . getLastPageNumber ( ) ) } , setToPrev : function ( ) { this . setPage ( this . getPage ( ) - 1 ) } , setToNext : function ( ) { this . setPage ( this . getPage ( ) + 1 ) } , setTotal : function ( a ) { this . totalAmount = a } , getTotal : function ( ) { return this . totalAmount } , setTotalMinusOne : function ( ) { this . totalAmount - - } } ) } ( ) , window . ClusterStatisticsCollection = Backbone . Collection . extend ( { model : window . Statistics , url : " / _admin / statistics " , updateUrl : function ( ) { this . url = window . App . getNewRoute ( this . host ) + this . url } , initialize : function ( a , b ) { this . host = b . host , window . App . registerForUpdate ( this ) } } ) , function ( ) { " use strict " ; window . ArangoCollections = Backbone . Collection . extend ( { url : arangoHelper . databaseUrl ( " / _api / collection " ) , model : arangoCollectionModel , searchOptions : { searchPhrase : null , includeSystem : ! 1 , includeDocument : ! 0 , includeEdge : ! 0 , includeLoaded : ! 0 , includeUnloaded : ! 0 , sortBy : " name " , sortOrder : 1 } , translateStatus : function ( a ) { switch ( a ) { case 0 : return " corrupted " ; case 1 : return " new born collection " ; case 2 : return " unloaded " ; case 3 : return " loaded " ; case 4 : return " unloading " ; case 5 : return " deleted " ; case 6 : return " loading " ; default : return } } , translateTypePicture : function ( a ) { var b = " " ; switch ( a ) { case " document " : b + = " fa - file - text - o " ; break ; case " edge " : b + = " fa - share - alt " ; break ; case " unknown " : b + = " fa - question " ; break ; default : b + = " fa - cogs " } return b } , parse : function ( a ) { var b = this ; return _ . each ( a . result , function ( a ) { a . isSystem = arangoHelper . isSystemCollection ( a ) , a . type = arangoHelper . collectionType ( a ) , a . status = b . translateStatus ( a . status ) , a . picture = b . translateTypePicture ( a . type ) } ) , a . result } , getPosition : function ( a ) { var b , c = this . getFiltered ( this . searchOptions ) , d = null , e = null ; for ( b = 0 ; b < c . length ; + + b ) c [ b ] . get ( " name " ) = = = a & & ( b > 0 & & ( d = c [ b - 1 ] ) , b < c . length - 1 & & ( e = c [ b + 1 ] ) ) ; return { prev : d , next : e } } , getFiltered : function ( a ) { var b = [ ] , c = [ ] ; if ( null ! = = a . searchPhrase ) { var d = a . searchPhrase . toLowerCase ( ) ; d = d . replace ( / \ s + / g , " " ) . replace ( / ( ^ \ s + | \ s + $ ) / g , " " ) , c = d . split ( " " ) } return this . models . forEach ( function ( d ) { if ( c . length > 0 ) { var e , f = d . get ( " name " ) . toLowerCase ( ) ; for ( e = 0 ; e < c . length ; + + e ) if ( - 1 = = = f . indexOf ( c [ e ] ) ) return } a . includeSystem = = = ! 1 & & d . get ( " isSystem " ) | | a . includeEdge = = = ! 1 & & " edge " = = = d . get ( " type " ) | | a . includeDocument = = = ! 1 & & " document " = = = d . get ( " type " ) | | a . includeLoaded = = = ! 1 & & " loaded " = = = d . get ( " status " ) | | a . includeUnloaded = = = ! 1 & & " unloaded " = = = d . get ( " status " ) | | b . push ( d ) } ) , b . sort ( function ( b , c ) { var d , e ; return " type " = = = a . sortBy ? ( d = b . get ( " type " ) + " " + b . get ( " name " ) . toLowerCase ( ) , e = c . get ( " type " ) + " " + c . get ( " name " ) . toLowerCase ( ) ) : ( d = b . get ( " name " ) . toLowerCase ( ) , e = c . get ( " name " ) . toLowerCase ( ) ) , d ! = = e ? a . sortOrder * ( e > d ? - 1 : 1 ) : 0 } ) , b } , newCollection : function ( a , b ) { var c = { } ; c . name = a . collName , c . waitForSync = a . wfs , a . journalSize > 0 & & ( c . journalSize = a . journalSize ) , c . isSystem = a . isSystem , c . type = parseInt ( a . collType , 10 ) , a . shards & & ( c . numberOfShards = a . shards , c . shardKeys = a . keys ) , a . replicationFactor & & ( c . replicationFactor = JSON . parse ( a . replicationFactor ) ) , $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / collection " ) , data : JSON . stringify ( c ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { b ( ! 1 , a ) } , error : function ( a ) { b ( ! 0 , a ) } } ) } } ) } ( ) , function ( ) { " use strict " ; window . ArangoDatabase = Backbone . Collection . extend ( { model : window . DatabaseModel , sortOptions : { desc : ! 1 } , url : arangoHelper . databaseUrl ( " / _api / database " ) , comparator : function ( a , b ) { var c = a . get ( " name " ) . toLowerCase ( ) , d = b . get ( " name " ) . toLowerCase ( ) ; return this . sortOptions . desc = = = ! 0 ? d > c ? 1 : c > d ? - 1 : 0 : c > d ? 1 : d > c ? - 1 : 0 } , parse : function ( a ) { return a ? _ . map ( a . result , function ( a ) { return { name : a } } ) : void 0 } , initialize : function ( ) { var a = this ; this . fetch ( ) . done ( function ( ) { a . sort ( ) } ) } , setSortingDesc : function ( a ) { this . sortOptions . desc = a } , getDatabases : function ( ) { var a = this ; return this . fetch ( ) . done ( function ( ) { a . sort ( ) } ) , this . models } , getDatabasesForUser : function ( a ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : this . url + " / user " , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b . result . sort ( ) ) } , error : function ( ) { a ( ! 0 , [ ] ) } } ) } , createDatabaseURL : function ( a , b , c ) { var d = window . location , e = window . location . hash ; b = b ? " SSL " = = = b | | " https : " = = = b ? " https : " : " http : " : d . protocol , c = c | | d . port ; var f = b + " / / " + window . location . hostname + " : " + c + " / _db / " + encodeURIComponent ( a ) + " / _admin / aardvark / standalone . html " ; if ( e ) { var g = e . split ( " / " ) [ 0 ] ; 0 = = = g . indexOf ( " # collection " ) & & ( g = " # collections " ) , 0 = = = g . indexOf ( " # service " ) & & ( g = " # services " ) , f + = g } return f } , getCurrentDatabase : function ( a ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : this . url + " / current " , contentType : " application / json " , processData : ! 1 , success : function ( b ) { 200 = = = b . code ? a ( ! 1 , b . result . name ) : a ( ! 1 , b ) } , error : function ( b ) { a ( ! 0 , b ) } } ) } , hasSystemAccess : function ( a ) { var b = function ( b , c ) { b ? arangoHelper . arangoError ( " DB " , " Could not fetch databases " ) : a ( ! 1 , _ . includes ( c , " _system " ) ) } ; this . getDatabasesForUser ( b ) } } ) } ( ) , window . ArangoDocument = Backbone . Collection . extend ( { url : " / _api / document / " , model : arangoDocumentModel , collectionInfo : { } , deleteEdge : function ( a , b , c ) { this . deleteDocument ( a , b , c ) } , deleteDocument : function ( a , b , c ) { $ . ajax ( { cache : ! 1 , type : " DELETE " , contentType : " application / json " , url : arangoHelper . databaseUrl ( " / _api / document / " + encodeURIComponent ( a ) + " / " + encodeURIComponent ( b ) ) , success : function ( ) { c ( ! 1 ) } , error : function ( ) { c ( ! 0 ) } } ) } , addDocument : function ( a , b ) { var c = this ; c . createTypeDocument ( a , b ) } , createTypeEdge : function ( a , b , c , d , e ) { var f ; f = d ? JSON . stringify ( { _key : d , _from : b , _to : c } ) : JSON . stringify ( { _from : b , _to : c } ) , $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / document ? collection = " + encodeURIComponent ( a ) ) , data : f , contentType : " application / json " , processData : ! 1 , success : function ( a ) { e ( ! 1 , a ) } , error : function ( a ) { e ( ! 0 , a ) } } ) } , createTypeDocument : function ( a , b , c ) { var d ; d = b ? JSON . stringify ( { _key : b } ) : JSON . stringify ( { } ) , $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / document ? collection = " + encodeURIComponent ( a ) ) , data : d , contentType : " application / json " , processData : ! 1 , success : function ( a ) { c ( ! 1 , a . _id ) } , error : function ( a ) { c ( ! 0 , a . _id ) } } ) } , getCollectionInfo : function ( a , b , c ) { var d = this ; $ . ajax ( { cache : ! 1 , type : " GET " , url : arangoHelper . databaseUrl ( " / _api / collection / " + a + " ? " + arangoHelper . getRandomToken ( ) ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { d . collectionInfo = a , b ( ! 1 , a , c ) } , error : function ( a ) { b ( ! 0 , a , c ) } } ) } , getEdge : function ( a , b , c ) { this . getDocument ( a , b , c ) } , getDocument : function ( a , b , c ) { var d = this ; this . clearDocument ( ) , $ . ajax ( { cache : ! 1 , type : " GET " , url : arangoHelper . databaseUrl ( " / _api / document / " + encodeURIComponent ( a ) + " / " + encodeURIComponent ( b ) ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { d . add ( a ) , c ( ! 1 , a , " document " ) } , error : function ( a ) { d . add ( ! 0 , a ) } } ) } , saveEdge : function ( a , b , c , d , e , f ) { var g ; try { g = JSON . parse ( e ) , g . _to = d , g . _from = c } catch ( h ) { arangoHelper . arangoError ( " Edge " , " Could not parsed document . " ) } $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / document / " + encodeURIComponent ( a ) + " / " + encodeURIComponent ( b ) ) + " # replaceEdge " , data : JSON . stringify ( g ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { f ( ! 1 , a ) } , error : function ( a ) { f ( ! 0 , a ) } } ) } , saveDocument : function ( a , b , c , d ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / document / " + encodeURIComponent ( a ) + " / " + encodeURIComponent ( b ) ) , data : c , contentType : " application / json " , processData : ! 1 , success : function ( a ) { d ( ! 1 , a ) } , error : function ( a ) { d ( ! 0 , a ) } } ) } , updateLocalDocument : function ( a ) { this . clearDocument ( ) , this . add ( a ) } , clearDocument : function ( ) { this . reset ( ) } } ) , function ( ) { " use strict " ; window . ArangoDocuments = window . PaginatedCollection . extend ( { collectionID : 1 , filters : [ ] , checkCursorTimer : void 0 , MAX_SORT : 12e3 , lastQuery : { } , sortAttribute : " " , url : arangoHelper . databaseUrl ( " / _api / documents " ) , model : window . arangoDocumentModel , loadTotal : function ( a ) { var b = this ; $ . ajax ( { cache : ! 1 , type : " GET " , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . collectionID + " / count " ) , contentType : " application / json " , processData : ! 1 , success : function ( c ) { b . setTotal ( c . count ) , a ( ! 1 ) } , error : function ( ) { a ( ! 0 ) } } ) } , setCollection : function ( a ) { var b = function ( a ) { a & & arangoHelper . arangoError ( " Documents " , " Could not fetch documents count " ) } ; this . resetFilter ( ) , this . collectionID = a , this . setPage ( 1 ) , this . loadTotal ( b ) } , setSort : function ( a ) { this . sortAttribute = a } , getSort : function ( ) { return this . sortAttribute } , addFilter : function ( a , b , c ) { this . filters . push ( { attr : a , op : b , val : c } ) } , setFiltersForQuery : function ( a ) { if ( 0 = = = this . filters . length ) return " " ; var b = " FILTER " , c = " " , d = _ . map ( this . filters , function ( b , d ) { return " LIKE " = = = b . op ? ( c = " " + b . op + " ( x . ` " + b . attr + " ` , @ param " , c + = d , c + = " ) " ) : ( c = " IN " = = = b . op | | " NOT IN " = = = b . op ? " " : " x . ` " , c + = b . attr , c + = " IN " = = = b . op | | " NOT IN " = = = b . op ? " " : " ` " , c + = b . op , c + = " IN " = = = b . op | | " NOT IN " = = = b . op ? " x . @ param " : " @ param " , c + = d ) , a [ " param " + d ] = b . val , c } ) ; return b + d . join ( " & & " ) } , setPagesize : function ( a ) { this . setPageSize ( a ) } , resetFilter : function ( ) { this . filters = [ ] } , moveDocument : function ( a , b , c , d ) { var e , f , g , h , i = { " @ collection " : b , filterid : a } ; e = " FOR x IN @ @ collection " , e + = " FILTER x . _key = = @ filterid " , e + = " INSERT x IN " , e + = c , f = " FOR x in @ @ collection " , f + = " FILTER x . _key = = @ filterid " , f + = " REMOVE x IN @ @ collection " , g = { query : e , bindVars : i } , h = { query : f , bindVars : i } , window . progressView . show ( ) , $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / cursor " ) , data : JSON . stringify ( g ) , contentType : " application / json " , success : function ( ) { $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / cursor " ) , data : JSON . stringify ( h ) , contentType : " application / json " , success : function ( ) { d & & d ( ) , window . progressView . hide ( ) } , error : function ( ) { window . progressView . hide ( ) , arangoHelper . arangoError ( " Document error " , " Documents inserted , but could not be removed . " ) } } ) } , error : function ( ) { window . progressView . hide ( ) , arangoHelper . arangoError ( " Document error " , " Could not move selected documents . " ) } } ) } , getDocuments : function ( a ) { var b , c , d , e , f = this ; c = { " @ collection " : this . collectionID , offset : this . getOffset ( ) , count : this . getPageSize ( ) } , b = " FOR x IN @ @ collection LET att = SLICE ( ATTRIBUTES ( x ) , 0 , 25 ) " , b + = this . setFiltersForQuery ( c ) , this . getTotal ( ) < this . MAX_SORT & & ( " _key " = = = this . getSort ( ) ? b + = " SORT TO_NUMBER ( x . " + this . getSort ( ) + " ) = = 0 ? x . " + this . getSort ( ) + " : TO_NUMBER ( x . " + this . getSort ( ) + " ) " : " " ! = = this . getSort ( ) & & ( b + = " SORT x . " + this . getSort ( ) ) ) , " all " ! = = c . count ? b + = " LIMIT @ offset , @ count RETURN KEEP ( x , att ) " : ( d = { " @ collection " : this . collectionID } , c = d , b + = " RETURN KEEP ( x , att ) " ) , e = { query : b , bindVars : c } ; var g = function ( b ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / job / " + encodeURIComponent ( b ) ) , contentType : " application / json " , success : function ( c , d , h ) { 201 = = = h . status ? ( window . progressView . toShow = ! 1 , f . clearDocuments ( ) , c . extra & & void 0 ! = = c . extra . stats . fullCount & & f . setTotal ( c . extra . stats . fullCount ) , 0 ! = = f . getTotal ( ) & & _ . each ( c . result , function ( a ) { f . add ( { id : a . _id , rev : a . _rev , key : a . _key , content : a } ) } ) , f . lastQuery = e , a ( ! 1 , c ) ) : 204 = = = h . status & & ( f . checkCursorTimer = window . setTimeout ( function ( ) { g ( b ) } , 500 ) ) } , error : function ( b ) { a ( ! 1 , b ) } } ) } ; $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / cursor " ) , data : JSON . stringify ( e ) , headers : { " x - arango - async " : " store " } , contentType : " application / json " , success : function ( b , c , d ) { if ( d . getResponseHeader ( " x - arango - async - id " ) ) { var e = d . getResponseHeader ( " x - arango - async - id " ) , h = function ( ) { $ . ajax ( { url : arangoHelper . databaseUrl ( " / _api / job / " + encodeURIComponent ( e ) + " / cancel " ) , type : " PUT " , success : function ( ) { window . clearTimeout ( f . checkCursorTimer ) , arangoHelper . arangoNotification ( " Documents " , " Canceled operation . " ) , $ ( " . dataTables_empty " ) . text ( " Canceled . " ) , window . progressView . hide ( ) } } ) } ; window . progressView . showWithDelay ( 300 , " Fetching documents . . . " , h ) , g ( e ) } else a ( ! 0 , b ) } , error : function ( b ) { a ( ! 1 , b ) } } ) } , clearDocuments : function ( ) { this . reset ( ) } , buildDownloadDocumentQuery : function ( ) { var a , b , c ; return c = { " @ collection " : this . collectionID } , a = " FOR x in @ @ collection " , a + = this . setFiltersForQuery ( c ) , this . getTotal ( ) < this . MAX_SORT & & this . getSort ( ) . length > 0 & & ( a + = " SORT x . " + this . getSort ( ) ) , a + = " RETURN x " , b = { query : a , bindVars : c } } , uploadDocuments : function ( a , b ) { $ . ajax ( { type : " POST " , url : arangoHelper . databaseUrl ( " / _api / import ? type = auto & collection = " + encodeURIComponent ( this . collectionID ) + " & createCollection = false " ) , data : a , processData : ! 1 , contentType : " json " , dataType : " json " , complete : function ( a ) { if ( 4 = = = a . readyState & & 201 = = = a . status ) b ( ! 1 ) ; else try { var c = JSON . parse ( a . responseText ) ; if ( c . errors > 0 ) { var d = " At least one error occurred during upload " ; b ( ! 1 , d ) } } catch ( e ) { console . log ( e ) } } } ) } } ) } ( ) , function ( ) { " use strict " ; window . ArangoLogs = window . PaginatedCollection . extend ( { upto : ! 1 , loglevel : 0 , totalPages : 0 , parse : function ( a ) { var b = [ ] ; return _ . each ( a . lid , function ( c , d ) { b . push ( { level : a . level [ d ] , lid : c , text : a . text [ d ] , timestamp : a . timestamp [ d ] , totalAmount : a . totalAmount } ) } ) , this . totalAmount = a . totalAmount , this . totalPages = Math . ceil ( this . totalAmount / this . pagesize ) , b } , initialize : function ( a ) { a . upto = = = ! 0 & & ( this . upto = ! 0 ) , this . loglevel = a . loglevel } , model : window . newArangoLog , url : function ( ) { var a , b , c , d = this . totalAmount - ( this . page + 1 ) * this . pagesize ; return 0 > d & & this . page = = = this . totalPages - 1 ? ( d = 0 , c = this . totalAmount % this . pagesize ) : c = this . pagesize , 0 = = = this . totalAmount & & ( c = 1 ) , a = this . upto ? " upto " : " level " , b = " / _admin / log ? " + a + " = " + this . loglevel + " & size = " + c + " & offset = " + d , arangoHelper . databaseUrl ( b ) } } ) } ( ) , function ( ) { " use strict " ; window . ArangoQueries = Backbone . Collection . extend ( { initialize : function ( a , b ) { var c = this ; $ . ajax ( " whoAmI ? _ = " + Date . now ( ) , { async : ! 0 } ) . done ( function ( a ) { this . activeUser = = = ! 1 | | null = = = this . activeUser ? c . activeUser = " root " : c . activeUser = a . user } ) } , url : arangoHelper . databaseUrl ( " / _api / user / " ) , model : ArangoQuery , activeUser : null , parse : function ( a ) { var b , c = this ; return this . activeUser ! = = ! 1 & & null ! = = this . activeUser | | ( this . activeUser = " root " ) , _ . each ( a . result , function ( a ) { if ( a . user = = = c . activeUser ) try { a . extra . queries & & ( b = a . extra . queries ) } catch ( d ) { } } ) , b } , saveCollectionQueries : function ( a ) { if ( this . activeUser = = = ! 1 | | null = = = this . activeUser ) return ! 1 ; this . activeUser ! = = ! 1 & & null ! = = this . activeUser | | ( this . activeUser = " root " ) ; var b = [ ] ; this . each ( function ( a ) { b . push ( { value : a . attributes . value , parameter : a . attributes . parameter , name : a . attributes . name } ) } ) , $ . ajax ( { cache : ! 1 , type : " PATCH " , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( this . activeUser ) ) , data : JSON . stringify ( { extra : { queries : b } } ) , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b ) } , error : function ( ) { a ( ! 0 ) } } ) } , saveImportQueries : function ( a , b ) { return 0 = = = this . activeUser ? ! 1 : ( window . progressView . show ( " Fetching documents . . . " ) , void $ . ajax ( { cache : ! 1 , type : " POST " , url : " query / upload / " + encodeURIComponent ( this . activeUser ) , data : a , contentType : " application / json " , processData : ! 1 , success : function ( ) { window . progressView . hide ( ) , arangoHelper . arangoNotification ( " Queries successfully imported . " ) , b ( ) } , error : function ( ) { window . progressView . hide ( ) , arangoHelper . arangoError ( " Query error " , " queries could not be imported " ) } } ) ) } } ) } ( ) , window . ArangoReplication = Backbone . Collection . extend ( { model : window . Replication , url : " . . / api / user " , getLogState : function ( a ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / replication / logger - state " ) , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b ) } , error : function ( b ) { a ( ! 0 , b ) } } ) } , getApplyState : function ( a ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / replication / applier - state " ) , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b ) } , error : function ( b ) { a ( ! 0 , b ) } } ) } } ) , window . StatisticsCollection = Backbone . Collection . extend ( { model : window . Statistics , url : " / _admin / statistics " } ) , window . StatisticsDescriptionCollection = Backbone . Collection . extend ( { model : window . StatisticsDescription , url : " / _admin / statistics - description " , parse : function ( a ) { return a } } ) , window . ArangoUsers = Backbone . Collection . extend ( { model : window . Users , activeUser : null , activeUserSettings : { query : { } , shell : { } , testing : ! 0 } , sortOptions : { desc : ! 1 } , fetch : function ( a ) { return window . App . currentUser & & " _system " ! = = window . App . currentDB . get ( " name " ) & & ( this . url = frontendConfig . basePath + " / _api / user / " + encodeURIComponent ( window . App . currentUser ) ) , Backbone . Collection . prototype . fetch . call ( this , a ) } , url : frontendConfig . basePath + " / _api / user " , comparator : function ( a , b ) { var c = a . get ( " user " ) . toLowerCase ( ) , d = b . get ( " user " ) . toLowerCase ( ) ; return this . sortOptions . desc = = = ! 0 ? d > c ? 1 : c > d ? - 1 : 0 : c > d ? 1 : d > c ? - 1 : 0 } , login : function ( a , b , c ) { var d = this ; $ . ajax ( { url : arangoHelper . databaseUrl ( " / _open / auth " ) , method : " POST " , data : JSON . stringify ( { username : a , password : b } ) , dataType : " json " } ) . success ( function ( a ) { arangoHelper . setCurrentJwt ( a . jwt ) ; var b = a . jwt . split ( " . " ) ; if ( ! b [ 1 ] ) throw new Error ( " Invalid JWT " ) ; if ( ! window . atob ) throw new Error ( " base64 support missing in browser " ) ; var e = JSON . parse ( atob ( b [ 1 ] ) ) ; d . activeUser = e . preferred_username , c ( ! 1 , d . activeUser ) } ) . error ( function ( ) { arangoHelper . setCurrentJwt ( null ) , d . activeUser = null , c ( ! 0 , null ) } ) } , setSortingDesc : function ( a ) { this . sortOptions . desc = a } , logout : function ( ) { arangoHelper . setCurrentJwt ( null ) , this . activeUser = null , this . reset ( ) , window . App . navigate ( " " ) , window . location . reload ( ) } , setUserSettings : function ( a , b ) { this . activeUserSettings . identifier = b } , loadUserSettings : function ( a ) { var b = this ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( b . activeUser ) ) , contentType : " application / json " , processData : ! 1 , success : function ( c ) { b . activeUserSettings = c . extra , a ( ! 1 , c ) } , error : function ( b ) { a ( ! 0 , b ) } } ) } , saveUserSettings : function ( a ) { var b = this ; $ . ajax ( { cache : ! 1 , type : " PUT " , url : frontendConfig . basePath + " / _api / user / " + encodeURIComponent ( b . activeUser ) , data : JSON . stringify ( { extra : b . activeUserSettings } ) , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b ) } , error : function ( b ) { a ( ! 0 , b ) } } ) } , parse : function ( a ) { var b = [ ] ; return a . result ? _ . each ( a . result , function ( a ) { b . push ( a ) } ) : b . push ( { user : a . user , active : a . active , extra : a . extra , changePassword : a . changePassword } ) , b } , whoAmI : function ( a ) { return this . activeUser ? void a ( ! 1 , this . activeUser ) : void $ . ajax ( " whoAmI ? _ = " + Date . now ( ) ) . success ( function ( b ) { a ( ! 1 , b . user ) } ) . error ( function ( ) { a ( ! 0 , null ) } ) } } ) , function ( ) { " use strict " ; window . ClusterCoordinators = window . AutomaticRetryCollection . extend ( { model : window . ClusterCoordinator , url : arangoHelper . databaseUrl ( " / _admin / aardvark / cluster / Coordinators " ) , updateUrl : function ( ) { this . url = window . App . getNewRoute ( " Coordinators " ) } , initialize : function ( ) { } , statusClass : function ( a ) { switch ( a ) { case " ok " : return " success " ; case " warning " : return " warning " ; case " critical " : return " danger " ; case " missing " : return " inactive " ; default : return " danger " } } , getStatuses : function ( a , b ) { if ( this . checkRetries ( ) ) { var c = this ; this . fetch ( { beforeSend : window . App . addAuth . bind ( window . App ) , error : c . failureTry . bind ( c , c . getStatuses . bind ( c , a , b ) ) } ) . done ( function ( ) { c . successFullTry ( ) , c . forEach ( function ( b ) { a ( c . statusClass ( b . get ( " status " ) ) , b . get ( " address " ) ) } ) , b ( ) } ) } } , byAddress : function ( a , b ) { if ( this . checkRetries ( ) ) { var c = this ; this . fetch ( { beforeSend : window . App . addAuth . bind ( window . App ) , error : c . failureTry . bind ( c , c . byAddress . bind ( c , a , b ) ) } ) . done ( function ( ) { c . successFullTry ( ) , a = a | | { } , c . forEach ( function ( b ) { var c = b . get ( " address " ) ; c = c . split ( " : " ) [ 0 ] , a [ c ] = a [ c ] | | { } , a [ c ] . coords = a [ c ] . coords | | [ ] , a [ c ] . coords . push ( b ) } ) , b ( a ) } ) } } , checkConnection : function ( a ) { var b = this ; this . checkRetries ( ) & & this . fetch ( { beforeSend : window . App . addAuth . bind ( window . App ) , error : b . failureTry . bind ( b , b . checkConnection . bind ( b , a ) ) } ) . done ( function ( ) { b . successFullTry ( ) , a ( ) } ) } } ) } ( ) , function ( ) { " use strict " ; window . ClusterServers = window . AutomaticRetryCollection . extend ( { model : window . ClusterServer , host : " " , url : arangoHelper . databaseUrl ( " / _admin / aardvark / cluster / DBServers " ) , updateUrl : function ( ) { this . url = window . App . getNewRoute ( this . host ) + this . url } , initialize : function ( a , b ) { this . host = b . host } , statusClass : function ( a ) { switch ( a ) { case " ok " : return " success " ; case " warning " : return " warning " ; case " critical " : return " danger " ; case " missing " : return " inactive " ; default : return " danger " } } , getStatuses : function ( a ) { if ( this . checkRetries ( ) ) { var b = this , c = function ( ) { b . successFullTry ( ) , b . _retryCount = 0 , b . forEach ( function ( c ) { a ( b . statusClass ( c . get ( " status " ) ) , c . get ( " address " ) ) } ) } ; this . fetch ( { beforeSend : window . App . addAuth . bind ( window . App ) , error : b . failureTry . bind ( b , b . getStatuses . bind ( b , a ) ) } ) . done ( c ) } } , byAddress : function ( a , b ) { if ( this . checkRetries ( ) ) { var c = this ; this . fetch ( { beforeSend : window . App . addAuth . bind ( window . App ) , error : c . failureTry . bind ( c , c . byAddress . bind ( c , a , b ) ) } ) . done ( function ( ) { c . successFullTry ( ) , a = a | | { } , c . forEach ( function ( b ) { var c = b . get ( " address " ) ; c = c . split ( " : " ) [ 0 ] , a [ c ] = a [ c ] | | { } , a [ c ] . dbs = a [ c ] . dbs | | [ ] , a [ c ] . dbs . push ( b ) } ) , b ( a ) } ) . error ( function ( a ) { console . log ( " error " ) , console . log ( a ) } ) } } , getList : function ( ) { throw new Error ( " Do not use " ) } , getOverview : function ( ) { throw new Error ( " Do not use DbServer . getOverview " ) } } ) } ( ) , function ( ) { " use strict " ; window . CoordinatorCollection = Backbone . Collection . extend ( { model : window . Coordinator , url : arangoHelper . databaseUrl ( " / _admin / aardvark / cluster / Coordinators " ) } ) } ( ) , function ( ) { " use strict " ; window . FoxxCollection = Backbone . Collection . extend ( { <nl> - model : window . Foxx , sortOptions : { desc : ! 1 } , url : arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes " ) , comparator : function ( a , b ) { var c , d ; return this . sortOptions . desc = = = ! 0 ? ( c = a . get ( " mount " ) , d = b . get ( " mount " ) , d > c ? 1 : c > d ? - 1 : 0 ) : ( c = a . get ( " mount " ) , d = b . get ( " mount " ) , c > d ? 1 : d > c ? - 1 : 0 ) } , setSortingDesc : function ( a ) { this . sortOptions . desc = a } , installFromGithub : function ( a , b , c , d ) { var e = arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes / git ? mount = " + encodeURIComponent ( b ) ) ; void 0 ! = = d & & ( e + = d ? " & replace = true " : " & upgrade = true " ) , $ . ajax ( { cache : ! 1 , type : " PUT " , url : e , data : JSON . stringify ( a ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { c ( a ) } , error : function ( a ) { c ( a ) } } ) } , installFromStore : function ( a , b , c , d ) { var e = arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes / store ? mount = " + encodeURIComponent ( b ) ) ; void 0 ! = = d & & ( e + = d ? " & replace = true " : " & upgrade = true " ) , $ . ajax ( { cache : ! 1 , type : " PUT " , url : e , data : JSON . stringify ( a ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { c ( a ) } , error : function ( a ) { c ( a ) } } ) } , installFromZip : function ( a , b , c , d ) { var e = arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes / zip ? mount = " + encodeURIComponent ( b ) ) ; void 0 ! = = d & & ( e + = d ? " & replace = true " : " & upgrade = true " ) , $ . ajax ( { cache : ! 1 , type : " PUT " , url : e , data : JSON . stringify ( { zipFile : a } ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { c ( a ) } , error : function ( a ) { c ( a ) } } ) } , generate : function ( a , b , c , d ) { var e = arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes / generate ? mount = " + encodeURIComponent ( b ) ) ; void 0 ! = = d & & ( e + = d ? " & replace = true " : " & upgrade = true " ) , $ . ajax ( { cache : ! 1 , type : " PUT " , url : e , data : JSON . stringify ( a ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { c ( a ) } , error : function ( a ) { c ( a ) } } ) } } ) } ( ) , function ( ) { " use strict " ; window . GraphCollection = Backbone . Collection . extend ( { model : window . Graph , sortOptions : { desc : ! 1 } , url : arangoHelper . databaseUrl ( " / _api / gharial " ) , dropAndDeleteGraph : function ( a , b ) { $ . ajax ( { type : " DELETE " , url : arangoHelper . databaseUrl ( " / _api / gharial / " ) + encodeURIComponent ( a ) + " ? dropCollections = true " , contentType : " application / json " , processData : ! 0 , success : function ( ) { b ( ! 0 ) } , error : function ( ) { b ( ! 1 ) } } ) } , comparator : function ( a , b ) { var c = a . get ( " _key " ) | | " " , d = b . get ( " _key " ) | | " " ; return c = c . toLowerCase ( ) , d = d . toLowerCase ( ) , this . sortOptions . desc = = = ! 0 ? d > c ? 1 : c > d ? - 1 : 0 : c > d ? 1 : d > c ? - 1 : 0 } , setSortingDesc : function ( a ) { this . sortOptions . desc = a } , parse : function ( a ) { return a . error ? void 0 : a . graphs } } ) } ( ) , function ( ) { " use strict " ; window . NotificationCollection = Backbone . Collection . extend ( { model : window . Notification , url : " " } ) } ( ) , function ( ) { " use strict " ; window . QueryManagementActive = Backbone . Collection . extend ( { model : window . queryManagementModel , url : function ( ) { return frontendConfig . basePath + " / _api / query / current " } , killRunningQuery : function ( a , b ) { $ . ajax ( { url : frontendConfig . basePath + " / _api / query / " + encodeURIComponent ( a ) , type : " DELETE " , success : function ( a ) { b ( ) } } ) } } ) } ( ) , function ( ) { " use strict " ; window . QueryManagementSlow = Backbone . Collection . extend ( { model : window . queryManagementModel , url : " / _api / query / slow " , deleteSlowQueryHistory : function ( a ) { var b = this ; $ . ajax ( { url : b . url , type : " DELETE " , success : function ( b ) { a ( ) } } ) } } ) } ( ) , function ( ) { " use strict " ; window . WorkMonitorCollection = Backbone . Collection . extend ( { model : window . workMonitorModel , url : " / _admin / work - monitor " , parse : function ( a ) { return a . work } } ) } ( ) , function ( ) { " use strict " ; window . PaginationView = Backbone . View . extend ( { collection : null , paginationDiv : " " , idPrefix : " " , rerender : function ( ) { } , jumpTo : function ( a ) { this . collection . setPage ( a ) , this . rerender ( ) } , firstPage : function ( ) { this . jumpTo ( 1 ) } , lastPage : function ( ) { this . jumpTo ( this . collection . getLastPageNumber ( ) ) } , firstDocuments : function ( ) { this . jumpTo ( 1 ) } , lastDocuments : function ( ) { this . jumpTo ( this . collection . getLastPageNumber ( ) ) } , prevDocuments : function ( ) { this . jumpTo ( this . collection . getPage ( ) - 1 ) } , nextDocuments : function ( ) { this . jumpTo ( this . collection . getPage ( ) + 1 ) } , renderPagination : function ( ) { $ ( this . paginationDiv ) . html ( " " ) ; var a = this , b = this . collection . getPage ( ) , c = this . collection . getLastPageNumber ( ) , d = $ ( this . paginationDiv ) , e = { page : b , lastPage : c , click : function ( b ) { var c = window . location . hash . split ( " / " ) ; " documents " = = = c [ 2 ] ? ( e . page = b , window . location . hash = c [ 0 ] + " / " + c [ 1 ] + " / " + c [ 2 ] + " / " + b ) : ( a . jumpTo ( b ) , e . page = b ) } } ; d . html ( " " ) , d . pagination ( e ) , $ ( this . paginationDiv ) . prepend ( ' < ul class = " pre - pagi " > < li > < a id = " ' + this . idPrefix + ' _first " class = " pagination - button " > < span > < i class = " fa fa - angle - double - left " / > < / span > < / a > < / li > < / ul > ' ) , $ ( this . paginationDiv ) . append ( ' < ul class = " las - pagi " > < li > < a id = " ' + this . idPrefix + ' _last " class = " pagination - button " > < span > < i class = " fa fa - angle - double - right " / > < / span > < / a > < / li > < / ul > ' ) } } ) } ( ) , function ( ) { " use strict " ; window . ApplicationDetailView = Backbone . View . extend ( { el : " # content " , divs : [ " # readme " , " # swagger " , " # app - info " , " # sideinformation " , " # information " , " # settings " ] , navs : [ " # service - info " , " # service - api " , " # service - readme " , " # service - settings " ] , template : templateEngine . createTemplate ( " applicationDetailView . ejs " ) , events : { " click . open " : " openApp " , " click . delete " : " deleteApp " , " click # app - deps " : " showDepsDialog " , " click # app - switch - mode " : " toggleDevelopment " , " click # app - scripts [ data - script ] " : " runScript " , " click # app - tests " : " runTests " , " click # app - replace " : " replaceApp " , " click # download - app " : " downloadApp " , " click . subMenuEntries li " : " changeSubview " , " click # jsonLink " : " toggleSwagger " , " mouseenter # app - scripts " : " showDropdown " , " mouseleave # app - scripts " : " hideDropdown " } , resize : function ( a ) { a ? $ ( " . innerContent " ) . css ( " height " , " auto " ) : ( $ ( " . innerContent " ) . height ( $ ( " . centralRow " ) . height ( ) - 150 ) , $ ( " # swagger iframe " ) . height ( $ ( " . centralRow " ) . height ( ) - 150 ) , $ ( " # swagger # swaggerJsonContent " ) . height ( $ ( " . centralRow " ) . height ( ) - 150 ) ) } , toggleSwagger : function ( ) { var a = function ( a ) { $ ( " # jsonLink " ) . html ( " JSON " ) , this . jsonEditor . setValue ( JSON . stringify ( a , null , " " ) , 1 ) , $ ( " # swaggerJsonContent " ) . show ( ) , $ ( " # swagger iframe " ) . hide ( ) } . bind ( this ) ; if ( " Swagger " = = = $ ( " # jsonLink " ) . html ( ) ) { var b = arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes / docs / swagger . json ? mount = " + encodeURIComponent ( this . model . get ( " mount " ) ) ) ; arangoHelper . download ( b , a ) } else $ ( " # swaggerJsonContent " ) . hide ( ) , $ ( " # swagger iframe " ) . show ( ) , $ ( " # jsonLink " ) . html ( " Swagger " ) } , changeSubview : function ( a ) { _ . each ( this . navs , function ( a ) { $ ( a ) . removeClass ( " active " ) } ) , $ ( a . currentTarget ) . addClass ( " active " ) , _ . each ( this . divs , function ( a ) { $ ( " . headerButtonBar " ) . hide ( ) , $ ( a ) . hide ( ) } ) , " service - readme " = = = a . currentTarget . id ? ( this . resize ( ! 0 ) , $ ( " # readme " ) . show ( ) ) : " service - api " = = = a . currentTarget . id ? ( this . resize ( ) , $ ( " # swagger " ) . show ( ) ) : " service - info " = = = a . currentTarget . id ? ( this . resize ( ! 0 ) , this . render ( ) , $ ( " # information " ) . show ( ) , $ ( " # sideinformation " ) . show ( ) ) : " service - settings " = = = a . currentTarget . id & & ( this . resize ( ! 0 ) , this . showConfigDialog ( ) , $ ( " . headerButtonBar " ) . show ( ) , $ ( " # settings " ) . show ( ) ) } , downloadApp : function ( ) { this . model . isSystem ( ) | | this . model . download ( ) } , replaceApp : function ( ) { var a = this . model . get ( " mount " ) ; window . foxxInstallView . upgrade ( a , function ( ) { window . App . applicationDetail ( encodeURIComponent ( a ) ) } ) , $ ( " . createModalDialog . arangoHeader " ) . html ( " Replace Service " ) , $ ( " # infoTab " ) . click ( ) } , updateConfig : function ( ) { this . model . getConfiguration ( function ( ) { $ ( " # app - warning " ) [ this . model . needsAttention ( ) ? " show " : " hide " ] ( ) , $ ( " # app - warning - config " ) [ this . model . needsConfiguration ( ) ? " show " : " hide " ] ( ) , this . model . needsConfiguration ( ) ? $ ( " # app - config " ) . addClass ( " error " ) : $ ( " # app - config " ) . removeClass ( " error " ) } . bind ( this ) ) } , updateDeps : function ( ) { this . model . getDependencies ( function ( ) { $ ( " # app - warning " ) [ this . model . needsAttention ( ) ? " show " : " hide " ] ( ) , $ ( " # app - warning - deps " ) [ this . model . hasUnconfiguredDependencies ( ) ? " show " : " hide " ] ( ) , this . model . hasUnconfiguredDependencies ( ) ? $ ( " # app - deps " ) . addClass ( " error " ) : $ ( " # app - deps " ) . removeClass ( " error " ) } . bind ( this ) ) } , toggleDevelopment : function ( ) { this . model . toggleDevelopment ( ! this . model . isDevelopment ( ) , function ( ) { this . model . isDevelopment ( ) ? ( $ ( " . app - switch - mode " ) . text ( " Set Production " ) , $ ( " # app - development - indicator " ) . css ( " display " , " inline " ) , $ ( " # app - development - path " ) . css ( " display " , " inline " ) ) : ( $ ( " . app - switch - mode " ) . text ( " Set Development " ) , $ ( " # app - development - indicator " ) . css ( " display " , " none " ) , $ ( " # app - development - path " ) . css ( " display " , " none " ) ) } . bind ( this ) ) } , runScript : function ( a ) { a . preventDefault ( ) ; var b = $ ( a . currentTarget ) . attr ( " data - script " ) , c = [ window . modalView . createBlobEntry ( " app_script_arguments " , " Script arguments " , " " , null , " optional " , ! 1 , [ { rule : function ( a ) { return a & & JSON . parse ( a ) } , msg : " Must be well - formed JSON or empty " } ] ) ] , d = [ window . modalView . createSuccessButton ( " Run script " , function ( ) { var a = $ ( " # app_script_arguments " ) . val ( ) ; a = a & & JSON . parse ( a ) , window . modalView . hide ( ) , this . model . runScript ( b , a , function ( a , c ) { var d ; d = a ? " < p > The script failed with an error " + ( a . statusCode ? " ( HTTP " + a . statusCode + " ) " : " " ) + " : < / p > < pre > " + a . message + " < / pre > " : c ? " < p > Script results : < / p > < pre > " + JSON . stringify ( c , null , 2 ) + " < / pre > " : " < p > The script ran successfully . < / p > " , window . modalView . show ( " modalTable . ejs " , ' Result of script " ' + b + ' " ' , void 0 , void 0 , void 0 , d ) } ) } . bind ( this ) ) ] ; window . modalView . show ( " modalTable . ejs " , ' Run script " ' + b + ' " on " ' + this . model . get ( " mount " ) + ' " ' , d , c ) } , showSwagger : function ( a ) { a . preventDefault ( ) , this . render ( " swagger " ) } , showReadme : function ( a ) { a . preventDefault ( ) , this . render ( " readme " ) } , runTests : function ( a ) { a . preventDefault ( ) ; var b = " < p > < strong > WARNING : < / strong > Running tests may result in destructive side - effects including data loss . Please make sure not to run tests on a production database . < / p > " ; this . model . isDevelopment ( ) & & ( b + = " < p > < strong > WARNING : < / strong > This app is running in < strong > development mode < / strong > . If any of the tests access the app ' s HTTP API they may become non - deterministic . < / p > " ) ; var c = [ window . modalView . createSuccessButton ( " Run tests " , function ( ) { window . modalView . hide ( ) , this . model . runTests ( { reporter : " suite " } , function ( a , b ) { window . modalView . show ( " modalTestResults . ejs " , " Test results " , void 0 , void 0 , void 0 , a | | b ) } ) } . bind ( this ) ) ] ; window . modalView . show ( " modalTable . ejs " , ' Run tests for app " ' + this . model . get ( " mount " ) + ' " ' , c , void 0 , void 0 , b ) } , render : function ( a ) { return this . resize ( ) , this . model . fetchThumbnail ( function ( ) { var b = function ( b , c ) { var d = this ; b ? arangoHelper . arangoError ( " DB " , " Could not get current database " ) : ( $ ( this . el ) . html ( this . template . render ( { app : this . model , baseUrl : arangoHelper . databaseUrl ( " " , c ) , mode : a } ) ) , d . jsonEditor = ace . edit ( " swaggerJsonEditor " ) , d . jsonEditor . setReadOnly ( ! 0 ) , d . jsonEditor . getSession ( ) . setMode ( " ace / mode / json " ) , $ . get ( this . appUrl ( c ) ) . success ( function ( ) { $ ( " . open " , this . el ) . prop ( " disabled " , ! 1 ) } . bind ( this ) ) , this . updateConfig ( ) , this . updateDeps ( ) , " swagger " = = = a & & $ . get ( " . / foxxes / docs / swagger . json ? mount = " + encodeURIComponent ( this . model . get ( " mount " ) ) , function ( a ) { Object . keys ( a . paths ) . length < 1 & & ( d . render ( " readme " ) , $ ( " # app - show - swagger " ) . attr ( " disabled " , " true " ) ) } ) ) , this . breadcrumb ( ) } . bind ( this ) ; arangoHelper . currentDatabase ( b ) , _ . isEmpty ( this . model . get ( " config " ) ) & & $ ( " # service - settings " ) . attr ( " disabled " , ! 0 ) } . bind ( this ) ) , $ ( this . el ) } , breadcrumb : function ( ) { var a = " Service : " + this . model . get ( " name " ) + ' < i class = " fa fa - ellipsis - v " aria - hidden = " true " > < / i > ' , b = ' < p class = " mount " > < span > Contributors : < / span > ' ; this . model . get ( " contributors " ) & & this . model . get ( " contributors " ) . length > 0 ? _ . each ( this . model . get ( " contributors " ) , function ( a ) { b + = ' < a href = " mailto : ' + a . email + ' " > ' + a . name + " < / a > " } ) : b + = " No contributors " , b + = " < / p > " , $ ( " . information " ) . append ( b ) , this . model . get ( " author " ) & & $ ( " . information " ) . append ( ' < p class = " mount " > < span > Author : < / span > ' + this . model . get ( " author " ) + " < / p > " ) , this . model . get ( " mount " ) & & $ ( " . information " ) . append ( ' < p class = " mount " > < span > Mount : < / span > ' + this . model . get ( " mount " ) + " < / p > " ) , this . model . get ( " development " ) & & this . model . get ( " path " ) & & $ ( " . information " ) . append ( ' < p class = " path " > < span > Path : < / span > ' + this . model . get ( " path " ) + " < / p > " ) , $ ( " # subNavigationBar . breadcrumb " ) . html ( a ) } , openApp : function ( ) { var a = function ( a , b ) { a ? arangoHelper . arangoError ( " DB " , " Could not get current database " ) : window . open ( this . appUrl ( b ) , this . model . get ( " title " ) ) . focus ( ) } . bind ( this ) ; arangoHelper . currentDatabase ( a ) } , deleteApp : function ( ) { var a = [ window . modalView . createDeleteButton ( " Delete " , function ( ) { var a = { teardown : $ ( " # app_delete_run_teardown " ) . is ( " : checked " ) } ; this . model . destroy ( a , function ( a , b ) { a | | b . error ! = = ! 1 | | ( window . modalView . hide ( ) , window . App . navigate ( " services " , { trigger : ! 0 } ) ) } ) } . bind ( this ) ) ] , b = [ window . modalView . createCheckboxEntry ( " app_delete_run_teardown " , " Run teardown ? " , ! 0 , " Should this app ' s teardown script be executed before removing the app ? " , ! 0 ) ] ; window . modalView . show ( " modalTable . ejs " , ' Delete Foxx App mounted at " ' + this . model . get ( " mount " ) + ' " ' , a , b , void 0 , " < p > Are you sure ? There is no way back . . . < / p > " , ! 0 ) } , appUrl : function ( a ) { return arangoHelper . databaseUrl ( this . model . get ( " mount " ) , a ) } , applyConfig : function ( ) { var a = { } ; _ . each ( this . model . get ( " config " ) , function ( b , c ) { var d = $ ( " # app_config_ " + c ) , e = d . val ( ) ; if ( " boolean " = = = b . type | | " bool " = = = b . type ) return void ( a [ c ] = d . is ( " : checked " ) ) ; if ( " " = = = e & & b . hasOwnProperty ( " default " ) ) return a [ c ] = b [ " default " ] , void ( " json " = = = b . type & & ( a [ c ] = JSON . stringify ( b [ " default " ] ) ) ) ; if ( " number " = = = b . type ) a [ c ] = parseFloat ( e ) ; else if ( " integer " = = = b . type | | " int " = = = b . type ) a [ c ] = parseInt ( e , 10 ) ; else { if ( " json " ! = = b . type ) return void ( a [ c ] = window . arangoHelper . escapeHtml ( e ) ) ; a [ c ] = e & & JSON . stringify ( JSON . parse ( e ) ) } } ) , this . model . setConfiguration ( a , function ( ) { this . updateConfig ( ) , arangoHelper . arangoNotification ( this . model . get ( " name " ) , " Settings applied . " ) } . bind ( this ) ) } , showConfigDialog : function ( ) { if ( _ . isEmpty ( this . model . get ( " config " ) ) ) return void $ ( " # settings . buttons " ) . html ( $ ( " # hidden_buttons " ) . html ( ) ) ; var a = _ . map ( this . model . get ( " config " ) , function ( a , b ) { var c = void 0 = = = a [ " default " ] ? " " : String ( a [ " default " ] ) , d = void 0 = = = a . current ? " " : String ( a . current ) , e = " createTextEntry " , f = ! 1 , g = [ ] ; return " boolean " = = = a . type | | " bool " = = = a . type ? ( e = " createCheckboxEntry " , a [ " default " ] = a [ " default " ] | | ! 1 , c = a [ " default " ] | | ! 1 , d = a . current | | ! 1 ) : " json " = = = a . type ? ( e = " createBlobEntry " , c = void 0 = = = a [ " default " ] ? " " : JSON . stringify ( a [ " default " ] ) , d = void 0 = = = a . current ? " " : a . current , g . push ( { rule : function ( a ) { return a & & JSON . parse ( a ) } , msg : " Must be well - formed JSON or empty . " } ) ) : " integer " = = = a . type | | " int " = = = a . type ? g . push ( { rule : Joi . number ( ) . integer ( ) . optional ( ) . allow ( " " ) , msg : " Has to be an integer . " } ) : " number " = = = a . type ? g . push ( { rule : Joi . number ( ) . optional ( ) . allow ( " " ) , msg : " Has to be a number . " } ) : ( " password " = = = a . type & & ( e = " createPasswordEntry " ) , g . push ( { rule : Joi . string ( ) . optional ( ) . allow ( " " ) , msg : " Has to be a string . " } ) ) , void 0 = = = a [ " default " ] & & a . required ! = = ! 1 & & ( f = ! 0 , g . unshift ( { rule : Joi . any ( ) . required ( ) , msg : " This field is required . " } ) ) , window . modalView [ e ] ( " app_config_ " + b , b , d , a . description , c , f , g ) } ) , b = [ window . modalView . createSuccessButton ( " Apply " , this . applyConfig . bind ( this ) ) ] ; window . modalView . show ( " modalTable . ejs " , " Configuration " , b , a , null , null , null , null , null , " settings " ) , $ ( " . modal - footer " ) . prepend ( $ ( " # hidden_buttons " ) . html ( ) ) } , applyDeps : function ( ) { var a = { } ; _ . each ( this . model . get ( " deps " ) , function ( b , c ) { var d = $ ( " # app_deps_ " + c ) ; a [ c ] = window . arangoHelper . escapeHtml ( d . val ( ) ) } ) , this . model . setDependencies ( a , function ( ) { window . modalView . hide ( ) , this . updateDeps ( ) } . bind ( this ) ) } , showDepsDialog : function ( ) { if ( ! _ . isEmpty ( this . model . get ( " deps " ) ) ) { var a = _ . map ( this . model . get ( " deps " ) , function ( a , b ) { var c = void 0 = = = a . current ? " " : String ( a . current ) , d = " " , e = a . definition . name ; " * " ! = = a . definition . version & & ( e + = " @ " + a . definition . version ) ; var f = [ { rule : Joi . string ( ) . optional ( ) . allow ( " " ) , msg : " Has to be a string . " } ] ; return a . definition . required & & f . push ( { rule : Joi . string ( ) . required ( ) , msg : " This value is required . " } ) , window . modalView . createTextEntry ( " app_deps_ " + b , a . title , c , e , d , a . definition . required , f ) } ) , b = [ window . modalView . createSuccessButton ( " Apply " , this . applyDeps . bind ( this ) ) ] ; window . modalView . show ( " modalTable . ejs " , " Dependencies " , b , a ) } } , showDropdown : function ( ) { _ . isEmpty ( this . model . get ( " scripts " ) ) | | $ ( " # scripts_dropdown " ) . show ( 200 ) } , hideDropdown : function ( ) { $ ( " # scripts_dropdown " ) . hide ( ) } } ) } ( ) , function ( ) { " use strict " ; window . ApplicationsView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " applicationsView . ejs " ) , events : { " click # addApp " : " createInstallModal " , " click # foxxToggle " : " slideToggle " , " click # checkDevel " : " toggleDevel " , " click # checkProduction " : " toggleProduction " , " click # checkSystem " : " toggleSystem " } , fixCheckboxes : function ( ) { this . _showDevel ? $ ( " # checkDevel " ) . attr ( " checked " , " checked " ) : $ ( " # checkDevel " ) . removeAttr ( " checked " ) , this . _showSystem ? $ ( " # checkSystem " ) . attr ( " checked " , " checked " ) : $ ( " # checkSystem " ) . removeAttr ( " checked " ) , this . _showProd ? $ ( " # checkProduction " ) . attr ( " checked " , " checked " ) : $ ( " # checkProduction " ) . removeAttr ( " checked " ) , $ ( " # checkDevel " ) . next ( ) . removeClass ( " fa fa - check - square - o fa - square - o " ) . addClass ( " fa " ) , $ ( " # checkSystem " ) . next ( ) . removeClass ( " fa fa - check - square - o fa - square - o " ) . addClass ( " fa " ) , $ ( " # checkProduction " ) . next ( ) . removeClass ( " fa fa - check - square - o fa - square - o " ) . addClass ( " fa " ) , arangoHelper . setCheckboxStatus ( " # foxxDropdown " ) } , toggleDevel : function ( ) { var a = this ; this . _showDevel = ! this . _showDevel , _ . each ( this . _installedSubViews , function ( b ) { b . toggle ( " devel " , a . _showDevel ) } ) , this . fixCheckboxes ( ) } , toggleProduction : function ( ) { var a = this ; this . _showProd = ! this . _showProd , _ . each ( this . _installedSubViews , function ( b ) { b . toggle ( " production " , a . _showProd ) } ) , this . fixCheckboxes ( ) } , toggleSystem : function ( ) { this . _showSystem = ! this . _showSystem ; var a = this ; _ . each ( this . _installedSubViews , function ( b ) { b . toggle ( " system " , a . _showSystem ) } ) , this . fixCheckboxes ( ) } , reload : function ( ) { var a = this ; _ . each ( this . _installedSubViews , function ( a ) { a . undelegateEvents ( ) } ) , this . collection . fetch ( { success : function ( ) { a . createSubViews ( ) , a . render ( ) } } ) } , createSubViews : function ( ) { var a = this ; this . _installedSubViews = { } , a . collection . each ( function ( b ) { var c = new window . FoxxActiveView ( { model : b , appsView : a } ) ; a . _installedSubViews [ b . get ( " mount " ) ] = c } ) } , initialize : function ( ) { this . _installedSubViews = { } , this . _showDevel = ! 0 , this . _showProd = ! 0 , this . _showSystem = ! 1 } , slideToggle : function ( ) { $ ( " # foxxToggle " ) . toggleClass ( " activated " ) , $ ( " # foxxDropdownOut " ) . slideToggle ( 200 ) } , createInstallModal : function ( a ) { a . preventDefault ( ) , window . foxxInstallView . install ( this . reload . bind ( this ) ) } , render : function ( ) { this . collection . sort ( ) , $ ( this . el ) . html ( this . template . render ( { } ) ) , _ . each ( this . _installedSubViews , function ( a ) { $ ( " # installedList " ) . append ( a . render ( ) ) } ) , this . delegateEvents ( ) , $ ( " # checkDevel " ) . attr ( " checked " , this . _showDevel ) , $ ( " # checkProduction " ) . attr ( " checked " , this . _showProd ) , $ ( " # checkSystem " ) . attr ( " checked " , this . _showSystem ) , arangoHelper . setCheckboxStatus ( " # foxxDropdown " ) ; var a = this ; return _ . each ( this . _installedSubViews , function ( b ) { b . toggle ( " devel " , a . _showDevel ) , b . toggle ( " system " , a . _showSystem ) } ) , arangoHelper . fixTooltips ( " icon_arangodb " , " left " ) , this } } ) } ( ) , function ( ) { " use strict " ; window . ClusterView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " clusterView . ejs " ) , events : { } , statsEnabled : ! 1 , historyInit : ! 1 , initDone : ! 1 , interval : 5e3 , maxValues : 100 , knownServers : [ ] , chartData : { } , charts : { } , nvcharts : [ ] , startHistory : { } , startHistoryAccumulated : { } , initialize : function ( a ) { var b = this ; window . App . isCluster & & ( this . dbServers = a . dbServers , this . coordinators = a . coordinators , this . updateServerTime ( ) , window . setInterval ( function ( ) { if ( " # cluster " = = = window . location . hash | | " " = = = window . location . hash | | " # " = = = window . location . hash ) { var a = function ( a ) { b . rerenderValues ( a ) , b . rerenderGraphs ( a ) } ; b . getCoordStatHistory ( a ) } } , this . interval ) ) } , render : function ( ) { this . $ el . html ( this . template . render ( { } ) ) , this . initDone | | ( void 0 ! = = this . coordinators . first ( ) ? this . getServerStatistics ( ) : this . waitForCoordinators ( ) , this . initDone = ! 0 ) , this . initGraphs ( ) } , waitForCoordinators : function ( ) { var a = this ; window . setTimeout ( function ( ) { a . coordinators ? a . getServerStatistics ( ) : a . waitForCoordinators ( ) } , 500 ) } , updateServerTime : function ( ) { this . serverTime = ( new Date ) . getTime ( ) } , getServerStatistics : function ( ) { var a = this ; this . data = void 0 ; var b = this . coordinators . first ( ) ; this . statCollectCoord = new window . ClusterStatisticsCollection ( [ ] , { host : b . get ( " address " ) } ) , this . statCollectDBS = new window . ClusterStatisticsCollection ( [ ] , { host : b . get ( " address " ) } ) ; var c = [ ] ; _ . each ( this . dbServers , function ( a ) { a . each ( function ( a ) { c . push ( a ) } ) } ) , _ . each ( c , function ( c ) { if ( " ok " = = = c . get ( " status " ) ) { - 1 = = = a . knownServers . indexOf ( c . id ) & & a . knownServers . push ( c . id ) ; var d = new window . Statistics ( { name : c . id } ) ; d . url = b . get ( " protocol " ) + " : / / " + b . get ( " address " ) + " / _admin / clusterStatistics ? DBserver = " + c . get ( " name " ) , a . statCollectDBS . add ( d ) } } ) , this . coordinators . forEach ( function ( b ) { if ( " ok " = = = b . get ( " status " ) ) { - 1 = = = a . knownServers . indexOf ( b . id ) & & a . knownServers . push ( b . id ) ; var c = new window . Statistics ( { name : b . id } ) ; c . url = b . get ( " protocol " ) + " : / / " + b . get ( " address " ) + " / _admin / statistics " , a . statCollectCoord . add ( c ) } } ) ; var d = function ( b ) { a . rerenderValues ( b ) , a . rerenderGraphs ( b ) } ; a . getCoordStatHistory ( d ) , a . renderNodes ( ) } , rerenderValues : function ( a ) { var b = this ; b . renderNodes ( ) , this . renderValue ( " # clusterConnections " , Math . round ( a . clientConnectionsCurrent ) ) , this . renderValue ( " # clusterConnectionsAvg " , Math . round ( a . clientConnections15M ) ) ; var c = a . physicalMemory , d = a . residentSizeCurrent ; this . renderValue ( " # clusterRam " , [ d , c ] ) } , renderValue : function ( a , b , c , d ) { if ( " number " = = typeof b ) $ ( a ) . html ( b ) ; else if ( $ . isArray ( b ) ) { var e = b [ 0 ] , f = b [ 1 ] , g = 1 / ( f / e ) * 100 ; g > 90 ? c = ! 0 : g > 70 & & 90 > g & & ( d = ! 0 ) , $ ( a ) . html ( g . toFixed ( 1 ) + " % " ) } else " string " = = typeof b & & $ ( a ) . html ( b ) ; c ? ( $ ( a ) . addClass ( " negative " ) , $ ( a ) . removeClass ( " warning " ) , $ ( a ) . removeClass ( " positive " ) ) : d ? ( $ ( a ) . addClass ( " warning " ) , $ ( a ) . removeClass ( " positive " ) , $ ( a ) . removeClass ( " negative " ) ) : ( $ ( a ) . addClass ( " positive " ) , $ ( a ) . removeClass ( " negative " ) , $ ( a ) . removeClass ( " warning " ) ) } , renderNodes : function ( ) { var a = this , b = function ( a ) { var b = 0 , c = 0 , d = 0 , e = 0 ; _ . each ( a , function ( a ) { " Coordinator " = = = a . Role ? ( b + + , " GOOD " ! = = a . Status & & c + + ) : " DBServer " = = = a . Role & & ( d + + , " GOOD " ! = = a . Status & & e + + ) } ) , c > 0 ? this . renderValue ( " # clusterCoordinators " , b - c + " / " + b , ! 0 ) : this . renderValue ( " # clusterCoordinators " , b ) , e > 0 ? this . renderValue ( " # clusterDBServers " , d - e + " / " + d , ! 0 ) : this . renderValue ( " # clusterDBServers " , d ) } . bind ( this ) ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / health " ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( a ) { b ( a . Health ) } , error : function ( ) { a . renderValue ( " # clusterCoordinators " , " N / A " , ! 0 ) , a . renderValue ( " # clusterDBServers " , " N / A " , ! 0 ) } } ) } , initValues : function ( ) { var a = [ " # clusterNodes " , " # clusterRam " , " # clusterConnections " , " # clusterConnectionsAvg " ] ; _ . each ( a , function ( a ) { $ ( a ) . html ( ' < i class = " fa fa - spin fa - circle - o - notch " style = " color : rgba ( 0 , 0 , 0 , 0 . 64 ) ; " > < / i > ' ) } ) } , graphData : { data : { sent : [ ] , received : [ ] } , http : [ ] , average : [ ] } , checkArraySizes : function ( ) { var a = this ; _ . each ( a . chartsOptions , function ( b , c ) { _ . each ( b . options , function ( b , d ) { b . values . length > a . maxValues - 1 & & a . chartsOptions [ c ] . options [ d ] . values . shift ( ) } ) } ) } , formatDataForGraph : function ( a ) { var b = this ; b . historyInit ? ( b . checkArraySizes ( ) , b . chartsOptions [ 0 ] . options [ 0 ] . values . push ( { x : a . times [ a . times . length - 1 ] , y : a . bytesSentPerSecond [ a . bytesSentPerSecond . length - 1 ] } ) , b . chartsOptions [ 0 ] . options [ 1 ] . values . push ( { x : a . times [ a . times . length - 1 ] , y : a . bytesReceivedPerSecond [ a . bytesReceivedPerSecond . length - 1 ] } ) , b . chartsOptions [ 1 ] . options [ 0 ] . values . push ( { x : a . times [ a . times . length - 1 ] , y : b . calcTotalHttp ( a . http , a . bytesSentPerSecond . length - 1 ) } ) , b . chartsOptions [ 2 ] . options [ 0 ] . values . push ( { x : a . times [ a . times . length - 1 ] , y : a . avgRequestTime [ a . bytesSentPerSecond . length - 1 ] / b . coordinators . length } ) ) : ( _ . each ( a . times , function ( c , d ) { b . chartsOptions [ 0 ] . options [ 0 ] . values . push ( { x : c , y : a . bytesSentPerSecond [ d ] } ) , b . chartsOptions [ 0 ] . options [ 1 ] . values . push ( { x : c , y : a . bytesReceivedPerSecond [ d ] } ) , b . chartsOptions [ 1 ] . options [ 0 ] . values . push ( { x : c , y : b . calcTotalHttp ( a . http , d ) } ) , b . chartsOptions [ 2 ] . options [ 0 ] . values . push ( { x : c , y : a . avgRequestTime [ d ] / b . coordinators . length } ) } ) , b . historyInit = ! 0 ) } , chartsOptions : [ { id : " # clusterData " , type : " bytes " , count : 2 , options : [ { area : ! 0 , values : [ ] , key : " Bytes out " , color : " rgb ( 23 , 190 , 207 ) " , strokeWidth : 2 , fillOpacity : . 1 } , { area : ! 0 , values : [ ] , key : " Bytes in " , color : " rgb ( 188 , 189 , 34 ) " , strokeWidth : 2 , fillOpacity : . 1 } ] } , { id : " # clusterHttp " , type : " bytes " , options : [ { area : ! 0 , values : [ ] , key : " Bytes " , color : " rgb ( 0 , 166 , 90 ) " , fillOpacity : . 1 } ] } , { id : " # clusterAverage " , data : [ ] , type : " seconds " , options : [ { area : ! 0 , values : [ ] , key : " Seconds " , color : " rgb ( 243 , 156 , 18 ) " , fillOpacity : . 1 } ] } ] , initGraphs : function ( ) { var a = this , b = " No data . . . " ; _ . each ( a . chartsOptions , function ( c ) { nv . addGraph ( function ( ) { a . charts [ c . id ] = nv . models . stackedAreaChart ( ) . options ( { useInteractiveGuideline : ! 0 , showControls : ! 1 , noData : b , duration : 0 } ) , a . charts [ c . id ] . xAxis . axisLabel ( " " ) . tickFormat ( function ( a ) { var b = new Date ( 1e3 * a ) ; return ( b . getHours ( ) < 10 ? " 0 " : " " ) + b . getHours ( ) + " : " + ( b . getMinutes ( ) < 10 ? " 0 " : " " ) + b . getMinutes ( ) + " : " + ( b . getSeconds ( ) < 10 ? " 0 " : " " ) + b . getSeconds ( ) } ) . staggerLabels ( ! 1 ) , a . charts [ c . id ] . yAxis . axisLabel ( " " ) . tickFormat ( function ( a ) { var b ; return " bytes " = = = c . type ? null = = = a ? " N / A " : ( b = parseFloat ( d3 . format ( " . 2f " ) ( a ) ) , prettyBytes ( b ) ) : " seconds " = = = c . type ? null = = = a ? " N / A " : b = parseFloat ( d3 . format ( " . 3f " ) ( a ) ) : void 0 } ) ; var d , e = a . returnGraphOptions ( c . id ) ; return e . length > 0 ? _ . each ( e , function ( a , b ) { c . options [ b ] . values = a } ) : c . options [ 0 ] . values = [ ] , d = c . options , a . chartData [ c . id ] = d3 . select ( c . id ) . append ( " svg " ) . datum ( d ) . transition ( ) . duration ( 300 ) . call ( a . charts [ c . id ] ) . each ( " start " , function ( ) { window . setTimeout ( function ( ) { d3 . selectAll ( c . id + " * " ) . each ( function ( ) { this . __transition__ & & ( this . __transition__ . duration = 0 ) } ) } , 0 ) } ) , nv . utils . windowResize ( a . charts [ c . id ] . update ) , a . nvcharts . push ( a . charts [ c . id ] ) , a . charts [ c . id ] } ) } ) } , returnGraphOptions : function ( a ) { var b = [ ] ; return b = " # clusterData " = = = a ? [ this . chartsOptions [ 0 ] . options [ 0 ] . values , this . chartsOptions [ 0 ] . options [ 1 ] . values ] : " # clusterHttp " = = = a ? [ this . chartsOptions [ 1 ] . options [ 0 ] . values ] : " # clusterAverage " = = = a ? [ this . chartsOptions [ 2 ] . options [ 0 ] . values ] : [ ] } , rerenderGraphs : function ( a ) { if ( this . statsEnabled ) { var b , c , d = this ; this . formatDataForGraph ( a ) , _ . each ( d . chartsOptions , function ( a ) { c = d . returnGraphOptions ( a . id ) , c . length > 0 ? _ . each ( c , function ( b , c ) { a . options [ c ] . values = b } ) : a . options [ 0 ] . values = [ ] , b = a . options , b [ 0 ] . values . length > 0 & & d . historyInit & & d . charts [ a . id ] & & d . charts [ a . id ] . update ( ) } ) } } , calcTotalHttp : function ( a , b ) { var c = 0 ; return _ . each ( a , function ( a ) { c + = a [ b ] } ) , c } , getCoordStatHistory : function ( a ) { $ . ajax ( { url : " statistics / coordshort " , json : ! 0 } ) . success ( function ( b ) { this . statsEnabled = b . enabled , a ( b . data ) } . bind ( this ) ) } } ) } ( ) , function ( ) { " use strict " ; window . CollectionListItemView = Backbone . View . extend ( { tagName : " div " , className : " tile pure - u - 1 - 1 pure - u - sm - 1 - 2 pure - u - md - 1 - 3 pure - u - lg - 1 - 4 pure - u - xl - 1 - 6 " , template : templateEngine . createTemplate ( " collectionsItemView . ejs " ) , initialize : function ( a ) { this . collectionsView = a . collectionsView } , events : { " click . iconSet . icon_arangodb_settings2 " : " createEditPropertiesModal " , " click . pull - left " : " noop " , " click . icon_arangodb_settings2 " : " editProperties " , " click . spanInfo " : " showProperties " , click : " selectCollection " } , render : function ( ) { return this . model . get ( " locked " ) ? ( $ ( this . el ) . addClass ( " locked " ) , $ ( this . el ) . addClass ( this . model . get ( " lockType " ) ) ) : $ ( this . el ) . removeClass ( " locked " ) , " loading " ! = = this . model . get ( " status " ) & & " unloading " ! = = this . model . get ( " status " ) | | $ ( this . el ) . addClass ( " locked " ) , $ ( this . el ) . html ( this . template . render ( { model : this . model } ) ) , $ ( this . el ) . attr ( " id " , " collection_ " + this . model . get ( " name " ) ) , this } , editProperties : function ( a ) { return this . model . get ( " locked " ) ? 0 : ( a . stopPropagation ( ) , void this . createEditPropertiesModal ( ) ) } , showProperties : function ( a ) { return this . model . get ( " locked " ) ? 0 : ( a . stopPropagation ( ) , void this . createInfoModal ( ) ) } , selectCollection : function ( a ) { return $ ( a . target ) . hasClass ( " disabled " ) ? 0 : this . model . get ( " locked " ) ? 0 : " loading " = = = this . model . get ( " status " ) ? 0 : void ( " unloaded " = = = this . model . get ( " status " ) ? this . loadCollection ( ) : window . App . navigate ( " collection / " + encodeURIComponent ( this . model . get ( " name " ) ) + " / documents / 1 " , { trigger : ! 0 } ) ) } , noop : function ( a ) { a . stopPropagation ( ) } , 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 . modalView . hide ( ) } } ) , this . collectionsView . render ( ) } , 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 , 10 ) ! = = Math . pow ( 2 , Math . log2 ( g ) ) ) throw new Error ( " 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 ) ; frontendConfig . isCluster = = = ! 1 ? this . model . renameCollection ( c , i ) : 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 ) ; frontendConfig . isCluster = = = ! 1 ? this . model . renameCollection ( c , j ) : j ( ) } else window . modalView . hide ( ) } } . bind ( this ) ; window . isCoordinator ( a ) } , createEditPropertiesModal : 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 ) , " loaded " = = = this . model . get ( " status " ) ? this . getIndex ( ) : $ ( $ ( " # 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 , [ { <nl> - 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 ( ) } ; this . model . getProperties ( g ) } else f ( ) } } . bind ( this ) ; window . isCoordinator ( a ) } , bindIndexEvents : function ( ) { this . unbindIndexEvents ( ) ; var a = this ; $ ( " # indexEditView # addIndex " ) . bind ( " click " , function ( ) { a . toggleNewIndexView ( ) , $ ( " # cancelIndex " ) . unbind ( " click " ) , $ ( " # cancelIndex " ) . bind ( " click " , function ( ) { a . toggleNewIndexView ( ) } ) , $ ( " # createIndex " ) . unbind ( " click " ) , $ ( " # createIndex " ) . bind ( " click " , function ( ) { a . createIndex ( ) } ) } ) , $ ( " # newIndexType " ) . bind ( " change " , function ( ) { a . selectIndexType ( ) } ) , $ ( " . deleteIndex " ) . bind ( " click " , function ( b ) { a . prepDeleteIndex ( b ) } ) , $ ( " # infoTab a " ) . bind ( " click " , function ( a ) { if ( $ ( " # indexDeleteModal " ) . remove ( ) , " Indices " ! = = $ ( a . currentTarget ) . html ( ) | | $ ( a . currentTarget ) . parent ( ) . hasClass ( " active " ) | | ( $ ( " # newIndexView " ) . hide ( ) , $ ( " # indexEditView " ) . show ( ) , $ ( " # modal - dialog . modal - footer . button - danger " ) . hide ( ) , $ ( " # modal - dialog . modal - footer . button - success " ) . hide ( ) , $ ( " # modal - dialog . modal - footer . button - notification " ) . hide ( ) ) , " General " = = = $ ( a . currentTarget ) . html ( ) & & ! $ ( a . currentTarget ) . parent ( ) . hasClass ( " active " ) ) { $ ( " # modal - dialog . modal - footer . button - danger " ) . show ( ) , $ ( " # modal - dialog . modal - footer . button - success " ) . show ( ) , $ ( " # modal - dialog . modal - footer . button - notification " ) . show ( ) ; var b = $ ( " . index - button - bar2 " ) [ 0 ] ; $ ( " # cancelIndex " ) . is ( " : visible " ) & & ( $ ( " # cancelIndex " ) . detach ( ) . appendTo ( b ) , $ ( " # createIndex " ) . detach ( ) . appendTo ( b ) ) } } ) } , unbindIndexEvents : function ( ) { $ ( " # indexEditView # addIndex " ) . unbind ( " click " ) , $ ( " # newIndexType " ) . unbind ( " change " ) , $ ( " # infoTab a " ) . unbind ( " click " ) , $ ( " . deleteIndex " ) . unbind ( " click " ) } , createInfoModal : function ( ) { var a = function ( a , b , c ) { if ( a ) arangoHelper . arangoError ( " Figures " , " Could not get revision . " ) ; else { var d = [ ] , e = { figures : c , revision : b , model : this . model } ; window . modalView . show ( " modalCollectionInfo . ejs " , " Collection : " + this . model . get ( " name " ) , d , e ) } } . bind ( this ) , b = function ( b , c ) { if ( b ) arangoHelper . arangoError ( " Figures " , " Could not get figures . " ) ; else { var d = c ; this . model . getRevision ( a , d ) } } . bind ( this ) ; this . model . getFigures ( b ) } , resetIndexForms : function ( ) { $ ( " # indexHeader input " ) . val ( " " ) . prop ( " checked " , ! 1 ) , $ ( " # newIndexType " ) . val ( " Geo " ) . prop ( " selected " , ! 0 ) , this . selectIndexType ( ) } , createIndex : function ( ) { var a , b , c , d = this , e = $ ( " # newIndexType " ) . val ( ) , f = { } ; switch ( e ) { case " Geo " : a = $ ( " # newGeoFields " ) . val ( ) ; var g = d . checkboxToValue ( " # newGeoJson " ) , h = d . checkboxToValue ( " # newGeoConstraint " ) , i = d . checkboxToValue ( " # newGeoIgnoreNull " ) ; f = { type : " geo " , fields : d . stringToArray ( a ) , geoJson : g , constraint : h , ignoreNull : i } ; break ; case " Hash " : a = $ ( " # newHashFields " ) . val ( ) , b = d . checkboxToValue ( " # newHashUnique " ) , c = d . checkboxToValue ( " # newHashSparse " ) , f = { type : " hash " , fields : d . stringToArray ( a ) , unique : b , sparse : c } ; break ; case " Fulltext " : a = $ ( " # newFulltextFields " ) . val ( ) ; var j = parseInt ( $ ( " # newFulltextMinLength " ) . val ( ) , 10 ) | | 0 ; f = { type : " fulltext " , fields : d . stringToArray ( a ) , minLength : j } ; break ; case " Skiplist " : a = $ ( " # newSkiplistFields " ) . val ( ) , b = d . checkboxToValue ( " # newSkiplistUnique " ) , c = d . checkboxToValue ( " # newSkiplistSparse " ) , f = { type : " skiplist " , fields : d . stringToArray ( a ) , unique : b , sparse : c } } var k = function ( a , b ) { if ( a ) if ( b ) { var c = JSON . parse ( b . responseText ) ; arangoHelper . arangoError ( " Document error " , c . errorMessage ) } else arangoHelper . arangoError ( " Document error " , " Could not create index . " ) ; d . refreshCollectionsView ( ) } ; window . modalView . hide ( ) , d . model . createIndex ( f , k ) } , lastTarget : null , prepDeleteIndex : function ( a ) { var b = this ; this . lastTarget = a , this . lastId = $ ( this . lastTarget . currentTarget ) . parent ( ) . parent ( ) . first ( ) . children ( ) . first ( ) . text ( ) , $ ( " # modal - dialog . modal - footer " ) . after ( ' < div id = " indexDeleteModal " style = " display : block ; " class = " alert alert - error modal - delete - confirmation " > < strong > Really delete ? < / strong > < button id = " indexConfirmDelete " class = " button - danger pull - right modal - confirm - delete " > Yes < / button > < button id = " indexAbortDelete " class = " button - neutral pull - right " > No < / button > < / div > ' ) , $ ( " # indexConfirmDelete " ) . unbind ( " click " ) , $ ( " # indexConfirmDelete " ) . bind ( " click " , function ( ) { $ ( " # indexDeleteModal " ) . remove ( ) , b . deleteIndex ( ) } ) , $ ( " # indexAbortDelete " ) . unbind ( " click " ) , $ ( " # indexAbortDelete " ) . bind ( " click " , function ( ) { $ ( " # indexDeleteModal " ) . remove ( ) } ) } , refreshCollectionsView : function ( ) { window . App . arangoCollectionsStore . fetch ( { success : function ( ) { window . App . collectionsView . render ( ) } } ) } , deleteIndex : function ( ) { var a = function ( a ) { a ? ( arangoHelper . arangoError ( " Could not delete index " ) , $ ( " tr th : contains ( ' " + this . lastId + " ' ) " ) . parent ( ) . children ( ) . last ( ) . html ( ' < span class = " deleteIndex icon_arangodb_roundminus " data - original - title = " Delete index " title = " Delete index " > < / span > ' ) , this . model . set ( " locked " , ! 1 ) , this . refreshCollectionsView ( ) ) : a | | void 0 = = = a | | ( $ ( " tr th : contains ( ' " + this . lastId + " ' ) " ) . parent ( ) . remove ( ) , this . model . set ( " locked " , ! 1 ) , this . refreshCollectionsView ( ) ) , this . refreshCollectionsView ( ) } . bind ( this ) ; this . model . set ( " locked " , ! 0 ) , this . model . deleteIndex ( this . lastId , a ) , $ ( " tr th : contains ( ' " + this . lastId + " ' ) " ) . parent ( ) . children ( ) . last ( ) . html ( ' < i class = " fa fa - circle - o - notch fa - spin " > < / i > ' ) } , selectIndexType : function ( ) { $ ( " . newIndexClass " ) . hide ( ) ; var a = $ ( " # newIndexType " ) . val ( ) ; $ ( " # newIndexType " + a ) . show ( ) } , getIndex : function ( ) { var a = function ( a , b ) { a ? window . arangoHelper . arangoError ( " Index " , b . errorMessage ) : this . renderIndex ( b ) } . bind ( this ) ; this . model . getIndex ( a ) } , renderIndex : function ( a ) { this . index = a ; var b = " collectionInfoTh modal - text " ; if ( this . index ) { var c = " " , d = " " ; _ . each ( this . index . indexes , function ( a ) { d = " primary " = = = a . type | | " edge " = = = a . type ? ' < span class = " icon_arangodb_locked " data - original - title = " No action " > < / span > ' : ' < span class = " deleteIndex icon_arangodb_roundminus " data - original - title = " Delete index " title = " Delete index " > < / span > ' , void 0 ! = = a . fields & & ( c = a . fields . join ( " , " ) ) ; var e = a . id . indexOf ( " / " ) , f = a . id . substr ( e + 1 , a . id . length ) , g = a . hasOwnProperty ( " selectivityEstimate " ) ? ( 100 * a . selectivityEstimate ) . toFixed ( 2 ) + " % " : " n / a " , h = a . hasOwnProperty ( " sparse " ) ? a . sparse : " n / a " ; $ ( " # collectionEditIndexTable " ) . append ( " < tr > < th class = " + JSON . stringify ( b ) + " > " + f + " < / th > < th class = " + JSON . stringify ( b ) + " > " + a . type + " < / th > < th class = " + JSON . stringify ( b ) + " > " + a . unique + " < / th > < th class = " + JSON . stringify ( b ) + " > " + h + " < / th > < th class = " + JSON . stringify ( b ) + " > " + g + " < / th > < th class = " + JSON . stringify ( b ) + " > " + c + " < / th > < th class = " + JSON . stringify ( b ) + " > " + d + " < / th > < / tr > " ) } ) } this . bindIndexEvents ( ) } , toggleNewIndexView : function ( ) { var a = $ ( " . index - button - bar2 " ) [ 0 ] ; $ ( " # indexEditView " ) . is ( " : visible " ) ? ( $ ( " # indexEditView " ) . hide ( ) , $ ( " # newIndexView " ) . show ( ) , $ ( " # cancelIndex " ) . detach ( ) . appendTo ( " # modal - dialog . modal - footer " ) , $ ( " # createIndex " ) . detach ( ) . appendTo ( " # modal - dialog . modal - footer " ) ) : ( $ ( " # indexEditView " ) . show ( ) , $ ( " # newIndexView " ) . hide ( ) , $ ( " # cancelIndex " ) . detach ( ) . appendTo ( a ) , $ ( " # createIndex " ) . detach ( ) . appendTo ( a ) ) , arangoHelper . fixTooltips ( " . icon_arangodb , . arangoicon " , " right " ) , this . resetIndexForms ( ) } , stringToArray : function ( a ) { var b = [ ] ; return a . split ( " , " ) . forEach ( function ( a ) { a = a . replace ( / ( ^ \ s + | \ s + $ ) / g , " " ) , " " ! = = a & & b . push ( a ) } ) , b } , checkboxToValue : function ( a ) { return $ ( a ) . prop ( " checked " ) } } ) } ( ) , function ( ) { " use strict " ; window . CollectionsView = Backbone . View . extend ( { el : " # content " , el2 : " # collectionsThumbnailsIn " , searchTimeout : null , refreshRate : 1e4 , template : templateEngine . createTemplate ( " collectionsView . ejs " ) , refetchCollections : function ( ) { var a = this ; this . collection . fetch ( { cache : ! 1 , success : function ( ) { a . checkLockedCollections ( ) } } ) } , checkLockedCollections : function ( ) { var a = function ( a , b ) { var c = this ; a ? console . log ( " Could not check locked collections " ) : ( this . collection . each ( function ( a ) { a . set ( " locked " , ! 1 ) } ) , _ . each ( b , function ( a ) { var b = c . collection . findWhere ( { id : a . collection } ) ; b . set ( " locked " , ! 0 ) , b . set ( " lockType " , a . type ) , b . set ( " desc " , a . desc ) } ) , this . collection . each ( function ( a ) { a . get ( " locked " ) | | ( $ ( " # collection_ " + a . get ( " name " ) ) . find ( " . corneredBadge " ) . removeClass ( " loaded unloaded " ) , $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . text ( a . get ( " status " ) ) , $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . addClass ( a . get ( " status " ) ) ) , a . get ( " locked " ) | | " loading " = = = a . get ( " status " ) ? ( $ ( " # collection_ " + a . get ( " name " ) ) . addClass ( " locked " ) , a . get ( " locked " ) ? ( $ ( " # collection_ " + a . get ( " name " ) ) . find ( " . corneredBadge " ) . removeClass ( " loaded unloaded " ) , $ ( " # collection_ " + a . get ( " name " ) ) . find ( " . corneredBadge " ) . addClass ( " inProgress " ) , $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . text ( a . get ( " desc " ) ) ) : $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . text ( a . get ( " status " ) ) ) : ( $ ( " # collection_ " + a . get ( " name " ) ) . removeClass ( " locked " ) , $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . text ( a . get ( " status " ) ) , $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . hasClass ( " inProgress " ) & & ( $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . text ( a . get ( " status " ) ) , $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . removeClass ( " inProgress " ) , $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . addClass ( " loaded " ) ) , " unloaded " = = = a . get ( " status " ) & & $ ( " # collection_ " + a . get ( " name " ) + " . icon_arangodb_info " ) . addClass ( " disabled " ) ) } ) ) } . bind ( this ) ; window . arangoHelper . syncAndReturnUninishedAardvarkJobs ( " index " , a ) } , initialize : function ( ) { var a = this ; window . setInterval ( function ( ) { " # collections " = = = window . location . hash & & window . VISIBLE & & a . refetchCollections ( ) } , a . refreshRate ) } , render : function ( ) { this . checkLockedCollections ( ) ; var a = ! 1 ; $ ( " # collectionsDropdown " ) . is ( " : visible " ) & & ( a = ! 0 ) , $ ( this . el ) . html ( this . template . render ( { } ) ) , this . setFilterValues ( ) , a = = = ! 0 & & $ ( " # collectionsDropdown2 " ) . show ( ) ; var b = this . collection . searchOptions ; this . collection . getFiltered ( b ) . forEach ( function ( a ) { $ ( " # collectionsThumbnailsIn " , this . el ) . append ( new window . CollectionListItemView ( { model : a , collectionsView : this } ) . render ( ) . el ) } , this ) , " none " = = = $ ( " # collectionsDropdown2 " ) . css ( " display " ) ? $ ( " # collectionsToggle " ) . removeClass ( " activated " ) : $ ( " # collectionsToggle " ) . addClass ( " activated " ) ; var c ; arangoHelper . setCheckboxStatus ( " # collectionsDropdown " ) ; try { c = b . searchPhrase . length } catch ( d ) { } return $ ( " # searchInput " ) . val ( b . searchPhrase ) , $ ( " # searchInput " ) . focus ( ) , $ ( " # searchInput " ) [ 0 ] . setSelectionRange ( c , c ) , arangoHelper . fixTooltips ( " . icon_arangodb , . arangoicon " , " left " ) , this } , events : { " click # createCollection " : " createCollection " , " keydown # searchInput " : " restrictToSearchPhraseKey " , " change # searchInput " : " restrictToSearchPhrase " , " click # searchSubmit " : " restrictToSearchPhrase " , " click . checkSystemCollections " : " checkSystem " , " click # checkLoaded " : " checkLoaded " , " click # checkUnloaded " : " checkUnloaded " , " click # checkDocument " : " checkDocument " , " click # checkEdge " : " checkEdge " , " click # sortName " : " sortName " , " click # sortType " : " sortType " , " click # sortOrder " : " sortOrder " , " click # collectionsToggle " : " toggleView " , " click . css - label " : " checkBoxes " } , updateCollectionsView : function ( ) { var a = this ; this . collection . fetch ( { cache : ! 1 , success : function ( ) { a . render ( ) } } ) } , toggleView : function ( ) { $ ( " # collectionsToggle " ) . toggleClass ( " activated " ) , $ ( " # collectionsDropdown2 " ) . slideToggle ( 200 ) } , checkBoxes : function ( a ) { var b = a . currentTarget . id ; $ ( " # " + b ) . click ( ) } , checkSystem : function ( ) { var a = this . collection . searchOptions , b = a . includeSystem ; a . includeSystem = $ ( " . checkSystemCollections " ) . is ( " : checked " ) = = = ! 0 , b ! = = a . includeSystem & & this . render ( ) } , checkEdge : function ( ) { var a = this . collection . searchOptions , b = a . includeEdge ; a . includeEdge = $ ( " # checkEdge " ) . is ( " : checked " ) = = = ! 0 , b ! = = a . includeEdge & & this . render ( ) } , checkDocument : function ( ) { var a = this . collection . searchOptions , b = a . includeDocument ; a . includeDocument = $ ( " # checkDocument " ) . is ( " : checked " ) = = = ! 0 , b ! = = a . includeDocument & & this . render ( ) } , checkLoaded : function ( ) { var a = this . collection . searchOptions , b = a . includeLoaded ; a . includeLoaded = $ ( " # checkLoaded " ) . is ( " : checked " ) = = = ! 0 , b ! = = a . includeLoaded & & this . render ( ) } , checkUnloaded : function ( ) { var a = this . collection . searchOptions , b = a . includeUnloaded ; a . includeUnloaded = $ ( " # checkUnloaded " ) . is ( " : checked " ) = = = ! 0 , b ! = = a . includeUnloaded & & this . render ( ) } , sortName : function ( ) { var a = this . collection . searchOptions , b = a . sortBy ; a . sortBy = $ ( " # sortName " ) . is ( " : checked " ) = = = ! 0 ? " name " : " type " , b ! = = a . sortBy & & this . render ( ) } , sortType : function ( ) { var a = this . collection . searchOptions , b = a . sortBy ; a . sortBy = $ ( " # sortType " ) . is ( " : checked " ) = = = ! 0 ? " type " : " name " , b ! = = a . sortBy & & this . render ( ) } , sortOrder : function ( ) { var a = this . collection . searchOptions , b = a . sortOrder ; a . sortOrder = $ ( " # sortOrder " ) . is ( " : checked " ) = = = ! 0 ? - 1 : 1 , b ! = = a . sortOrder & & this . render ( ) } , setFilterValues : function ( ) { var a = this . collection . searchOptions ; $ ( " # checkLoaded " ) . attr ( " checked " , a . includeLoaded ) , $ ( " # checkUnloaded " ) . attr ( " checked " , a . includeUnloaded ) , $ ( " . checkSystemCollections " ) . attr ( " checked " , a . includeSystem ) , $ ( " # checkEdge " ) . attr ( " checked " , a . includeEdge ) , $ ( " # checkDocument " ) . attr ( " checked " , a . includeDocument ) , $ ( " # sortName " ) . attr ( " checked " , " type " ! = = a . sortBy ) , $ ( " # sortType " ) . attr ( " checked " , " type " = = = a . sortBy ) , $ ( " # sortOrder " ) . attr ( " checked " , 1 ! = = a . sortOrder ) } , search : function ( ) { var a = this . collection . searchOptions , b = $ ( " # searchInput " ) . val ( ) ; b ! = = a . searchPhrase & & ( a . searchPhrase = b , this . render ( ) ) } , resetSearch : function ( ) { this . searchTimeout & & ( clearTimeout ( this . searchTimeout ) , this . searchTimeout = null ) ; var a = this . collection . searchOptions ; a . searchPhrase = null } , restrictToSearchPhraseKey : function ( ) { var a = this ; this . resetSearch ( ) , a . searchTimeout = setTimeout ( function ( ) { a . search ( ) } , 200 ) } , restrictToSearchPhrase : function ( ) { this . resetSearch ( ) , this . search ( ) } , createCollection : function ( a ) { a . preventDefault ( ) , this . createNewCollectionModal ( ) } , submitCreateCollection : function ( ) { var a = function ( a , b ) { if ( a ) arangoHelper . arangoError ( " DB " , " Could not check coordinator state " ) ; else { var c = $ ( " # new - collection - name " ) . val ( ) , d = $ ( " # new - collection - size " ) . val ( ) , e = $ ( " # new - replication - factor " ) . val ( ) , f = $ ( " # new - collection - type " ) . val ( ) , g = $ ( " # new - collection - sync " ) . val ( ) , h = 1 , i = [ ] ; if ( " " = = = e & & ( e = 1 ) , b ) { if ( h = $ ( " # new - collection - shards " ) . val ( ) , " " = = = h & & ( h = 1 ) , h = parseInt ( h , 10 ) , 1 > h ) return arangoHelper . arangoError ( " Number of shards has to be an integer value greater or equal 1 " ) , 0 ; i = _ . pluck ( $ ( " # new - collection - shardBy " ) . select2 ( " data " ) , " text " ) , 0 = = = i . length & & i . push ( " _key " ) } if ( " _ " = = = c . substr ( 0 , 1 ) ) return arangoHelper . arangoError ( ' No " _ " allowed as first character ! ' ) , 0 ; var j = ! 1 , k = " true " = = = g ; if ( d > 0 ) try { d = 1024 * JSON . parse ( d ) * 1024 } catch ( l ) { return arangoHelper . arangoError ( " Please enter a valid number " ) , 0 } if ( " " = = = c ) return arangoHelper . arangoError ( " No collection name entered ! " ) , 0 ; var m = function ( a , b ) { if ( a ) try { b = JSON . parse ( b . responseText ) , arangoHelper . arangoError ( " Error " , b . errorMessage ) } catch ( c ) { } else this . updateCollectionsView ( ) ; window . modalView . hide ( ) } . bind ( this ) ; this . collection . newCollection ( { collName : c , wfs : k , isSystem : j , collSize : d , replicationFactor : e , collType : f , shards : h , shardBy : i } , m ) } } . bind ( this ) ; window . isCoordinator ( a ) } , createNewCollectionModal : function ( ) { var a = function ( a , b ) { if ( a ) arangoHelper . arangoError ( " DB " , " Could not check coordinator state " ) ; else { var c = [ ] , d = [ ] , e = { } , f = [ ] ; d . push ( window . modalView . createTextEntry ( " new - collection - name " , " 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 . " } ] ) ) , d . push ( window . modalView . createSelectEntry ( " new - collection - type " , " Type " , " " , " The type of the collection to create . " , [ { value : 2 , label : " Document " } , { value : 3 , label : " Edge " } ] ) ) , b & & ( d . push ( window . modalView . createTextEntry ( " new - collection - shards " , " Shards " , " " , " The number of shards to create . You cannot change this afterwards . Recommended : DBServers squared " , " " , ! 0 ) ) , d . push ( window . modalView . createSelect2Entry ( " new - collection - shardBy " , " shardBy " , " " , " The keys used to distribute documents on shards . Type the key and press return to add it . " , " _key " , ! 1 ) ) ) , c . push ( window . modalView . createSuccessButton ( " Save " , this . submitCreateCollection . bind ( this ) ) ) , f . push ( window . modalView . createTextEntry ( " new - collection - size " , " Journal size " , " " , " The maximal size of a journal or datafile ( in MB ) . Must be at least 1 . " , " " , ! 1 , [ { rule : Joi . string ( ) . allow ( " " ) . optional ( ) . regex ( / ^ [ 0 - 9 ] * $ / ) , msg : " Must be a number . " } ] ) ) , window . App . isCluster & & f . push ( window . modalView . createTextEntry ( " new - replication - factor " , " Replication factor " , " " , " Numeric value . Must be at least 1 . Description : TODO " , " " , ! 1 , [ { rule : Joi . string ( ) . allow ( " " ) . optional ( ) . regex ( / ^ [ 0 - 9 ] * $ / ) , msg : " Must be a number . " } ] ) ) , f . push ( window . modalView . createSelectEntry ( " new - collection - sync " , " Wait for sync " , " " , " Synchronize to disk before returning from a create or update of a document . " , [ { value : ! 1 , label : " No " } , { value : ! 0 , label : " Yes " } ] ) ) , e . header = " Advanced " , e . content = f , window . modalView . show ( " modalTable . ejs " , " New Collection " , c , d , e ) , $ ( " # s2id_new - collection - shardBy . select2 - search - field input " ) . on ( " focusout " , function ( a ) { $ ( " . select2 - drop " ) . is ( " : visible " ) & & ( $ ( " # select2 - search - field input " ) . is ( " : focus " ) | | window . setTimeout ( function ( ) { $ ( a . currentTarget ) . parent ( ) . parent ( ) . parent ( ) . select2 ( " close " ) } , 200 ) ) } ) } } . bind ( this ) ; window . isCoordinator ( a ) } } ) } ( ) , function ( ) { " use strict " ; function a ( a , b ) { return void 0 ! = = a & & null ! = = a | | ( a = 0 ) , a . toFixed ( b ) } window . DashboardView = Backbone . View . extend ( { el : " # content " , interval : 1e4 , defaultTimeFrame : 12e5 , defaultDetailFrame : 1728e5 , history : { } , graphs : { } , events : { " click . subViewNavbar . subMenuEntry " : " toggleViews " } , tendencies : { asyncPerSecondCurrent : [ " asyncPerSecondCurrent " , " asyncPerSecondPercentChange " ] , syncPerSecondCurrent : [ " syncPerSecondCurrent " , " syncPerSecondPercentChange " ] , clientConnectionsCurrent : [ " clientConnectionsCurrent " , " clientConnectionsPercentChange " ] , clientConnectionsAverage : [ " clientConnections15M " , " clientConnections15MPercentChange " ] , numberOfThreadsCurrent : [ " numberOfThreadsCurrent " , " numberOfThreadsPercentChange " ] , numberOfThreadsAverage : [ " numberOfThreads15M " , " numberOfThreads15MPercentChange " ] , virtualSizeCurrent : [ " virtualSizeCurrent " , " virtualSizePercentChange " ] , virtualSizeAverage : [ " virtualSize15M " , " virtualSize15MPercentChange " ] } , barCharts : { totalTimeDistribution : [ " queueTimeDistributionPercent " , " requestTimeDistributionPercent " ] , dataTransferDistribution : [ " bytesSentDistributionPercent " , " bytesReceivedDistributionPercent " ] } , barChartsElementNames : { queueTimeDistributionPercent : " Queue " , requestTimeDistributionPercent : " Computation " , bytesSentDistributionPercent : " Bytes sent " , bytesReceivedDistributionPercent : " Bytes received " } , getDetailFigure : function ( a ) { var b = $ ( a . currentTarget ) . attr ( " id " ) . replace ( / ChartButton / g , " " ) ; return b } , showDetail : function ( a ) { var b , c = this , d = this . getDetailFigure ( a ) ; b = this . dygraphConfig . getDetailChartConfig ( d ) , this . getHistoryStatistics ( d ) , this . detailGraphFigure = d , window . modalView . hideFooter = ! 0 , window . modalView . hide ( ) , window . modalView . show ( " modalGraph . ejs " , b . header , void 0 , void 0 , void 0 , void 0 , this . events ) , window . modalView . hideFooter = ! 1 , $ ( " # modal - dialog " ) . on ( " hidden " , function ( ) { c . hidden ( ) } ) , $ ( " # modal - dialog " ) . toggleClass ( " modal - chart - detail " , ! 0 ) , b . height = . 7 * $ ( window ) . height ( ) , b . width = $ ( " . modal - inner - detail " ) . width ( ) , b . labelsDiv = $ ( b . labelsDiv ) [ 0 ] , this . detailGraph = new Dygraph ( document . getElementById ( " lineChartDetail " ) , this . history [ this . server ] [ d ] , b ) } , hidden : function ( ) { this . detailGraph . destroy ( ) , delete this . detailGraph , delete this . detailGraphFigure } , 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 } } , prepareDygraphs : function ( ) { var a , b = this ; this . dygraphConfig . getDashBoardFigures ( ) . forEach ( function ( c ) { a = b . dygraphConfig . getDefaultConfig ( c ) ; var d = b . getCurrentSize ( a . div ) ; a . height = d . height , a . width = d . width , b . graphs [ c ] = new Dygraph ( document . getElementById ( a . div ) , b . history [ b . server ] [ c ] | | [ ] , a ) } ) } , initialize : function ( a ) { this . options = a , this . dygraphConfig = a . dygraphConfig , this . d3NotInitialized = ! 0 , this . events [ " click . dashboard - sub - bar - menu - sign " ] = this . showDetail . bind ( this ) , this . events [ " mousedown . dygraph - rangesel - zoomhandle " ] = this . stopUpdating . bind ( this ) , this . events [ " mouseup . dygraph - rangesel - zoomhandle " ] = this . startUpdating . bind ( this ) , this . serverInfo = a . serverToShow , this . serverInfo ? this . server = this . serverInfo . target : this . server = " - local - " , this . history [ this . server ] = { } } , toggleViews : function ( a ) { var b = a . currentTarget . id . split ( " - " ) [ 0 ] , c = this , d = [ " replication " , " requests " , " system " ] ; _ . each ( d , function ( a ) { b ! = = a ? $ ( " # " + a ) . hide ( ) : ( $ ( " # " + a ) . show ( ) , c . resize ( ) , $ ( window ) . resize ( ) ) } ) , $ ( " . subMenuEntries " ) . children ( ) . removeClass ( " active " ) , $ ( " # " + b + " - statistics " ) . addClass ( " active " ) , window . setTimeout ( function ( ) { c . resize ( ) , $ ( window ) . resize ( ) } , 200 ) } , updateCharts : function ( ) { var a = this ; return this . detailGraph ? void this . updateLineChart ( this . detailGraphFigure , ! 0 ) : ( this . prepareD3Charts ( this . isUpdating ) , this . prepareResidentSize ( this . isUpdating ) , this . updateTendencies ( ) , void Object . keys ( this . graphs ) . forEach ( function ( b ) { a . updateLineChart ( b , ! 1 ) } ) ) } , updateTendencies : function ( ) { var a = this , b = this . tendencies , c = " " ; Object . keys ( b ) . forEach ( function ( b ) { var d = " " , e = 0 ; a . history . hasOwnProperty ( a . server ) & & a . history [ a . server ] . hasOwnProperty ( b ) & & ( e = a . history [ a . server ] [ b ] [ 1 ] ) , 0 > e ? c = " # d05448 " : ( c = " # 7da817 " , d = " + " ) , a . history . hasOwnProperty ( a . server ) & & a . history [ a . server ] . hasOwnProperty ( b ) ? $ ( " # " + b ) . html ( a . history [ a . server ] [ b ] [ 0 ] + ' < br / > < span class = " dashboard - figurePer " style = " color : ' + c + ' ; " > ' + d + e + " % < / span > " ) : $ ( " # " + b ) . html ( ' < br / > < span class = " dashboard - figurePer " style = " color : # 000 ; " > < p class = " dataNotReadyYet " > data not ready yet < / p > < / span > ' ) } ) } , updateDateWindow : function ( a , b ) { var c , d , e = ( new Date ) . getTime ( ) ; return b & & a . dateWindow_ ? ( c = a . dateWindow_ [ 0 ] , d = e - a . dateWindow_ [ 1 ] - 5 * this . interval > 0 ? a . dateWindow_ [ 1 ] : e , [ c , d ] ) : [ e - this . defaultTimeFrame , e ] } , updateLineChart : function ( a , b ) { var c = b ? this . detailGraph : this . graphs [ a ] , d = { file : this . history [ this . server ] [ a ] , dateWindow : this . updateDateWindow ( c , b ) } , e = 0 , f = [ ] ; _ . each ( d . file , function ( a ) { var b = a [ 0 ] . getSeconds ( ) - a [ 0 ] . getSeconds ( ) % 10 ; d . file [ e ] [ 0 ] . setSeconds ( b ) , f . push ( d . file [ e ] [ 0 ] ) , e + + } ) ; for ( var g = new Date ( Math . max . apply ( null , f ) ) , h = new Date ( Math . min . apply ( null , f ) ) , i = new Date ( h . getTime ( ) ) , j = [ ] , k = [ ] ; g > i ; ) i = new Date ( i . setSeconds ( i . getSeconds ( ) + 10 ) ) , k . push ( i ) ; _ . each ( k , function ( a ) { var b = ! 1 ; _ . each ( d . file , function ( c ) { Math . floor ( a . getTime ( ) / 1e3 ) = = = Math . floor ( c [ 0 ] . getTime ( ) / 1e3 ) & & ( b = ! 0 ) } ) , b = = = ! 1 & & a < new Date & & j . push ( a ) } ) , _ . each ( j , function ( b ) { " systemUserTime " ! = = a & & " requests " ! = = a & & " pageFaults " ! = = a & & " dataTransfer " ! = = a | | d . file . push ( [ b , 0 , 0 ] ) , " totalTime " = = = a & & d . file . push ( [ b , 0 , 0 , 0 ] ) } ) , void 0 = = = d . file ? ( $ ( " # loadingScreen span " ) . text ( " Statistics not ready yet . Waiting . " ) , " # dashboard " ! = = window . location . hash & & " " ! = = window . location . hash & & " # " ! = = window . location . hash | | ( $ ( " # loadingScreen " ) . show ( ) , $ ( " # content " ) . hide ( ) ) ) : ( $ ( " # content " ) . show ( ) , $ ( " # loadingScreen " ) . hide ( ) , d . file . sort ( function ( a , b ) { return new Date ( b [ 0 ] ) - new Date ( a [ 0 ] ) } ) , c . updateOptions ( d ) ) , $ ( window ) . trigger ( " resize " ) , this . resize ( ) } , mergeDygraphHistory : function ( a , b ) { var c , d = this ; this . dygraphConfig . getDashBoardFigures ( ! 0 ) . forEach ( function ( e ) { if ( d . dygraphConfig . mapStatToFigure [ e ] & & ( d . history [ d . server ] [ e ] | | ( d . history [ d . server ] [ e ] = [ ] ) , c = [ ] , d . dygraphConfig . mapStatToFigure [ e ] . forEach ( function ( d ) { a [ d ] & & ( " times " = = = d ? c . push ( new Date ( 1e3 * a [ d ] [ b ] ) ) : c . push ( a [ d ] [ b ] ) ) } ) , c . length > 1 ) ) { var f = 0 , g = 0 ; 9 = = = c . length & & ( f + = c [ 1 ] , f + = c [ 6 ] , f + = c [ 7 ] , f + = c [ 8 ] , g + = c [ 2 ] , g + = c [ 3 ] , g + = c [ 4 ] , g + = c [ 5 ] , c = [ c [ 0 ] , f , g ] ) , d . history [ d . server ] [ e ] . unshift ( c ) } } ) } , cutOffHistory : function ( a , b ) { for ( var c = this , d = c . history [ c . server ] [ a ] ; 0 ! = = d . length & & ! ( d [ d . length - 1 ] [ 0 ] > = b ) ; ) d . pop ( ) } , cutOffDygraphHistory : function ( a ) { var b = this , c = new Date ( a ) ; this . dygraphConfig . getDashBoardFigures ( ! 0 ) . forEach ( function ( a ) { b . dygraphConfig . mapStatToFigure [ a ] & & b . history [ b . server ] [ a ] & & b . cutOffHistory ( a , c ) } ) } , mergeHistory : function ( b ) { var c , d = this ; for ( c = 0 ; c < b . times . length ; + + c ) this . mergeDygraphHistory ( b , c ) ; this . cutOffDygraphHistory ( ( new Date ) . getTime ( ) - this . defaultTimeFrame ) , Object . keys ( this . tendencies ) . forEach ( function ( c ) { var e = 1 , f = 1 ; " virtualSizeCurrent " = = = c | | " virtualSizeAverage " = = = c ? ( b [ d . tendencies [ c ] [ 0 ] ] / = 1073741824 , e = 2 ) : " clientConnectionsCurrent " = = = c ? e = 0 : " numberOfThreadsCurrent " = = = c & & ( e = 0 ) , d . history [ d . server ] [ c ] = [ a ( b [ d . tendencies [ c ] [ 0 ] ] , e ) , a ( 100 * b [ d . tendencies [ c ] [ 1 ] ] , f ) ] } ) , Object . keys ( this . barCharts ) . forEach ( function ( a ) { d . history [ d . server ] [ a ] = d . mergeBarChartData ( d . barCharts [ a ] , b ) } ) , d . history [ d . server ] . physicalMemory = b . physicalMemory , d . history [ d . server ] . residentSizeCurrent = b . residentSizeCurrent , d . history [ d . server ] . residentSizePercent = b . residentSizePercent , d . history [ d . server ] . residentSizeChart = [ { key : " " , color : this . dygraphConfig . colors [ 1 ] , values : [ { label : " used " , value : 100 * b . residentSizePercent } ] } , { key : " " , color : this . dygraphConfig . colors [ 2 ] , values : [ { label : " used " , value : 100 - 100 * b . residentSizePercent } ] } ] , this . nextStart = b . nextStart } , mergeBarChartData : function ( a , b ) { var c , d = { key : this . barChartsElementNames [ a [ 0 ] ] , color : this . dygraphConfig . colors [ 1 ] , values : [ ] } , e = { key : this . barChartsElementNames [ a [ 1 ] ] , color : this . dygraphConfig . colors [ 2 ] , values : [ ] } ; for ( c = b [ a [ 0 ] ] . values . length - 1 ; c > = 0 ; - - c ) d . values . push ( { label : this . getLabel ( b [ a [ 0 ] ] . cuts , c ) , value : b [ a [ 0 ] ] . values [ c ] } ) , e . values . push ( { label : this . getLabel ( b [ a [ 1 ] ] . cuts , c ) , value : b [ a [ 1 ] ] . values [ c ] } ) ; return [ d , e ] } , getLabel : function ( a , b ) { return a [ b ] ? 0 = = = b ? " 0 - " + a [ b ] : a [ b - 1 ] + " - " + a [ b ] : " > " + a [ b - 1 ] } , renderReplicationStatistics : function ( a ) { $ ( " # repl - numbers table tr : nth - child ( 1 ) > td : nth - child ( 2 ) " ) . html ( a . state . totalEvents ) , $ ( " # repl - numbers table tr : nth - child ( 2 ) > td : nth - child ( 2 ) " ) . html ( a . state . totalRequests ) , $ ( " # repl - numbers table tr : nth - child ( 3 ) > td : nth - child ( 2 ) " ) . html ( a . state . totalFailedConnects ) , a . state . lastAppliedContinuousTick ? $ ( " # repl - ticks table tr : nth - child ( 1 ) > td : nth - child ( 2 ) " ) . html ( a . state . lastAppliedContinuousTick ) : $ ( " # repl - ticks table tr : nth - child ( 1 ) > td : nth - child ( 2 ) " ) . html ( " no data available " ) . addClass ( " no - data " ) , a . state . lastProcessedContinuousTick ? $ ( " # repl - ticks table tr : nth - child ( 2 ) > td : nth - child ( 2 ) " ) . html ( a . state . lastProcessedContinuousTick ) : $ ( " # repl - ticks table tr : nth - child ( 2 ) > td : nth - child ( 2 ) " ) . html ( " no data available " ) . addClass ( " no - data " ) , a . state . lastAvailableContinuousTick ? $ ( " # repl - ticks table tr : nth - child ( 3 ) > td : nth - child ( 2 ) " ) . html ( a . state . lastAvailableContinuousTick ) : $ ( " # repl - ticks table tr : nth - child ( 3 ) > td : nth - child ( 2 ) " ) . html ( " no data available " ) . addClass ( " no - data " ) , $ ( " # repl - progress table tr : nth - child ( 1 ) > td : nth - child ( 2 ) " ) . html ( a . state . progress . message ) , $ ( " # repl - progress table tr : nth - child ( 2 ) > td : nth - child ( 2 ) " ) . html ( a . state . progress . time ) , $ ( " # repl - progress table tr : nth - child ( 3 ) > td : nth - child ( 2 ) " ) . html ( a . state . progress . failedConnects ) } , getReplicationStatistics : function ( ) { var a = this ; $ . ajax ( arangoHelper . databaseUrl ( " / _api / replication / applier - state " ) , { async : ! 0 } ) . done ( function ( b ) { if ( b . hasOwnProperty ( " state " ) ) { var c ; c = b . state . running ? " active " : " inactive " , c = ' < span class = " state " > ' + c + " < / span > " , $ ( " # replication - chart . dashboard - sub - bar " ) . html ( " Replication " + c ) , a . renderReplicationStatistics ( b ) } } ) } , getStatistics : function ( a , b ) { var c = this , d = arangoHelper . databaseUrl ( " / _admin / aardvark / statistics / short " , " _system " ) , e = " ? start = " ; e + = c . nextStart ? c . nextStart : ( ( new Date ) . getTime ( ) - c . defaultTimeFrame ) / 1e3 , " - local - " ! = = c . server & & ( e + = " & type = short & DBserver = " + c . serverInfo . target , c . history . hasOwnProperty ( c . server ) | | ( c . history [ c . server ] = { } ) ) , $ . ajax ( d + e , { async : ! 0 , xhrFields : { withCredentials : ! 0 } , crossDomain : ! 0 } ) . done ( function ( d ) { d . times . length > 0 & & ( c . isUpdating = ! 0 , c . mergeHistory ( d ) ) , c . isUpdating ! = = ! 1 & & ( a & & a ( d . enabled , b ) , c . updateCharts ( ) ) } ) . error ( function ( a ) { console . log ( " stat fetch req error : " + a ) } ) , this . getReplicationStatistics ( ) } , getHistoryStatistics : function ( a ) { var b = this , c = " statistics / long " , d = " ? filter = " + this . dygraphConfig . mapStatToFigure [ a ] . join ( ) ; " - local - " ! = = b . server & & ( c = b . server . endpoint + arangoHelper . databaseUrl ( " / _admin / aardvark / statistics / cluster " ) , d + = " & type = long & DBserver = " + b . server . target , b . history . hasOwnProperty ( b . server ) | | ( b . history [ b . server ] = { } ) ) ; var e = window . location . href . split ( " / " ) , f = e [ 0 ] + " / / " + e [ 2 ] + " / " + e [ 3 ] + " / _system / " + e [ 5 ] + " / " + e [ 6 ] + " / " ; $ . ajax ( f + c + d , { async : ! 0 } ) . done ( function ( c ) { var d ; for ( b . history [ b . server ] [ a ] = [ ] , d = 0 ; d < c . times . length ; + + d ) b . mergeDygraphHistory ( c , d , ! 0 ) } ) } , addEmptyDataLabels : function ( ) { 0 = = = $ ( " . dataNotReadyYet " ) . length & & ( $ ( " # dataTransferDistribution " ) . prepend ( ' < p class = " dataNotReadyYet " > data not ready yet < / p > ' ) , $ ( " # totalTimeDistribution " ) . prepend ( ' < p class = " dataNotReadyYet " > data not ready yet < / p > ' ) , $ ( " . dashboard - bar - chart - title " ) . append ( ' < p class = " dataNotReadyYet " > data not ready yet < / p > ' ) ) } , removeEmptyDataLabels : function ( ) { $ ( " . dataNotReadyYet " ) . remove ( ) } , prepareResidentSize : function ( b ) { var c = this , d = this . getCurrentSize ( " # residentSizeChartContainer " ) , e = c . history [ c . server ] . residentSizeCurrent / 1024 / 1024 , f = " " ; f = 1025 > e ? a ( e , 2 ) + " MB " : a ( e / 1024 , 2 ) + " GB " ; var g = a ( 100 * c . history [ c . server ] . residentSizePercent , 2 ) , h = [ a ( c . history [ c . server ] . physicalMemory / 1024 / 1024 / 1024 , 0 ) + " GB " ] ; return void 0 = = = c . history [ c . server ] . residentSizeChart ? void this . addEmptyDataLabels ( ) : ( this . removeEmptyDataLabels ( ) , void nv . addGraph ( function ( ) { var a = nv . models . multiBarHorizontalChart ( ) . x ( function ( a ) { return a . label } ) . y ( function ( a ) { return a . value } ) . width ( d . width ) . height ( d . height ) . margin ( { top : ( $ ( " residentSizeChartContainer " ) . outerHeight ( ) - $ ( " residentSizeChartContainer " ) . height ( ) ) / 2 , right : 1 , bottom : ( $ ( " residentSizeChartContainer " ) . outerHeight ( ) - $ ( " residentSizeChartContainer " ) . height ( ) ) / 2 , left : 1 } ) . showValues ( ! 1 ) . showYAxis ( ! 1 ) . showXAxis ( ! 1 ) . showLegend ( ! 1 ) . showControls ( ! 1 ) . stacked ( ! 0 ) ; return a . yAxis . tickFormat ( function ( a ) { return a + " % " } ) . showMaxMin ( ! 1 ) , a . xAxis . showMaxMin ( ! 1 ) , d3 . select ( " # residentSizeChart svg " ) . datum ( c . history [ c . server ] . residentSizeChart ) . call ( a ) , d3 . select ( " # residentSizeChart svg " ) . select ( " . nv - zeroLine " ) . remove ( ) , b & & ( d3 . select ( " # residentSizeChart svg " ) . select ( " # total " ) . remove ( ) , d3 . select ( " # residentSizeChart svg " ) . select ( " # percentage " ) . remove ( ) ) , d3 . select ( " . dashboard - bar - chart - title . percentage " ) . html ( f + " ( " + g + " % ) " ) , d3 . select ( " . dashboard - bar - chart - title . absolut " ) . html ( h [ 0 ] ) , nv . utils . windowResize ( a . update ) , a } , function ( ) { d3 . selectAll ( " # residentSizeChart . nv - bar " ) . on ( " click " , function ( ) { } ) } ) ) } , prepareD3Charts : function ( b ) { var c = this , d = { totalTimeDistribution : [ " queueTimeDistributionPercent " , " requestTimeDistributionPercent " ] , dataTransferDistribution : [ " bytesSentDistributionPercent " , " bytesReceivedDistributionPercent " ] } ; this . d3NotInitialized & & ( b = ! 1 , this . d3NotInitialized = ! 1 ) , _ . each ( Object . keys ( d ) , function ( b ) { var d = c . getCurrentSize ( " # " + b + " Container . dashboard - interior - chart " ) , e = " # " + b + " Container svg " ; return void 0 = = = c . history [ c . server ] . residentSizeChart ? void c . addEmptyDataLabels ( ) : ( c . removeEmptyDataLabels ( ) , void nv . addGraph ( function ( ) { var f = [ 0 , . 25 , . 5 , . 75 , 1 ] , g = 75 , h = 23 , i = 6 ; d . width < 219 ? ( f = [ 0 , . 5 , 1 ] , g = 72 , h = 21 , i = 5 ) : d . width < 299 ? ( f = [ 0 , . 3334 , . 6667 , 1 ] , g = 77 ) : d . width < 379 ? g = 87 : d . width < 459 ? g = 95 : d . width < 539 ? g = 100 : d . width < 619 & & ( g = 105 ) ; var j = nv . models . multiBarHorizontalChart ( ) . x ( function ( a ) { return a . label } ) . y ( function ( a ) { return a . value } ) . width ( d . width ) . height ( d . height ) . margin ( { top : 5 , right : 20 , bottom : h , left : g } ) . showValues ( ! 1 ) . showYAxis ( ! 0 ) . showXAxis ( ! 0 ) . showLegend ( ! 1 ) . showControls ( ! 1 ) . forceY ( [ 0 , 1 ] ) ; return j . yAxis . showMaxMin ( ! 1 ) , d3 . select ( " . nv - y . nv - axis " ) . selectAll ( " text " ) . attr ( " transform " , " translate ( 0 , " + i + " ) " ) , j . yAxis . tickValues ( f ) . tickFormat ( function ( b ) { return a ( 100 * b * 100 / 100 , 0 ) + " % " } ) , d3 . select ( e ) . datum ( c . history [ c . server ] [ b ] ) . call ( j ) , nv . utils . windowResize ( j . update ) , j } , function ( ) { d3 . selectAll ( e + " . nv - bar " ) . on ( " click " , function ( ) { } ) } ) ) } ) } , stopUpdating : function ( ) { this . isUpdating = ! 1 } , startUpdating : function ( ) { var a = this ; a . timer | | ( a . timer = window . setInterval ( function ( ) { window . App . isCluster ? window . location . hash . indexOf ( a . serverInfo . target ) > - 1 & & a . getStatistics ( ) : a . getStatistics ( ) } , a . interval ) ) } , resize : function ( ) { if ( this . isUpdating ) { var a , b = this ; _ . each ( this . graphs , function ( c ) { a = b . getCurrentSize ( c . maindiv_ . id ) , c . resize ( a . width , a . height ) } ) , this . detailGraph & & ( a = this . getCurrentSize ( this . detailGraph . maindiv_ . id ) , this . detailGraph . resize ( a . width , a . height ) ) , this . prepareD3Charts ( ! 0 ) , this . prepareResidentSize ( ! 0 ) } } , template : templateEngine . createTemplate ( " dashboardView . ejs " ) , render : function ( a ) { var b = function ( a , b ) { return b | | $ ( this . el ) . html ( this . template . render ( ) ) , a & & " _system " = = = frontendConfig . db ? ( this . prepareDygraphs ( ) , this . isUpdating & & ( this . prepareD3Charts ( ) , this . prepareResidentSize ( ) , this . updateTendencies ( ) , $ ( window ) . trigger ( " resize " ) ) , this . startUpdating ( ) , void $ ( window ) . resize ( ) ) : ( $ ( this . el ) . html ( " " ) , void ( this . server ? $ ( this . el ) . append ( ' < div style = " color : red " > Server statistics ( ' + this . server + " ) are disabled . < / div > " ) : $ ( this . el ) . append ( ' < div style = " color : red " > Server statistics are disabled . < / div > ' ) ) ) ; <nl> - } . bind ( this ) , c = function ( ) { $ ( this . el ) . html ( " " ) , $ ( " . contentDiv " ) . remove ( ) , $ ( " . headerBar " ) . remove ( ) , $ ( " . dashboard - headerbar " ) . remove ( ) , $ ( " . dashboard - row " ) . remove ( ) , $ ( this . el ) . append ( ' < div style = " color : red " > You do not have permission to view this page . < / div > ' ) , $ ( this . el ) . append ( " < div style = \ " color : red \ " > You can switch to ' _system ' to see the dashboard . < / div > " ) } . bind ( this ) ; if ( " _system " ! = = frontendConfig . db ) return void c ( ) ; var d = function ( d , e ) { d | | ( e ? this . getStatistics ( b , a ) : c ( ) ) } . bind ( this ) ; void 0 = = = window . App . currentDB . get ( " name " ) ? window . setTimeout ( function ( ) { return " _system " ! = = window . App . currentDB . get ( " name " ) ? void c ( ) : void this . options . database . hasSystemAccess ( d ) } . bind ( this ) , 300 ) : this . options . database . hasSystemAccess ( d ) } } ) } ( ) , function ( ) { " use strict " ; window . DatabaseView = Backbone . View . extend ( { users : null , el : " # content " , template : templateEngine . createTemplate ( " databaseView . ejs " ) , dropdownVisible : ! 1 , currentDB : " " , events : { " click # createDatabase " : " createDatabase " , " click # submitCreateDatabase " : " submitCreateDatabase " , " click . editDatabase " : " editDatabase " , " click # userManagementView . icon " : " editDatabase " , " click # selectDatabase " : " updateDatabase " , " click # submitDeleteDatabase " : " submitDeleteDatabase " , " click . contentRowInactive a " : " changeDatabase " , " keyup # databaseSearchInput " : " search " , " click # databaseSearchSubmit " : " search " , " click # databaseToggle " : " toggleSettingsDropdown " , " click . css - label " : " checkBoxes " , " click # dbSortDesc " : " sorting " } , sorting : function ( ) { $ ( " # dbSortDesc " ) . is ( " : checked " ) ? this . collection . setSortingDesc ( ! 0 ) : this . collection . setSortingDesc ( ! 1 ) , $ ( " # databaseDropdown " ) . is ( " : visible " ) ? this . dropdownVisible = ! 0 : this . dropdownVisible = ! 1 , this . render ( ) } , initialize : function ( ) { this . collection . fetch ( { async : ! 0 , cache : ! 1 } ) } , checkBoxes : function ( a ) { var b = a . currentTarget . id ; $ ( " # " + b ) . click ( ) } , render : function ( ) { var a = function ( a , b ) { a ? arangoHelper . arangoError ( " DB " , " Could not get current db properties " ) : ( this . currentDB = b , this . collection . sort ( ) , $ ( this . el ) . html ( this . template . render ( { collection : this . collection , searchString : " " , currentDB : this . currentDB } ) ) , this . dropdownVisible = = = ! 0 & & ( $ ( " # dbSortDesc " ) . attr ( " checked " , this . collection . sortOptions . desc ) , $ ( " # databaseToggle " ) . toggleClass ( " activated " ) , $ ( " # databaseDropdown2 " ) . show ( ) ) , arangoHelper . setCheckboxStatus ( " # databaseDropdown " ) , this . replaceSVGs ( ) ) } . bind ( this ) ; return this . collection . getCurrentDatabase ( a ) , this } , toggleSettingsDropdown : function ( ) { $ ( " # dbSortDesc " ) . attr ( " checked " , this . collection . sortOptions . desc ) , $ ( " # databaseToggle " ) . toggleClass ( " activated " ) , $ ( " # databaseDropdown2 " ) . slideToggle ( 200 ) } , selectedDatabase : function ( ) { return $ ( " # selectDatabases " ) . val ( ) } , handleError : function ( a , b , c ) { return 409 = = = a ? void arangoHelper . arangoError ( " DB " , " Database " + c + " already exists . " ) : 400 = = = a ? void arangoHelper . arangoError ( " DB " , " Invalid Parameters " ) : 403 = = = a ? void arangoHelper . arangoError ( " DB " , " Insufficent rights . Execute this from _system database " ) : void 0 } , validateDatabaseInfo : function ( a , b ) { return " " = = = b ? ( arangoHelper . arangoError ( " DB " , " You have to define an owner for the new database " ) , ! 1 ) : " " = = = a ? ( arangoHelper . arangoError ( " DB " , " You have to define a name for the new database " ) , ! 1 ) : 0 = = = a . indexOf ( " _ " ) ? ( arangoHelper . arangoError ( " DB " , " Databasename should not start with _ " ) , ! 1 ) : a . match ( / ^ [ a - zA - Z ] [ a - zA - Z0 - 9_ \ - ] * $ / ) ? ! 0 : ( arangoHelper . arangoError ( " DB " , " Databasename may only contain numbers , letters , _ and - " ) , ! 1 ) } , createDatabase : function ( a ) { a . preventDefault ( ) , this . createAddDatabaseModal ( ) } , switchDatabase : function ( a ) { if ( ! $ ( a . target ) . parent ( ) . hasClass ( " iconSet " ) ) { var b = $ ( a . currentTarget ) . find ( " h5 " ) . text ( ) ; if ( " " ! = = b ) { var c = this . collection . createDatabaseURL ( b ) ; window . location . replace ( c ) } } } , submitCreateDatabase : function ( ) { var a = this , b = $ ( " # newDatabaseName " ) . val ( ) , c = $ ( " # newUser " ) . val ( ) , d = { name : b } ; this . collection . create ( d , { error : function ( c , d ) { a . handleError ( d . status , d . statusText , b ) } , success : function ( d ) { " root " ! = = c & & $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( c ) + " / database / " + encodeURIComponent ( b ) ) , contentType : " application / json " , data : JSON . stringify ( { grant : " rw " } ) } ) , $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / user / root / database / " + encodeURIComponent ( b ) ) , contentType : " application / json " , data : JSON . stringify ( { grant : " rw " } ) } ) , " # databases " = = = window . location . hash & & a . updateDatabases ( ) , arangoHelper . arangoNotification ( " Database " + d . get ( " name " ) + " created . " ) } } ) , arangoHelper . arangoNotification ( " Database creation in progress . " ) , window . modalView . hide ( ) } , submitDeleteDatabase : function ( a ) { var b = this . collection . where ( { name : a } ) ; b [ 0 ] . destroy ( { wait : ! 0 , url : arangoHelper . databaseUrl ( " / _api / database / " + a ) } ) , this . updateDatabases ( ) , window . App . naviView . dbSelectionView . render ( $ ( " # dbSelect " ) ) , window . modalView . hide ( ) } , changeDatabase : function ( a ) { var b = $ ( a . currentTarget ) . attr ( " id " ) , c = this . collection . createDatabaseURL ( b ) ; window . location . replace ( c ) } , updateDatabases : function ( ) { var a = this ; this . collection . fetch ( { cache : ! 1 , success : function ( ) { a . render ( ) , window . App . handleSelectDatabase ( ) } } ) } , editDatabase : function ( a ) { var b = this . evaluateDatabaseName ( $ ( a . currentTarget ) . attr ( " id " ) , " _edit - database " ) , c = ! 0 ; b = = = this . currentDB & & ( c = ! 1 ) , this . createEditDatabaseModal ( b , c ) } , search : function ( ) { var a , b , c , d ; a = $ ( " # databaseSearchInput " ) , b = $ ( " # databaseSearchInput " ) . val ( ) , d = this . collection . filter ( function ( a ) { return - 1 ! = = a . get ( " name " ) . indexOf ( b ) } ) , $ ( this . el ) . html ( this . template . render ( { collection : d , searchString : b , currentDB : this . currentDB } ) ) , this . replaceSVGs ( ) , a = $ ( " # databaseSearchInput " ) , c = a . val ( ) . length , a . focus ( ) , a [ 0 ] . setSelectionRange ( c , c ) } , replaceSVGs : function ( ) { $ ( " . svgToReplace " ) . each ( function ( ) { var a = $ ( this ) , b = a . attr ( " id " ) , c = a . attr ( " src " ) ; $ . get ( c , function ( c ) { var d = $ ( c ) . find ( " svg " ) ; d . attr ( " id " , b ) . attr ( " class " , " tile - icon - svg " ) . removeAttr ( " xmlns : a " ) , a . replaceWith ( d ) } , " xml " ) } ) } , evaluateDatabaseName : function ( a , b ) { var c = a . lastIndexOf ( b ) ; return a . substring ( 0 , c ) } , createEditDatabaseModal : function ( a , b ) { var c = [ ] , d = [ ] ; d . push ( window . modalView . createReadOnlyEntry ( " id_name " , " Name " , a , " " ) ) , b ? c . push ( window . modalView . createDeleteButton ( " Delete " , this . submitDeleteDatabase . bind ( this , a ) ) ) : c . push ( window . modalView . createDisabledButton ( " Delete " ) ) , window . modalView . show ( " modalTable . ejs " , " Delete database " , c , d ) } , createAddDatabaseModal : function ( ) { var a = [ ] , b = [ ] ; b . push ( window . modalView . createTextEntry ( " newDatabaseName " , " Name " , " " , ! 1 , " Database Name " , ! 0 , [ { rule : Joi . string ( ) . regex ( / ^ [ a - zA - Z ] / ) , msg : " Database name must start with a letter . " } , { rule : Joi . string ( ) . regex ( / ^ [ a - zA - Z0 - 9 \ - _ ] * $ / ) , msg : ' Only Symbols " _ " and " - " are allowed . ' } , { rule : Joi . string ( ) . required ( ) , msg : " No database name given . " } ] ) ) ; var c = [ ] ; window . App . userCollection . each ( function ( a ) { c . push ( { value : a . get ( " user " ) , label : a . get ( " user " ) } ) } ) , b . push ( window . modalView . createSelectEntry ( " newUser " , " Username " , null ! = = this . users ? this . users . whoAmI ( ) : " root " , " Please define the owner of this database . This will be the only user having initial access to this database if authentication is turned on . Please note that if you specify a username different to your account you will not be able to access the database with your account after having creating it . Specifying a username is mandatory even with authentication turned off . If there is a failure you will be informed . " , c ) ) , a . push ( window . modalView . createSuccessButton ( " Create " , this . submitCreateDatabase . bind ( this ) ) ) , window . modalView . show ( " modalTable . ejs " , " Create Database " , a , b ) , $ ( " # useDefaultPassword " ) . change ( function ( ) { " true " = = = $ ( " # useDefaultPassword " ) . val ( ) ? $ ( " # row_newPassword " ) . hide ( ) : $ ( " # row_newPassword " ) . show ( ) } ) , $ ( " # row_newPassword " ) . hide ( ) } } ) } ( ) , function ( ) { " use strict " ; window . DBSelectionView = Backbone . View . extend ( { template : templateEngine . createTemplate ( " dbSelectionView . ejs " ) , events : { " click . dbSelectionLink " : " changeDatabase " } , initialize : function ( a ) { this . current = a . current } , changeDatabase : function ( a ) { var b = $ ( a . currentTarget ) . closest ( " . dbSelectionLink . tab " ) . attr ( " id " ) , c = this . collection . createDatabaseURL ( b ) ; window . location . replace ( c ) } , render : function ( a ) { var b = function ( b , c ) { b ? arangoHelper . arangoError ( " DB " , " Could not fetch databases " ) : ( this . $ el = a , this . $ el . html ( this . template . render ( { list : c , current : this . current . get ( " name " ) } ) ) , this . delegateEvents ( ) ) } . bind ( this ) ; return this . collection . getDatabasesForUser ( b ) , this . el } } ) } ( ) , function ( ) { " use strict " ; window . DocumentsView = window . PaginationView . extend ( { filters : { 0 : ! 0 } , filterId : 0 , paginationDiv : " # documentsToolbarF " , idPrefix : " documents " , addDocumentSwitch : ! 0 , activeFilter : ! 1 , lastCollectionName : void 0 , restoredFilters : [ ] , editMode : ! 1 , allowUpload : ! 1 , el : " # content " , table : " # documentsTableID " , template : templateEngine . createTemplate ( " documentsView . ejs " ) , collectionContext : { prev : null , next : null } , editButtons : [ " # deleteSelected " , " # moveSelected " ] , initialize : function ( a ) { this . documentStore = a . documentStore , this . collectionsStore = a . collectionsStore , this . tableView = new window . TableView ( { el : this . table , collection : this . collection } ) , this . tableView . setRowClick ( this . clicked . bind ( this ) ) , this . tableView . setRemoveClick ( this . remove . bind ( this ) ) } , resize : function ( ) { $ ( " # docPureTable " ) . height ( $ ( " . centralRow " ) . height ( ) - 210 ) , $ ( " # docPureTable . pure - table - body " ) . css ( " max - height " , $ ( " # docPureTable " ) . height ( ) - 47 ) } , setCollectionId : function ( a , b ) { this . collection . setCollection ( a ) , this . collection . setPage ( b ) , this . page = b ; var c = function ( b , c ) { b ? arangoHelper . arangoError ( " Error " , " Could not get collection properties . " ) : ( this . type = c , this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , this . collectionModel = this . collectionsStore . get ( a ) ) } . bind ( this ) ; arangoHelper . collectionApiType ( a , null , c ) } , getDocsCallback : function ( a ) { $ ( " # documents_last " ) . css ( " visibility " , " hidden " ) , $ ( " # documents_first " ) . css ( " visibility " , " hidden " ) , a ? ( window . progressView . hide ( ) , arangoHelper . arangoError ( " Document error " , " Could not fetch requested documents . " ) ) : a & & void 0 = = = a | | ( window . progressView . hide ( ) , this . drawTable ( ) , this . renderPaginationElements ( ) ) } , events : { " click # collectionPrev " : " prevCollection " , " click # collectionNext " : " nextCollection " , " click # filterCollection " : " filterCollection " , " click # markDocuments " : " editDocuments " , " click # importCollection " : " importCollection " , " click # exportCollection " : " exportCollection " , " click # filterSend " : " sendFilter " , " click # addFilterItem " : " addFilterItem " , " click . removeFilterItem " : " removeFilterItem " , " click # deleteSelected " : " deleteSelectedDocs " , " click # moveSelected " : " moveSelectedDocs " , " click # addDocumentButton " : " addDocumentModal " , " click # documents_first " : " firstDocuments " , " click # documents_last " : " lastDocuments " , " click # documents_prev " : " prevDocuments " , " click # documents_next " : " nextDocuments " , " click # confirmDeleteBtn " : " confirmDelete " , " click . key " : " nop " , keyup : " returnPressedHandler " , " keydown . queryline input " : " filterValueKeydown " , " click # importModal " : " showImportModal " , " click # resetView " : " resetView " , " click # confirmDocImport " : " startUpload " , " click # exportDocuments " : " startDownload " , " change # documentSize " : " setPagesize " , " change # docsSort " : " setSorting " } , showSpinner : function ( ) { $ ( " # uploadIndicator " ) . show ( ) } , hideSpinner : function ( ) { $ ( " # uploadIndicator " ) . hide ( ) } , showImportModal : function ( ) { $ ( " # docImportModal " ) . modal ( " show " ) } , hideImportModal : function ( ) { $ ( " # docImportModal " ) . modal ( " hide " ) } , setPagesize : function ( ) { var a = $ ( " # documentSize " ) . find ( " : selected " ) . val ( ) ; this . collection . setPagesize ( a ) , this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) } , setSorting : function ( ) { var a = $ ( " # docsSort " ) . val ( ) ; " " ! = = a & & void 0 ! = = a & & null ! = = a | | ( a = " _key " ) , this . collection . setSort ( a ) } , returnPressedHandler : function ( a ) { 13 = = = a . keyCode & & $ ( a . target ) . is ( $ ( " # docsSort " ) ) & & this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , 13 = = = a . keyCode & & $ ( " # confirmDeleteBtn " ) . attr ( " disabled " ) = = = ! 1 & & this . confirmDelete ( ) } , nop : function ( a ) { a . stopPropagation ( ) } , resetView : function ( ) { var a = function ( a ) { a & & arangoHelper . arangoError ( " Document " , " Could not fetch documents count " ) } ; $ ( " input " ) . val ( " " ) , $ ( " select " ) . val ( " = = " ) , this . removeAllFilterItems ( ) , $ ( " # documentSize " ) . val ( this . collection . getPageSize ( ) ) , $ ( " # documents_last " ) . css ( " visibility " , " visible " ) , $ ( " # documents_first " ) . css ( " visibility " , " visible " ) , this . addDocumentSwitch = ! 0 , this . collection . resetFilter ( ) , this . collection . loadTotal ( a ) , this . restoredFilters = [ ] , this . allowUpload = ! 1 , this . files = void 0 , this . file = void 0 , $ ( " # confirmDocImport " ) . attr ( " disabled " , ! 0 ) , this . markFilterToggle ( ) , this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) } , startDownload : function ( ) { var a = this . collection . buildDownloadDocumentQuery ( ) ; " " ! = = a | | void 0 ! = = a | | null ! = = a ? window . open ( encodeURI ( " query / result / download / " + btoa ( JSON . stringify ( a ) ) ) ) : arangoHelper . arangoError ( " Document error " , " could not download documents " ) } , startUpload : function ( ) { var a = function ( a , b ) { a ? ( arangoHelper . arangoError ( " Upload " , b ) , this . hideSpinner ( ) ) : ( this . hideSpinner ( ) , this . hideImportModal ( ) , this . resetView ( ) ) } . bind ( this ) ; this . allowUpload = = = ! 0 & & ( this . showSpinner ( ) , this . collection . uploadDocuments ( this . file , a ) ) } , uploadSetup : function ( ) { var a = this ; $ ( " # importDocuments " ) . change ( function ( b ) { a . files = b . target . files | | b . dataTransfer . files , a . file = a . files [ 0 ] , $ ( " # confirmDocImport " ) . attr ( " disabled " , ! 1 ) , a . allowUpload = ! 0 } ) } , buildCollectionLink : function ( a ) { return " collection / " + encodeURIComponent ( a . get ( " name " ) ) + " / documents / 1 " } , markFilterToggle : function ( ) { this . restoredFilters . length > 0 ? $ ( " # filterCollection " ) . addClass ( " activated " ) : $ ( " # filterCollection " ) . removeClass ( " activated " ) } , editDocuments : function ( ) { $ ( " # importCollection " ) . removeClass ( " activated " ) , $ ( " # exportCollection " ) . removeClass ( " activated " ) , this . markFilterToggle ( ) , $ ( " # markDocuments " ) . toggleClass ( " activated " ) , this . changeEditMode ( ) , $ ( " # filterHeader " ) . hide ( ) , $ ( " # importHeader " ) . hide ( ) , $ ( " # editHeader " ) . slideToggle ( 200 ) , $ ( " # exportHeader " ) . hide ( ) } , filterCollection : function ( ) { $ ( " # importCollection " ) . removeClass ( " activated " ) , $ ( " # exportCollection " ) . removeClass ( " activated " ) , $ ( " # markDocuments " ) . removeClass ( " activated " ) , this . changeEditMode ( ! 1 ) , this . markFilterToggle ( ) , this . activeFilter = ! 0 , $ ( " # importHeader " ) . hide ( ) , $ ( " # editHeader " ) . hide ( ) , $ ( " # exportHeader " ) . hide ( ) , $ ( " # filterHeader " ) . slideToggle ( 200 ) ; var a ; for ( a in this . filters ) if ( this . filters . hasOwnProperty ( a ) ) return void $ ( " # attribute_name " + a ) . focus ( ) } , exportCollection : function ( ) { $ ( " # importCollection " ) . removeClass ( " activated " ) , $ ( " # filterHeader " ) . removeClass ( " activated " ) , $ ( " # markDocuments " ) . removeClass ( " activated " ) , this . changeEditMode ( ! 1 ) , $ ( " # exportCollection " ) . toggleClass ( " activated " ) , this . markFilterToggle ( ) , $ ( " # exportHeader " ) . slideToggle ( 200 ) , $ ( " # importHeader " ) . hide ( ) , $ ( " # filterHeader " ) . hide ( ) , $ ( " # editHeader " ) . hide ( ) } , importCollection : function ( ) { this . markFilterToggle ( ) , $ ( " # markDocuments " ) . removeClass ( " activated " ) , this . changeEditMode ( ! 1 ) , $ ( " # importCollection " ) . toggleClass ( " activated " ) , $ ( " # exportCollection " ) . removeClass ( " activated " ) , $ ( " # importHeader " ) . slideToggle ( 200 ) , $ ( " # filterHeader " ) . hide ( ) , $ ( " # editHeader " ) . hide ( ) , $ ( " # exportHeader " ) . hide ( ) } , changeEditMode : function ( a ) { a = = = ! 1 | | this . editMode = = = ! 0 ? ( $ ( " # docPureTable . pure - table - body . pure - table - row " ) . css ( " cursor " , " default " ) , $ ( " . deleteButton " ) . fadeIn ( ) , $ ( " . addButton " ) . fadeIn ( ) , $ ( " . selected - row " ) . removeClass ( " selected - row " ) , this . editMode = ! 1 , this . tableView . setRowClick ( this . clicked . bind ( this ) ) ) : ( $ ( " # docPureTable . pure - table - body . pure - table - row " ) . css ( " cursor " , " copy " ) , $ ( " . deleteButton " ) . fadeOut ( ) , $ ( " . addButton " ) . fadeOut ( ) , $ ( " . selectedCount " ) . text ( 0 ) , this . editMode = ! 0 , this . tableView . setRowClick ( this . editModeClick . bind ( this ) ) ) } , getFilterContent : function ( ) { var a , b , c = [ ] ; for ( a in this . filters ) if ( this . filters . hasOwnProperty ( a ) ) { b = $ ( " # attribute_value " + a ) . val ( ) ; try { b = JSON . parse ( b ) } catch ( d ) { b = String ( b ) } " " ! = = $ ( " # attribute_name " + a ) . val ( ) & & c . push ( { attribute : $ ( " # attribute_name " + a ) . val ( ) , operator : $ ( " # operator " + a ) . val ( ) , value : b } ) } return c } , sendFilter : function ( ) { this . restoredFilters = this . getFilterContent ( ) ; var a = this ; this . collection . resetFilter ( ) , this . addDocumentSwitch = ! 1 , _ . each ( this . restoredFilters , function ( b ) { void 0 ! = = b . operator & & a . collection . addFilter ( b . attribute , b . operator , b . value ) } ) , this . collection . setToFirst ( ) , this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , this . markFilterToggle ( ) } , restoreFilter : function ( ) { var a = this , b = 0 ; this . filterId = 0 , $ ( " # docsSort " ) . val ( this . collection . getSort ( ) ) , _ . each ( this . restoredFilters , function ( c ) { 0 ! = = b & & a . addFilterItem ( ) , void 0 ! = = c . operator & & ( $ ( " # attribute_name " + b ) . val ( c . attribute ) , $ ( " # operator " + b ) . val ( c . operator ) , $ ( " # attribute_value " + b ) . val ( c . value ) ) , b + + , a . collection . addFilter ( c . attribute , c . operator , c . value ) } ) } , addFilterItem : function ( ) { var a = + + this . filterId ; $ ( " # filterHeader " ) . append ( ' < div class = " queryline querylineAdd " > < input id = " attribute_name ' + a + ' " type = " text " placeholder = " Attribute name " > < select name = " operator " id = " operator ' + a + ' " class = " filterSelect " > < option value = " = = " > = = < / option > < option value = " ! = " > ! = < / option > < option value = " & lt ; " > & lt ; < / option > < option value = " & lt ; = " > & lt ; = < / option > < option value = " & gt ; = " > & gt ; = < / option > < option value = " & gt ; " > & gt ; < / option > < / select > < input id = " attribute_value ' + a + ' " type = " text " placeholder = " Attribute value " class = " filterValue " > < a class = " removeFilterItem " id = " removeFilter ' + a + ' " > < i class = " icon icon - minus arangoicon " > < / i > < / a > < / div > ' ) , this . filters [ a ] = ! 0 } , filterValueKeydown : function ( a ) { 13 = = = a . keyCode & & this . sendFilter ( ) } , removeFilterItem : function ( a ) { var b = a . currentTarget , c = b . id . replace ( / ^ removeFilter / , " " ) ; delete this . filters [ c ] , delete this . restoredFilters [ c ] , $ ( b . parentElement ) . remove ( ) } , removeAllFilterItems : function ( ) { var a , b = $ ( " # filterHeader " ) . children ( ) . length ; for ( a = 1 ; b > = a ; a + + ) $ ( " # removeFilter " + a ) . parent ( ) . remove ( ) ; this . filters = { 0 : ! 0 } , this . filterId = 0 } , addDocumentModal : function ( ) { var a = window . location . hash . split ( " / " ) [ 1 ] , b = [ ] , c = [ ] , d = function ( a , d ) { a ? arangoHelper . arangoError ( " Error " , " Could not fetch collection type " ) : " edge " = = = d ? ( c . push ( window . modalView . createTextEntry ( " new - edge - from - attr " , " _from " , " " , " document _id : document handle of the linked vertex ( incoming relation ) " , void 0 , ! 1 , [ { rule : Joi . string ( ) . required ( ) , msg : " No _from attribute given . " } ] ) ) , c . push ( window . modalView . createTextEntry ( " new - edge - to " , " _to " , " " , " document _id : document handle of the linked vertex ( outgoing relation ) " , void 0 , ! 1 , [ { rule : Joi . string ( ) . required ( ) , msg : " No _to attribute given . " } ] ) ) , c . push ( window . modalView . createTextEntry ( " new - edge - key - attr " , " _key " , void 0 , " the edges unique key ( optional attribute , leave empty for autogenerated key " , " is optional : leave empty for autogenerated key " , ! 1 , [ { rule : Joi . string ( ) . allow ( " " ) . optional ( ) , msg : " " } ] ) ) , b . push ( window . modalView . createSuccessButton ( " Create " , this . addEdge . bind ( this ) ) ) , window . modalView . show ( " modalTable . ejs " , " Create edge " , b , c ) ) : ( c . push ( window . modalView . createTextEntry ( " new - document - key - attr " , " _key " , void 0 , " the documents unique key ( optional attribute , leave empty for autogenerated key " , " is optional : leave empty for autogenerated key " , ! 1 , [ { rule : Joi . string ( ) . allow ( " " ) . optional ( ) , msg : " " } ] ) ) , b . push ( window . modalView . createSuccessButton ( " Create " , this . addDocument . bind ( this ) ) ) , window . modalView . show ( " modalTable . ejs " , " Create document " , b , c ) ) } . bind ( this ) ; arangoHelper . collectionApiType ( a , ! 0 , d ) } , addEdge : function ( ) { var a , b = window . location . hash . split ( " / " ) [ 1 ] , c = $ ( " . modal - body # new - edge - from - attr " ) . last ( ) . val ( ) , d = $ ( " . modal - body # new - edge - to " ) . last ( ) . val ( ) , e = $ ( " . modal - body # new - edge - key - attr " ) . last ( ) . val ( ) , f = function ( b , c ) { if ( b ) arangoHelper . arangoError ( " Error " , " Could not create edge " ) ; else { window . modalView . hide ( ) , c = c . _id . split ( " / " ) ; try { a = " collection / " + c [ 0 ] + " / " + c [ 1 ] , decodeURI ( a ) } catch ( d ) { a = " collection / " + c [ 0 ] + " / " + encodeURIComponent ( c [ 1 ] ) } window . location . hash = a } } ; " " ! = = e | | void 0 ! = = e ? this . documentStore . createTypeEdge ( b , c , d , e , f ) : this . documentStore . createTypeEdge ( b , c , d , null , f ) } , addDocument : function ( ) { var a , b = window . location . hash . split ( " / " ) [ 1 ] , c = $ ( " . modal - body # new - document - key - attr " ) . last ( ) . val ( ) , d = function ( b , c ) { if ( b ) arangoHelper . arangoError ( " Error " , " Could not create document " ) ; else { window . modalView . hide ( ) , c = c . split ( " / " ) ; try { a = " collection / " + c [ 0 ] + " / " + c [ 1 ] , decodeURI ( a ) } catch ( d ) { a = " collection / " + c [ 0 ] + " / " + encodeURIComponent ( c [ 1 ] ) } window . location . hash = a } } ; " " ! = = c | | void 0 ! = = c ? this . documentStore . createTypeDocument ( b , c , d ) : this . documentStore . createTypeDocument ( b , null , d ) } , moveSelectedDocs : function ( ) { var a = [ ] , b = [ ] , c = this . getSelectedDocs ( ) ; 0 ! = = c . length & & ( b . push ( window . modalView . createTextEntry ( " move - documents - to " , " Move to " , " " , ! 1 , " collection - name " , ! 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 . " } ] ) ) , a . push ( window . modalView . createSuccessButton ( " Move " , this . confirmMoveSelectedDocs . bind ( this ) ) ) , window . modalView . show ( " modalTable . ejs " , " Move documents " , a , b ) ) } , confirmMoveSelectedDocs : function ( ) { var a = this . getSelectedDocs ( ) , b = this , c = $ ( " . modal - body " ) . last ( ) . find ( " # move - documents - to " ) . val ( ) , d = function ( ) { this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , $ ( " # markDocuments " ) . click ( ) , window . modalView . hide ( ) } . bind ( this ) ; _ . each ( a , function ( a ) { b . collection . moveDocument ( a , b . collection . collectionID , c , d ) } ) } , deleteSelectedDocs : function ( ) { var a = [ ] , b = [ ] , c = this . getSelectedDocs ( ) ; 0 ! = = c . length & & ( b . push ( window . modalView . createReadOnlyEntry ( void 0 , c . length + " documents selected " , " Do you want to delete all selected documents ? " , void 0 , void 0 , ! 1 , void 0 ) ) , a . push ( window . modalView . createDeleteButton ( " Delete " , this . confirmDeleteSelectedDocs . bind ( this ) ) ) , window . modalView . show ( " modalTable . ejs " , " Delete documents " , a , b ) ) } , confirmDeleteSelectedDocs : function ( ) { var a = this . getSelectedDocs ( ) , b = [ ] , c = this ; _ . each ( a , function ( a ) { if ( " document " = = = c . type ) { var d = function ( a ) { a ? ( b . push ( ! 1 ) , arangoHelper . arangoError ( " Document error " , " Could not delete document . " ) ) : ( b . push ( ! 0 ) , c . collection . setTotalMinusOne ( ) , c . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , $ ( " # markDocuments " ) . click ( ) , window . modalView . hide ( ) ) } . bind ( c ) ; c . documentStore . deleteDocument ( c . collection . collectionID , a , d ) } else if ( " edge " = = = c . type ) { var e = function ( a ) { a ? ( b . push ( ! 1 ) , arangoHelper . arangoError ( " Edge error " , " Could not delete edge " ) ) : ( c . collection . setTotalMinusOne ( ) , b . push ( ! 0 ) , c . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , $ ( " # markDocuments " ) . click ( ) , window . modalView . hide ( ) ) } . bind ( c ) ; c . documentStore . deleteEdge ( c . collection . collectionID , a , e ) } } ) } , getSelectedDocs : function ( ) { var a = [ ] ; return _ . each ( $ ( " # docPureTable . pure - table - body . pure - table - row " ) , function ( b ) { $ ( b ) . hasClass ( " selected - row " ) & & a . push ( $ ( $ ( b ) . children ( ) [ 1 ] ) . find ( " . key " ) . text ( ) ) } ) , a } , remove : function ( a ) { this . docid = $ ( a . currentTarget ) . parent ( ) . parent ( ) . prev ( ) . find ( " . key " ) . text ( ) , $ ( " # confirmDeleteBtn " ) . attr ( " disabled " , ! 1 ) , $ ( " # docDeleteModal " ) . modal ( " show " ) } , confirmDelete : function ( ) { $ ( " # confirmDeleteBtn " ) . attr ( " disabled " , ! 0 ) ; var a = window . location . hash . split ( " / " ) , b = a [ 3 ] ; " source " ! = = b & & this . reallyDelete ( ) } , reallyDelete : function ( ) { if ( " document " = = = this . type ) { var a = function ( a ) { a ? arangoHelper . arangoError ( " Error " , " Could not delete document " ) : ( this . collection . setTotalMinusOne ( ) , this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , $ ( " # docDeleteModal " ) . modal ( " hide " ) ) } . bind ( this ) ; this . documentStore . deleteDocument ( this . collection . collectionID , this . docid , a ) } else if ( " edge " = = = this . type ) { var b = function ( a ) { a ? arangoHelper . arangoError ( " Edge error " , " Could not delete edge " ) : ( this . collection . setTotalMinusOne ( ) , this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , $ ( " # docDeleteModal " ) . modal ( " hide " ) ) } . bind ( this ) ; this . documentStore . deleteEdge ( this . collection . collectionID , this . docid , b ) } } , editModeClick : function ( a ) { var b = $ ( a . currentTarget ) ; b . hasClass ( " selected - row " ) ? b . removeClass ( " selected - row " ) : b . addClass ( " selected - row " ) ; var c = this . getSelectedDocs ( ) ; $ ( " . selectedCount " ) . text ( c . length ) , _ . each ( this . editButtons , function ( a ) { c . length > 0 ? ( $ ( a ) . prop ( " disabled " , ! 1 ) , $ ( a ) . removeClass ( " button - neutral " ) , $ ( a ) . removeClass ( " disabled " ) , " # moveSelected " = = = a ? $ ( a ) . addClass ( " button - success " ) : $ ( a ) . addClass ( " button - danger " ) ) : ( $ ( a ) . prop ( " disabled " , ! 0 ) , $ ( a ) . addClass ( " disabled " ) , $ ( a ) . addClass ( " button - neutral " ) , " # moveSelected " = = = a ? $ ( a ) . removeClass ( " button - success " ) : $ ( a ) . removeClass ( " button - danger " ) ) } ) } , clicked : function ( a ) { var b , c = a . currentTarget , d = $ ( c ) . attr ( " id " ) . substr ( 4 ) ; try { b = " collection / " + this . collection . collectionID + " / " + d , decodeURI ( d ) } catch ( e ) { b = " collection / " + this . collection . collectionID + " / " + encodeURIComponent ( d ) } window . location . hash = b } , drawTable : function ( ) { this . tableView . setElement ( $ ( " # docPureTable " ) ) . render ( ) , arangoHelper . fixTooltips ( " . icon_arangodb , . arangoicon " , " top " ) , $ ( " . prettify " ) . snippet ( " javascript " , { style : " nedit " , menu : ! 1 , startText : ! 1 , transparent : ! 0 , showNum : ! 1 } ) , this . resize ( ) } , checkCollectionState : function ( ) { this . lastCollectionName = = = this . collectionName ? this . activeFilter & & ( this . filterCollection ( ) , this . restoreFilter ( ) ) : void 0 ! = = this . lastCollectionName & & ( this . collection . resetFilter ( ) , this . collection . setSort ( " " ) , this . restoredFilters = [ ] , this . activeFilter = ! 1 ) } , render : function ( ) { return $ ( this . el ) . html ( this . template . render ( { } ) ) , 2 = = = this . type ? this . type = " document " : 3 = = = this . type & & ( this . type = " edge " ) , this . tableView . setElement ( $ ( this . table ) ) . drawLoading ( ) , this . collectionContext = this . collectionsStore . getPosition ( this . collection . collectionID ) , this . collectionName = window . location . hash . split ( " / " ) [ 1 ] , this . breadcrumb ( ) , window . arangoHelper . buildCollectionSubNav ( this . collectionName , " Content " ) , this . checkCollectionState ( ) , this . lastCollectionName = this . collectionName , this . uploadSetup ( ) , $ ( " [ data - toggle = tooltip ] " ) . tooltip ( ) , $ ( " . upload - info " ) . tooltip ( ) , arangoHelper . fixTooltips ( " . icon_arangodb , . arangoicon " , " top " ) , this . renderPaginationElements ( ) , this . selectActivePagesize ( ) , this . markFilterToggle ( ) , this . resize ( ) , this } , rerender : function ( ) { this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , this . resize ( ) } , selectActivePagesize : function ( ) { $ ( " # documentSize " ) . val ( this . collection . getPageSize ( ) ) } , renderPaginationElements : function ( ) { this . renderPagination ( ) ; var a = $ ( " # totalDocuments " ) ; 0 = = = a . length & & ( $ ( " # documentsToolbarFL " ) . append ( ' < a id = " totalDocuments " class = " totalDocuments " > < / a > ' ) , a = $ ( " # totalDocuments " ) ) , " document " = = = this . type & & a . html ( numeral ( this . collection . getTotal ( ) ) . format ( " 0 , 0 " ) + " doc ( s ) " ) , " edge " = = = this . type & & a . html ( numeral ( this . collection . getTotal ( ) ) . format ( " 0 , 0 " ) + " edge ( s ) " ) } , breadcrumb : function ( ) { $ ( " # subNavigationBar . breadcrumb " ) . html ( " Collection : " + this . collectionName ) } } ) } ( ) , function ( ) { " use strict " ; var a = function ( a ) { var b = a . split ( " / " ) ; return " collection / " + encodeURIComponent ( b [ 0 ] ) + " / " + encodeURIComponent ( b [ 1 ] ) } ; window . DocumentView = Backbone . View . extend ( { el : " # content " , colid : 0 , docid : 0 , customView : ! 1 , defaultMode : " tree " , template : templateEngine . createTemplate ( " documentView . ejs " ) , events : { " click # saveDocumentButton " : " saveDocument " , " click # deleteDocumentButton " : " deleteDocumentModal " , " click # confirmDeleteDocument " : " deleteDocument " , " click # document - from " : " navigateToDocument " , " click # document - to " : " navigateToDocument " , " keydown # documentEditor . ace_editor " : " keyPress " , " keyup . jsoneditor . search input " : " checkSearchBox " , " click . jsoneditor . modes " : " storeMode " , " click # addDocument " : " addDocument " } , checkSearchBox : function ( a ) { " " = = = $ ( a . currentTarget ) . val ( ) & & this . editor . expandAll ( ) } , addDocument : function ( ) { window . App . documentsView . addDocumentModal ( ) } , storeMode : function ( ) { var a = this ; $ ( " . type - modes " ) . on ( " click " , function ( b ) { a . defaultMode = $ ( b . currentTarget ) . text ( ) . toLowerCase ( ) } ) } , keyPress : function ( a ) { a . ctrlKey & & 13 = = = a . keyCode ? ( a . preventDefault ( ) , this . saveDocument ( ) ) : a . metaKey & & 13 = = = a . keyCode & & ( a . preventDefault ( ) , this . saveDocument ( ) ) } , editor : 0 , setType : function ( a ) { a = 2 = = = a ? " document " : " edge " ; var b = function ( a , b ) { if ( a ) arangoHelper . arangoError ( " Error " , " Could not fetch data . " ) ; else { var c = b + " : " ; this . type = b , this . fillInfo ( c ) , this . fillEditor ( ) } } . bind ( this ) ; " edge " = = = a ? this . collection . getEdge ( this . colid , this . docid , b ) : " document " = = = a & & this . collection . getDocument ( this . colid , this . docid , b ) } , deleteDocumentModal : function ( ) { var a = [ ] , b = [ ] ; b . push ( window . modalView . createReadOnlyEntry ( " doc - delete - button " , " Confirm delete , document id is " , this . type . _id , void 0 , void 0 , ! 1 , / [ < > & ' " ] / ) ) , a . push ( window . modalView . createDeleteButton ( " Delete " , this . deleteDocument . bind ( this ) ) ) , window . modalView . show ( " modalTable . ejs " , " Delete Document " , a , b ) } , deleteDocument : function ( ) { var a = function ( ) { if ( this . customView ) this . customDeleteFunction ( ) ; else { var a = " collection / " + encodeURIComponent ( this . colid ) + " / documents / 1 " ; window . modalView . hide ( ) , window . App . navigate ( a , { trigger : ! 0 } ) } } . bind ( this ) ; if ( this . type . _from & & this . type . _to ) { var b = function ( b ) { b ? arangoHelper . arangoError ( " Edge error " , " Could not delete edge " ) : a ( ) } ; this . collection . deleteEdge ( this . colid , this . docid , b ) } else { var c = function ( b ) { b ? arangoHelper . arangoError ( " Error " , " Could not delete document " ) : a ( ) } ; this . collection . deleteDocument ( this . colid , this . docid , c ) } } , navigateToDocument : function ( a ) { var b = $ ( a . target ) . attr ( " documentLink " ) ; b & & window . App . navigate ( b , { trigger : ! 0 } ) } , fillInfo : function ( ) { var b = this . collection . first ( ) , c = b . get ( " _id " ) , d = b . get ( " _key " ) , e = b . get ( " _rev " ) , f = b . get ( " _from " ) , g = b . get ( " _to " ) ; if ( $ ( " # document - type " ) . css ( " margin - left " , " 10px " ) , $ ( " # document - type " ) . text ( " _id : " ) , $ ( " # document - id " ) . css ( " margin - left " , " 0 " ) , $ ( " # document - id " ) . text ( c ) , $ ( " # document - key " ) . text ( d ) , $ ( " # document - rev " ) . text ( e ) , f & & g ) { var h = a ( f ) , i = a ( g ) ; $ ( " # document - from " ) . text ( f ) , $ ( " # document - from " ) . attr ( " documentLink " , h ) , $ ( " # document - to " ) . text ( g ) , $ ( " # document - to " ) . attr ( " documentLink " , i ) } else $ ( " . edge - info - container " ) . hide ( ) } , fillEditor : function ( ) { var a = this . removeReadonlyKeys ( this . collection . first ( ) . attributes ) ; $ ( " . disabledBread " ) . last ( ) . text ( this . collection . first ( ) . get ( " _key " ) ) , this . editor . set ( a ) , $ ( " . ace_content " ) . attr ( " font - size " , " 11pt " ) } , jsonContentChanged : function ( ) { this . enableSaveButton ( ) } , resize : function ( ) { $ ( " # documentEditor " ) . height ( $ ( " . centralRow " ) . height ( ) - 300 ) } , render : function ( ) { $ ( this . el ) . html ( this . template . render ( { } ) ) , $ ( " # documentEditor " ) . height ( $ ( " . centralRow " ) . height ( ) - 300 ) , this . disableSaveButton ( ) , this . breadcrumb ( ) ; var a = this , b = document . getElementById ( " documentEditor " ) , c = { change : function ( ) { a . jsonContentChanged ( ) } , search : ! 0 , mode : " tree " , modes : [ " tree " , " code " ] , iconlib : " fontawesome4 " } ; return this . editor = new JSONEditor ( b , c ) , this . editor . setMode ( this . defaultMode ) , this } , removeReadonlyKeys : function ( a ) { return _ . omit ( a , [ " _key " , " _id " , " _from " , " _to " , " _rev " ] ) } , saveDocument : function ( ) { if ( void 0 = = = $ ( " # saveDocumentButton " ) . attr ( " disabled " ) ) if ( " _ " = = = this . collection . first ( ) . attributes . _id . substr ( 0 , 1 ) ) { var a = [ ] , b = [ ] ; b . push ( window . modalView . createReadOnlyEntry ( " doc - save - system - button " , " Caution " , " You are modifying a system collection . Really continue ? " , void 0 , void 0 , ! 1 , / [ < > & ' " ] / ) ) , a . push ( window . modalView . createSuccessButton ( " Save " , this . confirmSaveDocument . bind ( this ) ) ) , window . modalView . show ( " modalTable . ejs " , " Modify System Collection " , a , b ) } else this . confirmSaveDocument ( ) } , confirmSaveDocument : function ( ) { window . modalView . hide ( ) ; var a ; try { a = this . editor . get ( ) } catch ( b ) { return this . errorConfirmation ( b ) , void this . disableSaveButton ( ) } if ( a = JSON . stringify ( a ) , this . type . _from & & this . type . _to ) { var c = function ( a ) { a ? arangoHelper . arangoError ( " Error " , " Could not save edge . " ) : ( this . successConfirmation ( ) , this . disableSaveButton ( ) ) } . bind ( this ) ; this . collection . saveEdge ( this . colid , this . docid , this . type . _from , this . type . _to , a , c ) } else { var d = function ( a ) { a ? arangoHelper . arangoError ( " Error " , " Could not save document . " ) : ( this . successConfirmation ( ) , this . disableSaveButton ( ) ) } . bind ( this ) ; this . collection . saveDocument ( this . colid , this . docid , a , d ) } } , successConfirmation : function ( ) { arangoHelper . arangoNotification ( " Document saved . " ) } , errorConfirmation : function ( a ) { arangoHelper . arangoError ( " Document editor : " , a ) } , enableSaveButton : function ( ) { $ ( " # saveDocumentButton " ) . prop ( " disabled " , ! 1 ) , $ ( " # saveDocumentButton " ) . addClass ( " button - success " ) , $ ( " # saveDocumentButton " ) . removeClass ( " button - close " ) } , disableSaveButton : function ( ) { $ ( " # saveDocumentButton " ) . prop ( " disabled " , ! 0 ) , $ ( " # saveDocumentButton " ) . addClass ( " button - close " ) , $ ( " # saveDocumentButton " ) . removeClass ( " button - success " ) } , breadcrumb : function ( ) { var a = window . location . hash . split ( " / " ) ; $ ( " # subNavigationBar . breadcrumb " ) . html ( ' < a href = " # collection / ' + a [ 1 ] + ' / documents / 1 " > Collection : ' + a [ 1 ] + ' < / a > < i class = " fa fa - chevron - right " > < / i > Document : ' + a [ 2 ] ) } , escaped : function ( a ) { return a . replace ( / & / g , " & amp ; " ) . replace ( / < / g , " & lt ; " ) . replace ( / > / g , " & gt ; " ) . replace ( / " / g , " & quot ; " ) . replace ( / ' / g , " & # 39 ; " ) } } ) } ( ) , function ( ) { " use strict " ; window . FooterView = Backbone . View . extend ( { <nl> - el : " # footerBar " , system : { } , isOffline : ! 0 , isOfflineCounter : 0 , firstLogin : ! 0 , timer : 15e3 , lap : 0 , timerFunction : null , events : { " click . footer - center p " : " showShortcutModal " } , initialize : function ( ) { var a = this ; window . setInterval ( function ( ) { a . getVersion ( ) } , a . timer ) , a . getVersion ( ) , window . VISIBLE = ! 0 , document . addEventListener ( " visibilitychange " , function ( ) { window . VISIBLE = ! window . VISIBLE } ) , $ ( " # offlinePlaceholder button " ) . on ( " click " , function ( ) { a . getVersion ( ) } ) , window . setTimeout ( function ( ) { window . frontendConfig . isCluster = = = ! 0 & & ( $ ( " . health - state " ) . css ( " cursor " , " pointer " ) , $ ( " . health - state " ) . on ( " click " , function ( ) { window . App . navigate ( " # nodes " , { trigger : ! 0 } ) } ) ) } , 1e3 ) } , template : templateEngine . createTemplate ( " footerView . ejs " ) , showServerStatus : function ( a ) { window . App . isCluster ? this . renderClusterState ( a ) : a = = = ! 0 ? ( $ ( " # healthStatus " ) . removeClass ( " negative " ) , $ ( " # healthStatus " ) . addClass ( " positive " ) , $ ( " . health - state " ) . html ( " GOOD " ) , $ ( " . health - icon " ) . html ( ' < i class = " fa fa - check - circle " > < / i > ' ) , $ ( " # offlinePlaceholder " ) . hide ( ) ) : ( $ ( " # healthStatus " ) . removeClass ( " positive " ) , $ ( " # healthStatus " ) . addClass ( " negative " ) , $ ( " . health - state " ) . html ( " UNKNOWN " ) , $ ( " . health - icon " ) . html ( ' < i class = " fa fa - exclamation - circle " > < / i > ' ) , $ ( " # offlinePlaceholder " ) . show ( ) , this . reconnectAnimation ( 0 ) ) } , reconnectAnimation : function ( a ) { var b = this ; 0 = = = a & & ( b . lap = a , $ ( " # offlineSeconds " ) . text ( b . timer / 1e3 ) , clearTimeout ( b . timerFunction ) ) , b . lap < this . timer / 1e3 & & ( b . lap + + , $ ( " # offlineSeconds " ) . text ( b . timer / 1e3 - b . lap ) , b . timerFunction = window . setTimeout ( function ( ) { b . timer / 1e3 - b . lap = = = 0 ? b . getVersion ( ) : b . reconnectAnimation ( b . lap ) } , 1e3 ) ) } , renderClusterState : function ( a ) { if ( a ) { $ ( " # offlinePlaceholder " ) . hide ( ) ; var b = function ( a ) { var b = a . Health , c = 0 ; _ . each ( b , function ( a ) { " GOOD " ! = = a . Status & & c + + } ) , c > 0 ? ( $ ( " # healthStatus " ) . removeClass ( " positive " ) , $ ( " # healthStatus " ) . addClass ( " negative " ) , 1 = = = c ? $ ( " . health - state " ) . html ( c + " NODE ERROR " ) : $ ( " . health - state " ) . html ( c + " NODES ERROR " ) , $ ( " . health - icon " ) . html ( ' < i class = " fa fa - exclamation - circle " > < / i > ' ) ) : ( $ ( " # healthStatus " ) . removeClass ( " negative " ) , $ ( " # healthStatus " ) . addClass ( " positive " ) , $ ( " . health - state " ) . html ( " NODES OK " ) , $ ( " . health - icon " ) . html ( ' < i class = " fa fa - check - circle " > < / i > ' ) ) } ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / health " ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( a ) { b ( a ) } } ) } else $ ( " # healthStatus " ) . removeClass ( " positive " ) , $ ( " # healthStatus " ) . addClass ( " negative " ) , $ ( " . health - state " ) . html ( window . location . host + " OFFLINE " ) , $ ( " . health - icon " ) . html ( ' < i class = " fa fa - exclamation - circle " > < / i > ' ) , $ ( " # offlinePlaceholder " ) . show ( ) , this . reconnectAnimation ( 0 ) } , showShortcutModal : function ( ) { window . arangoHelper . hotkeysFunctions . showHotkeysModal ( ) } , getVersion : function ( ) { var a = this ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / version " ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( b ) { a . showServerStatus ( ! 0 ) , a . isOffline = = = ! 0 & & ( a . isOffline = ! 1 , a . isOfflineCounter = 0 , a . firstLogin ? a . firstLogin = ! 1 : window . setTimeout ( function ( ) { a . showServerStatus ( ! 0 ) } , 1e3 ) , a . system . name = b . server , a . system . version = b . version , a . render ( ) ) } , error : function ( b ) { 401 = = = b . status ? ( a . showServerStatus ( ! 0 ) , window . App . navigate ( " login " , { trigger : ! 0 } ) ) : ( a . isOffline = ! 0 , a . isOfflineCounter + + , a . isOfflineCounter > = 1 & & a . showServerStatus ( ! 1 ) ) } } ) , a . system . hasOwnProperty ( " database " ) | | $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / database / current " ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( b ) { var c = b . result . name ; a . system . database = c ; var d = window . setInterval ( function ( ) { var b = $ ( " # databaseNavi " ) ; b & & ( window . clearTimeout ( d ) , d = null , a . render ( ) ) } , 50 ) } } ) } , renderVersion : function ( ) { this . system . hasOwnProperty ( " database " ) & & this . system . hasOwnProperty ( " name " ) & & $ ( this . el ) . html ( this . template . render ( { name : this . system . name , version : this . system . version , database : this . system . database } ) ) } , render : function ( ) { return this . system . version | | this . getVersion ( ) , $ ( this . el ) . html ( this . template . render ( { name : this . system . name , version : this . system . version } ) ) , this } } ) } ( ) , function ( ) { " use strict " ; window . FoxxActiveView = Backbone . View . extend ( { tagName : " div " , className : " tile pure - u - 1 - 1 pure - u - sm - 1 - 2 pure - u - md - 1 - 3 pure - u - lg - 1 - 4 pure - u - xl - 1 - 6 " , template : templateEngine . createTemplate ( " foxxActiveView . ejs " ) , _show : ! 0 , events : { click : " openAppDetailView " } , openAppDetailView : function ( ) { window . App . navigate ( " service / " + encodeURIComponent ( this . model . get ( " mount " ) ) , { trigger : ! 0 } ) } , toggle : function ( a , b ) { switch ( a ) { case " devel " : this . model . isDevelopment ( ) & & ( this . _show = b ) ; break ; case " production " : this . model . isDevelopment ( ) | | this . model . isSystem ( ) | | ( this . _show = b ) ; break ; case " system " : this . model . isSystem ( ) & & ( this . _show = b ) } this . _show ? $ ( this . el ) . show ( ) : $ ( this . el ) . hide ( ) } , render : function ( ) { return this . model . fetchThumbnail ( function ( ) { $ ( this . el ) . html ( this . template . render ( { model : this . model } ) ) ; var a = function ( ) { this . model . needsConfiguration ( ) & & ( $ ( this . el ) . find ( " . warning - icons " ) . length > 0 ? $ ( this . el ) . find ( " . warning - icons " ) . append ( ' < span class = " fa fa - cog " title = " Needs configuration " > < / span > ' ) : $ ( this . el ) . find ( " img " ) . after ( ' < span class = " warning - icons " > < span class = " fa fa - cog " title = " Needs configuration " > < / span > < / span > ' ) ) } . bind ( this ) , b = function ( ) { this . model . hasUnconfiguredDependencies ( ) & & ( $ ( this . el ) . find ( " . warning - icons " ) . length > 0 ? $ ( this . el ) . find ( " . warning - icons " ) . append ( ' < span class = " fa fa - cubes " title = " Unconfigured dependencies " > < / span > ' ) : $ ( this . el ) . find ( " img " ) . after ( ' < span class = " warning - icons " > < span class = " fa fa - cubes " title = " Unconfigured dependencies " > < / span > < / span > ' ) ) } . bind ( this ) ; this . model . getConfiguration ( a ) , this . model . getDependencies ( b ) } . bind ( this ) ) , $ ( this . el ) } } ) } ( ) , function ( ) { " use strict " ; var a = { ERROR_SERVICE_DOWNLOAD_FAILED : { code : 1752 , message : " service download failed " } } , b = templateEngine . createTemplate ( " applicationListView . ejs " ) , c = function ( a ) { this . collection = a . collection } , d = function ( b ) { var c = this ; if ( b . error = = = ! 1 ) this . collection . fetch ( { success : function ( ) { window . modalView . hide ( ) , c . reload ( ) , console . log ( b ) , arangoHelper . arangoNotification ( " Services " , " Service " + b . name + " installed . " ) } } ) ; else { var d = b ; switch ( b . hasOwnProperty ( " responseJSON " ) & & ( d = b . responseJSON ) , d . errorNum ) { case a . ERROR_SERVICE_DOWNLOAD_FAILED . code : arangoHelper . arangoError ( " Services " , " Unable to download application from the given repository . " ) ; break ; default : arangoHelper . arangoError ( " Services " , d . errorNum + " . " + d . errorMessage ) } } } , e = function ( ) { window . modalView . modalBindValidation ( { id : " new - app - mount " , validateInput : function ( ) { return [ { rule : Joi . string ( ) . regex ( / ^ ( \ / ( APP [ ^ \ / ] + | ( ? ! APP ) [ a - zA - Z0 - 9_ \ - % ] + ) ) + $ / i ) , msg : " May not contain / APP " } , { rule : Joi . string ( ) . regex ( / ^ ( \ / [ a - zA - Z0 - 9_ \ - % ] + ) + $ / ) , msg : " Can only contain [ a - zA - Z0 - 9_ - % ] " } , { rule : Joi . string ( ) . regex ( / ^ \ / ( [ ^ _ ] | _open \ / ) / ) , msg : " Mountpoints with _ are reserved for internal use " } , { rule : Joi . string ( ) . regex ( / [ ^ \ / ] $ / ) , msg : " May not end with / " } , { rule : Joi . string ( ) . regex ( / ^ \ / / ) , msg : " Has to start with / " } , { rule : Joi . string ( ) . required ( ) . min ( 2 ) , msg : " Has to be non - empty " } ] } } ) } , f = function ( ) { window . modalView . modalBindValidation ( { id : " repository " , validateInput : function ( ) { return [ { rule : Joi . string ( ) . required ( ) . regex ( / ^ [ a - zA - Z0 - 9_ \ - ] + \ / [ a - zA - Z0 - 9_ \ - ] + $ / ) , msg : " No valid Github account and repository . " } ] } } ) } , g = function ( ) { window . modalView . modalBindValidation ( { id : " new - app - author " , validateInput : function ( ) { return [ { rule : Joi . string ( ) . required ( ) . min ( 1 ) , msg : " Has to be non empty . " } ] } } ) , window . modalView . modalBindValidation ( { id : " new - app - name " , validateInput : function ( ) { return [ { rule : Joi . string ( ) . required ( ) . regex ( / ^ [ a - zA - Z \ - _ ] [ a - zA - Z0 - 9 \ - _ ] * $ / ) , msg : " Can only contain a to z , A to Z , 0 - 9 , ' - ' and ' _ ' . " } ] } } ) , window . modalView . modalBindValidation ( { id : " new - app - description " , validateInput : function ( ) { return [ { rule : Joi . string ( ) . required ( ) . min ( 1 ) , msg : " Has to be non empty . " } ] } } ) , window . modalView . modalBindValidation ( { id : " new - app - license " , validateInput : function ( ) { return [ { rule : Joi . string ( ) . required ( ) . regex ( / ^ [ a - zA - Z0 - 9 \ . , ; \ - ] + $ / ) , msg : " Has to be non empty . " } ] } } ) , window . modalView . modalTestAll ( ) } , h = function ( a ) { window . modalView . clearValidators ( ) ; var b = $ ( " # modalButton1 " ) ; switch ( this . _upgrade | | e ( ) , a ) { case " newApp " : b . html ( " Generate " ) , b . prop ( " disabled " , ! 1 ) , g ( ) ; break ; case " appstore " : b . html ( " Install " ) , b . prop ( " disabled " , ! 0 ) ; break ; case " github " : f ( ) , b . html ( " Install " ) , b . prop ( " disabled " , ! 1 ) ; break ; case " zip " : b . html ( " Install " ) , b . prop ( " disabled " , ! 1 ) } b . prop ( " disabled " ) | | window . modalView . modalTestAll ( ) | | b . prop ( " disabled " , ! 0 ) } , i = function ( a ) { var b = $ ( a . currentTarget ) . attr ( " href " ) . substr ( 1 ) ; h . call ( this , b ) } , j = function ( a ) { if ( h . call ( this , " appstore " ) , window . modalView . modalTestAll ( ) ) { var b , c ; this . _upgrade ? ( b = this . mount , c = $ ( " # new - app - teardown " ) . prop ( " checked " ) ) : b = window . arangoHelper . escapeHtml ( $ ( " # new - app - mount " ) . val ( ) ) ; var e = $ ( a . currentTarget ) . attr ( " appId " ) , f = $ ( a . currentTarget ) . attr ( " appVersion " ) ; void 0 ! = = c ? this . collection . installFromStore ( { name : e , version : f } , b , d . bind ( this ) , c ) : this . collection . installFromStore ( { name : e , version : f } , b , d . bind ( this ) ) , window . modalView . hide ( ) , arangoHelper . arangoNotification ( " Services " , " Installing " + e + " . " ) } } , k = function ( a , b ) { if ( void 0 = = = b ? b = this . _uploadData : this . _uploadData = b , b & & window . modalView . modalTestAll ( ) ) { var c , e ; this . _upgrade ? ( c = this . mount , e = $ ( " # new - app - teardown " ) . prop ( " checked " ) ) : c = window . arangoHelper . escapeHtml ( $ ( " # new - app - mount " ) . val ( ) ) , void 0 ! = = e ? this . collection . installFromZip ( b . filename , c , d . bind ( this ) , e ) : this . collection . installFromZip ( b . filename , c , d . bind ( this ) ) } } , l = function ( ) { if ( window . modalView . modalTestAll ( ) ) { var a , b , c , e ; this . _upgrade ? ( c = this . mount , e = $ ( " # new - app - teardown " ) . prop ( " checked " ) ) : c = window . arangoHelper . escapeHtml ( $ ( " # new - app - mount " ) . val ( ) ) , a = window . arangoHelper . escapeHtml ( $ ( " # repository " ) . val ( ) ) , b = window . arangoHelper . escapeHtml ( $ ( " # tag " ) . val ( ) ) , " " = = = b & & ( b = " master " ) ; var f = { url : window . arangoHelper . escapeHtml ( $ ( " # repository " ) . val ( ) ) , version : window . arangoHelper . escapeHtml ( $ ( " # tag " ) . val ( ) ) } ; try { Joi . assert ( a , Joi . string ( ) . regex ( / ^ [ a - zA - Z0 - 9_ \ - ] + \ / [ a - zA - Z0 - 9_ \ - ] + $ / ) ) } catch ( g ) { return } void 0 ! = = e ? this . collection . installFromGithub ( f , c , d . bind ( this ) , e ) : this . collection . installFromGithub ( f , c , d . bind ( this ) ) } } , m = function ( ) { if ( window . modalView . modalTestAll ( ) ) { var a , b ; this . _upgrade ? ( a = this . mount , b = $ ( " # new - app - teardown " ) . prop ( " checked " ) ) : a = window . arangoHelper . escapeHtml ( $ ( " # new - app - mount " ) . val ( ) ) ; var c = { name : window . arangoHelper . escapeHtml ( $ ( " # new - app - name " ) . val ( ) ) , documentCollections : _ . map ( $ ( " # new - app - document - collections " ) . select2 ( " data " ) , function ( a ) { return window . arangoHelper . escapeHtml ( a . text ) } ) , edgeCollections : _ . map ( $ ( " # new - app - edge - collections " ) . select2 ( " data " ) , function ( a ) { return window . arangoHelper . escapeHtml ( a . text ) } ) , author : window . arangoHelper . escapeHtml ( $ ( " # new - app - author " ) . val ( ) ) , license : window . arangoHelper . escapeHtml ( $ ( " # new - app - license " ) . val ( ) ) , description : window . arangoHelper . escapeHtml ( $ ( " # new - app - description " ) . val ( ) ) } ; void 0 ! = = b ? this . collection . generate ( c , a , d . bind ( this ) , b ) : this . collection . generate ( c , a , d . bind ( this ) ) } } , n = function ( ) { var a = $ ( " . modal - body . tab - pane . active " ) . attr ( " id " ) ; switch ( a ) { case " newApp " : m . apply ( this ) ; break ; case " github " : l . apply ( this ) ; break ; case " zip " : k . apply ( this ) } } , o = function ( a , c ) { var d = [ ] , e = { " click # infoTab a " : i . bind ( a ) , " click . install - app " : j . bind ( a ) } ; d . push ( window . modalView . createSuccessButton ( " Generate " , n . bind ( a ) ) ) , window . modalView . show ( " modalApplicationMount . ejs " , " Install Service " , d , c , void 0 , void 0 , e ) , $ ( " # new - app - document - collections " ) . select2 ( { tags : [ ] , showSearchBox : ! 1 , minimumResultsForSearch : - 1 , width : " 336px " } ) , $ ( " # new - app - edge - collections " ) . select2 ( { tags : [ ] , showSearchBox : ! 1 , minimumResultsForSearch : - 1 , width : " 336px " } ) ; var f = function ( ) { var a = $ ( " # modalButton1 " ) ; a . prop ( " disabled " ) | | window . modalView . modalTestAll ( ) ? a . prop ( " disabled " , ! 1 ) : a . prop ( " disabled " , ! 0 ) } ; $ ( " . select2 - search - field input " ) . focusout ( function ( ) { f ( ) , window . setTimeout ( function ( ) { $ ( " . select2 - drop " ) . is ( " : visible " ) & & ( $ ( " # select2 - search - field input " ) . is ( " : focus " ) | | ( $ ( " # s2id_new - app - document - collections " ) . select2 ( " close " ) , $ ( " # s2id_new - app - edge - collections " ) . select2 ( " close " ) , f ( ) ) ) } , 200 ) } ) , $ ( " . select2 - search - field input " ) . focusin ( function ( ) { if ( $ ( " . select2 - drop " ) . is ( " : visible " ) ) { var a = $ ( " # modalButton1 " ) ; a . prop ( " disabled " , ! 0 ) } } ) , $ ( " # upload - foxx - zip " ) . uploadFile ( { url : arangoHelper . databaseUrl ( " / _api / upload ? multipart = true " ) , allowedTypes : " zip " , multiple : ! 1 , onSuccess : k . bind ( a ) } ) , $ . get ( " foxxes / fishbowl " , function ( a ) { var c = $ ( " # appstore - content " ) ; c . html ( " " ) , _ . each ( _ . sortBy ( a , " name " ) , function ( a ) { c . append ( b . render ( a ) ) } ) } ) . fail ( function ( ) { var a = $ ( " # appstore - content " ) ; a . append ( " < tr > < td > Store is not available . ArangoDB is not able to connect to github . com < / td > < / tr > " ) } ) } ; c . prototype . install = function ( a ) { this . reload = a , this . _upgrade = ! 1 , this . _uploadData = void 0 , delete this . mount , o ( this , ! 1 ) , window . modalView . clearValidators ( ) , e ( ) , g ( ) } , c . prototype . upgrade = function ( a , b ) { this . reload = b , this . _upgrade = ! 0 , this . _uploadData = void 0 , this . mount = a , o ( this , ! 0 ) , window . modalView . clearValidators ( ) , g ( ) } , window . FoxxInstallView = c } ( ) , function ( ) { " use strict " ; window . GraphManagementView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " graphManagementView . ejs " ) , edgeDefintionTemplate : templateEngine . createTemplate ( " edgeDefinitionTable . ejs " ) , eCollList : [ ] , removedECollList : [ ] , dropdownVisible : ! 1 , initialize : function ( a ) { this . options = a } , events : { " click # deleteGraph " : " deleteGraph " , " click . icon_arangodb_settings2 . editGraph " : " editGraph " , " click # createGraph " : " addNewGraph " , " keyup # graphManagementSearchInput " : " search " , " click # graphManagementSearchSubmit " : " search " , " click . tile - graph " : " redirectToGraphViewer " , " click # graphManagementToggle " : " toggleGraphDropdown " , " click . css - label " : " checkBoxes " , " change # graphSortDesc " : " sorting " } , toggleTab : function ( a ) { var b = a . currentTarget . id ; b = b . replace ( " tab - " , " " ) , $ ( " # tab - content - create - graph . tab - pane " ) . removeClass ( " active " ) , $ ( " # tab - content - create - graph # " + b ) . addClass ( " active " ) , " exampleGraphs " = = = b ? $ ( " # modal - dialog . modal - footer . button - success " ) . css ( " display " , " none " ) : $ ( " # modal - dialog . modal - footer . button - success " ) . css ( " display " , " initial " ) } , redirectToGraphViewer : function ( a ) { var b = $ ( a . currentTarget ) . attr ( " id " ) ; b = b . substr ( 0 , b . length - 5 ) , window . location = window . location + " / " + encodeURIComponent ( b ) } , loadGraphViewer : function ( a , b ) { var c = function ( b ) { if ( b ) arangoHelper . arangoError ( " " , " " ) ; else { var c = this . collection . get ( a ) . get ( " edgeDefinitions " ) ; if ( ! c | | 0 = = = c . length ) return ; var d = { type : " gharial " , graphName : a , baseUrl : arangoHelper . databaseUrl ( " / " ) } , e = $ ( " # content " ) . width ( ) - 75 ; $ ( " # content " ) . html ( " " ) ; var f = arangoHelper . calculateCenterDivHeight ( ) ; this . ui = new GraphViewerUI ( $ ( " # content " ) [ 0 ] , d , e , $ ( " . centralRow " ) . height ( ) - 135 , { nodeShaper : { label : " _key " , color : { type : " attribute " , key : " _key " } } } , ! 0 ) , $ ( " . contentDiv " ) . height ( f ) } } . bind ( this ) ; b ? this . collection . fetch ( { cache : ! 1 , success : function ( ) { c ( ) } } ) : c ( ) } , handleResize : function ( a ) { this . width & & this . width = = = a | | ( this . width = a , this . ui & & this . ui . changeWidth ( a ) ) } , addNewGraph : function ( a ) { a . preventDefault ( ) , this . createEditGraphModal ( ) } , deleteGraph : function ( ) { var a = this , b = $ ( " # editGraphName " ) [ 0 ] . value ; if ( $ ( " # dropGraphCollections " ) . is ( " : checked " ) ) { var c = function ( c ) { c ? ( a . collection . remove ( a . collection . get ( b ) ) , a . updateGraphManagementView ( ) , window . modalView . hide ( ) ) : ( window . modalView . hide ( ) , arangoHelper . arangoError ( " Graph " , " Could not delete Graph . " ) ) } ; this . collection . dropAndDeleteGraph ( b , c ) } else this . collection . get ( b ) . destroy ( { success : function ( ) { a . updateGraphManagementView ( ) , window . modalView . hide ( ) } , error : function ( a , b ) { var c = JSON . parse ( b . responseText ) , d = c . errorMessage ; arangoHelper . arangoError ( d ) , window . modalView . hide ( ) } } ) } , checkBoxes : function ( a ) { var b = a . currentTarget . id ; $ ( " # " + b ) . click ( ) } , toggleGraphDropdown : function ( ) { $ ( " # graphSortDesc " ) . attr ( " checked " , this . collection . sortOptions . desc ) , $ ( " # graphManagementToggle " ) . toggleClass ( " activated " ) , $ ( " # graphManagementDropdown2 " ) . slideToggle ( 200 ) } , sorting : function ( ) { $ ( " # graphSortDesc " ) . is ( " : checked " ) ? this . collection . setSortingDesc ( ! 0 ) : this . collection . setSortingDesc ( ! 1 ) , $ ( " # graphManagementDropdown " ) . is ( " : visible " ) ? this . dropdownVisible = ! 0 : this . dropdownVisible = ! 1 , this . render ( ) } , createExampleGraphs : function ( a ) { var b = $ ( a . currentTarget ) . attr ( " graph - id " ) , c = this ; $ . ajax ( { type : " POST " , url : arangoHelper . databaseUrl ( " / _admin / aardvark / graph - examples / create / " + encodeURIComponent ( b ) ) , success : function ( ) { window . modalView . hide ( ) , c . updateGraphManagementView ( ) , arangoHelper . arangoNotification ( " Example Graphs " , " Graph : " + b + " created . " ) } , error : function ( a ) { if ( window . modalView . hide ( ) , a . responseText ) try { var c = JSON . parse ( a . responseText ) ; arangoHelper . arangoError ( " Example Graphs " , c . errorMessage ) } catch ( d ) { arangoHelper . arangoError ( " Example Graphs " , " Could not create example graph : " + b ) } else arangoHelper . arangoError ( " Example Graphs " , " Could not create example graph : " + b ) } } ) } , render : function ( a , b ) { var c = this ; return this . collection . fetch ( { cache : ! 1 , success : function ( ) { c . collection . sort ( ) , $ ( c . el ) . html ( c . template . render ( { graphs : c . collection , searchString : " " } ) ) , c . dropdownVisible = = = ! 0 & & ( $ ( " # graphManagementDropdown2 " ) . show ( ) , $ ( " # graphSortDesc " ) . attr ( " checked " , c . collection . sortOptions . desc ) , $ ( " # graphManagementToggle " ) . toggleClass ( " activated " ) , $ ( " # graphManagementDropdown " ) . show ( ) ) , c . events [ " click . tableRow " ] = c . showHideDefinition . bind ( c ) , c . events [ ' change tr [ id * = " newEdgeDefinitions " ] ' ] = c . setFromAndTo . bind ( c ) , c . events [ " click . graphViewer - icon - button " ] = c . addRemoveDefinition . bind ( c ) , c . events [ " click # graphTab a " ] = c . toggleTab . bind ( c ) , c . events [ " click . createExampleGraphs " ] = c . createExampleGraphs . bind ( c ) , c . events [ " focusout . select2 - search - field input " ] = function ( a ) { $ ( " . select2 - drop " ) . is ( " : visible " ) & & ( $ ( " # select2 - search - field input " ) . is ( " : focus " ) | | window . setTimeout ( function ( ) { $ ( a . currentTarget ) . parent ( ) . parent ( ) . parent ( ) . select2 ( " close " ) } , 200 ) ) } , arangoHelper . setCheckboxStatus ( " # graphManagementDropdown " ) } } ) , a & & this . loadGraphViewer ( a , b ) , this } , setFromAndTo : function ( a ) { a . stopPropagation ( ) ; var b , c = this . calculateEdgeDefinitionMap ( ) ; if ( a . added ) { if ( - 1 = = = this . eCollList . indexOf ( a . added . id ) & & - 1 ! = = this . removedECollList . indexOf ( a . added . id ) ) return b = a . currentTarget . id . split ( " row_newEdgeDefinitions " ) [ 1 ] , $ ( ' input [ id * = " newEdgeDefinitions ' + b + ' " ] ' ) . select2 ( " val " , null ) , void $ ( ' input [ id * = " newEdgeDefinitions ' + b + ' " ] ' ) . attr ( " placeholder " , " The collection " + a . added . id + " is already used . " ) ; this . removedECollList . push ( a . added . id ) , this . eCollList . splice ( this . eCollList . indexOf ( a . added . id ) , 1 ) } else this . eCollList . push ( a . removed . id ) , this . removedECollList . splice ( this . removedECollList . indexOf ( a . removed . id ) , 1 ) ; c [ a . val ] ? ( b = a . currentTarget . id . split ( " row_newEdgeDefinitions " ) [ 1 ] , $ ( " # s2id_fromCollections " + b ) . select2 ( " val " , c [ a . val ] . from ) , $ ( " # fromCollections " + b ) . attr ( " disabled " , ! 0 ) , $ ( " # s2id_toCollections " + b ) . select2 ( " val " , c [ a . val ] . to ) , $ ( " # toCollections " + b ) . attr ( " disabled " , ! 0 ) ) : ( b = a . currentTarget . id . split ( " row_newEdgeDefinitions " ) [ 1 ] , $ ( " # s2id_fromCollections " + b ) . select2 ( " val " , null ) , $ ( " # fromCollections " + b ) . attr ( " disabled " , ! 1 ) , $ ( " # s2id_toCollections " + b ) . select2 ( " val " , null ) , $ ( " # toCollections " + b ) . attr ( " disabled " , ! 1 ) ) } , editGraph : function ( a ) { a . stopPropagation ( ) , this . collection . fetch ( { cache : ! 1 } ) , this . graphToEdit = this . evaluateGraphName ( $ ( a . currentTarget ) . attr ( " id " ) , " _settings " ) ; var b = this . collection . findWhere ( { _key : this . graphToEdit } ) ; this . createEditGraphModal ( b ) } , saveEditedGraph : function ( ) { var a , b , c , d , e , f = $ ( " # editGraphName " ) [ 0 ] . value , g = _ . pluck ( $ ( " # newVertexCollections " ) . select2 ( " data " ) , " text " ) , h = [ ] , i = { } ; if ( e = $ ( " [ id ^ = s2id_newEdgeDefinitions ] " ) . toArray ( ) , e . forEach ( function ( e ) { if ( d = $ ( e ) . attr ( " id " ) , d = d . replace ( " s2id_newEdgeDefinitions " , " " ) , a = _ . pluck ( $ ( " # s2id_newEdgeDefinitions " + d ) . select2 ( " data " ) , " text " ) [ 0 ] , a & & " " ! = = a & & ( b = _ . pluck ( $ ( " # s2id_fromCollections " + d ) . select2 ( " data " ) , " text " ) , c = _ . pluck ( $ ( " # s2id_toCollections " + d ) . select2 ( " data " ) , " text " ) , 0 ! = = b . length & & 0 ! = = c . length ) ) { var f = { collection : a , from : b , to : c } ; h . push ( f ) , i [ a ] = f } } ) , 0 = = = h . length ) return $ ( " # s2id_newEdgeDefinitions0 . select2 - choices " ) . css ( " border - color " , " red " ) , $ ( " # s2id_newEdgeDefinitions0 " ) . parent ( ) . parent ( ) . next ( ) . find ( " . select2 - choices " ) . css ( " border - color " , " red " ) , void $ ( " # s2id_newEdgeDefinitions0 " ) . parent ( ) . parent ( ) . next ( ) . next ( ) . find ( " . select2 - choices " ) . css ( " border - color " , " red " ) ; var j = this . collection . findWhere ( { _key : f } ) , k = j . get ( " edgeDefinitions " ) , l = j . get ( " orphanCollections " ) , m = [ ] ; l . forEach ( function ( a ) { - 1 = = = g . indexOf ( a ) & & j . deleteVertexCollection ( a ) } ) , g . forEach ( function ( a ) { - 1 = = = l . indexOf ( a ) & & j . addVertexCollection ( a ) } ) ; var n = [ ] , o = [ ] , p = [ ] ; k . forEach ( function ( a ) { var b = a . collection ; m . push ( b ) ; var c = i [ b ] ; void 0 = = = c ? p . push ( b ) : JSON . stringify ( c ) ! = = JSON . stringify ( a ) & & o . push ( b ) } ) , h . forEach ( function ( a ) { var b = a . collection ; - 1 = = = m . indexOf ( b ) & & n . push ( b ) } ) , n . forEach ( function ( a ) { j . addEdgeDefinition ( i [ a ] ) } ) , o . forEach ( function ( a ) { j . modifyEdgeDefinition ( i [ a ] ) } ) , p . forEach ( function ( a ) { j . deleteEdgeDefinition ( a ) } ) , this . updateGraphManagementView ( ) , window . modalView . hide ( ) } , evaluateGraphName : function ( a , b ) { var c = a . lastIndexOf ( b ) ; return a . substring ( 0 , c ) } , search : function ( ) { var a , b , c , d ; a = $ ( " # graphManagementSearchInput " ) , b = $ ( " # graphManagementSearchInput " ) . val ( ) , d = this . collection . filter ( function ( a ) { return - 1 ! = = a . get ( " _key " ) . indexOf ( b ) } ) , $ ( this . el ) . html ( this . template . render ( { graphs : d , searchString : b } ) ) , a = $ ( " # graphManagementSearchInput " ) , c = a . val ( ) . length , a . focus ( ) , a [ 0 ] . setSelectionRange ( c , c ) } , updateGraphManagementView : function ( ) { var a = this ; this . collection . fetch ( { cache : ! 1 , success : function ( ) { a . render ( ) } } ) } , createNewGraph : function ( ) { var a , b , c , d , e , f = $ ( " # createNewGraphName " ) . val ( ) , g = _ . pluck ( $ ( " # newVertexCollections " ) . select2 ( " data " ) , " text " ) , h = [ ] , i = this ; return f ? this . collection . findWhere ( { _key : f } ) ? ( arangoHelper . arangoError ( " The graph ' " + f + " ' already exists . " ) , 0 ) : ( e = $ ( " [ id ^ = s2id_newEdgeDefinitions ] " ) . toArray ( ) , e . forEach ( function ( e ) { d = $ ( e ) . attr ( " id " ) , d = d . replace ( " s2id_newEdgeDefinitions " , " " ) , a = _ . pluck ( $ ( " # s2id_newEdgeDefinitions " + d ) . select2 ( " data " ) , " text " ) [ 0 ] , a & & " " ! = = a & & ( b = _ . pluck ( $ ( " # s2id_fromCollections " + d ) . select2 ( " data " ) , " text " ) , c = _ . pluck ( $ ( " # s2id_toCollections " + d ) . select2 ( " data " ) , " text " ) , 1 ! = = b & & 1 ! = = c & & h . push ( { collection : a , from : b , to : c } ) ) } ) , 0 = = = h . length ? ( $ ( " # s2id_newEdgeDefinitions0 . select2 - choices " ) . css ( " border - color " , " red " ) , $ ( " # s2id_newEdgeDefinitions0 " ) . parent ( ) . parent ( ) . next ( ) . find ( " . select2 - choices " ) . css ( " border - color " , " red " ) , void $ ( " # s2id_newEdgeDefinitions0 " ) . parent ( ) . parent ( ) . next ( ) . next ( ) . find ( " . select2 - choices " ) . css ( " border - color " , " red " ) ) : void this . collection . create ( { name : f , edgeDefinitions : h , orphanCollections : g } , { success : function ( ) { i . updateGraphManagementView ( ) , window . modalView . hide ( ) } , error : function ( a , b ) { var c = JSON . parse ( b . responseText ) , d = c . errorMessage ; d = d . replace ( " < " , " " ) , d = d . replace ( " > " , " " ) , arangoHelper . arangoError ( d ) } } ) ) : ( arangoHelper . arangoError ( " A name for the graph has to be provided . " ) , 0 ) } , createEditGraphModal : function ( a ) { var b , c = [ ] , d = [ ] , e = [ ] , f = this . options . collectionCollection . models , g = this , h = " " , i = [ { collection : " " , from : " " , to : " " } ] , j = " " , k = function ( a , b ) { return a = a . toLowerCase ( ) , b = b . toLowerCase ( ) , b > a ? - 1 : a > b ? 1 : 0 } ; if ( this . eCollList = [ ] , this . removedECollList = [ ] , f . forEach ( function ( a ) { a . get ( " isSystem " ) | | ( " edge " = = = a . get ( " type " ) ? g . eCollList . push ( a . id ) : d . push ( a . id ) ) } ) , window . modalView . enableHotKeys = ! 1 , this . counter = 0 , a ? ( b = " Edit Graph " , h = a . get ( " _key " ) , i = a . get ( " edgeDefinitions " ) , i & & 0 ! = = i . length | | ( i = [ { collection : " " , from : " " , to : " " } ] ) , j = a . get ( " orphanCollections " ) , e . push ( window . modalView . createReadOnlyEntry ( " editGraphName " , " Name " , h , " The name to identify the graph . Has to be unique " ) ) , c . push ( window . modalView . createDeleteButton ( " Delete " , this . deleteGraph . bind ( this ) ) ) , c . push ( window . modalView . createSuccessButton ( " Save " , this . saveEditedGraph . bind ( this ) ) ) ) : ( b = " Create Graph " , e . push ( window . modalView . createTextEntry ( " createNewGraphName " , " Name " , " " , " The name to identify the graph . Has to be unique . " , " graphName " , ! 0 ) ) , c . push ( window . modalView . createSuccessButton ( " Create " , this . createNewGraph . bind ( this ) ) ) ) , i . forEach ( function ( a ) { 0 = = = g . counter ? ( a . collection & & ( g . removedECollList . push ( a . collection ) , g . eCollList . splice ( g . eCollList . indexOf ( a . collection ) , 1 ) ) , e . push ( window . modalView . createSelect2Entry ( " newEdgeDefinitions " + g . counter , " Edge definitions " , a . collection , " An edge definition defines a relation of the graph " , " Edge definitions " , ! 0 , ! 1 , ! 0 , 1 , g . eCollList . sort ( k ) ) ) ) : e . push ( window . modalView . createSelect2Entry ( " newEdgeDefinitions " + g . counter , " Edge definitions " , a . collection , " An edge definition defines a relation of the graph " , " Edge definitions " , ! 1 , ! 0 , ! 1 , 1 , g . eCollList . sort ( k ) ) ) , e . push ( window . modalView . createSelect2Entry ( " fromCollections " + g . counter , " fromCollections " , a . from , " The collections that contain the start vertices of the relation . " , " fromCollections " , ! 0 , ! 1 , ! 1 , 10 , d . sort ( k ) ) ) , e . push ( window . modalView . createSelect2Entry ( " toCollections " + g . counter , " toCollections " , a . to , " The collections that contain the end vertices of the relation . " , " toCollections " , ! 0 , ! 1 , ! 1 , 10 , d . sort ( k ) ) ) , g . counter + + } ) , e . push ( window . modalView . createSelect2Entry ( " newVertexCollections " , " Vertex collections " , j , " Collections that are part of a graph but not used in an edge definition " , " Vertex Collections " , ! 1 , ! 1 , ! 1 , 10 , d . sort ( k ) ) ) , window . modalView . show ( " modalGraphTable . ejs " , b , c , e , void 0 , void 0 , this . events ) , a ) { $ ( " . modal - body table " ) . css ( " border - collapse " , " separate " ) ; var l ; for ( $ ( " . modal - body . spacer " ) . remove ( ) , l = 0 ; l < = this . counter ; l + + ) $ ( " # row_fromCollections " + l ) . show ( ) , $ ( " # row_toCollections " + l ) . show ( ) , $ ( " # row_newEdgeDefinitions " + l ) . addClass ( " first " ) , $ ( " # row_fromCollections " + l ) . addClass ( " middle " ) , $ ( " # row_toCollections " + l ) . addClass ( " last " ) , $ ( " # row_toCollections " + l ) . after ( ' < tr id = " spacer ' + l + ' " class = " spacer " > < / tr > ' ) ; $ ( " # graphTab " ) . hide ( ) , $ ( " # modal - dialog . modal - delete - confirmation " ) . append ( ' < fieldset > < input type = " checkbox " id = " dropGraphCollections " name = " " value = " " > < label for = " dropGraphCollections " > also drop collections ? < / label > < / fieldset > ' ) } } , showHideDefinition : function ( a ) { } , addRemoveDefinition : function ( a ) { var b = [ ] , c = this . options . collectionCollection . models ; c . forEach ( function ( a ) { a . get ( " isSystem " ) | | b . push ( a . id ) } ) , a . stopPropagation ( ) ; var d , e = $ ( a . currentTarget ) . attr ( " id " ) ; if ( - 1 = = = e . indexOf ( " addAfter_newEdgeDefinitions " ) ) - 1 ! = = e . indexOf ( " remove_newEdgeDefinitions " ) & & ( d = e . split ( " remove_newEdgeDefinitions " ) [ 1 ] , $ ( " # row_newEdgeDefinitions " + d ) . remove ( ) , $ ( " # row_fromCollections " + d ) . remove ( ) , $ ( " # row_toCollections " + d ) . remove ( ) , $ ( " # spacer " + d ) . remove ( ) ) ; else { this . counter + + , $ ( " # row_newVertexCollections " ) . before ( this . edgeDefintionTemplate . render ( { number : this . counter } ) ) , $ ( " # newEdgeDefinitions " + this . counter ) . select2 ( { tags : this . eCollList , showSearchBox : ! 1 , minimumResultsForSearch : - 1 , width : " 336px " , maximumSelectionSize : 1 } ) , $ ( " # fromCollections " + this . counter ) . select2 ( { tags : b , showSearchBox : ! 1 , minimumResultsForSearch : - 1 , width : " 336px " , maximumSelectionSize : 10 } ) , $ ( " # toCollections " + this . counter ) . select2 ( { tags : b , showSearchBox : ! 1 , minimumResultsForSearch : - 1 , width : " 336px " , maximumSelectionSize : 10 } ) , window . modalView . undelegateEvents ( ) , window . modalView . delegateEvents ( this . events ) ; var f ; for ( $ ( " . modal - body . spacer " ) . remove ( ) , f = 0 ; f < = this . counter ; f + + ) $ ( " # row_fromCollections " + f ) . show ( ) , $ ( " # row_toCollections " + f ) . show ( ) , $ ( " # row_newEdgeDefinitions " + f ) . addClass ( " first " ) , $ ( " # row_fromCollections " + f ) . addClass ( " middle " ) , $ ( " # row_toCollections " + f ) . addClass ( " last " ) , $ ( " # row_toCollections " + f ) . after ( ' < tr id = " spacer ' + f + ' " class = " spacer " > < / tr > ' ) } } , calculateEdgeDefinitionMap : function ( ) { var a = { } ; return this . collection . models . forEach ( function ( b ) { b . get ( " edgeDefinitions " ) . forEach ( function ( b ) { a [ b . collection ] = { from : b . from , to : b . to } } ) } ) , a } } ) } ( ) , function ( ) { " use strict " ; window . GraphSettingsView = Backbone . View . extend ( { el : " # content " , remove : function ( ) { return this . $ el . empty ( ) . off ( ) , this . stopListening ( ) , this } , general : { graph : { type : " divider " , name : " Graph " } , nodeStart : { type : " string " , name : " Starting node " , desc : " A valid node id . If empty , a random node will be chosen . " , value : 2 } , layout : { type : " select " , name : " Layout algorithm " , noverlap : { name : " No overlap ( fast ) " , val : " noverlap " } , force : { name : " Force ( slow ) " , val : " force " } , fruchtermann : { name : " Fruchtermann ( very slow ) " , val : " fruchtermann " } } , renderer : { type : " select " , name : " Renderer " , canvas : { name : " Canvas ( editable ) " , val : " canvas " } , webgl : { name : " WebGL ( only display ) " , val : " webgl " } } , depth : { type : " number " , name : " Search depth " , value : 2 } } , specific : { nodes : { type : " divider " , name : " Nodes " } , nodeLabel : { type : " string " , name : " Label " , desc : " Default node color . RGB or HEX value . " , " default " : " _key " } , nodeColor : { type : " color " , name : " Color " , desc : " Default node color . RGB or HEX value . " , " default " : " # 2ecc71 " } , nodeSize : { type : " string " , name : " Sizing attribute " , desc : " Default node size . Numeric value > 0 . " } , edges : { type : " divider " , name : " Edges " } , edgeLabel : { type : " string " , name : " Label " , desc : " Default edge label . " } , edgeColor : { type : " color " , name : " Color " , desc : " Default edge color . RGB or HEX value . " , " default " : " # cccccc " } , edgeSize : { type : " number " , name : " Sizing " , desc : " Default edge thickness . Numeric value > 0 . " } , edgeType : { type : " select " , name : " Type " , desc : " The type of the edge " , line : { name : " Line " , val : " line " } , curve : { name : " Curve " , val : " curve " } , arrow : { name : " Arrow " , val : " arrow " } , curvedArrow : { name : " Curved Arrow " , val : " curvedArrow " } } } , template : templateEngine . createTemplate ( " graphSettingsView . ejs " ) , initialize : function ( a ) { this . name = a . name , this . userConfig = a . userConfig } , events : { " click # saveGraphSettings " : " saveGraphSettings " , " click # restoreGraphSettings " : " restoreGraphSettings " } , getGraphSettings : function ( a ) { var b = this , c = window . App . currentDB . toJSON ( ) . name + " _ " + this . name ; this . userConfig . fetch ( { success : function ( d ) { b . graphConfig = d . toJSON ( ) . graphs [ c ] , a & & b . continueRender ( ) } } ) } , saveGraphSettings : function ( ) { var a = window . App . currentDB . toJSON ( ) . name + " _ " + this . name , b = { } ; b [ a ] = { layout : $ ( " # g_layout " ) . val ( ) , renderer : $ ( " # g_renderer " ) . val ( ) , depth : $ ( " # g_depth " ) . val ( ) , nodeColor : $ ( " # g_nodeColor " ) . val ( ) , edgeColor : $ ( " # g_edgeColor " ) . val ( ) , nodeLabel : $ ( " # g_nodeLabel " ) . val ( ) , edgeLabel : $ ( " # g_edgeLabel " ) . val ( ) , edgeType : $ ( " # g_edgeType " ) . val ( ) , nodeSize : $ ( " # g_nodeSize " ) . val ( ) , edgeSize : $ ( " # g_edgeSize " ) . val ( ) , nodeStart : $ ( " # g_nodeStart " ) . val ( ) } ; var c = function ( ) { window . arangoHelper . arangoNotification ( " Graph " + this . name , " Configuration saved . " ) } . bind ( this ) ; this . userConfig . setItem ( " graphs " , b , c ) } , setDefaults : function ( ) { } , render : function ( ) { this . getGraphSettings ( ! 0 ) } , continueRender : function ( ) { $ ( this . el ) . html ( this . template . render ( { general : this . general , specific : this . specific } ) ) , this . graphConfig ? _ . each ( this . graphConfig , function ( a , b ) { $ ( " # g_ " + b ) . val ( a ) } ) : this . setDefaults ( ) , arangoHelper . buildGraphSubNav ( this . name , " Settings " ) } } ) } ( ) , function ( ) { " use strict " ; window . GraphViewer2 = Backbone . View . extend ( { el : " # content " , remove : function ( ) { return this . $ el . empty ( ) . off ( ) , this . stopListening ( ) , this } , template : templateEngine . createTemplate ( " graphViewer2 . ejs " ) , initialize : function ( a ) { this . name = a . name , this . userConfig = a . userConfig , this . initSigma ( ) } , events : { " click # downloadPNG " : " downloadSVG " } , initSigma : function ( ) { try { sigma . classes . graph . addMethod ( " neighbors " , function ( a ) { var b , c = { } , d = this . allNeighborsIndex [ a ] | | { } ; for ( b in d ) c [ b ] = this . nodesIndex [ b ] ; return c } ) } catch ( a ) { } } , downloadSVG : function ( ) { var a = this ; this . currentGraph . toSVG ( { download : ! 0 , filename : a . name + " . svg " , size : 1e3 } ) } , resize : function ( ) { $ ( " # graph - container " ) . width ( $ ( " . centralContent " ) . width ( ) ) , $ ( " # graph - container " ) . height ( $ ( " . centralRow " ) . height ( ) - 150 ) } , render : function ( ) { this . $ el . html ( this . template . render ( { } ) ) , this . resize ( ) , this . fetchGraph ( ) } , fetchGraph : function ( ) { var a = this ; arangoHelper . buildGraphSubNav ( a . name , " Content " ) , $ ( " # content " ) . append ( ' < div id = " calculatingGraph " style = " position : absolute ; left : 25px ; top : 130px ; " > < i class = " fa fa - circle - o - notch fa - spin " style = " margin - right : 10px ; " > < / i > < span id = " calcText " > Fetching graph data . Please wait . . . < / span > < / div > ' ) ; var b = function ( ) { var b = { } ; this . graphConfig & & ( b = _ . clone ( this . graphConfig ) , delete b . layout , delete b . edgeType , delete b . renderer ) , this . setupSigma ( ) , $ . ajax ( { type : " GET " , url : arangoHelper . databaseUrl ( " / _admin / aardvark / graph / " + encodeURIComponent ( this . name ) ) , contentType : " application / json " , data : b , success : function ( b ) { $ ( " # calcText " ) . html ( " Calculating layout . Please wait . . . " ) , arangoHelper . buildGraphSubNav ( a . name , " Content " ) , a . renderGraph ( b ) } , error : function ( a ) { console . log ( a ) ; try { arangoHelper . arangoError ( " Graph " , a . responseJSON . exception ) } catch ( b ) { } $ ( " # calculatingGraph " ) . html ( " Failed to fetch graph information . " ) } } ) } . bind ( this ) ; this . getGraphSettings ( b ) } , setupSigma : function ( ) { if ( this . graphConfig & & this . graphConfig . edgeLabel ) { sigma . utils . pkg ( " sigma . settings " ) ; var a = { defaultEdgeLabelColor : " # 000 " , defaultEdgeLabelActiveColor : " # 000 " , <nl> - defaultEdgeLabelSize : 10 , edgeLabelSize : " fixed " , edgeLabelSizePowRatio : 1 , edgeLabelThreshold : 1 } ; sigma . settings = sigma . utils . extend ( sigma . settings | | { } , a ) , sigma . settings . drawEdgeLabels = ! 0 } } , contextState : { createEdge : ! 1 , _from : ! 1 , _to : ! 1 , fromX : ! 1 , fromY : ! 1 } , clearOldContextMenu : function ( a ) { var b = this ; $ ( " # nodeContextMenu " ) . remove ( ) ; var c = ' < div id = " nodeContextMenu " class = " nodeContextMenu " > < / div > ' ; $ ( " # graph - container " ) . append ( c ) , a & & _ . each ( this . contextState , function ( a , c ) { b . contextState [ c ] = ! 1 } ) } , createContextMenu : function ( a ) { var b = a . data . captor . clientX , c = a . data . captor . clientX ; console . log ( " Context menu " ) , console . log ( b ) , console . log ( c ) , this . clearOldContextMenu ( ) } , createNodeContextMenu : function ( a , b ) { var c = this , d = b . data . node [ " renderer1 : x " ] , e = b . data . node [ " renderer1 : y " ] ; this . clearOldContextMenu ( ) ; var f = function ( a , b ) { var f = [ " # 364C4A " , " # 497C7F " , " # 92C5C0 " , " # 858168 " , " # CCBCA5 " ] , g = wheelnav , h = new g ( " nodeContextMenu " ) ; h . maxPercent = 1 , h . wheelRadius = 50 , h . clockwise = ! 1 , h . colors = f , h . multiSelect = ! 0 , h . clickModeRotate = ! 1 , h . slicePathFunction = slicePath ( ) . DonutSlice , h . createWheel ( [ icon . edit , icon . trash , icon . arrowleft2 , icon . connect ] ) , h . navItems [ 0 ] . selected = ! 1 , h . navItems [ 0 ] . hovered = ! 1 , h . navItems [ 0 ] . navigateFunction = function ( a ) { c . clearOldContextMenu ( ) , c . editNode ( b ) } , h . navItems [ 1 ] . navigateFunction = function ( a ) { c . clearOldContextMenu ( ) , c . deleteNode ( b ) } , h . navItems [ 2 ] . navigateFunction = function ( a ) { c . clearOldContextMenu ( ) , c . setStartNode ( b ) } , h . navItems [ 3 ] . navigateFunction = function ( a ) { c . contextState . createEdge = ! 0 , c . contextState . _from = b , c . contextState . fromX = d , c . contextState . fromY = e ; var f = document . getElementsByClassName ( " sigma - mouse " ) [ 0 ] ; f . addEventListener ( " mousemove " , c . drawLine . bind ( this ) , ! 1 ) , c . clearOldContextMenu ( ) } , h . navItems [ 0 ] . selected = ! 1 , h . navItems [ 0 ] . hovered = ! 1 } ; $ ( " # nodeContextMenu " ) . css ( " left " , d + 115 ) , $ ( " # nodeContextMenu " ) . css ( " top " , e + 72 ) , $ ( " # nodeContextMenu " ) . width ( 100 ) , $ ( " # nodeContextMenu " ) . height ( 100 ) , f ( b , a ) } , clearMouseCanvas : function ( ) { var a = document . getElementsByClassName ( " sigma - mouse " ) [ 0 ] , b = a . getContext ( " 2d " ) ; b . clearRect ( 0 , 0 , $ ( a ) . width ( ) , $ ( a ) . height ( ) ) } , drawLine : function ( a ) { var b = window . App . graphViewer2 . contextState ; if ( b . createEdge ) { var c = b . fromX , d = b . fromY , e = a . offsetX , f = a . offsetY , g = document . getElementsByClassName ( " sigma - mouse " ) [ 0 ] , h = g . getContext ( " 2d " ) ; h . clearRect ( 0 , 0 , $ ( g ) . width ( ) , $ ( g ) . height ( ) ) , h . beginPath ( ) , h . moveTo ( c , d ) , h . lineTo ( e , f ) , h . stroke ( ) } } , getGraphSettings : function ( a ) { var b = this , c = window . App . currentDB . toJSON ( ) . name + " _ " + this . name ; this . userConfig . fetch ( { success : function ( d ) { b . graphConfig = d . toJSON ( ) . graphs [ c ] , a & & a ( b . graphConfig ) } } ) } , editNode : function ( a ) { var b = function ( ) { } ; arangoHelper . openDocEditor ( a , " doc " , b ) } , renderGraph : function ( a ) { var b = this ; if ( 0 ! = = a . edges . left ) { this . Sigma = sigma ; var c = " noverlap " , d = " canvas " ; this . graphConfig & & ( this . graphConfig . layout & & ( c = this . graphConfig . layout ) , this . graphConfig . renderer & & ( d = this . graphConfig . renderer , " canvas " = = = d & & ( b . isEditable = ! 0 ) ) ) ; var e = { doubleClickEnabled : ! 1 , minNodeSize : 3 . 5 , minEdgeSize : 1 , maxEdgeSize : 4 , enableEdgeHovering : ! 0 , edgeHoverColor : " # 000 " , defaultEdgeHoverColor : " # 000 " , defaultEdgeType : " line " , edgeHoverSizeRatio : 2 , edgeHoverExtremities : ! 0 } ; this . graphConfig & & this . graphConfig . edgeType & & ( e . defaultEdgeType = this . graphConfig . edgeType ) , a . nodes . length > 500 & & ( e . labelThreshold = 15 , e . hideEdgesOnMove = ! 0 ) , " webgl " = = = d & & ( e . enableEdgeHovering = ! 1 ) ; var f = new this . Sigma ( { graph : a , container : " graph - container " , renderer : { container : document . getElementById ( " graph - container " ) , type : d } , settings : e } ) ; if ( this . currentGraph = f , sigma . plugins . fullScreen ( { container : " graph - container " , btnId : " graph - fullscreen - btn " } ) , " noverlap " = = = c ) { var g = f . configNoverlap ( { nodeMargin : . 1 , scaleNodes : 1 . 05 , gridSize : 75 , easing : " quadraticInOut " , duration : 1e4 } ) ; g . bind ( " start stop interpolate " , function ( a ) { " start " = = = a . type , " interpolate " = = = a . type } ) } else if ( " fruchtermann " = = = c ) { var h = sigma . layouts . fruchtermanReingold . configure ( f , { iterations : 500 , easing : " quadraticInOut " , duration : 800 } ) ; h . bind ( " start stop interpolate " , function ( a ) { } ) } f . graph . nodes ( ) . forEach ( function ( a ) { a . originalColor = a . color } ) , f . graph . edges ( ) . forEach ( function ( a ) { a . originalColor = a . color } ) , " canvas " = = = d & & ( f . bind ( " rightClickStage " , function ( a ) { b . createContextMenu ( a ) , b . clearMouseCanvas ( ) } ) , f . bind ( " clickNode " , function ( a ) { b . contextState . createEdge = = = ! 0 & & ( b . contextState . _to = a . data . node . id , b . currentGraph . graph . addEdge ( { source : b . contextState . _from , target : b . contextState . _to , id : Math . random ( ) , color : b . graphConfig . edgeColor } ) , b . currentGraph . refresh ( ) , b . clearOldContextMenu ( ! 0 ) ) } ) , f . bind ( " rightClickNode " , function ( a ) { var c = a . data . node . id ; b . createNodeContextMenu ( c , a ) } ) , f . bind ( " doubleClickNode " , function ( a ) { var b = a . data . node . id , c = f . graph . neighbors ( b ) ; c [ b ] = a . data . node , f . graph . nodes ( ) . forEach ( function ( a ) { c [ a . id ] ? a . color = a . originalColor : a . color = " # eee " } ) , f . graph . edges ( ) . forEach ( function ( a ) { c [ a . source ] & & c [ a . target ] ? a . color = " rgb ( 64 , 74 , 83 ) " : a . color = " # eee " } ) , f . refresh ( ) } ) , f . bind ( " doubleClickStage " , function ( ) { f . graph . nodes ( ) . forEach ( function ( a ) { a . color = a . originalColor } ) , f . graph . edges ( ) . forEach ( function ( a ) { a . color = a . originalColor } ) , f . refresh ( ) } ) , f . bind ( " clickStage " , function ( ) { b . clearOldContextMenu ( ! 0 ) , b . clearMouseCanvas ( ) } ) ) ; var i ; if ( " noverlap " = = = c ) f . startNoverlap ( ) , i = sigma . plugins . dragNodes ( f , f . renderers [ 0 ] ) ; else if ( " force " = = = c ) { f . startForceAtlas2 ( { worker : ! 0 , barnesHutOptimize : ! 1 } ) ; var j = 3e3 ; a . nodes . length > 2500 ? j = 5e3 : a . nodes . length < 50 & & ( j = 500 ) , window . setTimeout ( function ( ) { f . stopForceAtlas2 ( ) , i = sigma . plugins . dragNodes ( f , f . renderers [ 0 ] ) } , j ) } else " fruchtermann " = = = c ? ( sigma . layouts . fruchtermanReingold . start ( f ) , i = sigma . plugins . dragNodes ( f , f . renderers [ 0 ] ) ) : i = sigma . plugins . dragNodes ( f , f . renderers [ 0 ] ) ; console . log ( i ) , $ ( " # calculatingGraph " ) . remove ( ) } } } ) } ( ) , function ( ) { " use strict " ; window . HelpUsView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " helpUsView . ejs " ) , render : function ( ) { this . $ el . html ( this . template . render ( { } ) ) } } ) } ( ) , function ( ) { " use strict " ; window . IndicesView = Backbone . View . extend ( { el : " # content " , initialize : function ( a ) { this . collectionName = a . collectionName , this . model = this . collection } , template : templateEngine . createTemplate ( " indicesView . ejs " ) , events : { } , render : function ( ) { $ ( this . el ) . html ( this . template . render ( { model : this . model } ) ) , this . breadcrumb ( ) , window . arangoHelper . buildCollectionSubNav ( this . collectionName , " Indices " ) , this . getIndex ( ) } , breadcrumb : function ( ) { $ ( " # subNavigationBar . breadcrumb " ) . html ( " Collection : " + this . collectionName ) } , getIndex : function ( ) { var a = function ( a , b ) { a ? window . arangoHelper . arangoError ( " Index " , b . errorMessage ) : this . renderIndex ( b ) } . bind ( this ) ; this . model . getIndex ( a ) } , createIndex : function ( ) { var a , b , c , d = this , e = $ ( " # newIndexType " ) . val ( ) , f = { } ; switch ( e ) { case " Geo " : a = $ ( " # newGeoFields " ) . val ( ) ; var g = d . checkboxToValue ( " # newGeoJson " ) ; f = { type : " geo " , fields : d . stringToArray ( a ) , geoJson : g } ; break ; case " Persistent " : a = $ ( " # newPersistentFields " ) . val ( ) , b = d . checkboxToValue ( " # newPersistentUnique " ) , c = d . checkboxToValue ( " # newPersistentSparse " ) , f = { type : " persistent " , fields : d . stringToArray ( a ) , unique : b , sparse : c } ; break ; case " Hash " : a = $ ( " # newHashFields " ) . val ( ) , b = d . checkboxToValue ( " # newHashUnique " ) , c = d . checkboxToValue ( " # newHashSparse " ) , f = { type : " hash " , fields : d . stringToArray ( a ) , unique : b , sparse : c } ; break ; case " Fulltext " : a = $ ( " # newFulltextFields " ) . val ( ) ; var h = parseInt ( $ ( " # newFulltextMinLength " ) . val ( ) , 10 ) | | 0 ; f = { type : " fulltext " , fields : d . stringToArray ( a ) , minLength : h } ; break ; case " Skiplist " : a = $ ( " # newSkiplistFields " ) . val ( ) , b = d . checkboxToValue ( " # newSkiplistUnique " ) , c = d . checkboxToValue ( " # newSkiplistSparse " ) , f = { type : " skiplist " , fields : d . stringToArray ( a ) , unique : b , sparse : c } } var i = function ( a , b ) { if ( a ) if ( b ) { var c = JSON . parse ( b . responseText ) ; arangoHelper . arangoError ( " Document error " , c . errorMessage ) } else arangoHelper . arangoError ( " Document error " , " Could not create index . " ) ; d . toggleNewIndexView ( ) , d . render ( ) } ; this . model . createIndex ( f , i ) } , bindIndexEvents : function ( ) { this . unbindIndexEvents ( ) ; var a = this ; $ ( " # indexEditView # addIndex " ) . bind ( " click " , function ( ) { a . toggleNewIndexView ( ) , $ ( " # cancelIndex " ) . unbind ( " click " ) , $ ( " # cancelIndex " ) . bind ( " click " , function ( ) { a . toggleNewIndexView ( ) , a . render ( ) } ) , $ ( " # createIndex " ) . unbind ( " click " ) , $ ( " # createIndex " ) . bind ( " click " , function ( ) { a . createIndex ( ) } ) } ) , $ ( " # newIndexType " ) . bind ( " change " , function ( ) { a . selectIndexType ( ) } ) , $ ( " . deleteIndex " ) . bind ( " click " , function ( b ) { a . prepDeleteIndex ( b ) } ) , $ ( " # infoTab a " ) . bind ( " click " , function ( a ) { if ( $ ( " # indexDeleteModal " ) . remove ( ) , " Indices " ! = = $ ( a . currentTarget ) . html ( ) | | $ ( a . currentTarget ) . parent ( ) . hasClass ( " active " ) | | ( $ ( " # newIndexView " ) . hide ( ) , $ ( " # indexEditView " ) . show ( ) , $ ( " # indexHeaderContent # modal - dialog . modal - footer . button - danger " ) . hide ( ) , $ ( " # indexHeaderContent # modal - dialog . modal - footer . button - success " ) . hide ( ) , $ ( " # indexHeaderContent # modal - dialog . modal - footer . button - notification " ) . hide ( ) ) , " General " = = = $ ( a . currentTarget ) . html ( ) & & ! $ ( a . currentTarget ) . parent ( ) . hasClass ( " active " ) ) { $ ( " # indexHeaderContent # modal - dialog . modal - footer . button - danger " ) . show ( ) , $ ( " # indexHeaderContent # modal - dialog . modal - footer . button - success " ) . show ( ) , $ ( " # indexHeaderContent # modal - dialog . modal - footer . button - notification " ) . show ( ) ; var b = $ ( " . index - button - bar2 " ) [ 0 ] ; $ ( " # cancelIndex " ) . is ( " : visible " ) & & ( $ ( " # cancelIndex " ) . detach ( ) . appendTo ( b ) , $ ( " # createIndex " ) . detach ( ) . appendTo ( b ) ) } } ) } , prepDeleteIndex : function ( a ) { var b = this ; this . lastTarget = a , this . lastId = $ ( this . lastTarget . currentTarget ) . parent ( ) . parent ( ) . first ( ) . children ( ) . first ( ) . text ( ) , $ ( " # content # modal - dialog . modal - footer " ) . after ( ' < div id = " indexDeleteModal " style = " display : block ; " class = " alert alert - error modal - delete - confirmation " > < strong > Really delete ? < / strong > < button id = " indexConfirmDelete " class = " button - danger pull - right modal - confirm - delete " > Yes < / button > < button id = " indexAbortDelete " class = " button - neutral pull - right " > No < / button > < / div > ' ) , $ ( " # indexHeaderContent # indexConfirmDelete " ) . unbind ( " click " ) , $ ( " # indexHeaderContent # indexConfirmDelete " ) . bind ( " click " , function ( ) { $ ( " # indexHeaderContent # indexDeleteModal " ) . remove ( ) , b . deleteIndex ( ) } ) , $ ( " # indexHeaderContent # indexAbortDelete " ) . unbind ( " click " ) , $ ( " # indexHeaderContent # indexAbortDelete " ) . bind ( " click " , function ( ) { $ ( " # indexHeaderContent # indexDeleteModal " ) . remove ( ) } ) } , unbindIndexEvents : function ( ) { $ ( " # indexHeaderContent # indexEditView # addIndex " ) . unbind ( " click " ) , $ ( " # indexHeaderContent # newIndexType " ) . unbind ( " change " ) , $ ( " # indexHeaderContent # infoTab a " ) . unbind ( " click " ) , $ ( " # indexHeaderContent . deleteIndex " ) . unbind ( " click " ) } , deleteIndex : function ( ) { var a = function ( a ) { a ? ( arangoHelper . arangoError ( " Could not delete index " ) , $ ( " tr th : contains ( ' " + this . lastId + " ' ) " ) . parent ( ) . children ( ) . last ( ) . html ( ' < span class = " deleteIndex icon_arangodb_roundminus " data - original - title = " Delete index " title = " Delete index " > < / span > ' ) , this . model . set ( " locked " , ! 1 ) ) : a | | void 0 = = = a | | ( $ ( " tr th : contains ( ' " + this . lastId + " ' ) " ) . parent ( ) . remove ( ) , this . model . set ( " locked " , ! 1 ) ) } . bind ( this ) ; this . model . set ( " locked " , ! 0 ) , this . model . deleteIndex ( this . lastId , a ) , $ ( " tr th : contains ( ' " + this . lastId + " ' ) " ) . parent ( ) . children ( ) . last ( ) . html ( ' < i class = " fa fa - circle - o - notch fa - spin " > < / i > ' ) } , renderIndex : function ( a ) { this . index = a ; var b = " collectionInfoTh modal - text " ; if ( this . index ) { var c = " " , d = " " ; _ . each ( this . index . indexes , function ( a ) { d = " primary " = = = a . type | | " edge " = = = a . type ? ' < span class = " icon_arangodb_locked " data - original - title = " No action " > < / span > ' : ' < span class = " deleteIndex icon_arangodb_roundminus " data - original - title = " Delete index " title = " Delete index " > < / span > ' , void 0 ! = = a . fields & & ( c = a . fields . join ( " , " ) ) ; var e = a . id . indexOf ( " / " ) , f = a . id . substr ( e + 1 , a . id . length ) , g = a . hasOwnProperty ( " selectivityEstimate " ) ? ( 100 * a . selectivityEstimate ) . toFixed ( 2 ) + " % " : " n / a " , h = a . hasOwnProperty ( " sparse " ) ? a . sparse : " n / a " ; $ ( " # collectionEditIndexTable " ) . append ( " < tr > < th class = " + JSON . stringify ( b ) + " > " + f + " < / th > < th class = " + JSON . stringify ( b ) + " > " + a . type + " < / th > < th class = " + JSON . stringify ( b ) + " > " + a . unique + " < / th > < th class = " + JSON . stringify ( b ) + " > " + h + " < / th > < th class = " + JSON . stringify ( b ) + " > " + g + " < / th > < th class = " + JSON . stringify ( b ) + " > " + c + " < / th > < th class = " + JSON . stringify ( b ) + " > " + d + " < / th > < / tr > " ) } ) } this . bindIndexEvents ( ) } , selectIndexType : function ( ) { $ ( " . newIndexClass " ) . hide ( ) ; var a = $ ( " # newIndexType " ) . val ( ) ; $ ( " # newIndexType " + a ) . show ( ) } , resetIndexForms : function ( ) { $ ( " # indexHeader input " ) . val ( " " ) . prop ( " checked " , ! 1 ) , $ ( " # newIndexType " ) . val ( " Geo " ) . prop ( " selected " , ! 0 ) , this . selectIndexType ( ) } , toggleNewIndexView : function ( ) { var a = $ ( " . index - button - bar2 " ) [ 0 ] ; $ ( " # indexEditView " ) . is ( " : visible " ) ? ( $ ( " # indexEditView " ) . hide ( ) , $ ( " # newIndexView " ) . show ( ) , $ ( " # cancelIndex " ) . detach ( ) . appendTo ( " # indexHeaderContent # modal - dialog . modal - footer " ) , $ ( " # createIndex " ) . detach ( ) . appendTo ( " # indexHeaderContent # modal - dialog . modal - footer " ) ) : ( $ ( " # indexEditView " ) . show ( ) , $ ( " # newIndexView " ) . hide ( ) , $ ( " # cancelIndex " ) . detach ( ) . appendTo ( a ) , $ ( " # createIndex " ) . detach ( ) . appendTo ( a ) ) , arangoHelper . fixTooltips ( " . icon_arangodb , . arangoicon " , " right " ) , this . resetIndexForms ( ) } , stringToArray : function ( a ) { var b = [ ] ; return a . split ( " , " ) . forEach ( function ( a ) { a = a . replace ( / ( ^ \ s + | \ s + $ ) / g , " " ) , " " ! = = a & & b . push ( a ) } ) , b } , checkboxToValue : function ( a ) { return $ ( a ) . prop ( " checked " ) } } ) } ( ) , function ( ) { " use strict " ; window . InfoView = 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 , " Info " ) , this . renderInfoView ( ) } , breadcrumb : function ( ) { $ ( " # subNavigationBar . breadcrumb " ) . html ( " Collection : " + this . collectionName ) } , renderInfoView : function ( ) { if ( this . model . get ( " locked " ) ) return 0 ; var a = function ( a , b , c ) { if ( a ) arangoHelper . arangoError ( " Figures " , " Could not get revision . " ) ; else { var d = [ ] , e = { figures : c , revision : b , model : this . model } ; window . modalView . show ( " modalCollectionInfo . ejs " , " Collection : " + this . model . get ( " name " ) , d , e , null , null , null , null , null , " content " ) } } . bind ( this ) , b = function ( b , c ) { if ( b ) arangoHelper . arangoError ( " Figures " , " Could not get figures . " ) ; else { var d = c ; this . model . getRevision ( a , d ) } } . bind ( this ) ; this . model . getFigures ( b ) } } ) } ( ) , function ( ) { " use strict " ; window . LoginView = Backbone . View . extend ( { el : " # content " , el2 : " . header " , el3 : " . footer " , loggedIn : ! 1 , loginCounter : 0 , events : { " keyPress # loginForm input " : " keyPress " , " click # submitLogin " : " validate " , " submit # dbForm " : " goTo " , " click # logout " : " logout " , " change # loginDatabase " : " renderDBS " } , template : templateEngine . createTemplate ( " loginView . ejs " ) , render : function ( a ) { var b = this ; if ( $ ( this . el ) . html ( this . template . render ( { } ) ) , $ ( this . el2 ) . hide ( ) , $ ( this . el3 ) . hide ( ) , frontendConfig . authenticationEnabled & & a ! = = ! 0 ) window . setTimeout ( function ( ) { $ ( " # loginUsername " ) . focus ( ) } , 300 ) ; else { var c = arangoHelper . databaseUrl ( " / _api / database / user " ) ; frontendConfig . authenticationEnabled = = = ! 1 & & ( $ ( " # logout " ) . hide ( ) , $ ( " . login - window # databases " ) . css ( " height " , " 90px " ) ) , $ ( " # loginForm " ) . hide ( ) , $ ( " . login - window # databases " ) . show ( ) , $ . ajax ( c ) . success ( function ( a ) { $ ( " # loginDatabase " ) . html ( " " ) , _ . each ( a . result , function ( a ) { $ ( " # loginDatabase " ) . append ( " < option > " + a + " < / option > " ) } ) , b . renderDBS ( ) } ) . error ( function ( ) { console . log ( " could not fetch user db data " ) } ) } return $ ( " . bodyWrapper " ) . show ( ) , this } , clear : function ( ) { $ ( " # loginForm input " ) . removeClass ( " form - error " ) , $ ( " . wrong - credentials " ) . hide ( ) } , keyPress : function ( a ) { a . ctrlKey & & 13 = = = a . keyCode ? ( a . preventDefault ( ) , this . validate ( ) ) : a . metaKey & & 13 = = = a . keyCode & & ( a . preventDefault ( ) , this . validate ( ) ) } , validate : function ( a ) { a . preventDefault ( ) , this . clear ( ) ; var b = $ ( " # loginUsername " ) . val ( ) , c = $ ( " # loginPassword " ) . val ( ) ; b & & this . collection . login ( b , c , this . loginCallback . bind ( this , b , c ) ) } , loginCallback : function ( a , b , c ) { var d = this ; if ( c ) { if ( 0 = = = d . loginCounter ) return d . loginCounter + + , void d . collection . login ( a , b , this . loginCallback . bind ( this , a ) ) ; d . loginCounter = 0 , $ ( " . wrong - credentials " ) . show ( ) , $ ( " # loginDatabase " ) . html ( " " ) , $ ( " # loginDatabase " ) . append ( " < option > _system < / option > " ) } else { var e = arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( a ) + " / database " , " _system " ) ; frontendConfig . authenticationEnabled = = = ! 1 & & ( e = arangoHelper . databaseUrl ( " / _api / database / user " ) ) , $ ( " . wrong - credentials " ) . hide ( ) , d . loggedIn = ! 0 , $ . ajax ( e ) . success ( function ( a ) { _ . each ( a . result , function ( b , c ) { " rw " ! = = b & & delete a . result [ c ] } ) , $ ( " # loginForm " ) . hide ( ) , $ ( " . login - window # databases " ) . show ( ) , $ ( " # loginDatabase " ) . html ( " " ) , _ . each ( a . result , function ( a , b ) { $ ( " # loginDatabase " ) . append ( " < option > " + b + " < / option > " ) } ) , d . renderDBS ( ) } ) . error ( function ( ) { $ ( " . wrong - credentials " ) . show ( ) } ) } } , renderDBS : function ( ) { if ( 0 = = = $ ( " # loginDatabase " ) . children ( ) . length ) $ ( " # dbForm " ) . remove ( ) , $ ( " . login - window # databases " ) . prepend ( ' < div class = " no - database " > You do not have permission to a database . < / div > ' ) ; else { var a = $ ( " # loginDatabase " ) . val ( ) ; $ ( " # goToDatabase " ) . html ( " Select DB : " + a ) , window . setTimeout ( function ( ) { $ ( " # goToDatabase " ) . focus ( ) } , 300 ) } } , logout : function ( ) { this . collection . logout ( ) } , goTo : function ( a ) { a . preventDefault ( ) ; var b = $ ( " # loginUsername " ) . val ( ) , c = $ ( " # loginDatabase " ) . val ( ) ; window . App . dbSet = c ; var d = function ( a ) { a & & arangoHelper . arangoError ( " User " , " Could not fetch user settings " ) } , e = window . location . protocol + " / / " + window . location . host + frontendConfig . basePath + " / _db / " + c + " / _admin / aardvark / index . html " ; window . location . href = e , $ ( this . el2 ) . show ( ) , $ ( this . el3 ) . show ( ) , $ ( " . bodyWrapper " ) . show ( ) , $ ( " . navbar " ) . show ( ) , $ ( " # currentUser " ) . text ( b ) , this . collection . loadUserSettings ( d ) } } ) } ( ) , function ( ) { " use strict " ; window . LogsView = window . PaginationView . extend ( { el : " # content " , id : " # logContent " , paginationDiv : " # logPaginationDiv " , idPrefix : " logTable " , fetchedAmount : ! 1 , initialize : function ( a ) { this . options = a , this . convertModelToJSON ( ) } , currentLoglevel : " logall " , events : { " click # arangoLogTabbar button " : " setActiveLoglevel " , " click # logTable_first " : " firstPage " , " click # logTable_last " : " lastPage " } , template : templateEngine . createTemplate ( " logsView . ejs " ) , tabbar : templateEngine . createTemplate ( " arangoTabbar . ejs " ) , table : templateEngine . createTemplate ( " arangoTable . ejs " ) , tabbarElements : { id : " arangoLogTabbar " , titles : [ [ " All " , " logall " ] , [ " Info " , " loginfo " ] , [ " Error " , " logerror " ] , [ " Warning " , " logwarning " ] , [ " Debug " , " logdebug " ] ] } , tableDescription : { id : " arangoLogTable " , titles : [ " Loglevel " , " Date " , " Message " ] , rows : [ ] } , convertedRows : null , setActiveLoglevel : function ( a ) { $ ( " . arangodb - tabbar " ) . removeClass ( " arango - active - tab " ) , this . currentLoglevel ! = = a . currentTarget . id & & ( this . currentLoglevel = a . currentTarget . id , this . convertModelToJSON ( ) ) } , initTotalAmount : function ( ) { var a = this ; this . collection = this . options [ this . currentLoglevel ] , this . collection . fetch ( { data : $ . param ( { test : ! 0 } ) , success : function ( ) { a . convertModelToJSON ( ) } } ) , this . fetchedAmount = ! 0 } , invertArray : function ( a ) { var b , c = [ ] , d = 0 ; for ( b = a . length - 1 ; b > = 0 ; b - - ) c [ d ] = a [ b ] , d + + ; return c } , convertModelToJSON : function ( ) { if ( ! this . fetchedAmount ) return void this . initTotalAmount ( ) ; var a , b = this , c = [ ] ; this . collection = this . options [ this . currentLoglevel ] , this . collection . fetch ( { success : function ( ) { b . collection . each ( function ( b ) { a = new Date ( 1e3 * b . get ( " timestamp " ) ) , c . push ( [ b . getLogStatus ( ) , arangoHelper . formatDT ( a ) , b . get ( " text " ) ] ) } ) , b . tableDescription . rows = b . invertArray ( c ) , b . render ( ) } } ) } , render : function ( ) { return $ ( this . el ) . html ( this . template . render ( { } ) ) , $ ( this . id ) . html ( this . tabbar . render ( { content : this . tabbarElements } ) ) , $ ( this . id ) . append ( this . table . render ( { content : this . tableDescription } ) ) , $ ( " # " + this . currentLoglevel ) . addClass ( " arango - active - tab " ) , $ ( " # logContent " ) . append ( ' < div id = " logPaginationDiv " class = " pagination - line " > < / div > ' ) , this . renderPagination ( ) , this } , rerender : function ( ) { this . convertModelToJSON ( ) } } ) } ( ) , function ( ) { " use strict " ; var a = function ( a , b , c , d ) { return { type : a , title : b , callback : c , confirm : d } } , b = function ( a , b , c , d , e , f , g , h , i , j , k ) { var l = { type : a , label : b } ; return void 0 ! = = c & & ( l . value = c ) , void 0 ! = = d & & ( l . info = d ) , void 0 ! = = e & & ( l . placeholder = e ) , void 0 ! = = f & & ( l . mandatory = f ) , void 0 ! = = h & & ( l . addDelete = h ) , void 0 ! = = i & & ( l . addAdd = i ) , void 0 ! = = j & & ( l . maxEntrySize = j ) , void 0 ! = = k & & ( l . tags = k ) , g & & ( l . validateInput = function ( ) { return g } ) , l } ; window . ModalView = Backbone . View . extend ( { _validators : [ ] , _validateWatchers : [ ] , baseTemplate : templateEngine . createTemplate ( " modalBase . ejs " ) , tableTemplate : templateEngine . createTemplate ( " modalTable . ejs " ) , el : " # modalPlaceholder " , contentEl : " # modalContent " , hideFooter : ! 1 , confirm : { list : " # modal - delete - confirmation " , yes : " # modal - confirm - delete " , no : " # modal - abort - delete " } , enabledHotkey : ! 1 , enableHotKeys : ! 0 , buttons : { SUCCESS : " success " , NOTIFICATION : " notification " , DELETE : " danger " , NEUTRAL : " neutral " , CLOSE : " close " } , tables : { READONLY : " readonly " , TEXT : " text " , BLOB : " blob " , PASSWORD : " password " , SELECT : " select " , SELECT2 : " select2 " , CHECKBOX : " checkbox " } , initialize : function ( ) { Object . freeze ( this . buttons ) , Object . freeze ( this . tables ) } , createModalHotkeys : function ( ) { $ ( this . el ) . unbind ( " keydown " ) , $ ( this . el ) . unbind ( " return " ) , $ ( this . el ) . bind ( " keydown " , " return " , function ( ) { $ ( " . createModalDialog . modal - footer . button - success " ) . click ( ) } ) , $ ( " . modal - body input " ) . unbind ( " keydown " ) , $ ( " . modal - body input " ) . unbind ( " return " ) , $ ( " . modal - body input " , $ ( this . el ) ) . bind ( " keydown " , " return " , function ( ) { $ ( " . createModalDialog . modal - footer . button - success " ) . click ( ) } ) , $ ( " . modal - body select " ) . unbind ( " keydown " ) , $ ( " . modal - body select " ) . unbind ( " return " ) , $ ( " . modal - body select " , $ ( this . el ) ) . bind ( " keydown " , " return " , function ( ) { $ ( " . createModalDialog . modal - footer . button - success " ) . click ( ) } ) } , createInitModalHotkeys : function ( ) { var a = this ; $ ( this . el ) . bind ( " keydown " , " left " , function ( ) { a . navigateThroughButtons ( " left " ) } ) , $ ( this . el ) . bind ( " keydown " , " right " , function ( ) { a . navigateThroughButtons ( " right " ) } ) } , navigateThroughButtons : function ( a ) { var b = $ ( " . createModalDialog . modal - footer button " ) . is ( " : focus " ) ; b = = = ! 1 ? " left " = = = a ? $ ( " . createModalDialog . modal - footer button " ) . first ( ) . focus ( ) : " right " = = = a & & $ ( " . createModalDialog . modal - footer button " ) . last ( ) . focus ( ) : b = = = ! 0 & & ( " left " = = = a ? $ ( " : focus " ) . prev ( ) . focus ( ) : " right " = = = a & & $ ( " : focus " ) . next ( ) . focus ( ) ) } , createCloseButton : function ( b , c ) { var d = this ; return a ( this . buttons . CLOSE , b , function ( ) { d . hide ( ) , c & & c ( ) } ) } , createSuccessButton : function ( b , c ) { return a ( this . buttons . SUCCESS , b , c ) } , createNotificationButton : function ( b , c ) { return a ( this . buttons . NOTIFICATION , b , c ) } , createDeleteButton : function ( b , c , d ) { return a ( this . buttons . DELETE , b , c , d ) } , createNeutralButton : function ( b , c ) { return a ( this . buttons . NEUTRAL , b , c ) } , createDisabledButton : function ( b ) { var c = a ( this . buttons . NEUTRAL , b ) ; return c . disabled = ! 0 , c } , createReadOnlyEntry : function ( a , c , d , e , f , g ) { var h = b ( this . tables . READONLY , c , d , e , void 0 , void 0 , void 0 , f , g ) ; return h . id = a , h } , createTextEntry : function ( a , c , d , e , f , g , h ) { var i = b ( this . tables . TEXT , c , d , e , f , g , h ) ; return i . id = a , i } , createBlobEntry : function ( a , c , d , e , f , g , h ) { var i = b ( this . tables . BLOB , c , d , e , f , g , h ) ; return i . id = a , i } , createSelect2Entry : function ( a , c , d , e , f , g , h , i , j , k ) { var l = b ( this . tables . SELECT2 , c , d , e , f , g , void 0 , h , i , j , k ) ; return l . id = a , l } , createPasswordEntry : function ( a , c , d , e , f , g , h ) { var i = b ( this . tables . PASSWORD , c , d , e , f , g , h ) ; return i . id = a , i } , createCheckboxEntry : function ( a , c , d , e , f ) { var g = b ( this . tables . CHECKBOX , c , d , e ) ; return g . id = a , f & & ( g . checked = f ) , g } , createSelectEntry : function ( a , c , d , e , f ) { var g = b ( this . tables . SELECT , c , null , e ) ; return g . id = a , d & & ( g . selected = d ) , g . options = f , g } , createOptionEntry : function ( a , b ) { return { label : a , value : b | | a } } , show : function ( a , b , c , d , e , f , g , h , i , j ) { var k , l , m = this , n = ! 1 ; c = c | | [ ] , h = Boolean ( h ) , this . clearValidators ( ) , c . length > 0 ? ( c . forEach ( function ( a ) { a . type = = = m . buttons . CLOSE & & ( n = ! 0 ) , a . type = = = m . buttons . DELETE & & ( l = l | | a . confirm ) } ) , n | | ( k = c . pop ( ) , c . push ( m . createCloseButton ( " Cancel " ) ) , c . push ( k ) ) ) : c . push ( m . createCloseButton ( " Close " ) ) , j ? ( $ ( " # " + j ) . html ( this . baseTemplate . render ( { title : b , buttons : c , hideFooter : this . hideFooter , confirm : l , tabBar : i } ) ) , $ ( " # " + j + " # modal - dialog " ) . removeClass ( " fade hide modal " ) , $ ( " # " + j + " . modal - header " ) . remove ( ) , $ ( " # " + j + " . modal - tabbar " ) . remove ( ) , $ ( " # " + j + " . modal - tabbar " ) . remove ( ) , $ ( " # " + j + " . button - close " ) . remove ( ) , 0 = = = $ ( " # " + j + " . modal - footer " ) . children ( ) . length & & $ ( " # " + j + " . modal - footer " ) . remove ( ) ) : $ ( this . el ) . html ( this . baseTemplate . render ( { title : b , buttons : c , hideFooter : this . hideFooter , confirm : l , tabBar : i } ) ) , _ . each ( c , function ( a , b ) { if ( ! a . disabled & & a . callback ) { if ( a . type = = = m . buttons . DELETE & & ! h ) { var c = " # modalButton " + b ; return j & & ( c = " # " + j + " # modalButton " + b ) , void $ ( c ) . bind ( " click " , function ( ) { j ? ( $ ( " # " + j + " " + m . confirm . yes ) . unbind ( " click " ) , $ ( " # " + j + " " + m . confirm . yes ) . bind ( " click " , a . callback ) , $ ( " # " + j + " " + m . confirm . list ) . css ( " display " , " block " ) ) : ( $ ( m . confirm . yes ) . unbind ( " click " ) , $ ( m . confirm . yes ) . bind ( " click " , a . callback ) , $ ( m . confirm . list ) . css ( " display " , " block " ) ) } ) } j ? $ ( " # " + j + " # modalButton " + b ) . bind ( " click " , a . callback ) : $ ( " # modalButton " + b ) . bind ( " click " , a . callback ) } } ) , j ? $ ( " # " + j + " " + this . confirm . no ) . bind ( " click " , function ( ) { $ ( " # " + j + " " + m . confirm . list ) . css ( " display " , " none " ) } ) : $ ( this . confirm . no ) . bind ( " click " , function ( ) { $ ( m . confirm . list ) . css ( " display " , " none " ) } ) ; var o ; if ( " string " = = typeof a ) o = templateEngine . createTemplate ( a ) , j ? $ ( " # " + j + " . createModalDialog . modal - body " ) . html ( o . render ( { content : d , advancedContent : e , info : f } ) ) : $ ( " # modalPlaceholder . createModalDialog . modal - body " ) . html ( o . render ( { content : d , advancedContent : e , info : f } ) ) ; else { var p = 0 ; _ . each ( a , function ( a ) { o = templateEngine . createTemplate ( a ) , $ ( " . createModalDialog . modal - body . tab - content # " + i [ p ] ) . html ( o . render ( { content : d , advancedContent : e , info : f } ) ) , p + + } ) } $ ( " . createModalDialog . modalTooltips " ) . tooltip ( { position : { my : " left top " , at : " right + 55 top - 1 " } } ) ; var q = d | | [ ] ; e & & e . content & & ( q = q . concat ( e . content ) ) , _ . each ( q , function ( a ) { m . modalBindValidation ( a ) , a . type = = = m . tables . SELECT2 & & $ ( " # " + a . id ) . select2 ( { tags : a . tags | | [ ] , showSearchBox : ! 1 , minimumResultsForSearch : - 1 , width : " 336px " , maximumSelectionSize : a . maxEntrySize | | 8 } ) } ) , g & & ( this . events = g , this . delegateEvents ( ) ) , $ ( " # accordion2 " ) & & ( $ ( " # accordion2 . accordion - toggle " ) . bind ( " click " , function ( ) { $ ( " # collapseOne " ) . is ( " : visible " ) ? ( $ ( " # collapseOne " ) . hide ( ) , setTimeout ( function ( ) { $ ( " . accordion - toggle " ) . addClass ( " collapsed " ) } , 100 ) ) : ( $ ( " # collapseOne " ) . show ( ) , setTimeout ( function ( ) { $ ( " . accordion - toggle " ) . removeClass ( " collapsed " ) } , 100 ) ) } ) , $ ( " # collapseOne " ) . hide ( ) , setTimeout ( function ( ) { $ ( " . accordion - toggle " ) . addClass ( " collapsed " ) } , 100 ) ) , j | | $ ( " # modal - dialog " ) . modal ( " show " ) , this . enabledHotkey = = = ! 1 & & ( this . createInitModalHotkeys ( ) , this . enabledHotkey = ! 0 ) , this . enableHotKeys & & this . createModalHotkeys ( ) ; var r ; r = j ? $ ( " # " + j + " # modal - dialog " ) . find ( " input " ) : $ ( " # modal - dialog " ) . find ( " input " ) , r & & setTimeout ( function ( ) { r = j ? $ ( " # " + j + " # modal - dialog " ) : $ ( " # modal - dialog " ) , r . length > 0 & & ( r = r . find ( " input " ) , r . length > 0 & & $ ( r [ 0 ] ) . focus ( ) ) } , 400 ) } , modalBindValidation : function ( a ) { var b = this ; if ( a . hasOwnProperty ( " id " ) & & a . hasOwnProperty ( " validateInput " ) ) { var c = function ( ) { var b = $ ( " # " + a . id ) , c = a . validateInput ( b ) , d = ! 1 ; return _ . each ( c , function ( a ) { var c = b . val ( ) ; if ( a . rule | | ( a = { rule : a } ) , " function " = = typeof a . rule ) try { a . rule ( c ) } catch ( e ) { d = a . msg | | e . message } else { var f = Joi . validate ( c , a . rule ) ; f . error & & ( d = a . msg | | f . error . message ) } return d ? ! 1 : void 0 } ) , d ? d : void 0 } , d = $ ( " # " + a . id ) ; d . on ( " keyup focusout " , function ( ) { var a = c ( ) , e = d . next ( ) [ 0 ] ; a ? ( d . addClass ( " invalid - input " ) , e ? $ ( e ) . text ( a ) : d . after ( ' < p class = " errorMessage " > ' + a + " < / p > " ) , $ ( " . createModalDialog . modal - footer . button - success " ) . prop ( " disabled " , ! 0 ) . addClass ( " disabled " ) ) : ( d . removeClass ( " invalid - input " ) , e & & $ ( e ) . remove ( ) , b . modalTestAll ( ) ) } ) , this . _validators . push ( c ) , this . _validateWatchers . push ( d ) } } , modalTestAll : function ( ) { var a = _ . map ( this . _validators , function ( a ) { return a ( ) } ) , b = _ . any ( a ) ; return b ? $ ( " . createModalDialog . modal - footer . button - success " ) . prop ( " disabled " , ! 0 ) . addClass ( " disabled " ) : $ ( " . createModalDialog . modal - footer . button - success " ) . prop ( " disabled " , ! 1 ) . removeClass ( " disabled " ) , ! b } , clearValidators : function ( ) { this . _validators = [ ] , _ . each ( this . _validateWatchers , function ( a ) { a . unbind ( " keyup focusout " ) } ) , this . _validateWatchers = [ ] } , hide : function ( ) { this . clearValidators ( ) , $ ( " # modal - dialog " ) . modal ( " hide " ) } } ) } ( ) , function ( ) { " use strict " ; window . NavigationView = Backbone . View . extend ( { el : " # navigationBar " , subEl : " # subNavigationBar " , events : { " change # arangoCollectionSelect " : " navigateBySelect " , " click . tab " : " navigateByTab " , " click li " : " switchTab " , " click . arangodbLogo " : " selectMenuItem " , " mouseenter . dropdown > * " : " showDropdown " , " click . shortcut - icons p " : " showShortcutModal " , " mouseleave . dropdown " : " hideDropdown " } , renderFirst : ! 0 , activeSubMenu : void 0 , changeDB : function ( ) { window . location . hash = " # login " } , initialize : function ( a ) { var b = this ; this . userCollection = a . userCollection , this . currentDB = a . currentDB , this . dbSelectionView = new window . DBSelectionView ( { collection : a . database , current : this . currentDB } ) , this . userBarView = new window . UserBarView ( { userCollection : this . userCollection } ) , this . notificationView = new window . NotificationView ( { collection : a . notificationCollection } ) , this . statisticBarView = new window . StatisticBarView ( { currentDB : this . currentDB } ) , this . isCluster = a . isCluster , this . handleKeyboardHotkeys ( ) , Backbone . history . on ( " all " , function ( ) { b . selectMenuItem ( ) } ) } , showShortcutModal : function ( ) { arangoHelper . hotkeysFunctions . showHotkeysModal ( ) } , handleSelectDatabase : function ( ) { this . dbSelectionView . render ( $ ( " # dbSelect " ) ) } , template : templateEngine . createTemplate ( " navigationView . ejs " ) , templateSub : templateEngine . createTemplate ( " subNavigationView . ejs " ) , render : function ( ) { var a = this ; $ ( this . el ) . html ( this . template . render ( { currentDB : this . currentDB , isCluster : this . isCluster } ) ) , " _system " ! = = this . currentDB . get ( " name " ) & & $ ( " # dashboard " ) . parent ( ) . remove ( ) , $ ( this . subEl ) . html ( this . templateSub . render ( { currentDB : this . currentDB . toJSON ( ) } ) ) , this . dbSelectionView . render ( $ ( " # dbSelect " ) ) ; var b = function ( a ) { a | | this . userBarView . render ( ) } . bind ( this ) ; return this . userCollection . whoAmI ( b ) , this . renderFirst & & ( this . renderFirst = ! 1 , this . selectMenuItem ( ) , $ ( " . arangodbLogo " ) . on ( " click " , function ( ) { a . selectMenuItem ( ) } ) , $ ( " # dbStatus " ) . on ( " click " , function ( ) { a . changeDB ( ) } ) ) , this } , navigateBySelect : function ( ) { var a = $ ( " # arangoCollectionSelect " ) . find ( " option : selected " ) . val ( ) ; window . App . navigate ( a , { trigger : ! 0 } ) } , handleKeyboardHotkeys : function ( ) { arangoHelper . enableKeyboardHotkeys ( ! 0 ) } , navigateByTab : function ( a ) { var b = a . target | | a . srcElement , c = b . id , d = ! 1 ; $ ( b ) . hasClass ( " fa " ) | | ( " " = = = c & & ( c = $ ( b ) . attr ( " class " ) ) , " links " = = = c ? ( d = ! 0 , $ ( " # link_dropdown " ) . slideToggle ( 1 ) , a . preventDefault ( ) ) : " tools " = = = c ? ( d = ! 0 , $ ( " # tools_dropdown " ) . slideToggle ( 1 ) , a . preventDefault ( ) ) : " dbselection " = = = c & & ( d = ! 0 , $ ( " # dbs_dropdown " ) . slideToggle ( 1 ) , a . preventDefault ( ) ) , d | | ( window . App . navigate ( c , { trigger : ! 0 } ) , a . preventDefault ( ) ) ) } , handleSelectNavigation : function ( ) { var a = this ; $ ( " # arangoCollectionSelect " ) . change ( function ( ) { a . navigateBySelect ( ) } ) } , subViewConfig : { documents : " collections " , collection : " collections " } , subMenuConfig : { cluster : [ { name : " Dashboard " , view : void 0 , active : ! 0 } , { name : " Logs " , view : void 0 , disabled : ! 0 } ] , collections : [ { name : " " , view : void 0 , active : ! 1 } ] , queries : [ { name : " Editor " , route : " query " , active : ! 0 } , { name : " Running Queries " , route : " queryManagement " , params : { active : ! 0 } , active : void 0 } , { name : " Slow Query History " , route : " queryManagement " , params : { active : ! 1 } , active : void 0 } ] } , renderSubMenu : function ( a ) { var b = this ; if ( void 0 = = = a & & ( a = window . isCluster ? " cluster " : " dashboard " ) , this . subMenuConfig [ a ] ) { $ ( this . subEl + " . bottom " ) . html ( " " ) ; var c = " " ; _ . each ( this . subMenuConfig [ a ] , function ( a ) { c = a . active ? " active " : " " , a . disabled & & ( c = " disabled " ) , $ ( b . subEl + " . bottom " ) . append ( ' < li class = " subMenuEntry ' + c + ' " > < a > ' + a . name + " < / a > < / li > " ) , a . disabled | | $ ( b . subEl + " . bottom " ) . children ( ) . last ( ) . bind ( " click " , function ( c ) { b . activeSubMenu = a , b . renderSubView ( a , c ) } ) } ) } } , renderSubView : function ( a , b ) { window . App [ a . route ] & & ( window . App [ a . route ] . resetState & & window . App [ a . route ] . resetState ( ) , window . App [ a . route ] ( ) ) , $ ( this . subEl + " . bottom " ) . children ( ) . removeClass ( " active " ) , $ ( b . currentTarget ) . addClass ( " active " ) } , switchTab : function ( a ) { var b = $ ( a . currentTarget ) . children ( ) . first ( ) . attr ( " id " ) ; b & & this . selectMenuItem ( b + " - menu " ) } , selectMenuItem : function ( a , b ) { void 0 = = = a & & ( a = window . location . hash . split ( " / " ) [ 0 ] , a = a . substr ( 1 , a . length - 1 ) ) , " " = = = a ? a = window . App . isCluster ? " cluster " : " dashboard " : " cNodes " ! = = a & & " dNodes " ! = = a | | ( a = " nodes " ) ; try { this . renderSubMenu ( a . split ( " - " ) [ 0 ] ) } catch ( c ) { this . renderSubMenu ( a ) } $ ( " . navlist li " ) . removeClass ( " active " ) , " string " = = typeof a & & ( b ? $ ( " . " + this . subViewConfig [ a ] + " - menu " ) . addClass ( " active " ) : a & & ( $ ( " . " + a ) . addClass ( " active " ) , $ ( " . " + a + " - menu " ) . addClass ( " active " ) ) ) , arangoHelper . hideArangoNotifications ( ) } , showSubDropdown : function ( a ) { $ ( a . currentTarget ) . find ( " . subBarDropdown " ) . toggle ( ) } , showDropdown : function ( a ) { var b = a . target | | a . srcElement , c = b . id ; " links " = = = c | | " link_dropdown " = = = c | | " links " = = = a . currentTarget . id ? $ ( " # link_dropdown " ) . fadeIn ( 1 ) : " tools " = = = c | | " tools_dropdown " = = = c | | " tools " = = = a . currentTarget . id ? $ ( " # tools_dropdown " ) . fadeIn ( 1 ) : " dbselection " ! = = c & & " dbs_dropdown " ! = = c & & " dbselection " ! = = a . currentTarget . id | | $ ( " # dbs_dropdown " ) . fadeIn ( 1 ) ; <nl> - } , hideDropdown : function ( a ) { var b = a . target | | a . srcElement ; b = $ ( b ) . parent ( ) , $ ( " # link_dropdown " ) . fadeOut ( 1 ) , $ ( " # tools_dropdown " ) . fadeOut ( 1 ) , $ ( " # dbs_dropdown " ) . fadeOut ( 1 ) } } ) } ( ) , function ( ) { " use strict " ; window . NodesView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " nodesView . ejs " ) , interval : 5e3 , knownServers : [ ] , events : { " click # nodesContent . pure - table - body . pure - table - row " : " navigateToNode " } , initialize : function ( a ) { var b = this ; clearInterval ( this . intervalFunction ) , window . App . isCluster & & ( this . dbServers = a . dbServers , this . coordinators = a . coordinators , this . updateServerTime ( ) , this . toRender = a . toRender , this . intervalFunction = window . setInterval ( function ( ) { " # cNodes " ! = = window . location . hash & & " # dNodes " ! = = window . location . hash & & " # nodes " ! = = window . location . hash | | b . checkNodesState ( ) } , this . interval ) ) } , checkNodesState : function ( ) { var a = function ( a ) { _ . each ( a , function ( a , b ) { _ . each ( $ ( " . pure - table - row " ) , function ( c ) { $ ( c ) . attr ( " node " ) = = = b & & ( " GOOD " = = = a . Status ? ( $ ( c ) . removeClass ( " noHover " ) , $ ( c ) . find ( " . state " ) . html ( ' < i class = " fa fa - check - circle " > < / i > ' ) ) : ( $ ( c ) . addClass ( " noHover " ) , $ ( c ) . find ( " . state " ) . html ( ' < i class = " fa fa - exclamation - circle " > < / i > ' ) ) ) } ) } ) } ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / health " ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( b ) { a ( b . Health ) } } ) } , navigateToNode : function ( a ) { if ( " # dNodes " ! = = window . location . hash & & ! $ ( a . currentTarget ) . hasClass ( " noHover " ) ) { var b = $ ( a . currentTarget ) . attr ( " node " ) ; window . App . navigate ( " # node / " + encodeURIComponent ( b ) , { trigger : ! 0 } ) } } , render : function ( ) { var a = function ( ) { this . continueRender ( ) } . bind ( this ) ; this . initDoneCoords ? a ( ) : this . waitForCoordinators ( a ) } , continueRender : function ( ) { var a ; a = " coordinator " = = = this . toRender ? this . coordinators . toJSON ( ) : this . dbServers . toJSON ( ) , this . $ el . html ( this . template . render ( { coords : a , type : this . toRender } ) ) , window . arangoHelper . buildNodesSubNav ( this . toRender ) , this . checkNodesState ( ) } , waitForCoordinators : function ( a ) { var b = this ; window . setTimeout ( function ( ) { 0 = = = b . coordinators . length ? b . waitForCoordinators ( a ) : ( this . initDoneCoords = ! 0 , a ( ) ) } , 200 ) } , updateServerTime : function ( ) { this . serverTime = ( new Date ) . getTime ( ) } } ) } ( ) , function ( ) { " use strict " ; window . NodesView2 = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " nodesView2 . ejs " ) , interval : 1e4 , knownServers : [ ] , events : { " click # nodesContent . coords - nodes . pure - table - row " : " navigateToNode " , " click # addCoord " : " addCoord " , " click # removeCoord " : " removeCoord " , " click # addDBs " : " addDBs " , " click # removeDBs " : " removeDBs " } , initialize : function ( ) { var a = this ; clearInterval ( this . intervalFunction ) , window . App . isCluster & & ( this . updateServerTime ( ) , this . intervalFunction = window . setInterval ( function ( ) { " # nodes " = = = window . location . hash & & a . render ( ! 1 ) } , this . interval ) ) } , navigateToNode : function ( a ) { if ( ! $ ( a . currentTarget ) . hasClass ( " noHover " ) ) { var b = $ ( a . currentTarget ) . attr ( " node " ) . slice ( 0 , - 5 ) ; window . App . navigate ( " # node / " + encodeURIComponent ( b ) , { trigger : ! 0 } ) } } , render : function ( a ) { var b = this , c = function ( a ) { $ . ajax ( { type : " GET " , url : arangoHelper . databaseUrl ( " / _admin / cluster / numberOfServers " ) , contentType : " application / json " , success : function ( c ) { b . continueRender ( a , c ) } } ) } ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / health " ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( a ) { c ( a . Health ) } , error : function ( ) { arangoHelper . arangoError ( " Cluster " , " Could not fetch cluster information " ) } } ) , a ! = = ! 1 & & arangoHelper . buildNodesSubNav ( " Overview " ) } , continueRender : function ( a , b ) { var c = { } , d = { } , e = ! 1 ; _ . each ( a , function ( a , b ) { " Coordinator " = = = a . Role ? c [ b ] = a : " DBServer " = = = a . Role & & ( d [ b ] = a ) } ) , null ! = = b . numberOfDBServers & & null ! = = b . numberOfCoordinators & & ( e = ! 0 ) ; var f = function ( a ) { this . $ el . html ( this . template . render ( { coords : c , dbs : d , scaling : e , scaleProperties : a , plannedDBs : b . numberOfDBServers , plannedCoords : b . numberOfCoordinators } ) ) , e | | ( $ ( " . title " ) . css ( " position " , " relative " ) , $ ( " . title " ) . css ( " top " , " - 4px " ) , $ ( " . sectionHeader . information " ) . css ( " margin - top " , " - 3px " ) ) } . bind ( this ) ; this . renderCounts ( e , f ) } , updatePlanned : function ( a ) { a . numberOfCoordinators & & ( $ ( " # plannedCoords " ) . val ( a . numberOfCoordinators ) , this . renderCounts ( ! 0 ) ) , a . numberOfDBServers & & ( $ ( " # plannedDBs " ) . val ( a . numberOfDBServers ) , this . renderCounts ( ! 0 ) ) } , setCoordSize : function ( a ) { var b = this , c = { numberOfCoordinators : a } ; $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _admin / cluster / numberOfServers " ) , contentType : " application / json " , data : JSON . stringify ( c ) , success : function ( ) { b . updatePlanned ( c ) } , error : function ( ) { arangoHelper . arangoError ( " Scale " , " Could not set coordinator size . " ) } } ) } , setDBsSize : function ( a ) { var b = this , c = { numberOfDBServers : a } ; $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _admin / cluster / numberOfServers " ) , contentType : " application / json " , data : JSON . stringify ( c ) , success : function ( ) { b . updatePlanned ( c ) } , error : function ( ) { arangoHelper . arangoError ( " Scale " , " Could not set coordinator size . " ) } } ) } , renderCounts : function ( a , b ) { var c = function ( b , c , d , e ) { var f = ' < span class = " positive " > < span > ' + c + ' < / span > < i class = " fa fa - check - circle " > < / i > < / span > ' ; d & & a = = = ! 0 & & ( f = f + ' < span class = " warning " > < span > ' + d + ' < / span > < i class = " fa fa - circle - o - notch fa - spin " > < / i > < / span > ' ) , e & & ( f = f + ' < span class = " negative " > < span > ' + e + ' < / span > < i class = " fa fa - exclamation - circle " > < / i > < / span > ' ) , $ ( b ) . html ( f ) , a | | ( $ ( " . title " ) . css ( " position " , " relative " ) , $ ( " . title " ) . css ( " top " , " - 4px " ) ) } , d = function ( a ) { var d = 0 , e = 0 , f = 0 , g = 0 , h = 0 , i = 0 ; _ . each ( a , function ( a ) { " Coordinator " = = = a . Role ? " GOOD " = = = a . Status ? e + + : d + + : " DBServer " = = = a . Role & & ( " GOOD " = = = a . Status ? g + + : h + + ) } ) , $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / numberOfServers " ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { f = Math . abs ( e + d - a . numberOfCoordinators ) , i = Math . abs ( g + h - a . numberOfDBServers ) , b ? b ( { coordsPending : f , coordsOk : e , coordsErrors : d , dbsPending : i , dbsOk : g , dbsErrors : h } ) : ( c ( " # infoDBs " , g , i , h ) , c ( " # infoCoords " , e , f , d ) ) } } ) } ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / health " ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { d ( a . Health ) } } ) } , addCoord : function ( ) { this . setCoordSize ( this . readNumberFromID ( " # plannedCoords " , ! 0 ) ) } , removeCoord : function ( ) { this . setCoordSize ( this . readNumberFromID ( " # plannedCoords " , ! 1 , ! 0 ) ) } , addDBs : function ( ) { this . setDBsSize ( this . readNumberFromID ( " # plannedDBs " , ! 0 ) ) } , removeDBs : function ( ) { this . setDBsSize ( this . readNumberFromID ( " # plannedDBs " , ! 1 , ! 0 ) ) } , readNumberFromID : function ( a , b , c ) { var d = $ ( a ) . val ( ) , e = ! 1 ; try { e = JSON . parse ( d ) } catch ( f ) { } return b & & e + + , c & & 1 ! = = e & & e - - , e } , updateServerTime : function ( ) { this . serverTime = ( new Date ) . getTime ( ) } } ) } ( ) , function ( ) { " use strict " ; window . NodeView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " nodeView . ejs " ) , interval : 5e3 , dashboards : [ ] , events : { } , initialize : function ( a ) { window . App . isCluster & & ( this . coordinators = a . coordinators , this . dbServers = a . dbServers , this . coordname = a . coordname , this . updateServerTime ( ) ) } , breadcrumb : function ( a ) { $ ( " # subNavigationBar . breadcrumb " ) . html ( " Node : " + a ) } , render : function ( ) { this . $ el . html ( this . template . render ( { coords : [ ] } ) ) ; var a = function ( ) { this . continueRender ( ) , this . breadcrumb ( this . coordname ) , $ ( window ) . trigger ( " resize " ) } . bind ( this ) ; this . initCoordDone | | this . waitForCoordinators ( ) , this . initDBDone ? ( this . coordname = window . location . hash . split ( " / " ) [ 1 ] , this . coordinator = this . coordinators . findWhere ( { name : this . coordname } ) , a ( ) ) : this . waitForDBServers ( a ) } , continueRender : function ( ) { var a = this ; this . dashboards [ this . coordinator . get ( " name " ) ] = new window . DashboardView ( { dygraphConfig : window . dygraphConfig , database : window . App . arangoDatabase , serverToShow : { raw : this . coordinator . get ( " address " ) , isDBServer : ! 1 , endpoint : this . coordinator . get ( " protocol " ) + " : / / " + this . coordinator . get ( " address " ) , target : this . coordinator . get ( " name " ) } } ) , this . dashboards [ this . coordinator . get ( " name " ) ] . render ( ) , window . setTimeout ( function ( ) { a . dashboards [ a . coordinator . get ( " name " ) ] . resize ( ) } , 500 ) } , waitForCoordinators : function ( a ) { var b = this ; window . setTimeout ( function ( ) { 0 = = = b . coordinators . length ? b . waitForCoordinators ( a ) : ( b . coordinator = b . coordinators . findWhere ( { name : b . coordname } ) , b . initCoordDone = ! 0 , a & & a ( ) ) } , 200 ) } , waitForDBServers : function ( a ) { var b = this ; window . setTimeout ( function ( ) { 0 = = = b . dbServers [ 0 ] . length ? b . waitForDBServers ( a ) : ( b . initDBDone = ! 0 , b . dbServer = b . dbServers [ 0 ] , b . dbServer . each ( function ( a ) { " DBServer001 " = = = a . get ( " name " ) & & ( b . dbServer = a ) } ) , a ( ) ) } , 200 ) } , updateServerTime : function ( ) { this . serverTime = ( new Date ) . getTime ( ) } } ) } ( ) , function ( ) { " use strict " ; window . NotificationView = Backbone . View . extend ( { events : { " click . navlogo # stat_hd " : " toggleNotification " , " click . notificationItem . fa " : " removeNotification " , " click # removeAllNotifications " : " removeAllNotifications " } , initialize : function ( ) { this . collection . bind ( " add " , this . renderNotifications . bind ( this ) ) , this . collection . bind ( " remove " , this . renderNotifications . bind ( this ) ) , this . collection . bind ( " reset " , this . renderNotifications . bind ( this ) ) , window . setTimeout ( function ( ) { frontendConfig . authenticationEnabled = = = ! 1 & & frontendConfig . isCluster = = = ! 1 & & arangoHelper . showAuthDialog ( ) = = = ! 0 & & window . arangoHelper . arangoWarning ( " Warning " , " Authentication is disabled . Do not use this setup in production mode . " ) } , 2e3 ) } , notificationItem : templateEngine . createTemplate ( " notificationItem . ejs " ) , el : " # notificationBar " , template : templateEngine . createTemplate ( " notificationView . ejs " ) , toggleNotification : function ( ) { var a = this . collection . length ; 0 ! = = a & & $ ( " # notification_menu " ) . toggle ( ) } , removeAllNotifications : function ( ) { $ . noty . clearQueue ( ) , $ . noty . closeAll ( ) , this . collection . reset ( ) , $ ( " # notification_menu " ) . hide ( ) } , removeNotification : function ( a ) { var b = a . target . id ; this . collection . get ( b ) . destroy ( ) } , renderNotifications : function ( a , b , c ) { if ( c & & c . add ) { var d , e = this . collection . at ( this . collection . length - 1 ) , f = e . get ( " title " ) , g = 3e3 , h = [ " click " ] ; if ( e . get ( " content " ) & & ( f = f + " : " + e . get ( " content " ) ) , " error " = = = e . get ( " type " ) ? ( g = ! 1 , h = [ " button " ] , d = [ { addClass : " button - danger " , text : " Close " , onClick : function ( a ) { a . close ( ) } } ] ) : " warning " = = = e . get ( " type " ) & & ( g = 15e3 , d = [ { addClass : " button - warning " , text : " Close " , onClick : function ( a ) { a . close ( ) } } , { addClass : " button - danger " , text : " Don ' t show again . " , onClick : function ( a ) { a . close ( ) , window . arangoHelper . doNotShowAgain ( ) } } ] ) , $ . noty . clearQueue ( ) , $ . noty . closeAll ( ) , noty ( { theme : " relax " , text : f , template : ' < div class = " noty_message arango_message " > < div > < i class = " fa fa - close " > < / i > < / div > < span class = " noty_text arango_text " > < / span > < div class = " noty_close arango_close " > < / div > < / div > ' , 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 ( ' < button class = " button - danger " > ' + c + " < / button > " ) : $ ( " . progress - action " ) . html ( ' < button class = " button - danger " > Cancel < / button > ' ) , 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 = ' < i data - id = " ' + b . get ( " id " ) + ' " class = " fa fa - minus - circle " > < / i > ' ) , 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 " , bindParamId : " # bindParamEditor " , myQueriesId : " # queryTable " , template : templateEngine . createTemplate ( " queryView . 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 " ) ; var c = " query / download / " + encodeURIComponent ( a ) ; arangoHelper . download ( c ) } ) } , 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 ( ' < span id = " lastQuery " class = " clickable " > Previous Query < / span > ' ) , $ ( " # 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 ( ) ; if ( " " ! = = d | | void 0 ! = = d | | null ! = = d ) { var e ; e = 0 = = = Object . keys ( this . bindParamTableObj ) . length ? " query / result / download / " + encodeURIComponent ( btoa ( JSON . stringify ( { query : d } ) ) ) : " query / result / download / " + encodeURIComponent ( btoa ( JSON . stringify ( { query : d , bindVars : this . bindParamTableObj } ) ) ) , arangoHelper . download ( e ) } else 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 : arangoHelper . databaseUrl ( " / _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 ( ' < option value = " ' + _ . escape ( c ) + ' " ' + ( a = = = c ? " selected " : " " ) + " > " + _ . escape ( c ) + " results < / option > " ) } ) } , 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 ( ) } , 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 ( " < tr > < td > " + c + " < / td > < td > < input name = " + c + ' type = " text " > < / input > < / td > < / tr > ' ) , 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 ( ' < tr class = " noBgColor " > < td > No bind parameters defined . < / td > < td > < / td > < / tr > ' ) } , 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 " ) , <nl> - this . aqlEditor . getSession ( ) . setMode ( " ace / mode / aql " ) , this . aqlEditor . setFontSize ( " 10pt " ) , this . aqlEditor . setShowPrintMargin ( ! 1 ) , this . bindParamAceEditor = ace . edit ( " bindParamAceEditor " ) , this . bindParamAceEditor . getSession ( ) . setMode ( " ace / mode / json " ) , this . bindParamAceEditor . setFontSize ( " 10pt " ) , this . bindParamAceEditor . setShowPrintMargin ( ! 1 ) , 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 . name < b . name ? - 1 : a . name > b . name ? 1 : 0 } var b = this ; this . updateLocalQueries ( ) , this . myQueriesTableDesc . rows = this . customQueries , _ . each ( this . myQueriesTableDesc . rows , function ( a ) { a . secondRow = ' < span class = " spanWrapper " > < span id = " copyQuery " title = " Copy query " > < i class = " fa fa - copy " > < / i > < / span > < span id = " explQuery " title = " Explain query " > < i class = " fa fa - comments " > < / i > < / i > < / span > < span id = " runQuery " title = " Run query " > < i class = " fa fa - play - circle - o " > < / i > < / i > < / span > < span id = " deleteQuery " title = " Delete query " > < i class = " fa fa - minus - circle " > < / i > < / span > < / span > ' , 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 : ' < span class = " spanWrapper " > < span id = " copyQuery " title = " Copy query " > < i class = " fa fa - copy " > < / i > < / span > < / span > ' } ) } ) , this . myQueriesTableDesc . unescaped = [ ! 1 , ! 0 , ! 0 ] , this . $ ( this . myQueriesId ) . html ( this . table . render ( { content : this . myQueriesTableDesc } ) ) } , listenKey : function ( a ) { 13 = = = a . keyCode & & " Update " = = = $ ( " # modalButton1 " ) . html ( ) & & this . saveAQL ( ) , 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 & & 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 ) , b . setShowPrintMargin ( ! 1 ) , 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 = $ ( " # querySize " ) , b = { query : this . aqlEditor . getValue ( ) , id : " currentFrontendQuery " } ; return " all " = = = a . val ( ) ? b . batchSize = 1e6 : b . batchSize = parseInt ( a . val ( ) , 10 ) , Object . keys ( this . bindParamTableObj ) . length > 0 & & ( b . bindVars = this . bindParamTableObj ) , JSON . stringify ( b ) } , fillResult : function ( a , b , c ) { var d = this , e = this . readQueryData ( ) ; e & & ( b . setValue ( d . aqlEditor . getValue ( ) , 1 ) , $ . ajax ( { type : " POST " , url : arangoHelper . databaseUrl ( " / _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 ( ) { var a = this ; window . progressView . hide ( ) , $ ( " # removeResults " ) . show ( ) , window . setTimeout ( function ( ) { a . aqlEditor . focus ( ) } , 300 ) , $ ( " . centralRow " ) . animate ( { scrollTop : $ ( " # queryContent " ) . height ( ) } , " fast " ) } , setEditorAutoHeight : function ( a ) { var b = $ ( " . centralRow " ) . height ( ) , c = ( b - 250 ) / 17 ; a . setOptions ( { maxLines : c , 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 : arangoHelper . databaseUrl ( " / _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 , d ) { d | | ( d = " " ) , $ ( " # outputEditorWrapper " + c + " . arangoToolbarTop . pull - left " ) . append ( ' < span class = " ' + d + ' " > < i class = " fa ' + b + ' " > < / i > < i class = " iconText " > ' + a + " < / i > < / span > " ) } ; $ ( " # outputEditorWrapper " + c + " . pull - left # spinner " ) . remove ( ) ; var g = " - " ; a & & a . extra & & a . extra . stats & & ( g = a . extra . stats . executionTime . toFixed ( 3 ) + " s " ) , e ( a . result . length + " elements " , " fa - calculator " ) , 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 " , " additional " ) : e ( a . extra . stats . writesIgnored + " writes ignored " , " fa - exclamation - circle warning " , " additional " ) ) , a . extra . stats . scannedFull > 0 ? e ( " full collection scan " , " fa - exclamation - circle warning " , " additional " ) : e ( " no full collection scan " , " fa - check - circle positive " , " additional " ) ) , $ ( " # 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 ) , a . id & & $ . ajax ( { url : " / _api / cursor / " + encodeURIComponent ( a . id ) , type : " DELETE " } ) } , h = function ( ) { $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _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 ) { if ( d . removeOutputEditor ( c ) , 409 = = = b . code ) return ; 400 ! = = b . code & & 404 ! = = b . code & & arangoHelper . arangoNotification ( " Query " , " Successfully aborted . " ) } 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 ( ) ) } , c = function ( ) { a . getSystemQueries ( b ) } ; 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 " ) } ; b . collection . saveCollectionQueries ( e ) } b . updateLocalQueries ( ) , a & & a ( ) } } ) } } ) } ( ) , function ( ) { " use strict " ; window . ScaleView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " scaleView . ejs " ) , interval : 1e4 , knownServers : [ ] , events : { " click # addCoord " : " addCoord " , " click # removeCoord " : " removeCoord " , " click # addDBs " : " addDBs " , " click # removeDBs " : " removeDBs " } , setCoordSize : function ( a ) { var b = this , c = { numberOfCoordinators : a } ; $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _admin / cluster / numberOfServers " ) , contentType : " application / json " , data : JSON . stringify ( c ) , success : function ( ) { b . updateTable ( c ) } , error : function ( ) { arangoHelper . arangoError ( " Scale " , " Could not set coordinator size . " ) } } ) } , setDBsSize : function ( a ) { var b = this , c = { numberOfDBServers : a } ; $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _admin / cluster / numberOfServers " ) , contentType : " application / json " , data : JSON . stringify ( c ) , success : function ( ) { b . updateTable ( c ) } , error : function ( ) { arangoHelper . arangoError ( " Scale " , " Could not set coordinator size . " ) } } ) } , addCoord : function ( ) { this . setCoordSize ( this . readNumberFromID ( " # plannedCoords " , ! 0 ) ) } , removeCoord : function ( ) { this . setCoordSize ( this . readNumberFromID ( " # plannedCoords " , ! 1 , ! 0 ) ) } , addDBs : function ( ) { this . setDBsSize ( this . readNumberFromID ( " # plannedDBs " , ! 0 ) ) } , removeDBs : function ( ) { this . setDBsSize ( this . readNumberFromID ( " # plannedDBs " , ! 1 , ! 0 ) ) } , readNumberFromID : function ( a , b , c ) { var d = $ ( a ) . html ( ) , e = ! 1 ; try { e = JSON . parse ( d ) } catch ( f ) { } return b & & e + + , c & & 1 ! = = e & & e - - , e } , initialize : function ( a ) { var b = this ; clearInterval ( this . intervalFunction ) , window . App . isCluster & & ( this . dbServers = a . dbServers , this . coordinators = a . coordinators , this . updateServerTime ( ) , this . intervalFunction = window . setInterval ( function ( ) { " # sNodes " = = = window . location . hash & & b . coordinators . fetch ( { success : function ( ) { b . dbServers . fetch ( { success : function ( ) { b . continueRender ( ! 0 ) } } ) } } ) } , this . interval ) ) } , render : function ( ) { var a = this , b = function ( ) { var b = function ( ) { a . continueRender ( ) } ; this . waitForDBServers ( b ) } . bind ( this ) ; this . initDoneCoords ? b ( ) : this . waitForCoordinators ( b ) , window . arangoHelper . buildNodesSubNav ( " scale " ) } , continueRender : function ( a ) { var b , c , d = this ; b = this . coordinators . toJSON ( ) , c = this . dbServers . toJSON ( ) , this . $ el . html ( this . template . render ( { runningCoords : b . length , runningDBs : c . length , plannedCoords : void 0 , plannedDBs : void 0 , initialized : a } ) ) , $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / numberOfServers " ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { d . updateTable ( a ) } } ) } , updateTable : function ( a ) { var b = ' < span class = " warning " > scaling in progress < i class = " fa fa - circle - o - notch fa - spin " > < / i > < / span > ' , c = ' < span class = " positive " > no scaling process active < / span > ' ; a . numberOfCoordinators & & ( $ ( " # plannedCoords " ) . html ( a . numberOfCoordinators ) , this . coordinators . toJSON ( ) . length = = = a . numberOfCoordinators ? $ ( " # statusCoords " ) . html ( c ) : $ ( " # statusCoords " ) . html ( b ) ) , a . numberOfDBServers & & ( $ ( " # plannedDBs " ) . html ( a . numberOfDBServers ) , this . dbServers . toJSON ( ) . length = = = a . numberOfDBServers ? $ ( " # statusDBs " ) . html ( c ) : $ ( " # statusDBs " ) . html ( b ) ) } , waitForDBServers : function ( a ) { var b = this ; 0 = = = this . dbServers . length ? window . setInterval ( function ( ) { b . waitForDBServers ( a ) } , 300 ) : a ( ) } , waitForCoordinators : function ( a ) { var b = this ; window . setTimeout ( function ( ) { 0 = = = b . coordinators . length ? b . waitForCoordinators ( a ) : ( b . initDoneCoords = ! 0 , a ( ) ) } , 200 ) } , updateServerTime : function ( ) { this . serverTime = ( new Date ) . getTime ( ) } } ) } ( ) , 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 , 10 ) ! = = Math . pow ( 2 , Math . log2 ( g ) ) ) throw new Error ( " 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 ) : ( arangoHelper . arangoNotification ( " Collection : Successfully changed . " ) , window . App . navigate ( " # cSettings / " + c , { trigger : ! 0 } ) ) } , 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 ) ; frontendConfig . isCluster = = = ! 1 ? this . model . renameCollection ( c , i ) : i ( ) } else if ( " unloaded " = = = d ) if ( this . model . get ( " name " ) ! = = c ) { var j = function ( a , b ) { a ? arangoHelper . arangoError ( " Collection " + b . responseText ) : ( arangoHelper . arangoNotification ( " CollectionSuccessfully changed . " ) , window . App . navigate ( " # cSettings / " + c , { trigger : ! 0 } ) ) } ; frontendConfig . isCluster = = = ! 1 ? this . model . renameCollection ( c , j ) : 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 ( ) } ; this . model . getProperties ( g ) } else f ( ) } } . bind ( this ) ; window . isCoordinator ( a ) } } ) } ( ) , function ( ) { " use strict " ; window . ShardsView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " shardsView . ejs " ) , interval : 1e4 , knownServers : [ ] , events : { " click # shardsContent . shardLeader span " : " moveShard " , " click # shardsContent . shardFollowers span " : " moveShardFollowers " , " click # rebalanceShards " : " rebalanceShards " } , initialize : function ( a ) { var b = this ; b . dbServers = a . dbServers , clearInterval ( this . intervalFunction ) , window . App . isCluster & & ( this . updateServerTime ( ) , this . intervalFunction = window . setInterval ( function ( ) { " # shards " = = = window . location . hash & & b . render ( ! 1 ) } , this . interval ) ) } , render : function ( a ) { var b = this ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / shardDistribution " ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( a ) { var c , d = ! 1 ; b . shardDistribution = a . results , _ . each ( a . results , function ( a , b ) { c = b . substring ( 0 , 1 ) , " _ " ! = = c & & " error " ! = = b & & " code " ! = = b & & ( d = ! 0 ) } ) , d ? b . continueRender ( a . results ) : arangoHelper . renderEmpty ( " No collections and no shards available " ) } , error : function ( a ) { 0 ! = = a . readyState & & arangoHelper . arangoError ( " Cluster " , " Could not fetch sharding information . " ) } } ) , a ! = = ! 1 & & arangoHelper . buildNodesSubNav ( " Shards " ) } , moveShardFollowers : function ( a ) { var b = $ ( a . currentTarget ) . html ( ) ; this . moveShard ( a , b ) } , moveShard : function ( a , b ) { var c , d , e , f , g = this , h = window . App . currentDB . get ( " name " ) ; d = $ ( a . currentTarget ) . parent ( ) . parent ( ) . attr ( " collection " ) , e = $ ( a . currentTarget ) . parent ( ) . parent ( ) . attr ( " shard " ) , b ? ( f = $ ( a . currentTarget ) . parent ( ) . parent ( ) . attr ( " leader " ) , c = b ) : c = $ ( a . currentTarget ) . parent ( ) . parent ( ) . attr ( " leader " ) ; var i = [ ] , j = [ ] , k = { } , l = [ ] ; return g . dbServers [ 0 ] . each ( function ( a ) { a . get ( " name " ) ! = = c & & ( k [ a . get ( " name " ) ] = { value : a . get ( " name " ) , label : a . get ( " name " ) } ) } ) , _ . each ( g . shardDistribution [ d ] . Plan [ e ] . followers , function ( a ) { delete k [ a ] } ) , b & & delete k [ f ] , _ . each ( k , function ( a ) { l . push ( a ) } ) , l = l . reverse ( ) , 0 = = = l . length ? void arangoHelper . arangoMessage ( " Shards " , " No database server for moving the shard is available . " ) : ( j . push ( window . modalView . createSelectEntry ( " toDBServer " , " Destination " , void 0 , " Please select the target databse server . The selected database server will be the new leader of the shard . " , l ) ) , i . push ( window . modalView . createSuccessButton ( " Move " , this . confirmMoveShards . bind ( this , h , d , e , c ) ) ) , void window . modalView . show ( " modalTable . ejs " , " Move shard : " + e , i , j ) ) } , confirmMoveShards : function ( a , b , c , d ) { var e = this , f = $ ( " # toDBServer " ) . val ( ) , g = { database : a , collection : b , shard : c , fromServer : d , toServer : f } ; $ . ajax ( { type : " POST " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / moveShard " ) , contentType : " application / json " , processData : ! 1 , data : JSON . stringify ( g ) , async : ! 0 , success : function ( a ) { a = = = ! 0 & & ( window . setTimeout ( function ( ) { e . render ( ! 1 ) } , 1500 ) , arangoHelper . arangoNotification ( " Shard " + c + " will be moved to " + f + " . " ) ) } , error : function ( ) { arangoHelper . arangoNotification ( " Shard " + c + " could not be moved to " + f + " . " ) } } ) , window . modalView . hide ( ) } , rebalanceShards : function ( ) { var a = this ; $ . ajax ( { type : " POST " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / rebalanceShards " ) , contentType : " application / json " , processData : ! 1 , data : JSON . stringify ( { } ) , async : ! 0 , success : function ( b ) { b = = = ! 0 & & ( window . setTimeout ( function ( ) { a . render ( ! 1 ) } , 1500 ) , arangoHelper . arangoNotification ( " Started rebalance process . " ) ) } , error : function ( ) { arangoHelper . arangoNotification ( " Could not start rebalance process . " ) } } ) , window . modalView . hide ( ) } , continueRender : function ( a ) { delete a . code , delete a . error , this . $ el . html ( this . template . render ( { collections : a } ) ) } , updateServerTime : function ( ) { this . serverTime = ( new Date ) . getTime ( ) } } ) } ( ) , 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 ( ' < option id = " ' + a + ' " > ' + a + " < / option > " ) } ) ; 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 ( ' < option id = " ' + a + ' " > ' + a + " < / option > " ) } ) ; 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 ; c < l . length ; + + c ) if ( b = g . hist [ l [ c ] ] ) for ( d = 0 ; d < b . length ; + + d ) f = b [ d ] . snap , <nl> - k > f | | ( 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 | shortest_path " , hide : function ( ) { this . typeahead = $ ( " # spotlight . typeahead " ) . typeahead ( " destroy " ) , $ ( this . el ) . hide ( ) } , listenKey : function ( a ) { 27 = = = a . keyCode ? ( this . hide ( ) , this . callbackSuccess & & this . callbackCancel ( ) ) : 13 = = = a . keyCode & & this . callbackSuccess & & ( this . hide ( ) , this . callbackSuccess ( $ ( this . typeahead ) . val ( ) ) ) } , 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 ( ) ) } ) , a . aqlKeywordsArray . push ( ! 0 ) , a . aqlKeywordsArray . push ( ! 1 ) , a . aqlKeywordsArray . push ( null ) } , fetchKeywords : function ( a ) { var b = this ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / aql - builtin " ) , contentType : " application / json " , success : function ( c ) { b . stringToArray ( ) , b . updateDatasets ( ) , _ . each ( c . functions , function ( a ) { b . aqlBuiltinFunctionsArray . push ( a . name ) } ) , a & & a ( ) } , error : function ( ) { a & & a ( ) , arangoHelper . arangoError ( " AQL " , " Could not fetch AQL function definition . " ) } } ) } , show : function ( a , b , c ) { var d = this ; this . callbackSuccess = a , this . callbackCancel = b ; var e = function ( ) { var a = function ( a , b , c ) { var d = ' < div class = " header - type " > < h4 > ' + a + " < / h4 > " ; return b & & ( d + = ' < span > < i class = " fa ' + b + ' " > < / i > < / span > ' ) , c & & ( d + = ' < span class = " type " > ' + c . toUpperCase ( ) + " < / span > " ) , d + = " < / div > " } ; $ ( 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 : a ( " Functions " , " fa - code " , " aql " ) } } , { name : " Keywords " , source : this . substringMatcher ( this . aqlKeywordsArray ) , limit : this . displayLimit , templates : { header : a ( " Keywords " , " fa - code " , " aql " ) } } , { name : " Documents " , source : this . substringMatcher ( this . collections . doc ) , limit : this . displayLimit , templates : { header : a ( " Documents " , " fa - file - text - o " , " Collection " ) } } , { name : " Edges " , source : this . substringMatcher ( this . collections . edge ) , limit : this . displayLimit , templates : { header : a ( " Edges " , " fa - share - alt " , " Collection " ) } } , { name : " System " , limit : this . displayLimit , source : this . substringMatcher ( this . collections . system ) , templates : { header : a ( " 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 : a ( " Documents " , " fa - file - text - o " , " Collection " ) } } , { name : " Edges " , source : this . substringMatcher ( this . collections . edge ) , limit : this . displayLimit , templates : { header : a ( " Edges " , " fa - share - alt " , " Collection " ) } } , { name : " System " , limit : this . displayLimit , source : this . substringMatcher ( this . collections . system ) , templates : { header : a ( " System " , " fa - cogs " , " Collection " ) } } ) , $ ( " # spotlight . typeahead " ) . focus ( ) } . bind ( this ) ; 0 = = = d . aqlBuiltinFunctionsArray . length ? this . fetchKeywords ( e ) : e ( ) } } ) } ( ) , function ( ) { " use strict " ; window . StatisticBarView = Backbone . View . extend ( { el : " # statisticBar " , events : { " change # arangoCollectionSelect " : " navigateBySelect " , " click . tab " : " navigateByTab " } , template : templateEngine . createTemplate ( " statisticBarView . ejs " ) , initialize : function ( 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 . SupportView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " supportView . ejs " ) , events : { " click . subViewNavbar . subMenuEntry " : " toggleViews " } , render : function ( ) { this . $ el . html ( this . template . render ( { } ) ) } , resize : function ( a ) { a ? $ ( " . innerContent " ) . css ( " height " , " auto " ) : $ ( " . innerContent " ) . height ( $ ( " . centralRow " ) . height ( ) - 170 ) } , renderSwagger : function ( ) { var a = window . location . pathname . split ( " / " ) , b = window . location . protocol + " / / " + window . location . hostname + " : " + window . location . port + " / " + a [ 1 ] + " / " + a [ 2 ] + " / _admin / aardvark / api / index . html " ; $ ( " # swagger " ) . html ( " " ) , $ ( " # swagger " ) . append ( ' < iframe src = " ' + b + ' " style = " border : none " > < / iframe > ' ) } , toggleViews : function ( a ) { var b = this , c = a . currentTarget . id . split ( " - " ) [ 0 ] , d = [ " community " , " documentation " , " swagger " ] ; _ . each ( d , function ( a ) { c ! = = a ? $ ( " # " + a ) . hide ( ) : ( " swagger " = = = c ? ( b . renderSwagger ( ) , $ ( " # swagger iframe " ) . css ( " height " , " 100 % " ) , $ ( " # swagger iframe " ) . css ( " width " , " 100 % " ) , $ ( " # swagger iframe " ) . css ( " margin - top " , " - 13px " ) , b . resize ( ) ) : b . resize ( ! 0 ) , $ ( " # " + a ) . show ( ) ) } ) , $ ( " . subMenuEntries " ) . children ( ) . removeClass ( " active " ) , $ ( " # " + c + " - support " ) . 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 . UserBarView = Backbone . View . extend ( { events : { " change # userBarSelect " : " navigateBySelect " , " click . tab " : " navigateByTab " , " mouseenter . dropdown " : " showDropdown " , " mouseleave . dropdown " : " hideDropdown " , " click # userLogoutIcon " : " userLogout " , " click # userLogout " : " userLogout " } , initialize : function ( a ) { this . userCollection = a . userCollection , this . userCollection . fetch ( { cache : ! 1 , 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 ( ) { if ( frontendConfig . authenticationEnabled ! = = ! 1 ) { 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 ) { frontendConfig . authenticationEnabled = = = ! 0 & & ( a | | null = = = b ? arangoHelper . arangoError ( " User " , " Could not fetch user data " ) : this . currentUser = this . collection . findWhere ( { user : b } ) ) } . bind ( this ) ; this . collection . fetch ( { cache : ! 1 , 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 ; $ ( " # userManagementDropdown " ) . is ( " : visible " ) & & ( b = ! 0 ) ; var c = function ( ) { 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 " ) } . bind ( this ) ; return this . collection . fetch ( { cache : ! 1 , success : function ( ) { c ( ) } } ) , 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 ( { cache : ! 1 , success : function ( ) { a . render ( ) } } ) } , editUser : function ( a ) { if ( " createUser " ! = = $ ( a . currentTarget ) . find ( " a " ) . attr ( " id " ) ) { $ ( a . currentTarget ) . hasClass ( " tile " ) & & ( a . currentTarget = $ ( a . currentTarget ) . find ( " img " ) ) , this . collection . fetch ( { cache : ! 1 } ) ; var b = this . evaluateUserName ( $ ( a . currentTarget ) . attr ( " id " ) , " _edit - user " ) ; " " = = = b & & ( b = $ ( a . currentTarget ) . attr ( " id " ) ) , window . App . navigate ( " user / " + encodeURIComponent ( b ) , { trigger : ! 0 } ) } } , toggleView : function ( ) { $ ( " # userSortDesc " ) . attr ( " checked " , this . collection . sortOptions . desc ) , $ ( " # userManagementToggle " ) . toggleClass ( " activated " ) , $ ( " # userManagementDropdown2 " ) . slideToggle ( 200 ) } , 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 ) } , evaluateUserName : function ( a , b ) { if ( a ) { var c = a . lastIndexOf ( b ) ; return a . substring ( 0 , c ) } } , updateUserProfile : function ( ) { var a = this ; this . collection . fetch ( { cache : ! 1 , success : function ( ) { a . render ( ) } } ) } } ) } ( ) , function ( ) { " use strict " ; window . UserPermissionView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " userPermissionView . ejs " ) , initialize : function ( a ) { this . username = a . username } , events : { ' click # userPermissionView [ type = " checkbox " ] ' : " setPermission " } , render : function ( ) { var a = this ; this . collection . fetch ( { success : function ( ) { a . continueRender ( ) } } ) } , setPermission : function ( a ) { var b = $ ( a . currentTarget ) . is ( " : checked " ) , c = $ ( a . currentTarget ) . attr ( " name " ) ; b ? this . grantPermission ( this . currentUser . get ( " user " ) , c ) : this . revokePermission ( this . currentUser . get ( " user " ) , c ) } , grantPermission : function ( a , b ) { $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( a ) + " / database / " + encodeURIComponent ( b ) ) , contentType : " application / json " , data : JSON . stringify ( { grant : " rw " } ) } ) } , revokePermission : function ( a , b ) { $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( a ) + " / database / " + encodeURIComponent ( b ) ) , contentType : " application / json " } ) } , continueRender : function ( ) { var a = this ; this . currentUser = this . collection . findWhere ( { user : this . username } ) , this . breadcrumb ( ) , arangoHelper . buildUserSubNav ( this . currentUser . get ( " user " ) , " Permissions " ) ; var b = arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( a . currentUser . get ( " user " ) ) + " / database " ) ; " _system " = = = frontendConfig . db & & ( b = arangoHelper . databaseUrl ( " / _api / user / root / database " ) ) , $ . ajax ( { type : " GET " , url : b , contentType : " application / json " , success : function ( b ) { var c = b . result ; $ . ajax ( { type : " GET " , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( a . currentUser . get ( " user " ) ) + " / database " ) , contentType : " application / json " , success : function ( b ) { var d = b . result ; if ( c . _system ) { var e = [ ] ; _ . each ( c , function ( a , b ) { e . push ( b ) } ) , c = e } a . finishRender ( c , d ) } } ) } } ) } , finishRender : function ( a , b ) { _ . each ( b , function ( a , c ) { " rw " ! = = a & & delete b [ c ] } ) , $ ( this . el ) . html ( this . template . render ( { allDBs : a , permissions : b } ) ) } , breadcrumb : function ( ) { $ ( " # subNavigationBar . breadcrumb " ) . html ( " User : " + this . currentUser . get ( " user " ) ) } } ) } ( ) , function ( ) { " use strict " ; window . UserView = Backbone . View . extend ( { el : " # content " , initialize : function ( a ) { this . username = a . username } , render : function ( ) { var a = this ; this . collection . fetch ( { success : function ( ) { a . continueRender ( ) } } ) } , editCurrentUser : function ( ) { this . createEditCurrentUserModal ( this . currentUser . get ( " user " ) , this . currentUser . get ( " extra " ) . name , this . currentUser . get ( " extra " ) . img ) } , continueRender : function ( ) { this . breadcrumb ( ) , this . currentUser = this . collection . findWhere ( { user : this . username } ) , arangoHelper . buildUserSubNav ( this . currentUser . get ( " user " ) , " General " ) , this . currentUser . get ( " loggedIn " ) ? this . editCurrentUser ( ) : this . createEditUserModal ( this . currentUser . get ( " user " ) , this . currentUser . get ( " extra " ) . name , this . currentUser . get ( " active " ) ) } , createEditUserPasswordModal : function ( ) { var a = [ ] , b = [ ] ; 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 ) } , 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 , null , null , this . events , null , null , " content " ) } , 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 : " Change Password " , type : window . modalView . buttons . NOTIFICATION , callback : this . createEditUserPasswordModal . 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 , null , null , this . events , null , null , " content " ) } , validateStatus : function ( a ) { return " " ! = = a } , submitDeleteUser : function ( a ) { var b = this . collection . findWhere ( { user : a } ) ; b . destroy ( { wait : ! 0 } ) , window . App . navigate ( " # users " , { trigger : ! 0 } ) } , 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 ( ) } , submitEditUserPassword : function ( ) { var a = $ ( " # newCurrentPassword " ) . val ( ) , b = $ ( " # confirmCurrentPassword " ) . val ( ) ; $ ( " # newCurrentPassword " ) . val ( " " ) , $ ( " # confirmCurrentPassword " ) . val ( " " ) , $ ( " # newCurrentPassword " ) . closest ( " th " ) . css ( " backgroundColor " , " white " ) , $ ( " # confirmCurrentPassword " ) . closest ( " th " ) . css ( " backgroundColor " , " white " ) ; var c = ! 1 ; a ! = = b & & ( arangoHelper . arangoError ( " User " , " New passwords do not match . " ) , c = ! 0 ) , c | | ( this . currentUser . setPassword ( a ) , arangoHelper . arangoNotification ( " User " , " Password changed . " ) , window . modalView . hide ( ) ) } , 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 ) } , editUserPassword : function ( ) { window . modalView . hide ( ) , this . createEditUserPasswordModal ( ) } , 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 ) } , 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 " , success : function ( ) { arangoHelper . arangoNotification ( " User " , d . get ( " user " ) + " updated . " ) } , error : function ( ) { arangoHelper . arangoError ( " User " , " Could not update " + d . get ( " user " ) + " . " ) } } ) } , breadcrumb : function ( ) { $ ( " # subNavigationBar . breadcrumb " ) . html ( " User : " + this . username ) } } ) } ( ) , 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 " , " user / : name " : " userView " , " user / : name / permission " : " userPermissionView " , userProfile : " userProfile " , cluster : " cluster " , nodes : " nodes " , shards : " shards " , " node / : name " : " node " , logs : " logs " , helpus : " helpUs " , " graph2 / : name " : " graph2 " , " graph2 / : name / settings " : " graph2settings " , support : " support " } , execute : function ( a , b ) { $ ( " # subNavigationBar . breadcrumb " ) . html ( " " ) , $ ( " # subNavigationBar . bottom " ) . html ( " " ) , $ ( " # loadingScreen " ) . hide ( ) , $ ( " # content " ) . show ( ) , a & & a . apply ( this , b ) } , checkUser : function ( ) { var a = this ; if ( " # login " ! = = window . location . hash ) { var b = function ( ) { this . initOnce ( ) , $ ( " . bodyWrapper " ) . show ( ) , $ ( " . navbar " ) . show ( ) } . bind ( this ) , c = function ( c , d ) { frontendConfig . authenticationEnabled ? ( a . currentUser = d , c | | null = = = d ? " # login " ! = = window . location . hash & & this . navigate ( " login " , { trigger : ! 0 } ) : b ( ) ) : b ( ) } . bind ( this ) ; frontendConfig . authenticationEnabled ? this . userCollection . whoAmI ( c ) : ( this . initOnce ( ) , $ ( " . bodyWrapper " ) . show ( ) , $ ( " . navbar " ) . show ( ) ) } } , 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 ) } , 350 ) } , initFinished : ! 1 , initialize : function ( ) { frontendConfig . isCluster = = = ! 0 & & ( this . isCluster = ! 0 ) , 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 = = = ! 0 & & a . coordinatorCollection . fetch ( { success : function ( ) { a . fetchDBS ( ) } } ) , b & & console . log ( b ) } . bind ( this ) ; window . isCoordinator ( b ) , frontendConfig . isCluster = = = ! 1 & & ( 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 ( { cache : ! 1 } ) , window . spotlightView = new window . SpotlightView ( { collection : this . arangoCollectionsStore } ) , this . footerView = new window . FooterView ( { collection : a . coordinatorCollection } ) , this . notificationList = new window . NotificationCollection , this . currentDB . fetch ( { cache : ! 1 , 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 ( ) , this . userConfig = new window . UserConfig , this . userConfig . fetch ( ) , this . documentsView = new window . DocumentsView ( { collection : new window . ArangoDocuments , documentStore : this . arangoDocumentStore , collectionsStore : this . arangoCollectionsStore } ) } . 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 ? this . isCluster = = = ! 1 | | void 0 = = = this . isCluster ? 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 ) } , shards : function ( a ) { return this . checkUser ( ) , a & & void 0 ! = = this . isCluster ? this . isCluster = = = ! 1 ? ( this . routes [ " " ] = " dashboard " , void this . navigate ( " # dashboard " , { trigger : ! 0 } ) ) : ( this . shardsView | | ( this . shardsView = new window . ShardsView ( { dbServers : this . dbServers } ) ) , void this . shardsView . render ( ) ) : void this . waitForInit ( this . shards . bind ( this ) ) } , nodes : 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 . NodesView2 ( { } ) , void this . nodesView . render ( ) ) : void this . waitForInit ( this . nodes . bind ( this ) ) } , 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 } ) ) : 0 = = = this . dbServers . length ? void this . navigate ( " # cNodes " , { 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 ) ) } , sNodes : function ( a ) { return this . checkUser ( ) , a & & void 0 ! = = this . isCluster ? this . isCluster = = = ! 1 ? ( this . routes [ " " ] = " dashboard " , void this . navigate ( " # dashboard " , { trigger : ! 0 } ) ) : ( this . scaleView = new window . ScaleView ( { coordinators : this . coordinatorCollection , dbServers : this . dbServers [ 0 ] } ) , void this . scaleView . render ( ) ) : void this . waitForInit ( this . sNodes . 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 ( { cache : ! 1 , success : function ( ) { c ( ) } } ) : c ( ) } , login : function ( ) { var a = function ( a , b ) { this . loginView | | ( this . loginView = new window . LoginView ( { collection : this . userCollection } ) ) , a | | null = = = b ? this . loginView . render ( ) : this . loginView . render ( ! 0 ) } . bind ( this ) ; this . userCollection . whoAmI ( a ) } , 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 ( { cache : ! 1 , success : function ( ) { b . collectionsView . render ( ) } } ) } , cIndices : function ( a , b ) { var c = this ; return this . checkUser ( ) , b ? void this . arangoCollectionsStore . fetch ( { cache : ! 1 , 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 ( { cache : ! 1 , success : function ( ) { c . settingsView = new window . SettingsView ( { collectionName : a , collection : c . arangoCollectionsStore . findWhere ( { <nl> - 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 ( { cache : ! 1 , 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 ) } , query : function ( a ) { return this . checkUser ( ) , a ? ( this . queryView | | ( this . queryView = new window . QueryView ( { collection : this . queryCollection } ) ) , void this . queryView . render ( ) ) : void this . waitForInit ( this . query . bind ( this ) ) } , graph2 : function ( a , b ) { return this . checkUser ( ) , b ? ( this . graphViewer2 & & this . graphViewer2 . remove ( ) , this . graphViewer2 = new window . GraphViewer2 ( { name : a , userConfig : this . userConfig } ) , void this . graphViewer2 . render ( ) ) : void this . waitForInit ( this . graph2 . bind ( this ) , a ) } , graph2settings : function ( a , b ) { return this . checkUser ( ) , b ? ( this . graphSettingsView & & this . graphSettingsView . remove ( ) , this . graphSettingsView = new window . GraphSettingsView ( { name : a , userConfig : this . userConfig } ) , void this . graphSettingsView . render ( ) ) : void this . waitForInit ( this . graph2settings . bind ( this ) , a ) } , 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 ) ) } , support : function ( a ) { return this . checkUser ( ) , a ? ( this . testView | | ( this . supportView = new window . SupportView ( { } ) ) , void this . supportView . render ( ) ) : void this . waitForInit ( this . support . 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 . graphViewer2 & & this . graphViewer2 . resize ( ) , this . documentsView & & this . documentsView . resize ( ) , this . documentView & & this . documentView . resize ( ) } , userPermissionView : function ( a , b ) { if ( this . checkUser ( ) , b | | null = = = b ) this . userPermissionView = new window . UserPermissionView ( { collection : this . userCollection , databases : this . arangoDatabase , username : a } ) , this . userPermissionView . render ( ) ; else if ( b = = = ! 1 ) return void this . waitForInit ( this . userPermissionView . bind ( this ) , a ) } , userView : function ( a , b ) { this . checkUser ( ) , b | | null = = = b ? ( this . userView = new window . UserView ( { collection : this . userCollection , username : a } ) , this . userView . render ( ) ) : b = = = ! 1 & & this . waitForInit ( this . userView . bind ( this ) , a ) } , 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 ( a ) { var b = this , c = ! 1 ; this . coordinatorCollection . each ( function ( a ) { b . dbServers . push ( new window . ClusterServers ( [ ] , { host : a . get ( " address " ) } ) ) } ) , this . initFinished = ! 0 , _ . each ( this . dbServers , function ( b ) { b . fetch ( { success : function ( ) { c = = = ! 1 & & a & & ( a ( ) , c = ! 0 ) } } ) } ) } , 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 : arangoHelper . databaseUrl ( " / _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 ) . ajaxSend ( function ( a , b , c ) { var d = window . arangoHelper . getCurrentJwt ( ) ; d & & b . setRequestHeader ( " Authorization " , " bearer " + d ) } ) , $ ( 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 ( ) } ) ) } ( ) ; <nl> \ No newline at end of file <nl> + function AbstractAdapter ( a , b , c , d , e ) { " use strict " ; if ( void 0 = = = a ) throw " The nodes have to be given . " ; if ( void 0 = = = b ) throw " The edges have to be given . " ; if ( void 0 = = = c ) throw " An inheriting class has to be given . " ; if ( void 0 = = = d ) throw " A reference to the graph viewer has to be given . " ; e = e | | { } ; var f , g , h , i , j , k = this , l = ! 1 , m = { } , n = { } , o = { } , p = { } , q = 0 , r = { } , s = { } , t = function ( a ) { void 0 ! = = a . prioList & & g . changePrioList ( a . prioList | | [ ] ) } , u = function ( a ) { m . range = a / 2 , m . start = a / 4 , m . getStart = function ( ) { return this . start + Math . random ( ) * this . range } } , v = function ( a ) { n . range = a / 2 , n . start = a / 4 , n . getStart = function ( ) { return this . start + Math . random ( ) * this . range } } , w = function ( b ) { var c = p [ b ] | | b , d = $ . grep ( a , function ( a ) { return a . _id = = = c } ) ; if ( 0 = = = d . length ) return ! 1 ; if ( 1 = = = d . length ) return d [ 0 ] ; throw " Too many nodes with the same ID , should never happen " } , x = function ( a ) { var c = $ . grep ( b , function ( b ) { return b . _id = = = a } ) ; if ( 0 = = = c . length ) return ! 1 ; if ( 1 = = = c . length ) return c [ 0 ] ; throw " Too many edges with the same ID , should never happen " } , y = function ( b , c , d ) { var e = { _data : b , _id : b . _id } , f = w ( e . _id ) ; return f ? f : ( e . x = c | | m . getStart ( ) , e . y = d | | n . getStart ( ) , e . weight = 1 , a . push ( e ) , e . _outboundCounter = 0 , e . _inboundCounter = 0 , e ) } , z = function ( a ) { var b = y ( a ) ; return b . x = 2 * m . start , b . y = 2 * n . start , b . fixed = ! 0 , b } , A = function ( ) { a . length = 0 , b . length = 0 , p = { } , o = { } , d . cleanUp ( ) } , B = function ( a ) { var c , d , e , f = ! 0 , g = { _data : a , _id : a . _id } , i = x ( g . _id ) ; if ( i ) return i ; if ( c = w ( a . _from ) , d = w ( a . _to ) , ! c ) throw " Unable to insert Edge , source node not existing " + a . _from ; if ( ! d ) throw " Unable to insert Edge , target node not existing " + a . _to ; return g . source = c , g . source . _isCommunity ? ( e = o [ g . source . _id ] , g . source = e . getNode ( a . _from ) , g . source . _outboundCounter + + , e . insertOutboundEdge ( g ) , f = ! 1 ) : c . _outboundCounter + + , g . target = d , g . target . _isCommunity ? ( e = o [ g . target . _id ] , g . target = e . getNode ( a . _to ) , g . target . _inboundCounter + + , e . insertInboundEdge ( g ) , f = ! 1 ) : d . _inboundCounter + + , b . push ( g ) , f & & h . call ( " insertEdge " , c . _id , d . _id ) , g } , C = function ( b ) { var c ; for ( c = 0 ; c < a . length ; c + + ) if ( a [ c ] = = = b ) return void a . splice ( c , 1 ) } , D = function ( a , c ) { var d = b [ a ] , e = d . source . _id , f = d . target . _id ; b . splice ( a , 1 ) , c | | h . call ( " deleteEdge " , e , f ) } , E = function ( a , c ) { var d ; for ( d = 0 ; d < b . length ; d + + ) if ( b [ d ] = = = a ) return void D ( d , c ) } , F = function ( a ) { var c ; for ( c = 0 ; c < b . length ; c + + ) b [ c ] . source = = = a ? ( a . _outboundCounter - - , b [ c ] . target . _inboundCounter - - , D ( c ) , c - - ) : b [ c ] . target = = = a & & ( a . _inboundCounter - - , b [ c ] . source . _outboundCounter - - , D ( c ) , c - - ) } , G = function ( a , c ) { var d , e , f , g , i ; for ( d = 0 ; d < b . length ; d + + ) for ( f = b [ d ] . source , g = b [ d ] . target , e = 0 ; e < a . length ; e + + ) i = ! 1 , f = = = a [ e ] & & ( i = c . insertOutboundEdge ( b [ d ] ) , g . _isCommunity | | h . call ( " deleteEdge " , f . _id , g . _id ) , f = b [ d ] . source ) , g = = = a [ e ] & & ( i = c . insertInboundEdge ( b [ d ] ) , f . _isCommunity | | h . call ( " deleteEdge " , f . _id , g . _id ) , g = b [ d ] . target ) , i & & ( b . splice ( d , 1 ) , d - - ) } , H = function ( a ) { if ( a . _outboundCounter > 0 ) { var c , d = [ ] ; for ( c = 0 ; c < b . length ; c + + ) if ( b [ c ] . source = = = a ) { if ( d . push ( b [ c ] ) , a . _outboundCounter - - , D ( c , b [ c ] . target . _isCommunity ) , 0 = = = a . _outboundCounter ) break ; c - - } return d } } , I = function ( b , c ) { if ( b & & 0 ! = = b . length ) { var d = _ . map ( b , function ( a ) { return w ( a ) } ) , e = new CommunityNode ( k , d ) , f = e . _id ; c & & ( e . _reason = c ) , o [ f ] = e , G ( d , e ) , _ . each ( d , function ( a ) { p [ a . _id ] = f , C ( a ) } ) , a . push ( e ) , l = ! 1 } } , J = function ( a ) { var b = a . data ; if ( b . error ) return console . log ( b . cmd ) , void console . log ( b . error ) ; switch ( b . cmd ) { case " debug " : break ; case " getCommunity " : I ( b . result ) } } , K = function ( a ) { l | | ( l = ! 0 , a ? h . call ( " getCommunity " , f , a . _id ) : h . call ( " getCommunity " , f ) ) } , L = function ( b ) { var c , d = a . length , e = - ( 1 / 0 ) ; _ . each ( o , function ( a ) { a . _expanded = = = ! 0 & & ( e < a . _size & & a ! = = b & & ( c = a , e = a . _size ) , d + = a . _size ) } ) , f < d & & ( c ? c . collapse ( ) : K ( b ) ) } , M = function ( c ) { var d = c . getDissolveInfo ( ) , e = d . nodes , g = d . edges . both , i = d . edges . inbound , j = d . edges . outbound ; C ( c ) , f < a . length + e . length & & K ( ) , _ . each ( e , function ( b ) { delete p [ b . _id ] , a . push ( b ) } ) , _ . each ( i , function ( a ) { a . target = a . _target , delete a . _target , a . source . _isCommunity | | h . call ( " insertEdge " , a . source . _id , a . target . _id ) } ) , _ . each ( j , function ( a ) { a . source = a . _source , delete a . _source , a . target . _isCommunity | | h . call ( " insertEdge " , a . source . _id , a . target . _id ) } ) , _ . each ( g , function ( a ) { a . source = a . _source , delete a . _source , a . target = a . _target , delete a . _target , b . push ( a ) , h . call ( " insertEdge " , a . source . _id , a . target . _id ) } ) , delete o [ c . _id ] } , N = function ( a ) { a . expand ( ) , L ( a ) } , O = function ( a ) { if ( _ . size ( a ) > i ) { var b = g . bucketNodes ( _ . values ( a ) , i ) ; _ . each ( b , function ( a ) { if ( a . nodes . length > 1 ) { var b = _ . map ( a . nodes , function ( a ) { return a . _id } ) ; I ( b , a . reason ) } } ) } } , P = function ( a , b ) { f = a , L ( ) , void 0 ! = = b & & b ( ) } , Q = function ( a ) { i = a } , R = function ( a , b ) { a . _expanded = ! 1 ; var c = b . removeOutboundEdgesFromNode ( a ) ; _ . each ( c , function ( a ) { j ( a ) , E ( a , ! 0 ) } ) } , S = function ( a ) { a . _expanded = ! 1 , p [ a . _id ] & & o [ p [ a . _id ] ] . collapseNode ( a ) ; var b = H ( a ) , c = [ ] ; _ . each ( b , function ( b ) { 0 = = = q ? ( r = b , s = a , c . push ( b ) ) : void 0 ! = = a & & ( a . _id = = = r . target . _id ? b . target . _id = = = s . _id & & c . push ( r ) : c . push ( b ) , r = b , s = a ) , q + + } ) , _ . each ( c , j ) , q = 0 } , T = function ( a ) { var b = a . getDissolveInfo ( ) ; C ( a ) , _ . each ( b . nodes , function ( a ) { delete p [ a . _id ] } ) , _ . each ( b . edges . outbound , function ( a ) { j ( a ) , E ( a , ! 0 ) } ) , delete o [ a . _id ] } , U = function ( a , b ) { a . _isCommunity ? k . expandCommunity ( a , b ) : ( a . _expanded = ! 0 , c . loadNode ( a . _id , b ) ) } , V = function ( a , b ) { a . _expanded ? S ( a ) : U ( a , b ) } ; j = function ( a ) { var b , c = a . target ; return c . _isCommunity ? ( b = a . _target , c . removeInboundEdge ( a ) , b . _inboundCounter - - , 0 = = = b . _inboundCounter & & ( R ( b , c ) , c . removeNode ( b ) , delete p [ b . _id ] ) , void ( 0 = = = c . _inboundCounter & & T ( c ) ) ) : ( c . _inboundCounter - - , void ( 0 = = = c . _inboundCounter & & ( S ( c ) , C ( c ) ) ) ) } , i = Number . POSITIVE_INFINITY , g = e . prioList ? new NodeReducer ( e . prioList ) : new NodeReducer , h = new WebWorkerWrapper ( ModularityJoiner , J ) , m . getStart = function ( ) { return 0 } , n . getStart = function ( ) { return 0 } , this . cleanUp = A , this . setWidth = u , this . setHeight = v , this . insertNode = y , this . insertInitialNode = z , this . insertEdge = B , this . removeNode = C , this . removeEdge = E , this . removeEdgesForNode = F , this . expandCommunity = N , this . setNodeLimit = P , this . setChildLimit = Q , this . checkSizeOfInserted = O , this . checkNodeLimit = L , this . explore = V , this . changeTo = t , this . getPrioList = g . getPrioList , this . dissolveCommunity = M } function ArangoAdapter ( a , b , c , d ) { " use strict " ; if ( void 0 = = = a ) throw " The nodes have to be given . " ; if ( void 0 = = = b ) throw " The edges have to be given . " ; if ( void 0 = = = c ) throw " A reference to the graph viewer has to be given . " ; if ( void 0 = = = d ) throw " A configuration with node - and edgeCollection has to be given . " ; if ( void 0 = = = d . graph ) { if ( void 0 = = = d . nodeCollection ) throw " The nodeCollection or a graphname has to be given . " ; if ( void 0 = = = d . edgeCollection ) throw " The edgeCollection or a graphname has to be given . " } var e , f , g , h , i , j = this , k = { } , l = { } , m = { } , n = function ( a ) { h = a } , o = function ( a ) { f = a , l . node = l . base + " document ? collection = " + f } , p = function ( a ) { g = a , l . edge = l . base + " edge ? collection = " + g } , q = function ( a ) { $ . ajax ( { cache : ! 1 , type : " GET " , async : ! 1 , url : l . graph + " / " + a , contentType : " application / json " , success : function ( a ) { o ( a . graph . vertices ) , p ( a . graph . edges ) } } ) } , r = function ( a ) { console . log ( a . baseUrl ) ; var b = a . baseUrl | | " " ; void 0 ! = = a . width & & e . setWidth ( a . width ) , void 0 ! = = a . height & & e . setHeight ( a . height ) , i = void 0 ! = = a . undirected & & a . undirected = = = ! 0 ? " any " : " outbound " , l . base = b + " _api / " , l . cursor = l . base + " cursor " , l . graph = l . base + " graph " , l . collection = l . base + " collection / " , l . document = l . base + " document / " , l . any = l . base + " simple / any " , a . graph ? ( q ( a . graph ) , n ( a . graph ) ) : ( o ( a . nodeCollection ) , p ( a . edgeCollection ) , n ( void 0 ) ) } , s = function ( a , b , c ) { a ! = = m . getAllGraphs & & ( a ! = = m . connectedEdges & & ( b [ " @ nodes " ] = f , a ! = = m . childrenCentrality & & ( b . dir = i ) ) , b [ " @ edges " ] = g ) ; var d = { query : a , bindVars : b } ; $ . ajax ( { type : " POST " , url : l . cursor , data : JSON . stringify ( d ) , contentType : " application / json " , dataType : " json " , processData : ! 1 , success : function ( a ) { c ( a . result ) } , error : function ( a ) { try { throw console . log ( a . statusText ) , " [ " + a . errorNum + " ] " + a . errorMessage } catch ( b ) { throw " Undefined ERROR " } } } ) } , t = function ( a , b ) { var c = [ ] , d = 0 , e = function ( d ) { c . push ( d . document | | { } ) , c . length = = = a & & b ( c ) } ; for ( d = 0 ; d < a ; d + + ) $ . ajax ( { cache : ! 1 , type : " PUT " , url : l . any , data : JSON . stringify ( { collection : f } ) , contentType : " application / json " , success : e } ) } , u = function ( b , c ) { if ( 0 = = = b . length ) return void ( c & & c ( { errorCode : 404 } ) ) ; b = b [ 0 ] ; var d = { } , f = e . insertNode ( b [ 0 ] . vertex ) , g = a . length ; _ . each ( b , function ( b ) { var c = e . insertNode ( b . vertex ) , f = b . path ; g < a . length & & ( d [ c . _id ] = c , g = a . length ) , _ . each ( f . vertices , function ( b ) { var c = e . insertNode ( b ) ; g < a . length & & ( d [ c . _id ] = c , g = a . length ) } ) , _ . each ( f . edges , function ( a ) { e . insertEdge ( a ) } ) } ) , delete d [ f . _id ] , e . checkSizeOfInserted ( d ) , e . checkNodeLimit ( f ) , c & & c ( f ) } , v = function ( a ) { return function ( b ) { return b & & b . errorCode ? void a ( b ) : void a ( e . insertInitialNode ( b ) ) } } , w = function ( a ) { s ( m . connectedEdges , { id : a } , function ( a ) { _ . each ( a , j . deleteEdge ) } ) } ; d . prioList & & ( k . prioList = d . prioList ) , e = new AbstractAdapter ( a , b , this , c , k ) , r ( d ) , m . getAllGraphs = " FOR g IN _graphs return g . _key " , m . randomDocuments = " FOR u IN @ @ nodes sort rand ( ) limit 10 return u " , m . nodeById = ' FOR n IN @ @ nodes FILTER n . _id = = @ id LET links = ( FOR l IN @ @ edges FILTER n . _id = = l . _from FOR t IN @ @ nodes FILTER t . _id = = l . _to RETURN t . _id ) RETURN MERGE ( n , { " children " : links } ) ' , m . traversalById = ' RETURN TRAVERSAL ( @ @ nodes , @ @ edges , @ id , @ dir , { strategy : " depthfirst " , maxDepth : 1 , paths : true } ) ' , m . traversalByAttribute = function ( a ) { return " FOR n IN @ @ nodes FILTER n . " + a + ' = = @ value RETURN TRAVERSAL ( @ @ nodes , @ @ edges , n . _id , @ dir , { strategy : " depthfirst " , maxDepth : 1 , paths : true } ) ' } , m . childrenCentrality = " FOR u IN @ @ nodes FILTER u . _id = = @ id LET g = ( FOR l in @ @ edges FILTER l . _from = = u . _id RETURN 1 ) RETURN length ( g ) " , m . connectedEdges = " FOR e IN @ @ edges FILTER e . _to = = @ id | | e . _from = = @ id RETURN e " , j . explore = e . explore , j . loadNode = function ( a , b ) { j . loadNodeFromTreeById ( a , b ) } , j . loadRandomNode = function ( a ) { var b = this ; t ( 1 , function ( c ) { var d = c [ 0 ] ; if ( d . _id ) return void b . loadInitialNode ( d . _id , a ) } ) } , j . loadInitialNode = function ( a , b ) { e . cleanUp ( ) , j . loadNode ( a , v ( b ) ) } , j . loadNodeFromTreeById = function ( a , b ) { s ( m . traversalById , { id : a } , function ( a ) { u ( a , b ) } ) } , j . loadNodeFromTreeByAttributeValue = function ( a , b , c ) { s ( m . traversalByAttribute ( a ) , { value : b } , function ( a ) { u ( a , c ) } ) } , j . loadInitialNodeByAttributeValue = function ( a , b , c ) { e . cleanUp ( ) , j . loadNodeFromTreeByAttributeValue ( a , b , v ( c ) ) } , j . requestCentralityChildren = function ( a , b ) { s ( m . childrenCentrality , { id : a } , function ( a ) { b ( a [ 0 ] ) } ) } , j . createEdge = function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " POST " , url : l . edge + " & from = " + a . source . _id + " & to = " + a . target . _id , data : JSON . stringify ( { } ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( c ) { c . _from = a . source . _id , c . _to = a . target . _id , delete c . error ; var d = e . insertEdge ( c ) ; b ( d ) } , error : function ( a ) { throw a . statusText } } ) } , j . deleteEdge = function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " DELETE " , url : l . document + a . _id , contentType : " application / json " , dataType : " json " , processData : ! 1 , success : function ( ) { e . removeEdge ( a ) , void 0 ! = = b & & _ . isFunction ( b ) & & b ( ) } , error : function ( a ) { throw a . statusText } } ) } , j . patchEdge = function ( a , b , c ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : l . document + a . _id , data : JSON . stringify ( b ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( d ) { a . _data = $ . extend ( a . _data , b ) , c ( ) } , error : function ( a ) { throw a . statusText } } ) } , j . createNode = function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " POST " , url : l . node , data : JSON . stringify ( a ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( c ) { c . error = = = ! 1 & & ( a . _key = c . _key , a . _id = c . _id , a . _rev = c . _rev , e . insertNode ( a ) , b ( a ) ) } , error : function ( a ) { throw a . statusText } } ) } , j . deleteNode = function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " DELETE " , url : l . document + a . _id , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( ) { e . removeEdgesForNode ( a ) , w ( a . _id ) , e . removeNode ( a ) , void 0 ! = = b & & _ . isFunction ( b ) & & b ( ) } , error : function ( a ) { throw a . statusText } } ) } , j . patchNode = function ( a , b , c ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : l . document + a . _id , data : JSON . stringify ( b ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( d ) { a . _data = $ . extend ( a . _data , b ) , c ( a ) } , error : function ( a ) { throw a . statusText } } ) } , j . changeToCollections = function ( a , b , c ) { e . cleanUp ( ) , o ( a ) , p ( b ) , void 0 ! = = c & & ( i = c = = = ! 0 ? " any " : " outbound " ) , n ( void 0 ) } , j . changeToGraph = function ( a , b ) { e . cleanUp ( ) , q ( a ) , void 0 ! = = b & & ( i = b = = = ! 0 ? " any " : " outbound " ) , n ( a ) } , j . setNodeLimit = function ( a , b ) { e . setNodeLimit ( a , b ) } , j . setChildLimit = function ( a ) { e . setChildLimit ( a ) } , j . expandCommunity = function ( a , b ) { e . expandCommunity ( a ) , void 0 ! = = b & & b ( ) } , j . getCollections = function ( a ) { a & & a . length > = 2 & & $ . ajax ( { cache : ! 1 , type : " GET " , url : l . collection , contentType : " application / json " , dataType : " json " , processData : ! 1 , success : function ( b ) { var c = b . collections , d = [ ] , e = [ ] ; _ . each ( c , function ( a ) { a . name . match ( / ^ _ / ) | | ( 3 = = = a . type ? e . push ( a . name ) : 2 = = = a . type & & d . push ( a . name ) ) } ) , a ( d , e ) } , error : function ( a ) { throw a . statusText } } ) } , j . getGraphs = function ( a ) { a & & a . length > = 1 & & s ( m . getAllGraphs , { } , a ) } , j . getAttributeExamples = function ( a ) { a & & a . length > = 1 & & t ( 10 , function ( b ) { var c = _ . sortBy ( _ . uniq ( _ . flatten ( _ . map ( b , function ( a ) { return _ . keys ( a ) } ) ) ) , function ( a ) { return a . toLowerCase ( ) } ) ; a ( c ) } ) } , j . getNodeCollection = function ( ) { return f } , j . getEdgeCollection = function ( ) { return g } , j . getDirection = function ( ) { return i } , j . getGraphName = function ( ) { return h } , j . setWidth = e . setWidth , j . changeTo = e . changeTo , j . getPrioList = e . getPrioList } function ColourMapper ( ) { " use strict " ; var a , b = { } , c = { } , d = [ ] , e = this , f = 0 ; d . push ( { back : " # C8E6C9 " , front : " black " } ) , d . push ( { back : " # 8aa249 " , front : " white " } ) , d . push ( { back : " # 8BC34A " , front : " black " } ) , d . push ( { back : " # 388E3C " , front : " white " } ) , d . push ( { back : " # 4CAF50 " , front : " white " } ) , d . push ( { back : " # 212121 " , front : " white " } ) , d . push ( { back : " # 727272 " , front : " white " } ) , d . push ( { back : " # B6B6B6 " , front : " black " } ) , d . push ( { back : " # e5f0a3 " , front : " black " } ) , d . push ( { back : " # 6c4313 " , front : " white " } ) , d . push ( { back : " # 9d8564 " , front : " white " } ) , this . getColour = function ( g ) { return void 0 = = = b [ g ] & & ( b [ g ] = d [ f ] , void 0 = = = c [ d [ f ] . back ] & & ( c [ d [ f ] . back ] = { front : d [ f ] . front , list : [ ] } ) , c [ d [ f ] . back ] . list . push ( g ) , f + + , f = = = d . length & & ( f = 0 ) ) , void 0 ! = = a & & a ( e . getList ( ) ) , b [ g ] . back } , this . getCommunityColour = function ( ) { return " # 333333 " } , this . getForegroundColour = function ( g ) { return void 0 = = = b [ g ] & & ( b [ g ] = d [ f ] , void 0 = = = c [ d [ f ] . back ] & & ( c [ d [ f ] . back ] = { front : d [ f ] . front , list : [ ] } ) , c [ d [ f ] . back ] . list . push ( g ) , f + + , f = = = d . length & & ( f = 0 ) ) , void 0 ! = = a & & a ( e . getList ( ) ) , b [ g ] . front } , this . getForegroundCommunityColour = function ( ) { return " white " } , this . reset = function ( ) { b = { } , c = { } , f = 0 , void 0 ! = = a & & a ( e . getList ( ) ) } , this . getList = function ( ) { return c } , this . setChangeListener = function ( b ) { a = b } , this . reset ( ) } function CommunityNode ( a , b ) { " use strict " ; if ( _ . isUndefined ( a ) | | ! _ . isFunction ( a . dissolveCommunity ) | | ! _ . isFunction ( a . checkNodeLimit ) ) throw " A parent element has to be given . " ; b = b | | [ ] ; var c , d , e , f , g , h = this , i = { } , j = [ ] , k = [ ] , l = { } , m = { } , n = { } , o = { } , p = function ( a ) { return h . _expanded ? 2 * a * Math . sqrt ( j . length ) : a } , q = function ( a ) { return h . _expanded ? 4 * a * Math . sqrt ( j . length ) : a } , r = function ( a ) { var b = h . position , c = a . x * b . z + b . x , d = a . y * b . z + b . y , e = a . z * b . z ; return { x : c , y : d , z : e } } , s = function ( a ) { return h . _expanded ? r ( a . _source . position ) : h . position } , t = function ( a ) { return h . _expanded ? r ( a . _target . position ) : h . position } , u = function ( ) { var a = document . getElementById ( h . _id ) . getBBox ( ) ; c . attr ( " transform " , " translate ( " + ( a . x - 5 ) + " , " + ( a . y - 25 ) + " ) " ) , d . attr ( " width " , a . width + 10 ) . attr ( " height " , a . height + 30 ) , e . attr ( " width " , a . width + 10 ) } , v = function ( ) { if ( ! f ) { var a = new DomObserverFactory ; f = a . createObserver ( function ( a ) { _ . any ( a , function ( a ) { return " transform " = = = a . attributeName } ) & & ( u ( ) , f . disconnect ( ) ) } ) } return f } , w = function ( ) { g . stop ( ) , j . length = 0 , _ . each ( i , function ( a ) { j . push ( a ) } ) , g . start ( ) } , x = function ( ) { g . stop ( ) , k . length = 0 , _ . each ( l , function ( a ) { k . push ( a ) } ) , g . start ( ) } , y = function ( a ) { var b = [ ] ; return _ . each ( a , function ( a ) { b . push ( a ) } ) , b } , z = function ( a ) { return ! ! i [ a ] } , A = function ( ) { return j } , B = function ( a ) { return i [ a ] } , C = function ( a ) { i [ a . _id ] = a , w ( ) , h . _size + + } , D = function ( a ) { _ . each ( a , function ( a ) { i [ a . _id ] = a , h . _size + + } ) , w ( ) } , E = function ( a ) { var b = a . _id | | a ; delete i [ b ] , w ( ) , h . _size - - } , F = function ( a ) { var b ; return _ . has ( a , " _id " ) ? b = a . _id : ( b = a , a = l [ b ] | | m [ b ] ) , a . target = a . _target , delete a . _target , l [ b ] ? ( delete l [ b ] , h . _outboundCounter + + , n [ b ] = a , void x ( ) ) : ( delete m [ b ] , void h . _inboundCounter - - ) } , G = function ( a ) { var b ; return _ . has ( a , " _id " ) ? b = a . _id : ( b = a , a = l [ b ] | | n [ b ] ) , a . source = a . _source , delete a . _source , delete o [ a . source . _id ] [ b ] , l [ b ] ? ( delete l [ b ] , h . _inboundCounter + + , m [ b ] = a , void x ( ) ) : ( delete n [ b ] , void h . _outboundCounter - - ) } , H = function ( a ) { var b = a . _id | | a , c = [ ] ; return _ . each ( o [ b ] , function ( a ) { G ( a ) , c . push ( a ) } ) , delete o [ b ] , c } , I = function ( a ) { return a . _target = a . target , a . target = h , n [ a . _id ] ? ( delete n [ a . _id ] , h . _outboundCounter - - , l [ a . _id ] = a , x ( ) , ! 0 ) : ( m [ a . _id ] = a , h . _inboundCounter + + , ! 1 ) } , J = function ( a ) { var b = a . source . _id ; return a . _source = a . source , a . source = h , o [ b ] = o [ b ] | | { } , o [ b ] [ a . _id ] = a , m [ a . _id ] ? ( delete m [ a . _id ] , h . _inboundCounter - - , l [ a . _id ] = a , x ( ) , ! 0 ) : ( h . _outboundCounter + + , n [ a . _id ] = a , ! 1 ) } , K = function ( ) { return { nodes : j , edges : { both : k , inbound : y ( m ) , outbound : y ( n ) } } } , L = function ( ) { this . _expanded = ! 0 } , M = function ( ) { a . dissolveCommunity ( h ) } , N = function ( ) { this . _expanded = ! 1 } , O = function ( a , b ) { var c = a . select ( " rect " ) . attr ( " width " ) , d = a . append ( " text " ) . attr ( " text - anchor " , " middle " ) . attr ( " fill " , b . getForegroundCommunityColour ( ) ) . attr ( " stroke " , " none " ) ; c * = 2 , c / = 3 , h . _reason & & h . _reason . key & & ( d . append ( " tspan " ) . attr ( " x " , " 0 " ) . attr ( " dy " , " - 4 " ) . text ( h . _reason . key + " : " ) , d . append ( " tspan " ) . attr ( " x " , " 0 " ) . attr ( " dy " , " 16 " ) . text ( h . _reason . value ) ) , d . append ( " tspan " ) . attr ( " x " , c ) . attr ( " y " , " 0 " ) . attr ( " fill " , b . getCommunityColour ( ) ) . text ( h . _size ) } , P = function ( b , c , d , e ) { var f = b . append ( " g " ) . attr ( " stroke " , e . getForegroundCommunityColour ( ) ) . attr ( " fill " , e . getCommunityColour ( ) ) ; c ( f , 9 ) , c ( f , 6 ) , c ( f , 3 ) , c ( f ) , f . on ( " click " , function ( ) { h . expand ( ) , a . checkNodeLimit ( h ) , d ( ) } ) , O ( f , e ) } , Q = function ( a , b ) { var c = a . selectAll ( " . node " ) . data ( j , function ( a ) { return a . _id } ) ; c . enter ( ) . append ( " g " ) . attr ( " class " , " node " ) . attr ( " id " , function ( a ) { return a . _id } ) , c . exit ( ) . remove ( ) , c . selectAll ( " * > * " ) . remove ( ) , b ( c ) } , R = function ( a , b ) { c = a . append ( " g " ) , d = c . append ( " rect " ) . attr ( " rx " , " 8 " ) . attr ( " ry " , " 8 " ) . attr ( " fill " , " none " ) . attr ( " stroke " , " black " ) , e = c . append ( " rect " ) . attr ( " rx " , " 8 " ) . attr ( " ry " , " 8 " ) . attr ( " height " , " 20 " ) . attr ( " fill " , " # 686766 " ) . attr ( " stroke " , " none " ) , c . append ( " image " ) . attr ( " id " , h . _id + " _dissolve " ) . attr ( " xlink : href " , " img / icon_delete . png " ) . attr ( " width " , " 16 " ) . attr ( " height " , " 16 " ) . attr ( " x " , " 5 " ) . attr ( " y " , " 2 " ) . attr ( " style " , " cursor : pointer " ) . on ( " click " , function ( ) { h . dissolve ( ) , b ( ) } ) , c . append ( " image " ) . attr ( " id " , h . _id + " _collapse " ) . attr ( " xlink : href " , " img / gv_collapse . png " ) . attr ( " width " , " 16 " ) . attr ( " height " , " 16 " ) . attr ( " x " , " 25 " ) . attr ( " y " , " 2 " ) . attr ( " style " , " cursor : pointer " ) . on ( " click " , function ( ) { h . collapse ( ) , b ( ) } ) ; var f = c . append ( " text " ) . attr ( " x " , " 45 " ) . attr ( " y " , " 15 " ) . attr ( " fill " , " white " ) . attr ( " stroke " , " none " ) . attr ( " text - anchor " , " left " ) ; h . _reason & & f . text ( h . _reason . text ) , v ( ) . observe ( document . getElementById ( h . _id ) , { subtree : ! 0 , attributes : ! 0 } ) } , S = function ( a ) { if ( h . _expanded ) { var b = a . focus ( ) , c = [ b [ 0 ] - h . position . x , b [ 1 ] - h . position . y ] ; a . focus ( c ) , _ . each ( j , function ( b ) { b . position = a ( b ) , b . position . x / = h . position . z , b . position . y / = h . position . z , b . position . z / = h . position . z } ) , a . focus ( b ) } } , T = function ( a , b , c , d , e ) { return a . on ( " click " , null ) , h . _expanded ? ( R ( a , d ) , void Q ( a , c , d , e ) ) : void P ( a , b , d , e ) } , U = function ( a , b , c ) { if ( h . _expanded ) { var d = a . selectAll ( " . link " ) , e = d . select ( " line " ) ; b ( e , d ) , c ( d ) } } , V = function ( a , b ) { var c , d , e = function ( a ) { return a . _id } ; h . _expanded & & ( d = a . selectAll ( " . link " ) . data ( k , e ) , d . enter ( ) . append ( " g " ) . attr ( " class " , " link " ) . attr ( " id " , e ) , d . exit ( ) . remove ( ) , d . selectAll ( " * > * " ) . remove ( ) , c = d . append ( " line " ) , b ( c , d ) ) } , W = function ( a ) { H ( a ) } ; g = new ForceLayouter ( { distance : 100 , gravity : . 1 , charge : - 500 , width : 1 , height : 1 , nodes : j , links : k } ) , this . _id = " * community_ " + Math . floor ( 1e6 * Math . random ( ) ) , b . length > 0 ? ( this . x = b [ 0 ] . x , this . y = b [ 0 ] . y ) : ( this . x = 0 , this . y = 0 ) , this . _size = 0 , this . _inboundCounter = 0 , this . _outboundCounter = 0 , this . _expanded = ! 1 , this . _isCommunity = ! 0 , D ( b ) , this . hasNode = z , this . getNodes = A , this . getNode = B , this . getDistance = p , this . getCharge = q , this . insertNode = C , this . insertInboundEdge = I , this . insertOutboundEdge = J , this . removeNode = E , this . removeInboundEdge = F , this . removeOutboundEdge = G , this . removeOutboundEdgesFromNode = H , this . collapseNode = W , this . dissolve = M , this . getDissolveInfo = K , this . collapse = N , this . expand = L , this . shapeNodes = T , this . shapeInnerEdges = V , this . updateInnerEdges = U , this . addDistortion = S , this . getSourcePosition = s , this . getTargetPosition = t } function DomObserverFactory ( ) { " use strict " ; var a = window . WebKitMutationObserver | | window . MutationObserver ; this . createObserver = function ( b ) { if ( ! a ) throw " Observer not supported " ; return new a ( b ) } } function EdgeShaper ( a , b , c ) { " use strict " ; var d , e , f , g = this , h = [ ] , i = { } , j = new ContextMenu ( " gv_edge_cm " ) , k = function ( a , b ) { return _ . isArray ( a ) ? b [ _ . find ( a , function ( a ) { return b [ a ] } ) ] : b [ a ] } , l = function ( a ) { if ( void 0 = = = a ) return [ " " ] ; " string " ! = typeof a & & ( a = String ( a ) ) ; var b = a . match ( / [ \ w \ W ] { 1 , 10 } ( \ s | $ ) | \ S + ? ( \ s | $ ) / g ) ; return b [ 0 ] = $ . trim ( b [ 0 ] ) , b [ 1 ] = $ . trim ( b [ 1 ] ) , b [ 0 ] . length > 12 & & ( b [ 0 ] = $ . trim ( a . substring ( 0 , 10 ) ) + " - " , b [ 1 ] = $ . trim ( a . substring ( 10 ) ) , b [ 1 ] . length > 12 & & ( b [ 1 ] = b [ 1 ] . split ( / \ W / ) [ 0 ] , b [ 1 ] . length > 12 & & ( b [ 1 ] = b [ 1 ] . substring ( 0 , 10 ) + " . . . " ) ) , b . length = 2 ) , b . length > 2 & & ( b . length = 2 , b [ 1 ] + = " . . . " ) , b } , m = ! 0 , n = { } , o = function ( a ) { return a . _id } , p = function ( a , b ) { } , q = new ColourMapper , r = function ( ) { q . reset ( ) } , s = p , t = p , u = p , v = p , w = function ( ) { f = { click : p , dblclick : p , mousedown : p , mouseup : p , mousemove : p , mouseout : p , mouseover : p } } , x = function ( a , b ) { return 180 * Math . atan2 ( b . y - a . y , b . x - a . x ) / Math . PI } , y = function ( a , b ) { var c , d = Math . sqrt ( ( b . y - a . y ) * ( b . y - a . y ) + ( b . x - a . x ) * ( b . x - a . x ) ) ; return a . x = = = b . x ? d - = 18 * b . z : ( c = Math . abs ( ( b . y - a . y ) / ( b . x - a . x ) ) , d - = c < . 4 ? Math . abs ( d * b . z * 45 / ( b . x - a . x ) ) : Math . abs ( d * b . z * 18 / ( b . y - a . y ) ) ) , d } , z = function ( a , b ) { _ . each ( f , function ( a , c ) { b . on ( c , a ) } ) } , A = function ( a , b ) { if ( " update " = = = a ) s = b ; else { if ( void 0 = = = f [ a ] ) throw " Sorry Unknown Event " + a + " cannot be bound . " ; f [ a ] = b } } , B = function ( a ) { var b , c , d , e ; return d = a . source , e = a . target , d . _isCommunity ? ( i [ d . _id ] = d , b = d . getSourcePosition ( a ) ) : b = d . position , e . _isCommunity ? ( i [ e . _id ] = e , c = e . getTargetPosition ( a ) ) : c = e . position , { s : b , t : c } } , C = function ( a , b ) { i = { } , b . attr ( " transform " , function ( a ) { var b = B ( a ) ; return " translate ( " + b . s . x + " , " + b . s . y + " ) rotate ( " + x ( b . s , b . t ) + " ) " } ) , a . attr ( " x2 " , function ( a ) { var b = B ( a ) ; return y ( b . s , b . t ) } ) } , D = function ( a , b ) { t ( a , b ) , m & & u ( a , b ) , v ( a , b ) , z ( a , b ) , C ( a , b ) } , E = function ( a ) { void 0 ! = = a & & ( h = a ) ; var b , c = g . parent . selectAll ( " . link " ) . data ( h , o ) ; c . enter ( ) . append ( " g " ) . attr ( " class " , " link " ) . attr ( " id " , o ) , c . exit ( ) . remove ( ) , c . selectAll ( " * > * " ) . remove ( ) , b = c . append ( " line " ) , D ( b , c ) , _ . each ( i , function ( a ) { a . shapeInnerEdges ( d3 . select ( this ) , D ) } ) , j . bindMenu ( $ ( " . link " ) ) } , F = function ( ) { var a = g . parent . selectAll ( " . link " ) , b = a . select ( " line " ) ; C ( b , a ) , s ( a ) , _ . each ( i , function ( a ) { a . updateInnerEdges ( d3 . select ( this ) , C , s ) } ) } , G = function ( a ) { switch ( $ ( " svg defs marker # arrow " ) . remove ( ) , a . type ) { case EdgeShaper . shapes . NONE : t = p ; break ; case EdgeShaper . shapes . ARROW : t = function ( a , b ) { a . attr ( " marker - end " , " url ( # arrow ) " ) } , 0 = = = d . selectAll ( " defs " ) [ 0 ] . length & & d . append ( " defs " ) , d . select ( " defs " ) . append ( " marker " ) . attr ( " id " , " arrow " ) . attr ( " refX " , " 10 " ) . attr ( " refY " , " 5 " ) . attr ( " markerUnits " , " strokeWidth " ) . attr ( " markerHeight " , " 10 " ) . attr ( " markerWidth " , " 10 " ) . attr ( " orient " , " auto " ) . append ( " path " ) . attr ( " d " , " M 0 0 L 10 5 L 0 10 z " ) ; break ; default : throw " Sorry given Shape not known ! " } } , H = function ( a ) { u = _ . isFunction ( a ) ? function ( b , c ) { c . append ( " text " ) . attr ( " text - anchor " , " middle " ) . text ( a ) } : function ( b , c ) { c . append ( " text " ) . attr ( " text - anchor " , " middle " ) . text ( function ( b ) { var c = l ( k ( a , b . _data ) ) ; return c [ 0 ] | | " " } ) } , s = function ( a ) { a . select ( " text " ) . attr ( " transform " , function ( a ) { var b = B ( a ) ; return " translate ( " + y ( b . s , b . t ) / 2 + " , - 3 ) " } ) } } , I = function ( a ) { void 0 ! = = a . reset & & a . reset & & w ( ) , _ . each ( a , function ( a , b ) { " reset " ! = = b & & A ( b , a ) } ) } , J = function ( a ) { switch ( $ ( " svg defs # gradientEdgeColor " ) . remove ( ) , r ( ) , a . type ) { case " single " : v = function ( b , c ) { b . attr ( " stroke " , a . stroke ) } ; break ; case " gradient " : 0 = = = d . selectAll ( " defs " ) [ 0 ] . length & & d . append ( " defs " ) ; var b = d . select ( " defs " ) . append ( " linearGradient " ) . attr ( " id " , " gradientEdgeColor " ) ; b . append ( " stop " ) . attr ( " offset " , " 0 " ) . attr ( " stop - color " , a . source ) , b . append ( " stop " ) . attr ( " offset " , " 0 . 4 " ) . attr ( " stop - color " , a . source ) , b . append ( " stop " ) . attr ( " offset " , " 0 . 6 " ) . attr ( " stop - color " , a . target ) , b . append ( " stop " ) . attr ( " offset " , " 1 " ) . attr ( " stop - color " , a . target ) , v = function ( a , b ) { a . attr ( " stroke " , " url ( # gradientEdgeColor ) " ) , a . attr ( " y2 " , " 0 . 0000000000000001 " ) } ; break ; case " attribute " : v = function ( b , c ) { c . attr ( " stroke " , function ( b ) { return q . getColour ( b . _data [ a . key ] ) } ) } ; break ; default : throw " Sorry given colour - scheme not known " } } , K = function ( a ) { void 0 ! = = a . shape & & G ( a . shape ) , void 0 ! = = a . label & & ( H ( a . label ) , g . label = a . label ) , void 0 ! = = a . actions & & I ( a . actions ) , void 0 ! = = a . color & & J ( a . color ) } ; for ( g . parent = a , w ( ) , d = a ; d [ 0 ] [ 0 ] & & d [ 0 ] [ 0 ] . ownerSVGElement ; ) d = d3 . select ( d [ 0 ] [ 0 ] . ownerSVGElement ) ; void 0 = = = b & & ( b = { color : { type : " single " , stroke : " # 686766 " } } ) , void 0 = = = b . color & & ( b . color = { type : " single " , stroke : " # 686766 " } ) , K ( b ) , _ . isFunction ( c ) & & ( o = c ) , e = d . append ( " g " ) , g . changeTo = function ( a ) { K ( a ) , E ( ) , F ( ) } , g . drawEdges = function ( a ) { E ( a ) , F ( ) } , g . updateEdges = function ( ) { F ( ) } , g . reshapeEdges = function ( ) { E ( ) } , g . activateLabel = function ( a ) { m = ! ! a , E ( ) } , g . addAnEdgeFollowingTheCursor = function ( a , b ) { return n = e . append ( " line " ) , n . attr ( " stroke " , " black " ) . attr ( " id " , " connectionLine " ) . attr ( " x1 " , a ) . attr ( " y1 " , b ) . attr ( " x2 " , a ) . attr ( " y2 " , b ) , function ( a , b ) { n . attr ( " x2 " , a ) . attr ( " y2 " , b ) } } , g . removeCursorFollowingEdge = function ( ) { n . remove & & ( n . remove ( ) , n = { } ) } , g . addMenuEntry = function ( a , b ) { j . addEntry ( a , b ) } , g . getLabel = function ( ) { return g . label | | " " } , g . resetColourMap = r } function EventDispatcher ( a , b , c ) { " use strict " ; var d , e , f , g , h = this , i = function ( b ) { if ( void 0 = = = b . shaper & & ( b . shaper = a ) , d . checkNodeEditorConfig ( b ) ) { var c = new d . InsertNode ( b ) , e = new d . PatchNode ( b ) , f = new d . DeleteNode ( b ) ; h . events . CREATENODE = function ( a , b , d , e ) { var f ; return f = _ . isFunction ( a ) ? a ( ) : a , function ( ) { c ( f , b , d , e ) } } , h . events . PATCHNODE = function ( a , b , c ) { if ( ! _ . isFunction ( b ) ) throw " Please give a function to extract the new node data " ; return function ( ) { e ( a , b ( ) , c ) } } , h . events . DELETENODE = function ( a ) { return function ( b ) { f ( b , a ) } } } } , j = function ( a ) { if ( void 0 = = = a . shaper & & ( a . shaper = b ) , d . checkEdgeEditorConfig ( a ) ) { var c = new d . InsertEdge ( a ) , e = new d . PatchEdge ( a ) , f = new d . DeleteEdge ( a ) , g = null , i = ! 1 ; h . events . STARTCREATEEDGE = function ( a ) { return function ( b ) { var c = d3 . event | | window . event ; g = b , i = ! 1 , void 0 ! = = a & & a ( b , c ) , c . stopPropagation ( ) } } , h . events . CANCELCREATEEDGE = function ( a ) { return function ( ) { g = null , void 0 = = = a | | i | | a ( ) } } , h . events . FINISHCREATEEDGE = function ( a ) { return function ( b ) { null ! = = g & & b ! = = g & & ( c ( g , b , a ) , i = ! 0 ) } } , h . events . PATCHEDGE = function ( a , b , c ) { if ( ! _ . isFunction ( b ) ) throw " Please give a function to extract the new node data " ; return function ( ) { e ( a , b ( ) , c ) } } , h . events . DELETEEDGE = function ( a ) { return function ( b ) { f ( b , a ) } } } } , k = function ( ) { g = g | | $ ( " svg " ) , g . unbind ( ) , _ . each ( e , function ( a , b ) { g . bind ( b , function ( c ) { _ . each ( a , function ( a ) { a ( c ) } ) , f [ b ] & & f [ b ] ( c ) } ) } ) } ; if ( void 0 = = = a ) throw " NodeShaper has to be given . " ; if ( void 0 = = = b ) throw " EdgeShaper has to be given . " ; d = new EventLibrary , e = { click : [ ] , dblclick : [ ] , mousedown : [ ] , mouseup : [ ] , mousemove : [ ] , mouseout : [ ] , mouseover : [ ] } , f = { } , h . events = { } , void 0 ! = = c & & ( void 0 ! = = c . expand & & d . checkExpandConfig ( c . expand ) & & ( h . events . EXPAND = new d . Expand ( c . expand ) , a . setGVStartFunction ( function ( ) { c . expand . reshapeNodes ( ) , c . expand . startCallback ( ) } ) ) , void 0 ! = = c . drag & & d . checkDragConfig ( c . drag ) & & ( h . events . DRAG = d . Drag ( c . drag ) ) , void 0 ! = = c . nodeEditor & & i ( c . nodeEditor ) , void 0 ! = = c . edgeEditor & & j ( c . edgeEditor ) ) , Object . freeze ( h . events ) , h . bind = function ( c , d , e ) { if ( void 0 = = = e | | ! _ . isFunction ( e ) ) throw " You have to give a function that should be bound as a third argument " ; var g = { } ; switch ( c ) { case " nodes " : g [ d ] = e , a . changeTo ( { actions : g } ) ; break ; case " edges " : g [ d ] = e , b . changeTo ( { actions : g } ) ; break ; case " svg " : f [ d ] = e , k ( ) ; break ; default : if ( void 0 = = = c . bind ) throw ' Sorry cannot bind to object . Please give either " nodes " , " edges " or a jQuery - selected DOM - Element ' ; c . unbind ( d ) , c . bind ( d , e ) } } , h . rebind = function ( c , d ) { switch ( d = d | | { } , d . reset = ! 0 , c ) { case " nodes " : a . changeTo ( { actions : d } ) ; break ; case " edges " : b . changeTo ( { actions : d } ) ; break ; case " svg " : f = { } , _ . each ( d , function ( a , b ) { " reset " ! = = b & & ( f [ b ] = a ) } ) , k ( ) ; break ; default : throw ' Sorry cannot rebind to object . Please give either " nodes " , " edges " or " svg " ' } } , h . fixSVG = function ( a , b ) { if ( void 0 = = = e [ a ] ) throw " Sorry unkown event " ; e [ a ] . push ( b ) , k ( ) } , Object . freeze ( h . events ) } function EventLibrary ( ) { " use strict " ; var a = this ; this . checkExpandConfig = function ( a ) { if ( void 0 = = = a . startCallback ) throw " A callback to the Start - method has to be defined " ; if ( void 0 = = = a . adapter | | void 0 = = = a . adapter . explore ) throw " An adapter to load data has to be defined " ; if ( void 0 = = = a . reshapeNodes ) throw " A callback to reshape nodes has to be defined " ; return ! 0 } , this . Expand = function ( b ) { a . checkExpandConfig ( b ) ; var c = b . startCallback , d = b . adapter . explore , e = b . reshapeNodes ; return function ( a ) { d ( a , c ) , e ( ) , c ( ) } } , this . checkDragConfig = function ( a ) { if ( void 0 = = = a . layouter ) throw " A layouter has to be defined " ; if ( void 0 = = = a . layouter . drag | | ! _ . isFunction ( a . layouter . drag ) ) throw " The layouter has to offer a drag function " ; return ! 0 } , this . Drag = function ( b ) { return a . checkDragConfig ( b ) , b . layouter . drag } , this . checkNodeEditorConfig = function ( a ) { if ( void 0 = = = a . adapter ) throw " An adapter has to be defined " ; if ( void 0 = = = a . shaper ) throw " A node shaper has to be defined " ; return ! 0 } , this . checkEdgeEditorConfig = function ( a ) { if ( void 0 = = = a . adapter ) throw " An adapter has to be defined " ; if ( void 0 = = = a . shaper ) throw " An edge Shaper has to be defined " ; return ! 0 } , this . InsertNode = function ( b ) { a . checkNodeEditorConfig ( b ) ; var c = b . adapter , d = b . shaper ; return function ( a , b , e , f ) { var g , h ; _ . isFunction ( a ) & & ! b ? ( g = a , h = { } ) : ( g = b , h = a ) , c . createNode ( h , function ( a ) { d . reshapeNodes ( ) , g ( a ) } , e , f ) } } , this . PatchNode = function ( b ) { a . checkNodeEditorConfig ( b ) ; var c = b . adapter , d = b . shaper ; return function ( a , b , e ) { c . patchNode ( a , b , function ( a ) { d . reshapeNodes ( ) , e ( a ) } ) } } , this . DeleteNode = function ( b ) { a . checkNodeEditorConfig ( b ) ; var c = b . adapter , d = b . shaper ; return function ( a , b ) { c . deleteNode ( a , function ( ) { d . reshapeNodes ( ) , b ( ) } ) } } , this . SelectNodeCollection = function ( b ) { a . checkNodeEditorConfig ( b ) ; var c = b . adapter ; if ( ! _ . isFunction ( c . useNodeCollection ) ) throw " The adapter has to support collection changes " ; return function ( a , b ) { c . useNodeCollection ( a ) , b ( ) } } , this . InsertEdge = function ( b ) { a . checkEdgeEditorConfig ( b ) ; var c = b . adapter , d = b . shaper ; return function ( a , b , e ) { c . createEdge ( { source : a , target : b } , function ( a ) { d . reshapeEdges ( ) , e ( a ) } ) } } , this . PatchEdge = function ( b ) { a . checkEdgeEditorConfig ( b ) ; var c = b . adapter , d = b . shaper ; return function ( a , b , e ) { c . patchEdge ( a , b , function ( a ) { d . reshapeEdges ( ) , e ( a ) } ) } } , this . DeleteEdge = function ( b ) { a . checkEdgeEditorConfig ( b ) ; var c = b . adapter , d = b . shaper ; return function ( a , b ) { c . deleteEdge ( a , function ( ) { d . reshapeEdges ( ) , b ( ) } ) } } } function ForceLayouter ( a ) { " use strict " ; var b = this , c = d3 . layout . force ( ) , d = a . charge | | - 600 , e = a . distance | | 80 , f = a . gravity | | . 01 , g = function ( a ) { var b = 0 ; return b + = a . source . _isCommunity ? a . source . getDistance ( e ) : e , b + = a . target . _isCommunity ? a . target . getDistance ( e ) : e } , h = function ( a ) { return a . _isCommunity ? a . getCharge ( d ) : d } , i = a . onUpdate | | function ( ) { } , j = a . width | | 880 , k = a . height | | 680 , l = function ( a ) { a . distance & & ( e = a . distance ) , a . gravity & & c . gravity ( a . gravity ) , a . charge & & ( d = a . charge ) } ; if ( void 0 = = = a . nodes ) throw " No nodes defined " ; if ( void 0 = = = a . links ) throw " No links defined " ; c . nodes ( a . nodes ) , c . links ( a . links ) , c . size ( [ j , k ] ) , c . linkDistance ( g ) , c . gravity ( f ) , c . charge ( h ) , c . on ( " tick " , function ( ) { } ) , b . start = function ( ) { c . start ( ) } , b . stop = function ( ) { c . stop ( ) } , b . drag = c . drag , b . setCombinedUpdateFunction = function ( a , d , e ) { void 0 ! = = e ? ( i = function ( ) { c . alpha ( ) < . 1 & & ( a . updateNodes ( ) , d . updateEdges ( ) , e ( ) , c . alpha ( ) < . 05 & & b . stop ( ) ) } , c . on ( " tick " , i ) ) : ( i = function ( ) { c . alpha ( ) < . 1 & & ( a . updateNodes ( ) , d . updateEdges ( ) , c . alpha ( ) < . 05 & & b . stop ( ) ) } , c . on ( " tick " , i ) ) } , b . changeTo = function ( a ) { l ( a ) } , b . changeWidth = function ( a ) { j = a , c . size ( [ j , k ] ) } } function FoxxAdapter ( a , b , c , d , e ) { " use strict " ; if ( void 0 = = = a ) throw " The nodes have to be given . " ; if ( void 0 = = = b ) throw " The edges have to be given . " ; if ( void 0 = = = c ) throw " The route has to be given . " ; if ( void 0 = = = d ) throw " A reference to the graph viewer has to be given . " ; e = e | | { } ; var f , g = this , h = { } , i = { } , j = c , k = { cache : ! 1 , contentType : " application / json " , dataType : " json " , processData : ! 1 , error : function ( a ) { try { throw console . log ( a . statusText ) , " [ " + a . errorNum + " ] " + a . errorMessage } catch ( b ) { throw console . log ( b ) , " Undefined ERROR " } } } , l = function ( ) { i . query = { get : function ( a , b ) { var c = $ . extend ( k , { type : " GET " , url : j + " / query / " + a , success : b } ) ; $ . ajax ( c ) } } , i . nodes = { post : function ( a , b ) { var c = $ . extend ( k , { type : " POST " , url : j + " / nodes " , data : JSON . stringify ( a ) , success : b } ) ; $ . ajax ( c ) } , put : function ( a , b , c ) { var d = $ . extend ( k , { type : " PUT " , url : j + " / nodes / " + a , data : JSON . stringify ( b ) , success : c } ) ; $ . ajax ( d ) } , del : function ( a , b ) { var c = $ . extend ( k , { type : " DELETE " , url : j + " / nodes / " + a , success : b } ) ; $ . ajax ( c ) } } , i . edges = { post : function ( a , b ) { var c = $ . extend ( k , { type : " POST " , url : j + " / edges " , data : JSON . stringify ( a ) , success : b } ) ; $ . ajax ( c ) } , put : function ( a , b , c ) { var d = $ . extend ( k , { type : " PUT " , url : j + " / edges / " + a , <nl> + data : JSON . stringify ( b ) , success : c } ) ; $ . ajax ( d ) } , del : function ( a , b ) { var c = $ . extend ( k , { type : " DELETE " , url : j + " / edges / " + a , success : b } ) ; $ . ajax ( c ) } } , i . forNode = { del : function ( a , b ) { var c = $ . extend ( k , { type : " DELETE " , url : j + " / edges / forNode / " + a , success : b } ) ; $ . ajax ( c ) } } } , m = function ( a , b , c ) { i [ a ] . get ( b , c ) } , n = function ( a , b , c ) { i [ a ] . post ( b , c ) } , o = function ( a , b , c ) { i [ a ] . del ( b , c ) } , p = function ( a , b , c , d ) { i [ a ] . put ( b , c , d ) } , q = function ( a ) { void 0 ! = = a . width & & f . setWidth ( a . width ) , void 0 ! = = a . height & & f . setHeight ( a . height ) } , r = function ( b , c ) { var d = { } , e = b . first , g = a . length ; e = f . insertNode ( e ) , _ . each ( b . nodes , function ( b ) { b = f . insertNode ( b ) , g < a . length & & ( d [ b . _id ] = b , g = a . length ) } ) , _ . each ( b . edges , function ( a ) { f . insertEdge ( a ) } ) , delete d [ e . _id ] , f . checkSizeOfInserted ( d ) , f . checkNodeLimit ( e ) , void 0 ! = = c & & _ . isFunction ( c ) & & c ( e ) } ; e . prioList & & ( h . prioList = e . prioList ) , f = new AbstractAdapter ( a , b , this , d , h ) , q ( e ) , l ( ) , g . explore = f . explore , g . loadNode = function ( a , b ) { m ( " query " , a , function ( a ) { r ( a , b ) } ) } , g . loadInitialNode = function ( a , b ) { f . cleanUp ( ) ; var c = function ( a ) { b ( f . insertInitialNode ( a ) ) } ; g . loadNode ( a , c ) } , g . requestCentralityChildren = function ( a , b ) { } , g . createEdge = function ( a , b ) { var c = _ . clone ( a ) ; c . _from = a . source . _id , c . _to = a . target . _id , delete c . source , delete c . target , n ( " edges " , c , function ( c ) { c . _from = a . source . _id , c . _to = a . target . _id , delete c . error ; var d = f . insertEdge ( c ) ; void 0 ! = = b & & _ . isFunction ( b ) & & b ( d ) } ) } , g . deleteEdge = function ( a , b ) { o ( " edges " , a . _id , function ( ) { f . removeEdge ( a ) , void 0 ! = = b & & _ . isFunction ( b ) & & b ( ) } ) } , g . patchEdge = function ( a , b , c ) { p ( " edges " , a . _id , b , function ( d ) { a . _data = $ . extend ( a . _data , b ) , void 0 ! = = c & & _ . isFunction ( c ) & & c ( ) } ) } , g . createNode = function ( a , b ) { n ( " nodes " , a , function ( a ) { f . insertNode ( a ) , void 0 ! = = b & & _ . isFunction ( b ) & & b ( a ) } ) } , g . deleteNode = function ( a , b ) { o ( " nodes " , a . _id , function ( ) { f . removeEdgesForNode ( a ) , o ( " forNode " , a . _id , function ( ) { } ) , f . removeNode ( a ) , void 0 ! = = b & & _ . isFunction ( b ) & & b ( ) } ) } , g . patchNode = function ( a , b , c ) { p ( " nodes " , a . _id , b , function ( d ) { a . _data = $ . extend ( a . _data , b ) , void 0 ! = = c & & _ . isFunction ( c ) & & c ( a ) } ) } , g . setNodeLimit = function ( a , b ) { f . setNodeLimit ( a , b ) } , g . setChildLimit = function ( a ) { f . setChildLimit ( a ) } , g . expandCommunity = function ( a , b ) { f . expandCommunity ( a ) , void 0 ! = = b & & b ( ) } , g . setWidth = f . setWidth , g . changeTo = f . changeTo , g . getPrioList = f . getPrioList } function GharialAdapter ( a , b , c , d ) { " use strict " ; if ( void 0 = = = a ) throw " The nodes have to be given . " ; if ( void 0 = = = b ) throw " The edges have to be given . " ; if ( void 0 = = = c ) throw " A reference to the graph viewer has to be given . " ; if ( void 0 = = = d ) throw " A configuration with graphName has to be given . " ; if ( void 0 = = = d . graphName ) throw " The graphname has to be given . " ; var e , f , g , h , i , j , k , l = this , m = { } , n = { } , o = { } , p = function ( a ) { $ . ajax ( { cache : ! 1 , type : " GET " , async : ! 1 , url : n . graph + " / " + a + " / edge " , contentType : " application / json " , success : function ( a ) { h = a . collections , i = h [ 0 ] } } ) , $ . ajax ( { cache : ! 1 , type : " GET " , async : ! 1 , url : n . graph + " / " + a + " / vertex " , contentType : " application / json " , success : function ( a ) { f = a . collections , g = f [ 0 ] } } ) } , q = function ( a ) { j = a , p ( a ) , n . edges = n . graph + " / " + j + " / edge / " , n . vertices = n . graph + " / " + j + " / vertex / " , n . any = n . base + " simple / any " } , r = function ( a ) { var b = a . baseUrl | | " " ; void 0 ! = = a . width & & e . setWidth ( a . width ) , void 0 ! = = a . height & & e . setHeight ( a . height ) , k = void 0 ! = = a . undirected ? a . undirected = = = ! 0 ? " any " : " outbound " : " any " , n . base = b + " _api / " , n . cursor = n . base + " cursor " , n . graph = n . base + " gharial " , a . graphName & & q ( a . graphName ) } , s = function ( a , b , c ) { a ! = = o . getAllGraphs & & ( b . graph = j ) ; var d = { query : a , bindVars : b } ; $ . ajax ( { type : " POST " , url : n . cursor , data : JSON . stringify ( d ) , contentType : " application / json " , dataType : " json " , processData : ! 1 , success : function ( a ) { c ( a . result ) } , error : function ( a ) { try { throw console . log ( a . statusText ) , " [ " + a . errorNum + " ] " + a . errorMessage } catch ( b ) { throw " Undefined ERROR " } } } ) } , t = function ( a , b ) { var c , d = { query : o . randomVertices , bindVars : { " @ collection " : b , limit : a } } ; return $ . ajax ( { type : " POST " , url : n . cursor , data : JSON . stringify ( d ) , contentType : " application / json " , dataType : " json " , processData : ! 1 , async : ! 1 , success : function ( a ) { c = a . result } , error : function ( a ) { try { throw console . log ( a . statusText ) , " [ " + a . errorNum + " ] " + a . errorMessage } catch ( b ) { throw " Undefined ERROR " } } } ) , c } , u = function ( b , c ) { 0 ! = = b . length & & null ! = = b [ 0 ] . vertex | | c & & c ( { errorCode : 404 } ) ; var d = { } , f = e . insertNode ( b [ 0 ] . vertex ) , g = a . length ; b . shift ( ) , _ . each ( b , function ( b ) { if ( null ! = = b . vertex ) { var c = e . insertNode ( b . vertex ) ; g < a . length & & ( d [ c . _id ] = c , g = a . length ) , null ! = = b . edge & & e . insertEdge ( b . edge ) } } ) , delete d [ f . _id ] , e . checkSizeOfInserted ( d ) , e . checkNodeLimit ( f ) , c & & c ( f ) } , v = function ( a ) { return function ( b ) { return b & & b . errorCode ? void a ( b ) : void a ( e . insertInitialNode ( b ) ) } } ; d . prioList & & ( m . prioList = d . prioList ) , e = new AbstractAdapter ( a , b , this , c , m ) , r ( d ) , o . getAllGraphs = " FOR g IN _graphs return g . _key " , o . traversal = function ( a ) { return " FOR vertex , edge IN 0 . . 1 " + a + " @ example GRAPH @ graph RETURN { vertex , edge } " } , o . oneNodeByAttributeValue = function ( a , b , c , d ) { if ( a . attr = c , a . value = d , 1 = = = b . length ) return a [ " @ collection " ] = b [ 0 ] , " FOR node IN @ @ collection FILTER node [ @ attr ] = = @ value LIMIT 1 " ; var e = " FOR node IN UNION ( " , f = 0 ; for ( f = 0 ; f < b . length ; + + f ) e + = " ( FOR node IN @ @ collection " + f + " FILTER node [ @ attr ] = = @ value LIMIT 1 RETURN node ) " , a [ " @ collection " + f ] = b [ f ] ; return e + = " ) LIMIT 1 " } , o . traversalAttributeValue = function ( a , b , c , d , e ) { return o . oneNodeByAttributeValue ( b , c , d , e ) + " FOR vertex , edge IN 0 . . 1 " + a + " node GRAPH @ graph RETURN { vertex , edge } " } , o . childrenCentrality = " RETURN SUM ( FOR v IN ANY @ id GRAPH @ graph RETURN 1 ) " , o . connectedEdges = " FOR v , e IN ANY @ id GRAPH @ graph RETURN e " , o . randomVertices = " FOR x IN @ @ collection SORT RAND ( ) LIMIT @ limit RETURN x " , l . explore = e . explore , l . loadNode = function ( a , b ) { l . loadNodeFromTreeById ( a , b ) } , l . NODES_TO_DISPLAY = 19 , l . TOTAL_NODES = 0 , l . definedNodes = [ ] , l . randomNodes = [ ] , l . loadRandomNode = function ( a , b ) { var c , d = _ . shuffle ( l . getNodeCollections ( ) ) ; for ( c = 0 ; c < d . length ; + + c ) { void 0 ! = = b & & ( " all " = = = b ? l . NODES_TO_DISPLAY = l . TOTAL_NODES : l . NODES_TO_DISPLAY = parseInt ( b , 10 ) - 1 , l . NODES_TO_DISPLAY > = l . TOTAL_NODES ? $ ( " . infoField " ) . hide ( ) : $ ( " . infoField " ) . show ( ) ) ; var e = t ( l . NODES_TO_DISPLAY , d [ c ] ) ; if ( e . length > 0 ) return _ . each ( e , function ( a ) { l . randomNodes . push ( a ) } ) , void l . loadInitialNode ( e [ 0 ] . _id , a ) } a ( { errorCode : 404 } ) } , l . loadInitialNode = function ( a , b ) { e . cleanUp ( ) , l . loadNode ( a , v ( b ) ) } , l . getRandomNodes = function ( ) { var a = [ ] , b = [ ] ; l . definedNodes . length > 0 & & _ . each ( l . definedNodes , function ( a ) { b . push ( a ) } ) , l . randomNodes . length > 0 & & _ . each ( l . randomNodes , function ( a ) { b . push ( a ) } ) ; var c = 0 ; return _ . each ( b , function ( b ) { c < l . NODES_TO_DISPLAY & & ( a . push ( { vertex : b , path : { edges : [ ] , vertices : [ b ] } } ) , c + + ) } ) , a } , l . loadNodeFromTreeById = function ( a , b ) { s ( o . traversal ( k ) , { example : a } , function ( c ) { var d = [ ] ; d = l . getRandomNodes ( ) , d . length > 0 ? _ . each ( d , function ( a ) { s ( o . traversal ( k ) , { example : a . vertex . _id } , function ( a ) { _ . each ( a , function ( a ) { c . push ( a ) } ) , u ( c , b ) } ) } ) : s ( o . traversal ( k ) , { example : a } , function ( a ) { u ( a , b ) } ) } ) } , l . loadNodeFromTreeByAttributeValue = function ( a , b , c ) { var d = { } , e = o . traversalAttributeValue ( k , d , f , a , b ) ; s ( e , d , function ( a ) { u ( a , c ) } ) } , l . getNodeExampleFromTreeByAttributeValue = function ( a , b , c ) { var d , g = o . travesalAttributeValue ( k , d , f , a , b ) ; s ( g , d , function ( d ) { if ( 0 = = = d . length ) throw arangoHelper . arangoError ( " Graph error " , " no nodes found " ) , " No suitable nodes have been found . " ; _ . each ( d , function ( d ) { if ( d . vertex [ a ] = = = b ) { var f = { } ; f . _key = d . vertex . _key , f . _id = d . vertex . _id , f . _rev = d . vertex . _rev , e . insertNode ( f ) , c ( f ) } } ) } ) } , l . loadAdditionalNodeByAttributeValue = function ( a , b , c ) { l . getNodeExampleFromTreeByAttributeValue ( a , b , c ) } , l . loadInitialNodeByAttributeValue = function ( a , b , c ) { e . cleanUp ( ) , l . loadNodeFromTreeByAttributeValue ( a , b , v ( c ) ) } , l . requestCentralityChildren = function ( a , b ) { s ( o . childrenCentrality , { id : a } , function ( a ) { b ( a [ 0 ] ) } ) } , l . createEdge = function ( a , b ) { var c = { } ; c . _from = a . source . _id , c . _to = a . target . _id , $ . ajax ( { cache : ! 1 , type : " POST " , url : n . edges + i , data : JSON . stringify ( c ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( a ) { if ( a . error = = = ! 1 ) { var d , f = a . edge ; f . _from = c . _from , f . _to = c . _to , d = e . insertEdge ( f ) , b ( d ) } } , error : function ( a ) { var b = " " ; try { b = JSON . parse ( a . responseText ) . errorMessage + " ( " + JSON . parse ( a . responseText ) . errorNum + " ) " , arangoHelper . arangoError ( a . statusText , b ) } catch ( c ) { throw a . statusText } } } ) } , l . deleteEdge = function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " DELETE " , url : n . edges + a . _id , contentType : " application / json " , dataType : " json " , processData : ! 1 , success : function ( ) { e . removeEdge ( a ) , void 0 ! = = b & & _ . isFunction ( b ) & & b ( ) } , error : function ( a ) { var b = " " ; try { b = JSON . parse ( a . responseText ) . errorMessage + " ( " + JSON . parse ( a . responseText ) . errorNum + " ) " , arangoHelper . arangoError ( a . statusText , b ) } catch ( c ) { throw a . statusText } } } ) } , l . patchEdge = function ( a , b , c ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : n . edges + a . _id , data : JSON . stringify ( b ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( ) { a . _data = $ . extend ( a . _data , b ) , c ( ) } , error : function ( a ) { var b = " " ; try { b = JSON . parse ( a . responseText ) . errorMessage + " ( " + JSON . parse ( a . responseText ) . errorNum + " ) " , arangoHelper . arangoError ( a . statusText , b ) } catch ( c ) { throw a . statusText } } } ) } , l . createNode = function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " POST " , url : n . vertices + g , data : JSON . stringify ( a ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( c ) { c . error = = = ! 1 & & ( a . _key = c . vertex . _key , a . _id = c . vertex . _id , a . _rev = c . vertex . _rev , e . insertNode ( a ) , b ( a ) ) } , error : function ( a ) { var b = " " ; try { b = JSON . parse ( a . responseText ) . errorMessage + " ( " + JSON . parse ( a . responseText ) . errorNum + " ) " , arangoHelper . arangoError ( a . statusText , b ) } catch ( c ) { throw a . statusText } } } ) } , l . deleteNode = function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " DELETE " , url : n . vertices + a . _id , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( ) { e . removeEdgesForNode ( a ) , e . removeNode ( a ) , void 0 ! = = b & & _ . isFunction ( b ) & & b ( ) } , error : function ( a ) { var b = " " ; try { b = JSON . parse ( a . responseText ) . errorMessage + " ( " + JSON . parse ( a . responseText ) . errorNum + " ) " , arangoHelper . arangoError ( a . statusText , b ) } catch ( c ) { throw a . statusText } } } ) } , l . patchNode = function ( a , b , c ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : n . vertices + a . _id , data : JSON . stringify ( b ) , dataType : " json " , contentType : " application / json " , processData : ! 1 , success : function ( ) { a . _data = $ . extend ( a . _data , b ) , c ( a ) } , error : function ( a ) { throw a . statusText } } ) } , l . changeToGraph = function ( a , b ) { e . cleanUp ( ) , q ( a ) , void 0 ! = = b & & ( k = b = = = ! 0 ? " any " : " outbound " ) } , l . setNodeLimit = function ( a , b ) { e . setNodeLimit ( a , b ) } , l . setChildLimit = function ( a ) { e . setChildLimit ( a ) } , l . expandCommunity = function ( a , b ) { e . expandCommunity ( a ) , void 0 ! = = b & & b ( ) } , l . getGraphs = function ( a ) { a & & a . length > = 1 & & s ( o . getAllGraphs , { } , a ) } , l . getAttributeExamples = function ( a ) { if ( a & & a . length > = 1 ) { var b , c = [ ] , d = _ . shuffle ( l . getNodeCollections ( ) ) ; for ( b = 0 ; b < d . length ; + + b ) { var e = t ( 10 , d [ b ] ) ; $ . ajax ( { cache : ! 1 , type : " GET " , async : ! 1 , url : arangoHelper . databaseUrl ( " / _api / collection / " + encodeURIComponent ( d [ b ] ) + " / count " ) , contentType : " application / json " , success : function ( a ) { l . TOTAL_NODES = l . TOTAL_NODES + a . count } } ) , e . length > 0 & & ( c = c . concat ( _ . flatten ( _ . map ( e , function ( a ) { return _ . keys ( a ) } ) ) ) ) } c = _ . sortBy ( _ . uniq ( c ) , function ( a ) { return a . toLowerCase ( ) } ) , a ( c ) } } , l . getEdgeCollections = function ( ) { return h } , l . getSelectedEdgeCollection = function ( ) { return i } , l . useEdgeCollection = function ( a ) { if ( ! _ . contains ( h , a ) ) throw " Collection " + a + " is not available in the graph . " ; i = a } , l . getNodeCollections = function ( ) { return f } , l . getSelectedNodeCollection = function ( ) { return g } , l . useNodeCollection = function ( a ) { if ( ! _ . contains ( f , a ) ) throw " Collection " + a + " is not available in the graph . " ; g = a } , l . getDirection = function ( ) { return k } , l . getGraphName = function ( ) { return j } , l . setWidth = e . setWidth , l . changeTo = e . changeTo , l . getPrioList = e . getPrioList } function JSONAdapter ( a , b , c , d , e , f ) { " use strict " ; var g = this , h = { } , i = { } , j = new AbstractAdapter ( b , c , this , d ) ; h . range = e / 2 , h . start = e / 4 , h . getStart = function ( ) { return this . start + Math . random ( ) * this . range } , i . range = f / 2 , i . start = f / 4 , i . getStart = function ( ) { return this . start + Math . random ( ) * this . range } , g . loadNode = function ( a , b ) { g . loadNodeFromTreeById ( a , b ) } , g . loadInitialNode = function ( b , c ) { var d = a + b + " . json " ; j . cleanUp ( ) , d3 . json ( d , function ( a , d ) { void 0 ! = = a & & null ! = = a & & console . log ( a ) ; var e = j . insertInitialNode ( d ) ; g . requestCentralityChildren ( b , function ( a ) { e . _centrality = a } ) , _ . each ( d . children , function ( a ) { var b = j . insertNode ( a ) , c = { _from : e . _id , _to : b . _id , _id : e . _id + " - " + b . _id } ; j . insertEdge ( c ) , g . requestCentralityChildren ( b . _id , function ( a ) { b . _centrality = a } ) , delete b . _data . children } ) , delete e . _data . children , c & & c ( e ) } ) } , g . loadNodeFromTreeById = function ( b , c ) { var d = a + b + " . json " ; d3 . json ( d , function ( a , d ) { void 0 ! = = a & & null ! = = a & & console . log ( a ) ; var e = j . insertNode ( d ) ; g . requestCentralityChildren ( b , function ( a ) { e . _centrality = a } ) , _ . each ( d . children , function ( a ) { var b = j . insertNode ( a ) , c = { _from : e . _id , _to : b . _id , _id : e . _id + " - " + b . _id } ; j . insertEdge ( c ) , g . requestCentralityChildren ( b . _id , function ( a ) { e . _centrality = a } ) , delete b . _data . children } ) , delete e . _data . children , c & & c ( e ) } ) } , g . requestCentralityChildren = function ( b , c ) { var d = a + b + " . json " ; d3 . json ( d , function ( a , b ) { void 0 ! = = a & & null ! = = a & & console . log ( a ) , void 0 ! = = c & & c ( void 0 ! = = b . children ? b . children . length : 0 ) } ) } , g . loadNodeFromTreeByAttributeValue = function ( a , b , c ) { throw " Sorry this adapter is read - only " } , g . loadInitialNodeByAttributeValue = function ( a , b , c ) { throw " Sorry this adapter is read - only " } , g . createEdge = function ( a , b ) { throw " Sorry this adapter is read - only " } , g . deleteEdge = function ( a , b ) { throw " Sorry this adapter is read - only " } , g . patchEdge = function ( a , b , c ) { throw " Sorry this adapter is read - only " } , g . createNode = function ( a , b ) { throw " Sorry this adapter is read - only " } , g . deleteNode = function ( a , b ) { throw " Sorry this adapter is read - only " } , g . patchNode = function ( a , b , c ) { throw " Sorry this adapter is read - only " } , g . setNodeLimit = function ( a , b ) { } , g . setChildLimit = function ( a ) { } , g . expandCommunity = function ( a , b ) { } , g . setWidth = function ( ) { } , g . explore = j . explore } function ModularityJoiner ( ) { " use strict " ; var a = { } , b = Array . prototype . forEach , c = Object . keys , d = Array . isArray , e = Object . prototype . toString , f = Array . prototype . indexOf , g = Array . prototype . map , h = Array . prototype . some , i = { isArray : d | | function ( a ) { return " [ object Array ] " = = = e . call ( a ) } , isFunction : function ( a ) { return " function " = = typeof a } , isString : function ( a ) { return " [ object String ] " = = = e . call ( a ) } , each : function ( c , d , e ) { if ( null ! = = c & & void 0 ! = = c ) { var f , g , h ; if ( b & & c . forEach = = = b ) c . forEach ( d , e ) ; else if ( c . length = = = + c . length ) { for ( f = 0 , g = c . length ; f < g ; f + + ) if ( d . call ( e , c [ f ] , f , c ) = = = a ) return } else for ( h in c ) if ( c . hasOwnProperty ( h ) & & d . call ( e , c [ h ] , h , c ) = = = a ) return } } , keys : c | | function ( a ) { if ( " object " ! = typeof a | | Array . isArray ( a ) ) throw new TypeError ( " Invalid object " ) ; var b , c = [ ] ; for ( b in a ) a . hasOwnProperty ( b ) & & ( c [ c . length ] = b ) ; return c } , min : function ( a , b , c ) { if ( ! b & & i . isArray ( a ) & & a [ 0 ] = = = + a [ 0 ] & & a . length < 65535 ) return Math . min . apply ( Math , a ) ; if ( ! b & & i . isEmpty ( a ) ) return 1 / 0 ; var d = { computed : 1 / 0 , value : 1 / 0 } ; return i . each ( a , function ( a , e , f ) { var g = b ? b . call ( c , a , e , f ) : a ; g < d . computed & & ( d = { value : a , computed : g } ) } ) , d . value } , map : function ( a , b , c ) { var d = [ ] ; return null = = = a ? d : g & & a . map = = = g ? a . map ( b , c ) : ( i . each ( a , function ( a , e , f ) { d [ d . length ] = b . call ( c , a , e , f ) } ) , d ) } , pluck : function ( a , b ) { return i . map ( a , function ( a ) { return a [ b ] } ) } , uniq : function ( a , b , c , d ) { i . isFunction ( b ) & & ( d = c , c = b , b = ! 1 ) ; var e = c ? i . map ( a , c , d ) : a , f = [ ] , g = [ ] ; return i . each ( e , function ( c , d ) { b ? d & & g [ g . length - 1 ] = = = c | | ( g . push ( c ) , f . push ( a [ d ] ) ) : i . contains ( g , c ) | | ( g . push ( c ) , f . push ( a [ d ] ) ) } ) , f } , union : function ( ) { return i . uniq ( Array . prototype . concat . apply ( Array . prototype , arguments ) ) } , isEmpty : function ( a ) { var b ; if ( null = = = a ) return ! 0 ; if ( i . isArray ( a ) | | i . isString ( a ) ) return 0 = = = a . length ; for ( b in a ) if ( a . hasOwnProperty ( b ) ) return ! 1 ; return ! 0 } , any : function ( b , c , d ) { c = c | | i . identity ; var e = ! 1 ; return null = = = b ? e : h & & b . some = = = h ? b . some ( c , d ) : ( i . each ( b , function ( b , f , g ) { return e ? a : ( e = c . call ( d , b , f , g ) , a ) } ) , ! ! e ) } , contains : function ( a , b ) { return null ! = = a & & ( f & & a . indexOf = = = f ? a . indexOf ( b ) ! = = - 1 : i . any ( a , function ( a ) { return a = = = b } ) ) } , values : function ( a ) { var b , c = [ ] ; for ( b in a ) a . hasOwnProperty ( b ) & & c . push ( a [ b ] ) ; return c } } , j = { } , k = { } , l = { } , m = 0 , n = 0 , o = null , p = null , q = null , r = { } , s = function ( a ) { var b , c = Number . NEGATIVE_INFINITY ; return i . each ( p [ a ] , function ( a , d ) { c < a & & ( c = a , b = d ) } ) , c < 0 ? void delete q [ a ] : void ( q [ a ] = b ) } , t = function ( a , b ) { s ( b ) } , u = function ( a , b ) { return a < b ? p [ a ] & & p [ a ] [ b ] : p [ b ] & & p [ b ] [ a ] } , v = function ( a , b ) { return a < b ? p [ a ] [ b ] : p [ b ] [ a ] } , w = function ( a , b , c ) { return a < b ? ( p [ a ] = p [ a ] | | { } , void ( p [ a ] [ b ] = c ) ) : ( p [ b ] = p [ b ] | | { } , void ( p [ b ] [ a ] = c ) ) } , x = function ( a , b ) { if ( a < b ) { if ( ! p [ a ] ) return ; return delete p [ a ] [ b ] , void ( i . isEmpty ( p [ a ] ) & & delete p [ a ] ) } a ! = = b & & x ( b , a ) } , y = function ( a , b ) { var c , d ; return a < b ? u ( a , b ) ? ( d = v ( a , b ) , q [ a ] = = = b ? void s ( a ) : u ( a , q [ a ] ) ? ( c = v ( a , q [ a ] ) , void ( c < d & & ( q [ a ] = b ) ) ) : void s ( a ) ) : void s ( a ) : void ( a ! = = b & & y ( b , a ) ) } , z = function ( a , b ) { o [ a ] . _in + = o [ b ] . _in , o [ a ] . _out + = o [ b ] . _out , delete o [ b ] } , A = function ( a , b ) { j [ a ] = j [ a ] | | { } , j [ a ] [ b ] = ( j [ a ] [ b ] | | 0 ) + 1 , k [ b ] = k [ b ] | | { } , k [ b ] [ a ] = ( k [ b ] [ a ] | | 0 ) + 1 , l [ a ] = l [ a ] | | { _in : 0 , _out : 0 } , l [ b ] = l [ b ] | | { _in : 0 , _out : 0 } , l [ a ] . _out + + , l [ b ] . _in + + , m + + , n = Math . pow ( m , - 1 ) } , B = function ( a , b ) { j [ a ] & & ( j [ a ] [ b ] - - , 0 = = = j [ a ] [ b ] & & delete j [ a ] [ b ] , k [ b ] [ a ] - - , 0 = = = k [ b ] [ a ] & & delete k [ b ] [ a ] , l [ a ] . _out - - , l [ b ] . _in - - , m - - , n = m > 0 ? Math . pow ( m , - 1 ) : 0 , i . isEmpty ( j [ a ] ) & & delete j [ a ] , i . isEmpty ( k [ b ] ) & & delete k [ b ] , 0 = = = l [ a ] . _in & & 0 = = = l [ a ] . _out & & delete l [ a ] , 0 = = = l [ b ] . _in & & 0 = = = l [ b ] . _out & & delete l [ b ] ) } , C = function ( ) { return o = { } , i . each ( l , function ( a , b ) { o [ b ] = { _in : a . _in / m , _out : a . _out / m } } ) , o } , D = function ( a , b ) { return o [ a ] . _out * o [ b ] . _in + o [ a ] . _in * o [ b ] . _out } , E = function ( a ) { var b = i . keys ( j [ a ] | | { } ) , c = i . keys ( k [ a ] | | { } ) ; return i . union ( b , c ) } , F = function ( ) { p = { } , i . each ( j , function ( a , b ) { var c = k [ b ] | | { } , d = E ( b ) ; i . each ( d , function ( d ) { var e , f = a [ d ] | | 0 ; f + = c [ d ] | | 0 , e = f * n - D ( b , d ) , e > 0 & & w ( b , d , e ) } ) } ) } , G = function ( ) { return q = { } , i . each ( p , t ) , q } , H = function ( a , b , c ) { var d ; return u ( c , a ) ? ( d = v ( c , a ) , u ( c , b ) ? ( d + = v ( c , b ) , w ( c , a , d ) , x ( c , b ) , y ( c , a ) , void y ( c , b ) ) : ( d - = D ( c , b ) , d < 0 & & x ( c , a ) , void y ( c , a ) ) ) : void ( u ( c , b ) & & ( d = v ( c , b ) , d - = D ( c , a ) , d > 0 & & w ( c , a , d ) , y ( c , a ) , x ( c , b ) , y ( c , b ) ) ) } , I = function ( a , b ) { i . each ( p , function ( c , d ) { return d = = = a | | d = = = b ? void i . each ( c , function ( c , d ) { return d = = = b ? ( x ( a , b ) , void y ( a , b ) ) : void H ( a , b , d ) } ) : void H ( a , b , d ) } ) } , J = function ( ) { return j } , K = function ( ) { return q } , L = function ( ) { return p } , M = function ( ) { return o } , N = function ( ) { return r } , O = function ( ) { var a , b , c = Number . NEGATIVE_INFINITY ; return i . each ( q , function ( d , e ) { c < p [ e ] [ d ] & & ( a = d , b = e , c = p [ e ] [ d ] ) } ) , c < = 0 ? null : { sID : b , lID : a , val : c } } , P = function ( a ) { var b , c = Number . NEGATIVE_INFINITY ; return i . each ( a , function ( a ) { a . q > c & & ( c = a . q , b = a . nodes ) } ) , b } , Q = function ( ) { C ( ) , F ( ) , G ( ) , r = { } } , R = function ( a ) { var b = a . sID , c = a . lID , d = a . val ; r [ b ] = r [ b ] | | { nodes : [ b ] , q : 0 } , r [ c ] ? ( r [ b ] . nodes = r [ b ] . nodes . concat ( r [ c ] . nodes ) , r [ b ] . q + = r [ c ] . q , delete r [ c ] ) : r [ b ] . nodes . push ( c ) , r [ b ] . q + = d , I ( b , c ) , z ( b , c ) } , S = function ( a , b , c ) { if ( 0 = = = c . length ) return ! 0 ; var d = [ ] ; return i . each ( c , function ( c ) { a [ c ] = = = Number . POSITIVE_INFINITY & & ( a [ c ] = b , d = d . concat ( E ( c ) ) ) } ) , S ( a , b + 1 , d ) } , T = function ( a ) { var b = { } ; if ( i . each ( j , function ( a , c ) { b [ c ] = Number . POSITIVE_INFINITY } ) , b [ a ] = 0 , S ( b , 1 , E ( a ) ) ) return b ; throw " FAIL ! " } , U = function ( a ) { return function ( b ) { return a [ b ] } } , V = function ( a , b ) { var c , d = { } , e = [ ] , f = { } , g = function ( a , b ) { var c = f [ i . min ( a , U ( f ) ) ] , e = f [ i . min ( b , U ( f ) ) ] , g = e - c ; return 0 = = = g & & ( g = d [ b [ b . length - 1 ] ] . q - d [ a [ a . length - 1 ] ] . q ) , g } ; for ( Q ( ) , c = O ( ) ; null ! = = c ; ) R ( c ) , c = O ( ) ; return d = N ( ) , void 0 ! = = b ? ( i . each ( d , function ( a , c ) { i . contains ( a . nodes , b ) & & delete d [ c ] } ) , e = i . pluck ( i . values ( d ) , " nodes " ) , f = T ( b ) , e . sort ( g ) , e [ 0 ] ) : P ( d ) } ; this . insertEdge = A , this . deleteEdge = B , this . getAdjacencyMatrix = J , this . getHeap = K , this . getDQ = L , this . getDegrees = M , this . getCommunities = N , this . getBest = O , this . setup = Q , this . joinCommunity = R , this . getCommunity = V } function NodeReducer ( a ) { " use strict " ; a = a | | [ ] ; var b = function ( a , b ) { a . push ( b ) } , c = function ( a , b ) { if ( ! a . reason . example ) return a . reason . example = b , 1 ; var c = b . _data | | { } , d = a . reason . example . _data | | { } , e = _ . union ( _ . keys ( d ) , _ . keys ( c ) ) , f = 0 , g = 0 ; return _ . each ( e , function ( a ) { void 0 ! = = d [ a ] & & void 0 ! = = c [ a ] & & ( f + + , d [ a ] = = = c [ a ] & & ( f + = 4 ) ) } ) , g = 5 * e . length , g + + , f + + , f / g } , d = function ( ) { return a } , e = function ( b ) { a = b } , f = function ( b , c ) { var d = { } , e = [ ] ; return _ . each ( b , function ( b ) { var c , e , f = b . _data , g = 0 ; for ( g = 0 ; g < a . length ; g + + ) if ( c = a [ g ] , void 0 ! = = f [ c ] ) return e = f [ c ] , d [ c ] = d [ c ] | | { } , d [ c ] [ e ] = d [ c ] [ e ] | | [ ] , void d [ c ] [ e ] . push ( b ) ; e = " default " , d [ e ] = d [ e ] | | [ ] , d [ e ] . push ( b ) } ) , _ . each ( d , function ( a , b ) { _ . each ( a , function ( a , c ) { var d = { key : b , value : c , text : b + " : " + c } ; e . push ( { reason : d , nodes : a } ) } ) } ) , e } , g = function ( d , e ) { var g = [ ] , h = . 5 ; return d . length < = e ? g = _ . map ( d , function ( a ) { return { reason : { type : " single " , text : " One Node " } , nodes : [ a ] } } ) : _ . isEmpty ( a ) ? ( _ . each ( d , function ( a ) { var d , f , i ; for ( f = 0 , i = Number . POSITIVE_INFINITY , d = 0 ; d < e ; d + + ) { if ( g [ d ] = g [ d ] | | { reason : { type : " similar " , text : " Similar Nodes " } , nodes : [ ] } , c ( g [ d ] , a ) > h ) return void b ( g [ d ] . nodes , a ) ; i > g [ d ] . nodes . length & & ( f = d , i = g [ d ] . nodes . length ) } b ( g [ f ] . nodes , a ) } ) , g ) : f ( d , e ) } ; this . bucketNodes = g , this . changePrioList = e , this . getPrioList = d } function NodeShaper ( a , b , c ) { " use strict " ; var d , e , f = this , g = [ ] , h = ! 0 , i = new ContextMenu ( " gv_node_cm " ) , j = function ( a , b ) { return _ . isArray ( a ) ? b [ _ . find ( a , function ( a ) { return b [ a ] } ) ] : b [ a ] } , k = function ( a ) { if ( void 0 = = = a ) return [ " " ] ; " string " ! = typeof a & & ( a = String ( a ) ) ; var b = a . match ( / [ \ w \ W ] { 1 , 10 } ( \ s | $ ) | \ S + ? ( \ s | $ ) / g ) ; return b [ 0 ] = $ . trim ( b [ 0 ] ) , b [ 1 ] = $ . trim ( b [ 1 ] ) , b [ 0 ] . length > 12 & & ( b [ 0 ] = $ . trim ( a . substring ( 0 , 10 ) ) , b [ 1 ] = $ . trim ( a . substring ( 10 ) ) , b [ 1 ] . length > 12 & & ( b [ 1 ] = b [ 1 ] . split ( / \ W / ) [ 0 ] , b [ 1 ] . length > 2 & & ( b [ 1 ] = b [ 1 ] . substring ( 0 , 5 ) + " . . . " ) ) , b . length = 2 ) , b . length > 2 & & ( b . length = 2 , b [ 1 ] + = " . . . " ) , b } , l = function ( a ) { } , m = l , n = function ( a ) { return { x : a . x , y : a . y , z : 1 } } , o = n , p = function ( ) { _ . each ( g , function ( a ) { a . position = o ( a ) , a . _isCommunity & & a . addDistortion ( o ) } ) } , q = new ColourMapper , r = function ( ) { q . reset ( ) } , s = function ( a ) { return a . _id } , t = l , u = l , v = l , w = function ( ) { return " black " } , x = function ( ) { f . parent . selectAll ( " . node " ) . on ( " mousedown . drag " , null ) , d = { click : l , dblclick : l , drag : l , mousedown : l , mouseup : l , mousemove : l , mouseout : l , mouseover : l } , e = l } , y = function ( a ) { _ . each ( d , function ( b , c ) { " drag " = = = c ? a . call ( b ) : a . on ( c , b ) } ) } , z = function ( a ) { var b = a . filter ( function ( a ) { return a . _isCommunity } ) , c = a . filter ( function ( a ) { return ! a . _isCommunity } ) ; u ( c ) , b . each ( function ( a ) { a . shapeNodes ( d3 . select ( this ) , u , z , m , q ) } ) , h & & v ( c ) , t ( c ) , y ( c ) , p ( ) } , A = function ( a , b ) { if ( " update " = = = a ) e = b ; else { if ( void 0 = = = d [ a ] ) throw " Sorry Unknown Event " + a + " cannot be bound . " ; d [ a ] = b } } , B = function ( ) { var a = f . parent . selectAll ( " . node " ) ; p ( ) , a . attr ( " transform " , function ( a ) { return " translate ( " + a . position . x + " , " + a . position . y + " ) scale ( " + a . position . z + " ) " } ) , e ( a ) } , C = function ( a ) { void 0 ! = = a & & ( g = a ) ; var b = f . parent . selectAll ( " . node " ) . data ( g , s ) ; b . enter ( ) . append ( " g " ) . attr ( " class " , function ( a ) { return a . _isCommunity ? " node communitynode " : " node " } ) . attr ( " id " , s ) , b . exit ( ) . remove ( ) , b . selectAll ( " * > * " ) . remove ( ) , z ( b ) , B ( ) , i . bindMenu ( $ ( " . node " ) ) } , D = function ( a ) { var b , c , d , e , f , g , h ; switch ( a . type ) { case NodeShaper . shapes . NONE : u = l ; break ; case NodeShaper . shapes . CIRCLE : b = a . radius | | 25 , u = function ( a , c ) { a . append ( " circle " ) . attr ( " r " , b ) , c & & a . attr ( " cx " , - c ) . attr ( " cy " , - c ) } ; break ; case NodeShaper . shapes . RECT : c = a . width | | 90 , d = a . height | | 36 , e = _ . isFunction ( c ) ? function ( a ) { return - ( c ( a ) / 2 ) } : function ( a ) { return - ( c / 2 ) } , f = _ . isFunction ( d ) ? function ( a ) { return - ( d ( a ) / 2 ) } : function ( ) { return - ( d / 2 ) } , u = function ( a , b ) { b = b | | 0 , a . append ( " rect " ) . attr ( " width " , c ) . attr ( " height " , d ) . attr ( " x " , function ( a ) { return e ( a ) - b } ) . attr ( " y " , function ( a ) { return f ( a ) - b } ) . attr ( " rx " , " 8 " ) . attr ( " ry " , " 8 " ) } ; break ; case NodeShaper . shapes . IMAGE : c = a . width | | 32 , d = a . height | | 32 , g = a . fallback | | " " , h = a . source | | g , e = _ . isFunction ( c ) ? function ( a ) { return - ( c ( a ) / 2 ) } : - ( c / 2 ) , f = _ . isFunction ( d ) ? function ( a ) { return - ( d ( a ) / 2 ) } : - ( d / 2 ) , u = function ( a ) { var b = a . append ( " image " ) . attr ( " width " , c ) . attr ( " height " , d ) . attr ( " x " , e ) . attr ( " y " , f ) ; _ . isFunction ( h ) ? b . attr ( " xlink : href " , h ) : b . attr ( " xlink : href " , function ( a ) { return a . _data [ h ] ? a . _data [ h ] : g } ) } ; break ; case void 0 : break ; default : throw " Sorry given Shape not known ! " } } , E = function ( a ) { var b = [ ] ; _ . each ( a , function ( a ) { b = $ ( a ) . find ( " text " ) , $ ( a ) . css ( " width " , " 90px " ) , $ ( a ) . css ( " height " , " 36px " ) , $ ( a ) . textfill ( { innerTag : " text " , maxFontPixels : 16 , minFontPixels : 10 , explicitWidth : 90 , explicitHeight : 36 } ) } ) } , F = function ( a ) { v = _ . isFunction ( a ) ? function ( b ) { var c = b . append ( " text " ) . attr ( " text - anchor " , " middle " ) . attr ( " fill " , w ) . attr ( " stroke " , " none " ) ; c . each ( function ( b ) { var c = k ( a ( b ) ) , d = c [ 0 ] ; 2 = = = c . length & & ( d + = c [ 1 ] ) , d . length > 15 & & ( d = d . substring ( 0 , 13 ) + " . . . " ) , void 0 ! = = d & & " " ! = = d | | ( d = " ATTR NOT SET " ) , d3 . select ( this ) . append ( " tspan " ) . attr ( " x " , " 0 " ) . attr ( " dy " , " 5 " ) . text ( d ) } ) , E ( b ) } : function ( b ) { var c = b . append ( " text " ) . attr ( " text - anchor " , " middle " ) . attr ( " fill " , w ) . attr ( " stroke " , " none " ) ; c . each ( function ( b ) { var c = k ( j ( a , b . _data ) ) , d = c [ 0 ] ; 2 = = = c . length & & ( d + = c [ 1 ] ) , d . length > 15 & & ( d = d . substring ( 0 , 13 ) + " . . . " ) , void 0 ! = = d & & " " ! = = d | | ( d = " ATTR NOT SET " ) , d3 . select ( this ) . append ( " tspan " ) . attr ( " x " , " 0 " ) . attr ( " dy " , " 5 " ) . text ( d ) } ) , E ( b ) } } , G = function ( a ) { void 0 ! = = a . reset & & a . reset & & x ( ) , _ . each ( a , function ( a , b ) { " reset " ! = = b & & A ( b , a ) } ) } , H = function ( a ) { switch ( r ( ) , a . type ) { case " single " : t = function ( b ) { b . attr ( " fill " , a . fill ) } , w = function ( b ) { return a . stroke } ; break ; case " expand " : t = function ( b ) { b . attr ( " fill " , function ( b ) { return b . _expanded ? a . expanded : a . collapsed } ) } , w = function ( a ) { return " white " } ; break ; case " attribute " : t = function ( b ) { b . attr ( " fill " , function ( b ) { return void 0 = = = b . _data ? q . getCommunityColour ( ) : q . getColour ( j ( a . key , b . _data ) ) } ) . attr ( " stroke " , function ( a ) { return a . _expanded ? " # fff " : " transparent " } ) . attr ( " fill - opacity " , function ( a ) { return a . _expanded ? " 1 " : " 0 . 3 " } ) } , w = function ( b ) { return void 0 = = = b . _data ? q . getForegroundCommunityColour ( ) : q . getForegroundColour ( j ( a . key , b . _data ) ) } ; break ; default : throw " Sorry given colour - scheme not known " } } , I = function ( a ) { if ( " reset " = = = a ) o = n ; else { if ( ! _ . isFunction ( a ) ) throw " Sorry distortion cannot be parsed . " ; o = a } } , J = function ( a ) { void 0 ! = = a . shape & & D ( a . shape ) , void 0 ! = = a . label & & ( F ( a . label ) , f . label = a . label ) , void 0 ! = = a . actions & & G ( a . actions ) , void 0 ! = = a . color & & ( H ( a . color ) , f . color = a . color ) , void 0 ! = = a . distortion & & I ( a . distortion ) } ; f . parent = a , x ( ) , void 0 = = = b & & ( b = { } ) , void 0 = = = b . shape & & ( b . shape = { type : NodeShaper . shapes . RECT } ) , void 0 = = = b . color & & ( b . color = { type : " single " , fill : " # 333333 " , stroke : " white " } ) , void 0 = = = b . distortion & & ( b . distortion = " reset " ) , J ( b ) , _ . isFunction ( c ) & & ( s = c ) , f . changeTo = function ( a ) { J ( a ) , C ( ) } , f . drawNodes = function ( a ) { C ( a ) } , f . updateNodes = function ( ) { B ( ) } , f . reshapeNodes = function ( ) { C ( ) } , f . activateLabel = function ( a ) { h = ! ! a , C ( ) } , f . getColourMapping = function ( ) { return q . getList ( ) } , f . setColourMappingListener = function ( a ) { q . setChangeListener ( a ) } , f . setGVStartFunction = function ( a ) { m = a } , f . getLabel = function ( ) { return f . label | | " " } , f . getColor = function ( ) { return f . color . key | | " " } , f . addMenuEntry = function ( a , b ) { i . addEntry ( a , b ) } , f . resetColourMap = r } function PreviewAdapter ( a , b , c , d ) { " use strict " ; if ( void 0 = = = a ) throw " The nodes have to be given . " ; if ( void 0 = = = b ) throw " The edges have to be given . " ; if ( void 0 = = = c ) throw " A reference to the graph viewer has to be given . " ; var e = this , f = new AbstractAdapter ( a , b , this , c ) , g = function ( a ) { void 0 ! = = a . width & & f . setWidth ( a . width ) , void 0 ! = = a . height & & f . setHeight ( a . height ) } , h = function ( a , b ) { var c = { } , d = a . first ; d = f . insertNode ( d ) , _ . each ( a . nodes , function ( a ) { a = f . insertNode ( a ) , c [ a . _id ] = a } ) , _ . each ( a . edges , function ( a ) { f . insertEdge ( a ) } ) , delete c [ d . _id ] , void 0 ! = = b & & _ . isFunction ( b ) & & b ( d ) } ; d = d | | { } , g ( d ) , e . loadInitialNode = function ( a , b ) { f . cleanUp ( ) ; var c = function ( a ) { b ( f . insertInitialNode ( a ) ) } ; e . loadNode ( a , c ) } , e . loadNode = function ( a , b ) { var c = [ ] , d = [ ] , e = { } , f = { _id : 1 , label : " Node 1 " , image : " img / stored . png " } , g = { _id : 2 , label : " Node 2 " } , i = { _id : 3 , label : " Node 3 " } , j = { _id : 4 , label : " Node 4 " } , k = { _id : 5 , label : " Node 5 " } , l = { _id : " 1 - 2 " , _from : 1 , _to : 2 , label : " Edge 1 " } , m = { _id : " 1 - 3 " , _from : 1 , _to : 3 , label : " Edge 2 " } , n = { _id : " 1 - 4 " , _from : 1 , _to : 4 , label : " Edge 3 " } , o = { _id : " 1 - 5 " , _from : 1 , _to : 5 , label : " Edge 4 " } , p = { _id : " 2 - 3 " , _from : 2 , _to : 3 , label : " Edge 5 " } ; c . push ( f ) , c . push ( g ) , c . push ( i ) , c . push ( j ) , c . push ( k ) , d . push ( l ) , d . push ( m ) , d . push ( n ) , d . push ( o ) , d . push ( p ) , e . first = f , e . nodes = c , e . edges = d , h ( e , b ) } , e . explore = f . explore , e . requestCentralityChildren = function ( a , b ) { } , e . createEdge = function ( a , b ) { arangoHelper . arangoError ( " Server - side " , " createEdge was triggered . " ) } , e . deleteEdge = function ( a , b ) { arangoHelper . arangoError ( " Server - side " , " deleteEdge was triggered . " ) } , e . patchEdge = function ( a , b , c ) { arangoHelper . arangoError ( " Server - side " , " patchEdge was triggered . " ) } , e . createNode = function ( a , b ) { arangoHelper . arangoError ( " Server - side " , " createNode was triggered . " ) } , e . deleteNode = function ( a , b ) { arangoHelper . arangoError ( " Server - side " , " deleteNode was triggered . " ) , arangoHelper . arangoError ( " Server - side " , " onNodeDelete was triggered . " ) } , e . patchNode = function ( a , b , c ) { arangoHelper . arangoError ( " Server - side " , " patchNode was triggered . " ) } , e . setNodeLimit = function ( a , b ) { f . setNodeLimit ( a , b ) } , e . setChildLimit = function ( a ) { f . setChildLimit ( a ) } , e . setWidth = f . setWidth , e . expandCommunity = function ( a , b ) { f . expandCommunity ( a ) , void 0 ! = = b & & b ( ) } } function WebWorkerWrapper ( a , b ) { " use strict " ; if ( void 0 = = = a ) throw " A class has to be given . " ; if ( void 0 = = = b ) throw " A callback has to be given . " ; var c , d = Array . prototype . slice . call ( arguments ) , e = { } , f = function ( ) { var c , d = function ( a ) { switch ( a . data . cmd ) { case " construct " : try { w = new ( Function . prototype . bind . apply ( Construct , [ null ] . concat ( a . data . args ) ) ) , w ? self . postMessage ( { cmd : " construct " , result : ! 0 } ) : self . postMessage ( { cmd : " construct " , result : ! 1 } ) } catch ( b ) { self . postMessage ( { cmd : " construct " , result : ! 1 , error : b . message | | b } ) } break ; default : var c , d = { cmd : a . data . cmd } ; if ( w & & " function " = = typeof w [ a . data . cmd ] ) try { c = w [ a . data . cmd ] . apply ( w , a . data . args ) , c & & ( d . result = c ) , self . postMessage ( d ) } catch ( e ) { d . error = e . message | | e , self . postMessage ( d ) } else d . error = " Method not known " , self . postMessage ( d ) } } , e = function ( a ) { var b = " var w , Construct = " + a . toString ( ) + " ; self . onmessage = " + d . toString ( ) ; return new window . Blob ( b . split ( ) ) } , f = window . URL , g = new e ( a ) ; return c = new window . Worker ( f . createObjectURL ( g ) ) , c . onmessage = b , c } , g = function ( ) { return a . apply ( this , d ) } ; try { return c = f ( ) , e . call = function ( a ) { var b = Array . prototype . slice . call ( arguments ) ; b . shift ( ) , c . postMessage ( { cmd : a , args : b } ) } , d . shift ( ) , d . shift ( ) , d . unshift ( " construct " ) , e . call . apply ( this , d ) , e } catch ( h ) { d . shift ( ) , d . shift ( ) , g . prototype = a . prototype ; try { c = new g } catch ( i ) { return void b ( { data : { cmd : " construct " , error : i } } ) } return e . call = function ( a ) { var d = Array . prototype . slice . call ( arguments ) , e = { data : { cmd : a } } ; if ( ! _ . isFunction ( c [ a ] ) ) return e . data . error = " Method not known " , void b ( e ) ; d . shift ( ) ; try { e . data . result = c [ a ] . apply ( c , d ) , b ( e ) } catch ( f ) { e . data . error = f , b ( e ) } } , b ( { data : { cmd : " construct " , result : ! 0 } } ) , e } } function ZoomManager ( a , b , c , d , e , f , g , h ) { " use strict " ; if ( void 0 = = = a | | a < 0 ) throw " A width has to be given . " ; if ( void 0 = = = b | | b < 0 ) throw " A height has to be given . " ; if ( void 0 = = = c | | void 0 = = = c . node | | " svg " ! = = c . node ( ) . tagName . toLowerCase ( ) ) throw " A svg has to be given . " ; if ( void 0 = = = d | | void 0 = = = d . node | | " g " ! = = d . node ( ) . tagName . toLowerCase ( ) ) throw " A group has to be given . " ; if ( void 0 = = = e | | void 0 = = = e . activateLabel | | void 0 = = = e . changeTo | | void 0 = = = e . updateNodes ) throw " The Node shaper has to be given . " ; if ( void 0 = = = f | | void 0 = = = f . activateLabel | | void 0 = = = f . updateEdges ) throw " The Edge shaper has to be given . " ; var i , j , k , l , m , n , o , p , q , r , s , t , u , v , w , x = this , y = a * b , z = h | | function ( ) { } , A = function ( ) { var a , b ; return l > = k ? ( b = i * l , b * = b , a = 60 * b ) : ( b = j * l , b * = b , a = 4 * Math . PI * b ) , Math . floor ( y / a ) } , B = function ( ) { q = s / l - . 99999999 , r = t / l , p . distortion ( q ) , p . radius ( r ) } , C = function ( a , b , c , g ) { g ? null ! = = a & & ( l = a ) : l = a , null ! = = b & & ( m [ 0 ] + = b ) , null ! = = c & & ( m [ 1 ] + = c ) , o = A ( ) , z ( o ) , e . activateLabel ( l > = k ) , f . activateLabel ( l > = k ) , B ( ) ; var h = " translate ( " + m + " ) " , i = " scale ( " + l + " ) " ; d . _isCommunity ? d . attr ( " transform " , h ) : d . attr ( " transform " , h + i ) , v & & v . slider ( " option " , " value " , l ) } , D = function ( a ) { var b = [ ] ; return b [ 0 ] = a [ 0 ] - n [ 0 ] , b [ 1 ] = a [ 1 ] - n [ 1 ] , n [ 0 ] = a [ 0 ] , n [ 1 ] = a [ 1 ] , b } , E = function ( a ) { void 0 = = = a & & ( a = { } ) ; var b = a . maxFont | | 16 , c = a . minFont | | 6 , d = a . maxRadius | | 25 , e = a . minRadius | | 4 ; s = a . focusZoom | | 1 , t = a . focusRadius | | 100 , w = e / d , i = b , j = d , k = c / b , l = 1 , m = [ 0 , 0 ] , n = [ 0 , 0 ] , B ( ) , o = A ( ) , u = d3 . behavior . zoom ( ) . scaleExtent ( [ w , 1 ] ) . on ( " zoom " , function ( ) { var a , b = d3 . event . sourceEvent , c = l ; " mousewheel " = = = b . type | | " DOMMouseScroll " = = = b . type ? ( b . wheelDelta ? b . wheelDelta > 0 ? ( c + = . 01 , c > 1 & & ( c = 1 ) ) : ( c - = . 01 , c < w & & ( c = w ) ) : b . detail > 0 ? ( c + = . 01 , c > 1 & & ( c = 1 ) ) : ( c - = . 01 , c < w & & ( c = w ) ) , a = [ 0 , 0 ] ) : a = D ( d3 . event . translate ) , C ( c , a [ 0 ] , a [ 1 ] ) } ) } , F = function ( ) { } ; p = d3 . fisheye . circular ( ) , E ( g ) , c . call ( u ) , e . changeTo ( { distortion : p } ) , c . on ( " mousemove " , F ) , x . translation = function ( ) { return null } , x . scaleFactor = function ( ) { return l } , x . scaledMouse = function ( ) { return null } , x . getDistortion = function ( ) { return q } , x . getDistortionRadius = function ( ) { return r } , x . getNodeLimit = function ( ) { return o } , x . getMinimalZoomFactor = function ( ) { return w } , x . registerSlider = function ( a ) { v = a } , x . triggerScale = function ( a ) { C ( a , null , null , ! 0 ) } , x . triggerTranslation = function ( a , b ) { C ( null , a , b , ! 0 ) } , x . changeWidth = function ( c ) { y = a * b } } function ArangoAdapterControls ( a , b ) { " use strict " ; if ( void 0 = = = a ) throw " A list element has to be given . " ; if ( void 0 = = = b ) throw " The ArangoAdapter has to be given . " ; this . addControlChangeCollections = function ( c ) { var d = " control_adapter_collections " , e = d + " _ " ; b . getCollections ( function ( f , g ) { b . getGraphs ( function ( h ) { uiComponentsHelper . createButton ( a , " Collections " , d , function ( ) { modalDialogHelper . createModalDialog ( " Switch Collections " , e , [ { <nl> + type : " decission " , id : " collections " , group : " loadtype " , text : " Select existing collections " , isDefault : void 0 = = = b . getGraphName ( ) , interior : [ { type : " list " , id : " node_collection " , text : " Vertex collection " , objects : f , selected : b . getNodeCollection ( ) } , { type : " list " , id : " edge_collection " , text : " Edge collection " , objects : g , selected : b . getEdgeCollection ( ) } ] } , { type : " decission " , id : " graphs " , group : " loadtype " , text : " Select existing graph " , isDefault : void 0 ! = = b . getGraphName ( ) , interior : [ { type : " list " , id : " graph " , objects : h , selected : b . getGraphName ( ) } ] } , { type : " checkbox " , text : " Start with random vertex " , id : " random " , selected : ! 0 } , { type : " checkbox " , id : " undirected " , selected : " any " = = = b . getDirection ( ) } ] , function ( ) { var a = $ ( " # " + e + " node_collection " ) . children ( " option " ) . filter ( " : selected " ) . text ( ) , d = $ ( " # " + e + " edge_collection " ) . children ( " option " ) . filter ( " : selected " ) . text ( ) , f = $ ( " # " + e + " graph " ) . children ( " option " ) . filter ( " : selected " ) . text ( ) , g = ! ! $ ( " # " + e + " undirected " ) . prop ( " checked " ) , h = ! ! $ ( " # " + e + " random " ) . prop ( " checked " ) , i = $ ( " input [ type = ' radio ' ] [ name = ' loadtype ' ] : checked " ) . prop ( " id " ) ; return i = = = e + " collections " ? b . changeToCollections ( a , d , g ) : b . changeToGraph ( f , g ) , h ? void b . loadRandomNode ( c ) : void ( _ . isFunction ( c ) & & c ( ) ) } ) } ) } ) } ) } , this . addControlChangePriority = function ( ) { var c = " control_adapter_priority " , d = c + " _ " , e = ( b . getPrioList ( ) , " Group vertices " ) ; uiComponentsHelper . createButton ( a , e , c , function ( ) { modalDialogHelper . createModalChangeDialog ( e , d , [ { type : " extendable " , id : " attribute " , objects : b . getPrioList ( ) } ] , function ( ) { var a = $ ( " input [ id ^ = " + d + " attribute_ ] " ) , c = [ ] ; a . each ( function ( a , b ) { var d = $ ( b ) . val ( ) ; " " ! = = d & & c . push ( d ) } ) , b . changeTo ( { prioList : c } ) } ) } ) } , this . addAll = function ( ) { this . addControlChangeCollections ( ) , this . addControlChangePriority ( ) } } function ContextMenu ( a ) { " use strict " ; if ( void 0 = = = a ) throw " An id has to be given . " ; var b , c , d = " # " + a , e = function ( a , d ) { var e , f ; e = document . createElement ( " div " ) , e . className = " context - menu - item " , f = document . createElement ( " div " ) , f . className = " context - menu - item - inner " , f . appendChild ( document . createTextNode ( a ) ) , f . onclick = function ( ) { d ( d3 . select ( c . target ) . data ( ) [ 0 ] ) } , e . appendChild ( f ) , b . appendChild ( e ) } , f = function ( a ) { c = $ . contextMenu . create ( d , { shadow : ! 1 } ) , a . each ( function ( ) { $ ( this ) . bind ( " contextmenu " , function ( a ) { return c . show ( this , a ) , ! 1 } ) } ) } , g = function ( ) { return b = document . getElementById ( a ) , b & & b . parentElement . removeChild ( b ) , b = document . createElement ( " div " ) , b . className = " context - menu context - menu - theme - osx " , b . id = a , document . body . appendChild ( b ) , b } ; g ( ) , this . addEntry = e , this . bindMenu = f } function EdgeShaperControls ( a , b ) { " use strict " ; if ( void 0 = = = a ) throw " A list element has to be given . " ; if ( void 0 = = = b ) throw " The EdgeShaper has to be given . " ; var c = this ; this . addControlOpticShapeNone = function ( ) { var c = " control_edge_none " ; uiComponentsHelper . createButton ( a , " None " , c , function ( ) { b . changeTo ( { shape : { type : EdgeShaper . shapes . NONE } } ) } ) } , this . addControlOpticShapeArrow = function ( ) { var c = " control_edge_arrow " ; uiComponentsHelper . createButton ( a , " Arrow " , c , function ( ) { b . changeTo ( { shape : { type : EdgeShaper . shapes . ARROW } } ) } ) } , this . addControlOpticLabel = function ( ) { var c = " control_edge_label " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Configure Label " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch Label Attribute " , d , [ { type : " text " , id : " key " , text : " Edge label attribute " , value : b . getLabel ( ) } ] , function ( ) { var a = $ ( " # " + d + " key " ) . attr ( " value " ) ; b . changeTo ( { label : a } ) } ) } ) } , this . addControlOpticLabelList = function ( ) { var d = " control_edge_label " , e = d + " _ " ; uiComponentsHelper . createButton ( a , " Configure Label " , d , function ( ) { modalDialogHelper . createModalDialog ( " Change Label Attribute " , e , [ { type : " extendable " , id : " label " , text : " Edge label attribute " , objects : b . getLabel ( ) } ] , function ( ) { var a = $ ( " input [ id ^ = " + e + " label_ ] " ) , d = [ ] ; a . each ( function ( a , b ) { var c = $ ( b ) . val ( ) ; " " ! = = c & & d . push ( c ) } ) ; var f = { label : d } ; c . applyLocalStorage ( f ) , b . changeTo ( f ) } ) } ) } , this . applyLocalStorage = function ( a ) { if ( " undefined " ! = = Storage ) try { var b = JSON . parse ( localStorage . getItem ( " graphSettings " ) ) , c = window . location . hash . split ( " / " ) [ 1 ] , d = window . location . pathname . split ( " / " ) [ 2 ] , e = c + d ; _ . each ( a , function ( a , c ) { void 0 ! = = c & & ( b [ e ] . viewer . hasOwnProperty ( " edgeShaper " ) | | ( b [ e ] . viewer . edgeShaper = { } ) , b [ e ] . viewer . edgeShaper [ c ] = a ) } ) , localStorage . setItem ( " graphSettings " , JSON . stringify ( b ) ) } catch ( f ) { console . log ( f ) } } , this . addControlOpticSingleColour = function ( ) { var c = " control_edge_singlecolour " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Single Colour " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch to Colour " , d , [ { type : " text " , id : " stroke " } ] , function ( ) { var a = $ ( " # " + d + " stroke " ) . attr ( " value " ) ; b . changeTo ( { color : { type : " single " , stroke : a } } ) } ) } ) } , this . addControlOpticAttributeColour = function ( ) { var c = " control_edge_attributecolour " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Colour by Attribute " , c , function ( ) { modalDialogHelper . createModalDialog ( " Display colour by attribute " , d , [ { type : " text " , id : " key " } ] , function ( ) { var a = $ ( " # " + d + " key " ) . attr ( " value " ) ; b . changeTo ( { color : { type : " attribute " , key : a } } ) } ) } ) } , this . addControlOpticGradientColour = function ( ) { var c = " control_edge_gradientcolour " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Gradient Colour " , c , function ( ) { modalDialogHelper . createModalDialog ( " Change colours for gradient " , d , [ { type : " text " , id : " source " } , { type : " text " , id : " target " } ] , function ( ) { var a = $ ( " # " + d + " source " ) . attr ( " value " ) , c = $ ( " # " + d + " target " ) . attr ( " value " ) ; b . changeTo ( { color : { type : " gradient " , source : a , target : c } } ) } ) } ) } , this . addAllOptics = function ( ) { c . addControlOpticShapeNone ( ) , c . addControlOpticShapeArrow ( ) , c . addControlOpticLabel ( ) , c . addControlOpticSingleColour ( ) , c . addControlOpticAttributeColour ( ) , c . addControlOpticGradientColour ( ) } , this . addAllActions = function ( ) { } , this . addAll = function ( ) { c . addAllOptics ( ) , c . addAllActions ( ) } } function EventDispatcherControls ( a , b , c , d , e ) { " use strict " ; if ( void 0 = = = a ) throw " A list element has to be given . " ; if ( void 0 = = = b ) throw " The NodeShaper has to be given . " ; if ( void 0 = = = c ) throw " The EdgeShaper has to be given . " ; if ( void 0 = = = d ) throw " The Start callback has to be given . " ; var f = this , g = { expand : { icon : " hand - pointer - o " , title : " Expand a node . " } , add : { icon : " plus - square " , title : " Add a node . " } , trash : { icon : " minus - square " , title : " Remove a node / edge . " } , drag : { icon : " hand - rock - o " , title : " Drag a node . " } , edge : { icon : " external - link - square " , title : " Create an edge between two nodes . " } , edit : { icon : " pencil - square " , title : " Edit attributes of a node . " } , view : { icon : " search " , title : " View attributes of a node . " } } , h = new EventDispatcher ( b , c , e ) , i = e . edgeEditor . adapter , j = ! ! i & & _ . isFunction ( i . useNodeCollection ) & & _ . isFunction ( i . useEdgeCollection ) , k = function ( b ) { a . appendChild ( b ) } , l = function ( a , b , c ) { var d = uiComponentsHelper . createIconButton ( a , " control_event_ " + b , c ) ; k ( d ) } , m = function ( a ) { h . rebind ( " nodes " , a ) } , n = function ( a ) { h . rebind ( " edges " , a ) } , o = function ( a ) { h . rebind ( " svg " , a ) } , p = function ( a ) { var b = a | | window . event , c = { } ; return c . x = b . clientX , c . y = b . clientY , c . x + = document . body . scrollLeft , c . y + = document . body . scrollTop , c } , q = function ( a ) { var b , c , d , e = p ( a ) , f = $ ( " svg # graphViewerSVG " ) . offset ( ) ; return b = d3 . select ( " svg # graphViewerSVG " ) . node ( ) , d = b . getBoundingClientRect ( ) , $ ( " svg # graphViewerSVG " ) . height ( ) < = d . height ? { x : e . x - f . left , y : e . y - f . top } : ( c = b . getBBox ( ) , { x : e . x - ( d . left - c . x ) , y : e . y - ( d . top - c . y ) } ) } , r = { nodes : { } , edges : { } , svg : { } } , s = function ( ) { var a = " control_event_new_node " , c = a + " _ " , e = function ( a ) { var e = q ( a ) ; modalDialogHelper . createModalCreateDialog ( " Create New Node " , c , { } , function ( a ) { h . events . CREATENODE ( a , function ( a ) { $ ( " # " + c + " modal " ) . modal ( " hide " ) , b . reshapeNodes ( ) , d ( ) } , e . x , e . y ) ( ) } ) } ; r . nodes . newNode = e } , t = function ( ) { var a = function ( a ) { modalDialogHelper . createModalViewDialog ( " View Node " + a . _id , " control_event_node_view_ " , a . _data , function ( ) { modalDialogHelper . createModalEditDialog ( " Edit Node " + a . _id , " control_event_node_edit_ " , a . _data , function ( b ) { h . events . PATCHNODE ( a , b , function ( ) { $ ( " # control_event_node_edit_modal " ) . modal ( " hide " ) } ) ( ) } ) } ) } , b = function ( a ) { modalDialogHelper . createModalViewDialog ( " View Edge " + a . _id , " control_event_edge_view_ " , a . _data , function ( ) { modalDialogHelper . createModalEditDialog ( " Edit Edge " + a . _id , " control_event_edge_edit_ " , a . _data , function ( b ) { h . events . PATCHEDGE ( a , b , function ( ) { $ ( " # control_event_edge_edit_modal " ) . modal ( " hide " ) } ) ( ) } ) } ) } ; r . nodes . view = a , r . edges . view = b } , u = function ( ) { var a = h . events . STARTCREATEEDGE ( function ( a , b ) { var d = q ( b ) , e = c . addAnEdgeFollowingTheCursor ( d . x , d . y ) ; h . bind ( " svg " , " mousemove " , function ( a ) { var b = q ( a ) ; e ( b . x , b . y ) } ) } ) , b = h . events . FINISHCREATEEDGE ( function ( a ) { c . removeCursorFollowingEdge ( ) , h . bind ( " svg " , " mousemove " , function ( ) { } ) , d ( ) } ) , e = function ( ) { h . events . CANCELCREATEEDGE ( ) , c . removeCursorFollowingEdge ( ) , h . bind ( " svg " , " mousemove " , function ( ) { } ) } ; r . nodes . startEdge = a , r . nodes . endEdge = b , r . svg . cancelEdge = e } , v = function ( ) { var a = function ( a ) { arangoHelper . openDocEditor ( a . _id , " document " ) } , b = function ( a ) { arangoHelper . openDocEditor ( a . _id , " edge " ) } ; r . nodes . edit = a , r . edges . edit = b } , w = function ( ) { var a = function ( a ) { modalDialogHelper . createModalDeleteDialog ( " Delete Node " + a . _id , " control_event_node_delete_ " , a , function ( a ) { h . events . DELETENODE ( function ( ) { $ ( " # control_event_node_delete_modal " ) . modal ( " hide " ) , b . reshapeNodes ( ) , c . reshapeEdges ( ) , d ( ) } ) ( a ) } ) } , e = function ( a ) { modalDialogHelper . createModalDeleteDialog ( " Delete Edge " + a . _id , " control_event_edge_delete_ " , a , function ( a ) { h . events . DELETEEDGE ( function ( ) { $ ( " # control_event_edge_delete_modal " ) . modal ( " hide " ) , b . reshapeNodes ( ) , c . reshapeEdges ( ) , d ( ) } ) ( a ) } ) } ; r . nodes . del = a , r . edges . del = e } , x = function ( ) { r . nodes . spot = h . events . EXPAND } ; s ( ) , t ( ) , u ( ) , v ( ) , w ( ) , x ( ) , this . dragRebinds = function ( ) { return { nodes : { drag : h . events . DRAG } } } , this . newNodeRebinds = function ( ) { return { svg : { click : r . nodes . newNode } } } , this . viewRebinds = function ( ) { return { nodes : { click : r . nodes . view } , edges : { click : r . edges . view } } } , this . connectNodesRebinds = function ( ) { return { nodes : { mousedown : r . nodes . startEdge , mouseup : r . nodes . endEdge } , svg : { mouseup : r . svg . cancelEdge } } } , this . editRebinds = function ( ) { return { nodes : { click : r . nodes . edit } , edges : { click : r . edges . edit } } } , this . expandRebinds = function ( ) { return { nodes : { click : r . nodes . spot } } } , this . deleteRebinds = function ( ) { return { nodes : { click : r . nodes . del } , edges : { click : r . edges . del } } } , this . rebindAll = function ( a ) { m ( a . nodes ) , n ( a . edges ) , o ( a . svg ) } , b . addMenuEntry ( " Edit " , r . nodes . edit ) , b . addMenuEntry ( " Spot " , r . nodes . spot ) , b . addMenuEntry ( " Trash " , r . nodes . del ) , c . addMenuEntry ( " Edit " , r . edges . edit ) , c . addMenuEntry ( " Trash " , r . edges . del ) , this . addControlNewNode = function ( ) { var a = g . add , b = " select_node_collection " , c = function ( ) { j & & i . getNodeCollections ( ) . length > 1 & & modalDialogHelper . createModalDialog ( " Select Vertex Collection " , b , [ { type : " list " , id : " vertex " , objects : i . getNodeCollections ( ) , text : " Select collection " , selected : i . getSelectedNodeCollection ( ) } ] , function ( ) { var a = $ ( " # " + b + " vertex " ) . children ( " option " ) . filter ( " : selected " ) . text ( ) ; i . useNodeCollection ( a ) } , " Select " ) , f . rebindAll ( f . newNodeRebinds ( ) ) } ; l ( a , " new_node " , c ) } , this . addControlView = function ( ) { var a = g . view , b = function ( ) { f . rebindAll ( f . viewRebinds ( ) ) } ; l ( a , " view " , b ) } , this . addControlDrag = function ( ) { var a = g . drag , b = function ( ) { f . rebindAll ( f . dragRebinds ( ) ) } ; l ( a , " drag " , b ) } , this . addControlEdit = function ( ) { var a = g . edit , b = function ( ) { f . rebindAll ( f . editRebinds ( ) ) } ; l ( a , " edit " , b ) } , this . addControlExpand = function ( ) { var a = g . expand , b = function ( ) { f . rebindAll ( f . expandRebinds ( ) ) } ; l ( a , " expand " , b ) } , this . addControlDelete = function ( ) { var a = g . trash , b = function ( ) { f . rebindAll ( f . deleteRebinds ( ) ) } ; l ( a , " delete " , b ) } , this . addControlConnect = function ( ) { var a = g . edge , b = " select_edge_collection " , c = function ( ) { j & & i . getEdgeCollections ( ) . length > 1 & & modalDialogHelper . createModalDialog ( " Select Edge Collection " , b , [ { type : " list " , id : " edge " , objects : i . getEdgeCollections ( ) , text : " Select collection " , selected : i . getSelectedEdgeCollection ( ) } ] , function ( ) { var a = $ ( " # " + b + " edge " ) . children ( " option " ) . filter ( " : selected " ) . text ( ) ; i . useEdgeCollection ( a ) } , " Select " ) , f . rebindAll ( f . connectNodesRebinds ( ) ) } ; l ( a , " connect " , c ) } , this . addAll = function ( ) { f . addControlExpand ( ) , f . addControlDrag ( ) , f . addControlEdit ( ) , f . addControlConnect ( ) , f . addControlNewNode ( ) , f . addControlDelete ( ) } } function GharialAdapterControls ( a , b ) { " use strict " ; if ( void 0 = = = a ) throw " A list element has to be given . " ; if ( void 0 = = = b ) throw " The GharialAdapter has to be given . " ; this . addControlChangeGraph = function ( c ) { var d = " control_adapter_graph " , e = d + " _ " ; b . getGraphs ( function ( f ) { uiComponentsHelper . createButton ( a , " Switch Graph " , d , function ( ) { modalDialogHelper . createModalDialog ( " Switch Graph " , e , [ { type : " list " , id : " graph " , objects : f , text : " Select graph " , selected : b . getGraphName ( ) } , { type : " checkbox " , text : " Start with random vertex " , id : " random " , selected : ! 0 } ] , function ( ) { var a = $ ( " # " + e + " graph " ) . children ( " option " ) . filter ( " : selected " ) . text ( ) , d = ! ! $ ( " # " + e + " undirected " ) . prop ( " checked " ) , f = ! ! $ ( " # " + e + " random " ) . prop ( " checked " ) ; return b . changeToGraph ( a , d ) , f ? void b . loadRandomNode ( c ) : void ( _ . isFunction ( c ) & & c ( ) ) } ) } ) } ) } , this . addControlChangePriority = function ( ) { var c = " control_adapter_priority " , d = c + " _ " , e = " Group vertices " ; uiComponentsHelper . createButton ( a , e , c , function ( ) { modalDialogHelper . createModalChangeDialog ( e + " by attribute " , d , [ { type : " extendable " , id : " attribute " , objects : b . getPrioList ( ) } ] , function ( ) { var a = $ ( " input [ id ^ = " + d + " attribute_ ] " ) , c = [ ] ; _ . each ( a , function ( a ) { var b = $ ( a ) . val ( ) ; " " ! = = b & & c . push ( b ) } ) , b . changeTo ( { prioList : c } ) } ) } ) } , this . addAll = function ( ) { this . addControlChangeGraph ( ) , this . addControlChangePriority ( ) } } function GraphViewerPreview ( a , b ) { " use strict " ; var c , d , e , f , g , h , i , j = function ( ) { return d3 . select ( a ) . append ( " svg " ) . attr ( " id " , " graphViewerSVG " ) . attr ( " width " , d ) . attr ( " height " , e ) . attr ( " class " , " graph - viewer " ) . attr ( " style " , " width : " + d + " px ; height : " + e + " ; " ) } , k = function ( a ) { var b = 0 ; return _ . each ( a , function ( c , d ) { c = = = ! 1 ? delete a [ d ] : b + + } ) , b > 0 } , l = function ( a , b ) { _ . each ( b , function ( b , c ) { a [ c ] = a [ c ] | | { } , _ . each ( b , function ( b , d ) { a [ c ] [ d ] = b } ) } ) } , m = function ( a ) { if ( a ) { var b = { } ; a . drag & & l ( b , i . dragRebinds ( ) ) , a . create & & ( l ( b , i . newNodeRebinds ( ) ) , l ( b , i . connectNodesRebinds ( ) ) ) , a . remove & & l ( b , i . deleteRebinds ( ) ) , a . expand & & l ( b , i . expandRebinds ( ) ) , a . edit & & l ( b , i . editRebinds ( ) ) , i . rebindAll ( b ) } } , n = function ( b ) { var c = document . createElement ( " div " ) ; i = new EventDispatcherControls ( c , f . nodeShaper , f . edgeShaper , f . start , f . dispatcherConfig ) , c . id = " toolbox " , c . className = " btn - group btn - group - vertical pull - left toolbox " , a . appendChild ( c ) , _ . each ( b , function ( a , b ) { switch ( b ) { case " expand " : i . addControlExpand ( ) ; break ; case " create " : i . addControlNewNode ( ) , i . addControlConnect ( ) ; break ; case " drag " : i . addControlDrag ( ) ; break ; case " edit " : i . addControlEdit ( ) ; break ; case " remove " : i . addControlDelete ( ) } } ) } , o = function ( a ) { var b = document . createElement ( " div " ) ; i = new EventDispatcherControls ( b , f . nodeShaper , f . edgeShaper , f . start , f . dispatcherConfig ) } , p = function ( ) { b & & ( b . nodeShaper & & ( b . nodeShaper . label & & ( b . nodeShaper . label = " label " ) , b . nodeShaper . shape & & b . nodeShaper . shape . type = = = NodeShaper . shapes . IMAGE & & b . nodeShaper . shape . source & & ( b . nodeShaper . shape . source = " image " ) ) , b . edgeShaper & & b . edgeShaper . label & & ( b . edgeShaper . label = " label " ) ) } , q = function ( ) { return p ( ) , new GraphViewer ( c , d , e , h , b ) } ; d = a . getBoundingClientRect ( ) . width , e = a . getBoundingClientRect ( ) . height , h = { type : " preview " } , b = b | | { } , g = k ( b . toolbox ) , g & & ( d - = 43 ) , c = j ( ) , f = q ( ) , g ? n ( b . toolbox ) : o ( ) , f . loadGraph ( " 1 " ) , m ( b . actions ) } function GraphViewerUI ( a , b , c , d , e , f ) { " use strict " ; if ( void 0 = = = a ) throw " A parent element has to be given . " ; if ( ! a . id ) throw " The parent element needs an unique id . " ; if ( void 0 = = = b ) throw " An adapter configuration has to be given " ; var g , h , i , j , k , l , m , n , o , p = c + 20 | | a . getBoundingClientRect ( ) . width - 81 + 20 , q = d | | a . getBoundingClientRect ( ) . height , r = document . createElement ( " ul " ) , s = document . createElement ( " div " ) , t = function ( ) { g . adapter . NODES_TO_DISPLAY < g . adapter . TOTAL_NODES & & ( $ ( " . headerBar " ) . append ( ' < div class = " infoField " > Graph too big . A random section is rendered . < div class = " fa fa - info - circle " > < / div > < / div > ' ) , $ ( " . infoField . fa - info - circle " ) . attr ( " title " , " You can display additional / other vertices by using the toolbar buttons . " ) . tooltip ( ) ) } , u = function ( ) { var a , b = document . createElement ( " div " ) , c = document . createElement ( " div " ) , d = document . createElement ( " div " ) , e = document . createElement ( " div " ) , f = document . createElement ( " button " ) , h = document . createElement ( " span " ) , i = document . createElement ( " input " ) , j = document . createElement ( " i " ) , k = document . createElement ( " span " ) , l = function ( ) { $ ( s ) . css ( " cursor " , " progress " ) } , n = function ( ) { $ ( s ) . css ( " cursor " , " " ) } , o = function ( a ) { if ( n ( ) , a & & a . errorCode & & 404 = = = a . errorCode ) return void arangoHelper . arangoError ( " Graph error " , " could not find a matching node . " ) } , p = function ( ) { l ( ) , " " = = = a . value | | void 0 = = = a . value ? g . loadGraph ( i . value , o ) : g . loadGraphWithAttributeValue ( a . value , i . value , o ) } ; b . id = " filterDropdown " , b . className = " headerDropdown smallDropdown " , c . className = " dropdownInner " , d . className = " queryline " , a = document . createElement ( " input " ) , m = document . createElement ( " ul " ) , e . className = " pull - left input - append searchByAttribute " , a . id = " attribute " , a . type = " text " , a . placeholder = " Attribute name " , f . id = " attribute_example_toggle " , f . className = " button - neutral gv_example_toggle " , h . className = " caret gv_caret " , m . className = " gv - dropdown - menu " , i . id = " value " , i . className = " searchInput gv_searchInput " , i . type = " text " , i . placeholder = " Attribute value " , j . id = " loadnode " , j . className = " fa fa - search " , k . className = " searchEqualsLabel " , k . appendChild ( document . createTextNode ( " = = " ) ) , c . appendChild ( d ) , d . appendChild ( e ) , e . appendChild ( a ) , e . appendChild ( f ) , e . appendChild ( m ) , f . appendChild ( h ) , d . appendChild ( k ) , d . appendChild ( i ) , d . appendChild ( j ) , j . onclick = p , $ ( i ) . keypress ( function ( a ) { if ( 13 = = = a . keyCode | | 13 = = = a . which ) return p ( ) , ! 1 } ) , f . onclick = function ( ) { $ ( m ) . slideToggle ( 200 ) } ; var q = document . createElement ( " p " ) ; return q . className = " dropdown - title " , q . innerHTML = " Filter graph by attribute : " , b . appendChild ( q ) , b . appendChild ( c ) , b } , v = function ( ) { var a , b = document . createElement ( " div " ) , c = document . createElement ( " div " ) , d = document . createElement ( " div " ) , e = document . createElement ( " div " ) , f = document . createElement ( " button " ) , h = document . createElement ( " span " ) , i = document . createElement ( " input " ) , j = document . createElement ( " i " ) , k = document . createElement ( " span " ) , l = function ( ) { $ ( s ) . css ( " cursor " , " progress " ) } , m = function ( ) { $ ( s ) . css ( " cursor " , " " ) } , o = function ( a ) { if ( m ( ) , a & & a . errorCode & & 404 = = = a . errorCode ) return void arangoHelper . arangoError ( " Graph error " , " could not find a matching node . " ) } , p = function ( ) { l ( ) , " " ! = = a . value & & g . loadGraphWithAdditionalNode ( a . value , i . value , o ) } ; b . id = " nodeDropdown " , b . className = " headerDropdown smallDropdown " , c . className = " dropdownInner " , d . className = " queryline " , a = document . createElement ( " input " ) , n = document . createElement ( " ul " ) , e . className = " pull - left input - append searchByAttribute " , a . id = " attribute " , a . type = " text " , a . placeholder = " Attribute name " , f . id = " attribute_example_toggle2 " , f . className = " button - neutral gv_example_toggle " , h . className = " caret gv_caret " , n . className = " gv - dropdown - menu " , i . id = " value " , i . className = " searchInput gv_searchInput " , i . type = " text " , i . placeholder = " Attribute value " , j . id = " loadnode " , j . className = " fa fa - search " , k . className = " searchEqualsLabel " , k . appendChild ( document . createTextNode ( " = = " ) ) , c . appendChild ( d ) , d . appendChild ( e ) , e . appendChild ( a ) , e . appendChild ( f ) , e . appendChild ( n ) , f . appendChild ( h ) , d . appendChild ( k ) , d . appendChild ( i ) , d . appendChild ( j ) , C ( n ) , j . onclick = p , $ ( i ) . keypress ( function ( a ) { if ( 13 = = = a . keyCode | | 13 = = = a . which ) return p ( ) , ! 1 } ) , f . onclick = function ( ) { $ ( n ) . slideToggle ( 200 ) } ; var q = document . createElement ( " p " ) ; return q . className = " dropdown - title " , q . innerHTML = " Add specific node by attribute : " , b . appendChild ( q ) , b . appendChild ( c ) , b } , w = function ( ) { var a , b , c , d , e , f , g , h ; return a = document . createElement ( " div " ) , a . id = " configureDropdown " , a . className = " headerDropdown " , b = document . createElement ( " div " ) , b . className = " dropdownInner " , c = document . createElement ( " ul " ) , d = document . createElement ( " li " ) , d . className = " nav - header " , d . appendChild ( document . createTextNode ( " Vertices " ) ) , g = document . createElement ( " ul " ) , h = document . createElement ( " li " ) , h . className = " nav - header " , h . appendChild ( document . createTextNode ( " Edges " ) ) , e = document . createElement ( " ul " ) , f = document . createElement ( " li " ) , f . className = " nav - header " , f . appendChild ( document . createTextNode ( " Connection " ) ) , c . appendChild ( d ) , g . appendChild ( h ) , e . appendChild ( f ) , b . appendChild ( c ) , b . appendChild ( g ) , b . appendChild ( e ) , a . appendChild ( b ) , { configure : a , nodes : c , edges : g , col : e } } , x = function ( a , b , c , d ) { var e , f , g , h , i , j , k , l , m , n , o ; return a . className = " headerButtonBar " , e = document . createElement ( " ul " ) , e . className = " headerButtonList " , a . appendChild ( e ) , g = document . createElement ( " li " ) , g . className = " enabled " , h = document . createElement ( " a " ) , h . id = b , h . className = " headerButton " , i = document . createElement ( " span " ) , i . className = " icon_arangodb_settings2 " , $ ( i ) . attr ( " title " , " Configure " ) , e . appendChild ( g ) , g . appendChild ( h ) , h . appendChild ( i ) , j = document . createElement ( " li " ) , j . className = " enabled " , k = document . createElement ( " a " ) , k . id = d , k . className = " headerButton " , l = document . createElement ( " span " ) , l . className = " fa fa - search - plus " , $ ( l ) . attr ( " title " , " Show additional vertices " ) , e . appendChild ( j ) , j . appendChild ( k ) , k . appendChild ( l ) , m = document . createElement ( " li " ) , m . className = " enabled " , n = document . createElement ( " a " ) , n . id = c , n . className = " headerButton " , o = document . createElement ( " span " ) , o . className = " icon_arangodb_filter " , $ ( o ) . attr ( " title " , " Filter " ) , e . appendChild ( m ) , m . appendChild ( n ) , n . appendChild ( o ) , f = w ( ) , f . filter = u ( ) , f . node = v ( ) , h . onclick = function ( ) { $ ( " # filterdropdown " ) . removeClass ( " activated " ) , $ ( " # nodedropdown " ) . removeClass ( " activated " ) , $ ( " # configuredropdown " ) . toggleClass ( " activated " ) , $ ( f . configure ) . slideToggle ( 200 ) , $ ( f . filter ) . hide ( ) , $ ( f . node ) . hide ( ) } , k . onclick = function ( ) { $ ( " # filterdropdown " ) . removeClass ( " activated " ) , $ ( " # configuredropdown " ) . removeClass ( " activated " ) , $ ( " # nodedropdown " ) . toggleClass ( " activated " ) , $ ( f . node ) . slideToggle ( 200 ) , $ ( f . filter ) . hide ( ) , $ ( f . configure ) . hide ( ) } , n . onclick = function ( ) { $ ( " # configuredropdown " ) . removeClass ( " activated " ) , $ ( " # nodedropdown " ) . removeClass ( " activated " ) , $ ( " # filterdropdown " ) . toggleClass ( " activated " ) , $ ( f . filter ) . slideToggle ( 200 ) , $ ( f . node ) . hide ( ) , $ ( f . configure ) . hide ( ) } , f } , y = function ( ) { return d3 . select ( " # " + a . id + " # background " ) . append ( " svg " ) . attr ( " id " , " graphViewerSVG " ) . attr ( " width " , p ) . attr ( " height " , q ) . attr ( " class " , " graph - viewer " ) . style ( " width " , p + " px " ) . style ( " height " , q + " px " ) } , z = function ( ) { var a = document . createElement ( " div " ) , b = document . createElement ( " div " ) , c = document . createElement ( " button " ) , d = document . createElement ( " button " ) , e = document . createElement ( " button " ) , f = document . createElement ( " button " ) ; a . className = " gv_zoom_widget " , b . className = " gv_zoom_buttons_bg " , c . className = " btn btn - icon btn - zoom btn - zoom - top gv - zoom - btn pan - top " , d . className = " btn btn - icon btn - zoom btn - zoom - left gv - zoom - btn pan - left " , e . className = " btn btn - icon btn - zoom btn - zoom - right gv - zoom - btn pan - right " , f . className = " btn btn - icon btn - zoom btn - zoom - bottom gv - zoom - btn pan - bottom " , c . onclick = function ( ) { g . zoomManager . triggerTranslation ( 0 , - 10 ) } , d . onclick = function ( ) { g . zoomManager . triggerTranslation ( - 10 , 0 ) } , e . onclick = function ( ) { g . zoomManager . triggerTranslation ( 10 , 0 ) } , f . onclick = function ( ) { g . zoomManager . triggerTranslation ( 0 , 10 ) } , b . appendChild ( c ) , b . appendChild ( d ) , b . appendChild ( e ) , b . appendChild ( f ) , l = document . createElement ( " div " ) , l . id = " gv_zoom_slider " , l . className = " gv_zoom_slider " , s . appendChild ( a ) , s . insertBefore ( a , o [ 0 ] [ 0 ] ) , a . appendChild ( b ) , a . appendChild ( l ) , $ ( " # gv_zoom_slider " ) . slider ( { orientation : " vertical " , min : g . zoomManager . getMinimalZoomFactor ( ) , max : 1 , value : 1 , step : . 01 , slide : function ( a , b ) { g . zoomManager . triggerScale ( b . value ) } } ) , g . zoomManager . registerSlider ( $ ( " # gv_zoom_slider " ) ) } , A = function ( ) { var a = document . createElement ( " div " ) , b = new EventDispatcherControls ( a , g . nodeShaper , g . edgeShaper , g . start , g . dispatcherConfig ) ; a . id = " toolbox " , a . className = " btn - group btn - group - vertical toolbox " , s . insertBefore ( a , o [ 0 ] [ 0 ] ) , b . addAll ( ) , $ ( " # control_event_expand " ) . click ( ) } , B = function ( ) { var a = ' < li class = " enabled " style = " float : right " > < select id = " graphSize " class = " documents - size " > < optgroup label = " Starting points : " > < option value = " 5 " selected = " " > 5 vertices < / option > < option value = " 10 " > 10 vertices < / option > < option value = " 20 " > 20 vertices < / option > < option value = " 50 " > 50 vertices < / option > < option value = " 100 " > 100 vertices < / option > < option value = " 500 " > 500 vertices < / option > < option value = " 1000 " > 1000 vertices < / option > < option value = " 2500 " > 2500 vertices < / option > < option value = " 5000 " > 5000 vertices < / option > < option value = " all " > All vertices < / option > < / select > < / optgroup > < / li > ' ; $ ( " . headerBar . headerButtonList " ) . prepend ( a ) } , C = function ( a ) { var b ; b = a ? $ ( a ) : $ ( m ) , b . innerHTML = " " ; var c = document . createElement ( " li " ) , d = document . createElement ( " img " ) ; $ ( c ) . append ( d ) , d . className = " gv - throbber " , b . append ( c ) , g . adapter . getAttributeExamples ( function ( a ) { $ ( b ) . html ( " " ) , _ . each ( a , function ( a ) { var c = document . createElement ( " li " ) , d = document . createElement ( " a " ) , e = document . createElement ( " label " ) ; $ ( c ) . append ( d ) , $ ( d ) . append ( e ) , $ ( e ) . append ( document . createTextNode ( a ) ) , e . className = " gv_dropdown_label " , b . append ( c ) , c . onclick = function ( ) { b . value = a , $ ( b ) . parent ( ) . find ( " input " ) . val ( a ) , $ ( b ) . slideToggle ( 200 ) } } ) } ) } , D = function ( ) { var a = document . createElement ( " div " ) , b = document . createElement ( " div " ) , c = ( document . createElement ( " a " ) , x ( b , " configuredropdown " , " filterdropdown " , " nodedropdown " ) ) ; i = new NodeShaperControls ( c . nodes , g . nodeShaper ) , j = new EdgeShaperControls ( c . edges , g . edgeShaper ) , k = new GharialAdapterControls ( c . col , g . adapter ) , r . id = " menubar " , a . className = " headerBar " , b . id = " modifiers " , r . appendChild ( a ) , r . appendChild ( c . configure ) , r . appendChild ( c . filter ) , r . appendChild ( c . node ) , a . appendChild ( b ) , k . addControlChangeGraph ( function ( ) { C ( ) , g . start ( ! 0 ) } ) , k . addControlChangePriority ( ) , i . addControlOpticLabelAndColourList ( g . adapter ) , j . addControlOpticLabelList ( ) , C ( ) } , E = function ( ) { h = i . createColourMappingList ( ) , h . className = " gv - colour - list " , s . insertBefore ( h , o [ 0 ] [ 0 ] ) } ; a . appendChild ( r ) , a . appendChild ( s ) , s . className = " contentDiv gv - background " , s . id = " background " , e = e | | { } , e . zoom = ! 0 , $ ( " # subNavigationBar . breadcrumb " ) . html ( " Graph : " + b . graphName ) , o = y ( ) , " undefined " ! = = Storage & & ( this . graphSettings = { } , this . loadLocalStorage = function ( ) { var a = b . baseUrl . split ( " / " ) [ 2 ] , c = b . graphName + a ; if ( null = = = localStorage . getItem ( " graphSettings " ) | | " null " = = = localStorage . getItem ( " graphSettings " ) ) { var d = { } ; d [ c ] = { viewer : e , adapter : b } , localStorage . setItem ( " graphSettings " , JSON . stringify ( d ) ) } else try { var f = JSON . parse ( localStorage . getItem ( " graphSettings " ) ) ; this . graphSettings = f , void 0 ! = = f [ c ] . viewer & & ( e = f [ c ] . viewer ) , void 0 ! = = f [ c ] . adapter & & ( b = f [ c ] . adapter ) } catch ( g ) { console . log ( " Could not load graph settings , resetting graph settings . " ) , this . graphSettings [ c ] = { viewer : e , adapter : b } , localStorage . setItem ( " graphSettings " , JSON . stringify ( this . graphSettings ) ) } } , this . loadLocalStorage ( ) , this . writeLocalStorage = function ( ) { } ) , g = new GraphViewer ( o , p , q , b , e ) , A ( ) , z ( ) , D ( ) , E ( ) , t ( ) , B ( ) , $ ( " # graphSize " ) . on ( " change " , function ( ) { var a = $ ( " # graphSize " ) . find ( " : selected " ) . val ( ) ; g . loadGraphWithRandomStart ( function ( a ) { a & & a . errorCode & & arangoHelper . arangoError ( " Graph " , " Sorry your graph seems to be empty " ) } , a ) } ) , f & & ( " string " = = typeof f ? g . loadGraph ( f ) : g . loadGraphWithRandomStart ( function ( a ) { a & & a . errorCode & & arangoHelper . arangoError ( " Graph " , " Sorry your graph seems to be empty " ) } ) ) , this . changeWidth = function ( a ) { g . changeWidth ( a ) ; var b = a - 55 ; o . attr ( " width " , b ) . style ( " width " , b + " px " ) } } function GraphViewerWidget ( a , b ) { " use strict " ; var c , d , e , f , g , h , i , j , k = function ( ) { return d3 . select ( d ) . append ( " svg " ) . attr ( " id " , " graphViewerSVG " ) . attr ( " width " , e ) . attr ( " height " , f ) . attr ( " class " , " graph - viewer " ) . attr ( " style " , " width : " + e + " px ; height : " + f + " px ; " ) } , l = function ( a ) { var b = 0 ; return _ . each ( a , function ( c , d ) { c = = = ! 1 ? delete a [ d ] : b + + } ) , b > 0 } , m = function ( a , b ) { _ . each ( b , function ( b , c ) { a [ c ] = a [ c ] | | { } , _ . each ( b , function ( b , d ) { a [ c ] [ d ] = b } ) } ) } , n = function ( a ) { if ( a ) { var b = { } ; a . drag & & m ( b , j . dragRebinds ( ) ) , a . create & & ( m ( b , j . newNodeRebinds ( ) ) , m ( b , j . connectNodesRebinds ( ) ) ) , a . remove & & m ( b , j . deleteRebinds ( ) ) , a . expand & & m ( b , j . expandRebinds ( ) ) , a . edit & & m ( b , j . editRebinds ( ) ) , j . rebindAll ( b ) } } , o = function ( a ) { var b = document . createElement ( " div " ) ; j = new EventDispatcherControls ( b , g . nodeShaper , g . edgeShaper , g . start , g . dispatcherConfig ) , b . id = " toolbox " , b . className = " btn - group btn - group - vertical pull - left toolbox " , d . appendChild ( b ) , _ . each ( a , function ( a , b ) { switch ( b ) { case " expand " : j . addControlExpand ( ) ; break ; case " create " : j . addControlNewNode ( ) , j . addControlConnect ( ) ; break ; case " drag " : j . addControlDrag ( ) ; break ; case " edit " : j . addControlEdit ( ) ; break ; case " remove " : j . addControlDelete ( ) } } ) } , p = function ( a ) { var b = document . createElement ( " div " ) ; j = new EventDispatcherControls ( b , g . nodeShaper , g . edgeShaper , g . start , g . dispatcherConfig ) } , q = function ( ) { return new GraphViewer ( c , e , f , i , a ) } ; d = document . body , e = d . getBoundingClientRect ( ) . width , f = d . getBoundingClientRect ( ) . height , i = { type : " foxx " , route : " . " } , a = a | | { } , h = l ( a . toolbox ) , h & & ( e - = 43 ) , c = k ( ) , g = q ( ) , h ? o ( a . toolbox ) : p ( ) , b & & g . loadGraph ( b ) , n ( a . actions ) } function LayouterControls ( a , b ) { " use strict " ; if ( void 0 = = = a ) throw " A list element has to be given . " ; if ( void 0 = = = b ) throw " The Layouter has to be given . " ; var c = this ; this . addControlGravity = function ( ) { var c = " control_layout_gravity " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Gravity " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch Gravity Strength " , d , [ { type : " text " , id : " value " } ] , function ( ) { var a = $ ( " # " + d + " value " ) . attr ( " value " ) ; b . changeTo ( { gravity : a } ) } ) } ) } , this . addControlCharge = function ( ) { var c = " control_layout_charge " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Charge " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch Charge Strength " , d , [ { type : " text " , id : " value " } ] , function ( ) { var a = $ ( " # " + d + " value " ) . attr ( " value " ) ; b . changeTo ( { charge : a } ) } ) } ) } , this . addControlDistance = function ( ) { var c = " control_layout_distance " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Distance " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch Distance Strength " , d , [ { type : " text " , id : " value " } ] , function ( ) { var a = $ ( " # " + d + " value " ) . attr ( " value " ) ; b . changeTo ( { distance : a } ) } ) } ) } , this . addAll = function ( ) { c . addControlDistance ( ) , c . addControlGravity ( ) , c . addControlCharge ( ) } } function NodeShaperControls ( a , b ) { " use strict " ; if ( void 0 = = = a ) throw " A list element has to be given . " ; if ( void 0 = = = b ) throw " The NodeShaper has to be given . " ; var c , d = this , e = function ( a ) { for ( ; c . hasChildNodes ( ) ; ) c . removeChild ( c . lastChild ) ; var b = document . createElement ( " ul " ) ; c . appendChild ( b ) , _ . each ( a , function ( a , c ) { var d = document . createElement ( " ul " ) , e = a . list , f = a . front ; d . style . backgroundColor = c , d . style . color = f , _ . each ( e , function ( a ) { var b = document . createElement ( " li " ) ; b . appendChild ( document . createTextNode ( a ) ) , d . appendChild ( b ) } ) , b . appendChild ( d ) } ) } ; this . addControlOpticShapeNone = function ( ) { uiComponentsHelper . createButton ( a , " None " , " control_node_none " , function ( ) { b . changeTo ( { shape : { type : NodeShaper . shapes . NONE } } ) } ) } , this . applyLocalStorage = function ( a ) { if ( " undefined " ! = = Storage ) try { var b = JSON . parse ( localStorage . getItem ( " graphSettings " ) ) , c = window . location . hash . split ( " / " ) [ 1 ] , d = window . location . pathname . split ( " / " ) [ 2 ] , e = c + d ; _ . each ( a , function ( a , c ) { void 0 ! = = c & & ( b [ e ] . viewer . nodeShaper [ c ] = a ) } ) , localStorage . setItem ( " graphSettings " , JSON . stringify ( b ) ) } catch ( f ) { console . log ( f ) } } , this . addControlOpticShapeCircle = function ( ) { var c = " control_node_circle " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Circle " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch to Circle " , d , [ { type : " text " , id : " radius " } ] , function ( ) { var a = $ ( " # " + d + " radius " ) . attr ( " value " ) ; b . changeTo ( { shape : { type : NodeShaper . shapes . CIRCLE , radius : a } } ) } ) } ) } , this . addControlOpticShapeRect = function ( ) { var c = " control_node_rect " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Rectangle " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch to Rectangle " , " control_node_rect_ " , [ { type : " text " , id : " width " } , { type : " text " , id : " height " } ] , function ( ) { var a = $ ( " # " + d + " width " ) . attr ( " value " ) , c = $ ( " # " + d + " height " ) . attr ( " value " ) ; b . changeTo ( { shape : { type : NodeShaper . shapes . RECT , width : a , height : c } } ) } ) } ) } , this . addControlOpticLabel = function ( ) { var c = " control_node_label " , e = c + " _ " ; uiComponentsHelper . createButton ( a , " Configure Label " , c , function ( ) { modalDialogHelper . createModalChangeDialog ( " Change label attribute " , e , [ { type : " text " , id : " key " } ] , function ( ) { var a = $ ( " # " + e + " key " ) . attr ( " value " ) , c = { label : a } ; d . applyLocalStorage ( c ) , b . changeTo ( c ) } ) } ) } , this . addControlOpticSingleColour = function ( ) { var c = " control_node_singlecolour " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Single Colour " , c , function ( ) { modalDialogHelper . createModalDialog ( " Switch to Colour " , d , [ { type : " text " , id : " fill " } , { type : " text " , id : " stroke " } ] , function ( ) { var a = $ ( " # " + d + " fill " ) . attr ( " value " ) , c = $ ( " # " + d + " stroke " ) . attr ( " value " ) ; b . changeTo ( { color : { type : " single " , fill : a , stroke : c } } ) } ) } ) } , this . addControlOpticAttributeColour = function ( ) { var c = " control_node_attributecolour " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Colour by Attribute " , c , function ( ) { modalDialogHelper . createModalDialog ( " Display colour by attribute " , d , [ { type : " text " , id : " key " <nl> + } ] , function ( ) { var a = $ ( " # " + d + " key " ) . attr ( " value " ) ; b . changeTo ( { color : { type : " attribute " , key : a } } ) } ) } ) } , this . addControlOpticExpandColour = function ( ) { var c = " control_node_expandcolour " , d = c + " _ " ; uiComponentsHelper . createButton ( a , " Expansion Colour " , c , function ( ) { modalDialogHelper . createModalDialog ( " Display colours for expansion " , d , [ { type : " text " , id : " expanded " } , { type : " text " , id : " collapsed " } ] , function ( ) { 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 | | b < = 0 ) throw " A width greater 0 has to be given " ; if ( void 0 = = = c | | c < = 0 ) 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 } 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 . length ; g + + ) n ( c [ g ] ) } , l = function ( a , b ) { var d = document . createElement ( " div " ) , e = document . createElement ( " div " ) , f = document . createElement ( " button " ) , g = document . createElement ( " a " ) , h = document . createElement ( " div " ) , i = document . createElement ( " table " ) ; return d . id = b + " modal " , d . className = " modal hide fade createModalDialog " , d . setAttribute ( " tabindex " , " - 1 " ) , d . setAttribute ( " role " , " dialog " ) , d . setAttribute ( " aria - labelledby " , " myModalLabel " ) , d . setAttribute ( " aria - hidden " , ! 0 ) , d . style . display = " none " , d . onhidden = function ( ) { c ( ) , document . body . removeChild ( d ) } , e . className = " modal - header " , g . className = " arangoHeader " , f . id = b + " modal_dismiss " , f . className = " close " , f . dataDismiss = " modal " , f . ariaHidden = " true " , f . appendChild ( document . createTextNode ( " × " ) ) , g . appendChild ( document . createTextNode ( a ) ) , h . className = " modal - body " , i . id = b + " table " , d . appendChild ( e ) , d . appendChild ( h ) , e . appendChild ( f ) , e . appendChild ( g ) , h . appendChild ( i ) , document . body . appendChild ( d ) , f . onclick = function ( ) { c ( ) , $ ( " # " + b + " modal " ) . modal ( " hide " ) } , { div : d , bodyTable : i } } ; a = function ( a , b , c ) { var d = document . createElement ( " tr " ) , e = document . createElement ( " th " ) , i = document . createElement ( " th " ) ; switch ( a . appendChild ( d ) , d . appendChild ( e ) , e . className = " collectionTh " , c . text ? e . appendChild ( document . createTextNode ( c . text + " : " ) ) : ( e . className + = " capitalize " , c . type & & " extenadable " = = = c . type ? e . appendChild ( document . createTextNode ( c . id + " : " ) ) : e . appendChild ( document . createTextNode ( c . id + " : " ) ) ) , d . appendChild ( i ) , i . className = " collectionTh " , c . type ) { case " text " : i . appendChild ( f ( b + c . id , c . value | | " " ) ) ; break ; case " checkbox " : i . appendChild ( g ( b + c . id , c . selected | | ! 1 ) ) ; break ; case " list " : i . appendChild ( h ( b + c . id , c . objects , c . selected | | void 0 ) ) ; break ; case " extendable " : k ( b , c . id , c . objects , i , a , d ) ; break ; case " decission " : j ( b , c . id , c . group , c . text , c . isDefault , c . interior , i , a ) , e . innerHTML = " " ; break ; default : a . removeChild ( d ) } return d } , modalDialogHelper . modalDivTemplate = function ( a , d , e , f ) { d = d | | " Switch " ; var g = document . createElement ( " div " ) , h = document . createElement ( " button " ) , i = document . createElement ( " button " ) , j = l ( a , e ) ; return g . className = " modal - footer " , h . id = e + " cancel " , h . className = " button - close btn - margin " , h . appendChild ( document . createTextNode ( " Close " ) ) , i . id = e + " submit " , i . className = " button - success " , i . style . marginRight = " 8px " , i . appendChild ( document . createTextNode ( d ) ) , j . div . appendChild ( g ) , g . appendChild ( i ) , g . appendChild ( h ) , h . onclick = function ( ) { c ( ) , $ ( " # " + e + " modal " ) . modal ( " hide " ) } , i . onclick = function ( ) { c ( ) , f ( ) , $ ( " # " + e + " modal " ) . modal ( " hide " ) } , b ( i ) , j . bodyTable } , modalDialogHelper . createModalDialog = function ( b , c , d , e , f ) { var g = modalDialogHelper . modalDivTemplate ( b , f , c , e ) ; _ . each ( d , function ( b ) { a ( g , c , b ) } ) , $ ( " # " + c + " modal " ) . modal ( " show " ) } , modalDialogHelper . createModalChangeDialog = function ( b , c , d , e ) { var f = modalDialogHelper . modalDivTemplate ( b , " Change " , c , e ) ; _ . each ( d , function ( b ) { a ( f , c , b ) } ) , $ ( " # " + c + " modal " ) . modal ( " show " ) } , modalDialogHelper . createModalEditDialog = function ( a , b , c , e ) { d ( a , " Save " , b , c , e ) } , modalDialogHelper . createModalCreateDialog = function ( a , b , c , e ) { d ( a , " Create " , b , c , e ) } , modalDialogHelper . createModalViewDialog = function ( a , b , c , d ) { e ( a , " Edit " , b , c , d ) } , modalDialogHelper . createModalDeleteDialog = function ( a , d , e , f ) { var g = document . createElement ( " div " ) , h = document . createElement ( " button " ) , i = document . createElement ( " button " ) , j = l ( a , d ) ; g . className = " modal - footer " , h . id = d + " cancel " , h . className = " button - close btn - margin " , h . appendChild ( document . createTextNode ( " Close " ) ) , i . id = d + " submit " , i . className = " button - danger " , i . style . marginRight = " 8px " , i . appendChild ( document . createTextNode ( " Delete " ) ) , j . div . appendChild ( g ) , g . appendChild ( i ) , g . appendChild ( h ) , h . onclick = function ( ) { c ( ) , $ ( " # " + d + " modal " ) . modal ( " hide " ) } , i . onclick = function ( ) { c ( ) , f ( e ) , $ ( " # " + d + " modal " ) . modal ( " hide " ) } , b ( i ) , $ ( " # " + d + " modal " ) . modal ( " show " ) } } ( ) ; var uiComponentsHelper = uiComponentsHelper | | { } ; ! function ( ) { " use strict " ; uiComponentsHelper . createButton = function ( a , b , c , d ) { var e = document . createElement ( " li " ) , f = document . createElement ( " button " ) ; e . className = " graph_control " + c , e . id = c , e . appendChild ( f ) , f . className = " button - primary gv_dropdown_entry " , f . appendChild ( document . createTextNode ( b ) ) , a . appendChild ( e ) , f . id = c + " _button " , f . onclick = d } , uiComponentsHelper . createIconButton = function ( a , b , c ) { var d = document . createElement ( " div " ) , e = document . createElement ( " h6 " ) , f = document . createElement ( " h6 " ) ; return d . className = " gv_action_button " , d . id = b , d . onclick = function ( ) { $ ( " . gv_action_button " ) . each ( function ( a , b ) { $ ( b ) . toggleClass ( " active " , ! 1 ) } ) , " control_event_new_node " = = = d . id ? ( $ ( " . node " ) . css ( " cursor " , " pointer " ) , $ ( " . gv - background " ) . css ( " cursor " , " copy " ) ) : " control_event_drag " = = = d . id ? ( $ ( " . node " ) . css ( " cursor " , " - webkit - grabbing " ) , $ ( " . gv - background " ) . css ( " cursor " , " default " ) ) : " control_event_expand " = = = d . id ? ( $ ( " . node " ) . css ( " cursor " , " grabbing " ) , $ ( " . gv - background " ) . css ( " cursor " , " default " ) ) : " control_event_view " = = = d . id ? ( $ ( " . node " ) . css ( " cursor " , " - webkit - zoom - in " ) , $ ( " . gv - background " ) . css ( " cursor " , " default " ) ) : " control_event_edit " = = = d . id ? ( $ ( " . gv - background . node " ) . css ( " cursor " , " context - menu " ) , $ ( " . gv - background " ) . css ( " cursor " , " default " ) ) : " control_event_connect " = = = d . id ? ( $ ( " . node " ) . css ( " cursor " , " ne - resize " ) , $ ( " . gv - background " ) . css ( " cursor " , " default " ) ) : " control_event_delete " = = = d . id & & ( $ ( " . node " ) . css ( " cursor " , " pointer " ) , $ ( " . gv - background " ) . css ( " cursor " , " default " ) ) , $ ( d ) . toggleClass ( " active " , ! 0 ) , c ( ) } , e . className = " fa gv_icon_icon fa - " + a . icon , e . title = a . title , f . className = " gv_button_title " , d . appendChild ( e ) , d . appendChild ( f ) , f . appendChild ( document . createTextNode ( a . title ) ) , d } } ( ) , function ( ) { " use strict " ; var a = null ; window . isCoordinator = function ( b ) { null = = = a ? $ . ajax ( " cluster / amICoordinator " , { async : ! 0 , success : function ( c ) { a = c , b ( ! 1 , c ) } , error : function ( c ) { a = c , b ( ! 0 , c ) } } ) : b ( ! 1 , a ) } , window . versionHelper = { fromString : function ( a ) { var b = a . replace ( / - [ a - zA - Z0 - 9_ \ - ] * $ / g , " " ) . split ( " . " ) ; return { major : parseInt ( b [ 0 ] , 10 ) | | 0 , minor : parseInt ( b [ 1 ] , 10 ) | | 0 , patch : parseInt ( b [ 2 ] , 10 ) | | 0 , toString : function ( ) { return this . major + " . " + this . minor + " . " + this . patch } } } , toString : function ( a ) { return a . major + " . " + a . minor + " . " + a . patch } } , window . arangoHelper = { getCurrentJwt : function ( ) { return localStorage . getItem ( " jwt " ) } , setCurrentJwt : function ( a ) { localStorage . setItem ( " jwt " , a ) } , lastNotificationMessage : null , CollectionTypes : { } , systemAttributes : function ( ) { return { _id : ! 0 , _rev : ! 0 , _key : ! 0 , _bidirectional : ! 0 , _vertices : ! 0 , _from : ! 0 , _to : ! 0 , $ id : ! 0 } } , getCurrentSub : function ( ) { return window . App . naviView . activeSubMenu } , parseError : function ( a , b ) { var c ; try { c = JSON . parse ( b . responseText ) . errorMessage } catch ( d ) { c = d } this . arangoError ( a , c ) } , setCheckboxStatus : function ( a ) { _ . each ( $ ( a ) . find ( " ul " ) . find ( " li " ) , function ( a ) { $ ( a ) . hasClass ( " nav - header " ) | | ( $ ( a ) . find ( " input " ) . attr ( " checked " ) ? $ ( a ) . find ( " i " ) . hasClass ( " css - round - label " ) ? $ ( a ) . find ( " i " ) . addClass ( " fa - dot - circle - o " ) : $ ( a ) . find ( " i " ) . addClass ( " fa - check - square - o " ) : $ ( a ) . find ( " i " ) . hasClass ( " css - round - label " ) ? $ ( a ) . find ( " i " ) . addClass ( " fa - circle - o " ) : $ ( a ) . find ( " i " ) . addClass ( " fa - square - o " ) ) } ) } , parseInput : function ( a ) { var b , c = $ ( a ) . val ( ) ; try { b = JSON . parse ( c ) } catch ( d ) { b = c } return b } , calculateCenterDivHeight : function ( ) { var a = $ ( " . navbar " ) . height ( ) , b = $ ( " . footer " ) . height ( ) , c = $ ( window ) . height ( ) ; return c - b - a - 110 } , fixTooltips : function ( a , b ) { $ ( a ) . tooltip ( { placement : b , hide : ! 1 , show : ! 1 } ) } , currentDatabase : function ( a ) { return frontendConfig . db ? a ( ! 1 , frontendConfig . db ) : a ( ! 0 , void 0 ) , frontendConfig . db } , allHotkeys : { jsoneditor : { name : " AQL editor " , content : [ { label : " Execute Query " , letter : " Ctrl / Cmd + Return " } , { label : " Explain Query " , letter : " Ctrl / Cmd + Shift + Return " } , { label : " Save Query " , letter : " Ctrl / Cmd + Shift + S " } , { label : " Open search " , letter : " Ctrl + Space " } , { label : " Toggle comments " , letter : " Ctrl / Cmd + Shift + C " } , { label : " Undo " , letter : " Ctrl / Cmd + Z " } , { label : " Redo " , letter : " Ctrl / Cmd + Shift + Z " } ] } , doceditor : { name : " Document editor " , content : [ { label : " Insert " , letter : " Ctrl + Insert " } , { label : " Save " , letter : " Ctrl + Return , Cmd + Return " } , { label : " Append " , letter : " Ctrl + Shift + Insert " } , { label : " Duplicate " , letter : " Ctrl + D " } , { label : " Remove " , letter : " Ctrl + Delete " } ] } , modals : { name : " Modal " , content : [ { label : " Submit " , letter : " Return " } , { label : " Close " , letter : " Esc " } , { label : " Navigate buttons " , letter : " Arrow keys " } , { label : " Navigate content " , letter : " Tab " } ] } } , hotkeysFunctions : { scrollDown : function ( ) { window . scrollBy ( 0 , 180 ) } , scrollUp : function ( ) { window . scrollBy ( 0 , - 180 ) } , showHotkeysModal : function ( ) { var a = [ ] , b = window . arangoHelper . allHotkeys ; window . modalView . show ( " modalHotkeys . ejs " , " Keyboard Shortcuts " , a , b ) } } , buildSubNavBar : function ( a ) { $ ( " # subNavigationBar . bottom " ) . html ( " " ) ; var b ; _ . each ( a , function ( a , c ) { b = " " , a . active & & ( b + = " active " ) , a . disabled & & ( b + = " disabled " ) , $ ( " # subNavigationBar . bottom " ) . append ( ' < li class = " subMenuEntry ' + b + ' " > < a > ' + c + " < / a > < / li > " ) , a . disabled | | $ ( " # subNavigationBar . bottom " ) . children ( ) . last ( ) . bind ( " click " , function ( ) { window . App . navigate ( a . route , { trigger : ! 0 } ) } ) } ) } , buildUserSubNav : function ( a , b ) { var c = { General : { route : " # user / " + encodeURIComponent ( a ) } , Permissions : { route : " # user / " + encodeURIComponent ( a ) + " / permission " } } ; c [ b ] . active = ! 0 , this . buildSubNavBar ( c ) } , buildGraphSubNav : function ( a , b ) { var c = { Content : { route : " # graph2 / " + encodeURIComponent ( a ) } , Settings : { route : " # graph2 / " + encodeURIComponent ( a ) + " / settings " } } ; c [ b ] . active = ! 0 , this . buildSubNavBar ( c ) } , buildNodeSubNav : function ( a , b , c ) { var d = { Dashboard : { route : " # node / " + encodeURIComponent ( a ) } } ; d [ b ] . active = ! 0 , d [ c ] . disabled = ! 0 , this . buildSubNavBar ( d ) } , buildNodesSubNav : function ( a , b ) { var c = { Overview : { route : " # nodes " } , Shards : { route : " # shards " } } ; c [ a ] . active = ! 0 , b & & ( c [ b ] . disabled = ! 0 ) , this . buildSubNavBar ( c ) } , scaleability : void 0 , 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 : this . databaseUrl ( " / _api / database / " , c ) , 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 " } ) } , arangoWarning : function ( a , b , c ) { window . App . notificationList . add ( { title : a , content : b , info : c , type : " warning " } ) } , arangoMessage : function ( a , b , c ) { window . App . notificationList . add ( { title : a , content : b , info : c , type : " message " } ) } , 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 ( ' < i class = " fa fa - times " > < / i > ' ) , $ ( " . 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 : this . databaseUrl ( " / _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 : this . databaseUrl ( " / _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 : this . databaseUrl ( " / _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 : this . databaseUrl ( " / _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 : this . databaseUrl ( " / _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 a < 10 ? " 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 , " & amp ; " ) . replace ( / < / g , " & lt ; " ) . replace ( / > / g , " & gt ; " ) . replace ( / " / g , " & quot ; " ) . replace ( / ' / g , " & # 39 ; " ) } , backendUrl : function ( a ) { return frontendConfig . basePath + a } , databaseUrl : function ( a , b ) { if ( " / _db / " = = = a . substr ( 0 , 5 ) ) throw new Error ( " Calling databaseUrl with a databased url ( " + a + " ) doesn ' t make any sense " ) ; return b | | ( b = " _system " , frontendConfig . db & & ( b = frontendConfig . db ) ) , this . backendUrl ( " / _db / " + encodeURIComponent ( b ) + a ) } , showAuthDialog : function ( ) { var a = ! 0 , b = localStorage . getItem ( " authenticationNotification " ) ; return " false " = = = b & & ( a = ! 1 ) , a } , doNotShowAgain : function ( ) { localStorage . setItem ( " authenticationNotification " , ! 1 ) } , renderEmpty : function ( a ) { $ ( " # content " ) . html ( ' < div class = " noContent " > < p > ' + a + " < / p > < / div > " ) } , download : function ( a , b ) { $ . ajax ( a ) . success ( function ( a , c , d ) { if ( b ) return void b ( a ) ; var e = new Blob ( [ JSON . stringify ( a ) ] , { type : d . getResponseHeader ( " Content - Type " ) | | " application / octet - stream " } ) , f = window . URL . createObjectURL ( e ) , g = document . createElement ( " a " ) ; document . body . appendChild ( g ) , g . style = " display : none " , g . href = f , g . download = d . getResponseHeader ( " Content - Disposition " ) . replace ( / . * filename = " ( [ ^ " ) ] * ) " / , " $ 1 " ) , g . click ( ) , window . URL . revokeObjectURL ( f ) , document . body . removeChild ( 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 } } ( ) , function ( ) { " use strict " ; window . dygraphConfig = { defaultFrame : 12e5 , zeropad : function ( a ) { return a < 10 ? " 0 " + a : a } , xAxisFormat : function ( a ) { if ( a = = = - 1 ) return " " ; var b = new Date ( a ) ; return this . zeropad ( b . getHours ( ) ) + " : " + this . zeropad ( b . getMinutes ( ) ) + " : " + this . zeropad ( b . getSeconds ( ) ) } , mergeObjects : function ( a , b , c ) { c | | ( c = [ ] ) ; var d , e = { } ; return c . forEach ( function ( c ) { var d = a [ c ] , f = b [ c ] ; void 0 = = = d & & ( d = { } ) , void 0 = = = f & & ( f = { } ) , e [ c ] = _ . extend ( d , f ) } ) , d = _ . extend ( a , b ) , Object . keys ( e ) . forEach ( function ( a ) { d [ a ] = e [ a ] } ) , d } , mapStatToFigure : { pageFaults : [ " times " , " majorPageFaultsPerSecond " , " minorPageFaultsPerSecond " ] , systemUserTime : [ " times " , " systemTimePerSecond " , " userTimePerSecond " ] , totalTime : [ " times " , " avgQueueTime " , " avgRequestTime " , " avgIoTime " ] , dataTransfer : [ " times " , " bytesSentPerSecond " , " bytesReceivedPerSecond " ] , requests : [ " times " , " getsPerSecond " , " putsPerSecond " , " postsPerSecond " , " deletesPerSecond " , " patchesPerSecond " , " headsPerSecond " , " optionsPerSecond " , " othersPerSecond " ] } , colors : [ " rgb ( 95 , 194 , 135 ) " , " rgb ( 238 , 190 , 77 ) " , " # 81ccd8 " , " # 7ca530 " , " # 3c3c3c " , " # aa90bd " , " # e1811d " , " # c7d4b2 " , " # d0b2d4 " ] , figureDependedOptions : { clusterRequestsPerSecond : { showLabelsOnHighlight : ! 0 , title : " " , header : " Cluster Requests per Second " , stackedGraph : ! 0 , div : " lineGraphLegend " , labelsKMG2 : ! 1 , axes : { y : { valueFormatter : function ( a ) { return parseFloat ( a . toPrecision ( 3 ) ) } , axisLabelFormatter : function ( a ) { return 0 = = = a ? 0 : parseFloat ( a . toPrecision ( 3 ) ) } } } } , pageFaults : { header : " Page Faults " , visibility : [ ! 0 , ! 1 ] , labels : [ " datetime " , " Major Page " , " Minor Page " ] , div : " pageFaultsChart " , labelsKMG2 : ! 1 , axes : { y : { valueFormatter : function ( a ) { return parseFloat ( a . toPrecision ( 3 ) ) } , axisLabelFormatter : function ( a ) { return 0 = = = a ? 0 : parseFloat ( a . toPrecision ( 3 ) ) } } } } , systemUserTime : { div : " systemUserTimeChart " , header : " System and User Time " , labels : [ " datetime " , " System Time " , " User Time " ] , stackedGraph : ! 0 , labelsKMG2 : ! 1 , axes : { y : { valueFormatter : function ( a ) { return parseFloat ( a . toPrecision ( 3 ) ) } , axisLabelFormatter : function ( a ) { return 0 = = = a ? 0 : parseFloat ( a . toPrecision ( 3 ) ) } } } } , totalTime : { div : " totalTimeChart " , header : " Total Time " , labels : [ " datetime " , " Queue " , " Computation " , " I / O " ] , labelsKMG2 : ! 1 , axes : { y : { valueFormatter : function ( a ) { return parseFloat ( a . toPrecision ( 3 ) ) } , axisLabelFormatter : function ( a ) { return 0 = = = a ? 0 : parseFloat ( a . toPrecision ( 3 ) ) } } } , stackedGraph : ! 0 } , dataTransfer : { header : " Data Transfer " , labels : [ " datetime " , " Bytes sent " , " Bytes received " ] , stackedGraph : ! 0 , div : " dataTransferChart " } , requests : { header : " Requests " , labels : [ " datetime " , " Reads " , " Writes " ] , stackedGraph : ! 0 , div : " requestsChart " , axes : { y : { valueFormatter : function ( a ) { return parseFloat ( a . toPrecision ( 3 ) ) } , axisLabelFormatter : function ( a ) { return 0 = = = a ? 0 : parseFloat ( a . toPrecision ( 3 ) ) } } } } } , getDashBoardFigures : function ( a ) { var b = [ ] , c = this ; return Object . keys ( this . figureDependedOptions ) . forEach ( function ( d ) { " clusterRequestsPerSecond " ! = = d & & ( c . figureDependedOptions [ d ] . div | | a ) & & b . push ( d ) } ) , b } , getDefaultConfig : function ( a ) { var b = this , c = { digitsAfterDecimal : 1 , drawGapPoints : ! 0 , fillGraph : ! 0 , fillAlpha : . 85 , showLabelsOnHighlight : ! 1 , strokeWidth : 0 , lineWidth : 0 , strokeBorderWidth : 0 , includeZero : ! 0 , highlightCircleSize : 2 . 5 , labelsSeparateLines : ! 0 , strokeBorderColor : " rgba ( 0 , 0 , 0 , 0 ) " , interactionModel : { } , maxNumberWidth : 10 , colors : [ this . colors [ 0 ] ] , xAxisLabelWidth : " 50 " , rightGap : 15 , showRangeSelector : ! 1 , rangeSelectorHeight : 50 , rangeSelectorPlotStrokeColor : " # 365300 " , rangeSelectorPlotFillColor : " " , pixelsPerLabel : 50 , labelsKMG2 : ! 0 , dateWindow : [ ( new Date ) . getTime ( ) - this . defaultFrame , ( new Date ) . getTime ( ) ] , axes : { x : { valueFormatter : function ( a ) { return b . xAxisFormat ( a ) } } , y : { ticker : Dygraph . numericLinearTicks } } } ; return this . figureDependedOptions [ a ] & & ( c = this . mergeObjects ( c , this . figureDependedOptions [ a ] , [ " axes " ] ) , c . div & & c . labels & & ( c . colors = this . getColors ( c . labels ) , c . labelsDiv = document . getElementById ( c . div + " Legend " ) , c . legend = " always " , c . showLabelsOnHighlight = ! 0 ) ) , c } , getDetailChartConfig : function ( a ) { var b = _ . extend ( this . getDefaultConfig ( a ) , { showRangeSelector : ! 0 , interactionModel : null , showLabelsOnHighlight : ! 0 , highlightCircleSize : 2 . 5 , legend : " always " , labelsDiv : " div # detailLegend . dashboard - legend - inner " } ) ; return " pageFaults " = = = a & & ( b . visibility = [ ! 0 , ! 0 ] ) , b . labels | | ( b . labels = [ " datetime " , b . header ] , b . colors = this . getColors ( b . labels ) ) , b } , getColors : function ( a ) { var b ; return b = this . colors . concat ( [ ] ) , b . slice ( 0 , a . length - 1 ) } } } ( ) , function ( ) { " use strict " ; window . arangoCollectionModel = Backbone . Model . extend ( { idAttribute : " name " , urlRoot : arangoHelper . databaseUrl ( " / _api / collection " ) , defaults : { id : " " , name : " " , status : " " , type : " " , isSystem : ! 1 , picture : " " , locked : ! 1 , desc : void 0 } , getProperties : function ( a ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / collection / " + encodeURIComponent ( this . get ( " id " ) ) + " / properties " ) , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b ) } , error : function ( b ) { a ( ! 0 , b ) } } ) } , getFigures : function ( a ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . get ( " id " ) + " / figures " ) , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b ) } , error : function ( ) { a ( ! 0 ) } } ) } , getRevision : function ( a , b ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . get ( " id " ) + " / revision " ) , contentType : " application / json " , processData : ! 1 , success : function ( c ) { a ( ! 1 , c , b ) } , error : function ( ) { a ( ! 0 ) } } ) } , getIndex : function ( a ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / index / ? collection = " + this . get ( " id " ) ) , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b ) } , error : function ( b ) { a ( ! 0 , b ) } } ) } , createIndex : function ( a , b ) { var c = this ; $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / index ? collection = " + c . get ( " id " ) ) , headers : { " x - arango - async " : " store " } , data : JSON . stringify ( a ) , contentType : " application / json " , processData : ! 1 , success : function ( a , d , e ) { e . getResponseHeader ( " x - arango - async - id " ) ? ( window . arangoHelper . addAardvarkJob ( { id : e . getResponseHeader ( " x - arango - async - id " ) , type : " index " , desc : " Creating Index " , collection : c . get ( " id " ) } ) , b ( ! 1 , a ) ) : b ( ! 0 , a ) } , error : function ( a ) { b ( ! 0 , a ) } } ) } , deleteIndex : function ( a , b ) { var c = this ; <nl> + $ . ajax ( { cache : ! 1 , type : " DELETE " , url : arangoHelper . databaseUrl ( " / _api / index / " + this . get ( " name " ) + " / " + encodeURIComponent ( a ) ) , headers : { " x - arango - async " : " store " } , success : function ( a , d , e ) { e . getResponseHeader ( " x - arango - async - id " ) ? ( window . arangoHelper . addAardvarkJob ( { id : e . getResponseHeader ( " x - arango - async - id " ) , type : " index " , desc : " Removing Index " , collection : c . get ( " id " ) } ) , b ( ! 1 , a ) ) : b ( ! 0 , a ) } , error : function ( a ) { b ( ! 0 , a ) } } ) , b ( ) } , truncateCollection : function ( ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . get ( " id " ) + " / truncate " ) , success : function ( ) { arangoHelper . arangoNotification ( " Collection truncated . " ) } , error : function ( ) { arangoHelper . arangoError ( " Collection error . " ) } } ) } , loadCollection : function ( a ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . get ( " id " ) + " / load " ) , success : function ( ) { a ( ! 1 ) } , error : function ( ) { a ( ! 0 ) } } ) , a ( ) } , unloadCollection : function ( a ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . get ( " id " ) + " / unload ? flush = true " ) , success : function ( ) { a ( ! 1 ) } , error : function ( ) { a ( ! 0 ) } } ) , a ( ) } , renameCollection : function ( a , b ) { var c = this ; $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . get ( " id " ) + " / rename " ) , data : JSON . stringify ( { name : a } ) , contentType : " application / json " , processData : ! 1 , success : function ( ) { c . set ( " name " , a ) , b ( ! 1 ) } , error : function ( a ) { b ( ! 0 , a ) } } ) } , changeCollection : function ( a , b , c , d ) { var e = ! 1 ; " true " = = = a ? a = ! 0 : " false " = = = a & & ( a = ! 1 ) ; var f = { waitForSync : a , journalSize : parseInt ( b , 10 ) , indexBuckets : parseInt ( c , 10 ) } ; return $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . get ( " id " ) + " / properties " ) , data : JSON . stringify ( f ) , contentType : " application / json " , processData : ! 1 , success : function ( ) { d ( ! 1 ) } , error : function ( a ) { d ( ! 1 , a ) } } ) , e } } ) } ( ) , window . DatabaseModel = Backbone . Model . extend ( { idAttribute : " name " , initialize : function ( ) { " use strict " } , isNew : function ( ) { " use strict " ; return ! 1 } , sync : function ( a , b , c ) { " use strict " ; return " update " = = = a & & ( a = " create " ) , Backbone . sync ( a , b , c ) } , url : arangoHelper . databaseUrl ( " / _api / database " ) , defaults : { } } ) , window . arangoDocumentModel = Backbone . Model . extend ( { initialize : function ( ) { " use strict " } , urlRoot : arangoHelper . databaseUrl ( " / _api / document " ) , defaults : { _id : " " , _rev : " " , _key : " " } , getSorted : function ( ) { " use strict " ; var a = this , b = Object . keys ( a . attributes ) . sort ( function ( a , b ) { var c = arangoHelper . isSystemAttribute ( a ) , d = arangoHelper . isSystemAttribute ( b ) ; return c ! = = d ? c ? - 1 : 1 : a < b ? - 1 : 1 } ) , c = { } ; return _ . each ( b , function ( b ) { c [ b ] = a . attributes [ b ] } ) , c } } ) , function ( ) { " use strict " ; window . ArangoQuery = Backbone . Model . extend ( { urlRoot : arangoHelper . databaseUrl ( " / _api / user " ) , defaults : { name : " " , type : " custom " , value : " " } } ) } ( ) , window . Replication = Backbone . Model . extend ( { defaults : { state : { } , server : { } } , initialize : function ( ) { } } ) , window . Statistics = Backbone . Model . extend ( { defaults : { } , url : function ( ) { " use strict " ; return " / _admin / statistics " } } ) , window . StatisticsDescription = Backbone . Model . extend ( { defaults : { figures : " " , groups : " " } , url : function ( ) { " use strict " ; return " / _admin / statistics - description " } } ) , window . Users = Backbone . Model . extend ( { defaults : { user : " " , active : ! 1 , extra : { } } , idAttribute : " user " , parse : function ( a ) { return this . isNotNew = ! 0 , a } , isNew : function ( ) { return ! this . isNotNew } , url : function ( ) { return this . isNew ( ) ? arangoHelper . databaseUrl ( " / _api / user " ) : " " ! = = this . get ( " user " ) ? arangoHelper . databaseUrl ( " / _api / user / " + this . get ( " user " ) ) : arangoHelper . databaseUrl ( " / _api / user " ) } , checkPassword : function ( a , b ) { $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / user / " + this . get ( " user " ) ) , data : JSON . stringify ( { passwd : a } ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { b ( ! 1 , a ) } , error : function ( a ) { b ( ! 0 , a ) } } ) } , setPassword : function ( a ) { $ . ajax ( { cache : ! 1 , type : " PATCH " , url : arangoHelper . databaseUrl ( " / _api / user / " + this . get ( " user " ) ) , data : JSON . stringify ( { passwd : a } ) , contentType : " application / json " , processData : ! 1 } ) } , setExtras : function ( a , b , c ) { $ . ajax ( { cache : ! 1 , type : " PATCH " , url : arangoHelper . databaseUrl ( " / _api / user / " + this . get ( " user " ) ) , data : JSON . stringify ( { extra : { name : a , img : b } } ) , contentType : " application / json " , processData : ! 1 , success : function ( ) { c ( ! 1 ) } , error : function ( ) { c ( ! 0 ) } } ) } } ) , function ( ) { " use strict " ; window . ClusterCoordinator = Backbone . Model . extend ( { defaults : { name : " " , status : " ok " , address : " " , protocol : " " } , idAttribute : " name " , forList : function ( ) { return { name : this . get ( " name " ) , status : this . get ( " status " ) , url : this . get ( " url " ) } } } ) } ( ) , function ( ) { " use strict " ; window . ClusterServer = Backbone . Model . extend ( { defaults : { name : " " , address : " " , role : " " , status : " ok " } , idAttribute : " name " , forList : function ( ) { return { name : this . get ( " name " ) , address : this . get ( " address " ) , status : this . get ( " status " ) } } } ) } ( ) , function ( ) { " use strict " ; window . Coordinator = Backbone . Model . extend ( { defaults : { address : " " , protocol : " " , name : " " , status : " " } } ) } ( ) , function ( ) { " use strict " ; window . CurrentDatabase = Backbone . Model . extend ( { url : arangoHelper . databaseUrl ( " / _api / database / current " , frontendConfig . db ) , parse : function ( a ) { return a . result } } ) } ( ) , function ( ) { " use strict " ; var a = function ( a , b , c , d , e , f ) { var g = { contentType : " application / json " , processData : ! 1 , type : c } ; b = b | | function ( ) { } , f = _ . extend ( { mount : a . encodedMount ( ) } , f ) ; var h = _ . reduce ( f , function ( a , b , c ) { return a + encodeURIComponent ( c ) + " = " + encodeURIComponent ( b ) + " & " } , " ? " ) ; g . url = arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes " + ( d ? " / " + d : " " ) + h . slice ( 0 , h . length - 1 ) ) , void 0 ! = = e & & ( g . data = JSON . stringify ( e ) ) , $ . ajax ( g ) . then ( function ( a ) { b ( null , a ) } , function ( a ) { window . xhr = a , b ( _ . extend ( a . status ? new Error ( a . responseJSON ? a . responseJSON . errorMessage : a . responseText ) : new Error ( " Network Error " ) , { statusCode : a . status } ) ) } ) } ; window . Foxx = Backbone . Model . extend ( { idAttribute : " mount " , defaults : { author : " Unknown Author " , name : " " , version : " Unknown Version " , description : " No description " , license : " Unknown License " , contributors : [ ] , scripts : { } , config : { } , deps : { } , git : " " , system : ! 1 , development : ! 1 } , isNew : function ( ) { return ! 1 } , encodedMount : function ( ) { return encodeURIComponent ( this . get ( " mount " ) ) } , destroy : function ( b , c ) { a ( this , c , " DELETE " , void 0 , void 0 , b ) } , isBroken : function ( ) { return ! 1 } , needsAttention : function ( ) { return this . isBroken ( ) | | this . needsConfiguration ( ) | | this . hasUnconfiguredDependencies ( ) } , needsConfiguration : function ( ) { return _ . any ( this . get ( " config " ) , function ( a ) { return void 0 = = = a . current & & a . required ! = = ! 1 } ) } , hasUnconfiguredDependencies : function ( ) { return _ . any ( this . get ( " deps " ) , function ( a ) { return void 0 = = = a . current & & a . definition . required ! = = ! 1 } ) } , getConfiguration : function ( b ) { a ( this , function ( a , c ) { a | | this . set ( " config " , c ) , " function " = = typeof b & & b ( a , c ) } . bind ( this ) , " GET " , " config " ) } , setConfiguration : function ( b , c ) { a ( this , c , " PATCH " , " config " , b ) } , getDependencies : function ( b ) { a ( this , function ( a , c ) { a | | this . set ( " deps " , c ) , " function " = = typeof b & & b ( a , c ) } . bind ( this ) , " GET " , " deps " ) } , setDependencies : function ( b , c ) { a ( this , c , " PATCH " , " deps " , b ) } , toggleDevelopment : function ( b , c ) { a ( this , function ( a , d ) { a | | this . set ( " development " , b ) , " function " = = typeof c & & c ( a , d ) } . bind ( this ) , " PATCH " , " devel " , b ) } , runScript : function ( b , c , d ) { a ( this , d , " POST " , " scripts / " + b , c ) } , runTests : function ( b , c ) { a ( this , function ( a , b ) { " function " = = typeof c & & c ( a ? a . responseJSON : a , b ) } , " POST " , " tests " , b ) } , isSystem : function ( ) { return this . get ( " system " ) } , isDevelopment : function ( ) { return this . get ( " development " ) } , download : function ( ) { a ( this , function ( a , b ) { return a ? void console . error ( a . responseJSON ) : void ( window . location . href = arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes / download / zip ? mount = " + this . encodedMount ( ) + " & nonce = " + b . nonce ) ) } . bind ( this ) , " POST " , " download / nonce " ) } , fetchThumbnail : function ( a ) { var b = new XMLHttpRequest ; b . responseType = " blob " , b . onload = function ( ) { this . thumbnailUrl = URL . createObjectURL ( b . response ) , a ( ) } . bind ( this ) , b . onerror = a , b . open ( " GET " , " foxxes / thumbnail ? mount = " + this . encodedMount ( ) ) , window . arangoHelper . getCurrentJwt ( ) & & b . setRequestHeader ( " Authorization " , " bearer " + window . arangoHelper . getCurrentJwt ( ) ) , b . send ( ) } } ) } ( ) , function ( ) { " use strict " ; window . Graph = Backbone . Model . extend ( { idAttribute : " _key " , urlRoot : arangoHelper . databaseUrl ( " / _api / gharial " ) , isNew : function ( ) { return ! this . get ( " _id " ) } , parse : function ( a ) { return a . graph | | a } , addEdgeDefinition : function ( a ) { $ . ajax ( { async : ! 1 , type : " POST " , url : this . urlRoot + " / " + this . get ( " _key " ) + " / edge " , data : JSON . stringify ( a ) } ) } , deleteEdgeDefinition : function ( a ) { $ . ajax ( { async : ! 1 , type : " DELETE " , url : this . urlRoot + " / " + this . get ( " _key " ) + " / edge / " + a } ) } , modifyEdgeDefinition : function ( a ) { $ . ajax ( { async : ! 1 , type : " PUT " , url : this . urlRoot + " / " + this . get ( " _key " ) + " / edge / " + a . collection , data : JSON . stringify ( a ) } ) } , addVertexCollection : function ( a ) { $ . ajax ( { async : ! 1 , type : " POST " , url : this . urlRoot + " / " + this . get ( " _key " ) + " / vertex " , data : JSON . stringify ( { collection : a } ) } ) } , deleteVertexCollection : function ( a ) { $ . ajax ( { async : ! 1 , type : " DELETE " , url : this . urlRoot + " / " + this . get ( " _key " ) + " / vertex / " + a } ) } , defaults : { name : " " , edgeDefinitions : [ ] , orphanCollections : [ ] } } ) } ( ) , function ( ) { " use strict " ; window . newArangoLog = Backbone . Model . extend ( { defaults : { lid : " " , level : " " , timestamp : " " , text : " " , totalAmount : " " } , getLogStatus : function ( ) { switch ( this . get ( " level " ) ) { case 1 : return " Error " ; case 2 : return " Warning " ; case 3 : return " Info " ; case 4 : return " Debug " ; default : return " Unknown " } } } ) } ( ) , function ( ) { " use strict " ; window . Notification = Backbone . Model . extend ( { defaults : { title : " " , date : 0 , content : " " , priority : " " , tags : " " , seen : ! 1 } } ) } ( ) , function ( ) { " use strict " ; window . queryManagementModel = Backbone . Model . extend ( { defaults : { id : " " , query : " " , started : " " , runTime : " " } } ) } ( ) , window . UserConfig = Backbone . Model . extend ( { defaults : { graphs : " " , queries : [ ] } , model : window . UserConfigModel , parse : function ( a ) { return a . result } , url : function ( ) { return window . App . currentUser ? this . username = window . App . currentUser : this . username = " root " , arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( this . username ) + " / config " ) } , setItem : function ( a , b , c ) { var d = this ; $ . ajax ( { type : " PUT " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( this . username ) + " / config / " + encodeURIComponent ( a ) ) , contentType : " application / json " , processData : ! 1 , data : JSON . stringify ( { value : b } ) , async : ! 0 , success : function ( ) { d . set ( a , b ) , c & & c ( ) } , error : function ( ) { arangoHelper . arangoError ( " User configuration " , " Could not update user configuration for key : " + a ) } } ) } , getItem : function ( a , b ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( this . username ) + " / config / " + encodeURIComponent ( a ) ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( a ) { b ( a ) } , error : function ( ) { arangoHelper . arangoError ( " User configuration " , " Could not fetch user configuration for key : " + a ) } } ) } } ) , function ( ) { " use strict " ; window . workMonitorModel = Backbone . Model . extend ( { defaults : { name : " " , number : " " , status : " " , type : " " } } ) } ( ) , function ( ) { " use strict " ; window . AutomaticRetryCollection = Backbone . Collection . extend ( { _retryCount : 0 , checkRetries : function ( ) { var a = this ; return this . updateUrl ( ) , ! ( this . _retryCount > 10 ) | | ( window . setTimeout ( function ( ) { a . _retryCount = 0 } , 1e4 ) , window . App . clusterUnreachable ( ) , ! 1 ) } , successFullTry : function ( ) { this . _retryCount = 0 } , failureTry : function ( a , b , c ) { 401 = = = c . status ? window . App . requestAuth ( ) : ( window . App . clusterPlan . rotateCoordinator ( ) , this . _retryCount + + , a ( ) ) } } ) } ( ) , function ( ) { " use strict " ; window . PaginatedCollection = Backbone . Collection . extend ( { page : 0 , pagesize : 10 , totalAmount : 0 , getPage : function ( ) { return this . page + 1 } , setPage : function ( a ) { return a > = this . getLastPageNumber ( ) ? void ( this . page = this . getLastPageNumber ( ) - 1 ) : a < 1 ? void ( this . page = 0 ) : void ( this . page = a - 1 ) } , getLastPageNumber : function ( ) { return Math . max ( Math . ceil ( this . totalAmount / this . pagesize ) , 1 ) } , getOffset : function ( ) { return this . page * this . pagesize } , getPageSize : function ( ) { return this . pagesize } , setPageSize : function ( a ) { if ( " all " = = = a ) this . pagesize = " all " ; else try { a = parseInt ( a , 10 ) , this . pagesize = a } catch ( b ) { } } , setToFirst : function ( ) { this . page = 0 } , setToLast : function ( ) { this . setPage ( this . getLastPageNumber ( ) ) } , setToPrev : function ( ) { this . setPage ( this . getPage ( ) - 1 ) } , setToNext : function ( ) { this . setPage ( this . getPage ( ) + 1 ) } , setTotal : function ( a ) { this . totalAmount = a } , getTotal : function ( ) { return this . totalAmount } , setTotalMinusOne : function ( ) { this . totalAmount - - } } ) } ( ) , window . ClusterStatisticsCollection = Backbone . Collection . extend ( { model : window . Statistics , url : " / _admin / statistics " , updateUrl : function ( ) { this . url = window . App . getNewRoute ( this . host ) + this . url } , initialize : function ( a , b ) { this . host = b . host , window . App . registerForUpdate ( this ) } } ) , function ( ) { " use strict " ; window . ArangoCollections = Backbone . Collection . extend ( { url : arangoHelper . databaseUrl ( " / _api / collection " ) , model : arangoCollectionModel , searchOptions : { searchPhrase : null , includeSystem : ! 1 , includeDocument : ! 0 , includeEdge : ! 0 , includeLoaded : ! 0 , includeUnloaded : ! 0 , sortBy : " name " , sortOrder : 1 } , translateStatus : function ( a ) { switch ( a ) { case 0 : return " corrupted " ; case 1 : return " new born collection " ; case 2 : return " unloaded " ; case 3 : return " loaded " ; case 4 : return " unloading " ; case 5 : return " deleted " ; case 6 : return " loading " ; default : return } } , translateTypePicture : function ( a ) { var b = " " ; switch ( a ) { case " document " : b + = " fa - file - text - o " ; break ; case " edge " : b + = " fa - share - alt " ; break ; case " unknown " : b + = " fa - question " ; break ; default : b + = " fa - cogs " } return b } , parse : function ( a ) { var b = this ; return _ . each ( a . result , function ( a ) { a . isSystem = arangoHelper . isSystemCollection ( a ) , a . type = arangoHelper . collectionType ( a ) , a . status = b . translateStatus ( a . status ) , a . picture = b . translateTypePicture ( a . type ) } ) , a . result } , getPosition : function ( a ) { var b , c = this . getFiltered ( this . searchOptions ) , d = null , e = null ; for ( b = 0 ; b < c . length ; + + b ) c [ b ] . get ( " name " ) = = = a & & ( b > 0 & & ( d = c [ b - 1 ] ) , b < c . length - 1 & & ( e = c [ b + 1 ] ) ) ; return { prev : d , next : e } } , getFiltered : function ( a ) { var b = [ ] , c = [ ] ; if ( null ! = = a . searchPhrase ) { var d = a . searchPhrase . toLowerCase ( ) ; d = d . replace ( / \ s + / g , " " ) . replace ( / ( ^ \ s + | \ s + $ ) / g , " " ) , c = d . split ( " " ) } return this . models . forEach ( function ( d ) { if ( c . length > 0 ) { var e , f = d . get ( " name " ) . toLowerCase ( ) ; for ( e = 0 ; e < c . length ; + + e ) if ( f . indexOf ( c [ e ] ) = = = - 1 ) return } a . includeSystem = = = ! 1 & & d . get ( " isSystem " ) | | a . includeEdge = = = ! 1 & & " edge " = = = d . get ( " type " ) | | a . includeDocument = = = ! 1 & & " document " = = = d . get ( " type " ) | | a . includeLoaded = = = ! 1 & & " loaded " = = = d . get ( " status " ) | | a . includeUnloaded = = = ! 1 & & " unloaded " = = = d . get ( " status " ) | | b . push ( d ) } ) , b . sort ( function ( b , c ) { var d , e ; return " type " = = = a . sortBy ? ( d = b . get ( " type " ) + " " + b . get ( " name " ) . toLowerCase ( ) , e = c . get ( " type " ) + " " + c . get ( " name " ) . toLowerCase ( ) ) : ( d = b . get ( " name " ) . toLowerCase ( ) , e = c . get ( " name " ) . toLowerCase ( ) ) , d ! = = e ? a . sortOrder * ( d < e ? - 1 : 1 ) : 0 } ) , b } , newCollection : function ( a , b ) { var c = { } ; c . name = a . collName , c . waitForSync = a . wfs , a . journalSize > 0 & & ( c . journalSize = a . journalSize ) , c . isSystem = a . isSystem , c . type = parseInt ( a . collType , 10 ) , a . shards & & ( c . numberOfShards = a . shards , c . shardKeys = a . keys ) , a . replicationFactor & & ( c . replicationFactor = JSON . parse ( a . replicationFactor ) ) , $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / collection " ) , data : JSON . stringify ( c ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { b ( ! 1 , a ) } , error : function ( a ) { b ( ! 0 , a ) } } ) } } ) } ( ) , function ( ) { " use strict " ; window . ArangoDatabase = Backbone . Collection . extend ( { model : window . DatabaseModel , sortOptions : { desc : ! 1 } , url : arangoHelper . databaseUrl ( " / _api / database " ) , comparator : function ( a , b ) { var c = a . get ( " name " ) . toLowerCase ( ) , d = b . get ( " name " ) . toLowerCase ( ) ; return this . sortOptions . desc = = = ! 0 ? c < d ? 1 : c > d ? - 1 : 0 : c > d ? 1 : c < d ? - 1 : 0 } , parse : function ( a ) { if ( a ) return _ . map ( a . result , function ( a ) { return { name : a } } ) } , initialize : function ( ) { var a = this ; this . fetch ( ) . done ( function ( ) { a . sort ( ) } ) } , setSortingDesc : function ( a ) { this . sortOptions . desc = a } , getDatabases : function ( ) { var a = this ; return this . fetch ( ) . done ( function ( ) { a . sort ( ) } ) , this . models } , getDatabasesForUser : function ( a ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : this . url + " / user " , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b . result . sort ( ) ) } , error : function ( ) { a ( ! 0 , [ ] ) } } ) } , createDatabaseURL : function ( a , b , c ) { var d = window . location , e = window . location . hash ; b = b ? " SSL " = = = b | | " https : " = = = b ? " https : " : " http : " : d . protocol , c = c | | d . port ; var f = b + " / / " + window . location . hostname + " : " + c + " / _db / " + encodeURIComponent ( a ) + " / _admin / aardvark / standalone . html " ; if ( e ) { var g = e . split ( " / " ) [ 0 ] ; 0 = = = g . indexOf ( " # collection " ) & & ( g = " # collections " ) , 0 = = = g . indexOf ( " # service " ) & & ( g = " # services " ) , f + = g } return f } , getCurrentDatabase : function ( a ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : this . url + " / current " , contentType : " application / json " , processData : ! 1 , success : function ( b ) { 200 = = = b . code ? a ( ! 1 , b . result . name ) : a ( ! 1 , b ) } , error : function ( b ) { a ( ! 0 , b ) } } ) } , hasSystemAccess : function ( a ) { var b = function ( b , c ) { b ? arangoHelper . arangoError ( " DB " , " Could not fetch databases " ) : a ( ! 1 , _ . includes ( c , " _system " ) ) } ; this . getDatabasesForUser ( b ) } } ) } ( ) , window . ArangoDocument = Backbone . Collection . extend ( { url : " / _api / document / " , model : arangoDocumentModel , collectionInfo : { } , deleteEdge : function ( a , b , c ) { this . deleteDocument ( a , b , c ) } , deleteDocument : function ( a , b , c ) { $ . ajax ( { cache : ! 1 , type : " DELETE " , contentType : " application / json " , url : arangoHelper . databaseUrl ( " / _api / document / " + encodeURIComponent ( a ) + " / " + encodeURIComponent ( b ) ) , success : function ( ) { c ( ! 1 ) } , error : function ( ) { c ( ! 0 ) } } ) } , addDocument : function ( a , b ) { var c = this ; c . createTypeDocument ( a , b ) } , createTypeEdge : function ( a , b , c , d , e ) { var f ; f = d ? JSON . stringify ( { _key : d , _from : b , _to : c } ) : JSON . stringify ( { _from : b , _to : c } ) , $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / document ? collection = " + encodeURIComponent ( a ) ) , data : f , contentType : " application / json " , processData : ! 1 , success : function ( a ) { e ( ! 1 , a ) } , error : function ( a ) { e ( ! 0 , a ) } } ) } , createTypeDocument : function ( a , b , c ) { var d ; d = b ? JSON . stringify ( { _key : b } ) : JSON . stringify ( { } ) , $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / document ? collection = " + encodeURIComponent ( a ) ) , data : d , contentType : " application / json " , processData : ! 1 , success : function ( a ) { c ( ! 1 , a . _id ) } , error : function ( a ) { c ( ! 0 , a . _id ) } } ) } , getCollectionInfo : function ( a , b , c ) { var d = this ; $ . ajax ( { cache : ! 1 , type : " GET " , url : arangoHelper . databaseUrl ( " / _api / collection / " + a + " ? " + arangoHelper . getRandomToken ( ) ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { d . collectionInfo = a , b ( ! 1 , a , c ) } , error : function ( a ) { b ( ! 0 , a , c ) } } ) } , getEdge : function ( a , b , c ) { this . getDocument ( a , b , c ) } , getDocument : function ( a , b , c ) { var d = this ; this . clearDocument ( ) , $ . ajax ( { cache : ! 1 , type : " GET " , url : arangoHelper . databaseUrl ( " / _api / document / " + encodeURIComponent ( a ) + " / " + encodeURIComponent ( b ) ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { d . add ( a ) , c ( ! 1 , a , " document " ) } , error : function ( a ) { d . add ( ! 0 , a ) } } ) } , saveEdge : function ( a , b , c , d , e , f ) { var g ; try { g = JSON . parse ( e ) , g . _to = d , g . _from = c } catch ( h ) { arangoHelper . arangoError ( " Edge " , " Could not parsed document . " ) } $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / document / " + encodeURIComponent ( a ) + " / " + encodeURIComponent ( b ) ) + " # replaceEdge " , data : JSON . stringify ( g ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { f ( ! 1 , a ) } , error : function ( a ) { f ( ! 0 , a ) } } ) } , saveDocument : function ( a , b , c , d ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / document / " + encodeURIComponent ( a ) + " / " + encodeURIComponent ( b ) ) , data : c , contentType : " application / json " , processData : ! 1 , success : function ( a ) { d ( ! 1 , a ) } , error : function ( a ) { d ( ! 0 , a ) } } ) } , updateLocalDocument : function ( a ) { this . clearDocument ( ) , this . add ( a ) } , clearDocument : function ( ) { this . reset ( ) } } ) , function ( ) { " use strict " ; window . ArangoDocuments = window . PaginatedCollection . extend ( { collectionID : 1 , filters : [ ] , checkCursorTimer : void 0 , MAX_SORT : 12e3 , lastQuery : { } , sortAttribute : " " , url : arangoHelper . databaseUrl ( " / _api / documents " ) , model : window . arangoDocumentModel , loadTotal : function ( a ) { var b = this ; $ . ajax ( { cache : ! 1 , type : " GET " , url : arangoHelper . databaseUrl ( " / _api / collection / " + this . collectionID + " / count " ) , contentType : " application / json " , processData : ! 1 , success : function ( c ) { b . setTotal ( c . count ) , a ( ! 1 ) } , error : function ( ) { a ( ! 0 ) } } ) } , setCollection : function ( a ) { var b = function ( a ) { a & & arangoHelper . arangoError ( " Documents " , " Could not fetch documents count " ) } ; this . resetFilter ( ) , this . collectionID = a , this . setPage ( 1 ) , this . loadTotal ( b ) } , setSort : function ( a ) { this . sortAttribute = a } , getSort : function ( ) { return this . sortAttribute } , addFilter : function ( a , b , c ) { this . filters . push ( { attr : a , op : b , val : c } ) } , setFiltersForQuery : function ( a ) { if ( 0 = = = this . filters . length ) return " " ; var b = " FILTER " , c = " " , d = _ . map ( this . filters , function ( b , d ) { return " LIKE " = = = b . op ? ( c = " " + b . op + " ( x . ` " + b . attr + " ` , @ param " , c + = d , c + = " ) " ) : ( c = " IN " = = = b . op | | " NOT IN " = = = b . op ? " " : " x . ` " , c + = b . attr , c + = " IN " = = = b . op | | " NOT IN " = = = b . op ? " " : " ` " , c + = b . op , c + = " IN " = = = b . op | | " NOT IN " = = = b . op ? " x . @ param " : " @ param " , c + = d ) , a [ " param " + d ] = b . val , c } ) ; return b + d . join ( " & & " ) } , setPagesize : function ( a ) { this . setPageSize ( a ) } , resetFilter : function ( ) { this . filters = [ ] } , moveDocument : function ( a , b , c , d ) { var e , f , g , h , i = { " @ collection " : b , filterid : a } ; e = " FOR x IN @ @ collection " , e + = " FILTER x . _key = = @ filterid " , e + = " INSERT x IN " , e + = c , f = " FOR x in @ @ collection " , f + = " FILTER x . _key = = @ filterid " , f + = " REMOVE x IN @ @ collection " , g = { query : e , bindVars : i } , h = { query : f , bindVars : i } , window . progressView . show ( ) , $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / cursor " ) , data : JSON . stringify ( g ) , contentType : " application / json " , success : function ( ) { $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / cursor " ) , data : JSON . stringify ( h ) , contentType : " application / json " , success : function ( ) { d & & d ( ) , window . progressView . hide ( ) } , error : function ( ) { window . progressView . hide ( ) , arangoHelper . arangoError ( " Document error " , " Documents inserted , but could not be removed . " ) } } ) } , error : function ( ) { window . progressView . hide ( ) , arangoHelper . arangoError ( " Document error " , " Could not move selected documents . " ) } } ) } , getDocuments : function ( a ) { var b , c , d , e , f = this ; c = { " @ collection " : this . collectionID , offset : this . getOffset ( ) , count : this . getPageSize ( ) } , b = " FOR x IN @ @ collection LET att = SLICE ( ATTRIBUTES ( x ) , 0 , 25 ) " , b + = this . setFiltersForQuery ( c ) , this . getTotal ( ) < this . MAX_SORT & & ( " _key " = = = this . getSort ( ) ? b + = " SORT TO_NUMBER ( x . " + this . getSort ( ) + " ) = = 0 ? x . " + this . getSort ( ) + " : TO_NUMBER ( x . " + this . getSort ( ) + " ) " : " " ! = = this . getSort ( ) & & ( b + = " SORT x . " + this . getSort ( ) ) ) , " all " ! = = c . count ? b + = " LIMIT @ offset , @ count RETURN KEEP ( x , att ) " : ( d = { " @ collection " : this . collectionID } , c = d , b + = " RETURN KEEP ( x , att ) " ) , e = { query : b , bindVars : c } ; var g = function ( b ) { $ . ajax ( { cache : ! 1 , type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / job / " + encodeURIComponent ( b ) ) , contentType : " application / json " , success : function ( c , d , h ) { 201 = = = h . status ? ( window . progressView . toShow = ! 1 , f . clearDocuments ( ) , c . extra & & void 0 ! = = c . extra . stats . fullCount & & f . setTotal ( c . extra . stats . fullCount ) , 0 ! = = f . getTotal ( ) & & _ . each ( c . result , function ( a ) { f . add ( { id : a . _id , rev : a . _rev , key : a . _key , content : a } ) } ) , f . lastQuery = e , a ( ! 1 , c ) ) : 204 = = = h . status & & ( f . checkCursorTimer = window . setTimeout ( function ( ) { g ( b ) } , 500 ) ) } , error : function ( b ) { a ( ! 1 , b ) } } ) } ; $ . ajax ( { cache : ! 1 , type : " POST " , url : arangoHelper . databaseUrl ( " / _api / cursor " ) , data : JSON . stringify ( e ) , headers : { " x - arango - async " : " store " } , contentType : " application / json " , success : function ( b , c , d ) { if ( d . getResponseHeader ( " x - arango - async - id " ) ) { var e = d . getResponseHeader ( " x - arango - async - id " ) , h = function ( ) { $ . ajax ( { url : arangoHelper . databaseUrl ( " / _api / job / " + encodeURIComponent ( e ) + " / cancel " ) , type : " PUT " , success : function ( ) { window . clearTimeout ( f . checkCursorTimer ) , arangoHelper . arangoNotification ( " Documents " , " Canceled operation . " ) , $ ( " . dataTables_empty " ) . text ( " Canceled . " ) , window . progressView . hide ( ) } } ) } ; window . progressView . showWithDelay ( 300 , " Fetching documents . . . " , h ) , g ( e ) } else a ( ! 0 , b ) } , error : function ( b ) { a ( ! 1 , b ) } } ) } , clearDocuments : function ( ) { this . reset ( ) } , buildDownloadDocumentQuery : function ( ) { var a , b , c ; return c = { " @ collection " : this . collectionID } , a = " FOR x in @ @ collection " , a + = this . setFiltersForQuery ( c ) , this . getTotal ( ) < this . MAX_SORT & & this . getSort ( ) . length > 0 & & ( a + = " SORT x . " + this . getSort ( ) ) , a + = " RETURN x " , b = { query : a , bindVars : c } } , uploadDocuments : function ( a , b ) { $ . ajax ( { type : " POST " , url : arangoHelper . databaseUrl ( " / _api / import ? type = auto & collection = " + encodeURIComponent ( this . collectionID ) + " & createCollection = false " ) , data : a , processData : ! 1 , contentType : " json " , dataType : " json " , complete : function ( a ) { if ( 4 = = = a . readyState & & 201 = = = a . status ) b ( ! 1 ) ; else try { var c = JSON . parse ( a . responseText ) ; if ( c . errors > 0 ) { var d = " At least one error occurred during upload " ; b ( ! 1 , d ) } } catch ( e ) { console . log ( e ) } } } ) } } ) } ( ) , function ( ) { " use strict " ; window . ArangoLogs = window . PaginatedCollection . extend ( { upto : ! 1 , loglevel : 0 , totalPages : 0 , parse : function ( a ) { var b = [ ] ; return _ . each ( a . lid , function ( c , d ) { b . push ( { level : a . level [ d ] , lid : c , text : a . text [ d ] , timestamp : a . timestamp [ d ] , totalAmount : a . totalAmount } ) } ) , this . totalAmount = a . totalAmount , this . totalPages = Math . ceil ( this . totalAmount / this . pagesize ) , b } , initialize : function ( a ) { a . upto = = = ! 0 & & ( this . upto = ! 0 ) , this . loglevel = a . loglevel } , model : window . newArangoLog , url : function ( ) { var a , b , c , d = this . totalAmount - ( this . page + 1 ) * this . pagesize ; return d < 0 & & this . page = = = this . totalPages - 1 ? ( d = 0 , c = this . totalAmount % this . pagesize ) : c = this . pagesize , 0 = = = this . totalAmount & & ( c = 1 ) , a = this . upto ? " upto " : " level " , b = " / _admin / log ? " + a + " = " + this . loglevel + " & size = " + c + " & offset = " + d , arangoHelper . databaseUrl ( b ) } } ) } ( ) , function ( ) { " use strict " ; window . ArangoQueries = Backbone . Collection . extend ( { initialize : function ( a , b ) { var c = this ; $ . ajax ( " whoAmI ? _ = " + Date . now ( ) , { async : ! 0 } ) . done ( function ( a ) { this . activeUser = = = ! 1 | | null = = = this . activeUser ? c . activeUser = " root " : c . activeUser = a . user } ) } , url : arangoHelper . databaseUrl ( " / _api / user / " ) , model : ArangoQuery , activeUser : null , parse : function ( a ) { var b , c = this ; return this . activeUser ! = = ! 1 & & null ! = = this . activeUser | | ( this . activeUser = " root " ) , _ . each ( a . result , function ( a ) { if ( a . user = = = c . activeUser ) try { a . extra . queries & & ( b = a . extra . queries ) } catch ( d ) { } } ) , b } , saveCollectionQueries : function ( a ) { if ( this . activeUser = = = ! 1 | | null = = = this . activeUser ) return ! 1 ; this . activeUser ! = = ! 1 & & null ! = = this . activeUser | | ( this . activeUser = " root " ) ; var b = [ ] ; this . each ( function ( a ) { b . push ( { value : a . attributes . value , parameter : a . attributes . parameter , name : a . attributes . name } ) } ) , $ . ajax ( { cache : ! 1 , type : " PATCH " , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( this . activeUser ) ) , data : JSON . stringify ( { extra : { queries : b } } ) , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b ) } , error : function ( ) { a ( ! 0 ) } } ) } , saveImportQueries : function ( a , b ) { return 0 ! = = this . activeUser & & ( window . progressView . show ( " Fetching documents . . . " ) , void $ . ajax ( { cache : ! 1 , type : " POST " , url : " query / upload / " + encodeURIComponent ( this . activeUser ) , data : a , contentType : " application / json " , processData : ! 1 , success : function ( ) { window . progressView . hide ( ) , arangoHelper . arangoNotification ( " Queries successfully imported . " ) , b ( ) } , error : function ( ) { window . progressView . hide ( ) , arangoHelper . arangoError ( " Query error " , " queries could not be imported " ) } } ) ) } } ) } ( ) , window . ArangoReplication = Backbone . Collection . extend ( { model : window . Replication , url : " . . / api / user " , getLogState : function ( a ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / replication / logger - state " ) , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b ) } , error : function ( b ) { a ( ! 0 , b ) } } ) } , getApplyState : function ( a ) { $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / replication / applier - state " ) , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b ) } , error : function ( b ) { a ( ! 0 , b ) } } ) } } ) , window . StatisticsCollection = Backbone . Collection . extend ( { model : window . Statistics , url : " / _admin / statistics " } ) , window . StatisticsDescriptionCollection = Backbone . Collection . extend ( { model : window . StatisticsDescription , url : " / _admin / statistics - description " , parse : function ( a ) { return a } } ) , window . ArangoUsers = Backbone . Collection . extend ( { model : window . Users , activeUser : null , activeUserSettings : { query : { } , shell : { } , testing : ! 0 } , sortOptions : { desc : ! 1 } , fetch : function ( a ) { return window . App . currentUser & & " _system " ! = = window . App . currentDB . get ( " name " ) & & ( this . url = frontendConfig . basePath + " / _api / user / " + encodeURIComponent ( window . App . currentUser ) ) , Backbone . Collection . prototype . fetch . call ( this , a ) } , url : frontendConfig . basePath + " / _api / user " , comparator : function ( a , b ) { var c = a . get ( " user " ) . toLowerCase ( ) , d = b . get ( " user " ) . toLowerCase ( ) ; return this . sortOptions . desc = = = ! 0 ? c < d ? 1 : c > d ? - 1 : 0 : c > d ? 1 : c < d ? - 1 : 0 } , login : function ( a , b , c ) { var d = this ; $ . ajax ( { url : arangoHelper . databaseUrl ( " / _open / auth " ) , method : " POST " , data : JSON . stringify ( { username : a , password : b } ) , dataType : " json " } ) . success ( function ( a ) { arangoHelper . setCurrentJwt ( a . jwt ) ; var b = a . jwt . split ( " . " ) ; if ( ! b [ 1 ] ) throw new Error ( " Invalid JWT " ) ; if ( ! window . atob ) throw new Error ( " base64 support missing in browser " ) ; var e = JSON . parse ( atob ( b [ 1 ] ) ) ; d . activeUser = e . preferred_username , c ( ! 1 , d . activeUser ) } ) . error ( function ( ) { arangoHelper . setCurrentJwt ( null ) , d . activeUser = null , c ( ! 0 , null ) } ) } , setSortingDesc : function ( a ) { this . sortOptions . desc = a } , logout : function ( ) { arangoHelper . setCurrentJwt ( null ) , this . activeUser = null , this . reset ( ) , window . App . navigate ( " " ) , window . location . reload ( ) } , setUserSettings : function ( a , b ) { this . activeUserSettings . identifier = b } , loadUserSettings : function ( a ) { var b = this ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( b . activeUser ) ) , contentType : " application / json " , processData : ! 1 , success : function ( c ) { b . activeUserSettings = c . extra , a ( ! 1 , c ) } , error : function ( b ) { a ( ! 0 , b ) } } ) } , saveUserSettings : function ( a ) { var b = this ; $ . ajax ( { cache : ! 1 , type : " PUT " , url : frontendConfig . basePath + " / _api / user / " + encodeURIComponent ( b . activeUser ) , data : JSON . stringify ( { extra : b . activeUserSettings } ) , contentType : " application / json " , processData : ! 1 , success : function ( b ) { a ( ! 1 , b ) } , error : function ( b ) { a ( ! 0 , b ) } } ) } , parse : function ( a ) { var b = [ ] ; return a . result ? _ . each ( a . result , function ( a ) { b . push ( a ) } ) : b . push ( { user : a . user , active : a . active , extra : a . extra , changePassword : a . changePassword } ) , b } , whoAmI : function ( a ) { return this . activeUser ? void a ( ! 1 , this . activeUser ) : void $ . ajax ( " whoAmI ? _ = " + Date . now ( ) ) . success ( function ( b ) { a ( ! 1 , b . user ) } ) . error ( function ( ) { a ( ! 0 , null ) } ) } } ) , function ( ) { " use strict " ; window . ClusterCoordinators = window . AutomaticRetryCollection . extend ( { model : window . ClusterCoordinator , url : arangoHelper . databaseUrl ( " / _admin / aardvark / cluster / Coordinators " ) , updateUrl : function ( ) { this . url = window . App . getNewRoute ( " Coordinators " ) } , initialize : function ( ) { } , statusClass : function ( a ) { switch ( a ) { case " ok " : return " success " ; case " warning " : return " warning " ; case " critical " : return " danger " ; case " missing " : return " inactive " ; default : return " danger " } } , getStatuses : function ( a , b ) { if ( this . checkRetries ( ) ) { var c = this ; this . fetch ( { beforeSend : window . App . addAuth . bind ( window . App ) , error : c . failureTry . bind ( c , c . getStatuses . bind ( c , a , b ) ) } ) . done ( function ( ) { c . successFullTry ( ) , c . forEach ( function ( b ) { a ( c . statusClass ( b . get ( " status " ) ) , b . get ( " address " ) ) } ) , b ( ) } ) } } , byAddress : function ( a , b ) { if ( this . checkRetries ( ) ) { var c = this ; this . fetch ( { beforeSend : window . App . addAuth . bind ( window . App ) , error : c . failureTry . bind ( c , c . byAddress . bind ( c , a , b ) ) } ) . done ( function ( ) { c . successFullTry ( ) , a = a | | { } , c . forEach ( function ( b ) { var c = b . get ( " address " ) ; c = c . split ( " : " ) [ 0 ] , a [ c ] = a [ c ] | | { } , a [ c ] . coords = a [ c ] . coords | | [ ] , a [ c ] . coords . push ( b ) } ) , b ( a ) } ) } } , checkConnection : function ( a ) { var b = this ; this . checkRetries ( ) & & this . fetch ( { beforeSend : window . App . addAuth . bind ( window . App ) , error : b . failureTry . bind ( b , b . checkConnection . bind ( b , a ) ) } ) . done ( function ( ) { b . successFullTry ( ) , a ( ) } ) } } ) } ( ) , function ( ) { " use strict " ; window . ClusterServers = window . AutomaticRetryCollection . extend ( { model : window . ClusterServer , host : " " , url : arangoHelper . databaseUrl ( " / _admin / aardvark / cluster / DBServers " ) , updateUrl : function ( ) { this . url = window . App . getNewRoute ( this . host ) + this . url } , initialize : function ( a , b ) { this . host = b . host } , statusClass : function ( a ) { switch ( a ) { case " ok " : return " success " ; case " warning " : return " warning " ; case " critical " : return " danger " ; case " missing " : return " inactive " ; default : return " danger " } } , getStatuses : function ( a ) { if ( this . checkRetries ( ) ) { var b = this , c = function ( ) { b . successFullTry ( ) , b . _retryCount = 0 , b . forEach ( function ( c ) { a ( b . statusClass ( c . get ( " status " ) ) , c . get ( " address " ) ) } ) } ; this . fetch ( { beforeSend : window . App . addAuth . bind ( window . App ) , error : b . failureTry . bind ( b , b . getStatuses . bind ( b , a ) ) } ) . done ( c ) } } , byAddress : function ( a , b ) { if ( this . checkRetries ( ) ) { var c = this ; this . fetch ( { beforeSend : window . App . addAuth . bind ( window . App ) , error : c . failureTry . bind ( c , c . byAddress . bind ( c , a , b ) ) } ) . done ( function ( ) { c . successFullTry ( ) , a = a | | { } , c . forEach ( function ( b ) { var c = b . get ( " address " ) ; c = c . split ( " : " ) [ 0 ] , a [ c ] = a [ c ] | | { } , a [ c ] . dbs = a [ c ] . dbs | | [ ] , a [ c ] . dbs . push ( b ) } ) , b ( a ) } ) . error ( function ( a ) { console . log ( " error " ) , console . log ( a ) } ) } } , getList : function ( ) { throw new Error ( " Do not use " ) } , getOverview : function ( ) { throw new Error ( " Do not use DbServer . getOverview " ) } } ) } ( ) , function ( ) { " use strict " ; window . CoordinatorCollection = Backbone . Collection . extend ( { model : window . Coordinator , url : arangoHelper . databaseUrl ( " / _admin / aardvark / cluster / Coordinators " ) } ) } ( ) , function ( ) { " use strict " ; window . FoxxCollection = Backbone . Collection . extend ( { model : window . Foxx , <nl> + sortOptions : { desc : ! 1 } , url : arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes " ) , comparator : function ( a , b ) { var c , d ; return this . sortOptions . desc = = = ! 0 ? ( c = a . get ( " mount " ) , d = b . get ( " mount " ) , c < d ? 1 : c > d ? - 1 : 0 ) : ( c = a . get ( " mount " ) , d = b . get ( " mount " ) , c > d ? 1 : c < d ? - 1 : 0 ) } , setSortingDesc : function ( a ) { this . sortOptions . desc = a } , installFromGithub : function ( a , b , c , d ) { var e = arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes / git ? mount = " + encodeURIComponent ( b ) ) ; void 0 ! = = d & & ( e + = d ? " & replace = true " : " & upgrade = true " ) , $ . ajax ( { cache : ! 1 , type : " PUT " , url : e , data : JSON . stringify ( a ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { c ( a ) } , error : function ( a ) { c ( a ) } } ) } , installFromStore : function ( a , b , c , d ) { var e = arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes / store ? mount = " + encodeURIComponent ( b ) ) ; void 0 ! = = d & & ( e + = d ? " & replace = true " : " & upgrade = true " ) , $ . ajax ( { cache : ! 1 , type : " PUT " , url : e , data : JSON . stringify ( a ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { c ( a ) } , error : function ( a ) { c ( a ) } } ) } , installFromZip : function ( a , b , c , d ) { var e = arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes / zip ? mount = " + encodeURIComponent ( b ) ) ; void 0 ! = = d & & ( e + = d ? " & replace = true " : " & upgrade = true " ) , $ . ajax ( { cache : ! 1 , type : " PUT " , url : e , data : JSON . stringify ( { zipFile : a } ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { c ( a ) } , error : function ( a ) { c ( a ) } } ) } , generate : function ( a , b , c , d ) { var e = arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes / generate ? mount = " + encodeURIComponent ( b ) ) ; void 0 ! = = d & & ( e + = d ? " & replace = true " : " & upgrade = true " ) , $ . ajax ( { cache : ! 1 , type : " PUT " , url : e , data : JSON . stringify ( a ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { c ( a ) } , error : function ( a ) { c ( a ) } } ) } } ) } ( ) , function ( ) { " use strict " ; window . GraphCollection = Backbone . Collection . extend ( { model : window . Graph , sortOptions : { desc : ! 1 } , url : arangoHelper . databaseUrl ( " / _api / gharial " ) , dropAndDeleteGraph : function ( a , b ) { $ . ajax ( { type : " DELETE " , url : arangoHelper . databaseUrl ( " / _api / gharial / " ) + encodeURIComponent ( a ) + " ? dropCollections = true " , contentType : " application / json " , processData : ! 0 , success : function ( ) { b ( ! 0 ) } , error : function ( ) { b ( ! 1 ) } } ) } , comparator : function ( a , b ) { var c = a . get ( " _key " ) | | " " , d = b . get ( " _key " ) | | " " ; return c = c . toLowerCase ( ) , d = d . toLowerCase ( ) , this . sortOptions . desc = = = ! 0 ? c < d ? 1 : c > d ? - 1 : 0 : c > d ? 1 : c < d ? - 1 : 0 } , setSortingDesc : function ( a ) { this . sortOptions . desc = a } , parse : function ( a ) { if ( ! a . error ) return a . graphs } } ) } ( ) , function ( ) { " use strict " ; window . NotificationCollection = Backbone . Collection . extend ( { model : window . Notification , url : " " } ) } ( ) , function ( ) { " use strict " ; window . QueryManagementActive = Backbone . Collection . extend ( { model : window . queryManagementModel , url : function ( ) { return frontendConfig . basePath + " / _api / query / current " } , killRunningQuery : function ( a , b ) { $ . ajax ( { url : frontendConfig . basePath + " / _api / query / " + encodeURIComponent ( a ) , type : " DELETE " , success : function ( a ) { b ( ) } } ) } } ) } ( ) , function ( ) { " use strict " ; window . QueryManagementSlow = Backbone . Collection . extend ( { model : window . queryManagementModel , url : " / _api / query / slow " , deleteSlowQueryHistory : function ( a ) { var b = this ; $ . ajax ( { url : b . url , type : " DELETE " , success : function ( b ) { a ( ) } } ) } } ) } ( ) , function ( ) { " use strict " ; window . WorkMonitorCollection = Backbone . Collection . extend ( { model : window . workMonitorModel , url : " / _admin / work - monitor " , parse : function ( a ) { return a . work } } ) } ( ) , function ( ) { " use strict " ; window . PaginationView = Backbone . View . extend ( { collection : null , paginationDiv : " " , idPrefix : " " , rerender : function ( ) { } , jumpTo : function ( a ) { this . collection . setPage ( a ) , this . rerender ( ) } , firstPage : function ( ) { this . jumpTo ( 1 ) } , lastPage : function ( ) { this . jumpTo ( this . collection . getLastPageNumber ( ) ) } , firstDocuments : function ( ) { this . jumpTo ( 1 ) } , lastDocuments : function ( ) { this . jumpTo ( this . collection . getLastPageNumber ( ) ) } , prevDocuments : function ( ) { this . jumpTo ( this . collection . getPage ( ) - 1 ) } , nextDocuments : function ( ) { this . jumpTo ( this . collection . getPage ( ) + 1 ) } , renderPagination : function ( ) { $ ( this . paginationDiv ) . html ( " " ) ; var a = this , b = this . collection . getPage ( ) , c = this . collection . getLastPageNumber ( ) , d = $ ( this . paginationDiv ) , e = { page : b , lastPage : c , click : function ( b ) { var c = window . location . hash . split ( " / " ) ; " documents " = = = c [ 2 ] ? ( e . page = b , window . location . hash = c [ 0 ] + " / " + c [ 1 ] + " / " + c [ 2 ] + " / " + b ) : ( a . jumpTo ( b ) , e . page = b ) } } ; d . html ( " " ) , d . pagination ( e ) , $ ( this . paginationDiv ) . prepend ( ' < ul class = " pre - pagi " > < li > < a id = " ' + this . idPrefix + ' _first " class = " pagination - button " > < span > < i class = " fa fa - angle - double - left " / > < / span > < / a > < / li > < / ul > ' ) , $ ( this . paginationDiv ) . append ( ' < ul class = " las - pagi " > < li > < a id = " ' + this . idPrefix + ' _last " class = " pagination - button " > < span > < i class = " fa fa - angle - double - right " / > < / span > < / a > < / li > < / ul > ' ) } } ) } ( ) , function ( ) { " use strict " ; window . ApplicationDetailView = Backbone . View . extend ( { el : " # content " , divs : [ " # readme " , " # swagger " , " # app - info " , " # sideinformation " , " # information " , " # settings " ] , navs : [ " # service - info " , " # service - api " , " # service - readme " , " # service - settings " ] , template : templateEngine . createTemplate ( " applicationDetailView . ejs " ) , events : { " click . open " : " openApp " , " click . delete " : " deleteApp " , " click # app - deps " : " showDepsDialog " , " click # app - switch - mode " : " toggleDevelopment " , " click # app - scripts [ data - script ] " : " runScript " , " click # app - tests " : " runTests " , " click # app - replace " : " replaceApp " , " click # download - app " : " downloadApp " , " click . subMenuEntries li " : " changeSubview " , " click # jsonLink " : " toggleSwagger " , " mouseenter # app - scripts " : " showDropdown " , " mouseleave # app - scripts " : " hideDropdown " } , resize : function ( a ) { a ? $ ( " . innerContent " ) . css ( " height " , " auto " ) : ( $ ( " . innerContent " ) . height ( $ ( " . centralRow " ) . height ( ) - 150 ) , $ ( " # swagger iframe " ) . height ( $ ( " . centralRow " ) . height ( ) - 150 ) , $ ( " # swagger # swaggerJsonContent " ) . height ( $ ( " . centralRow " ) . height ( ) - 150 ) ) } , toggleSwagger : function ( ) { var a = function ( a ) { $ ( " # jsonLink " ) . html ( " JSON " ) , this . jsonEditor . setValue ( JSON . stringify ( a , null , " \ t " ) , 1 ) , $ ( " # swaggerJsonContent " ) . show ( ) , $ ( " # swagger iframe " ) . hide ( ) } . bind ( this ) ; if ( " Swagger " = = = $ ( " # jsonLink " ) . html ( ) ) { var b = arangoHelper . databaseUrl ( " / _admin / aardvark / foxxes / docs / swagger . json ? mount = " + encodeURIComponent ( this . model . get ( " mount " ) ) ) ; arangoHelper . download ( b , a ) } else $ ( " # swaggerJsonContent " ) . hide ( ) , $ ( " # swagger iframe " ) . show ( ) , $ ( " # jsonLink " ) . html ( " Swagger " ) } , changeSubview : function ( a ) { _ . each ( this . navs , function ( a ) { $ ( a ) . removeClass ( " active " ) } ) , $ ( a . currentTarget ) . addClass ( " active " ) , _ . each ( this . divs , function ( a ) { $ ( " . headerButtonBar " ) . hide ( ) , $ ( a ) . hide ( ) } ) , " service - readme " = = = a . currentTarget . id ? ( this . resize ( ! 0 ) , $ ( " # readme " ) . show ( ) ) : " service - api " = = = a . currentTarget . id ? ( this . resize ( ) , $ ( " # swagger " ) . show ( ) ) : " service - info " = = = a . currentTarget . id ? ( this . resize ( ! 0 ) , this . render ( ) , $ ( " # information " ) . show ( ) , $ ( " # sideinformation " ) . show ( ) ) : " service - settings " = = = a . currentTarget . id & & ( this . resize ( ! 0 ) , this . showConfigDialog ( ) , $ ( " . headerButtonBar " ) . show ( ) , $ ( " # settings " ) . show ( ) ) } , downloadApp : function ( ) { this . model . isSystem ( ) | | this . model . download ( ) } , replaceApp : function ( ) { var a = this . model . get ( " mount " ) ; window . foxxInstallView . upgrade ( a , function ( ) { window . App . applicationDetail ( encodeURIComponent ( a ) ) } ) , $ ( " . createModalDialog . arangoHeader " ) . html ( " Replace Service " ) , $ ( " # infoTab " ) . click ( ) } , updateConfig : function ( ) { this . model . getConfiguration ( function ( ) { $ ( " # app - warning " ) [ this . model . needsAttention ( ) ? " show " : " hide " ] ( ) , $ ( " # app - warning - config " ) [ this . model . needsConfiguration ( ) ? " show " : " hide " ] ( ) , this . model . needsConfiguration ( ) ? $ ( " # app - config " ) . addClass ( " error " ) : $ ( " # app - config " ) . removeClass ( " error " ) } . bind ( this ) ) } , updateDeps : function ( ) { this . model . getDependencies ( function ( ) { $ ( " # app - warning " ) [ this . model . needsAttention ( ) ? " show " : " hide " ] ( ) , $ ( " # app - warning - deps " ) [ this . model . hasUnconfiguredDependencies ( ) ? " show " : " hide " ] ( ) , this . model . hasUnconfiguredDependencies ( ) ? $ ( " # app - deps " ) . addClass ( " error " ) : $ ( " # app - deps " ) . removeClass ( " error " ) } . bind ( this ) ) } , toggleDevelopment : function ( ) { this . model . toggleDevelopment ( ! this . model . isDevelopment ( ) , function ( ) { this . model . isDevelopment ( ) ? ( $ ( " . app - switch - mode " ) . text ( " Set Production " ) , $ ( " # app - development - indicator " ) . css ( " display " , " inline " ) , $ ( " # app - development - path " ) . css ( " display " , " inline " ) ) : ( $ ( " . app - switch - mode " ) . text ( " Set Development " ) , $ ( " # app - development - indicator " ) . css ( " display " , " none " ) , $ ( " # app - development - path " ) . css ( " display " , " none " ) ) } . bind ( this ) ) } , runScript : function ( a ) { a . preventDefault ( ) ; var b = $ ( a . currentTarget ) . attr ( " data - script " ) , c = [ window . modalView . createBlobEntry ( " app_script_arguments " , " Script arguments " , " " , null , " optional " , ! 1 , [ { rule : function ( a ) { return a & & JSON . parse ( a ) } , msg : " Must be well - formed JSON or empty " } ] ) ] , d = [ window . modalView . createSuccessButton ( " Run script " , function ( ) { var a = $ ( " # app_script_arguments " ) . val ( ) ; a = a & & JSON . parse ( a ) , window . modalView . hide ( ) , this . model . runScript ( b , a , function ( a , c ) { var d ; d = a ? " < p > The script failed with an error " + ( a . statusCode ? " ( HTTP " + a . statusCode + " ) " : " " ) + " : < / p > < pre > " + a . message + " < / pre > " : c ? " < p > Script results : < / p > < pre > " + JSON . stringify ( c , null , 2 ) + " < / pre > " : " < p > The script ran successfully . < / p > " , window . modalView . show ( " modalTable . ejs " , ' Result of script " ' + b + ' " ' , void 0 , void 0 , void 0 , d ) } ) } . bind ( this ) ) ] ; window . modalView . show ( " modalTable . ejs " , ' Run script " ' + b + ' " on " ' + this . model . get ( " mount " ) + ' " ' , d , c ) } , showSwagger : function ( a ) { a . preventDefault ( ) , this . render ( " swagger " ) } , showReadme : function ( a ) { a . preventDefault ( ) , this . render ( " readme " ) } , runTests : function ( a ) { a . preventDefault ( ) ; var b = " < p > < strong > WARNING : < / strong > Running tests may result in destructive side - effects including data loss . Please make sure not to run tests on a production database . < / p > " ; this . model . isDevelopment ( ) & & ( b + = " < p > < strong > WARNING : < / strong > This app is running in < strong > development mode < / strong > . If any of the tests access the app ' s HTTP API they may become non - deterministic . < / p > " ) ; var c = [ window . modalView . createSuccessButton ( " Run tests " , function ( ) { window . modalView . hide ( ) , this . model . runTests ( { reporter : " suite " } , function ( a , b ) { window . modalView . show ( " modalTestResults . ejs " , " Test results " , void 0 , void 0 , void 0 , a | | b ) } ) } . bind ( this ) ) ] ; window . modalView . show ( " modalTable . ejs " , ' Run tests for app " ' + this . model . get ( " mount " ) + ' " ' , c , void 0 , void 0 , b ) } , render : function ( a ) { return this . resize ( ) , this . model . fetchThumbnail ( function ( ) { var b = function ( b , c ) { var d = this ; b ? arangoHelper . arangoError ( " DB " , " Could not get current database " ) : ( $ ( this . el ) . html ( this . template . render ( { app : this . model , baseUrl : arangoHelper . databaseUrl ( " " , c ) , mode : a } ) ) , d . jsonEditor = ace . edit ( " swaggerJsonEditor " ) , d . jsonEditor . setReadOnly ( ! 0 ) , d . jsonEditor . getSession ( ) . setMode ( " ace / mode / json " ) , $ . ajax ( { url : this . appUrl ( c ) , headers : { accept : " text / html , * / * ; q = 0 . 9 " } } ) . success ( function ( ) { $ ( " . open " , this . el ) . prop ( " disabled " , ! 1 ) } . bind ( this ) ) , this . updateConfig ( ) , this . updateDeps ( ) , " swagger " = = = a & & $ . get ( " . / foxxes / docs / swagger . json ? mount = " + encodeURIComponent ( this . model . get ( " mount " ) ) , function ( a ) { Object . keys ( a . paths ) . length < 1 & & ( d . render ( " readme " ) , $ ( " # app - show - swagger " ) . attr ( " disabled " , " true " ) ) } ) ) , this . breadcrumb ( ) } . bind ( this ) ; arangoHelper . currentDatabase ( b ) , _ . isEmpty ( this . model . get ( " config " ) ) & & $ ( " # service - settings " ) . attr ( " disabled " , ! 0 ) } . bind ( this ) ) , $ ( this . el ) } , breadcrumb : function ( ) { var a = " Service : " + this . model . get ( " name " ) + ' < i class = " fa fa - ellipsis - v " aria - hidden = " true " > < / i > ' , b = ' < p class = " mount " > < span > Contributors : < / span > ' ; this . model . get ( " contributors " ) & & this . model . get ( " contributors " ) . length > 0 ? _ . each ( this . model . get ( " contributors " ) , function ( a ) { b + = ' < a href = " mailto : ' + a . email + ' " > ' + a . name + " < / a > " } ) : b + = " No contributors " , b + = " < / p > " , $ ( " . information " ) . append ( b ) , this . model . get ( " author " ) & & $ ( " . information " ) . append ( ' < p class = " mount " > < span > Author : < / span > ' + this . model . get ( " author " ) + " < / p > " ) , this . model . get ( " mount " ) & & $ ( " . information " ) . append ( ' < p class = " mount " > < span > Mount : < / span > ' + this . model . get ( " mount " ) + " < / p > " ) , this . model . get ( " development " ) & & this . model . get ( " path " ) & & $ ( " . information " ) . append ( ' < p class = " path " > < span > Path : < / span > ' + this . model . get ( " path " ) + " < / p > " ) , $ ( " # subNavigationBar . breadcrumb " ) . html ( a ) } , openApp : function ( ) { var a = function ( a , b ) { a ? arangoHelper . arangoError ( " DB " , " Could not get current database " ) : window . open ( this . appUrl ( b ) , this . model . get ( " title " ) ) . focus ( ) } . bind ( this ) ; arangoHelper . currentDatabase ( a ) } , deleteApp : function ( ) { var a = [ window . modalView . createDeleteButton ( " Delete " , function ( ) { var a = { teardown : $ ( " # app_delete_run_teardown " ) . is ( " : checked " ) } ; this . model . destroy ( a , function ( a , b ) { a | | b . error ! = = ! 1 | | ( window . modalView . hide ( ) , window . App . navigate ( " services " , { trigger : ! 0 } ) ) } ) } . bind ( this ) ) ] , b = [ window . modalView . createCheckboxEntry ( " app_delete_run_teardown " , " Run teardown ? " , ! 0 , " Should this app ' s teardown script be executed before removing the app ? " , ! 0 ) ] ; window . modalView . show ( " modalTable . ejs " , ' Delete Foxx App mounted at " ' + this . model . get ( " mount " ) + ' " ' , a , b , void 0 , " < p > Are you sure ? There is no way back . . . < / p > " , ! 0 ) } , appUrl : function ( a ) { return arangoHelper . databaseUrl ( this . model . get ( " mount " ) , a ) } , applyConfig : function ( ) { var a = { } ; _ . each ( this . model . get ( " config " ) , function ( b , c ) { var d = $ ( " # app_config_ " + c ) , e = d . val ( ) ; if ( " boolean " = = = b . type | | " bool " = = = b . type ) return void ( a [ c ] = d . is ( " : checked " ) ) ; if ( " " = = = e & & b . hasOwnProperty ( " default " ) ) return a [ c ] = b [ " default " ] , void ( " json " = = = b . type & & ( a [ c ] = JSON . stringify ( b [ " default " ] ) ) ) ; if ( " number " = = = b . type ) a [ c ] = parseFloat ( e ) ; else if ( " integer " = = = b . type | | " int " = = = b . type ) a [ c ] = parseInt ( e , 10 ) ; else { if ( " json " ! = = b . type ) return void ( a [ c ] = window . arangoHelper . escapeHtml ( e ) ) ; a [ c ] = e & & JSON . stringify ( JSON . parse ( e ) ) } } ) , this . model . setConfiguration ( a , function ( ) { this . updateConfig ( ) , arangoHelper . arangoNotification ( this . model . get ( " name " ) , " Settings applied . " ) } . bind ( this ) ) } , showConfigDialog : function ( ) { if ( _ . isEmpty ( this . model . get ( " config " ) ) ) return void $ ( " # settings . buttons " ) . html ( $ ( " # hidden_buttons " ) . html ( ) ) ; var a = _ . map ( this . model . get ( " config " ) , function ( a , b ) { var c = void 0 = = = a [ " default " ] ? " " : String ( a [ " default " ] ) , d = void 0 = = = a . current ? " " : String ( a . current ) , e = " createTextEntry " , f = ! 1 , g = [ ] ; return " boolean " = = = a . type | | " bool " = = = a . type ? ( e = " createCheckboxEntry " , a [ " default " ] = a [ " default " ] | | ! 1 , c = a [ " default " ] | | ! 1 , d = a . current | | ! 1 ) : " json " = = = a . type ? ( e = " createBlobEntry " , c = void 0 = = = a [ " default " ] ? " " : JSON . stringify ( a [ " default " ] ) , d = void 0 = = = a . current ? " " : a . current , g . push ( { rule : function ( a ) { return a & & JSON . parse ( a ) } , msg : " Must be well - formed JSON or empty . " } ) ) : " integer " = = = a . type | | " int " = = = a . type ? g . push ( { rule : Joi . number ( ) . integer ( ) . optional ( ) . allow ( " " ) , msg : " Has to be an integer . " } ) : " number " = = = a . type ? g . push ( { rule : Joi . number ( ) . optional ( ) . allow ( " " ) , msg : " Has to be a number . " } ) : ( " password " = = = a . type & & ( e = " createPasswordEntry " ) , g . push ( { rule : Joi . string ( ) . optional ( ) . allow ( " " ) , msg : " Has to be a string . " } ) ) , void 0 = = = a [ " default " ] & & a . required ! = = ! 1 & & ( f = ! 0 , g . unshift ( { rule : Joi . any ( ) . required ( ) , msg : " This field is required . " } ) ) , window . modalView [ e ] ( " app_config_ " + b , b , d , a . description , c , f , g ) } ) , b = [ window . modalView . createSuccessButton ( " Apply " , this . applyConfig . bind ( this ) ) ] ; window . modalView . show ( " modalTable . ejs " , " Configuration " , b , a , null , null , null , null , null , " settings " ) , $ ( " . modal - footer " ) . prepend ( $ ( " # hidden_buttons " ) . html ( ) ) } , applyDeps : function ( ) { var a = { } ; _ . each ( this . model . get ( " deps " ) , function ( b , c ) { var d = $ ( " # app_deps_ " + c ) ; a [ c ] = window . arangoHelper . escapeHtml ( d . val ( ) ) } ) , this . model . setDependencies ( a , function ( ) { window . modalView . hide ( ) , this . updateDeps ( ) } . bind ( this ) ) } , showDepsDialog : function ( ) { if ( ! _ . isEmpty ( this . model . get ( " deps " ) ) ) { var a = _ . map ( this . model . get ( " deps " ) , function ( a , b ) { var c = void 0 = = = a . current ? " " : String ( a . current ) , d = " " , e = a . definition . name ; " * " ! = = a . definition . version & & ( e + = " @ " + a . definition . version ) ; var f = [ { rule : Joi . string ( ) . optional ( ) . allow ( " " ) , msg : " Has to be a string . " } ] ; return a . definition . required & & f . push ( { rule : Joi . string ( ) . required ( ) , msg : " This value is required . " } ) , window . modalView . createTextEntry ( " app_deps_ " + b , a . title , c , e , d , a . definition . required , f ) } ) , b = [ window . modalView . createSuccessButton ( " Apply " , this . applyDeps . bind ( this ) ) ] ; window . modalView . show ( " modalTable . ejs " , " Dependencies " , b , a ) } } , showDropdown : function ( ) { _ . isEmpty ( this . model . get ( " scripts " ) ) | | $ ( " # scripts_dropdown " ) . show ( 200 ) } , hideDropdown : function ( ) { $ ( " # scripts_dropdown " ) . hide ( ) } } ) } ( ) , function ( ) { " use strict " ; window . ApplicationsView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " applicationsView . ejs " ) , events : { " click # addApp " : " createInstallModal " , " click # foxxToggle " : " slideToggle " , " click # checkDevel " : " toggleDevel " , " click # checkProduction " : " toggleProduction " , " click # checkSystem " : " toggleSystem " } , fixCheckboxes : function ( ) { this . _showDevel ? $ ( " # checkDevel " ) . attr ( " checked " , " checked " ) : $ ( " # checkDevel " ) . removeAttr ( " checked " ) , this . _showSystem ? $ ( " # checkSystem " ) . attr ( " checked " , " checked " ) : $ ( " # checkSystem " ) . removeAttr ( " checked " ) , this . _showProd ? $ ( " # checkProduction " ) . attr ( " checked " , " checked " ) : $ ( " # checkProduction " ) . removeAttr ( " checked " ) , $ ( " # checkDevel " ) . next ( ) . removeClass ( " fa fa - check - square - o fa - square - o " ) . addClass ( " fa " ) , $ ( " # checkSystem " ) . next ( ) . removeClass ( " fa fa - check - square - o fa - square - o " ) . addClass ( " fa " ) , $ ( " # checkProduction " ) . next ( ) . removeClass ( " fa fa - check - square - o fa - square - o " ) . addClass ( " fa " ) , arangoHelper . setCheckboxStatus ( " # foxxDropdown " ) } , toggleDevel : function ( ) { var a = this ; this . _showDevel = ! this . _showDevel , _ . each ( this . _installedSubViews , function ( b ) { b . toggle ( " devel " , a . _showDevel ) } ) , this . fixCheckboxes ( ) } , toggleProduction : function ( ) { var a = this ; this . _showProd = ! this . _showProd , _ . each ( this . _installedSubViews , function ( b ) { b . toggle ( " production " , a . _showProd ) } ) , this . fixCheckboxes ( ) } , toggleSystem : function ( ) { this . _showSystem = ! this . _showSystem ; var a = this ; _ . each ( this . _installedSubViews , function ( b ) { b . toggle ( " system " , a . _showSystem ) } ) , this . fixCheckboxes ( ) } , reload : function ( ) { var a = this ; _ . each ( this . _installedSubViews , function ( a ) { a . undelegateEvents ( ) } ) , this . collection . fetch ( { success : function ( ) { a . createSubViews ( ) , a . render ( ) } } ) } , createSubViews : function ( ) { var a = this ; this . _installedSubViews = { } , a . collection . each ( function ( b ) { var c = new window . FoxxActiveView ( { model : b , appsView : a } ) ; a . _installedSubViews [ b . get ( " mount " ) ] = c } ) } , initialize : function ( ) { this . _installedSubViews = { } , this . _showDevel = ! 0 , this . _showProd = ! 0 , this . _showSystem = ! 1 } , slideToggle : function ( ) { $ ( " # foxxToggle " ) . toggleClass ( " activated " ) , $ ( " # foxxDropdownOut " ) . slideToggle ( 200 ) } , createInstallModal : function ( a ) { a . preventDefault ( ) , window . foxxInstallView . install ( this . reload . bind ( this ) ) } , render : function ( ) { this . collection . sort ( ) , $ ( this . el ) . html ( this . template . render ( { } ) ) , _ . each ( this . _installedSubViews , function ( a ) { $ ( " # installedList " ) . append ( a . render ( ) ) } ) , this . delegateEvents ( ) , $ ( " # checkDevel " ) . attr ( " checked " , this . _showDevel ) , $ ( " # checkProduction " ) . attr ( " checked " , this . _showProd ) , $ ( " # checkSystem " ) . attr ( " checked " , this . _showSystem ) , arangoHelper . setCheckboxStatus ( " # foxxDropdown " ) ; var a = this ; return _ . each ( this . _installedSubViews , function ( b ) { b . toggle ( " devel " , a . _showDevel ) , b . toggle ( " system " , a . _showSystem ) } ) , arangoHelper . fixTooltips ( " icon_arangodb " , " left " ) , this } } ) } ( ) , function ( ) { " use strict " ; window . ClusterView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " clusterView . ejs " ) , events : { } , statsEnabled : ! 1 , historyInit : ! 1 , initDone : ! 1 , interval : 5e3 , maxValues : 100 , knownServers : [ ] , chartData : { } , charts : { } , nvcharts : [ ] , startHistory : { } , startHistoryAccumulated : { } , initialize : function ( a ) { var b = this ; window . App . isCluster & & ( this . dbServers = a . dbServers , this . coordinators = a . coordinators , this . updateServerTime ( ) , window . setInterval ( function ( ) { if ( " # cluster " = = = window . location . hash | | " " = = = window . location . hash | | " # " = = = window . location . hash ) { var a = function ( a ) { b . rerenderValues ( a ) , b . rerenderGraphs ( a ) } ; b . getCoordStatHistory ( a ) } } , this . interval ) ) } , render : function ( ) { this . $ el . html ( this . template . render ( { } ) ) , this . initDone | | ( void 0 ! = = this . coordinators . first ( ) ? this . getServerStatistics ( ) : this . waitForCoordinators ( ) , this . initDone = ! 0 ) , this . initGraphs ( ) } , waitForCoordinators : function ( ) { var a = this ; window . setTimeout ( function ( ) { a . coordinators ? a . getServerStatistics ( ) : a . waitForCoordinators ( ) } , 500 ) } , updateServerTime : function ( ) { this . serverTime = ( new Date ) . getTime ( ) } , getServerStatistics : function ( ) { var a = this ; this . data = void 0 ; var b = this . coordinators . first ( ) ; this . statCollectCoord = new window . ClusterStatisticsCollection ( [ ] , { host : b . get ( " address " ) } ) , this . statCollectDBS = new window . ClusterStatisticsCollection ( [ ] , { host : b . get ( " address " ) } ) ; var c = [ ] ; _ . each ( this . dbServers , function ( a ) { a . each ( function ( a ) { c . push ( a ) } ) } ) , _ . each ( c , function ( c ) { if ( " ok " = = = c . get ( " status " ) ) { a . knownServers . indexOf ( c . id ) = = = - 1 & & a . knownServers . push ( c . id ) ; var d = new window . Statistics ( { name : c . id } ) ; d . url = b . get ( " protocol " ) + " : / / " + b . get ( " address " ) + " / _admin / clusterStatistics ? DBserver = " + c . get ( " name " ) , a . statCollectDBS . add ( d ) } } ) , this . coordinators . forEach ( function ( b ) { if ( " ok " = = = b . get ( " status " ) ) { a . knownServers . indexOf ( b . id ) = = = - 1 & & a . knownServers . push ( b . id ) ; var c = new window . Statistics ( { name : b . id } ) ; c . url = b . get ( " protocol " ) + " : / / " + b . get ( " address " ) + " / _admin / statistics " , a . statCollectCoord . add ( c ) } } ) ; var d = function ( b ) { a . rerenderValues ( b ) , a . rerenderGraphs ( b ) } ; a . getCoordStatHistory ( d ) , a . renderNodes ( ) } , rerenderValues : function ( a ) { var b = this ; b . renderNodes ( ) , this . renderValue ( " # clusterConnections " , Math . round ( a . clientConnectionsCurrent ) ) , this . renderValue ( " # clusterConnectionsAvg " , Math . round ( a . clientConnections15M ) ) ; var c = a . physicalMemory , d = a . residentSizeCurrent ; this . renderValue ( " # clusterRam " , [ d , c ] ) } , renderValue : function ( a , b , c , d ) { if ( " number " = = typeof b ) $ ( a ) . html ( b ) ; else if ( $ . isArray ( b ) ) { var e = b [ 0 ] , f = b [ 1 ] , g = 1 / ( f / e ) * 100 ; g > 90 ? c = ! 0 : g > 70 & & g < 90 & & ( d = ! 0 ) , $ ( a ) . html ( g . toFixed ( 1 ) + " % " ) } else " string " = = typeof b & & $ ( a ) . html ( b ) ; c ? ( $ ( a ) . addClass ( " negative " ) , $ ( a ) . removeClass ( " warning " ) , $ ( a ) . removeClass ( " positive " ) ) : d ? ( $ ( a ) . addClass ( " warning " ) , $ ( a ) . removeClass ( " positive " ) , $ ( a ) . removeClass ( " negative " ) ) : ( $ ( a ) . addClass ( " positive " ) , $ ( a ) . removeClass ( " negative " ) , $ ( a ) . removeClass ( " warning " ) ) } , renderNodes : function ( ) { var a = this , b = function ( a ) { var b = 0 , c = 0 , d = 0 , e = 0 ; _ . each ( a , function ( a ) { " Coordinator " = = = a . Role ? ( b + + , " GOOD " ! = = a . Status & & c + + ) : " DBServer " = = = a . Role & & ( d + + , " GOOD " ! = = a . Status & & e + + ) } ) , c > 0 ? this . renderValue ( " # clusterCoordinators " , b - c + " / " + b , ! 0 ) : this . renderValue ( " # clusterCoordinators " , b ) , e > 0 ? this . renderValue ( " # clusterDBServers " , d - e + " / " + d , ! 0 ) : this . renderValue ( " # clusterDBServers " , d ) } . bind ( this ) ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / health " ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( a ) { b ( a . Health ) } , error : function ( ) { a . renderValue ( " # clusterCoordinators " , " N / A " , ! 0 ) , a . renderValue ( " # clusterDBServers " , " N / A " , ! 0 ) } } ) } , initValues : function ( ) { var a = [ " # clusterNodes " , " # clusterRam " , " # clusterConnections " , " # clusterConnectionsAvg " ] ; _ . each ( a , function ( a ) { $ ( a ) . html ( ' < i class = " fa fa - spin fa - circle - o - notch " style = " color : rgba ( 0 , 0 , 0 , 0 . 64 ) ; " > < / i > ' ) } ) } , graphData : { data : { sent : [ ] , received : [ ] } , http : [ ] , average : [ ] } , checkArraySizes : function ( ) { var a = this ; _ . each ( a . chartsOptions , function ( b , c ) { _ . each ( b . options , function ( b , d ) { b . values . length > a . maxValues - 1 & & a . chartsOptions [ c ] . options [ d ] . values . shift ( ) } ) } ) } , formatDataForGraph : function ( a ) { var b = this ; b . historyInit ? ( b . checkArraySizes ( ) , b . chartsOptions [ 0 ] . options [ 0 ] . values . push ( { x : a . times [ a . times . length - 1 ] , y : a . bytesSentPerSecond [ a . bytesSentPerSecond . length - 1 ] } ) , b . chartsOptions [ 0 ] . options [ 1 ] . values . push ( { x : a . times [ a . times . length - 1 ] , y : a . bytesReceivedPerSecond [ a . bytesReceivedPerSecond . length - 1 ] } ) , b . chartsOptions [ 1 ] . options [ 0 ] . values . push ( { x : a . times [ a . times . length - 1 ] , y : b . calcTotalHttp ( a . http , a . bytesSentPerSecond . length - 1 ) } ) , b . chartsOptions [ 2 ] . options [ 0 ] . values . push ( { x : a . times [ a . times . length - 1 ] , y : a . avgRequestTime [ a . bytesSentPerSecond . length - 1 ] / b . coordinators . length } ) ) : ( _ . each ( a . times , function ( c , d ) { b . chartsOptions [ 0 ] . options [ 0 ] . values . push ( { x : c , y : a . bytesSentPerSecond [ d ] } ) , b . chartsOptions [ 0 ] . options [ 1 ] . values . push ( { x : c , y : a . bytesReceivedPerSecond [ d ] } ) , b . chartsOptions [ 1 ] . options [ 0 ] . values . push ( { x : c , y : b . calcTotalHttp ( a . http , d ) } ) , b . chartsOptions [ 2 ] . options [ 0 ] . values . push ( { x : c , y : a . avgRequestTime [ d ] / b . coordinators . length } ) } ) , b . historyInit = ! 0 ) } , chartsOptions : [ { id : " # clusterData " , type : " bytes " , count : 2 , options : [ { area : ! 0 , values : [ ] , key : " Bytes out " , color : " rgb ( 23 , 190 , 207 ) " , strokeWidth : 2 , fillOpacity : . 1 } , { area : ! 0 , values : [ ] , key : " Bytes in " , color : " rgb ( 188 , 189 , 34 ) " , strokeWidth : 2 , fillOpacity : . 1 } ] } , { id : " # clusterHttp " , type : " bytes " , options : [ { area : ! 0 , values : [ ] , key : " Bytes " , color : " rgb ( 0 , 166 , 90 ) " , fillOpacity : . 1 } ] } , { id : " # clusterAverage " , data : [ ] , type : " seconds " , options : [ { area : ! 0 , values : [ ] , key : " Seconds " , color : " rgb ( 243 , 156 , 18 ) " , fillOpacity : . 1 } ] } ] , initGraphs : function ( ) { var a = this , b = " No data . . . " ; _ . each ( a . chartsOptions , function ( c ) { nv . addGraph ( function ( ) { a . charts [ c . id ] = nv . models . stackedAreaChart ( ) . options ( { useInteractiveGuideline : ! 0 , showControls : ! 1 , noData : b , duration : 0 } ) , a . charts [ c . id ] . xAxis . axisLabel ( " " ) . tickFormat ( function ( a ) { var b = new Date ( 1e3 * a ) ; return ( b . getHours ( ) < 10 ? " 0 " : " " ) + b . getHours ( ) + " : " + ( b . getMinutes ( ) < 10 ? " 0 " : " " ) + b . getMinutes ( ) + " : " + ( b . getSeconds ( ) < 10 ? " 0 " : " " ) + b . getSeconds ( ) } ) . staggerLabels ( ! 1 ) , a . charts [ c . id ] . yAxis . axisLabel ( " " ) . tickFormat ( function ( a ) { var b ; return " bytes " = = = c . type ? null = = = a ? " N / A " : ( b = parseFloat ( d3 . format ( " . 2f " ) ( a ) ) , prettyBytes ( b ) ) : " seconds " = = = c . type ? null = = = a ? " N / A " : b = parseFloat ( d3 . format ( " . 3f " ) ( a ) ) : void 0 } ) ; var d , e = a . returnGraphOptions ( c . id ) ; return e . length > 0 ? _ . each ( e , function ( a , b ) { c . options [ b ] . values = a } ) : c . options [ 0 ] . values = [ ] , d = c . options , a . chartData [ c . id ] = d3 . select ( c . id ) . append ( " svg " ) . datum ( d ) . transition ( ) . duration ( 300 ) . call ( a . charts [ c . id ] ) . each ( " start " , function ( ) { window . setTimeout ( function ( ) { d3 . selectAll ( c . id + " * " ) . each ( function ( ) { this . __transition__ & & ( this . __transition__ . duration = 0 ) } ) } , 0 ) } ) , nv . utils . windowResize ( a . charts [ c . id ] . update ) , a . nvcharts . push ( a . charts [ c . id ] ) , a . charts [ c . id ] } ) } ) } , returnGraphOptions : function ( a ) { var b = [ ] ; return b = " # clusterData " = = = a ? [ this . chartsOptions [ 0 ] . options [ 0 ] . values , this . chartsOptions [ 0 ] . options [ 1 ] . values ] : " # clusterHttp " = = = a ? [ this . chartsOptions [ 1 ] . options [ 0 ] . values ] : " # clusterAverage " = = = a ? [ this . chartsOptions [ 2 ] . options [ 0 ] . values ] : [ ] } , rerenderGraphs : function ( a ) { if ( this . statsEnabled ) { var b , c , d = this ; this . formatDataForGraph ( a ) , _ . each ( d . chartsOptions , function ( a ) { c = d . returnGraphOptions ( a . id ) , c . length > 0 ? _ . each ( c , function ( b , c ) { a . options [ c ] . values = b } ) : a . options [ 0 ] . values = [ ] , b = a . options , b [ 0 ] . values . length > 0 & & d . historyInit & & d . charts [ a . id ] & & d . charts [ a . id ] . update ( ) } ) } } , calcTotalHttp : function ( a , b ) { var c = 0 ; return _ . each ( a , function ( a ) { c + = a [ b ] } ) , c } , getCoordStatHistory : function ( a ) { $ . ajax ( { url : " statistics / coordshort " , json : ! 0 } ) . success ( function ( b ) { this . statsEnabled = b . enabled , a ( b . data ) } . bind ( this ) ) } } ) } ( ) , function ( ) { " use strict " ; window . CollectionListItemView = Backbone . View . extend ( { tagName : " div " , className : " tile pure - u - 1 - 1 pure - u - sm - 1 - 2 pure - u - md - 1 - 3 pure - u - lg - 1 - 4 pure - u - xl - 1 - 6 " , template : templateEngine . createTemplate ( " collectionsItemView . ejs " ) , initialize : function ( a ) { this . collectionsView = a . collectionsView } , events : { " click . iconSet . icon_arangodb_settings2 " : " createEditPropertiesModal " , " click . pull - left " : " noop " , " click . icon_arangodb_settings2 " : " editProperties " , " click . spanInfo " : " showProperties " , click : " selectCollection " } , render : function ( ) { return this . model . get ( " locked " ) ? ( $ ( this . el ) . addClass ( " locked " ) , $ ( this . el ) . addClass ( this . model . get ( " lockType " ) ) ) : $ ( this . el ) . removeClass ( " locked " ) , " loading " ! = = this . model . get ( " status " ) & & " unloading " ! = = this . model . get ( " status " ) | | $ ( this . el ) . addClass ( " locked " ) , $ ( this . el ) . html ( this . template . render ( { model : this . model } ) ) , $ ( this . el ) . attr ( " id " , " collection_ " + this . model . get ( " name " ) ) , this } , editProperties : function ( a ) { return this . model . get ( " locked " ) ? 0 : ( a . stopPropagation ( ) , void this . createEditPropertiesModal ( ) ) } , showProperties : function ( a ) { return this . model . get ( " locked " ) ? 0 : ( a . stopPropagation ( ) , void this . createInfoModal ( ) ) } , selectCollection : function ( a ) { return $ ( a . target ) . hasClass ( " disabled " ) ? 0 : this . model . get ( " locked " ) ? 0 : " loading " = = = this . model . get ( " status " ) ? 0 : void ( " unloaded " = = = this . model . get ( " status " ) ? this . loadCollection ( ) : window . App . navigate ( " collection / " + encodeURIComponent ( this . model . get ( " name " ) ) + " / documents / 1 " , { trigger : ! 0 } ) ) } , noop : function ( a ) { a . stopPropagation ( ) } , 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 . modalView . hide ( ) } } ) , this . collectionsView . render ( ) } , 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 ( ) ) , g < 1 | | parseInt ( g , 10 ) ! = = Math . pow ( 2 , Math . log2 ( g ) ) ) throw new Error ( " 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 ) ; frontendConfig . isCluster = = = ! 1 ? this . model . renameCollection ( c , i ) : 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 ) ; frontendConfig . isCluster = = = ! 1 ? this . model . renameCollection ( c , j ) : j ( ) } else window . modalView . hide ( ) } } . bind ( this ) ; window . isCoordinator ( a ) } , createEditPropertiesModal : 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 ) , " loaded " = = = this . model . get ( " status " ) ? this . getIndex ( ) : $ ( $ ( " # 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 , [ { <nl> + 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 ( ) } ; this . model . getProperties ( g ) } else f ( ) } } . bind ( this ) ; window . isCoordinator ( a ) } , bindIndexEvents : function ( ) { this . unbindIndexEvents ( ) ; var a = this ; $ ( " # indexEditView # addIndex " ) . bind ( " click " , function ( ) { a . toggleNewIndexView ( ) , $ ( " # cancelIndex " ) . unbind ( " click " ) , $ ( " # cancelIndex " ) . bind ( " click " , function ( ) { a . toggleNewIndexView ( ) } ) , $ ( " # createIndex " ) . unbind ( " click " ) , $ ( " # createIndex " ) . bind ( " click " , function ( ) { a . createIndex ( ) } ) } ) , $ ( " # newIndexType " ) . bind ( " change " , function ( ) { a . selectIndexType ( ) } ) , $ ( " . deleteIndex " ) . bind ( " click " , function ( b ) { a . prepDeleteIndex ( b ) } ) , $ ( " # infoTab a " ) . bind ( " click " , function ( a ) { if ( $ ( " # indexDeleteModal " ) . remove ( ) , " Indices " ! = = $ ( a . currentTarget ) . html ( ) | | $ ( a . currentTarget ) . parent ( ) . hasClass ( " active " ) | | ( $ ( " # newIndexView " ) . hide ( ) , $ ( " # indexEditView " ) . show ( ) , $ ( " # modal - dialog . modal - footer . button - danger " ) . hide ( ) , $ ( " # modal - dialog . modal - footer . button - success " ) . hide ( ) , $ ( " # modal - dialog . modal - footer . button - notification " ) . hide ( ) ) , " General " = = = $ ( a . currentTarget ) . html ( ) & & ! $ ( a . currentTarget ) . parent ( ) . hasClass ( " active " ) ) { $ ( " # modal - dialog . modal - footer . button - danger " ) . show ( ) , $ ( " # modal - dialog . modal - footer . button - success " ) . show ( ) , $ ( " # modal - dialog . modal - footer . button - notification " ) . show ( ) ; var b = $ ( " . index - button - bar2 " ) [ 0 ] ; $ ( " # cancelIndex " ) . is ( " : visible " ) & & ( $ ( " # cancelIndex " ) . detach ( ) . appendTo ( b ) , $ ( " # createIndex " ) . detach ( ) . appendTo ( b ) ) } } ) } , unbindIndexEvents : function ( ) { $ ( " # indexEditView # addIndex " ) . unbind ( " click " ) , $ ( " # newIndexType " ) . unbind ( " change " ) , $ ( " # infoTab a " ) . unbind ( " click " ) , $ ( " . deleteIndex " ) . unbind ( " click " ) } , createInfoModal : function ( ) { var a = function ( a , b , c ) { if ( a ) arangoHelper . arangoError ( " Figures " , " Could not get revision . " ) ; else { var d = [ ] , e = { figures : c , revision : b , model : this . model } ; window . modalView . show ( " modalCollectionInfo . ejs " , " Collection : " + this . model . get ( " name " ) , d , e ) } } . bind ( this ) , b = function ( b , c ) { if ( b ) arangoHelper . arangoError ( " Figures " , " Could not get figures . " ) ; else { var d = c ; this . model . getRevision ( a , d ) } } . bind ( this ) ; this . model . getFigures ( b ) } , resetIndexForms : function ( ) { $ ( " # indexHeader input " ) . val ( " " ) . prop ( " checked " , ! 1 ) , $ ( " # newIndexType " ) . val ( " Geo " ) . prop ( " selected " , ! 0 ) , this . selectIndexType ( ) } , createIndex : function ( ) { var a , b , c , d = this , e = $ ( " # newIndexType " ) . val ( ) , f = { } ; switch ( e ) { case " Geo " : a = $ ( " # newGeoFields " ) . val ( ) ; var g = d . checkboxToValue ( " # newGeoJson " ) , h = d . checkboxToValue ( " # newGeoConstraint " ) , i = d . checkboxToValue ( " # newGeoIgnoreNull " ) ; f = { type : " geo " , fields : d . stringToArray ( a ) , geoJson : g , constraint : h , ignoreNull : i } ; break ; case " Hash " : a = $ ( " # newHashFields " ) . val ( ) , b = d . checkboxToValue ( " # newHashUnique " ) , c = d . checkboxToValue ( " # newHashSparse " ) , f = { type : " hash " , fields : d . stringToArray ( a ) , unique : b , sparse : c } ; break ; case " Fulltext " : a = $ ( " # newFulltextFields " ) . val ( ) ; var j = parseInt ( $ ( " # newFulltextMinLength " ) . val ( ) , 10 ) | | 0 ; f = { type : " fulltext " , fields : d . stringToArray ( a ) , minLength : j } ; break ; case " Skiplist " : a = $ ( " # newSkiplistFields " ) . val ( ) , b = d . checkboxToValue ( " # newSkiplistUnique " ) , c = d . checkboxToValue ( " # newSkiplistSparse " ) , f = { type : " skiplist " , fields : d . stringToArray ( a ) , unique : b , sparse : c } } var k = function ( a , b ) { if ( a ) if ( b ) { var c = JSON . parse ( b . responseText ) ; arangoHelper . arangoError ( " Document error " , c . errorMessage ) } else arangoHelper . arangoError ( " Document error " , " Could not create index . " ) ; d . refreshCollectionsView ( ) } ; window . modalView . hide ( ) , d . model . createIndex ( f , k ) } , lastTarget : null , prepDeleteIndex : function ( a ) { var b = this ; this . lastTarget = a , this . lastId = $ ( this . lastTarget . currentTarget ) . parent ( ) . parent ( ) . first ( ) . children ( ) . first ( ) . text ( ) , $ ( " # modal - dialog . modal - footer " ) . after ( ' < div id = " indexDeleteModal " style = " display : block ; " class = " alert alert - error modal - delete - confirmation " > < strong > Really delete ? < / strong > < button id = " indexConfirmDelete " class = " button - danger pull - right modal - confirm - delete " > Yes < / button > < button id = " indexAbortDelete " class = " button - neutral pull - right " > No < / button > < / div > ' ) , $ ( " # indexConfirmDelete " ) . unbind ( " click " ) , $ ( " # indexConfirmDelete " ) . bind ( " click " , function ( ) { $ ( " # indexDeleteModal " ) . remove ( ) , b . deleteIndex ( ) } ) , $ ( " # indexAbortDelete " ) . unbind ( " click " ) , $ ( " # indexAbortDelete " ) . bind ( " click " , function ( ) { $ ( " # indexDeleteModal " ) . remove ( ) } ) } , refreshCollectionsView : function ( ) { window . App . arangoCollectionsStore . fetch ( { success : function ( ) { window . App . collectionsView . render ( ) } } ) } , deleteIndex : function ( ) { var a = function ( a ) { a ? ( arangoHelper . arangoError ( " Could not delete index " ) , $ ( " tr th : contains ( ' " + this . lastId + " ' ) " ) . parent ( ) . children ( ) . last ( ) . html ( ' < span class = " deleteIndex icon_arangodb_roundminus " data - original - title = " Delete index " title = " Delete index " > < / span > ' ) , this . model . set ( " locked " , ! 1 ) , this . refreshCollectionsView ( ) ) : a | | void 0 = = = a | | ( $ ( " tr th : contains ( ' " + this . lastId + " ' ) " ) . parent ( ) . remove ( ) , this . model . set ( " locked " , ! 1 ) , this . refreshCollectionsView ( ) ) , this . refreshCollectionsView ( ) } . bind ( this ) ; this . model . set ( " locked " , ! 0 ) , this . model . deleteIndex ( this . lastId , a ) , $ ( " tr th : contains ( ' " + this . lastId + " ' ) " ) . parent ( ) . children ( ) . last ( ) . html ( ' < i class = " fa fa - circle - o - notch fa - spin " > < / i > ' ) } , selectIndexType : function ( ) { $ ( " . newIndexClass " ) . hide ( ) ; var a = $ ( " # newIndexType " ) . val ( ) ; $ ( " # newIndexType " + a ) . show ( ) } , getIndex : function ( ) { var a = function ( a , b ) { a ? window . arangoHelper . arangoError ( " Index " , b . errorMessage ) : this . renderIndex ( b ) } . bind ( this ) ; this . model . getIndex ( a ) } , renderIndex : function ( a ) { this . index = a ; var b = " collectionInfoTh modal - text " ; if ( this . index ) { var c = " " , d = " " ; _ . each ( this . index . indexes , function ( a ) { d = " primary " = = = a . type | | " edge " = = = a . type ? ' < span class = " icon_arangodb_locked " data - original - title = " No action " > < / span > ' : ' < span class = " deleteIndex icon_arangodb_roundminus " data - original - title = " Delete index " title = " Delete index " > < / span > ' , void 0 ! = = a . fields & & ( c = a . fields . join ( " , " ) ) ; var e = a . id . indexOf ( " / " ) , f = a . id . substr ( e + 1 , a . id . length ) , g = a . hasOwnProperty ( " selectivityEstimate " ) ? ( 100 * a . selectivityEstimate ) . toFixed ( 2 ) + " % " : " n / a " , h = a . hasOwnProperty ( " sparse " ) ? a . sparse : " n / a " ; $ ( " # collectionEditIndexTable " ) . append ( " < tr > < th class = " + JSON . stringify ( b ) + " > " + f + " < / th > < th class = " + JSON . stringify ( b ) + " > " + a . type + " < / th > < th class = " + JSON . stringify ( b ) + " > " + a . unique + " < / th > < th class = " + JSON . stringify ( b ) + " > " + h + " < / th > < th class = " + JSON . stringify ( b ) + " > " + g + " < / th > < th class = " + JSON . stringify ( b ) + " > " + c + " < / th > < th class = " + JSON . stringify ( b ) + " > " + d + " < / th > < / tr > " ) } ) } this . bindIndexEvents ( ) } , toggleNewIndexView : function ( ) { var a = $ ( " . index - button - bar2 " ) [ 0 ] ; $ ( " # indexEditView " ) . is ( " : visible " ) ? ( $ ( " # indexEditView " ) . hide ( ) , $ ( " # newIndexView " ) . show ( ) , $ ( " # cancelIndex " ) . detach ( ) . appendTo ( " # modal - dialog . modal - footer " ) , $ ( " # createIndex " ) . detach ( ) . appendTo ( " # modal - dialog . modal - footer " ) ) : ( $ ( " # indexEditView " ) . show ( ) , $ ( " # newIndexView " ) . hide ( ) , $ ( " # cancelIndex " ) . detach ( ) . appendTo ( a ) , $ ( " # createIndex " ) . detach ( ) . appendTo ( a ) ) , arangoHelper . fixTooltips ( " . icon_arangodb , . arangoicon " , " right " ) , this . resetIndexForms ( ) } , stringToArray : function ( a ) { var b = [ ] ; return a . split ( " , " ) . forEach ( function ( a ) { a = a . replace ( / ( ^ \ s + | \ s + $ ) / g , " " ) , " " ! = = a & & b . push ( a ) } ) , b } , checkboxToValue : function ( a ) { return $ ( a ) . prop ( " checked " ) } } ) } ( ) , function ( ) { " use strict " ; window . CollectionsView = Backbone . View . extend ( { el : " # content " , el2 : " # collectionsThumbnailsIn " , searchTimeout : null , refreshRate : 1e4 , template : templateEngine . createTemplate ( " collectionsView . ejs " ) , refetchCollections : function ( ) { var a = this ; this . collection . fetch ( { cache : ! 1 , success : function ( ) { a . checkLockedCollections ( ) } } ) } , checkLockedCollections : function ( ) { var a = function ( a , b ) { var c = this ; a ? console . log ( " Could not check locked collections " ) : ( this . collection . each ( function ( a ) { a . set ( " locked " , ! 1 ) } ) , _ . each ( b , function ( a ) { var b = c . collection . findWhere ( { id : a . collection } ) ; b . set ( " locked " , ! 0 ) , b . set ( " lockType " , a . type ) , b . set ( " desc " , a . desc ) } ) , this . collection . each ( function ( a ) { a . get ( " locked " ) | | ( $ ( " # collection_ " + a . get ( " name " ) ) . find ( " . corneredBadge " ) . removeClass ( " loaded unloaded " ) , $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . text ( a . get ( " status " ) ) , $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . addClass ( a . get ( " status " ) ) ) , a . get ( " locked " ) | | " loading " = = = a . get ( " status " ) ? ( $ ( " # collection_ " + a . get ( " name " ) ) . addClass ( " locked " ) , a . get ( " locked " ) ? ( $ ( " # collection_ " + a . get ( " name " ) ) . find ( " . corneredBadge " ) . removeClass ( " loaded unloaded " ) , $ ( " # collection_ " + a . get ( " name " ) ) . find ( " . corneredBadge " ) . addClass ( " inProgress " ) , $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . text ( a . get ( " desc " ) ) ) : $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . text ( a . get ( " status " ) ) ) : ( $ ( " # collection_ " + a . get ( " name " ) ) . removeClass ( " locked " ) , $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . text ( a . get ( " status " ) ) , $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . hasClass ( " inProgress " ) & & ( $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . text ( a . get ( " status " ) ) , $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . removeClass ( " inProgress " ) , $ ( " # collection_ " + a . get ( " name " ) + " . corneredBadge " ) . addClass ( " loaded " ) ) , " unloaded " = = = a . get ( " status " ) & & $ ( " # collection_ " + a . get ( " name " ) + " . icon_arangodb_info " ) . addClass ( " disabled " ) ) } ) ) } . bind ( this ) ; window . arangoHelper . syncAndReturnUninishedAardvarkJobs ( " index " , a ) } , initialize : function ( ) { var a = this ; window . setInterval ( function ( ) { " # collections " = = = window . location . hash & & window . VISIBLE & & a . refetchCollections ( ) } , a . refreshRate ) } , render : function ( ) { this . checkLockedCollections ( ) ; var a = ! 1 ; $ ( " # collectionsDropdown " ) . is ( " : visible " ) & & ( a = ! 0 ) , $ ( this . el ) . html ( this . template . render ( { } ) ) , this . setFilterValues ( ) , a = = = ! 0 & & $ ( " # collectionsDropdown2 " ) . show ( ) ; var b = this . collection . searchOptions ; this . collection . getFiltered ( b ) . forEach ( function ( a ) { $ ( " # collectionsThumbnailsIn " , this . el ) . append ( new window . CollectionListItemView ( { model : a , collectionsView : this } ) . render ( ) . el ) } , this ) , " none " = = = $ ( " # collectionsDropdown2 " ) . css ( " display " ) ? $ ( " # collectionsToggle " ) . removeClass ( " activated " ) : $ ( " # collectionsToggle " ) . addClass ( " activated " ) ; var c ; arangoHelper . setCheckboxStatus ( " # collectionsDropdown " ) ; try { c = b . searchPhrase . length } catch ( d ) { } return $ ( " # searchInput " ) . val ( b . searchPhrase ) , $ ( " # searchInput " ) . focus ( ) , $ ( " # searchInput " ) [ 0 ] . setSelectionRange ( c , c ) , arangoHelper . fixTooltips ( " . icon_arangodb , . arangoicon " , " left " ) , this } , events : { " click # createCollection " : " createCollection " , " keydown # searchInput " : " restrictToSearchPhraseKey " , " change # searchInput " : " restrictToSearchPhrase " , " click # searchSubmit " : " restrictToSearchPhrase " , " click . checkSystemCollections " : " checkSystem " , " click # checkLoaded " : " checkLoaded " , " click # checkUnloaded " : " checkUnloaded " , " click # checkDocument " : " checkDocument " , " click # checkEdge " : " checkEdge " , " click # sortName " : " sortName " , " click # sortType " : " sortType " , " click # sortOrder " : " sortOrder " , " click # collectionsToggle " : " toggleView " , " click . css - label " : " checkBoxes " } , updateCollectionsView : function ( ) { var a = this ; this . collection . fetch ( { cache : ! 1 , success : function ( ) { a . render ( ) } } ) } , toggleView : function ( ) { $ ( " # collectionsToggle " ) . toggleClass ( " activated " ) , $ ( " # collectionsDropdown2 " ) . slideToggle ( 200 ) } , checkBoxes : function ( a ) { var b = a . currentTarget . id ; $ ( " # " + b ) . click ( ) } , checkSystem : function ( ) { var a = this . collection . searchOptions , b = a . includeSystem ; a . includeSystem = $ ( " . checkSystemCollections " ) . is ( " : checked " ) = = = ! 0 , b ! = = a . includeSystem & & this . render ( ) } , checkEdge : function ( ) { var a = this . collection . searchOptions , b = a . includeEdge ; a . includeEdge = $ ( " # checkEdge " ) . is ( " : checked " ) = = = ! 0 , b ! = = a . includeEdge & & this . render ( ) } , checkDocument : function ( ) { var a = this . collection . searchOptions , b = a . includeDocument ; a . includeDocument = $ ( " # checkDocument " ) . is ( " : checked " ) = = = ! 0 , b ! = = a . includeDocument & & this . render ( ) } , checkLoaded : function ( ) { var a = this . collection . searchOptions , b = a . includeLoaded ; a . includeLoaded = $ ( " # checkLoaded " ) . is ( " : checked " ) = = = ! 0 , b ! = = a . includeLoaded & & this . render ( ) } , checkUnloaded : function ( ) { var a = this . collection . searchOptions , b = a . includeUnloaded ; a . includeUnloaded = $ ( " # checkUnloaded " ) . is ( " : checked " ) = = = ! 0 , b ! = = a . includeUnloaded & & this . render ( ) } , sortName : function ( ) { var a = this . collection . searchOptions , b = a . sortBy ; a . sortBy = $ ( " # sortName " ) . is ( " : checked " ) = = = ! 0 ? " name " : " type " , b ! = = a . sortBy & & this . render ( ) } , sortType : function ( ) { var a = this . collection . searchOptions , b = a . sortBy ; a . sortBy = $ ( " # sortType " ) . is ( " : checked " ) = = = ! 0 ? " type " : " name " , b ! = = a . sortBy & & this . render ( ) } , sortOrder : function ( ) { var a = this . collection . searchOptions , b = a . sortOrder ; a . sortOrder = $ ( " # sortOrder " ) . is ( " : checked " ) = = = ! 0 ? - 1 : 1 , b ! = = a . sortOrder & & this . render ( ) } , setFilterValues : function ( ) { var a = this . collection . searchOptions ; $ ( " # checkLoaded " ) . attr ( " checked " , a . includeLoaded ) , $ ( " # checkUnloaded " ) . attr ( " checked " , a . includeUnloaded ) , $ ( " . checkSystemCollections " ) . attr ( " checked " , a . includeSystem ) , $ ( " # checkEdge " ) . attr ( " checked " , a . includeEdge ) , $ ( " # checkDocument " ) . attr ( " checked " , a . includeDocument ) , $ ( " # sortName " ) . attr ( " checked " , " type " ! = = a . sortBy ) , $ ( " # sortType " ) . attr ( " checked " , " type " = = = a . sortBy ) , $ ( " # sortOrder " ) . attr ( " checked " , 1 ! = = a . sortOrder ) } , search : function ( ) { var a = this . collection . searchOptions , b = $ ( " # searchInput " ) . val ( ) ; b ! = = a . searchPhrase & & ( a . searchPhrase = b , this . render ( ) ) } , resetSearch : function ( ) { this . searchTimeout & & ( clearTimeout ( this . searchTimeout ) , this . searchTimeout = null ) ; var a = this . collection . searchOptions ; a . searchPhrase = null } , restrictToSearchPhraseKey : function ( ) { var a = this ; this . resetSearch ( ) , a . searchTimeout = setTimeout ( function ( ) { a . search ( ) } , 200 ) } , restrictToSearchPhrase : function ( ) { this . resetSearch ( ) , this . search ( ) } , createCollection : function ( a ) { a . preventDefault ( ) , this . createNewCollectionModal ( ) } , submitCreateCollection : function ( ) { var a = function ( a , b ) { if ( a ) arangoHelper . arangoError ( " DB " , " Could not check coordinator state " ) ; else { var c = $ ( " # new - collection - name " ) . val ( ) , d = $ ( " # new - collection - size " ) . val ( ) , e = $ ( " # new - replication - factor " ) . val ( ) , f = $ ( " # new - collection - type " ) . val ( ) , g = $ ( " # new - collection - sync " ) . val ( ) , h = 1 , i = [ ] ; if ( " " = = = e & & ( e = 1 ) , b ) { if ( h = $ ( " # new - collection - shards " ) . val ( ) , " " = = = h & & ( h = 1 ) , h = parseInt ( h , 10 ) , h < 1 ) return arangoHelper . arangoError ( " Number of shards has to be an integer value greater or equal 1 " ) , 0 ; i = _ . pluck ( $ ( " # new - collection - shardBy " ) . select2 ( " data " ) , " text " ) , 0 = = = i . length & & i . push ( " _key " ) } if ( " _ " = = = c . substr ( 0 , 1 ) ) return arangoHelper . arangoError ( ' No " _ " allowed as first character ! ' ) , 0 ; var j = ! 1 , k = " true " = = = g ; if ( d > 0 ) try { d = 1024 * JSON . parse ( d ) * 1024 } catch ( l ) { return arangoHelper . arangoError ( " Please enter a valid number " ) , 0 } if ( " " = = = c ) return arangoHelper . arangoError ( " No collection name entered ! " ) , 0 ; var m = function ( a , b ) { if ( a ) try { b = JSON . parse ( b . responseText ) , arangoHelper . arangoError ( " Error " , b . errorMessage ) } catch ( c ) { } else this . updateCollectionsView ( ) ; window . modalView . hide ( ) } . bind ( this ) ; this . collection . newCollection ( { collName : c , wfs : k , isSystem : j , collSize : d , replicationFactor : e , collType : f , shards : h , shardBy : i } , m ) } } . bind ( this ) ; window . isCoordinator ( a ) } , createNewCollectionModal : function ( ) { var a = function ( a , b ) { if ( a ) arangoHelper . arangoError ( " DB " , " Could not check coordinator state " ) ; else { var c = [ ] , d = [ ] , e = { } , f = [ ] ; d . push ( window . modalView . createTextEntry ( " new - collection - name " , " 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 . " } ] ) ) , d . push ( window . modalView . createSelectEntry ( " new - collection - type " , " Type " , " " , " The type of the collection to create . " , [ { value : 2 , label : " Document " } , { value : 3 , label : " Edge " } ] ) ) , b & & ( d . push ( window . modalView . createTextEntry ( " new - collection - shards " , " Shards " , " " , " The number of shards to create . You cannot change this afterwards . Recommended : DBServers squared " , " " , ! 0 ) ) , d . push ( window . modalView . createSelect2Entry ( " new - collection - shardBy " , " shardBy " , " " , " The keys used to distribute documents on shards . Type the key and press return to add it . " , " _key " , ! 1 ) ) ) , c . push ( window . modalView . createSuccessButton ( " Save " , this . submitCreateCollection . bind ( this ) ) ) , f . push ( window . modalView . createTextEntry ( " new - collection - size " , " Journal size " , " " , " The maximal size of a journal or datafile ( in MB ) . Must be at least 1 . " , " " , ! 1 , [ { rule : Joi . string ( ) . allow ( " " ) . optional ( ) . regex ( / ^ [ 0 - 9 ] * $ / ) , msg : " Must be a number . " } ] ) ) , window . App . isCluster & & f . push ( window . modalView . createTextEntry ( " new - replication - factor " , " Replication factor " , " " , " Numeric value . Must be at least 1 . Description : TODO " , " " , ! 1 , [ { rule : Joi . string ( ) . allow ( " " ) . optional ( ) . regex ( / ^ [ 0 - 9 ] * $ / ) , msg : " Must be a number . " } ] ) ) , f . push ( window . modalView . createSelectEntry ( " new - collection - sync " , " Wait for sync " , " " , " Synchronize to disk before returning from a create or update of a document . " , [ { value : ! 1 , label : " No " } , { value : ! 0 , label : " Yes " } ] ) ) , e . header = " Advanced " , e . content = f , window . modalView . show ( " modalTable . ejs " , " New Collection " , c , d , e ) , $ ( " # s2id_new - collection - shardBy . select2 - search - field input " ) . on ( " focusout " , function ( a ) { $ ( " . select2 - drop " ) . is ( " : visible " ) & & ( $ ( " # select2 - search - field input " ) . is ( " : focus " ) | | window . setTimeout ( function ( ) { $ ( a . currentTarget ) . parent ( ) . parent ( ) . parent ( ) . select2 ( " close " ) } , 200 ) ) } ) } } . bind ( this ) ; window . isCoordinator ( a ) } } ) } ( ) , function ( ) { " use strict " ; function a ( a , b ) { return void 0 ! = = a & & null ! = = a | | ( a = 0 ) , a . toFixed ( b ) } window . DashboardView = Backbone . View . extend ( { el : " # content " , interval : 1e4 , defaultTimeFrame : 12e5 , defaultDetailFrame : 1728e5 , history : { } , graphs : { } , events : { " click . subViewNavbar . subMenuEntry " : " toggleViews " } , tendencies : { asyncPerSecondCurrent : [ " asyncPerSecondCurrent " , " asyncPerSecondPercentChange " ] , syncPerSecondCurrent : [ " syncPerSecondCurrent " , " syncPerSecondPercentChange " ] , clientConnectionsCurrent : [ " clientConnectionsCurrent " , " clientConnectionsPercentChange " ] , clientConnectionsAverage : [ " clientConnections15M " , " clientConnections15MPercentChange " ] , numberOfThreadsCurrent : [ " numberOfThreadsCurrent " , " numberOfThreadsPercentChange " ] , numberOfThreadsAverage : [ " numberOfThreads15M " , " numberOfThreads15MPercentChange " ] , virtualSizeCurrent : [ " virtualSizeCurrent " , " virtualSizePercentChange " ] , virtualSizeAverage : [ " virtualSize15M " , " virtualSize15MPercentChange " ] } , barCharts : { totalTimeDistribution : [ " queueTimeDistributionPercent " , " requestTimeDistributionPercent " ] , dataTransferDistribution : [ " bytesSentDistributionPercent " , " bytesReceivedDistributionPercent " ] } , barChartsElementNames : { queueTimeDistributionPercent : " Queue " , requestTimeDistributionPercent : " Computation " , bytesSentDistributionPercent : " Bytes sent " , bytesReceivedDistributionPercent : " Bytes received " } , getDetailFigure : function ( a ) { var b = $ ( a . currentTarget ) . attr ( " id " ) . replace ( / ChartButton / g , " " ) ; return b } , showDetail : function ( a ) { var b , c = this , d = this . getDetailFigure ( a ) ; b = this . dygraphConfig . getDetailChartConfig ( d ) , this . getHistoryStatistics ( d ) , this . detailGraphFigure = d , window . modalView . hideFooter = ! 0 , window . modalView . hide ( ) , window . modalView . show ( " modalGraph . ejs " , b . header , void 0 , void 0 , void 0 , void 0 , this . events ) , window . modalView . hideFooter = ! 1 , $ ( " # modal - dialog " ) . on ( " hidden " , function ( ) { c . hidden ( ) } ) , $ ( " # modal - dialog " ) . toggleClass ( " modal - chart - detail " , ! 0 ) , b . height = . 7 * $ ( window ) . height ( ) , b . width = $ ( " . modal - inner - detail " ) . width ( ) , b . labelsDiv = $ ( b . labelsDiv ) [ 0 ] , this . detailGraph = new Dygraph ( document . getElementById ( " lineChartDetail " ) , this . history [ this . server ] [ d ] , b ) } , hidden : function ( ) { this . detailGraph . destroy ( ) , delete this . detailGraph , delete this . detailGraphFigure } , 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 } } , prepareDygraphs : function ( ) { var a , b = this ; this . dygraphConfig . getDashBoardFigures ( ) . forEach ( function ( c ) { a = b . dygraphConfig . getDefaultConfig ( c ) ; var d = b . getCurrentSize ( a . div ) ; a . height = d . height , a . width = d . width , b . graphs [ c ] = new Dygraph ( document . getElementById ( a . div ) , b . history [ b . server ] [ c ] | | [ ] , a ) } ) } , initialize : function ( a ) { this . options = a , this . dygraphConfig = a . dygraphConfig , this . d3NotInitialized = ! 0 , this . events [ " click . dashboard - sub - bar - menu - sign " ] = this . showDetail . bind ( this ) , this . events [ " mousedown . dygraph - rangesel - zoomhandle " ] = this . stopUpdating . bind ( this ) , this . events [ " mouseup . dygraph - rangesel - zoomhandle " ] = this . startUpdating . bind ( this ) , this . serverInfo = a . serverToShow , this . serverInfo ? this . server = this . serverInfo . target : this . server = " - local - " , this . history [ this . server ] = { } } , toggleViews : function ( a ) { var b = a . currentTarget . id . split ( " - " ) [ 0 ] , c = this , d = [ " replication " , " requests " , " system " ] ; _ . each ( d , function ( a ) { b ! = = a ? $ ( " # " + a ) . hide ( ) : ( $ ( " # " + a ) . show ( ) , c . resize ( ) , $ ( window ) . resize ( ) ) } ) , $ ( " . subMenuEntries " ) . children ( ) . removeClass ( " active " ) , $ ( " # " + b + " - statistics " ) . addClass ( " active " ) , window . setTimeout ( function ( ) { c . resize ( ) , $ ( window ) . resize ( ) } , 200 ) } , updateCharts : function ( ) { var a = this ; return this . detailGraph ? void this . updateLineChart ( this . detailGraphFigure , ! 0 ) : ( this . prepareD3Charts ( this . isUpdating ) , this . prepareResidentSize ( this . isUpdating ) , this . updateTendencies ( ) , void Object . keys ( this . graphs ) . forEach ( function ( b ) { a . updateLineChart ( b , ! 1 ) } ) ) } , updateTendencies : function ( ) { var a = this , b = this . tendencies , c = " " ; Object . keys ( b ) . forEach ( function ( b ) { var d = " " , e = 0 ; a . history . hasOwnProperty ( a . server ) & & a . history [ a . server ] . hasOwnProperty ( b ) & & ( e = a . history [ a . server ] [ b ] [ 1 ] ) , e < 0 ? c = " # d05448 " : ( c = " # 7da817 " , d = " + " ) , a . history . hasOwnProperty ( a . server ) & & a . history [ a . server ] . hasOwnProperty ( b ) ? $ ( " # " + b ) . html ( a . history [ a . server ] [ b ] [ 0 ] + ' < br / > < span class = " dashboard - figurePer " style = " color : ' + c + ' ; " > ' + d + e + " % < / span > " ) : $ ( " # " + b ) . html ( ' < br / > < span class = " dashboard - figurePer " style = " color : # 000 ; " > < p class = " dataNotReadyYet " > data not ready yet < / p > < / span > ' ) } ) } , updateDateWindow : function ( a , b ) { var c , d , e = ( new Date ) . getTime ( ) ; return b & & a . dateWindow_ ? ( c = a . dateWindow_ [ 0 ] , d = e - a . dateWindow_ [ 1 ] - 5 * this . interval > 0 ? a . dateWindow_ [ 1 ] : e , [ c , d ] ) : [ e - this . defaultTimeFrame , e ] } , updateLineChart : function ( a , b ) { var c = b ? this . detailGraph : this . graphs [ a ] , d = { file : this . history [ this . server ] [ a ] , dateWindow : this . updateDateWindow ( c , b ) } , e = 0 , f = [ ] ; _ . each ( d . file , function ( a ) { var b = a [ 0 ] . getSeconds ( ) - a [ 0 ] . getSeconds ( ) % 10 ; d . file [ e ] [ 0 ] . setSeconds ( b ) , f . push ( d . file [ e ] [ 0 ] ) , e + + } ) ; for ( var g = new Date ( Math . max . apply ( null , f ) ) , h = new Date ( Math . min . apply ( null , f ) ) , i = new Date ( h . getTime ( ) ) , j = [ ] , k = [ ] ; i < g ; ) i = new Date ( i . setSeconds ( i . getSeconds ( ) + 10 ) ) , k . push ( i ) ; _ . each ( k , function ( a ) { var b = ! 1 ; _ . each ( d . file , function ( c ) { Math . floor ( a . getTime ( ) / 1e3 ) = = = Math . floor ( c [ 0 ] . getTime ( ) / 1e3 ) & & ( b = ! 0 ) } ) , b = = = ! 1 & & a < new Date & & j . push ( a ) } ) , _ . each ( j , function ( b ) { " systemUserTime " ! = = a & & " requests " ! = = a & & " pageFaults " ! = = a & & " dataTransfer " ! = = a | | d . file . push ( [ b , 0 , 0 ] ) , " totalTime " = = = a & & d . file . push ( [ b , 0 , 0 , 0 ] ) } ) , void 0 = = = d . file ? ( $ ( " # loadingScreen span " ) . text ( " Statistics not ready yet . Waiting . " ) , " # dashboard " ! = = window . location . hash & & " " ! = = window . location . hash & & " # " ! = = window . location . hash | | ( $ ( " # loadingScreen " ) . show ( ) , $ ( " # content " ) . hide ( ) ) ) : ( $ ( " # content " ) . show ( ) , $ ( " # loadingScreen " ) . hide ( ) , d . file . sort ( function ( a , b ) { return new Date ( b [ 0 ] ) - new Date ( a [ 0 ] ) } ) , c . updateOptions ( d ) ) , $ ( window ) . trigger ( " resize " ) , this . resize ( ) } , mergeDygraphHistory : function ( a , b ) { var c , d = this ; this . dygraphConfig . getDashBoardFigures ( ! 0 ) . forEach ( function ( e ) { if ( d . dygraphConfig . mapStatToFigure [ e ] & & ( d . history [ d . server ] [ e ] | | ( d . history [ d . server ] [ e ] = [ ] ) , c = [ ] , d . dygraphConfig . mapStatToFigure [ e ] . forEach ( function ( d ) { a [ d ] & & ( " times " = = = d ? c . push ( new Date ( 1e3 * a [ d ] [ b ] ) ) : c . push ( a [ d ] [ b ] ) ) } ) , c . length > 1 ) ) { var f = 0 , g = 0 ; 9 = = = c . length & & ( f + = c [ 1 ] , f + = c [ 6 ] , f + = c [ 7 ] , f + = c [ 8 ] , g + = c [ 2 ] , g + = c [ 3 ] , g + = c [ 4 ] , g + = c [ 5 ] , c = [ c [ 0 ] , f , g ] ) , d . history [ d . server ] [ e ] . unshift ( c ) } } ) } , cutOffHistory : function ( a , b ) { for ( var c = this , d = c . history [ c . server ] [ a ] ; 0 ! = = d . length & & ! ( d [ d . length - 1 ] [ 0 ] > = b ) ; ) d . pop ( ) } , cutOffDygraphHistory : function ( a ) { var b = this , c = new Date ( a ) ; this . dygraphConfig . getDashBoardFigures ( ! 0 ) . forEach ( function ( a ) { b . dygraphConfig . mapStatToFigure [ a ] & & b . history [ b . server ] [ a ] & & b . cutOffHistory ( a , c ) } ) } , mergeHistory : function ( b ) { var c , d = this ; for ( c = 0 ; c < b . times . length ; + + c ) this . mergeDygraphHistory ( b , c ) ; this . cutOffDygraphHistory ( ( new Date ) . getTime ( ) - this . defaultTimeFrame ) , Object . keys ( this . tendencies ) . forEach ( function ( c ) { var e = 1 , f = 1 ; " virtualSizeCurrent " = = = c | | " virtualSizeAverage " = = = c ? ( b [ d . tendencies [ c ] [ 0 ] ] / = 1073741824 , e = 2 ) : " clientConnectionsCurrent " = = = c ? e = 0 : " numberOfThreadsCurrent " = = = c & & ( e = 0 ) , d . history [ d . server ] [ c ] = [ a ( b [ d . tendencies [ c ] [ 0 ] ] , e ) , a ( 100 * b [ d . tendencies [ c ] [ 1 ] ] , f ) ] } ) , Object . keys ( this . barCharts ) . forEach ( function ( a ) { d . history [ d . server ] [ a ] = d . mergeBarChartData ( d . barCharts [ a ] , b ) } ) , d . history [ d . server ] . physicalMemory = b . physicalMemory , d . history [ d . server ] . residentSizeCurrent = b . residentSizeCurrent , d . history [ d . server ] . residentSizePercent = b . residentSizePercent , d . history [ d . server ] . residentSizeChart = [ { key : " " , color : this . dygraphConfig . colors [ 1 ] , values : [ { label : " used " , value : 100 * b . residentSizePercent } ] } , { key : " " , color : this . dygraphConfig . colors [ 2 ] , values : [ { label : " used " , value : 100 - 100 * b . residentSizePercent } ] } ] , this . nextStart = b . nextStart } , mergeBarChartData : function ( a , b ) { var c , d = { key : this . barChartsElementNames [ a [ 0 ] ] , color : this . dygraphConfig . colors [ 1 ] , values : [ ] } , e = { key : this . barChartsElementNames [ a [ 1 ] ] , color : this . dygraphConfig . colors [ 2 ] , values : [ ] } ; for ( c = b [ a [ 0 ] ] . values . length - 1 ; c > = 0 ; - - c ) d . values . push ( { label : this . getLabel ( b [ a [ 0 ] ] . cuts , c ) , value : b [ a [ 0 ] ] . values [ c ] } ) , e . values . push ( { label : this . getLabel ( b [ a [ 1 ] ] . cuts , c ) , value : b [ a [ 1 ] ] . values [ c ] } ) ; return [ d , e ] } , getLabel : function ( a , b ) { return a [ b ] ? 0 = = = b ? " 0 - " + a [ b ] : a [ b - 1 ] + " - " + a [ b ] : " > " + a [ b - 1 ] } , renderReplicationStatistics : function ( a ) { $ ( " # repl - numbers table tr : nth - child ( 1 ) > td : nth - child ( 2 ) " ) . html ( a . state . totalEvents ) , $ ( " # repl - numbers table tr : nth - child ( 2 ) > td : nth - child ( 2 ) " ) . html ( a . state . totalRequests ) , $ ( " # repl - numbers table tr : nth - child ( 3 ) > td : nth - child ( 2 ) " ) . html ( a . state . totalFailedConnects ) , a . state . lastAppliedContinuousTick ? $ ( " # repl - ticks table tr : nth - child ( 1 ) > td : nth - child ( 2 ) " ) . html ( a . state . lastAppliedContinuousTick ) : $ ( " # repl - ticks table tr : nth - child ( 1 ) > td : nth - child ( 2 ) " ) . html ( " no data available " ) . addClass ( " no - data " ) , a . state . lastProcessedContinuousTick ? $ ( " # repl - ticks table tr : nth - child ( 2 ) > td : nth - child ( 2 ) " ) . html ( a . state . lastProcessedContinuousTick ) : $ ( " # repl - ticks table tr : nth - child ( 2 ) > td : nth - child ( 2 ) " ) . html ( " no data available " ) . addClass ( " no - data " ) , a . state . lastAvailableContinuousTick ? $ ( " # repl - ticks table tr : nth - child ( 3 ) > td : nth - child ( 2 ) " ) . html ( a . state . lastAvailableContinuousTick ) : $ ( " # repl - ticks table tr : nth - child ( 3 ) > td : nth - child ( 2 ) " ) . html ( " no data available " ) . addClass ( " no - data " ) , $ ( " # repl - progress table tr : nth - child ( 1 ) > td : nth - child ( 2 ) " ) . html ( a . state . progress . message ) , $ ( " # repl - progress table tr : nth - child ( 2 ) > td : nth - child ( 2 ) " ) . html ( a . state . progress . time ) , $ ( " # repl - progress table tr : nth - child ( 3 ) > td : nth - child ( 2 ) " ) . html ( a . state . progress . failedConnects ) } , getReplicationStatistics : function ( ) { var a = this ; $ . ajax ( arangoHelper . databaseUrl ( " / _api / replication / applier - state " ) , { async : ! 0 } ) . done ( function ( b ) { if ( b . hasOwnProperty ( " state " ) ) { var c ; c = b . state . running ? " active " : " inactive " , c = ' < span class = " state " > ' + c + " < / span > " , $ ( " # replication - chart . dashboard - sub - bar " ) . html ( " Replication " + c ) , a . renderReplicationStatistics ( b ) } } ) } , getStatistics : function ( a , b ) { var c = this , d = arangoHelper . databaseUrl ( " / _admin / aardvark / statistics / short " , " _system " ) , e = " ? start = " ; e + = c . nextStart ? c . nextStart : ( ( new Date ) . getTime ( ) - c . defaultTimeFrame ) / 1e3 , " - local - " ! = = c . server & & ( e + = " & type = short & DBserver = " + c . serverInfo . target , c . history . hasOwnProperty ( c . server ) | | ( c . history [ c . server ] = { } ) ) , $ . ajax ( d + e , { async : ! 0 , xhrFields : { withCredentials : ! 0 } , crossDomain : ! 0 } ) . done ( function ( d ) { d . times . length > 0 & & ( c . isUpdating = ! 0 , c . mergeHistory ( d ) ) , c . isUpdating ! = = ! 1 & & ( a & & a ( d . enabled , b ) , c . updateCharts ( ) ) } ) . error ( function ( a ) { console . log ( " stat fetch req error : " + a ) } ) , this . getReplicationStatistics ( ) } , getHistoryStatistics : function ( a ) { var b = this , c = " statistics / long " , d = " ? filter = " + this . dygraphConfig . mapStatToFigure [ a ] . join ( ) ; " - local - " ! = = b . server & & ( c = b . server . endpoint + arangoHelper . databaseUrl ( " / _admin / aardvark / statistics / cluster " ) , d + = " & type = long & DBserver = " + b . server . target , b . history . hasOwnProperty ( b . server ) | | ( b . history [ b . server ] = { } ) ) ; var e = window . location . href . split ( " / " ) , f = e [ 0 ] + " / / " + e [ 2 ] + " / " + e [ 3 ] + " / _system / " + e [ 5 ] + " / " + e [ 6 ] + " / " ; $ . ajax ( f + c + d , { async : ! 0 } ) . done ( function ( c ) { var d ; for ( b . history [ b . server ] [ a ] = [ ] , d = 0 ; d < c . times . length ; + + d ) b . mergeDygraphHistory ( c , d , ! 0 ) } ) } , addEmptyDataLabels : function ( ) { 0 = = = $ ( " . dataNotReadyYet " ) . length & & ( $ ( " # dataTransferDistribution " ) . prepend ( ' < p class = " dataNotReadyYet " > data not ready yet < / p > ' ) , $ ( " # totalTimeDistribution " ) . prepend ( ' < p class = " dataNotReadyYet " > data not ready yet < / p > ' ) , $ ( " . dashboard - bar - chart - title " ) . append ( ' < p class = " dataNotReadyYet " > data not ready yet < / p > ' ) ) } , removeEmptyDataLabels : function ( ) { $ ( " . dataNotReadyYet " ) . remove ( ) } , prepareResidentSize : function ( b ) { var c = this , d = this . getCurrentSize ( " # residentSizeChartContainer " ) , e = c . history [ c . server ] . residentSizeCurrent / 1024 / 1024 , f = " " ; f = e < 1025 ? a ( e , 2 ) + " MB " : a ( e / 1024 , 2 ) + " GB " ; var g = a ( 100 * c . history [ c . server ] . residentSizePercent , 2 ) , h = [ a ( c . history [ c . server ] . physicalMemory / 1024 / 1024 / 1024 , 0 ) + " GB " ] ; return void 0 = = = c . history [ c . server ] . residentSizeChart ? void this . addEmptyDataLabels ( ) : ( this . removeEmptyDataLabels ( ) , void nv . addGraph ( function ( ) { var a = nv . models . multiBarHorizontalChart ( ) . x ( function ( a ) { return a . label } ) . y ( function ( a ) { return a . value } ) . width ( d . width ) . height ( d . height ) . margin ( { top : ( $ ( " residentSizeChartContainer " ) . outerHeight ( ) - $ ( " residentSizeChartContainer " ) . height ( ) ) / 2 , right : 1 , bottom : ( $ ( " residentSizeChartContainer " ) . outerHeight ( ) - $ ( " residentSizeChartContainer " ) . height ( ) ) / 2 , left : 1 } ) . showValues ( ! 1 ) . showYAxis ( ! 1 ) . showXAxis ( ! 1 ) . showLegend ( ! 1 ) . showControls ( ! 1 ) . stacked ( ! 0 ) ; return a . yAxis . tickFormat ( function ( a ) { return a + " % " } ) . showMaxMin ( ! 1 ) , a . xAxis . showMaxMin ( ! 1 ) , d3 . select ( " # residentSizeChart svg " ) . datum ( c . history [ c . server ] . residentSizeChart ) . call ( a ) , d3 . select ( " # residentSizeChart svg " ) . select ( " . nv - zeroLine " ) . remove ( ) , b & & ( d3 . select ( " # residentSizeChart svg " ) . select ( " # total " ) . remove ( ) , d3 . select ( " # residentSizeChart svg " ) . select ( " # percentage " ) . remove ( ) ) , d3 . select ( " . dashboard - bar - chart - title . percentage " ) . html ( f + " ( " + g + " % ) " ) , d3 . select ( " . dashboard - bar - chart - title . absolut " ) . html ( h [ 0 ] ) , nv . utils . windowResize ( a . update ) , a } , function ( ) { d3 . selectAll ( " # residentSizeChart . nv - bar " ) . on ( " click " , function ( ) { } ) } ) ) } , prepareD3Charts : function ( b ) { var c = this , d = { totalTimeDistribution : [ " queueTimeDistributionPercent " , " requestTimeDistributionPercent " ] , dataTransferDistribution : [ " bytesSentDistributionPercent " , " bytesReceivedDistributionPercent " ] } ; this . d3NotInitialized & & ( b = ! 1 , this . d3NotInitialized = ! 1 ) , _ . each ( Object . keys ( d ) , function ( b ) { var d = c . getCurrentSize ( " # " + b + " Container . dashboard - interior - chart " ) , e = " # " + b + " Container svg " ; return void 0 = = = c . history [ c . server ] . residentSizeChart ? void c . addEmptyDataLabels ( ) : ( c . removeEmptyDataLabels ( ) , void nv . addGraph ( function ( ) { var f = [ 0 , . 25 , . 5 , . 75 , 1 ] , g = 75 , h = 23 , i = 6 ; d . width < 219 ? ( f = [ 0 , . 5 , 1 ] , g = 72 , h = 21 , i = 5 ) : d . width < 299 ? ( f = [ 0 , . 3334 , . 6667 , 1 ] , g = 77 ) : d . width < 379 ? g = 87 : d . width < 459 ? g = 95 : d . width < 539 ? g = 100 : d . width < 619 & & ( g = 105 ) ; var j = nv . models . multiBarHorizontalChart ( ) . x ( function ( a ) { return a . label } ) . y ( function ( a ) { return a . value } ) . width ( d . width ) . height ( d . height ) . margin ( { top : 5 , right : 20 , bottom : h , left : g } ) . showValues ( ! 1 ) . showYAxis ( ! 0 ) . showXAxis ( ! 0 ) . showLegend ( ! 1 ) . showControls ( ! 1 ) . forceY ( [ 0 , 1 ] ) ; return j . yAxis . showMaxMin ( ! 1 ) , d3 . select ( " . nv - y . nv - axis " ) . selectAll ( " text " ) . attr ( " transform " , " translate ( 0 , " + i + " ) " ) , j . yAxis . tickValues ( f ) . tickFormat ( function ( b ) { return a ( 100 * b * 100 / 100 , 0 ) + " % " } ) , d3 . select ( e ) . datum ( c . history [ c . server ] [ b ] ) . call ( j ) , nv . utils . windowResize ( j . update ) , j } , function ( ) { d3 . selectAll ( e + " . nv - bar " ) . on ( " click " , function ( ) { } ) } ) ) } ) } , stopUpdating : function ( ) { this . isUpdating = ! 1 } , startUpdating : function ( ) { var a = this ; a . timer | | ( a . timer = window . setInterval ( function ( ) { window . App . isCluster ? window . location . hash . indexOf ( a . serverInfo . target ) > - 1 & & a . getStatistics ( ) : a . getStatistics ( ) } , a . interval ) ) } , resize : function ( ) { if ( this . isUpdating ) { var a , b = this ; _ . each ( this . graphs , function ( c ) { a = b . getCurrentSize ( c . maindiv_ . id ) , c . resize ( a . width , a . height ) } ) , this . detailGraph & & ( a = this . getCurrentSize ( this . detailGraph . maindiv_ . id ) , this . detailGraph . resize ( a . width , a . height ) ) , this . prepareD3Charts ( ! 0 ) , this . prepareResidentSize ( ! 0 ) } } , template : templateEngine . createTemplate ( " dashboardView . ejs " ) , render : function ( a ) { var b = function ( a , b ) { return b | | $ ( this . el ) . html ( this . template . render ( ) ) , a & & " _system " = = = frontendConfig . db ? ( this . prepareDygraphs ( ) , this . isUpdating & & ( this . prepareD3Charts ( ) , this . prepareResidentSize ( ) , this . updateTendencies ( ) , $ ( window ) . trigger ( " resize " ) ) , this . startUpdating ( ) , void $ ( window ) . resize ( ) ) : ( $ ( this . el ) . html ( " " ) , void ( this . server ? $ ( this . el ) . append ( ' < div style = " color : red " > Server statistics ( ' + this . server + " ) are disabled . < / div > " ) : $ ( this . el ) . append ( ' < div style = " color : red " > Server statistics are disabled . < / div > ' ) ) ) ; <nl> + } . bind ( this ) , c = function ( ) { $ ( this . el ) . html ( " " ) , $ ( " . contentDiv " ) . remove ( ) , $ ( " . headerBar " ) . remove ( ) , $ ( " . dashboard - headerbar " ) . remove ( ) , $ ( " . dashboard - row " ) . remove ( ) , $ ( this . el ) . append ( ' < div style = " color : red " > You do not have permission to view this page . < / div > ' ) , $ ( this . el ) . append ( " < div style = \ " color : red \ " > You can switch to ' _system ' to see the dashboard . < / div > " ) } . bind ( this ) ; if ( " _system " ! = = frontendConfig . db ) return void c ( ) ; var d = function ( d , e ) { d | | ( e ? this . getStatistics ( b , a ) : c ( ) ) } . bind ( this ) ; void 0 = = = window . App . currentDB . get ( " name " ) ? window . setTimeout ( function ( ) { return " _system " ! = = window . App . currentDB . get ( " name " ) ? void c ( ) : void this . options . database . hasSystemAccess ( d ) } . bind ( this ) , 300 ) : this . options . database . hasSystemAccess ( d ) } } ) } ( ) , function ( ) { " use strict " ; window . DatabaseView = Backbone . View . extend ( { users : null , el : " # content " , template : templateEngine . createTemplate ( " databaseView . ejs " ) , dropdownVisible : ! 1 , currentDB : " " , events : { " click # createDatabase " : " createDatabase " , " click # submitCreateDatabase " : " submitCreateDatabase " , " click . editDatabase " : " editDatabase " , " click # userManagementView . icon " : " editDatabase " , " click # selectDatabase " : " updateDatabase " , " click # submitDeleteDatabase " : " submitDeleteDatabase " , " click . contentRowInactive a " : " changeDatabase " , " keyup # databaseSearchInput " : " search " , " click # databaseSearchSubmit " : " search " , " click # databaseToggle " : " toggleSettingsDropdown " , " click . css - label " : " checkBoxes " , " click # dbSortDesc " : " sorting " } , sorting : function ( ) { $ ( " # dbSortDesc " ) . is ( " : checked " ) ? this . collection . setSortingDesc ( ! 0 ) : this . collection . setSortingDesc ( ! 1 ) , $ ( " # databaseDropdown " ) . is ( " : visible " ) ? this . dropdownVisible = ! 0 : this . dropdownVisible = ! 1 , this . render ( ) } , initialize : function ( ) { this . collection . fetch ( { async : ! 0 , cache : ! 1 } ) } , checkBoxes : function ( a ) { var b = a . currentTarget . id ; $ ( " # " + b ) . click ( ) } , render : function ( ) { var a = function ( a , b ) { a ? arangoHelper . arangoError ( " DB " , " Could not get current db properties " ) : ( this . currentDB = b , this . collection . sort ( ) , $ ( this . el ) . html ( this . template . render ( { collection : this . collection , searchString : " " , currentDB : this . currentDB } ) ) , this . dropdownVisible = = = ! 0 & & ( $ ( " # dbSortDesc " ) . attr ( " checked " , this . collection . sortOptions . desc ) , $ ( " # databaseToggle " ) . toggleClass ( " activated " ) , $ ( " # databaseDropdown2 " ) . show ( ) ) , arangoHelper . setCheckboxStatus ( " # databaseDropdown " ) , this . replaceSVGs ( ) ) } . bind ( this ) ; return this . collection . getCurrentDatabase ( a ) , this } , toggleSettingsDropdown : function ( ) { $ ( " # dbSortDesc " ) . attr ( " checked " , this . collection . sortOptions . desc ) , $ ( " # databaseToggle " ) . toggleClass ( " activated " ) , $ ( " # databaseDropdown2 " ) . slideToggle ( 200 ) } , selectedDatabase : function ( ) { return $ ( " # selectDatabases " ) . val ( ) } , handleError : function ( a , b , c ) { return 409 = = = a ? void arangoHelper . arangoError ( " DB " , " Database " + c + " already exists . " ) : 400 = = = a ? void arangoHelper . arangoError ( " DB " , " Invalid Parameters " ) : 403 = = = a ? void arangoHelper . arangoError ( " DB " , " Insufficent rights . Execute this from _system database " ) : void 0 } , validateDatabaseInfo : function ( a , b ) { return " " = = = b ? ( arangoHelper . arangoError ( " DB " , " You have to define an owner for the new database " ) , ! 1 ) : " " = = = a ? ( arangoHelper . arangoError ( " DB " , " You have to define a name for the new database " ) , ! 1 ) : 0 = = = a . indexOf ( " _ " ) ? ( arangoHelper . arangoError ( " DB " , " Databasename should not start with _ " ) , ! 1 ) : ! ! a . match ( / ^ [ a - zA - Z ] [ a - zA - Z0 - 9_ \ - ] * $ / ) | | ( arangoHelper . arangoError ( " DB " , " Databasename may only contain numbers , letters , _ and - " ) , ! 1 ) } , createDatabase : function ( a ) { a . preventDefault ( ) , this . createAddDatabaseModal ( ) } , switchDatabase : function ( a ) { if ( ! $ ( a . target ) . parent ( ) . hasClass ( " iconSet " ) ) { var b = $ ( a . currentTarget ) . find ( " h5 " ) . text ( ) ; if ( " " ! = = b ) { var c = this . collection . createDatabaseURL ( b ) ; window . location . replace ( c ) } } } , submitCreateDatabase : function ( ) { var a = this , b = $ ( " # newDatabaseName " ) . val ( ) , c = $ ( " # newUser " ) . val ( ) , d = { name : b } ; this . collection . create ( d , { error : function ( c , d ) { a . handleError ( d . status , d . statusText , b ) } , success : function ( d ) { " root " ! = = c & & $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( c ) + " / database / " + encodeURIComponent ( b ) ) , contentType : " application / json " , data : JSON . stringify ( { grant : " rw " } ) } ) , $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / user / root / database / " + encodeURIComponent ( b ) ) , contentType : " application / json " , data : JSON . stringify ( { grant : " rw " } ) } ) , " # databases " = = = window . location . hash & & a . updateDatabases ( ) , arangoHelper . arangoNotification ( " Database " + d . get ( " name " ) + " created . " ) } } ) , arangoHelper . arangoNotification ( " Database creation in progress . " ) , window . modalView . hide ( ) } , submitDeleteDatabase : function ( a ) { var b = this . collection . where ( { name : a } ) ; b [ 0 ] . destroy ( { wait : ! 0 , url : arangoHelper . databaseUrl ( " / _api / database / " + a ) } ) , this . updateDatabases ( ) , window . App . naviView . dbSelectionView . render ( $ ( " # dbSelect " ) ) , window . modalView . hide ( ) } , changeDatabase : function ( a ) { var b = $ ( a . currentTarget ) . attr ( " id " ) , c = this . collection . createDatabaseURL ( b ) ; window . location . replace ( c ) } , updateDatabases : function ( ) { var a = this ; this . collection . fetch ( { cache : ! 1 , success : function ( ) { a . render ( ) , window . App . handleSelectDatabase ( ) } } ) } , editDatabase : function ( a ) { var b = this . evaluateDatabaseName ( $ ( a . currentTarget ) . attr ( " id " ) , " _edit - database " ) , c = ! 0 ; b = = = this . currentDB & & ( c = ! 1 ) , this . createEditDatabaseModal ( b , c ) } , search : function ( ) { var a , b , c , d ; a = $ ( " # databaseSearchInput " ) , b = $ ( " # databaseSearchInput " ) . val ( ) , d = this . collection . filter ( function ( a ) { return a . get ( " name " ) . indexOf ( b ) ! = = - 1 } ) , $ ( this . el ) . html ( this . template . render ( { collection : d , searchString : b , currentDB : this . currentDB } ) ) , this . replaceSVGs ( ) , a = $ ( " # databaseSearchInput " ) , c = a . val ( ) . length , a . focus ( ) , a [ 0 ] . setSelectionRange ( c , c ) } , replaceSVGs : function ( ) { $ ( " . svgToReplace " ) . each ( function ( ) { var a = $ ( this ) , b = a . attr ( " id " ) , c = a . attr ( " src " ) ; $ . get ( c , function ( c ) { var d = $ ( c ) . find ( " svg " ) ; d . attr ( " id " , b ) . attr ( " class " , " tile - icon - svg " ) . removeAttr ( " xmlns : a " ) , a . replaceWith ( d ) } , " xml " ) } ) } , evaluateDatabaseName : function ( a , b ) { var c = a . lastIndexOf ( b ) ; return a . substring ( 0 , c ) } , createEditDatabaseModal : function ( a , b ) { var c = [ ] , d = [ ] ; d . push ( window . modalView . createReadOnlyEntry ( " id_name " , " Name " , a , " " ) ) , b ? c . push ( window . modalView . createDeleteButton ( " Delete " , this . submitDeleteDatabase . bind ( this , a ) ) ) : c . push ( window . modalView . createDisabledButton ( " Delete " ) ) , window . modalView . show ( " modalTable . ejs " , " Delete database " , c , d ) } , createAddDatabaseModal : function ( ) { var a = [ ] , b = [ ] ; b . push ( window . modalView . createTextEntry ( " newDatabaseName " , " Name " , " " , ! 1 , " Database Name " , ! 0 , [ { rule : Joi . string ( ) . regex ( / ^ [ a - zA - Z ] / ) , msg : " Database name must start with a letter . " } , { rule : Joi . string ( ) . regex ( / ^ [ a - zA - Z0 - 9 \ - _ ] * $ / ) , msg : ' Only Symbols " _ " and " - " are allowed . ' } , { rule : Joi . string ( ) . required ( ) , msg : " No database name given . " } ] ) ) ; var c = [ ] ; window . App . userCollection . each ( function ( a ) { c . push ( { value : a . get ( " user " ) , label : a . get ( " user " ) } ) } ) , b . push ( window . modalView . createSelectEntry ( " newUser " , " Username " , null ! = = this . users ? this . users . whoAmI ( ) : " root " , " Please define the owner of this database . This will be the only user having initial access to this database if authentication is turned on . Please note that if you specify a username different to your account you will not be able to access the database with your account after having creating it . Specifying a username is mandatory even with authentication turned off . If there is a failure you will be informed . " , c ) ) , a . push ( window . modalView . createSuccessButton ( " Create " , this . submitCreateDatabase . bind ( this ) ) ) , window . modalView . show ( " modalTable . ejs " , " Create Database " , a , b ) , $ ( " # useDefaultPassword " ) . change ( function ( ) { " true " = = = $ ( " # useDefaultPassword " ) . val ( ) ? $ ( " # row_newPassword " ) . hide ( ) : $ ( " # row_newPassword " ) . show ( ) } ) , $ ( " # row_newPassword " ) . hide ( ) } } ) } ( ) , function ( ) { " use strict " ; window . DBSelectionView = Backbone . View . extend ( { template : templateEngine . createTemplate ( " dbSelectionView . ejs " ) , events : { " click . dbSelectionLink " : " changeDatabase " } , initialize : function ( a ) { this . current = a . current } , changeDatabase : function ( a ) { var b = $ ( a . currentTarget ) . closest ( " . dbSelectionLink . tab " ) . attr ( " id " ) , c = this . collection . createDatabaseURL ( b ) ; window . location . replace ( c ) } , render : function ( a ) { var b = function ( b , c ) { b ? arangoHelper . arangoError ( " DB " , " Could not fetch databases " ) : ( this . $ el = a , this . $ el . html ( this . template . render ( { list : c , current : this . current . get ( " name " ) } ) ) , this . delegateEvents ( ) ) } . bind ( this ) ; return this . collection . getDatabasesForUser ( b ) , this . el } } ) } ( ) , function ( ) { " use strict " ; window . DocumentsView = window . PaginationView . extend ( { filters : { 0 : ! 0 } , filterId : 0 , paginationDiv : " # documentsToolbarF " , idPrefix : " documents " , addDocumentSwitch : ! 0 , activeFilter : ! 1 , lastCollectionName : void 0 , restoredFilters : [ ] , editMode : ! 1 , allowUpload : ! 1 , el : " # content " , table : " # documentsTableID " , template : templateEngine . createTemplate ( " documentsView . ejs " ) , collectionContext : { prev : null , next : null } , editButtons : [ " # deleteSelected " , " # moveSelected " ] , initialize : function ( a ) { this . documentStore = a . documentStore , this . collectionsStore = a . collectionsStore , this . tableView = new window . TableView ( { el : this . table , collection : this . collection } ) , this . tableView . setRowClick ( this . clicked . bind ( this ) ) , this . tableView . setRemoveClick ( this . remove . bind ( this ) ) } , resize : function ( ) { $ ( " # docPureTable " ) . height ( $ ( " . centralRow " ) . height ( ) - 210 ) , $ ( " # docPureTable . pure - table - body " ) . css ( " max - height " , $ ( " # docPureTable " ) . height ( ) - 47 ) } , setCollectionId : function ( a , b ) { this . collection . setCollection ( a ) , this . collection . setPage ( b ) , this . page = b ; var c = function ( b , c ) { b ? arangoHelper . arangoError ( " Error " , " Could not get collection properties . " ) : ( this . type = c , this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , this . collectionModel = this . collectionsStore . get ( a ) ) } . bind ( this ) ; arangoHelper . collectionApiType ( a , null , c ) } , getDocsCallback : function ( a ) { $ ( " # documents_last " ) . css ( " visibility " , " hidden " ) , $ ( " # documents_first " ) . css ( " visibility " , " hidden " ) , a ? ( window . progressView . hide ( ) , arangoHelper . arangoError ( " Document error " , " Could not fetch requested documents . " ) ) : a & & void 0 = = = a | | ( window . progressView . hide ( ) , this . drawTable ( ) , this . renderPaginationElements ( ) ) } , events : { " click # collectionPrev " : " prevCollection " , " click # collectionNext " : " nextCollection " , " click # filterCollection " : " filterCollection " , " click # markDocuments " : " editDocuments " , " click # importCollection " : " importCollection " , " click # exportCollection " : " exportCollection " , " click # filterSend " : " sendFilter " , " click # addFilterItem " : " addFilterItem " , " click . removeFilterItem " : " removeFilterItem " , " click # deleteSelected " : " deleteSelectedDocs " , " click # moveSelected " : " moveSelectedDocs " , " click # addDocumentButton " : " addDocumentModal " , " click # documents_first " : " firstDocuments " , " click # documents_last " : " lastDocuments " , " click # documents_prev " : " prevDocuments " , " click # documents_next " : " nextDocuments " , " click # confirmDeleteBtn " : " confirmDelete " , " click . key " : " nop " , keyup : " returnPressedHandler " , " keydown . queryline input " : " filterValueKeydown " , " click # importModal " : " showImportModal " , " click # resetView " : " resetView " , " click # confirmDocImport " : " startUpload " , " click # exportDocuments " : " startDownload " , " change # documentSize " : " setPagesize " , " change # docsSort " : " setSorting " } , showSpinner : function ( ) { $ ( " # uploadIndicator " ) . show ( ) } , hideSpinner : function ( ) { $ ( " # uploadIndicator " ) . hide ( ) } , showImportModal : function ( ) { $ ( " # docImportModal " ) . modal ( " show " ) } , hideImportModal : function ( ) { $ ( " # docImportModal " ) . modal ( " hide " ) } , setPagesize : function ( ) { var a = $ ( " # documentSize " ) . find ( " : selected " ) . val ( ) ; this . collection . setPagesize ( a ) , this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) } , setSorting : function ( ) { var a = $ ( " # docsSort " ) . val ( ) ; " " ! = = a & & void 0 ! = = a & & null ! = = a | | ( a = " _key " ) , this . collection . setSort ( a ) } , returnPressedHandler : function ( a ) { 13 = = = a . keyCode & & $ ( a . target ) . is ( $ ( " # docsSort " ) ) & & this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , 13 = = = a . keyCode & & $ ( " # confirmDeleteBtn " ) . attr ( " disabled " ) = = = ! 1 & & this . confirmDelete ( ) } , nop : function ( a ) { a . stopPropagation ( ) } , resetView : function ( ) { var a = function ( a ) { a & & arangoHelper . arangoError ( " Document " , " Could not fetch documents count " ) } ; $ ( " input " ) . val ( " " ) , $ ( " select " ) . val ( " = = " ) , this . removeAllFilterItems ( ) , $ ( " # documentSize " ) . val ( this . collection . getPageSize ( ) ) , $ ( " # documents_last " ) . css ( " visibility " , " visible " ) , $ ( " # documents_first " ) . css ( " visibility " , " visible " ) , this . addDocumentSwitch = ! 0 , this . collection . resetFilter ( ) , this . collection . loadTotal ( a ) , this . restoredFilters = [ ] , this . allowUpload = ! 1 , this . files = void 0 , this . file = void 0 , $ ( " # confirmDocImport " ) . attr ( " disabled " , ! 0 ) , this . markFilterToggle ( ) , this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) } , startDownload : function ( ) { var a = this . collection . buildDownloadDocumentQuery ( ) ; " " ! = = a | | void 0 ! = = a | | null ! = = a ? window . open ( encodeURI ( " query / result / download / " + btoa ( JSON . stringify ( a ) ) ) ) : arangoHelper . arangoError ( " Document error " , " could not download documents " ) } , startUpload : function ( ) { var a = function ( a , b ) { a ? ( arangoHelper . arangoError ( " Upload " , b ) , this . hideSpinner ( ) ) : ( this . hideSpinner ( ) , this . hideImportModal ( ) , this . resetView ( ) ) } . bind ( this ) ; this . allowUpload = = = ! 0 & & ( this . showSpinner ( ) , this . collection . uploadDocuments ( this . file , a ) ) } , uploadSetup : function ( ) { var a = this ; $ ( " # importDocuments " ) . change ( function ( b ) { a . files = b . target . files | | b . dataTransfer . files , a . file = a . files [ 0 ] , $ ( " # confirmDocImport " ) . attr ( " disabled " , ! 1 ) , a . allowUpload = ! 0 } ) } , buildCollectionLink : function ( a ) { return " collection / " + encodeURIComponent ( a . get ( " name " ) ) + " / documents / 1 " } , markFilterToggle : function ( ) { this . restoredFilters . length > 0 ? $ ( " # filterCollection " ) . addClass ( " activated " ) : $ ( " # filterCollection " ) . removeClass ( " activated " ) } , editDocuments : function ( ) { $ ( " # importCollection " ) . removeClass ( " activated " ) , $ ( " # exportCollection " ) . removeClass ( " activated " ) , this . markFilterToggle ( ) , $ ( " # markDocuments " ) . toggleClass ( " activated " ) , this . changeEditMode ( ) , $ ( " # filterHeader " ) . hide ( ) , $ ( " # importHeader " ) . hide ( ) , $ ( " # editHeader " ) . slideToggle ( 200 ) , $ ( " # exportHeader " ) . hide ( ) } , filterCollection : function ( ) { $ ( " # importCollection " ) . removeClass ( " activated " ) , $ ( " # exportCollection " ) . removeClass ( " activated " ) , $ ( " # markDocuments " ) . removeClass ( " activated " ) , this . changeEditMode ( ! 1 ) , this . markFilterToggle ( ) , this . activeFilter = ! 0 , $ ( " # importHeader " ) . hide ( ) , $ ( " # editHeader " ) . hide ( ) , $ ( " # exportHeader " ) . hide ( ) , $ ( " # filterHeader " ) . slideToggle ( 200 ) ; var a ; for ( a in this . filters ) if ( this . filters . hasOwnProperty ( a ) ) return void $ ( " # attribute_name " + a ) . focus ( ) } , exportCollection : function ( ) { $ ( " # importCollection " ) . removeClass ( " activated " ) , $ ( " # filterHeader " ) . removeClass ( " activated " ) , $ ( " # markDocuments " ) . removeClass ( " activated " ) , this . changeEditMode ( ! 1 ) , $ ( " # exportCollection " ) . toggleClass ( " activated " ) , this . markFilterToggle ( ) , $ ( " # exportHeader " ) . slideToggle ( 200 ) , $ ( " # importHeader " ) . hide ( ) , $ ( " # filterHeader " ) . hide ( ) , $ ( " # editHeader " ) . hide ( ) } , importCollection : function ( ) { this . markFilterToggle ( ) , $ ( " # markDocuments " ) . removeClass ( " activated " ) , this . changeEditMode ( ! 1 ) , $ ( " # importCollection " ) . toggleClass ( " activated " ) , $ ( " # exportCollection " ) . removeClass ( " activated " ) , $ ( " # importHeader " ) . slideToggle ( 200 ) , $ ( " # filterHeader " ) . hide ( ) , $ ( " # editHeader " ) . hide ( ) , $ ( " # exportHeader " ) . hide ( ) } , changeEditMode : function ( a ) { a = = = ! 1 | | this . editMode = = = ! 0 ? ( $ ( " # docPureTable . pure - table - body . pure - table - row " ) . css ( " cursor " , " default " ) , $ ( " . deleteButton " ) . fadeIn ( ) , $ ( " . addButton " ) . fadeIn ( ) , $ ( " . selected - row " ) . removeClass ( " selected - row " ) , this . editMode = ! 1 , this . tableView . setRowClick ( this . clicked . bind ( this ) ) ) : ( $ ( " # docPureTable . pure - table - body . pure - table - row " ) . css ( " cursor " , " copy " ) , $ ( " . deleteButton " ) . fadeOut ( ) , $ ( " . addButton " ) . fadeOut ( ) , $ ( " . selectedCount " ) . text ( 0 ) , this . editMode = ! 0 , this . tableView . setRowClick ( this . editModeClick . bind ( this ) ) ) } , getFilterContent : function ( ) { var a , b , c = [ ] ; for ( a in this . filters ) if ( this . filters . hasOwnProperty ( a ) ) { b = $ ( " # attribute_value " + a ) . val ( ) ; try { b = JSON . parse ( b ) } catch ( d ) { b = String ( b ) } " " ! = = $ ( " # attribute_name " + a ) . val ( ) & & c . push ( { attribute : $ ( " # attribute_name " + a ) . val ( ) , operator : $ ( " # operator " + a ) . val ( ) , value : b } ) } return c } , sendFilter : function ( ) { this . restoredFilters = this . getFilterContent ( ) ; var a = this ; this . collection . resetFilter ( ) , this . addDocumentSwitch = ! 1 , _ . each ( this . restoredFilters , function ( b ) { void 0 ! = = b . operator & & a . collection . addFilter ( b . attribute , b . operator , b . value ) } ) , this . collection . setToFirst ( ) , this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , this . markFilterToggle ( ) } , restoreFilter : function ( ) { var a = this , b = 0 ; this . filterId = 0 , $ ( " # docsSort " ) . val ( this . collection . getSort ( ) ) , _ . each ( this . restoredFilters , function ( c ) { 0 ! = = b & & a . addFilterItem ( ) , void 0 ! = = c . operator & & ( $ ( " # attribute_name " + b ) . val ( c . attribute ) , $ ( " # operator " + b ) . val ( c . operator ) , $ ( " # attribute_value " + b ) . val ( c . value ) ) , b + + , a . collection . addFilter ( c . attribute , c . operator , c . value ) } ) } , addFilterItem : function ( ) { var a = + + this . filterId ; $ ( " # filterHeader " ) . append ( ' < div class = " queryline querylineAdd " > < input id = " attribute_name ' + a + ' " type = " text " placeholder = " Attribute name " > < select name = " operator " id = " operator ' + a + ' " class = " filterSelect " > < option value = " = = " > = = < / option > < option value = " ! = " > ! = < / option > < option value = " & lt ; " > & lt ; < / option > < option value = " & lt ; = " > & lt ; = < / option > < option value = " & gt ; = " > & gt ; = < / option > < option value = " & gt ; " > & gt ; < / option > < / select > < input id = " attribute_value ' + a + ' " type = " text " placeholder = " Attribute value " class = " filterValue " > < a class = " removeFilterItem " id = " removeFilter ' + a + ' " > < i class = " icon icon - minus arangoicon " > < / i > < / a > < / div > ' ) , this . filters [ a ] = ! 0 } , filterValueKeydown : function ( a ) { 13 = = = a . keyCode & & this . sendFilter ( ) } , removeFilterItem : function ( a ) { var b = a . currentTarget , c = b . id . replace ( / ^ removeFilter / , " " ) ; delete this . filters [ c ] , delete this . restoredFilters [ c ] , $ ( b . parentElement ) . remove ( ) } , removeAllFilterItems : function ( ) { var a , b = $ ( " # filterHeader " ) . children ( ) . length ; for ( a = 1 ; a < = b ; a + + ) $ ( " # removeFilter " + a ) . parent ( ) . remove ( ) ; this . filters = { 0 : ! 0 } , this . filterId = 0 } , addDocumentModal : function ( ) { var a = window . location . hash . split ( " / " ) [ 1 ] , b = [ ] , c = [ ] , d = function ( a , d ) { a ? arangoHelper . arangoError ( " Error " , " Could not fetch collection type " ) : " edge " = = = d ? ( c . push ( window . modalView . createTextEntry ( " new - edge - from - attr " , " _from " , " " , " document _id : document handle of the linked vertex ( incoming relation ) " , void 0 , ! 1 , [ { rule : Joi . string ( ) . required ( ) , msg : " No _from attribute given . " } ] ) ) , c . push ( window . modalView . createTextEntry ( " new - edge - to " , " _to " , " " , " document _id : document handle of the linked vertex ( outgoing relation ) " , void 0 , ! 1 , [ { rule : Joi . string ( ) . required ( ) , msg : " No _to attribute given . " } ] ) ) , c . push ( window . modalView . createTextEntry ( " new - edge - key - attr " , " _key " , void 0 , " the edges unique key ( optional attribute , leave empty for autogenerated key " , " is optional : leave empty for autogenerated key " , ! 1 , [ { rule : Joi . string ( ) . allow ( " " ) . optional ( ) , msg : " " } ] ) ) , b . push ( window . modalView . createSuccessButton ( " Create " , this . addEdge . bind ( this ) ) ) , window . modalView . show ( " modalTable . ejs " , " Create edge " , b , c ) ) : ( c . push ( window . modalView . createTextEntry ( " new - document - key - attr " , " _key " , void 0 , " the documents unique key ( optional attribute , leave empty for autogenerated key " , " is optional : leave empty for autogenerated key " , ! 1 , [ { rule : Joi . string ( ) . allow ( " " ) . optional ( ) , msg : " " } ] ) ) , b . push ( window . modalView . createSuccessButton ( " Create " , this . addDocument . bind ( this ) ) ) , window . modalView . show ( " modalTable . ejs " , " Create document " , b , c ) ) } . bind ( this ) ; arangoHelper . collectionApiType ( a , ! 0 , d ) } , addEdge : function ( ) { var a , b = window . location . hash . split ( " / " ) [ 1 ] , c = $ ( " . modal - body # new - edge - from - attr " ) . last ( ) . val ( ) , d = $ ( " . modal - body # new - edge - to " ) . last ( ) . val ( ) , e = $ ( " . modal - body # new - edge - key - attr " ) . last ( ) . val ( ) , f = function ( b , c ) { if ( b ) arangoHelper . arangoError ( " Error " , " Could not create edge " ) ; else { window . modalView . hide ( ) , c = c . _id . split ( " / " ) ; try { a = " collection / " + c [ 0 ] + " / " + c [ 1 ] , decodeURI ( a ) } catch ( d ) { a = " collection / " + c [ 0 ] + " / " + encodeURIComponent ( c [ 1 ] ) } window . location . hash = a } } ; " " ! = = e | | void 0 ! = = e ? this . documentStore . createTypeEdge ( b , c , d , e , f ) : this . documentStore . createTypeEdge ( b , c , d , null , f ) } , addDocument : function ( ) { var a , b = window . location . hash . split ( " / " ) [ 1 ] , c = $ ( " . modal - body # new - document - key - attr " ) . last ( ) . val ( ) , d = function ( b , c ) { if ( b ) arangoHelper . arangoError ( " Error " , " Could not create document " ) ; else { window . modalView . hide ( ) , c = c . split ( " / " ) ; try { a = " collection / " + c [ 0 ] + " / " + c [ 1 ] , decodeURI ( a ) } catch ( d ) { a = " collection / " + c [ 0 ] + " / " + encodeURIComponent ( c [ 1 ] ) } window . location . hash = a } } ; " " ! = = c | | void 0 ! = = c ? this . documentStore . createTypeDocument ( b , c , d ) : this . documentStore . createTypeDocument ( b , null , d ) } , moveSelectedDocs : function ( ) { var a = [ ] , b = [ ] , c = this . getSelectedDocs ( ) ; 0 ! = = c . length & & ( b . push ( window . modalView . createTextEntry ( " move - documents - to " , " Move to " , " " , ! 1 , " collection - name " , ! 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 . " } ] ) ) , a . push ( window . modalView . createSuccessButton ( " Move " , this . confirmMoveSelectedDocs . bind ( this ) ) ) , window . modalView . show ( " modalTable . ejs " , " Move documents " , a , b ) ) } , confirmMoveSelectedDocs : function ( ) { var a = this . getSelectedDocs ( ) , b = this , c = $ ( " . modal - body " ) . last ( ) . find ( " # move - documents - to " ) . val ( ) , d = function ( ) { this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , $ ( " # markDocuments " ) . click ( ) , window . modalView . hide ( ) } . bind ( this ) ; _ . each ( a , function ( a ) { b . collection . moveDocument ( a , b . collection . collectionID , c , d ) } ) } , deleteSelectedDocs : function ( ) { var a = [ ] , b = [ ] , c = this . getSelectedDocs ( ) ; 0 ! = = c . length & & ( b . push ( window . modalView . createReadOnlyEntry ( void 0 , c . length + " documents selected " , " Do you want to delete all selected documents ? " , void 0 , void 0 , ! 1 , void 0 ) ) , a . push ( window . modalView . createDeleteButton ( " Delete " , this . confirmDeleteSelectedDocs . bind ( this ) ) ) , window . modalView . show ( " modalTable . ejs " , " Delete documents " , a , b ) ) } , confirmDeleteSelectedDocs : function ( ) { var a = this . getSelectedDocs ( ) , b = [ ] , c = this ; _ . each ( a , function ( a ) { if ( " document " = = = c . type ) { var d = function ( a ) { a ? ( b . push ( ! 1 ) , arangoHelper . arangoError ( " Document error " , " Could not delete document . " ) ) : ( b . push ( ! 0 ) , c . collection . setTotalMinusOne ( ) , c . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , $ ( " # markDocuments " ) . click ( ) , window . modalView . hide ( ) ) } . bind ( c ) ; c . documentStore . deleteDocument ( c . collection . collectionID , a , d ) } else if ( " edge " = = = c . type ) { var e = function ( a ) { a ? ( b . push ( ! 1 ) , arangoHelper . arangoError ( " Edge error " , " Could not delete edge " ) ) : ( c . collection . setTotalMinusOne ( ) , b . push ( ! 0 ) , c . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , $ ( " # markDocuments " ) . click ( ) , window . modalView . hide ( ) ) } . bind ( c ) ; c . documentStore . deleteEdge ( c . collection . collectionID , a , e ) } } ) } , getSelectedDocs : function ( ) { var a = [ ] ; return _ . each ( $ ( " # docPureTable . pure - table - body . pure - table - row " ) , function ( b ) { $ ( b ) . hasClass ( " selected - row " ) & & a . push ( $ ( $ ( b ) . children ( ) [ 1 ] ) . find ( " . key " ) . text ( ) ) } ) , a } , remove : function ( a ) { this . docid = $ ( a . currentTarget ) . parent ( ) . parent ( ) . prev ( ) . find ( " . key " ) . text ( ) , $ ( " # confirmDeleteBtn " ) . attr ( " disabled " , ! 1 ) , $ ( " # docDeleteModal " ) . modal ( " show " ) } , confirmDelete : function ( ) { $ ( " # confirmDeleteBtn " ) . attr ( " disabled " , ! 0 ) ; var a = window . location . hash . split ( " / " ) , b = a [ 3 ] ; " source " ! = = b & & this . reallyDelete ( ) } , reallyDelete : function ( ) { if ( " document " = = = this . type ) { var a = function ( a ) { a ? arangoHelper . arangoError ( " Error " , " Could not delete document " ) : ( this . collection . setTotalMinusOne ( ) , this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , $ ( " # docDeleteModal " ) . modal ( " hide " ) ) } . bind ( this ) ; this . documentStore . deleteDocument ( this . collection . collectionID , this . docid , a ) } else if ( " edge " = = = this . type ) { var b = function ( a ) { a ? arangoHelper . arangoError ( " Edge error " , " Could not delete edge " ) : ( this . collection . setTotalMinusOne ( ) , this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , $ ( " # docDeleteModal " ) . modal ( " hide " ) ) } . bind ( this ) ; this . documentStore . deleteEdge ( this . collection . collectionID , this . docid , b ) } } , editModeClick : function ( a ) { var b = $ ( a . currentTarget ) ; b . hasClass ( " selected - row " ) ? b . removeClass ( " selected - row " ) : b . addClass ( " selected - row " ) ; var c = this . getSelectedDocs ( ) ; $ ( " . selectedCount " ) . text ( c . length ) , _ . each ( this . editButtons , function ( a ) { c . length > 0 ? ( $ ( a ) . prop ( " disabled " , ! 1 ) , $ ( a ) . removeClass ( " button - neutral " ) , $ ( a ) . removeClass ( " disabled " ) , " # moveSelected " = = = a ? $ ( a ) . addClass ( " button - success " ) : $ ( a ) . addClass ( " button - danger " ) ) : ( $ ( a ) . prop ( " disabled " , ! 0 ) , $ ( a ) . addClass ( " disabled " ) , $ ( a ) . addClass ( " button - neutral " ) , " # moveSelected " = = = a ? $ ( a ) . removeClass ( " button - success " ) : $ ( a ) . removeClass ( " button - danger " ) ) } ) } , clicked : function ( a ) { var b , c = a . currentTarget , d = $ ( c ) . attr ( " id " ) . substr ( 4 ) ; try { b = " collection / " + this . collection . collectionID + " / " + d , decodeURI ( d ) } catch ( e ) { b = " collection / " + this . collection . collectionID + " / " + encodeURIComponent ( d ) } window . location . hash = b } , drawTable : function ( ) { this . tableView . setElement ( $ ( " # docPureTable " ) ) . render ( ) , arangoHelper . fixTooltips ( " . icon_arangodb , . arangoicon " , " top " ) , $ ( " . prettify " ) . snippet ( " javascript " , { style : " nedit " , menu : ! 1 , startText : ! 1 , transparent : ! 0 , showNum : ! 1 } ) , this . resize ( ) } , checkCollectionState : function ( ) { this . lastCollectionName = = = this . collectionName ? this . activeFilter & & ( this . filterCollection ( ) , this . restoreFilter ( ) ) : void 0 ! = = this . lastCollectionName & & ( this . collection . resetFilter ( ) , this . collection . setSort ( " " ) , this . restoredFilters = [ ] , this . activeFilter = ! 1 ) } , render : function ( ) { return $ ( this . el ) . html ( this . template . render ( { } ) ) , 2 = = = this . type ? this . type = " document " : 3 = = = this . type & & ( this . type = " edge " ) , this . tableView . setElement ( $ ( this . table ) ) . drawLoading ( ) , this . collectionContext = this . collectionsStore . getPosition ( this . collection . collectionID ) , this . collectionName = window . location . hash . split ( " / " ) [ 1 ] , this . breadcrumb ( ) , window . arangoHelper . buildCollectionSubNav ( this . collectionName , " Content " ) , this . checkCollectionState ( ) , this . lastCollectionName = this . collectionName , this . uploadSetup ( ) , $ ( " [ data - toggle = tooltip ] " ) . tooltip ( ) , $ ( " . upload - info " ) . tooltip ( ) , arangoHelper . fixTooltips ( " . icon_arangodb , . arangoicon " , " top " ) , this . renderPaginationElements ( ) , this . selectActivePagesize ( ) , this . markFilterToggle ( ) , this . resize ( ) , this } , rerender : function ( ) { this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) , this . resize ( ) } , selectActivePagesize : function ( ) { $ ( " # documentSize " ) . val ( this . collection . getPageSize ( ) ) } , renderPaginationElements : function ( ) { this . renderPagination ( ) ; var a = $ ( " # totalDocuments " ) ; 0 = = = a . length & & ( $ ( " # documentsToolbarFL " ) . append ( ' < a id = " totalDocuments " class = " totalDocuments " > < / a > ' ) , a = $ ( " # totalDocuments " ) ) , " document " = = = this . type & & a . html ( numeral ( this . collection . getTotal ( ) ) . format ( " 0 , 0 " ) + " doc ( s ) " ) , " edge " = = = this . type & & a . html ( numeral ( this . collection . getTotal ( ) ) . format ( " 0 , 0 " ) + " edge ( s ) " ) } , breadcrumb : function ( ) { $ ( " # subNavigationBar . breadcrumb " ) . html ( " Collection : " + this . collectionName ) } } ) } ( ) , function ( ) { " use strict " ; var a = function ( a ) { var b = a . split ( " / " ) ; return " collection / " + encodeURIComponent ( b [ 0 ] ) + " / " + encodeURIComponent ( b [ 1 ] ) } ; window . DocumentView = Backbone . View . extend ( { el : " # content " , colid : 0 , docid : 0 , customView : ! 1 , defaultMode : " tree " , template : templateEngine . createTemplate ( " documentView . ejs " ) , events : { " click # saveDocumentButton " : " saveDocument " , " click # deleteDocumentButton " : " deleteDocumentModal " , " click # confirmDeleteDocument " : " deleteDocument " , " click # document - from " : " navigateToDocument " , " click # document - to " : " navigateToDocument " , " keydown # documentEditor . ace_editor " : " keyPress " , " keyup . jsoneditor . search input " : " checkSearchBox " , " click . jsoneditor . modes " : " storeMode " , " click # addDocument " : " addDocument " } , checkSearchBox : function ( a ) { " " = = = $ ( a . currentTarget ) . val ( ) & & this . editor . expandAll ( ) } , addDocument : function ( ) { window . App . documentsView . addDocumentModal ( ) } , storeMode : function ( ) { var a = this ; $ ( " . type - modes " ) . on ( " click " , function ( b ) { a . defaultMode = $ ( b . currentTarget ) . text ( ) . toLowerCase ( ) } ) } , keyPress : function ( a ) { a . ctrlKey & & 13 = = = a . keyCode ? ( a . preventDefault ( ) , this . saveDocument ( ) ) : a . metaKey & & 13 = = = a . keyCode & & ( a . preventDefault ( ) , this . saveDocument ( ) ) } , editor : 0 , setType : function ( a ) { a = 2 = = = a ? " document " : " edge " ; var b = function ( a , b ) { if ( a ) arangoHelper . arangoError ( " Error " , " Could not fetch data . " ) ; else { var c = b + " : " ; this . type = b , this . fillInfo ( c ) , this . fillEditor ( ) } } . bind ( this ) ; " edge " = = = a ? this . collection . getEdge ( this . colid , this . docid , b ) : " document " = = = a & & this . collection . getDocument ( this . colid , this . docid , b ) } , deleteDocumentModal : function ( ) { var a = [ ] , b = [ ] ; b . push ( window . modalView . createReadOnlyEntry ( " doc - delete - button " , " Confirm delete , document id is " , this . type . _id , void 0 , void 0 , ! 1 , / [ < > & ' " ] / ) ) , a . push ( window . modalView . createDeleteButton ( " Delete " , this . deleteDocument . bind ( this ) ) ) , window . modalView . show ( " modalTable . ejs " , " Delete Document " , a , b ) } , deleteDocument : function ( ) { var a = function ( ) { if ( this . customView ) this . customDeleteFunction ( ) ; else { var a = " collection / " + encodeURIComponent ( this . colid ) + " / documents / 1 " ; window . modalView . hide ( ) , window . App . navigate ( a , { trigger : ! 0 } ) } } . bind ( this ) ; if ( this . type . _from & & this . type . _to ) { var b = function ( b ) { b ? arangoHelper . arangoError ( " Edge error " , " Could not delete edge " ) : a ( ) } ; this . collection . deleteEdge ( this . colid , this . docid , b ) } else { var c = function ( b ) { b ? arangoHelper . arangoError ( " Error " , " Could not delete document " ) : a ( ) } ; this . collection . deleteDocument ( this . colid , this . docid , c ) } } , navigateToDocument : function ( a ) { var b = $ ( a . target ) . attr ( " documentLink " ) ; b & & window . App . navigate ( b , { trigger : ! 0 } ) } , fillInfo : function ( ) { var b = this . collection . first ( ) , c = b . get ( " _id " ) , d = b . get ( " _key " ) , e = b . get ( " _rev " ) , f = b . get ( " _from " ) , g = b . get ( " _to " ) ; if ( $ ( " # document - type " ) . css ( " margin - left " , " 10px " ) , $ ( " # document - type " ) . text ( " _id : " ) , $ ( " # document - id " ) . css ( " margin - left " , " 0 " ) , $ ( " # document - id " ) . text ( c ) , $ ( " # document - key " ) . text ( d ) , $ ( " # document - rev " ) . text ( e ) , f & & g ) { var h = a ( f ) , i = a ( g ) ; $ ( " # document - from " ) . text ( f ) , $ ( " # document - from " ) . attr ( " documentLink " , h ) , $ ( " # document - to " ) . text ( g ) , $ ( " # document - to " ) . attr ( " documentLink " , i ) } else $ ( " . edge - info - container " ) . hide ( ) } , fillEditor : function ( ) { var a = this . removeReadonlyKeys ( this . collection . first ( ) . attributes ) ; $ ( " . disabledBread " ) . last ( ) . text ( this . collection . first ( ) . get ( " _key " ) ) , this . editor . set ( a ) , $ ( " . ace_content " ) . attr ( " font - size " , " 11pt " ) } , jsonContentChanged : function ( ) { this . enableSaveButton ( ) } , resize : function ( ) { $ ( " # documentEditor " ) . height ( $ ( " . centralRow " ) . height ( ) - 300 ) } , render : function ( ) { $ ( this . el ) . html ( this . template . render ( { } ) ) , $ ( " # documentEditor " ) . height ( $ ( " . centralRow " ) . height ( ) - 300 ) , this . disableSaveButton ( ) , this . breadcrumb ( ) ; var a = this , b = document . getElementById ( " documentEditor " ) , c = { change : function ( ) { a . jsonContentChanged ( ) } , search : ! 0 , mode : " tree " , modes : [ " tree " , " code " ] , iconlib : " fontawesome4 " } ; return this . editor = new JSONEditor ( b , c ) , this . editor . setMode ( this . defaultMode ) , this } , removeReadonlyKeys : function ( a ) { return _ . omit ( a , [ " _key " , " _id " , " _from " , " _to " , " _rev " ] ) } , saveDocument : function ( ) { if ( void 0 = = = $ ( " # saveDocumentButton " ) . attr ( " disabled " ) ) if ( " _ " = = = this . collection . first ( ) . attributes . _id . substr ( 0 , 1 ) ) { var a = [ ] , b = [ ] ; b . push ( window . modalView . createReadOnlyEntry ( " doc - save - system - button " , " Caution " , " You are modifying a system collection . Really continue ? " , void 0 , void 0 , ! 1 , / [ < > & ' " ] / ) ) , a . push ( window . modalView . createSuccessButton ( " Save " , this . confirmSaveDocument . bind ( this ) ) ) , window . modalView . show ( " modalTable . ejs " , " Modify System Collection " , a , b ) } else this . confirmSaveDocument ( ) } , confirmSaveDocument : function ( ) { window . modalView . hide ( ) ; var a ; try { a = this . editor . get ( ) } catch ( b ) { return this . errorConfirmation ( b ) , void this . disableSaveButton ( ) } if ( a = JSON . stringify ( a ) , this . type . _from & & this . type . _to ) { var c = function ( a ) { a ? arangoHelper . arangoError ( " Error " , " Could not save edge . " ) : ( this . successConfirmation ( ) , this . disableSaveButton ( ) ) } . bind ( this ) ; this . collection . saveEdge ( this . colid , this . docid , this . type . _from , this . type . _to , a , c ) } else { var d = function ( a ) { a ? arangoHelper . arangoError ( " Error " , " Could not save document . " ) : ( this . successConfirmation ( ) , this . disableSaveButton ( ) ) } . bind ( this ) ; this . collection . saveDocument ( this . colid , this . docid , a , d ) } } , successConfirmation : function ( ) { arangoHelper . arangoNotification ( " Document saved . " ) } , errorConfirmation : function ( a ) { arangoHelper . arangoError ( " Document editor : " , a ) } , enableSaveButton : function ( ) { $ ( " # saveDocumentButton " ) . prop ( " disabled " , ! 1 ) , $ ( " # saveDocumentButton " ) . addClass ( " button - success " ) , $ ( " # saveDocumentButton " ) . removeClass ( " button - close " ) } , disableSaveButton : function ( ) { $ ( " # saveDocumentButton " ) . prop ( " disabled " , ! 0 ) , $ ( " # saveDocumentButton " ) . addClass ( " button - close " ) , $ ( " # saveDocumentButton " ) . removeClass ( " button - success " ) } , breadcrumb : function ( ) { var a = window . location . hash . split ( " / " ) ; $ ( " # subNavigationBar . breadcrumb " ) . html ( ' < a href = " # collection / ' + a [ 1 ] + ' / documents / 1 " > Collection : ' + a [ 1 ] + ' < / a > < i class = " fa fa - chevron - right " > < / i > Document : ' + a [ 2 ] ) } , escaped : function ( a ) { return a . replace ( / & / g , " & amp ; " ) . replace ( / < / g , " & lt ; " ) . replace ( / > / g , " & gt ; " ) . replace ( / " / g , " & quot ; " ) . replace ( / ' / g , " & # 39 ; " ) } } ) } ( ) , function ( ) { " use strict " ; window . FooterView = Backbone . View . extend ( { <nl> + el : " # footerBar " , system : { } , isOffline : ! 0 , isOfflineCounter : 0 , firstLogin : ! 0 , timer : 15e3 , lap : 0 , timerFunction : null , events : { " click . footer - center p " : " showShortcutModal " } , initialize : function ( ) { var a = this ; window . setInterval ( function ( ) { a . getVersion ( ) } , a . timer ) , a . getVersion ( ) , window . VISIBLE = ! 0 , document . addEventListener ( " visibilitychange " , function ( ) { window . VISIBLE = ! window . VISIBLE } ) , $ ( " # offlinePlaceholder button " ) . on ( " click " , function ( ) { a . getVersion ( ) } ) , window . setTimeout ( function ( ) { window . frontendConfig . isCluster = = = ! 0 & & ( $ ( " . health - state " ) . css ( " cursor " , " pointer " ) , $ ( " . health - state " ) . on ( " click " , function ( ) { window . App . navigate ( " # nodes " , { trigger : ! 0 } ) } ) ) } , 1e3 ) } , template : templateEngine . createTemplate ( " footerView . ejs " ) , showServerStatus : function ( a ) { window . App . isCluster ? this . renderClusterState ( a ) : a = = = ! 0 ? ( $ ( " # healthStatus " ) . removeClass ( " negative " ) , $ ( " # healthStatus " ) . addClass ( " positive " ) , $ ( " . health - state " ) . html ( " GOOD " ) , $ ( " . health - icon " ) . html ( ' < i class = " fa fa - check - circle " > < / i > ' ) , $ ( " # offlinePlaceholder " ) . hide ( ) ) : ( $ ( " # healthStatus " ) . removeClass ( " positive " ) , $ ( " # healthStatus " ) . addClass ( " negative " ) , $ ( " . health - state " ) . html ( " UNKNOWN " ) , $ ( " . health - icon " ) . html ( ' < i class = " fa fa - exclamation - circle " > < / i > ' ) , $ ( " # offlinePlaceholder " ) . show ( ) , this . reconnectAnimation ( 0 ) ) } , reconnectAnimation : function ( a ) { var b = this ; 0 = = = a & & ( b . lap = a , $ ( " # offlineSeconds " ) . text ( b . timer / 1e3 ) , clearTimeout ( b . timerFunction ) ) , b . lap < this . timer / 1e3 & & ( b . lap + + , $ ( " # offlineSeconds " ) . text ( b . timer / 1e3 - b . lap ) , b . timerFunction = window . setTimeout ( function ( ) { b . timer / 1e3 - b . lap = = = 0 ? b . getVersion ( ) : b . reconnectAnimation ( b . lap ) } , 1e3 ) ) } , renderClusterState : function ( a ) { if ( a ) { $ ( " # offlinePlaceholder " ) . hide ( ) ; var b = function ( a ) { var b = a . Health , c = 0 ; _ . each ( b , function ( a ) { " GOOD " ! = = a . Status & & c + + } ) , c > 0 ? ( $ ( " # healthStatus " ) . removeClass ( " positive " ) , $ ( " # healthStatus " ) . addClass ( " negative " ) , 1 = = = c ? $ ( " . health - state " ) . html ( c + " NODE ERROR " ) : $ ( " . health - state " ) . html ( c + " NODES ERROR " ) , $ ( " . health - icon " ) . html ( ' < i class = " fa fa - exclamation - circle " > < / i > ' ) ) : ( $ ( " # healthStatus " ) . removeClass ( " negative " ) , $ ( " # healthStatus " ) . addClass ( " positive " ) , $ ( " . health - state " ) . html ( " NODES OK " ) , $ ( " . health - icon " ) . html ( ' < i class = " fa fa - check - circle " > < / i > ' ) ) } ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / health " ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( a ) { b ( a ) } } ) } else $ ( " # healthStatus " ) . removeClass ( " positive " ) , $ ( " # healthStatus " ) . addClass ( " negative " ) , $ ( " . health - state " ) . html ( window . location . host + " OFFLINE " ) , $ ( " . health - icon " ) . html ( ' < i class = " fa fa - exclamation - circle " > < / i > ' ) , $ ( " # offlinePlaceholder " ) . show ( ) , this . reconnectAnimation ( 0 ) } , showShortcutModal : function ( ) { window . arangoHelper . hotkeysFunctions . showHotkeysModal ( ) } , getVersion : function ( ) { var a = this ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / version " ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( b ) { a . showServerStatus ( ! 0 ) , a . isOffline = = = ! 0 & & ( a . isOffline = ! 1 , a . isOfflineCounter = 0 , a . firstLogin ? a . firstLogin = ! 1 : window . setTimeout ( function ( ) { a . showServerStatus ( ! 0 ) } , 1e3 ) , a . system . name = b . server , a . system . version = b . version , a . render ( ) ) } , error : function ( b ) { 401 = = = b . status ? ( a . showServerStatus ( ! 0 ) , window . App . navigate ( " login " , { trigger : ! 0 } ) ) : ( a . isOffline = ! 0 , a . isOfflineCounter + + , a . isOfflineCounter > = 1 & & a . showServerStatus ( ! 1 ) ) } } ) , a . system . hasOwnProperty ( " database " ) | | $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / database / current " ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( b ) { var c = b . result . name ; a . system . database = c ; var d = window . setInterval ( function ( ) { var b = $ ( " # databaseNavi " ) ; b & & ( window . clearTimeout ( d ) , d = null , a . render ( ) ) } , 50 ) } } ) } , renderVersion : function ( ) { this . system . hasOwnProperty ( " database " ) & & this . system . hasOwnProperty ( " name " ) & & $ ( this . el ) . html ( this . template . render ( { name : this . system . name , version : this . system . version , database : this . system . database } ) ) } , render : function ( ) { return this . system . version | | this . getVersion ( ) , $ ( this . el ) . html ( this . template . render ( { name : this . system . name , version : this . system . version } ) ) , this } } ) } ( ) , function ( ) { " use strict " ; window . FoxxActiveView = Backbone . View . extend ( { tagName : " div " , className : " tile pure - u - 1 - 1 pure - u - sm - 1 - 2 pure - u - md - 1 - 3 pure - u - lg - 1 - 4 pure - u - xl - 1 - 6 " , template : templateEngine . createTemplate ( " foxxActiveView . ejs " ) , _show : ! 0 , events : { click : " openAppDetailView " } , openAppDetailView : function ( ) { window . App . navigate ( " service / " + encodeURIComponent ( this . model . get ( " mount " ) ) , { trigger : ! 0 } ) } , toggle : function ( a , b ) { switch ( a ) { case " devel " : this . model . isDevelopment ( ) & & ( this . _show = b ) ; break ; case " production " : this . model . isDevelopment ( ) | | this . model . isSystem ( ) | | ( this . _show = b ) ; break ; case " system " : this . model . isSystem ( ) & & ( this . _show = b ) } this . _show ? $ ( this . el ) . show ( ) : $ ( this . el ) . hide ( ) } , render : function ( ) { return this . model . fetchThumbnail ( function ( ) { $ ( this . el ) . html ( this . template . render ( { model : this . model } ) ) ; var a = function ( ) { this . model . needsConfiguration ( ) & & ( $ ( this . el ) . find ( " . warning - icons " ) . length > 0 ? $ ( this . el ) . find ( " . warning - icons " ) . append ( ' < span class = " fa fa - cog " title = " Needs configuration " > < / span > ' ) : $ ( this . el ) . find ( " img " ) . after ( ' < span class = " warning - icons " > < span class = " fa fa - cog " title = " Needs configuration " > < / span > < / span > ' ) ) } . bind ( this ) , b = function ( ) { this . model . hasUnconfiguredDependencies ( ) & & ( $ ( this . el ) . find ( " . warning - icons " ) . length > 0 ? $ ( this . el ) . find ( " . warning - icons " ) . append ( ' < span class = " fa fa - cubes " title = " Unconfigured dependencies " > < / span > ' ) : $ ( this . el ) . find ( " img " ) . after ( ' < span class = " warning - icons " > < span class = " fa fa - cubes " title = " Unconfigured dependencies " > < / span > < / span > ' ) ) } . bind ( this ) ; this . model . getConfiguration ( a ) , this . model . getDependencies ( b ) } . bind ( this ) ) , $ ( this . el ) } } ) } ( ) , function ( ) { " use strict " ; var a = { ERROR_SERVICE_DOWNLOAD_FAILED : { code : 1752 , message : " service download failed " } } , b = templateEngine . createTemplate ( " applicationListView . ejs " ) , c = function ( a ) { this . collection = a . collection } , d = function ( b ) { var c = this ; if ( b . error = = = ! 1 ) this . collection . fetch ( { success : function ( ) { window . modalView . hide ( ) , c . reload ( ) , console . log ( b ) , arangoHelper . arangoNotification ( " Services " , " Service " + b . name + " installed . " ) } } ) ; else { var d = b ; switch ( b . hasOwnProperty ( " responseJSON " ) & & ( d = b . responseJSON ) , d . errorNum ) { case a . ERROR_SERVICE_DOWNLOAD_FAILED . code : arangoHelper . arangoError ( " Services " , " Unable to download application from the given repository . " ) ; break ; default : arangoHelper . arangoError ( " Services " , d . errorNum + " . " + d . errorMessage ) } } } , e = function ( ) { window . modalView . modalBindValidation ( { id : " new - app - mount " , validateInput : function ( ) { return [ { rule : Joi . string ( ) . regex ( / ^ ( \ / ( APP [ ^ \ / ] + | ( ? ! APP ) [ a - zA - Z0 - 9_ \ - % ] + ) ) + $ / i ) , msg : " May not contain / APP " } , { rule : Joi . string ( ) . regex ( / ^ ( \ / [ a - zA - Z0 - 9_ \ - % ] + ) + $ / ) , msg : " Can only contain [ a - zA - Z0 - 9_ - % ] " } , { rule : Joi . string ( ) . regex ( / ^ \ / ( [ ^ _ ] | _open \ / ) / ) , msg : " Mountpoints with _ are reserved for internal use " } , { rule : Joi . string ( ) . regex ( / [ ^ \ / ] $ / ) , msg : " May not end with / " } , { rule : Joi . string ( ) . regex ( / ^ \ / / ) , msg : " Has to start with / " } , { rule : Joi . string ( ) . required ( ) . min ( 2 ) , msg : " Has to be non - empty " } ] } } ) } , f = function ( ) { window . modalView . modalBindValidation ( { id : " repository " , validateInput : function ( ) { return [ { rule : Joi . string ( ) . required ( ) . regex ( / ^ [ a - zA - Z0 - 9_ \ - ] + \ / [ a - zA - Z0 - 9_ \ - ] + $ / ) , msg : " No valid Github account and repository . " } ] } } ) } , g = function ( ) { window . modalView . modalBindValidation ( { id : " new - app - author " , validateInput : function ( ) { return [ { rule : Joi . string ( ) . required ( ) . min ( 1 ) , msg : " Has to be non empty . " } ] } } ) , window . modalView . modalBindValidation ( { id : " new - app - name " , validateInput : function ( ) { return [ { rule : Joi . string ( ) . required ( ) . regex ( / ^ [ a - zA - Z \ - _ ] [ a - zA - Z0 - 9 \ - _ ] * $ / ) , msg : " Can only contain a to z , A to Z , 0 - 9 , ' - ' and ' _ ' . " } ] } } ) , window . modalView . modalBindValidation ( { id : " new - app - description " , validateInput : function ( ) { return [ { rule : Joi . string ( ) . required ( ) . min ( 1 ) , msg : " Has to be non empty . " } ] } } ) , window . modalView . modalBindValidation ( { id : " new - app - license " , validateInput : function ( ) { return [ { rule : Joi . string ( ) . required ( ) . regex ( / ^ [ a - zA - Z0 - 9 \ . , ; \ - ] + $ / ) , msg : " Has to be non empty . " } ] } } ) , window . modalView . modalTestAll ( ) } , h = function ( a ) { window . modalView . clearValidators ( ) ; var b = $ ( " # modalButton1 " ) ; switch ( this . _upgrade | | e ( ) , a ) { case " newApp " : b . html ( " Generate " ) , b . prop ( " disabled " , ! 1 ) , g ( ) ; break ; case " appstore " : b . html ( " Install " ) , b . prop ( " disabled " , ! 0 ) ; break ; case " github " : f ( ) , b . html ( " Install " ) , b . prop ( " disabled " , ! 1 ) ; break ; case " zip " : b . html ( " Install " ) , b . prop ( " disabled " , ! 1 ) } b . prop ( " disabled " ) | | window . modalView . modalTestAll ( ) | | b . prop ( " disabled " , ! 0 ) } , i = function ( a ) { var b = $ ( a . currentTarget ) . attr ( " href " ) . substr ( 1 ) ; h . call ( this , b ) } , j = function ( a ) { if ( h . call ( this , " appstore " ) , window . modalView . modalTestAll ( ) ) { var b , c ; this . _upgrade ? ( b = this . mount , c = $ ( " # new - app - teardown " ) . prop ( " checked " ) ) : b = window . arangoHelper . escapeHtml ( $ ( " # new - app - mount " ) . val ( ) ) ; var e = $ ( a . currentTarget ) . attr ( " appId " ) , f = $ ( a . currentTarget ) . attr ( " appVersion " ) ; void 0 ! = = c ? this . collection . installFromStore ( { name : e , version : f } , b , d . bind ( this ) , c ) : this . collection . installFromStore ( { name : e , version : f } , b , d . bind ( this ) ) , window . modalView . hide ( ) , arangoHelper . arangoNotification ( " Services " , " Installing " + e + " . " ) } } , k = function ( a , b ) { if ( void 0 = = = b ? b = this . _uploadData : this . _uploadData = b , b & & window . modalView . modalTestAll ( ) ) { var c , e ; this . _upgrade ? ( c = this . mount , e = $ ( " # new - app - teardown " ) . prop ( " checked " ) ) : c = window . arangoHelper . escapeHtml ( $ ( " # new - app - mount " ) . val ( ) ) , void 0 ! = = e ? this . collection . installFromZip ( b . filename , c , d . bind ( this ) , e ) : this . collection . installFromZip ( b . filename , c , d . bind ( this ) ) } } , l = function ( ) { if ( window . modalView . modalTestAll ( ) ) { var a , b , c , e ; this . _upgrade ? ( c = this . mount , e = $ ( " # new - app - teardown " ) . prop ( " checked " ) ) : c = window . arangoHelper . escapeHtml ( $ ( " # new - app - mount " ) . val ( ) ) , a = window . arangoHelper . escapeHtml ( $ ( " # repository " ) . val ( ) ) , b = window . arangoHelper . escapeHtml ( $ ( " # tag " ) . val ( ) ) , " " = = = b & & ( b = " master " ) ; var f = { url : window . arangoHelper . escapeHtml ( $ ( " # repository " ) . val ( ) ) , version : window . arangoHelper . escapeHtml ( $ ( " # tag " ) . val ( ) ) } ; try { Joi . assert ( a , Joi . string ( ) . regex ( / ^ [ a - zA - Z0 - 9_ \ - ] + \ / [ a - zA - Z0 - 9_ \ - ] + $ / ) ) } catch ( g ) { return } void 0 ! = = e ? this . collection . installFromGithub ( f , c , d . bind ( this ) , e ) : this . collection . installFromGithub ( f , c , d . bind ( this ) ) } } , m = function ( ) { if ( window . modalView . modalTestAll ( ) ) { var a , b ; this . _upgrade ? ( a = this . mount , b = $ ( " # new - app - teardown " ) . prop ( " checked " ) ) : a = window . arangoHelper . escapeHtml ( $ ( " # new - app - mount " ) . val ( ) ) ; var c = { name : window . arangoHelper . escapeHtml ( $ ( " # new - app - name " ) . val ( ) ) , documentCollections : _ . map ( $ ( " # new - app - document - collections " ) . select2 ( " data " ) , function ( a ) { return window . arangoHelper . escapeHtml ( a . text ) } ) , edgeCollections : _ . map ( $ ( " # new - app - edge - collections " ) . select2 ( " data " ) , function ( a ) { return window . arangoHelper . escapeHtml ( a . text ) } ) , author : window . arangoHelper . escapeHtml ( $ ( " # new - app - author " ) . val ( ) ) , license : window . arangoHelper . escapeHtml ( $ ( " # new - app - license " ) . val ( ) ) , description : window . arangoHelper . escapeHtml ( $ ( " # new - app - description " ) . val ( ) ) } ; void 0 ! = = b ? this . collection . generate ( c , a , d . bind ( this ) , b ) : this . collection . generate ( c , a , d . bind ( this ) ) } } , n = function ( ) { var a = $ ( " . modal - body . tab - pane . active " ) . attr ( " id " ) ; switch ( a ) { case " newApp " : m . apply ( this ) ; break ; case " github " : l . apply ( this ) ; break ; case " zip " : k . apply ( this ) } } , o = function ( a , c ) { var d = [ ] , e = { " click # infoTab a " : i . bind ( a ) , " click . install - app " : j . bind ( a ) } ; d . push ( window . modalView . createSuccessButton ( " Generate " , n . bind ( a ) ) ) , window . modalView . show ( " modalApplicationMount . ejs " , " Install Service " , d , c , void 0 , void 0 , e ) , $ ( " # new - app - document - collections " ) . select2 ( { tags : [ ] , showSearchBox : ! 1 , minimumResultsForSearch : - 1 , width : " 336px " } ) , $ ( " # new - app - edge - collections " ) . select2 ( { tags : [ ] , showSearchBox : ! 1 , minimumResultsForSearch : - 1 , width : " 336px " } ) ; var f = function ( ) { var a = $ ( " # modalButton1 " ) ; a . prop ( " disabled " ) | | window . modalView . modalTestAll ( ) ? a . prop ( " disabled " , ! 1 ) : a . prop ( " disabled " , ! 0 ) } ; $ ( " . select2 - search - field input " ) . focusout ( function ( ) { f ( ) , window . setTimeout ( function ( ) { $ ( " . select2 - drop " ) . is ( " : visible " ) & & ( $ ( " # select2 - search - field input " ) . is ( " : focus " ) | | ( $ ( " # s2id_new - app - document - collections " ) . select2 ( " close " ) , $ ( " # s2id_new - app - edge - collections " ) . select2 ( " close " ) , f ( ) ) ) } , 200 ) } ) , $ ( " . select2 - search - field input " ) . focusin ( function ( ) { if ( $ ( " . select2 - drop " ) . is ( " : visible " ) ) { var a = $ ( " # modalButton1 " ) ; a . prop ( " disabled " , ! 0 ) } } ) , $ ( " # upload - foxx - zip " ) . uploadFile ( { url : arangoHelper . databaseUrl ( " / _api / upload ? multipart = true " ) , allowedTypes : " zip " , multiple : ! 1 , onSuccess : k . bind ( a ) } ) , $ . get ( " foxxes / fishbowl " , function ( a ) { var c = $ ( " # appstore - content " ) ; c . html ( " " ) , _ . each ( _ . sortBy ( a , " name " ) , function ( a ) { c . append ( b . render ( a ) ) } ) } ) . fail ( function ( ) { var a = $ ( " # appstore - content " ) ; a . append ( " < tr > < td > Store is not available . ArangoDB is not able to connect to github . com < / td > < / tr > " ) } ) } ; c . prototype . install = function ( a ) { this . reload = a , this . _upgrade = ! 1 , this . _uploadData = void 0 , delete this . mount , o ( this , ! 1 ) , window . modalView . clearValidators ( ) , e ( ) , g ( ) } , c . prototype . upgrade = function ( a , b ) { this . reload = b , this . _upgrade = ! 0 , this . _uploadData = void 0 , this . mount = a , o ( this , ! 0 ) , window . modalView . clearValidators ( ) , g ( ) } , window . FoxxInstallView = c } ( ) , function ( ) { " use strict " ; window . GraphManagementView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " graphManagementView . ejs " ) , edgeDefintionTemplate : templateEngine . createTemplate ( " edgeDefinitionTable . ejs " ) , eCollList : [ ] , removedECollList : [ ] , dropdownVisible : ! 1 , initialize : function ( a ) { this . options = a } , events : { " click # deleteGraph " : " deleteGraph " , " click . icon_arangodb_settings2 . editGraph " : " editGraph " , " click # createGraph " : " addNewGraph " , " keyup # graphManagementSearchInput " : " search " , " click # graphManagementSearchSubmit " : " search " , " click . tile - graph " : " redirectToGraphViewer " , " click # graphManagementToggle " : " toggleGraphDropdown " , " click . css - label " : " checkBoxes " , " change # graphSortDesc " : " sorting " } , toggleTab : function ( a ) { var b = a . currentTarget . id ; b = b . replace ( " tab - " , " " ) , $ ( " # tab - content - create - graph . tab - pane " ) . removeClass ( " active " ) , $ ( " # tab - content - create - graph # " + b ) . addClass ( " active " ) , " exampleGraphs " = = = b ? $ ( " # modal - dialog . modal - footer . button - success " ) . css ( " display " , " none " ) : $ ( " # modal - dialog . modal - footer . button - success " ) . css ( " display " , " initial " ) } , redirectToGraphViewer : function ( a ) { var b = $ ( a . currentTarget ) . attr ( " id " ) ; b = b . substr ( 0 , b . length - 5 ) , window . location = window . location + " / " + encodeURIComponent ( b ) } , loadGraphViewer : function ( a , b ) { var c = function ( b ) { if ( b ) arangoHelper . arangoError ( " " , " " ) ; else { var c = this . collection . get ( a ) . get ( " edgeDefinitions " ) ; if ( ! c | | 0 = = = c . length ) return ; var d = { type : " gharial " , graphName : a , baseUrl : arangoHelper . databaseUrl ( " / " ) } , e = $ ( " # content " ) . width ( ) - 75 ; $ ( " # content " ) . html ( " " ) ; var f = arangoHelper . calculateCenterDivHeight ( ) ; this . ui = new GraphViewerUI ( $ ( " # content " ) [ 0 ] , d , e , $ ( " . centralRow " ) . height ( ) - 135 , { nodeShaper : { label : " _key " , color : { type : " attribute " , key : " _key " } } } , ( ! 0 ) ) , $ ( " . contentDiv " ) . height ( f ) } } . bind ( this ) ; b ? this . collection . fetch ( { cache : ! 1 , success : function ( ) { c ( ) } } ) : c ( ) } , handleResize : function ( a ) { this . width & & this . width = = = a | | ( this . width = a , this . ui & & this . ui . changeWidth ( a ) ) } , addNewGraph : function ( a ) { a . preventDefault ( ) , this . createEditGraphModal ( ) } , deleteGraph : function ( ) { var a = this , b = $ ( " # editGraphName " ) [ 0 ] . value ; if ( $ ( " # dropGraphCollections " ) . is ( " : checked " ) ) { var c = function ( c ) { c ? ( a . collection . remove ( a . collection . get ( b ) ) , a . updateGraphManagementView ( ) , window . modalView . hide ( ) ) : ( window . modalView . hide ( ) , arangoHelper . arangoError ( " Graph " , " Could not delete Graph . " ) ) } ; this . collection . dropAndDeleteGraph ( b , c ) } else this . collection . get ( b ) . destroy ( { success : function ( ) { a . updateGraphManagementView ( ) , window . modalView . hide ( ) } , error : function ( a , b ) { var c = JSON . parse ( b . responseText ) , d = c . errorMessage ; arangoHelper . arangoError ( d ) , window . modalView . hide ( ) } } ) } , checkBoxes : function ( a ) { var b = a . currentTarget . id ; $ ( " # " + b ) . click ( ) } , toggleGraphDropdown : function ( ) { $ ( " # graphSortDesc " ) . attr ( " checked " , this . collection . sortOptions . desc ) , $ ( " # graphManagementToggle " ) . toggleClass ( " activated " ) , $ ( " # graphManagementDropdown2 " ) . slideToggle ( 200 ) } , sorting : function ( ) { $ ( " # graphSortDesc " ) . is ( " : checked " ) ? this . collection . setSortingDesc ( ! 0 ) : this . collection . setSortingDesc ( ! 1 ) , $ ( " # graphManagementDropdown " ) . is ( " : visible " ) ? this . dropdownVisible = ! 0 : this . dropdownVisible = ! 1 , this . render ( ) } , createExampleGraphs : function ( a ) { var b = $ ( a . currentTarget ) . attr ( " graph - id " ) , c = this ; $ . ajax ( { type : " POST " , url : arangoHelper . databaseUrl ( " / _admin / aardvark / graph - examples / create / " + encodeURIComponent ( b ) ) , success : function ( ) { window . modalView . hide ( ) , c . updateGraphManagementView ( ) , arangoHelper . arangoNotification ( " Example Graphs " , " Graph : " + b + " created . " ) } , error : function ( a ) { if ( window . modalView . hide ( ) , a . responseText ) try { var c = JSON . parse ( a . responseText ) ; arangoHelper . arangoError ( " Example Graphs " , c . errorMessage ) } catch ( d ) { arangoHelper . arangoError ( " Example Graphs " , " Could not create example graph : " + b ) } else arangoHelper . arangoError ( " Example Graphs " , " Could not create example graph : " + b ) } } ) } , render : function ( a , b ) { var c = this ; return this . collection . fetch ( { cache : ! 1 , success : function ( ) { c . collection . sort ( ) , $ ( c . el ) . html ( c . template . render ( { graphs : c . collection , searchString : " " } ) ) , c . dropdownVisible = = = ! 0 & & ( $ ( " # graphManagementDropdown2 " ) . show ( ) , $ ( " # graphSortDesc " ) . attr ( " checked " , c . collection . sortOptions . desc ) , $ ( " # graphManagementToggle " ) . toggleClass ( " activated " ) , $ ( " # graphManagementDropdown " ) . show ( ) ) , c . events [ " click . tableRow " ] = c . showHideDefinition . bind ( c ) , c . events [ ' change tr [ id * = " newEdgeDefinitions " ] ' ] = c . setFromAndTo . bind ( c ) , c . events [ " click . graphViewer - icon - button " ] = c . addRemoveDefinition . bind ( c ) , c . events [ " click # graphTab a " ] = c . toggleTab . bind ( c ) , c . events [ " click . createExampleGraphs " ] = c . createExampleGraphs . bind ( c ) , c . events [ " focusout . select2 - search - field input " ] = function ( a ) { $ ( " . select2 - drop " ) . is ( " : visible " ) & & ( $ ( " # select2 - search - field input " ) . is ( " : focus " ) | | window . setTimeout ( function ( ) { $ ( a . currentTarget ) . parent ( ) . parent ( ) . parent ( ) . select2 ( " close " ) } , 200 ) ) } , arangoHelper . setCheckboxStatus ( " # graphManagementDropdown " ) } } ) , a & & this . loadGraphViewer ( a , b ) , this } , setFromAndTo : function ( a ) { a . stopPropagation ( ) ; var b , c = this . calculateEdgeDefinitionMap ( ) ; if ( a . added ) { if ( this . eCollList . indexOf ( a . added . id ) = = = - 1 & & this . removedECollList . indexOf ( a . added . id ) ! = = - 1 ) return b = a . currentTarget . id . split ( " row_newEdgeDefinitions " ) [ 1 ] , $ ( ' input [ id * = " newEdgeDefinitions ' + b + ' " ] ' ) . select2 ( " val " , null ) , void $ ( ' input [ id * = " newEdgeDefinitions ' + b + ' " ] ' ) . attr ( " placeholder " , " The collection " + a . added . id + " is already used . " ) ; this . removedECollList . push ( a . added . id ) , this . eCollList . splice ( this . eCollList . indexOf ( a . added . id ) , 1 ) } else this . eCollList . push ( a . removed . id ) , this . removedECollList . splice ( this . removedECollList . indexOf ( a . removed . id ) , 1 ) ; c [ a . val ] ? ( b = a . currentTarget . id . split ( " row_newEdgeDefinitions " ) [ 1 ] , $ ( " # s2id_fromCollections " + b ) . select2 ( " val " , c [ a . val ] . from ) , $ ( " # fromCollections " + b ) . attr ( " disabled " , ! 0 ) , $ ( " # s2id_toCollections " + b ) . select2 ( " val " , c [ a . val ] . to ) , $ ( " # toCollections " + b ) . attr ( " disabled " , ! 0 ) ) : ( b = a . currentTarget . id . split ( " row_newEdgeDefinitions " ) [ 1 ] , $ ( " # s2id_fromCollections " + b ) . select2 ( " val " , null ) , $ ( " # fromCollections " + b ) . attr ( " disabled " , ! 1 ) , $ ( " # s2id_toCollections " + b ) . select2 ( " val " , null ) , $ ( " # toCollections " + b ) . attr ( " disabled " , ! 1 ) ) } , editGraph : function ( a ) { a . stopPropagation ( ) , this . collection . fetch ( { cache : ! 1 } ) , this . graphToEdit = this . evaluateGraphName ( $ ( a . currentTarget ) . attr ( " id " ) , " _settings " ) ; var b = this . collection . findWhere ( { _key : this . graphToEdit } ) ; this . createEditGraphModal ( b ) } , saveEditedGraph : function ( ) { var a , b , c , d , e , f = $ ( " # editGraphName " ) [ 0 ] . value , g = _ . pluck ( $ ( " # newVertexCollections " ) . select2 ( " data " ) , " text " ) , h = [ ] , i = { } ; if ( e = $ ( " [ id ^ = s2id_newEdgeDefinitions ] " ) . toArray ( ) , e . forEach ( function ( e ) { if ( d = $ ( e ) . attr ( " id " ) , d = d . replace ( " s2id_newEdgeDefinitions " , " " ) , a = _ . pluck ( $ ( " # s2id_newEdgeDefinitions " + d ) . select2 ( " data " ) , " text " ) [ 0 ] , a & & " " ! = = a & & ( b = _ . pluck ( $ ( " # s2id_fromCollections " + d ) . select2 ( " data " ) , " text " ) , c = _ . pluck ( $ ( " # s2id_toCollections " + d ) . select2 ( " data " ) , " text " ) , 0 ! = = b . length & & 0 ! = = c . length ) ) { var f = { collection : a , from : b , to : c } ; h . push ( f ) , i [ a ] = f } } ) , 0 = = = h . length ) return $ ( " # s2id_newEdgeDefinitions0 . select2 - choices " ) . css ( " border - color " , " red " ) , $ ( " # s2id_newEdgeDefinitions0 " ) . parent ( ) . parent ( ) . next ( ) . find ( " . select2 - choices " ) . css ( " border - color " , " red " ) , void $ ( " # s2id_newEdgeDefinitions0 " ) . parent ( ) . parent ( ) . next ( ) . next ( ) . find ( " . select2 - choices " ) . css ( " border - color " , " red " ) ; var j = this . collection . findWhere ( { _key : f } ) , k = j . get ( " edgeDefinitions " ) , l = j . get ( " orphanCollections " ) , m = [ ] ; l . forEach ( function ( a ) { g . indexOf ( a ) = = = - 1 & & j . deleteVertexCollection ( a ) } ) , g . forEach ( function ( a ) { l . indexOf ( a ) = = = - 1 & & j . addVertexCollection ( a ) } ) ; var n = [ ] , o = [ ] , p = [ ] ; k . forEach ( function ( a ) { var b = a . collection ; m . push ( b ) ; var c = i [ b ] ; void 0 = = = c ? p . push ( b ) : JSON . stringify ( c ) ! = = JSON . stringify ( a ) & & o . push ( b ) } ) , h . forEach ( function ( a ) { var b = a . collection ; m . indexOf ( b ) = = = - 1 & & n . push ( b ) } ) , n . forEach ( function ( a ) { j . addEdgeDefinition ( i [ a ] ) } ) , o . forEach ( function ( a ) { j . modifyEdgeDefinition ( i [ a ] ) } ) , p . forEach ( function ( a ) { j . deleteEdgeDefinition ( a ) } ) , this . updateGraphManagementView ( ) , window . modalView . hide ( ) } , evaluateGraphName : function ( a , b ) { var c = a . lastIndexOf ( b ) ; return a . substring ( 0 , c ) } , search : function ( ) { var a , b , c , d ; a = $ ( " # graphManagementSearchInput " ) , b = $ ( " # graphManagementSearchInput " ) . val ( ) , d = this . collection . filter ( function ( a ) { return a . get ( " _key " ) . indexOf ( b ) ! = = - 1 } ) , $ ( this . el ) . html ( this . template . render ( { graphs : d , searchString : b } ) ) , a = $ ( " # graphManagementSearchInput " ) , c = a . val ( ) . length , a . focus ( ) , a [ 0 ] . setSelectionRange ( c , c ) } , updateGraphManagementView : function ( ) { var a = this ; this . collection . fetch ( { cache : ! 1 , success : function ( ) { a . render ( ) } } ) } , createNewGraph : function ( ) { var a , b , c , d , e , f = $ ( " # createNewGraphName " ) . val ( ) , g = _ . pluck ( $ ( " # newVertexCollections " ) . select2 ( " data " ) , " text " ) , h = [ ] , i = this ; return f ? this . collection . findWhere ( { _key : f } ) ? ( arangoHelper . arangoError ( " The graph ' " + f + " ' already exists . " ) , 0 ) : ( e = $ ( " [ id ^ = s2id_newEdgeDefinitions ] " ) . toArray ( ) , e . forEach ( function ( e ) { d = $ ( e ) . attr ( " id " ) , d = d . replace ( " s2id_newEdgeDefinitions " , " " ) , a = _ . pluck ( $ ( " # s2id_newEdgeDefinitions " + d ) . select2 ( " data " ) , " text " ) [ 0 ] , a & & " " ! = = a & & ( b = _ . pluck ( $ ( " # s2id_fromCollections " + d ) . select2 ( " data " ) , " text " ) , c = _ . pluck ( $ ( " # s2id_toCollections " + d ) . select2 ( " data " ) , " text " ) , 1 ! = = b & & 1 ! = = c & & h . push ( { collection : a , from : b , to : c } ) ) } ) , 0 = = = h . length ? ( $ ( " # s2id_newEdgeDefinitions0 . select2 - choices " ) . css ( " border - color " , " red " ) , $ ( " # s2id_newEdgeDefinitions0 " ) . parent ( ) . parent ( ) . next ( ) . find ( " . select2 - choices " ) . css ( " border - color " , " red " ) , void $ ( " # s2id_newEdgeDefinitions0 " ) . parent ( ) . parent ( ) . next ( ) . next ( ) . find ( " . select2 - choices " ) . css ( " border - color " , " red " ) ) : void this . collection . create ( { name : f , edgeDefinitions : h , orphanCollections : g } , { success : function ( ) { i . updateGraphManagementView ( ) , window . modalView . hide ( ) } , error : function ( a , b ) { var c = JSON . parse ( b . responseText ) , d = c . errorMessage ; d = d . replace ( " < " , " " ) , d = d . replace ( " > " , " " ) , arangoHelper . arangoError ( d ) } } ) ) : ( arangoHelper . arangoError ( " A name for the graph has to be provided . " ) , 0 ) } , createEditGraphModal : function ( a ) { var b , c = [ ] , d = [ ] , e = [ ] , f = this . options . collectionCollection . models , g = this , h = " " , i = [ { collection : " " , from : " " , to : " " } ] , j = " " , k = function ( a , b ) { return a = a . toLowerCase ( ) , b = b . toLowerCase ( ) , a < b ? - 1 : a > b ? 1 : 0 } ; if ( this . eCollList = [ ] , this . removedECollList = [ ] , f . forEach ( function ( a ) { a . get ( " isSystem " ) | | ( " edge " = = = a . get ( " type " ) ? g . eCollList . push ( a . id ) : d . push ( a . id ) ) } ) , window . modalView . enableHotKeys = ! 1 , this . counter = 0 , a ? ( b = " Edit Graph " , h = a . get ( " _key " ) , i = a . get ( " edgeDefinitions " ) , i & & 0 ! = = i . length | | ( i = [ { collection : " " , from : " " , to : " " } ] ) , j = a . get ( " orphanCollections " ) , e . push ( window . modalView . createReadOnlyEntry ( " editGraphName " , " Name " , h , " The name to identify the graph . Has to be unique " ) ) , c . push ( window . modalView . createDeleteButton ( " Delete " , this . deleteGraph . bind ( this ) ) ) , c . push ( window . modalView . createSuccessButton ( " Save " , this . saveEditedGraph . bind ( this ) ) ) ) : ( b = " Create Graph " , e . push ( window . modalView . createTextEntry ( " createNewGraphName " , " Name " , " " , " The name to identify the graph . Has to be unique . " , " graphName " , ! 0 ) ) , c . push ( window . modalView . createSuccessButton ( " Create " , this . createNewGraph . bind ( this ) ) ) ) , i . forEach ( function ( a ) { 0 = = = g . counter ? ( a . collection & & ( g . removedECollList . push ( a . collection ) , g . eCollList . splice ( g . eCollList . indexOf ( a . collection ) , 1 ) ) , e . push ( window . modalView . createSelect2Entry ( " newEdgeDefinitions " + g . counter , " Edge definitions " , a . collection , " An edge definition defines a relation of the graph " , " Edge definitions " , ! 0 , ! 1 , ! 0 , 1 , g . eCollList . sort ( k ) ) ) ) : e . push ( window . modalView . createSelect2Entry ( " newEdgeDefinitions " + g . counter , " Edge definitions " , a . collection , " An edge definition defines a relation of the graph " , " Edge definitions " , ! 1 , ! 0 , ! 1 , 1 , g . eCollList . sort ( k ) ) ) , e . push ( window . modalView . createSelect2Entry ( " fromCollections " + g . counter , " fromCollections " , a . from , " The collections that contain the start vertices of the relation . " , " fromCollections " , ! 0 , ! 1 , ! 1 , 10 , d . sort ( k ) ) ) , e . push ( window . modalView . createSelect2Entry ( " toCollections " + g . counter , " toCollections " , a . to , " The collections that contain the end vertices of the relation . " , " toCollections " , ! 0 , ! 1 , ! 1 , 10 , d . sort ( k ) ) ) , g . counter + + } ) , e . push ( window . modalView . createSelect2Entry ( " newVertexCollections " , " Vertex collections " , j , " Collections that are part of a graph but not used in an edge definition " , " Vertex Collections " , ! 1 , ! 1 , ! 1 , 10 , d . sort ( k ) ) ) , window . modalView . show ( " modalGraphTable . ejs " , b , c , e , void 0 , void 0 , this . events ) , a ) { $ ( " . modal - body table " ) . css ( " border - collapse " , " separate " ) ; var l ; for ( $ ( " . modal - body . spacer " ) . remove ( ) , l = 0 ; l < = this . counter ; l + + ) $ ( " # row_fromCollections " + l ) . show ( ) , $ ( " # row_toCollections " + l ) . show ( ) , $ ( " # row_newEdgeDefinitions " + l ) . addClass ( " first " ) , $ ( " # row_fromCollections " + l ) . addClass ( " middle " ) , $ ( " # row_toCollections " + l ) . addClass ( " last " ) , $ ( " # row_toCollections " + l ) . after ( ' < tr id = " spacer ' + l + ' " class = " spacer " > < / tr > ' ) ; $ ( " # graphTab " ) . hide ( ) , $ ( " # modal - dialog . modal - delete - confirmation " ) . append ( ' < fieldset > < input type = " checkbox " id = " dropGraphCollections " name = " " value = " " > < label for = " dropGraphCollections " > also drop collections ? < / label > < / fieldset > ' ) } } , showHideDefinition : function ( a ) { } , addRemoveDefinition : function ( a ) { var b = [ ] , c = this . options . collectionCollection . models ; c . forEach ( function ( a ) { a . get ( " isSystem " ) | | b . push ( a . id ) } ) , a . stopPropagation ( ) ; var d , e = $ ( a . currentTarget ) . attr ( " id " ) ; if ( e . indexOf ( " addAfter_newEdgeDefinitions " ) = = = - 1 ) e . indexOf ( " remove_newEdgeDefinitions " ) ! = = - 1 & & ( d = e . split ( " remove_newEdgeDefinitions " ) [ 1 ] , $ ( " # row_newEdgeDefinitions " + d ) . remove ( ) , $ ( " # row_fromCollections " + d ) . remove ( ) , $ ( " # row_toCollections " + d ) . remove ( ) , $ ( " # spacer " + d ) . remove ( ) ) ; else { this . counter + + , $ ( " # row_newVertexCollections " ) . before ( this . edgeDefintionTemplate . render ( { number : this . counter } ) ) , $ ( " # newEdgeDefinitions " + this . counter ) . select2 ( { tags : this . eCollList , showSearchBox : ! 1 , minimumResultsForSearch : - 1 , width : " 336px " , maximumSelectionSize : 1 } ) , $ ( " # fromCollections " + this . counter ) . select2 ( { tags : b , showSearchBox : ! 1 , minimumResultsForSearch : - 1 , width : " 336px " , maximumSelectionSize : 10 } ) , $ ( " # toCollections " + this . counter ) . select2 ( { tags : b , showSearchBox : ! 1 , minimumResultsForSearch : - 1 , width : " 336px " , maximumSelectionSize : 10 } ) , window . modalView . undelegateEvents ( ) , window . modalView . delegateEvents ( this . events ) ; var f ; for ( $ ( " . modal - body . spacer " ) . remove ( ) , f = 0 ; f < = this . counter ; f + + ) $ ( " # row_fromCollections " + f ) . show ( ) , $ ( " # row_toCollections " + f ) . show ( ) , $ ( " # row_newEdgeDefinitions " + f ) . addClass ( " first " ) , $ ( " # row_fromCollections " + f ) . addClass ( " middle " ) , $ ( " # row_toCollections " + f ) . addClass ( " last " ) , $ ( " # row_toCollections " + f ) . after ( ' < tr id = " spacer ' + f + ' " class = " spacer " > < / tr > ' ) } } , calculateEdgeDefinitionMap : function ( ) { var a = { } ; return this . collection . models . forEach ( function ( b ) { b . get ( " edgeDefinitions " ) . forEach ( function ( b ) { a [ b . collection ] = { from : b . from , to : b . to } } ) } ) , a } } ) } ( ) , function ( ) { " use strict " ; window . GraphSettingsView = Backbone . View . extend ( { el : " # content " , remove : function ( ) { return this . $ el . empty ( ) . off ( ) , this . stopListening ( ) , this } , general : { graph : { type : " divider " , name : " Graph " } , nodeStart : { type : " string " , name : " Starting node " , desc : " A valid node id . If empty , a random node will be chosen . " , value : 2 } , layout : { type : " select " , name : " Layout algorithm " , noverlap : { name : " No overlap ( fast ) " , val : " noverlap " } , force : { name : " Force ( slow ) " , val : " force " } , fruchtermann : { name : " Fruchtermann ( very slow ) " , val : " fruchtermann " } } , renderer : { type : " select " , name : " Renderer " , canvas : { name : " Canvas ( editable ) " , val : " canvas " } , webgl : { name : " WebGL ( only display ) " , val : " webgl " } } , depth : { type : " number " , name : " Search depth " , value : 2 } } , specific : { nodes : { type : " divider " , name : " Nodes " } , nodeLabel : { type : " string " , name : " Label " , desc : " Default node color . RGB or HEX value . " , " default " : " _key " } , nodeColor : { type : " color " , name : " Color " , desc : " Default node color . RGB or HEX value . " , " default " : " # 2ecc71 " } , nodeSize : { type : " string " , name : " Sizing attribute " , desc : " Default node size . Numeric value > 0 . " } , edges : { type : " divider " , name : " Edges " } , edgeLabel : { type : " string " , name : " Label " , desc : " Default edge label . " } , edgeColor : { type : " color " , name : " Color " , desc : " Default edge color . RGB or HEX value . " , " default " : " # cccccc " } , edgeSize : { type : " number " , name : " Sizing " , desc : " Default edge thickness . Numeric value > 0 . " } , edgeType : { type : " select " , name : " Type " , desc : " The type of the edge " , line : { name : " Line " , val : " line " } , curve : { name : " Curve " , val : " curve " } , arrow : { name : " Arrow " , val : " arrow " } , curvedArrow : { name : " Curved Arrow " , val : " curvedArrow " } } } , template : templateEngine . createTemplate ( " graphSettingsView . ejs " ) , initialize : function ( a ) { this . name = a . name , this . userConfig = a . userConfig } , events : { " click # saveGraphSettings " : " saveGraphSettings " , " click # restoreGraphSettings " : " restoreGraphSettings " } , getGraphSettings : function ( a ) { var b = this , c = window . App . currentDB . toJSON ( ) . name + " _ " + this . name ; this . userConfig . fetch ( { success : function ( d ) { b . graphConfig = d . toJSON ( ) . graphs [ c ] , a & & b . continueRender ( ) } } ) } , saveGraphSettings : function ( ) { var a = window . App . currentDB . toJSON ( ) . name + " _ " + this . name , b = { } ; b [ a ] = { layout : $ ( " # g_layout " ) . val ( ) , renderer : $ ( " # g_renderer " ) . val ( ) , depth : $ ( " # g_depth " ) . val ( ) , nodeColor : $ ( " # g_nodeColor " ) . val ( ) , edgeColor : $ ( " # g_edgeColor " ) . val ( ) , nodeLabel : $ ( " # g_nodeLabel " ) . val ( ) , edgeLabel : $ ( " # g_edgeLabel " ) . val ( ) , edgeType : $ ( " # g_edgeType " ) . val ( ) , nodeSize : $ ( " # g_nodeSize " ) . val ( ) , edgeSize : $ ( " # g_edgeSize " ) . val ( ) , nodeStart : $ ( " # g_nodeStart " ) . val ( ) } ; var c = function ( ) { window . arangoHelper . arangoNotification ( " Graph " + this . name , " Configuration saved . " ) } . bind ( this ) ; this . userConfig . setItem ( " graphs " , b , c ) } , setDefaults : function ( ) { } , render : function ( ) { this . getGraphSettings ( ! 0 ) } , continueRender : function ( ) { $ ( this . el ) . html ( this . template . render ( { general : this . general , specific : this . specific } ) ) , this . graphConfig ? _ . each ( this . graphConfig , function ( a , b ) { $ ( " # g_ " + b ) . val ( a ) } ) : this . setDefaults ( ) , arangoHelper . buildGraphSubNav ( this . name , " Settings " ) } } ) } ( ) , function ( ) { " use strict " ; window . GraphViewer2 = Backbone . View . extend ( { el : " # content " , remove : function ( ) { return this . $ el . empty ( ) . off ( ) , this . stopListening ( ) , this } , template : templateEngine . createTemplate ( " graphViewer2 . ejs " ) , initialize : function ( a ) { this . name = a . name , this . userConfig = a . userConfig , this . initSigma ( ) } , events : { " click # downloadPNG " : " downloadSVG " } , cursorX : 0 , cursorY : 0 , initSigma : function ( ) { try { sigma . classes . graph . addMethod ( " neighbors " , function ( a ) { var b , c = { } , d = this . allNeighborsIndex [ a ] | | { } ; for ( b in d ) c [ b ] = this . nodesIndex [ b ] ; return c } ) } catch ( a ) { } } , downloadSVG : function ( ) { var a = this ; this . currentGraph . toSVG ( { download : ! 0 , filename : a . name + " . svg " , size : 1e3 } ) } , resize : function ( ) { $ ( " # graph - container " ) . width ( $ ( " . centralContent " ) . width ( ) ) , $ ( " # graph - container " ) . height ( $ ( " . centralRow " ) . height ( ) - 150 ) } , render : function ( ) { this . $ el . html ( this . template . render ( { } ) ) , this . resize ( ) , this . fetchGraph ( ) } , fetchGraph : function ( ) { var a = this ; arangoHelper . buildGraphSubNav ( a . name , " Content " ) , $ ( " # content " ) . append ( ' < div id = " calculatingGraph " style = " position : absolute ; left : 25px ; top : 130px ; " > < i class = " fa fa - circle - o - notch fa - spin " style = " margin - right : 10px ; " > < / i > < span id = " calcText " > Fetching graph data . Please wait . . . < / span > < / br > < / br > < / br > < span style = " font - weight : 100 ; opacity : 0 . 6 ; font - size : 9pt ; " > If it ` s taking too much time to draw the graph , please go to : < / br > < a href = " ' + window . location . href + ' / settings " > ' + window . location . href + " / settings < / a > < / br > and adjust your settings . It is possible that the graph is too big to be handled by the browser . < / span > < / div > " ) ; var b = function ( ) { var b = { } ; this . graphConfig & & ( b = _ . clone ( this . graphConfig ) , delete b . layout , delete b . edgeType , delete b . renderer ) , this . setupSigma ( ) , $ . ajax ( { type : " GET " , url : arangoHelper . databaseUrl ( " / _admin / aardvark / graph / " + encodeURIComponent ( this . name ) ) , contentType : " application / json " , data : b , success : function ( b ) { $ ( " # calcText " ) . html ( " Calculating layout . Please wait . . . " ) , arangoHelper . buildGraphSubNav ( a . name , " Content " ) , a . renderGraph ( b ) } , error : function ( a ) { console . log ( a ) ; <nl> + try { arangoHelper . arangoError ( " Graph " , a . responseJSON . exception ) } catch ( b ) { } $ ( " # calculatingGraph " ) . html ( " Failed to fetch graph information . " ) } } ) } . bind ( this ) ; this . getGraphSettings ( b ) } , setupSigma : function ( ) { if ( this . graphConfig & & this . graphConfig . edgeLabel ) { sigma . utils . pkg ( " sigma . settings " ) ; var a = { defaultEdgeLabelColor : " # 000 " , defaultEdgeLabelActiveColor : " # 000 " , defaultEdgeLabelSize : 10 , edgeLabelSize : " fixed " , edgeLabelSizePowRatio : 1 , edgeLabelThreshold : 1 } ; sigma . settings = sigma . utils . extend ( sigma . settings | | { } , a ) , sigma . settings . drawEdgeLabels = ! 0 } } , contextState : { createEdge : ! 1 , _from : ! 1 , _to : ! 1 , fromX : ! 1 , fromY : ! 1 } , clearOldContextMenu : function ( a ) { var b = this ; $ ( " # nodeContextMenu " ) . remove ( ) ; var c = ' < div id = " nodeContextMenu " class = " nodeContextMenu " > < / div > ' ; $ ( " # graph - container " ) . append ( c ) , a & & _ . each ( this . contextState , function ( a , c ) { b . contextState [ c ] = ! 1 } ) ; var d = document . getElementsByClassName ( " sigma - mouse " ) [ 0 ] ; d . removeEventListener ( " mousemove " , b . drawLine . bind ( this ) , ! 1 ) } , trackCursorPosition : function ( a ) { this . cursorX = a . x , this . cursorY = a . y } , createContextMenu : function ( a ) { var b = this , c = b . cursorX - 50 , d = b . cursorY - 50 ; console . log ( a ) , this . clearOldContextMenu ( ) ; var e = function ( a ) { var c = [ " # 364C4A " , " # 497C7F " , " # 92C5C0 " , " # 858168 " , " # CCBCA5 " ] , d = wheelnav , e = new d ( " nodeContextMenu " ) ; e . maxPercent = 1 , e . wheelRadius = 50 , e . clockwise = ! 1 , e . colors = c , e . multiSelect = ! 0 , e . clickModeRotate = ! 1 , e . slicePathFunction = slicePath ( ) . DonutSlice , e . createWheel ( [ icon . plus , icon . trash ] ) , e . navItems [ 0 ] . selected = ! 1 , e . navItems [ 0 ] . hovered = ! 1 , e . navItems [ 0 ] . navigateFunction = function ( a ) { b . clearOldContextMenu ( ) } , e . navItems [ 1 ] . navigateFunction = function ( a ) { b . clearOldContextMenu ( ) } , e . navItems [ 0 ] . selected = ! 1 , e . navItems [ 0 ] . hovered = ! 1 } ; $ ( " # nodeContextMenu " ) . css ( " position " , " fixed " ) , $ ( " # nodeContextMenu " ) . css ( " left " , c ) , $ ( " # nodeContextMenu " ) . css ( " top " , d ) , $ ( " # nodeContextMenu " ) . width ( 100 ) , $ ( " # nodeContextMenu " ) . height ( 100 ) , e ( a ) } , createNodeContextMenu : function ( a , b ) { var c = this ; console . log ( b ) ; var d = b . data . captor . clientX - 52 , e = b . data . captor . clientY - 52 ; console . log ( b . data ) , this . clearOldContextMenu ( ) ; var f = function ( a , b ) { var f = [ " # 364C4A " , " # 497C7F " , " # 92C5C0 " , " # 858168 " , " # CCBCA5 " ] , g = wheelnav , h = new g ( " nodeContextMenu " ) ; h . maxPercent = 1 , h . wheelRadius = 50 , h . clockwise = ! 1 , h . colors = f , h . multiSelect = ! 0 , h . clickModeRotate = ! 1 , h . slicePathFunction = slicePath ( ) . DonutSlice , h . createWheel ( [ icon . edit , icon . trash , icon . arrowleft2 , icon . connect ] ) , h . navItems [ 0 ] . selected = ! 1 , h . navItems [ 0 ] . hovered = ! 1 , h . navItems [ 0 ] . navigateFunction = function ( a ) { c . clearOldContextMenu ( ) , c . editNode ( b ) } , h . navItems [ 1 ] . navigateFunction = function ( a ) { c . clearOldContextMenu ( ) , c . deleteNode ( b ) } , h . navItems [ 2 ] . navigateFunction = function ( a ) { c . clearOldContextMenu ( ) , c . setStartNode ( b ) } , h . navItems [ 3 ] . navigateFunction = function ( a ) { c . contextState . createEdge = ! 0 , c . contextState . _from = b , c . contextState . fromX = d , c . contextState . fromY = e ; var f = document . getElementsByClassName ( " sigma - mouse " ) [ 0 ] ; f . addEventListener ( " mousemove " , c . drawLine . bind ( this ) , ! 1 ) , c . clearOldContextMenu ( ) } , h . navItems [ 0 ] . selected = ! 1 , h . navItems [ 0 ] . hovered = ! 1 } ; $ ( " # nodeContextMenu " ) . css ( " left " , d ) , $ ( " # nodeContextMenu " ) . css ( " top " , e ) , $ ( " # nodeContextMenu " ) . width ( 100 ) , $ ( " # nodeContextMenu " ) . height ( 100 ) , f ( b , a ) } , clearMouseCanvas : function ( ) { var a = document . getElementsByClassName ( " sigma - mouse " ) [ 0 ] , b = a . getContext ( " 2d " ) ; b . clearRect ( 0 , 0 , $ ( a ) . width ( ) , $ ( a ) . height ( ) ) } , drawLine : function ( a ) { var b = window . App . graphViewer2 . contextState ; if ( b . createEdge ) { var c = b . fromX , d = b . fromY , e = a . offsetX , f = a . offsetY , g = document . getElementsByClassName ( " sigma - mouse " ) [ 0 ] , h = g . getContext ( " 2d " ) ; h . clearRect ( 0 , 0 , $ ( g ) . width ( ) , $ ( g ) . height ( ) ) , h . beginPath ( ) , h . moveTo ( c , d ) , h . lineTo ( e , f ) , h . stroke ( ) } } , getGraphSettings : function ( a ) { var b = this , c = window . App . currentDB . toJSON ( ) . name + " _ " + this . name ; this . userConfig . fetch ( { success : function ( d ) { b . graphConfig = d . toJSON ( ) . graphs [ c ] , a & & a ( b . graphConfig ) } } ) } , editNode : function ( a ) { var b = function ( ) { } ; arangoHelper . openDocEditor ( a , " doc " , b ) } , renderGraph : function ( a ) { var b = this ; if ( 0 ! = = a . edges . left ) { this . Sigma = sigma ; var c = " noverlap " , d = " canvas " ; this . graphConfig & & ( this . graphConfig . layout & & ( c = this . graphConfig . layout ) , this . graphConfig . renderer & & ( d = this . graphConfig . renderer , " canvas " = = = d & & ( b . isEditable = ! 0 ) ) ) ; var e = { doubleClickEnabled : ! 1 , minNodeSize : 3 . 5 , minEdgeSize : 1 , maxEdgeSize : 4 , enableEdgeHovering : ! 0 , edgeHoverColor : " # 000 " , defaultEdgeHoverColor : " # 000 " , defaultEdgeType : " line " , edgeHoverSizeRatio : 2 , edgeHoverExtremities : ! 0 } ; this . graphConfig & & this . graphConfig . edgeType & & ( e . defaultEdgeType = this . graphConfig . edgeType ) , a . nodes . length > 500 & & ( e . labelThreshold = 15 , e . hideEdgesOnMove = ! 0 ) , " webgl " = = = d & & ( e . enableEdgeHovering = ! 1 ) ; var f = new this . Sigma ( { graph : a , container : " graph - container " , renderer : { container : document . getElementById ( " graph - container " ) , type : d } , settings : e } ) ; if ( this . currentGraph = f , sigma . plugins . fullScreen ( { container : " graph - container " , btnId : " graph - fullscreen - btn " } ) , " noverlap " = = = c ) { var g = f . configNoverlap ( { nodeMargin : . 1 , scaleNodes : 1 . 05 , gridSize : 75 , easing : " quadraticInOut " , duration : 1e4 } ) ; g . bind ( " start stop interpolate " , function ( a ) { " start " = = = a . type , " interpolate " = = = a . type } ) } else if ( " fruchtermann " = = = c ) { var h = sigma . layouts . fruchtermanReingold . configure ( f , { iterations : 500 , easing : " quadraticInOut " , duration : 800 } ) ; h . bind ( " start stop interpolate " , function ( a ) { } ) } f . graph . nodes ( ) . forEach ( function ( a ) { a . originalColor = a . color } ) , f . graph . edges ( ) . forEach ( function ( a ) { a . originalColor = a . color } ) , " canvas " = = = d & & ( f . bind ( " rightClickStage " , function ( a ) { b . createContextMenu ( a ) , b . clearMouseCanvas ( ) } ) , f . bind ( " clickNode " , function ( a ) { b . contextState . createEdge = = = ! 0 & & ( b . contextState . _to = a . data . node . id , b . currentGraph . graph . addEdge ( { source : b . contextState . _from , target : b . contextState . _to , id : Math . random ( ) , color : b . graphConfig . edgeColor } ) , b . currentGraph . refresh ( ) , b . clearOldContextMenu ( ! 0 ) ) } ) , f . bind ( " rightClickNode " , function ( a ) { var c = a . data . node . id ; b . createNodeContextMenu ( c , a ) } ) , f . bind ( " doubleClickNode " , function ( a ) { var b = a . data . node . id , c = f . graph . neighbors ( b ) ; c [ b ] = a . data . node , f . graph . nodes ( ) . forEach ( function ( a ) { c [ a . id ] ? a . color = a . originalColor : a . color = " # eee " } ) , f . graph . edges ( ) . forEach ( function ( a ) { c [ a . source ] & & c [ a . target ] ? a . color = " rgb ( 64 , 74 , 83 ) " : a . color = " # eee " } ) , f . refresh ( ) } ) , f . bind ( " doubleClickStage " , function ( ) { f . graph . nodes ( ) . forEach ( function ( a ) { a . color = a . originalColor } ) , f . graph . edges ( ) . forEach ( function ( a ) { a . color = a . originalColor } ) , f . refresh ( ) } ) , f . bind ( " clickStage " , function ( ) { b . clearOldContextMenu ( ! 0 ) , b . clearMouseCanvas ( ) } ) ) ; var i ; if ( " noverlap " = = = c ) f . startNoverlap ( ) , i = sigma . plugins . dragNodes ( f , f . renderers [ 0 ] ) ; else if ( " force " = = = c ) { f . startForceAtlas2 ( { worker : ! 0 , barnesHutOptimize : ! 1 } ) ; var j = 3e3 ; a . nodes . length > 2500 ? j = 5e3 : a . nodes . length < 50 & & ( j = 500 ) , window . setTimeout ( function ( ) { f . stopForceAtlas2 ( ) , i = sigma . plugins . dragNodes ( f , f . renderers [ 0 ] ) } , j ) } else " fruchtermann " = = = c ? ( sigma . layouts . fruchtermanReingold . start ( f ) , i = sigma . plugins . dragNodes ( f , f . renderers [ 0 ] ) ) : i = sigma . plugins . dragNodes ( f , f . renderers [ 0 ] ) ; console . log ( i ) ; var k = document . getElementsByClassName ( " sigma - mouse " ) [ 0 ] ; k . addEventListener ( " mousemove " , b . trackCursorPosition . bind ( this ) , ! 1 ) , $ ( " # calculatingGraph " ) . remove ( ) } } } ) } ( ) , function ( ) { " use strict " ; window . HelpUsView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " helpUsView . ejs " ) , render : function ( ) { this . $ el . html ( this . template . render ( { } ) ) } } ) } ( ) , function ( ) { " use strict " ; window . IndicesView = Backbone . View . extend ( { el : " # content " , initialize : function ( a ) { this . collectionName = a . collectionName , this . model = this . collection } , template : templateEngine . createTemplate ( " indicesView . ejs " ) , events : { } , render : function ( ) { $ ( this . el ) . html ( this . template . render ( { model : this . model } ) ) , this . breadcrumb ( ) , window . arangoHelper . buildCollectionSubNav ( this . collectionName , " Indices " ) , this . getIndex ( ) } , breadcrumb : function ( ) { $ ( " # subNavigationBar . breadcrumb " ) . html ( " Collection : " + this . collectionName ) } , getIndex : function ( ) { var a = function ( a , b ) { a ? window . arangoHelper . arangoError ( " Index " , b . errorMessage ) : this . renderIndex ( b ) } . bind ( this ) ; this . model . getIndex ( a ) } , createIndex : function ( ) { var a , b , c , d = this , e = $ ( " # newIndexType " ) . val ( ) , f = { } ; switch ( e ) { case " Geo " : a = $ ( " # newGeoFields " ) . val ( ) ; var g = d . checkboxToValue ( " # newGeoJson " ) ; f = { type : " geo " , fields : d . stringToArray ( a ) , geoJson : g } ; break ; case " Persistent " : a = $ ( " # newPersistentFields " ) . val ( ) , b = d . checkboxToValue ( " # newPersistentUnique " ) , c = d . checkboxToValue ( " # newPersistentSparse " ) , f = { type : " persistent " , fields : d . stringToArray ( a ) , unique : b , sparse : c } ; break ; case " Hash " : a = $ ( " # newHashFields " ) . val ( ) , b = d . checkboxToValue ( " # newHashUnique " ) , c = d . checkboxToValue ( " # newHashSparse " ) , f = { type : " hash " , fields : d . stringToArray ( a ) , unique : b , sparse : c } ; break ; case " Fulltext " : a = $ ( " # newFulltextFields " ) . val ( ) ; var h = parseInt ( $ ( " # newFulltextMinLength " ) . val ( ) , 10 ) | | 0 ; f = { type : " fulltext " , fields : d . stringToArray ( a ) , minLength : h } ; break ; case " Skiplist " : a = $ ( " # newSkiplistFields " ) . val ( ) , b = d . checkboxToValue ( " # newSkiplistUnique " ) , c = d . checkboxToValue ( " # newSkiplistSparse " ) , f = { type : " skiplist " , fields : d . stringToArray ( a ) , unique : b , sparse : c } } var i = function ( a , b ) { if ( a ) if ( b ) { var c = JSON . parse ( b . responseText ) ; arangoHelper . arangoError ( " Document error " , c . errorMessage ) } else arangoHelper . arangoError ( " Document error " , " Could not create index . " ) ; d . toggleNewIndexView ( ) , d . render ( ) } ; this . model . createIndex ( f , i ) } , bindIndexEvents : function ( ) { this . unbindIndexEvents ( ) ; var a = this ; $ ( " # indexEditView # addIndex " ) . bind ( " click " , function ( ) { a . toggleNewIndexView ( ) , $ ( " # cancelIndex " ) . unbind ( " click " ) , $ ( " # cancelIndex " ) . bind ( " click " , function ( ) { a . toggleNewIndexView ( ) , a . render ( ) } ) , $ ( " # createIndex " ) . unbind ( " click " ) , $ ( " # createIndex " ) . bind ( " click " , function ( ) { a . createIndex ( ) } ) } ) , $ ( " # newIndexType " ) . bind ( " change " , function ( ) { a . selectIndexType ( ) } ) , $ ( " . deleteIndex " ) . bind ( " click " , function ( b ) { a . prepDeleteIndex ( b ) } ) , $ ( " # infoTab a " ) . bind ( " click " , function ( a ) { if ( $ ( " # indexDeleteModal " ) . remove ( ) , " Indices " ! = = $ ( a . currentTarget ) . html ( ) | | $ ( a . currentTarget ) . parent ( ) . hasClass ( " active " ) | | ( $ ( " # newIndexView " ) . hide ( ) , $ ( " # indexEditView " ) . show ( ) , $ ( " # indexHeaderContent # modal - dialog . modal - footer . button - danger " ) . hide ( ) , $ ( " # indexHeaderContent # modal - dialog . modal - footer . button - success " ) . hide ( ) , $ ( " # indexHeaderContent # modal - dialog . modal - footer . button - notification " ) . hide ( ) ) , " General " = = = $ ( a . currentTarget ) . html ( ) & & ! $ ( a . currentTarget ) . parent ( ) . hasClass ( " active " ) ) { $ ( " # indexHeaderContent # modal - dialog . modal - footer . button - danger " ) . show ( ) , $ ( " # indexHeaderContent # modal - dialog . modal - footer . button - success " ) . show ( ) , $ ( " # indexHeaderContent # modal - dialog . modal - footer . button - notification " ) . show ( ) ; var b = $ ( " . index - button - bar2 " ) [ 0 ] ; $ ( " # cancelIndex " ) . is ( " : visible " ) & & ( $ ( " # cancelIndex " ) . detach ( ) . appendTo ( b ) , $ ( " # createIndex " ) . detach ( ) . appendTo ( b ) ) } } ) } , prepDeleteIndex : function ( a ) { var b = this ; this . lastTarget = a , this . lastId = $ ( this . lastTarget . currentTarget ) . parent ( ) . parent ( ) . first ( ) . children ( ) . first ( ) . text ( ) , $ ( " # content # modal - dialog . modal - footer " ) . after ( ' < div id = " indexDeleteModal " style = " display : block ; " class = " alert alert - error modal - delete - confirmation " > < strong > Really delete ? < / strong > < button id = " indexConfirmDelete " class = " button - danger pull - right modal - confirm - delete " > Yes < / button > < button id = " indexAbortDelete " class = " button - neutral pull - right " > No < / button > < / div > ' ) , $ ( " # indexHeaderContent # indexConfirmDelete " ) . unbind ( " click " ) , $ ( " # indexHeaderContent # indexConfirmDelete " ) . bind ( " click " , function ( ) { $ ( " # indexHeaderContent # indexDeleteModal " ) . remove ( ) , b . deleteIndex ( ) } ) , $ ( " # indexHeaderContent # indexAbortDelete " ) . unbind ( " click " ) , $ ( " # indexHeaderContent # indexAbortDelete " ) . bind ( " click " , function ( ) { $ ( " # indexHeaderContent # indexDeleteModal " ) . remove ( ) } ) } , unbindIndexEvents : function ( ) { $ ( " # indexHeaderContent # indexEditView # addIndex " ) . unbind ( " click " ) , $ ( " # indexHeaderContent # newIndexType " ) . unbind ( " change " ) , $ ( " # indexHeaderContent # infoTab a " ) . unbind ( " click " ) , $ ( " # indexHeaderContent . deleteIndex " ) . unbind ( " click " ) } , deleteIndex : function ( ) { var a = function ( a ) { a ? ( arangoHelper . arangoError ( " Could not delete index " ) , $ ( " tr th : contains ( ' " + this . lastId + " ' ) " ) . parent ( ) . children ( ) . last ( ) . html ( ' < span class = " deleteIndex icon_arangodb_roundminus " data - original - title = " Delete index " title = " Delete index " > < / span > ' ) , this . model . set ( " locked " , ! 1 ) ) : a | | void 0 = = = a | | ( $ ( " tr th : contains ( ' " + this . lastId + " ' ) " ) . parent ( ) . remove ( ) , this . model . set ( " locked " , ! 1 ) ) } . bind ( this ) ; this . model . set ( " locked " , ! 0 ) , this . model . deleteIndex ( this . lastId , a ) , $ ( " tr th : contains ( ' " + this . lastId + " ' ) " ) . parent ( ) . children ( ) . last ( ) . html ( ' < i class = " fa fa - circle - o - notch fa - spin " > < / i > ' ) } , renderIndex : function ( a ) { this . index = a ; var b = " collectionInfoTh modal - text " ; if ( this . index ) { var c = " " , d = " " ; _ . each ( this . index . indexes , function ( a ) { d = " primary " = = = a . type | | " edge " = = = a . type ? ' < span class = " icon_arangodb_locked " data - original - title = " No action " > < / span > ' : ' < span class = " deleteIndex icon_arangodb_roundminus " data - original - title = " Delete index " title = " Delete index " > < / span > ' , void 0 ! = = a . fields & & ( c = a . fields . join ( " , " ) ) ; var e = a . id . indexOf ( " / " ) , f = a . id . substr ( e + 1 , a . id . length ) , g = a . hasOwnProperty ( " selectivityEstimate " ) ? ( 100 * a . selectivityEstimate ) . toFixed ( 2 ) + " % " : " n / a " , h = a . hasOwnProperty ( " sparse " ) ? a . sparse : " n / a " ; $ ( " # collectionEditIndexTable " ) . append ( " < tr > < th class = " + JSON . stringify ( b ) + " > " + f + " < / th > < th class = " + JSON . stringify ( b ) + " > " + a . type + " < / th > < th class = " + JSON . stringify ( b ) + " > " + a . unique + " < / th > < th class = " + JSON . stringify ( b ) + " > " + h + " < / th > < th class = " + JSON . stringify ( b ) + " > " + g + " < / th > < th class = " + JSON . stringify ( b ) + " > " + c + " < / th > < th class = " + JSON . stringify ( b ) + " > " + d + " < / th > < / tr > " ) } ) } this . bindIndexEvents ( ) } , selectIndexType : function ( ) { $ ( " . newIndexClass " ) . hide ( ) ; var a = $ ( " # newIndexType " ) . val ( ) ; $ ( " # newIndexType " + a ) . show ( ) } , resetIndexForms : function ( ) { $ ( " # indexHeader input " ) . val ( " " ) . prop ( " checked " , ! 1 ) , $ ( " # newIndexType " ) . val ( " Geo " ) . prop ( " selected " , ! 0 ) , this . selectIndexType ( ) } , toggleNewIndexView : function ( ) { var a = $ ( " . index - button - bar2 " ) [ 0 ] ; $ ( " # indexEditView " ) . is ( " : visible " ) ? ( $ ( " # indexEditView " ) . hide ( ) , $ ( " # newIndexView " ) . show ( ) , $ ( " # cancelIndex " ) . detach ( ) . appendTo ( " # indexHeaderContent # modal - dialog . modal - footer " ) , $ ( " # createIndex " ) . detach ( ) . appendTo ( " # indexHeaderContent # modal - dialog . modal - footer " ) ) : ( $ ( " # indexEditView " ) . show ( ) , $ ( " # newIndexView " ) . hide ( ) , $ ( " # cancelIndex " ) . detach ( ) . appendTo ( a ) , $ ( " # createIndex " ) . detach ( ) . appendTo ( a ) ) , arangoHelper . fixTooltips ( " . icon_arangodb , . arangoicon " , " right " ) , this . resetIndexForms ( ) } , stringToArray : function ( a ) { var b = [ ] ; return a . split ( " , " ) . forEach ( function ( a ) { a = a . replace ( / ( ^ \ s + | \ s + $ ) / g , " " ) , " " ! = = a & & b . push ( a ) } ) , b } , checkboxToValue : function ( a ) { return $ ( a ) . prop ( " checked " ) } } ) } ( ) , function ( ) { " use strict " ; window . InfoView = 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 , " Info " ) , this . renderInfoView ( ) } , breadcrumb : function ( ) { $ ( " # subNavigationBar . breadcrumb " ) . html ( " Collection : " + this . collectionName ) } , renderInfoView : function ( ) { if ( this . model . get ( " locked " ) ) return 0 ; var a = function ( a , b , c ) { if ( a ) arangoHelper . arangoError ( " Figures " , " Could not get revision . " ) ; else { var d = [ ] , e = { figures : c , revision : b , model : this . model } ; window . modalView . show ( " modalCollectionInfo . ejs " , " Collection : " + this . model . get ( " name " ) , d , e , null , null , null , null , null , " content " ) } } . bind ( this ) , b = function ( b , c ) { if ( b ) arangoHelper . arangoError ( " Figures " , " Could not get figures . " ) ; else { var d = c ; this . model . getRevision ( a , d ) } } . bind ( this ) ; this . model . getFigures ( b ) } } ) } ( ) , function ( ) { " use strict " ; window . LoginView = Backbone . View . extend ( { el : " # content " , el2 : " . header " , el3 : " . footer " , loggedIn : ! 1 , loginCounter : 0 , events : { " keyPress # loginForm input " : " keyPress " , " click # submitLogin " : " validate " , " submit # dbForm " : " goTo " , " click # logout " : " logout " , " change # loginDatabase " : " renderDBS " } , template : templateEngine . createTemplate ( " loginView . ejs " ) , render : function ( a ) { var b = this ; if ( $ ( this . el ) . html ( this . template . render ( { } ) ) , $ ( this . el2 ) . hide ( ) , $ ( this . el3 ) . hide ( ) , frontendConfig . authenticationEnabled & & a ! = = ! 0 ) window . setTimeout ( function ( ) { $ ( " # loginUsername " ) . focus ( ) } , 300 ) ; else { var c = arangoHelper . databaseUrl ( " / _api / database / user " ) ; frontendConfig . authenticationEnabled = = = ! 1 & & ( $ ( " # logout " ) . hide ( ) , $ ( " . login - window # databases " ) . css ( " height " , " 90px " ) ) , $ ( " # loginForm " ) . hide ( ) , $ ( " . login - window # databases " ) . show ( ) , $ . ajax ( c ) . success ( function ( a ) { $ ( " # loginDatabase " ) . html ( " " ) , _ . each ( a . result , function ( a ) { $ ( " # loginDatabase " ) . append ( " < option > " + a + " < / option > " ) } ) , b . renderDBS ( ) } ) . error ( function ( ) { console . log ( " could not fetch user db data " ) } ) } return $ ( " . bodyWrapper " ) . show ( ) , this } , clear : function ( ) { $ ( " # loginForm input " ) . removeClass ( " form - error " ) , $ ( " . wrong - credentials " ) . hide ( ) } , keyPress : function ( a ) { a . ctrlKey & & 13 = = = a . keyCode ? ( a . preventDefault ( ) , this . validate ( ) ) : a . metaKey & & 13 = = = a . keyCode & & ( a . preventDefault ( ) , this . validate ( ) ) } , validate : function ( a ) { a . preventDefault ( ) , this . clear ( ) ; var b = $ ( " # loginUsername " ) . val ( ) , c = $ ( " # loginPassword " ) . val ( ) ; b & & this . collection . login ( b , c , this . loginCallback . bind ( this , b , c ) ) } , loginCallback : function ( a , b , c ) { var d = this ; if ( c ) { if ( 0 = = = d . loginCounter ) return d . loginCounter + + , void d . collection . login ( a , b , this . loginCallback . bind ( this , a ) ) ; d . loginCounter = 0 , $ ( " . wrong - credentials " ) . show ( ) , $ ( " # loginDatabase " ) . html ( " " ) , $ ( " # loginDatabase " ) . append ( " < option > _system < / option > " ) } else { var e = arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( a ) + " / database " , " _system " ) ; frontendConfig . authenticationEnabled = = = ! 1 & & ( e = arangoHelper . databaseUrl ( " / _api / database / user " ) ) , $ ( " . wrong - credentials " ) . hide ( ) , d . loggedIn = ! 0 , $ . ajax ( e ) . success ( function ( a ) { _ . each ( a . result , function ( b , c ) { " rw " ! = = b & & delete a . result [ c ] } ) , $ ( " # loginForm " ) . hide ( ) , $ ( " . login - window # databases " ) . show ( ) , $ ( " # loginDatabase " ) . html ( " " ) , _ . each ( a . result , function ( a , b ) { $ ( " # loginDatabase " ) . append ( " < option > " + b + " < / option > " ) } ) , d . renderDBS ( ) } ) . error ( function ( ) { $ ( " . wrong - credentials " ) . show ( ) } ) } } , renderDBS : function ( ) { if ( 0 = = = $ ( " # loginDatabase " ) . children ( ) . length ) $ ( " # dbForm " ) . remove ( ) , $ ( " . login - window # databases " ) . prepend ( ' < div class = " no - database " > You do not have permission to a database . < / div > ' ) ; else { var a = $ ( " # loginDatabase " ) . val ( ) ; $ ( " # goToDatabase " ) . html ( " Select DB : " + a ) , window . setTimeout ( function ( ) { $ ( " # goToDatabase " ) . focus ( ) } , 300 ) } } , logout : function ( ) { this . collection . logout ( ) } , goTo : function ( a ) { a . preventDefault ( ) ; var b = $ ( " # loginUsername " ) . val ( ) , c = $ ( " # loginDatabase " ) . val ( ) ; window . App . dbSet = c ; var d = function ( a ) { a & & arangoHelper . arangoError ( " User " , " Could not fetch user settings " ) } , e = window . location . protocol + " / / " + window . location . host + frontendConfig . basePath + " / _db / " + c + " / _admin / aardvark / index . html " ; window . location . href = e , $ ( this . el2 ) . show ( ) , $ ( this . el3 ) . show ( ) , $ ( " . bodyWrapper " ) . show ( ) , $ ( " . navbar " ) . show ( ) , $ ( " # currentUser " ) . text ( b ) , this . collection . loadUserSettings ( d ) } } ) } ( ) , function ( ) { " use strict " ; window . LogsView = window . PaginationView . extend ( { el : " # content " , id : " # logContent " , paginationDiv : " # logPaginationDiv " , idPrefix : " logTable " , fetchedAmount : ! 1 , initialize : function ( a ) { this . options = a , this . convertModelToJSON ( ) } , currentLoglevel : " logall " , events : { " click # arangoLogTabbar button " : " setActiveLoglevel " , " click # logTable_first " : " firstPage " , " click # logTable_last " : " lastPage " } , template : templateEngine . createTemplate ( " logsView . ejs " ) , tabbar : templateEngine . createTemplate ( " arangoTabbar . ejs " ) , table : templateEngine . createTemplate ( " arangoTable . ejs " ) , tabbarElements : { id : " arangoLogTabbar " , titles : [ [ " All " , " logall " ] , [ " Info " , " loginfo " ] , [ " Error " , " logerror " ] , [ " Warning " , " logwarning " ] , [ " Debug " , " logdebug " ] ] } , tableDescription : { id : " arangoLogTable " , titles : [ " Loglevel " , " Date " , " Message " ] , rows : [ ] } , convertedRows : null , setActiveLoglevel : function ( a ) { $ ( " . arangodb - tabbar " ) . removeClass ( " arango - active - tab " ) , this . currentLoglevel ! = = a . currentTarget . id & & ( this . currentLoglevel = a . currentTarget . id , this . convertModelToJSON ( ) ) } , initTotalAmount : function ( ) { var a = this ; this . collection = this . options [ this . currentLoglevel ] , this . collection . fetch ( { data : $ . param ( { test : ! 0 } ) , success : function ( ) { a . convertModelToJSON ( ) } } ) , this . fetchedAmount = ! 0 } , invertArray : function ( a ) { var b , c = [ ] , d = 0 ; for ( b = a . length - 1 ; b > = 0 ; b - - ) c [ d ] = a [ b ] , d + + ; return c } , convertModelToJSON : function ( ) { if ( ! this . fetchedAmount ) return void this . initTotalAmount ( ) ; var a , b = this , c = [ ] ; this . collection = this . options [ this . currentLoglevel ] , this . collection . fetch ( { success : function ( ) { b . collection . each ( function ( b ) { a = new Date ( 1e3 * b . get ( " timestamp " ) ) , c . push ( [ b . getLogStatus ( ) , arangoHelper . formatDT ( a ) , b . get ( " text " ) ] ) } ) , b . tableDescription . rows = b . invertArray ( c ) , b . render ( ) } } ) } , render : function ( ) { return $ ( this . el ) . html ( this . template . render ( { } ) ) , $ ( this . id ) . html ( this . tabbar . render ( { content : this . tabbarElements } ) ) , $ ( this . id ) . append ( this . table . render ( { content : this . tableDescription } ) ) , $ ( " # " + this . currentLoglevel ) . addClass ( " arango - active - tab " ) , $ ( " # logContent " ) . append ( ' < div id = " logPaginationDiv " class = " pagination - line " > < / div > ' ) , this . renderPagination ( ) , this } , rerender : function ( ) { this . convertModelToJSON ( ) } } ) } ( ) , function ( ) { " use strict " ; var a = function ( a , b , c , d ) { return { type : a , title : b , callback : c , confirm : d } } , b = function ( a , b , c , d , e , f , g , h , i , j , k ) { var l = { type : a , label : b } ; return void 0 ! = = c & & ( l . value = c ) , void 0 ! = = d & & ( l . info = d ) , void 0 ! = = e & & ( l . placeholder = e ) , void 0 ! = = f & & ( l . mandatory = f ) , void 0 ! = = h & & ( l . addDelete = h ) , void 0 ! = = i & & ( l . addAdd = i ) , void 0 ! = = j & & ( l . maxEntrySize = j ) , void 0 ! = = k & & ( l . tags = k ) , g & & ( l . validateInput = function ( ) { return g } ) , l } ; window . ModalView = Backbone . View . extend ( { _validators : [ ] , _validateWatchers : [ ] , baseTemplate : templateEngine . createTemplate ( " modalBase . ejs " ) , tableTemplate : templateEngine . createTemplate ( " modalTable . ejs " ) , el : " # modalPlaceholder " , contentEl : " # modalContent " , hideFooter : ! 1 , confirm : { list : " # modal - delete - confirmation " , yes : " # modal - confirm - delete " , no : " # modal - abort - delete " } , enabledHotkey : ! 1 , enableHotKeys : ! 0 , buttons : { SUCCESS : " success " , NOTIFICATION : " notification " , DELETE : " danger " , NEUTRAL : " neutral " , CLOSE : " close " } , tables : { READONLY : " readonly " , TEXT : " text " , BLOB : " blob " , PASSWORD : " password " , SELECT : " select " , SELECT2 : " select2 " , CHECKBOX : " checkbox " } , initialize : function ( ) { Object . freeze ( this . buttons ) , Object . freeze ( this . tables ) } , createModalHotkeys : function ( ) { $ ( this . el ) . unbind ( " keydown " ) , $ ( this . el ) . unbind ( " return " ) , $ ( this . el ) . bind ( " keydown " , " return " , function ( ) { $ ( " . createModalDialog . modal - footer . button - success " ) . click ( ) } ) , $ ( " . modal - body input " ) . unbind ( " keydown " ) , $ ( " . modal - body input " ) . unbind ( " return " ) , $ ( " . modal - body input " , $ ( this . el ) ) . bind ( " keydown " , " return " , function ( ) { $ ( " . createModalDialog . modal - footer . button - success " ) . click ( ) } ) , $ ( " . modal - body select " ) . unbind ( " keydown " ) , $ ( " . modal - body select " ) . unbind ( " return " ) , $ ( " . modal - body select " , $ ( this . el ) ) . bind ( " keydown " , " return " , function ( ) { $ ( " . createModalDialog . modal - footer . button - success " ) . click ( ) } ) } , createInitModalHotkeys : function ( ) { var a = this ; $ ( this . el ) . bind ( " keydown " , " left " , function ( ) { a . navigateThroughButtons ( " left " ) } ) , $ ( this . el ) . bind ( " keydown " , " right " , function ( ) { a . navigateThroughButtons ( " right " ) } ) } , navigateThroughButtons : function ( a ) { var b = $ ( " . createModalDialog . modal - footer button " ) . is ( " : focus " ) ; b = = = ! 1 ? " left " = = = a ? $ ( " . createModalDialog . modal - footer button " ) . first ( ) . focus ( ) : " right " = = = a & & $ ( " . createModalDialog . modal - footer button " ) . last ( ) . focus ( ) : b = = = ! 0 & & ( " left " = = = a ? $ ( " : focus " ) . prev ( ) . focus ( ) : " right " = = = a & & $ ( " : focus " ) . next ( ) . focus ( ) ) } , createCloseButton : function ( b , c ) { var d = this ; return a ( this . buttons . CLOSE , b , function ( ) { d . hide ( ) , c & & c ( ) } ) } , createSuccessButton : function ( b , c ) { return a ( this . buttons . SUCCESS , b , c ) } , createNotificationButton : function ( b , c ) { return a ( this . buttons . NOTIFICATION , b , c ) } , createDeleteButton : function ( b , c , d ) { return a ( this . buttons . DELETE , b , c , d ) } , createNeutralButton : function ( b , c ) { return a ( this . buttons . NEUTRAL , b , c ) } , createDisabledButton : function ( b ) { var c = a ( this . buttons . NEUTRAL , b ) ; return c . disabled = ! 0 , c } , createReadOnlyEntry : function ( a , c , d , e , f , g ) { var h = b ( this . tables . READONLY , c , d , e , void 0 , void 0 , void 0 , f , g ) ; return h . id = a , h } , createTextEntry : function ( a , c , d , e , f , g , h ) { var i = b ( this . tables . TEXT , c , d , e , f , g , h ) ; return i . id = a , i } , createBlobEntry : function ( a , c , d , e , f , g , h ) { var i = b ( this . tables . BLOB , c , d , e , f , g , h ) ; return i . id = a , i } , createSelect2Entry : function ( a , c , d , e , f , g , h , i , j , k ) { var l = b ( this . tables . SELECT2 , c , d , e , f , g , void 0 , h , i , j , k ) ; return l . id = a , l } , createPasswordEntry : function ( a , c , d , e , f , g , h ) { var i = b ( this . tables . PASSWORD , c , d , e , f , g , h ) ; return i . id = a , i } , createCheckboxEntry : function ( a , c , d , e , f ) { var g = b ( this . tables . CHECKBOX , c , d , e ) ; return g . id = a , f & & ( g . checked = f ) , g } , createSelectEntry : function ( a , c , d , e , f ) { var g = b ( this . tables . SELECT , c , null , e ) ; return g . id = a , d & & ( g . selected = d ) , g . options = f , g } , createOptionEntry : function ( a , b ) { return { label : a , value : b | | a } } , show : function ( a , b , c , d , e , f , g , h , i , j ) { var k , l , m = this , n = ! 1 ; c = c | | [ ] , h = Boolean ( h ) , this . clearValidators ( ) , c . length > 0 ? ( c . forEach ( function ( a ) { a . type = = = m . buttons . CLOSE & & ( n = ! 0 ) , a . type = = = m . buttons . DELETE & & ( l = l | | a . confirm ) } ) , n | | ( k = c . pop ( ) , c . push ( m . createCloseButton ( " Cancel " ) ) , c . push ( k ) ) ) : c . push ( m . createCloseButton ( " Close " ) ) , j ? ( $ ( " # " + j ) . html ( this . baseTemplate . render ( { title : b , buttons : c , hideFooter : this . hideFooter , confirm : l , tabBar : i } ) ) , $ ( " # " + j + " # modal - dialog " ) . removeClass ( " fade hide modal " ) , $ ( " # " + j + " . modal - header " ) . remove ( ) , $ ( " # " + j + " . modal - tabbar " ) . remove ( ) , $ ( " # " + j + " . modal - tabbar " ) . remove ( ) , $ ( " # " + j + " . button - close " ) . remove ( ) , 0 = = = $ ( " # " + j + " . modal - footer " ) . children ( ) . length & & $ ( " # " + j + " . modal - footer " ) . remove ( ) ) : $ ( this . el ) . html ( this . baseTemplate . render ( { title : b , buttons : c , hideFooter : this . hideFooter , confirm : l , tabBar : i } ) ) , _ . each ( c , function ( a , b ) { if ( ! a . disabled & & a . callback ) { if ( a . type = = = m . buttons . DELETE & & ! h ) { var c = " # modalButton " + b ; return j & & ( c = " # " + j + " # modalButton " + b ) , void $ ( c ) . bind ( " click " , function ( ) { j ? ( $ ( " # " + j + " " + m . confirm . yes ) . unbind ( " click " ) , $ ( " # " + j + " " + m . confirm . yes ) . bind ( " click " , a . callback ) , $ ( " # " + j + " " + m . confirm . list ) . css ( " display " , " block " ) ) : ( $ ( m . confirm . yes ) . unbind ( " click " ) , $ ( m . confirm . yes ) . bind ( " click " , a . callback ) , $ ( m . confirm . list ) . css ( " display " , " block " ) ) } ) } j ? $ ( " # " + j + " # modalButton " + b ) . bind ( " click " , a . callback ) : $ ( " # modalButton " + b ) . bind ( " click " , a . callback ) } } ) , j ? $ ( " # " + j + " " + this . confirm . no ) . bind ( " click " , function ( ) { $ ( " # " + j + " " + m . confirm . list ) . css ( " display " , " none " ) } ) : $ ( this . confirm . no ) . bind ( " click " , function ( ) { $ ( m . confirm . list ) . css ( " display " , " none " ) } ) ; var o ; if ( " string " = = typeof a ) o = templateEngine . createTemplate ( a ) , j ? $ ( " # " + j + " . createModalDialog . modal - body " ) . html ( o . render ( { content : d , advancedContent : e , info : f } ) ) : $ ( " # modalPlaceholder . createModalDialog . modal - body " ) . html ( o . render ( { content : d , advancedContent : e , info : f } ) ) ; else { var p = 0 ; _ . each ( a , function ( a ) { o = templateEngine . createTemplate ( a ) , $ ( " . createModalDialog . modal - body . tab - content # " + i [ p ] ) . html ( o . render ( { content : d , advancedContent : e , info : f } ) ) , p + + } ) } $ ( " . createModalDialog . modalTooltips " ) . tooltip ( { position : { my : " left top " , at : " right + 55 top - 1 " } } ) ; var q = d | | [ ] ; e & & e . content & & ( q = q . concat ( e . content ) ) , _ . each ( q , function ( a ) { m . modalBindValidation ( a ) , a . type = = = m . tables . SELECT2 & & $ ( " # " + a . id ) . select2 ( { tags : a . tags | | [ ] , showSearchBox : ! 1 , minimumResultsForSearch : - 1 , width : " 336px " , maximumSelectionSize : a . maxEntrySize | | 8 } ) } ) , g & & ( this . events = g , this . delegateEvents ( ) ) , $ ( " # accordion2 " ) & & ( $ ( " # accordion2 . accordion - toggle " ) . bind ( " click " , function ( ) { $ ( " # collapseOne " ) . is ( " : visible " ) ? ( $ ( " # collapseOne " ) . hide ( ) , setTimeout ( function ( ) { $ ( " . accordion - toggle " ) . addClass ( " collapsed " ) } , 100 ) ) : ( $ ( " # collapseOne " ) . show ( ) , setTimeout ( function ( ) { $ ( " . accordion - toggle " ) . removeClass ( " collapsed " ) } , 100 ) ) } ) , $ ( " # collapseOne " ) . hide ( ) , setTimeout ( function ( ) { $ ( " . accordion - toggle " ) . addClass ( " collapsed " ) } , 100 ) ) , j | | $ ( " # modal - dialog " ) . modal ( " show " ) , this . enabledHotkey = = = ! 1 & & ( this . createInitModalHotkeys ( ) , this . enabledHotkey = ! 0 ) , this . enableHotKeys & & this . createModalHotkeys ( ) ; var r ; r = j ? $ ( " # " + j + " # modal - dialog " ) . find ( " input " ) : $ ( " # modal - dialog " ) . find ( " input " ) , r & & setTimeout ( function ( ) { r = j ? $ ( " # " + j + " # modal - dialog " ) : $ ( " # modal - dialog " ) , r . length > 0 & & ( r = r . find ( " input " ) , r . length > 0 & & $ ( r [ 0 ] ) . focus ( ) ) } , 400 ) } , modalBindValidation : function ( a ) { var b = this ; if ( a . hasOwnProperty ( " id " ) & & a . hasOwnProperty ( " validateInput " ) ) { var c = function ( ) { var b = $ ( " # " + a . id ) , c = a . validateInput ( b ) , d = ! 1 ; if ( _ . each ( c , function ( a ) { var c = b . val ( ) ; if ( a . rule | | ( a = { rule : a } ) , " function " = = typeof a . rule ) try { a . rule ( c ) } catch ( e ) { d = a . msg | | e . message } else { var f = Joi . validate ( c , a . rule ) ; f . error & & ( d = a . msg | | f . error . message ) } if ( d ) return ! 1 } ) , d ) return d } , d = $ ( " # " + a . id ) ; d . on ( " keyup focusout " , function ( ) { var a = c ( ) , e = d . next ( ) [ 0 ] ; a ? ( d . addClass ( " invalid - input " ) , e ? $ ( e ) . text ( a ) : d . after ( ' < p class = " errorMessage " > ' + a + " < / p > " ) , $ ( " . createModalDialog . modal - footer . button - success " ) . prop ( " disabled " , ! 0 ) . addClass ( " disabled " ) ) : ( d . removeClass ( " invalid - input " ) , e & & $ ( e ) . remove ( ) , b . modalTestAll ( ) ) } ) , this . _validators . push ( c ) , this . _validateWatchers . push ( d ) } } , modalTestAll : function ( ) { var a = _ . map ( this . _validators , function ( a ) { return a ( ) } ) , b = _ . any ( a ) ; return b ? $ ( " . createModalDialog . modal - footer . button - success " ) . prop ( " disabled " , ! 0 ) . addClass ( " disabled " ) : $ ( " . createModalDialog . modal - footer . button - success " ) . prop ( " disabled " , ! 1 ) . removeClass ( " disabled " ) , ! b } , clearValidators : function ( ) { this . _validators = [ ] , _ . each ( this . _validateWatchers , function ( a ) { a . unbind ( " keyup focusout " ) } ) , this . _validateWatchers = [ ] } , hide : function ( ) { this . clearValidators ( ) , $ ( " # modal - dialog " ) . modal ( " hide " ) } } ) } ( ) , function ( ) { " use strict " ; window . NavigationView = Backbone . View . extend ( { el : " # navigationBar " , subEl : " # subNavigationBar " , events : { " change # arangoCollectionSelect " : " navigateBySelect " , " click . tab " : " navigateByTab " , " click li " : " switchTab " , " click . arangodbLogo " : " selectMenuItem " , " mouseenter . dropdown > * " : " showDropdown " , " click . shortcut - icons p " : " showShortcutModal " , " mouseleave . dropdown " : " hideDropdown " } , renderFirst : ! 0 , activeSubMenu : void 0 , changeDB : function ( ) { window . location . hash = " # login " } , initialize : function ( a ) { var b = this ; this . userCollection = a . userCollection , this . currentDB = a . currentDB , this . dbSelectionView = new window . DBSelectionView ( { collection : a . database , current : this . currentDB } ) , this . userBarView = new window . UserBarView ( { userCollection : this . userCollection } ) , this . notificationView = new window . NotificationView ( { collection : a . notificationCollection } ) , this . statisticBarView = new window . StatisticBarView ( { currentDB : this . currentDB } ) , this . isCluster = a . isCluster , this . handleKeyboardHotkeys ( ) , Backbone . history . on ( " all " , function ( ) { b . selectMenuItem ( ) } ) } , showShortcutModal : function ( ) { arangoHelper . hotkeysFunctions . showHotkeysModal ( ) } , handleSelectDatabase : function ( ) { this . dbSelectionView . render ( $ ( " # dbSelect " ) ) } , template : templateEngine . createTemplate ( " navigationView . ejs " ) , templateSub : templateEngine . createTemplate ( " subNavigationView . ejs " ) , render : function ( ) { var a = this ; $ ( this . el ) . html ( this . template . render ( { currentDB : this . currentDB , isCluster : this . isCluster } ) ) , " _system " ! = = this . currentDB . get ( " name " ) & & $ ( " # dashboard " ) . parent ( ) . remove ( ) , $ ( this . subEl ) . html ( this . templateSub . render ( { currentDB : this . currentDB . toJSON ( ) } ) ) , this . dbSelectionView . render ( $ ( " # dbSelect " ) ) ; var b = function ( a ) { a | | this . userBarView . render ( ) } . bind ( this ) ; return this . userCollection . whoAmI ( b ) , this . renderFirst & & ( this . renderFirst = ! 1 , this . selectMenuItem ( ) , $ ( " . arangodbLogo " ) . on ( " click " , function ( ) { a . selectMenuItem ( ) } ) , $ ( " # dbStatus " ) . on ( " click " , function ( ) { a . changeDB ( ) } ) ) , this } , navigateBySelect : function ( ) { var a = $ ( " # arangoCollectionSelect " ) . find ( " option : selected " ) . val ( ) ; window . App . navigate ( a , { trigger : ! 0 } ) } , handleKeyboardHotkeys : function ( ) { arangoHelper . enableKeyboardHotkeys ( ! 0 ) } , navigateByTab : function ( a ) { var b = a . target | | a . srcElement , c = b . id , d = ! 1 ; $ ( b ) . hasClass ( " fa " ) | | ( " " = = = c & & ( c = $ ( b ) . attr ( " class " ) ) , " links " = = = c ? ( d = ! 0 , $ ( " # link_dropdown " ) . slideToggle ( 1 ) , a . preventDefault ( ) ) : " tools " = = = c ? ( d = ! 0 , $ ( " # tools_dropdown " ) . slideToggle ( 1 ) , a . preventDefault ( ) ) : " dbselection " = = = c & & ( d = ! 0 , $ ( " # dbs_dropdown " ) . slideToggle ( 1 ) , a . preventDefault ( ) ) , d | | ( window . App . navigate ( c , { trigger : ! 0 } ) , a . preventDefault ( ) ) ) } , handleSelectNavigation : function ( ) { var a = this ; $ ( " # arangoCollectionSelect " ) . change ( function ( ) { a . navigateBySelect ( ) } ) } , subViewConfig : { documents : " collections " , collection : " collections " } , subMenuConfig : { cluster : [ { name : " Dashboard " , view : void 0 , active : ! 0 } , { name : " Logs " , view : void 0 , disabled : ! 0 } ] , collections : [ { name : " " , view : void 0 , active : ! 1 } ] , queries : [ { name : " Editor " , route : " query " , active : ! 0 } , { name : " Running Queries " , route : " queryManagement " , params : { active : ! 0 } , active : void 0 } , { name : " Slow Query History " , route : " queryManagement " , params : { active : ! 1 } , active : void 0 } ] } , renderSubMenu : function ( a ) { var b = this ; if ( void 0 = = = a & & ( a = window . isCluster ? " cluster " : " dashboard " ) , this . subMenuConfig [ a ] ) { $ ( this . subEl + " . bottom " ) . html ( " " ) ; var c = " " ; _ . each ( this . subMenuConfig [ a ] , function ( a ) { c = a . active ? " active " : " " , a . disabled & & ( c = " disabled " ) , $ ( b . subEl + " . bottom " ) . append ( ' < li class = " subMenuEntry ' + c + ' " > < a > ' + a . name + " < / a > < / li > " ) , <nl> + a . disabled | | $ ( b . subEl + " . bottom " ) . children ( ) . last ( ) . bind ( " click " , function ( c ) { b . activeSubMenu = a , b . renderSubView ( a , c ) } ) } ) } } , renderSubView : function ( a , b ) { window . App [ a . route ] & & ( window . App [ a . route ] . resetState & & window . App [ a . route ] . resetState ( ) , window . App [ a . route ] ( ) ) , $ ( this . subEl + " . bottom " ) . children ( ) . removeClass ( " active " ) , $ ( b . currentTarget ) . addClass ( " active " ) } , switchTab : function ( a ) { var b = $ ( a . currentTarget ) . children ( ) . first ( ) . attr ( " id " ) ; b & & this . selectMenuItem ( b + " - menu " ) } , selectMenuItem : function ( a , b ) { void 0 = = = a & & ( a = window . location . hash . split ( " / " ) [ 0 ] , a = a . substr ( 1 , a . length - 1 ) ) , " " = = = a ? a = window . App . isCluster ? " cluster " : " dashboard " : " cNodes " ! = = a & & " dNodes " ! = = a | | ( a = " nodes " ) ; try { this . renderSubMenu ( a . split ( " - " ) [ 0 ] ) } catch ( c ) { this . renderSubMenu ( a ) } $ ( " . navlist li " ) . removeClass ( " active " ) , " string " = = typeof a & & ( b ? $ ( " . " + this . subViewConfig [ a ] + " - menu " ) . addClass ( " active " ) : a & & ( $ ( " . " + a ) . addClass ( " active " ) , $ ( " . " + a + " - menu " ) . addClass ( " active " ) ) ) , arangoHelper . hideArangoNotifications ( ) } , showSubDropdown : function ( a ) { $ ( a . currentTarget ) . find ( " . subBarDropdown " ) . toggle ( ) } , showDropdown : function ( a ) { var b = a . target | | a . srcElement , c = b . id ; " links " = = = c | | " link_dropdown " = = = c | | " links " = = = a . currentTarget . id ? $ ( " # link_dropdown " ) . fadeIn ( 1 ) : " tools " = = = c | | " tools_dropdown " = = = c | | " tools " = = = a . currentTarget . id ? $ ( " # tools_dropdown " ) . fadeIn ( 1 ) : " dbselection " ! = = c & & " dbs_dropdown " ! = = c & & " dbselection " ! = = a . currentTarget . id | | $ ( " # dbs_dropdown " ) . fadeIn ( 1 ) } , hideDropdown : function ( a ) { var b = a . target | | a . srcElement ; b = $ ( b ) . parent ( ) , $ ( " # link_dropdown " ) . fadeOut ( 1 ) , $ ( " # tools_dropdown " ) . fadeOut ( 1 ) , $ ( " # dbs_dropdown " ) . fadeOut ( 1 ) } } ) } ( ) , function ( ) { " use strict " ; window . NodesView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " nodesView . ejs " ) , interval : 5e3 , knownServers : [ ] , events : { " click # nodesContent . pure - table - body . pure - table - row " : " navigateToNode " } , initialize : function ( a ) { var b = this ; clearInterval ( this . intervalFunction ) , window . App . isCluster & & ( this . dbServers = a . dbServers , this . coordinators = a . coordinators , this . updateServerTime ( ) , this . toRender = a . toRender , this . intervalFunction = window . setInterval ( function ( ) { " # cNodes " ! = = window . location . hash & & " # dNodes " ! = = window . location . hash & & " # nodes " ! = = window . location . hash | | b . checkNodesState ( ) } , this . interval ) ) } , checkNodesState : function ( ) { var a = function ( a ) { _ . each ( a , function ( a , b ) { _ . each ( $ ( " . pure - table - row " ) , function ( c ) { $ ( c ) . attr ( " node " ) = = = b & & ( " GOOD " = = = a . Status ? ( $ ( c ) . removeClass ( " noHover " ) , $ ( c ) . find ( " . state " ) . html ( ' < i class = " fa fa - check - circle " > < / i > ' ) ) : ( $ ( c ) . addClass ( " noHover " ) , $ ( c ) . find ( " . state " ) . html ( ' < i class = " fa fa - exclamation - circle " > < / i > ' ) ) ) } ) } ) } ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / health " ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( b ) { a ( b . Health ) } } ) } , navigateToNode : function ( a ) { if ( " # dNodes " ! = = window . location . hash & & ! $ ( a . currentTarget ) . hasClass ( " noHover " ) ) { var b = $ ( a . currentTarget ) . attr ( " node " ) ; window . App . navigate ( " # node / " + encodeURIComponent ( b ) , { trigger : ! 0 } ) } } , render : function ( ) { var a = function ( ) { this . continueRender ( ) } . bind ( this ) ; this . initDoneCoords ? a ( ) : this . waitForCoordinators ( a ) } , continueRender : function ( ) { var a ; a = " coordinator " = = = this . toRender ? this . coordinators . toJSON ( ) : this . dbServers . toJSON ( ) , this . $ el . html ( this . template . render ( { coords : a , type : this . toRender } ) ) , window . arangoHelper . buildNodesSubNav ( this . toRender ) , this . checkNodesState ( ) } , waitForCoordinators : function ( a ) { var b = this ; window . setTimeout ( function ( ) { 0 = = = b . coordinators . length ? b . waitForCoordinators ( a ) : ( this . initDoneCoords = ! 0 , a ( ) ) } , 200 ) } , updateServerTime : function ( ) { this . serverTime = ( new Date ) . getTime ( ) } } ) } ( ) , function ( ) { " use strict " ; window . NodesView2 = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " nodesView2 . ejs " ) , interval : 1e4 , knownServers : [ ] , events : { " click # nodesContent . coords - nodes . pure - table - row " : " navigateToNode " , " click # addCoord " : " addCoord " , " click # removeCoord " : " removeCoord " , " click # addDBs " : " addDBs " , " click # removeDBs " : " removeDBs " } , initialize : function ( ) { var a = this ; clearInterval ( this . intervalFunction ) , window . App . isCluster & & ( this . updateServerTime ( ) , this . intervalFunction = window . setInterval ( function ( ) { " # nodes " = = = window . location . hash & & a . render ( ! 1 ) } , this . interval ) ) } , navigateToNode : function ( a ) { if ( ! $ ( a . currentTarget ) . hasClass ( " noHover " ) ) { var b = $ ( a . currentTarget ) . attr ( " node " ) . slice ( 0 , - 5 ) ; window . App . navigate ( " # node / " + encodeURIComponent ( b ) , { trigger : ! 0 } ) } } , render : function ( a ) { var b = this , c = function ( a ) { $ . ajax ( { type : " GET " , url : arangoHelper . databaseUrl ( " / _admin / cluster / numberOfServers " ) , contentType : " application / json " , success : function ( c ) { b . continueRender ( a , c ) } } ) } ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / health " ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( a ) { c ( a . Health ) } , error : function ( ) { arangoHelper . arangoError ( " Cluster " , " Could not fetch cluster information " ) } } ) , a ! = = ! 1 & & arangoHelper . buildNodesSubNav ( " Overview " ) } , continueRender : function ( a , b ) { var c = { } , d = { } , e = ! 1 ; _ . each ( a , function ( a , b ) { " Coordinator " = = = a . Role ? c [ b ] = a : " DBServer " = = = a . Role & & ( d [ b ] = a ) } ) , null ! = = b . numberOfDBServers & & null ! = = b . numberOfCoordinators & & ( e = ! 0 ) ; var f = function ( a ) { this . $ el . html ( this . template . render ( { coords : c , dbs : d , scaling : e , scaleProperties : a , plannedDBs : b . numberOfDBServers , plannedCoords : b . numberOfCoordinators } ) ) , e | | ( $ ( " . title " ) . css ( " position " , " relative " ) , $ ( " . title " ) . css ( " top " , " - 4px " ) , $ ( " . sectionHeader . information " ) . css ( " margin - top " , " - 3px " ) ) } . bind ( this ) ; this . renderCounts ( e , f ) } , updatePlanned : function ( a ) { a . numberOfCoordinators & & ( $ ( " # plannedCoords " ) . val ( a . numberOfCoordinators ) , this . renderCounts ( ! 0 ) ) , a . numberOfDBServers & & ( $ ( " # plannedDBs " ) . val ( a . numberOfDBServers ) , this . renderCounts ( ! 0 ) ) } , setCoordSize : function ( a ) { var b = this , c = { numberOfCoordinators : a } ; $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _admin / cluster / numberOfServers " ) , contentType : " application / json " , data : JSON . stringify ( c ) , success : function ( ) { b . updatePlanned ( c ) } , error : function ( ) { arangoHelper . arangoError ( " Scale " , " Could not set coordinator size . " ) } } ) } , setDBsSize : function ( a ) { var b = this , c = { numberOfDBServers : a } ; $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _admin / cluster / numberOfServers " ) , contentType : " application / json " , data : JSON . stringify ( c ) , success : function ( ) { b . updatePlanned ( c ) } , error : function ( ) { arangoHelper . arangoError ( " Scale " , " Could not set coordinator size . " ) } } ) } , renderCounts : function ( a , b ) { var c = function ( b , c , d , e ) { var f = ' < span class = " positive " > < span > ' + c + ' < / span > < i class = " fa fa - check - circle " > < / i > < / span > ' ; d & & a = = = ! 0 & & ( f = f + ' < span class = " warning " > < span > ' + d + ' < / span > < i class = " fa fa - circle - o - notch fa - spin " > < / i > < / span > ' ) , e & & ( f = f + ' < span class = " negative " > < span > ' + e + ' < / span > < i class = " fa fa - exclamation - circle " > < / i > < / span > ' ) , $ ( b ) . html ( f ) , a | | ( $ ( " . title " ) . css ( " position " , " relative " ) , $ ( " . title " ) . css ( " top " , " - 4px " ) ) } , d = function ( a ) { var d = 0 , e = 0 , f = 0 , g = 0 , h = 0 , i = 0 ; _ . each ( a , function ( a ) { " Coordinator " = = = a . Role ? " GOOD " = = = a . Status ? e + + : d + + : " DBServer " = = = a . Role & & ( " GOOD " = = = a . Status ? g + + : h + + ) } ) , $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / numberOfServers " ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { f = Math . abs ( e + d - a . numberOfCoordinators ) , i = Math . abs ( g + h - a . numberOfDBServers ) , b ? b ( { coordsPending : f , coordsOk : e , coordsErrors : d , dbsPending : i , dbsOk : g , dbsErrors : h } ) : ( c ( " # infoDBs " , g , i , h ) , c ( " # infoCoords " , e , f , d ) ) } } ) } ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / health " ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { d ( a . Health ) } } ) } , addCoord : function ( ) { this . setCoordSize ( this . readNumberFromID ( " # plannedCoords " , ! 0 ) ) } , removeCoord : function ( ) { this . setCoordSize ( this . readNumberFromID ( " # plannedCoords " , ! 1 , ! 0 ) ) } , addDBs : function ( ) { this . setDBsSize ( this . readNumberFromID ( " # plannedDBs " , ! 0 ) ) } , removeDBs : function ( ) { this . setDBsSize ( this . readNumberFromID ( " # plannedDBs " , ! 1 , ! 0 ) ) } , readNumberFromID : function ( a , b , c ) { var d = $ ( a ) . val ( ) , e = ! 1 ; try { e = JSON . parse ( d ) } catch ( f ) { } return b & & e + + , c & & 1 ! = = e & & e - - , e } , updateServerTime : function ( ) { this . serverTime = ( new Date ) . getTime ( ) } } ) } ( ) , function ( ) { " use strict " ; window . NodeView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " nodeView . ejs " ) , interval : 5e3 , dashboards : [ ] , events : { } , initialize : function ( a ) { window . App . isCluster & & ( this . coordinators = a . coordinators , this . dbServers = a . dbServers , this . coordname = a . coordname , this . updateServerTime ( ) ) } , breadcrumb : function ( a ) { $ ( " # subNavigationBar . breadcrumb " ) . html ( " Node : " + a ) } , render : function ( ) { this . $ el . html ( this . template . render ( { coords : [ ] } ) ) ; var a = function ( ) { this . continueRender ( ) , this . breadcrumb ( this . coordname ) , $ ( window ) . trigger ( " resize " ) } . bind ( this ) ; this . initCoordDone | | this . waitForCoordinators ( ) , this . initDBDone ? ( this . coordname = window . location . hash . split ( " / " ) [ 1 ] , this . coordinator = this . coordinators . findWhere ( { name : this . coordname } ) , a ( ) ) : this . waitForDBServers ( a ) } , continueRender : function ( ) { var a = this ; this . dashboards [ this . coordinator . get ( " name " ) ] = new window . DashboardView ( { dygraphConfig : window . dygraphConfig , database : window . App . arangoDatabase , serverToShow : { raw : this . coordinator . get ( " address " ) , isDBServer : ! 1 , endpoint : this . coordinator . get ( " protocol " ) + " : / / " + this . coordinator . get ( " address " ) , target : this . coordinator . get ( " name " ) } } ) , this . dashboards [ this . coordinator . get ( " name " ) ] . render ( ) , window . setTimeout ( function ( ) { a . dashboards [ a . coordinator . get ( " name " ) ] . resize ( ) } , 500 ) } , waitForCoordinators : function ( a ) { var b = this ; window . setTimeout ( function ( ) { 0 = = = b . coordinators . length ? b . waitForCoordinators ( a ) : ( b . coordinator = b . coordinators . findWhere ( { name : b . coordname } ) , b . initCoordDone = ! 0 , a & & a ( ) ) } , 200 ) } , waitForDBServers : function ( a ) { var b = this ; window . setTimeout ( function ( ) { 0 = = = b . dbServers [ 0 ] . length ? b . waitForDBServers ( a ) : ( b . initDBDone = ! 0 , b . dbServer = b . dbServers [ 0 ] , b . dbServer . each ( function ( a ) { " DBServer001 " = = = a . get ( " name " ) & & ( b . dbServer = a ) } ) , a ( ) ) } , 200 ) } , updateServerTime : function ( ) { this . serverTime = ( new Date ) . getTime ( ) } } ) } ( ) , function ( ) { " use strict " ; window . NotificationView = Backbone . View . extend ( { events : { " click . navlogo # stat_hd " : " toggleNotification " , " click . notificationItem . fa " : " removeNotification " , " click # removeAllNotifications " : " removeAllNotifications " } , initialize : function ( ) { this . collection . bind ( " add " , this . renderNotifications . bind ( this ) ) , this . collection . bind ( " remove " , this . renderNotifications . bind ( this ) ) , this . collection . bind ( " reset " , this . renderNotifications . bind ( this ) ) , window . setTimeout ( function ( ) { frontendConfig . authenticationEnabled = = = ! 1 & & frontendConfig . isCluster = = = ! 1 & & arangoHelper . showAuthDialog ( ) = = = ! 0 & & window . arangoHelper . arangoWarning ( " Warning " , " Authentication is disabled . Do not use this setup in production mode . " ) } , 2e3 ) } , notificationItem : templateEngine . createTemplate ( " notificationItem . ejs " ) , el : " # notificationBar " , template : templateEngine . createTemplate ( " notificationView . ejs " ) , toggleNotification : function ( ) { var a = this . collection . length ; 0 ! = = a & & $ ( " # notification_menu " ) . toggle ( ) } , removeAllNotifications : function ( ) { $ . noty . clearQueue ( ) , $ . noty . closeAll ( ) , this . collection . reset ( ) , $ ( " # notification_menu " ) . hide ( ) } , removeNotification : function ( a ) { var b = a . target . id ; this . collection . get ( b ) . destroy ( ) } , renderNotifications : function ( a , b , c ) { if ( c & & c . add ) { var d , e = this . collection . at ( this . collection . length - 1 ) , f = e . get ( " title " ) , g = 3e3 , h = [ " click " ] ; if ( e . get ( " content " ) & & ( f = f + " : " + e . get ( " content " ) ) , " error " = = = e . get ( " type " ) ? ( g = ! 1 , h = [ " button " ] , d = [ { addClass : " button - danger " , text : " Close " , onClick : function ( a ) { a . close ( ) } } ] ) : " warning " = = = e . get ( " type " ) & & ( g = 15e3 , d = [ { addClass : " button - warning " , text : " Close " , onClick : function ( a ) { a . close ( ) } } , { addClass : " button - danger " , text : " Don ' t show again . " , onClick : function ( a ) { a . close ( ) , window . arangoHelper . doNotShowAgain ( ) } } ] ) , $ . noty . clearQueue ( ) , $ . noty . closeAll ( ) , noty ( { theme : " relax " , text : f , template : ' < div class = " noty_message arango_message " > < div > < i class = " fa fa - close " > < / i > < / div > < span class = " noty_text arango_text " > < / span > < div class = " noty_close arango_close " > < / div > < / div > ' , 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 ( ' < button class = " button - danger " > ' + c + " < / button > " ) : $ ( " . progress - action " ) . html ( ' < button class = " button - danger " > Cancel < / button > ' ) , 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 = ' < i data - id = " ' + b . get ( " id " ) + ' " class = " fa fa - minus - circle " > < / i > ' ) , 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 " , bindParamId : " # bindParamEditor " , myQueriesId : " # queryTable " , template : templateEngine . createTemplate ( " queryView . 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 , " \ t " ) , 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 " ) ; var c = " query / download / " + encodeURIComponent ( a ) ; arangoHelper . download ( c ) } ) } , 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 ( ' < span id = " lastQuery " class = " clickable " > Previous Query < / span > ' ) , $ ( " # 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 ( ) ; if ( " " ! = = d | | void 0 ! = = d | | null ! = = d ) { var e ; e = 0 = = = Object . keys ( this . bindParamTableObj ) . length ? " query / result / download / " + encodeURIComponent ( btoa ( JSON . stringify ( { query : d } ) ) ) : " query / result / download / " + encodeURIComponent ( btoa ( JSON . stringify ( { query : d , bindVars : this . bindParamTableObj } ) ) ) , arangoHelper . download ( e ) } else 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 : arangoHelper . databaseUrl ( " / _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 ( ' < option value = " ' + _ . escape ( c ) + ' " ' + ( a = = = c ? " selected " : " " ) + " > " + _ . escape ( c ) + " results < / option > " ) } ) } , 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 ( ) } , 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 ; k < o ; + + 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 & & k + 1 < o & & ( " / " = = = 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 & & k + 1 < = o & & " / " = = = 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 ) ; <nl> + 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 ( " < tr > < td > " + c + " < / td > < td > < input name = " + c + ' type = " text " > < / input > < / td > < / tr > ' ) , 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 ( ' < tr class = " noBgColor " > < td > No bind parameters defined . < / td > < td > < / td > < / tr > ' ) } , 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 . aqlEditor . setShowPrintMargin ( ! 1 ) , this . bindParamAceEditor = ace . edit ( " bindParamAceEditor " ) , this . bindParamAceEditor . getSession ( ) . setMode ( " ace / mode / json " ) , this . bindParamAceEditor . setFontSize ( " 10pt " ) , this . bindParamAceEditor . setShowPrintMargin ( ! 1 ) , 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 , " \ t " ) , 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 . name < b . name ? - 1 : a . name > b . name ? 1 : 0 } var b = this ; this . updateLocalQueries ( ) , this . myQueriesTableDesc . rows = this . customQueries , _ . each ( this . myQueriesTableDesc . rows , function ( a ) { a . secondRow = ' < span class = " spanWrapper " > < span id = " copyQuery " title = " Copy query " > < i class = " fa fa - copy " > < / i > < / span > < span id = " explQuery " title = " Explain query " > < i class = " fa fa - comments " > < / i > < / i > < / span > < span id = " runQuery " title = " Run query " > < i class = " fa fa - play - circle - o " > < / i > < / i > < / span > < span id = " deleteQuery " title = " Delete query " > < i class = " fa fa - minus - circle " > < / i > < / span > < / span > ' , 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 : ' < span class = " spanWrapper " > < span id = " copyQuery " title = " Copy query " > < i class = " fa fa - copy " > < / i > < / span > < / span > ' } ) } ) , this . myQueriesTableDesc . unescaped = [ ! 1 , ! 0 , ! 0 ] , this . $ ( this . myQueriesId ) . html ( this . table . render ( { content : this . myQueriesTableDesc } ) ) } , listenKey : function ( a ) { 13 = = = a . keyCode & & " Update " = = = $ ( " # modalButton1 " ) . html ( ) & & this . saveAQL ( ) , 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 & & 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 ) { if ( a . name = = = b ) return a . value = d , void ( e = ! 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 ) , b . setShowPrintMargin ( ! 1 ) , 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 = $ ( " # querySize " ) , b = { query : this . aqlEditor . getValue ( ) , id : " currentFrontendQuery " } ; return " all " = = = a . val ( ) ? b . batchSize = 1e6 : b . batchSize = parseInt ( a . val ( ) , 10 ) , Object . keys ( this . bindParamTableObj ) . length > 0 & & ( b . bindVars = this . bindParamTableObj ) , JSON . stringify ( b ) } , fillResult : function ( a , b , c ) { var d = this , e = this . readQueryData ( ) ; e & & ( b . setValue ( d . aqlEditor . getValue ( ) , 1 ) , $ . ajax ( { type : " POST " , url : arangoHelper . databaseUrl ( " / _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 ( ) { var a = this ; window . progressView . hide ( ) , $ ( " # removeResults " ) . show ( ) , window . setTimeout ( function ( ) { a . aqlEditor . focus ( ) } , 300 ) , $ ( " . centralRow " ) . animate ( { scrollTop : $ ( " # queryContent " ) . height ( ) } , " fast " ) } , setEditorAutoHeight : function ( a ) { var b = $ ( " . centralRow " ) . height ( ) , c = ( b - 250 ) / 17 ; a . setOptions ( { maxLines : c , 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 : arangoHelper . databaseUrl ( " / _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 , d ) { d | | ( d = " " ) , $ ( " # outputEditorWrapper " + c + " . arangoToolbarTop . pull - left " ) . append ( ' < span class = " ' + d + ' " > < i class = " fa ' + b + ' " > < / i > < i class = " iconText " > ' + a + " < / i > < / span > " ) } ; $ ( " # outputEditorWrapper " + c + " . pull - left # spinner " ) . remove ( ) ; var g = " - " ; a & & a . extra & & a . extra . stats & & ( g = a . extra . stats . executionTime . toFixed ( 3 ) + " s " ) , e ( a . result . length + " elements " , " fa - calculator " ) , 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 " , " additional " ) : e ( a . extra . stats . writesIgnored + " writes ignored " , " fa - exclamation - circle warning " , " additional " ) ) , a . extra . stats . scannedFull > 0 ? e ( " full collection scan " , " fa - exclamation - circle warning " , " additional " ) : e ( " no full collection scan " , " fa - check - circle positive " , " additional " ) ) , $ ( " # 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 ) , a . id & & $ . ajax ( { url : " / _api / cursor / " + encodeURIComponent ( a . id ) , type : " DELETE " } ) } , h = function ( ) { $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _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 ) { if ( d . removeOutputEditor ( c ) , 409 = = = b . code ) return ; 400 ! = = b . code & & 404 ! = = b . code & & arangoHelper . arangoNotification ( " Query " , " Successfully aborted . " ) } 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 ( ) ) } , c = function ( ) { a . getSystemQueries ( b ) } ; 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 " ) } ; b . collection . saveCollectionQueries ( e ) } b . updateLocalQueries ( ) , a & & a ( ) } } ) } } ) } ( ) , function ( ) { " use strict " ; window . ScaleView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " scaleView . ejs " ) , interval : 1e4 , knownServers : [ ] , events : { " click # addCoord " : " addCoord " , " click # removeCoord " : " removeCoord " , " click # addDBs " : " addDBs " , " click # removeDBs " : " removeDBs " } , setCoordSize : function ( a ) { var b = this , c = { numberOfCoordinators : a } ; $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _admin / cluster / numberOfServers " ) , contentType : " application / json " , data : JSON . stringify ( c ) , success : function ( ) { b . updateTable ( c ) } , error : function ( ) { arangoHelper . arangoError ( " Scale " , " Could not set coordinator size . " ) } } ) } , setDBsSize : function ( a ) { var b = this , c = { numberOfDBServers : a } ; $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _admin / cluster / numberOfServers " ) , contentType : " application / json " , data : JSON . stringify ( c ) , success : function ( ) { b . updateTable ( c ) } , error : function ( ) { arangoHelper . arangoError ( " Scale " , " Could not set coordinator size . " ) } } ) } , addCoord : function ( ) { this . setCoordSize ( this . readNumberFromID ( " # plannedCoords " , ! 0 ) ) } , removeCoord : function ( ) { this . setCoordSize ( this . readNumberFromID ( " # plannedCoords " , ! 1 , ! 0 ) ) } , addDBs : function ( ) { this . setDBsSize ( this . readNumberFromID ( " # plannedDBs " , ! 0 ) ) } , removeDBs : function ( ) { this . setDBsSize ( this . readNumberFromID ( " # plannedDBs " , ! 1 , ! 0 ) ) } , readNumberFromID : function ( a , b , c ) { var d = $ ( a ) . html ( ) , e = ! 1 ; try { e = JSON . parse ( d ) } catch ( f ) { } return b & & e + + , c & & 1 ! = = e & & e - - , e } , initialize : function ( a ) { var b = this ; clearInterval ( this . intervalFunction ) , window . App . isCluster & & ( this . dbServers = a . dbServers , this . coordinators = a . coordinators , this . updateServerTime ( ) , this . intervalFunction = window . setInterval ( function ( ) { " # sNodes " = = = window . location . hash & & b . coordinators . fetch ( { success : function ( ) { b . dbServers . fetch ( { success : function ( ) { b . continueRender ( ! 0 ) } } ) } } ) } , this . interval ) ) } , render : function ( ) { var a = this , b = function ( ) { var b = function ( ) { a . continueRender ( ) } ; this . waitForDBServers ( b ) } . bind ( this ) ; this . initDoneCoords ? b ( ) : this . waitForCoordinators ( b ) , window . arangoHelper . buildNodesSubNav ( " scale " ) } , continueRender : function ( a ) { var b , c , d = this ; b = this . coordinators . toJSON ( ) , c = this . dbServers . toJSON ( ) , this . $ el . html ( this . template . render ( { runningCoords : b . length , runningDBs : c . length , plannedCoords : void 0 , plannedDBs : void 0 , initialized : a } ) ) , $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / numberOfServers " ) , contentType : " application / json " , processData : ! 1 , success : function ( a ) { d . updateTable ( a ) } } ) } , updateTable : function ( a ) { var b = ' < span class = " warning " > scaling in progress < i class = " fa fa - circle - o - notch fa - spin " > < / i > < / span > ' , c = ' < span class = " positive " > no scaling process active < / span > ' ; a . numberOfCoordinators & & ( $ ( " # plannedCoords " ) . html ( a . numberOfCoordinators ) , this . coordinators . toJSON ( ) . length = = = a . numberOfCoordinators ? $ ( " # statusCoords " ) . html ( c ) : $ ( " # statusCoords " ) . html ( b ) ) , a . numberOfDBServers & & ( $ ( " # plannedDBs " ) . html ( a . numberOfDBServers ) , this . dbServers . toJSON ( ) . length = = = a . numberOfDBServers ? $ ( " # statusDBs " ) . html ( c ) : $ ( " # statusDBs " ) . html ( b ) ) } , waitForDBServers : function ( a ) { var b = this ; 0 = = = this . dbServers . length ? window . setInterval ( function ( ) { b . waitForDBServers ( a ) } , 300 ) : a ( ) } , waitForCoordinators : function ( a ) { var b = this ; window . setTimeout ( function ( ) { 0 = = = b . coordinators . length ? b . waitForCoordinators ( a ) : ( b . initDoneCoords = ! 0 , a ( ) ) } , 200 ) } , updateServerTime : function ( ) { this . serverTime = ( new Date ) . getTime ( ) } } ) } ( ) , 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 ( ) ) , g < 1 | | parseInt ( g , 10 ) ! = = Math . pow ( 2 , Math . log2 ( g ) ) ) throw new Error ( " 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 ) : ( arangoHelper . arangoNotification ( " Collection : Successfully changed . " ) , window . App . navigate ( " # cSettings / " + c , { trigger : ! 0 } ) ) } , 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 ) ; frontendConfig . isCluster = = = ! 1 ? this . model . renameCollection ( c , i ) : i ( ) } else if ( " unloaded " = = = d ) if ( this . model . get ( " name " ) ! = = c ) { var j = function ( a , b ) { a ? arangoHelper . arangoError ( " Collection " + b . responseText ) : ( arangoHelper . arangoNotification ( " CollectionSuccessfully changed . " ) , window . App . navigate ( " # cSettings / " + c , { trigger : ! 0 } ) ) } ; frontendConfig . isCluster = = = ! 1 ? this . model . renameCollection ( c , j ) : 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 ( ) } ; this . model . getProperties ( g ) } else f ( ) } } . bind ( this ) ; window . isCoordinator ( a ) } } ) } ( ) , function ( ) { " use strict " ; window . ShardsView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " shardsView . ejs " ) , interval : 1e4 , knownServers : [ ] , events : { " click # shardsContent . shardLeader span " : " moveShard " , " click # shardsContent . shardFollowers span " : " moveShardFollowers " , " click # rebalanceShards " : " rebalanceShards " } , initialize : function ( a ) { var b = this ; b . dbServers = a . dbServers , clearInterval ( this . intervalFunction ) , window . App . isCluster & & ( this . updateServerTime ( ) , this . intervalFunction = window . setInterval ( function ( ) { " # shards " = = = window . location . hash & & b . render ( ! 1 ) } , this . interval ) ) } , render : function ( a ) { var b = this ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / shardDistribution " ) , contentType : " application / json " , processData : ! 1 , async : ! 0 , success : function ( a ) { var c , d = ! 1 ; b . shardDistribution = a . results , _ . each ( a . results , function ( a , b ) { c = b . substring ( 0 , 1 ) , " _ " ! = = c & & " error " ! = = b & & " code " ! = = b & & ( d = ! 0 ) } ) , d ? b . continueRender ( a . results ) : arangoHelper . renderEmpty ( " No collections and no shards available " ) } , error : function ( a ) { 0 ! = = a . readyState & & arangoHelper . arangoError ( " Cluster " , " Could not fetch sharding information . " ) } } ) , a ! = = ! 1 & & arangoHelper . buildNodesSubNav ( " Shards " ) } , moveShardFollowers : function ( a ) { var b = $ ( a . currentTarget ) . html ( ) ; this . moveShard ( a , b ) } , moveShard : function ( a , b ) { var c , d , e , f , g = this , h = window . App . currentDB . get ( " name " ) ; d = $ ( a . currentTarget ) . parent ( ) . parent ( ) . attr ( " collection " ) , e = $ ( a . currentTarget ) . parent ( ) . parent ( ) . attr ( " shard " ) , b ? ( f = $ ( a . currentTarget ) . parent ( ) . parent ( ) . attr ( " leader " ) , c = b ) : c = $ ( a . currentTarget ) . parent ( ) . parent ( ) . attr ( " leader " ) ; var i = [ ] , j = [ ] , k = { } , l = [ ] ; return g . dbServers [ 0 ] . each ( function ( a ) { a . get ( " name " ) ! = = c & & ( k [ a . get ( " name " ) ] = { value : a . get ( " name " ) , label : a . get ( " name " ) } ) } ) , _ . each ( g . shardDistribution [ d ] . Plan [ e ] . followers , function ( a ) { delete k [ a ] } ) , b & & delete k [ f ] , _ . each ( k , function ( a ) { l . push ( a ) } ) , l = l . reverse ( ) , 0 = = = l . length ? void arangoHelper . arangoMessage ( " Shards " , " No database server for moving the shard is available . " ) : ( j . push ( window . modalView . createSelectEntry ( " toDBServer " , " Destination " , void 0 , " Please select the target databse server . The selected database server will be the new leader of the shard . " , l ) ) , i . push ( window . modalView . createSuccessButton ( " Move " , this . confirmMoveShards . bind ( this , h , d , e , c ) ) ) , void window . modalView . show ( " modalTable . ejs " , " Move shard : " + e , i , j ) ) } , confirmMoveShards : function ( a , b , c , d ) { var e = this , f = $ ( " # toDBServer " ) . val ( ) , g = { database : a , collection : b , shard : c , fromServer : d , toServer : f } ; $ . ajax ( { type : " POST " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / moveShard " ) , contentType : " application / json " , processData : ! 1 , data : JSON . stringify ( g ) , async : ! 0 , success : function ( a ) { a = = = ! 0 & & ( window . setTimeout ( function ( ) { e . render ( ! 1 ) } , 1500 ) , arangoHelper . arangoNotification ( " Shard " + c + " will be moved to " + f + " . " ) ) } , error : function ( ) { arangoHelper . arangoNotification ( " Shard " + c + " could not be moved to " + f + " . " ) } } ) , window . modalView . hide ( ) } , rebalanceShards : function ( ) { var a = this ; $ . ajax ( { type : " POST " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _admin / cluster / rebalanceShards " ) , contentType : " application / json " , processData : ! 1 , data : JSON . stringify ( { } ) , async : ! 0 , success : function ( b ) { b = = = ! 0 & & ( window . setTimeout ( function ( ) { a . render ( ! 1 ) } , 1500 ) , arangoHelper . arangoNotification ( " Started rebalance process . " ) ) } , error : function ( ) { arangoHelper . arangoNotification ( " Could not start rebalance process . " ) } } ) , window . modalView . hide ( ) } , continueRender : function ( a ) { delete a . code , delete a . error , this . $ el . html ( this . template . render ( { collections : a } ) ) } , updateServerTime : function ( ) { this . serverTime = ( new Date ) . getTime ( ) } } ) } ( ) , 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 ( ' < option id = " ' + a + ' " > ' + a + " < / option > " ) } ) ; 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 ( ' < option id = " ' + a + ' " > ' + a + " < / option > " ) } ) ; 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 ( i < c ) { 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 " ) ) { b . knownServers . indexOf ( a . id ) = = = - 1 & & 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 " ) ) { b . knownServers . indexOf ( a . id ) = = = - 1 & & 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 ; <nl> + 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 ; c < l . length ; + + c ) if ( b = g . hist [ l [ c ] ] ) for ( d = 0 ; d < b . length ; + + d ) f = b [ d ] . snap , f < k | | ( 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 | shortest_path " , hide : function ( ) { this . typeahead = $ ( " # spotlight . typeahead " ) . typeahead ( " destroy " ) , $ ( this . el ) . hide ( ) } , listenKey : function ( a ) { 27 = = = a . keyCode ? ( this . hide ( ) , this . callbackSuccess & & this . callbackCancel ( ) ) : 13 = = = a . keyCode & & this . callbackSuccess & & ( this . hide ( ) , this . callbackSuccess ( $ ( this . typeahead ) . val ( ) ) ) } , 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 ( ) ) } ) , a . aqlKeywordsArray . push ( ! 0 ) , a . aqlKeywordsArray . push ( ! 1 ) , a . aqlKeywordsArray . push ( null ) } , fetchKeywords : function ( a ) { var b = this ; $ . ajax ( { type : " GET " , cache : ! 1 , url : arangoHelper . databaseUrl ( " / _api / aql - builtin " ) , contentType : " application / json " , success : function ( c ) { b . stringToArray ( ) , b . updateDatasets ( ) , _ . each ( c . functions , function ( a ) { b . aqlBuiltinFunctionsArray . push ( a . name ) } ) , a & & a ( ) } , error : function ( ) { a & & a ( ) , arangoHelper . arangoError ( " AQL " , " Could not fetch AQL function definition . " ) } } ) } , show : function ( a , b , c ) { var d = this ; this . callbackSuccess = a , this . callbackCancel = b ; var e = function ( ) { var a = function ( a , b , c ) { var d = ' < div class = " header - type " > < h4 > ' + a + " < / h4 > " ; return b & & ( d + = ' < span > < i class = " fa ' + b + ' " > < / i > < / span > ' ) , c & & ( d + = ' < span class = " type " > ' + c . toUpperCase ( ) + " < / span > " ) , d + = " < / div > " } ; $ ( 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 : a ( " Functions " , " fa - code " , " aql " ) } } , { name : " Keywords " , source : this . substringMatcher ( this . aqlKeywordsArray ) , limit : this . displayLimit , templates : { header : a ( " Keywords " , " fa - code " , " aql " ) } } , { name : " Documents " , source : this . substringMatcher ( this . collections . doc ) , limit : this . displayLimit , templates : { header : a ( " Documents " , " fa - file - text - o " , " Collection " ) } } , { name : " Edges " , source : this . substringMatcher ( this . collections . edge ) , limit : this . displayLimit , templates : { header : a ( " Edges " , " fa - share - alt " , " Collection " ) } } , { name : " System " , limit : this . displayLimit , source : this . substringMatcher ( this . collections . system ) , templates : { header : a ( " 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 : a ( " Documents " , " fa - file - text - o " , " Collection " ) } } , { name : " Edges " , source : this . substringMatcher ( this . collections . edge ) , limit : this . displayLimit , templates : { header : a ( " Edges " , " fa - share - alt " , " Collection " ) } } , { name : " System " , limit : this . displayLimit , source : this . substringMatcher ( this . collections . system ) , templates : { header : a ( " System " , " fa - cogs " , " Collection " ) } } ) , $ ( " # spotlight . typeahead " ) . focus ( ) } . bind ( this ) ; 0 = = = d . aqlBuiltinFunctionsArray . length ? this . fetchKeywords ( e ) : e ( ) } } ) } ( ) , function ( ) { " use strict " ; window . StatisticBarView = Backbone . View . extend ( { el : " # statisticBar " , events : { " change # arangoCollectionSelect " : " navigateBySelect " , " click . tab " : " navigateByTab " } , template : templateEngine . createTemplate ( " statisticBarView . ejs " ) , initialize : function ( 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 . SupportView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " supportView . ejs " ) , events : { " click . subViewNavbar . subMenuEntry " : " toggleViews " } , render : function ( ) { this . $ el . html ( this . template . render ( { } ) ) } , resize : function ( a ) { a ? $ ( " . innerContent " ) . css ( " height " , " auto " ) : $ ( " . innerContent " ) . height ( $ ( " . centralRow " ) . height ( ) - 170 ) } , renderSwagger : function ( ) { var a = window . location . pathname . split ( " / " ) , b = window . location . protocol + " / / " + window . location . hostname + " : " + window . location . port + " / " + a [ 1 ] + " / " + a [ 2 ] + " / _admin / aardvark / api / index . html " ; $ ( " # swagger " ) . html ( " " ) , $ ( " # swagger " ) . append ( ' < iframe src = " ' + b + ' " style = " border : none " > < / iframe > ' ) } , toggleViews : function ( a ) { var b = this , c = a . currentTarget . id . split ( " - " ) [ 0 ] , d = [ " community " , " documentation " , " swagger " ] ; _ . each ( d , function ( a ) { c ! = = a ? $ ( " # " + a ) . hide ( ) : ( " swagger " = = = c ? ( b . renderSwagger ( ) , $ ( " # swagger iframe " ) . css ( " height " , " 100 % " ) , $ ( " # swagger iframe " ) . css ( " width " , " 100 % " ) , $ ( " # swagger iframe " ) . css ( " margin - top " , " - 13px " ) , b . resize ( ) ) : b . resize ( ! 0 ) , $ ( " # " + a ) . show ( ) ) } ) , $ ( " . subMenuEntries " ) . children ( ) . removeClass ( " active " ) , $ ( " # " + c + " - support " ) . 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 . UserBarView = Backbone . View . extend ( { events : { " change # userBarSelect " : " navigateBySelect " , " click . tab " : " navigateByTab " , " mouseenter . dropdown " : " showDropdown " , " mouseleave . dropdown " : " hideDropdown " , " click # userLogoutIcon " : " userLogout " , " click # userLogout " : " userLogout " } , initialize : function ( a ) { this . userCollection = a . userCollection , this . userCollection . fetch ( { cache : ! 1 , 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 ( ) { if ( frontendConfig . authenticationEnabled ! = = ! 1 ) { 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 ) { frontendConfig . authenticationEnabled = = = ! 0 & & ( a | | null = = = b ? arangoHelper . arangoError ( " User " , " Could not fetch user data " ) : this . currentUser = this . collection . findWhere ( { user : b } ) ) } . bind ( this ) ; this . collection . fetch ( { cache : ! 1 , 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 ; $ ( " # userManagementDropdown " ) . is ( " : visible " ) & & ( b = ! 0 ) ; var c = function ( ) { 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 " ) } . bind ( this ) ; return this . collection . fetch ( { cache : ! 1 , success : function ( ) { c ( ) } } ) , this } , search : function ( ) { var a , b , c , d ; a = $ ( " # userManagementSearchInput " ) , b = $ ( " # userManagementSearchInput " ) . val ( ) , d = this . collection . filter ( function ( a ) { return a . get ( " user " ) . indexOf ( b ) ! = = - 1 } ) , $ ( 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 ) } , updateUserManagement : function ( ) { var a = this ; this . collection . fetch ( { cache : ! 1 , success : function ( ) { a . render ( ) } } ) } , editUser : function ( a ) { if ( " createUser " ! = = $ ( a . currentTarget ) . find ( " a " ) . attr ( " id " ) ) { $ ( a . currentTarget ) . hasClass ( " tile " ) & & ( a . currentTarget = $ ( a . currentTarget ) . find ( " img " ) ) , this . collection . fetch ( { cache : ! 1 } ) ; var b = this . evaluateUserName ( $ ( a . currentTarget ) . attr ( " id " ) , " _edit - user " ) ; " " = = = b & & ( b = $ ( a . currentTarget ) . attr ( " id " ) ) , window . App . navigate ( " user / " + encodeURIComponent ( b ) , { trigger : ! 0 } ) } } , toggleView : function ( ) { $ ( " # userSortDesc " ) . attr ( " checked " , this . collection . sortOptions . desc ) , $ ( " # userManagementToggle " ) . toggleClass ( " activated " ) , $ ( " # userManagementDropdown2 " ) . slideToggle ( 200 ) } , 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 ) } , evaluateUserName : function ( a , b ) { if ( a ) { var c = a . lastIndexOf ( b ) ; return a . substring ( 0 , c ) } } , updateUserProfile : function ( ) { var a = this ; this . collection . fetch ( { cache : ! 1 , success : function ( ) { a . render ( ) } } ) } } ) } ( ) , function ( ) { " use strict " ; window . UserPermissionView = Backbone . View . extend ( { el : " # content " , template : templateEngine . createTemplate ( " userPermissionView . ejs " ) , initialize : function ( a ) { this . username = a . username } , events : { ' click # userPermissionView [ type = " checkbox " ] ' : " setPermission " } , render : function ( ) { var a = this ; this . collection . fetch ( { success : function ( ) { a . continueRender ( ) } } ) } , setPermission : function ( a ) { var b = $ ( a . currentTarget ) . is ( " : checked " ) , c = $ ( a . currentTarget ) . attr ( " name " ) ; b ? this . grantPermission ( this . currentUser . get ( " user " ) , c ) : this . revokePermission ( this . currentUser . get ( " user " ) , c ) } , grantPermission : function ( a , b ) { $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( a ) + " / database / " + encodeURIComponent ( b ) ) , contentType : " application / json " , data : JSON . stringify ( { grant : " rw " } ) } ) } , revokePermission : function ( a , b ) { $ . ajax ( { type : " PUT " , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( a ) + " / database / " + encodeURIComponent ( b ) ) , contentType : " application / json " } ) } , continueRender : function ( ) { var a = this ; this . currentUser = this . collection . findWhere ( { user : this . username } ) , this . breadcrumb ( ) , arangoHelper . buildUserSubNav ( this . currentUser . get ( " user " ) , " Permissions " ) ; var b = arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( a . currentUser . get ( " user " ) ) + " / database " ) ; " _system " = = = frontendConfig . db & & ( b = arangoHelper . databaseUrl ( " / _api / user / root / database " ) ) , $ . ajax ( { type : " GET " , url : b , contentType : " application / json " , success : function ( b ) { var c = b . result ; $ . ajax ( { type : " GET " , url : arangoHelper . databaseUrl ( " / _api / user / " + encodeURIComponent ( a . currentUser . get ( " user " ) ) + " / database " ) , contentType : " application / json " , success : function ( b ) { var d = b . result ; if ( c . _system ) { var e = [ ] ; _ . each ( c , function ( a , b ) { e . push ( b ) } ) , c = e } a . finishRender ( c , d ) } } ) } } ) } , finishRender : function ( a , b ) { _ . each ( b , function ( a , c ) { " rw " ! = = a & & delete b [ c ] } ) , $ ( this . el ) . html ( this . template . render ( { allDBs : a , permissions : b } ) ) } , breadcrumb : function ( ) { $ ( " # subNavigationBar . breadcrumb " ) . html ( " User : " + this . currentUser . get ( " user " ) ) } } ) } ( ) , function ( ) { " use strict " ; window . UserView = Backbone . View . extend ( { el : " # content " , initialize : function ( a ) { this . username = a . username } , render : function ( ) { var a = this ; this . collection . fetch ( { success : function ( ) { a . continueRender ( ) } } ) } , editCurrentUser : function ( ) { this . createEditCurrentUserModal ( this . currentUser . get ( " user " ) , this . currentUser . get ( " extra " ) . name , this . currentUser . get ( " extra " ) . img ) } , continueRender : function ( ) { this . breadcrumb ( ) , this . currentUser = this . collection . findWhere ( { user : this . username } ) , arangoHelper . buildUserSubNav ( this . currentUser . get ( " user " ) , " General " ) , this . currentUser . get ( " loggedIn " ) ? this . editCurrentUser ( ) : this . createEditUserModal ( this . currentUser . get ( " user " ) , this . currentUser . get ( " extra " ) . name , this . currentUser . get ( " active " ) ) } , createEditUserPasswordModal : function ( ) { var a = [ ] , b = [ ] ; 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 ) } , 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 , null , null , this . events , null , null , " content " ) } , parseImgString : function ( a ) { return a . indexOf ( " @ " ) = = = - 1 ? 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 : " Change Password " , type : window . modalView . buttons . NOTIFICATION , callback : this . createEditUserPasswordModal . 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 , null , null , this . events , null , null , " content " ) } , validateStatus : function ( a ) { return " " ! = = a } , submitDeleteUser : function ( a ) { var b = this . collection . findWhere ( { user : a } ) ; b . destroy ( { wait : ! 0 } ) , window . App . navigate ( " # users " , { trigger : ! 0 } ) } , 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 ( ) } , submitEditUserPassword : function ( ) { var a = $ ( " # newCurrentPassword " ) . val ( ) , b = $ ( " # confirmCurrentPassword " ) . val ( ) ; $ ( " # newCurrentPassword " ) . val ( " " ) , $ ( " # confirmCurrentPassword " ) . val ( " " ) , $ ( " # newCurrentPassword " ) . closest ( " th " ) . css ( " backgroundColor " , " white " ) , $ ( " # confirmCurrentPassword " ) . closest ( " th " ) . css ( " backgroundColor " , " white " ) ; var c = ! 1 ; a ! = = b & & ( arangoHelper . arangoError ( " User " , " New passwords do not match . " ) , c = ! 0 ) , c | | ( this . currentUser . setPassword ( a ) , arangoHelper . arangoNotification ( " User " , " Password changed . " ) , window . modalView . hide ( ) ) } , 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_ \ - ] * $ / ) | | ( arangoHelper . arangoError ( " Wrong Username " , " Username may only contain numbers , letters , _ and - " ) , ! 1 ) } , editUserPassword : function ( ) { window . modalView . hide ( ) , this . createEditUserPasswordModal ( ) } , validateName : function ( a ) { return " " = = = a | | ( ! ! a . match ( / ^ [ a - zA - Z ] [ a - zA - Z0 - 9_ \ - \ ] * $ / ) | | ( arangoHelper . arangoError ( " Wrong Username " , " Username may only contain numbers , letters , _ and - " ) , ! 1 ) ) } , 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 " , success : function ( ) { arangoHelper . arangoNotification ( " User " , d . get ( " user " ) + " updated . " ) } , error : function ( ) { arangoHelper . arangoError ( " User " , " Could not update " + d . get ( " user " ) + " . " ) } } ) } , breadcrumb : function ( ) { $ ( " # subNavigationBar . breadcrumb " ) . html ( " User : " + this . username ) } } ) } ( ) , 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 " , " user / : name " : " userView " , " user / : name / permission " : " userPermissionView " , userProfile : " userProfile " , cluster : " cluster " , nodes : " nodes " , shards : " shards " , " node / : name " : " node " , logs : " logs " , helpus : " helpUs " , " graph2 / : name " : " graph2 " , " graph2 / : name / settings " : " graph2settings " , support : " support " } , execute : function ( a , b ) { $ ( " # subNavigationBar . breadcrumb " ) . html ( " " ) , $ ( " # subNavigationBar . bottom " ) . html ( " " ) , $ ( " # loadingScreen " ) . hide ( ) , $ ( " # content " ) . show ( ) , a & & a . apply ( this , b ) } , checkUser : function ( ) { var a = this ; if ( " # login " ! = = window . location . hash ) { var b = function ( ) { this . initOnce ( ) , $ ( " . bodyWrapper " ) . show ( ) , $ ( " . navbar " ) . show ( ) } . bind ( this ) , c = function ( c , d ) { frontendConfig . authenticationEnabled ? ( a . currentUser = d , c | | null = = = d ? " # login " ! = = window . location . hash & & this . navigate ( " login " , { trigger : ! 0 } ) : b ( ) ) : b ( ) } . bind ( this ) ; frontendConfig . authenticationEnabled ? this . userCollection . whoAmI ( c ) : ( this . initOnce ( ) , $ ( " . bodyWrapper " ) . show ( ) , $ ( " . navbar " ) . show ( ) ) } } , 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 ) } , 350 ) } , initFinished : ! 1 , initialize : function ( ) { frontendConfig . isCluster = = = ! 0 & & ( this . isCluster = ! 0 ) , 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 = = = ! 0 & & a . coordinatorCollection . fetch ( { success : function ( ) { a . fetchDBS ( ) } } ) , b & & console . log ( b ) } . bind ( this ) ; window . isCoordinator ( b ) , frontendConfig . isCluster = = = ! 1 & & ( 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 ( { cache : ! 1 } ) , window . spotlightView = new window . SpotlightView ( { collection : this . arangoCollectionsStore } ) , this . footerView = new window . FooterView ( { collection : a . coordinatorCollection } ) , this . notificationList = new window . NotificationCollection , this . currentDB . fetch ( { cache : ! 1 , 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 ( ) , this . userConfig = new window . UserConfig , this . userConfig . fetch ( ) , this . documentsView = new window . DocumentsView ( { collection : new window . ArangoDocuments , documentStore : this . arangoDocumentStore , collectionsStore : this . arangoCollectionsStore } ) } . 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 ? this . isCluster = = = ! 1 | | void 0 = = = this . isCluster ? 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 ) } , shards : function ( a ) { return this . checkUser ( ) , a & & void 0 ! = = this . isCluster ? this . isCluster = = = ! 1 ? ( this . routes [ " " ] = " dashboard " , void this . navigate ( " # dashboard " , { trigger : ! 0 } ) ) : ( this . shardsView | | ( this . shardsView = new window . ShardsView ( { dbServers : this . dbServers } ) ) , void this . shardsView . render ( ) ) : void this . waitForInit ( this . shards . bind ( this ) ) } , nodes : 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 . NodesView2 ( { } ) , void this . nodesView . render ( ) ) : void this . waitForInit ( this . nodes . bind ( this ) ) } , 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 } ) ) : 0 = = = this . dbServers . length ? void this . navigate ( " # cNodes " , { 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 ) ) } , sNodes : function ( a ) { return this . checkUser ( ) , a & & void 0 ! = = this . isCluster ? this . isCluster = = = ! 1 ? ( this . routes [ " " ] = " dashboard " , void this . navigate ( " # dashboard " , { trigger : ! 0 } ) ) : ( this . scaleView = new window . ScaleView ( { coordinators : this . coordinatorCollection , dbServers : this . dbServers [ 0 ] } ) , void this . scaleView . render ( ) ) : void this . waitForInit ( this . sNodes . 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 ( { <nl> + 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 ( { cache : ! 1 , success : function ( ) { c ( ) } } ) : c ( ) } , login : function ( ) { var a = function ( a , b ) { this . loginView | | ( this . loginView = new window . LoginView ( { collection : this . userCollection } ) ) , a | | null = = = b ? this . loginView . render ( ) : this . loginView . render ( ! 0 ) } . bind ( this ) ; this . userCollection . whoAmI ( a ) } , 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 ( { cache : ! 1 , success : function ( ) { b . collectionsView . render ( ) } } ) } , cIndices : function ( a , b ) { var c = this ; return this . checkUser ( ) , b ? void this . arangoCollectionsStore . fetch ( { cache : ! 1 , 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 ( { cache : ! 1 , 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 ( { cache : ! 1 , 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 ) } , query : function ( a ) { return this . checkUser ( ) , a ? ( this . queryView | | ( this . queryView = new window . QueryView ( { collection : this . queryCollection } ) ) , void this . queryView . render ( ) ) : void this . waitForInit ( this . query . bind ( this ) ) } , graph2 : function ( a , b ) { return this . checkUser ( ) , b ? ( this . graphViewer2 & & this . graphViewer2 . remove ( ) , this . graphViewer2 = new window . GraphViewer2 ( { name : a , userConfig : this . userConfig } ) , void this . graphViewer2 . render ( ) ) : void this . waitForInit ( this . graph2 . bind ( this ) , a ) } , graph2settings : function ( a , b ) { return this . checkUser ( ) , b ? ( this . graphSettingsView & & this . graphSettingsView . remove ( ) , this . graphSettingsView = new window . GraphSettingsView ( { name : a , userConfig : this . userConfig } ) , void this . graphSettingsView . render ( ) ) : void this . waitForInit ( this . graph2settings . bind ( this ) , a ) } , 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 ) ) } , support : function ( a ) { return this . checkUser ( ) , a ? ( this . testView | | ( this . supportView = new window . SupportView ( { } ) ) , void this . supportView . render ( ) ) : void this . waitForInit ( this . support . 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 . graphViewer2 & & this . graphViewer2 . resize ( ) , this . documentsView & & this . documentsView . resize ( ) , this . documentView & & this . documentView . resize ( ) } , userPermissionView : function ( a , b ) { if ( this . checkUser ( ) , b | | null = = = b ) this . userPermissionView = new window . UserPermissionView ( { collection : this . userCollection , databases : this . arangoDatabase , username : a } ) , this . userPermissionView . render ( ) ; else if ( b = = = ! 1 ) return void this . waitForInit ( this . userPermissionView . bind ( this ) , a ) } , userView : function ( a , b ) { this . checkUser ( ) , b | | null = = = b ? ( this . userView = new window . UserView ( { collection : this . userCollection , username : a } ) , this . userView . render ( ) ) : b = = = ! 1 & & this . waitForInit ( this . userView . bind ( this ) , a ) } , 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 ( a ) { var b = this , c = ! 1 ; this . coordinatorCollection . each ( function ( a ) { b . dbServers . push ( new window . ClusterServers ( [ ] , { host : a . get ( " address " ) } ) ) } ) , this . initFinished = ! 0 , _ . each ( this . dbServers , function ( b ) { b . fetch ( { success : function ( ) { c = = = ! 1 & & a & & ( a ( ) , c = ! 0 ) } } ) } ) } , 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 : arangoHelper . databaseUrl ( " / _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 ) . ajaxSend ( function ( a , b , c ) { var d = window . arangoHelper . getCurrentJwt ( ) ; d & & b . setRequestHeader ( " Authorization " , " bearer " + d ) } ) , $ ( 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 ( ) } ) ) } ( ) ; <nl> \ No newline at end of file <nl> Binary files a / js / apps / system / _admin / aardvark / APP / frontend / build / app . min . js . gz and b / js / apps / system / _admin / aardvark / APP / frontend / build / app . min . js . gz differ <nl> mmm a / js / apps / system / _admin / aardvark / APP / frontend / build / index - min . html <nl> ppp b / js / apps / system / _admin / aardvark / APP / frontend / build / index - min . html <nl> < h5 class = " collectionName " > < % = _ . escape ( username ) % > < % if ( name ! = = ' ' ) { % > ( < % <nl> < / div > <nl> <nl> < div id = " workMonitorContent " class = " innerContent " > <nl> - < / div > < / script > < / head > < body > < nav class = " navbar " style = " display : none " > < div class = " primary " > < div class = " navlogo " > < a class = " logo big " href = " # " > < img class = " arangodbLogo " src = " img / arangodb_logo_big . png " > < / a > < a class = " logo small " href = " # " > < img class = " arangodbLogo " src = " img / arangodb_logo_small . png " > < / a > < a class = " version " > < span > VERSION : < / span > < span id = " currentVersion " > < / span > < / a > < / div > < div class = " statmenu " id = " statisticBar " > < / div > < div class = " navmenu " id = " navigationBar " > < / div > < / div > < / nav > < div id = " modalPlaceholder " > < / div > < div class = " bodyWrapper " style = " display : none " > < div class = " centralRow " > < div id = " navbar2 " class = " navbarWrapper secondary " > < div class = " subnavmenu " id = " subNavigationBar " > < / div > < / div > < div class = " resizecontainer contentWrapper " > < div id = " loadingScreen " class = " loadingScreen " style = " display : none " > < i class = " fa fa - circle - o - notch fa - spin fa - 3x fa - fw margin - bottom " > < / i > < span class = " sr - only " > Loading . . . < / span > < / div > < div id = " content " class = " centralContent " > < / div > < footer class = " footer " > < div id = " footerBar " > < / div > < / footer > < / div > < / div > < / div > < div id = " progressPlaceholder " style = " display : none " > < / div > < div id = " spotlightPlaceholder " style = " display : none " > < / div > < div id = " offlinePlaceholder " style = " display : none " > < div class = " offline - div " > < div class = " pure - u " > < div class = " pure - u - 1 - 4 " > < / div > < div class = " pure - u - 1 - 2 offline - window " > < div class = " offline - header " > < h3 > You have been disconnected from the server < / h3 > < / div > < div class = " offline - body " > < p > The connection to the server has been lost . The server may be under heavy load . < / p > < p > Trying to reconnect in < span id = " offlineSeconds " > 10 < / span > seconds . < / p > < p class = " animation_state " > < span > < button class = " button - success " > Reconnect now < / button > < / span > < / p > < / div > < / div > < div class = " pure - u - 1 - 4 " > < / div > < / div > < / div > < / div > < div class = " arangoFrame " style = " " > < div class = " outerDiv " > < div class = " innerDiv " > < / div > < / div > < / div > < script src = " libs . js ? version = 1468420185169 " > < / script > < script src = " app . js ? version = 1468420185169 " > < / script > < / body > < / html > <nl> \ No newline at end of file <nl> + < / div > < / script > < / head > < body > < nav class = " navbar " style = " display : none " > < div class = " primary " > < div class = " navlogo " > < a class = " logo big " href = " # " > < img class = " arangodbLogo " src = " img / arangodb_logo_big . png " > < / a > < a class = " logo small " href = " # " > < img class = " arangodbLogo " src = " img / arangodb_logo_small . png " > < / a > < a class = " version " > < span > VERSION : < / span > < span id = " currentVersion " > < / span > < / a > < / div > < div class = " statmenu " id = " statisticBar " > < / div > < div class = " navmenu " id = " navigationBar " > < / div > < / div > < / nav > < div id = " modalPlaceholder " > < / div > < div class = " bodyWrapper " style = " display : none " > < div class = " centralRow " > < div id = " navbar2 " class = " navbarWrapper secondary " > < div class = " subnavmenu " id = " subNavigationBar " > < / div > < / div > < div class = " resizecontainer contentWrapper " > < div id = " loadingScreen " class = " loadingScreen " style = " display : none " > < i class = " fa fa - circle - o - notch fa - spin fa - 3x fa - fw margin - bottom " > < / i > < span class = " sr - only " > Loading . . . < / span > < / div > < div id = " content " class = " centralContent " > < / div > < footer class = " footer " > < div id = " footerBar " > < / div > < / footer > < / div > < / div > < / div > < div id = " progressPlaceholder " style = " display : none " > < / div > < div id = " spotlightPlaceholder " style = " display : none " > < / div > < div id = " offlinePlaceholder " style = " display : none " > < div class = " offline - div " > < div class = " pure - u " > < div class = " pure - u - 1 - 4 " > < / div > < div class = " pure - u - 1 - 2 offline - window " > < div class = " offline - header " > < h3 > You have been disconnected from the server < / h3 > < / div > < div class = " offline - body " > < p > The connection to the server has been lost . The server may be under heavy load . < / p > < p > Trying to reconnect in < span id = " offlineSeconds " > 10 < / span > seconds . < / p > < p class = " animation_state " > < span > < button class = " button - success " > Reconnect now < / button > < / span > < / p > < / div > < / div > < div class = " pure - u - 1 - 4 " > < / div > < / div > < / div > < / div > < div class = " arangoFrame " style = " " > < div class = " outerDiv " > < div class = " innerDiv " > < / div > < / div > < / div > < script src = " libs . js ? version = 1468500265065 " > < / script > < script src = " app . js ? version = 1468500265065 " > < / script > < / body > < / html > <nl> \ No newline at end of file <nl> Binary files a / js / apps / system / _admin / aardvark / APP / frontend / build / index - min . html . gz and b / js / apps / system / _admin / aardvark / APP / frontend / build / index - min . html . gz differ <nl>
|
Rebuild aardvark
|
arangodb/arangodb
|
4ea6517275ab3b1d1da7f0a487292dc8b7a44f00
|
2016-07-14T12:44:42Z
|
mmm a / test / test . lua <nl> ppp b / test / test . lua <nl> end <nl> <nl> function torchtest . TestAsserts ( ) <nl> mytester : assertError ( function ( ) error ( ' hello ' ) end , ' assertError : Error not caught ' ) <nl> + mytester : assertErrorMsg ( function ( ) error ( ' hello ' ) end , ' test . lua : 440 : hello ' , ' assertError : " hello " Error not caught ' ) <nl> + mytester : assertErrorPattern ( function ( ) error ( ' hello ' ) end , ' . * ll . * ' , ' assertError : " . * ll . * " Error not caught ' ) <nl> <nl> local x = torch . rand ( 100 , 100 ) * 2 - 1 ; <nl> local xx = x : clone ( ) ; <nl>
|
Test for new asserts
|
pytorch/pytorch
|
660e98a40464218de73e2e4d64631dca7975a781
|
2013-10-22T14:39:43Z
|
mmm a / InMemoryView . cpp <nl> ppp b / InMemoryView . cpp <nl> void InMemoryView : : startThreads ( w_root_t * root ) { <nl> notifyThreadInstance . detach ( ) ; <nl> <nl> / / Wait for it to signal that the watcher has been initialized <nl> - w_pending_coll_lock_and_wait ( & pending_ , - 1 / * infinite * / ) ; <nl> - w_pending_coll_unlock ( & pending_ ) ; <nl> + pending_ . lockAndWait ( std : : chrono : : milliseconds ( - 1 ) / * infinite * / ) ; <nl> + pending_ . unlock ( ) ; <nl> <nl> / / And now start the IO thread <nl> w_root_addref ( root ) ; <nl> void InMemoryView : : signalThreads ( ) { <nl> w_log ( W_LOG_DBG , " signalThreads ! % p % s \ n " , this , root_path . c_str ( ) ) ; <nl> stopThreads_ = true ; <nl> watcher - > signalThreads ( ) ; <nl> - w_pending_coll_ping ( & pending_ ) ; <nl> + pending_ . ping ( ) ; <nl> } <nl> <nl> bool InMemoryView : : doAnyOfTheseFilesExist ( <nl> mmm a / pending . cpp <nl> ppp b / pending . cpp <nl> static bool is_path_prefix ( const char * path , size_t path_len , const char * other , <nl> } <nl> <nl> / / Helper to un - doubly - link a pending item . <nl> - static inline void unlink_item ( struct watchman_pending_collection * coll , <nl> - struct watchman_pending_fs * p ) { <nl> - if ( coll - > pending = = p ) { <nl> - coll - > pending = p - > next ; <nl> + void watchman_pending_collection : : unlinkItem ( watchman_pending_fs * p ) { <nl> + if ( pending_ = = p ) { <nl> + pending_ = p - > next ; <nl> } <nl> if ( p - > prev ) { <nl> p - > prev - > next = p - > next ; <nl> static inline void unlink_item ( struct watchman_pending_collection * coll , <nl> } <nl> <nl> / / Helper to doubly - link a pending item to the head of a collection . <nl> - static inline void link_head ( struct watchman_pending_collection * coll , <nl> - struct watchman_pending_fs * p ) { <nl> + void watchman_pending_collection : : linkHead ( watchman_pending_fs * p ) { <nl> p - > prev = NULL ; <nl> - p - > next = coll - > pending ; <nl> - if ( coll - > pending ) { <nl> - coll - > pending - > prev = p ; <nl> + p - > next = pending_ ; <nl> + if ( pending_ ) { <nl> + pending_ - > prev = p ; <nl> } <nl> - coll - > pending = p ; <nl> + pending_ = p ; <nl> } <nl> <nl> / * Free a pending_fs node * / <nl> void w_pending_fs_free ( struct watchman_pending_fs * p ) { <nl> <nl> / * initialize a pending_coll * / <nl> watchman_pending_collection : : watchman_pending_collection ( ) <nl> - : pending ( nullptr ) , pinged ( false ) { <nl> - if ( pthread_mutex_init ( & lock , nullptr ) ) { <nl> + : pending_ ( nullptr ) , pinged_ ( false ) { <nl> + if ( pthread_mutex_init ( & mutex_ , nullptr ) ) { <nl> throw std : : runtime_error ( " failed to init mutex " ) ; <nl> } <nl> - if ( pthread_cond_init ( & cond , nullptr ) ) { <nl> + if ( pthread_cond_init ( & cond_ , nullptr ) ) { <nl> throw std : : runtime_error ( " failed to init cond " ) ; <nl> } <nl> } <nl> <nl> / * destroy a pending_coll * / <nl> watchman_pending_collection : : ~ watchman_pending_collection ( ) { <nl> - w_pending_coll_drain ( this ) ; <nl> - pthread_mutex_destroy ( & lock ) ; <nl> - pthread_cond_destroy ( & cond ) ; <nl> + drain ( ) ; <nl> + pthread_mutex_destroy ( & mutex_ ) ; <nl> + pthread_cond_destroy ( & cond_ ) ; <nl> } <nl> <nl> / * drain and discard the content of a pending_coll , but do not destroy it * / <nl> - void w_pending_coll_drain ( struct watchman_pending_collection * coll ) { <nl> + void watchman_pending_collection : : drain ( ) { <nl> struct watchman_pending_fs * p ; <nl> <nl> - while ( ( p = w_pending_coll_pop ( coll ) ) ! = NULL ) { <nl> + while ( ( p = pop ( ) ) ! = NULL ) { <nl> w_pending_fs_free ( p ) ; <nl> } <nl> <nl> - coll - > tree . clear ( ) ; <nl> + tree_ . clear ( ) ; <nl> } <nl> <nl> / * compute a deadline on entry , then obtain the collection lock <nl> * and wait until the deadline expires or until the collection is <nl> * pinged . On Return , the caller owns the collection lock . * / <nl> - bool w_pending_coll_lock_and_wait ( struct watchman_pending_collection * coll , <nl> - int timeoutms ) { <nl> + bool watchman_pending_collection : : lockAndWait ( <nl> + std : : chrono : : milliseconds timeoutms ) { <nl> struct timespec deadline ; <nl> int errcode ; <nl> <nl> - if ( timeoutms ! = - 1 ) { <nl> - w_timeoutms_to_abs_timespec ( timeoutms , & deadline ) ; <nl> + if ( timeoutms . count ( ) ! = - 1 ) { <nl> + w_timeoutms_to_abs_timespec ( timeoutms . count ( ) , & deadline ) ; <nl> } <nl> - w_pending_coll_lock ( coll ) ; <nl> - if ( coll - > pending | | coll - > pinged ) { <nl> - coll - > pinged = false ; <nl> + lock ( ) ; <nl> + if ( pending_ | | pinged_ ) { <nl> + pinged_ = false ; <nl> return true ; <nl> } <nl> - if ( timeoutms = = - 1 ) { <nl> - errcode = pthread_cond_wait ( & coll - > cond , & coll - > lock ) ; <nl> + if ( timeoutms . count ( ) = = - 1 ) { <nl> + errcode = pthread_cond_wait ( & cond_ , & mutex_ ) ; <nl> } else { <nl> - errcode = pthread_cond_timedwait ( & coll - > cond , & coll - > lock , & deadline ) ; <nl> + errcode = pthread_cond_timedwait ( & cond_ , & mutex_ , & deadline ) ; <nl> } <nl> <nl> return errcode = = 0 ; <nl> } <nl> <nl> - void w_pending_coll_ping ( struct watchman_pending_collection * coll ) { <nl> - coll - > pinged = true ; <nl> - pthread_cond_broadcast ( & coll - > cond ) ; <nl> + void watchman_pending_collection : : ping ( ) { <nl> + pinged_ = true ; <nl> + pthread_cond_broadcast ( & cond_ ) ; <nl> } <nl> <nl> / * obtain the collection lock * / <nl> - void w_pending_coll_lock ( struct watchman_pending_collection * coll ) { <nl> - int err = pthread_mutex_lock ( & coll - > lock ) ; <nl> + void watchman_pending_collection : : lock ( ) { <nl> + int err = pthread_mutex_lock ( & mutex_ ) ; <nl> if ( err ! = 0 ) { <nl> w_log ( W_LOG_FATAL , " lock assertion : % s \ n " , strerror ( err ) ) ; <nl> } <nl> } <nl> <nl> / * release the collection lock * / <nl> - void w_pending_coll_unlock ( struct watchman_pending_collection * coll ) { <nl> - int err = pthread_mutex_unlock ( & coll - > lock ) ; <nl> + void watchman_pending_collection : : unlock ( ) { <nl> + int err = pthread_mutex_unlock ( & mutex_ ) ; <nl> if ( err ! = 0 ) { <nl> w_log ( W_LOG_FATAL , " unlock assertion : % s \ n " , strerror ( err ) ) ; <nl> } <nl> void w_pending_coll_unlock ( struct watchman_pending_collection * coll ) { <nl> / / deletion . <nl> / / We use this kid_context state to pass down the required information <nl> / / to the iterator callback so that we adjust the overall state correctly . <nl> - struct kid_context { <nl> - w_string_t * root ; <nl> - struct watchman_pending_collection * coll ; <nl> - <nl> - / / This is the iterator callback we use to prune out obsoleted leaves . <nl> - / / We need to compare the prefix to make sure that we don ' t delete <nl> - / / a sibling node by mistake ( see commentary on the is_path_prefix <nl> - / / function for more on that ) . <nl> - int operator ( ) ( <nl> - const unsigned char * key , <nl> - uint32_t key_len , <nl> - watchman_pending_fs * & p ) { <nl> - if ( ( p - > flags & W_PENDING_CRAWL_ONLY ) = = 0 & & key_len > root - > len & & <nl> - is_path_prefix ( ( const char * ) key , key_len , root - > buf , root - > len ) & & <nl> - ! watchman : : CookieSync : : isPossiblyACookie ( p - > path ) ) { <nl> - w_log ( <nl> - W_LOG_DBG , <nl> - " delete_kids : removing ( % d ) % . * s from pending because it is " <nl> - " obsoleted by ( % d ) % . * s \ n " , <nl> - int ( p - > path . size ( ) ) , <nl> - int ( p - > path . size ( ) ) , <nl> - p - > path . data ( ) , <nl> - root - > len , <nl> - root - > len , <nl> - root - > buf ) ; <nl> - <nl> - / / Unlink the child from the pending index . <nl> - unlink_item ( coll , p ) ; <nl> - <nl> - / / and completely free it . <nl> - w_pending_fs_free ( p ) ; <nl> <nl> - / / Remove it from the art tree also . <nl> - coll - > tree . erase ( key , key_len ) ; <nl> + watchman_pending_collection : : iterContext : : iterContext ( <nl> + const w_string & root , <nl> + watchman_pending_collection & coll ) <nl> + : root ( root ) , coll ( coll ) { } <nl> + <nl> + / / This is the iterator callback we use to prune out obsoleted leaves . <nl> + / / We need to compare the prefix to make sure that we don ' t delete <nl> + / / a sibling node by mistake ( see commentary on the is_path_prefix <nl> + / / function for more on that ) . <nl> + int watchman_pending_collection : : iterContext : : operator ( ) ( <nl> + const unsigned char * key , <nl> + uint32_t key_len , <nl> + watchman_pending_fs * & p ) { <nl> + if ( ( p - > flags & W_PENDING_CRAWL_ONLY ) = = 0 & & key_len > root . size ( ) & & <nl> + is_path_prefix ( ( const char * ) key , key_len , root . data ( ) , root . size ( ) ) & & <nl> + ! watchman : : CookieSync : : isPossiblyACookie ( p - > path ) ) { <nl> + w_log ( <nl> + W_LOG_DBG , <nl> + " delete_kids : removing ( % d ) % . * s from pending because it is " <nl> + " obsoleted by ( % d ) % . * s \ n " , <nl> + int ( p - > path . size ( ) ) , <nl> + int ( p - > path . size ( ) ) , <nl> + p - > path . data ( ) , <nl> + int ( root . size ( ) ) , <nl> + int ( root . size ( ) ) , <nl> + root . data ( ) ) ; <nl> <nl> - / / Stop iteration because we just invalidated the iterator state <nl> - / / by modifying the tree mid - iteration . <nl> - return 1 ; <nl> - } <nl> + / / Unlink the child from the pending index . <nl> + coll . unlinkItem ( p ) ; <nl> + <nl> + / / and completely free it . <nl> + w_pending_fs_free ( p ) ; <nl> + <nl> + / / Remove it from the art tree also . <nl> + coll . tree_ . erase ( key , key_len ) ; <nl> <nl> - return 0 ; <nl> + / / Stop iteration because we just invalidated the iterator state <nl> + / / by modifying the tree mid - iteration . <nl> + return 1 ; <nl> } <nl> - } ; <nl> + <nl> + return 0 ; <nl> + } <nl> <nl> / / if there are any entries that are obsoleted by a recursive insert , <nl> / / walk over them now and mark them as ignored . <nl> - static void <nl> - maybe_prune_obsoleted_children ( struct watchman_pending_collection * coll , <nl> - w_string_t * path , int flags ) { <nl> + void watchman_pending_collection : : maybePruneObsoletedChildren ( <nl> + const w_string & path , <nl> + int flags ) { <nl> if ( ( flags & ( W_PENDING_RECURSIVE | W_PENDING_CRAWL_ONLY ) ) = = <nl> W_PENDING_RECURSIVE ) { <nl> - struct kid_context ctx = { path , coll } ; <nl> + iterContext ctx { path , * this } ; <nl> uint32_t pruned = 0 ; <nl> / / Since deletion invalidates the iterator , we need to repeatedly <nl> / / call this to prune out the nodes . It will return 0 once no <nl> / / matching prefixes are found and deleted . <nl> - while ( coll - > tree . iterPrefix ( ( const uint8_t * ) path - > buf , path - > len , ctx ) ) { <nl> + while ( tree_ . iterPrefix ( ( const uint8_t * ) path . data ( ) , path . size ( ) , ctx ) ) { <nl> / / OK ; try again <nl> + + pruned ; <nl> } <nl> <nl> if ( pruned ) { <nl> - w_log ( W_LOG_DBG , <nl> - " maybe_prune_obsoleted_children : pruned % u nodes under ( % d ) % . * s \ n " , <nl> - pruned , path - > len , path - > len , path - > buf ) ; <nl> + w_log ( <nl> + W_LOG_DBG , <nl> + " maybePruneObsoletedChildren : pruned % u nodes under ( % d ) % . * s \ n " , <nl> + pruned , <nl> + int ( path . size ( ) ) , <nl> + int ( path . size ( ) ) , <nl> + path . data ( ) ) ; <nl> } <nl> } <nl> } <nl> <nl> - static inline void consolidate_item ( struct watchman_pending_collection * coll , <nl> - struct watchman_pending_fs * p , int flags ) { <nl> + void watchman_pending_collection : : consolidateItem ( <nl> + watchman_pending_fs * p , <nl> + int flags ) { <nl> / / Increase the strength of the pending item if either of these <nl> / / flags are set . <nl> / / We upgrade crawl - only as well as recursive ; it indicates that <nl> static inline void consolidate_item ( struct watchman_pending_collection * coll , <nl> / / infinitely trying to stat - and - crawl <nl> p - > flags | = flags & ( W_PENDING_CRAWL_ONLY | W_PENDING_RECURSIVE ) ; <nl> <nl> - maybe_prune_obsoleted_children ( coll , p - > path , p - > flags ) ; <nl> + maybePruneObsoletedChildren ( p - > path , p - > flags ) ; <nl> } <nl> <nl> / / Check the tree to see if there is a path that is earlier / higher in the <nl> / / filesystem than the input path ; if there is , and it is recursive , <nl> / / return true to indicate that there is no need to track this new path <nl> / / due to the already scheduled higher level path . <nl> - static bool is_obsoleted_by_containing_dir ( <nl> - struct watchman_pending_collection * coll , <nl> + bool watchman_pending_collection : : isObsoletedByContainingDir ( <nl> const w_string & path ) { <nl> - auto leaf = coll - > tree . longestMatch ( ( const uint8_t * ) path . data ( ) , path . size ( ) ) ; <nl> + auto leaf = tree_ . longestMatch ( ( const uint8_t * ) path . data ( ) , path . size ( ) ) ; <nl> if ( ! leaf ) { <nl> return false ; <nl> } <nl> watchman_pending_fs : : watchman_pending_fs ( <nl> / * add a pending entry . Will consolidate an existing entry with the <nl> * same name . Returns false if an allocation fails . <nl> * The caller must own the collection lock . * / <nl> - bool w_pending_coll_add ( <nl> - struct watchman_pending_collection * coll , <nl> + bool watchman_pending_collection : : add ( <nl> const w_string & path , <nl> struct timeval now , <nl> int flags ) { <nl> char flags_label [ 128 ] ; <nl> <nl> - auto existing = <nl> - coll - > tree . search ( ( const unsigned char * ) path . data ( ) , path . size ( ) ) ; <nl> + auto existing = tree_ . search ( ( const unsigned char * ) path . data ( ) , path . size ( ) ) ; <nl> if ( existing ) { <nl> / * Entry already exists : consolidate * / <nl> - consolidate_item ( coll , * existing , flags ) ; <nl> + consolidateItem ( * existing , flags ) ; <nl> / * all done * / <nl> return true ; <nl> } <nl> <nl> - if ( is_obsoleted_by_containing_dir ( coll , path ) ) { <nl> + if ( isObsoletedByContainingDir ( path ) ) { <nl> return true ; <nl> } <nl> <nl> / / Try to allocate the new node before we prune any children . <nl> auto p = new watchman_pending_fs ( path , now , flags ) ; <nl> <nl> - maybe_prune_obsoleted_children ( coll , path , flags ) ; <nl> + maybePruneObsoletedChildren ( path , flags ) ; <nl> <nl> w_expand_flags ( kflags , flags , flags_label , sizeof ( flags_label ) ) ; <nl> w_log ( <nl> bool w_pending_coll_add ( <nl> path . data ( ) , <nl> flags_label ) ; <nl> <nl> - link_head ( coll , p ) ; <nl> - coll - > tree . insert ( ( const uint8_t * ) path . data ( ) , path . size ( ) , p ) ; <nl> + linkHead ( p ) ; <nl> + tree_ . insert ( ( const uint8_t * ) path . data ( ) , path . size ( ) , p ) ; <nl> <nl> return true ; <nl> } <nl> <nl> - bool w_pending_coll_add_rel ( struct watchman_pending_collection * coll , <nl> - struct watchman_dir * dir , const char * name , <nl> - struct timeval now , int flags ) <nl> - { <nl> + bool watchman_pending_collection : : add ( <nl> + struct watchman_dir * dir , <nl> + const char * name , <nl> + struct timeval now , <nl> + int flags ) { <nl> w_string_t * path_str ; <nl> bool res ; <nl> <nl> bool w_pending_coll_add_rel ( struct watchman_pending_collection * coll , <nl> if ( ! path_str ) { <nl> return false ; <nl> } <nl> - res = w_pending_coll_add ( coll , path_str , now , flags ) ; <nl> + res = add ( path_str , now , flags ) ; <nl> w_string_delref ( path_str ) ; <nl> <nl> return res ; <nl> bool w_pending_coll_add_rel ( struct watchman_pending_collection * coll , <nl> / * Append the contents of src to target , consolidating in target . <nl> * src is effectively drained in the process . <nl> * Caller must own the lock on both src and target . * / <nl> - void w_pending_coll_append ( struct watchman_pending_collection * target , <nl> - struct watchman_pending_collection * src ) { <nl> + void watchman_pending_collection : : append ( watchman_pending_collection * src ) { <nl> struct watchman_pending_fs * p ; <nl> <nl> - while ( ( p = w_pending_coll_pop ( src ) ) ! = NULL ) { <nl> + while ( ( p = src - > pop ( ) ) ! = NULL ) { <nl> auto target_p = <nl> - target - > tree . search ( ( const uint8_t * ) p - > path . data ( ) , p - > path . size ( ) ) ; <nl> + tree_ . search ( ( const uint8_t * ) p - > path . data ( ) , p - > path . size ( ) ) ; <nl> if ( target_p ) { <nl> / * Entry already exists : consolidate * / <nl> - consolidate_item ( target , * target_p , p - > flags ) ; <nl> + consolidateItem ( * target_p , p - > flags ) ; <nl> w_pending_fs_free ( p ) ; <nl> continue ; <nl> } <nl> <nl> - if ( is_obsoleted_by_containing_dir ( target , p - > path ) ) { <nl> + if ( isObsoletedByContainingDir ( p - > path ) ) { <nl> w_pending_fs_free ( p ) ; <nl> continue ; <nl> } <nl> - maybe_prune_obsoleted_children ( target , p - > path , p - > flags ) ; <nl> + maybePruneObsoletedChildren ( p - > path , p - > flags ) ; <nl> <nl> - link_head ( target , p ) ; <nl> - target - > tree . insert ( ( const uint8_t * ) p - > path . data ( ) , p - > path . size ( ) , p ) ; <nl> + linkHead ( p ) ; <nl> + tree_ . insert ( ( const uint8_t * ) p - > path . data ( ) , p - > path . size ( ) , p ) ; <nl> } <nl> <nl> / / Empty the src tree and reset it <nl> - src - > tree . clear ( ) ; <nl> - src - > pending = NULL ; <nl> + src - > tree_ . clear ( ) ; <nl> + src - > pending_ = NULL ; <nl> } <nl> <nl> / * Logically pop an entry from the collection . <nl> * Does NOT remove the entry from the uniq hash . <nl> * The intent is that the caller will call this in a tight loop and <nl> * then _drain ( ) it at the end to clear the uniq hash * / <nl> - struct watchman_pending_fs * w_pending_coll_pop ( <nl> - struct watchman_pending_collection * coll ) { <nl> - struct watchman_pending_fs * p = coll - > pending ; <nl> + struct watchman_pending_fs * watchman_pending_collection : : pop ( ) { <nl> + struct watchman_pending_fs * p = pending_ ; <nl> <nl> if ( p ) { <nl> - unlink_item ( coll , p ) ; <nl> + unlinkItem ( p ) ; <nl> } <nl> <nl> return p ; <nl> } <nl> <nl> / * Returns the number of unique pending items in the collection * / <nl> - uint32_t w_pending_coll_size ( struct watchman_pending_collection * coll ) { <nl> - return coll - > tree . size ( ) ; <nl> + uint32_t watchman_pending_collection : : size ( ) const { <nl> + return tree_ . size ( ) ; <nl> } <nl> <nl> / * vim : ts = 2 : sw = 2 : et : <nl> mmm a / root / crawler . cpp <nl> ppp b / root / crawler . cpp <nl> void InMemoryView : : crawler ( <nl> auto file = it . second . get ( ) ; <nl> if ( file - > exists & & <nl> ( file - > maybe_deleted | | ( S_ISDIR ( file - > stat . mode ) & & recursive ) ) ) { <nl> - w_pending_coll_add_rel ( <nl> - coll , <nl> + coll - > add ( <nl> dir , <nl> w_file_get_name ( file ) - > buf , <nl> now , <nl> mmm a / root / iothread . cpp <nl> ppp b / root / iothread . cpp <nl> void InMemoryView : : fullCrawl ( <nl> / / can get stuck with an empty view until another change is observed <nl> lock . root - > inner . ticks + + ; <nl> gettimeofday ( & start , NULL ) ; <nl> - w_pending_coll_add ( & pending_ , lock . root - > root_path , start , 0 ) ; <nl> + pending_ . add ( lock . root - > root_path , start , 0 ) ; <nl> / / There is the potential for a subtle race condition here . The boolean <nl> / / parameter indicates whether we want to merge in the set of <nl> / / notifications pending from the watcher or not . Since we now coalesce <nl> void InMemoryView : : ioThread ( unlocked_watchman_root * unlocked ) { <nl> / / Wait for the notify thread to give us pending items , or for <nl> / / the settle period to expire <nl> w_log ( W_LOG_DBG , " poll_events timeout = % dms \ n " , timeoutms ) ; <nl> - pinged = w_pending_coll_lock_and_wait ( & pending_ , timeoutms ) ; <nl> + pinged = pending_ . lockAndWait ( std : : chrono : : milliseconds ( timeoutms ) ) ; <nl> w_log ( W_LOG_DBG , " . . . wake up ( pinged = % s ) \ n " , pinged ? " true " : " false " ) ; <nl> - w_pending_coll_append ( & pending , & pending_ ) ; <nl> - w_pending_coll_unlock ( & pending_ ) ; <nl> + pending . append ( & pending_ ) ; <nl> + pending_ . unlock ( ) ; <nl> <nl> - if ( ! pinged & & w_pending_coll_size ( & pending ) = = 0 ) { <nl> + if ( ! pinged & & pending . size ( ) = = 0 ) { <nl> if ( do_settle_things ( unlocked ) ) { <nl> break ; <nl> } <nl> void InMemoryView : : ioThread ( unlocked_watchman_root * unlocked ) { <nl> w_root_lock ( unlocked , " io_thread : process notifications " , & lock ) ; <nl> if ( ! lock . root - > inner . done_initial ) { <nl> / / we need to recrawl . Discard these notifications <nl> - w_pending_coll_drain ( & pending ) ; <nl> + pending . drain ( ) ; <nl> w_root_unlock ( & lock , unlocked ) ; <nl> continue ; <nl> } <nl> bool InMemoryView : : processPending ( <nl> bool pullFromRoot ) { <nl> if ( pullFromRoot ) { <nl> / / You MUST own root - > pending lock for this <nl> - w_pending_coll_append ( coll , & pending_ ) ; <nl> + coll - > append ( & pending_ ) ; <nl> } <nl> <nl> - if ( ! coll - > pending ) { <nl> + if ( ! coll - > pending_ ) { <nl> return false ; <nl> } <nl> <nl> w_log ( <nl> W_LOG_DBG , <nl> " processing % d events in % s \ n " , <nl> - w_pending_coll_size ( coll ) , <nl> + coll - > size ( ) , <nl> root_path . c_str ( ) ) ; <nl> <nl> / / Steal the contents <nl> - auto pending = coll - > pending ; <nl> - coll - > pending = NULL ; <nl> - w_pending_coll_drain ( coll ) ; <nl> + auto pending = coll - > pending_ ; <nl> + coll - > pending_ = nullptr ; <nl> + coll - > drain ( ) ; <nl> <nl> while ( pending ) { <nl> auto p = pending ; <nl> mmm a / root / notifythread . cpp <nl> ppp b / root / notifythread . cpp <nl> void InMemoryView : : handleShouldRecrawl ( unlocked_watchman_root * unlocked ) { <nl> info - > recrawlCount + + ; <nl> / / Tell the new view instance to start up <nl> root - > inner . view - > startThreads ( root ) ; <nl> - w_pending_coll_ping ( & pending_ ) ; <nl> + pending_ . ping ( ) ; <nl> } <nl> } <nl> <nl> void InMemoryView : : notifyThread ( unlocked_watchman_root * unlocked ) { <nl> <nl> / / signal that we ' re done here , so that we can start the <nl> / / io thread after this point <nl> - w_pending_coll_lock ( & pending_ ) ; <nl> - pending_ . pinged = true ; <nl> - w_pending_coll_ping ( & pending_ ) ; <nl> - w_pending_coll_unlock ( & pending_ ) ; <nl> + pending_ . lock ( ) ; <nl> + pending_ . ping ( ) ; <nl> + pending_ . unlock ( ) ; <nl> <nl> while ( ! stopThreads_ ) { <nl> / / big number because not all watchers can deal with <nl> / / - 1 meaning infinite wait at the moment <nl> if ( watcher - > waitNotify ( 86400 ) ) { <nl> while ( watcher - > consumeNotify ( unlocked - > root , & pending ) ) { <nl> - if ( w_pending_coll_size ( & pending ) > = WATCHMAN_BATCH_LIMIT ) { <nl> + if ( pending . size ( ) > = WATCHMAN_BATCH_LIMIT ) { <nl> break ; <nl> } <nl> if ( ! watcher - > waitNotify ( 0 ) ) { <nl> break ; <nl> } <nl> } <nl> - if ( w_pending_coll_size ( & pending ) > 0 ) { <nl> - w_pending_coll_lock ( & pending_ ) ; <nl> - w_pending_coll_append ( & pending_ , & pending ) ; <nl> - w_pending_coll_ping ( & pending_ ) ; <nl> - w_pending_coll_unlock ( & pending_ ) ; <nl> + if ( pending . size ( ) > 0 ) { <nl> + pending_ . lock ( ) ; <nl> + pending_ . append ( & pending ) ; <nl> + pending_ . ping ( ) ; <nl> + pending_ . unlock ( ) ; <nl> } <nl> } <nl> } <nl> mmm a / root / stat . cpp <nl> ppp b / root / stat . cpp <nl> void InMemoryView : : statPath ( <nl> path , <nl> int ( dir_name . size ( ) ) , <nl> dir_name . data ( ) ) ; <nl> - w_pending_coll_add ( coll , dir_name , now , W_PENDING_CRAWL_ONLY ) ; <nl> + coll - > add ( dir_name , now , W_PENDING_CRAWL_ONLY ) ; <nl> } <nl> <nl> } else if ( res ) { <nl> void InMemoryView : : statPath ( <nl> file - > symlink_target = new_symlink_target ; <nl> <nl> if ( symlink_changed & & root - > config . getBool ( " watch_symlinks " , false ) ) { <nl> - w_pending_coll_add ( <nl> - & const_cast < w_root_t * > ( root ) - > inner . pending_symlink_targets , <nl> - full_path , <nl> - now , <nl> - 0 ) ; <nl> + const_cast < w_root_t * > ( root ) - > inner . pending_symlink_targets . add ( <nl> + full_path , now , 0 ) ; <nl> } <nl> } <nl> } else { <nl> void InMemoryView : : statPath ( <nl> w_string_equal ( full_path , root - > cookies . cookieDir ( ) ) ) { <nl> if ( ! root - > inner . watcher - > flags & WATCHER_HAS_PER_FILE_NOTIFICATIONS ) { <nl> / * we always need to crawl , but may not need to be fully recursive * / <nl> - w_pending_coll_add ( coll , full_path , now , <nl> + coll - > add ( <nl> + full_path , <nl> + now , <nl> W_PENDING_CRAWL_ONLY | ( recursive ? W_PENDING_RECURSIVE : 0 ) ) ; <nl> } else { <nl> / * we get told about changes on the child , so we only <nl> void InMemoryView : : statPath ( <nl> * of a dir rename and not a rename event for all of its <nl> * children . * / <nl> if ( recursive ) { <nl> - w_pending_coll_add ( coll , full_path , now , <nl> - W_PENDING_RECURSIVE | W_PENDING_CRAWL_ONLY ) ; <nl> + coll - > add ( <nl> + full_path , now , W_PENDING_RECURSIVE | W_PENDING_CRAWL_ONLY ) ; <nl> } <nl> } <nl> } <nl> void InMemoryView : : statPath ( <nl> * https : / / github . com / facebook / watchman / issues / 307 have more <nl> * context on why this is . <nl> * / <nl> - w_pending_coll_add ( coll , dir_name , now , 0 ) ; <nl> + coll - > add ( dir_name , now , 0 ) ; <nl> } <nl> } <nl> } <nl> mmm a / root / symlink . cpp <nl> ppp b / root / symlink . cpp <nl> void process_pending_symlink_targets ( struct unlocked_watchman_root * unlocked ) { <nl> struct watchman_pending_fs * p , * pending ; <nl> bool enforcing ; <nl> <nl> - pending = unlocked - > root - > inner . pending_symlink_targets . pending ; <nl> + pending = unlocked - > root - > inner . pending_symlink_targets . pending_ ; <nl> if ( ! pending ) { <nl> return ; <nl> } <nl> void process_pending_symlink_targets ( struct unlocked_watchman_root * unlocked ) { <nl> <nl> / / It is safe to work with unlocked - > root - > pending_symlink_targets because <nl> / / this collection is only ever mutated from the IO thread <nl> - unlocked - > root - > inner . pending_symlink_targets . pending = NULL ; <nl> - w_pending_coll_drain ( & unlocked - > root - > inner . pending_symlink_targets ) ; <nl> + unlocked - > root - > inner . pending_symlink_targets . pending_ = nullptr ; <nl> + unlocked - > root - > inner . pending_symlink_targets . drain ( ) ; <nl> while ( pending ) { <nl> p = pending ; <nl> pending = p - > next ; <nl> mmm a / tests / pending_test . cpp <nl> ppp b / tests / pending_test . cpp <nl> size_t process_items ( struct watchman_pending_collection * coll ) { <nl> size_t drained = 0 ; <nl> struct stat st ; <nl> <nl> - while ( ( item = w_pending_coll_pop ( coll ) ) ! = NULL ) { <nl> + while ( ( item = coll - > pop ( ) ) ! = nullptr ) { <nl> / / To simulate looking at the file , we ' re just going to stat <nl> / / ourselves over and over , as the path we put in the list <nl> / / doesn ' t exist on the filesystem . We ' re measuring hot cache <nl> static void bench_pending ( void ) { <nl> <nl> gettimeofday ( & start , NULL ) ; <nl> for ( auto & item : list ) { <nl> - w_pending_coll_add ( & coll , item . path , item . now , item . flags ) ; <nl> + coll . add ( item . path , item . now , item . flags ) ; <nl> } <nl> drained = process_items ( & coll ) ; <nl> <nl> static void bench_pending ( void ) { <nl> gettimeofday ( & start , NULL ) ; <nl> for ( auto it = list . rbegin ( ) ; it ! = list . rend ( ) ; + + it ) { <nl> auto & item = * it ; <nl> - w_pending_coll_add ( & coll , item . path , item . now , item . flags ) ; <nl> + coll . add ( item . path , item . now , item . flags ) ; <nl> } <nl> <nl> drained = process_items ( & coll ) ; <nl> mmm a / watcher / fsevents . cpp <nl> ppp b / watcher / fsevents . cpp <nl> bool FSEventsWatcher : : consumeNotify ( <nl> kFSEventStreamEventFlagItemRenamed ) ) <nl> ? true : false ; <nl> <nl> - w_pending_coll_add ( coll , evt - > path , now , <nl> + coll - > add ( <nl> + evt - > path , <nl> + now , <nl> W_PENDING_VIA_NOTIFY | ( recurse ? W_PENDING_RECURSIVE : 0 ) ) ; <nl> <nl> w_string_delref ( evt - > path ) ; <nl> mmm a / watcher / inotify . cpp <nl> ppp b / watcher / inotify . cpp <nl> void InotifyWatcher : : process_inotify_event ( <nl> <nl> w_log ( W_LOG_DBG , " add_pending for inotify mask = % x % . * s \ n " , <nl> ine - > mask , name - > len , name - > buf ) ; <nl> - w_pending_coll_add ( coll , name , now , pending_flags ) ; <nl> + coll - > add ( name , now , pending_flags ) ; <nl> <nl> w_string_delref ( name ) ; <nl> <nl> mmm a / watcher / kqueue . cpp <nl> ppp b / watcher / kqueue . cpp <nl> bool KQueueWatcher : : consumeNotify ( <nl> } <nl> <nl> pthread_mutex_unlock ( & lock ) ; <nl> - w_pending_coll_add ( coll , path , now , <nl> - is_dir ? 0 : ( W_PENDING_RECURSIVE | W_PENDING_VIA_NOTIFY ) ) ; <nl> + coll - > add ( <nl> + path , now , is_dir ? 0 : ( W_PENDING_RECURSIVE | W_PENDING_VIA_NOTIFY ) ) ; <nl> w_string_delref ( path ) ; <nl> } <nl> <nl> mmm a / watcher / win32 . cpp <nl> ppp b / watcher / win32 . cpp <nl> bool WinWatcher : : consumeNotify ( <nl> <nl> w_log ( W_LOG_DBG , " readchanges : add pending % . * s \ n " , <nl> item - > name - > len , item - > name - > buf ) ; <nl> - w_pending_coll_add ( coll , item - > name , now , W_PENDING_VIA_NOTIFY ) ; <nl> + coll - > add ( item - > name , now , W_PENDING_VIA_NOTIFY ) ; <nl> <nl> w_string_delref ( item - > name ) ; <nl> free ( item ) ; <nl> mmm a / watchman_pending . h <nl> ppp b / watchman_pending . h <nl> <nl> / * Copyright 2012 - present Facebook , Inc . <nl> * Licensed under the Apache License , Version 2 . 0 * / <nl> # pragma once <nl> + # include < chrono > <nl> <nl> # define W_PENDING_RECURSIVE 1 <nl> # define W_PENDING_VIA_NOTIFY 2 <nl> struct watchman_pending_fs { <nl> } ; <nl> <nl> struct watchman_pending_collection { <nl> - struct watchman_pending_fs * pending ; <nl> - pthread_mutex_t lock ; <nl> - pthread_cond_t cond ; <nl> - bool pinged ; <nl> - art_tree < watchman_pending_fs * > tree ; <nl> + watchman_pending_fs * pending_ ; <nl> <nl> watchman_pending_collection ( ) ; <nl> watchman_pending_collection ( const watchman_pending_collection & ) = delete ; <nl> ~ watchman_pending_collection ( ) ; <nl> + <nl> + void drain ( ) ; <nl> + void lock ( ) ; <nl> + void unlock ( ) ; <nl> + bool add ( const w_string & path , struct timeval now , int flags ) ; <nl> + bool add ( <nl> + struct watchman_dir * dir , <nl> + const char * name , <nl> + struct timeval now , <nl> + int flags ) ; <nl> + void append ( watchman_pending_collection * src ) ; <nl> + struct watchman_pending_fs * pop ( ) ; <nl> + bool lockAndWait ( std : : chrono : : milliseconds timeoutms ) ; <nl> + void ping ( ) ; <nl> + uint32_t size ( ) const ; <nl> + <nl> + private : <nl> + pthread_mutex_t mutex_ ; <nl> + pthread_cond_t cond_ ; <nl> + bool pinged_ ; <nl> + art_tree < watchman_pending_fs * > tree_ ; <nl> + <nl> + struct iterContext { <nl> + const w_string & root ; <nl> + watchman_pending_collection & coll ; <nl> + <nl> + int operator ( ) ( <nl> + const unsigned char * key , <nl> + uint32_t key_len , <nl> + watchman_pending_fs * & p ) ; <nl> + <nl> + iterContext ( const w_string & root , watchman_pending_collection & coll ) ; <nl> + } ; <nl> + friend struct iterContext ; <nl> + <nl> + void maybePruneObsoletedChildren ( const w_string & path , int flags ) ; <nl> + inline void consolidateItem ( watchman_pending_fs * p , int flags ) ; <nl> + bool isObsoletedByContainingDir ( const w_string & path ) ; <nl> + inline void linkHead ( watchman_pending_fs * p ) ; <nl> + inline void unlinkItem ( watchman_pending_fs * p ) ; <nl> } ; <nl> <nl> - void w_pending_coll_drain ( struct watchman_pending_collection * coll ) ; <nl> - void w_pending_coll_lock ( struct watchman_pending_collection * coll ) ; <nl> - void w_pending_coll_unlock ( struct watchman_pending_collection * coll ) ; <nl> - bool w_pending_coll_add ( <nl> - struct watchman_pending_collection * coll , <nl> - const w_string & path , <nl> - struct timeval now , <nl> - int flags ) ; <nl> - bool w_pending_coll_add_rel ( struct watchman_pending_collection * coll , <nl> - struct watchman_dir * dir , const char * name , <nl> - struct timeval now , int flags ) ; <nl> - void w_pending_coll_append ( struct watchman_pending_collection * target , <nl> - struct watchman_pending_collection * src ) ; <nl> - struct watchman_pending_fs * w_pending_coll_pop ( <nl> - struct watchman_pending_collection * coll ) ; <nl> - bool w_pending_coll_lock_and_wait ( struct watchman_pending_collection * coll , <nl> - int timeoutms ) ; <nl> - void w_pending_coll_ping ( struct watchman_pending_collection * coll ) ; <nl> - uint32_t w_pending_coll_size ( struct watchman_pending_collection * coll ) ; <nl> - void w_pending_fs_free ( struct watchman_pending_fs * p ) ; <nl> + void w_pending_fs_free ( watchman_pending_fs * p ) ; <nl>
|
move pending collection functions to be methods
|
facebook/watchman
|
7009864ddaa203ae4e8099b2493bc77c05137656
|
2016-11-01T00:34:59Z
|
mmm a / . travis . yml <nl> ppp b / . travis . yml <nl> addons : <nl> - yasm <nl> <nl> before_install : <nl> - - " export TRAVIS_COMMIT_MSG = \ " $ ( git log - - format = % B - - no - merges - n 1 ) \ " " <nl> - - . travis / check . sh <nl> - export CXX = " g + + - 6 " CC = " gcc - 6 " <nl> - sudo update - alternatives - - install / usr / bin / gcc gcc / usr / bin / gcc - 6 60 - - slave / usr / bin / g + + g + + / usr / bin / g + + - 6 <nl> - sudo update - alternatives - - config gcc <nl> deleted file mode 100755 <nl> index 2aaae04719e . . 00000000000 <nl> mmm a / . travis / check . sh <nl> ppp / dev / null <nl> <nl> - # ! / bin / bash <nl> - # Checks commit message , . . . <nl> - <nl> - run ( ) { <nl> - checkCommitMessage <nl> - } <nl> - <nl> - checkCommitMessage ( ) { <nl> - info_msg " Commit message : $ { TRAVIS_COMMIT_MSG } " ; <nl> - info_msg " Is pull request : $ { TRAVIS_PULL_REQUEST } " ; <nl> - <nl> - if [ [ $ TRAVIS_PULL_REQUEST ! = " false " ] ] ; then <nl> - if [ [ $ TRAVIS_COMMIT_MSG ! = * " Signed - off - by : " * ] ] ; then <nl> - error_msg " The commit message does not contain the signature ! " <nl> - error_msg " More information : https : / / github . com / telegramdesktop / tdesktop / blob / master / . github / CONTRIBUTING . md # sign - your - work " <nl> - addMissingSignatureInfos <nl> - exit 1 <nl> - else <nl> - success_msg " Commit message contains signature " <nl> - fi <nl> - fi <nl> - } <nl> - <nl> - addMissingSignatureInfos ( ) { <nl> - if [ [ $ BUILD_VERSION = = " " ] ] ; then <nl> - local TEXT = " Hi , \ n \ <nl> - thanks for the pull request ! \ n \ <nl> - \ n \ <nl> - Please read our [ contributing policy ] ( https : / / github . com / telegramdesktop / tdesktop / blob / master / . github / CONTRIBUTING . md ) . You ' ll need to make a pull request with the \ \ \ " Signed - off - by : \ \ \ " signature being the last line of your commit message , like it is described in [ sign your work ] ( https : / / github . com / telegramdesktop / tdesktop / blob / master / . github / CONTRIBUTING . md # sign - your - work ) section . That will grant your work into the public domain . \ n \ <nl> - \ n \ <nl> - ( See [ travis build ] ( https : / / travis - ci . org / telegramdesktop / tdesktop / jobs / $ { TRAVIS_JOB_ID } ) ) " <nl> - addCommentToGitHub " $ { TEXT } " <nl> - addLabelToGitHub " missing signature " <nl> - info_msg " Added missing signature info on github " <nl> - fi <nl> - } <nl> - <nl> - addCommentToGitHub ( ) { <nl> - local BODY = $ 1 <nl> - sendGitHubRequest " POST " " { \ " body \ " : \ " $ { BODY } \ " } " " repos / $ { TRAVIS_REPO_SLUG } / issues / $ { TRAVIS_PULL_REQUEST } / comments " <nl> - } <nl> - <nl> - addLabelToGitHub ( ) { <nl> - local LABEL = $ 1 <nl> - sendGitHubRequest " PATCH " " { \ " labels \ " : [ \ " $ { LABEL } \ " ] } " " repos / $ { TRAVIS_REPO_SLUG } / issues / $ { TRAVIS_PULL_REQUEST } " <nl> - } <nl> - <nl> - sendGitHubRequest ( ) { <nl> - local METHOD = $ 1 <nl> - local BODY = $ 2 <nl> - local URI = $ 3 <nl> - curl - H " Authorization : token $ { GH_AUTH_TOKEN } " - - request " $ { METHOD } " - - data " $ { BODY } " - - silent " https : / / api . github . com / $ { URI } " > / dev / null <nl> - } <nl> - <nl> - source . / . travis / common . sh <nl> - <nl> - run <nl>
|
Remove the check for " Signed - of - by " at PR
|
telegramdesktop/tdesktop
|
e83dd2037a4c6ff5fca9578c8a39059e4ca95394
|
2017-04-16T16:05:59Z
|
mmm a / modules / core / src / persistence . cpp <nl> ppp b / modules / core / src / persistence . cpp <nl> icvYMLParseValue ( CvFileStorage * fs , char * ptr , CvFileNode * node , <nl> ptr + + ; <nl> value_type | = CV_NODE_USER ; <nl> } <nl> + if ( d = = ' < ' ) / / support of full type heading from YAML 1 . 2 <nl> + { <nl> + const char * yamlTypeHeading = " < tag : yaml . org , 2002 : " ; <nl> + const size_t headingLenght = strlen ( yamlTypeHeading ) ; <nl> + <nl> + char * typeEndPtr = + + ptr ; <nl> + <nl> + do d = * + + typeEndPtr ; <nl> + while ( cv_isprint ( d ) & & d ! = ' ' & & d ! = ' > ' ) ; <nl> + <nl> + if ( d = = ' > ' & & ( size_t ) ( typeEndPtr - ptr ) > headingLenght ) <nl> + { <nl> + if ( memcmp ( ptr , yamlTypeHeading , headingLenght ) = = 0 ) <nl> + { <nl> + value_type | = CV_NODE_USER ; <nl> + * typeEndPtr = ' ' ; <nl> + ptr + = headingLenght - 1 ; <nl> + } <nl> + } <nl> + } <nl> <nl> endptr = ptr + + ; <nl> do d = * + + endptr ; <nl> mmm a / modules / core / test / test_io . cpp <nl> ppp b / modules / core / test / test_io . cpp <nl> TEST ( Core_InputOutput , filestorage_vec_vec_io ) <nl> remove ( ( fileName + formats [ i ] ) . c_str ( ) ) ; <nl> } <nl> } <nl> + <nl> + TEST ( Core_InputOutput , filestorage_yaml_advanvced_type_heading ) <nl> + { <nl> + String content = " % YAML : 1 . 0 \ n cameraMatrix : ! < tag : yaml . org , 2002 : opencv - matrix > \ n " <nl> + " rows : 1 \ n " <nl> + " cols : 1 \ n " <nl> + " dt : d \ n " <nl> + " data : [ 1 . ] " ; <nl> + <nl> + cv : : FileStorage fs ( content , cv : : FileStorage : : READ | cv : : FileStorage : : MEMORY ) ; <nl> + <nl> + cv : : Mat inputMatrix ; <nl> + cv : : Mat actualMatrix = cv : : Mat : : eye ( 1 , 1 , CV_64F ) ; <nl> + fs [ " cameraMatrix " ] > > inputMatrix ; <nl> + <nl> + ASSERT_EQ ( cv : : norm ( inputMatrix , actualMatrix , NORM_INF ) , 0 . ) ; <nl> + } <nl>
|
Add support of type headings from YAML1 . 2
|
opencv/opencv
|
896c34fab3fa49ec5d913305040b1eab15589d3a
|
2017-01-17T13:40:38Z
|
mmm a / emcc <nl> ppp b / emcc <nl> try : <nl> value = value . replace ( ' \ \ \ \ ' , ' / ' ) . replace ( ' \ \ ' , ' / ' ) # Convert backslash paths to forward slashes on Windows as well , since the JS compiler otherwise needs the backslashes escaped ( alternative is to escape all input paths passing to JS , which feels clumsier to read ) <nl> exec ( ' shared . Settings . ' + key + ' = ' + value ) <nl> <nl> - # Apply effects from settings <nl> - if bind and shared . Settings . ASM_JS : <nl> - logging . warning ( ' disabling asm . js since embind is not ready for it yet ' ) <nl> - shared . Settings . ASM_JS = 0 <nl> - <nl> fastcomp = os . environ . get ( ' EMCC_FAST_COMPILER ' ) ! = ' 0 ' <nl> <nl> if fastcomp : <nl> try : <nl> assert shared . Settings . TARGET_ASMJS_UNKNOWN_EMSCRIPTEN = = 1 , ' fastcomp requires asmjs - unknown - emscripten ' <nl> assert shared . Settings . USE_TYPED_ARRAYS = = 2 , ' fastcomp assumes ta2 ' <nl> assert not split_js_file , ' - - split - js is deprecated and not supported in fastcomp ' <nl> - assert not bind , ' embind not supported in fastcomp yet ' <nl> assert shared . Settings . MAX_SETJMPS = = 20 , ' changing MAX_SETJMPS is not supported in fastcomp yet ' <nl> assert shared . Settings . INIT_HEAP = = 0 , ' HEAP_INIT is not supported in fastcomp ( and should never be needed except for debugging ) ' <nl> assert not shared . Settings . RUNTIME_TYPE_INFO , ' RUNTIME_TYPE_INFO is not supported in fastcomp ' <nl> mmm a / src / embind / embind . js <nl> ppp b / src / embind / embind . js <nl> <nl> - / * global Module * / <nl> + / * global Module , asm * / <nl> / * global _malloc , _free , _memcpy * / <nl> / * global FUNCTION_TABLE , HEAP8 , HEAPU8 , HEAP16 , HEAPU16 , HEAP32 , HEAPU32 , HEAPF32 , HEAPF64 * / <nl> / * global readLatin1String * / <nl> function craftInvokerFunction ( humanName , argTypes , classType , cppInvokerFunc , cp <nl> <nl> var isClassMethodFunc = ( argTypes [ 1 ] ! = = null & & classType ! = = null ) ; <nl> <nl> - if ( ! isClassMethodFunc & & ! FUNCTION_TABLE [ cppTargetFunc ] ) { <nl> - throwBindingError ( ' Global function ' + humanName + ' is not defined ! ' ) ; <nl> - } <nl> - <nl> / / Free functions with signature " void function ( ) " do not need an invoker that marshalls between wire types . <nl> / / TODO : This omits argument count check - enable only at - O3 or similar . <nl> / / if ( ENABLE_UNSAFE_OPTS & & argCount = = 2 & & argTypes [ 0 ] . name = = " void " & & ! isClassMethodFunc ) { <nl> function craftInvokerFunction ( humanName , argTypes , classType , cppInvokerFunc , cp <nl> } <nl> <nl> var dtorStack = needsDestructorStack ? " destructors " : " null " ; <nl> - var args1 = [ " throwBindingError " , " classType " , " invoker " , " fn " , " runDestructors " , " retType " , " classParam " ] ; <nl> - var args2 = [ throwBindingError , classType , cppInvokerFunc , cppTargetFunc , runDestructors , argTypes [ 0 ] , argTypes [ 1 ] ] ; <nl> + var args1 = [ " throwBindingError " , " invoker " , " fn " , " runDestructors " , " retType " , " classParam " ] ; <nl> + var args2 = [ throwBindingError , cppInvokerFunc , cppTargetFunc , runDestructors , argTypes [ 0 ] , argTypes [ 1 ] ] ; <nl> <nl> if ( isClassMethodFunc ) { <nl> invokerFnBody + = " var thisWired = classParam . toWireType ( " + dtorStack + " , this ) ; \ n " ; <nl> function craftInvokerFunction ( humanName , argTypes , classType , cppInvokerFunc , cp <nl> return invokerFunction ; <nl> } <nl> <nl> - function __embind_register_function ( name , argCount , rawArgTypesAddr , rawInvoker , fn ) { <nl> + function requireFunction ( signature , rawFunction ) { <nl> + signature = readLatin1String ( signature ) ; <nl> + var fp ; <nl> + / / asm . js does not define FUNCTION_TABLE <nl> + if ( typeof FUNCTION_TABLE = = = " undefined " ) { <nl> + / / asm . js does not give direct access to the function tables , <nl> + / / and thus we must go through the dynCall interface which allows <nl> + / / calling into a signature ' s function table by pointer value . <nl> + / / <nl> + / / https : / / github . com / dherman / asm . js / issues / 83 <nl> + / / <nl> + / / This has three main penalties : <nl> + / / - dynCall is another function call in the path from JavaScript to C + + . <nl> + / / - JITs may not predict through the function table indirection at runtime . <nl> + / / - Function . prototype . bind generally benchmarks poorly relative to <nl> + / / function objects , but using ' arguments ' would confound JITs and <nl> + / / possibly allocate . <nl> + var dc = asm [ ' dynCall_ ' + signature ] ; <nl> + if ( dc = = = undefined ) { <nl> + throwBindingError ( " No dynCall invoker for signature : " + signature ) ; <nl> + } <nl> + fp = asm [ ' dynCall_ ' + signature ] . bind ( undefined , rawFunction ) ; <nl> + } else { <nl> + fp = FUNCTION_TABLE [ rawFunction ] ; <nl> + } <nl> + <nl> + if ( typeof fp ! = = " function " ) { <nl> + throwBindingError ( " unknown function pointer with signature " + signature + " : " + rawFunction ) ; <nl> + } <nl> + return fp ; <nl> + } <nl> + <nl> + function __embind_register_function ( name , argCount , rawArgTypesAddr , signature , rawInvoker , fn ) { <nl> var argTypes = heap32VectorToArray ( argCount , rawArgTypesAddr ) ; <nl> name = readLatin1String ( name ) ; <nl> - rawInvoker = FUNCTION_TABLE [ rawInvoker ] ; <nl> + <nl> + rawInvoker = requireFunction ( signature , rawInvoker ) ; <nl> <nl> exposePublicSymbol ( name , function ( ) { <nl> throwUnboundTypeError ( ' Cannot call ' + name + ' due to unbound types ' , argTypes ) ; <nl> function __embind_register_function ( name , argCount , rawArgTypesAddr , rawInvoker , <nl> <nl> var tupleRegistrations = { } ; <nl> <nl> - function __embind_register_value_array ( rawType , name , rawConstructor , rawDestructor ) { <nl> + function __embind_register_value_array ( rawType , name , constructorSignature , rawConstructor , destructorSignature , rawDestructor ) { <nl> tupleRegistrations [ rawType ] = { <nl> name : readLatin1String ( name ) , <nl> - rawConstructor : FUNCTION_TABLE [ rawConstructor ] , <nl> - rawDestructor : FUNCTION_TABLE [ rawDestructor ] , <nl> + rawConstructor : requireFunction ( constructorSignature , rawConstructor ) , <nl> + rawDestructor : requireFunction ( destructorSignature , rawDestructor ) , <nl> elements : [ ] , <nl> } ; <nl> } <nl> function __embind_register_value_array ( rawType , name , rawConstructor , rawDestruc <nl> function __embind_register_value_array_element ( <nl> rawTupleType , <nl> getterReturnType , <nl> + getterSignature , <nl> getter , <nl> getterContext , <nl> setterArgumentType , <nl> + setterSignature , <nl> setter , <nl> setterContext <nl> ) { <nl> tupleRegistrations [ rawTupleType ] . elements . push ( { <nl> getterReturnType : getterReturnType , <nl> - getter : FUNCTION_TABLE [ getter ] , <nl> + getter : requireFunction ( getterSignature , getter ) , <nl> getterContext : getterContext , <nl> setterArgumentType : setterArgumentType , <nl> - setter : FUNCTION_TABLE [ setter ] , <nl> + setter : requireFunction ( setterSignature , setter ) , <nl> setterContext : setterContext , <nl> } ) ; <nl> } <nl> var structRegistrations = { } ; <nl> function __embind_register_value_object ( <nl> rawType , <nl> name , <nl> + constructorSignature , <nl> rawConstructor , <nl> + destructorSignature , <nl> rawDestructor <nl> ) { <nl> structRegistrations [ rawType ] = { <nl> name : readLatin1String ( name ) , <nl> - rawConstructor : FUNCTION_TABLE [ rawConstructor ] , <nl> - rawDestructor : FUNCTION_TABLE [ rawDestructor ] , <nl> + rawConstructor : requireFunction ( constructorSignature , rawConstructor ) , <nl> + rawDestructor : requireFunction ( destructorSignature , rawDestructor ) , <nl> fields : [ ] , <nl> } ; <nl> } <nl> function __embind_register_value_object_field ( <nl> structType , <nl> fieldName , <nl> getterReturnType , <nl> + getterSignature , <nl> getter , <nl> getterContext , <nl> setterArgumentType , <nl> + setterSignature , <nl> setter , <nl> setterContext <nl> ) { <nl> structRegistrations [ structType ] . fields . push ( { <nl> fieldName : readLatin1String ( fieldName ) , <nl> getterReturnType : getterReturnType , <nl> - getter : FUNCTION_TABLE [ getter ] , <nl> + getter : requireFunction ( getterSignature , getter ) , <nl> getterContext : getterContext , <nl> setterArgumentType : setterArgumentType , <nl> - setter : FUNCTION_TABLE [ setter ] , <nl> + setter : requireFunction ( setterSignature , setter ) , <nl> setterContext : setterContext , <nl> } ) ; <nl> } <nl> function __embind_register_class ( <nl> rawPointerType , <nl> rawConstPointerType , <nl> baseClassRawType , <nl> + getActualTypeSignature , <nl> getActualType , <nl> + upcastSignature , <nl> upcast , <nl> + downcastSignature , <nl> downcast , <nl> name , <nl> + destructorSignature , <nl> rawDestructor <nl> ) { <nl> name = readLatin1String ( name ) ; <nl> - rawDestructor = FUNCTION_TABLE [ rawDestructor ] ; <nl> - getActualType = FUNCTION_TABLE [ getActualType ] ; <nl> - upcast = FUNCTION_TABLE [ upcast ] ; <nl> - downcast = FUNCTION_TABLE [ downcast ] ; <nl> + getActualType = requireFunction ( getActualTypeSignature , getActualType ) ; <nl> + if ( upcast ) { <nl> + upcast = requireFunction ( upcastSignature , upcast ) ; <nl> + } <nl> + if ( downcast ) { <nl> + downcast = requireFunction ( downcastSignature , downcast ) ; <nl> + } <nl> + rawDestructor = requireFunction ( destructorSignature , rawDestructor ) ; <nl> var legalFunctionName = makeLegalFunctionName ( name ) ; <nl> <nl> exposePublicSymbol ( legalFunctionName , function ( ) { <nl> function __embind_register_class_constructor ( <nl> rawClassType , <nl> argCount , <nl> rawArgTypesAddr , <nl> + invokerSignature , <nl> invoker , <nl> rawConstructor <nl> ) { <nl> var rawArgTypes = heap32VectorToArray ( argCount , rawArgTypesAddr ) ; <nl> - invoker = FUNCTION_TABLE [ invoker ] ; <nl> + invoker = requireFunction ( invokerSignature , invoker ) ; <nl> <nl> whenDependentTypesAreResolved ( [ ] , [ rawClassType ] , function ( classType ) { <nl> classType = classType [ 0 ] ; <nl> function __embind_register_class_function ( <nl> methodName , <nl> argCount , <nl> rawArgTypesAddr , / / [ ReturnType , ThisType , Args . . . ] <nl> + invokerSignature , <nl> rawInvoker , <nl> context <nl> ) { <nl> var rawArgTypes = heap32VectorToArray ( argCount , rawArgTypesAddr ) ; <nl> methodName = readLatin1String ( methodName ) ; <nl> - rawInvoker = FUNCTION_TABLE [ rawInvoker ] ; <nl> + rawInvoker = requireFunction ( invokerSignature , rawInvoker ) ; <nl> <nl> whenDependentTypesAreResolved ( [ ] , [ rawClassType ] , function ( classType ) { <nl> classType = classType [ 0 ] ; <nl> function __embind_register_class_class_function ( <nl> methodName , <nl> argCount , <nl> rawArgTypesAddr , <nl> + invokerSignature , <nl> rawInvoker , <nl> fn <nl> ) { <nl> var rawArgTypes = heap32VectorToArray ( argCount , rawArgTypesAddr ) ; <nl> methodName = readLatin1String ( methodName ) ; <nl> - rawInvoker = FUNCTION_TABLE [ rawInvoker ] ; <nl> + rawInvoker = requireFunction ( invokerSignature , rawInvoker ) ; <nl> whenDependentTypesAreResolved ( [ ] , [ rawClassType ] , function ( classType ) { <nl> classType = classType [ 0 ] ; <nl> var humanName = classType . name + ' . ' + methodName ; <nl> function __embind_register_class_property ( <nl> classType , <nl> fieldName , <nl> getterReturnType , <nl> + getterSignature , <nl> getter , <nl> getterContext , <nl> setterArgumentType , <nl> + setterSignature , <nl> setter , <nl> setterContext <nl> ) { <nl> fieldName = readLatin1String ( fieldName ) ; <nl> - getter = FUNCTION_TABLE [ getter ] ; <nl> + getter = requireFunction ( getterSignature , getter ) ; <nl> <nl> whenDependentTypesAreResolved ( [ ] , [ classType ] , function ( classType ) { <nl> classType = classType [ 0 ] ; <nl> function __embind_register_class_property ( <nl> } ; <nl> <nl> if ( setter ) { <nl> - setter = FUNCTION_TABLE [ setter ] ; <nl> + setter = requireFunction ( setterSignature , setter ) ; <nl> var setterArgumentType = types [ 1 ] ; <nl> desc . set = function ( v ) { <nl> var ptr = validateThis ( this , classType , humanName + ' setter ' ) ; <nl> function __embind_register_smart_ptr ( <nl> rawPointeeType , <nl> name , <nl> sharingPolicy , <nl> + getPointeeSignature , <nl> rawGetPointee , <nl> + constructorSignature , <nl> rawConstructor , <nl> + shareSignature , <nl> rawShare , <nl> + destructorSignature , <nl> rawDestructor <nl> ) { <nl> name = readLatin1String ( name ) ; <nl> - rawGetPointee = FUNCTION_TABLE [ rawGetPointee ] ; <nl> - rawConstructor = FUNCTION_TABLE [ rawConstructor ] ; <nl> - rawShare = FUNCTION_TABLE [ rawShare ] ; <nl> - rawDestructor = FUNCTION_TABLE [ rawDestructor ] ; <nl> + rawGetPointee = requireFunction ( getPointeeSignature , rawGetPointee ) ; <nl> + rawConstructor = requireFunction ( constructorSignature , rawConstructor ) ; <nl> + rawShare = requireFunction ( shareSignature , rawShare ) ; <nl> + rawDestructor = requireFunction ( destructorSignature , rawDestructor ) ; <nl> <nl> whenDependentTypesAreResolved ( [ rawType ] , [ rawPointeeType ] , function ( pointeeType ) { <nl> pointeeType = pointeeType [ 0 ] ; <nl> mmm a / system / include / emscripten / bind . h <nl> ppp b / system / include / emscripten / bind . h <nl> namespace emscripten { <nl> namespace internal { <nl> typedef long GenericEnumValue ; <nl> <nl> + typedef void ( * GenericFunction ) ( ) ; <nl> + <nl> / / Implemented in JavaScript . Don ' t call these directly . <nl> extern " C " { <nl> void _embind_fatal_error ( <nl> namespace emscripten { <nl> const char * name , <nl> unsigned argCount , <nl> TYPEID argTypes [ ] , <nl> + const char * signature , <nl> GenericFunction invoker , <nl> GenericFunction function ) ; <nl> <nl> void _embind_register_value_array ( <nl> TYPEID tupleType , <nl> const char * name , <nl> + const char * constructorSignature , <nl> GenericFunction constructor , <nl> + const char * destructorSignature , <nl> GenericFunction destructor ) ; <nl> <nl> void _embind_register_value_array_element ( <nl> TYPEID tupleType , <nl> TYPEID getterReturnType , <nl> + const char * getterSignature , <nl> GenericFunction getter , <nl> void * getterContext , <nl> TYPEID setterArgumentType , <nl> + const char * setterSignature , <nl> GenericFunction setter , <nl> void * setterContext ) ; <nl> <nl> namespace emscripten { <nl> void _embind_register_value_object ( <nl> TYPEID structType , <nl> const char * fieldName , <nl> + const char * constructorSignature , <nl> GenericFunction constructor , <nl> + const char * destructorSignature , <nl> GenericFunction destructor ) ; <nl> <nl> void _embind_register_value_object_field ( <nl> TYPEID structType , <nl> const char * fieldName , <nl> TYPEID getterReturnType , <nl> + const char * getterSignature , <nl> GenericFunction getter , <nl> void * getterContext , <nl> TYPEID setterArgumentType , <nl> + const char * setterSignature , <nl> GenericFunction setter , <nl> void * setterContext ) ; <nl> <nl> void _embind_finalize_value_object ( TYPEID structType ) ; <nl> <nl> - void _embind_register_smart_ptr ( <nl> - TYPEID pointerType , <nl> - TYPEID pointeeType , <nl> - const char * pointerName , <nl> - sharing_policy sharingPolicy , <nl> - GenericFunction getPointee , <nl> - GenericFunction constructor , <nl> - GenericFunction share , <nl> - GenericFunction destructor ) ; <nl> - <nl> void _embind_register_class ( <nl> TYPEID classType , <nl> TYPEID pointerType , <nl> TYPEID constPointerType , <nl> TYPEID baseClassType , <nl> + const char * getActualTypeSignature , <nl> GenericFunction getActualType , <nl> + const char * upcastSignature , <nl> GenericFunction upcast , <nl> + const char * downcastSignature , <nl> GenericFunction downcast , <nl> const char * className , <nl> + const char * destructorSignature , <nl> GenericFunction destructor ) ; <nl> <nl> void _embind_register_class_constructor ( <nl> TYPEID classType , <nl> unsigned argCount , <nl> TYPEID argTypes [ ] , <nl> + const char * invokerSignature , <nl> GenericFunction invoker , <nl> GenericFunction constructor ) ; <nl> <nl> namespace emscripten { <nl> const char * methodName , <nl> unsigned argCount , <nl> TYPEID argTypes [ ] , <nl> + const char * invokerSignature , <nl> GenericFunction invoker , <nl> void * context ) ; <nl> <nl> namespace emscripten { <nl> TYPEID classType , <nl> const char * fieldName , <nl> TYPEID getterReturnType , <nl> + const char * getterSignature , <nl> GenericFunction getter , <nl> void * getterContext , <nl> TYPEID setterArgumentType , <nl> + const char * setterSignature , <nl> GenericFunction setter , <nl> void * setterContext ) ; <nl> <nl> namespace emscripten { <nl> const char * methodName , <nl> unsigned argCount , <nl> TYPEID argTypes [ ] , <nl> + const char * invokerSignature , <nl> GenericFunction invoker , <nl> GenericFunction method ) ; <nl> <nl> namespace emscripten { <nl> size_t size , <nl> bool isSigned ) ; <nl> <nl> + void _embind_register_smart_ptr ( <nl> + TYPEID pointerType , <nl> + TYPEID pointeeType , <nl> + const char * pointerName , <nl> + sharing_policy sharingPolicy , <nl> + const char * getPointeeSignature , <nl> + GenericFunction getPointee , <nl> + const char * constructorSignature , <nl> + GenericFunction constructor , <nl> + const char * shareSignature , <nl> + GenericFunction share , <nl> + const char * destructorSignature , <nl> + GenericFunction destructor ) ; <nl> + <nl> void _embind_register_enum_value ( <nl> TYPEID enumType , <nl> const char * valueName , <nl> GenericEnumValue value ) ; <nl> <nl> - void _embind_register_interface ( <nl> - TYPEID interfaceType , <nl> - const char * name , <nl> - GenericFunction constructor , <nl> - GenericFunction destructor ) ; <nl> - <nl> void _embind_register_constant ( <nl> const char * name , <nl> TYPEID constantType , <nl> namespace emscripten { <nl> } ; <nl> } <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / SignatureCode , SignatureString <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + namespace internal { <nl> + template < typename T > <nl> + struct SignatureCode { <nl> + static constexpr char get ( ) { <nl> + return ' i ' ; <nl> + } <nl> + } ; <nl> + <nl> + template < > <nl> + struct SignatureCode < void > { <nl> + static constexpr char get ( ) { <nl> + return ' v ' ; <nl> + } <nl> + } ; <nl> + <nl> + template < > <nl> + struct SignatureCode < float > { <nl> + static constexpr char get ( ) { <nl> + return ' d ' ; <nl> + } <nl> + } ; <nl> + <nl> + template < > <nl> + struct SignatureCode < double > { <nl> + static constexpr char get ( ) { <nl> + return ' d ' ; <nl> + } <nl> + } ; <nl> + <nl> + template < typename . . . T > <nl> + struct SignatureString ; <nl> + <nl> + template < > <nl> + struct SignatureString < > { <nl> + char c = 0 ; <nl> + } ; <nl> + <nl> + template < typename First , typename . . . Rest > <nl> + struct SignatureString < First , Rest . . . > { <nl> + constexpr SignatureString ( ) <nl> + : c ( SignatureCode < First > : : get ( ) ) <nl> + { } <nl> + char c ; <nl> + SignatureString < Rest . . . > rest ; <nl> + } ; <nl> + <nl> + template < typename Return , typename . . . Args > <nl> + const char * getSignature ( Return ( * ) ( Args . . . ) ) { <nl> + static constexpr SignatureString < Return , Args . . . > sig ; <nl> + return & sig . c ; <nl> + } <nl> + } <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / FUNCTIONS <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> namespace emscripten { <nl> void function ( const char * name , ReturnType ( * fn ) ( Args . . . ) , Policies . . . ) { <nl> using namespace internal ; <nl> typename WithPolicies < Policies . . . > : : template ArgTypeList < ReturnType , Args . . . > args ; <nl> + auto invoker = & Invoker < ReturnType , Args . . . > : : invoke ; <nl> _embind_register_function ( <nl> name , <nl> args . count , <nl> args . types , <nl> - reinterpret_cast < GenericFunction > ( & Invoker < ReturnType , Args . . . > : : invoke ) , <nl> + getSignature ( invoker ) , <nl> + reinterpret_cast < GenericFunction > ( invoker ) , <nl> reinterpret_cast < GenericFunction > ( fn ) ) ; <nl> } <nl> <nl> namespace emscripten { <nl> <nl> value_array ( const char * name ) { <nl> using namespace internal ; <nl> + <nl> + auto constructor = & raw_constructor < ClassType > ; <nl> + auto destructor = & raw_destructor < ClassType > ; <nl> _embind_register_value_array ( <nl> TypeID < ClassType > : : get ( ) , <nl> name , <nl> - reinterpret_cast < GenericFunction > ( & raw_constructor < ClassType > ) , <nl> - reinterpret_cast < GenericFunction > ( & raw_destructor < ClassType > ) ) ; <nl> + getSignature ( constructor ) , <nl> + reinterpret_cast < GenericFunction > ( constructor ) , <nl> + getSignature ( destructor ) , <nl> + reinterpret_cast < GenericFunction > ( destructor ) ) ; <nl> } <nl> <nl> ~ value_array ( ) { <nl> namespace emscripten { <nl> template < typename InstanceType , typename ElementType > <nl> value_array & element ( ElementType InstanceType : : * field ) { <nl> using namespace internal ; <nl> + <nl> + auto getter = & MemberAccess < InstanceType , ElementType > <nl> + : : template getWire < ClassType > ; <nl> + auto setter = & MemberAccess < InstanceType , ElementType > <nl> + : : template setWire < ClassType > ; <nl> + <nl> _embind_register_value_array_element ( <nl> TypeID < ClassType > : : get ( ) , <nl> TypeID < ElementType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( <nl> - & MemberAccess < InstanceType , ElementType > <nl> - : : template getWire < ClassType > ) , <nl> + getSignature ( getter ) , <nl> + reinterpret_cast < GenericFunction > ( getter ) , <nl> getContext ( field ) , <nl> TypeID < ElementType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( <nl> - & MemberAccess < InstanceType , ElementType > <nl> - : : template setWire < ClassType > ) , <nl> + getSignature ( setter ) , <nl> + reinterpret_cast < GenericFunction > ( setter ) , <nl> getContext ( field ) ) ; <nl> return * this ; <nl> } <nl> namespace emscripten { <nl> using namespace internal ; <nl> typedef GetterPolicy < Getter > GP ; <nl> typedef SetterPolicy < Setter > SP ; <nl> + <nl> + auto g = & GP : : template get < ClassType > ; <nl> + auto s = & SP : : template set < ClassType > ; <nl> + <nl> _embind_register_value_array_element ( <nl> TypeID < ClassType > : : get ( ) , <nl> TypeID < typename GP : : ReturnType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( & GP : : template get < ClassType > ) , <nl> + getSignature ( g ) , <nl> + reinterpret_cast < GenericFunction > ( g ) , <nl> GP : : getContext ( getter ) , <nl> TypeID < typename SP : : ArgumentType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( & SP : : template set < ClassType > ) , <nl> + getSignature ( s ) , <nl> + reinterpret_cast < GenericFunction > ( s ) , <nl> SP : : getContext ( setter ) ) ; <nl> return * this ; <nl> } <nl> namespace emscripten { <nl> using namespace internal ; <nl> ClassType * null = 0 ; <nl> typedef typename std : : remove_reference < decltype ( ( * null ) [ Index ] ) > : : type ElementType ; <nl> + auto getter = & internal : : get_by_index < ClassType , ElementType > ; <nl> + auto setter = & internal : : set_by_index < ClassType , ElementType > ; <nl> + <nl> _embind_register_value_array_element ( <nl> TypeID < ClassType > : : get ( ) , <nl> TypeID < ElementType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( & internal : : get_by_index < ClassType , ElementType > ) , <nl> + getSignature ( getter ) , <nl> + reinterpret_cast < GenericFunction > ( getter ) , <nl> reinterpret_cast < void * > ( Index ) , <nl> TypeID < ElementType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( & internal : : set_by_index < ClassType , ElementType > ) , <nl> + getSignature ( setter ) , <nl> + reinterpret_cast < GenericFunction > ( setter ) , <nl> reinterpret_cast < void * > ( Index ) ) ; <nl> return * this ; <nl> } <nl> namespace emscripten { <nl> <nl> value_object ( const char * name ) { <nl> using namespace internal ; <nl> + <nl> + auto ctor = & raw_constructor < ClassType > ; <nl> + auto dtor = & raw_destructor < ClassType > ; <nl> + <nl> _embind_register_value_object ( <nl> TypeID < ClassType > : : get ( ) , <nl> name , <nl> - reinterpret_cast < GenericFunction > ( & raw_constructor < ClassType > ) , <nl> - reinterpret_cast < GenericFunction > ( & raw_destructor < ClassType > ) ) ; <nl> + getSignature ( ctor ) , <nl> + reinterpret_cast < GenericFunction > ( ctor ) , <nl> + getSignature ( dtor ) , <nl> + reinterpret_cast < GenericFunction > ( dtor ) ) ; <nl> } <nl> <nl> ~ value_object ( ) { <nl> namespace emscripten { <nl> template < typename InstanceType , typename FieldType > <nl> value_object & field ( const char * fieldName , FieldType InstanceType : : * field ) { <nl> using namespace internal ; <nl> + <nl> + auto getter = & MemberAccess < InstanceType , FieldType > <nl> + : : template getWire < ClassType > ; <nl> + auto setter = & MemberAccess < InstanceType , FieldType > <nl> + : : template setWire < ClassType > ; <nl> + <nl> _embind_register_value_object_field ( <nl> TypeID < ClassType > : : get ( ) , <nl> fieldName , <nl> TypeID < FieldType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( <nl> - & MemberAccess < InstanceType , FieldType > <nl> - : : template getWire < ClassType > ) , <nl> + getSignature ( getter ) , <nl> + reinterpret_cast < GenericFunction > ( getter ) , <nl> getContext ( field ) , <nl> TypeID < FieldType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( <nl> - & MemberAccess < InstanceType , FieldType > <nl> - : : template setWire < ClassType > ) , <nl> + getSignature ( setter ) , <nl> + reinterpret_cast < GenericFunction > ( setter ) , <nl> getContext ( field ) ) ; <nl> return * this ; <nl> } <nl> namespace emscripten { <nl> using namespace internal ; <nl> typedef GetterPolicy < Getter > GP ; <nl> typedef SetterPolicy < Setter > SP ; <nl> + <nl> + auto g = & GP : : template get < ClassType > ; <nl> + auto s = & SP : : template set < ClassType > ; <nl> + <nl> _embind_register_value_object_field ( <nl> TypeID < ClassType > : : get ( ) , <nl> fieldName , <nl> TypeID < typename GP : : ReturnType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( & GP : : template get < ClassType > ) , <nl> + getSignature ( g ) , <nl> + reinterpret_cast < GenericFunction > ( g ) , <nl> GP : : getContext ( getter ) , <nl> TypeID < typename SP : : ArgumentType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( & SP : : template set < ClassType > ) , <nl> + getSignature ( s ) , <nl> + reinterpret_cast < GenericFunction > ( s ) , <nl> SP : : getContext ( setter ) ) ; <nl> return * this ; <nl> } <nl> namespace emscripten { <nl> using namespace internal ; <nl> ClassType * null = 0 ; <nl> typedef typename std : : remove_reference < decltype ( ( * null ) [ Index ] ) > : : type ElementType ; <nl> + <nl> + auto getter = & internal : : get_by_index < ClassType , ElementType > ; <nl> + auto setter = & internal : : set_by_index < ClassType , ElementType > ; <nl> + <nl> _embind_register_value_object_field ( <nl> TypeID < ClassType > : : get ( ) , <nl> fieldName , <nl> TypeID < ElementType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( & internal : : get_by_index < ClassType , ElementType > ) , <nl> + getSignature ( getter ) , <nl> + reinterpret_cast < GenericFunction > ( getter ) , <nl> reinterpret_cast < void * > ( Index ) , <nl> TypeID < ElementType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( & internal : : set_by_index < ClassType , ElementType > ) , <nl> + getSignature ( setter ) , <nl> + reinterpret_cast < GenericFunction > ( setter ) , <nl> reinterpret_cast < void * > ( Index ) ) ; <nl> return * this ; <nl> } <nl> namespace emscripten { <nl> } <nl> <nl> template < typename ClassType > <nl> - static internal : : GenericFunction getUpcaster ( ) { <nl> - return reinterpret_cast < internal : : GenericFunction > ( & convertPointer < ClassType , BaseClass > ) ; <nl> + using Upcaster = BaseClass * ( * ) ( ClassType * ) ; <nl> + <nl> + template < typename ClassType > <nl> + using Downcaster = ClassType * ( * ) ( BaseClass * ) ; <nl> + <nl> + template < typename ClassType > <nl> + static Upcaster < ClassType > getUpcaster ( ) { <nl> + return & convertPointer < ClassType , BaseClass > ; <nl> } <nl> <nl> template < typename ClassType > <nl> - static internal : : GenericFunction getDowncaster ( ) { <nl> - return reinterpret_cast < internal : : GenericFunction > ( & convertPointer < BaseClass , ClassType > ) ; <nl> + static Downcaster < ClassType > getDowncaster ( ) { <nl> + return & convertPointer < BaseClass , ClassType > ; <nl> } <nl> <nl> template < typename From , typename To > <nl> namespace emscripten { <nl> <nl> BaseSpecifier : : template verify < ClassType > ( ) ; <nl> <nl> + auto _getActualType = & getActualType < ClassType > ; <nl> + auto upcast = BaseSpecifier : : template getUpcaster < ClassType > ( ) ; <nl> + auto downcast = BaseSpecifier : : template getDowncaster < ClassType > ( ) ; <nl> + auto destructor = & raw_destructor < ClassType > ; <nl> + <nl> _embind_register_class ( <nl> TypeID < ClassType > : : get ( ) , <nl> TypeID < AllowedRawPointer < ClassType > > : : get ( ) , <nl> TypeID < AllowedRawPointer < const ClassType > > : : get ( ) , <nl> BaseSpecifier : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( & getActualType < ClassType > ) , <nl> - BaseSpecifier : : template getUpcaster < ClassType > ( ) , <nl> - BaseSpecifier : : template getDowncaster < ClassType > ( ) , <nl> + getSignature ( _getActualType ) , <nl> + reinterpret_cast < GenericFunction > ( _getActualType ) , <nl> + getSignature ( upcast ) , <nl> + reinterpret_cast < GenericFunction > ( upcast ) , <nl> + getSignature ( downcast ) , <nl> + reinterpret_cast < GenericFunction > ( downcast ) , <nl> name , <nl> - reinterpret_cast < GenericFunction > ( & raw_destructor < ClassType > ) ) ; <nl> + getSignature ( destructor ) , <nl> + reinterpret_cast < GenericFunction > ( destructor ) ) ; <nl> } <nl> <nl> template < typename PointerType > <nl> namespace emscripten { <nl> <nl> static_assert ( std : : is_same < ClassType , typename std : : remove_cv < PointeeType > : : type > : : value , " smart pointer must point to this class " ) ; <nl> <nl> + auto get = & PointerTrait : : get ; <nl> + auto construct_null = & PointerTrait : : construct_null ; <nl> + auto share = & PointerTrait : : share ; <nl> + auto destructor = & raw_destructor < PointerType > ; <nl> + <nl> _embind_register_smart_ptr ( <nl> TypeID < PointerType > : : get ( ) , <nl> TypeID < PointeeType > : : get ( ) , <nl> name , <nl> PointerTrait : : get_sharing_policy ( ) , <nl> - reinterpret_cast < GenericFunction > ( & PointerTrait : : get ) , <nl> - reinterpret_cast < GenericFunction > ( & PointerTrait : : construct_null ) , <nl> - reinterpret_cast < GenericFunction > ( & PointerTrait : : share ) , <nl> - reinterpret_cast < GenericFunction > ( & raw_destructor < PointerType > ) ) ; <nl> + getSignature ( get ) , <nl> + reinterpret_cast < GenericFunction > ( get ) , <nl> + getSignature ( construct_null ) , <nl> + reinterpret_cast < GenericFunction > ( construct_null ) , <nl> + getSignature ( share ) , <nl> + reinterpret_cast < GenericFunction > ( share ) , <nl> + getSignature ( destructor ) , <nl> + reinterpret_cast < GenericFunction > ( destructor ) ) ; <nl> return * this ; <nl> } ; <nl> <nl> namespace emscripten { <nl> <nl> / / TODO : allows all raw pointers . . . policies need a rethink <nl> typename WithPolicies < allow_raw_pointers , Policies . . . > : : template ArgTypeList < ReturnType , Args . . . > args ; <nl> + auto invoke = & Invoker < ReturnType , Args . . . > : : invoke ; <nl> _embind_register_class_constructor ( <nl> TypeID < ClassType > : : get ( ) , <nl> args . count , <nl> args . types , <nl> - reinterpret_cast < GenericFunction > ( & Invoker < ReturnType , Args . . . > : : invoke ) , <nl> + getSignature ( invoke ) , <nl> + reinterpret_cast < GenericFunction > ( invoke ) , <nl> reinterpret_cast < GenericFunction > ( factory ) ) ; <nl> return * this ; <nl> } <nl> namespace emscripten { <nl> smart_ptr < SmartPtr > ( smartPtrName ) ; <nl> <nl> typename WithPolicies < Policies . . . > : : template ArgTypeList < SmartPtr , Args . . . > args ; <nl> + auto invoke = & Invoker < SmartPtr , Args . . . > : : invoke ; <nl> _embind_register_class_constructor ( <nl> TypeID < ClassType > : : get ( ) , <nl> args . count , <nl> args . types , <nl> - reinterpret_cast < GenericFunction > ( & Invoker < SmartPtr , Args . . . > : : invoke ) , <nl> + getSignature ( invoke ) , <nl> + reinterpret_cast < GenericFunction > ( invoke ) , <nl> reinterpret_cast < GenericFunction > ( factory ) ) ; <nl> return * this ; <nl> } <nl> namespace emscripten { <nl> EMSCRIPTEN_ALWAYS_INLINE const class_ & function ( const char * methodName , ReturnType ( ClassType : : * memberFunction ) ( Args . . . ) , Policies . . . ) const { <nl> using namespace internal ; <nl> <nl> + auto invoker = & MethodInvoker < decltype ( memberFunction ) , ReturnType , ClassType * , Args . . . > : : invoke ; <nl> + <nl> typename WithPolicies < Policies . . . > : : template ArgTypeList < ReturnType , AllowedRawPointer < ClassType > , Args . . . > args ; <nl> _embind_register_class_function ( <nl> TypeID < ClassType > : : get ( ) , <nl> methodName , <nl> args . count , <nl> args . types , <nl> - reinterpret_cast < GenericFunction > ( & MethodInvoker < decltype ( memberFunction ) , ReturnType , ClassType * , Args . . . > : : invoke ) , <nl> + getSignature ( invoker ) , <nl> + reinterpret_cast < GenericFunction > ( invoker ) , <nl> getContext ( memberFunction ) ) ; <nl> return * this ; <nl> } <nl> namespace emscripten { <nl> EMSCRIPTEN_ALWAYS_INLINE const class_ & function ( const char * methodName , ReturnType ( ClassType : : * memberFunction ) ( Args . . . ) const , Policies . . . ) const { <nl> using namespace internal ; <nl> <nl> + auto invoker = & MethodInvoker < decltype ( memberFunction ) , ReturnType , const ClassType * , Args . . . > : : invoke ; <nl> + <nl> typename WithPolicies < Policies . . . > : : template ArgTypeList < ReturnType , AllowedRawPointer < const ClassType > , Args . . . > args ; <nl> _embind_register_class_function ( <nl> TypeID < ClassType > : : get ( ) , <nl> methodName , <nl> args . count , <nl> args . types , <nl> - reinterpret_cast < GenericFunction > ( & MethodInvoker < decltype ( memberFunction ) , ReturnType , const ClassType * , Args . . . > : : invoke ) , <nl> + getSignature ( invoker ) , <nl> + reinterpret_cast < GenericFunction > ( invoker ) , <nl> getContext ( memberFunction ) ) ; <nl> return * this ; <nl> } <nl> namespace emscripten { <nl> using namespace internal ; <nl> <nl> typename WithPolicies < Policies . . . > : : template ArgTypeList < ReturnType , ThisType , Args . . . > args ; <nl> + auto invoke = & FunctionInvoker < decltype ( function ) , ReturnType , ThisType , Args . . . > : : invoke ; <nl> _embind_register_class_function ( <nl> TypeID < ClassType > : : get ( ) , <nl> methodName , <nl> args . count , <nl> args . types , <nl> - reinterpret_cast < GenericFunction > ( & FunctionInvoker < decltype ( function ) , ReturnType , ThisType , Args . . . > : : invoke ) , <nl> + getSignature ( invoke ) , <nl> + reinterpret_cast < GenericFunction > ( invoke ) , <nl> getContext ( function ) ) ; <nl> return * this ; <nl> } <nl> namespace emscripten { <nl> template < typename FieldType , typename = typename std : : enable_if < ! std : : is_function < FieldType > : : value > : : type > <nl> EMSCRIPTEN_ALWAYS_INLINE const class_ & property ( const char * fieldName , const FieldType ClassType : : * field ) const { <nl> using namespace internal ; <nl> - <nl> + <nl> + auto getter = & MemberAccess < ClassType , FieldType > : : template getWire < ClassType > ; <nl> _embind_register_class_property ( <nl> TypeID < ClassType > : : get ( ) , <nl> fieldName , <nl> TypeID < FieldType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( & MemberAccess < ClassType , FieldType > : : template getWire < ClassType > ) , <nl> + getSignature ( getter ) , <nl> + reinterpret_cast < GenericFunction > ( getter ) , <nl> getContext ( field ) , <nl> 0 , <nl> 0 , <nl> + 0 , <nl> 0 ) ; <nl> return * this ; <nl> } <nl> namespace emscripten { <nl> EMSCRIPTEN_ALWAYS_INLINE const class_ & property ( const char * fieldName , FieldType ClassType : : * field ) const { <nl> using namespace internal ; <nl> <nl> + auto getter = & MemberAccess < ClassType , FieldType > : : template getWire < ClassType > ; <nl> + auto setter = & MemberAccess < ClassType , FieldType > : : template setWire < ClassType > ; <nl> _embind_register_class_property ( <nl> TypeID < ClassType > : : get ( ) , <nl> fieldName , <nl> TypeID < FieldType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( & MemberAccess < ClassType , FieldType > : : template getWire < ClassType > ) , <nl> + getSignature ( getter ) , <nl> + reinterpret_cast < GenericFunction > ( getter ) , <nl> getContext ( field ) , <nl> TypeID < FieldType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( & MemberAccess < ClassType , FieldType > : : template setWire < ClassType > ) , <nl> + getSignature ( setter ) , <nl> + reinterpret_cast < GenericFunction > ( setter ) , <nl> getContext ( field ) ) ; <nl> return * this ; <nl> } <nl> namespace emscripten { <nl> EMSCRIPTEN_ALWAYS_INLINE const class_ & property ( const char * fieldName , Getter getter ) const { <nl> using namespace internal ; <nl> typedef GetterPolicy < Getter > GP ; <nl> + auto gter = & GP : : template get < ClassType > ; <nl> _embind_register_class_property ( <nl> TypeID < ClassType > : : get ( ) , <nl> fieldName , <nl> TypeID < typename GP : : ReturnType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( & GP : : template get < ClassType > ) , <nl> + getSignature ( gter ) , <nl> + reinterpret_cast < GenericFunction > ( gter ) , <nl> GP : : getContext ( getter ) , <nl> 0 , <nl> 0 , <nl> + 0 , <nl> 0 ) ; <nl> return * this ; <nl> } <nl> namespace emscripten { <nl> using namespace internal ; <nl> typedef GetterPolicy < Getter > GP ; <nl> typedef SetterPolicy < Setter > SP ; <nl> + <nl> + auto gter = & GP : : template get < ClassType > ; <nl> + auto ster = & SP : : template set < ClassType > ; <nl> + <nl> _embind_register_class_property ( <nl> TypeID < ClassType > : : get ( ) , <nl> fieldName , <nl> TypeID < typename GP : : ReturnType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( & GP : : template get < ClassType > ) , <nl> + getSignature ( gter ) , <nl> + reinterpret_cast < GenericFunction > ( gter ) , <nl> GP : : getContext ( getter ) , <nl> TypeID < typename SP : : ArgumentType > : : get ( ) , <nl> - reinterpret_cast < GenericFunction > ( & SP : : template set < ClassType > ) , <nl> + getSignature ( ster ) , <nl> + reinterpret_cast < GenericFunction > ( ster ) , <nl> SP : : getContext ( setter ) ) ; <nl> return * this ; <nl> } <nl> namespace emscripten { <nl> using namespace internal ; <nl> <nl> typename WithPolicies < Policies . . . > : : template ArgTypeList < ReturnType , Args . . . > args ; <nl> + auto invoke = & internal : : Invoker < ReturnType , Args . . . > : : invoke ; <nl> _embind_register_class_class_function ( <nl> TypeID < ClassType > : : get ( ) , <nl> methodName , <nl> args . count , <nl> args . types , <nl> - reinterpret_cast < internal : : GenericFunction > ( & internal : : Invoker < ReturnType , Args . . . > : : invoke ) , <nl> + getSignature ( invoke ) , <nl> + reinterpret_cast < internal : : GenericFunction > ( invoke ) , <nl> reinterpret_cast < GenericFunction > ( classMethod ) ) ; <nl> return * this ; <nl> } <nl> mmm a / tests / test_core . py <nl> ppp b / tests / test_core . py <nl> def test_demangle_stacks ( self ) : <nl> <nl> def test_embind ( self ) : <nl> if self . emcc_args is None : return self . skip ( ' requires emcc ' ) <nl> - if os . environ . get ( ' EMCC_FAST_COMPILER ' ) ! = ' 0 ' : return self . skip ( ' todo in fastcomp ' ) <nl> Building . COMPILER_TEST_OPTS + = [ ' - - bind ' ] <nl> <nl> src = r ' ' ' <nl> def test_embind ( self ) : <nl> <nl> def test_embind_2 ( self ) : <nl> if self . emcc_args is None : return self . skip ( ' requires emcc ' ) <nl> - if os . environ . get ( ' EMCC_FAST_COMPILER ' ) ! = ' 0 ' : return self . skip ( ' todo in fastcomp ' ) <nl> + if self . run_name = = ' asm2f ' : return self . skip ( ' embind / asm . js not compatible with PRECISE_F32 because it changes signature strings ' ) <nl> + if self . run_name = = ' slow2asm ' : return self . skip ( ' embind / asm . js requires fastcomp ' ) <nl> Building . COMPILER_TEST_OPTS + = [ ' - - bind ' , ' - - post - js ' , ' post . js ' ] <nl> open ( ' post . js ' , ' w ' ) . write ( ' ' ' <nl> Module . print ( ' lerp ' + Module . lerp ( 1 , 2 , 0 . 66 ) + ' . ' ) ; <nl> mmm a / tests / test_other . py <nl> ppp b / tests / test_other . py <nl> def test_scons ( self ) : # also incidentally tests c + + 11 integration in llvm 3 . 1 <nl> <nl> def test_embind ( self ) : <nl> def nonfc ( ) : <nl> - if os . environ . get ( ' EMCC_FAST_COMPILER ' ) ! = ' 0 ' : return self . skip ( ' todo in fastcomp ' ) <nl> for args , fail in [ <nl> ( [ ] , True ) , # without - - bind , we fail <nl> ( [ ' - - bind ' ] , False ) , <nl>
|
Merge pull request from chadaustin / embind - fastcomp - asm . js
|
emscripten-core/emscripten
|
5940f5fc55f36e55466716514945cb6ac54c4634
|
2014-04-25T22:47:50Z
|
mmm a / ports / gdal / CONTROL <nl> ppp b / ports / gdal / CONTROL <nl> Build - Depends : proj , libpng , geos , sqlite3 , curl , expat , libpq , openjpeg , libweb <nl> Feature : mysql - libmariadb <nl> Build - Depends : libmariadb <nl> Description : Add mysql support using libmariadb <nl> + <nl> + Feature : libspatialite <nl> + Build - Depends : libspatialite <nl> + Description : Create or update SpatiaLite databases using libspatialite <nl> mmm a / ports / gdal / portfile . cmake <nl> ppp b / ports / gdal / portfile . cmake <nl> if ( " mysql - libmysql " IN_LIST FEATURES OR " mysql - libmariadb " IN_LIST FEATURES ) <nl> list ( APPEND NMAKE_OPTIONS_DBG MYSQL_LIB = $ { MYSQL_LIBRARY_DBG } ) <nl> endif ( ) <nl> <nl> + if ( " libspatialite " IN_LIST FEATURES ) <nl> + # Setup spatialite libraries + include path <nl> + file ( TO_NATIVE_PATH " $ { CURRENT_INSTALLED_DIR } / include / spatialite " SPATIALITE_INCLUDE_DIR ) <nl> + file ( TO_NATIVE_PATH " $ { CURRENT_INSTALLED_DIR } / lib / spatialite . lib " SPATIALITE_LIBRARY_REL ) <nl> + file ( TO_NATIVE_PATH " $ { CURRENT_INSTALLED_DIR } / debug / lib / spatialite . lib " SPATIALITE_LIBRARY_DBG ) <nl> + set ( HAVE_SPATIALITE " - DHAVE_SPATIALITE " ) <nl> + endif ( ) <nl> + <nl> list ( APPEND NMAKE_OPTIONS <nl> GDAL_HOME = $ { NATIVE_PACKAGES_DIR } <nl> DATADIR = $ { NATIVE_DATA_DIR } <nl> list ( APPEND NMAKE_OPTIONS <nl> EXPAT_DIR = $ { EXPAT_INCLUDE_DIR } <nl> EXPAT_INCLUDE = - I $ { EXPAT_INCLUDE_DIR } <nl> CURL_INC = - I $ { CURL_INCLUDE_DIR } <nl> - SQLITE_INC = - I $ { SQLITE_INCLUDE_DIR } <nl> + " SQLITE_INC = - I $ { SQLITE_INCLUDE_DIR } $ { HAVE_SPATIALITE } " <nl> PG_INC_DIR = $ { PGSQL_INCLUDE_DIR } <nl> OPENJPEG_ENABLED = YES <nl> OPENJPEG_CFLAGS = - I $ { OPENJPEG_INCLUDE_DIR } <nl> list ( APPEND NMAKE_OPTIONS_REL <nl> GEOS_LIB = $ { GEOS_LIBRARY_REL } <nl> EXPAT_LIB = $ { EXPAT_LIBRARY_REL } <nl> " CURL_LIB = $ { CURL_LIBRARY_REL } wsock32 . lib wldap32 . lib winmm . lib " <nl> - SQLITE_LIB = $ { SQLITE_LIBRARY_REL } <nl> + " SQLITE_LIB = $ { SQLITE_LIBRARY_REL } $ { SPATIALITE_LIBRARY_REL } " <nl> OPENJPEG_LIB = $ { OPENJPEG_LIBRARY_REL } <nl> WEBP_LIBS = $ { WEBP_LIBRARY_REL } <nl> LIBXML2_LIB = $ { XML2_LIBRARY_REL } <nl> list ( APPEND NMAKE_OPTIONS_DBG <nl> GEOS_LIB = $ { GEOS_LIBRARY_DBG } <nl> EXPAT_LIB = $ { EXPAT_LIBRARY_DBG } <nl> " CURL_LIB = $ { CURL_LIBRARY_DBG } wsock32 . lib wldap32 . lib winmm . lib " <nl> - SQLITE_LIB = $ { SQLITE_LIBRARY_DBG } <nl> + " SQLITE_LIB = $ { SQLITE_LIBRARY_DBG } $ { SPATIALITE_LIBRARY_DBG } " <nl> OPENJPEG_LIB = $ { OPENJPEG_LIBRARY_DBG } <nl> WEBP_LIBS = $ { WEBP_LIBRARY_DBG } <nl> LIBXML2_LIB = $ { XML2_LIBRARY_DBG } <nl>
|
[ gdal ] Add libspatialite build - dependency ( )
|
microsoft/vcpkg
|
4c7f464233fd50f7a41e4cb97d4cf311213ecc54
|
2019-05-05T01:35:25Z
|
mmm a / src / builtins / builtins - intl . cc <nl> ppp b / src / builtins / builtins - intl . cc <nl> Object * FormatNumberToParts ( Isolate * isolate , icu : : NumberFormat * fmt , <nl> } <nl> + + index ; <nl> } <nl> - JSObject : : ValidateElements ( result ) ; <nl> + JSObject : : ValidateElements ( * result ) ; <nl> <nl> return * result ; <nl> } <nl> mmm a / src / elements . cc <nl> ppp b / src / elements . cc <nl> class ElementsAccessorBase : public ElementsAccessor { <nl> <nl> static ElementsKind kind ( ) { return ElementsTraits : : Kind ; } <nl> <nl> - static void ValidateContents ( Handle < JSObject > holder , int length ) { <nl> - } <nl> + static void ValidateContents ( JSObject * holder , int length ) { } <nl> <nl> - static void ValidateImpl ( Handle < JSObject > holder ) { <nl> - Handle < FixedArrayBase > fixed_array_base ( holder - > elements ( ) ) ; <nl> + static void ValidateImpl ( JSObject * holder ) { <nl> + FixedArrayBase * fixed_array_base = holder - > elements ( ) ; <nl> if ( ! fixed_array_base - > IsHeapObject ( ) ) return ; <nl> / / Arrays that have been shifted in place can ' t be verified . <nl> if ( fixed_array_base - > IsFiller ( ) ) return ; <nl> int length = 0 ; <nl> if ( holder - > IsJSArray ( ) ) { <nl> - Object * length_obj = Handle < JSArray > : : cast ( holder ) - > length ( ) ; <nl> + Object * length_obj = JSArray : : cast ( holder ) - > length ( ) ; <nl> if ( length_obj - > IsSmi ( ) ) { <nl> length = Smi : : cast ( length_obj ) - > value ( ) ; <nl> } <nl> class ElementsAccessorBase : public ElementsAccessor { <nl> Subclass : : ValidateContents ( holder , length ) ; <nl> } <nl> <nl> - void Validate ( Handle < JSObject > holder ) final { <nl> + void Validate ( JSObject * holder ) final { <nl> DisallowHeapAllocation no_gc ; <nl> Subclass : : ValidateImpl ( holder ) ; <nl> } <nl> class ElementsAccessorBase : public ElementsAccessor { <nl> } <nl> <nl> array - > set_length ( Smi : : FromInt ( length ) ) ; <nl> - JSObject : : ValidateElements ( array ) ; <nl> + JSObject : : ValidateElements ( * array ) ; <nl> } <nl> <nl> uint32_t NumberOfElements ( JSObject * receiver ) final { <nl> class DictionaryElementsAccessor <nl> } <nl> return Just < int64_t > ( - 1 ) ; <nl> } <nl> + <nl> + static void ValidateContents ( JSObject * holder , int length ) { <nl> + DisallowHeapAllocation no_gc ; <nl> + # if DEBUG <nl> + DCHECK_EQ ( holder - > map ( ) - > elements_kind ( ) , DICTIONARY_ELEMENTS ) ; <nl> + if ( ! FLAG_enable_slow_asserts ) return ; <nl> + Isolate * isolate = holder - > GetIsolate ( ) ; <nl> + SeededNumberDictionary * dictionary = <nl> + SeededNumberDictionary : : cast ( holder - > elements ( ) ) ; <nl> + / / Validate the requires_slow_elements and max_number_key values . <nl> + int capacity = dictionary - > Capacity ( ) ; <nl> + bool requires_slow_elements = false ; <nl> + int max_key = 0 ; <nl> + for ( int i = 0 ; i < capacity ; + + i ) { <nl> + Object * k ; <nl> + if ( ! dictionary - > ToKey ( isolate , i , & k ) ) continue ; <nl> + DCHECK_LE ( 0 . 0 , k - > Number ( ) ) ; <nl> + if ( k - > Number ( ) > SeededNumberDictionary : : kRequiresSlowElementsLimit ) { <nl> + requires_slow_elements = true ; <nl> + } else { <nl> + max_key = Max ( max_key , Smi : : cast ( k ) - > value ( ) ) ; <nl> + } <nl> + } <nl> + if ( requires_slow_elements ) { <nl> + DCHECK ( dictionary - > requires_slow_elements ( ) ) ; <nl> + } else if ( ! dictionary - > requires_slow_elements ( ) ) { <nl> + DCHECK_LE ( max_key , dictionary - > max_number_key ( ) ) ; <nl> + } <nl> + # endif <nl> + } <nl> } ; <nl> <nl> <nl> class FastElementsAccessor : public ElementsAccessorBase < Subclass , KindTraits > { <nl> } <nl> } <nl> <nl> - static void ValidateContents ( Handle < JSObject > holder , int length ) { <nl> + static void ValidateContents ( JSObject * holder , int length ) { <nl> # if DEBUG <nl> Isolate * isolate = holder - > GetIsolate ( ) ; <nl> Heap * heap = isolate - > heap ( ) ; <nl> - HandleScope scope ( isolate ) ; <nl> - Handle < FixedArrayBase > elements ( holder - > elements ( ) , isolate ) ; <nl> + FixedArrayBase * elements = holder - > elements ( ) ; <nl> Map * map = elements - > map ( ) ; <nl> if ( IsSmiOrObjectElementsKind ( KindTraits : : Kind ) ) { <nl> DCHECK_NE ( map , heap - > fixed_double_array_map ( ) ) ; <nl> class FastElementsAccessor : public ElementsAccessorBase < Subclass , KindTraits > { <nl> if ( length = = 0 ) return ; / / nothing to do ! <nl> # if ENABLE_SLOW_DCHECKS <nl> DisallowHeapAllocation no_gc ; <nl> - Handle < BackingStore > backing_store = Handle < BackingStore > : : cast ( elements ) ; <nl> + BackingStore * backing_store = BackingStore : : cast ( elements ) ; <nl> if ( IsSmiElementsKind ( KindTraits : : Kind ) ) { <nl> + HandleScope scope ( isolate ) ; <nl> for ( int i = 0 ; i < length ; i + + ) { <nl> - DCHECK ( BackingStore : : get ( * backing_store , i , isolate ) - > IsSmi ( ) | | <nl> + DCHECK ( BackingStore : : get ( backing_store , i , isolate ) - > IsSmi ( ) | | <nl> ( IsHoleyElementsKind ( KindTraits : : Kind ) & & <nl> backing_store - > is_the_hole ( isolate , i ) ) ) ; <nl> } <nl> class FastSloppyArgumentsElementsAccessor <nl> object , FAST_SLOPPY_ARGUMENTS_ELEMENTS ) ; <nl> JSObject : : MigrateToMap ( object , new_map ) ; <nl> elements - > set_arguments ( FixedArray : : cast ( * arguments ) ) ; <nl> - JSObject : : ValidateElements ( object ) ; <nl> + JSObject : : ValidateElements ( * object ) ; <nl> } <nl> } ; <nl> <nl> mmm a / src / elements . h <nl> ppp b / src / elements . h <nl> class ElementsAccessor { <nl> <nl> / / Checks the elements of an object for consistency , asserting when a problem <nl> / / is found . <nl> - virtual void Validate ( Handle < JSObject > obj ) = 0 ; <nl> + virtual void Validate ( JSObject * obj ) = 0 ; <nl> <nl> / / Returns true if a holder contains an element with the specified index <nl> / / without iterating up the prototype chain . The caller can optionally pass <nl> mmm a / src / factory . cc <nl> ppp b / src / factory . cc <nl> Handle < JSArray > Factory : : NewJSArrayWithElements ( Handle < FixedArrayBase > elements , <nl> <nl> array - > set_elements ( * elements ) ; <nl> array - > set_length ( Smi : : FromInt ( length ) ) ; <nl> - JSObject : : ValidateElements ( array ) ; <nl> + JSObject : : ValidateElements ( * array ) ; <nl> return array ; <nl> } <nl> <nl> mmm a / src / objects - inl . h <nl> ppp b / src / objects - inl . h <nl> Address AllocationMemento : : GetAllocationSiteUnchecked ( ) { <nl> } <nl> <nl> void JSObject : : EnsureCanContainHeapObjectElements ( Handle < JSObject > object ) { <nl> - JSObject : : ValidateElements ( object ) ; <nl> + JSObject : : ValidateElements ( * object ) ; <nl> ElementsKind elements_kind = object - > map ( ) - > elements_kind ( ) ; <nl> if ( ! IsObjectElementsKind ( elements_kind ) ) { <nl> if ( IsHoleyElementsKind ( elements_kind ) ) { <nl> mmm a / src / objects - printer . cc <nl> ppp b / src / objects - printer . cc <nl> void PrintFixedArrayElements ( std : : ostream & os , FixedArray * array ) { <nl> } <nl> } <nl> <nl> + void PrintDictionaryElements ( std : : ostream & os , FixedArrayBase * elements ) { <nl> + / / Print some internal fields <nl> + SeededNumberDictionary * dict = SeededNumberDictionary : : cast ( elements ) ; <nl> + if ( dict - > requires_slow_elements ( ) ) { <nl> + os < < " \ n - requires_slow_elements " ; <nl> + } else { <nl> + os < < " \ n - max_number_key : " < < dict - > max_number_key ( ) ; <nl> + } <nl> + dict - > Print ( os ) ; <nl> + } <nl> + <nl> void PrintSloppyArgumentElements ( std : : ostream & os , ElementsKind kind , <nl> SloppyArgumentsElements * elements ) { <nl> Isolate * isolate = elements - > GetIsolate ( ) ; <nl> void PrintSloppyArgumentElements ( std : : ostream & os , ElementsKind kind , <nl> PrintFixedArrayElements ( os , arguments_store ) ; <nl> } else { <nl> DCHECK_EQ ( kind , SLOW_SLOPPY_ARGUMENTS_ELEMENTS ) ; <nl> - SeededNumberDictionary : : cast ( arguments_store ) - > Print ( os ) ; <nl> + PrintDictionaryElements ( os , arguments_store ) ; <nl> } <nl> os < < " \ n } " ; <nl> } <nl> void JSObject : : PrintElements ( std : : ostream & os ) { / / NOLINT <nl> <nl> case DICTIONARY_ELEMENTS : <nl> case SLOW_STRING_WRAPPER_ELEMENTS : <nl> - SeededNumberDictionary : : cast ( elements ( ) ) - > Print ( os ) ; <nl> + PrintDictionaryElements ( os , elements ( ) ) ; <nl> break ; <nl> case FAST_SLOPPY_ARGUMENTS_ELEMENTS : <nl> case SLOW_SLOPPY_ARGUMENTS_ELEMENTS : <nl> mmm a / src / objects . cc <nl> ppp b / src / objects . cc <nl> Maybe < bool > Object : : AddDataProperty ( LookupIterator * it , Handle < Object > value , <nl> <nl> Maybe < bool > result = JSObject : : AddDataElement ( receiver , it - > index ( ) , value , <nl> attributes , should_throw ) ; <nl> - JSObject : : ValidateElements ( receiver ) ; <nl> + JSObject : : ValidateElements ( * receiver ) ; <nl> return result ; <nl> } else { <nl> it - > UpdateProtector ( ) ; <nl> ElementsAccessor * JSObject : : GetElementsAccessor ( ) { <nl> return ElementsAccessor : : ForKind ( GetElementsKind ( ) ) ; <nl> } <nl> <nl> - <nl> - void JSObject : : ValidateElements ( Handle < JSObject > object ) { <nl> + void JSObject : : ValidateElements ( JSObject * object ) { <nl> # ifdef ENABLE_SLOW_DCHECKS <nl> if ( FLAG_enable_slow_asserts ) { <nl> - ElementsAccessor * accessor = object - > GetElementsAccessor ( ) ; <nl> - accessor - > Validate ( object ) ; <nl> + object - > GetElementsAccessor ( ) - > Validate ( object ) ; <nl> } <nl> # endif <nl> } <nl> template int <nl> Dictionary < SeededNumberDictionary , <nl> SeededNumberDictionaryShape > : : NumberOfEnumerableProperties ( ) ; <nl> <nl> - Handle < Object > JSObject : : PrepareSlowElementsForSort ( <nl> - Handle < JSObject > object , uint32_t limit ) { <nl> - DCHECK ( object - > HasDictionaryElements ( ) ) ; <nl> - Isolate * isolate = object - > GetIsolate ( ) ; <nl> - / / Must stay in dictionary mode , either because of requires_slow_elements , <nl> - / / or because we are not going to sort ( and therefore compact ) all of the <nl> - / / elements . <nl> - Handle < SeededNumberDictionary > dict ( object - > element_dictionary ( ) , isolate ) ; <nl> - Handle < SeededNumberDictionary > new_dict = <nl> - SeededNumberDictionary : : New ( isolate , dict - > NumberOfElements ( ) ) ; <nl> - <nl> - uint32_t pos = 0 ; <nl> - uint32_t undefs = 0 ; <nl> - int capacity = dict - > Capacity ( ) ; <nl> - Handle < Smi > bailout ( Smi : : FromInt ( - 1 ) , isolate ) ; <nl> - / / Entry to the new dictionary does not cause it to grow , as we have <nl> - / / allocated one that is large enough for all entries . <nl> - DisallowHeapAllocation no_gc ; <nl> - for ( int i = 0 ; i < capacity ; i + + ) { <nl> - Object * k ; <nl> - if ( ! dict - > ToKey ( isolate , i , & k ) ) continue ; <nl> - <nl> - DCHECK ( k - > IsNumber ( ) ) ; <nl> - DCHECK ( ! k - > IsSmi ( ) | | Smi : : cast ( k ) - > value ( ) > = 0 ) ; <nl> - DCHECK ( ! k - > IsHeapNumber ( ) | | HeapNumber : : cast ( k ) - > value ( ) > = 0 ) ; <nl> - DCHECK ( ! k - > IsHeapNumber ( ) | | HeapNumber : : cast ( k ) - > value ( ) < = kMaxUInt32 ) ; <nl> - <nl> - HandleScope scope ( isolate ) ; <nl> - Handle < Object > value ( dict - > ValueAt ( i ) , isolate ) ; <nl> - PropertyDetails details = dict - > DetailsAt ( i ) ; <nl> - if ( details . kind ( ) = = kAccessor | | details . IsReadOnly ( ) ) { <nl> - / / Bail out and do the sorting of undefineds and array holes in JS . <nl> - / / Also bail out if the element is not supposed to be moved . <nl> - return bailout ; <nl> - } <nl> - <nl> - uint32_t key = NumberToUint32 ( k ) ; <nl> - if ( key < limit ) { <nl> - if ( value - > IsUndefined ( isolate ) ) { <nl> - undefs + + ; <nl> - } else if ( pos > static_cast < uint32_t > ( Smi : : kMaxValue ) ) { <nl> - / / Adding an entry with the key beyond smi - range requires <nl> - / / allocation . Bailout . <nl> - return bailout ; <nl> - } else { <nl> - Handle < Object > result = <nl> - SeededNumberDictionary : : Add ( new_dict , pos , value , details ) ; <nl> - DCHECK ( result . is_identical_to ( new_dict ) ) ; <nl> - USE ( result ) ; <nl> - pos + + ; <nl> - } <nl> - } else if ( key > static_cast < uint32_t > ( Smi : : kMaxValue ) ) { <nl> - / / Adding an entry with the key beyond smi - range requires <nl> - / / allocation . Bailout . <nl> - return bailout ; <nl> - } else { <nl> - Handle < Object > result = <nl> - SeededNumberDictionary : : Add ( new_dict , key , value , details ) ; <nl> - DCHECK ( result . is_identical_to ( new_dict ) ) ; <nl> - USE ( result ) ; <nl> - } <nl> - } <nl> - <nl> - uint32_t result = pos ; <nl> - PropertyDetails no_details = PropertyDetails : : Empty ( ) ; <nl> - while ( undefs > 0 ) { <nl> - if ( pos > static_cast < uint32_t > ( Smi : : kMaxValue ) ) { <nl> - / / Adding an entry with the key beyond smi - range requires <nl> - / / allocation . Bailout . <nl> - return bailout ; <nl> - } <nl> - HandleScope scope ( isolate ) ; <nl> - Handle < Object > result = SeededNumberDictionary : : Add ( <nl> - new_dict , pos , isolate - > factory ( ) - > undefined_value ( ) , no_details ) ; <nl> - DCHECK ( result . is_identical_to ( new_dict ) ) ; <nl> - USE ( result ) ; <nl> - pos + + ; <nl> - undefs - - ; <nl> - } <nl> - <nl> - object - > set_elements ( * new_dict ) ; <nl> - new_dict - > UpdateMaxNumberKey ( pos - 1 , object ) ; <nl> - <nl> - AllowHeapAllocation allocate_return_value ; <nl> - return isolate - > factory ( ) - > NewNumberFromUint ( result ) ; <nl> - } <nl> - <nl> - <nl> - / / Collects all defined ( non - hole ) and non - undefined ( array ) elements at <nl> - / / the start of the elements array . <nl> - / / If the object is in dictionary mode , it is converted to fast elements <nl> - / / mode . <nl> - Handle < Object > JSObject : : PrepareElementsForSort ( Handle < JSObject > object , <nl> - uint32_t limit ) { <nl> - Isolate * isolate = object - > GetIsolate ( ) ; <nl> - if ( object - > HasSloppyArgumentsElements ( ) | | ! object - > map ( ) - > is_extensible ( ) ) { <nl> - return handle ( Smi : : FromInt ( - 1 ) , isolate ) ; <nl> - } <nl> - <nl> - if ( object - > HasStringWrapperElements ( ) ) { <nl> - int len = String : : cast ( Handle < JSValue > : : cast ( object ) - > value ( ) ) - > length ( ) ; <nl> - return handle ( Smi : : FromInt ( len ) , isolate ) ; <nl> - } <nl> - <nl> - if ( object - > HasDictionaryElements ( ) ) { <nl> - / / Convert to fast elements containing only the existing properties . <nl> - / / Ordering is irrelevant , since we are going to sort anyway . <nl> - Handle < SeededNumberDictionary > dict ( object - > element_dictionary ( ) ) ; <nl> - if ( object - > IsJSArray ( ) | | dict - > requires_slow_elements ( ) | | <nl> - dict - > max_number_key ( ) > = limit ) { <nl> - return JSObject : : PrepareSlowElementsForSort ( object , limit ) ; <nl> - } <nl> - / / Convert to fast elements . <nl> - <nl> - Handle < Map > new_map = <nl> - JSObject : : GetElementsTransitionMap ( object , HOLEY_ELEMENTS ) ; <nl> - <nl> - PretenureFlag tenure = isolate - > heap ( ) - > InNewSpace ( * object ) ? <nl> - NOT_TENURED : TENURED ; <nl> - Handle < FixedArray > fast_elements = <nl> - isolate - > factory ( ) - > NewFixedArray ( dict - > NumberOfElements ( ) , tenure ) ; <nl> - dict - > CopyValuesTo ( * fast_elements ) ; <nl> - JSObject : : ValidateElements ( object ) ; <nl> - <nl> - JSObject : : SetMapAndElements ( object , new_map , fast_elements ) ; <nl> - } else if ( object - > HasFixedTypedArrayElements ( ) ) { <nl> - / / Typed arrays cannot have holes or undefined elements . <nl> - return handle ( Smi : : FromInt ( <nl> - FixedArrayBase : : cast ( object - > elements ( ) ) - > length ( ) ) , isolate ) ; <nl> - } else if ( ! object - > HasDoubleElements ( ) ) { <nl> - EnsureWritableFastElements ( object ) ; <nl> - } <nl> - DCHECK ( object - > HasSmiOrObjectElements ( ) | | object - > HasDoubleElements ( ) ) ; <nl> - <nl> - / / Collect holes at the end , undefined before that and the rest at the <nl> - / / start , and return the number of non - hole , non - undefined values . <nl> - <nl> - Handle < FixedArrayBase > elements_base ( object - > elements ( ) ) ; <nl> - uint32_t elements_length = static_cast < uint32_t > ( elements_base - > length ( ) ) ; <nl> - if ( limit > elements_length ) { <nl> - limit = elements_length ; <nl> - } <nl> - if ( limit = = 0 ) { <nl> - return handle ( Smi : : kZero , isolate ) ; <nl> - } <nl> - <nl> - uint32_t result = 0 ; <nl> - if ( elements_base - > map ( ) = = isolate - > heap ( ) - > fixed_double_array_map ( ) ) { <nl> - FixedDoubleArray * elements = FixedDoubleArray : : cast ( * elements_base ) ; <nl> - / / Split elements into defined and the_hole , in that order . <nl> - unsigned int holes = limit ; <nl> - / / Assume most arrays contain no holes and undefined values , so minimize the <nl> - / / number of stores of non - undefined , non - the - hole values . <nl> - for ( unsigned int i = 0 ; i < holes ; i + + ) { <nl> - if ( elements - > is_the_hole ( i ) ) { <nl> - holes - - ; <nl> - } else { <nl> - continue ; <nl> - } <nl> - / / Position i needs to be filled . <nl> - while ( holes > i ) { <nl> - if ( elements - > is_the_hole ( holes ) ) { <nl> - holes - - ; <nl> - } else { <nl> - elements - > set ( i , elements - > get_scalar ( holes ) ) ; <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - result = holes ; <nl> - while ( holes < limit ) { <nl> - elements - > set_the_hole ( holes ) ; <nl> - holes + + ; <nl> - } <nl> - } else { <nl> - FixedArray * elements = FixedArray : : cast ( * elements_base ) ; <nl> - DisallowHeapAllocation no_gc ; <nl> - <nl> - / / Split elements into defined , undefined and the_hole , in that order . Only <nl> - / / count locations for undefined and the hole , and fill them afterwards . <nl> - WriteBarrierMode write_barrier = elements - > GetWriteBarrierMode ( no_gc ) ; <nl> - unsigned int undefs = limit ; <nl> - unsigned int holes = limit ; <nl> - / / Assume most arrays contain no holes and undefined values , so minimize the <nl> - / / number of stores of non - undefined , non - the - hole values . <nl> - for ( unsigned int i = 0 ; i < undefs ; i + + ) { <nl> - Object * current = elements - > get ( i ) ; <nl> - if ( current - > IsTheHole ( isolate ) ) { <nl> - holes - - ; <nl> - undefs - - ; <nl> - } else if ( current - > IsUndefined ( isolate ) ) { <nl> - undefs - - ; <nl> - } else { <nl> - continue ; <nl> - } <nl> - / / Position i needs to be filled . <nl> - while ( undefs > i ) { <nl> - current = elements - > get ( undefs ) ; <nl> - if ( current - > IsTheHole ( isolate ) ) { <nl> - holes - - ; <nl> - undefs - - ; <nl> - } else if ( current - > IsUndefined ( isolate ) ) { <nl> - undefs - - ; <nl> - } else { <nl> - elements - > set ( i , current , write_barrier ) ; <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - result = undefs ; <nl> - while ( undefs < holes ) { <nl> - elements - > set_undefined ( isolate , undefs ) ; <nl> - undefs + + ; <nl> - } <nl> - while ( holes < limit ) { <nl> - elements - > set_the_hole ( isolate , holes ) ; <nl> - holes + + ; <nl> - } <nl> - } <nl> - <nl> - return isolate - > factory ( ) - > NewNumberFromUint ( result ) ; <nl> - } <nl> - <nl> namespace { <nl> <nl> bool CanonicalNumericIndexString ( Isolate * isolate , Handle < Object > s , <nl> void SeededNumberDictionary : : CopyValuesTo ( FixedArray * elements ) { <nl> elements - > set ( pos + + , this - > ValueAt ( i ) , mode ) ; <nl> } <nl> } <nl> - DCHECK ( pos = = elements - > length ( ) ) ; <nl> + DCHECK_EQ ( pos , elements - > length ( ) ) ; <nl> } <nl> <nl> Handle < UnseededNumberDictionary > UnseededNumberDictionary : : Set ( <nl> mmm a / src / objects . h <nl> ppp b / src / objects . h <nl> class JSObject : public JSReceiver { <nl> / / Requires : HasFastElements ( ) . <nl> static void EnsureWritableFastElements ( Handle < JSObject > object ) ; <nl> <nl> - / / Collects elements starting at index 0 . <nl> - / / Undefined values are placed after non - undefined values . <nl> - / / Returns the number of non - undefined values . <nl> - static Handle < Object > PrepareElementsForSort ( Handle < JSObject > object , <nl> - uint32_t limit ) ; <nl> - / / As PrepareElementsForSort , but only on objects where elements is <nl> - / / a dictionary , and it will stay a dictionary . Collates undefined and <nl> - / / unexisting elements below limit from position zero of the elements . <nl> - static Handle < Object > PrepareSlowElementsForSort ( Handle < JSObject > object , <nl> - uint32_t limit ) ; <nl> - <nl> MUST_USE_RESULT static Maybe < bool > SetPropertyWithInterceptor ( <nl> LookupIterator * it , ShouldThrow should_throw , Handle < Object > value ) ; <nl> <nl> class JSObject : public JSReceiver { <nl> MUST_USE_RESULT static MaybeHandle < Object > GetPropertyWithInterceptor ( <nl> LookupIterator * it , bool * done ) ; <nl> <nl> - static void ValidateElements ( Handle < JSObject > object ) ; <nl> + static void ValidateElements ( JSObject * object ) ; <nl> <nl> / / Makes sure that this object can contain HeapObject as elements . <nl> static inline void EnsureCanContainHeapObjectElements ( Handle < JSObject > obj ) ; <nl> mmm a / src / runtime / runtime - array . cc <nl> ppp b / src / runtime / runtime - array . cc <nl> RUNTIME_FUNCTION ( Runtime_TransitionElementsKind ) { <nl> return * object ; <nl> } <nl> <nl> + namespace { <nl> + / / As PrepareElementsForSort , but only on objects where elements is <nl> + / / a dictionary , and it will stay a dictionary . Collates undefined and <nl> + / / unexisting elements below limit from position zero of the elements . <nl> + Handle < Object > PrepareSlowElementsForSort ( Handle < JSObject > object , <nl> + uint32_t limit ) { <nl> + DCHECK ( object - > HasDictionaryElements ( ) ) ; <nl> + Isolate * isolate = object - > GetIsolate ( ) ; <nl> + / / Must stay in dictionary mode , either because of requires_slow_elements , <nl> + / / or because we are not going to sort ( and therefore compact ) all of the <nl> + / / elements . <nl> + Handle < SeededNumberDictionary > dict ( object - > element_dictionary ( ) , isolate ) ; <nl> + Handle < SeededNumberDictionary > new_dict = <nl> + SeededNumberDictionary : : New ( isolate , dict - > NumberOfElements ( ) ) ; <nl> + <nl> + uint32_t pos = 0 ; <nl> + uint32_t undefs = 0 ; <nl> + uint32_t max_key = 0 ; <nl> + int capacity = dict - > Capacity ( ) ; <nl> + Handle < Smi > bailout ( Smi : : FromInt ( - 1 ) , isolate ) ; <nl> + / / Entry to the new dictionary does not cause it to grow , as we have <nl> + / / allocated one that is large enough for all entries . <nl> + DisallowHeapAllocation no_gc ; <nl> + for ( int i = 0 ; i < capacity ; i + + ) { <nl> + Object * k ; <nl> + if ( ! dict - > ToKey ( isolate , i , & k ) ) continue ; <nl> + <nl> + DCHECK_LE ( 0 , k - > Number ( ) ) ; <nl> + DCHECK_LE ( k - > Number ( ) , kMaxUInt32 ) ; <nl> + <nl> + HandleScope scope ( isolate ) ; <nl> + Handle < Object > value ( dict - > ValueAt ( i ) , isolate ) ; <nl> + PropertyDetails details = dict - > DetailsAt ( i ) ; <nl> + if ( details . kind ( ) = = kAccessor | | details . IsReadOnly ( ) ) { <nl> + / / Bail out and do the sorting of undefineds and array holes in JS . <nl> + / / Also bail out if the element is not supposed to be moved . <nl> + return bailout ; <nl> + } <nl> + <nl> + uint32_t key = NumberToUint32 ( k ) ; <nl> + if ( key < limit ) { <nl> + if ( value - > IsUndefined ( isolate ) ) { <nl> + undefs + + ; <nl> + } else if ( pos > static_cast < uint32_t > ( Smi : : kMaxValue ) ) { <nl> + / / Adding an entry with the key beyond smi - range requires <nl> + / / allocation . Bailout . <nl> + return bailout ; <nl> + } else { <nl> + Handle < Object > result = <nl> + SeededNumberDictionary : : Add ( new_dict , pos , value , details ) ; <nl> + DCHECK ( result . is_identical_to ( new_dict ) ) ; <nl> + USE ( result ) ; <nl> + pos + + ; <nl> + } <nl> + } else if ( key > static_cast < uint32_t > ( Smi : : kMaxValue ) ) { <nl> + / / Adding an entry with the key beyond smi - range requires <nl> + / / allocation . Bailout . <nl> + return bailout ; <nl> + } else { <nl> + Handle < Object > result = <nl> + SeededNumberDictionary : : Add ( new_dict , key , value , details ) ; <nl> + DCHECK ( result . is_identical_to ( new_dict ) ) ; <nl> + USE ( result ) ; <nl> + max_key = Max ( max_key , key ) ; <nl> + } <nl> + } <nl> + <nl> + uint32_t result = pos ; <nl> + PropertyDetails no_details = PropertyDetails : : Empty ( ) ; <nl> + while ( undefs > 0 ) { <nl> + if ( pos > static_cast < uint32_t > ( Smi : : kMaxValue ) ) { <nl> + / / Adding an entry with the key beyond smi - range requires <nl> + / / allocation . Bailout . <nl> + return bailout ; <nl> + } <nl> + HandleScope scope ( isolate ) ; <nl> + Handle < Object > result = SeededNumberDictionary : : Add ( <nl> + new_dict , pos , isolate - > factory ( ) - > undefined_value ( ) , no_details ) ; <nl> + DCHECK ( result . is_identical_to ( new_dict ) ) ; <nl> + USE ( result ) ; <nl> + pos + + ; <nl> + undefs - - ; <nl> + } <nl> + max_key = Max ( max_key , pos - 1 ) ; <nl> + <nl> + object - > set_elements ( * new_dict ) ; <nl> + new_dict - > UpdateMaxNumberKey ( max_key , object ) ; <nl> + JSObject : : ValidateElements ( * object ) ; <nl> + <nl> + AllowHeapAllocation allocate_return_value ; <nl> + return isolate - > factory ( ) - > NewNumberFromUint ( result ) ; <nl> + } <nl> + <nl> + / / Collects all defined ( non - hole ) and non - undefined ( array ) elements at the <nl> + / / start of the elements array . If the object is in dictionary mode , it is <nl> + / / converted to fast elements mode . Undefined values are placed after <nl> + / / non - undefined values . Returns the number of non - undefined values . <nl> + Handle < Object > PrepareElementsForSort ( Handle < JSObject > object , uint32_t limit ) { <nl> + Isolate * isolate = object - > GetIsolate ( ) ; <nl> + if ( object - > HasSloppyArgumentsElements ( ) | | ! object - > map ( ) - > is_extensible ( ) ) { <nl> + return handle ( Smi : : FromInt ( - 1 ) , isolate ) ; <nl> + } <nl> + <nl> + if ( object - > HasStringWrapperElements ( ) ) { <nl> + int len = String : : cast ( Handle < JSValue > : : cast ( object ) - > value ( ) ) - > length ( ) ; <nl> + return handle ( Smi : : FromInt ( len ) , isolate ) ; <nl> + } <nl> + <nl> + JSObject : : ValidateElements ( * object ) ; <nl> + if ( object - > HasDictionaryElements ( ) ) { <nl> + / / Convert to fast elements containing only the existing properties . <nl> + / / Ordering is irrelevant , since we are going to sort anyway . <nl> + Handle < SeededNumberDictionary > dict ( object - > element_dictionary ( ) ) ; <nl> + if ( object - > IsJSArray ( ) | | dict - > requires_slow_elements ( ) | | <nl> + dict - > max_number_key ( ) > = limit ) { <nl> + return PrepareSlowElementsForSort ( object , limit ) ; <nl> + } <nl> + / / Convert to fast elements . <nl> + Handle < Map > new_map = <nl> + JSObject : : GetElementsTransitionMap ( object , HOLEY_ELEMENTS ) ; <nl> + <nl> + PretenureFlag tenure = <nl> + isolate - > heap ( ) - > InNewSpace ( * object ) ? NOT_TENURED : TENURED ; <nl> + Handle < FixedArray > fast_elements = <nl> + isolate - > factory ( ) - > NewFixedArray ( dict - > NumberOfElements ( ) , tenure ) ; <nl> + dict - > CopyValuesTo ( * fast_elements ) ; <nl> + <nl> + JSObject : : SetMapAndElements ( object , new_map , fast_elements ) ; <nl> + JSObject : : ValidateElements ( * object ) ; <nl> + } else if ( object - > HasFixedTypedArrayElements ( ) ) { <nl> + / / Typed arrays cannot have holes or undefined elements . <nl> + return handle ( <nl> + Smi : : FromInt ( FixedArrayBase : : cast ( object - > elements ( ) ) - > length ( ) ) , <nl> + isolate ) ; <nl> + } else if ( ! object - > HasDoubleElements ( ) ) { <nl> + JSObject : : EnsureWritableFastElements ( object ) ; <nl> + } <nl> + DCHECK ( object - > HasSmiOrObjectElements ( ) | | object - > HasDoubleElements ( ) ) ; <nl> + <nl> + / / Collect holes at the end , undefined before that and the rest at the <nl> + / / start , and return the number of non - hole , non - undefined values . <nl> + <nl> + Handle < FixedArrayBase > elements_base ( object - > elements ( ) ) ; <nl> + uint32_t elements_length = static_cast < uint32_t > ( elements_base - > length ( ) ) ; <nl> + if ( limit > elements_length ) { <nl> + limit = elements_length ; <nl> + } <nl> + if ( limit = = 0 ) { <nl> + return handle ( Smi : : kZero , isolate ) ; <nl> + } <nl> + <nl> + uint32_t result = 0 ; <nl> + if ( elements_base - > map ( ) = = isolate - > heap ( ) - > fixed_double_array_map ( ) ) { <nl> + FixedDoubleArray * elements = FixedDoubleArray : : cast ( * elements_base ) ; <nl> + / / Split elements into defined and the_hole , in that order . <nl> + unsigned int holes = limit ; <nl> + / / Assume most arrays contain no holes and undefined values , so minimize the <nl> + / / number of stores of non - undefined , non - the - hole values . <nl> + for ( unsigned int i = 0 ; i < holes ; i + + ) { <nl> + if ( elements - > is_the_hole ( i ) ) { <nl> + holes - - ; <nl> + } else { <nl> + continue ; <nl> + } <nl> + / / Position i needs to be filled . <nl> + while ( holes > i ) { <nl> + if ( elements - > is_the_hole ( holes ) ) { <nl> + holes - - ; <nl> + } else { <nl> + elements - > set ( i , elements - > get_scalar ( holes ) ) ; <nl> + break ; <nl> + } <nl> + } <nl> + } <nl> + result = holes ; <nl> + while ( holes < limit ) { <nl> + elements - > set_the_hole ( holes ) ; <nl> + holes + + ; <nl> + } <nl> + } else { <nl> + FixedArray * elements = FixedArray : : cast ( * elements_base ) ; <nl> + DisallowHeapAllocation no_gc ; <nl> + <nl> + / / Split elements into defined , undefined and the_hole , in that order . Only <nl> + / / count locations for undefined and the hole , and fill them afterwards . <nl> + WriteBarrierMode write_barrier = elements - > GetWriteBarrierMode ( no_gc ) ; <nl> + unsigned int undefs = limit ; <nl> + unsigned int holes = limit ; <nl> + / / Assume most arrays contain no holes and undefined values , so minimize the <nl> + / / number of stores of non - undefined , non - the - hole values . <nl> + for ( unsigned int i = 0 ; i < undefs ; i + + ) { <nl> + Object * current = elements - > get ( i ) ; <nl> + if ( current - > IsTheHole ( isolate ) ) { <nl> + holes - - ; <nl> + undefs - - ; <nl> + } else if ( current - > IsUndefined ( isolate ) ) { <nl> + undefs - - ; <nl> + } else { <nl> + continue ; <nl> + } <nl> + / / Position i needs to be filled . <nl> + while ( undefs > i ) { <nl> + current = elements - > get ( undefs ) ; <nl> + if ( current - > IsTheHole ( isolate ) ) { <nl> + holes - - ; <nl> + undefs - - ; <nl> + } else if ( current - > IsUndefined ( isolate ) ) { <nl> + undefs - - ; <nl> + } else { <nl> + elements - > set ( i , current , write_barrier ) ; <nl> + break ; <nl> + } <nl> + } <nl> + } <nl> + result = undefs ; <nl> + while ( undefs < holes ) { <nl> + elements - > set_undefined ( isolate , undefs ) ; <nl> + undefs + + ; <nl> + } <nl> + while ( holes < limit ) { <nl> + elements - > set_the_hole ( isolate , holes ) ; <nl> + holes + + ; <nl> + } <nl> + } <nl> + <nl> + return isolate - > factory ( ) - > NewNumberFromUint ( result ) ; <nl> + } <nl> + <nl> + } / / namespace <nl> <nl> / / Moves all own elements of an object , that are below a limit , to positions <nl> / / starting at zero . All undefined values are placed after non - undefined values , <nl> RUNTIME_FUNCTION ( Runtime_RemoveArrayHoles ) { <nl> CONVERT_ARG_HANDLE_CHECKED ( JSReceiver , object , 0 ) ; <nl> CONVERT_NUMBER_CHECKED ( uint32_t , limit , Uint32 , args [ 1 ] ) ; <nl> if ( object - > IsJSProxy ( ) ) return Smi : : FromInt ( - 1 ) ; <nl> - return * JSObject : : PrepareElementsForSort ( Handle < JSObject > : : cast ( object ) , <nl> - limit ) ; <nl> + return * PrepareElementsForSort ( Handle < JSObject > : : cast ( object ) , limit ) ; <nl> } <nl> <nl> <nl> RUNTIME_FUNCTION ( Runtime_MoveArrayContents ) { <nl> DCHECK_EQ ( 2 , args . length ( ) ) ; <nl> CONVERT_ARG_HANDLE_CHECKED ( JSArray , from , 0 ) ; <nl> CONVERT_ARG_HANDLE_CHECKED ( JSArray , to , 1 ) ; <nl> - JSObject : : ValidateElements ( from ) ; <nl> - JSObject : : ValidateElements ( to ) ; <nl> + JSObject : : ValidateElements ( * from ) ; <nl> + JSObject : : ValidateElements ( * to ) ; <nl> <nl> Handle < FixedArrayBase > new_elements ( from - > elements ( ) ) ; <nl> ElementsKind from_kind = from - > GetElementsKind ( ) ; <nl> RUNTIME_FUNCTION ( Runtime_MoveArrayContents ) { <nl> from - > initialize_elements ( ) ; <nl> from - > set_length ( Smi : : kZero ) ; <nl> <nl> - JSObject : : ValidateElements ( to ) ; <nl> + JSObject : : ValidateElements ( * to ) ; <nl> return * to ; <nl> } <nl> <nl> mmm a / src / runtime / runtime - intl . cc <nl> ppp b / src / runtime / runtime - intl . cc <nl> RUNTIME_FUNCTION ( Runtime_InternalDateFormatToParts ) { <nl> return isolate - > heap ( ) - > undefined_value ( ) ; <nl> } <nl> } <nl> - JSObject : : ValidateElements ( result ) ; <nl> + JSObject : : ValidateElements ( * result ) ; <nl> return * result ; <nl> } <nl> <nl> mmm a / src / runtime / runtime - object . cc <nl> ppp b / src / runtime / runtime - object . cc <nl> RUNTIME_FUNCTION ( Runtime_AppendElement ) { <nl> <nl> RETURN_FAILURE_ON_EXCEPTION ( <nl> isolate , JSObject : : AddDataElement ( array , index , value , NONE ) ) ; <nl> - JSObject : : ValidateElements ( array ) ; <nl> + JSObject : : ValidateElements ( * array ) ; <nl> return * array ; <nl> } <nl> <nl> new file mode 100644 <nl> index 00000000000 . . 13d3087e3fc <nl> mmm / dev / null <nl> ppp b / test / mjsunit / regress / regress - crbug - 737645 . js <nl> <nl> + / / Copyright 2017 the V8 project authors . All rights reserved . <nl> + / / Use of this source code is governed by a BSD - style license that can be <nl> + / / found in the LICENSE file . <nl> + <nl> + / / Flags : - - allow - natives - syntax <nl> + <nl> + for ( let i = 0 ; i < 100 ; i + + ) { <nl> + / / - length > 2 to trigger sorting . <nl> + / / - key > kRequiresSlowElementsLimit required to set the according bit on the <nl> + / / dictionary elements store . <nl> + let key = 1073741800 + i ; <nl> + var a = { length : 12 , 1 : 0xFA , [ key ] : 0xFB } ; <nl> + % HeapObjectVerify ( a ) ; <nl> + assertEquals ( [ " 1 " , " " + key , " length " ] , Object . keys ( a ) ) ; <nl> + / / Sort , everything > length is ignored . <nl> + Array . prototype . sort . call ( a ) ; <nl> + % HeapObjectVerify ( a ) ; <nl> + assertEquals ( [ " 0 " , " " + key , " length " ] , Object . keys ( a ) ) ; <nl> + / / Sorting again to trigger bug caused by not setting requires_slow_elements <nl> + Array . prototype . sort . call ( a ) ; <nl> + % HeapObjectVerify ( a ) ; <nl> + assertEquals ( [ " 0 " , " " + key , " length " ] , Object . keys ( a ) ) ; <nl> + } <nl>
|
[ runtime ] Fix Array . prototype . sort for large entries
|
v8/v8
|
78c74e68f7d195fcc28451b7d170931849aaecb1
|
2017-07-06T10:45:52Z
|
mmm a / libraries / chain / apply_context . cpp <nl> ppp b / libraries / chain / apply_context . cpp <nl> <nl> # include < eosio / chain / wasm_interface . hpp > <nl> # include < eosio / chain / generated_transaction_object . hpp > <nl> # include < eosio / chain / scope_sequence_object . hpp > <nl> + # include < boost / container / flat_set . hpp > <nl> + <nl> + using boost : : container : : flat_set ; <nl> <nl> namespace eosio { namespace chain { <nl> void apply_context : : exec_one ( ) <nl> void apply_context : : require_recipient ( account_name code ) { <nl> _notified . push_back ( code ) ; <nl> } <nl> <nl> - void apply_context : : deferred_transaction_start ( uint32_t id , <nl> - uint16_t region , <nl> - vector < scope_name > write_scopes , <nl> - vector < scope_name > read_scopes , <nl> - time_point_sec execute_after , <nl> - time_point_sec execute_before <nl> - ) { <nl> - FC_ASSERT ( execute_before > ( controller . head_block_time ( ) + fc : : milliseconds ( 2 * config : : block_interval_ms ) ) , <nl> + void apply_context : : execute_inline ( action & & a ) { <nl> + controller . check_authorization ( { a } , flat_set < public_key_type > ( ) , false , { receiver } ) ; <nl> + _inline_actions . emplace_back ( move ( a ) ) ; <nl> + } <nl> + <nl> + void apply_context : : execute_deferred ( deferred_transaction & & trx ) { <nl> + FC_ASSERT ( trx . expiration > ( controller . head_block_time ( ) + fc : : milliseconds ( 2 * config : : block_interval_ms ) ) , <nl> " transaction is expired when created " ) ; <nl> - FC_ASSERT ( execute_after < execute_before ) ; <nl> + <nl> + FC_ASSERT ( trx . execute_after < trx . expiration , " transaction expires before it can execute " ) ; <nl> <nl> / / / TODO : make default_max_gen_trx_count a producer parameter <nl> FC_ASSERT ( _pending_deferred_transactions . size ( ) < config : : default_max_gen_trx_count ) ; <nl> <nl> - auto itr = _pending_deferred_transactions . find ( id ) ; <nl> - FC_ASSERT ( itr = = _pending_deferred_transactions . end ( ) , " pending transaction with ID $ { id } already started " , ( " id " , id ) ) ; <nl> - auto & trx = _pending_deferred_transactions [ id ] ; <nl> - trx . region = region ; <nl> - trx . write_scope = move ( write_scopes ) ; <nl> - trx . read_scope = move ( read_scopes ) ; <nl> - trx . expiration = execute_before ; <nl> - trx . execute_after = execute_after ; <nl> - trx . sender = receiver ; / / / < sender is the receiver of the current action <nl> - trx . sender_id = id ; <nl> + FC_ASSERT ( trx . actions . empty ( ) , " transaction must have at least one action " ) ; <nl> + <nl> + controller . check_authorization ( trx . actions , flat_set < public_key_type > ( ) , false , { receiver } ) ; <nl> <nl> controller . validate_scope ( trx ) ; <nl> <nl> - / / / TODO : make sure there isn ' t already a deferred transaction with this ID <nl> - } <nl> + trx . sender = receiver ; / / " Attempting to send from another account " <nl> + trx . set_reference_block ( controller . head_block_id ( ) ) ; <nl> <nl> - deferred_transaction & apply_context : : get_deferred_transaction ( uint32_t id ) { <nl> - auto itr = _pending_deferred_transactions . find ( id ) ; <nl> - FC_ASSERT ( itr ! = _pending_deferred_transactions . end ( ) , " attempt to reference unknown pending deferred transaction " ) ; <nl> - return itr - > second ; <nl> - } <nl> + auto itr = _pending_deferred_transactions . find ( trx . sender_id ) ; <nl> + FC_ASSERT ( itr = = _pending_deferred_transactions . end ( ) , " pending transaction with ID $ { id } already exists " , ( " id " , trx . sender_id ) ) ; <nl> <nl> - void apply_context : : deferred_transaction_append ( uint32_t id , action a ) { <nl> - / / auto & dt = get_deferred_transaction ( id ) ; <nl> - / / dt . actions . emplace_back ( move ( a ) ) ; <nl> - / / <nl> - / / / / / TODO : use global properties object for dynamic configuration of this default_max_gen_trx_size <nl> - / / FC_ASSERT ( fc : : raw : : pack_size ( dt ) < config : : default_max_gen_trx_size , " generated transaction too big " ) ; <nl> - } <nl> - void apply_context : : deferred_transaction_send ( uint32_t id ) { <nl> - / / auto & dt = get_deferred_transaction ( id ) ; <nl> - / / FC_ASSERT ( dt . actions . size ( ) , " transaction must contain at least one action " ) ; <nl> - / / controller . check_authorization ( dt , flat_set < public_key_type > ( ) , false , { receiver } ) ; <nl> - / / auto itr = _pending_deferred_transactions . find ( id ) ; <nl> - / / _pending_deferred_transactions . erase ( itr ) ; <nl> + / / / TODO : make sure there isn ' t already a deferred transaction with this ID <nl> + _pending_deferred_transactions . emplace ( std : : piecewise_construct , std : : forward_as_tuple ( trx . sender_id ) , std : : forward_as_tuple ( move ( trx ) ) ) ; <nl> } <nl> <nl> - <nl> const contracts : : table_id_object * apply_context : : find_table ( name scope , name code , name table ) { <nl> require_read_scope ( scope ) ; <nl> return db . find < table_id_object , contracts : : by_scope_code_table > ( boost : : make_tuple ( scope , code , table ) ) ; <nl> mmm a / libraries / chain / chain_controller . cpp <nl> ppp b / libraries / chain / chain_controller . cpp <nl> flat_set < public_key_type > chain_controller : : get_required_keys ( const signed_trans <nl> return checker . used_keys ( ) ; <nl> } <nl> <nl> - void chain_controller : : check_authorization ( const transaction & trx , <nl> + void chain_controller : : check_authorization ( const vector < action > & actions , <nl> flat_set < public_key_type > provided_keys , <nl> bool allow_unused_signatures , <nl> flat_set < account_name > provided_accounts ) const <nl> void chain_controller : : check_authorization ( const transaction & trx , <nl> provided_keys , provided_accounts ) ; <nl> <nl> <nl> - for ( const auto & act : trx . actions ) { <nl> + for ( const auto & act : actions ) { <nl> for ( const auto & declared_auth : act . authorization ) { <nl> <nl> const auto & min_permission = lookup_minimum_permission ( declared_auth . actor , <nl> void chain_controller : : check_authorization ( const transaction & trx , <nl> void chain_controller : : check_transaction_authorization ( const signed_transaction & trx , <nl> bool allow_unused_signatures ) const <nl> { <nl> - check_authorization ( trx , trx . get_signature_keys ( chain_id_type { } ) , allow_unused_signatures ) ; <nl> + check_authorization ( trx . actions , trx . get_signature_keys ( chain_id_type { } ) , allow_unused_signatures ) ; <nl> } <nl> <nl> void chain_controller : : validate_scope ( const transaction & trx ) const { <nl> mmm a / libraries / chain / include / eosio / chain / apply_context . hpp <nl> ppp b / libraries / chain / include / eosio / chain / apply_context . hpp <nl> class apply_context { <nl> <nl> void exec ( ) ; <nl> <nl> - void execute_inline ( action a ) { _inline_actions . emplace_back ( move ( a ) ) ; } <nl> - <nl> - deferred_transaction & get_deferred_transaction ( uint32_t id ) ; <nl> - void deferred_transaction_start ( uint32_t id , <nl> - uint16_t region , <nl> - vector < scope_name > write_scopes , <nl> - vector < scope_name > read_scopes , <nl> - time_point_sec execute_after , <nl> - time_point_sec execute_before <nl> - ) ; <nl> - void deferred_transaction_append ( uint32_t id , action a ) ; <nl> - void deferred_transaction_send ( uint32_t id ) ; <nl> + void execute_inline ( action & & a ) ; <nl> + void execute_deferred ( deferred_transaction & & trx ) ; <nl> <nl> using table_id_object = contracts : : table_id_object ; <nl> const table_id_object * find_table ( name scope , name code , name table ) ; <nl> mmm a / libraries / chain / include / eosio / chain / chain_controller . hpp <nl> ppp b / libraries / chain / include / eosio / chain / chain_controller . hpp <nl> namespace eosio { namespace chain { <nl> * <nl> * @ return true if the provided keys and accounts are sufficient to authorize actions of the transaction <nl> * / <nl> - void check_authorization ( const transaction & trx , <nl> + void check_authorization ( const vector < action > & actions , <nl> flat_set < public_key_type > provided_keys , <nl> bool allow_unused_signatures = false , <nl> flat_set < account_name > provided_accounts = flat_set < account_name > ( ) <nl> ) const ; <nl> <nl> + <nl> + <nl> private : <nl> const apply_handler * find_apply_handler ( account_name contract , scope_name scope , action_name act ) const ; <nl> <nl> mmm a / libraries / chain / include / eosio / chain / wasm_interface_private . hpp <nl> ppp b / libraries / chain / include / eosio / chain / wasm_interface_private . hpp <nl> template < > <nl> struct native_to_wasm < wasm_double > { <nl> using type = I64 ; <nl> } ; <nl> - <nl> + template < > <nl> + struct native_to_wasm < const fc : : time_point_sec & > { <nl> + using type = I32 ; <nl> + } ; <nl> <nl> / / convenience alias <nl> template < typename T > <nl> auto convert_native_to_wasm ( const name & val ) { <nl> return native_to_wasm_t < const name & > ( val . value ) ; <nl> } <nl> <nl> + auto convert_native_to_wasm ( const fc : : time_point_sec & val ) { <nl> + return native_to_wasm_t < const fc : : time_point_sec & > ( val . sec_since_epoch ( ) ) ; <nl> + } <nl> + <nl> template < typename T > <nl> auto convert_wasm_to_native ( native_to_wasm_t < T > val ) { <nl> return T ( val ) ; <nl> struct wasm_to_rvalue_type < void > { <nl> static constexpr auto value = ResultType : : none ; <nl> } ; <nl> template < > <nl> - struct wasm_to_rvalue_type < const name & > { <nl> + struct wasm_to_rvalue_type < const name & > { <nl> static constexpr auto value = ResultType : : i64 ; <nl> } ; <nl> template < > <nl> struct wasm_to_rvalue_type < name > { <nl> static constexpr auto value = ResultType : : i64 ; <nl> } ; <nl> <nl> - <nl> template < typename T > <nl> constexpr auto wasm_to_rvalue_type_v = wasm_to_rvalue_type < T > : : value ; <nl> <nl> + template < typename T > <nl> + struct is_reference_from_value { <nl> + static constexpr bool value = false ; <nl> + } ; <nl> + <nl> + template < > <nl> + struct is_reference_from_value < name > { <nl> + static constexpr bool value = true ; <nl> + } ; <nl> + <nl> + template < > <nl> + struct is_reference_from_value < fc : : time_point_sec > { <nl> + static constexpr bool value = true ; <nl> + } ; <nl> + <nl> + template < typename T > <nl> + constexpr bool is_reference_from_value_v = is_reference_from_value < T > : : value ; <nl> + <nl> + <nl> + <nl> struct void_type { <nl> } ; <nl> <nl> struct intrinsic_invoker_impl < Ret , std : : tuple < T * , Inputs . . . > , std : : tuple < Transl <nl> } ; <nl> <nl> / * * <nl> - * Specialization for transcribing a reference to a name in the native method signature <nl> - * This type transcribes into an int64 which is loaded by value into a <nl> - * name on the stack and then passed by to the reference . <nl> + * Specialization for transcribing a reference to a name which can be passed as a native value <nl> + * This type transcribes into a native type which is loaded by value into a <nl> + * variable on the stack and then passed by reference to the intrinsic . <nl> + * <nl> + * @ tparam Ret - the return type of the native method <nl> + * @ tparam Inputs - the remaining native parameters to transcribe <nl> + * @ tparam Translated - the list of transcribed wasm parameters <nl> + * / <nl> + template < typename Ret , typename . . . Inputs , typename . . . Translated > <nl> + struct intrinsic_invoker_impl < Ret , std : : tuple < const name & , Inputs . . . > , std : : tuple < Translated . . . > > { <nl> + using next_step = intrinsic_invoker_impl < Ret , std : : tuple < Inputs . . . > , std : : tuple < Translated . . . , native_to_wasm_t < const name & > > > ; <nl> + using then_type = Ret ( * ) ( wasm_interface & , const name & , Inputs . . . , Translated . . . ) ; <nl> + <nl> + template < then_type Then > <nl> + static Ret translate_one ( wasm_interface & wasm , Inputs . . . rest , Translated . . . translated , native_to_wasm_t < const name & > wasm_value ) { <nl> + auto value = name ( wasm_value ) ; <nl> + return Then ( wasm , value , rest . . . , translated . . . ) ; <nl> + } <nl> + <nl> + template < then_type Then > <nl> + static const auto fn ( ) { <nl> + return next_step : : template fn < translate_one < Then > > ( ) ; <nl> + } <nl> + } ; <nl> + <nl> + / * * <nl> + * Specialization for transcribing a reference to a fc : : time_point_sec which can be passed as a native value <nl> + * This type transcribes into a native type which is loaded by value into a <nl> + * variable on the stack and then passed by reference to the intrinsic . <nl> * <nl> * @ tparam Ret - the return type of the native method <nl> * @ tparam Inputs - the remaining native parameters to transcribe <nl> * @ tparam Translated - the list of transcribed wasm parameters <nl> * / <nl> template < typename Ret , typename . . . Inputs , typename . . . Translated > <nl> - struct intrinsic_invoker_impl < Ret , std : : tuple < const name & , Inputs . . . > , std : : tuple < Translated . . . > > { <nl> - using next_step = intrinsic_invoker_impl < Ret , std : : tuple < Inputs . . . > , std : : tuple < Translated . . . , I64 > > ; <nl> - using then_type = Ret ( * ) ( wasm_interface & , const name & , Inputs . . . , Translated . . . ) ; <nl> + struct intrinsic_invoker_impl < Ret , std : : tuple < const fc : : time_point_sec & , Inputs . . . > , std : : tuple < Translated . . . > > { <nl> + using next_step = intrinsic_invoker_impl < Ret , std : : tuple < Inputs . . . > , std : : tuple < Translated . . . , native_to_wasm_t < const fc : : time_point_sec & > > > ; <nl> + using then_type = Ret ( * ) ( wasm_interface & , const fc : : time_point_sec & , Inputs . . . , Translated . . . ) ; <nl> <nl> template < then_type Then > <nl> - static Ret translate_one ( wasm_interface & wasm , Inputs . . . rest , Translated . . . translated , I64 name_value ) { <nl> - auto value = name ( name_value ) ; <nl> + static Ret translate_one ( wasm_interface & wasm , Inputs . . . rest , Translated . . . translated , native_to_wasm_t < const fc : : time_point_sec & > wasm_value ) { <nl> + auto value = fc : : time_point_sec ( wasm_value ) ; <nl> return Then ( wasm , value , rest . . . , translated . . . ) ; <nl> } <nl> <nl> mmm a / libraries / chain / wasm_interface . cpp <nl> ppp b / libraries / chain / wasm_interface . cpp <nl> class db_index_api : public context_aware_api { <nl> <nl> } ; <nl> <nl> + class transaction_api : public context_aware_api { <nl> + public : <nl> + using context_aware_api : : context_aware_api ; <nl> + <nl> + void send_inline ( array_ptr < char > data , size_t data_len ) { <nl> + / / TODO : use global properties object for dynamic configuration of this default_max_gen_trx_size <nl> + FC_ASSERT ( data_len < config : : default_max_inline_action_size , " inline action too big " ) ; <nl> + <nl> + action act ; <nl> + fc : : raw : : unpack < action > ( data , data_len , act ) ; <nl> + context . execute_inline ( std : : move ( act ) ) ; <nl> + } <nl> + <nl> + <nl> + void send_deferred ( uint32_t sender_id , const fc : : time_point_sec & execute_after , array_ptr < char > data , size_t data_len ) { <nl> + / / TODO : use global properties object for dynamic configuration of this default_max_gen_trx_size <nl> + FC_ASSERT ( data_len < config : : default_max_gen_trx_size , " generated transaction too big " ) ; <nl> + <nl> + deferred_transaction dtrx ; <nl> + fc : : raw : : unpack < transaction > ( data , data_len , dtrx ) ; <nl> + dtrx . sender = context . receiver ; <nl> + dtrx . sender_id = sender_id ; <nl> + dtrx . execute_after = execute_after ; <nl> + context . execute_deferred ( std : : move ( dtrx ) ) ; <nl> + } <nl> + <nl> + } ; <nl> + <nl> REGISTER_INTRINSICS ( system_api , <nl> ( assert , void ( int , int ) ) <nl> ) ; <nl> REGISTER_INTRINSICS ( console_api , <nl> ( printhex , void ( int , int ) ) <nl> ) ; <nl> <nl> + REGISTER_INTRINSICS ( transaction_api , <nl> + ( send_inline , void ( int , int ) ) <nl> + ( send_deferred , void ( int , int , int , int ) ) <nl> + ) ; <nl> + <nl> + <nl> # define DB_METHOD_SEQ ( SUFFIX ) \ <nl> ( store , int32_t ( int64_t , int64_t , int , int ) , " store_ " # SUFFIX ) \ <nl> ( update , int32_t ( int64_t , int64_t , int , int ) , " update_ " # SUFFIX ) \ <nl> mmm a / libraries / fc / include / fc / io / raw . hpp <nl> ppp b / libraries / fc / include / fc / io / raw . hpp <nl> namespace fc { <nl> { try { <nl> datastream < const char * > ds ( d , s ) ; <nl> fc : : raw : : unpack ( ds , v ) ; <nl> - return v ; <nl> } FC_RETHROW_EXCEPTIONS ( warn , " error unpacking $ { type } " , ( " type " , fc : : get_typename < T > : : name ( ) ) ) } <nl> <nl> template < typename Stream > <nl>
|
add in wasm interface for inline actions and deferred transactions
|
EOSIO/eos
|
38b50df9b29f354a4bc6c23fa4737e4123aaed36
|
2017-12-13T20:11:16Z
|
mmm a / LICENSE . txt <nl> ppp b / LICENSE . txt <nl> <nl> - Port Tree <nl> - <nl> Copyright ( c ) Microsoft Corporation <nl> <nl> All rights reserved . <nl>
|
[ vcpkg ] remove text from license ( )
|
microsoft/vcpkg
|
2fb3debcffd37b9a91c15ab912b1dcfef5b1a0fd
|
2019-09-06T21:24:19Z
|
mmm a / src / rpc / mining . cpp <nl> ppp b / src / rpc / mining . cpp <nl> static UniValue getnetworkhashps ( const JSONRPCRequest & request ) <nl> <nl> static UniValue generateBlocks ( const CScript & coinbase_script , int nGenerate , uint64_t nMaxTries ) <nl> { <nl> - static const int nInnerLoopCount = 0x10000 ; <nl> int nHeightEnd = 0 ; <nl> int nHeight = 0 ; <nl> <nl> static UniValue generateBlocks ( const CScript & coinbase_script , int nGenerate , ui <nl> LOCK ( cs_main ) ; <nl> IncrementExtraNonce ( pblock , : : ChainActive ( ) . Tip ( ) , nExtraNonce ) ; <nl> } <nl> - while ( nMaxTries > 0 & & pblock - > nNonce < nInnerLoopCount & & ! CheckProofOfWork ( pblock - > GetHash ( ) , pblock - > nBits , Params ( ) . GetConsensus ( ) ) ) { <nl> + while ( nMaxTries > 0 & & pblock - > nNonce < std : : numeric_limits < uint32_t > : : max ( ) & & ! CheckProofOfWork ( pblock - > GetHash ( ) , pblock - > nBits , Params ( ) . GetConsensus ( ) ) & & ! ShutdownRequested ( ) ) { <nl> + + pblock - > nNonce ; <nl> - - nMaxTries ; <nl> } <nl> - if ( nMaxTries = = 0 ) { <nl> + if ( nMaxTries = = 0 | | ShutdownRequested ( ) ) { <nl> break ; <nl> } <nl> - if ( pblock - > nNonce = = nInnerLoopCount ) { <nl> + if ( pblock - > nNonce = = std : : numeric_limits < uint32_t > : : max ( ) ) { <nl> continue ; <nl> } <nl> std : : shared_ptr < const CBlock > shared_pblock = std : : make_shared < const CBlock > ( * pblock ) ; <nl>
|
rpc : Allow shutdown while in generateblocks
|
bitcoin/bitcoin
|
3b9bf0eb0e0d69f112ce905078018d8351c73e26
|
2019-06-24T00:51:02Z
|
mmm a / tensorflow / python / distribute / values_test . py <nl> ppp b / tensorflow / python / distribute / values_test . py <nl> def _make_replica_local ( method , strategy = None ) : <nl> return v , replica_local <nl> <nl> <nl> - # TODO ( b / 144432582 ) : Add variable aggregation type to combinations to simplify <nl> - # tests . <nl> - def strategy_and_run_tf_function_combinations ( ) : <nl> - # Test the combination of different strategies and whether a tf . function <nl> - # is passed into strategy . run . " " " <nl> - return combinations . combine ( <nl> - distribution = [ <nl> - strategy_combinations . mirrored_strategy_with_gpu_and_cpu , <nl> - ] , <nl> - mode = [ " graph " , " eager " ] , <nl> - experimental_run_tf_function = [ True , False ] ) + combinations . combine ( <nl> - distribution = [ <nl> - strategy_combinations . tpu_strategy , <nl> - strategy_combinations . tpu_strategy_packed_var , <nl> - ] , <nl> - mode = [ " graph " , " eager " ] , <nl> - experimental_run_tf_function = [ True ] ) <nl> - <nl> - <nl> class SyncOnReadVariableTest ( test . TestCase , parameterized . TestCase ) : <nl> <nl> def _assign_replica_local ( self , v , new ) : <nl>
|
Remove unused helper in values_test . py
|
tensorflow/tensorflow
|
640cdad89f7d3d2ab392526f2859e4f3e3f78721
|
2020-07-30T03:53:01Z
|
mmm a / caffe2 / quantization / server / conv_dnnlowp_acc16_op . cc <nl> ppp b / caffe2 / quantization / server / conv_dnnlowp_acc16_op . cc <nl> static void conv_nhwc_acc16_ref_ ( <nl> } <nl> <nl> template < bool ReluFused > <nl> - template < fbgemm : : QuantizationGranularity Q_GRAN > <nl> + template < typename PackAMatrix , fbgemm : : QuantizationGranularity Q_GRAN > <nl> void ConvDNNLowPAcc16Op < ReluFused > : : DispatchFBGEMM_ ( <nl> - fbgemm : : PackAWithRowOffset < uint8_t , int16_t > & packA , <nl> + PackAMatrix & packA , <nl> const uint8_t * col_buffer_data , <nl> vector < int32_t > * Y_int32 , <nl> uint8_t * Y_uint8_data ) { <nl> void ConvDNNLowPAcc16Op < ReluFused > : : DispatchFBGEMM_ ( <nl> doNothingObj , <nl> this - > requantization_multipliers_ . data ( ) , <nl> out_qparams_ . zero_point , <nl> - in_qparams_ [ INPUT ] . zero_point , <nl> + / / column_offsets_ empty means column_offsets_ are folded into bias <nl> + this - > column_offsets_ - > empty ( ) ? 0 : in_qparams_ [ INPUT ] . zero_point , <nl> this - > filter_zero_points_ . data ( ) , <nl> packA . getRowOffsetBuffer ( ) , <nl> - this - > column_offsets_ - > data ( ) , <nl> + this - > column_offsets_ - > empty ( ) ? nullptr : this - > column_offsets_ - > data ( ) , <nl> InputSize ( ) = = 3 ? this - > b_quantized_data_ : nullptr , <nl> M , <nl> group_ ) ; <nl> bool ConvDNNLowPAcc16Op < ReluFused > : : RunOnDeviceWithOrderNHWC ( ) { <nl> int row_offset_size_per_thread = - 1 ; <nl> int x_pack_buf_size_per_thread = - 1 ; <nl> if ( Wq_acc16_packed_ ) { <nl> - row_offset_size_per_thread = <nl> - PackAWithRowOffset < uint8_t , int16_t > : : rowOffsetBufferSize ( ) ; <nl> - x_pack_buf_size_per_thread = <nl> - PackAWithRowOffset < uint8_t , int16_t > : : packedBufferSize ( ) ; <nl> - row_offsets_ . resize ( <nl> - dnnlowp_get_max_threads ( ) * row_offset_size_per_thread ) ; <nl> - X_pack_buf_ . resize ( <nl> - dnnlowp_get_max_threads ( ) * x_pack_buf_size_per_thread ) ; <nl> + if ( ! this - > quantize_groupwise_ & & this - > filter_zero_points_ [ 0 ] = = 0 ) { <nl> + x_pack_buf_size_per_thread = <nl> + PackAMatrix < uint8_t , int16_t > : : packedBufferSize ( ) ; <nl> + X_pack_buf_ . resize ( <nl> + dnnlowp_get_max_threads ( ) * x_pack_buf_size_per_thread ) ; <nl> + } else { <nl> + row_offset_size_per_thread = <nl> + PackAWithRowOffset < uint8_t , int16_t > : : rowOffsetBufferSize ( ) ; <nl> + x_pack_buf_size_per_thread = <nl> + PackAWithRowOffset < uint8_t , int16_t > : : packedBufferSize ( ) ; <nl> + row_offsets_ . resize ( <nl> + dnnlowp_get_max_threads ( ) * row_offset_size_per_thread ) ; <nl> + X_pack_buf_ . resize ( <nl> + dnnlowp_get_max_threads ( ) * x_pack_buf_size_per_thread ) ; <nl> + } <nl> } <nl> <nl> uint8_t * Y_uint8_data = Y - > template mutable_data < uint8_t > ( ) ; <nl> bool ConvDNNLowPAcc16Op < ReluFused > : : RunOnDeviceWithOrderNHWC ( ) { <nl> int tid = dnnlowp_get_thread_num ( ) ; <nl> <nl> / / no im2col fusion <nl> - PackAWithRowOffset < uint8_t , int16_t > packA ( <nl> - matrix_op_t : : NoTranspose , <nl> - N * output_image_size , <nl> - group_ * kernel_dim , <nl> - col_buffer_data , <nl> - group_ * kernel_dim , <nl> - X_pack_buf_ . data ( ) + tid * x_pack_buf_size_per_thread , <nl> - group_ , <nl> - row_offsets_ . data ( ) + tid * row_offset_size_per_thread ) ; <nl> - <nl> - if ( this - > quantize_groupwise_ ) { <nl> - DispatchFBGEMM_ < QuantizationGranularity : : GROUP > ( <nl> - packA , col_buffer_data , Y_int32 , Y_uint8_data ) ; <nl> + if ( ! this - > quantize_groupwise_ & & this - > filter_zero_points_ [ 0 ] = = 0 ) { <nl> + PackAMatrix < uint8_t , int16_t > packA ( <nl> + matrix_op_t : : NoTranspose , <nl> + N * output_image_size , <nl> + group_ * kernel_dim , <nl> + col_buffer_data , <nl> + group_ * kernel_dim , <nl> + X_pack_buf_ . data ( ) + tid * x_pack_buf_size_per_thread , <nl> + group_ ) ; <nl> + <nl> + if ( this - > quantize_groupwise_ ) { <nl> + DispatchFBGEMM_ < <nl> + PackAMatrix < uint8_t , int16_t > , <nl> + QuantizationGranularity : : GROUP > ( <nl> + packA , col_buffer_data , Y_int32 , Y_uint8_data ) ; <nl> + } else { <nl> + DispatchFBGEMM_ < <nl> + PackAMatrix < uint8_t , int16_t > , <nl> + QuantizationGranularity : : TENSOR > ( <nl> + packA , col_buffer_data , Y_int32 , Y_uint8_data ) ; <nl> + } <nl> } else { <nl> - DispatchFBGEMM_ < QuantizationGranularity : : TENSOR > ( <nl> - packA , col_buffer_data , Y_int32 , Y_uint8_data ) ; <nl> + / / no im2col fusion <nl> + PackAWithRowOffset < uint8_t , int16_t > packA ( <nl> + matrix_op_t : : NoTranspose , <nl> + N * output_image_size , <nl> + group_ * kernel_dim , <nl> + col_buffer_data , <nl> + group_ * kernel_dim , <nl> + X_pack_buf_ . data ( ) + tid * x_pack_buf_size_per_thread , <nl> + group_ , <nl> + row_offsets_ . data ( ) + tid * row_offset_size_per_thread ) ; <nl> + <nl> + if ( this - > quantize_groupwise_ ) { <nl> + DispatchFBGEMM_ < <nl> + PackAWithRowOffset < uint8_t , int16_t > , <nl> + QuantizationGranularity : : GROUP > ( <nl> + packA , col_buffer_data , Y_int32 , Y_uint8_data ) ; <nl> + } else { <nl> + DispatchFBGEMM_ < <nl> + PackAWithRowOffset < uint8_t , int16_t > , <nl> + QuantizationGranularity : : TENSOR > ( <nl> + packA , col_buffer_data , Y_int32 , Y_uint8_data ) ; <nl> + } <nl> } <nl> } else { <nl> / / slow path <nl> mmm a / caffe2 / quantization / server / conv_dnnlowp_acc16_op . h <nl> ppp b / caffe2 / quantization / server / conv_dnnlowp_acc16_op . h <nl> class ConvDNNLowPAcc16Op final : public ConvDNNLowPOp < std : : uint8_t , ReluFused > { <nl> <nl> bool GetQuantizationParameters_ ( ) ; <nl> <nl> - template < fbgemm : : QuantizationGranularity Q_GRAN > <nl> + template < typename PackAMatrix , fbgemm : : QuantizationGranularity Q_GRAN > <nl> void DispatchFBGEMM_ ( <nl> - fbgemm : : PackAWithRowOffset < std : : uint8_t , std : : int16_t > & packA , <nl> + PackAMatrix & packA , <nl> const std : : uint8_t * col_buffer_data , <nl> vector < std : : int32_t > * Y_int32 , <nl> uint8_t * Y_uint8_data ) ; <nl> mmm a / caffe2 / quantization / server / conv_dnnlowp_op . cc <nl> ppp b / caffe2 / quantization / server / conv_dnnlowp_op . cc <nl> bool ConvDNNLowPOp < T , ReluFused > : : NoIm2ColNHWC_ ( ) { <nl> <nl> template < typename T , bool ReluFused > <nl> void ConvDNNLowPOp < T , ReluFused > : : PreComputeRowColumnOffsets_ ( ) { <nl> + if ( this - > order_ = = StorageOrder : : NHWC & & <nl> + this - > template InputIsType < int8 : : Int8TensorCPU > ( INPUT ) ) { <nl> + / / If input tensor doesn ' t use dynamic quantization , we fold column_offsets_ <nl> + / / into bias . <nl> + return ; <nl> + } <nl> + <nl> const auto & filter = InputTensorCPU_ ( FILTER ) ; <nl> int kernel_dim = KernelDim_ ( ) ; <nl> int M = filter . dim32 ( 0 ) ; <nl> <nl> / / Pre - compute row_offset / column_offset <nl> vector < int > & offsets = <nl> - StorageOrder : : NCHW = = ConvPoolOpBase < CPUContext > : : order_ <nl> - ? row_offsets_ <nl> - : * column_offsets_ ; <nl> + this - > order_ = = StorageOrder : : NCHW ? row_offsets_ : * column_offsets_ ; <nl> <nl> if ( offsets . empty ( ) ) { <nl> if ( this - > template InputIsType < Int8ConvDNNLowPPackedWeightBlob > ( FILTER ) ) { <nl> void ConvDNNLowPOp < T , ReluFused > : : QuantizeBias_ ( ) { <nl> / / Quantize bias <nl> if ( has_bias & & <nl> ( ! b_quantized_data_ | | <nl> - in_qparams_ [ INPUT ] . scale ! = in_qparams_scale_old_ ) ) { <nl> + in_qparams_ [ INPUT ] . scale ! = in_qparams_scale_old_ | | <nl> + in_qparams_ [ INPUT ] . zero_point ! = in_qparams_zero_point_old_ ) ) { <nl> if ( has_packed_bias ) { <nl> const auto & packed_filter = <nl> this - > template Input < Int8ConvDNNLowPPackedWeightBlob > ( FILTER ) ; <nl> void ConvDNNLowPOp < T , ReluFused > : : QuantizeBias_ ( ) { <nl> } <nl> b_quantized_data_ = b_quantized_ - > data ( ) ; <nl> } <nl> - in_qparams_scale_old_ = in_qparams_ [ INPUT ] . scale ; <nl> } <nl> + in_qparams_scale_old_ = in_qparams_ [ INPUT ] . scale ; <nl> + in_qparams_zero_point_old_ = in_qparams_ [ INPUT ] . zero_point ; <nl> <nl> CAFFE_ENFORCE ( b_quantized_data_ ) ; <nl> + <nl> + / / If column_offsets_ is empty even when we need column_offsets ( asymmetric <nl> + / / quantization in input ) , it means we need to fuse column_offsets to bias . <nl> + if ( this - > order_ = = StorageOrder : : NHWC & & in_qparams_ [ INPUT ] . zero_point & & <nl> + column_offsets_ - > empty ( ) ) { <nl> + if ( b_quantized_ - > empty ( ) ) { <nl> + b_quantized_ - > assign ( b_quantized_data_ , b_quantized_data_ + M ) ; <nl> + b_quantized_data_ = b_quantized_ - > data ( ) ; <nl> + } <nl> + vector < int32_t > * column_offset_ptr ; <nl> + vector < int32_t > column_offset_temp ; <nl> + if ( this - > template InputIsType < Int8ConvDNNLowPPackedWeightBlob > ( FILTER ) ) { <nl> + const auto & packed_filter = <nl> + this - > template Input < Int8ConvDNNLowPPackedWeightBlob > ( FILTER ) ; <nl> + column_offset_ptr = packed_filter . column_offsets . get ( ) ; <nl> + } else { <nl> + vector < TensorQuantizationParams > temp_qparams ; <nl> + temp_qparams . push_back ( in_qparams_ [ 1 ] ) ; <nl> + column_offset_temp . resize ( M ) ; <nl> + ComputeColumnOffsets < T_signed > ( <nl> + KernelDim_ ( ) , <nl> + M , <nl> + W_quantized_ . data ( ) , <nl> + filter_qparams_ , <nl> + column_offset_temp ) ; <nl> + column_offset_ptr = & column_offset_temp ; <nl> + } <nl> + for ( int i = 0 ; i < M ; + + i ) { <nl> + ( * b_quantized_ ) [ i ] - = <nl> + in_qparams_ [ 0 ] . zero_point * ( * column_offset_ptr ) [ i ] ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( ! has_bias & & this - > order_ = = StorageOrder : : NHWC & & <nl> + in_qparams_ [ INPUT ] . zero_point & & column_offsets_ - > empty ( ) & & <nl> + ! b_quantized_data_ ) { <nl> + / / no bias but create one filling with column offset values <nl> + b_quantized_ - > resize ( M , 0 ) ; <nl> + b_quantized_data_ = b_quantized_ - > data ( ) ; <nl> + <nl> + vector < int32_t > * column_offset_ptr ; <nl> + vector < int32_t > column_offset_temp ; <nl> + if ( this - > template InputIsType < Int8ConvDNNLowPPackedWeightBlob > ( FILTER ) ) { <nl> + const auto & packed_filter = <nl> + this - > template Input < Int8ConvDNNLowPPackedWeightBlob > ( FILTER ) ; <nl> + column_offset_ptr = packed_filter . column_offsets . get ( ) ; <nl> + } else { <nl> + vector < TensorQuantizationParams > temp_qparams ; <nl> + temp_qparams . push_back ( in_qparams_ [ 1 ] ) ; <nl> + column_offset_temp . resize ( M ) ; <nl> + ComputeColumnOffsets < T_signed > ( <nl> + KernelDim_ ( ) , <nl> + M , <nl> + W_quantized_ . data ( ) , <nl> + filter_qparams_ , <nl> + column_offset_temp ) ; <nl> + column_offset_ptr = & column_offset_temp ; <nl> + } <nl> + for ( int i = 0 ; i < M ; + + i ) { <nl> + ( * b_quantized_ ) [ i ] - = in_qparams_ [ 0 ] . zero_point * ( * column_offset_ptr ) [ i ] ; <nl> + } <nl> } <nl> } <nl> <nl> bool ConvDNNLowPOp < T , ReluFused > : : GetQuantizationParameters_ ( ) { <nl> <nl> QuantizeWeight_ ( ) ; <nl> PreComputeRowColumnOffsets_ ( ) ; <nl> + QuantizeBias_ ( ) ; <nl> + <nl> if ( Wq_packed_ & & ! FLAGS_caffe2_dnnlowp_dump_tensors ) { <nl> / / From here , W_quantized_ is not used anymore when we have Wq_packed_ <nl> vector < T_signed > ( ) . swap ( W_quantized_ ) ; <nl> } <nl> <nl> - QuantizeBias_ ( ) ; <nl> - <nl> bool fp32_executed = false ; <nl> if ( HasStaticQuantization ( this ) ) { <nl> out_qparams_ = GetStaticQuantizationParamsOf ( this , 0 ) ; <nl> void ConvDNNLowPOp < T , ReluFused > : : RunOnDeviceEpilogueNHWC_ ( <nl> <nl> for ( int j = group_id * ( M / group_ ) ; j < ( group_id + 1 ) * ( M / group_ ) ; <nl> + + j ) { <nl> - int32_t raw = Y_int32 [ i * M + j ] - <nl> - A_zero_point * ( * column_offsets_ ) [ j ] - row_offset ; <nl> + int32_t raw = Y_int32 [ i * M + j ] - row_offset ; <nl> + if ( ! column_offsets_ - > empty ( ) ) { <nl> + raw - = A_zero_point * ( * column_offsets_ ) [ j ] ; <nl> + } <nl> if ( b_quantized_data_ ) { <nl> raw + = b_quantized_data_ [ j ] ; <nl> } <nl> void ConvDNNLowPOp < T , ReluFused > : : RunOnDeviceEpilogueNHWC_ ( <nl> reinterpret_cast < uint8_t * > ( Ydata + i * M + group_id * ( M / group_ ) ) , <nl> & C_multiplier , <nl> C_zero_point , <nl> - A_zero_point , <nl> + column_offsets_ - > empty ( ) ? 0 : A_zero_point , <nl> & B_zero_point , <nl> & row_offset , <nl> - column_offsets_ - > data ( ) + group_id * ( M / group_ ) , <nl> + column_offsets_ - > empty ( ) <nl> + ? nullptr <nl> + : column_offsets_ - > data ( ) + group_id * ( M / group_ ) , <nl> b_quantized_data_ ? b_quantized_data_ + group_id * ( M / group_ ) <nl> : nullptr , <nl> M / group_ , <nl> void ConvDNNLowPOp < T , ReluFused > : : RunOnDeviceEpilogueNHWC_ ( <nl> <nl> for ( int j = group_id * ( M / group_ ) ; j < ( group_id + 1 ) * ( M / group_ ) ; <nl> + + j ) { <nl> - int32_t raw = Y_int32 [ i * M + j ] - <nl> - A_zero_point * ( * column_offsets_ ) [ j ] - row_offset ; <nl> + int32_t raw = Y_int32 [ i * M + j ] - row_offset ; <nl> + if ( ! column_offsets_ - > empty ( ) ) { <nl> + raw - = A_zero_point * ( * column_offsets_ ) [ j ] ; <nl> + } <nl> if ( b_quantized_data_ ) { <nl> raw + = b_quantized_data_ [ j ] ; <nl> } <nl> void ConvDNNLowPOp < T , ReluFused > : : DispatchFBGEMM_ ( <nl> doNothingObj , <nl> requantization_multipliers_ . data ( ) , <nl> out_qparams_ . zero_point , <nl> - in_qparams_ [ INPUT ] . zero_point , <nl> + / / column_offsets_ empty means column_offsets_ are folded into bias <nl> + column_offsets_ - > empty ( ) ? 0 : in_qparams_ [ INPUT ] . zero_point , <nl> filter_zero_points_ . data ( ) , <nl> packA . getRowOffsetBuffer ( ) , <nl> - column_offsets_ - > data ( ) , <nl> + column_offsets_ - > empty ( ) ? nullptr : column_offsets_ - > data ( ) , <nl> b_quantized_data_ , <nl> M , <nl> group_ ) ; <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> this - > stride_ [ 0 ] , <nl> this - > stride_ [ 1 ] , <nl> this - > stride_ [ 2 ] , <nl> + / / Shouldn ' t pass 0 if column_offsets_ is empty here because we <nl> + / / need zero_point for padding <nl> in_qparams_ [ INPUT ] . zero_point , <nl> reinterpret_cast < const uint8_t * > ( Xdata ) , <nl> filter_zero_points_ . data ( ) , <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> requantization_multipliers_ . data ( ) , <nl> out_qparams_ . zero_point , <nl> Y_uint8_data , <nl> - column_offsets_ - > data ( ) , <nl> + / / column_offsets_ empty means column_offsets_ are folded into bias <nl> + column_offsets_ - > empty ( ) ? nullptr : column_offsets_ - > data ( ) , <nl> b_quantized_data_ , <nl> ReluFused , <nl> dnnlowp_get_thread_num ( ) , <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> this - > stride_ [ 0 ] , <nl> this - > stride_ [ 1 ] , <nl> this - > stride_ [ 2 ] , <nl> + / / Shouldn ' t pass 0 if column_offsets_ is empty here because we <nl> + / / need zero_point for padding <nl> in_qparams_ [ INPUT ] . zero_point , <nl> reinterpret_cast < const uint8_t * > ( Xdata ) , <nl> FilterQuantizationParams ( 0 ) . zero_point , <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> requantization_params_ [ 0 ] . real_multiplier , <nl> out_qparams_ . zero_point , <nl> Y_uint8_data , <nl> - column_offsets_ - > data ( ) , <nl> + / / column_offsets_ empty means column_offsets_ are folded into bias <nl> + column_offsets_ - > empty ( ) ? nullptr : column_offsets_ - > data ( ) , <nl> b_quantized_data_ , <nl> ReluFused , <nl> dnnlowp_get_thread_num ( ) , <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> C , <nl> stride_h ( ) , <nl> stride_w ( ) , <nl> + / / Shouldn ' t pass 0 if column_offsets_ is empty here because we <nl> + / / need zero_point for padding <nl> in_qparams_ [ INPUT ] . zero_point , <nl> reinterpret_cast < const uint8_t * > ( Xdata ) , <nl> filter_zero_points_ . data ( ) , <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> requantization_multipliers_ . data ( ) , <nl> out_qparams_ . zero_point , <nl> Y_uint8_data , <nl> - column_offsets_ - > data ( ) , <nl> + / / column_offsets_ empty means column_offsets_ are folded into bias <nl> + column_offsets_ - > empty ( ) ? nullptr : column_offsets_ - > data ( ) , <nl> b_quantized_data_ , <nl> ReluFused , <nl> dnnlowp_get_thread_num ( ) , <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> C , <nl> stride_h ( ) , <nl> stride_w ( ) , <nl> + / / Shouldn ' t pass 0 if column_offsets_ is empty here because we <nl> + / / need zero_point for padding <nl> in_qparams_ [ INPUT ] . zero_point , <nl> reinterpret_cast < const uint8_t * > ( Xdata ) , <nl> FilterQuantizationParams ( 0 ) . zero_point , <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> requantization_params_ [ 0 ] . real_multiplier , <nl> out_qparams_ . zero_point , <nl> Y_uint8_data , <nl> - column_offsets_ - > data ( ) , <nl> + / / column_offsets_ empty means column_offsets_ are folded into bias <nl> + column_offsets_ - > empty ( ) ? nullptr : column_offsets_ - > data ( ) , <nl> b_quantized_data_ , <nl> ReluFused , <nl> dnnlowp_get_thread_num ( ) , <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> doNothingObj , <nl> requantization_multipliers_ . data ( ) , <nl> out_qparams_ . zero_point , <nl> - in_qparams_ [ INPUT ] . zero_point , <nl> + / / column_offsets_ empty means column_offsets_ are folded into bias <nl> + column_offsets_ - > empty ( ) ? 0 : in_qparams_ [ INPUT ] . zero_point , <nl> filter_zero_points_ . data ( ) , <nl> row_offsets_ . data ( ) + tid * row_offset_size_per_thread , <nl> - column_offsets_ - > data ( ) , <nl> + column_offsets_ - > empty ( ) ? nullptr : column_offsets_ - > data ( ) , <nl> b_quantized_data_ , <nl> conv_p . OC , <nl> conv_p . G ) ; <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> fbgemmGroupwiseConv ( <nl> conv_p , <nl> reinterpret_cast < const uint8_t * > ( Xdata ) , <nl> + / / Shouldn ' t pass 0 if column_offsets_ is empty here because we <nl> + / / need zero_point for padding <nl> in_qparams_ [ INPUT ] . zero_point , <nl> row_offsets_ . data ( ) + tid * row_offset_size_per_thread , <nl> * Wq_gconv_packed_ , <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> doNothingObj , <nl> requantization_multipliers_ . data ( ) , <nl> out_qparams_ . zero_point , <nl> - in_qparams_ [ INPUT ] . zero_point , <nl> + / / column_offsets_ empty means column_offsets_ are folded into bias <nl> + column_offsets_ - > empty ( ) ? 0 : in_qparams_ [ INPUT ] . zero_point , <nl> filter_zero_points_ . data ( ) , <nl> filter_zero_points_ [ 0 ] <nl> ? row_offsets_ . data ( ) + tid * row_offset_size_per_thread <nl> : nullptr , <nl> - column_offsets_ - > data ( ) , <nl> + column_offsets_ - > empty ( ) ? nullptr : column_offsets_ - > data ( ) , <nl> b_quantized_data_ , <nl> conv_p . OC , <nl> conv_p . G ) ; <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> fbgemmGroupwiseConv ( <nl> conv_p , <nl> reinterpret_cast < const uint8_t * > ( Xdata ) , <nl> + / / Shouldn ' t pass 0 if column_offsets_ is empty here because we <nl> + / / need zero_point for padding <nl> in_qparams_ [ INPUT ] . zero_point , <nl> filter_zero_points_ [ 0 ] <nl> ? row_offsets_ . data ( ) + tid * row_offset_size_per_thread <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> row_offset_size_per_thread = <nl> PackAWithIm2Col < uint8_t > : : rowOffsetBufferSize ( ) ; <nl> x_pack_buf_size_per_thread = PackAWithIm2Col < uint8_t > : : packedBufferSize ( ) ; <nl> + } else if ( ! quantize_groupwise_ & & filter_zero_points_ [ 0 ] = = 0 ) { <nl> + row_offset_size_per_thread = 0 ; <nl> + x_pack_buf_size_per_thread = PackAMatrix < uint8_t > : : packedBufferSize ( ) ; <nl> } else { <nl> row_offset_size_per_thread = <nl> PackAWithRowOffset < uint8_t > : : rowOffsetBufferSize ( ) ; <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> reinterpret_cast < const uint8_t * > ( col_buffer_data ) , <nl> / / buffer for packed matrix <nl> X_pack_buf_ . data ( ) + tid * x_pack_buf_size_per_thread , <nl> + / / Shouldn ' t pass 0 if column_offsets_ is empty here because we <nl> + / / need zero_point for padding <nl> in_qparams_ [ INPUT ] . zero_point , <nl> row_offsets_ . data ( ) + tid * row_offset_size_per_thread ) ; <nl> <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> reinterpret_cast < const uint8_t * > ( col_buffer_data ) , <nl> / / buffer for packed matrix <nl> X_pack_buf_ . data ( ) + tid * x_pack_buf_size_per_thread , <nl> + / / Shouldn ' t pass 0 if column_offsets_ is empty here because we <nl> + / / need zero_point for padding <nl> in_qparams_ [ INPUT ] . zero_point , <nl> row_offsets_ . data ( ) + tid * row_offset_size_per_thread ) ; <nl> <nl> void ConvDNNLowPOp < T , ReluFused > : : ConvNHWCCore_ ( <nl> QuantizationGranularity : : TENSOR > ( packA , Y_int32 , Y_uint8_data ) ; <nl> } <nl> } / / 3D <nl> + } else if ( ! quantize_groupwise_ & & filter_zero_points_ [ 0 ] = = 0 ) { <nl> + / / no im2col fusion <nl> + PackAMatrix < uint8_t > packA ( <nl> + matrix_op_t : : NoTranspose , <nl> + N * Y_HxW , <nl> + group_ * kernel_dim , <nl> + reinterpret_cast < const uint8_t * > ( col_buffer_data ) , <nl> + group_ * kernel_dim , <nl> + / / buffer for packed matrix <nl> + X_pack_buf_ . data ( ) + tid * x_pack_buf_size_per_thread , <nl> + group_ ) ; <nl> + <nl> + DispatchFBGEMM_ < PackAMatrix < uint8_t > , QuantizationGranularity : : TENSOR > ( <nl> + packA , Y_int32 , Y_uint8_data ) ; <nl> } else { <nl> / / no im2col fusion <nl> PackAWithRowOffset < uint8_t > packA ( <nl> mmm a / caffe2 / quantization / server / conv_dnnlowp_op . h <nl> ppp b / caffe2 / quantization / server / conv_dnnlowp_op . h <nl> class ConvDNNLowPOp : public ConvPoolDNNLowPOpBase < T , ConvFp32Op > { <nl> / / pre - computed biases and offsets <nl> std : : shared_ptr < std : : vector < std : : int32_t > > b_quantized_ ; <nl> <nl> - float in_qparams_scale_old_ = 0 ; <nl> + float in_qparams_scale_old_ { 0 } ; <nl> + std : : int32_t in_qparams_zero_point_old_ { 0 } ; <nl> } ; / / class ConvDNNLowPOp <nl> <nl> } / / namespace caffe2 <nl>
|
fold col offset into bias ; optimize A symmetric quant ( )
|
pytorch/pytorch
|
fa0ad057f8b0b16500a00ec874fcaa733e0287e3
|
2019-04-04T05:52:54Z
|
mmm a / . appveyor . yml <nl> ppp b / . appveyor . yml <nl> skip_tags : true <nl> <nl> os : Visual Studio 2015 <nl> <nl> + branches : <nl> + except : # blacklist <nl> + - coverity_scan <nl> + <nl> environment : <nl> REPO_DIR : & REPO_DIR c : \ qbittorrent <nl> CACHE_DIR : & CACHE_DIR c : \ qbt_cache <nl>
|
[ AppveyorCI ] : Ignore coverity_scan branch
|
qbittorrent/qBittorrent
|
4ddb340a94e5cef372dc7e6c1b9dda957c2c2508
|
2017-05-18T02:19:17Z
|
mmm a / xbmc / addons / AudioEncoder . cpp <nl> ppp b / xbmc / addons / AudioEncoder . cpp <nl> namespace ADDON <nl> CAudioEncoder : : CAudioEncoder ( const AddonInfoPtr & addonInfo ) <nl> : IAddonInstanceHandler ( ADDON_INSTANCE_AUDIOENCODER , addonInfo ) <nl> { <nl> - m_struct = { { 0 } } ; <nl> + / / Create " C " interface structures , used as own parts to prevent API problems on update <nl> + m_struct . props = new AddonProps_AudioEncoder ( ) ; <nl> + m_struct . toAddon = new KodiToAddonFuncTable_AudioEncoder ( ) ; <nl> + m_struct . toKodi = new AddonToKodiFuncTable_AudioEncoder ( ) ; <nl> + } <nl> + <nl> + CAudioEncoder : : ~ CAudioEncoder ( ) <nl> + { <nl> + / / Delete " C " interface structures <nl> + delete m_struct . toAddon ; <nl> + delete m_struct . toKodi ; <nl> + delete m_struct . props ; <nl> } <nl> <nl> bool CAudioEncoder : : Init ( AddonToKodiFuncTable_AudioEncoder & callbacks ) <nl> { <nl> - m_struct . toKodi = callbacks ; <nl> - if ( CreateInstance ( & m_struct ) ! = ADDON_STATUS_OK | | ! m_struct . toAddon . start ) <nl> + * m_struct . toKodi = callbacks ; <nl> + if ( CreateInstance ( & m_struct ) ! = ADDON_STATUS_OK | | ! m_struct . toAddon - > start ) <nl> return false ; <nl> <nl> - return m_struct . toAddon . start ( & m_struct , <nl> - m_iInChannels , <nl> - m_iInSampleRate , <nl> - m_iInBitsPerSample , <nl> - m_strTitle . c_str ( ) , <nl> - m_strArtist . c_str ( ) , <nl> - m_strAlbumArtist . c_str ( ) , <nl> - m_strAlbum . c_str ( ) , <nl> - m_strYear . c_str ( ) , <nl> - m_strTrack . c_str ( ) , <nl> - m_strGenre . c_str ( ) , <nl> - m_strComment . c_str ( ) , <nl> - m_iTrackLength ) ; <nl> + return m_struct . toAddon - > start ( & m_struct , m_iInChannels , m_iInSampleRate , m_iInBitsPerSample , <nl> + m_strTitle . c_str ( ) , m_strArtist . c_str ( ) , m_strAlbumArtist . c_str ( ) , <nl> + m_strAlbum . c_str ( ) , m_strYear . c_str ( ) , m_strTrack . c_str ( ) , <nl> + m_strGenre . c_str ( ) , m_strComment . c_str ( ) , m_iTrackLength ) ; <nl> } <nl> <nl> int CAudioEncoder : : Encode ( int nNumBytesRead , uint8_t * pbtStream ) <nl> { <nl> - if ( m_struct . toAddon . encode ) <nl> - return m_struct . toAddon . encode ( & m_struct , nNumBytesRead , pbtStream ) ; <nl> + if ( m_struct . toAddon - > encode ) <nl> + return m_struct . toAddon - > encode ( & m_struct , nNumBytesRead , pbtStream ) ; <nl> return 0 ; <nl> } <nl> <nl> bool CAudioEncoder : : Close ( ) <nl> { <nl> bool ret = false ; <nl> - if ( m_struct . toAddon . finish ) <nl> - ret = m_struct . toAddon . finish ( & m_struct ) ; <nl> + if ( m_struct . toAddon - > finish ) <nl> + ret = m_struct . toAddon - > finish ( & m_struct ) ; <nl> <nl> DestroyInstance ( ) ; <nl> - m_struct = { { 0 } } ; <nl> <nl> return ret ; <nl> } <nl> mmm a / xbmc / addons / AudioEncoder . h <nl> ppp b / xbmc / addons / AudioEncoder . h <nl> namespace ADDON <nl> { <nl> public : <nl> explicit CAudioEncoder ( const AddonInfoPtr & addonInfo ) ; <nl> + ~ CAudioEncoder ( ) override ; <nl> <nl> / / Child functions related to IEncoder <nl> bool Init ( AddonToKodiFuncTable_AudioEncoder & callbacks ) override ; <nl> mmm a / xbmc / addons / kodi - addon - dev - kit / include / kodi / addon - instance / AudioEncoder . h <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / include / kodi / addon - instance / AudioEncoder . h <nl> <nl> # pragma once <nl> <nl> # include " . . / AddonBase . h " <nl> + # include " . . / c - api / addon - instance / audio_encoder . h " <nl> <nl> - namespace kodi { namespace addon { class CInstanceAudioEncoder ; } } <nl> - <nl> - extern " C " <nl> + # ifdef __cplusplus <nl> + namespace kodi <nl> + { <nl> + namespace addon <nl> { <nl> <nl> - typedef struct AddonProps_AudioEncoder <nl> + / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + / / / @ addtogroup cpp_kodi_addon_audioencoder <nl> + / / / @ brief \ cpp_class { kodi : : addon : : CInstanceAudioEncoder } <nl> + / / / * * Audio encoder add - on instance . * * \ n <nl> + / / / For audio encoders as binary add - ons . This class implements a way to handle <nl> + / / / the encode of given stream to a new format . <nl> + / / / <nl> + / / / The addon . xml defines the capabilities of this add - on . <nl> + / / / <nl> + / / / <nl> + / / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + / / / <nl> + / / / * * Here ' s an example on addon . xml : * * <nl> + / / / ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ { . xml } <nl> + / / / < extension <nl> + / / / point = " kodi . audioencoder " <nl> + / / / extension = " . flac " <nl> + / / / library_ @ PLATFORM @ = " @ LIBRARY_FILENAME @ " / > <nl> + / / / ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ <nl> + / / / <nl> + / / / Description to audio encoder related addon . xml values : <nl> + / / / | Name | Description <nl> + / / / | : mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm | mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + / / / | < b > ` point ` < / b > | Addon type specification < br > At all addon types and for this kind always < b > " kodi . audioencoder " < / b > . <nl> + / / / | < b > ` library_ @ PLATFORM @ ` < / b > | Sets the used library name , which is automatically set by cmake at addon build . <nl> + / / / | < b > ` extension ` < / b > | The file extensions / styles supported by this addon . <nl> + / / / <nl> + / / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / / <nl> + / / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / / <nl> + / / / * * Here is a code example how this addon is used : * * <nl> + / / / <nl> + / / / ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ { . cpp } <nl> + / / / # include < kodi / addon - instance / AudioEncoder . h > <nl> + / / / <nl> + / / / class ATTRIBUTE_HIDDEN CMyAudioEncoder : public kodi : : addon : : CInstanceAudioEncoder <nl> + / / / { <nl> + / / / public : <nl> + / / / CMyAudioEncoder ( KODI_HANDLE instance , const std : : string & kodiVersion ) <nl> + / / / : kodi : : addon : : CInstanceAudioEncoder ( instance , kodiVersion ) <nl> + / / / <nl> + / / / bool Init ( const std : : string & filename , unsigned int filecache , <nl> + / / / int & channels , int & samplerate , <nl> + / / / int & bitspersample , int64_t & totaltime , <nl> + / / / int & bitrate , AEDataFormat & format , <nl> + / / / std : : vector < AEChannel > & channellist ) override ; <nl> + / / / int Encode ( int numBytesRead , const uint8_t * pbtStream ) override ; <nl> + / / / bool Finish ( ) override ; / / Optional <nl> + / / / } ; <nl> + / / / <nl> + / / / CMyAudioEncoder : : CMyAudioEncoder ( KODI_HANDLE instance ) <nl> + / / / : kodi : : addon : : CInstanceAudioEncoder ( instance ) <nl> + / / / { <nl> + / / / . . . <nl> + / / / } <nl> + / / / <nl> + / / / bool CMyAudioEncoder : : Start ( int inChannels , <nl> + / / / int inRate , <nl> + / / / int inBits , <nl> + / / / const std : : string & title , <nl> + / / / const std : : string & artist , <nl> + / / / const std : : string & albumartist , <nl> + / / / const std : : string & album , <nl> + / / / const std : : string & year , <nl> + / / / const std : : string & track , <nl> + / / / const std : : string & genre , <nl> + / / / const std : : string & comment , <nl> + / / / int trackLength ) <nl> + / / / { <nl> + / / / . . . <nl> + / / / return true ; <nl> + / / / } <nl> + / / / <nl> + / / / int CMyAudioEncoder : : Encode ( int numBytesRead , const uint8_t * pbtStream ) <nl> + / / / { <nl> + / / / uint8_t * data = nullptr ; <nl> + / / / int length = 0 ; <nl> + / / / . . . <nl> + / / / kodi : : addon : : CInstanceAudioEncoder : : Write ( data , length ) ; <nl> + / / / <nl> + / / / return 0 ; <nl> + / / / } <nl> + / / / <nl> + / / / <nl> + / / / bool CMyAudioEncoder : : Finish ( ) <nl> + / / / { <nl> + / / / . . . <nl> + / / / return true ; <nl> + / / / } <nl> + / / / <nl> + / / / / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + / / / <nl> + / / / class CMyAddon : public kodi : : addon : : CAddonBase <nl> + / / / { <nl> + / / / public : <nl> + / / / CMyAddon ( ) = default ; <nl> + / / / ADDON_STATUS CreateInstance ( int instanceType , <nl> + / / / const std : : string & instanceID , <nl> + / / / KODI_HANDLE instance , <nl> + / / / const std : : string & version , <nl> + / / / KODI_HANDLE & addonInstance ) override ; <nl> + / / / } ; <nl> + / / / <nl> + / / / / / If you use only one instance in your add - on , can be instanceType and <nl> + / / / / / instanceID ignored <nl> + / / / ADDON_STATUS CMyAddon : : CreateInstance ( int instanceType , <nl> + / / / const std : : string & instanceID , <nl> + / / / KODI_HANDLE instance , <nl> + / / / const std : : string & version , <nl> + / / / KODI_HANDLE & addonInstance ) <nl> + / / / { <nl> + / / / if ( instanceType = = ADDON_INSTANCE_AUDIOENCODER ) <nl> + / / / { <nl> + / / / kodi : : Log ( ADDON_LOG_NOTICE , " Creating my audio encoder instance " ) ; <nl> + / / / addonInstance = new CMyAudioEncoder ( instance , version ) ; <nl> + / / / return ADDON_STATUS_OK ; <nl> + / / / } <nl> + / / / else if ( . . . ) <nl> + / / / { <nl> + / / / . . . <nl> + / / / } <nl> + / / / return ADDON_STATUS_UNKNOWN ; <nl> + / / / } <nl> + / / / <nl> + / / / ADDONCREATOR ( CMyAddon ) <nl> + / / / ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ <nl> + / / / <nl> + / / / The destruction of the example class ` CMyAudioEncoder ` is called from <nl> + / / / Kodi ' s header . Manually deleting the add - on instance is not required . <nl> + / / / <nl> + class ATTRIBUTE_HIDDEN CInstanceAudioEncoder : public IAddonInstance <nl> + { <nl> + public : <nl> + / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + / / / @ ingroup cpp_kodi_addon_audioencoder <nl> + / / / @ brief Audio encoder class constructor used to support multiple instances . <nl> + / / / <nl> + / / / @ param [ in ] instance The instance value given to <nl> + / / / < b > ` kodi : : addon : : CAddonBase : : CreateInstance ( . . . ) ` < / b > . <nl> + / / / @ param [ in ] kodiVersion [ opt ] Version used in Kodi for this instance , to <nl> + / / / allow compatibility to older Kodi versions . <nl> + / / / <nl> + / / / @ note Recommended to set < b > ` kodiVersion ` < / b > . <nl> + / / / <nl> + / / / <nl> + / / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / / <nl> + / / / * * Here ' s example about the use of this : * * <nl> + / / / ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ { . cpp } <nl> + / / / class CMyAudioEncoder : public kodi : : addon : : CInstanceAudioEncoder <nl> + / / / { <nl> + / / / public : <nl> + / / / CMyAudioEncoder ( KODI_HANDLE instance , const std : : string & kodiVersion ) <nl> + / / / : kodi : : addon : : CInstanceAudioEncoder ( instance , kodiVersion ) <nl> + / / / { <nl> + / / / . . . <nl> + / / / } <nl> + / / / <nl> + / / / . . . <nl> + / / / } ; <nl> + / / / <nl> + / / / ADDON_STATUS CMyAddon : : CreateInstance ( int instanceType , <nl> + / / / const std : : string & instanceID , <nl> + / / / KODI_HANDLE instance , <nl> + / / / const std : : string & version , <nl> + / / / KODI_HANDLE & addonInstance ) <nl> + / / / { <nl> + / / / kodi : : Log ( ADDON_LOG_NOTICE , " Creating my audio encoder instance " ) ; <nl> + / / / addonInstance = new CMyAudioEncoder ( instance , version ) ; <nl> + / / / return ADDON_STATUS_OK ; <nl> + / / / } <nl> + / / / ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ <nl> + / / / <nl> + explicit CInstanceAudioEncoder ( KODI_HANDLE instance , const std : : string & kodiVersion = " " ) <nl> + : IAddonInstance ( ADDON_INSTANCE_AUDIOENCODER , <nl> + ! kodiVersion . empty ( ) ? kodiVersion <nl> + : GetKodiTypeVersion ( ADDON_INSTANCE_AUDIOENCODER ) ) <nl> { <nl> - int dummy ; <nl> - } AddonProps_AudioEncoder ; <nl> + if ( CAddonBase : : m_interface - > globalSingleInstance ! = nullptr ) <nl> + throw std : : logic_error ( " kodi : : addon : : CInstanceAudioEncoder : Creation of multiple together " <nl> + " with single instance way is not allowed ! " ) ; <nl> <nl> - typedef struct AddonToKodiFuncTable_AudioEncoder <nl> + SetAddonStruct ( instance ) ; <nl> + } <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + <nl> + / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + / / / @ ingroup cpp_kodi_addon_audioencoder <nl> + / / / @ brief Start encoder ( * * required * * ) <nl> + / / / <nl> + / / / @ param [ in ] inChannels Number of channels <nl> + / / / @ param [ in ] inRate Sample rate of input data <nl> + / / / @ param [ in ] inBits Bits per sample in input data <nl> + / / / @ param [ in ] title The title of the song <nl> + / / / @ param [ in ] artist The artist of the song <nl> + / / / @ param [ in ] albumartist The albumartist of the song <nl> + / / / @ param [ in ] year The year of the song <nl> + / / / @ param [ in ] track The track number of the song <nl> + / / / @ param [ in ] genre The genre of the song <nl> + / / / @ param [ in ] comment A comment to attach to the song <nl> + / / / @ param [ in ] trackLength Total track length in seconds <nl> + / / / @ return True on success , false on failure . <nl> + / / / <nl> + virtual bool Start ( int inChannels , <nl> + int inRate , <nl> + int inBits , <nl> + const std : : string & title , <nl> + const std : : string & artist , <nl> + const std : : string & albumartist , <nl> + const std : : string & album , <nl> + const std : : string & year , <nl> + const std : : string & track , <nl> + const std : : string & genre , <nl> + const std : : string & comment , <nl> + int trackLength ) = 0 ; <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + <nl> + / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + / / / @ ingroup cpp_kodi_addon_audioencoder <nl> + / / / @ brief Encode a chunk of audio ( * * required * * ) <nl> + / / / <nl> + / / / @ param [ in ] numBytesRead Number of bytes in input buffer <nl> + / / / @ param [ in ] pbtStream The input buffer <nl> + / / / @ return Number of bytes consumed <nl> + / / / <nl> + virtual int Encode ( int numBytesRead , const uint8_t * pbtStream ) = 0 ; <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + <nl> + / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + / / / @ ingroup cpp_kodi_addon_audioencoder <nl> + / / / @ brief Finalize encoding ( * * optional * * ) <nl> + / / / <nl> + / / / @ return True on success , false on failure . <nl> + / / / <nl> + virtual bool Finish ( ) { return true ; } <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + <nl> + / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + / / / @ ingroup cpp_kodi_addon_audioencoder <nl> + / / / @ brief Write block of data <nl> + / / / <nl> + / / / @ param [ in ] data Pointer to the array of elements to be written <nl> + / / / @ param [ in ] length Size in bytes to be written . <nl> + / / / @ return The total number of bytes successfully written is returned . <nl> + / / / <nl> + / / / @ remarks Only called from addon itself . <nl> + / / / <nl> + int Write ( const uint8_t * data , int length ) <nl> { <nl> - void * kodiInstance ; <nl> - int ( * write ) ( void * kodiInstance , const uint8_t * data , int len ) ; <nl> - int64_t ( * seek ) ( void * kodiInstance , int64_t pos , int whence ) ; <nl> - } AddonToKodiFuncTable_AudioEncoder ; <nl> + return m_instanceData - > toKodi - > write ( m_instanceData - > toKodi - > kodiInstance , data , length ) ; <nl> + } <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> <nl> - struct AddonInstance_AudioEncoder ; <nl> - typedef struct KodiToAddonFuncTable_AudioEncoder <nl> + / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + / / / @ ingroup cpp_kodi_addon_audioencoder <nl> + / / / @ brief Set the file ' s current position . <nl> + / / / <nl> + / / / The whence argument is optional and defaults to SEEK_SET ( 0 ) <nl> + / / / <nl> + / / / @ param [ in ] position The position that you want to seek to <nl> + / / / @ param [ in ] whence [ optional ] offset relative to \ n <nl> + / / / You can set the value of whence to one <nl> + / / / of three things : <nl> + / / / | Value | int | Description | <nl> + / / / | : mmmmmm - - : | : mmm : | : mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm | <nl> + / / / | SEEK_SET | 0 | position is relative to the beginning of the file . This is probably what you had in mind anyway , and is the most commonly used value for whence . <nl> + / / / | SEEK_CUR | 1 | position is relative to the current file pointer position . So , in effect , you can say , " Move to my current position plus 30 bytes , " or , " move to my current position minus 20 bytes . " <nl> + / / / | SEEK_END | 2 | position is relative to the end of the file . Just like SEEK_SET except from the other end of the file . Be sure to use negative values for offset if you want to back up from the end of the file , instead of going past the end into oblivion . <nl> + / / / <nl> + / / / @ return Returns the resulting offset location as measured in bytes from <nl> + / / / the beginning of the file . On error , the value - 1 is returned . <nl> + / / / <nl> + / / / @ remarks Only called from addon itself . <nl> + / / / <nl> + int64_t Seek ( int64_t position , int whence = SEEK_SET ) <nl> { <nl> - kodi : : addon : : CInstanceAudioEncoder * addonInstance ; <nl> - bool ( __cdecl * start ) ( const AddonInstance_AudioEncoder * instance , int in_channels , int in_rate , int in_bits , <nl> - const char * title , const char * artist , <nl> - const char * albumartist , const char * album , <nl> - const char * year , const char * track , <nl> - const char * genre , const char * comment , <nl> - int track_length ) ; <nl> - int ( __cdecl * encode ) ( const AddonInstance_AudioEncoder * instance , int num_bytes_read , const uint8_t * pbt_stream ) ; <nl> - bool ( __cdecl * finish ) ( const AddonInstance_AudioEncoder * instance ) ; <nl> - } KodiToAddonFuncTable_AudioEncoder ; <nl> - <nl> - typedef struct AddonInstance_AudioEncoder <nl> + return m_instanceData - > toKodi - > seek ( m_instanceData - > toKodi - > kodiInstance , position , whence ) ; <nl> + } <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + <nl> + private : <nl> + void SetAddonStruct ( KODI_HANDLE instance ) <nl> { <nl> - AddonProps_AudioEncoder props ; <nl> - AddonToKodiFuncTable_AudioEncoder toKodi ; <nl> - KodiToAddonFuncTable_AudioEncoder toAddon ; <nl> - } AddonInstance_AudioEncoder ; <nl> + if ( instance = = nullptr ) <nl> + throw std : : logic_error ( " kodi : : addon : : CInstanceAudioEncoder : Creation with empty addon " <nl> + " structure not allowed , table must be given from Kodi ! " ) ; <nl> <nl> - } / * extern " C " * / <nl> + m_instanceData = static_cast < AddonInstance_AudioEncoder * > ( instance ) ; <nl> + m_instanceData - > toAddon - > addonInstance = this ; <nl> + m_instanceData - > toAddon - > start = ADDON_Start ; <nl> + m_instanceData - > toAddon - > encode = ADDON_Encode ; <nl> + m_instanceData - > toAddon - > finish = ADDON_Finish ; <nl> + } <nl> <nl> - namespace kodi <nl> - { <nl> - namespace addon <nl> - { <nl> + inline static bool ADDON_Start ( const AddonInstance_AudioEncoder * instance , <nl> + int inChannels , <nl> + int inRate , <nl> + int inBits , <nl> + const char * title , <nl> + const char * artist , <nl> + const char * albumartist , <nl> + const char * album , <nl> + const char * year , <nl> + const char * track , <nl> + const char * genre , <nl> + const char * comment , <nl> + int trackLength ) <nl> + { <nl> + return static_cast < CInstanceAudioEncoder * > ( instance - > toAddon - > addonInstance ) <nl> + - > Start ( inChannels , inRate , inBits , title , artist , albumartist , album , year , track , genre , <nl> + comment , trackLength ) ; <nl> + } <nl> <nl> - class ATTRIBUTE_HIDDEN CInstanceAudioEncoder : public IAddonInstance <nl> + inline static int ADDON_Encode ( const AddonInstance_AudioEncoder * instance , <nl> + int numBytesRead , <nl> + const uint8_t * pbtStream ) <nl> { <nl> - public : <nl> - / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> - / / / @ brief Class constructor <nl> - / / / <nl> - / / / @ param [ in ] instance The from Kodi given instance given be <nl> - / / / add - on CreateInstance call with instance <nl> - / / / id ADDON_INSTANCE_AUDIOENCODER . <nl> - / / / @ param [ in ] kodiVersion [ opt ] Version used in Kodi for this instance , to <nl> - / / / allow compatibility to older Kodi versions . <nl> - / / / @ note Recommended to set . <nl> - / / / <nl> - explicit CInstanceAudioEncoder ( KODI_HANDLE instance , const std : : string & kodiVersion = " " ) <nl> - : IAddonInstance ( ADDON_INSTANCE_AUDIOENCODER , <nl> - ! kodiVersion . empty ( ) ? kodiVersion <nl> - : GetKodiTypeVersion ( ADDON_INSTANCE_AUDIOENCODER ) ) <nl> - { <nl> - if ( CAddonBase : : m_interface - > globalSingleInstance ! = nullptr ) <nl> - throw std : : logic_error ( " kodi : : addon : : CInstanceAudioEncoder : Creation of multiple together with single instance way is not allowed ! " ) ; <nl> - <nl> - SetAddonStruct ( instance ) ; <nl> - } <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> - / / / \ brief Start encoder ( * * required * * ) <nl> - / / / <nl> - / / / \ param [ in ] inChannels Number of channels <nl> - / / / \ param [ in ] inRate Sample rate of input data <nl> - / / / \ param [ in ] inBits Bits per sample in input data <nl> - / / / \ param [ in ] title The title of the song <nl> - / / / \ param [ in ] artist The artist of the song <nl> - / / / \ param [ in ] albumartist The albumartist of the song <nl> - / / / \ param [ in ] year The year of the song <nl> - / / / \ param [ in ] track The track number of the song <nl> - / / / \ param [ in ] genre The genre of the song <nl> - / / / \ param [ in ] comment A comment to attach to the song <nl> - / / / \ param [ in ] trackLength Total track length in seconds <nl> - / / / \ return True on success , false on failure . <nl> - / / / <nl> - virtual bool Start ( int inChannels , <nl> - int inRate , <nl> - int inBits , <nl> - const std : : string & title , <nl> - const std : : string & artist , <nl> - const std : : string & albumartist , <nl> - const std : : string & album , <nl> - const std : : string & year , <nl> - const std : : string & track , <nl> - const std : : string & genre , <nl> - const std : : string & comment , <nl> - int trackLength ) = 0 ; <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> - / / / \ brief Encode a chunk of audio ( * * required * * ) <nl> - / / / <nl> - / / / \ param [ in ] numBytesRead Number of bytes in input buffer <nl> - / / / \ param [ in ] pbtStream the input buffer <nl> - / / / \ return Number of bytes consumed <nl> - / / / <nl> - virtual int Encode ( int numBytesRead , const uint8_t * pbtStream ) = 0 ; <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> - / / / \ brief Finalize encoding ( * * optional * * ) <nl> - / / / <nl> - / / / \ return True on success , false on failure . <nl> - / / / <nl> - virtual bool Finish ( ) { return true ; } <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> - / / / \ brief Write block of data <nl> - / / / <nl> - / / / \ param [ in ] data Pointer to the array of elements to be <nl> - / / / written <nl> - / / / \ param [ in ] length Size in bytes to be written . <nl> - / / / \ return The total number of bytes <nl> - / / / successfully written is returned . <nl> - int Write ( const uint8_t * data , int length ) <nl> - { <nl> - return m_instanceData - > toKodi . write ( m_instanceData - > toKodi . kodiInstance , data , length ) ; <nl> - } <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> - / / / \ brief Set the file ' s current position . <nl> - / / / <nl> - / / / The whence argument is optional and defaults to SEEK_SET ( 0 ) <nl> - / / / <nl> - / / / \ param [ in ] position the position that you want to seek to <nl> - / / / \ param [ in ] whence [ optional ] offset relative to <nl> - / / / You can set the value of whence to one <nl> - / / / of three things : <nl> - / / / | Value | int | Description | <nl> - / / / | : mmmmmm - - : | : mmm : | : mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm | <nl> - / / / | SEEK_SET | 0 | position is relative to the beginning of the file . This is probably what you had in mind anyway , and is the most commonly used value for whence . <nl> - / / / | SEEK_CUR | 1 | position is relative to the current file pointer position . So , in effect , you can say , " Move to my current position plus 30 bytes , " or , " move to my current position minus 20 bytes . " <nl> - / / / | SEEK_END | 2 | position is relative to the end of the file . Just like SEEK_SET except from the other end of the file . Be sure to use negative values for offset if you want to back up from the end of the file , instead of going past the end into oblivion . <nl> - / / / <nl> - / / / \ return Returns the resulting offset location as <nl> - / / / measured in bytes from the beginning of <nl> - / / / the file . On error , the value - 1 is <nl> - / / / returned . <nl> - int64_t Seek ( int64_t position , int whence = SEEK_SET ) <nl> - { <nl> - return m_instanceData - > toKodi . seek ( m_instanceData - > toKodi . kodiInstance , position , whence ) ; <nl> - } <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - private : <nl> - void SetAddonStruct ( KODI_HANDLE instance ) <nl> - { <nl> - if ( instance = = nullptr ) <nl> - throw std : : logic_error ( " kodi : : addon : : CInstanceAudioEncoder : Creation with empty addon structure not allowed , table must be given from Kodi ! " ) ; <nl> - <nl> - m_instanceData = static_cast < AddonInstance_AudioEncoder * > ( instance ) ; <nl> - m_instanceData - > toAddon . addonInstance = this ; <nl> - m_instanceData - > toAddon . start = ADDON_Start ; <nl> - m_instanceData - > toAddon . encode = ADDON_Encode ; <nl> - m_instanceData - > toAddon . finish = ADDON_Finish ; <nl> - } <nl> - <nl> - inline static bool ADDON_Start ( const AddonInstance_AudioEncoder * instance , int inChannels , int inRate , int inBits , <nl> - const char * title , const char * artist , <nl> - const char * albumartist , const char * album , <nl> - const char * year , const char * track , <nl> - const char * genre , const char * comment , <nl> - int trackLength ) <nl> - { <nl> - return instance - > toAddon . addonInstance - > Start ( inChannels , <nl> - inRate , <nl> - inBits , <nl> - title , <nl> - artist , <nl> - albumartist , <nl> - album , <nl> - year , <nl> - track , <nl> - genre , <nl> - comment , <nl> - trackLength ) ; <nl> - } <nl> - <nl> - inline static int ADDON_Encode ( const AddonInstance_AudioEncoder * instance , int numBytesRead , const uint8_t * pbtStream ) <nl> - { <nl> - return instance - > toAddon . addonInstance - > Encode ( numBytesRead , pbtStream ) ; <nl> - } <nl> - <nl> - inline static bool ADDON_Finish ( const AddonInstance_AudioEncoder * instance ) <nl> - { <nl> - return instance - > toAddon . addonInstance - > Finish ( ) ; <nl> - } <nl> - <nl> - AddonInstance_AudioEncoder * m_instanceData ; <nl> - } ; <nl> + return static_cast < CInstanceAudioEncoder * > ( instance - > toAddon - > addonInstance ) <nl> + - > Encode ( numBytesRead , pbtStream ) ; <nl> + } <nl> + <nl> + inline static bool ADDON_Finish ( const AddonInstance_AudioEncoder * instance ) <nl> + { <nl> + return static_cast < CInstanceAudioEncoder * > ( instance - > toAddon - > addonInstance ) - > Finish ( ) ; <nl> + } <nl> + <nl> + AddonInstance_AudioEncoder * m_instanceData ; <nl> + } ; <nl> <nl> } / * namespace addon * / <nl> } / * namespace kodi * / <nl> + <nl> + # endif / * __cplusplus * / <nl> mmm a / xbmc / addons / kodi - addon - dev - kit / include / kodi / c - api / addon - instance / CMakeLists . txt <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / include / kodi / c - api / addon - instance / CMakeLists . txt <nl> <nl> - set ( HEADERS image_decoder . h <nl> + set ( HEADERS audio_encoder . h <nl> + image_decoder . h <nl> pvr . h ) <nl> <nl> if ( NOT ENABLE_STATIC_LIBS ) <nl> new file mode 100644 <nl> index 000000000000 . . 408085811cfb <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / include / kodi / c - api / addon - instance / audio_encoder . h <nl> <nl> + / * <nl> + * Copyright ( C ) 2005 - 2018 Team Kodi <nl> + * This file is part of Kodi - https : / / kodi . tv <nl> + * <nl> + * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> + * See LICENSES / README . md for more information . <nl> + * / <nl> + <nl> + # pragma once <nl> + <nl> + # include " . . / addon_base . h " <nl> + <nl> + # ifdef __cplusplus <nl> + extern " C " <nl> + { <nl> + # endif / * __cplusplus * / <nl> + <nl> + typedef struct AddonProps_AudioEncoder <nl> + { <nl> + int dummy ; <nl> + } AddonProps_AudioEncoder ; <nl> + <nl> + typedef struct AddonToKodiFuncTable_AudioEncoder <nl> + { <nl> + KODI_HANDLE kodiInstance ; <nl> + int ( * write ) ( KODI_HANDLE kodiInstance , const uint8_t * data , int len ) ; <nl> + int64_t ( * seek ) ( KODI_HANDLE kodiInstance , int64_t pos , int whence ) ; <nl> + } AddonToKodiFuncTable_AudioEncoder ; <nl> + <nl> + struct AddonInstance_AudioEncoder ; <nl> + typedef struct KodiToAddonFuncTable_AudioEncoder <nl> + { <nl> + KODI_HANDLE addonInstance ; <nl> + bool ( __cdecl * start ) ( const struct AddonInstance_AudioEncoder * instance , <nl> + int in_channels , <nl> + int in_rate , <nl> + int in_bits , <nl> + const char * title , <nl> + const char * artist , <nl> + const char * albumartist , <nl> + const char * album , <nl> + const char * year , <nl> + const char * track , <nl> + const char * genre , <nl> + const char * comment , <nl> + int track_length ) ; <nl> + int ( __cdecl * encode ) ( const struct AddonInstance_AudioEncoder * instance , <nl> + int num_bytes_read , <nl> + const uint8_t * pbt_stream ) ; <nl> + bool ( __cdecl * finish ) ( const struct AddonInstance_AudioEncoder * instance ) ; <nl> + } KodiToAddonFuncTable_AudioEncoder ; <nl> + <nl> + typedef struct AddonInstance_AudioEncoder <nl> + { <nl> + struct AddonProps_AudioEncoder * props ; <nl> + struct AddonToKodiFuncTable_AudioEncoder * toKodi ; <nl> + struct KodiToAddonFuncTable_AudioEncoder * toAddon ; <nl> + } AddonInstance_AudioEncoder ; <nl> + <nl> + # ifdef __cplusplus <nl> + } / * extern " C " * / <nl> + # endif / * __cplusplus * / <nl> mmm a / xbmc / addons / kodi - addon - dev - kit / include / kodi / versions . h <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / include / kodi / versions . h <nl> <nl> # define ADDON_INSTANCE_VERSION_AUDIODECODER_XML_ID " kodi . binary . instance . audiodecoder " <nl> # define ADDON_INSTANCE_VERSION_AUDIODECODER_DEPENDS " addon - instance / AudioDecoder . h " <nl> <nl> - # define ADDON_INSTANCE_VERSION_AUDIOENCODER " 2 . 0 . 2 " <nl> - # define ADDON_INSTANCE_VERSION_AUDIOENCODER_MIN " 2 . 0 . 1 " <nl> + # define ADDON_INSTANCE_VERSION_AUDIOENCODER " 2 . 1 . 0 " <nl> + # define ADDON_INSTANCE_VERSION_AUDIOENCODER_MIN " 2 . 1 . 0 " <nl> # define ADDON_INSTANCE_VERSION_AUDIOENCODER_XML_ID " kodi . binary . instance . audioencoder " <nl> - # define ADDON_INSTANCE_VERSION_AUDIOENCODER_DEPENDS " addon - instance / AudioEncoder . h " <nl> + # define ADDON_INSTANCE_VERSION_AUDIOENCODER_DEPENDS " c - api / addon - instance / audio_encoder . h " \ <nl> + " addon - instance / AudioEncoder . h " <nl> <nl> # define ADDON_INSTANCE_VERSION_GAME " 2 . 0 . 2 " <nl> # define ADDON_INSTANCE_VERSION_GAME_MIN " 2 . 0 . 1 " <nl>
|
Merge pull request from AlwinEsch / audio - encoder - change
|
xbmc/xbmc
|
7bd921c5f38bfe93f97433e661c6d9e1ca6665f3
|
2020-07-30T19:57:06Z
|
mmm a / xbmc / guilib / GUIControlFactory . cpp <nl> ppp b / xbmc / guilib / GUIControlFactory . cpp <nl> CGUIControl * CGUIControlFactory : : Create ( int parentID , const CRect & rect , TiXmlEl <nl> <nl> CRect hitRect ; <nl> CPoint camera ; <nl> + float stereo = 0 . f ; <nl> bool hasCamera = false ; <nl> bool resetOnLabelChange = true ; <nl> bool bPassword = false ; <nl> CGUIControl * CGUIControlFactory : : Create ( int parentID , const CRect & rect , TiXmlEl <nl> cam - > QueryFloatAttribute ( " y " , & camera . y ) ; <nl> } <nl> <nl> + if ( XMLUtils : : GetFloat ( pControlNode , " depth " , stereo ) ) <nl> + stereo = std : : max ( - 1 . f , std : : min ( 1 . f , stereo ) ) ; <nl> + <nl> XMLUtils : : GetInt ( pControlNode , " scrollspeed " , labelInfo . scrollSpeed ) ; <nl> spinInfo . scrollSpeed = labelInfo . scrollSpeed ; <nl> <nl> CGUIControl * CGUIControlFactory : : Create ( int parentID , const CRect & rect , TiXmlEl <nl> control - > SetPulseOnSelect ( bPulse ) ; <nl> if ( hasCamera ) <nl> control - > SetCamera ( camera ) ; <nl> + control - > SetStereoFactor ( stereo ) ; <nl> } <nl> return control ; <nl> } <nl>
|
[ guilib ] ControlFactory : added new < depth > tag which define on how control will be " in front " or " in back " in stereo mode .
|
xbmc/xbmc
|
cf0eab1714546926bcd6147494247fdfdd07d043
|
2015-08-28T07:58:28Z
|
mmm a / src / webui / www / public / scripts / client . js <nl> ppp b / src / webui / www / public / scripts / client . js <nl> window . addEvent ( ' load ' , function ( ) { <nl> <nl> var addTorrentToCategoryList = function ( torrent ) { <nl> var category = torrent [ ' category ' ] ; <nl> - if ( category = = = null ) <nl> + if ( typeof category = = = ' undefined ' ) <nl> return false ; <nl> if ( category . length = = = 0 ) { / / Empty category <nl> removeTorrentFromCategoryList ( torrent [ ' hash ' ] ) ; <nl> mmm a / src / webui / www / public / scripts / dynamicTable . js <nl> ppp b / src / webui / www / public / scripts / dynamicTable . js <nl> var TorrentsTable = new Class ( { <nl> break ; <nl> case ' inactive ' : <nl> inactive = true ; <nl> - break ; <nl> + / / fallthrough <nl> case ' active ' : <nl> if ( state = = ' stalledDL ' ) <nl> r = ( row [ ' full_data ' ] . upspeed > 0 ) ; <nl>
|
Merge pull request from Chocobo1 / js
|
qbittorrent/qBittorrent
|
f345d0f13615e7c5d089831beba6a60acbf15fdd
|
2017-07-11T09:23:32Z
|
mmm a / editor / debugger / editor_debugger_node . cpp <nl> ppp b / editor / debugger / editor_debugger_node . cpp <nl> void EditorDebuggerNode : : _notification ( int p_what ) { <nl> debugger_button - > set_icon ( Ref < Texture2D > ( ) ) ; <nl> } else { <nl> debugger_button - > set_text ( TTR ( " Debugger " ) + " ( " + itos ( error_count + warning_count ) + " ) " ) ; <nl> - if ( error_count = = 0 ) { <nl> - debugger_button - > set_icon ( get_theme_icon ( " Warning " , " EditorIcons " ) ) ; <nl> - } else { <nl> + if ( error_count > = 1 & & warning_count > = 1 ) { <nl> + debugger_button - > set_icon ( get_theme_icon ( " ErrorWarning " , " EditorIcons " ) ) ; <nl> + } else if ( error_count > = 1 ) { <nl> debugger_button - > set_icon ( get_theme_icon ( " Error " , " EditorIcons " ) ) ; <nl> + } else { <nl> + debugger_button - > set_icon ( get_theme_icon ( " Warning " , " EditorIcons " ) ) ; <nl> } <nl> } <nl> last_error_count = error_count ; <nl> mmm a / editor / debugger / script_editor_debugger . cpp <nl> ppp b / editor / debugger / script_editor_debugger . cpp <nl> void ScriptEditorDebugger : : update_tabs ( ) { <nl> tabs - > set_tab_icon ( errors_tab - > get_index ( ) , Ref < Texture2D > ( ) ) ; <nl> } else { <nl> errors_tab - > set_name ( TTR ( " Errors " ) + " ( " + itos ( error_count + warning_count ) + " ) " ) ; <nl> - if ( error_count = = 0 ) { <nl> - tabs - > set_tab_icon ( errors_tab - > get_index ( ) , get_theme_icon ( " Warning " , " EditorIcons " ) ) ; <nl> - } else { <nl> + if ( error_count > = 1 & & warning_count > = 1 ) { <nl> + tabs - > set_tab_icon ( errors_tab - > get_index ( ) , get_theme_icon ( " ErrorWarning " , " EditorIcons " ) ) ; <nl> + } else if ( error_count > = 1 ) { <nl> tabs - > set_tab_icon ( errors_tab - > get_index ( ) , get_theme_icon ( " Error " , " EditorIcons " ) ) ; <nl> + } else { <nl> + tabs - > set_tab_icon ( errors_tab - > get_index ( ) , get_theme_icon ( " Warning " , " EditorIcons " ) ) ; <nl> } <nl> } <nl> } <nl> new file mode 100644 <nl> index 00000000000 . . 72b5037e50a <nl> mmm / dev / null <nl> ppp b / editor / icons / ErrorWarning . svg <nl> @ @ - 0 , 0 + 1 @ @ <nl> + < svg height = " 8 " viewBox = " 0 0 8 8 " width = " 8 " xmlns = " http : / / www . w3 . org / 2000 / svg " > < path d = " m4 0c - 2 . 216 0 - 4 1 . 784 - 4 4s1 . 784 4 4 4z " fill = " # ff5d5d " / > < path d = " m4 . 00000003c2 . 216 0 4 1 . 78399997 4 3 . 99999997s - 1 . 784 4 - 4 4z " fill = " # ffdd65 " / > < / svg > <nl> \ No newline at end of file <nl>
|
Use a different icon for the debugger tab with both warnings and errors
|
godotengine/godot
|
564f8ccc1311f7f2a76e583d36d9f76347106f16
|
2020-05-09T13:29:13Z
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.