diff --git a/.gitea/workflows/go.yml b/.gitea/workflows/go.yml index 5279a13..d7e3652 100644 --- a/.gitea/workflows/go.yml +++ b/.gitea/workflows/go.yml @@ -36,6 +36,12 @@ jobs: echo "Cloned successfully. Last commit:" git log -1 + - name: Install dependencies + run: | + set -e + echo "Installing jq..." + sudo apt-get update && sudo apt-get install -y jq + - name: Set up Go run: | set -e diff --git a/cmd/orly-launcher/config.go b/cmd/orly-launcher/config.go index 12ebb19..aab7b2b 100644 --- a/cmd/orly-launcher/config.go +++ b/cmd/orly-launcher/config.go @@ -1,6 +1,7 @@ package main import ( + "encoding/json" "os" "path/filepath" "strconv" @@ -10,6 +11,102 @@ import ( "github.com/adrg/xdg" ) +// ConfigFile is the JSON structure for persistent configuration. +type ConfigFile struct { + DBBackend string `json:"db_backend,omitempty"` + DBBinary string `json:"db_binary,omitempty"` + RelayBinary string `json:"relay_binary,omitempty"` + ACLBinary string `json:"acl_binary,omitempty"` + DBListen string `json:"db_listen,omitempty"` + ACLListen string `json:"acl_listen,omitempty"` + ACLEnabled *bool `json:"acl_enabled,omitempty"` + ACLMode string `json:"acl_mode,omitempty"` + DataDir string `json:"data_dir,omitempty"` + LogLevel string `json:"log_level,omitempty"` + AdminPort *int `json:"admin_port,omitempty"` + AdminOwners []string `json:"admin_owners,omitempty"` + BinDir string `json:"bin_dir,omitempty"` + RelayPort *int `json:"relay_port,omitempty"` + RelayHost string `json:"relay_host,omitempty"` + TLSDomains string `json:"tls_domains,omitempty"` + AuthToWrite *bool `json:"auth_to_write,omitempty"` + AuthRequired *bool `json:"auth_required,omitempty"` + + // Sync services + DistributedSyncEnabled *bool `json:"distributed_sync_enabled,omitempty"` + ClusterSyncEnabled *bool `json:"cluster_sync_enabled,omitempty"` + RelayGroupEnabled *bool `json:"relay_group_enabled,omitempty"` + NegentropyEnabled *bool `json:"negentropy_enabled,omitempty"` + NegentropyBinary string `json:"negentropy_binary,omitempty"` + NegentropyListen string `json:"negentropy_listen,omitempty"` +} + +// configFilePath returns the path to the config file. +func configFilePath() string { + return filepath.Join(xdg.ConfigHome, "orly", "launcher.json") +} + +// loadConfigFile loads configuration from the JSON file if it exists. +func loadConfigFile() (*ConfigFile, error) { + path := configFilePath() + data, err := os.ReadFile(path) + if err != nil { + if os.IsNotExist(err) { + return &ConfigFile{}, nil + } + return nil, err + } + + var cf ConfigFile + if err := json.Unmarshal(data, &cf); err != nil { + return nil, err + } + return &cf, nil +} + +// SaveConfigFile saves the configuration to the JSON file. +func SaveConfigFile(cf *ConfigFile) error { + path := configFilePath() + + // Ensure directory exists + dir := filepath.Dir(path) + if err := os.MkdirAll(dir, 0755); err != nil { + return err + } + + data, err := json.MarshalIndent(cf, "", " ") + if err != nil { + return err + } + + return os.WriteFile(path, data, 0644) +} + +// ConfigToFile converts a Config to a ConfigFile for persistence. +func ConfigToFile(cfg *Config) *ConfigFile { + return &ConfigFile{ + DBBackend: cfg.DBBackend, + DBBinary: cfg.DBBinary, + RelayBinary: cfg.RelayBinary, + ACLBinary: cfg.ACLBinary, + DBListen: cfg.DBListen, + ACLListen: cfg.ACLListen, + ACLEnabled: &cfg.ACLEnabled, + ACLMode: cfg.ACLMode, + DataDir: cfg.DataDir, + LogLevel: cfg.LogLevel, + AdminPort: &cfg.AdminPort, + AdminOwners: cfg.AdminOwners, + BinDir: cfg.BinDir, + DistributedSyncEnabled: &cfg.DistributedSyncEnabled, + ClusterSyncEnabled: &cfg.ClusterSyncEnabled, + RelayGroupEnabled: &cfg.RelayGroupEnabled, + NegentropyEnabled: &cfg.NegentropyEnabled, + NegentropyBinary: cfg.NegentropyBinary, + NegentropyListen: cfg.NegentropyListen, + } +} + // Config holds the launcher configuration. type Config struct { // DBBackend is the database backend: badger or neo4j @@ -97,61 +194,117 @@ type Config struct { } func loadConfig() (*Config, error) { - // Get backend and mode first to compute default binary names - dbBackend := getEnvOrDefault("ORLY_LAUNCHER_DB_BACKEND", "badger") - aclMode := getEnvOrDefault("ORLY_ACL_MODE", "follows") + // Load config file first (provides defaults) + cf, err := loadConfigFile() + if err != nil { + // Log but don't fail - env vars are still valid + cf = &ConfigFile{} + } + + // Get backend and mode - file first, then env + dbBackend := stringOr(cf.DBBackend, getEnvOrDefault("ORLY_LAUNCHER_DB_BACKEND", "badger")) + aclMode := stringOr(cf.ACLMode, getEnvOrDefault("ORLY_ACL_MODE", "follows")) // Compute default binary names based on backend/mode defaultDBBinary := "orly-db-" + dbBackend defaultACLBinary := "orly-acl-" + aclMode - // Parse admin owners (comma-separated hex pubkeys) - adminOwners := parseOwnersList(getEnvOrDefault("ORLY_LAUNCHER_OWNERS", "")) + // Parse admin owners - env takes precedence, then file + envOwners := getEnvOrDefault("ORLY_LAUNCHER_OWNERS", "") + var adminOwners []string + if envOwners != "" { + adminOwners = parseOwnersList(envOwners) + } else if len(cf.AdminOwners) > 0 { + adminOwners = cf.AdminOwners + } cfg := &Config{ DBBackend: dbBackend, - DBBinary: getEnvOrDefault("ORLY_LAUNCHER_DB_BINARY", defaultDBBinary), - RelayBinary: getEnvOrDefault("ORLY_LAUNCHER_RELAY_BINARY", "orly"), - ACLBinary: getEnvOrDefault("ORLY_LAUNCHER_ACL_BINARY", defaultACLBinary), - DBListen: getEnvOrDefault("ORLY_LAUNCHER_DB_LISTEN", "127.0.0.1:50051"), - ACLListen: getEnvOrDefault("ORLY_LAUNCHER_ACL_LISTEN", "127.0.0.1:50052"), - ACLEnabled: getEnvOrDefault("ORLY_LAUNCHER_ACL_ENABLED", "false") == "true", + DBBinary: envOrFileOrDefault("ORLY_LAUNCHER_DB_BINARY", cf.DBBinary, defaultDBBinary), + RelayBinary: envOrFileOrDefault("ORLY_LAUNCHER_RELAY_BINARY", cf.RelayBinary, "orly"), + ACLBinary: envOrFileOrDefault("ORLY_LAUNCHER_ACL_BINARY", cf.ACLBinary, defaultACLBinary), + DBListen: envOrFileOrDefault("ORLY_LAUNCHER_DB_LISTEN", cf.DBListen, "127.0.0.1:50051"), + ACLListen: envOrFileOrDefault("ORLY_LAUNCHER_ACL_LISTEN", cf.ACLListen, "127.0.0.1:50052"), + ACLEnabled: boolEnvOrFile("ORLY_LAUNCHER_ACL_ENABLED", cf.ACLEnabled, false), ACLMode: aclMode, DBReadyTimeout: parseDuration("ORLY_LAUNCHER_DB_READY_TIMEOUT", 30*time.Second), ACLReadyTimeout: parseDuration("ORLY_LAUNCHER_ACL_READY_TIMEOUT", 120*time.Second), - StopTimeout: parseDuration("ORLY_LAUNCHER_STOP_TIMEOUT", 30*time.Second), // Increased for DB flush - DataDir: getEnvOrDefault("ORLY_DATA_DIR", filepath.Join(xdg.DataHome, "ORLY")), - LogLevel: getEnvOrDefault("ORLY_LOG_LEVEL", "info"), + StopTimeout: parseDuration("ORLY_LAUNCHER_STOP_TIMEOUT", 30*time.Second), + DataDir: envOrFileOrDefault("ORLY_DATA_DIR", cf.DataDir, filepath.Join(xdg.DataHome, "ORLY")), + LogLevel: envOrFileOrDefault("ORLY_LOG_LEVEL", cf.LogLevel, "info"), // Sync services configuration - DistributedSyncEnabled: getEnvOrDefault("ORLY_LAUNCHER_SYNC_DISTRIBUTED_ENABLED", "false") == "true", + DistributedSyncEnabled: boolEnvOrFile("ORLY_LAUNCHER_SYNC_DISTRIBUTED_ENABLED", cf.DistributedSyncEnabled, false), DistributedSyncBinary: getEnvOrDefault("ORLY_LAUNCHER_SYNC_DISTRIBUTED_BINARY", "orly-sync-distributed"), DistributedSyncListen: getEnvOrDefault("ORLY_LAUNCHER_SYNC_DISTRIBUTED_LISTEN", "127.0.0.1:50061"), - ClusterSyncEnabled: getEnvOrDefault("ORLY_LAUNCHER_SYNC_CLUSTER_ENABLED", "false") == "true", + ClusterSyncEnabled: boolEnvOrFile("ORLY_LAUNCHER_SYNC_CLUSTER_ENABLED", cf.ClusterSyncEnabled, false), ClusterSyncBinary: getEnvOrDefault("ORLY_LAUNCHER_SYNC_CLUSTER_BINARY", "orly-sync-cluster"), ClusterSyncListen: getEnvOrDefault("ORLY_LAUNCHER_SYNC_CLUSTER_LISTEN", "127.0.0.1:50062"), - RelayGroupEnabled: getEnvOrDefault("ORLY_LAUNCHER_SYNC_RELAYGROUP_ENABLED", "false") == "true", + RelayGroupEnabled: boolEnvOrFile("ORLY_LAUNCHER_SYNC_RELAYGROUP_ENABLED", cf.RelayGroupEnabled, false), RelayGroupBinary: getEnvOrDefault("ORLY_LAUNCHER_SYNC_RELAYGROUP_BINARY", "orly-sync-relaygroup"), RelayGroupListen: getEnvOrDefault("ORLY_LAUNCHER_SYNC_RELAYGROUP_LISTEN", "127.0.0.1:50063"), - NegentropyEnabled: getEnvOrDefault("ORLY_LAUNCHER_SYNC_NEGENTROPY_ENABLED", "false") == "true", - NegentropyBinary: getEnvOrDefault("ORLY_LAUNCHER_SYNC_NEGENTROPY_BINARY", "orly-sync-negentropy"), - NegentropyListen: getEnvOrDefault("ORLY_LAUNCHER_SYNC_NEGENTROPY_LISTEN", "127.0.0.1:50064"), + NegentropyEnabled: boolEnvOrFile("ORLY_LAUNCHER_SYNC_NEGENTROPY_ENABLED", cf.NegentropyEnabled, false), + NegentropyBinary: envOrFileOrDefault("ORLY_LAUNCHER_SYNC_NEGENTROPY_BINARY", cf.NegentropyBinary, "orly-sync-negentropy"), + NegentropyListen: envOrFileOrDefault("ORLY_LAUNCHER_SYNC_NEGENTROPY_LISTEN", cf.NegentropyListen, "127.0.0.1:50064"), SyncReadyTimeout: parseDuration("ORLY_LAUNCHER_SYNC_READY_TIMEOUT", 30*time.Second), // Admin UI configuration AdminEnabled: getEnvOrDefault("ORLY_LAUNCHER_ADMIN_ENABLED", "true") == "true", - AdminPort: parseInt("ORLY_LAUNCHER_ADMIN_PORT", 8080), + AdminPort: intEnvOrFile("ORLY_LAUNCHER_ADMIN_PORT", cf.AdminPort, 8080), AdminOwners: adminOwners, - BinDir: getEnvOrDefault("ORLY_LAUNCHER_BIN_DIR", filepath.Join(xdg.DataHome, "orly", "bin")), + BinDir: envOrFileOrDefault("ORLY_LAUNCHER_BIN_DIR", cf.BinDir, filepath.Join(xdg.DataHome, "orly", "bin")), } return cfg, nil } +// stringOr returns the first non-empty string. +func stringOr(a, b string) string { + if a != "" { + return a + } + return b +} + +// envOrFileOrDefault returns env var if set, then file value if set, then default. +func envOrFileOrDefault(envKey, fileValue, defaultValue string) string { + if v := os.Getenv(envKey); v != "" { + return v + } + if fileValue != "" { + return fileValue + } + return defaultValue +} + +// boolEnvOrFile returns env var if set, then file value if set, then default. +func boolEnvOrFile(envKey string, fileValue *bool, defaultValue bool) bool { + if v := os.Getenv(envKey); v != "" { + return v == "true" + } + if fileValue != nil { + return *fileValue + } + return defaultValue +} + +// intEnvOrFile returns env var if set, then file value if set, then default. +func intEnvOrFile(envKey string, fileValue *int, defaultValue int) int { + if v := os.Getenv(envKey); v != "" { + if i, err := strconv.Atoi(v); err == nil { + return i + } + } + if fileValue != nil { + return *fileValue + } + return defaultValue +} + func parseOwnersList(s string) []string { if s == "" { return nil diff --git a/cmd/orly-launcher/server.go b/cmd/orly-launcher/server.go index 6cf1ae0..d496c6a 100644 --- a/cmd/orly-launcher/server.go +++ b/cmd/orly-launcher/server.go @@ -158,9 +158,132 @@ func (s *AdminServer) handleGetConfig(w http.ResponseWriter, r *http.Request) { json.NewEncoder(w).Encode(response) } +// SetConfigRequest is the request body for POST /api/config +type SetConfigRequest struct { + DBBackend string `json:"db_backend,omitempty"` + DBBinary string `json:"db_binary,omitempty"` + RelayBinary string `json:"relay_binary,omitempty"` + ACLBinary string `json:"acl_binary,omitempty"` + DBListen string `json:"db_listen,omitempty"` + ACLListen string `json:"acl_listen,omitempty"` + ACLEnabled *bool `json:"acl_enabled,omitempty"` + ACLMode string `json:"acl_mode,omitempty"` + DataDir string `json:"data_dir,omitempty"` + LogLevel string `json:"log_level,omitempty"` + AdminPort *int `json:"admin_port,omitempty"` + AdminOwners []string `json:"admin_owners,omitempty"` + BinDir string `json:"bin_dir,omitempty"` + DistributedSyncEnabled *bool `json:"distributed_sync_enabled,omitempty"` + ClusterSyncEnabled *bool `json:"cluster_sync_enabled,omitempty"` + RelayGroupEnabled *bool `json:"relay_group_enabled,omitempty"` + NegentropyEnabled *bool `json:"negentropy_enabled,omitempty"` +} + +// SetConfigResponse is the response for POST /api/config +type SetConfigResponse struct { + Success bool `json:"success"` + Message string `json:"message"` + RestartNeeded bool `json:"restart_needed"` + ConfigFilePath string `json:"config_file_path"` +} + func (s *AdminServer) handleSetConfig(w http.ResponseWriter, r *http.Request) { - // TODO: Implement config update (requires restart) - http.Error(w, "Config update not implemented yet", http.StatusNotImplemented) + var req SetConfigRequest + if err := json.NewDecoder(r.Body).Decode(&req); chk.E(err) { + http.Error(w, "Invalid request body", http.StatusBadRequest) + return + } + + // Load existing config file or create new + cf, err := loadConfigFile() + if chk.E(err) { + cf = &ConfigFile{} + } + + // Update only fields that were provided + if req.DBBackend != "" { + cf.DBBackend = req.DBBackend + } + if req.DBBinary != "" { + cf.DBBinary = req.DBBinary + } + if req.RelayBinary != "" { + cf.RelayBinary = req.RelayBinary + } + if req.ACLBinary != "" { + cf.ACLBinary = req.ACLBinary + } + if req.DBListen != "" { + cf.DBListen = req.DBListen + } + if req.ACLListen != "" { + cf.ACLListen = req.ACLListen + } + if req.ACLEnabled != nil { + cf.ACLEnabled = req.ACLEnabled + } + if req.ACLMode != "" { + cf.ACLMode = req.ACLMode + } + if req.DataDir != "" { + cf.DataDir = req.DataDir + } + if req.LogLevel != "" { + cf.LogLevel = req.LogLevel + } + if req.AdminPort != nil { + cf.AdminPort = req.AdminPort + } + if req.AdminOwners != nil { + cf.AdminOwners = req.AdminOwners + } + if req.BinDir != "" { + cf.BinDir = req.BinDir + } + if req.DistributedSyncEnabled != nil { + cf.DistributedSyncEnabled = req.DistributedSyncEnabled + } + if req.ClusterSyncEnabled != nil { + cf.ClusterSyncEnabled = req.ClusterSyncEnabled + } + if req.RelayGroupEnabled != nil { + cf.RelayGroupEnabled = req.RelayGroupEnabled + } + if req.NegentropyEnabled != nil { + cf.NegentropyEnabled = req.NegentropyEnabled + } + + // Save to file + if err := SaveConfigFile(cf); chk.E(err) { + response := SetConfigResponse{ + Success: false, + Message: fmt.Sprintf("Failed to save config: %v", err), + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusInternalServerError) + json.NewEncoder(w).Encode(response) + return + } + + // Update auth middleware if owners changed + if req.AdminOwners != nil { + for _, owner := range s.auth.Owners() { + s.auth.RemoveOwner(owner) + } + for _, owner := range req.AdminOwners { + s.auth.AddOwner(owner) + } + } + + response := SetConfigResponse{ + Success: true, + Message: "Configuration saved. Restart required for most changes to take effect.", + RestartNeeded: true, + ConfigFilePath: configFilePath(), + } + + w.Header().Set("Content-Type", "application/json") + json.NewEncoder(w).Encode(response) } // BinariesResponse is the response for GET /api/binaries diff --git a/cmd/orly-launcher/web.go b/cmd/orly-launcher/web.go index 715116c..4b8c6d6 100644 --- a/cmd/orly-launcher/web.go +++ b/cmd/orly-launcher/web.go @@ -2,6 +2,7 @@ package main import ( "embed" + "io" "io/fs" "net/http" "path" @@ -11,29 +12,25 @@ import ( //go:embed all:web/dist all:web/public var adminFS embed.FS -// getAdminFS returns the embedded filesystem for the admin UI. -func getAdminFS() (http.FileSystem, error) { +// getAdminSubFS returns the embedded filesystem for the admin UI. +func getAdminSubFS() (fs.FS, error) { // Try dist first (built assets) distFS, err := fs.Sub(adminFS, "web/dist") if err == nil { // Check if dist has content entries, _ := fs.ReadDir(distFS, ".") if len(entries) > 0 { - return http.FS(distFS), nil + return distFS, nil } } // Fall back to public (template) - publicFS, err := fs.Sub(adminFS, "web/public") - if err != nil { - return nil, err - } - return http.FS(publicFS), nil + return fs.Sub(adminFS, "web/public") } // serveAdminUI serves the embedded admin web UI. func (s *AdminServer) serveAdminUI(w http.ResponseWriter, r *http.Request) { - fsys, err := getAdminFS() + fsys, err := getAdminSubFS() if err != nil { http.Error(w, "Admin UI not available", http.StatusInternalServerError) return @@ -43,32 +40,47 @@ func (s *AdminServer) serveAdminUI(w http.ResponseWriter, r *http.Request) { urlPath := r.URL.Path if strings.HasPrefix(urlPath, "/admin") { urlPath = strings.TrimPrefix(urlPath, "/admin") - if urlPath == "" { - urlPath = "/" - } } + urlPath = strings.TrimPrefix(urlPath, "/") - // Try to serve the file - filePath := strings.TrimPrefix(urlPath, "/") - if filePath == "" { - filePath = "index.html" + // Default to index.html + if urlPath == "" { + urlPath = "index.html" + } + + // Try to open the file + f, err := fsys.Open(urlPath) + if err != nil { + // For SPA routing, serve index.html for non-existent paths + urlPath = "index.html" + f, err = fsys.Open(urlPath) + if err != nil { + http.Error(w, "Not found", http.StatusNotFound) + return + } } + defer f.Close() - // Check if file exists - f, err := fsys.Open(filePath) + // Check if it's a directory + stat, err := f.Stat() if err != nil { - // Serve index.html for SPA routing - filePath = "index.html" - f, err = fsys.Open(filePath) + http.Error(w, "Internal error", http.StatusInternalServerError) + return + } + if stat.IsDir() { + // Try index.html in the directory + f.Close() + urlPath = path.Join(urlPath, "index.html") + f, err = fsys.Open(urlPath) if err != nil { http.Error(w, "Not found", http.StatusNotFound) return } + defer f.Close() } - f.Close() - // Set content type - switch path.Ext(filePath) { + // Set content type based on extension + switch path.Ext(urlPath) { case ".html": w.Header().Set("Content-Type", "text/html; charset=utf-8") case ".css": @@ -81,9 +93,10 @@ func (s *AdminServer) serveAdminUI(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "image/svg+xml") case ".png": w.Header().Set("Content-Type", "image/png") + case ".ico": + w.Header().Set("Content-Type", "image/x-icon") } - // Serve the file - r.URL.Path = "/" + filePath - http.FileServer(fsys).ServeHTTP(w, r) + // Serve the file content directly + io.Copy(w, f) } diff --git a/cmd/orly-launcher/web/dist/bundle.css b/cmd/orly-launcher/web/dist/bundle.css index 2098df1..7e16ec7 100644 --- a/cmd/orly-launcher/web/dist/bundle.css +++ b/cmd/orly-launcher/web/dist/bundle.css @@ -2,6 +2,6 @@ header.svelte-1bc06ax{background:var(--card-bg);border-bottom:1px solid var(--bo .modal-overlay.svelte-rhbu32.svelte-rhbu32{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.5);display:flex;justify-content:center;align-items:center;z-index:1000}.modal.svelte-rhbu32.svelte-rhbu32{background:var(--card-bg, #fff);border-radius:8px;box-shadow:0 4px 20px rgba(0, 0, 0, 0.3);width:90%;max-width:450px;border:1px solid var(--border-color, #e0e0e0)}.modal-header.svelte-rhbu32.svelte-rhbu32{display:flex;justify-content:space-between;align-items:center;padding:20px;border-bottom:1px solid var(--border-color, #e0e0e0)}.modal-header.svelte-rhbu32 h2.svelte-rhbu32{margin:0;color:var(--text-color, #333);font-size:1.25rem}.close-btn.svelte-rhbu32.svelte-rhbu32{background:none;border:none;font-size:1.5rem;cursor:pointer;color:var(--text-color, #333);padding:0;width:30px;height:30px;display:flex;align-items:center;justify-content:center;border-radius:50%}.close-btn.svelte-rhbu32.svelte-rhbu32:hover{background-color:var(--border-color, #e0e0e0)}.tab-container.svelte-rhbu32.svelte-rhbu32{padding:20px}.tabs.svelte-rhbu32.svelte-rhbu32{display:flex;border-bottom:1px solid var(--border-color, #e0e0e0);margin-bottom:20px}.tab-btn.svelte-rhbu32.svelte-rhbu32{flex:1;padding:12px 16px;background:none;border:none;cursor:pointer;color:var(--text-color, #333);font-size:1rem;border-bottom:2px solid transparent}.tab-btn.svelte-rhbu32.svelte-rhbu32:hover{background-color:var(--border-color, #e0e0e0)}.tab-btn.active.svelte-rhbu32.svelte-rhbu32{border-bottom-color:var(--primary, #00bcd4);color:var(--primary, #00bcd4)}.tab-content.svelte-rhbu32.svelte-rhbu32{min-height:180px}.extension-login.svelte-rhbu32.svelte-rhbu32,.nsec-login.svelte-rhbu32.svelte-rhbu32{display:flex;flex-direction:column;gap:16px}.extension-login.svelte-rhbu32 p.svelte-rhbu32,.nsec-login.svelte-rhbu32 p.svelte-rhbu32{margin:0;color:var(--muted-color, #666);line-height:1.5}.login-btn.svelte-rhbu32.svelte-rhbu32{padding:12px 24px;background:var(--primary, #00bcd4);color:white;border:none;border-radius:6px;cursor:pointer;font-size:1rem}.login-btn.svelte-rhbu32.svelte-rhbu32:hover:not(:disabled){background:var(--primary-hover, #00acc1)}.login-btn.svelte-rhbu32.svelte-rhbu32:disabled{background:#ccc;cursor:not-allowed}.nsec-input.svelte-rhbu32.svelte-rhbu32{padding:12px;border:1px solid var(--border-color, #e0e0e0);border-radius:6px;font-size:1rem;background:var(--card-bg, #fff);color:var(--text-color, #333)}.nsec-input.svelte-rhbu32.svelte-rhbu32:focus{outline:none;border-color:var(--primary, #00bcd4)}.generate-btn.svelte-rhbu32.svelte-rhbu32{padding:10px 20px;background:var(--success, #4caf50);color:white;border:none;border-radius:6px;cursor:pointer;font-size:0.95rem}.generate-btn.svelte-rhbu32.svelte-rhbu32:hover:not(:disabled){opacity:0.9}.generate-btn.svelte-rhbu32.svelte-rhbu32:disabled{background:#ccc;cursor:not-allowed}.generated-info.svelte-rhbu32.svelte-rhbu32{background:var(--bg-color, #f5f5f5);padding:12px;border-radius:6px;border:1px solid var(--border-color, #e0e0e0)}.generated-info.svelte-rhbu32 label.svelte-rhbu32{display:block;font-size:0.85rem;color:var(--muted-color, #666);margin-bottom:6px}.generated-info.svelte-rhbu32 code.svelte-rhbu32{display:block;word-break:break-all;font-size:0.8rem;color:var(--text-color, #333)}.message.svelte-rhbu32.svelte-rhbu32{padding:10px;border-radius:4px;margin-top:16px;text-align:center}.error-message.svelte-rhbu32.svelte-rhbu32{background:#ffebee;color:#c62828;border:1px solid #ffcdd2}.success-message.svelte-rhbu32.svelte-rhbu32{background:#e8f5e9;color:#2e7d32;border:1px solid #c8e6c9}.dark-theme.svelte-rhbu32 .error-message.svelte-rhbu32{background:#4a2c2a;color:#ffcdd2}.dark-theme.svelte-rhbu32 .success-message.svelte-rhbu32{background:#2e4a2e;color:#a5d6a7} .process-card.svelte-xh5u5u{background:var(--card-bg);border:1px solid var(--border-color);border-radius:8px;padding:16px}.process-header.svelte-xh5u5u{display:flex;align-items:center;gap:8px;margin-bottom:12px}.status-indicator.svelte-xh5u5u{font-size:1.2rem}.process-name.svelte-xh5u5u{font-weight:600;font-size:1rem;color:var(--text-color)}.process-details.svelte-xh5u5u{display:flex;flex-direction:column;gap:6px}.detail-row.svelte-xh5u5u{display:flex;justify-content:space-between;font-size:0.85rem}.label.svelte-xh5u5u{color:var(--muted-color)}.value.svelte-xh5u5u{color:var(--text-color);font-family:monospace}.value.binary.svelte-xh5u5u{font-size:0.75rem;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.value.warning.svelte-xh5u5u{color:var(--warning)} .dashboard.svelte-17dya06.svelte-17dya06{padding:20px 0}.page-header.svelte-17dya06.svelte-17dya06{display:flex;justify-content:space-between;align-items:center;margin-bottom:24px}.page-header.svelte-17dya06 h2.svelte-17dya06{font-size:1.5rem;color:var(--text-color)}.actions.svelte-17dya06.svelte-17dya06{display:flex;gap:8px}.refresh-btn.svelte-17dya06.svelte-17dya06,.restart-btn.svelte-17dya06.svelte-17dya06{padding:8px 16px;border-radius:4px;cursor:pointer;font-size:0.9rem}.refresh-btn.svelte-17dya06.svelte-17dya06{background:var(--card-bg);border:1px solid var(--border-color);color:var(--text-color)}.refresh-btn.svelte-17dya06.svelte-17dya06:hover:not(:disabled){background:var(--border-color)}.restart-btn.svelte-17dya06.svelte-17dya06{background:var(--warning);border:none;color:white}.restart-btn.svelte-17dya06.svelte-17dya06:hover:not(:disabled){opacity:0.9}.restart-btn.svelte-17dya06.svelte-17dya06:disabled,.refresh-btn.svelte-17dya06.svelte-17dya06:disabled{opacity:0.5;cursor:not-allowed}.error-banner.svelte-17dya06.svelte-17dya06{background:#ffebee;color:#c62828;padding:12px 16px;border-radius:6px;margin-bottom:20px;border:1px solid #ffcdd2}.status-summary.svelte-17dya06.svelte-17dya06{display:grid;grid-template-columns:repeat(auto-fit, minmax(150px, 1fr));gap:16px;margin-bottom:32px}.summary-card.svelte-17dya06.svelte-17dya06{background:var(--card-bg);border:1px solid var(--border-color);border-radius:8px;padding:16px;display:flex;flex-direction:column;gap:4px}.summary-card.svelte-17dya06 .label.svelte-17dya06{font-size:0.85rem;color:var(--muted-color)}.summary-card.svelte-17dya06 .value.svelte-17dya06{font-size:1.25rem;font-weight:600;color:var(--text-color)}h3.svelte-17dya06.svelte-17dya06{font-size:1.1rem;color:var(--text-color);margin-bottom:16px}.processes-grid.svelte-17dya06.svelte-17dya06{display:grid;grid-template-columns:repeat(auto-fill, minmax(280px, 1fr));gap:16px}.loading.svelte-17dya06.svelte-17dya06{text-align:center;color:var(--muted-color);padding:40px} -.config-page.svelte-1kruta9.svelte-1kruta9{padding:20px 0}.page-header.svelte-1kruta9.svelte-1kruta9{display:flex;justify-content:space-between;align-items:center;margin-bottom:24px}.page-header.svelte-1kruta9 h2.svelte-1kruta9{font-size:1.5rem;color:var(--text-color)}.refresh-btn.svelte-1kruta9.svelte-1kruta9{padding:8px 16px;background:var(--card-bg);border:1px solid var(--border-color);color:var(--text-color);border-radius:4px;cursor:pointer;font-size:0.9rem}.refresh-btn.svelte-1kruta9.svelte-1kruta9:hover:not(:disabled){background:var(--border-color)}.refresh-btn.svelte-1kruta9.svelte-1kruta9:disabled{opacity:0.5;cursor:not-allowed}.error-banner.svelte-1kruta9.svelte-1kruta9{background:#ffebee;color:#c62828;padding:12px 16px;border-radius:6px;margin-bottom:20px;border:1px solid #ffcdd2}.config-sections.svelte-1kruta9.svelte-1kruta9{display:flex;flex-direction:column;gap:24px}.config-section.svelte-1kruta9.svelte-1kruta9{background:var(--card-bg);border:1px solid var(--border-color);border-radius:8px;padding:20px}.config-section.svelte-1kruta9 h3.svelte-1kruta9{font-size:1.1rem;color:var(--text-color);margin-bottom:16px;padding-bottom:8px;border-bottom:1px solid var(--border-color)}.config-grid.svelte-1kruta9.svelte-1kruta9{display:grid;grid-template-columns:repeat(auto-fill, minmax(250px, 1fr));gap:16px}.config-item.svelte-1kruta9.svelte-1kruta9{display:flex;flex-direction:column;gap:4px}.config-item.full-width.svelte-1kruta9.svelte-1kruta9{grid-column:1 / -1}.config-item.svelte-1kruta9 .label.svelte-1kruta9{font-size:0.85rem;color:var(--muted-color)}.config-item.svelte-1kruta9 .value.svelte-1kruta9{font-size:0.95rem;color:var(--text-color)}.config-item.svelte-1kruta9 .value.mono.svelte-1kruta9{font-family:monospace;font-size:0.85rem}.config-item.svelte-1kruta9 .value.bool.svelte-1kruta9{font-weight:500}.config-item.svelte-1kruta9 .value.bool.enabled.svelte-1kruta9{color:var(--success)}.owners-list.svelte-1kruta9.svelte-1kruta9{display:flex;flex-wrap:wrap;gap:8px;margin-top:4px}.owner.svelte-1kruta9.svelte-1kruta9{font-size:0.75rem;background:var(--bg-color);padding:4px 8px;border-radius:4px;word-break:break-all}.no-owners.svelte-1kruta9.svelte-1kruta9{color:var(--muted-color);font-style:italic}.config-note.svelte-1kruta9.svelte-1kruta9{margin-top:24px;padding:16px;background:var(--card-bg);border:1px solid var(--border-color);border-radius:8px}.config-note.svelte-1kruta9 p.svelte-1kruta9{color:var(--muted-color);font-size:0.9rem;margin:0}.loading.svelte-1kruta9.svelte-1kruta9{text-align:center;color:var(--muted-color);padding:40px} +.config-page.svelte-my2rpu.svelte-my2rpu{padding:20px 0}.page-header.svelte-my2rpu.svelte-my2rpu{display:flex;justify-content:space-between;align-items:center;margin-bottom:24px}.page-header.svelte-my2rpu h2.svelte-my2rpu{font-size:1.5rem;color:var(--text-color)}.header-buttons.svelte-my2rpu.svelte-my2rpu{display:flex;gap:8px}.refresh-btn.svelte-my2rpu.svelte-my2rpu,.edit-btn.svelte-my2rpu.svelte-my2rpu,.cancel-btn.svelte-my2rpu.svelte-my2rpu,.save-btn.svelte-my2rpu.svelte-my2rpu{padding:8px 16px;background:var(--card-bg);border:1px solid var(--border-color);color:var(--text-color);border-radius:4px;cursor:pointer;font-size:0.9rem}.edit-btn.svelte-my2rpu.svelte-my2rpu{background:var(--primary);border-color:var(--primary);color:white}.save-btn.svelte-my2rpu.svelte-my2rpu{background:var(--success);border-color:var(--success);color:white}.cancel-btn.svelte-my2rpu.svelte-my2rpu:hover:not(:disabled){background:var(--border-color)}.edit-btn.svelte-my2rpu.svelte-my2rpu:hover:not(:disabled),.save-btn.svelte-my2rpu.svelte-my2rpu:hover:not(:disabled){opacity:0.9}button.svelte-my2rpu.svelte-my2rpu:disabled{opacity:0.5;cursor:not-allowed}.error-banner.svelte-my2rpu.svelte-my2rpu{background:#ffebee;color:#c62828;padding:12px 16px;border-radius:6px;margin-bottom:20px;border:1px solid #ffcdd2}.message-banner.svelte-my2rpu.svelte-my2rpu{padding:12px 16px;border-radius:6px;margin-bottom:20px;display:flex;align-items:center;gap:12px}.message-banner.success.svelte-my2rpu.svelte-my2rpu{background:#e8f5e9;color:#2e7d32;border:1px solid #c8e6c9}.message-banner.error.svelte-my2rpu.svelte-my2rpu{background:#ffebee;color:#c62828;border:1px solid #ffcdd2}.restart-btn-inline.svelte-my2rpu.svelte-my2rpu{padding:4px 12px;background:var(--primary);border:none;color:white;border-radius:4px;cursor:pointer;font-size:0.85rem}.config-sections.svelte-my2rpu.svelte-my2rpu{display:flex;flex-direction:column;gap:24px}.config-section.svelte-my2rpu.svelte-my2rpu{background:var(--card-bg);border:1px solid var(--border-color);border-radius:8px;padding:20px}.config-section.svelte-my2rpu h3.svelte-my2rpu{font-size:1.1rem;color:var(--text-color);margin-bottom:16px;padding-bottom:8px;border-bottom:1px solid var(--border-color)}.config-grid.svelte-my2rpu.svelte-my2rpu{display:grid;grid-template-columns:repeat(auto-fill, minmax(250px, 1fr));gap:16px}.config-item.svelte-my2rpu.svelte-my2rpu{display:flex;flex-direction:column;gap:4px}.config-item.full-width.svelte-my2rpu.svelte-my2rpu{grid-column:1 / -1}.config-item.svelte-my2rpu .label.svelte-my2rpu{font-size:0.85rem;color:var(--muted-color);display:flex;align-items:center;gap:8px}.config-item.svelte-my2rpu .value.svelte-my2rpu{font-size:0.95rem;color:var(--text-color)}.config-item.svelte-my2rpu .value.mono.svelte-my2rpu{font-family:monospace;font-size:0.85rem}.config-item.svelte-my2rpu .value.bool.svelte-my2rpu{font-weight:500}.config-item.svelte-my2rpu .value.bool.enabled.svelte-my2rpu{color:var(--success)}.config-item.svelte-my2rpu input[type="text"].svelte-my2rpu,.config-item.svelte-my2rpu select.svelte-my2rpu{padding:8px 12px;border:1px solid var(--border-color);border-radius:4px;background:var(--bg-color);color:var(--text-color);font-size:0.9rem}.config-item.svelte-my2rpu input[type="text"].svelte-my2rpu:focus,.config-item.svelte-my2rpu select.svelte-my2rpu:focus{outline:none;border-color:var(--primary)}.toggle.svelte-my2rpu.svelte-my2rpu{display:flex;align-items:center;gap:8px;cursor:pointer}.toggle.svelte-my2rpu input[type="checkbox"].svelte-my2rpu{width:18px;height:18px}.owners-list.svelte-my2rpu.svelte-my2rpu{display:flex;flex-wrap:wrap;gap:8px;margin-top:4px}.owner-item.svelte-my2rpu.svelte-my2rpu{display:flex;align-items:center;gap:4px}.owner.svelte-my2rpu.svelte-my2rpu{font-size:0.75rem;background:var(--bg-color);padding:4px 8px;border-radius:4px;word-break:break-all}.remove-owner-btn.svelte-my2rpu.svelte-my2rpu{padding:2px 6px;background:#ffebee;border:none;color:#c62828;border-radius:4px;cursor:pointer;font-size:0.8rem}.add-owner-btn.svelte-my2rpu.svelte-my2rpu{padding:2px 8px;background:var(--primary);border:none;color:white;border-radius:4px;cursor:pointer;font-size:0.75rem}.no-owners.svelte-my2rpu.svelte-my2rpu{color:var(--muted-color);font-style:italic}.config-note.svelte-my2rpu.svelte-my2rpu{margin-top:24px;padding:16px;background:var(--card-bg);border:1px solid var(--border-color);border-radius:8px}.config-note.svelte-my2rpu p.svelte-my2rpu{color:var(--muted-color);font-size:0.9rem;margin:0}.config-note.svelte-my2rpu code.svelte-my2rpu{background:var(--bg-color);padding:2px 6px;border-radius:4px;font-size:0.85rem}.loading.svelte-my2rpu.svelte-my2rpu{text-align:center;color:var(--muted-color);padding:40px} .update-page.svelte-1ig49gt.svelte-1ig49gt{padding:20px 0}.page-header.svelte-1ig49gt.svelte-1ig49gt{margin-bottom:24px}.page-header.svelte-1ig49gt h2.svelte-1ig49gt{font-size:1.5rem;color:var(--text-color)}.error-banner.svelte-1ig49gt.svelte-1ig49gt{background:#ffebee;color:#c62828;padding:12px 16px;border-radius:6px;margin-bottom:20px;border:1px solid #ffcdd2}.success-banner.svelte-1ig49gt.svelte-1ig49gt{background:#e8f5e9;color:#2e7d32;padding:12px 16px;border-radius:6px;margin-bottom:20px;border:1px solid #c8e6c9}.current-version.svelte-1ig49gt.svelte-1ig49gt,.update-form.svelte-1ig49gt.svelte-1ig49gt,.versions-list.svelte-1ig49gt.svelte-1ig49gt{background:var(--card-bg);border:1px solid var(--border-color);border-radius:8px;padding:20px;margin-bottom:24px}h3.svelte-1ig49gt.svelte-1ig49gt{font-size:1.1rem;color:var(--text-color);margin-bottom:16px}.version-info.svelte-1ig49gt.svelte-1ig49gt{display:flex;align-items:center;justify-content:space-between}.version.svelte-1ig49gt.svelte-1ig49gt{font-size:1.5rem;font-weight:600;font-family:monospace;color:var(--text-color)}.rollback-btn.svelte-1ig49gt.svelte-1ig49gt{padding:8px 16px;background:var(--warning);border:none;color:white;border-radius:4px;cursor:pointer}.rollback-btn.svelte-1ig49gt.svelte-1ig49gt:hover:not(:disabled){opacity:0.9}.rollback-btn.svelte-1ig49gt.svelte-1ig49gt:disabled{opacity:0.5;cursor:not-allowed}.form-group.svelte-1ig49gt.svelte-1ig49gt{margin-bottom:20px}.form-group.svelte-1ig49gt>label.svelte-1ig49gt{display:block;font-size:0.9rem;color:var(--text-color);margin-bottom:8px;font-weight:500}.form-group.svelte-1ig49gt input[type="text"].svelte-1ig49gt{width:100%;padding:10px 12px;border:1px solid var(--border-color);border-radius:4px;font-size:0.95rem;background:var(--bg-color);color:var(--text-color)}.form-group.svelte-1ig49gt input.svelte-1ig49gt:focus{outline:none;border-color:var(--primary)}.url-header.svelte-1ig49gt.svelte-1ig49gt{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.url-header.svelte-1ig49gt label.svelte-1ig49gt{font-size:0.9rem;color:var(--text-color);font-weight:500}.helper-btn.svelte-1ig49gt.svelte-1ig49gt{padding:4px 12px;font-size:0.8rem;background:var(--card-bg);border:1px solid var(--border-color);border-radius:4px;color:var(--text-color);cursor:pointer}.helper-btn.svelte-1ig49gt.svelte-1ig49gt:hover:not(:disabled){background:var(--border-color)}.url-input.svelte-1ig49gt.svelte-1ig49gt{display:flex;gap:12px;align-items:center;margin-bottom:8px}.binary-name.svelte-1ig49gt.svelte-1ig49gt{width:140px;font-family:monospace;font-size:0.85rem;color:var(--muted-color)}.url-input.svelte-1ig49gt input.svelte-1ig49gt{flex:1;padding:8px 12px;border:1px solid var(--border-color);border-radius:4px;font-size:0.85rem;background:var(--bg-color);color:var(--text-color)}.update-btn.svelte-1ig49gt.svelte-1ig49gt{width:100%;padding:12px;background:var(--primary);border:none;color:white;border-radius:6px;font-size:1rem;cursor:pointer}.update-btn.svelte-1ig49gt.svelte-1ig49gt:hover:not(:disabled){background:var(--primary-hover)}.update-btn.svelte-1ig49gt.svelte-1ig49gt:disabled{opacity:0.5;cursor:not-allowed}table.svelte-1ig49gt.svelte-1ig49gt{width:100%;border-collapse:collapse}th.svelte-1ig49gt.svelte-1ig49gt,td.svelte-1ig49gt.svelte-1ig49gt{padding:10px 12px;text-align:left;border-bottom:1px solid var(--border-color)}th.svelte-1ig49gt.svelte-1ig49gt{font-size:0.85rem;color:var(--muted-color);font-weight:500}td.svelte-1ig49gt.svelte-1ig49gt{font-size:0.9rem;color:var(--text-color)}.version-cell.svelte-1ig49gt.svelte-1ig49gt{font-family:monospace}tr.current.svelte-1ig49gt.svelte-1ig49gt{background:rgba(0, 188, 212, 0.1)}.current-badge.svelte-1ig49gt.svelte-1ig49gt{background:var(--primary);color:white;padding:2px 8px;border-radius:4px;font-size:0.75rem} *{box-sizing:border-box;margin:0;padding:0}body{font-family:system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;background:var(--bg-color);color:var(--text-color);min-height:100vh}main.svelte-4k9oqz.svelte-4k9oqz{--bg-color:#f5f5f5;--card-bg:#ffffff;--text-color:#333333;--muted-color:#666666;--border-color:#e0e0e0;--primary:#00bcd4;--primary-hover:#00acc1;--success:#4caf50;--error:#f44336;--warning:#ff9800;min-height:100vh;background:var(--bg-color)}main.dark-theme.svelte-4k9oqz.svelte-4k9oqz{--bg-color:#1a1a1a;--card-bg:#2d2d2d;--text-color:#e0e0e0;--muted-color:#999999;--border-color:#444444}.content.svelte-4k9oqz.svelte-4k9oqz{max-width:1200px;margin:0 auto;padding:20px}.login-prompt.svelte-4k9oqz.svelte-4k9oqz{text-align:center;padding:60px 20px}.login-prompt.svelte-4k9oqz h2.svelte-4k9oqz{font-size:2rem;margin-bottom:16px;color:var(--text-color)}.login-prompt.svelte-4k9oqz p.svelte-4k9oqz{color:var(--muted-color);margin-bottom:24px}.login-btn.svelte-4k9oqz.svelte-4k9oqz{padding:12px 32px;font-size:1rem;background:var(--primary);color:white;border:none;border-radius:6px;cursor:pointer;transition:background 0.2s}.login-btn.svelte-4k9oqz.svelte-4k9oqz:hover{background:var(--primary-hover)} diff --git a/cmd/orly-launcher/web/dist/bundle.js b/cmd/orly-launcher/web/dist/bundle.js index ba68016..e585802 100644 --- a/cmd/orly-launcher/web/dist/bundle.js +++ b/cmd/orly-launcher/web/dist/bundle.js @@ -1,14 +1,14 @@ -var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function r(t){t.forEach(e)}function s(t){return"function"==typeof t}function o(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function i(e,n,r){e.$$.on_destroy.push(function(e,...n){if(null==e){for(const t of n)t(void 0);return t}const r=e.subscribe(...n);return r.unsubscribe?()=>r.unsubscribe():r}(n,r))}function a(t,e,n){return t.set(n),e}const l="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function c(t,e){t.appendChild(e)}function u(t,e,n){t.insertBefore(e,n||null)}function d(t){t.parentNode&&t.parentNode.removeChild(t)}function f(t,e){for(let n=0;nt.removeEventListener(e,n,r)}function w(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function b(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function m(t,e){e=""+e,t.data!==e&&(t.data=e)}function v(t,e){t.value=null==e?"":e}function E(t,e,n,r){null==n?t.style.removeProperty(e):t.style.setProperty(e,n,"")}function x(t,e,n){t.classList.toggle(e,!!n)}let k;function $(t){k=t}function A(){if(!k)throw new Error("Function called outside component initialization");return k}function B(t){A().$$.on_mount.push(t)}function I(){const t=A();return(e,n,{cancelable:r=!1}={})=>{const s=t.$$.callbacks[e];if(s){const o=function(t,e,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:r})}(e,n,{cancelable:r});return s.slice().forEach(e=>{e.call(t,o)}),!o.defaultPrevented}return!0}}function _(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(t=>t.call(this,e))}const L=[],S=[];let C=[];const U=[],T=Promise.resolve();let N=!1;function O(t){C.push(t)}const R=new Set;let P=0;function D(){if(0!==P)return;const t=k;do{try{for(;P{H.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function M(t){return void 0!==t?.length?t:Array.from(t)}function Z(t){t&&t.c()}function G(t,n,o){const{fragment:i,after_update:a}=t.$$;i&&i.m(n,o),O(()=>{const n=t.$$.on_mount.map(e).filter(s);t.$$.on_destroy?t.$$.on_destroy.push(...n):r(n),t.$$.on_mount=[]}),a.forEach(O)}function W(t,e){const n=t.$$;null!==n.fragment&&(!function(t){const e=[],n=[];C.forEach(r=>-1===t.indexOf(r)?e.push(r):n.push(r)),n.forEach(t=>t()),C=e}(n.after_update),r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Y(t,e){-1===t.$$.dirty[0]&&(L.push(t),N||(N=!0,T.then(D)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const s=r.length?r[0]:n;return h.ctx&&a(h.ctx[t],h.ctx[t]=s)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](s),g&&Y(e,t)),n}):[],h.update(),g=!0,r(h.before_update),h.fragment=!!i&&i(h.ctx),s.target){if(s.hydrate){const t=function(t){return Array.from(t.childNodes)}(s.target);h.fragment&&h.fragment.l(t),t.forEach(d)}else h.fragment&&h.fragment.c();s.intro&&z(e.$$.fragment),G(e,s.target,s.anchor),D()}$(f)}class Q{$$=void 0;$$set=void 0;$destroy(){W(this,1),this.$destroy=t}$on(e,n){if(!s(n))return t;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const t=r.indexOf(n);-1!==t&&r.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function X(e){let n,r,s;return{c(){n=h("button"),n.textContent="Login",b(n,"class","login-header-btn svelte-1bc06ax")},m(t,o){u(t,n,o),r||(s=y(n,"click",e[9]),r=!0)},p:t,d(t){t&&d(n),r=!1,s()}}}function tt(t){let e,n,s,o,i,a,l,f,w,v,E,k,$,A,B=nt(t[2])+"";return{c(){e=h("nav"),n=h("button"),n.textContent="Dashboard",s=p(),o=h("button"),o.textContent="Config",i=p(),a=h("button"),a.textContent="Update",l=p(),f=h("div"),w=h("span"),v=g(B),E=p(),k=h("button"),k.textContent="Logout",b(n,"class","nav-btn svelte-1bc06ax"),x(n,"active","dashboard"===t[0]),b(o,"class","nav-btn svelte-1bc06ax"),x(o,"active","config"===t[0]),b(a,"class","nav-btn svelte-1bc06ax"),x(a,"active","update"===t[0]),b(e,"class","svelte-1bc06ax"),b(w,"class","pubkey svelte-1bc06ax"),b(k,"class","logout-btn svelte-1bc06ax"),b(f,"class","user-section svelte-1bc06ax")},m(r,d){u(r,e,d),c(e,n),c(e,s),c(e,o),c(e,i),c(e,a),u(r,l,d),u(r,f,d),c(f,w),c(w,v),c(f,E),c(f,k),$||(A=[y(n,"click",t[5]),y(o,"click",t[6]),y(a,"click",t[7]),y(k,"click",t[8])],$=!0)},p(t,e){1&e&&x(n,"active","dashboard"===t[0]),1&e&&x(o,"active","config"===t[0]),1&e&&x(a,"active","update"===t[0]),4&e&&B!==(B=nt(t[2])+"")&&m(v,B)},d(t){t&&(d(e),d(l),d(f)),$=!1,r(A)}}}function et(e){let n,r,s,o;function i(t,e){return t[1]?tt:X}let a=i(e),l=a(e);return{c(){n=h("header"),r=h("div"),s=h("h1"),s.textContent="ORLY Launcher",o=p(),l.c(),b(s,"class","svelte-1bc06ax"),b(r,"class","header-content svelte-1bc06ax"),b(n,"class","svelte-1bc06ax")},m(t,e){u(t,n,e),c(n,r),c(r,s),c(r,o),l.m(r,null)},p(t,[e]){a===(a=i(t))&&l?l.p(t,e):(l.d(1),l=a(t),l&&(l.c(),l.m(r,null)))},i:t,o:t,d(t){t&&d(n),l.d()}}}function nt(t){return t?t.slice(0,8)+"..."+t.slice(-4):""}function rt(t,e,n){const r=I();let{currentPage:s="dashboard"}=e,{isLoggedIn:o=!1}=e,{userPubkey:i=""}=e;function a(t){r("navigate",t)}return t.$$set=t=>{"currentPage"in t&&n(0,s=t.currentPage),"isLoggedIn"in t&&n(1,o=t.isLoggedIn),"userPubkey"in t&&n(2,i=t.userPubkey)},[s,o,i,r,a,()=>a("dashboard"),()=>a("config"),()=>a("update"),()=>r("logout"),()=>r("login")]}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");class st extends Q{constructor(t){super(),J(this,t,rt,et,o,{currentPage:0,isLoggedIn:1,userPubkey:2})}}function ot(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function it(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function at(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}const lt="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,ct=t=>t instanceof Uint8Array,ut=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),dt=(t,e)=>t<<32-e|t>>>e; -/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function ft(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}(t)),!ct(t))throw new Error("expected Uint8Array, got "+typeof t);return t}let ht=class{clone(){return this._cloneInto()}};function gt(t){const e=e=>t().update(ft(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function pt(t=32){if(lt&&"function"==typeof lt.getRandomValues)return lt.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}let yt=class extends ht{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=ut(this.buffer)}update(t){at(this);const{view:e,buffer:n,blockLen:r}=this,s=(t=ft(t)).length;for(let o=0;or-o&&(this.process(n,0),o=0);for(let t=o;t>s&o),a=Number(n&o),l=r?4:0,c=r?0:4;t.setUint32(e+l,i,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),s),this.process(n,0);const i=ut(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;tt&e^~t&n,bt=(t,e,n)=>t&e^t&n^e&n,mt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),vt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Et=new Uint32Array(64);let xt=class extends yt{constructor(){super(64,32,8,!1),this.A=0|vt[0],this.B=0|vt[1],this.C=0|vt[2],this.D=0|vt[3],this.E=0|vt[4],this.F=0|vt[5],this.G=0|vt[6],this.H=0|vt[7]}get(){const{A:t,B:e,C:n,D:r,E:s,F:o,G:i,H:a}=this;return[t,e,n,r,s,o,i,a]}set(t,e,n,r,s,o,i,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|s,this.F=0|o,this.G=0|i,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)Et[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=Et[t-15],n=Et[t-2],r=dt(e,7)^dt(e,18)^e>>>3,s=dt(n,17)^dt(n,19)^n>>>10;Et[t]=s+Et[t-7]+r+Et[t-16]|0}let{A:n,B:r,C:s,D:o,E:i,F:a,G:l,H:c}=this;for(let t=0;t<64;t++){const e=c+(dt(i,6)^dt(i,11)^dt(i,25))+wt(i,a,l)+mt[t]+Et[t]|0,u=(dt(n,2)^dt(n,13)^dt(n,22))+bt(n,r,s)|0;c=l,l=a,a=i,i=o+e|0,o=s,s=r,r=n,n=e+u|0}n=n+this.A|0,r=r+this.B|0,s=s+this.C|0,o=o+this.D|0,i=i+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,s,o,i,a,l,c)}roundClean(){Et.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const kt=gt(()=>new xt); -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0);const $t=BigInt(1),At=BigInt(2),Bt=t=>t instanceof Uint8Array,It=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function _t(t){if(!Bt(t))throw new Error("Uint8Array expected");let e="";for(let n=0;nt+e.length,0));let n=0;return t.forEach(t=>{if(!Bt(t))throw new Error("Uint8Array expected");e.set(t,n),n+=t.length}),e}const Pt=t=>(At<new Uint8Array(t),qt=t=>Uint8Array.from(t);function Ht(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=Dt(t),s=Dt(t),o=0;const i=()=>{r.fill(1),s.fill(0),o=0},a=(...t)=>n(s,r,...t),l=(t=Dt())=>{s=a(qt([0]),t),r=a(),0!==t.length&&(s=a(qt([1]),t),r=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t{let n;for(i(),l(t);!(n=e(c()));)l();return i(),n}}const Ft={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function Vt(t,e,n={}){const r=(e,n,r)=>{const s=Ft[n];if("function"!=typeof s)throw new Error(`Invalid validator "${n}", expected function`);const o=t[e];if(!(r&&void 0===o||s(o,t)))throw new Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${n}`)};for(const[t,n]of Object.entries(e))r(t,n,!1);for(const[t,e]of Object.entries(n))r(t,e,!0);return t}var jt=Object.freeze({__proto__:null,bitMask:Pt,bytesToHex:_t,bytesToNumberBE:Ct,bytesToNumberLE:Ut,concatBytes:Rt,createHmacDrbg:Ht,ensureBytes:Ot,hexToBytes:St,hexToNumber:Lt,numberToBytesBE:Tt,numberToBytesLE:Nt,validateObject:Vt}); -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const zt=BigInt(0),Kt=BigInt(1),Mt=BigInt(2),Zt=BigInt(3),Gt=BigInt(4),Wt=BigInt(5),Yt=BigInt(8);function Jt(t,e){const n=t%e;return n>=zt?n:e+n}function Qt(t,e,n){if(n<=zt||e 0");if(n===Kt)return zt;let r=Kt;for(;e>zt;)e&Kt&&(r=r*t%n),t=t*t%n,e>>=Kt;return r}function Xt(t,e,n){let r=t;for(;e-- >zt;)r*=r,r%=n;return r}function te(t,e){if(t===zt||e<=zt)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=Jt(t,e),r=e,s=zt,o=Kt;for(;n!==zt;){const t=r%n,e=s-o*(r/n);r=n,n=t,s=o,o=e}if(r!==Kt)throw new Error("invert: does not exist");return Jt(s,e)}function ee(t){if(t%Gt===Zt){const e=(t+Kt)/Gt;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}if(t%Yt===Wt){const e=(t-Wt)/Yt;return function(t,n){const r=t.mul(n,Mt),s=t.pow(r,e),o=t.mul(n,s),i=t.mul(t.mul(o,Mt),s),a=t.mul(o,t.sub(i,t.ONE));if(!t.eql(t.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-Kt)/Mt;let n,r,s;for(n=t-Kt,r=0;n%Mt===zt;n/=Mt,r++);for(s=Mt;sr.unsubscribe():r}(n,r))}function l(e,t,n){return e.set(n),t}const a="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function c(e,t){e.appendChild(t)}function u(e,t,n){e.insertBefore(t,n||null)}function d(e){e.parentNode&&e.parentNode.removeChild(e)}function f(e,t){for(let n=0;ne.removeEventListener(t,n,r)}function m(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function w(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function v(e,t){t=""+t,e.data!==t&&(e.data=t)}function E(e,t){e.value=null==t?"":t}function x(e,t,n,r){null==n?e.style.removeProperty(t):e.style.setProperty(t,n,"")}function _(e,t,n){for(let n=0;n{const s=e.$$.callbacks[t];if(s){const o=function(e,t,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(e,{detail:t,bubbles:n,cancelable:r})}(t,n,{cancelable:r});return s.slice().forEach(t=>{t.call(e,o)}),!o.defaultPrevented}return!0}}function L(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(e=>e.call(this,t))}const N=[],U=[];let O=[];const T=[],R=Promise.resolve();let P=!1;function D(e){O.push(e)}const q=new Set;let H=0;function j(){if(0!==H)return;const e=A;do{try{for(;H{V.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}function G(e){return void 0!==e?.length?e:Array.from(e)}function Y(e){e&&e.c()}function J(e,n,o){const{fragment:i,after_update:l}=e.$$;i&&i.m(n,o),D(()=>{const n=e.$$.on_mount.map(t).filter(s);e.$$.on_destroy?e.$$.on_destroy.push(...n):r(n),e.$$.on_mount=[]}),l.forEach(D)}function Q(e,t){const n=e.$$;null!==n.fragment&&(!function(e){const t=[],n=[];O.forEach(r=>-1===e.indexOf(r)?t.push(r):n.push(r)),n.forEach(e=>e()),O=t}(n.after_update),r(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function X(e,t){-1===e.$$.dirty[0]&&(N.push(e),P||(P=!0,R.then(j)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const s=r.length?r[0]:n;return h.ctx&&l(h.ctx[e],h.ctx[e]=s)&&(!h.skip_bound&&h.bound[e]&&h.bound[e](s),p&&X(t,e)),n}):[],h.update(),p=!0,r(h.before_update),h.fragment=!!i&&i(h.ctx),s.target){if(s.hydrate){const e=function(e){return Array.from(e.childNodes)}(s.target);h.fragment&&h.fragment.l(e),e.forEach(d)}else h.fragment&&h.fragment.c();s.intro&&Z(t.$$.fragment),J(t,s.target,s.anchor),j()}B(f)}class te{$$=void 0;$$set=void 0;$destroy(){Q(this,1),this.$destroy=e}$on(t,n){if(!s(n))return e;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const e=r.indexOf(n);-1!==e&&r.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function ne(t){let n,r,s;return{c(){n=h("button"),n.textContent="Login",w(n,"class","login-header-btn svelte-1bc06ax")},m(e,o){u(e,n,o),r||(s=b(n,"click",t[9]),r=!0)},p:e,d(e){e&&d(n),r=!1,s()}}}function re(e){let t,n,s,o,i,l,a,f,y,m,E,x,_,$,A=oe(e[2])+"";return{c(){t=h("nav"),n=h("button"),n.textContent="Dashboard",s=g(),o=h("button"),o.textContent="Config",i=g(),l=h("button"),l.textContent="Update",a=g(),f=h("div"),y=h("span"),m=p(A),E=g(),x=h("button"),x.textContent="Logout",w(n,"class","nav-btn svelte-1bc06ax"),k(n,"active","dashboard"===e[0]),w(o,"class","nav-btn svelte-1bc06ax"),k(o,"active","config"===e[0]),w(l,"class","nav-btn svelte-1bc06ax"),k(l,"active","update"===e[0]),w(t,"class","svelte-1bc06ax"),w(y,"class","pubkey svelte-1bc06ax"),w(x,"class","logout-btn svelte-1bc06ax"),w(f,"class","user-section svelte-1bc06ax")},m(r,d){u(r,t,d),c(t,n),c(t,s),c(t,o),c(t,i),c(t,l),u(r,a,d),u(r,f,d),c(f,y),c(y,m),c(f,E),c(f,x),_||($=[b(n,"click",e[5]),b(o,"click",e[6]),b(l,"click",e[7]),b(x,"click",e[8])],_=!0)},p(e,t){1&t&&k(n,"active","dashboard"===e[0]),1&t&&k(o,"active","config"===e[0]),1&t&&k(l,"active","update"===e[0]),4&t&&A!==(A=oe(e[2])+"")&&v(m,A)},d(e){e&&(d(t),d(a),d(f)),_=!1,r($)}}}function se(t){let n,r,s,o;function i(e,t){return e[1]?re:ne}let l=i(t),a=l(t);return{c(){n=h("header"),r=h("div"),s=h("h1"),s.textContent="ORLY Launcher",o=g(),a.c(),w(s,"class","svelte-1bc06ax"),w(r,"class","header-content svelte-1bc06ax"),w(n,"class","svelte-1bc06ax")},m(e,t){u(e,n,t),c(n,r),c(r,s),c(r,o),a.m(r,null)},p(e,[t]){l===(l=i(e))&&a?a.p(e,t):(a.d(1),a=l(e),a&&(a.c(),a.m(r,null)))},i:e,o:e,d(e){e&&d(n),a.d()}}}function oe(e){return e?e.slice(0,8)+"..."+e.slice(-4):""}function ie(e,t,n){const r=C();let{currentPage:s="dashboard"}=t,{isLoggedIn:o=!1}=t,{userPubkey:i=""}=t;function l(e){r("navigate",e)}return e.$$set=e=>{"currentPage"in e&&n(0,s=e.currentPage),"isLoggedIn"in e&&n(1,o=e.isLoggedIn),"userPubkey"in e&&n(2,i=e.userPubkey)},[s,o,i,r,l,()=>l("dashboard"),()=>l("config"),()=>l("update"),()=>r("logout"),()=>r("login")]}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");class le extends te{constructor(e){super(),ee(this,e,ie,se,o,{currentPage:0,isLoggedIn:1,userPubkey:2})}}function ae(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function ce(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function ue(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}const de="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,fe=e=>e instanceof Uint8Array,he=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),pe=(e,t)=>e<<32-t|e>>>t; +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function ge(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),!fe(e))throw new Error("expected Uint8Array, got "+typeof e);return e}let ye=class{clone(){return this._cloneInto()}};function be(e){const t=t=>e().update(ge(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function me(e=32){if(de&&"function"==typeof de.getRandomValues)return de.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}let we=class extends ye{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=he(this.buffer)}update(e){ue(this);const{view:t,buffer:n,blockLen:r}=this,s=(e=ge(e)).length;for(let o=0;or-o&&(this.process(n,0),o=0);for(let e=o;e>s&o),l=Number(n&o),a=r?4:0,c=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+c,l,r)}(n,r-8,BigInt(8*this.length),s),this.process(n,0);const i=he(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const a=l/4,c=this.get();if(a>c.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;ee&t^~e&n,Ee=(e,t,n)=>e&t^e&n^t&n,xe=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),_e=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),$e=new Uint32Array(64);let ke=class extends we{constructor(){super(64,32,8,!1),this.A=0|_e[0],this.B=0|_e[1],this.C=0|_e[2],this.D=0|_e[3],this.E=0|_e[4],this.F=0|_e[5],this.G=0|_e[6],this.H=0|_e[7]}get(){const{A:e,B:t,C:n,D:r,E:s,F:o,G:i,H:l}=this;return[e,t,n,r,s,o,i,l]}set(e,t,n,r,s,o,i,l){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|s,this.F=0|o,this.G=0|i,this.H=0|l}process(e,t){for(let n=0;n<16;n++,t+=4)$e[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=$e[e-15],n=$e[e-2],r=pe(t,7)^pe(t,18)^t>>>3,s=pe(n,17)^pe(n,19)^n>>>10;$e[e]=s+$e[e-7]+r+$e[e-16]|0}let{A:n,B:r,C:s,D:o,E:i,F:l,G:a,H:c}=this;for(let e=0;e<64;e++){const t=c+(pe(i,6)^pe(i,11)^pe(i,25))+ve(i,l,a)+xe[e]+$e[e]|0,u=(pe(n,2)^pe(n,13)^pe(n,22))+Ee(n,r,s)|0;c=a,a=l,l=i,i=o+t|0,o=s,s=r,r=n,n=t+u|0}n=n+this.A|0,r=r+this.B|0,s=s+this.C|0,o=o+this.D|0,i=i+this.E|0,l=l+this.F|0,a=a+this.G|0,c=c+this.H|0,this.set(n,r,s,o,i,l,a,c)}roundClean(){$e.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Ae=be(()=>new ke); +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0);const Be=BigInt(1),Ie=BigInt(2),Se=e=>e instanceof Uint8Array,Ce=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Le(e){if(!Se(e))throw new Error("Uint8Array expected");let t="";for(let n=0;ne+t.length,0));let n=0;return e.forEach(e=>{if(!Se(e))throw new Error("Uint8Array expected");t.set(e,n),n+=e.length}),t}const He=e=>(Ie<new Uint8Array(e),Fe=e=>Uint8Array.from(e);function Ve(e,t,n){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=je(e),s=je(e),o=0;const i=()=>{r.fill(1),s.fill(0),o=0},l=(...e)=>n(s,r,...e),a=(e=je())=>{s=l(Fe([0]),e),r=l(),0!==e.length&&(s=l(Fe([1]),e),r=l())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e{let n;for(i(),a(e);!(n=t(c()));)a();return i(),n}}const ze={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function Ke(e,t,n={}){const r=(t,n,r)=>{const s=ze[n];if("function"!=typeof s)throw new Error(`Invalid validator "${n}", expected function`);const o=e[t];if(!(r&&void 0===o||s(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${n}`)};for(const[e,n]of Object.entries(t))r(e,n,!1);for(const[e,t]of Object.entries(n))r(e,t,!0);return e}var Me=Object.freeze({__proto__:null,bitMask:He,bytesToHex:Le,bytesToNumberBE:Oe,bytesToNumberLE:Te,concatBytes:qe,createHmacDrbg:Ve,ensureBytes:De,hexToBytes:Ue,hexToNumber:Ne,numberToBytesBE:Re,numberToBytesLE:Pe,validateObject:Ke}); +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ze=BigInt(0),We=BigInt(1),Ge=BigInt(2),Ye=BigInt(3),Je=BigInt(4),Qe=BigInt(5),Xe=BigInt(8);function et(e,t){const n=e%t;return n>=Ze?n:t+n}function tt(e,t,n){if(n<=Ze||t 0");if(n===We)return Ze;let r=We;for(;t>Ze;)t&We&&(r=r*e%n),e=e*e%n,t>>=We;return r}function nt(e,t,n){let r=e;for(;t-- >Ze;)r*=r,r%=n;return r}function rt(e,t){if(e===Ze||t<=Ze)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=et(e,t),r=t,s=Ze,o=We;for(;n!==Ze;){const e=r%n,t=s-o*(r/n);r=n,n=e,s=o,o=t}if(r!==We)throw new Error("invert: does not exist");return et(s,t)}function st(e){if(e%Je===Ye){const t=(e+We)/Je;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}if(e%Xe===Qe){const t=(e-Qe)/Xe;return function(e,n){const r=e.mul(n,Ge),s=e.pow(r,t),o=e.mul(n,s),i=e.mul(e.mul(o,Ge),s),l=e.mul(o,e.sub(i,e.ONE));if(!e.eql(e.sqr(l),n))throw new Error("Cannot find square root");return l}}return function(e){const t=(e-We)/Ge;let n,r,s;for(n=e-We,r=0;n%Ge===Ze;n/=Ge,r++);for(s=Ge;s(t[e]="function",t),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),Vt(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...re(t.n,t.nBitLength),...t,p:t.Fp.ORDER})} -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const{bytesToNumberBE:ce,hexToBytes:ue}=jt,de={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=de;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:ce(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=de,n="string"==typeof t?ue(t):t;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:o}=de._parseInt(n.subarray(2)),{d:i,l:a}=de._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:i}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,n=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},r=e(n(t.s)),s=e(n(t.r)),o=r.length/2,i=s.length/2,a=n(o),l=n(i);return`30${n(i+o+4)}02${l}${s}02${a}${r}`}},fe=BigInt(0),he=BigInt(1);BigInt(2);const ge=BigInt(3);function pe(t){const e=function(t){const e=le(t);Vt(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:s}=e;if(n){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=e,r=e.toBytes||((t,e,r)=>{const s=e.toAffine();return Rt(Uint8Array.from([4]),n.toBytes(s.x),n.toBytes(s.y))}),s=e.fromBytes||(t=>{const e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function o(t){const{a:r,b:s}=e,o=n.sqr(t),i=n.mul(o,t);return n.add(n.add(i,n.mul(t,r)),s)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function i(t){return"bigint"==typeof t&&fen.eql(t,n.ZERO);return s(e)&&s(r)?d.ZERO:new d(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=n.invertBatch(t.map(t=>t.pz));return t.map((t,n)=>t.toAffine(e[n])).map(d.fromAffine)}static fromHex(t){const e=d.fromAffine(s(Ot("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return d.BASE.multiply(l(t))}_setWindowSize(t){this._WINDOW_SIZE=t,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:r}=this.toAffine();if(!n.isValid(t)||!n.isValid(r))throw new Error("bad point: x or y not FE");const s=n.sqr(r),i=o(t);if(!n.eql(s,i))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){u(t);const{px:e,py:r,pz:s}=this,{px:o,py:i,pz:a}=t,l=n.eql(n.mul(e,a),n.mul(o,s)),c=n.eql(n.mul(r,a),n.mul(i,s));return l&&c}negate(){return new d(this.px,n.neg(this.py),this.pz)}double(){const{a:t,b:r}=e,s=n.mul(r,ge),{px:o,py:i,pz:a}=this;let l=n.ZERO,c=n.ZERO,u=n.ZERO,f=n.mul(o,o),h=n.mul(i,i),g=n.mul(a,a),p=n.mul(o,i);return p=n.add(p,p),u=n.mul(o,a),u=n.add(u,u),l=n.mul(t,u),c=n.mul(s,g),c=n.add(l,c),l=n.sub(h,c),c=n.add(h,c),c=n.mul(l,c),l=n.mul(p,l),u=n.mul(s,u),g=n.mul(t,g),p=n.sub(f,g),p=n.mul(t,p),p=n.add(p,u),u=n.add(f,f),f=n.add(u,f),f=n.add(f,g),f=n.mul(f,p),c=n.add(c,f),g=n.mul(i,a),g=n.add(g,g),f=n.mul(g,p),l=n.sub(l,f),u=n.mul(g,h),u=n.add(u,u),u=n.add(u,u),new d(l,c,u)}add(t){u(t);const{px:r,py:s,pz:o}=this,{px:i,py:a,pz:l}=t;let c=n.ZERO,f=n.ZERO,h=n.ZERO;const g=e.a,p=n.mul(e.b,ge);let y=n.mul(r,i),w=n.mul(s,a),b=n.mul(o,l),m=n.add(r,s),v=n.add(i,a);m=n.mul(m,v),v=n.add(y,w),m=n.sub(m,v),v=n.add(r,o);let E=n.add(i,l);return v=n.mul(v,E),E=n.add(y,b),v=n.sub(v,E),E=n.add(s,o),c=n.add(a,l),E=n.mul(E,c),c=n.add(w,b),E=n.sub(E,c),h=n.mul(g,v),c=n.mul(p,b),h=n.add(c,h),c=n.sub(w,h),h=n.add(w,h),f=n.mul(c,h),w=n.add(y,y),w=n.add(w,y),b=n.mul(g,b),v=n.mul(p,v),w=n.add(w,b),b=n.sub(y,b),b=n.mul(g,b),v=n.add(v,b),y=n.mul(w,v),f=n.add(f,y),y=n.mul(E,v),c=n.mul(m,c),c=n.sub(c,y),y=n.mul(m,w),h=n.mul(E,h),h=n.add(h,y),new d(c,f,h)}subtract(t){return this.add(t.negate())}is0(){return this.equals(d.ZERO)}wNAF(t){return h.wNAFCached(this,c,t,t=>{const e=n.invertBatch(t.map(t=>t.pz));return t.map((t,n)=>t.toAffine(e[n])).map(d.fromAffine)})}multiplyUnsafe(t){const r=d.ZERO;if(t===fe)return r;if(a(t),t===he)return this;const{endo:s}=e;if(!s)return h.unsafeLadder(this,t);let{k1neg:o,k1:i,k2neg:l,k2:c}=s.splitScalar(t),u=r,f=r,g=this;for(;i>fe||c>fe;)i&he&&(u=u.add(g)),c&he&&(f=f.add(g)),g=g.double(),i>>=he,c>>=he;return o&&(u=u.negate()),l&&(f=f.negate()),f=new d(n.mul(f.px,s.beta),f.py,f.pz),u.add(f)}multiply(t){a(t);let r,s,o=t;const{endo:i}=e;if(i){const{k1neg:t,k1:e,k2neg:a,k2:l}=i.splitScalar(o);let{p:c,f:u}=this.wNAF(e),{p:f,f:g}=this.wNAF(l);c=h.constTimeNegate(t,c),f=h.constTimeNegate(a,f),f=new d(n.mul(f.px,i.beta),f.py,f.pz),r=c.add(f),s=u.add(g)}else{const{p:t,f:e}=this.wNAF(o);r=t,s=e}return d.normalizeZ([r,s])[0]}multiplyAndAddUnsafe(t,e,n){const r=d.BASE,s=(t,e)=>e!==fe&&e!==he&&t.equals(r)?t.multiply(e):t.multiplyUnsafe(e),o=s(this,e).add(s(t,n));return o.is0()?void 0:o}toAffine(t){const{px:e,py:r,pz:s}=this,o=this.is0();null==t&&(t=o?n.ONE:n.inv(s));const i=n.mul(e,t),a=n.mul(r,t),l=n.mul(s,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(l,n.ONE))throw new Error("invZ was invalid");return{x:i,y:a}}isTorsionFree(){const{h:t,isTorsionFree:n}=e;if(t===he)return!0;if(n)return n(d,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:n}=e;return t===he?this:n?n(d,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),r(d,this,t)}toHex(t=!0){return _t(this.toRawBytes(t))}}d.BASE=new d(e.Gx,e.Gy,n.ONE),d.ZERO=new d(n.ZERO,n.ONE,n.ZERO);const f=e.nBitLength,h=function(t,e){const n=(t,e)=>{const n=e.negate();return t?n:e},r=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:n,unsafeLadder(e,n){let r=t.ZERO,s=e;for(;n>ie;)n&ae&&(r=r.add(s)),s=s.double(),n>>=ae;return r},precomputeWindow(t,e){const{windows:n,windowSize:s}=r(e),o=[];let i=t,a=i;for(let t=0;t>=f,r>a&&(r-=d,o+=ae);const i=e,h=e+Math.abs(r)-1,g=t%2!=0,p=r<0;0===r?c=c.add(n(g,s[i])):l=l.add(n(p,s[h]))}return{p:l,f:c}},wNAFCached(t,e,n,r){const s=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,s),1!==s&&e.set(t,r(o))),this.wNAF(s,o,n)}}}(d,e.endo?Math.ceil(f/2):f);return{CURVE:e,ProjectivePoint:d,normPrivateKeyToScalar:l,weierstrassEquation:o,isWithinCurveOrder:i}}function ye(t){const e=function(t){const e=le(t);return Vt(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r}=e,s=n.BYTES+1,o=2*n.BYTES+1;function i(t){return Jt(t,r)}function a(t){return te(t,r)}const{ProjectivePoint:l,normPrivateKeyToScalar:c,weierstrassEquation:u,isWithinCurveOrder:d}=pe({...e,toBytes(t,e,r){const s=e.toAffine(),o=n.toBytes(s.x),i=Rt;return r?i(Uint8Array.from([e.hasEvenY()?2:3]),o):i(Uint8Array.from([4]),o,n.toBytes(s.y))},fromBytes(t){const e=t.length,r=t[0],i=t.subarray(1);if(e!==s||2!==r&&3!==r){if(e===o&&4===r){return{x:n.fromBytes(i.subarray(0,n.BYTES)),y:n.fromBytes(i.subarray(n.BYTES,2*n.BYTES))}}throw new Error(`Point of length ${e} was invalid. Expected ${s} compressed bytes or ${o} uncompressed bytes`)}{const t=Ct(i);if(!(fe<(a=t)&&a_t(Tt(t,e.nByteLength));function h(t){return t>r>>he}const g=(t,e,n)=>Ct(t.slice(e,n));class p{constructor(t,e,n){this.r=t,this.s=e,this.recovery=n,this.assertValidity()}static fromCompact(t){const n=e.nByteLength;return t=Ot("compactSignature",t,2*n),new p(g(t,0,n),g(t,n,2*n))}static fromDER(t){const{r:e,s:n}=de.toSig(Ot("DER",t));return new p(e,n)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new p(this.r,this.s,t)}recoverPublicKey(t){const{r:r,s:s,recovery:o}=this,c=m(Ot("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const u=2===o||3===o?r+e.n:r;if(u>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const d=1&o?"03":"02",h=l.fromHex(d+f(u)),g=a(u),p=i(-c*g),y=i(s*g),w=l.BASE.multiplyAndAddUnsafe(h,p,y);if(!w)throw new Error("point at infinify");return w.assertValidity(),w}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new p(this.r,i(-this.s),this.recovery):this}toDERRawBytes(){return St(this.toDERHex())}toDERHex(){return de.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return St(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const y={isValidPrivateKey(t){try{return c(t),!0}catch(t){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const t=oe(e.n);return function(t,e,n=!1){const r=t.length,s=se(e),o=oe(e);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const i=Jt(n?Ct(t):Ut(t),e-Kt)+Kt;return n?Nt(i,s):Tt(i,s)}(e.randomBytes(t),e.n)},precompute:(t=8,e=l.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function w(t){const e=t instanceof Uint8Array,n="string"==typeof t,r=(e||n)&&t.length;return e?r===s||r===o:n?r===2*s||r===2*o:t instanceof l}const b=e.bits2int||function(t){const n=Ct(t),r=8*t.length-e.nBitLength;return r>0?n>>BigInt(r):n},m=e.bits2int_modN||function(t){return i(b(t))},v=Pt(e.nBitLength);function E(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(fe<=t&&tt in s))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:u}=e;let{lowS:f,prehash:g,extraEntropy:y}=s;null==f&&(f=!0),t=Ot("msgHash",t),g&&(t=Ot("prehashed msgHash",o(t)));const w=m(t),v=c(r),x=[E(v),E(w)];if(null!=y){const t=!0===y?u(n.BYTES):y;x.push(Ot("extraEntropy",t))}const $=Rt(...x),A=w;return{seed:$,k2sig:function(t){const e=b(t);if(!d(e))return;const n=a(e),r=l.BASE.multiply(e).toAffine(),s=i(r.x);if(s===fe)return;const o=i(n*i(A+s*v));if(o===fe)return;let c=(r.x===s?0:2)|Number(r.y&he),u=o;return f&&h(o)&&(u=function(t){return h(t)?i(-t):t}(o),c^=1),new p(s,u,c)}}}const k={lowS:e.lowS,prehash:!1},$={lowS:e.lowS,prehash:!1};return l.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return l.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,n=!0){if(w(t))throw new Error("first arg must be private key");if(!w(e))throw new Error("second arg must be public key");return l.fromHex(e).multiply(c(t)).toRawBytes(n)},sign:function(t,n,r=k){const{seed:s,k2sig:o}=x(t,n,r),i=e;return Ht(i.hash.outputLen,i.nByteLength,i.hmac)(s,o)},verify:function(t,n,r,s=$){const o=t;if(n=Ot("msgHash",n),r=Ot("publicKey",r),"strict"in s)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:u}=s;let d,f;try{if("string"==typeof o||o instanceof Uint8Array)try{d=p.fromDER(o)}catch(t){if(!(t instanceof de.Err))throw t;d=p.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:t,s:e}=o;d=new p(t,e)}}f=l.fromHex(r)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&d.hasHighS())return!1;u&&(n=e.hash(n));const{r:h,s:g}=d,y=m(n),w=a(g),b=i(y*w),v=i(h*w),E=l.BASE.multiplyAndAddUnsafe(f,b,v)?.toAffine();return!!E&&i(E.x)===h},ProjectivePoint:l,Signature:p,utils:y}}BigInt(4);class we extends ht{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");ot(t.outputLen),ot(t.blockLen)}(t);const n=ft(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,s=new Uint8Array(r);s.set(n.length>r?t.create().update(n).digest():n);for(let t=0;tnew we(t,e).update(n).digest(); +const ct=BigInt(0),ut=BigInt(1);function dt(e){return Ke(e.Fp,ot.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),Ke(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...it(e.n,e.nBitLength),...e,p:e.Fp.ORDER})} +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const{bytesToNumberBE:ft,hexToBytes:ht}=Me,pt={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=pt;if(e.length<2||2!==e[0])throw new t("Invalid signature integer tag");const n=e[1],r=e.subarray(2,n+2);if(!n||r.length!==n)throw new t("Invalid signature integer: wrong length");if(128&r[0])throw new t("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:ft(r),l:e.subarray(n+2)}},toSig(e){const{Err:t}=pt,n="string"==typeof e?ht(e):e;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new t("Invalid signature tag");if(n[1]!==r-2)throw new t("Invalid signature: incorrect length");const{d:s,l:o}=pt._parseInt(n.subarray(2)),{d:i,l:l}=pt._parseInt(o);if(l.length)throw new t("Invalid signature: left bytes after parsing");return{r:s,s:i}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,n=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},r=t(n(e.s)),s=t(n(e.r)),o=r.length/2,i=s.length/2,l=n(o),a=n(i);return`30${n(i+o+4)}02${a}${s}02${l}${r}`}},gt=BigInt(0),yt=BigInt(1);BigInt(2);const bt=BigInt(3);function mt(e){const t=function(e){const t=dt(e);Ke(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:s}=t;if(n){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:n}=t,r=t.toBytes||((e,t,r)=>{const s=t.toAffine();return qe(Uint8Array.from([4]),n.toBytes(s.x),n.toBytes(s.y))}),s=t.fromBytes||(e=>{const t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}});function o(e){const{a:r,b:s}=t,o=n.sqr(e),i=n.mul(o,e);return n.add(n.add(i,n.mul(e,r)),s)}if(!n.eql(n.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function i(e){return"bigint"==typeof e&>n.eql(e,n.ZERO);return s(t)&&s(r)?d.ZERO:new d(t,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=n.invertBatch(e.map(e=>e.pz));return e.map((e,n)=>e.toAffine(t[n])).map(d.fromAffine)}static fromHex(e){const t=d.fromAffine(s(De("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return d.BASE.multiply(a(e))}_setWindowSize(e){this._WINDOW_SIZE=e,c.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:r}=this.toAffine();if(!n.isValid(e)||!n.isValid(r))throw new Error("bad point: x or y not FE");const s=n.sqr(r),i=o(e);if(!n.eql(s,i))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(n.isOdd)return!n.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){u(e);const{px:t,py:r,pz:s}=this,{px:o,py:i,pz:l}=e,a=n.eql(n.mul(t,l),n.mul(o,s)),c=n.eql(n.mul(r,l),n.mul(i,s));return a&&c}negate(){return new d(this.px,n.neg(this.py),this.pz)}double(){const{a:e,b:r}=t,s=n.mul(r,bt),{px:o,py:i,pz:l}=this;let a=n.ZERO,c=n.ZERO,u=n.ZERO,f=n.mul(o,o),h=n.mul(i,i),p=n.mul(l,l),g=n.mul(o,i);return g=n.add(g,g),u=n.mul(o,l),u=n.add(u,u),a=n.mul(e,u),c=n.mul(s,p),c=n.add(a,c),a=n.sub(h,c),c=n.add(h,c),c=n.mul(a,c),a=n.mul(g,a),u=n.mul(s,u),p=n.mul(e,p),g=n.sub(f,p),g=n.mul(e,g),g=n.add(g,u),u=n.add(f,f),f=n.add(u,f),f=n.add(f,p),f=n.mul(f,g),c=n.add(c,f),p=n.mul(i,l),p=n.add(p,p),f=n.mul(p,g),a=n.sub(a,f),u=n.mul(p,h),u=n.add(u,u),u=n.add(u,u),new d(a,c,u)}add(e){u(e);const{px:r,py:s,pz:o}=this,{px:i,py:l,pz:a}=e;let c=n.ZERO,f=n.ZERO,h=n.ZERO;const p=t.a,g=n.mul(t.b,bt);let y=n.mul(r,i),b=n.mul(s,l),m=n.mul(o,a),w=n.add(r,s),v=n.add(i,l);w=n.mul(w,v),v=n.add(y,b),w=n.sub(w,v),v=n.add(r,o);let E=n.add(i,a);return v=n.mul(v,E),E=n.add(y,m),v=n.sub(v,E),E=n.add(s,o),c=n.add(l,a),E=n.mul(E,c),c=n.add(b,m),E=n.sub(E,c),h=n.mul(p,v),c=n.mul(g,m),h=n.add(c,h),c=n.sub(b,h),h=n.add(b,h),f=n.mul(c,h),b=n.add(y,y),b=n.add(b,y),m=n.mul(p,m),v=n.mul(g,v),b=n.add(b,m),m=n.sub(y,m),m=n.mul(p,m),v=n.add(v,m),y=n.mul(b,v),f=n.add(f,y),y=n.mul(E,v),c=n.mul(w,c),c=n.sub(c,y),y=n.mul(w,b),h=n.mul(E,h),h=n.add(h,y),new d(c,f,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(d.ZERO)}wNAF(e){return h.wNAFCached(this,c,e,e=>{const t=n.invertBatch(e.map(e=>e.pz));return e.map((e,n)=>e.toAffine(t[n])).map(d.fromAffine)})}multiplyUnsafe(e){const r=d.ZERO;if(e===gt)return r;if(l(e),e===yt)return this;const{endo:s}=t;if(!s)return h.unsafeLadder(this,e);let{k1neg:o,k1:i,k2neg:a,k2:c}=s.splitScalar(e),u=r,f=r,p=this;for(;i>gt||c>gt;)i&yt&&(u=u.add(p)),c&yt&&(f=f.add(p)),p=p.double(),i>>=yt,c>>=yt;return o&&(u=u.negate()),a&&(f=f.negate()),f=new d(n.mul(f.px,s.beta),f.py,f.pz),u.add(f)}multiply(e){l(e);let r,s,o=e;const{endo:i}=t;if(i){const{k1neg:e,k1:t,k2neg:l,k2:a}=i.splitScalar(o);let{p:c,f:u}=this.wNAF(t),{p:f,f:p}=this.wNAF(a);c=h.constTimeNegate(e,c),f=h.constTimeNegate(l,f),f=new d(n.mul(f.px,i.beta),f.py,f.pz),r=c.add(f),s=u.add(p)}else{const{p:e,f:t}=this.wNAF(o);r=e,s=t}return d.normalizeZ([r,s])[0]}multiplyAndAddUnsafe(e,t,n){const r=d.BASE,s=(e,t)=>t!==gt&&t!==yt&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),o=s(this,t).add(s(e,n));return o.is0()?void 0:o}toAffine(e){const{px:t,py:r,pz:s}=this,o=this.is0();null==e&&(e=o?n.ONE:n.inv(s));const i=n.mul(t,e),l=n.mul(r,e),a=n.mul(s,e);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(a,n.ONE))throw new Error("invZ was invalid");return{x:i,y:l}}isTorsionFree(){const{h:e,isTorsionFree:n}=t;if(e===yt)return!0;if(n)return n(d,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:n}=t;return e===yt?this:n?n(d,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),r(d,this,e)}toHex(e=!0){return Le(this.toRawBytes(e))}}d.BASE=new d(t.Gx,t.Gy,n.ONE),d.ZERO=new d(n.ZERO,n.ONE,n.ZERO);const f=t.nBitLength,h=function(e,t){const n=(e,t)=>{const n=t.negate();return e?n:t},r=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:n,unsafeLadder(t,n){let r=e.ZERO,s=t;for(;n>ct;)n&ut&&(r=r.add(s)),s=s.double(),n>>=ut;return r},precomputeWindow(e,t){const{windows:n,windowSize:s}=r(t),o=[];let i=e,l=i;for(let e=0;e>=f,r>l&&(r-=d,o+=ut);const i=t,h=t+Math.abs(r)-1,p=e%2!=0,g=r<0;0===r?c=c.add(n(p,s[i])):a=a.add(n(g,s[h]))}return{p:a,f:c}},wNAFCached(e,t,n,r){const s=e._WINDOW_SIZE||1;let o=t.get(e);return o||(o=this.precomputeWindow(e,s),1!==s&&t.set(e,r(o))),this.wNAF(s,o,n)}}}(d,t.endo?Math.ceil(f/2):f);return{CURVE:t,ProjectivePoint:d,normPrivateKeyToScalar:a,weierstrassEquation:o,isWithinCurveOrder:i}}function wt(e){const t=function(e){const t=dt(e);return Ke(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:n,n:r}=t,s=n.BYTES+1,o=2*n.BYTES+1;function i(e){return et(e,r)}function l(e){return rt(e,r)}const{ProjectivePoint:a,normPrivateKeyToScalar:c,weierstrassEquation:u,isWithinCurveOrder:d}=mt({...t,toBytes(e,t,r){const s=t.toAffine(),o=n.toBytes(s.x),i=qe;return r?i(Uint8Array.from([t.hasEvenY()?2:3]),o):i(Uint8Array.from([4]),o,n.toBytes(s.y))},fromBytes(e){const t=e.length,r=e[0],i=e.subarray(1);if(t!==s||2!==r&&3!==r){if(t===o&&4===r){return{x:n.fromBytes(i.subarray(0,n.BYTES)),y:n.fromBytes(i.subarray(n.BYTES,2*n.BYTES))}}throw new Error(`Point of length ${t} was invalid. Expected ${s} compressed bytes or ${o} uncompressed bytes`)}{const e=Oe(i);if(!(gt<(l=e)&&lLe(Re(e,t.nByteLength));function h(e){return e>r>>yt}const p=(e,t,n)=>Oe(e.slice(t,n));class g{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){const n=t.nByteLength;return e=De("compactSignature",e,2*n),new g(p(e,0,n),p(e,n,2*n))}static fromDER(e){const{r:t,s:n}=pt.toSig(De("DER",e));return new g(t,n)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new g(this.r,this.s,e)}recoverPublicKey(e){const{r:r,s:s,recovery:o}=this,c=w(De("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const u=2===o||3===o?r+t.n:r;if(u>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const d=1&o?"03":"02",h=a.fromHex(d+f(u)),p=l(u),g=i(-c*p),y=i(s*p),b=a.BASE.multiplyAndAddUnsafe(h,g,y);if(!b)throw new Error("point at infinify");return b.assertValidity(),b}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new g(this.r,i(-this.s),this.recovery):this}toDERRawBytes(){return Ue(this.toDERHex())}toDERHex(){return pt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Ue(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const y={isValidPrivateKey(e){try{return c(e),!0}catch(e){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const e=at(t.n);return function(e,t,n=!1){const r=e.length,s=lt(t),o=at(t);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const i=et(n?Oe(e):Te(e),t-We)+We;return n?Pe(i,s):Re(i,s)}(t.randomBytes(e),t.n)},precompute:(e=8,t=a.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function b(e){const t=e instanceof Uint8Array,n="string"==typeof e,r=(t||n)&&e.length;return t?r===s||r===o:n?r===2*s||r===2*o:e instanceof a}const m=t.bits2int||function(e){const n=Oe(e),r=8*e.length-t.nBitLength;return r>0?n>>BigInt(r):n},w=t.bits2int_modN||function(e){return i(m(e))},v=He(t.nBitLength);function E(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(gt<=e&&ee in s))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:u}=t;let{lowS:f,prehash:p,extraEntropy:y}=s;null==f&&(f=!0),e=De("msgHash",e),p&&(e=De("prehashed msgHash",o(e)));const b=w(e),v=c(r),x=[E(v),E(b)];if(null!=y){const e=!0===y?u(n.BYTES):y;x.push(De("extraEntropy",e))}const $=qe(...x),k=b;return{seed:$,k2sig:function(e){const t=m(e);if(!d(t))return;const n=l(t),r=a.BASE.multiply(t).toAffine(),s=i(r.x);if(s===gt)return;const o=i(n*i(k+s*v));if(o===gt)return;let c=(r.x===s?0:2)|Number(r.y&yt),u=o;return f&&h(o)&&(u=function(e){return h(e)?i(-e):e}(o),c^=1),new g(s,u,c)}}}const _={lowS:t.lowS,prehash:!1},$={lowS:t.lowS,prehash:!1};return a.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return a.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,n=!0){if(b(e))throw new Error("first arg must be private key");if(!b(t))throw new Error("second arg must be public key");return a.fromHex(t).multiply(c(e)).toRawBytes(n)},sign:function(e,n,r=_){const{seed:s,k2sig:o}=x(e,n,r),i=t;return Ve(i.hash.outputLen,i.nByteLength,i.hmac)(s,o)},verify:function(e,n,r,s=$){const o=e;if(n=De("msgHash",n),r=De("publicKey",r),"strict"in s)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:u}=s;let d,f;try{if("string"==typeof o||o instanceof Uint8Array)try{d=g.fromDER(o)}catch(e){if(!(e instanceof pt.Err))throw e;d=g.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:e,s:t}=o;d=new g(e,t)}}f=a.fromHex(r)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&d.hasHighS())return!1;u&&(n=t.hash(n));const{r:h,s:p}=d,y=w(n),b=l(p),m=i(y*b),v=i(h*b),E=a.BASE.multiplyAndAddUnsafe(f,m,v)?.toAffine();return!!E&&i(E.x)===h},ProjectivePoint:a,Signature:g,utils:y}}BigInt(4);class vt extends ye{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");ae(e.outputLen),ae(e.blockLen)}(e);const n=ge(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,s=new Uint8Array(r);s.set(n.length>r?e.create().update(n).digest():n);for(let e=0;enew vt(e,t).update(n).digest(); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -function me(t){return{hash:t,hmac:(e,...n)=>be(t,e,function(...t){const e=new Uint8Array(t.reduce((t,e)=>t+e.length,0));let n=0;return t.forEach(t=>{if(!ct(t))throw new Error("Uint8Array expected");e.set(t,n),n+=t.length}),e}(...n)),randomBytes:pt}}be.create=(t,e)=>new we(t,e); +function xt(e){return{hash:e,hmac:(t,...n)=>Et(e,t,function(...e){const t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));let n=0;return e.forEach(e=>{if(!fe(e))throw new Error("Uint8Array expected");t.set(e,n),n+=e.length}),t}(...n)),randomBytes:me}}Et.create=(e,t)=>new vt(e,t); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const ve=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ee=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),xe=BigInt(1),ke=BigInt(2),$e=(t,e)=>(t+e/ke)/e;function Ae(t){const e=ve,n=BigInt(3),r=BigInt(6),s=BigInt(11),o=BigInt(22),i=BigInt(23),a=BigInt(44),l=BigInt(88),c=t*t*t%e,u=c*c*t%e,d=Xt(u,n,e)*u%e,f=Xt(d,n,e)*u%e,h=Xt(f,ke,e)*c%e,g=Xt(h,s,e)*h%e,p=Xt(g,o,e)*g%e,y=Xt(p,a,e)*p%e,w=Xt(y,l,e)*y%e,b=Xt(w,a,e)*p%e,m=Xt(b,n,e)*u%e,v=Xt(m,i,e)*g%e,E=Xt(v,r,e)*c%e,x=Xt(E,ke,e);if(!Be.eql(Be.sqr(x),t))throw new Error("Cannot find square root");return x}const Be=function(t,e,n=!1,r={}){if(t<=zt)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:s,nByteLength:o}=re(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const i=ee(t),a=Object.freeze({ORDER:t,BITS:s,BYTES:o,MASK:Pt(s),ZERO:zt,ONE:Kt,create:e=>Jt(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return zt<=e&&et===zt,isOdd:t=>(t&Kt)===Kt,neg:e=>Jt(-e,t),eql:(t,e)=>t===e,sqr:e=>Jt(e*e,t),add:(e,n)=>Jt(e+n,t),sub:(e,n)=>Jt(e-n,t),mul:(e,n)=>Jt(e*n,t),pow:(t,e)=>function(t,e,n){if(n 0");if(n===zt)return t.ONE;if(n===Kt)return e;let r=t.ONE,s=e;for(;n>zt;)n&Kt&&(r=t.mul(r,s)),s=t.sqr(s),n>>=Kt;return r}(a,t,e),div:(e,n)=>Jt(e*te(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>te(e,t),sqrt:r.sqrt||(t=>i(a,t)),invertBatch:t=>function(t,e){const n=new Array(e.length),r=e.reduce((e,r,s)=>t.is0(r)?e:(n[s]=e,t.mul(e,r)),t.ONE),s=t.inv(r);return e.reduceRight((e,r,s)=>t.is0(r)?e:(n[s]=t.mul(e,n[s]),t.mul(e,r)),s),n}(a,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?Nt(t,o):Tt(t,o),fromBytes:t=>{if(t.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return n?Ut(t):Ct(t)}});return Object.freeze(a)}(ve,void 0,void 0,{sqrt:Ae}),Ie=function(t,e){const n=e=>ye({...t,...me(e)});return Object.freeze({...n(e),create:n})}({a:BigInt(0),b:BigInt(7),Fp:Be,n:Ee,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Ee,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-xe*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,i=BigInt("0x100000000000000000000000000000000"),a=$e(o*t,e),l=$e(-r*t,e);let c=Jt(t-a*n-l*s,e),u=Jt(-a*r-l*o,e);const d=c>i,f=u>i;if(d&&(c=e-c),f&&(u=e-u),c>i||u>i)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:d,k1:c,k2neg:f,k2:u}}}},kt),_e=BigInt(0),Le=t=>"bigint"==typeof t&&_et.charCodeAt(0)));n=Rt(e,e),Se[t]=n}return kt(Rt(n,...e))}const Ue=t=>t.toRawBytes(!0).slice(1),Te=t=>Tt(t,32),Ne=t=>Jt(t,ve),Oe=t=>Jt(t,Ee),Re=Ie.ProjectivePoint;function Pe(t){let e=Ie.utils.normPrivateKeyToScalar(t),n=Re.fromPrivateKey(e);return{scalar:n.hasEvenY()?e:Oe(-e),bytes:Ue(n)}}function De(t){if(!Le(t))throw new Error("bad x: need 0 < x < p");const e=Ne(t*t);let n=Ae(Ne(e*t+BigInt(7)));n%ke!==_e&&(n=Ne(-n));const r=new Re(t,n,xe);return r.assertValidity(),r}function qe(...t){return Oe(Ct(Ce("BIP0340/challenge",...t)))}function He(t){return Pe(t).bytes}function Fe(t,e,n=pt(32)){const r=Ot("message",t),{bytes:s,scalar:o}=Pe(e),i=Ot("auxRand",n,32),a=Te(o^Ct(Ce("BIP0340/aux",i))),l=Ce("BIP0340/nonce",a,s,r),c=Oe(Ct(l));if(c===_e)throw new Error("sign failed: k is zero");const{bytes:u,scalar:d}=Pe(c),f=qe(u,s,r),h=new Uint8Array(64);if(h.set(u,0),h.set(Te(Oe(d+f*o)),32),!Ve(h,r,s))throw new Error("sign: Invalid signature produced");return h}function Ve(t,e,n){const r=Ot("signature",t,64),s=Ot("message",e),o=Ot("publicKey",n,32);try{const t=De(Ct(o)),e=Ct(r.subarray(0,32));if(!Le(e))return!1;const n=Ct(r.subarray(32,64));if(!("bigint"==typeof(c=n)&&_e({getPublicKey:He,sign:Fe,verify:Ve,utils:{randomPrivateKey:Ie.utils.randomPrivateKey,lift_x:De,pointToBytes:Ue,numberToBytesBE:Tt,bytesToNumberBE:Ct,taggedHash:Ce,mod:Jt}}))(),ze=t=>t instanceof Uint8Array,Ke=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),Me=(t,e)=>t<<32-e|t>>>e; -/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");const Ze=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Ge(t){if(!ze(t))throw new Error("Uint8Array expected");let e="";for(let n=0;nt().update(We(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Qe(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function Xe(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}const tn={number:Qe,bool:function(t){if("boolean"!=typeof t)throw new Error(`Expected boolean, not ${t}`)},bytes:Xe,hash:function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");Qe(t.outputLen),Qe(t.blockLen)},exists:function(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")},output:function(t,e){Xe(t);const n=e.outputLen;if(t.lengthr-o&&(this.process(n,0),o=0);for(let t=o;t>s&o),a=Number(n&o),l=r?4:0,c=r?0:4;t.setUint32(e+l,i,r),t.setUint32(e+c,a,r)}(n,r-8,BigInt(8*this.length),s),this.process(n,0);const i=Ke(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;tt&e^~t&n,rn=(t,e,n)=>t&e^t&n^e&n,sn=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),on=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),an=new Uint32Array(64);class ln extends en{constructor(){super(64,32,8,!1),this.A=0|on[0],this.B=0|on[1],this.C=0|on[2],this.D=0|on[3],this.E=0|on[4],this.F=0|on[5],this.G=0|on[6],this.H=0|on[7]}get(){const{A:t,B:e,C:n,D:r,E:s,F:o,G:i,H:a}=this;return[t,e,n,r,s,o,i,a]}set(t,e,n,r,s,o,i,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|s,this.F=0|o,this.G=0|i,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)an[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=an[t-15],n=an[t-2],r=Me(e,7)^Me(e,18)^e>>>3,s=Me(n,17)^Me(n,19)^n>>>10;an[t]=s+an[t-7]+r+an[t-16]|0}let{A:n,B:r,C:s,D:o,E:i,F:a,G:l,H:c}=this;for(let t=0;t<64;t++){const e=c+(Me(i,6)^Me(i,11)^Me(i,25))+nn(i,a,l)+sn[t]+an[t]|0,u=(Me(n,2)^Me(n,13)^Me(n,22))+rn(n,r,s)|0;c=l,l=a,a=i,i=o+e|0,o=s,s=r,r=n,n=e+u|0}n=n+this.A|0,r=r+this.B|0,s=s+this.C|0,o=o+this.D|0,i=i+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,s,o,i,a,l,c)}roundClean(){an.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class cn extends ln{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const un=Je(()=>new ln);Je(()=>new cn);var dn=Symbol("verified");function fn(t){if(!(t instanceof Object))return!1;if("number"!=typeof t.kind)return!1;if("string"!=typeof t.content)return!1;if("number"!=typeof t.created_at)return!1;if("string"!=typeof t.pubkey)return!1;if(!t.pubkey.match(/^[a-f0-9]{64}$/))return!1;if(!Array.isArray(t.tags))return!1;for(let e=0;e(e+t/At)/t;function It(e){const t=_t,n=BigInt(3),r=BigInt(6),s=BigInt(11),o=BigInt(22),i=BigInt(23),l=BigInt(44),a=BigInt(88),c=e*e*e%t,u=c*c*e%t,d=nt(u,n,t)*u%t,f=nt(d,n,t)*u%t,h=nt(f,At,t)*c%t,p=nt(h,s,t)*h%t,g=nt(p,o,t)*p%t,y=nt(g,l,t)*g%t,b=nt(y,a,t)*y%t,m=nt(b,l,t)*g%t,w=nt(m,n,t)*u%t,v=nt(w,i,t)*p%t,E=nt(v,r,t)*c%t,x=nt(E,At,t);if(!St.eql(St.sqr(x),e))throw new Error("Cannot find square root");return x}const St=function(e,t,n=!1,r={}){if(e<=Ze)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:s,nByteLength:o}=it(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const i=st(e),l=Object.freeze({ORDER:e,BITS:s,BYTES:o,MASK:He(s),ZERO:Ze,ONE:We,create:t=>et(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return Ze<=t&&te===Ze,isOdd:e=>(e&We)===We,neg:t=>et(-t,e),eql:(e,t)=>e===t,sqr:t=>et(t*t,e),add:(t,n)=>et(t+n,e),sub:(t,n)=>et(t-n,e),mul:(t,n)=>et(t*n,e),pow:(e,t)=>function(e,t,n){if(n 0");if(n===Ze)return e.ONE;if(n===We)return t;let r=e.ONE,s=t;for(;n>Ze;)n&We&&(r=e.mul(r,s)),s=e.sqr(s),n>>=We;return r}(l,e,t),div:(t,n)=>et(t*rt(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>rt(t,e),sqrt:r.sqrt||(e=>i(l,e)),invertBatch:e=>function(e,t){const n=new Array(t.length),r=t.reduce((t,r,s)=>e.is0(r)?t:(n[s]=t,e.mul(t,r)),e.ONE),s=e.inv(r);return t.reduceRight((t,r,s)=>e.is0(r)?t:(n[s]=e.mul(t,n[s]),e.mul(t,r)),s),n}(l,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?Pe(e,o):Re(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return n?Te(e):Oe(e)}});return Object.freeze(l)}(_t,void 0,void 0,{sqrt:It}),Ct=function(e,t){const n=t=>wt({...e,...xt(t)});return Object.freeze({...n(t),create:n})}({a:BigInt(0),b:BigInt(7),Fp:St,n:$t,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=$t,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-kt*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,i=BigInt("0x100000000000000000000000000000000"),l=Bt(o*e,t),a=Bt(-r*e,t);let c=et(e-l*n-a*s,t),u=et(-l*r-a*o,t);const d=c>i,f=u>i;if(d&&(c=t-c),f&&(u=t-u),c>i||u>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:c,k2neg:f,k2:u}}}},Ae),Lt=BigInt(0),Nt=e=>"bigint"==typeof e&&Lte.charCodeAt(0)));n=qe(t,t),Ut[e]=n}return Ae(qe(n,...t))}const Tt=e=>e.toRawBytes(!0).slice(1),Rt=e=>Re(e,32),Pt=e=>et(e,_t),Dt=e=>et(e,$t),qt=Ct.ProjectivePoint;function Ht(e){let t=Ct.utils.normPrivateKeyToScalar(e),n=qt.fromPrivateKey(t);return{scalar:n.hasEvenY()?t:Dt(-t),bytes:Tt(n)}}function jt(e){if(!Nt(e))throw new Error("bad x: need 0 < x < p");const t=Pt(e*e);let n=It(Pt(t*e+BigInt(7)));n%At!==Lt&&(n=Pt(-n));const r=new qt(e,n,kt);return r.assertValidity(),r}function Ft(...e){return Dt(Oe(Ot("BIP0340/challenge",...e)))}function Vt(e){return Ht(e).bytes}function zt(e,t,n=me(32)){const r=De("message",e),{bytes:s,scalar:o}=Ht(t),i=De("auxRand",n,32),l=Rt(o^Oe(Ot("BIP0340/aux",i))),a=Ot("BIP0340/nonce",l,s,r),c=Dt(Oe(a));if(c===Lt)throw new Error("sign failed: k is zero");const{bytes:u,scalar:d}=Ht(c),f=Ft(u,s,r),h=new Uint8Array(64);if(h.set(u,0),h.set(Rt(Dt(d+f*o)),32),!Kt(h,r,s))throw new Error("sign: Invalid signature produced");return h}function Kt(e,t,n){const r=De("signature",e,64),s=De("message",t),o=De("publicKey",n,32);try{const e=jt(Oe(o)),t=Oe(r.subarray(0,32));if(!Nt(t))return!1;const n=Oe(r.subarray(32,64));if(!("bigint"==typeof(c=n)&&Lt({getPublicKey:Vt,sign:zt,verify:Kt,utils:{randomPrivateKey:Ct.utils.randomPrivateKey,lift_x:jt,pointToBytes:Tt,numberToBytesBE:Re,bytesToNumberBE:Oe,taggedHash:Ot,mod:et}}))(),Zt=e=>e instanceof Uint8Array,Wt=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Gt=(e,t)=>e<<32-t|e>>>t; +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");const Yt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Jt(e){if(!Zt(e))throw new Error("Uint8Array expected");let t="";for(let n=0;ne().update(Qt(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function tn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function nn(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}const rn={number:tn,bool:function(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)},bytes:nn,hash:function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");tn(e.outputLen),tn(e.blockLen)},exists:function(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")},output:function(e,t){nn(e);const n=t.outputLen;if(e.lengthr-o&&(this.process(n,0),o=0);for(let e=o;e>s&o),l=Number(n&o),a=r?4:0,c=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+c,l,r)}(n,r-8,BigInt(8*this.length),s),this.process(n,0);const i=Wt(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const a=l/4,c=this.get();if(a>c.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;ee&t^~e&n,ln=(e,t,n)=>e&t^e&n^t&n,an=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),cn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),un=new Uint32Array(64);class dn extends sn{constructor(){super(64,32,8,!1),this.A=0|cn[0],this.B=0|cn[1],this.C=0|cn[2],this.D=0|cn[3],this.E=0|cn[4],this.F=0|cn[5],this.G=0|cn[6],this.H=0|cn[7]}get(){const{A:e,B:t,C:n,D:r,E:s,F:o,G:i,H:l}=this;return[e,t,n,r,s,o,i,l]}set(e,t,n,r,s,o,i,l){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|s,this.F=0|o,this.G=0|i,this.H=0|l}process(e,t){for(let n=0;n<16;n++,t+=4)un[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=un[e-15],n=un[e-2],r=Gt(t,7)^Gt(t,18)^t>>>3,s=Gt(n,17)^Gt(n,19)^n>>>10;un[e]=s+un[e-7]+r+un[e-16]|0}let{A:n,B:r,C:s,D:o,E:i,F:l,G:a,H:c}=this;for(let e=0;e<64;e++){const t=c+(Gt(i,6)^Gt(i,11)^Gt(i,25))+on(i,l,a)+an[e]+un[e]|0,u=(Gt(n,2)^Gt(n,13)^Gt(n,22))+ln(n,r,s)|0;c=a,a=l,l=i,i=o+t|0,o=s,s=r,r=n,n=t+u|0}n=n+this.A|0,r=r+this.B|0,s=s+this.C|0,o=o+this.D|0,i=i+this.E|0,l=l+this.F|0,a=a+this.G|0,c=c+this.H|0,this.set(n,r,s,o,i,l,a,c)}roundClean(){un.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class fn extends dn{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const hn=en(()=>new dn);en(()=>new fn);var pn=Symbol("verified");function gn(e){if(!(e instanceof Object))return!1;if("number"!=typeof e.kind)return!1;if("string"!=typeof e.content)return!1;if("number"!=typeof e.created_at)return!1;if("string"!=typeof e.pubkey)return!1;if(!e.pubkey.match(/^[a-f0-9]{64}$/))return!1;if(!Array.isArray(e.tags))return!1;for(let t=0;tn=>t(e(n)),n=Array.from(t).reverse().reduce((t,n)=>t?e(t,n.encode):n.encode,void 0),r=t.reduce((t,n)=>t?e(t,n.decode):n.decode,void 0);return{encode:n,decode:r}}function En(t){return{encode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("alphabet.encode input should be an array of numbers");return e.map(e=>{if(mn(e),e<0||e>=t.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${t.length})`);return t[e]})},decode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("alphabet.decode input should be array of strings");return e.map(e=>{if("string"!=typeof e)throw new Error(`alphabet.decode: not string element=${e}`);const n=t.indexOf(e);if(-1===n)throw new Error(`Unknown letter: "${e}". Allowed: ${t}`);return n})}}}function xn(t=""){if("string"!=typeof t)throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("join.encode input should be array of strings");for(let t of e)if("string"!=typeof t)throw new Error(`join.encode: non-string input=${t}`);return e.join(t)},decode:e=>{if("string"!=typeof e)throw new Error("join.decode input should be string");return e.split(t)}}}function kn(t,e="="){if(mn(t),"string"!=typeof e)throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let t of n)if("string"!=typeof t)throw new Error(`padding.encode: non-string input=${t}`);for(;n.length*t%8;)n.push(e);return n},decode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let t of n)if("string"!=typeof t)throw new Error(`padding.decode: non-string input=${t}`);let r=n.length;if(r*t%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===e;r--)if(!((r-1)*t%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function $n(t){if("function"!=typeof t)throw new Error("normalize fn should be function");return{encode:t=>t,decode:e=>t(e)}}function An(t,e,n){if(e<2)throw new Error(`convertRadix: wrong from=${e}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(t))throw new Error("convertRadix: data should be array");if(!t.length)return[];let r=0;const s=[],o=Array.from(t);for(o.forEach(t=>{if(mn(t),t<0||t>=e)throw new Error(`Wrong integer: ${t}`)});;){let t=0,i=!0;for(let s=r;se?Bn(e,t%e):t,In=(t,e)=>t+(e-Bn(t,e));function _n(t,e,n,r){if(!Array.isArray(t))throw new Error("convertRadix2: data should be array");if(e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(In(e,n)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${In(e,n)}`);let s=0,o=0;const i=2**n-1,a=[];for(const r of t){if(mn(r),r>=2**e)throw new Error(`convertRadix2: invalid data word=${r} from=${e}`);if(s=s<32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${e}`);for(o+=e;o>=n;o-=n)a.push((s>>o-n&i)>>>0);s&=2**o-1}if(s=s<=e)throw new Error("Excess padding");if(!r&&s)throw new Error(`Non-zero padding: ${s}`);return r&&o>0&&a.push(s>>>0),a}function Ln(t,e=!1){if(mn(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(In(8,t)>32||In(t,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!(n instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return _n(Array.from(n),8,t,!e)},decode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(_n(n,t,8,e))}}}function Sn(t){if("function"!=typeof t)throw new Error("unsafeWrapper fn should be function");return function(...e){try{return t.apply(null,e)}catch(t){}}}const Cn=vn(Ln(4),En("0123456789ABCDEF"),xn("")),Un=vn(Ln(5),En("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),kn(5),xn(""));vn(Ln(5),En("0123456789ABCDEFGHIJKLMNOPQRSTUV"),kn(5),xn("")),vn(Ln(5),En("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),xn(""),$n(t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));const Tn=vn(Ln(6),En("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),kn(6),xn("")),Nn=vn(Ln(6),En("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),kn(6),xn("")),On=t=>{return vn((mn(e=58),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return An(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(An(t,e,256))}}),En(t),xn(""));var e},Rn=On("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");On("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),On("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const Pn=[0,2,3,5,6,7,9,10,11],Dn={encode(t){let e="";for(let n=0;n>25;let n=(33554431&t)<<5;for(let t=0;t>t&1)&&(n^=Hn[t]);return n}function Vn(t,e,n=1){const r=t.length;let s=1;for(let e=0;e126)throw new Error(`Invalid prefix (${t})`);s=Fn(s)^n>>5}s=Fn(s);for(let e=0;en)throw new TypeError(`Wrong string length: ${t.length} (${t}). Expected (8..${n})`);const r=t.toLowerCase();if(t!==r&&t!==t.toUpperCase())throw new Error("String must be lowercase or uppercase");const s=(t=r).lastIndexOf("1");if(0===s||-1===s)throw new Error('Letter "1" must be present between prefix and data only');const o=t.slice(0,s),i=t.slice(s+1);if(i.length<6)throw new Error("Data must be at least 6 characters long");const a=qn.decode(i).slice(0,-6),l=Vn(o,a,e);if(!i.endsWith(l))throw new Error(`Invalid checksum in ${t}: expected "${l}"`);return{prefix:o,words:a}}return{encode:function(t,n,r=90){if("string"!=typeof t)throw new Error("bech32.encode prefix should be string, not "+typeof t);if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof n);const s=t.length+7+n.length;if(!1!==r&&s>r)throw new TypeError(`Length ${s} exceeds limit ${r}`);return`${t=t.toLowerCase()}1${qn.encode(n)}${Vn(t,n,e)}`},decode:i,decodeToBytes:function(t){const{prefix:e,words:n}=i(t,!1);return{prefix:e,words:n,bytes:r(n)}},decodeUnsafe:Sn(i),fromWords:r,fromWordsUnsafe:o,toWords:s}}const zn=jn("bech32");jn("bech32m");const Kn={utf8:{encode:t=>(new TextDecoder).decode(t),decode:t=>(new TextEncoder).encode(t)},hex:vn(Ln(4),En("0123456789abcdef"),xn(""),$n(t=>{if("string"!=typeof t||t.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);return t.toLowerCase()})),base16:Cn,base32:Un,base64:Tn,base64url:Nn,base58:Rn,base58xmr:Dn};Object.keys(Kn).join(", ");var Mn=new TextDecoder("utf-8");new TextEncoder;function Zn(t){let e={},n=t;for(;n.length>0;){let t=n[0],r=n[1],s=n.slice(2,2+r);if(n=n.slice(2+r),s.lengthMn.decode(t)):[]}}}case"nevent":{let t=Zn(r);if(!t[0]?.[0])throw new Error("missing TLV 0 for nevent");if(32!==t[0][0].length)throw new Error("TLV 0 should be 32 bytes");if(t[2]&&32!==t[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(t[3]&&4!==t[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:Ge(t[0][0]),relays:t[1]?t[1].map(t=>Mn.decode(t)):[],author:t[2]?.[0]?Ge(t[2][0]):void 0,kind:t[3]?.[0]?parseInt(Ge(t[3][0]),16):void 0}}}case"naddr":{let t=Zn(r);if(!t[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!t[2]?.[0])throw new Error("missing TLV 2 for naddr");if(32!==t[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(!t[3]?.[0])throw new Error("missing TLV 3 for naddr");if(4!==t[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:Mn.decode(t[0][0]),pubkey:Ge(t[2][0]),kind:parseInt(Ge(t[3][0]),16),relays:t[1]?t[1].map(t=>Mn.decode(t)):[]}}}case"nsec":return{type:e,data:r};case"npub":case"note":return{type:e,data:Ge(r)};default:throw new Error(`unknown prefix ${e}`)}}(t)}catch{throw new Error("Invalid nsec format")}if("nsec"!==e.type)throw new Error("Please enter an nsec (private key)");const s=e.data,o=wn(s),i={getPublicKey:async()=>o,signEvent:async t=>bn(t,s)};n(6,u="Successfully logged in!"),r("login",{method:"nsec",pubkey:o,privateKey:t,signer:i}),setTimeout(h,500)}catch(t){n(5,c=t.message)}finally{n(4,l=!1)}}return t.$$set=t=>{"showModal"in t&&n(0,s=t.showModal),"isDarkTheme"in t&&n(1,o=t.isDarkTheme)},[s,o,i,a,l,c,u,f,h,g,async function(){n(5,c=""),n(6,u="");try{const t=yn(),e=Wn("nsec",t),r=Gn(wn(t));d=e,n(7,f=r),n(3,a=e),n(6,u="New key generated!")}catch(t){n(5,c="Failed to generate key: "+t.message)}},async function(){n(4,l=!0),n(5,c=""),n(6,u="");try{if(!window.nostr)throw new Error("No Nostr extension found. Please install nos2x or Alby.");const t=await window.nostr.getPublicKey();t&&(n(6,u="Successfully logged in with extension!"),r("login",{method:"extension",pubkey:t,signer:window.nostr}),setTimeout(h,500))}catch(t){n(5,c=t.message)}finally{n(4,l=!1)}},p,function(t){"Escape"===t.key&&h(),"Enter"===t.key&&"nsec"===i&&p()},function(e){_.call(this,t,e)},function(e){_.call(this,t,e)},()=>g("extension"),()=>g("nsec"),function(){a=this.value,n(3,a)},t=>"Escape"===t.key&&h()]}class or extends Q{constructor(t){super(),J(this,t,sr,rr,o,{showModal:0,isDarkTheme:1})}}const ir=[];function ar(e,n=t){let r;const s=new Set;function i(t){if(o(e,t)&&(e=t,r)){const t=!ir.length;for(const t of s)t[1](),ir.push(t,e);if(t){for(let t=0;t{s.delete(c),0===s.size&&r&&(r(),r=null)}}}}const lr=ar(!1),cr=ar(""),ur=ar(null),dr=ar(""),fr=ar(null),hr=ar(null),gr=ar(null),pr=ar(!1),yr=ar("");async function wr(t,e={},n,r){const s=`${window.location.origin}${t}`,o=e.method||"GET",i=await async function(t,e,n,r){if(!t||!e)return null;try{const e={kind:27235,created_at:Math.floor(Date.now()/1e3),tags:[["u",r],["method",n.toUpperCase()]],content:""},s=await t.signEvent(e),o=JSON.stringify(s);return btoa(o).replace(/\+/g,"-").replace(/\//g,"_")}catch(t){return console.error("createNIP98Auth error:",t),null}}(n,r,o,s),a={...e.headers};return i&&(a.Authorization=`Nostr ${i}`),fetch(s,{...e,headers:a})}function br(t){let e,n,r,s,o,i=t[0].pid+"";return{c(){e=h("div"),n=h("span"),n.textContent="PID:",r=p(),s=h("span"),o=g(i),b(n,"class","label svelte-xh5u5u"),b(s,"class","value svelte-xh5u5u"),b(e,"class","detail-row svelte-xh5u5u")},m(t,i){u(t,e,i),c(e,n),c(e,r),c(e,s),c(s,o)},p(t,e){1&e&&i!==(i=t[0].pid+"")&&m(o,i)},d(t){t&&d(e)}}}function mr(t){let e,n,r,s,o,i=t[0].restarts+"";return{c(){e=h("div"),n=h("span"),n.textContent="Restarts:",r=p(),s=h("span"),o=g(i),b(n,"class","label svelte-xh5u5u"),b(s,"class","value warning svelte-xh5u5u"),b(e,"class","detail-row svelte-xh5u5u")},m(t,i){u(t,e,i),c(e,n),c(e,r),c(e,s),c(s,o)},p(t,e){1&e&&i!==(i=t[0].restarts+"")&&m(o,i)},d(t){t&&d(e)}}}function vr(e){let n,r,s,o,i,a,l,f,y,w,v,x,k,$,A,B,I,_,L,S,C,U,T=xr(e[0].status)+"",N=e[0].name+"",O=e[0].status+"",R=e[0].binary+"",P=e[0].pid>0&&br(e),D=e[0].restarts>0&&mr(e);return{c(){n=h("div"),r=h("div"),s=h("span"),o=g(T),i=p(),a=h("span"),l=g(N),f=p(),y=h("div"),w=h("div"),v=h("span"),v.textContent="Status:",x=p(),k=h("span"),$=g(O),A=p(),P&&P.c(),B=p(),I=h("div"),_=h("span"),_.textContent="Binary:",L=p(),S=h("span"),C=g(R),U=p(),D&&D.c(),b(s,"class","status-indicator svelte-xh5u5u"),E(s,"color",Er(e[0].status)),b(a,"class","process-name svelte-xh5u5u"),b(r,"class","process-header svelte-xh5u5u"),b(v,"class","label svelte-xh5u5u"),b(k,"class","value svelte-xh5u5u"),E(k,"color",Er(e[0].status)),b(w,"class","detail-row svelte-xh5u5u"),b(_,"class","label svelte-xh5u5u"),b(S,"class","value binary svelte-xh5u5u"),b(I,"class","detail-row svelte-xh5u5u"),b(y,"class","process-details svelte-xh5u5u"),b(n,"class","process-card svelte-xh5u5u")},m(t,e){u(t,n,e),c(n,r),c(r,s),c(s,o),c(r,i),c(r,a),c(a,l),c(n,f),c(n,y),c(y,w),c(w,v),c(w,x),c(w,k),c(k,$),c(y,A),P&&P.m(y,null),c(y,B),c(y,I),c(I,_),c(I,L),c(I,S),c(S,C),c(y,U),D&&D.m(y,null)},p(t,[e]){1&e&&T!==(T=xr(t[0].status)+"")&&m(o,T),1&e&&E(s,"color",Er(t[0].status)),1&e&&N!==(N=t[0].name+"")&&m(l,N),1&e&&O!==(O=t[0].status+"")&&m($,O),1&e&&E(k,"color",Er(t[0].status)),t[0].pid>0?P?P.p(t,e):(P=br(t),P.c(),P.m(y,B)):P&&(P.d(1),P=null),1&e&&R!==(R=t[0].binary+"")&&m(C,R),t[0].restarts>0?D?D.p(t,e):(D=mr(t),D.c(),D.m(y,null)):D&&(D.d(1),D=null)},i:t,o:t,d(t){t&&d(n),P&&P.d(),D&&D.d()}}}function Er(t){switch(t){case"running":return"var(--success)";case"stopped":default:return"var(--muted-color)";case"crashed":return"var(--error)"}}function xr(t){switch(t){case"running":return"●";case"stopped":return"○";case"crashed":return"✗";default:return"?"}}function kr(t,e,n){let{process:r}=e;return t.$$set=t=>{"process"in t&&n(0,r=t.process)},[r]}class $r extends Q{constructor(t){super(),J(this,t,kr,vr,o,{process:0})}}function Ar(t,e,n){const r=t.slice();return r[8]=e[n],r}function Br(t){let e,n;return{c(){e=h("div"),n=g(t[1]),b(e,"class","error-banner svelte-17dya06")},m(t,r){u(t,e,r),c(e,n)},p(t,e){2&e&&m(n,t[1])},d(t){t&&d(e)}}}function Ir(e){let n;return{c(){n=h("div"),n.textContent="Loading status...",b(n,"class","loading svelte-17dya06")},m(t,e){u(t,n,e)},p:t,i:t,o:t,d(t){t&&d(n)}}}function _r(t){let e,n,r,s,o,i,a,l,y,w,v,E,x,k,$,A,B,I,_,L,S,C,U,T=t[2].version+"",N=t[2].uptime+"",O=(t[2].processes?.length||0)+"",R=M(t[2].processes||[]),P=[];for(let e=0;eK(P[t],1,1,()=>{P[t]=null});return{c(){e=h("div"),n=h("div"),r=h("span"),r.textContent="Version",s=p(),o=h("span"),i=g(T),a=p(),l=h("div"),y=h("span"),y.textContent="Uptime",w=p(),v=h("span"),E=g(N),x=p(),k=h("div"),$=h("span"),$.textContent="Processes",A=p(),B=h("span"),I=g(O),_=p(),L=h("h3"),L.textContent="Managed Processes",S=p(),C=h("div");for(let t=0;t{L[r]=null}),j()),~x?(k=L[x],k?k.p(t,n):(k=L[x]=_[x](t),k.c()),z(k,1),k.m(e,null)):k=null)},i(t){$||(z(k),$=!0)},o(t){K(k),$=!1},d(t){t&&d(e),I&&I.d(),~x&&L[x].d(),A=!1,r(B)}}}function Cr(t,e,n){let r,s,o,l,c,u;var d;async function f(){try{a(fr,c=await async function(t,e){const n=await wr("/api/status",{},t,e);if(!n.ok)throw new Error(`Failed to fetch status: ${n.statusText}`);return n.json()}(l,o),c),a(yr,s="",s)}catch(t){a(yr,s=t.message,s)}}return i(t,pr,t=>n(0,r=t)),i(t,yr,t=>n(1,s=t)),i(t,cr,t=>n(6,o=t)),i(t,ur,t=>n(7,l=t)),i(t,fr,t=>n(2,c=t)),B(async()=>{await f(),u=setInterval(f,5e3)}),d=()=>{u&&clearInterval(u)},A().$$.on_destroy.push(d),[r,s,c,f,async function(){if(confirm("Are you sure you want to restart all services?")){a(pr,r=!0,r);try{await async function(t,e){const n=await wr("/api/restart",{method:"POST"},t,e);if(!n.ok)throw new Error(`Restart failed: ${n.statusText}`);return n.json()}(l,o),setTimeout(f,2e3)}catch(t){a(yr,s=t.message,s)}finally{a(pr,r=!1,r)}}}]}class Ur extends Q{constructor(t){super(),J(this,t,Cr,Sr,o,{})}}function Tr(t,e,n){const r=t.slice();return r[6]=e[n],r}function Nr(t){let e,n;return{c(){e=h("div"),n=g(t[1]),b(e,"class","error-banner svelte-1kruta9")},m(t,r){u(t,e,r),c(e,n)},p(t,e){2&e&&m(n,t[1])},d(t){t&&d(e)}}}function Or(e){let n;return{c(){n=h("div"),n.textContent="Loading configuration...",b(n,"class","loading svelte-1kruta9")},m(t,e){u(t,n,e)},p:t,d(t){t&&d(n)}}}function Rr(t){let e,n,r,s,o,i,a,l,y,w,v,E,k,$,A,B,I,_,L,S,C,U,T,N,O,R,P,D,q,H,F,V,j,z,K,Z,G,W,Y,J,Q,X,tt,et,nt,rt,st,ot,it,at,lt,ct,ut,dt,ft,ht,gt,pt,yt,wt,bt,mt,vt,Et,xt,kt,$t,At,Bt,It,_t,Lt,St,Ct,Ut,Tt,Nt,Ot,Rt,Pt,Dt,qt,Ht,Ft,Vt,jt,zt,Kt,Mt,Zt,Gt,Wt,Yt,Jt,Qt,Xt,te,ee,ne,re,se,oe,ie,ae,le,ce,ue,de,fe,he,ge,pe,ye,we,be,me,ve,Ee=t[2].db_backend+"",xe=t[2].db_binary+"",ke=t[2].db_listen+"",$e=t[2].data_dir+"",Ae=t[2].acl_enabled?"Yes":"No",Be=t[2].acl_mode+"",Ie=t[2].acl_binary+"",_e=t[2].acl_listen+"",Le=t[2].relay_binary+"",Se=t[2].log_level+"",Ce=t[2].distributed_sync_enabled?"Enabled":"Disabled",Ue=t[2].cluster_sync_enabled?"Enabled":"Disabled",Te=t[2].relay_group_enabled?"Enabled":"Disabled",Ne=t[2].negentropy_enabled?"Enabled":"Disabled",Oe=t[2].bin_dir+"",Re=M(t[2].admin_owners||[]),Pe=[];for(let e=0;eConfiguration is loaded from environment variables. To change settings, update the environment and restart the launcher.

',b(r,"class","svelte-1kruta9"),b(a,"class","label svelte-1kruta9"),b(y,"class","value svelte-1kruta9"),b(i,"class","config-item svelte-1kruta9"),b(k,"class","label svelte-1kruta9"),b(A,"class","value mono svelte-1kruta9"),b(E,"class","config-item svelte-1kruta9"),b(L,"class","label svelte-1kruta9"),b(C,"class","value mono svelte-1kruta9"),b(_,"class","config-item svelte-1kruta9"),b(O,"class","label svelte-1kruta9"),b(P,"class","value mono svelte-1kruta9"),b(N,"class","config-item svelte-1kruta9"),b(o,"class","config-grid svelte-1kruta9"),b(n,"class","config-section svelte-1kruta9"),b(F,"class","svelte-1kruta9"),b(K,"class","label svelte-1kruta9"),b(G,"class","value bool svelte-1kruta9"),x(G,"enabled",t[2].acl_enabled),b(z,"class","config-item svelte-1kruta9"),b(Q,"class","label svelte-1kruta9"),b(tt,"class","value svelte-1kruta9"),b(J,"class","config-item svelte-1kruta9"),b(st,"class","label svelte-1kruta9"),b(it,"class","value mono svelte-1kruta9"),b(rt,"class","config-item svelte-1kruta9"),b(ut,"class","label svelte-1kruta9"),b(ft,"class","value mono svelte-1kruta9"),b(ct,"class","config-item svelte-1kruta9"),b(j,"class","config-grid svelte-1kruta9"),b(H,"class","config-section svelte-1kruta9"),b(yt,"class","svelte-1kruta9"),b(vt,"class","label svelte-1kruta9"),b(xt,"class","value mono svelte-1kruta9"),b(mt,"class","config-item svelte-1kruta9"),b(Bt,"class","label svelte-1kruta9"),b(_t,"class","value svelte-1kruta9"),b(At,"class","config-item svelte-1kruta9"),b(bt,"class","config-grid svelte-1kruta9"),b(pt,"class","config-section svelte-1kruta9"),b(Ut,"class","svelte-1kruta9"),b(Rt,"class","label svelte-1kruta9"),b(Dt,"class","value bool svelte-1kruta9"),x(Dt,"enabled",t[2].distributed_sync_enabled),b(Ot,"class","config-item svelte-1kruta9"),b(Vt,"class","label svelte-1kruta9"),b(zt,"class","value bool svelte-1kruta9"),x(zt,"enabled",t[2].cluster_sync_enabled),b(Ft,"class","config-item svelte-1kruta9"),b(Gt,"class","label svelte-1kruta9"),b(Yt,"class","value bool svelte-1kruta9"),x(Yt,"enabled",t[2].relay_group_enabled),b(Zt,"class","config-item svelte-1kruta9"),b(te,"class","label svelte-1kruta9"),b(ne,"class","value bool svelte-1kruta9"),x(ne,"enabled",t[2].negentropy_enabled),b(Xt,"class","config-item svelte-1kruta9"),b(Nt,"class","config-grid svelte-1kruta9"),b(Ct,"class","config-section svelte-1kruta9"),b(ie,"class","svelte-1kruta9"),b(ue,"class","label svelte-1kruta9"),b(fe,"class","value mono svelte-1kruta9"),b(ce,"class","config-item svelte-1kruta9"),b(ye,"class","label svelte-1kruta9"),b(be,"class","owners-list svelte-1kruta9"),b(pe,"class","config-item full-width svelte-1kruta9"),b(le,"class","config-grid svelte-1kruta9"),b(oe,"class","config-section svelte-1kruta9"),b(e,"class","config-sections svelte-1kruta9"),b(ve,"class","config-note svelte-1kruta9")},m(t,d){u(t,e,d),c(e,n),c(n,r),c(n,s),c(n,o),c(o,i),c(i,a),c(i,l),c(i,y),c(y,w),c(o,v),c(o,E),c(E,k),c(E,$),c(E,A),c(A,B),c(o,I),c(o,_),c(_,L),c(_,S),c(_,C),c(C,U),c(o,T),c(o,N),c(N,O),c(N,R),c(N,P),c(P,D),c(e,q),c(e,H),c(H,F),c(H,V),c(H,j),c(j,z),c(z,K),c(z,Z),c(z,G),c(G,W),c(j,Y),c(j,J),c(J,Q),c(J,X),c(J,tt),c(tt,et),c(j,nt),c(j,rt),c(rt,st),c(rt,ot),c(rt,it),c(it,at),c(j,lt),c(j,ct),c(ct,ut),c(ct,dt),c(ct,ft),c(ft,ht),c(e,gt),c(e,pt),c(pt,yt),c(pt,wt),c(pt,bt),c(bt,mt),c(mt,vt),c(mt,Et),c(mt,xt),c(xt,kt),c(bt,$t),c(bt,At),c(At,Bt),c(At,It),c(At,_t),c(_t,Lt),c(e,St),c(e,Ct),c(Ct,Ut),c(Ct,Tt),c(Ct,Nt),c(Nt,Ot),c(Ot,Rt),c(Ot,Pt),c(Ot,Dt),c(Dt,qt),c(Nt,Ht),c(Nt,Ft),c(Ft,Vt),c(Ft,jt),c(Ft,zt),c(zt,Kt),c(Nt,Mt),c(Nt,Zt),c(Zt,Gt),c(Zt,Wt),c(Zt,Yt),c(Yt,Jt),c(Nt,Qt),c(Nt,Xt),c(Xt,te),c(Xt,ee),c(Xt,ne),c(ne,re),c(e,se),c(e,oe),c(oe,ie),c(oe,ae),c(oe,le),c(le,ce),c(ce,ue),c(ce,de),c(ce,fe),c(fe,he),c(le,ge),c(le,pe),c(pe,ye),c(pe,we),c(pe,be);for(let t=0;tn(0,r=t)),i(t,yr,t=>n(1,s=t)),i(t,cr,t=>n(4,o=t)),i(t,ur,t=>n(5,l=t)),i(t,hr,t=>n(2,c=t)),B(async()=>{await u()}),[r,s,c,u]}class Fr extends Q{constructor(t){super(),J(this,t,Hr,qr,o,{})}}function Vr(t,e,n){const r=t.slice();return r[15]=e[n],r}function jr(t,e,n){const r=t.slice();return r[18]=e[n],r[19]=e,r[20]=n,r}function zr(t){let e,n;return{c(){e=h("div"),n=g(t[4]),b(e,"class","error-banner svelte-1ig49gt")},m(t,r){u(t,e,r),c(e,n)},p(t,e){16&e&&m(n,t[4])},d(t){t&&d(e)}}}function Kr(t){let e,n,r,s=t[2].message+"",o=t[2].downloaded_files?.length&&Mr(t);return{c(){e=h("div"),n=g(s),r=p(),o&&o.c(),b(e,"class","success-banner svelte-1ig49gt")},m(t,s){u(t,e,s),c(e,n),c(e,r),o&&o.m(e,null)},p(t,r){4&r&&s!==(s=t[2].message+"")&&m(n,s),t[2].downloaded_files?.length?o?o.p(t,r):(o=Mr(t),o.c(),o.m(e,null)):o&&(o.d(1),o=null)},d(t){t&&d(e),o&&o.d()}}}function Mr(t){let e,n,r,s=t[2].downloaded_files.join(", ")+"";return{c(){e=h("br"),n=g("Downloaded: "),r=g(s)},m(t,s){u(t,e,s),u(t,n,s),u(t,r,s)},p(t,e){4&e&&s!==(s=t[2].downloaded_files.join(", ")+"")&&m(r,s)},d(t){t&&(d(e),d(n),d(r))}}}function Zr(t){let e,n,r,s,o,i,a,l,f=t[18]+"";function w(){t[10].call(o,t[18])}return{c(){e=h("div"),n=h("span"),r=g(f),s=p(),o=h("input"),i=p(),b(n,"class","binary-name svelte-1ig49gt"),b(o,"type","text"),b(o,"placeholder","https://..."),o.disabled=t[3],b(o,"class","svelte-1ig49gt"),b(e,"class","url-input svelte-1ig49gt")},m(d,f){u(d,e,f),c(e,n),c(n,r),c(e,s),c(e,o),v(o,t[1][t[18]]),c(e,i),a||(l=y(o,"input",w),a=!0)},p(e,n){t=e,2&n&&f!==(f=t[18]+"")&&m(r,f),8&n&&(o.disabled=t[3]),2&n&&o.value!==t[1][t[18]]&&v(o,t[1][t[18]])},d(t){t&&d(e),a=!1,l()}}}function Gr(t){let e,n,r,s,o,i,a,l=M(t[5].available_versions),g=[];for(let e=0;eVersion Installed Binaries Status',i=p(),a=h("tbody");for(let t=0;tUpdate Binaries',o=p(),tt&&tt.c(),i=p(),et&&et.c(),a=p(),l=h("div"),w=h("h3"),w.textContent="Current Version",E=p(),x=h("div"),k=h("span"),$=g(Q),A=p(),B=h("button"),I=g("Rollback"),L=p(),S=h("div"),C=h("h3"),C.textContent="Install New Version",U=p(),T=h("div"),N=h("label"),N.textContent="Version",O=p(),R=h("input"),P=p(),D=h("div"),q=h("div"),H=h("label"),H.textContent="Binary URLs",F=p(),V=h("button"),j=g("Fill from Release"),z=p();for(let t=0;tn(4,r=t)),i(t,cr,t=>n(11,s=t)),i(t,ur,t=>n(12,o=t)),i(t,pr,t=>n(13,l=t)),i(t,gr,t=>n(5,c=t));let u="",d={orly:"","orly-db-badger":"","orly-acl-follows":"","orly-launcher":""},f=null,h=!1;async function g(){a(pr,l=!0,l);try{a(gr,c=await async function(t,e){const n=await wr("/api/binaries",{},t,e);if(!n.ok)throw new Error(`Failed to fetch binaries: ${n.statusText}`);return n.json()}(o,s),c),a(yr,r="",r)}catch(t){a(yr,r=t.message,r)}finally{a(pr,l=!1,l)}}return B(async()=>{await g()}),[u,d,f,h,r,c,async function(){const t={};for(const[e,n]of Object.entries(d))n.trim()&&(t[e]=n.trim());if(u.trim())if(0!==Object.keys(t).length){n(3,h=!0),n(2,f=null),a(yr,r="",r);try{n(2,f=await async function(t,e,n,r){const s=await wr("/api/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({version:n,urls:r})},t,e);if(!s.ok){const t=await s.json();throw new Error(t.message||`Update failed: ${s.statusText}`)}return s.json()}(o,s,u.trim(),t)),await g()}catch(t){a(yr,r=t.message,r)}finally{n(3,h=!1)}}else a(yr,r="At least one binary URL is required",r);else a(yr,r="Version is required",r)},async function(){if(confirm("Are you sure you want to rollback to the previous version?")){n(3,h=!0),a(yr,r="",r);try{const t=await async function(t,e){const n=await wr("/api/rollback",{method:"POST"},t,e);if(!n.ok){const t=await n.json();throw new Error(t.message||`Rollback failed: ${n.statusText}`)}return n.json()}(o,s);n(2,f={success:!0,message:`Rolled back from ${t.previous_version} to ${t.current_version}. Restart services to apply.`}),await g()}catch(t){a(yr,r=t.message,r)}finally{n(3,h=!1)}}},function(){const t=prompt("Enter release base URL (e.g., https://git.mleku.dev/mleku/next.orly.dev/releases/download/v0.55.11):");if(!t)return;const e=t.replace(/\/$/,""),r=prompt("Enter architecture (amd64 or arm64):","amd64");if(!r)return;const s=u.trim()||t.split("/").pop();n(1,d.orly=`${e}/orly-${s.replace("v","")}-linux-${r}`,d),n(1,d["orly-db-badger"]=`${e}/orly-db-badger-${s.replace("v","")}-linux-${r}`,d),n(1,d["orly-acl-follows"]=`${e}/orly-acl-follows-${s.replace("v","")}-linux-${r}`,d),n(1,d["orly-launcher"]=`${e}/orly-launcher-${s.replace("v","")}-linux-${r}`,d),u.trim()||n(0,u=s)},function(){u=this.value,n(0,u)},function(t){d[t]=this.value,n(1,d)}]}class Xr extends Q{constructor(t){super(),J(this,t,Qr,Jr,o,{})}}function ts(e){let n,r;return n=new Xr({}),{c(){Z(n.$$.fragment)},m(t,e){G(n,t,e),r=!0},p:t,i(t){r||(z(n.$$.fragment,t),r=!0)},o(t){K(n.$$.fragment,t),r=!1},d(t){W(n,t)}}}function es(e){let n,r;return n=new Fr({}),{c(){Z(n.$$.fragment)},m(t,e){G(n,t,e),r=!0},p:t,i(t){r||(z(n.$$.fragment,t),r=!0)},o(t){K(n.$$.fragment,t),r=!1},d(t){W(n,t)}}}function ns(e){let n,r;return n=new Ur({}),{c(){Z(n.$$.fragment)},m(t,e){G(n,t,e),r=!0},p:t,i(t){r||(z(n.$$.fragment,t),r=!0)},o(t){K(n.$$.fragment,t),r=!1},d(t){W(n,t)}}}function rs(e){let n,r,s,o,i,a,l,f;return{c(){n=h("div"),r=h("h2"),r.textContent="ORLY Launcher Admin",s=p(),o=h("p"),o.textContent="Please login to manage the relay services.",i=p(),a=h("button"),a.textContent="Login with Nostr",b(r,"class","svelte-4k9oqz"),b(o,"class","svelte-4k9oqz"),b(a,"class","login-btn svelte-4k9oqz"),b(n,"class","login-prompt svelte-4k9oqz")},m(t,d){u(t,n,d),c(n,r),c(n,s),c(n,o),c(n,i),c(n,a),l||(f=y(a,"click",e[10]),l=!0)},p:t,i:t,o:t,d(t){t&&d(n),l=!1,f()}}}function ss(t){let e,n,r,s,o,i,a,l,f,g;n=new st({props:{currentPage:t[0],isLoggedIn:t[4],userPubkey:t[3]}}),n.$on("navigate",t[8]),n.$on("login",t[9]),n.$on("logout",t[6]);const y=[rs,ns,es,ts],w=[];function m(t,e){return t[4]?"dashboard"===t[0]?1:"config"===t[0]?2:"update"===t[0]?3:-1:0}function v(e){t[11](e)}~(o=m(t))&&(i=w[o]=y[o](t));let E={isDarkTheme:t[2]};return void 0!==t[1]&&(E.showModal=t[1]),l=new or({props:E}),S.push(()=>function(t,e,n){const r=t.$$.props[e];void 0!==r&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}(l,"showModal",v)),l.$on("login",t[5]),l.$on("close",t[12]),{c(){e=h("main"),Z(n.$$.fragment),r=p(),s=h("div"),i&&i.c(),a=p(),Z(l.$$.fragment),b(s,"class","content svelte-4k9oqz"),b(e,"class","svelte-4k9oqz"),x(e,"dark-theme",t[2])},m(t,i){u(t,e,i),G(n,e,null),c(e,r),c(e,s),~o&&w[o].m(s,null),c(e,a),G(l,e,null),g=!0},p(t,[r]){const a={};1&r&&(a.currentPage=t[0]),16&r&&(a.isLoggedIn=t[4]),8&r&&(a.userPubkey=t[3]),n.$set(a);let c=o;o=m(t),o===c?~o&&w[o].p(t,r):(i&&(V(),K(w[c],1,1,()=>{w[c]=null}),j()),~o?(i=w[o],i?i.p(t,r):(i=w[o]=y[o](t),i.c()),z(i,1),i.m(s,null)):i=null);const u={};var d;4&r&&(u.isDarkTheme=t[2]),!f&&2&r&&(f=!0,u.showModal=t[1],d=()=>f=!1,U.push(d)),l.$set(u),(!g||4&r)&&x(e,"dark-theme",t[2])},i(t){g||(z(n.$$.fragment,t),z(i),z(l.$$.fragment,t),g=!0)},o(t){K(n.$$.fragment,t),K(i),K(l.$$.fragment,t),g=!1},d(t){t&&d(e),W(n),~o&&w[o].d(),W(l)}}}function os(t,e,n){let r,s,o,l;i(t,dr,t=>n(13,r=t)),i(t,ur,t=>n(14,s=t)),i(t,cr,t=>n(3,o=t)),i(t,lr,t=>n(4,l=t));let c="dashboard",u=!1,d=!1;function f(t){n(0,c=t)}B(()=>{const t=localStorage.getItem("launcher_auth_method"),e=localStorage.getItem("launcher_pubkey");"extension"===t&&e&&window.nostr&&window.nostr.getPublicKey().then(t=>{t===e&&(a(lr,l=!0,l),a(cr,o=t,o),a(ur,s=window.nostr,s),a(dr,r="extension",r))}).catch(()=>{localStorage.removeItem("launcher_auth_method"),localStorage.removeItem("launcher_pubkey")}),n(2,d=window.matchMedia("(prefers-color-scheme: dark)").matches)});return[c,u,d,o,l,function(t){const{method:e,pubkey:i,signer:c,privateKey:d}=t.detail;a(lr,l=!0,l),a(cr,o=i,o),a(ur,s=c,s),a(dr,r=e,r),localStorage.setItem("launcher_auth_method",e),localStorage.setItem("launcher_pubkey",i),n(1,u=!1)},function(){a(lr,l=!1,l),a(cr,o="",o),a(ur,s=null,s),a(dr,r="",r),localStorage.removeItem("launcher_auth_method"),localStorage.removeItem("launcher_pubkey"),localStorage.removeItem("launcher_privkey_encrypted")},f,t=>f(t.detail),()=>n(1,u=!0),()=>n(1,u=!0),function(t){u=t,n(1,u)},()=>n(1,u=!1)]}return new class extends Q{constructor(t){super(),J(this,t,os,ss,o,{})}}({target:document.body})}(); +function xn(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function _n(...e){const t=(e,t)=>n=>e(t(n)),n=Array.from(e).reverse().reduce((e,n)=>e?t(e,n.encode):n.encode,void 0),r=e.reduce((e,n)=>e?t(e,n.decode):n.decode,void 0);return{encode:n,decode:r}}function $n(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map(t=>{if(xn(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]})},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map(t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const n=e.indexOf(t);if(-1===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n})}}}function kn(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function An(e,t="="){if(xn(e),"string"!=typeof t)throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let r=n.length;if(r*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if(!((r-1)*e%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function Bn(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function In(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let r=0;const s=[],o=Array.from(e);for(o.forEach(e=>{if(xn(e),e<0||e>=t)throw new Error(`Wrong integer: ${e}`)});;){let e=0,i=!0;for(let s=r;st?Sn(t,e%t):e,Cn=(e,t)=>e+(t-Sn(e,t));function Ln(e,t,n,r){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(Cn(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${Cn(t,n)}`);let s=0,o=0;const i=2**n-1,l=[];for(const r of e){if(xn(r),r>=2**t)throw new Error(`convertRadix2: invalid data word=${r} from=${t}`);if(s=s<32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${t}`);for(o+=t;o>=n;o-=n)l.push((s>>o-n&i)>>>0);s&=2**o-1}if(s=s<=t)throw new Error("Excess padding");if(!r&&s)throw new Error(`Non-zero padding: ${s}`);return r&&o>0&&l.push(s>>>0),l}function Nn(e,t=!1){if(xn(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(Cn(8,e)>32||Cn(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!(n instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return Ln(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(Ln(n,e,8,t))}}}function Un(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(e){}}}const On=_n(Nn(4),$n("0123456789ABCDEF"),kn("")),Tn=_n(Nn(5),$n("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),An(5),kn(""));_n(Nn(5),$n("0123456789ABCDEFGHIJKLMNOPQRSTUV"),An(5),kn("")),_n(Nn(5),$n("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),kn(""),Bn(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));const Rn=_n(Nn(6),$n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),An(6),kn("")),Pn=_n(Nn(6),$n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),An(6),kn("")),Dn=e=>{return _n((xn(t=58),{encode:e=>{if(!(e instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return In(Array.from(e),256,t)},decode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(In(e,t,256))}}),$n(e),kn(""));var t},qn=Dn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");Dn("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),Dn("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const Hn=[0,2,3,5,6,7,9,10,11],jn={encode(e){let t="";for(let n=0;n>25;let n=(33554431&e)<<5;for(let e=0;e>e&1)&&(n^=Vn[e]);return n}function Kn(e,t,n=1){const r=e.length;let s=1;for(let t=0;t126)throw new Error(`Invalid prefix (${e})`);s=zn(s)^n>>5}s=zn(s);for(let t=0;tn)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${n})`);const r=e.toLowerCase();if(e!==r&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const s=(e=r).lastIndexOf("1");if(0===s||-1===s)throw new Error('Letter "1" must be present between prefix and data only');const o=e.slice(0,s),i=e.slice(s+1);if(i.length<6)throw new Error("Data must be at least 6 characters long");const l=Fn.decode(i).slice(0,-6),a=Kn(o,l,t);if(!i.endsWith(a))throw new Error(`Invalid checksum in ${e}: expected "${a}"`);return{prefix:o,words:l}}return{encode:function(e,n,r=90){if("string"!=typeof e)throw new Error("bech32.encode prefix should be string, not "+typeof e);if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof n);const s=e.length+7+n.length;if(!1!==r&&s>r)throw new TypeError(`Length ${s} exceeds limit ${r}`);return`${e=e.toLowerCase()}1${Fn.encode(n)}${Kn(e,n,t)}`},decode:i,decodeToBytes:function(e){const{prefix:t,words:n}=i(e,!1);return{prefix:t,words:n,bytes:r(n)}},decodeUnsafe:Un(i),fromWords:r,fromWordsUnsafe:o,toWords:s}}const Zn=Mn("bech32");Mn("bech32m");const Wn={utf8:{encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},hex:_n(Nn(4),$n("0123456789abcdef"),kn(""),Bn(e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})),base16:On,base32:Tn,base64:Rn,base64url:Pn,base58:qn,base58xmr:jn};Object.keys(Wn).join(", ");var Gn=new TextDecoder("utf-8");new TextEncoder;function Yn(e){let t={},n=e;for(;n.length>0;){let e=n[0],r=n[1],s=n.slice(2,2+r);if(n=n.slice(2+r),s.lengthGn.decode(e)):[]}}}case"nevent":{let e=Yn(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for nevent");if(32!==e[0][0].length)throw new Error("TLV 0 should be 32 bytes");if(e[2]&&32!==e[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(e[3]&&4!==e[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:Jt(e[0][0]),relays:e[1]?e[1].map(e=>Gn.decode(e)):[],author:e[2]?.[0]?Jt(e[2][0]):void 0,kind:e[3]?.[0]?parseInt(Jt(e[3][0]),16):void 0}}}case"naddr":{let e=Yn(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!e[2]?.[0])throw new Error("missing TLV 2 for naddr");if(32!==e[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(!e[3]?.[0])throw new Error("missing TLV 3 for naddr");if(4!==e[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:Gn.decode(e[0][0]),pubkey:Jt(e[2][0]),kind:parseInt(Jt(e[3][0]),16),relays:e[1]?e[1].map(e=>Gn.decode(e)):[]}}}case"nsec":return{type:t,data:r};case"npub":case"note":return{type:t,data:Jt(r)};default:throw new Error(`unknown prefix ${t}`)}}(e)}catch{throw new Error("Invalid nsec format")}if("nsec"!==t.type)throw new Error("Please enter an nsec (private key)");const s=t.data,o=vn(s),i={getPublicKey:async()=>o,signEvent:async e=>En(e,s)};n(6,u="Successfully logged in!"),r("login",{method:"nsec",pubkey:o,privateKey:e,signer:i}),setTimeout(h,500)}catch(e){n(5,c=e.message)}finally{n(4,a=!1)}}return e.$$set=e=>{"showModal"in e&&n(0,s=e.showModal),"isDarkTheme"in e&&n(1,o=e.isDarkTheme)},[s,o,i,l,a,c,u,f,h,p,async function(){n(5,c=""),n(6,u="");try{const e=wn(),t=Qn("nsec",e),r=Jn(vn(e));d=t,n(7,f=r),n(3,l=t),n(6,u="New key generated!")}catch(e){n(5,c="Failed to generate key: "+e.message)}},async function(){n(4,a=!0),n(5,c=""),n(6,u="");try{if(!window.nostr)throw new Error("No Nostr extension found. Please install nos2x or Alby.");const e=await window.nostr.getPublicKey();e&&(n(6,u="Successfully logged in with extension!"),r("login",{method:"extension",pubkey:e,signer:window.nostr}),setTimeout(h,500))}catch(e){n(5,c=e.message)}finally{n(4,a=!1)}},g,function(e){"Escape"===e.key&&h(),"Enter"===e.key&&"nsec"===i&&g()},function(t){L.call(this,e,t)},function(t){L.call(this,e,t)},()=>p("extension"),()=>p("nsec"),function(){l=this.value,n(3,l)},e=>"Escape"===e.key&&h()]}class ar extends te{constructor(e){super(),ee(this,e,lr,ir,o,{showModal:0,isDarkTheme:1})}}const cr=[];function ur(t,n=e){let r;const s=new Set;function i(e){if(o(t,e)&&(t=e,r)){const e=!cr.length;for(const e of s)e[1](),cr.push(e,t);if(e){for(let e=0;e{s.delete(c),0===s.size&&r&&(r(),r=null)}}}}const dr=ur(!1),fr=ur(""),hr=ur(null),pr=ur(""),gr=ur(null),yr=ur(null),br=ur(null),mr=ur(!1),wr=ur("");async function vr(e,t={},n,r){const s=`${window.location.origin}${e}`,o=t.method||"GET",i=await async function(e,t,n,r){if(!e||!t)return null;try{const t={kind:27235,created_at:Math.floor(Date.now()/1e3),tags:[["u",r],["method",n.toUpperCase()]],content:""},s=await e.signEvent(t),o=JSON.stringify(s);return btoa(o).replace(/\+/g,"-").replace(/\//g,"_")}catch(e){return console.error("createNIP98Auth error:",e),null}}(n,r,o,s),l={...t.headers};return i&&(l.Authorization=`Nostr ${i}`),fetch(s,{...t,headers:l})}async function Er(e,t){const n=await vr("/api/restart",{method:"POST"},e,t);if(!n.ok)throw new Error(`Restart failed: ${n.statusText}`);return n.json()}function xr(e){let t,n,r,s,o,i=e[0].pid+"";return{c(){t=h("div"),n=h("span"),n.textContent="PID:",r=g(),s=h("span"),o=p(i),w(n,"class","label svelte-xh5u5u"),w(s,"class","value svelte-xh5u5u"),w(t,"class","detail-row svelte-xh5u5u")},m(e,i){u(e,t,i),c(t,n),c(t,r),c(t,s),c(s,o)},p(e,t){1&t&&i!==(i=e[0].pid+"")&&v(o,i)},d(e){e&&d(t)}}}function _r(e){let t,n,r,s,o,i=e[0].restarts+"";return{c(){t=h("div"),n=h("span"),n.textContent="Restarts:",r=g(),s=h("span"),o=p(i),w(n,"class","label svelte-xh5u5u"),w(s,"class","value warning svelte-xh5u5u"),w(t,"class","detail-row svelte-xh5u5u")},m(e,i){u(e,t,i),c(t,n),c(t,r),c(t,s),c(s,o)},p(e,t){1&t&&i!==(i=e[0].restarts+"")&&v(o,i)},d(e){e&&d(t)}}}function $r(t){let n,r,s,o,i,l,a,f,y,b,m,E,_,$,k,A,B,I,S,C,L,N,U=Ar(t[0].status)+"",O=t[0].name+"",T=t[0].status+"",R=t[0].binary+"",P=t[0].pid>0&&xr(t),D=t[0].restarts>0&&_r(t);return{c(){n=h("div"),r=h("div"),s=h("span"),o=p(U),i=g(),l=h("span"),a=p(O),f=g(),y=h("div"),b=h("div"),m=h("span"),m.textContent="Status:",E=g(),_=h("span"),$=p(T),k=g(),P&&P.c(),A=g(),B=h("div"),I=h("span"),I.textContent="Binary:",S=g(),C=h("span"),L=p(R),N=g(),D&&D.c(),w(s,"class","status-indicator svelte-xh5u5u"),x(s,"color",kr(t[0].status)),w(l,"class","process-name svelte-xh5u5u"),w(r,"class","process-header svelte-xh5u5u"),w(m,"class","label svelte-xh5u5u"),w(_,"class","value svelte-xh5u5u"),x(_,"color",kr(t[0].status)),w(b,"class","detail-row svelte-xh5u5u"),w(I,"class","label svelte-xh5u5u"),w(C,"class","value binary svelte-xh5u5u"),w(B,"class","detail-row svelte-xh5u5u"),w(y,"class","process-details svelte-xh5u5u"),w(n,"class","process-card svelte-xh5u5u")},m(e,t){u(e,n,t),c(n,r),c(r,s),c(s,o),c(r,i),c(r,l),c(l,a),c(n,f),c(n,y),c(y,b),c(b,m),c(b,E),c(b,_),c(_,$),c(y,k),P&&P.m(y,null),c(y,A),c(y,B),c(B,I),c(B,S),c(B,C),c(C,L),c(y,N),D&&D.m(y,null)},p(e,[t]){1&t&&U!==(U=Ar(e[0].status)+"")&&v(o,U),1&t&&x(s,"color",kr(e[0].status)),1&t&&O!==(O=e[0].name+"")&&v(a,O),1&t&&T!==(T=e[0].status+"")&&v($,T),1&t&&x(_,"color",kr(e[0].status)),e[0].pid>0?P?P.p(e,t):(P=xr(e),P.c(),P.m(y,A)):P&&(P.d(1),P=null),1&t&&R!==(R=e[0].binary+"")&&v(L,R),e[0].restarts>0?D?D.p(e,t):(D=_r(e),D.c(),D.m(y,null)):D&&(D.d(1),D=null)},i:e,o:e,d(e){e&&d(n),P&&P.d(),D&&D.d()}}}function kr(e){switch(e){case"running":return"var(--success)";case"stopped":default:return"var(--muted-color)";case"crashed":return"var(--error)"}}function Ar(e){switch(e){case"running":return"●";case"stopped":return"○";case"crashed":return"✗";default:return"?"}}function Br(e,t,n){let{process:r}=t;return e.$$set=e=>{"process"in e&&n(0,r=e.process)},[r]}class Ir extends te{constructor(e){super(),ee(this,e,Br,$r,o,{process:0})}}function Sr(e,t,n){const r=e.slice();return r[8]=t[n],r}function Cr(e){let t,n;return{c(){t=h("div"),n=p(e[1]),w(t,"class","error-banner svelte-17dya06")},m(e,r){u(e,t,r),c(t,n)},p(e,t){2&t&&v(n,e[1])},d(e){e&&d(t)}}}function Lr(t){let n;return{c(){n=h("div"),n.textContent="Loading status...",w(n,"class","loading svelte-17dya06")},m(e,t){u(e,n,t)},p:e,i:e,o:e,d(e){e&&d(n)}}}function Nr(e){let t,n,r,s,o,i,l,a,y,b,m,E,x,_,$,k,A,B,I,S,C,L,N,U=e[2].version+"",O=e[2].uptime+"",T=(e[2].processes?.length||0)+"",R=G(e[2].processes||[]),P=[];for(let t=0;tW(P[e],1,1,()=>{P[e]=null});return{c(){t=h("div"),n=h("div"),r=h("span"),r.textContent="Version",s=g(),o=h("span"),i=p(U),l=g(),a=h("div"),y=h("span"),y.textContent="Uptime",b=g(),m=h("span"),E=p(O),x=g(),_=h("div"),$=h("span"),$.textContent="Processes",k=g(),A=h("span"),B=p(T),I=g(),S=h("h3"),S.textContent="Managed Processes",C=g(),L=h("div");for(let e=0;e{S[r]=null}),M()),~x?(_=S[x],_?_.p(e,n):(_=S[x]=I[x](e),_.c()),Z(_,1),_.m(t,null)):_=null)},i(e){$||(Z(_),$=!0)},o(e){W(_),$=!1},d(e){e&&d(t),B&&B.d(),~x&&S[x].d(),k=!1,r(A)}}}function Tr(e,t,n){let r,s,o,a,c,u;var d;async function f(){try{l(gr,c=await async function(e,t){const n=await vr("/api/status",{},e,t);if(!n.ok)throw new Error(`Failed to fetch status: ${n.statusText}`);return n.json()}(a,o),c),l(wr,s="",s)}catch(e){l(wr,s=e.message,s)}}return i(e,mr,e=>n(0,r=e)),i(e,wr,e=>n(1,s=e)),i(e,fr,e=>n(6,o=e)),i(e,hr,e=>n(7,a=e)),i(e,gr,e=>n(2,c=e)),S(async()=>{await f(),u=setInterval(f,5e3)}),d=()=>{u&&clearInterval(u)},I().$$.on_destroy.push(d),[r,s,c,f,async function(){if(confirm("Are you sure you want to restart all services?")){l(mr,r=!0,r);try{await Er(a,o),setTimeout(f,2e3)}catch(e){l(wr,s=e.message,s)}finally{l(mr,r=!1,r)}}}]}class Rr extends te{constructor(e){super(),ee(this,e,Tr,Or,o,{})}}function Pr(e,t,n){const r=e.slice();return r[33]=t[n],r[35]=n,r}function Dr(e){let t,n,s,o,i,l,a,f;return{c(){t=h("button"),n=p("Refresh"),s=g(),o=h("button"),i=p("Edit"),w(t,"class","refresh-btn svelte-my2rpu"),t.disabled=e[6],w(o,"class","edit-btn svelte-my2rpu"),o.disabled=l=e[6]||!e[5]},m(r,l){u(r,t,l),c(t,n),u(r,s,l),u(r,o,l),c(o,i),a||(f=[b(t,"click",e[8]),b(o,"click",e[9])],a=!0)},p(e,n){64&n[0]&&(t.disabled=e[6]),96&n[0]&&l!==(l=e[6]||!e[5])&&(o.disabled=l)},d(e){e&&(d(t),d(s),d(o)),a=!1,r(f)}}}function qr(e){let t,n,s,o,i,l,a,f=e[4]?"Saving...":"Save";return{c(){t=h("button"),n=p("Cancel"),s=g(),o=h("button"),i=p(f),w(t,"class","cancel-btn svelte-my2rpu"),t.disabled=e[4],w(o,"class","save-btn svelte-my2rpu"),o.disabled=e[4]},m(r,d){u(r,t,d),c(t,n),u(r,s,d),u(r,o,d),c(o,i),l||(a=[b(t,"click",e[10]),b(o,"click",e[11])],l=!0)},p(e,n){16&n[0]&&(t.disabled=e[4]),16&n[0]&&f!==(f=e[4]?"Saving...":"Save")&&v(i,f),16&n[0]&&(o.disabled=e[4])},d(e){e&&(d(t),d(s),d(o)),l=!1,r(a)}}}function Hr(e){let t,n;return{c(){t=h("div"),n=p(e[7]),w(t,"class","error-banner svelte-my2rpu")},m(e,r){u(e,t,r),c(t,n)},p(e,t){128&t[0]&&v(n,e[7])},d(e){e&&d(t)}}}function jr(e){let t,n,r,s=e[3]&&e[2].includes("Restart required"),o=s&&Fr(e);return{c(){t=h("div"),n=p(e[2]),r=g(),o&&o.c(),w(t,"class","message-banner svelte-my2rpu"),k(t,"success",e[3]),k(t,"error",!e[3])},m(e,s){u(e,t,s),c(t,n),c(t,r),o&&o.m(t,null)},p(e,r){4&r[0]&&v(n,e[2]),12&r[0]&&(s=e[3]&&e[2].includes("Restart required")),s?o?o.p(e,r):(o=Fr(e),o.c(),o.m(t,null)):o&&(o.d(1),o=null),8&r[0]&&k(t,"success",e[3]),8&r[0]&&k(t,"error",!e[3])},d(e){e&&d(t),o&&o.d()}}}function Fr(t){let n,r,s;return{c(){n=h("button"),n.textContent="Restart Now",w(n,"class","restart-btn-inline svelte-my2rpu")},m(e,o){u(e,n,o),r||(s=b(n,"click",t[12]),r=!0)},p:e,d(e){e&&d(n),r=!1,s()}}}function Vr(t){let n;return{c(){n=h("div"),n.textContent="Loading configuration...",w(n,"class","loading svelte-my2rpu")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function zr(e){let t,n,r,s,o,i,l,a,b,m,v,E,x,_,$,k,A,B,I,S,C,L,N,U,O,T,R,P,D,q,H,j,F,V,z,K,M,Z,W,Y,J,Q,X,ee,te,ne,re,se,oe,ie,le,ae,ce,ue,de,fe,he,pe,ge,ye,be,me,we,ve,Ee,xe,_e,$e,ke,Ae,Be,Ie,Se,Ce,Le,Ne,Ue,Oe,Te,Re,Pe,De,qe,He,je,Fe,Ve,ze;function Ke(e,t){return e[0]?Mr:Kr}let Me=Ke(e),Ze=Me(e);function We(e,t){return e[0]?Wr:Zr}let Ge=We(e),Ye=Ge(e);function Je(e,t){return e[0]?Yr:Gr}let Qe=Je(e),Xe=Qe(e);function et(e,t){return e[0]?Qr:Jr}let tt=et(e),nt=tt(e);function rt(e,t){return e[0]?es:Xr}let st=rt(e),ot=st(e);function it(e,t){return e[0]?ns:ts}let lt=it(e),at=lt(e);function ct(e,t){return e[0]?ss:rs}let ut=ct(e),dt=ut(e);function ft(e,t){return e[0]?is:os}let ht=ft(e),pt=ht(e);function gt(e,t){return e[0]?as:ls}let yt=gt(e),bt=yt(e);function mt(e,t){return e[0]?us:cs}let wt=mt(e),vt=wt(e);function Et(e,t){return e[0]?fs:ds}let xt=Et(e),_t=xt(e);function $t(e,t){return e[0]?ps:hs}let kt=$t(e),At=kt(e);function Bt(e,t){return e[0]?ys:gs}let It=Bt(e),St=It(e);function Ct(e,t){return e[0]?ms:bs}let Lt=Ct(e),Nt=Lt(e);function Ut(e,t){return e[0]?vs:ws}let Ot=Ut(e),Tt=Ot(e),Rt=e[0]&&Es(e),Pt=G((e[0]?e[1].admin_owners:e[5].admin_owners)||[]),Dt=[];for(let t=0;te[15].call(t))},m(i,l){u(i,t,l),c(t,n),c(t,r),_(t,e[1].db_backend,!0),s||(o=b(t,"change",e[15]),s=!0)},p(e,n){2&n[0]&&_(t,e[1].db_backend)},d(e){e&&d(t),s=!1,o()}}}function Zr(e){let t,n,r=e[5].db_binary+"";return{c(){t=h("span"),n=p(r),w(t,"class","value mono svelte-my2rpu")},m(e,r){u(e,t,r),c(t,n)},p(e,t){32&t[0]&&r!==(r=e[5].db_binary+"")&&v(n,r)},d(e){e&&d(t)}}}function Wr(e){let t,n,r;return{c(){t=h("input"),w(t,"type","text"),w(t,"placeholder","orly-db-badger"),w(t,"class","svelte-my2rpu")},m(s,o){u(s,t,o),E(t,e[1].db_binary),n||(r=b(t,"input",e[16]),n=!0)},p(e,n){2&n[0]&&t.value!==e[1].db_binary&&E(t,e[1].db_binary)},d(e){e&&d(t),n=!1,r()}}}function Gr(e){let t,n,r=e[5].db_listen+"";return{c(){t=h("span"),n=p(r),w(t,"class","value mono svelte-my2rpu")},m(e,r){u(e,t,r),c(t,n)},p(e,t){32&t[0]&&r!==(r=e[5].db_listen+"")&&v(n,r)},d(e){e&&d(t)}}}function Yr(e){let t,n,r;return{c(){t=h("input"),w(t,"type","text"),w(t,"placeholder","127.0.0.1:50051"),w(t,"class","svelte-my2rpu")},m(s,o){u(s,t,o),E(t,e[1].db_listen),n||(r=b(t,"input",e[17]),n=!0)},p(e,n){2&n[0]&&t.value!==e[1].db_listen&&E(t,e[1].db_listen)},d(e){e&&d(t),n=!1,r()}}}function Jr(e){let t,n,r=e[5].data_dir+"";return{c(){t=h("span"),n=p(r),w(t,"class","value mono svelte-my2rpu")},m(e,r){u(e,t,r),c(t,n)},p(e,t){32&t[0]&&r!==(r=e[5].data_dir+"")&&v(n,r)},d(e){e&&d(t)}}}function Qr(e){let t,n,r;return{c(){t=h("input"),w(t,"type","text"),w(t,"class","svelte-my2rpu")},m(s,o){u(s,t,o),E(t,e[1].data_dir),n||(r=b(t,"input",e[18]),n=!0)},p(e,n){2&n[0]&&t.value!==e[1].data_dir&&E(t,e[1].data_dir)},d(e){e&&d(t),n=!1,r()}}}function Xr(e){let t,n,r=e[5].acl_enabled?"Yes":"No";return{c(){t=h("span"),n=p(r),w(t,"class","value bool svelte-my2rpu"),k(t,"enabled",e[5].acl_enabled)},m(e,r){u(e,t,r),c(t,n)},p(e,s){32&s[0]&&r!==(r=e[5].acl_enabled?"Yes":"No")&&v(n,r),32&s[0]&&k(t,"enabled",e[5].acl_enabled)},d(e){e&&d(t)}}}function es(e){let t,n,r,s,o,i,l,a=e[1].acl_enabled?"Enabled":"Disabled";return{c(){t=h("label"),n=h("input"),r=g(),s=h("span"),o=p(a),w(n,"type","checkbox"),w(n,"class","svelte-my2rpu"),w(t,"class","toggle svelte-my2rpu")},m(a,d){u(a,t,d),c(t,n),n.checked=e[1].acl_enabled,c(t,r),c(t,s),c(s,o),i||(l=b(n,"change",e[19]),i=!0)},p(e,t){2&t[0]&&(n.checked=e[1].acl_enabled),2&t[0]&&a!==(a=e[1].acl_enabled?"Enabled":"Disabled")&&v(o,a)},d(e){e&&d(t),i=!1,l()}}}function ts(e){let t,n,r=e[5].acl_mode+"";return{c(){t=h("span"),n=p(r),w(t,"class","value svelte-my2rpu")},m(e,r){u(e,t,r),c(t,n)},p(e,t){32&t[0]&&r!==(r=e[5].acl_mode+"")&&v(n,r)},d(e){e&&d(t)}}}function ns(e){let t,n,r,s,o,i;return{c(){t=h("select"),n=h("option"),n.textContent="Follows",r=h("option"),r.textContent="Managed",s=h("option"),s.textContent="Curation",n.__value="follows",E(n,n.__value),r.__value="managed",E(r,r.__value),s.__value="curation",E(s,s.__value),w(t,"class","svelte-my2rpu"),void 0===e[1].acl_mode&&D(()=>e[20].call(t))},m(l,a){u(l,t,a),c(t,n),c(t,r),c(t,s),_(t,e[1].acl_mode,!0),o||(i=b(t,"change",e[20]),o=!0)},p(e,n){2&n[0]&&_(t,e[1].acl_mode)},d(e){e&&d(t),o=!1,i()}}}function rs(e){let t,n,r=e[5].acl_binary+"";return{c(){t=h("span"),n=p(r),w(t,"class","value mono svelte-my2rpu")},m(e,r){u(e,t,r),c(t,n)},p(e,t){32&t[0]&&r!==(r=e[5].acl_binary+"")&&v(n,r)},d(e){e&&d(t)}}}function ss(e){let t,n,r;return{c(){t=h("input"),w(t,"type","text"),w(t,"class","svelte-my2rpu")},m(s,o){u(s,t,o),E(t,e[1].acl_binary),n||(r=b(t,"input",e[21]),n=!0)},p(e,n){2&n[0]&&t.value!==e[1].acl_binary&&E(t,e[1].acl_binary)},d(e){e&&d(t),n=!1,r()}}}function os(e){let t,n,r=e[5].acl_listen+"";return{c(){t=h("span"),n=p(r),w(t,"class","value mono svelte-my2rpu")},m(e,r){u(e,t,r),c(t,n)},p(e,t){32&t[0]&&r!==(r=e[5].acl_listen+"")&&v(n,r)},d(e){e&&d(t)}}}function is(e){let t,n,r;return{c(){t=h("input"),w(t,"type","text"),w(t,"placeholder","127.0.0.1:50052"),w(t,"class","svelte-my2rpu")},m(s,o){u(s,t,o),E(t,e[1].acl_listen),n||(r=b(t,"input",e[22]),n=!0)},p(e,n){2&n[0]&&t.value!==e[1].acl_listen&&E(t,e[1].acl_listen)},d(e){e&&d(t),n=!1,r()}}}function ls(e){let t,n,r=e[5].relay_binary+"";return{c(){t=h("span"),n=p(r),w(t,"class","value mono svelte-my2rpu")},m(e,r){u(e,t,r),c(t,n)},p(e,t){32&t[0]&&r!==(r=e[5].relay_binary+"")&&v(n,r)},d(e){e&&d(t)}}}function as(e){let t,n,r;return{c(){t=h("input"),w(t,"type","text"),w(t,"placeholder","orly"),w(t,"class","svelte-my2rpu")},m(s,o){u(s,t,o),E(t,e[1].relay_binary),n||(r=b(t,"input",e[23]),n=!0)},p(e,n){2&n[0]&&t.value!==e[1].relay_binary&&E(t,e[1].relay_binary)},d(e){e&&d(t),n=!1,r()}}}function cs(e){let t,n,r=e[5].log_level+"";return{c(){t=h("span"),n=p(r),w(t,"class","value svelte-my2rpu")},m(e,r){u(e,t,r),c(t,n)},p(e,t){32&t[0]&&r!==(r=e[5].log_level+"")&&v(n,r)},d(e){e&&d(t)}}}function us(e){let t,n,r,s,o,i,l,a;return{c(){t=h("select"),n=h("option"),n.textContent="Trace",r=h("option"),r.textContent="Debug",s=h("option"),s.textContent="Info",o=h("option"),o.textContent="Warn",i=h("option"),i.textContent="Error",n.__value="trace",E(n,n.__value),r.__value="debug",E(r,r.__value),s.__value="info",E(s,s.__value),o.__value="warn",E(o,o.__value),i.__value="error",E(i,i.__value),w(t,"class","svelte-my2rpu"),void 0===e[1].log_level&&D(()=>e[24].call(t))},m(d,f){u(d,t,f),c(t,n),c(t,r),c(t,s),c(t,o),c(t,i),_(t,e[1].log_level,!0),l||(a=b(t,"change",e[24]),l=!0)},p(e,n){2&n[0]&&_(t,e[1].log_level)},d(e){e&&d(t),l=!1,a()}}}function ds(e){let t,n,r=e[5].distributed_sync_enabled?"Enabled":"Disabled";return{c(){t=h("span"),n=p(r),w(t,"class","value bool svelte-my2rpu"),k(t,"enabled",e[5].distributed_sync_enabled)},m(e,r){u(e,t,r),c(t,n)},p(e,s){32&s[0]&&r!==(r=e[5].distributed_sync_enabled?"Enabled":"Disabled")&&v(n,r),32&s[0]&&k(t,"enabled",e[5].distributed_sync_enabled)},d(e){e&&d(t)}}}function fs(e){let t,n,r,s,o,i,l,a=e[1].distributed_sync_enabled?"Enabled":"Disabled";return{c(){t=h("label"),n=h("input"),r=g(),s=h("span"),o=p(a),w(n,"type","checkbox"),w(n,"class","svelte-my2rpu"),w(t,"class","toggle svelte-my2rpu")},m(a,d){u(a,t,d),c(t,n),n.checked=e[1].distributed_sync_enabled,c(t,r),c(t,s),c(s,o),i||(l=b(n,"change",e[25]),i=!0)},p(e,t){2&t[0]&&(n.checked=e[1].distributed_sync_enabled),2&t[0]&&a!==(a=e[1].distributed_sync_enabled?"Enabled":"Disabled")&&v(o,a)},d(e){e&&d(t),i=!1,l()}}}function hs(e){let t,n,r=e[5].cluster_sync_enabled?"Enabled":"Disabled";return{c(){t=h("span"),n=p(r),w(t,"class","value bool svelte-my2rpu"),k(t,"enabled",e[5].cluster_sync_enabled)},m(e,r){u(e,t,r),c(t,n)},p(e,s){32&s[0]&&r!==(r=e[5].cluster_sync_enabled?"Enabled":"Disabled")&&v(n,r),32&s[0]&&k(t,"enabled",e[5].cluster_sync_enabled)},d(e){e&&d(t)}}}function ps(e){let t,n,r,s,o,i,l,a=e[1].cluster_sync_enabled?"Enabled":"Disabled";return{c(){t=h("label"),n=h("input"),r=g(),s=h("span"),o=p(a),w(n,"type","checkbox"),w(n,"class","svelte-my2rpu"),w(t,"class","toggle svelte-my2rpu")},m(a,d){u(a,t,d),c(t,n),n.checked=e[1].cluster_sync_enabled,c(t,r),c(t,s),c(s,o),i||(l=b(n,"change",e[26]),i=!0)},p(e,t){2&t[0]&&(n.checked=e[1].cluster_sync_enabled),2&t[0]&&a!==(a=e[1].cluster_sync_enabled?"Enabled":"Disabled")&&v(o,a)},d(e){e&&d(t),i=!1,l()}}}function gs(e){let t,n,r=e[5].relay_group_enabled?"Enabled":"Disabled";return{c(){t=h("span"),n=p(r),w(t,"class","value bool svelte-my2rpu"),k(t,"enabled",e[5].relay_group_enabled)},m(e,r){u(e,t,r),c(t,n)},p(e,s){32&s[0]&&r!==(r=e[5].relay_group_enabled?"Enabled":"Disabled")&&v(n,r),32&s[0]&&k(t,"enabled",e[5].relay_group_enabled)},d(e){e&&d(t)}}}function ys(e){let t,n,r,s,o,i,l,a=e[1].relay_group_enabled?"Enabled":"Disabled";return{c(){t=h("label"),n=h("input"),r=g(),s=h("span"),o=p(a),w(n,"type","checkbox"),w(n,"class","svelte-my2rpu"),w(t,"class","toggle svelte-my2rpu")},m(a,d){u(a,t,d),c(t,n),n.checked=e[1].relay_group_enabled,c(t,r),c(t,s),c(s,o),i||(l=b(n,"change",e[27]),i=!0)},p(e,t){2&t[0]&&(n.checked=e[1].relay_group_enabled),2&t[0]&&a!==(a=e[1].relay_group_enabled?"Enabled":"Disabled")&&v(o,a)},d(e){e&&d(t),i=!1,l()}}}function bs(e){let t,n,r=e[5].negentropy_enabled?"Enabled":"Disabled";return{c(){t=h("span"),n=p(r),w(t,"class","value bool svelte-my2rpu"),k(t,"enabled",e[5].negentropy_enabled)},m(e,r){u(e,t,r),c(t,n)},p(e,s){32&s[0]&&r!==(r=e[5].negentropy_enabled?"Enabled":"Disabled")&&v(n,r),32&s[0]&&k(t,"enabled",e[5].negentropy_enabled)},d(e){e&&d(t)}}}function ms(e){let t,n,r,s,o,i,l,a=e[1].negentropy_enabled?"Enabled":"Disabled";return{c(){t=h("label"),n=h("input"),r=g(),s=h("span"),o=p(a),w(n,"type","checkbox"),w(n,"class","svelte-my2rpu"),w(t,"class","toggle svelte-my2rpu")},m(a,d){u(a,t,d),c(t,n),n.checked=e[1].negentropy_enabled,c(t,r),c(t,s),c(s,o),i||(l=b(n,"change",e[28]),i=!0)},p(e,t){2&t[0]&&(n.checked=e[1].negentropy_enabled),2&t[0]&&a!==(a=e[1].negentropy_enabled?"Enabled":"Disabled")&&v(o,a)},d(e){e&&d(t),i=!1,l()}}}function ws(e){let t,n,r=e[5].bin_dir+"";return{c(){t=h("span"),n=p(r),w(t,"class","value mono svelte-my2rpu")},m(e,r){u(e,t,r),c(t,n)},p(e,t){32&t[0]&&r!==(r=e[5].bin_dir+"")&&v(n,r)},d(e){e&&d(t)}}}function vs(e){let t,n,r;return{c(){t=h("input"),w(t,"type","text"),w(t,"class","svelte-my2rpu")},m(s,o){u(s,t,o),E(t,e[1].bin_dir),n||(r=b(t,"input",e[29]),n=!0)},p(e,n){2&n[0]&&t.value!==e[1].bin_dir&&E(t,e[1].bin_dir)},d(e){e&&d(t),n=!1,r()}}}function Es(t){let n,r,s;return{c(){n=h("button"),n.textContent="+ Add",w(n,"class","add-owner-btn svelte-my2rpu")},m(e,o){u(e,n,o),r||(s=b(n,"click",t[13]),r=!0)},p:e,d(e){e&&d(n),r=!1,s()}}}function xs(t){let n;return{c(){n=h("span"),n.textContent="No owners configured",w(n,"class","no-owners svelte-my2rpu")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function _s(e){let t,n,r;function s(){return e[30](e[35])}return{c(){t=h("button"),t.textContent="x",w(t,"class","remove-owner-btn svelte-my2rpu")},m(e,o){u(e,t,o),n||(r=b(t,"click",s),n=!0)},p(t,n){e=t},d(e){e&&d(t),n=!1,r()}}}function $s(e){let t,n,r,s,o,i=e[33]+"",l=e[0]&&_s(e);return{c(){t=h("div"),n=h("code"),r=p(i),s=g(),l&&l.c(),o=g(),w(n,"class","owner svelte-my2rpu"),w(t,"class","owner-item svelte-my2rpu")},m(e,i){u(e,t,i),c(t,n),c(n,r),c(t,s),l&&l.m(t,null),c(t,o)},p(e,n){35&n[0]&&i!==(i=e[33]+"")&&v(r,i),e[0]?l?l.p(e,n):(l=_s(e),l.c(),l.m(t,o)):l&&(l.d(1),l=null)},d(e){e&&d(t),l&&l.d()}}}function ks(e){let t,n,r,s,o,i,l,a=e[5].bin_dir?.replace(/\/bin$/,"")+"";return{c(){t=h("div"),n=h("p"),r=p("Configuration is saved to "),s=h("code"),o=p(a),i=p("/launcher.json"),l=p(". Environment variables override file settings."),w(s,"class","svelte-my2rpu"),w(n,"class","svelte-my2rpu"),w(t,"class","config-note svelte-my2rpu")},m(e,a){u(e,t,a),c(t,n),c(n,r),c(n,s),c(s,o),c(s,i),c(n,l)},p(e,t){32&t[0]&&a!==(a=e[5].bin_dir?.replace(/\/bin$/,"")+"")&&v(o,a)},d(e){e&&d(t)}}}function As(t){let n,r,s,o,i,l,a,f;function p(e,t){return e[0]?qr:Dr}let y=p(t),b=y(t),m=t[7]&&Hr(t),v=t[2]&&jr(t);function E(e,t){return e[5]?zr:e[7]?void 0:Vr}let x=E(t),_=x&&x(t);return{c(){n=h("div"),r=h("div"),s=h("h2"),s.textContent="Configuration",o=g(),i=h("div"),b.c(),l=g(),m&&m.c(),a=g(),v&&v.c(),f=g(),_&&_.c(),w(s,"class","svelte-my2rpu"),w(i,"class","header-buttons svelte-my2rpu"),w(r,"class","page-header svelte-my2rpu"),w(n,"class","config-page svelte-my2rpu")},m(e,t){u(e,n,t),c(n,r),c(r,s),c(r,o),c(r,i),b.m(i,null),c(n,l),m&&m.m(n,null),c(n,a),v&&v.m(n,null),c(n,f),_&&_.m(n,null)},p(e,t){y===(y=p(e))&&b?b.p(e,t):(b.d(1),b=y(e),b&&(b.c(),b.m(i,null))),e[7]?m?m.p(e,t):(m=Hr(e),m.c(),m.m(n,a)):m&&(m.d(1),m=null),e[2]?v?v.p(e,t):(v=jr(e),v.c(),v.m(n,f)):v&&(v.d(1),v=null),x===(x=E(e))&&_?_.p(e,t):(_&&_.d(1),_=x&&x(e),_&&(_.c(),_.m(n,null)))},i:e,o:e,d(e){e&&d(n),b.d(),m&&m.d(),v&&v.d(),_&&_.d()}}}function Bs(e,t,n){let r,s,o,a,c;i(e,fr,e=>n(31,r=e)),i(e,hr,e=>n(32,s=e)),i(e,yr,e=>n(5,o=e)),i(e,mr,e=>n(6,a=e)),i(e,wr,e=>n(7,c=e));let u=!1,d={},f="",h=!1,p=!1;async function g(){l(mr,a=!0,a);try{l(yr,o=await async function(e,t){const n=await vr("/api/config",{},e,t);if(!n.ok)throw new Error(`Failed to fetch config: ${n.statusText}`);return n.json()}(s,r),o),n(1,d=JSON.parse(JSON.stringify(o))),l(wr,c="",c)}catch(e){l(wr,c=e.message,c)}finally{l(mr,a=!1,a)}}function y(e){n(1,d.admin_owners=d.admin_owners.filter((t,n)=>n!==e),d)}S(async()=>{await g()});return[u,d,f,h,p,o,a,c,g,function(){n(1,d=JSON.parse(JSON.stringify(o))),n(0,u=!0),n(2,f="")},function(){n(1,d=JSON.parse(JSON.stringify(o))),n(0,u=!1),n(2,f="")},async function(){n(4,p=!0),n(2,f="");try{const e=await async function(e,t,n){const r=await vr("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},e,t);if(!r.ok){const e=await r.json().catch(()=>({}));throw new Error(e.message||`Save failed: ${r.statusText}`)}return r.json()}(s,r,d);n(3,h=e.success),n(2,f=e.message),e.success&&(l(yr,o={...d},o),n(0,u=!1))}catch(e){n(3,h=!1),n(2,f=e.message)}finally{n(4,p=!1)}},async function(){if(confirm("Restart all services? This will briefly interrupt the relay."))try{await Er(s,r),n(2,f="Restart initiated. Services are restarting..."),n(3,h=!0)}catch(e){n(2,f=e.message),n(3,h=!1)}},function(){const e=prompt("Enter hex pubkey for new admin owner:");e&&e.match(/^[0-9a-fA-F]{64}$/)?n(1,d.admin_owners=[...d.admin_owners||[],e.toLowerCase()],d):e&&alert("Invalid pubkey. Must be 64 hex characters.")},y,function(){d.db_backend=$(this),n(1,d)},function(){d.db_binary=this.value,n(1,d)},function(){d.db_listen=this.value,n(1,d)},function(){d.data_dir=this.value,n(1,d)},function(){d.acl_enabled=this.checked,n(1,d)},function(){d.acl_mode=$(this),n(1,d)},function(){d.acl_binary=this.value,n(1,d)},function(){d.acl_listen=this.value,n(1,d)},function(){d.relay_binary=this.value,n(1,d)},function(){d.log_level=$(this),n(1,d)},function(){d.distributed_sync_enabled=this.checked,n(1,d)},function(){d.cluster_sync_enabled=this.checked,n(1,d)},function(){d.relay_group_enabled=this.checked,n(1,d)},function(){d.negentropy_enabled=this.checked,n(1,d)},function(){d.bin_dir=this.value,n(1,d)},e=>y(e)]}class Is extends te{constructor(e){super(),ee(this,e,Bs,As,o,{},null,[-1,-1])}}function Ss(e,t,n){const r=e.slice();return r[15]=t[n],r}function Cs(e,t,n){const r=e.slice();return r[18]=t[n],r[19]=t,r[20]=n,r}function Ls(e){let t,n;return{c(){t=h("div"),n=p(e[4]),w(t,"class","error-banner svelte-1ig49gt")},m(e,r){u(e,t,r),c(t,n)},p(e,t){16&t&&v(n,e[4])},d(e){e&&d(t)}}}function Ns(e){let t,n,r,s=e[2].message+"",o=e[2].downloaded_files?.length&&Us(e);return{c(){t=h("div"),n=p(s),r=g(),o&&o.c(),w(t,"class","success-banner svelte-1ig49gt")},m(e,s){u(e,t,s),c(t,n),c(t,r),o&&o.m(t,null)},p(e,r){4&r&&s!==(s=e[2].message+"")&&v(n,s),e[2].downloaded_files?.length?o?o.p(e,r):(o=Us(e),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(e){e&&d(t),o&&o.d()}}}function Us(e){let t,n,r,s=e[2].downloaded_files.join(", ")+"";return{c(){t=h("br"),n=p("Downloaded: "),r=p(s)},m(e,s){u(e,t,s),u(e,n,s),u(e,r,s)},p(e,t){4&t&&s!==(s=e[2].downloaded_files.join(", ")+"")&&v(r,s)},d(e){e&&(d(t),d(n),d(r))}}}function Os(e){let t,n,r,s,o,i,l,a,f=e[18]+"";function y(){e[10].call(o,e[18])}return{c(){t=h("div"),n=h("span"),r=p(f),s=g(),o=h("input"),i=g(),w(n,"class","binary-name svelte-1ig49gt"),w(o,"type","text"),w(o,"placeholder","https://..."),o.disabled=e[3],w(o,"class","svelte-1ig49gt"),w(t,"class","url-input svelte-1ig49gt")},m(d,f){u(d,t,f),c(t,n),c(n,r),c(t,s),c(t,o),E(o,e[1][e[18]]),c(t,i),l||(a=b(o,"input",y),l=!0)},p(t,n){e=t,2&n&&f!==(f=e[18]+"")&&v(r,f),8&n&&(o.disabled=e[3]),2&n&&o.value!==e[1][e[18]]&&E(o,e[1][e[18]])},d(e){e&&d(t),l=!1,a()}}}function Ts(e){let t,n,r,s,o,i,l,a=G(e[5].available_versions),p=[];for(let t=0;tVersion Installed Binaries Status',i=g(),l=h("tbody");for(let e=0;eUpdate Binaries',o=g(),ee&&ee.c(),i=g(),te&&te.c(),l=g(),a=h("div"),y=h("h3"),y.textContent="Current Version",m=g(),x=h("div"),_=h("span"),$=p(Q),k=g(),A=h("button"),B=p("Rollback"),S=g(),C=h("div"),L=h("h3"),L.textContent="Install New Version",N=g(),U=h("div"),O=h("label"),O.textContent="Version",T=g(),R=h("input"),P=g(),D=h("div"),q=h("div"),H=h("label"),H.textContent="Binary URLs",j=g(),F=h("button"),V=p("Fill from Release"),z=g();for(let e=0;en(4,r=e)),i(e,fr,e=>n(11,s=e)),i(e,hr,e=>n(12,o=e)),i(e,mr,e=>n(13,a=e)),i(e,br,e=>n(5,c=e));let u="",d={orly:"","orly-db-badger":"","orly-acl-follows":"","orly-launcher":""},f=null,h=!1;async function p(){l(mr,a=!0,a);try{l(br,c=await async function(e,t){const n=await vr("/api/binaries",{},e,t);if(!n.ok)throw new Error(`Failed to fetch binaries: ${n.statusText}`);return n.json()}(o,s),c),l(wr,r="",r)}catch(e){l(wr,r=e.message,r)}finally{l(mr,a=!1,a)}}return S(async()=>{await p()}),[u,d,f,h,r,c,async function(){const e={};for(const[t,n]of Object.entries(d))n.trim()&&(e[t]=n.trim());if(u.trim())if(0!==Object.keys(e).length){n(3,h=!0),n(2,f=null),l(wr,r="",r);try{n(2,f=await async function(e,t,n,r){const s=await vr("/api/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({version:n,urls:r})},e,t);if(!s.ok){const e=await s.json();throw new Error(e.message||`Update failed: ${s.statusText}`)}return s.json()}(o,s,u.trim(),e)),await p()}catch(e){l(wr,r=e.message,r)}finally{n(3,h=!1)}}else l(wr,r="At least one binary URL is required",r);else l(wr,r="Version is required",r)},async function(){if(confirm("Are you sure you want to rollback to the previous version?")){n(3,h=!0),l(wr,r="",r);try{const e=await async function(e,t){const n=await vr("/api/rollback",{method:"POST"},e,t);if(!n.ok){const e=await n.json();throw new Error(e.message||`Rollback failed: ${n.statusText}`)}return n.json()}(o,s);n(2,f={success:!0,message:`Rolled back from ${e.previous_version} to ${e.current_version}. Restart services to apply.`}),await p()}catch(e){l(wr,r=e.message,r)}finally{n(3,h=!1)}}},function(){let e=prompt("Enter release URL (e.g., https://git.mleku.dev/mleku/next.orly.dev/releases/tag/v0.56.0):");if(!e)return;let t=e.replace(/\/$/,"");if(t.includes("/releases/tag/"))t=t.replace("/releases/tag/","/releases/download/");else if(!t.includes("/releases/download/")){const e=u.trim()||"v0.56.0";t=t.replace(/\/$/,"")+"/releases/download/"+e}const r=prompt("Enter architecture (amd64 or arm64):","amd64");if(!r)return;const s=t.split("/"),o=s[s.length-1],i=o.replace("v","");n(1,d.orly=`${t}/orly-${i}-linux-${r}`,d),n(1,d["orly-db-badger"]=`${t}/orly-db-badger-${i}-linux-${r}`,d),n(1,d["orly-acl-follows"]=`${t}/orly-acl-follows-${i}-linux-${r}`,d),n(1,d["orly-launcher"]=`${t}/orly-launcher-${i}-linux-${r}`,d),u.trim()||n(0,u=o)},function(){u=this.value,n(0,u)},function(e){d[e]=this.value,n(1,d)}]}class Hs extends te{constructor(e){super(),ee(this,e,qs,Ds,o,{})}}function js(t){let n,r;return n=new Hs({}),{c(){Y(n.$$.fragment)},m(e,t){J(n,e,t),r=!0},p:e,i(e){r||(Z(n.$$.fragment,e),r=!0)},o(e){W(n.$$.fragment,e),r=!1},d(e){Q(n,e)}}}function Fs(t){let n,r;return n=new Is({}),{c(){Y(n.$$.fragment)},m(e,t){J(n,e,t),r=!0},p:e,i(e){r||(Z(n.$$.fragment,e),r=!0)},o(e){W(n.$$.fragment,e),r=!1},d(e){Q(n,e)}}}function Vs(t){let n,r;return n=new Rr({}),{c(){Y(n.$$.fragment)},m(e,t){J(n,e,t),r=!0},p:e,i(e){r||(Z(n.$$.fragment,e),r=!0)},o(e){W(n.$$.fragment,e),r=!1},d(e){Q(n,e)}}}function zs(t){let n,r,s,o,i,l,a,f;return{c(){n=h("div"),r=h("h2"),r.textContent="ORLY Launcher Admin",s=g(),o=h("p"),o.textContent="Please login to manage the relay services.",i=g(),l=h("button"),l.textContent="Login with Nostr",w(r,"class","svelte-4k9oqz"),w(o,"class","svelte-4k9oqz"),w(l,"class","login-btn svelte-4k9oqz"),w(n,"class","login-prompt svelte-4k9oqz")},m(e,d){u(e,n,d),c(n,r),c(n,s),c(n,o),c(n,i),c(n,l),a||(f=b(l,"click",t[10]),a=!0)},p:e,i:e,o:e,d(e){e&&d(n),a=!1,f()}}}function Ks(e){let t,n,r,s,o,i,l,a,f,p;n=new le({props:{currentPage:e[0],isLoggedIn:e[4],userPubkey:e[3]}}),n.$on("navigate",e[8]),n.$on("login",e[9]),n.$on("logout",e[6]);const y=[zs,Vs,Fs,js],b=[];function m(e,t){return e[4]?"dashboard"===e[0]?1:"config"===e[0]?2:"update"===e[0]?3:-1:0}function v(t){e[11](t)}~(o=m(e))&&(i=b[o]=y[o](e));let E={isDarkTheme:e[2]};return void 0!==e[1]&&(E.showModal=e[1]),a=new ar({props:E}),U.push(()=>function(e,t,n){const r=e.$$.props[t];void 0!==r&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}(a,"showModal",v)),a.$on("login",e[5]),a.$on("close",e[12]),{c(){t=h("main"),Y(n.$$.fragment),r=g(),s=h("div"),i&&i.c(),l=g(),Y(a.$$.fragment),w(s,"class","content svelte-4k9oqz"),w(t,"class","svelte-4k9oqz"),k(t,"dark-theme",e[2])},m(e,i){u(e,t,i),J(n,t,null),c(t,r),c(t,s),~o&&b[o].m(s,null),c(t,l),J(a,t,null),p=!0},p(e,[r]){const l={};1&r&&(l.currentPage=e[0]),16&r&&(l.isLoggedIn=e[4]),8&r&&(l.userPubkey=e[3]),n.$set(l);let c=o;o=m(e),o===c?~o&&b[o].p(e,r):(i&&(K(),W(b[c],1,1,()=>{b[c]=null}),M()),~o?(i=b[o],i?i.p(e,r):(i=b[o]=y[o](e),i.c()),Z(i,1),i.m(s,null)):i=null);const u={};var d;4&r&&(u.isDarkTheme=e[2]),!f&&2&r&&(f=!0,u.showModal=e[1],d=()=>f=!1,T.push(d)),a.$set(u),(!p||4&r)&&k(t,"dark-theme",e[2])},i(e){p||(Z(n.$$.fragment,e),Z(i),Z(a.$$.fragment,e),p=!0)},o(e){W(n.$$.fragment,e),W(i),W(a.$$.fragment,e),p=!1},d(e){e&&d(t),Q(n),~o&&b[o].d(),Q(a)}}}function Ms(e,t,n){let r,s,o,a;i(e,pr,e=>n(13,r=e)),i(e,hr,e=>n(14,s=e)),i(e,fr,e=>n(3,o=e)),i(e,dr,e=>n(4,a=e));let c="dashboard",u=!1,d=!1;function f(e){n(0,c=e)}S(()=>{const e=localStorage.getItem("launcher_auth_method"),t=localStorage.getItem("launcher_pubkey");"extension"===e&&t&&window.nostr&&window.nostr.getPublicKey().then(e=>{e===t&&(l(dr,a=!0,a),l(fr,o=e,o),l(hr,s=window.nostr,s),l(pr,r="extension",r))}).catch(()=>{localStorage.removeItem("launcher_auth_method"),localStorage.removeItem("launcher_pubkey")}),n(2,d=window.matchMedia("(prefers-color-scheme: dark)").matches)});return[c,u,d,o,a,function(e){const{method:t,pubkey:i,signer:c,privateKey:d}=e.detail;l(dr,a=!0,a),l(fr,o=i,o),l(hr,s=c,s),l(pr,r=t,r),localStorage.setItem("launcher_auth_method",t),localStorage.setItem("launcher_pubkey",i),n(1,u=!1)},function(){l(dr,a=!1,a),l(fr,o="",o),l(hr,s=null,s),l(pr,r="",r),localStorage.removeItem("launcher_auth_method"),localStorage.removeItem("launcher_pubkey"),localStorage.removeItem("launcher_privkey_encrypted")},f,e=>f(e.detail),()=>n(1,u=!0),()=>n(1,u=!0),function(e){u=e,n(1,u)},()=>n(1,u=!1)]}return new class extends te{constructor(e){super(),ee(this,e,Ms,Ks,o,{})}}({target:document.body})}(); diff --git a/cmd/orly-launcher/web/src/api.js b/cmd/orly-launcher/web/src/api.js index 014dee0..3cbdd44 100644 --- a/cmd/orly-launcher/web/src/api.js +++ b/cmd/orly-launcher/web/src/api.js @@ -93,6 +93,24 @@ export async function fetchConfig(signer, pubkey) { return response.json(); } +/** + * Save launcher configuration + * @param {object} config - Configuration object to save + */ +export async function saveConfig(signer, pubkey, config) { + const response = await authFetch('/api/config', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(config), + }, signer, pubkey); + + if (!response.ok) { + const data = await response.json().catch(() => ({})); + throw new Error(data.message || `Save failed: ${response.statusText}`); + } + return response.json(); +} + /** * Fetch available binaries */ diff --git a/cmd/orly-launcher/web/src/pages/Config.svelte b/cmd/orly-launcher/web/src/pages/Config.svelte index bc1de84..23b64b8 100644 --- a/cmd/orly-launcher/web/src/pages/Config.svelte +++ b/cmd/orly-launcher/web/src/pages/Config.svelte @@ -1,7 +1,13 @@
{#if $error}
{$error}
{/if} + {#if saveMessage} +
+ {saveMessage} + {#if saveSuccess && saveMessage.includes('Restart required')} + + {/if} +
+ {/if} + {#if $configData}

Database

- Backend - {$configData.db_backend} + + {#if editMode} + + {:else} + {$configData.db_backend} + {/if}
- Binary - {$configData.db_binary} + + {#if editMode} + + {:else} + {$configData.db_binary} + {/if}
- Listen Address - {$configData.db_listen} + + {#if editMode} + + {:else} + {$configData.db_listen} + {/if}
- Data Directory - {$configData.data_dir} + + {#if editMode} + + {:else} + {$configData.data_dir} + {/if}
@@ -60,22 +161,45 @@

ACL

- Enabled - - {$configData.acl_enabled ? 'Yes' : 'No'} - + + {#if editMode} + + {:else} + + {$configData.acl_enabled ? 'Yes' : 'No'} + + {/if}
- Mode - {$configData.acl_mode} + + {#if editMode} + + {:else} + {$configData.acl_mode} + {/if}
- Binary - {$configData.acl_binary} + + {#if editMode} + + {:else} + {$configData.acl_binary} + {/if}
- Listen Address - {$configData.acl_listen} + + {#if editMode} + + {:else} + {$configData.acl_listen} + {/if}
@@ -84,12 +208,26 @@

Relay

- Binary - {$configData.relay_binary} + + {#if editMode} + + {:else} + {$configData.relay_binary} + {/if}
- Log Level - {$configData.log_level} + + {#if editMode} + + {:else} + {$configData.log_level} + {/if}
@@ -98,28 +236,56 @@

Sync Services

- Distributed Sync - - {$configData.distributed_sync_enabled ? 'Enabled' : 'Disabled'} - + + {#if editMode} + + {:else} + + {$configData.distributed_sync_enabled ? 'Enabled' : 'Disabled'} + + {/if}
- Cluster Sync - - {$configData.cluster_sync_enabled ? 'Enabled' : 'Disabled'} - + + {#if editMode} + + {:else} + + {$configData.cluster_sync_enabled ? 'Enabled' : 'Disabled'} + + {/if}
- Relay Group - - {$configData.relay_group_enabled ? 'Enabled' : 'Disabled'} - + + {#if editMode} + + {:else} + + {$configData.relay_group_enabled ? 'Enabled' : 'Disabled'} + + {/if}
- Negentropy - - {$configData.negentropy_enabled ? 'Enabled' : 'Disabled'} - + + {#if editMode} + + {:else} + + {$configData.negentropy_enabled ? 'Enabled' : 'Disabled'} + + {/if}
@@ -128,14 +294,28 @@

Admin

- Binary Directory - {$configData.bin_dir} + + {#if editMode} + + {:else} + {$configData.bin_dir} + {/if}
- Admin Owners +
- {#each $configData.admin_owners || [] as owner} - {owner} + {#each (editMode ? editedConfig.admin_owners : $configData.admin_owners) || [] as owner, index} +
+ {owner} + {#if editMode} + + {/if} +
{:else} No owners configured {/each} @@ -145,9 +325,11 @@
-
-

Configuration is loaded from environment variables. To change settings, update the environment and restart the launcher.

-
+ {#if !editMode} +
+

Configuration is saved to {$configData.bin_dir?.replace(/\/bin$/, '')}/launcher.json. Environment variables override file settings.

+
+ {/if} {:else if !$error}
Loading configuration...
{/if} @@ -170,7 +352,12 @@ color: var(--text-color); } - .refresh-btn { + .header-buttons { + display: flex; + gap: 8px; + } + + .refresh-btn, .edit-btn, .cancel-btn, .save-btn { padding: 8px 16px; background: var(--card-bg); border: 1px solid var(--border-color); @@ -180,11 +367,27 @@ font-size: 0.9rem; } - .refresh-btn:hover:not(:disabled) { + .edit-btn { + background: var(--primary); + border-color: var(--primary); + color: white; + } + + .save-btn { + background: var(--success); + border-color: var(--success); + color: white; + } + + .cancel-btn:hover:not(:disabled) { background: var(--border-color); } - .refresh-btn:disabled { + .edit-btn:hover:not(:disabled), .save-btn:hover:not(:disabled) { + opacity: 0.9; + } + + button:disabled { opacity: 0.5; cursor: not-allowed; } @@ -198,6 +401,37 @@ border: 1px solid #ffcdd2; } + .message-banner { + padding: 12px 16px; + border-radius: 6px; + margin-bottom: 20px; + display: flex; + align-items: center; + gap: 12px; + } + + .message-banner.success { + background: #e8f5e9; + color: #2e7d32; + border: 1px solid #c8e6c9; + } + + .message-banner.error { + background: #ffebee; + color: #c62828; + border: 1px solid #ffcdd2; + } + + .restart-btn-inline { + padding: 4px 12px; + background: var(--primary); + border: none; + color: white; + border-radius: 4px; + cursor: pointer; + font-size: 0.85rem; + } + .config-sections { display: flex; flex-direction: column; @@ -238,6 +472,9 @@ .config-item .label { font-size: 0.85rem; color: var(--muted-color); + display: flex; + align-items: center; + gap: 8px; } .config-item .value { @@ -258,6 +495,34 @@ color: var(--success); } + .config-item input[type="text"], + .config-item select { + padding: 8px 12px; + border: 1px solid var(--border-color); + border-radius: 4px; + background: var(--bg-color); + color: var(--text-color); + font-size: 0.9rem; + } + + .config-item input[type="text"]:focus, + .config-item select:focus { + outline: none; + border-color: var(--primary); + } + + .toggle { + display: flex; + align-items: center; + gap: 8px; + cursor: pointer; + } + + .toggle input[type="checkbox"] { + width: 18px; + height: 18px; + } + .owners-list { display: flex; flex-wrap: wrap; @@ -265,6 +530,12 @@ margin-top: 4px; } + .owner-item { + display: flex; + align-items: center; + gap: 4px; + } + .owner { font-size: 0.75rem; background: var(--bg-color); @@ -273,6 +544,26 @@ word-break: break-all; } + .remove-owner-btn { + padding: 2px 6px; + background: #ffebee; + border: none; + color: #c62828; + border-radius: 4px; + cursor: pointer; + font-size: 0.8rem; + } + + .add-owner-btn { + padding: 2px 8px; + background: var(--primary); + border: none; + color: white; + border-radius: 4px; + cursor: pointer; + font-size: 0.75rem; + } + .no-owners { color: var(--muted-color); font-style: italic; @@ -292,6 +583,13 @@ margin: 0; } + .config-note code { + background: var(--bg-color); + padding: 2px 6px; + border-radius: 4px; + font-size: 0.85rem; + } + .loading { text-align: center; color: var(--muted-color); diff --git a/cmd/orly-launcher/web/src/pages/Update.svelte b/cmd/orly-launcher/web/src/pages/Update.svelte index 467cba1..e1f6a6e 100644 --- a/cmd/orly-launcher/web/src/pages/Update.svelte +++ b/cmd/orly-launcher/web/src/pages/Update.svelte @@ -86,19 +86,31 @@ function setReleaseUrls() { // Helper to fill in URLs from a release base - const baseUrl = prompt('Enter release base URL (e.g., https://git.mleku.dev/mleku/next.orly.dev/releases/download/v0.55.11):'); - if (!baseUrl) return; + let inputUrl = prompt('Enter release URL (e.g., https://git.mleku.dev/mleku/next.orly.dev/releases/tag/v0.56.0):'); + if (!inputUrl) return; + + // Normalize the URL - convert /releases/tag/ to /releases/download/ + let cleanBase = inputUrl.replace(/\/$/, ''); + if (cleanBase.includes('/releases/tag/')) { + cleanBase = cleanBase.replace('/releases/tag/', '/releases/download/'); + } else if (!cleanBase.includes('/releases/download/')) { + // If it's just a repo URL, construct the download path + const ver = version.trim() || 'v0.56.0'; + cleanBase = cleanBase.replace(/\/$/, '') + '/releases/download/' + ver; + } - const cleanBase = baseUrl.replace(/\/$/, ''); const arch = prompt('Enter architecture (amd64 or arm64):', 'amd64'); if (!arch) return; - const ver = version.trim() || baseUrl.split('/').pop(); + // Extract version from URL + const urlParts = cleanBase.split('/'); + const ver = urlParts[urlParts.length - 1]; + const verNum = ver.replace('v', ''); - urls['orly'] = `${cleanBase}/orly-${ver.replace('v', '')}-linux-${arch}`; - urls['orly-db-badger'] = `${cleanBase}/orly-db-badger-${ver.replace('v', '')}-linux-${arch}`; - urls['orly-acl-follows'] = `${cleanBase}/orly-acl-follows-${ver.replace('v', '')}-linux-${arch}`; - urls['orly-launcher'] = `${cleanBase}/orly-launcher-${ver.replace('v', '')}-linux-${arch}`; + urls['orly'] = `${cleanBase}/orly-${verNum}-linux-${arch}`; + urls['orly-db-badger'] = `${cleanBase}/orly-db-badger-${verNum}-linux-${arch}`; + urls['orly-acl-follows'] = `${cleanBase}/orly-acl-follows-${verNum}-linux-${arch}`; + urls['orly-launcher'] = `${cleanBase}/orly-launcher-${verNum}-linux-${arch}`; if (!version.trim()) { version = ver; diff --git a/pkg/version/version b/pkg/version/version index fefa9a2..c676b21 100644 --- a/pkg/version/version +++ b/pkg/version/version @@ -1 +1 @@ -v0.55.11 +v0.56.0