diff --git a/DittoToolsApp/DittoToolsApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DittoToolsApp/DittoToolsApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 3adf7cc..0000000 --- a/DittoToolsApp/DittoToolsApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,23 +0,0 @@ -{ - "pins" : [ - { - "identity" : "dittoswiftpackage", - "kind" : "remoteSourceControl", - "location" : "https://github.com/getditto/DittoSwiftPackage", - "state" : { - "revision" : "fb4ee210d85380084f9bdd26cd5bb987db971da2", - "version" : "4.8.0" - } - }, - { - "identity" : "swift-collections", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-collections", - "state" : { - "revision" : "3d2dc41a01f9e49d84f0a3925fb858bed64f702d", - "version" : "1.1.2" - } - } - ], - "version" : 2 -} diff --git a/Package.swift b/Package.swift index 54de2b4..59951f0 100644 --- a/Package.swift +++ b/Package.swift @@ -13,10 +13,6 @@ let package = Package( name: "DittoHealthMetrics", targets: ["DittoHealthMetrics"] ), - .library( - name: "DittoPresenceViewer", - targets: ["DittoPresenceViewer"] - ), .library( name: "DittoDataBrowser", targets: ["DittoDataBrowser"] @@ -54,24 +50,11 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/getditto/DittoSwiftPackage", from: "4.8.0"), + .package(url: "https://github.com/getditto/DittoPresenceViewer.git", from: "1.0.0"), .package(url: "https://github.com/apple/swift-collections", from: "1.0.0") ], targets: [ .target(name: "DittoHealthMetrics"), - .target( - name: "DittoPresenceViewer", - dependencies: [ - .product(name: "DittoSwift", package: "DittoSwiftPackage") - ], - resources: [ - .copy("Resources/index.html"), - .copy("Resources/main.css"), - .copy("Resources/main.js"), - ], - cxxSettings: [ - .define("ENABLE_BITCODE", to: "NO") - ] - ), .target( name: "DittoDataBrowser", dependencies: [ @@ -129,7 +112,7 @@ let package = Package( name: "DittoAllToolsMenu", dependencies: [ "DittoHealthMetrics", - "DittoPresenceViewer", + .product(name: "DittoPresenceViewer", package: "DittoPresenceViewer"), "DittoDataBrowser", "DittoExportLogs", "DittoDiskUsage", diff --git a/Sources/DittoPresenceViewer/Bundle+FrameworkBundle.swift b/Sources/DittoPresenceViewer/Bundle+FrameworkBundle.swift deleted file mode 100644 index b4943b6..0000000 --- a/Sources/DittoPresenceViewer/Bundle+FrameworkBundle.swift +++ /dev/null @@ -1,20 +0,0 @@ -// -// Copyright © 2020 DittoLive Incorporated. All rights reserved. -// - -import Foundation - -extension Bundle { - - // https://blog.sabintsev.com/simultaneously-supporting-bundle-resources-in-swift-package-manager-and-cocoapods-3fa35f4bce4e - static var presenceViewerResourceBundle: Bundle { -#if SWIFT_PACKAGE - // Auto-generated for swift package - // https://developer.apple.com/forums/thread/650158?answerId=614513022#614513022 - Bundle.module -#else - Bundle(for: DittoPresenceView.self) -#endif - } - -} diff --git a/Sources/DittoPresenceViewer/DittoPresenceView.swift b/Sources/DittoPresenceViewer/DittoPresenceView.swift deleted file mode 100644 index ddd264d..0000000 --- a/Sources/DittoPresenceViewer/DittoPresenceView.swift +++ /dev/null @@ -1,186 +0,0 @@ -// -// Copyright © 2020 DittoLive Incorporated. All rights reserved. -// - -#if canImport(WebKit) -import WebKit -#endif - -import DittoSwift - -#if canImport(UIKit) -import UIKit -public typealias PlatformView = UIView -public typealias PlatformViewController = UIViewController -#endif - -#if !targetEnvironment(macCatalyst) -#if canImport(AppKit) -import AppKit -public typealias PlatformView = NSView -public typealias PlatformViewController = NSViewController -#endif -#endif - -/** - The `DittoPresenceView` offers a visualization of the current - state of peers in a ditto mesh. - - A `DittoPresenceView` can be added to any view as a child or - alternatively, it can be added as a view controller. - - ```swift - import DittoSwift - import DittoSwiftPresenceViewer - - let ditto: Ditto - - func showPresence() { - let presenceView = DittoPresenceView(ditto: ditto) - // maybe add it to an existing view - self.view.addSubview(presenceView) - - // or add it as a view controller - let viewController = DittoPresenceView(ditto: ditto).viewController - present(viewController: viewController, animated: true) - } - ``` - */ -public class DittoPresenceView: PlatformView { - - // MARK: Public Properties - - /** - The `Ditto` object for which you would like to visualize presence data. - The `DittoPresenceView` will not display any presence information - until the `ditto` property has been set. - */ - public weak var ditto: Ditto? { - willSet { - if (ditto !== newValue) { - self.stopObservingPresence() - } - } - - didSet { - if (oldValue !== ditto) { - self.startObservingPresence() - } - } - } - - deinit { - stopObservingPresence() - webView.removeFromSuperview() - _vc = nil - } - - /** - Returns a `UIViewController` containing this view. - */ - public var viewController: PlatformViewController { - // Note that this is a highly unusual inversion of the typical - // `UIViewController` → `UIView` relationship based on the original - // specification for this work(https://github.com/getditto/ditto/issues/789) - // but it seems to make for a nice plug-and-play API. - // - // The inversion will likely trip up more experienced native iOS - // developers, but they're also the group likely to be designing their - // own `UIViewControllers` which renders this a non-issue in most cases. - // - // Also note that we can't hold the view controller strongly here because - // this would lead to a retain cycle. Therefore, we'll hold it weakly - // and create a new one whenever the previous one is dealloced: - if let vc = self._vc { - return vc - } - - let vc = DittoPresenceViewController(view: self) - self._vc = vc - return vc - } - - // MARK: Private Properties - - private var peersObserver: DittoObserver? - - private var webView = VisJSWebView() - - private weak var _vc: DittoPresenceViewController? - - // MARK: Initializer - - /** - Initializes a new `DittoPresenceView`. - - - Parameter ditto: A reference to the `Ditto` which you would like - to visualize presence status for. - */ - public convenience init(ditto: Ditto) { - self.init(frame: .zero) - self.ditto = ditto - startObservingPresence() - } - - public override init(frame: CGRect) { - super.init(frame: frame) - setup() - } - - required init?(coder: NSCoder) { - super.init(coder: coder) - setup() - } - - - // MARK: Private Functions - - private func setup() { - -#if canImport(UIKit) - backgroundColor = .clear -#endif - - addSubview(webView) - webView.translatesAutoresizingMaskIntoConstraints = false - NSLayoutConstraint.activate([ - webView.leftAnchor.constraint(equalTo: leftAnchor), - webView.rightAnchor.constraint(equalTo: rightAnchor), - webView.topAnchor.constraint(equalTo: topAnchor), - webView.bottomAnchor.constraint(equalTo: bottomAnchor) - ]) - } - - private func startObservingPresence() { - if let ditto = ditto { - self.peersObserver = ditto.presence.observe { presenceGraph in - let encoder = JSONEncoder() - encoder.dataEncodingStrategy = .custom({ data, enc in - var container = enc.unkeyedContainer() - data.forEach { byte in - try! container.encode(byte) - } - }) - let presenceGraphJSON = try! encoder.encode(presenceGraph) - let presenceGraphJSONString = String(data: presenceGraphJSON, encoding: .utf8)! - DispatchQueue.main.async { [weak self] in - self?.webView.updateNetwork(json: presenceGraphJSONString, completionHandler: nil) - } - } - } -// // Comment out the ditto observer above and toggle following to test presence with -// // fake data. Several different mock drivers exist: -// // - runFrequentConnectionChanges() -// // - runFrequentRSSIChanges() -// // - runLargeMesh() -// // - runMassiveMesh() -// MockData.runLargeMesh() { [weak self] json in -// self?.webView.updateNetwork(json: json, completionHandler: nil) -// } - } - - private func stopObservingPresence() { - peersObserver?.stop() - peersObserver = nil - } -} diff --git a/Sources/DittoPresenceViewer/DittoPresenceViewController.swift b/Sources/DittoPresenceViewer/DittoPresenceViewController.swift deleted file mode 100644 index 48b45da..0000000 --- a/Sources/DittoPresenceViewer/DittoPresenceViewController.swift +++ /dev/null @@ -1,216 +0,0 @@ -// -// Copyright © 2020 DittoLive Incorporated. All rights reserved. -// - -#if canImport(UIKit) -import UIKit -#endif - -#if canImport(AppKit) -import AppKit -#endif - -/** - The `DittoPresenceViewController` is an internal view controller designed - to wrap a `DittoPresenceView`. - - This VC will attempt to autoconfigure to the best of its ability to support a - variety of plug-and-play use cases: - - In all situations: - - A navigation bar will be displayed, regardless of presentation within a - `UINavigationController` - - A localized title will be set in the navigation bar - - If pushed onto a navigation controller: - - the back button will be supported if a previous view controller existed on - the stack - - a close button will be added if a left navigation button doesn't already - exist (in this situation we can safely assume we were presented in a - UINavigationController only to provide us with a UINavigationBar as a place - for our title and defensively in the event that we tried to push further - content). - - If presented modally: - - a close button will be added alongside any swipe to dismiss gestures to - ensure that the modal view is accessible to assistive technologies. - */ -final class DittoPresenceViewController: PlatformViewController { - - // MARK: Constants - - private struct LocalizedStrings { - static let title = NSLocalizedString("Ditto Presence", - bundle: Bundle.presenceViewerResourceBundle, - comment: "View controller title for the presence UI") - } - - // MARK: - Properties - -#if canImport(UIKit) - /** - A close button added to the navigation bar when we are modally presented - in some manner that doesn't allow an iOS 13 modal sheet drag to dismiss - action. - */ - lazy var leftNavButton: UIBarButtonItem! = { - return .init(title: "Close", - style: .done, - target: self, - action: #selector(self.close)) - }() - - /** - A standalone navigation bar which will be used in the event that we're not - being presented within a `UINavigationController`. - */ - private lazy var navigationBar: UINavigationBar! = UINavigationBar() -#endif - - // MARK: - Initialization - - init(view: DittoPresenceView) { - super.init(nibName: nil, bundle: nil) - self.view = view -#if canImport(UIKit) - self.modalPresentationStyle = .fullScreen -#endif - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - View Life Cycle - - override func viewDidLoad() { - super.viewDidLoad() - - title = LocalizedStrings.title - -#if canImport(UIKit) -#if os(tvOS) - view.backgroundColor = .white -#else - view.backgroundColor = .systemBackground -#endif -#endif - } - -#if canImport(UIKit) - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - - addStandaloneNavigationBarIfNeeded() - addCloseButtonIfNeeded() - } -#endif - -#if !targetEnvironment(macCatalyst) -#if canImport(AppKit) - override func viewWillAppear() { - super.viewWillAppear() - - addStandaloneNavigationBarIfNeeded() - addCloseButtonIfNeeded() - } -#endif -#endif - - // MARK: - Private Functions - - /** - Adds a `UINavigationBar` to our view if we're not being presented inside a - `UINavigationController`. - - - Postcondition: The view controller should not be instantiated and then displayed - in various contexts, sometimes within a `UINavigationController` and sometimes outside - of one. We expect to be displayed in the same context each time. - */ - private func addStandaloneNavigationBarIfNeeded() { -#if canImport(UIKit) - guard navigationController == nil else { return } - - navigationItem.title = LocalizedStrings.title -#if !os(tvOS) - navigationItem.largeTitleDisplayMode = .never -#endif - - view.addSubview(navigationBar) - navigationBar.translatesAutoresizingMaskIntoConstraints = false - NSLayoutConstraint.activate([ - navigationBar.leftAnchor.constraint(equalTo: view.leftAnchor), - navigationBar.rightAnchor.constraint(equalTo: view.rightAnchor), - navigationBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor)]) - navigationBar.items = [navigationItem] - navigationBar.delegate = self -#endif - } - - /** - Adds a close button to our navigation bar if required. - - - Precondition: There should be no existing `leftBarButtonItem`. We don't want - to mess with the navigation item if a developer has already placed - a button there, or if a system-provided back button exists. - */ - private func addCloseButtonIfNeeded() { -#if canImport(UIKit) -#if !os(tvOS) - if let navigationController = navigationController, - navigationController.viewControllers.count > 1, - !navigationController.navigationItem.hidesBackButton { - return - } -#endif - -#if os(tvOS) - if let navigationController = navigationController, - navigationController.viewControllers.count > 1 { - return - } -#endif - - guard navigationItem.leftBarButtonItem == nil else { - return - } - - navigationItem.leftBarButtonItem = leftNavButton - navigationBar.setNeedsDisplay() -#endif - } - - /** - Ordinarily, `dismiss(animated:)` should be invoked by the parent `UIViewController`, - but our parent doesn't know about the temporary back button we added if required. - Regardless, this is safe to call on ourselves as UIKit will forward the invocation - to our parent in this case. - */ - @objc private func close() { -#if canImport(UIKit) - dismiss(animated: true) -#endif - -#if !targetEnvironment(macCatalyst) -#if canImport(AppKit) - dismiss(self) -#endif -#endif - } - -} - -#if canImport(UIKit) -// MARK: - UINavigationBarDelegate - -extension DittoPresenceViewController: UINavigationBarDelegate { - - /** - In the event that we created our own `UINavigationBar`, we ensure - that it is correctly docked underneath the system status bar and - visually indistinguishable from a `UINavigationBar` provided by a - `UINavigationController`. - */ - public func position(for bar: UIBarPositioning) -> UIBarPosition { - return .topAttached - } - -} -#endif diff --git a/Sources/DittoPresenceViewer/JSWebView.swift b/Sources/DittoPresenceViewer/JSWebView.swift deleted file mode 100644 index 8e1e6a2..0000000 --- a/Sources/DittoPresenceViewer/JSWebView.swift +++ /dev/null @@ -1,211 +0,0 @@ -// -// Copyright © 2020 DittoLive Incorporated. All rights reserved. -// - -import Foundation -#if canImport(WebKit) -import WebKit -#endif - -#if canImport(UIKit) -import UIKit -#endif - -#if canImport(AppKit) -import AppKit -#endif - -class JSWebView: PlatformView { - - // MARK: - Data Types - - typealias JavaScript = String - - /** - In the event that the page load hasn't completed before the first JavaScript - function is invoked, we must store the invocation and only request that the - webView interpret it once the page has fully loaded. - */ - private struct PendingJavascriptInvocation { - let coalescingIdentifier: String? - let javascript: JavaScript - let completionHandler: ((Any?, Error?) -> Void)? - } - - // MARK: - Internal Properties - - #if canImport(WebKit) - let webView = WKWebView() - #endif - - - // MARK: - Private Properties - - private var observers = [NSObjectProtocol]() - - private var pendingInvocations = [PendingJavascriptInvocation]() - - private var isInitialLoadComplete = false { didSet { processPendingInvocations() } } - - private var isBackgrounded = false { didSet { processPendingInvocations() } } - - // MARK: - Initialization - - override init(frame: CGRect) { - super.init(frame: frame) - setup() - } - - required init?(coder: NSCoder) { - super.init(coder: coder) - setup() - } - - deinit { - observers.forEach { NotificationCenter.default.removeObserver($0) } - } - - private func setup() { -#if canImport(WebKit) -#if canImport(UIKit) - backgroundColor = .systemBackground - webView.backgroundColor = .systemBackground - webView.scrollView.backgroundColor = .systemBackground - webView.isOpaque = false - - webView.scrollView.isScrollEnabled = false -#endif -#if canImport(AppKit) -#endif - webView.navigationDelegate = self - addSubview(webView) - - webView.translatesAutoresizingMaskIntoConstraints = false - NSLayoutConstraint.activate([ - webView.leftAnchor.constraint(equalTo: leftAnchor), - webView.rightAnchor.constraint(equalTo: rightAnchor), - webView.topAnchor.constraint(equalTo: topAnchor), - webView.bottomAnchor.constraint(equalTo: bottomAnchor) - ]) -#endif - addBackgroundGuards() - } - - // MARK: - Internal Functions - - /** - Enqueues a javascript command for execution. - - - parameter javascript: A JavaScript command as a string. - - parameter coalescingIdentifier: An optional identifier which, if present will - replace all other enqueued invocations with the same ID. This is useful if the - newly enqueued invocation should completely supersede any other previously enqueued - but not yet executed invocations of the same function. - - parameter completionHandler: A completion handler which will be invoked - */ - func enqueueInvocation(javascript: JavaScript, - coalescingIdentifier: String? = nil, - completionHandler: ((Result) -> Void)? = nil) { - let completionHandlerShim: (Any?, Error?) -> Void = { result, error in - defer { - // Lets map our old school (Any?, Error?) response to the newer swift Result type. - if let error = error { - completionHandler?(.failure(error)) - } else { - completionHandler?(.success(result)) - } - } - - guard let error = error else { return } - let nsError = error as NSError - #if canImport(WebKit) - guard nsError.domain == WKErrorDomain, let code = WKError.Code(rawValue: nsError.code) else { return } - - switch code { - case .javaScriptExceptionOccurred, .javaScriptResultTypeIsUnsupported: - // There is no reason to fail with these errors. We control the inputs and outputs - // and all resources are fully-offline. This is likely caused by incorrectly packaged - // webpack content or drift between the JS code and the JS function names/signatures - // hardcoded in Swift. - print("VisJSWebView: Failed to evaluate javascript: \(error)") - case .unknown: - print("VisJSWebView: an unknown error occurred: \(error)") - case .webContentProcessTerminated: - print("VisJSWebView: web content process was terminated. Possibly out of memory or terminated for " + - "battery optimization (i.e. not in visible view hierarchy when requested to evaluate JS): \(error)") - case .webViewInvalidated: - // Web view has been torn down. We can safely ignore this message. - break - case .contentRuleListStoreCompileFailed, .contentRuleListStoreLookUpFailed, - .contentRuleListStoreRemoveFailed, .contentRuleListStoreVersionMismatch: - break - default: - // .attributedStringContentFailedToLoad (iOS 13) - // .attributedStringContentLoadTimedOut (iOS 13) - break - } - #endif - } - - if let coalescingIdentifier = coalescingIdentifier { - pendingInvocations.removeAll { - $0.coalescingIdentifier == coalescingIdentifier - } - } - - pendingInvocations += [PendingJavascriptInvocation(coalescingIdentifier: coalescingIdentifier, - javascript: javascript, - completionHandler: completionHandlerShim)] - processPendingInvocations() - } - - // MARK: - Private Functions - - /** - We don't want to execute JS commands if we're in the background. - */ - private func addBackgroundGuards() { -#if canImport(UIKit) - let didBecomeActiveObserver = NotificationCenter.default.addObserver( - forName: UIApplication.didBecomeActiveNotification, - object: nil, - queue: .main) { [weak self] (_) in self?.isBackgrounded = false } - - let willResignActiveObserver = NotificationCenter.default.addObserver( - forName: UIApplication.didEnterBackgroundNotification, - object: nil, - queue: .main) { [weak self] (_) in self?.isBackgrounded = true } - - observers = [didBecomeActiveObserver, willResignActiveObserver] -#endif -#if canImport(AppKit) -#endif - } - - private func processPendingInvocations() { - guard isInitialLoadComplete, !isBackgrounded else { return } - - #if canImport(WebKit) - pendingInvocations.forEach { - webView.evaluateJavaScript($0.javascript, completionHandler: $0.completionHandler) - } - #endif - - pendingInvocations.removeAll() - } - -} - -//MARK: - WKNavigationDelegate -#if canImport(WebKit) -extension JSWebView: WKNavigationDelegate { - - func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { - isInitialLoadComplete = true - } - - func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { - print("JSWebView: didFailNavigationWithError: %@", error) - } -} -#endif diff --git a/Sources/DittoPresenceViewer/MockData.swift b/Sources/DittoPresenceViewer/MockData.swift deleted file mode 100644 index 3c6d659..0000000 --- a/Sources/DittoPresenceViewer/MockData.swift +++ /dev/null @@ -1,201 +0,0 @@ -// -// Copyright © 2021 DittoLive Incorporated. All rights reserved. -// - -import Foundation - -#if DEBUG - -// MARK: Mock Data Interface - -struct MockData { - - // MARK: Static Functions - - static func runFrequentConnectionChanges(callback: @escaping (String) -> Void) { - let numPeers = 5 - - func generator(lastState: PresenceUpdate?) -> PresenceUpdate { - let peers = (0...numPeers).map { (site: Int) in Peer.init(siteId: site) } - - let conns = (0...(numPeers - 1)).flatMap { site1 in - ((site1+1)...numPeers).map { site2 in - Connection.init(from: site1, to: site2, type: ConnectionType.random()) - } - } - - return PresenceUpdate(localPeer: "0", peers: peers, connections: conns) - } - - let startingState = generator(lastState: nil) - Self.runChanges(lastState: startingState, generator: generator, callback: callback) - } - - static func runFrequentRSSIChanges(callback: @escaping (String) -> Void) { - let numPeers = 5 - - func generator(lastState: PresenceUpdate?) -> PresenceUpdate { - let peers = (0...numPeers).map { (site: Int) in Peer.init(siteId: site) } - - let conns = (0...(numPeers - 1)).flatMap { site1 in - ((site1 + 1)...numPeers).map { site2 in - Connection.init(from: site1, to: site2, type: .bluetooth) - } - } - - return PresenceUpdate(localPeer: "0", peers: peers, connections: conns) - } - - let startingState = generator(lastState: nil) - Self.runChanges(lastState: startingState, generator: generator, callback: callback) - } - - static func runLargeMesh(callback: @escaping (String) -> Void) { - Self.runDynamicMesh(numPeers: 10, connectivity: 4, callback: callback) - } - - static func runMassiveMesh(callback: @escaping (String) -> Void) { - Self.runDynamicMesh(numPeers: 50, connectivity: 4, callback: callback) - - } - - // MARK: Private Static Functions - - static func runDynamicMesh(numPeers: Int, connectivity: Int, callback: @escaping (String) -> Void) { - let percentConnectionsChange = 0.2 - - func generator(lastState: PresenceUpdate?) -> PresenceUpdate { - if let lastState = lastState { - let numChanges = Int(Double(numPeers) * percentConnectionsChange) - var newUpdate = lastState - - let connectionsToRemove = lastState - .connections - .shuffled() - .prefix(numChanges) - .map { $0.id } - let connectionsToAdd = (0...(numChanges - 1)) - .map { _ in Connection(from: .random(in: 0...numPeers), to: .random(in: 0...numPeers), type: .random()) } - - newUpdate.connections = lastState.connections.filter { !connectionsToRemove.contains($0.id) } - newUpdate.connections += connectionsToAdd - - return newUpdate - } else { - let peers = (0...numPeers).map { (site: Int) in Peer.init(siteId: site) } - let conns = (0...(numPeers - 1)).flatMap { site1 in - ((site1 + 1)...numPeers).shuffled().prefix(.random(in: 0...connectivity)).map { site2 in - Connection.init(from: site1, to: site2, type: .random()) - } - } - return PresenceUpdate(localPeer: "0", peers: peers, connections: conns) - } - } - - let startingState = generator(lastState: nil) - Self.runChanges(lastState: startingState, generator: generator, callback: callback) - } - - private static func runChanges(lastState: PresenceUpdate, - generator: @escaping (PresenceUpdate?) -> PresenceUpdate, - callback: @escaping (String) -> Void) { - DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(1)) { - let newState = generator(lastState) - - callback(String.init(data: try! JSONEncoder().encode(newState), encoding: .utf8)!) - - runChanges(lastState: newState, generator: generator, callback: callback) - } - } - -} - -// MARK: Private Types - -private func specialChar(_ index: Int) -> String { - let chars = ["'", "`", "\"", "😄", "👍🏾", "<"] - return chars[index % chars.count] -} - -private struct PresenceUpdate: Codable { - let localPeer: String - var peers: [Peer] - var connections: [Connection] -} - -private struct Peer: Codable { - let id: Int - let siteId: String - let deviceName: String - let os: Os - let isHydraConnected: Bool - let dittoSdkVersion: String - - init(siteId: Int) { - self.id = siteId // Usually a separate network Id - but this is just mock data. - self.siteId = "\(siteId)" - self.deviceName = "Device \(specialChar(siteId)) \(siteId)" - self.os = Os.generate(index: siteId) - self.isHydraConnected = siteId % 2 == 1 - self.dittoSdkVersion = "1.0.\(siteId)" - } -} - -private enum Os: String, CaseIterable, Codable { - case generic = "Generic" - case iOS = "iOS" - case android = "Android" - case linux = "Linux" - case windows = "Windows" - case macOS = "macOS" - - /// Deterministic generator - static func generate(index: Int) -> Self { - return Self.allCases[index % Self.allCases.count] - } - - /// Random generator - static func random() -> Self { - return Self.allCases.randomElement()! - } -} - -private struct Connection: Codable { - let id: String - let from: Int - let to: Int - let connectionType: ConnectionType - let approximateDistanceInMeters: Double? - - init(from: Int, to: Int, type: ConnectionType) { - let distance = (type == .bluetooth && Bool.random()) - ? Double.random(in: 1.0...6.0) - : nil - - self.id = "\(from)<->\(to):\(type)" - self.from = from - self.to = to - self.connectionType = type - self.approximateDistanceInMeters = distance - } -} - -private enum ConnectionType: String, CaseIterable, Codable { - case bluetooth = "Bluetooth" - case accessPoint = "AccessPoint" - case p2pWiFi = "P2PWiFi" - case webSocket = "WebSocket" - - /// Deterministic generator - static func generate(index: Int) -> Self { - return Self.allCases[index % Self.allCases.count] - } - - /// Random generator - static func random() -> Self { - Self.allCases.randomElement()! - } - -} - -#endif diff --git a/Sources/DittoPresenceViewer/PresenceView.swift b/Sources/DittoPresenceViewer/PresenceView.swift deleted file mode 100644 index 148bd5b..0000000 --- a/Sources/DittoPresenceViewer/PresenceView.swift +++ /dev/null @@ -1,62 +0,0 @@ -// -// PresenceView.swift -// -// -// Created by Ben Chatelain on 9/23/22. -// - -import DittoSwift - -#if canImport(SwiftUI) -import SwiftUI -#endif - -#if canImport(UIKit) -import UIKit -#endif - -#if canImport(AppKit) -import AppKit -#endif - -#if canImport(WebKit) -@available(macOS 10.15, *) -public struct PresenceView: View { - private var ditto: Ditto - - public init(ditto: Ditto) { - self.ditto = ditto - } - - public var body: some View { - DittoPresenceViewRepresentable(ditto: ditto) - } -} - -// MARK: - UIViewRepresentable -#if os(iOS) -private struct DittoPresenceViewRepresentable: UIViewRepresentable { - let ditto: Ditto - - func makeUIView(context: Context) -> UIView { - return DittoPresenceView(ditto: ditto) - } - - func updateUIView(_ uiView: UIView, context: Context) { - } -} - -// MARK: - NSViewRepresentable -#elseif os(macOS) -private struct DittoPresenceViewRepresentable: NSViewRepresentable { - let ditto: Ditto - - func makeNSView(context: Context) -> NSView { - return DittoPresenceView(ditto: ditto) - } - - func updateNSView(_ nsView: NSView, context: Context) { - } -} -#endif -#endif diff --git a/Sources/DittoPresenceViewer/Resources/index.html b/Sources/DittoPresenceViewer/Resources/index.html deleted file mode 100644 index 3475960..0000000 --- a/Sources/DittoPresenceViewer/Resources/index.html +++ /dev/null @@ -1 +0,0 @@ -Ditto Presence
Bluetooth
LAN
P2P WiFi
WebSocket
Cloud
\ No newline at end of file diff --git a/Sources/DittoPresenceViewer/Resources/main.css b/Sources/DittoPresenceViewer/Resources/main.css deleted file mode 100644 index d3731a1..0000000 --- a/Sources/DittoPresenceViewer/Resources/main.css +++ /dev/null @@ -1,102 +0,0 @@ -:root { - color-scheme: light dark; - --legend-text: #000000ff; -} - -@media screen and (prefers-color-scheme: dark) { - :root { - --legend-text: #ffffffff; - } -} - -* { - -webkit-touch-callout: none; - -webkit-user-select: none; -} - -body, html { - -webkit-tap-highlight-color: rgba(0,0,0,0); - background-color: transparent; - margin: 0; - height: 100%; - width: 100%; -} - -#presenceNetwork { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; -} - -.legend { - display: flex; - flex-wrap: wrap; - justify-content: center; - position: fixed; - left: 0; - bottom: 0; - width: 100%; - text-align: center; -} - -.conditional-break { - flex-basis: 100%; - height: 0; -} - -/* - We add a conditional break to force a 3 over 2 layout on mid-sized screens for - the presence legend: - - [item][item][item] - [item][item] - - For larger screens (iPads, etc.) we remove this restriction once we know that all - items can fit on a single line: - - [item][item][item][item][item] - */ -@media only screen and (min-width: 470px) { - .conditional-break { - display: none; - } -} - -.legend>div { - font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; - background-color: transparent; - color: var(--legend-text); - width: 6.5em; - margin: 0.4em; - text-align: center; - font-size: 0.8em; -} - -hr { - border: none; - border-top: 4px dotted #000; - width: 75%; -} - -hr.bluetooth { - border-top: 3px dotted #0074d9; -} - -hr.access-point { - border-top: 3px dotted #00BC7F; -} - -hr.p2p-wifi { - border-top: 3px dotted #F856B3; -} - -hr.hydra { - border-top: 3px dotted #5F43E9; -} - -hr.web-socket { - border-top: 3px dotted #D35400; -} - diff --git a/Sources/DittoPresenceViewer/Resources/main.js b/Sources/DittoPresenceViewer/Resources/main.js deleted file mode 100644 index 4d0372d..0000000 --- a/Sources/DittoPresenceViewer/Resources/main.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see main.js.LICENSE.txt */ -var Presence;(()=>{var e={698:(e,t,i)=>{"use strict";i.r(t)},400:function(e){var t;"undefined"!=typeof self&&self,t=function(){return function(e){var t={};function i(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=85)}([function(e,t,i){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,i){"use strict";t.__esModule=!0;var o,n=(o=i(130))&&o.__esModule?o:{default:o};t.default=function(){function e(e,t){for(var i=0;i2&&void 0!==arguments[2]&&arguments[2];for(var n in e)void 0!==i[n]&&(null===i[n]||"object"!==(0,r.default)(i[n])?l(e,i,n,o):"object"===(0,r.default)(e[n])&&t.fillIfDefined(e[n],i[n],o))},t.extend=function(e){for(var t=1;t3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(o))throw new TypeError("Arrays are not supported by deepExtend");for(var s=0;s3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(o))throw new TypeError("Arrays are not supported by deepExtend");for(var s in o)if(o.hasOwnProperty(s)&&-1===e.indexOf(s))if(o[s]&&o[s].constructor===Object)void 0===i[s]&&(i[s]={}),i[s].constructor===Object?t.deepExtend(i[s],o[s]):l(i,o,s,n);else if(Array.isArray(o[s])){i[s]=[];for(var r=0;r2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];for(var s in i)if(i.hasOwnProperty(s)||!0===o)if(i[s]&&i[s].constructor===Object)void 0===e[s]&&(e[s]={}),e[s].constructor===Object?t.deepExtend(e[s],i[s],o):l(e,i,s,n);else if(Array.isArray(i[s])){e[s]=[];for(var r=0;r=0&&(t="DOMMouseScroll"),e.addEventListener(t,i,o)):e.attachEvent("on"+t,i)},t.removeEventListener=function(e,t,i,o){e.removeEventListener?(void 0===o&&(o=!1),"mousewheel"===t&&navigator.userAgent.indexOf("Firefox")>=0&&(t="DOMMouseScroll"),e.removeEventListener(t,i,o)):e.detachEvent("on"+t,i)},t.preventDefault=function(e){e||(e=window.event),e.preventDefault?e.preventDefault():e.returnValue=!1},t.getTarget=function(e){var t;return e||(e=window.event),e.target?t=e.target:e.srcElement&&(t=e.srcElement),null!=t.nodeType&&3==t.nodeType&&(t=t.parentNode),t},t.hasParent=function(e,t){for(var i=e;i;){if(i===t)return!0;i=i.parentNode}return!1},t.option={},t.option.asBoolean=function(e,t){return"function"==typeof e&&(e=e()),null!=e?0!=e:t||null},t.option.asNumber=function(e,t){return"function"==typeof e&&(e=e()),null!=e?Number(e)||t||null:t||null},t.option.asString=function(e,t){return"function"==typeof e&&(e=e()),null!=e?String(e):t||null},t.option.asSize=function(e,i){return"function"==typeof e&&(e=e()),t.isString(e)?e:t.isNumber(e)?e+"px":i||null},t.option.asElement=function(e,t){return"function"==typeof e&&(e=e()),e||t||null},t.hexToRGB=function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,i,o){return t+t+i+i+o+o}));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},t.overrideOpacity=function(e,i){var o;return-1!=e.indexOf("rgba")?e:-1!=e.indexOf("rgb")?"rgba("+(o=e.substr(e.indexOf("(")+1).replace(")","").split(","))[0]+","+o[1]+","+o[2]+","+i+")":null==(o=t.hexToRGB(e))?e:"rgba("+o.r+","+o.g+","+o.b+","+i+")"},t.RGBToHex=function(e,t,i){return"#"+((1<<24)+(e<<16)+(t<<8)+i).toString(16).slice(1)},t.parseColor=function(e){var i;if(!0===t.isString(e)){if(!0===t.isValidRGB(e)){var o=e.substr(4).substr(0,e.length-5).split(",").map((function(e){return parseInt(e)}));e=t.RGBToHex(o[0],o[1],o[2])}if(!0===t.isValidHex(e)){var n=t.hexToHSV(e),s={h:n.h,s:.8*n.s,v:Math.min(1,1.02*n.v)},r={h:n.h,s:Math.min(1,1.25*n.s),v:.8*n.v},a=t.HSVToHex(r.h,r.s,r.v),d=t.HSVToHex(s.h,s.s,s.v);i={background:e,border:a,highlight:{background:d,border:a},hover:{background:d,border:a}}}else i={background:e,border:e,highlight:{background:e,border:e},hover:{background:e,border:e}}}else(i={}).background=e.background||void 0,i.border=e.border||void 0,t.isString(e.highlight)?i.highlight={border:e.highlight,background:e.highlight}:(i.highlight={},i.highlight.background=e.highlight&&e.highlight.background||void 0,i.highlight.border=e.highlight&&e.highlight.border||void 0),t.isString(e.hover)?i.hover={border:e.hover,background:e.hover}:(i.hover={},i.hover.background=e.hover&&e.hover.background||void 0,i.hover.border=e.hover&&e.hover.border||void 0);return i},t.RGBToHSV=function(e,t,i){e/=255,t/=255,i/=255;var o=Math.min(e,Math.min(t,i)),n=Math.max(e,Math.max(t,i));return o==n?{h:0,s:0,v:o}:{h:60*((e==o?3:i==o?1:5)-(e==o?t-i:i==o?e-t:i-e)/(n-o))/360,s:(n-o)/n,v:n}};var c=function(e){var t={};return e.split(";").forEach((function(e){if(""!=e.trim()){var i=e.split(":"),o=i[0].trim(),n=i[1].trim();t[o]=n}})),t},f=function(e){return(0,s.default)(e).map((function(t){return t+": "+e[t]})).join("; ")};t.addCssText=function(e,i){var o=c(e.style.cssText),n=c(i),s=t.extend(o,n);e.style.cssText=f(s)},t.removeCssText=function(e,t){var i=c(e.style.cssText),o=c(t);for(var n in o)o.hasOwnProperty(n)&&delete i[n];e.style.cssText=f(i)},t.HSVToRGB=function(e,t,i){var o,n,s,r=Math.floor(6*e),a=6*e-r,d=i*(1-t),h=i*(1-a*t),l=i*(1-(1-a)*t);switch(r%6){case 0:o=i,n=l,s=d;break;case 1:o=h,n=i,s=d;break;case 2:o=d,n=i,s=l;break;case 3:o=d,n=h,s=i;break;case 4:o=l,n=d,s=i;break;case 5:o=i,n=d,s=h}return{r:Math.floor(255*o),g:Math.floor(255*n),b:Math.floor(255*s)}},t.HSVToHex=function(e,i,o){var n=t.HSVToRGB(e,i,o);return t.RGBToHex(n.r,n.g,n.b)},t.hexToHSV=function(e){var i=t.hexToRGB(e);return t.RGBToHSV(i.r,i.g,i.b)},t.isValidHex=function(e){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e)},t.isValidRGB=function(e){return e=e.replace(" ",""),/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(e)},t.isValidRGBA=function(e){return e=e.replace(" ",""),/rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(.{1,3})\)/i.test(e)},t.selectiveBridgeObject=function(e,i){if(null!==i&&"object"===(void 0===i?"undefined":(0,r.default)(i))){for(var o=(0,n.default)(i),s=0;s0&&t(o,e[n-1])<0;n--)e[n]=e[n-1];e[n]=o}return e},t.mergeOptions=function(e,t,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=function(e){return null!=e},a=function(e){return null!==e&&"object"===(void 0===e?"undefined":(0,r.default)(e))},d=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0};if(!a(e))throw new Error("Parameter mergeTarget must be an object");if(!a(t))throw new Error("Parameter options must be an object");if(!s(i))throw new Error("Parameter option must have a value");if(!a(o))throw new Error("Parameter globalOptions must be an object");var h=function(e,t,i){a(e[i])||(e[i]={});var o=t[i],n=e[i];for(var s in o)o.hasOwnProperty(s)&&(n[s]=o[s])},l=t[i],u=a(o)&&!d(o),c=u?o[i]:void 0,f=c?c.enabled:void 0;if(void 0!==l){if("boolean"==typeof l)return a(e[i])||(e[i]={}),void(e[i].enabled=l);if(null===l&&!a(e[i])){if(!s(c))return;e[i]=(0,n.default)(c)}if(a(l)){var p=!0;void 0!==l.enabled?p=l.enabled:void 0!==f&&(p=c.enabled),h(e,t,i),e[i].enabled=p}}},t.binarySearchCustom=function(e,t,i,o){for(var n=0,s=0,r=e.length-1;s<=r&&n<1e4;){var a=Math.floor((s+r)/2),d=e[a],h=t(void 0===o?d[i]:d[i][o]);if(0==h)return a;-1==h?s=a+1:r=a-1,n++}return-1},t.binarySearchValue=function(e,t,i,o,n){var s,r,a,d,h=0,l=0,u=e.length-1;for(n=null!=n?n:function(e,t){return e==t?0:e0)return"before"==o?Math.max(0,d-1):d;if(n(r,t)<0&&n(a,t)>0)return"before"==o?d:Math.min(e.length-1,d+1);n(r,t)<0?l=d+1:u=d-1,h++}return-1},t.easingFunctions={linear:function(e){return e},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return e*(2-e)},easeInOutQuad:function(e){return e<.5?2*e*e:(4-2*e)*e-1},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return--e*e*e+1},easeInOutCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1- --e*e*e*e},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1+--e*e*e*e*e},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e}},t.getScrollBarWidth=function(){var e=document.createElement("p");e.style.width="100%",e.style.height="200px";var t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);var i=e.offsetWidth;t.style.overflow="scroll";var o=e.offsetWidth;return i==o&&(o=t.clientWidth),document.body.removeChild(t),i-o},t.topMost=function(e,t){var i=void 0;Array.isArray(t)||(t=[t]);var n=!0,s=!1,r=void 0;try{for(var a,d=(0,o.default)(e);!(n=(a=d.next()).done);n=!0){var h=a.value;if(h){i=h[t[0]];for(var l=1;l0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}},{key:"performFill",value:function(e,t){this.enableShadow(e,t),e.fill(),this.disableShadow(e,t),this.performStroke(e,t)}},{key:"_addBoundingBoxMargin",value:function(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}},{key:"_updateBoundingBox",value:function(e,t,i,o,n){void 0!==i&&this.resize(i,o,n),this.left=e-this.width/2,this.top=t-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}},{key:"updateBoundingBox",value:function(e,t,i,o,n){this._updateBoundingBox(e,t,i,o,n)}},{key:"getDimensionsFromLabel",value:function(e,t,i){this.textSize=this.labelModule.getTextSize(e,t,i);var o=this.textSize.width,n=this.textSize.height;return 0===o&&(o=14,n=14),{width:o,height:n}}}]),e}();t.default=a},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){return(0,n.default)(this,t),(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s))}return(0,a.default)(t,e),(0,s.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{size:this.options.size};if(this.needsRefresh(t,i)){this.labelModule.getTextSize(e,t,i);var n=2*o.size;this.width=n,this.height=n,this.radius=.5*this.width}}},{key:"_drawShape",value:function(e,t,i,o,n,s,r,a){if(this.resize(e,s,r,a),this.left=o-this.width/2,this.top=n-this.height/2,this.initContextForDraw(e,a),e[t](o,n,a.size),this.performFill(e,a),void 0!==this.options.icon&&void 0!==this.options.icon.code&&(e.font=(s?"bold ":"")+this.height/2+"px "+(this.options.icon.face||"FontAwesome"),e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",e.fillText(this.options.icon.code,o,n)),void 0!==this.options.label){this.labelModule.calculateLabelSize(e,s,r,o,n,"hanging");var d=n+.5*this.height+.5*this.labelModule.size.height;this.labelModule.draw(e,o,d,s,r,"hanging")}this.updateBoundingBox(o,n)}},{key:"updateBoundingBox",value:function(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size,void 0!==this.options.label&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}}]),t}(d(i(16)).default);t.default=h},function(e,t,i){var o=i(59),n=i(39);e.exports=function(e){return o(n(e))}},function(e,t,i){var o=i(12),n=i(28);e.exports=i(13)?function(e,t,i){return o.f(e,t,n(1,i))}:function(e,t,i){return e[t]=i,e}},function(e,t,i){var o=i(21);e.exports=function(e){if(!o(e))throw TypeError(e+" is not an object!");return e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,i){e.exports={default:i(123),__esModule:!0}},function(e,t,i){"use strict";if("undefined"!=typeof window){var o=i(127),n=window.Hammer||i(128);e.exports=o(n,{preventDefault:"mouse"})}else e.exports=function(){return{on:e=function(){},off:e,destroy:e,emit:e,get:function(t){return{set:e}}};var e}},function(e,t){e.exports={}},function(e,t,i){var o=i(65),n=i(45);e.exports=Object.keys||function(e){return o(e,n)}},function(e,t){e.exports=!0},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){var i=0,o=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++i+o).toString(36))}},function(e,t,i){var o=i(39);e.exports=function(e){return Object(o(e))}},function(e,t,i){e.exports={default:i(100),__esModule:!0}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,i){"use strict";var o=r(i(23)),n=r(i(7)),s=r(i(9));function r(e){return e&&e.__esModule?e:{default:e}}var a=i(2),d=i(72);function h(e,t){if(e&&!Array.isArray(e)&&(t=e,e=null),this._options=t||{},this._data={},this.length=0,this._fieldId=this._options.fieldId||"id",this._type={},this._options.type)for(var i=(0,s.default)(this._options.type),o=0,n=i.length;on?1:oa)&&(r=d,a=h)}return r},h.prototype.min=function(e){var t,i,o=this._data,n=(0,s.default)(o),r=null,a=null;for(t=0,i=n.length;te.left&&this.shape.tope.top}},{key:"isBoundingBoxOverlappingWith",value:function(e){return this.shape.boundingBox.lefte.left&&this.shape.boundingBox.tope.top}}],[{key:"updateGroupOptions",value:function(e,t,i){if(void 0!==i){var o=e.group;if(void 0!==t&&void 0!==t.group&&o!==t.group)throw new Error("updateGroupOptions: group values in options don't match.");if("number"==typeof o||"string"==typeof o&&""!=o){var n=i.get(o),s=["font"];void 0!==t&&void 0!==t.color&&null!=t.color&&s.push("color"),r.selectiveNotDeepExtend(s,e,n),e.color=r.parseColor(e.color)}}}},{key:"parseOptions",value:function(t,i){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=arguments[4],a=["color","fixed","shadow"];if(r.selectiveNotDeepExtend(a,t,i,o),e.checkMass(i),r.mergeOptions(t,i,"shadow",n),void 0!==i.color&&null!==i.color){var d=r.parseColor(i.color);r.fillIfDefined(t.color,d)}else!0===o&&null===i.color&&(t.color=r.bridgeObject(n.color));void 0!==i.fixed&&null!==i.fixed&&("boolean"==typeof i.fixed?(t.fixed.x=i.fixed,t.fixed.y=i.fixed):(void 0!==i.fixed.x&&"boolean"==typeof i.fixed.x&&(t.fixed.x=i.fixed.x),void 0!==i.fixed.y&&"boolean"==typeof i.fixed.y&&(t.fixed.y=i.fixed.y))),!0===o&&null===i.font&&(t.font=r.bridgeObject(n.font)),e.updateGroupOptions(t,i,s),void 0!==i.scaling&&r.mergeOptions(t.scaling,i.scaling,"label",n.scaling)}},{key:"checkMass",value:function(e,t){if(void 0!==e.mass&&e.mass<=0){var i="";void 0!==t&&(i=" in node id: "+t),console.log("%cNegative or zero mass disallowed"+i+", setting mass to 1.",O),e.mass=1}}}]),e}();t.default=M},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(i(7)),n=r(i(0)),s=r(i(1));function r(e){return e&&e.__esModule?e:{default:e}}var a=i(2),d=function(){function e(){(0,n.default)(this,e)}return(0,s.default)(e,null,[{key:"choosify",value:function(e,t){var i=["node","edge","label"],n=!0,s=a.topMost(t,"chosen");if("boolean"==typeof s)n=s;else if("object"===(void 0===s?"undefined":(0,o.default)(s))){if(-1===i.indexOf(e))throw new Error("choosify: subOption '"+e+"' should be one of '"+i.join("', '")+"'");var r=a.topMost(t,["chosen",e]);"boolean"!=typeof r&&"function"!=typeof r||(n=r)}return n}},{key:"pointInRect",value:function(e,t,i){if(e.width<=0||e.height<=0)return!1;if(void 0!==i){var o={x:t.x-i.x,y:t.y-i.y};if(0!==i.angle){var n=-i.angle;t={x:Math.cos(n)*o.x-Math.sin(n)*o.y,y:Math.sin(n)*o.x+Math.cos(n)*o.y}}else t=o}var s=e.x+e.width,r=e.y+e.width;return e.leftt.x&&e.topt.y}},{key:"isValidLabel",value:function(e){return"string"==typeof e&&""!==e}}]),e}();t.default=d},function(e,t,i){"use strict";t.onTouch=function(e,t){t.inputHandler=function(e){e.isFirst&&t(e)},e.on("hammer.input",t.inputHandler)},t.onRelease=function(e,t){return t.inputHandler=function(e){e.isFinal&&t(e)},e.on("hammer.input",t.inputHandler)},t.offTouch=function(e,t){e.off("hammer.input",t.inputHandler)},t.offRelease=t.offTouch,t.disablePreventDefaultVertically=function(e){return e.getTouchAction=function(){return["pan-y"]},e}},function(e,t,i){i(87);for(var o=i(10),n=i(19),s=i(25),r=i(8)("toStringTag"),a="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),d=0;ddocument.F=Object<\/script>"),e.close(),d=e.F;o--;)delete d.prototype[s[o]];return d()};e.exports=Object.create||function(e,t){var i;return null!==e?(a.prototype=o(e),i=new a,a.prototype=null,i[r]=e):i=d(),void 0===t?i:n(i,t)}},function(e,t){var i=Math.ceil,o=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?o:i)(e)}},function(e,t,i){var o=i(44)("keys"),n=i(29);e.exports=function(e){return o[e]||(o[e]=n(e))}},function(e,t,i){var o=i(6),n=i(10),s="__core-js_shared__",r=n[s]||(n[s]={});(e.exports=function(e,t){return r[e]||(r[e]=void 0!==t?t:{})})("versions",[]).push({version:o.version,mode:i(27)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,i){var o=i(12).f,n=i(14),s=i(8)("toStringTag");e.exports=function(e,t,i){e&&!n(e=i?e:e.prototype,s)&&o(e,s,{configurable:!0,value:t})}},function(e,t,i){"use strict";var o=i(97)(!0);i(60)(String,"String",(function(e){this._t=String(e),this._i=0}),(function(){var e,t=this._t,i=this._i;return i>=t.length?{value:void 0,done:!0}:(e=o(t,i),this._i+=e.length,{value:e,done:!1})}))},function(e,t,i){t.f=i(8)},function(e,t,i){var o=i(10),n=i(6),s=i(27),r=i(48),a=i(12).f;e.exports=function(e){var t=n.Symbol||(n.Symbol=s?{}:o.Symbol||{});"_"==e.charAt(0)||e in t||a(t,e,{value:r.f(e)})}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,i){"use strict";var o,n=(o=i(9))&&o.__esModule?o:{default:o},s=i(2),r=i(33);function a(e,t){this._data=null,this._ids={},this.length=0,this._options=t||{},this._fieldId="id",this._subscribers={};var i=this;this.listener=function(){i._onEvent.apply(i,arguments)},this.setData(e)}a.prototype.setData=function(e){var t,i,o,n,s;if(this._data){for(this._data.off&&this._data.off("*",this.listener),s=[],o=0,n=(t=this._data.getIds({filter:this._options&&this._options.filter})).length;othis.imageObj.height?i=this.imageObj.width/this.imageObj.height:o=this.imageObj.height/this.imageObj.width),e=2*this.options.size*i,t=2*this.options.size*o}else e=this.imageObj.width,t=this.imageObj.height;this.width=e,this.height=t,this.radius=.5*this.width}},{key:"_drawRawCircle",value:function(e,t,i,o){this.initContextForDraw(e,o),e.circle(t,i,o.size),this.performFill(e,o)}},{key:"_drawImageAtPosition",value:function(e,t){if(0!=this.imageObj.width){e.globalAlpha=1,this.enableShadow(e,t);var i=1;!0===this.options.shapeProperties.interpolation&&(i=this.imageObj.width/this.width/this.body.view.scale),this.imageObj.drawImageAtPosition(e,i,this.left,this.top,this.width,this.height),this.disableShadow(e,t)}}},{key:"_drawImageLabel",value:function(e,t,i,o,n){var s,r=0;if(void 0!==this.height){r=.5*this.height;var a=this.labelModule.getTextSize(e,o,n);a.lineCount>=1&&(r+=a.height/2)}s=i+r,this.options.label&&(this.labelOffset=r),this.labelModule.draw(e,t,s,o,n,"hanging")}}]),t}(d(i(16)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.printStyle=void 0;var o=d(i(23)),n=d(i(7)),s=d(i(9)),r=d(i(0)),a=d(i(1));function d(e){return e&&e.__esModule?e:{default:e}}var h=i(2),l=!1,u=void 0,c="background: #FFeeee; color: #dd0000",f=function(){function e(){(0,r.default)(this,e)}return(0,a.default)(e,null,[{key:"validate",value:function(t,i,o){l=!1,u=i;var n=i;return void 0!==o&&(n=i[o]),e.parse(t,n,[]),l}},{key:"parse",value:function(t,i,o){for(var n in t)t.hasOwnProperty(n)&&e.check(n,t,i,o)}},{key:"check",value:function(t,i,o,n){if(void 0!==o[t]||void 0!==o.__any__){var s=t,r=!0;void 0===o[t]&&void 0!==o.__any__&&(s="__any__",r="object"===e.getType(i[t]));var a=o[s];r&&void 0!==a.__type__&&(a=a.__type__),e.checkFields(t,i,o,s,a,n)}else e.getSuggestion(t,o,n)}},{key:"checkFields",value:function(t,i,o,n,r,a){var d=function(i){console.log("%c"+i+e.printLocation(a,t),c)},u=e.getType(i[t]),f=r[u];void 0!==f?"array"===e.getType(f)&&-1===f.indexOf(i[t])?(d('Invalid option detected in "'+t+'". Allowed values are:'+e.print(f)+' not "'+i[t]+'". '),l=!0):"object"===u&&"__any__"!==n&&(a=h.copyAndExtendArray(a,t),e.parse(i[t],o[n],a)):void 0===r.any&&(d('Invalid type received for "'+t+'". Expected: '+e.print((0,s.default)(r))+". Received ["+u+'] "'+i[t]+'"'),l=!0)}},{key:"getType",value:function(e){var t=void 0===e?"undefined":(0,n.default)(e);return"object"===t?null===e?"null":e instanceof Boolean?"boolean":e instanceof Number?"number":e instanceof String?"string":Array.isArray(e)?"array":e instanceof Date?"date":void 0!==e.nodeType?"dom":!0===e._isAMomentObject?"moment":"object":"number"===t?"number":"boolean"===t?"boolean":"string"===t?"string":void 0===t?"undefined":t}},{key:"getSuggestion",value:function(t,i,o){var n,r=e.findInOptions(t,i,o,!1),a=e.findInOptions(t,u,[],!0);n=void 0!==r.indexMatch?" in "+e.printLocation(r.path,t,"")+'Perhaps it was incomplete? Did you mean: "'+r.indexMatch+'"?\n\n':a.distance<=4&&r.distance>a.distance?" in "+e.printLocation(r.path,t,"")+"Perhaps it was misplaced? Matching option found at: "+e.printLocation(a.path,a.closestMatch,""):r.distance<=8?'. Did you mean "'+r.closestMatch+'"?'+e.printLocation(r.path,t):". Did you mean one of these: "+e.print((0,s.default)(i))+e.printLocation(o,t),console.log('%cUnknown option detected: "'+t+'"'+n,c),l=!0}},{key:"findInOptions",value:function(t,i,o){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=1e9,r="",a=[],d=t.toLowerCase(),l=void 0;for(var u in i){var c=void 0;if(void 0!==i[u].__type__&&!0===n){var f=e.findInOptions(t,i[u],h.copyAndExtendArray(o,u));s>f.distance&&(r=f.closestMatch,a=f.path,s=f.distance,l=f.indexMatch)}else-1!==u.toLowerCase().indexOf(d)&&(l=u),s>(c=e.levenshteinDistance(t,u))&&(r=u,a=h.copyArray(o),s=c)}return{closestMatch:r,path:a,distance:s,indexMatch:l}}},{key:"printLocation",value:function(e,t){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Problem value found at: \n",o="\n\n"+i+"options = {\n",n=0;ni.shape.height?(r=i.x+.5*i.shape.width,a=i.y-d):(r=i.x+d,a=i.y-.5*i.shape.height),n=this._pointOnCircle(r,a,d,.125),this.labelModule.draw(e,n.x,n.y,this.selected,this.hover)}}}},{key:"getItemsOnPoint",value:function(e){var t=[];if(this.labelModule.visible()){var i=this._getRotation();u.pointInRect(this.labelModule.getSize(),e,i)&&t.push({edgeId:this.id,labelId:0})}var o={left:e.x,top:e.y};return this.isOverlappingWith(o)&&t.push({edgeId:this.id}),t}},{key:"isOverlappingWith",value:function(e){if(this.connected){var t=this.from.x,i=this.from.y,o=this.to.x,n=this.to.y,s=e.left,r=e.top;return this.edgeType.getDistanceToEdge(t,i,o,n,s,r)<10}return!1}},{key:"_getRotation",value:function(e){var t=this.edgeType.getViaNode(),i=this.edgeType.getPoint(.5,t);void 0!==e&&this.labelModule.calculateLabelSize(e,this.selected,this.hover,i.x,i.y);var o={x:i.x,y:this.labelModule.size.yLine,angle:0};if(!this.labelModule.visible())return o;if("horizontal"===this.options.font.align)return o;var n=this.from.y-this.to.y,s=this.from.x-this.to.x,r=Math.atan2(n,s);return(r<-1&&s<0||r>0&&s<0)&&(r+=Math.PI),o.angle=r,o}},{key:"_pointOnCircle",value:function(e,t,i,o){var n=2*o*Math.PI;return{x:e+i*Math.cos(n),y:t-i*Math.sin(n)}}},{key:"select",value:function(){this.selected=!0}},{key:"unselect",value:function(){this.selected=!1}},{key:"cleanup",value:function(){if(this.edgeType)return this.edgeType.cleanup()}},{key:"remove",value:function(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}},{key:"endPointsValid",value:function(){return void 0!==this.body.nodes[this.fromId]&&void 0!==this.body.nodes[this.toId]}}],[{key:"parseOptions",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],d=["arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","to","title","value","width","font","chosen","widthConstraint"];if(h.selectiveDeepExtend(d,e,t,i),u.isValidLabel(t.label)?e.label=t.label:u.isValidLabel(e.label)||(e.label=void 0),h.mergeOptions(e,t,"smooth",r),h.mergeOptions(e,t,"shadow",r),h.mergeOptions(e,t,"background",r),void 0!==t.dashes&&null!==t.dashes?e.dashes=t.dashes:!0===i&&null===t.dashes&&(e.dashes=(0,s.default)(r.dashes)),void 0!==t.scaling&&null!==t.scaling?(void 0!==t.scaling.min&&(e.scaling.min=t.scaling.min),void 0!==t.scaling.max&&(e.scaling.max=t.scaling.max),h.mergeOptions(e.scaling,t.scaling,"label",r.scaling)):!0===i&&null===t.scaling&&(e.scaling=(0,s.default)(r.scaling)),void 0!==t.arrows&&null!==t.arrows)if("string"==typeof t.arrows){var l=t.arrows.toLowerCase();e.arrows.to.enabled=-1!=l.indexOf("to"),e.arrows.middle.enabled=-1!=l.indexOf("middle"),e.arrows.from.enabled=-1!=l.indexOf("from")}else{if("object"!==(0,n.default)(t.arrows))throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+(0,o.default)(t.arrows));h.mergeOptions(e.arrows,t.arrows,"to",r.arrows),h.mergeOptions(e.arrows,t.arrows,"middle",r.arrows),h.mergeOptions(e.arrows,t.arrows,"from",r.arrows)}else!0===i&&null===t.arrows&&(e.arrows=(0,s.default)(r.arrows));if(void 0!==t.color&&null!==t.color){var c=t.color,f=e.color;if(a)h.deepExtend(f,r.color,!1,i);else for(var p in f)f.hasOwnProperty(p)&&delete f[p];if(h.isString(f))f.color=f,f.highlight=f,f.hover=f,f.inherit=!1,void 0===c.opacity&&(f.opacity=1);else{var v=!1;void 0!==c.color&&(f.color=c.color,v=!0),void 0!==c.highlight&&(f.highlight=c.highlight,v=!0),void 0!==c.hover&&(f.hover=c.hover,v=!0),void 0!==c.inherit&&(f.inherit=c.inherit),void 0!==c.opacity&&(f.opacity=Math.min(1,Math.max(0,c.opacity))),!0===v?f.inherit=!1:void 0===f.inherit&&(f.inherit="from")}}else!0===i&&null===t.color&&(e.color=h.bridgeObject(r.color));!0===i&&null===t.font&&(e.font=h.bridgeObject(r.font))}}]),e}();t.default=g},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){return(0,n.default)(this,t),(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s))}return(0,a.default)(t,e),(0,s.default)(t,[{key:"_findBorderPositionBezier",value:function(e,t){var i,o,n,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this._getViaCoordinates(),r=10,a=0,d=0,h=1,l=.2,u=this.to,c=!1;for(e.id===this.from.id&&(u=this.from,c=!0);d<=h&&a0&&(a=(d=this._getDistanceToLine(f,p,u,c,n,s))1&&void 0!==arguments[1]?arguments[1]:[],o=1e9,n=-1e9,s=1e9,r=-1e9;if(i.length>0)for(var a=0;a(t=e[i[a]]).shape.boundingBox.left&&(s=t.shape.boundingBox.left),rt.shape.boundingBox.top&&(o=t.shape.boundingBox.top),n1&&void 0!==arguments[1]?arguments[1]:[],o=1e9,n=-1e9,s=1e9,r=-1e9;if(i.length>0)for(var a=0;a(t=e[i[a]]).x&&(s=t.x),rt.y&&(o=t.y),nd;)o(a,i=t[d++])&&(~s(h,i)||h.push(i));return h}},function(e,t,i){var o=i(14),n=i(30),s=i(43)("IE_PROTO"),r=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=n(e),o(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?r:null}},function(e,t,i){var o=i(38),n=i(8)("toStringTag"),s="Arguments"==o(function(){return arguments}());e.exports=function(e){var t,i,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),n))?i:s?o(t):"Object"==(r=o(t))&&"function"==typeof t.callee?"Arguments":r}},function(e,t,i){var o=i(11),n=i(6),s=i(22);e.exports=function(e,t){var i=(n.Object||{})[e]||Object[e],r={};r[e]=t(i),o(o.S+o.F*s((function(){i(1)})),"Object",r)}},function(e,t,i){var o=i(65),n=i(45).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return o(e,n)}},function(e,t,i){var o=i(32),n=i(28),s=i(18),r=i(40),a=i(14),d=i(62),h=Object.getOwnPropertyDescriptor;t.f=i(13)?h:function(e,t){if(e=s(e),t=r(t,!0),d)try{return h(e,t)}catch(e){}if(a(e,t))return n(!o.f.call(e,t),e[t])}},function(e,t,i){"use strict";e.exports="undefined"!=typeof window&&window.moment||i(116)},function(e,t,i){"use strict";function o(e){this.delay=null,this.max=1/0,this._queue=[],this._timeout=null,this._extended=null,this.setOptions(e)}o.prototype.setOptions=function(e){e&&void 0!==e.delay&&(this.delay=e.delay),e&&void 0!==e.max&&(this.max=e.max),this._flushIfNeeded()},o.extend=function(e,t){var i=new o(t);if(void 0!==e.flush)throw new Error("Target object already has a property flush");e.flush=function(){i.flush()};var n=[{name:"flush",original:void 0}];if(t&&t.replace)for(var s=0;sthis.max&&this.flush(),clearTimeout(this._timeout),this.queue.length>0&&"number"==typeof this.delay){var e=this;this._timeout=setTimeout((function(){e.flush()}),this.delay)}},o.prototype.flush=function(){for(;this._queue.length>0;){var e=this._queue.shift();e.fn.apply(e.context||e.fn,e.args||[])}},e.exports=o},function(e,t){function i(e){if(e)return function(e){for(var t in i.prototype)e[t]=i.prototype[t];return e}(e)}e.exports=i,i.prototype.on=i.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[e]=this._callbacks[e]||[]).push(t),this},i.prototype.once=function(e,t){var i=this;function o(){i.off(e,o),t.apply(this,arguments)}return this._callbacks=this._callbacks||{},o.fn=t,this.on(e,o),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i,o=this._callbacks[e];if(!o)return this;if(1==arguments.length)return delete this._callbacks[e],this;for(var n=0;n":!0,"--":!0},l="",u=0,c="",f="",p=0;function v(){u++,c=l.charAt(u)}function g(){return l.charAt(u+1)}var y=/[a-zA-Z_0-9.:#]/;function m(e){return y.test(e)}function b(e,t){if(e||(e={}),t)for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function _(e,t,i){for(var o=t.split("."),n=e;o.length;){var s=o.shift();o.length?(n[s]||(n[s]={}),n=n[s]):n[s]=i}}function w(e,t){for(var i,o,n=null,s=[e],r=e;r.parent;)s.push(r.parent),r=r.parent;if(r.nodes)for(i=0,o=r.nodes.length;i=0;i--){var a=s[i];a.nodes||(a.nodes=[]),-1===a.nodes.indexOf(n)&&a.nodes.push(n)}t.attr&&(n.attr=b(n.attr,t.attr))}function k(e,t){if(e.edges||(e.edges=[]),e.edges.push(t),e.edge){var i=b({},e.edge);t.attr=b(i,t.attr)}}function x(e,t,i,o,n){var s={from:t,to:i,type:o};return e.edge&&(s.attr=b({},e.edge)),s.attr=b(s.attr||{},n),null!=n&&n.hasOwnProperty("arrows")&&(s.arrows={to:{enabled:!0,type:n.arrows.type}},n.arrows=null),s}function O(){for(p=0,f="";" "===c||"\t"===c||"\n"===c||"\r"===c;)v();do{var e=!1;if("#"===c){for(var t=u-1;" "===l.charAt(t)||"\t"===l.charAt(t);)t--;if("\n"===l.charAt(t)||""===l.charAt(t)){for(;""!=c&&"\n"!=c;)v();e=!0}}if("/"===c&&"/"===g()){for(;""!=c&&"\n"!=c;)v();e=!0}if("/"===c&&"*"===g()){for(;""!=c;){if("*"===c&&"/"===g()){v(),v();break}v()}e=!0}for(;" "===c||"\t"===c||"\n"===c||"\r"===c;)v()}while(e);if(""!==c){var i=c+g();if(h[i])return p=1,f=i,v(),void v();if(h[c])return p=1,f=c,void v();if(m(c)||"-"===c){for(f+=c,v();m(c);)f+=c,v();return"false"===f?f=!1:"true"===f?f=!0:isNaN(Number(f))||(f=Number(f)),void(p=d)}if('"'===c){for(v();""!=c&&('"'!=c||'"'===c&&'"'===g());)'"'===c?(f+=c,v()):"\\"===c&&"n"===g()?(f+="\n",v()):f+=c,v();if('"'!=c)throw T('End of string " expected');return v(),void(p=d)}for(p=3;""!=c;)f+=c,v();throw new SyntaxError('Syntax error in part "'+P(f,30)+'"')}p=1}function M(e){for(;""!==f&&"}"!=f;)E(e),";"===f&&O()}function E(e){var t=S(e);if(t)D(e,t);else{var i=function(e){return"node"===f?(O(),e.node=C(),"node"):"edge"===f?(O(),e.edge=C(),"edge"):"graph"===f?(O(),e.graph=C(),"graph"):null}(e);if(!i){if(p!=d)throw T("Identifier expected");var o=f;if(O(),"="===f){if(O(),p!=d)throw T("Identifier expected");e[o]=f,O()}else!function(e,t){var i={id:t},o=C();o&&(i.attr=o),w(e,i),D(e,t)}(e,o)}}}function S(e){var t=null;if("subgraph"===f&&((t={}).type="subgraph",O(),p===d&&(t.id=f,O())),"{"===f){if(O(),t||(t={}),t.parent=e,t.node=e.node,t.edge=e.edge,t.graph=e.graph,M(t),"}"!=f)throw T("Angle bracket } expected");O(),delete t.node,delete t.edge,delete t.graph,delete t.parent,e.subgraphs||(e.subgraphs=[]),e.subgraphs.push(t)}return t}function D(e,t){for(;"->"===f||"--"===f;){var i,o=f;O();var n=S(e);if(n)i=n;else{if(p!=d)throw T("Identifier or subgraph expected");w(e,{id:i=f}),O()}k(e,x(e,t,i,o,C())),t=i}}function C(){for(var e,t,i=null,o={dashed:!0,solid:!1,dotted:[1,5]},n={dot:"circle",box:"box",crow:"crow",curve:"curve",icurve:"inv_curve",normal:"triangle",inv:"inv_triangle",diamond:"diamond",tee:"bar",vee:"vee"},s=new Array,r=new Array;"["===f;){for(O(),i={};""!==f&&"]"!=f;){if(p!=d)throw T("Attribute name expected");var a=f;if(O(),"="!=f)throw T("Equal sign = expected");if(O(),p!=d)throw T("Attribute value expected");var h=f;"style"===a&&(h=o[h]),"arrowhead"===a&&(a="arrows",h={to:{enabled:!0,type:n[h]}}),"arrowtail"===a&&(a="arrows",h={from:{enabled:!0,type:n[h]}}),s.push({attr:i,name:a,value:h}),r.push(a),O(),","==f&&O()}if("]"!=f)throw T("Bracket ] expected");O()}if(s=function(e,t){var i;if(e.includes("dir")){var o={arrows:{}};for(i=0;i"===e.type&&(t.arrows="to"),t};t.edges.forEach((function(e){var t,n,s,r,a;t=e.from instanceof Object?e.from.nodes:{id:e.from},n=e.to instanceof Object?e.to.nodes:{id:e.to},e.from instanceof Object&&e.from.edges&&e.from.edges.forEach((function(e){var t=o(e);i.edges.push(t)})),s=t,r=n,a=function(t,n){var s=x(i,t.id,n.id,e.type,e.attr),r=o(s);i.edges.push(r)},Array.isArray(s)?s.forEach((function(e){Array.isArray(r)?r.forEach((function(t){a(e,t)})):a(e,r)})):Array.isArray(r)?r.forEach((function(e){a(s,e)})):a(s,r),e.to instanceof Object&&e.to.edges&&e.to.edges.forEach((function(e){var t=o(e);i.edges.push(t)}))}))}return t.attr&&(i.options=t.attr),i}},function(e,t,i){"use strict";t.parseGephi=function(e,t){var i=[],o=[],n={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};void 0!==t&&(void 0!==t.fixed&&(n.nodes.fixed=t.fixed),void 0!==t.parseColor&&(n.nodes.parseColor=t.parseColor),void 0!==t.inheritColor&&(n.edges.inheritColor=t.inheritColor));for(var s=e.edges,r=e.nodes,a=0;a2&&void 0!==arguments[2]&&arguments[2];(0,s.default)(this,e),this.body=t,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(i),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=o}return(0,r.default)(e,[{key:"setOptions",value:function(e){if(this.elementOptions=e,this.initFontOptions(e.font),h.isValidLabel(e.label)?this.labelDirty=!0:e.label=void 0,void 0!==e.font&&null!==e.font)if("string"==typeof e.font)this.baseSize=this.fontOptions.size;else if("object"===(0,n.default)(e.font)){var t=e.font.size;void 0!==t&&(this.baseSize=t)}}},{key:"initFontOptions",value:function(t){var i=this;d.forEach(u,(function(e){i.fontOptions[e]={}})),e.parseFontString(this.fontOptions,t)?this.fontOptions.vadjust=0:d.forEach(t,(function(e,t){null!=e&&"object"!==(void 0===e?"undefined":(0,n.default)(e))&&(i.fontOptions[t]=e)}))}},{key:"constrain",value:function(e){var t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},i=d.topMost(e,"widthConstraint");if("number"==typeof i)t.maxWdt=Number(i),t.minWdt=Number(i);else if("object"===(void 0===i?"undefined":(0,n.default)(i))){var o=d.topMost(e,["widthConstraint","maximum"]);"number"==typeof o&&(t.maxWdt=Number(o));var s=d.topMost(e,["widthConstraint","minimum"]);"number"==typeof s&&(t.minWdt=Number(s))}var r=d.topMost(e,"heightConstraint");if("number"==typeof r)t.minHgt=Number(r);else if("object"===(void 0===r?"undefined":(0,n.default)(r))){var a=d.topMost(e,["heightConstraint","minimum"]);"number"==typeof a&&(t.minHgt=Number(a));var h=d.topMost(e,["heightConstraint","valign"]);"string"==typeof h&&("top"!==h&&"bottom"!==h||(t.valign=h))}return t}},{key:"update",value:function(e,t){this.setOptions(e,!0),this.propagateFonts(t),d.deepExtend(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=h.choosify("label",t)}},{key:"adjustSizes",value:function(e){var t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);var i=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=i)}},{key:"addFontOptionsToPile",value:function(e,t){for(var i=0;i5&&void 0!==arguments[5]?arguments[5]:"middle";if(void 0!==this.elementOptions.label){var r=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&r=this.elementOptions.scaling.label.maxVisible&&(r=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,o,n,t,i,s),this._drawBackground(e),this._drawText(e,t,this.size.yLine,s,r))}}},{key:"_drawBackground",value:function(e){if(void 0!==this.fontOptions.background&&"none"!==this.fontOptions.background){e.fillStyle=this.fontOptions.background;var t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}},{key:"_drawText",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"middle",s=arguments[4],r=this._setAlignment(e,t,i,n),a=(0,o.default)(r,2);t=a[0],i=a[1],e.textAlign="left",t-=this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&("top"===this.fontOptions.valign&&(i-=(this.size.height-this.size.labelHeight)/2),"bottom"===this.fontOptions.valign&&(i+=(this.size.height-this.size.labelHeight)/2));for(var d=0;d0&&(e.lineWidth=c.strokeWidth,e.strokeStyle=g,e.lineJoin="round"),e.fillStyle=v,c.strokeWidth>0&&e.strokeText(c.text,t+l,i+c.vadjust),e.fillText(c.text,t+l,i+c.vadjust),l+=c.width}i+=h.height}}}},{key:"_setAlignment",value:function(e,t,i,o){return this.isEdgeLabel&&"horizontal"!==this.fontOptions.align&&!1===this.pointToSelf?(t=0,i=0,"top"===this.fontOptions.align?(e.textBaseline="alphabetic",i-=4):"bottom"===this.fontOptions.align?(e.textBaseline="hanging",i+=4):e.textBaseline="middle"):e.textBaseline=o,[t,i]}},{key:"_getColor",value:function(e,t,i){var o=e||"#000000",n=i||"#ffffff";if(t<=this.elementOptions.scaling.label.drawThreshold){var s=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));o=d.overrideOpacity(o,s),n=d.overrideOpacity(n,s)}return[o,n]}},{key:"getTextSize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this._processLabel(e,t,i),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}},{key:"getSize",value:function(){var e=this.size.left,t=this.size.top-1;if(this.isEdgeLabel){var i=.5*-this.size.width;switch(this.fontOptions.align){case"middle":e=i,t=.5*-this.size.height;break;case"top":e=i,t=-(this.size.height+2);break;case"bottom":e=i,t=2}}return{left:e,top:t,width:this.size.width,height:this.size.height}}},{key:"calculateLabelSize",value:function(e,t,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"middle";this._processLabel(e,t,i),this.size.left=o-.5*this.size.width,this.size.top=n-.5*this.size.height,this.size.yLine=n+.5*(1-this.lineCount)*this.fontOptions.size,"hanging"===s&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}},{key:"getFormattingValues",value:function(e,t,i,o){var n=function(e,t,i){return"normal"===t?"mod"===i?"":e[i]:void 0!==e[t][i]?e[t][i]:e[i]},s={color:n(this.fontOptions,o,"color"),size:n(this.fontOptions,o,"size"),face:n(this.fontOptions,o,"face"),mod:n(this.fontOptions,o,"mod"),vadjust:n(this.fontOptions,o,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||i)&&("normal"===o&&!0===this.fontOptions.chooser&&this.elementOptions.labelHighlightBold?s.mod="bold":"function"==typeof this.fontOptions.chooser&&this.fontOptions.chooser(s,this.elementOptions.id,t,i));var r="";return void 0!==s.mod&&""!==s.mod&&(r+=s.mod+" "),r+=s.size+"px "+s.face,e.font=r.replace(/"/g,""),s.font=e.font,s.height=s.size,s}},{key:"differentState",value:function(e,t){return e!==this.selectedState||t!==this.hoverState}},{key:"_processLabelText",value:function(e,t,i,o){return new l(e,this,t,i).process(o)}},{key:"_processLabel",value:function(e,t,i){if(!1!==this.labelDirty||this.differentState(t,i)){var o=this._processLabelText(e,t,i,this.elementOptions.label);this.fontOptions.minWdt>0&&o.width0&&o.heighto.shape.height?(t=o.x+.5*o.shape.width,i=o.y-n):(t=o.x+n,i=o.y-.5*o.shape.height),[t,i,n]}},{key:"_pointOnCircle",value:function(e,t,i,o){var n=2*o*Math.PI;return{x:e+i*Math.cos(n),y:t-i*Math.sin(n)}}},{key:"_findBorderPositionCircle",value:function(e,t,i){for(var o=i.x,n=i.y,s=i.low,r=i.high,a=i.direction,d=0,h=this.options.selfReferenceSize,l=void 0,u=void 0,c=void 0,f=.5*(s+r);s<=r&&d<10&&(f=.5*(s+r),l=this._pointOnCircle(o,n,h,f),u=Math.atan2(e.y-l.y,e.x-l.x),c=e.distanceToBorder(t,u)-Math.sqrt(Math.pow(l.x-e.x,2)+Math.pow(l.y-e.y,2)),!(Math.abs(c)<.05));)c>0?a>0?s=f:r=f:a>0?r=f:s=f,d++;return l.t=f,l}},{key:"getLineWidth",value:function(e,t){return!0===e?Math.max(this.selectionWidth,.3/this.body.view.scale):!0===t?Math.max(this.hoverWidth,.3/this.body.view.scale):Math.max(this.options.width,.3/this.body.view.scale)}},{key:"getColor",value:function(e,t,i,o){if(!1!==t.inheritsColor){if("both"===t.inheritsColor&&this.from.id!==this.to.id){var n=e.createLinearGradient(this.from.x,this.from.y,this.to.x,this.to.y),s=void 0,r=void 0;return s=this.from.options.color.highlight.border,r=this.to.options.color.highlight.border,!1===this.from.selected&&!1===this.to.selected?(s=a.overrideOpacity(this.from.options.color.border,t.opacity),r=a.overrideOpacity(this.to.options.color.border,t.opacity)):!0===this.from.selected&&!1===this.to.selected?r=this.to.options.color.border:!1===this.from.selected&&!0===this.to.selected&&(s=this.from.options.color.border),n.addColorStop(0,s),n.addColorStop(1,r),n}return"to"===t.inheritsColor?a.overrideOpacity(this.to.options.color.border,t.opacity):a.overrideOpacity(this.from.options.color.border,t.opacity)}return a.overrideOpacity(t.color,t.opacity)}},{key:"_circle",value:function(e,t,i,o,n){this.enableShadow(e,t),e.beginPath(),e.arc(i,o,n,0,2*Math.PI,!1),e.stroke(),this.disableShadow(e,t)}},{key:"getDistanceToEdge",value:function(e,t,i,n,s,r,a,d){var h=0;if(this.from!=this.to)h=this._getDistanceToEdge(e,t,i,n,s,r,a);else{var l=this._getCircleData(void 0),u=(0,o.default)(l,3),c=u[0],f=u[1],p=u[2],v=c-s,g=f-r;h=Math.abs(Math.sqrt(v*v+g*g)-p)}return h}},{key:"_getDistanceToLine",value:function(e,t,i,o,n,s){var r=i-e,a=o-t,d=((n-e)*r+(s-t)*a)/(r*r+a*a);d>1?d=1:d<0&&(d=0);var h=e+d*r-n,l=t+d*a-s;return Math.sqrt(h*h+l*l)}},{key:"getArrowData",value:function(e,t,i,n,s,r){var a=void 0,d=void 0,h=void 0,l=void 0,u=void 0,c=void 0,f=void 0,p=r.width;if("from"===t?(h=this.from,l=this.to,u=.1,c=r.fromArrowScale,f=r.fromArrowType):"to"===t?(h=this.to,l=this.from,u=-.1,c=r.toArrowScale,f=r.toArrowType):(h=this.to,l=this.from,c=r.middleArrowScale,f=r.middleArrowType),h!=l)if("middle"!==t)if(!0===this.options.smooth.enabled){d=this.findBorderPosition(h,e,{via:i});var v=this.getPoint(Math.max(0,Math.min(1,d.t+u)),i);a=Math.atan2(d.y-v.y,d.x-v.x)}else a=Math.atan2(h.y-l.y,h.x-l.x),d=this.findBorderPosition(h,e);else a=Math.atan2(h.y-l.y,h.x-l.x),d=this.getPoint(.5,i);else{var g=this._getCircleData(e),y=(0,o.default)(g,3),m=y[0],b=y[1],_=y[2];"from"===t?a=-2*(d=this.findBorderPosition(this.from,e,{x:m,y:b,low:.25,high:.6,direction:-1})).t*Math.PI+1.5*Math.PI+.1*Math.PI:"to"===t?a=-2*(d=this.findBorderPosition(this.from,e,{x:m,y:b,low:.6,high:1,direction:1})).t*Math.PI+1.5*Math.PI-1.1*Math.PI:(d=this._pointOnCircle(m,b,_,.175),a=3.9269908169872414)}"middle"===t&&c<0&&(p*=-1);var w=15*c+3*p;return{point:d,core:{x:d.x-.9*w*Math.cos(a),y:d.y-.9*w*Math.sin(a)},angle:a,length:w,type:f}}},{key:"drawArrowHead",value:function(e,t,i,o,n){e.strokeStyle=this.getColor(e,t,i,o),e.fillStyle=e.strokeStyle,e.lineWidth=t.width,d.draw(e,n),this.enableShadow(e,t),e.fill(),this.disableShadow(e,t)}},{key:"enableShadow",value:function(e,t){!0===t.shadow&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}},{key:"disableShadow",value:function(e,t){!0===t.shadow&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}},{key:"drawBackground",value:function(e,t){if(!1!==t.background){var i=["strokeStyle","lineWidth","dashes"],o={};i.forEach((function(t){o[t]=e[t]})),e.strokeStyle=t.backgroundColor,e.lineWidth=t.backgroundSize,this.setStrokeDashed(e,t.backgroundDashes),e.stroke(),i.forEach((function(t){e[t]=o[t]})),this.setStrokeDashed(e,t.dashes)}}},{key:"setStrokeDashed",value:function(e,t){if(!1!==t)if(void 0!==e.setLineDash){var i=[5,5];!0===Array.isArray(t)&&(i=t),e.setLineDash(i)}else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");else void 0!==e.setLineDash?e.setLineDash([]):console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.")}}]),e}();t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(4)),s=d(i(5)),r=d(i(0)),a=d(i(1));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(){function e(){(0,r.default)(this,e)}return(0,a.default)(e,null,[{key:"transform",value:function(e,t){e instanceof Array||(e=[e]);for(var i=t.point.x,o=t.point.y,n=t.angle,s=t.length,r=0;r0){var e=void 0,t=this.body.nodes,i=this.physicsBody.physicsNodeIndices,o=i.length,n=this._formBarnesHutTree(t,i);this.barnesHutTree=n;for(var s=0;s0&&this._getForceContributions(n.root,e)}}},{key:"_getForceContributions",value:function(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}},{key:"_getForceContribution",value:function(e,t){var i,o,n;e.childrenCount>0&&(i=e.centerOfMass.x-t.x,o=e.centerOfMass.y-t.y,(n=Math.sqrt(i*i+o*o))*e.calcSize>this.thetaInversed?this._calculateForces(n,i,o,t,e):4===e.childrenCount?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(n,i,o,t,e))}},{key:"_calculateForces",value:function(e,t,i,o,n){0===e&&(t=e=.1),this.overlapAvoidanceFactor<1&&o.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*o.shape.radius,e-o.shape.radius));var s=this.options.gravitationalConstant*n.mass*o.options.mass/Math.pow(e,3),r=t*s,a=i*s;this.physicsBody.forces[o.id].x+=r,this.physicsBody.forces[o.id].y+=a}},{key:"_formBarnesHutTree",value:function(e,t){for(var i=void 0,o=t.length,n=e[t[0]].x,s=e[t[0]].y,r=e[t[0]].x,a=e[t[0]].y,d=1;d0&&(lr&&(r=l),ua&&(a=u))}var c=Math.abs(r-n)-Math.abs(a-s);c>0?(s-=.5*c,a+=.5*c):(n+=.5*c,r-=.5*c);var f=Math.max(1e-5,Math.abs(r-n)),p=.5*f,v=.5*(n+r),g=.5*(s+a),y={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:v-p,maxX:v+p,minY:g-p,maxY:g+p},size:f,calcSize:1/f,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(y.root);for(var m=0;m0&&this._placeInTree(y.root,i);return y}},{key:"_updateBranchMass",value:function(e,t){var i=e.centerOfMass,o=e.mass+t.options.mass,n=1/o;i.x=i.x*e.mass+t.x*t.options.mass,i.x*=n,i.y=i.y*e.mass+t.y*t.options.mass,i.y*=n,e.mass=o;var s=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidtht.x?n.maxY>t.y?"NW":"SW":n.maxY>t.y?"NE":"SE",this._placeInRegion(e,t,o)}},{key:"_placeInRegion",value:function(e,t,i){var o=e.children[i];switch(o.childrenCount){case 0:o.children.data=t,o.childrenCount=1,this._updateBranchMass(o,t);break;case 1:o.children.data.x===t.x&&o.children.data.y===t.y?(t.x+=this.seededRandom(),t.y+=this.seededRandom()):(this._splitBranch(o),this._placeInTree(o,t));break;case 4:this._placeInTree(o,t)}}},{key:"_splitBranch",value:function(e){var t=null;1===e.childrenCount&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,"NW"),this._insertRegion(e,"NE"),this._insertRegion(e,"SW"),this._insertRegion(e,"SE"),null!=t&&this._placeInTree(e,t)}},{key:"_insertRegion",value:function(e,t){var i=void 0,o=void 0,n=void 0,s=void 0,r=.5*e.size;switch(t){case"NW":i=e.range.minX,o=e.range.minX+r,n=e.range.minY,s=e.range.minY+r;break;case"NE":i=e.range.minX+r,o=e.range.maxX,n=e.range.minY,s=e.range.minY+r;break;case"SW":i=e.range.minX,o=e.range.minX+r,n=e.range.minY+r,s=e.range.maxY;break;case"SE":i=e.range.minX+r,o=e.range.maxX,n=e.range.minY+r,s=e.range.maxY}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:i,maxX:o,minY:n,maxY:s},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}},{key:"_debug",value:function(e,t){void 0!==this.barnesHutTree&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}},{key:"_drawBranch",value:function(e,t,i){void 0===i&&(i="#FF0000"),4===e.childrenCount&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=i,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}}]),e}();t.default=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=s(i(0)),n=s(i(1));function s(e){return e&&e.__esModule?e:{default:e}}var r=function(){function e(t,i,n){(0,o.default)(this,e),this.body=t,this.physicsBody=i,this.setOptions(n)}return(0,n.default)(e,[{key:"setOptions",value:function(e){this.options=e}},{key:"solve",value:function(){for(var e=void 0,t=void 0,i=void 0,o=void 0,n=this.body.nodes,s=this.physicsBody.physicsNodeIndices,r=this.physicsBody.forces,a=0;a=e.length?(this._t=void 0,n(1)):n(0,"keys"==t?i:"values"==t?e[i]:[i,e[i]])}),"values"),s.Arguments=s.Array,o("keys"),o("values"),o("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,i){"use strict";var o=i(41),n=i(28),s=i(46),r={};i(19)(r,i(8)("iterator"),(function(){return this})),e.exports=function(e,t,i){e.prototype=o(r,{next:n(1,i)}),s(e,t+" Iterator")}},function(e,t,i){var o=i(12),n=i(20),s=i(26);e.exports=i(13)?Object.defineProperties:function(e,t){n(e);for(var i,r=s(t),a=r.length,d=0;a>d;)o.f(e,i=r[d++],t[i]);return e}},function(e,t,i){var o=i(18),n=i(94),s=i(95);e.exports=function(e){return function(t,i,r){var a,d=o(t),h=n(d.length),l=s(r,h);if(e&&i!=i){for(;h>l;)if((a=d[l++])!=a)return!0}else for(;h>l;l++)if((e||l in d)&&d[l]===i)return e||l||0;return!e&&-1}}},function(e,t,i){var o=i(42),n=Math.min;e.exports=function(e){return e>0?n(o(e),9007199254740991):0}},function(e,t,i){var o=i(42),n=Math.max,s=Math.min;e.exports=function(e,t){return(e=o(e))<0?n(e+t,0):s(e,t)}},function(e,t,i){var o=i(10).document;e.exports=o&&o.documentElement},function(e,t,i){var o=i(42),n=i(39);e.exports=function(e){return function(t,i){var s,r,a=String(n(t)),d=o(i),h=a.length;return d<0||d>=h?e?"":void 0:(s=a.charCodeAt(d))<55296||s>56319||d+1===h||(r=a.charCodeAt(d+1))<56320||r>57343?e?a.charAt(d):s:e?a.slice(d,d+2):r-56320+(s-55296<<10)+65536}}},function(e,t,i){var o=i(20),n=i(99);e.exports=i(6).getIterator=function(e){var t=n(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return o(t.call(e))}},function(e,t,i){var o=i(67),n=i(8)("iterator"),s=i(25);e.exports=i(6).getIteratorMethod=function(e){if(null!=e)return e[n]||e["@@iterator"]||s[o(e)]}},function(e,t,i){i(101);var o=i(6).Object;e.exports=function(e,t){return o.create(e,t)}},function(e,t,i){var o=i(11);o(o.S,"Object",{create:i(41)})},function(e,t,i){i(103),e.exports=i(6).Object.keys},function(e,t,i){var o=i(30),n=i(26);i(68)("keys",(function(){return function(e){return n(o(e))}}))},function(e,t,i){e.exports={default:i(105),__esModule:!0}},function(e,t,i){i(47),i(37),e.exports=i(48).f("iterator")},function(e,t,i){e.exports={default:i(107),__esModule:!0}},function(e,t,i){i(108),i(113),i(114),i(115),e.exports=i(6).Symbol},function(e,t,i){"use strict";var o=i(10),n=i(14),s=i(13),r=i(11),a=i(64),d=i(109).KEY,h=i(22),l=i(44),u=i(46),c=i(29),f=i(8),p=i(48),v=i(49),g=i(110),y=i(111),m=i(20),b=i(21),_=i(18),w=i(40),k=i(28),x=i(41),O=i(112),M=i(70),E=i(12),S=i(26),D=M.f,C=E.f,T=O.f,P=o.Symbol,F=o.JSON,I=F&&F.stringify,N=f("_hidden"),B=f("toPrimitive"),z={}.propertyIsEnumerable,A=l("symbol-registry"),R=l("symbols"),j=l("op-symbols"),L=Object.prototype,H="function"==typeof P,W=o.QObject,Y=!W||!W.prototype||!W.prototype.findChild,V=s&&h((function(){return 7!=x(C({},"a",{get:function(){return C(this,"a",{value:7}).a}})).a}))?function(e,t,i){var o=D(L,t);o&&delete L[t],C(e,t,i),o&&e!==L&&C(L,t,o)}:C,U=function(e){var t=R[e]=x(P.prototype);return t._k=e,t},G=H&&"symbol"==typeof P.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof P},q=function(e,t,i){return e===L&&q(j,t,i),m(e),t=w(t,!0),m(i),n(R,t)?(i.enumerable?(n(e,N)&&e[N][t]&&(e[N][t]=!1),i=x(i,{enumerable:k(0,!1)})):(n(e,N)||C(e,N,k(1,{})),e[N][t]=!0),V(e,t,i)):C(e,t,i)},X=function(e,t){m(e);for(var i,o=g(t=_(t)),n=0,s=o.length;s>n;)q(e,i=o[n++],t[i]);return e},K=function(e){var t=z.call(this,e=w(e,!0));return!(this===L&&n(R,e)&&!n(j,e))&&(!(t||!n(this,e)||!n(R,e)||n(this,N)&&this[N][e])||t)},Z=function(e,t){if(e=_(e),t=w(t,!0),e!==L||!n(R,t)||n(j,t)){var i=D(e,t);return!i||!n(R,t)||n(e,N)&&e[N][t]||(i.enumerable=!0),i}},$=function(e){for(var t,i=T(_(e)),o=[],s=0;i.length>s;)n(R,t=i[s++])||t==N||t==d||o.push(t);return o},J=function(e){for(var t,i=e===L,o=T(i?j:_(e)),s=[],r=0;o.length>r;)!n(R,t=o[r++])||i&&!n(L,t)||s.push(R[t]);return s};H||(P=function(){if(this instanceof P)throw TypeError("Symbol is not a constructor!");var e=c(arguments.length>0?arguments[0]:void 0),t=function(i){this===L&&t.call(j,i),n(this,N)&&n(this[N],e)&&(this[N][e]=!1),V(this,e,k(1,i))};return s&&Y&&V(L,e,{configurable:!0,set:t}),U(e)},a(P.prototype,"toString",(function(){return this._k})),M.f=Z,E.f=q,i(69).f=O.f=$,i(32).f=K,i(50).f=J,s&&!i(27)&&a(L,"propertyIsEnumerable",K,!0),p.f=function(e){return U(f(e))}),r(r.G+r.W+r.F*!H,{Symbol:P});for(var Q="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ee=0;Q.length>ee;)f(Q[ee++]);for(var te=S(f.store),ie=0;te.length>ie;)v(te[ie++]);r(r.S+r.F*!H,"Symbol",{for:function(e){return n(A,e+="")?A[e]:A[e]=P(e)},keyFor:function(e){if(!G(e))throw TypeError(e+" is not a symbol!");for(var t in A)if(A[t]===e)return t},useSetter:function(){Y=!0},useSimple:function(){Y=!1}}),r(r.S+r.F*!H,"Object",{create:function(e,t){return void 0===t?x(e):X(x(e),t)},defineProperty:q,defineProperties:X,getOwnPropertyDescriptor:Z,getOwnPropertyNames:$,getOwnPropertySymbols:J}),F&&r(r.S+r.F*(!H||h((function(){var e=P();return"[null]"!=I([e])||"{}"!=I({a:e})||"{}"!=I(Object(e))}))),"JSON",{stringify:function(e){for(var t,i,o=[e],n=1;arguments.length>n;)o.push(arguments[n++]);if(i=t=o[1],(b(t)||void 0!==e)&&!G(e))return y(t)||(t=function(e,t){if("function"==typeof i&&(t=i.call(this,e,t)),!G(t))return t}),o[1]=t,I.apply(F,o)}}),P.prototype[B]||i(19)(P.prototype,B,P.prototype.valueOf),u(P,"Symbol"),u(Math,"Math",!0),u(o.JSON,"JSON",!0)},function(e,t,i){var o=i(29)("meta"),n=i(21),s=i(14),r=i(12).f,a=0,d=Object.isExtensible||function(){return!0},h=!i(22)((function(){return d(Object.preventExtensions({}))})),l=function(e){r(e,o,{value:{i:"O"+ ++a,w:{}}})},u=e.exports={KEY:o,NEED:!1,fastKey:function(e,t){if(!n(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!s(e,o)){if(!d(e))return"F";if(!t)return"E";l(e)}return e[o].i},getWeak:function(e,t){if(!s(e,o)){if(!d(e))return!0;if(!t)return!1;l(e)}return e[o].w},onFreeze:function(e){return h&&u.NEED&&d(e)&&!s(e,o)&&l(e),e}}},function(e,t,i){var o=i(26),n=i(50),s=i(32);e.exports=function(e){var t=o(e),i=n.f;if(i)for(var r,a=i(e),d=s.f,h=0;a.length>h;)d.call(e,r=a[h++])&&t.push(r);return t}},function(e,t,i){var o=i(38);e.exports=Array.isArray||function(e){return"Array"==o(e)}},function(e,t,i){var o=i(18),n=i(69).f,s={}.toString,r="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return r&&"[object Window]"==s.call(e)?function(e){try{return n(e)}catch(e){return r.slice()}}(e):n(o(e))}},function(e,t){},function(e,t,i){i(49)("asyncIterator")},function(e,t,i){i(49)("observable")},function(e,t,i){(function(e){e.exports=function(){"use strict";var t,i;function o(){return t.apply(null,arguments)}function n(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function s(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function r(e){return void 0===e}function a(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function d(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function h(e,t){var i,o=[];for(i=0;i>>0,o=0;o0)for(i=0;i=0?i?"+":"":"-")+Math.pow(10,Math.max(0,n)).toString().substr(1)+o}var j=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,L=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,H={},W={};function Y(e,t,i,o){var n=o;"string"==typeof o&&(n=function(){return this[o]()}),e&&(W[e]=n),t&&(W[t[0]]=function(){return R(n.apply(this,arguments),t[1],t[2])}),i&&(W[i]=function(){return this.localeData().ordinal(n.apply(this,arguments),e)})}function V(e,t){return e.isValid()?(t=U(t,e.localeData()),H[t]=H[t]||function(e){var t,i,o,n=e.match(j);for(t=0,i=n.length;t=0&&L.test(e);)e=e.replace(L,o),L.lastIndex=0,i-=1;return e}var G=/\d/,q=/\d\d/,X=/\d{3}/,K=/\d{4}/,Z=/[+-]?\d{6}/,$=/\d\d?/,J=/\d\d\d\d?/,Q=/\d\d\d\d\d\d?/,ee=/\d{1,3}/,te=/\d{1,4}/,ie=/[+-]?\d{1,6}/,oe=/\d+/,ne=/[+-]?\d+/,se=/Z|[+-]\d\d:?\d\d/gi,re=/Z|[+-]\d\d(?::?\d\d)?/gi,ae=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,de={};function he(e,t,i){de[e]=C(t)?t:function(e,o){return e&&i?i:t}}function le(e,t){return l(de,e)?de[e](t._strict,t._locale):new RegExp(ue(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(e,t,i,o,n){return t||i||o||n}))))}function ue(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var ce={};function fe(e,t){var i,o=t;for("string"==typeof e&&(e=[e]),a(t)&&(o=function(e,i){i[t]=k(e)}),i=0;i68?1900:2e3)};var me,be=_e("FullYear",!0);function _e(e,t){return function(i){return null!=i?(ke(this,e,i),o.updateOffset(this,t),this):we(this,e)}}function we(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function ke(e,t,i){e.isValid()&&!isNaN(i)&&("FullYear"===t&&ye(e.year())&&1===e.month()&&29===e.date()?e._d["set"+(e._isUTC?"UTC":"")+t](i,e.month(),xe(i,e.month())):e._d["set"+(e._isUTC?"UTC":"")+t](i))}function xe(e,t){if(isNaN(e)||isNaN(t))return NaN;var i,o=(t%(i=12)+i)%i;return e+=(t-o)/12,1===o?ye(e)?29:28:31-o%7%2}me=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t=0&&isFinite(a.getFullYear())&&a.setFullYear(e),a}function Ne(e){var t=new Date(Date.UTC.apply(null,arguments));return e<100&&e>=0&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function Be(e,t,i){var o=7+t-i;return-(7+Ne(e,0,o).getUTCDay()-t)%7+o-1}function ze(e,t,i,o,n){var s,r,a=1+7*(t-1)+(7+i-o)%7+Be(e,o,n);return a<=0?r=ge(s=e-1)+a:a>ge(e)?(s=e+1,r=a-ge(e)):(s=e,r=a),{year:s,dayOfYear:r}}function Ae(e,t,i){var o,n,s=Be(e.year(),t,i),r=Math.floor((e.dayOfYear()-s-1)/7)+1;return r<1?o=r+Re(n=e.year()-1,t,i):r>Re(e.year(),t,i)?(o=r-Re(e.year(),t,i),n=e.year()+1):(n=e.year(),o=r),{week:o,year:n}}function Re(e,t,i){var o=Be(e,t,i),n=Be(e+1,t,i);return(ge(e)-o+n)/7}Y("w",["ww",2],"wo","week"),Y("W",["WW",2],"Wo","isoWeek"),I("week","w"),I("isoWeek","W"),A("week",5),A("isoWeek",5),he("w",$),he("ww",$,q),he("W",$),he("WW",$,q),pe(["w","ww","W","WW"],(function(e,t,i,o){t[o.substr(0,1)]=k(e)}));Y("d",0,"do","day"),Y("dd",0,0,(function(e){return this.localeData().weekdaysMin(this,e)})),Y("ddd",0,0,(function(e){return this.localeData().weekdaysShort(this,e)})),Y("dddd",0,0,(function(e){return this.localeData().weekdays(this,e)})),Y("e",0,0,"weekday"),Y("E",0,0,"isoWeekday"),I("day","d"),I("weekday","e"),I("isoWeekday","E"),A("day",11),A("weekday",11),A("isoWeekday",11),he("d",$),he("e",$),he("E",$),he("dd",(function(e,t){return t.weekdaysMinRegex(e)})),he("ddd",(function(e,t){return t.weekdaysShortRegex(e)})),he("dddd",(function(e,t){return t.weekdaysRegex(e)})),pe(["dd","ddd","dddd"],(function(e,t,i,o){var n=i._locale.weekdaysParse(e,o,i._strict);null!=n?t.d=n:f(i).invalidWeekday=e})),pe(["d","e","E"],(function(e,t,i,o){t[o]=k(e)}));var je="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var Le="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var He="Su_Mo_Tu_We_Th_Fr_Sa".split("_");function We(e,t,i){var o,n,s,r=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],o=0;o<7;++o)s=c([2e3,1]).day(o),this._minWeekdaysParse[o]=this.weekdaysMin(s,"").toLocaleLowerCase(),this._shortWeekdaysParse[o]=this.weekdaysShort(s,"").toLocaleLowerCase(),this._weekdaysParse[o]=this.weekdays(s,"").toLocaleLowerCase();return i?"dddd"===t?-1!==(n=me.call(this._weekdaysParse,r))?n:null:"ddd"===t?-1!==(n=me.call(this._shortWeekdaysParse,r))?n:null:-1!==(n=me.call(this._minWeekdaysParse,r))?n:null:"dddd"===t?-1!==(n=me.call(this._weekdaysParse,r))||-1!==(n=me.call(this._shortWeekdaysParse,r))||-1!==(n=me.call(this._minWeekdaysParse,r))?n:null:"ddd"===t?-1!==(n=me.call(this._shortWeekdaysParse,r))||-1!==(n=me.call(this._weekdaysParse,r))||-1!==(n=me.call(this._minWeekdaysParse,r))?n:null:-1!==(n=me.call(this._minWeekdaysParse,r))||-1!==(n=me.call(this._weekdaysParse,r))||-1!==(n=me.call(this._shortWeekdaysParse,r))?n:null}var Ye=ae;var Ve=ae;var Ue=ae;function Ge(){function e(e,t){return t.length-e.length}var t,i,o,n,s,r=[],a=[],d=[],h=[];for(t=0;t<7;t++)i=c([2e3,1]).day(t),o=this.weekdaysMin(i,""),n=this.weekdaysShort(i,""),s=this.weekdays(i,""),r.push(o),a.push(n),d.push(s),h.push(o),h.push(n),h.push(s);for(r.sort(e),a.sort(e),d.sort(e),h.sort(e),t=0;t<7;t++)a[t]=ue(a[t]),d[t]=ue(d[t]),h[t]=ue(h[t]);this._weekdaysRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+d.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function qe(){return this.hours()%12||12}function Xe(e,t){Y(e,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)}))}function Ke(e,t){return t._meridiemParse}Y("H",["HH",2],0,"hour"),Y("h",["hh",2],0,qe),Y("k",["kk",2],0,(function(){return this.hours()||24})),Y("hmm",0,0,(function(){return""+qe.apply(this)+R(this.minutes(),2)})),Y("hmmss",0,0,(function(){return""+qe.apply(this)+R(this.minutes(),2)+R(this.seconds(),2)})),Y("Hmm",0,0,(function(){return""+this.hours()+R(this.minutes(),2)})),Y("Hmmss",0,0,(function(){return""+this.hours()+R(this.minutes(),2)+R(this.seconds(),2)})),Xe("a",!0),Xe("A",!1),I("hour","h"),A("hour",13),he("a",Ke),he("A",Ke),he("H",$),he("h",$),he("k",$),he("HH",$,q),he("hh",$,q),he("kk",$,q),he("hmm",J),he("hmmss",Q),he("Hmm",J),he("Hmmss",Q),fe(["H","HH"],3),fe(["k","kk"],(function(e,t,i){var o=k(e);t[3]=24===o?0:o})),fe(["a","A"],(function(e,t,i){i._isPm=i._locale.isPM(e),i._meridiem=e})),fe(["h","hh"],(function(e,t,i){t[3]=k(e),f(i).bigHour=!0})),fe("hmm",(function(e,t,i){var o=e.length-2;t[3]=k(e.substr(0,o)),t[4]=k(e.substr(o)),f(i).bigHour=!0})),fe("hmmss",(function(e,t,i){var o=e.length-4,n=e.length-2;t[3]=k(e.substr(0,o)),t[4]=k(e.substr(o,2)),t[5]=k(e.substr(n)),f(i).bigHour=!0})),fe("Hmm",(function(e,t,i){var o=e.length-2;t[3]=k(e.substr(0,o)),t[4]=k(e.substr(o))})),fe("Hmmss",(function(e,t,i){var o=e.length-4,n=e.length-2;t[3]=k(e.substr(0,o)),t[4]=k(e.substr(o,2)),t[5]=k(e.substr(n))}));var Ze,$e=_e("Hours",!0),Je={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Me,monthsShort:Ee,week:{dow:0,doy:6},weekdays:je,weekdaysMin:He,weekdaysShort:Le,meridiemParse:/[ap]\.?m?\.?/i},Qe={},et={};function tt(e){return e?e.toLowerCase().replace("_","-"):e}function it(t){var i=null;if(!Qe[t]&&void 0!==e&&e&&e.exports)try{i=Ze._abbr,function(){var e=new Error('Cannot find module "./locale"');throw e.code="MODULE_NOT_FOUND",e}(),ot(i)}catch(e){}return Qe[t]}function ot(e,t){var i;return e&&((i=r(t)?st(e):nt(e,t))?Ze=i:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),Ze._abbr}function nt(e,t){if(null!==t){var i,o=Je;if(t.abbr=e,null!=Qe[e])D("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),o=Qe[e]._config;else if(null!=t.parentLocale)if(null!=Qe[t.parentLocale])o=Qe[t.parentLocale]._config;else{if(null==(i=it(t.parentLocale)))return et[t.parentLocale]||(et[t.parentLocale]=[]),et[t.parentLocale].push({name:e,config:t}),null;o=i._config}return Qe[e]=new P(T(o,t)),et[e]&&et[e].forEach((function(e){nt(e.name,e.config)})),ot(e),Qe[e]}return delete Qe[e],null}function st(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return Ze;if(!n(e)){if(t=it(e))return t;e=[e]}return function(e){for(var t,i,o,n,s=0;s0;){if(o=it(n.slice(0,t).join("-")))return o;if(i&&i.length>=t&&x(n,i,!0)>=t-1)break;t--}s++}return Ze}(e)}function rt(e){var t,i=e._a;return i&&-2===f(e).overflow&&(t=i[1]<0||i[1]>11?1:i[2]<1||i[2]>xe(i[0],i[1])?2:i[3]<0||i[3]>24||24===i[3]&&(0!==i[4]||0!==i[5]||0!==i[6])?3:i[4]<0||i[4]>59?4:i[5]<0||i[5]>59?5:i[6]<0||i[6]>999?6:-1,f(e)._overflowDayOfYear&&(t<0||t>2)&&(t=2),f(e)._overflowWeeks&&-1===t&&(t=7),f(e)._overflowWeekday&&-1===t&&(t=8),f(e).overflow=t),e}function at(e,t,i){return null!=e?e:null!=t?t:i}function dt(e){var t,i,n,s,r,a=[];if(!e._d){for(n=function(e){var t=new Date(o.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}(e),e._w&&null==e._a[2]&&null==e._a[1]&&function(e){var t,i,o,n,s,r,a,d;if(null!=(t=e._w).GG||null!=t.W||null!=t.E)s=1,r=4,i=at(t.GG,e._a[0],Ae(xt(),1,4).year),o=at(t.W,1),((n=at(t.E,1))<1||n>7)&&(d=!0);else{s=e._locale._week.dow,r=e._locale._week.doy;var h=Ae(xt(),s,r);i=at(t.gg,e._a[0],h.year),o=at(t.w,h.week),null!=t.d?((n=t.d)<0||n>6)&&(d=!0):null!=t.e?(n=t.e+s,(t.e<0||t.e>6)&&(d=!0)):n=s}o<1||o>Re(i,s,r)?f(e)._overflowWeeks=!0:null!=d?f(e)._overflowWeekday=!0:(a=ze(i,o,n,s,r),e._a[0]=a.year,e._dayOfYear=a.dayOfYear)}(e),null!=e._dayOfYear&&(r=at(e._a[0],n[0]),(e._dayOfYear>ge(r)||0===e._dayOfYear)&&(f(e)._overflowDayOfYear=!0),i=Ne(r,0,e._dayOfYear),e._a[1]=i.getUTCMonth(),e._a[2]=i.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=n[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[3]&&0===e._a[4]&&0===e._a[5]&&0===e._a[6]&&(e._nextDay=!0,e._a[3]=0),e._d=(e._useUTC?Ne:Ie).apply(null,a),s=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[3]=24),e._w&&void 0!==e._w.d&&e._w.d!==s&&(f(e).weekdayMismatch=!0)}}var ht=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,lt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ut=/Z|[+-]\d\d(?::?\d\d)?/,ct=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],ft=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],pt=/^\/?Date\((\-?\d+)/i;function vt(e){var t,i,o,n,s,r,a=e._i,d=ht.exec(a)||lt.exec(a);if(d){for(f(e).iso=!0,t=0,i=ct.length;t0&&f(e).unusedInput.push(r),a=a.slice(a.indexOf(i)+i.length),h+=i.length),W[s]?(i?f(e).empty=!1:f(e).unusedTokens.push(s),ve(s,i,e)):e._strict&&!i&&f(e).unusedTokens.push(s);f(e).charsLeftOver=d-h,a.length>0&&f(e).unusedInput.push(a),e._a[3]<=12&&!0===f(e).bigHour&&e._a[3]>0&&(f(e).bigHour=void 0),f(e).parsedDateParts=e._a.slice(0),f(e).meridiem=e._meridiem,e._a[3]=function(e,t,i){var o;return null==i?t:null!=e.meridiemHour?e.meridiemHour(t,i):null!=e.isPM?((o=e.isPM(i))&&t<12&&(t+=12),o||12!==t||(t=0),t):t}(e._locale,e._a[3],e._meridiem),dt(e),rt(e)}else bt(e);else vt(e)}function wt(e){var t=e._i,i=e._f;return e._locale=e._locale||st(e._l),null===t||void 0===i&&""===t?v({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),_(t)?new b(rt(t)):(d(t)?e._d=t:n(i)?function(e){var t,i,o,n,s;if(0===e._f.length)return f(e).invalidFormat=!0,void(e._d=new Date(NaN));for(n=0;nthis?this:e:v()}));function Et(e,t){var i,o;if(1===t.length&&n(t[0])&&(t=t[0]),!t.length)return xt();for(i=t[0],o=1;o(s=Re(e,o,n))&&(t=s),Jt.call(this,e,t,i,o,n))}function Jt(e,t,i,o,n){var s=ze(e,t,i,o,n),r=Ne(s.year,0,s.dayOfYear);return this.year(r.getUTCFullYear()),this.month(r.getUTCMonth()),this.date(r.getUTCDate()),this}Y(0,["gg",2],0,(function(){return this.weekYear()%100})),Y(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),Zt("gggg","weekYear"),Zt("ggggg","weekYear"),Zt("GGGG","isoWeekYear"),Zt("GGGGG","isoWeekYear"),I("weekYear","gg"),I("isoWeekYear","GG"),A("weekYear",1),A("isoWeekYear",1),he("G",ne),he("g",ne),he("GG",$,q),he("gg",$,q),he("GGGG",te,K),he("gggg",te,K),he("GGGGG",ie,Z),he("ggggg",ie,Z),pe(["gggg","ggggg","GGGG","GGGGG"],(function(e,t,i,o){t[o.substr(0,2)]=k(e)})),pe(["gg","GG"],(function(e,t,i,n){t[n]=o.parseTwoDigitYear(e)})),Y("Q",0,"Qo","quarter"),I("quarter","Q"),A("quarter",7),he("Q",G),fe("Q",(function(e,t){t[1]=3*(k(e)-1)})),Y("D",["DD",2],"Do","date"),I("date","D"),A("date",9),he("D",$),he("DD",$,q),he("Do",(function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient})),fe(["D","DD"],2),fe("Do",(function(e,t){t[2]=k(e.match($)[0])}));var Qt=_e("Date",!0);Y("DDD",["DDDD",3],"DDDo","dayOfYear"),I("dayOfYear","DDD"),A("dayOfYear",4),he("DDD",ee),he("DDDD",X),fe(["DDD","DDDD"],(function(e,t,i){i._dayOfYear=k(e)})),Y("m",["mm",2],0,"minute"),I("minute","m"),A("minute",14),he("m",$),he("mm",$,q),fe(["m","mm"],4);var ei=_e("Minutes",!1);Y("s",["ss",2],0,"second"),I("second","s"),A("second",15),he("s",$),he("ss",$,q),fe(["s","ss"],5);var ti,ii=_e("Seconds",!1);for(Y("S",0,0,(function(){return~~(this.millisecond()/100)})),Y(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),Y(0,["SSS",3],0,"millisecond"),Y(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),Y(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),Y(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),Y(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),Y(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),Y(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),I("millisecond","ms"),A("millisecond",16),he("S",ee,G),he("SS",ee,q),he("SSS",ee,X),ti="SSSS";ti.length<=9;ti+="S")he(ti,oe);function oi(e,t){t[6]=k(1e3*("0."+e))}for(ti="S";ti.length<=9;ti+="S")fe(ti,oi);var ni=_e("Milliseconds",!1);Y("z",0,0,"zoneAbbr"),Y("zz",0,0,"zoneName");var si=b.prototype;function ri(e){return e}si.add=Vt,si.calendar=function(e,t){var i=e||xt(),n=Nt(i,this).startOf("day"),s=o.calendarFormat(this,n)||"sameElse",r=t&&(C(t[s])?t[s].call(this,i):t[s]);return this.format(r||this.localeData().calendar(s,this,xt(i)))},si.clone=function(){return new b(this)},si.diff=function(e,t,i){var o,n,s;if(!this.isValid())return NaN;if(!(o=Nt(e,this)).isValid())return NaN;switch(n=6e4*(o.utcOffset()-this.utcOffset()),t=N(t)){case"year":s=Gt(this,o)/12;break;case"month":s=Gt(this,o);break;case"quarter":s=Gt(this,o)/3;break;case"second":s=(this-o)/1e3;break;case"minute":s=(this-o)/6e4;break;case"hour":s=(this-o)/36e5;break;case"day":s=(this-o-n)/864e5;break;case"week":s=(this-o-n)/6048e5;break;default:s=this-o}return i?s:w(s)},si.endOf=function(e){return void 0===(e=N(e))||"millisecond"===e?this:("date"===e&&(e="day"),this.startOf(e).add(1,"isoWeek"===e?"week":e).subtract(1,"ms"))},si.format=function(e){e||(e=this.isUtc()?o.defaultFormatUtc:o.defaultFormat);var t=V(this,e);return this.localeData().postformat(t)},si.from=function(e,t){return this.isValid()&&(_(e)&&e.isValid()||xt(e).isValid())?jt({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},si.fromNow=function(e){return this.from(xt(),e)},si.to=function(e,t){return this.isValid()&&(_(e)&&e.isValid()||xt(e).isValid())?jt({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},si.toNow=function(e){return this.to(xt(),e)},si.get=function(e){return C(this[e=N(e)])?this[e]():this},si.invalidAt=function(){return f(this).overflow},si.isAfter=function(e,t){var i=_(e)?e:xt(e);return!(!this.isValid()||!i.isValid())&&("millisecond"===(t=N(t)||"millisecond")?this.valueOf()>i.valueOf():i.valueOf()9999?V(i,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):C(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",V(i,"Z")):V(i,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},si.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var i="["+e+'("]',o=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n=t+'[")]';return this.format(i+o+"-MM-DD[T]HH:mm:ss.SSS"+n)},si.toJSON=function(){return this.isValid()?this.toISOString():null},si.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},si.unix=function(){return Math.floor(this.valueOf()/1e3)},si.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},si.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},si.year=be,si.isLeapYear=function(){return ye(this.year())},si.weekYear=function(e){return $t.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},si.isoWeekYear=function(e){return $t.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},si.quarter=si.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},si.month=Ce,si.daysInMonth=function(){return xe(this.year(),this.month())},si.week=si.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},si.isoWeek=si.isoWeeks=function(e){var t=Ae(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},si.weeksInYear=function(){var e=this.localeData()._week;return Re(this.year(),e.dow,e.doy)},si.isoWeeksInYear=function(){return Re(this.year(),1,4)},si.date=Qt,si.day=si.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=function(e,t){return"string"!=typeof e?e:isNaN(e)?"number"==typeof(e=t.weekdaysParse(e))?e:null:parseInt(e,10)}(e,this.localeData()),this.add(e-t,"d")):t},si.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},si.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=function(e,t){return"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7},si.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},si.hour=si.hours=$e,si.minute=si.minutes=ei,si.second=si.seconds=ii,si.millisecond=si.milliseconds=ni,si.utcOffset=function(e,t,i){var n,s=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null!=e){if("string"==typeof e){if(null===(e=It(re,e)))return this}else Math.abs(e)<16&&!i&&(e*=60);return!this._isUTC&&t&&(n=Bt(this)),this._offset=e,this._isUTC=!0,null!=n&&this.add(n,"m"),s!==e&&(!t||this._changeInProgress?Yt(this,jt(e-s,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,o.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?s:Bt(this)},si.utc=function(e){return this.utcOffset(0,e)},si.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Bt(this),"m")),this},si.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=It(se,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},si.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?xt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},si.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},si.isLocal=function(){return!!this.isValid()&&!this._isUTC},si.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},si.isUtc=zt,si.isUTC=zt,si.zoneAbbr=function(){return this._isUTC?"UTC":""},si.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},si.dates=M("dates accessor is deprecated. Use date instead.",Qt),si.months=M("months accessor is deprecated. Use month instead",Ce),si.years=M("years accessor is deprecated. Use year instead",be),si.zone=M("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",(function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()})),si.isDSTShifted=M("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",(function(){if(!r(this._isDSTShifted))return this._isDSTShifted;var e={};if(y(e,this),(e=wt(e))._a){var t=e._isUTC?c(e._a):xt(e._a);this._isDSTShifted=this.isValid()&&x(e._a,t.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}));var ai=P.prototype;function di(e,t,i,o){var n=st(),s=c().set(o,t);return n[i](s,e)}function hi(e,t,i){if(a(e)&&(t=e,e=void 0),e=e||"",null!=t)return di(e,t,i,"month");var o,n=[];for(o=0;o<12;o++)n[o]=di(e,o,i,"month");return n}function li(e,t,i,o){"boolean"==typeof e?(a(t)&&(i=t,t=void 0),t=t||""):(i=t=e,e=!1,a(t)&&(i=t,t=void 0),t=t||"");var n,s=st(),r=e?s._week.dow:0;if(null!=i)return di(t,(i+r)%7,o,"day");var d=[];for(n=0;n<7;n++)d[n]=di(t,(n+r)%7,o,"day");return d}ai.calendar=function(e,t,i){var o=this._calendar[e]||this._calendar.sameElse;return C(o)?o.call(t,i):o},ai.longDateFormat=function(e){var t=this._longDateFormat[e],i=this._longDateFormat[e.toUpperCase()];return t||!i?t:(this._longDateFormat[e]=i.replace(/MMMM|MM|DD|dddd/g,(function(e){return e.slice(1)})),this._longDateFormat[e])},ai.invalidDate=function(){return this._invalidDate},ai.ordinal=function(e){return this._ordinal.replace("%d",e)},ai.preparse=ri,ai.postformat=ri,ai.relativeTime=function(e,t,i,o){var n=this._relativeTime[i];return C(n)?n(e,t,i,o):n.replace(/%d/i,e)},ai.pastFuture=function(e,t){var i=this._relativeTime[e>0?"future":"past"];return C(i)?i(t):i.replace(/%s/i,t)},ai.set=function(e){var t,i;for(i in e)C(t=e[i])?this[i]=t:this["_"+i]=t;this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},ai.months=function(e,t){return e?n(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||Oe).test(t)?"format":"standalone"][e.month()]:n(this._months)?this._months:this._months.standalone},ai.monthsShort=function(e,t){return e?n(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[Oe.test(t)?"format":"standalone"][e.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},ai.monthsParse=function(e,t,i){var o,n,s;if(this._monthsParseExact)return Se.call(this,e,t,i);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),o=0;o<12;o++){if(n=c([2e3,o]),i&&!this._longMonthsParse[o]&&(this._longMonthsParse[o]=new RegExp("^"+this.months(n,"").replace(".","")+"$","i"),this._shortMonthsParse[o]=new RegExp("^"+this.monthsShort(n,"").replace(".","")+"$","i")),i||this._monthsParse[o]||(s="^"+this.months(n,"")+"|^"+this.monthsShort(n,""),this._monthsParse[o]=new RegExp(s.replace(".",""),"i")),i&&"MMMM"===t&&this._longMonthsParse[o].test(e))return o;if(i&&"MMM"===t&&this._shortMonthsParse[o].test(e))return o;if(!i&&this._monthsParse[o].test(e))return o}},ai.monthsRegex=function(e){return this._monthsParseExact?(l(this,"_monthsRegex")||Fe.call(this),e?this._monthsStrictRegex:this._monthsRegex):(l(this,"_monthsRegex")||(this._monthsRegex=Pe),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},ai.monthsShortRegex=function(e){return this._monthsParseExact?(l(this,"_monthsRegex")||Fe.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(l(this,"_monthsShortRegex")||(this._monthsShortRegex=Te),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},ai.week=function(e){return Ae(e,this._week.dow,this._week.doy).week},ai.firstDayOfYear=function(){return this._week.doy},ai.firstDayOfWeek=function(){return this._week.dow},ai.weekdays=function(e,t){return e?n(this._weekdays)?this._weekdays[e.day()]:this._weekdays[this._weekdays.isFormat.test(t)?"format":"standalone"][e.day()]:n(this._weekdays)?this._weekdays:this._weekdays.standalone},ai.weekdaysMin=function(e){return e?this._weekdaysMin[e.day()]:this._weekdaysMin},ai.weekdaysShort=function(e){return e?this._weekdaysShort[e.day()]:this._weekdaysShort},ai.weekdaysParse=function(e,t,i){var o,n,s;if(this._weekdaysParseExact)return We.call(this,e,t,i);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),o=0;o<7;o++){if(n=c([2e3,1]).day(o),i&&!this._fullWeekdaysParse[o]&&(this._fullWeekdaysParse[o]=new RegExp("^"+this.weekdays(n,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[o]=new RegExp("^"+this.weekdaysShort(n,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[o]=new RegExp("^"+this.weekdaysMin(n,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[o]||(s="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[o]=new RegExp(s.replace(".",""),"i")),i&&"dddd"===t&&this._fullWeekdaysParse[o].test(e))return o;if(i&&"ddd"===t&&this._shortWeekdaysParse[o].test(e))return o;if(i&&"dd"===t&&this._minWeekdaysParse[o].test(e))return o;if(!i&&this._weekdaysParse[o].test(e))return o}},ai.weekdaysRegex=function(e){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Ge.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(l(this,"_weekdaysRegex")||(this._weekdaysRegex=Ye),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},ai.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Ge.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(l(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Ve),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},ai.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Ge.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(l(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Ue),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},ai.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},ai.meridiem=function(e,t,i){return e>11?i?"pm":"PM":i?"am":"AM"},ot("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===k(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),o.lang=M("moment.lang is deprecated. Use moment.locale instead.",ot),o.langData=M("moment.langData is deprecated. Use moment.localeData instead.",st);var ui=Math.abs;function ci(e,t,i,o){var n=jt(t,i);return e._milliseconds+=o*n._milliseconds,e._days+=o*n._days,e._months+=o*n._months,e._bubble()}function fi(e){return e<0?Math.floor(e):Math.ceil(e)}function pi(e){return 4800*e/146097}function vi(e){return 146097*e/4800}function gi(e){return function(){return this.as(e)}}var yi=gi("ms"),mi=gi("s"),bi=gi("m"),_i=gi("h"),wi=gi("d"),ki=gi("w"),xi=gi("M"),Oi=gi("y");function Mi(e){return function(){return this.isValid()?this._data[e]:NaN}}var Ei=Mi("milliseconds"),Si=Mi("seconds"),Di=Mi("minutes"),Ci=Mi("hours"),Ti=Mi("days"),Pi=Mi("months"),Fi=Mi("years");var Ii=Math.round,Ni={ss:44,s:45,m:45,h:22,d:26,M:11};function Bi(e,t,i,o,n){return n.relativeTime(t||1,!!i,e,o)}var zi=Math.abs;function Ai(e){return(e>0)-(e<0)||+e}function Ri(){if(!this.isValid())return this.localeData().invalidDate();var e,t,i=zi(this._milliseconds)/1e3,o=zi(this._days),n=zi(this._months);e=w(i/60),t=w(e/60),i%=60,e%=60;var s=w(n/12),r=n%=12,a=o,d=t,h=e,l=i?i.toFixed(3).replace(/\.?0+$/,""):"",u=this.asSeconds();if(!u)return"P0D";var c=u<0?"-":"",f=Ai(this._months)!==Ai(u)?"-":"",p=Ai(this._days)!==Ai(u)?"-":"",v=Ai(this._milliseconds)!==Ai(u)?"-":"";return c+"P"+(s?f+s+"Y":"")+(r?f+r+"M":"")+(a?p+a+"D":"")+(d||h||l?"T":"")+(d?v+d+"H":"")+(h?v+h+"M":"")+(l?v+l+"S":"")}var ji=Dt.prototype;return ji.isValid=function(){return this._isValid},ji.abs=function(){var e=this._data;return this._milliseconds=ui(this._milliseconds),this._days=ui(this._days),this._months=ui(this._months),e.milliseconds=ui(e.milliseconds),e.seconds=ui(e.seconds),e.minutes=ui(e.minutes),e.hours=ui(e.hours),e.months=ui(e.months),e.years=ui(e.years),this},ji.add=function(e,t){return ci(this,e,t,1)},ji.subtract=function(e,t){return ci(this,e,t,-1)},ji.as=function(e){if(!this.isValid())return NaN;var t,i,o=this._milliseconds;if("month"===(e=N(e))||"year"===e)return t=this._days+o/864e5,i=this._months+pi(t),"month"===e?i:i/12;switch(t=this._days+Math.round(vi(this._months)),e){case"week":return t/7+o/6048e5;case"day":return t+o/864e5;case"hour":return 24*t+o/36e5;case"minute":return 1440*t+o/6e4;case"second":return 86400*t+o/1e3;case"millisecond":return Math.floor(864e5*t)+o;default:throw new Error("Unknown unit "+e)}},ji.asMilliseconds=yi,ji.asSeconds=mi,ji.asMinutes=bi,ji.asHours=_i,ji.asDays=wi,ji.asWeeks=ki,ji.asMonths=xi,ji.asYears=Oi,ji.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*k(this._months/12):NaN},ji._bubble=function(){var e,t,i,o,n,s=this._milliseconds,r=this._days,a=this._months,d=this._data;return s>=0&&r>=0&&a>=0||s<=0&&r<=0&&a<=0||(s+=864e5*fi(vi(a)+r),r=0,a=0),d.milliseconds=s%1e3,e=w(s/1e3),d.seconds=e%60,t=w(e/60),d.minutes=t%60,i=w(t/60),d.hours=i%24,r+=w(i/24),a+=n=w(pi(r)),r-=fi(vi(n)),o=w(a/12),a%=12,d.days=r,d.months=a,d.years=o,this},ji.clone=function(){return jt(this)},ji.get=function(e){return e=N(e),this.isValid()?this[e+"s"]():NaN},ji.milliseconds=Ei,ji.seconds=Si,ji.minutes=Di,ji.hours=Ci,ji.days=Ti,ji.weeks=function(){return w(this.days()/7)},ji.months=Pi,ji.years=Fi,ji.humanize=function(e){if(!this.isValid())return this.localeData().invalidDate();var t=this.localeData(),i=function(e,t,i){var o=jt(e).abs(),n=Ii(o.as("s")),s=Ii(o.as("m")),r=Ii(o.as("h")),a=Ii(o.as("d")),d=Ii(o.as("M")),h=Ii(o.as("y")),l=n<=Ni.ss&&["s",n]||n0,l[4]=i,Bi.apply(null,l)}(this,!e,t);return e&&(i=t.pastFuture(+this,i)),t.postformat(i)},ji.toISOString=Ri,ji.toString=Ri,ji.toJSON=Ri,ji.locale=qt,ji.localeData=Kt,ji.toIsoString=M("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Ri),ji.lang=Xt,Y("X",0,0,"unix"),Y("x",0,0,"valueOf"),he("x",ne),he("X",/[+-]?\d+(\.\d{1,3})?/),fe("X",(function(e,t,i){i._d=new Date(1e3*parseFloat(e,10))})),fe("x",(function(e,t,i){i._d=new Date(k(e))})),o.version="2.23.0",t=xt,o.fn=si,o.min=function(){return Et("isBefore",[].slice.call(arguments,0))},o.max=function(){return Et("isAfter",[].slice.call(arguments,0))},o.now=function(){return Date.now?Date.now():+new Date},o.utc=c,o.unix=function(e){return xt(1e3*e)},o.months=function(e,t){return hi(e,t,"months")},o.isDate=d,o.locale=ot,o.invalid=v,o.duration=jt,o.isMoment=_,o.weekdays=function(e,t,i){return li(e,t,i,"weekdays")},o.parseZone=function(){return xt.apply(null,arguments).parseZone()},o.localeData=st,o.isDuration=Ct,o.monthsShort=function(e,t){return hi(e,t,"monthsShort")},o.weekdaysMin=function(e,t,i){return li(e,t,i,"weekdaysMin")},o.defineLocale=nt,o.updateLocale=function(e,t){if(null!=t){var i,o,n=Je;null!=(o=it(e))&&(n=o._config),(i=new P(t=T(n,t))).parentLocale=Qe[e],Qe[e]=i,ot(e)}else null!=Qe[e]&&(null!=Qe[e].parentLocale?Qe[e]=Qe[e].parentLocale:null!=Qe[e]&&delete Qe[e]);return Qe[e]},o.locales=function(){return E(Qe)},o.weekdaysShort=function(e,t,i){return li(e,t,i,"weekdaysShort")},o.normalizeUnits=N,o.relativeTimeRounding=function(e){return void 0===e?Ii:"function"==typeof e&&(Ii=e,!0)},o.relativeTimeThreshold=function(e,t){return void 0!==Ni[e]&&(void 0===t?Ni[e]:(Ni[e]=t,"s"===e&&(Ni.ss=t-1),!0))},o.calendarFormat=function(e,t){var i=e.diff(t,"days",!0);return i<-6?"sameElse":i<-1?"lastWeek":i<0?"lastDay":i<1?"sameDay":i<2?"nextDay":i<7?"nextWeek":"sameElse"},o.prototype=si,o.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},o}()}).call(t,i(117)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){function i(e){throw new Error("Cannot find module '"+e+"'.")}i.keys=function(){return[]},i.resolve=i,e.exports=i,i.id=118},function(e,t,i){"use strict";(function(t){var i,o="undefined"!=typeof window?window:void 0!==t?t:null;if(o&&o.crypto&&crypto.getRandomValues){var n=new Uint8Array(16);i=function(){return crypto.getRandomValues(n),n}}if(!i){var s=new Array(16);i=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),s[t]=e>>>((3&t)<<3)&255;return s}}for(var r=[],a={},d=0;d<256;d++)r[d]=(d+256).toString(16).substr(1),a[r[d]]=d;function h(e,t){var i=t||0,o=r;return o[e[i++]]+o[e[i++]]+o[e[i++]]+o[e[i++]]+"-"+o[e[i++]]+o[e[i++]]+"-"+o[e[i++]]+o[e[i++]]+"-"+o[e[i++]]+o[e[i++]]+"-"+o[e[i++]]+o[e[i++]]+o[e[i++]]+o[e[i++]]+o[e[i++]]+o[e[i++]]}var l=i(),u=[1|l[0],l[1],l[2],l[3],l[4],l[5]],c=16383&(l[6]<<8|l[7]),f=0,p=0;function v(e,t,o){var n=t&&o||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||i)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var r=0;r<16;r++)t[n+r]=s[r];return t||h(s)}var g=v;g.v1=function(e,t,i){var o=t&&i||0,n=t||[],s=void 0!==(e=e||{}).clockseq?e.clockseq:c,r=void 0!==e.msecs?e.msecs:(new Date).getTime(),a=void 0!==e.nsecs?e.nsecs:p+1,d=r-f+(a-p)/1e4;if(d<0&&void 0===e.clockseq&&(s=s+1&16383),(d<0||r>f)&&void 0===e.nsecs&&(a=0),a>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");f=r,p=a,c=s;var l=(1e4*(268435455&(r+=122192928e5))+a)%4294967296;n[o++]=l>>>24&255,n[o++]=l>>>16&255,n[o++]=l>>>8&255,n[o++]=255&l;var v=r/4294967296*1e4&268435455;n[o++]=v>>>8&255,n[o++]=255&v,n[o++]=v>>>24&15|16,n[o++]=v>>>16&255,n[o++]=s>>>8|128,n[o++]=255&s;for(var g=e.node||u,y=0;y<6;y++)n[o+y]=g[y];return t||h(n)},g.v4=v,g.parse=function(e,t,i){var o=t&&i||0,n=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,(function(e){n<16&&(t[o+n++]=a[e])}));n<16;)t[o+n++]=0;return t},g.unparse=h,e.exports=g}).call(t,i(120))},function(e,t){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){"use strict";t.util=i(2),t.DOMutil=i(122),t.DataSet=i(33),t.DataView=i(51),t.Queue=i(72),t.Network=i(124),t.network={Images:i(76),dotparser:i(74),gephiParser:i(75),allOptions:i(84)},t.network.convertDot=function(e){return t.network.dotparser.DOTToGraph(e)},t.network.convertGephi=function(e,i){return t.network.gephiParser.parseGephi(e,i)},t.moment=i(71),t.Hammer=i(24),t.keycharm=i(52)},function(e,t,i){"use strict";t.prepareElements=function(e){for(var t in e)e.hasOwnProperty(t)&&(e[t].redundant=e[t].used,e[t].used=[])},t.cleanupElements=function(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t].redundant){for(var i=0;i0?(o=t[e].redundant[0],t[e].redundant.shift()):(o=document.createElementNS("http://www.w3.org/2000/svg",e),i.appendChild(o)):(o=document.createElementNS("http://www.w3.org/2000/svg",e),t[e]={used:[],redundant:[]},i.appendChild(o)),t[e].used.push(o),o},t.getDOMElement=function(e,t,i,o){var n;return t.hasOwnProperty(e)?t[e].redundant.length>0?(n=t[e].redundant[0],t[e].redundant.shift()):(n=document.createElement(e),void 0!==o?i.insertBefore(n,o):i.appendChild(n)):(n=document.createElement(e),t[e]={used:[],redundant:[]},void 0!==o?i.insertBefore(n,o):i.appendChild(n)),t[e].used.push(n),n},t.drawPoint=function(e,i,o,n,s,r){var a;if("circle"==o.style?((a=t.getSVGElement("circle",n,s)).setAttributeNS(null,"cx",e),a.setAttributeNS(null,"cy",i),a.setAttributeNS(null,"r",.5*o.size)):((a=t.getSVGElement("rect",n,s)).setAttributeNS(null,"x",e-.5*o.size),a.setAttributeNS(null,"y",i-.5*o.size),a.setAttributeNS(null,"width",o.size),a.setAttributeNS(null,"height",o.size)),void 0!==o.styles&&a.setAttributeNS(null,"style",o.styles),a.setAttributeNS(null,"class",o.className+" vis-point"),r){var d=t.getSVGElement("text",n,s);r.xOffset&&(e+=r.xOffset),r.yOffset&&(i+=r.yOffset),r.content&&(d.textContent=r.content),r.className&&d.setAttributeNS(null,"class",r.className+" vis-label"),d.setAttributeNS(null,"x",e),d.setAttributeNS(null,"y",i)}return a},t.drawBar=function(e,i,o,n,s,r,a,d){if(0!=n){n<0&&(i-=n*=-1);var h=t.getSVGElement("rect",r,a);h.setAttributeNS(null,"x",e-.5*o),h.setAttributeNS(null,"y",i),h.setAttributeNS(null,"width",o),h.setAttributeNS(null,"height",n),h.setAttributeNS(null,"class",s),d&&h.setAttributeNS(null,"style",d)}}},function(e,t,i){var o=i(6),n=o.JSON||(o.JSON={stringify:JSON.stringify});e.exports=function(e){return n.stringify.apply(n,arguments)}},function(e,t,i){"use strict";i(125);var o=i(73),n=i(2),s=i(74),r=i(75),a=i(126),d=i(129),h=i(76).default,l=i(134).default,u=i(135).default,c=i(165).default,f=i(171).default,p=i(178).default,v=i(180).default,g=i(181).default,y=i(182).default,m=i(183).default,b=i(186).default,_=i(187).default,w=i(190).default,k=i(191).default,x=i(54).default,O=i(54).printStyle,M=i(84),E=M.allOptions,S=M.configureOptions,D=i(193).default;function C(e,t,i){var o=this;if(!(this instanceof C))throw new SyntaxError("Constructor must be called with the new operator");this.options={},this.defaultOptions={locale:"en",locales:d,clickToUse:!1},n.extend(this.options,this.defaultOptions),this.body={container:e,nodes:{},nodeIndices:[],edges:{},edgeIndices:[],emitter:{on:this.on.bind(this),off:this.off.bind(this),emit:this.emit.bind(this),once:this.once.bind(this)},eventListeners:{onTap:function(){},onTouch:function(){},onDoubleTap:function(){},onHold:function(){},onDragStart:function(){},onDrag:function(){},onDragEnd:function(){},onMouseWheel:function(){},onPinch:function(){},onMouseMove:function(){},onRelease:function(){},onContext:function(){}},data:{nodes:null,edges:null},functions:{createNode:function(){},createEdge:function(){},getPointer:function(){}},modules:{},view:{scale:1,translation:{x:0,y:0}}},this.bindEventListeners(),this.images=new h((function(){return o.body.emitter.emit("_requestRedraw")})),this.groups=new l,this.canvas=new g(this.body),this.selectionHandler=new b(this.body,this.canvas),this.interactionHandler=new m(this.body,this.canvas,this.selectionHandler),this.view=new y(this.body,this.canvas),this.renderer=new v(this.body,this.canvas),this.physics=new f(this.body),this.layoutEngine=new _(this.body),this.clustering=new p(this.body),this.manipulation=new w(this.body,this.canvas,this.selectionHandler),this.nodesHandler=new u(this.body,this.images,this.groups,this.layoutEngine),this.edgesHandler=new c(this.body,this.images,this.groups),this.body.modules.kamadaKawai=new D(this.body,150,.05),this.body.modules.clustering=this.clustering,this.canvas._create(),this.setOptions(i),this.setData(t)}o(C.prototype),C.prototype.setOptions=function(e){var t=this;if(null===e&&(e=void 0),void 0!==e){if(!0===x.validate(e,E)&&console.log("%cErrors have been found in the supplied options object.",O),n.selectiveDeepExtend(["locale","locales","clickToUse"],this.options,e),e=this.layoutEngine.setOptions(e.layout,e),this.canvas.setOptions(e),this.groups.setOptions(e.groups),this.nodesHandler.setOptions(e.nodes),this.edgesHandler.setOptions(e.edges),this.physics.setOptions(e.physics),this.manipulation.setOptions(e.manipulation,e,this.options),this.interactionHandler.setOptions(e.interaction),this.renderer.setOptions(e.interaction),this.selectionHandler.setOptions(e.interaction),void 0!==e.groups&&this.body.emitter.emit("refreshNodes"),"configure"in e&&(this.configurator||(this.configurator=new k(this,this.body.container,S,this.canvas.pixelRatio)),this.configurator.setOptions(e.configure)),this.configurator&&!0===this.configurator.options.enabled){var i={nodes:{},edges:{},layout:{},interaction:{},manipulation:{},physics:{},global:{}};n.deepExtend(i.nodes,this.nodesHandler.options),n.deepExtend(i.edges,this.edgesHandler.options),n.deepExtend(i.layout,this.layoutEngine.options),n.deepExtend(i.interaction,this.selectionHandler.options),n.deepExtend(i.interaction,this.renderer.options),n.deepExtend(i.interaction,this.interactionHandler.options),n.deepExtend(i.manipulation,this.manipulation.options),n.deepExtend(i.physics,this.physics.options),n.deepExtend(i.global,this.canvas.options),n.deepExtend(i.global,this.options),this.configurator.setModuleOptions(i)}void 0!==e.clickToUse?!0===e.clickToUse?void 0===this.activator&&(this.activator=new a(this.canvas.frame),this.activator.on("change",(function(){t.body.emitter.emit("activate")}))):(void 0!==this.activator&&(this.activator.destroy(),delete this.activator),this.body.emitter.emit("activate")):this.body.emitter.emit("activate"),this.canvas.setSize(),this.body.emitter.emit("startSimulation")}},C.prototype._updateVisibleIndices=function(){var e=this.body.nodes,t=this.body.edges;for(var i in this.body.nodeIndices=[],this.body.edgeIndices=[],e)e.hasOwnProperty(i)&&(this.clustering._isClusteredNode(i)||!1!==e[i].options.hidden||this.body.nodeIndices.push(e[i].id));for(var o in t)if(t.hasOwnProperty(o)){var n=t[o],s=e[n.fromId],r=e[n.toId],a=void 0!==s&&void 0!==r;!this.clustering._isClusteredEdge(o)&&!1===n.options.hidden&&a&&!1===s.options.hidden&&!1===r.options.hidden&&this.body.edgeIndices.push(n.id)}},C.prototype.bindEventListeners=function(){var e=this;this.body.emitter.on("_dataChanged",(function(){e.edgesHandler._updateState(),e.body.emitter.emit("_dataUpdated")})),this.body.emitter.on("_dataUpdated",(function(){e.clustering._updateState(),e._updateVisibleIndices(),e._updateValueRange(e.body.nodes),e._updateValueRange(e.body.edges),e.body.emitter.emit("startSimulation"),e.body.emitter.emit("_requestRedraw")}))},C.prototype.setData=function(e){if(this.body.emitter.emit("resetPhysics"),this.body.emitter.emit("_resetData"),this.selectionHandler.unselectAll(),e&&e.dot&&(e.nodes||e.edges))throw new SyntaxError('Data must contain either parameter "dot" or parameter pair "nodes" and "edges", but not both.');if(this.setOptions(e&&e.options),e&&e.dot){console.log("The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);");var t=s.DOTToGraph(e.dot);this.setData(t)}else if(e&&e.gephi){console.log("The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);");var i=r.parseGephi(e.gephi);this.setData(i)}else this.nodesHandler.setData(e&&e.nodes,!0),this.edgesHandler.setData(e&&e.edges,!0),this.body.emitter.emit("_dataChanged"),this.body.emitter.emit("_dataLoaded"),this.body.emitter.emit("initPhysics")},C.prototype.destroy=function(){for(var e in this.body.emitter.emit("destroy"),this.body.emitter.off(),this.off(),delete this.groups,delete this.canvas,delete this.selectionHandler,delete this.interactionHandler,delete this.view,delete this.renderer,delete this.physics,delete this.layoutEngine,delete this.clustering,delete this.manipulation,delete this.nodesHandler,delete this.edgesHandler,delete this.configurator,delete this.images,this.body.nodes)this.body.nodes.hasOwnProperty(e)&&delete this.body.nodes[e];for(var t in this.body.edges)this.body.edges.hasOwnProperty(t)&&delete this.body.edges[t];n.recursiveDOMDelete(this.body.container)},C.prototype._updateValueRange=function(e){var t,i=void 0,o=void 0,n=0;for(t in e)if(e.hasOwnProperty(t)){var s=e[t].getValue();void 0!==s&&(i=void 0===i?s:Math.min(s,i),o=void 0===o?s:Math.max(s,o),n+=s)}if(void 0!==i&&void 0!==o)for(t in e)e.hasOwnProperty(t)&&e[t].setValueRange(i,o,n)},C.prototype.isActive=function(){return!this.activator||this.activator.active},C.prototype.setSize=function(){return this.canvas.setSize.apply(this.canvas,arguments)},C.prototype.canvasToDOM=function(){return this.canvas.canvasToDOM.apply(this.canvas,arguments)},C.prototype.DOMtoCanvas=function(){return this.canvas.DOMtoCanvas.apply(this.canvas,arguments)},C.prototype.findNode=function(){return this.clustering.findNode.apply(this.clustering,arguments)},C.prototype.isCluster=function(){return this.clustering.isCluster.apply(this.clustering,arguments)},C.prototype.openCluster=function(){return this.clustering.openCluster.apply(this.clustering,arguments)},C.prototype.cluster=function(){return this.clustering.cluster.apply(this.clustering,arguments)},C.prototype.getNodesInCluster=function(){return this.clustering.getNodesInCluster.apply(this.clustering,arguments)},C.prototype.clusterByConnection=function(){return this.clustering.clusterByConnection.apply(this.clustering,arguments)},C.prototype.clusterByHubsize=function(){return this.clustering.clusterByHubsize.apply(this.clustering,arguments)},C.prototype.clusterOutliers=function(){return this.clustering.clusterOutliers.apply(this.clustering,arguments)},C.prototype.getSeed=function(){return this.layoutEngine.getSeed.apply(this.layoutEngine,arguments)},C.prototype.enableEditMode=function(){return this.manipulation.enableEditMode.apply(this.manipulation,arguments)},C.prototype.disableEditMode=function(){return this.manipulation.disableEditMode.apply(this.manipulation,arguments)},C.prototype.addNodeMode=function(){return this.manipulation.addNodeMode.apply(this.manipulation,arguments)},C.prototype.editNode=function(){return this.manipulation.editNode.apply(this.manipulation,arguments)},C.prototype.editNodeMode=function(){return console.log("Deprecated: Please use editNode instead of editNodeMode."),this.manipulation.editNode.apply(this.manipulation,arguments)},C.prototype.addEdgeMode=function(){return this.manipulation.addEdgeMode.apply(this.manipulation,arguments)},C.prototype.editEdgeMode=function(){return this.manipulation.editEdgeMode.apply(this.manipulation,arguments)},C.prototype.deleteSelected=function(){return this.manipulation.deleteSelected.apply(this.manipulation,arguments)},C.prototype.getPositions=function(){return this.nodesHandler.getPositions.apply(this.nodesHandler,arguments)},C.prototype.storePositions=function(){return this.nodesHandler.storePositions.apply(this.nodesHandler,arguments)},C.prototype.moveNode=function(){return this.nodesHandler.moveNode.apply(this.nodesHandler,arguments)},C.prototype.getBoundingBox=function(){return this.nodesHandler.getBoundingBox.apply(this.nodesHandler,arguments)},C.prototype.getConnectedNodes=function(e){return void 0!==this.body.nodes[e]?this.nodesHandler.getConnectedNodes.apply(this.nodesHandler,arguments):this.edgesHandler.getConnectedNodes.apply(this.edgesHandler,arguments)},C.prototype.getConnectedEdges=function(){return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler,arguments)},C.prototype.startSimulation=function(){return this.physics.startSimulation.apply(this.physics,arguments)},C.prototype.stopSimulation=function(){return this.physics.stopSimulation.apply(this.physics,arguments)},C.prototype.stabilize=function(){return this.physics.stabilize.apply(this.physics,arguments)},C.prototype.getSelection=function(){return this.selectionHandler.getSelection.apply(this.selectionHandler,arguments)},C.prototype.setSelection=function(){return this.selectionHandler.setSelection.apply(this.selectionHandler,arguments)},C.prototype.getSelectedNodes=function(){return this.selectionHandler.getSelectedNodes.apply(this.selectionHandler,arguments)},C.prototype.getSelectedEdges=function(){return this.selectionHandler.getSelectedEdges.apply(this.selectionHandler,arguments)},C.prototype.getNodeAt=function(){var e=this.selectionHandler.getNodeAt.apply(this.selectionHandler,arguments);return void 0!==e&&void 0!==e.id?e.id:e},C.prototype.getEdgeAt=function(){var e=this.selectionHandler.getEdgeAt.apply(this.selectionHandler,arguments);return void 0!==e&&void 0!==e.id?e.id:e},C.prototype.selectNodes=function(){return this.selectionHandler.selectNodes.apply(this.selectionHandler,arguments)},C.prototype.selectEdges=function(){return this.selectionHandler.selectEdges.apply(this.selectionHandler,arguments)},C.prototype.unselectAll=function(){this.selectionHandler.unselectAll.apply(this.selectionHandler,arguments),this.redraw()},C.prototype.redraw=function(){return this.renderer.redraw.apply(this.renderer,arguments)},C.prototype.getScale=function(){return this.view.getScale.apply(this.view,arguments)},C.prototype.getViewPosition=function(){return this.view.getViewPosition.apply(this.view,arguments)},C.prototype.fit=function(){return this.view.fit.apply(this.view,arguments)},C.prototype.moveTo=function(){return this.view.moveTo.apply(this.view,arguments)},C.prototype.focus=function(){return this.view.focus.apply(this.view,arguments)},C.prototype.releaseNode=function(){return this.view.releaseNode.apply(this.view,arguments)},C.prototype.getOptionsFromConfigurator=function(){var e={};return this.configurator&&(e=this.configurator.getOptions.apply(this.configurator)),e},e.exports=C},function(e,t,i){"use strict";"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.circle=function(e,t,i){this.beginPath(),this.arc(e,t,i,0,2*Math.PI,!1),this.closePath()},CanvasRenderingContext2D.prototype.square=function(e,t,i){this.beginPath(),this.rect(e-i,t-i,2*i,2*i),this.closePath()},CanvasRenderingContext2D.prototype.triangle=function(e,t,i){this.beginPath(),t+=.275*(i*=1.15);var o=2*i,n=o/2,s=Math.sqrt(3)/6*o,r=Math.sqrt(o*o-n*n);this.moveTo(e,t-(r-s)),this.lineTo(e+n,t+s),this.lineTo(e-n,t+s),this.lineTo(e,t-(r-s)),this.closePath()},CanvasRenderingContext2D.prototype.triangleDown=function(e,t,i){this.beginPath(),t-=.275*(i*=1.15);var o=2*i,n=o/2,s=Math.sqrt(3)/6*o,r=Math.sqrt(o*o-n*n);this.moveTo(e,t+(r-s)),this.lineTo(e+n,t-s),this.lineTo(e-n,t-s),this.lineTo(e,t+(r-s)),this.closePath()},CanvasRenderingContext2D.prototype.star=function(e,t,i){this.beginPath(),t+=.1*(i*=.82);for(var o=0;o<10;o++){var n=o%2==0?1.3*i:.5*i;this.lineTo(e+n*Math.sin(2*o*Math.PI/10),t-n*Math.cos(2*o*Math.PI/10))}this.closePath()},CanvasRenderingContext2D.prototype.diamond=function(e,t,i){this.beginPath(),this.lineTo(e,t+i),this.lineTo(e+i,t),this.lineTo(e,t-i),this.lineTo(e-i,t),this.closePath()},CanvasRenderingContext2D.prototype.roundRect=function(e,t,i,o,n){var s=Math.PI/180;i-2*n<0&&(n=i/2),o-2*n<0&&(n=o/2),this.beginPath(),this.moveTo(e+n,t),this.lineTo(e+i-n,t),this.arc(e+i-n,t+n,n,270*s,360*s,!1),this.lineTo(e+i,t+o-n),this.arc(e+i-n,t+o-n,n,0,90*s,!1),this.lineTo(e+n,t+o),this.arc(e+n,t+o-n,n,90*s,180*s,!1),this.lineTo(e,t+n),this.arc(e+n,t+n,n,180*s,270*s,!1),this.closePath()},CanvasRenderingContext2D.prototype.ellipse_vis=function(e,t,i,o){var n=.5522848,s=i/2*n,r=o/2*n,a=e+i,d=t+o,h=e+i/2,l=t+o/2;this.beginPath(),this.moveTo(e,l),this.bezierCurveTo(e,l-r,h-s,t,h,t),this.bezierCurveTo(h+s,t,a,l-r,a,l),this.bezierCurveTo(a,l+r,h+s,d,h,d),this.bezierCurveTo(h-s,d,e,l+r,e,l),this.closePath()},CanvasRenderingContext2D.prototype.database=function(e,t,i,o){var n=o*(1/3),s=.5522848,r=i/2*s,a=n/2*s,d=e+i,h=t+n,l=e+i/2,u=t+n/2,c=t+(o-n/2),f=t+o;this.beginPath(),this.moveTo(d,u),this.bezierCurveTo(d,u+a,l+r,h,l,h),this.bezierCurveTo(l-r,h,e,u+a,e,u),this.bezierCurveTo(e,u-a,l-r,t,l,t),this.bezierCurveTo(l+r,t,d,u-a,d,u),this.lineTo(d,c),this.bezierCurveTo(d,c+a,l+r,f,l,f),this.bezierCurveTo(l-r,f,e,c+a,e,c),this.lineTo(e,u)},CanvasRenderingContext2D.prototype.dashedLine=function(e,t,i,o,n){this.beginPath(),this.moveTo(e,t);for(var s=n.length,r=i-e,a=o-t,d=a/r,h=Math.sqrt(r*r+a*a),l=0,u=!0,c=0,f=n[0];h>=.1;)(f=n[l++%s])>h&&(f=h),c=Math.sqrt(f*f/(1+d*d)),e+=c=r<0?-c:c,t+=d*c,!0===u?this.lineTo(e,t):this.moveTo(e,t),h-=f,u=!u},CanvasRenderingContext2D.prototype.hexagon=function(e,t,i){this.beginPath();var o=2*Math.PI/6;this.moveTo(e+i,t);for(var n=1;n<6;n++)this.lineTo(e+i*Math.cos(o*n),t+i*Math.sin(o*n));this.closePath()})},function(e,t,i){"use strict";var o=i(52),n=i(73),s=i(24),r=i(2);function a(e){this.active=!1,this.dom={container:e},this.dom.overlay=document.createElement("div"),this.dom.overlay.className="vis-overlay",this.dom.container.appendChild(this.dom.overlay),this.hammer=s(this.dom.overlay),this.hammer.on("tap",this._onTapOverlay.bind(this));var t=this;["tap","doubletap","press","pinch","pan","panstart","panmove","panend"].forEach((function(e){t.hammer.on(e,(function(e){e.stopPropagation()}))})),document&&document.body&&(this.onClick=function(i){(function(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1})(i.target,e)||t.deactivate()},document.body.addEventListener("click",this.onClick)),void 0!==this.keycharm&&this.keycharm.destroy(),this.keycharm=o(),this.escListener=this.deactivate.bind(this)}n(a.prototype),a.current=null,a.prototype.destroy=function(){this.deactivate(),this.dom.overlay.parentNode.removeChild(this.dom.overlay),this.onClick&&document.body.removeEventListener("click",this.onClick),void 0!==this.keycharm&&this.keycharm.destroy(),this.keycharm=null,this.hammer.destroy(),this.hammer=null},a.prototype.activate=function(){a.current&&a.current.deactivate(),a.current=this,this.active=!0,this.dom.overlay.style.display="none",r.addClassName(this.dom.container,"vis-active"),this.emit("change"),this.emit("activate"),this.keycharm.bind("esc",this.escListener)},a.prototype.deactivate=function(){this.active=!1,this.dom.overlay.style.display="",r.removeClassName(this.dom.container,"vis-active"),this.keycharm.unbind("esc",this.escListener),this.emit("change"),this.emit("deactivate")},a.prototype._onTapOverlay=function(e){this.activate(),e.stopPropagation()},e.exports=a},function(e,t,i){"use strict";var o,n;void 0===(n="function"==typeof(o=function(){var e=null;return function t(i,o){var n=o||{preventDefault:!1};if(i.Manager){var s=i,r=function(e,i){var o=Object.create(n);return i&&s.assign(o,i),t(new s(e,o),o)};return s.assign(r,s),r.Manager=function(e,i){var o=Object.create(n);return i&&s.assign(o,i),t(new s.Manager(e,o),o)},r}var a=Object.create(i),d=i.element;function h(e){return e.match(/[^ ]+/g)}function l(t){if("hammer.input"!==t.type){if(t.srcEvent._handled||(t.srcEvent._handled={}),t.srcEvent._handled[t.type])return;t.srcEvent._handled[t.type]=!0}var i=!1;t.stopPropagation=function(){i=!0};var o=t.srcEvent.stopPropagation.bind(t.srcEvent);"function"==typeof o&&(t.srcEvent.stopPropagation=function(){o(),t.stopPropagation()}),t.firstTarget=e;for(var n=e;n&&!i;){var s=n.hammer;if(s)for(var r,a=0;a0?a._handlers[e]=o:(i.off(e,l),delete a._handlers[e]))})),a},a.emit=function(t,o){e=o.target,i.emit(t,o)},a.destroy=function(){var e=i.element.hammer,t=e.indexOf(a);-1!==t&&e.splice(t,1),e.length||delete i.element.hammer,a._handlers={},i.destroy()},a}})?o.apply(t,[]):o)||(e.exports=n)},function(e,t,i){var o;!function(n,s,r,a){"use strict";var d,h=["","webkit","Moz","MS","ms","o"],l=s.createElement("div"),u=Math.round,c=Math.abs,f=Date.now;function p(e,t,i){return setTimeout(w(e,i),t)}function v(e,t,i){return!!Array.isArray(e)&&(g(e,i[t],i),!0)}function g(e,t,i){var o;if(e)if(e.forEach)e.forEach(t,i);else if(e.length!==a)for(o=0;o\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",s=n.console&&(n.console.warn||n.console.log);return s&&s.call(n.console,o,i),e.apply(this,arguments)}}d="function"!=typeof Object.assign?function(e){if(e===a||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i-1}function D(e){return e.trim().split(/\s+/g)}function C(e,t,i){if(e.indexOf&&!i)return e.indexOf(t);for(var o=0;oi[t]})):o.sort()),o}function F(e,t){for(var i,o,n=t[0].toUpperCase()+t.slice(1),s=0;s1&&!i.firstMultiple?i.firstMultiple=V(t):1===n&&(i.firstMultiple=!1);var s=i.firstInput,r=i.firstMultiple,d=r?r.center:s.center,h=t.center=U(o);t.timeStamp=f(),t.deltaTime=t.timeStamp-s.timeStamp,t.angle=K(d,h),t.distance=X(d,h),function(e,t){var i=t.center,o=e.offsetDelta||{},n=e.prevDelta||{},s=e.prevInput||{};1!==t.eventType&&4!==s.eventType||(n=e.prevDelta={x:s.deltaX||0,y:s.deltaY||0},o=e.offsetDelta={x:i.x,y:i.y}),t.deltaX=n.x+(i.x-o.x),t.deltaY=n.y+(i.y-o.y)}(i,t),t.offsetDirection=q(t.deltaX,t.deltaY);var l,u,p=G(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=p.x,t.overallVelocityY=p.y,t.overallVelocity=c(p.x)>c(p.y)?p.x:p.y,t.scale=r?(l=r.pointers,X((u=o)[0],u[1],H)/X(l[0],l[1],H)):1,t.rotation=r?function(e,t){return K(t[1],t[0],H)+K(e[1],e[0],H)}(r.pointers,o):0,t.maxPointers=i.prevInput?t.pointers.length>i.prevInput.maxPointers?t.pointers.length:i.prevInput.maxPointers:t.pointers.length,function(e,t){var i,o,n,s,r=e.lastInterval||t,d=t.timeStamp-r.timeStamp;if(8!=t.eventType&&(d>25||r.velocity===a)){var h=t.deltaX-r.deltaX,l=t.deltaY-r.deltaY,u=G(d,h,l);o=u.x,n=u.y,i=c(u.x)>c(u.y)?u.x:u.y,s=q(h,l),e.lastInterval=t}else i=r.velocity,o=r.velocityX,n=r.velocityY,s=r.direction;t.velocity=i,t.velocityX=o,t.velocityY=n,t.direction=s}(i,t);var v=e.element;E(t.srcEvent.target,v)&&(v=t.srcEvent.target),t.target=v}(e,i),e.emit("hammer.input",i),e.recognize(i),e.session.prevInput=i}function V(e){for(var t=[],i=0;i=c(t)?e<0?2:4:t<0?8:16}function X(e,t,i){i||(i=L);var o=t[i[0]]-e[i[0]],n=t[i[1]]-e[i[1]];return Math.sqrt(o*o+n*n)}function K(e,t,i){i||(i=L);var o=t[i[0]]-e[i[0]],n=t[i[1]]-e[i[1]];return 180*Math.atan2(n,o)/Math.PI}W.prototype={handler:function(){},init:function(){this.evEl&&O(this.element,this.evEl,this.domHandler),this.evTarget&&O(this.target,this.evTarget,this.domHandler),this.evWin&&O(N(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&M(this.element,this.evEl,this.domHandler),this.evTarget&&M(this.target,this.evTarget,this.domHandler),this.evWin&&M(N(this.element),this.evWin,this.domHandler)}};var Z={mousedown:1,mousemove:2,mouseup:4},$="mousedown",J="mousemove mouseup";function Q(){this.evEl=$,this.evWin=J,this.pressed=!1,W.apply(this,arguments)}_(Q,W,{handler:function(e){var t=Z[e.type];1&t&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=4),this.pressed&&(4&t&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:j,srcEvent:e}))}});var ee={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},te={2:R,3:"pen",4:j,5:"kinect"},ie="pointerdown",oe="pointermove pointerup pointercancel";function ne(){this.evEl=ie,this.evWin=oe,W.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}n.MSPointerEvent&&!n.PointerEvent&&(ie="MSPointerDown",oe="MSPointerMove MSPointerUp MSPointerCancel"),_(ne,W,{handler:function(e){var t=this.store,i=!1,o=e.type.toLowerCase().replace("ms",""),n=ee[o],s=te[e.pointerType]||e.pointerType,r=s==R,a=C(t,e.pointerId,"pointerId");1&n&&(0===e.button||r)?a<0&&(t.push(e),a=t.length-1):12&n&&(i=!0),a<0||(t[a]=e,this.callback(this.manager,n,{pointers:t,changedPointers:[e],pointerType:s,srcEvent:e}),i&&t.splice(a,1))}});var se={touchstart:1,touchmove:2,touchend:4,touchcancel:8},re="touchstart",ae="touchstart touchmove touchend touchcancel";function de(){this.evTarget=re,this.evWin=ae,this.started=!1,W.apply(this,arguments)}function he(e,t){var i=T(e.touches),o=T(e.changedTouches);return 12&t&&(i=P(i.concat(o),"identifier",!0)),[i,o]}_(de,W,{handler:function(e){var t=se[e.type];if(1===t&&(this.started=!0),this.started){var i=he.call(this,e,t);12&t&&i[0].length-i[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:i[0],changedPointers:i[1],pointerType:R,srcEvent:e})}}});var le={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ue="touchstart touchmove touchend touchcancel";function ce(){this.evTarget=ue,this.targetIds={},W.apply(this,arguments)}function fe(e,t){var i=T(e.touches),o=this.targetIds;if(3&t&&1===i.length)return o[i[0].identifier]=!0,[i,i];var n,s,r=T(e.changedTouches),a=[],d=this.target;if(s=i.filter((function(e){return E(e.target,d)})),1===t)for(n=0;n-1&&o.splice(e,1)}),2500)}}function ye(e){for(var t=e.srcEvent.clientX,i=e.srcEvent.clientY,o=0;o-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,i=this.state;function o(i){t.manager.emit(i,e)}i<8&&o(t.options.event+Te(i)),o(t.options.event),e.additionalEvent&&o(e.additionalEvent),i>=8&&o(t.options.event+Te(i))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=De},canEmit:function(){for(var e=0;et.threshold&&n&t.direction},attrTest:function(e){return Ie.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=Pe(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),_(Be,Ie,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[xe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),_(ze,Ce,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[we]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,o=e.distancet.time;if(this._input=e,!o||!i||12&e.eventType&&!n)this.reset();else if(1&e.eventType)this.reset(),this._timer=p((function(){this.state=8,this.tryEmit()}),t.time,this);else if(4&e.eventType)return 8;return De},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&4&e.eventType?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}}),_(Ae,Ie,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[xe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),_(Re,Ie,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Ne.prototype.getTouchAction.call(this)},attrTest:function(e){var t,i=this.options.direction;return 30&i?t=e.overallVelocity:6&i?t=e.overallVelocityX:24&i&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&i&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&c(t)>this.options.velocity&&4&e.eventType},emit:function(e){var t=Pe(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),_(je,Ce,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ke]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,o=e.distance2){t*=.5;for(var r=0;t>2&&r=this.NUM_ITERATIONS&&(r=this.NUM_ITERATIONS-1);var a=this.coordinates[r];e.drawImage(this.canvas,a[0],a[1],a[2],a[3],i,o,n,s)}else e.drawImage(this.image,i,o,n,s)}}]),e}();t.default=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=s(i(0)),n=s(i(1));function s(e){return e&&e.__esModule?e:{default:e}}var r=i(2),a=function(){function e(){(0,o.default)(this,e),this.clear(),this.defaultIndex=0,this.groupsArray=[],this.groupIndex=0,this.defaultGroups=[{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},{border:"#FFA500",background:"#FFFF00",highlight:{border:"#FFA500",background:"#FFFFA3"},hover:{border:"#FFA500",background:"#FFFFA3"}},{border:"#FA0A10",background:"#FB7E81",highlight:{border:"#FA0A10",background:"#FFAFB1"},hover:{border:"#FA0A10",background:"#FFAFB1"}},{border:"#41A906",background:"#7BE141",highlight:{border:"#41A906",background:"#A1EC76"},hover:{border:"#41A906",background:"#A1EC76"}},{border:"#E129F0",background:"#EB7DF4",highlight:{border:"#E129F0",background:"#F0B3F5"},hover:{border:"#E129F0",background:"#F0B3F5"}},{border:"#7C29F0",background:"#AD85E4",highlight:{border:"#7C29F0",background:"#D3BDF0"},hover:{border:"#7C29F0",background:"#D3BDF0"}},{border:"#C37F00",background:"#FFA807",highlight:{border:"#C37F00",background:"#FFCA66"},hover:{border:"#C37F00",background:"#FFCA66"}},{border:"#4220FB",background:"#6E6EFD",highlight:{border:"#4220FB",background:"#9B9BFD"},hover:{border:"#4220FB",background:"#9B9BFD"}},{border:"#FD5A77",background:"#FFC0CB",highlight:{border:"#FD5A77",background:"#FFD1D9"},hover:{border:"#FD5A77",background:"#FFD1D9"}},{border:"#4AD63A",background:"#C2FABC",highlight:{border:"#4AD63A",background:"#E6FFE3"},hover:{border:"#4AD63A",background:"#E6FFE3"}},{border:"#990000",background:"#EE0000",highlight:{border:"#BB0000",background:"#FF3333"},hover:{border:"#BB0000",background:"#FF3333"}},{border:"#FF6000",background:"#FF6000",highlight:{border:"#FF6000",background:"#FF6000"},hover:{border:"#FF6000",background:"#FF6000"}},{border:"#97C2FC",background:"#2B7CE9",highlight:{border:"#D2E5FF",background:"#2B7CE9"},hover:{border:"#D2E5FF",background:"#2B7CE9"}},{border:"#399605",background:"#255C03",highlight:{border:"#399605",background:"#255C03"},hover:{border:"#399605",background:"#255C03"}},{border:"#B70054",background:"#FF007E",highlight:{border:"#B70054",background:"#FF007E"},hover:{border:"#B70054",background:"#FF007E"}},{border:"#AD85E4",background:"#7C29F0",highlight:{border:"#D3BDF0",background:"#7C29F0"},hover:{border:"#D3BDF0",background:"#7C29F0"}},{border:"#4557FA",background:"#000EA1",highlight:{border:"#6E6EFD",background:"#000EA1"},hover:{border:"#6E6EFD",background:"#000EA1"}},{border:"#FFC0CB",background:"#FD5A77",highlight:{border:"#FFD1D9",background:"#FD5A77"},hover:{border:"#FFD1D9",background:"#FD5A77"}},{border:"#C2FABC",background:"#74D66A",highlight:{border:"#E6FFE3",background:"#74D66A"},hover:{border:"#E6FFE3",background:"#74D66A"}},{border:"#EE0000",background:"#990000",highlight:{border:"#FF3333",background:"#BB0000"},hover:{border:"#FF3333",background:"#BB0000"}}],this.options={},this.defaultOptions={useDefaultGroups:!0},r.extend(this.options,this.defaultOptions)}return(0,n.default)(e,[{key:"setOptions",value:function(e){var t=["useDefaultGroups"];if(void 0!==e)for(var i in e)if(e.hasOwnProperty(i)&&-1===t.indexOf(i)){var o=e[i];this.add(i,o)}}},{key:"clear",value:function(){this.groups={},this.groupsArray=[]}},{key:"get",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.groups[e];if(void 0===i&&t)if(!1===this.options.useDefaultGroups&&this.groupsArray.length>0){var o=this.groupIndex%this.groupsArray.length;this.groupIndex++,(i={}).color=this.groups[this.groupsArray[o]],this.groups[e]=i}else{var n=this.defaultIndex%this.defaultGroups.length;this.defaultIndex++,(i={}).color=this.defaultGroups[n],this.groups[e]=i}return i}},{key:"add",value:function(e,t){return this.groups[e]=t,this.groupsArray.push(e),t}}]),e}();t.default=a},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=s(i(0)),n=s(i(1));function s(e){return e&&e.__esModule?e:{default:e}}var r=i(2),a=i(33),d=i(51),h=i(34).default,l=function(){function e(t,i,n,s){var a=this;if((0,o.default)(this,e),this.body=t,this.images=i,this.groups=n,this.layoutEngine=s,this.body.functions.createNode=this.create.bind(this),this.nodesListeners={add:function(e,t){a.add(t.items)},update:function(e,t){a.update(t.items,t.data,t.oldData)},remove:function(e,t){a.remove(t.items)}},this.defaultOptions={borderWidth:1,borderWidthSelected:2,brokenImage:void 0,color:{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},fixed:{x:!1,y:!1},font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:0,strokeColor:"#ffffff",align:"center",vadjust:0,multi:!1,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"monospace",vadjust:2}},group:void 0,hidden:!1,icon:{face:"FontAwesome",code:void 0,size:50,color:"#2B7CE9"},image:void 0,label:void 0,labelHighlightBold:!0,level:void 0,margin:{top:5,right:5,bottom:5,left:5},mass:1,physics:!0,scaling:{min:10,max:30,label:{enabled:!1,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(e,t,i,o){if(t===e)return.5;var n=1/(t-e);return Math.max(0,(o-e)*n)}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},shape:"ellipse",shapeProperties:{borderDashes:!1,borderRadius:6,interpolation:!0,useImageSize:!1,useBorderWithImage:!1},size:25,title:void 0,value:void 0,x:void 0,y:void 0},this.defaultOptions.mass<=0)throw"Internal error: mass in defaultOptions of NodesHandler may not be zero or negative";this.options=r.bridgeObject(this.defaultOptions),this.bindEventListeners()}return(0,n.default)(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("refreshNodes",this.refresh.bind(this)),this.body.emitter.on("refresh",this.refresh.bind(this)),this.body.emitter.on("destroy",(function(){r.forEach(e.nodesListeners,(function(t,i){e.body.data.nodes&&e.body.data.nodes.off(i,t)})),delete e.body.functions.createNode,delete e.nodesListeners.add,delete e.nodesListeners.update,delete e.nodesListeners.remove,delete e.nodesListeners}))}},{key:"setOptions",value:function(e){if(void 0!==e){if(h.parseOptions(this.options,e),void 0!==e.shape)for(var t in this.body.nodes)this.body.nodes.hasOwnProperty(t)&&this.body.nodes[t].updateShape();if(void 0!==e.font)for(var i in this.body.nodes)this.body.nodes.hasOwnProperty(i)&&(this.body.nodes[i].updateLabelModule(),this.body.nodes[i].needsRefresh());if(void 0!==e.size)for(var o in this.body.nodes)this.body.nodes.hasOwnProperty(o)&&this.body.nodes[o].needsRefresh();void 0===e.hidden&&void 0===e.physics||this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.body.data.nodes;if(e instanceof a||e instanceof d)this.body.data.nodes=e;else if(Array.isArray(e))this.body.data.nodes=new a,this.body.data.nodes.add(e);else{if(e)throw new TypeError("Array or DataSet expected");this.body.data.nodes=new a}if(i&&r.forEach(this.nodesListeners,(function(e,t){i.off(t,e)})),this.body.nodes={},this.body.data.nodes){var o=this;r.forEach(this.nodesListeners,(function(e,t){o.body.data.nodes.on(t,e)}));var n=this.body.data.nodes.getIds();this.add(n,!0)}!1===t&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=void 0,o=[],n=0;n1&&void 0!==arguments[1]?arguments[1]:h;return new t(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}},{key:"refresh",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r.forEach(this.body.nodes,(function(i,o){var n=e.body.data.nodes.get(o);void 0!==n&&(!0===t&&i.setOptions({x:null,y:null}),i.setOptions({fixed:!1}),i.setOptions(n))}))}},{key:"getPositions",value:function(e){var t={};if(void 0!==e){if(!0===Array.isArray(e)){for(var i=0;i"://,""://,""://,"":/<\/b>/,"":/<\/i>/,"":/<\/code>/,"*":/\*/,_:/\_/,"`":/`/,afterBold:/[^\*]/,afterItal:/[^_]/,afterMono:/[^`]/},l=function(){function e(t){(0,n.default)(this,e),this.text=t,this.bold=!1,this.ital=!1,this.mono=!1,this.spacing=!1,this.position=0,this.buffer="",this.modStack=[],this.blocks=[]}return(0,s.default)(e,[{key:"mod",value:function(){return 0===this.modStack.length?"normal":this.modStack[0]}},{key:"modName",value:function(){return 0===this.modStack.length?"normal":"mono"===this.modStack[0]?"mono":this.bold&&this.ital?"boldital":this.bold?"bold":this.ital?"ital":void 0}},{key:"emitBlock",value:function(){this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(this.blocks.push({text:this.buffer,mod:this.modName()}),this.buffer="")}},{key:"add",value:function(e){" "===e&&(this.spacing=!0),this.spacing&&(this.buffer+=" ",this.spacing=!1)," "!=e&&(this.buffer+=e)}},{key:"parseWS",value:function(e){return!!/[ \t]/.test(e)&&(this.mono?this.add(e):this.spacing=!0,!0)}},{key:"setTag",value:function(e){this.emitBlock(),this[e]=!0,this.modStack.unshift(e)}},{key:"unsetTag",value:function(e){this.emitBlock(),this[e]=!1,this.modStack.shift()}},{key:"parseStartTag",value:function(e,t){return!(this.mono||this[e]||!this.match(t)||(this.setTag(e),0))}},{key:"match",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.prepareRegExp(e),n=(0,o.default)(i,2),s=n[0],r=n[1],a=s.test(this.text.substr(this.position,r));return a&&t&&(this.position+=r-1),a}},{key:"parseEndTag",value:function(e,t,i){var o=this.mod()===e;return!(!(o="mono"===e?o&&this.mono:o&&!this.mono)||!this.match(t)||(void 0!==i?(this.position===this.text.length-1||this.match(i,!1))&&this.unsetTag(e):this.unsetTag(e),0))}},{key:"replace",value:function(e,t){return!!this.match(e)&&(this.add(t),this.position+=length-1,!0)}},{key:"prepareRegExp",value:function(e){var t=void 0,i=void 0;if(e instanceof RegExp)i=e,t=1;else{var o=h[e];i=void 0!==o?o:new RegExp(e),t=e.length}return[i,t]}}]),e}(),u=function(){function e(t,i,o,s){var r=this;(0,n.default)(this,e),this.ctx=t,this.parent=i,this.selected=o,this.hover=s,this.lines=new a((function(e,i){if(void 0===e)return 0;var n=r.parent.getFormattingValues(t,o,s,i),a=0;return""!==e&&(a=r.ctx.measureText(e).width),{width:a,values:n}}))}return(0,s.default)(e,[{key:"process",value:function(e){if(!d.isValidLabel(e))return this.lines.finalize();var t=this.parent.fontOptions;e=(e=e.replace(/\r\n/g,"\n")).replace(/\r/g,"\n");var i=String(e).split("\n"),o=i.length;if(t.multi)for(var n=0;n0)for(var r=0;r0)for(var f=0;f")||t.parseStartTag("ital","")||t.parseStartTag("mono","")||t.parseEndTag("bold","")||t.parseEndTag("ital","")||t.parseEndTag("mono",""))||i(o)||t.add(o),t.position++}return t.emitBlock(),t.blocks}},{key:"splitMarkdownBlocks",value:function(e){for(var t=this,i=new l(e),o=!0,n=function(e){return!!/\\/.test(e)&&(i.positionthis.parent.fontOptions.maxWdt}},{key:"getLongestFit",value:function(e){for(var t="",i=0;i1&&void 0!==arguments[1]?arguments[1]:"normal",i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.parent.getFormattingValues(this.ctx,this.selected,this.hover,t);for(var o=(e=(e=e.replace(/^( +)/g,"$1\r")).replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r")).split("\r");o.length>0;){var n=this.getLongestFit(o);if(0===n){var s=o[0],r=this.getLongestFitWord(s);this.lines.newLine(s.slice(0,r),t),o[0]=s.slice(r)}else{var a=n;" "===o[n-1]?n--:" "===o[a]&&a++;var d=o.slice(0,n).join("");n==o.length&&i?this.lines.append(d,t):this.lines.newLine(d,t),o=o.slice(a)}}}}]),e}();t.default=u},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(i(78)),n=r(i(0)),s=r(i(1));function r(e){return e&&e.__esModule?e:{default:e}}var a=function(){function e(t){(0,n.default)(this,e),this.measureText=t,this.current=0,this.width=0,this.height=0,this.lines=[]}return(0,s.default)(e,[{key:"_add",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal";void 0===this.lines[e]&&(this.lines[e]={width:0,height:0,blocks:[]});var n=t;void 0!==t&&""!==t||(n=" ");var s=this.measureText(n,i),r=(0,o.default)({},s.values);r.text=t,r.width=s.width,r.mod=i,void 0!==t&&""!==t||(r.width=0),this.lines[e].blocks.push(r),this.lines[e].width+=r.width}},{key:"curWidth",value:function(){var e=this.lines[this.current];return void 0===e?0:e.width}},{key:"append",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"normal";this._add(this.current,e,t)}},{key:"newLine",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"normal";this._add(this.current,e,t),this.current++}},{key:"determineLineHeights",value:function(){for(var e=0;ee&&(e=o.width),t+=o.height}this.width=e,this.height=t}},{key:"removeEmptyBlocks",value:function(){for(var e=[],t=0;th;)for(var c,f=a(arguments[h++]),p=l?o(f).concat(l(f)):o(f),v=p.length,g=0;v>g;)u.call(f,c=p[g++])&&(i[c]=f[c]);return i}:d},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){(0,n.default)(this,t);var a=(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s));return a._setMargins(s),a}return(0,a.default)(t,e),(0,s.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(this.needsRefresh(t,i)){var o=this.getDimensionsFromLabel(e,t,i);this.width=o.width+this.margin.right+this.margin.left,this.height=o.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}},{key:"draw",value:function(e,t,i,o,n,s){this.resize(e,o,n),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,s),e.roundRect(this.left,this.top,this.width,this.height,s.borderRadius),this.performFill(e,s),this.updateBoundingBox(t,i,e,o,n),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,n)}},{key:"updateBoundingBox",value:function(e,t,i,o,n){this._updateBoundingBox(e,t,i,o,n);var s=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(s)}},{key:"distanceToBorder",value:function(e,t){this.resize(e);var i=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(t)),Math.abs(this.height/2/Math.sin(t)))+i}}]),t}(d(i(16)).default);t.default=h},function(e,t,i){i(146),e.exports=i(6).Object.getPrototypeOf},function(e,t,i){var o=i(30),n=i(66);i(68)("getPrototypeOf",(function(){return function(e){return n(o(e))}}))},function(e,t,i){e.exports={default:i(148),__esModule:!0}},function(e,t,i){i(149),e.exports=i(6).Object.setPrototypeOf},function(e,t,i){var o=i(11);o(o.S,"Object",{setPrototypeOf:i(150).set})},function(e,t,i){var o=i(21),n=i(20),s=function(e,t){if(n(e),!o(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,o){try{(o=i(61)(Function.call,i(70).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,i){return s(e,i),t?e.__proto__=i:o(e,i),e}}({},!1):void 0),check:s}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){(0,n.default)(this,t);var a=(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s));return a._setMargins(s),a}return(0,a.default)(t,e),(0,s.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(this.needsRefresh(t,i)){var o=this.getDimensionsFromLabel(e,t,i),n=Math.max(o.width+this.margin.right+this.margin.left,o.height+this.margin.top+this.margin.bottom);this.options.size=n/2,this.width=n,this.height=n,this.radius=this.width/2}}},{key:"draw",value:function(e,t,i,o,n,s){this.resize(e,o,n),this.left=t-this.width/2,this.top=i-this.height/2,this._drawRawCircle(e,t,i,s),this.updateBoundingBox(t,i),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,i,o,n)}},{key:"updateBoundingBox",value:function(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size}},{key:"distanceToBorder",value:function(e,t){return this.resize(e),.5*this.width}}]),t}(d(i(53)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s,a,d){(0,n.default)(this,t);var h=(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s));return h.setImages(a,d),h}return(0,a.default)(t,e),(0,s.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover,o=void 0===this.imageObj.src||void 0===this.imageObj.width||void 0===this.imageObj.height;if(o){var n=2*this.options.size;return this.width=n,this.height=n,void(this.radius=.5*this.width)}this.needsRefresh(t,i)&&this._resizeImage()}},{key:"draw",value:function(e,t,i,o,n,s){this.switchImages(o),this.resize(),this.left=t-this.width/2,this.top=i-this.height/2,this._drawRawCircle(e,t,i,s),e.save(),e.clip(),this._drawImageAtPosition(e,s),e.restore(),this._drawImageLabel(e,t,i,o,n),this.updateBoundingBox(t,i)}},{key:"updateBoundingBox",value:function(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size,this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}},{key:"distanceToBorder",value:function(e,t){return this.resize(e),.5*this.width}}]),t}(d(i(53)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){(0,n.default)(this,t);var a=(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s));return a._setMargins(s),a}return(0,a.default)(t,e),(0,s.default)(t,[{key:"resize",value:function(e,t,i){if(this.needsRefresh(t,i)){var o=this.getDimensionsFromLabel(e,t,i).width+this.margin.right+this.margin.left;this.width=o,this.height=o,this.radius=this.width/2}}},{key:"draw",value:function(e,t,i,o,n,s){this.resize(e,o,n),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,s),e.database(t-this.width/2,i-this.height/2,this.width,this.height),this.performFill(e,s),this.updateBoundingBox(t,i,e,o,n),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,n)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(d(i(16)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){return(0,n.default)(this,t),(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s))}return(0,a.default)(t,e),(0,s.default)(t,[{key:"draw",value:function(e,t,i,o,n,s){this._drawShape(e,"diamond",4,t,i,o,n,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(d(i(17)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){return(0,n.default)(this,t),(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s))}return(0,a.default)(t,e),(0,s.default)(t,[{key:"draw",value:function(e,t,i,o,n,s){this._drawShape(e,"circle",2,t,i,o,n,s)}},{key:"distanceToBorder",value:function(e,t){return this.resize(e),this.options.size}}]),t}(d(i(17)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){return(0,n.default)(this,t),(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s))}return(0,a.default)(t,e),(0,s.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(this.needsRefresh(t,i)){var o=this.getDimensionsFromLabel(e,t,i);this.height=2*o.height,this.width=o.width+o.height,this.radius=.5*this.width}}},{key:"draw",value:function(e,t,i,o,n,s){this.resize(e,o,n),this.left=t-.5*this.width,this.top=i-.5*this.height,this.initContextForDraw(e,s),e.ellipse_vis(this.left,this.top,this.width,this.height),this.performFill(e,s),this.updateBoundingBox(t,i,e,o,n),this.labelModule.draw(e,t,i,o,n)}},{key:"distanceToBorder",value:function(e,t){this.resize(e);var i=.5*this.width,o=.5*this.height,n=Math.sin(t)*i,s=Math.cos(t)*o;return i*o/Math.sqrt(n*n+s*s)}}]),t}(d(i(16)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){(0,n.default)(this,t);var a=(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s));return a._setMargins(s),a}return(0,a.default)(t,e),(0,s.default)(t,[{key:"resize",value:function(e,t,i){this.needsRefresh(t,i)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(e,t,i,o,n,s){this.resize(e,o,n),this.options.icon.size=this.options.icon.size||50,this.left=t-this.width/2,this.top=i-this.height/2,this._icon(e,t,i,o,n,s),void 0!==this.options.label&&this.labelModule.draw(e,this.left+this.iconSize.width/2+this.margin.left,i+this.height/2+5,o),this.updateBoundingBox(t,i)}},{key:"updateBoundingBox",value:function(e,t){this.boundingBox.top=t-.5*this.options.icon.size,this.boundingBox.left=e-.5*this.options.icon.size,this.boundingBox.right=e+.5*this.options.icon.size,this.boundingBox.bottom=t+.5*this.options.icon.size,void 0!==this.options.label&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+5))}},{key:"_icon",value:function(e,t,i,o,n,s){var r=Number(this.options.icon.size);void 0!==this.options.icon.code?(e.font=(o?"bold ":"")+r+"px "+this.options.icon.face,e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",this.enableShadow(e,s),e.fillText(this.options.icon.code,t,i),this.disableShadow(e,s)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(d(i(16)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s,a,d){(0,n.default)(this,t);var h=(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s));return h.setImages(a,d),h}return(0,a.default)(t,e),(0,s.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover,o=void 0===this.imageObj.src||void 0===this.imageObj.width||void 0===this.imageObj.height;if(o){var n=2*this.options.size;return this.width=n,void(this.height=n)}this.needsRefresh(t,i)&&this._resizeImage()}},{key:"draw",value:function(e,t,i,o,n,s){if(this.switchImages(o),this.resize(),this.left=t-this.width/2,this.top=i-this.height/2,!0===this.options.shapeProperties.useBorderWithImage){var r=this.options.borderWidth,a=this.options.borderWidthSelected||2*this.options.borderWidth,d=(o?a:r)/this.body.view.scale;e.lineWidth=Math.min(this.width,d),e.beginPath(),e.strokeStyle=o?this.options.color.highlight.border:n?this.options.color.hover.border:this.options.color.border,e.fillStyle=o?this.options.color.highlight.background:n?this.options.color.hover.background:this.options.color.background,e.rect(this.left-.5*e.lineWidth,this.top-.5*e.lineWidth,this.width+e.lineWidth,this.height+e.lineWidth),e.fill(),this.performStroke(e,s),e.closePath()}this._drawImageAtPosition(e,s),this._drawImageLabel(e,t,i,o,n),this.updateBoundingBox(t,i)}},{key:"updateBoundingBox",value:function(e,t){this.resize(),this._updateBoundingBox(e,t),void 0!==this.options.label&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(d(i(53)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){return(0,n.default)(this,t),(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s))}return(0,a.default)(t,e),(0,s.default)(t,[{key:"draw",value:function(e,t,i,o,n,s){this._drawShape(e,"square",2,t,i,o,n,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(d(i(17)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){return(0,n.default)(this,t),(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s))}return(0,a.default)(t,e),(0,s.default)(t,[{key:"draw",value:function(e,t,i,o,n,s){this._drawShape(e,"hexagon",4,t,i,o,n,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(d(i(17)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){return(0,n.default)(this,t),(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s))}return(0,a.default)(t,e),(0,s.default)(t,[{key:"draw",value:function(e,t,i,o,n,s){this._drawShape(e,"star",4,t,i,o,n,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(d(i(17)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){(0,n.default)(this,t);var a=(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s));return a._setMargins(s),a}return(0,a.default)(t,e),(0,s.default)(t,[{key:"resize",value:function(e,t,i){this.needsRefresh(t,i)&&(this.textSize=this.labelModule.getTextSize(e,t,i),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(e,t,i,o,n,s){this.resize(e,o,n),this.left=t-this.width/2,this.top=i-this.height/2,this.enableShadow(e,s),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,n),this.disableShadow(e,s),this.updateBoundingBox(t,i,e,o,n)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(d(i(16)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){return(0,n.default)(this,t),(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s))}return(0,a.default)(t,e),(0,s.default)(t,[{key:"draw",value:function(e,t,i,o,n,s){this._drawShape(e,"triangle",3,t,i,o,n,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(d(i(17)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){return(0,n.default)(this,t),(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s))}return(0,a.default)(t,e),(0,s.default)(t,[{key:"draw",value:function(e,t,i,o,n,s){this._drawShape(e,"triangleDown",3,t,i,o,n,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(d(i(17)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=s(i(0)),n=s(i(1));function s(e){return e&&e.__esModule?e:{default:e}}var r=i(2),a=i(33),d=i(51),h=i(55).default,l=function(){function e(t,i,n){var s=this;(0,o.default)(this,e),this.body=t,this.images=i,this.groups=n,this.body.functions.createEdge=this.create.bind(this),this.edgesListeners={add:function(e,t){s.add(t.items)},update:function(e,t){s.update(t.items)},remove:function(e,t){s.remove(t.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:"arrow"},middle:{enabled:!1,scaleFactor:1,type:"arrow"},from:{enabled:!1,scaleFactor:1,type:"arrow"}},arrowStrikethrough:!0,color:{color:"#848484",highlight:"#848484",hover:"#848484",inherit:"from",opacity:1},dashes:!1,font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:2,strokeColor:"#ffffff",align:"horizontal",multi:!1,vadjust:0,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(e,t,i,o){if(t===e)return.5;var n=1/(t-e);return Math.max(0,(o-e)*n)}},selectionWidth:1.5,selfReferenceSize:20,shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},background:{enabled:!1,color:"rgba(111,111,111,1)",size:10,dashes:!1},smooth:{enabled:!0,type:"dynamic",forceDirection:"none",roundness:.5},title:void 0,width:1,value:void 0},r.deepExtend(this.options,this.defaultOptions),this.bindEventListeners()}return(0,n.default)(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("_forceDisableDynamicCurves",(function(t){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"dynamic"===t&&(t="continuous");var o=!1;for(var n in e.body.edges)if(e.body.edges.hasOwnProperty(n)){var s=e.body.edges[n],r=e.body.data.edges._data[n];if(void 0!==r){var a=r.smooth;void 0!==a&&!0===a.enabled&&"dynamic"===a.type&&(void 0===t?s.setOptions({smooth:!1}):s.setOptions({smooth:{type:t}}),o=!0)}}!0===i&&!0===o&&e.body.emitter.emit("_dataChanged")})),this.body.emitter.on("_dataUpdated",(function(){e.reconnectEdges()})),this.body.emitter.on("refreshEdges",this.refresh.bind(this)),this.body.emitter.on("refresh",this.refresh.bind(this)),this.body.emitter.on("destroy",(function(){r.forEach(e.edgesListeners,(function(t,i){e.body.data.edges&&e.body.data.edges.off(i,t)})),delete e.body.functions.createEdge,delete e.edgesListeners.add,delete e.edgesListeners.update,delete e.edgesListeners.remove,delete e.edgesListeners}))}},{key:"setOptions",value:function(e){if(void 0!==e){h.parseOptions(this.options,e,!0,this.defaultOptions,!0);var t=!1;if(void 0!==e.smooth)for(var i in this.body.edges)this.body.edges.hasOwnProperty(i)&&(t=this.body.edges[i].updateEdgeType()||t);if(void 0!==e.font)for(var o in this.body.edges)this.body.edges.hasOwnProperty(o)&&this.body.edges[o].updateLabelModule();void 0===e.hidden&&void 0===e.physics&&!0!==t||this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=this.body.data.edges;if(e instanceof a||e instanceof d)this.body.data.edges=e;else if(Array.isArray(e))this.body.data.edges=new a,this.body.data.edges.add(e);else{if(e)throw new TypeError("Array or DataSet expected");this.body.data.edges=new a}if(o&&r.forEach(this.edgesListeners,(function(e,t){o.off(t,e)})),this.body.edges={},this.body.data.edges){r.forEach(this.edgesListeners,(function(e,i){t.body.data.edges.on(i,e)}));var n=this.body.data.edges.getIds();this.add(n,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),!1===i&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.body.edges,o=this.body.data.edges,n=0;n1&&void 0!==arguments[1])||arguments[1];if(0!==e.length){var i=this.body.edges;r.forEach(e,(function(e){var t=i[e];void 0!==t&&t.remove()})),t&&this.body.emitter.emit("_dataChanged")}}},{key:"refresh",value:function(){var e=this;r.forEach(this.body.edges,(function(t,i){var o=e.body.data.edges._data[i];void 0!==o&&t.setOptions(o)}))}},{key:"create",value:function(e){return new h(e,this.body,this.options,this.defaultOptions)}},{key:"reconnectEdges",value:function(){var e,t=this.body.nodes,i=this.body.edges;for(e in t)t.hasOwnProperty(e)&&(t[e].edges=[]);for(e in i)if(i.hasOwnProperty(e)){var o=i[e];o.from=null,o.to=null,o.connect()}}},{key:"getConnectedNodes",value:function(e){var t=[];if(void 0!==this.body.edges[e]){var i=this.body.edges[e];void 0!==i.fromId&&t.push(i.fromId),void 0!==i.toId&&t.push(i.toId)}return t}},{key:"_updateState",value:function(){this._addMissingEdges(),this._removeInvalidEdges()}},{key:"_removeInvalidEdges",value:function(){var e=this,t=[];r.forEach(this.body.edges,(function(i,o){var n=e.body.nodes[i.toId],s=e.body.nodes[i.fromId];void 0!==n&&!0===n.isCluster||void 0!==s&&!0===s.isCluster||void 0!==n&&void 0!==s||t.push(o)})),this.remove(t,!1)}},{key:"_addMissingEdges",value:function(){var e=this.body.data.edges;if(null!=e){var t=this.body.edges,i=[];e instanceof d&&(e=e.getDataSet()),e.forEach((function(e,o){void 0===t[o]&&i.push(o)})),this.add(i,!0)}}}]),e}();t.default=l},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=h(i(15)),n=h(i(3)),s=h(i(0)),r=h(i(1)),a=h(i(4)),d=h(i(5));function h(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e,i,o){return(0,s.default)(this,t),(0,a.default)(this,(t.__proto__||(0,n.default)(t)).call(this,e,i,o))}return(0,d.default)(t,e),(0,r.default)(t,[{key:"_line",value:function(e,t,i){var o=i[0],n=i[1];this._bezierCurve(e,t,o,n)}},{key:"_getViaCoordinates",value:function(){var e=this.from.x-this.to.x,t=this.from.y-this.to.y,i=void 0,o=void 0,n=void 0,s=void 0,r=this.options.smooth.roundness;return(Math.abs(e)>Math.abs(t)||!0===this.options.smooth.forceDirection||"horizontal"===this.options.smooth.forceDirection)&&"vertical"!==this.options.smooth.forceDirection?(o=this.from.y,s=this.to.y,i=this.from.x-r*e,n=this.to.x+r*e):(o=this.from.y-r*t,s=this.to.y+r*t,i=this.from.x,n=this.to.x),[{x:i,y:o},{x:n,y:s}]}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_findBorderPosition",value:function(e,t){return this._findBorderPositionBezier(e,t)}},{key:"_getDistanceToEdge",value:function(e,t,i,n,s,r){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this._getViaCoordinates(),d=(0,o.default)(a,2),h=d[0],l=d[1];return this._getDistanceToBezierEdge(e,t,i,n,s,r,h,l)}},{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getViaCoordinates(),i=(0,o.default)(t,2),n=i[0],s=i[1],r=e,a=[];a[0]=Math.pow(1-r,3),a[1]=3*r*Math.pow(1-r,2),a[2]=3*Math.pow(r,2)*(1-r),a[3]=Math.pow(r,3);var d=a[0]*this.fromPoint.x+a[1]*n.x+a[2]*s.x+a[3]*this.toPoint.x,h=a[0]*this.fromPoint.y+a[1]*n.y+a[2]*s.y+a[3]*this.toPoint.y;return{x:d,y:h}}}]),t}(h(i(167)).default);t.default=l},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){return(0,n.default)(this,t),(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s))}return(0,a.default)(t,e),(0,s.default)(t,[{key:"_getDistanceToBezierEdge",value:function(e,t,i,o,n,s,r,a){var d=1e9,h=void 0,l=void 0,u=void 0,c=void 0,f=void 0,p=e,v=t,g=[0,0,0,0];for(l=1;l<10;l++)u=.1*l,g[0]=Math.pow(1-u,3),g[1]=3*u*Math.pow(1-u,2),g[2]=3*Math.pow(u,2)*(1-u),g[3]=Math.pow(u,3),c=g[0]*e+g[1]*r.x+g[2]*a.x+g[3]*i,f=g[0]*t+g[1]*r.y+g[2]*a.y+g[3]*o,l>0&&(d=(h=this._getDistanceToLine(p,v,c,f,n,s))1&&void 0!==arguments[1]?arguments[1]:this.via,i=e,n=void 0,s=void 0;if(this.from===this.to){var r=this._getCircleData(this.from),a=(0,o.default)(r,3),d=a[0],h=a[1],l=a[2],u=2*Math.PI*(1-i);n=d+l*Math.sin(u),s=h+l-l*(1-Math.cos(u))}else n=Math.pow(1-i,2)*this.fromPoint.x+2*i*(1-i)*t.x+Math.pow(i,2)*this.toPoint.x,s=Math.pow(1-i,2)*this.fromPoint.y+2*i*(1-i)*t.y+Math.pow(i,2)*this.toPoint.y;return{x:n,y:s}}},{key:"_findBorderPosition",value:function(e,t){return this._findBorderPositionBezier(e,t,this.via)}},{key:"_getDistanceToEdge",value:function(e,t,i,o,n,s){return this._getDistanceToBezierEdge(e,t,i,o,n,s,this.via)}}]),t}(h(i(56)).default);t.default=l},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){return(0,n.default)(this,t),(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s))}return(0,a.default)(t,e),(0,s.default)(t,[{key:"_line",value:function(e,t,i){this._bezierCurve(e,t,i)}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_getViaCoordinates",value:function(){var e=void 0,t=void 0,i=this.options.smooth.roundness,o=this.options.smooth.type,n=Math.abs(this.from.x-this.to.x),s=Math.abs(this.from.y-this.to.y);if("discrete"===o||"diagonalCross"===o){var r=void 0,a=void 0;r=a=n<=s?i*s:i*n,this.from.x>this.to.x&&(r=-r),this.from.y>=this.to.y&&(a=-a),e=this.from.x+r,t=this.from.y+a,"discrete"===o&&(n<=s?e=nthis.to.x&&(m=-m),this.from.y>=this.to.y&&(b=-b),e=this.from.x+m,t=this.from.y+b,n<=s?e=this.from.x<=this.to.x?this.to.xe?this.to.x:e:t=this.from.y>=this.to.y?this.to.y>t?this.to.y:t:this.to.y2&&void 0!==arguments[2]?arguments[2]:{};return this._findBorderPositionBezier(e,t,i.via)}},{key:"_getDistanceToEdge",value:function(e,t,i,o,n,s){var r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(e,t,i,o,n,s,r)}},{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getViaCoordinates(),i=e,o=Math.pow(1-i,2)*this.fromPoint.x+2*i*(1-i)*t.x+Math.pow(i,2)*this.toPoint.x,n=Math.pow(1-i,2)*this.fromPoint.y+2*i*(1-i)*t.y+Math.pow(i,2)*this.toPoint.y;return{x:o,y:n}}}]),t}(d(i(56)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(e,i,s){return(0,n.default)(this,t),(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s))}return(0,a.default)(t,e),(0,s.default)(t,[{key:"_line",value:function(e,t){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),e.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}},{key:"getViaNode",value:function(){}},{key:"getPoint",value:function(e){return{x:(1-e)*this.fromPoint.x+e*this.toPoint.x,y:(1-e)*this.fromPoint.y+e*this.toPoint.y}}},{key:"_findBorderPosition",value:function(e,t){var i=this.to,o=this.from;e.id===this.from.id&&(i=this.from,o=this.to);var n=Math.atan2(i.y-o.y,i.x-o.x),s=i.x-o.x,r=i.y-o.y,a=Math.sqrt(s*s+r*r),d=(a-e.distanceToBorder(t,n))/a,h={};return h.x=(1-d)*o.x+d*i.x,h.y=(1-d)*o.y+d*i.y,h}},{key:"_getDistanceToEdge",value:function(e,t,i,o,n,s){return this._getDistanceToLine(e,t,i,o,n,s)}}]),t}(d(i(79)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(i(9)),n=r(i(0)),s=r(i(1));function r(e){return e&&e.__esModule?e:{default:e}}var a=i(81).default,d=i(172).default,h=i(173).default,l=i(174).default,u=i(175).default,c=i(82).default,f=i(176).default,p=i(177).default,v=i(2),g=i(80).default,y=function(){function e(t){(0,n.default)(this,e),this.body=t,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0},v.extend(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}return(0,s.default)(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("initPhysics",(function(){e.initPhysics()})),this.body.emitter.on("_layoutFailed",(function(){e.layoutFailed=!0})),this.body.emitter.on("resetPhysics",(function(){e.stopSimulation(),e.ready=!1})),this.body.emitter.on("disablePhysics",(function(){e.physicsEnabled=!1,e.stopSimulation()})),this.body.emitter.on("restorePhysics",(function(){e.setOptions(e.options),!0===e.ready&&e.startSimulation()})),this.body.emitter.on("startSimulation",(function(){!0===e.ready&&e.startSimulation()})),this.body.emitter.on("stopSimulation",(function(){e.stopSimulation()})),this.body.emitter.on("destroy",(function(){e.stopSimulation(!1),e.body.emitter.off()})),this.body.emitter.on("_dataChanged",(function(){e.updatePhysicsData()}))}},{key:"setOptions",value:function(e){void 0!==e&&(!1===e?(this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation()):!0===e?(this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation()):(this.physicsEnabled=!0,v.selectiveNotDeepExtend(["stabilization"],this.options,e),v.mergeOptions(this.options,e,"stabilization"),void 0===e.enabled&&(this.options.enabled=!0),!1===this.options.enabled&&(this.physicsEnabled=!1,this.stopSimulation()),this.timestep=this.options.timestep)),this.init()}},{key:"init",value:function(){var e;"forceAtlas2Based"===this.options.solver?(e=this.options.forceAtlas2Based,this.nodesSolver=new f(this.body,this.physicsBody,e),this.edgesSolver=new l(this.body,this.physicsBody,e),this.gravitySolver=new p(this.body,this.physicsBody,e)):"repulsion"===this.options.solver?(e=this.options.repulsion,this.nodesSolver=new d(this.body,this.physicsBody,e),this.edgesSolver=new l(this.body,this.physicsBody,e),this.gravitySolver=new c(this.body,this.physicsBody,e)):"hierarchicalRepulsion"===this.options.solver?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new h(this.body,this.physicsBody,e),this.edgesSolver=new u(this.body,this.physicsBody,e),this.gravitySolver=new c(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new a(this.body,this.physicsBody,e),this.edgesSolver=new l(this.body,this.physicsBody,e),this.gravitySolver=new c(this.body,this.physicsBody,e)),this.modelOptions=e}},{key:"initPhysics",value:function(){!0===this.physicsEnabled&&!0===this.options.enabled?!0===this.options.stabilization.enabled?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit("fit",{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit("fit"))}},{key:"startSimulation",value:function(){!0===this.physicsEnabled&&!0===this.options.enabled?(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),void 0===this.viewFunction&&(this.viewFunction=this.simulationStep.bind(this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering"))):this.body.emitter.emit("_redraw")}},{key:"stopSimulation",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.stabilized=!0,!0===e&&this._emitStabilized(),void 0!==this.viewFunction&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,!0===e&&this.body.emitter.emit("_stopRendering"))}},{key:"simulationStep",value:function(){var e=Date.now();this.physicsTick(),(Date.now()-e<.4*this.simulationInterval||!0===this.runDoubleSpeed)&&!1===this.stabilized&&(this.physicsTick(),this.runDoubleSpeed=!0),!0===this.stabilized&&this.stopSimulation()}},{key:"_emitStabilized",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||!0===this.startedStabilization)&&setTimeout((function(){e.body.emitter.emit("stabilized",{iterations:t}),e.startedStabilization=!1,e.stabilizationIterations=0}),0)}},{key:"physicsStep",value:function(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}},{key:"adjustTimeStep",value:function(){!0===this._evaluateStepQuality()?this.timestep=1.2*this.timestep:this.timestep/1.2.3))return!1;return!0}},{key:"moveNodes",value:function(){for(var e=this.physicsBody.physicsNodeIndices,t=0,i=0,o=0;oo&&(e=e>0?o:-o),e}},{key:"_performStep",value:function(e){var t=this.body.nodes[e],i=this.physicsBody.forces[e],o=this.physicsBody.velocities[e];return this.previousStates[e]={x:t.x,y:t.y,vx:o.x,vy:o.y},!1===t.options.fixed.x?(o.x=this.calculateComponentVelocity(o.x,i.x,t.options.mass),t.x+=o.x*this.timestep):(i.x=0,o.x=0),!1===t.options.fixed.y?(o.y=this.calculateComponentVelocity(o.y,i.y,t.options.mass),t.y+=o.y*this.timestep):(i.y=0,o.y=0),Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))}},{key:"_freezeNodes",value:function(){var e=this.body.nodes;for(var t in e)if(e.hasOwnProperty(t)&&e[t].x&&e[t].y){var i=e[t].options.fixed;this.freezeCache[t]={x:i.x,y:i.y},i.x=!0,i.y=!0}}},{key:"_restoreFrozenNodes",value:function(){var e=this.body.nodes;for(var t in e)e.hasOwnProperty(t)&&void 0!==this.freezeCache[t]&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}},{key:"stabilize",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.stabilization.iterations;"number"!=typeof t&&(t=this.options.stabilization.iterations,console.log("The stabilize method needs a numeric amount of iterations. Switching to default: ",t)),0!==this.physicsBody.physicsNodeIndices.length?(this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=t,!0===this.options.stabilization.onlyDynamicEdges&&this._freezeNodes(),this.stabilizationIterations=0,setTimeout((function(){return e._stabilizationBatch()}),0)):this.ready=!0}},{key:"_startStabilizing",value:function(){return!0!==this.startedStabilization&&(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0,!0)}},{key:"_stabilizationBatch",value:function(){var e=this,t=function(){return!1===e.stabilized&&e.stabilizationIterations0){var s=n.edges.length+1,r=this.options.centralGravity*s*n.options.mass;o[n.id].x=t*r,o[n.id].y=i*r}}}]),t}(d(i(82)).default);t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=a(i(9)),n=a(i(7)),s=a(i(0)),r=a(i(1));function a(e){return e&&e.__esModule?e:{default:e}}var d=i(2),h=i(57).default,l=i(179).default,u=i(55).default,c=i(34).default,f=function(){function e(t){var i=this;(0,s.default)(this,e),this.body=t,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},d.extend(this.options,this.defaultOptions),this.body.emitter.on("_resetData",(function(){i.clusteredNodes={},i.clusteredEdges={}}))}return(0,r.default)(e,[{key:"clusterByHubsize",value:function(e,t){void 0===e?e=this._getHubSize():"object"===(void 0===e?"undefined":(0,n.default)(e))&&(t=this._checkOptions(e),e=this._getHubSize());for(var i=[],o=0;o=e&&i.push(s.id)}for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(void 0===t.joinCondition)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");t=this._checkOptions(t);var o={},n={};d.forEach(this.body.nodes,(function(i,s){i.options&&!0===t.joinCondition(i.options)&&(o[s]=i,d.forEach(i.edges,(function(t){void 0===e.clusteredEdges[t.id]&&(n[t.id]=t)})))})),this._cluster(o,n,t,i)}},{key:"clusterByEdgeCount",value:function(e,t){var i=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t=this._checkOptions(t);for(var s=[],r={},a=void 0,d=void 0,l=void 0,u=function(n){var u={},c={},g=i.body.nodeIndices[n],y=i.body.nodes[g];if(void 0===r[g]){l=0,d=[];for(var m=0;m0&&(0,o.default)(c).length>0&&!0===b)if(p=function(){for(var e=0;e1&&void 0!==arguments[1])||arguments[1];this.clusterByEdgeCount(1,e,t)}},{key:"clusterBridges",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clusterByEdgeCount(2,e,t)}},{key:"clusterByConnection",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===e)throw new Error("No nodeId supplied to clusterByConnection!");if(void 0===this.body.nodes[e])throw new Error("The nodeId given to clusterByConnection does not exist!");var n=this.body.nodes[e];void 0===(t=this._checkOptions(t,n)).clusterNodeProperties.x&&(t.clusterNodeProperties.x=n.x),void 0===t.clusterNodeProperties.y&&(t.clusterNodeProperties.y=n.y),void 0===t.clusterNodeProperties.fixed&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=n.options.fixed.x,t.clusterNodeProperties.fixed.y=n.options.fixed.y);var s={},r={},a=n.id,d=h.cloneOptions(n);s[a]=n;for(var l=0;l-1&&(r[y.id]=y)}this._cluster(s,r,t,i)}},{key:"_createClusterEdges",value:function(e,t,i,n){for(var s=void 0,r=void 0,a=void 0,d=void 0,h=void 0,l=void 0,u=(0,o.default)(e),c=[],f=0;f0&&void 0!==arguments[0]?arguments[0]:{};return void 0===e.clusterEdgeProperties&&(e.clusterEdgeProperties={}),void 0===e.clusterNodeProperties&&(e.clusterNodeProperties={}),e}},{key:"_cluster",value:function(e,t,i){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=[];for(var r in e)e.hasOwnProperty(r)&&void 0!==this.clusteredNodes[r]&&s.push(r);for(var a=0;an?a.x:n,s=a.yr?a.y:r;return{x:.5*(i+n),y:.5*(s+r)}}},{key:"openCluster",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===e)throw new Error("No clusterNodeId supplied to openCluster.");var o=this.body.nodes[e];if(void 0===o)throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(!0!==o.isCluster||void 0===o.containedNodes||void 0===o.containedEdges)throw new Error("The node:"+e+" is not a valid cluster.");var n=this.findNode(e),s=n.indexOf(e)-1;if(s>=0){var r=n[s],a=this.body.nodes[r];return a._openChildCluster(e),delete this.body.nodes[e],void(!0===i&&this.body.emitter.emit("_dataChanged"))}var h=o.containedNodes,l=o.containedEdges;if(void 0!==t&&void 0!==t.releaseFunction&&"function"==typeof t.releaseFunction){var u={},c={x:o.x,y:o.y};for(var f in h)if(h.hasOwnProperty(f)){var p=this.body.nodes[f];u[f]={x:p.x,y:p.y}}var v=t.releaseFunction(c,u);for(var g in h)if(h.hasOwnProperty(g)){var y=this.body.nodes[g];void 0!==v[g]&&(y.x=void 0===v[g].x?o.x:v[g].x,y.y=void 0===v[g].y?o.y:v[g].y)}}else d.forEach(h,(function(e){!1===e.options.fixed.x&&(e.x=o.x),!1===e.options.fixed.y&&(e.y=o.y)}));for(var m in h)if(h.hasOwnProperty(m)){var b=this.body.nodes[m];b.vx=o.vx,b.vy=o.vy,b.setOptions({physics:!0}),delete this.clusteredNodes[m]}for(var _=[],w=0;w0&&n<100;){var s=t.pop();if(void 0!==s){var r=this.body.edges[s];if(void 0!==r){n++;var a=r.clusteringEdgeReplacingIds;if(void 0===a)o.push(s);else for(var d=0;do&&(o=s.edges.length),e+=s.edges.length,t+=Math.pow(s.edges.length,2),i+=1}e/=i;var r=(t/=i)-Math.pow(e,2),a=Math.sqrt(r),d=Math.floor(e+2*a);return d>o&&(d=o),d}},{key:"_createClusteredEdge",value:function(e,t,i,o,n){var s=h.cloneOptions(i,"edge");d.deepExtend(s,o),s.from=e,s.to=t,s.id="clusterEdge:"+d.randomUUID(),void 0!==n&&d.deepExtend(s,n);var r=this.body.functions.createEdge(s);return r.clusteringEdgeReplacingIds=[i.id],r.connect(),this.body.edges[r.id]=r,r}},{key:"_clusterEdges",value:function(e,t,i,o){if(t instanceof u){var n=t,s={};s[n.id]=n,t=s}if(e instanceof c){var r=e,a={};a[r.id]=r,e=a}if(null==i)throw new Error("_clusterEdges: parameter clusterNode required");for(var d in void 0===o&&(o=i.clusterEdgeProperties),this._createClusterEdges(e,t,i,o),t)if(t.hasOwnProperty(d)&&void 0!==this.body.edges[d]){var h=this.body.edges[d];this._backupEdgeOptions(h),h.setOptions({physics:!1})}for(var l in e)e.hasOwnProperty(l)&&(this.clusteredNodes[l]={clusterId:i.id,node:this.body.nodes[l]},this.body.nodes[l].setOptions({physics:!1}))}},{key:"_getClusterNodeForNode",value:function(e){if(void 0!==e){var t=this.clusteredNodes[e];if(void 0!==t){var i=t.clusterId;if(void 0!==i)return this.body.nodes[i]}}}},{key:"_filter",value:function(e,t){var i=[];return d.forEach(e,(function(e){t(e)&&i.push(e)})),i}},{key:"_updateState",value:function(){var e=this,t=void 0,i=[],n={},s=function(t){d.forEach(e.body.nodes,(function(e){!0===e.isCluster&&t(e)}))};for(t in this.clusteredNodes)this.clusteredNodes.hasOwnProperty(t)&&void 0===this.body.nodes[t]&&i.push(t);s((function(e){for(var t=0;t0}t.endPointsValid()&&o||(n[i]=i)})),s((function(t){d.forEach(n,(function(i){delete t.containedEdges[i],d.forEach(t.edges,(function(o,s){o.id!==i?o.clusteringEdgeReplacingIds=e._filter(o.clusteringEdgeReplacingIds,(function(e){return!n[e]})):t.edges[s]=null})),t.edges=e._filter(t.edges,(function(e){return null!==e}))}))})),d.forEach(n,(function(t){delete e.clusteredEdges[t]})),d.forEach(n,(function(t){delete e.body.edges[t]}));var a=(0,o.default)(this.body.edges);d.forEach(a,(function(t){var i=e.body.edges[t],o=e._isClusteredNode(i.fromId)||e._isClusteredNode(i.toId);if(o!==e._isClusteredEdge(i.id))if(o){var n=e._getClusterNodeForNode(i.fromId);void 0!==n&&e._clusterEdges(e.body.nodes[i.fromId],i,n);var s=e._getClusterNodeForNode(i.toId);void 0!==s&&e._clusterEdges(e.body.nodes[i.toId],i,s)}else delete e._clusterEdges[t],e._restoreEdge(i)}));for(var h=!1,l=!0,u=function(){var t=[];s((function(e){var i=(0,o.default)(e.containedNodes).length,n=!0===e.options.allowSingleNodeCluster;(n&&i<1||!n&&i<2)&&t.push(e.id)}));for(var i=0;i0,h=h||l};l;)u();h&&this._updateState()}},{key:"_isClusteredNode",value:function(e){return void 0!==this.clusteredNodes[e]}},{key:"_isClusteredEdge",value:function(e){return void 0!==this.clusteredEdges[e]}}]),e}();t.default=f},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(3)),n=d(i(0)),s=d(i(1)),r=d(i(4)),a=d(i(5));function d(e){return e&&e.__esModule?e:{default:e}}var h=i(2),l=function(e){function t(e,i,s,a,d,h){(0,n.default)(this,t);var l=(0,r.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i,s,a,d,h));return l.isCluster=!0,l.containedNodes={},l.containedEdges={},l}return(0,a.default)(t,e),(0,s.default)(t,[{key:"_openChildCluster",value:function(e){var t=this,i=this.body.nodes[e];if(void 0===this.containedNodes[e])throw new Error("node with id: "+e+" not in current cluster");if(!i.isCluster)throw new Error("node with id: "+e+" is not a cluster");delete this.containedNodes[e],h.forEach(i.edges,(function(e){delete t.containedEdges[e.id]})),h.forEach(i.containedNodes,(function(e,i){t.containedNodes[i]=e})),i.containedNodes={},h.forEach(i.containedEdges,(function(e,i){t.containedEdges[i]=e})),i.containedEdges={},h.forEach(i.edges,(function(e){h.forEach(t.edges,(function(i){var o=i.clusteringEdgeReplacingIds.indexOf(e.id);-1!==o&&(h.forEach(e.clusteringEdgeReplacingIds,(function(e){i.clusteringEdgeReplacingIds.push(e),t.body.edges[e].edgeReplacedById=i.id})),i.clusteringEdgeReplacingIds.splice(o,1))}))})),i.edges=[]}}]),t}(i(34).default);t.default=l},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=s(i(0)),n=s(i(1));function s(e){return e&&e.__esModule?e:{default:e}}var r=i(2),a=function(){function e(t,i){var n;(0,o.default)(this,e),void 0!==window&&(n=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame),window.requestAnimationFrame=void 0===n?function(e){e()}:n,this.body=t,this.canvas=i,this.redrawRequested=!1,this.renderTimer=void 0,this.requiresTimeout=!0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.zooming=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1},r.extend(this.options,this.defaultOptions),this._determineBrowserMethod(),this.bindEventListeners()}return(0,n.default)(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("dragStart",(function(){e.dragging=!0})),this.body.emitter.on("dragEnd",(function(){e.dragging=!1})),this.body.emitter.on("zoom",(function(){e.zooming=!0,window.clearTimeout(e.zoomTimeoutId),e.zoomTimeoutId=window.setTimeout((function(){e.zooming=!1,e._requestRedraw.bind(e)()}),250)})),this.body.emitter.on("_resizeNodes",(function(){e._resizeNodes()})),this.body.emitter.on("_redraw",(function(){!1===e.renderingActive&&e._redraw()})),this.body.emitter.on("_blockRedraw",(function(){e.allowRedraw=!1})),this.body.emitter.on("_allowRedraw",(function(){e.allowRedraw=!0,e.redrawRequested=!1})),this.body.emitter.on("_requestRedraw",this._requestRedraw.bind(this)),this.body.emitter.on("_startRendering",(function(){e.renderRequests+=1,e.renderingActive=!0,e._startRendering()})),this.body.emitter.on("_stopRendering",(function(){e.renderRequests-=1,e.renderingActive=e.renderRequests>0,e.renderTimer=void 0})),this.body.emitter.on("destroy",(function(){e.renderRequests=0,e.allowRedraw=!1,e.renderingActive=!1,!0===e.requiresTimeout?clearTimeout(e.renderTimer):window.cancelAnimationFrame(e.renderTimer),e.body.emitter.off()}))}},{key:"setOptions",value:function(e){void 0!==e&&r.selectiveDeepExtend(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag"],this.options,e)}},{key:"_requestNextFrame",value:function(e,t){if("undefined"!=typeof window){var i=void 0,o=window;return!0===this.requiresTimeout?i=o.setTimeout(e,t):o.requestAnimationFrame&&(i=o.requestAnimationFrame(e)),i}}},{key:"_startRendering",value:function(){!0===this.renderingActive&&void 0===this.renderTimer&&(this.renderTimer=this._requestNextFrame(this._renderStep.bind(this),this.simulationInterval))}},{key:"_renderStep",value:function(){!0===this.renderingActive&&(this.renderTimer=void 0,!0===this.requiresTimeout&&this._startRendering(),this._redraw(),!1===this.requiresTimeout&&this._startRendering())}},{key:"redraw",value:function(){this.body.emitter.emit("setSize"),this._redraw()}},{key:"_requestRedraw",value:function(){var e=this;!0!==this.redrawRequested&&!1===this.renderingActive&&!0===this.allowRedraw&&(this.redrawRequested=!0,this._requestNextFrame((function(){e._redraw(!1)}),0))}},{key:"_redraw",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!0===this.allowRedraw){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1,0!==this.canvas.frame.canvas.width&&0!==this.canvas.frame.canvas.height||this.canvas.setSize(),this.canvas.setTransform();var t=this.canvas.getContext(),i=this.canvas.frame.canvas.clientWidth,o=this.canvas.frame.canvas.clientHeight;if(t.clearRect(0,0,i,o),0===this.canvas.frame.clientWidth)return;t.save(),t.translate(this.body.view.translation.x,this.body.view.translation.y),t.scale(this.body.view.scale,this.body.view.scale),t.beginPath(),this.body.emitter.emit("beforeDrawing",t),t.closePath(),!1===e&&(!1===this.dragging||!0===this.dragging&&!1===this.options.hideEdgesOnDrag)&&(!1===this.zooming||!0===this.zooming&&!1===this.options.hideEdgesOnZoom)&&this._drawEdges(t),(!1===this.dragging||!0===this.dragging&&!1===this.options.hideNodesOnDrag)&&this._drawNodes(t,e),t.beginPath(),this.body.emitter.emit("afterDrawing",t),t.closePath(),t.restore(),!0===e&&t.clearRect(0,0,i,o)}}},{key:"_resizeNodes",value:function(){this.canvas.setTransform();var e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);var t=this.body.nodes,i=void 0;for(var o in t)t.hasOwnProperty(o)&&((i=t[o]).resize(e),i.updateBoundingBox(e,i.selected));e.restore()}},{key:"_drawNodes",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.body.nodes,o=this.body.nodeIndices,n=void 0,s=[],r=20,a=this.canvas.DOMtoCanvas({x:-r,y:-r}),d=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+r,y:this.canvas.frame.canvas.clientHeight+r}),h={top:a.y,left:a.x,bottom:d.y,right:d.x},l=0;l0&&void 0!==arguments[0]?arguments[0]:this.pixelRatio;!0===this.initialized&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}},{key:"_setCameraState",value:function(){if(void 0!==this.cameraState.scale&&0!==this.frame.canvas.clientWidth&&0!==this.frame.canvas.clientHeight&&0!==this.pixelRatio&&this.cameraState.previousWidth>0){var e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight,i=this.cameraState.scale;1!=e&&1!=t?i=.5*this.cameraState.scale*(e+t):1!=e?i=this.cameraState.scale*e:1!=t&&(i=this.cameraState.scale*t),this.body.view.scale=i;var o=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),n={x:o.x-this.cameraState.position.x,y:o.y-this.cameraState.position.y};this.body.view.translation.x+=n.x*this.body.view.scale,this.body.view.translation.y+=n.y*this.body.view.scale}}},{key:"_prepareValue",value:function(e){if("number"==typeof e)return e+"px";if("string"==typeof e){if(-1!==e.indexOf("%")||-1!==e.indexOf("px"))return e;if(-1===e.indexOf("%"))return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}},{key:"_create",value:function(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=900,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{var e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerHTML="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}},{key:"_bindHammer",value:function(){var e=this;void 0!==this.hammer&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new r(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:r.DIRECTION_ALL}),a.onTouch(this.hammer,(function(t){e.body.eventListeners.onTouch(t)})),this.hammer.on("tap",(function(t){e.body.eventListeners.onTap(t)})),this.hammer.on("doubletap",(function(t){e.body.eventListeners.onDoubleTap(t)})),this.hammer.on("press",(function(t){e.body.eventListeners.onHold(t)})),this.hammer.on("panstart",(function(t){e.body.eventListeners.onDragStart(t)})),this.hammer.on("panmove",(function(t){e.body.eventListeners.onDrag(t)})),this.hammer.on("panend",(function(t){e.body.eventListeners.onDragEnd(t)})),this.hammer.on("pinch",(function(t){e.body.eventListeners.onPinch(t)})),this.frame.canvas.addEventListener("mousewheel",(function(t){e.body.eventListeners.onMouseWheel(t)})),this.frame.canvas.addEventListener("DOMMouseScroll",(function(t){e.body.eventListeners.onMouseWheel(t)})),this.frame.canvas.addEventListener("mousemove",(function(t){e.body.eventListeners.onMouseMove(t)})),this.frame.canvas.addEventListener("contextmenu",(function(t){e.body.eventListeners.onContext(t)})),this.hammerFrame=new r(this.frame),a.onRelease(this.hammerFrame,(function(t){e.body.eventListeners.onRelease(t)}))}},{key:"setSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.width,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);var i=!1,o=this.frame.canvas.width,n=this.frame.canvas.height,s=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(s),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},i=!0;else{var r=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),a=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);this.frame.canvas.width===r&&this.frame.canvas.height===a||this._getCameraState(s),this.frame.canvas.width!==r&&(this.frame.canvas.width=r,i=!0),this.frame.canvas.height!==a&&(this.frame.canvas.height=a,i=!0)}return!0===i&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(o/this.pixelRatio),oldHeight:Math.round(n/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,i}},{key:"getContext",value:function(){return this.frame.canvas.getContext("2d")}},{key:"_determinePixelRatio",value:function(){var e=this.getContext();if(void 0===e)throw new Error("Could not get canvax context");var t=1;return"undefined"!=typeof window&&(t=window.devicePixelRatio||1),t/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)}},{key:"_setPixelRatio",value:function(){this.pixelRatio=this._determinePixelRatio()}},{key:"setTransform",value:function(){var e=this.getContext();if(void 0===e)throw new Error("Could not get canvax context");e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}},{key:"_XconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.x)/this.body.view.scale}},{key:"_XconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.x}},{key:"_YconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.y)/this.body.view.scale}},{key:"_YconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.y}},{key:"canvasToDOM",value:function(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}},{key:"DOMtoCanvas",value:function(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}]),e}();t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(i(78)),n=r(i(0)),s=r(i(1));function r(e){return e&&e.__esModule?e:{default:e}}var a=i(2),d=i(57).default,h=function(){function e(t,i){var o=this;(0,n.default)(this,e),this.body=t,this.canvas=i,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",this.fit.bind(this)),this.body.emitter.on("animationFinished",(function(){o.body.emitter.emit("_stopRendering")})),this.body.emitter.on("unlockNode",this.releaseNode.bind(this))}return(0,s.default)(e,[{key:"setOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=e}},{key:"fit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{nodes:[]},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=void 0,n=void 0;if(void 0!==(e=(0,o.default)({},e)).nodes&&0!==e.nodes.length||(e.nodes=this.body.nodeIndices),!0===t){var s=0;for(var r in this.body.nodes)if(this.body.nodes.hasOwnProperty(r)){var a=this.body.nodes[r];!0===a.predefinedPosition&&(s+=1)}if(s>.5*this.body.nodeIndices.length)return void this.fit(e,!1);i=d.getRange(this.body.nodes,e.nodes);var h=this.body.nodeIndices.length;n=12.662/(h+7.4147)+.0964822;var l=Math.min(this.canvas.frame.canvas.clientWidth/600,this.canvas.frame.canvas.clientHeight/600);n*=l}else{this.body.emitter.emit("_resizeNodes"),i=d.getRange(this.body.nodes,e.nodes);var u=1.1*Math.abs(i.maxX-i.minX),c=1.1*Math.abs(i.maxY-i.minY),f=this.canvas.frame.canvas.clientWidth/u,p=this.canvas.frame.canvas.clientHeight/c;n=f<=p?f:p}(n>1||0===n)&&(n=1);var v=d.findCenter(i),g={position:v,scale:n,animation:e.animation};this.moveTo(g)}},{key:"focus",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==this.body.nodes[e]){var i={x:this.body.nodes[e].x,y:this.body.nodes[e].y};t.position=i,t.lockedOnNode=e,this.moveTo(t)}else console.log("Node: "+e+" cannot be found.")}},{key:"moveTo",value:function(e){void 0!==e?(void 0===e.offset&&(e.offset={x:0,y:0}),void 0===e.offset.x&&(e.offset.x=0),void 0===e.offset.y&&(e.offset.y=0),void 0===e.scale&&(e.scale=this.body.view.scale),void 0===e.position&&(e.position=this.getViewPosition()),void 0===e.animation&&(e.animation={duration:0}),!1===e.animation&&(e.animation={duration:0}),!0===e.animation&&(e.animation={}),void 0===e.animation.duration&&(e.animation.duration=1e3),void 0===e.animation.easingFunction&&(e.animation.easingFunction="easeInOutQuad"),this.animateView(e)):e={}}},{key:"animateView",value:function(e){if(void 0!==e){this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),!0===e.locked&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),0!=this.easingTime&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;var t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i=t.x-e.position.x,o=t.y-e.position.y;this.targetTranslation={x:this.sourceTranslation.x+i*this.targetScale+e.offset.x,y:this.sourceTranslation.y+o*this.targetScale+e.offset.y},0===e.animation.duration?null!=this.lockedOnNodeId?(this.viewFunction=this._lockedRedraw.bind(this),this.body.emitter.on("initRedraw",this.viewFunction)):(this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw")):(this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=this._transitionRedraw.bind(this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering"))}}},{key:"_lockedRedraw",value:function(){var e=this.body.nodes[this.lockedOnNodeId].x,t=this.body.nodes[this.lockedOnNodeId].y,i=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),o=i.x-e,n=i.y-t,s=this.body.view.translation,r={x:s.x+o*this.body.view.scale+this.lockedOnNodeOffset.x,y:s.y+n*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=r}},{key:"releaseNode",value:function(){void 0!==this.lockedOnNodeId&&void 0!==this.viewFunction&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}},{key:"_transitionRedraw",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.easingTime+=this.animationSpeed,this.easingTime=!0===e?1:this.easingTime;var t=a.easingFunctions[this.animationEasingFunction](this.easingTime);this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1&&(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,null!=this.lockedOnNodeId&&(this.viewFunction=this._lockedRedraw.bind(this),this.body.emitter.on("initRedraw",this.viewFunction)),this.body.emitter.emit("animationFinished"))}},{key:"getScale",value:function(){return this.body.view.scale}},{key:"getViewPosition",value:function(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}]),e}();t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=s(i(0)),n=s(i(1));function s(e){return e&&e.__esModule?e:{default:e}}var r=i(2),a=i(184).default,d=i(185).default,h=function(){function e(t,i,n){(0,o.default)(this,e),this.body=t,this.canvas=i,this.selectionHandler=n,this.navigationHandler=new a(t,i),this.body.eventListeners.onTap=this.onTap.bind(this),this.body.eventListeners.onTouch=this.onTouch.bind(this),this.body.eventListeners.onDoubleTap=this.onDoubleTap.bind(this),this.body.eventListeners.onHold=this.onHold.bind(this),this.body.eventListeners.onDragStart=this.onDragStart.bind(this),this.body.eventListeners.onDrag=this.onDrag.bind(this),this.body.eventListeners.onDragEnd=this.onDragEnd.bind(this),this.body.eventListeners.onMouseWheel=this.onMouseWheel.bind(this),this.body.eventListeners.onPinch=this.onPinch.bind(this),this.body.eventListeners.onMouseMove=this.onMouseMove.bind(this),this.body.eventListeners.onRelease=this.onRelease.bind(this),this.body.eventListeners.onContext=this.onContext.bind(this),this.touchTime=0,this.drag={},this.pinch={},this.popup=void 0,this.popupObj=void 0,this.popupTimer=void 0,this.body.functions.getPointer=this.getPointer.bind(this),this.options={},this.defaultOptions={dragNodes:!0,dragView:!0,hover:!1,keyboard:{enabled:!1,speed:{x:10,y:10,zoom:.02},bindToWindow:!0},navigationButtons:!1,tooltipDelay:300,zoomView:!0,zoomSpeed:1},r.extend(this.options,this.defaultOptions),this.bindEventListeners()}return(0,n.default)(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("destroy",(function(){clearTimeout(e.popupTimer),delete e.body.functions.getPointer}))}},{key:"setOptions",value:function(e){void 0!==e&&(r.selectiveNotDeepExtend(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag","keyboard","multiselect","selectable","selectConnectedEdges"],this.options,e),r.mergeOptions(this.options,e,"keyboard"),e.tooltip&&(r.extend(this.options.tooltip,e.tooltip),e.tooltip.color&&(this.options.tooltip.color=r.parseColor(e.tooltip.color)))),this.navigationHandler.setOptions(this.options)}},{key:"getPointer",value:function(e){return{x:e.x-r.getAbsoluteLeft(this.canvas.frame.canvas),y:e.y-r.getAbsoluteTop(this.canvas.frame.canvas)}}},{key:"onTouch",value:function(e){(new Date).valueOf()-this.touchTime>50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=(new Date).valueOf())}},{key:"onTap",value:function(e){var t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,e,i),this.selectionHandler._generateClickEvent("click",e,t)}},{key:"onDoubleTap",value:function(e){var t=this.getPointer(e.center);this.selectionHandler._generateClickEvent("doubleClick",e,t)}},{key:"onHold",value:function(e){var t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,e,i),this.selectionHandler._generateClickEvent("click",e,t),this.selectionHandler._generateClickEvent("hold",e,t)}},{key:"onRelease",value:function(e){if((new Date).valueOf()-this.touchTime>10){var t=this.getPointer(e.center);this.selectionHandler._generateClickEvent("release",e,t),this.touchTime=(new Date).valueOf()}}},{key:"onContext",value:function(e){var t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler._generateClickEvent("oncontext",e,t)}},{key:"checkSelectionChanges",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=this.selectionHandler.getSelection(),n=!1;n=!0===i?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e);var s=this.selectionHandler.getSelection(),r=this._determineDifference(o,s),a=this._determineDifference(s,o);r.edges.length>0&&(this.selectionHandler._generateClickEvent("deselectEdge",t,e,o),n=!0),r.nodes.length>0&&(this.selectionHandler._generateClickEvent("deselectNode",t,e,o),n=!0),a.nodes.length>0&&(this.selectionHandler._generateClickEvent("selectNode",t,e),n=!0),a.edges.length>0&&(this.selectionHandler._generateClickEvent("selectEdge",t,e),n=!0),!0===n&&this.selectionHandler._generateClickEvent("select",t,e)}},{key:"_determineDifference",value:function(e,t){var i=function(e,t){for(var i=[],o=0;o10&&(e=10);var o=void 0;void 0!==this.drag&&!0===this.drag.dragging&&(o=this.canvas.DOMtoCanvas(this.drag.pointer));var n=this.body.view.translation,s=e/i,r=(1-s)*t.x+n.x*s,a=(1-s)*t.y+n.y*s;if(this.body.view.scale=e,this.body.view.translation={x:r,y:a},null!=o){var d=this.canvas.canvasToDOM(o);this.drag.pointer.x=d.x,this.drag.pointer.y=d.y}this.body.emitter.emit("_requestRedraw"),i0&&(this.popupObj=h[u[u.length-1]],s=!0)}if(void 0===this.popupObj&&!1===s){for(var f=this.body.edgeIndices,p=this.body.edges,v=void 0,g=[],y=0;y0&&(this.popupObj=p[g[g.length-1]],r="edge")}void 0!==this.popupObj?this.popupObj.id!==n&&(void 0===this.popup&&(this.popup=new d(this.canvas.frame)),this.popup.popupTargetType=r,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):void 0!==this.popup&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}},{key:"_checkHidePopup",value:function(e){var t=this.selectionHandler._pointerToPositionObject(e),i=!1;if("node"===this.popup.popupTargetType){if(void 0!==this.body.nodes[this.popup.popupTargetId]&&!0===(i=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t))){var o=this.selectionHandler.getNodeAt(e);i=void 0!==o&&o.id===this.popup.popupTargetId}}else void 0===this.selectionHandler.getNodeAt(e)&&void 0!==this.body.edges[this.popup.popupTargetId]&&(i=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));!1===i&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}]),e}();t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=s(i(0)),n=s(i(1));function s(e){return e&&e.__esModule?e:{default:e}}var r=i(24),a=i(36),d=i(52),h=function(){function e(t,i){var n=this;(0,o.default)(this,e),this.body=t,this.canvas=i,this.iconsCreated=!1,this.navigationHammers=[],this.boundFunctions={},this.touchTime=0,this.activated=!1,this.body.emitter.on("activate",(function(){n.activated=!0,n.configureKeyboardBindings()})),this.body.emitter.on("deactivate",(function(){n.activated=!1,n.configureKeyboardBindings()})),this.body.emitter.on("destroy",(function(){void 0!==n.keycharm&&n.keycharm.destroy()})),this.options={}}return(0,n.default)(e,[{key:"setOptions",value:function(e){void 0!==e&&(this.options=e,this.create())}},{key:"create",value:function(){!0===this.options.navigationButtons?!1===this.iconsCreated&&this.loadNavigationElements():!0===this.iconsCreated&&this.cleanNavigation(),this.configureKeyboardBindings()}},{key:"cleanNavigation",value:function(){if(0!=this.navigationHammers.length){for(var e=0;e700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=(new Date).valueOf())}},{key:"_stopMovement",value:function(){for(var e in this.boundFunctions)this.boundFunctions.hasOwnProperty(e)&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}},{key:"_moveUp",value:function(){this.body.view.translation.y+=this.options.keyboard.speed.y}},{key:"_moveDown",value:function(){this.body.view.translation.y-=this.options.keyboard.speed.y}},{key:"_moveLeft",value:function(){this.body.view.translation.x+=this.options.keyboard.speed.x}},{key:"_moveRight",value:function(){this.body.view.translation.x-=this.options.keyboard.speed.x}},{key:"_zoomIn",value:function(){var e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,o=t/e,n=(1-o)*this.canvas.canvasViewCenter.x+i.x*o,s=(1-o)*this.canvas.canvasViewCenter.y+i.y*o;this.body.view.scale=t,this.body.view.translation={x:n,y:s},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}},{key:"_zoomOut",value:function(){var e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,o=t/e,n=(1-o)*this.canvas.canvasViewCenter.x+i.x*o,s=(1-o)*this.canvas.canvasViewCenter.y+i.y*o;this.body.view.scale=t,this.body.view.translation={x:n,y:s},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}},{key:"configureKeyboardBindings",value:function(){var e=this;void 0!==this.keycharm&&this.keycharm.destroy(),!0===this.options.keyboard.enabled&&(!0===this.options.keyboard.bindToWindow?this.keycharm=d({container:window,preventDefault:!0}):this.keycharm=d({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),!0===this.activated&&(this.keycharm.bind("up",(function(){e.bindToRedraw("_moveUp")}),"keydown"),this.keycharm.bind("down",(function(){e.bindToRedraw("_moveDown")}),"keydown"),this.keycharm.bind("left",(function(){e.bindToRedraw("_moveLeft")}),"keydown"),this.keycharm.bind("right",(function(){e.bindToRedraw("_moveRight")}),"keydown"),this.keycharm.bind("=",(function(){e.bindToRedraw("_zoomIn")}),"keydown"),this.keycharm.bind("num+",(function(){e.bindToRedraw("_zoomIn")}),"keydown"),this.keycharm.bind("num-",(function(){e.bindToRedraw("_zoomOut")}),"keydown"),this.keycharm.bind("-",(function(){e.bindToRedraw("_zoomOut")}),"keydown"),this.keycharm.bind("[",(function(){e.bindToRedraw("_zoomOut")}),"keydown"),this.keycharm.bind("]",(function(){e.bindToRedraw("_zoomIn")}),"keydown"),this.keycharm.bind("pageup",(function(){e.bindToRedraw("_zoomIn")}),"keydown"),this.keycharm.bind("pagedown",(function(){e.bindToRedraw("_zoomOut")}),"keydown"),this.keycharm.bind("up",(function(){e.unbindFromRedraw("_moveUp")}),"keyup"),this.keycharm.bind("down",(function(){e.unbindFromRedraw("_moveDown")}),"keyup"),this.keycharm.bind("left",(function(){e.unbindFromRedraw("_moveLeft")}),"keyup"),this.keycharm.bind("right",(function(){e.unbindFromRedraw("_moveRight")}),"keyup"),this.keycharm.bind("=",(function(){e.unbindFromRedraw("_zoomIn")}),"keyup"),this.keycharm.bind("num+",(function(){e.unbindFromRedraw("_zoomIn")}),"keyup"),this.keycharm.bind("num-",(function(){e.unbindFromRedraw("_zoomOut")}),"keyup"),this.keycharm.bind("-",(function(){e.unbindFromRedraw("_zoomOut")}),"keyup"),this.keycharm.bind("[",(function(){e.unbindFromRedraw("_zoomOut")}),"keyup"),this.keycharm.bind("]",(function(){e.unbindFromRedraw("_zoomIn")}),"keyup"),this.keycharm.bind("pageup",(function(){e.unbindFromRedraw("_zoomIn")}),"keyup"),this.keycharm.bind("pagedown",(function(){e.unbindFromRedraw("_zoomOut")}),"keyup")))}}]),e}();t.default=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=s(i(0)),n=s(i(1));function s(e){return e&&e.__esModule?e:{default:e}}var r=function(){function e(t,i){(0,o.default)(this,e),this.container=t,this.overflowMethod=i||"cap",this.x=0,this.y=0,this.padding=5,this.hidden=!1,this.frame=document.createElement("div"),this.frame.className="vis-tooltip",this.container.appendChild(this.frame)}return(0,n.default)(e,[{key:"setPosition",value:function(e,t){this.x=parseInt(e),this.y=parseInt(t)}},{key:"setText",value:function(e){e instanceof Element?(this.frame.innerHTML="",this.frame.appendChild(e)):this.frame.innerHTML=e}},{key:"show",value:function(e){if(void 0===e&&(e=!0),!0===e){var t=this.frame.clientHeight,i=this.frame.clientWidth,o=this.frame.parentNode.clientHeight,n=this.frame.parentNode.clientWidth,s=0,r=0;if("flip"==this.overflowMethod){var a=!1,d=!0;this.y-tn-this.padding&&(a=!0),s=a?this.x-i:this.x,r=d?this.y-t:this.y}else(r=this.y-t)+t+this.padding>o&&(r=o-t-this.padding),rn&&(s=n-i-this.padding),s4&&void 0!==arguments[4]&&arguments[4],s=this._initBaseEvent(t,i);if(!0===n)s.nodes=[],s.edges=[];else{var r=this.getSelection();s.nodes=r.nodes,s.edges=r.edges}void 0!==o&&(s.previousSelection=o),"click"==e&&(s.items=this.getClickedItems(i)),void 0!==t.controlEdge&&(s.controlEdge=t.controlEdge),this.body.emitter.emit(e,s)}},{key:"selectObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.selectConnectedEdges;return void 0!==e&&(e instanceof a&&!0===t&&this._selectConnectedEdges(e),e.select(),this._addToSelection(e),!0)}},{key:"deselectObject",value:function(e){!0===e.isSelected()&&(e.selected=!1,this._removeFromSelection(e))}},{key:"_getAllNodesOverlappingWith",value:function(e){for(var t=[],i=this.body.nodes,o=0;o1&&void 0!==arguments[1])||arguments[1],i=this._pointerToPositionObject(e),o=this._getAllNodesOverlappingWith(i);return o.length>0?!0===t?this.body.nodes[o[o.length-1]]:o[o.length-1]:void 0}},{key:"_getEdgesOverlappingWith",value:function(e,t){for(var i=this.body.edges,o=0;o1&&void 0!==arguments[1])||arguments[1],i=this.canvas.DOMtoCanvas(e),o=10,n=null,s=this.body.edges,r=0;r1)return!0;return!1}},{key:"_selectConnectedEdges",value:function(e){for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:{},i=void 0,o=void 0;if(!e||!e.nodes&&!e.edges)throw"Selection must be an object with nodes and/or edges properties";if((t.unselectAll||void 0===t.unselectAll)&&this.unselectAll(),e.nodes)for(i=0;i1&&void 0!==arguments[1])||arguments[1];if(!e||void 0===e.length)throw"Selection must be an array with ids";this.setSelection({nodes:e},{highlightEdges:t})}},{key:"selectEdges",value:function(e){if(!e||void 0===e.length)throw"Selection must be an array with ids";this.setSelection({edges:e})}},{key:"updateSelection",value:function(){for(var e in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(e)&&(this.body.nodes.hasOwnProperty(e)||delete this.selectionObj.nodes[e]);for(var t in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(t)&&(this.body.edges.hasOwnProperty(t)||delete this.selectionObj.edges[t])}},{key:"getClickedItems",value:function(e){for(var t=this.canvas.DOMtoCanvas(e),i=[],o=this.body.nodeIndices,n=this.body.nodes,s=o.length-1;s>=0;s--){var r=n[o[s]].getItemsOnPoint(t);i.push.apply(i,r)}for(var a=this.body.edgeIndices,d=this.body.edges,h=a.length-1;h>=0;h--){var l=d[a[h]].getItemsOnPoint(t);i.push.apply(i,l)}return i}}]),e}();t.default=l},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(15)),n=d(i(7)),s=d(i(9)),r=d(i(0)),a=d(i(1));function d(e){return e&&e.__esModule?e:{default:e}}var h=i(83),l=i(2),u=i(57).default,c=i(189),f=c.HorizontalStrategy,p=c.VerticalStrategy,v=function(){function e(){(0,r.default)(this,e),this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}return(0,a.default)(e,[{key:"addRelation",value:function(e,t){void 0===this.childrenReference[e]&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),void 0===this.parentReference[t]&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}},{key:"checkIfTree",value:function(){for(var e in this.parentReference)if(this.parentReference[e].length>1)return void(this.isTree=!1);this.isTree=!0}},{key:"numTrees",value:function(){return this.treeIndex+1}},{key:"setTreeIndex",value:function(e,t){void 0!==t&&void 0===this.trees[e.id]&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}},{key:"ensureLevel",value:function(e){void 0===this.levels[e]&&(this.levels[e]=0)}},{key:"getMaxLevel",value:function(e){var t=this,i={};return function e(o){if(void 0!==i[o])return i[o];var n=t.levels[o];if(t.childrenReference[o]){var s=t.childrenReference[o];if(s.length>0)for(var r=0;r0&&(i.levelSeparation*=-1):i.levelSeparation<0&&(i.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(t);if(!0===o)return this.body.emitter.emit("refresh"),l.deepExtend(t,this.optionsBackup)}return t}},{key:"adaptAllOptionsForHierarchicalLayout",value:function(e){if(!0===this.options.hierarchical.enabled){var t=this.optionsBackup.physics;void 0===e.physics||!0===e.physics?(e.physics={enabled:void 0===t.enabled||t.enabled,solver:"hierarchicalRepulsion"},t.enabled=void 0===t.enabled||t.enabled,t.solver=t.solver||"barnesHut"):"object"===(0,n.default)(e.physics)?(t.enabled=void 0===e.physics.enabled||e.physics.enabled,t.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):!1!==e.physics&&(t.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});var i=this.direction.curveType();if(void 0===e.edges)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges={smooth:!1};else if(void 0===e.edges.smooth)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges.smooth=!1;else if("boolean"==typeof e.edges.smooth)this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:i};else{var o=e.edges.smooth;void 0!==o.type&&"dynamic"!==o.type&&(i=o.type),this.optionsBackup.edges={smooth:void 0===o.enabled||o.enabled,type:void 0===o.type?"dynamic":o.type,roundness:void 0===o.roundness?.5:o.roundness,forceDirection:void 0!==o.forceDirection&&o.forceDirection},e.edges.smooth={enabled:void 0===o.enabled||o.enabled,type:i,roundness:void 0===o.roundness?.5:o.roundness,forceDirection:void 0!==o.forceDirection&&o.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",i)}return e}},{key:"seededRandom",value:function(){var e=1e4*Math.sin(this.randomSeed++);return e-Math.floor(e)}},{key:"positionInitially",value:function(e){if(!0!==this.options.hierarchical.enabled){this.randomSeed=this.initialRandomSeed;for(var t=e.length+50,i=0;i150){for(var s=e.length;e.length>150&&o<=10;){o+=1;var r=e.length;if(o%3==0?this.body.modules.clustering.clusterBridges(n):this.body.modules.clustering.clusterOutliers(n),r==e.length&&o%3!=0)return this._declusterAll(),this.body.emitter.emit("_layoutFailed"),void console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.")}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*s)})}o>10&&console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();for(var a=0;a0){var e=void 0,t=void 0,i=!1,o=!1;for(t in this.lastNodeOnLevel={},this.hierarchical=new v,this.body.nodes)this.body.nodes.hasOwnProperty(t)&&(void 0!==(e=this.body.nodes[t]).options.level?(i=!0,this.hierarchical.levels[t]=e.options.level):o=!0);if(!0===o&&!0===i)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");if(!0===o){var n=this.options.hierarchical.sortMethod;"hubsize"===n?this._determineLevelsByHubsize():"directed"===n?this._determineLevelsDirected():"custom"===n&&this._determineLevelsCustomCallback()}for(var s in this.body.nodes)this.body.nodes.hasOwnProperty(s)&&this.hierarchical.ensureLevel(s);var r=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(r),this._condenseHierarchy(),this._shiftToCenter()}}},{key:"_condenseHierarchy",value:function(){var e=this,t=!1,i={},n=function(t,i){var o=e.hierarchical.trees;for(var n in o)o.hasOwnProperty(n)&&o[n]===t&&e.direction.shift(n,i)},s=function t(i,o){if(!o[i.id]&&(o[i.id]=!0,e.hierarchical.childrenReference[i.id])){var n=e.hierarchical.childrenReference[i.id];if(n.length>0)for(var s=0;s1&&void 0!==arguments[1]?arguments[1]:1e9,n=1e9,s=1e9,r=1e9,a=-1e9;for(var d in t)if(t.hasOwnProperty(d)){var h=e.body.nodes[d],l=e.hierarchical.levels[h.id],u=e.direction.getPosition(h),c=e._getSpaceAroundNode(h,t),f=(0,o.default)(c,2),p=f[0],v=f[1];n=Math.min(p,n),s=Math.min(v,s),l<=i&&(r=Math.min(u,r),a=Math.max(u,a))}return[r,a,n,s]},a=function(t,i){var o=e.hierarchical.getMaxLevel(t.id),n=e.hierarchical.getMaxLevel(i.id);return Math.min(o,n)},d=function(t,i,o){for(var n=e.hierarchical,s=0;s1)for(var d=0;d2&&void 0!==arguments[2]&&arguments[2],d=e.direction.getPosition(i),h=e.direction.getPosition(o),l=Math.abs(h-d),u=e.options.hierarchical.nodeSpacing;if(l>u){var c={},f={};s(i,c),s(o,f);var p=a(i,o),v=r(c,p),g=r(f,p),y=v[1],m=g[0],b=g[2],_=Math.abs(y-m);if(_>u){var w=y-m+u;w<-b+u&&(w=-b+u),w<0&&(e._shiftBlock(o.id,w),t=!0,!0===n&&e._centerParent(o))}}},l=function(n,a){for(var d=a.id,h=a.edges,l=e.hierarchical.levels[a.id],u=e.options.hierarchical.levelSeparation*e.options.hierarchical.levelSeparation,c={},f=[],p=0;p0?f=Math.min(c,u-e.options.hierarchical.nodeSpacing):c<0&&(f=-Math.min(-c,l-e.options.hierarchical.nodeSpacing)),0!=f&&(e._shiftBlock(a.id,f),t=!0)}(_),function(i){var n=e.direction.getPosition(a),s=e._getSpaceAroundNode(a),r=(0,o.default)(s,2),d=r[0],h=r[1],l=i-n,u=n;l>0?u=Math.min(n+(h-e.options.hierarchical.nodeSpacing),i):l<0&&(u=Math.max(n-(d-e.options.hierarchical.nodeSpacing),i)),u!==n&&(e.direction.setPosition(a,u),t=!0)}(_=b(n,h))};!0===this.options.hierarchical.blockShifting&&(function(i){var o=e.hierarchical.getLevels();o=o.reverse();for(var n=0;n<5&&(t=!1,d(h,o,!0),!0===t);n++);}(),function(){for(var t in e.body.nodes)e.body.nodes.hasOwnProperty(t)&&e._centerParent(e.body.nodes[t])}()),!0===this.options.hierarchical.edgeMinimization&&function(i){var o=e.hierarchical.getLevels();o=o.reverse();for(var n=0;n<20;n++){t=!1;for(var s=0;s0&&Math.abs(f)0&&(d=this.direction.getPosition(i[n-1])+a),this.direction.setPosition(r,d,t),this._validatePositionAndContinue(r,t,d),o++}}}}},{key:"_placeBranchNodes",value:function(e,t){var i=this.hierarchical.childrenReference[e];if(void 0!==i){for(var o=[],n=0;nt&&void 0===this.positionedNodes[r.id]))return;var d,h=this.options.hierarchical.nodeSpacing;d=0===s?this.direction.getPosition(this.body.nodes[e]):this.direction.getPosition(o[s-1])+h,this.direction.setPosition(r,d,a),this._validatePositionAndContinue(r,a,d)}var l=this._getCenterPosition(o);this.direction.setPosition(this.body.nodes[e],l,t)}}},{key:"_validatePositionAndContinue",value:function(e,t,i){if(this.hierarchical.isTree){if(void 0!==this.lastNodeOnLevel[t]){var o=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(i-oe.hierarchical.levels[t.id]&&e.hierarchical.addRelation(t.id,i.id)})),this.hierarchical.checkIfTree()}},{key:"_crawlNetwork",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},i=arguments[1],o={},n=function i(n,s){if(void 0===o[n.id]){e.hierarchical.setTreeIndex(n,s),o[n.id]=!0;for(var r=void 0,a=e._getActiveEdges(n),d=0;d=32;)t|=1&e,e>>=1;return e+t}(a);do{if((h=n(e,i,r,t))u&&(c=u),s(e,i,i+c,i+h,t),h=c}l.pushRun(i,h),l.mergeRuns(),a-=h,i+=h}while(0!==a);l.forceMergeRuns()}}};var t=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9];function i(e){return e<1e5?e<100?e<10?0:1:e<1e4?e<1e3?2:3:4:e<1e7?e<1e6?5:6:e<1e9?e<1e8?7:8:9}function o(e,o){if(e===o)return 0;if(~~e===e&&~~o===o){if(0===e||0===o)return e=0)return-1;if(e>=0)return 1;e=-e,o=-o}var n=i(e),s=i(o),r=0;return ns&&(o*=t[n-s-1],e/=10,r=1),e===o?r:e=0;)n++;return n-t}function s(e,t,i,o,n){for(o===t&&o++;o>>1;n(s,e[d])<0?a=d:r=d+1}var h=o-r;switch(h){case 3:e[r+3]=e[r+2];case 2:e[r+2]=e[r+1];case 1:e[r+1]=e[r];break;default:for(;h>0;)e[r+h]=e[r+h-1],h--}e[r]=s}}function r(e,t,i,o,n,s){var r=0,a=0,d=1;if(s(e,t[i+n])>0){for(a=o-n;d0;)r=d,(d=1+(d<<1))<=0&&(d=a);d>a&&(d=a),r+=n,d+=n}else{for(a=n+1;da&&(d=a);var h=r;r=n-d,d=n-h}for(r++;r>>1);s(e,t[i+l])>0?r=l+1:d=l}return d}function a(e,t,i,o,n,s){var r=0,a=0,d=1;if(s(e,t[i+n])<0){for(a=n+1;da&&(d=a);var h=r;r=n-d,d=n-h}else{for(a=o-n;d=0;)r=d,(d=1+(d<<1))<=0&&(d=a);d>a&&(d=a),r+=n,d+=n}for(r++;r>>1);s(e,t[i+l])<0?d=l:r=l+1}return d}var d=function(){function e(t,i){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.array=null,this.compare=null,this.minGallop=7,this.length=0,this.tmpStorageLength=256,this.stackLength=0,this.runStart=null,this.runLength=null,this.stackSize=0,this.array=t,this.compare=i,this.length=t.length,this.length<512&&(this.tmpStorageLength=this.length>>>1),this.tmp=new Array(this.tmpStorageLength),this.stackLength=this.length<120?5:this.length<1542?10:this.length<119151?19:40,this.runStart=new Array(this.stackLength),this.runLength=new Array(this.stackLength)}return e.prototype.pushRun=function(e,t){this.runStart[this.stackSize]=e,this.runLength[this.stackSize]=t,this.stackSize+=1},e.prototype.mergeRuns=function(){for(;this.stackSize>1;){var e=this.stackSize-2;if(e>=1&&this.runLength[e-1]<=this.runLength[e]+this.runLength[e+1]||e>=2&&this.runLength[e-2]<=this.runLength[e]+this.runLength[e-1])this.runLength[e-1]this.runLength[e+1])break;this.mergeAt(e)}},e.prototype.forceMergeRuns=function(){for(;this.stackSize>1;){var e=this.stackSize-2;e>0&&this.runLength[e-1]=7||v>=7);if(g)break;f<0&&(f=0),f+=2}if(this.minGallop=f,f<1&&(this.minGallop=1),1===t){for(h=0;h=0;h--)s[p+h]=s[f+h];if(0===t){m=!0;break}}if(s[c--]=d[u--],1==--o){m=!0;break}if(0!=(y=o-r(s[l],d,0,o,o-1,n))){for(o-=y,p=1+(c-=y),f=1+(u-=y),h=0;h=7||y>=7);if(m)break;v<0&&(v=0),v+=2}if(this.minGallop=v,v<1&&(this.minGallop=1),1===o){for(p=1+(c-=t),f=1+(l-=t),h=t-1;h>=0;h--)s[p+h]=s[f+h];s[c]=d[u]}else{if(0===o)throw new Error("mergeHigh preconditions were not respected");for(f=c-(o-1),h=0;h=0;h--)s[p+h]=s[f+h];s[c]=d[u]}else for(f=c-(o-1),h=0;h2&&void 0!==arguments[2]?arguments[2]:void 0;this.fake_use(e,t,i),this.abstract()}},{key:"getTreeSize",value:function(e){return this.fake_use(e),this.abstract()}},{key:"sort",value:function(e){this.fake_use(e),this.abstract()}},{key:"fix",value:function(e,t){this.fake_use(e,t),this.abstract()}},{key:"shift",value:function(e,t){this.fake_use(e,t),this.abstract()}}]),e}(),u=function(e){function t(e){(0,r.default)(this,t);var i=(0,n.default)(this,(t.__proto__||(0,o.default)(t)).call(this));return i.layout=e,i}return(0,s.default)(t,e),(0,a.default)(t,[{key:"curveType",value:function(){return"horizontal"}},{key:"getPosition",value:function(e){return e.x}},{key:"setPosition",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;void 0!==i&&this.layout.hierarchical.addToOrdering(e,i),e.x=t}},{key:"getTreeSize",value:function(e){var t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_x,max:t.max_x}}},{key:"sort",value:function(e){h.sort(e,(function(e,t){return e.x-t.x}))}},{key:"fix",value:function(e,t){e.y=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.y=!0}},{key:"shift",value:function(e,t){this.layout.body.nodes[e].x+=t}}]),t}(l),c=function(e){function t(e){(0,r.default)(this,t);var i=(0,n.default)(this,(t.__proto__||(0,o.default)(t)).call(this));return i.layout=e,i}return(0,s.default)(t,e),(0,a.default)(t,[{key:"curveType",value:function(){return"vertical"}},{key:"getPosition",value:function(e){return e.y}},{key:"setPosition",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;void 0!==i&&this.layout.hierarchical.addToOrdering(e,i),e.y=t}},{key:"getTreeSize",value:function(e){var t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_y,max:t.max_y}}},{key:"sort",value:function(e){h.sort(e,(function(e,t){return e.y-t.y}))}},{key:"fix",value:function(e,t){e.x=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.x=!0}},{key:"shift",value:function(e,t){this.layout.body.nodes[e].y+=t}}]),t}(l);t.HorizontalStrategy=c,t.VerticalStrategy=u},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=d(i(9)),n=d(i(23)),s=d(i(7)),r=d(i(0)),a=d(i(1));function d(e){return e&&e.__esModule?e:{default:e}}var h=i(2),l=i(24),u=i(36),c=function(){function e(t,i,o){var n=this;(0,r.default)(this,e),this.body=t,this.canvas=i,this.selectionHandler=o,this.editMode=!1,this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0,this.manipulationHammers=[],this.temporaryUIFunctions={},this.temporaryEventFunctions=[],this.touchTime=0,this.temporaryIds={nodes:[],edges:[]},this.guiEnabled=!1,this.inMode=!1,this.selectedControlNode=void 0,this.options={},this.defaultOptions={enabled:!1,initiallyActive:!1,addNode:!0,addEdge:!0,editNode:void 0,editEdge:!0,deleteNode:!0,deleteEdge:!0,controlNodeStyle:{shape:"dot",size:6,color:{background:"#ff0000",border:"#3c3c3c",highlight:{background:"#07f968",border:"#3c3c3c"}},borderWidth:2,borderWidthSelected:2}},h.extend(this.options,this.defaultOptions),this.body.emitter.on("destroy",(function(){n._clean()})),this.body.emitter.on("_dataChanged",this._restore.bind(this)),this.body.emitter.on("_resetData",this._restore.bind(this))}return(0,a.default)(e,[{key:"_restore",value:function(){!1!==this.inMode&&(!0===this.options.initiallyActive?this.enableEditMode():this.disableEditMode())}},{key:"setOptions",value:function(e,t,i){void 0!==t&&(void 0!==t.locale?this.options.locale=t.locale:this.options.locale=i.locale,void 0!==t.locales?this.options.locales=t.locales:this.options.locales=i.locales),void 0!==e&&("boolean"==typeof e?this.options.enabled=e:(this.options.enabled=!0,h.deepExtend(this.options,e)),!0===this.options.initiallyActive&&(this.editMode=!0),this._setup())}},{key:"toggleEditMode",value:function(){!0===this.editMode?this.disableEditMode():this.enableEditMode()}},{key:"enableEditMode",value:function(){this.editMode=!0,this._clean(),!0===this.guiEnabled&&(this.manipulationDiv.style.display="block",this.closeDiv.style.display="block",this.editModeDiv.style.display="none",this.showManipulatorToolbar())}},{key:"disableEditMode",value:function(){this.editMode=!1,this._clean(),!0===this.guiEnabled&&(this.manipulationDiv.style.display="none",this.closeDiv.style.display="none",this.editModeDiv.style.display="block",this._createEditButton())}},{key:"showManipulatorToolbar",value:function(){if(this._clean(),this.manipulationDOM={},!0===this.guiEnabled){this.editMode=!0,this.manipulationDiv.style.display="block",this.closeDiv.style.display="block";var e=this.selectionHandler._getSelectedNodeCount(),t=this.selectionHandler._getSelectedEdgeCount(),i=e+t,o=this.options.locales[this.options.locale],n=!1;!1!==this.options.addNode&&(this._createAddNodeButton(o),n=!0),!1!==this.options.addEdge&&(!0===n?this._createSeperator(1):n=!0,this._createAddEdgeButton(o)),1===e&&"function"==typeof this.options.editNode?(!0===n?this._createSeperator(2):n=!0,this._createEditNodeButton(o)):1===t&&0===e&&!1!==this.options.editEdge&&(!0===n?this._createSeperator(3):n=!0,this._createEditEdgeButton(o)),0!==i&&(e>0&&!1!==this.options.deleteNode||0===e&&!1!==this.options.deleteEdge)&&(!0===n&&this._createSeperator(4),this._createDeleteButton(o)),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this)),this._temporaryBindEvent("select",this.showManipulatorToolbar.bind(this))}this.body.emitter.emit("_redraw")}},{key:"addNodeMode",value:function(){if(!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="addNode",!0===this.guiEnabled){var e=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(e),this._createSeperator(),this._createDescription(e.addDescription||this.options.locales.en.addDescription),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this))}this._temporaryBindEvent("click",this._performAddNode.bind(this))}},{key:"editNode",value:function(){var e=this;!0!==this.editMode&&this.enableEditMode(),this._clean();var t=this.selectionHandler._getSelectedNode();if(void 0!==t){if(this.inMode="editNode","function"!=typeof this.options.editNode)throw new Error("No function has been configured to handle the editing of nodes.");if(!0!==t.isCluster){var i=h.deepExtend({},t.options,!1);if(i.x=t.x,i.y=t.y,2!==this.options.editNode.length)throw new Error("The function for edit does not support two arguments (data, callback)");this.options.editNode(i,(function(t){null!=t&&"editNode"===e.inMode&&e.body.data.nodes.getDataSet().update(t),e.showManipulatorToolbar()}))}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError)}else this.showManipulatorToolbar()}},{key:"addEdgeMode",value:function(){if(!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="addEdge",!0===this.guiEnabled){var e=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(e),this._createSeperator(),this._createDescription(e.edgeDescription||this.options.locales.en.edgeDescription),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this))}this._temporaryBindUI("onTouch",this._handleConnect.bind(this)),this._temporaryBindUI("onDragEnd",this._finishConnect.bind(this)),this._temporaryBindUI("onDrag",this._dragControlNode.bind(this)),this._temporaryBindUI("onRelease",this._finishConnect.bind(this)),this._temporaryBindUI("onDragStart",this._dragStartEdge.bind(this)),this._temporaryBindUI("onHold",(function(){}))}},{key:"editEdgeMode",value:function(){if(!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="editEdge","object"!==(0,s.default)(this.options.editEdge)||"function"!=typeof this.options.editEdge.editWithoutDrag||(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdges()[0],void 0===this.edgeBeingEditedId)){if(!0===this.guiEnabled){var e=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(e),this._createSeperator(),this._createDescription(e.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdges()[0],void 0!==this.edgeBeingEditedId){var t=this.body.edges[this.edgeBeingEditedId],i=this._getNewTargetNode(t.from.x,t.from.y),o=this._getNewTargetNode(t.to.x,t.to.y);this.temporaryIds.nodes.push(i.id),this.temporaryIds.nodes.push(o.id),this.body.nodes[i.id]=i,this.body.nodeIndices.push(i.id),this.body.nodes[o.id]=o,this.body.nodeIndices.push(o.id),this._temporaryBindUI("onTouch",this._controlNodeTouch.bind(this)),this._temporaryBindUI("onTap",(function(){})),this._temporaryBindUI("onHold",(function(){})),this._temporaryBindUI("onDragStart",this._controlNodeDragStart.bind(this)),this._temporaryBindUI("onDrag",this._controlNodeDrag.bind(this)),this._temporaryBindUI("onDragEnd",this._controlNodeDragEnd.bind(this)),this._temporaryBindUI("onMouseMove",(function(){})),this._temporaryBindEvent("beforeDrawing",(function(e){var n=t.edgeType.findBorderPositions(e);!1===i.selected&&(i.x=n.from.x,i.y=n.from.y),!1===o.selected&&(o.x=n.to.x,o.y=n.to.y)})),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}else{var n=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(n.from,n.to)}}},{key:"deleteSelected",value:function(){var e=this;!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="delete";var t=this.selectionHandler.getSelectedNodes(),i=this.selectionHandler.getSelectedEdges(),o=void 0;if(t.length>0){for(var n=0;n0&&"function"==typeof this.options.deleteEdge&&(o=this.options.deleteEdge);if("function"==typeof o){var s={nodes:t,edges:i};if(2!==o.length)throw new Error("The function for delete does not support two arguments (data, callback)");o(s,(function(t){null!=t&&"delete"===e.inMode?(e.body.data.edges.getDataSet().remove(t.edges),e.body.data.nodes.getDataSet().remove(t.nodes),e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar()):(e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar())}))}else this.body.data.edges.getDataSet().remove(i),this.body.data.nodes.getDataSet().remove(t),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}},{key:"_setup",value:function(){!0===this.options.enabled?(this.guiEnabled=!0,this._createWrappers(),!1===this.editMode?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}},{key:"_createWrappers",value:function(){void 0===this.manipulationDiv&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",!0===this.editMode?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),void 0===this.editModeDiv&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",!0===this.editMode?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),void 0===this.closeDiv&&(this.closeDiv=document.createElement("div"),this.closeDiv.className="vis-close",this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv))}},{key:"_getNewTargetNode",value:function(e,t){var i=h.deepExtend({},this.options.controlNodeStyle);i.id="targetNode"+h.randomUUID(),i.hidden=!1,i.physics=!1,i.x=e,i.y=t;var o=this.body.functions.createNode(i);return o.shape.boundingBox={left:e,right:e,top:t,bottom:t},o}},{key:"_createEditButton",value:function(){this._clean(),this.manipulationDOM={},h.recursiveDOMDelete(this.editModeDiv);var e=this.options.locales[this.options.locale],t=this._createButton("editMode","vis-button vis-edit vis-edit-mode",e.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(t),this._bindHammerToDiv(t,this.toggleEditMode.bind(this))}},{key:"_clean",value:function(){this.inMode=!1,!0===this.guiEnabled&&(h.recursiveDOMDelete(this.editModeDiv),h.recursiveDOMDelete(this.manipulationDiv),this._cleanManipulatorHammers()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}},{key:"_cleanManipulatorHammers",value:function(){if(0!=this.manipulationHammers.length){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}},{key:"_createAddNodeButton",value:function(e){var t=this._createButton("addNode","vis-button vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(t),this._bindHammerToDiv(t,this.addNodeMode.bind(this))}},{key:"_createAddEdgeButton",value:function(e){var t=this._createButton("addEdge","vis-button vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(t),this._bindHammerToDiv(t,this.addEdgeMode.bind(this))}},{key:"_createEditNodeButton",value:function(e){var t=this._createButton("editNode","vis-button vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(t),this._bindHammerToDiv(t,this.editNode.bind(this))}},{key:"_createEditEdgeButton",value:function(e){var t=this._createButton("editEdge","vis-button vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(t),this._bindHammerToDiv(t,this.editEdgeMode.bind(this))}},{key:"_createDeleteButton",value:function(e){var t;t=this.options.rtl?"vis-button vis-delete-rtl":"vis-button vis-delete";var i=this._createButton("delete",t,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(i),this._bindHammerToDiv(i,this.deleteSelected.bind(this))}},{key:"_createBackButton",value:function(e){var t=this._createButton("back","vis-button vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(t),this._bindHammerToDiv(t,this.showManipulatorToolbar.bind(this))}},{key:"_createButton",value:function(e,t,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("div"),this.manipulationDOM[e+"Div"].className=t,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=o,this.manipulationDOM[e+"Label"].innerHTML=i,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}},{key:"_createDescription",value:function(e){this.manipulationDiv.appendChild(this._createButton("description","vis-button vis-none",e))}},{key:"_temporaryBindEvent",value:function(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}},{key:"_temporaryBindUI",value:function(e,t){if(void 0===this.body.eventListeners[e])throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+(0,n.default)((0,o.default)(this.body.eventListeners)));this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t}},{key:"_unbindTemporaryUIs",value:function(){for(var e in this.temporaryUIFunctions)this.temporaryUIFunctions.hasOwnProperty(e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}},{key:"_unbindTemporaryEvents",value:function(){for(var e=0;e=0;r--)if(n[r]!==this.selectedControlNode.id){s=this.body.nodes[n[r]];break}if(void 0!==s&&void 0!==this.selectedControlNode)if(!0===s.isCluster)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var a=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===a.id?this._performEditEdge(s.id,o.to.id):this._performEditEdge(o.from.id,s.id)}else o.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}}},{key:"_handleConnect",value:function(e){if((new Date).valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=h.extend({},this.body.view.translation);var t=this.lastTouch,i=this.selectionHandler.getNodeAt(t);if(void 0!==i)if(!0===i.isCluster)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var o=this._getNewTargetNode(i.x,i.y);this.body.nodes[o.id]=o,this.body.nodeIndices.push(o.id);var n=this.body.functions.createEdge({id:"connectionEdge"+h.randomUUID(),from:i.id,to:o.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[n.id]=n,this.body.edgeIndices.push(n.id),this.temporaryIds.nodes.push(o.id),this.temporaryIds.edges.push(n.id)}this.touchTime=(new Date).valueOf()}}},{key:"_dragControlNode",value:function(e){var t=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(t),o=void 0;void 0!==this.temporaryIds.edges[0]&&(o=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var n=this.selectionHandler._getAllNodesOverlappingWith(i),s=void 0,r=n.length-1;r>=0;r--)if(-1===this.temporaryIds.nodes.indexOf(n[r])){s=this.body.nodes[n[r]];break}if(e.controlEdge={from:o,to:s?s.id:void 0},this.selectionHandler._generateClickEvent("controlNodeDragging",e,t),void 0!==this.temporaryIds.nodes[0]){var a=this.body.nodes[this.temporaryIds.nodes[0]];a.x=this.canvas._XconvertDOMtoCanvas(t.x),a.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit("_redraw")}else{var d=t.x-this.lastTouch.x,h=t.y-this.lastTouch.y;this.body.view.translation={x:this.lastTouch.translation.x+d,y:this.lastTouch.translation.y+h}}}},{key:"_finishConnect",value:function(e){var t=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(t),o=void 0;void 0!==this.temporaryIds.edges[0]&&(o=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var n=this.selectionHandler._getAllNodesOverlappingWith(i),s=void 0,r=n.length-1;r>=0;r--)if(-1===this.temporaryIds.nodes.indexOf(n[r])){s=this.body.nodes[n[r]];break}this._cleanupTemporaryNodesAndEdges(),void 0!==s&&(!0===s.isCluster?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):void 0!==this.body.nodes[o]&&void 0!==this.body.nodes[s.id]&&this._performAddEdge(o,s.id)),e.controlEdge={from:o,to:s?s.id:void 0},this.selectionHandler._generateClickEvent("controlNodeDragEnd",e,t),this.body.emitter.emit("_redraw")}},{key:"_dragStartEdge",value:function(e){var t=this.lastTouch;this.selectionHandler._generateClickEvent("dragStart",e,t,void 0,!0)}},{key:"_performAddNode",value:function(e){var t=this,i={id:h.randomUUID(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:"new"};if("function"==typeof this.options.addNode){if(2!==this.options.addNode.length)throw this.showManipulatorToolbar(),new Error("The function for add does not support two arguments (data,callback)");this.options.addNode(i,(function(e){null!=e&&"addNode"===t.inMode&&t.body.data.nodes.getDataSet().add(e),t.showManipulatorToolbar()}))}else this.body.data.nodes.getDataSet().add(i),this.showManipulatorToolbar()}},{key:"_performAddEdge",value:function(e,t){var i=this,o={from:e,to:t};if("function"==typeof this.options.addEdge){if(2!==this.options.addEdge.length)throw new Error("The function for connect does not support two arguments (data,callback)");this.options.addEdge(o,(function(e){null!=e&&"addEdge"===i.inMode&&(i.body.data.edges.getDataSet().add(e),i.selectionHandler.unselectAll(),i.showManipulatorToolbar())}))}else this.body.data.edges.getDataSet().add(o),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}},{key:"_performEditEdge",value:function(e,t){var i=this,o={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges._data[this.edgeBeingEditedId].label},n=this.options.editEdge;if("object"===(void 0===n?"undefined":(0,s.default)(n))&&(n=n.editWithoutDrag),"function"==typeof n){if(2!==n.length)throw new Error("The function for edit does not support two arguments (data, callback)");n(o,(function(e){null==e||"editEdge"!==i.inMode?(i.body.edges[o.id].updateEdgeType(),i.body.emitter.emit("_redraw"),i.showManipulatorToolbar()):(i.body.data.edges.getDataSet().update(e),i.selectionHandler.unselectAll(),i.showManipulatorToolbar())}))}else this.body.data.edges.getDataSet().update(o),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}]),e}();t.default=c},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=a(i(23)),n=a(i(7)),s=a(i(0)),r=a(i(1));function a(e){return e&&e.__esModule?e:{default:e}}var d=i(2),h=i(192).default,l=function(){function e(t,i,o){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;(0,s.default)(this,e),this.parent=t,this.changedOptions=[],this.container=i,this.allowCreation=!1,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},d.extend(this.options,this.defaultOptions),this.configureOptions=o,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new h(n),this.wrapper=void 0}return(0,r.default)(e,[{key:"setOptions",value:function(e){if(void 0!==e){this.popupHistory={},this._removePopup();var t=!0;if("string"==typeof e)this.options.filter=e;else if(e instanceof Array)this.options.filter=e.join();else if("object"===(void 0===e?"undefined":(0,n.default)(e))){if(null==e)throw new TypeError("options cannot be null");void 0!==e.container&&(this.options.container=e.container),void 0!==e.filter&&(this.options.filter=e.filter),void 0!==e.showButton&&(this.options.showButton=e.showButton),void 0!==e.enabled&&(t=e.enabled)}else"boolean"==typeof e?(this.options.filter=!0,t=e):"function"==typeof e&&(this.options.filter=e,t=!0);!1===this.options.filter&&(t=!1),this.options.enabled=t}this._clean()}},{key:"setModuleOptions",value:function(e){this.moduleOptions=e,!0===this.options.enabled&&(this._clean(),void 0!==this.options.container&&(this.container=this.options.container),this._create())}},{key:"_create",value:function(){this._clean(),this.changedOptions=[];var e=this.options.filter,t=0,i=!1;for(var o in this.configureOptions)this.configureOptions.hasOwnProperty(o)&&(this.allowCreation=!1,i=!1,"function"==typeof e?i=(i=e(o,[]))||this._handleObject(this.configureOptions[o],[o],!0):!0!==e&&-1===e.indexOf(o)||(i=!0),!1!==i&&(this.allowCreation=!0,t>0&&this._makeItem([]),this._makeHeader(o),this._handleObject(this.configureOptions[o],[o])),t++);this._makeButton(),this._push()}},{key:"_push",value:function(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(var e=0;e1?i-1:0),n=1;n2&&void 0!==arguments[2]&&arguments[2],o=document.createElement("div");return o.className="vis-configuration vis-config-label vis-config-s"+t.length,o.innerHTML=!0===i?""+e+":":e+":",o}},{key:"_makeDropdown",value:function(e,t,i){var o=document.createElement("select");o.className="vis-configuration vis-config-select";var n=0;void 0!==t&&-1!==e.indexOf(t)&&(n=e.indexOf(t));for(var s=0;ss&&1!==s&&(a.max=Math.ceil(t*l),h=a.max,d="range increased"),a.value=t}else a.value=o;var u=document.createElement("input");u.className="vis-configuration vis-config-rangeinput",u.value=a.value;var c=this;a.onchange=function(){u.value=this.value,c._update(Number(this.value),i)},a.oninput=function(){u.value=this.value};var f=this._makeLabel(i[i.length-1],i),p=this._makeItem(i,f,a,u);""!==d&&this.popupHistory[p]!==h&&(this.popupHistory[p]=h,this._setupPopup(d,p))}},{key:"_makeButton",value:function(){var e=this;if(!0===this.options.showButton){var t=document.createElement("div");t.className="vis-configuration vis-config-button",t.innerHTML="generate options",t.onclick=function(){e._printOptions()},t.onmouseover=function(){t.className="vis-configuration vis-config-button hover"},t.onmouseout=function(){t.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(t)}}},{key:"_setupPopup",value:function(e,t){var i=this;if(!0===this.initialized&&!0===this.allowCreation&&this.popupCounter1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!1,n=this.options.filter,s=!1;for(var r in e)if(e.hasOwnProperty(r)){o=!0;var a=e[r],h=d.copyAndExtendArray(t,r);if("function"==typeof n&&!1===(o=n(r,t))&&!(a instanceof Array)&&"string"!=typeof a&&"boolean"!=typeof a&&a instanceof Object&&(this.allowCreation=!1,o=this._handleObject(a,h,!0),this.allowCreation=!1===i),!1!==o){s=!0;var l=this._getValue(h);if(a instanceof Array)this._handleArray(a,l,h);else if("string"==typeof a)this._makeTextInput(a,l,h);else if("boolean"==typeof a)this._makeCheckbox(a,l,h);else if(a instanceof Object){var u=!0;if(-1!==t.indexOf("physics")&&this.moduleOptions.physics.solver!==r&&(u=!1),!0===u)if(void 0!==a.enabled){var c=d.copyAndExtendArray(h,"enabled"),f=this._getValue(c);if(!0===f){var p=this._makeLabel(r,h,!0);this._makeItem(h,p),s=this._handleObject(a,h)||s}else this._makeCheckbox(a,f,h)}else{var v=this._makeLabel(r,h,!0);this._makeItem(h,v),s=this._handleObject(a,h)||s}}else console.error("dont know how to handle",a,r,h)}}return s}},{key:"_handleArray",value:function(e,t,i){"string"==typeof e[0]&&"color"===e[0]?(this._makeColorField(e,t,i),e[1]!==t&&this.changedOptions.push({path:i,value:t})):"string"==typeof e[0]?(this._makeDropdown(e,t,i),e[0]!==t&&this.changedOptions.push({path:i,value:t})):"number"==typeof e[0]&&(this._makeRange(e,t,i),e[0]!==t&&this.changedOptions.push({path:i,value:Number(t)}))}},{key:"_update",value:function(e,t){var i=this._constructOptions(e,t);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",i),this.initialized=!0,this.parent.setOptions(i)}},{key:"_constructOptions",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i;e="false"!==(e="true"===e||e)&&e;for(var n=0;nvar options = "+(0,o.default)(e,null,2)+""}},{key:"getOptions",value:function(){for(var e={},t=0;t0&&void 0!==arguments[0]?arguments[0]:1;(0,n.default)(this,e),this.pixelRatio=t,this.generated=!1,this.centerCoordinates={x:144.5,y:144.5},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=function(){},this.closeCallback=function(){},this._create()}return(0,s.default)(e,[{key:"insertTo",value:function(e){void 0!==this.hammer&&(this.hammer.destroy(),this.hammer=void 0),this.container=e,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(e){if("function"!=typeof e)throw new Error("Function attempted to set as colorPicker update callback is not a function.");this.updateCallback=e}},{key:"setCloseCallback",value:function(e){if("function"!=typeof e)throw new Error("Function attempted to set as colorPicker closing callback is not a function.");this.closeCallback=e}},{key:"_isColorString",value:function(e){if("string"==typeof e)return l[e]}},{key:"setColor",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("none"!==e){var i=void 0,n=this._isColorString(e);if(void 0!==n&&(e=n),!0===h.isString(e)){if(!0===h.isValidRGB(e)){var s=e.substr(4).substr(0,e.length-5).split(",");i={r:s[0],g:s[1],b:s[2],a:1}}else if(!0===h.isValidRGBA(e)){var r=e.substr(5).substr(0,e.length-6).split(",");i={r:r[0],g:r[1],b:r[2],a:r[3]}}else if(!0===h.isValidHex(e)){var a=h.hexToRGB(e);i={r:a.r,g:a.g,b:a.b,a:1}}}else if(e instanceof Object&&void 0!==e.r&&void 0!==e.g&&void 0!==e.b){var d=void 0!==e.a?e.a:"1.0";i={r:e.r,g:e.g,b:e.b,a:d}}if(void 0===i)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+(0,o.default)(e));this._setColor(i,t)}}},{key:"show",value:function(){void 0!==this.closeCallback&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}},{key:"_hide",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===t&&(this.previousColor=h.extend({},this.color)),!0===this.applied&&this.updateCallback(this.initialColor),this.frame.style.display="none",setTimeout((function(){void 0!==e.closeCallback&&(e.closeCallback(),e.closeCallback=void 0)}),0)}},{key:"_save",value:function(){this.updateCallback(this.color),this.applied=!1,this._hide()}},{key:"_apply",value:function(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}},{key:"_loadLast",value:function(){void 0!==this.previousColor?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}},{key:"_setColor",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];!0===t&&(this.initialColor=h.extend({},e)),this.color=e;var i=h.RGBToHSV(e.r,e.g,e.b),o=2*Math.PI,n=this.r*i.s,s=this.centerCoordinates.x+n*Math.sin(o*i.h),r=this.centerCoordinates.y+n*Math.cos(o*i.h);this.colorPickerSelector.style.left=s-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=r-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(e)}},{key:"_setOpacity",value:function(e){this.color.a=e/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(e){var t=h.RGBToHSV(this.color.r,this.color.g,this.color.b);t.v=e/100;var i=h.HSVToRGB(t.h,t.s,t.v);i.a=this.color.a,this.color=i,this._updatePicker()}},{key:"_updatePicker",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.color,t=h.RGBToHSV(e.r,e.g,e.b),i=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1)),i.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var o=this.colorPickerCanvas.clientWidth,n=this.colorPickerCanvas.clientHeight;i.clearRect(0,0,o,n),i.putImageData(this.hueCircle,0,0),i.fillStyle="rgba(0,0,0,"+(1-t.v)+")",i.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),i.fill(),this.brightnessRange.value=100*t.v,this.opacityRange.value=100*e.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}},{key:"_setSize",value:function(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}},{key:"_create",value:function(){if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){var e=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var t=document.createElement("DIV");t.style.color="red",t.style.fontWeight="bold",t.style.padding="10px",t.innerHTML="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(t)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch(e){}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch(e){}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);var i=this;this.opacityRange.onchange=function(){i._setOpacity(this.value)},this.opacityRange.oninput=function(){i._setOpacity(this.value)},this.brightnessRange.onchange=function(){i._setBrightness(this.value)},this.brightnessRange.oninput=function(){i._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerHTML="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerHTML="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerHTML="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerHTML="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerHTML="cancel",this.cancelButton.onclick=this._hide.bind(this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerHTML="apply",this.applyButton.onclick=this._apply.bind(this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerHTML="save",this.saveButton.onclick=this._save.bind(this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerHTML="load last",this.loadButton.onclick=this._loadLast.bind(this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}},{key:"_bindHammer",value:function(){var e=this;this.drag={},this.pinch={},this.hammer=new a(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),d.onTouch(this.hammer,(function(t){e._moveSelector(t)})),this.hammer.on("tap",(function(t){e._moveSelector(t)})),this.hammer.on("panstart",(function(t){e._moveSelector(t)})),this.hammer.on("panmove",(function(t){e._moveSelector(t)})),this.hammer.on("panend",(function(t){e._moveSelector(t)}))}},{key:"_generateHueCircle",value:function(){if(!1===this.generated){var e=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)),e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var t=this.colorPickerCanvas.clientWidth,i=this.colorPickerCanvas.clientHeight;e.clearRect(0,0,t,i);var o=void 0,n=void 0,s=void 0,r=void 0;this.centerCoordinates={x:.5*t,y:.5*i},this.r=.49*t;var a=2*Math.PI/360,d=1/this.r,l=void 0;for(s=0;s<360;s++)for(r=0;r2&&void 0!==arguments[2]&&arguments[2],n=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(n),this._createK_matrix(n),this._createE_matrix();for(var s=.01,r=1,a=0,d=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),h=5,l=1e9,u=0,c=0,f=0,p=0,v=0;l>s&&ar&&v{const o=i(400);i(698);const n={nodes:{default:{borderWidth:2,shape:"ellipse",font:{color:"#FFFFFF"}},localPeer:{color:{border:"#1563FF",background:"#1563FF",highlight:{border:"#1563FF",background:"#1563FF"}}},remotePeer:{color:{border:"#00BC7F",background:"#00BC7F",highlight:{border:"#00BC7F",background:"#00BC7F"}}}},edges:{adaptive:{font:function(){return{strokeColor:"#FFFFFF",color:"#000000"}}},default:{dashes:!0,width:2,chosen:!1},bluetooth:{color:{color:"#0074d9",opacity:1,highlight:"#0074d9"}},accesspoint:{color:{color:"#00BC7F",opacity:1,highlight:"#00BC7F"}},p2pwifi:{color:{color:"#F856B3",opacity:1,highlight:"#F856B3"}},websocket:{color:{color:"#D35400",opacity:1,highlight:"#D35400"}},hydra:{color:{color:"#5F43E9",opacity:1,highlight:"#5F43E9"}}}},s=(e,t)=>{const i=e.getIds(),o=t.map((e=>e.id)),n=i.filter((e=>!o.includes(e)));e.remove(n),e.update(t)};function r(e){return e.reduce(((e,t)=>e+("0"+t.toString(16)).slice(-2)),"")}e.exports={updateNetwork:e=>{const t=(()=>{const e=window.document.getElementById("presenceNetwork");if(null==window.presence){const t={nodes:new o.DataSet,edges:new o.DataSet,network:null},i={nodes:t.nodes,edges:t.edges},s={autoResize:!0,height:"100%",width:"100%",interaction:{dragNodes:!0,dragView:!0,selectable:!1},physics:{enabled:!0,solver:"barnesHut",barnesHut:{gravitationalConstant:-2e3,centralGravity:.5,springLength:95,springConstant:.02,damping:1,avoidOverlap:1}},nodes:n.nodes.default,edges:n.edges.default};t.network=new o.Network(e,i,s),window.presence=t}return window.presence})();let i=JSON.parse((a=e,decodeURIComponent(escape(window.atob(a)))));var a;let d=i.remotePeers.concat([i.localPeer]),h=function(e){let t={};for(const i of e)t[i.id]=i;return Object.values(t)}(d.map((e=>e.connections)).flat()),l=r(i.localPeer.peerKey),u=d.map((e=>{let t=r(e.peerKey),i=t===l,o=i?n.nodes.localPeer:n.nodes.remotePeer;return e.color=o.color,e.label=i?"Me":e.deviceName,e.id=t,e})),c=h.map((e=>{let t=n.edges[e.connectionType.toLowerCase()];return e.color=t.color,e.font=n.edges.adaptive.font(),e.from=r(e.peer1),e.to=r(e.peer2),e}));if(d.find((e=>r(e.peerKey)===l)).isConnectedToDittoCloud){let e={id:"DittoCloud",color:n.nodes.remotePeer.color,label:"Ditto Cloud"},t={color:n.edges.hydra.color,font:n.edges.adaptive.font(),from:l,to:"DittoCloud",id:`${r(i.localPeer.peerKey)}<->DittoCloud`};u.push(e),c.push(t)}s(t.nodes,u),s(t.edges,c)}}}},t={};function i(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o].call(s.exports,s,s.exports,i),s.exports}i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o=i(138);Presence=o})(); \ No newline at end of file diff --git a/Sources/DittoPresenceViewer/Resources/main.js.LICENSE.txt b/Sources/DittoPresenceViewer/Resources/main.js.LICENSE.txt deleted file mode 100644 index e8f0da3..0000000 --- a/Sources/DittoPresenceViewer/Resources/main.js.LICENSE.txt +++ /dev/null @@ -1,30 +0,0 @@ -/*! Hammer.JS - v2.0.7 - 2016-04-22 - * http://hammerjs.github.io/ - * - * Copyright (c) 2016 Jorik Tangelder; - * Licensed under the MIT license */ - -/** - * vis.js - * https://github.com/almende/vis - * - * A dynamic, browser-based visualization library. - * - * @version 4.24.11 - * @date 2019-10-24 - * - * @license - * Copyright (C) 2011-2017 Almende B.V, http://almende.com - * - * Vis.js is dual licensed under both - * - * * The Apache 2.0 License - * http://www.apache.org/licenses/LICENSE-2.0 - * - * and - * - * * The MIT License - * http://opensource.org/licenses/MIT - * - * Vis.js may be distributed under either license. - */ diff --git a/Sources/DittoPresenceViewer/VisJSWebView.swift b/Sources/DittoPresenceViewer/VisJSWebView.swift deleted file mode 100644 index 0eba809..0000000 --- a/Sources/DittoPresenceViewer/VisJSWebView.swift +++ /dev/null @@ -1,75 +0,0 @@ -// -// Copyright © 2020 DittoLive Incorporated. All rights reserved. -// - -import Foundation - -#if canImport(WebKit) -import WebKit -#endif - -/** - `VisJSWebView` is a simple `UIView` subclass containing a `WKWebView` which it - manages. The `VisJSWebView` ensures that any attempt to execute javascript will - be delayed until the initial page load is complete. - */ -class VisJSWebView: JSWebView { - - // MARK: - Initialization - - override init(frame: CGRect) { - super.init(frame: frame) - setup() - } - - required init?(coder: NSCoder) { - super.init(coder: coder) - setup() - } - - private func setup() { - let bundle = Bundle.module - let webDistDirURL = bundle.bundleURL.appendingPathComponent("dist") - let htmlURL = bundle.url(forResource: "index", withExtension: "html")! - let htmlString = try! String(contentsOf: htmlURL, encoding: .utf8) -#if canImport(WebKit) - webView.loadHTMLString(htmlString, baseURL: webDistDirURL) -#endif - } - - // MARK: - Functions - - /** - Updates the vis.js network visualization. If the page is not yet loaded, the javascript - will be enqueued and executed as soon as the page load is complete. - - - Parameters: - - json: A V2 presence payload as JSON string containing all nodes - and edges (not just the updated nodes/edges). - - completionHandler: An optional completion handler to be invoked when the update - completes. The completion handler always runs on the main thread. - */ - func updateNetwork(json: String, completionHandler: (() -> Void)? = nil) { - // To avoid characters in our JSON string being interpreted as JS, we pass our JSON - // as base64 encoded string and decode on the other side. - let base64JSON = json.data(using: .utf8)!.base64EncodedString() - - enqueueInvocation(javascript: "Presence.updateNetwork('\(base64JSON)');", - coalescingIdentifier: "updateNetwork") { result in - if case let .failure(error) = result { - print("VisJSWebView: failed to update network: %@", error) - } - - // In release mode, we should never fail (we control all inputs and outputs an - // all resources are offline). An assertion crash should have triggered during - // unit tests or development testing if our JS was incorrectly packaged or if - // there was drift between the JS code and the JS function names/signatures - // hardcoded in Swift. - // - // We log to the console to help catch errors during active development, but - // otherwise always report success to our caller. - completionHandler?() - } - } - -}