diff --git a/CLAUDE.md b/CLAUDE.md index 93fad92..e56be56 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -413,6 +413,9 @@ internal/ ├── config/ # YAML configuration loading ├── models/ # Shared data structures across all apps ├── notifications/ # Notification system (webhooks, ntfy, in-app) +├── plugins/ # Plugin system and built-in plugins +│ ├── builtin/npm/ # NPM (Nginx Proxy Manager) enrichment plugin +│ └── builtin/graph/ # Graph visualizer plugin with frontend ├── scanner/ # Multi-protocol Docker scanning (unix/agent/tcp/ssh) ├── storage/ # SQLite operations for census server ├── telemetry/ # Telemetry collection, scheduling, submission @@ -428,6 +431,58 @@ web/ # Static files for census server UI web/analytics/ # Static files for telemetry dashboard ``` +### Plugin Architecture + +Container Census uses a built-in plugin system to extend functionality. Plugins are compiled directly into the server binary and share the same process space. + +**Built-in Plugins:** +- **NPM Plugin** (`internal/plugins/builtin/npm`): Enriches Nginx Proxy Manager containers with host/domain information +- **Graph Plugin** (`internal/plugins/builtin/graph`): Provides interactive network graph visualization of container relationships + +**Plugin Interface** (`internal/plugins/plugins.go`): +```go +type Plugin interface { + Info() PluginInfo // Plugin metadata + Init(ctx, deps) error // Initialize plugin + Start(ctx) error // Start plugin services + Stop(ctx) error // Stop plugin services + Routes() []Route // HTTP routes to mount under /api/p/{plugin-id}/ + Tab() *TabDefinition // UI tab configuration + Badges() []BadgeProvider // Container badge providers + ContainerEnricher() ContainerEnricher // Container data enrichment + Settings() *SettingsDefinition // Plugin settings schema + NotificationChannelFactory() ChannelFactory // Notification channel factory +} +``` + +**Plugin Lifecycle:** +1. **Registration**: Plugins register in `cmd/server/main.go` via `pluginManager.RegisterBuiltIn()` +2. **Discovery**: Manager loads all registered plugins on startup +3. **Initialization**: Each plugin receives dependencies (DB, logger, scanner, etc.) +4. **Route Mounting**: HTTP routes mounted under `/api/p/{plugin-id}/` +5. **Frontend Loading**: UI loads plugin bundles from `/api/p/{plugin-id}/bundle.js` + +**Frontend Integration:** +- Plugins can provide static assets (JavaScript bundles, CSS) via HTTP routes +- Frontend bundles use `//go:embed` to embed compiled assets at build time +- Example: Graph plugin uses webpack to build `frontend/bundle.js` (embedded in binary) +- Plugins expose global init functions (e.g., `window.initGraphVisualizer()`) +- UI dynamically loads and initializes plugins based on tab configuration + +**Build Process:** +- Graph plugin frontend is built during `./scripts/server-build.sh` +- Webpack bundles source code from `internal/plugins/builtin/graph/frontend/src/` +- Compiled bundle.js embedded via `//go:embed frontend/bundle.js` +- No runtime compilation - all assets compiled into Go binary + +**Implementation Files:** +- `internal/plugins/plugins.go` - Plugin interface and types +- `internal/plugins/manager.go` - Plugin lifecycle management +- `internal/plugins/builtin/npm/` - NPM plugin implementation +- `internal/plugins/builtin/graph/` - Graph plugin implementation +- `internal/api/plugins.go` - Plugin API endpoints +- `cmd/server/main.go` - Plugin registration + ## Configuration ### Census Server diff --git a/agent b/agent new file mode 100755 index 0000000..f8020e5 Binary files /dev/null and b/agent differ diff --git a/cmd/server/main.go b/cmd/server/main.go index 87ab6e9..3f59133 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "log" - "net" "net/http" "os" "os/signal" @@ -14,8 +13,6 @@ import ( "syscall" "time" - "google.golang.org/grpc" - "github.com/container-census/container-census/internal/api" "github.com/container-census/container-census/internal/auth" "github.com/container-census/container-census/internal/migration" @@ -24,7 +21,6 @@ import ( "github.com/container-census/container-census/internal/plugins" "github.com/container-census/container-census/internal/plugins/builtin/graph" "github.com/container-census/container-census/internal/plugins/builtin/npm" - pb "github.com/container-census/container-census/internal/plugins/proto" "github.com/container-census/container-census/internal/registry" "github.com/container-census/container-census/internal/scanner" "github.com/container-census/container-census/internal/storage" @@ -258,25 +254,11 @@ func main() { if err := pluginManager.LoadBuiltInPlugins(context.Background()); err != nil { log.Printf("Warning: Failed to load built-in plugins: %v", err) } - if err := pluginManager.LoadExternalPlugins(context.Background()); err != nil { - log.Printf("Warning: Failed to load external plugins: %v", err) - } if err := pluginManager.Start(context.Background()); err != nil { log.Printf("Warning: Failed to start plugins: %v", err) } log.Println("Plugin manager initialized") - // Start Census API gRPC server for plugin callbacks - censusAPIAddr := os.Getenv("CENSUS_API_ADDRESS") - if censusAPIAddr == "" { - censusAPIAddr = "localhost:50052" - } - go func() { - if err := startCensusAPIServer(censusAPIAddr, pluginManager); err != nil { - log.Printf("Warning: Failed to start Census API gRPC server: %v", err) - } - }() - server := &http.Server{ Addr: addr, Handler: apiServer.Router(), @@ -958,27 +940,6 @@ func runImageUpdateChecker(ctx context.Context, db *storage.DB, scan *scanner.Sc } } -// startCensusAPIServer starts the gRPC server for plugin callbacks -func startCensusAPIServer(addr string, pluginManager *plugins.Manager) error { - lis, err := net.Listen("tcp", addr) - if err != nil { - return fmt.Errorf("failed to listen on %s: %w", addr, err) - } - - grpcServer := grpc.NewServer() - censusAPIServer := pluginManager.GetCensusAPIServer() - - pb.RegisterCensusAPIServer(grpcServer, censusAPIServer) - - log.Printf("Census API gRPC server listening on %s", addr) - - if err := grpcServer.Serve(lis); err != nil { - return fmt.Errorf("failed to serve: %w", err) - } - - return nil -} - // containerProviderImpl implements plugins.ContainerProvider type containerProviderImpl struct { db *storage.DB diff --git a/go.mod b/go.mod index 0460ecd..d4aab69 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/docker/docker v28.3.3+incompatible github.com/google/uuid v1.6.0 github.com/gorilla/mux v1.8.1 + github.com/gorilla/sessions v1.4.0 github.com/lib/pq v1.10.9 github.com/mattn/go-sqlite3 v1.14.24 gopkg.in/yaml.v3 v3.0.1 @@ -25,7 +26,6 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/gorilla/securecookie v1.1.2 // indirect - github.com/gorilla/sessions v1.4.0 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/moby/sys/atomicwriter v0.1.0 // indirect github.com/moby/term v0.5.2 // indirect @@ -34,7 +34,6 @@ require ( github.com/opencontainers/image-spec v1.1.1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect go.opentelemetry.io/otel v1.38.0 // indirect @@ -43,13 +42,9 @@ require ( go.opentelemetry.io/otel/sdk v1.38.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect go.opentelemetry.io/otel/trace v1.38.0 // indirect - golang.org/x/net v0.46.1-0.20251013234738-63d1a5100f82 // indirect golang.org/x/sys v0.37.0 // indirect - golang.org/x/text v0.30.0 // indirect golang.org/x/time v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8 // indirect google.golang.org/grpc v1.77.0 // indirect - google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.0 // indirect google.golang.org/protobuf v1.36.10 // indirect gotest.tools/v3 v3.5.2 // indirect ) diff --git a/go.sum b/go.sum index 105e374..5610934 100644 --- a/go.sum +++ b/go.sum @@ -31,6 +31,8 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= @@ -77,8 +79,6 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= -go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 h1:Hf9xI/XLML9ElpiHVDNwvqI0hIFlzV8dgIr35kV1kRU= @@ -108,8 +108,6 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I= -golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= golang.org/x/net v0.46.1-0.20251013234738-63d1a5100f82 h1:6/3JGEh1C88g7m+qzzTbl3A0FtsLguXieqofVLU/JAo= golang.org/x/net v0.46.1-0.20251013234738-63d1a5100f82/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -118,14 +116,10 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= -golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= -golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k= golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM= golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= @@ -138,21 +132,12 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 h1:BIRfGDEjiHRrk0QKZe3Xv2ieMhtgRGeLcZQ0mIVn4EY= -google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5/go.mod h1:j3QtIyytwqGr1JUDtYXwtMXWPKsEa5LtzIFN1Wn5WvE= google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8 h1:mepRgnBZa07I4TRuomDE4sTIYieg/osKmzIf4USdWS4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 h1:eaY8u2EuxbRv7c3NiGK0/NedzVsCcV6hDuU5qPX5EGE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5/go.mod h1:M4/wBTSeyLxupu3W3tJtOgB14jILAS/XWPSSa3TAlJc= +google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8/go.mod h1:fDMmzKV90WSg1NbozdqrE64fkuTv6mlq2zxo9ad+3yo= google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8 h1:M1rk8KBnUsBDg1oPGHNCxG4vc1f49epmTO7xscSajMk= google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= -google.golang.org/grpc v1.75.0 h1:+TW+dqTd2Biwe6KKfhE5JpiYIBWq865PhKGSXiivqt4= -google.golang.org/grpc v1.75.0/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= google.golang.org/grpc v1.77.0 h1:wVVY6/8cGA6vvffn+wWK5ToddbgdU3d8MNENr4evgXM= google.golang.org/grpc v1.77.0/go.mod h1:z0BY1iVj0q8E1uSQCjL9cppRj+gnZjzDnzV0dHhrNig= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.0 h1:6Al3kEFFP9VJhRz3DID6quisgPnTeZVr4lep9kkxdPA= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.0/go.mod h1:QLvsjh0OIR0TYBeiu2bkWGTJBUNQ64st52iWj/yA93I= -google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= -google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/api/plugins.go b/internal/api/plugins.go index 2df2d6a..272e3e3 100644 --- a/internal/api/plugins.go +++ b/internal/api/plugins.go @@ -31,13 +31,6 @@ func (s *Server) setupPluginRoutes(api *mux.Router) { api.HandleFunc("/plugins/{id}/disable", s.handleDisablePlugin).Methods("PUT") api.HandleFunc("/plugins/{id}/settings", s.handleGetPluginSettings).Methods("GET") api.HandleFunc("/plugins/{id}/settings", s.handleUpdatePluginSettings).Methods("PUT") - - // External plugin installation endpoints - api.HandleFunc("/plugins/install", s.handleInstallPlugin).Methods("POST") - api.HandleFunc("/plugins/{id}/update", s.handleUpdatePlugin).Methods("POST") - api.HandleFunc("/plugins/{id}/uninstall", s.handleUninstallPlugin).Methods("DELETE") - api.HandleFunc("/plugins/{id}/logs", s.handleGetPluginLogs).Methods("GET") - api.HandleFunc("/plugins/{id}/status", s.handleGetPluginStatus).Methods("GET") } // handleGetPlugins returns all registered plugins @@ -299,121 +292,3 @@ func (s *Server) handleUpdatePluginSettings(w http.ResponseWriter, r *http.Reque "message": "Settings updated", }) } - -// handleInstallPlugin installs a new external plugin from GitHub URL -func (s *Server) handleInstallPlugin(w http.ResponseWriter, r *http.Request) { - var req struct { - RepositoryURL string `json:"repository_url"` - Version string `json:"version"` // optional, defaults to "latest" - } - - if err := json.NewDecoder(r.Body).Decode(&req); err != nil { - respondError(w, http.StatusBadRequest, "Invalid request body") - return - } - - if req.RepositoryURL == "" { - respondError(w, http.StatusBadRequest, "repository_url is required") - return - } - - if s.pluginManager == nil { - respondError(w, http.StatusInternalServerError, "Plugin manager not initialized") - return - } - - // Install plugin using the plugin manager - if err := s.pluginManager.InstallExternalPlugin(r.Context(), req.RepositoryURL, req.Version); err != nil { - respondError(w, http.StatusInternalServerError, err.Error()) - return - } - - respondJSON(w, http.StatusOK, map[string]interface{}{ - "success": true, - "message": "Plugin installation started", - }) -} - -// handleUpdatePlugin updates an external plugin to the latest version -func (s *Server) handleUpdatePlugin(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - pluginID := vars["id"] - - if s.pluginManager == nil { - respondError(w, http.StatusInternalServerError, "Plugin manager not initialized") - return - } - - if err := s.pluginManager.UpdateExternalPlugin(r.Context(), pluginID); err != nil { - respondError(w, http.StatusInternalServerError, err.Error()) - return - } - - respondJSON(w, http.StatusOK, map[string]interface{}{ - "success": true, - "message": "Plugin update started", - }) -} - -// handleUninstallPlugin removes an external plugin -func (s *Server) handleUninstallPlugin(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - pluginID := vars["id"] - - if s.pluginManager == nil { - respondError(w, http.StatusInternalServerError, "Plugin manager not initialized") - return - } - - if err := s.pluginManager.UninstallExternalPlugin(pluginID); err != nil { - respondError(w, http.StatusInternalServerError, err.Error()) - return - } - - respondJSON(w, http.StatusOK, map[string]interface{}{ - "success": true, - "message": "Plugin uninstalled successfully", - }) -} - -// handleGetPluginLogs returns recent log output from an external plugin -func (s *Server) handleGetPluginLogs(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - pluginID := vars["id"] - - if s.pluginManager == nil { - respondError(w, http.StatusInternalServerError, "Plugin manager not initialized") - return - } - - stdout, stderr, err := s.pluginManager.GetExternalPluginLogs(pluginID) - if err != nil { - respondError(w, http.StatusNotFound, err.Error()) - return - } - - respondJSON(w, http.StatusOK, map[string]interface{}{ - "plugin_id": pluginID, - "stdout": stdout, - "stderr": stderr, - }) -} - -// handleGetPluginStatus returns the runtime status of an external plugin -func (s *Server) handleGetPluginStatus(w http.ResponseWriter, r *http.Request) { - vars := mux.Vars(r) - pluginID := vars["id"] - - if s.pluginManager == nil { - respondError(w, http.StatusInternalServerError, "Plugin manager not initialized") - return - } - - status, err := s.pluginManager.GetExternalPluginStatus(pluginID) - if err != nil { - respondError(w, http.StatusNotFound, err.Error()) - return - } - - respondJSON(w, http.StatusOK, status) -} diff --git a/internal/plugins/builtin/graph/frontend/bundle.js b/internal/plugins/builtin/graph/frontend/bundle.js index fcc5fa0..ad7111d 100644 --- a/internal/plugins/builtin/graph/frontend/bundle.js +++ b/internal/plugins/builtin/graph/frontend/bundle.js @@ -1,2 +1,2 @@ /*! For license information please see bundle.js.LICENSE.txt */ -(()=>{var e={2:(e,t,n)=>{var r=n(2199),a=n(4664),i=n(5950);e.exports=function(e){return r(e,i,a)}},79:(e,t,n)=>{var r=n(3702),a=n(80),i=n(4739),o=n(8655),s=n(1175);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var r=n(6025),a=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0||(n==t.length-1?t.pop():a.call(t,n,1),--this.size,0))}},104:(e,t,n)=>{var r=n(3661);function a(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],i=n.cache;if(i.has(a))return i.get(a);var o=e.apply(this,r);return n.cache=i.set(a,o)||i,o};return n.cache=new(a.Cache||r),n}a.Cache=r,e.exports=a},117:(e,t,n)=>{var r;try{r={clone:n(2629),constant:n(7334),each:n(6135),filter:n(7612),has:n(1448),isArray:n(6449),isEmpty:n(2193),isFunction:n(1882),isUndefined:n(2216),keys:n(5950),map:n(5378),reduce:n(860),size:n(7091),transform:n(9752),union:n(299),values:n(5880)}}catch(e){}r||(r=window._),e.exports=r},124:(e,t,n)=>{var r=n(9325);e.exports=function(){return r.Date.now()}},135:(e,t,n)=>{var r=n(6857),a=n(3988);function i(e,t,n,r,i,o){var s={width:0,height:0,rank:o,borderType:t},u=i[t][o-1],l=a.addDummyNode(e,"border",s,n);i[t][o]=l,e.setParent(l,r),u&&e.setEdge(u,l,{weight:1})}e.exports=function(e){r.forEach(e.children(),function t(n){var a=e.children(n),o=e.node(n);if(a.length&&r.forEach(a,t),r.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var s=o.minRank,u=o.maxRank+1;s{e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},270:(e,t,n)=>{var r=n(7068),a=n(346);e.exports=function e(t,n,i,o,s){return t===n||(null==t||null==n||!a(t)&&!a(n)?t!=t&&n!=n:r(t,n,i,o,e,s))}},289:(e,t,n)=>{var r=n(2651);e.exports=function(e){return r(this,e).get(e)}},294:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},299:(e,t,n)=>{var r=n(3120),a=n(9302),i=n(5765),o=n(3693),s=a(function(e){return i(r(e,1,o,!0))});e.exports=s},317:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}},346:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},361:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,n){var r=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&t.test(e))&&e>-1&&e%1==0&&e{"use strict";n.d(t,{A:()=>s});var r=n(1601),a=n.n(r),i=n(6314),o=n.n(i)()(a());o.push([e.id,'/**\n * Container Census - Graph Visualizer Plugin Styles\n */\n\n.graph-visualizer {\n display: flex;\n flex-direction: column;\n height: calc(100vh - 120px);\n background: #f8f9fa;\n border-radius: 8px;\n overflow: hidden;\n}\n\n.graph-toolbar {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 15px 20px;\n background: white;\n border-bottom: 1px solid #dee2e6;\n}\n\n.graph-toolbar-left {\n display: flex;\n align-items: center;\n gap: 15px;\n}\n\n.graph-toolbar-right {\n display: flex;\n align-items: center;\n gap: 15px;\n}\n\n.graph-filter {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 14px;\n cursor: pointer;\n user-select: none;\n}\n\n.graph-filter input[type="checkbox"] {\n cursor: pointer;\n width: 16px;\n height: 16px;\n}\n\n.graph-filter span {\n color: #495057;\n}\n\n.graph-layout-select {\n padding: 6px 12px;\n border: 1px solid #ced4da;\n border-radius: 4px;\n font-size: 14px;\n background: white;\n color: #495057;\n cursor: pointer;\n outline: none;\n}\n\n.graph-layout-select:focus {\n border-color: #3b82f6;\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n}\n\n.graph-btn {\n padding: 8px 16px;\n border: none;\n border-radius: 4px;\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.2s ease;\n outline: none;\n}\n\n.graph-btn:hover {\n transform: translateY(-1px);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n}\n\n.graph-btn:active {\n transform: translateY(0);\n}\n\n.graph-btn-primary {\n background: #3b82f6;\n color: white;\n}\n\n.graph-btn-primary:hover {\n background: #2563eb;\n}\n\n.graph-btn-secondary {\n background: #6c757d;\n color: white;\n}\n\n.graph-btn-secondary:hover {\n background: #5a6268;\n}\n\n.graph-container {\n flex: 1;\n background: white;\n position: relative;\n margin: 15px;\n border-radius: 8px;\n border: 1px solid #dee2e6;\n overflow: hidden;\n}\n\n.graph-legend {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 30px;\n padding: 12px 20px;\n background: white;\n border-top: 1px solid #dee2e6;\n}\n\n.legend-item {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 13px;\n color: #495057;\n}\n\n.legend-box {\n width: 20px;\n height: 20px;\n border-radius: 4px;\n border: 2px solid white;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);\n}\n\n/* Responsive design */\n@media (max-width: 768px) {\n .graph-toolbar {\n flex-direction: column;\n align-items: flex-start;\n gap: 12px;\n }\n\n .graph-toolbar-right {\n flex-wrap: wrap;\n width: 100%;\n }\n\n .graph-legend {\n flex-wrap: wrap;\n gap: 15px;\n }\n}\n\n/* Loading state */\n.graph-loading {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n font-size: 16px;\n color: #6c757d;\n}\n\n/* Error state */\n.graph-error {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n color: #dc3545;\n text-align: center;\n padding: 20px;\n}\n',""]);const s=o},392:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},426:e=>{var t=Object.prototype.hasOwnProperty;e.exports=function(e,n){return null!=e&&t.call(e,n)}},498:(e,t,n)=>{var r=n(9888);e.exports=function(e){try{r(e)}catch(e){if(e instanceof r.CycleException)return!1;throw e}return!0}},514:(e,t,n)=>{var r=n(4932);e.exports=function(e,t){return r(t,function(t){return e[t]})}},540:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},583:(e,t,n)=>{var r=n(7237),a=n(7255),i=n(8586),o=n(7797);e.exports=function(e){return i(e)?r(o(e)):a(e)}},631:(e,t,n)=>{var r=n(8077),a=n(9326);e.exports=function(e,t){return null!=e&&a(e,t,r)}},641:(e,t,n)=>{var r=n(6649),a=n(5950);e.exports=function(e,t){return e&&r(e,t,a)}},659:(e,t,n)=>{var r=n(1873),a=Object.prototype,i=a.hasOwnProperty,o=a.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var a=o.call(e);return r&&(t?e[s]=n:delete e[s]),a}},689:(e,t,n)=>{var r=n(2),a=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,i,o,s){var u=1&n,l=r(e),c=l.length;if(c!=r(t).length&&!u)return!1;for(var d=c;d--;){var h=l[d];if(!(u?h in t:a.call(t,h)))return!1}var f=s.get(e),p=s.get(t);if(f&&p)return f==t&&p==e;var v=!0;s.set(e,t),s.set(t,e);for(var g=u;++d{var r=n(8096),a=n(2428),i=n(6449),o=n(3656),s=n(361),u=n(7167),l=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=i(e),c=!n&&a(e),d=!n&&!c&&o(e),h=!n&&!c&&!d&&u(e),f=n||c||d||h,p=f?r(e.length,String):[],v=p.length;for(var g in e)!t&&!l.call(e,g)||f&&("length"==g||d&&("offset"==g||"parent"==g)||h&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||s(g,v))||p.push(g);return p}},756:(e,t,n)=>{var r=n(3805);e.exports=function(e){return e==e&&!r(e)}},776:(e,t,n)=>{var r=n(756),a=n(5950);e.exports=function(e){for(var t=a(e),n=t.length;n--;){var i=t[n],o=e[i];t[n]=[i,o,r(o)]}return t}},860:(e,t,n)=>{var r=n(882),a=n(909),i=n(5389),o=n(5558),s=n(6449);e.exports=function(e,t,n){var u=s(e)?r:o,l=arguments.length<3;return u(e,i(t,4),n,l,a)}},882:e=>{e.exports=function(e,t,n,r){var a=-1,i=null==e?0:e.length;for(r&&i&&(n=e[++a]);++a{var r=n(641),a=n(8329)(r);e.exports=a},938:e=>{e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},945:(e,t,n)=>{var r=n(79),a=n(8223),i=n(3661);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var o=n.__data__;if(!a||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(o)}return n.set(e,t),this.size=n.size,this}},999:(e,t,n)=>{var r=n(9302),a=n(6800);e.exports=function(e){return r(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,s&&a(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++r{e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},1042:(e,t,n)=>{var r=n(6110)(Object,"create");e.exports=r},1045:(e,t,n)=>{var r=n(9276);e.exports=function(e,t){return r(e,t,"post")}},1113:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},1166:(e,t,n)=>{e.exports={Graph:n(6454),version:n(4458)}},1175:(e,t,n)=>{var r=n(6025);e.exports=function(e,t){var n=this.__data__,a=r(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this}},1234:e=>{e.exports=function(e,t,n){for(var r=-1,a=e.length,i=t.length,o={};++r{var r=n(2552),a=n(8879),i=n(346),o=Function.prototype,s=Object.prototype,u=o.toString,l=s.hasOwnProperty,c=u.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=a(e);if(null===t)return!0;var n=l.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&u.call(n)==c}},1380:e=>{e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},1420:(e,t,n)=>{var r=n(79);e.exports=function(){this.__data__=new r,this.size=0}},1448:(e,t,n)=>{var r=n(426),a=n(9326);e.exports=function(e,t){return null!=e&&a(e,t,r)}},1453:(e,t,n)=>{"use strict";var r=n(6857),a=n(8918),i=n(6639),o=n(4520),s=n(7860),u=n(4384),l=n(8191).Graph,c=n(3988);function d(e,t,n){return r.map(t,function(t){return s(e,t,n)})}function h(e,t){var n=new l;r.forEach(e,function(e){var a=e.graph().root,i=o(e,a,n,t);r.forEach(i.vs,function(t,n){e.node(t).order=n}),u(e,n,i.vs)})}function f(e,t){r.forEach(t,function(t){r.forEach(t,function(t,n){e.node(t).order=n})})}e.exports=function(e){var t=c.maxRank(e),n=d(e,r.range(1,t+1),"inEdges"),o=d(e,r.range(t-1,-1,-1),"outEdges"),s=a(e);f(e,s);for(var u,l=Number.POSITIVE_INFINITY,p=0,v=0;v<4;++p,++v){h(p%2?n:o,p%4>=2),s=c.buildLayerMatrix(e);var g=i(e,s);g{e.exports=function(e){return this.__data__.has(e)}},1489:(e,t,n)=>{var r=n(7400);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},1549:(e,t,n)=>{var r=n(2032),a=n(3862),i=n(6721),o=n(2749),s=n(5749);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{"use strict";e.exports=function(e){return e[1]}},1667:(e,t,n)=>{e.exports={components:n(3619),dijkstra:n(8905),dijkstraAll:n(4919),findCycles:n(6678),floydWarshall:n(3590),isAcyclic:n(498),postorder:n(1045),preorder:n(6016),prim:n(4423),tarjan:n(6291),topsort:n(9888)}},1684:(e,t,n)=>{var r=n(3599),a=n(6176),i=n(3488);e.exports=function(e){return e&&e.length?r(e,i,a):void 0}},1737:(e,t,n)=>{var r=n(117);function a(){this._arr=[],this._keyIndices={}}e.exports=a,a.prototype.size=function(){return this._arr.length},a.prototype.keys=function(){return this._arr.map(function(e){return e.key})},a.prototype.has=function(e){return r.has(this._keyIndices,e)},a.prototype.priority=function(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority},a.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},a.prototype.add=function(e,t){var n=this._keyIndices;if(e=String(e),!r.has(n,e)){var a=this._arr,i=a.length;return n[e]=i,a.push({key:e,priority:t}),this._decrease(i),!0}return!1},a.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},a.prototype.decrease=function(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[n].priority+" New: "+t);this._arr[n].priority=t,this._decrease(n)},a.prototype._heapify=function(e){var t=this._arr,n=2*e,r=n+1,a=e;n>1].priority{var r=n(6449),a=n(8586),i=n(1802),o=n(3222);e.exports=function(e,t){return r(e)?e:a(e,t)?[e]:i(o(e))}},1791:(e,t,n)=>{var r=n(6547),a=n(3360);e.exports=function(e,t,n,i){var o=!n;n||(n={});for(var s=-1,u=t.length;++s{var r=n(7217),a=n(270);e.exports=function(e,t,n,i){var o=n.length,s=o,u=!i;if(null==e)return!s;for(e=Object(e);o--;){var l=n[o];if(u&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++o{var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},1802:(e,t,n)=>{var r=n(2224),a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,o=r(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(a,function(e,n,r,a){t.push(r?a.replace(i,"$1"):n||e)}),t});e.exports=o},1811:e=>{var t=Date.now;e.exports=function(e){var n=0,r=0;return function(){var a=t(),i=16-(a-r);if(r=a,i>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},1873:(e,t,n)=>{var r=n(9325).Symbol;e.exports=r},1882:(e,t,n)=>{var r=n(2552),a=n(3805);e.exports=function(e){if(!a(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},1961:(e,t,n)=>{var r=n(9653);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}},1986:(e,t,n)=>{var r=n(1873),a=n(7828),i=n(5288),o=n(5911),s=n(317),u=n(4247),l=r?r.prototype:void 0,c=l?l.valueOf:void 0;e.exports=function(e,t,n,r,l,d,h){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new a(e),new a(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var f=s;case"[object Set]":var p=1&r;if(f||(f=u),e.size!=t.size&&!p)return!1;var v=h.get(e);if(v)return v==t;r|=2,h.set(e,t);var g=o(f(e),f(t),r,l,d,h);return h.delete(e),g;case"[object Symbol]":if(c)return c.call(e)==c.call(t)}return!1}},1993:(e,t,n)=>{var r=n(9811),a=n(9698),i=n(7927);e.exports=function(e){return a(e)?i(e):r(e)}},2006:(e,t,n)=>{var r=n(5389),a=n(4894),i=n(5950);e.exports=function(e){return function(t,n,o){var s=Object(t);if(!a(t)){var u=r(n,3);t=i(t),n=function(e){return u(s[e],e,s)}}var l=e(t,n,o);return l>-1?s[u?t[l]:l]:void 0}}},2031:(e,t,n)=>{var r=n(6857),a=n(8191).Graph,i=n(9859);e.exports=function(e,t){if(e.nodeCount()<=1)return[];var n=function(e,t){var n=new a,o=0,s=0;r.forEach(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),r.forEach(e.edges(),function(e){var r=n.edge(e.v,e.w)||0,a=t(e),i=r+a;n.setEdge(e.v,e.w,i),s=Math.max(s,n.node(e.v).out+=a),o=Math.max(o,n.node(e.w).in+=a)});var l=r.range(s+o+3).map(function(){return new i}),c=o+1;return r.forEach(n.nodes(),function(e){u(l,c,n.node(e))}),{graph:n,buckets:l,zeroIdx:c}}(e,t||o),l=function(e,t,n){for(var r,a=[],i=t[t.length-1],o=t[0];e.nodeCount();){for(;r=o.dequeue();)s(e,t,n,r);for(;r=i.dequeue();)s(e,t,n,r);if(e.nodeCount())for(var u=t.length-2;u>0;--u)if(r=t[u].dequeue()){a=a.concat(s(e,t,n,r,!0));break}}return a}(n.graph,n.buckets,n.zeroIdx);return r.flatten(r.map(l,function(t){return e.outEdges(t.v,t.w)}),!0)};var o=r.constant(1);function s(e,t,n,a,i){var o=i?[]:void 0;return r.forEach(e.inEdges(a.v),function(r){var a=e.edge(r),s=e.node(r.v);i&&o.push({v:r.v,w:r.w}),s.out-=a,u(t,n,s)}),r.forEach(e.outEdges(a.v),function(r){var a=e.edge(r),i=r.w,o=e.node(i);o.in-=a,u(t,n,o)}),e.removeNode(a.v),o}function u(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}},2032:(e,t,n)=>{var r=n(1042);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},2193:(e,t,n)=>{var r=n(8984),a=n(5861),i=n(2428),o=n(6449),s=n(4894),u=n(3656),l=n(5527),c=n(7167),d=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(s(e)&&(o(e)||"string"==typeof e||"function"==typeof e.splice||u(e)||c(e)||i(e)))return!e.length;var t=a(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(l(e))return!r(e).length;for(var n in e)if(d.call(e,n))return!1;return!0}},2199:(e,t,n)=>{var r=n(4528),a=n(6449);e.exports=function(e,t,n){var i=t(e);return a(e)?i:r(i,n(e))}},2216:e=>{e.exports=function(e){return void 0===e}},2224:(e,t,n)=>{var r=n(104);e.exports=function(e){var t=r(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}},2271:(e,t,n)=>{var r=n(1791),a=n(4664);e.exports=function(e,t){return r(e,a(e),t)}},2420:(e,t,n)=>{var r=n(6649),a=n(4066),i=n(7241);e.exports=function(e,t){return null==e?e:r(e,a(t),i)}},2428:(e,t,n)=>{var r=n(7534),a=n(346),i=Object.prototype,o=i.hasOwnProperty,s=i.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(e){return a(e)&&o.call(e,"callee")&&!s.call(e,"callee")};e.exports=u},2523:e=>{e.exports=function(e,t,n,r){for(var a=e.length,i=n+(r?1:-1);r?i--:++i{var r=n(1873),a=n(659),i=n(9350),o=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?a(e):i(e)}},2629:(e,t,n)=>{var r=n(9999);e.exports=function(e){return r(e,4)}},2651:(e,t,n)=>{var r=n(4218);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},2749:(e,t,n)=>{var r=n(1042),a=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:a.call(t,e)}},2804:(e,t,n)=>{var r=n(6110)(n(9325),"Promise");e.exports=r},2824:(e,t,n)=>{var r=n(7805),a=n(3290),i=n(1961),o=n(3007),s=n(5529),u=n(2428),l=n(6449),c=n(3693),d=n(3656),h=n(1882),f=n(3805),p=n(1331),v=n(7167),g=n(4974),y=n(9884);e.exports=function(e,t,n,m,b,x,w){var E=g(e,n),k=g(t,n),_=w.get(k);if(_)r(e,n,_);else{var C=x?x(E,k,n+"",e,t,w):void 0,T=void 0===C;if(T){var S=l(k),P=!S&&d(k),B=!S&&!P&&v(k);C=k,S||P||B?l(E)?C=E:c(E)?C=o(E):P?(T=!1,C=a(k,!0)):B?(T=!1,C=i(k,!0)):C=[]:p(k)||u(k)?(C=E,u(E)?C=y(E):f(E)&&!h(E)||(C=s(k))):T=!1}T&&(w.set(k,C),b(C,k,m,x,w),w.delete(k)),r(e,n,C)}}},2865:(e,t,n)=>{var r=n(9570),a=n(1811)(r);e.exports=a},2903:(e,t,n)=>{var r=n(3805),a=n(5527),i=n(181),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=a(e),n=[];for(var s in e)("constructor"!=s||!t&&o.call(e,s))&&n.push(s);return n}},2948:(e,t,n)=>{var r=n(6857);e.exports=function(e){var t=function(e){var t={},n=0;return r.forEach(e.children(),function a(i){var o=n;r.forEach(e.children(i),a),t[i]={low:o,lim:n++}}),t}(e);r.forEach(e.graph().dummyChains,function(n){for(var r=e.node(n),a=r.edgeObj,i=function(e,t,n,r){var a,i,o=[],s=[],u=Math.min(t[n].low,t[r].low),l=Math.max(t[n].lim,t[r].lim);a=n;do{a=e.parent(a),o.push(a)}while(a&&(t[a].low>u||l>t[a].lim));for(i=a,a=r;(a=e.parent(a))!==i;)s.push(a);return{path:o.concat(s.reverse()),lca:i}}(e,t,a.v,a.w),o=i.path,s=i.lca,u=0,l=o[u],c=!0;n!==a.w;){if(r=e.node(n),c){for(;(l=o[u])!==s&&e.node(l).maxRank{var r=n(2651);e.exports=function(e,t){var n=r(this,e),a=n.size;return n.set(e,t),this.size+=n.size==a?0:1,this}},3007:e=>{e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n{var r=n(3120),a=n(6155),i=n(9302),o=n(6800),s=i(function(e,t){if(null==e)return[];var n=t.length;return n>1&&o(e,t[0],t[1])?t=[]:n>2&&o(t[0],t[1],t[2])&&(t=[t[0]]),a(e,r(t,1),[])});e.exports=s},3040:(e,t,n)=>{var r=n(1549),a=n(79),i=n(8223);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||a),string:new r}}},3120:(e,t,n)=>{var r=n(4528),a=n(5891);e.exports=function e(t,n,i,o,s){var u=-1,l=t.length;for(i||(i=a),s||(s=[]);++u0&&i(c)?n>1?e(c,n-1,i,o,s):r(s,c):o||(s[s.length]=c)}return s}},3170:(e,t,n)=>{var r=n(6547),a=n(1769),i=n(361),o=n(3805),s=n(7797);e.exports=function(e,t,n,u){if(!o(e))return e;for(var l=-1,c=(t=a(t,e)).length,d=c-1,h=e;null!=h&&++l{var r=n(5508)();e.exports=r},3201:e=>{var t=/\w*$/;e.exports=function(e){var n=new e.constructor(e.source,t.exec(e));return n.lastIndex=e.lastIndex,n}},3221:e=>{e.exports=function(e){return function(t,n,r){for(var a=-1,i=Object(t),o=r(t),s=o.length;s--;){var u=o[e?s:++a];if(!1===n(i[u],u,i))break}return t}}},3222:(e,t,n)=>{var r=n(7556);e.exports=function(e){return null==e?"":r(e)}},3243:(e,t,n)=>{var r=n(6110),a=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=a},3290:(e,t,n)=>{e=n.nmd(e);var r=n(9325),a=t&&!t.nodeType&&t,i=a&&e&&!e.nodeType&&e,o=i&&i.exports===a?r.Buffer:void 0,s=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=s?s(n):new e.constructor(n);return e.copy(r),r}},3335:e=>{e.exports=function(e,t){return e>t}},3345:e=>{e.exports=function(){return[]}},3349:(e,t,n)=>{var r=n(2199),a=n(6375),i=n(7241);e.exports=function(e){return r(e,i,a)}},3360:(e,t,n)=>{var r=n(3243);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},3488:e=>{e.exports=function(e){return e}},3590:(e,t,n)=>{var r=n(117);e.exports=function(e,t,n){return function(e,t,n){var r={},a=e.nodes();return a.forEach(function(e){r[e]={},r[e][e]={distance:0},a.forEach(function(t){e!==t&&(r[e][t]={distance:Number.POSITIVE_INFINITY})}),n(e).forEach(function(n){var a=n.v===e?n.w:n.v,i=t(n);r[e][a]={distance:i,predecessor:e}})}),a.forEach(function(e){var t=r[e];a.forEach(function(n){var i=r[n];a.forEach(function(n){var r=i[e],a=t[n],o=i[n],s=r.distance+a.distance;s{var r=n(4394);e.exports=function(e,t,n){for(var a=-1,i=e.length;++a{e.exports=function(e){return this.__data__.get(e)}},3619:(e,t,n)=>{var r=n(117);e.exports=function(e){var t,n={},a=[];function i(a){r.has(n,a)||(n[a]=!0,t.push(a),r.each(e.successors(a),i),r.each(e.predecessors(a),i))}return r.each(e.nodes(),function(e){t=[],i(e),t.length&&a.push(t)}),a}},3650:(e,t,n)=>{var r=n(4335)(Object.keys,Object);e.exports=r},3656:(e,t,n)=>{e=n.nmd(e);var r=n(9325),a=n(9935),i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,s=o&&o.exports===i?r.Buffer:void 0,u=(s?s.isBuffer:void 0)||a;e.exports=u},3661:(e,t,n)=>{var r=n(3040),a=n(7670),i=n(289),o=n(4509),s=n(2949);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var r=n(1799),a=n(776),i=n(7197);e.exports=function(e){var t=a(e);return 1==t.length&&t[0][2]?i(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},3693:(e,t,n)=>{var r=n(4894),a=n(346);e.exports=function(e){return a(e)&&r(e)}},3702:e=>{e.exports=function(){this.__data__=[],this.size=0}},3714:(e,t,n)=>{var r=n(3730);e.exports=function(e,t,n){for(var a=-1,i=e.criteria,o=t.criteria,s=i.length,u=n.length;++a=u?l:l*("desc"==n[a]?-1:1)}return e.index-t.index}},3729:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n{var r=n(4394);e.exports=function(e,t){if(e!==t){var n=void 0!==e,a=null===e,i=e==e,o=r(e),s=void 0!==t,u=null===t,l=t==t,c=r(t);if(!u&&!c&&!o&&e>t||o&&s&&l&&!u&&!c||a&&s&&l||!n&&l||!i)return 1;if(!a&&!o&&!c&&e{var r=n(1873),a=r?r.prototype:void 0,i=a?a.valueOf:void 0;e.exports=function(e){return i?Object(i.call(e)):{}}},3776:(e,t,n)=>{"use strict";var r=n(6857),a=n(3988),i=n(9741).positionX;e.exports=function(e){(function(e){var t=a.buildLayerMatrix(e),n=e.graph().ranksep,i=0;r.forEach(t,function(t){var a=r.max(r.map(t,function(t){return e.node(t).height}));r.forEach(t,function(t){e.node(t).y=i+a/2}),i+=a+n})})(e=a.asNonCompoundGraph(e)),r.forEach(i(e),function(t,n){e.node(n).x=t})}},3805:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},3838:(e,t,n)=>{var r=n(1791),a=n(7241);e.exports=function(e,t){return e&&r(t,a(t),e)}},3860:(e,t,n)=>{var r=n(6857);e.exports=function(e,t){return r.map(t,function(t){var n=e.inEdges(t);if(n.length){var a=r.reduce(n,function(t,n){var r=e.edge(n),a=e.node(n.v);return{sum:t.sum+r.weight*a.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:a.sum/a.weight,weight:a.weight}}return{v:t}})}},3862:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},3916:(e,t,n)=>{var r=n(3360),a=n(641),i=n(5389);e.exports=function(e,t){var n={};return t=i(t,3),a(e,function(e,a,i){r(n,a,t(e,a,i))}),n}},3937:e=>{e.exports=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}},3950:e=>{e.exports=function(){}},3988:(e,t,n)=>{"use strict";var r=n(6857),a=n(8191).Graph;function i(e,t,n,a){var i;do{i=r.uniqueId(a)}while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function o(e){return r.max(r.map(e.nodes(),function(t){var n=e.node(t).rank;if(!r.isUndefined(n))return n}))}e.exports={addDummyNode:i,simplify:function(e){var t=(new a).setGraph(e.graph());return r.forEach(e.nodes(),function(n){t.setNode(n,e.node(n))}),r.forEach(e.edges(),function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},a=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+a.weight,minlen:Math.max(r.minlen,a.minlen)})}),t},asNonCompoundGraph:function(e){var t=new a({multigraph:e.isMultigraph()}).setGraph(e.graph());return r.forEach(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),r.forEach(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t},successorWeights:function(e){var t=r.map(e.nodes(),function(t){var n={};return r.forEach(e.outEdges(t),function(t){n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return r.zipObject(e.nodes(),t)},predecessorWeights:function(e){var t=r.map(e.nodes(),function(t){var n={};return r.forEach(e.inEdges(t),function(t){n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return r.zipObject(e.nodes(),t)},intersectRect:function(e,t){var n,r,a=e.x,i=e.y,o=t.x-a,s=t.y-i,u=e.width/2,l=e.height/2;if(!o&&!s)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*u>Math.abs(o)*l?(s<0&&(l=-l),n=l*o/s,r=l):(o<0&&(u=-u),n=u,r=u*s/o),{x:a+n,y:i+r}},buildLayerMatrix:function(e){var t=r.map(r.range(o(e)+1),function(){return[]});return r.forEach(e.nodes(),function(n){var a=e.node(n),i=a.rank;r.isUndefined(i)||(t[i][a.order]=n)}),t},normalizeRanks:function(e){var t=r.min(r.map(e.nodes(),function(t){return e.node(t).rank}));r.forEach(e.nodes(),function(n){var a=e.node(n);r.has(a,"rank")&&(a.rank-=t)})},removeEmptyRanks:function(e){var t=r.min(r.map(e.nodes(),function(t){return e.node(t).rank})),n=[];r.forEach(e.nodes(),function(r){var a=e.node(r).rank-t;n[a]||(n[a]=[]),n[a].push(r)});var a=0,i=e.graph().nodeRankFactor;r.forEach(n,function(t,n){r.isUndefined(t)&&n%i!==0?--a:a&&r.forEach(t,function(t){e.node(t).rank+=a})})},addBorderNode:function(e,t,n,r){var a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=r),i(e,"border",a,t)},maxRank:o,partition:function(e,t){var n={lhs:[],rhs:[]};return r.forEach(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n},time:function(e,t){var n=r.now();try{return t()}finally{console.log(e+" time: "+(r.now()-n)+"ms")}},notime:function(e,t){return t()}}},4066:(e,t,n)=>{var r=n(3488);e.exports=function(e){return"function"==typeof e?e:r}},4128:(e,t,n)=>{var r=n(1800),a=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(a,""):e}},4218:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},4247:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}},4248:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n{e.exports=function(e,t){return function(n){return e(t(n))}}},4383:(e,t,n)=>{var r=n(6001),a=n(8816)(function(e,t){return null==e?{}:r(e,t)});e.exports=a},4384:(e,t,n)=>{var r=n(6857);e.exports=function(e,t,n){var a,i={};r.forEach(n,function(n){for(var r,o,s=e.parent(n);s;){if((r=e.parent(s))?(o=i[r],i[r]=s):(o=a,a=s),o&&o!==s)return void t.setEdge(o,s);s=r}})}},4394:(e,t,n)=>{var r=n(2552),a=n(346);e.exports=function(e){return"symbol"==typeof e||a(e)&&"[object Symbol]"==r(e)}},4423:(e,t,n)=>{var r=n(117),a=n(6454),i=n(1737);e.exports=function(e,t){var n,o=new a,s={},u=new i;function l(e){var r=e.v===n?e.w:e.v,a=u.priority(r);if(void 0!==a){var i=t(e);i0;){if(n=u.removeMin(),r.has(s,n))o.setEdge(n,s[n]);else{if(c)throw new Error("Input graph is not connected: "+e);c=!0}e.nodeEdges(n).forEach(l)}return o}},4458:e=>{e.exports="2.1.8"},4506:(e,t,n)=>{var r=n(3599),a=n(3335),i=n(3488);e.exports=function(e){return e&&e.length?r(e,i,a):void 0}},4509:(e,t,n)=>{var r=n(2651);e.exports=function(e){return r(this,e).has(e)}},4517:(e,t,n)=>{var r=n(6545),a=n(3950),i=n(4247),o=r&&1/i(new r([,-0]))[1]==1/0?function(e){return new r(e)}:a;e.exports=o},4520:(e,t,n)=>{var r=n(6857),a=n(3860),i=n(4959),o=n(5169);e.exports=function e(t,n,s,u){var l=t.children(n),c=t.node(n),d=c?c.borderLeft:void 0,h=c?c.borderRight:void 0,f={};d&&(l=r.filter(l,function(e){return e!==d&&e!==h}));var p=a(t,l);r.forEach(p,function(n){if(t.children(n.v).length){var a=e(t,n.v,s,u);f[n.v]=a,r.has(a,"barycenter")&&(i=n,o=a,r.isUndefined(i.barycenter)?(i.barycenter=o.barycenter,i.weight=o.weight):(i.barycenter=(i.barycenter*i.weight+o.barycenter*o.weight)/(i.weight+o.weight),i.weight+=o.weight))}var i,o});var v=i(p,s);!function(e,t){r.forEach(e,function(e){e.vs=r.flatten(e.vs.map(function(e){return t[e]?t[e].vs:e}),!0)})}(v,f);var g=o(v,u);if(d&&(g.vs=r.flatten([d,g.vs,h],!0),t.predecessors(d).length)){var y=t.node(t.predecessors(d)[0]),m=t.node(t.predecessors(h)[0]);r.has(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+y.order+m.order)/(g.weight+2),g.weight+=2}return g}},4528:e=>{e.exports=function(e,t){for(var n=-1,r=t.length,a=e.length;++n{var r=n(9770),a=n(3345),i=Object.prototype.propertyIsEnumerable,o=Object.getOwnPropertySymbols,s=o?function(e){return null==e?[]:(e=Object(e),r(o(e),function(t){return i.call(e,t)}))}:a;e.exports=s},4684:(e,t,n)=>{var r=n(9302),a=n(5288),i=n(6800),o=n(7241),s=Object.prototype,u=s.hasOwnProperty,l=r(function(e,t){e=Object(e);var n=-1,r=t.length,l=r>2?t[2]:void 0;for(l&&i(t[0],t[1],l)&&(r=1);++n{var r=n(2523),a=n(5389),i=n(1489),o=Math.max;e.exports=function(e,t,n){var s=null==e?0:e.length;if(!s)return-1;var u=null==n?0:i(n);return u<0&&(u=o(s+u,0)),r(e,a(t,3),u)}},4733:(e,t,n)=>{var r=n(1791),a=n(5950);e.exports=function(e,t){return e&&r(t,a(t),e)}},4739:(e,t,n)=>{var r=n(6025);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},4840:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},4850:(e,t,n)=>{"use strict";var r=n(6857);function a(e){r.forEach(e.nodes(),function(t){i(e.node(t))}),r.forEach(e.edges(),function(t){i(e.edge(t))})}function i(e){var t=e.width;e.width=e.height,e.height=t}function o(e){e.y=-e.y}function s(e){var t=e.x;e.x=e.y,e.y=t}e.exports={adjust:function(e){var t=e.graph().rankdir.toLowerCase();"lr"!==t&&"rl"!==t||a(e)},undo:function(e){var t=e.graph().rankdir.toLowerCase();"bt"!==t&&"rl"!==t||function(e){r.forEach(e.nodes(),function(t){o(e.node(t))}),r.forEach(e.edges(),function(t){var n=e.edge(t);r.forEach(n.points,o),r.has(n,"y")&&o(n)})}(e),"lr"!==t&&"rl"!==t||(function(e){r.forEach(e.nodes(),function(t){s(e.node(t))}),r.forEach(e.edges(),function(t){var n=e.edge(t);r.forEach(n.points,s),r.has(n,"x")&&s(n)})}(e),a(e))}}},4894:(e,t,n)=>{var r=n(1882),a=n(294);e.exports=function(e){return null!=e&&a(e.length)&&!r(e)}},4901:(e,t,n)=>{var r=n(2552),a=n(294),i=n(346),o={};o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o["[object Arguments]"]=o["[object Array]"]=o["[object ArrayBuffer]"]=o["[object Boolean]"]=o["[object DataView]"]=o["[object Date]"]=o["[object Error]"]=o["[object Function]"]=o["[object Map]"]=o["[object Number]"]=o["[object Object]"]=o["[object RegExp]"]=o["[object Set]"]=o["[object String]"]=o["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&a(e.length)&&!!o[r(e)]}},4919:(e,t,n)=>{var r=n(8905),a=n(117);e.exports=function(e,t,n){return a.transform(e.nodes(),function(a,i){a[i]=r(e,i,t,n)},{})}},4932:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,a=Array(r);++n{"use strict";var r=n(6857);e.exports=function(e,t){var n={};return r.forEach(e,function(e,t){var a=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};r.isUndefined(e.barycenter)||(a.barycenter=e.barycenter,a.weight=e.weight)}),r.forEach(t.edges(),function(e){var t=n[e.v],a=n[e.w];r.isUndefined(t)||r.isUndefined(a)||(a.indegree++,t.out.push(n[e.w]))}),function(e){var t=[];function n(e){return function(t){var n,a,i,o;t.merged||(r.isUndefined(t.barycenter)||r.isUndefined(e.barycenter)||t.barycenter>=e.barycenter)&&(a=t,i=0,o=0,(n=e).weight&&(i+=n.barycenter*n.weight,o+=n.weight),a.weight&&(i+=a.barycenter*a.weight,o+=a.weight),n.vs=a.vs.concat(n.vs),n.barycenter=i/o,n.weight=o,n.i=Math.min(a.i,n.i),a.merged=!0)}}function a(t){return function(n){n.in.push(t),0===--n.indegree&&e.push(n)}}for(;e.length;){var i=e.pop();t.push(i),r.forEach(i.in.reverse(),n(i)),r.forEach(i.out,a(i))}return r.map(r.filter(t,function(e){return!e.merged}),function(e){return r.pick(e,["vs","i","barycenter","weight"])})}(r.filter(n,function(e){return!e.indegree}))}},4974:e=>{e.exports=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}},5015:(e,t,n)=>{var r=n(2552),a=n(6449),i=n(346);e.exports=function(e){return"string"==typeof e||!a(e)&&i(e)&&"[object String]"==r(e)}},5056:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},5072:e=>{"use strict";var t=[];function n(e){for(var n=-1,r=0;r{var r=n(1882),a=n(7296),i=n(3805),o=n(7473),s=/^\[object .+?Constructor\]$/,u=Function.prototype,l=Object.prototype,c=u.toString,d=l.hasOwnProperty,h=RegExp("^"+c.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||a(e))&&(r(e)?h:s).test(o(e))}},5111:function(e,t,n){var r;r=function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){var r=n(1),a=function(e){e&&e("layout","dagre",r)};"undefined"!=typeof cytoscape&&a(cytoscape),e.exports=a},function(e,t,n){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}var a=function(e){return"function"==typeof e},i=n(2),o=n(3),s=n(4);function u(e){this.options=o({},i,e)}u.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,i=function(e,t){return a(t)?t.apply(e,[e]):t},o=e.boundingBox||{x1:0,y1:0,w:t.width(),h:t.height()};void 0===o.x2&&(o.x2=o.x1+o.w),void 0===o.w&&(o.w=o.x2-o.x1),void 0===o.y2&&(o.y2=o.y1+o.h),void 0===o.h&&(o.h=o.y2-o.y1);var u=new s.graphlib.Graph({multigraph:!0,compound:!0}),l={},c=function(e,t){null!=t&&(l[e]=t)};c("nodesep",e.nodeSep),c("edgesep",e.edgeSep),c("ranksep",e.rankSep),c("rankdir",e.rankDir),c("align",e.align),c("ranker",e.ranker),c("acyclicer",e.acyclicer),u.setGraph(l),u.setDefaultEdgeLabel(function(){return{}}),u.setDefaultNodeLabel(function(){return{}});var d=n.nodes();a(e.sort)&&(d=d.sort(e.sort));for(var h=0;h1?t-1:0),r=1;r{var r=n(909),a=n(4894);e.exports=function(e,t){var n=-1,i=a(e)?Array(e.length):[];return r(e,function(e,r,a){i[++n]=t(e,r,a)}),i}},5169:(e,t,n)=>{var r=n(6857),a=n(3988);function i(e,t,n){for(var a;t.length&&(a=r.last(t)).i<=n;)t.pop(),e.push(a.vs),n++;return n}e.exports=function(e,t){var n,o=a.partition(e,function(e){return r.has(e,"barycenter")}),s=o.lhs,u=r.sortBy(o.rhs,function(e){return-e.i}),l=[],c=0,d=0,h=0;s.sort((n=!!t,function(e,t){return e.barycentert.barycenter?1:n?t.i-e.i:e.i-t.i})),h=i(l,u,h),r.forEach(s,function(e){h+=e.vs.length,l.push(e.vs),c+=e.barycenter*e.weight,d+=e.weight,h=i(l,u,h)});var f={vs:r.flatten(l,!0)};return d&&(f.barycenter=c/d,f.weight=d),f}},5250:(e,t,n)=>{var r=n(7217),a=n(7805),i=n(6649),o=n(2824),s=n(3805),u=n(7241),l=n(4974);e.exports=function e(t,n,c,d,h){t!==n&&i(n,function(i,u){if(h||(h=new r),s(i))o(t,n,u,c,e,d,h);else{var f=d?d(l(t,u),i,u+"",t,n,h):void 0;void 0===f&&(f=i),a(t,u,f)}},u)}},5288:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},5325:(e,t,n)=>{var r=n(6131);e.exports=function(e,t){return!(null==e||!e.length)&&r(e,t,0)>-1}},5364:(e,t,n)=>{var r=n(5250),a=n(999)(function(e,t,n){r(e,t,n)});e.exports=a},5378:(e,t,n)=>{var r=n(4932),a=n(5389),i=n(5128),o=n(6449);e.exports=function(e,t){return(o(e)?r:i)(e,a(t,3))}},5389:(e,t,n)=>{var r=n(3663),a=n(7978),i=n(3488),o=n(6449),s=n(583);e.exports=function(e){return"function"==typeof e?e:null==e?i:"object"==typeof e?o(e)?a(e[0],e[1]):r(e):s(e)}},5463:e=>{e.exports=function(e){return e!=e}},5481:(e,t,n)=>{var r=n(9325)["__core-js_shared__"];e.exports=r},5508:(e,t,n)=>{var r=n(6151),a=n(6800),i=n(7400);e.exports=function(e){return function(t,n,o){return o&&"number"!=typeof o&&a(t,n,o)&&(n=o=void 0),t=i(t),void 0===n?(n=t,t=0):n=i(n),o=void 0===o?t{var t=Object.prototype;e.exports=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||t)}},5529:(e,t,n)=>{var r=n(9344),a=n(8879),i=n(5527);e.exports=function(e){return"function"!=typeof e.constructor||i(e)?{}:r(a(e))}},5558:e=>{e.exports=function(e,t,n,r,a){return a(e,function(e,a,i){n=r?(r=!1,e):t(n,e,a,i)}),n}},5580:(e,t,n)=>{var r=n(6110)(n(9325),"DataView");e.exports=r},5749:(e,t,n)=>{var r=n(1042);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},5765:(e,t,n)=>{var r=n(8859),a=n(5325),i=n(9905),o=n(9219),s=n(4517),u=n(4247);e.exports=function(e,t,n){var l=-1,c=a,d=e.length,h=!0,f=[],p=f;if(n)h=!1,c=i;else if(d>=200){var v=t?null:s(e);if(v)return u(v);h=!1,c=o,p=new r}else p=t?[]:f;e:for(;++l{var r=n(5580),a=n(8223),i=n(2804),o=n(6545),s=n(8303),u=n(2552),l=n(7473),c="[object Map]",d="[object Promise]",h="[object Set]",f="[object WeakMap]",p="[object DataView]",v=l(r),g=l(a),y=l(i),m=l(o),b=l(s),x=u;(r&&x(new r(new ArrayBuffer(1)))!=p||a&&x(new a)!=c||i&&x(i.resolve())!=d||o&&x(new o)!=h||s&&x(new s)!=f)&&(x=function(e){var t=u(e),n="[object Object]"==t?e.constructor:void 0,r=n?l(n):"";if(r)switch(r){case v:return p;case g:return c;case y:return d;case m:return h;case b:return f}return t}),e.exports=x},5880:(e,t,n)=>{var r=n(514),a=n(5950);e.exports=function(e){return null==e?[]:r(e,a(e))}},5891:(e,t,n)=>{var r=n(1873),a=n(2428),i=n(6449),o=r?r.isConcatSpreadable:void 0;e.exports=function(e){return i(e)||a(e)||!!(o&&e&&e[o])}},5911:(e,t,n)=>{var r=n(8859),a=n(4248),i=n(9219);e.exports=function(e,t,n,o,s,u){var l=1&n,c=e.length,d=t.length;if(c!=d&&!(l&&d>c))return!1;var h=u.get(e),f=u.get(t);if(h&&f)return h==t&&f==e;var p=-1,v=!0,g=2&n?new r:void 0;for(u.set(e,t),u.set(t,e);++p{var r=n(695),a=n(8984),i=n(4894);e.exports=function(e){return i(e)?r(e):a(e)}},5970:(e,t,n)=>{var r=n(3120);e.exports=function(e){return null!=e&&e.length?r(e,1):[]}},6001:(e,t,n)=>{var r=n(7420),a=n(631);e.exports=function(e,t){return r(e,t,function(t,n){return a(e,n)})}},6009:(e,t,n)=>{e=n.nmd(e);var r=n(4840),a=t&&!t.nodeType&&t,i=a&&e&&!e.nodeType&&e,o=i&&i.exports===a&&r.process,s=function(){try{return i&&i.require&&i.require("util").types||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=s},6016:(e,t,n)=>{var r=n(9276);e.exports=function(e,t){return r(e,t,"pre")}},6025:(e,t,n)=>{var r=n(5288);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},6038:(e,t,n)=>{var r=n(5861),a=n(346);e.exports=function(e){return a(e)&&"[object Set]"==r(e)}},6110:(e,t,n)=>{var r=n(5083),a=n(392);e.exports=function(e,t){var n=a(e,t);return r(n)?n:void 0}},6131:(e,t,n)=>{var r=n(2523),a=n(5463),i=n(6959);e.exports=function(e,t,n){return t==t?i(e,t,n):r(e,a,n)}},6135:(e,t,n)=>{e.exports=n(9754)},6151:e=>{var t=Math.ceil,n=Math.max;e.exports=function(e,r,a,i){for(var o=-1,s=n(t((r-e)/(a||1)),0),u=Array(s);s--;)u[i?s:++o]=e,e+=a;return u}},6155:(e,t,n)=>{var r=n(4932),a=n(7422),i=n(5389),o=n(5128),s=n(3937),u=n(7301),l=n(3714),c=n(3488),d=n(6449);e.exports=function(e,t,n){t=t.length?r(t,function(e){return d(e)?function(t){return a(t,1===e.length?e[0]:e)}:e}):[c];var h=-1;t=r(t,u(i));var f=o(e,function(e,n,a){return{criteria:r(t,function(t){return t(e)}),index:++h,value:e}});return s(f,function(e,t){return l(e,t,n)})}},6169:(e,t,n)=>{var r=n(9653);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}},6176:e=>{e.exports=function(e,t){return e{var t=Object.prototype.hasOwnProperty;e.exports=function(e){var n=e.length,r=new e.constructor(n);return n&&"string"==typeof e[0]&&t.call(e,"index")&&(r.index=e.index,r.input=e.input),r}},6246:(e,t,n)=>{e.exports={graphlib:n(8191),layout:n(8202),debug:n(8909),util:{time:n(3988).time,notime:n(3988).notime},version:n(7038)}},6291:(e,t,n)=>{var r=n(117);e.exports=function(e){var t=0,n=[],a={},i=[];function o(s){var u=a[s]={onStack:!0,lowlink:t,index:t++};if(n.push(s),e.successors(s).forEach(function(e){r.has(a,e)?a[e].onStack&&(u.lowlink=Math.min(u.lowlink,a[e].index)):(o(e),u.lowlink=Math.min(u.lowlink,a[e].lowlink))}),u.lowlink===u.index){var l,c=[];do{l=n.pop(),a[l].onStack=!1,c.push(l)}while(s!==l);i.push(c)}}return e.nodes().forEach(function(e){r.has(a,e)||o(e)}),i}},6314:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,r,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(r)for(var s=0;s0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),a&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=a):c[4]="".concat(a)),t.push(c))}},t}},6353:(e,t,n)=>{var r=n(6857),a=n(3988);function i(e,t,n,o,s,u,l){var c=e.children(l);if(c.length){var d=a.addBorderNode(e,"_bt"),h=a.addBorderNode(e,"_bb"),f=e.node(l);e.setParent(d,l),f.borderTop=d,e.setParent(h,l),f.borderBottom=h,r.forEach(c,function(r){i(e,t,n,o,s,u,r);var a=e.node(r),c=a.borderTop?a.borderTop:r,f=a.borderBottom?a.borderBottom:r,p=a.borderTop?o:2*o,v=c!==f?1:s-u[l]+1;e.setEdge(d,c,{weight:p,minlen:v,nestingEdge:!0}),e.setEdge(f,h,{weight:p,minlen:v,nestingEdge:!0})}),e.parent(l)||e.setEdge(t,d,{weight:0,minlen:s+u[l]})}else l!==t&&e.setEdge(t,l,{weight:0,minlen:n})}e.exports={run:function(e){var t=a.addDummyNode(e,"root",{},"_root"),n=function(e){var t={};function n(a,i){var o=e.children(a);o&&o.length&&r.forEach(o,function(e){n(e,i+1)}),t[a]=i}return r.forEach(e.children(),function(e){n(e,1)}),t}(e),o=r.max(r.values(n))-1,s=2*o+1;e.graph().nestingRoot=t,r.forEach(e.edges(),function(t){e.edge(t).minlen*=s});var u=function(e){return r.reduce(e.edges(),function(t,n){return t+e.edge(n).weight},0)}(e)+1;r.forEach(e.children(),function(r){i(e,t,s,u,o,n,r)}),e.graph().nodeRankFactor=s},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,r.forEach(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}}},6375:(e,t,n)=>{var r=n(4528),a=n(8879),i=n(4664),o=n(3345),s=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,i(e)),e=a(e);return t}:o;e.exports=s},6449:e=>{var t=Array.isArray;e.exports=t},6454:(e,t,n)=>{"use strict";var r=n(117);e.exports=i;var a="\0";function i(e){this._isDirected=!r.has(e,"directed")||e.directed,this._isMultigraph=!!r.has(e,"multigraph")&&e.multigraph,this._isCompound=!!r.has(e,"compound")&&e.compound,this._label=void 0,this._defaultNodeLabelFn=r.constant(void 0),this._defaultEdgeLabelFn=r.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[a]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function o(e,t){e[t]?e[t]++:e[t]=1}function s(e,t){--e[t]||delete e[t]}function u(e,t,n,a){var i=""+t,o=""+n;if(!e&&i>o){var s=i;i=o,o=s}return i+""+o+""+(r.isUndefined(a)?"\0":a)}function l(e,t){return u(e,t.v,t.w,t.name)}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(e){return this._label=e,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(e){return r.isFunction(e)||(e=r.constant(e)),this._defaultNodeLabelFn=e,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return r.keys(this._nodes)},i.prototype.sources=function(){var e=this;return r.filter(this.nodes(),function(t){return r.isEmpty(e._in[t])})},i.prototype.sinks=function(){var e=this;return r.filter(this.nodes(),function(t){return r.isEmpty(e._out[t])})},i.prototype.setNodes=function(e,t){var n=arguments,a=this;return r.each(e,function(e){n.length>1?a.setNode(e,t):a.setNode(e)}),this},i.prototype.setNode=function(e,t){return r.has(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=a,this._children[e]={},this._children[a][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)},i.prototype.node=function(e){return this._nodes[e]},i.prototype.hasNode=function(e){return r.has(this._nodes,e)},i.prototype.removeNode=function(e){var t=this;if(r.has(this._nodes,e)){var n=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],r.each(this.children(e),function(e){t.setParent(e)}),delete this._children[e]),r.each(r.keys(this._in[e]),n),delete this._in[e],delete this._preds[e],r.each(r.keys(this._out[e]),n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},i.prototype.setParent=function(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(r.isUndefined(t))t=a;else{for(var n=t+="";!r.isUndefined(n);n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this},i.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},i.prototype.parent=function(e){if(this._isCompound){var t=this._parent[e];if(t!==a)return t}},i.prototype.children=function(e){if(r.isUndefined(e)&&(e=a),this._isCompound){var t=this._children[e];if(t)return r.keys(t)}else{if(e===a)return this.nodes();if(this.hasNode(e))return[]}},i.prototype.predecessors=function(e){var t=this._preds[e];if(t)return r.keys(t)},i.prototype.successors=function(e){var t=this._sucs[e];if(t)return r.keys(t)},i.prototype.neighbors=function(e){var t=this.predecessors(e);if(t)return r.union(t,this.successors(e))},i.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},i.prototype.filterNodes=function(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;r.each(this._nodes,function(n,r){e(r)&&t.setNode(r,n)}),r.each(this._edgeObjs,function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var a={};function i(e){var r=n.parent(e);return void 0===r||t.hasNode(r)?(a[e]=r,r):r in a?a[r]:i(r)}return this._isCompound&&r.each(t.nodes(),function(e){t.setParent(e,i(e))}),t},i.prototype.setDefaultEdgeLabel=function(e){return r.isFunction(e)||(e=r.constant(e)),this._defaultEdgeLabelFn=e,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return r.values(this._edgeObjs)},i.prototype.setPath=function(e,t){var n=this,a=arguments;return r.reduce(e,function(e,r){return a.length>1?n.setEdge(e,r,t):n.setEdge(e,r),r}),this},i.prototype.setEdge=function(){var e,t,n,a,i=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(e=s.v,t=s.w,n=s.name,2===arguments.length&&(a=arguments[1],i=!0)):(e=s,t=arguments[1],n=arguments[3],arguments.length>2&&(a=arguments[2],i=!0)),e=""+e,t=""+t,r.isUndefined(n)||(n=""+n);var l=u(this._isDirected,e,t,n);if(r.has(this._edgeLabels,l))return i&&(this._edgeLabels[l]=a),this;if(!r.isUndefined(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[l]=i?a:this._defaultEdgeLabelFn(e,t,n);var c=function(e,t,n,r){var a=""+t,i=""+n;if(!e&&a>i){var o=a;a=i,i=o}var s={v:a,w:i};return r&&(s.name=r),s}(this._isDirected,e,t,n);return e=c.v,t=c.w,Object.freeze(c),this._edgeObjs[l]=c,o(this._preds[t],e),o(this._sucs[e],t),this._in[t][l]=c,this._out[e][l]=c,this._edgeCount++,this},i.prototype.edge=function(e,t,n){var r=1===arguments.length?l(this._isDirected,arguments[0]):u(this._isDirected,e,t,n);return this._edgeLabels[r]},i.prototype.hasEdge=function(e,t,n){var a=1===arguments.length?l(this._isDirected,arguments[0]):u(this._isDirected,e,t,n);return r.has(this._edgeLabels,a)},i.prototype.removeEdge=function(e,t,n){var r=1===arguments.length?l(this._isDirected,arguments[0]):u(this._isDirected,e,t,n),a=this._edgeObjs[r];return a&&(e=a.v,t=a.w,delete this._edgeLabels[r],delete this._edgeObjs[r],s(this._preds[t],e),s(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this},i.prototype.inEdges=function(e,t){var n=this._in[e];if(n){var a=r.values(n);return t?r.filter(a,function(e){return e.v===t}):a}},i.prototype.outEdges=function(e,t){var n=this._out[e];if(n){var a=r.values(n);return t?r.filter(a,function(e){return e.w===t}):a}},i.prototype.nodeEdges=function(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}},6533:(e,t,n)=>{var r=n(3599),a=n(5389),i=n(6176);e.exports=function(e,t){return e&&e.length?r(e,a(t,2),i):void 0}},6545:(e,t,n)=>{var r=n(6110)(n(9325),"Set");e.exports=r},6547:(e,t,n)=>{var r=n(3360),a=n(5288),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var o=e[t];i.call(e,t)&&a(o,n)&&(void 0!==n||t in e)||r(e,t,n)}},6574:(e,t,n)=>{var r=n(909);e.exports=function(e,t){var n=[];return r(e,function(e,r,a){t(e,r,a)&&n.push(e)}),n}},6639:(e,t,n)=>{"use strict";var r=n(6857);function a(e,t,n){for(var a=r.zipObject(n,r.map(n,function(e,t){return t})),i=r.flatten(r.map(t,function(t){return r.sortBy(r.map(e.outEdges(t),function(t){return{pos:a[t.w],weight:e.edge(t).weight}}),"pos")}),!0),o=1;o0;)t%2&&(n+=u[t+1]),u[t=t-1>>1]+=e.weight;l+=e.weight*n})),l}e.exports=function(e,t){for(var n=0,r=1;r{var r=n(3221)();e.exports=r},6678:(e,t,n)=>{var r=n(117),a=n(6291);e.exports=function(e){return r.filter(a(e),function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}},6721:(e,t,n)=>{var r=n(1042),a=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return a.call(t,e)?t[e]:void 0}},6757:(e,t,n)=>{var r=n(1033),a=Math.max;e.exports=function(e,t,n){return t=a(void 0===t?e.length-1:t,0),function(){for(var i=arguments,o=-1,s=a(i.length-t,0),u=Array(s);++o{var r=n(5288),a=n(4894),i=n(361),o=n(3805);e.exports=function(e,t,n){if(!o(n))return!1;var s=typeof t;return!!("number"==s?a(n)&&i(t,n.length):"string"==s&&t in n)&&r(n[t],e)}},6822:(e,t,n)=>{"use strict";var r=n(6857),a=n(2031);e.exports={run:function(e){var t="greedy"===e.graph().acyclicer?a(e,function(e){return function(t){return e.edge(t).weight}}(e)):function(e){var t=[],n={},a={};return r.forEach(e.nodes(),function i(o){r.has(a,o)||(a[o]=!0,n[o]=!0,r.forEach(e.outEdges(o),function(e){r.has(n,e.w)?t.push(e):i(e.w)}),delete n[o])}),t}(e);r.forEach(t,function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,r.uniqueId("rev"))})},undo:function(e){r.forEach(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}}},6857:(e,t,n)=>{var r;try{r={cloneDeep:n(8055),constant:n(7334),defaults:n(4684),each:n(6135),filter:n(7612),find:n(7309),flatten:n(5970),forEach:n(9754),forIn:n(2420),has:n(1448),isUndefined:n(2216),last:n(8090),map:n(5378),mapValues:n(3916),max:n(4506),merge:n(5364),min:n(1684),minBy:n(6533),now:n(124),pick:n(4383),range:n(3181),reduce:n(860),sortBy:n(3031),uniqueId:n(7200),values:n(5880),zipObject:n(7248)}}catch(e){}r||(r=window._),e.exports=r},6860:(e,t,n)=>{"use strict";var r=n(6857),a=n(8481),i=n(8073).slack,o=n(8073).longestPath,s=n(8191).alg.preorder,u=n(8191).alg.postorder,l=n(3988).simplify;function c(e){e=l(e),o(e);var t,n=a(e);for(f(n),d(n,e);t=v(n);)y(n,e,t,g(n,e,t))}function d(e,t){var n=u(e,e.nodes());n=n.slice(0,n.length-1),r.forEach(n,function(n){!function(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=h(e,t,n)}(e,t,n)})}function h(e,t,n){var a=e.node(n).parent,i=!0,o=t.edge(n,a),s=0;return o||(i=!1,o=t.edge(a,n)),s=o.weight,r.forEach(t.nodeEdges(n),function(r){var o,u,l=r.v===n,c=l?r.w:r.v;if(c!==a){var d=l===i,h=t.edge(r).weight;if(s+=d?h:-h,o=n,u=c,e.hasEdge(o,u)){var f=e.edge(n,c).cutvalue;s+=d?-f:f}}}),s}function f(e,t){arguments.length<2&&(t=e.nodes()[0]),p(e,{},1,t)}function p(e,t,n,a,i){var o=n,s=e.node(a);return t[a]=!0,r.forEach(e.neighbors(a),function(i){r.has(t,i)||(n=p(e,t,n,i,a))}),s.low=o,s.lim=n++,i?s.parent=i:delete s.parent,n}function v(e){return r.find(e.edges(),function(t){return e.edge(t).cutvalue<0})}function g(e,t,n){var a=n.v,o=n.w;t.hasEdge(a,o)||(a=n.w,o=n.v);var s=e.node(a),u=e.node(o),l=s,c=!1;s.lim>u.lim&&(l=u,c=!0);var d=r.filter(t.edges(),function(t){return c===m(0,e.node(t.v),l)&&c!==m(0,e.node(t.w),l)});return r.minBy(d,function(e){return i(t,e)})}function y(e,t,n,a){var i=n.v,o=n.w;e.removeEdge(i,o),e.setEdge(a.v,a.w,{}),f(e),d(e,t),function(e,t){var n=r.find(e.nodes(),function(e){return!t.node(e).parent}),a=s(e,n);a=a.slice(1),r.forEach(a,function(n){var r=e.node(n).parent,a=t.edge(n,r),i=!1;a||(a=t.edge(r,n),i=!0),t.node(n).rank=t.node(r).rank+(i?a.minlen:-a.minlen)})}(e,t)}function m(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}e.exports=c,c.initLowLimValues=f,c.initCutValues=d,c.calcCutValue=h,c.leaveEdge=v,c.enterEdge=g,c.exchangeEdges=y},6959:e=>{e.exports=function(e,t,n){for(var r=n-1,a=e.length;++r{e.exports="0.8.5"},7068:(e,t,n)=>{var r=n(7217),a=n(5911),i=n(1986),o=n(689),s=n(5861),u=n(6449),l=n(3656),c=n(7167),d="[object Arguments]",h="[object Array]",f="[object Object]",p=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,v,g,y){var m=u(e),b=u(t),x=m?h:s(e),w=b?h:s(t),E=(x=x==d?f:x)==f,k=(w=w==d?f:w)==f,_=x==w;if(_&&l(e)){if(!l(t))return!1;m=!0,E=!1}if(_&&!E)return y||(y=new r),m||c(e)?a(e,t,n,v,g,y):i(e,t,x,n,v,g,y);if(!(1&n)){var C=E&&p.call(e,"__wrapped__"),T=k&&p.call(t,"__wrapped__");if(C||T){var S=C?e.value():e,P=T?t.value():t;return y||(y=new r),g(S,P,n,v,y)}}return!!_&&(y||(y=new r),o(e,t,n,v,g,y))}},7091:(e,t,n)=>{var r=n(8984),a=n(5861),i=n(4894),o=n(5015),s=n(1993);e.exports=function(e){if(null==e)return 0;if(i(e))return o(e)?s(e):e.length;var t=a(e);return"[object Map]"==t||"[object Set]"==t?e.size:r(e).length}},7167:(e,t,n)=>{var r=n(4901),a=n(7301),i=n(6009),o=i&&i.isTypedArray,s=o?a(o):r;e.exports=s},7197:e=>{e.exports=function(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in Object(n))}}},7199:(e,t,n)=>{var r=n(9653),a=n(6169),i=n(3201),o=n(3736),s=n(1961);e.exports=function(e,t,n){var u=e.constructor;switch(t){case"[object ArrayBuffer]":return r(e);case"[object Boolean]":case"[object Date]":return new u(+e);case"[object DataView]":return a(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return s(e,n);case"[object Map]":case"[object Set]":return new u;case"[object Number]":case"[object String]":return new u(e);case"[object RegExp]":return i(e);case"[object Symbol]":return o(e)}}},7200:(e,t,n)=>{var r=n(3222),a=0;e.exports=function(e){var t=++a;return r(e)+t}},7217:(e,t,n)=>{var r=n(79),a=n(1420),i=n(938),o=n(3605),s=n(9817),u=n(945);function l(e){var t=this.__data__=new r(e);this.size=t.size}l.prototype.clear=a,l.prototype.delete=i,l.prototype.get=o,l.prototype.has=s,l.prototype.set=u,e.exports=l},7237:e=>{e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},7241:(e,t,n)=>{var r=n(695),a=n(2903),i=n(4894);e.exports=function(e){return i(e)?r(e,!0):a(e)}},7248:(e,t,n)=>{var r=n(6547),a=n(1234);e.exports=function(e,t){return a(e||[],t||[],r)}},7255:(e,t,n)=>{var r=n(7422);e.exports=function(e){return function(t){return r(t,e)}}},7296:(e,t,n)=>{var r,a=n(5481),i=(r=/[^.]+$/.exec(a&&a.keys&&a.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!i&&i in e}},7301:e=>{e.exports=function(e){return function(t){return e(t)}}},7309:(e,t,n)=>{var r=n(2006)(n(4713));e.exports=r},7334:e=>{e.exports=function(e){return function(){return e}}},7400:(e,t,n)=>{var r=n(9374),a=1/0;e.exports=function(e){return e?(e=r(e))===a||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},7420:(e,t,n)=>{var r=n(7422),a=n(3170),i=n(1769);e.exports=function(e,t,n){for(var o=-1,s=t.length,u={};++o{var r=n(1769),a=n(7797);e.exports=function(e,t){for(var n=0,i=(t=r(t,e)).length;null!=e&&n{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},7494:(e,t,n)=>{var r=n(117),a=n(6454);function i(e){return r.map(e.nodes(),function(t){var n=e.node(t),a=e.parent(t),i={v:t};return r.isUndefined(n)||(i.value=n),r.isUndefined(a)||(i.parent=a),i})}function o(e){return r.map(e.edges(),function(t){var n=e.edge(t),a={v:t.v,w:t.w};return r.isUndefined(t.name)||(a.name=t.name),r.isUndefined(n)||(a.value=n),a})}e.exports={write:function(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:i(e),edges:o(e)};return r.isUndefined(e.graph())||(t.value=r.clone(e.graph())),t},read:function(e){var t=new a(e.options).setGraph(e.value);return r.each(e.nodes,function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),r.each(e.edges,function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}},7534:(e,t,n)=>{var r=n(2552),a=n(346);e.exports=function(e){return a(e)&&"[object Arguments]"==r(e)}},7556:(e,t,n)=>{var r=n(1873),a=n(4932),i=n(6449),o=n(4394),s=r?r.prototype:void 0,u=s?s.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(i(t))return a(t,e)+"";if(o(t))return u?u.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},7612:(e,t,n)=>{var r=n(9770),a=n(6574),i=n(5389),o=n(6449);e.exports=function(e,t){return(o(e)?r:a)(e,i(t,3))}},7659:e=>{"use strict";var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},7670:(e,t,n)=>{var r=n(2651);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},7730:(e,t,n)=>{var r=n(9172),a=n(7301),i=n(6009),o=i&&i.isMap,s=o?a(o):r;e.exports=s},7797:(e,t,n)=>{var r=n(4394);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},7805:(e,t,n)=>{var r=n(3360),a=n(5288);e.exports=function(e,t,n){(void 0!==n&&!a(e[t],n)||void 0===n&&!(t in e))&&r(e,t,n)}},7825:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,a&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},7828:(e,t,n)=>{var r=n(9325).Uint8Array;e.exports=r},7860:(e,t,n)=>{var r=n(6857),a=n(8191).Graph;e.exports=function(e,t,n){var i=function(e){for(var t;e.hasNode(t=r.uniqueId("_root")););return t}(e),o=new a({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(function(t){return e.node(t)});return r.forEach(e.nodes(),function(a){var s=e.node(a),u=e.parent(a);(s.rank===t||s.minRank<=t&&t<=s.maxRank)&&(o.setNode(a),o.setParent(a,u||i),r.forEach(e[n](a),function(t){var n=t.v===a?t.w:t.v,i=o.edge(n,a),s=r.isUndefined(i)?0:i.weight;o.setEdge(n,a,{weight:e.edge(t).weight+s})}),r.has(s,"minRank")&&o.setNode(a,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))}),o}},7927:e=>{var t="\\ud800-\\udfff",n="["+t+"]",r="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",a="\\ud83c[\\udffb-\\udfff]",i="[^"+t+"]",o="(?:\\ud83c[\\udde6-\\uddff]){2}",s="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+r+"|"+a+")?",l="[\\ufe0e\\ufe0f]?",c=l+u+"(?:\\u200d(?:"+[i,o,s].join("|")+")"+l+u+")*",d="(?:"+[i+r+"?",r,o,s,n].join("|")+")",h=RegExp(a+"(?="+a+")|"+d+c,"g");e.exports=function(e){for(var t=h.lastIndex=0;h.test(e);)++t;return t}},7978:(e,t,n)=>{var r=n(270),a=n(8156),i=n(631),o=n(8586),s=n(756),u=n(7197),l=n(7797);e.exports=function(e,t){return o(e)&&s(t)?u(l(e),t):function(n){var o=a(n,e);return void 0===o&&o===t?i(n,e):r(t,o,3)}}},8055:(e,t,n)=>{var r=n(9999);e.exports=function(e){return r(e,5)}},8073:(e,t,n)=>{"use strict";var r=n(6857);e.exports={longestPath:function(e){var t={};r.forEach(e.sources(),function n(a){var i=e.node(a);if(r.has(t,a))return i.rank;t[a]=!0;var o=r.min(r.map(e.outEdges(a),function(t){return n(t.w)-e.edge(t).minlen}));return o!==Number.POSITIVE_INFINITY&&null!=o||(o=0),i.rank=o})},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}},8077:e=>{e.exports=function(e,t){return null!=e&&t in Object(e)}},8090:e=>{e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},8096:e=>{e.exports=function(e,t){for(var n=-1,r=Array(e);++n{var r=n(7422);e.exports=function(e,t,n){var a=null==e?void 0:r(e,t);return void 0===a?n:a}},8191:(e,t,n)=>{var r;try{r=n(8362)}catch(e){}r||(r=window.graphlib),e.exports=r},8202:(e,t,n)=>{"use strict";var r=n(6857),a=n(6822),i=n(8209),o=n(9361),s=n(3988).normalizeRanks,u=n(2948),l=n(3988).removeEmptyRanks,c=n(6353),d=n(135),h=n(4850),f=n(1453),p=n(3776),v=n(3988),g=n(8191).Graph;e.exports=function(e,t){var n=t&&t.debugTiming?v.time:v.notime;n("layout",function(){var t=n(" buildLayoutGraph",function(){return function(e){var t=new g({multigraph:!0,compound:!0}),n=T(e.graph());return t.setGraph(r.merge({},m,C(n,y),r.pick(n,b))),r.forEach(e.nodes(),function(n){var a=T(e.node(n));t.setNode(n,r.defaults(C(a,x),w)),t.setParent(n,e.parent(n))}),r.forEach(e.edges(),function(n){var a=T(e.edge(n));t.setEdge(n,r.merge({},k,C(a,E),r.pick(a,_)))}),t}(e)});n(" runLayout",function(){!function(e,t){t(" makeSpaceForEdgeLabels",function(){!function(e){var t=e.graph();t.ranksep/=2,r.forEach(e.edges(),function(n){var r=e.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===t.rankdir||"BT"===t.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)})}(e)}),t(" removeSelfEdges",function(){!function(e){r.forEach(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}(e)}),t(" acyclic",function(){a.run(e)}),t(" nestingGraph.run",function(){c.run(e)}),t(" rank",function(){o(v.asNonCompoundGraph(e))}),t(" injectEdgeLabelProxies",function(){!function(e){r.forEach(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v),a={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};v.addDummyNode(e,"edge-proxy",a,"_ep")}})}(e)}),t(" removeEmptyRanks",function(){l(e)}),t(" nestingGraph.cleanup",function(){c.cleanup(e)}),t(" normalizeRanks",function(){s(e)}),t(" assignRankMinMax",function(){!function(e){var t=0;r.forEach(e.nodes(),function(n){var a=e.node(n);a.borderTop&&(a.minRank=e.node(a.borderTop).rank,a.maxRank=e.node(a.borderBottom).rank,t=r.max(t,a.maxRank))}),e.graph().maxRank=t}(e)}),t(" removeEdgeLabelProxies",function(){!function(e){r.forEach(e.nodes(),function(t){var n=e.node(t);"edge-proxy"===n.dummy&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}(e)}),t(" normalize.run",function(){i.run(e)}),t(" parentDummyChains",function(){u(e)}),t(" addBorderSegments",function(){d(e)}),t(" order",function(){f(e)}),t(" insertSelfEdges",function(){!function(e){var t=v.buildLayerMatrix(e);r.forEach(t,function(t){var n=0;r.forEach(t,function(t,a){var i=e.node(t);i.order=a+n,r.forEach(i.selfEdges,function(t){v.addDummyNode(e,"selfedge",{width:t.label.width,height:t.label.height,rank:i.rank,order:a+ ++n,e:t.e,label:t.label},"_se")}),delete i.selfEdges})})}(e)}),t(" adjustCoordinateSystem",function(){h.adjust(e)}),t(" position",function(){p(e)}),t(" positionSelfEdges",function(){!function(e){r.forEach(e.nodes(),function(t){var n=e.node(t);if("selfedge"===n.dummy){var r=e.node(n.e.v),a=r.x+r.width/2,i=r.y,o=n.x-a,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:a+2*o/3,y:i-s},{x:a+5*o/6,y:i-s},{x:a+o,y:i},{x:a+5*o/6,y:i+s},{x:a+2*o/3,y:i+s}],n.label.x=n.x,n.label.y=n.y}})}(e)}),t(" removeBorderNodes",function(){!function(e){r.forEach(e.nodes(),function(t){if(e.children(t).length){var n=e.node(t),a=e.node(n.borderTop),i=e.node(n.borderBottom),o=e.node(r.last(n.borderLeft)),s=e.node(r.last(n.borderRight));n.width=Math.abs(s.x-o.x),n.height=Math.abs(i.y-a.y),n.x=o.x+n.width/2,n.y=a.y+n.height/2}}),r.forEach(e.nodes(),function(t){"border"===e.node(t).dummy&&e.removeNode(t)})}(e)}),t(" normalize.undo",function(){i.undo(e)}),t(" fixupEdgeLabelCoords",function(){!function(e){r.forEach(e.edges(),function(t){var n=e.edge(t);if(r.has(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}(e)}),t(" undoCoordinateSystem",function(){h.undo(e)}),t(" translateGraph",function(){!function(e){var t=Number.POSITIVE_INFINITY,n=0,a=Number.POSITIVE_INFINITY,i=0,o=e.graph(),s=o.marginx||0,u=o.marginy||0;function l(e){var r=e.x,o=e.y,s=e.width,u=e.height;t=Math.min(t,r-s/2),n=Math.max(n,r+s/2),a=Math.min(a,o-u/2),i=Math.max(i,o+u/2)}r.forEach(e.nodes(),function(t){l(e.node(t))}),r.forEach(e.edges(),function(t){var n=e.edge(t);r.has(n,"x")&&l(n)}),t-=s,a-=u,r.forEach(e.nodes(),function(n){var r=e.node(n);r.x-=t,r.y-=a}),r.forEach(e.edges(),function(n){var i=e.edge(n);r.forEach(i.points,function(e){e.x-=t,e.y-=a}),r.has(i,"x")&&(i.x-=t),r.has(i,"y")&&(i.y-=a)}),o.width=n-t+s,o.height=i-a+u}(e)}),t(" assignNodeIntersects",function(){!function(e){r.forEach(e.edges(),function(t){var n,r,a=e.edge(t),i=e.node(t.v),o=e.node(t.w);a.points?(n=a.points[0],r=a.points[a.points.length-1]):(a.points=[],n=o,r=i),a.points.unshift(v.intersectRect(i,n)),a.points.push(v.intersectRect(o,r))})}(e)}),t(" reversePoints",function(){!function(e){r.forEach(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}(e)}),t(" acyclic.undo",function(){a.undo(e)})}(t,n)}),n(" updateInputGraph",function(){!function(e,t){r.forEach(e.nodes(),function(n){var r=e.node(n),a=t.node(n);r&&(r.x=a.x,r.y=a.y,t.children(n).length&&(r.width=a.width,r.height=a.height))}),r.forEach(e.edges(),function(n){var a=e.edge(n),i=t.edge(n);a.points=i.points,r.has(i,"x")&&(a.x=i.x,a.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}(e,t)})})};var y=["nodesep","edgesep","ranksep","marginx","marginy"],m={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},b=["acyclicer","ranker","rankdir","align"],x=["width","height"],w={width:0,height:0},E=["minlen","weight","width","height","labeloffset"],k={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},_=["labelpos"];function C(e,t){return r.mapValues(r.pick(e,t),Number)}function T(e){var t={};return r.forEach(e,function(e,n){t[n.toLowerCase()]=e}),t}},8209:(e,t,n)=>{"use strict";var r=n(6857),a=n(3988);e.exports={run:function(e){e.graph().dummyChains=[],r.forEach(e.edges(),function(t){!function(e,t){var n,r,i,o=t.v,s=e.node(o).rank,u=t.w,l=e.node(u).rank,c=t.name,d=e.edge(t),h=d.labelRank;if(l!==s+1){for(e.removeEdge(t),i=0,++s;s{var r=n(6110)(n(9325),"Map");e.exports=r},8303:(e,t,n)=>{var r=n(6110)(n(9325),"WeakMap");e.exports=r},8329:(e,t,n)=>{var r=n(4894);e.exports=function(e,t){return function(n,a){if(null==n)return n;if(!r(n))return e(n,a);for(var i=n.length,o=t?i:-1,s=Object(n);(t?o--:++o{var r=n(1166);e.exports={Graph:r.Graph,json:n(7494),alg:n(1667),version:r.version}},8440:(e,t,n)=>{var r=n(6038),a=n(7301),i=n(6009),o=i&&i.isSet,s=o?a(o):r;e.exports=s},8481:(e,t,n)=>{"use strict";var r=n(6857),a=n(8191).Graph,i=n(8073).slack;function o(e,t){return r.forEach(e.nodes(),function n(a){r.forEach(t.nodeEdges(a),function(r){var o=r.v,s=a===o?r.w:o;e.hasNode(s)||i(t,r)||(e.setNode(s,{}),e.setEdge(a,s,{}),n(s))})}),e.nodeCount()}function s(e,t){return r.minBy(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return i(t,n)})}function u(e,t,n){r.forEach(e.nodes(),function(e){t.node(e).rank+=n})}e.exports=function(e){var t,n,r=new a({directed:!1}),l=e.nodes()[0],c=e.nodeCount();for(r.setNode(l,{});o(r,e){var r=n(6449),a=n(4394),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!a(e))||o.test(e)||!i.test(e)||null!=t&&e in Object(t)}},8655:(e,t,n)=>{var r=n(6025);e.exports=function(e){return r(this.__data__,e)>-1}},8816:(e,t,n)=>{var r=n(5970),a=n(6757),i=n(2865);e.exports=function(e){return i(a(e,void 0,r),e+"")}},8859:(e,t,n)=>{var r=n(3661),a=n(1380),i=n(1459);function o(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t{var r=n(4335)(Object.getPrototypeOf,Object);e.exports=r},8905:(e,t,n)=>{var r=n(117),a=n(1737);e.exports=function(e,t,n,r){return function(e,t,n,r){var i,o,s={},u=new a,l=function(e){var t=e.v!==i?e.v:e.w,r=s[t],a=n(e),l=o.distance+a;if(a<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+a);l0&&(i=u.removeMin(),(o=s[i]).distance!==Number.POSITIVE_INFINITY);)r(i).forEach(l);return s}(e,String(t),n||i,r||function(t){return e.outEdges(t)})};var i=r.constant(1)},8909:(e,t,n)=>{var r=n(6857),a=n(3988),i=n(8191).Graph;e.exports={debugOrdering:function(e){var t=a.buildLayerMatrix(e),n=new i({compound:!0,multigraph:!0}).setGraph({});return r.forEach(e.nodes(),function(t){n.setNode(t,{label:t}),n.setParent(t,"layer"+e.node(t).rank)}),r.forEach(e.edges(),function(e){n.setEdge(e.v,e.w,{},e.name)}),r.forEach(t,function(e,t){var a="layer"+t;n.setNode(a,{rank:"same"}),r.reduce(e,function(e,t){return n.setEdge(e,t,{style:"invis"}),t})}),n}}},8918:(e,t,n)=>{"use strict";var r=n(6857);e.exports=function(e){var t={},n=r.filter(e.nodes(),function(t){return!e.children(t).length}),a=r.max(r.map(n,function(t){return e.node(t).rank})),i=r.map(r.range(a+1),function(){return[]}),o=r.sortBy(n,function(t){return e.node(t).rank});return r.forEach(o,function n(a){if(!r.has(t,a)){t[a]=!0;var o=e.node(a);i[o.rank].push(a),r.forEach(e.successors(a),n)}}),i}},8948:(e,t,n)=>{var r=n(1791),a=n(6375);e.exports=function(e,t){return r(e,a(e),t)}},8984:(e,t,n)=>{var r=n(5527),a=n(3650),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return a(e);var t=[];for(var n in Object(e))i.call(e,n)&&"constructor"!=n&&t.push(n);return t}},9172:(e,t,n)=>{var r=n(5861),a=n(346);e.exports=function(e){return a(e)&&"[object Map]"==r(e)}},9219:e=>{e.exports=function(e,t){return e.has(t)}},9276:(e,t,n)=>{var r=n(117);function a(e,t,n,i,o,s){r.has(i,t)||(i[t]=!0,n||s.push(t),r.each(o(t),function(t){a(e,t,n,i,o,s)}),n&&s.push(t))}e.exports=function(e,t,n){r.isArray(t)||(t=[t]);var i=(e.isDirected()?e.successors:e.neighbors).bind(e),o=[],s={};return r.each(t,function(t){if(!e.hasNode(t))throw new Error("Graph does not have node: "+t);a(e,t,"post"===n,s,i,o)}),o}},9302:(e,t,n)=>{var r=n(3488),a=n(6757),i=n(2865);e.exports=function(e,t){return i(a(e,t,r),e+"")}},9325:(e,t,n)=>{var r=n(4840),a="object"==typeof self&&self&&self.Object===Object&&self,i=r||a||Function("return this")();e.exports=i},9326:(e,t,n)=>{var r=n(1769),a=n(2428),i=n(6449),o=n(361),s=n(294),u=n(7797);e.exports=function(e,t,n){for(var l=-1,c=(t=r(t,e)).length,d=!1;++l{var r=n(3805),a=Object.create,i=function(){function e(){}return function(t){if(!r(t))return{};if(a)return a(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();e.exports=i},9350:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},9361:(e,t,n)=>{"use strict";var r=n(8073).longestPath,a=n(8481),i=n(6860);e.exports=function(e){switch(e.graph().ranker){case"network-simplex":default:!function(e){i(e)}(e);break;case"tight-tree":!function(e){r(e),a(e)}(e);break;case"longest-path":o(e)}};var o=r},9374:(e,t,n)=>{var r=n(4128),a=n(3805),i=n(4394),o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,u=/^0o[0-7]+$/i,l=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=s.test(e);return n||u.test(e)?l(e.slice(2),n?2:8):o.test(e)?NaN:+e}},9570:(e,t,n)=>{var r=n(7334),a=n(3243),i=n(3488),o=a?function(e,t){return a(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:i;e.exports=o},9653:(e,t,n)=>{var r=n(7828);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},9698:e=>{var t=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=function(e){return t.test(e)}},9741:(e,t,n)=>{"use strict";var r=n(6857),a=n(8191).Graph,i=n(3988);function o(e,t){var n={};return r.reduce(t,function(t,a){var i=0,o=0,s=t.length,l=r.last(a);return r.forEach(a,function(t,c){var d=function(e,t){if(e.node(t).dummy)return r.find(e.predecessors(t),function(t){return e.node(t).dummy})}(e,t),h=d?e.node(d).order:s;(d||t===l)&&(r.forEach(a.slice(o,c+1),function(t){r.forEach(e.predecessors(t),function(r){var a=e.node(r),o=a.order;!(os)&&u(n,t,l)})})}return r.reduce(t,function(t,n){var i,o=-1,s=0;return r.forEach(n,function(r,u){if("border"===e.node(r).dummy){var l=e.predecessors(r);l.length&&(i=e.node(l[0]).order,a(n,s,u,o,i),s=u,o=i)}a(n,s,n.length,i,t.length)}),n}),n}function u(e,t,n){if(t>n){var r=t;t=n,n=r}var a=e[t];a||(e[t]=a={}),a[n]=!0}function l(e,t,n){if(t>n){var a=t;t=n,n=a}return r.has(e[t],n)}function c(e,t,n,a){var i={},o={},s={};return r.forEach(t,function(e){r.forEach(e,function(e,t){i[e]=e,o[e]=e,s[e]=t})}),r.forEach(t,function(e){var t=-1;r.forEach(e,function(e){var u=a(e);if(u.length){u=r.sortBy(u,function(e){return s[e]});for(var c=(u.length-1)/2,d=Math.floor(c),h=Math.ceil(c);d<=h;++d){var f=u[d];o[e]===e&&t{var r=n(3729),a=n(9344),i=n(641),o=n(5389),s=n(8879),u=n(6449),l=n(3656),c=n(1882),d=n(3805),h=n(7167);e.exports=function(e,t,n){var f=u(e),p=f||l(e)||h(e);if(t=o(t,4),null==n){var v=e&&e.constructor;n=p?f?new v:[]:d(e)&&c(v)?a(s(e)):{}}return(p?r:i)(e,function(e,r,a){return t(n,e,r,a)}),n}},9754:(e,t,n)=>{var r=n(3729),a=n(909),i=n(4066),o=n(6449);e.exports=function(e,t){return(o(e)?r:a)(e,i(t))}},9770:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,a=0,i=[];++n{var r=n(7237)("length");e.exports=r},9817:e=>{e.exports=function(e){return this.__data__.has(e)}},9859:e=>{function t(){var e={};e._next=e._prev=e,this._sentinel=e}function n(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function r(e,t){if("_next"!==e&&"_prev"!==e)return t}e.exports=t,t.prototype.dequeue=function(){var e=this._sentinel,t=e._prev;if(t!==e)return n(t),t},t.prototype.enqueue=function(e){var t=this._sentinel;e._prev&&e._next&&n(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t},t.prototype.toString=function(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,r)),n=n._prev;return"["+e.join(", ")+"]"}},9884:(e,t,n)=>{var r=n(1791),a=n(7241);e.exports=function(e){return r(e,a(e))}},9888:(e,t,n)=>{var r=n(117);function a(e){var t={},n={},a=[];if(r.each(e.sinks(),function o(s){if(r.has(n,s))throw new i;r.has(t,s)||(n[s]=!0,t[s]=!0,r.each(e.predecessors(s),o),delete n[s],a.push(s))}),r.size(t)!==e.nodeCount())throw new i;return a}function i(){}e.exports=a,a.CycleException=i,i.prototype=new Error},9905:e=>{e.exports=function(e,t,n){for(var r=-1,a=null==e?0:e.length;++r{e.exports=function(){return!1}},9999:(e,t,n)=>{var r=n(7217),a=n(3729),i=n(6547),o=n(4733),s=n(3838),u=n(3290),l=n(3007),c=n(2271),d=n(8948),h=n(2),f=n(3349),p=n(5861),v=n(6189),g=n(7199),y=n(5529),m=n(6449),b=n(3656),x=n(7730),w=n(3805),E=n(8440),k=n(5950),_=n(7241),C="[object Arguments]",T="[object Function]",S="[object Object]",P={};P[C]=P["[object Array]"]=P["[object ArrayBuffer]"]=P["[object DataView]"]=P["[object Boolean]"]=P["[object Date]"]=P["[object Float32Array]"]=P["[object Float64Array]"]=P["[object Int8Array]"]=P["[object Int16Array]"]=P["[object Int32Array]"]=P["[object Map]"]=P["[object Number]"]=P[S]=P["[object RegExp]"]=P["[object Set]"]=P["[object String]"]=P["[object Symbol]"]=P["[object Uint8Array]"]=P["[object Uint8ClampedArray]"]=P["[object Uint16Array]"]=P["[object Uint32Array]"]=!0,P["[object Error]"]=P[T]=P["[object WeakMap]"]=!1,e.exports=function e(t,n,B,D,M,A){var I,N=1&n,R=2&n,L=4&n;if(B&&(I=M?B(t,D,M,A):B(t)),void 0!==I)return I;if(!w(t))return t;var O=m(t);if(O){if(I=v(t),!N)return l(t,I)}else{var z=p(t),j=z==T||"[object GeneratorFunction]"==z;if(b(t))return u(t,N);if(z==S||z==C||j&&!M){if(I=R||j?{}:y(t),!N)return R?d(t,s(I,t)):c(t,o(I,t))}else{if(!P[z])return M?t:{};I=g(t,z,N)}}A||(A=new r);var V=A.get(t);if(V)return V;A.set(t,I),E(t)?t.forEach(function(r){I.add(e(r,n,B,r,t,A))}):x(t)&&t.forEach(function(r,a){I.set(a,e(r,n,B,a,t,A))});var F=O?void 0:(L?R?f:h:R?_:k)(t);return a(F||t,function(r,a){F&&(r=t[a=r]),i(I,a,e(r,n,B,a,t,A))}),I}}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),n.nc=void 0,(()=>{"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function i(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],u=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){l=!0,a=e}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw a}}return s}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||c(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function c(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}var d="undefined"==typeof window?null:window,h=d?d.navigator:null;d&&d.document;var f,p,v,g,y,m,b,x,w,E,k,_,C,T,S,P,B,D,M,A,I,N,R,L,O,z,j,V,F=l(""),Y=l({}),q=l(function(){}),X="undefined"==typeof HTMLElement?"undefined":l(HTMLElement),W=function(e){return e&&e.instanceString&&G(e.instanceString)?e.instanceString():null},U=function(e){return null!=e&&l(e)==F},G=function(e){return null!=e&&l(e)===q},H=function(e){return!Q(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},K=function(e){return null!=e&&l(e)===Y&&!H(e)&&e.constructor===Object},Z=function(e){return null!=e&&l(e)===l(1)&&!isNaN(e)},$=function(e){return"undefined"===X?void 0:null!=e&&e instanceof HTMLElement},Q=function(e){return J(e)||ee(e)},J=function(e){return"collection"===W(e)&&e._private.single},ee=function(e){return"collection"===W(e)&&!e._private.single},te=function(e){return"core"===W(e)},ne=function(e){return"stylesheet"===W(e)},re=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},ae=function(e){return function(e){return null!=e&&l(e)===Y}(e)&&G(e.then)},ie=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;tt?1:0},ye=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n255)return;t.push(Math.floor(i))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var u=n[4];if(void 0!==u){if((u=parseFloat(u))<0||u>1)return;t.push(u)}}return t}(e)||function(e){var t,n,r,a,i,o,s,u;function l(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^"+pe+"$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(a=parseFloat(c[3]))<0||a>100)return;if(a/=100,void 0!==(i=c[4])&&((i=parseFloat(i))<0||i>1))return;if(0===r)o=s=u=Math.round(255*a);else{var d=a<.5?a*(1+r):a+r-a*r,h=2*a-d;o=Math.round(255*l(h,d,n+1/3)),s=Math.round(255*l(h,d,n)),u=Math.round(255*l(h,d,n-1/3))}t=[o,s,u,i]}return t}(e)},be={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},xe=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a=o||t<0||g&&e-p>=c}function x(){var e=t();if(b(e))return w(e);h=setTimeout(x,function(e){var t=o-(e-f);return g?a(t,c-(e-p)):t}(e))}function w(e){return h=void 0,y&&u?m(e):(u=l=void 0,d)}function E(){var e=t(),n=b(e);if(u=arguments,l=this,f=e,n){if(void 0===h)return function(e){return p=e,h=setTimeout(x,o),v?m(e):d}(f);if(g)return clearTimeout(h),h=setTimeout(x,o),m(f)}return void 0===h&&(h=setTimeout(x,o)),d}return o=n(o)||0,e(s)&&(v=!!s.leading,c=(g="maxWait"in s)?r(n(s.maxWait)||0,o):c,y="trailing"in s?!!s.trailing:y),E.cancel=function(){void 0!==h&&clearTimeout(h),p=0,u=f=l=h=void 0},E.flush=function(){return void 0===h?d:w(t())},E},j}(),De=ke(Be),Me=d?d.performance:null,Ae=Me&&Me.now?function(){return Me.now()}:function(){return Date.now()},Ie=function(){if(d){if(d.requestAnimationFrame)return function(e){d.requestAnimationFrame(e)};if(d.mozRequestAnimationFrame)return function(e){d.mozRequestAnimationFrame(e)};if(d.webkitRequestAnimationFrame)return function(e){d.webkitRequestAnimationFrame(e)};if(d.msRequestAnimationFrame)return function(e){d.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(Ae())},1e3/60)}}(),Ne=function(e){return Ie(e)},Re=Ae,Le=9261,Oe=5381,ze=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Le;!(t=e.next()).done;)n=65599*n+t.value|0;return n},je=function(e){return 65599*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Le)+e|0},Ve=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Oe;return(t<<5)+t+e|0},Fe=function(e){return 2097152*e[0]+e[1]},Ye=function(e,t){return[je(e[0],t[0]),Ve(e[1],t[1])]},qe=function(e,t){var n={value:0,done:!1},r=0,a=e.length;return ze({next:function(){return r=0;r--)e[r]===t&&e.splice(r,1)},ct=function(e){e.splice(0,e.length)},dt=function(e,t,n){return n&&(t=ue(n,t)),e[t]},ht=function(e,t,n,r){n&&(t=ue(n,t)),e[t]=r},ft="undefined"!=typeof Map?Map:function(){return r(function e(){t(this,e),this._obj={}},[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}])}(),pt=function(){return r(function e(n){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=n){var r;r=null!=n.instanceString&&n.instanceString()===this.instanceString()?n.toArray():n;for(var a=0;a2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&te(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var a=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new vt,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==a.position.x&&(a.position.x=0),null==a.position.y&&(a.position.y=0),t.renderedPosition){var i=t.renderedPosition,o=e.pan(),s=e.zoom();a.position={x:(i.x-o.x)/s,y:(i.y-o.y)/s}}var u=[];H(t.classes)?u=t.classes:U(t.classes)&&(u=t.classes.split(/\s+/));for(var l=0,c=u.length;lt?1:0},u=function(e,r,a,i,o){var s;if(null==a&&(a=0),null==o&&(o=t),a<0)throw new Error("lo must be non-negative");for(null==i&&(i=e.length);ar;0<=r?t++:t--)l.push(t);return l}.apply(this).reverse()).length;iv;0<=v?++h:--h)g.push(a(e,i));return g},f=function(e,n,r,a){var i,o,s;for(null==a&&(a=t),i=e[r];r>n&&a(i,o=e[s=r-1>>1])<0;)e[r]=o,r=s;return e[r]=i},p=function(e,n,r){var a,i,o,s,u;for(null==r&&(r=t),i=e.length,u=n,o=e[n],a=2*n+1;a0;){var w=y.pop(),E=v(w),k=w.id();if(d[k]=E,E!==1/0)for(var _=w.neighborhood().intersect(f),C=0;C<_.length;C++){var T=_[C],S=T.id(),P=x(w,T),B=E+P.dist;B0)for(n.unshift(t);c[a];){var i=c[a];n.unshift(i.edge),n.unshift(i.node),a=(r=i.node).id()}return o.spawn(n)}}}},Pt={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,a=n.length,i=new Array(a),o=n,s=function(e){for(var t=0;t0;){if(x(),E++,l===d){for(var k=[],_=a,C=d,T=m[C];k.unshift(_),null!=T&&k.unshift(T),null!=(_=y[C]);)T=m[C=_.id()];return{found:!0,distance:h[l],path:this.spawn(k),steps:E}}p[l]=!0;for(var S=u._private.edges,P=0;PT&&(f[C]=T,y[C]=_,m[C]=x),!a){var S=_*l+k;!a&&f[S]>T&&(f[S]=T,y[S]=k,m[S]=x)}}}for(var P=0;P1&&void 0!==arguments[1]?arguments[1]:i,r=[],a=m(e);;){if(null==a)return t.spawn();var o=y(a),u=o.edge,l=o.pred;if(r.unshift(a[0]),a.same(n)&&r.length>0)break;null!=u&&r.unshift(u),a=l}return s.spawn(r)},hasNegativeWeightCycle:p,negativeWeightCycles:v}}},Rt=Math.sqrt(2),Lt=function(e,t,n){0===n.length&&tt("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],a=r[1],i=r[2],o=t[a],s=t[i],u=n,l=u.length-1;l>=0;l--){var c=u[l],d=c[1],h=c[2];(t[d]===o&&t[h]===s||t[d]===s&&t[h]===o)&&u.splice(l,1)}for(var f=0;fr;){var a=Math.floor(Math.random()*t.length);t=Lt(a,e,t),n--}return t},zt={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(e){return e.isLoop()});var a=n.length,i=r.length,o=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),s=Math.floor(a/Rt);if(!(a<2)){for(var u=[],l=0;l0?1:e<0?-1:0},Wt=function(e,t){return Math.sqrt(Ut(e,t))},Ut=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},Gt=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Qt=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Jt=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},en=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},tn=function(e){var t,n,r,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===i.length)t=n=r=a=i[0];else if(2===i.length)t=r=i[0],a=n=i[1];else if(4===i.length){var s=o(i,4);t=s[0],n=s[1],r=s[2],a=s[3]}return e.x1-=a,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},nn=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},rn=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2t.y2||t.y1>e.y2)},an=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},on=function(e,t){return an(e,t.x,t.y)},sn=function(e,t){return an(e,t.x1,t.y1)&&an(e,t.x2,t.y2)},un=null!==(kt=Math.hypot)&&void 0!==kt?kt:function(e,t){return Math.sqrt(e*e+t*t)};var ln=function(e,t,n,r,a,i,o){var s,u,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",c="auto"===l?Pn(a,i):l,d=a/2,h=i/2,f=(c=Math.min(c,d,h))!==d,p=c!==h;if(f){var v=r-h-o;if((s=wn(e,t,n,r,n-d+c-o,v,n+d-c+o,v,!1)).length>0)return s}if(p){var g=n+d+o;if((s=wn(e,t,n,r,g,r-h+c-o,g,r+h-c+o,!1)).length>0)return s}if(f){var y=r+h+o;if((s=wn(e,t,n,r,n-d+c-o,y,n+d-c+o,y,!1)).length>0)return s}if(p){var m=n-d-o;if((s=wn(e,t,n,r,m,r-h+c-o,m,r+h-c+o,!1)).length>0)return s}var b=n-d+c,x=r-h+c;if((u=bn(e,t,n,r,b,x,c+o)).length>0&&u[0]<=b&&u[1]<=x)return[u[0],u[1]];var w=n+d-c,E=r-h+c;if((u=bn(e,t,n,r,w,E,c+o)).length>0&&u[0]>=w&&u[1]<=E)return[u[0],u[1]];var k=n+d-c,_=r+h-c;if((u=bn(e,t,n,r,k,_,c+o)).length>0&&u[0]>=k&&u[1]>=_)return[u[0],u[1]];var C=n-d+c,T=r+h-c;return(u=bn(e,t,n,r,C,T,c+o)).length>0&&u[0]<=C&&u[1]>=T?[u[0],u[1]]:[]},cn=function(e,t,n,r,a,i,o){var s=o,u=Math.min(n,a),l=Math.max(n,a),c=Math.min(r,i),d=Math.max(r,i);return u-s<=e&&e<=l+s&&c-s<=t&&t<=d+s},dn=function(e,t,n,r,a,i,o,s,u){var l=Math.min(n,o,a)-u,c=Math.max(n,o,a)+u,d=Math.min(r,s,i)-u,h=Math.max(r,s,i)+u;return!(ec||th)},hn=function(e,t,n,r,a,i,o,s){var u,l,c,d,h,f,p,v,g,y,m,b,x,w=[];l=9*n*a-3*n*n-3*n*o-6*a*a+3*a*o+9*r*i-3*r*r-3*r*s-6*i*i+3*i*s,c=3*n*n-6*n*a+n*o-n*e+2*a*a+2*a*e-o*e+3*r*r-6*r*i+r*s-r*t+2*i*i+2*i*t-s*t,d=1*n*a-n*n+n*e-a*e+r*i-r*r+r*t-i*t,0===(u=1*n*n-4*n*a+2*n*o+4*a*a-4*a*o+o*o+r*r-4*r*i+2*r*s+4*i*i-4*i*s+s*s)&&(u=1e-5),v=-27*(d/=u)+(l/=u)*(9*(c/=u)-l*l*2),f=(p=(3*c-l*l)/9)*p*p+(v/=54)*v,(h=w)[1]=0,b=l/3,f>0?(y=(y=v+Math.sqrt(f))<0?-Math.pow(-y,1/3):Math.pow(y,1/3),m=(m=v-Math.sqrt(f))<0?-Math.pow(-m,1/3):Math.pow(m,1/3),h[0]=-b+y+m,b+=(y+m)/2,h[4]=h[2]=-b,b=Math.sqrt(3)*(-m+y)/2,h[3]=b,h[5]=-b):(h[5]=h[3]=0,0===f?(x=v<0?-Math.pow(-v,1/3):Math.pow(v,1/3),h[0]=2*x-b,h[4]=h[2]=-(x+b)):(g=(p=-p)*p*p,g=Math.acos(v/Math.sqrt(g)),x=2*Math.sqrt(p),h[0]=-b+x*Math.cos(g/3),h[2]=-b+x*Math.cos((g+2*Math.PI)/3),h[4]=-b+x*Math.cos((g+4*Math.PI)/3)));for(var E=[],k=0;k<6;k+=2)Math.abs(w[k+1])<1e-7&&w[k]>=0&&w[k]<=1&&E.push(w[k]);E.push(1),E.push(0);for(var _,C,T,S=-1,P=0;P=0?Tu?(e-a)*(e-a)+(t-i)*(t-i):l-d},pn=function(e,t,n){for(var r,a,i,o,s=0,u=0;u=e&&e>=i||r<=e&&e<=i))continue;(e-r)/(i-r)*(o-a)+a>t&&s++}return s%2!=0},vn=function(e,t,n,r,a,i,o,s,u){var l,c=new Array(n.length);null!=s[0]?(l=Math.atan(s[1]/s[0]),s[0]<0?l+=Math.PI/2:l=-l-Math.PI/2):l=s;for(var d,h=Math.cos(-l),f=Math.sin(-l),p=0;p0){var v=yn(c,-u);d=gn(v)}else d=c;return pn(e,t,d)},gn=function(e){for(var t,n,r,a,i,o,s,u,l=new Array(e.length/2),c=0;c=0&&p<=1&&g.push(p),v>=0&&v<=1&&g.push(v),0===g.length)return[];var y=g[0]*s[0]+e,m=g[0]*s[1]+t;return g.length>1?g[0]==g[1]?[y,m]:[y,m,g[1]*s[0]+e,g[1]*s[1]+t]:[y,m]},xn=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},wn=function(e,t,n,r,a,i,o,s,u){var l=e-a,c=n-e,d=o-a,h=t-i,f=r-t,p=s-i,v=d*h-p*l,g=c*h-f*l,y=p*c-d*f;if(0!==y){var m=v/y,b=g/y,x=-.001;return x<=m&&m<=1.001&&x<=b&&b<=1.001||u?[e+m*c,t+m*f]:[]}return 0===v||0===g?xn(e,n,o)===o?[o,s]:xn(e,n,a)===a?[a,i]:xn(a,o,n)===n?[n,r]:[]:[]},En=function(e,t,n,r,a){var i=[],o=r/2,s=a/2,u=t,l=n;i.push({x:u+o*e[0],y:l+s*e[1]});for(var c=1;c0){var m=yn(v,-s);l=gn(m)}else l=v}else l=n;for(var b=0;bl&&(l=t)},d=function(e){return u[e]},h=0;h0?x.edgesTo(b)[0]:b.edgesTo(x)[0];var w=r(m);b=b.id(),l[b]>l[v]+w&&(l[b]=l[v]+w,h.nodes.indexOf(b)<0?h.push(b):h.updateItem(b),u[b]=0,n[b]=[]),l[b]==l[v]+w&&(u[b]=u[b]+u[v],n[b].push(v))}else for(var E=0;E0;){for(var T=t.pop(),S=0;S0&&o.push(n[s]);0!==o.length&&a.push(r.collection(o))}return a}(c,u,t,r);return b=function(e){for(var t=0;t5&&void 0!==arguments[5]?arguments[5]:Zn,o=r,s=0;s=2?nr(e,t,n,0,Jn,er):nr(e,t,n,0,Qn)},squaredEuclidean:function(e,t,n){return nr(e,t,n,0,Jn)},manhattan:function(e,t,n){return nr(e,t,n,0,Qn)},max:function(e,t,n){return nr(e,t,n,-1/0,tr)}};function ar(e,t,n,r,a,i){var o;return o=G(e)?e:rr[e]||rr.euclidean,0===t&&G(e)?o(a,i):o(t,n,r,a,i)}rr["squared-euclidean"]=rr.squaredEuclidean,rr.squaredeuclidean=rr.squaredEuclidean;var ir=ut({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),or=function(e){return ir(e)},sr=function(e,t,n,r,a){var i="kMedoids"!==a?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return ar(e,r.length,i,function(e){return r[e](t)},o,s)},ur=function(e,t,n){for(var r=n.length,a=new Array(r),i=new Array(r),o=new Array(t),s=null,u=0;un)return!1;return!0},fr=function(e,t,n){for(var r=0;ra&&(a=t[u][l],i=l);o[i].push(e[u])}for(var c=0;c=a.threshold||"dendrogram"===a.mode&&1===e.length)return!1;var f,p=t[o],v=t[r[o]];f="dendrogram"===a.mode?{left:p,right:v,key:p.key}:{value:p.value.concat(v.value),key:p.key},e[p.index]=f,e.splice(v.index,1),t[p.key]=f;for(var g=0;gn[v.key][y.key]&&(i=n[v.key][y.key])):"max"===a.linkage?(i=n[p.key][y.key],n[p.key][y.key]o&&(i=u,o=t[a*e+u])}i>0&&r.push(i)}for(var l=0;l1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];arguments.length>3&&void 0!==arguments[3]&&!arguments[3]?(n0&&e.splice(0,t)):e=e.slice(t,n);for(var i=0,o=e.length-1;o>=0;o--){var s=e[o];a?isFinite(s)||(e[o]=-1/0,i++):e.splice(o,1)}r&&e.sort(function(e,t){return e-t});var u=e.length,l=Math.floor(u/2);return u%2!=0?e[l+1+i]:(e[l-1+i]+e[l+i])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,a=0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,a=t;a=T?(S=T,T=B,P=D):B>S&&(S=B);for(var M=0;M0?1:0;k[E%l.minIterations*t+O]=z,L+=z}if(L>0&&(E>=l.minIterations-1||E==l.maxIterations-1)){for(var j=0,V=0;V0&&r.push(a);return r}(t,i,o),q=function(e,t,n){for(var r=Dr(e,t,n),a=0;au&&(s=l,u=c)}n[a]=i[s]}return Dr(e,t,n)}(t,r,Y),X={},W=0;W1||o>1)&&(l=!0),c[t]=[],e.outgoers().forEach(function(e){e.isEdge()&&c[t].push(e.id())})}else d[t]=[void 0,e.target().id()]}):u.forEach(function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?l=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach(function(e){return c[t].push(e.id())})):d[t]=[e.source().id(),e.target().id()]});var h={found:!1,trail:void 0};if(l)return h;if(r&&n)if(s){if(a&&r!=a)return h;a=r}else{if(a&&r!=a&&n!=a)return h;a||(a=r)}else a||(a=u[0].id());var f=function(e){for(var t,n,r,a=e,i=[e];c[a].length;)t=c[a].shift(),n=d[t][0],a!=(r=d[t][1])?(c[r]=c[r].filter(function(e){return e!=t}),a=r):s||a==n||(c[n]=c[n].filter(function(e){return e!=t}),a=n),i.unshift(t),i.unshift(a);return i},p=[],v=[];for(v=f(a);1!=v.length;)0==c[v[0]].length?(p.unshift(u.getElementById(v.shift())),p.unshift(u.getElementById(v.shift()))):v=f(v.shift()).concat(v);for(var g in p.unshift(u.getElementById(v.shift())),c)if(c[g].length)return h;return h.found=!0,h.trail=this.spawn(p,!0),h}},Rr=function(){var e=this,t={},n=0,r=0,a=[],i=[],o={},s=function(u,l,c){u===c&&(r+=1),t[l]={id:n,low:n++,cutVertex:!1};var d,h,f,p,v=e.getElementById(l).connectedEdges().intersection(e);0===v.size()?a.push(e.spawn(e.getElementById(l))):v.forEach(function(n){d=n.source().id(),h=n.target().id(),(f=d===l?h:d)!==c&&(p=n.id(),o[p]||(o[p]=!0,i.push({x:l,y:f,edge:n})),f in t?t[l].low=Math.min(t[l].low,t[f].id):(s(u,f,l),t[l].low=Math.min(t[l].low,t[f].low),t[l].id<=t[f].low&&(t[l].cutVertex=!0,function(n,r){for(var o=i.length-1,s=[],u=e.spawn();i[o].x!=n||i[o].y!=r;)s.push(i.pop().edge),o--;s.push(i.pop().edge),s.forEach(function(n){var r=n.connectedNodes().intersection(e);u.merge(n),r.forEach(function(n){var r=n.id(),a=n.connectedEdges().intersection(e);u.merge(n),t[r].cutVertex?u.merge(a.filter(function(e){return e.isLoop()})):u.merge(a)})}),a.push(u)}(l,f))))})};e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||(r=0,s(n,n),t[n].cutVertex=r>1)}});var u=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(u),components:a}},Lr=function(){var e=this,t={},n=0,r=[],a=[],i=e.spawn(e),o=function(s){if(a.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))}),t[s].index===t[s].low){for(var u=e.spawn();;){var l=a.pop();if(u.merge(e.getElementById(l)),t[l].low=t[s].index,t[l].explored=!0,l===s)break}var c=u.edgesWith(u),d=u.merge(c);r.push(d),i=i.difference(d)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||o(n)}}),{cut:i,components:r}},Or={};[mt,St,Pt,Dt,At,Nt,zt,In,Rn,On,jn,Kn,br,Sr,Ar,Nr,{hopcroftTarjanBiconnected:Rr,htbc:Rr,htb:Rr,hopcroftTarjanBiconnectedComponents:Rr},{tarjanStronglyConnected:Lr,tsc:Lr,tscc:Lr,tarjanStronglyConnectedComponents:Lr}].forEach(function(e){ye(Or,e)});var zr=function(e){if(!(this instanceof zr))return new zr(e);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof e&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};zr.prototype={fulfill:function(e){return jr(this,1,"fulfillValue",e)},reject:function(e){return jr(this,2,"rejectReason",e)},then:function(e,t){var n=this,r=new zr;return n.onFulfilled.push(Yr(e,r,"fulfill")),n.onRejected.push(Yr(t,r,"reject")),Vr(n),r.proxy}};var jr=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,Vr(e)),e},Vr=function(e){1===e.state?Fr(e,"onFulfilled",e.fulfillValue):2===e.state&&Fr(e,"onRejected",e.rejectReason)},Fr=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var a=function(){for(var e=0;e0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n-1}}(),a=function(){if(za)return Oa;za=1;var e=Mi();return Oa=function(t,n){var r=this.__data__,a=e(r,t);return a<0?(++this.size,r.push([t,n])):r[a][1]=n,this},Oa}();function i(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&t%1==0&&t0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){H(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,a=[],i=0,o=n.length;i0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};ho.className=ho.classNames=ho.classes;var fo={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:de,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};fo.variable="(?:[\\w-.]|(?:\\\\"+fo.metaChar+"))+",fo.className="(?:[\\w-]|(?:\\\\"+fo.metaChar+"))+",fo.value=fo.string+"|"+fo.number,fo.id=fo.variable,function(){var e,t,n;for(e=fo.comparatorOp.split("|"),n=0;n=0||"="!==t&&(fo.comparatorOp+="|\\!"+t)}();var po=20,vo=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return function(e,t){return-1*ge(e,t)}(e.selector,t.selector)}),go=function(){for(var e,t={},n=0;n0&&l.edgeCount>0)return rt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return rt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&rt("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return U(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(a,i){return a.checks.reduce(function(o,s,u){return o+(i===a&&0===u?"$":"")+function(a,i){var o=a.type,s=a.value;switch(o){case 0:var u=e(s);return u.substring(0,u.length-1);case 3:var l=a.field,c=a.operator;return"["+l+n(e(c))+t(s)+"]";case 5:var d=a.operator,h=a.field;return"["+e(d)+h+"]";case 4:return"["+a.field+"]";case 6:var f=a.operator;return"[["+a.field+n(e(f))+t(s)+"]]";case 7:return s;case 8:return"#"+s;case 9:return"."+s;case 17:case 15:return r(a.parent,i)+n(">")+r(a.child,i);case 18:case 16:return r(a.ancestor,i)+" "+r(a.descendant,i);case 19:var p=r(a.left,i),v=r(a.subject,i),g=r(a.right,i);return p+(p.length>0?" ":"")+v+g;case po:return""}}(s,i)},"")},a="",i=0;i1&&i=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),l=!0),(o||u||l)&&(a=o||s?""+e:"",i=""+n),l&&(e=a=a.toLowerCase(),n=i=i.toLowerCase()),t){case"*=":r=a.indexOf(i)>=0;break;case"$=":r=a.indexOf(i,a.length-i.length)>=0;break;case"^=":r=0===a.indexOf(i);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var l=a.shift();t(l),i.add(l.id()),o&&r(a,i,l)}return e}function Lo(e,t,n){if(n.isParent())for(var r=n._private.children,a=0;a1&&void 0!==arguments[1])||arguments[1],Lo)},No.forEachUp=function(e){return Ro(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Oo)},No.forEachUpAndDown=function(e){return Ro(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],zo)},No.ancestors=No.parents,(Mo=Ao={data:lo.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:lo.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:lo.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:lo.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:lo.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:lo.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Mo.data,Mo.removeAttr=Mo.removeData;var jo,Vo,Fo=Ao,Yo={};function qo(e){return function(t){var n=this;if(void 0===t&&(t=!0),0!==n.length&&n.isNode()&&!n.removed()){for(var r=0,a=n[0],i=a._private.edges,o=0;ot}),minIndegree:Xo("indegree",function(e,t){return et}),minOutdegree:Xo("outdegree",function(e,t){return et})}),ye(Yo,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=l;l&&(u=u[0]);var d=c?u.position():{x:0,y:0};return a={x:s.x-d.x,y:s.y-d.y},void 0===e?a:a[e]}for(var h=0;h0,g=v;v&&(p=p[0]);var y=g?p.position():{x:0,y:0};void 0!==t?f.position(e,t+y[e]):void 0!==a&&f.position({x:a.x+y.x,y:a.y+y.y})}}else if(!i)return;return this}},jo.modelPosition=jo.point=jo.position,jo.modelPositions=jo.points=jo.positions,jo.renderedPoint=jo.renderedPosition,jo.relativePoint=jo.relativePosition;var Go,Ho,Ko=Vo;Go=Ho={},Ho.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),a=n.pan(),i=t.x1*r+a.x,o=t.x2*r+a.x,s=t.y1*r+a.y,u=t.y2*r+a.y;return{x1:i,x2:o,y1:s,y2:u,w:o-i,h:u-s}},Ho.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}}),this):this},Ho.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,a={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},i=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==i.w&&0!==i.h||((i={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-i.w/2,i.x2=o.x+i.w/2,i.y1=o.y-i.h/2,i.y2=o.y+i.h/2);var s=a.width.left.value;"px"===a.width.left.units&&a.width.val>0&&(s=100*s/a.width.val);var u=a.width.right.value;"px"===a.width.right.units&&a.width.val>0&&(u=100*u/a.width.val);var l=a.height.top.value;"px"===a.height.top.units&&a.height.val>0&&(l=100*l/a.height.val);var c=a.height.bottom.value;"px"===a.height.bottom.units&&a.height.val>0&&(c=100*c/a.height.val);var d=y(a.width.val-i.w,s,u),h=d.biasDiff,f=d.biasComplementDiff,p=y(a.height.val-i.h,l,c),v=p.biasDiff,g=p.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(i.w,i.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(i.w,a.width.val),o.x=(-h+i.x1+i.x2+f)/2,t.autoHeight=Math.max(i.h,a.height.val),o.y=(-v+i.y1+i.y2+g)/2}function y(e,t,n){var r=0,a=0,i=t+n;return e>0&&i>0&&(r=t/i*e,a=n/i*e),{biasDiff:r,biasComplementDiff:a}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Qo=function(e,t){return null==t?e:$o(e,t.x1,t.y1,t.x2,t.y2)},Jo=function(e,t,n){return dt(e,t,n)},es=function(e,t,n){if(!t.cy().headless()){var r,a,i=t._private,o=i.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,a=o.srcY):"target"===n?(r=o.tgtX,a=o.tgtY):(r=o.midX,a=o.midY);var u=i.arrowBounds=i.arrowBounds||{},l=u[n]=u[n]||{};l.x1=r-s,l.y1=a-s,l.x2=r+s,l.y2=a+s,l.w=l.x2-l.x1,l.h=l.y2-l.y1,en(l,1),$o(e,l.x1,l.y1,l.x2,l.y2)}}},ts=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var a=t._private,i=a.rstyle;if(t.pstyle(r+"label").strValue){var o,s,u,l,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=Jo(i,"labelWidth",n),f=Jo(i,"labelHeight",n),p=Jo(i,"labelX",n),v=Jo(i,"labelY",n),g=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,k=f,_=h,C=_/2,T=k/2;if(m)o=p-C,s=p+C,u=v-T,l=v+T;else{switch(c.value){case"left":o=p-_,s=p;break;case"center":o=p-C,s=p+C;break;case"right":o=p,s=p+_}switch(d.value){case"top":u=v-k,l=v;break;case"center":u=v-T,l=v+T;break;case"bottom":u=v,l=v+k}}var S=g-Math.max(x,w)-E-2,P=g+Math.max(x,w)+E+2,B=y-Math.max(x,w)-E-2,D=y+Math.max(x,w)+E+2;o+=S,s+=P,u+=B,l+=D;var M=n||"main",A=a.labelBounds,I=A[M]=A[M]||{};I.x1=o,I.y1=u,I.x2=s,I.y2=l,I.w=s-o,I.h=l-u,I.leftPad=S,I.rightPad=P,I.topPad=B,I.botPad=D;var N=m&&"autorotate"===b.strValue,R=null!=b.pfValue&&0!==b.pfValue;if(N||R){var L=N?Jo(a.rstyle,"labelAngle",n):b.pfValue,O=Math.cos(L),z=Math.sin(L),j=(o+s)/2,V=(u+l)/2;if(!m){switch(c.value){case"left":j=s;break;case"right":j=o}switch(d.value){case"top":V=l;break;case"bottom":V=u}}var F=function(e,t){return{x:(e-=j)*O-(t-=V)*z+j,y:e*z+t*O+V}},Y=F(o,u),q=F(o,l),X=F(s,u),W=F(s,l);o=Math.min(Y.x,q.x,X.x,W.x),s=Math.max(Y.x,q.x,X.x,W.x),u=Math.min(Y.y,q.y,X.y,W.y),l=Math.max(Y.y,q.y,X.y,W.y)}var U=M+"Rot",G=A[U]=A[U]||{};G.x1=o,G.y1=u,G.x2=s,G.y2=l,G.w=s-o,G.h=l-u,$o(e,o,u,s,l),$o(a.labelBounds.all,o,u,s,l)}return e}},ns=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value+t.pstyle("outline-offset").value;rs(e,t,n,r,"outside",r/2)}},rs=function(e,t,n,r,a,i){if(!(0===n||r<=0||"inside"===a)){var o=t.cy(),s=t.pstyle("shape").value,u=o.renderer().nodeShapes[s],l=t.position(),c=l.x,d=l.y,h=t.width(),f=t.height();if(u.hasMiterBounds){"center"===a&&(r/=2);var p=u.miterBounds(c,d,h,f,r);Qo(e,p)}else null!=i&&i>0&&tn(e,[i,i,i,i])}},as=function(e){var t=0,n=function(e){return(e?1:0)<(r=P[1].x)){var B=n;n=r,r=B}if(a>(i=P[1].y)){var D=a;a=i,i=D}$o(h,n-k,a-k,r+k,i+k)}}else if("bezier"===S||"unbundled-bezier"===S||ce(S,"segments")||ce(S,"taxi")){var M;switch(S){case"bezier":case"unbundled-bezier":M=g.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":M=g.linePts}if(null!=M)for(var A=0;A(r=R.x)){var L=n;n=r,r=L}if((a=N.y)>(i=R.y)){var O=a;a=i,i=O}$o(h,n-=k,a-=k,r+=k,i+=k)}if(c&&t.includeEdges&&v&&(es(h,e,"mid-source"),es(h,e,"mid-target"),es(h,e,"source"),es(h,e,"target")),c&&"yes"===e.pstyle("ghost").value){var z=e.pstyle("ghost-offset-x").pfValue,j=e.pstyle("ghost-offset-y").pfValue;$o(h,h.x1+z,h.y1+j,h.x2+z,h.y2+j)}var V=f.bodyBounds=f.bodyBounds||{};nn(V,h),tn(V,y),en(V,1),c&&(n=h.x1,r=h.x2,a=h.y1,i=h.y2,$o(h,n-E,a-E,r+E,i+E));var F=f.overlayBounds=f.overlayBounds||{};nn(F,h),tn(F,y),en(F,1);var Y=f.labelBounds=f.labelBounds||{};null!=Y.all?((u=Y.all).x1=1/0,u.y1=1/0,u.x2=-1/0,u.y2=-1/0,u.w=0,u.h=0):Y.all=$t(),c&&t.includeLabels&&(t.includeMainLabels&&ts(h,e,null),v&&(t.includeSourceLabels&&ts(h,e,"source"),t.includeTargetLabels&&ts(h,e,"target")))}return h.x1=Zo(h.x1),h.y1=Zo(h.y1),h.x2=Zo(h.x2),h.y2=Zo(h.y2),h.w=Zo(h.x2-h.x1),h.h=Zo(h.y2-h.y1),h.w>0&&h.h>0&&b&&(tn(h,y),en(h,1)),h}(e,ss),r.bbCache=n,r.bbCachePosKey=is(e)):n=r.bbCache,!i){var o=e.isNode();n=$t(),(t.includeNodes&&o||t.includeEdges&&!o)&&(t.includeOverlays?Qo(n,r.overlayBounds):Qo(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!a||t.includeSourceLabels&&t.includeTargetLabels)?Qo(n,r.labelBounds.all):(t.includeMainLabels&&Qo(n,r.labelBounds.mainRot),t.includeSourceLabels&&Qo(n,r.labelBounds.sourceRot),t.includeTargetLabels&&Qo(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},ss={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},us=as(ss),ls=ut(ss);Ho.boundingBox=function(e){var t,n=void 0===e||void 0===e.useCache||!0===e.useCache,r=ie(function(e){var t=e._private;return null==t.bbCache||t.styleDirty||t.bbCachePosKey!==is(e)},function(e){return e.id()});if(n&&1===this.length&&!r(this[0]))e=void 0===e?ss:ls(e),t=os(this[0],e);else{t=$t();var a=ls(e=e||ss),i=this,o=i.cy().styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),o&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:_s,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},Ts.removeAllListeners=function(){return this.removeListener("*")},Ts.emit=Ts.trigger=function(e,t,n){var r=this.listeners,a=r.length;return this.emitting++,H(t)||(t=[t]),function(e,t,n){if("event"!==W(n))if(K(n))t(e,Ps(e,n));else for(var r=H(n)?n:n.split(/\s+/),a=0;a1&&!r){var a=this.length-1,i=this[a],o=i._private.data.id;this[a]=void 0,this[e]=i,n.set(o,{ele:i,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var a=r.index;return this.unmergeAt(a),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&U(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],r=this,a=0;ar&&(r=s,n=o)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,a=this,i=0;i=0&&a1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n));var a=n._private.style[e];return null!=a?a:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style();if(K(e)){var i=e;a.applyBypass(this,i,r),this.emitAndNotify("style")}else if(U(e)){if(void 0===t){var o=this[0];return o?a.getStylePropertyValue(o,e):void 0}a.applyBypass(this,e,t,r),this.emitAndNotify("style")}else if(void 0===e){var s=this[0];return s?a.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),a=this;if(void 0===e)for(var i=0;i0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Js.neighbourhood=Js.neighborhood,Js.closedNeighbourhood=Js.closedNeighborhood,Js.openNeighbourhood=Js.openNeighborhood,ye(Js,{source:Io(function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t},"source"),target:Io(function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t},"target"),sources:ru({attr:"source"}),targets:ru({attr:"target"})}),ye(Js,{edgesWith:Io(au(),"edgesWith"),edgesTo:Io(au({thisIsSrc:!0}),"edgesTo")}),ye(Js,{connectedEdges:Io(function(e){for(var t=[],n=0;n0);return i},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Js.componentsOf=Js.components;var ou=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var a=new ft,i=!1;if(t){if(t.length>0&&K(t[0])&&!J(t[0])){i=!0;for(var o=[],s=new vt,u=0,l=t.length;u0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=this,i=a.cy(),o=i._private,s=[],u=[],l=0,c=a.length;l0){for(var N=e.length===a.length?a:new ou(i,e),R=0;R0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],a={},i=n._private.cy;function o(e){var n=a[e.id()];t&&e.removed()||n||(a[e.id()]=!0,e.isNode()?(r.push(e),function(e){for(var t=e._private.edges,n=0;n0&&(e?k.emitAndNotify("remove"):t&&k.emit("remove"));for(var _=0;_=.001?function(t,r){for(var a=0;a<4;++a){var i=h(r,e,n);if(0===i)return r;r-=(d(r,e,n)-t)/i}return r}(t,o):0===u?o:function(t,r,a){var i,o,s=0;do{(i=d(o=r+(a-r)/2,e,n)-t)>0?a=o:r=o}while(Math.abs(i)>1e-7&&++s<10);return o}(t,r,r+a)}(i),t,r)};p.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var v="generateBezier("+[e,t,n,r]+")";return p.toString=function(){return v},p}var cu=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var a={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:a.v,dv:e(a)}}function n(n,r){var a={dx:n.v,dv:e(n)},i=t(n,.5*r,a),o=t(n,.5*r,i),s=t(n,r,o),u=1/6*(a.dx+2*(i.dx+o.dx)+s.dx),l=1/6*(a.dv+2*(i.dv+o.dv)+s.dv);return n.x=n.x+u*r,n.v=n.v+l*r,n}return function e(t,r,a){var i,o,s,u={x:-1,v:0,tension:null,friction:null},l=[0],c=0,d=1e-4;for(t=parseFloat(t)||500,r=parseFloat(r)||20,a=a||null,u.tension=t,u.friction=r,o=(i=null!==a)?(c=e(t,r))/a*.016:.016;s=n(s||u,o),l.push(1+s.x),c+=16,Math.abs(s.x)>d&&Math.abs(s.v)>d;);return i?function(e){return l[e*(l.length-1)|0]}:c}}(),du=function(e,t,n,r){var a=lu(e,t,n,r);return function(e,t,n){return e+(t-e)*a(n)}},hu={linear:function(e,t,n){return e+(t-e)*n},ease:du(.25,.1,.25,1),"ease-in":du(.42,0,1,1),"ease-out":du(0,0,.58,1),"ease-in-out":du(.42,0,.58,1),"ease-in-sine":du(.47,0,.745,.715),"ease-out-sine":du(.39,.575,.565,1),"ease-in-out-sine":du(.445,.05,.55,.95),"ease-in-quad":du(.55,.085,.68,.53),"ease-out-quad":du(.25,.46,.45,.94),"ease-in-out-quad":du(.455,.03,.515,.955),"ease-in-cubic":du(.55,.055,.675,.19),"ease-out-cubic":du(.215,.61,.355,1),"ease-in-out-cubic":du(.645,.045,.355,1),"ease-in-quart":du(.895,.03,.685,.22),"ease-out-quart":du(.165,.84,.44,1),"ease-in-out-quart":du(.77,0,.175,1),"ease-in-quint":du(.755,.05,.855,.06),"ease-out-quint":du(.23,1,.32,1),"ease-in-out-quint":du(.86,0,.07,1),"ease-in-expo":du(.95,.05,.795,.035),"ease-out-expo":du(.19,1,.22,1),"ease-in-out-expo":du(1,0,0,1),"ease-in-circ":du(.6,.04,.98,.335),"ease-out-circ":du(.075,.82,.165,1),"ease-in-out-circ":du(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return hu.linear;var r=cu(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":du};function fu(e,t,n,r,a){if(1===r)return n;if(t===n)return n;var i=a(t,n,r);return null==e||((e.roundValue||e.color)&&(i=Math.round(i)),void 0!==e.min&&(i=Math.max(i,e.min)),void 0!==e.max&&(i=Math.min(i,e.max))),i}function pu(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function vu(e,t,n,r,a){var i=null!=a?a.type:null;n<0?n=0:n>1&&(n=1);var o=pu(e,a),s=pu(t,a);if(Z(o)&&Z(s))return fu(i,o,s,n,r);if(H(o)&&H(s)){for(var u=[],l=0;l0?("spring"===d&&h.push(o.duration),o.easingImpl=hu[d].apply(null,h)):o.easingImpl=hu[d]}var f,p=o.easingImpl;if(f=0===o.duration?1:(n-u)/o.duration,o.applying&&(f=o.progress),f<0?f=0:f>1&&(f=1),null==o.delay){var v=o.startPosition,g=o.position;if(g&&a&&!e.locked()){var y={};yu(v.x,g.x)&&(y.x=vu(v.x,g.x,f,p)),yu(v.y,g.y)&&(y.y=vu(v.y,g.y,f,p)),e.position(y)}var m=o.startPan,b=o.pan,x=i.pan,w=null!=b&&r;w&&(yu(m.x,b.x)&&(x.x=vu(m.x,b.x,f,p)),yu(m.y,b.y)&&(x.y=vu(m.y,b.y,f,p)),e.emit("pan"));var E=o.startZoom,k=o.zoom,_=null!=k&&r;_&&(yu(E,k)&&(i.zoom=Zt(i.minZoom,vu(E,k,f,p),i.maxZoom)),e.emit("zoom")),(w||_)&&e.emit("viewport");var C=o.style;if(C&&C.length>0&&a){for(var T=0;T=0;t--)(0,e[t])();e.splice(0,e.length)},c=i.length-1;c>=0;c--){var d=i[c],h=d._private;h.stopped?(i.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,l(h.frames)):(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||mu(0,d,e),gu(t,d,e,n),h.applying&&(h.applying=!1),l(h.frames),null!=h.step&&h.step(e),d.completed()&&(i.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,l(h.completes)),s=!0)}return n||0!==i.length||0!==o.length||r.push(t),s}for(var i=!1,o=0;o0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var xu={animate:lo.animate(),animation:lo.animation(),animated:lo.animated(),clearQueue:lo.clearQueue(),delay:lo.delay(),delayAnimation:lo.delayAnimation(),stop:lo.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender(function(t,n){bu(n,e)},t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&Ne(function(n){bu(n,e),t()})}()}}},wu={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&J(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},Eu=function(e){return U(e)?new Po(e):e},ku={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Cs(wu,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Eu(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Eu(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Eu(t),n),this},once:function(e,t,n){return this.emitter().one(e,Eu(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};lo.eventAliasesOn(ku);var _u={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};_u.jpeg=_u.jpg;var Cu={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var n,r=e.name,a=t.extension("layout",r);if(null!=a)return n=U(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$(),new a(ye({},e,{cy:t,eles:n}));tt("No such layout `"+r+"` found. Did you forget to import it and `cytoscape.use()` it?")}else tt("A `name` must be specified to make a layout");else tt("Layout options must be specified to make a layout")}};Cu.createLayout=Cu.makeLayout=Cu.layout;var Tu={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var a=this.renderer();!this.destroyed()&&a&&a.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Pu.invalidateDimensions=Pu.resize;var Bu={collection:function(e,t){return U(e)?this.$(e):Q(e)?e.collection():H(e)?(t||(t={}),new ou(this,e,t.unique,t.removed)):new ou(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Bu.elements=Bu.filter=Bu.$;var Du={},Mu="t";Du.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r0;if(h||d&&f){var p=void 0;h&&f||h?p=l.properties:f&&(p=l.mappedProperties);for(var v=0;v1&&(g=1),s.color){var w=a.valueMin[0],E=a.valueMax[0],k=a.valueMin[1],_=a.valueMax[1],C=a.valueMin[2],T=a.valueMax[2],S=null==a.valueMin[3]?1:a.valueMin[3],P=null==a.valueMax[3]?1:a.valueMax[3],B=[Math.round(w+(E-w)*g),Math.round(k+(_-k)*g),Math.round(C+(T-C)*g),Math.round(S+(P-S)*g)];n={bypass:a.bypass,name:a.name,value:B,strValue:"rgb("+B[0]+", "+B[1]+", "+B[2]+")"}}else{if(!s.number)return!1;var D=a.valueMin+(a.valueMax-a.valueMin)*g;n=this.parse(a.name,D,a.bypass,h)}if(!n)return v(),!1;n.mapping=a,a=n;break;case o.data:for(var M=a.field.split("."),A=d.data,I=0;I0&&i>0){for(var s={},u=!1,l=0;l0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:i,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1)},Du.checkTrigger=function(e,t,n,r,a,i){var o=this.properties[t],s=a(o);e.removed()||null!=s&&s(n,r,e)&&i(o)},Du.checkZOrderTrigger=function(e,t,n,r){var a=this;this.checkTrigger(e,t,n,r,function(e){return e.triggersZOrder},function(){a._private.cy.notify("zorder",e)})},Du.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},Du.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfConnectedEdges},function(t){e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},Du.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfParallelEdges},function(t){e.parallelEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},Du.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var Au={applyBypass:function(e,t,n,r){var a=[];if("*"===t||"**"===t){if(void 0!==n)for(var i=0;it.length?i.substr(t.length):""}function s(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");!i.match(/^\s*$/);){var u=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!u){rt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=u[0];var l=u[1];if("core"!==l&&new Po(l).invalid)rt("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),o();else{var c=u[2],d=!1;n=c;for(var h=[];!n.match(/^\s*$/);){var f=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!f){rt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+c),d=!0;break}r=f[0];var p=f[1],v=f[2];this.properties[p]?a.parse(p,v)?(h.push({name:p,val:v}),s()):(rt("Skipping property: Invalid property definition in: "+r),s()):(rt("Skipping property: Invalid property name in: "+r),s())}if(d){o();break}a.selector(l);for(var g=0;g=7&&"d"===t[0]&&(l=new RegExp(s.data.regex).exec(t))){if(n)return!1;var h=s.data;return{name:e,value:l,strValue:""+t,mapped:h,field:l[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(c=new RegExp(s.mapData.regex).exec(t))){if(n)return!1;if(d.multiple)return!1;var f=s.mapData;if(!d.color&&!d.number)return!1;var p=this.parse(e,c[4]);if(!p||p.mapped)return!1;var v=this.parse(e,c[5]);if(!v||v.mapped)return!1;if(p.pfValue===v.pfValue||p.strValue===v.strValue)return rt("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(d.color){var g=p.value,y=v.value;if(!(g[0]!==y[0]||g[1]!==y[1]||g[2]!==y[2]||g[3]!==y[3]&&(null!=g[3]&&1!==g[3]||null!=y[3]&&1!==y[3])))return!1}return{name:e,value:c,strValue:""+t,mapped:f,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:p.value,valueMax:v.value,bypass:n}}}if(d.multiple&&"multiple"!==r){var m;if(m=u?t.split(/\s+/):H(t)?t:[t],d.evenMultiple&&m.length%2!=0)return null;for(var b=[],x=[],w=[],E="",k=!1,_=0;_0?" ":"")+C.strValue}return d.validate&&!d.validate(b,x)?null:d.singleEnum&&k?1===b.length&&U(b[0])?{name:e,value:b[0],strValue:b[0],bypass:n}:null:{name:e,value:b,pfValue:w,strValue:E,bypass:n,units:x}}var T,S,P=function(){for(var r=0;rd.max||d.strictMax&&t===d.max))return null;var I={name:e,value:t,strValue:""+t+(B||""),units:B,bypass:n};return d.unitless||"px"!==B&&"em"!==B?I.pfValue=t:I.pfValue="px"!==B&&B?this.getEmSizeInPixels()*t:t,"ms"!==B&&"s"!==B||(I.pfValue="ms"===B?t:1e3*t),"deg"!==B&&"rad"!==B||(I.pfValue="rad"===B?t:(T=t,Math.PI*T/180)),"%"===B&&(I.pfValue=t/100),I}if(d.propList){var N=[],R=""+t;if("none"===R);else{for(var L=R.split(/\s*,\s*|\s+/),O=0;O0&&u>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(u-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,a=r.pan,i=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),Z(e)?n=e:K(e)&&(n=e.level,null!=e.position?t=jt(e.position,i,a):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?i=!0:(t.zoom=s,a.push("zoom"))}if(r&&(!i||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;Z(u.x)&&(t.pan.x=u.x,o=!1),Z(u.y)&&(t.pan.y=u.y,o=!1),o||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(U(e)){var n=e;e=this.mutableElements().filter(n)}else Q(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),a=this.width(),i=this.height();return{x:(a-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(i-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container;return n.sizeCache=n.sizeCache||(r?(e=this.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};Yu.centre=Yu.center,Yu.autolockNodes=Yu.autolock,Yu.autoungrabifyNodes=Yu.autoungrabify;var qu={data:lo.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:lo.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:lo.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:lo.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};qu.attr=qu.data,qu.removeAttr=qu.removeData;var Xu=function(e){var t=this,n=(e=ye({},e)).container;n&&!$(n)&&$(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var a=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var i=void 0!==d&&void 0!==n&&!e.headless,o=e;o.layout=ye({name:i?"grid":"null"},o.layout),o.renderer=ye({name:i?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},u=this._private={container:n,ready:!1,options:o,elements:new ou(this),listeners:[],aniEles:new ou(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?i:o.styleEnabled,zoom:Z(o.zoom)?o.zoom:1,pan:{x:K(o.pan)&&Z(o.pan.x)?o.pan.x:0,y:K(o.pan)&&Z(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom}),u.styleEnabled&&t.setStyle([]);var l=ye({},o,o.renderer);t.initRenderer(l),function(e,t){if(e.some(ae))return Xr.all(e).then(t);t(e)}([o.style,o.elements],function(e){var n=e[0],i=e[1];u.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var a=t.mutableElements();a.length>0&&a.remove(),null!=e&&(K(e)||H(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",r),t.emit("done")});var i=ye({},t._private.options.layout);i.eles=t.elements(),t.layout(i).run()}(i,function(){t.startAnimationLoop(),u.ready=!0,G(o.ready)&&t.on("ready",o.ready);for(var e=0;e0,u=!!t.boundingBox,l=$t(u?t.boundingBox:structuredClone(n.extent()));if(Q(t.roots))e=t.roots;else if(H(t.roots)){for(var c=[],d=0;d0;){var B=P(),D=_(B,T);if(D)B.outgoers().filter(function(e){return e.isNode()&&r.has(e)}).forEach(S);else if(null===D){rt("Detected double maximal shift for node `"+B.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var M=0;if(t.avoidOverlap)for(var A=0;A0&&y[0].length<=3?i/2:0),s=2*Math.PI/y[r].length*a;return 0===r&&1===y[0].length&&(o=1),{x:W+o*Math.cos(s),y:G+o*Math.sin(s)}}var c=y[r].length,d=Math.max(1===c?0:u?(l.w-2*t.padding-K.w)/((t.grid?$:c)-1):(l.w-2*t.padding-K.w)/((t.grid?$:c)+1),M);return{x:W+(a+1-(c+1)/2)*d,y:G+(r+1-(j+1)/2)*Z}}(e),l,J[t.direction])}),this};var $u={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Qu(e){this.options=ye({},$u,e)}Qu.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));for(var o,s=$t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),u=s.x1+s.w/2,l=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/i.length:t.sweep)/Math.max(1,i.length-1),d=0,h=0;h1&&t.avoidOverlap){d*=1.75;var g=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(d*d/(g*g+y*y));o=Math.max(m,o)}return r.nodes().layoutPositions(this,t,function(e,n){var r=t.startAngle+n*c*(a?1:-1),i=o*Math.cos(r),s=o*Math.sin(r);return{x:u+i,y:l+s}}),this};var Ju,el={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function tl(e){this.options=ye({},el,e)}tl.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,a=t.eles,i=a.nodes().not(":parent"),o=$t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=o.x1+o.w/2,u=o.y1+o.h/2,l=[],c=0,d=0;d0&&Math.abs(m[0].value-x.value)>=g&&(m=[],y.push(m)),m.push(x)}var w=c+t.minNodeSpacing;if(!t.avoidOverlap){var E=y.length>0&&y[0].length>1,k=(Math.min(o.w,o.h)/2-w)/(y.length+E?1:0);w=Math.min(w,k)}for(var _=0,C=0;C1&&t.avoidOverlap){var B=Math.cos(P)-Math.cos(0),D=Math.sin(P)-Math.sin(0),M=Math.sqrt(w*w/(B*B+D*D));_=Math.max(M,_)}T.r=_,_+=w}if(t.equidistant){for(var A=0,I=0,N=0;N=e.numIter||(cl(r,e),r.temperature=r.temperature*e.coolingFactor,r.temperature=e.animationThreshold&&i(),Ne(c)):(El(r,e),s())};c()}else{for(;l;)l=o(u),u++;El(r,e),s()}return this},rl.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},rl.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var al=function(e,t,n){for(var r=n.eles.edges(),a=n.eles.nodes(),i=$t(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:i.w,clientHeight:i.h,boundingBox:i},s=n.eles.components(),u={},l=0;l0)for(o.graphSet.push(w),l=0;lr.count?0:r.graph},ol=function(e,t,n,r){var a=r.graphSet[n];if(-10)var s=(l=r.nodeOverlap*o)*a/(v=Math.sqrt(a*a+i*i)),u=l*i/v;else{var l,c=vl(e,a,i),d=vl(t,-1*a,-1*i),h=d.x-c.x,f=d.y-c.y,p=h*h+f*f,v=Math.sqrt(p);s=(l=(e.nodeRepulsion+t.nodeRepulsion)/p)*h/v,u=l*f/v}e.isLocked||(e.offsetX-=s,e.offsetY-=u),t.isLocked||(t.offsetX+=s,t.offsetY+=u)}},pl=function(e,t,n,r){if(n>0)var a=e.maxX-t.minX;else a=t.maxX-e.minX;if(r>0)var i=e.maxY-t.minY;else i=t.maxY-e.minY;return a>=0&&i>=0?Math.sqrt(a*a+i*i):0},vl=function(e,t,n){var r=e.positionX,a=e.positionY,i=e.height||1,o=e.width||1,s=n/t,u=i/o,l={};return 0===t&&0n?(l.x=r,l.y=a+i/2,l):0t&&-1*u<=s&&s<=u?(l.x=r-o/2,l.y=a-o*n/2/t,l):0=u)?(l.x=r+i*t/2/n,l.y=a+i/2,l):0>n&&(s<=-1*u||s>=u)?(l.x=r-i*t/2/n,l.y=a-i/2,l):l},gl=function(e,t){for(var n=0;n1){var p=t.gravity*d/f,v=t.gravity*h/f;c.offsetX+=p,c.offsetY+=v}}}}},ml=function(e,t){var n=[],r=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;r<=a;){var i=n[r++],o=e.idToIndex[i],s=e.layoutNodes[o],u=s.children;if(0n)var a={x:n*e/r,y:n*t/r};else a={x:e,y:t};return a},wl=function(e,t){var n=e.parentId;if(null!=n){var r=t.layoutNodes[t.idToIndex[n]],a=!1;return(null==r.maxX||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,a=!0),(null==r.minX||e.minX-r.padLeftr.maxY)&&(r.maxY=e.maxY+r.padBottom,a=!0),(null==r.minY||e.minY-r.padTopp&&(d+=f+t.componentSpacing,c=0,h=0,f=0)}}},kl={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function _l(e){this.options=ye({},kl,e)}_l.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));var i=$t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===i.h||0===i.w)r.nodes().layoutPositions(this,t,function(e){return{x:i.x1,y:i.y1}});else{var o=a.size(),s=Math.sqrt(o*i.h/i.w),u=Math.round(s),l=Math.round(i.w/i.h*s),c=function(e){if(null==e)return Math.min(u,l);Math.min(u,l)==u?u=e:l=e},d=function(e){if(null==e)return Math.max(u,l);Math.max(u,l)==u?u=e:l=e},h=t.rows,f=null!=t.cols?t.cols:t.columns;if(null!=h&&null!=f)u=h,l=f;else if(null!=h&&null==f)u=h,l=Math.ceil(o/u);else if(null==h&&null!=f)l=f,u=Math.ceil(o/l);else if(l*u>o){var p=c(),v=d();(p-1)*v>=o?c(p-1):(v-1)*p>=o&&d(v-1)}else for(;l*u=o?d(y+1):c(g+1)}var m=i.w/l,b=i.h/u;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x=l&&(M=0,D++)},I={},N=0;N(r=fn(e,t,x[w],x[w+1],x[w+2],x[w+3])))return g(n,r),!0}else if("bezier"===i.edgeType||"multibezier"===i.edgeType||"self"===i.edgeType||"compound"===i.edgeType)for(x=i.allpts,w=0;w+5(r=hn(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return g(n,r),!0;m=m||a.source,b=b||a.target;var E=o.getArrowWidth(u,c),k=[{name:"source",x:i.arrowStartX,y:i.arrowStartY,angle:i.srcArrowAngle},{name:"target",x:i.arrowEndX,y:i.arrowEndY,angle:i.tgtArrowAngle},{name:"mid-source",x:i.midX,y:i.midY,angle:i.midsrcArrowAngle},{name:"mid-target",x:i.midX,y:i.midY,angle:i.midtgtArrowAngle}];for(w=0;w0&&(y(m),y(b))}function b(e,t,n){return dt(e,t,n)}function x(n,r){var a,i=n._private,o=p;a=r?r+"-":"",n.boundingBox();var s=i.labelBounds[r||"main"],u=n.pstyle(a+"label").value;if("yes"===n.pstyle("text-events").strValue&&u){var l=b(i.rscratch,"labelX",r),c=b(i.rscratch,"labelY",r),d=b(i.rscratch,"labelAngle",r),h=n.pstyle(a+"text-margin-x").pfValue,f=n.pstyle(a+"text-margin-y").pfValue,v=s.x1-o-h,y=s.x2+o-h,m=s.y1-o-f,x=s.y2+o-f;if(d){var w=Math.cos(d),E=Math.sin(d),k=function(e,t){return{x:(e-=l)*w-(t-=c)*E+l,y:e*E+t*w+c}},_=k(v,m),C=k(v,x),T=k(y,m),S=k(y,x),P=[_.x+h,_.y+f,T.x+h,T.y+f,S.x+h,S.y+f,C.x+h,C.y+f];if(pn(e,t,P))return g(n),!0}else if(an(s,e,t))return g(n),!0}}n&&(u=u.interactive);for(var w=u.length-1;w>=0;w--){var E=u[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return l},getAllInBox:function(e,t,n,r){var a=this.getCachedZSortedEles().interactive,i=2/this.cy.zoom(),s=[],u=Math.min(e,n),l=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),h=$t({x1:e=u,y1:t=c,x2:n=l,y2:r=d}),f=[{x:h.x1,y:h.y1},{x:h.x2,y:h.y1},{x:h.x2,y:h.y2},{x:h.x1,y:h.y2}],p=[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]],[f[3],f[0]]];function v(e,t,n){return dt(e,t,n)}function g(e,t){var n=e._private,r=i;e.boundingBox();var a=n.labelBounds.main;if(!a)return null;var o=v(n.rscratch,"labelX",t),s=v(n.rscratch,"labelY",t),u=v(n.rscratch,"labelAngle",t),l=e.pstyle("text-margin-x").pfValue,c=e.pstyle("text-margin-y").pfValue,d=a.x1-r-l,h=a.x2+r-l,f=a.y1-r-c,p=a.y2+r-c;if(u){var g=Math.cos(u),y=Math.sin(u),m=function(e,t){return{x:(e-=o)*g-(t-=s)*y+o,y:e*y+t*g+s}};return[m(d,f),m(h,f),m(h,p),m(d,p)]}return[{x:d,y:f},{x:h,y:f},{x:h,y:p},{x:d,y:p}]}function y(e,t,n,r){function a(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}return a(e,n,r)!==a(t,n,r)&&a(e,t,n)!==a(e,t,r)}for(var m=0;m4&&void 0!==arguments[4])||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(function(e,t,n,r,a){var i,o;if(e!==ec?rc(t,e,tc):((o=tc).x=-1*(i=nc).x,o.y=-1*i.y,o.nx=-1*i.nx,o.ny=-1*i.ny,o.ang=i.ang>0?-(Math.PI-i.ang):Math.PI+i.ang),rc(t,n,nc),Vl=tc.nx*nc.ny-tc.ny*nc.nx,Fl=tc.nx*nc.nx-tc.ny*-nc.ny,Xl=Math.asin(Math.max(-1,Math.min(1,Vl))),Math.abs(Xl)<1e-6)return zl=t.x,jl=t.y,void(Ul=Hl=0);Yl=1,ql=!1,Fl<0?Xl<0?Xl=Math.PI+Xl:(Xl=Math.PI-Xl,Yl=-1,ql=!0):Xl>0&&(Yl=-1,ql=!0),Hl=void 0!==t.radius?t.radius:r,Wl=Xl/2,Kl=Math.min(tc.len/2,nc.len/2),a?(Gl=Math.abs(Math.cos(Wl)*Hl/Math.sin(Wl)))>Kl?(Gl=Kl,Ul=Math.abs(Gl*Math.sin(Wl)/Math.cos(Wl))):Ul=Hl:(Gl=Math.min(Kl,Hl),Ul=Math.abs(Gl*Math.sin(Wl)/Math.cos(Wl))),Ql=t.x+nc.nx*Gl,Jl=t.y+nc.ny*Gl,zl=Ql-nc.ny*Ul*Yl,jl=Jl+nc.nx*Ul*Yl,Zl=t.x+tc.nx*Gl,$l=t.y+tc.ny*Gl,ec=t}(e,t,n,r,a),{cx:zl,cy:jl,radius:Ul,startX:Zl,startY:$l,stopX:Ql,stopY:Jl,startAngle:tc.ang+Math.PI/2*Yl,endAngle:nc.ang-Math.PI/2*Yl,counterClockwise:ql})}var oc=.01,sc=Math.sqrt(.02),uc={};function lc(e){var t=[];if(null!=e){for(var n=0;n0?Math.max(e-t,0):Math.min(e+t,0)},S=T(_,E),P=T(C,k),B=!1;"auto"===g?v=Math.abs(S)>Math.abs(P)?a:r:g===u||g===s?(v=r,B=!0):g!==i&&g!==o||(v=a,B=!0);var D,M=v===r,A=M?P:S,I=M?C:_,N=Xt(I),R=!1;B&&(m||x)||!(g===s&&I<0||g===u&&I>0||g===i&&I>0||g===o&&I<0)||(A=(N*=-1)*Math.abs(A),R=!0);var L=function(e){return Math.abs(e)=Math.abs(A)},O=L(D=m?(b<0?1+b:b)*A:(b<0?A:0)+b*N),z=L(Math.abs(A)-Math.abs(D));if(!O&&!z||R)if(M){var j=l.y1+D+(p?d/2*N:0),V=l.x1,F=l.x2;n.segpts=[V,j,F,j]}else{var Y=l.x1+D+(p?c/2*N:0),q=l.y1,X=l.y2;n.segpts=[Y,q,Y,X]}else if(M){var W=Math.abs(I)<=d/2,U=Math.abs(_)<=h/2;if(W){var G=(l.x1+l.x2)/2,H=l.y1,K=l.y2;n.segpts=[G,H,G,K]}else if(U){var Z=(l.y1+l.y2)/2,$=l.x1,Q=l.x2;n.segpts=[$,Z,Q,Z]}else n.segpts=[l.x1,l.y2]}else{var J=Math.abs(I)<=c/2,ee=Math.abs(C)<=f/2;if(J){var te=(l.y1+l.y2)/2,ne=l.x1,re=l.x2;n.segpts=[ne,te,re,te]}else if(ee){var ae=(l.x1+l.x2)/2,ie=l.y1,oe=l.y2;n.segpts=[ae,ie,ae,oe]}else n.segpts=[l.x2,l.y1]}if(n.isRound){var se=e.pstyle("taxi-radius").value,ue="arc-radius"===e.pstyle("radius-type").value[0];n.radii=new Array(n.segpts.length/2).fill(se),n.isArcRadius=new Array(n.segpts.length/2).fill(ue)}},uc.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,a=t.tgtPos,i=t.srcW,o=t.srcH,s=t.tgtW,u=t.tgtH,l=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,f=t.srcRs,p=t.tgtRs,v=!Z(n.startX)||!Z(n.startY),g=!Z(n.arrowStartX)||!Z(n.arrowStartY),y=!Z(n.endX)||!Z(n.endY),m=!Z(n.arrowEndX)||!Z(n.arrowEndY),b=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth*3,x=Wt({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),w=xv.poolIndex()){var g=p;p=v,v=g}var y=d.srcPos=p.position(),m=d.tgtPos=v.position(),b=d.srcW=p.outerWidth(),x=d.srcH=p.outerHeight(),E=d.tgtW=v.outerWidth(),k=d.tgtH=v.outerHeight(),_=d.srcShape=n.nodeShapes[t.getNodeShape(p)],C=d.tgtShape=n.nodeShapes[t.getNodeShape(v)],T=d.srcCornerRadius="auto"===p.pstyle("corner-radius").value?"auto":p.pstyle("corner-radius").pfValue,S=d.tgtCornerRadius="auto"===v.pstyle("corner-radius").value?"auto":v.pstyle("corner-radius").pfValue,P=d.tgtRs=v._private.rscratch,B=d.srcRs=p._private.rscratch;d.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var D=0;D=sc||(X=Math.sqrt(Math.max(q*q,oc)+Math.max(Y*Y,oc)));var W=d.vector={x:q,y:Y},U=d.vectorNorm={x:W.x/X,y:W.y/X},G={x:-U.y,y:U.x};d.nodesOverlap=!Z(X)||C.checkPoint(L[0],L[1],0,E,k,m.x,m.y,S,P)||_.checkPoint(z[0],z[1],0,b,x,y.x,y.y,T,B),d.vectorNormInverse=G,e={nodesOverlap:d.nodesOverlap,dirCounts:d.dirCounts,calculatedIntersection:!0,hasBezier:d.hasBezier,hasUnbundled:d.hasUnbundled,eles:d.eles,srcPos:m,srcRs:P,tgtPos:y,tgtRs:B,srcW:E,srcH:k,tgtW:b,tgtH:x,srcIntn:j,tgtIntn:O,srcShape:C,tgtShape:_,posPts:{x1:F.x2,y1:F.y2,x2:F.x1,y2:F.y1},intersectionPts:{x1:V.x2,y1:V.y2,x2:V.x1,y2:V.y1},vector:{x:-W.x,y:-W.y},vectorNorm:{x:-U.x,y:-U.y},vectorNormInverse:{x:-G.x,y:-G.y}}}var H=R?e:d;A.nodesOverlap=H.nodesOverlap,A.srcIntn=H.srcIntn,A.tgtIntn=H.tgtIntn,A.isRound=I.startsWith("round"),r&&(p.isParent()||p.isChild()||v.isParent()||v.isChild())&&(p.parents().anySame(v)||v.parents().anySame(p)||p.same(v)&&p.isParent())?t.findCompoundLoopPoints(M,H,D,N):p===v?t.findLoopPoints(M,H,D,N):I.endsWith("segments")?t.findSegmentsPoints(M,H):I.endsWith("taxi")?t.findTaxiPoints(M,H):"straight"===I||!N&&d.eles.length%2==1&&D===Math.floor(d.eles.length/2)?t.findStraightEdgePoints(M):t.findBezierPoints(M,H,D,N,R),t.findEndpoints(M),t.tryToCorrectInvalidPoints(M,H),t.checkForInvalidEdgeWarning(M),t.storeAllpts(M),t.storeEdgeProjections(M),t.calculateArrowAngles(M),t.recalculateEdgeLabelProjections(M),t.calculateLabelAngles(M)}},w=0;w0){var J=f,ee=Ut(J,Ft(i)),te=Ut(J,Ft(Q)),ne=ee;te2&&Ut(J,{x:Q[2],y:Q[3]})0){var ge=p,ye=Ut(ge,Ft(i)),me=Ut(ge,Ft(ve)),be=ye;me2&&Ut(ge,{x:ve[2],y:ve[3]})=l||m){c={cp:v,segment:y};break}}if(c)break}var b=c.cp,x=c.segment,w=(l-h)/x.length,E=x.t1-x.t0,k=s?x.t0+E*w:x.t1-E*w;k=Zt(0,k,1),t=Kt(b.p0,b.p1,b.p2,k),a=function(e,t,n,r){var a=Zt(0,r-.001,1),i=Zt(0,r+.001,1),o=Kt(e,t,n,a),s=Kt(e,t,n,i);return vc(o,s)}(b.p0,b.p1,b.p2,k);break;case"straight":case"segments":case"haystack":for(var _,C,T,S,P=0,B=r.allpts.length,D=0;D+3=l));D+=2);var M=(l-C)/_;M=Zt(0,M,1),t=function(e,t,n,r){var a=t.x-e.x,i=t.y-e.y,o=Wt(e,t),s=a/o,u=i/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+u*r}}(T,S,M),a=vc(T,S)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,a)}};l("source"),l("target"),this.applyLabelDimensions(e)}},fc.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},fc.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),a=Xe(r,e._private.labelDimsKey);if(dt(n.rscratch,"prefixedLabelDimsKey",t)!==a){ht(n.rscratch,"prefixedLabelDimsKey",t,a);var i=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,s=e.pstyle("text-wrap").strValue,u=dt(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==s?1:Math.max(u.length,1),c=i.height/l,d=c*o,h=i.width,f=i.height+(l-1)*(o-1)*c;ht(n.rstyle,"labelWidth",t,h),ht(n.rscratch,"labelWidth",t,h),ht(n.rstyle,"labelHeight",t,f),ht(n.rscratch,"labelHeight",t,f),ht(n.rscratch,"labelLineHeight",t,d)}},fc.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,o=e.pstyle("text-transform").value,s=function(e,r){return r?(ht(n.rscratch,e,t,r),r):dt(n.rscratch,e,t)};if(!i)return"";"none"==o||("uppercase"==o?i=i.toUpperCase():"lowercase"==o&&(i=i.toLowerCase()));var u=e.pstyle("text-wrap").value;if("wrap"===u){var l=s("labelKey");if(null!=l&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var c=i.split("\n"),d=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,f=[],p=/[\s\u200b]+|$/g,v=0;vd){var b,x="",w=0,E=a(g.matchAll(p));try{for(E.s();!(b=E.n()).done;){var k=b.value,_=k[0],C=g.substring(w,k.index);w=k.index+_.length;var T=0===x.length?C:x+C+_;this.calculateLabelDimensions(e,T).width<=d?x+=C+_:(x&&f.push(x),x=C+_)}}catch(e){E.e(e)}finally{E.f()}x.match(/^[\s\u200b]+$/)||f.push(x)}else f.push(g)}s("labelWrapCachedLines",f),i=s("labelWrapCachedText",f.join("\n")),s("labelWrapKey",l)}else if("ellipsis"===u){var S=e.pstyle("text-max-width").pfValue,P="",B=!1;if(this.calculateLabelDimensions(e,i).widthS);D++)P+=i[D],D===i.length-1&&(B=!0);return B||(P+="…"),P}return i},fc.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},fc.calculateLabelDimensions=function(e,t){var n=this.cy.window().document,r=e.pstyle("font-style").strValue,a=e.pstyle("font-size").pfValue,i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=this.labelCalcCanvas,u=this.labelCalcCanvasContext;if(!s){s=this.labelCalcCanvas=n.createElement("canvas"),u=this.labelCalcCanvasContext=s.getContext("2d");var l=s.style;l.position="absolute",l.left="-9999px",l.top="-9999px",l.zIndex="-1",l.visibility="hidden",l.pointerEvents="none"}u.font="".concat(r," ").concat(o," ").concat(a,"px ").concat(i);for(var c=0,d=0,h=t.split("\n"),f=0;f1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var T=a(t);g&&(e.hoverData.tapholdCancelled=!0),n=!0,r(v,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var S=function(e){return{originalEvent:t,type:e,position:{x:c[0],y:c[1]}}},P=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit(S("boxstart")),p[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(g){var B=S("cxtdrag");b?b.emit(B):o.emit(B),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&v===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(S("cxtdragout")),e.hoverData.cxtOver=v,v&&v.emit(S("cxtdragover")))}}else if(e.hoverData.dragging){if(n=!0,o.panningEnabled()&&o.userPanningEnabled()){var D;if(e.hoverData.justStartedPan){var M=e.hoverData.mdownPos;D={x:(c[0]-M[0])*s,y:(c[1]-M[1])*s},e.hoverData.justStartedPan=!1}else D={x:x[0]*s,y:x[1]*s};o.panBy(D),o.emit(S("dragpan")),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=p[4]||null!=b&&!b.pannable()){if(b&&b.pannable()&&b.active()&&b.unactivate(),b&&b.grabbed()||v==y||(y&&r(y,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),v&&r(v,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=v),b)if(g){if(o.boxSelectionEnabled()&&T)b&&b.grabbed()&&(d(w),b.emit(S("freeon")),w.emit(S("free")),e.dragData.didDrag&&(b.emit(S("dragfreeon")),w.emit(S("dragfree")))),P();else if(b&&b.grabbed()&&e.nodeIsDraggable(b)){var A=!e.dragData.didDrag;A&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||l(w,{inDragLayer:!0});var I={x:0,y:0};if(Z(x[0])&&Z(x[1])&&(I.x+=x[0],I.y+=x[1],A)){var N=e.hoverData.dragDelta;N&&Z(N[0])&&Z(N[1])&&(I.x+=N[0],I.y+=N[1])}e.hoverData.draggingEles=!0,w.silentShift(I).emit(S("position")).emit(S("drag")),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(x[0]),t.push(x[1])):(t[0]+=x[0],t[1]+=x[1])}();n=!0}else g&&(e.hoverData.dragging||!o.boxSelectionEnabled()||!T&&o.panningEnabled()&&o.userPanningEnabled()?!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()&&i(b,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,p[4]=0,e.data.bgActivePosistion=Ft(h),e.redrawHint("select",!0),e.redraw()):P(),b&&b.pannable()&&b.active()&&b.unactivate());return p[2]=c[0],p[3]=c[1],n?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}},!1),e.registerBinding(t,"mouseup",function(t){if((1!==e.hoverData.which||1===t.which||!e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var i=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,u=e.findNearestElement(o[0],o[1],!0,!1),l=e.dragData.possibleDragElements,c=e.hoverData.down,h=a(t);e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate();var f=function(e){return{originalEvent:t,type:e,position:{x:o[0],y:o[1]}}};if(3===e.hoverData.which){var p=f("cxttapend");if(c?c.emit(p):i.emit(p),!e.hoverData.cxtDragged){var v=f("cxttap");c?c.emit(v):i.emit(v)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(r(u,["mouseup","tapend","vmouseup"],t,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(r(c,["click","tap","vclick"],t,{x:o[0],y:o[1]}),x=!1,t.timeStamp-w<=i.multiClickDebounceTime()?(b&&clearTimeout(b),x=!0,w=null,r(c,["dblclick","dbltap","vdblclick"],t,{x:o[0],y:o[1]})):(b=setTimeout(function(){x||r(c,["oneclick","onetap","voneclick"],t,{x:o[0],y:o[1]})},i.multiClickDebounceTime()),w=t.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||a(t)||(i.$(n).unselect(["tapunselect"]),l.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=l=i.collection()),u!=c||e.dragData.didDrag||e.hoverData.selecting||null!=u&&u._private.selectable&&(e.hoverData.dragging||("additive"===i.selectionType()||h?u.selected()?u.unselect(["tapunselect"]):u.select(["tapselect"]):h||(i.$(n).unmerge(u).unselect(["tapunselect"]),u.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=i.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),i.emit(f("boxend"));"additive"===i.selectionType()||h||i.$(n).unmerge(g).unselect(),g.emit(f("box")).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(f("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var y=c&&c.grabbed();d(l),y&&(c.emit(f("freeon")),l.emit(f("free")),e.dragData.didDrag&&(c.emit(f("dragfreeon")),l.emit(f("dragfree"))))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}},!1);var k,_,C,T,S,P,B,D,M,A,I,N,R,L,O=[],z=1e5,j=function(t){var n=!1,r=t.deltaY;if(null==r&&(null!=t.wheelDeltaY?r=t.wheelDeltaY/4:null!=t.wheelDelta&&(r=t.wheelDelta/4)),0!==r){if(null==k)if(O.length>=4){var a=O;if(k=function(e){for(var t=0;t5}if(k)for(var o=0;o5&&(r=5*Xt(r)),h=r/-250,k&&(h/=z,h*=3),h*=e.wheelSensitivity,1===t.deltaMode&&(h*=33);var f=s.zoom()*Math.pow(10,h);"gesturechange"===t.type&&(f=e.gestureStartZoom*t.scale),s.zoom({level:f,renderedPosition:{x:d[0],y:d[1]}}),s.emit({type:"gesturechange"===t.type?"pinchzoom":"scrollzoom",originalEvent:t,position:{x:c[0],y:c[1]}})}}}};e.registerBinding(e.container,"wheel",j,!0),e.registerBinding(t,"scroll",function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(t){e.hasTouchStarted||j(t)},!0),e.registerBinding(e.container,"mouseout",function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})},!1),e.registerBinding(e.container,"mouseover",function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})},!1);var V,F,Y,q,X,W,U,G=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},H=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",V=function(t){if(e.hasTouchStarted=!0,m(t)){f(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,a=e.touchData.now,i=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);a[0]=o[0],a[1]=o[1]}t.touches[1]&&(o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),a[2]=o[0],a[3]=o[1]),t.touches[2]&&(o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),a[4]=o[0],a[5]=o[1]);var u=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}};if(t.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var h=e.findContainerClientCoords();A=h[0],I=h[1],N=h[2],R=h[3],_=t.touches[0].clientX-A,C=t.touches[0].clientY-I,T=t.touches[1].clientX-A,S=t.touches[1].clientY-I,L=0<=_&&_<=N&&0<=T&&T<=N&&0<=C&&C<=R&&0<=S&&S<=R;var p=n.pan(),v=n.zoom();if(P=G(_,C,T,S),B=H(_,C,T,S),M=[((D=[(_+T)/2,(C+S)/2])[0]-p.x)/v,(D[1]-p.y)/v],B<4e4&&!t.touches[2]){var g=e.findNearestElement(a[0],a[1],!0,!0),y=e.findNearestElement(a[2],a[3],!0,!0);return g&&g.isNode()?(g.activate().emit(u("cxttapstart")),e.touchData.start=g):y&&y.isNode()?(y.activate().emit(u("cxttapstart")),e.touchData.start=y):n.emit(u("cxttapstart")),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var b=e.findNearestElements(a[0],a[1],!0,!0),x=b[0];if(null!=x&&(x.activate(),e.touchData.start=x,e.touchData.starts=b,e.nodeIsGrabbable(x))){var w=e.dragData.touchDragEles=n.collection(),E=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),x.selected()?(E=n.$(function(t){return t.selected()&&e.nodeIsGrabbable(t)}),l(E,{addToList:w})):c(x,{addToList:w}),s(x),x.emit(u("grabon")),E?E.forEach(function(e){e.emit(u("grab"))}):x.emit(u("grab"))}r(x,["touchstart","tapstart","vmousedown"],t,{x:a[0],y:a[1]}),null==x&&(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||r(e.touchData.start,["taphold"],t,{x:a[0],y:a[1]})},e.tapholdDuration)}if(t.touches.length>=1){for(var k=e.touchData.startPosition=[null,null,null,null,null,null],O=0;O=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var E=t.touches[0].clientX-A,k=t.touches[0].clientY-I,D=t.touches[1].clientX-A,N=t.touches[1].clientY-I,R=H(E,k,D,N);if(R/B>=2.25||R>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var O=p("cxttapend");e.touchData.start?(e.touchData.start.unactivate().emit(O),e.touchData.start=null):o.emit(O)}}if(n&&e.touchData.cxt){O=p("cxtdrag"),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(O):o.emit(O),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var z=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&z===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit(p("cxtdragout")),e.touchData.cxtOver=z,z&&z.emit(p("cxtdragover")))}else if(n&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit(p("boxstart")),e.touchData.selecting=!0,e.touchData.didSelect=!0,a[4]=1,a&&0!==a.length&&void 0!==a[0]?(a[2]=(s[0]+s[2]+s[4])/3,a[3]=(s[1]+s[3]+s[5])/3):(a[0]=(s[0]+s[2]+s[4])/3,a[1]=(s[1]+s[3]+s[5])/3,a[2]=(s[0]+s[2]+s[4])/3+1,a[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),te=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var j=0;j0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",Y=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(t,"touchend",q=function(t){var a=e.touchData.start;if(e.touchData.capture){0===t.touches.length&&(e.touchData.capture=!1),t.preventDefault();var i=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o=e.cy,s=o.zoom(),u=e.touchData.now,l=e.touchData.earlier;if(t.touches[0]){var c=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);u[0]=c[0],u[1]=c[1]}t.touches[1]&&(c=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),u[2]=c[0],u[3]=c[1]),t.touches[2]&&(c=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),u[4]=c[0],u[5]=c[1]);var h,f=function(e){return{originalEvent:t,type:e,position:{x:u[0],y:u[1]}}};if(a&&a.unactivate(),e.touchData.cxt){if(h=f("cxttapend"),a?a.emit(h):o.emit(h),!e.touchData.cxtDragged){var p=f("cxttap");a?a.emit(p):o.emit(p)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!t.touches[2]&&o.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var v=o.collection(e.getAllInBox(i[0],i[1],i[2],i[3]));i[0]=void 0,i[1]=void 0,i[2]=void 0,i[3]=void 0,i[4]=0,e.redrawHint("select",!0),o.emit(f("boxend")),v.emit(f("box")).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(f("boxselect")),v.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=a&&a.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(t.touches[1]);else if(t.touches[0]);else if(!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var g=e.dragData.touchDragEles;if(null!=a){var y=a._private.grabbed;d(g),e.redrawHint("drag",!0),e.redrawHint("eles",!0),y&&(a.emit(f("freeon")),g.emit(f("free")),e.dragData.didDrag&&(a.emit(f("dragfreeon")),g.emit(f("dragfree")))),r(a,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]}),a.unactivate(),e.touchData.start=null}else{var m=e.findNearestElement(u[0],u[1],!0,!0);r(m,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]})}var b=e.touchData.startPosition[0]-u[0],x=b*b,w=e.touchData.startPosition[1]-u[1],E=(x+w*w)*s*s;e.touchData.singleTouchMoved||(a||o.$(":selected").unselect(["tapunselect"]),r(a,["tap","vclick"],t,{x:u[0],y:u[1]}),X=!1,t.timeStamp-U<=o.multiClickDebounceTime()?(W&&clearTimeout(W),X=!0,U=null,r(a,["dbltap","vdblclick"],t,{x:u[0],y:u[1]})):(W=setTimeout(function(){X||r(a,["onetap","voneclick"],t,{x:u[0],y:u[1]})},o.multiClickDebounceTime()),U=t.timeStamp)),null!=a&&!e.dragData.didDrag&&a._private.selectable&&E2){for(var f=[c[0],c[1]],p=Math.pow(f[0]-e,2)+Math.pow(f[1]-t,2),v=1;v0)return v[0]}return null},f=Object.keys(d),p=0;p0?l:ln(a,i,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,a,i,o,s){var u=2*(s="auto"===s?Pn(r,a):s);if(vn(e,t,this.points,i,o,r,a-u,[0,-1],n))return!0;if(vn(e,t,this.points,i,o,r-u,a,[0,-1],n))return!0;var l=r/2+2*n,c=a/2+2*n;return!!pn(e,t,[i-l,o-c,i-l,o,i+l,o,i+l,o-c])||!!mn(e,t,u,u,i+r/2-s,o+a/2-s,n)||!!mn(e,t,u,u,i-r/2+s,o+a/2-s,n)}}},registerNodeShapes:function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Cn(3,0)),this.generateRoundPolygon("round-triangle",Cn(3,0)),this.generatePolygon("rectangle",Cn(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",Cn(5,0)),this.generateRoundPolygon("round-pentagon",Cn(5,0)),this.generatePolygon("hexagon",Cn(6,0)),this.generateRoundPolygon("round-hexagon",Cn(6,0)),this.generatePolygon("heptagon",Cn(7,0)),this.generateRoundPolygon("round-heptagon",Cn(7,0)),this.generatePolygon("octagon",Cn(8,0)),this.generateRoundPolygon("round-octagon",Cn(8,0));var r=new Array(20),a=Sn(5,0),i=Sn(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*v)break}else if(a){if(f>=e.deqCost*u||f>=e.deqAvgCost*s)break}else if(p>=e.deqNoDrawCost*Sc)break;var g=e.deq(t,d,c);if(!(g.length>0))break;for(var y=0;y0&&(e.onDeqd(t,l),!a&&e.shouldRedraw(t,l,d,c)&&r())},a(t))}}},Bc=function(){return r(function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qe;t(this,e),this.idsByKey=new ft,this.keyForId=new ft,this.cachesByLvl=new ft,this.lvls=[],this.getKey=n,this.doesEleInvalidateKey=r},[{key:"getIdsFor",value:function(e){null==e&&tt("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new vt,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new ft,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach(function(n){return t.deleteCache(e,n)})}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}])}(),Dc={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Mc=ut({getKey:null,doesEleInvalidateKey:Qe,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:$e,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Ac=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=Mc(t);ye(n,r),n.lookup=new Bc(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},Ic=Ac.prototype;Ic.reasons=Dc,Ic.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},Ic.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},Ic.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new Ct(function(e,t){return t.reqs-e.reqs})},Ic.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Ic.getElement=function(e,t,n,r,a){var i=this,o=this.renderer,s=o.cy.zoom(),u=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!i.allowEdgeTxrCaching&&e.isEdge()||!i.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(qt(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var l=Math.pow(2,r),c=t.h*l,d=t.w*l,h=o.eleTextBiggerThanMin(e,l);if(!this.isVisible(e,h))return null;var f,p=u.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;if(f=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var v=i.getTextureQueue(f),g=v[v.length-2],y=function(){return i.recycleTexture(f,d)||i.addTexture(f,d)};g||(g=v[v.length-1]),g||(g=y()),g.width-g.usedWidthr;S--)C=i.getElement(e,t,n,S,Dc.downscale);T()}else{var P;if(!x&&!w&&!E)for(var B=r-1;B>=-4;B--){var D=u.get(e,B);if(D){P=D;break}}if(b(P))return i.queueElement(e,r),P;g.context.translate(g.usedWidth,0),g.context.scale(l,l),this.drawElement(g.context,e,t,h,!1),g.context.scale(1/l,1/l),g.context.translate(-g.usedWidth,0)}return p={x:g.usedWidth,texture:g,level:r,scale:l,width:d,height:c,scaledLabelShown:h},g.usedWidth+=Math.ceil(d+8),g.eleCaches.push(p),u.set(e,r,p),i.checkTextureFullness(g),p},Ic.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},Ic.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?lt(t,e):e.fullnessChecks++},Ic.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;lt(n,e),e.retired=!0;for(var a=e.eleCaches,i=0;i=t)return i.retired=!1,i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,ct(i.eleCaches),i.context.setTransform(1,0,0,1,0,0),i.context.clearRect(0,0,i.width,i.height),lt(r,i),n.push(i),i}},Ic.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),a=this.getKey(e),i=r[a];if(i)i.level=Math.max(i.level,t),i.eles.merge(e),i.reqs++,n.updateItem(i);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:a};n.push(o),r[a]=o}},Ic.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],i=t.lookup,o=0;o<1&&n.size()>0;o++){var s=n.pop(),u=s.key,l=s.eles[0],c=i.hasCache(l,s.level);if(r[u]=null,!c){a.push(s);var d=t.getBoundingBox(l);t.getElement(l,d,e,s.level,Dc.dequeue)}}return a},Ic.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),a=n[r];null!=a&&(1===a.eles.length?(a.reqs=Ze,t.updateItem(a),t.pop(),n[r]=null):a.eles.unmerge(e))},Ic.onDequeue=function(e){this.onDequeues.push(e)},Ic.offDequeue=function(e){lt(this.onDequeues,e)},Ic.setupDequeueing=Pc({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,s,u=r.layersByLevel,l=Math.pow(2,n),c=u[n]=u[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=u[t],!0},a=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};a(1),a(-1);for(var i=c.length-1;i>=0;i--){var o=c[i];o.invalid&<(c,o)}}();var d=function(t){var a=(t=t||{}).after;!function(){if(!o){o=$t();for(var t=0;t32767||s>32767)return null;if(i*s>16e6)return null;var u=r.makeLayer(o,n);if(null!=a){var d=c.indexOf(a)+1;c.splice(d,0,u)}else(void 0===t.insert||t.insert)&&c.unshift(u);return u};if(r.skipping&&!i)return null;for(var h=null,f=e.length/1,p=!i,v=0;v=f||!sn(h.bb,g.boundingBox()))&&!(h=d({insert:!0,after:h})))return null;s||p?r.queueLayer(h,g):r.drawEleInLayer(h,g,n,t),h.eles.push(g),m[n]=h}}return s||(p?null:c)},Rc.getEleLevelForLayerLevel=function(e,t){return e},Rc.drawEleInLayer=function(e,t,n,r){var a=this.renderer,i=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(i,!1),a.drawCachedElement(i,t,null,null,n,!0),a.setImgSmoothing(i,!0))},Rc.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,a=0;a0)return!1;if(i.invalid)return!1;r+=i.eles.length}return r===t.length},Rc.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},Rc.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=Re(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)}))},Rc.invalidateLayer=function(e){if(this.lastInvalidationTime=Re(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];lt(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a3&&void 0!==arguments[3])||arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!i||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var u;n&&(u=n,e.translate(-u.x1,-u.y1));var l=i?t.pstyle("opacity").value:1,c=i?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,f=t.pstyle("width").pfValue,p=t.pstyle("line-cap").value,v=t.pstyle("line-outline-width").value,g=t.pstyle("line-outline-color").value,y=l*c,m=l*c,b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===d?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=f,e.lineCap=p,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;o.drawArrowheads(e,t,n)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var w=t.pstyle("ghost-offset-x").pfValue,E=t.pstyle("ghost-offset-y").pfValue,k=t.pstyle("ghost-opacity").value,_=y*k;e.translate(w,E),b(_),x(_),e.translate(-w,-E)}else!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;e.lineWidth=f+v,e.lineCap=p,v>0?(o.colorStrokeStyle(e,g[0],g[1],g[2],n),"straight-triangle"===d?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")):e.lineCap="butt"}();a&&o.drawEdgeUnderlay(e,t),b(),x(),a&&o.drawEdgeOverlay(e,t),o.drawElementText(e,t,null,r),n&&e.translate(u.x1,u.y1)}}},Jc=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var a=this,i=a.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,u=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==o.edgeType||i?t.lineCap="round":t.lineCap="butt",a.colorStrokeStyle(t,u[0],u[1],u[2],r),a.drawEdgePath(n,t,o.allpts,"solid")}}}};Qc.drawEdgeOverlay=Jc("overlay"),Qc.drawEdgeUnderlay=Jc("underlay"),Qc.drawEdgePath=function(e,t,n,r){var i,o=e._private.rscratch,s=t,u=!1,l=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,d=e.pstyle("line-dash-offset").pfValue;if(l){var h=n.join("$");o.pathCacheKey&&o.pathCacheKey===h?(i=t=o.pathCache,u=!0):(i=t=new Path2D,o.pathCacheKey=h,o.pathCache=i)}if(s.setLineDash)switch(r){case"dotted":s.setLineDash([1,1]);break;case"dashed":s.setLineDash(c),s.lineDashOffset=d;break;case"solid":s.setLineDash([])}if(!u&&!o.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),o.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var f=2;f+35&&void 0!==arguments[5]?arguments[5]:5,o=Math.min(i,r/2,a/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+a-o),e.quadraticCurveTo(t+r,n+a,t+r-o,n+a),e.lineTo(t+o,n+a),e.quadraticCurveTo(t,n+a,t,n+a-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}td.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(qt(n*r));t=Math.pow(2,a)}return!(e.pstyle("font-size").pfValue*t5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(i&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var u=o.getLabelJustification(t);e.textAlign=u,e.textBaseline="bottom"}else{var l=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(l||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var f,p=!n;n&&(f=n,e.translate(-f.x1,-f.y1)),null==a?(o.drawText(e,t,null,p,i),t.isEdge()&&(o.drawText(e,t,"source",p,i),o.drawText(e,t,"target",p,i))):o.drawText(e,t,a,p,i),n&&e.translate(f.x1,f.y1)},td.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",i=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,u=t.pstyle("text-outline-opacity").value*s,l=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+a+" "+i,e.lineJoin="round",this.colorFillStyle(e,l[0],l[1],l[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],u)},td.getTextAngle=function(e,t){var n,r=e._private.rscratch,a=t?t+"-":"",i=e.pstyle(a+"text-rotation");if("autorotate"===i.strValue){var o=dt(r,"labelAngle",t);n=e.isEdge()?o:0}else n="none"===i.strValue?0:i.pfValue;return n},td.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=t._private.rscratch,o=a?t.effectiveOpacity():1;if(!a||0!==o&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s,u,l=dt(i,"labelX",n),c=dt(i,"labelY",n),d=this.getLabelText(t,n);if(null!=d&&""!==d&&!isNaN(l)&&!isNaN(c)){this.setupTextStyle(e,t,a);var h,f=n?n+"-":"",p=dt(i,"labelWidth",n),v=dt(i,"labelHeight",n),g=t.pstyle(f+"text-margin-x").pfValue,y=t.pstyle(f+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle("text-halign").value,x=t.pstyle("text-valign").value;switch(m&&(b="center",x="center"),l+=g,c+=y,0!==(h=r?this.getTextAngle(t,n):0)&&(s=l,u=c,e.translate(s,u),e.rotate(h),l=0,c=0),x){case"top":break;case"center":c+=v/2;break;case"bottom":c+=v}var w=t.pstyle("text-background-opacity").value,E=t.pstyle("text-border-opacity").value,k=t.pstyle("text-border-width").pfValue,_=t.pstyle("text-background-padding").pfValue,C=t.pstyle("text-background-shape").strValue,T="round-rectangle"===C||"roundrectangle"===C,S="circle"===C;if(w>0||k>0&&E>0){var P=e.fillStyle,B=e.strokeStyle,D=e.lineWidth,M=t.pstyle("text-background-color").value,A=t.pstyle("text-border-color").value,I=t.pstyle("text-border-style").value,N=w>0,R=k>0&&E>0,L=l-_;switch(b){case"left":L-=p;break;case"center":L-=p/2}var O=c-v-_,z=p+2*_,j=v+2*_;if(N&&(e.fillStyle="rgba(".concat(M[0],",").concat(M[1],",").concat(M[2],",").concat(w*o,")")),R&&(e.strokeStyle="rgba(".concat(A[0],",").concat(A[1],",").concat(A[2],",").concat(E*o,")"),e.lineWidth=k,e.setLineDash))switch(I){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=k/4,e.setLineDash([]);break;default:e.setLineDash([])}if(T?(e.beginPath(),nd(e,L,O,z,j,2)):S?(e.beginPath(),function(e,t,n,r,a){var i=Math.min(r,a)/2,o=t+r/2,s=n+a/2;e.beginPath(),e.arc(o,s,i,0,2*Math.PI),e.closePath()}(e,L,O,z,j)):(e.beginPath(),e.rect(L,O,z,j)),N&&e.fill(),R&&e.stroke(),R&&"double"===I){var V=k/2;e.beginPath(),T?nd(e,L+V,O+V,z-2*V,j-2*V,2):e.rect(L+V,O+V,z-2*V,j-2*V),e.stroke()}e.fillStyle=P,e.strokeStyle=B,e.lineWidth=D,e.setLineDash&&e.setLineDash([])}var F=2*t.pstyle("text-outline-width").pfValue;if(F>0&&(e.lineWidth=F),"wrap"===t.pstyle("text-wrap").value){var Y=dt(i,"labelWrapCachedLines",n),q=dt(i,"labelLineHeight",n),X=p/2,W=this.getLabelJustification(t);switch("auto"===W||("left"===b?"left"===W?l+=-p:"center"===W&&(l+=-X):"center"===b?"left"===W?l+=-X:"right"===W&&(l+=X):"right"===b&&("center"===W?l+=X:"right"===W&&(l+=p))),x){case"top":case"center":case"bottom":c-=(Y.length-1)*q}for(var U=0;U0&&e.strokeText(Y[U],l,c),e.fillText(Y[U],l,c),c+=q}else F>0&&e.strokeText(d,l,c),e.fillText(d,l,c);0!==h&&(e.rotate(-h),e.translate(-s,-u))}}};var rd={drawNode:function(e,t,n){var r,a,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],u=this,l=t._private,c=l.rscratch,d=t.position();if(Z(d.x)&&Z(d.y)&&(!s||t.visible())){var h,f,p=s?t.effectiveOpacity():1,v=u.usePaths(),g=!1,y=t.padding();r=t.width()+2*y,a=t.height()+2*y,n&&(f=n,e.translate(-f.x1,-f.y1));for(var m=t.pstyle("background-image").value,b=new Array(m.length),x=new Array(m.length),w=0,E=0;E0&&void 0!==arguments[0]?arguments[0]:S;u.eleFillStyle(e,t,n)},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R;u.colorStrokeStyle(e,P[0],P[1],P[2],t)},X=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:j;u.colorStrokeStyle(e,O[0],O[1],O[2],t)},W=function(e,t,n,r){var a,i=u.nodePathCache=u.nodePathCache||[],o=We("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+F),s=i[o],l=!1;return null!=s?(a=s,l=!0,c.pathCache=a):(a=new Path2D,i[o]=c.pathCache=a),{path:a,cacheHit:l}},U=t.pstyle("shape").strValue,G=t.pstyle("shape-polygon-points").pfValue;if(v){e.translate(d.x,d.y);var H=W(r,a,U,G);h=H.path,g=H.cacheHit}var K=function(){if(!g){var n=d;v&&(n={x:0,y:0}),u.nodeShapes[u.getNodeShape(t)].draw(h||e,n.x,n.y,r,a,F,c)}v?e.fill(h):e.fill()},$=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=l.backgrounding,i=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;u.hasPie(t)&&(u.drawPie(e,t,i),n&&(v||u.nodeShapes[u.getNodeShape(t)].draw(e,d.x,d.y,r,a,F,c)))},J=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;u.hasStripe(t)&&(e.save(),v?e.clip(c.pathCache):(u.nodeShapes[u.getNodeShape(t)].draw(e,d.x,d.y,r,a,F,c),e.clip()),u.drawStripe(e,t,i),e.restore(),n&&(v||u.nodeShapes[u.getNodeShape(t)].draw(e,d.x,d.y,r,a,F,c)))},ee=function(){var t=(C>0?C:-C)*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:p),n=C>0?0:255;0!==C&&(u.colorFillStyle(e,n,n,n,t),v?e.fill(h):e.fill())},te=function(){if(T>0){if(e.lineWidth=T,e.lineCap=M,e.lineJoin=D,e.setLineDash)switch(B){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(I),e.lineDashOffset=N;break;case"solid":case"double":e.setLineDash([])}if("center"!==A){if(e.save(),e.lineWidth*=2,"inside"===A)v?e.clip(h):e.clip();else{var t=new Path2D;t.rect(-r/2-T,-a/2-T,r+2*T,a+2*T),t.addPath(h),e.clip(t,"evenodd")}v?e.stroke(h):e.stroke(),e.restore()}else v?e.stroke(h):e.stroke();if("double"===B){e.lineWidth=T/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",v?e.stroke(h):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},ne=function(){if(L>0){if(e.lineWidth=L,e.lineCap="butt",e.setLineDash)switch(z){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=d;v&&(n={x:0,y:0});var i=u.getNodeShape(t),o=T;"inside"===A&&(o=0),"outside"===A&&(o*=2);var s,l=(r+o+(L+V))/r,c=(a+o+(L+V))/a,h=r*l,f=a*c,p=u.nodeShapes[i].points;if(v&&(s=W(h,f,i,p).path),"ellipse"===i)u.drawEllipsePath(s||e,n.x,n.y,h,f);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(i)){var g=0,y=0,m=0;"round-diamond"===i?g=1.4*(o+V+L):"round-heptagon"===i?(g=1.075*(o+V+L),m=-(o/2+V+L)/35):"round-hexagon"===i?g=1.12*(o+V+L):"round-pentagon"===i?(g=1.13*(o+V+L),m=-(o/2+V+L)/15):"round-tag"===i?(g=1.12*(o+V+L),y=.07*(o/2+L+V)):"round-triangle"===i&&(g=(o+V+L)*(Math.PI/2),m=-(o+V/2+L)/Math.PI),0!==g&&(h=r*(l=(r+g)/r),["round-hexagon","round-tag"].includes(i)||(f=a*(c=(a+g)/a)));for(var b=h/2,x=f/2,w=(F="auto"===F?Bn(h,f):F)+(o+L+V)/2,E=new Array(p.length/2),k=new Array(p.length/2),_=0;_0){if(r=r||n.position(),null==a||null==i){var d=n.padding();a=n.width()+2*d,i=n.height()+2*d}this.colorFillStyle(t,u[0],u[1],u[2],s),this.nodeShapes[l].draw(t,r.x,r.y,a+2*o,i+2*o,c),t.fill()}}}};rd.drawNodeOverlay=ad("overlay"),rd.drawNodeUnderlay=ad("underlay"),rd.hasPie=function(e){return(e=e[0])._private.hasPie},rd.hasStripe=function(e){return(e=e[0])._private.hasStripe},rd.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a,i=t.cy().style(),o=t.pstyle("pie-size"),s=t.pstyle("pie-hole"),u=t.pstyle("pie-start-angle").pfValue,l=r.x,c=r.y,d=t.width(),h=t.height(),f=Math.min(d,h)/2,p=0;if(this.usePaths()&&(l=0,c=0),"%"===o.units?f*=o.pfValue:void 0!==o.pfValue&&(f=o.pfValue/2),"%"===s.units?a=f*s.pfValue:void 0!==s.pfValue&&(a=s.pfValue/2),!(a>=f))for(var v=1;v<=i.pieBackgroundN;v++){var g=t.pstyle("pie-"+v+"-background-size").value,y=t.pstyle("pie-"+v+"-background-color").value,m=t.pstyle("pie-"+v+"-background-opacity").value*n,b=g/100;b+p>1&&(b=1-p);var x=1.5*Math.PI+2*Math.PI*p,w=(x+=u)+2*Math.PI*b;0===g||p>=1||p+b>1||(0===a?(e.beginPath(),e.moveTo(l,c),e.arc(l,c,f,x,w),e.closePath()):(e.beginPath(),e.arc(l,c,f,x,w),e.arc(l,c,a,w,x,!0),e.closePath()),this.colorFillStyle(e,y[0],y[1],y[2],m),e.fill(),p+=b)}},rd.drawStripe=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),i=r.x,o=r.y,s=t.width(),u=t.height(),l=0,c=this.usePaths();e.save();var d=t.pstyle("stripe-direction").value,h=t.pstyle("stripe-size");switch(d){case"vertical":break;case"righward":e.rotate(-Math.PI/2)}var f=s,p=u;"%"===h.units?(f*=h.pfValue,p*=h.pfValue):void 0!==h.pfValue&&(f=h.pfValue,p=h.pfValue),c&&(i=0,o=0),o-=f/2,i-=p/2;for(var v=1;v<=a.stripeBackgroundN;v++){var g=t.pstyle("stripe-"+v+"-background-size").value,y=t.pstyle("stripe-"+v+"-background-color").value,m=t.pstyle("stripe-"+v+"-background-opacity").value*n,b=g/100;b+l>1&&(b=1-l),0===g||l>=1||l+b>1||(e.beginPath(),e.rect(i,o+p*l,f,p*b),e.closePath(),this.colorFillStyle(e,y[0],y[1],y[2],m),e.fill(),l+=b)}e.restore()};var id,od={};function sd(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(r));return r}function ud(e,t,n){void 0===n&&(n=t);var r=e.makeOffscreenCanvas(t,n),a=r.context=r.getContext("2d");return r.clear=function(){return a.clearRect(0,0,r.width,r.height)},r.clear(),r}function ld(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function cd(e){return"solid"===e.pstyle("background-fill").value&&"none"===e.pstyle("background-image").strValue&&(0===e.pstyle("border-width").value||0===e.pstyle("border-opacity").value||"solid"===e.pstyle("border-style").value)}function dd(e,t){if(e.length!==t.length)return!1;for(var n=0;n>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function pd(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function vd(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function gd(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function yd(e,t,n,r,a,i){switch(t){case e.FLOAT:return new Float32Array(n.buffer,i*r,a);case e.INT:return new Int32Array(n.buffer,i*r,a)}}function md(e,t,n,r){var a=o(vd(e,n),3),i=a[0],s=a[1],u=a[2],l=gd(e,s,t*i),c=i*u,d=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,d),e.bufferData(e.ARRAY_BUFFER,t*c,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),s===e.FLOAT?e.vertexAttribPointer(r,i,s,!1,c,0):s===e.INT&&e.vertexAttribIPointer(r,i,s,c,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var h=new Array(t),f=0;ft.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!d&&(c[t.NODE]=!0,c[t.SELECT_BOX]=!0);var m=n.style(),b=n.zoom(),x=void 0!==o?o:b,w=n.pan(),E={x:w.x,y:w.y},k={zoom:b,pan:{x:w.x,y:w.y}},_=t.prevViewport;void 0===_||k.zoom!==_.zoom||k.pan.x!==_.pan.x||k.pan.y!==_.pan.y||v&&!p||(t.motionBlurPxRatio=1),s&&(E=s),x*=u,E.x*=u,E.y*=u;var C=t.getCachedZSortedEles();function T(e,n,r,a,i){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,a,i),e.globalCompositeOperation=o}function S(e,n){var i,u,c,d;t.clearingMotionBlur||e!==l.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]&&e!==l.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]?(i=E,u=x,c=t.canvasWidth,d=t.canvasHeight):(i={x:w.x*f,y:w.y*f},u=b*f,c=t.canvasWidth*f,d=t.canvasHeight*f),e.setTransform(1,0,0,1,0,0),"motionBlur"===n?T(e,0,0,c,d):r||void 0!==n&&!n||e.clearRect(0,0,c,d),a||(e.translate(i.x,i.y),e.scale(u,u)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}if(d||(t.textureDrawLastFrame=!1),d){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var P=t.data.bufferContexts[t.TEXTURE_BUFFER];P.setTransform(1,0,0,1,0,0),P.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:P,drawOnlyNodeLayer:!0,forcedPxRatio:u*t.textureMult}),(k=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight}).mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[t.DRAG]=!1,c[t.NODE]=!1;var B=l.contexts[t.NODE],D=t.textureCache.texture;k=t.textureCache.viewport,B.setTransform(1,0,0,1,0,0),h?T(B,0,0,k.width,k.height):B.clearRect(0,0,k.width,k.height);var M=m.core("outside-texture-bg-color").value,A=m.core("outside-texture-bg-opacity").value;t.colorFillStyle(B,M[0],M[1],M[2],A),B.fillRect(0,0,k.width,k.height),b=n.zoom(),S(B,!1),B.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/u,k.height/k.zoom/u),B.drawImage(D,k.mpan.x,k.mpan.y,k.width/k.zoom/u,k.height/k.zoom/u)}else t.textureOnViewport&&!r&&(t.textureCache=null);var I=n.extent(),N=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),R=t.hideEdgesOnViewport&&N,L=[];if(L[t.NODE]=!c[t.NODE]&&h&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,L[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),L[t.DRAG]=!c[t.DRAG]&&h&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,L[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),c[t.NODE]||a||i||L[t.NODE]){var O=h&&!L[t.NODE]&&1!==f;S(B=r||(O?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:l.contexts[t.NODE]),h&&!O?"motionBlur":void 0),R?t.drawCachedNodes(B,C.nondrag,u,I):t.drawLayeredElements(B,C.nondrag,u,I),t.debug&&t.drawDebugPoints(B,C.nondrag),a||h||(c[t.NODE]=!1)}if(!i&&(c[t.DRAG]||a||L[t.DRAG])&&(O=h&&!L[t.DRAG]&&1!==f,S(B=r||(O?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:l.contexts[t.DRAG]),h&&!O?"motionBlur":void 0),R?t.drawCachedNodes(B,C.drag,u,I):t.drawCachedElements(B,C.drag,u,I),t.debug&&t.drawDebugPoints(B,C.drag),a||h||(c[t.DRAG]=!1)),this.drawSelectionRectangle(e,S),h&&1!==f){var z=l.contexts[t.NODE],j=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],V=l.contexts[t.DRAG],F=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],Y=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!y?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):T(e,0,0,t.canvasWidth,t.canvasHeight);var a=f;e.drawImage(n,0,0,t.canvasWidth*a,t.canvasHeight*a,0,0,t.canvasWidth,t.canvasHeight)};(c[t.NODE]||L[t.NODE])&&(Y(z,j,L[t.NODE]),c[t.NODE]=!1),(c[t.DRAG]||L[t.DRAG])&&(Y(V,F,L[t.DRAG]),c[t.DRAG]=!1)}t.prevViewport=k,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),h&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!d,t.mbFrames=0,c[t.NODE]=!0,c[t.DRAG]=!0,t.redraw()},100)),r||n.emit("render")},od.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,a=n.data,i=r.style(),o=e.drawOnlyNodeLayer,s=e.drawAllLayers,u=a.canvasNeedsRedraw,l=e.forcedContext;if(n.showFps||!o&&u[n.SELECT_BOX]&&!s){var c=l||a.contexts[n.SELECT_BOX];if(t(c),1==n.selection[4]&&(n.hoverData.selecting||n.touchData.selecting)){var d=n.cy.zoom(),h=i.core("selection-box-border-width").value/d;c.lineWidth=h,c.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",c.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),h>0&&(c.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",c.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(a.bgActivePosistion&&!n.hoverData.selecting){d=n.cy.zoom();var f=a.bgActivePosistion;c.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",c.beginPath(),c.arc(f.x,f.y,i.core("active-bg-size").pfValue/d,0,2*Math.PI),c.fill()}var p=n.lastRedrawTime;if(n.showFps&&p){p=Math.round(p);var v=Math.round(1e3/p),g="1 frame = "+p+" ms = "+v+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!id){var y=c.measureText(g);id=y.actualBoundingBoxAscent}c.fillText(g,0,id),c.strokeRect(0,id+10,250,20),c.fillRect(0,id+10,250*Math.min(v/60,1),20)}s||(u[n.SELECT_BOX]=!1)}};var bd="undefined"!=typeof Float32Array?Float32Array:Array;function xd(){var e=new bd(9);return bd!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function wd(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Ed(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],l=t[6],c=t[7],d=t[8],h=n[0],f=n[1];return e[0]=r,e[1]=a,e[2]=i,e[3]=o,e[4]=s,e[5]=u,e[6]=h*r+f*o+l,e[7]=h*a+f*s+c,e[8]=h*i+f*u+d,e}function kd(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],l=t[6],c=t[7],d=t[8],h=Math.sin(n),f=Math.cos(n);return e[0]=f*r+h*o,e[1]=f*a+h*s,e[2]=f*i+h*u,e[3]=f*o-h*r,e[4]=f*s-h*a,e[5]=f*u-h*i,e[6]=l,e[7]=c,e[8]=d,e}function _d(e,t,n){var r=n[0],a=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=a*t[3],e[4]=a*t[4],e[5]=a*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Cd=function(){return r(function e(n,r,a,i){t(this,e),this.debugID=Math.floor(1e4*Math.random()),this.r=n,this.texSize=r,this.texRows=a,this.texHeight=Math.floor(r/a),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(n,r,r),this.scratch=i(n,r,this.texHeight,"scratch")},[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(e){var t=e.w,n=e.h,r=this.texHeight,a=this.texSize,i=r/n,o=t*i,s=n*i;return o>a&&(o=t*(i=a/t),s=n*i),{scale:i,texW:o,texH:s}}},{key:"draw",value:function(e,t,n){var r=this;if(this.locked)throw new Error("can't draw, atlas is locked");var a=this.texSize,i=this.texRows,o=this.texHeight,s=this.getScale(t),u=s.scale,l=s.texW,c=s.texH,d=function(e,r){if(n&&r){var a=r.context,i=e.x,s=e.row,l=i,c=o*s;a.save(),a.translate(l,c),a.scale(u,u),n(a,t),a.restore()}},h=[null,null],f=function(){d(r.freePointer,r.canvas),h[0]={x:r.freePointer.x,y:r.freePointer.row*o,w:l,h:c},h[1]={x:r.freePointer.x+l,y:r.freePointer.row*o,w:0,h:c},r.freePointer.x+=l,r.freePointer.x==a&&(r.freePointer.x=0,r.freePointer.row++)},p=function(){r.freePointer.x=0,r.freePointer.row++};if(this.freePointer.x+l<=a)f();else{if(this.freePointer.row>=i-1)return!1;this.freePointer.x===a?(p(),f()):this.enableWrapping?function(){var e=r.scratch,t=r.canvas;e.clear(),d({x:0,row:0},e);var n=a-r.freePointer.x,i=l-n,s=o,u=r.freePointer.x,f=r.freePointer.row*o,p=n;t.context.drawImage(e,0,0,p,s,u,f,p,s),h[0]={x:u,y:f,w:p,h:c};var v=n,g=(r.freePointer.row+1)*o,y=i;t&&t.context.drawImage(e,v,0,y,s,0,g,y,s),h[1]={x:0,y:g,w:y,h:c},r.freePointer.x=i,r.freePointer.row++}():(p(),f())}return this.keyToLocation.set(e,h),this.needsBuffer=!0,h}},{key:"getOffsets",value:function(e){return this.keyToLocation.get(e)}},{key:"isEmpty",value:function(){return 0===this.freePointer.x&&0===this.freePointer.row}},{key:"canFit",value:function(e){if(this.locked)return!1;var t=this.texSize,n=this.texRows,r=this.getScale(e).texW;return!(this.freePointer.x+r>t)||this.freePointer.row1&&void 0!==arguments[1]?arguments[1]:{},i=r.forceRedraw,o=void 0!==i&&i,s=r.filterEle,u=void 0===s?function(){return!0}:s,l=r.filterType,c=void 0===l?function(){return!0}:l,d=!1,h=!1,f=a(e);try{for(f.s();!(t=f.n()).done;){var p=t.value;if(u(p)){var v,g=a(this.renderTypes.values());try{var y=function(){var e=v.value,t=e.type;if(c(t)){var r=n.collections.get(e.collection),a=e.getKey(p),i=Array.isArray(a)?a:[a];if(o)i.forEach(function(e){return r.markKeyForGC(e)}),h=!0;else{var s=e.getID?e.getID(p):p.id(),u=n._key(t,s),l=n.typeAndIdToKey.get(u);void 0===l||dd(i,l)||(d=!0,n.typeAndIdToKey.delete(u),l.forEach(function(e){return r.markKeyForGC(e)}))}}};for(g.s();!(v=g.n()).done;)y()}catch(e){g.e(e)}finally{g.f()}}}}catch(e){f.e(e)}finally{f.f()}return h&&(this.gc(),d=!1),d}},{key:"gc",value:function(){var e,t=a(this.collections.values());try{for(t.s();!(e=t.n()).done;)e.value.gc()}catch(e){t.e(e)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(e,t,n,r){var a=this.renderTypes.get(t),i=this.collections.get(a.collection),o=!1,s=i.draw(r,n,function(t){a.drawClipped?(t.save(),t.beginPath(),t.rect(0,0,n.w,n.h),t.clip(),a.drawElement(t,e,n,!0,!0),t.restore()):a.drawElement(t,e,n,!0,!0),o=!0});if(o){var u=a.getID?a.getID(e):e.id(),l=this._key(t,u);this.typeAndIdToKey.has(l)?this.typeAndIdToKey.get(l).push(r):this.typeAndIdToKey.set(l,[r])}return s}},{key:"getAtlasInfo",value:function(e,t){var n=this,r=this.renderTypes.get(t),a=r.getKey(e);return(Array.isArray(a)?a:[a]).map(function(a){var i=r.getBoundingBox(e,a),s=n.getOrCreateAtlas(e,t,i,a),u=o(s.getOffsets(a),2),l=u[0];return{atlas:s,tex:l,tex1:l,tex2:u[1],bb:i}})}},{key:"getDebugInfo",value:function(){var e,t=[],n=a(this.collections);try{for(n.s();!(e=n.n()).done;){var r=o(e.value,2),i=r[0],s=r[1].getCounts(),u=s.keyCount,l=s.atlasCount;t.push({type:i,keyCount:u,atlasCount:l})}}catch(e){n.e(e)}finally{n.f()}return t}}])}(),Pd=function(){return r(function e(n){t(this,e),this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.batchAtlases=[]},[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(e,t){return t})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(e){return this.batchAtlases.length!==this.maxAtlasesPerBatch||this.batchAtlases.includes(e)}},{key:"getAtlasIndexForBatch",value:function(e){var t=this.batchAtlases.indexOf(e);if(t<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(e),t=this.batchAtlases.length-1}return t}}])}(),Bd={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Dd=function(){return r(function e(n,r,a){t(this,e),this.r=n,this.gl=r,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=ud,this.atlasManager=new Sd(n,a),this.batchManager=new Pd(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Bd.SCREEN),this.pickingProgram=this._createShaderProgram(Bd.PICKING),this.vao=this._createVAO()},[{key:"addAtlasCollection",value:function(e,t){this.atlasManager.addAtlasCollection(e,t)}},{key:"addTextureAtlasRenderType",value:function(e,t){this.atlasManager.addRenderType(e,t)}},{key:"addSimpleShapeRenderType",value:function(e,t){this.simpleShapeOptions.set(e,t)}},{key:"invalidate",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).type,n=this.atlasManager;return t?n.invalidate(e,{filterType:function(e){return e===t},forceRedraw:!0}):n.invalidate(e)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(e){var t=this.gl,n="#version 300 es\n precision highp float;\n\n uniform mat3 uPanZoomMatrix;\n uniform int uAtlasSize;\n \n // instanced\n in vec2 aPosition; // a vertex from the unit square\n \n in mat3 aTransform; // used to transform verticies, eg into a bounding box\n in int aVertType; // the type of thing we are rendering\n\n // the z-index that is output when using picking mode\n in vec4 aIndex;\n \n // For textures\n in int aAtlasId; // which shader unit/atlas to use\n in vec4 aTex; // x/y/w/h of texture in atlas\n\n // for edges\n in vec4 aPointAPointB;\n in vec4 aPointCPointD;\n in vec2 aLineWidth; // also used for node border width\n\n // simple shapes\n in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]\n in vec4 aColor; // also used for edges\n in vec4 aBorderColor; // aLineWidth is used for border width\n\n // output values passed to the fragment shader\n out vec2 vTexCoord;\n out vec4 vColor;\n out vec2 vPosition;\n // flat values are not interpolated\n flat out int vAtlasId; \n flat out int vVertType;\n flat out vec2 vTopRight;\n flat out vec2 vBotLeft;\n flat out vec4 vCornerRadius;\n flat out vec4 vBorderColor;\n flat out vec2 vBorderWidth;\n flat out vec4 vIndex;\n \n void main(void) {\n int vid = gl_VertexID;\n vec2 position = aPosition; // TODO make this a vec3, simplifies some code below\n\n if(aVertType == ".concat(0,") {\n float texX = aTex.x; // texture coordinates\n float texY = aTex.y;\n float texW = aTex.z;\n float texH = aTex.w;\n\n if(vid == 1 || vid == 2 || vid == 4) {\n texX += texW;\n }\n if(vid == 2 || vid == 4 || vid == 5) {\n texY += texH;\n }\n\n float d = float(uAtlasSize);\n vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(4," || aVertType == ").concat(7," \n || aVertType == ").concat(5," || aVertType == ").concat(6,") { // simple shapes\n\n // the bounding box is needed by the fragment shader\n vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat\n vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat\n vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated\n\n // calculations are done in the fragment shader, just pass these along\n vColor = aColor;\n vCornerRadius = aCornerRadius;\n vBorderColor = aBorderColor;\n vBorderWidth = aLineWidth;\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(1,") {\n vec2 source = aPointAPointB.xy;\n vec2 target = aPointAPointB.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n // stretch the unit square into a long skinny rectangle\n vec2 xBasis = target - source;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;\n\n gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n vColor = aColor;\n } \n else if(aVertType == ").concat(2,") {\n vec2 pointA = aPointAPointB.xy;\n vec2 pointB = aPointAPointB.zw;\n vec2 pointC = aPointCPointD.xy;\n vec2 pointD = aPointCPointD.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 p0, p1, p2, pos;\n if(position.x == 0.0) { // The left side of the unit square\n p0 = pointA;\n p1 = pointB;\n p2 = pointC;\n pos = position;\n } else { // The right side of the unit square, use same approach but flip the geometry upside down\n p0 = pointD;\n p1 = pointC;\n p2 = pointB;\n pos = vec2(0.0, -position.y);\n }\n\n vec2 p01 = p1 - p0;\n vec2 p12 = p2 - p1;\n vec2 p21 = p1 - p2;\n\n // Find the normal vector.\n vec2 tangent = normalize(normalize(p12) + normalize(p01));\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n // Find the vector perpendicular to p0 -> p1.\n vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n // Determine the bend direction.\n float sigma = sign(dot(p01 + p21, normal));\n float width = aLineWidth[0];\n\n if(sign(pos.y) == -sigma) {\n // This is an intersecting vertex. Adjust the position so that there's no overlap.\n vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n } else {\n // This is a non-intersecting vertex. Treat it like a mitre join.\n vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n }\n\n vColor = aColor;\n } \n else if(aVertType == ").concat(3," && vid < 3) {\n // massage the first triangle into an edge arrow\n if(vid == 0)\n position = vec2(-0.15, -0.3);\n if(vid == 1)\n position = vec2( 0.0, 0.0);\n if(vid == 2)\n position = vec2( 0.15, -0.3);\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n vColor = aColor;\n }\n else {\n gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space\n }\n\n vAtlasId = aAtlasId;\n vVertType = aVertType;\n vIndex = aIndex;\n }\n "),r=this.batchManager.getIndexArray(),a="#version 300 es\n precision highp float;\n\n // declare texture unit for each texture atlas in the batch\n ".concat(r.map(function(e){return"uniform sampler2D uTexture".concat(e,";")}).join("\n\t"),"\n\n uniform vec4 uBGColor;\n uniform float uZoom;\n\n in vec2 vTexCoord;\n in vec4 vColor;\n in vec2 vPosition; // model coordinates\n\n flat in int vAtlasId;\n flat in vec4 vIndex;\n flat in int vVertType;\n flat in vec2 vTopRight;\n flat in vec2 vBotLeft;\n flat in vec4 vCornerRadius;\n flat in vec4 vBorderColor;\n flat in vec2 vBorderWidth;\n\n out vec4 outColor;\n\n ").concat("\n float circleSD(vec2 p, float r) {\n return distance(vec2(0), p) - r; // signed distance\n }\n","\n ").concat("\n float rectangleSD(vec2 p, vec2 b) {\n vec2 d = abs(p)-b;\n return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);\n }\n","\n ").concat("\n float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {\n cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;\n cr.x = (p.y > 0.0) ? cr.x : cr.y;\n vec2 q = abs(p) - b + cr.x;\n return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;\n }\n","\n ").concat("\n float ellipseSD(vec2 p, vec2 ab) {\n p = abs( p ); // symmetry\n\n // find root with Newton solver\n vec2 q = ab*(p-ab);\n float w = (q.x1.0) ? d : -d;\n }\n","\n\n vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha\n return vec4( \n top.rgb + (bot.rgb * (1.0 - top.a)),\n top.a + (bot.a * (1.0 - top.a)) \n );\n }\n\n vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance\n // scale to the zoom level so that borders don't look blurry when zoomed in\n // note 1.5 is an aribitrary value chosen because it looks good\n return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); \n }\n\n void main(void) {\n if(vVertType == ").concat(0,") {\n // look up the texel from the texture unit\n ").concat(r.map(function(e){return"if(vAtlasId == ".concat(e,") outColor = texture(uTexture").concat(e,", vTexCoord);")}).join("\n\telse "),"\n } \n else if(vVertType == ").concat(3,") {\n // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';\n outColor = blend(vColor, uBGColor);\n outColor.a = 1.0; // make opaque, masks out line under arrow\n }\n else if(vVertType == ").concat(4," && vBorderWidth == vec2(0.0)) { // simple rectangle with no border\n outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done\n }\n else if(vVertType == ").concat(4," || vVertType == ").concat(7," \n || vVertType == ").concat(5," || vVertType == ").concat(6,") { // use SDF\n\n float outerBorder = vBorderWidth[0];\n float innerBorder = vBorderWidth[1];\n float borderPadding = outerBorder * 2.0;\n float w = vTopRight.x - vBotLeft.x - borderPadding;\n float h = vTopRight.y - vBotLeft.y - borderPadding;\n vec2 b = vec2(w/2.0, h/2.0); // half width, half height\n vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center\n\n float d; // signed distance\n if(vVertType == ").concat(4,") {\n d = rectangleSD(p, b);\n } else if(vVertType == ").concat(7," && w == h) {\n d = circleSD(p, b.x); // faster than ellipse\n } else if(vVertType == ").concat(7,") {\n d = ellipseSD(p, b);\n } else {\n d = roundRectangleSD(p, b, vCornerRadius.wzyx);\n }\n\n // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling\n // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box\n if(d > 0.0) {\n if(d > outerBorder) {\n discard;\n } else {\n outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);\n }\n } else {\n if(d > innerBorder) {\n vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;\n vec4 innerBorderColor = blend(vBorderColor, vColor);\n outColor = distInterp(innerBorderColor, outerColor, d);\n } \n else {\n vec4 outerColor;\n if(innerBorder == 0.0 && outerBorder == 0.0) {\n outerColor = vec4(0);\n } else if(innerBorder == 0.0) {\n outerColor = vBorderColor;\n } else {\n outerColor = blend(vBorderColor, vColor);\n }\n outColor = distInterp(vColor, outerColor, d - innerBorder);\n }\n }\n }\n else {\n outColor = vColor;\n }\n\n ").concat(e.picking?"if(outColor.a == 0.0) discard;\n else outColor = vIndex;":"","\n }\n "),i=function(e,t,n){var r=sd(e,e.VERTEX_SHADER,t),a=sd(e,e.FRAGMENT_SHADER,n),i=e.createProgram();if(e.attachShader(i,r),e.attachShader(i,a),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw new Error("Could not initialize shaders");return i}(t,n,a);i.aPosition=t.getAttribLocation(i,"aPosition"),i.aIndex=t.getAttribLocation(i,"aIndex"),i.aVertType=t.getAttribLocation(i,"aVertType"),i.aTransform=t.getAttribLocation(i,"aTransform"),i.aAtlasId=t.getAttribLocation(i,"aAtlasId"),i.aTex=t.getAttribLocation(i,"aTex"),i.aPointAPointB=t.getAttribLocation(i,"aPointAPointB"),i.aPointCPointD=t.getAttribLocation(i,"aPointCPointD"),i.aLineWidth=t.getAttribLocation(i,"aLineWidth"),i.aColor=t.getAttribLocation(i,"aColor"),i.aCornerRadius=t.getAttribLocation(i,"aCornerRadius"),i.aBorderColor=t.getAttribLocation(i,"aBorderColor"),i.uPanZoomMatrix=t.getUniformLocation(i,"uPanZoomMatrix"),i.uAtlasSize=t.getUniformLocation(i,"uAtlasSize"),i.uBGColor=t.getUniformLocation(i,"uBGColor"),i.uZoom=t.getUniformLocation(i,"uZoom"),i.uTextures=[];for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:Bd.SCREEN;this.panZoomMatrix=e,this.renderTarget=t,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(e,t){return!!e.visible()&&(!t||!t.isVisible||t.isVisible(e))}},{key:"drawTexture",value:function(e,t,n){var r=this.atlasManager,i=this.batchManager,s=r.getRenderTypeOpts(n);if(this._isVisible(e,s)&&(!e.isEdge()||this._isValidEdge(e))){if(this.renderTarget.picking&&s.getTexPickingMode){var u=s.getTexPickingMode(e);if(1===u)return;if(2==u)return void this.drawPickingRectangle(e,t,n)}var l,c=a(r.getAtlasInfo(e,n));try{for(c.s();!(l=c.n()).done;){var d=l.value,h=d.atlas,f=d.tex1,p=d.tex2;i.canAddToCurrentBatch(h)||this.endBatch();for(var v=i.getAtlasIndexForBatch(h),g=0,y=[[f,!0],[p,!1]];g=this.maxInstances&&this.endBatch()}}}}catch(e){c.e(e)}finally{c.f()}}}},{key:"setTransformMatrix",value:function(e,t,n,r){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=0;if(n.shapeProps&&n.shapeProps.padding&&(i=e.pstyle(n.shapeProps.padding).pfValue),r){var o=r.bb,s=r.tex1,u=r.tex2,l=s.w/(s.w+u.w);a||(l=1-l);var c=this._getAdjustedBB(o,i,a,l);this._applyTransformMatrix(t,c,n,e)}else{var d=n.getBoundingBox(e),h=this._getAdjustedBB(d,i,!0,1);this._applyTransformMatrix(t,h,n,e)}}},{key:"_applyTransformMatrix",value:function(e,t,n,r){var a,i;wd(e);var o=n.getRotation?n.getRotation(r):0;if(0!==o){var s=n.getRotationPoint(r);Ed(e,e,[s.x,s.y]),kd(e,e,o);var u=n.getRotationOffset(r);a=u.x+(t.xOffset||0),i=u.y+(t.yOffset||0)}else a=t.x1,i=t.y1;Ed(e,e,[a,i]),_d(e,e,[t.w,t.h])}},{key:"_getAdjustedBB",value:function(e,t,n,r){var a=e.x1,i=e.y1,o=e.w,s=e.h;t&&(a-=t,i-=t,o+=2*t,s+=2*t);var u=0,l=o*r;return n&&r<1?o=l:!n&&r<1&&(a+=u=o-l,o=l),{x1:a,y1:i,w:o,h:s,xOffset:u,yOffset:e.yOffset}}},{key:"drawPickingRectangle",value:function(e,t,n){var r=this.atlasManager.getRenderTypeOpts(n),a=this.instanceCount;this.vertTypeBuffer.getView(a)[0]=4,fd(t,this.indexBuffer.getView(a)),hd([0,0,0],1,this.colorBuffer.getView(a));var i=this.transformBuffer.getMatrixView(a);this.setTransformMatrix(e,i,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(e,t,n){var r=this.simpleShapeOptions.get(n);if(this._isVisible(e,r)){var a=r.shapeProps,i=this._getVertTypeForShape(e,a.shape);if(void 0===i||r.isSimple&&!r.isSimple(e))this.drawTexture(e,t,n);else{var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=i,5===i||6===i){var s=r.getBoundingBox(e),u=this._getCornerRadius(e,a.radius,s),l=this.cornerRadiusBuffer.getView(o);l[0]=u,l[1]=u,l[2]=u,l[3]=u,6===i&&(l[0]=0,l[2]=0)}fd(t,this.indexBuffer.getView(o)),hd(e.pstyle(a.color).value,e.pstyle(a.opacity).value,this.colorBuffer.getView(o));var c=this.lineWidthBuffer.getView(o);if(c[0]=0,c[1]=0,a.border){var d=e.pstyle("border-width").value;if(d>0){hd(e.pstyle("border-color").value,e.pstyle("border-opacity").value,this.borderColorBuffer.getView(o));var h=e.pstyle("border-position").value;if("inside"===h)c[0]=0,c[1]=-d;else if("outside"===h)c[0]=d,c[1]=0;else{var f=d/2;c[0]=f,c[1]=-f}}}var p=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(e,p,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"_getVertTypeForShape",value:function(e,t){switch(e.pstyle(t).value){case"rectangle":return 4;case"ellipse":return 7;case"roundrectangle":case"round-rectangle":return 5;case"bottom-round-rectangle":return 6;default:return}}},{key:"_getCornerRadius",value:function(e,t,n){var r=n.w,a=n.h;if("auto"===e.pstyle(t).value)return Pn(r,a);var i=e.pstyle(t).pfValue,o=r/2,s=a/2;return Math.min(i,s,o)}},{key:"drawEdgeArrow",value:function(e,t,n){if(e.visible()){var r,a,i,o=e._private.rscratch;if(!("source"===n?(r=o.arrowStartX,a=o.arrowStartY,i=o.srcArrowAngle):(r=o.arrowEndX,a=o.arrowEndY,i=o.tgtArrowAngle),isNaN(r)||null==r||isNaN(a)||null==a||isNaN(i)||null==i||"none"===e.pstyle(n+"-arrow-shape").value)){var s=e.pstyle(n+"-arrow-color").value,u=e.pstyle("opacity").value*e.pstyle("line-opacity").value,l=e.pstyle("width").pfValue,c=e.pstyle("arrow-scale").value,d=this.r.getArrowWidth(l,c),h=this.instanceCount,f=this.transformBuffer.getMatrixView(h);wd(f),Ed(f,f,[r,a]),_d(f,f,[d,d]),kd(f,f,i),this.vertTypeBuffer.getView(h)[0]=3,fd(t,this.indexBuffer.getView(h)),hd(s,u,this.colorBuffer.getView(h)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(e,t){if(e.visible()){var n=this._getEdgePoints(e);if(n){var r=e.pstyle("opacity").value,a=e.pstyle("line-opacity").value,i=e.pstyle("width").pfValue,o=e.pstyle("line-color").value,s=r*a;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),4==n.length){var u=this.instanceCount;this.vertTypeBuffer.getView(u)[0]=1,fd(t,this.indexBuffer.getView(u)),hd(o,s,this.colorBuffer.getView(u)),this.lineWidthBuffer.getView(u)[0]=i;var l=this.pointAPointBBuffer.getView(u);l[0]=n[0],l[1]=n[1],l[2]=n[2],l[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var c=0;c=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(e){var t=e._private.rscratch;return!t.badLine&&null!=t.allpts&&!isNaN(t.allpts[0])}},{key:"_getEdgePoints",value:function(e){var t=e._private.rscratch;if(this._isValidEdge(e)){var n=t.allpts;if(4==n.length)return n;var r=this._getNumSegments(e);return this._getCurveSegmentPoints(n,r)}}},{key:"_getNumSegments",value:function(e){return Math.min(Math.max(15,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(e,t){if(4==e.length)return e;for(var n=Array(2*(t+1)),r=0;r<=t;r++)if(0==r)n[0]=e[0],n[1]=e[1];else if(r==t)n[2*r]=e[e.length-2],n[2*r+1]=e[e.length-1];else{var a=r/t;this._setCurvePoint(e,a,n,2*r)}return n}},{key:"_setCurvePoint",value:function(e,t,n,r){if(!(e.length<=2)){for(var a=Array(e.length-2),i=0;i0}},l=function(e){return"yes"===e.pstyle("text-events").strValue?2:1},c=function(e){var t=e.position(),n=t.x,r=t.y,a=e.outerWidth(),i=e.outerHeight();return{w:a,h:i,x1:n-a/2,y1:r-i/2}};n.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),n.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),n.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),n.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:c,isSimple:cd,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),n.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:c,isVisible:u("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),n.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:c,isVisible:u("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),n.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:l,getKey:Id(t.getLabelKey,null),getBoundingBox:Nd(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:i(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:s("label")}),n.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:l,getKey:Id(t.getSourceLabelKey,"source"),getBoundingBox:Nd(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:i("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:s("source-label")}),n.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:l,getKey:Id(t.getTargetLabelKey,"target"),getBoundingBox:Nd(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:i("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:s("target-label")});var d=De(function(){console.log("garbage collect flag set"),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(e,t){var r=!1;t&&t.length>0&&(r|=n.drawing.invalidate(t)),r&&d()}),function(e){var t=e.render;e.render=function(n){n=n||{};var r=e.cy;e.webgl&&(r.zoom()>7.99?(function(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}(e),t.call(e,n)):(function(e){var t=function(t){t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.canvasWidth,e.canvasHeight),t.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}(e),Od(e,n,Bd.SCREEN)))};var n=e.matchCanvasSize;e.matchCanvasSize=function(t){n.call(e,t),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0},e.findNearestElements=function(t,n,r,i){return function(e,t,n){var r,i,s,u=function(e,t,n){var r,a,i=ld(e),s=function(e,t,n,r,a){var i=r*n+t.x,o=a*n+t.y;return[i,o=Math.round(e.canvasHeight-o)]}(e,i.pan,i.zoom,t,n),u=o(s,2);if(r=u[0]-3,a=u[1]-3,0==6)return[];var l=e.data.contexts[e.WEBGL];l.bindFramebuffer(l.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(l.viewport(0,0,l.canvas.width,l.canvas.height),Od(e,null,Bd.PICKING),e.pickingFrameBuffer.needsDraw=!1);var c=new Uint8Array(144);l.readPixels(r,a,6,6,l.RGBA,l.UNSIGNED_BYTE,c),l.bindFramebuffer(l.FRAMEBUFFER,null);for(var d=new Set,h=0;h<36;h++){var f=pd(c.slice(4*h,4*h+4))-1;f>=0&&d.add(f)}return d}(e,t,n),l=e.getCachedZSortedEles(),c=a(u);try{for(c.s();!(s=c.n()).done;){var d=l[s.value];if(!r&&d.isNode()&&(r=d),!i&&d.isEdge()&&(i=d),r&&i)break}}catch(e){c.e(e)}finally{c.f()}return[r,i].filter(Boolean)}(e,t,n)};var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0};var i=e.notify;e.notify=function(t,n){i.call(e,t,n),"viewport"===t||"bounds"===t?e.pickingFrameBuffer.needsDraw=!0:"background"===t&&e.drawing.invalidate(n,{type:"node-body"})}}(n)};var Id=function(e,t){return function(n){var r=e(n),a=Ad(n,t);return a.length>1?a.map(function(e,t){return"".concat(r,"_").concat(t)}):r}},Nd=function(e,t){return function(n,r){var a=e(n);if("string"==typeof r){var i=r.indexOf("_");if(i>0){var o=Number(r.substring(i+1)),s=Ad(n,t),u=a.h/s.length,l=u*o,c=a.y1+l;return{x1:a.x1,w:a.w,y1:c,h:u,yOffset:l}}}return a}};function Rd(e,t){var n=e.canvasWidth,r=e.canvasHeight,a=ld(e),i=a.pan,o=a.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(i.x,i.y),t.scale(o,o)}function Ld(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,"node-underlay"),r.drawNode(n,t,"node-body"),r.drawTexture(n,t,"label"),r.drawNode(n,t,"node-overlay")):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,"source"),r.drawEdgeArrow(n,t,"target"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"edge-source-label"),r.drawTexture(n,t,"edge-target-label"))}function Od(e,t,n){var r;e.webglDebug&&(r=performance.now());var i=e.drawing,o=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&function(e,t){e.drawSelectionRectangle(t,function(t){return Rd(e,t)})}(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var s=e.data.contexts[e.WEBGL];n.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var u=function(e){var t=e.canvasWidth,n=e.canvasHeight,r=ld(e),a=r.pan,i=r.zoom,o=xd();Ed(o,o,[a.x,a.y]),_d(o,o,[i,i]);var s=xd();!function(e,t,n){e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1}(s,t,n);var u,l,c,d,h,f,p,v,g,y,m,b,x,w,E,k,_,C,T,S,P,B=xd();return u=B,c=o,d=(l=s)[0],h=l[1],f=l[2],p=l[3],v=l[4],g=l[5],y=l[6],m=l[7],b=l[8],x=c[0],w=c[1],E=c[2],k=c[3],_=c[4],C=c[5],T=c[6],S=c[7],P=c[8],u[0]=x*d+w*p+E*y,u[1]=x*h+w*v+E*m,u[2]=x*f+w*g+E*b,u[3]=k*d+_*p+C*y,u[4]=k*h+_*v+C*m,u[5]=k*f+_*g+C*b,u[6]=T*d+S*p+P*y,u[7]=T*h+S*v+P*m,u[8]=T*f+S*g+P*b,B}(e),l=e.getCachedZSortedEles();if(o=l.length,i.startFrame(u,n),n.screen){for(var c=0;c0&&i>0){h.clearRect(0,0,a,i),h.globalCompositeOperation="source-over";var f=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*u,-n.y1*u),h.scale(u,u),this.drawElements(h,f),h.scale(1/u,1/u),h.translate(n.x1*u,n.y1*u);else{var p=t.pan(),v={x:p.x*u,y:p.y*u};u*=t.zoom(),h.translate(v.x,v.y),h.scale(u,u),this.drawElements(h,f),h.scale(1/u,1/u),h.translate(-v.x,-v.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,a,i),h.fill())}return d},Wd.png=function(e){return Gd(e,this.bufferCanvasImage(e),"image/png")},Wd.jpg=function(e){return Gd(e,this.bufferCanvasImage(e),"image/jpeg")};var Hd=Zd,Kd=Zd.prototype;function Zd(e){var t=this,n=t.cy.window().document;e.webgl&&(Kd.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:new Array(Kd.CANVAS_LAYERS),contexts:new Array(Kd.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Kd.CANVAS_LAYERS),bufferCanvases:new Array(Kd.BUFFER_COUNT),bufferContexts:new Array(Kd.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";t.data.canvasContainer=n.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=a,i.position="relative",i.zIndex="0",i.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=a;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};h&&h.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var u=0;uthis.loadGraph()),t.addEventListener("click",()=>this.fitGraph()),n.addEventListener("click",()=>this.zoomIn()),r.addEventListener("click",()=>this.zoomOut()),a.addEventListener("change",e=>{this.currentLayout=e.target.value,this.applyLayout()}),i.addEventListener("change",e=>{this.colorMode=e.target.value,this.updateColors(),this.updateLegend()}),o.addEventListener("change",e=>{this.showNetworks=e.target.checked,this.applyFilters()}),s.addEventListener("change",e=>{this.showVolumes=e.target.checked,this.applyFilters()}),u.addEventListener("change",e=>{this.showStoppedContainers=e.target.checked,this.applyFilters()})}async loadGraph(){try{this.sdk.showToast("Loading graph data...","info");const e=await this.sdk.fetch("/graph-data");if(!e.ok)throw new Error(`Failed to load graph: ${e.statusText}`);const t=await e.json();this.renderGraph(t),this.sdk.showToast("Graph loaded successfully!","success")}catch(e){console.error("Failed to load graph:",e),this.sdk.showToast(`Failed to load graph: ${e.message}`,"error"),this.renderError(e.message)}}renderGraph(e){const t=document.getElementById("graphContainer");this.cy&&this.cy.destroy();const n=this.convertToElements(e);this.cy=uh({container:t,elements:n,style:this.getStylesheet(),layout:this.getLayoutConfig(),minZoom:.01,maxZoom:20,wheelSensitivity:.05}),this.cy.on("tap","node",e=>{const t=e.target;this.showNodeDetails(t)}),this.applyFilters(),this.updateLegend()}convertToElements(e){return[...e.nodes.map(e=>({data:{id:e.id,label:e.label,type:e.type,status:e.status,host_id:e.host_id}})),...e.edges.map(e=>({data:{id:`${e.from}-${e.to}-${e.type}`,source:e.from,target:e.to,type:e.type,label:e.label||""}}))]}getStylesheet(){return[{selector:'node[type="container"]',style:{"background-color":e=>this.getContainerColor(e),label:"data(label)",color:"#ffffff","text-valign":"center","text-halign":"center","font-size":"12px","font-weight":"500",width:60,height:60,shape:"roundrectangle","border-width":2,"border-color":"#ffffff","text-wrap":"wrap","text-max-width":"60px"}},{selector:'node[type="network"]',style:{"background-color":"#3b82f6",label:"data(label)",color:"#ffffff","text-valign":"center","text-halign":"center","font-size":"11px",width:50,height:50,shape:"ellipse","border-width":2,"border-color":"#ffffff"}},{selector:'node[type="volume"]',style:{"background-color":"#f59e0b",label:"data(label)",color:"#ffffff","text-valign":"center","text-halign":"center","font-size":"11px",width:50,height:50,shape:"barrel","border-width":2,"border-color":"#ffffff"}},{selector:"edge",style:{width:2,"line-color":"#cbd5e1","target-arrow-color":"#cbd5e1","target-arrow-shape":"triangle","curve-style":"bezier",opacity:.6}},{selector:'edge[type="network"]',style:{"line-color":"#3b82f6","target-arrow-color":"#3b82f6"}},{selector:'edge[type="volume"]',style:{"line-color":"#f59e0b","target-arrow-color":"#f59e0b"}},{selector:"node:selected",style:{"border-width":4,"border-color":"#ef4444"}},{selector:".hidden",style:{display:"none"}}]}getLayoutConfig(){const e={dagre:{name:"dagre",rankDir:"LR",nodeSep:50,rankSep:150,animate:!0,animationDuration:500},circle:{name:"circle",animate:!0,animationDuration:500},grid:{name:"grid",animate:!0,animationDuration:500},cose:{name:"cose",animate:!0,animationDuration:500,nodeRepulsion:4e3,idealEdgeLength:80,gravity:1,numIter:1e3,componentSpacing:100}};return e[this.currentLayout]||e.cose}applyLayout(){this.cy&&this.cy.layout(this.getLayoutConfig()).run()}applyFilters(){this.cy&&(this.cy.elements().removeClass("hidden"),this.showNetworks||(this.cy.nodes('[type="network"]').addClass("hidden"),this.cy.edges('[type="network"]').addClass("hidden")),this.showVolumes||(this.cy.nodes('[type="volume"]').addClass("hidden"),this.cy.edges('[type="volume"]').addClass("hidden")),this.showStoppedContainers||this.cy.nodes('[type="container"]').filter(e=>{const t=e.data("status");return!(t&&t.toLowerCase().startsWith("up"))}).addClass("hidden"))}fitGraph(){this.cy&&this.cy.fit(null,50)}zoomIn(){if(!this.cy)return;const e=this.cy.zoom();this.cy.zoom({level:1.5*e,renderedPosition:{x:this.cy.width()/2,y:this.cy.height()/2}})}zoomOut(){if(!this.cy)return;const e=this.cy.zoom();this.cy.zoom({level:e/1.5,renderedPosition:{x:this.cy.width()/2,y:this.cy.height()/2}})}getContainerColor(e){if("status"===this.colorMode){const t=e.data("status");return t&&t.toLowerCase().startsWith("up")?"#10b981":"#ef4444"}if("project"===this.colorMode){const t=e.data("compose_project");return t?this.getProjectColor(t):"#6b7280"}return"#6b7280"}getProjectColor(e){if(this.projectColors[e])return this.projectColors[e];const t=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#06b6d4","#84cc16"],n=Object.keys(this.projectColors).length%t.length;return this.projectColors[e]=t[n],t[n]}updateColors(){this.cy&&(this.projectColors={},this.cy.style(this.getStylesheet()))}updateLegend(){const e=document.getElementById("graphLegend");if("status"===this.colorMode)e.innerHTML='\n
\n \n Running\n
\n
\n \n Stopped\n
\n
\n \n Network\n
\n
\n \n Volume\n
\n ';else if("project"===this.colorMode){let t='\n
\n \n No Project\n
\n ';const n=Object.keys(this.projectColors).sort();for(const e of n)t+=`\n
\n \n ${e}\n
\n `;t+='\n
\n \n Network\n
\n
\n \n Volume\n
\n ',e.innerHTML=t}}showNodeDetails(e){const t=e.data();let n=`Type: ${t.type}
`;n+=`Label: ${t.label}
`,"container"===t.type&&(n+=`Status: ${t.status}
`,n+=`Host ID: ${t.host_id}
`),this.sdk.showToast(n,"info")}renderError(e){document.getElementById("graphContainer").innerHTML=`\n
\n
\n

⚠️ Error Loading Graph

\n

${e}

\n \n
\n
\n `}}"undefined"!=typeof window&&(window.initGraphVisualizer=function(e,t){new Ch(e,t).init()})})()})(); \ No newline at end of file +(()=>{var e={2:(e,t,n)=>{var r=n(2199),a=n(4664),i=n(5950);e.exports=function(e){return r(e,i,a)}},79:(e,t,n)=>{var r=n(3702),a=n(80),i=n(4739),o=n(8655),s=n(1175);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var r=n(6025),a=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0||(n==t.length-1?t.pop():a.call(t,n,1),--this.size,0))}},104:(e,t,n)=>{var r=n(3661);function a(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],i=n.cache;if(i.has(a))return i.get(a);var o=e.apply(this,r);return n.cache=i.set(a,o)||i,o};return n.cache=new(a.Cache||r),n}a.Cache=r,e.exports=a},117:(e,t,n)=>{var r;try{r={clone:n(2629),constant:n(7334),each:n(6135),filter:n(7612),has:n(1448),isArray:n(6449),isEmpty:n(2193),isFunction:n(1882),isUndefined:n(2216),keys:n(5950),map:n(5378),reduce:n(860),size:n(7091),transform:n(9752),union:n(299),values:n(5880)}}catch(e){}r||(r=window._),e.exports=r},124:(e,t,n)=>{var r=n(9325);e.exports=function(){return r.Date.now()}},135:(e,t,n)=>{var r=n(6857),a=n(3988);function i(e,t,n,r,i,o){var s={width:0,height:0,rank:o,borderType:t},u=i[t][o-1],l=a.addDummyNode(e,"border",s,n);i[t][o]=l,e.setParent(l,r),u&&e.setEdge(u,l,{weight:1})}e.exports=function(e){r.forEach(e.children(),function t(n){var a=e.children(n),o=e.node(n);if(a.length&&r.forEach(a,t),r.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var s=o.minRank,u=o.maxRank+1;s{e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},270:(e,t,n)=>{var r=n(7068),a=n(346);e.exports=function e(t,n,i,o,s){return t===n||(null==t||null==n||!a(t)&&!a(n)?t!=t&&n!=n:r(t,n,i,o,e,s))}},289:(e,t,n)=>{var r=n(2651);e.exports=function(e){return r(this,e).get(e)}},294:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},299:(e,t,n)=>{var r=n(3120),a=n(9302),i=n(5765),o=n(3693),s=a(function(e){return i(r(e,1,o,!0))});e.exports=s},317:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}},346:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},361:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,n){var r=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&t.test(e))&&e>-1&&e%1==0&&e{"use strict";n.d(t,{A:()=>s});var r=n(1601),a=n.n(r),i=n(6314),o=n.n(i)()(a());o.push([e.id,'/**\n * Container Census - Graph Visualizer Plugin Styles\n */\n\n.graph-visualizer {\n display: flex;\n flex-direction: column;\n height: calc(100vh - 120px);\n background: #f8f9fa;\n border-radius: 8px;\n overflow: hidden;\n}\n\n.graph-toolbar {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 15px 20px;\n background: white;\n border-bottom: 1px solid #dee2e6;\n}\n\n.graph-toolbar-left {\n display: flex;\n align-items: center;\n gap: 15px;\n}\n\n.graph-toolbar-right {\n display: flex;\n align-items: center;\n gap: 15px;\n}\n\n.graph-filter {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 14px;\n cursor: pointer;\n user-select: none;\n}\n\n.graph-filter input[type="checkbox"] {\n cursor: pointer;\n width: 16px;\n height: 16px;\n}\n\n.graph-filter span {\n color: #495057;\n}\n\n.graph-layout-select {\n padding: 6px 12px;\n border: 1px solid #ced4da;\n border-radius: 4px;\n font-size: 14px;\n background: white;\n color: #495057;\n cursor: pointer;\n outline: none;\n}\n\n.graph-layout-select:focus {\n border-color: #3b82f6;\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n}\n\n.graph-btn {\n padding: 8px 16px;\n border: none;\n border-radius: 4px;\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.2s ease;\n outline: none;\n}\n\n.graph-btn:hover {\n transform: translateY(-1px);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n}\n\n.graph-btn:active {\n transform: translateY(0);\n}\n\n.graph-btn-primary {\n background: #3b82f6;\n color: white;\n}\n\n.graph-btn-primary:hover {\n background: #2563eb;\n}\n\n.graph-btn-secondary {\n background: #6c757d;\n color: white;\n}\n\n.graph-btn-secondary:hover {\n background: #5a6268;\n}\n\n.graph-container {\n flex: 1;\n background: white;\n position: relative;\n margin: 15px;\n border-radius: 8px;\n border: 1px solid #dee2e6;\n overflow: hidden;\n}\n\n.graph-legend {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 30px;\n padding: 12px 20px;\n background: white;\n border-top: 1px solid #dee2e6;\n}\n\n.legend-item {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 13px;\n color: #495057;\n}\n\n.legend-box {\n width: 20px;\n height: 20px;\n border-radius: 4px;\n border: 2px solid white;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);\n}\n\n/* Responsive design */\n@media (max-width: 768px) {\n .graph-toolbar {\n flex-direction: column;\n align-items: flex-start;\n gap: 12px;\n }\n\n .graph-toolbar-right {\n flex-wrap: wrap;\n width: 100%;\n }\n\n .graph-legend {\n flex-wrap: wrap;\n gap: 15px;\n }\n}\n\n/* Loading state */\n.graph-loading {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n font-size: 16px;\n color: #6c757d;\n}\n\n/* Error state */\n.graph-error {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n color: #dc3545;\n text-align: center;\n padding: 20px;\n}\n',""]);const s=o},392:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},426:e=>{var t=Object.prototype.hasOwnProperty;e.exports=function(e,n){return null!=e&&t.call(e,n)}},498:(e,t,n)=>{var r=n(9888);e.exports=function(e){try{r(e)}catch(e){if(e instanceof r.CycleException)return!1;throw e}return!0}},514:(e,t,n)=>{var r=n(4932);e.exports=function(e,t){return r(t,function(t){return e[t]})}},540:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},583:(e,t,n)=>{var r=n(7237),a=n(7255),i=n(8586),o=n(7797);e.exports=function(e){return i(e)?r(o(e)):a(e)}},631:(e,t,n)=>{var r=n(8077),a=n(9326);e.exports=function(e,t){return null!=e&&a(e,t,r)}},641:(e,t,n)=>{var r=n(6649),a=n(5950);e.exports=function(e,t){return e&&r(e,t,a)}},659:(e,t,n)=>{var r=n(1873),a=Object.prototype,i=a.hasOwnProperty,o=a.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var a=o.call(e);return r&&(t?e[s]=n:delete e[s]),a}},689:(e,t,n)=>{var r=n(2),a=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,i,o,s){var u=1&n,l=r(e),c=l.length;if(c!=r(t).length&&!u)return!1;for(var d=c;d--;){var h=l[d];if(!(u?h in t:a.call(t,h)))return!1}var f=s.get(e),p=s.get(t);if(f&&p)return f==t&&p==e;var v=!0;s.set(e,t),s.set(t,e);for(var g=u;++d{var r=n(8096),a=n(2428),i=n(6449),o=n(3656),s=n(361),u=n(7167),l=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=i(e),c=!n&&a(e),d=!n&&!c&&o(e),h=!n&&!c&&!d&&u(e),f=n||c||d||h,p=f?r(e.length,String):[],v=p.length;for(var g in e)!t&&!l.call(e,g)||f&&("length"==g||d&&("offset"==g||"parent"==g)||h&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||s(g,v))||p.push(g);return p}},756:(e,t,n)=>{var r=n(3805);e.exports=function(e){return e==e&&!r(e)}},776:(e,t,n)=>{var r=n(756),a=n(5950);e.exports=function(e){for(var t=a(e),n=t.length;n--;){var i=t[n],o=e[i];t[n]=[i,o,r(o)]}return t}},860:(e,t,n)=>{var r=n(882),a=n(909),i=n(5389),o=n(5558),s=n(6449);e.exports=function(e,t,n){var u=s(e)?r:o,l=arguments.length<3;return u(e,i(t,4),n,l,a)}},882:e=>{e.exports=function(e,t,n,r){var a=-1,i=null==e?0:e.length;for(r&&i&&(n=e[++a]);++a{var r=n(641),a=n(8329)(r);e.exports=a},938:e=>{e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},945:(e,t,n)=>{var r=n(79),a=n(8223),i=n(3661);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var o=n.__data__;if(!a||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(o)}return n.set(e,t),this.size=n.size,this}},999:(e,t,n)=>{var r=n(9302),a=n(6800);e.exports=function(e){return r(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,s&&a(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++r{e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},1042:(e,t,n)=>{var r=n(6110)(Object,"create");e.exports=r},1045:(e,t,n)=>{var r=n(9276);e.exports=function(e,t){return r(e,t,"post")}},1113:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},1166:(e,t,n)=>{e.exports={Graph:n(6454),version:n(4458)}},1175:(e,t,n)=>{var r=n(6025);e.exports=function(e,t){var n=this.__data__,a=r(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this}},1234:e=>{e.exports=function(e,t,n){for(var r=-1,a=e.length,i=t.length,o={};++r{var r=n(2552),a=n(8879),i=n(346),o=Function.prototype,s=Object.prototype,u=o.toString,l=s.hasOwnProperty,c=u.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=a(e);if(null===t)return!0;var n=l.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&u.call(n)==c}},1380:e=>{e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},1420:(e,t,n)=>{var r=n(79);e.exports=function(){this.__data__=new r,this.size=0}},1448:(e,t,n)=>{var r=n(426),a=n(9326);e.exports=function(e,t){return null!=e&&a(e,t,r)}},1453:(e,t,n)=>{"use strict";var r=n(6857),a=n(8918),i=n(6639),o=n(4520),s=n(7860),u=n(4384),l=n(8191).Graph,c=n(3988);function d(e,t,n){return r.map(t,function(t){return s(e,t,n)})}function h(e,t){var n=new l;r.forEach(e,function(e){var a=e.graph().root,i=o(e,a,n,t);r.forEach(i.vs,function(t,n){e.node(t).order=n}),u(e,n,i.vs)})}function f(e,t){r.forEach(t,function(t){r.forEach(t,function(t,n){e.node(t).order=n})})}e.exports=function(e){var t=c.maxRank(e),n=d(e,r.range(1,t+1),"inEdges"),o=d(e,r.range(t-1,-1,-1),"outEdges"),s=a(e);f(e,s);for(var u,l=Number.POSITIVE_INFINITY,p=0,v=0;v<4;++p,++v){h(p%2?n:o,p%4>=2),s=c.buildLayerMatrix(e);var g=i(e,s);g{e.exports=function(e){return this.__data__.has(e)}},1489:(e,t,n)=>{var r=n(7400);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},1549:(e,t,n)=>{var r=n(2032),a=n(3862),i=n(6721),o=n(2749),s=n(5749);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{"use strict";e.exports=function(e){return e[1]}},1667:(e,t,n)=>{e.exports={components:n(3619),dijkstra:n(8905),dijkstraAll:n(4919),findCycles:n(6678),floydWarshall:n(3590),isAcyclic:n(498),postorder:n(1045),preorder:n(6016),prim:n(4423),tarjan:n(6291),topsort:n(9888)}},1684:(e,t,n)=>{var r=n(3599),a=n(6176),i=n(3488);e.exports=function(e){return e&&e.length?r(e,i,a):void 0}},1737:(e,t,n)=>{var r=n(117);function a(){this._arr=[],this._keyIndices={}}e.exports=a,a.prototype.size=function(){return this._arr.length},a.prototype.keys=function(){return this._arr.map(function(e){return e.key})},a.prototype.has=function(e){return r.has(this._keyIndices,e)},a.prototype.priority=function(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority},a.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},a.prototype.add=function(e,t){var n=this._keyIndices;if(e=String(e),!r.has(n,e)){var a=this._arr,i=a.length;return n[e]=i,a.push({key:e,priority:t}),this._decrease(i),!0}return!1},a.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},a.prototype.decrease=function(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[n].priority+" New: "+t);this._arr[n].priority=t,this._decrease(n)},a.prototype._heapify=function(e){var t=this._arr,n=2*e,r=n+1,a=e;n>1].priority{var r=n(6449),a=n(8586),i=n(1802),o=n(3222);e.exports=function(e,t){return r(e)?e:a(e,t)?[e]:i(o(e))}},1791:(e,t,n)=>{var r=n(6547),a=n(3360);e.exports=function(e,t,n,i){var o=!n;n||(n={});for(var s=-1,u=t.length;++s{var r=n(7217),a=n(270);e.exports=function(e,t,n,i){var o=n.length,s=o,u=!i;if(null==e)return!s;for(e=Object(e);o--;){var l=n[o];if(u&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++o{var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},1802:(e,t,n)=>{var r=n(2224),a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,o=r(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(a,function(e,n,r,a){t.push(r?a.replace(i,"$1"):n||e)}),t});e.exports=o},1811:e=>{var t=Date.now;e.exports=function(e){var n=0,r=0;return function(){var a=t(),i=16-(a-r);if(r=a,i>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},1873:(e,t,n)=>{var r=n(9325).Symbol;e.exports=r},1882:(e,t,n)=>{var r=n(2552),a=n(3805);e.exports=function(e){if(!a(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},1961:(e,t,n)=>{var r=n(9653);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}},1986:(e,t,n)=>{var r=n(1873),a=n(7828),i=n(5288),o=n(5911),s=n(317),u=n(4247),l=r?r.prototype:void 0,c=l?l.valueOf:void 0;e.exports=function(e,t,n,r,l,d,h){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new a(e),new a(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var f=s;case"[object Set]":var p=1&r;if(f||(f=u),e.size!=t.size&&!p)return!1;var v=h.get(e);if(v)return v==t;r|=2,h.set(e,t);var g=o(f(e),f(t),r,l,d,h);return h.delete(e),g;case"[object Symbol]":if(c)return c.call(e)==c.call(t)}return!1}},1993:(e,t,n)=>{var r=n(9811),a=n(9698),i=n(7927);e.exports=function(e){return a(e)?i(e):r(e)}},2006:(e,t,n)=>{var r=n(5389),a=n(4894),i=n(5950);e.exports=function(e){return function(t,n,o){var s=Object(t);if(!a(t)){var u=r(n,3);t=i(t),n=function(e){return u(s[e],e,s)}}var l=e(t,n,o);return l>-1?s[u?t[l]:l]:void 0}}},2031:(e,t,n)=>{var r=n(6857),a=n(8191).Graph,i=n(9859);e.exports=function(e,t){if(e.nodeCount()<=1)return[];var n=function(e,t){var n=new a,o=0,s=0;r.forEach(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),r.forEach(e.edges(),function(e){var r=n.edge(e.v,e.w)||0,a=t(e),i=r+a;n.setEdge(e.v,e.w,i),s=Math.max(s,n.node(e.v).out+=a),o=Math.max(o,n.node(e.w).in+=a)});var l=r.range(s+o+3).map(function(){return new i}),c=o+1;return r.forEach(n.nodes(),function(e){u(l,c,n.node(e))}),{graph:n,buckets:l,zeroIdx:c}}(e,t||o),l=function(e,t,n){for(var r,a=[],i=t[t.length-1],o=t[0];e.nodeCount();){for(;r=o.dequeue();)s(e,t,n,r);for(;r=i.dequeue();)s(e,t,n,r);if(e.nodeCount())for(var u=t.length-2;u>0;--u)if(r=t[u].dequeue()){a=a.concat(s(e,t,n,r,!0));break}}return a}(n.graph,n.buckets,n.zeroIdx);return r.flatten(r.map(l,function(t){return e.outEdges(t.v,t.w)}),!0)};var o=r.constant(1);function s(e,t,n,a,i){var o=i?[]:void 0;return r.forEach(e.inEdges(a.v),function(r){var a=e.edge(r),s=e.node(r.v);i&&o.push({v:r.v,w:r.w}),s.out-=a,u(t,n,s)}),r.forEach(e.outEdges(a.v),function(r){var a=e.edge(r),i=r.w,o=e.node(i);o.in-=a,u(t,n,o)}),e.removeNode(a.v),o}function u(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}},2032:(e,t,n)=>{var r=n(1042);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},2193:(e,t,n)=>{var r=n(8984),a=n(5861),i=n(2428),o=n(6449),s=n(4894),u=n(3656),l=n(5527),c=n(7167),d=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(s(e)&&(o(e)||"string"==typeof e||"function"==typeof e.splice||u(e)||c(e)||i(e)))return!e.length;var t=a(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(l(e))return!r(e).length;for(var n in e)if(d.call(e,n))return!1;return!0}},2199:(e,t,n)=>{var r=n(4528),a=n(6449);e.exports=function(e,t,n){var i=t(e);return a(e)?i:r(i,n(e))}},2216:e=>{e.exports=function(e){return void 0===e}},2224:(e,t,n)=>{var r=n(104);e.exports=function(e){var t=r(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}},2271:(e,t,n)=>{var r=n(1791),a=n(4664);e.exports=function(e,t){return r(e,a(e),t)}},2420:(e,t,n)=>{var r=n(6649),a=n(4066),i=n(7241);e.exports=function(e,t){return null==e?e:r(e,a(t),i)}},2428:(e,t,n)=>{var r=n(7534),a=n(346),i=Object.prototype,o=i.hasOwnProperty,s=i.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(e){return a(e)&&o.call(e,"callee")&&!s.call(e,"callee")};e.exports=u},2523:e=>{e.exports=function(e,t,n,r){for(var a=e.length,i=n+(r?1:-1);r?i--:++i{var r=n(1873),a=n(659),i=n(9350),o=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?a(e):i(e)}},2629:(e,t,n)=>{var r=n(9999);e.exports=function(e){return r(e,4)}},2651:(e,t,n)=>{var r=n(4218);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},2749:(e,t,n)=>{var r=n(1042),a=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:a.call(t,e)}},2804:(e,t,n)=>{var r=n(6110)(n(9325),"Promise");e.exports=r},2824:(e,t,n)=>{var r=n(7805),a=n(3290),i=n(1961),o=n(3007),s=n(5529),u=n(2428),l=n(6449),c=n(3693),d=n(3656),h=n(1882),f=n(3805),p=n(1331),v=n(7167),g=n(4974),y=n(9884);e.exports=function(e,t,n,m,b,x,w){var E=g(e,n),k=g(t,n),_=w.get(k);if(_)r(e,n,_);else{var C=x?x(E,k,n+"",e,t,w):void 0,T=void 0===C;if(T){var S=l(k),P=!S&&d(k),B=!S&&!P&&v(k);C=k,S||P||B?l(E)?C=E:c(E)?C=o(E):P?(T=!1,C=a(k,!0)):B?(T=!1,C=i(k,!0)):C=[]:p(k)||u(k)?(C=E,u(E)?C=y(E):f(E)&&!h(E)||(C=s(k))):T=!1}T&&(w.set(k,C),b(C,k,m,x,w),w.delete(k)),r(e,n,C)}}},2865:(e,t,n)=>{var r=n(9570),a=n(1811)(r);e.exports=a},2903:(e,t,n)=>{var r=n(3805),a=n(5527),i=n(181),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=a(e),n=[];for(var s in e)("constructor"!=s||!t&&o.call(e,s))&&n.push(s);return n}},2948:(e,t,n)=>{var r=n(6857);e.exports=function(e){var t=function(e){var t={},n=0;return r.forEach(e.children(),function a(i){var o=n;r.forEach(e.children(i),a),t[i]={low:o,lim:n++}}),t}(e);r.forEach(e.graph().dummyChains,function(n){for(var r=e.node(n),a=r.edgeObj,i=function(e,t,n,r){var a,i,o=[],s=[],u=Math.min(t[n].low,t[r].low),l=Math.max(t[n].lim,t[r].lim);a=n;do{a=e.parent(a),o.push(a)}while(a&&(t[a].low>u||l>t[a].lim));for(i=a,a=r;(a=e.parent(a))!==i;)s.push(a);return{path:o.concat(s.reverse()),lca:i}}(e,t,a.v,a.w),o=i.path,s=i.lca,u=0,l=o[u],c=!0;n!==a.w;){if(r=e.node(n),c){for(;(l=o[u])!==s&&e.node(l).maxRank{var r=n(2651);e.exports=function(e,t){var n=r(this,e),a=n.size;return n.set(e,t),this.size+=n.size==a?0:1,this}},3007:e=>{e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n{var r=n(3120),a=n(6155),i=n(9302),o=n(6800),s=i(function(e,t){if(null==e)return[];var n=t.length;return n>1&&o(e,t[0],t[1])?t=[]:n>2&&o(t[0],t[1],t[2])&&(t=[t[0]]),a(e,r(t,1),[])});e.exports=s},3040:(e,t,n)=>{var r=n(1549),a=n(79),i=n(8223);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||a),string:new r}}},3120:(e,t,n)=>{var r=n(4528),a=n(5891);e.exports=function e(t,n,i,o,s){var u=-1,l=t.length;for(i||(i=a),s||(s=[]);++u0&&i(c)?n>1?e(c,n-1,i,o,s):r(s,c):o||(s[s.length]=c)}return s}},3170:(e,t,n)=>{var r=n(6547),a=n(1769),i=n(361),o=n(3805),s=n(7797);e.exports=function(e,t,n,u){if(!o(e))return e;for(var l=-1,c=(t=a(t,e)).length,d=c-1,h=e;null!=h&&++l{var r=n(5508)();e.exports=r},3201:e=>{var t=/\w*$/;e.exports=function(e){var n=new e.constructor(e.source,t.exec(e));return n.lastIndex=e.lastIndex,n}},3221:e=>{e.exports=function(e){return function(t,n,r){for(var a=-1,i=Object(t),o=r(t),s=o.length;s--;){var u=o[e?s:++a];if(!1===n(i[u],u,i))break}return t}}},3222:(e,t,n)=>{var r=n(7556);e.exports=function(e){return null==e?"":r(e)}},3243:(e,t,n)=>{var r=n(6110),a=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=a},3290:(e,t,n)=>{e=n.nmd(e);var r=n(9325),a=t&&!t.nodeType&&t,i=a&&e&&!e.nodeType&&e,o=i&&i.exports===a?r.Buffer:void 0,s=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=s?s(n):new e.constructor(n);return e.copy(r),r}},3335:e=>{e.exports=function(e,t){return e>t}},3345:e=>{e.exports=function(){return[]}},3349:(e,t,n)=>{var r=n(2199),a=n(6375),i=n(7241);e.exports=function(e){return r(e,i,a)}},3360:(e,t,n)=>{var r=n(3243);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},3488:e=>{e.exports=function(e){return e}},3590:(e,t,n)=>{var r=n(117);e.exports=function(e,t,n){return function(e,t,n){var r={},a=e.nodes();return a.forEach(function(e){r[e]={},r[e][e]={distance:0},a.forEach(function(t){e!==t&&(r[e][t]={distance:Number.POSITIVE_INFINITY})}),n(e).forEach(function(n){var a=n.v===e?n.w:n.v,i=t(n);r[e][a]={distance:i,predecessor:e}})}),a.forEach(function(e){var t=r[e];a.forEach(function(n){var i=r[n];a.forEach(function(n){var r=i[e],a=t[n],o=i[n],s=r.distance+a.distance;s{var r=n(4394);e.exports=function(e,t,n){for(var a=-1,i=e.length;++a{e.exports=function(e){return this.__data__.get(e)}},3619:(e,t,n)=>{var r=n(117);e.exports=function(e){var t,n={},a=[];function i(a){r.has(n,a)||(n[a]=!0,t.push(a),r.each(e.successors(a),i),r.each(e.predecessors(a),i))}return r.each(e.nodes(),function(e){t=[],i(e),t.length&&a.push(t)}),a}},3650:(e,t,n)=>{var r=n(4335)(Object.keys,Object);e.exports=r},3656:(e,t,n)=>{e=n.nmd(e);var r=n(9325),a=n(9935),i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,s=o&&o.exports===i?r.Buffer:void 0,u=(s?s.isBuffer:void 0)||a;e.exports=u},3661:(e,t,n)=>{var r=n(3040),a=n(7670),i=n(289),o=n(4509),s=n(2949);function u(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var r=n(1799),a=n(776),i=n(7197);e.exports=function(e){var t=a(e);return 1==t.length&&t[0][2]?i(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},3693:(e,t,n)=>{var r=n(4894),a=n(346);e.exports=function(e){return a(e)&&r(e)}},3702:e=>{e.exports=function(){this.__data__=[],this.size=0}},3714:(e,t,n)=>{var r=n(3730);e.exports=function(e,t,n){for(var a=-1,i=e.criteria,o=t.criteria,s=i.length,u=n.length;++a=u?l:l*("desc"==n[a]?-1:1)}return e.index-t.index}},3729:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n{var r=n(4394);e.exports=function(e,t){if(e!==t){var n=void 0!==e,a=null===e,i=e==e,o=r(e),s=void 0!==t,u=null===t,l=t==t,c=r(t);if(!u&&!c&&!o&&e>t||o&&s&&l&&!u&&!c||a&&s&&l||!n&&l||!i)return 1;if(!a&&!o&&!c&&e{var r=n(1873),a=r?r.prototype:void 0,i=a?a.valueOf:void 0;e.exports=function(e){return i?Object(i.call(e)):{}}},3776:(e,t,n)=>{"use strict";var r=n(6857),a=n(3988),i=n(9741).positionX;e.exports=function(e){(function(e){var t=a.buildLayerMatrix(e),n=e.graph().ranksep,i=0;r.forEach(t,function(t){var a=r.max(r.map(t,function(t){return e.node(t).height}));r.forEach(t,function(t){e.node(t).y=i+a/2}),i+=a+n})})(e=a.asNonCompoundGraph(e)),r.forEach(i(e),function(t,n){e.node(n).x=t})}},3805:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},3838:(e,t,n)=>{var r=n(1791),a=n(7241);e.exports=function(e,t){return e&&r(t,a(t),e)}},3860:(e,t,n)=>{var r=n(6857);e.exports=function(e,t){return r.map(t,function(t){var n=e.inEdges(t);if(n.length){var a=r.reduce(n,function(t,n){var r=e.edge(n),a=e.node(n.v);return{sum:t.sum+r.weight*a.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:a.sum/a.weight,weight:a.weight}}return{v:t}})}},3862:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},3916:(e,t,n)=>{var r=n(3360),a=n(641),i=n(5389);e.exports=function(e,t){var n={};return t=i(t,3),a(e,function(e,a,i){r(n,a,t(e,a,i))}),n}},3937:e=>{e.exports=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}},3950:e=>{e.exports=function(){}},3988:(e,t,n)=>{"use strict";var r=n(6857),a=n(8191).Graph;function i(e,t,n,a){var i;do{i=r.uniqueId(a)}while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function o(e){return r.max(r.map(e.nodes(),function(t){var n=e.node(t).rank;if(!r.isUndefined(n))return n}))}e.exports={addDummyNode:i,simplify:function(e){var t=(new a).setGraph(e.graph());return r.forEach(e.nodes(),function(n){t.setNode(n,e.node(n))}),r.forEach(e.edges(),function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},a=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+a.weight,minlen:Math.max(r.minlen,a.minlen)})}),t},asNonCompoundGraph:function(e){var t=new a({multigraph:e.isMultigraph()}).setGraph(e.graph());return r.forEach(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),r.forEach(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t},successorWeights:function(e){var t=r.map(e.nodes(),function(t){var n={};return r.forEach(e.outEdges(t),function(t){n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return r.zipObject(e.nodes(),t)},predecessorWeights:function(e){var t=r.map(e.nodes(),function(t){var n={};return r.forEach(e.inEdges(t),function(t){n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return r.zipObject(e.nodes(),t)},intersectRect:function(e,t){var n,r,a=e.x,i=e.y,o=t.x-a,s=t.y-i,u=e.width/2,l=e.height/2;if(!o&&!s)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*u>Math.abs(o)*l?(s<0&&(l=-l),n=l*o/s,r=l):(o<0&&(u=-u),n=u,r=u*s/o),{x:a+n,y:i+r}},buildLayerMatrix:function(e){var t=r.map(r.range(o(e)+1),function(){return[]});return r.forEach(e.nodes(),function(n){var a=e.node(n),i=a.rank;r.isUndefined(i)||(t[i][a.order]=n)}),t},normalizeRanks:function(e){var t=r.min(r.map(e.nodes(),function(t){return e.node(t).rank}));r.forEach(e.nodes(),function(n){var a=e.node(n);r.has(a,"rank")&&(a.rank-=t)})},removeEmptyRanks:function(e){var t=r.min(r.map(e.nodes(),function(t){return e.node(t).rank})),n=[];r.forEach(e.nodes(),function(r){var a=e.node(r).rank-t;n[a]||(n[a]=[]),n[a].push(r)});var a=0,i=e.graph().nodeRankFactor;r.forEach(n,function(t,n){r.isUndefined(t)&&n%i!==0?--a:a&&r.forEach(t,function(t){e.node(t).rank+=a})})},addBorderNode:function(e,t,n,r){var a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=r),i(e,"border",a,t)},maxRank:o,partition:function(e,t){var n={lhs:[],rhs:[]};return r.forEach(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n},time:function(e,t){var n=r.now();try{return t()}finally{console.log(e+" time: "+(r.now()-n)+"ms")}},notime:function(e,t){return t()}}},4066:(e,t,n)=>{var r=n(3488);e.exports=function(e){return"function"==typeof e?e:r}},4128:(e,t,n)=>{var r=n(1800),a=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(a,""):e}},4218:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},4247:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}},4248:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n{e.exports=function(e,t){return function(n){return e(t(n))}}},4383:(e,t,n)=>{var r=n(6001),a=n(8816)(function(e,t){return null==e?{}:r(e,t)});e.exports=a},4384:(e,t,n)=>{var r=n(6857);e.exports=function(e,t,n){var a,i={};r.forEach(n,function(n){for(var r,o,s=e.parent(n);s;){if((r=e.parent(s))?(o=i[r],i[r]=s):(o=a,a=s),o&&o!==s)return void t.setEdge(o,s);s=r}})}},4394:(e,t,n)=>{var r=n(2552),a=n(346);e.exports=function(e){return"symbol"==typeof e||a(e)&&"[object Symbol]"==r(e)}},4423:(e,t,n)=>{var r=n(117),a=n(6454),i=n(1737);e.exports=function(e,t){var n,o=new a,s={},u=new i;function l(e){var r=e.v===n?e.w:e.v,a=u.priority(r);if(void 0!==a){var i=t(e);i0;){if(n=u.removeMin(),r.has(s,n))o.setEdge(n,s[n]);else{if(c)throw new Error("Input graph is not connected: "+e);c=!0}e.nodeEdges(n).forEach(l)}return o}},4458:e=>{e.exports="2.1.8"},4506:(e,t,n)=>{var r=n(3599),a=n(3335),i=n(3488);e.exports=function(e){return e&&e.length?r(e,i,a):void 0}},4509:(e,t,n)=>{var r=n(2651);e.exports=function(e){return r(this,e).has(e)}},4517:(e,t,n)=>{var r=n(6545),a=n(3950),i=n(4247),o=r&&1/i(new r([,-0]))[1]==1/0?function(e){return new r(e)}:a;e.exports=o},4520:(e,t,n)=>{var r=n(6857),a=n(3860),i=n(4959),o=n(5169);e.exports=function e(t,n,s,u){var l=t.children(n),c=t.node(n),d=c?c.borderLeft:void 0,h=c?c.borderRight:void 0,f={};d&&(l=r.filter(l,function(e){return e!==d&&e!==h}));var p=a(t,l);r.forEach(p,function(n){if(t.children(n.v).length){var a=e(t,n.v,s,u);f[n.v]=a,r.has(a,"barycenter")&&(i=n,o=a,r.isUndefined(i.barycenter)?(i.barycenter=o.barycenter,i.weight=o.weight):(i.barycenter=(i.barycenter*i.weight+o.barycenter*o.weight)/(i.weight+o.weight),i.weight+=o.weight))}var i,o});var v=i(p,s);!function(e,t){r.forEach(e,function(e){e.vs=r.flatten(e.vs.map(function(e){return t[e]?t[e].vs:e}),!0)})}(v,f);var g=o(v,u);if(d&&(g.vs=r.flatten([d,g.vs,h],!0),t.predecessors(d).length)){var y=t.node(t.predecessors(d)[0]),m=t.node(t.predecessors(h)[0]);r.has(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+y.order+m.order)/(g.weight+2),g.weight+=2}return g}},4528:e=>{e.exports=function(e,t){for(var n=-1,r=t.length,a=e.length;++n{var r=n(9770),a=n(3345),i=Object.prototype.propertyIsEnumerable,o=Object.getOwnPropertySymbols,s=o?function(e){return null==e?[]:(e=Object(e),r(o(e),function(t){return i.call(e,t)}))}:a;e.exports=s},4684:(e,t,n)=>{var r=n(9302),a=n(5288),i=n(6800),o=n(7241),s=Object.prototype,u=s.hasOwnProperty,l=r(function(e,t){e=Object(e);var n=-1,r=t.length,l=r>2?t[2]:void 0;for(l&&i(t[0],t[1],l)&&(r=1);++n{var r=n(2523),a=n(5389),i=n(1489),o=Math.max;e.exports=function(e,t,n){var s=null==e?0:e.length;if(!s)return-1;var u=null==n?0:i(n);return u<0&&(u=o(s+u,0)),r(e,a(t,3),u)}},4733:(e,t,n)=>{var r=n(1791),a=n(5950);e.exports=function(e,t){return e&&r(t,a(t),e)}},4739:(e,t,n)=>{var r=n(6025);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},4840:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},4850:(e,t,n)=>{"use strict";var r=n(6857);function a(e){r.forEach(e.nodes(),function(t){i(e.node(t))}),r.forEach(e.edges(),function(t){i(e.edge(t))})}function i(e){var t=e.width;e.width=e.height,e.height=t}function o(e){e.y=-e.y}function s(e){var t=e.x;e.x=e.y,e.y=t}e.exports={adjust:function(e){var t=e.graph().rankdir.toLowerCase();"lr"!==t&&"rl"!==t||a(e)},undo:function(e){var t=e.graph().rankdir.toLowerCase();"bt"!==t&&"rl"!==t||function(e){r.forEach(e.nodes(),function(t){o(e.node(t))}),r.forEach(e.edges(),function(t){var n=e.edge(t);r.forEach(n.points,o),r.has(n,"y")&&o(n)})}(e),"lr"!==t&&"rl"!==t||(function(e){r.forEach(e.nodes(),function(t){s(e.node(t))}),r.forEach(e.edges(),function(t){var n=e.edge(t);r.forEach(n.points,s),r.has(n,"x")&&s(n)})}(e),a(e))}}},4894:(e,t,n)=>{var r=n(1882),a=n(294);e.exports=function(e){return null!=e&&a(e.length)&&!r(e)}},4901:(e,t,n)=>{var r=n(2552),a=n(294),i=n(346),o={};o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o["[object Arguments]"]=o["[object Array]"]=o["[object ArrayBuffer]"]=o["[object Boolean]"]=o["[object DataView]"]=o["[object Date]"]=o["[object Error]"]=o["[object Function]"]=o["[object Map]"]=o["[object Number]"]=o["[object Object]"]=o["[object RegExp]"]=o["[object Set]"]=o["[object String]"]=o["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&a(e.length)&&!!o[r(e)]}},4919:(e,t,n)=>{var r=n(8905),a=n(117);e.exports=function(e,t,n){return a.transform(e.nodes(),function(a,i){a[i]=r(e,i,t,n)},{})}},4932:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,a=Array(r);++n{"use strict";var r=n(6857);e.exports=function(e,t){var n={};return r.forEach(e,function(e,t){var a=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};r.isUndefined(e.barycenter)||(a.barycenter=e.barycenter,a.weight=e.weight)}),r.forEach(t.edges(),function(e){var t=n[e.v],a=n[e.w];r.isUndefined(t)||r.isUndefined(a)||(a.indegree++,t.out.push(n[e.w]))}),function(e){var t=[];function n(e){return function(t){var n,a,i,o;t.merged||(r.isUndefined(t.barycenter)||r.isUndefined(e.barycenter)||t.barycenter>=e.barycenter)&&(a=t,i=0,o=0,(n=e).weight&&(i+=n.barycenter*n.weight,o+=n.weight),a.weight&&(i+=a.barycenter*a.weight,o+=a.weight),n.vs=a.vs.concat(n.vs),n.barycenter=i/o,n.weight=o,n.i=Math.min(a.i,n.i),a.merged=!0)}}function a(t){return function(n){n.in.push(t),0===--n.indegree&&e.push(n)}}for(;e.length;){var i=e.pop();t.push(i),r.forEach(i.in.reverse(),n(i)),r.forEach(i.out,a(i))}return r.map(r.filter(t,function(e){return!e.merged}),function(e){return r.pick(e,["vs","i","barycenter","weight"])})}(r.filter(n,function(e){return!e.indegree}))}},4974:e=>{e.exports=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}},5015:(e,t,n)=>{var r=n(2552),a=n(6449),i=n(346);e.exports=function(e){return"string"==typeof e||!a(e)&&i(e)&&"[object String]"==r(e)}},5056:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},5072:e=>{"use strict";var t=[];function n(e){for(var n=-1,r=0;r{var r=n(1882),a=n(7296),i=n(3805),o=n(7473),s=/^\[object .+?Constructor\]$/,u=Function.prototype,l=Object.prototype,c=u.toString,d=l.hasOwnProperty,h=RegExp("^"+c.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||a(e))&&(r(e)?h:s).test(o(e))}},5111:function(e,t,n){var r;r=function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){var r=n(1),a=function(e){e&&e("layout","dagre",r)};"undefined"!=typeof cytoscape&&a(cytoscape),e.exports=a},function(e,t,n){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}var a=function(e){return"function"==typeof e},i=n(2),o=n(3),s=n(4);function u(e){this.options=o({},i,e)}u.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,i=function(e,t){return a(t)?t.apply(e,[e]):t},o=e.boundingBox||{x1:0,y1:0,w:t.width(),h:t.height()};void 0===o.x2&&(o.x2=o.x1+o.w),void 0===o.w&&(o.w=o.x2-o.x1),void 0===o.y2&&(o.y2=o.y1+o.h),void 0===o.h&&(o.h=o.y2-o.y1);var u=new s.graphlib.Graph({multigraph:!0,compound:!0}),l={},c=function(e,t){null!=t&&(l[e]=t)};c("nodesep",e.nodeSep),c("edgesep",e.edgeSep),c("ranksep",e.rankSep),c("rankdir",e.rankDir),c("align",e.align),c("ranker",e.ranker),c("acyclicer",e.acyclicer),u.setGraph(l),u.setDefaultEdgeLabel(function(){return{}}),u.setDefaultNodeLabel(function(){return{}});var d=n.nodes();a(e.sort)&&(d=d.sort(e.sort));for(var h=0;h1?t-1:0),r=1;r{var r=n(909),a=n(4894);e.exports=function(e,t){var n=-1,i=a(e)?Array(e.length):[];return r(e,function(e,r,a){i[++n]=t(e,r,a)}),i}},5169:(e,t,n)=>{var r=n(6857),a=n(3988);function i(e,t,n){for(var a;t.length&&(a=r.last(t)).i<=n;)t.pop(),e.push(a.vs),n++;return n}e.exports=function(e,t){var n,o=a.partition(e,function(e){return r.has(e,"barycenter")}),s=o.lhs,u=r.sortBy(o.rhs,function(e){return-e.i}),l=[],c=0,d=0,h=0;s.sort((n=!!t,function(e,t){return e.barycentert.barycenter?1:n?t.i-e.i:e.i-t.i})),h=i(l,u,h),r.forEach(s,function(e){h+=e.vs.length,l.push(e.vs),c+=e.barycenter*e.weight,d+=e.weight,h=i(l,u,h)});var f={vs:r.flatten(l,!0)};return d&&(f.barycenter=c/d,f.weight=d),f}},5250:(e,t,n)=>{var r=n(7217),a=n(7805),i=n(6649),o=n(2824),s=n(3805),u=n(7241),l=n(4974);e.exports=function e(t,n,c,d,h){t!==n&&i(n,function(i,u){if(h||(h=new r),s(i))o(t,n,u,c,e,d,h);else{var f=d?d(l(t,u),i,u+"",t,n,h):void 0;void 0===f&&(f=i),a(t,u,f)}},u)}},5288:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},5325:(e,t,n)=>{var r=n(6131);e.exports=function(e,t){return!(null==e||!e.length)&&r(e,t,0)>-1}},5364:(e,t,n)=>{var r=n(5250),a=n(999)(function(e,t,n){r(e,t,n)});e.exports=a},5378:(e,t,n)=>{var r=n(4932),a=n(5389),i=n(5128),o=n(6449);e.exports=function(e,t){return(o(e)?r:i)(e,a(t,3))}},5389:(e,t,n)=>{var r=n(3663),a=n(7978),i=n(3488),o=n(6449),s=n(583);e.exports=function(e){return"function"==typeof e?e:null==e?i:"object"==typeof e?o(e)?a(e[0],e[1]):r(e):s(e)}},5463:e=>{e.exports=function(e){return e!=e}},5481:(e,t,n)=>{var r=n(9325)["__core-js_shared__"];e.exports=r},5508:(e,t,n)=>{var r=n(6151),a=n(6800),i=n(7400);e.exports=function(e){return function(t,n,o){return o&&"number"!=typeof o&&a(t,n,o)&&(n=o=void 0),t=i(t),void 0===n?(n=t,t=0):n=i(n),o=void 0===o?t{var t=Object.prototype;e.exports=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||t)}},5529:(e,t,n)=>{var r=n(9344),a=n(8879),i=n(5527);e.exports=function(e){return"function"!=typeof e.constructor||i(e)?{}:r(a(e))}},5558:e=>{e.exports=function(e,t,n,r,a){return a(e,function(e,a,i){n=r?(r=!1,e):t(n,e,a,i)}),n}},5580:(e,t,n)=>{var r=n(6110)(n(9325),"DataView");e.exports=r},5749:(e,t,n)=>{var r=n(1042);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},5765:(e,t,n)=>{var r=n(8859),a=n(5325),i=n(9905),o=n(9219),s=n(4517),u=n(4247);e.exports=function(e,t,n){var l=-1,c=a,d=e.length,h=!0,f=[],p=f;if(n)h=!1,c=i;else if(d>=200){var v=t?null:s(e);if(v)return u(v);h=!1,c=o,p=new r}else p=t?[]:f;e:for(;++l{var r=n(5580),a=n(8223),i=n(2804),o=n(6545),s=n(8303),u=n(2552),l=n(7473),c="[object Map]",d="[object Promise]",h="[object Set]",f="[object WeakMap]",p="[object DataView]",v=l(r),g=l(a),y=l(i),m=l(o),b=l(s),x=u;(r&&x(new r(new ArrayBuffer(1)))!=p||a&&x(new a)!=c||i&&x(i.resolve())!=d||o&&x(new o)!=h||s&&x(new s)!=f)&&(x=function(e){var t=u(e),n="[object Object]"==t?e.constructor:void 0,r=n?l(n):"";if(r)switch(r){case v:return p;case g:return c;case y:return d;case m:return h;case b:return f}return t}),e.exports=x},5880:(e,t,n)=>{var r=n(514),a=n(5950);e.exports=function(e){return null==e?[]:r(e,a(e))}},5891:(e,t,n)=>{var r=n(1873),a=n(2428),i=n(6449),o=r?r.isConcatSpreadable:void 0;e.exports=function(e){return i(e)||a(e)||!!(o&&e&&e[o])}},5911:(e,t,n)=>{var r=n(8859),a=n(4248),i=n(9219);e.exports=function(e,t,n,o,s,u){var l=1&n,c=e.length,d=t.length;if(c!=d&&!(l&&d>c))return!1;var h=u.get(e),f=u.get(t);if(h&&f)return h==t&&f==e;var p=-1,v=!0,g=2&n?new r:void 0;for(u.set(e,t),u.set(t,e);++p{var r=n(695),a=n(8984),i=n(4894);e.exports=function(e){return i(e)?r(e):a(e)}},5970:(e,t,n)=>{var r=n(3120);e.exports=function(e){return null!=e&&e.length?r(e,1):[]}},6001:(e,t,n)=>{var r=n(7420),a=n(631);e.exports=function(e,t){return r(e,t,function(t,n){return a(e,n)})}},6009:(e,t,n)=>{e=n.nmd(e);var r=n(4840),a=t&&!t.nodeType&&t,i=a&&e&&!e.nodeType&&e,o=i&&i.exports===a&&r.process,s=function(){try{return i&&i.require&&i.require("util").types||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=s},6016:(e,t,n)=>{var r=n(9276);e.exports=function(e,t){return r(e,t,"pre")}},6025:(e,t,n)=>{var r=n(5288);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},6038:(e,t,n)=>{var r=n(5861),a=n(346);e.exports=function(e){return a(e)&&"[object Set]"==r(e)}},6110:(e,t,n)=>{var r=n(5083),a=n(392);e.exports=function(e,t){var n=a(e,t);return r(n)?n:void 0}},6131:(e,t,n)=>{var r=n(2523),a=n(5463),i=n(6959);e.exports=function(e,t,n){return t==t?i(e,t,n):r(e,a,n)}},6135:(e,t,n)=>{e.exports=n(9754)},6151:e=>{var t=Math.ceil,n=Math.max;e.exports=function(e,r,a,i){for(var o=-1,s=n(t((r-e)/(a||1)),0),u=Array(s);s--;)u[i?s:++o]=e,e+=a;return u}},6155:(e,t,n)=>{var r=n(4932),a=n(7422),i=n(5389),o=n(5128),s=n(3937),u=n(7301),l=n(3714),c=n(3488),d=n(6449);e.exports=function(e,t,n){t=t.length?r(t,function(e){return d(e)?function(t){return a(t,1===e.length?e[0]:e)}:e}):[c];var h=-1;t=r(t,u(i));var f=o(e,function(e,n,a){return{criteria:r(t,function(t){return t(e)}),index:++h,value:e}});return s(f,function(e,t){return l(e,t,n)})}},6169:(e,t,n)=>{var r=n(9653);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}},6176:e=>{e.exports=function(e,t){return e{var t=Object.prototype.hasOwnProperty;e.exports=function(e){var n=e.length,r=new e.constructor(n);return n&&"string"==typeof e[0]&&t.call(e,"index")&&(r.index=e.index,r.input=e.input),r}},6246:(e,t,n)=>{e.exports={graphlib:n(8191),layout:n(8202),debug:n(8909),util:{time:n(3988).time,notime:n(3988).notime},version:n(7038)}},6291:(e,t,n)=>{var r=n(117);e.exports=function(e){var t=0,n=[],a={},i=[];function o(s){var u=a[s]={onStack:!0,lowlink:t,index:t++};if(n.push(s),e.successors(s).forEach(function(e){r.has(a,e)?a[e].onStack&&(u.lowlink=Math.min(u.lowlink,a[e].index)):(o(e),u.lowlink=Math.min(u.lowlink,a[e].lowlink))}),u.lowlink===u.index){var l,c=[];do{l=n.pop(),a[l].onStack=!1,c.push(l)}while(s!==l);i.push(c)}}return e.nodes().forEach(function(e){r.has(a,e)||o(e)}),i}},6314:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,r,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(r)for(var s=0;s0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),a&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=a):c[4]="".concat(a)),t.push(c))}},t}},6353:(e,t,n)=>{var r=n(6857),a=n(3988);function i(e,t,n,o,s,u,l){var c=e.children(l);if(c.length){var d=a.addBorderNode(e,"_bt"),h=a.addBorderNode(e,"_bb"),f=e.node(l);e.setParent(d,l),f.borderTop=d,e.setParent(h,l),f.borderBottom=h,r.forEach(c,function(r){i(e,t,n,o,s,u,r);var a=e.node(r),c=a.borderTop?a.borderTop:r,f=a.borderBottom?a.borderBottom:r,p=a.borderTop?o:2*o,v=c!==f?1:s-u[l]+1;e.setEdge(d,c,{weight:p,minlen:v,nestingEdge:!0}),e.setEdge(f,h,{weight:p,minlen:v,nestingEdge:!0})}),e.parent(l)||e.setEdge(t,d,{weight:0,minlen:s+u[l]})}else l!==t&&e.setEdge(t,l,{weight:0,minlen:n})}e.exports={run:function(e){var t=a.addDummyNode(e,"root",{},"_root"),n=function(e){var t={};function n(a,i){var o=e.children(a);o&&o.length&&r.forEach(o,function(e){n(e,i+1)}),t[a]=i}return r.forEach(e.children(),function(e){n(e,1)}),t}(e),o=r.max(r.values(n))-1,s=2*o+1;e.graph().nestingRoot=t,r.forEach(e.edges(),function(t){e.edge(t).minlen*=s});var u=function(e){return r.reduce(e.edges(),function(t,n){return t+e.edge(n).weight},0)}(e)+1;r.forEach(e.children(),function(r){i(e,t,s,u,o,n,r)}),e.graph().nodeRankFactor=s},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,r.forEach(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}}},6375:(e,t,n)=>{var r=n(4528),a=n(8879),i=n(4664),o=n(3345),s=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,i(e)),e=a(e);return t}:o;e.exports=s},6449:e=>{var t=Array.isArray;e.exports=t},6454:(e,t,n)=>{"use strict";var r=n(117);e.exports=i;var a="\0";function i(e){this._isDirected=!r.has(e,"directed")||e.directed,this._isMultigraph=!!r.has(e,"multigraph")&&e.multigraph,this._isCompound=!!r.has(e,"compound")&&e.compound,this._label=void 0,this._defaultNodeLabelFn=r.constant(void 0),this._defaultEdgeLabelFn=r.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[a]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function o(e,t){e[t]?e[t]++:e[t]=1}function s(e,t){--e[t]||delete e[t]}function u(e,t,n,a){var i=""+t,o=""+n;if(!e&&i>o){var s=i;i=o,o=s}return i+""+o+""+(r.isUndefined(a)?"\0":a)}function l(e,t){return u(e,t.v,t.w,t.name)}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(e){return this._label=e,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(e){return r.isFunction(e)||(e=r.constant(e)),this._defaultNodeLabelFn=e,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return r.keys(this._nodes)},i.prototype.sources=function(){var e=this;return r.filter(this.nodes(),function(t){return r.isEmpty(e._in[t])})},i.prototype.sinks=function(){var e=this;return r.filter(this.nodes(),function(t){return r.isEmpty(e._out[t])})},i.prototype.setNodes=function(e,t){var n=arguments,a=this;return r.each(e,function(e){n.length>1?a.setNode(e,t):a.setNode(e)}),this},i.prototype.setNode=function(e,t){return r.has(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=a,this._children[e]={},this._children[a][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)},i.prototype.node=function(e){return this._nodes[e]},i.prototype.hasNode=function(e){return r.has(this._nodes,e)},i.prototype.removeNode=function(e){var t=this;if(r.has(this._nodes,e)){var n=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],r.each(this.children(e),function(e){t.setParent(e)}),delete this._children[e]),r.each(r.keys(this._in[e]),n),delete this._in[e],delete this._preds[e],r.each(r.keys(this._out[e]),n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},i.prototype.setParent=function(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(r.isUndefined(t))t=a;else{for(var n=t+="";!r.isUndefined(n);n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this},i.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},i.prototype.parent=function(e){if(this._isCompound){var t=this._parent[e];if(t!==a)return t}},i.prototype.children=function(e){if(r.isUndefined(e)&&(e=a),this._isCompound){var t=this._children[e];if(t)return r.keys(t)}else{if(e===a)return this.nodes();if(this.hasNode(e))return[]}},i.prototype.predecessors=function(e){var t=this._preds[e];if(t)return r.keys(t)},i.prototype.successors=function(e){var t=this._sucs[e];if(t)return r.keys(t)},i.prototype.neighbors=function(e){var t=this.predecessors(e);if(t)return r.union(t,this.successors(e))},i.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},i.prototype.filterNodes=function(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;r.each(this._nodes,function(n,r){e(r)&&t.setNode(r,n)}),r.each(this._edgeObjs,function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var a={};function i(e){var r=n.parent(e);return void 0===r||t.hasNode(r)?(a[e]=r,r):r in a?a[r]:i(r)}return this._isCompound&&r.each(t.nodes(),function(e){t.setParent(e,i(e))}),t},i.prototype.setDefaultEdgeLabel=function(e){return r.isFunction(e)||(e=r.constant(e)),this._defaultEdgeLabelFn=e,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return r.values(this._edgeObjs)},i.prototype.setPath=function(e,t){var n=this,a=arguments;return r.reduce(e,function(e,r){return a.length>1?n.setEdge(e,r,t):n.setEdge(e,r),r}),this},i.prototype.setEdge=function(){var e,t,n,a,i=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(e=s.v,t=s.w,n=s.name,2===arguments.length&&(a=arguments[1],i=!0)):(e=s,t=arguments[1],n=arguments[3],arguments.length>2&&(a=arguments[2],i=!0)),e=""+e,t=""+t,r.isUndefined(n)||(n=""+n);var l=u(this._isDirected,e,t,n);if(r.has(this._edgeLabels,l))return i&&(this._edgeLabels[l]=a),this;if(!r.isUndefined(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[l]=i?a:this._defaultEdgeLabelFn(e,t,n);var c=function(e,t,n,r){var a=""+t,i=""+n;if(!e&&a>i){var o=a;a=i,i=o}var s={v:a,w:i};return r&&(s.name=r),s}(this._isDirected,e,t,n);return e=c.v,t=c.w,Object.freeze(c),this._edgeObjs[l]=c,o(this._preds[t],e),o(this._sucs[e],t),this._in[t][l]=c,this._out[e][l]=c,this._edgeCount++,this},i.prototype.edge=function(e,t,n){var r=1===arguments.length?l(this._isDirected,arguments[0]):u(this._isDirected,e,t,n);return this._edgeLabels[r]},i.prototype.hasEdge=function(e,t,n){var a=1===arguments.length?l(this._isDirected,arguments[0]):u(this._isDirected,e,t,n);return r.has(this._edgeLabels,a)},i.prototype.removeEdge=function(e,t,n){var r=1===arguments.length?l(this._isDirected,arguments[0]):u(this._isDirected,e,t,n),a=this._edgeObjs[r];return a&&(e=a.v,t=a.w,delete this._edgeLabels[r],delete this._edgeObjs[r],s(this._preds[t],e),s(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this},i.prototype.inEdges=function(e,t){var n=this._in[e];if(n){var a=r.values(n);return t?r.filter(a,function(e){return e.v===t}):a}},i.prototype.outEdges=function(e,t){var n=this._out[e];if(n){var a=r.values(n);return t?r.filter(a,function(e){return e.w===t}):a}},i.prototype.nodeEdges=function(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}},6533:(e,t,n)=>{var r=n(3599),a=n(5389),i=n(6176);e.exports=function(e,t){return e&&e.length?r(e,a(t,2),i):void 0}},6545:(e,t,n)=>{var r=n(6110)(n(9325),"Set");e.exports=r},6547:(e,t,n)=>{var r=n(3360),a=n(5288),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var o=e[t];i.call(e,t)&&a(o,n)&&(void 0!==n||t in e)||r(e,t,n)}},6574:(e,t,n)=>{var r=n(909);e.exports=function(e,t){var n=[];return r(e,function(e,r,a){t(e,r,a)&&n.push(e)}),n}},6639:(e,t,n)=>{"use strict";var r=n(6857);function a(e,t,n){for(var a=r.zipObject(n,r.map(n,function(e,t){return t})),i=r.flatten(r.map(t,function(t){return r.sortBy(r.map(e.outEdges(t),function(t){return{pos:a[t.w],weight:e.edge(t).weight}}),"pos")}),!0),o=1;o0;)t%2&&(n+=u[t+1]),u[t=t-1>>1]+=e.weight;l+=e.weight*n})),l}e.exports=function(e,t){for(var n=0,r=1;r{var r=n(3221)();e.exports=r},6678:(e,t,n)=>{var r=n(117),a=n(6291);e.exports=function(e){return r.filter(a(e),function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}},6721:(e,t,n)=>{var r=n(1042),a=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return a.call(t,e)?t[e]:void 0}},6757:(e,t,n)=>{var r=n(1033),a=Math.max;e.exports=function(e,t,n){return t=a(void 0===t?e.length-1:t,0),function(){for(var i=arguments,o=-1,s=a(i.length-t,0),u=Array(s);++o{var r=n(5288),a=n(4894),i=n(361),o=n(3805);e.exports=function(e,t,n){if(!o(n))return!1;var s=typeof t;return!!("number"==s?a(n)&&i(t,n.length):"string"==s&&t in n)&&r(n[t],e)}},6822:(e,t,n)=>{"use strict";var r=n(6857),a=n(2031);e.exports={run:function(e){var t="greedy"===e.graph().acyclicer?a(e,function(e){return function(t){return e.edge(t).weight}}(e)):function(e){var t=[],n={},a={};return r.forEach(e.nodes(),function i(o){r.has(a,o)||(a[o]=!0,n[o]=!0,r.forEach(e.outEdges(o),function(e){r.has(n,e.w)?t.push(e):i(e.w)}),delete n[o])}),t}(e);r.forEach(t,function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,r.uniqueId("rev"))})},undo:function(e){r.forEach(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}}},6857:(e,t,n)=>{var r;try{r={cloneDeep:n(8055),constant:n(7334),defaults:n(4684),each:n(6135),filter:n(7612),find:n(7309),flatten:n(5970),forEach:n(9754),forIn:n(2420),has:n(1448),isUndefined:n(2216),last:n(8090),map:n(5378),mapValues:n(3916),max:n(4506),merge:n(5364),min:n(1684),minBy:n(6533),now:n(124),pick:n(4383),range:n(3181),reduce:n(860),sortBy:n(3031),uniqueId:n(7200),values:n(5880),zipObject:n(7248)}}catch(e){}r||(r=window._),e.exports=r},6860:(e,t,n)=>{"use strict";var r=n(6857),a=n(8481),i=n(8073).slack,o=n(8073).longestPath,s=n(8191).alg.preorder,u=n(8191).alg.postorder,l=n(3988).simplify;function c(e){e=l(e),o(e);var t,n=a(e);for(f(n),d(n,e);t=v(n);)y(n,e,t,g(n,e,t))}function d(e,t){var n=u(e,e.nodes());n=n.slice(0,n.length-1),r.forEach(n,function(n){!function(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=h(e,t,n)}(e,t,n)})}function h(e,t,n){var a=e.node(n).parent,i=!0,o=t.edge(n,a),s=0;return o||(i=!1,o=t.edge(a,n)),s=o.weight,r.forEach(t.nodeEdges(n),function(r){var o,u,l=r.v===n,c=l?r.w:r.v;if(c!==a){var d=l===i,h=t.edge(r).weight;if(s+=d?h:-h,o=n,u=c,e.hasEdge(o,u)){var f=e.edge(n,c).cutvalue;s+=d?-f:f}}}),s}function f(e,t){arguments.length<2&&(t=e.nodes()[0]),p(e,{},1,t)}function p(e,t,n,a,i){var o=n,s=e.node(a);return t[a]=!0,r.forEach(e.neighbors(a),function(i){r.has(t,i)||(n=p(e,t,n,i,a))}),s.low=o,s.lim=n++,i?s.parent=i:delete s.parent,n}function v(e){return r.find(e.edges(),function(t){return e.edge(t).cutvalue<0})}function g(e,t,n){var a=n.v,o=n.w;t.hasEdge(a,o)||(a=n.w,o=n.v);var s=e.node(a),u=e.node(o),l=s,c=!1;s.lim>u.lim&&(l=u,c=!0);var d=r.filter(t.edges(),function(t){return c===m(0,e.node(t.v),l)&&c!==m(0,e.node(t.w),l)});return r.minBy(d,function(e){return i(t,e)})}function y(e,t,n,a){var i=n.v,o=n.w;e.removeEdge(i,o),e.setEdge(a.v,a.w,{}),f(e),d(e,t),function(e,t){var n=r.find(e.nodes(),function(e){return!t.node(e).parent}),a=s(e,n);a=a.slice(1),r.forEach(a,function(n){var r=e.node(n).parent,a=t.edge(n,r),i=!1;a||(a=t.edge(r,n),i=!0),t.node(n).rank=t.node(r).rank+(i?a.minlen:-a.minlen)})}(e,t)}function m(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}e.exports=c,c.initLowLimValues=f,c.initCutValues=d,c.calcCutValue=h,c.leaveEdge=v,c.enterEdge=g,c.exchangeEdges=y},6959:e=>{e.exports=function(e,t,n){for(var r=n-1,a=e.length;++r{e.exports="0.8.5"},7068:(e,t,n)=>{var r=n(7217),a=n(5911),i=n(1986),o=n(689),s=n(5861),u=n(6449),l=n(3656),c=n(7167),d="[object Arguments]",h="[object Array]",f="[object Object]",p=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,v,g,y){var m=u(e),b=u(t),x=m?h:s(e),w=b?h:s(t),E=(x=x==d?f:x)==f,k=(w=w==d?f:w)==f,_=x==w;if(_&&l(e)){if(!l(t))return!1;m=!0,E=!1}if(_&&!E)return y||(y=new r),m||c(e)?a(e,t,n,v,g,y):i(e,t,x,n,v,g,y);if(!(1&n)){var C=E&&p.call(e,"__wrapped__"),T=k&&p.call(t,"__wrapped__");if(C||T){var S=C?e.value():e,P=T?t.value():t;return y||(y=new r),g(S,P,n,v,y)}}return!!_&&(y||(y=new r),o(e,t,n,v,g,y))}},7091:(e,t,n)=>{var r=n(8984),a=n(5861),i=n(4894),o=n(5015),s=n(1993);e.exports=function(e){if(null==e)return 0;if(i(e))return o(e)?s(e):e.length;var t=a(e);return"[object Map]"==t||"[object Set]"==t?e.size:r(e).length}},7167:(e,t,n)=>{var r=n(4901),a=n(7301),i=n(6009),o=i&&i.isTypedArray,s=o?a(o):r;e.exports=s},7197:e=>{e.exports=function(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in Object(n))}}},7199:(e,t,n)=>{var r=n(9653),a=n(6169),i=n(3201),o=n(3736),s=n(1961);e.exports=function(e,t,n){var u=e.constructor;switch(t){case"[object ArrayBuffer]":return r(e);case"[object Boolean]":case"[object Date]":return new u(+e);case"[object DataView]":return a(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return s(e,n);case"[object Map]":case"[object Set]":return new u;case"[object Number]":case"[object String]":return new u(e);case"[object RegExp]":return i(e);case"[object Symbol]":return o(e)}}},7200:(e,t,n)=>{var r=n(3222),a=0;e.exports=function(e){var t=++a;return r(e)+t}},7217:(e,t,n)=>{var r=n(79),a=n(1420),i=n(938),o=n(3605),s=n(9817),u=n(945);function l(e){var t=this.__data__=new r(e);this.size=t.size}l.prototype.clear=a,l.prototype.delete=i,l.prototype.get=o,l.prototype.has=s,l.prototype.set=u,e.exports=l},7237:e=>{e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},7241:(e,t,n)=>{var r=n(695),a=n(2903),i=n(4894);e.exports=function(e){return i(e)?r(e,!0):a(e)}},7248:(e,t,n)=>{var r=n(6547),a=n(1234);e.exports=function(e,t){return a(e||[],t||[],r)}},7255:(e,t,n)=>{var r=n(7422);e.exports=function(e){return function(t){return r(t,e)}}},7296:(e,t,n)=>{var r,a=n(5481),i=(r=/[^.]+$/.exec(a&&a.keys&&a.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!i&&i in e}},7301:e=>{e.exports=function(e){return function(t){return e(t)}}},7309:(e,t,n)=>{var r=n(2006)(n(4713));e.exports=r},7334:e=>{e.exports=function(e){return function(){return e}}},7400:(e,t,n)=>{var r=n(9374),a=1/0;e.exports=function(e){return e?(e=r(e))===a||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},7420:(e,t,n)=>{var r=n(7422),a=n(3170),i=n(1769);e.exports=function(e,t,n){for(var o=-1,s=t.length,u={};++o{var r=n(1769),a=n(7797);e.exports=function(e,t){for(var n=0,i=(t=r(t,e)).length;null!=e&&n{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},7494:(e,t,n)=>{var r=n(117),a=n(6454);function i(e){return r.map(e.nodes(),function(t){var n=e.node(t),a=e.parent(t),i={v:t};return r.isUndefined(n)||(i.value=n),r.isUndefined(a)||(i.parent=a),i})}function o(e){return r.map(e.edges(),function(t){var n=e.edge(t),a={v:t.v,w:t.w};return r.isUndefined(t.name)||(a.name=t.name),r.isUndefined(n)||(a.value=n),a})}e.exports={write:function(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:i(e),edges:o(e)};return r.isUndefined(e.graph())||(t.value=r.clone(e.graph())),t},read:function(e){var t=new a(e.options).setGraph(e.value);return r.each(e.nodes,function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),r.each(e.edges,function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}},7534:(e,t,n)=>{var r=n(2552),a=n(346);e.exports=function(e){return a(e)&&"[object Arguments]"==r(e)}},7556:(e,t,n)=>{var r=n(1873),a=n(4932),i=n(6449),o=n(4394),s=r?r.prototype:void 0,u=s?s.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(i(t))return a(t,e)+"";if(o(t))return u?u.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},7612:(e,t,n)=>{var r=n(9770),a=n(6574),i=n(5389),o=n(6449);e.exports=function(e,t){return(o(e)?r:a)(e,i(t,3))}},7659:e=>{"use strict";var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},7670:(e,t,n)=>{var r=n(2651);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},7730:(e,t,n)=>{var r=n(9172),a=n(7301),i=n(6009),o=i&&i.isMap,s=o?a(o):r;e.exports=s},7797:(e,t,n)=>{var r=n(4394);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},7805:(e,t,n)=>{var r=n(3360),a=n(5288);e.exports=function(e,t,n){(void 0!==n&&!a(e[t],n)||void 0===n&&!(t in e))&&r(e,t,n)}},7825:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var a=void 0!==n.layer;a&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,a&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},7828:(e,t,n)=>{var r=n(9325).Uint8Array;e.exports=r},7860:(e,t,n)=>{var r=n(6857),a=n(8191).Graph;e.exports=function(e,t,n){var i=function(e){for(var t;e.hasNode(t=r.uniqueId("_root")););return t}(e),o=new a({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(function(t){return e.node(t)});return r.forEach(e.nodes(),function(a){var s=e.node(a),u=e.parent(a);(s.rank===t||s.minRank<=t&&t<=s.maxRank)&&(o.setNode(a),o.setParent(a,u||i),r.forEach(e[n](a),function(t){var n=t.v===a?t.w:t.v,i=o.edge(n,a),s=r.isUndefined(i)?0:i.weight;o.setEdge(n,a,{weight:e.edge(t).weight+s})}),r.has(s,"minRank")&&o.setNode(a,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))}),o}},7927:e=>{var t="\\ud800-\\udfff",n="["+t+"]",r="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",a="\\ud83c[\\udffb-\\udfff]",i="[^"+t+"]",o="(?:\\ud83c[\\udde6-\\uddff]){2}",s="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+r+"|"+a+")?",l="[\\ufe0e\\ufe0f]?",c=l+u+"(?:\\u200d(?:"+[i,o,s].join("|")+")"+l+u+")*",d="(?:"+[i+r+"?",r,o,s,n].join("|")+")",h=RegExp(a+"(?="+a+")|"+d+c,"g");e.exports=function(e){for(var t=h.lastIndex=0;h.test(e);)++t;return t}},7978:(e,t,n)=>{var r=n(270),a=n(8156),i=n(631),o=n(8586),s=n(756),u=n(7197),l=n(7797);e.exports=function(e,t){return o(e)&&s(t)?u(l(e),t):function(n){var o=a(n,e);return void 0===o&&o===t?i(n,e):r(t,o,3)}}},8055:(e,t,n)=>{var r=n(9999);e.exports=function(e){return r(e,5)}},8073:(e,t,n)=>{"use strict";var r=n(6857);e.exports={longestPath:function(e){var t={};r.forEach(e.sources(),function n(a){var i=e.node(a);if(r.has(t,a))return i.rank;t[a]=!0;var o=r.min(r.map(e.outEdges(a),function(t){return n(t.w)-e.edge(t).minlen}));return o!==Number.POSITIVE_INFINITY&&null!=o||(o=0),i.rank=o})},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}},8077:e=>{e.exports=function(e,t){return null!=e&&t in Object(e)}},8090:e=>{e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},8096:e=>{e.exports=function(e,t){for(var n=-1,r=Array(e);++n{var r=n(7422);e.exports=function(e,t,n){var a=null==e?void 0:r(e,t);return void 0===a?n:a}},8191:(e,t,n)=>{var r;try{r=n(8362)}catch(e){}r||(r=window.graphlib),e.exports=r},8202:(e,t,n)=>{"use strict";var r=n(6857),a=n(6822),i=n(8209),o=n(9361),s=n(3988).normalizeRanks,u=n(2948),l=n(3988).removeEmptyRanks,c=n(6353),d=n(135),h=n(4850),f=n(1453),p=n(3776),v=n(3988),g=n(8191).Graph;e.exports=function(e,t){var n=t&&t.debugTiming?v.time:v.notime;n("layout",function(){var t=n(" buildLayoutGraph",function(){return function(e){var t=new g({multigraph:!0,compound:!0}),n=T(e.graph());return t.setGraph(r.merge({},m,C(n,y),r.pick(n,b))),r.forEach(e.nodes(),function(n){var a=T(e.node(n));t.setNode(n,r.defaults(C(a,x),w)),t.setParent(n,e.parent(n))}),r.forEach(e.edges(),function(n){var a=T(e.edge(n));t.setEdge(n,r.merge({},k,C(a,E),r.pick(a,_)))}),t}(e)});n(" runLayout",function(){!function(e,t){t(" makeSpaceForEdgeLabels",function(){!function(e){var t=e.graph();t.ranksep/=2,r.forEach(e.edges(),function(n){var r=e.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===t.rankdir||"BT"===t.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)})}(e)}),t(" removeSelfEdges",function(){!function(e){r.forEach(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}(e)}),t(" acyclic",function(){a.run(e)}),t(" nestingGraph.run",function(){c.run(e)}),t(" rank",function(){o(v.asNonCompoundGraph(e))}),t(" injectEdgeLabelProxies",function(){!function(e){r.forEach(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v),a={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};v.addDummyNode(e,"edge-proxy",a,"_ep")}})}(e)}),t(" removeEmptyRanks",function(){l(e)}),t(" nestingGraph.cleanup",function(){c.cleanup(e)}),t(" normalizeRanks",function(){s(e)}),t(" assignRankMinMax",function(){!function(e){var t=0;r.forEach(e.nodes(),function(n){var a=e.node(n);a.borderTop&&(a.minRank=e.node(a.borderTop).rank,a.maxRank=e.node(a.borderBottom).rank,t=r.max(t,a.maxRank))}),e.graph().maxRank=t}(e)}),t(" removeEdgeLabelProxies",function(){!function(e){r.forEach(e.nodes(),function(t){var n=e.node(t);"edge-proxy"===n.dummy&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}(e)}),t(" normalize.run",function(){i.run(e)}),t(" parentDummyChains",function(){u(e)}),t(" addBorderSegments",function(){d(e)}),t(" order",function(){f(e)}),t(" insertSelfEdges",function(){!function(e){var t=v.buildLayerMatrix(e);r.forEach(t,function(t){var n=0;r.forEach(t,function(t,a){var i=e.node(t);i.order=a+n,r.forEach(i.selfEdges,function(t){v.addDummyNode(e,"selfedge",{width:t.label.width,height:t.label.height,rank:i.rank,order:a+ ++n,e:t.e,label:t.label},"_se")}),delete i.selfEdges})})}(e)}),t(" adjustCoordinateSystem",function(){h.adjust(e)}),t(" position",function(){p(e)}),t(" positionSelfEdges",function(){!function(e){r.forEach(e.nodes(),function(t){var n=e.node(t);if("selfedge"===n.dummy){var r=e.node(n.e.v),a=r.x+r.width/2,i=r.y,o=n.x-a,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:a+2*o/3,y:i-s},{x:a+5*o/6,y:i-s},{x:a+o,y:i},{x:a+5*o/6,y:i+s},{x:a+2*o/3,y:i+s}],n.label.x=n.x,n.label.y=n.y}})}(e)}),t(" removeBorderNodes",function(){!function(e){r.forEach(e.nodes(),function(t){if(e.children(t).length){var n=e.node(t),a=e.node(n.borderTop),i=e.node(n.borderBottom),o=e.node(r.last(n.borderLeft)),s=e.node(r.last(n.borderRight));n.width=Math.abs(s.x-o.x),n.height=Math.abs(i.y-a.y),n.x=o.x+n.width/2,n.y=a.y+n.height/2}}),r.forEach(e.nodes(),function(t){"border"===e.node(t).dummy&&e.removeNode(t)})}(e)}),t(" normalize.undo",function(){i.undo(e)}),t(" fixupEdgeLabelCoords",function(){!function(e){r.forEach(e.edges(),function(t){var n=e.edge(t);if(r.has(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}(e)}),t(" undoCoordinateSystem",function(){h.undo(e)}),t(" translateGraph",function(){!function(e){var t=Number.POSITIVE_INFINITY,n=0,a=Number.POSITIVE_INFINITY,i=0,o=e.graph(),s=o.marginx||0,u=o.marginy||0;function l(e){var r=e.x,o=e.y,s=e.width,u=e.height;t=Math.min(t,r-s/2),n=Math.max(n,r+s/2),a=Math.min(a,o-u/2),i=Math.max(i,o+u/2)}r.forEach(e.nodes(),function(t){l(e.node(t))}),r.forEach(e.edges(),function(t){var n=e.edge(t);r.has(n,"x")&&l(n)}),t-=s,a-=u,r.forEach(e.nodes(),function(n){var r=e.node(n);r.x-=t,r.y-=a}),r.forEach(e.edges(),function(n){var i=e.edge(n);r.forEach(i.points,function(e){e.x-=t,e.y-=a}),r.has(i,"x")&&(i.x-=t),r.has(i,"y")&&(i.y-=a)}),o.width=n-t+s,o.height=i-a+u}(e)}),t(" assignNodeIntersects",function(){!function(e){r.forEach(e.edges(),function(t){var n,r,a=e.edge(t),i=e.node(t.v),o=e.node(t.w);a.points?(n=a.points[0],r=a.points[a.points.length-1]):(a.points=[],n=o,r=i),a.points.unshift(v.intersectRect(i,n)),a.points.push(v.intersectRect(o,r))})}(e)}),t(" reversePoints",function(){!function(e){r.forEach(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}(e)}),t(" acyclic.undo",function(){a.undo(e)})}(t,n)}),n(" updateInputGraph",function(){!function(e,t){r.forEach(e.nodes(),function(n){var r=e.node(n),a=t.node(n);r&&(r.x=a.x,r.y=a.y,t.children(n).length&&(r.width=a.width,r.height=a.height))}),r.forEach(e.edges(),function(n){var a=e.edge(n),i=t.edge(n);a.points=i.points,r.has(i,"x")&&(a.x=i.x,a.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}(e,t)})})};var y=["nodesep","edgesep","ranksep","marginx","marginy"],m={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},b=["acyclicer","ranker","rankdir","align"],x=["width","height"],w={width:0,height:0},E=["minlen","weight","width","height","labeloffset"],k={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},_=["labelpos"];function C(e,t){return r.mapValues(r.pick(e,t),Number)}function T(e){var t={};return r.forEach(e,function(e,n){t[n.toLowerCase()]=e}),t}},8209:(e,t,n)=>{"use strict";var r=n(6857),a=n(3988);e.exports={run:function(e){e.graph().dummyChains=[],r.forEach(e.edges(),function(t){!function(e,t){var n,r,i,o=t.v,s=e.node(o).rank,u=t.w,l=e.node(u).rank,c=t.name,d=e.edge(t),h=d.labelRank;if(l!==s+1){for(e.removeEdge(t),i=0,++s;s{var r=n(6110)(n(9325),"Map");e.exports=r},8303:(e,t,n)=>{var r=n(6110)(n(9325),"WeakMap");e.exports=r},8329:(e,t,n)=>{var r=n(4894);e.exports=function(e,t){return function(n,a){if(null==n)return n;if(!r(n))return e(n,a);for(var i=n.length,o=t?i:-1,s=Object(n);(t?o--:++o{var r=n(1166);e.exports={Graph:r.Graph,json:n(7494),alg:n(1667),version:r.version}},8440:(e,t,n)=>{var r=n(6038),a=n(7301),i=n(6009),o=i&&i.isSet,s=o?a(o):r;e.exports=s},8481:(e,t,n)=>{"use strict";var r=n(6857),a=n(8191).Graph,i=n(8073).slack;function o(e,t){return r.forEach(e.nodes(),function n(a){r.forEach(t.nodeEdges(a),function(r){var o=r.v,s=a===o?r.w:o;e.hasNode(s)||i(t,r)||(e.setNode(s,{}),e.setEdge(a,s,{}),n(s))})}),e.nodeCount()}function s(e,t){return r.minBy(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return i(t,n)})}function u(e,t,n){r.forEach(e.nodes(),function(e){t.node(e).rank+=n})}e.exports=function(e){var t,n,r=new a({directed:!1}),l=e.nodes()[0],c=e.nodeCount();for(r.setNode(l,{});o(r,e){var r=n(6449),a=n(4394),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!a(e))||o.test(e)||!i.test(e)||null!=t&&e in Object(t)}},8655:(e,t,n)=>{var r=n(6025);e.exports=function(e){return r(this.__data__,e)>-1}},8816:(e,t,n)=>{var r=n(5970),a=n(6757),i=n(2865);e.exports=function(e){return i(a(e,void 0,r),e+"")}},8859:(e,t,n)=>{var r=n(3661),a=n(1380),i=n(1459);function o(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t{var r=n(4335)(Object.getPrototypeOf,Object);e.exports=r},8905:(e,t,n)=>{var r=n(117),a=n(1737);e.exports=function(e,t,n,r){return function(e,t,n,r){var i,o,s={},u=new a,l=function(e){var t=e.v!==i?e.v:e.w,r=s[t],a=n(e),l=o.distance+a;if(a<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+a);l0&&(i=u.removeMin(),(o=s[i]).distance!==Number.POSITIVE_INFINITY);)r(i).forEach(l);return s}(e,String(t),n||i,r||function(t){return e.outEdges(t)})};var i=r.constant(1)},8909:(e,t,n)=>{var r=n(6857),a=n(3988),i=n(8191).Graph;e.exports={debugOrdering:function(e){var t=a.buildLayerMatrix(e),n=new i({compound:!0,multigraph:!0}).setGraph({});return r.forEach(e.nodes(),function(t){n.setNode(t,{label:t}),n.setParent(t,"layer"+e.node(t).rank)}),r.forEach(e.edges(),function(e){n.setEdge(e.v,e.w,{},e.name)}),r.forEach(t,function(e,t){var a="layer"+t;n.setNode(a,{rank:"same"}),r.reduce(e,function(e,t){return n.setEdge(e,t,{style:"invis"}),t})}),n}}},8918:(e,t,n)=>{"use strict";var r=n(6857);e.exports=function(e){var t={},n=r.filter(e.nodes(),function(t){return!e.children(t).length}),a=r.max(r.map(n,function(t){return e.node(t).rank})),i=r.map(r.range(a+1),function(){return[]}),o=r.sortBy(n,function(t){return e.node(t).rank});return r.forEach(o,function n(a){if(!r.has(t,a)){t[a]=!0;var o=e.node(a);i[o.rank].push(a),r.forEach(e.successors(a),n)}}),i}},8948:(e,t,n)=>{var r=n(1791),a=n(6375);e.exports=function(e,t){return r(e,a(e),t)}},8984:(e,t,n)=>{var r=n(5527),a=n(3650),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return a(e);var t=[];for(var n in Object(e))i.call(e,n)&&"constructor"!=n&&t.push(n);return t}},9172:(e,t,n)=>{var r=n(5861),a=n(346);e.exports=function(e){return a(e)&&"[object Map]"==r(e)}},9219:e=>{e.exports=function(e,t){return e.has(t)}},9276:(e,t,n)=>{var r=n(117);function a(e,t,n,i,o,s){r.has(i,t)||(i[t]=!0,n||s.push(t),r.each(o(t),function(t){a(e,t,n,i,o,s)}),n&&s.push(t))}e.exports=function(e,t,n){r.isArray(t)||(t=[t]);var i=(e.isDirected()?e.successors:e.neighbors).bind(e),o=[],s={};return r.each(t,function(t){if(!e.hasNode(t))throw new Error("Graph does not have node: "+t);a(e,t,"post"===n,s,i,o)}),o}},9302:(e,t,n)=>{var r=n(3488),a=n(6757),i=n(2865);e.exports=function(e,t){return i(a(e,t,r),e+"")}},9325:(e,t,n)=>{var r=n(4840),a="object"==typeof self&&self&&self.Object===Object&&self,i=r||a||Function("return this")();e.exports=i},9326:(e,t,n)=>{var r=n(1769),a=n(2428),i=n(6449),o=n(361),s=n(294),u=n(7797);e.exports=function(e,t,n){for(var l=-1,c=(t=r(t,e)).length,d=!1;++l{var r=n(3805),a=Object.create,i=function(){function e(){}return function(t){if(!r(t))return{};if(a)return a(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();e.exports=i},9350:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},9361:(e,t,n)=>{"use strict";var r=n(8073).longestPath,a=n(8481),i=n(6860);e.exports=function(e){switch(e.graph().ranker){case"network-simplex":default:!function(e){i(e)}(e);break;case"tight-tree":!function(e){r(e),a(e)}(e);break;case"longest-path":o(e)}};var o=r},9374:(e,t,n)=>{var r=n(4128),a=n(3805),i=n(4394),o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,u=/^0o[0-7]+$/i,l=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=s.test(e);return n||u.test(e)?l(e.slice(2),n?2:8):o.test(e)?NaN:+e}},9570:(e,t,n)=>{var r=n(7334),a=n(3243),i=n(3488),o=a?function(e,t){return a(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:i;e.exports=o},9653:(e,t,n)=>{var r=n(7828);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},9698:e=>{var t=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=function(e){return t.test(e)}},9741:(e,t,n)=>{"use strict";var r=n(6857),a=n(8191).Graph,i=n(3988);function o(e,t){var n={};return r.reduce(t,function(t,a){var i=0,o=0,s=t.length,l=r.last(a);return r.forEach(a,function(t,c){var d=function(e,t){if(e.node(t).dummy)return r.find(e.predecessors(t),function(t){return e.node(t).dummy})}(e,t),h=d?e.node(d).order:s;(d||t===l)&&(r.forEach(a.slice(o,c+1),function(t){r.forEach(e.predecessors(t),function(r){var a=e.node(r),o=a.order;!(os)&&u(n,t,l)})})}return r.reduce(t,function(t,n){var i,o=-1,s=0;return r.forEach(n,function(r,u){if("border"===e.node(r).dummy){var l=e.predecessors(r);l.length&&(i=e.node(l[0]).order,a(n,s,u,o,i),s=u,o=i)}a(n,s,n.length,i,t.length)}),n}),n}function u(e,t,n){if(t>n){var r=t;t=n,n=r}var a=e[t];a||(e[t]=a={}),a[n]=!0}function l(e,t,n){if(t>n){var a=t;t=n,n=a}return r.has(e[t],n)}function c(e,t,n,a){var i={},o={},s={};return r.forEach(t,function(e){r.forEach(e,function(e,t){i[e]=e,o[e]=e,s[e]=t})}),r.forEach(t,function(e){var t=-1;r.forEach(e,function(e){var u=a(e);if(u.length){u=r.sortBy(u,function(e){return s[e]});for(var c=(u.length-1)/2,d=Math.floor(c),h=Math.ceil(c);d<=h;++d){var f=u[d];o[e]===e&&t{var r=n(3729),a=n(9344),i=n(641),o=n(5389),s=n(8879),u=n(6449),l=n(3656),c=n(1882),d=n(3805),h=n(7167);e.exports=function(e,t,n){var f=u(e),p=f||l(e)||h(e);if(t=o(t,4),null==n){var v=e&&e.constructor;n=p?f?new v:[]:d(e)&&c(v)?a(s(e)):{}}return(p?r:i)(e,function(e,r,a){return t(n,e,r,a)}),n}},9754:(e,t,n)=>{var r=n(3729),a=n(909),i=n(4066),o=n(6449);e.exports=function(e,t){return(o(e)?r:a)(e,i(t))}},9770:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,a=0,i=[];++n{var r=n(7237)("length");e.exports=r},9817:e=>{e.exports=function(e){return this.__data__.has(e)}},9859:e=>{function t(){var e={};e._next=e._prev=e,this._sentinel=e}function n(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function r(e,t){if("_next"!==e&&"_prev"!==e)return t}e.exports=t,t.prototype.dequeue=function(){var e=this._sentinel,t=e._prev;if(t!==e)return n(t),t},t.prototype.enqueue=function(e){var t=this._sentinel;e._prev&&e._next&&n(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t},t.prototype.toString=function(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,r)),n=n._prev;return"["+e.join(", ")+"]"}},9884:(e,t,n)=>{var r=n(1791),a=n(7241);e.exports=function(e){return r(e,a(e))}},9888:(e,t,n)=>{var r=n(117);function a(e){var t={},n={},a=[];if(r.each(e.sinks(),function o(s){if(r.has(n,s))throw new i;r.has(t,s)||(n[s]=!0,t[s]=!0,r.each(e.predecessors(s),o),delete n[s],a.push(s))}),r.size(t)!==e.nodeCount())throw new i;return a}function i(){}e.exports=a,a.CycleException=i,i.prototype=new Error},9905:e=>{e.exports=function(e,t,n){for(var r=-1,a=null==e?0:e.length;++r{e.exports=function(){return!1}},9999:(e,t,n)=>{var r=n(7217),a=n(3729),i=n(6547),o=n(4733),s=n(3838),u=n(3290),l=n(3007),c=n(2271),d=n(8948),h=n(2),f=n(3349),p=n(5861),v=n(6189),g=n(7199),y=n(5529),m=n(6449),b=n(3656),x=n(7730),w=n(3805),E=n(8440),k=n(5950),_=n(7241),C="[object Arguments]",T="[object Function]",S="[object Object]",P={};P[C]=P["[object Array]"]=P["[object ArrayBuffer]"]=P["[object DataView]"]=P["[object Boolean]"]=P["[object Date]"]=P["[object Float32Array]"]=P["[object Float64Array]"]=P["[object Int8Array]"]=P["[object Int16Array]"]=P["[object Int32Array]"]=P["[object Map]"]=P["[object Number]"]=P[S]=P["[object RegExp]"]=P["[object Set]"]=P["[object String]"]=P["[object Symbol]"]=P["[object Uint8Array]"]=P["[object Uint8ClampedArray]"]=P["[object Uint16Array]"]=P["[object Uint32Array]"]=!0,P["[object Error]"]=P[T]=P["[object WeakMap]"]=!1,e.exports=function e(t,n,B,D,M,A){var I,N=1&n,R=2&n,L=4&n;if(B&&(I=M?B(t,D,M,A):B(t)),void 0!==I)return I;if(!w(t))return t;var O=m(t);if(O){if(I=v(t),!N)return l(t,I)}else{var z=p(t),j=z==T||"[object GeneratorFunction]"==z;if(b(t))return u(t,N);if(z==S||z==C||j&&!M){if(I=R||j?{}:y(t),!N)return R?d(t,s(I,t)):c(t,o(I,t))}else{if(!P[z])return M?t:{};I=g(t,z,N)}}A||(A=new r);var V=A.get(t);if(V)return V;A.set(t,I),E(t)?t.forEach(function(r){I.add(e(r,n,B,r,t,A))}):x(t)&&t.forEach(function(r,a){I.set(a,e(r,n,B,a,t,A))});var F=O?void 0:(L?R?f:h:R?_:k)(t);return a(F||t,function(r,a){F&&(r=t[a=r]),i(I,a,e(r,n,B,a,t,A))}),I}}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),n.nc=void 0,(()=>{"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function i(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],u=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){l=!0,a=e}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw a}}return s}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||c(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function c(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}var d="undefined"==typeof window?null:window,h=d?d.navigator:null;d&&d.document;var f,p,v,g,y,m,b,x,w,E,k,_,C,T,S,P,B,D,M,A,I,N,R,L,O,z,j,V,F=l(""),Y=l({}),q=l(function(){}),X="undefined"==typeof HTMLElement?"undefined":l(HTMLElement),W=function(e){return e&&e.instanceString&&G(e.instanceString)?e.instanceString():null},U=function(e){return null!=e&&l(e)==F},G=function(e){return null!=e&&l(e)===q},H=function(e){return!Q(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},K=function(e){return null!=e&&l(e)===Y&&!H(e)&&e.constructor===Object},Z=function(e){return null!=e&&l(e)===l(1)&&!isNaN(e)},$=function(e){return"undefined"===X?void 0:null!=e&&e instanceof HTMLElement},Q=function(e){return J(e)||ee(e)},J=function(e){return"collection"===W(e)&&e._private.single},ee=function(e){return"collection"===W(e)&&!e._private.single},te=function(e){return"core"===W(e)},ne=function(e){return"stylesheet"===W(e)},re=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},ae=function(e){return function(e){return null!=e&&l(e)===Y}(e)&&G(e.then)},ie=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;tt?1:0},ye=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n255)return;t.push(Math.floor(i))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var u=n[4];if(void 0!==u){if((u=parseFloat(u))<0||u>1)return;t.push(u)}}return t}(e)||function(e){var t,n,r,a,i,o,s,u;function l(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^"+pe+"$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(a=parseFloat(c[3]))<0||a>100)return;if(a/=100,void 0!==(i=c[4])&&((i=parseFloat(i))<0||i>1))return;if(0===r)o=s=u=Math.round(255*a);else{var d=a<.5?a*(1+r):a+r-a*r,h=2*a-d;o=Math.round(255*l(h,d,n+1/3)),s=Math.round(255*l(h,d,n)),u=Math.round(255*l(h,d,n-1/3))}t=[o,s,u,i]}return t}(e)},be={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},xe=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a=o||t<0||g&&e-p>=c}function x(){var e=t();if(b(e))return w(e);h=setTimeout(x,function(e){var t=o-(e-f);return g?a(t,c-(e-p)):t}(e))}function w(e){return h=void 0,y&&u?m(e):(u=l=void 0,d)}function E(){var e=t(),n=b(e);if(u=arguments,l=this,f=e,n){if(void 0===h)return function(e){return p=e,h=setTimeout(x,o),v?m(e):d}(f);if(g)return clearTimeout(h),h=setTimeout(x,o),m(f)}return void 0===h&&(h=setTimeout(x,o)),d}return o=n(o)||0,e(s)&&(v=!!s.leading,c=(g="maxWait"in s)?r(n(s.maxWait)||0,o):c,y="trailing"in s?!!s.trailing:y),E.cancel=function(){void 0!==h&&clearTimeout(h),p=0,u=f=l=h=void 0},E.flush=function(){return void 0===h?d:w(t())},E},j}(),De=ke(Be),Me=d?d.performance:null,Ae=Me&&Me.now?function(){return Me.now()}:function(){return Date.now()},Ie=function(){if(d){if(d.requestAnimationFrame)return function(e){d.requestAnimationFrame(e)};if(d.mozRequestAnimationFrame)return function(e){d.mozRequestAnimationFrame(e)};if(d.webkitRequestAnimationFrame)return function(e){d.webkitRequestAnimationFrame(e)};if(d.msRequestAnimationFrame)return function(e){d.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(Ae())},1e3/60)}}(),Ne=function(e){return Ie(e)},Re=Ae,Le=9261,Oe=5381,ze=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Le;!(t=e.next()).done;)n=65599*n+t.value|0;return n},je=function(e){return 65599*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Le)+e|0},Ve=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Oe;return(t<<5)+t+e|0},Fe=function(e){return 2097152*e[0]+e[1]},Ye=function(e,t){return[je(e[0],t[0]),Ve(e[1],t[1])]},qe=function(e,t){var n={value:0,done:!1},r=0,a=e.length;return ze({next:function(){return r=0;r--)e[r]===t&&e.splice(r,1)},ct=function(e){e.splice(0,e.length)},dt=function(e,t,n){return n&&(t=ue(n,t)),e[t]},ht=function(e,t,n,r){n&&(t=ue(n,t)),e[t]=r},ft="undefined"!=typeof Map?Map:function(){return r(function e(){t(this,e),this._obj={}},[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}])}(),pt=function(){return r(function e(n){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=n){var r;r=null!=n.instanceString&&n.instanceString()===this.instanceString()?n.toArray():n;for(var a=0;a2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&te(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var a=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new vt,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==a.position.x&&(a.position.x=0),null==a.position.y&&(a.position.y=0),t.renderedPosition){var i=t.renderedPosition,o=e.pan(),s=e.zoom();a.position={x:(i.x-o.x)/s,y:(i.y-o.y)/s}}var u=[];H(t.classes)?u=t.classes:U(t.classes)&&(u=t.classes.split(/\s+/));for(var l=0,c=u.length;lt?1:0},u=function(e,r,a,i,o){var s;if(null==a&&(a=0),null==o&&(o=t),a<0)throw new Error("lo must be non-negative");for(null==i&&(i=e.length);ar;0<=r?t++:t--)l.push(t);return l}.apply(this).reverse()).length;iv;0<=v?++h:--h)g.push(a(e,i));return g},f=function(e,n,r,a){var i,o,s;for(null==a&&(a=t),i=e[r];r>n&&a(i,o=e[s=r-1>>1])<0;)e[r]=o,r=s;return e[r]=i},p=function(e,n,r){var a,i,o,s,u;for(null==r&&(r=t),i=e.length,u=n,o=e[n],a=2*n+1;a0;){var w=y.pop(),E=v(w),k=w.id();if(d[k]=E,E!==1/0)for(var _=w.neighborhood().intersect(f),C=0;C<_.length;C++){var T=_[C],S=T.id(),P=x(w,T),B=E+P.dist;B0)for(n.unshift(t);c[a];){var i=c[a];n.unshift(i.edge),n.unshift(i.node),a=(r=i.node).id()}return o.spawn(n)}}}},Pt={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,a=n.length,i=new Array(a),o=n,s=function(e){for(var t=0;t0;){if(x(),E++,l===d){for(var k=[],_=a,C=d,T=m[C];k.unshift(_),null!=T&&k.unshift(T),null!=(_=y[C]);)T=m[C=_.id()];return{found:!0,distance:h[l],path:this.spawn(k),steps:E}}p[l]=!0;for(var S=u._private.edges,P=0;PT&&(f[C]=T,y[C]=_,m[C]=x),!a){var S=_*l+k;!a&&f[S]>T&&(f[S]=T,y[S]=k,m[S]=x)}}}for(var P=0;P1&&void 0!==arguments[1]?arguments[1]:i,r=[],a=m(e);;){if(null==a)return t.spawn();var o=y(a),u=o.edge,l=o.pred;if(r.unshift(a[0]),a.same(n)&&r.length>0)break;null!=u&&r.unshift(u),a=l}return s.spawn(r)},hasNegativeWeightCycle:p,negativeWeightCycles:v}}},Rt=Math.sqrt(2),Lt=function(e,t,n){0===n.length&&tt("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],a=r[1],i=r[2],o=t[a],s=t[i],u=n,l=u.length-1;l>=0;l--){var c=u[l],d=c[1],h=c[2];(t[d]===o&&t[h]===s||t[d]===s&&t[h]===o)&&u.splice(l,1)}for(var f=0;fr;){var a=Math.floor(Math.random()*t.length);t=Lt(a,e,t),n--}return t},zt={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(e){return e.isLoop()});var a=n.length,i=r.length,o=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),s=Math.floor(a/Rt);if(!(a<2)){for(var u=[],l=0;l0?1:e<0?-1:0},Wt=function(e,t){return Math.sqrt(Ut(e,t))},Ut=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},Gt=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Qt=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Jt=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},en=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},tn=function(e){var t,n,r,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===i.length)t=n=r=a=i[0];else if(2===i.length)t=r=i[0],a=n=i[1];else if(4===i.length){var s=o(i,4);t=s[0],n=s[1],r=s[2],a=s[3]}return e.x1-=a,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},nn=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},rn=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2t.y2||t.y1>e.y2)},an=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},on=function(e,t){return an(e,t.x,t.y)},sn=function(e,t){return an(e,t.x1,t.y1)&&an(e,t.x2,t.y2)},un=null!==(kt=Math.hypot)&&void 0!==kt?kt:function(e,t){return Math.sqrt(e*e+t*t)};var ln=function(e,t,n,r,a,i,o){var s,u,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",c="auto"===l?Pn(a,i):l,d=a/2,h=i/2,f=(c=Math.min(c,d,h))!==d,p=c!==h;if(f){var v=r-h-o;if((s=wn(e,t,n,r,n-d+c-o,v,n+d-c+o,v,!1)).length>0)return s}if(p){var g=n+d+o;if((s=wn(e,t,n,r,g,r-h+c-o,g,r+h-c+o,!1)).length>0)return s}if(f){var y=r+h+o;if((s=wn(e,t,n,r,n-d+c-o,y,n+d-c+o,y,!1)).length>0)return s}if(p){var m=n-d-o;if((s=wn(e,t,n,r,m,r-h+c-o,m,r+h-c+o,!1)).length>0)return s}var b=n-d+c,x=r-h+c;if((u=bn(e,t,n,r,b,x,c+o)).length>0&&u[0]<=b&&u[1]<=x)return[u[0],u[1]];var w=n+d-c,E=r-h+c;if((u=bn(e,t,n,r,w,E,c+o)).length>0&&u[0]>=w&&u[1]<=E)return[u[0],u[1]];var k=n+d-c,_=r+h-c;if((u=bn(e,t,n,r,k,_,c+o)).length>0&&u[0]>=k&&u[1]>=_)return[u[0],u[1]];var C=n-d+c,T=r+h-c;return(u=bn(e,t,n,r,C,T,c+o)).length>0&&u[0]<=C&&u[1]>=T?[u[0],u[1]]:[]},cn=function(e,t,n,r,a,i,o){var s=o,u=Math.min(n,a),l=Math.max(n,a),c=Math.min(r,i),d=Math.max(r,i);return u-s<=e&&e<=l+s&&c-s<=t&&t<=d+s},dn=function(e,t,n,r,a,i,o,s,u){var l=Math.min(n,o,a)-u,c=Math.max(n,o,a)+u,d=Math.min(r,s,i)-u,h=Math.max(r,s,i)+u;return!(ec||th)},hn=function(e,t,n,r,a,i,o,s){var u,l,c,d,h,f,p,v,g,y,m,b,x,w=[];l=9*n*a-3*n*n-3*n*o-6*a*a+3*a*o+9*r*i-3*r*r-3*r*s-6*i*i+3*i*s,c=3*n*n-6*n*a+n*o-n*e+2*a*a+2*a*e-o*e+3*r*r-6*r*i+r*s-r*t+2*i*i+2*i*t-s*t,d=1*n*a-n*n+n*e-a*e+r*i-r*r+r*t-i*t,0===(u=1*n*n-4*n*a+2*n*o+4*a*a-4*a*o+o*o+r*r-4*r*i+2*r*s+4*i*i-4*i*s+s*s)&&(u=1e-5),v=-27*(d/=u)+(l/=u)*(9*(c/=u)-l*l*2),f=(p=(3*c-l*l)/9)*p*p+(v/=54)*v,(h=w)[1]=0,b=l/3,f>0?(y=(y=v+Math.sqrt(f))<0?-Math.pow(-y,1/3):Math.pow(y,1/3),m=(m=v-Math.sqrt(f))<0?-Math.pow(-m,1/3):Math.pow(m,1/3),h[0]=-b+y+m,b+=(y+m)/2,h[4]=h[2]=-b,b=Math.sqrt(3)*(-m+y)/2,h[3]=b,h[5]=-b):(h[5]=h[3]=0,0===f?(x=v<0?-Math.pow(-v,1/3):Math.pow(v,1/3),h[0]=2*x-b,h[4]=h[2]=-(x+b)):(g=(p=-p)*p*p,g=Math.acos(v/Math.sqrt(g)),x=2*Math.sqrt(p),h[0]=-b+x*Math.cos(g/3),h[2]=-b+x*Math.cos((g+2*Math.PI)/3),h[4]=-b+x*Math.cos((g+4*Math.PI)/3)));for(var E=[],k=0;k<6;k+=2)Math.abs(w[k+1])<1e-7&&w[k]>=0&&w[k]<=1&&E.push(w[k]);E.push(1),E.push(0);for(var _,C,T,S=-1,P=0;P=0?Tu?(e-a)*(e-a)+(t-i)*(t-i):l-d},pn=function(e,t,n){for(var r,a,i,o,s=0,u=0;u=e&&e>=i||r<=e&&e<=i))continue;(e-r)/(i-r)*(o-a)+a>t&&s++}return s%2!=0},vn=function(e,t,n,r,a,i,o,s,u){var l,c=new Array(n.length);null!=s[0]?(l=Math.atan(s[1]/s[0]),s[0]<0?l+=Math.PI/2:l=-l-Math.PI/2):l=s;for(var d,h=Math.cos(-l),f=Math.sin(-l),p=0;p0){var v=yn(c,-u);d=gn(v)}else d=c;return pn(e,t,d)},gn=function(e){for(var t,n,r,a,i,o,s,u,l=new Array(e.length/2),c=0;c=0&&p<=1&&g.push(p),v>=0&&v<=1&&g.push(v),0===g.length)return[];var y=g[0]*s[0]+e,m=g[0]*s[1]+t;return g.length>1?g[0]==g[1]?[y,m]:[y,m,g[1]*s[0]+e,g[1]*s[1]+t]:[y,m]},xn=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},wn=function(e,t,n,r,a,i,o,s,u){var l=e-a,c=n-e,d=o-a,h=t-i,f=r-t,p=s-i,v=d*h-p*l,g=c*h-f*l,y=p*c-d*f;if(0!==y){var m=v/y,b=g/y,x=-.001;return x<=m&&m<=1.001&&x<=b&&b<=1.001||u?[e+m*c,t+m*f]:[]}return 0===v||0===g?xn(e,n,o)===o?[o,s]:xn(e,n,a)===a?[a,i]:xn(a,o,n)===n?[n,r]:[]:[]},En=function(e,t,n,r,a){var i=[],o=r/2,s=a/2,u=t,l=n;i.push({x:u+o*e[0],y:l+s*e[1]});for(var c=1;c0){var m=yn(v,-s);l=gn(m)}else l=v}else l=n;for(var b=0;bl&&(l=t)},d=function(e){return u[e]},h=0;h0?x.edgesTo(b)[0]:b.edgesTo(x)[0];var w=r(m);b=b.id(),l[b]>l[v]+w&&(l[b]=l[v]+w,h.nodes.indexOf(b)<0?h.push(b):h.updateItem(b),u[b]=0,n[b]=[]),l[b]==l[v]+w&&(u[b]=u[b]+u[v],n[b].push(v))}else for(var E=0;E0;){for(var T=t.pop(),S=0;S0&&o.push(n[s]);0!==o.length&&a.push(r.collection(o))}return a}(c,u,t,r);return b=function(e){for(var t=0;t5&&void 0!==arguments[5]?arguments[5]:Zn,o=r,s=0;s=2?nr(e,t,n,0,Jn,er):nr(e,t,n,0,Qn)},squaredEuclidean:function(e,t,n){return nr(e,t,n,0,Jn)},manhattan:function(e,t,n){return nr(e,t,n,0,Qn)},max:function(e,t,n){return nr(e,t,n,-1/0,tr)}};function ar(e,t,n,r,a,i){var o;return o=G(e)?e:rr[e]||rr.euclidean,0===t&&G(e)?o(a,i):o(t,n,r,a,i)}rr["squared-euclidean"]=rr.squaredEuclidean,rr.squaredeuclidean=rr.squaredEuclidean;var ir=ut({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),or=function(e){return ir(e)},sr=function(e,t,n,r,a){var i="kMedoids"!==a?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return ar(e,r.length,i,function(e){return r[e](t)},o,s)},ur=function(e,t,n){for(var r=n.length,a=new Array(r),i=new Array(r),o=new Array(t),s=null,u=0;un)return!1;return!0},fr=function(e,t,n){for(var r=0;ra&&(a=t[u][l],i=l);o[i].push(e[u])}for(var c=0;c=a.threshold||"dendrogram"===a.mode&&1===e.length)return!1;var f,p=t[o],v=t[r[o]];f="dendrogram"===a.mode?{left:p,right:v,key:p.key}:{value:p.value.concat(v.value),key:p.key},e[p.index]=f,e.splice(v.index,1),t[p.key]=f;for(var g=0;gn[v.key][y.key]&&(i=n[v.key][y.key])):"max"===a.linkage?(i=n[p.key][y.key],n[p.key][y.key]o&&(i=u,o=t[a*e+u])}i>0&&r.push(i)}for(var l=0;l1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];arguments.length>3&&void 0!==arguments[3]&&!arguments[3]?(n0&&e.splice(0,t)):e=e.slice(t,n);for(var i=0,o=e.length-1;o>=0;o--){var s=e[o];a?isFinite(s)||(e[o]=-1/0,i++):e.splice(o,1)}r&&e.sort(function(e,t){return e-t});var u=e.length,l=Math.floor(u/2);return u%2!=0?e[l+1+i]:(e[l-1+i]+e[l+i])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,a=0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,a=t;a=T?(S=T,T=B,P=D):B>S&&(S=B);for(var M=0;M0?1:0;k[E%l.minIterations*t+O]=z,L+=z}if(L>0&&(E>=l.minIterations-1||E==l.maxIterations-1)){for(var j=0,V=0;V0&&r.push(a);return r}(t,i,o),q=function(e,t,n){for(var r=Dr(e,t,n),a=0;au&&(s=l,u=c)}n[a]=i[s]}return Dr(e,t,n)}(t,r,Y),X={},W=0;W1||o>1)&&(l=!0),c[t]=[],e.outgoers().forEach(function(e){e.isEdge()&&c[t].push(e.id())})}else d[t]=[void 0,e.target().id()]}):u.forEach(function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?l=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach(function(e){return c[t].push(e.id())})):d[t]=[e.source().id(),e.target().id()]});var h={found:!1,trail:void 0};if(l)return h;if(r&&n)if(s){if(a&&r!=a)return h;a=r}else{if(a&&r!=a&&n!=a)return h;a||(a=r)}else a||(a=u[0].id());var f=function(e){for(var t,n,r,a=e,i=[e];c[a].length;)t=c[a].shift(),n=d[t][0],a!=(r=d[t][1])?(c[r]=c[r].filter(function(e){return e!=t}),a=r):s||a==n||(c[n]=c[n].filter(function(e){return e!=t}),a=n),i.unshift(t),i.unshift(a);return i},p=[],v=[];for(v=f(a);1!=v.length;)0==c[v[0]].length?(p.unshift(u.getElementById(v.shift())),p.unshift(u.getElementById(v.shift()))):v=f(v.shift()).concat(v);for(var g in p.unshift(u.getElementById(v.shift())),c)if(c[g].length)return h;return h.found=!0,h.trail=this.spawn(p,!0),h}},Rr=function(){var e=this,t={},n=0,r=0,a=[],i=[],o={},s=function(u,l,c){u===c&&(r+=1),t[l]={id:n,low:n++,cutVertex:!1};var d,h,f,p,v=e.getElementById(l).connectedEdges().intersection(e);0===v.size()?a.push(e.spawn(e.getElementById(l))):v.forEach(function(n){d=n.source().id(),h=n.target().id(),(f=d===l?h:d)!==c&&(p=n.id(),o[p]||(o[p]=!0,i.push({x:l,y:f,edge:n})),f in t?t[l].low=Math.min(t[l].low,t[f].id):(s(u,f,l),t[l].low=Math.min(t[l].low,t[f].low),t[l].id<=t[f].low&&(t[l].cutVertex=!0,function(n,r){for(var o=i.length-1,s=[],u=e.spawn();i[o].x!=n||i[o].y!=r;)s.push(i.pop().edge),o--;s.push(i.pop().edge),s.forEach(function(n){var r=n.connectedNodes().intersection(e);u.merge(n),r.forEach(function(n){var r=n.id(),a=n.connectedEdges().intersection(e);u.merge(n),t[r].cutVertex?u.merge(a.filter(function(e){return e.isLoop()})):u.merge(a)})}),a.push(u)}(l,f))))})};e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||(r=0,s(n,n),t[n].cutVertex=r>1)}});var u=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(u),components:a}},Lr=function(){var e=this,t={},n=0,r=[],a=[],i=e.spawn(e),o=function(s){if(a.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))}),t[s].index===t[s].low){for(var u=e.spawn();;){var l=a.pop();if(u.merge(e.getElementById(l)),t[l].low=t[s].index,t[l].explored=!0,l===s)break}var c=u.edgesWith(u),d=u.merge(c);r.push(d),i=i.difference(d)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||o(n)}}),{cut:i,components:r}},Or={};[mt,St,Pt,Dt,At,Nt,zt,In,Rn,On,jn,Kn,br,Sr,Ar,Nr,{hopcroftTarjanBiconnected:Rr,htbc:Rr,htb:Rr,hopcroftTarjanBiconnectedComponents:Rr},{tarjanStronglyConnected:Lr,tsc:Lr,tscc:Lr,tarjanStronglyConnectedComponents:Lr}].forEach(function(e){ye(Or,e)});var zr=function(e){if(!(this instanceof zr))return new zr(e);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof e&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};zr.prototype={fulfill:function(e){return jr(this,1,"fulfillValue",e)},reject:function(e){return jr(this,2,"rejectReason",e)},then:function(e,t){var n=this,r=new zr;return n.onFulfilled.push(Yr(e,r,"fulfill")),n.onRejected.push(Yr(t,r,"reject")),Vr(n),r.proxy}};var jr=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,Vr(e)),e},Vr=function(e){1===e.state?Fr(e,"onFulfilled",e.fulfillValue):2===e.state&&Fr(e,"onRejected",e.rejectReason)},Fr=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var a=function(){for(var e=0;e0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n-1}}(),a=function(){if(za)return Oa;za=1;var e=Mi();return Oa=function(t,n){var r=this.__data__,a=e(r,t);return a<0?(++this.size,r.push([t,n])):r[a][1]=n,this},Oa}();function i(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&t%1==0&&t0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){H(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,a=[],i=0,o=n.length;i0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};ho.className=ho.classNames=ho.classes;var fo={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:de,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};fo.variable="(?:[\\w-.]|(?:\\\\"+fo.metaChar+"))+",fo.className="(?:[\\w-]|(?:\\\\"+fo.metaChar+"))+",fo.value=fo.string+"|"+fo.number,fo.id=fo.variable,function(){var e,t,n;for(e=fo.comparatorOp.split("|"),n=0;n=0||"="!==t&&(fo.comparatorOp+="|\\!"+t)}();var po=20,vo=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return function(e,t){return-1*ge(e,t)}(e.selector,t.selector)}),go=function(){for(var e,t={},n=0;n0&&l.edgeCount>0)return rt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return rt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&rt("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return U(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(a,i){return a.checks.reduce(function(o,s,u){return o+(i===a&&0===u?"$":"")+function(a,i){var o=a.type,s=a.value;switch(o){case 0:var u=e(s);return u.substring(0,u.length-1);case 3:var l=a.field,c=a.operator;return"["+l+n(e(c))+t(s)+"]";case 5:var d=a.operator,h=a.field;return"["+e(d)+h+"]";case 4:return"["+a.field+"]";case 6:var f=a.operator;return"[["+a.field+n(e(f))+t(s)+"]]";case 7:return s;case 8:return"#"+s;case 9:return"."+s;case 17:case 15:return r(a.parent,i)+n(">")+r(a.child,i);case 18:case 16:return r(a.ancestor,i)+" "+r(a.descendant,i);case 19:var p=r(a.left,i),v=r(a.subject,i),g=r(a.right,i);return p+(p.length>0?" ":"")+v+g;case po:return""}}(s,i)},"")},a="",i=0;i1&&i=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),l=!0),(o||u||l)&&(a=o||s?""+e:"",i=""+n),l&&(e=a=a.toLowerCase(),n=i=i.toLowerCase()),t){case"*=":r=a.indexOf(i)>=0;break;case"$=":r=a.indexOf(i,a.length-i.length)>=0;break;case"^=":r=0===a.indexOf(i);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var l=a.shift();t(l),i.add(l.id()),o&&r(a,i,l)}return e}function Lo(e,t,n){if(n.isParent())for(var r=n._private.children,a=0;a1&&void 0!==arguments[1])||arguments[1],Lo)},No.forEachUp=function(e){return Ro(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Oo)},No.forEachUpAndDown=function(e){return Ro(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],zo)},No.ancestors=No.parents,(Mo=Ao={data:lo.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:lo.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:lo.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:lo.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:lo.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:lo.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Mo.data,Mo.removeAttr=Mo.removeData;var jo,Vo,Fo=Ao,Yo={};function qo(e){return function(t){var n=this;if(void 0===t&&(t=!0),0!==n.length&&n.isNode()&&!n.removed()){for(var r=0,a=n[0],i=a._private.edges,o=0;ot}),minIndegree:Xo("indegree",function(e,t){return et}),minOutdegree:Xo("outdegree",function(e,t){return et})}),ye(Yo,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=l;l&&(u=u[0]);var d=c?u.position():{x:0,y:0};return a={x:s.x-d.x,y:s.y-d.y},void 0===e?a:a[e]}for(var h=0;h0,g=v;v&&(p=p[0]);var y=g?p.position():{x:0,y:0};void 0!==t?f.position(e,t+y[e]):void 0!==a&&f.position({x:a.x+y.x,y:a.y+y.y})}}else if(!i)return;return this}},jo.modelPosition=jo.point=jo.position,jo.modelPositions=jo.points=jo.positions,jo.renderedPoint=jo.renderedPosition,jo.relativePoint=jo.relativePosition;var Go,Ho,Ko=Vo;Go=Ho={},Ho.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),a=n.pan(),i=t.x1*r+a.x,o=t.x2*r+a.x,s=t.y1*r+a.y,u=t.y2*r+a.y;return{x1:i,x2:o,y1:s,y2:u,w:o-i,h:u-s}},Ho.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}}),this):this},Ho.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,a={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},i=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==i.w&&0!==i.h||((i={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-i.w/2,i.x2=o.x+i.w/2,i.y1=o.y-i.h/2,i.y2=o.y+i.h/2);var s=a.width.left.value;"px"===a.width.left.units&&a.width.val>0&&(s=100*s/a.width.val);var u=a.width.right.value;"px"===a.width.right.units&&a.width.val>0&&(u=100*u/a.width.val);var l=a.height.top.value;"px"===a.height.top.units&&a.height.val>0&&(l=100*l/a.height.val);var c=a.height.bottom.value;"px"===a.height.bottom.units&&a.height.val>0&&(c=100*c/a.height.val);var d=y(a.width.val-i.w,s,u),h=d.biasDiff,f=d.biasComplementDiff,p=y(a.height.val-i.h,l,c),v=p.biasDiff,g=p.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(i.w,i.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(i.w,a.width.val),o.x=(-h+i.x1+i.x2+f)/2,t.autoHeight=Math.max(i.h,a.height.val),o.y=(-v+i.y1+i.y2+g)/2}function y(e,t,n){var r=0,a=0,i=t+n;return e>0&&i>0&&(r=t/i*e,a=n/i*e),{biasDiff:r,biasComplementDiff:a}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Qo=function(e,t){return null==t?e:$o(e,t.x1,t.y1,t.x2,t.y2)},Jo=function(e,t,n){return dt(e,t,n)},es=function(e,t,n){if(!t.cy().headless()){var r,a,i=t._private,o=i.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,a=o.srcY):"target"===n?(r=o.tgtX,a=o.tgtY):(r=o.midX,a=o.midY);var u=i.arrowBounds=i.arrowBounds||{},l=u[n]=u[n]||{};l.x1=r-s,l.y1=a-s,l.x2=r+s,l.y2=a+s,l.w=l.x2-l.x1,l.h=l.y2-l.y1,en(l,1),$o(e,l.x1,l.y1,l.x2,l.y2)}}},ts=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var a=t._private,i=a.rstyle;if(t.pstyle(r+"label").strValue){var o,s,u,l,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=Jo(i,"labelWidth",n),f=Jo(i,"labelHeight",n),p=Jo(i,"labelX",n),v=Jo(i,"labelY",n),g=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,k=f,_=h,C=_/2,T=k/2;if(m)o=p-C,s=p+C,u=v-T,l=v+T;else{switch(c.value){case"left":o=p-_,s=p;break;case"center":o=p-C,s=p+C;break;case"right":o=p,s=p+_}switch(d.value){case"top":u=v-k,l=v;break;case"center":u=v-T,l=v+T;break;case"bottom":u=v,l=v+k}}var S=g-Math.max(x,w)-E-2,P=g+Math.max(x,w)+E+2,B=y-Math.max(x,w)-E-2,D=y+Math.max(x,w)+E+2;o+=S,s+=P,u+=B,l+=D;var M=n||"main",A=a.labelBounds,I=A[M]=A[M]||{};I.x1=o,I.y1=u,I.x2=s,I.y2=l,I.w=s-o,I.h=l-u,I.leftPad=S,I.rightPad=P,I.topPad=B,I.botPad=D;var N=m&&"autorotate"===b.strValue,R=null!=b.pfValue&&0!==b.pfValue;if(N||R){var L=N?Jo(a.rstyle,"labelAngle",n):b.pfValue,O=Math.cos(L),z=Math.sin(L),j=(o+s)/2,V=(u+l)/2;if(!m){switch(c.value){case"left":j=s;break;case"right":j=o}switch(d.value){case"top":V=l;break;case"bottom":V=u}}var F=function(e,t){return{x:(e-=j)*O-(t-=V)*z+j,y:e*z+t*O+V}},Y=F(o,u),q=F(o,l),X=F(s,u),W=F(s,l);o=Math.min(Y.x,q.x,X.x,W.x),s=Math.max(Y.x,q.x,X.x,W.x),u=Math.min(Y.y,q.y,X.y,W.y),l=Math.max(Y.y,q.y,X.y,W.y)}var U=M+"Rot",G=A[U]=A[U]||{};G.x1=o,G.y1=u,G.x2=s,G.y2=l,G.w=s-o,G.h=l-u,$o(e,o,u,s,l),$o(a.labelBounds.all,o,u,s,l)}return e}},ns=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value+t.pstyle("outline-offset").value;rs(e,t,n,r,"outside",r/2)}},rs=function(e,t,n,r,a,i){if(!(0===n||r<=0||"inside"===a)){var o=t.cy(),s=t.pstyle("shape").value,u=o.renderer().nodeShapes[s],l=t.position(),c=l.x,d=l.y,h=t.width(),f=t.height();if(u.hasMiterBounds){"center"===a&&(r/=2);var p=u.miterBounds(c,d,h,f,r);Qo(e,p)}else null!=i&&i>0&&tn(e,[i,i,i,i])}},as=function(e){var t=0,n=function(e){return(e?1:0)<(r=P[1].x)){var B=n;n=r,r=B}if(a>(i=P[1].y)){var D=a;a=i,i=D}$o(h,n-k,a-k,r+k,i+k)}}else if("bezier"===S||"unbundled-bezier"===S||ce(S,"segments")||ce(S,"taxi")){var M;switch(S){case"bezier":case"unbundled-bezier":M=g.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":M=g.linePts}if(null!=M)for(var A=0;A(r=R.x)){var L=n;n=r,r=L}if((a=N.y)>(i=R.y)){var O=a;a=i,i=O}$o(h,n-=k,a-=k,r+=k,i+=k)}if(c&&t.includeEdges&&v&&(es(h,e,"mid-source"),es(h,e,"mid-target"),es(h,e,"source"),es(h,e,"target")),c&&"yes"===e.pstyle("ghost").value){var z=e.pstyle("ghost-offset-x").pfValue,j=e.pstyle("ghost-offset-y").pfValue;$o(h,h.x1+z,h.y1+j,h.x2+z,h.y2+j)}var V=f.bodyBounds=f.bodyBounds||{};nn(V,h),tn(V,y),en(V,1),c&&(n=h.x1,r=h.x2,a=h.y1,i=h.y2,$o(h,n-E,a-E,r+E,i+E));var F=f.overlayBounds=f.overlayBounds||{};nn(F,h),tn(F,y),en(F,1);var Y=f.labelBounds=f.labelBounds||{};null!=Y.all?((u=Y.all).x1=1/0,u.y1=1/0,u.x2=-1/0,u.y2=-1/0,u.w=0,u.h=0):Y.all=$t(),c&&t.includeLabels&&(t.includeMainLabels&&ts(h,e,null),v&&(t.includeSourceLabels&&ts(h,e,"source"),t.includeTargetLabels&&ts(h,e,"target")))}return h.x1=Zo(h.x1),h.y1=Zo(h.y1),h.x2=Zo(h.x2),h.y2=Zo(h.y2),h.w=Zo(h.x2-h.x1),h.h=Zo(h.y2-h.y1),h.w>0&&h.h>0&&b&&(tn(h,y),en(h,1)),h}(e,ss),r.bbCache=n,r.bbCachePosKey=is(e)):n=r.bbCache,!i){var o=e.isNode();n=$t(),(t.includeNodes&&o||t.includeEdges&&!o)&&(t.includeOverlays?Qo(n,r.overlayBounds):Qo(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!a||t.includeSourceLabels&&t.includeTargetLabels)?Qo(n,r.labelBounds.all):(t.includeMainLabels&&Qo(n,r.labelBounds.mainRot),t.includeSourceLabels&&Qo(n,r.labelBounds.sourceRot),t.includeTargetLabels&&Qo(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},ss={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},us=as(ss),ls=ut(ss);Ho.boundingBox=function(e){var t,n=void 0===e||void 0===e.useCache||!0===e.useCache,r=ie(function(e){var t=e._private;return null==t.bbCache||t.styleDirty||t.bbCachePosKey!==is(e)},function(e){return e.id()});if(n&&1===this.length&&!r(this[0]))e=void 0===e?ss:ls(e),t=os(this[0],e);else{t=$t();var a=ls(e=e||ss),i=this,o=i.cy().styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),o&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:_s,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},Ts.removeAllListeners=function(){return this.removeListener("*")},Ts.emit=Ts.trigger=function(e,t,n){var r=this.listeners,a=r.length;return this.emitting++,H(t)||(t=[t]),function(e,t,n){if("event"!==W(n))if(K(n))t(e,Ps(e,n));else for(var r=H(n)?n:n.split(/\s+/),a=0;a1&&!r){var a=this.length-1,i=this[a],o=i._private.data.id;this[a]=void 0,this[e]=i,n.set(o,{ele:i,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var a=r.index;return this.unmergeAt(a),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&U(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],r=this,a=0;ar&&(r=s,n=o)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,a=this,i=0;i=0&&a1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n));var a=n._private.style[e];return null!=a?a:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style();if(K(e)){var i=e;a.applyBypass(this,i,r),this.emitAndNotify("style")}else if(U(e)){if(void 0===t){var o=this[0];return o?a.getStylePropertyValue(o,e):void 0}a.applyBypass(this,e,t,r),this.emitAndNotify("style")}else if(void 0===e){var s=this[0];return s?a.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),a=this;if(void 0===e)for(var i=0;i0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Js.neighbourhood=Js.neighborhood,Js.closedNeighbourhood=Js.closedNeighborhood,Js.openNeighbourhood=Js.openNeighborhood,ye(Js,{source:Io(function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t},"source"),target:Io(function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t},"target"),sources:ru({attr:"source"}),targets:ru({attr:"target"})}),ye(Js,{edgesWith:Io(au(),"edgesWith"),edgesTo:Io(au({thisIsSrc:!0}),"edgesTo")}),ye(Js,{connectedEdges:Io(function(e){for(var t=[],n=0;n0);return i},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Js.componentsOf=Js.components;var ou=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var a=new ft,i=!1;if(t){if(t.length>0&&K(t[0])&&!J(t[0])){i=!0;for(var o=[],s=new vt,u=0,l=t.length;u0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=this,i=a.cy(),o=i._private,s=[],u=[],l=0,c=a.length;l0){for(var N=e.length===a.length?a:new ou(i,e),R=0;R0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],a={},i=n._private.cy;function o(e){var n=a[e.id()];t&&e.removed()||n||(a[e.id()]=!0,e.isNode()?(r.push(e),function(e){for(var t=e._private.edges,n=0;n0&&(e?k.emitAndNotify("remove"):t&&k.emit("remove"));for(var _=0;_=.001?function(t,r){for(var a=0;a<4;++a){var i=h(r,e,n);if(0===i)return r;r-=(d(r,e,n)-t)/i}return r}(t,o):0===u?o:function(t,r,a){var i,o,s=0;do{(i=d(o=r+(a-r)/2,e,n)-t)>0?a=o:r=o}while(Math.abs(i)>1e-7&&++s<10);return o}(t,r,r+a)}(i),t,r)};p.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var v="generateBezier("+[e,t,n,r]+")";return p.toString=function(){return v},p}var cu=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var a={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:a.v,dv:e(a)}}function n(n,r){var a={dx:n.v,dv:e(n)},i=t(n,.5*r,a),o=t(n,.5*r,i),s=t(n,r,o),u=1/6*(a.dx+2*(i.dx+o.dx)+s.dx),l=1/6*(a.dv+2*(i.dv+o.dv)+s.dv);return n.x=n.x+u*r,n.v=n.v+l*r,n}return function e(t,r,a){var i,o,s,u={x:-1,v:0,tension:null,friction:null},l=[0],c=0,d=1e-4;for(t=parseFloat(t)||500,r=parseFloat(r)||20,a=a||null,u.tension=t,u.friction=r,o=(i=null!==a)?(c=e(t,r))/a*.016:.016;s=n(s||u,o),l.push(1+s.x),c+=16,Math.abs(s.x)>d&&Math.abs(s.v)>d;);return i?function(e){return l[e*(l.length-1)|0]}:c}}(),du=function(e,t,n,r){var a=lu(e,t,n,r);return function(e,t,n){return e+(t-e)*a(n)}},hu={linear:function(e,t,n){return e+(t-e)*n},ease:du(.25,.1,.25,1),"ease-in":du(.42,0,1,1),"ease-out":du(0,0,.58,1),"ease-in-out":du(.42,0,.58,1),"ease-in-sine":du(.47,0,.745,.715),"ease-out-sine":du(.39,.575,.565,1),"ease-in-out-sine":du(.445,.05,.55,.95),"ease-in-quad":du(.55,.085,.68,.53),"ease-out-quad":du(.25,.46,.45,.94),"ease-in-out-quad":du(.455,.03,.515,.955),"ease-in-cubic":du(.55,.055,.675,.19),"ease-out-cubic":du(.215,.61,.355,1),"ease-in-out-cubic":du(.645,.045,.355,1),"ease-in-quart":du(.895,.03,.685,.22),"ease-out-quart":du(.165,.84,.44,1),"ease-in-out-quart":du(.77,0,.175,1),"ease-in-quint":du(.755,.05,.855,.06),"ease-out-quint":du(.23,1,.32,1),"ease-in-out-quint":du(.86,0,.07,1),"ease-in-expo":du(.95,.05,.795,.035),"ease-out-expo":du(.19,1,.22,1),"ease-in-out-expo":du(1,0,0,1),"ease-in-circ":du(.6,.04,.98,.335),"ease-out-circ":du(.075,.82,.165,1),"ease-in-out-circ":du(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return hu.linear;var r=cu(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":du};function fu(e,t,n,r,a){if(1===r)return n;if(t===n)return n;var i=a(t,n,r);return null==e||((e.roundValue||e.color)&&(i=Math.round(i)),void 0!==e.min&&(i=Math.max(i,e.min)),void 0!==e.max&&(i=Math.min(i,e.max))),i}function pu(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function vu(e,t,n,r,a){var i=null!=a?a.type:null;n<0?n=0:n>1&&(n=1);var o=pu(e,a),s=pu(t,a);if(Z(o)&&Z(s))return fu(i,o,s,n,r);if(H(o)&&H(s)){for(var u=[],l=0;l0?("spring"===d&&h.push(o.duration),o.easingImpl=hu[d].apply(null,h)):o.easingImpl=hu[d]}var f,p=o.easingImpl;if(f=0===o.duration?1:(n-u)/o.duration,o.applying&&(f=o.progress),f<0?f=0:f>1&&(f=1),null==o.delay){var v=o.startPosition,g=o.position;if(g&&a&&!e.locked()){var y={};yu(v.x,g.x)&&(y.x=vu(v.x,g.x,f,p)),yu(v.y,g.y)&&(y.y=vu(v.y,g.y,f,p)),e.position(y)}var m=o.startPan,b=o.pan,x=i.pan,w=null!=b&&r;w&&(yu(m.x,b.x)&&(x.x=vu(m.x,b.x,f,p)),yu(m.y,b.y)&&(x.y=vu(m.y,b.y,f,p)),e.emit("pan"));var E=o.startZoom,k=o.zoom,_=null!=k&&r;_&&(yu(E,k)&&(i.zoom=Zt(i.minZoom,vu(E,k,f,p),i.maxZoom)),e.emit("zoom")),(w||_)&&e.emit("viewport");var C=o.style;if(C&&C.length>0&&a){for(var T=0;T=0;t--)(0,e[t])();e.splice(0,e.length)},c=i.length-1;c>=0;c--){var d=i[c],h=d._private;h.stopped?(i.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,l(h.frames)):(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||mu(0,d,e),gu(t,d,e,n),h.applying&&(h.applying=!1),l(h.frames),null!=h.step&&h.step(e),d.completed()&&(i.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,l(h.completes)),s=!0)}return n||0!==i.length||0!==o.length||r.push(t),s}for(var i=!1,o=0;o0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var xu={animate:lo.animate(),animation:lo.animation(),animated:lo.animated(),clearQueue:lo.clearQueue(),delay:lo.delay(),delayAnimation:lo.delayAnimation(),stop:lo.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender(function(t,n){bu(n,e)},t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&Ne(function(n){bu(n,e),t()})}()}}},wu={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&J(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},Eu=function(e){return U(e)?new Po(e):e},ku={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Cs(wu,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Eu(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Eu(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Eu(t),n),this},once:function(e,t,n){return this.emitter().one(e,Eu(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};lo.eventAliasesOn(ku);var _u={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};_u.jpeg=_u.jpg;var Cu={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var n,r=e.name,a=t.extension("layout",r);if(null!=a)return n=U(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$(),new a(ye({},e,{cy:t,eles:n}));tt("No such layout `"+r+"` found. Did you forget to import it and `cytoscape.use()` it?")}else tt("A `name` must be specified to make a layout");else tt("Layout options must be specified to make a layout")}};Cu.createLayout=Cu.makeLayout=Cu.layout;var Tu={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var a=this.renderer();!this.destroyed()&&a&&a.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Pu.invalidateDimensions=Pu.resize;var Bu={collection:function(e,t){return U(e)?this.$(e):Q(e)?e.collection():H(e)?(t||(t={}),new ou(this,e,t.unique,t.removed)):new ou(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Bu.elements=Bu.filter=Bu.$;var Du={},Mu="t";Du.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r0;if(h||d&&f){var p=void 0;h&&f||h?p=l.properties:f&&(p=l.mappedProperties);for(var v=0;v1&&(g=1),s.color){var w=a.valueMin[0],E=a.valueMax[0],k=a.valueMin[1],_=a.valueMax[1],C=a.valueMin[2],T=a.valueMax[2],S=null==a.valueMin[3]?1:a.valueMin[3],P=null==a.valueMax[3]?1:a.valueMax[3],B=[Math.round(w+(E-w)*g),Math.round(k+(_-k)*g),Math.round(C+(T-C)*g),Math.round(S+(P-S)*g)];n={bypass:a.bypass,name:a.name,value:B,strValue:"rgb("+B[0]+", "+B[1]+", "+B[2]+")"}}else{if(!s.number)return!1;var D=a.valueMin+(a.valueMax-a.valueMin)*g;n=this.parse(a.name,D,a.bypass,h)}if(!n)return v(),!1;n.mapping=a,a=n;break;case o.data:for(var M=a.field.split("."),A=d.data,I=0;I0&&i>0){for(var s={},u=!1,l=0;l0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:i,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1)},Du.checkTrigger=function(e,t,n,r,a,i){var o=this.properties[t],s=a(o);e.removed()||null!=s&&s(n,r,e)&&i(o)},Du.checkZOrderTrigger=function(e,t,n,r){var a=this;this.checkTrigger(e,t,n,r,function(e){return e.triggersZOrder},function(){a._private.cy.notify("zorder",e)})},Du.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},Du.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfConnectedEdges},function(t){e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},Du.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfParallelEdges},function(t){e.parallelEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},Du.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var Au={applyBypass:function(e,t,n,r){var a=[];if("*"===t||"**"===t){if(void 0!==n)for(var i=0;it.length?i.substr(t.length):""}function s(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");!i.match(/^\s*$/);){var u=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!u){rt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=u[0];var l=u[1];if("core"!==l&&new Po(l).invalid)rt("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),o();else{var c=u[2],d=!1;n=c;for(var h=[];!n.match(/^\s*$/);){var f=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!f){rt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+c),d=!0;break}r=f[0];var p=f[1],v=f[2];this.properties[p]?a.parse(p,v)?(h.push({name:p,val:v}),s()):(rt("Skipping property: Invalid property definition in: "+r),s()):(rt("Skipping property: Invalid property name in: "+r),s())}if(d){o();break}a.selector(l);for(var g=0;g=7&&"d"===t[0]&&(l=new RegExp(s.data.regex).exec(t))){if(n)return!1;var h=s.data;return{name:e,value:l,strValue:""+t,mapped:h,field:l[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(c=new RegExp(s.mapData.regex).exec(t))){if(n)return!1;if(d.multiple)return!1;var f=s.mapData;if(!d.color&&!d.number)return!1;var p=this.parse(e,c[4]);if(!p||p.mapped)return!1;var v=this.parse(e,c[5]);if(!v||v.mapped)return!1;if(p.pfValue===v.pfValue||p.strValue===v.strValue)return rt("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(d.color){var g=p.value,y=v.value;if(!(g[0]!==y[0]||g[1]!==y[1]||g[2]!==y[2]||g[3]!==y[3]&&(null!=g[3]&&1!==g[3]||null!=y[3]&&1!==y[3])))return!1}return{name:e,value:c,strValue:""+t,mapped:f,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:p.value,valueMax:v.value,bypass:n}}}if(d.multiple&&"multiple"!==r){var m;if(m=u?t.split(/\s+/):H(t)?t:[t],d.evenMultiple&&m.length%2!=0)return null;for(var b=[],x=[],w=[],E="",k=!1,_=0;_0?" ":"")+C.strValue}return d.validate&&!d.validate(b,x)?null:d.singleEnum&&k?1===b.length&&U(b[0])?{name:e,value:b[0],strValue:b[0],bypass:n}:null:{name:e,value:b,pfValue:w,strValue:E,bypass:n,units:x}}var T,S,P=function(){for(var r=0;rd.max||d.strictMax&&t===d.max))return null;var I={name:e,value:t,strValue:""+t+(B||""),units:B,bypass:n};return d.unitless||"px"!==B&&"em"!==B?I.pfValue=t:I.pfValue="px"!==B&&B?this.getEmSizeInPixels()*t:t,"ms"!==B&&"s"!==B||(I.pfValue="ms"===B?t:1e3*t),"deg"!==B&&"rad"!==B||(I.pfValue="rad"===B?t:(T=t,Math.PI*T/180)),"%"===B&&(I.pfValue=t/100),I}if(d.propList){var N=[],R=""+t;if("none"===R);else{for(var L=R.split(/\s*,\s*|\s+/),O=0;O0&&u>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(u-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,a=r.pan,i=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),Z(e)?n=e:K(e)&&(n=e.level,null!=e.position?t=jt(e.position,i,a):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?i=!0:(t.zoom=s,a.push("zoom"))}if(r&&(!i||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;Z(u.x)&&(t.pan.x=u.x,o=!1),Z(u.y)&&(t.pan.y=u.y,o=!1),o||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(U(e)){var n=e;e=this.mutableElements().filter(n)}else Q(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),a=this.width(),i=this.height();return{x:(a-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(i-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container;return n.sizeCache=n.sizeCache||(r?(e=this.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};Yu.centre=Yu.center,Yu.autolockNodes=Yu.autolock,Yu.autoungrabifyNodes=Yu.autoungrabify;var qu={data:lo.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:lo.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:lo.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:lo.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};qu.attr=qu.data,qu.removeAttr=qu.removeData;var Xu=function(e){var t=this,n=(e=ye({},e)).container;n&&!$(n)&&$(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var a=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var i=void 0!==d&&void 0!==n&&!e.headless,o=e;o.layout=ye({name:i?"grid":"null"},o.layout),o.renderer=ye({name:i?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},u=this._private={container:n,ready:!1,options:o,elements:new ou(this),listeners:[],aniEles:new ou(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?i:o.styleEnabled,zoom:Z(o.zoom)?o.zoom:1,pan:{x:K(o.pan)&&Z(o.pan.x)?o.pan.x:0,y:K(o.pan)&&Z(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom}),u.styleEnabled&&t.setStyle([]);var l=ye({},o,o.renderer);t.initRenderer(l),function(e,t){if(e.some(ae))return Xr.all(e).then(t);t(e)}([o.style,o.elements],function(e){var n=e[0],i=e[1];u.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var a=t.mutableElements();a.length>0&&a.remove(),null!=e&&(K(e)||H(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",r),t.emit("done")});var i=ye({},t._private.options.layout);i.eles=t.elements(),t.layout(i).run()}(i,function(){t.startAnimationLoop(),u.ready=!0,G(o.ready)&&t.on("ready",o.ready);for(var e=0;e0,u=!!t.boundingBox,l=$t(u?t.boundingBox:structuredClone(n.extent()));if(Q(t.roots))e=t.roots;else if(H(t.roots)){for(var c=[],d=0;d0;){var B=P(),D=_(B,T);if(D)B.outgoers().filter(function(e){return e.isNode()&&r.has(e)}).forEach(S);else if(null===D){rt("Detected double maximal shift for node `"+B.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var M=0;if(t.avoidOverlap)for(var A=0;A0&&y[0].length<=3?i/2:0),s=2*Math.PI/y[r].length*a;return 0===r&&1===y[0].length&&(o=1),{x:W+o*Math.cos(s),y:G+o*Math.sin(s)}}var c=y[r].length,d=Math.max(1===c?0:u?(l.w-2*t.padding-K.w)/((t.grid?$:c)-1):(l.w-2*t.padding-K.w)/((t.grid?$:c)+1),M);return{x:W+(a+1-(c+1)/2)*d,y:G+(r+1-(j+1)/2)*Z}}(e),l,J[t.direction])}),this};var $u={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Qu(e){this.options=ye({},$u,e)}Qu.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));for(var o,s=$t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),u=s.x1+s.w/2,l=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/i.length:t.sweep)/Math.max(1,i.length-1),d=0,h=0;h1&&t.avoidOverlap){d*=1.75;var g=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(d*d/(g*g+y*y));o=Math.max(m,o)}return r.nodes().layoutPositions(this,t,function(e,n){var r=t.startAngle+n*c*(a?1:-1),i=o*Math.cos(r),s=o*Math.sin(r);return{x:u+i,y:l+s}}),this};var Ju,el={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function tl(e){this.options=ye({},el,e)}tl.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,a=t.eles,i=a.nodes().not(":parent"),o=$t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=o.x1+o.w/2,u=o.y1+o.h/2,l=[],c=0,d=0;d0&&Math.abs(m[0].value-x.value)>=g&&(m=[],y.push(m)),m.push(x)}var w=c+t.minNodeSpacing;if(!t.avoidOverlap){var E=y.length>0&&y[0].length>1,k=(Math.min(o.w,o.h)/2-w)/(y.length+E?1:0);w=Math.min(w,k)}for(var _=0,C=0;C1&&t.avoidOverlap){var B=Math.cos(P)-Math.cos(0),D=Math.sin(P)-Math.sin(0),M=Math.sqrt(w*w/(B*B+D*D));_=Math.max(M,_)}T.r=_,_+=w}if(t.equidistant){for(var A=0,I=0,N=0;N=e.numIter||(cl(r,e),r.temperature=r.temperature*e.coolingFactor,r.temperature=e.animationThreshold&&i(),Ne(c)):(El(r,e),s())};c()}else{for(;l;)l=o(u),u++;El(r,e),s()}return this},rl.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},rl.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var al=function(e,t,n){for(var r=n.eles.edges(),a=n.eles.nodes(),i=$t(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:i.w,clientHeight:i.h,boundingBox:i},s=n.eles.components(),u={},l=0;l0)for(o.graphSet.push(w),l=0;lr.count?0:r.graph},ol=function(e,t,n,r){var a=r.graphSet[n];if(-10)var s=(l=r.nodeOverlap*o)*a/(v=Math.sqrt(a*a+i*i)),u=l*i/v;else{var l,c=vl(e,a,i),d=vl(t,-1*a,-1*i),h=d.x-c.x,f=d.y-c.y,p=h*h+f*f,v=Math.sqrt(p);s=(l=(e.nodeRepulsion+t.nodeRepulsion)/p)*h/v,u=l*f/v}e.isLocked||(e.offsetX-=s,e.offsetY-=u),t.isLocked||(t.offsetX+=s,t.offsetY+=u)}},pl=function(e,t,n,r){if(n>0)var a=e.maxX-t.minX;else a=t.maxX-e.minX;if(r>0)var i=e.maxY-t.minY;else i=t.maxY-e.minY;return a>=0&&i>=0?Math.sqrt(a*a+i*i):0},vl=function(e,t,n){var r=e.positionX,a=e.positionY,i=e.height||1,o=e.width||1,s=n/t,u=i/o,l={};return 0===t&&0n?(l.x=r,l.y=a+i/2,l):0t&&-1*u<=s&&s<=u?(l.x=r-o/2,l.y=a-o*n/2/t,l):0=u)?(l.x=r+i*t/2/n,l.y=a+i/2,l):0>n&&(s<=-1*u||s>=u)?(l.x=r-i*t/2/n,l.y=a-i/2,l):l},gl=function(e,t){for(var n=0;n1){var p=t.gravity*d/f,v=t.gravity*h/f;c.offsetX+=p,c.offsetY+=v}}}}},ml=function(e,t){var n=[],r=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;r<=a;){var i=n[r++],o=e.idToIndex[i],s=e.layoutNodes[o],u=s.children;if(0n)var a={x:n*e/r,y:n*t/r};else a={x:e,y:t};return a},wl=function(e,t){var n=e.parentId;if(null!=n){var r=t.layoutNodes[t.idToIndex[n]],a=!1;return(null==r.maxX||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,a=!0),(null==r.minX||e.minX-r.padLeftr.maxY)&&(r.maxY=e.maxY+r.padBottom,a=!0),(null==r.minY||e.minY-r.padTopp&&(d+=f+t.componentSpacing,c=0,h=0,f=0)}}},kl={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function _l(e){this.options=ye({},kl,e)}_l.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));var i=$t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===i.h||0===i.w)r.nodes().layoutPositions(this,t,function(e){return{x:i.x1,y:i.y1}});else{var o=a.size(),s=Math.sqrt(o*i.h/i.w),u=Math.round(s),l=Math.round(i.w/i.h*s),c=function(e){if(null==e)return Math.min(u,l);Math.min(u,l)==u?u=e:l=e},d=function(e){if(null==e)return Math.max(u,l);Math.max(u,l)==u?u=e:l=e},h=t.rows,f=null!=t.cols?t.cols:t.columns;if(null!=h&&null!=f)u=h,l=f;else if(null!=h&&null==f)u=h,l=Math.ceil(o/u);else if(null==h&&null!=f)l=f,u=Math.ceil(o/l);else if(l*u>o){var p=c(),v=d();(p-1)*v>=o?c(p-1):(v-1)*p>=o&&d(v-1)}else for(;l*u=o?d(y+1):c(g+1)}var m=i.w/l,b=i.h/u;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x=l&&(M=0,D++)},I={},N=0;N(r=fn(e,t,x[w],x[w+1],x[w+2],x[w+3])))return g(n,r),!0}else if("bezier"===i.edgeType||"multibezier"===i.edgeType||"self"===i.edgeType||"compound"===i.edgeType)for(x=i.allpts,w=0;w+5(r=hn(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return g(n,r),!0;m=m||a.source,b=b||a.target;var E=o.getArrowWidth(u,c),k=[{name:"source",x:i.arrowStartX,y:i.arrowStartY,angle:i.srcArrowAngle},{name:"target",x:i.arrowEndX,y:i.arrowEndY,angle:i.tgtArrowAngle},{name:"mid-source",x:i.midX,y:i.midY,angle:i.midsrcArrowAngle},{name:"mid-target",x:i.midX,y:i.midY,angle:i.midtgtArrowAngle}];for(w=0;w0&&(y(m),y(b))}function b(e,t,n){return dt(e,t,n)}function x(n,r){var a,i=n._private,o=p;a=r?r+"-":"",n.boundingBox();var s=i.labelBounds[r||"main"],u=n.pstyle(a+"label").value;if("yes"===n.pstyle("text-events").strValue&&u){var l=b(i.rscratch,"labelX",r),c=b(i.rscratch,"labelY",r),d=b(i.rscratch,"labelAngle",r),h=n.pstyle(a+"text-margin-x").pfValue,f=n.pstyle(a+"text-margin-y").pfValue,v=s.x1-o-h,y=s.x2+o-h,m=s.y1-o-f,x=s.y2+o-f;if(d){var w=Math.cos(d),E=Math.sin(d),k=function(e,t){return{x:(e-=l)*w-(t-=c)*E+l,y:e*E+t*w+c}},_=k(v,m),C=k(v,x),T=k(y,m),S=k(y,x),P=[_.x+h,_.y+f,T.x+h,T.y+f,S.x+h,S.y+f,C.x+h,C.y+f];if(pn(e,t,P))return g(n),!0}else if(an(s,e,t))return g(n),!0}}n&&(u=u.interactive);for(var w=u.length-1;w>=0;w--){var E=u[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return l},getAllInBox:function(e,t,n,r){var a=this.getCachedZSortedEles().interactive,i=2/this.cy.zoom(),s=[],u=Math.min(e,n),l=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),h=$t({x1:e=u,y1:t=c,x2:n=l,y2:r=d}),f=[{x:h.x1,y:h.y1},{x:h.x2,y:h.y1},{x:h.x2,y:h.y2},{x:h.x1,y:h.y2}],p=[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]],[f[3],f[0]]];function v(e,t,n){return dt(e,t,n)}function g(e,t){var n=e._private,r=i;e.boundingBox();var a=n.labelBounds.main;if(!a)return null;var o=v(n.rscratch,"labelX",t),s=v(n.rscratch,"labelY",t),u=v(n.rscratch,"labelAngle",t),l=e.pstyle("text-margin-x").pfValue,c=e.pstyle("text-margin-y").pfValue,d=a.x1-r-l,h=a.x2+r-l,f=a.y1-r-c,p=a.y2+r-c;if(u){var g=Math.cos(u),y=Math.sin(u),m=function(e,t){return{x:(e-=o)*g-(t-=s)*y+o,y:e*y+t*g+s}};return[m(d,f),m(h,f),m(h,p),m(d,p)]}return[{x:d,y:f},{x:h,y:f},{x:h,y:p},{x:d,y:p}]}function y(e,t,n,r){function a(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}return a(e,n,r)!==a(t,n,r)&&a(e,t,n)!==a(e,t,r)}for(var m=0;m4&&void 0!==arguments[4])||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(function(e,t,n,r,a){var i,o;if(e!==ec?rc(t,e,tc):((o=tc).x=-1*(i=nc).x,o.y=-1*i.y,o.nx=-1*i.nx,o.ny=-1*i.ny,o.ang=i.ang>0?-(Math.PI-i.ang):Math.PI+i.ang),rc(t,n,nc),Vl=tc.nx*nc.ny-tc.ny*nc.nx,Fl=tc.nx*nc.nx-tc.ny*-nc.ny,Xl=Math.asin(Math.max(-1,Math.min(1,Vl))),Math.abs(Xl)<1e-6)return zl=t.x,jl=t.y,void(Ul=Hl=0);Yl=1,ql=!1,Fl<0?Xl<0?Xl=Math.PI+Xl:(Xl=Math.PI-Xl,Yl=-1,ql=!0):Xl>0&&(Yl=-1,ql=!0),Hl=void 0!==t.radius?t.radius:r,Wl=Xl/2,Kl=Math.min(tc.len/2,nc.len/2),a?(Gl=Math.abs(Math.cos(Wl)*Hl/Math.sin(Wl)))>Kl?(Gl=Kl,Ul=Math.abs(Gl*Math.sin(Wl)/Math.cos(Wl))):Ul=Hl:(Gl=Math.min(Kl,Hl),Ul=Math.abs(Gl*Math.sin(Wl)/Math.cos(Wl))),Ql=t.x+nc.nx*Gl,Jl=t.y+nc.ny*Gl,zl=Ql-nc.ny*Ul*Yl,jl=Jl+nc.nx*Ul*Yl,Zl=t.x+tc.nx*Gl,$l=t.y+tc.ny*Gl,ec=t}(e,t,n,r,a),{cx:zl,cy:jl,radius:Ul,startX:Zl,startY:$l,stopX:Ql,stopY:Jl,startAngle:tc.ang+Math.PI/2*Yl,endAngle:nc.ang-Math.PI/2*Yl,counterClockwise:ql})}var oc=.01,sc=Math.sqrt(.02),uc={};function lc(e){var t=[];if(null!=e){for(var n=0;n0?Math.max(e-t,0):Math.min(e+t,0)},S=T(_,E),P=T(C,k),B=!1;"auto"===g?v=Math.abs(S)>Math.abs(P)?a:r:g===u||g===s?(v=r,B=!0):g!==i&&g!==o||(v=a,B=!0);var D,M=v===r,A=M?P:S,I=M?C:_,N=Xt(I),R=!1;B&&(m||x)||!(g===s&&I<0||g===u&&I>0||g===i&&I>0||g===o&&I<0)||(A=(N*=-1)*Math.abs(A),R=!0);var L=function(e){return Math.abs(e)=Math.abs(A)},O=L(D=m?(b<0?1+b:b)*A:(b<0?A:0)+b*N),z=L(Math.abs(A)-Math.abs(D));if(!O&&!z||R)if(M){var j=l.y1+D+(p?d/2*N:0),V=l.x1,F=l.x2;n.segpts=[V,j,F,j]}else{var Y=l.x1+D+(p?c/2*N:0),q=l.y1,X=l.y2;n.segpts=[Y,q,Y,X]}else if(M){var W=Math.abs(I)<=d/2,U=Math.abs(_)<=h/2;if(W){var G=(l.x1+l.x2)/2,H=l.y1,K=l.y2;n.segpts=[G,H,G,K]}else if(U){var Z=(l.y1+l.y2)/2,$=l.x1,Q=l.x2;n.segpts=[$,Z,Q,Z]}else n.segpts=[l.x1,l.y2]}else{var J=Math.abs(I)<=c/2,ee=Math.abs(C)<=f/2;if(J){var te=(l.y1+l.y2)/2,ne=l.x1,re=l.x2;n.segpts=[ne,te,re,te]}else if(ee){var ae=(l.x1+l.x2)/2,ie=l.y1,oe=l.y2;n.segpts=[ae,ie,ae,oe]}else n.segpts=[l.x2,l.y1]}if(n.isRound){var se=e.pstyle("taxi-radius").value,ue="arc-radius"===e.pstyle("radius-type").value[0];n.radii=new Array(n.segpts.length/2).fill(se),n.isArcRadius=new Array(n.segpts.length/2).fill(ue)}},uc.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,a=t.tgtPos,i=t.srcW,o=t.srcH,s=t.tgtW,u=t.tgtH,l=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,f=t.srcRs,p=t.tgtRs,v=!Z(n.startX)||!Z(n.startY),g=!Z(n.arrowStartX)||!Z(n.arrowStartY),y=!Z(n.endX)||!Z(n.endY),m=!Z(n.arrowEndX)||!Z(n.arrowEndY),b=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth*3,x=Wt({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),w=xv.poolIndex()){var g=p;p=v,v=g}var y=d.srcPos=p.position(),m=d.tgtPos=v.position(),b=d.srcW=p.outerWidth(),x=d.srcH=p.outerHeight(),E=d.tgtW=v.outerWidth(),k=d.tgtH=v.outerHeight(),_=d.srcShape=n.nodeShapes[t.getNodeShape(p)],C=d.tgtShape=n.nodeShapes[t.getNodeShape(v)],T=d.srcCornerRadius="auto"===p.pstyle("corner-radius").value?"auto":p.pstyle("corner-radius").pfValue,S=d.tgtCornerRadius="auto"===v.pstyle("corner-radius").value?"auto":v.pstyle("corner-radius").pfValue,P=d.tgtRs=v._private.rscratch,B=d.srcRs=p._private.rscratch;d.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var D=0;D=sc||(X=Math.sqrt(Math.max(q*q,oc)+Math.max(Y*Y,oc)));var W=d.vector={x:q,y:Y},U=d.vectorNorm={x:W.x/X,y:W.y/X},G={x:-U.y,y:U.x};d.nodesOverlap=!Z(X)||C.checkPoint(L[0],L[1],0,E,k,m.x,m.y,S,P)||_.checkPoint(z[0],z[1],0,b,x,y.x,y.y,T,B),d.vectorNormInverse=G,e={nodesOverlap:d.nodesOverlap,dirCounts:d.dirCounts,calculatedIntersection:!0,hasBezier:d.hasBezier,hasUnbundled:d.hasUnbundled,eles:d.eles,srcPos:m,srcRs:P,tgtPos:y,tgtRs:B,srcW:E,srcH:k,tgtW:b,tgtH:x,srcIntn:j,tgtIntn:O,srcShape:C,tgtShape:_,posPts:{x1:F.x2,y1:F.y2,x2:F.x1,y2:F.y1},intersectionPts:{x1:V.x2,y1:V.y2,x2:V.x1,y2:V.y1},vector:{x:-W.x,y:-W.y},vectorNorm:{x:-U.x,y:-U.y},vectorNormInverse:{x:-G.x,y:-G.y}}}var H=R?e:d;A.nodesOverlap=H.nodesOverlap,A.srcIntn=H.srcIntn,A.tgtIntn=H.tgtIntn,A.isRound=I.startsWith("round"),r&&(p.isParent()||p.isChild()||v.isParent()||v.isChild())&&(p.parents().anySame(v)||v.parents().anySame(p)||p.same(v)&&p.isParent())?t.findCompoundLoopPoints(M,H,D,N):p===v?t.findLoopPoints(M,H,D,N):I.endsWith("segments")?t.findSegmentsPoints(M,H):I.endsWith("taxi")?t.findTaxiPoints(M,H):"straight"===I||!N&&d.eles.length%2==1&&D===Math.floor(d.eles.length/2)?t.findStraightEdgePoints(M):t.findBezierPoints(M,H,D,N,R),t.findEndpoints(M),t.tryToCorrectInvalidPoints(M,H),t.checkForInvalidEdgeWarning(M),t.storeAllpts(M),t.storeEdgeProjections(M),t.calculateArrowAngles(M),t.recalculateEdgeLabelProjections(M),t.calculateLabelAngles(M)}},w=0;w0){var J=f,ee=Ut(J,Ft(i)),te=Ut(J,Ft(Q)),ne=ee;te2&&Ut(J,{x:Q[2],y:Q[3]})0){var ge=p,ye=Ut(ge,Ft(i)),me=Ut(ge,Ft(ve)),be=ye;me2&&Ut(ge,{x:ve[2],y:ve[3]})=l||m){c={cp:v,segment:y};break}}if(c)break}var b=c.cp,x=c.segment,w=(l-h)/x.length,E=x.t1-x.t0,k=s?x.t0+E*w:x.t1-E*w;k=Zt(0,k,1),t=Kt(b.p0,b.p1,b.p2,k),a=function(e,t,n,r){var a=Zt(0,r-.001,1),i=Zt(0,r+.001,1),o=Kt(e,t,n,a),s=Kt(e,t,n,i);return vc(o,s)}(b.p0,b.p1,b.p2,k);break;case"straight":case"segments":case"haystack":for(var _,C,T,S,P=0,B=r.allpts.length,D=0;D+3=l));D+=2);var M=(l-C)/_;M=Zt(0,M,1),t=function(e,t,n,r){var a=t.x-e.x,i=t.y-e.y,o=Wt(e,t),s=a/o,u=i/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+u*r}}(T,S,M),a=vc(T,S)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,a)}};l("source"),l("target"),this.applyLabelDimensions(e)}},fc.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},fc.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),a=Xe(r,e._private.labelDimsKey);if(dt(n.rscratch,"prefixedLabelDimsKey",t)!==a){ht(n.rscratch,"prefixedLabelDimsKey",t,a);var i=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,s=e.pstyle("text-wrap").strValue,u=dt(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==s?1:Math.max(u.length,1),c=i.height/l,d=c*o,h=i.width,f=i.height+(l-1)*(o-1)*c;ht(n.rstyle,"labelWidth",t,h),ht(n.rscratch,"labelWidth",t,h),ht(n.rstyle,"labelHeight",t,f),ht(n.rscratch,"labelHeight",t,f),ht(n.rscratch,"labelLineHeight",t,d)}},fc.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,o=e.pstyle("text-transform").value,s=function(e,r){return r?(ht(n.rscratch,e,t,r),r):dt(n.rscratch,e,t)};if(!i)return"";"none"==o||("uppercase"==o?i=i.toUpperCase():"lowercase"==o&&(i=i.toLowerCase()));var u=e.pstyle("text-wrap").value;if("wrap"===u){var l=s("labelKey");if(null!=l&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var c=i.split("\n"),d=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,f=[],p=/[\s\u200b]+|$/g,v=0;vd){var b,x="",w=0,E=a(g.matchAll(p));try{for(E.s();!(b=E.n()).done;){var k=b.value,_=k[0],C=g.substring(w,k.index);w=k.index+_.length;var T=0===x.length?C:x+C+_;this.calculateLabelDimensions(e,T).width<=d?x+=C+_:(x&&f.push(x),x=C+_)}}catch(e){E.e(e)}finally{E.f()}x.match(/^[\s\u200b]+$/)||f.push(x)}else f.push(g)}s("labelWrapCachedLines",f),i=s("labelWrapCachedText",f.join("\n")),s("labelWrapKey",l)}else if("ellipsis"===u){var S=e.pstyle("text-max-width").pfValue,P="",B=!1;if(this.calculateLabelDimensions(e,i).widthS);D++)P+=i[D],D===i.length-1&&(B=!0);return B||(P+="…"),P}return i},fc.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},fc.calculateLabelDimensions=function(e,t){var n=this.cy.window().document,r=e.pstyle("font-style").strValue,a=e.pstyle("font-size").pfValue,i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=this.labelCalcCanvas,u=this.labelCalcCanvasContext;if(!s){s=this.labelCalcCanvas=n.createElement("canvas"),u=this.labelCalcCanvasContext=s.getContext("2d");var l=s.style;l.position="absolute",l.left="-9999px",l.top="-9999px",l.zIndex="-1",l.visibility="hidden",l.pointerEvents="none"}u.font="".concat(r," ").concat(o," ").concat(a,"px ").concat(i);for(var c=0,d=0,h=t.split("\n"),f=0;f1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var T=a(t);g&&(e.hoverData.tapholdCancelled=!0),n=!0,r(v,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var S=function(e){return{originalEvent:t,type:e,position:{x:c[0],y:c[1]}}},P=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit(S("boxstart")),p[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(g){var B=S("cxtdrag");b?b.emit(B):o.emit(B),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&v===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(S("cxtdragout")),e.hoverData.cxtOver=v,v&&v.emit(S("cxtdragover")))}}else if(e.hoverData.dragging){if(n=!0,o.panningEnabled()&&o.userPanningEnabled()){var D;if(e.hoverData.justStartedPan){var M=e.hoverData.mdownPos;D={x:(c[0]-M[0])*s,y:(c[1]-M[1])*s},e.hoverData.justStartedPan=!1}else D={x:x[0]*s,y:x[1]*s};o.panBy(D),o.emit(S("dragpan")),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=p[4]||null!=b&&!b.pannable()){if(b&&b.pannable()&&b.active()&&b.unactivate(),b&&b.grabbed()||v==y||(y&&r(y,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),v&&r(v,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=v),b)if(g){if(o.boxSelectionEnabled()&&T)b&&b.grabbed()&&(d(w),b.emit(S("freeon")),w.emit(S("free")),e.dragData.didDrag&&(b.emit(S("dragfreeon")),w.emit(S("dragfree")))),P();else if(b&&b.grabbed()&&e.nodeIsDraggable(b)){var A=!e.dragData.didDrag;A&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||l(w,{inDragLayer:!0});var I={x:0,y:0};if(Z(x[0])&&Z(x[1])&&(I.x+=x[0],I.y+=x[1],A)){var N=e.hoverData.dragDelta;N&&Z(N[0])&&Z(N[1])&&(I.x+=N[0],I.y+=N[1])}e.hoverData.draggingEles=!0,w.silentShift(I).emit(S("position")).emit(S("drag")),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(x[0]),t.push(x[1])):(t[0]+=x[0],t[1]+=x[1])}();n=!0}else g&&(e.hoverData.dragging||!o.boxSelectionEnabled()||!T&&o.panningEnabled()&&o.userPanningEnabled()?!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()&&i(b,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,p[4]=0,e.data.bgActivePosistion=Ft(h),e.redrawHint("select",!0),e.redraw()):P(),b&&b.pannable()&&b.active()&&b.unactivate());return p[2]=c[0],p[3]=c[1],n?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}},!1),e.registerBinding(t,"mouseup",function(t){if((1!==e.hoverData.which||1===t.which||!e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var i=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,u=e.findNearestElement(o[0],o[1],!0,!1),l=e.dragData.possibleDragElements,c=e.hoverData.down,h=a(t);e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate();var f=function(e){return{originalEvent:t,type:e,position:{x:o[0],y:o[1]}}};if(3===e.hoverData.which){var p=f("cxttapend");if(c?c.emit(p):i.emit(p),!e.hoverData.cxtDragged){var v=f("cxttap");c?c.emit(v):i.emit(v)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(r(u,["mouseup","tapend","vmouseup"],t,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(r(c,["click","tap","vclick"],t,{x:o[0],y:o[1]}),x=!1,t.timeStamp-w<=i.multiClickDebounceTime()?(b&&clearTimeout(b),x=!0,w=null,r(c,["dblclick","dbltap","vdblclick"],t,{x:o[0],y:o[1]})):(b=setTimeout(function(){x||r(c,["oneclick","onetap","voneclick"],t,{x:o[0],y:o[1]})},i.multiClickDebounceTime()),w=t.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||a(t)||(i.$(n).unselect(["tapunselect"]),l.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=l=i.collection()),u!=c||e.dragData.didDrag||e.hoverData.selecting||null!=u&&u._private.selectable&&(e.hoverData.dragging||("additive"===i.selectionType()||h?u.selected()?u.unselect(["tapunselect"]):u.select(["tapselect"]):h||(i.$(n).unmerge(u).unselect(["tapunselect"]),u.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=i.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),i.emit(f("boxend"));"additive"===i.selectionType()||h||i.$(n).unmerge(g).unselect(),g.emit(f("box")).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(f("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var y=c&&c.grabbed();d(l),y&&(c.emit(f("freeon")),l.emit(f("free")),e.dragData.didDrag&&(c.emit(f("dragfreeon")),l.emit(f("dragfree"))))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}},!1);var k,_,C,T,S,P,B,D,M,A,I,N,R,L,O=[],z=1e5,j=function(t){var n=!1,r=t.deltaY;if(null==r&&(null!=t.wheelDeltaY?r=t.wheelDeltaY/4:null!=t.wheelDelta&&(r=t.wheelDelta/4)),0!==r){if(null==k)if(O.length>=4){var a=O;if(k=function(e){for(var t=0;t5}if(k)for(var o=0;o5&&(r=5*Xt(r)),h=r/-250,k&&(h/=z,h*=3),h*=e.wheelSensitivity,1===t.deltaMode&&(h*=33);var f=s.zoom()*Math.pow(10,h);"gesturechange"===t.type&&(f=e.gestureStartZoom*t.scale),s.zoom({level:f,renderedPosition:{x:d[0],y:d[1]}}),s.emit({type:"gesturechange"===t.type?"pinchzoom":"scrollzoom",originalEvent:t,position:{x:c[0],y:c[1]}})}}}};e.registerBinding(e.container,"wheel",j,!0),e.registerBinding(t,"scroll",function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(t){e.hasTouchStarted||j(t)},!0),e.registerBinding(e.container,"mouseout",function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})},!1),e.registerBinding(e.container,"mouseover",function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})},!1);var V,F,Y,q,X,W,U,G=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},H=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",V=function(t){if(e.hasTouchStarted=!0,m(t)){f(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,a=e.touchData.now,i=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);a[0]=o[0],a[1]=o[1]}t.touches[1]&&(o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),a[2]=o[0],a[3]=o[1]),t.touches[2]&&(o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),a[4]=o[0],a[5]=o[1]);var u=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}};if(t.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var h=e.findContainerClientCoords();A=h[0],I=h[1],N=h[2],R=h[3],_=t.touches[0].clientX-A,C=t.touches[0].clientY-I,T=t.touches[1].clientX-A,S=t.touches[1].clientY-I,L=0<=_&&_<=N&&0<=T&&T<=N&&0<=C&&C<=R&&0<=S&&S<=R;var p=n.pan(),v=n.zoom();if(P=G(_,C,T,S),B=H(_,C,T,S),M=[((D=[(_+T)/2,(C+S)/2])[0]-p.x)/v,(D[1]-p.y)/v],B<4e4&&!t.touches[2]){var g=e.findNearestElement(a[0],a[1],!0,!0),y=e.findNearestElement(a[2],a[3],!0,!0);return g&&g.isNode()?(g.activate().emit(u("cxttapstart")),e.touchData.start=g):y&&y.isNode()?(y.activate().emit(u("cxttapstart")),e.touchData.start=y):n.emit(u("cxttapstart")),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var b=e.findNearestElements(a[0],a[1],!0,!0),x=b[0];if(null!=x&&(x.activate(),e.touchData.start=x,e.touchData.starts=b,e.nodeIsGrabbable(x))){var w=e.dragData.touchDragEles=n.collection(),E=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),x.selected()?(E=n.$(function(t){return t.selected()&&e.nodeIsGrabbable(t)}),l(E,{addToList:w})):c(x,{addToList:w}),s(x),x.emit(u("grabon")),E?E.forEach(function(e){e.emit(u("grab"))}):x.emit(u("grab"))}r(x,["touchstart","tapstart","vmousedown"],t,{x:a[0],y:a[1]}),null==x&&(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||r(e.touchData.start,["taphold"],t,{x:a[0],y:a[1]})},e.tapholdDuration)}if(t.touches.length>=1){for(var k=e.touchData.startPosition=[null,null,null,null,null,null],O=0;O=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var E=t.touches[0].clientX-A,k=t.touches[0].clientY-I,D=t.touches[1].clientX-A,N=t.touches[1].clientY-I,R=H(E,k,D,N);if(R/B>=2.25||R>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var O=p("cxttapend");e.touchData.start?(e.touchData.start.unactivate().emit(O),e.touchData.start=null):o.emit(O)}}if(n&&e.touchData.cxt){O=p("cxtdrag"),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(O):o.emit(O),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var z=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&z===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit(p("cxtdragout")),e.touchData.cxtOver=z,z&&z.emit(p("cxtdragover")))}else if(n&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit(p("boxstart")),e.touchData.selecting=!0,e.touchData.didSelect=!0,a[4]=1,a&&0!==a.length&&void 0!==a[0]?(a[2]=(s[0]+s[2]+s[4])/3,a[3]=(s[1]+s[3]+s[5])/3):(a[0]=(s[0]+s[2]+s[4])/3,a[1]=(s[1]+s[3]+s[5])/3,a[2]=(s[0]+s[2]+s[4])/3+1,a[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),te=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var j=0;j0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",Y=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(t,"touchend",q=function(t){var a=e.touchData.start;if(e.touchData.capture){0===t.touches.length&&(e.touchData.capture=!1),t.preventDefault();var i=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o=e.cy,s=o.zoom(),u=e.touchData.now,l=e.touchData.earlier;if(t.touches[0]){var c=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);u[0]=c[0],u[1]=c[1]}t.touches[1]&&(c=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),u[2]=c[0],u[3]=c[1]),t.touches[2]&&(c=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),u[4]=c[0],u[5]=c[1]);var h,f=function(e){return{originalEvent:t,type:e,position:{x:u[0],y:u[1]}}};if(a&&a.unactivate(),e.touchData.cxt){if(h=f("cxttapend"),a?a.emit(h):o.emit(h),!e.touchData.cxtDragged){var p=f("cxttap");a?a.emit(p):o.emit(p)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!t.touches[2]&&o.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var v=o.collection(e.getAllInBox(i[0],i[1],i[2],i[3]));i[0]=void 0,i[1]=void 0,i[2]=void 0,i[3]=void 0,i[4]=0,e.redrawHint("select",!0),o.emit(f("boxend")),v.emit(f("box")).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(f("boxselect")),v.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=a&&a.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(t.touches[1]);else if(t.touches[0]);else if(!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var g=e.dragData.touchDragEles;if(null!=a){var y=a._private.grabbed;d(g),e.redrawHint("drag",!0),e.redrawHint("eles",!0),y&&(a.emit(f("freeon")),g.emit(f("free")),e.dragData.didDrag&&(a.emit(f("dragfreeon")),g.emit(f("dragfree")))),r(a,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]}),a.unactivate(),e.touchData.start=null}else{var m=e.findNearestElement(u[0],u[1],!0,!0);r(m,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]})}var b=e.touchData.startPosition[0]-u[0],x=b*b,w=e.touchData.startPosition[1]-u[1],E=(x+w*w)*s*s;e.touchData.singleTouchMoved||(a||o.$(":selected").unselect(["tapunselect"]),r(a,["tap","vclick"],t,{x:u[0],y:u[1]}),X=!1,t.timeStamp-U<=o.multiClickDebounceTime()?(W&&clearTimeout(W),X=!0,U=null,r(a,["dbltap","vdblclick"],t,{x:u[0],y:u[1]})):(W=setTimeout(function(){X||r(a,["onetap","voneclick"],t,{x:u[0],y:u[1]})},o.multiClickDebounceTime()),U=t.timeStamp)),null!=a&&!e.dragData.didDrag&&a._private.selectable&&E2){for(var f=[c[0],c[1]],p=Math.pow(f[0]-e,2)+Math.pow(f[1]-t,2),v=1;v0)return v[0]}return null},f=Object.keys(d),p=0;p0?l:ln(a,i,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,a,i,o,s){var u=2*(s="auto"===s?Pn(r,a):s);if(vn(e,t,this.points,i,o,r,a-u,[0,-1],n))return!0;if(vn(e,t,this.points,i,o,r-u,a,[0,-1],n))return!0;var l=r/2+2*n,c=a/2+2*n;return!!pn(e,t,[i-l,o-c,i-l,o,i+l,o,i+l,o-c])||!!mn(e,t,u,u,i+r/2-s,o+a/2-s,n)||!!mn(e,t,u,u,i-r/2+s,o+a/2-s,n)}}},registerNodeShapes:function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Cn(3,0)),this.generateRoundPolygon("round-triangle",Cn(3,0)),this.generatePolygon("rectangle",Cn(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",Cn(5,0)),this.generateRoundPolygon("round-pentagon",Cn(5,0)),this.generatePolygon("hexagon",Cn(6,0)),this.generateRoundPolygon("round-hexagon",Cn(6,0)),this.generatePolygon("heptagon",Cn(7,0)),this.generateRoundPolygon("round-heptagon",Cn(7,0)),this.generatePolygon("octagon",Cn(8,0)),this.generateRoundPolygon("round-octagon",Cn(8,0));var r=new Array(20),a=Sn(5,0),i=Sn(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*v)break}else if(a){if(f>=e.deqCost*u||f>=e.deqAvgCost*s)break}else if(p>=e.deqNoDrawCost*Sc)break;var g=e.deq(t,d,c);if(!(g.length>0))break;for(var y=0;y0&&(e.onDeqd(t,l),!a&&e.shouldRedraw(t,l,d,c)&&r())},a(t))}}},Bc=function(){return r(function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qe;t(this,e),this.idsByKey=new ft,this.keyForId=new ft,this.cachesByLvl=new ft,this.lvls=[],this.getKey=n,this.doesEleInvalidateKey=r},[{key:"getIdsFor",value:function(e){null==e&&tt("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new vt,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new ft,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach(function(n){return t.deleteCache(e,n)})}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}])}(),Dc={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Mc=ut({getKey:null,doesEleInvalidateKey:Qe,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:$e,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Ac=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=Mc(t);ye(n,r),n.lookup=new Bc(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},Ic=Ac.prototype;Ic.reasons=Dc,Ic.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},Ic.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},Ic.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new Ct(function(e,t){return t.reqs-e.reqs})},Ic.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Ic.getElement=function(e,t,n,r,a){var i=this,o=this.renderer,s=o.cy.zoom(),u=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!i.allowEdgeTxrCaching&&e.isEdge()||!i.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(qt(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var l=Math.pow(2,r),c=t.h*l,d=t.w*l,h=o.eleTextBiggerThanMin(e,l);if(!this.isVisible(e,h))return null;var f,p=u.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;if(f=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var v=i.getTextureQueue(f),g=v[v.length-2],y=function(){return i.recycleTexture(f,d)||i.addTexture(f,d)};g||(g=v[v.length-1]),g||(g=y()),g.width-g.usedWidthr;S--)C=i.getElement(e,t,n,S,Dc.downscale);T()}else{var P;if(!x&&!w&&!E)for(var B=r-1;B>=-4;B--){var D=u.get(e,B);if(D){P=D;break}}if(b(P))return i.queueElement(e,r),P;g.context.translate(g.usedWidth,0),g.context.scale(l,l),this.drawElement(g.context,e,t,h,!1),g.context.scale(1/l,1/l),g.context.translate(-g.usedWidth,0)}return p={x:g.usedWidth,texture:g,level:r,scale:l,width:d,height:c,scaledLabelShown:h},g.usedWidth+=Math.ceil(d+8),g.eleCaches.push(p),u.set(e,r,p),i.checkTextureFullness(g),p},Ic.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},Ic.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?lt(t,e):e.fullnessChecks++},Ic.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;lt(n,e),e.retired=!0;for(var a=e.eleCaches,i=0;i=t)return i.retired=!1,i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,ct(i.eleCaches),i.context.setTransform(1,0,0,1,0,0),i.context.clearRect(0,0,i.width,i.height),lt(r,i),n.push(i),i}},Ic.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),a=this.getKey(e),i=r[a];if(i)i.level=Math.max(i.level,t),i.eles.merge(e),i.reqs++,n.updateItem(i);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:a};n.push(o),r[a]=o}},Ic.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],i=t.lookup,o=0;o<1&&n.size()>0;o++){var s=n.pop(),u=s.key,l=s.eles[0],c=i.hasCache(l,s.level);if(r[u]=null,!c){a.push(s);var d=t.getBoundingBox(l);t.getElement(l,d,e,s.level,Dc.dequeue)}}return a},Ic.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),a=n[r];null!=a&&(1===a.eles.length?(a.reqs=Ze,t.updateItem(a),t.pop(),n[r]=null):a.eles.unmerge(e))},Ic.onDequeue=function(e){this.onDequeues.push(e)},Ic.offDequeue=function(e){lt(this.onDequeues,e)},Ic.setupDequeueing=Pc({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,s,u=r.layersByLevel,l=Math.pow(2,n),c=u[n]=u[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=u[t],!0},a=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};a(1),a(-1);for(var i=c.length-1;i>=0;i--){var o=c[i];o.invalid&<(c,o)}}();var d=function(t){var a=(t=t||{}).after;!function(){if(!o){o=$t();for(var t=0;t32767||s>32767)return null;if(i*s>16e6)return null;var u=r.makeLayer(o,n);if(null!=a){var d=c.indexOf(a)+1;c.splice(d,0,u)}else(void 0===t.insert||t.insert)&&c.unshift(u);return u};if(r.skipping&&!i)return null;for(var h=null,f=e.length/1,p=!i,v=0;v=f||!sn(h.bb,g.boundingBox()))&&!(h=d({insert:!0,after:h})))return null;s||p?r.queueLayer(h,g):r.drawEleInLayer(h,g,n,t),h.eles.push(g),m[n]=h}}return s||(p?null:c)},Rc.getEleLevelForLayerLevel=function(e,t){return e},Rc.drawEleInLayer=function(e,t,n,r){var a=this.renderer,i=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(i,!1),a.drawCachedElement(i,t,null,null,n,!0),a.setImgSmoothing(i,!0))},Rc.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,a=0;a0)return!1;if(i.invalid)return!1;r+=i.eles.length}return r===t.length},Rc.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},Rc.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=Re(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)}))},Rc.invalidateLayer=function(e){if(this.lastInvalidationTime=Re(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];lt(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a3&&void 0!==arguments[3])||arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!i||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var u;n&&(u=n,e.translate(-u.x1,-u.y1));var l=i?t.pstyle("opacity").value:1,c=i?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,f=t.pstyle("width").pfValue,p=t.pstyle("line-cap").value,v=t.pstyle("line-outline-width").value,g=t.pstyle("line-outline-color").value,y=l*c,m=l*c,b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===d?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=f,e.lineCap=p,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;o.drawArrowheads(e,t,n)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var w=t.pstyle("ghost-offset-x").pfValue,E=t.pstyle("ghost-offset-y").pfValue,k=t.pstyle("ghost-opacity").value,_=y*k;e.translate(w,E),b(_),x(_),e.translate(-w,-E)}else!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;e.lineWidth=f+v,e.lineCap=p,v>0?(o.colorStrokeStyle(e,g[0],g[1],g[2],n),"straight-triangle"===d?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")):e.lineCap="butt"}();a&&o.drawEdgeUnderlay(e,t),b(),x(),a&&o.drawEdgeOverlay(e,t),o.drawElementText(e,t,null,r),n&&e.translate(u.x1,u.y1)}}},Jc=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var a=this,i=a.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,u=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==o.edgeType||i?t.lineCap="round":t.lineCap="butt",a.colorStrokeStyle(t,u[0],u[1],u[2],r),a.drawEdgePath(n,t,o.allpts,"solid")}}}};Qc.drawEdgeOverlay=Jc("overlay"),Qc.drawEdgeUnderlay=Jc("underlay"),Qc.drawEdgePath=function(e,t,n,r){var i,o=e._private.rscratch,s=t,u=!1,l=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,d=e.pstyle("line-dash-offset").pfValue;if(l){var h=n.join("$");o.pathCacheKey&&o.pathCacheKey===h?(i=t=o.pathCache,u=!0):(i=t=new Path2D,o.pathCacheKey=h,o.pathCache=i)}if(s.setLineDash)switch(r){case"dotted":s.setLineDash([1,1]);break;case"dashed":s.setLineDash(c),s.lineDashOffset=d;break;case"solid":s.setLineDash([])}if(!u&&!o.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),o.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var f=2;f+35&&void 0!==arguments[5]?arguments[5]:5,o=Math.min(i,r/2,a/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+a-o),e.quadraticCurveTo(t+r,n+a,t+r-o,n+a),e.lineTo(t+o,n+a),e.quadraticCurveTo(t,n+a,t,n+a-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}td.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(qt(n*r));t=Math.pow(2,a)}return!(e.pstyle("font-size").pfValue*t5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(i&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var u=o.getLabelJustification(t);e.textAlign=u,e.textBaseline="bottom"}else{var l=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(l||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var f,p=!n;n&&(f=n,e.translate(-f.x1,-f.y1)),null==a?(o.drawText(e,t,null,p,i),t.isEdge()&&(o.drawText(e,t,"source",p,i),o.drawText(e,t,"target",p,i))):o.drawText(e,t,a,p,i),n&&e.translate(f.x1,f.y1)},td.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",i=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,u=t.pstyle("text-outline-opacity").value*s,l=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+a+" "+i,e.lineJoin="round",this.colorFillStyle(e,l[0],l[1],l[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],u)},td.getTextAngle=function(e,t){var n,r=e._private.rscratch,a=t?t+"-":"",i=e.pstyle(a+"text-rotation");if("autorotate"===i.strValue){var o=dt(r,"labelAngle",t);n=e.isEdge()?o:0}else n="none"===i.strValue?0:i.pfValue;return n},td.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=t._private.rscratch,o=a?t.effectiveOpacity():1;if(!a||0!==o&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s,u,l=dt(i,"labelX",n),c=dt(i,"labelY",n),d=this.getLabelText(t,n);if(null!=d&&""!==d&&!isNaN(l)&&!isNaN(c)){this.setupTextStyle(e,t,a);var h,f=n?n+"-":"",p=dt(i,"labelWidth",n),v=dt(i,"labelHeight",n),g=t.pstyle(f+"text-margin-x").pfValue,y=t.pstyle(f+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle("text-halign").value,x=t.pstyle("text-valign").value;switch(m&&(b="center",x="center"),l+=g,c+=y,0!==(h=r?this.getTextAngle(t,n):0)&&(s=l,u=c,e.translate(s,u),e.rotate(h),l=0,c=0),x){case"top":break;case"center":c+=v/2;break;case"bottom":c+=v}var w=t.pstyle("text-background-opacity").value,E=t.pstyle("text-border-opacity").value,k=t.pstyle("text-border-width").pfValue,_=t.pstyle("text-background-padding").pfValue,C=t.pstyle("text-background-shape").strValue,T="round-rectangle"===C||"roundrectangle"===C,S="circle"===C;if(w>0||k>0&&E>0){var P=e.fillStyle,B=e.strokeStyle,D=e.lineWidth,M=t.pstyle("text-background-color").value,A=t.pstyle("text-border-color").value,I=t.pstyle("text-border-style").value,N=w>0,R=k>0&&E>0,L=l-_;switch(b){case"left":L-=p;break;case"center":L-=p/2}var O=c-v-_,z=p+2*_,j=v+2*_;if(N&&(e.fillStyle="rgba(".concat(M[0],",").concat(M[1],",").concat(M[2],",").concat(w*o,")")),R&&(e.strokeStyle="rgba(".concat(A[0],",").concat(A[1],",").concat(A[2],",").concat(E*o,")"),e.lineWidth=k,e.setLineDash))switch(I){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=k/4,e.setLineDash([]);break;default:e.setLineDash([])}if(T?(e.beginPath(),nd(e,L,O,z,j,2)):S?(e.beginPath(),function(e,t,n,r,a){var i=Math.min(r,a)/2,o=t+r/2,s=n+a/2;e.beginPath(),e.arc(o,s,i,0,2*Math.PI),e.closePath()}(e,L,O,z,j)):(e.beginPath(),e.rect(L,O,z,j)),N&&e.fill(),R&&e.stroke(),R&&"double"===I){var V=k/2;e.beginPath(),T?nd(e,L+V,O+V,z-2*V,j-2*V,2):e.rect(L+V,O+V,z-2*V,j-2*V),e.stroke()}e.fillStyle=P,e.strokeStyle=B,e.lineWidth=D,e.setLineDash&&e.setLineDash([])}var F=2*t.pstyle("text-outline-width").pfValue;if(F>0&&(e.lineWidth=F),"wrap"===t.pstyle("text-wrap").value){var Y=dt(i,"labelWrapCachedLines",n),q=dt(i,"labelLineHeight",n),X=p/2,W=this.getLabelJustification(t);switch("auto"===W||("left"===b?"left"===W?l+=-p:"center"===W&&(l+=-X):"center"===b?"left"===W?l+=-X:"right"===W&&(l+=X):"right"===b&&("center"===W?l+=X:"right"===W&&(l+=p))),x){case"top":case"center":case"bottom":c-=(Y.length-1)*q}for(var U=0;U0&&e.strokeText(Y[U],l,c),e.fillText(Y[U],l,c),c+=q}else F>0&&e.strokeText(d,l,c),e.fillText(d,l,c);0!==h&&(e.rotate(-h),e.translate(-s,-u))}}};var rd={drawNode:function(e,t,n){var r,a,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],u=this,l=t._private,c=l.rscratch,d=t.position();if(Z(d.x)&&Z(d.y)&&(!s||t.visible())){var h,f,p=s?t.effectiveOpacity():1,v=u.usePaths(),g=!1,y=t.padding();r=t.width()+2*y,a=t.height()+2*y,n&&(f=n,e.translate(-f.x1,-f.y1));for(var m=t.pstyle("background-image").value,b=new Array(m.length),x=new Array(m.length),w=0,E=0;E0&&void 0!==arguments[0]?arguments[0]:S;u.eleFillStyle(e,t,n)},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R;u.colorStrokeStyle(e,P[0],P[1],P[2],t)},X=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:j;u.colorStrokeStyle(e,O[0],O[1],O[2],t)},W=function(e,t,n,r){var a,i=u.nodePathCache=u.nodePathCache||[],o=We("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+F),s=i[o],l=!1;return null!=s?(a=s,l=!0,c.pathCache=a):(a=new Path2D,i[o]=c.pathCache=a),{path:a,cacheHit:l}},U=t.pstyle("shape").strValue,G=t.pstyle("shape-polygon-points").pfValue;if(v){e.translate(d.x,d.y);var H=W(r,a,U,G);h=H.path,g=H.cacheHit}var K=function(){if(!g){var n=d;v&&(n={x:0,y:0}),u.nodeShapes[u.getNodeShape(t)].draw(h||e,n.x,n.y,r,a,F,c)}v?e.fill(h):e.fill()},$=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=l.backgrounding,i=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;u.hasPie(t)&&(u.drawPie(e,t,i),n&&(v||u.nodeShapes[u.getNodeShape(t)].draw(e,d.x,d.y,r,a,F,c)))},J=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;u.hasStripe(t)&&(e.save(),v?e.clip(c.pathCache):(u.nodeShapes[u.getNodeShape(t)].draw(e,d.x,d.y,r,a,F,c),e.clip()),u.drawStripe(e,t,i),e.restore(),n&&(v||u.nodeShapes[u.getNodeShape(t)].draw(e,d.x,d.y,r,a,F,c)))},ee=function(){var t=(C>0?C:-C)*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:p),n=C>0?0:255;0!==C&&(u.colorFillStyle(e,n,n,n,t),v?e.fill(h):e.fill())},te=function(){if(T>0){if(e.lineWidth=T,e.lineCap=M,e.lineJoin=D,e.setLineDash)switch(B){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(I),e.lineDashOffset=N;break;case"solid":case"double":e.setLineDash([])}if("center"!==A){if(e.save(),e.lineWidth*=2,"inside"===A)v?e.clip(h):e.clip();else{var t=new Path2D;t.rect(-r/2-T,-a/2-T,r+2*T,a+2*T),t.addPath(h),e.clip(t,"evenodd")}v?e.stroke(h):e.stroke(),e.restore()}else v?e.stroke(h):e.stroke();if("double"===B){e.lineWidth=T/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",v?e.stroke(h):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},ne=function(){if(L>0){if(e.lineWidth=L,e.lineCap="butt",e.setLineDash)switch(z){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=d;v&&(n={x:0,y:0});var i=u.getNodeShape(t),o=T;"inside"===A&&(o=0),"outside"===A&&(o*=2);var s,l=(r+o+(L+V))/r,c=(a+o+(L+V))/a,h=r*l,f=a*c,p=u.nodeShapes[i].points;if(v&&(s=W(h,f,i,p).path),"ellipse"===i)u.drawEllipsePath(s||e,n.x,n.y,h,f);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(i)){var g=0,y=0,m=0;"round-diamond"===i?g=1.4*(o+V+L):"round-heptagon"===i?(g=1.075*(o+V+L),m=-(o/2+V+L)/35):"round-hexagon"===i?g=1.12*(o+V+L):"round-pentagon"===i?(g=1.13*(o+V+L),m=-(o/2+V+L)/15):"round-tag"===i?(g=1.12*(o+V+L),y=.07*(o/2+L+V)):"round-triangle"===i&&(g=(o+V+L)*(Math.PI/2),m=-(o+V/2+L)/Math.PI),0!==g&&(h=r*(l=(r+g)/r),["round-hexagon","round-tag"].includes(i)||(f=a*(c=(a+g)/a)));for(var b=h/2,x=f/2,w=(F="auto"===F?Bn(h,f):F)+(o+L+V)/2,E=new Array(p.length/2),k=new Array(p.length/2),_=0;_0){if(r=r||n.position(),null==a||null==i){var d=n.padding();a=n.width()+2*d,i=n.height()+2*d}this.colorFillStyle(t,u[0],u[1],u[2],s),this.nodeShapes[l].draw(t,r.x,r.y,a+2*o,i+2*o,c),t.fill()}}}};rd.drawNodeOverlay=ad("overlay"),rd.drawNodeUnderlay=ad("underlay"),rd.hasPie=function(e){return(e=e[0])._private.hasPie},rd.hasStripe=function(e){return(e=e[0])._private.hasStripe},rd.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a,i=t.cy().style(),o=t.pstyle("pie-size"),s=t.pstyle("pie-hole"),u=t.pstyle("pie-start-angle").pfValue,l=r.x,c=r.y,d=t.width(),h=t.height(),f=Math.min(d,h)/2,p=0;if(this.usePaths()&&(l=0,c=0),"%"===o.units?f*=o.pfValue:void 0!==o.pfValue&&(f=o.pfValue/2),"%"===s.units?a=f*s.pfValue:void 0!==s.pfValue&&(a=s.pfValue/2),!(a>=f))for(var v=1;v<=i.pieBackgroundN;v++){var g=t.pstyle("pie-"+v+"-background-size").value,y=t.pstyle("pie-"+v+"-background-color").value,m=t.pstyle("pie-"+v+"-background-opacity").value*n,b=g/100;b+p>1&&(b=1-p);var x=1.5*Math.PI+2*Math.PI*p,w=(x+=u)+2*Math.PI*b;0===g||p>=1||p+b>1||(0===a?(e.beginPath(),e.moveTo(l,c),e.arc(l,c,f,x,w),e.closePath()):(e.beginPath(),e.arc(l,c,f,x,w),e.arc(l,c,a,w,x,!0),e.closePath()),this.colorFillStyle(e,y[0],y[1],y[2],m),e.fill(),p+=b)}},rd.drawStripe=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),i=r.x,o=r.y,s=t.width(),u=t.height(),l=0,c=this.usePaths();e.save();var d=t.pstyle("stripe-direction").value,h=t.pstyle("stripe-size");switch(d){case"vertical":break;case"righward":e.rotate(-Math.PI/2)}var f=s,p=u;"%"===h.units?(f*=h.pfValue,p*=h.pfValue):void 0!==h.pfValue&&(f=h.pfValue,p=h.pfValue),c&&(i=0,o=0),o-=f/2,i-=p/2;for(var v=1;v<=a.stripeBackgroundN;v++){var g=t.pstyle("stripe-"+v+"-background-size").value,y=t.pstyle("stripe-"+v+"-background-color").value,m=t.pstyle("stripe-"+v+"-background-opacity").value*n,b=g/100;b+l>1&&(b=1-l),0===g||l>=1||l+b>1||(e.beginPath(),e.rect(i,o+p*l,f,p*b),e.closePath(),this.colorFillStyle(e,y[0],y[1],y[2],m),e.fill(),l+=b)}e.restore()};var id,od={};function sd(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(r));return r}function ud(e,t,n){void 0===n&&(n=t);var r=e.makeOffscreenCanvas(t,n),a=r.context=r.getContext("2d");return r.clear=function(){return a.clearRect(0,0,r.width,r.height)},r.clear(),r}function ld(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function cd(e){return"solid"===e.pstyle("background-fill").value&&"none"===e.pstyle("background-image").strValue&&(0===e.pstyle("border-width").value||0===e.pstyle("border-opacity").value||"solid"===e.pstyle("border-style").value)}function dd(e,t){if(e.length!==t.length)return!1;for(var n=0;n>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function pd(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function vd(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function gd(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function yd(e,t,n,r,a,i){switch(t){case e.FLOAT:return new Float32Array(n.buffer,i*r,a);case e.INT:return new Int32Array(n.buffer,i*r,a)}}function md(e,t,n,r){var a=o(vd(e,n),3),i=a[0],s=a[1],u=a[2],l=gd(e,s,t*i),c=i*u,d=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,d),e.bufferData(e.ARRAY_BUFFER,t*c,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),s===e.FLOAT?e.vertexAttribPointer(r,i,s,!1,c,0):s===e.INT&&e.vertexAttribIPointer(r,i,s,c,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var h=new Array(t),f=0;ft.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!d&&(c[t.NODE]=!0,c[t.SELECT_BOX]=!0);var m=n.style(),b=n.zoom(),x=void 0!==o?o:b,w=n.pan(),E={x:w.x,y:w.y},k={zoom:b,pan:{x:w.x,y:w.y}},_=t.prevViewport;void 0===_||k.zoom!==_.zoom||k.pan.x!==_.pan.x||k.pan.y!==_.pan.y||v&&!p||(t.motionBlurPxRatio=1),s&&(E=s),x*=u,E.x*=u,E.y*=u;var C=t.getCachedZSortedEles();function T(e,n,r,a,i){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,a,i),e.globalCompositeOperation=o}function S(e,n){var i,u,c,d;t.clearingMotionBlur||e!==l.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]&&e!==l.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]?(i=E,u=x,c=t.canvasWidth,d=t.canvasHeight):(i={x:w.x*f,y:w.y*f},u=b*f,c=t.canvasWidth*f,d=t.canvasHeight*f),e.setTransform(1,0,0,1,0,0),"motionBlur"===n?T(e,0,0,c,d):r||void 0!==n&&!n||e.clearRect(0,0,c,d),a||(e.translate(i.x,i.y),e.scale(u,u)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}if(d||(t.textureDrawLastFrame=!1),d){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var P=t.data.bufferContexts[t.TEXTURE_BUFFER];P.setTransform(1,0,0,1,0,0),P.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:P,drawOnlyNodeLayer:!0,forcedPxRatio:u*t.textureMult}),(k=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight}).mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[t.DRAG]=!1,c[t.NODE]=!1;var B=l.contexts[t.NODE],D=t.textureCache.texture;k=t.textureCache.viewport,B.setTransform(1,0,0,1,0,0),h?T(B,0,0,k.width,k.height):B.clearRect(0,0,k.width,k.height);var M=m.core("outside-texture-bg-color").value,A=m.core("outside-texture-bg-opacity").value;t.colorFillStyle(B,M[0],M[1],M[2],A),B.fillRect(0,0,k.width,k.height),b=n.zoom(),S(B,!1),B.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/u,k.height/k.zoom/u),B.drawImage(D,k.mpan.x,k.mpan.y,k.width/k.zoom/u,k.height/k.zoom/u)}else t.textureOnViewport&&!r&&(t.textureCache=null);var I=n.extent(),N=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),R=t.hideEdgesOnViewport&&N,L=[];if(L[t.NODE]=!c[t.NODE]&&h&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,L[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),L[t.DRAG]=!c[t.DRAG]&&h&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,L[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),c[t.NODE]||a||i||L[t.NODE]){var O=h&&!L[t.NODE]&&1!==f;S(B=r||(O?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:l.contexts[t.NODE]),h&&!O?"motionBlur":void 0),R?t.drawCachedNodes(B,C.nondrag,u,I):t.drawLayeredElements(B,C.nondrag,u,I),t.debug&&t.drawDebugPoints(B,C.nondrag),a||h||(c[t.NODE]=!1)}if(!i&&(c[t.DRAG]||a||L[t.DRAG])&&(O=h&&!L[t.DRAG]&&1!==f,S(B=r||(O?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:l.contexts[t.DRAG]),h&&!O?"motionBlur":void 0),R?t.drawCachedNodes(B,C.drag,u,I):t.drawCachedElements(B,C.drag,u,I),t.debug&&t.drawDebugPoints(B,C.drag),a||h||(c[t.DRAG]=!1)),this.drawSelectionRectangle(e,S),h&&1!==f){var z=l.contexts[t.NODE],j=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],V=l.contexts[t.DRAG],F=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],Y=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!y?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):T(e,0,0,t.canvasWidth,t.canvasHeight);var a=f;e.drawImage(n,0,0,t.canvasWidth*a,t.canvasHeight*a,0,0,t.canvasWidth,t.canvasHeight)};(c[t.NODE]||L[t.NODE])&&(Y(z,j,L[t.NODE]),c[t.NODE]=!1),(c[t.DRAG]||L[t.DRAG])&&(Y(V,F,L[t.DRAG]),c[t.DRAG]=!1)}t.prevViewport=k,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),h&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!d,t.mbFrames=0,c[t.NODE]=!0,c[t.DRAG]=!0,t.redraw()},100)),r||n.emit("render")},od.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,a=n.data,i=r.style(),o=e.drawOnlyNodeLayer,s=e.drawAllLayers,u=a.canvasNeedsRedraw,l=e.forcedContext;if(n.showFps||!o&&u[n.SELECT_BOX]&&!s){var c=l||a.contexts[n.SELECT_BOX];if(t(c),1==n.selection[4]&&(n.hoverData.selecting||n.touchData.selecting)){var d=n.cy.zoom(),h=i.core("selection-box-border-width").value/d;c.lineWidth=h,c.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",c.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),h>0&&(c.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",c.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(a.bgActivePosistion&&!n.hoverData.selecting){d=n.cy.zoom();var f=a.bgActivePosistion;c.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",c.beginPath(),c.arc(f.x,f.y,i.core("active-bg-size").pfValue/d,0,2*Math.PI),c.fill()}var p=n.lastRedrawTime;if(n.showFps&&p){p=Math.round(p);var v=Math.round(1e3/p),g="1 frame = "+p+" ms = "+v+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!id){var y=c.measureText(g);id=y.actualBoundingBoxAscent}c.fillText(g,0,id),c.strokeRect(0,id+10,250,20),c.fillRect(0,id+10,250*Math.min(v/60,1),20)}s||(u[n.SELECT_BOX]=!1)}};var bd="undefined"!=typeof Float32Array?Float32Array:Array;function xd(){var e=new bd(9);return bd!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function wd(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Ed(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],l=t[6],c=t[7],d=t[8],h=n[0],f=n[1];return e[0]=r,e[1]=a,e[2]=i,e[3]=o,e[4]=s,e[5]=u,e[6]=h*r+f*o+l,e[7]=h*a+f*s+c,e[8]=h*i+f*u+d,e}function kd(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],l=t[6],c=t[7],d=t[8],h=Math.sin(n),f=Math.cos(n);return e[0]=f*r+h*o,e[1]=f*a+h*s,e[2]=f*i+h*u,e[3]=f*o-h*r,e[4]=f*s-h*a,e[5]=f*u-h*i,e[6]=l,e[7]=c,e[8]=d,e}function _d(e,t,n){var r=n[0],a=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=a*t[3],e[4]=a*t[4],e[5]=a*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Cd=function(){return r(function e(n,r,a,i){t(this,e),this.debugID=Math.floor(1e4*Math.random()),this.r=n,this.texSize=r,this.texRows=a,this.texHeight=Math.floor(r/a),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(n,r,r),this.scratch=i(n,r,this.texHeight,"scratch")},[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(e){var t=e.w,n=e.h,r=this.texHeight,a=this.texSize,i=r/n,o=t*i,s=n*i;return o>a&&(o=t*(i=a/t),s=n*i),{scale:i,texW:o,texH:s}}},{key:"draw",value:function(e,t,n){var r=this;if(this.locked)throw new Error("can't draw, atlas is locked");var a=this.texSize,i=this.texRows,o=this.texHeight,s=this.getScale(t),u=s.scale,l=s.texW,c=s.texH,d=function(e,r){if(n&&r){var a=r.context,i=e.x,s=e.row,l=i,c=o*s;a.save(),a.translate(l,c),a.scale(u,u),n(a,t),a.restore()}},h=[null,null],f=function(){d(r.freePointer,r.canvas),h[0]={x:r.freePointer.x,y:r.freePointer.row*o,w:l,h:c},h[1]={x:r.freePointer.x+l,y:r.freePointer.row*o,w:0,h:c},r.freePointer.x+=l,r.freePointer.x==a&&(r.freePointer.x=0,r.freePointer.row++)},p=function(){r.freePointer.x=0,r.freePointer.row++};if(this.freePointer.x+l<=a)f();else{if(this.freePointer.row>=i-1)return!1;this.freePointer.x===a?(p(),f()):this.enableWrapping?function(){var e=r.scratch,t=r.canvas;e.clear(),d({x:0,row:0},e);var n=a-r.freePointer.x,i=l-n,s=o,u=r.freePointer.x,f=r.freePointer.row*o,p=n;t.context.drawImage(e,0,0,p,s,u,f,p,s),h[0]={x:u,y:f,w:p,h:c};var v=n,g=(r.freePointer.row+1)*o,y=i;t&&t.context.drawImage(e,v,0,y,s,0,g,y,s),h[1]={x:0,y:g,w:y,h:c},r.freePointer.x=i,r.freePointer.row++}():(p(),f())}return this.keyToLocation.set(e,h),this.needsBuffer=!0,h}},{key:"getOffsets",value:function(e){return this.keyToLocation.get(e)}},{key:"isEmpty",value:function(){return 0===this.freePointer.x&&0===this.freePointer.row}},{key:"canFit",value:function(e){if(this.locked)return!1;var t=this.texSize,n=this.texRows,r=this.getScale(e).texW;return!(this.freePointer.x+r>t)||this.freePointer.row1&&void 0!==arguments[1]?arguments[1]:{},i=r.forceRedraw,o=void 0!==i&&i,s=r.filterEle,u=void 0===s?function(){return!0}:s,l=r.filterType,c=void 0===l?function(){return!0}:l,d=!1,h=!1,f=a(e);try{for(f.s();!(t=f.n()).done;){var p=t.value;if(u(p)){var v,g=a(this.renderTypes.values());try{var y=function(){var e=v.value,t=e.type;if(c(t)){var r=n.collections.get(e.collection),a=e.getKey(p),i=Array.isArray(a)?a:[a];if(o)i.forEach(function(e){return r.markKeyForGC(e)}),h=!0;else{var s=e.getID?e.getID(p):p.id(),u=n._key(t,s),l=n.typeAndIdToKey.get(u);void 0===l||dd(i,l)||(d=!0,n.typeAndIdToKey.delete(u),l.forEach(function(e){return r.markKeyForGC(e)}))}}};for(g.s();!(v=g.n()).done;)y()}catch(e){g.e(e)}finally{g.f()}}}}catch(e){f.e(e)}finally{f.f()}return h&&(this.gc(),d=!1),d}},{key:"gc",value:function(){var e,t=a(this.collections.values());try{for(t.s();!(e=t.n()).done;)e.value.gc()}catch(e){t.e(e)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(e,t,n,r){var a=this.renderTypes.get(t),i=this.collections.get(a.collection),o=!1,s=i.draw(r,n,function(t){a.drawClipped?(t.save(),t.beginPath(),t.rect(0,0,n.w,n.h),t.clip(),a.drawElement(t,e,n,!0,!0),t.restore()):a.drawElement(t,e,n,!0,!0),o=!0});if(o){var u=a.getID?a.getID(e):e.id(),l=this._key(t,u);this.typeAndIdToKey.has(l)?this.typeAndIdToKey.get(l).push(r):this.typeAndIdToKey.set(l,[r])}return s}},{key:"getAtlasInfo",value:function(e,t){var n=this,r=this.renderTypes.get(t),a=r.getKey(e);return(Array.isArray(a)?a:[a]).map(function(a){var i=r.getBoundingBox(e,a),s=n.getOrCreateAtlas(e,t,i,a),u=o(s.getOffsets(a),2),l=u[0];return{atlas:s,tex:l,tex1:l,tex2:u[1],bb:i}})}},{key:"getDebugInfo",value:function(){var e,t=[],n=a(this.collections);try{for(n.s();!(e=n.n()).done;){var r=o(e.value,2),i=r[0],s=r[1].getCounts(),u=s.keyCount,l=s.atlasCount;t.push({type:i,keyCount:u,atlasCount:l})}}catch(e){n.e(e)}finally{n.f()}return t}}])}(),Pd=function(){return r(function e(n){t(this,e),this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.batchAtlases=[]},[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(e,t){return t})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(e){return this.batchAtlases.length!==this.maxAtlasesPerBatch||this.batchAtlases.includes(e)}},{key:"getAtlasIndexForBatch",value:function(e){var t=this.batchAtlases.indexOf(e);if(t<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(e),t=this.batchAtlases.length-1}return t}}])}(),Bd={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Dd=function(){return r(function e(n,r,a){t(this,e),this.r=n,this.gl=r,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=ud,this.atlasManager=new Sd(n,a),this.batchManager=new Pd(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Bd.SCREEN),this.pickingProgram=this._createShaderProgram(Bd.PICKING),this.vao=this._createVAO()},[{key:"addAtlasCollection",value:function(e,t){this.atlasManager.addAtlasCollection(e,t)}},{key:"addTextureAtlasRenderType",value:function(e,t){this.atlasManager.addRenderType(e,t)}},{key:"addSimpleShapeRenderType",value:function(e,t){this.simpleShapeOptions.set(e,t)}},{key:"invalidate",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).type,n=this.atlasManager;return t?n.invalidate(e,{filterType:function(e){return e===t},forceRedraw:!0}):n.invalidate(e)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(e){var t=this.gl,n="#version 300 es\n precision highp float;\n\n uniform mat3 uPanZoomMatrix;\n uniform int uAtlasSize;\n \n // instanced\n in vec2 aPosition; // a vertex from the unit square\n \n in mat3 aTransform; // used to transform verticies, eg into a bounding box\n in int aVertType; // the type of thing we are rendering\n\n // the z-index that is output when using picking mode\n in vec4 aIndex;\n \n // For textures\n in int aAtlasId; // which shader unit/atlas to use\n in vec4 aTex; // x/y/w/h of texture in atlas\n\n // for edges\n in vec4 aPointAPointB;\n in vec4 aPointCPointD;\n in vec2 aLineWidth; // also used for node border width\n\n // simple shapes\n in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]\n in vec4 aColor; // also used for edges\n in vec4 aBorderColor; // aLineWidth is used for border width\n\n // output values passed to the fragment shader\n out vec2 vTexCoord;\n out vec4 vColor;\n out vec2 vPosition;\n // flat values are not interpolated\n flat out int vAtlasId; \n flat out int vVertType;\n flat out vec2 vTopRight;\n flat out vec2 vBotLeft;\n flat out vec4 vCornerRadius;\n flat out vec4 vBorderColor;\n flat out vec2 vBorderWidth;\n flat out vec4 vIndex;\n \n void main(void) {\n int vid = gl_VertexID;\n vec2 position = aPosition; // TODO make this a vec3, simplifies some code below\n\n if(aVertType == ".concat(0,") {\n float texX = aTex.x; // texture coordinates\n float texY = aTex.y;\n float texW = aTex.z;\n float texH = aTex.w;\n\n if(vid == 1 || vid == 2 || vid == 4) {\n texX += texW;\n }\n if(vid == 2 || vid == 4 || vid == 5) {\n texY += texH;\n }\n\n float d = float(uAtlasSize);\n vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(4," || aVertType == ").concat(7," \n || aVertType == ").concat(5," || aVertType == ").concat(6,") { // simple shapes\n\n // the bounding box is needed by the fragment shader\n vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat\n vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat\n vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated\n\n // calculations are done in the fragment shader, just pass these along\n vColor = aColor;\n vCornerRadius = aCornerRadius;\n vBorderColor = aBorderColor;\n vBorderWidth = aLineWidth;\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(1,") {\n vec2 source = aPointAPointB.xy;\n vec2 target = aPointAPointB.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n // stretch the unit square into a long skinny rectangle\n vec2 xBasis = target - source;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;\n\n gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n vColor = aColor;\n } \n else if(aVertType == ").concat(2,") {\n vec2 pointA = aPointAPointB.xy;\n vec2 pointB = aPointAPointB.zw;\n vec2 pointC = aPointCPointD.xy;\n vec2 pointD = aPointCPointD.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 p0, p1, p2, pos;\n if(position.x == 0.0) { // The left side of the unit square\n p0 = pointA;\n p1 = pointB;\n p2 = pointC;\n pos = position;\n } else { // The right side of the unit square, use same approach but flip the geometry upside down\n p0 = pointD;\n p1 = pointC;\n p2 = pointB;\n pos = vec2(0.0, -position.y);\n }\n\n vec2 p01 = p1 - p0;\n vec2 p12 = p2 - p1;\n vec2 p21 = p1 - p2;\n\n // Find the normal vector.\n vec2 tangent = normalize(normalize(p12) + normalize(p01));\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n // Find the vector perpendicular to p0 -> p1.\n vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n // Determine the bend direction.\n float sigma = sign(dot(p01 + p21, normal));\n float width = aLineWidth[0];\n\n if(sign(pos.y) == -sigma) {\n // This is an intersecting vertex. Adjust the position so that there's no overlap.\n vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n } else {\n // This is a non-intersecting vertex. Treat it like a mitre join.\n vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n }\n\n vColor = aColor;\n } \n else if(aVertType == ").concat(3," && vid < 3) {\n // massage the first triangle into an edge arrow\n if(vid == 0)\n position = vec2(-0.15, -0.3);\n if(vid == 1)\n position = vec2( 0.0, 0.0);\n if(vid == 2)\n position = vec2( 0.15, -0.3);\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n vColor = aColor;\n }\n else {\n gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space\n }\n\n vAtlasId = aAtlasId;\n vVertType = aVertType;\n vIndex = aIndex;\n }\n "),r=this.batchManager.getIndexArray(),a="#version 300 es\n precision highp float;\n\n // declare texture unit for each texture atlas in the batch\n ".concat(r.map(function(e){return"uniform sampler2D uTexture".concat(e,";")}).join("\n\t"),"\n\n uniform vec4 uBGColor;\n uniform float uZoom;\n\n in vec2 vTexCoord;\n in vec4 vColor;\n in vec2 vPosition; // model coordinates\n\n flat in int vAtlasId;\n flat in vec4 vIndex;\n flat in int vVertType;\n flat in vec2 vTopRight;\n flat in vec2 vBotLeft;\n flat in vec4 vCornerRadius;\n flat in vec4 vBorderColor;\n flat in vec2 vBorderWidth;\n\n out vec4 outColor;\n\n ").concat("\n float circleSD(vec2 p, float r) {\n return distance(vec2(0), p) - r; // signed distance\n }\n","\n ").concat("\n float rectangleSD(vec2 p, vec2 b) {\n vec2 d = abs(p)-b;\n return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);\n }\n","\n ").concat("\n float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {\n cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;\n cr.x = (p.y > 0.0) ? cr.x : cr.y;\n vec2 q = abs(p) - b + cr.x;\n return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;\n }\n","\n ").concat("\n float ellipseSD(vec2 p, vec2 ab) {\n p = abs( p ); // symmetry\n\n // find root with Newton solver\n vec2 q = ab*(p-ab);\n float w = (q.x1.0) ? d : -d;\n }\n","\n\n vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha\n return vec4( \n top.rgb + (bot.rgb * (1.0 - top.a)),\n top.a + (bot.a * (1.0 - top.a)) \n );\n }\n\n vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance\n // scale to the zoom level so that borders don't look blurry when zoomed in\n // note 1.5 is an aribitrary value chosen because it looks good\n return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); \n }\n\n void main(void) {\n if(vVertType == ").concat(0,") {\n // look up the texel from the texture unit\n ").concat(r.map(function(e){return"if(vAtlasId == ".concat(e,") outColor = texture(uTexture").concat(e,", vTexCoord);")}).join("\n\telse "),"\n } \n else if(vVertType == ").concat(3,") {\n // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';\n outColor = blend(vColor, uBGColor);\n outColor.a = 1.0; // make opaque, masks out line under arrow\n }\n else if(vVertType == ").concat(4," && vBorderWidth == vec2(0.0)) { // simple rectangle with no border\n outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done\n }\n else if(vVertType == ").concat(4," || vVertType == ").concat(7," \n || vVertType == ").concat(5," || vVertType == ").concat(6,") { // use SDF\n\n float outerBorder = vBorderWidth[0];\n float innerBorder = vBorderWidth[1];\n float borderPadding = outerBorder * 2.0;\n float w = vTopRight.x - vBotLeft.x - borderPadding;\n float h = vTopRight.y - vBotLeft.y - borderPadding;\n vec2 b = vec2(w/2.0, h/2.0); // half width, half height\n vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center\n\n float d; // signed distance\n if(vVertType == ").concat(4,") {\n d = rectangleSD(p, b);\n } else if(vVertType == ").concat(7," && w == h) {\n d = circleSD(p, b.x); // faster than ellipse\n } else if(vVertType == ").concat(7,") {\n d = ellipseSD(p, b);\n } else {\n d = roundRectangleSD(p, b, vCornerRadius.wzyx);\n }\n\n // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling\n // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box\n if(d > 0.0) {\n if(d > outerBorder) {\n discard;\n } else {\n outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);\n }\n } else {\n if(d > innerBorder) {\n vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;\n vec4 innerBorderColor = blend(vBorderColor, vColor);\n outColor = distInterp(innerBorderColor, outerColor, d);\n } \n else {\n vec4 outerColor;\n if(innerBorder == 0.0 && outerBorder == 0.0) {\n outerColor = vec4(0);\n } else if(innerBorder == 0.0) {\n outerColor = vBorderColor;\n } else {\n outerColor = blend(vBorderColor, vColor);\n }\n outColor = distInterp(vColor, outerColor, d - innerBorder);\n }\n }\n }\n else {\n outColor = vColor;\n }\n\n ").concat(e.picking?"if(outColor.a == 0.0) discard;\n else outColor = vIndex;":"","\n }\n "),i=function(e,t,n){var r=sd(e,e.VERTEX_SHADER,t),a=sd(e,e.FRAGMENT_SHADER,n),i=e.createProgram();if(e.attachShader(i,r),e.attachShader(i,a),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw new Error("Could not initialize shaders");return i}(t,n,a);i.aPosition=t.getAttribLocation(i,"aPosition"),i.aIndex=t.getAttribLocation(i,"aIndex"),i.aVertType=t.getAttribLocation(i,"aVertType"),i.aTransform=t.getAttribLocation(i,"aTransform"),i.aAtlasId=t.getAttribLocation(i,"aAtlasId"),i.aTex=t.getAttribLocation(i,"aTex"),i.aPointAPointB=t.getAttribLocation(i,"aPointAPointB"),i.aPointCPointD=t.getAttribLocation(i,"aPointCPointD"),i.aLineWidth=t.getAttribLocation(i,"aLineWidth"),i.aColor=t.getAttribLocation(i,"aColor"),i.aCornerRadius=t.getAttribLocation(i,"aCornerRadius"),i.aBorderColor=t.getAttribLocation(i,"aBorderColor"),i.uPanZoomMatrix=t.getUniformLocation(i,"uPanZoomMatrix"),i.uAtlasSize=t.getUniformLocation(i,"uAtlasSize"),i.uBGColor=t.getUniformLocation(i,"uBGColor"),i.uZoom=t.getUniformLocation(i,"uZoom"),i.uTextures=[];for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:Bd.SCREEN;this.panZoomMatrix=e,this.renderTarget=t,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(e,t){return!!e.visible()&&(!t||!t.isVisible||t.isVisible(e))}},{key:"drawTexture",value:function(e,t,n){var r=this.atlasManager,i=this.batchManager,s=r.getRenderTypeOpts(n);if(this._isVisible(e,s)&&(!e.isEdge()||this._isValidEdge(e))){if(this.renderTarget.picking&&s.getTexPickingMode){var u=s.getTexPickingMode(e);if(1===u)return;if(2==u)return void this.drawPickingRectangle(e,t,n)}var l,c=a(r.getAtlasInfo(e,n));try{for(c.s();!(l=c.n()).done;){var d=l.value,h=d.atlas,f=d.tex1,p=d.tex2;i.canAddToCurrentBatch(h)||this.endBatch();for(var v=i.getAtlasIndexForBatch(h),g=0,y=[[f,!0],[p,!1]];g=this.maxInstances&&this.endBatch()}}}}catch(e){c.e(e)}finally{c.f()}}}},{key:"setTransformMatrix",value:function(e,t,n,r){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=0;if(n.shapeProps&&n.shapeProps.padding&&(i=e.pstyle(n.shapeProps.padding).pfValue),r){var o=r.bb,s=r.tex1,u=r.tex2,l=s.w/(s.w+u.w);a||(l=1-l);var c=this._getAdjustedBB(o,i,a,l);this._applyTransformMatrix(t,c,n,e)}else{var d=n.getBoundingBox(e),h=this._getAdjustedBB(d,i,!0,1);this._applyTransformMatrix(t,h,n,e)}}},{key:"_applyTransformMatrix",value:function(e,t,n,r){var a,i;wd(e);var o=n.getRotation?n.getRotation(r):0;if(0!==o){var s=n.getRotationPoint(r);Ed(e,e,[s.x,s.y]),kd(e,e,o);var u=n.getRotationOffset(r);a=u.x+(t.xOffset||0),i=u.y+(t.yOffset||0)}else a=t.x1,i=t.y1;Ed(e,e,[a,i]),_d(e,e,[t.w,t.h])}},{key:"_getAdjustedBB",value:function(e,t,n,r){var a=e.x1,i=e.y1,o=e.w,s=e.h;t&&(a-=t,i-=t,o+=2*t,s+=2*t);var u=0,l=o*r;return n&&r<1?o=l:!n&&r<1&&(a+=u=o-l,o=l),{x1:a,y1:i,w:o,h:s,xOffset:u,yOffset:e.yOffset}}},{key:"drawPickingRectangle",value:function(e,t,n){var r=this.atlasManager.getRenderTypeOpts(n),a=this.instanceCount;this.vertTypeBuffer.getView(a)[0]=4,fd(t,this.indexBuffer.getView(a)),hd([0,0,0],1,this.colorBuffer.getView(a));var i=this.transformBuffer.getMatrixView(a);this.setTransformMatrix(e,i,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(e,t,n){var r=this.simpleShapeOptions.get(n);if(this._isVisible(e,r)){var a=r.shapeProps,i=this._getVertTypeForShape(e,a.shape);if(void 0===i||r.isSimple&&!r.isSimple(e))this.drawTexture(e,t,n);else{var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=i,5===i||6===i){var s=r.getBoundingBox(e),u=this._getCornerRadius(e,a.radius,s),l=this.cornerRadiusBuffer.getView(o);l[0]=u,l[1]=u,l[2]=u,l[3]=u,6===i&&(l[0]=0,l[2]=0)}fd(t,this.indexBuffer.getView(o)),hd(e.pstyle(a.color).value,e.pstyle(a.opacity).value,this.colorBuffer.getView(o));var c=this.lineWidthBuffer.getView(o);if(c[0]=0,c[1]=0,a.border){var d=e.pstyle("border-width").value;if(d>0){hd(e.pstyle("border-color").value,e.pstyle("border-opacity").value,this.borderColorBuffer.getView(o));var h=e.pstyle("border-position").value;if("inside"===h)c[0]=0,c[1]=-d;else if("outside"===h)c[0]=d,c[1]=0;else{var f=d/2;c[0]=f,c[1]=-f}}}var p=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(e,p,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"_getVertTypeForShape",value:function(e,t){switch(e.pstyle(t).value){case"rectangle":return 4;case"ellipse":return 7;case"roundrectangle":case"round-rectangle":return 5;case"bottom-round-rectangle":return 6;default:return}}},{key:"_getCornerRadius",value:function(e,t,n){var r=n.w,a=n.h;if("auto"===e.pstyle(t).value)return Pn(r,a);var i=e.pstyle(t).pfValue,o=r/2,s=a/2;return Math.min(i,s,o)}},{key:"drawEdgeArrow",value:function(e,t,n){if(e.visible()){var r,a,i,o=e._private.rscratch;if(!("source"===n?(r=o.arrowStartX,a=o.arrowStartY,i=o.srcArrowAngle):(r=o.arrowEndX,a=o.arrowEndY,i=o.tgtArrowAngle),isNaN(r)||null==r||isNaN(a)||null==a||isNaN(i)||null==i||"none"===e.pstyle(n+"-arrow-shape").value)){var s=e.pstyle(n+"-arrow-color").value,u=e.pstyle("opacity").value*e.pstyle("line-opacity").value,l=e.pstyle("width").pfValue,c=e.pstyle("arrow-scale").value,d=this.r.getArrowWidth(l,c),h=this.instanceCount,f=this.transformBuffer.getMatrixView(h);wd(f),Ed(f,f,[r,a]),_d(f,f,[d,d]),kd(f,f,i),this.vertTypeBuffer.getView(h)[0]=3,fd(t,this.indexBuffer.getView(h)),hd(s,u,this.colorBuffer.getView(h)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(e,t){if(e.visible()){var n=this._getEdgePoints(e);if(n){var r=e.pstyle("opacity").value,a=e.pstyle("line-opacity").value,i=e.pstyle("width").pfValue,o=e.pstyle("line-color").value,s=r*a;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),4==n.length){var u=this.instanceCount;this.vertTypeBuffer.getView(u)[0]=1,fd(t,this.indexBuffer.getView(u)),hd(o,s,this.colorBuffer.getView(u)),this.lineWidthBuffer.getView(u)[0]=i;var l=this.pointAPointBBuffer.getView(u);l[0]=n[0],l[1]=n[1],l[2]=n[2],l[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var c=0;c=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(e){var t=e._private.rscratch;return!t.badLine&&null!=t.allpts&&!isNaN(t.allpts[0])}},{key:"_getEdgePoints",value:function(e){var t=e._private.rscratch;if(this._isValidEdge(e)){var n=t.allpts;if(4==n.length)return n;var r=this._getNumSegments(e);return this._getCurveSegmentPoints(n,r)}}},{key:"_getNumSegments",value:function(e){return Math.min(Math.max(15,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(e,t){if(4==e.length)return e;for(var n=Array(2*(t+1)),r=0;r<=t;r++)if(0==r)n[0]=e[0],n[1]=e[1];else if(r==t)n[2*r]=e[e.length-2],n[2*r+1]=e[e.length-1];else{var a=r/t;this._setCurvePoint(e,a,n,2*r)}return n}},{key:"_setCurvePoint",value:function(e,t,n,r){if(!(e.length<=2)){for(var a=Array(e.length-2),i=0;i0}},l=function(e){return"yes"===e.pstyle("text-events").strValue?2:1},c=function(e){var t=e.position(),n=t.x,r=t.y,a=e.outerWidth(),i=e.outerHeight();return{w:a,h:i,x1:n-a/2,y1:r-i/2}};n.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),n.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),n.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),n.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:c,isSimple:cd,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),n.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:c,isVisible:u("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),n.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:c,isVisible:u("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),n.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:l,getKey:Id(t.getLabelKey,null),getBoundingBox:Nd(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:i(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:s("label")}),n.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:l,getKey:Id(t.getSourceLabelKey,"source"),getBoundingBox:Nd(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:i("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:s("source-label")}),n.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:l,getKey:Id(t.getTargetLabelKey,"target"),getBoundingBox:Nd(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:i("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:s("target-label")});var d=De(function(){console.log("garbage collect flag set"),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(e,t){var r=!1;t&&t.length>0&&(r|=n.drawing.invalidate(t)),r&&d()}),function(e){var t=e.render;e.render=function(n){n=n||{};var r=e.cy;e.webgl&&(r.zoom()>7.99?(function(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}(e),t.call(e,n)):(function(e){var t=function(t){t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.canvasWidth,e.canvasHeight),t.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}(e),Od(e,n,Bd.SCREEN)))};var n=e.matchCanvasSize;e.matchCanvasSize=function(t){n.call(e,t),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0},e.findNearestElements=function(t,n,r,i){return function(e,t,n){var r,i,s,u=function(e,t,n){var r,a,i=ld(e),s=function(e,t,n,r,a){var i=r*n+t.x,o=a*n+t.y;return[i,o=Math.round(e.canvasHeight-o)]}(e,i.pan,i.zoom,t,n),u=o(s,2);if(r=u[0]-3,a=u[1]-3,0==6)return[];var l=e.data.contexts[e.WEBGL];l.bindFramebuffer(l.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(l.viewport(0,0,l.canvas.width,l.canvas.height),Od(e,null,Bd.PICKING),e.pickingFrameBuffer.needsDraw=!1);var c=new Uint8Array(144);l.readPixels(r,a,6,6,l.RGBA,l.UNSIGNED_BYTE,c),l.bindFramebuffer(l.FRAMEBUFFER,null);for(var d=new Set,h=0;h<36;h++){var f=pd(c.slice(4*h,4*h+4))-1;f>=0&&d.add(f)}return d}(e,t,n),l=e.getCachedZSortedEles(),c=a(u);try{for(c.s();!(s=c.n()).done;){var d=l[s.value];if(!r&&d.isNode()&&(r=d),!i&&d.isEdge()&&(i=d),r&&i)break}}catch(e){c.e(e)}finally{c.f()}return[r,i].filter(Boolean)}(e,t,n)};var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0};var i=e.notify;e.notify=function(t,n){i.call(e,t,n),"viewport"===t||"bounds"===t?e.pickingFrameBuffer.needsDraw=!0:"background"===t&&e.drawing.invalidate(n,{type:"node-body"})}}(n)};var Id=function(e,t){return function(n){var r=e(n),a=Ad(n,t);return a.length>1?a.map(function(e,t){return"".concat(r,"_").concat(t)}):r}},Nd=function(e,t){return function(n,r){var a=e(n);if("string"==typeof r){var i=r.indexOf("_");if(i>0){var o=Number(r.substring(i+1)),s=Ad(n,t),u=a.h/s.length,l=u*o,c=a.y1+l;return{x1:a.x1,w:a.w,y1:c,h:u,yOffset:l}}}return a}};function Rd(e,t){var n=e.canvasWidth,r=e.canvasHeight,a=ld(e),i=a.pan,o=a.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(i.x,i.y),t.scale(o,o)}function Ld(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,"node-underlay"),r.drawNode(n,t,"node-body"),r.drawTexture(n,t,"label"),r.drawNode(n,t,"node-overlay")):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,"source"),r.drawEdgeArrow(n,t,"target"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"edge-source-label"),r.drawTexture(n,t,"edge-target-label"))}function Od(e,t,n){var r;e.webglDebug&&(r=performance.now());var i=e.drawing,o=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&function(e,t){e.drawSelectionRectangle(t,function(t){return Rd(e,t)})}(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var s=e.data.contexts[e.WEBGL];n.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var u=function(e){var t=e.canvasWidth,n=e.canvasHeight,r=ld(e),a=r.pan,i=r.zoom,o=xd();Ed(o,o,[a.x,a.y]),_d(o,o,[i,i]);var s=xd();!function(e,t,n){e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1}(s,t,n);var u,l,c,d,h,f,p,v,g,y,m,b,x,w,E,k,_,C,T,S,P,B=xd();return u=B,c=o,d=(l=s)[0],h=l[1],f=l[2],p=l[3],v=l[4],g=l[5],y=l[6],m=l[7],b=l[8],x=c[0],w=c[1],E=c[2],k=c[3],_=c[4],C=c[5],T=c[6],S=c[7],P=c[8],u[0]=x*d+w*p+E*y,u[1]=x*h+w*v+E*m,u[2]=x*f+w*g+E*b,u[3]=k*d+_*p+C*y,u[4]=k*h+_*v+C*m,u[5]=k*f+_*g+C*b,u[6]=T*d+S*p+P*y,u[7]=T*h+S*v+P*m,u[8]=T*f+S*g+P*b,B}(e),l=e.getCachedZSortedEles();if(o=l.length,i.startFrame(u,n),n.screen){for(var c=0;c0&&i>0){h.clearRect(0,0,a,i),h.globalCompositeOperation="source-over";var f=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*u,-n.y1*u),h.scale(u,u),this.drawElements(h,f),h.scale(1/u,1/u),h.translate(n.x1*u,n.y1*u);else{var p=t.pan(),v={x:p.x*u,y:p.y*u};u*=t.zoom(),h.translate(v.x,v.y),h.scale(u,u),this.drawElements(h,f),h.scale(1/u,1/u),h.translate(-v.x,-v.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,a,i),h.fill())}return d},Wd.png=function(e){return Gd(e,this.bufferCanvasImage(e),"image/png")},Wd.jpg=function(e){return Gd(e,this.bufferCanvasImage(e),"image/jpeg")};var Hd=Zd,Kd=Zd.prototype;function Zd(e){var t=this,n=t.cy.window().document;e.webgl&&(Kd.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:new Array(Kd.CANVAS_LAYERS),contexts:new Array(Kd.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Kd.CANVAS_LAYERS),bufferCanvases:new Array(Kd.BUFFER_COUNT),bufferContexts:new Array(Kd.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";t.data.canvasContainer=n.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=a,i.position="relative",i.zIndex="0",i.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=a;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};h&&h.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var u=0;uthis.loadGraph()),t.addEventListener("click",()=>this.fitGraph()),n.addEventListener("click",()=>this.zoomIn()),r.addEventListener("click",()=>this.zoomOut()),a.addEventListener("change",e=>{this.currentLayout=e.target.value,this.applyLayout()}),i.addEventListener("change",e=>{this.colorMode=e.target.value,this.updateColors(),this.updateLegend()}),o.addEventListener("change",e=>{this.showNetworks=e.target.checked,this.applyFilters()}),s.addEventListener("change",e=>{this.showVolumes=e.target.checked,this.applyFilters()}),u.addEventListener("change",e=>{this.showStoppedContainers=e.target.checked,this.applyFilters()})}async loadGraph(){try{this.sdk.showToast("Loading graph data...","info");const e=await this.sdk.fetch("/graph-data");if(!e.ok)throw new Error(`Failed to load graph: ${e.statusText}`);const t=await e.json();this.renderGraph(t),this.sdk.showToast("Graph loaded successfully!","success")}catch(e){console.error("Failed to load graph:",e),this.sdk.showToast(`Failed to load graph: ${e.message}`,"error"),this.renderError(e.message)}}renderGraph(e){const t=document.getElementById("graphContainer");this.cy&&this.cy.destroy();const n=this.convertToElements(e);this.cy=uh({container:t,elements:n,style:this.getStylesheet(),layout:this.getLayoutConfig(),minZoom:.01,maxZoom:20,wheelSensitivity:.05}),this.cy.on("tap","node",e=>{const t=e.target;this.showNodeDetails(t)}),this.applyFilters(),this.updateLegend()}convertToElements(e){return[...e.nodes.map(e=>({data:{id:e.id,label:e.label,type:e.type,status:e.status,host_id:e.host_id}})),...e.edges.map(e=>({data:{id:`${e.from}-${e.to}-${e.type}`,source:e.from,target:e.to,type:e.type,label:e.label||""}}))]}getStylesheet(){return[{selector:'node[type="container"]',style:{"background-color":e=>this.getContainerColor(e),label:"data(label)",color:"#ffffff","text-valign":"center","text-halign":"center","font-size":"12px","font-weight":"500",width:"label",height:"40px",padding:"8px",shape:"roundrectangle","border-width":2,"border-color":"#ffffff","text-wrap":"none"}},{selector:'node[type="network"]',style:{"background-color":"#3b82f6",label:"data(label)",color:"#ffffff","text-valign":"center","text-halign":"center","font-size":"11px",width:50,height:50,shape:"ellipse","border-width":2,"border-color":"#ffffff"}},{selector:'node[type="volume"]',style:{"background-color":"#f59e0b",label:"data(label)",color:"#ffffff","text-valign":"center","text-halign":"center","font-size":"11px",width:50,height:50,shape:"barrel","border-width":2,"border-color":"#ffffff"}},{selector:"edge",style:{width:2,"line-color":"#cbd5e1","target-arrow-color":"#cbd5e1","target-arrow-shape":"triangle","curve-style":"bezier",opacity:.6}},{selector:'edge[type="network"]',style:{"line-color":"#3b82f6","target-arrow-color":"#3b82f6"}},{selector:'edge[type="volume"]',style:{"line-color":"#f59e0b","target-arrow-color":"#f59e0b"}},{selector:"node:selected",style:{"border-width":4,"border-color":"#ef4444"}},{selector:".hidden",style:{display:"none"}}]}getLayoutConfig(){const e={dagre:{name:"dagre",rankDir:"LR",nodeSep:50,rankSep:150,animate:!0,animationDuration:500},circle:{name:"circle",animate:!0,animationDuration:500},grid:{name:"grid",animate:!0,animationDuration:500},cose:{name:"cose",animate:!0,animationDuration:500,nodeRepulsion:4e3,idealEdgeLength:80,gravity:1,numIter:1e3,componentSpacing:100}};return e[this.currentLayout]||e.cose}applyLayout(){this.cy&&this.cy.layout(this.getLayoutConfig()).run()}applyFilters(){this.cy&&(this.cy.elements().removeClass("hidden"),this.showNetworks||(this.cy.nodes('[type="network"]').addClass("hidden"),this.cy.edges('[type="network"]').addClass("hidden")),this.showVolumes||(this.cy.nodes('[type="volume"]').addClass("hidden"),this.cy.edges('[type="volume"]').addClass("hidden")),this.showStoppedContainers||this.cy.nodes('[type="container"]').filter(e=>{const t=e.data("status");return!(t&&t.toLowerCase().startsWith("up"))}).addClass("hidden"))}fitGraph(){this.cy&&this.cy.fit(null,50)}zoomIn(){if(!this.cy)return;const e=this.cy.zoom();this.cy.zoom({level:1.5*e,renderedPosition:{x:this.cy.width()/2,y:this.cy.height()/2}})}zoomOut(){if(!this.cy)return;const e=this.cy.zoom();this.cy.zoom({level:e/1.5,renderedPosition:{x:this.cy.width()/2,y:this.cy.height()/2}})}getContainerColor(e){if("status"===this.colorMode){const t=e.data("status");return t&&t.toLowerCase().startsWith("up")?"#10b981":"#ef4444"}if("project"===this.colorMode){const t=e.data("compose_project");return t?this.getProjectColor(t):"#6b7280"}return"#6b7280"}getProjectColor(e){if(this.projectColors[e])return this.projectColors[e];const t=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#06b6d4","#84cc16"],n=Object.keys(this.projectColors).length%t.length;return this.projectColors[e]=t[n],t[n]}updateColors(){this.cy&&(this.projectColors={},this.cy.style(this.getStylesheet()))}updateLegend(){const e=document.getElementById("graphLegend");if("status"===this.colorMode)e.innerHTML='\n
\n \n Running\n
\n
\n \n Stopped\n
\n
\n \n Network\n
\n
\n \n Volume\n
\n ';else if("project"===this.colorMode){let t='\n
\n \n No Project\n
\n ';const n=Object.keys(this.projectColors).sort();for(const e of n)t+=`\n
\n \n ${e}\n
\n `;t+='\n
\n \n Network\n
\n
\n \n Volume\n
\n ',e.innerHTML=t}}showNodeDetails(e){const t=e.data();let n=`Type: ${t.type}
`;n+=`Label: ${t.label}
`,"container"===t.type&&(n+=`Status: ${t.status}
`,n+=`Host ID: ${t.host_id}
`),this.sdk.showToast(n,"info")}renderError(e){document.getElementById("graphContainer").innerHTML=`\n
\n
\n

⚠️ Error Loading Graph

\n

${e}

\n \n
\n
\n `}}"undefined"!=typeof window&&(window.initGraphVisualizer=function(e,t){new Ch(e,t).init()})})()})(); \ No newline at end of file diff --git a/internal/plugins/builtin/graph/frontend/src/index.js b/internal/plugins/builtin/graph/frontend/src/index.js index cc0d45c..b4b73dd 100644 --- a/internal/plugins/builtin/graph/frontend/src/index.js +++ b/internal/plugins/builtin/graph/frontend/src/index.js @@ -255,13 +255,13 @@ class GraphVisualizerView { 'text-halign': 'center', 'font-size': '12px', 'font-weight': '500', - 'width': 60, - 'height': 60, + 'width': 'label', + 'height': '40px', + 'padding': '8px', 'shape': 'roundrectangle', 'border-width': 2, 'border-color': '#ffffff', - 'text-wrap': 'wrap', - 'text-max-width': '60px', + 'text-wrap': 'none', }, }, // Network nodes diff --git a/internal/plugins/external/census_api.go b/internal/plugins/external/census_api.go deleted file mode 100644 index befb342..0000000 --- a/internal/plugins/external/census_api.go +++ /dev/null @@ -1,359 +0,0 @@ -package external - -import ( - "context" - "fmt" - "log" - "time" - - "github.com/container-census/container-census/internal/models" - pb "github.com/container-census/container-census/internal/plugins/proto" - "github.com/container-census/container-census/internal/storage" -) - -// CensusAPIServer implements the Census API gRPC service for plugins -type CensusAPIServer struct { - pb.UnimplementedCensusAPIServer - db *storage.DB - permissions map[string]*PermissionChecker // pluginID -> checker -} - -// NewCensusAPIServer creates a new Census API server -func NewCensusAPIServer(db *storage.DB) *CensusAPIServer { - return &CensusAPIServer{ - db: db, - permissions: make(map[string]*PermissionChecker), - } -} - -// RegisterPlugin registers a plugin's permissions for enforcement -func (s *CensusAPIServer) RegisterPlugin(pluginID string, permissions []string) error { - if err := ValidatePermissions(permissions); err != nil { - return fmt.Errorf("invalid permissions for plugin %s: %w", pluginID, err) - } - - s.permissions[pluginID] = NewPermissionChecker(pluginID, permissions) - log.Printf("[CensusAPI] Registered plugin %s with permissions: %v", pluginID, permissions) - return nil -} - -// UnregisterPlugin removes a plugin's permissions -func (s *CensusAPIServer) UnregisterPlugin(pluginID string) { - delete(s.permissions, pluginID) - log.Printf("[CensusAPI] Unregistered plugin %s", pluginID) -} - -// checkPermission verifies a plugin has the required permission -func (s *CensusAPIServer) checkPermission(pluginID string, perm Permission) error { - checker, ok := s.permissions[pluginID] - if !ok { - return fmt.Errorf("plugin %s is not registered", pluginID) - } - return checker.Check(perm) -} - -// GetContainers returns containers -func (s *CensusAPIServer) GetContainers(ctx context.Context, req *pb.GetContainersRequest) (*pb.GetContainersResponse, error) { - // Check permission - if err := s.checkPermission(req.PluginId, PermContainersRead); err != nil { - log.Printf("[CensusAPI] Permission denied: %v", err) - return nil, err - } - - log.Printf("[CensusAPI] Plugin %s requesting containers (latest_only=%v, host_id=%d)", - req.PluginId, req.LatestOnly, req.HostId) - - // Get containers from database - var containers []models.Container - var err error - - if req.HostId > 0 { - containers, err = s.db.GetContainersByHost(req.HostId) - } else if req.LatestOnly { - containers, err = s.db.GetLatestContainers() - } else { - // For now, default to latest - containers, err = s.db.GetLatestContainers() - } - - if err != nil { - return nil, fmt.Errorf("failed to get containers: %w", err) - } - - // Convert to protobuf format - pbContainers := make([]*pb.Container, len(containers)) - for i, c := range containers { - pbContainers[i] = containerToProto(&c) - } - - return &pb.GetContainersResponse{ - Containers: pbContainers, - }, nil -} - -// GetContainer returns a specific container -func (s *CensusAPIServer) GetContainer(ctx context.Context, req *pb.GetContainerRequest) (*pb.GetContainerResponse, error) { - // Check permission - if err := s.checkPermission(req.PluginId, PermContainersRead); err != nil { - log.Printf("[CensusAPI] Permission denied: %v", err) - return nil, err - } - - log.Printf("[CensusAPI] Plugin %s requesting container %s on host %d", - req.PluginId, req.ContainerId, req.HostId) - - // For simplicity, get all containers and filter - // In production, this would be a direct query - containers, err := s.db.GetContainersByHost(req.HostId) - if err != nil { - return nil, fmt.Errorf("failed to get containers: %w", err) - } - - for _, c := range containers { - if c.ID == req.ContainerId { - return &pb.GetContainerResponse{ - Container: containerToProto(&c), - Found: true, - }, nil - } - } - - return &pb.GetContainerResponse{ - Found: false, - }, nil -} - -// GetHosts returns all hosts -func (s *CensusAPIServer) GetHosts(ctx context.Context, req *pb.GetHostsRequest) (*pb.GetHostsResponse, error) { - // Check permission - if err := s.checkPermission(req.PluginId, PermHostsRead); err != nil { - log.Printf("[CensusAPI] Permission denied: %v", err) - return nil, err - } - - log.Printf("[CensusAPI] Plugin %s requesting hosts", req.PluginId) - - hosts, err := s.db.GetHosts() - if err != nil { - return nil, fmt.Errorf("failed to get hosts: %w", err) - } - - pbHosts := make([]*pb.Host, len(hosts)) - for i, h := range hosts { - pbHosts[i] = hostToProto(&h) - } - - return &pb.GetHostsResponse{ - Hosts: pbHosts, - }, nil -} - -// GetHost returns a specific host -func (s *CensusAPIServer) GetHost(ctx context.Context, req *pb.GetHostRequest) (*pb.GetHostResponse, error) { - // Check permission - if err := s.checkPermission(req.PluginId, PermHostsRead); err != nil { - log.Printf("[CensusAPI] Permission denied: %v", err) - return nil, err - } - - log.Printf("[CensusAPI] Plugin %s requesting host %d", req.PluginId, req.HostId) - - host, err := s.db.GetHost(req.HostId) - if err != nil { - return nil, fmt.Errorf("failed to get host: %w", err) - } - - if host == nil { - return &pb.GetHostResponse{ - Found: false, - }, nil - } - - return &pb.GetHostResponse{ - Host: hostToProto(host), - Found: true, - }, nil -} - -// GetPluginData retrieves plugin-specific data -func (s *CensusAPIServer) GetPluginData(ctx context.Context, req *pb.GetPluginDataRequest) (*pb.GetPluginDataResponse, error) { - // Check permission - if err := s.checkPermission(req.PluginId, PermStorageRead); err != nil { - log.Printf("[CensusAPI] Permission denied: %v", err) - return nil, err - } - - log.Printf("[CensusAPI] Plugin %s reading data key: %s", req.PluginId, req.Key) - - value, err := s.db.GetPluginData(req.PluginId, req.Key) - if err != nil { - return nil, fmt.Errorf("failed to get plugin data: %w", err) - } - - if value == nil { - return &pb.GetPluginDataResponse{ - Found: false, - }, nil - } - - return &pb.GetPluginDataResponse{ - Value: string(value), - Found: true, - }, nil -} - -// SetPluginData stores plugin-specific data -func (s *CensusAPIServer) SetPluginData(ctx context.Context, req *pb.SetPluginDataRequest) (*pb.SetPluginDataResponse, error) { - // Check permission - if err := s.checkPermission(req.PluginId, PermStorageWrite); err != nil { - log.Printf("[CensusAPI] Permission denied: %v", err) - return nil, err - } - - log.Printf("[CensusAPI] Plugin %s writing data key: %s", req.PluginId, req.Key) - - err := s.db.SetPluginData(req.PluginId, req.Key, []byte(req.Value)) - if err != nil { - return nil, fmt.Errorf("failed to set plugin data: %w", err) - } - - return &pb.SetPluginDataResponse{ - Success: true, - }, nil -} - -// DeletePluginData deletes plugin-specific data -func (s *CensusAPIServer) DeletePluginData(ctx context.Context, req *pb.DeletePluginDataRequest) (*pb.DeletePluginDataResponse, error) { - // Check permission - if err := s.checkPermission(req.PluginId, PermStorageWrite); err != nil { - log.Printf("[CensusAPI] Permission denied: %v", err) - return nil, err - } - - log.Printf("[CensusAPI] Plugin %s deleting data key: %s", req.PluginId, req.Key) - - err := s.db.DeletePluginData(req.PluginId, req.Key) - if err != nil { - return nil, fmt.Errorf("failed to delete plugin data: %w", err) - } - - return &pb.DeletePluginDataResponse{ - Success: true, - }, nil -} - -// Log receives log messages from plugins -func (s *CensusAPIServer) Log(ctx context.Context, req *pb.LogRequest) (*pb.LogResponse, error) { - // Format log message with plugin ID prefix - prefix := fmt.Sprintf("[Plugin:%s]", req.PluginId) - - switch req.Level { - case "debug": - log.Printf("%s [DEBUG] %s", prefix, req.Message) - case "info": - log.Printf("%s [INFO] %s", prefix, req.Message) - case "warn": - log.Printf("%s [WARN] %s", prefix, req.Message) - case "error": - log.Printf("%s [ERROR] %s", prefix, req.Message) - default: - log.Printf("%s %s", prefix, req.Message) - } - - return &pb.LogResponse{ - Success: true, - }, nil -} - -// SendEvent sends events to other plugins -func (s *CensusAPIServer) SendEvent(ctx context.Context, req *pb.SendEventRequest) (*pb.SendEventResponse, error) { - log.Printf("[CensusAPI] Plugin %s sending event: %s", req.PluginId, req.EventType) - - // TODO: Implement event bus for inter-plugin communication - // For now, just log it - log.Printf("[CensusAPI] Event from %s: type=%s, data=%v", req.PluginId, req.EventType, req.Data) - - return &pb.SendEventResponse{ - Success: true, - }, nil -} - -// Helper functions to convert models to protobuf - -func containerToProto(c *models.Container) *pb.Container { - pbContainer := &pb.Container{ - Id: c.ID, - Name: c.Name, - Image: c.Image, - ImageId: c.ImageID, - State: c.State, - Status: c.Status, - HostId: c.HostID, - HostName: c.HostName, - Created: c.Created.Format(time.RFC3339), - StartedAt: c.StartedAt.Format(time.RFC3339), - FinishedAt: "", // Not in current model - Networks: c.Networks, - Links: c.Links, - Labels: c.Labels, - Env: make(map[string]string), // Not in current model - ComposeProject: c.ComposeProject, - CpuPercent: c.CPUPercent, - MemoryUsage: c.MemoryUsage, - MemoryLimit: c.MemoryLimit, - MemoryPercent: c.MemoryPercent, - } - - // Convert ports - if c.Ports != nil { - pbContainer.Ports = make([]*pb.Port, len(c.Ports)) - for i, p := range c.Ports { - pbContainer.Ports[i] = &pb.Port{ - ContainerPort: int32(p.PrivatePort), - HostPort: int32(p.PublicPort), - Protocol: p.Type, - HostIp: p.IP, - } - } - } - - // Convert volumes - if c.Volumes != nil { - pbContainer.Volumes = make([]*pb.Volume, len(c.Volumes)) - for i, v := range c.Volumes { - mode := "ro" - if v.RW { - mode = "rw" - } - pbContainer.Volumes[i] = &pb.Volume{ - Type: v.Type, - Name: v.Name, - Source: v.Name, // Use name as source - Destination: v.Destination, - Mode: mode, - } - } - } - - return pbContainer -} - -func hostToProto(h *models.Host) *pb.Host { - lastSeen := "" - if !h.LastSeen.IsZero() { - lastSeen = h.LastSeen.Format(time.RFC3339) - } - - return &pb.Host{ - Id: h.ID, - Name: h.Name, - Address: h.Address, - HostType: h.HostType, - Description: h.Description, - Enabled: h.Enabled, - CollectStats: h.CollectStats, - LastSeen: lastSeen, - AgentVersion: h.AgentVersion, - AgentStatus: h.AgentStatus, - } -} diff --git a/internal/plugins/external/installer.go b/internal/plugins/external/installer.go deleted file mode 100644 index c900927..0000000 --- a/internal/plugins/external/installer.go +++ /dev/null @@ -1,458 +0,0 @@ -package external - -import ( - "archive/tar" - "compress/gzip" - "context" - "encoding/json" - "fmt" - "io" - "log" - "net/http" - "os" - "path/filepath" - "runtime" - "strings" - "time" - - "github.com/container-census/container-census/internal/storage" - "gopkg.in/yaml.v3" -) - -// PluginManifest represents the plugin.yaml structure -type PluginManifest struct { - ID string `yaml:"id"` - Name string `yaml:"name"` - Version string `yaml:"version"` - Description string `yaml:"description"` - Author string `yaml:"author"` - Repository string `yaml:"repository"` - MinCensusVersion string `yaml:"min_census_version"` - Permissions []string `yaml:"permissions"` - Frontend FrontendConfig `yaml:"frontend"` - Tab TabConfig `yaml:"tab"` -} - -type FrontendConfig struct { - BundleURL string `yaml:"bundle_url"` - CSSURL string `yaml:"css_url"` - InitFunc string `yaml:"init_function"` -} - -type TabConfig struct { - ID string `yaml:"id"` - Label string `yaml:"label"` - Icon string `yaml:"icon"` - Order int `yaml:"order"` -} - -// GitHubRelease represents a GitHub release -type GitHubRelease struct { - TagName string `json:"tag_name"` - Name string `json:"name"` - Assets []struct { - Name string `json:"name"` - BrowserDownloadURL string `json:"browser_download_url"` - } `json:"assets"` -} - -// PluginInstaller handles plugin installation from GitHub -type PluginInstaller struct { - db *storage.DB - pluginsDir string - httpClient *http.Client -} - -// NewPluginInstaller creates a new plugin installer -func NewPluginInstaller(db *storage.DB, pluginsDir string) *PluginInstaller { - return &PluginInstaller{ - db: db, - pluginsDir: pluginsDir, - httpClient: &http.Client{Timeout: 60 * time.Second}, - } -} - -// Install installs a plugin from a GitHub repository URL -func (i *PluginInstaller) Install(ctx context.Context, repoURL, version string) error { - log.Printf("[Installer] Installing plugin from %s (version: %s)", repoURL, version) - - // Parse repository owner and name from URL - owner, repo, err := parseGitHubURL(repoURL) - if err != nil { - return fmt.Errorf("invalid GitHub URL: %w", err) - } - - // Fetch plugin manifest - manifest, err := i.fetchPluginManifest(owner, repo) - if err != nil { - return fmt.Errorf("failed to fetch plugin manifest: %w", err) - } - - log.Printf("[Installer] Found plugin: %s v%s", manifest.Name, manifest.Version) - - // Check if plugin is already installed - existing, err := i.db.GetExternalPlugin(manifest.ID) - if err != nil { - return fmt.Errorf("failed to check existing plugin: %w", err) - } - if existing != nil { - return fmt.Errorf("plugin %s is already installed (version %s)", manifest.ID, existing.Version) - } - - // Determine which version to install - targetVersion := version - if targetVersion == "" || targetVersion == "latest" { - release, err := i.getLatestRelease(owner, repo) - if err != nil { - return fmt.Errorf("failed to get latest release: %w", err) - } - targetVersion = release.TagName - } - - // Create plugin directory - pluginDir := filepath.Join(i.pluginsDir, manifest.ID) - if err := os.MkdirAll(pluginDir, 0755); err != nil { - return fmt.Errorf("failed to create plugin directory: %w", err) - } - - // Download and extract plugin binary - binaryPath, err := i.downloadBinary(owner, repo, targetVersion, pluginDir) - if err != nil { - os.RemoveAll(pluginDir) // Clean up on error - return fmt.Errorf("failed to download plugin binary: %w", err) - } - - // Download frontend assets if specified - frontendDir := filepath.Join(pluginDir, "frontend") - if manifest.Frontend.BundleURL != "" { - if err := os.MkdirAll(frontendDir, 0755); err != nil { - os.RemoveAll(pluginDir) - return fmt.Errorf("failed to create frontend directory: %w", err) - } - - if err := i.downloadFrontendAssets(owner, repo, targetVersion, frontendDir); err != nil { - os.RemoveAll(pluginDir) - return fmt.Errorf("failed to download frontend assets: %w", err) - } - } - - // Save plugin record to database - // Marshal tab config to JSON - tabConfigJSON := "" - if manifest.Tab.ID != "" { - tabBytes, err := json.Marshal(manifest.Tab) - if err != nil { - log.Printf("[Installer] Warning: failed to marshal tab config: %v", err) - } else { - tabConfigJSON = string(tabBytes) - } - } - - record := &storage.ExternalPluginRecord{ - PluginRecord: storage.PluginRecord{ - ID: manifest.ID, - Name: manifest.Name, - Version: targetVersion, - SourceType: "github", - SourceURL: repoURL, - Enabled: true, - InstalledAt: time.Now(), - UpdatedAt: time.Now(), - TabConfig: tabConfigJSON, - }, - BinaryPath: binaryPath, - Permissions: manifest.Permissions, - FrontendBundle: filepath.Join(frontendDir, "bundle.js"), - FrontendCSS: filepath.Join(frontendDir, "bundle.css"), - ProcessStatus: "stopped", - } - - if err := i.db.SaveExternalPlugin(record); err != nil { - os.RemoveAll(pluginDir) - return fmt.Errorf("failed to save plugin record: %w", err) - } - - log.Printf("[Installer] Successfully installed plugin %s v%s", manifest.ID, targetVersion) - return nil -} - -// Update updates a plugin to the latest version -func (i *PluginInstaller) Update(ctx context.Context, pluginID string) error { - log.Printf("[Installer] Updating plugin %s", pluginID) - - // Get existing plugin - existing, err := i.db.GetExternalPlugin(pluginID) - if err != nil { - return fmt.Errorf("failed to get plugin: %w", err) - } - if existing == nil { - return fmt.Errorf("plugin %s not found", pluginID) - } - - // Uninstall old version - if err := i.Uninstall(pluginID); err != nil { - return fmt.Errorf("failed to uninstall old version: %w", err) - } - - // Reinstall latest version - return i.Install(ctx, existing.SourceURL, "latest") -} - -// Uninstall removes a plugin -func (i *PluginInstaller) Uninstall(pluginID string) error { - log.Printf("[Installer] Uninstalling plugin %s", pluginID) - - // Get plugin record - plugin, err := i.db.GetExternalPlugin(pluginID) - if err != nil { - return fmt.Errorf("failed to get plugin: %w", err) - } - if plugin == nil { - return fmt.Errorf("plugin %s not found", pluginID) - } - - // Remove plugin directory - pluginDir := filepath.Join(i.pluginsDir, pluginID) - if err := os.RemoveAll(pluginDir); err != nil { - log.Printf("[Installer] Warning: failed to remove plugin directory: %v", err) - } - - // Delete from database - if err := i.db.DeletePlugin(pluginID); err != nil { - return fmt.Errorf("failed to delete plugin from database: %w", err) - } - - log.Printf("[Installer] Successfully uninstalled plugin %s", pluginID) - return nil -} - -// fetchPluginManifest fetches the plugin.yaml from GitHub -func (i *PluginInstaller) fetchPluginManifest(owner, repo string) (*PluginManifest, error) { - // Fetch raw plugin.yaml from main branch - url := fmt.Sprintf("https://raw.githubusercontent.com/%s/%s/main/plugin.yaml", owner, repo) - - resp, err := i.httpClient.Get(url) - if err != nil { - return nil, fmt.Errorf("failed to fetch manifest: %w", err) - } - defer resp.Body.Close() - - if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("failed to fetch manifest: HTTP %d", resp.StatusCode) - } - - var manifest PluginManifest - if err := yaml.NewDecoder(resp.Body).Decode(&manifest); err != nil { - return nil, fmt.Errorf("failed to parse manifest: %w", err) - } - - return &manifest, nil -} - -// getLatestRelease gets the latest GitHub release -func (i *PluginInstaller) getLatestRelease(owner, repo string) (*GitHubRelease, error) { - url := fmt.Sprintf("https://api.github.com/repos/%s/%s/releases/latest", owner, repo) - - resp, err := i.httpClient.Get(url) - if err != nil { - return nil, fmt.Errorf("failed to fetch releases: %w", err) - } - defer resp.Body.Close() - - if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("failed to fetch releases: HTTP %d", resp.StatusCode) - } - - var release GitHubRelease - if err := json.NewDecoder(resp.Body).Decode(&release); err != nil { - return nil, fmt.Errorf("failed to parse release: %w", err) - } - - return &release, nil -} - -// downloadBinary downloads the plugin binary for the current platform -func (i *PluginInstaller) downloadBinary(owner, repo, version, destDir string) (string, error) { - // Determine platform-specific binary name (use hyphen to match common naming convention) - platform := fmt.Sprintf("%s-%s", runtime.GOOS, runtime.GOARCH) - - // Get release - url := fmt.Sprintf("https://api.github.com/repos/%s/%s/releases/tags/%s", owner, repo, version) - resp, err := i.httpClient.Get(url) - if err != nil { - return "", fmt.Errorf("failed to fetch release: %w", err) - } - defer resp.Body.Close() - - var release GitHubRelease - if err := json.NewDecoder(resp.Body).Decode(&release); err != nil { - return "", fmt.Errorf("failed to parse release: %w", err) - } - - // Find matching asset - var downloadURL string - for _, asset := range release.Assets { - if strings.Contains(asset.Name, platform) { - downloadURL = asset.BrowserDownloadURL - break - } - } - - if downloadURL == "" { - return "", fmt.Errorf("no binary found for platform %s", platform) - } - - // Download binary - log.Printf("[Installer] Downloading binary from %s", downloadURL) - resp, err = i.httpClient.Get(downloadURL) - if err != nil { - return "", fmt.Errorf("failed to download binary: %w", err) - } - defer resp.Body.Close() - - // Save to file - binaryPath := filepath.Join(destDir, "plugin") - file, err := os.OpenFile(binaryPath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0755) - if err != nil { - return "", fmt.Errorf("failed to create binary file: %w", err) - } - defer file.Close() - - if _, err := io.Copy(file, resp.Body); err != nil { - return "", fmt.Errorf("failed to write binary: %w", err) - } - - log.Printf("[Installer] Binary saved to %s", binaryPath) - return binaryPath, nil -} - -// downloadFrontendAssets downloads frontend bundle and CSS -func (i *PluginInstaller) downloadFrontendAssets(owner, repo, version, destDir string) error { - // Get release to find frontend assets - url := fmt.Sprintf("https://api.github.com/repos/%s/%s/releases/tags/%s", owner, repo, version) - resp, err := i.httpClient.Get(url) - if err != nil { - return fmt.Errorf("failed to fetch release: %w", err) - } - defer resp.Body.Close() - - var release GitHubRelease - if err := json.NewDecoder(resp.Body).Decode(&release); err != nil { - return fmt.Errorf("failed to parse release: %w", err) - } - - // Download bundle.js if present - for _, asset := range release.Assets { - if asset.Name == "bundle.js" { - log.Printf("[Installer] Downloading frontend bundle from %s", asset.BrowserDownloadURL) - if err := i.downloadFile(asset.BrowserDownloadURL, filepath.Join(destDir, "bundle.js")); err != nil { - return fmt.Errorf("failed to download JS bundle: %w", err) - } - } - // Download bundle.css if present - if asset.Name == "bundle.css" { - log.Printf("[Installer] Downloading frontend CSS from %s", asset.BrowserDownloadURL) - if err := i.downloadFile(asset.BrowserDownloadURL, filepath.Join(destDir, "bundle.css")); err != nil { - return fmt.Errorf("failed to download CSS: %w", err) - } - } - } - - return nil -} - -// downloadFile downloads a file from a URL -func (i *PluginInstaller) downloadFile(url, destPath string) error { - log.Printf("[Installer] Downloading %s to %s", url, destPath) - - resp, err := i.httpClient.Get(url) - if err != nil { - return err - } - defer resp.Body.Close() - - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("HTTP %d", resp.StatusCode) - } - - file, err := os.Create(destPath) - if err != nil { - return err - } - defer file.Close() - - if _, err := io.Copy(file, resp.Body); err != nil { - return err - } - - return nil -} - -// extractTarGz extracts a .tar.gz archive -func (i *PluginInstaller) extractTarGz(archivePath, destDir string) error { - file, err := os.Open(archivePath) - if err != nil { - return err - } - defer file.Close() - - gzr, err := gzip.NewReader(file) - if err != nil { - return err - } - defer gzr.Close() - - tr := tar.NewReader(gzr) - - for { - header, err := tr.Next() - if err == io.EOF { - break - } - if err != nil { - return err - } - - target := filepath.Join(destDir, header.Name) - - switch header.Typeflag { - case tar.TypeDir: - if err := os.MkdirAll(target, 0755); err != nil { - return err - } - case tar.TypeReg: - file, err := os.OpenFile(target, os.O_CREATE|os.O_RDWR, os.FileMode(header.Mode)) - if err != nil { - return err - } - if _, err := io.Copy(file, tr); err != nil { - file.Close() - return err - } - file.Close() - } - } - - return nil -} - -// parseGitHubURL extracts owner and repo from a GitHub URL -func parseGitHubURL(url string) (owner, repo string, err error) { - // Handle various GitHub URL formats: - // https://github.com/owner/repo - // https://github.com/owner/repo.git - // github.com/owner/repo - - url = strings.TrimPrefix(url, "https://") - url = strings.TrimPrefix(url, "http://") - url = strings.TrimPrefix(url, "www.") - url = strings.TrimSuffix(url, ".git") - url = strings.TrimSuffix(url, "/") - - parts := strings.Split(url, "/") - if len(parts) < 3 || parts[0] != "github.com" { - return "", "", fmt.Errorf("invalid GitHub URL format") - } - - return parts[1], parts[2], nil -} diff --git a/internal/plugins/external/permissions.go b/internal/plugins/external/permissions.go deleted file mode 100644 index 99aca64..0000000 --- a/internal/plugins/external/permissions.go +++ /dev/null @@ -1,122 +0,0 @@ -package external - -import ( - "fmt" - "strings" -) - -// Permission represents a plugin permission -type Permission string - -const ( - // Data access permissions - PermContainersRead Permission = "containers:read" - PermHostsRead Permission = "hosts:read" - PermStorageRead Permission = "storage:read" - PermStorageWrite Permission = "storage:write" - - // API permissions - PermAPIRoutes Permission = "api:routes" - PermAPIEvents Permission = "api:events" - - // UI permissions - PermUITab Permission = "ui:tab" - PermUIBadge Permission = "ui:badge" - PermUIEnrich Permission = "ui:enrich" -) - -// PermissionChecker validates plugin permissions -type PermissionChecker struct { - pluginID string - permissions map[Permission]bool -} - -// NewPermissionChecker creates a permission checker for a plugin -func NewPermissionChecker(pluginID string, permissions []string) *PermissionChecker { - permMap := make(map[Permission]bool) - for _, p := range permissions { - permMap[Permission(p)] = true - } - - return &PermissionChecker{ - pluginID: pluginID, - permissions: permMap, - } -} - -// Check verifies if a plugin has a specific permission -func (p *PermissionChecker) Check(permission Permission) error { - if !p.permissions[permission] { - return fmt.Errorf("plugin %s does not have permission: %s", p.pluginID, permission) - } - return nil -} - -// CheckAny verifies if a plugin has any of the specified permissions -func (p *PermissionChecker) CheckAny(permissions ...Permission) error { - for _, perm := range permissions { - if p.permissions[perm] { - return nil - } - } - return fmt.Errorf("plugin %s does not have any of the required permissions: %v", p.pluginID, permissions) -} - -// Has returns true if the plugin has the specified permission -func (p *PermissionChecker) Has(permission Permission) bool { - return p.permissions[permission] -} - -// CanAccessEndpoint checks if a plugin can access a specific API endpoint -func (p *PermissionChecker) CanAccessEndpoint(method, path string) error { - // Plugin routes require api:routes permission - if strings.HasPrefix(path, "/api/p/") { - return p.Check(PermAPIRoutes) - } - - // Census API callbacks are checked individually in the gRPC server - return nil -} - -// ValidatePermissions validates that all requested permissions are known -func ValidatePermissions(permissions []string) error { - knownPerms := map[string]bool{ - string(PermContainersRead): true, - string(PermHostsRead): true, - string(PermStorageRead): true, - string(PermStorageWrite): true, - string(PermAPIRoutes): true, - string(PermAPIEvents): true, - string(PermUITab): true, - string(PermUIBadge): true, - string(PermUIEnrich): true, - } - - for _, p := range permissions { - if !knownPerms[p] { - return fmt.Errorf("unknown permission: %s", p) - } - } - - return nil -} - -// GetPermissionDescription returns a human-readable description -func GetPermissionDescription(perm Permission) string { - descriptions := map[Permission]string{ - PermContainersRead: "Read container data from all hosts", - PermHostsRead: "Read host configuration and metadata", - PermStorageRead: "Read plugin-specific data from storage", - PermStorageWrite: "Write plugin-specific data to storage", - PermAPIRoutes: "Register custom HTTP API routes", - PermAPIEvents: "Subscribe to system events", - PermUITab: "Add a custom UI tab to the interface", - PermUIBadge: "Display badges on container cards", - PermUIEnrich: "Add custom data to container details", - } - - if desc, ok := descriptions[perm]; ok { - return desc - } - return "Unknown permission" -} diff --git a/internal/plugins/external/supervisor.go b/internal/plugins/external/supervisor.go deleted file mode 100644 index af3a453..0000000 --- a/internal/plugins/external/supervisor.go +++ /dev/null @@ -1,486 +0,0 @@ -package external - -import ( - "context" - "fmt" - "log" - "os" - "os/exec" - "sync" - "time" - - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - - pb "github.com/container-census/container-census/internal/plugins/proto" - "github.com/container-census/container-census/internal/storage" -) - -// PluginStatus represents the current state of a plugin process -type PluginStatus struct { - PluginID string - ProcessStatus string // "starting", "running", "stopping", "stopped", "failed" - HealthStatus string // "healthy", "unhealthy", "unknown" - GRPCPort int - RestartCount int - LastRestart time.Time - Error string -} - -// PluginProcess represents a running plugin process -type PluginProcess struct { - PluginID string - Cmd *exec.Cmd - GRPCClient pb.PluginClient - GRPCConn *grpc.ClientConn - GRPCPort int - Status string - HealthStatus string - RestartCount int - LastRestart time.Time - CancelFunc context.CancelFunc - StdoutLog *CircularLog - StderrLog *CircularLog -} - -// CircularLog stores recent log lines -type CircularLog struct { - mu sync.Mutex - lines []string - maxSize int - index int -} - -func NewCircularLog(maxSize int) *CircularLog { - return &CircularLog{ - lines: make([]string, 0, maxSize), - maxSize: maxSize, - } -} - -func (cl *CircularLog) Add(line string) { - cl.mu.Lock() - defer cl.mu.Unlock() - - if len(cl.lines) < cl.maxSize { - cl.lines = append(cl.lines, line) - } else { - cl.lines[cl.index] = line - cl.index = (cl.index + 1) % cl.maxSize - } -} - -func (cl *CircularLog) GetLines() []string { - cl.mu.Lock() - defer cl.mu.Unlock() - - if len(cl.lines) < cl.maxSize { - return append([]string(nil), cl.lines...) - } - - // Rotate to get chronological order - result := make([]string, len(cl.lines)) - for i := 0; i < len(cl.lines); i++ { - result[i] = cl.lines[(cl.index+i)%cl.maxSize] - } - return result -} - -// ExternalPluginSupervisor manages external plugin processes -type ExternalPluginSupervisor struct { - mu sync.RWMutex - db *storage.DB - processes map[string]*PluginProcess - censusAPIAddress string // gRPC address for Census API - censusAPIServer *grpc.Server - basePort int // Starting port for plugin gRPC servers - portCounter int - healthCheckPeriod time.Duration - maxRestarts int -} - -// NewExternalPluginSupervisor creates a new supervisor -func NewExternalPluginSupervisor(db *storage.DB, censusAPIAddress string, basePort int) *ExternalPluginSupervisor { - return &ExternalPluginSupervisor{ - db: db, - processes: make(map[string]*PluginProcess), - censusAPIAddress: censusAPIAddress, - basePort: basePort, - portCounter: 0, - healthCheckPeriod: 10 * time.Second, - maxRestarts: 3, - } -} - -// StartPlugin starts a plugin process -func (s *ExternalPluginSupervisor) StartPlugin(ctx context.Context, pluginID string) error { - s.mu.Lock() - defer s.mu.Unlock() - - // Check if already running - if proc, exists := s.processes[pluginID]; exists { - if proc.Status == "running" { - return fmt.Errorf("plugin %s is already running", pluginID) - } - // Clean up old process - s.stopPluginLocked(pluginID) - } - - // Load plugin metadata from database - plugin, err := s.db.GetExternalPlugin(pluginID) - if err != nil { - return fmt.Errorf("failed to load plugin metadata: %w", err) - } - - if plugin.BinaryPath == "" { - return fmt.Errorf("plugin binary path not set") - } - - // Allocate gRPC port - grpcPort := s.basePort + s.portCounter - s.portCounter++ - - // Create process context - procCtx, cancel := context.WithCancel(ctx) - - // Create command - cmd := exec.CommandContext(procCtx, plugin.BinaryPath) - cmd.Env = append(os.Environ(), - fmt.Sprintf("PLUGIN_ID=%s", pluginID), - fmt.Sprintf("GRPC_PORT=%d", grpcPort), - fmt.Sprintf("CENSUS_API=%s", s.censusAPIAddress), - ) - - // Create circular logs - stdoutLog := NewCircularLog(100) - stderrLog := NewCircularLog(100) - - // Capture stdout/stderr - stdout, err := cmd.StdoutPipe() - if err != nil { - cancel() - return fmt.Errorf("failed to create stdout pipe: %w", err) - } - - stderr, err := cmd.StderrPipe() - if err != nil { - cancel() - return fmt.Errorf("failed to create stderr pipe: %w", err) - } - - // Start process - if err := cmd.Start(); err != nil { - cancel() - return fmt.Errorf("failed to start plugin process: %w", err) - } - - // Create process record - process := &PluginProcess{ - PluginID: pluginID, - Cmd: cmd, - GRPCPort: grpcPort, - Status: "starting", - HealthStatus: "unknown", - RestartCount: 0, - CancelFunc: cancel, - StdoutLog: stdoutLog, - StderrLog: stderrLog, - } - - s.processes[pluginID] = process - - log.Printf("[Supervisor] Started plugin %s on port %d (PID: %d)", pluginID, grpcPort, cmd.Process.Pid) - - // Start log readers - go s.readLogLines(pluginID, stdout, stdoutLog, "stdout") - go s.readLogLines(pluginID, stderr, stderrLog, "stderr") - - // Wait for gRPC server to be ready - go s.waitForGRPCReady(procCtx, pluginID, grpcPort) - - // Start monitoring - go s.monitorProcess(procCtx, pluginID) - - return nil -} - -// waitForGRPCReady waits for the plugin's gRPC server to be ready -func (s *ExternalPluginSupervisor) waitForGRPCReady(ctx context.Context, pluginID string, port int) { - timeout := 30 * time.Second - deadline := time.Now().Add(timeout) - - for time.Now().Before(deadline) { - select { - case <-ctx.Done(): - return - default: - } - - // Try to connect - conn, err := grpc.NewClient( - fmt.Sprintf("localhost:%d", port), - grpc.WithTransportCredentials(insecure.NewCredentials()), - ) - if err != nil { - time.Sleep(500 * time.Millisecond) - continue - } - - client := pb.NewPluginClient(conn) - - // Try Init RPC - initReq := &pb.InitRequest{ - PluginId: pluginID, - CensusApiAddress: s.censusAPIAddress, - CensusVersion: "1.0.0", // TODO: Get from version package - } - - ctx, cancel := context.WithTimeout(ctx, 5*time.Second) - resp, err := client.Init(ctx, initReq) - cancel() - - if err == nil && resp.Success { - s.mu.Lock() - if proc, exists := s.processes[pluginID]; exists { - proc.GRPCClient = client - proc.GRPCConn = conn - proc.Status = "running" - proc.HealthStatus = "healthy" - } - s.mu.Unlock() - - log.Printf("[Supervisor] Plugin %s initialized successfully", pluginID) - return - } - - conn.Close() - time.Sleep(500 * time.Millisecond) - } - - // Timeout - log.Printf("[Supervisor] Plugin %s failed to initialize within %v", pluginID, timeout) - s.mu.Lock() - if proc, exists := s.processes[pluginID]; exists { - proc.Status = "failed" - proc.HealthStatus = "unhealthy" - } - s.mu.Unlock() -} - -// readLogLines reads log lines from reader -func (s *ExternalPluginSupervisor) readLogLines(pluginID string, reader interface{}, log *CircularLog, stream string) { - // Implementation would use bufio.Scanner to read lines - // For brevity, simplified here -} - -// monitorProcess monitors plugin health and handles restarts -func (s *ExternalPluginSupervisor) monitorProcess(ctx context.Context, pluginID string) { - ticker := time.NewTicker(s.healthCheckPeriod) - defer ticker.Stop() - - for { - select { - case <-ctx.Done(): - return - case <-ticker.C: - s.performHealthCheck(ctx, pluginID) - } - } -} - -// performHealthCheck checks plugin health -func (s *ExternalPluginSupervisor) performHealthCheck(ctx context.Context, pluginID string) { - s.mu.RLock() - proc, exists := s.processes[pluginID] - s.mu.RUnlock() - - if !exists || proc.Status != "running" { - return - } - - // Check if process is still alive - if proc.Cmd.ProcessState != nil && proc.Cmd.ProcessState.Exited() { - log.Printf("[Supervisor] Plugin %s process exited unexpectedly", pluginID) - s.handleProcessFailure(ctx, pluginID) - return - } - - // Perform gRPC healthcheck - if proc.GRPCClient != nil { - ctx, cancel := context.WithTimeout(ctx, 5*time.Second) - defer cancel() - - resp, err := proc.GRPCClient.Healthcheck(ctx, &pb.HealthcheckRequest{ - PluginId: pluginID, - }) - - s.mu.Lock() - if err != nil || !resp.Healthy { - proc.HealthStatus = "unhealthy" - log.Printf("[Supervisor] Plugin %s health check failed: %v", pluginID, err) - } else { - proc.HealthStatus = "healthy" - } - s.mu.Unlock() - } -} - -// handleProcessFailure handles plugin process failures -func (s *ExternalPluginSupervisor) handleProcessFailure(ctx context.Context, pluginID string) { - s.mu.Lock() - proc, exists := s.processes[pluginID] - if !exists { - s.mu.Unlock() - return - } - - proc.Status = "failed" - proc.RestartCount++ - proc.LastRestart = time.Now() - - shouldRestart := proc.RestartCount <= s.maxRestarts - s.mu.Unlock() - - if shouldRestart { - log.Printf("[Supervisor] Attempting to restart plugin %s (attempt %d/%d)", - pluginID, proc.RestartCount, s.maxRestarts) - - // Wait before restart - time.Sleep(2 * time.Second) - - // Restart - if err := s.StartPlugin(ctx, pluginID); err != nil { - log.Printf("[Supervisor] Failed to restart plugin %s: %v", pluginID, err) - } - } else { - log.Printf("[Supervisor] Plugin %s exceeded max restart attempts (%d), giving up", - pluginID, s.maxRestarts) - - // Disable plugin in database - if err := s.db.SetPluginEnabled(pluginID, false); err != nil { - log.Printf("[Supervisor] Failed to disable plugin %s: %v", pluginID, err) - } - } -} - -// StopPlugin gracefully stops a plugin -func (s *ExternalPluginSupervisor) StopPlugin(pluginID string) error { - s.mu.Lock() - defer s.mu.Unlock() - return s.stopPluginLocked(pluginID) -} - -func (s *ExternalPluginSupervisor) stopPluginLocked(pluginID string) error { - proc, exists := s.processes[pluginID] - if !exists { - return fmt.Errorf("plugin %s is not running", pluginID) - } - - log.Printf("[Supervisor] Stopping plugin %s", pluginID) - proc.Status = "stopping" - - // Call Stop RPC if available - if proc.GRPCClient != nil { - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) - defer cancel() - - proc.GRPCClient.Stop(ctx, &pb.StopRequest{PluginId: pluginID}) - } - - // Close gRPC connection - if proc.GRPCConn != nil { - proc.GRPCConn.Close() - } - - // Cancel context to stop monitors - if proc.CancelFunc != nil { - proc.CancelFunc() - } - - // Kill process if still running - if proc.Cmd.Process != nil && proc.Cmd.ProcessState == nil { - proc.Cmd.Process.Kill() - } - - proc.Status = "stopped" - delete(s.processes, pluginID) - - log.Printf("[Supervisor] Plugin %s stopped", pluginID) - return nil -} - -// RestartPlugin restarts a plugin -func (s *ExternalPluginSupervisor) RestartPlugin(ctx context.Context, pluginID string) error { - if err := s.StopPlugin(pluginID); err != nil { - log.Printf("[Supervisor] Error stopping plugin %s for restart: %v", pluginID, err) - } - - time.Sleep(1 * time.Second) - return s.StartPlugin(ctx, pluginID) -} - -// GetPluginStatus returns the status of a plugin -func (s *ExternalPluginSupervisor) GetPluginStatus(pluginID string) (PluginStatus, error) { - s.mu.RLock() - defer s.mu.RUnlock() - - proc, exists := s.processes[pluginID] - if !exists { - return PluginStatus{ - PluginID: pluginID, - ProcessStatus: "stopped", - HealthStatus: "unknown", - }, nil - } - - return PluginStatus{ - PluginID: proc.PluginID, - ProcessStatus: proc.Status, - HealthStatus: proc.HealthStatus, - GRPCPort: proc.GRPCPort, - RestartCount: proc.RestartCount, - LastRestart: proc.LastRestart, - }, nil -} - -// GetPluginLogs returns recent log lines -func (s *ExternalPluginSupervisor) GetPluginLogs(pluginID string) (stdout, stderr []string, err error) { - s.mu.RLock() - defer s.mu.RUnlock() - - proc, exists := s.processes[pluginID] - if !exists { - return nil, nil, fmt.Errorf("plugin %s is not running", pluginID) - } - - return proc.StdoutLog.GetLines(), proc.StderrLog.GetLines(), nil -} - -// GetGRPCClient returns the gRPC client for a plugin -func (s *ExternalPluginSupervisor) GetGRPCClient(pluginID string) (pb.PluginClient, error) { - s.mu.RLock() - defer s.mu.RUnlock() - - proc, exists := s.processes[pluginID] - if !exists { - return nil, fmt.Errorf("plugin %s is not running", pluginID) - } - - if proc.GRPCClient == nil { - return nil, fmt.Errorf("plugin %s gRPC client not ready", pluginID) - } - - return proc.GRPCClient, nil -} - -// StopAll stops all running plugins -func (s *ExternalPluginSupervisor) StopAll() { - s.mu.Lock() - defer s.mu.Unlock() - - log.Printf("[Supervisor] Stopping all plugins...") - - for pluginID := range s.processes { - s.stopPluginLocked(pluginID) - } -} diff --git a/internal/plugins/manager.go b/internal/plugins/manager.go index fc0faa1..bb740d8 100644 --- a/internal/plugins/manager.go +++ b/internal/plugins/manager.go @@ -4,18 +4,14 @@ import ( "context" "encoding/json" "fmt" - "io" "log" "net/http" - "os" "sort" "strconv" "sync" "time" "github.com/container-census/container-census/internal/models" - "github.com/container-census/container-census/internal/plugins/external" - pb "github.com/container-census/container-census/internal/plugins/proto" "github.com/container-census/container-census/internal/storage" "github.com/gorilla/mux" ) @@ -32,12 +28,6 @@ type Manager struct { eventBus *EventBusImpl router *mux.Router started bool - - // External plugin support - installer *external.PluginInstaller - supervisor *external.ExternalPluginSupervisor - censusAPIServer *external.CensusAPIServer - pluginsDir string } // PluginFactory creates a new plugin instance @@ -45,15 +35,6 @@ type PluginFactory func() Plugin // NewManager creates a new plugin manager func NewManager(db *storage.DB, containers ContainerProvider, hosts HostProvider) *Manager { - // Default to /app/data/plugins, but use ./data/plugins for local development - pluginsDir := "/app/data/plugins" - if dataDir := os.Getenv("DATA_DIR"); dataDir != "" { - pluginsDir = dataDir + "/plugins" - } else if _, err := os.Stat("/app/data"); os.IsNotExist(err) { - // Running locally, not in Docker container - pluginsDir = "./data/plugins" - } - return &Manager{ plugins: make(map[string]Plugin), pluginOrder: make([]string, 0), @@ -62,12 +43,6 @@ func NewManager(db *storage.DB, containers ContainerProvider, hosts HostProvider containers: containers, hosts: hosts, eventBus: NewEventBus(), - - // External plugin infrastructure - installer: external.NewPluginInstaller(db, pluginsDir), - supervisor: external.NewExternalPluginSupervisor(db, "localhost:50052", 50100), - censusAPIServer: external.NewCensusAPIServer(db), - pluginsDir: pluginsDir, } } @@ -78,13 +53,6 @@ func (m *Manager) SetRouter(router *mux.Router) { m.router = router } -// GetCensusAPIServer returns the Census API server for plugin callbacks -func (m *Manager) GetCensusAPIServer() *external.CensusAPIServer { - m.mu.RLock() - defer m.mu.RUnlock() - return m.censusAPIServer -} - // RegisterBuiltIn registers a built-in plugin factory func (m *Manager) RegisterBuiltIn(id string, factory PluginFactory) { m.mu.Lock() @@ -120,68 +88,6 @@ func (m *Manager) LoadBuiltInPlugins(ctx context.Context) error { return nil } -// LoadExternalPlugins loads and starts all enabled external plugins from database -func (m *Manager) LoadExternalPlugins(ctx context.Context) error { - // Get all plugin records from database - records, err := m.db.GetAllPlugins() - if err != nil { - return fmt.Errorf("failed to get plugins from database: %w", err) - } - - // Filter for enabled external plugins - for _, record := range records { - // Skip built-in plugins (they're loaded via LoadBuiltInPlugins) - if record.SourceType == "built_in" { - continue - } - - // Skip disabled plugins - if !record.Enabled { - log.Printf("Skipping disabled external plugin: %s", record.ID) - continue - } - - // Start the external plugin - log.Printf("Loading external plugin: %s v%s", record.Name, record.Version) - if err := m.StartExternalPlugin(ctx, record.ID); err != nil { - log.Printf("Failed to start external plugin %s: %v", record.ID, err) - continue - } - - // Mount routes for the plugin with retry (gRPC client needs time to connect) - mounted := false - for attempt := 1; attempt <= 5; attempt++ { - if attempt > 1 { - time.Sleep(time.Duration(attempt) * 500 * time.Millisecond) - } - if err := m.MountPluginRoutes(record.ID); err != nil { - if attempt < 5 { - log.Printf("[PluginManager] Attempt %d/5: Failed to mount routes for %s, retrying...", attempt, record.ID) - continue - } - log.Printf("Failed to mount routes for plugin %s after 5 attempts: %v", record.ID, err) - } else { - mounted = true - break - } - } - - if !mounted { - log.Printf("Warning: Plugin %s started but routes not mounted", record.ID) - } else { - // Fetch and save tab configuration after successful route mounting - if err := m.FetchAndSaveTabConfig(ctx, record.ID); err != nil { - log.Printf("Warning: Failed to fetch tab config for %s: %v", record.ID, err) - // Continue anyway - tab can be fetched later if needed - } - } - - log.Printf("Loaded external plugin: %s v%s", record.Name, record.Version) - } - - return nil -} - // loadPlugin initializes and registers a plugin func (m *Manager) loadPlugin(ctx context.Context, plugin Plugin) error { info := plugin.Info() @@ -630,296 +536,3 @@ func (s *scopedPluginDB) SetSetting(key string, value string) error { func (s *scopedPluginDB) GetAllSettings() (map[string]string, error) { return s.db.GetAllPluginSettings(s.pluginID) } -// External Plugin Management Methods - -// InstallExternalPlugin installs a plugin from a GitHub repository URL -func (m *Manager) InstallExternalPlugin(ctx context.Context, repoURL, version string) error { - log.Printf("[PluginManager] Installing external plugin from %s", repoURL) - - // Install the plugin files and save to database - if err := m.installer.Install(ctx, repoURL, version); err != nil { - return err - } - - // Get the plugin ID from the installer - // The plugin ID is extracted during install, we need to get the plugin record - plugins, err := m.db.GetAllPlugins() - if err != nil { - return fmt.Errorf("failed to get plugins after install: %w", err) - } - - // Find the newly installed plugin (it will be enabled and from the repo URL) - var pluginID string - for _, p := range plugins { - if p.SourceURL == repoURL && p.Enabled { - pluginID = p.ID - break - } - } - - if pluginID == "" { - return fmt.Errorf("could not find installed plugin from %s", repoURL) - } - - log.Printf("[PluginManager] Starting installed plugin %s", pluginID) - - // Start the plugin process - if err := m.StartExternalPlugin(ctx, pluginID); err != nil { - log.Printf("[PluginManager] Failed to start plugin %s: %v", pluginID, err) - return fmt.Errorf("plugin installed but failed to start: %w", err) - } - - // Mount routes with retry - mounted := false - for attempt := 1; attempt <= 5; attempt++ { - if attempt > 1 { - time.Sleep(time.Duration(attempt) * 500 * time.Millisecond) - } - if err := m.MountPluginRoutes(pluginID); err != nil { - if attempt < 5 { - log.Printf("[PluginManager] Attempt %d/5: Failed to mount routes for %s, retrying...", attempt, pluginID) - continue - } - log.Printf("Failed to mount routes for plugin %s after 5 attempts: %v", pluginID, err) - } else { - mounted = true - break - } - } - - if mounted { - // Fetch and save tab configuration - if err := m.FetchAndSaveTabConfig(ctx, pluginID); err != nil { - log.Printf("Warning: Failed to fetch tab config for %s: %v", pluginID, err) - } - } - - return nil -} - -// UpdateExternalPlugin updates an external plugin to the latest version -func (m *Manager) UpdateExternalPlugin(ctx context.Context, pluginID string) error { - log.Printf("[PluginManager] Updating external plugin %s", pluginID) - return m.installer.Update(ctx, pluginID) -} - -// UninstallExternalPlugin removes an external plugin -func (m *Manager) UninstallExternalPlugin(pluginID string) error { - log.Printf("[PluginManager] Uninstalling external plugin %s", pluginID) - - // Stop plugin process if running - if err := m.supervisor.StopPlugin(pluginID); err != nil { - log.Printf("[PluginManager] Warning: failed to stop plugin %s: %v", pluginID, err) - } - - // Unregister from Census API - m.censusAPIServer.UnregisterPlugin(pluginID) - - // Remove plugin files and database record - return m.installer.Uninstall(pluginID) -} - -// GetExternalPluginLogs returns recent log output from a plugin process -func (m *Manager) GetExternalPluginLogs(pluginID string) (stdout, stderr []string, err error) { - return m.supervisor.GetPluginLogs(pluginID) -} - -// GetExternalPluginStatus returns the runtime status of an external plugin -func (m *Manager) GetExternalPluginStatus(pluginID string) (external.PluginStatus, error) { - return m.supervisor.GetPluginStatus(pluginID) -} - -// StartExternalPlugin starts an external plugin process -func (m *Manager) StartExternalPlugin(ctx context.Context, pluginID string) error { - log.Printf("[PluginManager] Starting external plugin %s", pluginID) - - // Get plugin metadata - plugin, err := m.db.GetExternalPlugin(pluginID) - if err != nil { - return fmt.Errorf("failed to get plugin metadata: %w", err) - } - - // Register permissions with Census API - if err := m.censusAPIServer.RegisterPlugin(pluginID, plugin.Permissions); err != nil { - return fmt.Errorf("failed to register plugin permissions: %w", err) - } - - // Start plugin process - if err := m.supervisor.StartPlugin(ctx, pluginID); err != nil { - m.censusAPIServer.UnregisterPlugin(pluginID) - return fmt.Errorf("failed to start plugin process: %w", err) - } - - return nil -} - -// StopExternalPlugin stops an external plugin process -func (m *Manager) StopExternalPlugin(pluginID string) error { - log.Printf("[PluginManager] Stopping external plugin %s", pluginID) - - // Stop plugin process - if err := m.supervisor.StopPlugin(pluginID); err != nil { - return err - } - - // Unregister from Census API - m.censusAPIServer.UnregisterPlugin(pluginID) - - return nil -} - -// FetchAndSaveTabConfig retrieves tab configuration from a plugin via gRPC and saves it to the database -func (m *Manager) FetchAndSaveTabConfig(ctx context.Context, pluginID string) error { - log.Printf("[PluginManager] Fetching tab config for plugin %s", pluginID) - - // Get the gRPC client from supervisor - client, err := m.supervisor.GetGRPCClient(pluginID) - if err != nil { - return fmt.Errorf("failed to get plugin gRPC client: %w", err) - } - - // Call GetTab via gRPC with timeout - ctx, cancel := context.WithTimeout(ctx, 10*time.Second) - defer cancel() - - resp, err := client.GetTab(ctx, &pb.TabRequest{ - PluginId: pluginID, - }) - - if err != nil { - return fmt.Errorf("failed to call GetTab: %w", err) - } - - // If plugin doesn't have a tab, skip - if !resp.HasTab { - log.Printf("[PluginManager] Plugin %s does not provide a tab", pluginID) - return nil - } - - // Create TabDefinition structure - tabDef := TabDefinition{ - ID: resp.Id, - Label: resp.Label, - Icon: resp.Icon, - Order: int(resp.Order), - ScriptURL: resp.ScriptUrl, - InitFunc: resp.InitFunc, - } - - // Get existing plugin record - plugin, err := m.db.GetExternalPlugin(pluginID) - if err != nil { - return fmt.Errorf("failed to get plugin record: %w", err) - } - - // Update tab_config field as map[string]string - plugin.TabConfig = map[string]string{ - "id": tabDef.ID, - "label": tabDef.Label, - "icon": tabDef.Icon, - "order": fmt.Sprintf("%d", tabDef.Order), - "script_url": tabDef.ScriptURL, - "init_func": tabDef.InitFunc, - } - - // Save back to database - if err := m.db.SaveExternalPlugin(plugin); err != nil { - return fmt.Errorf("failed to save tab config: %w", err) - } - - log.Printf("[PluginManager] Successfully saved tab config for %s: %s", pluginID, tabDef.Label) - return nil -} - -// MountPluginRoutes dynamically mounts routes for an external plugin -func (m *Manager) MountPluginRoutes(pluginID string) error { - m.mu.Lock() - defer m.mu.Unlock() - - if m.router == nil { - return fmt.Errorf("router not set") - } - - // Get gRPC client for the plugin - client, err := m.supervisor.GetGRPCClient(pluginID) - if err != nil { - return fmt.Errorf("failed to get plugin gRPC client: %w", err) - } - - // Create a subrouter for this plugin under /api/p/{pluginID}/* - pluginPath := fmt.Sprintf("/p/%s", pluginID) - pluginRouter := m.router.PathPrefix(pluginPath).Subrouter() - - // Mount a catch-all handler that forwards requests to the plugin via gRPC - pluginRouter.PathPrefix("/").HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - m.handlePluginRoute(w, r, pluginID, client) - }) - - log.Printf("[PluginManager] Mounted routes for plugin %s at /api%s", pluginID, pluginPath) - return nil -} - -// handlePluginRoute forwards HTTP requests to an external plugin via gRPC -func (m *Manager) handlePluginRoute(w http.ResponseWriter, r *http.Request, pluginID string, client pb.PluginClient) { - // Extract path after /api/p/{pluginID}/ - pathPrefix := fmt.Sprintf("/api/p/%s/", pluginID) - pluginPath := r.URL.Path - if len(pluginPath) >= len(pathPrefix) { - pluginPath = pluginPath[len(pathPrefix)-1:] // Keep the leading slash - } - - // Read request body - body, err := io.ReadAll(r.Body) - if err != nil { - http.Error(w, "Failed to read request body", http.StatusInternalServerError) - return - } - - // Convert headers to map - headers := make(map[string]string) - for key, values := range r.Header { - if len(values) > 0 { - headers[key] = values[0] - } - } - - // Convert query parameters to map - queryParams := make(map[string]string) - for key, values := range r.URL.Query() { - if len(values) > 0 { - queryParams[key] = values[0] - } - } - - // Call plugin via gRPC - ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) - defer cancel() - - resp, err := client.HandleRoute(ctx, &pb.RouteRequest{ - PluginId: pluginID, - Method: r.Method, - Path: pluginPath, - Headers: headers, - Body: body, - QueryParams: queryParams, - }) - - if err != nil { - log.Printf("[PluginManager] Plugin %s route handler error: %v", pluginID, err) - http.Error(w, "Plugin error", http.StatusInternalServerError) - return - } - - // Set response headers - for key, value := range resp.Headers { - w.Header().Set(key, value) - } - - // Set status code - w.WriteHeader(int(resp.StatusCode)) - - // Write response body - if len(resp.Body) > 0 { - w.Write(resp.Body) - } -} diff --git a/internal/plugins/proto/plugin.pb.go b/internal/plugins/proto/plugin.pb.go deleted file mode 100644 index 586778c..0000000 --- a/internal/plugins/proto/plugin.pb.go +++ /dev/null @@ -1,3339 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v5.29.3 -// source: internal/plugins/proto/plugin.proto - -package proto - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Init - Called when plugin is first loaded -type InitRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - Config map[string]string `protobuf:"bytes,2,rep,name=config,proto3" json:"config,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - CensusApiAddress string `protobuf:"bytes,3,opt,name=census_api_address,json=censusApiAddress,proto3" json:"census_api_address,omitempty"` // gRPC address for callbacks (e.g., "localhost:50052") - CensusVersion string `protobuf:"bytes,4,opt,name=census_version,json=censusVersion,proto3" json:"census_version,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *InitRequest) Reset() { - *x = InitRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *InitRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InitRequest) ProtoMessage() {} - -func (x *InitRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InitRequest.ProtoReflect.Descriptor instead. -func (*InitRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{0} -} - -func (x *InitRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -func (x *InitRequest) GetConfig() map[string]string { - if x != nil { - return x.Config - } - return nil -} - -func (x *InitRequest) GetCensusApiAddress() string { - if x != nil { - return x.CensusApiAddress - } - return "" -} - -func (x *InitRequest) GetCensusVersion() string { - if x != nil { - return x.CensusVersion - } - return "" -} - -type InitResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *InitResponse) Reset() { - *x = InitResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *InitResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InitResponse) ProtoMessage() {} - -func (x *InitResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InitResponse.ProtoReflect.Descriptor instead. -func (*InitResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{1} -} - -func (x *InitResponse) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -func (x *InitResponse) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -// Start - Called to start plugin operations -type StartRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StartRequest) Reset() { - *x = StartRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StartRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StartRequest) ProtoMessage() {} - -func (x *StartRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StartRequest.ProtoReflect.Descriptor instead. -func (*StartRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{2} -} - -func (x *StartRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -type StartResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StartResponse) Reset() { - *x = StartResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StartResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StartResponse) ProtoMessage() {} - -func (x *StartResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StartResponse.ProtoReflect.Descriptor instead. -func (*StartResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{3} -} - -func (x *StartResponse) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -func (x *StartResponse) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -// Stop - Called to gracefully stop plugin -type StopRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StopRequest) Reset() { - *x = StopRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StopRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StopRequest) ProtoMessage() {} - -func (x *StopRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StopRequest.ProtoReflect.Descriptor instead. -func (*StopRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{4} -} - -func (x *StopRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -type StopResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StopResponse) Reset() { - *x = StopResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StopResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StopResponse) ProtoMessage() {} - -func (x *StopResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StopResponse.ProtoReflect.Descriptor instead. -func (*StopResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{5} -} - -func (x *StopResponse) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -// Healthcheck - Called periodically to verify plugin is alive -type HealthcheckRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *HealthcheckRequest) Reset() { - *x = HealthcheckRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HealthcheckRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthcheckRequest) ProtoMessage() {} - -func (x *HealthcheckRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthcheckRequest.ProtoReflect.Descriptor instead. -func (*HealthcheckRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{6} -} - -func (x *HealthcheckRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -type HealthcheckResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Healthy bool `protobuf:"varint,1,opt,name=healthy,proto3" json:"healthy,omitempty"` - Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` // "running", "degraded", "failed" - Metrics map[string]string `protobuf:"bytes,3,rep,name=metrics,proto3" json:"metrics,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` // Optional metrics - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *HealthcheckResponse) Reset() { - *x = HealthcheckResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HealthcheckResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthcheckResponse) ProtoMessage() {} - -func (x *HealthcheckResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthcheckResponse.ProtoReflect.Descriptor instead. -func (*HealthcheckResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{7} -} - -func (x *HealthcheckResponse) GetHealthy() bool { - if x != nil { - return x.Healthy - } - return false -} - -func (x *HealthcheckResponse) GetStatus() string { - if x != nil { - return x.Status - } - return "" -} - -func (x *HealthcheckResponse) GetMetrics() map[string]string { - if x != nil { - return x.Metrics - } - return nil -} - -// GetInfo - Returns plugin metadata -type InfoRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *InfoRequest) Reset() { - *x = InfoRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *InfoRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InfoRequest) ProtoMessage() {} - -func (x *InfoRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InfoRequest.ProtoReflect.Descriptor instead. -func (*InfoRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{8} -} - -func (x *InfoRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -type InfoResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` - Author string `protobuf:"bytes,5,opt,name=author,proto3" json:"author,omitempty"` - Homepage string `protobuf:"bytes,6,opt,name=homepage,proto3" json:"homepage,omitempty"` - Capabilities []string `protobuf:"bytes,7,rep,name=capabilities,proto3" json:"capabilities,omitempty"` // "ui_tab", "ui_badge", "container_enrichment", etc. - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *InfoResponse) Reset() { - *x = InfoResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *InfoResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InfoResponse) ProtoMessage() {} - -func (x *InfoResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InfoResponse.ProtoReflect.Descriptor instead. -func (*InfoResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{9} -} - -func (x *InfoResponse) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *InfoResponse) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *InfoResponse) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *InfoResponse) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *InfoResponse) GetAuthor() string { - if x != nil { - return x.Author - } - return "" -} - -func (x *InfoResponse) GetHomepage() string { - if x != nil { - return x.Homepage - } - return "" -} - -func (x *InfoResponse) GetCapabilities() []string { - if x != nil { - return x.Capabilities - } - return nil -} - -// GetTab - Returns UI tab configuration -type TabRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *TabRequest) Reset() { - *x = TabRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *TabRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TabRequest) ProtoMessage() {} - -func (x *TabRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[10] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TabRequest.ProtoReflect.Descriptor instead. -func (*TabRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{10} -} - -func (x *TabRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -type TabResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - HasTab bool `protobuf:"varint,1,opt,name=has_tab,json=hasTab,proto3" json:"has_tab,omitempty"` - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` - Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"` - Icon string `protobuf:"bytes,4,opt,name=icon,proto3" json:"icon,omitempty"` - Order int32 `protobuf:"varint,5,opt,name=order,proto3" json:"order,omitempty"` - ScriptUrl string `protobuf:"bytes,6,opt,name=script_url,json=scriptUrl,proto3" json:"script_url,omitempty"` // URL to frontend bundle - CssUrl string `protobuf:"bytes,7,opt,name=css_url,json=cssUrl,proto3" json:"css_url,omitempty"` // URL to frontend CSS - InitFunc string `protobuf:"bytes,8,opt,name=init_func,json=initFunc,proto3" json:"init_func,omitempty"` // JavaScript function name to call - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *TabResponse) Reset() { - *x = TabResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *TabResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TabResponse) ProtoMessage() {} - -func (x *TabResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[11] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TabResponse.ProtoReflect.Descriptor instead. -func (*TabResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{11} -} - -func (x *TabResponse) GetHasTab() bool { - if x != nil { - return x.HasTab - } - return false -} - -func (x *TabResponse) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *TabResponse) GetLabel() string { - if x != nil { - return x.Label - } - return "" -} - -func (x *TabResponse) GetIcon() string { - if x != nil { - return x.Icon - } - return "" -} - -func (x *TabResponse) GetOrder() int32 { - if x != nil { - return x.Order - } - return 0 -} - -func (x *TabResponse) GetScriptUrl() string { - if x != nil { - return x.ScriptUrl - } - return "" -} - -func (x *TabResponse) GetCssUrl() string { - if x != nil { - return x.CssUrl - } - return "" -} - -func (x *TabResponse) GetInitFunc() string { - if x != nil { - return x.InitFunc - } - return "" -} - -// GetBadges - Returns badges to display on container cards -type BadgesRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - Container *Container `protobuf:"bytes,2,opt,name=container,proto3" json:"container,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *BadgesRequest) Reset() { - *x = BadgesRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *BadgesRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BadgesRequest) ProtoMessage() {} - -func (x *BadgesRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[12] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BadgesRequest.ProtoReflect.Descriptor instead. -func (*BadgesRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{12} -} - -func (x *BadgesRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -func (x *BadgesRequest) GetContainer() *Container { - if x != nil { - return x.Container - } - return nil -} - -type BadgesResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Badges []*Badge `protobuf:"bytes,1,rep,name=badges,proto3" json:"badges,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *BadgesResponse) Reset() { - *x = BadgesResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *BadgesResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BadgesResponse) ProtoMessage() {} - -func (x *BadgesResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[13] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BadgesResponse.ProtoReflect.Descriptor instead. -func (*BadgesResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{13} -} - -func (x *BadgesResponse) GetBadges() []*Badge { - if x != nil { - return x.Badges - } - return nil -} - -type Badge struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"` - Icon string `protobuf:"bytes,3,opt,name=icon,proto3" json:"icon,omitempty"` - Color string `protobuf:"bytes,4,opt,name=color,proto3" json:"color,omitempty"` - Tooltip string `protobuf:"bytes,5,opt,name=tooltip,proto3" json:"tooltip,omitempty"` - Link string `protobuf:"bytes,6,opt,name=link,proto3" json:"link,omitempty"` - Priority int32 `protobuf:"varint,7,opt,name=priority,proto3" json:"priority,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Badge) Reset() { - *x = Badge{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Badge) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Badge) ProtoMessage() {} - -func (x *Badge) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[14] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Badge.ProtoReflect.Descriptor instead. -func (*Badge) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{14} -} - -func (x *Badge) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *Badge) GetLabel() string { - if x != nil { - return x.Label - } - return "" -} - -func (x *Badge) GetIcon() string { - if x != nil { - return x.Icon - } - return "" -} - -func (x *Badge) GetColor() string { - if x != nil { - return x.Color - } - return "" -} - -func (x *Badge) GetTooltip() string { - if x != nil { - return x.Tooltip - } - return "" -} - -func (x *Badge) GetLink() string { - if x != nil { - return x.Link - } - return "" -} - -func (x *Badge) GetPriority() int32 { - if x != nil { - return x.Priority - } - return 0 -} - -// HandleRoute - Handles HTTP requests to plugin routes -type RouteRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` // GET, POST, PUT, DELETE, etc. - Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"` // Path after /api/p/{plugin-id}/ - Headers map[string]string `protobuf:"bytes,4,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - Body []byte `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"` - QueryParams map[string]string `protobuf:"bytes,6,rep,name=query_params,json=queryParams,proto3" json:"query_params,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - PathParams map[string]string `protobuf:"bytes,7,rep,name=path_params,json=pathParams,proto3" json:"path_params,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RouteRequest) Reset() { - *x = RouteRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RouteRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteRequest) ProtoMessage() {} - -func (x *RouteRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[15] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteRequest.ProtoReflect.Descriptor instead. -func (*RouteRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{15} -} - -func (x *RouteRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -func (x *RouteRequest) GetMethod() string { - if x != nil { - return x.Method - } - return "" -} - -func (x *RouteRequest) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -func (x *RouteRequest) GetHeaders() map[string]string { - if x != nil { - return x.Headers - } - return nil -} - -func (x *RouteRequest) GetBody() []byte { - if x != nil { - return x.Body - } - return nil -} - -func (x *RouteRequest) GetQueryParams() map[string]string { - if x != nil { - return x.QueryParams - } - return nil -} - -func (x *RouteRequest) GetPathParams() map[string]string { - if x != nil { - return x.PathParams - } - return nil -} - -type RouteResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - StatusCode int32 `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"` - Headers map[string]string `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RouteResponse) Reset() { - *x = RouteResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RouteResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteResponse) ProtoMessage() {} - -func (x *RouteResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[16] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteResponse.ProtoReflect.Descriptor instead. -func (*RouteResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{16} -} - -func (x *RouteResponse) GetStatusCode() int32 { - if x != nil { - return x.StatusCode - } - return 0 -} - -func (x *RouteResponse) GetHeaders() map[string]string { - if x != nil { - return x.Headers - } - return nil -} - -func (x *RouteResponse) GetBody() []byte { - if x != nil { - return x.Body - } - return nil -} - -// EnrichContainer - Adds custom data to containers -type EnrichRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - Container *Container `protobuf:"bytes,2,opt,name=container,proto3" json:"container,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *EnrichRequest) Reset() { - *x = EnrichRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *EnrichRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EnrichRequest) ProtoMessage() {} - -func (x *EnrichRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[17] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EnrichRequest.ProtoReflect.Descriptor instead. -func (*EnrichRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{17} -} - -func (x *EnrichRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -func (x *EnrichRequest) GetContainer() *Container { - if x != nil { - return x.Container - } - return nil -} - -type EnrichResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginData map[string]string `protobuf:"bytes,1,rep,name=plugin_data,json=pluginData,proto3" json:"plugin_data,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` // Data to add to container.plugin_data - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *EnrichResponse) Reset() { - *x = EnrichResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *EnrichResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EnrichResponse) ProtoMessage() {} - -func (x *EnrichResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[18] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EnrichResponse.ProtoReflect.Descriptor instead. -func (*EnrichResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{18} -} - -func (x *EnrichResponse) GetPluginData() map[string]string { - if x != nil { - return x.PluginData - } - return nil -} - -// HandleEvent - Receives system events -type EventRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - EventType string `protobuf:"bytes,2,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` // "scan_complete", "container_state_change", "image_updated", etc. - Timestamp string `protobuf:"bytes,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Data map[string]string `protobuf:"bytes,4,rep,name=data,proto3" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *EventRequest) Reset() { - *x = EventRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *EventRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EventRequest) ProtoMessage() {} - -func (x *EventRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[19] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EventRequest.ProtoReflect.Descriptor instead. -func (*EventRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{19} -} - -func (x *EventRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -func (x *EventRequest) GetEventType() string { - if x != nil { - return x.EventType - } - return "" -} - -func (x *EventRequest) GetTimestamp() string { - if x != nil { - return x.Timestamp - } - return "" -} - -func (x *EventRequest) GetData() map[string]string { - if x != nil { - return x.Data - } - return nil -} - -type EventResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Handled bool `protobuf:"varint,1,opt,name=handled,proto3" json:"handled,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *EventResponse) Reset() { - *x = EventResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *EventResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EventResponse) ProtoMessage() {} - -func (x *EventResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[20] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EventResponse.ProtoReflect.Descriptor instead. -func (*EventResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{20} -} - -func (x *EventResponse) GetHandled() bool { - if x != nil { - return x.Handled - } - return false -} - -// GetSettings - Returns plugin settings schema -type SettingsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SettingsRequest) Reset() { - *x = SettingsRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SettingsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SettingsRequest) ProtoMessage() {} - -func (x *SettingsRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[21] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SettingsRequest.ProtoReflect.Descriptor instead. -func (*SettingsRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{21} -} - -func (x *SettingsRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -type SettingsResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - SchemaJson string `protobuf:"bytes,1,opt,name=schema_json,json=schemaJson,proto3" json:"schema_json,omitempty"` // JSON schema for settings - ValuesJson string `protobuf:"bytes,2,opt,name=values_json,json=valuesJson,proto3" json:"values_json,omitempty"` // Current setting values as JSON - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SettingsResponse) Reset() { - *x = SettingsResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SettingsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SettingsResponse) ProtoMessage() {} - -func (x *SettingsResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[22] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SettingsResponse.ProtoReflect.Descriptor instead. -func (*SettingsResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{22} -} - -func (x *SettingsResponse) GetSchemaJson() string { - if x != nil { - return x.SchemaJson - } - return "" -} - -func (x *SettingsResponse) GetValuesJson() string { - if x != nil { - return x.ValuesJson - } - return "" -} - -// UpdateSettings - Updates plugin settings -type UpdateSettingsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - ValuesJson string `protobuf:"bytes,2,opt,name=values_json,json=valuesJson,proto3" json:"values_json,omitempty"` // New settings as JSON - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateSettingsRequest) Reset() { - *x = UpdateSettingsRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateSettingsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateSettingsRequest) ProtoMessage() {} - -func (x *UpdateSettingsRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[23] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateSettingsRequest.ProtoReflect.Descriptor instead. -func (*UpdateSettingsRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{23} -} - -func (x *UpdateSettingsRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -func (x *UpdateSettingsRequest) GetValuesJson() string { - if x != nil { - return x.ValuesJson - } - return "" -} - -type UpdateSettingsResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateSettingsResponse) Reset() { - *x = UpdateSettingsResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateSettingsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateSettingsResponse) ProtoMessage() {} - -func (x *UpdateSettingsResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[24] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateSettingsResponse.ProtoReflect.Descriptor instead. -func (*UpdateSettingsResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{24} -} - -func (x *UpdateSettingsResponse) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -func (x *UpdateSettingsResponse) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -// GetContainers - Fetch all containers -type GetContainersRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - LatestOnly bool `protobuf:"varint,2,opt,name=latest_only,json=latestOnly,proto3" json:"latest_only,omitempty"` // If true, only return latest scan results - HostId int64 `protobuf:"varint,3,opt,name=host_id,json=hostId,proto3" json:"host_id,omitempty"` // If > 0, filter by host - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetContainersRequest) Reset() { - *x = GetContainersRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetContainersRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetContainersRequest) ProtoMessage() {} - -func (x *GetContainersRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[25] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetContainersRequest.ProtoReflect.Descriptor instead. -func (*GetContainersRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{25} -} - -func (x *GetContainersRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -func (x *GetContainersRequest) GetLatestOnly() bool { - if x != nil { - return x.LatestOnly - } - return false -} - -func (x *GetContainersRequest) GetHostId() int64 { - if x != nil { - return x.HostId - } - return 0 -} - -type GetContainersResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Containers []*Container `protobuf:"bytes,1,rep,name=containers,proto3" json:"containers,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetContainersResponse) Reset() { - *x = GetContainersResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetContainersResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetContainersResponse) ProtoMessage() {} - -func (x *GetContainersResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[26] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetContainersResponse.ProtoReflect.Descriptor instead. -func (*GetContainersResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{26} -} - -func (x *GetContainersResponse) GetContainers() []*Container { - if x != nil { - return x.Containers - } - return nil -} - -// GetContainer - Fetch specific container -type GetContainerRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - ContainerId string `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - HostId int64 `protobuf:"varint,3,opt,name=host_id,json=hostId,proto3" json:"host_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetContainerRequest) Reset() { - *x = GetContainerRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetContainerRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetContainerRequest) ProtoMessage() {} - -func (x *GetContainerRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[27] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetContainerRequest.ProtoReflect.Descriptor instead. -func (*GetContainerRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{27} -} - -func (x *GetContainerRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -func (x *GetContainerRequest) GetContainerId() string { - if x != nil { - return x.ContainerId - } - return "" -} - -func (x *GetContainerRequest) GetHostId() int64 { - if x != nil { - return x.HostId - } - return 0 -} - -type GetContainerResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Container *Container `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` - Found bool `protobuf:"varint,2,opt,name=found,proto3" json:"found,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetContainerResponse) Reset() { - *x = GetContainerResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetContainerResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetContainerResponse) ProtoMessage() {} - -func (x *GetContainerResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[28] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetContainerResponse.ProtoReflect.Descriptor instead. -func (*GetContainerResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{28} -} - -func (x *GetContainerResponse) GetContainer() *Container { - if x != nil { - return x.Container - } - return nil -} - -func (x *GetContainerResponse) GetFound() bool { - if x != nil { - return x.Found - } - return false -} - -// GetHosts - Fetch all hosts -type GetHostsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetHostsRequest) Reset() { - *x = GetHostsRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetHostsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetHostsRequest) ProtoMessage() {} - -func (x *GetHostsRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[29] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetHostsRequest.ProtoReflect.Descriptor instead. -func (*GetHostsRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{29} -} - -func (x *GetHostsRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -type GetHostsResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Hosts []*Host `protobuf:"bytes,1,rep,name=hosts,proto3" json:"hosts,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetHostsResponse) Reset() { - *x = GetHostsResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetHostsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetHostsResponse) ProtoMessage() {} - -func (x *GetHostsResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[30] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetHostsResponse.ProtoReflect.Descriptor instead. -func (*GetHostsResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{30} -} - -func (x *GetHostsResponse) GetHosts() []*Host { - if x != nil { - return x.Hosts - } - return nil -} - -// GetHost - Fetch specific host -type GetHostRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - HostId int64 `protobuf:"varint,2,opt,name=host_id,json=hostId,proto3" json:"host_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetHostRequest) Reset() { - *x = GetHostRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetHostRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetHostRequest) ProtoMessage() {} - -func (x *GetHostRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[31] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetHostRequest.ProtoReflect.Descriptor instead. -func (*GetHostRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{31} -} - -func (x *GetHostRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -func (x *GetHostRequest) GetHostId() int64 { - if x != nil { - return x.HostId - } - return 0 -} - -type GetHostResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Host *Host `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` - Found bool `protobuf:"varint,2,opt,name=found,proto3" json:"found,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetHostResponse) Reset() { - *x = GetHostResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetHostResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetHostResponse) ProtoMessage() {} - -func (x *GetHostResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[32] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetHostResponse.ProtoReflect.Descriptor instead. -func (*GetHostResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{32} -} - -func (x *GetHostResponse) GetHost() *Host { - if x != nil { - return x.Host - } - return nil -} - -func (x *GetHostResponse) GetFound() bool { - if x != nil { - return x.Found - } - return false -} - -// GetPluginData - Fetch plugin-specific data from storage -type GetPluginDataRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetPluginDataRequest) Reset() { - *x = GetPluginDataRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetPluginDataRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetPluginDataRequest) ProtoMessage() {} - -func (x *GetPluginDataRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[33] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetPluginDataRequest.ProtoReflect.Descriptor instead. -func (*GetPluginDataRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{33} -} - -func (x *GetPluginDataRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -func (x *GetPluginDataRequest) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -type GetPluginDataResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - Found bool `protobuf:"varint,2,opt,name=found,proto3" json:"found,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetPluginDataResponse) Reset() { - *x = GetPluginDataResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetPluginDataResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetPluginDataResponse) ProtoMessage() {} - -func (x *GetPluginDataResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[34] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetPluginDataResponse.ProtoReflect.Descriptor instead. -func (*GetPluginDataResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{34} -} - -func (x *GetPluginDataResponse) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -func (x *GetPluginDataResponse) GetFound() bool { - if x != nil { - return x.Found - } - return false -} - -// SetPluginData - Store plugin-specific data -type SetPluginDataRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SetPluginDataRequest) Reset() { - *x = SetPluginDataRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SetPluginDataRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetPluginDataRequest) ProtoMessage() {} - -func (x *SetPluginDataRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[35] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SetPluginDataRequest.ProtoReflect.Descriptor instead. -func (*SetPluginDataRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{35} -} - -func (x *SetPluginDataRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -func (x *SetPluginDataRequest) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *SetPluginDataRequest) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -type SetPluginDataResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SetPluginDataResponse) Reset() { - *x = SetPluginDataResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SetPluginDataResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetPluginDataResponse) ProtoMessage() {} - -func (x *SetPluginDataResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[36] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SetPluginDataResponse.ProtoReflect.Descriptor instead. -func (*SetPluginDataResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{36} -} - -func (x *SetPluginDataResponse) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -// DeletePluginData - Delete plugin-specific data -type DeletePluginDataRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeletePluginDataRequest) Reset() { - *x = DeletePluginDataRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeletePluginDataRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeletePluginDataRequest) ProtoMessage() {} - -func (x *DeletePluginDataRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[37] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeletePluginDataRequest.ProtoReflect.Descriptor instead. -func (*DeletePluginDataRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{37} -} - -func (x *DeletePluginDataRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -func (x *DeletePluginDataRequest) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -type DeletePluginDataResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeletePluginDataResponse) Reset() { - *x = DeletePluginDataResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeletePluginDataResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeletePluginDataResponse) ProtoMessage() {} - -func (x *DeletePluginDataResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[38] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeletePluginDataResponse.ProtoReflect.Descriptor instead. -func (*DeletePluginDataResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{38} -} - -func (x *DeletePluginDataResponse) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -// Log - Send log message to Census server -type LogRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - Level string `protobuf:"bytes,2,opt,name=level,proto3" json:"level,omitempty"` // "debug", "info", "warn", "error" - Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` - Fields map[string]string `protobuf:"bytes,4,rep,name=fields,proto3" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *LogRequest) Reset() { - *x = LogRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *LogRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LogRequest) ProtoMessage() {} - -func (x *LogRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[39] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LogRequest.ProtoReflect.Descriptor instead. -func (*LogRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{39} -} - -func (x *LogRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -func (x *LogRequest) GetLevel() string { - if x != nil { - return x.Level - } - return "" -} - -func (x *LogRequest) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -func (x *LogRequest) GetFields() map[string]string { - if x != nil { - return x.Fields - } - return nil -} - -type LogResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *LogResponse) Reset() { - *x = LogResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *LogResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LogResponse) ProtoMessage() {} - -func (x *LogResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[40] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LogResponse.ProtoReflect.Descriptor instead. -func (*LogResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{40} -} - -func (x *LogResponse) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -// SendEvent - Send event to other plugins -type SendEventRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"` - EventType string `protobuf:"bytes,2,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` - Data map[string]string `protobuf:"bytes,3,rep,name=data,proto3" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SendEventRequest) Reset() { - *x = SendEventRequest{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SendEventRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SendEventRequest) ProtoMessage() {} - -func (x *SendEventRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[41] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SendEventRequest.ProtoReflect.Descriptor instead. -func (*SendEventRequest) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{41} -} - -func (x *SendEventRequest) GetPluginId() string { - if x != nil { - return x.PluginId - } - return "" -} - -func (x *SendEventRequest) GetEventType() string { - if x != nil { - return x.EventType - } - return "" -} - -func (x *SendEventRequest) GetData() map[string]string { - if x != nil { - return x.Data - } - return nil -} - -type SendEventResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SendEventResponse) Reset() { - *x = SendEventResponse{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[42] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SendEventResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SendEventResponse) ProtoMessage() {} - -func (x *SendEventResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[42] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SendEventResponse.ProtoReflect.Descriptor instead. -func (*SendEventResponse) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{42} -} - -func (x *SendEventResponse) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -type Container struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Image string `protobuf:"bytes,3,opt,name=image,proto3" json:"image,omitempty"` - ImageId string `protobuf:"bytes,4,opt,name=image_id,json=imageId,proto3" json:"image_id,omitempty"` - State string `protobuf:"bytes,5,opt,name=state,proto3" json:"state,omitempty"` - Status string `protobuf:"bytes,6,opt,name=status,proto3" json:"status,omitempty"` - HostId int64 `protobuf:"varint,7,opt,name=host_id,json=hostId,proto3" json:"host_id,omitempty"` - HostName string `protobuf:"bytes,8,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` - Created string `protobuf:"bytes,9,opt,name=created,proto3" json:"created,omitempty"` - StartedAt string `protobuf:"bytes,10,opt,name=started_at,json=startedAt,proto3" json:"started_at,omitempty"` - FinishedAt string `protobuf:"bytes,11,opt,name=finished_at,json=finishedAt,proto3" json:"finished_at,omitempty"` - Ports []*Port `protobuf:"bytes,12,rep,name=ports,proto3" json:"ports,omitempty"` - Networks []string `protobuf:"bytes,13,rep,name=networks,proto3" json:"networks,omitempty"` - Volumes []*Volume `protobuf:"bytes,14,rep,name=volumes,proto3" json:"volumes,omitempty"` - Links []string `protobuf:"bytes,15,rep,name=links,proto3" json:"links,omitempty"` - Labels map[string]string `protobuf:"bytes,16,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - Env map[string]string `protobuf:"bytes,17,rep,name=env,proto3" json:"env,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - ComposeProject string `protobuf:"bytes,18,opt,name=compose_project,json=composeProject,proto3" json:"compose_project,omitempty"` - // Resource stats - CpuPercent float64 `protobuf:"fixed64,19,opt,name=cpu_percent,json=cpuPercent,proto3" json:"cpu_percent,omitempty"` - MemoryUsage int64 `protobuf:"varint,20,opt,name=memory_usage,json=memoryUsage,proto3" json:"memory_usage,omitempty"` - MemoryLimit int64 `protobuf:"varint,21,opt,name=memory_limit,json=memoryLimit,proto3" json:"memory_limit,omitempty"` - MemoryPercent float64 `protobuf:"fixed64,22,opt,name=memory_percent,json=memoryPercent,proto3" json:"memory_percent,omitempty"` - // Plugin data - PluginData map[string]string `protobuf:"bytes,23,rep,name=plugin_data,json=pluginData,proto3" json:"plugin_data,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Container) Reset() { - *x = Container{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[43] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Container) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Container) ProtoMessage() {} - -func (x *Container) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[43] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Container.ProtoReflect.Descriptor instead. -func (*Container) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{43} -} - -func (x *Container) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *Container) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Container) GetImage() string { - if x != nil { - return x.Image - } - return "" -} - -func (x *Container) GetImageId() string { - if x != nil { - return x.ImageId - } - return "" -} - -func (x *Container) GetState() string { - if x != nil { - return x.State - } - return "" -} - -func (x *Container) GetStatus() string { - if x != nil { - return x.Status - } - return "" -} - -func (x *Container) GetHostId() int64 { - if x != nil { - return x.HostId - } - return 0 -} - -func (x *Container) GetHostName() string { - if x != nil { - return x.HostName - } - return "" -} - -func (x *Container) GetCreated() string { - if x != nil { - return x.Created - } - return "" -} - -func (x *Container) GetStartedAt() string { - if x != nil { - return x.StartedAt - } - return "" -} - -func (x *Container) GetFinishedAt() string { - if x != nil { - return x.FinishedAt - } - return "" -} - -func (x *Container) GetPorts() []*Port { - if x != nil { - return x.Ports - } - return nil -} - -func (x *Container) GetNetworks() []string { - if x != nil { - return x.Networks - } - return nil -} - -func (x *Container) GetVolumes() []*Volume { - if x != nil { - return x.Volumes - } - return nil -} - -func (x *Container) GetLinks() []string { - if x != nil { - return x.Links - } - return nil -} - -func (x *Container) GetLabels() map[string]string { - if x != nil { - return x.Labels - } - return nil -} - -func (x *Container) GetEnv() map[string]string { - if x != nil { - return x.Env - } - return nil -} - -func (x *Container) GetComposeProject() string { - if x != nil { - return x.ComposeProject - } - return "" -} - -func (x *Container) GetCpuPercent() float64 { - if x != nil { - return x.CpuPercent - } - return 0 -} - -func (x *Container) GetMemoryUsage() int64 { - if x != nil { - return x.MemoryUsage - } - return 0 -} - -func (x *Container) GetMemoryLimit() int64 { - if x != nil { - return x.MemoryLimit - } - return 0 -} - -func (x *Container) GetMemoryPercent() float64 { - if x != nil { - return x.MemoryPercent - } - return 0 -} - -func (x *Container) GetPluginData() map[string]string { - if x != nil { - return x.PluginData - } - return nil -} - -type Port struct { - state protoimpl.MessageState `protogen:"open.v1"` - ContainerPort int32 `protobuf:"varint,1,opt,name=container_port,json=containerPort,proto3" json:"container_port,omitempty"` - HostPort int32 `protobuf:"varint,2,opt,name=host_port,json=hostPort,proto3" json:"host_port,omitempty"` - Protocol string `protobuf:"bytes,3,opt,name=protocol,proto3" json:"protocol,omitempty"` - HostIp string `protobuf:"bytes,4,opt,name=host_ip,json=hostIp,proto3" json:"host_ip,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Port) Reset() { - *x = Port{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[44] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Port) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Port) ProtoMessage() {} - -func (x *Port) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[44] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Port.ProtoReflect.Descriptor instead. -func (*Port) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{44} -} - -func (x *Port) GetContainerPort() int32 { - if x != nil { - return x.ContainerPort - } - return 0 -} - -func (x *Port) GetHostPort() int32 { - if x != nil { - return x.HostPort - } - return 0 -} - -func (x *Port) GetProtocol() string { - if x != nil { - return x.Protocol - } - return "" -} - -func (x *Port) GetHostIp() string { - if x != nil { - return x.HostIp - } - return "" -} - -type Volume struct { - state protoimpl.MessageState `protogen:"open.v1"` - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` // "bind", "volume", "tmpfs" - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Volume name (for named volumes) - Source string `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"` // Host path - Destination string `protobuf:"bytes,4,opt,name=destination,proto3" json:"destination,omitempty"` // Container path - Mode string `protobuf:"bytes,5,opt,name=mode,proto3" json:"mode,omitempty"` // "rw", "ro" - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Volume) Reset() { - *x = Volume{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[45] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Volume) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Volume) ProtoMessage() {} - -func (x *Volume) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[45] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Volume.ProtoReflect.Descriptor instead. -func (*Volume) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{45} -} - -func (x *Volume) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Volume) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Volume) GetSource() string { - if x != nil { - return x.Source - } - return "" -} - -func (x *Volume) GetDestination() string { - if x != nil { - return x.Destination - } - return "" -} - -func (x *Volume) GetMode() string { - if x != nil { - return x.Mode - } - return "" -} - -type Host struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` - HostType string `protobuf:"bytes,4,opt,name=host_type,json=hostType,proto3" json:"host_type,omitempty"` // "unix", "agent", "tcp", "ssh" - Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` - Enabled bool `protobuf:"varint,6,opt,name=enabled,proto3" json:"enabled,omitempty"` - CollectStats bool `protobuf:"varint,7,opt,name=collect_stats,json=collectStats,proto3" json:"collect_stats,omitempty"` - LastSeen string `protobuf:"bytes,8,opt,name=last_seen,json=lastSeen,proto3" json:"last_seen,omitempty"` - AgentVersion string `protobuf:"bytes,9,opt,name=agent_version,json=agentVersion,proto3" json:"agent_version,omitempty"` - AgentStatus string `protobuf:"bytes,10,opt,name=agent_status,json=agentStatus,proto3" json:"agent_status,omitempty"` // "online", "offline", "auth_failed" - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Host) Reset() { - *x = Host{} - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[46] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Host) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Host) ProtoMessage() {} - -func (x *Host) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugins_proto_plugin_proto_msgTypes[46] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Host.ProtoReflect.Descriptor instead. -func (*Host) Descriptor() ([]byte, []int) { - return file_internal_plugins_proto_plugin_proto_rawDescGZIP(), []int{46} -} - -func (x *Host) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *Host) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Host) GetAddress() string { - if x != nil { - return x.Address - } - return "" -} - -func (x *Host) GetHostType() string { - if x != nil { - return x.HostType - } - return "" -} - -func (x *Host) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Host) GetEnabled() bool { - if x != nil { - return x.Enabled - } - return false -} - -func (x *Host) GetCollectStats() bool { - if x != nil { - return x.CollectStats - } - return false -} - -func (x *Host) GetLastSeen() string { - if x != nil { - return x.LastSeen - } - return "" -} - -func (x *Host) GetAgentVersion() string { - if x != nil { - return x.AgentVersion - } - return "" -} - -func (x *Host) GetAgentStatus() string { - if x != nil { - return x.AgentStatus - } - return "" -} - -var File_internal_plugins_proto_plugin_proto protoreflect.FileDescriptor - -const file_internal_plugins_proto_plugin_proto_rawDesc = "" + - "\n" + - "#internal/plugins/proto/plugin.proto\x12\rcensus.plugin\"\xfa\x01\n" + - "\vInitRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\x12>\n" + - "\x06config\x18\x02 \x03(\v2&.census.plugin.InitRequest.ConfigEntryR\x06config\x12,\n" + - "\x12census_api_address\x18\x03 \x01(\tR\x10censusApiAddress\x12%\n" + - "\x0ecensus_version\x18\x04 \x01(\tR\rcensusVersion\x1a9\n" + - "\vConfigEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\">\n" + - "\fInitResponse\x12\x18\n" + - "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x14\n" + - "\x05error\x18\x02 \x01(\tR\x05error\"+\n" + - "\fStartRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\"?\n" + - "\rStartResponse\x12\x18\n" + - "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x14\n" + - "\x05error\x18\x02 \x01(\tR\x05error\"*\n" + - "\vStopRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\"(\n" + - "\fStopResponse\x12\x18\n" + - "\asuccess\x18\x01 \x01(\bR\asuccess\"1\n" + - "\x12HealthcheckRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\"\xce\x01\n" + - "\x13HealthcheckResponse\x12\x18\n" + - "\ahealthy\x18\x01 \x01(\bR\ahealthy\x12\x16\n" + - "\x06status\x18\x02 \x01(\tR\x06status\x12I\n" + - "\ametrics\x18\x03 \x03(\v2/.census.plugin.HealthcheckResponse.MetricsEntryR\ametrics\x1a:\n" + - "\fMetricsEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"*\n" + - "\vInfoRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\"\xc6\x01\n" + - "\fInfoResponse\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12\x18\n" + - "\aversion\x18\x03 \x01(\tR\aversion\x12 \n" + - "\vdescription\x18\x04 \x01(\tR\vdescription\x12\x16\n" + - "\x06author\x18\x05 \x01(\tR\x06author\x12\x1a\n" + - "\bhomepage\x18\x06 \x01(\tR\bhomepage\x12\"\n" + - "\fcapabilities\x18\a \x03(\tR\fcapabilities\")\n" + - "\n" + - "TabRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\"\xcb\x01\n" + - "\vTabResponse\x12\x17\n" + - "\ahas_tab\x18\x01 \x01(\bR\x06hasTab\x12\x0e\n" + - "\x02id\x18\x02 \x01(\tR\x02id\x12\x14\n" + - "\x05label\x18\x03 \x01(\tR\x05label\x12\x12\n" + - "\x04icon\x18\x04 \x01(\tR\x04icon\x12\x14\n" + - "\x05order\x18\x05 \x01(\x05R\x05order\x12\x1d\n" + - "\n" + - "script_url\x18\x06 \x01(\tR\tscriptUrl\x12\x17\n" + - "\acss_url\x18\a \x01(\tR\x06cssUrl\x12\x1b\n" + - "\tinit_func\x18\b \x01(\tR\binitFunc\"d\n" + - "\rBadgesRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\x126\n" + - "\tcontainer\x18\x02 \x01(\v2\x18.census.plugin.ContainerR\tcontainer\">\n" + - "\x0eBadgesResponse\x12,\n" + - "\x06badges\x18\x01 \x03(\v2\x14.census.plugin.BadgeR\x06badges\"\xa1\x01\n" + - "\x05Badge\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x14\n" + - "\x05label\x18\x02 \x01(\tR\x05label\x12\x12\n" + - "\x04icon\x18\x03 \x01(\tR\x04icon\x12\x14\n" + - "\x05color\x18\x04 \x01(\tR\x05color\x12\x18\n" + - "\atooltip\x18\x05 \x01(\tR\atooltip\x12\x12\n" + - "\x04link\x18\x06 \x01(\tR\x04link\x12\x1a\n" + - "\bpriority\x18\a \x01(\x05R\bpriority\"\x89\x04\n" + - "\fRouteRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\x12\x16\n" + - "\x06method\x18\x02 \x01(\tR\x06method\x12\x12\n" + - "\x04path\x18\x03 \x01(\tR\x04path\x12B\n" + - "\aheaders\x18\x04 \x03(\v2(.census.plugin.RouteRequest.HeadersEntryR\aheaders\x12\x12\n" + - "\x04body\x18\x05 \x01(\fR\x04body\x12O\n" + - "\fquery_params\x18\x06 \x03(\v2,.census.plugin.RouteRequest.QueryParamsEntryR\vqueryParams\x12L\n" + - "\vpath_params\x18\a \x03(\v2+.census.plugin.RouteRequest.PathParamsEntryR\n" + - "pathParams\x1a:\n" + - "\fHeadersEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a>\n" + - "\x10QueryParamsEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a=\n" + - "\x0fPathParamsEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xc5\x01\n" + - "\rRouteResponse\x12\x1f\n" + - "\vstatus_code\x18\x01 \x01(\x05R\n" + - "statusCode\x12C\n" + - "\aheaders\x18\x02 \x03(\v2).census.plugin.RouteResponse.HeadersEntryR\aheaders\x12\x12\n" + - "\x04body\x18\x03 \x01(\fR\x04body\x1a:\n" + - "\fHeadersEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"d\n" + - "\rEnrichRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\x126\n" + - "\tcontainer\x18\x02 \x01(\v2\x18.census.plugin.ContainerR\tcontainer\"\x9f\x01\n" + - "\x0eEnrichResponse\x12N\n" + - "\vplugin_data\x18\x01 \x03(\v2-.census.plugin.EnrichResponse.PluginDataEntryR\n" + - "pluginData\x1a=\n" + - "\x0fPluginDataEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xdc\x01\n" + - "\fEventRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\x12\x1d\n" + - "\n" + - "event_type\x18\x02 \x01(\tR\teventType\x12\x1c\n" + - "\ttimestamp\x18\x03 \x01(\tR\ttimestamp\x129\n" + - "\x04data\x18\x04 \x03(\v2%.census.plugin.EventRequest.DataEntryR\x04data\x1a7\n" + - "\tDataEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\")\n" + - "\rEventResponse\x12\x18\n" + - "\ahandled\x18\x01 \x01(\bR\ahandled\".\n" + - "\x0fSettingsRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\"T\n" + - "\x10SettingsResponse\x12\x1f\n" + - "\vschema_json\x18\x01 \x01(\tR\n" + - "schemaJson\x12\x1f\n" + - "\vvalues_json\x18\x02 \x01(\tR\n" + - "valuesJson\"U\n" + - "\x15UpdateSettingsRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\x12\x1f\n" + - "\vvalues_json\x18\x02 \x01(\tR\n" + - "valuesJson\"H\n" + - "\x16UpdateSettingsResponse\x12\x18\n" + - "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x14\n" + - "\x05error\x18\x02 \x01(\tR\x05error\"m\n" + - "\x14GetContainersRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\x12\x1f\n" + - "\vlatest_only\x18\x02 \x01(\bR\n" + - "latestOnly\x12\x17\n" + - "\ahost_id\x18\x03 \x01(\x03R\x06hostId\"Q\n" + - "\x15GetContainersResponse\x128\n" + - "\n" + - "containers\x18\x01 \x03(\v2\x18.census.plugin.ContainerR\n" + - "containers\"n\n" + - "\x13GetContainerRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\x12!\n" + - "\fcontainer_id\x18\x02 \x01(\tR\vcontainerId\x12\x17\n" + - "\ahost_id\x18\x03 \x01(\x03R\x06hostId\"d\n" + - "\x14GetContainerResponse\x126\n" + - "\tcontainer\x18\x01 \x01(\v2\x18.census.plugin.ContainerR\tcontainer\x12\x14\n" + - "\x05found\x18\x02 \x01(\bR\x05found\".\n" + - "\x0fGetHostsRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\"=\n" + - "\x10GetHostsResponse\x12)\n" + - "\x05hosts\x18\x01 \x03(\v2\x13.census.plugin.HostR\x05hosts\"F\n" + - "\x0eGetHostRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\x12\x17\n" + - "\ahost_id\x18\x02 \x01(\x03R\x06hostId\"P\n" + - "\x0fGetHostResponse\x12'\n" + - "\x04host\x18\x01 \x01(\v2\x13.census.plugin.HostR\x04host\x12\x14\n" + - "\x05found\x18\x02 \x01(\bR\x05found\"E\n" + - "\x14GetPluginDataRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\x12\x10\n" + - "\x03key\x18\x02 \x01(\tR\x03key\"C\n" + - "\x15GetPluginDataResponse\x12\x14\n" + - "\x05value\x18\x01 \x01(\tR\x05value\x12\x14\n" + - "\x05found\x18\x02 \x01(\bR\x05found\"[\n" + - "\x14SetPluginDataRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\x12\x10\n" + - "\x03key\x18\x02 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x03 \x01(\tR\x05value\"1\n" + - "\x15SetPluginDataResponse\x12\x18\n" + - "\asuccess\x18\x01 \x01(\bR\asuccess\"H\n" + - "\x17DeletePluginDataRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\x12\x10\n" + - "\x03key\x18\x02 \x01(\tR\x03key\"4\n" + - "\x18DeletePluginDataResponse\x12\x18\n" + - "\asuccess\x18\x01 \x01(\bR\asuccess\"\xd3\x01\n" + - "\n" + - "LogRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\x12\x14\n" + - "\x05level\x18\x02 \x01(\tR\x05level\x12\x18\n" + - "\amessage\x18\x03 \x01(\tR\amessage\x12=\n" + - "\x06fields\x18\x04 \x03(\v2%.census.plugin.LogRequest.FieldsEntryR\x06fields\x1a9\n" + - "\vFieldsEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"'\n" + - "\vLogResponse\x12\x18\n" + - "\asuccess\x18\x01 \x01(\bR\asuccess\"\xc6\x01\n" + - "\x10SendEventRequest\x12\x1b\n" + - "\tplugin_id\x18\x01 \x01(\tR\bpluginId\x12\x1d\n" + - "\n" + - "event_type\x18\x02 \x01(\tR\teventType\x12=\n" + - "\x04data\x18\x03 \x03(\v2).census.plugin.SendEventRequest.DataEntryR\x04data\x1a7\n" + - "\tDataEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"-\n" + - "\x11SendEventResponse\x12\x18\n" + - "\asuccess\x18\x01 \x01(\bR\asuccess\"\xd3\a\n" + - "\tContainer\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12\x14\n" + - "\x05image\x18\x03 \x01(\tR\x05image\x12\x19\n" + - "\bimage_id\x18\x04 \x01(\tR\aimageId\x12\x14\n" + - "\x05state\x18\x05 \x01(\tR\x05state\x12\x16\n" + - "\x06status\x18\x06 \x01(\tR\x06status\x12\x17\n" + - "\ahost_id\x18\a \x01(\x03R\x06hostId\x12\x1b\n" + - "\thost_name\x18\b \x01(\tR\bhostName\x12\x18\n" + - "\acreated\x18\t \x01(\tR\acreated\x12\x1d\n" + - "\n" + - "started_at\x18\n" + - " \x01(\tR\tstartedAt\x12\x1f\n" + - "\vfinished_at\x18\v \x01(\tR\n" + - "finishedAt\x12)\n" + - "\x05ports\x18\f \x03(\v2\x13.census.plugin.PortR\x05ports\x12\x1a\n" + - "\bnetworks\x18\r \x03(\tR\bnetworks\x12/\n" + - "\avolumes\x18\x0e \x03(\v2\x15.census.plugin.VolumeR\avolumes\x12\x14\n" + - "\x05links\x18\x0f \x03(\tR\x05links\x12<\n" + - "\x06labels\x18\x10 \x03(\v2$.census.plugin.Container.LabelsEntryR\x06labels\x123\n" + - "\x03env\x18\x11 \x03(\v2!.census.plugin.Container.EnvEntryR\x03env\x12'\n" + - "\x0fcompose_project\x18\x12 \x01(\tR\x0ecomposeProject\x12\x1f\n" + - "\vcpu_percent\x18\x13 \x01(\x01R\n" + - "cpuPercent\x12!\n" + - "\fmemory_usage\x18\x14 \x01(\x03R\vmemoryUsage\x12!\n" + - "\fmemory_limit\x18\x15 \x01(\x03R\vmemoryLimit\x12%\n" + - "\x0ememory_percent\x18\x16 \x01(\x01R\rmemoryPercent\x12I\n" + - "\vplugin_data\x18\x17 \x03(\v2(.census.plugin.Container.PluginDataEntryR\n" + - "pluginData\x1a9\n" + - "\vLabelsEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a6\n" + - "\bEnvEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a=\n" + - "\x0fPluginDataEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x7f\n" + - "\x04Port\x12%\n" + - "\x0econtainer_port\x18\x01 \x01(\x05R\rcontainerPort\x12\x1b\n" + - "\thost_port\x18\x02 \x01(\x05R\bhostPort\x12\x1a\n" + - "\bprotocol\x18\x03 \x01(\tR\bprotocol\x12\x17\n" + - "\ahost_ip\x18\x04 \x01(\tR\x06hostIp\"~\n" + - "\x06Volume\x12\x12\n" + - "\x04type\x18\x01 \x01(\tR\x04type\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12\x16\n" + - "\x06source\x18\x03 \x01(\tR\x06source\x12 \n" + - "\vdestination\x18\x04 \x01(\tR\vdestination\x12\x12\n" + - "\x04mode\x18\x05 \x01(\tR\x04mode\"\xa7\x02\n" + - "\x04Host\x12\x0e\n" + - "\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12\x18\n" + - "\aaddress\x18\x03 \x01(\tR\aaddress\x12\x1b\n" + - "\thost_type\x18\x04 \x01(\tR\bhostType\x12 \n" + - "\vdescription\x18\x05 \x01(\tR\vdescription\x12\x18\n" + - "\aenabled\x18\x06 \x01(\bR\aenabled\x12#\n" + - "\rcollect_stats\x18\a \x01(\bR\fcollectStats\x12\x1b\n" + - "\tlast_seen\x18\b \x01(\tR\blastSeen\x12#\n" + - "\ragent_version\x18\t \x01(\tR\fagentVersion\x12!\n" + - "\fagent_status\x18\n" + - " \x01(\tR\vagentStatus2\x86\a\n" + - "\x06Plugin\x12?\n" + - "\x04Init\x12\x1a.census.plugin.InitRequest\x1a\x1b.census.plugin.InitResponse\x12B\n" + - "\x05Start\x12\x1b.census.plugin.StartRequest\x1a\x1c.census.plugin.StartResponse\x12?\n" + - "\x04Stop\x12\x1a.census.plugin.StopRequest\x1a\x1b.census.plugin.StopResponse\x12T\n" + - "\vHealthcheck\x12!.census.plugin.HealthcheckRequest\x1a\".census.plugin.HealthcheckResponse\x12B\n" + - "\aGetInfo\x12\x1a.census.plugin.InfoRequest\x1a\x1b.census.plugin.InfoResponse\x12?\n" + - "\x06GetTab\x12\x19.census.plugin.TabRequest\x1a\x1a.census.plugin.TabResponse\x12H\n" + - "\tGetBadges\x12\x1c.census.plugin.BadgesRequest\x1a\x1d.census.plugin.BadgesResponse\x12H\n" + - "\vHandleRoute\x12\x1b.census.plugin.RouteRequest\x1a\x1c.census.plugin.RouteResponse\x12N\n" + - "\x0fEnrichContainer\x12\x1c.census.plugin.EnrichRequest\x1a\x1d.census.plugin.EnrichResponse\x12H\n" + - "\vHandleEvent\x12\x1b.census.plugin.EventRequest\x1a\x1c.census.plugin.EventResponse\x12N\n" + - "\vGetSettings\x12\x1e.census.plugin.SettingsRequest\x1a\x1f.census.plugin.SettingsResponse\x12]\n" + - "\x0eUpdateSettings\x12$.census.plugin.UpdateSettingsRequest\x1a%.census.plugin.UpdateSettingsResponse2\x82\x06\n" + - "\tCensusAPI\x12Z\n" + - "\rGetContainers\x12#.census.plugin.GetContainersRequest\x1a$.census.plugin.GetContainersResponse\x12W\n" + - "\fGetContainer\x12\".census.plugin.GetContainerRequest\x1a#.census.plugin.GetContainerResponse\x12K\n" + - "\bGetHosts\x12\x1e.census.plugin.GetHostsRequest\x1a\x1f.census.plugin.GetHostsResponse\x12H\n" + - "\aGetHost\x12\x1d.census.plugin.GetHostRequest\x1a\x1e.census.plugin.GetHostResponse\x12Z\n" + - "\rGetPluginData\x12#.census.plugin.GetPluginDataRequest\x1a$.census.plugin.GetPluginDataResponse\x12Z\n" + - "\rSetPluginData\x12#.census.plugin.SetPluginDataRequest\x1a$.census.plugin.SetPluginDataResponse\x12c\n" + - "\x10DeletePluginData\x12&.census.plugin.DeletePluginDataRequest\x1a'.census.plugin.DeletePluginDataResponse\x12<\n" + - "\x03Log\x12\x19.census.plugin.LogRequest\x1a\x1a.census.plugin.LogResponse\x12N\n" + - "\tSendEvent\x12\x1f.census.plugin.SendEventRequest\x1a .census.plugin.SendEventResponseBCZAgithub.com/selfhosters-cc/container-census/internal/plugins/protob\x06proto3" - -var ( - file_internal_plugins_proto_plugin_proto_rawDescOnce sync.Once - file_internal_plugins_proto_plugin_proto_rawDescData []byte -) - -func file_internal_plugins_proto_plugin_proto_rawDescGZIP() []byte { - file_internal_plugins_proto_plugin_proto_rawDescOnce.Do(func() { - file_internal_plugins_proto_plugin_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_internal_plugins_proto_plugin_proto_rawDesc), len(file_internal_plugins_proto_plugin_proto_rawDesc))) - }) - return file_internal_plugins_proto_plugin_proto_rawDescData -} - -var file_internal_plugins_proto_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 60) -var file_internal_plugins_proto_plugin_proto_goTypes = []any{ - (*InitRequest)(nil), // 0: census.plugin.InitRequest - (*InitResponse)(nil), // 1: census.plugin.InitResponse - (*StartRequest)(nil), // 2: census.plugin.StartRequest - (*StartResponse)(nil), // 3: census.plugin.StartResponse - (*StopRequest)(nil), // 4: census.plugin.StopRequest - (*StopResponse)(nil), // 5: census.plugin.StopResponse - (*HealthcheckRequest)(nil), // 6: census.plugin.HealthcheckRequest - (*HealthcheckResponse)(nil), // 7: census.plugin.HealthcheckResponse - (*InfoRequest)(nil), // 8: census.plugin.InfoRequest - (*InfoResponse)(nil), // 9: census.plugin.InfoResponse - (*TabRequest)(nil), // 10: census.plugin.TabRequest - (*TabResponse)(nil), // 11: census.plugin.TabResponse - (*BadgesRequest)(nil), // 12: census.plugin.BadgesRequest - (*BadgesResponse)(nil), // 13: census.plugin.BadgesResponse - (*Badge)(nil), // 14: census.plugin.Badge - (*RouteRequest)(nil), // 15: census.plugin.RouteRequest - (*RouteResponse)(nil), // 16: census.plugin.RouteResponse - (*EnrichRequest)(nil), // 17: census.plugin.EnrichRequest - (*EnrichResponse)(nil), // 18: census.plugin.EnrichResponse - (*EventRequest)(nil), // 19: census.plugin.EventRequest - (*EventResponse)(nil), // 20: census.plugin.EventResponse - (*SettingsRequest)(nil), // 21: census.plugin.SettingsRequest - (*SettingsResponse)(nil), // 22: census.plugin.SettingsResponse - (*UpdateSettingsRequest)(nil), // 23: census.plugin.UpdateSettingsRequest - (*UpdateSettingsResponse)(nil), // 24: census.plugin.UpdateSettingsResponse - (*GetContainersRequest)(nil), // 25: census.plugin.GetContainersRequest - (*GetContainersResponse)(nil), // 26: census.plugin.GetContainersResponse - (*GetContainerRequest)(nil), // 27: census.plugin.GetContainerRequest - (*GetContainerResponse)(nil), // 28: census.plugin.GetContainerResponse - (*GetHostsRequest)(nil), // 29: census.plugin.GetHostsRequest - (*GetHostsResponse)(nil), // 30: census.plugin.GetHostsResponse - (*GetHostRequest)(nil), // 31: census.plugin.GetHostRequest - (*GetHostResponse)(nil), // 32: census.plugin.GetHostResponse - (*GetPluginDataRequest)(nil), // 33: census.plugin.GetPluginDataRequest - (*GetPluginDataResponse)(nil), // 34: census.plugin.GetPluginDataResponse - (*SetPluginDataRequest)(nil), // 35: census.plugin.SetPluginDataRequest - (*SetPluginDataResponse)(nil), // 36: census.plugin.SetPluginDataResponse - (*DeletePluginDataRequest)(nil), // 37: census.plugin.DeletePluginDataRequest - (*DeletePluginDataResponse)(nil), // 38: census.plugin.DeletePluginDataResponse - (*LogRequest)(nil), // 39: census.plugin.LogRequest - (*LogResponse)(nil), // 40: census.plugin.LogResponse - (*SendEventRequest)(nil), // 41: census.plugin.SendEventRequest - (*SendEventResponse)(nil), // 42: census.plugin.SendEventResponse - (*Container)(nil), // 43: census.plugin.Container - (*Port)(nil), // 44: census.plugin.Port - (*Volume)(nil), // 45: census.plugin.Volume - (*Host)(nil), // 46: census.plugin.Host - nil, // 47: census.plugin.InitRequest.ConfigEntry - nil, // 48: census.plugin.HealthcheckResponse.MetricsEntry - nil, // 49: census.plugin.RouteRequest.HeadersEntry - nil, // 50: census.plugin.RouteRequest.QueryParamsEntry - nil, // 51: census.plugin.RouteRequest.PathParamsEntry - nil, // 52: census.plugin.RouteResponse.HeadersEntry - nil, // 53: census.plugin.EnrichResponse.PluginDataEntry - nil, // 54: census.plugin.EventRequest.DataEntry - nil, // 55: census.plugin.LogRequest.FieldsEntry - nil, // 56: census.plugin.SendEventRequest.DataEntry - nil, // 57: census.plugin.Container.LabelsEntry - nil, // 58: census.plugin.Container.EnvEntry - nil, // 59: census.plugin.Container.PluginDataEntry -} -var file_internal_plugins_proto_plugin_proto_depIdxs = []int32{ - 47, // 0: census.plugin.InitRequest.config:type_name -> census.plugin.InitRequest.ConfigEntry - 48, // 1: census.plugin.HealthcheckResponse.metrics:type_name -> census.plugin.HealthcheckResponse.MetricsEntry - 43, // 2: census.plugin.BadgesRequest.container:type_name -> census.plugin.Container - 14, // 3: census.plugin.BadgesResponse.badges:type_name -> census.plugin.Badge - 49, // 4: census.plugin.RouteRequest.headers:type_name -> census.plugin.RouteRequest.HeadersEntry - 50, // 5: census.plugin.RouteRequest.query_params:type_name -> census.plugin.RouteRequest.QueryParamsEntry - 51, // 6: census.plugin.RouteRequest.path_params:type_name -> census.plugin.RouteRequest.PathParamsEntry - 52, // 7: census.plugin.RouteResponse.headers:type_name -> census.plugin.RouteResponse.HeadersEntry - 43, // 8: census.plugin.EnrichRequest.container:type_name -> census.plugin.Container - 53, // 9: census.plugin.EnrichResponse.plugin_data:type_name -> census.plugin.EnrichResponse.PluginDataEntry - 54, // 10: census.plugin.EventRequest.data:type_name -> census.plugin.EventRequest.DataEntry - 43, // 11: census.plugin.GetContainersResponse.containers:type_name -> census.plugin.Container - 43, // 12: census.plugin.GetContainerResponse.container:type_name -> census.plugin.Container - 46, // 13: census.plugin.GetHostsResponse.hosts:type_name -> census.plugin.Host - 46, // 14: census.plugin.GetHostResponse.host:type_name -> census.plugin.Host - 55, // 15: census.plugin.LogRequest.fields:type_name -> census.plugin.LogRequest.FieldsEntry - 56, // 16: census.plugin.SendEventRequest.data:type_name -> census.plugin.SendEventRequest.DataEntry - 44, // 17: census.plugin.Container.ports:type_name -> census.plugin.Port - 45, // 18: census.plugin.Container.volumes:type_name -> census.plugin.Volume - 57, // 19: census.plugin.Container.labels:type_name -> census.plugin.Container.LabelsEntry - 58, // 20: census.plugin.Container.env:type_name -> census.plugin.Container.EnvEntry - 59, // 21: census.plugin.Container.plugin_data:type_name -> census.plugin.Container.PluginDataEntry - 0, // 22: census.plugin.Plugin.Init:input_type -> census.plugin.InitRequest - 2, // 23: census.plugin.Plugin.Start:input_type -> census.plugin.StartRequest - 4, // 24: census.plugin.Plugin.Stop:input_type -> census.plugin.StopRequest - 6, // 25: census.plugin.Plugin.Healthcheck:input_type -> census.plugin.HealthcheckRequest - 8, // 26: census.plugin.Plugin.GetInfo:input_type -> census.plugin.InfoRequest - 10, // 27: census.plugin.Plugin.GetTab:input_type -> census.plugin.TabRequest - 12, // 28: census.plugin.Plugin.GetBadges:input_type -> census.plugin.BadgesRequest - 15, // 29: census.plugin.Plugin.HandleRoute:input_type -> census.plugin.RouteRequest - 17, // 30: census.plugin.Plugin.EnrichContainer:input_type -> census.plugin.EnrichRequest - 19, // 31: census.plugin.Plugin.HandleEvent:input_type -> census.plugin.EventRequest - 21, // 32: census.plugin.Plugin.GetSettings:input_type -> census.plugin.SettingsRequest - 23, // 33: census.plugin.Plugin.UpdateSettings:input_type -> census.plugin.UpdateSettingsRequest - 25, // 34: census.plugin.CensusAPI.GetContainers:input_type -> census.plugin.GetContainersRequest - 27, // 35: census.plugin.CensusAPI.GetContainer:input_type -> census.plugin.GetContainerRequest - 29, // 36: census.plugin.CensusAPI.GetHosts:input_type -> census.plugin.GetHostsRequest - 31, // 37: census.plugin.CensusAPI.GetHost:input_type -> census.plugin.GetHostRequest - 33, // 38: census.plugin.CensusAPI.GetPluginData:input_type -> census.plugin.GetPluginDataRequest - 35, // 39: census.plugin.CensusAPI.SetPluginData:input_type -> census.plugin.SetPluginDataRequest - 37, // 40: census.plugin.CensusAPI.DeletePluginData:input_type -> census.plugin.DeletePluginDataRequest - 39, // 41: census.plugin.CensusAPI.Log:input_type -> census.plugin.LogRequest - 41, // 42: census.plugin.CensusAPI.SendEvent:input_type -> census.plugin.SendEventRequest - 1, // 43: census.plugin.Plugin.Init:output_type -> census.plugin.InitResponse - 3, // 44: census.plugin.Plugin.Start:output_type -> census.plugin.StartResponse - 5, // 45: census.plugin.Plugin.Stop:output_type -> census.plugin.StopResponse - 7, // 46: census.plugin.Plugin.Healthcheck:output_type -> census.plugin.HealthcheckResponse - 9, // 47: census.plugin.Plugin.GetInfo:output_type -> census.plugin.InfoResponse - 11, // 48: census.plugin.Plugin.GetTab:output_type -> census.plugin.TabResponse - 13, // 49: census.plugin.Plugin.GetBadges:output_type -> census.plugin.BadgesResponse - 16, // 50: census.plugin.Plugin.HandleRoute:output_type -> census.plugin.RouteResponse - 18, // 51: census.plugin.Plugin.EnrichContainer:output_type -> census.plugin.EnrichResponse - 20, // 52: census.plugin.Plugin.HandleEvent:output_type -> census.plugin.EventResponse - 22, // 53: census.plugin.Plugin.GetSettings:output_type -> census.plugin.SettingsResponse - 24, // 54: census.plugin.Plugin.UpdateSettings:output_type -> census.plugin.UpdateSettingsResponse - 26, // 55: census.plugin.CensusAPI.GetContainers:output_type -> census.plugin.GetContainersResponse - 28, // 56: census.plugin.CensusAPI.GetContainer:output_type -> census.plugin.GetContainerResponse - 30, // 57: census.plugin.CensusAPI.GetHosts:output_type -> census.plugin.GetHostsResponse - 32, // 58: census.plugin.CensusAPI.GetHost:output_type -> census.plugin.GetHostResponse - 34, // 59: census.plugin.CensusAPI.GetPluginData:output_type -> census.plugin.GetPluginDataResponse - 36, // 60: census.plugin.CensusAPI.SetPluginData:output_type -> census.plugin.SetPluginDataResponse - 38, // 61: census.plugin.CensusAPI.DeletePluginData:output_type -> census.plugin.DeletePluginDataResponse - 40, // 62: census.plugin.CensusAPI.Log:output_type -> census.plugin.LogResponse - 42, // 63: census.plugin.CensusAPI.SendEvent:output_type -> census.plugin.SendEventResponse - 43, // [43:64] is the sub-list for method output_type - 22, // [22:43] is the sub-list for method input_type - 22, // [22:22] is the sub-list for extension type_name - 22, // [22:22] is the sub-list for extension extendee - 0, // [0:22] is the sub-list for field type_name -} - -func init() { file_internal_plugins_proto_plugin_proto_init() } -func file_internal_plugins_proto_plugin_proto_init() { - if File_internal_plugins_proto_plugin_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_internal_plugins_proto_plugin_proto_rawDesc), len(file_internal_plugins_proto_plugin_proto_rawDesc)), - NumEnums: 0, - NumMessages: 60, - NumExtensions: 0, - NumServices: 2, - }, - GoTypes: file_internal_plugins_proto_plugin_proto_goTypes, - DependencyIndexes: file_internal_plugins_proto_plugin_proto_depIdxs, - MessageInfos: file_internal_plugins_proto_plugin_proto_msgTypes, - }.Build() - File_internal_plugins_proto_plugin_proto = out.File - file_internal_plugins_proto_plugin_proto_goTypes = nil - file_internal_plugins_proto_plugin_proto_depIdxs = nil -} diff --git a/internal/plugins/proto/plugin.proto b/internal/plugins/proto/plugin.proto deleted file mode 100644 index 2c27327..0000000 --- a/internal/plugins/proto/plugin.proto +++ /dev/null @@ -1,358 +0,0 @@ -syntax = "proto3"; - -package census.plugin; -option go_package = "github.com/selfhosters-cc/container-census/internal/plugins/proto"; - -// Plugin service - implemented by external plugin processes -service Plugin { - // Lifecycle methods - rpc Init(InitRequest) returns (InitResponse); - rpc Start(StartRequest) returns (StartResponse); - rpc Stop(StopRequest) returns (StopResponse); - rpc Healthcheck(HealthcheckRequest) returns (HealthcheckResponse); - - // Capability methods - rpc GetInfo(InfoRequest) returns (InfoResponse); - rpc GetTab(TabRequest) returns (TabResponse); - rpc GetBadges(BadgesRequest) returns (BadgesResponse); - rpc HandleRoute(RouteRequest) returns (RouteResponse); - rpc EnrichContainer(EnrichRequest) returns (EnrichResponse); - rpc HandleEvent(EventRequest) returns (EventResponse); - rpc GetSettings(SettingsRequest) returns (SettingsResponse); - rpc UpdateSettings(UpdateSettingsRequest) returns (UpdateSettingsResponse); -} - -// Census API service - implemented by main server (callback API for plugins) -service CensusAPI { - rpc GetContainers(GetContainersRequest) returns (GetContainersResponse); - rpc GetContainer(GetContainerRequest) returns (GetContainerResponse); - rpc GetHosts(GetHostsRequest) returns (GetHostsResponse); - rpc GetHost(GetHostRequest) returns (GetHostResponse); - rpc GetPluginData(GetPluginDataRequest) returns (GetPluginDataResponse); - rpc SetPluginData(SetPluginDataRequest) returns (SetPluginDataResponse); - rpc DeletePluginData(DeletePluginDataRequest) returns (DeletePluginDataResponse); - rpc Log(LogRequest) returns (LogResponse); - rpc SendEvent(SendEventRequest) returns (SendEventResponse); -} - -// ============================================================================ -// Plugin Service Messages -// ============================================================================ - -// Init - Called when plugin is first loaded -message InitRequest { - string plugin_id = 1; - map config = 2; - string census_api_address = 3; // gRPC address for callbacks (e.g., "localhost:50052") - string census_version = 4; -} - -message InitResponse { - bool success = 1; - string error = 2; -} - -// Start - Called to start plugin operations -message StartRequest { - string plugin_id = 1; -} - -message StartResponse { - bool success = 1; - string error = 2; -} - -// Stop - Called to gracefully stop plugin -message StopRequest { - string plugin_id = 1; -} - -message StopResponse { - bool success = 1; -} - -// Healthcheck - Called periodically to verify plugin is alive -message HealthcheckRequest { - string plugin_id = 1; -} - -message HealthcheckResponse { - bool healthy = 1; - string status = 2; // "running", "degraded", "failed" - map metrics = 3; // Optional metrics -} - -// GetInfo - Returns plugin metadata -message InfoRequest { - string plugin_id = 1; -} - -message InfoResponse { - string id = 1; - string name = 2; - string version = 3; - string description = 4; - string author = 5; - string homepage = 6; - repeated string capabilities = 7; // "ui_tab", "ui_badge", "container_enrichment", etc. -} - -// GetTab - Returns UI tab configuration -message TabRequest { - string plugin_id = 1; -} - -message TabResponse { - bool has_tab = 1; - string id = 2; - string label = 3; - string icon = 4; - int32 order = 5; - string script_url = 6; // URL to frontend bundle - string css_url = 7; // URL to frontend CSS - string init_func = 8; // JavaScript function name to call -} - -// GetBadges - Returns badges to display on container cards -message BadgesRequest { - string plugin_id = 1; - Container container = 2; -} - -message BadgesResponse { - repeated Badge badges = 1; -} - -message Badge { - string id = 1; - string label = 2; - string icon = 3; - string color = 4; - string tooltip = 5; - string link = 6; - int32 priority = 7; -} - -// HandleRoute - Handles HTTP requests to plugin routes -message RouteRequest { - string plugin_id = 1; - string method = 2; // GET, POST, PUT, DELETE, etc. - string path = 3; // Path after /api/p/{plugin-id}/ - map headers = 4; - bytes body = 5; - map query_params = 6; - map path_params = 7; -} - -message RouteResponse { - int32 status_code = 1; - map headers = 2; - bytes body = 3; -} - -// EnrichContainer - Adds custom data to containers -message EnrichRequest { - string plugin_id = 1; - Container container = 2; -} - -message EnrichResponse { - map plugin_data = 1; // Data to add to container.plugin_data -} - -// HandleEvent - Receives system events -message EventRequest { - string plugin_id = 1; - string event_type = 2; // "scan_complete", "container_state_change", "image_updated", etc. - string timestamp = 3; - map data = 4; -} - -message EventResponse { - bool handled = 1; -} - -// GetSettings - Returns plugin settings schema -message SettingsRequest { - string plugin_id = 1; -} - -message SettingsResponse { - string schema_json = 1; // JSON schema for settings - string values_json = 2; // Current setting values as JSON -} - -// UpdateSettings - Updates plugin settings -message UpdateSettingsRequest { - string plugin_id = 1; - string values_json = 2; // New settings as JSON -} - -message UpdateSettingsResponse { - bool success = 1; - string error = 2; -} - -// ============================================================================ -// Census API Service Messages -// ============================================================================ - -// GetContainers - Fetch all containers -message GetContainersRequest { - string plugin_id = 1; - bool latest_only = 2; // If true, only return latest scan results - int64 host_id = 3; // If > 0, filter by host -} - -message GetContainersResponse { - repeated Container containers = 1; -} - -// GetContainer - Fetch specific container -message GetContainerRequest { - string plugin_id = 1; - string container_id = 2; - int64 host_id = 3; -} - -message GetContainerResponse { - Container container = 1; - bool found = 2; -} - -// GetHosts - Fetch all hosts -message GetHostsRequest { - string plugin_id = 1; -} - -message GetHostsResponse { - repeated Host hosts = 1; -} - -// GetHost - Fetch specific host -message GetHostRequest { - string plugin_id = 1; - int64 host_id = 2; -} - -message GetHostResponse { - Host host = 1; - bool found = 2; -} - -// GetPluginData - Fetch plugin-specific data from storage -message GetPluginDataRequest { - string plugin_id = 1; - string key = 2; -} - -message GetPluginDataResponse { - string value = 1; - bool found = 2; -} - -// SetPluginData - Store plugin-specific data -message SetPluginDataRequest { - string plugin_id = 1; - string key = 2; - string value = 3; -} - -message SetPluginDataResponse { - bool success = 1; -} - -// DeletePluginData - Delete plugin-specific data -message DeletePluginDataRequest { - string plugin_id = 1; - string key = 2; -} - -message DeletePluginDataResponse { - bool success = 1; -} - -// Log - Send log message to Census server -message LogRequest { - string plugin_id = 1; - string level = 2; // "debug", "info", "warn", "error" - string message = 3; - map fields = 4; -} - -message LogResponse { - bool success = 1; -} - -// SendEvent - Send event to other plugins -message SendEventRequest { - string plugin_id = 1; - string event_type = 2; - map data = 3; -} - -message SendEventResponse { - bool success = 1; -} - -// ============================================================================ -// Data Models -// ============================================================================ - -message Container { - string id = 1; - string name = 2; - string image = 3; - string image_id = 4; - string state = 5; - string status = 6; - int64 host_id = 7; - string host_name = 8; - string created = 9; - string started_at = 10; - string finished_at = 11; - repeated Port ports = 12; - repeated string networks = 13; - repeated Volume volumes = 14; - repeated string links = 15; - map labels = 16; - map env = 17; - string compose_project = 18; - - // Resource stats - double cpu_percent = 19; - int64 memory_usage = 20; - int64 memory_limit = 21; - double memory_percent = 22; - - // Plugin data - map plugin_data = 23; -} - -message Port { - int32 container_port = 1; - int32 host_port = 2; - string protocol = 3; - string host_ip = 4; -} - -message Volume { - string type = 1; // "bind", "volume", "tmpfs" - string name = 2; // Volume name (for named volumes) - string source = 3; // Host path - string destination = 4; // Container path - string mode = 5; // "rw", "ro" -} - -message Host { - int64 id = 1; - string name = 2; - string address = 3; - string host_type = 4; // "unix", "agent", "tcp", "ssh" - string description = 5; - bool enabled = 6; - bool collect_stats = 7; - string last_seen = 8; - string agent_version = 9; - string agent_status = 10; // "online", "offline", "auth_failed" -} diff --git a/internal/plugins/proto/plugin_grpc.pb.go b/internal/plugins/proto/plugin_grpc.pb.go deleted file mode 100644 index addd9c1..0000000 --- a/internal/plugins/proto/plugin_grpc.pb.go +++ /dev/null @@ -1,957 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.6.0 -// - protoc v5.29.3 -// source: internal/plugins/proto/plugin.proto - -package proto - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - Plugin_Init_FullMethodName = "/census.plugin.Plugin/Init" - Plugin_Start_FullMethodName = "/census.plugin.Plugin/Start" - Plugin_Stop_FullMethodName = "/census.plugin.Plugin/Stop" - Plugin_Healthcheck_FullMethodName = "/census.plugin.Plugin/Healthcheck" - Plugin_GetInfo_FullMethodName = "/census.plugin.Plugin/GetInfo" - Plugin_GetTab_FullMethodName = "/census.plugin.Plugin/GetTab" - Plugin_GetBadges_FullMethodName = "/census.plugin.Plugin/GetBadges" - Plugin_HandleRoute_FullMethodName = "/census.plugin.Plugin/HandleRoute" - Plugin_EnrichContainer_FullMethodName = "/census.plugin.Plugin/EnrichContainer" - Plugin_HandleEvent_FullMethodName = "/census.plugin.Plugin/HandleEvent" - Plugin_GetSettings_FullMethodName = "/census.plugin.Plugin/GetSettings" - Plugin_UpdateSettings_FullMethodName = "/census.plugin.Plugin/UpdateSettings" -) - -// PluginClient is the client API for Plugin service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Plugin service - implemented by external plugin processes -type PluginClient interface { - // Lifecycle methods - Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*InitResponse, error) - Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) - Stop(ctx context.Context, in *StopRequest, opts ...grpc.CallOption) (*StopResponse, error) - Healthcheck(ctx context.Context, in *HealthcheckRequest, opts ...grpc.CallOption) (*HealthcheckResponse, error) - // Capability methods - GetInfo(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error) - GetTab(ctx context.Context, in *TabRequest, opts ...grpc.CallOption) (*TabResponse, error) - GetBadges(ctx context.Context, in *BadgesRequest, opts ...grpc.CallOption) (*BadgesResponse, error) - HandleRoute(ctx context.Context, in *RouteRequest, opts ...grpc.CallOption) (*RouteResponse, error) - EnrichContainer(ctx context.Context, in *EnrichRequest, opts ...grpc.CallOption) (*EnrichResponse, error) - HandleEvent(ctx context.Context, in *EventRequest, opts ...grpc.CallOption) (*EventResponse, error) - GetSettings(ctx context.Context, in *SettingsRequest, opts ...grpc.CallOption) (*SettingsResponse, error) - UpdateSettings(ctx context.Context, in *UpdateSettingsRequest, opts ...grpc.CallOption) (*UpdateSettingsResponse, error) -} - -type pluginClient struct { - cc grpc.ClientConnInterface -} - -func NewPluginClient(cc grpc.ClientConnInterface) PluginClient { - return &pluginClient{cc} -} - -func (c *pluginClient) Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*InitResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(InitResponse) - err := c.cc.Invoke(ctx, Plugin_Init_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *pluginClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(StartResponse) - err := c.cc.Invoke(ctx, Plugin_Start_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *pluginClient) Stop(ctx context.Context, in *StopRequest, opts ...grpc.CallOption) (*StopResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(StopResponse) - err := c.cc.Invoke(ctx, Plugin_Stop_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *pluginClient) Healthcheck(ctx context.Context, in *HealthcheckRequest, opts ...grpc.CallOption) (*HealthcheckResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(HealthcheckResponse) - err := c.cc.Invoke(ctx, Plugin_Healthcheck_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *pluginClient) GetInfo(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(InfoResponse) - err := c.cc.Invoke(ctx, Plugin_GetInfo_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *pluginClient) GetTab(ctx context.Context, in *TabRequest, opts ...grpc.CallOption) (*TabResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(TabResponse) - err := c.cc.Invoke(ctx, Plugin_GetTab_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *pluginClient) GetBadges(ctx context.Context, in *BadgesRequest, opts ...grpc.CallOption) (*BadgesResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(BadgesResponse) - err := c.cc.Invoke(ctx, Plugin_GetBadges_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *pluginClient) HandleRoute(ctx context.Context, in *RouteRequest, opts ...grpc.CallOption) (*RouteResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(RouteResponse) - err := c.cc.Invoke(ctx, Plugin_HandleRoute_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *pluginClient) EnrichContainer(ctx context.Context, in *EnrichRequest, opts ...grpc.CallOption) (*EnrichResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(EnrichResponse) - err := c.cc.Invoke(ctx, Plugin_EnrichContainer_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *pluginClient) HandleEvent(ctx context.Context, in *EventRequest, opts ...grpc.CallOption) (*EventResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(EventResponse) - err := c.cc.Invoke(ctx, Plugin_HandleEvent_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *pluginClient) GetSettings(ctx context.Context, in *SettingsRequest, opts ...grpc.CallOption) (*SettingsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(SettingsResponse) - err := c.cc.Invoke(ctx, Plugin_GetSettings_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *pluginClient) UpdateSettings(ctx context.Context, in *UpdateSettingsRequest, opts ...grpc.CallOption) (*UpdateSettingsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(UpdateSettingsResponse) - err := c.cc.Invoke(ctx, Plugin_UpdateSettings_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// PluginServer is the server API for Plugin service. -// All implementations must embed UnimplementedPluginServer -// for forward compatibility. -// -// Plugin service - implemented by external plugin processes -type PluginServer interface { - // Lifecycle methods - Init(context.Context, *InitRequest) (*InitResponse, error) - Start(context.Context, *StartRequest) (*StartResponse, error) - Stop(context.Context, *StopRequest) (*StopResponse, error) - Healthcheck(context.Context, *HealthcheckRequest) (*HealthcheckResponse, error) - // Capability methods - GetInfo(context.Context, *InfoRequest) (*InfoResponse, error) - GetTab(context.Context, *TabRequest) (*TabResponse, error) - GetBadges(context.Context, *BadgesRequest) (*BadgesResponse, error) - HandleRoute(context.Context, *RouteRequest) (*RouteResponse, error) - EnrichContainer(context.Context, *EnrichRequest) (*EnrichResponse, error) - HandleEvent(context.Context, *EventRequest) (*EventResponse, error) - GetSettings(context.Context, *SettingsRequest) (*SettingsResponse, error) - UpdateSettings(context.Context, *UpdateSettingsRequest) (*UpdateSettingsResponse, error) - mustEmbedUnimplementedPluginServer() -} - -// UnimplementedPluginServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedPluginServer struct{} - -func (UnimplementedPluginServer) Init(context.Context, *InitRequest) (*InitResponse, error) { - return nil, status.Error(codes.Unimplemented, "method Init not implemented") -} -func (UnimplementedPluginServer) Start(context.Context, *StartRequest) (*StartResponse, error) { - return nil, status.Error(codes.Unimplemented, "method Start not implemented") -} -func (UnimplementedPluginServer) Stop(context.Context, *StopRequest) (*StopResponse, error) { - return nil, status.Error(codes.Unimplemented, "method Stop not implemented") -} -func (UnimplementedPluginServer) Healthcheck(context.Context, *HealthcheckRequest) (*HealthcheckResponse, error) { - return nil, status.Error(codes.Unimplemented, "method Healthcheck not implemented") -} -func (UnimplementedPluginServer) GetInfo(context.Context, *InfoRequest) (*InfoResponse, error) { - return nil, status.Error(codes.Unimplemented, "method GetInfo not implemented") -} -func (UnimplementedPluginServer) GetTab(context.Context, *TabRequest) (*TabResponse, error) { - return nil, status.Error(codes.Unimplemented, "method GetTab not implemented") -} -func (UnimplementedPluginServer) GetBadges(context.Context, *BadgesRequest) (*BadgesResponse, error) { - return nil, status.Error(codes.Unimplemented, "method GetBadges not implemented") -} -func (UnimplementedPluginServer) HandleRoute(context.Context, *RouteRequest) (*RouteResponse, error) { - return nil, status.Error(codes.Unimplemented, "method HandleRoute not implemented") -} -func (UnimplementedPluginServer) EnrichContainer(context.Context, *EnrichRequest) (*EnrichResponse, error) { - return nil, status.Error(codes.Unimplemented, "method EnrichContainer not implemented") -} -func (UnimplementedPluginServer) HandleEvent(context.Context, *EventRequest) (*EventResponse, error) { - return nil, status.Error(codes.Unimplemented, "method HandleEvent not implemented") -} -func (UnimplementedPluginServer) GetSettings(context.Context, *SettingsRequest) (*SettingsResponse, error) { - return nil, status.Error(codes.Unimplemented, "method GetSettings not implemented") -} -func (UnimplementedPluginServer) UpdateSettings(context.Context, *UpdateSettingsRequest) (*UpdateSettingsResponse, error) { - return nil, status.Error(codes.Unimplemented, "method UpdateSettings not implemented") -} -func (UnimplementedPluginServer) mustEmbedUnimplementedPluginServer() {} -func (UnimplementedPluginServer) testEmbeddedByValue() {} - -// UnsafePluginServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to PluginServer will -// result in compilation errors. -type UnsafePluginServer interface { - mustEmbedUnimplementedPluginServer() -} - -func RegisterPluginServer(s grpc.ServiceRegistrar, srv PluginServer) { - // If the following call panics, it indicates UnimplementedPluginServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&Plugin_ServiceDesc, srv) -} - -func _Plugin_Init_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(InitRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PluginServer).Init(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Plugin_Init_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PluginServer).Init(ctx, req.(*InitRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Plugin_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StartRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PluginServer).Start(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Plugin_Start_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PluginServer).Start(ctx, req.(*StartRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Plugin_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StopRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PluginServer).Stop(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Plugin_Stop_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PluginServer).Stop(ctx, req.(*StopRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Plugin_Healthcheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(HealthcheckRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PluginServer).Healthcheck(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Plugin_Healthcheck_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PluginServer).Healthcheck(ctx, req.(*HealthcheckRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Plugin_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(InfoRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PluginServer).GetInfo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Plugin_GetInfo_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PluginServer).GetInfo(ctx, req.(*InfoRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Plugin_GetTab_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(TabRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PluginServer).GetTab(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Plugin_GetTab_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PluginServer).GetTab(ctx, req.(*TabRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Plugin_GetBadges_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(BadgesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PluginServer).GetBadges(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Plugin_GetBadges_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PluginServer).GetBadges(ctx, req.(*BadgesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Plugin_HandleRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RouteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PluginServer).HandleRoute(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Plugin_HandleRoute_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PluginServer).HandleRoute(ctx, req.(*RouteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Plugin_EnrichContainer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(EnrichRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PluginServer).EnrichContainer(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Plugin_EnrichContainer_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PluginServer).EnrichContainer(ctx, req.(*EnrichRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Plugin_HandleEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(EventRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PluginServer).HandleEvent(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Plugin_HandleEvent_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PluginServer).HandleEvent(ctx, req.(*EventRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Plugin_GetSettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SettingsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PluginServer).GetSettings(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Plugin_GetSettings_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PluginServer).GetSettings(ctx, req.(*SettingsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Plugin_UpdateSettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateSettingsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PluginServer).UpdateSettings(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Plugin_UpdateSettings_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PluginServer).UpdateSettings(ctx, req.(*UpdateSettingsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Plugin_ServiceDesc is the grpc.ServiceDesc for Plugin service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Plugin_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "census.plugin.Plugin", - HandlerType: (*PluginServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Init", - Handler: _Plugin_Init_Handler, - }, - { - MethodName: "Start", - Handler: _Plugin_Start_Handler, - }, - { - MethodName: "Stop", - Handler: _Plugin_Stop_Handler, - }, - { - MethodName: "Healthcheck", - Handler: _Plugin_Healthcheck_Handler, - }, - { - MethodName: "GetInfo", - Handler: _Plugin_GetInfo_Handler, - }, - { - MethodName: "GetTab", - Handler: _Plugin_GetTab_Handler, - }, - { - MethodName: "GetBadges", - Handler: _Plugin_GetBadges_Handler, - }, - { - MethodName: "HandleRoute", - Handler: _Plugin_HandleRoute_Handler, - }, - { - MethodName: "EnrichContainer", - Handler: _Plugin_EnrichContainer_Handler, - }, - { - MethodName: "HandleEvent", - Handler: _Plugin_HandleEvent_Handler, - }, - { - MethodName: "GetSettings", - Handler: _Plugin_GetSettings_Handler, - }, - { - MethodName: "UpdateSettings", - Handler: _Plugin_UpdateSettings_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "internal/plugins/proto/plugin.proto", -} - -const ( - CensusAPI_GetContainers_FullMethodName = "/census.plugin.CensusAPI/GetContainers" - CensusAPI_GetContainer_FullMethodName = "/census.plugin.CensusAPI/GetContainer" - CensusAPI_GetHosts_FullMethodName = "/census.plugin.CensusAPI/GetHosts" - CensusAPI_GetHost_FullMethodName = "/census.plugin.CensusAPI/GetHost" - CensusAPI_GetPluginData_FullMethodName = "/census.plugin.CensusAPI/GetPluginData" - CensusAPI_SetPluginData_FullMethodName = "/census.plugin.CensusAPI/SetPluginData" - CensusAPI_DeletePluginData_FullMethodName = "/census.plugin.CensusAPI/DeletePluginData" - CensusAPI_Log_FullMethodName = "/census.plugin.CensusAPI/Log" - CensusAPI_SendEvent_FullMethodName = "/census.plugin.CensusAPI/SendEvent" -) - -// CensusAPIClient is the client API for CensusAPI service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Census API service - implemented by main server (callback API for plugins) -type CensusAPIClient interface { - GetContainers(ctx context.Context, in *GetContainersRequest, opts ...grpc.CallOption) (*GetContainersResponse, error) - GetContainer(ctx context.Context, in *GetContainerRequest, opts ...grpc.CallOption) (*GetContainerResponse, error) - GetHosts(ctx context.Context, in *GetHostsRequest, opts ...grpc.CallOption) (*GetHostsResponse, error) - GetHost(ctx context.Context, in *GetHostRequest, opts ...grpc.CallOption) (*GetHostResponse, error) - GetPluginData(ctx context.Context, in *GetPluginDataRequest, opts ...grpc.CallOption) (*GetPluginDataResponse, error) - SetPluginData(ctx context.Context, in *SetPluginDataRequest, opts ...grpc.CallOption) (*SetPluginDataResponse, error) - DeletePluginData(ctx context.Context, in *DeletePluginDataRequest, opts ...grpc.CallOption) (*DeletePluginDataResponse, error) - Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (*LogResponse, error) - SendEvent(ctx context.Context, in *SendEventRequest, opts ...grpc.CallOption) (*SendEventResponse, error) -} - -type censusAPIClient struct { - cc grpc.ClientConnInterface -} - -func NewCensusAPIClient(cc grpc.ClientConnInterface) CensusAPIClient { - return &censusAPIClient{cc} -} - -func (c *censusAPIClient) GetContainers(ctx context.Context, in *GetContainersRequest, opts ...grpc.CallOption) (*GetContainersResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(GetContainersResponse) - err := c.cc.Invoke(ctx, CensusAPI_GetContainers_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *censusAPIClient) GetContainer(ctx context.Context, in *GetContainerRequest, opts ...grpc.CallOption) (*GetContainerResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(GetContainerResponse) - err := c.cc.Invoke(ctx, CensusAPI_GetContainer_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *censusAPIClient) GetHosts(ctx context.Context, in *GetHostsRequest, opts ...grpc.CallOption) (*GetHostsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(GetHostsResponse) - err := c.cc.Invoke(ctx, CensusAPI_GetHosts_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *censusAPIClient) GetHost(ctx context.Context, in *GetHostRequest, opts ...grpc.CallOption) (*GetHostResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(GetHostResponse) - err := c.cc.Invoke(ctx, CensusAPI_GetHost_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *censusAPIClient) GetPluginData(ctx context.Context, in *GetPluginDataRequest, opts ...grpc.CallOption) (*GetPluginDataResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(GetPluginDataResponse) - err := c.cc.Invoke(ctx, CensusAPI_GetPluginData_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *censusAPIClient) SetPluginData(ctx context.Context, in *SetPluginDataRequest, opts ...grpc.CallOption) (*SetPluginDataResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(SetPluginDataResponse) - err := c.cc.Invoke(ctx, CensusAPI_SetPluginData_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *censusAPIClient) DeletePluginData(ctx context.Context, in *DeletePluginDataRequest, opts ...grpc.CallOption) (*DeletePluginDataResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(DeletePluginDataResponse) - err := c.cc.Invoke(ctx, CensusAPI_DeletePluginData_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *censusAPIClient) Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (*LogResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(LogResponse) - err := c.cc.Invoke(ctx, CensusAPI_Log_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *censusAPIClient) SendEvent(ctx context.Context, in *SendEventRequest, opts ...grpc.CallOption) (*SendEventResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(SendEventResponse) - err := c.cc.Invoke(ctx, CensusAPI_SendEvent_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// CensusAPIServer is the server API for CensusAPI service. -// All implementations must embed UnimplementedCensusAPIServer -// for forward compatibility. -// -// Census API service - implemented by main server (callback API for plugins) -type CensusAPIServer interface { - GetContainers(context.Context, *GetContainersRequest) (*GetContainersResponse, error) - GetContainer(context.Context, *GetContainerRequest) (*GetContainerResponse, error) - GetHosts(context.Context, *GetHostsRequest) (*GetHostsResponse, error) - GetHost(context.Context, *GetHostRequest) (*GetHostResponse, error) - GetPluginData(context.Context, *GetPluginDataRequest) (*GetPluginDataResponse, error) - SetPluginData(context.Context, *SetPluginDataRequest) (*SetPluginDataResponse, error) - DeletePluginData(context.Context, *DeletePluginDataRequest) (*DeletePluginDataResponse, error) - Log(context.Context, *LogRequest) (*LogResponse, error) - SendEvent(context.Context, *SendEventRequest) (*SendEventResponse, error) - mustEmbedUnimplementedCensusAPIServer() -} - -// UnimplementedCensusAPIServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedCensusAPIServer struct{} - -func (UnimplementedCensusAPIServer) GetContainers(context.Context, *GetContainersRequest) (*GetContainersResponse, error) { - return nil, status.Error(codes.Unimplemented, "method GetContainers not implemented") -} -func (UnimplementedCensusAPIServer) GetContainer(context.Context, *GetContainerRequest) (*GetContainerResponse, error) { - return nil, status.Error(codes.Unimplemented, "method GetContainer not implemented") -} -func (UnimplementedCensusAPIServer) GetHosts(context.Context, *GetHostsRequest) (*GetHostsResponse, error) { - return nil, status.Error(codes.Unimplemented, "method GetHosts not implemented") -} -func (UnimplementedCensusAPIServer) GetHost(context.Context, *GetHostRequest) (*GetHostResponse, error) { - return nil, status.Error(codes.Unimplemented, "method GetHost not implemented") -} -func (UnimplementedCensusAPIServer) GetPluginData(context.Context, *GetPluginDataRequest) (*GetPluginDataResponse, error) { - return nil, status.Error(codes.Unimplemented, "method GetPluginData not implemented") -} -func (UnimplementedCensusAPIServer) SetPluginData(context.Context, *SetPluginDataRequest) (*SetPluginDataResponse, error) { - return nil, status.Error(codes.Unimplemented, "method SetPluginData not implemented") -} -func (UnimplementedCensusAPIServer) DeletePluginData(context.Context, *DeletePluginDataRequest) (*DeletePluginDataResponse, error) { - return nil, status.Error(codes.Unimplemented, "method DeletePluginData not implemented") -} -func (UnimplementedCensusAPIServer) Log(context.Context, *LogRequest) (*LogResponse, error) { - return nil, status.Error(codes.Unimplemented, "method Log not implemented") -} -func (UnimplementedCensusAPIServer) SendEvent(context.Context, *SendEventRequest) (*SendEventResponse, error) { - return nil, status.Error(codes.Unimplemented, "method SendEvent not implemented") -} -func (UnimplementedCensusAPIServer) mustEmbedUnimplementedCensusAPIServer() {} -func (UnimplementedCensusAPIServer) testEmbeddedByValue() {} - -// UnsafeCensusAPIServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to CensusAPIServer will -// result in compilation errors. -type UnsafeCensusAPIServer interface { - mustEmbedUnimplementedCensusAPIServer() -} - -func RegisterCensusAPIServer(s grpc.ServiceRegistrar, srv CensusAPIServer) { - // If the following call panics, it indicates UnimplementedCensusAPIServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&CensusAPI_ServiceDesc, srv) -} - -func _CensusAPI_GetContainers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetContainersRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CensusAPIServer).GetContainers(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CensusAPI_GetContainers_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CensusAPIServer).GetContainers(ctx, req.(*GetContainersRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CensusAPI_GetContainer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetContainerRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CensusAPIServer).GetContainer(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CensusAPI_GetContainer_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CensusAPIServer).GetContainer(ctx, req.(*GetContainerRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CensusAPI_GetHosts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetHostsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CensusAPIServer).GetHosts(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CensusAPI_GetHosts_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CensusAPIServer).GetHosts(ctx, req.(*GetHostsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CensusAPI_GetHost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetHostRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CensusAPIServer).GetHost(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CensusAPI_GetHost_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CensusAPIServer).GetHost(ctx, req.(*GetHostRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CensusAPI_GetPluginData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetPluginDataRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CensusAPIServer).GetPluginData(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CensusAPI_GetPluginData_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CensusAPIServer).GetPluginData(ctx, req.(*GetPluginDataRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CensusAPI_SetPluginData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SetPluginDataRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CensusAPIServer).SetPluginData(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CensusAPI_SetPluginData_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CensusAPIServer).SetPluginData(ctx, req.(*SetPluginDataRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CensusAPI_DeletePluginData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeletePluginDataRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CensusAPIServer).DeletePluginData(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CensusAPI_DeletePluginData_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CensusAPIServer).DeletePluginData(ctx, req.(*DeletePluginDataRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CensusAPI_Log_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LogRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CensusAPIServer).Log(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CensusAPI_Log_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CensusAPIServer).Log(ctx, req.(*LogRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CensusAPI_SendEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SendEventRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CensusAPIServer).SendEvent(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CensusAPI_SendEvent_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CensusAPIServer).SendEvent(ctx, req.(*SendEventRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// CensusAPI_ServiceDesc is the grpc.ServiceDesc for CensusAPI service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var CensusAPI_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "census.plugin.CensusAPI", - HandlerType: (*CensusAPIServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetContainers", - Handler: _CensusAPI_GetContainers_Handler, - }, - { - MethodName: "GetContainer", - Handler: _CensusAPI_GetContainer_Handler, - }, - { - MethodName: "GetHosts", - Handler: _CensusAPI_GetHosts_Handler, - }, - { - MethodName: "GetHost", - Handler: _CensusAPI_GetHost_Handler, - }, - { - MethodName: "GetPluginData", - Handler: _CensusAPI_GetPluginData_Handler, - }, - { - MethodName: "SetPluginData", - Handler: _CensusAPI_SetPluginData_Handler, - }, - { - MethodName: "DeletePluginData", - Handler: _CensusAPI_DeletePluginData_Handler, - }, - { - MethodName: "Log", - Handler: _CensusAPI_Log_Handler, - }, - { - MethodName: "SendEvent", - Handler: _CensusAPI_SendEvent_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "internal/plugins/proto/plugin.proto", -} diff --git a/server b/server new file mode 100755 index 0000000..a93a230 Binary files /dev/null and b/server differ diff --git a/telemetry-collector b/telemetry-collector new file mode 100755 index 0000000..3e3793e Binary files /dev/null and b/telemetry-collector differ