From 9ecea8713fefa0fc10f4039d5711f9264a9d8bb7 Mon Sep 17 00:00:00 2001 From: woikos Date: Sat, 24 Jan 2026 17:44:38 +0100 Subject: [PATCH] Add launcher dashboard service controls and NIP-86 advertisement - Add start/stop/restart buttons for individual services in launcher UI - Show all available modules with categories (Database, ACL, Sync, Certs) - Add enable/disable toggles with mutual exclusivity for DB/ACL backends - Handle service dependencies when stopping (DB stops dependents first) - Advertise NIP-86 in NIP-11 when ACL mode is managed or curating - Add module descriptions showing API coverage Files modified: - app/handle-relayinfo.go: Add NIP-86 to supported NIPs for managed/curating modes - cmd/orly-launcher/server.go: Add start-service/stop-service endpoints, ProcessStatus fields - cmd/orly-launcher/supervisor.go: Add StartService, StopService with dependency handling - cmd/orly-launcher/web/src/api.js: Add startService, stopService API functions - cmd/orly-launcher/web/src/components/ProcessCard.svelte: Add toggles, categories, action buttons - cmd/orly-launcher/web/src/pages/Dashboard.svelte: Add service control handlers - pkg/version/version: Bump to v0.56.9 Co-Authored-By: Claude Opus 4.5 --- app/handle-relayinfo.go | 8 + cmd/orly-launcher/server.go | 111 ++++++- cmd/orly-launcher/supervisor.go | 307 ++++++++++++++++-- cmd/orly-launcher/web/dist/bundle.css | 2 +- cmd/orly-launcher/web/dist/bundle.js | 16 +- cmd/orly-launcher/web/src/api.js | 36 ++ .../web/src/components/ProcessCard.svelte | 271 ++++++++++++++-- .../web/src/pages/Dashboard.svelte | 149 ++++++++- pkg/version/version | 2 +- 9 files changed, 826 insertions(+), 76 deletions(-) diff --git a/app/handle-relayinfo.go b/app/handle-relayinfo.go index 9b200f4..24a8cba 100644 --- a/app/handle-relayinfo.go +++ b/app/handle-relayinfo.go @@ -77,6 +77,10 @@ func (s *Server) HandleRelayInfo(w http.ResponseWriter, r *http.Request) { if s.Config.NegentropyEnabled { nips = append(nips, relayinfo.NIP{Number: 77, Description: "Negentropy-based sync"}) } + // Add NIP-86 (Relay Management API) if ACL mode supports it + if s.Config.ACLMode == "managed" || s.Config.ACLMode == "curating" { + nips = append(nips, relayinfo.NIP{Number: 86, Description: "Relay Management API"}) + } supportedNIPs := relayinfo.GetList(nips...) if s.Config.ACLMode != "none" { nipsACL := []relayinfo.NIP{ @@ -104,6 +108,10 @@ func (s *Server) HandleRelayInfo(w http.ResponseWriter, r *http.Request) { if s.Config.NegentropyEnabled { nipsACL = append(nipsACL, relayinfo.NIP{Number: 77, Description: "Negentropy-based sync"}) } + // Add NIP-86 (Relay Management API) if ACL mode supports it + if s.Config.ACLMode == "managed" || s.Config.ACLMode == "curating" { + nipsACL = append(nipsACL, relayinfo.NIP{Number: 86, Description: "Relay Management API"}) + } supportedNIPs = relayinfo.GetList(nipsACL...) } sort.Sort(supportedNIPs) diff --git a/cmd/orly-launcher/server.go b/cmd/orly-launcher/server.go index f03df3b..ed3f954 100644 --- a/cmd/orly-launcher/server.go +++ b/cmd/orly-launcher/server.go @@ -52,6 +52,8 @@ func (s *AdminServer) Start(ctx context.Context) error { mux.HandleFunc("/api/rollback", s.auth.RequireAuth(s.handleRollback)) mux.HandleFunc("/api/start-services", s.auth.RequireAuth(s.handleStartServices)) mux.HandleFunc("/api/stop-services", s.auth.RequireAuth(s.handleStopServices)) + mux.HandleFunc("/api/start-service", s.auth.RequireAuth(s.handleStartService)) + mux.HandleFunc("/api/stop-service", s.auth.RequireAuth(s.handleStopService)) addr := fmt.Sprintf(":%d", s.cfg.AdminPort) s.server = &http.Server{ @@ -81,13 +83,16 @@ type StatusResponse struct { // ProcessStatus represents the status of a single managed process. type ProcessStatus struct { - Name string `json:"name"` - Binary string `json:"binary"` - Version string `json:"version"` - Status string `json:"status"` - PID int `json:"pid"` - Restarts int `json:"restarts"` - StartedAt string `json:"started_at,omitempty"` + Name string `json:"name"` + Binary string `json:"binary"` + Version string `json:"version"` + Status string `json:"status"` // running, stopped, disabled + Enabled bool `json:"enabled"` + Category string `json:"category"` // database, acl, sync, certs, relay + Description string `json:"description"` + PID int `json:"pid"` + Restarts int `json:"restarts"` + StartedAt string `json:"started_at,omitempty"` } func (s *AdminServer) handleStatus(w http.ResponseWriter, r *http.Request) { @@ -654,6 +659,98 @@ func (s *AdminServer) handleStopServices(w http.ResponseWriter, r *http.Request) json.NewEncoder(w).Encode(response) } +// StartServiceRequest is the request body for POST /api/start-service +type StartServiceRequest struct { + Service string `json:"service"` +} + +// StartServiceResponse is the response for POST /api/start-service +type StartServiceResponse struct { + Success bool `json:"success"` + Message string `json:"message"` +} + +func (s *AdminServer) handleStartService(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) + return + } + + var req StartServiceRequest + if err := json.NewDecoder(r.Body).Decode(&req); chk.E(err) { + http.Error(w, "Invalid request body", http.StatusBadRequest) + return + } + + if req.Service == "" { + http.Error(w, "Service name is required", http.StatusBadRequest) + return + } + + // Start the service + go func() { + if err := s.supervisor.StartService(req.Service); chk.E(err) { + log.E.F("start service %s failed: %v", req.Service, err) + } else { + log.I.F("started service: %s", req.Service) + } + }() + + response := StartServiceResponse{ + Success: true, + Message: fmt.Sprintf("Start of %s initiated", req.Service), + } + + w.Header().Set("Content-Type", "application/json") + json.NewEncoder(w).Encode(response) +} + +// StopServiceRequest is the request body for POST /api/stop-service +type StopServiceRequest struct { + Service string `json:"service"` +} + +// StopServiceResponse is the response for POST /api/stop-service +type StopServiceResponse struct { + Success bool `json:"success"` + Message string `json:"message"` +} + +func (s *AdminServer) handleStopService(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) + return + } + + var req StopServiceRequest + if err := json.NewDecoder(r.Body).Decode(&req); chk.E(err) { + http.Error(w, "Invalid request body", http.StatusBadRequest) + return + } + + if req.Service == "" { + http.Error(w, "Service name is required", http.StatusBadRequest) + return + } + + // Stop the service + go func() { + if err := s.supervisor.StopService(req.Service); chk.E(err) { + log.E.F("stop service %s failed: %v", req.Service, err) + } else { + log.I.F("stopped service: %s", req.Service) + } + }() + + response := StopServiceResponse{ + Success: true, + Message: fmt.Sprintf("Stop of %s initiated", req.Service), + } + + w.Header().Set("Content-Type", "application/json") + json.NewEncoder(w).Encode(response) +} + func (s *AdminServer) serveUI(w http.ResponseWriter, r *http.Request) { s.serveAdminUI(w, r) } diff --git a/cmd/orly-launcher/supervisor.go b/cmd/orly-launcher/supervisor.go index 48f6cec..bf5461d 100644 --- a/cmd/orly-launcher/supervisor.go +++ b/cmd/orly-launcher/supervisor.go @@ -917,51 +917,79 @@ func (s *Supervisor) startCerts() error { return nil } -// GetProcessStatuses returns the status of all managed processes. +// GetProcessStatuses returns the status of all available modules with categories. +// Modules are grouped by category, and some categories are mutually exclusive. func (s *Supervisor) GetProcessStatuses() []ProcessStatus { s.mu.Lock() defer s.mu.Unlock() var statuses []ProcessStatus - // Database process - if s.dbProc != nil { - statuses = append(statuses, s.getProcessStatus(s.dbProc, s.cfg.DBBinary)) - } - - // ACL process - if s.cfg.ACLEnabled && s.aclProc != nil { - statuses = append(statuses, s.getProcessStatus(s.aclProc, s.cfg.ACLBinary)) - } - - // Sync services - if s.cfg.DistributedSyncEnabled && s.distributedSyncProc != nil { - statuses = append(statuses, s.getProcessStatus(s.distributedSyncProc, s.cfg.DistributedSyncBinary)) - } - if s.cfg.ClusterSyncEnabled && s.clusterSyncProc != nil { - statuses = append(statuses, s.getProcessStatus(s.clusterSyncProc, s.cfg.ClusterSyncBinary)) - } - if s.cfg.RelayGroupEnabled && s.relayGroupProc != nil { - statuses = append(statuses, s.getProcessStatus(s.relayGroupProc, s.cfg.RelayGroupBinary)) - } - if s.cfg.NegentropyEnabled && s.negentropyProc != nil { - statuses = append(statuses, s.getProcessStatus(s.negentropyProc, s.cfg.NegentropyBinary)) - } - - // Certificate service - if s.cfg.CertsEnabled && s.certsProc != nil { - statuses = append(statuses, s.getProcessStatus(s.certsProc, s.cfg.CertsBinary)) - } - - // Relay process - if s.relayProc != nil { - statuses = append(statuses, s.getProcessStatus(s.relayProc, s.cfg.RelayBinary)) - } + // Database backends (mutually exclusive - only one can be active) + isBadger := s.cfg.DBBackend == "badger" + isNeo4j := s.cfg.DBBackend == "neo4j" + + statuses = append(statuses, s.getProcessStatusFull( + s.dbProc, "orly-db-badger", "orly-db-badger", + isBadger, "database", "Badger embedded key-value store (default)", + )) + statuses = append(statuses, s.getProcessStatusFull( + nil, "orly-db-neo4j", "orly-db-neo4j", + isNeo4j, "database", "Neo4j graph database for WoT queries", + )) + + // ACL backends (mutually exclusive - only one can be active, can be disabled) + isFollows := s.cfg.ACLEnabled && s.cfg.ACLMode == "follows" + isManaged := s.cfg.ACLEnabled && s.cfg.ACLMode == "managed" + isCuration := s.cfg.ACLEnabled && (s.cfg.ACLMode == "curation" || s.cfg.ACLMode == "curating") + + statuses = append(statuses, s.getProcessStatusFull( + s.aclProc, "orly-acl-follows", "orly-acl-follows", + isFollows, "acl", "Whitelist based on admin's follow list", + )) + statuses = append(statuses, s.getProcessStatusFull( + nil, "orly-acl-managed", "orly-acl-managed", + isManaged, "acl", "NIP-86 fine-grained access control", + )) + statuses = append(statuses, s.getProcessStatusFull( + nil, "orly-acl-curation", "orly-acl-curation", + isCuration, "acl", "Rate-limited trust tiers for curation", + )) + + // Sync services (independent - multiple can be enabled) + statuses = append(statuses, s.getProcessStatusFull( + s.distributedSyncProc, "orly-sync-distributed", s.cfg.DistributedSyncBinary, + s.cfg.DistributedSyncEnabled, "sync", "Distributed event synchronization", + )) + statuses = append(statuses, s.getProcessStatusFull( + s.clusterSyncProc, "orly-sync-cluster", s.cfg.ClusterSyncBinary, + s.cfg.ClusterSyncEnabled, "sync", "Cluster synchronization for HA", + )) + statuses = append(statuses, s.getProcessStatusFull( + s.relayGroupProc, "orly-sync-relaygroup", s.cfg.RelayGroupBinary, + s.cfg.RelayGroupEnabled, "sync", "NIP-29 relay group synchronization", + )) + statuses = append(statuses, s.getProcessStatusFull( + s.negentropyProc, "orly-sync-negentropy", s.cfg.NegentropyBinary, + s.cfg.NegentropyEnabled, "sync", "NIP-77 negentropy reconciliation", + )) + + // Certificate service (standalone) + statuses = append(statuses, s.getProcessStatusFull( + s.certsProc, "orly-certs", s.cfg.CertsBinary, + s.cfg.CertsEnabled, "certs", "Let's Encrypt certificate management", + )) + + // Relay process - always enabled + statuses = append(statuses, s.getProcessStatusFull( + s.relayProc, "orly", s.cfg.RelayBinary, + true, "relay", "Main Nostr relay server", + )) return statuses } -func (s *Supervisor) getProcessStatus(p *Process, binaryPath string) ProcessStatus { +func (s *Supervisor) getProcessStatus(p *Process, binaryPath string, enabled bool) ProcessStatus { status := "stopped" pid := 0 @@ -984,11 +1012,70 @@ func (s *Supervisor) getProcessStatus(p *Process, binaryPath string) ProcessStat Binary: binaryPath, Version: "", // Will be filled by caller if needed Status: status, + Enabled: enabled, PID: pid, Restarts: p.restarts, } } +// getProcessStatusOrDisabled returns the status of a process, or a disabled status if the process is nil. +func (s *Supervisor) getProcessStatusOrDisabled(p *Process, name, binaryPath string, enabled bool) ProcessStatus { + if p != nil { + return s.getProcessStatus(p, binaryPath, enabled) + } + + // Process doesn't exist - show as disabled or stopped + status := "stopped" + if !enabled { + status = "disabled" + } + + return ProcessStatus{ + Name: name, + Binary: binaryPath, + Status: status, + Enabled: enabled, + } +} + +// getProcessStatusFull returns the status of a process with category and description. +func (s *Supervisor) getProcessStatusFull(p *Process, name, binaryPath string, enabled bool, category, description string) ProcessStatus { + status := "disabled" + pid := 0 + restarts := 0 + + if enabled { + status = "stopped" + } + + if p != nil { + p.mu.Lock() + defer p.mu.Unlock() + + if p.cmd != nil && p.cmd.Process != nil { + select { + case <-p.exited: + status = "stopped" + default: + status = "running" + pid = p.cmd.Process.Pid + } + } + restarts = p.restarts + } + + return ProcessStatus{ + Name: name, + Binary: binaryPath, + Status: status, + Enabled: enabled, + Category: category, + Description: description, + PID: pid, + Restarts: restarts, + } +} + // RestartService restarts a specific service with dependency handling. // If a service's dependencies need to restart, they are handled appropriately. // Returns the list of services that were restarted. @@ -1153,6 +1240,156 @@ func (s *Supervisor) RestartService(serviceName string) ([]string, error) { return restarted, nil } +// StartService starts a specific service if it's not already running. +func (s *Supervisor) StartService(serviceName string) error { + log.I.F("starting service: %s", serviceName) + + switch serviceName { + case "orly-db", "db": + if err := s.startDB(); err != nil { + return fmt.Errorf("failed to start db: %w", err) + } + if err := s.waitForDBReady(s.cfg.DBReadyTimeout); err != nil { + return fmt.Errorf("db not ready: %w", err) + } + + case "orly-acl", "acl": + if !s.cfg.ACLEnabled { + return fmt.Errorf("ACL is not enabled in configuration") + } + if err := s.startACL(); err != nil { + return fmt.Errorf("failed to start acl: %w", err) + } + if err := s.waitForACLReady(s.cfg.ACLReadyTimeout); err != nil { + return fmt.Errorf("acl not ready: %w", err) + } + + case "orly-sync-distributed", "distributed-sync": + if !s.cfg.DistributedSyncEnabled { + return fmt.Errorf("distributed sync is not enabled in configuration") + } + if err := s.startDistributedSync(); err != nil { + return fmt.Errorf("failed to start distributed sync: %w", err) + } + + case "orly-sync-cluster", "cluster-sync": + if !s.cfg.ClusterSyncEnabled { + return fmt.Errorf("cluster sync is not enabled in configuration") + } + if err := s.startClusterSync(); err != nil { + return fmt.Errorf("failed to start cluster sync: %w", err) + } + + case "orly-sync-relaygroup", "relaygroup": + if !s.cfg.RelayGroupEnabled { + return fmt.Errorf("relaygroup is not enabled in configuration") + } + if err := s.startRelayGroup(); err != nil { + return fmt.Errorf("failed to start relaygroup: %w", err) + } + + case "orly-sync-negentropy", "negentropy": + if !s.cfg.NegentropyEnabled { + return fmt.Errorf("negentropy is not enabled in configuration") + } + if err := s.startNegentropy(); err != nil { + return fmt.Errorf("failed to start negentropy: %w", err) + } + + case "orly-certs", "certs": + if !s.cfg.CertsEnabled { + return fmt.Errorf("certificate service is not enabled in configuration") + } + if err := s.startCerts(); err != nil { + return fmt.Errorf("failed to start certificate service: %w", err) + } + + case "orly", "relay": + if err := s.startRelay(); err != nil { + return fmt.Errorf("failed to start relay: %w", err) + } + + default: + return fmt.Errorf("unknown service: %s", serviceName) + } + + log.I.F("started service: %s", serviceName) + return nil +} + +// StopService stops a specific service and its dependents. +// Dependency chain: db → acl, sync services → relay +// Stopping a service will first stop all services that depend on it. +func (s *Supervisor) StopService(serviceName string) error { + log.I.F("stopping service: %s", serviceName) + + switch serviceName { + case "orly-db", "db": + // DB is the root - everything depends on it + // Stop in reverse dependency order: relay, sync, acl, then db + log.I.F("stopping relay (depends on db)") + s.stopProcess(s.relayProc, 5*time.Second) + + log.I.F("stopping sync services (depend on db)") + s.stopSyncServices() + + if s.cfg.ACLEnabled && s.aclProc != nil { + log.I.F("stopping acl (depends on db)") + s.stopProcess(s.aclProc, 5*time.Second) + } + + log.I.F("stopping db") + s.stopProcess(s.dbProc, s.cfg.StopTimeout) + + case "orly-acl", "acl": + // Relay depends on ACL when ACL is enabled + if s.cfg.ACLEnabled { + log.I.F("stopping relay (depends on acl)") + s.stopProcess(s.relayProc, 5*time.Second) + } + if s.aclProc != nil { + s.stopProcess(s.aclProc, 5*time.Second) + } + + case "orly-sync-distributed", "distributed-sync": + // Relay may depend on sync services + if s.distributedSyncProc != nil { + s.stopProcess(s.distributedSyncProc, 5*time.Second) + } + + case "orly-sync-cluster", "cluster-sync": + if s.clusterSyncProc != nil { + s.stopProcess(s.clusterSyncProc, 5*time.Second) + } + + case "orly-sync-relaygroup", "relaygroup": + if s.relayGroupProc != nil { + s.stopProcess(s.relayGroupProc, 5*time.Second) + } + + case "orly-sync-negentropy", "negentropy": + if s.negentropyProc != nil { + s.stopProcess(s.negentropyProc, 5*time.Second) + } + + case "orly-certs", "certs": + // Certs is independent + if s.certsProc != nil { + s.stopProcess(s.certsProc, 5*time.Second) + } + + case "orly", "relay": + // Relay is a leaf - nothing depends on it + s.stopProcess(s.relayProc, 5*time.Second) + + default: + return fmt.Errorf("unknown service: %s", serviceName) + } + + log.I.F("stopped service: %s", serviceName) + return nil +} + // RestartAll stops all processes and starts them again. func (s *Supervisor) RestartAll() error { log.I.F("restarting all processes...") diff --git a/cmd/orly-launcher/web/dist/bundle.css b/cmd/orly-launcher/web/dist/bundle.css index f8a1b72..24b1337 100644 --- a/cmd/orly-launcher/web/dist/bundle.css +++ b/cmd/orly-launcher/web/dist/bundle.css @@ -1,6 +1,6 @@ header.svelte-1bc06ax{background:var(--card-bg);border-bottom:1px solid var(--border-color);padding:0 20px}.header-content.svelte-1bc06ax{max-width:1200px;margin:0 auto;display:flex;align-items:center;justify-content:space-between;height:60px}h1.svelte-1bc06ax{font-size:1.25rem;font-weight:600;color:var(--text-color)}nav.svelte-1bc06ax{display:flex;gap:4px}.nav-btn.svelte-1bc06ax{padding:8px 16px;background:none;border:none;border-radius:4px;color:var(--muted-color);cursor:pointer;font-size:0.9rem}.nav-btn.svelte-1bc06ax:hover{background:var(--border-color);color:var(--text-color)}.nav-btn.active.svelte-1bc06ax{background:var(--primary);color:white}.user-section.svelte-1bc06ax{display:flex;align-items:center;gap:12px}.pubkey.svelte-1bc06ax{font-family:monospace;font-size:0.85rem;color:var(--muted-color)}.logout-btn.svelte-1bc06ax,.login-header-btn.svelte-1bc06ax{padding:6px 14px;font-size:0.85rem;border-radius:4px;cursor:pointer}.logout-btn.svelte-1bc06ax{background:none;border:1px solid var(--border-color);color:var(--text-color)}.logout-btn.svelte-1bc06ax:hover{background:var(--border-color)}.login-header-btn.svelte-1bc06ax{background:var(--primary);border:none;color:white}.login-header-btn.svelte-1bc06ax:hover{background:var(--primary-hover)} .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)} +.process-card.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{background:var(--card-bg);border:1px solid var(--border-color);border-radius:8px;padding:16px;display:flex;flex-direction:column;gap:10px}.process-card.disabled.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{opacity:0.6}.process-header.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{display:flex;align-items:center;gap:8px}.status-indicator.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{font-size:1.2rem;flex-shrink:0}.name-section.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{flex:1;display:flex;flex-direction:column;gap:2px}.process-name.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{font-weight:600;font-size:0.95rem;color:var(--text-color)}.category-badge.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{font-size:0.65rem;padding:1px 4px;border-radius:3px;text-transform:uppercase;background:var(--border-color);color:var(--muted-color);width:fit-content}.category-badge.exclusive.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{background:var(--warning, #ff9800);color:white;opacity:0.8}.description.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{font-size:0.8rem;color:var(--muted-color);margin:0;line-height:1.3}.badge.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{font-size:0.65rem;padding:2px 6px;border-radius:4px;text-transform:uppercase;flex-shrink:0}.required-badge.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{background:var(--text-color);color:var(--card-bg);opacity:0.4}.enable-toggle.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{position:relative;display:inline-block;width:36px;height:20px;cursor:pointer;flex-shrink:0}.enable-toggle.svelte-1lnumzb input.svelte-1lnumzb.svelte-1lnumzb{opacity:0;width:0;height:0}.toggle-slider.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{position:absolute;top:0;left:0;right:0;bottom:0;background-color:var(--muted-color);border-radius:20px;transition:0.2s}.toggle-slider.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb:before{position:absolute;content:"";height:14px;width:14px;left:3px;bottom:3px;background-color:white;border-radius:50%;transition:0.2s}.enable-toggle.svelte-1lnumzb input.svelte-1lnumzb:checked+.toggle-slider.svelte-1lnumzb{background-color:var(--success, #4caf50)}.enable-toggle.svelte-1lnumzb input.svelte-1lnumzb:checked+.toggle-slider.svelte-1lnumzb:before{transform:translateX(16px)}.enable-toggle.svelte-1lnumzb input.svelte-1lnumzb:disabled+.toggle-slider.svelte-1lnumzb{opacity:0.5;cursor:not-allowed}.process-details.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{display:flex;flex-direction:column;gap:4px}.detail-row.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{display:flex;justify-content:space-between;font-size:0.8rem}.label.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{color:var(--muted-color)}.value.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{color:var(--text-color);font-family:monospace}.value.warning.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{color:var(--warning)}.process-actions.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{display:flex;gap:8px;align-items:center;margin-top:4px;padding-top:10px;border-top:1px solid var(--border-color)}.action-btn.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{width:32px;height:32px;border-radius:4px;border:none;cursor:pointer;font-size:1rem;display:flex;align-items:center;justify-content:center;transition:opacity 0.2s, transform 0.1s}.action-btn.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb:hover:not(:disabled){transform:scale(1.05)}.action-btn.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb:disabled{opacity:0.5;cursor:not-allowed}.start-btn.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{background:var(--success, #4caf50);color:white}.stop-btn.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{background:var(--error, #f44336);color:white}.restart-btn.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{background:var(--warning, #ff9800);color:white}.hint.svelte-1lnumzb.svelte-1lnumzb.svelte-1lnumzb{font-size:0.75rem;color:var(--muted-color);font-style:italic} .dashboard.svelte-ehjgxg.svelte-ehjgxg{padding:20px 0}.page-header.svelte-ehjgxg.svelte-ehjgxg{display:flex;justify-content:space-between;align-items:center;margin-bottom:24px}.page-header.svelte-ehjgxg h2.svelte-ehjgxg{font-size:1.5rem;color:var(--text-color)}.actions.svelte-ehjgxg.svelte-ehjgxg{display:flex;gap:8px}.refresh-btn.svelte-ehjgxg.svelte-ehjgxg,.restart-btn.svelte-ehjgxg.svelte-ehjgxg,.start-btn.svelte-ehjgxg.svelte-ehjgxg,.stop-btn.svelte-ehjgxg.svelte-ehjgxg{padding:8px 16px;border-radius:4px;cursor:pointer;font-size:0.9rem}.refresh-btn.svelte-ehjgxg.svelte-ehjgxg{background:var(--card-bg);border:1px solid var(--border-color);color:var(--text-color)}.refresh-btn.svelte-ehjgxg.svelte-ehjgxg:hover:not(:disabled){background:var(--border-color)}.restart-btn.svelte-ehjgxg.svelte-ehjgxg{background:var(--warning);border:none;color:white}.restart-btn.svelte-ehjgxg.svelte-ehjgxg:hover:not(:disabled){opacity:0.9}.start-btn.svelte-ehjgxg.svelte-ehjgxg{background:var(--success, #4caf50);border:none;color:white}.start-btn.svelte-ehjgxg.svelte-ehjgxg:hover:not(:disabled){opacity:0.9}.stop-btn.svelte-ehjgxg.svelte-ehjgxg{background:var(--error, #f44336);border:none;color:white}.stop-btn.svelte-ehjgxg.svelte-ehjgxg:hover:not(:disabled){opacity:0.9}.restart-btn.svelte-ehjgxg.svelte-ehjgxg:disabled,.refresh-btn.svelte-ehjgxg.svelte-ehjgxg:disabled,.start-btn.svelte-ehjgxg.svelte-ehjgxg:disabled,.stop-btn.svelte-ehjgxg.svelte-ehjgxg:disabled{opacity:0.5;cursor:not-allowed}.error-banner.svelte-ehjgxg.svelte-ehjgxg{background:#ffebee;color:#c62828;padding:12px 16px;border-radius:6px;margin-bottom:20px;border:1px solid #ffcdd2}.status-summary.svelte-ehjgxg.svelte-ehjgxg{display:grid;grid-template-columns:repeat(auto-fit, minmax(150px, 1fr));gap:16px;margin-bottom:32px}.summary-card.svelte-ehjgxg.svelte-ehjgxg{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-ehjgxg .label.svelte-ehjgxg{font-size:0.85rem;color:var(--muted-color)}.summary-card.svelte-ehjgxg .value.svelte-ehjgxg{font-size:1.25rem;font-weight:600;color:var(--text-color)}.status-indicator.running.svelte-ehjgxg.svelte-ehjgxg{color:var(--success, #4caf50)}.status-indicator.stopped.svelte-ehjgxg.svelte-ehjgxg{color:var(--error, #f44336)}h3.svelte-ehjgxg.svelte-ehjgxg{font-size:1.1rem;color:var(--text-color);margin-bottom:16px}.processes-grid.svelte-ehjgxg.svelte-ehjgxg{display:grid;grid-template-columns:repeat(auto-fill, minmax(280px, 1fr));gap:16px}.loading.svelte-ehjgxg.svelte-ehjgxg{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-z9aqcb.svelte-z9aqcb{padding:20px 0}.page-header.svelte-z9aqcb.svelte-z9aqcb{margin-bottom:24px}.page-header.svelte-z9aqcb h2.svelte-z9aqcb{font-size:1.5rem;color:var(--text-color)}.error-banner.svelte-z9aqcb.svelte-z9aqcb{background:#ffebee;color:#c62828;padding:12px 16px;border-radius:6px;margin-bottom:20px;border:1px solid #ffcdd2}.success-banner.svelte-z9aqcb.svelte-z9aqcb{background:#e8f5e9;color:#2e7d32;padding:12px 16px;border-radius:6px;margin-bottom:20px;border:1px solid #c8e6c9}.launcher-restart.svelte-z9aqcb.svelte-z9aqcb{margin-top:12px;padding-top:12px;border-top:1px solid #c8e6c9;display:flex;align-items:center;gap:12px}.restart-launcher-btn.svelte-z9aqcb.svelte-z9aqcb{padding:8px 16px;background:#1976d2;border:none;color:white;border-radius:4px;cursor:pointer;font-weight:500}.restart-launcher-btn.svelte-z9aqcb.svelte-z9aqcb:hover{background:#1565c0}.current-version.svelte-z9aqcb.svelte-z9aqcb,.update-form.svelte-z9aqcb.svelte-z9aqcb,.versions-list.svelte-z9aqcb.svelte-z9aqcb{background:var(--card-bg);border:1px solid var(--border-color);border-radius:8px;padding:20px;margin-bottom:24px}h3.svelte-z9aqcb.svelte-z9aqcb{font-size:1.1rem;color:var(--text-color);margin-bottom:16px}.version-info.svelte-z9aqcb.svelte-z9aqcb{display:flex;align-items:center;justify-content:space-between}.version.svelte-z9aqcb.svelte-z9aqcb{font-size:1.5rem;font-weight:600;font-family:monospace;color:var(--text-color)}.rollback-btn.svelte-z9aqcb.svelte-z9aqcb{padding:8px 16px;background:var(--warning);border:none;color:white;border-radius:4px;cursor:pointer}.rollback-btn.svelte-z9aqcb.svelte-z9aqcb:hover:not(:disabled){opacity:0.9}.rollback-btn.svelte-z9aqcb.svelte-z9aqcb:disabled{opacity:0.5;cursor:not-allowed}.release-settings.svelte-z9aqcb.svelte-z9aqcb{margin-bottom:24px;padding-bottom:20px;border-bottom:1px solid var(--border-color)}.form-row.svelte-z9aqcb.svelte-z9aqcb{display:flex;gap:16px;align-items:flex-end}.form-group.svelte-z9aqcb.svelte-z9aqcb{flex:1}.form-group.svelte-z9aqcb label.svelte-z9aqcb{display:block;font-size:0.85rem;color:var(--text-color);margin-bottom:6px;font-weight:500}.form-group.svelte-z9aqcb input[type="text"].svelte-z9aqcb,.form-group.svelte-z9aqcb select.svelte-z9aqcb{width:100%;padding:8px 12px;border:1px solid var(--border-color);border-radius:4px;font-size:0.9rem;background:var(--bg-color);color:var(--text-color)}.form-group.svelte-z9aqcb input.svelte-z9aqcb:focus,.form-group.svelte-z9aqcb select.svelte-z9aqcb:focus{outline:none;border-color:var(--primary)}.helper-btn.svelte-z9aqcb.svelte-z9aqcb{padding:8px 16px;font-size:0.85rem;background:var(--primary);border:none;border-radius:4px;color:white;cursor:pointer;white-space:nowrap}.helper-btn.svelte-z9aqcb.svelte-z9aqcb:hover:not(:disabled){opacity:0.9}.helper-btn.svelte-z9aqcb.svelte-z9aqcb:disabled{opacity:0.5;cursor:not-allowed}.fill-btn.svelte-z9aqcb.svelte-z9aqcb{width:100%}.custom-release-row.svelte-z9aqcb.svelte-z9aqcb{margin-top:12px;padding-top:12px;border-top:1px dashed var(--border-color)}.release-url-display.svelte-z9aqcb.svelte-z9aqcb{margin-top:12px;padding:8px 12px;background:var(--bg-color);border-radius:4px;font-size:0.8rem;display:flex;align-items:center;gap:8px}.release-label.svelte-z9aqcb.svelte-z9aqcb{color:var(--muted-color)}.release-url-display.svelte-z9aqcb code.svelte-z9aqcb{color:var(--text-color);word-break:break-all}.categories.svelte-z9aqcb.svelte-z9aqcb{display:flex;flex-direction:column;gap:12px;margin-bottom:20px}.category-row.svelte-z9aqcb.svelte-z9aqcb{padding:12px;background:var(--bg-color);border-radius:6px;border:1px solid var(--border-color)}.category-header.svelte-z9aqcb.svelte-z9aqcb{display:flex;align-items:center;gap:8px;margin-bottom:8px}.category-label.svelte-z9aqcb.svelte-z9aqcb{font-weight:600;color:var(--text-color);font-size:0.95rem}.optional-badge.svelte-z9aqcb.svelte-z9aqcb{font-size:0.7rem;color:var(--muted-color);background:var(--border-color);padding:2px 6px;border-radius:3px}.category-controls.svelte-z9aqcb.svelte-z9aqcb{display:flex;gap:8px;align-items:center}.category-controls.svelte-z9aqcb select.svelte-z9aqcb{min-width:140px;padding:6px 10px;border:1px solid var(--border-color);border-radius:4px;font-size:0.85rem;background:var(--card-bg);color:var(--text-color)}.category-controls.svelte-z9aqcb .custom-url.svelte-z9aqcb,.category-controls.svelte-z9aqcb .url-display.svelte-z9aqcb{flex:1;padding:6px 10px;border:1px solid var(--border-color);border-radius:4px;font-size:0.8rem;font-family:monospace;background:var(--card-bg);color:var(--text-color)}.category-controls.svelte-z9aqcb .url-display.svelte-z9aqcb{background:var(--bg-color);color:var(--muted-color)}.install-btn.svelte-z9aqcb.svelte-z9aqcb{padding:6px 14px;background:var(--primary);border:none;color:white;border-radius:4px;cursor:pointer;font-size:0.8rem;min-width:70px}.install-btn.svelte-z9aqcb.svelte-z9aqcb:hover:not(:disabled){opacity:0.9}.install-btn.svelte-z9aqcb.svelte-z9aqcb:disabled{opacity:0.5;cursor:not-allowed}.update-btn.svelte-z9aqcb.svelte-z9aqcb{width:100%;padding:12px;background:var(--primary);border:none;color:white;border-radius:6px;font-size:1rem;cursor:pointer}.update-btn.svelte-z9aqcb.svelte-z9aqcb:hover:not(:disabled){background:var(--primary-hover)}.update-btn.svelte-z9aqcb.svelte-z9aqcb:disabled{opacity:0.5;cursor:not-allowed}table.svelte-z9aqcb.svelte-z9aqcb{width:100%;border-collapse:collapse}th.svelte-z9aqcb.svelte-z9aqcb,td.svelte-z9aqcb.svelte-z9aqcb{padding:10px 12px;text-align:left;border-bottom:1px solid var(--border-color)}th.svelte-z9aqcb.svelte-z9aqcb{font-size:0.85rem;color:var(--muted-color);font-weight:500}td.svelte-z9aqcb.svelte-z9aqcb{font-size:0.9rem;color:var(--text-color)}.version-cell.svelte-z9aqcb.svelte-z9aqcb{font-family:monospace}tr.current.svelte-z9aqcb.svelte-z9aqcb{background:rgba(0, 188, 212, 0.1)}.current-badge.svelte-z9aqcb.svelte-z9aqcb{background:var(--primary);color:white;padding:2px 8px;border-radius:4px;font-size:0.75rem}@media(max-width: 768px){.form-row.svelte-z9aqcb.svelte-z9aqcb{flex-direction:column;gap:12px}.category-controls.svelte-z9aqcb.svelte-z9aqcb{flex-wrap:wrap}.category-controls.svelte-z9aqcb select.svelte-z9aqcb{min-width:100%}.category-controls.svelte-z9aqcb .custom-url.svelte-z9aqcb,.category-controls.svelte-z9aqcb .url-display.svelte-z9aqcb{min-width:100%}} diff --git a/cmd/orly-launcher/web/dist/bundle.js b/cmd/orly-launcher/web/dist/bundle.js index 8aad58c..292c0f2 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 e(){}function t(e){return e()}function n(){return Object.create(null)}function r(e){e.forEach(t)}function s(e){return"function"==typeof e}function o(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function i(t,n,r){t.$$.on_destroy.push(function(t,...n){if(null==t){for(const e of n)e(void 0);return e}const r=t.subscribe(...n);return r.unsubscribe?()=>r.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 x(e,t){e.value=null==t?"":t}function E(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 q=[],U=[];let T=[];const N=[],O=Promise.resolve();let R=!1;function z(e){T.push(e)}const j=new Set;let P=0;function D(){if(0!==P)return;const e=A;do{try{for(;P{F.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),z(()=>{const n=e.$$.on_mount.map(t).filter(s);e.$$.on_destroy?e.$$.on_destroy.push(...n):r(n),e.$$.on_mount=[]}),l.forEach(z)}function Q(e,t){const n=e.$$;null!==n.fragment&&(!function(e){const t=[],n=[];T.forEach(r=>-1===e.indexOf(r)?t.push(r):n.push(r)),n.forEach(e=>e()),T=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]&&(q.push(e),R||(R=!0,O.then(D)),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),D()}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=y(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,b,m,x,E,_,$,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"),b=h("span"),m=p(A),x=g(),E=h("button"),E.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(b,"class","pubkey svelte-1bc06ax"),w(E,"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,b),c(b,m),c(f,x),c(f,E),_||($=[y(n,"click",e[5]),y(o,"click",e[6]),y(l,"click",e[7]),y(E,"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=I();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 be=class{clone(){return this._cloneInto()}};function ye(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 be{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,xe=(e,t,n)=>e&t^e&n^t&n,Ee=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)+Ee[e]+$e[e]|0,u=(pe(n,2)^pe(n,13)^pe(n,22))+xe(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=ye(()=>new ke); -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0);const Be=BigInt(1),Se=BigInt(2),Ce=e=>e instanceof Uint8Array,Ie=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Le(e){if(!Ce(e))throw new Error("Uint8Array expected");let t="";for(let n=0;ne+t.length,0));let n=0;return e.forEach(e=>{if(!Ce(e))throw new Error("Uint8Array expected");t.set(e,n),n+=e.length}),t}const Pe=e=>(Se<new Uint8Array(e),He=e=>Uint8Array.from(e);function Fe(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=De(e),s=De(e),o=0;const i=()=>{r.fill(1),s.fill(0),o=0},l=(...e)=>n(s,r,...e),a=(e=De())=>{s=l(He([0]),e),r=l(),0!==e.length&&(s=l(He([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 Ve={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=Ve[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:Pe,bytesToHex:Le,bytesToNumberBE:Te,bytesToNumberLE:Ne,concatBytes:je,createHmacDrbg:Fe,ensureBytes:ze,hexToBytes:Ue,hexToNumber:qe,numberToBytesBE:Oe,numberToBytesLE:Re,validateObject:Ke}); +var app=function(){"use strict";function e(){}function t(e){return e()}function n(){return Object.create(null)}function r(e){e.forEach(t)}function s(e){return"function"==typeof e}function o(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function i(t,n,r){t.$$.on_destroy.push(function(t,...n){if(null==t){for(const e of n)e(void 0);return e}const r=t.subscribe(...n);return r.unsubscribe?()=>r.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 y(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function v(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function w(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 q=[],z=[];let T=[];const U=[],N=Promise.resolve();let O=!1;function R(e){T.push(e)}const j=new Set;let D=0;function P(){if(0!==D)return;const e=A;do{try{for(;D{F.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),R(()=>{const n=e.$$.on_mount.map(t).filter(s);e.$$.on_destroy?e.$$.on_destroy.push(...n):r(n),e.$$.on_mount=[]}),l.forEach(R)}function Q(e,t){const n=e.$$;null!==n.fragment&&(!function(e){const t=[],n=[];T.forEach(r=>-1===e.indexOf(r)?t.push(r):n.push(r)),n.forEach(e=>e()),T=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]&&(q.push(e),O||(O=!0,N.then(P)),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),P()}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",v(n,"class","login-header-btn svelte-1bc06ax")},m(e,o){u(e,n,o),r||(s=m(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,b,y,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"),b=h("span"),y=p(A),E=g(),x=h("button"),x.textContent="Logout",v(n,"class","nav-btn svelte-1bc06ax"),k(n,"active","dashboard"===e[0]),v(o,"class","nav-btn svelte-1bc06ax"),k(o,"active","config"===e[0]),v(l,"class","nav-btn svelte-1bc06ax"),k(l,"active","update"===e[0]),v(t,"class","svelte-1bc06ax"),v(b,"class","pubkey svelte-1bc06ax"),v(x,"class","logout-btn svelte-1bc06ax"),v(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,b),c(b,y),c(f,E),c(f,x),_||($=[m(n,"click",e[5]),m(o,"click",e[6]),m(l,"click",e[7]),m(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])+"")&&w(y,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(),v(s,"class","svelte-1bc06ax"),v(r,"class","header-content svelte-1bc06ax"),v(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=I();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 be=class{clone(){return this._cloneInto()}};function me(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 ye(e=32){if(de&&"function"==typeof de.getRandomValues)return de.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}let ve=class extends be{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 ve{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))+we(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=me(()=>new ke); +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0);const Be=BigInt(1),Se=BigInt(2),Ce=e=>e instanceof Uint8Array,Ie=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Le(e){if(!Ce(e))throw new Error("Uint8Array expected");let t="";for(let n=0;ne+t.length,0));let n=0;return e.forEach(e=>{if(!Ce(e))throw new Error("Uint8Array expected");t.set(e,n),n+=e.length}),t}const De=e=>(Se<new Uint8Array(e),He=e=>Uint8Array.from(e);function Fe(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=Pe(e),s=Pe(e),o=0;const i=()=>{r.fill(1),s.fill(0),o=0},l=(...e)=>n(s,r,...e),a=(e=Pe())=>{s=l(He([0]),e),r=l(),0!==e.length&&(s=l(He([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 Ve={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=Ve[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:De,bytesToHex:Le,bytesToNumberBE:Te,bytesToNumberLE:Ue,concatBytes:je,createHmacDrbg:Fe,ensureBytes:Re,hexToBytes:ze,hexToNumber:qe,numberToBytesBE:Ne,numberToBytesLE:Oe,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(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),bt=BigInt(1);BigInt(2);const yt=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 je(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(ze("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,yt),{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,yt);let b=n.mul(r,i),y=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(b,y),w=n.sub(w,v),v=n.add(r,o);let x=n.add(i,a);return v=n.mul(v,x),x=n.add(b,m),v=n.sub(v,x),x=n.add(s,o),c=n.add(l,a),x=n.mul(x,c),c=n.add(y,m),x=n.sub(x,c),h=n.mul(p,v),c=n.mul(g,m),h=n.add(c,h),c=n.sub(y,h),h=n.add(y,h),f=n.mul(c,h),y=n.add(b,b),y=n.add(y,b),m=n.mul(p,m),v=n.mul(g,v),y=n.add(y,m),m=n.sub(b,m),m=n.mul(p,m),v=n.add(v,m),b=n.mul(y,v),f=n.add(f,b),b=n.mul(x,v),c=n.mul(w,c),c=n.sub(c,b),b=n.mul(w,y),h=n.mul(x,h),h=n.add(h,b),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===bt)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&bt&&(u=u.add(p)),c&bt&&(f=f.add(p)),p=p.double(),i>>=bt,c>>=bt;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!==bt&&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===bt)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===bt?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=je;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=Te(i);if(!(gt<(l=e)&&lLe(Oe(e,t.nByteLength));function h(e){return e>r>>bt}const p=(e,t,n)=>Te(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=ze("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(ze("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(ze("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),b=i(s*p),y=a.BASE.multiplyAndAddUnsafe(h,g,b);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}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 b={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?Te(e):Ne(e),t-We)+We;return n?Re(i,s):Oe(i,s)}(t.randomBytes(e),t.n)},precompute:(e=8,t=a.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function y(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=Te(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=Pe(t.nBitLength);function x(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:b}=s;null==f&&(f=!0),e=ze("msgHash",e),p&&(e=ze("prehashed msgHash",o(e)));const y=w(e),v=c(r),E=[x(v),x(y)];if(null!=b){const e=!0===b?u(n.BYTES):b;E.push(ze("extraEntropy",e))}const $=je(...E),k=y;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&bt),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(y(e))throw new Error("first arg must be private key");if(!y(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}=E(e,n,r),i=t;return Fe(i.hash.outputLen,i.nByteLength,i.hmac)(s,o)},verify:function(e,n,r,s=$){const o=e;if(n=ze("msgHash",n),r=ze("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,b=w(n),y=l(p),m=i(b*y),v=i(h*y),x=a.BASE.multiplyAndAddUnsafe(f,m,v)?.toAffine();return!!x&&i(x.x)===h},ProjectivePoint:a,Signature:g,utils:b}}BigInt(4);class vt extends be{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) */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),bt=BigInt(1);BigInt(2);const mt=BigInt(3);function yt(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 je(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(Re("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,mt),{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,mt);let b=n.mul(r,i),m=n.mul(s,l),y=n.mul(o,a),v=n.add(r,s),w=n.add(i,l);v=n.mul(v,w),w=n.add(b,m),v=n.sub(v,w),w=n.add(r,o);let E=n.add(i,a);return w=n.mul(w,E),E=n.add(b,y),w=n.sub(w,E),E=n.add(s,o),c=n.add(l,a),E=n.mul(E,c),c=n.add(m,y),E=n.sub(E,c),h=n.mul(p,w),c=n.mul(g,y),h=n.add(c,h),c=n.sub(m,h),h=n.add(m,h),f=n.mul(c,h),m=n.add(b,b),m=n.add(m,b),y=n.mul(p,y),w=n.mul(g,w),m=n.add(m,y),y=n.sub(b,y),y=n.mul(p,y),w=n.add(w,y),b=n.mul(m,w),f=n.add(f,b),b=n.mul(E,w),c=n.mul(v,c),c=n.sub(c,b),b=n.mul(v,m),h=n.mul(E,h),h=n.add(h,b),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===bt)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&bt&&(u=u.add(p)),c&bt&&(f=f.add(p)),p=p.double(),i>>=bt,c>>=bt;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!==bt&&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===bt)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===bt?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 vt(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}=yt({...t,toBytes(e,t,r){const s=t.toAffine(),o=n.toBytes(s.x),i=je;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=Te(i);if(!(gt<(l=e)&&lLe(Ne(e,t.nByteLength));function h(e){return e>r>>bt}const p=(e,t,n)=>Te(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=Re("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(Re("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=v(Re("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),b=i(s*p),m=a.BASE.multiplyAndAddUnsafe(h,g,b);if(!m)throw new Error("point at infinify");return m.assertValidity(),m}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new g(this.r,i(-this.s),this.recovery):this}toDERRawBytes(){return ze(this.toDERHex())}toDERHex(){return pt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return ze(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const b={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?Te(e):Ue(e),t-We)+We;return n?Oe(i,s):Ne(i,s)}(t.randomBytes(e),t.n)},precompute:(e=8,t=a.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function m(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 y=t.bits2int||function(e){const n=Te(e),r=8*e.length-t.nBitLength;return r>0?n>>BigInt(r):n},v=t.bits2int_modN||function(e){return i(y(e))},w=De(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:b}=s;null==f&&(f=!0),e=Re("msgHash",e),p&&(e=Re("prehashed msgHash",o(e)));const m=v(e),w=c(r),x=[E(w),E(m)];if(null!=b){const e=!0===b?u(n.BYTES):b;x.push(Re("extraEntropy",e))}const $=je(...x),k=m;return{seed:$,k2sig:function(e){const t=y(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*w));if(o===gt)return;let c=(r.x===s?0:2)|Number(r.y&bt),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(m(e))throw new Error("first arg must be private key");if(!m(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 Fe(i.hash.outputLen,i.nByteLength,i.hmac)(s,o)},verify:function(e,n,r,s=$){const o=e;if(n=Re("msgHash",n),r=Re("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,b=v(n),m=l(p),y=i(b*m),w=i(h*m),E=a.BASE.multiplyAndAddUnsafe(f,y,w)?.toAffine();return!!E&&i(E.x)===h},ProjectivePoint:a,Signature:g,utils:b}}BigInt(4);class wt extends be{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 wt(e,t).update(n).digest(); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -function Et(e){return{hash:e,hmac:(t,...n)=>xt(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}}xt.create=(e,t)=>new vt(e,t); +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:ye}}Et.create=(e,t)=>new wt(e,t); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const _t=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),$t=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),kt=BigInt(1),At=BigInt(2),Bt=(e,t)=>(e+t/At)/t;function St(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,b=nt(g,l,t)*g%t,y=nt(b,a,t)*b%t,m=nt(y,l,t)*g%t,w=nt(m,n,t)*u%t,v=nt(w,i,t)*p%t,x=nt(v,r,t)*c%t,E=nt(x,At,t);if(!Ct.eql(Ct.sqr(E),e))throw new Error("Cannot find square root");return E}const Ct=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:Pe(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?Re(e,o):Oe(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return n?Ne(e):Te(e)}});return Object.freeze(l)}(_t,void 0,void 0,{sqrt:St}),It=function(e,t){const n=t=>wt({...e,...Et(t)});return Object.freeze({...n(t),create:n})}({a:BigInt(0),b:BigInt(7),Fp:Ct,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),qt=e=>"bigint"==typeof e&&Lte.charCodeAt(0)));n=je(t,t),Ut[e]=n}return Ae(je(n,...t))}const Nt=e=>e.toRawBytes(!0).slice(1),Ot=e=>Oe(e,32),Rt=e=>et(e,_t),zt=e=>et(e,$t),jt=It.ProjectivePoint;function Pt(e){let t=It.utils.normPrivateKeyToScalar(e),n=jt.fromPrivateKey(t);return{scalar:n.hasEvenY()?t:zt(-t),bytes:Nt(n)}}function Dt(e){if(!qt(e))throw new Error("bad x: need 0 < x < p");const t=Rt(e*e);let n=St(Rt(t*e+BigInt(7)));n%At!==Lt&&(n=Rt(-n));const r=new jt(e,n,kt);return r.assertValidity(),r}function Ht(...e){return zt(Te(Tt("BIP0340/challenge",...e)))}function Ft(e){return Pt(e).bytes}function Vt(e,t,n=me(32)){const r=ze("message",e),{bytes:s,scalar:o}=Pt(t),i=ze("auxRand",n,32),l=Ot(o^Te(Tt("BIP0340/aux",i))),a=Tt("BIP0340/nonce",l,s,r),c=zt(Te(a));if(c===Lt)throw new Error("sign failed: k is zero");const{bytes:u,scalar:d}=Pt(c),f=Ht(u,s,r),h=new Uint8Array(64);if(h.set(u,0),h.set(Ot(zt(d+f*o)),32),!Kt(h,r,s))throw new Error("sign: Invalid signature produced");return h}function Kt(e,t,n){const r=ze("signature",e,64),s=ze("message",t),o=ze("publicKey",n,32);try{const e=Dt(Te(o)),t=Te(r.subarray(0,32));if(!qt(t))return!1;const n=Te(r.subarray(32,64));if(!("bigint"==typeof(c=n)&&Lt({getPublicKey:Ft,sign:Vt,verify:Kt,utils:{randomPrivateKey:It.utils.randomPrivateKey,lift_x:Dt,pointToBytes:Nt,numberToBytesBE:Oe,bytesToNumberBE:Te,taggedHash:Tt,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;t(e+t/At)/t;function St(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,b=nt(g,l,t)*g%t,m=nt(b,a,t)*b%t,y=nt(m,l,t)*g%t,v=nt(y,n,t)*u%t,w=nt(v,i,t)*p%t,E=nt(w,r,t)*c%t,x=nt(E,At,t);if(!Ct.eql(Ct.sqr(x),e))throw new Error("Cannot find square root");return x}const Ct=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:De(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?Oe(e,o):Ne(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return n?Ue(e):Te(e)}});return Object.freeze(l)}(_t,void 0,void 0,{sqrt:St}),It=function(e,t){const n=t=>vt({...e,...xt(t)});return Object.freeze({...n(t),create:n})}({a:BigInt(0),b:BigInt(7),Fp:Ct,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),qt=e=>"bigint"==typeof e&&Lte.charCodeAt(0)));n=je(t,t),zt[e]=n}return Ae(je(n,...t))}const Ut=e=>e.toRawBytes(!0).slice(1),Nt=e=>Ne(e,32),Ot=e=>et(e,_t),Rt=e=>et(e,$t),jt=It.ProjectivePoint;function Dt(e){let t=It.utils.normPrivateKeyToScalar(e),n=jt.fromPrivateKey(t);return{scalar:n.hasEvenY()?t:Rt(-t),bytes:Ut(n)}}function Pt(e){if(!qt(e))throw new Error("bad x: need 0 < x < p");const t=Ot(e*e);let n=St(Ot(t*e+BigInt(7)));n%At!==Lt&&(n=Ot(-n));const r=new jt(e,n,kt);return r.assertValidity(),r}function Ht(...e){return Rt(Te(Tt("BIP0340/challenge",...e)))}function Ft(e){return Dt(e).bytes}function Vt(e,t,n=ye(32)){const r=Re("message",e),{bytes:s,scalar:o}=Dt(t),i=Re("auxRand",n,32),l=Nt(o^Te(Tt("BIP0340/aux",i))),a=Tt("BIP0340/nonce",l,s,r),c=Rt(Te(a));if(c===Lt)throw new Error("sign failed: k is zero");const{bytes:u,scalar:d}=Dt(c),f=Ht(u,s,r),h=new Uint8Array(64);if(h.set(u,0),h.set(Nt(Rt(d+f*o)),32),!Kt(h,r,s))throw new Error("sign: Invalid signature produced");return h}function Kt(e,t,n){const r=Re("signature",e,64),s=Re("message",t),o=Re("publicKey",n,32);try{const e=Pt(Te(o)),t=Te(r.subarray(0,32));if(!qt(t))return!1;const n=Te(r.subarray(32,64));if(!("bigint"==typeof(c=n)&&Lt({getPublicKey:Ft,sign:Vt,verify:Kt,utils:{randomPrivateKey:It.utils.randomPrivateKey,lift_x:Pt,pointToBytes:Ut,numberToBytesBE:Ne,bytesToNumberBE:Te,taggedHash:Tt,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=>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(En(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(En(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 Sn(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(En(e),e<0||e>=t)throw new Error(`Wrong integer: ${e}`)});;){let e=0,i=!0;for(let s=r;st?Cn(t,e%t):e,In=(e,t)=>e+(t-Cn(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(In(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${In(t,n)}`);let s=0,o=0;const i=2**n-1,l=[];for(const r of e){if(En(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 qn(e,t=!1){if(En(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(In(8,e)>32||In(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 Tn=_n(qn(4),$n("0123456789ABCDEF"),kn("")),Nn=_n(qn(5),$n("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),An(5),kn(""));_n(qn(5),$n("0123456789ABCDEFGHIJKLMNOPQRSTUV"),An(5),kn("")),_n(qn(5),$n("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),kn(""),Bn(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));const On=_n(qn(6),$n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),An(6),kn("")),Rn=_n(qn(6),$n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),An(6),kn("")),zn=e=>{return _n((En(t=58),{encode:e=>{if(!(e instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return Sn(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(Sn(e,t,256))}}),$n(e),kn(""));var t},jn=zn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");zn("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),zn("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const Pn=[0,2,3,5,6,7,9,10,11],Dn={encode(e){let t="";for(let n=0;n>25;let n=(33554431&e)<<5;for(let e=0;e>e&1)&&(n^=Fn[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=Vn(s)^n>>5}s=Vn(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=Hn.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${Hn.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(qn(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:Tn,base32:Nn,base64:On,base64url:Rn,base58:jn,base58xmr:Dn};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=>xn(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),br=ur(null),yr=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 xr(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()}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 _r(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 kr(t){let n,r,s,o,i,l,a,f,b,y,m,x,_,$,k,A,B,S,C,I,L,q,U=Br(t[0].status)+"",T=t[0].name+"",N=t[0].status+"",O=t[0].binary+"",R=t[0].pid>0&&_r(t),z=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(T),f=g(),b=h("div"),y=h("div"),m=h("span"),m.textContent="Status:",x=g(),_=h("span"),$=p(N),k=g(),R&&R.c(),A=g(),B=h("div"),S=h("span"),S.textContent="Binary:",C=g(),I=h("span"),L=p(O),q=g(),z&&z.c(),w(s,"class","status-indicator svelte-xh5u5u"),E(s,"color",Ar(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"),E(_,"color",Ar(t[0].status)),w(y,"class","detail-row svelte-xh5u5u"),w(S,"class","label svelte-xh5u5u"),w(I,"class","value binary svelte-xh5u5u"),w(B,"class","detail-row svelte-xh5u5u"),w(b,"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,b),c(b,y),c(y,m),c(y,x),c(y,_),c(_,$),c(b,k),R&&R.m(b,null),c(b,A),c(b,B),c(B,S),c(B,C),c(B,I),c(I,L),c(b,q),z&&z.m(b,null)},p(e,[t]){1&t&&U!==(U=Br(e[0].status)+"")&&v(o,U),1&t&&E(s,"color",Ar(e[0].status)),1&t&&T!==(T=e[0].name+"")&&v(a,T),1&t&&N!==(N=e[0].status+"")&&v($,N),1&t&&E(_,"color",Ar(e[0].status)),e[0].pid>0?R?R.p(e,t):(R=_r(e),R.c(),R.m(b,A)):R&&(R.d(1),R=null),1&t&&O!==(O=e[0].binary+"")&&v(L,O),e[0].restarts>0?z?z.p(e,t):(z=$r(e),z.c(),z.m(b,null)):z&&(z.d(1),z=null)},i:e,o:e,d(e){e&&d(n),R&&R.d(),z&&z.d()}}}function Ar(e){switch(e){case"running":return"var(--success)";case"stopped":default:return"var(--muted-color)";case"crashed":return"var(--error)"}}function Br(e){switch(e){case"running":return"●";case"stopped":return"○";case"crashed":return"✗";default:return"?"}}function Sr(e,t,n){let{process:r}=t;return e.$$set=e=>{"process"in e&&n(0,r=e.process)},[r]}class Cr extends te{constructor(e){super(),ee(this,e,Sr,kr,o,{process:0})}}function Ir(e,t,n){const r=e.slice();return r[10]=t[n],r}function Lr(e){let t,n,r,s;return{c(){t=h("button"),n=p("Start Services"),w(t,"class","start-btn svelte-ehjgxg"),t.disabled=e[0]},m(o,i){u(o,t,i),c(t,n),r||(s=y(t,"click",e[5]),r=!0)},p(e,n){1&n&&(t.disabled=e[0])},d(e){e&&d(t),r=!1,s()}}}function qr(e){let t,n,s,o,i,l,a;return{c(){t=h("button"),n=p("Stop Services"),s=g(),o=h("button"),i=p("Restart All"),w(t,"class","stop-btn svelte-ehjgxg"),t.disabled=e[0],w(o,"class","restart-btn svelte-ehjgxg"),o.disabled=e[0]},m(r,d){u(r,t,d),c(t,n),u(r,s,d),u(r,o,d),c(o,i),l||(a=[y(t,"click",e[6]),y(o,"click",e[4])],l=!0)},p(e,n){1&n&&(t.disabled=e[0]),1&n&&(o.disabled=e[0])},d(e){e&&(d(t),d(s),d(o)),l=!1,r(a)}}}function Ur(e){let t,n;return{c(){t=h("div"),n=p(e[1]),w(t,"class","error-banner svelte-ehjgxg")},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 Tr(t){let n;return{c(){n=h("div"),n.textContent="Loading status...",w(n,"class","loading svelte-ehjgxg")},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,b,y,m,x,E,_,$,A,B,S,C,I,L,q,U,T,N,O,R,z,j,P=e[2].services_running?"Running":"Stopped",D=(e[2].version||"unknown")+"",H=e[2].uptime+"",F=(e[2].processes?.length||0)+"",V=G(e[2].processes||[]),Y=[];for(let t=0;tW(Y[e],1,1,()=>{Y[e]=null});return{c(){t=h("div"),n=h("div"),r=h("span"),r.textContent="Status",s=g(),o=h("span"),i=p(P),l=g(),a=h("div"),b=h("span"),b.textContent="Version",y=g(),m=h("span"),x=p(D),E=g(),_=h("div"),$=h("span"),$.textContent="Uptime",A=g(),B=h("span"),S=p(H),C=g(),I=h("div"),L=h("span"),L.textContent="Processes",q=g(),U=h("span"),T=p(F),N=g(),O=h("h3"),O.textContent="Managed Processes",R=g(),z=h("div");for(let e=0;e{C[r]=null}),M()),~m?(v=C[m],v?v.p(e,n):(v=C[m]=S[m](e),v.c()),Z(v,1),v.m(t,null)):v=null)},i(e){x||(Z(v),x=!0)},o(e){W(v),x=!1},d(e){e&&d(t),A.d(),B&&B.d(),~m&&C[m].d(),E=!1,_()}}}function zr(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(8,o=e)),i(e,hr,e=>n(9,a=e)),i(e,gr,e=>n(2,c=e)),C(async()=>{await f(),u=setInterval(f,5e3)}),d=()=>{u&&clearInterval(u)},S().$$.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)}}},async function(){l(mr,r=!0,r);try{await async function(e,t){const n=await vr("/api/start-services",{method:"POST"},e,t);if(!n.ok){const e=await n.json().catch(()=>({}));throw new Error(e.message||`Start failed: ${n.statusText}`)}return n.json()}(a,o),setTimeout(f,2e3)}catch(e){l(wr,s=e.message,s)}finally{l(mr,r=!1,r)}},async function(){if(confirm("Are you sure you want to stop all services?")){l(mr,r=!0,r);try{await async function(e,t){const n=await vr("/api/stop-services",{method:"POST"},e,t);if(!n.ok){const e=await n.json().catch(()=>({}));throw new Error(e.message||`Stop failed: ${n.statusText}`)}return n.json()}(a,o),setTimeout(f,2e3)}catch(e){l(wr,s=e.message,s)}finally{l(mr,r=!1,r)}}}]}class jr extends te{constructor(e){super(),ee(this,e,zr,Rr,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=[y(t,"click",e[8]),y(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 Hr(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=[y(t,"click",e[10]),y(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 Fr(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 Vr(e){let t,n,r,s=e[3]&&e[2].includes("Restart required"),o=s&&Kr(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=Kr(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 Kr(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=y(n,"click",t[12]),r=!0)},p:e,d(e){e&&d(n),r=!1,s()}}}function Mr(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,y,m,v,x,E,_,$,k,A,B,S,C,I,L,q,U,T,N,O,R,z,j,P,D,H,F,V,K,M,Z,W,Y,J,Q,X,ee,te,ne,re,se,oe,ie,le,ae,ce,ue,de,fe,he,pe,ge,be,ye,me,we,ve,xe,Ee,_e,$e,ke,Ae,Be,Se,Ce,Ie,Le,qe,Ue,Te,Ne,Oe,Re,ze,je,Pe,De,He,Fe,Ve;function Ke(e,t){return e[0]?Gr:Wr}let Me=Ke(e),Ze=Me(e);function We(e,t){return e[0]?Jr:Yr}let Ge=We(e),Ye=Ge(e);function Je(e,t){return e[0]?Xr:Qr}let Qe=Je(e),Xe=Qe(e);function et(e,t){return e[0]?ts:es}let tt=et(e),nt=tt(e);function rt(e,t){return e[0]?rs:ns}let st=rt(e),ot=st(e);function it(e,t){return e[0]?os:ss}let lt=it(e),at=lt(e);function ct(e,t){return e[0]?ls:is}let ut=ct(e),dt=ut(e);function ft(e,t){return e[0]?cs:as}let ht=ft(e),pt=ht(e);function gt(e,t){return e[0]?ds:us}let bt=gt(e),yt=bt(e);function mt(e,t){return e[0]?hs:fs}let wt=mt(e),vt=wt(e);function xt(e,t){return e[0]?gs:ps}let Et=xt(e),_t=Et(e);function $t(e,t){return e[0]?ys:bs}let kt=$t(e),At=kt(e);function Bt(e,t){return e[0]?ws:ms}let St=Bt(e),Ct=St(e);function It(e,t){return e[0]?xs:vs}let Lt=It(e),qt=Lt(e);function Ut(e,t){return e[0]?_s:Es}let Tt=Ut(e),Nt=Tt(e),Ot=e[0]&&$s(e),Rt=G((e[0]?e[1].admin_owners:e[5].admin_owners)||[]),zt=[];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=y(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 Yr(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 Jr(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),x(t,e[1].db_binary),n||(r=y(t,"input",e[16]),n=!0)},p(e,n){2&n[0]&&t.value!==e[1].db_binary&&x(t,e[1].db_binary)},d(e){e&&d(t),n=!1,r()}}}function Qr(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 Xr(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),x(t,e[1].db_listen),n||(r=y(t,"input",e[17]),n=!0)},p(e,n){2&n[0]&&t.value!==e[1].db_listen&&x(t,e[1].db_listen)},d(e){e&&d(t),n=!1,r()}}}function es(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 ts(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),x(t,e[1].data_dir),n||(r=y(t,"input",e[18]),n=!0)},p(e,n){2&n[0]&&t.value!==e[1].data_dir&&x(t,e[1].data_dir)},d(e){e&&d(t),n=!1,r()}}}function ns(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 rs(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=y(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 ss(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 os(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",x(n,n.__value),r.__value="managed",x(r,r.__value),s.__value="curation",x(s,s.__value),w(t,"class","svelte-my2rpu"),void 0===e[1].acl_mode&&z(()=>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=y(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 is(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 ls(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),x(t,e[1].acl_binary),n||(r=y(t,"input",e[21]),n=!0)},p(e,n){2&n[0]&&t.value!==e[1].acl_binary&&x(t,e[1].acl_binary)},d(e){e&&d(t),n=!1,r()}}}function as(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 cs(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),x(t,e[1].acl_listen),n||(r=y(t,"input",e[22]),n=!0)},p(e,n){2&n[0]&&t.value!==e[1].acl_listen&&x(t,e[1].acl_listen)},d(e){e&&d(t),n=!1,r()}}}function us(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 ds(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),x(t,e[1].relay_binary),n||(r=y(t,"input",e[23]),n=!0)},p(e,n){2&n[0]&&t.value!==e[1].relay_binary&&x(t,e[1].relay_binary)},d(e){e&&d(t),n=!1,r()}}}function fs(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 hs(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",x(n,n.__value),r.__value="debug",x(r,r.__value),s.__value="info",x(s,s.__value),o.__value="warn",x(o,o.__value),i.__value="error",x(i,i.__value),w(t,"class","svelte-my2rpu"),void 0===e[1].log_level&&z(()=>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=y(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 ps(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 gs(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=y(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 bs(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 ys(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=y(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 ms(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 ws(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=y(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 vs(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 xs(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=y(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 Es(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 _s(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),x(t,e[1].bin_dir),n||(r=y(t,"input",e[29]),n=!0)},p(e,n){2&n[0]&&t.value!==e[1].bin_dir&&x(t,e[1].bin_dir)},d(e){e&&d(t),n=!1,r()}}}function $s(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=y(n,"click",t[13]),r=!0)},p:e,d(e){e&&d(n),r=!1,s()}}}function ks(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 As(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=y(t,"click",s),n=!0)},p(t,n){e=t},d(e){e&&d(t),n=!1,r()}}}function Bs(e){let t,n,r,s,o,i=e[33]+"",l=e[0]&&As(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=As(e),l.c(),l.m(t,o)):l&&(l.d(1),l=null)},d(e){e&&d(t),l&&l.d()}}}function Ss(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 Cs(t){let n,r,s,o,i,l,a,f;function p(e,t){return e[0]?Hr:Dr}let b=p(t),y=b(t),m=t[7]&&Fr(t),v=t[2]&&Vr(t);function x(e,t){return e[5]?Zr:e[7]?void 0:Mr}let E=x(t),_=E&&E(t);return{c(){n=h("div"),r=h("div"),s=h("h2"),s.textContent="Configuration",o=g(),i=h("div"),y.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),y.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){b===(b=p(e))&&y?y.p(e,t):(y.d(1),y=b(e),y&&(y.c(),y.m(i,null))),e[7]?m?m.p(e,t):(m=Fr(e),m.c(),m.m(n,a)):m&&(m.d(1),m=null),e[2]?v?v.p(e,t):(v=Vr(e),v.c(),v.m(n,f)):v&&(v.d(1),v=null),E===(E=x(e))&&_?_.p(e,t):(_&&_.d(1),_=E&&E(e),_&&(_.c(),_.m(n,null)))},i:e,o:e,d(e){e&&d(n),y.d(),m&&m.d(),v&&v.d(),_&&_.d()}}}function Is(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,br,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(br,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 b(e){n(1,d.admin_owners=d.admin_owners.filter((t,n)=>n!==e),d)}C(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(br,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.")},b,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=>b(e)]}class Ls extends te{constructor(e){super(),ee(this,e,Is,Cs,o,{},null,[-1,-1])}}function qs(e,t,n){const r=e.slice();return r[37]=t[n],r}function Us(e,t,n){const r=e.slice();return r[40]=t[n][0],r[41]=t[n][1],r[42]=t,r[43]=n,r}function Ts(e,t,n){const r=e.slice();return r[44]=t[n],r}function Ns(e,t,n){const r=e.slice();return r[47]=t[n],r}function Os(e){let t,n;return{c(){t=h("div"),n=p(e[10]),w(t,"class","error-banner svelte-z9aqcb")},m(e,r){u(e,t,r),c(t,n)},p(e,t){1024&t[0]&&v(n,e[10])},d(e){e&&d(t)}}}function Rs(e){let t,n,r,s,o=e[3].message+"",i=e[3].downloaded_files?.length&&zs(e),l=e[5]&&js(e);return{c(){t=h("div"),n=p(o),r=g(),i&&i.c(),s=g(),l&&l.c(),w(t,"class","success-banner svelte-z9aqcb")},m(e,o){u(e,t,o),c(t,n),c(t,r),i&&i.m(t,null),c(t,s),l&&l.m(t,null)},p(e,r){8&r[0]&&o!==(o=e[3].message+"")&&v(n,o),e[3].downloaded_files?.length?i?i.p(e,r):(i=zs(e),i.c(),i.m(t,s)):i&&(i.d(1),i=null),e[5]?l?l.p(e,r):(l=js(e),l.c(),l.m(t,null)):l&&(l.d(1),l=null)},d(e){e&&d(t),i&&i.d(),l&&l.d()}}}function zs(e){let t,n,r,s=e[3].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){8&t[0]&&s!==(s=e[3].downloaded_files.join(", ")+"")&&v(r,s)},d(e){e&&(d(t),d(n),d(r))}}}function js(t){let n,r,s,o,i,l;return{c(){n=h("div"),r=h("strong"),r.textContent="Launcher was updated!",s=g(),o=h("button"),o.textContent="Restart Launcher Now",w(o,"class","restart-launcher-btn svelte-z9aqcb"),w(n,"class","launcher-restart svelte-z9aqcb")},m(e,a){u(e,n,a),c(n,r),c(n,s),c(n,o),i||(l=y(o,"click",t[20]),i=!0)},p:e,d(e){e&&d(n),i=!1,l()}}}function Ps(e){let t,n,r,s,o,i=e[47].tag+"",l=e[47].message?` - ${e[47].message.slice(0,40)}`:"";return{c(){t=h("option"),n=p(i),r=p(l),s=g(),t.__value=o=e[47].tag,x(t,t.__value)},m(e,o){u(e,t,o),c(t,n),c(t,r),c(t,s)},p(e,s){64&s[0]&&i!==(i=e[47].tag+"")&&v(n,i),64&s[0]&&l!==(l=e[47].message?` - ${e[47].message.slice(0,40)}`:"")&&v(r,l),64&s[0]&&o!==(o=e[47].tag)&&(t.__value=o,x(t,t.__value))},d(e){e&&d(t)}}}function Ds(e){let t,n,r,s,o;return{c(){t=h("div"),n=h("span"),n.textContent="Release:",r=g(),s=h("code"),o=p(e[2]),w(n,"class","release-label svelte-z9aqcb"),w(s,"class","svelte-z9aqcb"),w(t,"class","release-url-display svelte-z9aqcb")},m(e,i){u(e,t,i),c(t,n),c(t,r),c(t,s),c(s,o)},p(e,t){4&t[0]&&v(o,e[2])},d(e){e&&d(t)}}}function Hs(t){let n,r,s=t[44].label+"";return{c(){n=h("option"),r=p(s),n.__value=t[44].value,x(n,n.__value)},m(e,t){u(e,n,t),c(n,r)},p:e,d(e){e&&d(n)}}}function Fs(e){let t,n;return{c(){t=h("input"),w(t,"type","text"),w(t,"class","url-display svelte-z9aqcb"),t.value=n=e[9][e[40]].url,t.readOnly=!0,w(t,"placeholder","Set release URL above")},m(e,n){u(e,t,n)},p(e,r){4608&r[0]&&n!==(n=e[9][e[40]].url)&&t.value!==n&&(t.value=n)},d(e){e&&d(t)}}}function Vs(e){let t,n,s,o;function i(){e[26].call(t,e[40])}function l(){return e[27](e[40])}return{c(){t=h("input"),w(t,"type","text"),w(t,"class","custom-url svelte-z9aqcb"),w(t,"placeholder","https://... (custom binary URL)"),t.disabled=n=e[4]||e[9][e[40]].installing},m(n,r){u(n,t,r),x(t,e[9][e[40]].customUrl),s||(o=[y(t,"input",i),y(t,"input",l)],s=!0)},p(r,s){e=r,4624&s[0]&&n!==(n=e[4]||e[9][e[40]].installing)&&(t.disabled=n),4608&s[0]&&t.value!==e[9][e[40]].customUrl&&x(t,e[9][e[40]].customUrl)},d(e){e&&d(t),s=!1,r(o)}}}function Ks(e){let t,n,r,s;function o(e,t){return e[9][e[40]].installing?Ws:e[9][e[40]].installed?Zs:Ms}let i=o(e),l=i(e);function a(){return e[28](e[40])}return{c(){t=h("button"),l.c(),w(t,"class","install-btn svelte-z9aqcb"),t.disabled=n=e[4]||e[9][e[40]].installing||!e[16](e[40]),w(t,"title","Download and install this component")},m(e,n){u(e,t,n),l.m(t,null),r||(s=y(t,"click",a),r=!0)},p(r,s){i!==(i=o(e=r))&&(l.d(1),l=i(e),l&&(l.c(),l.m(t,null))),4624&s[0]&&n!==(n=e[4]||e[9][e[40]].installing||!e[16](e[40]))&&(t.disabled=n)},d(e){e&&d(t),l.d(),r=!1,s()}}}function Ms(e){let t;return{c(){t=p("Install")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Zs(e){let t;return{c(){t=p("Done")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Ws(e){let t;return{c(){t=p("...")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function Gs(e){let t,n,s,o,i,l,a,p,b,m,v,x,E,$=!e[41].required&&function(){let e;return{c(){e=h("span"),e.textContent="optional",w(e,"class","optional-badge svelte-z9aqcb")},m(t,n){u(t,e,n)},d(t){t&&d(e)}}}(),k=G(e[41].options),A=[];for(let t=0;tVersion Installed Binaries Status',i=g(),l=h("tbody");for(let e=0;eUpdate Binaries',o=g(),_e&&_e.c(),i=g(),$e&&$e.c(),l=g(),a=h("div"),b=h("h3"),b.textContent="Current Version",m=g(),E=h("div"),$=h("span"),k=p(ve),A=g(),B=h("button"),S=p("Rollback"),I=g(),L=h("div"),q=h("h3"),q.textContent="Install New Version",U=g(),T=h("div"),N=h("div"),O=h("div"),R=h("label"),R.textContent="Official Release",j=g(),P=h("select"),D=h("option"),H=p(xe),F=g();for(let e=0;et[21].call(P)),w(O,"class","form-group svelte-z9aqcb"),w(Z,"for","arch"),w(Z,"class","svelte-z9aqcb"),J.__value="amd64",x(J,J.__value),Q.__value="arm64",x(Q,Q.__value),w(Y,"id","arch"),Y.disabled=t[4],w(Y,"class","svelte-z9aqcb"),void 0===t[1]&&z(()=>t[22].call(Y)),w(M,"class","form-group svelte-z9aqcb"),w(N,"class","form-row svelte-z9aqcb"),w(ne,"for","version"),w(ne,"class","svelte-z9aqcb"),w(se,"type","text"),w(se,"id","version"),w(se,"placeholder","v0.56.1"),se.disabled=t[4],w(se,"class","svelte-z9aqcb"),w(te,"class","form-group svelte-z9aqcb"),w(le,"class","svelte-z9aqcb"),w(ce,"class","helper-btn fill-btn svelte-z9aqcb"),ce.disabled=t[4],w(ie,"class","form-group svelte-z9aqcb"),w(ee,"class","form-row custom-release-row svelte-z9aqcb"),w(T,"class","release-settings svelte-z9aqcb"),w(he,"class","categories svelte-z9aqcb"),w(ge,"class","update-btn svelte-z9aqcb"),ge.disabled=t[4],w(L,"class","update-form svelte-z9aqcb"),w(n,"class","update-page svelte-z9aqcb")},m(e,r){u(e,n,r),c(n,s),c(n,o),_e&&_e.m(n,null),c(n,i),$e&&$e.m(n,null),c(n,l),c(n,a),c(a,b),c(a,m),c(a,E),c(E,$),c($,k),c(E,A),c(E,B),c(B,S),c(n,I),c(n,L),c(L,q),c(L,U),c(L,T),c(T,N),c(N,O),c(O,R),c(O,j),c(O,P),c(P,D),c(D,H),c(D,F);for(let e=0;en(10,r=e)),i(e,fr,e=>n(29,s=e)),i(e,hr,e=>n(30,o=e)),i(e,mr,e=>n(31,a=e)),i(e,yr,e=>n(11,c=e));let u="",d="",f="amd64",h=null,p=!1,g=!1,b=[],y="",m=!1;const w={launcher:{label:"Launcher",options:[{value:"orly-launcher",label:"orly-launcher"},{value:"custom",label:"Custom"}],required:!0},relay:{label:"Relay",options:[{value:"orly",label:"orly"},{value:"custom",label:"Custom"}],required:!0},database:{label:"Database",options:[{value:"orly-db-badger",label:"Badger"},{value:"orly-db-neo4j",label:"Neo4j"},{value:"custom",label:"Custom"}],required:!0},acl:{label:"ACL",options:[{value:"none",label:"None (disabled)"},{value:"orly-acl-follows",label:"Follows"},{value:"orly-acl-managed",label:"Managed"},{value:"orly-acl-curation",label:"Curation"},{value:"custom",label:"Custom"}],required:!1},sync:{label:"Sync",options:[{value:"none",label:"None (disabled)"},{value:"orly-sync-negentropy",label:"Negentropy"},{value:"custom",label:"Custom"}],required:!1}};let v={launcher:{selected:"orly-launcher",customUrl:"",url:"",installing:!1,installed:!1},relay:{selected:"orly",customUrl:"",url:"",installing:!1,installed:!1},database:{selected:"orly-db-badger",customUrl:"",url:"",installing:!1,installed:!1},acl:{selected:"none",customUrl:"",url:"",installing:!1,installed:!1},sync:{selected:"none",customUrl:"",url:"",installing:!1,installed:!1}};async function x(){l(mr,a=!0,a);try{l(yr,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)}}function E(e){if(!d||!u)return"";const t=u.replace(/^v/,"");return`${d}/${e}-${t}-linux-${f}`}function _(){for(const e of Object.keys(v)){const t=v[e];"none"!==t.selected&&"custom"!==t.selected?t.url=E(t.selected):"custom"===t.selected?t.url=t.customUrl:t.url=""}n(9,v)}function k(e){_()}function A(e){const t=v[e];if("custom"===t.selected){const n=t.customUrl.split("/");return n[n.length-1].replace(/-[\d.]+-linux-(amd64|arm64)$/,"")||e}return t.selected}function B(e){const t=v[e];return"custom"===t.selected?t.customUrl:t.url}async function S(e){const t=v[e],i=B(e);if(i.trim())if(u.trim()){t.installing=!0,n(9,v),l(wr,r="",r);try{const r=A(e),l={[r]:i.trim()},a=await xr(o,s,u.trim(),l);if(a.success){if(t.installed=!0,"launcher"===e)n(5,g=!0),n(3,h={success:!0,message:`Downloaded ${r}. Click 'Restart Launcher' to apply.`,downloaded_files:a.downloaded_files});else{n(3,h={success:!0,message:`Downloaded ${r}, restarting service...`,downloaded_files:a.downloaded_files});try{await async function(e,t,n){const r=await vr("/api/restart-service",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:n})},e,t);if(!r.ok){const e=await r.json().catch(()=>({}));throw new Error(e.message||`Restart failed: ${r.statusText}`)}return r.json()}(o,s,r),n(3,h={success:!0,message:`${r} installed and restart initiated`,downloaded_files:a.downloaded_files})}catch(e){n(3,h={success:!0,message:`Downloaded ${r}, but restart failed: ${e.message}`,downloaded_files:a.downloaded_files})}}await x()}}catch(t){l(wr,r=`Failed to install ${w[e].label}: ${t.message}`,r)}finally{t.installing=!1,n(9,v)}}else l(wr,r="Version is required",r);else l(wr,r=`URL is required for ${w[e].label}`,r)}C(async()=>{await x(),await async function(){n(8,m=!0);try{const e=await async function(e,t){const n=await vr("/api/releases",{},e,t);if(!n.ok)throw new Error(`Failed to fetch releases: ${n.statusText}`);return n.json()}(o,s);e.releases&&n(6,b=e.releases.map(e=>({tag:e.tag,message:e.message||""})))}catch(e){console.error("Failed to fetch releases:",e)}finally{n(8,m=!1)}}()});return e.$$.update=()=>{3&e.$$.dirty[0]&&(f||u)&&_()},[u,f,d,h,p,g,b,y,m,v,r,c,w,function(){y&&(n(0,u=y),n(2,d=`https://git.nostrdev.com/mleku/next.orly.dev/releases/download/${y}`),_())},k,function(){let e=prompt("Enter release URL (e.g., https://git.mleku.dev/mleku/next.orly.dev/releases/tag/v0.56.1):");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/")){t=t+"/releases/download/"+(u.trim()||"v0.56.1")}const r=t.split("/"),s=r[r.length-1];n(2,d=t),u||n(0,u=s),_()},B,S,async function(){const e={};let t=!1;for(const n of Object.keys(v)){if("none"!==v[n].selected){const r=B(n);if(r.trim()){e[A(n)]=r.trim(),"launcher"===n&&(t=!0)}}}if(u.trim())if(0!==Object.keys(e).length){n(4,p=!0),n(3,h=null),n(5,g=!1),l(wr,r="",r);try{n(3,h=await xr(o,s,u.trim(),e)),await x(),t&&h.success&&n(5,g=!0)}catch(e){l(wr,r=e.message,r)}finally{n(4,p=!1)}}else l(wr,r="No binaries selected for installation",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(4,p=!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(3,h={success:!0,message:`Rolled back from ${e.previous_version} to ${e.current_version}. Restart services to apply.`}),await x()}catch(e){l(wr,r=e.message,r)}finally{n(4,p=!1)}}},async function(){if(confirm("Restart the launcher? This will briefly disconnect you."))try{await Er(o,s),n(3,h={success:!0,message:"Launcher restart initiated. The page will reconnect automatically..."}),setTimeout(()=>{window.location.reload()},5e3)}catch(e){l(wr,r=e.message,r)}},function(){y=$(this),n(7,y),n(6,b)},function(){f=$(this),n(1,f)},function(){u=this.value,n(0,u)},function(e){v[e].selected=$(this),n(9,v),n(12,w)},e=>k(),function(e){v[e].customUrl=this.value,n(9,v),n(12,w)},e=>{n(9,v[e].url=v[e].customUrl,v)},e=>S(e)]}class to extends te{constructor(e){super(),ee(this,e,eo,Xs,o,{},null,[-1,-1])}}function no(t){let n,r;return n=new to({}),{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 ro(t){let n,r;return n=new Ls({}),{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 so(t){let n,r;return n=new jr({}),{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 oo(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=y(l,"click",t[10]),a=!0)},p:e,i:e,o:e,d(e){e&&d(n),a=!1,f()}}}function io(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 b=[oo,so,ro,no],y=[];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=y[o]=b[o](e));let x={isDarkTheme:e[2]};return void 0!==e[1]&&(x.showModal=e[1]),a=new ar({props:x}),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&&y[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&&y[o].p(e,r):(i&&(K(),W(y[c],1,1,()=>{y[c]=null}),M()),~o?(i=y[o],i?i.p(e,r):(i=y[o]=b[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,N.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&&y[o].d(),Q(a)}}}function lo(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)}C(()=>{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,lo,io,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 Sn(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?Cn(t,e%t):e,In=(e,t)=>e+(t-Cn(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(In(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${In(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 qn(e,t=!1){if(xn(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(In(8,e)>32||In(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 zn(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 Tn=_n(qn(4),$n("0123456789ABCDEF"),kn("")),Un=_n(qn(5),$n("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),An(5),kn(""));_n(qn(5),$n("0123456789ABCDEFGHIJKLMNOPQRSTUV"),An(5),kn("")),_n(qn(5),$n("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),kn(""),Bn(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));const Nn=_n(qn(6),$n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),An(6),kn("")),On=_n(qn(6),$n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),An(6),kn("")),Rn=e=>{return _n((xn(t=58),{encode:e=>{if(!(e instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return Sn(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(Sn(e,t,256))}}),$n(e),kn(""));var t},jn=Rn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");Rn("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),Rn("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const Dn=[0,2,3,5,6,7,9,10,11],Pn={encode(e){let t="";for(let n=0;n>25;let n=(33554431&e)<<5;for(let e=0;e>e&1)&&(n^=Fn[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=Vn(s)^n>>5}s=Vn(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=Hn.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${Hn.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:zn(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(qn(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:Tn,base32:Un,base64:Nn,base64url:On,base58:jn,base58xmr:Pn};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=wn(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=vn(),t=Qn("nsec",e),r=Jn(wn(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),br=ur(null),mr=ur(null),yr=ur(!1),vr=ur("");async function wr(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,n){const r=await wr("/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()}async function xr(e,t,n,r){const s=await wr("/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()}async function _r(e,t){const n=await wr("/api/restart",{method:"POST"},e,t);if(!n.ok)throw new Error(`Restart failed: ${n.statusText}`);return n.json()}async function $r(e,t,n){const r=await wr("/api/restart-service",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:n})},e,t);if(!r.ok){const e=await r.json().catch(()=>({}));throw new Error(e.message||`Restart failed: ${r.statusText}`)}return r.json()}function kr(t){let n;return{c(){n=h("span"),n.textContent="always on",v(n,"class","badge required-badge svelte-1lnumzb")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Ar(e){let t,n,r,s,o,i,l,a,f;return{c(){t=h("label"),n=h("input"),o=g(),i=h("span"),v(n,"type","checkbox"),n.checked=r=e[0].enabled,n.disabled=s=e[1]||"running"===e[0].status,v(n,"class","svelte-1lnumzb"),v(i,"class","toggle-slider svelte-1lnumzb"),v(t,"class","enable-toggle svelte-1lnumzb"),v(t,"title",l=e[0].enabled?"Disable":"Enable")},m(r,s){u(r,t,s),c(t,n),c(t,o),c(t,i),a||(f=m(n,"change",e[10]),a=!0)},p(e,o){1&o&&r!==(r=e[0].enabled)&&(n.checked=r),3&o&&s!==(s=e[1]||"running"===e[0].status)&&(n.disabled=s),1&o&&l!==(l=e[0].enabled?"Disable":"Enable")&&v(t,"title",l)},d(e){e&&d(t),a=!1,f()}}}function Br(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),v(n,"class","label svelte-1lnumzb"),v(s,"class","value svelte-1lnumzb"),v(t,"class","detail-row svelte-1lnumzb")},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+"")&&w(o,i)},d(e){e&&d(t)}}}function Sr(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),v(n,"class","label svelte-1lnumzb"),v(s,"class","value warning svelte-1lnumzb"),v(t,"class","detail-row svelte-1lnumzb")},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+"")&&w(o,i)},d(e){e&&d(t)}}}function Cr(e){let t,n,r,s;return{c(){t=h("button"),n=p("▶"),v(t,"class","action-btn start-btn svelte-1lnumzb"),t.disabled=e[1],v(t,"title","Start service")},m(o,i){u(o,t,i),c(t,n),r||(s=m(t,"click",e[7]),r=!0)},p(e,n){2&n&&(t.disabled=e[1])},d(e){e&&d(t),r=!1,s()}}}function Ir(e){let t,n,r,s;return{c(){t=h("button"),n=p("■"),v(t,"class","action-btn stop-btn svelte-1lnumzb"),t.disabled=e[1],v(t,"title","Stop service")},m(o,i){u(o,t,i),c(t,n),r||(s=m(t,"click",e[8]),r=!0)},p(e,n){2&n&&(t.disabled=e[1])},d(e){e&&d(t),r=!1,s()}}}function Lr(e){let t,n,r,s;return{c(){t=h("button"),n=p("↻"),v(t,"class","action-btn restart-btn svelte-1lnumzb"),t.disabled=e[1],v(t,"title","Restart service")},m(o,i){u(o,t,i),c(t,n),r||(s=m(t,"click",e[9]),r=!0)},p(e,n){2&n&&(t.disabled=e[1])},d(e){e&&d(t),r=!1,s()}}}function qr(e){let t;return{c(){t=h("span"),t.textContent="Enable to start",v(t,"class","hint svelte-1lnumzb")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function zr(t){let n,r,s,o,i,l,a,f,b,m,y,E,_,$,A,B,S,C,I,L,q,z,T,U,N,O,R,j,D,P=Ur(t[0].status)+"",H=t[0].name+"",F=Nr(t[0].category)+"",V=t[0].description+"",K=t[0].status+"";function M(e,t){return e[6]?Ar:kr}let Z=M(t),W=Z(t),G=t[0].pid>0&&Br(t),Y=t[0].restarts>0&&Sr(t),J=t[4]&&Cr(t),Q=t[3]&&Ir(t),X=t[2]&&Lr(t),ee=!t[0].enabled&&!t[4]&&!t[3]&&qr();return{c(){n=h("div"),r=h("div"),s=h("span"),o=p(P),i=g(),l=h("div"),a=h("span"),f=p(H),b=g(),m=h("span"),y=p(F),E=g(),W.c(),_=g(),$=h("p"),A=p(V),B=g(),S=h("div"),C=h("div"),I=h("span"),I.textContent="Status:",L=g(),q=h("span"),z=p(K),T=g(),G&&G.c(),U=g(),Y&&Y.c(),N=g(),O=h("div"),J&&J.c(),R=g(),Q&&Q.c(),j=g(),X&&X.c(),D=g(),ee&&ee.c(),v(s,"class","status-indicator svelte-1lnumzb"),x(s,"color",Tr(t[0].status)),v(a,"class","process-name svelte-1lnumzb"),v(m,"class","category-badge svelte-1lnumzb"),k(m,"exclusive",t[5]),v(l,"class","name-section svelte-1lnumzb"),v(r,"class","process-header svelte-1lnumzb"),v($,"class","description svelte-1lnumzb"),v(I,"class","label svelte-1lnumzb"),v(q,"class","value svelte-1lnumzb"),x(q,"color",Tr(t[0].status)),v(C,"class","detail-row svelte-1lnumzb"),v(S,"class","process-details svelte-1lnumzb"),v(O,"class","process-actions svelte-1lnumzb"),v(n,"class","process-card svelte-1lnumzb"),k(n,"disabled",!t[0].enabled)},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(a,f),c(l,b),c(l,m),c(m,y),c(r,E),W.m(r,null),c(n,_),c(n,$),c($,A),c(n,B),c(n,S),c(S,C),c(C,I),c(C,L),c(C,q),c(q,z),c(S,T),G&&G.m(S,null),c(S,U),Y&&Y.m(S,null),c(n,N),c(n,O),J&&J.m(O,null),c(O,R),Q&&Q.m(O,null),c(O,j),X&&X.m(O,null),c(O,D),ee&&ee.m(O,null)},p(e,[t]){1&t&&P!==(P=Ur(e[0].status)+"")&&w(o,P),1&t&&x(s,"color",Tr(e[0].status)),1&t&&H!==(H=e[0].name+"")&&w(f,H),1&t&&F!==(F=Nr(e[0].category)+"")&&w(y,F),32&t&&k(m,"exclusive",e[5]),Z===(Z=M(e))&&W?W.p(e,t):(W.d(1),W=Z(e),W&&(W.c(),W.m(r,null))),1&t&&V!==(V=e[0].description+"")&&w(A,V),1&t&&K!==(K=e[0].status+"")&&w(z,K),1&t&&x(q,"color",Tr(e[0].status)),e[0].pid>0?G?G.p(e,t):(G=Br(e),G.c(),G.m(S,U)):G&&(G.d(1),G=null),e[0].restarts>0?Y?Y.p(e,t):(Y=Sr(e),Y.c(),Y.m(S,null)):Y&&(Y.d(1),Y=null),e[4]?J?J.p(e,t):(J=Cr(e),J.c(),J.m(O,R)):J&&(J.d(1),J=null),e[3]?Q?Q.p(e,t):(Q=Ir(e),Q.c(),Q.m(O,j)):Q&&(Q.d(1),Q=null),e[2]?X?X.p(e,t):(X=Lr(e),X.c(),X.m(O,D)):X&&(X.d(1),X=null),e[0].enabled||e[4]||e[3]?ee&&(ee.d(1),ee=null):ee||(ee=qr(),ee.c(),ee.m(O,null)),1&t&&k(n,"disabled",!e[0].enabled)},i:e,o:e,d(e){e&&d(n),W.d(),G&&G.d(),Y&&Y.d(),J&&J.d(),Q&&Q.d(),X&&X.d(),ee&&ee.d()}}}function Tr(e){switch(e){case"running":return"var(--success)";case"stopped":case"disabled":default:return"var(--muted-color)";case"crashed":return"var(--error)"}}function Ur(e){switch(e){case"running":return"●";case"stopped":return"○";case"disabled":return"◌";case"crashed":return"✗";default:return"?"}}function Nr(e){switch(e){case"database":return"Database";case"acl":return"Access Control";case"sync":return"Sync Service";case"certs":return"Certificates";case"relay":return"Relay";default:return e}}function Or(e,t,n){let r,s,o,i,l,{process:a}=t,{isLoading:c=!1}=t;const u=I(),d=["database","acl"];return e.$$set=e=>{"process"in e&&n(0,a=e.process),"isLoading"in e&&n(1,c=e.isLoading)},e.$$.update=()=>{1&e.$$.dirty&&n(6,r="relay"!==a.category),1&e.$$.dirty&&n(5,s=d.includes(a.category)),1&e.$$.dirty&&n(4,o=a.enabled&&"running"!==a.status),1&e.$$.dirty&&n(3,i="running"===a.status),1&e.$$.dirty&&n(2,l="running"===a.status)},[a,c,l,i,o,s,r,function(){u("start",{service:a.name})},function(){u("stop",{service:a.name})},function(){u("restart",{service:a.name})},function(e){const t=e.target.checked;u("toggle-enabled",{service:a.name,enabled:t,category:a.category,isExclusive:s})}]}class Rr extends te{constructor(e){super(),ee(this,e,Or,zr,o,{process:0,isLoading:1})}}function jr(e,t,n){const r=e.slice();return r[14]=t[n],r}function Dr(e){let t,n,r,s;return{c(){t=h("button"),n=p("Start Services"),v(t,"class","start-btn svelte-ehjgxg"),t.disabled=e[0]},m(o,i){u(o,t,i),c(t,n),r||(s=m(t,"click",e[5]),r=!0)},p(e,n){1&n&&(t.disabled=e[0])},d(e){e&&d(t),r=!1,s()}}}function Pr(e){let t,n,s,o,i,l,a;return{c(){t=h("button"),n=p("Stop Services"),s=g(),o=h("button"),i=p("Restart All"),v(t,"class","stop-btn svelte-ehjgxg"),t.disabled=e[0],v(o,"class","restart-btn svelte-ehjgxg"),o.disabled=e[0]},m(r,d){u(r,t,d),c(t,n),u(r,s,d),u(r,o,d),c(o,i),l||(a=[m(t,"click",e[6]),m(o,"click",e[4])],l=!0)},p(e,n){1&n&&(t.disabled=e[0]),1&n&&(o.disabled=e[0])},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[1]),v(t,"class","error-banner svelte-ehjgxg")},m(e,r){u(e,t,r),c(t,n)},p(e,t){2&t&&w(n,e[1])},d(e){e&&d(t)}}}function Fr(t){let n;return{c(){n=h("div"),n.textContent="Loading status...",v(n,"class","loading svelte-ehjgxg")},m(e,t){u(e,n,t)},p:e,i:e,o:e,d(e){e&&d(n)}}}function Vr(e){let t,n,r,s,o,i,l,a,b,m,y,E,x,_,$,A,B,S,C,I,L,q,z,T,U,N,O,R,j,D,P,H=e[2].services_running?"Running":"Stopped",F=(e[2].version||"unknown")+"",V=e[2].uptime+"",Y=(e[2].processes?.filter(Zr).length||0)+"",J=(e[2].processes?.filter(Wr).length||0)+"",Q=G(e[2].processes||[]),X=[];for(let t=0;tW(X[e],1,1,()=>{X[e]=null});return{c(){t=h("div"),n=h("div"),r=h("span"),r.textContent="Status",s=g(),o=h("span"),i=p(H),l=g(),a=h("div"),b=h("span"),b.textContent="Version",m=g(),y=h("span"),E=p(F),x=g(),_=h("div"),$=h("span"),$.textContent="Uptime",A=g(),B=h("span"),S=p(V),C=g(),I=h("div"),L=h("span"),L.textContent="Running",q=g(),z=h("span"),T=p(Y),U=p(" / "),N=p(J),O=g(),R=h("h3"),R.textContent="Available Modules",j=g(),D=h("div");for(let e=0;e{C[r]=null}),M()),~y?(w=C[y],w?w.p(e,n):(w=C[y]=S[y](e),w.c()),Z(w,1),w.m(t,null)):w=null)},i(e){E||(Z(w),E=!0)},o(e){W(w),E=!1},d(e){e&&d(t),A.d(),B&&B.d(),~y&&C[y].d(),x=!1,_()}}}const Zr=e=>"running"===e.status,Wr=e=>e.enabled;function Gr(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 wr("/api/status",{},e,t);if(!n.ok)throw new Error(`Failed to fetch status: ${n.statusText}`);return n.json()}(a,o),c),l(vr,s="",s)}catch(e){l(vr,s=e.message,s)}}return i(e,yr,e=>n(0,r=e)),i(e,vr,e=>n(1,s=e)),i(e,fr,e=>n(12,o=e)),i(e,hr,e=>n(13,a=e)),i(e,gr,e=>n(2,c=e)),C(async()=>{await f(),u=setInterval(f,5e3)}),d=()=>{u&&clearInterval(u)},S().$$.on_destroy.push(d),[r,s,c,f,async function(){if(confirm("Are you sure you want to restart all services?")){l(yr,r=!0,r);try{await _r(a,o),setTimeout(f,2e3)}catch(e){l(vr,s=e.message,s)}finally{l(yr,r=!1,r)}}},async function(){l(yr,r=!0,r);try{await async function(e,t){const n=await wr("/api/start-services",{method:"POST"},e,t);if(!n.ok){const e=await n.json().catch(()=>({}));throw new Error(e.message||`Start failed: ${n.statusText}`)}return n.json()}(a,o),setTimeout(f,2e3)}catch(e){l(vr,s=e.message,s)}finally{l(yr,r=!1,r)}},async function(){if(confirm("Are you sure you want to stop all services?")){l(yr,r=!0,r);try{await async function(e,t){const n=await wr("/api/stop-services",{method:"POST"},e,t);if(!n.ok){const e=await n.json().catch(()=>({}));throw new Error(e.message||`Stop failed: ${n.statusText}`)}return n.json()}(a,o),setTimeout(f,2e3)}catch(e){l(vr,s=e.message,s)}finally{l(yr,r=!1,r)}}},async function(e){const{service:t}=e.detail;l(yr,r=!0,r);try{await async function(e,t,n){const r=await wr("/api/start-service",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:n})},e,t);if(!r.ok){const e=await r.json().catch(()=>({}));throw new Error(e.message||`Start failed: ${r.statusText}`)}return r.json()}(a,o,t),setTimeout(f,2e3)}catch(e){l(vr,s=e.message,s)}finally{l(yr,r=!1,r)}},async function(e){const{service:t}=e.detail;if(!["orly-db","orly-acl"].includes(t)||confirm(`Stopping ${t} will also stop its dependent services. Continue?`)){l(yr,r=!0,r);try{await async function(e,t,n){const r=await wr("/api/stop-service",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:n})},e,t);if(!r.ok){const e=await r.json().catch(()=>({}));throw new Error(e.message||`Stop failed: ${r.statusText}`)}return r.json()}(a,o,t),setTimeout(f,2e3)}catch(e){l(vr,s=e.message,s)}finally{l(yr,r=!1,r)}}},async function(e){const{service:t}=e.detail;if(!["orly-db","orly-acl"].includes(t)||confirm(`Restarting ${t} will also restart its dependent services. Continue?`)){l(yr,r=!0,r);try{await $r(a,o,t),setTimeout(f,2e3)}catch(e){l(vr,s=e.message,s)}finally{l(yr,r=!1,r)}}},async function(e){const{service:t,enabled:n,category:i,isExclusive:u}=e.detail;if(n&&u){const e=c.processes.filter(e=>e.category===i&&e.enabled&&e.name!==t).map(e=>e.name);if(e.length>0&&!confirm(`Enabling ${t} will disable ${e.join(", ")}. Continue?`))return void await f()}const d=function(e,t){switch(e){case"orly-db-badger":return t?{db_backend:"badger"}:null;case"orly-db-neo4j":return t?{db_backend:"neo4j"}:null;case"orly-acl-follows":return t?{acl_enabled:!0,acl_mode:"follows"}:{acl_enabled:!1};case"orly-acl-managed":return t?{acl_enabled:!0,acl_mode:"managed"}:{acl_enabled:!1};case"orly-acl-curation":return t?{acl_enabled:!0,acl_mode:"curation"}:{acl_enabled:!1};case"orly-sync-distributed":return{distributed_sync_enabled:t};case"orly-sync-cluster":return{cluster_sync_enabled:t};case"orly-sync-relaygroup":return{relay_group_enabled:t};case"orly-sync-negentropy":return{negentropy_enabled:t};case"orly-certs":return{certs_enabled:t};default:return null}}(t,n);if(d){l(yr,r=!0,r);try{await Er(a,o,d),setTimeout(f,1e3)}catch(e){l(vr,s=e.message,s),setTimeout(f,500)}finally{l(yr,r=!1,r)}}else l(vr,s=`Unknown service: ${t}`,s)}]}class Yr extends te{constructor(e){super(),ee(this,e,Gr,Mr,o,{})}}function Jr(e,t,n){const r=e.slice();return r[33]=t[n],r[35]=n,r}function Qr(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"),v(t,"class","refresh-btn svelte-my2rpu"),t.disabled=e[6],v(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=[m(t,"click",e[8]),m(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 Xr(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),v(t,"class","cancel-btn svelte-my2rpu"),t.disabled=e[4],v(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=[m(t,"click",e[10]),m(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")&&w(i,f),16&n[0]&&(o.disabled=e[4])},d(e){e&&(d(t),d(s),d(o)),l=!1,r(a)}}}function es(e){let t,n;return{c(){t=h("div"),n=p(e[7]),v(t,"class","error-banner svelte-my2rpu")},m(e,r){u(e,t,r),c(t,n)},p(e,t){128&t[0]&&w(n,e[7])},d(e){e&&d(t)}}}function ts(e){let t,n,r,s=e[3]&&e[2].includes("Restart required"),o=s&&ns(e);return{c(){t=h("div"),n=p(e[2]),r=g(),o&&o.c(),v(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]&&w(n,e[2]),12&r[0]&&(s=e[3]&&e[2].includes("Restart required")),s?o?o.p(e,r):(o=ns(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 ns(t){let n,r,s;return{c(){n=h("button"),n.textContent="Restart Now",v(n,"class","restart-btn-inline svelte-my2rpu")},m(e,o){u(e,n,o),r||(s=m(n,"click",t[12]),r=!0)},p:e,d(e){e&&d(n),r=!1,s()}}}function rs(t){let n;return{c(){n=h("div"),n.textContent="Loading configuration...",v(n,"class","loading svelte-my2rpu")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function ss(e){let t,n,r,s,o,i,l,a,m,y,w,E,x,_,$,k,A,B,S,C,I,L,q,z,T,U,N,O,R,j,D,P,H,F,V,K,M,Z,W,Y,J,Q,X,ee,te,ne,re,se,oe,ie,le,ae,ce,ue,de,fe,he,pe,ge,be,me,ye,ve,we,Ee,xe,_e,$e,ke,Ae,Be,Se,Ce,Ie,Le,qe,ze,Te,Ue,Ne,Oe,Re,je,De,Pe,He,Fe,Ve;function Ke(e,t){return e[0]?is:os}let Me=Ke(e),Ze=Me(e);function We(e,t){return e[0]?as:ls}let Ge=We(e),Ye=Ge(e);function Je(e,t){return e[0]?us:cs}let Qe=Je(e),Xe=Qe(e);function et(e,t){return e[0]?fs:ds}let tt=et(e),nt=tt(e);function rt(e,t){return e[0]?ps:hs}let st=rt(e),ot=st(e);function it(e,t){return e[0]?bs:gs}let lt=it(e),at=lt(e);function ct(e,t){return e[0]?ys:ms}let ut=ct(e),dt=ut(e);function ft(e,t){return e[0]?ws:vs}let ht=ft(e),pt=ht(e);function gt(e,t){return e[0]?xs:Es}let bt=gt(e),mt=bt(e);function yt(e,t){return e[0]?$s:_s}let vt=yt(e),wt=vt(e);function Et(e,t){return e[0]?As:ks}let xt=Et(e),_t=xt(e);function $t(e,t){return e[0]?Ss:Bs}let kt=$t(e),At=kt(e);function Bt(e,t){return e[0]?Is:Cs}let St=Bt(e),Ct=St(e);function It(e,t){return e[0]?qs:Ls}let Lt=It(e),qt=Lt(e);function zt(e,t){return e[0]?Ts:zs}let Tt=zt(e),Ut=Tt(e),Nt=e[0]&&Us(e),Ot=G((e[0]?e[1].admin_owners:e[5].admin_owners)||[]),Rt=[];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=m(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 ls(e){let t,n,r=e[5].db_binary+"";return{c(){t=h("span"),n=p(r),v(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+"")&&w(n,r)},d(e){e&&d(t)}}}function as(e){let t,n,r;return{c(){t=h("input"),v(t,"type","text"),v(t,"placeholder","orly-db-badger"),v(t,"class","svelte-my2rpu")},m(s,o){u(s,t,o),E(t,e[1].db_binary),n||(r=m(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 cs(e){let t,n,r=e[5].db_listen+"";return{c(){t=h("span"),n=p(r),v(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+"")&&w(n,r)},d(e){e&&d(t)}}}function us(e){let t,n,r;return{c(){t=h("input"),v(t,"type","text"),v(t,"placeholder","127.0.0.1:50051"),v(t,"class","svelte-my2rpu")},m(s,o){u(s,t,o),E(t,e[1].db_listen),n||(r=m(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 ds(e){let t,n,r=e[5].data_dir+"";return{c(){t=h("span"),n=p(r),v(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+"")&&w(n,r)},d(e){e&&d(t)}}}function fs(e){let t,n,r;return{c(){t=h("input"),v(t,"type","text"),v(t,"class","svelte-my2rpu")},m(s,o){u(s,t,o),E(t,e[1].data_dir),n||(r=m(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 hs(e){let t,n,r=e[5].acl_enabled?"Yes":"No";return{c(){t=h("span"),n=p(r),v(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")&&w(n,r),32&s[0]&&k(t,"enabled",e[5].acl_enabled)},d(e){e&&d(t)}}}function ps(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),v(n,"type","checkbox"),v(n,"class","svelte-my2rpu"),v(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=m(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")&&w(o,a)},d(e){e&&d(t),i=!1,l()}}}function gs(e){let t,n,r=e[5].acl_mode+"";return{c(){t=h("span"),n=p(r),v(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+"")&&w(n,r)},d(e){e&&d(t)}}}function bs(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),v(t,"class","svelte-my2rpu"),void 0===e[1].acl_mode&&R(()=>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=m(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 ms(e){let t,n,r=e[5].acl_binary+"";return{c(){t=h("span"),n=p(r),v(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+"")&&w(n,r)},d(e){e&&d(t)}}}function ys(e){let t,n,r;return{c(){t=h("input"),v(t,"type","text"),v(t,"class","svelte-my2rpu")},m(s,o){u(s,t,o),E(t,e[1].acl_binary),n||(r=m(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 vs(e){let t,n,r=e[5].acl_listen+"";return{c(){t=h("span"),n=p(r),v(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+"")&&w(n,r)},d(e){e&&d(t)}}}function ws(e){let t,n,r;return{c(){t=h("input"),v(t,"type","text"),v(t,"placeholder","127.0.0.1:50052"),v(t,"class","svelte-my2rpu")},m(s,o){u(s,t,o),E(t,e[1].acl_listen),n||(r=m(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 Es(e){let t,n,r=e[5].relay_binary+"";return{c(){t=h("span"),n=p(r),v(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+"")&&w(n,r)},d(e){e&&d(t)}}}function xs(e){let t,n,r;return{c(){t=h("input"),v(t,"type","text"),v(t,"placeholder","orly"),v(t,"class","svelte-my2rpu")},m(s,o){u(s,t,o),E(t,e[1].relay_binary),n||(r=m(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 _s(e){let t,n,r=e[5].log_level+"";return{c(){t=h("span"),n=p(r),v(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+"")&&w(n,r)},d(e){e&&d(t)}}}function $s(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),v(t,"class","svelte-my2rpu"),void 0===e[1].log_level&&R(()=>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=m(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 ks(e){let t,n,r=e[5].distributed_sync_enabled?"Enabled":"Disabled";return{c(){t=h("span"),n=p(r),v(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")&&w(n,r),32&s[0]&&k(t,"enabled",e[5].distributed_sync_enabled)},d(e){e&&d(t)}}}function As(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),v(n,"type","checkbox"),v(n,"class","svelte-my2rpu"),v(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=m(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")&&w(o,a)},d(e){e&&d(t),i=!1,l()}}}function Bs(e){let t,n,r=e[5].cluster_sync_enabled?"Enabled":"Disabled";return{c(){t=h("span"),n=p(r),v(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")&&w(n,r),32&s[0]&&k(t,"enabled",e[5].cluster_sync_enabled)},d(e){e&&d(t)}}}function Ss(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),v(n,"type","checkbox"),v(n,"class","svelte-my2rpu"),v(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=m(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")&&w(o,a)},d(e){e&&d(t),i=!1,l()}}}function Cs(e){let t,n,r=e[5].relay_group_enabled?"Enabled":"Disabled";return{c(){t=h("span"),n=p(r),v(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")&&w(n,r),32&s[0]&&k(t,"enabled",e[5].relay_group_enabled)},d(e){e&&d(t)}}}function Is(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),v(n,"type","checkbox"),v(n,"class","svelte-my2rpu"),v(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=m(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")&&w(o,a)},d(e){e&&d(t),i=!1,l()}}}function Ls(e){let t,n,r=e[5].negentropy_enabled?"Enabled":"Disabled";return{c(){t=h("span"),n=p(r),v(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")&&w(n,r),32&s[0]&&k(t,"enabled",e[5].negentropy_enabled)},d(e){e&&d(t)}}}function qs(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),v(n,"type","checkbox"),v(n,"class","svelte-my2rpu"),v(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=m(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")&&w(o,a)},d(e){e&&d(t),i=!1,l()}}}function zs(e){let t,n,r=e[5].bin_dir+"";return{c(){t=h("span"),n=p(r),v(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+"")&&w(n,r)},d(e){e&&d(t)}}}function Ts(e){let t,n,r;return{c(){t=h("input"),v(t,"type","text"),v(t,"class","svelte-my2rpu")},m(s,o){u(s,t,o),E(t,e[1].bin_dir),n||(r=m(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 Us(t){let n,r,s;return{c(){n=h("button"),n.textContent="+ Add",v(n,"class","add-owner-btn svelte-my2rpu")},m(e,o){u(e,n,o),r||(s=m(n,"click",t[13]),r=!0)},p:e,d(e){e&&d(n),r=!1,s()}}}function Ns(t){let n;return{c(){n=h("span"),n.textContent="No owners configured",v(n,"class","no-owners svelte-my2rpu")},m(e,t){u(e,n,t)},p:e,d(e){e&&d(n)}}}function Os(e){let t,n,r;function s(){return e[30](e[35])}return{c(){t=h("button"),t.textContent="x",v(t,"class","remove-owner-btn svelte-my2rpu")},m(e,o){u(e,t,o),n||(r=m(t,"click",s),n=!0)},p(t,n){e=t},d(e){e&&d(t),n=!1,r()}}}function Rs(e){let t,n,r,s,o,i=e[33]+"",l=e[0]&&Os(e);return{c(){t=h("div"),n=h("code"),r=p(i),s=g(),l&&l.c(),o=g(),v(n,"class","owner svelte-my2rpu"),v(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]+"")&&w(r,i),e[0]?l?l.p(e,n):(l=Os(e),l.c(),l.m(t,o)):l&&(l.d(1),l=null)},d(e){e&&d(t),l&&l.d()}}}function js(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."),v(s,"class","svelte-my2rpu"),v(n,"class","svelte-my2rpu"),v(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$/,"")+"")&&w(o,a)},d(e){e&&d(t)}}}function Ds(t){let n,r,s,o,i,l,a,f;function p(e,t){return e[0]?Xr:Qr}let b=p(t),m=b(t),y=t[7]&&es(t),w=t[2]&&ts(t);function E(e,t){return e[5]?ss:e[7]?void 0:rs}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"),m.c(),l=g(),y&&y.c(),a=g(),w&&w.c(),f=g(),_&&_.c(),v(s,"class","svelte-my2rpu"),v(i,"class","header-buttons svelte-my2rpu"),v(r,"class","page-header svelte-my2rpu"),v(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),m.m(i,null),c(n,l),y&&y.m(n,null),c(n,a),w&&w.m(n,null),c(n,f),_&&_.m(n,null)},p(e,t){b===(b=p(e))&&m?m.p(e,t):(m.d(1),m=b(e),m&&(m.c(),m.m(i,null))),e[7]?y?y.p(e,t):(y=es(e),y.c(),y.m(n,a)):y&&(y.d(1),y=null),e[2]?w?w.p(e,t):(w=ts(e),w.c(),w.m(n,f)):w&&(w.d(1),w=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),m.d(),y&&y.d(),w&&w.d(),_&&_.d()}}}function Ps(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,br,e=>n(5,o=e)),i(e,yr,e=>n(6,a=e)),i(e,vr,e=>n(7,c=e));let u=!1,d={},f="",h=!1,p=!1;async function g(){l(yr,a=!0,a);try{l(br,o=await async function(e,t){const n=await wr("/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(vr,c="",c)}catch(e){l(vr,c=e.message,c)}finally{l(yr,a=!1,a)}}function b(e){n(1,d.admin_owners=d.admin_owners.filter((t,n)=>n!==e),d)}C(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 Er(s,r,d);n(3,h=e.success),n(2,f=e.message),e.success&&(l(br,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 _r(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.")},b,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=>b(e)]}class Hs extends te{constructor(e){super(),ee(this,e,Ps,Ds,o,{},null,[-1,-1])}}function Fs(e,t,n){const r=e.slice();return r[37]=t[n],r}function Vs(e,t,n){const r=e.slice();return r[40]=t[n][0],r[41]=t[n][1],r[42]=t,r[43]=n,r}function Ks(e,t,n){const r=e.slice();return r[44]=t[n],r}function Ms(e,t,n){const r=e.slice();return r[47]=t[n],r}function Zs(e){let t,n;return{c(){t=h("div"),n=p(e[10]),v(t,"class","error-banner svelte-z9aqcb")},m(e,r){u(e,t,r),c(t,n)},p(e,t){1024&t[0]&&w(n,e[10])},d(e){e&&d(t)}}}function Ws(e){let t,n,r,s,o=e[3].message+"",i=e[3].downloaded_files?.length&&Gs(e),l=e[5]&&Ys(e);return{c(){t=h("div"),n=p(o),r=g(),i&&i.c(),s=g(),l&&l.c(),v(t,"class","success-banner svelte-z9aqcb")},m(e,o){u(e,t,o),c(t,n),c(t,r),i&&i.m(t,null),c(t,s),l&&l.m(t,null)},p(e,r){8&r[0]&&o!==(o=e[3].message+"")&&w(n,o),e[3].downloaded_files?.length?i?i.p(e,r):(i=Gs(e),i.c(),i.m(t,s)):i&&(i.d(1),i=null),e[5]?l?l.p(e,r):(l=Ys(e),l.c(),l.m(t,null)):l&&(l.d(1),l=null)},d(e){e&&d(t),i&&i.d(),l&&l.d()}}}function Gs(e){let t,n,r,s=e[3].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){8&t[0]&&s!==(s=e[3].downloaded_files.join(", ")+"")&&w(r,s)},d(e){e&&(d(t),d(n),d(r))}}}function Ys(t){let n,r,s,o,i,l;return{c(){n=h("div"),r=h("strong"),r.textContent="Launcher was updated!",s=g(),o=h("button"),o.textContent="Restart Launcher Now",v(o,"class","restart-launcher-btn svelte-z9aqcb"),v(n,"class","launcher-restart svelte-z9aqcb")},m(e,a){u(e,n,a),c(n,r),c(n,s),c(n,o),i||(l=m(o,"click",t[20]),i=!0)},p:e,d(e){e&&d(n),i=!1,l()}}}function Js(e){let t,n,r,s,o,i=e[47].tag+"",l=e[47].message?` - ${e[47].message.slice(0,40)}`:"";return{c(){t=h("option"),n=p(i),r=p(l),s=g(),t.__value=o=e[47].tag,E(t,t.__value)},m(e,o){u(e,t,o),c(t,n),c(t,r),c(t,s)},p(e,s){64&s[0]&&i!==(i=e[47].tag+"")&&w(n,i),64&s[0]&&l!==(l=e[47].message?` - ${e[47].message.slice(0,40)}`:"")&&w(r,l),64&s[0]&&o!==(o=e[47].tag)&&(t.__value=o,E(t,t.__value))},d(e){e&&d(t)}}}function Qs(e){let t,n,r,s,o;return{c(){t=h("div"),n=h("span"),n.textContent="Release:",r=g(),s=h("code"),o=p(e[2]),v(n,"class","release-label svelte-z9aqcb"),v(s,"class","svelte-z9aqcb"),v(t,"class","release-url-display svelte-z9aqcb")},m(e,i){u(e,t,i),c(t,n),c(t,r),c(t,s),c(s,o)},p(e,t){4&t[0]&&w(o,e[2])},d(e){e&&d(t)}}}function Xs(t){let n,r,s=t[44].label+"";return{c(){n=h("option"),r=p(s),n.__value=t[44].value,E(n,n.__value)},m(e,t){u(e,n,t),c(n,r)},p:e,d(e){e&&d(n)}}}function eo(e){let t,n;return{c(){t=h("input"),v(t,"type","text"),v(t,"class","url-display svelte-z9aqcb"),t.value=n=e[9][e[40]].url,t.readOnly=!0,v(t,"placeholder","Set release URL above")},m(e,n){u(e,t,n)},p(e,r){4608&r[0]&&n!==(n=e[9][e[40]].url)&&t.value!==n&&(t.value=n)},d(e){e&&d(t)}}}function to(e){let t,n,s,o;function i(){e[26].call(t,e[40])}function l(){return e[27](e[40])}return{c(){t=h("input"),v(t,"type","text"),v(t,"class","custom-url svelte-z9aqcb"),v(t,"placeholder","https://... (custom binary URL)"),t.disabled=n=e[4]||e[9][e[40]].installing},m(n,r){u(n,t,r),E(t,e[9][e[40]].customUrl),s||(o=[m(t,"input",i),m(t,"input",l)],s=!0)},p(r,s){e=r,4624&s[0]&&n!==(n=e[4]||e[9][e[40]].installing)&&(t.disabled=n),4608&s[0]&&t.value!==e[9][e[40]].customUrl&&E(t,e[9][e[40]].customUrl)},d(e){e&&d(t),s=!1,r(o)}}}function no(e){let t,n,r,s;function o(e,t){return e[9][e[40]].installing?oo:e[9][e[40]].installed?so:ro}let i=o(e),l=i(e);function a(){return e[28](e[40])}return{c(){t=h("button"),l.c(),v(t,"class","install-btn svelte-z9aqcb"),t.disabled=n=e[4]||e[9][e[40]].installing||!e[16](e[40]),v(t,"title","Download and install this component")},m(e,n){u(e,t,n),l.m(t,null),r||(s=m(t,"click",a),r=!0)},p(r,s){i!==(i=o(e=r))&&(l.d(1),l=i(e),l&&(l.c(),l.m(t,null))),4624&s[0]&&n!==(n=e[4]||e[9][e[40]].installing||!e[16](e[40]))&&(t.disabled=n)},d(e){e&&d(t),l.d(),r=!1,s()}}}function ro(e){let t;return{c(){t=p("Install")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function so(e){let t;return{c(){t=p("Done")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function oo(e){let t;return{c(){t=p("...")},m(e,n){u(e,t,n)},d(e){e&&d(t)}}}function io(e){let t,n,s,o,i,l,a,p,b,y,w,E,x,$=!e[41].required&&function(){let e;return{c(){e=h("span"),e.textContent="optional",v(e,"class","optional-badge svelte-z9aqcb")},m(t,n){u(t,e,n)},d(t){t&&d(e)}}}(),k=G(e[41].options),A=[];for(let t=0;tVersion Installed Binaries Status',i=g(),l=h("tbody");for(let e=0;eUpdate Binaries',o=g(),_e&&_e.c(),i=g(),$e&&$e.c(),l=g(),a=h("div"),b=h("h3"),b.textContent="Current Version",y=g(),x=h("div"),$=h("span"),k=p(we),A=g(),B=h("button"),S=p("Rollback"),I=g(),L=h("div"),q=h("h3"),q.textContent="Install New Version",z=g(),T=h("div"),U=h("div"),N=h("div"),O=h("label"),O.textContent="Official Release",j=g(),D=h("select"),P=h("option"),H=p(Ee),F=g();for(let e=0;et[21].call(D)),v(N,"class","form-group svelte-z9aqcb"),v(Z,"for","arch"),v(Z,"class","svelte-z9aqcb"),J.__value="amd64",E(J,J.__value),Q.__value="arm64",E(Q,Q.__value),v(Y,"id","arch"),Y.disabled=t[4],v(Y,"class","svelte-z9aqcb"),void 0===t[1]&&R(()=>t[22].call(Y)),v(M,"class","form-group svelte-z9aqcb"),v(U,"class","form-row svelte-z9aqcb"),v(ne,"for","version"),v(ne,"class","svelte-z9aqcb"),v(se,"type","text"),v(se,"id","version"),v(se,"placeholder","v0.56.1"),se.disabled=t[4],v(se,"class","svelte-z9aqcb"),v(te,"class","form-group svelte-z9aqcb"),v(le,"class","svelte-z9aqcb"),v(ce,"class","helper-btn fill-btn svelte-z9aqcb"),ce.disabled=t[4],v(ie,"class","form-group svelte-z9aqcb"),v(ee,"class","form-row custom-release-row svelte-z9aqcb"),v(T,"class","release-settings svelte-z9aqcb"),v(he,"class","categories svelte-z9aqcb"),v(ge,"class","update-btn svelte-z9aqcb"),ge.disabled=t[4],v(L,"class","update-form svelte-z9aqcb"),v(n,"class","update-page svelte-z9aqcb")},m(e,r){u(e,n,r),c(n,s),c(n,o),_e&&_e.m(n,null),c(n,i),$e&&$e.m(n,null),c(n,l),c(n,a),c(a,b),c(a,y),c(a,x),c(x,$),c($,k),c(x,A),c(x,B),c(B,S),c(n,I),c(n,L),c(L,q),c(L,z),c(L,T),c(T,U),c(U,N),c(N,O),c(N,j),c(N,D),c(D,P),c(P,H),c(P,F);for(let e=0;en(10,r=e)),i(e,fr,e=>n(29,s=e)),i(e,hr,e=>n(30,o=e)),i(e,yr,e=>n(31,a=e)),i(e,mr,e=>n(11,c=e));let u="",d="",f="amd64",h=null,p=!1,g=!1,b=[],m="",y=!1;const v={launcher:{label:"Launcher",options:[{value:"orly-launcher",label:"orly-launcher"},{value:"custom",label:"Custom"}],required:!0},relay:{label:"Relay",options:[{value:"orly",label:"orly"},{value:"custom",label:"Custom"}],required:!0},database:{label:"Database",options:[{value:"orly-db-badger",label:"Badger"},{value:"orly-db-neo4j",label:"Neo4j"},{value:"custom",label:"Custom"}],required:!0},acl:{label:"ACL",options:[{value:"none",label:"None (disabled)"},{value:"orly-acl-follows",label:"Follows"},{value:"orly-acl-managed",label:"Managed"},{value:"orly-acl-curation",label:"Curation"},{value:"custom",label:"Custom"}],required:!1},sync:{label:"Sync",options:[{value:"none",label:"None (disabled)"},{value:"orly-sync-negentropy",label:"Negentropy"},{value:"custom",label:"Custom"}],required:!1}};let w={launcher:{selected:"orly-launcher",customUrl:"",url:"",installing:!1,installed:!1},relay:{selected:"orly",customUrl:"",url:"",installing:!1,installed:!1},database:{selected:"orly-db-badger",customUrl:"",url:"",installing:!1,installed:!1},acl:{selected:"none",customUrl:"",url:"",installing:!1,installed:!1},sync:{selected:"none",customUrl:"",url:"",installing:!1,installed:!1}};async function E(){l(yr,a=!0,a);try{l(mr,c=await async function(e,t){const n=await wr("/api/binaries",{},e,t);if(!n.ok)throw new Error(`Failed to fetch binaries: ${n.statusText}`);return n.json()}(o,s),c),l(vr,r="",r)}catch(e){l(vr,r=e.message,r)}finally{l(yr,a=!1,a)}}function x(e){if(!d||!u)return"";const t=u.replace(/^v/,"");return`${d}/${e}-${t}-linux-${f}`}function _(){for(const e of Object.keys(w)){const t=w[e];"none"!==t.selected&&"custom"!==t.selected?t.url=x(t.selected):"custom"===t.selected?t.url=t.customUrl:t.url=""}n(9,w)}function k(e){_()}function A(e){const t=w[e];if("custom"===t.selected){const n=t.customUrl.split("/");return n[n.length-1].replace(/-[\d.]+-linux-(amd64|arm64)$/,"")||e}return t.selected}function B(e){const t=w[e];return"custom"===t.selected?t.customUrl:t.url}async function S(e){const t=w[e],i=B(e);if(i.trim())if(u.trim()){t.installing=!0,n(9,w),l(vr,r="",r);try{const r=A(e),l={[r]:i.trim()},a=await xr(o,s,u.trim(),l);if(a.success){if(t.installed=!0,"launcher"===e)n(5,g=!0),n(3,h={success:!0,message:`Downloaded ${r}. Click 'Restart Launcher' to apply.`,downloaded_files:a.downloaded_files});else{n(3,h={success:!0,message:`Downloaded ${r}, restarting service...`,downloaded_files:a.downloaded_files});try{await $r(o,s,r),n(3,h={success:!0,message:`${r} installed and restart initiated`,downloaded_files:a.downloaded_files})}catch(e){n(3,h={success:!0,message:`Downloaded ${r}, but restart failed: ${e.message}`,downloaded_files:a.downloaded_files})}}await E()}}catch(t){l(vr,r=`Failed to install ${v[e].label}: ${t.message}`,r)}finally{t.installing=!1,n(9,w)}}else l(vr,r="Version is required",r);else l(vr,r=`URL is required for ${v[e].label}`,r)}C(async()=>{await E(),await async function(){n(8,y=!0);try{const e=await async function(e,t){const n=await wr("/api/releases",{},e,t);if(!n.ok)throw new Error(`Failed to fetch releases: ${n.statusText}`);return n.json()}(o,s);e.releases&&n(6,b=e.releases.map(e=>({tag:e.tag,message:e.message||""})))}catch(e){console.error("Failed to fetch releases:",e)}finally{n(8,y=!1)}}()});return e.$$.update=()=>{3&e.$$.dirty[0]&&(f||u)&&_()},[u,f,d,h,p,g,b,m,y,w,r,c,v,function(){m&&(n(0,u=m),n(2,d=`https://git.nostrdev.com/mleku/next.orly.dev/releases/download/${m}`),_())},k,function(){let e=prompt("Enter release URL (e.g., https://git.mleku.dev/mleku/next.orly.dev/releases/tag/v0.56.1):");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/")){t=t+"/releases/download/"+(u.trim()||"v0.56.1")}const r=t.split("/"),s=r[r.length-1];n(2,d=t),u||n(0,u=s),_()},B,S,async function(){const e={};let t=!1;for(const n of Object.keys(w)){if("none"!==w[n].selected){const r=B(n);if(r.trim()){e[A(n)]=r.trim(),"launcher"===n&&(t=!0)}}}if(u.trim())if(0!==Object.keys(e).length){n(4,p=!0),n(3,h=null),n(5,g=!1),l(vr,r="",r);try{n(3,h=await xr(o,s,u.trim(),e)),await E(),t&&h.success&&n(5,g=!0)}catch(e){l(vr,r=e.message,r)}finally{n(4,p=!1)}}else l(vr,r="No binaries selected for installation",r);else l(vr,r="Version is required",r)},async function(){if(confirm("Are you sure you want to rollback to the previous version?")){n(4,p=!0),l(vr,r="",r);try{const e=await async function(e,t){const n=await wr("/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(3,h={success:!0,message:`Rolled back from ${e.previous_version} to ${e.current_version}. Restart services to apply.`}),await E()}catch(e){l(vr,r=e.message,r)}finally{n(4,p=!1)}}},async function(){if(confirm("Restart the launcher? This will briefly disconnect you."))try{await _r(o,s),n(3,h={success:!0,message:"Launcher restart initiated. The page will reconnect automatically..."}),setTimeout(()=>{window.location.reload()},5e3)}catch(e){l(vr,r=e.message,r)}},function(){m=$(this),n(7,m),n(6,b)},function(){f=$(this),n(1,f)},function(){u=this.value,n(0,u)},function(e){w[e].selected=$(this),n(9,w),n(12,v)},e=>k(),function(e){w[e].customUrl=this.value,n(9,w),n(12,v)},e=>{n(9,w[e].url=w[e].customUrl,w)},e=>S(e)]}class ho extends te{constructor(e){super(),ee(this,e,fo,uo,o,{},null,[-1,-1])}}function po(t){let n,r;return n=new ho({}),{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 go(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 bo(t){let n,r;return n=new Yr({}),{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 mo(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",v(r,"class","svelte-4k9oqz"),v(o,"class","svelte-4k9oqz"),v(l,"class","login-btn svelte-4k9oqz"),v(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=m(l,"click",t[10]),a=!0)},p:e,i:e,o:e,d(e){e&&d(n),a=!1,f()}}}function yo(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 b=[mo,bo,go,po],m=[];function y(e,t){return e[4]?"dashboard"===e[0]?1:"config"===e[0]?2:"update"===e[0]?3:-1:0}function w(t){e[11](t)}~(o=y(e))&&(i=m[o]=b[o](e));let E={isDarkTheme:e[2]};return void 0!==e[1]&&(E.showModal=e[1]),a=new ar({props:E}),z.push(()=>function(e,t,n){const r=e.$$.props[t];void 0!==r&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}(a,"showModal",w)),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),v(s,"class","content svelte-4k9oqz"),v(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&&m[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=y(e),o===c?~o&&m[o].p(e,r):(i&&(K(),W(m[c],1,1,()=>{m[c]=null}),M()),~o?(i=m[o],i?i.p(e,r):(i=m[o]=b[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,U.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&&m[o].d(),Q(a)}}}function vo(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)}C(()=>{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,vo,yo,o,{})}}({target:document.body})}(); diff --git a/cmd/orly-launcher/web/src/api.js b/cmd/orly-launcher/web/src/api.js index 3cb7e99..2306964 100644 --- a/cmd/orly-launcher/web/src/api.js +++ b/cmd/orly-launcher/web/src/api.js @@ -226,3 +226,39 @@ export async function stopServices(signer, pubkey) { } return response.json(); } + +/** + * Start a specific service + * @param {string} service - The service name (e.g., 'orly-db', 'orly-acl', 'orly') + */ +export async function startService(signer, pubkey, service) { + const response = await authFetch('/api/start-service', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ service }), + }, signer, pubkey); + + if (!response.ok) { + const data = await response.json().catch(() => ({})); + throw new Error(data.message || `Start failed: ${response.statusText}`); + } + return response.json(); +} + +/** + * Stop a specific service (and its dependents) + * @param {string} service - The service name (e.g., 'orly-db', 'orly-acl', 'orly') + */ +export async function stopService(signer, pubkey, service) { + const response = await authFetch('/api/stop-service', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ service }), + }, signer, pubkey); + + if (!response.ok) { + const data = await response.json().catch(() => ({})); + throw new Error(data.message || `Stop failed: ${response.statusText}`); + } + return response.json(); +} diff --git a/cmd/orly-launcher/web/src/components/ProcessCard.svelte b/cmd/orly-launcher/web/src/components/ProcessCard.svelte index 0df5fe0..60dbd42 100644 --- a/cmd/orly-launcher/web/src/components/ProcessCard.svelte +++ b/cmd/orly-launcher/web/src/components/ProcessCard.svelte @@ -1,10 +1,25 @@ -
+
{getStatusIcon(process.status)} - {process.name} +
+ {process.name} + {getCategoryLabel(process.category)} +
+ {#if canToggle} + + {:else} + always on + {/if}
+

{process.description}

+
Status: @@ -43,11 +114,6 @@
{/if} -
- Binary: - {process.binary} -
- {#if process.restarts > 0}
Restarts: @@ -55,6 +121,27 @@
{/if}
+ +
+ {#if canStart} + + {/if} + {#if canStop} + + {/if} + {#if canRestart} + + {/if} + {#if !process.enabled && !canStart && !canStop} + Enable to start + {/if} +
diff --git a/cmd/orly-launcher/web/src/pages/Dashboard.svelte b/cmd/orly-launcher/web/src/pages/Dashboard.svelte index 7cff3d3..7f6afb9 100644 --- a/cmd/orly-launcher/web/src/pages/Dashboard.svelte +++ b/cmd/orly-launcher/web/src/pages/Dashboard.svelte @@ -1,7 +1,7 @@
@@ -118,15 +250,22 @@ {$statusData.uptime}
- Processes - {$statusData.processes?.length || 0} + Running + {$statusData.processes?.filter(p => p.status === 'running').length || 0} / {$statusData.processes?.filter(p => p.enabled).length || 0}
-

Managed Processes

+

Available Modules

{#each $statusData.processes || [] as process} - + {/each}
{:else if !$error} diff --git a/pkg/version/version b/pkg/version/version index 3b58177..b398141 100644 --- a/pkg/version/version +++ b/pkg/version/version @@ -1 +1 @@ -v0.56.8 +v0.56.9