From 183c83c17705c860200313dd6f24efc89fa2350f Mon Sep 17 00:00:00 2001 From: tajniak81 <13187254+tajniak81@users.noreply.github.com> Date: Thu, 16 Jul 2026 18:36:14 +0200 Subject: [PATCH] Stop reporting the flight controller's serial as the drone's MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit getSerialNumber() is a BaseComponent method, so every component answers for itself — and the bridge reads it off the flight controller. A Mavic Pro reports 08RDE1J00103H1 (what DJI Go labels "Flight Controller SN") where the airframe sticker, and the registration, say 08QDE3H012032E. We were publishing the former as the drone's serial, onto records that exist to satisfy BEK 1649 §5. Same trap as 002e484, where a component's own firmware stood in for the aircraft's, but with no correct source to switch to: MSDK v4 exposes no aircraft-level serial at all — BaseProduct offers only the model and the firmware package version — so the registered serial can only be typed by hand. So split the two rather than pick one: serial the airframe's, hand-entered, and the only one that reaches the logbook and the CSV export flight_controller_serial what the aircraft reports; auto-filled on connect, and what POST /api/drones/auto now upserts on Keying auto-add on the flight controller's serial keeps the fleet recognising a connected drone without typing — it is stable per airframe — while leaving the compliance record's serial to the pilot. A flight controller swapped in a repair now costs a duplicate fleet entry to merge, where before it would have quietly rewritten what the logbook claimed the drone was. Note droneInput.payload() is a whole-record write, so any UI editing a drone must round-trip flightControllerSerial; blanking it forks the drone into a duplicate on its next connect. Drones.vue carries it through the edit form for that reason. The migration copies existing serials into flight_controller_serial rather than moving them: every current value came from auto-add and is therefore a flight controller's, but a pilot may since have corrected one by hand and this cannot tell them apart. Copying keeps auto-add matching the airframes it matched before. Applied to the remote PocketBase, where drones held no records, so the backfill was a no-op there. Co-Authored-By: Claude Opus 4.8 --- API Server/internal/api/logbook.go | 185 ++++++++++-------- API Server/internal/hub/hub.go | 2 +- API Server/internal/hub/models.go | 21 +- ...20301000_split_flight_controller_serial.js | 72 +++++++ .../flutter/dji_msdk_sample/DjiSdkBridge.kt | 42 ++-- Fly App/lib/flight_model.dart | 6 +- Fly App/lib/main.dart | 7 +- Fly App/lib/ui/settings_menu_page.dart | 2 +- ...{index-DgA6j1AP.css => index-Bw3iqrF-.css} | 2 +- .../{index-DrzdlcUJ.js => index-DwyUIzSZ.js} | 2 +- Web App/server/dist/index.html | 4 +- Web App/web/src/api.js | 7 +- Web App/web/src/components/Dashboard.vue | 39 ++-- Web App/web/src/components/Drones.vue | 45 +++-- 14 files changed, 297 insertions(+), 139 deletions(-) create mode 100644 API Server/pocketbase/pb_migrations/1720301000_split_flight_controller_serial.js rename Web App/server/dist/assets/{index-DgA6j1AP.css => index-Bw3iqrF-.css} (53%) rename Web App/server/dist/assets/{index-DrzdlcUJ.js => index-DwyUIzSZ.js} (86%) diff --git a/API Server/internal/api/logbook.go b/API Server/internal/api/logbook.go index 0438aa0..a026754 100644 --- a/API Server/internal/api/logbook.go +++ b/API Server/internal/api/logbook.go @@ -34,56 +34,70 @@ func (s *Server) requireUser(next http.HandlerFunc) http.HandlerFunc { // --------------------------------------------------------------------------- type droneRecord struct { - ID string `json:"id"` - Name string `json:"name"` // pilot's custom label; blank on auto-added drones - Model string `json:"model"` - Serial string `json:"serial"` - Firmware string `json:"firmware"` - ControllerFirmware string `json:"controller_firmware"` - Registration string `json:"registration"` - OperatorNumber string `json:"operator_number"` - MtomGrams float64 `json:"mtom_grams"` - IsToy bool `json:"is_toy"` - AutologsFlights bool `json:"autologs_flights"` - CClass string `json:"c_class"` - Organization string `json:"organization"` - Created string `json:"created"` - Updated string `json:"updated"` + ID string `json:"id"` + Name string `json:"name"` // pilot's custom label; blank on auto-added drones + Model string `json:"model"` + // Serial is the number on the airframe — what the drone is registered under. + // The SDK cannot read it (see FlightControllerSerial), so it is hand-entered. + Serial string `json:"serial"` + // FlightControllerSerial is the only serial a connected aircraft reports, and + // so is what the auto-add path keys on. Stable per airframe, but not the + // registered serial and never shown as one. + FlightControllerSerial string `json:"flight_controller_serial"` + Firmware string `json:"firmware"` + ControllerFirmware string `json:"controller_firmware"` + Registration string `json:"registration"` + OperatorNumber string `json:"operator_number"` + MtomGrams float64 `json:"mtom_grams"` + IsToy bool `json:"is_toy"` + AutologsFlights bool `json:"autologs_flights"` + CClass string `json:"c_class"` + Organization string `json:"organization"` + Created string `json:"created"` + Updated string `json:"updated"` } type droneView struct { - ID string `json:"id"` - Name string `json:"name"` - DisplayName string `json:"displayName"` - Model string `json:"model"` - Serial string `json:"serial"` - Firmware string `json:"firmware"` - ControllerFirmware string `json:"controllerFirmware"` - Registration string `json:"registration"` - OperatorNumber string `json:"operatorNumber"` - MtomGrams float64 `json:"mtomGrams"` - IsToy bool `json:"isToy"` - AutologsFlights bool `json:"autologsFlights"` - CClass string `json:"cClass"` - Organization string `json:"organization"` - Created string `json:"created"` + ID string `json:"id"` + Name string `json:"name"` + DisplayName string `json:"displayName"` + Model string `json:"model"` + Serial string `json:"serial"` + FlightControllerSerial string `json:"flightControllerSerial"` + Firmware string `json:"firmware"` + ControllerFirmware string `json:"controllerFirmware"` + Registration string `json:"registration"` + OperatorNumber string `json:"operatorNumber"` + MtomGrams float64 `json:"mtomGrams"` + IsToy bool `json:"isToy"` + AutologsFlights bool `json:"autologsFlights"` + CClass string `json:"cClass"` + Organization string `json:"organization"` + Created string `json:"created"` } // displayName is what to call the drone in lists, logbook entries and the CSV // export. The custom name wins; a drone auto-added on connection has none, so // fall back to what the aircraft reported about itself. func (d droneRecord) displayName() string { + // The airframe serial identifies the drone to a human, so it is preferred — + // but only the pilot can supply it, and an auto-added entry has nothing but + // the flight controller's, which is better than no distinguisher at all. + serial := strings.TrimSpace(d.Serial) + if serial == "" { + serial = strings.TrimSpace(d.FlightControllerSerial) + } if n := strings.TrimSpace(d.Name); n != "" { return n } if m := strings.TrimSpace(d.Model); m != "" { - if s := strings.TrimSpace(d.Serial); s != "" { - return m + " · " + s + if serial != "" { + return m + " · " + serial } return m } - if s := strings.TrimSpace(d.Serial); s != "" { - return s + if serial != "" { + return serial } return "Unnamed drone" } @@ -91,7 +105,8 @@ func (d droneRecord) displayName() string { func (d droneRecord) view() droneView { return droneView{ ID: d.ID, Name: d.Name, DisplayName: d.displayName(), Model: d.Model, Serial: d.Serial, - Firmware: d.Firmware, ControllerFirmware: d.ControllerFirmware, + FlightControllerSerial: d.FlightControllerSerial, + Firmware: d.Firmware, ControllerFirmware: d.ControllerFirmware, Registration: d.Registration, OperatorNumber: d.OperatorNumber, MtomGrams: d.MtomGrams, IsToy: d.IsToy, AutologsFlights: d.AutologsFlights, CClass: d.CClass, @@ -419,18 +434,19 @@ func (s *Server) handleListDrones(w http.ResponseWriter, r *http.Request) { } type droneInput struct { - Name string `json:"name"` // custom label; optional - Model string `json:"model"` - Serial string `json:"serial"` - Firmware string `json:"firmware"` - ControllerFirmware string `json:"controllerFirmware"` - Registration string `json:"registration"` - OperatorNumber string `json:"operatorNumber"` - MtomGrams float64 `json:"mtomGrams"` - IsToy bool `json:"isToy"` - AutologsFlights bool `json:"autologsFlights"` - CClass string `json:"cClass"` - Organization *string `json:"organization"` // superadmin may target any org + Name string `json:"name"` // custom label; optional + Model string `json:"model"` + Serial string `json:"serial"` + FlightControllerSerial string `json:"flightControllerSerial"` + Firmware string `json:"firmware"` + ControllerFirmware string `json:"controllerFirmware"` + Registration string `json:"registration"` + OperatorNumber string `json:"operatorNumber"` + MtomGrams float64 `json:"mtomGrams"` + IsToy bool `json:"isToy"` + AutologsFlights bool `json:"autologsFlights"` + CClass string `json:"cClass"` + Organization *string `json:"organization"` // superadmin may target any org } func (in droneInput) payload(who *callerIdentity) map[string]any { @@ -439,18 +455,19 @@ func (in droneInput) payload(who *callerIdentity) map[string]any { org = strings.TrimSpace(*in.Organization) } return map[string]any{ - "name": strings.TrimSpace(in.Name), - "model": strings.TrimSpace(in.Model), - "serial": strings.TrimSpace(in.Serial), - "firmware": strings.TrimSpace(in.Firmware), - "controller_firmware": strings.TrimSpace(in.ControllerFirmware), - "registration": strings.TrimSpace(in.Registration), - "operator_number": strings.TrimSpace(in.OperatorNumber), - "mtom_grams": in.MtomGrams, - "is_toy": in.IsToy, - "autologs_flights": in.AutologsFlights, - "c_class": strings.TrimSpace(in.CClass), - "organization": org, + "name": strings.TrimSpace(in.Name), + "model": strings.TrimSpace(in.Model), + "serial": strings.TrimSpace(in.Serial), + "flight_controller_serial": strings.TrimSpace(in.FlightControllerSerial), + "firmware": strings.TrimSpace(in.Firmware), + "controller_firmware": strings.TrimSpace(in.ControllerFirmware), + "registration": strings.TrimSpace(in.Registration), + "operator_number": strings.TrimSpace(in.OperatorNumber), + "mtom_grams": in.MtomGrams, + "is_toy": in.IsToy, + "autologs_flights": in.AutologsFlights, + "c_class": strings.TrimSpace(in.CClass), + "organization": org, } } @@ -460,7 +477,8 @@ func (in droneInput) payload(who *callerIdentity) map[string]any { func (in droneInput) identifiable() bool { return strings.TrimSpace(in.Name) != "" || strings.TrimSpace(in.Model) != "" || - strings.TrimSpace(in.Serial) != "" + strings.TrimSpace(in.Serial) != "" || + strings.TrimSpace(in.FlightControllerSerial) != "" } // POST /api/drones — register a drone (assigned to the caller's org). @@ -494,20 +512,22 @@ func (s *Server) handleCreateDrone(w http.ResponseWriter, r *http.Request) { // Everything the pilot curates by hand (custom name, registration, MTOM, class) // is deliberately absent — the auto path never touches those. type autoDroneInput struct { - Model string `json:"model"` - Serial string `json:"serial"` - Firmware string `json:"firmware"` - ControllerFirmware string `json:"controllerFirmware"` + Model string `json:"model"` + // The airframe serial is absent by design: the SDK cannot read it, so an + // aircraft can only report its flight controller's. + FlightControllerSerial string `json:"flightControllerSerial"` + Firmware string `json:"firmware"` + ControllerFirmware string `json:"controllerFirmware"` } -// findDroneBySerial looks a drone up across *all* orgs, ignoring caller scope: -// the serial is unique per airframe, so the caller's own scope is not enough to -// know whether the record already exists. -func (s *Server) findDroneBySerial(ctx context.Context, serial string) (droneRecord, bool, error) { +// findDroneByFCSerial looks a drone up across *all* orgs, ignoring caller scope: +// the flight controller's serial is unique per airframe, so the caller's own +// scope is not enough to know whether the record already exists. +func (s *Server) findDroneByFCSerial(ctx context.Context, fcSerial string) (droneRecord, bool, error) { var list struct { Items []droneRecord `json:"items"` } - filter := "serial = " + strconv.Quote(serial) + filter := "flight_controller_serial = " + strconv.Quote(fcSerial) if _, err := s.listRecords(ctx, "drones", filter, "created", &list); err != nil { return droneRecord{}, false, err } @@ -518,8 +538,15 @@ func (s *Server) findDroneBySerial(ctx context.Context, serial string) (droneRec } // POST /api/drones/auto — upsert the drone the caller just connected, keyed by -// serial. Called by the Web App when a device reports a connected aircraft, so -// the fleet fills itself in without the pilot typing anything. +// the flight controller's serial. Called by the Web App when a device reports a +// connected aircraft, so the fleet fills itself in without the pilot typing +// anything. +// +// It keys on the flight controller's serial rather than the airframe's because +// that is the only one an aircraft reports (MSDK v4 exposes no aircraft-level +// serial). The airframe serial — the registered one — stays blank here for the +// pilot to fill in on the Drones tab; guessing it from the flight controller's +// would put a wrong number on a compliance record. // // Idempotent by design: it runs on every connection event, so an existing entry // is refreshed (firmware changes as the pilot updates the aircraft) rather than @@ -531,15 +558,15 @@ func (s *Server) handleAutoDrone(w http.ResponseWriter, r *http.Request) { writeError(w, http.StatusBadRequest, "invalid json") return } - serial := strings.TrimSpace(in.Serial) - if serial == "" { + fcSerial := strings.TrimSpace(in.FlightControllerSerial) + if fcSerial == "" { // No serial means no stable identity to key on — auto-adding here would // mint a fresh drone on every reconnect. - writeError(w, http.StatusBadRequest, "serial is required to auto-add a drone") + writeError(w, http.StatusBadRequest, "flightControllerSerial is required to auto-add a drone") return } - existing, found, err := s.findDroneBySerial(r.Context(), serial) + existing, found, err := s.findDroneByFCSerial(r.Context(), fcSerial) if err != nil { gatewayError(w, err) return @@ -586,10 +613,10 @@ func (s *Server) handleAutoDrone(w http.ResponseWriter, r *http.Request) { // New airframe: record what it reported and leave the curated fields blank // for the pilot to fill in on the Drones tab. payload := droneInput{ - Model: strings.TrimSpace(in.Model), - Serial: serial, - Firmware: strings.TrimSpace(in.Firmware), - ControllerFirmware: strings.TrimSpace(in.ControllerFirmware), + Model: strings.TrimSpace(in.Model), + FlightControllerSerial: fcSerial, + Firmware: strings.TrimSpace(in.Firmware), + ControllerFirmware: strings.TrimSpace(in.ControllerFirmware), }.payload(who) data, status, err := s.admin.do(r.Context(), http.MethodPost, "/api/collections/drones/records", payload) if err != nil { diff --git a/API Server/internal/hub/hub.go b/API Server/internal/hub/hub.go index 212e597..73471bc 100644 --- a/API Server/internal/hub/hub.go +++ b/API Server/internal/hub/hub.go @@ -182,7 +182,7 @@ func (h *Hub) Ingest(deviceID string, raw map[string]any) { s.Connected = c if !c { s.Telemetry = Telemetry{} // drone unlinked: live telemetry is no longer valid - s.Serial, s.Firmware, s.ControllerFirmware = "", "", "" + s.FlightControllerSerial, s.Firmware, s.ControllerFirmware = "", "", "" } } if m, ok := raw["model"].(string); ok { diff --git a/API Server/internal/hub/models.go b/API Server/internal/hub/models.go index aecc5a8..f2b46a8 100644 --- a/API Server/internal/hub/models.go +++ b/API Server/internal/hub/models.go @@ -31,14 +31,19 @@ type DeviceState struct { // ("success", "failed", …) — not the aircraft's FAA/CAA registration number, // which lives on the drone's logbook record. Registration string `json:"registration"` - // Identity of the connected aircraft, as it reports itself. Serial and the + // Identity of the connected aircraft, as it reports itself. The serial and the // two firmware versions resolve asynchronously after connect, each on its own // schedule, so these fill in over several events rather than all at once. - Serial string `json:"serial"` - Firmware string `json:"firmware"` - ControllerFirmware string `json:"controllerFirmware"` - Telemetry Telemetry `json:"telemetry"` - LastSeenMs int64 `json:"lastSeenMs"` + // + // FlightControllerSerial is the flight controller's own serial, not the number + // on the airframe: MSDK v4 exposes no aircraft-level serial, so the serial a + // drone is *registered* under is hand-entered on its logbook record instead. + // It is nonetheless stable per airframe, which is what the fleet auto-add keys on. + FlightControllerSerial string `json:"flightControllerSerial"` + Firmware string `json:"firmware"` + ControllerFirmware string `json:"controllerFirmware"` + Telemetry Telemetry `json:"telemetry"` + LastSeenMs int64 `json:"lastSeenMs"` } // TrackPoint is one sample of the drone's GPS track (for the map trail). @@ -98,8 +103,8 @@ func toInt(v any) (int, bool) { // answers serial in seconds but firmware can take far longer — so an absent // value never clears one an earlier event already delivered. func applyIdentity(s *DeviceState, raw map[string]any) { - if v, ok := raw["serial"].(string); ok && v != "" { - s.Serial = v + if v, ok := raw["flightControllerSerial"].(string); ok && v != "" { + s.FlightControllerSerial = v } if v, ok := raw["firmware"].(string); ok && v != "" { s.Firmware = v diff --git a/API Server/pocketbase/pb_migrations/1720301000_split_flight_controller_serial.js b/API Server/pocketbase/pb_migrations/1720301000_split_flight_controller_serial.js new file mode 100644 index 0000000..934a0a8 --- /dev/null +++ b/API Server/pocketbase/pb_migrations/1720301000_split_flight_controller_serial.js @@ -0,0 +1,72 @@ +/// + +// Splits the drone's serial in two, because the app had been conflating them. +// +// `getSerialNumber` in MSDK v4 is a `BaseComponent` method: every component +// answers for itself, and the Fly App reads it off the *flight controller*. So +// what a connected aircraft reports — and what auto-add has been storing in +// `serial` — is the flight controller's number, not the one on the airframe's +// sticker that the drone is registered under. On a Mavic Pro the aircraft says +// 08RDE1J00103H1 where the sticker reads 08QDE3H012032E. There is no fix on the +// SDK side: MSDK v4 exposes no aircraft-level serial at all, so the registered +// serial can only ever be typed in by the pilot. (Same trap as the firmware +// versions in 1720300900 — a component reporting its own value, taken for the +// aircraft's — but with no correct source to switch to.) +// +// After this: +// - serial the airframe sticker's number — hand-entered, +// and the one that belongs on a compliance record +// - flight_controller_serial what the aircraft reports; auto-filled, and the +// key POST /api/drones/auto upserts on +// +// Existing values are *copied* into `flight_controller_serial`, not moved: every +// non-empty `serial` today came from auto-add and is therefore a flight +// controller's, but a pilot may since have corrected one by hand, and this +// cannot tell the two apart. Copying keeps auto-add matching the same airframes +// it matched before (a cleared key would fork every drone into a duplicate on +// its next connect) and loses nothing; the Drones tab shows both numbers, so a +// `serial` still holding a flight controller's is visible and correctable. +// +// Apply by copying into your PocketBase deployment's `pb_migrations/` directory +// and restarting. Written for PocketBase v0.22+/v0.23. Idempotent: the field is +// added only if absent and the backfill only writes records whose +// `flight_controller_serial` is still empty, so re-running is a no-op. +// +// Depends on 1720300900_add_drone_identity.js (idx_drones_serial). +migrate( + (app) => { + const drones = app.findCollectionByNameOrId('drones') + + if (!drones.fields.find((f) => f.name === 'flight_controller_serial')) { + drones.fields.add(new Field({ name: 'flight_controller_serial', type: 'text', max: 120 })) + } + + // One fleet entry per airframe, enforced on both numbers: auto-add keys on + // the flight controller's, so a duplicate there would fork a drone's history + // across two records — the reason idx_drones_serial existed in the first + // place. The airframe serial stays unique too, now on its own terms. + const idx = + 'CREATE UNIQUE INDEX `idx_drones_fc_serial` ON `drones` (`flight_controller_serial`)' + + " WHERE `flight_controller_serial` != ''" + if (!drones.indexes.find((i) => i.includes('idx_drones_fc_serial'))) drones.indexes.push(idx) + + app.save(drones) + + // Backfill: today's `serial` values are what auto-add stored, i.e. flight + // controllers'. Copy them across so connected drones keep matching their + // existing fleet entry. + for (const rec of app.findAllRecords('drones')) { + const serial = (rec.getString('serial') || '').trim() + if (!serial || (rec.getString('flight_controller_serial') || '').trim()) continue + rec.set('flight_controller_serial', serial) + app.save(rec) + } + }, + (app) => { + const drones = app.findCollectionByNameOrId('drones') + const f = drones.fields.find((x) => x.name === 'flight_controller_serial') + if (f) drones.fields.removeById(f.id) + drones.indexes = drones.indexes.filter((i) => !i.includes('idx_drones_fc_serial')) + app.save(drones) + }, +) diff --git a/Fly App/android/app/src/main/kotlin/com/dji/flutter/dji_msdk_sample/DjiSdkBridge.kt b/Fly App/android/app/src/main/kotlin/com/dji/flutter/dji_msdk_sample/DjiSdkBridge.kt index 84627a2..5e20f30 100644 --- a/Fly App/android/app/src/main/kotlin/com/dji/flutter/dji_msdk_sample/DjiSdkBridge.kt +++ b/Fly App/android/app/src/main/kotlin/com/dji/flutter/dji_msdk_sample/DjiSdkBridge.kt @@ -56,11 +56,24 @@ class DjiSdkBridge( private var eventSink: EventChannel.EventSink? = null /** - * Aircraft identity, resolved asynchronously after connect (see [fetchIdentity]) - * and cached so [connectionMap] can answer `getProductInfo` without re-fetching. - * Volatile: written from the SDK's callback threads, read from the main thread. + * The *flight controller's* serial number — not the aircraft's. + * + * `getSerialNumber` is a `BaseComponent` method, so every component answers for + * itself, and this one is read off the flight controller: on a Mavic Pro it + * returns 08RDE1J00103H1 where the airframe sticker says 08QDE3H012032E (the + * same number DJI Go shows as "Flight Controller SN"). MSDK v4 exposes no + * aircraft-level serial at all — `BaseProduct` offers only the model and the + * firmware package version — so the airframe serial the pilot registers with + * cannot be read over the SDK and is typed by hand in the Web App instead. + * + * Still worth publishing: it is stable per airframe (short of swapping the + * flight controller), which is what the fleet's auto-add keys on. + * + * Resolved asynchronously after connect (see [fetchIdentity]) and cached so + * [connectionMap] can answer `getProductInfo` without re-fetching. Volatile: + * written from the SDK's callback threads, read from the main thread. */ - @Volatile private var serialNumber: String? = null + @Volatile private var flightControllerSerial: String? = null @Volatile private var firmwareVersion: String? = null @@ -215,7 +228,7 @@ class DjiSdkBridge( "model" to model, "firmware" to (product?.firmwarePackageVersion ?: firmwareVersion), "controllerFirmware" to controllerFirmwareVersion, - "serial" to serialNumber, + "flightControllerSerial" to flightControllerSerial, ) } @@ -243,7 +256,7 @@ class DjiSdkBridge( * worst case is dropping a just-resolved value that the retry chain re-fetches. */ private fun resetIdentityCache() { - serialNumber = null + flightControllerSerial = null firmwareVersion = null controllerFirmwareVersion = null } @@ -252,14 +265,15 @@ class DjiSdkBridge( private fun clearIdentity() { mainHandler.post { identityGeneration++ - serialNumber = null + flightControllerSerial = null firmwareVersion = null controllerFirmwareVersion = null } } /** - * Resolves the aircraft's serial number and firmware version. + * Resolves the flight controller's serial number and the aircraft's firmware + * version. (The airframe serial is not among them — see [flightControllerSerial].) * * Neither is readable the instant a product connects — `getFirmwarePackageVersion` * returns null and the flight controller's callbacks fail until the SDK has @@ -284,13 +298,15 @@ class DjiSdkBridge( val controller = (product as? Aircraft)?.flightController if (controller != null) { - if (serialNumber == null) { + if (flightControllerSerial == null) { + // Answers for the flight controller itself, not the airframe — see + // [flightControllerSerial] for why there is no aircraft-level source. controller.getSerialNumber(object : CommonCallbacks.CompletionCallbackWith { override fun onSuccess(value: String?) { if (value.isNullOrBlank()) return mainHandler.post { - if (generation != identityGeneration || serialNumber == value) return@post - serialNumber = value + if (generation != identityGeneration || flightControllerSerial == value) return@post + flightControllerSerial = value emitIdentity() } } @@ -325,7 +341,7 @@ class DjiSdkBridge( ) } - val pending = serialNumber == null || firmwareVersion == null || controllerFirmwareVersion == null + val pending = flightControllerSerial == null || firmwareVersion == null || controllerFirmwareVersion == null if (pending && attempt + 1 < IDENTITY_MAX_ATTEMPTS) { mainHandler.postDelayed({ fetchIdentity(generation, attempt + 1) }, IDENTITY_RETRY_MS) } @@ -342,7 +358,7 @@ class DjiSdkBridge( emit( mapOf( "type" to "identity", - "serial" to serialNumber, + "flightControllerSerial" to flightControllerSerial, "firmware" to firmwareVersion, "controllerFirmware" to controllerFirmwareVersion, ) diff --git a/Fly App/lib/flight_model.dart b/Fly App/lib/flight_model.dart index 20f94dd..75cdf4f 100644 --- a/Fly App/lib/flight_model.dart +++ b/Fly App/lib/flight_model.dart @@ -71,7 +71,11 @@ class FlightModel extends ChangeNotifier { String? firmwareVersion; /// The remote controller's own firmware — distinct from the aircraft's above. String? controllerFirmwareVersion; - String? serialNumber; + + /// The *flight controller's* serial, which is the only serial MSDK v4 exposes — + /// the airframe serial on the sticker (the one a drone is registered under) is + /// unreadable over the SDK and is entered by hand in the Web App's fleet. + String? flightControllerSerial; // ── Flight controller telemetry ──────────────────────────────────────────── int? satellites; diff --git a/Fly App/lib/main.dart b/Fly App/lib/main.dart index 5ba2acc..054ca67 100644 --- a/Fly App/lib/main.dart +++ b/Fly App/lib/main.dart @@ -154,7 +154,7 @@ class _HomePageState extends State { _model.model = event['model'] as String?; _model.firmwareVersion = event['firmware'] as String?; _model.controllerFirmwareVersion = event['controllerFirmware'] as String?; - _model.serialNumber = event['serial'] as String?; + _model.flightControllerSerial = event['flightControllerSerial'] as String?; if (!_model.connected) _clearTelemetry(); _model.bump(); break; @@ -163,7 +163,8 @@ class _HomePageState extends State { // own schedule, so a null here means "not resolved yet" — never a reason // to drop a value the previous identity event already delivered. if (!_model.connected) break; - _model.serialNumber = event['serial'] as String? ?? _model.serialNumber; + _model.flightControllerSerial = + event['flightControllerSerial'] as String? ?? _model.flightControllerSerial; _model.firmwareVersion = event['firmware'] as String? ?? _model.firmwareVersion; _model.controllerFirmwareVersion = event['controllerFirmware'] as String? ?? _model.controllerFirmwareVersion; @@ -272,7 +273,7 @@ class _HomePageState extends State { _model.recordSeconds = 0; _model.firmwareVersion = null; _model.controllerFirmwareVersion = null; - _model.serialNumber = null; + _model.flightControllerSerial = null; } Future _register() async { diff --git a/Fly App/lib/ui/settings_menu_page.dart b/Fly App/lib/ui/settings_menu_page.dart index 52e35f0..35276d3 100644 --- a/Fly App/lib/ui/settings_menu_page.dart +++ b/Fly App/lib/ui/settings_menu_page.dart @@ -134,7 +134,7 @@ class _SettingsMenuPageState extends State { 3 => ('Transmission', _infoRows(<(String, String)>[('Channel Mode', 'Auto'), ('Frequency', '2.4 / 5.8 GHz'), ('Signal', 'HD 1080p')])), _ => ('About', _infoRows(<(String, String)>[ ('Model', _m.model ?? '—'), - ('Serial Number', _m.serialNumber ?? '—'), + ('Flight Controller SN', _m.flightControllerSerial ?? '—'), ('Firmware', _m.firmwareVersion ?? '—'), ('Controller Firmware', _m.controllerFirmwareVersion ?? '—'), ('MSDK', _m.sdkVersion), diff --git a/Web App/server/dist/assets/index-DgA6j1AP.css b/Web App/server/dist/assets/index-Bw3iqrF-.css similarity index 53% rename from Web App/server/dist/assets/index-DgA6j1AP.css rename to Web App/server/dist/assets/index-Bw3iqrF-.css index 5c4eb41..8c2ba28 100644 --- a/Web App/server/dist/assets/index-DgA6j1AP.css +++ b/Web App/server/dist/assets/index-Bw3iqrF-.css @@ -1 +1 @@ -:root,[data-theme=light]{--navy-950: #0B1730;--navy-900: #0F1E3D;--navy-800: #1B2E52;--navy-700: #26406E;--blue-50: #EAF1FE;--blue-100: #D6E3FD;--blue-200: #B4CDFA;--blue-300: #8FB4F6;--blue-400: #5B93F5;--blue-500: #3D7BF0;--blue-600: #2B62CC;--blue-700: #1F4CA0;--slate-0: #FFFFFF;--slate-50: #F6F7F9;--slate-100: #EEF0F3;--slate-150: #E6E9EE;--slate-200: #DCE0E7;--slate-300: #C5CCD7;--slate-400: #97A1B0;--slate-500: #6B7688;--slate-600: #4C5566;--slate-700: #333B4A;--slate-800: #1E2635;--slate-900: #131A28;--slate-950: #0B111C;--steel: #5A6B85;--green-500: #1F8A5B;--green-100: #DCF1E7;--green-600:#177049;--amber-500: #D9852B;--amber-100: #FBEBD5;--amber-600:#B86C1B;--red-500: #D64545;--red-100: #FBE0E0;--red-600: #B83232;--bg-app: var(--slate-100);--bg-subtle: var(--slate-50);--surface: var(--slate-0);--surface-2: var(--slate-50);--surface-inset: var(--slate-100);--border: var(--slate-200);--border-strong: var(--slate-300);--border-subtle: var(--slate-150);--text-primary: var(--navy-900);--text-secondary:var(--steel);--text-tertiary: var(--slate-400);--text-inverse: var(--slate-0);--text-on-accent:#FFFFFF;--accent: var(--blue-500);--accent-hover: var(--blue-600);--accent-active: var(--blue-700);--accent-soft: var(--blue-50);--accent-soft-fg:var(--blue-700);--focus-ring: color-mix(in srgb, var(--blue-500) 45%, transparent);--success: var(--green-500);--success-soft: var(--green-100);--success-fg: var(--green-600);--warning: var(--amber-500);--warning-soft: var(--amber-100);--warning-fg: var(--amber-600);--danger: var(--red-500);--danger-soft: var(--red-100);--danger-fg: var(--red-600);--overlay: color-mix(in srgb, var(--navy-950) 55%, transparent);--font-sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;--font-mono: "Space Mono", ui-monospace, "SF Mono", "JetBrains Mono", monospace;--radius-xs: 4px;--radius-sm: 6px;--radius-md: 10px;--radius-lg: 14px;--radius-xl: 20px;--radius-pill: 999px;--shadow-xs: 0 1px 2px rgba(15,30,61,.06);--shadow-sm: 0 1px 2px rgba(15,30,61,.06), 0 1px 3px rgba(15,30,61,.04);--shadow-md: 0 2px 4px rgba(15,30,61,.06), 0 6px 16px rgba(15,30,61,.08);--shadow-lg: 0 8px 24px rgba(15,30,61,.1), 0 2px 6px rgba(15,30,61,.06);--ease-standard: cubic-bezier(.4, 0, .2, 1);--ease-out: cubic-bezier(.16, 1, .3, 1);--dur-fast: .12s;--dur-base: .2s;color-scheme:light}[data-theme=dark]{--bg-app: var(--navy-950);--bg-subtle: var(--slate-950);--surface: #10203F;--surface-2: #142748;--surface-inset: var(--navy-950);--border: color-mix(in srgb, #FFFFFF 10%, transparent);--border-strong: color-mix(in srgb, #FFFFFF 18%, transparent);--border-subtle: color-mix(in srgb, #FFFFFF 6%, transparent);--text-primary: #F4F7FC;--text-secondary:#8FA0BE;--text-tertiary: #5E6E8C;--text-inverse: var(--navy-900);--text-on-accent:#FFFFFF;--accent: var(--blue-400);--accent-hover: var(--blue-300);--accent-active: var(--blue-200);--accent-soft: color-mix(in srgb, var(--blue-500) 18%, transparent);--accent-soft-fg:var(--blue-300);--focus-ring: color-mix(in srgb, var(--blue-400) 55%, transparent);--success:var(--green-500);--success-soft: color-mix(in srgb, var(--green-500) 22%, transparent);--success-fg:#5FD3A0;--warning:var(--amber-500);--warning-soft: color-mix(in srgb, var(--amber-500) 22%, transparent);--warning-fg:#F0B26A;--danger: var(--red-500);--danger-soft: color-mix(in srgb, var(--red-500) 22%, transparent);--danger-fg: #F08A8A;--overlay: color-mix(in srgb, #000000 62%, transparent);--shadow-xs: 0 1px 2px rgba(0,0,0,.35);--shadow-sm: 0 1px 3px rgba(0,0,0,.4);--shadow-md: 0 4px 12px rgba(0,0,0,.45);--shadow-lg: 0 12px 32px rgba(0,0,0,.5);color-scheme:dark}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Space Grotesk,ui-sans-serif,system-ui,-apple-system,Segoe UI,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:Space Mono,ui-monospace,SF Mono,JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.tabular{font-variant-numeric:tabular-nums}.eyebrow{font-family:Space Mono,ui-monospace,SF Mono,JetBrains Mono,monospace;font-size:11px;text-transform:uppercase;letter-spacing:.14em;color:var(--text-tertiary)}.readout{font-variant-numeric:tabular-nums;font-family:Space Mono,ui-monospace,SF Mono,JetBrains Mono,monospace;font-size:30px;line-height:1;font-weight:500;color:var(--text-primary)}.panel{border-radius:14px;border-width:1px;border-color:var(--border);background-color:var(--surface);--tw-shadow: var(--shadow-xs);--tw-shadow-colored: var(--shadow-xs);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.pill{border-radius:10px;border-width:1px;border-color:var(--border);background-color:var(--surface-2);padding:.5rem .75rem}.field{width:100%;border-radius:10px;border-width:1px;border-color:var(--border);background-color:var(--surface-2);padding:.625rem .75rem;font-size:.875rem;line-height:1.25rem;color:var(--text-primary);outline:2px solid transparent;outline-offset:2px;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.field::-moz-placeholder{color:var(--text-tertiary)}.field::placeholder{color:var(--text-tertiary)}.field{transition-duration:var(--dur-fast)}.field:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--focus-ring)}.btn-accent{border-radius:10px;background-color:var(--accent);padding:.625rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:600;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.btn-accent:hover{background-color:var(--accent-hover)}.btn-accent:active{--tw-translate-y: 1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.btn-accent:disabled{opacity:.5}.btn-accent{transition-duration:var(--dur-fast)}.btn-ghost{border-radius:10px;border-width:1px;border-color:var(--border);background-color:var(--surface);padding:.375rem .75rem;font-size:.875rem;line-height:1.25rem;color:var(--text-secondary);transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.btn-ghost:hover{border-color:var(--border-strong);color:var(--text-primary)}.btn-ghost:active{--tw-translate-y: 1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.btn-ghost{transition-duration:var(--dur-fast)}.btn-icon{display:grid;height:2.25rem;width:2.25rem;place-items:center;border-radius:10px;border-width:1px;border-color:var(--border);background-color:var(--surface);color:var(--text-secondary);transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.btn-icon:hover{border-color:var(--border-strong);color:var(--text-primary)}.btn-icon{transition-duration:var(--dur-fast)}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{top:0;bottom:0}.bottom-5{bottom:1.25rem}.right-0{right:0}.right-5{right:1.25rem}.top-0{top:0}.top-5{top:1.25rem}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[1190\]{z-index:1190}.z-\[1200\]{z-index:1200}.col-span-2{grid-column:span 2 / span 2}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-2\.5{margin-bottom:.625rem}.mb-3{margin-bottom:.75rem}.mb-3\.5{margin-bottom:.875rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-2\.5{margin-top:.625rem}.mt-3{margin-top:.75rem}.mt-3\.5{margin-top:.875rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.mt-px{margin-top:1px}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-28{height:7rem}.h-4{height:1rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[180px\]{height:180px}.h-\[18px\]{height:18px}.h-\[320px\]{height:320px}.h-\[74vh\]{height:74vh}.h-full{height:100%}.max-h-\[90vh\]{max-height:90vh}.min-h-\[16px\]{min-height:16px}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-24{width:6rem}.w-28{width:7rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-44{width:11rem}.w-48{width:12rem}.w-56{width:14rem}.w-60{width:15rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[18px\]{width:18px}.w-\[380px\]{width:380px}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-\[1240px\]{max-width:1240px}.max-w-\[1280px\]{max-width:1280px}.max-w-\[220px\]{max-width:220px}.max-w-\[280px\]{max-width:280px}.max-w-\[360px\]{max-width:360px}.max-w-\[420px\]{max-width:420px}.max-w-\[520px\]{max-width:520px}.max-w-\[920px\]{max-width:920px}.max-w-full{max-width:100%}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.translate-x-1{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-6{--tw-translate-x: 1.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-\[1\.6fr_1fr\]{grid-template-columns:1.6fr 1fr}.grid-cols-\[210px_1fr\]{grid-template-columns:210px 1fr}.grid-cols-\[248px_1fr\]{grid-template-columns:248px 1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-x-8{-moz-column-gap:2rem;column-gap:2rem}.gap-y-1\.5{row-gap:.375rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded,.rounded-\[10px\]{border-radius:10px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:14px}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-0{border-width:0px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-r{border-right-width:1px}.border-none{border-style:none}.border-accent{border-color:var(--accent)}.border-line{border-color:var(--border)}.border-line-strong{border-color:var(--border-strong)}.border-transparent{border-color:transparent}.bg-\[var\(--navy-800\)\]{background-color:var(--navy-800)}.bg-accent{background-color:var(--accent)}.bg-accent-soft{background-color:var(--accent-soft)}.bg-amber{background-color:var(--warning)}.bg-amber-soft{background-color:var(--warning-soft)}.bg-caution{background-color:var(--warning)}.bg-current{background-color:currentColor}.bg-danger{background-color:var(--danger)}.bg-danger-soft{background-color:var(--danger-soft)}.bg-ink-muted{background-color:var(--text-tertiary)}.bg-line{background-color:var(--border)}.bg-ready,.bg-success{background-color:var(--success)}.bg-success-soft{background-color:var(--success-soft)}.bg-surface-1{background-color:var(--surface)}.bg-surface-2{background-color:var(--surface-2)}.bg-transparent{background-color:transparent}.bg-warning{background-color:var(--danger)}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-10{padding:2.5rem}.p-16{padding:4rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-3\.5{padding:.875rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-7{padding:1.75rem}.p-8{padding:2rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pb-8{padding-bottom:2rem}.pr-10{padding-right:2.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:Space Mono,ui-monospace,SF Mono,JetBrains Mono,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-5xl{font-size:3rem;line-height:1}.text-\[10\.5px\]{font-size:10.5px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.text-\[19px\]{font-size:19px}.text-\[22px\]{font-size:22px}.text-\[30px\]{font-size:30px}.text-\[34px\]{font-size:34px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-mode{font-size:18px;line-height:1.2;letter-spacing:-.02em;font-weight:600}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.leading-none{line-height:1}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-\[0\.3em\]{letter-spacing:.3em}.tracking-caps{letter-spacing:.14em}.tracking-tightest{letter-spacing:-.02em}.text-accent{color:var(--accent)}.text-accent-soft-fg{color:var(--accent-soft-fg)}.text-amber-fg{color:var(--warning-fg)}.text-danger-fg{color:var(--danger-fg)}.text-ink{color:var(--text-primary)}.text-ink-muted{color:var(--text-tertiary)}.text-ink-secondary{color:var(--text-secondary)}.text-success-fg{color:var(--success-fg)}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.accent-\[var\(--accent\)\]{accent-color:var(--accent)}.accent-\[var\(--danger\)\]{accent-color:var(--danger)}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: var(--shadow-lg);--tw-shadow-colored: var(--shadow-lg);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: var(--shadow-md);--tw-shadow-colored: var(--shadow-md);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: var(--shadow-sm);--tw-shadow-colored: var(--shadow-sm);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xs{--tw-shadow: var(--shadow-xs);--tw-shadow-colored: var(--shadow-xs);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}html,body,#app{height:100%}html{background-color:var(--bg-app);transition:background-color var(--dur-base) var(--ease-standard)}body{font-family:Space Grotesk,ui-sans-serif,system-ui,-apple-system,Segoe UI,sans-serif;color:var(--text-primary);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#app{background-color:var(--bg-app);min-height:100vh;transition:background-color var(--dur-base) var(--ease-standard)}html.reduce-motion *,html.reduce-motion *:before,html.reduce-motion *:after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important}.leaflet-container{background:var(--surface-inset);font-family:var(--font-sans)}.leaflet-control-attribution{background:color-mix(in srgb,var(--surface) 82%,transparent)!important;color:var(--text-tertiary)!important}.leaflet-control-attribution a{color:var(--text-secondary)!important}.placeholder\:text-ink-muted::-moz-placeholder{color:var(--text-tertiary)}.placeholder\:text-ink-muted::placeholder{color:var(--text-tertiary)}.first\:mt-0:first-child{margin-top:0}.last\:border-0:last-child{border-width:0px}.hover\:border-line-strong:hover{border-color:var(--border-strong)}.hover\:bg-danger-soft:hover{background-color:var(--danger-soft)}.hover\:bg-surface-2:hover{background-color:var(--surface-2)}.hover\:text-ink:hover{color:var(--text-primary)}.hover\:text-ink-secondary:hover{color:var(--text-secondary)}.hover\:underline:hover{text-decoration-line:underline}.hover\:brightness-110:hover{--tw-brightness: brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.enabled\:hover\:brightness-110:hover:enabled{--tw-brightness: brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media(max-width:1100px){.max-\[1100px\]\:hidden{display:none}.max-\[1100px\]\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.max-\[1100px\]\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:900px){.max-\[900px\]\:hidden{display:none}.max-\[900px\]\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.max-\[900px\]\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:820px){.max-\[820px\]\:col-span-1{grid-column:span 1 / span 1}.max-\[820px\]\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}}@media(max-width:760px){.max-\[760px\]\:col-span-1{grid-column:span 1 / span 1}.max-\[760px\]\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.max-\[760px\]\:flex-row{flex-direction:row}.max-\[760px\]\:overflow-x-auto{overflow-x:auto}}@media(max-width:560px){.max-\[560px\]\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}}@media(min-width:640px){.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}}.fade-enter-active[data-v-7522b856],.fade-leave-active[data-v-7522b856]{transition:opacity .2s}.fade-enter-from[data-v-7522b856],.fade-leave-to[data-v-7522b856]{opacity:0} +:root,[data-theme=light]{--navy-950: #0B1730;--navy-900: #0F1E3D;--navy-800: #1B2E52;--navy-700: #26406E;--blue-50: #EAF1FE;--blue-100: #D6E3FD;--blue-200: #B4CDFA;--blue-300: #8FB4F6;--blue-400: #5B93F5;--blue-500: #3D7BF0;--blue-600: #2B62CC;--blue-700: #1F4CA0;--slate-0: #FFFFFF;--slate-50: #F6F7F9;--slate-100: #EEF0F3;--slate-150: #E6E9EE;--slate-200: #DCE0E7;--slate-300: #C5CCD7;--slate-400: #97A1B0;--slate-500: #6B7688;--slate-600: #4C5566;--slate-700: #333B4A;--slate-800: #1E2635;--slate-900: #131A28;--slate-950: #0B111C;--steel: #5A6B85;--green-500: #1F8A5B;--green-100: #DCF1E7;--green-600:#177049;--amber-500: #D9852B;--amber-100: #FBEBD5;--amber-600:#B86C1B;--red-500: #D64545;--red-100: #FBE0E0;--red-600: #B83232;--bg-app: var(--slate-100);--bg-subtle: var(--slate-50);--surface: var(--slate-0);--surface-2: var(--slate-50);--surface-inset: var(--slate-100);--border: var(--slate-200);--border-strong: var(--slate-300);--border-subtle: var(--slate-150);--text-primary: var(--navy-900);--text-secondary:var(--steel);--text-tertiary: var(--slate-400);--text-inverse: var(--slate-0);--text-on-accent:#FFFFFF;--accent: var(--blue-500);--accent-hover: var(--blue-600);--accent-active: var(--blue-700);--accent-soft: var(--blue-50);--accent-soft-fg:var(--blue-700);--focus-ring: color-mix(in srgb, var(--blue-500) 45%, transparent);--success: var(--green-500);--success-soft: var(--green-100);--success-fg: var(--green-600);--warning: var(--amber-500);--warning-soft: var(--amber-100);--warning-fg: var(--amber-600);--danger: var(--red-500);--danger-soft: var(--red-100);--danger-fg: var(--red-600);--overlay: color-mix(in srgb, var(--navy-950) 55%, transparent);--font-sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;--font-mono: "Space Mono", ui-monospace, "SF Mono", "JetBrains Mono", monospace;--radius-xs: 4px;--radius-sm: 6px;--radius-md: 10px;--radius-lg: 14px;--radius-xl: 20px;--radius-pill: 999px;--shadow-xs: 0 1px 2px rgba(15,30,61,.06);--shadow-sm: 0 1px 2px rgba(15,30,61,.06), 0 1px 3px rgba(15,30,61,.04);--shadow-md: 0 2px 4px rgba(15,30,61,.06), 0 6px 16px rgba(15,30,61,.08);--shadow-lg: 0 8px 24px rgba(15,30,61,.1), 0 2px 6px rgba(15,30,61,.06);--ease-standard: cubic-bezier(.4, 0, .2, 1);--ease-out: cubic-bezier(.16, 1, .3, 1);--dur-fast: .12s;--dur-base: .2s;color-scheme:light}[data-theme=dark]{--bg-app: var(--navy-950);--bg-subtle: var(--slate-950);--surface: #10203F;--surface-2: #142748;--surface-inset: var(--navy-950);--border: color-mix(in srgb, #FFFFFF 10%, transparent);--border-strong: color-mix(in srgb, #FFFFFF 18%, transparent);--border-subtle: color-mix(in srgb, #FFFFFF 6%, transparent);--text-primary: #F4F7FC;--text-secondary:#8FA0BE;--text-tertiary: #5E6E8C;--text-inverse: var(--navy-900);--text-on-accent:#FFFFFF;--accent: var(--blue-400);--accent-hover: var(--blue-300);--accent-active: var(--blue-200);--accent-soft: color-mix(in srgb, var(--blue-500) 18%, transparent);--accent-soft-fg:var(--blue-300);--focus-ring: color-mix(in srgb, var(--blue-400) 55%, transparent);--success:var(--green-500);--success-soft: color-mix(in srgb, var(--green-500) 22%, transparent);--success-fg:#5FD3A0;--warning:var(--amber-500);--warning-soft: color-mix(in srgb, var(--amber-500) 22%, transparent);--warning-fg:#F0B26A;--danger: var(--red-500);--danger-soft: color-mix(in srgb, var(--red-500) 22%, transparent);--danger-fg: #F08A8A;--overlay: color-mix(in srgb, #000000 62%, transparent);--shadow-xs: 0 1px 2px rgba(0,0,0,.35);--shadow-sm: 0 1px 3px rgba(0,0,0,.4);--shadow-md: 0 4px 12px rgba(0,0,0,.45);--shadow-lg: 0 12px 32px rgba(0,0,0,.5);color-scheme:dark}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Space Grotesk,ui-sans-serif,system-ui,-apple-system,Segoe UI,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:Space Mono,ui-monospace,SF Mono,JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.tabular{font-variant-numeric:tabular-nums}.eyebrow{font-family:Space Mono,ui-monospace,SF Mono,JetBrains Mono,monospace;font-size:11px;text-transform:uppercase;letter-spacing:.14em;color:var(--text-tertiary)}.readout{font-variant-numeric:tabular-nums;font-family:Space Mono,ui-monospace,SF Mono,JetBrains Mono,monospace;font-size:30px;line-height:1;font-weight:500;color:var(--text-primary)}.panel{border-radius:14px;border-width:1px;border-color:var(--border);background-color:var(--surface);--tw-shadow: var(--shadow-xs);--tw-shadow-colored: var(--shadow-xs);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.pill{border-radius:10px;border-width:1px;border-color:var(--border);background-color:var(--surface-2);padding:.5rem .75rem}.field{width:100%;border-radius:10px;border-width:1px;border-color:var(--border);background-color:var(--surface-2);padding:.625rem .75rem;font-size:.875rem;line-height:1.25rem;color:var(--text-primary);outline:2px solid transparent;outline-offset:2px;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.field::-moz-placeholder{color:var(--text-tertiary)}.field::placeholder{color:var(--text-tertiary)}.field{transition-duration:var(--dur-fast)}.field:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--focus-ring)}.btn-accent{border-radius:10px;background-color:var(--accent);padding:.625rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:600;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.btn-accent:hover{background-color:var(--accent-hover)}.btn-accent:active{--tw-translate-y: 1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.btn-accent:disabled{opacity:.5}.btn-accent{transition-duration:var(--dur-fast)}.btn-ghost{border-radius:10px;border-width:1px;border-color:var(--border);background-color:var(--surface);padding:.375rem .75rem;font-size:.875rem;line-height:1.25rem;color:var(--text-secondary);transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.btn-ghost:hover{border-color:var(--border-strong);color:var(--text-primary)}.btn-ghost:active{--tw-translate-y: 1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.btn-ghost{transition-duration:var(--dur-fast)}.btn-icon{display:grid;height:2.25rem;width:2.25rem;place-items:center;border-radius:10px;border-width:1px;border-color:var(--border);background-color:var(--surface);color:var(--text-secondary);transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.btn-icon:hover{border-color:var(--border-strong);color:var(--text-primary)}.btn-icon{transition-duration:var(--dur-fast)}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{top:0;bottom:0}.bottom-5{bottom:1.25rem}.right-0{right:0}.right-5{right:1.25rem}.top-0{top:0}.top-5{top:1.25rem}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[1190\]{z-index:1190}.z-\[1200\]{z-index:1200}.col-span-2{grid-column:span 2 / span 2}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-2\.5{margin-bottom:.625rem}.mb-3{margin-bottom:.75rem}.mb-3\.5{margin-bottom:.875rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-2\.5{margin-top:.625rem}.mt-3{margin-top:.75rem}.mt-3\.5{margin-top:.875rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.mt-px{margin-top:1px}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-28{height:7rem}.h-4{height:1rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[180px\]{height:180px}.h-\[18px\]{height:18px}.h-\[320px\]{height:320px}.h-\[74vh\]{height:74vh}.h-full{height:100%}.max-h-\[90vh\]{max-height:90vh}.min-h-\[16px\]{min-height:16px}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-24{width:6rem}.w-28{width:7rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-44{width:11rem}.w-48{width:12rem}.w-56{width:14rem}.w-60{width:15rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[18px\]{width:18px}.w-\[380px\]{width:380px}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-\[1240px\]{max-width:1240px}.max-w-\[1280px\]{max-width:1280px}.max-w-\[220px\]{max-width:220px}.max-w-\[280px\]{max-width:280px}.max-w-\[360px\]{max-width:360px}.max-w-\[420px\]{max-width:420px}.max-w-\[520px\]{max-width:520px}.max-w-\[920px\]{max-width:920px}.max-w-full{max-width:100%}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.border-collapse{border-collapse:collapse}.translate-x-1{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-6{--tw-translate-x: 1.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-\[1\.6fr_1fr\]{grid-template-columns:1.6fr 1fr}.grid-cols-\[210px_1fr\]{grid-template-columns:210px 1fr}.grid-cols-\[248px_1fr\]{grid-template-columns:248px 1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-x-8{-moz-column-gap:2rem;column-gap:2rem}.gap-y-1\.5{row-gap:.375rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded,.rounded-\[10px\]{border-radius:10px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:14px}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-0{border-width:0px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-r{border-right-width:1px}.border-none{border-style:none}.border-accent{border-color:var(--accent)}.border-line{border-color:var(--border)}.border-line-strong{border-color:var(--border-strong)}.border-transparent{border-color:transparent}.bg-\[var\(--navy-800\)\]{background-color:var(--navy-800)}.bg-accent{background-color:var(--accent)}.bg-accent-soft{background-color:var(--accent-soft)}.bg-amber{background-color:var(--warning)}.bg-amber-soft{background-color:var(--warning-soft)}.bg-caution{background-color:var(--warning)}.bg-current{background-color:currentColor}.bg-danger{background-color:var(--danger)}.bg-danger-soft{background-color:var(--danger-soft)}.bg-ink-muted{background-color:var(--text-tertiary)}.bg-line{background-color:var(--border)}.bg-ready,.bg-success{background-color:var(--success)}.bg-success-soft{background-color:var(--success-soft)}.bg-surface-1{background-color:var(--surface)}.bg-surface-2{background-color:var(--surface-2)}.bg-transparent{background-color:transparent}.bg-warning{background-color:var(--danger)}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-10{padding:2.5rem}.p-16{padding:4rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-3\.5{padding:.875rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-7{padding:1.75rem}.p-8{padding:2rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pb-8{padding-bottom:2rem}.pr-10{padding-right:2.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:Space Mono,ui-monospace,SF Mono,JetBrains Mono,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-5xl{font-size:3rem;line-height:1}.text-\[10\.5px\]{font-size:10.5px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.text-\[19px\]{font-size:19px}.text-\[22px\]{font-size:22px}.text-\[30px\]{font-size:30px}.text-\[34px\]{font-size:34px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-mode{font-size:18px;line-height:1.2;letter-spacing:-.02em;font-weight:600}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.leading-none{line-height:1}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-\[0\.3em\]{letter-spacing:.3em}.tracking-caps{letter-spacing:.14em}.tracking-tightest{letter-spacing:-.02em}.text-accent{color:var(--accent)}.text-accent-soft-fg{color:var(--accent-soft-fg)}.text-amber-fg{color:var(--warning-fg)}.text-danger-fg{color:var(--danger-fg)}.text-ink{color:var(--text-primary)}.text-ink-muted{color:var(--text-tertiary)}.text-ink-secondary{color:var(--text-secondary)}.text-success-fg{color:var(--success-fg)}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.accent-\[var\(--accent\)\]{accent-color:var(--accent)}.accent-\[var\(--danger\)\]{accent-color:var(--danger)}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: var(--shadow-lg);--tw-shadow-colored: var(--shadow-lg);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: var(--shadow-md);--tw-shadow-colored: var(--shadow-md);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: var(--shadow-sm);--tw-shadow-colored: var(--shadow-sm);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xs{--tw-shadow: var(--shadow-xs);--tw-shadow-colored: var(--shadow-xs);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}html,body,#app{height:100%}html{background-color:var(--bg-app);transition:background-color var(--dur-base) var(--ease-standard)}body{font-family:Space Grotesk,ui-sans-serif,system-ui,-apple-system,Segoe UI,sans-serif;color:var(--text-primary);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#app{background-color:var(--bg-app);min-height:100vh;transition:background-color var(--dur-base) var(--ease-standard)}html.reduce-motion *,html.reduce-motion *:before,html.reduce-motion *:after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important}.leaflet-container{background:var(--surface-inset);font-family:var(--font-sans)}.leaflet-control-attribution{background:color-mix(in srgb,var(--surface) 82%,transparent)!important;color:var(--text-tertiary)!important}.leaflet-control-attribution a{color:var(--text-secondary)!important}.placeholder\:text-ink-muted::-moz-placeholder{color:var(--text-tertiary)}.placeholder\:text-ink-muted::placeholder{color:var(--text-tertiary)}.first\:mt-0:first-child{margin-top:0}.last\:border-0:last-child{border-width:0px}.hover\:border-line-strong:hover{border-color:var(--border-strong)}.hover\:bg-danger-soft:hover{background-color:var(--danger-soft)}.hover\:bg-surface-2:hover{background-color:var(--surface-2)}.hover\:text-ink:hover{color:var(--text-primary)}.hover\:text-ink-secondary:hover{color:var(--text-secondary)}.hover\:underline:hover{text-decoration-line:underline}.hover\:brightness-110:hover{--tw-brightness: brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.enabled\:hover\:brightness-110:hover:enabled{--tw-brightness: brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media(max-width:1100px){.max-\[1100px\]\:hidden{display:none}.max-\[1100px\]\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.max-\[1100px\]\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:900px){.max-\[900px\]\:hidden{display:none}.max-\[900px\]\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.max-\[900px\]\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:820px){.max-\[820px\]\:col-span-1{grid-column:span 1 / span 1}.max-\[820px\]\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}}@media(max-width:760px){.max-\[760px\]\:col-span-1{grid-column:span 1 / span 1}.max-\[760px\]\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.max-\[760px\]\:flex-row{flex-direction:row}.max-\[760px\]\:overflow-x-auto{overflow-x:auto}}@media(max-width:560px){.max-\[560px\]\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}}@media(min-width:640px){.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}}.fade-enter-active[data-v-7522b856],.fade-leave-active[data-v-7522b856]{transition:opacity .2s}.fade-enter-from[data-v-7522b856],.fade-leave-to[data-v-7522b856]{opacity:0} diff --git a/Web App/server/dist/assets/index-DrzdlcUJ.js b/Web App/server/dist/assets/index-DwyUIzSZ.js similarity index 86% rename from Web App/server/dist/assets/index-DrzdlcUJ.js rename to Web App/server/dist/assets/index-DwyUIzSZ.js index 1d34990..ccc8c84 100644 --- a/Web App/server/dist/assets/index-DrzdlcUJ.js +++ b/Web App/server/dist/assets/index-DwyUIzSZ.js @@ -17,4 +17,4 @@ **/let Gr;const ql=typeof window<"u"&&window.trustedTypes;if(ql)try{Gr=ql.createPolicy("vue",{createHTML:t=>t})}catch{}const Hc=Gr?t=>Gr.createHTML(t):t=>t,fh="http://www.w3.org/2000/svg",hh="http://www.w3.org/1998/Math/MathML",Pi=typeof document<"u"?document:null,Yl=Pi&&Pi.createElement("template"),ph={insert:(t,i,s)=>{i.insertBefore(t,s||null)},remove:t=>{const i=t.parentNode;i&&i.removeChild(t)},createElement:(t,i,s,l)=>{const u=i==="svg"?Pi.createElementNS(fh,t):i==="mathml"?Pi.createElementNS(hh,t):s?Pi.createElement(t,{is:s}):Pi.createElement(t);return t==="select"&&l&&l.multiple!=null&&u.setAttribute("multiple",l.multiple),u},createText:t=>Pi.createTextNode(t),createComment:t=>Pi.createComment(t),setText:(t,i)=>{t.nodeValue=i},setElementText:(t,i)=>{t.textContent=i},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Pi.querySelector(t),setScopeId(t,i){t.setAttribute(i,"")},insertStaticContent(t,i,s,l,u,f){const h=s?s.previousSibling:i.lastChild;if(u&&(u===f||u.nextSibling))for(;i.insertBefore(u.cloneNode(!0),s),!(u===f||!(u=u.nextSibling)););else{Yl.innerHTML=Hc(l==="svg"?`${t}`:l==="mathml"?`${t}`:t);const _=Yl.content;if(l==="svg"||l==="mathml"){const y=_.firstChild;for(;y.firstChild;)_.appendChild(y.firstChild);_.removeChild(y)}i.insertBefore(_,s)}return[h?h.nextSibling:i.firstChild,s?s.previousSibling:i.lastChild]}},Gi="transition",zs="animation",Qs=Symbol("_vtc"),jc={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},mh=Kt({},pc,jc),gh=t=>(t.displayName="Transition",t.props=mh,t),vh=gh((t,{slots:i})=>ch(hf,_h(t),i)),So=(t,i=[])=>{$e(t)?t.forEach(s=>s(...i)):t&&t(...i)},Jl=t=>t?$e(t)?t.some(i=>i.length>1):t.length>1:!1;function _h(t){const i={};for(const O in t)O in jc||(i[O]=t[O]);if(t.css===!1)return i;const{name:s="v",type:l,duration:u,enterFromClass:f=`${s}-enter-from`,enterActiveClass:h=`${s}-enter-active`,enterToClass:_=`${s}-enter-to`,appearFromClass:y=f,appearActiveClass:C=h,appearToClass:T=_,leaveFromClass:M=`${s}-leave-from`,leaveActiveClass:H=`${s}-leave-active`,leaveToClass:j=`${s}-leave-to`}=t,K=bh(u),F=K&&K[0],te=K&&K[1],{onBeforeEnter:X,onEnter:fe,onEnterCancelled:Se,onLeave:de,onLeaveCancelled:Fe,onBeforeAppear:Oe=X,onAppear:Te=fe,onAppearCancelled:Ze=Se}=i,he=(O,N,$,Ye)=>{O._enterCancelled=Ye,To(O,N?T:_),To(O,N?C:h),$&&$()},Q=(O,N)=>{O._isLeaving=!1,To(O,M),To(O,j),To(O,H),N&&N()},B=O=>(N,$)=>{const Ye=O?Te:fe,we=()=>he(N,O,$);So(Ye,[N,we]),Xl(()=>{To(N,O?y:f),Ti(N,O?T:_),Jl(Ye)||Ql(N,l,F,we)})};return Kt(i,{onBeforeEnter(O){So(X,[O]),Ti(O,f),Ti(O,h)},onBeforeAppear(O){So(Oe,[O]),Ti(O,y),Ti(O,C)},onEnter:B(!1),onAppear:B(!0),onLeave(O,N){O._isLeaving=!0;const $=()=>Q(O,N);Ti(O,M),O._enterCancelled?(Ti(O,H),nu(O)):(nu(O),Ti(O,H)),Xl(()=>{O._isLeaving&&(To(O,M),Ti(O,j),Jl(de)||Ql(O,l,te,$))}),So(de,[O,$])},onEnterCancelled(O){he(O,!1,void 0,!0),So(Se,[O])},onAppearCancelled(O){he(O,!0,void 0,!0),So(Ze,[O])},onLeaveCancelled(O){Q(O),So(Fe,[O])}})}function bh(t){if(t==null)return null;if(dt(t))return[Mr(t.enter),Mr(t.leave)];{const i=Mr(t);return[i,i]}}function Mr(t){return _d(t)}function Ti(t,i){i.split(/\s+/).forEach(s=>s&&t.classList.add(s)),(t[Qs]||(t[Qs]=new Set)).add(i)}function To(t,i){i.split(/\s+/).forEach(l=>l&&t.classList.remove(l));const s=t[Qs];s&&(s.delete(i),s.size||(t[Qs]=void 0))}function Xl(t){requestAnimationFrame(()=>{requestAnimationFrame(t)})}let yh=0;function Ql(t,i,s,l){const u=t._endId=++yh,f=()=>{u===t._endId&&l()};if(s!=null)return setTimeout(f,s);const{type:h,timeout:_,propCount:y}=xh(t,i);if(!h)return l();const C=h+"end";let T=0;const M=()=>{t.removeEventListener(C,H),f()},H=j=>{j.target===t&&++T>=y&&M()};setTimeout(()=>{T(s[K]||"").split(", "),u=l(`${Gi}Delay`),f=l(`${Gi}Duration`),h=eu(u,f),_=l(`${zs}Delay`),y=l(`${zs}Duration`),C=eu(_,y);let T=null,M=0,H=0;i===Gi?h>0&&(T=Gi,M=h,H=f.length):i===zs?C>0&&(T=zs,M=C,H=y.length):(M=Math.max(h,C),T=M>0?h>C?Gi:zs:null,H=T?T===Gi?f.length:y.length:0);const j=T===Gi&&/\b(?:transform|all)(?:,|$)/.test(l(`${Gi}Property`).toString());return{type:T,timeout:M,propCount:H,hasTransform:j}}function eu(t,i){for(;t.lengthtu(s)+tu(t[l])))}function tu(t){return t==="auto"?0:Number(t.slice(0,-1).replace(",","."))*1e3}function nu(t){return(t?t.ownerDocument:document).body.offsetHeight}function wh(t,i,s){const l=t[Qs];l&&(i=(i?[i,...l]:[...l]).join(" ")),i==null?t.removeAttribute("class"):s?t.setAttribute("class",i):t.className=i}const Ua=Symbol("_vod"),Wc=Symbol("_vsh"),kh={name:"show",beforeMount(t,{value:i},{transition:s}){t[Ua]=t.style.display==="none"?"":t.style.display,s&&i?s.beforeEnter(t):$s(t,i)},mounted(t,{value:i},{transition:s}){s&&i&&s.enter(t)},updated(t,{value:i,oldValue:s},{transition:l}){!i!=!s&&(l?i?(l.beforeEnter(t),$s(t,!0),l.enter(t)):l.leave(t,()=>{$s(t,!1)}):$s(t,i))},beforeUnmount(t,{value:i}){$s(t,i)}};function $s(t,i){t.style.display=i?t[Ua]:"none",t[Wc]=!i}const Sh=Symbol(""),Th=/(?:^|;)\s*display\s*:/;function Ph(t,i,s){const l=t.style,u=Tt(s);let f=!1;if(s&&!u){if(i)if(Tt(i))for(const h of i.split(";")){const _=h.slice(0,h.indexOf(":")).trim();s[_]==null&&Ds(l,_,"")}else for(const h in i)s[h]==null&&Ds(l,h,"");for(const h in s){h==="display"&&(f=!0);const _=s[h];_!=null?Lh(t,h,!Tt(i)&&i?i[h]:void 0,_)||Ds(l,h,_):Ds(l,h,"")}}else if(u){if(i!==s){const h=l[Sh];h&&(s+=";"+h),l.cssText=s,f=Th.test(s)}}else i&&t.removeAttribute("style");Ua in t&&(t[Ua]=f?l.display:"",t[Wc]&&(l.display="none"))}const iu=/\s*!important$/;function Ds(t,i,s){if($e(s))s.forEach(l=>Ds(t,i,l));else if(s==null&&(s=""),i.startsWith("--"))t.setProperty(i,s);else{const l=Ch(t,i);iu.test(s)?t.setProperty(to(l),s.replace(iu,""),"important"):t[l]=s}}const ou=["Webkit","Moz","ms"],Er={};function Ch(t,i){const s=Er[i];if(s)return s;let l=Jn(i);if(l!=="filter"&&l in t)return Er[i]=l;l=Du(l);for(let u=0;uOr||($h.then(()=>Or=0),Or=Date.now());function Nh(t,i){const s=l=>{if(!l._vts)l._vts=Date.now();else if(l._vts<=s.attached)return;const u=s.value;if($e(u)){const f=l.stopImmediatePropagation;l.stopImmediatePropagation=()=>{f.call(l),l._stopped=!0};const h=u.slice(),_=[l];for(let y=0;yt.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Dh=(t,i,s,l,u,f)=>{const h=u==="svg";i==="class"?wh(t,l,h):i==="style"?Ph(t,s,l):ja(i)?Wa(i)||Mh(t,i,s,l,f):(i[0]==="."?(i=i.slice(1),!0):i[0]==="^"?(i=i.slice(1),!1):Fh(t,i,l,h))?(ru(t,i,l),!t.tagName.includes("-")&&(i==="value"||i==="checked"||i==="selected")&&au(t,i,l,h,f,i!=="value")):t._isVueCE&&(Rh(t,i)||t._def.__asyncLoader&&(/[A-Z]/.test(i)||!Tt(l)))?ru(t,Jn(i),l,f,i):(i==="true-value"?t._trueValue=l:i==="false-value"&&(t._falseValue=l),au(t,i,l,h))};function Fh(t,i,s,l){if(l)return!!(i==="innerHTML"||i==="textContent"||i in t&&uu(i)&&je(s));if(i==="spellcheck"||i==="draggable"||i==="translate"||i==="autocorrect"||i==="sandbox"&&t.tagName==="IFRAME"||i==="form"||i==="list"&&t.tagName==="INPUT"||i==="type"&&t.tagName==="TEXTAREA")return!1;if(i==="width"||i==="height"){const u=t.tagName;if(u==="IMG"||u==="VIDEO"||u==="CANVAS"||u==="SOURCE")return!1}return uu(i)&&Tt(s)?!1:i in t}function Rh(t,i){const s=t._def.props;if(!s)return!1;const l=Jn(i);return Array.isArray(s)?s.some(u=>Jn(u)===l):Object.keys(s).some(u=>Jn(u)===l)}const eo=t=>{const i=t.props["onUpdate:modelValue"]||!1;return $e(i)?s=>Ea(i,s):i};function Bh(t){t.target.composing=!0}function cu(t){const i=t.target;i.composing&&(i.composing=!1,i.dispatchEvent(new Event("input")))}const Zn=Symbol("_assign");function du(t,i,s){return i&&(t=t.trim()),s&&(t=Ga(t)),t}const me={created(t,{modifiers:{lazy:i,trim:s,number:l}},u){t[Zn]=eo(u);const f=l||u.props&&u.props.type==="number";Mi(t,i?"change":"input",h=>{h.target.composing||t[Zn](du(t.value,s,f))}),(s||f)&&Mi(t,"change",()=>{t.value=du(t.value,s,f)}),i||(Mi(t,"compositionstart",Bh),Mi(t,"compositionend",cu),Mi(t,"change",cu))},mounted(t,{value:i}){t.value=i??""},beforeUpdate(t,{value:i,oldValue:s,modifiers:{lazy:l,trim:u,number:f}},h){if(t[Zn]=eo(h),t.composing)return;const _=(f||t.type==="number")&&!/^0\d/.test(t.value)?Ga(t.value):t.value,y=i??"";if(_===y)return;const C=t.getRootNode();(C instanceof Document||C instanceof ShadowRoot)&&C.activeElement===t&&t.type!=="range"&&(l&&i===s||u&&t.value.trim()===y)||(t.value=y)}},Va={deep:!0,created(t,i,s){t[Zn]=eo(s),Mi(t,"change",()=>{const l=t._modelValue,u=rs(t),f=t.checked,h=t[Zn];if($e(l)){const _=tl(l,u),y=_!==-1;if(f&&!y)h(l.concat(u));else if(!f&&y){const C=[...l];C.splice(_,1),h(C)}}else if(ls(l)){const _=new Set(l);f?_.add(u):_.delete(u),h(_)}else h(Kc(t,f))})},mounted:fu,beforeUpdate(t,i,s){t[Zn]=eo(s),fu(t,i,s)}};function fu(t,{value:i,oldValue:s},l){t._modelValue=i;let u;if($e(i))u=tl(i,l.props.value)>-1;else if(ls(i))u=i.has(l.props.value);else{if(i===s)return;u=Xi(i,Kc(t,!0))}t.checked!==u&&(t.checked=u)}const Uh={created(t,{value:i},s){t.checked=Xi(i,s.props.value),t[Zn]=eo(s),Mi(t,"change",()=>{t[Zn](rs(t))})},beforeUpdate(t,{value:i,oldValue:s},l){t[Zn]=eo(l),i!==s&&(t.checked=Xi(i,l.props.value))}},Ot={deep:!0,created(t,{value:i,modifiers:{number:s}},l){const u=ls(i);Mi(t,"change",()=>{const f=Array.prototype.filter.call(t.options,h=>h.selected).map(h=>s?Ga(rs(h)):rs(h));t[Zn](t.multiple?u?new Set(f):f:f[0]),t._assigning=!0,oc(()=>{t._assigning=!1})}),t[Zn]=eo(l)},mounted(t,{value:i}){hu(t,i)},beforeUpdate(t,i,s){t[Zn]=eo(s)},updated(t,{value:i}){t._assigning||hu(t,i)}};function hu(t,i){const s=t.multiple,l=$e(i);if(!(s&&!l&&!ls(i))){for(let u=0,f=t.options.length;uString(C)===String(_)):h.selected=tl(i,_)>-1}else h.selected=i.has(_);else if(Xi(rs(h),i)){t.selectedIndex!==u&&(t.selectedIndex=u);return}}!s&&t.selectedIndex!==-1&&(t.selectedIndex=-1)}}function rs(t){return"_value"in t?t._value:t.value}function Kc(t,i){const s=i?"_trueValue":"_falseValue";return s in t?t[s]:i}const Vh={created(t,i,s){Aa(t,i,s,null,"created")},mounted(t,i,s){Aa(t,i,s,null,"mounted")},beforeUpdate(t,i,s,l){Aa(t,i,s,l,"beforeUpdate")},updated(t,i,s,l){Aa(t,i,s,l,"updated")}};function Zh(t,i){switch(t){case"SELECT":return Ot;case"TEXTAREA":return me;default:switch(i){case"checkbox":return Va;case"radio":return Uh;default:return me}}}function Aa(t,i,s,l,u){const h=Zh(t.tagName,s.props&&s.props.type)[u];h&&h(t,i,s,l)}const Hh=["ctrl","shift","alt","meta"],jh={stop:t=>t.stopPropagation(),prevent:t=>t.preventDefault(),self:t=>t.target!==t.currentTarget,ctrl:t=>!t.ctrlKey,shift:t=>!t.shiftKey,alt:t=>!t.altKey,meta:t=>!t.metaKey,left:t=>"button"in t&&t.button!==0,middle:t=>"button"in t&&t.button!==1,right:t=>"button"in t&&t.button!==2,exact:(t,i)=>Hh.some(s=>t[`${s}Key`]&&!i.includes(s))},hl=(t,i)=>{if(!t)return t;const s=t._withMods||(t._withMods={}),l=i.join(".");return s[l]||(s[l]=((u,...f)=>{for(let h=0;h{const s=t._withKeys||(t._withKeys={}),l=i.join(".");return s[l]||(s[l]=(u=>{if(!("key"in u))return;const f=to(u.key);if(i.some(h=>h===f||Wh[h]===f))return t(u)}))},Kh=Kt({patchProp:Dh},ph);let mu;function Gh(){return mu||(mu=Kf(Kh))}const qh=((...t)=>{const i=Gh().createApp(...t),{mount:s}=i;return i.mount=l=>{const u=Jh(l);if(!u)return;const f=i._component;!je(f)&&!f.render&&!f.template&&(f.template=u.innerHTML),u.nodeType===1&&(u.textContent="");const h=s(u,!1,Yh(u));return u instanceof Element&&(u.removeAttribute("v-cloak"),u.setAttribute("data-v-app","")),h},i});function Yh(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Jh(t){return Tt(t)?document.querySelector(t):t}const Gc="pv_theme",gu={light:"#EEF0F3",dark:"#0B1730"},Za=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;function qc(){return Za&&Za.matches?"dark":"light"}function Xh(){try{return localStorage.getItem(Gc)||"light"}catch{return"light"}}function Yc(t){return t==="system"?qc():t}function Jc(t){const i=document.documentElement;i.setAttribute("data-theme",t),i.style.backgroundColor=gu[t]||gu.light}const Oo=Y(Xh()),ss=Y(Yc(Oo.value));function Ha(t){Oo.value=t;const i=Yc(t);ss.value=i,Jc(i);try{localStorage.setItem(Gc,t)}catch{}}function vu(){Ha(ss.value==="dark"?"light":"dark")}Za&&Za.addEventListener("change",()=>{if(Oo.value==="system"){const t=qc();ss.value=t,Jc(t)}});async function Qh(){try{const t=await fetch("/bff/config");return t.ok?await t.json():{apiBase:""}}catch{return{apiBase:""}}}async function _u(){try{const t=await fetch("/bff/me");return t.ok?await t.json():null}catch{return null}}async function ep(t,i,s){const l=await fetch("/bff/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t,password:i,apiBase:s})});return{ok:l.ok,status:l.status,body:await l.json().catch(()=>({}))}}async function tp(){try{await fetch("/bff/logout",{method:"POST"})}catch{}}async function np(){try{const t=await fetch("/bff/devices");return t.ok?await t.json():[]}catch{return[]}}async function ip(){try{const t=await fetch("/bff/users");return t.ok?{ok:!0,status:200,users:(await t.json()).users||[]}:{ok:!1,status:t.status,users:[]}}catch{return{ok:!1,status:0,users:[]}}}async function op(t,i,s,l){const u=await fetch("/bff/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t,password:i,role:s,organization:l})});return{ok:u.ok,status:u.status,body:await u.json().catch(()=>({}))}}async function sp(t,i){const s=await fetch(`/bff/users/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return{ok:s.ok,status:s.status,body:await s.json().catch(()=>({}))}}async function ap(t){const i=await fetch(`/bff/users/${encodeURIComponent(t)}`,{method:"DELETE"});return{ok:i.ok,status:i.status,body:await i.json().catch(()=>({}))}}async function rp(){try{const t=await fetch("/bff/orgs");return t.ok?{ok:!0,status:200,organizations:(await t.json()).organizations||[]}:{ok:!1,status:t.status,organizations:[]}}catch{return{ok:!1,status:0,organizations:[]}}}async function lp(t){const i=await fetch("/bff/orgs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t})});return{ok:i.ok,status:i.status,body:await i.json().catch(()=>({}))}}async function up(t,i){const s=await fetch(`/bff/orgs/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i})});return{ok:s.ok,status:s.status,body:await s.json().catch(()=>({}))}}async function cp(t){const i=await fetch(`/bff/orgs/${encodeURIComponent(t)}`,{method:"DELETE"});return{ok:i.ok,status:i.status,body:await i.json().catch(()=>({}))}}async function dp(){try{const t=await fetch("/bff/preferences");if(!t.ok)return null;const i=await t.json();return i&&typeof i.preferences=="object"?i.preferences:null}catch{return null}}async function fp(t){try{return(await fetch("/bff/preferences",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({preferences:t})})).ok}catch{return!1}}async function hp(){try{const t=await fetch("/bff/integrations/opensky");return t.ok?{ok:!0,status:200,body:await t.json()}:{ok:!1,status:t.status,body:await t.json().catch(()=>({}))}}catch{return{ok:!1,status:0,body:{}}}}async function bu(t){const i=await fetch("/bff/integrations/opensky",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return{ok:i.ok,status:i.status,body:await i.json().catch(()=>({}))}}async function pp(t){const i=t?`?bbox=${encodeURIComponent(t)}`:"",s=await fetch(`/bff/integrations/opensky/health${i}`,{method:"POST"});return{ok:s.ok,status:s.status,body:await s.json().catch(()=>({}))}}async function mp(t){try{const i=t?`?bbox=${encodeURIComponent(t)}`:"",s=await fetch(`/bff/integrations/opensky/states${i}`);if(!s.ok)return{states:[],unavailable:!0,detail:"OpenSky unavailable"};const l=await s.json();return{states:l.states||[],time:l.time,unavailable:!!l.unavailable,detail:l.detail||"",plan:l.plan||"",recommendedInterval:l.recommendedInterval||0}}catch{return{states:[],unavailable:!0,detail:"OpenSky unavailable"}}}async function gp(){try{const t=await fetch("/bff/integrations/filetransfer");return t.ok?{ok:!0,status:200,body:await t.json()}:{ok:!1,status:t.status,body:await t.json().catch(()=>({}))}}catch{return{ok:!1,status:0,body:{}}}}async function yu(t){const i=await fetch("/bff/integrations/filetransfer",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return{ok:i.ok,status:i.status,body:await i.json().catch(()=>({}))}}async function vp(){const t=await fetch("/bff/integrations/filetransfer/health",{method:"POST"});return{ok:t.ok,status:t.status,body:await t.json().catch(()=>({}))}}async function _p(){try{const t=await fetch("/bff/integrations/localstorage");return t.ok?{ok:!0,status:200,body:await t.json()}:{ok:!1,status:t.status,body:await t.json().catch(()=>({}))}}catch{return{ok:!1,status:0,body:{}}}}async function Ma(t){const i=await fetch("/bff/integrations/localstorage",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return{ok:i.ok,status:i.status,body:await i.json().catch(()=>({}))}}async function bp(){const t=await fetch("/bff/integrations/localstorage/health",{method:"POST"});return{ok:t.ok,status:t.status,body:await t.json().catch(()=>({}))}}async function yp(){try{const t=await fetch("/bff/integrations/webdav");return t.ok?{ok:!0,status:200,body:await t.json()}:{ok:!1,status:t.status,body:await t.json().catch(()=>({}))}}catch{return{ok:!1,status:0,body:{}}}}async function xu(t){const i=await fetch("/bff/integrations/webdav",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return{ok:i.ok,status:i.status,body:await i.json().catch(()=>({}))}}async function xp(){const t=await fetch("/bff/integrations/webdav/health",{method:"POST"});return{ok:t.ok,status:t.status,body:await t.json().catch(()=>({}))}}async function wp(){try{const t=await fetch("/bff/integrations/openweather");return t.ok?{ok:!0,status:200,body:await t.json()}:{ok:!1,status:t.status,body:await t.json().catch(()=>({}))}}catch{return{ok:!1,status:0,body:{}}}}async function wu(t){const i=await fetch("/bff/integrations/openweather",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return{ok:i.ok,status:i.status,body:await i.json().catch(()=>({}))}}async function kp(){const t=await fetch("/bff/integrations/openweather/health",{method:"POST"});return{ok:t.ok,status:t.status,body:await t.json().catch(()=>({}))}}async function Sp(t,i){try{const s=t!=null&&i!=null?`?lat=${encodeURIComponent(t)}&lon=${encodeURIComponent(i)}`:"",l=await fetch(`/bff/integrations/openweather/current${s}`);return l.ok?await l.json():{unavailable:!0,detail:"Weather unavailable"}}catch{return{unavailable:!0,detail:"Weather unavailable"}}}async function pl(){try{const t=await fetch("/bff/drones");return t.ok?{ok:!0,status:200,drones:(await t.json()).drones||[]}:{ok:!1,status:t.status,drones:[]}}catch{return{ok:!1,status:0,drones:[]}}}async function Tp(t){const i=await fetch("/bff/drones",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return{ok:i.ok,status:i.status,body:await i.json().catch(()=>({}))}}async function Pp(t){try{const i=await fetch("/bff/drones/auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return{ok:i.ok,status:i.status,body:await i.json().catch(()=>({}))}}catch{return{ok:!1,status:0,body:{}}}}async function Cp(t,i){const s=await fetch(`/bff/drones/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return{ok:s.ok,status:s.status,body:await s.json().catch(()=>({}))}}async function Lp(t){const i=await fetch(`/bff/drones/${encodeURIComponent(t)}`,{method:"DELETE"});return{ok:i.ok,status:i.status,body:await i.json().catch(()=>({}))}}async function Ap(){try{const t=await fetch("/bff/flights");return t.ok?{ok:!0,status:200,flights:(await t.json()).flights||[]}:{ok:!1,status:t.status,flights:[]}}catch{return{ok:!1,status:0,flights:[]}}}async function Mp(t){const i=await fetch("/bff/flights",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return{ok:i.ok,status:i.status,body:await i.json().catch(()=>({}))}}async function Ep(t,i){const s=await fetch(`/bff/flights/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return{ok:s.ok,status:s.status,body:await s.json().catch(()=>({}))}}async function Op(t){const i=await fetch(`/bff/flights/${encodeURIComponent(t)}`,{method:"DELETE"});return{ok:i.ok,status:i.status,body:await i.json().catch(()=>({}))}}function zp(){return"/bff/logbook/export"}async function $p(t){try{const i=t!=null&&t!==""?`?expiring=${encodeURIComponent(t)}`:"",s=await fetch(`/bff/documents${i}`);return s.ok?{ok:!0,status:200,documents:(await s.json()).documents||[]}:{ok:!1,status:s.status,documents:[]}}catch{return{ok:!1,status:0,documents:[]}}}async function Ip(t,i){const s=new FormData;Object.entries(t).forEach(([u,f])=>{f!=null&&f!==""&&s.append(u,f)}),i&&s.append("file",i);const l=await fetch("/bff/documents",{method:"POST",body:s});return{ok:l.ok,status:l.status,body:await l.json().catch(()=>({}))}}async function Np(t,i){const s=await fetch(`/bff/documents/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return{ok:s.ok,status:s.status,body:await s.json().catch(()=>({}))}}async function Dp(t){const i=await fetch(`/bff/documents/${encodeURIComponent(t)}`,{method:"DELETE"});return{ok:i.ok,status:i.status,body:await i.json().catch(()=>({}))}}function zr(t){return`/bff/documents/${encodeURIComponent(t)}/file`}function Fp(t){return`/bff/documents/${encodeURIComponent(t)}/file?inline=1`}async function Rp(t,i,s){const l=await fetch(`/bff/devices/${encodeURIComponent(t)}/command`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:i,payload:s})});return{ok:l.ok,body:await l.json().catch(()=>({}))}}const Xc="pv_prefs",qr={name:"",username:"",displayName:"",bio:"",avatar:"",showEmail:!1,fontSize:"md",language:"en",region:"US",dateFormat:"MDY",timeFormat:"24",reduceMotion:!1,showAirTraffic:!0,autoBbox:!0,airTrafficInterval:"auto",twoFactor:!1};function Bp(){try{return{...qr,...JSON.parse(localStorage.getItem(Xc)||"{}")||{}}}catch{return{...qr}}}const be=gt(Bp());function Qc(){try{localStorage.setItem(Xc,JSON.stringify(be))}catch{}}function ed(t){if(!t||typeof t!="object")return!1;for(const i of Object.keys(qr))i in t&&(be[i]=t[i]);return!0}const Up={sm:15,md:16,lg:18};function ml(t){document.documentElement.style.fontSize=(Up[t]||16)+"px"}function gl(t){document.documentElement.classList.toggle("reduce-motion",!!t)}function td(t){const i=new Date(t),s=i.getFullYear(),l=String(i.getMonth()+1).padStart(2,"0"),u=String(i.getDate()).padStart(2,"0");let f;switch(be.dateFormat){case"DMY":f=`${u}/${l}/${s}`;break;case"YMD":f=`${s}/${l}/${u}`;break;case"ISO":f=`${s}-${l}-${u}`;break;default:f=`${l}/${u}/${s}`}let h;return be.timeFormat==="12"?h=i.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0}):h=`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}:${String(i.getSeconds()).padStart(2,"0")}`,{date:f,time:h}}function ku(t){return td(t).time}function Su(t){const i=td(t);return`${i.date} ${i.time}`}let vl=!1,Yr=!1,Jr=null;function Vp(){return{...JSON.parse(JSON.stringify(be)),themeMode:Oo.value}}function _l(){!vl||Yr||(clearTimeout(Jr),Jr=setTimeout(()=>{fp(Vp())},600))}function Zp(t){Yr=!0;try{ed(t),t.themeMode&&Ha(t.themeMode),ml(be.fontSize),gl(be.reduceMotion),Qc()}finally{Yr=!1}}async function Tu(){vl=!0;const t=await dp();t&&Object.keys(t).length?Zp(t):_l()}function Hp(){vl=!1,clearTimeout(Jr)}Bt(be,()=>{Qc(),_l()},{deep:!0});Bt(Oo,_l);Bt(()=>be.fontSize,ml,{immediate:!0});Bt(()=>be.reduceMotion,gl,{immediate:!0});const jp=["width","height"],nd={__name:"BrandMark",props:{size:{type:[Number,String],default:28}},setup(t){return(i,s)=>(p(),m("svg",{width:t.size,height:t.size,viewBox:"0 0 48 48",fill:"none","aria-hidden":"true"},[...s[0]||(s[0]=[a("g",{"stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round"},[a("polyline",{points:"8,30 19,17 30,30",stroke:"var(--accent)"}),a("polyline",{points:"18,33 29,20 40,33",stroke:"currentColor"})],-1)])],8,jp))}},Wp=["title","aria-label"],Kp={key:0,width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Gp={key:1,width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},qp={__name:"ThemeToggle",setup(t){return(i,s)=>(p(),m("button",{class:"btn-icon",type:"button",title:Ee(ss)==="dark"?"Switch to light":"Switch to dark","aria-label":Ee(ss)==="dark"?"Switch to light theme":"Switch to dark theme",onClick:s[0]||(s[0]=(...l)=>Ee(vu)&&Ee(vu)(...l))},[Ee(ss)==="dark"?(p(),m("svg",Kp,[...s[1]||(s[1]=[a("circle",{cx:"12",cy:"12",r:"4"},null,-1),a("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"},null,-1)])])):(p(),m("svg",Gp,[...s[2]||(s[2]=[a("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9z"},null,-1)])]))],8,Wp))}},Yp={class:"relative grid h-full place-items-center p-5"},Jp={class:"absolute right-5 top-5"},Xp={class:"mb-6 flex items-center gap-3 text-ink"},Qp={class:"relative mb-1"},em=["type"],tm=["aria-label","title"],nm={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"h-[18px] w-[18px]"},im={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"h-[18px] w-[18px]"},om={key:0,class:"mt-4"},sm={key:1,class:"mt-4 rounded border border-line bg-danger-soft px-3 py-2 text-sm text-danger-fg"},am=["disabled"],rm={__name:"LoginView",props:{defaultApiBase:{type:String,default:""}},emits:["signed-in"],setup(t,{emit:i}){const s=t,l=i,u=Y(""),f=Y(""),h=Y(localStorage.getItem("api_url")||s.defaultApiBase||"http://localhost:8080"),_=Y(!1),y=Y(!1),C=Y(!1),T=Y("");async function M(){C.value=!0,T.value="",localStorage.setItem("api_url",h.value.trim());const{ok:H,status:j,body:K}=await ep(u.value.trim(),f.value,h.value.trim());if(C.value=!1,H){l("signed-in",K.email);return}T.value=j===400?"Invalid email or password.":j===502?"API server can't reach PocketBase.":K.message||K.error||"Cannot reach the API server."}return(H,j)=>(p(),m("div",Yp,[a("div",Jp,[A(qp)]),a("form",{class:"panel w-[380px] p-8 shadow-md",onSubmit:hl(M,["prevent"])},[a("div",Xp,[A(nd,{size:34}),j[5]||(j[5]=a("div",{class:"leading-tight"},[a("div",{class:"text-mode"},"PilotVault"),a("div",{class:"eyebrow mt-0.5"},"Control panel")],-1))]),j[9]||(j[9]=a("label",{class:"eyebrow mb-1.5 block"},"Email",-1)),ie(a("input",{"onUpdate:modelValue":j[0]||(j[0]=K=>u.value=K),type:"email",autocomplete:"username",required:"",class:"field mb-4",placeholder:"you@example.com"},null,512),[[me,u.value]]),j[10]||(j[10]=a("label",{class:"eyebrow mb-1.5 block"},"Password",-1)),a("div",Qp,[ie(a("input",{"onUpdate:modelValue":j[1]||(j[1]=K=>f.value=K),type:y.value?"text":"password",autocomplete:"current-password",required:"",class:"field w-full pr-10",placeholder:"••••••••"},null,8,em),[[Vh,f.value]]),a("button",{type:"button",class:"absolute inset-y-0 right-0 grid w-10 place-items-center text-ink-muted transition hover:text-ink-secondary","aria-label":y.value?"Hide password":"Show password",title:y.value?"Hide password":"Show password",onClick:j[2]||(j[2]=K=>y.value=!y.value)},[y.value?(p(),m("svg",nm,[...j[6]||(j[6]=[a("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"},null,-1),a("line",{x1:"1",y1:"1",x2:"23",y2:"23"},null,-1)])])):(p(),m("svg",im,[...j[7]||(j[7]=[a("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"},null,-1),a("circle",{cx:"12",cy:"12",r:"3"},null,-1)])]))],8,tm)]),_.value?(p(),m("div",om,[j[8]||(j[8]=a("label",{class:"eyebrow mb-1.5 block"},"API Server",-1)),ie(a("input",{"onUpdate:modelValue":j[3]||(j[3]=K=>h.value=K),type:"text",class:"field font-mono",placeholder:"10.2.1.101:8080"},null,512),[[me,h.value]])])):I("",!0),T.value?(p(),m("p",sm,w(T.value),1)):I("",!0),a("button",{type:"submit",class:"btn-accent mt-6 w-full",disabled:C.value},w(C.value?"Signing in…":"Sign in"),9,am),a("button",{type:"button",class:"mx-auto mt-3 block text-xs text-ink-muted transition hover:text-ink-secondary",onClick:j[4]||(j[4]=K=>_.value=!_.value)},w(_.value?"Hide server settings":"Server settings"),1)],32)]))}};function lm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Fs={exports:{}};/* @preserve * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade - */var um=Fs.exports,Pu;function cm(){return Pu||(Pu=1,(function(t,i){(function(s,l){l(i)})(um,(function(s){var l="1.9.4";function u(e){var n,o,r,d;for(o=1,r=arguments.length;o"u"||!L||!L.Mixin)){e=Se(e)?e:[e];for(var n=0;n0?Math.floor(e):Math.ceil(e)};ue.prototype={clone:function(){return new ue(this.x,this.y)},add:function(e){return this.clone()._add(pe(e))},_add:function(e){return this.x+=e.x,this.y+=e.y,this},subtract:function(e){return this.clone()._subtract(pe(e))},_subtract:function(e){return this.x-=e.x,this.y-=e.y,this},divideBy:function(e){return this.clone()._divideBy(e)},_divideBy:function(e){return this.x/=e,this.y/=e,this},multiplyBy:function(e){return this.clone()._multiplyBy(e)},_multiplyBy:function(e){return this.x*=e,this.y*=e,this},scaleBy:function(e){return new ue(this.x*e.x,this.y*e.y)},unscaleBy:function(e){return new ue(this.x/e.x,this.y/e.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=ft(this.x),this.y=ft(this.y),this},distanceTo:function(e){e=pe(e);var n=e.x-this.x,o=e.y-this.y;return Math.sqrt(n*n+o*o)},equals:function(e){return e=pe(e),e.x===this.x&&e.y===this.y},contains:function(e){return e=pe(e),Math.abs(e.x)<=Math.abs(this.x)&&Math.abs(e.y)<=Math.abs(this.y)},toString:function(){return"Point("+H(this.x)+", "+H(this.y)+")"}};function pe(e,n,o){return e instanceof ue?e:Se(e)?new ue(e[0],e[1]):e==null?e:typeof e=="object"&&"x"in e&&"y"in e?new ue(e.x,e.y):new ue(e,n,o)}function Ue(e,n){if(e)for(var o=n?[e,n]:e,r=0,d=o.length;r=this.min.x&&o.x<=this.max.x&&n.y>=this.min.y&&o.y<=this.max.y},intersects:function(e){e=Ve(e);var n=this.min,o=this.max,r=e.min,d=e.max,v=d.x>=n.x&&r.x<=o.x,P=d.y>=n.y&&r.y<=o.y;return v&&P},overlaps:function(e){e=Ve(e);var n=this.min,o=this.max,r=e.min,d=e.max,v=d.x>n.x&&r.xn.y&&r.y=n.lat&&d.lat<=o.lat&&r.lng>=n.lng&&d.lng<=o.lng},intersects:function(e){e=st(e);var n=this._southWest,o=this._northEast,r=e.getSouthWest(),d=e.getNorthEast(),v=d.lat>=n.lat&&r.lat<=o.lat,P=d.lng>=n.lng&&r.lng<=o.lng;return v&&P},overlaps:function(e){e=st(e);var n=this._southWest,o=this._northEast,r=e.getSouthWest(),d=e.getNorthEast(),v=d.lat>n.lat&&r.latn.lng&&r.lng1,jn=(function(){var e=!1;try{var n=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassiveEventSupport",M,n),window.removeEventListener("testPassiveEventSupport",M,n)}catch{}return e})(),U=(function(){return!!document.createElement("canvas").getContext})(),E=!!(document.createElementNS&&W("svg").createSVGRect),Me=!!E&&(function(){var e=document.createElement("div");return e.innerHTML="",(e.firstChild&&e.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),tt=!E&&(function(){try{var e=document.createElement("div");e.innerHTML='';var n=e.firstChild;return n.style.behavior="url(#default#VML)",n&&typeof n.adj=="object"}catch{return!1}})(),It=navigator.platform.indexOf("Mac")===0,St=navigator.platform.indexOf("Linux")===0;function Et(e){return navigator.userAgent.toLowerCase().indexOf(e)>=0}var Z={ie:re,ielt9:ae,edge:oe,webkit:ee,android:ve,android23:se,androidStock:Pe,opera:Re,chrome:Ke,gecko:Ge,safari:pt,phantom:ht,opera12:Vt,win:Jt,ie3d:Zt,webkit3d:pn,gecko3d:Ct,any3d:$t,mobile:kn,mobileWebkit:zi,mobileWebkit3d:at,msPointer:Sn,pointer:$i,touch:hi,touchNative:rt,mobileOpera:pi,mobileGecko:Ii,retina:Gt,passiveEvents:jn,canvas:U,svg:E,vml:tt,inlineSvg:Me,mac:It,linux:St},_t=Z.msPointer?"MSPointerDown":"pointerdown",bt=Z.msPointer?"MSPointerMove":"pointermove",oa=Z.msPointer?"MSPointerUp":"pointerup",cs=Z.msPointer?"MSPointerCancel":"pointercancel",no={touchstart:_t,touchmove:bt,touchend:oa,touchcancel:cs},sa={touchstart:ds,touchmove:Wn,touchend:Wn,touchcancel:Wn},Ni={},aa=!1;function ir(e,n,o){return n==="touchstart"&<(),sa[n]?(o=sa[n].bind(this,o),e.addEventListener(no[n],o,!1),o):(console.warn("wrong event specified:",n),M)}function ra(e,n,o){if(!no[n]){console.warn("wrong event specified:",n);return}e.removeEventListener(no[n],o,!1)}function or(e){Ni[e.pointerId]=e}function sr(e){Ni[e.pointerId]&&(Ni[e.pointerId]=e)}function la(e){delete Ni[e.pointerId]}function lt(){aa||(document.addEventListener(_t,or,!0),document.addEventListener(bt,sr,!0),document.addEventListener(oa,la,!0),document.addEventListener(cs,la,!0),aa=!0)}function Wn(e,n){if(n.pointerType!==(n.MSPOINTER_TYPE_MOUSE||"mouse")){n.touches=[];for(var o in Ni)n.touches.push(Ni[o]);n.changedTouches=[n],e(n)}}function ds(e,n){n.MSPOINTER_TYPE_TOUCH&&n.pointerType===n.MSPOINTER_TYPE_TOUCH&&Ft(n),Wn(e,n)}function Xt(e){var n={},o,r;for(r in e)o=e[r],n[r]=o&&o.bind?o.bind(e):o;return e=n,n.type="dblclick",n.detail=2,n.isTrusted=!1,n._simulated=!0,n}var io=200;function zo(e,n){e.addEventListener("dblclick",n);var o=0,r;function d(v){if(v.detail!==1){r=v.detail;return}if(!(v.pointerType==="mouse"||v.sourceCapabilities&&!v.sourceCapabilities.firesTouchEvents)){var P=da(v);if(!(P.some(function(R){return R instanceof HTMLLabelElement&&R.attributes.for})&&!P.some(function(R){return R instanceof HTMLInputElement||R instanceof HTMLSelectElement}))){var D=Date.now();D-o<=io?(r++,r===2&&n(Xt(v))):r=1,o=D}}}return e.addEventListener("click",d),{dblclick:n,simDblclick:d}}function $o(e,n){e.removeEventListener("dblclick",n.dblclick),e.removeEventListener("click",n.simDblclick)}var Tn=Fo(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),$n=Fo(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),ua=$n==="webkitTransition"||$n==="OTransition"?$n+"End":"transitionend";function Io(e){return typeof e=="string"?document.getElementById(e):e}function mi(e,n){var o=e.style[n]||e.currentStyle&&e.currentStyle[n];if((!o||o==="auto")&&document.defaultView){var r=document.defaultView.getComputedStyle(e,null);o=r?r[n]:null}return o==="auto"?null:o}function it(e,n,o){var r=document.createElement(e);return r.className=n||"",o&&o.appendChild(r),r}function ot(e){var n=e.parentNode;n&&n.removeChild(e)}function Pn(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function Cn(e){var n=e.parentNode;n&&n.lastChild!==e&&n.appendChild(e)}function qt(e){var n=e.parentNode;n&&n.firstChild!==e&&n.insertBefore(e,n.firstChild)}function No(e,n){if(e.classList!==void 0)return e.classList.contains(n);var o=Do(e);return o.length>0&&new RegExp("(^|\\s)"+n+"(\\s|$)").test(o)}function He(e,n){if(e.classList!==void 0)for(var o=K(n),r=0,d=o.length;r0?2*window.devicePixelRatio:1;function fa(e){return Z.edge?e.wheelDeltaY/2:e.deltaY&&e.deltaMode===0?-e.deltaY/vs:e.deltaY&&e.deltaMode===1?-e.deltaY*20:e.deltaY&&e.deltaMode===2?-e.deltaY*60:e.deltaX||e.deltaZ?0:e.wheelDelta?(e.wheelDeltaY||e.wheelDelta)/2:e.detail&&Math.abs(e.detail)<32765?-e.detail*20:e.detail?e.detail/-32765*60:0}function Ae(e,n){var o=n.relatedTarget;if(!o)return!0;try{for(;o&&o!==e;)o=o.parentNode}catch{return!1}return o!==e}var Vi={__proto__:null,on:ze,off:Je,stopPropagation:_i,disableScrollPropagation:gs,disableClickPropagation:Bi,preventDefault:Ft,stop:bi,getPropagationPath:da,getMousePosition:Ui,getWheelDelta:fa,isExternalTarget:Ae,addListener:ze,removeListener:Je},so=ge.extend({run:function(e,n,o,r){this.stop(),this._el=e,this._inProgress=!0,this._duration=o||.25,this._easeOutPower=1/Math.max(r||.5,.2),this._startPos=Xe(e),this._offset=n.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=B(this._animate,this),this._step()},_step:function(e){var n=+new Date-this._startTime,o=this._duration*1e3;nthis.options.maxZoom)?this.setZoom(e):this},panInsideBounds:function(e,n){this._enforcingBounds=!0;var o=this.getCenter(),r=this._limitCenter(o,this._zoom,st(e));return o.equals(r)||this.panTo(r,n),this._enforcingBounds=!1,this},panInside:function(e,n){n=n||{};var o=pe(n.paddingTopLeft||n.padding||[0,0]),r=pe(n.paddingBottomRight||n.padding||[0,0]),d=this.project(this.getCenter()),v=this.project(e),P=this.getPixelBounds(),D=Ve([P.min.add(o),P.max.subtract(r)]),R=D.getSize();if(!D.contains(v)){this._enforcingBounds=!0;var ne=v.subtract(D.getCenter()),_e=D.extend(v).getSize().subtract(R);d.x+=ne.x<0?-_e.x:_e.x,d.y+=ne.y<0?-_e.y:_e.y,this.panTo(this.unproject(d),n),this._enforcingBounds=!1}return this},invalidateSize:function(e){if(!this._loaded)return this;e=u({animate:!1,pan:!0},e===!0?{animate:!0}:e);var n=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var o=this.getSize(),r=n.divideBy(2).round(),d=o.divideBy(2).round(),v=r.subtract(d);return!v.x&&!v.y?this:(e.animate&&e.pan?this.panBy(v):(e.pan&&this._rawPanBy(v),this.fire("move"),e.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(h(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:n,newSize:o}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(e){if(e=this._locateOptions=u({timeout:1e4,watch:!1},e),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var n=h(this._handleGeolocationResponse,this),o=h(this._handleGeolocationError,this);return e.watch?this._locationWatchId=navigator.geolocation.watchPosition(n,o,e):navigator.geolocation.getCurrentPosition(n,o,e),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(e){if(this._container._leaflet_id){var n=e.code,o=e.message||(n===1?"permission denied":n===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:n,message:"Geolocation error: "+o+"."})}},_handleGeolocationResponse:function(e){if(this._container._leaflet_id){var n=e.coords.latitude,o=e.coords.longitude,r=new Le(n,o),d=r.toBounds(e.coords.accuracy*2),v=this._locateOptions;if(v.setView){var P=this.getBoundsZoom(d);this.setView(r,v.maxZoom?Math.min(P,v.maxZoom):P)}var D={latlng:r,bounds:d,timestamp:e.timestamp};for(var R in e.coords)typeof e.coords[R]=="number"&&(D[R]=e.coords[R]);this.fire("locationfound",D)}},addHandler:function(e,n){if(!n)return this;var o=this[e]=new n(this);return this._handlers.push(o),this.options[e]&&o.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),ot(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(O(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var e;for(e in this._layers)this._layers[e].remove();for(e in this._panes)ot(this._panes[e]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(e,n){var o="leaflet-pane"+(e?" leaflet-"+e.replace("Pane","")+"-pane":""),r=it("div",o,n||this._mapPane);return e&&(this._panes[e]=r),r},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var e=this.getPixelBounds(),n=this.unproject(e.getBottomLeft()),o=this.unproject(e.getTopRight());return new wt(n,o)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(e,n,o){e=st(e),o=pe(o||[0,0]);var r=this.getZoom()||0,d=this.getMinZoom(),v=this.getMaxZoom(),P=e.getNorthWest(),D=e.getSouthEast(),R=this.getSize().subtract(o),ne=Ve(this.project(D,r),this.project(P,r)).getSize(),_e=Z.any3d?this.options.zoomSnap:1,Ne=R.x/ne.x,et=R.y/ne.y,un=n?Math.max(Ne,et):Math.min(Ne,et);return r=this.getScaleZoom(un,r),_e&&(r=Math.round(r/(_e/100))*(_e/100),r=n?Math.ceil(r/_e)*_e:Math.floor(r/_e)*_e),Math.max(d,Math.min(v,r))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new ue(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(e,n){var o=this._getTopLeftPoint(e,n);return new Ue(o,o.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(e){return this.options.crs.getProjectedBounds(e===void 0?this.getZoom():e)},getPane:function(e){return typeof e=="string"?this._panes[e]:e},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(e,n){var o=this.options.crs;return n=n===void 0?this._zoom:n,o.scale(e)/o.scale(n)},getScaleZoom:function(e,n){var o=this.options.crs;n=n===void 0?this._zoom:n;var r=o.zoom(e*o.scale(n));return isNaN(r)?1/0:r},project:function(e,n){return n=n===void 0?this._zoom:n,this.options.crs.latLngToPoint(De(e),n)},unproject:function(e,n){return n=n===void 0?this._zoom:n,this.options.crs.pointToLatLng(pe(e),n)},layerPointToLatLng:function(e){var n=pe(e).add(this.getPixelOrigin());return this.unproject(n)},latLngToLayerPoint:function(e){var n=this.project(De(e))._round();return n._subtract(this.getPixelOrigin())},wrapLatLng:function(e){return this.options.crs.wrapLatLng(De(e))},wrapLatLngBounds:function(e){return this.options.crs.wrapLatLngBounds(st(e))},distance:function(e,n){return this.options.crs.distance(De(e),De(n))},containerPointToLayerPoint:function(e){return pe(e).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(e){return pe(e).add(this._getMapPanePos())},containerPointToLatLng:function(e){var n=this.containerPointToLayerPoint(pe(e));return this.layerPointToLatLng(n)},latLngToContainerPoint:function(e){return this.layerPointToContainerPoint(this.latLngToLayerPoint(De(e)))},mouseEventToContainerPoint:function(e){return Ui(e,this._container)},mouseEventToLayerPoint:function(e){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e))},mouseEventToLatLng:function(e){return this.layerPointToLatLng(this.mouseEventToLayerPoint(e))},_initContainer:function(e){var n=this._container=Io(e);if(n){if(n._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");ze(n,"scroll",this._onScroll,this),this._containerId=y(n)},_initLayout:function(){var e=this._container;this._fadeAnimated=this.options.fadeAnimation&&Z.any3d,He(e,"leaflet-container"+(Z.touch?" leaflet-touch":"")+(Z.retina?" leaflet-retina":"")+(Z.ielt9?" leaflet-oldie":"")+(Z.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var n=mi(e,"position");n!=="absolute"&&n!=="relative"&&n!=="fixed"&&n!=="sticky"&&(e.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var e=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Mt(this._mapPane,new ue(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(He(e.markerPane,"leaflet-zoom-hide"),He(e.shadowPane,"leaflet-zoom-hide"))},_resetView:function(e,n,o){Mt(this._mapPane,new ue(0,0));var r=!this._loaded;this._loaded=!0,n=this._limitZoom(n),this.fire("viewprereset");var d=this._zoom!==n;this._moveStart(d,o)._move(e,n)._moveEnd(d),this.fire("viewreset"),r&&this.fire("load")},_moveStart:function(e,n){return e&&this.fire("zoomstart"),n||this.fire("movestart"),this},_move:function(e,n,o,r){n===void 0&&(n=this._zoom);var d=this._zoom!==n;return this._zoom=n,this._lastCenter=e,this._pixelOrigin=this._getNewPixelOrigin(e),r?o&&o.pinch&&this.fire("zoom",o):((d||o&&o.pinch)&&this.fire("zoom",o),this.fire("move",o)),this},_moveEnd:function(e){return e&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return O(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(e){Mt(this._mapPane,this._getMapPanePos().subtract(e))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(e){this._targets={},this._targets[y(this._container)]=this;var n=e?Je:ze;n(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&n(window,"resize",this._onResize,this),Z.any3d&&this.options.transform3DLimit&&(e?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){O(this._resizeRequest),this._resizeRequest=B(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var e=this._getMapPanePos();Math.max(Math.abs(e.x),Math.abs(e.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(e,n){for(var o=[],r,d=n==="mouseout"||n==="mouseover",v=e.target||e.srcElement,P=!1;v;){if(r=this._targets[y(v)],r&&(n==="click"||n==="preclick")&&this._draggableMoved(r)){P=!0;break}if(r&&r.listens(n,!0)&&(d&&!Ae(v,e)||(o.push(r),d))||v===this._container)break;v=v.parentNode}return!o.length&&!P&&!d&&this.listens(n,!0)&&(o=[this]),o},_isClickDisabled:function(e){for(;e&&e!==this._container;){if(e._leaflet_disable_click)return!0;e=e.parentNode}},_handleDOMEvent:function(e){var n=e.target||e.srcElement;if(!(!this._loaded||n._leaflet_disable_events||e.type==="click"&&this._isClickDisabled(n))){var o=e.type;o==="mousedown"&&Ro(n),this._fireDOMEvent(e,o)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(e,n,o){if(e.type==="click"){var r=u({},e);r.type="preclick",this._fireDOMEvent(r,r.type,o)}var d=this._findEventTargets(e,n);if(o){for(var v=[],P=0;P0?Math.round(e-n)/2:Math.max(0,Math.ceil(e))-Math.max(0,Math.floor(n))},_limitZoom:function(e){var n=this.getMinZoom(),o=this.getMaxZoom(),r=Z.any3d?this.options.zoomSnap:1;return r&&(e=Math.round(e/r)*r),Math.max(n,Math.min(o,e))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Lt(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(e,n){var o=this._getCenterOffset(e)._trunc();return(n&&n.animate)!==!0&&!this.getSize().contains(o)?!1:(this.panBy(o,n),!0)},_createAnimProxy:function(){var e=this._proxy=it("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(e),this.on("zoomanim",function(n){var o=Tn,r=this._proxy.style[o];gi(this._proxy,this.project(n.center,n.zoom),this.getZoomScale(n.zoom,1)),r===this._proxy.style[o]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ot(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var e=this.getCenter(),n=this.getZoom();gi(this._proxy,this.project(e,n),this.getZoomScale(n,1))},_catchTransitionEnd:function(e){this._animatingZoom&&e.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(e,n,o){if(this._animatingZoom)return!0;if(o=o||{},!this._zoomAnimated||o.animate===!1||this._nothingToAnimate()||Math.abs(n-this._zoom)>this.options.zoomAnimationThreshold)return!1;var r=this.getZoomScale(n),d=this._getCenterOffset(e)._divideBy(1-1/r);return o.animate!==!0&&!this.getSize().contains(d)?!1:(B(function(){this._moveStart(!0,o.noMoveStart||!1)._animateZoom(e,n,!0)},this),!0)},_animateZoom:function(e,n,o,r){this._mapPane&&(o&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=n,He(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:e,zoom:n,noUpdate:r}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(h(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Lt(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Vo(e,n){return new qe(e,n)}var en=$.extend({options:{position:"topright"},initialize:function(e){F(this,e)},getPosition:function(){return this.options.position},setPosition:function(e){var n=this._map;return n&&n.removeControl(this),this.options.position=e,n&&n.addControl(this),this},getContainer:function(){return this._container},addTo:function(e){this.remove(),this._map=e;var n=this._container=this.onAdd(e),o=this.getPosition(),r=e._controlCorners[o];return He(n,"leaflet-control"),o.indexOf("bottom")!==-1?r.insertBefore(n,r.firstChild):r.appendChild(n),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(ot(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(e){this._map&&e&&e.screenX>0&&e.screenY>0&&this._map.getContainer().focus()}}),ln=function(e){return new en(e)};qe.include({addControl:function(e){return e.addTo(this),this},removeControl:function(e){return e.remove(),this},_initControlPos:function(){var e=this._controlCorners={},n="leaflet-",o=this._controlContainer=it("div",n+"control-container",this._container);function r(d,v){var P=n+d+" "+n+v;e[d+v]=it("div",P,o)}r("top","left"),r("top","right"),r("bottom","left"),r("bottom","right")},_clearControlPos:function(){for(var e in this._controlCorners)ot(this._controlCorners[e]);ot(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var yi=en.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(e,n,o,r){return o1,this._baseLayersList.style.display=e?"":"none"),this._separator.style.display=n&&e?"":"none",this},_onLayerChange:function(e){this._handlingClick||this._update();var n=this._getLayer(y(e.target)),o=n.overlay?e.type==="add"?"overlayadd":"overlayremove":e.type==="add"?"baselayerchange":null;o&&this._map.fire(o,n)},_createRadioElement:function(e,n){var o='",r=document.createElement("div");return r.innerHTML=o,r.firstChild},_addItem:function(e){var n=document.createElement("label"),o=this._map.hasLayer(e.layer),r;e.overlay?(r=document.createElement("input"),r.type="checkbox",r.className="leaflet-control-layers-selector",r.defaultChecked=o):r=this._createRadioElement("leaflet-base-layers_"+y(this),o),this._layerControlInputs.push(r),r.layerId=y(e.layer),ze(r,"click",this._onInputClick,this);var d=document.createElement("span");d.innerHTML=" "+e.name;var v=document.createElement("span");n.appendChild(v),v.appendChild(r),v.appendChild(d);var P=e.overlay?this._overlaysList:this._baseLayersList;return P.appendChild(n),this._checkDisabledLayers(),n},_onInputClick:function(){if(!this._preventClick){var e=this._layerControlInputs,n,o,r=[],d=[];this._handlingClick=!0;for(var v=e.length-1;v>=0;v--)n=e[v],o=this._getLayer(n.layerId).layer,n.checked?r.push(o):n.checked||d.push(o);for(v=0;v=0;d--)n=e[d],o=this._getLayer(n.layerId).layer,n.disabled=o.options.minZoom!==void 0&&ro.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var e=this._section;this._preventClick=!0,ze(e,"click",Ft),this.expand();var n=this;setTimeout(function(){Je(e,"click",Ft),n._preventClick=!1})}}),ao=function(e,n,o){return new yi(e,n,o)},Zo=en.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(e){var n="leaflet-control-zoom",o=it("div",n+" leaflet-bar"),r=this.options;return this._zoomInButton=this._createButton(r.zoomInText,r.zoomInTitle,n+"-in",o,this._zoomIn),this._zoomOutButton=this._createButton(r.zoomOutText,r.zoomOutTitle,n+"-out",o,this._zoomOut),this._updateDisabled(),e.on("zoomend zoomlevelschange",this._updateDisabled,this),o},onRemove:function(e){e.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(e){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(e.shiftKey?3:1))},_createButton:function(e,n,o,r,d){var v=it("a",o,r);return v.innerHTML=e,v.href="#",v.title=n,v.setAttribute("role","button"),v.setAttribute("aria-label",n),Bi(v),ze(v,"click",bi),ze(v,"click",d,this),ze(v,"click",this._refocusOnMap,this),v},_updateDisabled:function(){var e=this._map,n="leaflet-disabled";Lt(this._zoomInButton,n),Lt(this._zoomOutButton,n),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||e._zoom===e.getMinZoom())&&(He(this._zoomOutButton,n),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||e._zoom===e.getMaxZoom())&&(He(this._zoomInButton,n),this._zoomInButton.setAttribute("aria-disabled","true"))}});qe.mergeOptions({zoomControl:!0}),qe.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Zo,this.addControl(this.zoomControl))});var _s=function(e){return new Zo(e)},Ho=en.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(e){var n="leaflet-control-scale",o=it("div",n),r=this.options;return this._addScales(r,n+"-line",o),e.on(r.updateWhenIdle?"moveend":"move",this._update,this),e.whenReady(this._update,this),o},onRemove:function(e){e.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(e,n,o){e.metric&&(this._mScale=it("div",n,o)),e.imperial&&(this._iScale=it("div",n,o))},_update:function(){var e=this._map,n=e.getSize().y/2,o=e.distance(e.containerPointToLatLng([0,n]),e.containerPointToLatLng([this.options.maxWidth,n]));this._updateScales(o)},_updateScales:function(e){this.options.metric&&e&&this._updateMetric(e),this.options.imperial&&e&&this._updateImperial(e)},_updateMetric:function(e){var n=this._getRoundNum(e),o=n<1e3?n+" m":n/1e3+" km";this._updateScale(this._mScale,o,n/e)},_updateImperial:function(e){var n=e*3.2808399,o,r,d;n>5280?(o=n/5280,r=this._getRoundNum(o),this._updateScale(this._iScale,r+" mi",r/o)):(d=this._getRoundNum(n),this._updateScale(this._iScale,d+" ft",d/n))},_updateScale:function(e,n,o){e.style.width=Math.round(this.options.maxWidth*o)+"px",e.innerHTML=n},_getRoundNum:function(e){var n=Math.pow(10,(Math.floor(e)+"").length-1),o=e/n;return o=o>=10?10:o>=5?5:o>=3?3:o>=2?2:1,n*o}}),ar=function(e){return new Ho(e)},gn='',Zi=en.extend({options:{position:"bottomright",prefix:''+(Z.inlineSvg?gn+" ":"")+"Leaflet"},initialize:function(e){F(this,e),this._attributions={}},onAdd:function(e){e.attributionControl=this,this._container=it("div","leaflet-control-attribution"),Bi(this._container);for(var n in e._layers)e._layers[n].getAttribution&&this.addAttribution(e._layers[n].getAttribution());return this._update(),e.on("layeradd",this._addAttribution,this),this._container},onRemove:function(e){e.off("layeradd",this._addAttribution,this)},_addAttribution:function(e){e.layer.getAttribution&&(this.addAttribution(e.layer.getAttribution()),e.layer.once("remove",function(){this.removeAttribution(e.layer.getAttribution())},this))},setPrefix:function(e){return this.options.prefix=e,this._update(),this},addAttribution:function(e){return e?(this._attributions[e]||(this._attributions[e]=0),this._attributions[e]++,this._update(),this):this},removeAttribution:function(e){return e?(this._attributions[e]&&(this._attributions[e]--,this._update()),this):this},_update:function(){if(this._map){var e=[];for(var n in this._attributions)this._attributions[n]&&e.push(n);var o=[];this.options.prefix&&o.push(this.options.prefix),e.length&&o.push(e.join(", ")),this._container.innerHTML=o.join(' ')}}});qe.mergeOptions({attributionControl:!0}),qe.addInitHook(function(){this.options.attributionControl&&new Zi().addTo(this)});var ha=function(e){return new Zi(e)};en.Layers=yi,en.Zoom=Zo,en.Scale=Ho,en.Attribution=Zi,ln.layers=ao,ln.zoom=_s,ln.scale=ar,ln.attribution=ha;var An=$.extend({initialize:function(e){this._map=e},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});An.addTo=function(e,n){return e.addHandler(n,this),this};var rr={Events:we},bs=Z.touch?"touchstart mousedown":"mousedown",vn=ge.extend({options:{clickTolerance:3},initialize:function(e,n,o,r){F(this,r),this._element=e,this._dragStartTarget=n||e,this._preventOutline=o},enable:function(){this._enabled||(ze(this._dragStartTarget,bs,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(vn._dragging===this&&this.finishDrag(!0),Je(this._dragStartTarget,bs,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(e){if(this._enabled&&(this._moved=!1,!No(this._element,"leaflet-zoom-anim"))){if(e.touches&&e.touches.length!==1){vn._dragging===this&&this.finishDrag();return}if(!(vn._dragging||e.shiftKey||e.which!==1&&e.button!==1&&!e.touches)&&(vn._dragging=this,this._preventOutline&&Ro(this._element),Di(),In(),!this._moving)){this.fire("down");var n=e.touches?e.touches[0]:e,o=Bo(this._element);this._startPoint=new ue(n.clientX,n.clientY),this._startPos=Xe(this._element),this._parentScale=hs(o);var r=e.type==="mousedown";ze(document,r?"mousemove":"touchmove",this._onMove,this),ze(document,r?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(e){if(this._enabled){if(e.touches&&e.touches.length>1){this._moved=!0;return}var n=e.touches&&e.touches.length===1?e.touches[0]:e,o=new ue(n.clientX,n.clientY)._subtract(this._startPoint);!o.x&&!o.y||Math.abs(o.x)+Math.abs(o.y)v&&(P=D,v=R);v>o&&(n[P]=1,ws(e,n,o,r,P),ws(e,n,o,P,d))}function va(e,n){for(var o=[e[0]],r=1,d=0,v=e.length;rn&&(o.push(e[r]),d=r);return dn.max.x&&(o|=2),e.yn.max.y&&(o|=8),o}function ks(e,n){var o=n.x-e.x,r=n.y-e.y;return o*o+r*r}function We(e,n,o,r){var d=n.x,v=n.y,P=o.x-d,D=o.y-v,R=P*P+D*D,ne;return R>0&&(ne=((e.x-d)*P+(e.y-v)*D)/R,ne>1?(d=o.x,v=o.y):ne>0&&(d+=P*ne,v+=D*ne)),P=e.x-d,D=e.y-v,r?P*P+D*D:new ue(d,v)}function yt(e){return!Se(e[0])||typeof e[0][0]!="object"&&typeof e[0][0]<"u"}function xi(e){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),yt(e)}function Ss(e,n){var o,r,d,v,P,D,R,ne;if(!e||e.length===0)throw new Error("latlngs not passed");yt(e)||(console.warn("latlngs are not flat! Only the first ring will be used"),e=e[0]);var _e=De([0,0]),Ne=st(e),et=Ne.getNorthWest().distanceTo(Ne.getSouthWest())*Ne.getNorthEast().distanceTo(Ne.getNorthWest());et<1700&&(_e=ys(e));var un=e.length,Wt=[];for(o=0;or){R=(v-r)/d,ne=[D.x-R*(D.x-P.x),D.y-R*(D.y-P.y)];break}var xn=n.unproject(pe(ne));return De([xn.lat+_e.lat,xn.lng+_e.lng])}var dr={__proto__:null,simplify:xs,pointToSegmentDistance:ga,closestPointOnSegment:ur,clipSegment:jo,_getEdgeIntersection:Hi,_getBitCode:Nn,_sqClosestPointOnSegment:We,isFlat:yt,_flat:xi,polylineCenter:Ss},ro={project:function(e){return new ue(e.lng,e.lat)},unproject:function(e){return new Le(e.y,e.x)},bounds:new Ue([-180,-90],[180,90])},Ts={R:6378137,R_MINOR:6356752314245179e-9,bounds:new Ue([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(e){var n=Math.PI/180,o=this.R,r=e.lat*n,d=this.R_MINOR/o,v=Math.sqrt(1-d*d),P=v*Math.sin(r),D=Math.tan(Math.PI/4-r/2)/Math.pow((1-P)/(1+P),v/2);return r=-o*Math.log(Math.max(D,1e-10)),new ue(e.lng*n*o,r)},unproject:function(e){for(var n=180/Math.PI,o=this.R,r=this.R_MINOR/o,d=Math.sqrt(1-r*r),v=Math.exp(-e.y/o),P=Math.PI/2-2*Math.atan(v),D=0,R=.1,ne;D<15&&Math.abs(R)>1e-7;D++)ne=d*Math.sin(P),ne=Math.pow((1-ne)/(1+ne),d/2),R=Math.PI/2-2*Math.atan(v*ne)-P,P+=R;return new Le(P*n,e.x*n/o)}},fr={__proto__:null,LonLat:ro,Mercator:Ts,SphericalMercator:Pt},hr=u({},At,{code:"EPSG:3395",projection:Ts,transformation:(function(){var e=.5/(Math.PI*Ts.R);return x(e,.5,-e,.5)})()}),ba=u({},At,{code:"EPSG:4326",projection:ro,transformation:x(1/180,1,-1/180,.5)}),lo=u({},zt,{projection:ro,transformation:x(1,0,-1,0),scale:function(e){return Math.pow(2,e)},zoom:function(e){return Math.log(e)/Math.LN2},distance:function(e,n){var o=n.lng-e.lng,r=n.lat-e.lat;return Math.sqrt(o*o+r*r)},infinite:!0});zt.Earth=At,zt.EPSG3395=hr,zt.EPSG3857=b,zt.EPSG900913=S,zt.EPSG4326=ba,zt.Simple=lo;var _n=ge.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(e){return e.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(e){return e&&e.removeLayer(this),this},getPane:function(e){return this._map.getPane(e?this.options[e]||e:this.options.pane)},addInteractiveTarget:function(e){return this._map._targets[y(e)]=this,this},removeInteractiveTarget:function(e){return delete this._map._targets[y(e)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(e){var n=e.target;if(n.hasLayer(this)){if(this._map=n,this._zoomAnimated=n._zoomAnimated,this.getEvents){var o=this.getEvents();n.on(o,this),this.once("remove",function(){n.off(o,this)},this)}this.onAdd(n),this.fire("add"),n.fire("layeradd",{layer:this})}}});qe.include({addLayer:function(e){if(!e._layerAdd)throw new Error("The provided object is not a Layer.");var n=y(e);return this._layers[n]?this:(this._layers[n]=e,e._mapToAdd=this,e.beforeAdd&&e.beforeAdd(this),this.whenReady(e._layerAdd,e),this)},removeLayer:function(e){var n=y(e);return this._layers[n]?(this._loaded&&e.onRemove(this),delete this._layers[n],this._loaded&&(this.fire("layerremove",{layer:e}),e.fire("remove")),e._map=e._mapToAdd=null,this):this},hasLayer:function(e){return y(e)in this._layers},eachLayer:function(e,n){for(var o in this._layers)e.call(n,this._layers[o]);return this},_addLayers:function(e){e=e?Se(e)?e:[e]:[];for(var n=0,o=e.length;nthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&n[0]instanceof Le&&n[0].equals(n[o-1])&&n.pop(),n},_setLatLngs:function(e){tn.prototype._setLatLngs.call(this,e),yt(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return yt(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var e=this._renderer._bounds,n=this.options.weight,o=new ue(n,n);if(e=new Ue(e.min.subtract(o),e.max.add(o)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(e))){if(this.options.noClip){this._parts=this._rings;return}for(var r=0,d=this._rings.length,v;re.y!=d.y>e.y&&e.x<(d.x-r.x)*(e.y-r.y)/(d.y-r.y)+r.x&&(n=!n);return n||tn.prototype._containsPoint.call(this,e,!0)}});function ya(e,n){return new Dn(e,n)}var yn=bn.extend({initialize:function(e,n){F(this,n),this._layers={},e&&this.addData(e)},addData:function(e){var n=Se(e)?e:e.features,o,r,d;if(n){for(o=0,r=n.length;o0&&d.push(d[0].slice()),d}function Qe(e,n){return e.feature?u({},e.feature,{geometry:n}):En(n)}function En(e){return e.type==="Feature"||e.type==="FeatureCollection"?e:{type:"Feature",properties:{},geometry:e}}var Ki={toGeoJSON:function(e){return Qe(this,{type:"Point",coordinates:Ls(this.getLatLng(),e)})}};Wo.include(Ki),Wi.include(Ki),wi.include(Ki),tn.include({toGeoJSON:function(e){var n=!yt(this._latlngs),o=Go(this._latlngs,n?1:0,!1,e);return Qe(this,{type:(n?"Multi":"")+"LineString",coordinates:o})}}),Dn.include({toGeoJSON:function(e){var n=!yt(this._latlngs),o=n&&!yt(this._latlngs[0]),r=Go(this._latlngs,o?2:n?1:0,!0,e);return n||(r=[r]),Qe(this,{type:(o?"Multi":"")+"Polygon",coordinates:r})}}),qn.include({toMultiPoint:function(e){var n=[];return this.eachLayer(function(o){n.push(o.toGeoJSON(e).geometry.coordinates)}),Qe(this,{type:"MultiPoint",coordinates:n})},toGeoJSON:function(e){var n=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(n==="MultiPoint")return this.toMultiPoint(e);var o=n==="GeometryCollection",r=[];return this.eachLayer(function(d){if(d.toGeoJSON){var v=d.toGeoJSON(e);if(o)r.push(v.geometry);else{var P=En(v);P.type==="FeatureCollection"?r.push.apply(r,P.features):r.push(P)}}}),o?Qe(this,{geometries:r,type:"GeometryCollection"}):{type:"FeatureCollection",features:r}}});function qo(e,n){return new yn(e,n)}var gr=qo,ho=_n.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(e,n,o){this._url=e,this._bounds=st(n),F(this,o)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(He(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){ot(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(e){return this.options.opacity=e,this._image&&this._updateOpacity(),this},setStyle:function(e){return e.opacity&&this.setOpacity(e.opacity),this},bringToFront:function(){return this._map&&Cn(this._image),this},bringToBack:function(){return this._map&&qt(this._image),this},setUrl:function(e){return this._url=e,this._image&&(this._image.src=e),this},setBounds:function(e){return this._bounds=st(e),this._map&&this._reset(),this},getEvents:function(){var e={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var e=this._url.tagName==="IMG",n=this._image=e?this._url:it("img");if(He(n,"leaflet-image-layer"),this._zoomAnimated&&He(n,"leaflet-zoom-animated"),this.options.className&&He(n,this.options.className),n.onselectstart=M,n.onmousemove=M,n.onload=h(this.fire,this,"load"),n.onerror=h(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(n.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),e){this._url=n.src;return}n.src=this._url,n.alt=this.options.alt},_animateZoom:function(e){var n=this._map.getZoomScale(e.zoom),o=this._map._latLngBoundsToNewLayerBounds(this._bounds,e.zoom,e.center).min;gi(this._image,o,n)},_reset:function(){var e=this._image,n=new Ue(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),o=n.getSize();Mt(e,n.min),e.style.width=o.x+"px",e.style.height=o.y+"px"},_updateOpacity:function(){mn(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var e=this.options.errorOverlayUrl;e&&this._url!==e&&(this._url=e,this._image.src=e)},getCenter:function(){return this._bounds.getCenter()}}),vr=function(e,n,o){return new ho(e,n,o)},po=ho.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var e=this._url.tagName==="VIDEO",n=this._image=e?this._url:it("video");if(He(n,"leaflet-image-layer"),this._zoomAnimated&&He(n,"leaflet-zoom-animated"),this.options.className&&He(n,this.options.className),n.onselectstart=M,n.onmousemove=M,n.onloadeddata=h(this.fire,this,"load"),e){for(var o=n.getElementsByTagName("source"),r=[],d=0;d0?r:[n.src];return}Se(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(n.style,"objectFit")&&(n.style.objectFit="fill"),n.autoplay=!!this.options.autoplay,n.loop=!!this.options.loop,n.muted=!!this.options.muted,n.playsInline=!!this.options.playsInline;for(var v=0;vd?(n.height=d+"px",He(e,v)):Lt(e,v),this._containerWidth=this._container.offsetWidth},_animateZoom:function(e){var n=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center),o=this._getAnchor();Mt(this._container,n.add(o))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var e=this._map,n=parseInt(mi(this._container,"marginBottom"),10)||0,o=this._container.offsetHeight+n,r=this._containerWidth,d=new ue(this._containerLeft,-o-this._containerBottom);d._add(Xe(this._container));var v=e.layerPointToContainerPoint(d),P=pe(this.options.autoPanPadding),D=pe(this.options.autoPanPaddingTopLeft||P),R=pe(this.options.autoPanPaddingBottomRight||P),ne=e.getSize(),_e=0,Ne=0;v.x+r+R.x>ne.x&&(_e=v.x+r-ne.x+R.x),v.x-_e-D.x<0&&(_e=v.x-D.x),v.y+o+R.y>ne.y&&(Ne=v.y+o-ne.y+R.y),v.y-Ne-D.y<0&&(Ne=v.y-D.y),(_e||Ne)&&(this.options.keepInView&&(this._autopanning=!0),e.fire("autopanstart").panBy([_e,Ne]))}},_getAnchor:function(){return pe(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),As=function(e,n){return new Fn(e,n)};qe.mergeOptions({closePopupOnClick:!0}),qe.include({openPopup:function(e,n,o){return this._initOverlay(Fn,e,n,o).openOn(this),this},closePopup:function(e){return e=arguments.length?e:this._popup,e&&e.close(),this}}),_n.include({bindPopup:function(e,n){return this._popup=this._initOverlay(Fn,this._popup,e,n),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(e){return this._popup&&(this instanceof bn||(this._popup._source=this),this._popup._prepareOpen(e||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(e){return this._popup&&this._popup.setContent(e),this},getPopup:function(){return this._popup},_openPopup:function(e){if(!(!this._popup||!this._map)){bi(e);var n=e.layer||e.target;if(this._popup._source===n&&!(n instanceof ti)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(e.latlng);return}this._popup._source=n,this.openPopup(e.latlng)}},_movePopup:function(e){this._popup.setLatLng(e.latlng)},_onKeyPress:function(e){e.originalEvent.keyCode===13&&this._openPopup(e)}});var _o=Nt.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(e){Nt.prototype.onAdd.call(this,e),this.setOpacity(this.options.opacity),e.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(e){Nt.prototype.onRemove.call(this,e),e.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var e=Nt.prototype.getEvents.call(this);return this.options.permanent||(e.preclick=this.close),e},_initLayout:function(){var e="leaflet-tooltip",n=e+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=it("div",n),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+y(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(e){var n,o,r=this._map,d=this._container,v=r.latLngToContainerPoint(r.getCenter()),P=r.layerPointToContainerPoint(e),D=this.options.direction,R=d.offsetWidth,ne=d.offsetHeight,_e=pe(this.options.offset),Ne=this._getAnchor();D==="top"?(n=R/2,o=ne):D==="bottom"?(n=R/2,o=0):D==="center"?(n=R/2,o=ne/2):D==="right"?(n=0,o=ne/2):D==="left"?(n=R,o=ne/2):P.xthis.options.maxZoom||or?this._retainParent(d,v,P,r):!1)},_retainChildren:function(e,n,o,r){for(var d=2*e;d<2*e+2;d++)for(var v=2*n;v<2*n+2;v++){var P=new ue(d,v);P.z=o+1;var D=this._tileCoordsToKey(P),R=this._tiles[D];if(R&&R.active){R.retain=!0;continue}else R&&R.loaded&&(R.retain=!0);o+1this.options.maxZoom||this.options.minZoom!==void 0&&d1){this._setView(e,o);return}for(var Ne=d.min.y;Ne<=d.max.y;Ne++)for(var et=d.min.x;et<=d.max.x;et++){var un=new ue(et,Ne);if(un.z=this._tileZoom,!!this._isValidTile(un)){var Wt=this._tiles[this._tileCoordsToKey(un)];Wt?Wt.current=!0:P.push(un)}}if(P.sort(function(xn,Jo){return xn.distanceTo(v)-Jo.distanceTo(v)}),P.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Rn=document.createDocumentFragment();for(et=0;eto.max.x)||!n.wrapLat&&(e.yo.max.y))return!1}if(!this.options.bounds)return!0;var r=this._tileCoordsToBounds(e);return st(this.options.bounds).overlaps(r)},_keyToBounds:function(e){return this._tileCoordsToBounds(this._keyToTileCoords(e))},_tileCoordsToNwSe:function(e){var n=this._map,o=this.getTileSize(),r=e.scaleBy(o),d=r.add(o),v=n.unproject(r,e.z),P=n.unproject(d,e.z);return[v,P]},_tileCoordsToBounds:function(e){var n=this._tileCoordsToNwSe(e),o=new wt(n[0],n[1]);return this.options.noWrap||(o=this._map.wrapLatLngBounds(o)),o},_tileCoordsToKey:function(e){return e.x+":"+e.y+":"+e.z},_keyToTileCoords:function(e){var n=e.split(":"),o=new ue(+n[0],+n[1]);return o.z=+n[2],o},_removeTile:function(e){var n=this._tiles[e];n&&(ot(n.el),delete this._tiles[e],this.fire("tileunload",{tile:n.el,coords:this._keyToTileCoords(e)}))},_initTile:function(e){He(e,"leaflet-tile");var n=this.getTileSize();e.style.width=n.x+"px",e.style.height=n.y+"px",e.onselectstart=M,e.onmousemove=M,Z.ielt9&&this.options.opacity<1&&mn(e,this.options.opacity)},_addTile:function(e,n){var o=this._getTilePos(e),r=this._tileCoordsToKey(e),d=this.createTile(this._wrapCoords(e),h(this._tileReady,this,e));this._initTile(d),this.createTile.length<2&&B(h(this._tileReady,this,e,null,d)),Mt(d,o),this._tiles[r]={el:d,coords:e,current:!0},n.appendChild(d),this.fire("tileloadstart",{tile:d,coords:e})},_tileReady:function(e,n,o){n&&this.fire("tileerror",{error:n,tile:o,coords:e});var r=this._tileCoordsToKey(e);o=this._tiles[r],o&&(o.loaded=+new Date,this._map._fadeAnimated?(mn(o.el,0),O(this._fadeFrame),this._fadeFrame=B(this._updateOpacity,this)):(o.active=!0,this._pruneTiles()),n||(He(o.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:o.el,coords:e})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Z.ielt9||!this._map._fadeAnimated?B(this._pruneTiles,this):setTimeout(h(this._pruneTiles,this),250)))},_getTilePos:function(e){return e.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(e){var n=new ue(this._wrapX?T(e.x,this._wrapX):e.x,this._wrapY?T(e.y,this._wrapY):e.y);return n.z=e.z,n},_pxBoundsToTileRange:function(e){var n=this.getTileSize();return new Ue(e.min.unscaleBy(n).floor(),e.max.unscaleBy(n).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var e in this._tiles)if(!this._tiles[e].loaded)return!1;return!0}});function br(e){return new bo(e)}var Yn=bo.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(e,n){this._url=e,n=F(this,n),n.detectRetina&&Z.retina&&n.maxZoom>0?(n.tileSize=Math.floor(n.tileSize/2),n.zoomReverse?(n.zoomOffset--,n.minZoom=Math.min(n.maxZoom,n.minZoom+1)):(n.zoomOffset++,n.maxZoom=Math.max(n.minZoom,n.maxZoom-1)),n.minZoom=Math.max(0,n.minZoom)):n.zoomReverse?n.minZoom=Math.min(n.maxZoom,n.minZoom):n.maxZoom=Math.max(n.minZoom,n.maxZoom),typeof n.subdomains=="string"&&(n.subdomains=n.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(e,n){return this._url===e&&n===void 0&&(n=!0),this._url=e,n||this.redraw(),this},createTile:function(e,n){var o=document.createElement("img");return ze(o,"load",h(this._tileOnLoad,this,n,o)),ze(o,"error",h(this._tileOnError,this,n,o)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(o.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(o.referrerPolicy=this.options.referrerPolicy),o.alt="",o.src=this.getTileUrl(e),o},getTileUrl:function(e){var n={r:Z.retina?"@2x":"",s:this._getSubdomain(e),x:e.x,y:e.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var o=this._globalTileRange.max.y-e.y;this.options.tms&&(n.y=o),n["-y"]=o}return fe(this._url,u(n,this.options))},_tileOnLoad:function(e,n){Z.ielt9?setTimeout(h(e,this,null,n),0):e(null,n)},_tileOnError:function(e,n,o){var r=this.options.errorTileUrl;r&&n.getAttribute("src")!==r&&(n.src=r),e(o,n)},_onTileRemove:function(e){e.tile.onload=null},_getZoomForUrl:function(){var e=this._tileZoom,n=this.options.maxZoom,o=this.options.zoomReverse,r=this.options.zoomOffset;return o&&(e=n-e),e+r},_getSubdomain:function(e){var n=Math.abs(e.x+e.y)%this.options.subdomains.length;return this.options.subdomains[n]},_abortLoading:function(){var e,n;for(e in this._tiles)if(this._tiles[e].coords.z!==this._tileZoom&&(n=this._tiles[e].el,n.onload=M,n.onerror=M,!n.complete)){n.src=Fe;var o=this._tiles[e].coords;ot(n),delete this._tiles[e],this.fire("tileabort",{tile:n,coords:o})}},_removeTile:function(e){var n=this._tiles[e];if(n)return n.el.setAttribute("src",Fe),bo.prototype._removeTile.call(this,e)},_tileReady:function(e,n,o){if(!(!this._map||o&&o.getAttribute("src")===Fe))return bo.prototype._tileReady.call(this,e,n,o)}});function wa(e,n){return new Yn(e,n)}var mt=Yn.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(e,n){this._url=e;var o=u({},this.defaultWmsParams);for(var r in n)r in this.options||(o[r]=n[r]);n=F(this,n);var d=n.detectRetina&&Z.retina?2:1,v=this.getTileSize();o.width=v.x*d,o.height=v.y*d,this.wmsParams=o},onAdd:function(e){this._crs=this.options.crs||e.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var n=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[n]=this._crs.code,Yn.prototype.onAdd.call(this,e)},getTileUrl:function(e){var n=this._tileCoordsToNwSe(e),o=this._crs,r=Ve(o.project(n[0]),o.project(n[1])),d=r.min,v=r.max,P=(this._wmsVersion>=1.3&&this._crs===ba?[d.y,d.x,v.y,v.x]:[d.x,d.y,v.x,v.y]).join(","),D=Yn.prototype.getTileUrl.call(this,e);return D+te(this.wmsParams,D,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+P},setParams:function(e,n){return u(this.wmsParams,e),n||this.redraw(),this}});function yo(e,n){return new mt(e,n)}Yn.WMS=mt,wa.wms=yo;var On=_n.extend({options:{padding:.1},initialize:function(e){F(this,e),y(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),He(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var e={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(e.zoomanim=this._onAnimZoom),e},_onAnimZoom:function(e){this._updateTransform(e.center,e.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(e,n){var o=this._map.getZoomScale(n,this._zoom),r=this._map.getSize().multiplyBy(.5+this.options.padding),d=this._map.project(this._center,n),v=r.multiplyBy(-o).add(d).subtract(this._map._getNewPixelOrigin(e,n));Z.any3d?gi(this._container,v,o):Mt(this._container,v)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var e in this._layers)this._layers[e]._reset()},_onZoomEnd:function(){for(var e in this._layers)this._layers[e]._project()},_updatePaths:function(){for(var e in this._layers)this._layers[e]._update()},_update:function(){var e=this.options.padding,n=this._map.getSize(),o=this._map.containerPointToLayerPoint(n.multiplyBy(-e)).round();this._bounds=new Ue(o,o.add(n.multiplyBy(1+e*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Yo=On.extend({options:{tolerance:0},getEvents:function(){var e=On.prototype.getEvents.call(this);return e.viewprereset=this._onViewPreReset,e},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){On.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var e=this._container=document.createElement("canvas");ze(e,"mousemove",this._onMouseMove,this),ze(e,"click dblclick mousedown mouseup contextmenu",this._onClick,this),ze(e,"mouseout",this._handleMouseOut,this),e._leaflet_disable_events=!0,this._ctx=e.getContext("2d")},_destroyContainer:function(){O(this._redrawRequest),delete this._ctx,ot(this._container),Je(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var e;this._redrawBounds=null;for(var n in this._layers)e=this._layers[n],e._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){On.prototype._update.call(this);var e=this._bounds,n=this._container,o=e.getSize(),r=Z.retina?2:1;Mt(n,e.min),n.width=r*o.x,n.height=r*o.y,n.style.width=o.x+"px",n.style.height=o.y+"px",Z.retina&&this._ctx.scale(2,2),this._ctx.translate(-e.min.x,-e.min.y),this.fire("update")}},_reset:function(){On.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(e){this._updateDashArray(e),this._layers[y(e)]=e;var n=e._order={layer:e,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=n),this._drawLast=n,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(e){this._requestRedraw(e)},_removePath:function(e){var n=e._order,o=n.next,r=n.prev;o?o.prev=r:this._drawLast=r,r?r.next=o:this._drawFirst=o,delete e._order,delete this._layers[y(e)],this._requestRedraw(e)},_updatePath:function(e){this._extendRedrawBounds(e),e._project(),e._update(),this._requestRedraw(e)},_updateStyle:function(e){this._updateDashArray(e),this._requestRedraw(e)},_updateDashArray:function(e){if(typeof e.options.dashArray=="string"){var n=e.options.dashArray.split(/[, ]+/),o=[],r,d;for(d=0;d')}}catch{}return function(e){return document.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),g={_initContainer:function(){this._container=it("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(On.prototype._update.call(this),this.fire("update"))},_initPath:function(e){var n=e._container=xo("shape");He(n,"leaflet-vml-shape "+(this.options.className||"")),n.coordsize="1 1",e._path=xo("path"),n.appendChild(e._path),this._updateStyle(e),this._layers[y(e)]=e},_addPath:function(e){var n=e._container;this._container.appendChild(n),e.options.interactive&&e.addInteractiveTarget(n)},_removePath:function(e){var n=e._container;ot(n),e.removeInteractiveTarget(n),delete this._layers[y(e)]},_updateStyle:function(e){var n=e._stroke,o=e._fill,r=e.options,d=e._container;d.stroked=!!r.stroke,d.filled=!!r.fill,r.stroke?(n||(n=e._stroke=xo("stroke")),d.appendChild(n),n.weight=r.weight+"px",n.color=r.color,n.opacity=r.opacity,r.dashArray?n.dashStyle=Se(r.dashArray)?r.dashArray.join(" "):r.dashArray.replace(/( *, *)/g," "):n.dashStyle="",n.endcap=r.lineCap.replace("butt","flat"),n.joinstyle=r.lineJoin):n&&(d.removeChild(n),e._stroke=null),r.fill?(o||(o=e._fill=xo("fill")),d.appendChild(o),o.color=r.fillColor||r.color,o.opacity=r.fillOpacity):o&&(d.removeChild(o),e._fill=null)},_updateCircle:function(e){var n=e._point.round(),o=Math.round(e._radius),r=Math.round(e._radiusY||o);this._setPath(e,e._empty()?"M0 0":"AL "+n.x+","+n.y+" "+o+","+r+" 0,"+65535*360)},_setPath:function(e,n){e._path.v=n},_bringToFront:function(e){Cn(e._container)},_bringToBack:function(e){qt(e._container)}},c=Z.vml?xo:W,q=On.extend({_initContainer:function(){this._container=c("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=c("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ot(this._container),Je(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){On.prototype._update.call(this);var e=this._bounds,n=e.getSize(),o=this._container;(!this._svgSize||!this._svgSize.equals(n))&&(this._svgSize=n,o.setAttribute("width",n.x),o.setAttribute("height",n.y)),Mt(o,e.min),o.setAttribute("viewBox",[e.min.x,e.min.y,n.x,n.y].join(" ")),this.fire("update")}},_initPath:function(e){var n=e._path=c("path");e.options.className&&He(n,e.options.className),e.options.interactive&&He(n,"leaflet-interactive"),this._updateStyle(e),this._layers[y(e)]=e},_addPath:function(e){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(e._path),e.addInteractiveTarget(e._path)},_removePath:function(e){ot(e._path),e.removeInteractiveTarget(e._path),delete this._layers[y(e)]},_updatePath:function(e){e._project(),e._update()},_updateStyle:function(e){var n=e._path,o=e.options;n&&(o.stroke?(n.setAttribute("stroke",o.color),n.setAttribute("stroke-opacity",o.opacity),n.setAttribute("stroke-width",o.weight),n.setAttribute("stroke-linecap",o.lineCap),n.setAttribute("stroke-linejoin",o.lineJoin),o.dashArray?n.setAttribute("stroke-dasharray",o.dashArray):n.removeAttribute("stroke-dasharray"),o.dashOffset?n.setAttribute("stroke-dashoffset",o.dashOffset):n.removeAttribute("stroke-dashoffset")):n.setAttribute("stroke","none"),o.fill?(n.setAttribute("fill",o.fillColor||o.color),n.setAttribute("fill-opacity",o.fillOpacity),n.setAttribute("fill-rule",o.fillRule||"evenodd")):n.setAttribute("fill","none"))},_updatePoly:function(e,n){this._setPath(e,V(e._parts,n))},_updateCircle:function(e){var n=e._point,o=Math.max(Math.round(e._radius),1),r=Math.max(Math.round(e._radiusY),1)||o,d="a"+o+","+r+" 0 1,0 ",v=e._empty()?"M0 0":"M"+(n.x-o)+","+n.y+d+o*2+",0 "+d+-o*2+",0 ";this._setPath(e,v)},_setPath:function(e,n){e._path.setAttribute("d",n)},_bringToFront:function(e){Cn(e._path)},_bringToBack:function(e){qt(e._path)}});Z.vml&&q.include(g);function k(e){return Z.svg||Z.vml?new q(e):null}qe.include({getRenderer:function(e){var n=e.options.renderer||this._getPaneRenderer(e.options.pane)||this.options.renderer||this._renderer;return n||(n=this._renderer=this._createRenderer()),this.hasLayer(n)||this.addLayer(n),n},_getPaneRenderer:function(e){if(e==="overlayPane"||e===void 0)return!1;var n=this._paneRenderers[e];return n===void 0&&(n=this._createRenderer({pane:e}),this._paneRenderers[e]=n),n},_createRenderer:function(e){return this.options.preferCanvas&&ka(e)||k(e)}});var Be=Dn.extend({initialize:function(e,n){Dn.prototype.initialize.call(this,this._boundsToLatLngs(e),n)},setBounds:function(e){return this.setLatLngs(this._boundsToLatLngs(e))},_boundsToLatLngs:function(e){return e=st(e),[e.getSouthWest(),e.getNorthWest(),e.getNorthEast(),e.getSouthEast()]}});function id(e,n){return new Be(e,n)}q.create=c,q.pointsToPath=V,yn.geometryToLayer=ni,yn.coordsToLatLng=ii,yn.coordsToLatLngs=ki,yn.latLngToCoords=Ls,yn.latLngsToCoords=Go,yn.getFeature=Qe,yn.asFeature=En,qe.mergeOptions({boxZoom:!0});var bl=An.extend({initialize:function(e){this._map=e,this._container=e._container,this._pane=e._panes.overlayPane,this._resetStateTimeout=0,e.on("unload",this._destroy,this)},addHooks:function(){ze(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Je(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ot(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(e){if(!e.shiftKey||e.which!==1&&e.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),In(),Di(),this._startPoint=this._map.mouseEventToContainerPoint(e),ze(document,{contextmenu:bi,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(e){this._moved||(this._moved=!0,this._box=it("div","leaflet-zoom-box",this._container),He(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(e);var n=new Ue(this._point,this._startPoint),o=n.getSize();Mt(this._box,n.min),this._box.style.width=o.x+"px",this._box.style.height=o.y+"px"},_finish:function(){this._moved&&(ot(this._box),Lt(this._container,"leaflet-crosshair")),vi(),Fi(),Je(document,{contextmenu:bi,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(e){if(!(e.which!==1&&e.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(h(this._resetState,this),0);var n=new wt(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(n).fire("boxzoomend",{boxZoomBounds:n})}},_onKeyDown:function(e){e.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});qe.addInitHook("addHandler","boxZoom",bl),qe.mergeOptions({doubleClickZoom:!0});var yl=An.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(e){var n=this._map,o=n.getZoom(),r=n.options.zoomDelta,d=e.originalEvent.shiftKey?o-r:o+r;n.options.doubleClickZoom==="center"?n.setZoom(d):n.setZoomAround(e.containerPoint,d)}});qe.addInitHook("addHandler","doubleClickZoom",yl),qe.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var xl=An.extend({addHooks:function(){if(!this._draggable){var e=this._map;this._draggable=new vn(e._mapPane,e._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),e.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),e.on("zoomend",this._onZoomEnd,this),e.whenReady(this._onZoomEnd,this))}He(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Lt(this._map._container,"leaflet-grab"),Lt(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var e=this._map;if(e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var n=st(this._map.options.maxBounds);this._offsetLimit=Ve(this._map.latLngToContainerPoint(n.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(n.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;e.fire("movestart").fire("dragstart"),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(e){if(this._map.options.inertia){var n=this._lastTime=+new Date,o=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(o),this._times.push(n),this._prunePositions(n)}this._map.fire("move",e).fire("drag",e)},_prunePositions:function(e){for(;this._positions.length>1&&e-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var e=this._map.getSize().divideBy(2),n=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=n.subtract(e).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(e,n){return e-(e-n)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var e=this._draggable._newPos.subtract(this._draggable._startPos),n=this._offsetLimit;e.xn.max.x&&(e.x=this._viscousLimit(e.x,n.max.x)),e.y>n.max.y&&(e.y=this._viscousLimit(e.y,n.max.y)),this._draggable._newPos=this._draggable._startPos.add(e)}},_onPreDragWrap:function(){var e=this._worldWidth,n=Math.round(e/2),o=this._initialWorldOffset,r=this._draggable._newPos.x,d=(r-n+o)%e+n-o,v=(r+n+o)%e-n-o,P=Math.abs(d+o)0?v:-v))-n;this._delta=0,this._startTime=null,P&&(e.options.scrollWheelZoom==="center"?e.setZoom(n+P):e.setZoomAround(this._lastMousePos,n+P))}});qe.addInitHook("addHandler","scrollWheelZoom",kl);var od=600;qe.mergeOptions({tapHold:Z.touchNative&&Z.safari&&Z.mobile,tapTolerance:15});var Sl=An.extend({addHooks:function(){ze(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Je(this._map._container,"touchstart",this._onDown,this)},_onDown:function(e){if(clearTimeout(this._holdTimeout),e.touches.length===1){var n=e.touches[0];this._startPos=this._newPos=new ue(n.clientX,n.clientY),this._holdTimeout=setTimeout(h(function(){this._cancel(),this._isTapValid()&&(ze(document,"touchend",Ft),ze(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",n))},this),od),ze(document,"touchend touchcancel contextmenu",this._cancel,this),ze(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function e(){Je(document,"touchend",Ft),Je(document,"touchend touchcancel",e)},_cancel:function(){clearTimeout(this._holdTimeout),Je(document,"touchend touchcancel contextmenu",this._cancel,this),Je(document,"touchmove",this._onMove,this)},_onMove:function(e){var n=e.touches[0];this._newPos=new ue(n.clientX,n.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(e,n){var o=new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,screenX:n.screenX,screenY:n.screenY,clientX:n.clientX,clientY:n.clientY});o._simulated=!0,n.target.dispatchEvent(o)}});qe.addInitHook("addHandler","tapHold",Sl),qe.mergeOptions({touchZoom:Z.touch,bounceAtZoomLimits:!0});var Tl=An.extend({addHooks:function(){He(this._map._container,"leaflet-touch-zoom"),ze(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Lt(this._map._container,"leaflet-touch-zoom"),Je(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(e){var n=this._map;if(!(!e.touches||e.touches.length!==2||n._animatingZoom||this._zooming)){var o=n.mouseEventToContainerPoint(e.touches[0]),r=n.mouseEventToContainerPoint(e.touches[1]);this._centerPoint=n.getSize()._divideBy(2),this._startLatLng=n.containerPointToLatLng(this._centerPoint),n.options.touchZoom!=="center"&&(this._pinchStartLatLng=n.containerPointToLatLng(o.add(r)._divideBy(2))),this._startDist=o.distanceTo(r),this._startZoom=n.getZoom(),this._moved=!1,this._zooming=!0,n._stop(),ze(document,"touchmove",this._onTouchMove,this),ze(document,"touchend touchcancel",this._onTouchEnd,this),Ft(e)}},_onTouchMove:function(e){if(!(!e.touches||e.touches.length!==2||!this._zooming)){var n=this._map,o=n.mouseEventToContainerPoint(e.touches[0]),r=n.mouseEventToContainerPoint(e.touches[1]),d=o.distanceTo(r)/this._startDist;if(this._zoom=n.getScaleZoom(d,this._startZoom),!n.options.bounceAtZoomLimits&&(this._zoomn.getMaxZoom()&&d>1)&&(this._zoom=n._limitZoom(this._zoom)),n.options.touchZoom==="center"){if(this._center=this._startLatLng,d===1)return}else{var v=o._add(r)._divideBy(2)._subtract(this._centerPoint);if(d===1&&v.x===0&&v.y===0)return;this._center=n.unproject(n.project(this._pinchStartLatLng,this._zoom).subtract(v),this._zoom)}this._moved||(n._moveStart(!0,!1),this._moved=!0),O(this._animRequest);var P=h(n._move,n,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=B(P,this,!0),Ft(e)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,O(this._animRequest),Je(document,"touchmove",this._onTouchMove,this),Je(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});qe.addInitHook("addHandler","touchZoom",Tl),qe.BoxZoom=bl,qe.DoubleClickZoom=yl,qe.Drag=xl,qe.Keyboard=wl,qe.ScrollWheelZoom=kl,qe.TapHold=Sl,qe.TouchZoom=Tl,s.Bounds=Ue,s.Browser=Z,s.CRS=zt,s.Canvas=Yo,s.Circle=Wi,s.CircleMarker=wi,s.Class=$,s.Control=en,s.DivIcon=Ms,s.DivOverlay=Nt,s.DomEvent=Vi,s.DomUtil=Ln,s.Draggable=vn,s.Evented=ge,s.FeatureGroup=bn,s.GeoJSON=yn,s.GridLayer=bo,s.Handler=An,s.Icon=ji,s.ImageOverlay=ho,s.LatLng=Le,s.LatLngBounds=wt,s.Layer=_n,s.LayerGroup=qn,s.LineUtil=dr,s.Map=qe,s.Marker=Wo,s.Mixin=rr,s.Path=ti,s.Point=ue,s.PolyUtil=lr,s.Polygon=Dn,s.Polyline=tn,s.Popup=Fn,s.PosAnimation=so,s.Projection=fr,s.Rectangle=Be,s.Renderer=On,s.SVG=q,s.SVGOverlay=go,s.TileLayer=Yn,s.Tooltip=_o,s.Transformation=kt,s.Util=N,s.VideoOverlay=po,s.bind=h,s.bounds=Ve,s.canvas=ka,s.circle=Rt,s.circleMarker=fo,s.control=ln,s.divIcon=xa,s.extend=u,s.featureGroup=Ps,s.geoJSON=qo,s.geoJson=gr,s.gridLayer=br,s.icon=pr,s.imageOverlay=vr,s.latLng=De,s.latLngBounds=st,s.layerGroup=uo,s.map=Vo,s.marker=mr,s.point=pe,s.polygon=ya,s.polyline=Ko,s.popup=As,s.rectangle=id,s.setOptions=F,s.stamp=y,s.svg=k,s.svgOverlay=vo,s.tileLayer=wa,s.tooltip=_r,s.transformation=x,s.version=l,s.videoOverlay=mo;var sd=window.L;s.noConflict=function(){return window.L=sd,this},window.L=s}))})(Fs,Fs.exports)),Fs.exports}var dm=cm();const qi=lm(dm),Cu={__name:"DeviceMap",props:{position:{type:Object,default:null},trail:{type:Array,default:()=>[]},aircraft:{type:Array,default:()=>[]}},setup(t){const i=t,s=Y(null);let l,u,f,h;const _=new Map;function y(K,F){const te=getComputedStyle(document.documentElement).getPropertyValue("--accent").trim()||"#3D7BF0",X=F?"#8a94a6":te,fe=typeof K=="number"?K:0;return qi.divIcon({className:"plane-marker",iconSize:[22,22],iconAnchor:[11,11],html:``})}function C(K){const te=[`${K.callsign||K.icao24||"aircraft"}`];return K.country&&te.push(K.country),typeof K.altitude=="number"&&te.push(`${Math.round(K.altitude)} m`),typeof K.velocity=="number"&&te.push(`${Math.round(K.velocity*3.6)} km/h`),K.onGround&&te.push("on ground"),te.join(" · ")}function T(){if(!l)return;h||(h=qi.layerGroup().addTo(l));const K=new Set;for(const F of i.aircraft){if(typeof F.lat!="number"||typeof F.lng!="number")continue;K.add(F.icao24);const te=[F.lat,F.lng];let X=_.get(F.icao24);X?(X.setLatLng(te),X.setIcon(y(F.heading,F.onGround)),X.setTooltipContent(C(F))):(X=qi.marker(te,{icon:y(F.heading,F.onGround)}).bindTooltip(C(F)),X.addTo(h),_.set(F.icao24,X))}for(const[F,te]of _)K.has(F)||(h.removeLayer(te),_.delete(F))}function M(){if(!l)return;const K=i.position;if(K&&(K.lat||K.lng)){const F=[K.lat,K.lng];u?u.setLatLng(F):(u=qi.marker(F).addTo(l),l.setView(F,17))}if(f&&f.remove(),i.trail.length){const F=getComputedStyle(document.documentElement).getPropertyValue("--accent").trim()||"#3D7BF0";f=qi.polyline(i.trail,{color:F,weight:3}).addTo(l)}}fi(()=>{l=qi.map(s.value,{zoomControl:!0}).setView([20,0],2),qi.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:"© OpenStreetMap",maxZoom:19}).addTo(l),setTimeout(()=>l.invalidateSize(),60),M(),T(),(!i.position||!i.position.lat&&!i.position.lng)&&i.aircraft.length&&j()});let H=!1;function j(){if(H||!l||!i.aircraft.length)return;const K=i.aircraft.filter(F=>typeof F.lat=="number"&&typeof F.lng=="number").map(F=>[F.lat,F.lng]);K.length&&(l.fitBounds(qi.latLngBounds(K).pad(.2)),H=!0)}return us(()=>{l&&l.remove(),l=null}),Bt(()=>i.position,M,{deep:!0}),Bt(()=>i.trail,M,{deep:!0}),Bt(()=>i.aircraft,()=>{T(),(!i.position||!i.position.lat&&!i.position.lng)&&j()},{deep:!0}),(K,F)=>(p(),m("div",{ref_key:"el",ref:s,class:"h-[320px] w-full rounded-lg"},null,512))}},fm=["width","height","stroke-width"],hm=["d"],J={__name:"Icon",props:{name:{type:String,required:!0},size:{type:[Number,String],default:18},stroke:{type:[Number,String],default:2}},setup(t){const l=({grid:"M3 3h7v7H3zM14 3h7v7h-7zM14 14h7v7h-7zM3 14h7v7H3z",radio:"M4.9 19.1a10 10 0 0 1 0-14.2M7.8 16.2a6 6 0 0 1 0-8.4M16.2 7.8a6 6 0 0 1 0 8.4M19.1 4.9a10 10 0 0 1 0 14.2M12 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2z",route:"M6 19a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM18 11a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 13V9a4 4 0 0 1 4-4h4",calendar:"M8 2v4M16 2v4M3 10h18M5 4h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z",book:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",fileText:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zM14 2v6h6M16 13H8M16 17H8M10 9H8",settings:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z",search:"M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM21 21l-4.3-4.3",plus:"M12 5v14M5 12h14",battery:"M3 8h14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H3a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1zM22 11v2",signal:"M2 20h.01M7 20v-4M12 20v-8M17 20V8M22 20V4",clock:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 7v5l3 2",chevronRight:"M9 6l6 6-6 6",play:"M6 3l14 9-14 9V3z",logout:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9",wind:"M12.8 19.6A2 2 0 1 0 14 16H2M17.5 8a2.5 2.5 0 1 1 2 4H2M9.6 4.6A2 2 0 1 1 11 8H2",drone:"M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8zM6 6 4 4M18 6l2-2M6 18l-2 2M18 18l2 2",user:"M20 21a8 8 0 1 0-16 0M12 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8z",users:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75",shield:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",sliders:"M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6",alertTriangle:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0zM12 9v4M12 17h.01",download:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3",upload:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12",trash:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6",check:"M20 6 9 17l-5-5",mail:"M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zM22 6l-10 7L2 6",lock:"M5 11h14a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2zM7 11V7a5 5 0 0 1 10 0v4",monitor:"M3 4h18a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM8 21h8M12 17v4",globe:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM3 12h18M12 3a15 15 0 0 1 0 18 15 15 0 0 1 0-18z",smartphone:"M7 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zM11 18h2",image:"M4 4h16a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM8.5 11a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zM21 15l-5-5L5 21",eye:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7z M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",type:"M4 7V4h16v3M9 20h6M12 4v16",sun:"M12 17a5 5 0 1 0 0-10 5 5 0 0 0 0 10zM12 1v2M12 21v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M1 12h2M21 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4",moon:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z",x:"M18 6 6 18M6 6l12 12",server:"M20 4H4a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zM20 13H4a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2zM6 7.5h.01M6 16.5h.01",cloud:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9z"}[t.name]||"").split(" M").map((u,f)=>f?"M"+u:u);return(u,f)=>(p(),m("svg",{width:t.size,height:t.size,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":t.stroke,"stroke-linecap":"round","stroke-linejoin":"round",style:{flex:"none"},"aria-hidden":"true"},[(p(!0),m(le,null,Ie(Ee(l),(h,_)=>(p(),m("path",{key:_,d:h},null,8,hm))),128))],8,fm))}},pm=["aria-checked","disabled"],nn={__name:"Toggle",props:{modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:i}){const s=i;return(l,u)=>(p(),m("button",{type:"button",role:"switch","aria-checked":t.modelValue,disabled:t.disabled,class:Ce(["relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition disabled:opacity-40",t.modelValue?"bg-accent":"bg-surface-2 border border-line-strong"]),onClick:u[0]||(u[0]=f=>s("update:modelValue",!t.modelValue))},[a("span",{class:Ce(["inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition",t.modelValue?"translate-x-6":"translate-x-1"])},null,2)],10,pm))}},mm={class:"inline-flex rounded-[10px] border border-line bg-surface-2 p-0.5"},gm=["onClick"],wn={__name:"Segmented",props:{modelValue:{type:[String,Number],default:""},options:{type:Array,default:()=>[]}},emits:["update:modelValue"],setup(t,{emit:i}){const s=i;return(l,u)=>(p(),m("div",mm,[(p(!0),m(le,null,Ie(t.options,f=>(p(),m("button",{key:f.value,type:"button",class:Ce(["inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[13px] font-semibold transition",t.modelValue===f.value?"bg-surface-1 text-ink shadow-xs":"text-ink-secondary hover:text-ink"]),onClick:h=>s("update:modelValue",f.value)},[f.icon?(p(),nt(J,{key:0,name:f.icon,size:15},null,8,["name"])):I("",!0),z(" "+w(f.label),1)],10,gm))),128))]))}},vm={class:"text-sm font-semibold text-ink"},_m={key:0,class:"mt-0.5 text-xs text-ink-muted"},xe={__name:"Row",props:{title:{type:String,default:""},desc:{type:String,default:""},keywords:{type:String,default:""},block:{type:Boolean,default:!1}},setup(t){const i=t,s=Vs("settingsSearch",{value:""}),l=ce(()=>{const u=(s.value||"").trim().toLowerCase();return u?`${i.title} ${i.desc} ${i.keywords}`.toLowerCase().includes(u):!0});return(u,f)=>l.value?(p(),m("div",{key:0,class:Ce(["border-b border-line py-4 last:border-0",t.block?"":"flex items-center justify-between gap-6"])},[a("div",{class:Ce(t.block?"mb-3":"min-w-0")},[a("div",vm,w(t.title),1),t.desc?(p(),m("div",_m,w(t.desc),1)):I("",!0)],2),a("div",{class:Ce(t.block?"":"shrink-0")},[Tf(u.$slots,"default")],2)],2)):I("",!0)}},ia=[{code:"AL",name:"Albania",continent:"EU",bbox:"39.6,19.3,42.7,21.1"},{code:"AD",name:"Andorra",continent:"EU",bbox:"42.4,1.4,42.7,1.8"},{code:"AT",name:"Austria",continent:"EU",bbox:"46.4,9.5,49.0,17.2"},{code:"BY",name:"Belarus",continent:"EU",bbox:"51.2,23.2,56.2,32.8"},{code:"BE",name:"Belgium",continent:"EU",bbox:"49.5,2.5,51.5,6.4"},{code:"BA",name:"Bosnia and Herzegovina",continent:"EU",bbox:"42.6,15.7,45.3,19.6"},{code:"BG",name:"Bulgaria",continent:"EU",bbox:"41.2,22.4,44.2,28.6"},{code:"HR",name:"Croatia",continent:"EU",bbox:"42.4,13.5,46.6,19.4"},{code:"CY",name:"Cyprus",continent:"EU",bbox:"34.6,32.3,35.7,34.6"},{code:"CZ",name:"Czechia",continent:"EU",bbox:"48.6,12.1,51.1,18.9"},{code:"DK",name:"Denmark",continent:"EU",bbox:"54.6,8.1,57.8,12.7"},{code:"EE",name:"Estonia",continent:"EU",bbox:"57.5,21.8,59.7,28.2"},{code:"FI",name:"Finland",continent:"EU",bbox:"59.8,20.6,70.1,31.6"},{code:"FR",name:"France",continent:"EU",bbox:"41.3,-5.2,51.1,9.6"},{code:"DE",name:"Germany",continent:"EU",bbox:"47.2,5.8,55.1,15.1"},{code:"GR",name:"Greece",continent:"EU",bbox:"34.8,19.4,41.8,28.3"},{code:"HU",name:"Hungary",continent:"EU",bbox:"45.7,16.1,48.6,22.9"},{code:"IS",name:"Iceland",continent:"EU",bbox:"63.3,-24.6,66.6,-13.5"},{code:"IE",name:"Ireland",continent:"EU",bbox:"51.4,-10.6,55.4,-6.0"},{code:"IT",name:"Italy",continent:"EU",bbox:"36.6,6.6,47.1,18.6"},{code:"XK",name:"Kosovo",continent:"EU",bbox:"41.8,20.0,43.3,21.8"},{code:"LV",name:"Latvia",continent:"EU",bbox:"55.7,20.9,58.1,28.2"},{code:"LI",name:"Liechtenstein",continent:"EU",bbox:"47.0,9.4,47.3,9.6"},{code:"LT",name:"Lithuania",continent:"EU",bbox:"53.9,20.9,56.5,26.9"},{code:"LU",name:"Luxembourg",continent:"EU",bbox:"49.4,5.7,50.2,6.5"},{code:"MT",name:"Malta",continent:"EU",bbox:"35.8,14.1,36.1,14.6"},{code:"MD",name:"Moldova",continent:"EU",bbox:"45.4,26.6,48.5,30.2"},{code:"MC",name:"Monaco",continent:"EU",bbox:"43.72,7.40,43.75,7.44"},{code:"ME",name:"Montenegro",continent:"EU",bbox:"41.8,18.4,43.6,20.4"},{code:"NL",name:"Netherlands",continent:"EU",bbox:"50.7,3.3,53.7,7.2"},{code:"MK",name:"North Macedonia",continent:"EU",bbox:"40.8,20.4,42.4,23.0"},{code:"NO",name:"Norway",continent:"EU",bbox:"57.9,4.6,71.2,31.1"},{code:"PL",name:"Poland",continent:"EU",bbox:"49.0,14.1,54.9,24.2"},{code:"PT",name:"Portugal",continent:"EU",bbox:"36.9,-9.5,42.2,-6.2"},{code:"RO",name:"Romania",continent:"EU",bbox:"43.6,20.2,48.3,29.7"},{code:"SM",name:"San Marino",continent:"EU",bbox:"43.89,12.40,43.99,12.52"},{code:"RS",name:"Serbia",continent:"EU",bbox:"42.2,18.8,46.2,23.0"},{code:"SK",name:"Slovakia",continent:"EU",bbox:"47.7,16.8,49.6,22.6"},{code:"SI",name:"Slovenia",continent:"EU",bbox:"45.4,13.4,46.9,16.6"},{code:"ES",name:"Spain",continent:"EU",bbox:"35.9,-9.4,43.8,3.4"},{code:"SE",name:"Sweden",continent:"EU",bbox:"55.3,11.1,69.1,24.2"},{code:"CH",name:"Switzerland",continent:"EU",bbox:"45.8,5.9,47.8,10.5"},{code:"UA",name:"Ukraine",continent:"EU",bbox:"44.4,22.1,52.4,40.2"},{code:"GB",name:"United Kingdom",continent:"EU",bbox:"49.9,-8.7,60.9,1.8"},{code:"VA",name:"Vatican City",continent:"EU",bbox:"41.900,12.445,41.908,12.458"},{code:"RU",name:"Russia",continent:"EU",bbox:"41.2,19.6,81.9,180"},{code:"TR",name:"Turkey",continent:"EU",bbox:"35.8,25.7,42.3,44.8"},{code:"AF",name:"Afghanistan",continent:"AS",bbox:"29.4,60.5,38.5,74.9"},{code:"AM",name:"Armenia",continent:"AS",bbox:"38.8,43.4,41.3,46.6"},{code:"AZ",name:"Azerbaijan",continent:"AS",bbox:"38.4,44.8,41.9,50.4"},{code:"BH",name:"Bahrain",continent:"AS",bbox:"25.8,50.4,26.3,50.7"},{code:"BD",name:"Bangladesh",continent:"AS",bbox:"20.7,88.0,26.6,92.7"},{code:"BT",name:"Bhutan",continent:"AS",bbox:"26.7,88.7,28.3,92.1"},{code:"BN",name:"Brunei",continent:"AS",bbox:"4.0,114.0,5.1,115.4"},{code:"KH",name:"Cambodia",continent:"AS",bbox:"10.4,102.3,14.7,107.6"},{code:"CN",name:"China",continent:"AS",bbox:"18.2,73.5,53.6,134.8"},{code:"GE",name:"Georgia",continent:"AS",bbox:"41.0,40.0,43.6,46.7"},{code:"IN",name:"India",continent:"AS",bbox:"6.7,68.1,35.5,97.4"},{code:"ID",name:"Indonesia",continent:"AS",bbox:"-11.0,95.0,6.1,141.0"},{code:"IR",name:"Iran",continent:"AS",bbox:"25.0,44.0,39.8,63.3"},{code:"IQ",name:"Iraq",continent:"AS",bbox:"29.1,38.8,37.4,48.6"},{code:"IL",name:"Israel",continent:"AS",bbox:"29.5,34.2,33.3,35.9"},{code:"JP",name:"Japan",continent:"AS",bbox:"24.0,122.9,45.5,145.8"},{code:"JO",name:"Jordan",continent:"AS",bbox:"29.2,34.9,33.4,39.3"},{code:"KZ",name:"Kazakhstan",continent:"AS",bbox:"40.6,46.5,55.4,87.3"},{code:"KW",name:"Kuwait",continent:"AS",bbox:"28.5,46.5,30.1,48.4"},{code:"KG",name:"Kyrgyzstan",continent:"AS",bbox:"39.2,69.3,43.3,80.3"},{code:"LA",name:"Laos",continent:"AS",bbox:"13.9,100.1,22.5,107.7"},{code:"LB",name:"Lebanon",continent:"AS",bbox:"33.0,35.1,34.7,36.6"},{code:"MY",name:"Malaysia",continent:"AS",bbox:"0.9,99.6,7.4,119.3"},{code:"MV",name:"Maldives",continent:"AS",bbox:"-0.7,72.7,7.1,73.7"},{code:"MN",name:"Mongolia",continent:"AS",bbox:"41.6,87.7,52.1,119.9"},{code:"MM",name:"Myanmar",continent:"AS",bbox:"9.8,92.2,28.5,101.2"},{code:"NP",name:"Nepal",continent:"AS",bbox:"26.3,80.1,30.4,88.2"},{code:"KP",name:"North Korea",continent:"AS",bbox:"37.7,124.2,43.0,130.7"},{code:"OM",name:"Oman",continent:"AS",bbox:"16.6,52.0,26.4,59.8"},{code:"PK",name:"Pakistan",continent:"AS",bbox:"23.7,60.9,37.1,77.8"},{code:"PH",name:"Philippines",continent:"AS",bbox:"4.6,116.9,21.1,126.6"},{code:"QA",name:"Qatar",continent:"AS",bbox:"24.5,50.7,26.2,51.6"},{code:"SA",name:"Saudi Arabia",continent:"AS",bbox:"16.4,34.6,32.2,55.7"},{code:"SG",name:"Singapore",continent:"AS",bbox:"1.2,103.6,1.5,104.1"},{code:"KR",name:"South Korea",continent:"AS",bbox:"33.1,125.9,38.6,129.6"},{code:"LK",name:"Sri Lanka",continent:"AS",bbox:"5.9,79.7,9.8,81.9"},{code:"SY",name:"Syria",continent:"AS",bbox:"32.3,35.7,37.3,42.4"},{code:"TW",name:"Taiwan",continent:"AS",bbox:"21.9,120.0,25.3,122.0"},{code:"TJ",name:"Tajikistan",continent:"AS",bbox:"36.7,67.4,41.0,75.2"},{code:"TH",name:"Thailand",continent:"AS",bbox:"5.6,97.3,20.5,105.6"},{code:"TL",name:"Timor-Leste",continent:"AS",bbox:"-9.5,124.0,-8.1,127.3"},{code:"TM",name:"Turkmenistan",continent:"AS",bbox:"35.1,52.4,42.8,66.7"},{code:"AE",name:"United Arab Emirates",continent:"AS",bbox:"22.6,51.5,26.1,56.4"},{code:"UZ",name:"Uzbekistan",continent:"AS",bbox:"37.2,55.9,45.6,73.1"},{code:"VN",name:"Vietnam",continent:"AS",bbox:"8.2,102.1,23.4,109.5"},{code:"YE",name:"Yemen",continent:"AS",bbox:"12.1,42.5,19.0,54.5"},{code:"DZ",name:"Algeria",continent:"AF",bbox:"18.9,-8.7,37.1,12.0"},{code:"AO",name:"Angola",continent:"AF",bbox:"-18.0,11.6,-4.4,24.1"},{code:"BJ",name:"Benin",continent:"AF",bbox:"6.2,0.8,12.4,3.9"},{code:"BW",name:"Botswana",continent:"AF",bbox:"-26.9,20.0,-17.8,29.4"},{code:"BF",name:"Burkina Faso",continent:"AF",bbox:"9.4,-5.5,15.1,2.4"},{code:"BI",name:"Burundi",continent:"AF",bbox:"-4.5,29.0,-2.3,30.8"},{code:"CV",name:"Cabo Verde",continent:"AF",bbox:"14.8,-25.4,17.2,-22.7"},{code:"CM",name:"Cameroon",continent:"AF",bbox:"1.7,8.5,13.1,16.2"},{code:"CF",name:"Central African Republic",continent:"AF",bbox:"2.2,14.4,11.0,27.5"},{code:"TD",name:"Chad",continent:"AF",bbox:"7.4,13.5,23.4,24.0"},{code:"KM",name:"Comoros",continent:"AF",bbox:"-12.4,43.2,-11.4,44.5"},{code:"CG",name:"Congo",continent:"AF",bbox:"-5.0,11.1,3.7,18.6"},{code:"CD",name:"DR Congo",continent:"AF",bbox:"-13.5,12.2,5.4,31.3"},{code:"DJ",name:"Djibouti",continent:"AF",bbox:"10.9,41.7,12.7,43.4"},{code:"EG",name:"Egypt",continent:"AF",bbox:"22.0,25.0,31.7,36.9"},{code:"GQ",name:"Equatorial Guinea",continent:"AF",bbox:"0.9,9.3,3.8,11.4"},{code:"ER",name:"Eritrea",continent:"AF",bbox:"12.4,36.4,18.0,43.1"},{code:"SZ",name:"Eswatini",continent:"AF",bbox:"-27.3,30.8,-25.7,32.1"},{code:"ET",name:"Ethiopia",continent:"AF",bbox:"3.4,33.0,14.9,48.0"},{code:"GA",name:"Gabon",continent:"AF",bbox:"-4.0,8.7,2.3,14.5"},{code:"GM",name:"Gambia",continent:"AF",bbox:"13.1,-16.8,13.8,-13.8"},{code:"GH",name:"Ghana",continent:"AF",bbox:"4.7,-3.3,11.2,1.2"},{code:"GN",name:"Guinea",continent:"AF",bbox:"7.2,-15.1,12.7,-7.6"},{code:"GW",name:"Guinea-Bissau",continent:"AF",bbox:"10.9,-16.7,12.7,-13.6"},{code:"CI",name:"Ivory Coast",continent:"AF",bbox:"4.4,-8.6,10.7,-2.5"},{code:"KE",name:"Kenya",continent:"AF",bbox:"-4.7,33.9,5.5,41.9"},{code:"LS",name:"Lesotho",continent:"AF",bbox:"-30.7,27.0,-28.6,29.5"},{code:"LR",name:"Liberia",continent:"AF",bbox:"4.3,-11.5,8.6,-7.4"},{code:"LY",name:"Libya",continent:"AF",bbox:"19.5,9.3,33.2,25.2"},{code:"MG",name:"Madagascar",continent:"AF",bbox:"-25.6,43.2,-11.9,50.5"},{code:"MW",name:"Malawi",continent:"AF",bbox:"-17.1,32.7,-9.4,35.9"},{code:"ML",name:"Mali",continent:"AF",bbox:"10.1,-12.3,25.0,4.3"},{code:"MR",name:"Mauritania",continent:"AF",bbox:"14.7,-17.1,27.3,-4.8"},{code:"MU",name:"Mauritius",continent:"AF",bbox:"-20.5,57.3,-19.9,57.8"},{code:"MA",name:"Morocco",continent:"AF",bbox:"27.7,-13.2,35.9,-1.0"},{code:"MZ",name:"Mozambique",continent:"AF",bbox:"-26.9,30.2,-10.5,40.8"},{code:"NA",name:"Namibia",continent:"AF",bbox:"-28.9,11.7,-16.9,25.3"},{code:"NE",name:"Niger",continent:"AF",bbox:"11.7,0.2,23.5,16.0"},{code:"NG",name:"Nigeria",continent:"AF",bbox:"4.3,2.7,13.9,14.7"},{code:"RW",name:"Rwanda",continent:"AF",bbox:"-2.8,28.9,-1.1,30.9"},{code:"SN",name:"Senegal",continent:"AF",bbox:"12.3,-17.5,16.7,-11.4"},{code:"SL",name:"Sierra Leone",continent:"AF",bbox:"6.9,-13.3,10.0,-10.3"},{code:"SO",name:"Somalia",continent:"AF",bbox:"-1.7,40.9,12.0,51.4"},{code:"ZA",name:"South Africa",continent:"AF",bbox:"-34.8,16.5,-22.1,32.9"},{code:"SS",name:"South Sudan",continent:"AF",bbox:"3.5,24.1,12.2,35.9"},{code:"SD",name:"Sudan",continent:"AF",bbox:"8.7,21.8,22.2,38.6"},{code:"TZ",name:"Tanzania",continent:"AF",bbox:"-11.7,29.3,-1.0,40.4"},{code:"TG",name:"Togo",continent:"AF",bbox:"6.1,-0.1,11.1,1.8"},{code:"TN",name:"Tunisia",continent:"AF",bbox:"30.2,7.5,37.5,11.6"},{code:"UG",name:"Uganda",continent:"AF",bbox:"-1.5,29.6,4.2,35.0"},{code:"ZM",name:"Zambia",continent:"AF",bbox:"-18.1,21.9,-8.2,33.7"},{code:"ZW",name:"Zimbabwe",continent:"AF",bbox:"-22.4,25.2,-15.6,33.1"},{code:"CA",name:"Canada",continent:"NA",bbox:"41.7,-141.0,83.1,-52.6"},{code:"US",name:"United States",continent:"NA",bbox:"24.4,-125.0,49.4,-66.9"},{code:"MX",name:"Mexico",continent:"NA",bbox:"14.5,-118.4,32.7,-86.7"},{code:"GT",name:"Guatemala",continent:"NA",bbox:"13.7,-92.2,17.8,-88.2"},{code:"BZ",name:"Belize",continent:"NA",bbox:"15.9,-89.2,18.5,-87.8"},{code:"SV",name:"El Salvador",continent:"NA",bbox:"13.1,-90.1,14.4,-87.7"},{code:"HN",name:"Honduras",continent:"NA",bbox:"12.9,-89.4,16.5,-83.1"},{code:"NI",name:"Nicaragua",continent:"NA",bbox:"10.7,-87.7,15.0,-83.1"},{code:"CR",name:"Costa Rica",continent:"NA",bbox:"8.0,-85.9,11.2,-82.5"},{code:"PA",name:"Panama",continent:"NA",bbox:"7.2,-83.1,9.6,-77.2"},{code:"CU",name:"Cuba",continent:"NA",bbox:"19.8,-85.0,23.3,-74.1"},{code:"DO",name:"Dominican Republic",continent:"NA",bbox:"17.5,-72.0,19.9,-68.3"},{code:"HT",name:"Haiti",continent:"NA",bbox:"18.0,-74.5,20.1,-71.6"},{code:"JM",name:"Jamaica",continent:"NA",bbox:"17.7,-78.4,18.5,-76.2"},{code:"BS",name:"Bahamas",continent:"NA",bbox:"20.9,-79.0,27.3,-72.7"},{code:"TT",name:"Trinidad and Tobago",continent:"NA",bbox:"10.0,-61.9,11.4,-60.5"},{code:"AR",name:"Argentina",continent:"SA",bbox:"-55.1,-73.6,-21.8,-53.6"},{code:"BO",name:"Bolivia",continent:"SA",bbox:"-22.9,-69.6,-9.7,-57.5"},{code:"BR",name:"Brazil",continent:"SA",bbox:"-33.8,-74.0,5.3,-34.8"},{code:"CL",name:"Chile",continent:"SA",bbox:"-55.9,-75.6,-17.5,-66.4"},{code:"CO",name:"Colombia",continent:"SA",bbox:"-4.2,-79.0,12.5,-66.9"},{code:"EC",name:"Ecuador",continent:"SA",bbox:"-5.0,-81.1,1.4,-75.2"},{code:"GY",name:"Guyana",continent:"SA",bbox:"1.2,-61.4,8.6,-56.5"},{code:"PY",name:"Paraguay",continent:"SA",bbox:"-27.6,-62.6,-19.3,-54.3"},{code:"PE",name:"Peru",continent:"SA",bbox:"-18.4,-81.3,0.0,-68.7"},{code:"SR",name:"Suriname",continent:"SA",bbox:"1.8,-58.1,6.0,-54.0"},{code:"UY",name:"Uruguay",continent:"SA",bbox:"-35.0,-58.4,-30.1,-53.1"},{code:"VE",name:"Venezuela",continent:"SA",bbox:"0.6,-73.4,12.2,-59.8"},{code:"AU",name:"Australia",continent:"OC",bbox:"-43.6,113.3,-10.7,153.6"},{code:"NZ",name:"New Zealand",continent:"OC",bbox:"-47.3,166.4,-34.4,178.6"},{code:"PG",name:"Papua New Guinea",continent:"OC",bbox:"-11.7,140.8,-1.3,155.9"},{code:"FJ",name:"Fiji",continent:"OC",bbox:"-19.2,177.0,-16.0,180.0"}],bm=new Map(ia.map(t=>[t.code,t]));function ym(t){const i=String(t||"").split(",").map(s=>Number(s.trim()));return i.length!==4||i.some(s=>Number.isNaN(s))?null:i}function xm(t){const i=bm.get(t);return i?i.bbox:""}function $r(t,i){if(typeof t!="number"||typeof i!="number"||Number.isNaN(t)||Number.isNaN(i))return null;let s=null,l=1/0;for(const u of ia){const f=ym(u.bbox);if(!f)continue;const[h,_,y,C]=f;if(ty||i<_||i>C)continue;const T=Math.abs(y-h)*Math.abs(C-_);Tt.continent==="EU").slice().sort((t,i)=>t.name.localeCompare(i.name)).map(t=>({value:t.bbox,label:t.name}))}function km(){return ia.slice().sort((t,i)=>t.name.localeCompare(i.name)).map(t=>[t.code,t.name])}const Sm=[["EU","European countries"],["AS","Asian countries"],["AF","African countries"],["NA","North American countries"],["SA","South American countries"],["OC","Oceanian countries"]];function Tm(){return Sm.map(([t,i])=>({label:i,options:ia.filter(s=>s.continent===t).slice().sort((s,l)=>s.name.localeCompare(l.name)).map(s=>({value:s.bbox,label:s.name}))}))}const Pm=(t,i)=>{const s=t.__vccOpts||t;for(const[l,u]of i)s[l]=u;return s},Cm={class:"mx-auto max-w-[1280px] p-7"},Lm={class:"mb-5 flex flex-wrap items-end justify-between gap-4"},Am={class:"flex h-10 w-full max-w-[280px] items-center gap-2 rounded border border-line-strong bg-surface-1 px-3"},Mm={class:"grid grid-cols-[210px_1fr] gap-6 max-[760px]:grid-cols-1"},Em={class:"flex flex-col gap-0.5 max-[760px]:flex-row max-[760px]:overflow-x-auto"},Om=["onClick"],zm={class:"whitespace-nowrap"},$m={class:"min-w-0"},Im={key:0,class:"panel p-10 text-center text-sm text-ink-muted"},Nm={key:0,class:"eyebrow mb-2 mt-5 first:mt-0 flex items-center gap-2"},Dm={key:1,class:"panel mb-5 p-5"},Fm={class:"flex items-center gap-1"},Rm={class:"flex items-center gap-2"},Bm={class:"font-mono text-sm text-ink"},Um={class:"inline-flex items-center gap-1 rounded-full bg-amber-soft px-2 py-0.5 text-[11px] font-semibold text-amber-fg"},Vm={key:0,class:"mt-2 text-xs text-ink-muted"},Zm={class:"grid max-w-[420px] gap-2"},Hm={class:"flex items-center gap-3"},jm={key:2,class:"panel mb-5 p-5"},Wm=["value"],Km=["value"],Gm=["value"],qm={class:"font-mono text-sm text-ink"},Ym={key:3},Jm={key:0,class:"mb-5 flex items-center gap-1 overflow-x-auto border-b border-line"},Xm=["onClick"],Qm={class:"panel mb-5 p-5"},eg={class:"mb-4 flex items-start gap-3 border-b border-line pb-4"},tg={class:"grid h-10 w-10 place-items-center rounded-lg bg-accent-soft text-accent-soft-fg"},ng={key:0,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},ig={key:1,class:"mb-4 flex flex-col gap-2 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between"},og={key:4,class:"border-b border-line py-3 text-xs text-amber-fg"},sg={key:0},ag={key:5,class:"border-b border-line py-3 text-xs text-ink-muted"},rg={class:"font-semibold text-ink-secondary"},lg={key:6,class:"border-b border-line py-3 text-xs text-ink-muted"},ug={key:7,class:"my-4 rounded-lg border border-line bg-surface-2 p-4","data-keywords":"credits usage quota remaining daily allowance rate limit"},cg={class:"flex items-center justify-between gap-3"},dg={class:"flex items-center gap-2 text-sm font-semibold text-ink"},fg={key:0,class:"text-[11px] text-ink-muted"},hg={class:"mt-2 flex items-baseline gap-1.5"},pg={class:"font-mono text-2xl font-semibold text-ink"},mg={class:"text-sm text-ink-muted"},gg={class:"mt-2 h-2 w-full overflow-hidden rounded-full bg-line"},vg={class:"mt-2 text-xs text-ink-muted"},_g={class:"mt-2 text-sm text-ink"},bg={class:"font-semibold"},yg={class:"mt-1 text-xs text-ink-muted"},xg={key:1,class:"mt-2 text-xs text-ink-muted"},wg={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},kg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Sg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Tg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Pg={key:1,class:"flex flex-col items-end gap-2"},Cg={key:0,value:"__auto__"},Lg=["label"],Ag=["value"],Mg={key:0,class:"w-64 text-right text-[11px] leading-snug text-ink-muted"},Eg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Og={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},zg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},$g={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Ig={key:8,class:"border-b border-line py-3 text-xs text-amber-fg"},Ng={class:"mt-4 flex flex-wrap items-center gap-3"},Dg=["disabled"],Fg={key:1,class:"flex items-center gap-2",title:"Bounding box used for Test connection — smaller areas cost fewer OpenSky credits"},Rg=["label"],Bg=["value"],Ug=["disabled"],Vg={key:3,class:"text-xs text-danger-fg"},Zg={class:"panel mb-5 p-5"},Hg={class:"mb-4 flex items-start gap-3 border-b border-line pb-4"},jg={class:"grid h-10 w-10 place-items-center rounded-lg bg-accent-soft text-accent-soft-fg"},Wg={key:0,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},Kg={key:1,class:"mb-4 flex flex-col gap-2 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between"},Gg={key:4,class:"border-b border-line py-3 text-xs text-amber-fg"},qg={key:0},Yg={key:5,class:"border-b border-line py-3 text-xs text-ink-muted"},Jg={class:"font-semibold text-ink-secondary"},Xg={key:6,class:"border-b border-line py-3 text-xs text-ink-muted"},Qg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},ev={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},tv={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},nv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},iv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},ov={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},sv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},av={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},rv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},lv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},uv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},cv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},dv={key:7,class:"my-4 rounded-lg border border-line bg-surface-2 p-4","data-keywords":"usage quota rate limit calls per minute remaining left api"},fv={class:"flex items-center justify-between gap-3"},hv={class:"flex items-center gap-2 text-sm font-semibold text-ink"},pv={key:0,class:"text-[11px] text-ink-muted"},mv={class:"mt-2 flex items-baseline gap-1.5"},gv={class:"font-mono text-2xl font-semibold text-ink"},vv={class:"text-sm text-ink-muted"},_v={key:0,class:"mt-2 h-2 w-full overflow-hidden rounded-full bg-line"},bv={class:"mt-2 text-xs text-ink-muted"},yv={key:1,class:"mt-2 text-xs text-ink-muted"},xv={class:"mt-4 flex flex-wrap items-center gap-3"},wv=["disabled"],kv=["disabled"],Sv={key:2,class:"text-xs text-danger-fg"},Tv={key:3,class:"text-[11px] text-ink-muted"},Pv={class:"panel mb-5 p-5"},Cv={class:"mb-4 flex items-start gap-3 border-b border-line pb-4"},Lv={class:"grid h-10 w-10 place-items-center rounded-lg bg-accent-soft text-accent-soft-fg"},Av={key:0,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},Mv={key:1,class:"mb-4 flex flex-col gap-2 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between"},Ev={key:4,class:"border-b border-line py-3 text-xs text-amber-fg"},Ov={key:0},zv={key:5,class:"border-b border-line py-3 text-xs text-ink-muted"},$v={class:"font-semibold text-ink-secondary"},Iv={key:6,class:"border-b border-line py-3 text-xs text-ink-muted"},Nv={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},Dv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Fv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Rv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Bv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Uv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Vv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Zv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Hv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},jv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Wv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Kv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Gv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},qv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Yv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Jv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Xv={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},Qv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},e_={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},t_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},n_={class:"mt-4 flex flex-wrap items-center gap-3"},i_=["disabled"],o_=["disabled"],s_={key:2,class:"text-xs text-danger-fg"},a_={key:3,class:"text-[11px] text-ink-muted"},r_={class:"panel mb-5 p-5"},l_={class:"mb-4 flex items-start gap-3 border-b border-line pb-4"},u_={class:"grid h-10 w-10 place-items-center rounded-lg bg-accent-soft text-accent-soft-fg"},c_={key:0,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},d_={key:1,class:"mb-4 flex flex-col gap-2 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between"},f_={key:4,class:"border-b border-line py-3 text-xs text-amber-fg"},h_={key:0},p_={key:5,class:"border-b border-line py-3 text-xs text-ink-muted"},m_={class:"font-semibold text-ink-secondary"},g_={key:6,class:"border-b border-line py-3 text-xs text-ink-muted"},v_={key:0,class:"inline-flex items-center gap-2 break-all font-mono text-sm text-ink"},__={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},b_={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},y_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},x_={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},w_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},k_={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},S_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},T_={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},P_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},C_={class:"mt-4 flex flex-wrap items-center gap-3"},L_=["disabled"],A_=["disabled"],M_={key:2,class:"text-xs text-danger-fg"},E_={key:3,class:"text-[11px] text-ink-muted"},O_={key:3,class:"panel mb-5 p-5"},z_={class:"mb-4 flex items-start gap-3 border-b border-line pb-4"},$_={class:"grid h-10 w-10 place-items-center rounded-lg bg-accent-soft text-accent-soft-fg"},I_={key:0,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},N_={key:1,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},D_={key:2,class:"mb-4 flex flex-col gap-2 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between"},F_={key:5,class:"border-b border-line py-3 text-xs text-amber-fg"},R_={key:0},B_={key:6,class:"border-b border-line py-3 text-xs text-ink-muted"},U_={class:"font-semibold text-ink-secondary"},V_={key:7,class:"border-b border-line py-3 text-xs text-ink-muted"},Z_={class:"flex w-full flex-col gap-2"},H_={class:"break-all font-mono text-sm text-ink"},j_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},W_={key:1,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},K_={key:0,class:"text-xs text-ink-muted"},G_={key:1,class:"border-b border-line py-3 text-xs text-ink-muted"},q_={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},Y_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},J_={class:"mt-4 flex flex-wrap items-center gap-3"},X_=["disabled"],Q_=["disabled"],e1={key:2,class:"text-xs text-danger-fg"},t1={key:3,class:"text-[11px] text-ink-muted"},n1={key:4,class:"panel mb-5 p-5"},i1={class:"flex items-center gap-4"},o1=["src"],s1={key:1,class:"grid h-16 w-16 place-items-center rounded-full bg-[var(--navy-800)] text-lg font-bold text-white"},a1={class:"flex gap-2"},r1={class:"btn-ghost cursor-pointer"},l1={class:"mt-1 text-right text-[11px] text-ink-muted"},u1={key:5,class:"panel mb-5 p-5"},c1={class:"flex items-center gap-3"},d1={key:0,class:"mt-4 rounded-lg border border-line bg-surface-2 p-4"},f1={class:"flex flex-wrap items-center gap-4"},h1={class:"min-w-0"},p1={class:"mt-1 select-all font-mono text-sm font-bold text-ink"},m1={class:"mt-3 flex items-center gap-2"},g1={key:0,class:"mt-2 text-xs text-danger-fg"},v1={key:1,class:"mt-4 rounded-lg border border-line bg-surface-2 p-4"},_1={class:"mt-2 grid grid-cols-2 gap-1 font-mono text-xs text-ink-secondary sm:grid-cols-4"},b1={class:"rounded-lg border border-line bg-surface-2 p-3"},y1={class:"flex items-center gap-3"},x1={class:"grid h-9 w-9 place-items-center rounded-full bg-accent-soft text-accent-soft-fg"},w1={class:"min-w-0 flex-1"},k1={class:"text-sm font-semibold text-ink"},S1={class:"font-mono text-[11px] text-ink-muted"},T1={key:6,class:"mb-5"},P1={key:0,class:"panel mb-5 p-5"},C1={class:"grid max-w-[520px] gap-2"},L1={class:"flex flex-wrap gap-2"},A1=["disabled","title"],M1=["value"],E1=["value"],O1={class:"flex items-center gap-2 py-1 text-sm text-ink-secondary"},z1={class:"flex items-center gap-3"},$1=["disabled"],I1={key:0,class:"text-xs text-danger-fg"},N1={key:1,class:"text-xs text-ink-muted"},D1={key:1,class:"panel mb-5 p-5"},F1={class:"grid max-w-[520px] gap-2"},R1={class:"flex flex-wrap gap-2"},B1=["value"],U1=["value"],V1={key:1,class:"text-xs text-ink-muted"},Z1={class:"font-semibold text-ink-secondary"},H1={class:"flex items-center gap-3"},j1=["disabled"],W1={key:0,class:"text-xs text-danger-fg"},K1={class:"panel overflow-hidden p-0"},G1={class:"flex items-center justify-between px-5 py-4"},q1=["disabled"],Y1={key:0,class:"px-5 pb-5 text-sm text-danger-fg"},J1={key:1,class:"px-5 pb-8 text-sm text-ink-muted"},X1={key:2,class:"overflow-x-auto"},Q1={class:"w-full border-collapse text-sm"},eb={class:"text-left"},tb={class:"px-5 py-3"},nb={class:"text-ink"},ib={key:0,class:"ml-1.5 text-[11px] text-ink-muted"},ob={class:"px-5 py-3"},sb={class:"px-5 py-3"},ab={class:"px-5 py-3"},rb={class:"px-5 py-3 text-right"},lb=["onClick"],ub={key:1,class:"inline-flex items-center gap-1.5"},cb=["onClick"],db=["onClick"],fb={key:7,class:"mb-5"},hb={key:0,class:"panel mb-5 p-5"},pb={class:"grid max-w-[520px] gap-2"},mb={class:"flex items-center gap-3"},gb={key:0,class:"text-xs text-danger-fg"},vb={key:1,class:"panel mb-5 p-5"},_b={class:"grid max-w-[520px] gap-2"},bb={class:"flex items-center gap-3"},yb=["disabled"],xb={key:0,class:"text-xs text-danger-fg"},wb={class:"panel overflow-hidden p-0"},kb={key:0,class:"px-5 pb-8 text-sm text-ink-muted"},Sb={key:1,class:"overflow-x-auto"},Tb={class:"w-full border-collapse text-sm"},Pb={class:"text-left"},Cb={class:"px-5 py-3"},Lb={class:"inline-flex items-center gap-2 text-ink"},Ab={class:"px-5 py-3 text-ink-secondary"},Mb={class:"px-5 py-3 text-right"},Eb=["onClick"],Ob={key:1,class:"inline-flex items-center gap-1.5"},zb=["onClick"],$b=["disabled","title","onClick"],Ib={key:8,class:"mb-5"},Nb={class:"panel mb-5 p-5"},Db={class:"btn-ghost cursor-pointer"},Fb={key:0,class:"mt-2 text-xs text-ink-muted"},Rb={class:"rounded-lg border p-5",style:{"border-color":"color-mix(in srgb, var(--danger) 35%, transparent)",background:"var(--danger-soft)"}},Bb={class:"flex items-center gap-2 text-danger-fg"},Ub={class:"mt-4 rounded-lg border border-line bg-surface-1 p-4"},Vb={class:"mt-3 flex items-start gap-2 text-sm text-ink-secondary"},Zb={class:"mt-3"},Hb={class:"eyebrow mb-1 block"},jb={class:"text-ink"},Wb=["placeholder"],Kb={class:"mt-4 flex flex-wrap items-center gap-3"},Gb=["disabled"],qb=["disabled"],Yb={key:2,class:"text-xs text-ink-muted"},Jb={key:0,class:"mt-3 rounded border border-line bg-surface-2 px-3 py-2 text-xs text-ink-secondary"},Xb={key:0,class:"fixed bottom-5 right-5 z-20 flex items-center gap-2 rounded-lg border border-line bg-surface-1 px-4 py-2.5 text-sm text-ink shadow-md"},Lu="pv.opensky.health",Au="pv.filetransfer.health",Mu="pv.webdav.health",Eu="pv.openweather.health",Ou="pv.localstorage.health",Qb={__name:"Settings",props:{email:{type:String,default:""},role:{type:String,default:"user"},organization:{type:String,default:""},organizationName:{type:String,default:""}},emits:["logout"],setup(t,{emit:i}){const s=t,l=i,u=ce(()=>s.role==="superadmin"),f=ce(()=>s.role==="admin"||s.role==="superadmin");function h(g){return g==="superadmin"?"Superadmin":g==="admin"?"Admin":"User"}function _(g){return g==="superadmin"||g==="admin"?"shield":"user"}function y(g){return g==="superadmin"||g==="admin"?C.accent:C.neutral}const C={success:"bg-success-soft text-success-fg",warning:"bg-amber-soft text-amber-fg",danger:"bg-danger-soft text-danger-fg",accent:"bg-accent-soft text-accent-soft-fg",neutral:"bg-surface-2 text-ink-secondary"},T=ce(()=>{const g=[{id:"account",label:"Account",icon:"user",kw:"name username email password verification login credentials role"},{id:"appearance",label:"Appearance",icon:"sliders",kw:"theme light dark system language region font size accessibility date time format motion"},{id:"integrations",label:"Integrations",icon:"radio",kw:"opensky flights adsb aircraft plugin oauth credentials bounding box plan connection ftp sftp ftps file transfer server host upload download local storage folder drive isolated private read only webdav nextcloud owncloud dav url https openweather weather forecast temperature api key units calls per minute usage limit quota"},{id:"profile",label:"Profile",icon:"image",kw:"avatar photo display name bio public"},{id:"security",label:"Privacy & Security",icon:"shield",kw:"two factor authentication 2fa sessions devices logout security privacy"}];return f.value&&g.push({id:"team",label:"User management",icon:"users",kw:"users team members add remove create delete role admin permissions rights organization"}),u.value&&g.push({id:"organizations",label:"Organizations",icon:"grid",kw:"organization org tenant company create rename delete members"}),g.push({id:"advanced",label:"Advanced",icon:"alertTriangle",kw:"export import data delete account danger zone",danger:!0}),g}),M=Y("account"),H=Y("");uc("settingsSearch",H);const j=ce(()=>H.value.trim().length>0),K=ce(()=>H.value.trim().toLowerCase());function F(g){return K.value?(g.label+" "+g.kw).toLowerCase().includes(K.value)||X(g.id):!0}const te={account:["full name","username","email address verification verify","password change current new"],appearance:["theme light dark system","language","region","font size accessibility","reduce motion","date format","time format clock"],integrations:["opensky live flights","enable plugin","oauth client id secret","plan credits","bounding box","test connection","file transfer ftp sftp ftps","server host port username password","private key passphrase","base path directory","local storage folder drive","private isolated folder","read only access mode","webdav nextcloud owncloud dav","server url username password tls","base path directory folder","openweather weather forecast","api key units metric imperial","default latitude longitude language","calls per minute limit usage quota","api call usage today rate limit"],profile:["profile photo avatar","display name","bio about","show email public"],security:["two factor authentication","active sessions devices","sign out"],team:["add user create account","members list role admin remove delete","organization org assign"],organizations:["add organization create","rename organization","delete organization members"],advanced:["export data download","import data upload","delete account permanent danger"]};function X(g){return K.value?(te[g]||[]).some(c=>c.includes(K.value)):!0}const fe=ce(()=>j.value?T.value.filter(F):T.value.filter(g=>g.id===M.value)),Se=ce({get:()=>Oo.value,set:g=>Ha(g)}),de=[{value:"light",label:"Light",icon:"sun"},{value:"dark",label:"Dark",icon:"moon"},{value:"system",label:"System",icon:"monitor"}],Fe=[{value:"sm",label:"Small"},{value:"md",label:"Default"},{value:"lg",label:"Large"}],Oe=[{value:"12",label:"12-hour"},{value:"24",label:"24-hour"}],Te=[["en","English"],["es","Español"],["de","Deutsch"],["fr","Français"],["pl","Polski"],["ja","日本語"]],Ze=km(),he=ce(()=>(Ze.find(([g])=>g===be.region)||[null,be.region])[1]),Q=[["MDY","MM/DD/YYYY"],["DMY","DD/MM/YYYY"],["YMD","YYYY/MM/DD"],["ISO","YYYY-MM-DD"]],B=Y(Date.now());let O=null;const N=ce(()=>Su(B.value)),$=gt({loaded:!1,available:!1,orgEnabled:!0,allowAnonymous:!0,enabled:!1,canEditOrg:!1,isSuperadmin:!1,scopes:{}}),Ye=Y("user"),we=gt({clientId:"",clientSecret:"",plan:"",bbox:""}),ge=Y(""),ue=Y(!1),ft=Y(!1),pe=Y(null),Ue=Y(null),Ve=ce(()=>pe.value&&pe.value.credits||null),wt=ce(()=>{const g=Ve.value;return!g||!g.daily||g.remaining==null?null:Math.max(0,Math.min(100,Math.round(g.remaining/g.daily*100)))}),st=ce(()=>{const g=wt.value;return g==null?"bg-accent":g<=10?"bg-danger":g<=30?"bg-amber":"bg-success"});function Le(g){return typeof g=="number"?g.toLocaleString():g}function De(){if(!Ue.value)return"";const g=Math.max(0,Math.round((Date.now()-Ue.value)/1e3));if(g<60)return"just now";const c=Math.round(g/60);if(c<60)return`${c} min ago`;const q=Math.round(c/60);return q<24?`${q} h ago`:`${Math.round(q/24)} d ago`}function zt(){try{pe.value&&localStorage.setItem(Lu,JSON.stringify({health:pe.value,ts:Ue.value}))}catch{}}function At(){try{const g=localStorage.getItem(Lu);if(!g)return;const c=JSON.parse(g);c&&c.health&&(pe.value=c.health,Ue.value=c.ts||null)}catch{}}const Ut=[{value:"",label:"Not set"},{value:"anonymous",label:"Anonymous"},{value:"standard",label:"Standard"},{value:"contributor",label:"Contributor"}],Pt=[{value:"user",label:"My settings",icon:"user"},{value:"org",label:"Organization",icon:"users"}],kt=[{label:"World",options:[{value:"-90,-180,90,180",label:"World"}]},{label:"Continents",options:[{value:"34,-25,72,45",label:"Europe"},{value:"-35,-18,38,52",label:"Africa"},{value:"5,25,82,180",label:"Asia"},{value:"7,-168,72,-52",label:"North America"},{value:"-56,-82,13,-34",label:"South America"},{value:"-48,110,-10,180",label:"Oceania"}]},{label:"European countries",options:wm()},{label:"Other countries",options:[{value:"24,-125,49.5,-66.5",label:"United States"},{value:"41.7,-141,83.1,-52.6",label:"Canada"},{value:"-43.6,113.3,-10.7,153.6",label:"Australia"},{value:"24,122.9,45.5,145.8",label:"Japan"}]}],x=kt.flatMap(g=>g.options);function b(g){const c=String(g||"").split(",").map(k=>k.trim());if(c.length!==4)return"";const q=c.map(Number);return q.some(k=>Number.isNaN(k))?"":q.join(",")}function S(g){const c=b(g),q=c&&x.find(k=>b(k.value)===c);return q?q.label:""}const W=Y(!1),V=ce({get(){if(!ve.value&&be.autoBbox)return"__auto__";if(W.value)return"__custom__";const g=b(we.bbox),c=g&&x.find(q=>b(q.value)===g);return c?c.value:"__custom__"},set(g){if(g==="__auto__"){ve.value||(be.autoBbox=!0),W.value=!1;return}if(ve.value||(be.autoBbox=!1),g==="__custom__"){W.value=!0;return}W.value=!1,we.bbox=g}}),G=ce(()=>V.value==="__custom__"),re=ce(()=>V.value==="__auto__"),ae=ce(()=>$.isSuperadmin),oe=ce(()=>$.isSuperadmin?"user":Ye.value),ee=ce(()=>$.scopes[oe.value]||{editableLayer:"user",fields:{}}),ve=ce(()=>oe.value==="org");function se(g){return ee.value.fields[g]||{effective:"",own:"",source:"unset",locked:!1}}function ke(g){return ae.value||se(g).locked}function Pe(g){const c=se(g).source;return c==="global"?"Set by administrator":c==="org"?"Set by your organization":""}function Re(){we.clientId=se("clientId").own||"",we.clientSecret=se("clientSecret").own||"",we.plan=se("plan").own||"",we.bbox=se("bbox").own||"",W.value=!1}function Ke(g){$.available=!!g.available,$.orgEnabled=g.orgEnabled!==!1,$.allowAnonymous=!!g.allowAnonymous,$.enabled=!!g.enabled,$.canEditOrg=!!g.canEditOrg,$.isSuperadmin=!!g.isSuperadmin,$.scopes=g.scopes||{},Ye.value==="org"&&!$.canEditOrg&&(Ye.value="user"),Re(),$.loaded=!0}Bt(Ye,()=>{ge.value="",Re()});async function Ge(){At();const{ok:g,body:c}=await hp();g&&Ke(c)}async function pt(g){const c=ve.value;c?$.orgEnabled=g:$.enabled=g;const{ok:q,body:k}=await bu(c?{scope:"org",enabled:g}:{scope:"user",enabled:g});q?(Ke(k),We(c?g?"OpenSky enabled for your organization.":"OpenSky disabled for your organization.":g?"OpenSky enabled.":"OpenSky disabled.")):(c?$.orgEnabled=!g:$.enabled=!g,We(k.error||"Could not update."))}async function ht(){ge.value="",ue.value=!0;const g={};for(const Be of["clientId","clientSecret","plan","bbox"])ke(Be)||(g[Be]=we[Be]);const c={scope:oe.value,config:g};ve.value||(c.enabled=$.enabled);const{ok:q,body:k}=await bu(c);if(ue.value=!1,!q){ge.value=k.error||"Could not save settings.";return}Ke(k),We(ve.value?"Organization OpenSky settings saved.":"OpenSky settings saved.")}const Vt=[{label:"World",options:[{value:"-90,-180,90,180",label:"World"}]},{label:"Continents",options:[{value:"34,-25,72,45",label:"Europe"},{value:"-35,-18,38,52",label:"Africa"},{value:"5,25,82,180",label:"Asia"},{value:"7,-168,72,-52",label:"North America"},{value:"-56,-82,13,-34",label:"South America"},{value:"-48,110,-10,180",label:"Oceania"}]},...Tm()],Jt=Vt.flatMap(g=>g.options),Zt=Y(""),pn=Y(!1),Ct=ce({get(){if(pn.value)return"__custom__";if(!Zt.value)return"__default__";const g=b(Zt.value),c=g&&Jt.find(q=>b(q.value)===g);return c?c.value:"__custom__"},set(g){if(g==="__default__"){pn.value=!1,Zt.value="";return}if(g==="__custom__"){pn.value=!0;return}pn.value=!1,Zt.value=g}}),$t=ce(()=>Ct.value==="__custom__");async function kn(){ft.value=!0,pe.value=null;const{ok:g,body:c}=await pp((Zt.value||"").trim()||void 0);ft.value=!1,pe.value=g&&c.health?c.health:{status:"down",detail:c.error||"Probe failed."},Ue.value=Date.now(),zt()}function zi(g){return g==="ok"?C.success:g==="degraded"?C.warning:C.danger}const at=gt({loaded:!1,available:!1,orgEnabled:!0,enabled:!1,canEditOrg:!1,isSuperadmin:!1,scopes:{}}),Sn=Y("user"),$i=["protocol","host","port","username","password","privateKey","keyPassphrase","hostKeyFingerprint","insecureSkipVerify","basePath"],rt=gt(Object.fromEntries($i.map(g=>[g,""]))),hi=Y(""),pi=Y(!1),Ii=Y(!1),Gt=Y(null),jn=Y(null),U=[{value:"sftp",label:"SFTP"},{value:"ftps",label:"FTPS"},{value:"ftp",label:"FTP"}],E=[{value:"false",label:"Verify certificate"},{value:"true",label:"Skip verification"}],Me=ce(()=>at.isSuperadmin),tt=ce(()=>at.isSuperadmin?"user":Sn.value),It=ce(()=>at.scopes[tt.value]||{editableLayer:"user",fields:{}}),St=ce(()=>tt.value==="org"),Et=ce(()=>(_t("protocol")?Z("protocol").effective:rt.protocol)||"sftp");function Z(g){return It.value.fields[g]||{effective:"",own:"",source:"unset",locked:!1}}function _t(g){return Me.value||Z(g).locked}function bt(g){const c=Z(g).source;return c==="global"?"Set by administrator":c==="org"?"Set by your organization":""}function oa(g){return(U.find(c=>c.value===g)||{}).label||g||"—"}function cs(){for(const g of $i)rt[g]=Z(g).own||"";rt.protocol||(rt.protocol="sftp"),rt.insecureSkipVerify||(rt.insecureSkipVerify="false")}function no(g){at.available=!!g.available,at.orgEnabled=g.orgEnabled!==!1,at.enabled=!!g.enabled,at.canEditOrg=!!g.canEditOrg,at.isSuperadmin=!!g.isSuperadmin,at.scopes=g.scopes||{},Sn.value==="org"&&!at.canEditOrg&&(Sn.value="user"),cs(),at.loaded=!0}Bt(Sn,()=>{hi.value="",cs()});function sa(){if(!jn.value)return"";const g=Math.max(0,Math.round((Date.now()-jn.value)/1e3));if(g<60)return"just now";const c=Math.round(g/60);if(c<60)return`${c} min ago`;const q=Math.round(c/60);return q<24?`${q} h ago`:`${Math.round(q/24)} d ago`}function Ni(){try{Gt.value&&localStorage.setItem(Au,JSON.stringify({health:Gt.value,ts:jn.value}))}catch{}}function aa(){try{const g=localStorage.getItem(Au);if(!g)return;const c=JSON.parse(g);c&&c.health&&(Gt.value=c.health,jn.value=c.ts||null)}catch{}}async function ir(){aa();const{ok:g,body:c}=await gp();g&&no(c)}async function ra(g){const c=St.value;c?at.orgEnabled=g:at.enabled=g;const{ok:q,body:k}=await yu(c?{scope:"org",enabled:g}:{scope:"user",enabled:g});q?(no(k),We(c?g?"File transfer enabled for your organization.":"File transfer disabled for your organization.":g?"File transfer enabled.":"File transfer disabled.")):(c?at.orgEnabled=!g:at.enabled=!g,We(k.error||"Could not update."))}async function or(){hi.value="",pi.value=!0;const g={};for(const Be of $i)_t(Be)||(g[Be]=rt[Be]);const c={scope:tt.value,config:g};St.value||(c.enabled=at.enabled);const{ok:q,body:k}=await yu(c);if(pi.value=!1,!q){hi.value=k.error||"Could not save settings.";return}no(k),We(St.value?"Organization file-transfer settings saved.":"File-transfer settings saved.")}async function sr(){Ii.value=!0,Gt.value=null;const{ok:g,body:c}=await vp();Ii.value=!1,Gt.value=g&&c.health?c.health:{status:"down",detail:c.error||"Probe failed."},jn.value=Date.now(),Ni()}function la(g){return g==="ok"?C.success:g==="degraded"?C.warning:C.danger}const lt=gt({loaded:!1,available:!1,orgEnabled:!0,enabled:!1,canEditOrg:!1,isSuperadmin:!1,scopes:{}}),Wn=Y("user"),ds=["baseURL","username","password","insecureSkipVerify","basePath"],Xt=gt(Object.fromEntries(ds.map(g=>[g,""]))),io=Y(""),zo=Y(!1),$o=Y(!1),Tn=Y(null),$n=Y(null),ua=[{value:"false",label:"Verify certificate"},{value:"true",label:"Skip verification"}],Io=ce(()=>lt.isSuperadmin),mi=ce(()=>lt.isSuperadmin?"user":Wn.value),it=ce(()=>lt.scopes[mi.value]||{editableLayer:"user",fields:{}}),ot=ce(()=>mi.value==="org");function Pn(g){return it.value.fields[g]||{effective:"",own:"",source:"unset",locked:!1}}function Cn(g){return Io.value||Pn(g).locked}function qt(g){const c=Pn(g).source;return c==="global"?"Set by administrator":c==="org"?"Set by your organization":""}function No(){for(const g of ds)Xt[g]=Pn(g).own||"";Xt.insecureSkipVerify||(Xt.insecureSkipVerify="false")}function He(g){lt.available=!!g.available,lt.orgEnabled=g.orgEnabled!==!1,lt.enabled=!!g.enabled,lt.canEditOrg=!!g.canEditOrg,lt.isSuperadmin=!!g.isSuperadmin,lt.scopes=g.scopes||{},Wn.value==="org"&&!lt.canEditOrg&&(Wn.value="user"),No(),lt.loaded=!0}Bt(Wn,()=>{io.value="",No()});function Lt(){if(!$n.value)return"";const g=Math.max(0,Math.round((Date.now()-$n.value)/1e3));if(g<60)return"just now";const c=Math.round(g/60);if(c<60)return`${c} min ago`;const q=Math.round(c/60);return q<24?`${q} h ago`:`${Math.round(q/24)} d ago`}function fs(){try{Tn.value&&localStorage.setItem(Mu,JSON.stringify({health:Tn.value,ts:$n.value}))}catch{}}function Do(){try{const g=localStorage.getItem(Mu);if(!g)return;const c=JSON.parse(g);c&&c.health&&(Tn.value=c.health,$n.value=c.ts||null)}catch{}}async function mn(){Do();const{ok:g,body:c}=await yp();g&&He(c)}async function ca(g){const c=ot.value;c?lt.orgEnabled=g:lt.enabled=g;const{ok:q,body:k}=await xu(c?{scope:"org",enabled:g}:{scope:"user",enabled:g});q?(He(k),We(c?g?"WebDAV enabled for your organization.":"WebDAV disabled for your organization.":g?"WebDAV enabled.":"WebDAV disabled.")):(c?lt.orgEnabled=!g:lt.enabled=!g,We(k.error||"Could not update."))}async function Fo(){io.value="",zo.value=!0;const g={};for(const Be of ds)Cn(Be)||(g[Be]=Xt[Be]);const c={scope:mi.value,config:g};ot.value||(c.enabled=lt.enabled);const{ok:q,body:k}=await xu(c);if(zo.value=!1,!q){io.value=k.error||"Could not save settings.";return}He(k),We(ot.value?"Organization WebDAV settings saved.":"WebDAV settings saved.")}async function gi(){$o.value=!0,Tn.value=null;const{ok:g,body:c}=await xp();$o.value=!1,Tn.value=g&&c.health?c.health:{status:"down",detail:c.error||"Probe failed."},$n.value=Date.now(),fs()}function Mt(g){return g==="ok"?C.success:g==="degraded"?C.warning:C.danger}const Xe=gt({loaded:!1,available:!1,orgEnabled:!0,enabled:!1,canEditOrg:!1,isSuperadmin:!1,scopes:{}}),In=Y("user"),vi=["apiKey","units","lat","lon","lang","callsPerMinute"],Ht=gt(Object.fromEntries(vi.map(g=>[g,""]))),Kn=Y(""),Di=Y(!1),Fi=Y(!1),Qt=Y(null),Gn=Y(null),Ro=[{value:"",label:"Not set"},{value:"metric",label:"Metric (°C)"},{value:"imperial",label:"Imperial (°F)"},{value:"standard",label:"Standard (K)"}],Ri=ce(()=>Xe.isSuperadmin),Bo=ce(()=>Xe.isSuperadmin?"user":In.value),hs=ce(()=>Xe.scopes[Bo.value]||{editableLayer:"user",fields:{}}),Ln=ce(()=>Bo.value==="org");function ze(g){return hs.value.fields[g]||{effective:"",own:"",source:"unset",locked:!1}}function jt(g){return Ri.value||ze(g).locked}function Je(g){const c=ze(g).source;return c==="global"?"Set by administrator":c==="org"?"Set by your organization":""}function ps(){for(const g of vi)Ht[g]=ze(g).own||""}function oo(g){Xe.available=!!g.available,Xe.orgEnabled=g.orgEnabled!==!1,Xe.enabled=!!g.enabled,Xe.canEditOrg=!!g.canEditOrg,Xe.isSuperadmin=!!g.isSuperadmin,Xe.scopes=g.scopes||{},In.value==="org"&&!Xe.canEditOrg&&(In.value="user"),ps(),Xe.loaded=!0}Bt(In,()=>{Kn.value="",ps()});function Uo(){if(!Gn.value)return"";const g=Math.max(0,Math.round((Date.now()-Gn.value)/1e3));if(g<60)return"just now";const c=Math.round(g/60);if(c<60)return`${c} min ago`;const q=Math.round(c/60);return q<24?`${q} h ago`:`${Math.round(q/24)} d ago`}function ms(){try{Qt.value&&localStorage.setItem(Eu,JSON.stringify({health:Qt.value,ts:Gn.value}))}catch{}}function _i(){try{const g=localStorage.getItem(Eu);if(!g)return;const c=JSON.parse(g);c&&c.health&&(Qt.value=c.health,Gn.value=c.ts||null)}catch{}}async function gs(){_i();const{ok:g,body:c}=await wp();g&&oo(c)}async function Bi(g){const c=Ln.value;c?Xe.orgEnabled=g:Xe.enabled=g;const{ok:q,body:k}=await wu(c?{scope:"org",enabled:g}:{scope:"user",enabled:g});q?(oo(k),We(c?g?"OpenWeather enabled for your organization.":"OpenWeather disabled for your organization.":g?"OpenWeather enabled.":"OpenWeather disabled.")):(c?Xe.orgEnabled=!g:Xe.enabled=!g,We(k.error||"Could not update."))}async function Ft(){Kn.value="",Di.value=!0;const g={};for(const Be of vi)jt(Be)||(g[Be]=Ht[Be]);const c={scope:Bo.value,config:g};Ln.value||(c.enabled=Xe.enabled);const{ok:q,body:k}=await wu(c);if(Di.value=!1,!q){Kn.value=k.error||"Could not save settings.";return}oo(k),We(Ln.value?"Organization OpenWeather settings saved.":"OpenWeather settings saved.")}async function bi(){Fi.value=!0,Qt.value=null;const{ok:g,body:c}=await kp();Fi.value=!1,Qt.value=g&&c.health?c.health:{status:"down",detail:c.error||"Probe failed."},Gn.value=Date.now(),ms()}function da(g){return g==="ok"?C.success:g==="degraded"?C.warning:C.danger}const Ui=ce(()=>Qt.value&&Qt.value.usage||null),vs=ce(()=>{const g=Ui.value;return!g||!g.minuteLimit?null:Math.max(0,Math.min(100,Math.round(g.minuteUsed/g.minuteLimit*100)))}),fa=ce(()=>{const g=vs.value;return g==null?"bg-accent":g>=90?"bg-danger":g>=70?"bg-amber":"bg-success"}),Ae=gt({loaded:!1,available:!1,orgEnabled:!0,enabled:!1,canEditOrg:!1,isSuperadmin:!1,isOrgUser:!1,mounts:[],privateFolder:!1,privateEnabled:!1,allowPrivate:!0,rootConfigured:!1,scopes:{}}),Vi=Y("user"),so=Y(""),qe=Y(""),Vo=Y(!1),en=Y(!1),ln=Y(null),yi=Y(null),ao=Y({}),Zo=[{value:"",label:"Inherit"},{value:"false",label:"Read-write"},{value:"true",label:"Read-only"}],_s=ce(()=>Ae.isSuperadmin),Ho=ce(()=>Ae.isSuperadmin?"user":Vi.value),ar=ce(()=>Ae.scopes[Ho.value]||{editableLayer:"user",fields:{}}),gn=ce(()=>Ho.value==="org");function Zi(g){return ar.value.fields[g]||{effective:"",own:"",source:"unset",locked:!1}}function ha(g){return _s.value||Zi(g).locked}function An(g){const c=Zi(g).source;return c==="global"?"Set by administrator":c==="org"?"Set by your organization":""}function rr(g){return(Zo.find(c=>c.value===g)||{}).label||"Inherit"}function bs(){so.value=Zi("readOnly").own||""}function vn(g){Ae.available=!!g.available,Ae.orgEnabled=g.orgEnabled!==!1,Ae.enabled=!!g.enabled,Ae.canEditOrg=!!g.canEditOrg,Ae.isSuperadmin=!!g.isSuperadmin,Ae.isOrgUser=!!g.isOrgUser,Ae.mounts=Array.isArray(g.mounts)?g.mounts:[],Ae.privateFolder=!!g.privateFolder,Ae.privateEnabled=!!g.privateEnabled,Ae.allowPrivate=g.allowPrivate!==!1,Ae.rootConfigured=!!g.rootConfigured,Ae.scopes=g.scopes||{},Vi.value==="org"&&!Ae.canEditOrg&&(Vi.value="user"),bs(),Ae.loaded=!0}Bt(Vi,()=>{qe.value="",bs()});function pa(){if(!yi.value)return"";const g=Math.max(0,Math.round((Date.now()-yi.value)/1e3));if(g<60)return"just now";const c=Math.round(g/60);if(c<60)return`${c} min ago`;const q=Math.round(c/60);return q<24?`${q} h ago`:`${Math.round(q/24)} d ago`}function ma(){try{ln.value&&localStorage.setItem(Ou,JSON.stringify({health:ln.value,ts:yi.value}))}catch{}}function ys(){try{const g=localStorage.getItem(Ou);if(!g)return;const c=JSON.parse(g);c&&c.health&&(ln.value=c.health,yi.value=c.ts||null)}catch{}}async function lr(){ys();const{ok:g,body:c}=await _p();g&&vn(c)}async function xs(g){const c=gn.value;c?Ae.orgEnabled=g:Ae.enabled=g;const{ok:q,body:k}=await Ma(c?{scope:"org",enabled:g}:{scope:"user",enabled:g});q?(vn(k),We(c?g?"Local storage enabled for your organization.":"Local storage disabled for your organization.":g?"Local storage enabled.":"Local storage disabled.")):(c?Ae.orgEnabled=!g:Ae.enabled=!g,We(k.error||"Could not update."))}async function ga(g){Ae.privateFolder=g;const{ok:c,body:q}=await Ma({scope:"user",privateFolder:g});c?(vn(q),We(g?"Private folder enabled.":"Private folder disabled.")):(Ae.privateFolder=!g,We(q.error||"Could not update."))}async function ur(g){Ae.allowPrivate=g;const{ok:c,body:q}=await Ma({scope:"org",allowPrivate:g});c?(vn(q),We(g?"Members may now create private folders.":"Private folders disabled for your organization.")):(Ae.allowPrivate=!g,We(q.error||"Could not update."))}async function cr(){qe.value="",Vo.value=!0;const g={};ha("readOnly")||(g.readOnly=so.value);const c={scope:Ho.value,config:g};gn.value||(c.enabled=Ae.enabled);const{ok:q,body:k}=await Ma(c);if(Vo.value=!1,!q){qe.value=k.error||"Could not save settings.";return}vn(k),We(gn.value?"Organization local-storage settings saved.":"Local-storage settings saved.")}async function ws(){en.value=!0,ln.value=null,ao.value={};const{ok:g,body:c}=await bp();en.value=!1,ln.value=g&&c.health?c.health:{status:"down",detail:c.error||"Probe failed."};const q={};if(Array.isArray(c.mounts))for(const k of c.mounts)q[k.id]={status:k.status,detail:k.detail};ao.value=q,yi.value=Date.now(),ma()}function va(g){return g==="ok"?C.success:g==="degraded"?C.warning:C.danger}const _a=[{id:"apis-external",label:"APIs — External",icon:"globe"},{id:"drives-external",label:"Drives — External",icon:"server"},{id:"drives-local",label:"Drives — Local",icon:"monitor"}],jo=Y("apis-external");function Hi(g){return j.value||jo.value===g}const Nn=Y("");let ks=null;function We(g){Nn.value=g,clearTimeout(ks),ks=setTimeout(()=>Nn.value="",2200)}const yt=gt({current:"",next:"",confirm:""}),xi=Y(""),Ss=Y(!1);function dr(){if(Ss.value=!1,!yt.current)return xi.value="Enter your current password.";if(yt.next.length<8)return xi.value="New password must be at least 8 characters.";if(yt.next!==yt.confirm)return xi.value="New passwords do not match.";xi.value="Validated. Connecting to the account service is pending — no password endpoint yet.",yt.current=yt.next=yt.confirm=""}const ro=Y("");function Ts(){ro.value="Verification link would be sent once the account service is wired up."}function fr(g){const c=g.target.files&&g.target.files[0];if(!c)return;if(c.size>1.5*1024*1024){We("Image too large (max ~1.5 MB).");return}const q=new FileReader;q.onload=()=>{be.avatar=String(q.result),We("Photo updated.")},q.readAsDataURL(c)}function hr(){be.avatar="",We("Photo removed.")}const ba=ce(()=>{var q,k,Be;const c=(be.displayName||be.name||s.email||"PV").split("@")[0].split(/[.\-_ ]+/).filter(Boolean);return((((q=c[0])==null?void 0:q[0])||"P")+(((k=c[1])==null?void 0:k[0])||((Be=c[0])==null?void 0:Be[1])||"V")).toUpperCase()}),lo=Y(!1),_n=Y(""),qn=Y(""),uo=Y(""),bn=Y([]);function Ps(g){const c="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";let q="";for(let k=0;kPs(4).toLowerCase()+"-"+Ps(4).toLowerCase()),uo.value=""}function co(){be.twoFactor=!1,bn.value=[],lo.value=!1}const Mn=navigator.userAgent;function Wo(){return/Edg\//.test(Mn)?"Edge":/OPR\//.test(Mn)?"Opera":/Chrome\//.test(Mn)?"Chrome":/Firefox\//.test(Mn)?"Firefox":/Safari\//.test(Mn)?"Safari":"Browser"}function mr(){return/Windows/.test(Mn)?"Windows":/Mac OS X/.test(Mn)?"macOS":/Android/.test(Mn)?"Android":/iPhone|iPad/.test(Mn)?"iOS":/Linux/.test(Mn)?"Linux":"Unknown OS"}const ti=Date.now(),wi=Y([]),fo=Y(!1),Wi=Y(""),Rt=gt({email:"",password:"",role:"user",organization:""}),tn=Y(""),Ko=Y(!1),Dn=Y(""),ya=ce(()=>{const g=[{value:"user",label:"User"},{value:"admin",label:"Admin"}];return u.value&&g.push({value:"superadmin",label:"Superadmin"}),g}),yn=Y([]);async function ni(){if(!f.value)return;const g=await rp();g.ok&&(yn.value=g.organizations.slice().sort((c,q)=>c.name.localeCompare(q.name)))}const Cs=ce(()=>{const g=yn.value.map(c=>({value:c.id,label:c.name}));return u.value&&g.unshift({value:"",label:"No organization"}),g});async function ii(){if(!f.value)return;fo.value=!0,Wi.value="";const g=await ip();if(fo.value=!1,!g.ok){Wi.value=g.status===403?"Manager role required.":"Could not load users.";return}wi.value=g.users.slice().sort((c,q)=>c.email.localeCompare(q.email))}function ki(g){try{const c=g.data||{},q=Object.keys(c)[0];return q&&c[q]&&c[q].message||g.message||g.error||"Invalid input."}catch{return g.error||"Could not create user."}}async function Ls(){tn.value="";const g=Rt.email.trim().toLowerCase();if(!g.includes("@"))return tn.value="Enter a valid email.";if(Rt.password.length<8)return tn.value="Password must be at least 8 characters.";Ko.value=!0;const c=u.value?Rt.organization:s.organization,{ok:q,body:k}=await op(g,Rt.password,Rt.role,c);if(Ko.value=!1,!q)return tn.value=ki(k);Rt.email="",Rt.password="",Rt.role="user",Rt.organization="",We("User created."),ii()}async function Go(g){const{ok:c,body:q}=await ap(g.id);if(Dn.value="",!c)return We(q.error||"Could not remove user.");We("User removed."),ii()}const Qe=gt({id:"",email:"",role:"user",verified:!1,password:"",organization:""}),En=Y(""),Ki=Y(!1),qo=ce(()=>!!Qe.id&&Qe.email===s.email);function gr(g){Dn.value="",Qe.id=g.id,Qe.email=g.email,Qe.role=g.role||"user",Qe.verified=!!g.verified,Qe.password="",Qe.organization=g.organization||"",En.value=""}function ho(){Qe.id="",En.value=""}async function vr(){En.value="";const g=Qe.email.trim().toLowerCase();if(!g.includes("@"))return En.value="Enter a valid email.";if(Qe.password&&Qe.password.length<8)return En.value="New password must be at least 8 characters (or leave blank).";const c={email:g,role:Qe.role,verified:Qe.verified};u.value&&(c.organization=Qe.organization),Qe.password&&(c.password=Qe.password),Ki.value=!0;const{ok:q,body:k}=await sp(Qe.id,c);if(Ki.value=!1,!q)return En.value=ki(k);We("User updated."),ho(),ii()}const po=gt({name:""}),mo=Y(""),go=Y(!1),vo=Y(""),Nt=gt({id:"",name:""}),Fn=Y(""),As=ce(()=>{const g={};for(const c of wi.value)c.organization&&(g[c.organization]=(g[c.organization]||0)+1);return g});async function _o(){mo.value="";const g=po.name.trim();if(!g)return mo.value="Enter an organization name.";go.value=!0;const{ok:c,body:q}=await lp(g);if(go.value=!1,!c)return mo.value=ki(q);po.name="",We("Organization created."),ni()}function _r(g){vo.value="",Nt.id=g.id,Nt.name=g.name,Fn.value=""}function Ms(){Nt.id="",Fn.value=""}async function xa(){Fn.value="";const g=Nt.name.trim();if(!g)return Fn.value="Enter an organization name.";const{ok:c,body:q}=await up(Nt.id,g);if(!c)return Fn.value=ki(q);We("Organization renamed."),Ms(),ni(),ii()}async function bo(g){const{ok:c,body:q}=await cp(g.id);if(vo.value="",!c)return We(q.error||"Could not delete organization.");We("Organization deleted."),ni()}function br(){const g={_app:"PilotVault",_kind:"settings-export",exportedAt:new Date().toISOString(),email:s.email,prefs:{...be},themeMode:Oo.value},c=new Blob([JSON.stringify(g,null,2)],{type:"application/json"}),q=URL.createObjectURL(c),k=document.createElement("a");k.href=q,k.download=`pilotvault-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(k),k.click(),k.remove(),URL.revokeObjectURL(q),We("Settings exported.")}const Yn=Y("");function wa(g){const c=g.target.files&&g.target.files[0];if(!c)return;const q=new FileReader;q.onload=()=>{try{const k=JSON.parse(String(q.result)),Be=k.prefs||k;if(!ed(Be))throw new Error("bad shape");k.themeMode&&Ha(k.themeMode),ml(be.fontSize),gl(be.reduceMotion),Yn.value="Settings imported and applied."}catch{Yn.value="That file is not a valid PilotVault settings export."}},q.readAsText(c),g.target.value=""}const mt=gt({understand:!1,typed:"",cooldown:0,armed:!1,msg:""});let yo=null;const On=ce(()=>s.email||"DELETE MY ACCOUNT"),Yo=ce(()=>mt.understand&&mt.typed===On.value);function ka(){Yo.value&&(mt.armed=!0,mt.cooldown=5,clearInterval(yo),yo=setInterval(()=>{mt.cooldown--,mt.cooldown<=0&&clearInterval(yo)},1e3))}Bt(Yo,g=>{!g&&mt.armed&&(mt.armed=!1,mt.cooldown=0,clearInterval(yo))});function xo(){if(!(!mt.armed||mt.cooldown>0)){try{localStorage.removeItem("pv_prefs")}catch{}mt.msg="Account deletion requires the account service. Local data was cleared and you were signed out.",setTimeout(()=>l("logout"),900)}}return fi(()=>{O=setInterval(()=>B.value=Date.now(),1e3),ni(),ii(),Ge(),ir(),mn(),gs(),lr()}),us(()=>{clearInterval(O),clearInterval(yo),clearTimeout(ks)}),(g,c)=>(p(),m("div",Cm,[a("div",Lm,[c[72]||(c[72]=a("div",null,[a("div",{class:"eyebrow"},"Preferences"),a("h2",{class:"mt-0.5 text-[22px] font-bold tracking-tightest text-ink"},"Settings")],-1)),a("div",Am,[A(J,{name:"search",size:16,class:"text-ink-muted"}),ie(a("input",{"onUpdate:modelValue":c[0]||(c[0]=q=>H.value=q),placeholder:"Search settings…",class:"w-full border-none bg-transparent text-sm text-ink outline-none placeholder:text-ink-muted"},null,512),[[me,H.value]]),H.value?(p(),m("button",{key:0,class:"text-ink-muted hover:text-ink","aria-label":"Clear search",onClick:c[1]||(c[1]=q=>H.value="")},[A(J,{name:"x",size:15})])):I("",!0)])]),a("div",Mm,[ie(a("nav",Em,[(p(!0),m(le,null,Ie(T.value,q=>(p(),m("button",{key:q.id,class:Ce(["flex items-center gap-2.5 rounded px-3 py-2.5 text-left text-sm transition",[M.value===q.id?q.danger?"bg-danger-soft font-semibold text-danger-fg":"bg-accent-soft font-semibold text-accent-soft-fg":q.danger?"font-medium text-danger-fg hover:bg-danger-soft":"font-medium text-ink-secondary hover:bg-surface-2"]]),onClick:k=>M.value=q.id},[A(J,{name:q.icon,size:17},null,8,["name"]),a("span",zm,w(q.label),1)],10,Om))),128))],512),[[kh,!j.value]]),a("div",$m,[j.value&&!fe.value.length?(p(),m("div",Im," No settings match “"+w(H.value)+"”. ",1)):I("",!0),(p(!0),m(le,null,Ie(fe.value,q=>(p(),m(le,{key:q.id},[j.value?(p(),m("div",Nm,[A(J,{name:q.icon,size:14},null,8,["name"]),z(" "+w(q.label),1)])):I("",!0),q.id==="account"?(p(),m("div",Dm,[A(xe,{title:"Full name",desc:"Shown to your team on flights and audit logs.",keywords:"full name account"},{default:ye(()=>[ie(a("input",{"onUpdate:modelValue":c[2]||(c[2]=k=>Ee(be).name=k),class:"field w-56",placeholder:"Jane Operator",onBlur:c[3]||(c[3]=k=>We("Saved."))},null,544),[[me,Ee(be).name]])]),_:1}),A(xe,{title:"Username",desc:"Your unique handle within PilotVault.",keywords:"username handle"},{default:ye(()=>[a("div",Fm,[c[73]||(c[73]=a("span",{class:"text-sm text-ink-muted"},"@",-1)),ie(a("input",{"onUpdate:modelValue":c[4]||(c[4]=k=>Ee(be).username=k),class:"field w-48",placeholder:"jane",onBlur:c[5]||(c[5]=k=>We("Saved."))},null,544),[[me,Ee(be).username]])])]),_:1}),A(xe,{title:"Email address",desc:"Used for sign-in and notifications.",keywords:"email verification verify"},{default:ye(()=>[a("div",Rm,[a("span",Bm,w(t.email||"—"),1),a("span",Um,[A(J,{name:"mail",size:12}),c[74]||(c[74]=z(" Unverified ",-1))])])]),_:1}),A(xe,{title:"Role",desc:"Your access level in PilotVault.",keywords:"role admin user superadmin access rights permissions"},{default:ye(()=>[a("span",{class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",y(t.role)])},[A(J,{name:_(t.role),size:12},null,8,["name"]),z(w(h(t.role)),1)],2)]),_:1}),A(xe,{title:"Organization",desc:"The organization your account belongs to.",keywords:"organization org tenant company"},{default:ye(()=>[a("span",{class:Ce(["text-sm",t.organizationName?"text-ink":"text-ink-muted"])},w(t.organizationName||(u.value?"All organizations":"None")),3)]),_:1}),A(xe,{block:"",title:"Verify email",desc:"Confirm ownership to enable password resets and alerts.",keywords:"verify email resend"},{default:ye(()=>[a("button",{class:"btn-ghost",onClick:Ts},"Send verification link"),ro.value?(p(),m("p",Vm,w(ro.value),1)):I("",!0)]),_:1}),A(xe,{block:"",title:"Change password",desc:"Use at least 8 characters.",keywords:"password change current new"},{default:ye(()=>[a("div",Zm,[ie(a("input",{"onUpdate:modelValue":c[6]||(c[6]=k=>yt.current=k),type:"password",class:"field",placeholder:"Current password"},null,512),[[me,yt.current]]),ie(a("input",{"onUpdate:modelValue":c[7]||(c[7]=k=>yt.next=k),type:"password",class:"field",placeholder:"New password"},null,512),[[me,yt.next]]),ie(a("input",{"onUpdate:modelValue":c[8]||(c[8]=k=>yt.confirm=k),type:"password",class:"field",placeholder:"Confirm new password"},null,512),[[me,yt.confirm]]),a("div",Hm,[a("button",{class:"btn-accent",onClick:dr},"Update password"),xi.value?(p(),m("span",{key:0,class:Ce(["text-xs",Ss.value?"text-success-fg":"text-ink-muted"])},w(xi.value),3)):I("",!0)])])]),_:1})])):q.id==="appearance"?(p(),m("div",jm,[A(xe,{title:"Theme",desc:"Light, dark, or follow your system.",keywords:"theme light dark system appearance"},{default:ye(()=>[A(wn,{modelValue:Se.value,"onUpdate:modelValue":c[9]||(c[9]=k=>Se.value=k),options:de},null,8,["modelValue"])]),_:1}),A(xe,{title:"Font size",desc:"Scales the entire interface for readability.",keywords:"font size accessibility text"},{default:ye(()=>[A(wn,{modelValue:Ee(be).fontSize,"onUpdate:modelValue":c[10]||(c[10]=k=>Ee(be).fontSize=k),options:Fe},null,8,["modelValue"])]),_:1}),A(xe,{title:"Reduce motion",desc:"Minimise animations and transitions.",keywords:"reduce motion accessibility animation"},{default:ye(()=>[A(nn,{modelValue:Ee(be).reduceMotion,"onUpdate:modelValue":c[11]||(c[11]=k=>Ee(be).reduceMotion=k)},null,8,["modelValue"])]),_:1}),A(xe,{title:"Language",desc:"Interface language.",keywords:"language locale"},{default:ye(()=>[ie(a("select",{"onUpdate:modelValue":c[12]||(c[12]=k=>Ee(be).language=k),class:"field w-48"},[(p(),m(le,null,Ie(Te,([k,Be])=>a("option",{key:k,value:k},w(Be),9,Wm)),64))],512),[[Ot,Ee(be).language]])]),_:1}),A(xe,{title:"Region",desc:"Affects number, unit and date defaults.",keywords:"region country locale"},{default:ye(()=>[ie(a("select",{"onUpdate:modelValue":c[13]||(c[13]=k=>Ee(be).region=k),class:"field w-48"},[(p(!0),m(le,null,Ie(Ee(Ze),([k,Be])=>(p(),m("option",{key:k,value:k},w(Be),9,Km))),128))],512),[[Ot,Ee(be).region]])]),_:1}),A(xe,{title:"Date format",desc:"How calendar dates are displayed.",keywords:"date format"},{default:ye(()=>[ie(a("select",{"onUpdate:modelValue":c[14]||(c[14]=k=>Ee(be).dateFormat=k),class:"field w-48"},[(p(),m(le,null,Ie(Q,([k,Be])=>a("option",{key:k,value:k},w(Be),9,Gm)),64))],512),[[Ot,Ee(be).dateFormat]])]),_:1}),A(xe,{title:"Time format",desc:"12- or 24-hour clock.",keywords:"time format clock 12 24 hour"},{default:ye(()=>[A(wn,{modelValue:Ee(be).timeFormat,"onUpdate:modelValue":c[15]||(c[15]=k=>Ee(be).timeFormat=k),options:Oe},null,8,["modelValue"])]),_:1}),A(xe,{title:"Preview",desc:"How timestamps appear across the app.",keywords:"preview date time"},{default:ye(()=>[a("span",qm,w(N.value),1)]),_:1}),c[75]||(c[75]=a("p",{class:"mt-3 text-xs text-ink-muted"}," Language & region are stored now; full localisation ships with the account service. ",-1))])):q.id==="integrations"?(p(),m("div",Ym,[j.value?I("",!0):(p(),m("div",Jm,[(p(),m(le,null,Ie(_a,k=>a("button",{key:k.id,type:"button",class:Ce(["-mb-px inline-flex items-center gap-1.5 whitespace-nowrap border-b-2 px-3 py-2 text-sm font-semibold transition",jo.value===k.id?"border-accent text-ink":"border-transparent text-ink-secondary hover:text-ink"]),onClick:Be=>jo.value=k.id},[A(J,{name:k.icon,size:16},null,8,["name"]),z(w(k.label),1)],10,Xm)),64))])),Hi("apis-external")?(p(),m(le,{key:1},[a("div",Qm,[a("div",eg,[a("div",tg,[A(J,{name:"radio",size:20})]),c[76]||(c[76]=a("div",{class:"min-w-0"},[a("div",{class:"text-sm font-semibold text-ink"},"OpenSky Network"),a("div",{class:"mt-0.5 text-xs text-ink-muted"}," Live ADS-B aircraft data. Configure your own OAuth2 credentials, plan and default bounding box. ")],-1))]),$.loaded&&!$.available?(p(),m("div",ng,[A(J,{name:"lock",size:14,class:"mr-1 inline"}),c[77]||(c[77]=z(" OpenSky is currently disabled by your administrator. Contact them to enable it. ",-1))])):I("",!0),$.canEditOrg?(p(),m("div",ig,[c[78]||(c[78]=a("div",{class:"text-xs text-ink-muted"},"Manage your own settings, or organization-wide settings that apply to every user.",-1)),A(wn,{modelValue:Ye.value,"onUpdate:modelValue":c[16]||(c[16]=k=>Ye.value=k),options:Pt},null,8,["modelValue"])])):I("",!0),ve.value?(p(),nt(xe,{key:2,title:"Enable OpenSky (organization-wide)",desc:"Turn OpenSky on or off for everyone in your organization.",keywords:"enable disable plugin opensky organization"},{default:ye(()=>[A(nn,{"model-value":$.orgEnabled,disabled:!$.available,"onUpdate:modelValue":pt},null,8,["model-value","disabled"])]),_:1})):(p(),nt(xe,{key:3,title:"Enable OpenSky",desc:"Turn the plugin on for your account in the Web App.",keywords:"enable disable plugin opensky"},{default:ye(()=>[A(nn,{"model-value":$.enabled,disabled:!$.available||!$.orgEnabled,"onUpdate:modelValue":pt},null,8,["model-value","disabled"])]),_:1})),!ve.value&&$.available&&!$.orgEnabled?(p(),m("div",og,[A(J,{name:"lock",size:13,class:"mr-1 inline"}),c[80]||(c[80]=z("OpenSky is turned off for your organization",-1)),$.canEditOrg?(p(),m("span",sg,[...c[79]||(c[79]=[z(" — switch to ",-1),a("span",{class:"font-semibold"},"Organization",-1),z(" to turn it back on",-1)])])):I("",!0),c[81]||(c[81]=z(". ",-1))])):I("",!0),ve.value?(p(),m("div",ag,[A(J,{name:"users",size:13,class:"mr-1 inline"}),c[82]||(c[82]=z("These are organization-wide settings — they apply to everyone in ",-1)),a("span",rg,w(t.organizationName||"your organization"),1),c[83]||(c[83]=z(". Leave a field blank to let each user choose their own; a value set here overrides the user's. ",-1))])):ae.value?(p(),m("div",lg," As a superadmin you manage the global OpenSky configuration in the API Server panel. The effective configuration is shown below. ")):I("",!0),$.available&&!ve.value?(p(),m("div",ug,[a("div",cg,[a("div",dg,[A(J,{name:"signal",size:15}),c[84]||(c[84]=z("Credit usage ",-1))]),Ue.value?(p(),m("span",fg,"Checked "+w(De()),1)):I("",!0)]),Ve.value?(p(),m(le,{key:0},[Ve.value.remaining!=null?(p(),m(le,{key:0},[a("div",hg,[a("span",pg,w(Le(Ve.value.remaining)),1),a("span",mg,"/ "+w(Le(Ve.value.daily))+" credits left today",1)]),a("div",gg,[a("div",{class:Ce(["h-full rounded-full transition-all",st.value]),style:Eo({width:wt.value+"%"})},null,6)]),a("div",vg," Used "+w(Le(Ve.value.daily-Ve.value.remaining))+" today · "+w(Ve.value.probeCost)+" credit"+w(Ve.value.probeCost===1?"":"s")+" per query · "+w(Ve.value.mode),1)],64)):(p(),m(le,{key:1},[a("div",_g,[c[85]||(c[85]=z("Daily allowance: ",-1)),a("span",bg,w(Le(Ve.value.daily)),1),c[86]||(c[86]=z(" credits",-1))]),a("div",yg,w(Ve.value.probeCost)+" credit"+w(Ve.value.probeCost===1?"":"s")+" per query · "+w(Ve.value.mode)+". OpenSky only reports live remaining credits for authenticated requests — add OAuth2 credentials below to track usage. ",1)],64))],64)):(p(),m("div",xg,[...c[87]||(c[87]=[z(" Run ",-1),a("span",{class:"font-semibold text-ink-secondary"},"Test connection",-1),z(" below to fetch your live OpenSky credit balance. ",-1)])]))])):I("",!0),A(xe,{title:"OpenSky plan",desc:"Your account tier — sets the daily credit allowance.",keywords:"plan tier credits"},{default:ye(()=>[ke("plan")?(p(),m("span",wg,[z(w((Ut.find(k=>k.value===se("plan").effective)||{}).label||se("plan").effective||"—")+" ",1),Pe("plan")?(p(),m("span",kg,[A(J,{name:"lock",size:10}),z(w(Pe("plan")),1)])):I("",!0)])):(p(),nt(wn,{key:1,modelValue:we.plan,"onUpdate:modelValue":c[17]||(c[17]=k=>we.plan=k),options:Ut},null,8,["modelValue"]))]),_:1}),A(xe,{title:"Default bounding box",desc:"Automatic follows your location; or pick a region, or enter lamin,lomin,lamax,lomax by hand.",keywords:"bounding box bbox area region country continent world europe custom coordinates automatic location drone"},{default:ye(()=>[ke("bbox")?(p(),m("span",Sg,[z(w(S(se("bbox").effective)||se("bbox").effective||"—")+" ",1),Pe("bbox")?(p(),m("span",Tg,[A(J,{name:"lock",size:10}),z(w(Pe("bbox")),1)])):I("",!0)])):(p(),m("div",Pg,[ie(a("select",{"onUpdate:modelValue":c[18]||(c[18]=k=>V.value=k),class:"field w-64"},[ve.value?I("",!0):(p(),m("option",Cg,"Automatic (by location)")),(p(),m(le,null,Ie(kt,k=>a("optgroup",{key:k.label,label:k.label},[(p(!0),m(le,null,Ie(k.options,Be=>(p(),m("option",{key:Be.value,value:Be.value},w(Be.label),9,Ag))),128))],8,Lg)),64)),c[88]||(c[88]=a("option",{value:"__custom__"},"Custom…",-1))],512),[[Ot,V.value]]),re.value?(p(),m("p",Mg," Live map follows drone location → your device location → your Region ("+w(he.value)+"). ",1)):I("",!0),G.value?ie((p(),m("input",{key:1,"onUpdate:modelValue":c[19]||(c[19]=k=>we.bbox=k),class:"field w-64 font-mono",placeholder:"50.5,3.2,53.7,7.3"},null,512)),[[me,we.bbox]]):I("",!0)]))]),_:1}),A(xe,{title:"OAuth2 client ID",desc:"Optional — leave blank for anonymous access (lower limits).",keywords:"oauth client id credentials"},{default:ye(()=>[ke("clientId")?(p(),m("span",Eg,[z(w(se("clientId").effective||"—")+" ",1),Pe("clientId")?(p(),m("span",Og,[A(J,{name:"lock",size:10}),z(w(Pe("clientId")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[20]||(c[20]=k=>we.clientId=k),class:"field w-64",placeholder:"your-api-client"},null,512)),[[me,we.clientId]])]),_:1}),A(xe,{title:"OAuth2 client secret",desc:"Paired with the client ID for authenticated access.",keywords:"oauth client secret credentials password"},{default:ye(()=>[ke("clientSecret")?(p(),m("span",zg,[z(w(se("clientSecret").effective||"—")+" ",1),Pe("clientSecret")?(p(),m("span",$g,[A(J,{name:"lock",size:10}),z(w(Pe("clientSecret")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[21]||(c[21]=k=>we.clientSecret=k),type:"password",class:"field w-64",placeholder:"••••••••"},null,512)),[[me,we.clientSecret]])]),_:1}),$.available&&!$.allowAnonymous?(p(),m("div",Ig," Anonymous access is disabled by the administrator — OpenSky needs OAuth2 credentials from some layer to work. ")):I("",!0),a("div",Ng,[ae.value?I("",!0):(p(),m("button",{key:0,class:"btn-accent",disabled:ue.value||!$.available,onClick:ht},w(ue.value?"Saving…":ve.value?"Save organization settings":"Save settings"),9,Dg)),ve.value?I("",!0):(p(),m("div",Fg,[c[91]||(c[91]=a("label",{class:"text-xs text-ink-muted"},"Test area",-1)),ie(a("select",{"onUpdate:modelValue":c[22]||(c[22]=k=>Ct.value=k),class:"field w-44"},[c[89]||(c[89]=a("option",{value:"__default__"},"Default bounding box",-1)),(p(),m(le,null,Ie(Vt,k=>a("optgroup",{key:k.label,label:k.label},[(p(!0),m(le,null,Ie(k.options,Be=>(p(),m("option",{key:Be.value,value:Be.value},w(Be.label),9,Bg))),128))],8,Rg)),64)),c[90]||(c[90]=a("option",{value:"__custom__"},"Custom…",-1))],512),[[Ot,Ct.value]]),$t.value?ie((p(),m("input",{key:0,"onUpdate:modelValue":c[23]||(c[23]=k=>Zt.value=k),class:"field w-44 font-mono",placeholder:"lamin,lomin,lamax,lomax"},null,512)),[[me,Zt.value]]):I("",!0)])),ve.value?I("",!0):(p(),m("button",{key:2,class:"btn-ghost",disabled:ft.value||!$.available,onClick:kn},w(ft.value?"Testing…":"Test connection"),9,Ug)),ge.value?(p(),m("span",Vg,w(ge.value),1)):I("",!0),pe.value&&!ve.value?(p(),m("span",{key:4,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",zi(pe.value.status)])},[c[92]||(c[92]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(pe.value.detail||pe.value.status),1)],2)):I("",!0)])]),a("div",Zg,[a("div",Hg,[a("div",jg,[A(J,{name:"sun",size:20})]),c[93]||(c[93]=a("div",{class:"min-w-0"},[a("div",{class:"text-sm font-semibold text-ink"},"OpenWeather"),a("div",{class:"mt-0.5 text-xs text-ink-muted"}," Current conditions and forecast from the OpenWeather API. Configure the API key and default location your account uses. ")],-1))]),Xe.loaded&&!Xe.available?(p(),m("div",Wg,[A(J,{name:"lock",size:14,class:"mr-1 inline"}),c[94]||(c[94]=z(" OpenWeather is currently disabled by your administrator. Contact them to enable it. ",-1))])):I("",!0),Xe.canEditOrg?(p(),m("div",Kg,[c[95]||(c[95]=a("div",{class:"text-xs text-ink-muted"},"Manage your own settings, or organization-wide settings that apply to every user.",-1)),A(wn,{modelValue:In.value,"onUpdate:modelValue":c[24]||(c[24]=k=>In.value=k),options:Pt},null,8,["modelValue"])])):I("",!0),Ln.value?(p(),nt(xe,{key:2,title:"Enable OpenWeather (organization-wide)",desc:"Turn it on or off for everyone in your organization.",keywords:"enable disable plugin openweather weather organization"},{default:ye(()=>[A(nn,{"model-value":Xe.orgEnabled,disabled:!Xe.available,"onUpdate:modelValue":Bi},null,8,["model-value","disabled"])]),_:1})):(p(),nt(xe,{key:3,title:"Enable OpenWeather",desc:"Turn the plugin on for your account in the Web App.",keywords:"enable disable plugin openweather weather"},{default:ye(()=>[A(nn,{"model-value":Xe.enabled,disabled:!Xe.available||!Xe.orgEnabled,"onUpdate:modelValue":Bi},null,8,["model-value","disabled"])]),_:1})),!Ln.value&&Xe.available&&!Xe.orgEnabled?(p(),m("div",Gg,[A(J,{name:"lock",size:13,class:"mr-1 inline"}),c[97]||(c[97]=z("OpenWeather is turned off for your organization",-1)),Xe.canEditOrg?(p(),m("span",qg,[...c[96]||(c[96]=[z(" — switch to ",-1),a("span",{class:"font-semibold"},"Organization",-1),z(" to turn it back on",-1)])])):I("",!0),c[98]||(c[98]=z(". ",-1))])):I("",!0),Ln.value?(p(),m("div",Yg,[A(J,{name:"users",size:13,class:"mr-1 inline"}),c[99]||(c[99]=z("These are organization-wide settings — they apply to everyone in ",-1)),a("span",Jg,w(t.organizationName||"your organization"),1),c[100]||(c[100]=z(". Leave the API key blank to let each user configure their own; a key set here overrides the user's. ",-1))])):Ri.value?(p(),m("div",Xg," As a superadmin you manage the global OpenWeather configuration in the API Server panel. The effective configuration is shown below. ")):I("",!0),A(xe,{title:"API key",desc:"Your OpenWeather API key (the appid parameter). Required — OpenWeather has no anonymous tier.",keywords:"api key appid secret credentials token openweather"},{default:ye(()=>[jt("apiKey")?(p(),m("span",Qg,[z(w(ze("apiKey").effective||"—")+" ",1),Je("apiKey")?(p(),m("span",ev,[A(J,{name:"lock",size:10}),z(w(Je("apiKey")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[25]||(c[25]=k=>Ht.apiKey=k),type:"password",class:"field w-64",placeholder:"••••••••"},null,512)),[[me,Ht.apiKey]])]),_:1}),A(xe,{title:"Units",desc:"Measurement system for temperatures and wind speed.",keywords:"units metric imperial standard celsius fahrenheit kelvin"},{default:ye(()=>[jt("units")?(p(),m("span",tv,[z(w((Ro.find(k=>k.value===ze("units").effective)||{}).label||ze("units").effective||"—")+" ",1),Je("units")?(p(),m("span",nv,[A(J,{name:"lock",size:10}),z(w(Je("units")),1)])):I("",!0)])):(p(),nt(wn,{key:1,modelValue:Ht.units,"onUpdate:modelValue":c[26]||(c[26]=k=>Ht.units=k),options:Ro},null,8,["modelValue"]))]),_:1}),A(xe,{title:"Default latitude",desc:"Latitude used by the health probe and calls with no location (−90…90).",keywords:"latitude location coordinates default"},{default:ye(()=>[jt("lat")?(p(),m("span",iv,[z(w(ze("lat").effective||"—")+" ",1),Je("lat")?(p(),m("span",ov,[A(J,{name:"lock",size:10}),z(w(Je("lat")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[27]||(c[27]=k=>Ht.lat=k),inputmode:"decimal",class:"field w-40 font-mono",placeholder:"52.2297"},null,512)),[[me,Ht.lat]])]),_:1}),A(xe,{title:"Default longitude",desc:"Longitude used by the health probe and calls with no location (−180…180).",keywords:"longitude location coordinates default"},{default:ye(()=>[jt("lon")?(p(),m("span",sv,[z(w(ze("lon").effective||"—")+" ",1),Je("lon")?(p(),m("span",av,[A(J,{name:"lock",size:10}),z(w(Je("lon")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[28]||(c[28]=k=>Ht.lon=k),inputmode:"decimal",class:"field w-40 font-mono",placeholder:"21.0122"},null,512)),[[me,Ht.lon]])]),_:1}),A(xe,{title:"Language",desc:"Optional ISO code for human-readable weather descriptions, e.g. en, pl, de.",keywords:"language locale description"},{default:ye(()=>[jt("lang")?(p(),m("span",rv,[z(w(ze("lang").effective||"—")+" ",1),Je("lang")?(p(),m("span",lv,[A(J,{name:"lock",size:10}),z(w(Je("lang")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[29]||(c[29]=k=>Ht.lang=k),class:"field w-24 font-mono",placeholder:"en"},null,512)),[[me,Ht.lang]])]),_:1}),A(xe,{title:"Calls per minute limit",desc:"Your plan's per-minute limit (free tier is 60). Only used to gauge app usage below. Leave blank to inherit; the app falls back to 60.",keywords:"calls per minute limit rate quota plan usage"},{default:ye(()=>[jt("callsPerMinute")?(p(),m("span",uv,[z(w(ze("callsPerMinute").effective||"60")+" ",1),Je("callsPerMinute")?(p(),m("span",cv,[A(J,{name:"lock",size:10}),z(w(Je("callsPerMinute")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[30]||(c[30]=k=>Ht.callsPerMinute=k),inputmode:"numeric",class:"field w-24 font-mono",placeholder:"60"},null,512)),[[me,Ht.callsPerMinute]])]),_:1}),Xe.available&&!Ln.value?(p(),m("div",dv,[a("div",fv,[a("div",hv,[A(J,{name:"signal",size:15}),c[101]||(c[101]=z("API call usage ",-1))]),Gn.value?(p(),m("span",pv,"Checked "+w(Uo()),1)):I("",!0)]),Ui.value?(p(),m(le,{key:0},[a("div",mv,[a("span",gv,w(Ui.value.minuteUsed),1),a("span",vv,"/ "+w(Ui.value.minuteLimit||"—")+" calls this minute",1)]),vs.value!=null?(p(),m("div",_v,[a("div",{class:Ce(["h-full rounded-full transition-all",fa.value]),style:Eo({width:vs.value+"%"})},null,6)])):I("",!0),a("div",bv,w(Ui.value.dayUsed)+" calls today · counts only requests PilotVault makes with this key, since server start. OpenWeather does not report remaining quota — check your account dashboard for the authoritative total. ",1)],64)):(p(),m("div",yv,[...c[102]||(c[102]=[z(" Run ",-1),a("span",{class:"font-semibold text-ink-secondary"},"Test connection",-1),z(" below to record and show call usage. ",-1)])]))])):I("",!0),a("div",xv,[Ri.value?I("",!0):(p(),m("button",{key:0,class:"btn-accent",disabled:Di.value||!Xe.available,onClick:Ft},w(Di.value?"Saving…":Ln.value?"Save organization settings":"Save settings"),9,wv)),Ln.value?I("",!0):(p(),m("button",{key:1,class:"btn-ghost",disabled:Fi.value||!Xe.available,onClick:bi},w(Fi.value?"Testing…":"Test connection"),9,kv)),Kn.value?(p(),m("span",Sv,w(Kn.value),1)):I("",!0),Gn.value&&!Ln.value?(p(),m("span",Tv,"Checked "+w(Uo()),1)):I("",!0),Qt.value&&!Ln.value?(p(),m("span",{key:4,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",da(Qt.value.status)])},[c[103]||(c[103]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Qt.value.detail||Qt.value.status),1)],2)):I("",!0)])])],64)):I("",!0),Hi("drives-external")?(p(),m(le,{key:2},[a("div",Pv,[a("div",Cv,[a("div",Lv,[A(J,{name:"server",size:20})]),c[104]||(c[104]=a("div",{class:"min-w-0"},[a("div",{class:"text-sm font-semibold text-ink"},"File Transfer (FTP / SFTP)"),a("div",{class:"mt-0.5 text-xs text-ink-muted"}," Connect to an FTP, FTPS or SFTP server. Configure the connection your account uses for file transfers. ")],-1))]),at.loaded&&!at.available?(p(),m("div",Av,[A(J,{name:"lock",size:14,class:"mr-1 inline"}),c[105]||(c[105]=z(" File transfer is currently disabled by your administrator. Contact them to enable it. ",-1))])):I("",!0),at.canEditOrg?(p(),m("div",Mv,[c[106]||(c[106]=a("div",{class:"text-xs text-ink-muted"},"Manage your own settings, or organization-wide settings that apply to every user.",-1)),A(wn,{modelValue:Sn.value,"onUpdate:modelValue":c[31]||(c[31]=k=>Sn.value=k),options:Pt},null,8,["modelValue"])])):I("",!0),St.value?(p(),nt(xe,{key:2,title:"Enable file transfer (organization-wide)",desc:"Turn it on or off for everyone in your organization.",keywords:"enable disable plugin ftp sftp organization"},{default:ye(()=>[A(nn,{"model-value":at.orgEnabled,disabled:!at.available,"onUpdate:modelValue":ra},null,8,["model-value","disabled"])]),_:1})):(p(),nt(xe,{key:3,title:"Enable file transfer",desc:"Turn the plugin on for your account in the Web App.",keywords:"enable disable plugin ftp sftp"},{default:ye(()=>[A(nn,{"model-value":at.enabled,disabled:!at.available||!at.orgEnabled,"onUpdate:modelValue":ra},null,8,["model-value","disabled"])]),_:1})),!St.value&&at.available&&!at.orgEnabled?(p(),m("div",Ev,[A(J,{name:"lock",size:13,class:"mr-1 inline"}),c[108]||(c[108]=z("File transfer is turned off for your organization",-1)),at.canEditOrg?(p(),m("span",Ov,[...c[107]||(c[107]=[z(" — switch to ",-1),a("span",{class:"font-semibold"},"Organization",-1),z(" to turn it back on",-1)])])):I("",!0),c[109]||(c[109]=z(". ",-1))])):I("",!0),St.value?(p(),m("div",zv,[A(J,{name:"users",size:13,class:"mr-1 inline"}),c[110]||(c[110]=z("These are organization-wide settings — they apply to everyone in ",-1)),a("span",$v,w(t.organizationName||"your organization"),1),c[111]||(c[111]=z(". Leave the connection blank to let each user configure their own; a connection set here overrides the user's. ",-1))])):Me.value?(p(),m("div",Iv," As a superadmin you manage the global file-transfer configuration in the API Server panel. The effective configuration is shown below. ")):I("",!0),A(xe,{title:"Protocol",desc:"SFTP (over SSH), FTPS (FTP over TLS), or plain FTP.",keywords:"protocol sftp ftps ftp"},{default:ye(()=>[_t("protocol")?(p(),m("span",Nv,[z(w(oa(Z("protocol").effective))+" ",1),bt("protocol")?(p(),m("span",Dv,[A(J,{name:"lock",size:10}),z(w(bt("protocol")),1)])):I("",!0)])):(p(),nt(wn,{key:1,modelValue:rt.protocol,"onUpdate:modelValue":c[32]||(c[32]=k=>rt.protocol=k),options:U},null,8,["modelValue"]))]),_:1}),A(xe,{title:"Host",desc:"Server hostname or IP address.",keywords:"host server address"},{default:ye(()=>[_t("host")?(p(),m("span",Fv,[z(w(Z("host").effective||"—")+" ",1),bt("host")?(p(),m("span",Rv,[A(J,{name:"lock",size:10}),z(w(bt("host")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[33]||(c[33]=k=>rt.host=k),class:"field w-64",placeholder:"files.example.com"},null,512)),[[me,rt.host]])]),_:1}),A(xe,{title:"Port",desc:"Leave blank for the protocol default (22 for SFTP, 21 for FTP/FTPS).",keywords:"port"},{default:ye(()=>[_t("port")?(p(),m("span",Bv,[z(w(Z("port").effective||"default")+" ",1),bt("port")?(p(),m("span",Uv,[A(J,{name:"lock",size:10}),z(w(bt("port")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[34]||(c[34]=k=>rt.port=k),inputmode:"numeric",class:"field w-24 font-mono",placeholder:"22"},null,512)),[[me,rt.port]])]),_:1}),A(xe,{title:"Username",desc:"Account used to authenticate.",keywords:"username login account"},{default:ye(()=>[_t("username")?(p(),m("span",Vv,[z(w(Z("username").effective||"—")+" ",1),bt("username")?(p(),m("span",Zv,[A(J,{name:"lock",size:10}),z(w(bt("username")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[35]||(c[35]=k=>rt.username=k),class:"field w-64",placeholder:"user"},null,512)),[[me,rt.username]])]),_:1}),A(xe,{title:"Password",desc:"Password auth for FTP/FTPS, or SFTP password login. Leave blank to use a key.",keywords:"password secret credentials"},{default:ye(()=>[_t("password")?(p(),m("span",Hv,[z(w(Z("password").effective||"—")+" ",1),bt("password")?(p(),m("span",jv,[A(J,{name:"lock",size:10}),z(w(bt("password")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[36]||(c[36]=k=>rt.password=k),type:"password",class:"field w-64",placeholder:"••••••••"},null,512)),[[me,rt.password]])]),_:1}),Et.value==="sftp"?(p(),nt(xe,{key:7,block:"",title:"SSH private key",desc:"PEM key for SFTP key auth — used instead of, or alongside, a password.",keywords:"private key ssh pem identity"},{default:ye(()=>[_t("privateKey")?(p(),m("span",Wv,[z(w(Z("privateKey").effective||"—")+" ",1),bt("privateKey")?(p(),m("span",Kv,[A(J,{name:"lock",size:10}),z(w(bt("privateKey")),1)])):I("",!0)])):ie((p(),m("textarea",{key:1,"onUpdate:modelValue":c[37]||(c[37]=k=>rt.privateKey=k),rows:"3",class:"field w-full font-mono text-xs",placeholder:"-----BEGIN OPENSSH PRIVATE KEY-----"},null,512)),[[me,rt.privateKey]])]),_:1})):I("",!0),Et.value==="sftp"?(p(),nt(xe,{key:8,title:"Private key passphrase",desc:"Passphrase protecting the SSH private key, if any.",keywords:"passphrase key secret"},{default:ye(()=>[_t("keyPassphrase")?(p(),m("span",Gv,[z(w(Z("keyPassphrase").effective||"—")+" ",1),bt("keyPassphrase")?(p(),m("span",qv,[A(J,{name:"lock",size:10}),z(w(bt("keyPassphrase")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[38]||(c[38]=k=>rt.keyPassphrase=k),type:"password",class:"field w-64",placeholder:"••••••••"},null,512)),[[me,rt.keyPassphrase]])]),_:1})):I("",!0),Et.value==="sftp"?(p(),nt(xe,{key:9,title:"Host key fingerprint",desc:"Optional SHA256:… fingerprint to pin the server's host key. Blank accepts any key.",keywords:"host key fingerprint verify trust"},{default:ye(()=>[_t("hostKeyFingerprint")?(p(),m("span",Yv,[z(w(Z("hostKeyFingerprint").effective||"—")+" ",1),bt("hostKeyFingerprint")?(p(),m("span",Jv,[A(J,{name:"lock",size:10}),z(w(bt("hostKeyFingerprint")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[39]||(c[39]=k=>rt.hostKeyFingerprint=k),class:"field w-full font-mono text-xs",placeholder:"SHA256:…"},null,512)),[[me,rt.hostKeyFingerprint]])]),_:1})):I("",!0),Et.value==="ftps"?(p(),nt(xe,{key:10,title:"TLS verification",desc:"Skip only for self-signed test servers.",keywords:"tls certificate verify insecure ftps"},{default:ye(()=>[_t("insecureSkipVerify")?(p(),m("span",Xv,[z(w(Z("insecureSkipVerify").effective==="true"?"Skip verification":"Verify certificate")+" ",1),bt("insecureSkipVerify")?(p(),m("span",Qv,[A(J,{name:"lock",size:10}),z(w(bt("insecureSkipVerify")),1)])):I("",!0)])):(p(),nt(wn,{key:1,modelValue:rt.insecureSkipVerify,"onUpdate:modelValue":c[40]||(c[40]=k=>rt.insecureSkipVerify=k),options:E},null,8,["modelValue"]))]),_:1})):I("",!0),A(xe,{title:"Base path",desc:"Working directory and health-check target, e.g. /uploads.",keywords:"base path directory folder root"},{default:ye(()=>[_t("basePath")?(p(),m("span",e_,[z(w(Z("basePath").effective||"—")+" ",1),bt("basePath")?(p(),m("span",t_,[A(J,{name:"lock",size:10}),z(w(bt("basePath")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[41]||(c[41]=k=>rt.basePath=k),class:"field w-64 font-mono",placeholder:"/uploads"},null,512)),[[me,rt.basePath]])]),_:1}),a("div",n_,[Me.value?I("",!0):(p(),m("button",{key:0,class:"btn-accent",disabled:pi.value||!at.available,onClick:or},w(pi.value?"Saving…":St.value?"Save organization settings":"Save settings"),9,i_)),St.value?I("",!0):(p(),m("button",{key:1,class:"btn-ghost",disabled:Ii.value||!at.available,onClick:sr},w(Ii.value?"Testing…":"Test connection"),9,o_)),hi.value?(p(),m("span",s_,w(hi.value),1)):I("",!0),jn.value&&!St.value?(p(),m("span",a_,"Checked "+w(sa()),1)):I("",!0),Gt.value&&!St.value?(p(),m("span",{key:4,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",la(Gt.value.status)])},[c[112]||(c[112]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Gt.value.detail||Gt.value.status),1)],2)):I("",!0)])]),a("div",r_,[a("div",l_,[a("div",u_,[A(J,{name:"cloud",size:20})]),c[113]||(c[113]=a("div",{class:"min-w-0"},[a("div",{class:"text-sm font-semibold text-ink"},"WebDAV"),a("div",{class:"mt-0.5 text-xs text-ink-muted"}," Connect to a WebDAV server (Nextcloud, ownCloud, IIS, …). Configure the connection your account uses. ")],-1))]),lt.loaded&&!lt.available?(p(),m("div",c_,[A(J,{name:"lock",size:14,class:"mr-1 inline"}),c[114]||(c[114]=z(" WebDAV is currently disabled by your administrator. Contact them to enable it. ",-1))])):I("",!0),lt.canEditOrg?(p(),m("div",d_,[c[115]||(c[115]=a("div",{class:"text-xs text-ink-muted"},"Manage your own settings, or organization-wide settings that apply to every user.",-1)),A(wn,{modelValue:Wn.value,"onUpdate:modelValue":c[42]||(c[42]=k=>Wn.value=k),options:Pt},null,8,["modelValue"])])):I("",!0),ot.value?(p(),nt(xe,{key:2,title:"Enable WebDAV (organization-wide)",desc:"Turn it on or off for everyone in your organization.",keywords:"enable disable plugin webdav organization"},{default:ye(()=>[A(nn,{"model-value":lt.orgEnabled,disabled:!lt.available,"onUpdate:modelValue":ca},null,8,["model-value","disabled"])]),_:1})):(p(),nt(xe,{key:3,title:"Enable WebDAV",desc:"Turn the plugin on for your account in the Web App.",keywords:"enable disable plugin webdav"},{default:ye(()=>[A(nn,{"model-value":lt.enabled,disabled:!lt.available||!lt.orgEnabled,"onUpdate:modelValue":ca},null,8,["model-value","disabled"])]),_:1})),!ot.value&<.available&&!lt.orgEnabled?(p(),m("div",f_,[A(J,{name:"lock",size:13,class:"mr-1 inline"}),c[117]||(c[117]=z("WebDAV is turned off for your organization",-1)),lt.canEditOrg?(p(),m("span",h_,[...c[116]||(c[116]=[z(" — switch to ",-1),a("span",{class:"font-semibold"},"Organization",-1),z(" to turn it back on",-1)])])):I("",!0),c[118]||(c[118]=z(". ",-1))])):I("",!0),ot.value?(p(),m("div",p_,[A(J,{name:"users",size:13,class:"mr-1 inline"}),c[119]||(c[119]=z("These are organization-wide settings — they apply to everyone in ",-1)),a("span",m_,w(t.organizationName||"your organization"),1),c[120]||(c[120]=z(". Leave the connection blank to let each user configure their own; a connection set here overrides the user's. ",-1))])):Io.value?(p(),m("div",g_," As a superadmin you manage the global WebDAV configuration in the API Server panel. The effective configuration is shown below. ")):I("",!0),A(xe,{block:"",title:"Server URL",desc:"WebDAV endpoint including scheme, e.g. https://cloud.example.com/remote.php/dav/files/alice/.",keywords:"url server address endpoint webdav host"},{default:ye(()=>[Cn("baseURL")?(p(),m("span",v_,[z(w(Pn("baseURL").effective||"—")+" ",1),qt("baseURL")?(p(),m("span",__,[A(J,{name:"lock",size:10}),z(w(qt("baseURL")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[43]||(c[43]=k=>Xt.baseURL=k),class:"field w-full font-mono text-xs",placeholder:"https://cloud.example.com/remote.php/dav/files/alice/"},null,512)),[[me,Xt.baseURL]])]),_:1}),A(xe,{title:"Username",desc:"Account used to authenticate (leave blank for a public share).",keywords:"username login account"},{default:ye(()=>[Cn("username")?(p(),m("span",b_,[z(w(Pn("username").effective||"—")+" ",1),qt("username")?(p(),m("span",y_,[A(J,{name:"lock",size:10}),z(w(qt("username")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[44]||(c[44]=k=>Xt.username=k),class:"field w-64",placeholder:"user"},null,512)),[[me,Xt.username]])]),_:1}),A(xe,{title:"Password",desc:"Password or app-specific token for HTTP Basic auth.",keywords:"password secret credentials token"},{default:ye(()=>[Cn("password")?(p(),m("span",x_,[z(w(Pn("password").effective||"—")+" ",1),qt("password")?(p(),m("span",w_,[A(J,{name:"lock",size:10}),z(w(qt("password")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[45]||(c[45]=k=>Xt.password=k),type:"password",class:"field w-64",placeholder:"••••••••"},null,512)),[[me,Xt.password]])]),_:1}),A(xe,{title:"TLS verification",desc:"Only affects HTTPS. Skip only for self-signed test servers.",keywords:"tls certificate verify insecure https"},{default:ye(()=>[Cn("insecureSkipVerify")?(p(),m("span",k_,[z(w(Pn("insecureSkipVerify").effective==="true"?"Skip verification":"Verify certificate")+" ",1),qt("insecureSkipVerify")?(p(),m("span",S_,[A(J,{name:"lock",size:10}),z(w(qt("insecureSkipVerify")),1)])):I("",!0)])):(p(),nt(wn,{key:1,modelValue:Xt.insecureSkipVerify,"onUpdate:modelValue":c[46]||(c[46]=k=>Xt.insecureSkipVerify=k),options:ua},null,8,["modelValue"]))]),_:1}),A(xe,{title:"Base path",desc:"Working directory under the server URL and health-check target, e.g. /Documents.",keywords:"base path directory folder root"},{default:ye(()=>[Cn("basePath")?(p(),m("span",T_,[z(w(Pn("basePath").effective||"—")+" ",1),qt("basePath")?(p(),m("span",P_,[A(J,{name:"lock",size:10}),z(w(qt("basePath")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[47]||(c[47]=k=>Xt.basePath=k),class:"field w-64 font-mono",placeholder:"/Documents"},null,512)),[[me,Xt.basePath]])]),_:1}),a("div",C_,[Io.value?I("",!0):(p(),m("button",{key:0,class:"btn-accent",disabled:zo.value||!lt.available,onClick:Fo},w(zo.value?"Saving…":ot.value?"Save organization settings":"Save settings"),9,L_)),ot.value?I("",!0):(p(),m("button",{key:1,class:"btn-ghost",disabled:$o.value||!lt.available,onClick:gi},w($o.value?"Testing…":"Test connection"),9,A_)),io.value?(p(),m("span",M_,w(io.value),1)):I("",!0),$n.value&&!ot.value?(p(),m("span",E_,"Checked "+w(Lt()),1)):I("",!0),Tn.value&&!ot.value?(p(),m("span",{key:4,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",Mt(Tn.value.status)])},[c[121]||(c[121]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Tn.value.detail||Tn.value.status),1)],2)):I("",!0)])])],64)):I("",!0),Hi("drives-local")?(p(),m("div",O_,[a("div",z_,[a("div",$_,[A(J,{name:"monitor",size:20})]),c[122]||(c[122]=a("div",{class:"min-w-0"},[a("div",{class:"text-sm font-semibold text-ink"},"Local Storage"),a("div",{class:"mt-0.5 text-xs text-ink-muted"}," A private folder on the server for your files. Each user has their own; members of an organization share one. ")],-1))]),Ae.loaded&&!Ae.available?(p(),m("div",I_,[A(J,{name:"lock",size:14,class:"mr-1 inline"}),c[123]||(c[123]=z(" Local storage is currently disabled by your administrator. Contact them to enable it. ",-1))])):Ae.loaded&&!Ae.rootConfigured?(p(),m("div",N_,[A(J,{name:"alertTriangle",size:14,class:"mr-1 inline"}),c[124]||(c[124]=z(" No storage root has been configured by your administrator yet. ",-1))])):I("",!0),Ae.canEditOrg?(p(),m("div",D_,[c[125]||(c[125]=a("div",{class:"text-xs text-ink-muted"},"Manage your own settings, or organization-wide settings that apply to every user.",-1)),A(wn,{modelValue:Vi.value,"onUpdate:modelValue":c[48]||(c[48]=k=>Vi.value=k),options:Pt},null,8,["modelValue"])])):I("",!0),gn.value?(p(),nt(xe,{key:3,title:"Enable local storage (organization-wide)",desc:"Turn it on or off for everyone in your organization.",keywords:"enable disable plugin local storage folder organization"},{default:ye(()=>[A(nn,{"model-value":Ae.orgEnabled,disabled:!Ae.available,"onUpdate:modelValue":xs},null,8,["model-value","disabled"])]),_:1})):(p(),nt(xe,{key:4,title:"Enable local storage",desc:"Turn the plugin on for your account in the Web App.",keywords:"enable disable plugin local storage folder"},{default:ye(()=>[A(nn,{"model-value":Ae.enabled,disabled:!Ae.available||!Ae.orgEnabled,"onUpdate:modelValue":xs},null,8,["model-value","disabled"])]),_:1})),!gn.value&&Ae.available&&!Ae.orgEnabled?(p(),m("div",F_,[A(J,{name:"lock",size:13,class:"mr-1 inline"}),c[127]||(c[127]=z("Local storage is turned off for your organization",-1)),Ae.canEditOrg?(p(),m("span",R_,[...c[126]||(c[126]=[z(" — switch to ",-1),a("span",{class:"font-semibold"},"Organization",-1),z(" to turn it back on",-1)])])):I("",!0),c[128]||(c[128]=z(". ",-1))])):I("",!0),gn.value?(p(),m("div",B_,[A(J,{name:"users",size:13,class:"mr-1 inline"}),c[129]||(c[129]=z("These are organization-wide settings — they apply to everyone in ",-1)),a("span",U_,w(t.organizationName||"your organization"),1),c[130]||(c[130]=z(", who all share the organization folder. Members can additionally enable a private folder inside it. ",-1))])):_s.value?(p(),m("div",V_," As a superadmin you manage the global storage root in the API Server panel. The effective configuration is shown below. ")):I("",!0),gn.value?(p(),nt(xe,{key:8,title:"Private folders",desc:"Let members create a private folder inside the organization folder, reachable only by them.",keywords:"private folder members allow policy organization"},{default:ye(()=>[A(nn,{"model-value":Ae.allowPrivate,disabled:!Ae.available,"onUpdate:modelValue":ur},null,8,["model-value","disabled"])]),_:1})):I("",!0),gn.value?I("",!0):(p(),m(le,{key:9},[A(xe,{block:"",title:"Your folders",desc:"Assigned automatically and isolated — no one else can reach your private folder.",keywords:"folder directory path storage location isolated private shared"},{default:ye(()=>[a("div",Z_,[(p(!0),m(le,null,Ie(Ae.mounts,k=>(p(),m("div",{key:k.id,class:"flex flex-wrap items-center gap-2"},[a("span",H_,w(k.path),1),k.kind==="shared"?(p(),m("span",j_,[A(J,{name:"users",size:10}),c[131]||(c[131]=z("Shared with your organization",-1))])):(p(),m("span",W_,[A(J,{name:"lock",size:10}),c[132]||(c[132]=z("Private to you",-1))])),ao.value[k.id]?(p(),m("span",{key:2,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-semibold",va(ao.value[k.id].status)])},[c[133]||(c[133]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(ao.value[k.id].status),1)],2)):I("",!0)]))),128)),Ae.mounts.length?I("",!0):(p(),m("div",K_,w(Ae.rootConfigured?"No folder assigned yet.":"Waiting for the administrator to configure a storage root."),1))])]),_:1}),Ae.isOrgUser&&Ae.allowPrivate?(p(),nt(xe,{key:0,title:"My private folder",desc:"Add a private folder inside the organization folder, reachable only by you — you keep the shared folder too.",keywords:"private folder personal isolated organization inside"},{default:ye(()=>[A(nn,{"model-value":Ae.privateFolder,disabled:!Ae.available||!Ae.orgEnabled,"onUpdate:modelValue":ga},null,8,["model-value","disabled"])]),_:1})):Ae.isOrgUser&&!Ae.allowPrivate?(p(),m("div",G_,[A(J,{name:"lock",size:13,class:"mr-1 inline"}),c[134]||(c[134]=z("Private folders are turned off by your organization. ",-1))])):I("",!0)],64)),A(xe,{title:"Access mode",desc:"Read-only prevents uploads, deletes and folder creation.",keywords:"read only write access mode permission"},{default:ye(()=>[ha("readOnly")?(p(),m("span",q_,[z(w(rr(Zi("readOnly").effective))+" ",1),An("readOnly")?(p(),m("span",Y_,[A(J,{name:"lock",size:10}),z(w(An("readOnly")),1)])):I("",!0)])):(p(),nt(wn,{key:1,modelValue:so.value,"onUpdate:modelValue":c[49]||(c[49]=k=>so.value=k),options:Zo},null,8,["modelValue"]))]),_:1}),a("div",J_,[_s.value?I("",!0):(p(),m("button",{key:0,class:"btn-accent",disabled:Vo.value||!Ae.available,onClick:cr},w(Vo.value?"Saving…":gn.value?"Save organization settings":"Save settings"),9,X_)),gn.value?I("",!0):(p(),m("button",{key:1,class:"btn-ghost",disabled:en.value||!Ae.available,onClick:ws},w(en.value?"Testing…":"Test folder"),9,Q_)),qe.value?(p(),m("span",e1,w(qe.value),1)):I("",!0),yi.value&&!gn.value?(p(),m("span",t1,"Checked "+w(pa()),1)):I("",!0),ln.value&&!gn.value?(p(),m("span",{key:4,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",va(ln.value.status)])},[c[135]||(c[135]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(ln.value.detail||ln.value.status),1)],2)):I("",!0)])])):I("",!0)])):q.id==="profile"?(p(),m("div",n1,[A(xe,{block:"",title:"Profile photo",desc:"PNG or JPG, up to ~1.5 MB. Stored on this device.",keywords:"avatar photo picture"},{default:ye(()=>[a("div",i1,[Ee(be).avatar?(p(),m("img",{key:0,src:Ee(be).avatar,alt:"Avatar",class:"h-16 w-16 rounded-full object-cover"},null,8,o1)):(p(),m("div",s1,w(ba.value),1)),a("div",a1,[a("label",r1,[A(J,{name:"upload",size:15,class:"mr-1.5 inline"}),c[136]||(c[136]=z("Upload ",-1)),a("input",{type:"file",accept:"image/*",class:"hidden",onChange:fr},null,32)]),Ee(be).avatar?(p(),m("button",{key:0,class:"btn-ghost",onClick:hr},"Remove")):I("",!0)])])]),_:1}),A(xe,{title:"Display name",desc:"The name shown on your public profile.",keywords:"display name profile"},{default:ye(()=>[ie(a("input",{"onUpdate:modelValue":c[50]||(c[50]=k=>Ee(be).displayName=k),class:"field w-56",placeholder:"Jane O.",onBlur:c[51]||(c[51]=k=>We("Saved."))},null,544),[[me,Ee(be).displayName]])]),_:1}),A(xe,{block:"",title:"Bio",desc:"A short description others can see.",keywords:"bio about description"},{default:ye(()=>[ie(a("textarea",{"onUpdate:modelValue":c[52]||(c[52]=k=>Ee(be).bio=k),rows:"3",maxlength:"240",class:"field w-full resize-none",placeholder:"Flight director, North yard operations…",onBlur:c[53]||(c[53]=k=>We("Saved."))},null,544),[[me,Ee(be).bio]]),a("div",l1,w((Ee(be).bio||"").length)+"/240",1)]),_:1}),A(xe,{title:"Show email on profile",desc:"Let teammates see your email address.",keywords:"show email public visibility"},{default:ye(()=>[A(nn,{modelValue:Ee(be).showEmail,"onUpdate:modelValue":c[54]||(c[54]=k=>Ee(be).showEmail=k)},null,8,["modelValue"])]),_:1})])):q.id==="security"?(p(),m("div",u1,[A(xe,{block:"",title:"Two-factor authentication",desc:"Require a one-time code at sign-in.",keywords:"two factor 2fa authentication security"},{default:ye(()=>[a("div",c1,[a("span",{class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",Ee(be).twoFactor?"bg-success-soft text-success-fg":"bg-surface-2 text-ink-secondary"])},[c[137]||(c[137]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Ee(be).twoFactor?"Enabled":"Disabled"),1)],2),!Ee(be).twoFactor&&!lo.value?(p(),m("button",{key:0,class:"btn-accent",onClick:ji},"Enable 2FA")):Ee(be).twoFactor?(p(),m("button",{key:1,class:"btn-ghost",onClick:co},"Disable")):I("",!0)]),lo.value?(p(),m("div",d1,[a("div",f1,[c[139]||(c[139]=a("div",{class:"grid h-28 w-28 place-items-center rounded bg-white p-2"},[a("svg",{viewBox:"0 0 100 100",class:"h-full w-full"},[a("rect",{width:"100",height:"100",fill:"#fff"}),a("g",{fill:"#0F1E3D"},[a("rect",{x:"6",y:"6",width:"24",height:"24"}),a("rect",{x:"70",y:"6",width:"24",height:"24"}),a("rect",{x:"6",y:"70",width:"24",height:"24"}),a("rect",{x:"12",y:"12",width:"12",height:"12",fill:"#fff"}),a("rect",{x:"76",y:"12",width:"12",height:"12",fill:"#fff"}),a("rect",{x:"12",y:"76",width:"12",height:"12",fill:"#fff"}),a("rect",{x:"40",y:"10",width:"8",height:"8"}),a("rect",{x:"52",y:"20",width:"8",height:"8"}),a("rect",{x:"40",y:"40",width:"8",height:"8"}),a("rect",{x:"60",y:"44",width:"8",height:"8"}),a("rect",{x:"44",y:"60",width:"8",height:"8"}),a("rect",{x:"70",y:"60",width:"8",height:"8"}),a("rect",{x:"80",y:"72",width:"8",height:"8"}),a("rect",{x:"60",y:"80",width:"8",height:"8"})])])],-1)),a("div",h1,[c[138]||(c[138]=a("div",{class:"text-xs text-ink-secondary"},"Scan with an authenticator app, or enter this secret:",-1)),a("div",p1,w(_n.value),1),a("div",m1,[ie(a("input",{"onUpdate:modelValue":c[55]||(c[55]=k=>qn.value=k),inputmode:"numeric",maxlength:"6",class:"field w-28 font-mono tracking-[0.3em]",placeholder:"000000"},null,512),[[me,qn.value]]),a("button",{class:"btn-accent",onClick:pr},"Verify & enable")]),uo.value?(p(),m("p",g1,w(uo.value),1)):I("",!0)])])])):I("",!0),Ee(be).twoFactor&&bn.value.length?(p(),m("div",v1,[c[140]||(c[140]=a("div",{class:"text-xs font-semibold text-ink"},"Recovery codes",-1)),c[141]||(c[141]=a("div",{class:"mt-0.5 text-xs text-ink-muted"},"Store these somewhere safe — each works once.",-1)),a("div",_1,[(p(!0),m(le,null,Ie(bn.value,k=>(p(),m("span",{key:k,class:"select-all"},w(k),1))),128))])])):I("",!0),c[142]||(c[142]=a("p",{class:"mt-2 text-xs text-ink-muted"},"Prototype — codes are generated locally until the account service verifies them.",-1))]),_:1}),A(xe,{block:"",title:"Active sessions",desc:"Devices currently signed in to your account.",keywords:"sessions devices logout sign out remote"},{default:ye(()=>[a("div",b1,[a("div",y1,[a("div",x1,[A(J,{name:"monitor",size:18})]),a("div",w1,[a("div",k1,[z(w(Wo())+" on "+w(mr())+" ",1),c[143]||(c[143]=a("span",{class:"ml-1 rounded-full bg-success-soft px-2 py-0.5 text-[10px] font-semibold text-success-fg"},"This device",-1))]),a("div",S1,"Signed in "+w(Ee(Su)(Ee(ti))),1)]),a("button",{class:"btn-ghost",onClick:c[56]||(c[56]=k=>l("logout"))},"Log out")])]),c[144]||(c[144]=a("button",{class:"btn-ghost mt-2 opacity-60",disabled:"",title:"Requires the account service"}," Log out all other devices ",-1)),c[145]||(c[145]=a("p",{class:"mt-2 text-xs text-ink-muted"}," Only this session is visible from the browser; enumerating and revoking remote sessions needs the account service. ",-1))]),_:1})])):q.id==="team"?(p(),m("div",T1,[Qe.id?(p(),m("div",P1,[A(xe,{block:"",title:`Edit user — ${Qe.email}`,desc:"Update details, change role, reset password, or set verified.",keywords:"edit user update role password verified organization"},{default:ye(()=>[a("div",C1,[a("div",L1,[ie(a("input",{"onUpdate:modelValue":c[57]||(c[57]=k=>Qe.email=k),type:"email",class:"field flex-1",placeholder:"name@pilotvault.local"},null,512),[[me,Qe.email]]),ie(a("select",{"onUpdate:modelValue":c[58]||(c[58]=k=>Qe.role=k),class:"field w-32",disabled:qo.value,title:qo.value?"You cannot change your own role":""},[(p(!0),m(le,null,Ie(ya.value,k=>(p(),m("option",{key:k.value,value:k.value},w(k.label),9,M1))),128))],8,A1),[[Ot,Qe.role]])]),u.value?ie((p(),m("select",{key:0,"onUpdate:modelValue":c[59]||(c[59]=k=>Qe.organization=k),class:"field",title:"Organization"},[(p(!0),m(le,null,Ie(Cs.value,k=>(p(),m("option",{key:k.value,value:k.value},w(k.label),9,E1))),128))],512)),[[Ot,Qe.organization]]):I("",!0),ie(a("input",{"onUpdate:modelValue":c[60]||(c[60]=k=>Qe.password=k),type:"password",class:"field",placeholder:"New password (leave blank to keep current)"},null,512),[[me,Qe.password]]),a("label",O1,[A(nn,{modelValue:Qe.verified,"onUpdate:modelValue":c[61]||(c[61]=k=>Qe.verified=k)},null,8,["modelValue"]),c[146]||(c[146]=z(" Email verified ",-1))]),a("div",z1,[a("button",{class:"btn-accent",disabled:Ki.value,onClick:vr},w(Ki.value?"Saving…":"Save changes"),9,$1),a("button",{class:"btn-ghost",onClick:ho},"Cancel"),En.value?(p(),m("span",I1,w(En.value),1)):I("",!0),qo.value?(p(),m("span",N1,"Editing your own account — role locked.")):I("",!0)])])]),_:1},8,["title"])])):(p(),m("div",D1,[A(xe,{block:"",title:"Add user",desc:"Create a new account. Admins add users within their organization; superadmins can target any.",keywords:"add user create account role admin organization"},{default:ye(()=>[a("div",F1,[a("div",R1,[ie(a("input",{"onUpdate:modelValue":c[62]||(c[62]=k=>Rt.email=k),type:"email",class:"field flex-1",placeholder:"name@pilotvault.local"},null,512),[[me,Rt.email]]),ie(a("select",{"onUpdate:modelValue":c[63]||(c[63]=k=>Rt.role=k),class:"field w-32"},[(p(!0),m(le,null,Ie(ya.value,k=>(p(),m("option",{key:k.value,value:k.value},w(k.label),9,B1))),128))],512),[[Ot,Rt.role]])]),u.value?ie((p(),m("select",{key:0,"onUpdate:modelValue":c[64]||(c[64]=k=>Rt.organization=k),class:"field",title:"Organization"},[(p(!0),m(le,null,Ie(Cs.value,k=>(p(),m("option",{key:k.value,value:k.value},w(k.label),9,U1))),128))],512)),[[Ot,Rt.organization]]):(p(),m("div",V1,[c[147]||(c[147]=z(" New users join your organization: ",-1)),a("span",Z1,w(t.organizationName||"—"),1)])),ie(a("input",{"onUpdate:modelValue":c[65]||(c[65]=k=>Rt.password=k),type:"password",class:"field",placeholder:"Temporary password (min 8 chars)"},null,512),[[me,Rt.password]]),a("div",H1,[a("button",{class:"btn-accent",disabled:Ko.value,onClick:Ls},w(Ko.value?"Creating…":"Create user"),9,j1),tn.value?(p(),m("span",W1,w(tn.value),1)):I("",!0)])])]),_:1})])),a("div",K1,[a("div",G1,[c[148]||(c[148]=a("div",null,[a("div",{class:"eyebrow"},"Team"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"All users")],-1)),a("button",{class:"btn-ghost",disabled:fo.value,onClick:ii},w(fo.value?"Loading…":"Refresh"),9,q1)]),Wi.value?(p(),m("div",Y1,w(Wi.value),1)):!wi.value.length&&!fo.value?(p(),m("div",J1,"No users yet.")):(p(),m("div",X1,[a("table",Q1,[a("thead",null,[a("tr",eb,[(p(),m(le,null,Ie(["User","Role","Organization","Status",""],k=>a("th",{key:k,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},w(k),1)),64))])]),a("tbody",null,[(p(!0),m(le,null,Ie(wi.value,k=>(p(),m("tr",{key:k.id,class:Ce(["border-b border-line last:border-0",Qe.id===k.id?"bg-accent-soft":""])},[a("td",tb,[a("span",nb,w(k.email),1),k.email===t.email?(p(),m("span",ib,"(you)")):I("",!0)]),a("td",ob,[a("span",{class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",y(k.role||"user")])},[A(J,{name:_(k.role||"user"),size:12},null,8,["name"]),z(w(h(k.role||"user")),1)],2)]),a("td",sb,[a("span",{class:Ce(["text-sm",k.organizationName?"text-ink-secondary":"text-ink-muted"])},w(k.organizationName||"—"),3)]),a("td",ab,[a("span",{class:Ce(["text-xs",k.verified?"text-success-fg":"text-ink-muted"])},w(k.verified?"Verified":"Unverified"),3)]),a("td",rb,[Dn.value===k.id?(p(),m(le,{key:0},[c[149]||(c[149]=a("span",{class:"mr-2 text-xs text-ink-muted"},"Remove?",-1)),a("button",{class:"btn-ghost mr-1",onClick:c[66]||(c[66]=Be=>Dn.value="")},"Cancel"),a("button",{class:"rounded bg-danger px-3 py-1.5 text-sm font-semibold text-white transition hover:brightness-110",onClick:Be=>Go(k)}," Remove ",8,lb)],64)):(p(),m("div",ub,[a("button",{class:"btn-ghost inline-flex items-center gap-1.5",onClick:Be=>gr(k)},[A(J,{name:"settings",size:14}),c[150]||(c[150]=z(" Edit ",-1))],8,cb),k.email!==t.email?(p(),m("button",{key:0,class:"btn-ghost inline-flex items-center gap-1.5",onClick:Be=>Dn.value=k.id},[A(J,{name:"trash",size:14}),c[151]||(c[151]=z(" Remove ",-1))],8,db)):I("",!0)]))])],2))),128))])])]))])])):q.id==="organizations"?(p(),m("div",fb,[Nt.id?(p(),m("div",hb,[A(xe,{block:"",title:"Rename organization",desc:"Update the organization's display name.",keywords:"rename organization edit"},{default:ye(()=>[a("div",pb,[ie(a("input",{"onUpdate:modelValue":c[67]||(c[67]=k=>Nt.name=k),class:"field",placeholder:"Organization name",onKeyup:pu(xa,["enter"])},null,544),[[me,Nt.name]]),a("div",mb,[a("button",{class:"btn-accent",onClick:xa},"Save changes"),a("button",{class:"btn-ghost",onClick:Ms},"Cancel"),Fn.value?(p(),m("span",gb,w(Fn.value),1)):I("",!0)])])]),_:1})])):(p(),m("div",vb,[A(xe,{block:"",title:"Add organization",desc:"Create a new organization. Assign admins and users to it from User management.",keywords:"add organization create tenant company"},{default:ye(()=>[a("div",_b,[ie(a("input",{"onUpdate:modelValue":c[68]||(c[68]=k=>po.name=k),class:"field",placeholder:"e.g. Northwind Aerial",onKeyup:pu(_o,["enter"])},null,544),[[me,po.name]]),a("div",bb,[a("button",{class:"btn-accent",disabled:go.value,onClick:_o},w(go.value?"Creating…":"Create organization"),9,yb),mo.value?(p(),m("span",xb,w(mo.value),1)):I("",!0)])])]),_:1})])),a("div",wb,[a("div",{class:"flex items-center justify-between px-5 py-4"},[c[152]||(c[152]=a("div",null,[a("div",{class:"eyebrow"},"Tenancy"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"All organizations")],-1)),a("button",{class:"btn-ghost",onClick:ni},"Refresh")]),yn.value.length?(p(),m("div",Sb,[a("table",Tb,[a("thead",null,[a("tr",Pb,[(p(),m(le,null,Ie(["Organization","Members",""],k=>a("th",{key:k,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},w(k),1)),64))])]),a("tbody",null,[(p(!0),m(le,null,Ie(yn.value,k=>(p(),m("tr",{key:k.id,class:Ce(["border-b border-line last:border-0",Nt.id===k.id?"bg-accent-soft":""])},[a("td",Cb,[a("span",Lb,[A(J,{name:"grid",size:14,class:"text-ink-muted"}),z(w(k.name),1)])]),a("td",Ab,w(As.value[k.id]||0),1),a("td",Mb,[vo.value===k.id?(p(),m(le,{key:0},[c[153]||(c[153]=a("span",{class:"mr-2 text-xs text-ink-muted"},"Delete?",-1)),a("button",{class:"btn-ghost mr-1",onClick:c[69]||(c[69]=Be=>vo.value="")},"Cancel"),a("button",{class:"rounded bg-danger px-3 py-1.5 text-sm font-semibold text-white transition hover:brightness-110",onClick:Be=>bo(k)}," Delete ",8,Eb)],64)):(p(),m("div",Ob,[a("button",{class:"btn-ghost inline-flex items-center gap-1.5",onClick:Be=>_r(k)},[A(J,{name:"settings",size:14}),c[154]||(c[154]=z(" Rename ",-1))],8,zb),a("button",{class:"btn-ghost inline-flex items-center gap-1.5",disabled:(As.value[k.id]||0)>0,title:(As.value[k.id]||0)>0?"Reassign or remove members first":"",onClick:Be=>vo.value=k.id},[A(J,{name:"trash",size:14}),c[155]||(c[155]=z(" Delete ",-1))],8,$b)]))])],2))),128))])])])):(p(),m("div",kb,"No organizations yet."))])])):q.id==="advanced"?(p(),m("div",Ib,[a("div",Nb,[A(xe,{title:"Export data",desc:"Download your settings and profile as JSON.",keywords:"export data download backup"},{default:ye(()=>[a("button",{class:"btn-ghost",onClick:br},[A(J,{name:"download",size:15,class:"mr-1.5 inline"}),c[156]||(c[156]=z("Export",-1))])]),_:1}),A(xe,{block:"",title:"Import data",desc:"Restore settings from a previous export.",keywords:"import data upload restore"},{default:ye(()=>[a("label",Db,[A(J,{name:"upload",size:15,class:"mr-1.5 inline"}),c[157]||(c[157]=z("Choose file… ",-1)),a("input",{type:"file",accept:"application/json,.json",class:"hidden",onChange:wa},null,32)]),Yn.value?(p(),m("p",Fb,w(Yn.value),1)):I("",!0)]),_:1})]),a("div",Rb,[a("div",Bb,[A(J,{name:"alertTriangle",size:18}),c[158]||(c[158]=a("h3",{class:"text-sm font-bold uppercase tracking-caps"},"Danger zone",-1))]),c[163]||(c[163]=a("p",{class:"mt-1 text-xs text-ink-secondary"},"Deleting your account is permanent and cannot be undone.",-1)),a("div",Ub,[c[162]||(c[162]=a("div",{class:"text-sm font-semibold text-ink"},"Delete account",-1)),a("label",Vb,[ie(a("input",{"onUpdate:modelValue":c[70]||(c[70]=k=>mt.understand=k),type:"checkbox",class:"mt-0.5 h-4 w-4 accent-[var(--danger)]"},null,512),[[Va,mt.understand]]),c[159]||(c[159]=z(" I understand this permanently deletes my account and all associated data. ",-1))]),a("div",Zb,[a("label",Hb,[c[160]||(c[160]=z("Type ",-1)),a("span",jb,w(On.value),1),c[161]||(c[161]=z(" to confirm",-1))]),ie(a("input",{"onUpdate:modelValue":c[71]||(c[71]=k=>mt.typed=k),class:"field w-full max-w-[360px] font-mono",placeholder:On.value},null,8,Wb),[[me,mt.typed]])]),a("div",Kb,[mt.armed?(p(),m("button",{key:1,class:"rounded bg-danger px-4 py-2.5 text-sm font-semibold text-white transition enabled:hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-50",disabled:mt.cooldown>0,onClick:xo},w(mt.cooldown>0?`Confirm in ${mt.cooldown}s…`:"Permanently delete account"),9,qb)):(p(),m("button",{key:0,class:"rounded bg-danger px-4 py-2.5 text-sm font-semibold text-white transition enabled:hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-40",disabled:!Yo.value,onClick:ka}," Delete account… ",8,Gb)),mt.armed&&mt.cooldown>0?(p(),m("span",Yb,"Cooling-off period — read once more.")):I("",!0)]),mt.msg?(p(),m("p",Jb,w(mt.msg),1)):I("",!0)])])])):I("",!0)],64))),128))])]),A(vh,{name:"fade"},{default:ye(()=>[Nn.value?(p(),m("div",Xb,[A(J,{name:"check",size:16,class:"text-success-fg"}),z(w(Nn.value),1)])):I("",!0)]),_:1})]))}},ey=Pm(Qb,[["__scopeId","data-v-7522b856"]]),ty={class:"mx-auto flex max-w-[1240px] flex-col gap-5 p-7"},ny={class:"flex flex-wrap items-center gap-3"},iy={class:"ml-auto flex items-center gap-2"},oy=["href"],sy={class:"grid grid-cols-3 gap-4 max-[900px]:grid-cols-1"},ay={class:"eyebrow"},ry={key:0,class:"panel border-danger/40 p-4 text-sm text-danger-fg"},ly={key:1,class:"panel p-5"},uy={class:"mb-4 flex items-center justify-between"},cy={class:"eyebrow"},dy={class:"grid grid-cols-3 gap-3 max-[760px]:grid-cols-1"},fy={class:"block"},hy={class:"block"},py={class:"block"},my={class:"block"},gy={key:0,value:""},vy=["value"],_y={class:"block"},by={class:"block"},yy={class:"block"},xy={class:"block"},wy={class:"block"},ky=["value"],Sy={class:"block"},Ty=["value"],Py={class:"block"},Cy=["value"],Ly={class:"block"},Ay={class:"mt-3 block"},My={key:0,class:"mt-3 grid grid-cols-2 gap-3 max-[760px]:grid-cols-1"},Ey={class:"block"},Oy={class:"block"},zy={class:"block"},$y={class:"block"},Iy={class:"col-span-2 block max-[760px]:col-span-1"},Ny={class:"mt-4 flex items-center gap-3"},Dy=["disabled"],Fy={key:0,class:"text-sm text-danger-fg"},Ry={class:"panel overflow-hidden p-0"},By={key:0,class:"px-5 py-12 text-center text-sm text-ink-muted"},Uy={key:1,class:"grid place-items-center px-5 py-16 text-center"},Vy={key:2,class:"overflow-x-auto"},Zy={class:"w-full border-collapse text-sm"},Hy={class:"text-left"},jy={class:"whitespace-nowrap px-5 py-3 font-mono text-ink"},Wy={key:0,class:"text-ink-muted"},Ky={class:"px-5 py-3 text-ink-secondary"},Gy=["title"],qy={class:"px-5 py-3 font-mono text-ink-secondary"},Yy={class:"px-5 py-3 text-ink-secondary"},Jy={class:"px-5 py-3"},Xy=["onClick"],Qy={class:"whitespace-nowrap px-5 py-3 text-right"},ex=["onClick"],tx=["onClick"],nx=["onClick"],ix={key:0,class:"border-b border-line bg-surface-2"},ox={colspan:"7",class:"px-5 py-3"},sx={class:"flex flex-wrap gap-x-8 gap-y-1.5 text-xs"},ax={class:"text-ink-secondary"},rx={class:"text-ink"},lx={class:"text-ink-secondary"},ux={class:"text-ink"},cx={class:"text-ink-secondary"},dx={class:"font-mono text-ink"},fx={key:0,class:"text-ink-secondary"},hx={class:"text-ink"},px={key:0,class:"mt-2 space-y-1"},mx={key:1,class:"mt-2 text-xs text-success-fg"},gx={__name:"Logbook",props:{email:{type:String,default:""},role:{type:String,default:"user"},organization:{type:String,default:""},organizationName:{type:String,default:""}},setup(t){const i=t,s={success:"bg-success-soft text-success-fg",danger:"bg-danger-soft text-danger-fg",neutral:"bg-surface-2 text-ink-secondary"},l=Y([]),u=Y([]),f=Y(!1),h=Y("");async function _(){f.value=!0,h.value="";const[O,N]=await Promise.all([pl(),Ap()]);(!O.ok||!N.ok)&&(h.value=O.status===503||N.status===503?"Logbook storage is not configured on the API Server (service account missing).":"Could not load the logbook."),l.value=O.drones,u.value=N.flights,f.value=!1}fi(_);function y(O){const N=O.compliance||{};return N.exempt?{tone:"neutral",label:"Exempt"}:(N.redFlags||[]).length?{tone:"danger",label:`${N.redFlags.length} issue${N.redFlags.length>1?"s":""}`}:{tone:"success",label:"Compliant"}}const C=Y("");function T(O){C.value=C.value===O?"":O}const M=[{value:"open",label:"Open"},{value:"specific",label:"Specific"},{value:"certified",label:"Certified"}],H=[{value:"commercial",label:"Commercial"},{value:"research",label:"Research"},{value:"public",label:"Public-benefit"},{value:"hobby",label:"Private hobby"},{value:"club_area",label:"Model-club area"}],j=[{value:"",label:"Auto (from drone)"},{value:"manual",label:"Manual"},{value:"automatic",label:"Automatic (FDR)"}];function K(){var O;return{operationDate:new Date().toISOString().slice(0,10),startTime:"",endTime:"",drone:((O=l.value[0])==null?void 0:O.id)||"",areaRoute:"",maxAltitudeAgl:"",pilotName:i.email,certificateRef:"",category:"open",purpose:"commercial",loggingPath:"",rawFdrLogUrl:"",authorisationRef:"",weather:"",airspaceRef:"",observer:"",incidents:"",notes:""}}const F=Y(!1),te=Y(""),X=gt(K()),fe=Y(""),Se=Y(!1),de=Y(!1);function Fe(){Object.assign(X,K()),te.value="",fe.value="",de.value=!1,F.value=!0}function Oe(O){Object.assign(X,{operationDate:(O.operationDate||"").slice(0,10),startTime:O.startTime||"",endTime:O.endTime||"",drone:O.drone||"",areaRoute:O.areaRoute||"",maxAltitudeAgl:O.maxAltitudeAgl||"",pilotName:O.pilotName||"",certificateRef:O.certificateRef||"",category:O.category||"open",purpose:O.purpose||"commercial",loggingPath:O.loggingPath||"",rawFdrLogUrl:O.rawFdrLogUrl||"",authorisationRef:O.authorisationRef||"",weather:O.weather||"",airspaceRef:O.airspaceRef||"",observer:O.observer||"",incidents:O.incidents||"",notes:O.notes||""}),te.value=O.id,fe.value="",de.value=!!(O.weather||O.airspaceRef||O.observer||O.incidents||O.notes),F.value=!0}function Te(){F.value=!1,te.value=""}async function Ze(){var $;if(fe.value="",!X.drone){fe.value="Select a drone first (add one in the Drones section).";return}Se.value=!0;const O={...X,maxAltitudeAgl:Number(X.maxAltitudeAgl)||0},N=te.value?await Ep(te.value,O):await Mp(O);if(Se.value=!1,!N.ok){fe.value=(($=N.body)==null?void 0:$.error)||"Could not save the flight.";return}F.value=!1,await _()}const he=Y("");async function Q(O){const N=await Op(O.id);he.value="",N.ok&&await _()}const B=ce(()=>{const O=u.value.length,N=u.value.filter(Ye=>{var we;return(((we=Ye.compliance)==null?void 0:we.redFlags)||[]).length}).length,$=u.value.filter(Ye=>{var we;return(we=Ye.compliance)==null?void 0:we.required}).length;return{total:O,flagged:N,required:$}});return(O,N)=>(p(),m("div",ty,[a("div",ny,[N[22]||(N[22]=a("div",null,[a("div",{class:"eyebrow"},"Logbook"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Flights (BEK 1649 §5)")],-1)),a("div",iy,[a("a",{href:Ee(zp)(),class:"btn-ghost inline-flex items-center gap-2",title:"Download a compliance CSV (Trafikstyrelsen / police disclosure)"},[A(J,{name:"download",size:15}),N[20]||(N[20]=z(" Export CSV ",-1))],8,oy),a("button",{class:"btn-accent inline-flex items-center gap-2",onClick:Fe},[A(J,{name:"plus",size:15}),N[21]||(N[21]=z(" Log flight ",-1))])])]),a("div",sy,[(p(!0),m(le,null,Ie([{label:"Flights logged",value:B.value.total,tone:"neutral"},{label:"Require logbook",value:B.value.required,tone:"neutral"},{label:"Compliance flags",value:B.value.flagged,tone:B.value.flagged?"danger":"success"}],$=>(p(),m("div",{key:$.label,class:"panel p-5"},[a("div",ay,w($.label),1),a("div",{class:Ce(["mt-2 text-[30px] font-bold leading-none tracking-tightest",$.tone==="danger"?"text-danger-fg":$.tone==="success"?"text-success-fg":"text-ink"])},w($.value),3)]))),128))]),h.value?(p(),m("div",ry,w(h.value),1)):I("",!0),F.value?(p(),m("div",ly,[a("div",uy,[a("div",null,[a("div",cy,w(te.value?"Edit entry":"New entry"),1),N[23]||(N[23]=a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Logbook flight (BEK 1649 §5)",-1))]),a("button",{class:"btn-icon",onClick:Te},[A(J,{name:"x",size:16})])]),a("div",dy,[a("label",fy,[N[24]||(N[24]=a("span",{class:"eyebrow mb-1 block"},"Date",-1)),ie(a("input",{"onUpdate:modelValue":N[0]||(N[0]=$=>X.operationDate=$),type:"date",class:"field"},null,512),[[me,X.operationDate]])]),a("label",hy,[N[25]||(N[25]=a("span",{class:"eyebrow mb-1 block"},"Start",-1)),ie(a("input",{"onUpdate:modelValue":N[1]||(N[1]=$=>X.startTime=$),type:"time",class:"field"},null,512),[[me,X.startTime]])]),a("label",py,[N[26]||(N[26]=a("span",{class:"eyebrow mb-1 block"},"End",-1)),ie(a("input",{"onUpdate:modelValue":N[2]||(N[2]=$=>X.endTime=$),type:"time",class:"field"},null,512),[[me,X.endTime]])]),a("label",my,[N[27]||(N[27]=a("span",{class:"eyebrow mb-1 block"},"Drone",-1)),ie(a("select",{"onUpdate:modelValue":N[3]||(N[3]=$=>X.drone=$),class:"field"},[l.value.length?I("",!0):(p(),m("option",gy,"— add a drone first —")),(p(!0),m(le,null,Ie(l.value,$=>(p(),m("option",{key:$.id,value:$.id},w($.displayName),9,vy))),128))],512),[[Ot,X.drone]])]),a("label",_y,[N[28]||(N[28]=a("span",{class:"eyebrow mb-1 block"},"Max altitude (m AGL)",-1)),ie(a("input",{"onUpdate:modelValue":N[4]||(N[4]=$=>X.maxAltitudeAgl=$),type:"number",min:"0",class:"field",placeholder:"120"},null,512),[[me,X.maxAltitudeAgl]])]),a("label",by,[N[29]||(N[29]=a("span",{class:"eyebrow mb-1 block"},"Area / route",-1)),ie(a("input",{"onUpdate:modelValue":N[5]||(N[5]=$=>X.areaRoute=$),class:"field",placeholder:"Field N of Roskilde, grid survey"},null,512),[[me,X.areaRoute]])]),a("label",yy,[N[30]||(N[30]=a("span",{class:"eyebrow mb-1 block"},"Remote pilot name",-1)),ie(a("input",{"onUpdate:modelValue":N[6]||(N[6]=$=>X.pilotName=$),class:"field",placeholder:"Full name"},null,512),[[me,X.pilotName]])]),a("label",xy,[N[31]||(N[31]=a("span",{class:"eyebrow mb-1 block"},"Certificate ref",-1)),ie(a("input",{"onUpdate:modelValue":N[7]||(N[7]=$=>X.certificateRef=$),class:"field",placeholder:"A2 / STS cert no."},null,512),[[me,X.certificateRef]])]),a("label",wy,[N[32]||(N[32]=a("span",{class:"eyebrow mb-1 block"},"Logging path",-1)),ie(a("select",{"onUpdate:modelValue":N[8]||(N[8]=$=>X.loggingPath=$),class:"field"},[(p(),m(le,null,Ie(j,$=>a("option",{key:$.value,value:$.value},w($.label),9,ky)),64))],512),[[Ot,X.loggingPath]])]),a("label",Sy,[N[33]||(N[33]=a("span",{class:"eyebrow mb-1 block"},"Category",-1)),ie(a("select",{"onUpdate:modelValue":N[9]||(N[9]=$=>X.category=$),class:"field"},[(p(),m(le,null,Ie(M,$=>a("option",{key:$.value,value:$.value},w($.label),9,Ty)),64))],512),[[Ot,X.category]])]),a("label",Py,[N[34]||(N[34]=a("span",{class:"eyebrow mb-1 block"},"Purpose",-1)),ie(a("select",{"onUpdate:modelValue":N[10]||(N[10]=$=>X.purpose=$),class:"field"},[(p(),m(le,null,Ie(H,$=>a("option",{key:$.value,value:$.value},w($.label),9,Cy)),64))],512),[[Ot,X.purpose]])]),a("label",Ly,[N[35]||(N[35]=a("span",{class:"eyebrow mb-1 block"},"Authorisation ref",-1)),ie(a("input",{"onUpdate:modelValue":N[11]||(N[11]=$=>X.authorisationRef=$),class:"field",placeholder:"Specific-category ref"},null,512),[[me,X.authorisationRef]])])]),a("label",Ay,[N[36]||(N[36]=a("span",{class:"eyebrow mb-1 block"},"FDR log URL (automatic path)",-1)),ie(a("input",{"onUpdate:modelValue":N[12]||(N[12]=$=>X.rawFdrLogUrl=$),class:"field",placeholder:"Link to the stored flight-data-recorder export"},null,512),[[me,X.rawFdrLogUrl]])]),a("button",{class:"mt-4 flex items-center gap-1.5 text-sm font-semibold text-accent",onClick:N[13]||(N[13]=$=>de.value=!de.value)},[A(J,{name:de.value?"x":"plus",size:14},null,8,["name"]),N[37]||(N[37]=z(" Operational details (weather, airspace, incidents) ",-1))]),de.value?(p(),m("div",My,[a("label",Ey,[N[38]||(N[38]=a("span",{class:"eyebrow mb-1 block"},"Weather / wind",-1)),ie(a("input",{"onUpdate:modelValue":N[14]||(N[14]=$=>X.weather=$),class:"field",placeholder:"6 m/s NW, CAVOK"},null,512),[[me,X.weather]])]),a("label",Oy,[N[39]||(N[39]=a("span",{class:"eyebrow mb-1 block"},"Airspace / NOTAM ref",-1)),ie(a("input",{"onUpdate:modelValue":N[15]||(N[15]=$=>X.airspaceRef=$),class:"field"},null,512),[[me,X.airspaceRef]])]),a("label",zy,[N[40]||(N[40]=a("span",{class:"eyebrow mb-1 block"},"Observer",-1)),ie(a("input",{"onUpdate:modelValue":N[16]||(N[16]=$=>X.observer=$),class:"field"},null,512),[[me,X.observer]])]),a("label",$y,[N[41]||(N[41]=a("span",{class:"eyebrow mb-1 block"},"Incidents / anomalies",-1)),ie(a("input",{"onUpdate:modelValue":N[17]||(N[17]=$=>X.incidents=$),class:"field",placeholder:"RTH trigger, GPS dropout…"},null,512),[[me,X.incidents]])]),a("label",Iy,[N[42]||(N[42]=a("span",{class:"eyebrow mb-1 block"},"Notes",-1)),ie(a("textarea",{"onUpdate:modelValue":N[18]||(N[18]=$=>X.notes=$),rows:"2",class:"field"},null,512),[[me,X.notes]])])])):I("",!0),a("div",Ny,[a("button",{class:"btn-accent",disabled:Se.value,onClick:Ze},w(Se.value?"Saving…":te.value?"Save changes":"Log flight"),9,Dy),a("button",{class:"btn-ghost",onClick:Te},"Cancel"),fe.value?(p(),m("span",Fy,w(fe.value),1)):I("",!0)])])):I("",!0),a("div",Ry,[f.value?(p(),m("div",By,"Loading…")):u.value.length?(p(),m("div",Vy,[a("table",Zy,[a("thead",null,[a("tr",Hy,[(p(),m(le,null,Ie(["Date","Drone","Area / route","Alt","Pilot","Compliance",""],$=>a("th",{key:$,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},w($),1)),64))])]),a("tbody",null,[(p(!0),m(le,null,Ie(u.value,$=>{var Ye,we,ge,ue;return p(),m(le,{key:$.id},[a("tr",{class:Ce(["border-b border-line last:border-0",te.value===$.id?"bg-accent-soft":""])},[a("td",jy,[z(w(($.operationDate||"").slice(0,10))+" ",1),$.startTime?(p(),m("span",Wy,w($.startTime),1)):I("",!0)]),a("td",Ky,w($.droneName||"—"),1),a("td",{class:"max-w-[220px] truncate px-5 py-3 text-ink-secondary",title:$.areaRoute},w($.areaRoute||"—"),9,Gy),a("td",qy,w($.maxAltitudeAgl?$.maxAltitudeAgl+" m":"—"),1),a("td",Yy,w($.pilotName||"—"),1),a("td",Jy,[a("button",{class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",s[y($).tone]]),onClick:ft=>T($.id)},[y($).tone==="danger"?(p(),nt(J,{key:0,name:"alertTriangle",size:12})):y($).tone==="success"?(p(),nt(J,{key:1,name:"check",size:12})):I("",!0),z(" "+w(y($).label),1)],10,Xy)]),a("td",Qy,[he.value===$.id?(p(),m(le,{key:0},[N[45]||(N[45]=a("span",{class:"mr-2 text-xs text-ink-muted"},"Delete?",-1)),a("button",{class:"btn-ghost mr-1",onClick:N[19]||(N[19]=ft=>he.value="")},"Cancel"),a("button",{class:"rounded bg-danger px-3 py-1.5 text-sm font-semibold text-white transition hover:brightness-110",onClick:ft=>Q($)},"Delete",8,ex)],64)):(p(),m(le,{key:1},[a("button",{class:"btn-ghost mr-1 inline-flex items-center gap-1",onClick:ft=>Oe($)},[A(J,{name:"sliders",size:13}),N[46]||(N[46]=z(" Edit",-1))],8,tx),a("button",{class:"btn-ghost inline-flex items-center gap-1",onClick:ft=>he.value=$.id},[A(J,{name:"trash",size:13})],8,nx)],64))])],2),C.value===$.id?(p(),m("tr",ix,[a("td",ox,[a("div",sx,[a("span",ax,[N[47]||(N[47]=z("Logging path: ",-1)),a("b",rx,w(((Ye=$.compliance)==null?void 0:Ye.loggingPath)||"—"),1)]),a("span",lx,[N[48]||(N[48]=z("Category: ",-1)),a("b",ux,w($.category||"—"),1)]),a("span",cx,[N[49]||(N[49]=z("Retain until: ",-1)),a("b",dx,w(($.retentionUntil||"").slice(0,10)||"—"),1)]),(we=$.compliance)!=null&&we.exempt?(p(),m("span",fx,[N[50]||(N[50]=z("Exempt: ",-1)),a("b",hx,w($.compliance.exemptReason),1)])):I("",!0)]),(((ge=$.compliance)==null?void 0:ge.redFlags)||[]).length?(p(),m("ul",px,[(p(!0),m(le,null,Ie($.compliance.redFlags,(ft,pe)=>(p(),m("li",{key:pe,class:"flex items-start gap-2 text-xs text-danger-fg"},[A(J,{name:"alertTriangle",size:13,class:"mt-px shrink-0"}),z(" "+w(ft),1)]))),128))])):(ue=$.compliance)!=null&&ue.exempt?I("",!0):(p(),m("div",mx,"No compliance gaps detected."))])])):I("",!0)],64)}),128))])])])):(p(),m("div",Uy,[A(J,{name:"book",size:26,class:"text-ink-muted"}),N[43]||(N[43]=a("div",{class:"mt-3 text-sm font-medium text-ink-secondary"},"No flights logged yet",-1)),N[44]||(N[44]=a("div",{class:"mt-1 text-xs text-ink-muted"},"Log your first operation to start the 5-year retention record.",-1))]))])]))}},vx={class:"mx-auto flex max-w-[1240px] flex-col gap-5 p-7"},_x={class:"flex flex-wrap items-center gap-3"},bx={class:"ml-auto flex items-center gap-2"},yx={class:"grid grid-cols-4 gap-4 max-[900px]:grid-cols-2"},xx={class:"eyebrow"},wx={key:0,class:"panel border-danger/40 p-4 text-sm text-danger-fg"},kx={key:1,class:"panel p-5"},Sx={class:"mb-4 flex items-center justify-between"},Tx={class:"eyebrow"},Px={class:"grid grid-cols-3 gap-3 max-[760px]:grid-cols-1"},Cx={class:"block"},Lx={class:"block"},Ax={class:"block"},Mx={class:"block"},Ex={class:"block"},Ox={class:"block"},zx={class:"block"},$x={class:"block"},Ix={class:"block"},Nx=["value"],Dx={class:"mt-3 flex flex-wrap gap-6"},Fx={class:"flex items-center gap-2 text-sm text-ink-secondary"},Rx={class:"flex items-center gap-2 text-sm text-ink-secondary"},Bx={class:"mt-4 flex items-center gap-3"},Ux=["disabled"],Vx={key:0,class:"text-sm text-danger-fg"},Zx={class:"panel overflow-hidden p-0"},Hx={key:0,class:"px-5 py-12 text-center text-sm text-ink-muted"},jx={key:1,class:"grid place-items-center px-5 py-16 text-center"},Wx={key:2,class:"overflow-x-auto"},Kx={class:"w-full border-collapse text-sm"},Gx={class:"text-left"},qx={class:"px-5 py-3"},Yx={class:"flex items-center gap-2"},Jx={class:"font-semibold text-ink"},Xx={key:0,class:"text-xs text-ink-muted"},Qx={key:1,class:"text-xs text-ink-muted"},e0={class:"px-5 py-3 font-mono text-xs text-ink-secondary"},t0={class:"px-5 py-3 font-mono text-xs text-ink-secondary"},n0={class:"px-5 py-3 font-mono text-xs text-ink-secondary"},i0={class:"px-5 py-3 font-mono text-xs text-ink-secondary"},o0={class:"px-5 py-3"},s0={key:1,class:"text-ink-muted"},a0={class:"whitespace-nowrap px-5 py-3 text-right"},r0=["onClick"],l0=["onClick"],u0=["onClick"],c0={__name:"Drones",props:{connectedSerials:{type:Array,default:()=>[]}},emits:["deleted"],setup(t,{expose:i,emit:s}){const l=t,u=s,f={success:"bg-success-soft text-success-fg",accent:"bg-accent-soft text-accent-soft-fg",neutral:"bg-surface-2 text-ink-secondary"},h=Y([]),_=Y(!1),y=Y("");async function C(){_.value=!0,y.value="";const Q=await pl();Q.ok||(y.value=Q.status===503?"Drone storage is not configured on the API Server (service account missing).":"Could not load your drones."),h.value=Q.drones,_.value=!1}fi(C),i({reload:C});const T=ce(()=>new Set(l.connectedSerials.filter(Boolean)));function M(Q){return!!Q.serial&&T.value.has(Q.serial)}const H=["","C0","C1","C2","C3","C4","C5","C6"];function j(){return{name:"",model:"",serial:"",firmware:"",controllerFirmware:"",registration:"",operatorNumber:"",mtomGrams:"",isToy:!1,autologsFlights:!1,cClass:""}}const K=Y(!1),F=Y(""),te=gt(j()),X=Y(""),fe=Y(!1);function Se(){Object.assign(te,j()),F.value="",X.value="",K.value=!0}function de(Q){Object.assign(te,{name:Q.name||"",model:Q.model||"",serial:Q.serial||"",firmware:Q.firmware||"",controllerFirmware:Q.controllerFirmware||"",registration:Q.registration||"",operatorNumber:Q.operatorNumber||"",mtomGrams:Q.mtomGrams||"",isToy:!!Q.isToy,autologsFlights:!!Q.autologsFlights,cClass:Q.cClass||""}),F.value=Q.id,X.value="",K.value=!0}function Fe(){K.value=!1,F.value=""}async function Oe(){var O;if(X.value="",!te.name.trim()&&!te.model.trim()&&!te.serial.trim()){X.value="Give the drone a custom name, model or serial.";return}fe.value=!0;const Q={...te,mtomGrams:Number(te.mtomGrams)||0},B=F.value?await Cp(F.value,Q):await Tp(Q);if(fe.value=!1,!B.ok){X.value=((O=B.body)==null?void 0:O.error)||"Could not save the drone.";return}K.value=!1,await C()}const Te=Y("");async function Ze(Q){var O;const B=await Lp(Q.id);Te.value="",B.ok?(u("deleted",Q.serial),await C()):X.value=((O=B.body)==null?void 0:O.error)||"Could not delete the drone."}const he=ce(()=>({fleet:h.value.length,connected:h.value.filter(M).length,unnamed:h.value.filter(Q=>!(Q.name||"").trim()).length,unregistered:h.value.filter(Q=>!(Q.registration||"").trim()).length}));return(Q,B)=>(p(),m("div",vx,[a("div",_x,[B[13]||(B[13]=a("div",null,[a("div",{class:"eyebrow"},"Fleet"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Drones you fly")],-1)),a("div",bx,[a("button",{class:"btn-accent inline-flex items-center gap-2",onClick:Se},[A(J,{name:"plus",size:15}),B[12]||(B[12]=z(" Add drone ",-1))])])]),a("div",yx,[(p(!0),m(le,null,Ie([{label:"Drones in fleet",value:he.value.fleet,tone:"neutral"},{label:"Connected now",value:he.value.connected,tone:he.value.connected?"success":"neutral"},{label:"Awaiting a name",value:he.value.unnamed,tone:"neutral"},{label:"No registration",value:he.value.unregistered,tone:"neutral"}],O=>(p(),m("div",{key:O.label,class:"panel p-5"},[a("div",xx,w(O.label),1),a("div",{class:Ce(["mt-2 text-[30px] font-bold leading-none tracking-tightest",O.tone==="success"?"text-success-fg":"text-ink"])},w(O.value),3)]))),128))]),y.value?(p(),m("div",wx,w(y.value),1)):I("",!0),K.value?(p(),m("div",kx,[a("div",Sx,[a("div",null,[a("div",Tx,w(F.value?"Edit drone":"New drone"),1),B[14]||(B[14]=a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Aircraft registry",-1))]),a("button",{class:"btn-icon",onClick:Fe},[A(J,{name:"x",size:16})])]),a("div",Px,[a("label",Cx,[B[15]||(B[15]=a("span",{class:"eyebrow mb-1 block"},"Custom name",-1)),ie(a("input",{"onUpdate:modelValue":B[0]||(B[0]=O=>te.name=O),class:"field",placeholder:"Mavic-01"},null,512),[[me,te.name]])]),a("label",Lx,[B[16]||(B[16]=a("span",{class:"eyebrow mb-1 block"},"Model",-1)),ie(a("input",{"onUpdate:modelValue":B[1]||(B[1]=O=>te.model=O),class:"field",placeholder:"DJI Mavic 3 Enterprise"},null,512),[[me,te.model]])]),a("label",Ax,[B[17]||(B[17]=a("span",{class:"eyebrow mb-1 block"},"Serial number",-1)),ie(a("input",{"onUpdate:modelValue":B[2]||(B[2]=O=>te.serial=O),class:"field"},null,512),[[me,te.serial]])]),a("label",Mx,[B[18]||(B[18]=a("span",{class:"eyebrow mb-1 block"},"Drone firmware",-1)),ie(a("input",{"onUpdate:modelValue":B[3]||(B[3]=O=>te.firmware=O),class:"field",placeholder:"03.02.35.05"},null,512),[[me,te.firmware]])]),a("label",Ex,[B[19]||(B[19]=a("span",{class:"eyebrow mb-1 block"},"Controller firmware",-1)),ie(a("input",{"onUpdate:modelValue":B[4]||(B[4]=O=>te.controllerFirmware=O),class:"field",placeholder:"01.03.0800"},null,512),[[me,te.controllerFirmware]])]),a("label",Ox,[B[20]||(B[20]=a("span",{class:"eyebrow mb-1 block"},"Registration (FAA/CAA)",-1)),ie(a("input",{"onUpdate:modelValue":B[5]||(B[5]=O=>te.registration=O),class:"field",placeholder:"FA3X7K9PLM"},null,512),[[me,te.registration]])]),a("label",zx,[B[21]||(B[21]=a("span",{class:"eyebrow mb-1 block"},"Operator no. (EU)",-1)),ie(a("input",{"onUpdate:modelValue":B[6]||(B[6]=O=>te.operatorNumber=O),class:"field",placeholder:"DNK…"},null,512),[[me,te.operatorNumber]])]),a("label",$x,[B[22]||(B[22]=a("span",{class:"eyebrow mb-1 block"},"MTOM (grams)",-1)),ie(a("input",{"onUpdate:modelValue":B[7]||(B[7]=O=>te.mtomGrams=O),type:"number",min:"0",class:"field",placeholder:"920"},null,512),[[me,te.mtomGrams]])]),a("label",Ix,[B[23]||(B[23]=a("span",{class:"eyebrow mb-1 block"},"C-class",-1)),ie(a("select",{"onUpdate:modelValue":B[8]||(B[8]=O=>te.cClass=O),class:"field"},[(p(),m(le,null,Ie(H,O=>a("option",{key:O,value:O},w(O||"— none —"),9,Nx)),64))],512),[[Ot,te.cClass]])])]),B[26]||(B[26]=a("p",{class:"mt-3 text-xs text-ink-muted"}," Model, serial and both firmware versions fill themselves in when the drone connects — anything you type here is kept as-is. ",-1)),a("div",Dx,[a("label",Fx,[ie(a("input",{"onUpdate:modelValue":B[9]||(B[9]=O=>te.autologsFlights=O),type:"checkbox",class:"h-4 w-4 accent-[var(--accent)]"},null,512),[[Va,te.autologsFlights]]),B[24]||(B[24]=z(" Auto-logs flights (onboard FDR) ",-1))]),a("label",Rx,[ie(a("input",{"onUpdate:modelValue":B[10]||(B[10]=O=>te.isToy=O),type:"checkbox",class:"h-4 w-4 accent-[var(--accent)]"},null,512),[[Va,te.isToy]]),B[25]||(B[25]=z(" Toy drone (logbook-exempt) ",-1))])]),a("div",Bx,[a("button",{class:"btn-accent",disabled:fe.value,onClick:Oe},w(fe.value?"Saving…":F.value?"Save changes":"Add drone"),9,Ux),a("button",{class:"btn-ghost",onClick:Fe},"Cancel"),X.value?(p(),m("span",Vx,w(X.value),1)):I("",!0)])])):I("",!0),a("div",Zx,[_.value?(p(),m("div",Hx,"Loading…")):h.value.length?(p(),m("div",Wx,[a("table",Kx,[a("thead",null,[a("tr",Gx,[(p(),m(le,null,Ie(["Drone","Serial","Firmware","Ctrl FW","Registration","Class",""],O=>a("th",{key:O,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},w(O),1)),64))])]),a("tbody",null,[(p(!0),m(le,null,Ie(h.value,O=>(p(),m("tr",{key:O.id,class:Ce(["border-b border-line last:border-0",F.value===O.id?"bg-accent-soft":""])},[a("td",qx,[a("div",Yx,[a("span",Jx,w(O.displayName),1),M(O)?(p(),m("span",{key:0,class:Ce(["inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-semibold",f.success])},[A(J,{name:"signal",size:11}),B[29]||(B[29]=z(" connected ",-1))],2)):I("",!0)]),O.name&&O.model?(p(),m("div",Xx,w(O.model),1)):O.name?I("",!0):(p(),m("div",Qx,"no custom name yet"))]),a("td",e0,w(O.serial||"—"),1),a("td",t0,w(O.firmware||"—"),1),a("td",n0,w(O.controllerFirmware||"—"),1),a("td",i0,w(O.registration||"—"),1),a("td",o0,[O.cClass?(p(),m("span",{key:0,class:Ce(["inline-flex rounded-full px-2 py-0.5 text-[11px] font-semibold",f.accent])},w(O.cClass),3)):(p(),m("span",s0,"—")),O.isToy?(p(),m("span",{key:2,class:Ce(["ml-1 inline-flex rounded-full px-2 py-0.5 text-[11px] font-semibold",f.neutral])},"toy",2)):I("",!0)]),a("td",a0,[Te.value===O.id?(p(),m(le,{key:0},[B[30]||(B[30]=a("span",{class:"mr-2 text-xs text-ink-muted"},"Delete?",-1)),a("button",{class:"btn-ghost mr-1",onClick:B[11]||(B[11]=N=>Te.value="")},"Cancel"),a("button",{class:"rounded bg-danger px-3 py-1.5 text-sm font-semibold text-white transition hover:brightness-110",onClick:N=>Ze(O)},"Delete",8,r0)],64)):(p(),m(le,{key:1},[a("button",{class:"btn-ghost mr-1 inline-flex items-center gap-1",onClick:N=>de(O)},[A(J,{name:"sliders",size:13}),B[31]||(B[31]=z(" Edit",-1))],8,l0),a("button",{class:"btn-ghost inline-flex items-center gap-1",onClick:N=>Te.value=O.id},[A(J,{name:"trash",size:13})],8,u0)],64))])],2))),128))])])])):(p(),m("div",jx,[A(J,{name:"drone",size:26,class:"text-ink-muted"}),B[27]||(B[27]=a("div",{class:"mt-3 text-sm font-medium text-ink-secondary"},"No drones yet",-1)),B[28]||(B[28]=a("div",{class:"mt-1 text-xs text-ink-muted"}," Connect a drone in the Fly App and it lands here by itself — or add one by hand. ",-1))]))])]))}},d0={class:"mx-auto flex max-w-[1240px] flex-col gap-5 p-7"},f0={class:"flex flex-wrap items-center gap-3"},h0={class:"inline-flex flex-wrap rounded-lg border border-line bg-surface-1 p-0.5"},p0=["onClick"],m0={class:"ml-auto"},g0={class:"grid grid-cols-4 gap-4 max-[900px]:grid-cols-2"},v0={class:"eyebrow"},_0={key:0,class:"panel border-danger/40 p-4 text-sm text-danger-fg"},b0={key:1,class:"panel p-5"},y0={class:"mb-4 flex items-center justify-between"},x0={class:"eyebrow"},w0={class:"mt-0.5 text-base font-semibold text-ink"},k0={class:"grid grid-cols-3 gap-3 max-[760px]:grid-cols-1"},S0={class:"col-span-2 block max-[760px]:col-span-1"},T0={class:"block"},P0=["value"],C0={class:"block"},L0=["value"],A0={class:"block"},M0=["value"],E0={class:"block"},O0={class:"block"},z0={class:"block"},$0={class:"block"},I0=["value"],N0={class:"block"},D0={class:"block"},F0={class:"block"},R0=["value"],B0={class:"mt-3 block"},U0={key:0,class:"mt-3"},V0={class:"eyebrow mb-1 block"},Z0={key:1,class:"mt-3 text-xs text-ink-muted"},H0={class:"mt-4 flex items-center gap-3"},j0=["disabled"],W0={key:0,class:"text-sm text-danger-fg"},K0={class:"panel overflow-hidden p-0"},G0={key:0,class:"px-5 py-12 text-center text-sm text-ink-muted"},q0={key:1,class:"grid place-items-center px-5 py-16 text-center"},Y0={class:"mt-3 text-sm font-medium text-ink-secondary"},J0={class:"mt-1 text-xs text-ink-muted"},X0={key:2,class:"overflow-x-auto"},Q0={class:"w-full border-collapse text-sm"},ew={class:"text-left"},tw={class:"px-5 py-3"},nw={class:"font-semibold text-ink"},iw={key:0,class:"font-mono text-[11px] text-ink-muted"},ow={class:"px-5 py-3 text-ink-secondary"},sw={class:"px-5 py-3 text-ink-secondary"},aw={class:"px-5 py-3"},rw=["onClick"],lw={key:0,class:"mt-0.5 font-mono text-[10.5px] text-ink-muted"},uw={class:"px-5 py-3 font-mono text-ink-secondary"},cw={class:"whitespace-nowrap px-5 py-3 text-right"},dw=["onClick"],fw=["onClick"],hw=["href"],pw=["onClick"],mw=["onClick"],gw=["onClick"],vw={key:0,class:"border-b border-line bg-surface-2"},_w={colspan:"6",class:"px-5 py-3"},bw={class:"flex flex-wrap gap-x-8 gap-y-1.5 text-xs"},yw={class:"text-ink-secondary"},xw={class:"text-ink"},ww={class:"text-ink-secondary"},kw={class:"text-ink"},Sw={key:0,class:"text-ink-secondary"},Tw={class:"text-ink"},Pw={key:1,class:"text-ink-secondary"},Cw={class:"font-mono text-ink"},Lw={key:2,class:"text-ink-secondary"},Aw={class:"font-mono text-ink"},Mw={class:"text-ink-secondary"},Ew={class:"text-ink"},Ow={key:0,class:"mt-2 space-y-1"},zw={key:1,class:"mt-2 text-xs text-success-fg"},$w={key:2,class:"mt-2 text-xs text-ink-secondary"},Iw={class:"flex max-h-[90vh] w-full max-w-[920px] flex-col overflow-hidden rounded-lg border border-line bg-surface-1 shadow-2xl"},Nw={class:"flex items-center gap-3 border-b border-line px-5 py-3"},Dw={class:"min-w-0"},Fw={class:"truncate text-sm font-semibold text-ink"},Rw={class:"truncate font-mono text-[11px] text-ink-muted"},Bw={class:"ml-auto flex items-center gap-2"},Uw=["href"],Vw=["href"],Zw={class:"flex-1 overflow-auto bg-surface-2"},Hw=["src","alt"],jw=["src","title"],Ww={key:2,class:"grid place-items-center px-6 py-16 text-center"},Kw={class:"mt-1 text-xs text-ink-muted"},Gw=["href"],qw={__name:"Documents",props:{email:{type:String,default:""},role:{type:String,default:"user"},organization:{type:String,default:""},organizationName:{type:String,default:""}},setup(t){const i={success:"bg-success-soft text-success-fg",warning:"bg-amber-soft text-amber-fg",danger:"bg-danger-soft text-danger-fg",accent:"bg-accent-soft text-accent-soft-fg",neutral:"bg-surface-2 text-ink-secondary"},s=[{value:"certificate",label:"Pilot certificate"},{value:"medical",label:"Medical / training"},{value:"insurance",label:"Insurance / liability"},{value:"background_check",label:"Background check / waiver"},{value:"registration",label:"Aircraft registration"},{value:"maintenance",label:"Maintenance log"},{value:"conformity",label:"Conformity / compliance"},{value:"firmware",label:"Firmware / software"},{value:"incident",label:"Incident / repair report"},{value:"flight_log",label:"Flight log"},{value:"checklist",label:"Pre-flight checklist"},{value:"airspace_auth",label:"Airspace authorisation"},{value:"mission_plan",label:"Mission plan / flight path"},{value:"risk_assessment",label:"Risk assessment / survey"},{value:"contract",label:"Contract / SOW"},{value:"client_insurance",label:"Client insurance cert"},{value:"delivery_report",label:"Delivery / media handoff"},{value:"other",label:"Other"}],l=Object.fromEntries(s.map(x=>[x.value,x.label])),u=[{value:"pilot",label:"Pilot"},{value:"aircraft",label:"Aircraft"},{value:"organization",label:"Organization"},{value:"client",label:"Client"},{value:"other",label:"Other"}],f=[{value:"active",label:"Active"},{value:"pending_review",label:"Pending review"},{value:"archived",label:"Archived"}],h=[{value:"pilot",label:"Pilot"},{value:"ops",label:"Ops manager"},{value:"admin",label:"Admin"},{value:"client",label:"Client-facing"}],_=Y([]),y=Y([]),C=Y(!1),T=Y("");async function M(){C.value=!0,T.value="";const[x,b]=await Promise.all([$p(),pl()]);x.ok||(T.value=x.status===503?"Document storage is not configured on the API Server (service account missing).":"Could not load documents."),_.value=x.documents,y.value=b.drones||[],C.value=!1}fi(M);const H=Y("all"),j=[["all","All"],["expiring","Expiring soon"],["expired","Expired"],["pending","Pending review"],["archived","Archived"]],K=ce(()=>{const x=_.value;switch(H.value){case"expiring":return x.filter(b=>{var S;return((S=b.expiry)==null?void 0:S.state)==="expiring_soon"&&b.status!=="archived"});case"expired":return x.filter(b=>{var S;return((S=b.expiry)==null?void 0:S.state)==="expired"&&b.status!=="archived"});case"pending":return x.filter(b=>b.status==="pending_review");case"archived":return x.filter(b=>b.status==="archived");default:return x.filter(b=>b.status!=="archived")}});function F(x){if(x.status==="archived")return{tone:"neutral",label:"Superseded",icon:""};const b=x.expiry||{};return b.state==="expired"?{tone:"danger",label:"Expired",icon:"alertTriangle"}:b.state==="expiring_soon"?{tone:"warning",label:`Expires in ${b.daysUntilExpiry}d`,icon:"clock"}:b.state==="valid"?{tone:"success",label:"Valid",icon:"check"}:{tone:"neutral",label:"No expiry",icon:""}}const te=Y("");function X(x){te.value=te.value===x?"":x}function fe(x){return x.ownerDrone?x.ownerDroneName||"Aircraft":x.ownerRef?x.ownerRef:x.ownerType==="pilot"?"Pilot":x.ownerType?x.ownerType.charAt(0).toUpperCase()+x.ownerType.slice(1):"—"}const Se=["png","jpg","jpeg","gif","webp","svg","bmp","avif"],de=["pdf","txt","csv","log","json","md","html","htm","xml"];function Fe(x){const b=(x||"").split(".").pop().toLowerCase();return Se.includes(b)?"image":de.includes(b)?"frame":"none"}const Oe=Y(null),Te=ce(()=>Oe.value?Fe(Oe.value.fileName):"none"),Ze=ce(()=>Oe.value?Fp(Oe.value.id):"");function he(x){Oe.value=x}function Q(){Oe.value=null}function B(x){x.key==="Escape"&&Oe.value&&Q()}fi(()=>window.addEventListener("keydown",B)),us(()=>window.removeEventListener("keydown",B));function O(){return{title:"",docType:"certificate",ownerType:"pilot",ownerDrone:"",ownerRef:"",reference:"",jurisdiction:"",issueDate:"",expiryDate:"",status:"active",accessTier:"ops",notes:""}}const N=Y(!1),$=Y(""),Ye=Y(""),we=Y(""),ge=gt(O()),ue=Y(null),ft=Y(null),pe=Y(""),Ue=Y(!1);function Ve(){ue.value=null,ft.value&&(ft.value.value="")}function wt(){Object.assign(ge,O()),$.value="",Ye.value="",we.value="",Ve(),pe.value="",N.value=!0}function st(x){Object.assign(ge,{title:x.title||"",docType:x.docType||"certificate",ownerType:x.ownerType||"pilot",ownerDrone:x.ownerDrone||"",ownerRef:x.ownerRef||"",reference:x.reference||"",jurisdiction:x.jurisdiction||"",issueDate:x.issueDate||"",expiryDate:x.expiryDate||"",status:x.status||"active",accessTier:x.accessTier||"ops",notes:x.notes||""}),$.value=x.id,Ye.value="",we.value="",Ve(),pe.value="",N.value=!0}function Le(x){st(x),$.value="",Ye.value=x.id,we.value=x.title,ge.status="active"}function De(){N.value=!1,$.value="",Ye.value=""}function zt(x){var b;ue.value=((b=x.target.files)==null?void 0:b[0])||null}async function At(){var b;if(pe.value="",!ge.title.trim()){pe.value="Give the document a title.";return}Ue.value=!0;let x;if($.value)x=await Np($.value,{...ge});else{const S={...ge};Ye.value&&(S.replaces=Ye.value),x=await Ip(S,ue.value)}if(Ue.value=!1,!x.ok){pe.value=((b=x.body)==null?void 0:b.error)||"Could not save the document.";return}N.value=!1,$.value="",Ye.value="",await M()}const Ut=Y("");async function Pt(x){var S;const b=await Dp(x.id);Ut.value="",b.ok?await M():pe.value=((S=b.body)==null?void 0:S.error)||"Could not delete the document."}const kt=ce(()=>{const x=_.value.filter(b=>b.status!=="archived");return{total:x.length,expiring:x.filter(b=>{var S;return((S=b.expiry)==null?void 0:S.state)==="expiring_soon"}).length,expired:x.filter(b=>{var S;return((S=b.expiry)==null?void 0:S.state)==="expired"}).length,pending:_.value.filter(b=>b.status==="pending_review").length}});return(x,b)=>(p(),m("div",d0,[a("div",f0,[a("div",h0,[(p(),m(le,null,Ie(j,S=>a("button",{key:S[0],class:Ce(["rounded-md px-3.5 py-1.5 text-sm font-semibold transition",H.value===S[0]?"bg-accent-soft text-accent-soft-fg":"text-ink-secondary hover:text-ink"]),onClick:W=>H.value=S[0]},w(S[1]),11,p0)),64))]),a("div",m0,[a("button",{class:"btn-accent inline-flex items-center gap-2",onClick:wt},[A(J,{name:"upload",size:15}),b[13]||(b[13]=z(" Add document ",-1))])])]),a("div",g0,[(p(!0),m(le,null,Ie([{label:"Documents on file",value:kt.value.total,tone:"neutral"},{label:"Expiring soon",value:kt.value.expiring,tone:kt.value.expiring?"warning":"neutral"},{label:"Expired",value:kt.value.expired,tone:kt.value.expired?"danger":"success"},{label:"Pending review",value:kt.value.pending,tone:kt.value.pending?"accent":"neutral"}],S=>(p(),m("div",{key:S.label,class:"panel p-5"},[a("div",v0,w(S.label),1),a("div",{class:Ce(["mt-2 text-[30px] font-bold leading-none tracking-tightest",S.tone==="danger"?"text-danger-fg":S.tone==="warning"?"text-amber-fg":S.tone==="success"?"text-success-fg":S.tone==="accent"?"text-accent-soft-fg":"text-ink"])},w(S.value),3)]))),128))]),T.value?(p(),m("div",_0,w(T.value),1)):I("",!0),N.value?(p(),m("div",b0,[a("div",y0,[a("div",null,[a("div",x0,w($.value?"Edit document":Ye.value?"New version":"New document"),1),a("div",w0,w(Ye.value?`Supersedes “${we.value}”`:"Compliance & operational document"),1)]),a("button",{class:"btn-icon",onClick:De},[A(J,{name:"x",size:16})])]),a("div",k0,[a("label",S0,[b[14]||(b[14]=a("span",{class:"eyebrow mb-1 block"},"Title",-1)),ie(a("input",{"onUpdate:modelValue":b[0]||(b[0]=S=>ge.title=S),class:"field",placeholder:"A2 Remote Pilot Certificate — J. Dariusz"},null,512),[[me,ge.title]])]),a("label",T0,[b[15]||(b[15]=a("span",{class:"eyebrow mb-1 block"},"Type",-1)),ie(a("select",{"onUpdate:modelValue":b[1]||(b[1]=S=>ge.docType=S),class:"field"},[(p(),m(le,null,Ie(s,S=>a("option",{key:S.value,value:S.value},w(S.label),9,P0)),64))],512),[[Ot,ge.docType]])]),a("label",C0,[b[16]||(b[16]=a("span",{class:"eyebrow mb-1 block"},"Owner type",-1)),ie(a("select",{"onUpdate:modelValue":b[2]||(b[2]=S=>ge.ownerType=S),class:"field"},[(p(),m(le,null,Ie(u,S=>a("option",{key:S.value,value:S.value},w(S.label),9,L0)),64))],512),[[Ot,ge.ownerType]])]),a("label",A0,[b[18]||(b[18]=a("span",{class:"eyebrow mb-1 block"},"Aircraft (if any)",-1)),ie(a("select",{"onUpdate:modelValue":b[3]||(b[3]=S=>ge.ownerDrone=S),class:"field"},[b[17]||(b[17]=a("option",{value:""},"— none —",-1)),(p(!0),m(le,null,Ie(y.value,S=>(p(),m("option",{key:S.id,value:S.id},w(S.name)+w(S.model?` · ${S.model}`:""),9,M0))),128))],512),[[Ot,ge.ownerDrone]])]),a("label",E0,[b[19]||(b[19]=a("span",{class:"eyebrow mb-1 block"},"Owner reference",-1)),ie(a("input",{"onUpdate:modelValue":b[4]||(b[4]=S=>ge.ownerRef=S),class:"field",placeholder:"Client name / serial / site"},null,512),[[me,ge.ownerRef]])]),a("label",O0,[b[20]||(b[20]=a("span",{class:"eyebrow mb-1 block"},"Reference / number",-1)),ie(a("input",{"onUpdate:modelValue":b[5]||(b[5]=S=>ge.reference=S),class:"field",placeholder:"Cert / registration / policy no."},null,512),[[me,ge.reference]])]),a("label",z0,[b[21]||(b[21]=a("span",{class:"eyebrow mb-1 block"},"Jurisdiction",-1)),ie(a("input",{"onUpdate:modelValue":b[6]||(b[6]=S=>ge.jurisdiction=S),class:"field",placeholder:"DK / EASA / FAA"},null,512),[[me,ge.jurisdiction]])]),a("label",$0,[b[22]||(b[22]=a("span",{class:"eyebrow mb-1 block"},"Access tier",-1)),ie(a("select",{"onUpdate:modelValue":b[7]||(b[7]=S=>ge.accessTier=S),class:"field"},[(p(),m(le,null,Ie(h,S=>a("option",{key:S.value,value:S.value},w(S.label),9,I0)),64))],512),[[Ot,ge.accessTier]])]),a("label",N0,[b[23]||(b[23]=a("span",{class:"eyebrow mb-1 block"},"Issue date",-1)),ie(a("input",{"onUpdate:modelValue":b[8]||(b[8]=S=>ge.issueDate=S),type:"date",class:"field"},null,512),[[me,ge.issueDate]])]),a("label",D0,[b[24]||(b[24]=a("span",{class:"eyebrow mb-1 block"},"Expiry date",-1)),ie(a("input",{"onUpdate:modelValue":b[9]||(b[9]=S=>ge.expiryDate=S),type:"date",class:"field"},null,512),[[me,ge.expiryDate]])]),a("label",F0,[b[25]||(b[25]=a("span",{class:"eyebrow mb-1 block"},"Status",-1)),ie(a("select",{"onUpdate:modelValue":b[10]||(b[10]=S=>ge.status=S),class:"field"},[(p(),m(le,null,Ie(f,S=>a("option",{key:S.value,value:S.value},w(S.label),9,R0)),64))],512),[[Ot,ge.status]])])]),a("label",B0,[b[26]||(b[26]=a("span",{class:"eyebrow mb-1 block"},"Notes",-1)),ie(a("textarea",{"onUpdate:modelValue":b[11]||(b[11]=S=>ge.notes=S),rows:"2",class:"field",placeholder:"Conditions, renewal contacts, anything worth recording"},null,512),[[me,ge.notes]])]),$.value?(p(),m("div",Z0,[...b[28]||(b[28]=[z(" Editing updates metadata only. To replace the file, close this and use ",-1),a("b",{class:"text-ink-secondary"},"New version",-1),z(" on the document — the old version is kept for audit. ",-1)])])):(p(),m("div",U0,[a("span",V0,"File "+w(Ye.value?"(new version)":"(optional)"),1),a("input",{ref_key:"fileInput",ref:ft,type:"file",class:"field",onChange:zt},null,544),b[27]||(b[27]=a("p",{class:"mt-1 text-xs text-ink-muted"}," Stored in PocketBase for now (object storage later). Max 50 MB. ",-1))])),a("div",H0,[a("button",{class:"btn-accent",disabled:Ue.value,onClick:At},w(Ue.value?"Saving…":$.value?"Save changes":Ye.value?"Upload new version":"Add document"),9,j0),a("button",{class:"btn-ghost",onClick:De},"Cancel"),pe.value?(p(),m("span",W0,w(pe.value),1)):I("",!0)])])):I("",!0),a("div",K0,[C.value?(p(),m("div",G0,"Loading…")):K.value.length?(p(),m("div",X0,[a("table",Q0,[a("thead",null,[a("tr",ew,[(p(),m(le,null,Ie(["Title","Type","Owner","Expiry","Ver",""],S=>a("th",{key:S,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},w(S),1)),64))])]),a("tbody",null,[(p(!0),m(le,null,Ie(K.value,S=>{var W,V;return p(),m(le,{key:S.id},[a("tr",{class:Ce(["border-b border-line last:border-0",$.value===S.id?"bg-accent-soft":""])},[a("td",tw,[a("div",nw,w(S.title),1),S.reference?(p(),m("div",iw,w(S.reference),1)):I("",!0)]),a("td",ow,w(Ee(l)[S.docType]||S.docType||"—"),1),a("td",sw,w(fe(S)),1),a("td",aw,[a("button",{class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",i[F(S).tone]]),onClick:G=>X(S.id)},[F(S).icon?(p(),nt(J,{key:0,name:F(S).icon,size:12},null,8,["name"])):I("",!0),z(" "+w(F(S).label),1)],10,rw),S.expiryDate?(p(),m("div",lw,w(S.expiryDate),1)):I("",!0)]),a("td",uw,"v"+w(S.version||1),1),a("td",cw,[Ut.value===S.id?(p(),m(le,{key:0},[b[29]||(b[29]=a("span",{class:"mr-2 text-xs text-ink-muted"},"Delete?",-1)),a("button",{class:"btn-ghost mr-1",onClick:b[12]||(b[12]=G=>Ut.value="")},"Cancel"),a("button",{class:"rounded bg-danger px-3 py-1.5 text-sm font-semibold text-white transition hover:brightness-110",onClick:G=>Pt(S)},"Delete",8,dw)],64)):(p(),m(le,{key:1},[S.hasFile?(p(),m("button",{key:0,class:"btn-ghost mr-1 inline-flex items-center gap-1",title:"Preview",onClick:G=>he(S)},[A(J,{name:"eye",size:13})],8,fw)):I("",!0),S.hasFile?(p(),m("a",{key:1,href:Ee(zr)(S.id),class:"btn-ghost mr-1 inline-flex items-center gap-1",title:"Download file"},[A(J,{name:"download",size:13})],8,hw)):I("",!0),a("button",{class:"btn-ghost mr-1 inline-flex items-center gap-1",title:"Upload new version",onClick:G=>Le(S)},[A(J,{name:"upload",size:13})],8,pw),a("button",{class:"btn-ghost mr-1 inline-flex items-center gap-1",onClick:G=>st(S)},[A(J,{name:"sliders",size:13}),b[30]||(b[30]=z(" Edit",-1))],8,mw),a("button",{class:"btn-ghost inline-flex items-center gap-1",onClick:G=>Ut.value=S.id},[A(J,{name:"trash",size:13})],8,gw)],64))])],2),te.value===S.id?(p(),m("tr",vw,[a("td",_w,[a("div",bw,[a("span",yw,[b[31]||(b[31]=z("Status: ",-1)),a("b",xw,w(S.status||"—"),1)]),a("span",ww,[b[32]||(b[32]=z("Access: ",-1)),a("b",kw,w(S.accessTier||"—"),1)]),S.jurisdiction?(p(),m("span",Sw,[b[33]||(b[33]=z("Jurisdiction: ",-1)),a("b",Tw,w(S.jurisdiction),1)])):I("",!0),S.issueDate?(p(),m("span",Pw,[b[34]||(b[34]=z("Issued: ",-1)),a("b",Cw,w(S.issueDate),1)])):I("",!0),S.expiryDate?(p(),m("span",Lw,[b[35]||(b[35]=z("Expires: ",-1)),a("b",Aw,w(S.expiryDate),1)])):I("",!0),a("span",Mw,[b[36]||(b[36]=z("File: ",-1)),a("b",Ew,w(S.hasFile?S.fileName:"none"),1)])]),(((W=S.expiry)==null?void 0:W.flags)||[]).length?(p(),m("ul",Ow,[(p(!0),m(le,null,Ie(S.expiry.flags,(G,re)=>(p(),m("li",{key:re,class:Ce(["flex items-start gap-2 text-xs",S.expiry.state==="expired"?"text-danger-fg":S.expiry.state==="expiring_soon"?"text-amber-fg":"text-ink-secondary"])},[A(J,{name:"alertTriangle",size:13,class:"mt-px shrink-0"}),z(" "+w(G),1)],2))),128))])):((V=S.expiry)==null?void 0:V.state)==="valid"?(p(),m("div",zw,"In force — no action needed.")):I("",!0),S.notes?(p(),m("div",$w,[b[37]||(b[37]=a("span",{class:"text-ink-muted"},"Notes:",-1)),z(" "+w(S.notes),1)])):I("",!0)])])):I("",!0)],64)}),128))])])])):(p(),m("div",q0,[A(J,{name:"fileText",size:26,class:"text-ink-muted"}),a("div",Y0,w(H.value==="all"?"No documents on file yet":"Nothing in this view"),1),a("div",J0,w(H.value==="all"?"Add certificates, registrations, insurance and authorisations to track their expiry.":"Try a different filter."),1)]))]),(p(),nt(cf,{to:"body"},[Oe.value?(p(),m("div",{key:0,class:"fixed inset-0 z-50 grid place-items-center p-4",style:{background:"color-mix(in srgb, black 60%, transparent)"},onClick:hl(Q,["self"])},[a("div",Iw,[a("div",Nw,[a("div",Dw,[a("div",Fw,w(Oe.value.title),1),a("div",Rw,w(Oe.value.fileName),1)]),a("div",Bw,[a("a",{href:Ze.value,target:"_blank",rel:"noopener",class:"btn-ghost inline-flex items-center gap-1.5",title:"Open in new tab"},[A(J,{name:"globe",size:14}),b[38]||(b[38]=z(" New tab ",-1))],8,Uw),a("a",{href:Ee(zr)(Oe.value.id),class:"btn-ghost inline-flex items-center gap-1.5",title:"Download"},[A(J,{name:"download",size:14}),b[39]||(b[39]=z(" Download ",-1))],8,Vw),a("button",{class:"btn-icon",title:"Close",onClick:Q},[A(J,{name:"x",size:16})])])]),a("div",Zw,[Te.value==="image"?(p(),m("img",{key:0,src:Ze.value,alt:Oe.value.title,class:"mx-auto block max-w-full"},null,8,Hw)):Te.value==="frame"?(p(),m("iframe",{key:1,src:Ze.value,class:"h-[74vh] w-full border-0 bg-white",title:Oe.value.title},null,8,jw)):(p(),m("div",Ww,[A(J,{name:"fileText",size:28,class:"text-ink-muted"}),b[41]||(b[41]=a("div",{class:"mt-3 text-sm font-medium text-ink-secondary"},"Preview isn't available for this file type",-1)),a("div",Kw,w(Oe.value.fileName),1),a("a",{href:Ee(zr)(Oe.value.id),class:"btn-accent mt-4 inline-flex items-center gap-2"},[A(J,{name:"download",size:15}),b[40]||(b[40]=z(" Download instead ",-1))],8,Gw)]))])])])):I("",!0)]))]))}},Yw={class:"grid h-full grid-cols-[248px_1fr] max-[900px]:grid-cols-1"},Jw={class:"flex flex-col border-r border-line bg-surface-1 px-4 py-5 max-[900px]:hidden"},Xw={class:"flex items-center gap-2.5 px-2 pb-5"},Qw={class:"flex flex-col gap-0.5"},e2=["onClick"],t2={class:"mt-auto flex flex-col gap-2.5"},n2={class:"rounded-lg bg-surface-2 p-3"},i2={class:"flex items-center gap-2"},o2={class:"text-xs font-semibold text-ink"},s2={class:"mt-1.5 block font-mono text-[10.5px] text-ink-muted"},a2={class:"flex items-center gap-2.5 px-2 py-1"},r2={class:"grid h-8 w-8 place-items-center rounded-full bg-[var(--navy-800)] text-xs font-bold text-white"},l2={class:"min-w-0 flex-1"},u2={class:"truncate text-[13px] font-semibold text-ink"},c2={class:"flex items-center gap-1.5 text-[11px] text-ink-muted"},d2=["title"],f2={class:"overflow-y-auto"},h2={class:"sticky top-0 z-10 flex items-center gap-4 border-b border-line px-7 py-3.5",style:{background:"color-mix(in srgb, var(--bg-app) 82%, transparent)","backdrop-filter":"blur(10px)"}},p2={class:"mt-0.5 text-[22px] font-bold tracking-tightest text-ink"},m2={class:"ml-auto flex items-center gap-3"},g2={class:"flex h-10 w-60 items-center gap-2 rounded border border-line-strong bg-surface-1 px-3 max-[1100px]:hidden"},v2={key:0,class:"mx-auto flex max-w-[1240px] flex-col gap-5 p-7"},_2={class:"grid grid-cols-4 gap-4 max-[1100px]:grid-cols-2 max-[560px]:grid-cols-1"},b2={class:"flex items-center justify-between"},y2={class:"eyebrow"},x2={class:"mt-2.5 text-[34px] font-bold leading-none tracking-tightest text-ink"},w2={class:"grid grid-cols-[1.6fr_1fr] gap-5 max-[1100px]:grid-cols-1"},k2={class:"panel p-5"},S2={class:"mb-3.5 flex items-center justify-between"},T2={class:"flex items-center gap-2"},P2={class:"relative z-[1200]"},C2={class:"panel absolute right-0 z-[1200] mt-1.5 w-72 p-3.5 shadow-lg"},L2={class:"flex items-center justify-between gap-3"},A2={class:"mb-1.5 flex items-center justify-between"},M2={class:"font-mono text-[11px] text-ink-muted"},E2=["value"],O2={key:0,class:"mt-1.5 text-[11px] text-ink-muted"},z2={key:0,class:"mt-2.5 text-xs text-ink-muted"},$2={key:1,class:"mt-2.5 text-xs text-ink-muted"},I2={key:2,class:"mt-2.5 text-xs text-ink-muted"},N2={class:"flex flex-col gap-5"},D2={class:"panel p-5"},F2={class:"mb-3.5 flex items-center justify-between"},R2={class:"flex items-center gap-3"},B2={class:"text-5xl leading-none"},U2={class:"min-w-0"},V2={class:"flex items-baseline gap-1"},Z2={class:"text-[34px] font-bold leading-none tracking-tightest text-ink"},H2={class:"text-lg font-semibold text-ink-secondary"},j2={class:"mt-1 truncate text-sm capitalize text-ink-secondary"},W2={class:"mt-1.5 truncate text-xs text-ink-muted"},K2={class:"mt-4 grid grid-cols-2 gap-2.5"},G2={class:"rounded-lg bg-surface-2 px-3 py-2"},q2={class:"mt-0.5 font-mono text-sm text-ink"},Y2={class:"rounded-lg bg-surface-2 px-3 py-2"},J2={class:"mt-0.5 font-mono text-sm text-ink"},X2={class:"rounded-lg bg-surface-2 px-3 py-2"},Q2={class:"mt-0.5 font-mono text-sm text-ink"},ek={key:0},tk={class:"rounded-lg bg-surface-2 px-3 py-2"},nk={class:"mt-0.5 font-mono text-sm text-ink"},ik={key:0},ok={key:0,class:"mt-3 text-[11px] text-ink-muted"},sk={key:1,class:"grid place-items-center py-8 text-center"},ak={class:"mt-0.5 text-xs text-ink-muted"},rk={key:2,class:"grid place-items-center py-8 text-center text-sm text-ink-muted"},lk={class:"panel p-5"},uk={class:"mb-3.5 flex items-center justify-between"},ck={class:"grid place-items-center py-10 text-center"},dk={class:"panel overflow-hidden p-0"},fk={class:"flex items-center justify-between px-5 py-4"},hk={class:"flex gap-2"},pk={key:0,class:"px-5 py-12 text-center text-sm text-ink-muted"},mk={key:1,class:"overflow-x-auto"},gk={class:"w-full border-collapse text-sm"},vk={class:"text-left"},_k=["onClick"],bk={class:"px-5 py-3 font-mono font-bold text-ink"},yk={class:"px-5 py-3 text-ink-secondary"},xk={class:"px-5 py-3"},wk={class:"px-5 py-3 font-mono text-ink-secondary"},kk={class:"px-5 py-3"},Sk={key:0,class:"flex items-center gap-2"},Tk={class:"h-1.5 w-12 overflow-hidden rounded bg-surface-2"},Pk={class:"font-mono text-xs text-ink-secondary"},Ck={key:1,class:"font-mono text-xs text-ink-muted"},Lk={class:"px-5 py-3 font-mono text-ink-secondary"},Ak={class:"px-5 py-3 text-right"},Mk=["onClick"],Ek={key:1,class:"p-7"},Ok={class:"mb-4 flex flex-wrap items-center gap-3"},zk={class:"font-mono text-mode font-bold text-ink"},$k={key:0,class:"rounded-full bg-danger-soft px-2.5 py-0.5 font-mono text-[10px] font-bold uppercase tracking-caps text-danger-fg"},Ik={key:1,class:"ml-auto flex flex-wrap gap-1.5"},Nk=["onClick"],Dk={key:0,class:"panel grid place-items-center p-16 text-center"},Fk={class:"pill"},Rk={class:"pill"},Bk={class:"pill"},Uk={class:"mt-1 text-sm font-semibold text-ink"},Vk={class:"pill"},Zk={class:"mt-1 font-mono text-sm font-bold tabular text-ink"},Hk={class:"grid grid-cols-2 gap-4 max-[820px]:grid-cols-1"},jk={class:"panel p-4"},Wk={class:"flex items-center gap-4"},Kk={class:"h-9 flex-1 overflow-hidden rounded border border-line bg-surface-2"},Gk={class:"readout"},qk={class:"panel p-4"},Yk={class:"readout"},Jk={class:"panel p-4"},Xk={class:"space-y-1.5 text-sm"},Qk={class:"flex justify-between"},eS={class:"text-ink"},tS={class:"flex justify-between"},nS={class:"text-ink"},iS={class:"flex justify-between"},oS={class:"font-mono tabular text-ink"},sS={class:"flex justify-between"},aS={class:"font-mono tabular text-ink"},rS={class:"panel p-4"},lS={class:"space-y-1.5 text-sm"},uS={class:"flex justify-between"},cS={class:"font-mono tabular text-ink"},dS={class:"flex justify-between"},fS={class:"font-mono tabular text-ink"},hS={class:"flex justify-between"},pS={class:"font-mono tabular text-ink"},mS={class:"panel col-span-2 p-4 max-[820px]:col-span-1"},gS={class:"panel p-4"},vS={class:"flex flex-wrap gap-2"},_S={class:"mt-2 min-h-[16px] text-xs text-ink-muted"},bS={class:"panel p-4"},yS={class:"h-[180px] overflow-y-auto font-mono text-xs"},xS={class:"text-ink-muted"},wS={class:"font-semibold text-accent"},kS={class:"break-all text-ink"},SS={key:6,class:"p-7"},TS={class:"panel grid place-items-center p-16 text-center"},PS={class:"mt-3 text-sm font-medium text-ink-secondary"},CS={key:0,class:"mt-1 text-xs text-ink-muted"},LS={key:1,class:"mt-1 text-xs text-ink-muted"},AS="34,-25,72,45",MS=600*1e3,ES={__name:"Dashboard",props:{email:{type:String,default:""},role:{type:String,default:"user"},organization:{type:String,default:""},organizationName:{type:String,default:""}},emits:["logout"],setup(t,{emit:i}){const s=t,l=i,u=gt({}),f=gt({}),h=Y(null),_=Y(!1),y=gt([]),C=Y(""),T=Y([]),M=gt({unavailable:!1,detail:"",loaded:!1,plan:"",recommendedInterval:30}),H=ce(()=>T.value.filter(U=>!U.onGround).length),j=Y(!1);let K=null;const F=[{value:"auto",label:"Auto"},{value:5,label:"5s"},{value:10,label:"10s"},{value:15,label:"15s"},{value:30,label:"30s"},{value:60,label:"60s"},{value:120,label:"120s"}],te=ce(()=>{if(be.airTrafficInterval==="auto")return M.recommendedInterval||30;const U=Number(be.airTrafficInterval);return Number.isFinite(U)&&U>0?U:30}),X=Y(null);let fe=!1;function Se(){if(!(fe||X.value!==null)){if(typeof navigator>"u"||!navigator.geolocation){X.value=!1;return}fe=!0,navigator.geolocation.getCurrentPosition(U=>{X.value={lat:U.coords.latitude,lng:U.coords.longitude},fe=!1},()=>{X.value=!1,fe=!1},{timeout:8e3,maximumAge:6e5})}}function de(U,E,Me){const tt=U&&U.telemetry||{},It=tt[E],St=tt[Me];return typeof It=="number"&&typeof St=="number"&&(It||St)?{lat:It,lng:St}:null}function Fe(){const U=de(W.value,"latitude","longitude")||S.value.map(tt=>de(u[tt],"latitude","longitude")).find(Boolean);if(U){const tt=$r(U.lat,U.lng);if(tt)return tt.bbox}const E=de(W.value,"phoneLatitude","phoneLongitude")||S.value.map(tt=>de(u[tt],"phoneLatitude","phoneLongitude")).find(Boolean);if(E){const tt=$r(E.lat,E.lng);if(tt)return tt.bbox}if(Se(),X.value){const tt=$r(X.value.lat,X.value.lng);if(tt)return tt.bbox}const Me=xm(be.region);return Me||AS}async function Oe(){if(!be.showAirTraffic)return;const U=be.autoBbox?Fe():void 0,{states:E,unavailable:Me,detail:tt,plan:It,recommendedInterval:St}=await mp(U);T.value=E,M.unavailable=Me,M.detail=tt,M.plan=It||"",St&&(M.recommendedInterval=St),M.loaded=!0}function Te(){K&&clearInterval(K),K=setInterval(()=>{Le.value==="Overview"&&be.showAirTraffic&&Oe()},te.value*1e3)}function Ze(){Oe(),Te()}function he(){K&&clearInterval(K),K=null}const Q=gt({loaded:!1,unavailable:!1,detail:"",data:null,units:"metric",source:"",updatedAt:0});let B=null;function O(){const U=de(W.value,"latitude","longitude")||S.value.map(Me=>de(u[Me],"latitude","longitude")).find(Boolean);if(U)return{lat:U.lat,lng:U.lng,source:"drone"};const E=de(W.value,"phoneLatitude","phoneLongitude")||S.value.map(Me=>de(u[Me],"phoneLatitude","phoneLongitude")).find(Boolean);return E?{lat:E.lat,lng:E.lng,source:"phone"}:X.value?{lat:X.value.lat,lng:X.value.lng,source:"browser"}:null}async function N(){const U=O(),E=await Sp(U?U.lat:void 0,U?U.lng:void 0);if(Q.loaded=!0,Q.units=E.units||"metric",E.unavailable||!E.weather){Q.unavailable=!0,Q.detail=E.detail||"Weather is unavailable.",Q.data=null;return}Q.unavailable=!1,Q.detail="",Q.data=E.weather,Q.source=U?U.source:"default",Q.updatedAt=Date.now()}function $(){B&&clearInterval(B),B=setInterval(()=>{Le.value==="Overview"&&N()},MS)}function Ye(){N(),$()}function we(){B&&clearInterval(B),B=null}const ge=ce(()=>Q.units==="imperial"?"°F":Q.units==="standard"?"K":"°C"),ue=ce(()=>Q.units==="imperial"?"mph":"m/s");function ft(U){const E=(U||"").slice(0,2);return E==="01"?(U||"").endsWith("n")?"🌙":"☀️":{"02":"🌤️","03":"⛅","04":"☁️","09":"🌧️",10:"🌦️",11:"⛈️",13:"❄️",50:"🌫️"}[E]||"🌡️"}const pe=ce(()=>ft(Q.data&&Q.data.icon)),Ue=ce(()=>{const U=Q.data;return U?U.country?`${U.location}, ${U.country}`:U.location||"Unknown location":""}),Ve=ce(()=>Q.source==="drone"?"at aircraft location":Q.source==="phone"||Q.source==="browser"?"at your location":"default location"),wt=ce(()=>Q.updatedAt?new Date(Q.updatedAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"");function st(U,E=0){return typeof U=="number"?U.toFixed(E):"—"}const Le=Y("Overview"),De=[["grid","Overview"],["radio","Live flights"],["route","Routes"],["calendar","Schedule"],["drone","Drones"],["book","Logbook"],["fileText","Documents"],["server","Drives"],["settings","Settings"]],zt=ce(()=>(De.find(([,U])=>U===Le.value)||["grid"])[0]),At=Y(""),Ut=Y(""),Pt=Y("");let kt=null,x=null,b=!1;const S=ce(()=>Object.keys(u).sort((U,E)=>(u[E].online?1:0)-(u[U].online?1:0)||U.localeCompare(E))),W=ce(()=>h.value?u[h.value]:null),V=ce(()=>W.value&&W.value.telemetry||{}),G=ce(()=>!!(W.value&&W.value.online)),re=ce(()=>{const U=V.value;return typeof U.latitude=="number"&&typeof U.longitude=="number"&&(U.latitude||U.longitude)?{lat:U.latitude,lng:U.longitude}:null}),ae=ce(()=>h.value&&f[h.value]||[]),oe=ce(()=>{const U=V.value;return typeof U.velocityX=="number"&&typeof U.velocityY=="number"?Math.hypot(U.velocityX,U.velocityY):null});function ee(U){return U.online?U.connected?["In flight","success"]:["Standby","accent"]:["Offline","neutral"]}function ve(U){const E=U&&U.telemetry||{};return typeof E.velocityX=="number"&&typeof E.velocityY=="number"?Math.hypot(E.velocityX,E.velocityY):null}const se=ce(()=>S.value.map(U=>{const E=u[U],Me=E.telemetry||{},[tt,It]=ee(E);return{id:U,mission:E.model||(E.connected?"Drone linked":E.online?"App online":"No signal"),status:tt,tone:It,alt:typeof Me.altitude=="number"?Me.altitude.toFixed(0)+" m":"—",battery:typeof Me.batteryPercent=="number"?Me.batteryPercent:null,speed:ve(E)}})),ke=ce(()=>S.value.map(U=>u[U].connected?u[U].serial:"").filter(Boolean)),Pe=ce(()=>S.value.filter(U=>u[U].online).length),Re=ce(()=>S.value.filter(U=>u[U].online&&u[U].connected).length),Ke=ce(()=>S.value.filter(U=>!u[U].online).length),Ge=ce(()=>{const U=S.value.map(E=>{var Me;return(Me=u[E].telemetry)==null?void 0:Me.batteryPercent}).filter(E=>typeof E=="number");return U.length?Math.round(U.reduce((E,Me)=>E+Me,0)/U.length):null}),pt=ce(()=>[{label:"Active flights",value:String(Re.value),delta:`${Pe.value} online`,tone:"success",icon:"radio"},{label:"Avg battery",value:Ge.value==null?"—":Ge.value+"%",delta:Ge.value==null?"no telemetry":Ge.value<40?"low — watch":"nominal",tone:Ge.value!=null&&Ge.value<40?"danger":"neutral",icon:"battery"},{label:"Fleet size",value:String(S.value.length),delta:`${Re.value} in flight`,tone:"neutral",icon:"grid"},{label:"Offline",value:String(Ke.value),delta:Ke.value?"needs attention":"all reachable",tone:Ke.value?"warning":"success",icon:"signal"}]),ht={success:"bg-success-soft text-success-fg",warning:"bg-amber-soft text-amber-fg",danger:"bg-danger-soft text-danger-fg",accent:"bg-accent-soft text-accent-soft-fg",neutral:"bg-surface-2 text-ink-secondary"},Vt={success:"text-success-fg",danger:"text-danger-fg",warning:"text-amber-fg",neutral:"text-ink-muted",accent:"text-accent-soft-fg"},Jt=ce(()=>{var Me,tt,It;const E=(s.email||"PV").split("@")[0].split(/[.\-_ ]+/).filter(Boolean);return((((Me=E[0])==null?void 0:Me[0])||"P")+(((tt=E[1])==null?void 0:tt[0])||((It=E[0])==null?void 0:It[1])||"V")).toUpperCase()}),Zt={superadmin:"Superadmin",admin:"Admin",user:"Operator"},pn=ce(()=>Zt[s.role]||"Operator"),Ct=ce(()=>s.organizationName||(s.role==="superadmin"?"All organizations":"No organization")),$t=new Set,kn=Y(null);async function zi(U){var It,St,Et;if(!U.connected||!U.serial)return;const E={serial:U.serial,model:U.model||"",firmware:U.firmware||"",controllerFirmware:U.controllerFirmware||""},Me=[E.serial,E.model,E.firmware,E.controllerFirmware].join("|");if($t.has(Me))return;$t.add(Me);const tt=await Pp(E);if(!tt.ok){(tt.status===0||tt.status>=500)&&$t.delete(Me);return}((It=tt.body)!=null&&It.created||(St=tt.body)!=null&&St.updated)&&((Et=kn.value)==null||Et.reload())}function at(U){if(U)for(const E of $t)E.startsWith(`${U}|`)&&$t.delete(E)}function Sn(U){var Me;u[U.deviceId]=U,zi(U);const E=U.telemetry||{};typeof E.latitude=="number"&&typeof E.longitude=="number"&&(E.latitude||E.longitude)&&(f[U.deviceId]||(f[U.deviceId]=[]),f[U.deviceId].push([E.latitude,E.longitude]),f[U.deviceId].length>1e3&&f[U.deviceId].shift()),(!h.value||U.online&&!((Me=u[h.value])!=null&&Me.online))&&(h.value=U.deviceId)}function $i(U){delete u[U],delete f[U],h.value===U&&(h.value=S.value[0]||null)}function rt(U){y.unshift({t:ku(Date.now()),tag:U.type||"?",text:JSON.stringify(hi(U))}),y.length>200&&y.pop()}function hi(U){const E={...U};return delete E.type,E}function pi(){const U=location.protocol==="https:"?"wss":"ws";kt=new WebSocket(`${U}://${location.host}/bff/ws`),kt.onopen=()=>_.value=!0,kt.onclose=()=>{_.value=!1,b||(x=setTimeout(pi,1500))},kt.onerror=()=>kt&&kt.close(),kt.onmessage=E=>{let Me;try{Me=JSON.parse(E.data)}catch{return}Me.type==="snapshot"?(Me.devices||[]).forEach(Sn):Me.type==="update"&&Me.device?(Sn(Me.device),Me.event&&Me.device.deviceId===h.value&&rt(Me.event)):Me.type==="removed"&&Me.deviceId&&$i(Me.deviceId)}}async function Ii(){if(!h.value)return Pt.value="No device selected.";if(!At.value.trim())return Pt.value="Enter a command name.";let U;if(Ut.value.trim())try{U=JSON.parse(Ut.value)}catch{return Pt.value="Payload is not valid JSON."}const{ok:E,body:Me}=await Rp(h.value,At.value.trim(),U);Pt.value=E?`Sent "${At.value.trim()}".`:`Error: ${Me.error||"failed"}`}function Gt(U,E,Me=""){return typeof U=="number"?U.toFixed(E)+Me:"—"}function jn(U){h.value=U,Le.value="Live flights"}return Bt(Le,U=>{U==="Overview"&&(Oe(),N())}),Bt(()=>be.showAirTraffic,U=>{U?Oe():T.value=[]}),Bt(te,Te),fi(async()=>{(await np()).forEach(Sn),pi(),Ze(),Ye()}),us(()=>{b=!0,x&&clearTimeout(x),kt&&kt.close(),he(),we()}),(U,E)=>{var Me,tt,It,St,Et;return p(),m("div",Yw,[a("aside",Jw,[a("div",Xw,[A(nd,{size:26}),E[11]||(E[11]=a("span",{class:"text-[19px] tracking-tightest"},[a("span",{class:"font-medium text-ink-secondary"},"Pilot"),a("span",{class:"font-bold text-ink"},"Vault")],-1))]),a("nav",Qw,[(p(),m(le,null,Ie(De,([Z,_t])=>a("button",{key:_t,class:Ce(["flex items-center gap-3 rounded px-3 py-2.5 text-left text-sm transition",Le.value===_t?"bg-accent-soft font-semibold text-accent-soft-fg":"font-medium text-ink-secondary hover:bg-surface-2"]),onClick:bt=>Le.value=_t},[A(J,{name:Z,size:18,stroke:Le.value===_t?2.2:1.8},null,8,["name","stroke"]),z(" "+w(_t),1)],10,e2)),64))]),a("div",t2,[a("div",n2,[a("div",i2,[a("span",{class:Ce(["h-2 w-2 rounded-full",_.value?"bg-ready":"bg-caution"])},null,2),a("span",o2,w(_.value?"Link healthy":"Reconnecting…"),1)]),a("span",s2,"API gateway · "+w(_.value?"streaming":"retrying"),1)]),a("div",a2,[a("div",r2,w(Jt.value),1),a("div",l2,[a("div",u2,w(t.email||"Operator"),1),a("div",c2,[A(J,{name:"grid",size:11,class:"shrink-0"}),a("span",{class:"truncate",title:`${pn.value} · ${Ct.value}`},w(pn.value)+" · "+w(Ct.value),9,d2)])]),a("button",{class:"text-ink-muted transition hover:text-ink",title:"Log out","aria-label":"Log out",onClick:E[0]||(E[0]=Z=>l("logout"))},[A(J,{name:"logout",size:16})])])])]),a("main",f2,[a("header",h2,[a("div",null,[E[12]||(E[12]=a("div",{class:"eyebrow"},"Live operations",-1)),a("h1",p2,w(Le.value),1)]),a("div",m2,[a("div",g2,[A(J,{name:"search",size:16,class:"text-ink-muted"}),ie(a("input",{"onUpdate:modelValue":E[1]||(E[1]=Z=>C.value=Z),placeholder:"Search drones, routes…",class:"w-full border-none bg-transparent text-sm text-ink outline-none placeholder:text-ink-muted"},null,512),[[me,C.value]])]),a("button",{class:"btn-accent flex items-center gap-2",onClick:E[2]||(E[2]=Z=>Le.value="Live flights")},[A(J,{name:"radio",size:16}),E[13]||(E[13]=z(" Live flights ",-1))])])]),Le.value==="Overview"?(p(),m("div",v2,[a("div",_2,[(p(!0),m(le,null,Ie(pt.value,Z=>(p(),m("div",{key:Z.label,class:"panel p-5"},[a("div",b2,[a("span",y2,w(Z.label),1),A(J,{name:Z.icon,size:16,class:"text-ink-muted"},null,8,["name"])]),a("div",x2,w(Z.value),1),a("span",{class:Ce(["mt-2 block font-mono text-[11px]",Vt[Z.tone]])},w(Z.delta),3)]))),128))]),a("div",w2,[a("div",k2,[a("div",S2,[E[18]||(E[18]=a("div",null,[a("div",{class:"eyebrow"},"Airspace"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Live map")],-1)),a("div",T2,[Ee(be).showAirTraffic&&H.value?(p(),m("span",{key:0,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",ht.accent]),title:"Live aircraft from OpenSky Network"},[A(J,{name:"radio",size:12}),z(w(H.value)+" aircraft ",1)],2)):I("",!0),Re.value?(p(),m("span",{key:1,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",ht.success])},[E[14]||(E[14]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Re.value)+" drones ",1)],2)):I("",!0),a("div",P2,[a("button",{type:"button",class:Ce(["grid h-7 w-7 place-items-center rounded-md text-ink-muted transition hover:bg-surface-2 hover:text-ink",j.value?"bg-surface-2 text-ink":""]),title:"Map settings","aria-label":"Map settings",onClick:E[3]||(E[3]=Z=>j.value=!j.value)},[A(J,{name:"settings",size:16})],2),j.value?(p(),m(le,{key:0},[a("div",{class:"fixed inset-0 z-[1190]",onClick:E[4]||(E[4]=Z=>j.value=!1)}),a("div",C2,[E[17]||(E[17]=a("div",{class:"eyebrow mb-2.5"},"Map settings",-1)),a("label",L2,[E[15]||(E[15]=a("span",{class:"text-sm text-ink-secondary"},"Show live air traffic",-1)),A(nn,{modelValue:Ee(be).showAirTraffic,"onUpdate:modelValue":E[5]||(E[5]=Z=>Ee(be).showAirTraffic=Z)},null,8,["modelValue"])]),a("div",{class:Ce(["mt-3.5",Ee(be).showAirTraffic?"":"pointer-events-none opacity-40"])},[a("div",A2,[E[16]||(E[16]=a("span",{class:"text-sm text-ink-secondary"},"Refresh interval",-1)),a("span",M2,"every "+w(te.value)+"s",1)]),ie(a("select",{"onUpdate:modelValue":E[6]||(E[6]=Z=>Ee(be).airTrafficInterval=Z),class:"field"},[(p(),m(le,null,Ie(F,Z=>a("option",{key:Z.value,value:Z.value},w(Z.label)+w(Z.value==="auto"?` (plan: ${M.recommendedInterval}s)`:""),9,E2)),64))],512),[[Ot,Ee(be).airTrafficInterval]]),M.plan?(p(),m("p",O2," OpenSky plan: "+w(M.plan),1)):I("",!0)],2)])],64)):I("",!0)])])]),A(Cu,{position:re.value,trail:ae.value,aircraft:Ee(be).showAirTraffic?T.value:[]},null,8,["position","trail","aircraft"]),Ee(be).showAirTraffic?M.loaded&&M.unavailable?(p(),m("p",$2,w(M.detail||"Live air traffic is unavailable."),1)):(p(),m("p",I2," Live air traffic from OpenSky Network · updates every "+w(te.value)+"s ",1)):(p(),m("p",z2," Live air traffic hidden · enable it in Map settings "))]),a("div",N2,[a("div",D2,[a("div",F2,[E[19]||(E[19]=a("div",null,[a("div",{class:"eyebrow"},"Conditions"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Weather")],-1)),A(J,{name:"sun",size:16,class:"text-ink-muted"})]),Q.data?(p(),m(le,{key:0},[a("div",R2,[a("div",B2,w(pe.value),1),a("div",U2,[a("div",V2,[a("span",Z2,w(st(Q.data.temp)),1),a("span",H2,w(ge.value),1)]),a("div",j2,w(Q.data.description||"—"),1)])]),a("div",W2,w(Ue.value)+" · "+w(Ve.value),1),a("div",K2,[a("div",G2,[E[20]||(E[20]=a("div",{class:"eyebrow"},"Feels like",-1)),a("div",q2,w(st(Q.data.feelsLike))+w(ge.value),1)]),a("div",Y2,[E[21]||(E[21]=a("div",{class:"eyebrow"},"Wind",-1)),a("div",J2,w(st(Q.data.windSpeed,1))+" "+w(ue.value),1)]),a("div",X2,[E[22]||(E[22]=a("div",{class:"eyebrow"},"Humidity",-1)),a("div",Q2,[z(w(st(Q.data.humidity)),1),Q.data.humidity!=null?(p(),m("span",ek,"%")):I("",!0)])]),a("div",tk,[E[23]||(E[23]=a("div",{class:"eyebrow"},"Cloud cover",-1)),a("div",nk,[z(w(st(Q.data.clouds)),1),Q.data.clouds!=null?(p(),m("span",ik,"%")):I("",!0)])])]),wt.value?(p(),m("div",ok,"Updated "+w(wt.value)+" · OpenWeather",1)):I("",!0)],64)):Q.loaded&&Q.unavailable?(p(),m("div",sk,[A(J,{name:"sun",size:24,class:"text-ink-muted"}),E[24]||(E[24]=a("div",{class:"mt-2 text-sm font-medium text-ink-secondary"},"Weather unavailable",-1)),a("div",ak,w(Q.detail),1)])):(p(),m("div",rk," Loading weather… "))]),a("div",lk,[a("div",uk,[E[25]||(E[25]=a("div",null,[a("div",{class:"eyebrow"},"Today"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Schedule")],-1)),A(J,{name:"clock",size:16,class:"text-ink-muted"})]),a("div",ck,[A(J,{name:"calendar",size:24,class:"text-ink-muted"}),E[26]||(E[26]=a("div",{class:"mt-2 text-sm font-medium text-ink-secondary"},"No missions scheduled",-1)),E[27]||(E[27]=a("div",{class:"mt-0.5 text-xs text-ink-muted"},"Scheduling is not wired to a backend yet.",-1))])])])]),a("div",dk,[a("div",fk,[E[30]||(E[30]=a("div",null,[a("div",{class:"eyebrow"},"Fleet"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Aircraft status")],-1)),a("div",hk,[a("span",{class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",ht.success])},[E[28]||(E[28]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Re.value)+" in flight ",1)],2),Ke.value?(p(),m("span",{key:0,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",ht.warning])},[E[29]||(E[29]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Ke.value)+" offline ",1)],2)):I("",!0)])]),se.value.length?(p(),m("div",mk,[a("table",gk,[a("thead",null,[a("tr",vk,[(p(),m(le,null,Ie(["Aircraft","Mission","Status","Alt","Battery","Speed",""],Z=>a("th",{key:Z,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},w(Z),1)),64))])]),a("tbody",null,[(p(!0),m(le,null,Ie(se.value,(Z,_t)=>(p(),m("tr",{key:Z.id,class:Ce(["cursor-pointer transition hover:bg-surface-2",_tjn(Z.id)},[a("td",bk,w(Z.id),1),a("td",yk,w(Z.mission),1),a("td",xk,[a("span",{class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",ht[Z.tone]])},[E[31]||(E[31]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Z.status),1)],2)]),a("td",wk,w(Z.alt),1),a("td",kk,[Z.battery!=null?(p(),m("div",Sk,[a("div",Tk,[a("div",{class:Ce(["h-full",Z.battery<40?"bg-caution":"bg-ready"]),style:Eo({width:Z.battery+"%"})},null,6)]),a("span",Pk,w(Z.battery)+"%",1)])):(p(),m("span",Ck,"—"))]),a("td",Lk,[z(w(Z.speed==null?"—":Z.speed.toFixed(1))+" ",1),E[32]||(E[32]=a("span",{class:"text-ink-muted"},"m/s",-1))]),a("td",Ak,[a("button",{class:"btn-ghost inline-flex items-center gap-1.5 whitespace-nowrap",onClick:hl(bt=>jn(Z.id),["stop"])},[A(J,{name:"play",size:14}),E[33]||(E[33]=z(" Track ",-1))],8,Mk)])],10,_k))),128))])])])):(p(),m("div",pk," No aircraft connected yet. Devices appear here as they come online. "))])])):Le.value==="Live flights"?(p(),m("div",Ek,[a("div",Ok,[a("span",zk,w(h.value||"No device selected"),1),W.value&&!G.value?(p(),m("span",$k,"Offline")):I("",!0),S.value.length?(p(),m("div",Ik,[(p(!0),m(le,null,Ie(S.value,Z=>(p(),m("button",{key:Z,class:Ce(["flex items-center gap-2 rounded border px-3 py-1.5 font-mono text-xs font-bold transition",Z===h.value?"border-accent bg-accent-soft text-accent-soft-fg":"border-line bg-surface-1 text-ink-secondary hover:border-line-strong"]),onClick:_t=>h.value=Z},[a("span",{class:Ce(["h-2 w-2 rounded-full",u[Z].online?"bg-ready":"bg-ink-muted"])},null,2),z(" "+w(Z),1)],10,Nk))),128))])):I("",!0)]),S.value.length?(p(),m(le,{key:1},[a("div",{class:Ce(["mb-4 grid gap-3",!G.value&&W.value?"opacity-60":""]),style:{"grid-template-columns":"repeat(auto-fit, minmax(150px, 1fr))"}},[a("div",Fk,[E[36]||(E[36]=a("div",{class:"eyebrow"},"Registration",-1)),a("div",{class:Ce(["mt-1 text-sm font-semibold",G.value?((Me=W.value)==null?void 0:Me.registration)==="success"?"text-success-fg":"text-danger-fg":"text-ink"])},w(G.value&&((tt=W.value)!=null&&tt.registration)?W.value.registration:"—"),3)]),a("div",Rk,[E[37]||(E[37]=a("div",{class:"eyebrow"},"Drone link",-1)),a("div",{class:Ce(["mt-1 text-sm font-semibold",G.value?(It=W.value)!=null&&It.connected?"text-success-fg":"text-danger-fg":"text-ink"])},w(W.value?G.value?W.value.connected?"connected":"no drone":"app offline":"—"),3)]),a("div",Bk,[E[38]||(E[38]=a("div",{class:"eyebrow"},"Model",-1)),a("div",Uk,w(((St=W.value)==null?void 0:St.model)||"—"),1)]),a("div",Vk,[E[39]||(E[39]=a("div",{class:"eyebrow"},"Last update",-1)),a("div",Zk,w((Et=W.value)!=null&&Et.lastSeenMs?Ee(ku)(W.value.lastSeenMs):"—"),1)])],2),a("div",Hk,[a("div",jk,[E[41]||(E[41]=a("div",{class:"mb-3 eyebrow"},"Battery",-1)),a("div",Wk,[a("div",Kk,[a("div",{class:Ce(["h-full transition-all",typeof V.value.batteryPercent=="number"?V.value.batteryPercent<20?"bg-warning":V.value.batteryPercent<40?"bg-caution":"bg-ready":""]),style:Eo({width:(typeof V.value.batteryPercent=="number"?V.value.batteryPercent:0)+"%"})},null,6)]),a("div",Gk,[z(w(typeof V.value.batteryPercent=="number"?V.value.batteryPercent:"—"),1),E[40]||(E[40]=a("span",{class:"text-sm text-ink-secondary"},"%",-1))])])]),a("div",qk,[E[43]||(E[43]=a("div",{class:"mb-3 eyebrow"},"Altitude",-1)),a("div",Yk,[z(w(Gt(V.value.altitude,1)),1),E[42]||(E[42]=a("span",{class:"text-sm text-ink-secondary"}," m",-1))])]),a("div",Jk,[E[48]||(E[48]=a("div",{class:"mb-3 eyebrow"},"Flight",-1)),a("div",Xk,[a("div",Qk,[E[44]||(E[44]=a("span",{class:"text-ink-secondary"},"Mode",-1)),a("b",eS,w(V.value.flightMode||"—"),1)]),a("div",tS,[E[45]||(E[45]=a("span",{class:"text-ink-secondary"},"Flying",-1)),a("b",nS,w(V.value.isFlying==null?"—":V.value.isFlying?"yes":"no"),1)]),a("div",iS,[E[46]||(E[46]=a("span",{class:"text-ink-secondary"},"GPS sats",-1)),a("b",oS,w(V.value.satelliteCount==null?"—":V.value.satelliteCount),1)]),a("div",sS,[E[47]||(E[47]=a("span",{class:"text-ink-secondary"},"Speed (H)",-1)),a("b",aS,w(oe.value==null?"—":Gt(oe.value,2," m/s")),1)])])]),a("div",rS,[E[52]||(E[52]=a("div",{class:"mb-3 eyebrow"},"Position",-1)),a("div",lS,[a("div",uS,[E[49]||(E[49]=a("span",{class:"text-ink-secondary"},"Latitude",-1)),a("b",cS,w(Gt(V.value.latitude,6)),1)]),a("div",dS,[E[50]||(E[50]=a("span",{class:"text-ink-secondary"},"Longitude",-1)),a("b",fS,w(Gt(V.value.longitude,6)),1)]),a("div",hS,[E[51]||(E[51]=a("span",{class:"text-ink-secondary"},"Vert. speed",-1)),a("b",pS,w(Gt(typeof V.value.velocityZ=="number"?-V.value.velocityZ:void 0,2," m/s")),1)])])]),a("div",mS,[E[53]||(E[53]=a("div",{class:"mb-3 eyebrow"},"Track",-1)),A(Cu,{position:re.value,trail:ae.value},null,8,["position","trail"])]),a("div",gS,[E[54]||(E[54]=a("div",{class:"mb-3 eyebrow"},"Send command",-1)),a("div",vS,[ie(a("input",{"onUpdate:modelValue":E[7]||(E[7]=Z=>At.value=Z),class:"field flex-1",placeholder:"command (e.g. startConnection)"},null,512),[[me,At.value]]),ie(a("input",{"onUpdate:modelValue":E[8]||(E[8]=Z=>Ut.value=Z),class:"field flex-1",placeholder:"payload JSON (optional)"},null,512),[[me,Ut.value]]),a("button",{class:"btn-accent",onClick:Ii},"Send")]),a("div",_S,w(Pt.value),1)]),a("div",bS,[E[55]||(E[55]=a("div",{class:"mb-3 eyebrow"},"Event log",-1)),a("div",yS,[(p(!0),m(le,null,Ie(y,(Z,_t)=>(p(),m("div",{key:_t,class:"border-b border-line py-1"},[a("span",xS,w(Z.t),1),a("span",wS,w(Z.tag),1),a("span",kS,w(Z.text),1)]))),128))])])])],64)):(p(),m("div",Dk,[A(J,{name:"radio",size:28,class:"text-ink-muted"}),E[34]||(E[34]=a("div",{class:"mt-3 text-sm font-medium text-ink-secondary"},"No aircraft online",-1)),E[35]||(E[35]=a("div",{class:"mt-1 text-xs text-ink-muted"},"Live telemetry appears here once a drone connects.",-1))]))])):Le.value==="Logbook"?(p(),nt(gx,{key:2,email:t.email,role:t.role,organization:t.organization,"organization-name":t.organizationName},null,8,["email","role","organization","organization-name"])):Le.value==="Drones"?(p(),nt(c0,{key:3,ref_key:"dronesView",ref:kn,"connected-serials":ke.value,onDeleted:at},null,8,["connected-serials"])):Le.value==="Documents"?(p(),nt(qw,{key:4,email:t.email,role:t.role,organization:t.organization,"organization-name":t.organizationName},null,8,["email","role","organization","organization-name"])):Le.value==="Settings"?(p(),nt(ey,{key:5,email:t.email,role:t.role,organization:t.organization,"organization-name":t.organizationName,onLogout:E[9]||(E[9]=Z=>l("logout"))},null,8,["email","role","organization","organization-name"])):(p(),m("div",SS,[a("div",TS,[A(J,{name:zt.value,size:28,class:"text-ink-muted"},null,8,["name"]),a("div",PS,w(Le.value),1),Le.value==="Drives"?(p(),m("div",CS,[E[56]||(E[56]=z(" Browse and transfer files here once a drive is connected. Configure drives in ",-1)),a("button",{class:"font-semibold text-accent hover:underline",onClick:E[10]||(E[10]=Z=>Le.value="Settings")},"Settings → Integrations"),E[57]||(E[57]=z(". ",-1))])):(p(),m("div",LS,"This section is part of the console shell and has no backend yet."))])]))])])}}},OS={key:0,class:"h-full"},zS={key:1,class:"grid h-full place-items-center text-ink-muted text-sm"},$S={__name:"App",setup(t){const i=Y(!1),s=Y(null),l=Y("user"),u=Y(""),f=Y(""),h=Y("");function _(T){l.value=T&&T.role||"user",u.value=T&&T.organization||"",f.value=T&&T.organizationName||""}fi(async()=>{h.value=(await Qh()).apiBase||"";const T=await _u();T&&(s.value=T.email,_(T),await Tu()),i.value=!0});async function y(T){s.value=T,_(await _u()),await Tu()}async function C(){Hp(),await tp(),s.value=null,l.value="user",u.value="",f.value=""}return(T,M)=>i.value?(p(),m("div",OS,[s.value?(p(),nt(ES,{key:0,email:s.value,role:l.value,organization:u.value,"organization-name":f.value,onLogout:C},null,8,["email","role","organization","organization-name"])):(p(),nt(rm,{key:1,"default-api-base":h.value,onSignedIn:y},null,8,["default-api-base"]))])):(p(),m("div",zS,"Loading…"))}};qh($S).mount("#app"); + */var um=Fs.exports,Pu;function cm(){return Pu||(Pu=1,(function(t,i){(function(s,l){l(i)})(um,(function(s){var l="1.9.4";function u(e){var n,o,r,d;for(o=1,r=arguments.length;o"u"||!L||!L.Mixin)){e=Se(e)?e:[e];for(var n=0;n0?Math.floor(e):Math.ceil(e)};ue.prototype={clone:function(){return new ue(this.x,this.y)},add:function(e){return this.clone()._add(pe(e))},_add:function(e){return this.x+=e.x,this.y+=e.y,this},subtract:function(e){return this.clone()._subtract(pe(e))},_subtract:function(e){return this.x-=e.x,this.y-=e.y,this},divideBy:function(e){return this.clone()._divideBy(e)},_divideBy:function(e){return this.x/=e,this.y/=e,this},multiplyBy:function(e){return this.clone()._multiplyBy(e)},_multiplyBy:function(e){return this.x*=e,this.y*=e,this},scaleBy:function(e){return new ue(this.x*e.x,this.y*e.y)},unscaleBy:function(e){return new ue(this.x/e.x,this.y/e.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=ft(this.x),this.y=ft(this.y),this},distanceTo:function(e){e=pe(e);var n=e.x-this.x,o=e.y-this.y;return Math.sqrt(n*n+o*o)},equals:function(e){return e=pe(e),e.x===this.x&&e.y===this.y},contains:function(e){return e=pe(e),Math.abs(e.x)<=Math.abs(this.x)&&Math.abs(e.y)<=Math.abs(this.y)},toString:function(){return"Point("+H(this.x)+", "+H(this.y)+")"}};function pe(e,n,o){return e instanceof ue?e:Se(e)?new ue(e[0],e[1]):e==null?e:typeof e=="object"&&"x"in e&&"y"in e?new ue(e.x,e.y):new ue(e,n,o)}function Ue(e,n){if(e)for(var o=n?[e,n]:e,r=0,d=o.length;r=this.min.x&&o.x<=this.max.x&&n.y>=this.min.y&&o.y<=this.max.y},intersects:function(e){e=Ve(e);var n=this.min,o=this.max,r=e.min,d=e.max,v=d.x>=n.x&&r.x<=o.x,P=d.y>=n.y&&r.y<=o.y;return v&&P},overlaps:function(e){e=Ve(e);var n=this.min,o=this.max,r=e.min,d=e.max,v=d.x>n.x&&r.xn.y&&r.y=n.lat&&d.lat<=o.lat&&r.lng>=n.lng&&d.lng<=o.lng},intersects:function(e){e=st(e);var n=this._southWest,o=this._northEast,r=e.getSouthWest(),d=e.getNorthEast(),v=d.lat>=n.lat&&r.lat<=o.lat,P=d.lng>=n.lng&&r.lng<=o.lng;return v&&P},overlaps:function(e){e=st(e);var n=this._southWest,o=this._northEast,r=e.getSouthWest(),d=e.getNorthEast(),v=d.lat>n.lat&&r.latn.lng&&r.lng1,jn=(function(){var e=!1;try{var n=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassiveEventSupport",M,n),window.removeEventListener("testPassiveEventSupport",M,n)}catch{}return e})(),U=(function(){return!!document.createElement("canvas").getContext})(),E=!!(document.createElementNS&&W("svg").createSVGRect),Me=!!E&&(function(){var e=document.createElement("div");return e.innerHTML="",(e.firstChild&&e.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),tt=!E&&(function(){try{var e=document.createElement("div");e.innerHTML='';var n=e.firstChild;return n.style.behavior="url(#default#VML)",n&&typeof n.adj=="object"}catch{return!1}})(),It=navigator.platform.indexOf("Mac")===0,St=navigator.platform.indexOf("Linux")===0;function Et(e){return navigator.userAgent.toLowerCase().indexOf(e)>=0}var Z={ie:re,ielt9:ae,edge:oe,webkit:ee,android:ve,android23:se,androidStock:Pe,opera:Re,chrome:Ke,gecko:Ge,safari:pt,phantom:ht,opera12:Vt,win:Jt,ie3d:Zt,webkit3d:pn,gecko3d:Ct,any3d:$t,mobile:kn,mobileWebkit:zi,mobileWebkit3d:at,msPointer:Sn,pointer:$i,touch:hi,touchNative:rt,mobileOpera:pi,mobileGecko:Ii,retina:Gt,passiveEvents:jn,canvas:U,svg:E,vml:tt,inlineSvg:Me,mac:It,linux:St},_t=Z.msPointer?"MSPointerDown":"pointerdown",bt=Z.msPointer?"MSPointerMove":"pointermove",oa=Z.msPointer?"MSPointerUp":"pointerup",cs=Z.msPointer?"MSPointerCancel":"pointercancel",no={touchstart:_t,touchmove:bt,touchend:oa,touchcancel:cs},sa={touchstart:ds,touchmove:Wn,touchend:Wn,touchcancel:Wn},Ni={},aa=!1;function ir(e,n,o){return n==="touchstart"&<(),sa[n]?(o=sa[n].bind(this,o),e.addEventListener(no[n],o,!1),o):(console.warn("wrong event specified:",n),M)}function ra(e,n,o){if(!no[n]){console.warn("wrong event specified:",n);return}e.removeEventListener(no[n],o,!1)}function or(e){Ni[e.pointerId]=e}function sr(e){Ni[e.pointerId]&&(Ni[e.pointerId]=e)}function la(e){delete Ni[e.pointerId]}function lt(){aa||(document.addEventListener(_t,or,!0),document.addEventListener(bt,sr,!0),document.addEventListener(oa,la,!0),document.addEventListener(cs,la,!0),aa=!0)}function Wn(e,n){if(n.pointerType!==(n.MSPOINTER_TYPE_MOUSE||"mouse")){n.touches=[];for(var o in Ni)n.touches.push(Ni[o]);n.changedTouches=[n],e(n)}}function ds(e,n){n.MSPOINTER_TYPE_TOUCH&&n.pointerType===n.MSPOINTER_TYPE_TOUCH&&Ft(n),Wn(e,n)}function Xt(e){var n={},o,r;for(r in e)o=e[r],n[r]=o&&o.bind?o.bind(e):o;return e=n,n.type="dblclick",n.detail=2,n.isTrusted=!1,n._simulated=!0,n}var io=200;function zo(e,n){e.addEventListener("dblclick",n);var o=0,r;function d(v){if(v.detail!==1){r=v.detail;return}if(!(v.pointerType==="mouse"||v.sourceCapabilities&&!v.sourceCapabilities.firesTouchEvents)){var P=da(v);if(!(P.some(function(R){return R instanceof HTMLLabelElement&&R.attributes.for})&&!P.some(function(R){return R instanceof HTMLInputElement||R instanceof HTMLSelectElement}))){var D=Date.now();D-o<=io?(r++,r===2&&n(Xt(v))):r=1,o=D}}}return e.addEventListener("click",d),{dblclick:n,simDblclick:d}}function $o(e,n){e.removeEventListener("dblclick",n.dblclick),e.removeEventListener("click",n.simDblclick)}var Tn=Fo(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),$n=Fo(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),ua=$n==="webkitTransition"||$n==="OTransition"?$n+"End":"transitionend";function Io(e){return typeof e=="string"?document.getElementById(e):e}function mi(e,n){var o=e.style[n]||e.currentStyle&&e.currentStyle[n];if((!o||o==="auto")&&document.defaultView){var r=document.defaultView.getComputedStyle(e,null);o=r?r[n]:null}return o==="auto"?null:o}function it(e,n,o){var r=document.createElement(e);return r.className=n||"",o&&o.appendChild(r),r}function ot(e){var n=e.parentNode;n&&n.removeChild(e)}function Pn(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function Cn(e){var n=e.parentNode;n&&n.lastChild!==e&&n.appendChild(e)}function qt(e){var n=e.parentNode;n&&n.firstChild!==e&&n.insertBefore(e,n.firstChild)}function No(e,n){if(e.classList!==void 0)return e.classList.contains(n);var o=Do(e);return o.length>0&&new RegExp("(^|\\s)"+n+"(\\s|$)").test(o)}function He(e,n){if(e.classList!==void 0)for(var o=K(n),r=0,d=o.length;r0?2*window.devicePixelRatio:1;function fa(e){return Z.edge?e.wheelDeltaY/2:e.deltaY&&e.deltaMode===0?-e.deltaY/vs:e.deltaY&&e.deltaMode===1?-e.deltaY*20:e.deltaY&&e.deltaMode===2?-e.deltaY*60:e.deltaX||e.deltaZ?0:e.wheelDelta?(e.wheelDeltaY||e.wheelDelta)/2:e.detail&&Math.abs(e.detail)<32765?-e.detail*20:e.detail?e.detail/-32765*60:0}function Ae(e,n){var o=n.relatedTarget;if(!o)return!0;try{for(;o&&o!==e;)o=o.parentNode}catch{return!1}return o!==e}var Vi={__proto__:null,on:ze,off:Je,stopPropagation:_i,disableScrollPropagation:gs,disableClickPropagation:Bi,preventDefault:Ft,stop:bi,getPropagationPath:da,getMousePosition:Ui,getWheelDelta:fa,isExternalTarget:Ae,addListener:ze,removeListener:Je},so=ge.extend({run:function(e,n,o,r){this.stop(),this._el=e,this._inProgress=!0,this._duration=o||.25,this._easeOutPower=1/Math.max(r||.5,.2),this._startPos=Xe(e),this._offset=n.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=B(this._animate,this),this._step()},_step:function(e){var n=+new Date-this._startTime,o=this._duration*1e3;nthis.options.maxZoom)?this.setZoom(e):this},panInsideBounds:function(e,n){this._enforcingBounds=!0;var o=this.getCenter(),r=this._limitCenter(o,this._zoom,st(e));return o.equals(r)||this.panTo(r,n),this._enforcingBounds=!1,this},panInside:function(e,n){n=n||{};var o=pe(n.paddingTopLeft||n.padding||[0,0]),r=pe(n.paddingBottomRight||n.padding||[0,0]),d=this.project(this.getCenter()),v=this.project(e),P=this.getPixelBounds(),D=Ve([P.min.add(o),P.max.subtract(r)]),R=D.getSize();if(!D.contains(v)){this._enforcingBounds=!0;var ne=v.subtract(D.getCenter()),_e=D.extend(v).getSize().subtract(R);d.x+=ne.x<0?-_e.x:_e.x,d.y+=ne.y<0?-_e.y:_e.y,this.panTo(this.unproject(d),n),this._enforcingBounds=!1}return this},invalidateSize:function(e){if(!this._loaded)return this;e=u({animate:!1,pan:!0},e===!0?{animate:!0}:e);var n=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var o=this.getSize(),r=n.divideBy(2).round(),d=o.divideBy(2).round(),v=r.subtract(d);return!v.x&&!v.y?this:(e.animate&&e.pan?this.panBy(v):(e.pan&&this._rawPanBy(v),this.fire("move"),e.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(h(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:n,newSize:o}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(e){if(e=this._locateOptions=u({timeout:1e4,watch:!1},e),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var n=h(this._handleGeolocationResponse,this),o=h(this._handleGeolocationError,this);return e.watch?this._locationWatchId=navigator.geolocation.watchPosition(n,o,e):navigator.geolocation.getCurrentPosition(n,o,e),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(e){if(this._container._leaflet_id){var n=e.code,o=e.message||(n===1?"permission denied":n===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:n,message:"Geolocation error: "+o+"."})}},_handleGeolocationResponse:function(e){if(this._container._leaflet_id){var n=e.coords.latitude,o=e.coords.longitude,r=new Le(n,o),d=r.toBounds(e.coords.accuracy*2),v=this._locateOptions;if(v.setView){var P=this.getBoundsZoom(d);this.setView(r,v.maxZoom?Math.min(P,v.maxZoom):P)}var D={latlng:r,bounds:d,timestamp:e.timestamp};for(var R in e.coords)typeof e.coords[R]=="number"&&(D[R]=e.coords[R]);this.fire("locationfound",D)}},addHandler:function(e,n){if(!n)return this;var o=this[e]=new n(this);return this._handlers.push(o),this.options[e]&&o.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),ot(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(O(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var e;for(e in this._layers)this._layers[e].remove();for(e in this._panes)ot(this._panes[e]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(e,n){var o="leaflet-pane"+(e?" leaflet-"+e.replace("Pane","")+"-pane":""),r=it("div",o,n||this._mapPane);return e&&(this._panes[e]=r),r},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var e=this.getPixelBounds(),n=this.unproject(e.getBottomLeft()),o=this.unproject(e.getTopRight());return new wt(n,o)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(e,n,o){e=st(e),o=pe(o||[0,0]);var r=this.getZoom()||0,d=this.getMinZoom(),v=this.getMaxZoom(),P=e.getNorthWest(),D=e.getSouthEast(),R=this.getSize().subtract(o),ne=Ve(this.project(D,r),this.project(P,r)).getSize(),_e=Z.any3d?this.options.zoomSnap:1,Ne=R.x/ne.x,et=R.y/ne.y,un=n?Math.max(Ne,et):Math.min(Ne,et);return r=this.getScaleZoom(un,r),_e&&(r=Math.round(r/(_e/100))*(_e/100),r=n?Math.ceil(r/_e)*_e:Math.floor(r/_e)*_e),Math.max(d,Math.min(v,r))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new ue(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(e,n){var o=this._getTopLeftPoint(e,n);return new Ue(o,o.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(e){return this.options.crs.getProjectedBounds(e===void 0?this.getZoom():e)},getPane:function(e){return typeof e=="string"?this._panes[e]:e},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(e,n){var o=this.options.crs;return n=n===void 0?this._zoom:n,o.scale(e)/o.scale(n)},getScaleZoom:function(e,n){var o=this.options.crs;n=n===void 0?this._zoom:n;var r=o.zoom(e*o.scale(n));return isNaN(r)?1/0:r},project:function(e,n){return n=n===void 0?this._zoom:n,this.options.crs.latLngToPoint(De(e),n)},unproject:function(e,n){return n=n===void 0?this._zoom:n,this.options.crs.pointToLatLng(pe(e),n)},layerPointToLatLng:function(e){var n=pe(e).add(this.getPixelOrigin());return this.unproject(n)},latLngToLayerPoint:function(e){var n=this.project(De(e))._round();return n._subtract(this.getPixelOrigin())},wrapLatLng:function(e){return this.options.crs.wrapLatLng(De(e))},wrapLatLngBounds:function(e){return this.options.crs.wrapLatLngBounds(st(e))},distance:function(e,n){return this.options.crs.distance(De(e),De(n))},containerPointToLayerPoint:function(e){return pe(e).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(e){return pe(e).add(this._getMapPanePos())},containerPointToLatLng:function(e){var n=this.containerPointToLayerPoint(pe(e));return this.layerPointToLatLng(n)},latLngToContainerPoint:function(e){return this.layerPointToContainerPoint(this.latLngToLayerPoint(De(e)))},mouseEventToContainerPoint:function(e){return Ui(e,this._container)},mouseEventToLayerPoint:function(e){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e))},mouseEventToLatLng:function(e){return this.layerPointToLatLng(this.mouseEventToLayerPoint(e))},_initContainer:function(e){var n=this._container=Io(e);if(n){if(n._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");ze(n,"scroll",this._onScroll,this),this._containerId=y(n)},_initLayout:function(){var e=this._container;this._fadeAnimated=this.options.fadeAnimation&&Z.any3d,He(e,"leaflet-container"+(Z.touch?" leaflet-touch":"")+(Z.retina?" leaflet-retina":"")+(Z.ielt9?" leaflet-oldie":"")+(Z.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var n=mi(e,"position");n!=="absolute"&&n!=="relative"&&n!=="fixed"&&n!=="sticky"&&(e.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var e=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Mt(this._mapPane,new ue(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(He(e.markerPane,"leaflet-zoom-hide"),He(e.shadowPane,"leaflet-zoom-hide"))},_resetView:function(e,n,o){Mt(this._mapPane,new ue(0,0));var r=!this._loaded;this._loaded=!0,n=this._limitZoom(n),this.fire("viewprereset");var d=this._zoom!==n;this._moveStart(d,o)._move(e,n)._moveEnd(d),this.fire("viewreset"),r&&this.fire("load")},_moveStart:function(e,n){return e&&this.fire("zoomstart"),n||this.fire("movestart"),this},_move:function(e,n,o,r){n===void 0&&(n=this._zoom);var d=this._zoom!==n;return this._zoom=n,this._lastCenter=e,this._pixelOrigin=this._getNewPixelOrigin(e),r?o&&o.pinch&&this.fire("zoom",o):((d||o&&o.pinch)&&this.fire("zoom",o),this.fire("move",o)),this},_moveEnd:function(e){return e&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return O(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(e){Mt(this._mapPane,this._getMapPanePos().subtract(e))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(e){this._targets={},this._targets[y(this._container)]=this;var n=e?Je:ze;n(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&n(window,"resize",this._onResize,this),Z.any3d&&this.options.transform3DLimit&&(e?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){O(this._resizeRequest),this._resizeRequest=B(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var e=this._getMapPanePos();Math.max(Math.abs(e.x),Math.abs(e.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(e,n){for(var o=[],r,d=n==="mouseout"||n==="mouseover",v=e.target||e.srcElement,P=!1;v;){if(r=this._targets[y(v)],r&&(n==="click"||n==="preclick")&&this._draggableMoved(r)){P=!0;break}if(r&&r.listens(n,!0)&&(d&&!Ae(v,e)||(o.push(r),d))||v===this._container)break;v=v.parentNode}return!o.length&&!P&&!d&&this.listens(n,!0)&&(o=[this]),o},_isClickDisabled:function(e){for(;e&&e!==this._container;){if(e._leaflet_disable_click)return!0;e=e.parentNode}},_handleDOMEvent:function(e){var n=e.target||e.srcElement;if(!(!this._loaded||n._leaflet_disable_events||e.type==="click"&&this._isClickDisabled(n))){var o=e.type;o==="mousedown"&&Ro(n),this._fireDOMEvent(e,o)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(e,n,o){if(e.type==="click"){var r=u({},e);r.type="preclick",this._fireDOMEvent(r,r.type,o)}var d=this._findEventTargets(e,n);if(o){for(var v=[],P=0;P0?Math.round(e-n)/2:Math.max(0,Math.ceil(e))-Math.max(0,Math.floor(n))},_limitZoom:function(e){var n=this.getMinZoom(),o=this.getMaxZoom(),r=Z.any3d?this.options.zoomSnap:1;return r&&(e=Math.round(e/r)*r),Math.max(n,Math.min(o,e))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Lt(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(e,n){var o=this._getCenterOffset(e)._trunc();return(n&&n.animate)!==!0&&!this.getSize().contains(o)?!1:(this.panBy(o,n),!0)},_createAnimProxy:function(){var e=this._proxy=it("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(e),this.on("zoomanim",function(n){var o=Tn,r=this._proxy.style[o];gi(this._proxy,this.project(n.center,n.zoom),this.getZoomScale(n.zoom,1)),r===this._proxy.style[o]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ot(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var e=this.getCenter(),n=this.getZoom();gi(this._proxy,this.project(e,n),this.getZoomScale(n,1))},_catchTransitionEnd:function(e){this._animatingZoom&&e.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(e,n,o){if(this._animatingZoom)return!0;if(o=o||{},!this._zoomAnimated||o.animate===!1||this._nothingToAnimate()||Math.abs(n-this._zoom)>this.options.zoomAnimationThreshold)return!1;var r=this.getZoomScale(n),d=this._getCenterOffset(e)._divideBy(1-1/r);return o.animate!==!0&&!this.getSize().contains(d)?!1:(B(function(){this._moveStart(!0,o.noMoveStart||!1)._animateZoom(e,n,!0)},this),!0)},_animateZoom:function(e,n,o,r){this._mapPane&&(o&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=n,He(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:e,zoom:n,noUpdate:r}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(h(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Lt(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Vo(e,n){return new qe(e,n)}var en=$.extend({options:{position:"topright"},initialize:function(e){F(this,e)},getPosition:function(){return this.options.position},setPosition:function(e){var n=this._map;return n&&n.removeControl(this),this.options.position=e,n&&n.addControl(this),this},getContainer:function(){return this._container},addTo:function(e){this.remove(),this._map=e;var n=this._container=this.onAdd(e),o=this.getPosition(),r=e._controlCorners[o];return He(n,"leaflet-control"),o.indexOf("bottom")!==-1?r.insertBefore(n,r.firstChild):r.appendChild(n),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(ot(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(e){this._map&&e&&e.screenX>0&&e.screenY>0&&this._map.getContainer().focus()}}),ln=function(e){return new en(e)};qe.include({addControl:function(e){return e.addTo(this),this},removeControl:function(e){return e.remove(),this},_initControlPos:function(){var e=this._controlCorners={},n="leaflet-",o=this._controlContainer=it("div",n+"control-container",this._container);function r(d,v){var P=n+d+" "+n+v;e[d+v]=it("div",P,o)}r("top","left"),r("top","right"),r("bottom","left"),r("bottom","right")},_clearControlPos:function(){for(var e in this._controlCorners)ot(this._controlCorners[e]);ot(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var yi=en.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(e,n,o,r){return o1,this._baseLayersList.style.display=e?"":"none"),this._separator.style.display=n&&e?"":"none",this},_onLayerChange:function(e){this._handlingClick||this._update();var n=this._getLayer(y(e.target)),o=n.overlay?e.type==="add"?"overlayadd":"overlayremove":e.type==="add"?"baselayerchange":null;o&&this._map.fire(o,n)},_createRadioElement:function(e,n){var o='",r=document.createElement("div");return r.innerHTML=o,r.firstChild},_addItem:function(e){var n=document.createElement("label"),o=this._map.hasLayer(e.layer),r;e.overlay?(r=document.createElement("input"),r.type="checkbox",r.className="leaflet-control-layers-selector",r.defaultChecked=o):r=this._createRadioElement("leaflet-base-layers_"+y(this),o),this._layerControlInputs.push(r),r.layerId=y(e.layer),ze(r,"click",this._onInputClick,this);var d=document.createElement("span");d.innerHTML=" "+e.name;var v=document.createElement("span");n.appendChild(v),v.appendChild(r),v.appendChild(d);var P=e.overlay?this._overlaysList:this._baseLayersList;return P.appendChild(n),this._checkDisabledLayers(),n},_onInputClick:function(){if(!this._preventClick){var e=this._layerControlInputs,n,o,r=[],d=[];this._handlingClick=!0;for(var v=e.length-1;v>=0;v--)n=e[v],o=this._getLayer(n.layerId).layer,n.checked?r.push(o):n.checked||d.push(o);for(v=0;v=0;d--)n=e[d],o=this._getLayer(n.layerId).layer,n.disabled=o.options.minZoom!==void 0&&ro.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var e=this._section;this._preventClick=!0,ze(e,"click",Ft),this.expand();var n=this;setTimeout(function(){Je(e,"click",Ft),n._preventClick=!1})}}),ao=function(e,n,o){return new yi(e,n,o)},Zo=en.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(e){var n="leaflet-control-zoom",o=it("div",n+" leaflet-bar"),r=this.options;return this._zoomInButton=this._createButton(r.zoomInText,r.zoomInTitle,n+"-in",o,this._zoomIn),this._zoomOutButton=this._createButton(r.zoomOutText,r.zoomOutTitle,n+"-out",o,this._zoomOut),this._updateDisabled(),e.on("zoomend zoomlevelschange",this._updateDisabled,this),o},onRemove:function(e){e.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(e){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(e.shiftKey?3:1))},_createButton:function(e,n,o,r,d){var v=it("a",o,r);return v.innerHTML=e,v.href="#",v.title=n,v.setAttribute("role","button"),v.setAttribute("aria-label",n),Bi(v),ze(v,"click",bi),ze(v,"click",d,this),ze(v,"click",this._refocusOnMap,this),v},_updateDisabled:function(){var e=this._map,n="leaflet-disabled";Lt(this._zoomInButton,n),Lt(this._zoomOutButton,n),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||e._zoom===e.getMinZoom())&&(He(this._zoomOutButton,n),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||e._zoom===e.getMaxZoom())&&(He(this._zoomInButton,n),this._zoomInButton.setAttribute("aria-disabled","true"))}});qe.mergeOptions({zoomControl:!0}),qe.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Zo,this.addControl(this.zoomControl))});var _s=function(e){return new Zo(e)},Ho=en.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(e){var n="leaflet-control-scale",o=it("div",n),r=this.options;return this._addScales(r,n+"-line",o),e.on(r.updateWhenIdle?"moveend":"move",this._update,this),e.whenReady(this._update,this),o},onRemove:function(e){e.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(e,n,o){e.metric&&(this._mScale=it("div",n,o)),e.imperial&&(this._iScale=it("div",n,o))},_update:function(){var e=this._map,n=e.getSize().y/2,o=e.distance(e.containerPointToLatLng([0,n]),e.containerPointToLatLng([this.options.maxWidth,n]));this._updateScales(o)},_updateScales:function(e){this.options.metric&&e&&this._updateMetric(e),this.options.imperial&&e&&this._updateImperial(e)},_updateMetric:function(e){var n=this._getRoundNum(e),o=n<1e3?n+" m":n/1e3+" km";this._updateScale(this._mScale,o,n/e)},_updateImperial:function(e){var n=e*3.2808399,o,r,d;n>5280?(o=n/5280,r=this._getRoundNum(o),this._updateScale(this._iScale,r+" mi",r/o)):(d=this._getRoundNum(n),this._updateScale(this._iScale,d+" ft",d/n))},_updateScale:function(e,n,o){e.style.width=Math.round(this.options.maxWidth*o)+"px",e.innerHTML=n},_getRoundNum:function(e){var n=Math.pow(10,(Math.floor(e)+"").length-1),o=e/n;return o=o>=10?10:o>=5?5:o>=3?3:o>=2?2:1,n*o}}),ar=function(e){return new Ho(e)},gn='',Zi=en.extend({options:{position:"bottomright",prefix:''+(Z.inlineSvg?gn+" ":"")+"Leaflet"},initialize:function(e){F(this,e),this._attributions={}},onAdd:function(e){e.attributionControl=this,this._container=it("div","leaflet-control-attribution"),Bi(this._container);for(var n in e._layers)e._layers[n].getAttribution&&this.addAttribution(e._layers[n].getAttribution());return this._update(),e.on("layeradd",this._addAttribution,this),this._container},onRemove:function(e){e.off("layeradd",this._addAttribution,this)},_addAttribution:function(e){e.layer.getAttribution&&(this.addAttribution(e.layer.getAttribution()),e.layer.once("remove",function(){this.removeAttribution(e.layer.getAttribution())},this))},setPrefix:function(e){return this.options.prefix=e,this._update(),this},addAttribution:function(e){return e?(this._attributions[e]||(this._attributions[e]=0),this._attributions[e]++,this._update(),this):this},removeAttribution:function(e){return e?(this._attributions[e]&&(this._attributions[e]--,this._update()),this):this},_update:function(){if(this._map){var e=[];for(var n in this._attributions)this._attributions[n]&&e.push(n);var o=[];this.options.prefix&&o.push(this.options.prefix),e.length&&o.push(e.join(", ")),this._container.innerHTML=o.join(' ')}}});qe.mergeOptions({attributionControl:!0}),qe.addInitHook(function(){this.options.attributionControl&&new Zi().addTo(this)});var ha=function(e){return new Zi(e)};en.Layers=yi,en.Zoom=Zo,en.Scale=Ho,en.Attribution=Zi,ln.layers=ao,ln.zoom=_s,ln.scale=ar,ln.attribution=ha;var An=$.extend({initialize:function(e){this._map=e},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});An.addTo=function(e,n){return e.addHandler(n,this),this};var rr={Events:we},bs=Z.touch?"touchstart mousedown":"mousedown",vn=ge.extend({options:{clickTolerance:3},initialize:function(e,n,o,r){F(this,r),this._element=e,this._dragStartTarget=n||e,this._preventOutline=o},enable:function(){this._enabled||(ze(this._dragStartTarget,bs,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(vn._dragging===this&&this.finishDrag(!0),Je(this._dragStartTarget,bs,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(e){if(this._enabled&&(this._moved=!1,!No(this._element,"leaflet-zoom-anim"))){if(e.touches&&e.touches.length!==1){vn._dragging===this&&this.finishDrag();return}if(!(vn._dragging||e.shiftKey||e.which!==1&&e.button!==1&&!e.touches)&&(vn._dragging=this,this._preventOutline&&Ro(this._element),Di(),In(),!this._moving)){this.fire("down");var n=e.touches?e.touches[0]:e,o=Bo(this._element);this._startPoint=new ue(n.clientX,n.clientY),this._startPos=Xe(this._element),this._parentScale=hs(o);var r=e.type==="mousedown";ze(document,r?"mousemove":"touchmove",this._onMove,this),ze(document,r?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(e){if(this._enabled){if(e.touches&&e.touches.length>1){this._moved=!0;return}var n=e.touches&&e.touches.length===1?e.touches[0]:e,o=new ue(n.clientX,n.clientY)._subtract(this._startPoint);!o.x&&!o.y||Math.abs(o.x)+Math.abs(o.y)v&&(P=D,v=R);v>o&&(n[P]=1,ws(e,n,o,r,P),ws(e,n,o,P,d))}function va(e,n){for(var o=[e[0]],r=1,d=0,v=e.length;rn&&(o.push(e[r]),d=r);return dn.max.x&&(o|=2),e.yn.max.y&&(o|=8),o}function ks(e,n){var o=n.x-e.x,r=n.y-e.y;return o*o+r*r}function We(e,n,o,r){var d=n.x,v=n.y,P=o.x-d,D=o.y-v,R=P*P+D*D,ne;return R>0&&(ne=((e.x-d)*P+(e.y-v)*D)/R,ne>1?(d=o.x,v=o.y):ne>0&&(d+=P*ne,v+=D*ne)),P=e.x-d,D=e.y-v,r?P*P+D*D:new ue(d,v)}function yt(e){return!Se(e[0])||typeof e[0][0]!="object"&&typeof e[0][0]<"u"}function xi(e){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),yt(e)}function Ss(e,n){var o,r,d,v,P,D,R,ne;if(!e||e.length===0)throw new Error("latlngs not passed");yt(e)||(console.warn("latlngs are not flat! Only the first ring will be used"),e=e[0]);var _e=De([0,0]),Ne=st(e),et=Ne.getNorthWest().distanceTo(Ne.getSouthWest())*Ne.getNorthEast().distanceTo(Ne.getNorthWest());et<1700&&(_e=ys(e));var un=e.length,Wt=[];for(o=0;or){R=(v-r)/d,ne=[D.x-R*(D.x-P.x),D.y-R*(D.y-P.y)];break}var xn=n.unproject(pe(ne));return De([xn.lat+_e.lat,xn.lng+_e.lng])}var dr={__proto__:null,simplify:xs,pointToSegmentDistance:ga,closestPointOnSegment:ur,clipSegment:jo,_getEdgeIntersection:Hi,_getBitCode:Nn,_sqClosestPointOnSegment:We,isFlat:yt,_flat:xi,polylineCenter:Ss},ro={project:function(e){return new ue(e.lng,e.lat)},unproject:function(e){return new Le(e.y,e.x)},bounds:new Ue([-180,-90],[180,90])},Ts={R:6378137,R_MINOR:6356752314245179e-9,bounds:new Ue([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(e){var n=Math.PI/180,o=this.R,r=e.lat*n,d=this.R_MINOR/o,v=Math.sqrt(1-d*d),P=v*Math.sin(r),D=Math.tan(Math.PI/4-r/2)/Math.pow((1-P)/(1+P),v/2);return r=-o*Math.log(Math.max(D,1e-10)),new ue(e.lng*n*o,r)},unproject:function(e){for(var n=180/Math.PI,o=this.R,r=this.R_MINOR/o,d=Math.sqrt(1-r*r),v=Math.exp(-e.y/o),P=Math.PI/2-2*Math.atan(v),D=0,R=.1,ne;D<15&&Math.abs(R)>1e-7;D++)ne=d*Math.sin(P),ne=Math.pow((1-ne)/(1+ne),d/2),R=Math.PI/2-2*Math.atan(v*ne)-P,P+=R;return new Le(P*n,e.x*n/o)}},fr={__proto__:null,LonLat:ro,Mercator:Ts,SphericalMercator:Pt},hr=u({},At,{code:"EPSG:3395",projection:Ts,transformation:(function(){var e=.5/(Math.PI*Ts.R);return x(e,.5,-e,.5)})()}),ba=u({},At,{code:"EPSG:4326",projection:ro,transformation:x(1/180,1,-1/180,.5)}),lo=u({},zt,{projection:ro,transformation:x(1,0,-1,0),scale:function(e){return Math.pow(2,e)},zoom:function(e){return Math.log(e)/Math.LN2},distance:function(e,n){var o=n.lng-e.lng,r=n.lat-e.lat;return Math.sqrt(o*o+r*r)},infinite:!0});zt.Earth=At,zt.EPSG3395=hr,zt.EPSG3857=b,zt.EPSG900913=S,zt.EPSG4326=ba,zt.Simple=lo;var _n=ge.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(e){return e.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(e){return e&&e.removeLayer(this),this},getPane:function(e){return this._map.getPane(e?this.options[e]||e:this.options.pane)},addInteractiveTarget:function(e){return this._map._targets[y(e)]=this,this},removeInteractiveTarget:function(e){return delete this._map._targets[y(e)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(e){var n=e.target;if(n.hasLayer(this)){if(this._map=n,this._zoomAnimated=n._zoomAnimated,this.getEvents){var o=this.getEvents();n.on(o,this),this.once("remove",function(){n.off(o,this)},this)}this.onAdd(n),this.fire("add"),n.fire("layeradd",{layer:this})}}});qe.include({addLayer:function(e){if(!e._layerAdd)throw new Error("The provided object is not a Layer.");var n=y(e);return this._layers[n]?this:(this._layers[n]=e,e._mapToAdd=this,e.beforeAdd&&e.beforeAdd(this),this.whenReady(e._layerAdd,e),this)},removeLayer:function(e){var n=y(e);return this._layers[n]?(this._loaded&&e.onRemove(this),delete this._layers[n],this._loaded&&(this.fire("layerremove",{layer:e}),e.fire("remove")),e._map=e._mapToAdd=null,this):this},hasLayer:function(e){return y(e)in this._layers},eachLayer:function(e,n){for(var o in this._layers)e.call(n,this._layers[o]);return this},_addLayers:function(e){e=e?Se(e)?e:[e]:[];for(var n=0,o=e.length;nthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&n[0]instanceof Le&&n[0].equals(n[o-1])&&n.pop(),n},_setLatLngs:function(e){tn.prototype._setLatLngs.call(this,e),yt(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return yt(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var e=this._renderer._bounds,n=this.options.weight,o=new ue(n,n);if(e=new Ue(e.min.subtract(o),e.max.add(o)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(e))){if(this.options.noClip){this._parts=this._rings;return}for(var r=0,d=this._rings.length,v;re.y!=d.y>e.y&&e.x<(d.x-r.x)*(e.y-r.y)/(d.y-r.y)+r.x&&(n=!n);return n||tn.prototype._containsPoint.call(this,e,!0)}});function ya(e,n){return new Dn(e,n)}var yn=bn.extend({initialize:function(e,n){F(this,n),this._layers={},e&&this.addData(e)},addData:function(e){var n=Se(e)?e:e.features,o,r,d;if(n){for(o=0,r=n.length;o0&&d.push(d[0].slice()),d}function Qe(e,n){return e.feature?u({},e.feature,{geometry:n}):En(n)}function En(e){return e.type==="Feature"||e.type==="FeatureCollection"?e:{type:"Feature",properties:{},geometry:e}}var Ki={toGeoJSON:function(e){return Qe(this,{type:"Point",coordinates:Ls(this.getLatLng(),e)})}};Wo.include(Ki),Wi.include(Ki),wi.include(Ki),tn.include({toGeoJSON:function(e){var n=!yt(this._latlngs),o=Go(this._latlngs,n?1:0,!1,e);return Qe(this,{type:(n?"Multi":"")+"LineString",coordinates:o})}}),Dn.include({toGeoJSON:function(e){var n=!yt(this._latlngs),o=n&&!yt(this._latlngs[0]),r=Go(this._latlngs,o?2:n?1:0,!0,e);return n||(r=[r]),Qe(this,{type:(o?"Multi":"")+"Polygon",coordinates:r})}}),qn.include({toMultiPoint:function(e){var n=[];return this.eachLayer(function(o){n.push(o.toGeoJSON(e).geometry.coordinates)}),Qe(this,{type:"MultiPoint",coordinates:n})},toGeoJSON:function(e){var n=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(n==="MultiPoint")return this.toMultiPoint(e);var o=n==="GeometryCollection",r=[];return this.eachLayer(function(d){if(d.toGeoJSON){var v=d.toGeoJSON(e);if(o)r.push(v.geometry);else{var P=En(v);P.type==="FeatureCollection"?r.push.apply(r,P.features):r.push(P)}}}),o?Qe(this,{geometries:r,type:"GeometryCollection"}):{type:"FeatureCollection",features:r}}});function qo(e,n){return new yn(e,n)}var gr=qo,ho=_n.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(e,n,o){this._url=e,this._bounds=st(n),F(this,o)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(He(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){ot(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(e){return this.options.opacity=e,this._image&&this._updateOpacity(),this},setStyle:function(e){return e.opacity&&this.setOpacity(e.opacity),this},bringToFront:function(){return this._map&&Cn(this._image),this},bringToBack:function(){return this._map&&qt(this._image),this},setUrl:function(e){return this._url=e,this._image&&(this._image.src=e),this},setBounds:function(e){return this._bounds=st(e),this._map&&this._reset(),this},getEvents:function(){var e={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var e=this._url.tagName==="IMG",n=this._image=e?this._url:it("img");if(He(n,"leaflet-image-layer"),this._zoomAnimated&&He(n,"leaflet-zoom-animated"),this.options.className&&He(n,this.options.className),n.onselectstart=M,n.onmousemove=M,n.onload=h(this.fire,this,"load"),n.onerror=h(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(n.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),e){this._url=n.src;return}n.src=this._url,n.alt=this.options.alt},_animateZoom:function(e){var n=this._map.getZoomScale(e.zoom),o=this._map._latLngBoundsToNewLayerBounds(this._bounds,e.zoom,e.center).min;gi(this._image,o,n)},_reset:function(){var e=this._image,n=new Ue(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),o=n.getSize();Mt(e,n.min),e.style.width=o.x+"px",e.style.height=o.y+"px"},_updateOpacity:function(){mn(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var e=this.options.errorOverlayUrl;e&&this._url!==e&&(this._url=e,this._image.src=e)},getCenter:function(){return this._bounds.getCenter()}}),vr=function(e,n,o){return new ho(e,n,o)},po=ho.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var e=this._url.tagName==="VIDEO",n=this._image=e?this._url:it("video");if(He(n,"leaflet-image-layer"),this._zoomAnimated&&He(n,"leaflet-zoom-animated"),this.options.className&&He(n,this.options.className),n.onselectstart=M,n.onmousemove=M,n.onloadeddata=h(this.fire,this,"load"),e){for(var o=n.getElementsByTagName("source"),r=[],d=0;d0?r:[n.src];return}Se(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(n.style,"objectFit")&&(n.style.objectFit="fill"),n.autoplay=!!this.options.autoplay,n.loop=!!this.options.loop,n.muted=!!this.options.muted,n.playsInline=!!this.options.playsInline;for(var v=0;vd?(n.height=d+"px",He(e,v)):Lt(e,v),this._containerWidth=this._container.offsetWidth},_animateZoom:function(e){var n=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center),o=this._getAnchor();Mt(this._container,n.add(o))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var e=this._map,n=parseInt(mi(this._container,"marginBottom"),10)||0,o=this._container.offsetHeight+n,r=this._containerWidth,d=new ue(this._containerLeft,-o-this._containerBottom);d._add(Xe(this._container));var v=e.layerPointToContainerPoint(d),P=pe(this.options.autoPanPadding),D=pe(this.options.autoPanPaddingTopLeft||P),R=pe(this.options.autoPanPaddingBottomRight||P),ne=e.getSize(),_e=0,Ne=0;v.x+r+R.x>ne.x&&(_e=v.x+r-ne.x+R.x),v.x-_e-D.x<0&&(_e=v.x-D.x),v.y+o+R.y>ne.y&&(Ne=v.y+o-ne.y+R.y),v.y-Ne-D.y<0&&(Ne=v.y-D.y),(_e||Ne)&&(this.options.keepInView&&(this._autopanning=!0),e.fire("autopanstart").panBy([_e,Ne]))}},_getAnchor:function(){return pe(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),As=function(e,n){return new Fn(e,n)};qe.mergeOptions({closePopupOnClick:!0}),qe.include({openPopup:function(e,n,o){return this._initOverlay(Fn,e,n,o).openOn(this),this},closePopup:function(e){return e=arguments.length?e:this._popup,e&&e.close(),this}}),_n.include({bindPopup:function(e,n){return this._popup=this._initOverlay(Fn,this._popup,e,n),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(e){return this._popup&&(this instanceof bn||(this._popup._source=this),this._popup._prepareOpen(e||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(e){return this._popup&&this._popup.setContent(e),this},getPopup:function(){return this._popup},_openPopup:function(e){if(!(!this._popup||!this._map)){bi(e);var n=e.layer||e.target;if(this._popup._source===n&&!(n instanceof ti)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(e.latlng);return}this._popup._source=n,this.openPopup(e.latlng)}},_movePopup:function(e){this._popup.setLatLng(e.latlng)},_onKeyPress:function(e){e.originalEvent.keyCode===13&&this._openPopup(e)}});var _o=Nt.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(e){Nt.prototype.onAdd.call(this,e),this.setOpacity(this.options.opacity),e.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(e){Nt.prototype.onRemove.call(this,e),e.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var e=Nt.prototype.getEvents.call(this);return this.options.permanent||(e.preclick=this.close),e},_initLayout:function(){var e="leaflet-tooltip",n=e+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=it("div",n),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+y(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(e){var n,o,r=this._map,d=this._container,v=r.latLngToContainerPoint(r.getCenter()),P=r.layerPointToContainerPoint(e),D=this.options.direction,R=d.offsetWidth,ne=d.offsetHeight,_e=pe(this.options.offset),Ne=this._getAnchor();D==="top"?(n=R/2,o=ne):D==="bottom"?(n=R/2,o=0):D==="center"?(n=R/2,o=ne/2):D==="right"?(n=0,o=ne/2):D==="left"?(n=R,o=ne/2):P.xthis.options.maxZoom||or?this._retainParent(d,v,P,r):!1)},_retainChildren:function(e,n,o,r){for(var d=2*e;d<2*e+2;d++)for(var v=2*n;v<2*n+2;v++){var P=new ue(d,v);P.z=o+1;var D=this._tileCoordsToKey(P),R=this._tiles[D];if(R&&R.active){R.retain=!0;continue}else R&&R.loaded&&(R.retain=!0);o+1this.options.maxZoom||this.options.minZoom!==void 0&&d1){this._setView(e,o);return}for(var Ne=d.min.y;Ne<=d.max.y;Ne++)for(var et=d.min.x;et<=d.max.x;et++){var un=new ue(et,Ne);if(un.z=this._tileZoom,!!this._isValidTile(un)){var Wt=this._tiles[this._tileCoordsToKey(un)];Wt?Wt.current=!0:P.push(un)}}if(P.sort(function(xn,Jo){return xn.distanceTo(v)-Jo.distanceTo(v)}),P.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Rn=document.createDocumentFragment();for(et=0;eto.max.x)||!n.wrapLat&&(e.yo.max.y))return!1}if(!this.options.bounds)return!0;var r=this._tileCoordsToBounds(e);return st(this.options.bounds).overlaps(r)},_keyToBounds:function(e){return this._tileCoordsToBounds(this._keyToTileCoords(e))},_tileCoordsToNwSe:function(e){var n=this._map,o=this.getTileSize(),r=e.scaleBy(o),d=r.add(o),v=n.unproject(r,e.z),P=n.unproject(d,e.z);return[v,P]},_tileCoordsToBounds:function(e){var n=this._tileCoordsToNwSe(e),o=new wt(n[0],n[1]);return this.options.noWrap||(o=this._map.wrapLatLngBounds(o)),o},_tileCoordsToKey:function(e){return e.x+":"+e.y+":"+e.z},_keyToTileCoords:function(e){var n=e.split(":"),o=new ue(+n[0],+n[1]);return o.z=+n[2],o},_removeTile:function(e){var n=this._tiles[e];n&&(ot(n.el),delete this._tiles[e],this.fire("tileunload",{tile:n.el,coords:this._keyToTileCoords(e)}))},_initTile:function(e){He(e,"leaflet-tile");var n=this.getTileSize();e.style.width=n.x+"px",e.style.height=n.y+"px",e.onselectstart=M,e.onmousemove=M,Z.ielt9&&this.options.opacity<1&&mn(e,this.options.opacity)},_addTile:function(e,n){var o=this._getTilePos(e),r=this._tileCoordsToKey(e),d=this.createTile(this._wrapCoords(e),h(this._tileReady,this,e));this._initTile(d),this.createTile.length<2&&B(h(this._tileReady,this,e,null,d)),Mt(d,o),this._tiles[r]={el:d,coords:e,current:!0},n.appendChild(d),this.fire("tileloadstart",{tile:d,coords:e})},_tileReady:function(e,n,o){n&&this.fire("tileerror",{error:n,tile:o,coords:e});var r=this._tileCoordsToKey(e);o=this._tiles[r],o&&(o.loaded=+new Date,this._map._fadeAnimated?(mn(o.el,0),O(this._fadeFrame),this._fadeFrame=B(this._updateOpacity,this)):(o.active=!0,this._pruneTiles()),n||(He(o.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:o.el,coords:e})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Z.ielt9||!this._map._fadeAnimated?B(this._pruneTiles,this):setTimeout(h(this._pruneTiles,this),250)))},_getTilePos:function(e){return e.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(e){var n=new ue(this._wrapX?T(e.x,this._wrapX):e.x,this._wrapY?T(e.y,this._wrapY):e.y);return n.z=e.z,n},_pxBoundsToTileRange:function(e){var n=this.getTileSize();return new Ue(e.min.unscaleBy(n).floor(),e.max.unscaleBy(n).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var e in this._tiles)if(!this._tiles[e].loaded)return!1;return!0}});function br(e){return new bo(e)}var Yn=bo.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(e,n){this._url=e,n=F(this,n),n.detectRetina&&Z.retina&&n.maxZoom>0?(n.tileSize=Math.floor(n.tileSize/2),n.zoomReverse?(n.zoomOffset--,n.minZoom=Math.min(n.maxZoom,n.minZoom+1)):(n.zoomOffset++,n.maxZoom=Math.max(n.minZoom,n.maxZoom-1)),n.minZoom=Math.max(0,n.minZoom)):n.zoomReverse?n.minZoom=Math.min(n.maxZoom,n.minZoom):n.maxZoom=Math.max(n.minZoom,n.maxZoom),typeof n.subdomains=="string"&&(n.subdomains=n.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(e,n){return this._url===e&&n===void 0&&(n=!0),this._url=e,n||this.redraw(),this},createTile:function(e,n){var o=document.createElement("img");return ze(o,"load",h(this._tileOnLoad,this,n,o)),ze(o,"error",h(this._tileOnError,this,n,o)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(o.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(o.referrerPolicy=this.options.referrerPolicy),o.alt="",o.src=this.getTileUrl(e),o},getTileUrl:function(e){var n={r:Z.retina?"@2x":"",s:this._getSubdomain(e),x:e.x,y:e.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var o=this._globalTileRange.max.y-e.y;this.options.tms&&(n.y=o),n["-y"]=o}return fe(this._url,u(n,this.options))},_tileOnLoad:function(e,n){Z.ielt9?setTimeout(h(e,this,null,n),0):e(null,n)},_tileOnError:function(e,n,o){var r=this.options.errorTileUrl;r&&n.getAttribute("src")!==r&&(n.src=r),e(o,n)},_onTileRemove:function(e){e.tile.onload=null},_getZoomForUrl:function(){var e=this._tileZoom,n=this.options.maxZoom,o=this.options.zoomReverse,r=this.options.zoomOffset;return o&&(e=n-e),e+r},_getSubdomain:function(e){var n=Math.abs(e.x+e.y)%this.options.subdomains.length;return this.options.subdomains[n]},_abortLoading:function(){var e,n;for(e in this._tiles)if(this._tiles[e].coords.z!==this._tileZoom&&(n=this._tiles[e].el,n.onload=M,n.onerror=M,!n.complete)){n.src=Fe;var o=this._tiles[e].coords;ot(n),delete this._tiles[e],this.fire("tileabort",{tile:n,coords:o})}},_removeTile:function(e){var n=this._tiles[e];if(n)return n.el.setAttribute("src",Fe),bo.prototype._removeTile.call(this,e)},_tileReady:function(e,n,o){if(!(!this._map||o&&o.getAttribute("src")===Fe))return bo.prototype._tileReady.call(this,e,n,o)}});function wa(e,n){return new Yn(e,n)}var mt=Yn.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(e,n){this._url=e;var o=u({},this.defaultWmsParams);for(var r in n)r in this.options||(o[r]=n[r]);n=F(this,n);var d=n.detectRetina&&Z.retina?2:1,v=this.getTileSize();o.width=v.x*d,o.height=v.y*d,this.wmsParams=o},onAdd:function(e){this._crs=this.options.crs||e.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var n=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[n]=this._crs.code,Yn.prototype.onAdd.call(this,e)},getTileUrl:function(e){var n=this._tileCoordsToNwSe(e),o=this._crs,r=Ve(o.project(n[0]),o.project(n[1])),d=r.min,v=r.max,P=(this._wmsVersion>=1.3&&this._crs===ba?[d.y,d.x,v.y,v.x]:[d.x,d.y,v.x,v.y]).join(","),D=Yn.prototype.getTileUrl.call(this,e);return D+te(this.wmsParams,D,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+P},setParams:function(e,n){return u(this.wmsParams,e),n||this.redraw(),this}});function yo(e,n){return new mt(e,n)}Yn.WMS=mt,wa.wms=yo;var On=_n.extend({options:{padding:.1},initialize:function(e){F(this,e),y(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),He(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var e={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(e.zoomanim=this._onAnimZoom),e},_onAnimZoom:function(e){this._updateTransform(e.center,e.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(e,n){var o=this._map.getZoomScale(n,this._zoom),r=this._map.getSize().multiplyBy(.5+this.options.padding),d=this._map.project(this._center,n),v=r.multiplyBy(-o).add(d).subtract(this._map._getNewPixelOrigin(e,n));Z.any3d?gi(this._container,v,o):Mt(this._container,v)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var e in this._layers)this._layers[e]._reset()},_onZoomEnd:function(){for(var e in this._layers)this._layers[e]._project()},_updatePaths:function(){for(var e in this._layers)this._layers[e]._update()},_update:function(){var e=this.options.padding,n=this._map.getSize(),o=this._map.containerPointToLayerPoint(n.multiplyBy(-e)).round();this._bounds=new Ue(o,o.add(n.multiplyBy(1+e*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Yo=On.extend({options:{tolerance:0},getEvents:function(){var e=On.prototype.getEvents.call(this);return e.viewprereset=this._onViewPreReset,e},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){On.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var e=this._container=document.createElement("canvas");ze(e,"mousemove",this._onMouseMove,this),ze(e,"click dblclick mousedown mouseup contextmenu",this._onClick,this),ze(e,"mouseout",this._handleMouseOut,this),e._leaflet_disable_events=!0,this._ctx=e.getContext("2d")},_destroyContainer:function(){O(this._redrawRequest),delete this._ctx,ot(this._container),Je(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var e;this._redrawBounds=null;for(var n in this._layers)e=this._layers[n],e._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){On.prototype._update.call(this);var e=this._bounds,n=this._container,o=e.getSize(),r=Z.retina?2:1;Mt(n,e.min),n.width=r*o.x,n.height=r*o.y,n.style.width=o.x+"px",n.style.height=o.y+"px",Z.retina&&this._ctx.scale(2,2),this._ctx.translate(-e.min.x,-e.min.y),this.fire("update")}},_reset:function(){On.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(e){this._updateDashArray(e),this._layers[y(e)]=e;var n=e._order={layer:e,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=n),this._drawLast=n,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(e){this._requestRedraw(e)},_removePath:function(e){var n=e._order,o=n.next,r=n.prev;o?o.prev=r:this._drawLast=r,r?r.next=o:this._drawFirst=o,delete e._order,delete this._layers[y(e)],this._requestRedraw(e)},_updatePath:function(e){this._extendRedrawBounds(e),e._project(),e._update(),this._requestRedraw(e)},_updateStyle:function(e){this._updateDashArray(e),this._requestRedraw(e)},_updateDashArray:function(e){if(typeof e.options.dashArray=="string"){var n=e.options.dashArray.split(/[, ]+/),o=[],r,d;for(d=0;d')}}catch{}return function(e){return document.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),g={_initContainer:function(){this._container=it("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(On.prototype._update.call(this),this.fire("update"))},_initPath:function(e){var n=e._container=xo("shape");He(n,"leaflet-vml-shape "+(this.options.className||"")),n.coordsize="1 1",e._path=xo("path"),n.appendChild(e._path),this._updateStyle(e),this._layers[y(e)]=e},_addPath:function(e){var n=e._container;this._container.appendChild(n),e.options.interactive&&e.addInteractiveTarget(n)},_removePath:function(e){var n=e._container;ot(n),e.removeInteractiveTarget(n),delete this._layers[y(e)]},_updateStyle:function(e){var n=e._stroke,o=e._fill,r=e.options,d=e._container;d.stroked=!!r.stroke,d.filled=!!r.fill,r.stroke?(n||(n=e._stroke=xo("stroke")),d.appendChild(n),n.weight=r.weight+"px",n.color=r.color,n.opacity=r.opacity,r.dashArray?n.dashStyle=Se(r.dashArray)?r.dashArray.join(" "):r.dashArray.replace(/( *, *)/g," "):n.dashStyle="",n.endcap=r.lineCap.replace("butt","flat"),n.joinstyle=r.lineJoin):n&&(d.removeChild(n),e._stroke=null),r.fill?(o||(o=e._fill=xo("fill")),d.appendChild(o),o.color=r.fillColor||r.color,o.opacity=r.fillOpacity):o&&(d.removeChild(o),e._fill=null)},_updateCircle:function(e){var n=e._point.round(),o=Math.round(e._radius),r=Math.round(e._radiusY||o);this._setPath(e,e._empty()?"M0 0":"AL "+n.x+","+n.y+" "+o+","+r+" 0,"+65535*360)},_setPath:function(e,n){e._path.v=n},_bringToFront:function(e){Cn(e._container)},_bringToBack:function(e){qt(e._container)}},c=Z.vml?xo:W,q=On.extend({_initContainer:function(){this._container=c("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=c("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ot(this._container),Je(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){On.prototype._update.call(this);var e=this._bounds,n=e.getSize(),o=this._container;(!this._svgSize||!this._svgSize.equals(n))&&(this._svgSize=n,o.setAttribute("width",n.x),o.setAttribute("height",n.y)),Mt(o,e.min),o.setAttribute("viewBox",[e.min.x,e.min.y,n.x,n.y].join(" ")),this.fire("update")}},_initPath:function(e){var n=e._path=c("path");e.options.className&&He(n,e.options.className),e.options.interactive&&He(n,"leaflet-interactive"),this._updateStyle(e),this._layers[y(e)]=e},_addPath:function(e){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(e._path),e.addInteractiveTarget(e._path)},_removePath:function(e){ot(e._path),e.removeInteractiveTarget(e._path),delete this._layers[y(e)]},_updatePath:function(e){e._project(),e._update()},_updateStyle:function(e){var n=e._path,o=e.options;n&&(o.stroke?(n.setAttribute("stroke",o.color),n.setAttribute("stroke-opacity",o.opacity),n.setAttribute("stroke-width",o.weight),n.setAttribute("stroke-linecap",o.lineCap),n.setAttribute("stroke-linejoin",o.lineJoin),o.dashArray?n.setAttribute("stroke-dasharray",o.dashArray):n.removeAttribute("stroke-dasharray"),o.dashOffset?n.setAttribute("stroke-dashoffset",o.dashOffset):n.removeAttribute("stroke-dashoffset")):n.setAttribute("stroke","none"),o.fill?(n.setAttribute("fill",o.fillColor||o.color),n.setAttribute("fill-opacity",o.fillOpacity),n.setAttribute("fill-rule",o.fillRule||"evenodd")):n.setAttribute("fill","none"))},_updatePoly:function(e,n){this._setPath(e,V(e._parts,n))},_updateCircle:function(e){var n=e._point,o=Math.max(Math.round(e._radius),1),r=Math.max(Math.round(e._radiusY),1)||o,d="a"+o+","+r+" 0 1,0 ",v=e._empty()?"M0 0":"M"+(n.x-o)+","+n.y+d+o*2+",0 "+d+-o*2+",0 ";this._setPath(e,v)},_setPath:function(e,n){e._path.setAttribute("d",n)},_bringToFront:function(e){Cn(e._path)},_bringToBack:function(e){qt(e._path)}});Z.vml&&q.include(g);function k(e){return Z.svg||Z.vml?new q(e):null}qe.include({getRenderer:function(e){var n=e.options.renderer||this._getPaneRenderer(e.options.pane)||this.options.renderer||this._renderer;return n||(n=this._renderer=this._createRenderer()),this.hasLayer(n)||this.addLayer(n),n},_getPaneRenderer:function(e){if(e==="overlayPane"||e===void 0)return!1;var n=this._paneRenderers[e];return n===void 0&&(n=this._createRenderer({pane:e}),this._paneRenderers[e]=n),n},_createRenderer:function(e){return this.options.preferCanvas&&ka(e)||k(e)}});var Be=Dn.extend({initialize:function(e,n){Dn.prototype.initialize.call(this,this._boundsToLatLngs(e),n)},setBounds:function(e){return this.setLatLngs(this._boundsToLatLngs(e))},_boundsToLatLngs:function(e){return e=st(e),[e.getSouthWest(),e.getNorthWest(),e.getNorthEast(),e.getSouthEast()]}});function id(e,n){return new Be(e,n)}q.create=c,q.pointsToPath=V,yn.geometryToLayer=ni,yn.coordsToLatLng=ii,yn.coordsToLatLngs=ki,yn.latLngToCoords=Ls,yn.latLngsToCoords=Go,yn.getFeature=Qe,yn.asFeature=En,qe.mergeOptions({boxZoom:!0});var bl=An.extend({initialize:function(e){this._map=e,this._container=e._container,this._pane=e._panes.overlayPane,this._resetStateTimeout=0,e.on("unload",this._destroy,this)},addHooks:function(){ze(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Je(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ot(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(e){if(!e.shiftKey||e.which!==1&&e.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),In(),Di(),this._startPoint=this._map.mouseEventToContainerPoint(e),ze(document,{contextmenu:bi,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(e){this._moved||(this._moved=!0,this._box=it("div","leaflet-zoom-box",this._container),He(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(e);var n=new Ue(this._point,this._startPoint),o=n.getSize();Mt(this._box,n.min),this._box.style.width=o.x+"px",this._box.style.height=o.y+"px"},_finish:function(){this._moved&&(ot(this._box),Lt(this._container,"leaflet-crosshair")),vi(),Fi(),Je(document,{contextmenu:bi,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(e){if(!(e.which!==1&&e.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(h(this._resetState,this),0);var n=new wt(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(n).fire("boxzoomend",{boxZoomBounds:n})}},_onKeyDown:function(e){e.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});qe.addInitHook("addHandler","boxZoom",bl),qe.mergeOptions({doubleClickZoom:!0});var yl=An.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(e){var n=this._map,o=n.getZoom(),r=n.options.zoomDelta,d=e.originalEvent.shiftKey?o-r:o+r;n.options.doubleClickZoom==="center"?n.setZoom(d):n.setZoomAround(e.containerPoint,d)}});qe.addInitHook("addHandler","doubleClickZoom",yl),qe.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var xl=An.extend({addHooks:function(){if(!this._draggable){var e=this._map;this._draggable=new vn(e._mapPane,e._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),e.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),e.on("zoomend",this._onZoomEnd,this),e.whenReady(this._onZoomEnd,this))}He(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Lt(this._map._container,"leaflet-grab"),Lt(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var e=this._map;if(e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var n=st(this._map.options.maxBounds);this._offsetLimit=Ve(this._map.latLngToContainerPoint(n.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(n.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;e.fire("movestart").fire("dragstart"),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(e){if(this._map.options.inertia){var n=this._lastTime=+new Date,o=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(o),this._times.push(n),this._prunePositions(n)}this._map.fire("move",e).fire("drag",e)},_prunePositions:function(e){for(;this._positions.length>1&&e-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var e=this._map.getSize().divideBy(2),n=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=n.subtract(e).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(e,n){return e-(e-n)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var e=this._draggable._newPos.subtract(this._draggable._startPos),n=this._offsetLimit;e.xn.max.x&&(e.x=this._viscousLimit(e.x,n.max.x)),e.y>n.max.y&&(e.y=this._viscousLimit(e.y,n.max.y)),this._draggable._newPos=this._draggable._startPos.add(e)}},_onPreDragWrap:function(){var e=this._worldWidth,n=Math.round(e/2),o=this._initialWorldOffset,r=this._draggable._newPos.x,d=(r-n+o)%e+n-o,v=(r+n+o)%e-n-o,P=Math.abs(d+o)0?v:-v))-n;this._delta=0,this._startTime=null,P&&(e.options.scrollWheelZoom==="center"?e.setZoom(n+P):e.setZoomAround(this._lastMousePos,n+P))}});qe.addInitHook("addHandler","scrollWheelZoom",kl);var od=600;qe.mergeOptions({tapHold:Z.touchNative&&Z.safari&&Z.mobile,tapTolerance:15});var Sl=An.extend({addHooks:function(){ze(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Je(this._map._container,"touchstart",this._onDown,this)},_onDown:function(e){if(clearTimeout(this._holdTimeout),e.touches.length===1){var n=e.touches[0];this._startPos=this._newPos=new ue(n.clientX,n.clientY),this._holdTimeout=setTimeout(h(function(){this._cancel(),this._isTapValid()&&(ze(document,"touchend",Ft),ze(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",n))},this),od),ze(document,"touchend touchcancel contextmenu",this._cancel,this),ze(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function e(){Je(document,"touchend",Ft),Je(document,"touchend touchcancel",e)},_cancel:function(){clearTimeout(this._holdTimeout),Je(document,"touchend touchcancel contextmenu",this._cancel,this),Je(document,"touchmove",this._onMove,this)},_onMove:function(e){var n=e.touches[0];this._newPos=new ue(n.clientX,n.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(e,n){var o=new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,screenX:n.screenX,screenY:n.screenY,clientX:n.clientX,clientY:n.clientY});o._simulated=!0,n.target.dispatchEvent(o)}});qe.addInitHook("addHandler","tapHold",Sl),qe.mergeOptions({touchZoom:Z.touch,bounceAtZoomLimits:!0});var Tl=An.extend({addHooks:function(){He(this._map._container,"leaflet-touch-zoom"),ze(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Lt(this._map._container,"leaflet-touch-zoom"),Je(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(e){var n=this._map;if(!(!e.touches||e.touches.length!==2||n._animatingZoom||this._zooming)){var o=n.mouseEventToContainerPoint(e.touches[0]),r=n.mouseEventToContainerPoint(e.touches[1]);this._centerPoint=n.getSize()._divideBy(2),this._startLatLng=n.containerPointToLatLng(this._centerPoint),n.options.touchZoom!=="center"&&(this._pinchStartLatLng=n.containerPointToLatLng(o.add(r)._divideBy(2))),this._startDist=o.distanceTo(r),this._startZoom=n.getZoom(),this._moved=!1,this._zooming=!0,n._stop(),ze(document,"touchmove",this._onTouchMove,this),ze(document,"touchend touchcancel",this._onTouchEnd,this),Ft(e)}},_onTouchMove:function(e){if(!(!e.touches||e.touches.length!==2||!this._zooming)){var n=this._map,o=n.mouseEventToContainerPoint(e.touches[0]),r=n.mouseEventToContainerPoint(e.touches[1]),d=o.distanceTo(r)/this._startDist;if(this._zoom=n.getScaleZoom(d,this._startZoom),!n.options.bounceAtZoomLimits&&(this._zoomn.getMaxZoom()&&d>1)&&(this._zoom=n._limitZoom(this._zoom)),n.options.touchZoom==="center"){if(this._center=this._startLatLng,d===1)return}else{var v=o._add(r)._divideBy(2)._subtract(this._centerPoint);if(d===1&&v.x===0&&v.y===0)return;this._center=n.unproject(n.project(this._pinchStartLatLng,this._zoom).subtract(v),this._zoom)}this._moved||(n._moveStart(!0,!1),this._moved=!0),O(this._animRequest);var P=h(n._move,n,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=B(P,this,!0),Ft(e)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,O(this._animRequest),Je(document,"touchmove",this._onTouchMove,this),Je(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});qe.addInitHook("addHandler","touchZoom",Tl),qe.BoxZoom=bl,qe.DoubleClickZoom=yl,qe.Drag=xl,qe.Keyboard=wl,qe.ScrollWheelZoom=kl,qe.TapHold=Sl,qe.TouchZoom=Tl,s.Bounds=Ue,s.Browser=Z,s.CRS=zt,s.Canvas=Yo,s.Circle=Wi,s.CircleMarker=wi,s.Class=$,s.Control=en,s.DivIcon=Ms,s.DivOverlay=Nt,s.DomEvent=Vi,s.DomUtil=Ln,s.Draggable=vn,s.Evented=ge,s.FeatureGroup=bn,s.GeoJSON=yn,s.GridLayer=bo,s.Handler=An,s.Icon=ji,s.ImageOverlay=ho,s.LatLng=Le,s.LatLngBounds=wt,s.Layer=_n,s.LayerGroup=qn,s.LineUtil=dr,s.Map=qe,s.Marker=Wo,s.Mixin=rr,s.Path=ti,s.Point=ue,s.PolyUtil=lr,s.Polygon=Dn,s.Polyline=tn,s.Popup=Fn,s.PosAnimation=so,s.Projection=fr,s.Rectangle=Be,s.Renderer=On,s.SVG=q,s.SVGOverlay=go,s.TileLayer=Yn,s.Tooltip=_o,s.Transformation=kt,s.Util=N,s.VideoOverlay=po,s.bind=h,s.bounds=Ve,s.canvas=ka,s.circle=Rt,s.circleMarker=fo,s.control=ln,s.divIcon=xa,s.extend=u,s.featureGroup=Ps,s.geoJSON=qo,s.geoJson=gr,s.gridLayer=br,s.icon=pr,s.imageOverlay=vr,s.latLng=De,s.latLngBounds=st,s.layerGroup=uo,s.map=Vo,s.marker=mr,s.point=pe,s.polygon=ya,s.polyline=Ko,s.popup=As,s.rectangle=id,s.setOptions=F,s.stamp=y,s.svg=k,s.svgOverlay=vo,s.tileLayer=wa,s.tooltip=_r,s.transformation=x,s.version=l,s.videoOverlay=mo;var sd=window.L;s.noConflict=function(){return window.L=sd,this},window.L=s}))})(Fs,Fs.exports)),Fs.exports}var dm=cm();const qi=lm(dm),Cu={__name:"DeviceMap",props:{position:{type:Object,default:null},trail:{type:Array,default:()=>[]},aircraft:{type:Array,default:()=>[]}},setup(t){const i=t,s=Y(null);let l,u,f,h;const _=new Map;function y(K,F){const te=getComputedStyle(document.documentElement).getPropertyValue("--accent").trim()||"#3D7BF0",X=F?"#8a94a6":te,fe=typeof K=="number"?K:0;return qi.divIcon({className:"plane-marker",iconSize:[22,22],iconAnchor:[11,11],html:``})}function C(K){const te=[`${K.callsign||K.icao24||"aircraft"}`];return K.country&&te.push(K.country),typeof K.altitude=="number"&&te.push(`${Math.round(K.altitude)} m`),typeof K.velocity=="number"&&te.push(`${Math.round(K.velocity*3.6)} km/h`),K.onGround&&te.push("on ground"),te.join(" · ")}function T(){if(!l)return;h||(h=qi.layerGroup().addTo(l));const K=new Set;for(const F of i.aircraft){if(typeof F.lat!="number"||typeof F.lng!="number")continue;K.add(F.icao24);const te=[F.lat,F.lng];let X=_.get(F.icao24);X?(X.setLatLng(te),X.setIcon(y(F.heading,F.onGround)),X.setTooltipContent(C(F))):(X=qi.marker(te,{icon:y(F.heading,F.onGround)}).bindTooltip(C(F)),X.addTo(h),_.set(F.icao24,X))}for(const[F,te]of _)K.has(F)||(h.removeLayer(te),_.delete(F))}function M(){if(!l)return;const K=i.position;if(K&&(K.lat||K.lng)){const F=[K.lat,K.lng];u?u.setLatLng(F):(u=qi.marker(F).addTo(l),l.setView(F,17))}if(f&&f.remove(),i.trail.length){const F=getComputedStyle(document.documentElement).getPropertyValue("--accent").trim()||"#3D7BF0";f=qi.polyline(i.trail,{color:F,weight:3}).addTo(l)}}fi(()=>{l=qi.map(s.value,{zoomControl:!0}).setView([20,0],2),qi.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:"© OpenStreetMap",maxZoom:19}).addTo(l),setTimeout(()=>l.invalidateSize(),60),M(),T(),(!i.position||!i.position.lat&&!i.position.lng)&&i.aircraft.length&&j()});let H=!1;function j(){if(H||!l||!i.aircraft.length)return;const K=i.aircraft.filter(F=>typeof F.lat=="number"&&typeof F.lng=="number").map(F=>[F.lat,F.lng]);K.length&&(l.fitBounds(qi.latLngBounds(K).pad(.2)),H=!0)}return us(()=>{l&&l.remove(),l=null}),Bt(()=>i.position,M,{deep:!0}),Bt(()=>i.trail,M,{deep:!0}),Bt(()=>i.aircraft,()=>{T(),(!i.position||!i.position.lat&&!i.position.lng)&&j()},{deep:!0}),(K,F)=>(p(),m("div",{ref_key:"el",ref:s,class:"h-[320px] w-full rounded-lg"},null,512))}},fm=["width","height","stroke-width"],hm=["d"],J={__name:"Icon",props:{name:{type:String,required:!0},size:{type:[Number,String],default:18},stroke:{type:[Number,String],default:2}},setup(t){const l=({grid:"M3 3h7v7H3zM14 3h7v7h-7zM14 14h7v7h-7zM3 14h7v7H3z",radio:"M4.9 19.1a10 10 0 0 1 0-14.2M7.8 16.2a6 6 0 0 1 0-8.4M16.2 7.8a6 6 0 0 1 0 8.4M19.1 4.9a10 10 0 0 1 0 14.2M12 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2z",route:"M6 19a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM18 11a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 13V9a4 4 0 0 1 4-4h4",calendar:"M8 2v4M16 2v4M3 10h18M5 4h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z",book:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",fileText:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zM14 2v6h6M16 13H8M16 17H8M10 9H8",settings:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z",search:"M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM21 21l-4.3-4.3",plus:"M12 5v14M5 12h14",battery:"M3 8h14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H3a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1zM22 11v2",signal:"M2 20h.01M7 20v-4M12 20v-8M17 20V8M22 20V4",clock:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 7v5l3 2",chevronRight:"M9 6l6 6-6 6",play:"M6 3l14 9-14 9V3z",logout:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9",wind:"M12.8 19.6A2 2 0 1 0 14 16H2M17.5 8a2.5 2.5 0 1 1 2 4H2M9.6 4.6A2 2 0 1 1 11 8H2",drone:"M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8zM6 6 4 4M18 6l2-2M6 18l-2 2M18 18l2 2",user:"M20 21a8 8 0 1 0-16 0M12 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8z",users:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75",shield:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",sliders:"M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6",alertTriangle:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0zM12 9v4M12 17h.01",download:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3",upload:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12",trash:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6",check:"M20 6 9 17l-5-5",mail:"M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zM22 6l-10 7L2 6",lock:"M5 11h14a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2zM7 11V7a5 5 0 0 1 10 0v4",monitor:"M3 4h18a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM8 21h8M12 17v4",globe:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM3 12h18M12 3a15 15 0 0 1 0 18 15 15 0 0 1 0-18z",smartphone:"M7 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zM11 18h2",image:"M4 4h16a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM8.5 11a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zM21 15l-5-5L5 21",eye:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7z M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",type:"M4 7V4h16v3M9 20h6M12 4v16",sun:"M12 17a5 5 0 1 0 0-10 5 5 0 0 0 0 10zM12 1v2M12 21v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M1 12h2M21 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4",moon:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z",x:"M18 6 6 18M6 6l12 12",server:"M20 4H4a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zM20 13H4a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2zM6 7.5h.01M6 16.5h.01",cloud:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9z"}[t.name]||"").split(" M").map((u,f)=>f?"M"+u:u);return(u,f)=>(p(),m("svg",{width:t.size,height:t.size,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":t.stroke,"stroke-linecap":"round","stroke-linejoin":"round",style:{flex:"none"},"aria-hidden":"true"},[(p(!0),m(le,null,Ie(Ee(l),(h,_)=>(p(),m("path",{key:_,d:h},null,8,hm))),128))],8,fm))}},pm=["aria-checked","disabled"],nn={__name:"Toggle",props:{modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:i}){const s=i;return(l,u)=>(p(),m("button",{type:"button",role:"switch","aria-checked":t.modelValue,disabled:t.disabled,class:Ce(["relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition disabled:opacity-40",t.modelValue?"bg-accent":"bg-surface-2 border border-line-strong"]),onClick:u[0]||(u[0]=f=>s("update:modelValue",!t.modelValue))},[a("span",{class:Ce(["inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition",t.modelValue?"translate-x-6":"translate-x-1"])},null,2)],10,pm))}},mm={class:"inline-flex rounded-[10px] border border-line bg-surface-2 p-0.5"},gm=["onClick"],wn={__name:"Segmented",props:{modelValue:{type:[String,Number],default:""},options:{type:Array,default:()=>[]}},emits:["update:modelValue"],setup(t,{emit:i}){const s=i;return(l,u)=>(p(),m("div",mm,[(p(!0),m(le,null,Ie(t.options,f=>(p(),m("button",{key:f.value,type:"button",class:Ce(["inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[13px] font-semibold transition",t.modelValue===f.value?"bg-surface-1 text-ink shadow-xs":"text-ink-secondary hover:text-ink"]),onClick:h=>s("update:modelValue",f.value)},[f.icon?(p(),nt(J,{key:0,name:f.icon,size:15},null,8,["name"])):I("",!0),z(" "+w(f.label),1)],10,gm))),128))]))}},vm={class:"text-sm font-semibold text-ink"},_m={key:0,class:"mt-0.5 text-xs text-ink-muted"},xe={__name:"Row",props:{title:{type:String,default:""},desc:{type:String,default:""},keywords:{type:String,default:""},block:{type:Boolean,default:!1}},setup(t){const i=t,s=Vs("settingsSearch",{value:""}),l=ce(()=>{const u=(s.value||"").trim().toLowerCase();return u?`${i.title} ${i.desc} ${i.keywords}`.toLowerCase().includes(u):!0});return(u,f)=>l.value?(p(),m("div",{key:0,class:Ce(["border-b border-line py-4 last:border-0",t.block?"":"flex items-center justify-between gap-6"])},[a("div",{class:Ce(t.block?"mb-3":"min-w-0")},[a("div",vm,w(t.title),1),t.desc?(p(),m("div",_m,w(t.desc),1)):I("",!0)],2),a("div",{class:Ce(t.block?"":"shrink-0")},[Tf(u.$slots,"default")],2)],2)):I("",!0)}},ia=[{code:"AL",name:"Albania",continent:"EU",bbox:"39.6,19.3,42.7,21.1"},{code:"AD",name:"Andorra",continent:"EU",bbox:"42.4,1.4,42.7,1.8"},{code:"AT",name:"Austria",continent:"EU",bbox:"46.4,9.5,49.0,17.2"},{code:"BY",name:"Belarus",continent:"EU",bbox:"51.2,23.2,56.2,32.8"},{code:"BE",name:"Belgium",continent:"EU",bbox:"49.5,2.5,51.5,6.4"},{code:"BA",name:"Bosnia and Herzegovina",continent:"EU",bbox:"42.6,15.7,45.3,19.6"},{code:"BG",name:"Bulgaria",continent:"EU",bbox:"41.2,22.4,44.2,28.6"},{code:"HR",name:"Croatia",continent:"EU",bbox:"42.4,13.5,46.6,19.4"},{code:"CY",name:"Cyprus",continent:"EU",bbox:"34.6,32.3,35.7,34.6"},{code:"CZ",name:"Czechia",continent:"EU",bbox:"48.6,12.1,51.1,18.9"},{code:"DK",name:"Denmark",continent:"EU",bbox:"54.6,8.1,57.8,12.7"},{code:"EE",name:"Estonia",continent:"EU",bbox:"57.5,21.8,59.7,28.2"},{code:"FI",name:"Finland",continent:"EU",bbox:"59.8,20.6,70.1,31.6"},{code:"FR",name:"France",continent:"EU",bbox:"41.3,-5.2,51.1,9.6"},{code:"DE",name:"Germany",continent:"EU",bbox:"47.2,5.8,55.1,15.1"},{code:"GR",name:"Greece",continent:"EU",bbox:"34.8,19.4,41.8,28.3"},{code:"HU",name:"Hungary",continent:"EU",bbox:"45.7,16.1,48.6,22.9"},{code:"IS",name:"Iceland",continent:"EU",bbox:"63.3,-24.6,66.6,-13.5"},{code:"IE",name:"Ireland",continent:"EU",bbox:"51.4,-10.6,55.4,-6.0"},{code:"IT",name:"Italy",continent:"EU",bbox:"36.6,6.6,47.1,18.6"},{code:"XK",name:"Kosovo",continent:"EU",bbox:"41.8,20.0,43.3,21.8"},{code:"LV",name:"Latvia",continent:"EU",bbox:"55.7,20.9,58.1,28.2"},{code:"LI",name:"Liechtenstein",continent:"EU",bbox:"47.0,9.4,47.3,9.6"},{code:"LT",name:"Lithuania",continent:"EU",bbox:"53.9,20.9,56.5,26.9"},{code:"LU",name:"Luxembourg",continent:"EU",bbox:"49.4,5.7,50.2,6.5"},{code:"MT",name:"Malta",continent:"EU",bbox:"35.8,14.1,36.1,14.6"},{code:"MD",name:"Moldova",continent:"EU",bbox:"45.4,26.6,48.5,30.2"},{code:"MC",name:"Monaco",continent:"EU",bbox:"43.72,7.40,43.75,7.44"},{code:"ME",name:"Montenegro",continent:"EU",bbox:"41.8,18.4,43.6,20.4"},{code:"NL",name:"Netherlands",continent:"EU",bbox:"50.7,3.3,53.7,7.2"},{code:"MK",name:"North Macedonia",continent:"EU",bbox:"40.8,20.4,42.4,23.0"},{code:"NO",name:"Norway",continent:"EU",bbox:"57.9,4.6,71.2,31.1"},{code:"PL",name:"Poland",continent:"EU",bbox:"49.0,14.1,54.9,24.2"},{code:"PT",name:"Portugal",continent:"EU",bbox:"36.9,-9.5,42.2,-6.2"},{code:"RO",name:"Romania",continent:"EU",bbox:"43.6,20.2,48.3,29.7"},{code:"SM",name:"San Marino",continent:"EU",bbox:"43.89,12.40,43.99,12.52"},{code:"RS",name:"Serbia",continent:"EU",bbox:"42.2,18.8,46.2,23.0"},{code:"SK",name:"Slovakia",continent:"EU",bbox:"47.7,16.8,49.6,22.6"},{code:"SI",name:"Slovenia",continent:"EU",bbox:"45.4,13.4,46.9,16.6"},{code:"ES",name:"Spain",continent:"EU",bbox:"35.9,-9.4,43.8,3.4"},{code:"SE",name:"Sweden",continent:"EU",bbox:"55.3,11.1,69.1,24.2"},{code:"CH",name:"Switzerland",continent:"EU",bbox:"45.8,5.9,47.8,10.5"},{code:"UA",name:"Ukraine",continent:"EU",bbox:"44.4,22.1,52.4,40.2"},{code:"GB",name:"United Kingdom",continent:"EU",bbox:"49.9,-8.7,60.9,1.8"},{code:"VA",name:"Vatican City",continent:"EU",bbox:"41.900,12.445,41.908,12.458"},{code:"RU",name:"Russia",continent:"EU",bbox:"41.2,19.6,81.9,180"},{code:"TR",name:"Turkey",continent:"EU",bbox:"35.8,25.7,42.3,44.8"},{code:"AF",name:"Afghanistan",continent:"AS",bbox:"29.4,60.5,38.5,74.9"},{code:"AM",name:"Armenia",continent:"AS",bbox:"38.8,43.4,41.3,46.6"},{code:"AZ",name:"Azerbaijan",continent:"AS",bbox:"38.4,44.8,41.9,50.4"},{code:"BH",name:"Bahrain",continent:"AS",bbox:"25.8,50.4,26.3,50.7"},{code:"BD",name:"Bangladesh",continent:"AS",bbox:"20.7,88.0,26.6,92.7"},{code:"BT",name:"Bhutan",continent:"AS",bbox:"26.7,88.7,28.3,92.1"},{code:"BN",name:"Brunei",continent:"AS",bbox:"4.0,114.0,5.1,115.4"},{code:"KH",name:"Cambodia",continent:"AS",bbox:"10.4,102.3,14.7,107.6"},{code:"CN",name:"China",continent:"AS",bbox:"18.2,73.5,53.6,134.8"},{code:"GE",name:"Georgia",continent:"AS",bbox:"41.0,40.0,43.6,46.7"},{code:"IN",name:"India",continent:"AS",bbox:"6.7,68.1,35.5,97.4"},{code:"ID",name:"Indonesia",continent:"AS",bbox:"-11.0,95.0,6.1,141.0"},{code:"IR",name:"Iran",continent:"AS",bbox:"25.0,44.0,39.8,63.3"},{code:"IQ",name:"Iraq",continent:"AS",bbox:"29.1,38.8,37.4,48.6"},{code:"IL",name:"Israel",continent:"AS",bbox:"29.5,34.2,33.3,35.9"},{code:"JP",name:"Japan",continent:"AS",bbox:"24.0,122.9,45.5,145.8"},{code:"JO",name:"Jordan",continent:"AS",bbox:"29.2,34.9,33.4,39.3"},{code:"KZ",name:"Kazakhstan",continent:"AS",bbox:"40.6,46.5,55.4,87.3"},{code:"KW",name:"Kuwait",continent:"AS",bbox:"28.5,46.5,30.1,48.4"},{code:"KG",name:"Kyrgyzstan",continent:"AS",bbox:"39.2,69.3,43.3,80.3"},{code:"LA",name:"Laos",continent:"AS",bbox:"13.9,100.1,22.5,107.7"},{code:"LB",name:"Lebanon",continent:"AS",bbox:"33.0,35.1,34.7,36.6"},{code:"MY",name:"Malaysia",continent:"AS",bbox:"0.9,99.6,7.4,119.3"},{code:"MV",name:"Maldives",continent:"AS",bbox:"-0.7,72.7,7.1,73.7"},{code:"MN",name:"Mongolia",continent:"AS",bbox:"41.6,87.7,52.1,119.9"},{code:"MM",name:"Myanmar",continent:"AS",bbox:"9.8,92.2,28.5,101.2"},{code:"NP",name:"Nepal",continent:"AS",bbox:"26.3,80.1,30.4,88.2"},{code:"KP",name:"North Korea",continent:"AS",bbox:"37.7,124.2,43.0,130.7"},{code:"OM",name:"Oman",continent:"AS",bbox:"16.6,52.0,26.4,59.8"},{code:"PK",name:"Pakistan",continent:"AS",bbox:"23.7,60.9,37.1,77.8"},{code:"PH",name:"Philippines",continent:"AS",bbox:"4.6,116.9,21.1,126.6"},{code:"QA",name:"Qatar",continent:"AS",bbox:"24.5,50.7,26.2,51.6"},{code:"SA",name:"Saudi Arabia",continent:"AS",bbox:"16.4,34.6,32.2,55.7"},{code:"SG",name:"Singapore",continent:"AS",bbox:"1.2,103.6,1.5,104.1"},{code:"KR",name:"South Korea",continent:"AS",bbox:"33.1,125.9,38.6,129.6"},{code:"LK",name:"Sri Lanka",continent:"AS",bbox:"5.9,79.7,9.8,81.9"},{code:"SY",name:"Syria",continent:"AS",bbox:"32.3,35.7,37.3,42.4"},{code:"TW",name:"Taiwan",continent:"AS",bbox:"21.9,120.0,25.3,122.0"},{code:"TJ",name:"Tajikistan",continent:"AS",bbox:"36.7,67.4,41.0,75.2"},{code:"TH",name:"Thailand",continent:"AS",bbox:"5.6,97.3,20.5,105.6"},{code:"TL",name:"Timor-Leste",continent:"AS",bbox:"-9.5,124.0,-8.1,127.3"},{code:"TM",name:"Turkmenistan",continent:"AS",bbox:"35.1,52.4,42.8,66.7"},{code:"AE",name:"United Arab Emirates",continent:"AS",bbox:"22.6,51.5,26.1,56.4"},{code:"UZ",name:"Uzbekistan",continent:"AS",bbox:"37.2,55.9,45.6,73.1"},{code:"VN",name:"Vietnam",continent:"AS",bbox:"8.2,102.1,23.4,109.5"},{code:"YE",name:"Yemen",continent:"AS",bbox:"12.1,42.5,19.0,54.5"},{code:"DZ",name:"Algeria",continent:"AF",bbox:"18.9,-8.7,37.1,12.0"},{code:"AO",name:"Angola",continent:"AF",bbox:"-18.0,11.6,-4.4,24.1"},{code:"BJ",name:"Benin",continent:"AF",bbox:"6.2,0.8,12.4,3.9"},{code:"BW",name:"Botswana",continent:"AF",bbox:"-26.9,20.0,-17.8,29.4"},{code:"BF",name:"Burkina Faso",continent:"AF",bbox:"9.4,-5.5,15.1,2.4"},{code:"BI",name:"Burundi",continent:"AF",bbox:"-4.5,29.0,-2.3,30.8"},{code:"CV",name:"Cabo Verde",continent:"AF",bbox:"14.8,-25.4,17.2,-22.7"},{code:"CM",name:"Cameroon",continent:"AF",bbox:"1.7,8.5,13.1,16.2"},{code:"CF",name:"Central African Republic",continent:"AF",bbox:"2.2,14.4,11.0,27.5"},{code:"TD",name:"Chad",continent:"AF",bbox:"7.4,13.5,23.4,24.0"},{code:"KM",name:"Comoros",continent:"AF",bbox:"-12.4,43.2,-11.4,44.5"},{code:"CG",name:"Congo",continent:"AF",bbox:"-5.0,11.1,3.7,18.6"},{code:"CD",name:"DR Congo",continent:"AF",bbox:"-13.5,12.2,5.4,31.3"},{code:"DJ",name:"Djibouti",continent:"AF",bbox:"10.9,41.7,12.7,43.4"},{code:"EG",name:"Egypt",continent:"AF",bbox:"22.0,25.0,31.7,36.9"},{code:"GQ",name:"Equatorial Guinea",continent:"AF",bbox:"0.9,9.3,3.8,11.4"},{code:"ER",name:"Eritrea",continent:"AF",bbox:"12.4,36.4,18.0,43.1"},{code:"SZ",name:"Eswatini",continent:"AF",bbox:"-27.3,30.8,-25.7,32.1"},{code:"ET",name:"Ethiopia",continent:"AF",bbox:"3.4,33.0,14.9,48.0"},{code:"GA",name:"Gabon",continent:"AF",bbox:"-4.0,8.7,2.3,14.5"},{code:"GM",name:"Gambia",continent:"AF",bbox:"13.1,-16.8,13.8,-13.8"},{code:"GH",name:"Ghana",continent:"AF",bbox:"4.7,-3.3,11.2,1.2"},{code:"GN",name:"Guinea",continent:"AF",bbox:"7.2,-15.1,12.7,-7.6"},{code:"GW",name:"Guinea-Bissau",continent:"AF",bbox:"10.9,-16.7,12.7,-13.6"},{code:"CI",name:"Ivory Coast",continent:"AF",bbox:"4.4,-8.6,10.7,-2.5"},{code:"KE",name:"Kenya",continent:"AF",bbox:"-4.7,33.9,5.5,41.9"},{code:"LS",name:"Lesotho",continent:"AF",bbox:"-30.7,27.0,-28.6,29.5"},{code:"LR",name:"Liberia",continent:"AF",bbox:"4.3,-11.5,8.6,-7.4"},{code:"LY",name:"Libya",continent:"AF",bbox:"19.5,9.3,33.2,25.2"},{code:"MG",name:"Madagascar",continent:"AF",bbox:"-25.6,43.2,-11.9,50.5"},{code:"MW",name:"Malawi",continent:"AF",bbox:"-17.1,32.7,-9.4,35.9"},{code:"ML",name:"Mali",continent:"AF",bbox:"10.1,-12.3,25.0,4.3"},{code:"MR",name:"Mauritania",continent:"AF",bbox:"14.7,-17.1,27.3,-4.8"},{code:"MU",name:"Mauritius",continent:"AF",bbox:"-20.5,57.3,-19.9,57.8"},{code:"MA",name:"Morocco",continent:"AF",bbox:"27.7,-13.2,35.9,-1.0"},{code:"MZ",name:"Mozambique",continent:"AF",bbox:"-26.9,30.2,-10.5,40.8"},{code:"NA",name:"Namibia",continent:"AF",bbox:"-28.9,11.7,-16.9,25.3"},{code:"NE",name:"Niger",continent:"AF",bbox:"11.7,0.2,23.5,16.0"},{code:"NG",name:"Nigeria",continent:"AF",bbox:"4.3,2.7,13.9,14.7"},{code:"RW",name:"Rwanda",continent:"AF",bbox:"-2.8,28.9,-1.1,30.9"},{code:"SN",name:"Senegal",continent:"AF",bbox:"12.3,-17.5,16.7,-11.4"},{code:"SL",name:"Sierra Leone",continent:"AF",bbox:"6.9,-13.3,10.0,-10.3"},{code:"SO",name:"Somalia",continent:"AF",bbox:"-1.7,40.9,12.0,51.4"},{code:"ZA",name:"South Africa",continent:"AF",bbox:"-34.8,16.5,-22.1,32.9"},{code:"SS",name:"South Sudan",continent:"AF",bbox:"3.5,24.1,12.2,35.9"},{code:"SD",name:"Sudan",continent:"AF",bbox:"8.7,21.8,22.2,38.6"},{code:"TZ",name:"Tanzania",continent:"AF",bbox:"-11.7,29.3,-1.0,40.4"},{code:"TG",name:"Togo",continent:"AF",bbox:"6.1,-0.1,11.1,1.8"},{code:"TN",name:"Tunisia",continent:"AF",bbox:"30.2,7.5,37.5,11.6"},{code:"UG",name:"Uganda",continent:"AF",bbox:"-1.5,29.6,4.2,35.0"},{code:"ZM",name:"Zambia",continent:"AF",bbox:"-18.1,21.9,-8.2,33.7"},{code:"ZW",name:"Zimbabwe",continent:"AF",bbox:"-22.4,25.2,-15.6,33.1"},{code:"CA",name:"Canada",continent:"NA",bbox:"41.7,-141.0,83.1,-52.6"},{code:"US",name:"United States",continent:"NA",bbox:"24.4,-125.0,49.4,-66.9"},{code:"MX",name:"Mexico",continent:"NA",bbox:"14.5,-118.4,32.7,-86.7"},{code:"GT",name:"Guatemala",continent:"NA",bbox:"13.7,-92.2,17.8,-88.2"},{code:"BZ",name:"Belize",continent:"NA",bbox:"15.9,-89.2,18.5,-87.8"},{code:"SV",name:"El Salvador",continent:"NA",bbox:"13.1,-90.1,14.4,-87.7"},{code:"HN",name:"Honduras",continent:"NA",bbox:"12.9,-89.4,16.5,-83.1"},{code:"NI",name:"Nicaragua",continent:"NA",bbox:"10.7,-87.7,15.0,-83.1"},{code:"CR",name:"Costa Rica",continent:"NA",bbox:"8.0,-85.9,11.2,-82.5"},{code:"PA",name:"Panama",continent:"NA",bbox:"7.2,-83.1,9.6,-77.2"},{code:"CU",name:"Cuba",continent:"NA",bbox:"19.8,-85.0,23.3,-74.1"},{code:"DO",name:"Dominican Republic",continent:"NA",bbox:"17.5,-72.0,19.9,-68.3"},{code:"HT",name:"Haiti",continent:"NA",bbox:"18.0,-74.5,20.1,-71.6"},{code:"JM",name:"Jamaica",continent:"NA",bbox:"17.7,-78.4,18.5,-76.2"},{code:"BS",name:"Bahamas",continent:"NA",bbox:"20.9,-79.0,27.3,-72.7"},{code:"TT",name:"Trinidad and Tobago",continent:"NA",bbox:"10.0,-61.9,11.4,-60.5"},{code:"AR",name:"Argentina",continent:"SA",bbox:"-55.1,-73.6,-21.8,-53.6"},{code:"BO",name:"Bolivia",continent:"SA",bbox:"-22.9,-69.6,-9.7,-57.5"},{code:"BR",name:"Brazil",continent:"SA",bbox:"-33.8,-74.0,5.3,-34.8"},{code:"CL",name:"Chile",continent:"SA",bbox:"-55.9,-75.6,-17.5,-66.4"},{code:"CO",name:"Colombia",continent:"SA",bbox:"-4.2,-79.0,12.5,-66.9"},{code:"EC",name:"Ecuador",continent:"SA",bbox:"-5.0,-81.1,1.4,-75.2"},{code:"GY",name:"Guyana",continent:"SA",bbox:"1.2,-61.4,8.6,-56.5"},{code:"PY",name:"Paraguay",continent:"SA",bbox:"-27.6,-62.6,-19.3,-54.3"},{code:"PE",name:"Peru",continent:"SA",bbox:"-18.4,-81.3,0.0,-68.7"},{code:"SR",name:"Suriname",continent:"SA",bbox:"1.8,-58.1,6.0,-54.0"},{code:"UY",name:"Uruguay",continent:"SA",bbox:"-35.0,-58.4,-30.1,-53.1"},{code:"VE",name:"Venezuela",continent:"SA",bbox:"0.6,-73.4,12.2,-59.8"},{code:"AU",name:"Australia",continent:"OC",bbox:"-43.6,113.3,-10.7,153.6"},{code:"NZ",name:"New Zealand",continent:"OC",bbox:"-47.3,166.4,-34.4,178.6"},{code:"PG",name:"Papua New Guinea",continent:"OC",bbox:"-11.7,140.8,-1.3,155.9"},{code:"FJ",name:"Fiji",continent:"OC",bbox:"-19.2,177.0,-16.0,180.0"}],bm=new Map(ia.map(t=>[t.code,t]));function ym(t){const i=String(t||"").split(",").map(s=>Number(s.trim()));return i.length!==4||i.some(s=>Number.isNaN(s))?null:i}function xm(t){const i=bm.get(t);return i?i.bbox:""}function $r(t,i){if(typeof t!="number"||typeof i!="number"||Number.isNaN(t)||Number.isNaN(i))return null;let s=null,l=1/0;for(const u of ia){const f=ym(u.bbox);if(!f)continue;const[h,_,y,C]=f;if(ty||i<_||i>C)continue;const T=Math.abs(y-h)*Math.abs(C-_);Tt.continent==="EU").slice().sort((t,i)=>t.name.localeCompare(i.name)).map(t=>({value:t.bbox,label:t.name}))}function km(){return ia.slice().sort((t,i)=>t.name.localeCompare(i.name)).map(t=>[t.code,t.name])}const Sm=[["EU","European countries"],["AS","Asian countries"],["AF","African countries"],["NA","North American countries"],["SA","South American countries"],["OC","Oceanian countries"]];function Tm(){return Sm.map(([t,i])=>({label:i,options:ia.filter(s=>s.continent===t).slice().sort((s,l)=>s.name.localeCompare(l.name)).map(s=>({value:s.bbox,label:s.name}))}))}const Pm=(t,i)=>{const s=t.__vccOpts||t;for(const[l,u]of i)s[l]=u;return s},Cm={class:"mx-auto max-w-[1280px] p-7"},Lm={class:"mb-5 flex flex-wrap items-end justify-between gap-4"},Am={class:"flex h-10 w-full max-w-[280px] items-center gap-2 rounded border border-line-strong bg-surface-1 px-3"},Mm={class:"grid grid-cols-[210px_1fr] gap-6 max-[760px]:grid-cols-1"},Em={class:"flex flex-col gap-0.5 max-[760px]:flex-row max-[760px]:overflow-x-auto"},Om=["onClick"],zm={class:"whitespace-nowrap"},$m={class:"min-w-0"},Im={key:0,class:"panel p-10 text-center text-sm text-ink-muted"},Nm={key:0,class:"eyebrow mb-2 mt-5 first:mt-0 flex items-center gap-2"},Dm={key:1,class:"panel mb-5 p-5"},Fm={class:"flex items-center gap-1"},Rm={class:"flex items-center gap-2"},Bm={class:"font-mono text-sm text-ink"},Um={class:"inline-flex items-center gap-1 rounded-full bg-amber-soft px-2 py-0.5 text-[11px] font-semibold text-amber-fg"},Vm={key:0,class:"mt-2 text-xs text-ink-muted"},Zm={class:"grid max-w-[420px] gap-2"},Hm={class:"flex items-center gap-3"},jm={key:2,class:"panel mb-5 p-5"},Wm=["value"],Km=["value"],Gm=["value"],qm={class:"font-mono text-sm text-ink"},Ym={key:3},Jm={key:0,class:"mb-5 flex items-center gap-1 overflow-x-auto border-b border-line"},Xm=["onClick"],Qm={class:"panel mb-5 p-5"},eg={class:"mb-4 flex items-start gap-3 border-b border-line pb-4"},tg={class:"grid h-10 w-10 place-items-center rounded-lg bg-accent-soft text-accent-soft-fg"},ng={key:0,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},ig={key:1,class:"mb-4 flex flex-col gap-2 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between"},og={key:4,class:"border-b border-line py-3 text-xs text-amber-fg"},sg={key:0},ag={key:5,class:"border-b border-line py-3 text-xs text-ink-muted"},rg={class:"font-semibold text-ink-secondary"},lg={key:6,class:"border-b border-line py-3 text-xs text-ink-muted"},ug={key:7,class:"my-4 rounded-lg border border-line bg-surface-2 p-4","data-keywords":"credits usage quota remaining daily allowance rate limit"},cg={class:"flex items-center justify-between gap-3"},dg={class:"flex items-center gap-2 text-sm font-semibold text-ink"},fg={key:0,class:"text-[11px] text-ink-muted"},hg={class:"mt-2 flex items-baseline gap-1.5"},pg={class:"font-mono text-2xl font-semibold text-ink"},mg={class:"text-sm text-ink-muted"},gg={class:"mt-2 h-2 w-full overflow-hidden rounded-full bg-line"},vg={class:"mt-2 text-xs text-ink-muted"},_g={class:"mt-2 text-sm text-ink"},bg={class:"font-semibold"},yg={class:"mt-1 text-xs text-ink-muted"},xg={key:1,class:"mt-2 text-xs text-ink-muted"},wg={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},kg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Sg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Tg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Pg={key:1,class:"flex flex-col items-end gap-2"},Cg={key:0,value:"__auto__"},Lg=["label"],Ag=["value"],Mg={key:0,class:"w-64 text-right text-[11px] leading-snug text-ink-muted"},Eg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Og={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},zg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},$g={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Ig={key:8,class:"border-b border-line py-3 text-xs text-amber-fg"},Ng={class:"mt-4 flex flex-wrap items-center gap-3"},Dg=["disabled"],Fg={key:1,class:"flex items-center gap-2",title:"Bounding box used for Test connection — smaller areas cost fewer OpenSky credits"},Rg=["label"],Bg=["value"],Ug=["disabled"],Vg={key:3,class:"text-xs text-danger-fg"},Zg={class:"panel mb-5 p-5"},Hg={class:"mb-4 flex items-start gap-3 border-b border-line pb-4"},jg={class:"grid h-10 w-10 place-items-center rounded-lg bg-accent-soft text-accent-soft-fg"},Wg={key:0,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},Kg={key:1,class:"mb-4 flex flex-col gap-2 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between"},Gg={key:4,class:"border-b border-line py-3 text-xs text-amber-fg"},qg={key:0},Yg={key:5,class:"border-b border-line py-3 text-xs text-ink-muted"},Jg={class:"font-semibold text-ink-secondary"},Xg={key:6,class:"border-b border-line py-3 text-xs text-ink-muted"},Qg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},ev={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},tv={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},nv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},iv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},ov={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},sv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},av={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},rv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},lv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},uv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},cv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},dv={key:7,class:"my-4 rounded-lg border border-line bg-surface-2 p-4","data-keywords":"usage quota rate limit calls per minute remaining left api"},fv={class:"flex items-center justify-between gap-3"},hv={class:"flex items-center gap-2 text-sm font-semibold text-ink"},pv={key:0,class:"text-[11px] text-ink-muted"},mv={class:"mt-2 flex items-baseline gap-1.5"},gv={class:"font-mono text-2xl font-semibold text-ink"},vv={class:"text-sm text-ink-muted"},_v={key:0,class:"mt-2 h-2 w-full overflow-hidden rounded-full bg-line"},bv={class:"mt-2 text-xs text-ink-muted"},yv={key:1,class:"mt-2 text-xs text-ink-muted"},xv={class:"mt-4 flex flex-wrap items-center gap-3"},wv=["disabled"],kv=["disabled"],Sv={key:2,class:"text-xs text-danger-fg"},Tv={key:3,class:"text-[11px] text-ink-muted"},Pv={class:"panel mb-5 p-5"},Cv={class:"mb-4 flex items-start gap-3 border-b border-line pb-4"},Lv={class:"grid h-10 w-10 place-items-center rounded-lg bg-accent-soft text-accent-soft-fg"},Av={key:0,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},Mv={key:1,class:"mb-4 flex flex-col gap-2 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between"},Ev={key:4,class:"border-b border-line py-3 text-xs text-amber-fg"},Ov={key:0},zv={key:5,class:"border-b border-line py-3 text-xs text-ink-muted"},$v={class:"font-semibold text-ink-secondary"},Iv={key:6,class:"border-b border-line py-3 text-xs text-ink-muted"},Nv={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},Dv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Fv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Rv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Bv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Uv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Vv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Zv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Hv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},jv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Wv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Kv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Gv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},qv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Yv={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Jv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Xv={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},Qv={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},e_={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},t_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},n_={class:"mt-4 flex flex-wrap items-center gap-3"},i_=["disabled"],o_=["disabled"],s_={key:2,class:"text-xs text-danger-fg"},a_={key:3,class:"text-[11px] text-ink-muted"},r_={class:"panel mb-5 p-5"},l_={class:"mb-4 flex items-start gap-3 border-b border-line pb-4"},u_={class:"grid h-10 w-10 place-items-center rounded-lg bg-accent-soft text-accent-soft-fg"},c_={key:0,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},d_={key:1,class:"mb-4 flex flex-col gap-2 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between"},f_={key:4,class:"border-b border-line py-3 text-xs text-amber-fg"},h_={key:0},p_={key:5,class:"border-b border-line py-3 text-xs text-ink-muted"},m_={class:"font-semibold text-ink-secondary"},g_={key:6,class:"border-b border-line py-3 text-xs text-ink-muted"},v_={key:0,class:"inline-flex items-center gap-2 break-all font-mono text-sm text-ink"},__={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},b_={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},y_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},x_={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},w_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},k_={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},S_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},T_={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},P_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},C_={class:"mt-4 flex flex-wrap items-center gap-3"},L_=["disabled"],A_=["disabled"],M_={key:2,class:"text-xs text-danger-fg"},E_={key:3,class:"text-[11px] text-ink-muted"},O_={key:3,class:"panel mb-5 p-5"},z_={class:"mb-4 flex items-start gap-3 border-b border-line pb-4"},$_={class:"grid h-10 w-10 place-items-center rounded-lg bg-accent-soft text-accent-soft-fg"},I_={key:0,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},N_={key:1,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},D_={key:2,class:"mb-4 flex flex-col gap-2 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between"},F_={key:5,class:"border-b border-line py-3 text-xs text-amber-fg"},R_={key:0},B_={key:6,class:"border-b border-line py-3 text-xs text-ink-muted"},U_={class:"font-semibold text-ink-secondary"},V_={key:7,class:"border-b border-line py-3 text-xs text-ink-muted"},Z_={class:"flex w-full flex-col gap-2"},H_={class:"break-all font-mono text-sm text-ink"},j_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},W_={key:1,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},K_={key:0,class:"text-xs text-ink-muted"},G_={key:1,class:"border-b border-line py-3 text-xs text-ink-muted"},q_={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},Y_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},J_={class:"mt-4 flex flex-wrap items-center gap-3"},X_=["disabled"],Q_=["disabled"],e1={key:2,class:"text-xs text-danger-fg"},t1={key:3,class:"text-[11px] text-ink-muted"},n1={key:4,class:"panel mb-5 p-5"},i1={class:"flex items-center gap-4"},o1=["src"],s1={key:1,class:"grid h-16 w-16 place-items-center rounded-full bg-[var(--navy-800)] text-lg font-bold text-white"},a1={class:"flex gap-2"},r1={class:"btn-ghost cursor-pointer"},l1={class:"mt-1 text-right text-[11px] text-ink-muted"},u1={key:5,class:"panel mb-5 p-5"},c1={class:"flex items-center gap-3"},d1={key:0,class:"mt-4 rounded-lg border border-line bg-surface-2 p-4"},f1={class:"flex flex-wrap items-center gap-4"},h1={class:"min-w-0"},p1={class:"mt-1 select-all font-mono text-sm font-bold text-ink"},m1={class:"mt-3 flex items-center gap-2"},g1={key:0,class:"mt-2 text-xs text-danger-fg"},v1={key:1,class:"mt-4 rounded-lg border border-line bg-surface-2 p-4"},_1={class:"mt-2 grid grid-cols-2 gap-1 font-mono text-xs text-ink-secondary sm:grid-cols-4"},b1={class:"rounded-lg border border-line bg-surface-2 p-3"},y1={class:"flex items-center gap-3"},x1={class:"grid h-9 w-9 place-items-center rounded-full bg-accent-soft text-accent-soft-fg"},w1={class:"min-w-0 flex-1"},k1={class:"text-sm font-semibold text-ink"},S1={class:"font-mono text-[11px] text-ink-muted"},T1={key:6,class:"mb-5"},P1={key:0,class:"panel mb-5 p-5"},C1={class:"grid max-w-[520px] gap-2"},L1={class:"flex flex-wrap gap-2"},A1=["disabled","title"],M1=["value"],E1=["value"],O1={class:"flex items-center gap-2 py-1 text-sm text-ink-secondary"},z1={class:"flex items-center gap-3"},$1=["disabled"],I1={key:0,class:"text-xs text-danger-fg"},N1={key:1,class:"text-xs text-ink-muted"},D1={key:1,class:"panel mb-5 p-5"},F1={class:"grid max-w-[520px] gap-2"},R1={class:"flex flex-wrap gap-2"},B1=["value"],U1=["value"],V1={key:1,class:"text-xs text-ink-muted"},Z1={class:"font-semibold text-ink-secondary"},H1={class:"flex items-center gap-3"},j1=["disabled"],W1={key:0,class:"text-xs text-danger-fg"},K1={class:"panel overflow-hidden p-0"},G1={class:"flex items-center justify-between px-5 py-4"},q1=["disabled"],Y1={key:0,class:"px-5 pb-5 text-sm text-danger-fg"},J1={key:1,class:"px-5 pb-8 text-sm text-ink-muted"},X1={key:2,class:"overflow-x-auto"},Q1={class:"w-full border-collapse text-sm"},eb={class:"text-left"},tb={class:"px-5 py-3"},nb={class:"text-ink"},ib={key:0,class:"ml-1.5 text-[11px] text-ink-muted"},ob={class:"px-5 py-3"},sb={class:"px-5 py-3"},ab={class:"px-5 py-3"},rb={class:"px-5 py-3 text-right"},lb=["onClick"],ub={key:1,class:"inline-flex items-center gap-1.5"},cb=["onClick"],db=["onClick"],fb={key:7,class:"mb-5"},hb={key:0,class:"panel mb-5 p-5"},pb={class:"grid max-w-[520px] gap-2"},mb={class:"flex items-center gap-3"},gb={key:0,class:"text-xs text-danger-fg"},vb={key:1,class:"panel mb-5 p-5"},_b={class:"grid max-w-[520px] gap-2"},bb={class:"flex items-center gap-3"},yb=["disabled"],xb={key:0,class:"text-xs text-danger-fg"},wb={class:"panel overflow-hidden p-0"},kb={key:0,class:"px-5 pb-8 text-sm text-ink-muted"},Sb={key:1,class:"overflow-x-auto"},Tb={class:"w-full border-collapse text-sm"},Pb={class:"text-left"},Cb={class:"px-5 py-3"},Lb={class:"inline-flex items-center gap-2 text-ink"},Ab={class:"px-5 py-3 text-ink-secondary"},Mb={class:"px-5 py-3 text-right"},Eb=["onClick"],Ob={key:1,class:"inline-flex items-center gap-1.5"},zb=["onClick"],$b=["disabled","title","onClick"],Ib={key:8,class:"mb-5"},Nb={class:"panel mb-5 p-5"},Db={class:"btn-ghost cursor-pointer"},Fb={key:0,class:"mt-2 text-xs text-ink-muted"},Rb={class:"rounded-lg border p-5",style:{"border-color":"color-mix(in srgb, var(--danger) 35%, transparent)",background:"var(--danger-soft)"}},Bb={class:"flex items-center gap-2 text-danger-fg"},Ub={class:"mt-4 rounded-lg border border-line bg-surface-1 p-4"},Vb={class:"mt-3 flex items-start gap-2 text-sm text-ink-secondary"},Zb={class:"mt-3"},Hb={class:"eyebrow mb-1 block"},jb={class:"text-ink"},Wb=["placeholder"],Kb={class:"mt-4 flex flex-wrap items-center gap-3"},Gb=["disabled"],qb=["disabled"],Yb={key:2,class:"text-xs text-ink-muted"},Jb={key:0,class:"mt-3 rounded border border-line bg-surface-2 px-3 py-2 text-xs text-ink-secondary"},Xb={key:0,class:"fixed bottom-5 right-5 z-20 flex items-center gap-2 rounded-lg border border-line bg-surface-1 px-4 py-2.5 text-sm text-ink shadow-md"},Lu="pv.opensky.health",Au="pv.filetransfer.health",Mu="pv.webdav.health",Eu="pv.openweather.health",Ou="pv.localstorage.health",Qb={__name:"Settings",props:{email:{type:String,default:""},role:{type:String,default:"user"},organization:{type:String,default:""},organizationName:{type:String,default:""}},emits:["logout"],setup(t,{emit:i}){const s=t,l=i,u=ce(()=>s.role==="superadmin"),f=ce(()=>s.role==="admin"||s.role==="superadmin");function h(g){return g==="superadmin"?"Superadmin":g==="admin"?"Admin":"User"}function _(g){return g==="superadmin"||g==="admin"?"shield":"user"}function y(g){return g==="superadmin"||g==="admin"?C.accent:C.neutral}const C={success:"bg-success-soft text-success-fg",warning:"bg-amber-soft text-amber-fg",danger:"bg-danger-soft text-danger-fg",accent:"bg-accent-soft text-accent-soft-fg",neutral:"bg-surface-2 text-ink-secondary"},T=ce(()=>{const g=[{id:"account",label:"Account",icon:"user",kw:"name username email password verification login credentials role"},{id:"appearance",label:"Appearance",icon:"sliders",kw:"theme light dark system language region font size accessibility date time format motion"},{id:"integrations",label:"Integrations",icon:"radio",kw:"opensky flights adsb aircraft plugin oauth credentials bounding box plan connection ftp sftp ftps file transfer server host upload download local storage folder drive isolated private read only webdav nextcloud owncloud dav url https openweather weather forecast temperature api key units calls per minute usage limit quota"},{id:"profile",label:"Profile",icon:"image",kw:"avatar photo display name bio public"},{id:"security",label:"Privacy & Security",icon:"shield",kw:"two factor authentication 2fa sessions devices logout security privacy"}];return f.value&&g.push({id:"team",label:"User management",icon:"users",kw:"users team members add remove create delete role admin permissions rights organization"}),u.value&&g.push({id:"organizations",label:"Organizations",icon:"grid",kw:"organization org tenant company create rename delete members"}),g.push({id:"advanced",label:"Advanced",icon:"alertTriangle",kw:"export import data delete account danger zone",danger:!0}),g}),M=Y("account"),H=Y("");uc("settingsSearch",H);const j=ce(()=>H.value.trim().length>0),K=ce(()=>H.value.trim().toLowerCase());function F(g){return K.value?(g.label+" "+g.kw).toLowerCase().includes(K.value)||X(g.id):!0}const te={account:["full name","username","email address verification verify","password change current new"],appearance:["theme light dark system","language","region","font size accessibility","reduce motion","date format","time format clock"],integrations:["opensky live flights","enable plugin","oauth client id secret","plan credits","bounding box","test connection","file transfer ftp sftp ftps","server host port username password","private key passphrase","base path directory","local storage folder drive","private isolated folder","read only access mode","webdav nextcloud owncloud dav","server url username password tls","base path directory folder","openweather weather forecast","api key units metric imperial","default latitude longitude language","calls per minute limit usage quota","api call usage today rate limit"],profile:["profile photo avatar","display name","bio about","show email public"],security:["two factor authentication","active sessions devices","sign out"],team:["add user create account","members list role admin remove delete","organization org assign"],organizations:["add organization create","rename organization","delete organization members"],advanced:["export data download","import data upload","delete account permanent danger"]};function X(g){return K.value?(te[g]||[]).some(c=>c.includes(K.value)):!0}const fe=ce(()=>j.value?T.value.filter(F):T.value.filter(g=>g.id===M.value)),Se=ce({get:()=>Oo.value,set:g=>Ha(g)}),de=[{value:"light",label:"Light",icon:"sun"},{value:"dark",label:"Dark",icon:"moon"},{value:"system",label:"System",icon:"monitor"}],Fe=[{value:"sm",label:"Small"},{value:"md",label:"Default"},{value:"lg",label:"Large"}],Oe=[{value:"12",label:"12-hour"},{value:"24",label:"24-hour"}],Te=[["en","English"],["es","Español"],["de","Deutsch"],["fr","Français"],["pl","Polski"],["ja","日本語"]],Ze=km(),he=ce(()=>(Ze.find(([g])=>g===be.region)||[null,be.region])[1]),Q=[["MDY","MM/DD/YYYY"],["DMY","DD/MM/YYYY"],["YMD","YYYY/MM/DD"],["ISO","YYYY-MM-DD"]],B=Y(Date.now());let O=null;const N=ce(()=>Su(B.value)),$=gt({loaded:!1,available:!1,orgEnabled:!0,allowAnonymous:!0,enabled:!1,canEditOrg:!1,isSuperadmin:!1,scopes:{}}),Ye=Y("user"),we=gt({clientId:"",clientSecret:"",plan:"",bbox:""}),ge=Y(""),ue=Y(!1),ft=Y(!1),pe=Y(null),Ue=Y(null),Ve=ce(()=>pe.value&&pe.value.credits||null),wt=ce(()=>{const g=Ve.value;return!g||!g.daily||g.remaining==null?null:Math.max(0,Math.min(100,Math.round(g.remaining/g.daily*100)))}),st=ce(()=>{const g=wt.value;return g==null?"bg-accent":g<=10?"bg-danger":g<=30?"bg-amber":"bg-success"});function Le(g){return typeof g=="number"?g.toLocaleString():g}function De(){if(!Ue.value)return"";const g=Math.max(0,Math.round((Date.now()-Ue.value)/1e3));if(g<60)return"just now";const c=Math.round(g/60);if(c<60)return`${c} min ago`;const q=Math.round(c/60);return q<24?`${q} h ago`:`${Math.round(q/24)} d ago`}function zt(){try{pe.value&&localStorage.setItem(Lu,JSON.stringify({health:pe.value,ts:Ue.value}))}catch{}}function At(){try{const g=localStorage.getItem(Lu);if(!g)return;const c=JSON.parse(g);c&&c.health&&(pe.value=c.health,Ue.value=c.ts||null)}catch{}}const Ut=[{value:"",label:"Not set"},{value:"anonymous",label:"Anonymous"},{value:"standard",label:"Standard"},{value:"contributor",label:"Contributor"}],Pt=[{value:"user",label:"My settings",icon:"user"},{value:"org",label:"Organization",icon:"users"}],kt=[{label:"World",options:[{value:"-90,-180,90,180",label:"World"}]},{label:"Continents",options:[{value:"34,-25,72,45",label:"Europe"},{value:"-35,-18,38,52",label:"Africa"},{value:"5,25,82,180",label:"Asia"},{value:"7,-168,72,-52",label:"North America"},{value:"-56,-82,13,-34",label:"South America"},{value:"-48,110,-10,180",label:"Oceania"}]},{label:"European countries",options:wm()},{label:"Other countries",options:[{value:"24,-125,49.5,-66.5",label:"United States"},{value:"41.7,-141,83.1,-52.6",label:"Canada"},{value:"-43.6,113.3,-10.7,153.6",label:"Australia"},{value:"24,122.9,45.5,145.8",label:"Japan"}]}],x=kt.flatMap(g=>g.options);function b(g){const c=String(g||"").split(",").map(k=>k.trim());if(c.length!==4)return"";const q=c.map(Number);return q.some(k=>Number.isNaN(k))?"":q.join(",")}function S(g){const c=b(g),q=c&&x.find(k=>b(k.value)===c);return q?q.label:""}const W=Y(!1),V=ce({get(){if(!ve.value&&be.autoBbox)return"__auto__";if(W.value)return"__custom__";const g=b(we.bbox),c=g&&x.find(q=>b(q.value)===g);return c?c.value:"__custom__"},set(g){if(g==="__auto__"){ve.value||(be.autoBbox=!0),W.value=!1;return}if(ve.value||(be.autoBbox=!1),g==="__custom__"){W.value=!0;return}W.value=!1,we.bbox=g}}),G=ce(()=>V.value==="__custom__"),re=ce(()=>V.value==="__auto__"),ae=ce(()=>$.isSuperadmin),oe=ce(()=>$.isSuperadmin?"user":Ye.value),ee=ce(()=>$.scopes[oe.value]||{editableLayer:"user",fields:{}}),ve=ce(()=>oe.value==="org");function se(g){return ee.value.fields[g]||{effective:"",own:"",source:"unset",locked:!1}}function ke(g){return ae.value||se(g).locked}function Pe(g){const c=se(g).source;return c==="global"?"Set by administrator":c==="org"?"Set by your organization":""}function Re(){we.clientId=se("clientId").own||"",we.clientSecret=se("clientSecret").own||"",we.plan=se("plan").own||"",we.bbox=se("bbox").own||"",W.value=!1}function Ke(g){$.available=!!g.available,$.orgEnabled=g.orgEnabled!==!1,$.allowAnonymous=!!g.allowAnonymous,$.enabled=!!g.enabled,$.canEditOrg=!!g.canEditOrg,$.isSuperadmin=!!g.isSuperadmin,$.scopes=g.scopes||{},Ye.value==="org"&&!$.canEditOrg&&(Ye.value="user"),Re(),$.loaded=!0}Bt(Ye,()=>{ge.value="",Re()});async function Ge(){At();const{ok:g,body:c}=await hp();g&&Ke(c)}async function pt(g){const c=ve.value;c?$.orgEnabled=g:$.enabled=g;const{ok:q,body:k}=await bu(c?{scope:"org",enabled:g}:{scope:"user",enabled:g});q?(Ke(k),We(c?g?"OpenSky enabled for your organization.":"OpenSky disabled for your organization.":g?"OpenSky enabled.":"OpenSky disabled.")):(c?$.orgEnabled=!g:$.enabled=!g,We(k.error||"Could not update."))}async function ht(){ge.value="",ue.value=!0;const g={};for(const Be of["clientId","clientSecret","plan","bbox"])ke(Be)||(g[Be]=we[Be]);const c={scope:oe.value,config:g};ve.value||(c.enabled=$.enabled);const{ok:q,body:k}=await bu(c);if(ue.value=!1,!q){ge.value=k.error||"Could not save settings.";return}Ke(k),We(ve.value?"Organization OpenSky settings saved.":"OpenSky settings saved.")}const Vt=[{label:"World",options:[{value:"-90,-180,90,180",label:"World"}]},{label:"Continents",options:[{value:"34,-25,72,45",label:"Europe"},{value:"-35,-18,38,52",label:"Africa"},{value:"5,25,82,180",label:"Asia"},{value:"7,-168,72,-52",label:"North America"},{value:"-56,-82,13,-34",label:"South America"},{value:"-48,110,-10,180",label:"Oceania"}]},...Tm()],Jt=Vt.flatMap(g=>g.options),Zt=Y(""),pn=Y(!1),Ct=ce({get(){if(pn.value)return"__custom__";if(!Zt.value)return"__default__";const g=b(Zt.value),c=g&&Jt.find(q=>b(q.value)===g);return c?c.value:"__custom__"},set(g){if(g==="__default__"){pn.value=!1,Zt.value="";return}if(g==="__custom__"){pn.value=!0;return}pn.value=!1,Zt.value=g}}),$t=ce(()=>Ct.value==="__custom__");async function kn(){ft.value=!0,pe.value=null;const{ok:g,body:c}=await pp((Zt.value||"").trim()||void 0);ft.value=!1,pe.value=g&&c.health?c.health:{status:"down",detail:c.error||"Probe failed."},Ue.value=Date.now(),zt()}function zi(g){return g==="ok"?C.success:g==="degraded"?C.warning:C.danger}const at=gt({loaded:!1,available:!1,orgEnabled:!0,enabled:!1,canEditOrg:!1,isSuperadmin:!1,scopes:{}}),Sn=Y("user"),$i=["protocol","host","port","username","password","privateKey","keyPassphrase","hostKeyFingerprint","insecureSkipVerify","basePath"],rt=gt(Object.fromEntries($i.map(g=>[g,""]))),hi=Y(""),pi=Y(!1),Ii=Y(!1),Gt=Y(null),jn=Y(null),U=[{value:"sftp",label:"SFTP"},{value:"ftps",label:"FTPS"},{value:"ftp",label:"FTP"}],E=[{value:"false",label:"Verify certificate"},{value:"true",label:"Skip verification"}],Me=ce(()=>at.isSuperadmin),tt=ce(()=>at.isSuperadmin?"user":Sn.value),It=ce(()=>at.scopes[tt.value]||{editableLayer:"user",fields:{}}),St=ce(()=>tt.value==="org"),Et=ce(()=>(_t("protocol")?Z("protocol").effective:rt.protocol)||"sftp");function Z(g){return It.value.fields[g]||{effective:"",own:"",source:"unset",locked:!1}}function _t(g){return Me.value||Z(g).locked}function bt(g){const c=Z(g).source;return c==="global"?"Set by administrator":c==="org"?"Set by your organization":""}function oa(g){return(U.find(c=>c.value===g)||{}).label||g||"—"}function cs(){for(const g of $i)rt[g]=Z(g).own||"";rt.protocol||(rt.protocol="sftp"),rt.insecureSkipVerify||(rt.insecureSkipVerify="false")}function no(g){at.available=!!g.available,at.orgEnabled=g.orgEnabled!==!1,at.enabled=!!g.enabled,at.canEditOrg=!!g.canEditOrg,at.isSuperadmin=!!g.isSuperadmin,at.scopes=g.scopes||{},Sn.value==="org"&&!at.canEditOrg&&(Sn.value="user"),cs(),at.loaded=!0}Bt(Sn,()=>{hi.value="",cs()});function sa(){if(!jn.value)return"";const g=Math.max(0,Math.round((Date.now()-jn.value)/1e3));if(g<60)return"just now";const c=Math.round(g/60);if(c<60)return`${c} min ago`;const q=Math.round(c/60);return q<24?`${q} h ago`:`${Math.round(q/24)} d ago`}function Ni(){try{Gt.value&&localStorage.setItem(Au,JSON.stringify({health:Gt.value,ts:jn.value}))}catch{}}function aa(){try{const g=localStorage.getItem(Au);if(!g)return;const c=JSON.parse(g);c&&c.health&&(Gt.value=c.health,jn.value=c.ts||null)}catch{}}async function ir(){aa();const{ok:g,body:c}=await gp();g&&no(c)}async function ra(g){const c=St.value;c?at.orgEnabled=g:at.enabled=g;const{ok:q,body:k}=await yu(c?{scope:"org",enabled:g}:{scope:"user",enabled:g});q?(no(k),We(c?g?"File transfer enabled for your organization.":"File transfer disabled for your organization.":g?"File transfer enabled.":"File transfer disabled.")):(c?at.orgEnabled=!g:at.enabled=!g,We(k.error||"Could not update."))}async function or(){hi.value="",pi.value=!0;const g={};for(const Be of $i)_t(Be)||(g[Be]=rt[Be]);const c={scope:tt.value,config:g};St.value||(c.enabled=at.enabled);const{ok:q,body:k}=await yu(c);if(pi.value=!1,!q){hi.value=k.error||"Could not save settings.";return}no(k),We(St.value?"Organization file-transfer settings saved.":"File-transfer settings saved.")}async function sr(){Ii.value=!0,Gt.value=null;const{ok:g,body:c}=await vp();Ii.value=!1,Gt.value=g&&c.health?c.health:{status:"down",detail:c.error||"Probe failed."},jn.value=Date.now(),Ni()}function la(g){return g==="ok"?C.success:g==="degraded"?C.warning:C.danger}const lt=gt({loaded:!1,available:!1,orgEnabled:!0,enabled:!1,canEditOrg:!1,isSuperadmin:!1,scopes:{}}),Wn=Y("user"),ds=["baseURL","username","password","insecureSkipVerify","basePath"],Xt=gt(Object.fromEntries(ds.map(g=>[g,""]))),io=Y(""),zo=Y(!1),$o=Y(!1),Tn=Y(null),$n=Y(null),ua=[{value:"false",label:"Verify certificate"},{value:"true",label:"Skip verification"}],Io=ce(()=>lt.isSuperadmin),mi=ce(()=>lt.isSuperadmin?"user":Wn.value),it=ce(()=>lt.scopes[mi.value]||{editableLayer:"user",fields:{}}),ot=ce(()=>mi.value==="org");function Pn(g){return it.value.fields[g]||{effective:"",own:"",source:"unset",locked:!1}}function Cn(g){return Io.value||Pn(g).locked}function qt(g){const c=Pn(g).source;return c==="global"?"Set by administrator":c==="org"?"Set by your organization":""}function No(){for(const g of ds)Xt[g]=Pn(g).own||"";Xt.insecureSkipVerify||(Xt.insecureSkipVerify="false")}function He(g){lt.available=!!g.available,lt.orgEnabled=g.orgEnabled!==!1,lt.enabled=!!g.enabled,lt.canEditOrg=!!g.canEditOrg,lt.isSuperadmin=!!g.isSuperadmin,lt.scopes=g.scopes||{},Wn.value==="org"&&!lt.canEditOrg&&(Wn.value="user"),No(),lt.loaded=!0}Bt(Wn,()=>{io.value="",No()});function Lt(){if(!$n.value)return"";const g=Math.max(0,Math.round((Date.now()-$n.value)/1e3));if(g<60)return"just now";const c=Math.round(g/60);if(c<60)return`${c} min ago`;const q=Math.round(c/60);return q<24?`${q} h ago`:`${Math.round(q/24)} d ago`}function fs(){try{Tn.value&&localStorage.setItem(Mu,JSON.stringify({health:Tn.value,ts:$n.value}))}catch{}}function Do(){try{const g=localStorage.getItem(Mu);if(!g)return;const c=JSON.parse(g);c&&c.health&&(Tn.value=c.health,$n.value=c.ts||null)}catch{}}async function mn(){Do();const{ok:g,body:c}=await yp();g&&He(c)}async function ca(g){const c=ot.value;c?lt.orgEnabled=g:lt.enabled=g;const{ok:q,body:k}=await xu(c?{scope:"org",enabled:g}:{scope:"user",enabled:g});q?(He(k),We(c?g?"WebDAV enabled for your organization.":"WebDAV disabled for your organization.":g?"WebDAV enabled.":"WebDAV disabled.")):(c?lt.orgEnabled=!g:lt.enabled=!g,We(k.error||"Could not update."))}async function Fo(){io.value="",zo.value=!0;const g={};for(const Be of ds)Cn(Be)||(g[Be]=Xt[Be]);const c={scope:mi.value,config:g};ot.value||(c.enabled=lt.enabled);const{ok:q,body:k}=await xu(c);if(zo.value=!1,!q){io.value=k.error||"Could not save settings.";return}He(k),We(ot.value?"Organization WebDAV settings saved.":"WebDAV settings saved.")}async function gi(){$o.value=!0,Tn.value=null;const{ok:g,body:c}=await xp();$o.value=!1,Tn.value=g&&c.health?c.health:{status:"down",detail:c.error||"Probe failed."},$n.value=Date.now(),fs()}function Mt(g){return g==="ok"?C.success:g==="degraded"?C.warning:C.danger}const Xe=gt({loaded:!1,available:!1,orgEnabled:!0,enabled:!1,canEditOrg:!1,isSuperadmin:!1,scopes:{}}),In=Y("user"),vi=["apiKey","units","lat","lon","lang","callsPerMinute"],Ht=gt(Object.fromEntries(vi.map(g=>[g,""]))),Kn=Y(""),Di=Y(!1),Fi=Y(!1),Qt=Y(null),Gn=Y(null),Ro=[{value:"",label:"Not set"},{value:"metric",label:"Metric (°C)"},{value:"imperial",label:"Imperial (°F)"},{value:"standard",label:"Standard (K)"}],Ri=ce(()=>Xe.isSuperadmin),Bo=ce(()=>Xe.isSuperadmin?"user":In.value),hs=ce(()=>Xe.scopes[Bo.value]||{editableLayer:"user",fields:{}}),Ln=ce(()=>Bo.value==="org");function ze(g){return hs.value.fields[g]||{effective:"",own:"",source:"unset",locked:!1}}function jt(g){return Ri.value||ze(g).locked}function Je(g){const c=ze(g).source;return c==="global"?"Set by administrator":c==="org"?"Set by your organization":""}function ps(){for(const g of vi)Ht[g]=ze(g).own||""}function oo(g){Xe.available=!!g.available,Xe.orgEnabled=g.orgEnabled!==!1,Xe.enabled=!!g.enabled,Xe.canEditOrg=!!g.canEditOrg,Xe.isSuperadmin=!!g.isSuperadmin,Xe.scopes=g.scopes||{},In.value==="org"&&!Xe.canEditOrg&&(In.value="user"),ps(),Xe.loaded=!0}Bt(In,()=>{Kn.value="",ps()});function Uo(){if(!Gn.value)return"";const g=Math.max(0,Math.round((Date.now()-Gn.value)/1e3));if(g<60)return"just now";const c=Math.round(g/60);if(c<60)return`${c} min ago`;const q=Math.round(c/60);return q<24?`${q} h ago`:`${Math.round(q/24)} d ago`}function ms(){try{Qt.value&&localStorage.setItem(Eu,JSON.stringify({health:Qt.value,ts:Gn.value}))}catch{}}function _i(){try{const g=localStorage.getItem(Eu);if(!g)return;const c=JSON.parse(g);c&&c.health&&(Qt.value=c.health,Gn.value=c.ts||null)}catch{}}async function gs(){_i();const{ok:g,body:c}=await wp();g&&oo(c)}async function Bi(g){const c=Ln.value;c?Xe.orgEnabled=g:Xe.enabled=g;const{ok:q,body:k}=await wu(c?{scope:"org",enabled:g}:{scope:"user",enabled:g});q?(oo(k),We(c?g?"OpenWeather enabled for your organization.":"OpenWeather disabled for your organization.":g?"OpenWeather enabled.":"OpenWeather disabled.")):(c?Xe.orgEnabled=!g:Xe.enabled=!g,We(k.error||"Could not update."))}async function Ft(){Kn.value="",Di.value=!0;const g={};for(const Be of vi)jt(Be)||(g[Be]=Ht[Be]);const c={scope:Bo.value,config:g};Ln.value||(c.enabled=Xe.enabled);const{ok:q,body:k}=await wu(c);if(Di.value=!1,!q){Kn.value=k.error||"Could not save settings.";return}oo(k),We(Ln.value?"Organization OpenWeather settings saved.":"OpenWeather settings saved.")}async function bi(){Fi.value=!0,Qt.value=null;const{ok:g,body:c}=await kp();Fi.value=!1,Qt.value=g&&c.health?c.health:{status:"down",detail:c.error||"Probe failed."},Gn.value=Date.now(),ms()}function da(g){return g==="ok"?C.success:g==="degraded"?C.warning:C.danger}const Ui=ce(()=>Qt.value&&Qt.value.usage||null),vs=ce(()=>{const g=Ui.value;return!g||!g.minuteLimit?null:Math.max(0,Math.min(100,Math.round(g.minuteUsed/g.minuteLimit*100)))}),fa=ce(()=>{const g=vs.value;return g==null?"bg-accent":g>=90?"bg-danger":g>=70?"bg-amber":"bg-success"}),Ae=gt({loaded:!1,available:!1,orgEnabled:!0,enabled:!1,canEditOrg:!1,isSuperadmin:!1,isOrgUser:!1,mounts:[],privateFolder:!1,privateEnabled:!1,allowPrivate:!0,rootConfigured:!1,scopes:{}}),Vi=Y("user"),so=Y(""),qe=Y(""),Vo=Y(!1),en=Y(!1),ln=Y(null),yi=Y(null),ao=Y({}),Zo=[{value:"",label:"Inherit"},{value:"false",label:"Read-write"},{value:"true",label:"Read-only"}],_s=ce(()=>Ae.isSuperadmin),Ho=ce(()=>Ae.isSuperadmin?"user":Vi.value),ar=ce(()=>Ae.scopes[Ho.value]||{editableLayer:"user",fields:{}}),gn=ce(()=>Ho.value==="org");function Zi(g){return ar.value.fields[g]||{effective:"",own:"",source:"unset",locked:!1}}function ha(g){return _s.value||Zi(g).locked}function An(g){const c=Zi(g).source;return c==="global"?"Set by administrator":c==="org"?"Set by your organization":""}function rr(g){return(Zo.find(c=>c.value===g)||{}).label||"Inherit"}function bs(){so.value=Zi("readOnly").own||""}function vn(g){Ae.available=!!g.available,Ae.orgEnabled=g.orgEnabled!==!1,Ae.enabled=!!g.enabled,Ae.canEditOrg=!!g.canEditOrg,Ae.isSuperadmin=!!g.isSuperadmin,Ae.isOrgUser=!!g.isOrgUser,Ae.mounts=Array.isArray(g.mounts)?g.mounts:[],Ae.privateFolder=!!g.privateFolder,Ae.privateEnabled=!!g.privateEnabled,Ae.allowPrivate=g.allowPrivate!==!1,Ae.rootConfigured=!!g.rootConfigured,Ae.scopes=g.scopes||{},Vi.value==="org"&&!Ae.canEditOrg&&(Vi.value="user"),bs(),Ae.loaded=!0}Bt(Vi,()=>{qe.value="",bs()});function pa(){if(!yi.value)return"";const g=Math.max(0,Math.round((Date.now()-yi.value)/1e3));if(g<60)return"just now";const c=Math.round(g/60);if(c<60)return`${c} min ago`;const q=Math.round(c/60);return q<24?`${q} h ago`:`${Math.round(q/24)} d ago`}function ma(){try{ln.value&&localStorage.setItem(Ou,JSON.stringify({health:ln.value,ts:yi.value}))}catch{}}function ys(){try{const g=localStorage.getItem(Ou);if(!g)return;const c=JSON.parse(g);c&&c.health&&(ln.value=c.health,yi.value=c.ts||null)}catch{}}async function lr(){ys();const{ok:g,body:c}=await _p();g&&vn(c)}async function xs(g){const c=gn.value;c?Ae.orgEnabled=g:Ae.enabled=g;const{ok:q,body:k}=await Ma(c?{scope:"org",enabled:g}:{scope:"user",enabled:g});q?(vn(k),We(c?g?"Local storage enabled for your organization.":"Local storage disabled for your organization.":g?"Local storage enabled.":"Local storage disabled.")):(c?Ae.orgEnabled=!g:Ae.enabled=!g,We(k.error||"Could not update."))}async function ga(g){Ae.privateFolder=g;const{ok:c,body:q}=await Ma({scope:"user",privateFolder:g});c?(vn(q),We(g?"Private folder enabled.":"Private folder disabled.")):(Ae.privateFolder=!g,We(q.error||"Could not update."))}async function ur(g){Ae.allowPrivate=g;const{ok:c,body:q}=await Ma({scope:"org",allowPrivate:g});c?(vn(q),We(g?"Members may now create private folders.":"Private folders disabled for your organization.")):(Ae.allowPrivate=!g,We(q.error||"Could not update."))}async function cr(){qe.value="",Vo.value=!0;const g={};ha("readOnly")||(g.readOnly=so.value);const c={scope:Ho.value,config:g};gn.value||(c.enabled=Ae.enabled);const{ok:q,body:k}=await Ma(c);if(Vo.value=!1,!q){qe.value=k.error||"Could not save settings.";return}vn(k),We(gn.value?"Organization local-storage settings saved.":"Local-storage settings saved.")}async function ws(){en.value=!0,ln.value=null,ao.value={};const{ok:g,body:c}=await bp();en.value=!1,ln.value=g&&c.health?c.health:{status:"down",detail:c.error||"Probe failed."};const q={};if(Array.isArray(c.mounts))for(const k of c.mounts)q[k.id]={status:k.status,detail:k.detail};ao.value=q,yi.value=Date.now(),ma()}function va(g){return g==="ok"?C.success:g==="degraded"?C.warning:C.danger}const _a=[{id:"apis-external",label:"APIs — External",icon:"globe"},{id:"drives-external",label:"Drives — External",icon:"server"},{id:"drives-local",label:"Drives — Local",icon:"monitor"}],jo=Y("apis-external");function Hi(g){return j.value||jo.value===g}const Nn=Y("");let ks=null;function We(g){Nn.value=g,clearTimeout(ks),ks=setTimeout(()=>Nn.value="",2200)}const yt=gt({current:"",next:"",confirm:""}),xi=Y(""),Ss=Y(!1);function dr(){if(Ss.value=!1,!yt.current)return xi.value="Enter your current password.";if(yt.next.length<8)return xi.value="New password must be at least 8 characters.";if(yt.next!==yt.confirm)return xi.value="New passwords do not match.";xi.value="Validated. Connecting to the account service is pending — no password endpoint yet.",yt.current=yt.next=yt.confirm=""}const ro=Y("");function Ts(){ro.value="Verification link would be sent once the account service is wired up."}function fr(g){const c=g.target.files&&g.target.files[0];if(!c)return;if(c.size>1.5*1024*1024){We("Image too large (max ~1.5 MB).");return}const q=new FileReader;q.onload=()=>{be.avatar=String(q.result),We("Photo updated.")},q.readAsDataURL(c)}function hr(){be.avatar="",We("Photo removed.")}const ba=ce(()=>{var q,k,Be;const c=(be.displayName||be.name||s.email||"PV").split("@")[0].split(/[.\-_ ]+/).filter(Boolean);return((((q=c[0])==null?void 0:q[0])||"P")+(((k=c[1])==null?void 0:k[0])||((Be=c[0])==null?void 0:Be[1])||"V")).toUpperCase()}),lo=Y(!1),_n=Y(""),qn=Y(""),uo=Y(""),bn=Y([]);function Ps(g){const c="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";let q="";for(let k=0;kPs(4).toLowerCase()+"-"+Ps(4).toLowerCase()),uo.value=""}function co(){be.twoFactor=!1,bn.value=[],lo.value=!1}const Mn=navigator.userAgent;function Wo(){return/Edg\//.test(Mn)?"Edge":/OPR\//.test(Mn)?"Opera":/Chrome\//.test(Mn)?"Chrome":/Firefox\//.test(Mn)?"Firefox":/Safari\//.test(Mn)?"Safari":"Browser"}function mr(){return/Windows/.test(Mn)?"Windows":/Mac OS X/.test(Mn)?"macOS":/Android/.test(Mn)?"Android":/iPhone|iPad/.test(Mn)?"iOS":/Linux/.test(Mn)?"Linux":"Unknown OS"}const ti=Date.now(),wi=Y([]),fo=Y(!1),Wi=Y(""),Rt=gt({email:"",password:"",role:"user",organization:""}),tn=Y(""),Ko=Y(!1),Dn=Y(""),ya=ce(()=>{const g=[{value:"user",label:"User"},{value:"admin",label:"Admin"}];return u.value&&g.push({value:"superadmin",label:"Superadmin"}),g}),yn=Y([]);async function ni(){if(!f.value)return;const g=await rp();g.ok&&(yn.value=g.organizations.slice().sort((c,q)=>c.name.localeCompare(q.name)))}const Cs=ce(()=>{const g=yn.value.map(c=>({value:c.id,label:c.name}));return u.value&&g.unshift({value:"",label:"No organization"}),g});async function ii(){if(!f.value)return;fo.value=!0,Wi.value="";const g=await ip();if(fo.value=!1,!g.ok){Wi.value=g.status===403?"Manager role required.":"Could not load users.";return}wi.value=g.users.slice().sort((c,q)=>c.email.localeCompare(q.email))}function ki(g){try{const c=g.data||{},q=Object.keys(c)[0];return q&&c[q]&&c[q].message||g.message||g.error||"Invalid input."}catch{return g.error||"Could not create user."}}async function Ls(){tn.value="";const g=Rt.email.trim().toLowerCase();if(!g.includes("@"))return tn.value="Enter a valid email.";if(Rt.password.length<8)return tn.value="Password must be at least 8 characters.";Ko.value=!0;const c=u.value?Rt.organization:s.organization,{ok:q,body:k}=await op(g,Rt.password,Rt.role,c);if(Ko.value=!1,!q)return tn.value=ki(k);Rt.email="",Rt.password="",Rt.role="user",Rt.organization="",We("User created."),ii()}async function Go(g){const{ok:c,body:q}=await ap(g.id);if(Dn.value="",!c)return We(q.error||"Could not remove user.");We("User removed."),ii()}const Qe=gt({id:"",email:"",role:"user",verified:!1,password:"",organization:""}),En=Y(""),Ki=Y(!1),qo=ce(()=>!!Qe.id&&Qe.email===s.email);function gr(g){Dn.value="",Qe.id=g.id,Qe.email=g.email,Qe.role=g.role||"user",Qe.verified=!!g.verified,Qe.password="",Qe.organization=g.organization||"",En.value=""}function ho(){Qe.id="",En.value=""}async function vr(){En.value="";const g=Qe.email.trim().toLowerCase();if(!g.includes("@"))return En.value="Enter a valid email.";if(Qe.password&&Qe.password.length<8)return En.value="New password must be at least 8 characters (or leave blank).";const c={email:g,role:Qe.role,verified:Qe.verified};u.value&&(c.organization=Qe.organization),Qe.password&&(c.password=Qe.password),Ki.value=!0;const{ok:q,body:k}=await sp(Qe.id,c);if(Ki.value=!1,!q)return En.value=ki(k);We("User updated."),ho(),ii()}const po=gt({name:""}),mo=Y(""),go=Y(!1),vo=Y(""),Nt=gt({id:"",name:""}),Fn=Y(""),As=ce(()=>{const g={};for(const c of wi.value)c.organization&&(g[c.organization]=(g[c.organization]||0)+1);return g});async function _o(){mo.value="";const g=po.name.trim();if(!g)return mo.value="Enter an organization name.";go.value=!0;const{ok:c,body:q}=await lp(g);if(go.value=!1,!c)return mo.value=ki(q);po.name="",We("Organization created."),ni()}function _r(g){vo.value="",Nt.id=g.id,Nt.name=g.name,Fn.value=""}function Ms(){Nt.id="",Fn.value=""}async function xa(){Fn.value="";const g=Nt.name.trim();if(!g)return Fn.value="Enter an organization name.";const{ok:c,body:q}=await up(Nt.id,g);if(!c)return Fn.value=ki(q);We("Organization renamed."),Ms(),ni(),ii()}async function bo(g){const{ok:c,body:q}=await cp(g.id);if(vo.value="",!c)return We(q.error||"Could not delete organization.");We("Organization deleted."),ni()}function br(){const g={_app:"PilotVault",_kind:"settings-export",exportedAt:new Date().toISOString(),email:s.email,prefs:{...be},themeMode:Oo.value},c=new Blob([JSON.stringify(g,null,2)],{type:"application/json"}),q=URL.createObjectURL(c),k=document.createElement("a");k.href=q,k.download=`pilotvault-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(k),k.click(),k.remove(),URL.revokeObjectURL(q),We("Settings exported.")}const Yn=Y("");function wa(g){const c=g.target.files&&g.target.files[0];if(!c)return;const q=new FileReader;q.onload=()=>{try{const k=JSON.parse(String(q.result)),Be=k.prefs||k;if(!ed(Be))throw new Error("bad shape");k.themeMode&&Ha(k.themeMode),ml(be.fontSize),gl(be.reduceMotion),Yn.value="Settings imported and applied."}catch{Yn.value="That file is not a valid PilotVault settings export."}},q.readAsText(c),g.target.value=""}const mt=gt({understand:!1,typed:"",cooldown:0,armed:!1,msg:""});let yo=null;const On=ce(()=>s.email||"DELETE MY ACCOUNT"),Yo=ce(()=>mt.understand&&mt.typed===On.value);function ka(){Yo.value&&(mt.armed=!0,mt.cooldown=5,clearInterval(yo),yo=setInterval(()=>{mt.cooldown--,mt.cooldown<=0&&clearInterval(yo)},1e3))}Bt(Yo,g=>{!g&&mt.armed&&(mt.armed=!1,mt.cooldown=0,clearInterval(yo))});function xo(){if(!(!mt.armed||mt.cooldown>0)){try{localStorage.removeItem("pv_prefs")}catch{}mt.msg="Account deletion requires the account service. Local data was cleared and you were signed out.",setTimeout(()=>l("logout"),900)}}return fi(()=>{O=setInterval(()=>B.value=Date.now(),1e3),ni(),ii(),Ge(),ir(),mn(),gs(),lr()}),us(()=>{clearInterval(O),clearInterval(yo),clearTimeout(ks)}),(g,c)=>(p(),m("div",Cm,[a("div",Lm,[c[72]||(c[72]=a("div",null,[a("div",{class:"eyebrow"},"Preferences"),a("h2",{class:"mt-0.5 text-[22px] font-bold tracking-tightest text-ink"},"Settings")],-1)),a("div",Am,[A(J,{name:"search",size:16,class:"text-ink-muted"}),ie(a("input",{"onUpdate:modelValue":c[0]||(c[0]=q=>H.value=q),placeholder:"Search settings…",class:"w-full border-none bg-transparent text-sm text-ink outline-none placeholder:text-ink-muted"},null,512),[[me,H.value]]),H.value?(p(),m("button",{key:0,class:"text-ink-muted hover:text-ink","aria-label":"Clear search",onClick:c[1]||(c[1]=q=>H.value="")},[A(J,{name:"x",size:15})])):I("",!0)])]),a("div",Mm,[ie(a("nav",Em,[(p(!0),m(le,null,Ie(T.value,q=>(p(),m("button",{key:q.id,class:Ce(["flex items-center gap-2.5 rounded px-3 py-2.5 text-left text-sm transition",[M.value===q.id?q.danger?"bg-danger-soft font-semibold text-danger-fg":"bg-accent-soft font-semibold text-accent-soft-fg":q.danger?"font-medium text-danger-fg hover:bg-danger-soft":"font-medium text-ink-secondary hover:bg-surface-2"]]),onClick:k=>M.value=q.id},[A(J,{name:q.icon,size:17},null,8,["name"]),a("span",zm,w(q.label),1)],10,Om))),128))],512),[[kh,!j.value]]),a("div",$m,[j.value&&!fe.value.length?(p(),m("div",Im," No settings match “"+w(H.value)+"”. ",1)):I("",!0),(p(!0),m(le,null,Ie(fe.value,q=>(p(),m(le,{key:q.id},[j.value?(p(),m("div",Nm,[A(J,{name:q.icon,size:14},null,8,["name"]),z(" "+w(q.label),1)])):I("",!0),q.id==="account"?(p(),m("div",Dm,[A(xe,{title:"Full name",desc:"Shown to your team on flights and audit logs.",keywords:"full name account"},{default:ye(()=>[ie(a("input",{"onUpdate:modelValue":c[2]||(c[2]=k=>Ee(be).name=k),class:"field w-56",placeholder:"Jane Operator",onBlur:c[3]||(c[3]=k=>We("Saved."))},null,544),[[me,Ee(be).name]])]),_:1}),A(xe,{title:"Username",desc:"Your unique handle within PilotVault.",keywords:"username handle"},{default:ye(()=>[a("div",Fm,[c[73]||(c[73]=a("span",{class:"text-sm text-ink-muted"},"@",-1)),ie(a("input",{"onUpdate:modelValue":c[4]||(c[4]=k=>Ee(be).username=k),class:"field w-48",placeholder:"jane",onBlur:c[5]||(c[5]=k=>We("Saved."))},null,544),[[me,Ee(be).username]])])]),_:1}),A(xe,{title:"Email address",desc:"Used for sign-in and notifications.",keywords:"email verification verify"},{default:ye(()=>[a("div",Rm,[a("span",Bm,w(t.email||"—"),1),a("span",Um,[A(J,{name:"mail",size:12}),c[74]||(c[74]=z(" Unverified ",-1))])])]),_:1}),A(xe,{title:"Role",desc:"Your access level in PilotVault.",keywords:"role admin user superadmin access rights permissions"},{default:ye(()=>[a("span",{class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",y(t.role)])},[A(J,{name:_(t.role),size:12},null,8,["name"]),z(w(h(t.role)),1)],2)]),_:1}),A(xe,{title:"Organization",desc:"The organization your account belongs to.",keywords:"organization org tenant company"},{default:ye(()=>[a("span",{class:Ce(["text-sm",t.organizationName?"text-ink":"text-ink-muted"])},w(t.organizationName||(u.value?"All organizations":"None")),3)]),_:1}),A(xe,{block:"",title:"Verify email",desc:"Confirm ownership to enable password resets and alerts.",keywords:"verify email resend"},{default:ye(()=>[a("button",{class:"btn-ghost",onClick:Ts},"Send verification link"),ro.value?(p(),m("p",Vm,w(ro.value),1)):I("",!0)]),_:1}),A(xe,{block:"",title:"Change password",desc:"Use at least 8 characters.",keywords:"password change current new"},{default:ye(()=>[a("div",Zm,[ie(a("input",{"onUpdate:modelValue":c[6]||(c[6]=k=>yt.current=k),type:"password",class:"field",placeholder:"Current password"},null,512),[[me,yt.current]]),ie(a("input",{"onUpdate:modelValue":c[7]||(c[7]=k=>yt.next=k),type:"password",class:"field",placeholder:"New password"},null,512),[[me,yt.next]]),ie(a("input",{"onUpdate:modelValue":c[8]||(c[8]=k=>yt.confirm=k),type:"password",class:"field",placeholder:"Confirm new password"},null,512),[[me,yt.confirm]]),a("div",Hm,[a("button",{class:"btn-accent",onClick:dr},"Update password"),xi.value?(p(),m("span",{key:0,class:Ce(["text-xs",Ss.value?"text-success-fg":"text-ink-muted"])},w(xi.value),3)):I("",!0)])])]),_:1})])):q.id==="appearance"?(p(),m("div",jm,[A(xe,{title:"Theme",desc:"Light, dark, or follow your system.",keywords:"theme light dark system appearance"},{default:ye(()=>[A(wn,{modelValue:Se.value,"onUpdate:modelValue":c[9]||(c[9]=k=>Se.value=k),options:de},null,8,["modelValue"])]),_:1}),A(xe,{title:"Font size",desc:"Scales the entire interface for readability.",keywords:"font size accessibility text"},{default:ye(()=>[A(wn,{modelValue:Ee(be).fontSize,"onUpdate:modelValue":c[10]||(c[10]=k=>Ee(be).fontSize=k),options:Fe},null,8,["modelValue"])]),_:1}),A(xe,{title:"Reduce motion",desc:"Minimise animations and transitions.",keywords:"reduce motion accessibility animation"},{default:ye(()=>[A(nn,{modelValue:Ee(be).reduceMotion,"onUpdate:modelValue":c[11]||(c[11]=k=>Ee(be).reduceMotion=k)},null,8,["modelValue"])]),_:1}),A(xe,{title:"Language",desc:"Interface language.",keywords:"language locale"},{default:ye(()=>[ie(a("select",{"onUpdate:modelValue":c[12]||(c[12]=k=>Ee(be).language=k),class:"field w-48"},[(p(),m(le,null,Ie(Te,([k,Be])=>a("option",{key:k,value:k},w(Be),9,Wm)),64))],512),[[Ot,Ee(be).language]])]),_:1}),A(xe,{title:"Region",desc:"Affects number, unit and date defaults.",keywords:"region country locale"},{default:ye(()=>[ie(a("select",{"onUpdate:modelValue":c[13]||(c[13]=k=>Ee(be).region=k),class:"field w-48"},[(p(!0),m(le,null,Ie(Ee(Ze),([k,Be])=>(p(),m("option",{key:k,value:k},w(Be),9,Km))),128))],512),[[Ot,Ee(be).region]])]),_:1}),A(xe,{title:"Date format",desc:"How calendar dates are displayed.",keywords:"date format"},{default:ye(()=>[ie(a("select",{"onUpdate:modelValue":c[14]||(c[14]=k=>Ee(be).dateFormat=k),class:"field w-48"},[(p(),m(le,null,Ie(Q,([k,Be])=>a("option",{key:k,value:k},w(Be),9,Gm)),64))],512),[[Ot,Ee(be).dateFormat]])]),_:1}),A(xe,{title:"Time format",desc:"12- or 24-hour clock.",keywords:"time format clock 12 24 hour"},{default:ye(()=>[A(wn,{modelValue:Ee(be).timeFormat,"onUpdate:modelValue":c[15]||(c[15]=k=>Ee(be).timeFormat=k),options:Oe},null,8,["modelValue"])]),_:1}),A(xe,{title:"Preview",desc:"How timestamps appear across the app.",keywords:"preview date time"},{default:ye(()=>[a("span",qm,w(N.value),1)]),_:1}),c[75]||(c[75]=a("p",{class:"mt-3 text-xs text-ink-muted"}," Language & region are stored now; full localisation ships with the account service. ",-1))])):q.id==="integrations"?(p(),m("div",Ym,[j.value?I("",!0):(p(),m("div",Jm,[(p(),m(le,null,Ie(_a,k=>a("button",{key:k.id,type:"button",class:Ce(["-mb-px inline-flex items-center gap-1.5 whitespace-nowrap border-b-2 px-3 py-2 text-sm font-semibold transition",jo.value===k.id?"border-accent text-ink":"border-transparent text-ink-secondary hover:text-ink"]),onClick:Be=>jo.value=k.id},[A(J,{name:k.icon,size:16},null,8,["name"]),z(w(k.label),1)],10,Xm)),64))])),Hi("apis-external")?(p(),m(le,{key:1},[a("div",Qm,[a("div",eg,[a("div",tg,[A(J,{name:"radio",size:20})]),c[76]||(c[76]=a("div",{class:"min-w-0"},[a("div",{class:"text-sm font-semibold text-ink"},"OpenSky Network"),a("div",{class:"mt-0.5 text-xs text-ink-muted"}," Live ADS-B aircraft data. Configure your own OAuth2 credentials, plan and default bounding box. ")],-1))]),$.loaded&&!$.available?(p(),m("div",ng,[A(J,{name:"lock",size:14,class:"mr-1 inline"}),c[77]||(c[77]=z(" OpenSky is currently disabled by your administrator. Contact them to enable it. ",-1))])):I("",!0),$.canEditOrg?(p(),m("div",ig,[c[78]||(c[78]=a("div",{class:"text-xs text-ink-muted"},"Manage your own settings, or organization-wide settings that apply to every user.",-1)),A(wn,{modelValue:Ye.value,"onUpdate:modelValue":c[16]||(c[16]=k=>Ye.value=k),options:Pt},null,8,["modelValue"])])):I("",!0),ve.value?(p(),nt(xe,{key:2,title:"Enable OpenSky (organization-wide)",desc:"Turn OpenSky on or off for everyone in your organization.",keywords:"enable disable plugin opensky organization"},{default:ye(()=>[A(nn,{"model-value":$.orgEnabled,disabled:!$.available,"onUpdate:modelValue":pt},null,8,["model-value","disabled"])]),_:1})):(p(),nt(xe,{key:3,title:"Enable OpenSky",desc:"Turn the plugin on for your account in the Web App.",keywords:"enable disable plugin opensky"},{default:ye(()=>[A(nn,{"model-value":$.enabled,disabled:!$.available||!$.orgEnabled,"onUpdate:modelValue":pt},null,8,["model-value","disabled"])]),_:1})),!ve.value&&$.available&&!$.orgEnabled?(p(),m("div",og,[A(J,{name:"lock",size:13,class:"mr-1 inline"}),c[80]||(c[80]=z("OpenSky is turned off for your organization",-1)),$.canEditOrg?(p(),m("span",sg,[...c[79]||(c[79]=[z(" — switch to ",-1),a("span",{class:"font-semibold"},"Organization",-1),z(" to turn it back on",-1)])])):I("",!0),c[81]||(c[81]=z(". ",-1))])):I("",!0),ve.value?(p(),m("div",ag,[A(J,{name:"users",size:13,class:"mr-1 inline"}),c[82]||(c[82]=z("These are organization-wide settings — they apply to everyone in ",-1)),a("span",rg,w(t.organizationName||"your organization"),1),c[83]||(c[83]=z(". Leave a field blank to let each user choose their own; a value set here overrides the user's. ",-1))])):ae.value?(p(),m("div",lg," As a superadmin you manage the global OpenSky configuration in the API Server panel. The effective configuration is shown below. ")):I("",!0),$.available&&!ve.value?(p(),m("div",ug,[a("div",cg,[a("div",dg,[A(J,{name:"signal",size:15}),c[84]||(c[84]=z("Credit usage ",-1))]),Ue.value?(p(),m("span",fg,"Checked "+w(De()),1)):I("",!0)]),Ve.value?(p(),m(le,{key:0},[Ve.value.remaining!=null?(p(),m(le,{key:0},[a("div",hg,[a("span",pg,w(Le(Ve.value.remaining)),1),a("span",mg,"/ "+w(Le(Ve.value.daily))+" credits left today",1)]),a("div",gg,[a("div",{class:Ce(["h-full rounded-full transition-all",st.value]),style:Eo({width:wt.value+"%"})},null,6)]),a("div",vg," Used "+w(Le(Ve.value.daily-Ve.value.remaining))+" today · "+w(Ve.value.probeCost)+" credit"+w(Ve.value.probeCost===1?"":"s")+" per query · "+w(Ve.value.mode),1)],64)):(p(),m(le,{key:1},[a("div",_g,[c[85]||(c[85]=z("Daily allowance: ",-1)),a("span",bg,w(Le(Ve.value.daily)),1),c[86]||(c[86]=z(" credits",-1))]),a("div",yg,w(Ve.value.probeCost)+" credit"+w(Ve.value.probeCost===1?"":"s")+" per query · "+w(Ve.value.mode)+". OpenSky only reports live remaining credits for authenticated requests — add OAuth2 credentials below to track usage. ",1)],64))],64)):(p(),m("div",xg,[...c[87]||(c[87]=[z(" Run ",-1),a("span",{class:"font-semibold text-ink-secondary"},"Test connection",-1),z(" below to fetch your live OpenSky credit balance. ",-1)])]))])):I("",!0),A(xe,{title:"OpenSky plan",desc:"Your account tier — sets the daily credit allowance.",keywords:"plan tier credits"},{default:ye(()=>[ke("plan")?(p(),m("span",wg,[z(w((Ut.find(k=>k.value===se("plan").effective)||{}).label||se("plan").effective||"—")+" ",1),Pe("plan")?(p(),m("span",kg,[A(J,{name:"lock",size:10}),z(w(Pe("plan")),1)])):I("",!0)])):(p(),nt(wn,{key:1,modelValue:we.plan,"onUpdate:modelValue":c[17]||(c[17]=k=>we.plan=k),options:Ut},null,8,["modelValue"]))]),_:1}),A(xe,{title:"Default bounding box",desc:"Automatic follows your location; or pick a region, or enter lamin,lomin,lamax,lomax by hand.",keywords:"bounding box bbox area region country continent world europe custom coordinates automatic location drone"},{default:ye(()=>[ke("bbox")?(p(),m("span",Sg,[z(w(S(se("bbox").effective)||se("bbox").effective||"—")+" ",1),Pe("bbox")?(p(),m("span",Tg,[A(J,{name:"lock",size:10}),z(w(Pe("bbox")),1)])):I("",!0)])):(p(),m("div",Pg,[ie(a("select",{"onUpdate:modelValue":c[18]||(c[18]=k=>V.value=k),class:"field w-64"},[ve.value?I("",!0):(p(),m("option",Cg,"Automatic (by location)")),(p(),m(le,null,Ie(kt,k=>a("optgroup",{key:k.label,label:k.label},[(p(!0),m(le,null,Ie(k.options,Be=>(p(),m("option",{key:Be.value,value:Be.value},w(Be.label),9,Ag))),128))],8,Lg)),64)),c[88]||(c[88]=a("option",{value:"__custom__"},"Custom…",-1))],512),[[Ot,V.value]]),re.value?(p(),m("p",Mg," Live map follows drone location → your device location → your Region ("+w(he.value)+"). ",1)):I("",!0),G.value?ie((p(),m("input",{key:1,"onUpdate:modelValue":c[19]||(c[19]=k=>we.bbox=k),class:"field w-64 font-mono",placeholder:"50.5,3.2,53.7,7.3"},null,512)),[[me,we.bbox]]):I("",!0)]))]),_:1}),A(xe,{title:"OAuth2 client ID",desc:"Optional — leave blank for anonymous access (lower limits).",keywords:"oauth client id credentials"},{default:ye(()=>[ke("clientId")?(p(),m("span",Eg,[z(w(se("clientId").effective||"—")+" ",1),Pe("clientId")?(p(),m("span",Og,[A(J,{name:"lock",size:10}),z(w(Pe("clientId")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[20]||(c[20]=k=>we.clientId=k),class:"field w-64",placeholder:"your-api-client"},null,512)),[[me,we.clientId]])]),_:1}),A(xe,{title:"OAuth2 client secret",desc:"Paired with the client ID for authenticated access.",keywords:"oauth client secret credentials password"},{default:ye(()=>[ke("clientSecret")?(p(),m("span",zg,[z(w(se("clientSecret").effective||"—")+" ",1),Pe("clientSecret")?(p(),m("span",$g,[A(J,{name:"lock",size:10}),z(w(Pe("clientSecret")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[21]||(c[21]=k=>we.clientSecret=k),type:"password",class:"field w-64",placeholder:"••••••••"},null,512)),[[me,we.clientSecret]])]),_:1}),$.available&&!$.allowAnonymous?(p(),m("div",Ig," Anonymous access is disabled by the administrator — OpenSky needs OAuth2 credentials from some layer to work. ")):I("",!0),a("div",Ng,[ae.value?I("",!0):(p(),m("button",{key:0,class:"btn-accent",disabled:ue.value||!$.available,onClick:ht},w(ue.value?"Saving…":ve.value?"Save organization settings":"Save settings"),9,Dg)),ve.value?I("",!0):(p(),m("div",Fg,[c[91]||(c[91]=a("label",{class:"text-xs text-ink-muted"},"Test area",-1)),ie(a("select",{"onUpdate:modelValue":c[22]||(c[22]=k=>Ct.value=k),class:"field w-44"},[c[89]||(c[89]=a("option",{value:"__default__"},"Default bounding box",-1)),(p(),m(le,null,Ie(Vt,k=>a("optgroup",{key:k.label,label:k.label},[(p(!0),m(le,null,Ie(k.options,Be=>(p(),m("option",{key:Be.value,value:Be.value},w(Be.label),9,Bg))),128))],8,Rg)),64)),c[90]||(c[90]=a("option",{value:"__custom__"},"Custom…",-1))],512),[[Ot,Ct.value]]),$t.value?ie((p(),m("input",{key:0,"onUpdate:modelValue":c[23]||(c[23]=k=>Zt.value=k),class:"field w-44 font-mono",placeholder:"lamin,lomin,lamax,lomax"},null,512)),[[me,Zt.value]]):I("",!0)])),ve.value?I("",!0):(p(),m("button",{key:2,class:"btn-ghost",disabled:ft.value||!$.available,onClick:kn},w(ft.value?"Testing…":"Test connection"),9,Ug)),ge.value?(p(),m("span",Vg,w(ge.value),1)):I("",!0),pe.value&&!ve.value?(p(),m("span",{key:4,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",zi(pe.value.status)])},[c[92]||(c[92]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(pe.value.detail||pe.value.status),1)],2)):I("",!0)])]),a("div",Zg,[a("div",Hg,[a("div",jg,[A(J,{name:"sun",size:20})]),c[93]||(c[93]=a("div",{class:"min-w-0"},[a("div",{class:"text-sm font-semibold text-ink"},"OpenWeather"),a("div",{class:"mt-0.5 text-xs text-ink-muted"}," Current conditions and forecast from the OpenWeather API. Configure the API key and default location your account uses. ")],-1))]),Xe.loaded&&!Xe.available?(p(),m("div",Wg,[A(J,{name:"lock",size:14,class:"mr-1 inline"}),c[94]||(c[94]=z(" OpenWeather is currently disabled by your administrator. Contact them to enable it. ",-1))])):I("",!0),Xe.canEditOrg?(p(),m("div",Kg,[c[95]||(c[95]=a("div",{class:"text-xs text-ink-muted"},"Manage your own settings, or organization-wide settings that apply to every user.",-1)),A(wn,{modelValue:In.value,"onUpdate:modelValue":c[24]||(c[24]=k=>In.value=k),options:Pt},null,8,["modelValue"])])):I("",!0),Ln.value?(p(),nt(xe,{key:2,title:"Enable OpenWeather (organization-wide)",desc:"Turn it on or off for everyone in your organization.",keywords:"enable disable plugin openweather weather organization"},{default:ye(()=>[A(nn,{"model-value":Xe.orgEnabled,disabled:!Xe.available,"onUpdate:modelValue":Bi},null,8,["model-value","disabled"])]),_:1})):(p(),nt(xe,{key:3,title:"Enable OpenWeather",desc:"Turn the plugin on for your account in the Web App.",keywords:"enable disable plugin openweather weather"},{default:ye(()=>[A(nn,{"model-value":Xe.enabled,disabled:!Xe.available||!Xe.orgEnabled,"onUpdate:modelValue":Bi},null,8,["model-value","disabled"])]),_:1})),!Ln.value&&Xe.available&&!Xe.orgEnabled?(p(),m("div",Gg,[A(J,{name:"lock",size:13,class:"mr-1 inline"}),c[97]||(c[97]=z("OpenWeather is turned off for your organization",-1)),Xe.canEditOrg?(p(),m("span",qg,[...c[96]||(c[96]=[z(" — switch to ",-1),a("span",{class:"font-semibold"},"Organization",-1),z(" to turn it back on",-1)])])):I("",!0),c[98]||(c[98]=z(". ",-1))])):I("",!0),Ln.value?(p(),m("div",Yg,[A(J,{name:"users",size:13,class:"mr-1 inline"}),c[99]||(c[99]=z("These are organization-wide settings — they apply to everyone in ",-1)),a("span",Jg,w(t.organizationName||"your organization"),1),c[100]||(c[100]=z(". Leave the API key blank to let each user configure their own; a key set here overrides the user's. ",-1))])):Ri.value?(p(),m("div",Xg," As a superadmin you manage the global OpenWeather configuration in the API Server panel. The effective configuration is shown below. ")):I("",!0),A(xe,{title:"API key",desc:"Your OpenWeather API key (the appid parameter). Required — OpenWeather has no anonymous tier.",keywords:"api key appid secret credentials token openweather"},{default:ye(()=>[jt("apiKey")?(p(),m("span",Qg,[z(w(ze("apiKey").effective||"—")+" ",1),Je("apiKey")?(p(),m("span",ev,[A(J,{name:"lock",size:10}),z(w(Je("apiKey")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[25]||(c[25]=k=>Ht.apiKey=k),type:"password",class:"field w-64",placeholder:"••••••••"},null,512)),[[me,Ht.apiKey]])]),_:1}),A(xe,{title:"Units",desc:"Measurement system for temperatures and wind speed.",keywords:"units metric imperial standard celsius fahrenheit kelvin"},{default:ye(()=>[jt("units")?(p(),m("span",tv,[z(w((Ro.find(k=>k.value===ze("units").effective)||{}).label||ze("units").effective||"—")+" ",1),Je("units")?(p(),m("span",nv,[A(J,{name:"lock",size:10}),z(w(Je("units")),1)])):I("",!0)])):(p(),nt(wn,{key:1,modelValue:Ht.units,"onUpdate:modelValue":c[26]||(c[26]=k=>Ht.units=k),options:Ro},null,8,["modelValue"]))]),_:1}),A(xe,{title:"Default latitude",desc:"Latitude used by the health probe and calls with no location (−90…90).",keywords:"latitude location coordinates default"},{default:ye(()=>[jt("lat")?(p(),m("span",iv,[z(w(ze("lat").effective||"—")+" ",1),Je("lat")?(p(),m("span",ov,[A(J,{name:"lock",size:10}),z(w(Je("lat")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[27]||(c[27]=k=>Ht.lat=k),inputmode:"decimal",class:"field w-40 font-mono",placeholder:"52.2297"},null,512)),[[me,Ht.lat]])]),_:1}),A(xe,{title:"Default longitude",desc:"Longitude used by the health probe and calls with no location (−180…180).",keywords:"longitude location coordinates default"},{default:ye(()=>[jt("lon")?(p(),m("span",sv,[z(w(ze("lon").effective||"—")+" ",1),Je("lon")?(p(),m("span",av,[A(J,{name:"lock",size:10}),z(w(Je("lon")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[28]||(c[28]=k=>Ht.lon=k),inputmode:"decimal",class:"field w-40 font-mono",placeholder:"21.0122"},null,512)),[[me,Ht.lon]])]),_:1}),A(xe,{title:"Language",desc:"Optional ISO code for human-readable weather descriptions, e.g. en, pl, de.",keywords:"language locale description"},{default:ye(()=>[jt("lang")?(p(),m("span",rv,[z(w(ze("lang").effective||"—")+" ",1),Je("lang")?(p(),m("span",lv,[A(J,{name:"lock",size:10}),z(w(Je("lang")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[29]||(c[29]=k=>Ht.lang=k),class:"field w-24 font-mono",placeholder:"en"},null,512)),[[me,Ht.lang]])]),_:1}),A(xe,{title:"Calls per minute limit",desc:"Your plan's per-minute limit (free tier is 60). Only used to gauge app usage below. Leave blank to inherit; the app falls back to 60.",keywords:"calls per minute limit rate quota plan usage"},{default:ye(()=>[jt("callsPerMinute")?(p(),m("span",uv,[z(w(ze("callsPerMinute").effective||"60")+" ",1),Je("callsPerMinute")?(p(),m("span",cv,[A(J,{name:"lock",size:10}),z(w(Je("callsPerMinute")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[30]||(c[30]=k=>Ht.callsPerMinute=k),inputmode:"numeric",class:"field w-24 font-mono",placeholder:"60"},null,512)),[[me,Ht.callsPerMinute]])]),_:1}),Xe.available&&!Ln.value?(p(),m("div",dv,[a("div",fv,[a("div",hv,[A(J,{name:"signal",size:15}),c[101]||(c[101]=z("API call usage ",-1))]),Gn.value?(p(),m("span",pv,"Checked "+w(Uo()),1)):I("",!0)]),Ui.value?(p(),m(le,{key:0},[a("div",mv,[a("span",gv,w(Ui.value.minuteUsed),1),a("span",vv,"/ "+w(Ui.value.minuteLimit||"—")+" calls this minute",1)]),vs.value!=null?(p(),m("div",_v,[a("div",{class:Ce(["h-full rounded-full transition-all",fa.value]),style:Eo({width:vs.value+"%"})},null,6)])):I("",!0),a("div",bv,w(Ui.value.dayUsed)+" calls today · counts only requests PilotVault makes with this key, since server start. OpenWeather does not report remaining quota — check your account dashboard for the authoritative total. ",1)],64)):(p(),m("div",yv,[...c[102]||(c[102]=[z(" Run ",-1),a("span",{class:"font-semibold text-ink-secondary"},"Test connection",-1),z(" below to record and show call usage. ",-1)])]))])):I("",!0),a("div",xv,[Ri.value?I("",!0):(p(),m("button",{key:0,class:"btn-accent",disabled:Di.value||!Xe.available,onClick:Ft},w(Di.value?"Saving…":Ln.value?"Save organization settings":"Save settings"),9,wv)),Ln.value?I("",!0):(p(),m("button",{key:1,class:"btn-ghost",disabled:Fi.value||!Xe.available,onClick:bi},w(Fi.value?"Testing…":"Test connection"),9,kv)),Kn.value?(p(),m("span",Sv,w(Kn.value),1)):I("",!0),Gn.value&&!Ln.value?(p(),m("span",Tv,"Checked "+w(Uo()),1)):I("",!0),Qt.value&&!Ln.value?(p(),m("span",{key:4,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",da(Qt.value.status)])},[c[103]||(c[103]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Qt.value.detail||Qt.value.status),1)],2)):I("",!0)])])],64)):I("",!0),Hi("drives-external")?(p(),m(le,{key:2},[a("div",Pv,[a("div",Cv,[a("div",Lv,[A(J,{name:"server",size:20})]),c[104]||(c[104]=a("div",{class:"min-w-0"},[a("div",{class:"text-sm font-semibold text-ink"},"File Transfer (FTP / SFTP)"),a("div",{class:"mt-0.5 text-xs text-ink-muted"}," Connect to an FTP, FTPS or SFTP server. Configure the connection your account uses for file transfers. ")],-1))]),at.loaded&&!at.available?(p(),m("div",Av,[A(J,{name:"lock",size:14,class:"mr-1 inline"}),c[105]||(c[105]=z(" File transfer is currently disabled by your administrator. Contact them to enable it. ",-1))])):I("",!0),at.canEditOrg?(p(),m("div",Mv,[c[106]||(c[106]=a("div",{class:"text-xs text-ink-muted"},"Manage your own settings, or organization-wide settings that apply to every user.",-1)),A(wn,{modelValue:Sn.value,"onUpdate:modelValue":c[31]||(c[31]=k=>Sn.value=k),options:Pt},null,8,["modelValue"])])):I("",!0),St.value?(p(),nt(xe,{key:2,title:"Enable file transfer (organization-wide)",desc:"Turn it on or off for everyone in your organization.",keywords:"enable disable plugin ftp sftp organization"},{default:ye(()=>[A(nn,{"model-value":at.orgEnabled,disabled:!at.available,"onUpdate:modelValue":ra},null,8,["model-value","disabled"])]),_:1})):(p(),nt(xe,{key:3,title:"Enable file transfer",desc:"Turn the plugin on for your account in the Web App.",keywords:"enable disable plugin ftp sftp"},{default:ye(()=>[A(nn,{"model-value":at.enabled,disabled:!at.available||!at.orgEnabled,"onUpdate:modelValue":ra},null,8,["model-value","disabled"])]),_:1})),!St.value&&at.available&&!at.orgEnabled?(p(),m("div",Ev,[A(J,{name:"lock",size:13,class:"mr-1 inline"}),c[108]||(c[108]=z("File transfer is turned off for your organization",-1)),at.canEditOrg?(p(),m("span",Ov,[...c[107]||(c[107]=[z(" — switch to ",-1),a("span",{class:"font-semibold"},"Organization",-1),z(" to turn it back on",-1)])])):I("",!0),c[109]||(c[109]=z(". ",-1))])):I("",!0),St.value?(p(),m("div",zv,[A(J,{name:"users",size:13,class:"mr-1 inline"}),c[110]||(c[110]=z("These are organization-wide settings — they apply to everyone in ",-1)),a("span",$v,w(t.organizationName||"your organization"),1),c[111]||(c[111]=z(". Leave the connection blank to let each user configure their own; a connection set here overrides the user's. ",-1))])):Me.value?(p(),m("div",Iv," As a superadmin you manage the global file-transfer configuration in the API Server panel. The effective configuration is shown below. ")):I("",!0),A(xe,{title:"Protocol",desc:"SFTP (over SSH), FTPS (FTP over TLS), or plain FTP.",keywords:"protocol sftp ftps ftp"},{default:ye(()=>[_t("protocol")?(p(),m("span",Nv,[z(w(oa(Z("protocol").effective))+" ",1),bt("protocol")?(p(),m("span",Dv,[A(J,{name:"lock",size:10}),z(w(bt("protocol")),1)])):I("",!0)])):(p(),nt(wn,{key:1,modelValue:rt.protocol,"onUpdate:modelValue":c[32]||(c[32]=k=>rt.protocol=k),options:U},null,8,["modelValue"]))]),_:1}),A(xe,{title:"Host",desc:"Server hostname or IP address.",keywords:"host server address"},{default:ye(()=>[_t("host")?(p(),m("span",Fv,[z(w(Z("host").effective||"—")+" ",1),bt("host")?(p(),m("span",Rv,[A(J,{name:"lock",size:10}),z(w(bt("host")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[33]||(c[33]=k=>rt.host=k),class:"field w-64",placeholder:"files.example.com"},null,512)),[[me,rt.host]])]),_:1}),A(xe,{title:"Port",desc:"Leave blank for the protocol default (22 for SFTP, 21 for FTP/FTPS).",keywords:"port"},{default:ye(()=>[_t("port")?(p(),m("span",Bv,[z(w(Z("port").effective||"default")+" ",1),bt("port")?(p(),m("span",Uv,[A(J,{name:"lock",size:10}),z(w(bt("port")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[34]||(c[34]=k=>rt.port=k),inputmode:"numeric",class:"field w-24 font-mono",placeholder:"22"},null,512)),[[me,rt.port]])]),_:1}),A(xe,{title:"Username",desc:"Account used to authenticate.",keywords:"username login account"},{default:ye(()=>[_t("username")?(p(),m("span",Vv,[z(w(Z("username").effective||"—")+" ",1),bt("username")?(p(),m("span",Zv,[A(J,{name:"lock",size:10}),z(w(bt("username")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[35]||(c[35]=k=>rt.username=k),class:"field w-64",placeholder:"user"},null,512)),[[me,rt.username]])]),_:1}),A(xe,{title:"Password",desc:"Password auth for FTP/FTPS, or SFTP password login. Leave blank to use a key.",keywords:"password secret credentials"},{default:ye(()=>[_t("password")?(p(),m("span",Hv,[z(w(Z("password").effective||"—")+" ",1),bt("password")?(p(),m("span",jv,[A(J,{name:"lock",size:10}),z(w(bt("password")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[36]||(c[36]=k=>rt.password=k),type:"password",class:"field w-64",placeholder:"••••••••"},null,512)),[[me,rt.password]])]),_:1}),Et.value==="sftp"?(p(),nt(xe,{key:7,block:"",title:"SSH private key",desc:"PEM key for SFTP key auth — used instead of, or alongside, a password.",keywords:"private key ssh pem identity"},{default:ye(()=>[_t("privateKey")?(p(),m("span",Wv,[z(w(Z("privateKey").effective||"—")+" ",1),bt("privateKey")?(p(),m("span",Kv,[A(J,{name:"lock",size:10}),z(w(bt("privateKey")),1)])):I("",!0)])):ie((p(),m("textarea",{key:1,"onUpdate:modelValue":c[37]||(c[37]=k=>rt.privateKey=k),rows:"3",class:"field w-full font-mono text-xs",placeholder:"-----BEGIN OPENSSH PRIVATE KEY-----"},null,512)),[[me,rt.privateKey]])]),_:1})):I("",!0),Et.value==="sftp"?(p(),nt(xe,{key:8,title:"Private key passphrase",desc:"Passphrase protecting the SSH private key, if any.",keywords:"passphrase key secret"},{default:ye(()=>[_t("keyPassphrase")?(p(),m("span",Gv,[z(w(Z("keyPassphrase").effective||"—")+" ",1),bt("keyPassphrase")?(p(),m("span",qv,[A(J,{name:"lock",size:10}),z(w(bt("keyPassphrase")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[38]||(c[38]=k=>rt.keyPassphrase=k),type:"password",class:"field w-64",placeholder:"••••••••"},null,512)),[[me,rt.keyPassphrase]])]),_:1})):I("",!0),Et.value==="sftp"?(p(),nt(xe,{key:9,title:"Host key fingerprint",desc:"Optional SHA256:… fingerprint to pin the server's host key. Blank accepts any key.",keywords:"host key fingerprint verify trust"},{default:ye(()=>[_t("hostKeyFingerprint")?(p(),m("span",Yv,[z(w(Z("hostKeyFingerprint").effective||"—")+" ",1),bt("hostKeyFingerprint")?(p(),m("span",Jv,[A(J,{name:"lock",size:10}),z(w(bt("hostKeyFingerprint")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[39]||(c[39]=k=>rt.hostKeyFingerprint=k),class:"field w-full font-mono text-xs",placeholder:"SHA256:…"},null,512)),[[me,rt.hostKeyFingerprint]])]),_:1})):I("",!0),Et.value==="ftps"?(p(),nt(xe,{key:10,title:"TLS verification",desc:"Skip only for self-signed test servers.",keywords:"tls certificate verify insecure ftps"},{default:ye(()=>[_t("insecureSkipVerify")?(p(),m("span",Xv,[z(w(Z("insecureSkipVerify").effective==="true"?"Skip verification":"Verify certificate")+" ",1),bt("insecureSkipVerify")?(p(),m("span",Qv,[A(J,{name:"lock",size:10}),z(w(bt("insecureSkipVerify")),1)])):I("",!0)])):(p(),nt(wn,{key:1,modelValue:rt.insecureSkipVerify,"onUpdate:modelValue":c[40]||(c[40]=k=>rt.insecureSkipVerify=k),options:E},null,8,["modelValue"]))]),_:1})):I("",!0),A(xe,{title:"Base path",desc:"Working directory and health-check target, e.g. /uploads.",keywords:"base path directory folder root"},{default:ye(()=>[_t("basePath")?(p(),m("span",e_,[z(w(Z("basePath").effective||"—")+" ",1),bt("basePath")?(p(),m("span",t_,[A(J,{name:"lock",size:10}),z(w(bt("basePath")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[41]||(c[41]=k=>rt.basePath=k),class:"field w-64 font-mono",placeholder:"/uploads"},null,512)),[[me,rt.basePath]])]),_:1}),a("div",n_,[Me.value?I("",!0):(p(),m("button",{key:0,class:"btn-accent",disabled:pi.value||!at.available,onClick:or},w(pi.value?"Saving…":St.value?"Save organization settings":"Save settings"),9,i_)),St.value?I("",!0):(p(),m("button",{key:1,class:"btn-ghost",disabled:Ii.value||!at.available,onClick:sr},w(Ii.value?"Testing…":"Test connection"),9,o_)),hi.value?(p(),m("span",s_,w(hi.value),1)):I("",!0),jn.value&&!St.value?(p(),m("span",a_,"Checked "+w(sa()),1)):I("",!0),Gt.value&&!St.value?(p(),m("span",{key:4,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",la(Gt.value.status)])},[c[112]||(c[112]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Gt.value.detail||Gt.value.status),1)],2)):I("",!0)])]),a("div",r_,[a("div",l_,[a("div",u_,[A(J,{name:"cloud",size:20})]),c[113]||(c[113]=a("div",{class:"min-w-0"},[a("div",{class:"text-sm font-semibold text-ink"},"WebDAV"),a("div",{class:"mt-0.5 text-xs text-ink-muted"}," Connect to a WebDAV server (Nextcloud, ownCloud, IIS, …). Configure the connection your account uses. ")],-1))]),lt.loaded&&!lt.available?(p(),m("div",c_,[A(J,{name:"lock",size:14,class:"mr-1 inline"}),c[114]||(c[114]=z(" WebDAV is currently disabled by your administrator. Contact them to enable it. ",-1))])):I("",!0),lt.canEditOrg?(p(),m("div",d_,[c[115]||(c[115]=a("div",{class:"text-xs text-ink-muted"},"Manage your own settings, or organization-wide settings that apply to every user.",-1)),A(wn,{modelValue:Wn.value,"onUpdate:modelValue":c[42]||(c[42]=k=>Wn.value=k),options:Pt},null,8,["modelValue"])])):I("",!0),ot.value?(p(),nt(xe,{key:2,title:"Enable WebDAV (organization-wide)",desc:"Turn it on or off for everyone in your organization.",keywords:"enable disable plugin webdav organization"},{default:ye(()=>[A(nn,{"model-value":lt.orgEnabled,disabled:!lt.available,"onUpdate:modelValue":ca},null,8,["model-value","disabled"])]),_:1})):(p(),nt(xe,{key:3,title:"Enable WebDAV",desc:"Turn the plugin on for your account in the Web App.",keywords:"enable disable plugin webdav"},{default:ye(()=>[A(nn,{"model-value":lt.enabled,disabled:!lt.available||!lt.orgEnabled,"onUpdate:modelValue":ca},null,8,["model-value","disabled"])]),_:1})),!ot.value&<.available&&!lt.orgEnabled?(p(),m("div",f_,[A(J,{name:"lock",size:13,class:"mr-1 inline"}),c[117]||(c[117]=z("WebDAV is turned off for your organization",-1)),lt.canEditOrg?(p(),m("span",h_,[...c[116]||(c[116]=[z(" — switch to ",-1),a("span",{class:"font-semibold"},"Organization",-1),z(" to turn it back on",-1)])])):I("",!0),c[118]||(c[118]=z(". ",-1))])):I("",!0),ot.value?(p(),m("div",p_,[A(J,{name:"users",size:13,class:"mr-1 inline"}),c[119]||(c[119]=z("These are organization-wide settings — they apply to everyone in ",-1)),a("span",m_,w(t.organizationName||"your organization"),1),c[120]||(c[120]=z(". Leave the connection blank to let each user configure their own; a connection set here overrides the user's. ",-1))])):Io.value?(p(),m("div",g_," As a superadmin you manage the global WebDAV configuration in the API Server panel. The effective configuration is shown below. ")):I("",!0),A(xe,{block:"",title:"Server URL",desc:"WebDAV endpoint including scheme, e.g. https://cloud.example.com/remote.php/dav/files/alice/.",keywords:"url server address endpoint webdav host"},{default:ye(()=>[Cn("baseURL")?(p(),m("span",v_,[z(w(Pn("baseURL").effective||"—")+" ",1),qt("baseURL")?(p(),m("span",__,[A(J,{name:"lock",size:10}),z(w(qt("baseURL")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[43]||(c[43]=k=>Xt.baseURL=k),class:"field w-full font-mono text-xs",placeholder:"https://cloud.example.com/remote.php/dav/files/alice/"},null,512)),[[me,Xt.baseURL]])]),_:1}),A(xe,{title:"Username",desc:"Account used to authenticate (leave blank for a public share).",keywords:"username login account"},{default:ye(()=>[Cn("username")?(p(),m("span",b_,[z(w(Pn("username").effective||"—")+" ",1),qt("username")?(p(),m("span",y_,[A(J,{name:"lock",size:10}),z(w(qt("username")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[44]||(c[44]=k=>Xt.username=k),class:"field w-64",placeholder:"user"},null,512)),[[me,Xt.username]])]),_:1}),A(xe,{title:"Password",desc:"Password or app-specific token for HTTP Basic auth.",keywords:"password secret credentials token"},{default:ye(()=>[Cn("password")?(p(),m("span",x_,[z(w(Pn("password").effective||"—")+" ",1),qt("password")?(p(),m("span",w_,[A(J,{name:"lock",size:10}),z(w(qt("password")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[45]||(c[45]=k=>Xt.password=k),type:"password",class:"field w-64",placeholder:"••••••••"},null,512)),[[me,Xt.password]])]),_:1}),A(xe,{title:"TLS verification",desc:"Only affects HTTPS. Skip only for self-signed test servers.",keywords:"tls certificate verify insecure https"},{default:ye(()=>[Cn("insecureSkipVerify")?(p(),m("span",k_,[z(w(Pn("insecureSkipVerify").effective==="true"?"Skip verification":"Verify certificate")+" ",1),qt("insecureSkipVerify")?(p(),m("span",S_,[A(J,{name:"lock",size:10}),z(w(qt("insecureSkipVerify")),1)])):I("",!0)])):(p(),nt(wn,{key:1,modelValue:Xt.insecureSkipVerify,"onUpdate:modelValue":c[46]||(c[46]=k=>Xt.insecureSkipVerify=k),options:ua},null,8,["modelValue"]))]),_:1}),A(xe,{title:"Base path",desc:"Working directory under the server URL and health-check target, e.g. /Documents.",keywords:"base path directory folder root"},{default:ye(()=>[Cn("basePath")?(p(),m("span",T_,[z(w(Pn("basePath").effective||"—")+" ",1),qt("basePath")?(p(),m("span",P_,[A(J,{name:"lock",size:10}),z(w(qt("basePath")),1)])):I("",!0)])):ie((p(),m("input",{key:1,"onUpdate:modelValue":c[47]||(c[47]=k=>Xt.basePath=k),class:"field w-64 font-mono",placeholder:"/Documents"},null,512)),[[me,Xt.basePath]])]),_:1}),a("div",C_,[Io.value?I("",!0):(p(),m("button",{key:0,class:"btn-accent",disabled:zo.value||!lt.available,onClick:Fo},w(zo.value?"Saving…":ot.value?"Save organization settings":"Save settings"),9,L_)),ot.value?I("",!0):(p(),m("button",{key:1,class:"btn-ghost",disabled:$o.value||!lt.available,onClick:gi},w($o.value?"Testing…":"Test connection"),9,A_)),io.value?(p(),m("span",M_,w(io.value),1)):I("",!0),$n.value&&!ot.value?(p(),m("span",E_,"Checked "+w(Lt()),1)):I("",!0),Tn.value&&!ot.value?(p(),m("span",{key:4,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",Mt(Tn.value.status)])},[c[121]||(c[121]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Tn.value.detail||Tn.value.status),1)],2)):I("",!0)])])],64)):I("",!0),Hi("drives-local")?(p(),m("div",O_,[a("div",z_,[a("div",$_,[A(J,{name:"monitor",size:20})]),c[122]||(c[122]=a("div",{class:"min-w-0"},[a("div",{class:"text-sm font-semibold text-ink"},"Local Storage"),a("div",{class:"mt-0.5 text-xs text-ink-muted"}," A private folder on the server for your files. Each user has their own; members of an organization share one. ")],-1))]),Ae.loaded&&!Ae.available?(p(),m("div",I_,[A(J,{name:"lock",size:14,class:"mr-1 inline"}),c[123]||(c[123]=z(" Local storage is currently disabled by your administrator. Contact them to enable it. ",-1))])):Ae.loaded&&!Ae.rootConfigured?(p(),m("div",N_,[A(J,{name:"alertTriangle",size:14,class:"mr-1 inline"}),c[124]||(c[124]=z(" No storage root has been configured by your administrator yet. ",-1))])):I("",!0),Ae.canEditOrg?(p(),m("div",D_,[c[125]||(c[125]=a("div",{class:"text-xs text-ink-muted"},"Manage your own settings, or organization-wide settings that apply to every user.",-1)),A(wn,{modelValue:Vi.value,"onUpdate:modelValue":c[48]||(c[48]=k=>Vi.value=k),options:Pt},null,8,["modelValue"])])):I("",!0),gn.value?(p(),nt(xe,{key:3,title:"Enable local storage (organization-wide)",desc:"Turn it on or off for everyone in your organization.",keywords:"enable disable plugin local storage folder organization"},{default:ye(()=>[A(nn,{"model-value":Ae.orgEnabled,disabled:!Ae.available,"onUpdate:modelValue":xs},null,8,["model-value","disabled"])]),_:1})):(p(),nt(xe,{key:4,title:"Enable local storage",desc:"Turn the plugin on for your account in the Web App.",keywords:"enable disable plugin local storage folder"},{default:ye(()=>[A(nn,{"model-value":Ae.enabled,disabled:!Ae.available||!Ae.orgEnabled,"onUpdate:modelValue":xs},null,8,["model-value","disabled"])]),_:1})),!gn.value&&Ae.available&&!Ae.orgEnabled?(p(),m("div",F_,[A(J,{name:"lock",size:13,class:"mr-1 inline"}),c[127]||(c[127]=z("Local storage is turned off for your organization",-1)),Ae.canEditOrg?(p(),m("span",R_,[...c[126]||(c[126]=[z(" — switch to ",-1),a("span",{class:"font-semibold"},"Organization",-1),z(" to turn it back on",-1)])])):I("",!0),c[128]||(c[128]=z(". ",-1))])):I("",!0),gn.value?(p(),m("div",B_,[A(J,{name:"users",size:13,class:"mr-1 inline"}),c[129]||(c[129]=z("These are organization-wide settings — they apply to everyone in ",-1)),a("span",U_,w(t.organizationName||"your organization"),1),c[130]||(c[130]=z(", who all share the organization folder. Members can additionally enable a private folder inside it. ",-1))])):_s.value?(p(),m("div",V_," As a superadmin you manage the global storage root in the API Server panel. The effective configuration is shown below. ")):I("",!0),gn.value?(p(),nt(xe,{key:8,title:"Private folders",desc:"Let members create a private folder inside the organization folder, reachable only by them.",keywords:"private folder members allow policy organization"},{default:ye(()=>[A(nn,{"model-value":Ae.allowPrivate,disabled:!Ae.available,"onUpdate:modelValue":ur},null,8,["model-value","disabled"])]),_:1})):I("",!0),gn.value?I("",!0):(p(),m(le,{key:9},[A(xe,{block:"",title:"Your folders",desc:"Assigned automatically and isolated — no one else can reach your private folder.",keywords:"folder directory path storage location isolated private shared"},{default:ye(()=>[a("div",Z_,[(p(!0),m(le,null,Ie(Ae.mounts,k=>(p(),m("div",{key:k.id,class:"flex flex-wrap items-center gap-2"},[a("span",H_,w(k.path),1),k.kind==="shared"?(p(),m("span",j_,[A(J,{name:"users",size:10}),c[131]||(c[131]=z("Shared with your organization",-1))])):(p(),m("span",W_,[A(J,{name:"lock",size:10}),c[132]||(c[132]=z("Private to you",-1))])),ao.value[k.id]?(p(),m("span",{key:2,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-semibold",va(ao.value[k.id].status)])},[c[133]||(c[133]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(ao.value[k.id].status),1)],2)):I("",!0)]))),128)),Ae.mounts.length?I("",!0):(p(),m("div",K_,w(Ae.rootConfigured?"No folder assigned yet.":"Waiting for the administrator to configure a storage root."),1))])]),_:1}),Ae.isOrgUser&&Ae.allowPrivate?(p(),nt(xe,{key:0,title:"My private folder",desc:"Add a private folder inside the organization folder, reachable only by you — you keep the shared folder too.",keywords:"private folder personal isolated organization inside"},{default:ye(()=>[A(nn,{"model-value":Ae.privateFolder,disabled:!Ae.available||!Ae.orgEnabled,"onUpdate:modelValue":ga},null,8,["model-value","disabled"])]),_:1})):Ae.isOrgUser&&!Ae.allowPrivate?(p(),m("div",G_,[A(J,{name:"lock",size:13,class:"mr-1 inline"}),c[134]||(c[134]=z("Private folders are turned off by your organization. ",-1))])):I("",!0)],64)),A(xe,{title:"Access mode",desc:"Read-only prevents uploads, deletes and folder creation.",keywords:"read only write access mode permission"},{default:ye(()=>[ha("readOnly")?(p(),m("span",q_,[z(w(rr(Zi("readOnly").effective))+" ",1),An("readOnly")?(p(),m("span",Y_,[A(J,{name:"lock",size:10}),z(w(An("readOnly")),1)])):I("",!0)])):(p(),nt(wn,{key:1,modelValue:so.value,"onUpdate:modelValue":c[49]||(c[49]=k=>so.value=k),options:Zo},null,8,["modelValue"]))]),_:1}),a("div",J_,[_s.value?I("",!0):(p(),m("button",{key:0,class:"btn-accent",disabled:Vo.value||!Ae.available,onClick:cr},w(Vo.value?"Saving…":gn.value?"Save organization settings":"Save settings"),9,X_)),gn.value?I("",!0):(p(),m("button",{key:1,class:"btn-ghost",disabled:en.value||!Ae.available,onClick:ws},w(en.value?"Testing…":"Test folder"),9,Q_)),qe.value?(p(),m("span",e1,w(qe.value),1)):I("",!0),yi.value&&!gn.value?(p(),m("span",t1,"Checked "+w(pa()),1)):I("",!0),ln.value&&!gn.value?(p(),m("span",{key:4,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",va(ln.value.status)])},[c[135]||(c[135]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(ln.value.detail||ln.value.status),1)],2)):I("",!0)])])):I("",!0)])):q.id==="profile"?(p(),m("div",n1,[A(xe,{block:"",title:"Profile photo",desc:"PNG or JPG, up to ~1.5 MB. Stored on this device.",keywords:"avatar photo picture"},{default:ye(()=>[a("div",i1,[Ee(be).avatar?(p(),m("img",{key:0,src:Ee(be).avatar,alt:"Avatar",class:"h-16 w-16 rounded-full object-cover"},null,8,o1)):(p(),m("div",s1,w(ba.value),1)),a("div",a1,[a("label",r1,[A(J,{name:"upload",size:15,class:"mr-1.5 inline"}),c[136]||(c[136]=z("Upload ",-1)),a("input",{type:"file",accept:"image/*",class:"hidden",onChange:fr},null,32)]),Ee(be).avatar?(p(),m("button",{key:0,class:"btn-ghost",onClick:hr},"Remove")):I("",!0)])])]),_:1}),A(xe,{title:"Display name",desc:"The name shown on your public profile.",keywords:"display name profile"},{default:ye(()=>[ie(a("input",{"onUpdate:modelValue":c[50]||(c[50]=k=>Ee(be).displayName=k),class:"field w-56",placeholder:"Jane O.",onBlur:c[51]||(c[51]=k=>We("Saved."))},null,544),[[me,Ee(be).displayName]])]),_:1}),A(xe,{block:"",title:"Bio",desc:"A short description others can see.",keywords:"bio about description"},{default:ye(()=>[ie(a("textarea",{"onUpdate:modelValue":c[52]||(c[52]=k=>Ee(be).bio=k),rows:"3",maxlength:"240",class:"field w-full resize-none",placeholder:"Flight director, North yard operations…",onBlur:c[53]||(c[53]=k=>We("Saved."))},null,544),[[me,Ee(be).bio]]),a("div",l1,w((Ee(be).bio||"").length)+"/240",1)]),_:1}),A(xe,{title:"Show email on profile",desc:"Let teammates see your email address.",keywords:"show email public visibility"},{default:ye(()=>[A(nn,{modelValue:Ee(be).showEmail,"onUpdate:modelValue":c[54]||(c[54]=k=>Ee(be).showEmail=k)},null,8,["modelValue"])]),_:1})])):q.id==="security"?(p(),m("div",u1,[A(xe,{block:"",title:"Two-factor authentication",desc:"Require a one-time code at sign-in.",keywords:"two factor 2fa authentication security"},{default:ye(()=>[a("div",c1,[a("span",{class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",Ee(be).twoFactor?"bg-success-soft text-success-fg":"bg-surface-2 text-ink-secondary"])},[c[137]||(c[137]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Ee(be).twoFactor?"Enabled":"Disabled"),1)],2),!Ee(be).twoFactor&&!lo.value?(p(),m("button",{key:0,class:"btn-accent",onClick:ji},"Enable 2FA")):Ee(be).twoFactor?(p(),m("button",{key:1,class:"btn-ghost",onClick:co},"Disable")):I("",!0)]),lo.value?(p(),m("div",d1,[a("div",f1,[c[139]||(c[139]=a("div",{class:"grid h-28 w-28 place-items-center rounded bg-white p-2"},[a("svg",{viewBox:"0 0 100 100",class:"h-full w-full"},[a("rect",{width:"100",height:"100",fill:"#fff"}),a("g",{fill:"#0F1E3D"},[a("rect",{x:"6",y:"6",width:"24",height:"24"}),a("rect",{x:"70",y:"6",width:"24",height:"24"}),a("rect",{x:"6",y:"70",width:"24",height:"24"}),a("rect",{x:"12",y:"12",width:"12",height:"12",fill:"#fff"}),a("rect",{x:"76",y:"12",width:"12",height:"12",fill:"#fff"}),a("rect",{x:"12",y:"76",width:"12",height:"12",fill:"#fff"}),a("rect",{x:"40",y:"10",width:"8",height:"8"}),a("rect",{x:"52",y:"20",width:"8",height:"8"}),a("rect",{x:"40",y:"40",width:"8",height:"8"}),a("rect",{x:"60",y:"44",width:"8",height:"8"}),a("rect",{x:"44",y:"60",width:"8",height:"8"}),a("rect",{x:"70",y:"60",width:"8",height:"8"}),a("rect",{x:"80",y:"72",width:"8",height:"8"}),a("rect",{x:"60",y:"80",width:"8",height:"8"})])])],-1)),a("div",h1,[c[138]||(c[138]=a("div",{class:"text-xs text-ink-secondary"},"Scan with an authenticator app, or enter this secret:",-1)),a("div",p1,w(_n.value),1),a("div",m1,[ie(a("input",{"onUpdate:modelValue":c[55]||(c[55]=k=>qn.value=k),inputmode:"numeric",maxlength:"6",class:"field w-28 font-mono tracking-[0.3em]",placeholder:"000000"},null,512),[[me,qn.value]]),a("button",{class:"btn-accent",onClick:pr},"Verify & enable")]),uo.value?(p(),m("p",g1,w(uo.value),1)):I("",!0)])])])):I("",!0),Ee(be).twoFactor&&bn.value.length?(p(),m("div",v1,[c[140]||(c[140]=a("div",{class:"text-xs font-semibold text-ink"},"Recovery codes",-1)),c[141]||(c[141]=a("div",{class:"mt-0.5 text-xs text-ink-muted"},"Store these somewhere safe — each works once.",-1)),a("div",_1,[(p(!0),m(le,null,Ie(bn.value,k=>(p(),m("span",{key:k,class:"select-all"},w(k),1))),128))])])):I("",!0),c[142]||(c[142]=a("p",{class:"mt-2 text-xs text-ink-muted"},"Prototype — codes are generated locally until the account service verifies them.",-1))]),_:1}),A(xe,{block:"",title:"Active sessions",desc:"Devices currently signed in to your account.",keywords:"sessions devices logout sign out remote"},{default:ye(()=>[a("div",b1,[a("div",y1,[a("div",x1,[A(J,{name:"monitor",size:18})]),a("div",w1,[a("div",k1,[z(w(Wo())+" on "+w(mr())+" ",1),c[143]||(c[143]=a("span",{class:"ml-1 rounded-full bg-success-soft px-2 py-0.5 text-[10px] font-semibold text-success-fg"},"This device",-1))]),a("div",S1,"Signed in "+w(Ee(Su)(Ee(ti))),1)]),a("button",{class:"btn-ghost",onClick:c[56]||(c[56]=k=>l("logout"))},"Log out")])]),c[144]||(c[144]=a("button",{class:"btn-ghost mt-2 opacity-60",disabled:"",title:"Requires the account service"}," Log out all other devices ",-1)),c[145]||(c[145]=a("p",{class:"mt-2 text-xs text-ink-muted"}," Only this session is visible from the browser; enumerating and revoking remote sessions needs the account service. ",-1))]),_:1})])):q.id==="team"?(p(),m("div",T1,[Qe.id?(p(),m("div",P1,[A(xe,{block:"",title:`Edit user — ${Qe.email}`,desc:"Update details, change role, reset password, or set verified.",keywords:"edit user update role password verified organization"},{default:ye(()=>[a("div",C1,[a("div",L1,[ie(a("input",{"onUpdate:modelValue":c[57]||(c[57]=k=>Qe.email=k),type:"email",class:"field flex-1",placeholder:"name@pilotvault.local"},null,512),[[me,Qe.email]]),ie(a("select",{"onUpdate:modelValue":c[58]||(c[58]=k=>Qe.role=k),class:"field w-32",disabled:qo.value,title:qo.value?"You cannot change your own role":""},[(p(!0),m(le,null,Ie(ya.value,k=>(p(),m("option",{key:k.value,value:k.value},w(k.label),9,M1))),128))],8,A1),[[Ot,Qe.role]])]),u.value?ie((p(),m("select",{key:0,"onUpdate:modelValue":c[59]||(c[59]=k=>Qe.organization=k),class:"field",title:"Organization"},[(p(!0),m(le,null,Ie(Cs.value,k=>(p(),m("option",{key:k.value,value:k.value},w(k.label),9,E1))),128))],512)),[[Ot,Qe.organization]]):I("",!0),ie(a("input",{"onUpdate:modelValue":c[60]||(c[60]=k=>Qe.password=k),type:"password",class:"field",placeholder:"New password (leave blank to keep current)"},null,512),[[me,Qe.password]]),a("label",O1,[A(nn,{modelValue:Qe.verified,"onUpdate:modelValue":c[61]||(c[61]=k=>Qe.verified=k)},null,8,["modelValue"]),c[146]||(c[146]=z(" Email verified ",-1))]),a("div",z1,[a("button",{class:"btn-accent",disabled:Ki.value,onClick:vr},w(Ki.value?"Saving…":"Save changes"),9,$1),a("button",{class:"btn-ghost",onClick:ho},"Cancel"),En.value?(p(),m("span",I1,w(En.value),1)):I("",!0),qo.value?(p(),m("span",N1,"Editing your own account — role locked.")):I("",!0)])])]),_:1},8,["title"])])):(p(),m("div",D1,[A(xe,{block:"",title:"Add user",desc:"Create a new account. Admins add users within their organization; superadmins can target any.",keywords:"add user create account role admin organization"},{default:ye(()=>[a("div",F1,[a("div",R1,[ie(a("input",{"onUpdate:modelValue":c[62]||(c[62]=k=>Rt.email=k),type:"email",class:"field flex-1",placeholder:"name@pilotvault.local"},null,512),[[me,Rt.email]]),ie(a("select",{"onUpdate:modelValue":c[63]||(c[63]=k=>Rt.role=k),class:"field w-32"},[(p(!0),m(le,null,Ie(ya.value,k=>(p(),m("option",{key:k.value,value:k.value},w(k.label),9,B1))),128))],512),[[Ot,Rt.role]])]),u.value?ie((p(),m("select",{key:0,"onUpdate:modelValue":c[64]||(c[64]=k=>Rt.organization=k),class:"field",title:"Organization"},[(p(!0),m(le,null,Ie(Cs.value,k=>(p(),m("option",{key:k.value,value:k.value},w(k.label),9,U1))),128))],512)),[[Ot,Rt.organization]]):(p(),m("div",V1,[c[147]||(c[147]=z(" New users join your organization: ",-1)),a("span",Z1,w(t.organizationName||"—"),1)])),ie(a("input",{"onUpdate:modelValue":c[65]||(c[65]=k=>Rt.password=k),type:"password",class:"field",placeholder:"Temporary password (min 8 chars)"},null,512),[[me,Rt.password]]),a("div",H1,[a("button",{class:"btn-accent",disabled:Ko.value,onClick:Ls},w(Ko.value?"Creating…":"Create user"),9,j1),tn.value?(p(),m("span",W1,w(tn.value),1)):I("",!0)])])]),_:1})])),a("div",K1,[a("div",G1,[c[148]||(c[148]=a("div",null,[a("div",{class:"eyebrow"},"Team"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"All users")],-1)),a("button",{class:"btn-ghost",disabled:fo.value,onClick:ii},w(fo.value?"Loading…":"Refresh"),9,q1)]),Wi.value?(p(),m("div",Y1,w(Wi.value),1)):!wi.value.length&&!fo.value?(p(),m("div",J1,"No users yet.")):(p(),m("div",X1,[a("table",Q1,[a("thead",null,[a("tr",eb,[(p(),m(le,null,Ie(["User","Role","Organization","Status",""],k=>a("th",{key:k,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},w(k),1)),64))])]),a("tbody",null,[(p(!0),m(le,null,Ie(wi.value,k=>(p(),m("tr",{key:k.id,class:Ce(["border-b border-line last:border-0",Qe.id===k.id?"bg-accent-soft":""])},[a("td",tb,[a("span",nb,w(k.email),1),k.email===t.email?(p(),m("span",ib,"(you)")):I("",!0)]),a("td",ob,[a("span",{class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",y(k.role||"user")])},[A(J,{name:_(k.role||"user"),size:12},null,8,["name"]),z(w(h(k.role||"user")),1)],2)]),a("td",sb,[a("span",{class:Ce(["text-sm",k.organizationName?"text-ink-secondary":"text-ink-muted"])},w(k.organizationName||"—"),3)]),a("td",ab,[a("span",{class:Ce(["text-xs",k.verified?"text-success-fg":"text-ink-muted"])},w(k.verified?"Verified":"Unverified"),3)]),a("td",rb,[Dn.value===k.id?(p(),m(le,{key:0},[c[149]||(c[149]=a("span",{class:"mr-2 text-xs text-ink-muted"},"Remove?",-1)),a("button",{class:"btn-ghost mr-1",onClick:c[66]||(c[66]=Be=>Dn.value="")},"Cancel"),a("button",{class:"rounded bg-danger px-3 py-1.5 text-sm font-semibold text-white transition hover:brightness-110",onClick:Be=>Go(k)}," Remove ",8,lb)],64)):(p(),m("div",ub,[a("button",{class:"btn-ghost inline-flex items-center gap-1.5",onClick:Be=>gr(k)},[A(J,{name:"settings",size:14}),c[150]||(c[150]=z(" Edit ",-1))],8,cb),k.email!==t.email?(p(),m("button",{key:0,class:"btn-ghost inline-flex items-center gap-1.5",onClick:Be=>Dn.value=k.id},[A(J,{name:"trash",size:14}),c[151]||(c[151]=z(" Remove ",-1))],8,db)):I("",!0)]))])],2))),128))])])]))])])):q.id==="organizations"?(p(),m("div",fb,[Nt.id?(p(),m("div",hb,[A(xe,{block:"",title:"Rename organization",desc:"Update the organization's display name.",keywords:"rename organization edit"},{default:ye(()=>[a("div",pb,[ie(a("input",{"onUpdate:modelValue":c[67]||(c[67]=k=>Nt.name=k),class:"field",placeholder:"Organization name",onKeyup:pu(xa,["enter"])},null,544),[[me,Nt.name]]),a("div",mb,[a("button",{class:"btn-accent",onClick:xa},"Save changes"),a("button",{class:"btn-ghost",onClick:Ms},"Cancel"),Fn.value?(p(),m("span",gb,w(Fn.value),1)):I("",!0)])])]),_:1})])):(p(),m("div",vb,[A(xe,{block:"",title:"Add organization",desc:"Create a new organization. Assign admins and users to it from User management.",keywords:"add organization create tenant company"},{default:ye(()=>[a("div",_b,[ie(a("input",{"onUpdate:modelValue":c[68]||(c[68]=k=>po.name=k),class:"field",placeholder:"e.g. Northwind Aerial",onKeyup:pu(_o,["enter"])},null,544),[[me,po.name]]),a("div",bb,[a("button",{class:"btn-accent",disabled:go.value,onClick:_o},w(go.value?"Creating…":"Create organization"),9,yb),mo.value?(p(),m("span",xb,w(mo.value),1)):I("",!0)])])]),_:1})])),a("div",wb,[a("div",{class:"flex items-center justify-between px-5 py-4"},[c[152]||(c[152]=a("div",null,[a("div",{class:"eyebrow"},"Tenancy"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"All organizations")],-1)),a("button",{class:"btn-ghost",onClick:ni},"Refresh")]),yn.value.length?(p(),m("div",Sb,[a("table",Tb,[a("thead",null,[a("tr",Pb,[(p(),m(le,null,Ie(["Organization","Members",""],k=>a("th",{key:k,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},w(k),1)),64))])]),a("tbody",null,[(p(!0),m(le,null,Ie(yn.value,k=>(p(),m("tr",{key:k.id,class:Ce(["border-b border-line last:border-0",Nt.id===k.id?"bg-accent-soft":""])},[a("td",Cb,[a("span",Lb,[A(J,{name:"grid",size:14,class:"text-ink-muted"}),z(w(k.name),1)])]),a("td",Ab,w(As.value[k.id]||0),1),a("td",Mb,[vo.value===k.id?(p(),m(le,{key:0},[c[153]||(c[153]=a("span",{class:"mr-2 text-xs text-ink-muted"},"Delete?",-1)),a("button",{class:"btn-ghost mr-1",onClick:c[69]||(c[69]=Be=>vo.value="")},"Cancel"),a("button",{class:"rounded bg-danger px-3 py-1.5 text-sm font-semibold text-white transition hover:brightness-110",onClick:Be=>bo(k)}," Delete ",8,Eb)],64)):(p(),m("div",Ob,[a("button",{class:"btn-ghost inline-flex items-center gap-1.5",onClick:Be=>_r(k)},[A(J,{name:"settings",size:14}),c[154]||(c[154]=z(" Rename ",-1))],8,zb),a("button",{class:"btn-ghost inline-flex items-center gap-1.5",disabled:(As.value[k.id]||0)>0,title:(As.value[k.id]||0)>0?"Reassign or remove members first":"",onClick:Be=>vo.value=k.id},[A(J,{name:"trash",size:14}),c[155]||(c[155]=z(" Delete ",-1))],8,$b)]))])],2))),128))])])])):(p(),m("div",kb,"No organizations yet."))])])):q.id==="advanced"?(p(),m("div",Ib,[a("div",Nb,[A(xe,{title:"Export data",desc:"Download your settings and profile as JSON.",keywords:"export data download backup"},{default:ye(()=>[a("button",{class:"btn-ghost",onClick:br},[A(J,{name:"download",size:15,class:"mr-1.5 inline"}),c[156]||(c[156]=z("Export",-1))])]),_:1}),A(xe,{block:"",title:"Import data",desc:"Restore settings from a previous export.",keywords:"import data upload restore"},{default:ye(()=>[a("label",Db,[A(J,{name:"upload",size:15,class:"mr-1.5 inline"}),c[157]||(c[157]=z("Choose file… ",-1)),a("input",{type:"file",accept:"application/json,.json",class:"hidden",onChange:wa},null,32)]),Yn.value?(p(),m("p",Fb,w(Yn.value),1)):I("",!0)]),_:1})]),a("div",Rb,[a("div",Bb,[A(J,{name:"alertTriangle",size:18}),c[158]||(c[158]=a("h3",{class:"text-sm font-bold uppercase tracking-caps"},"Danger zone",-1))]),c[163]||(c[163]=a("p",{class:"mt-1 text-xs text-ink-secondary"},"Deleting your account is permanent and cannot be undone.",-1)),a("div",Ub,[c[162]||(c[162]=a("div",{class:"text-sm font-semibold text-ink"},"Delete account",-1)),a("label",Vb,[ie(a("input",{"onUpdate:modelValue":c[70]||(c[70]=k=>mt.understand=k),type:"checkbox",class:"mt-0.5 h-4 w-4 accent-[var(--danger)]"},null,512),[[Va,mt.understand]]),c[159]||(c[159]=z(" I understand this permanently deletes my account and all associated data. ",-1))]),a("div",Zb,[a("label",Hb,[c[160]||(c[160]=z("Type ",-1)),a("span",jb,w(On.value),1),c[161]||(c[161]=z(" to confirm",-1))]),ie(a("input",{"onUpdate:modelValue":c[71]||(c[71]=k=>mt.typed=k),class:"field w-full max-w-[360px] font-mono",placeholder:On.value},null,8,Wb),[[me,mt.typed]])]),a("div",Kb,[mt.armed?(p(),m("button",{key:1,class:"rounded bg-danger px-4 py-2.5 text-sm font-semibold text-white transition enabled:hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-50",disabled:mt.cooldown>0,onClick:xo},w(mt.cooldown>0?`Confirm in ${mt.cooldown}s…`:"Permanently delete account"),9,qb)):(p(),m("button",{key:0,class:"rounded bg-danger px-4 py-2.5 text-sm font-semibold text-white transition enabled:hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-40",disabled:!Yo.value,onClick:ka}," Delete account… ",8,Gb)),mt.armed&&mt.cooldown>0?(p(),m("span",Yb,"Cooling-off period — read once more.")):I("",!0)]),mt.msg?(p(),m("p",Jb,w(mt.msg),1)):I("",!0)])])])):I("",!0)],64))),128))])]),A(vh,{name:"fade"},{default:ye(()=>[Nn.value?(p(),m("div",Xb,[A(J,{name:"check",size:16,class:"text-success-fg"}),z(w(Nn.value),1)])):I("",!0)]),_:1})]))}},ey=Pm(Qb,[["__scopeId","data-v-7522b856"]]),ty={class:"mx-auto flex max-w-[1240px] flex-col gap-5 p-7"},ny={class:"flex flex-wrap items-center gap-3"},iy={class:"ml-auto flex items-center gap-2"},oy=["href"],sy={class:"grid grid-cols-3 gap-4 max-[900px]:grid-cols-1"},ay={class:"eyebrow"},ry={key:0,class:"panel border-danger/40 p-4 text-sm text-danger-fg"},ly={key:1,class:"panel p-5"},uy={class:"mb-4 flex items-center justify-between"},cy={class:"eyebrow"},dy={class:"grid grid-cols-3 gap-3 max-[760px]:grid-cols-1"},fy={class:"block"},hy={class:"block"},py={class:"block"},my={class:"block"},gy={key:0,value:""},vy=["value"],_y={class:"block"},by={class:"block"},yy={class:"block"},xy={class:"block"},wy={class:"block"},ky=["value"],Sy={class:"block"},Ty=["value"],Py={class:"block"},Cy=["value"],Ly={class:"block"},Ay={class:"mt-3 block"},My={key:0,class:"mt-3 grid grid-cols-2 gap-3 max-[760px]:grid-cols-1"},Ey={class:"block"},Oy={class:"block"},zy={class:"block"},$y={class:"block"},Iy={class:"col-span-2 block max-[760px]:col-span-1"},Ny={class:"mt-4 flex items-center gap-3"},Dy=["disabled"],Fy={key:0,class:"text-sm text-danger-fg"},Ry={class:"panel overflow-hidden p-0"},By={key:0,class:"px-5 py-12 text-center text-sm text-ink-muted"},Uy={key:1,class:"grid place-items-center px-5 py-16 text-center"},Vy={key:2,class:"overflow-x-auto"},Zy={class:"w-full border-collapse text-sm"},Hy={class:"text-left"},jy={class:"whitespace-nowrap px-5 py-3 font-mono text-ink"},Wy={key:0,class:"text-ink-muted"},Ky={class:"px-5 py-3 text-ink-secondary"},Gy=["title"],qy={class:"px-5 py-3 font-mono text-ink-secondary"},Yy={class:"px-5 py-3 text-ink-secondary"},Jy={class:"px-5 py-3"},Xy=["onClick"],Qy={class:"whitespace-nowrap px-5 py-3 text-right"},ex=["onClick"],tx=["onClick"],nx=["onClick"],ix={key:0,class:"border-b border-line bg-surface-2"},ox={colspan:"7",class:"px-5 py-3"},sx={class:"flex flex-wrap gap-x-8 gap-y-1.5 text-xs"},ax={class:"text-ink-secondary"},rx={class:"text-ink"},lx={class:"text-ink-secondary"},ux={class:"text-ink"},cx={class:"text-ink-secondary"},dx={class:"font-mono text-ink"},fx={key:0,class:"text-ink-secondary"},hx={class:"text-ink"},px={key:0,class:"mt-2 space-y-1"},mx={key:1,class:"mt-2 text-xs text-success-fg"},gx={__name:"Logbook",props:{email:{type:String,default:""},role:{type:String,default:"user"},organization:{type:String,default:""},organizationName:{type:String,default:""}},setup(t){const i=t,s={success:"bg-success-soft text-success-fg",danger:"bg-danger-soft text-danger-fg",neutral:"bg-surface-2 text-ink-secondary"},l=Y([]),u=Y([]),f=Y(!1),h=Y("");async function _(){f.value=!0,h.value="";const[O,N]=await Promise.all([pl(),Ap()]);(!O.ok||!N.ok)&&(h.value=O.status===503||N.status===503?"Logbook storage is not configured on the API Server (service account missing).":"Could not load the logbook."),l.value=O.drones,u.value=N.flights,f.value=!1}fi(_);function y(O){const N=O.compliance||{};return N.exempt?{tone:"neutral",label:"Exempt"}:(N.redFlags||[]).length?{tone:"danger",label:`${N.redFlags.length} issue${N.redFlags.length>1?"s":""}`}:{tone:"success",label:"Compliant"}}const C=Y("");function T(O){C.value=C.value===O?"":O}const M=[{value:"open",label:"Open"},{value:"specific",label:"Specific"},{value:"certified",label:"Certified"}],H=[{value:"commercial",label:"Commercial"},{value:"research",label:"Research"},{value:"public",label:"Public-benefit"},{value:"hobby",label:"Private hobby"},{value:"club_area",label:"Model-club area"}],j=[{value:"",label:"Auto (from drone)"},{value:"manual",label:"Manual"},{value:"automatic",label:"Automatic (FDR)"}];function K(){var O;return{operationDate:new Date().toISOString().slice(0,10),startTime:"",endTime:"",drone:((O=l.value[0])==null?void 0:O.id)||"",areaRoute:"",maxAltitudeAgl:"",pilotName:i.email,certificateRef:"",category:"open",purpose:"commercial",loggingPath:"",rawFdrLogUrl:"",authorisationRef:"",weather:"",airspaceRef:"",observer:"",incidents:"",notes:""}}const F=Y(!1),te=Y(""),X=gt(K()),fe=Y(""),Se=Y(!1),de=Y(!1);function Fe(){Object.assign(X,K()),te.value="",fe.value="",de.value=!1,F.value=!0}function Oe(O){Object.assign(X,{operationDate:(O.operationDate||"").slice(0,10),startTime:O.startTime||"",endTime:O.endTime||"",drone:O.drone||"",areaRoute:O.areaRoute||"",maxAltitudeAgl:O.maxAltitudeAgl||"",pilotName:O.pilotName||"",certificateRef:O.certificateRef||"",category:O.category||"open",purpose:O.purpose||"commercial",loggingPath:O.loggingPath||"",rawFdrLogUrl:O.rawFdrLogUrl||"",authorisationRef:O.authorisationRef||"",weather:O.weather||"",airspaceRef:O.airspaceRef||"",observer:O.observer||"",incidents:O.incidents||"",notes:O.notes||""}),te.value=O.id,fe.value="",de.value=!!(O.weather||O.airspaceRef||O.observer||O.incidents||O.notes),F.value=!0}function Te(){F.value=!1,te.value=""}async function Ze(){var $;if(fe.value="",!X.drone){fe.value="Select a drone first (add one in the Drones section).";return}Se.value=!0;const O={...X,maxAltitudeAgl:Number(X.maxAltitudeAgl)||0},N=te.value?await Ep(te.value,O):await Mp(O);if(Se.value=!1,!N.ok){fe.value=(($=N.body)==null?void 0:$.error)||"Could not save the flight.";return}F.value=!1,await _()}const he=Y("");async function Q(O){const N=await Op(O.id);he.value="",N.ok&&await _()}const B=ce(()=>{const O=u.value.length,N=u.value.filter(Ye=>{var we;return(((we=Ye.compliance)==null?void 0:we.redFlags)||[]).length}).length,$=u.value.filter(Ye=>{var we;return(we=Ye.compliance)==null?void 0:we.required}).length;return{total:O,flagged:N,required:$}});return(O,N)=>(p(),m("div",ty,[a("div",ny,[N[22]||(N[22]=a("div",null,[a("div",{class:"eyebrow"},"Logbook"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Flights (BEK 1649 §5)")],-1)),a("div",iy,[a("a",{href:Ee(zp)(),class:"btn-ghost inline-flex items-center gap-2",title:"Download a compliance CSV (Trafikstyrelsen / police disclosure)"},[A(J,{name:"download",size:15}),N[20]||(N[20]=z(" Export CSV ",-1))],8,oy),a("button",{class:"btn-accent inline-flex items-center gap-2",onClick:Fe},[A(J,{name:"plus",size:15}),N[21]||(N[21]=z(" Log flight ",-1))])])]),a("div",sy,[(p(!0),m(le,null,Ie([{label:"Flights logged",value:B.value.total,tone:"neutral"},{label:"Require logbook",value:B.value.required,tone:"neutral"},{label:"Compliance flags",value:B.value.flagged,tone:B.value.flagged?"danger":"success"}],$=>(p(),m("div",{key:$.label,class:"panel p-5"},[a("div",ay,w($.label),1),a("div",{class:Ce(["mt-2 text-[30px] font-bold leading-none tracking-tightest",$.tone==="danger"?"text-danger-fg":$.tone==="success"?"text-success-fg":"text-ink"])},w($.value),3)]))),128))]),h.value?(p(),m("div",ry,w(h.value),1)):I("",!0),F.value?(p(),m("div",ly,[a("div",uy,[a("div",null,[a("div",cy,w(te.value?"Edit entry":"New entry"),1),N[23]||(N[23]=a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Logbook flight (BEK 1649 §5)",-1))]),a("button",{class:"btn-icon",onClick:Te},[A(J,{name:"x",size:16})])]),a("div",dy,[a("label",fy,[N[24]||(N[24]=a("span",{class:"eyebrow mb-1 block"},"Date",-1)),ie(a("input",{"onUpdate:modelValue":N[0]||(N[0]=$=>X.operationDate=$),type:"date",class:"field"},null,512),[[me,X.operationDate]])]),a("label",hy,[N[25]||(N[25]=a("span",{class:"eyebrow mb-1 block"},"Start",-1)),ie(a("input",{"onUpdate:modelValue":N[1]||(N[1]=$=>X.startTime=$),type:"time",class:"field"},null,512),[[me,X.startTime]])]),a("label",py,[N[26]||(N[26]=a("span",{class:"eyebrow mb-1 block"},"End",-1)),ie(a("input",{"onUpdate:modelValue":N[2]||(N[2]=$=>X.endTime=$),type:"time",class:"field"},null,512),[[me,X.endTime]])]),a("label",my,[N[27]||(N[27]=a("span",{class:"eyebrow mb-1 block"},"Drone",-1)),ie(a("select",{"onUpdate:modelValue":N[3]||(N[3]=$=>X.drone=$),class:"field"},[l.value.length?I("",!0):(p(),m("option",gy,"— add a drone first —")),(p(!0),m(le,null,Ie(l.value,$=>(p(),m("option",{key:$.id,value:$.id},w($.displayName),9,vy))),128))],512),[[Ot,X.drone]])]),a("label",_y,[N[28]||(N[28]=a("span",{class:"eyebrow mb-1 block"},"Max altitude (m AGL)",-1)),ie(a("input",{"onUpdate:modelValue":N[4]||(N[4]=$=>X.maxAltitudeAgl=$),type:"number",min:"0",class:"field",placeholder:"120"},null,512),[[me,X.maxAltitudeAgl]])]),a("label",by,[N[29]||(N[29]=a("span",{class:"eyebrow mb-1 block"},"Area / route",-1)),ie(a("input",{"onUpdate:modelValue":N[5]||(N[5]=$=>X.areaRoute=$),class:"field",placeholder:"Field N of Roskilde, grid survey"},null,512),[[me,X.areaRoute]])]),a("label",yy,[N[30]||(N[30]=a("span",{class:"eyebrow mb-1 block"},"Remote pilot name",-1)),ie(a("input",{"onUpdate:modelValue":N[6]||(N[6]=$=>X.pilotName=$),class:"field",placeholder:"Full name"},null,512),[[me,X.pilotName]])]),a("label",xy,[N[31]||(N[31]=a("span",{class:"eyebrow mb-1 block"},"Certificate ref",-1)),ie(a("input",{"onUpdate:modelValue":N[7]||(N[7]=$=>X.certificateRef=$),class:"field",placeholder:"A2 / STS cert no."},null,512),[[me,X.certificateRef]])]),a("label",wy,[N[32]||(N[32]=a("span",{class:"eyebrow mb-1 block"},"Logging path",-1)),ie(a("select",{"onUpdate:modelValue":N[8]||(N[8]=$=>X.loggingPath=$),class:"field"},[(p(),m(le,null,Ie(j,$=>a("option",{key:$.value,value:$.value},w($.label),9,ky)),64))],512),[[Ot,X.loggingPath]])]),a("label",Sy,[N[33]||(N[33]=a("span",{class:"eyebrow mb-1 block"},"Category",-1)),ie(a("select",{"onUpdate:modelValue":N[9]||(N[9]=$=>X.category=$),class:"field"},[(p(),m(le,null,Ie(M,$=>a("option",{key:$.value,value:$.value},w($.label),9,Ty)),64))],512),[[Ot,X.category]])]),a("label",Py,[N[34]||(N[34]=a("span",{class:"eyebrow mb-1 block"},"Purpose",-1)),ie(a("select",{"onUpdate:modelValue":N[10]||(N[10]=$=>X.purpose=$),class:"field"},[(p(),m(le,null,Ie(H,$=>a("option",{key:$.value,value:$.value},w($.label),9,Cy)),64))],512),[[Ot,X.purpose]])]),a("label",Ly,[N[35]||(N[35]=a("span",{class:"eyebrow mb-1 block"},"Authorisation ref",-1)),ie(a("input",{"onUpdate:modelValue":N[11]||(N[11]=$=>X.authorisationRef=$),class:"field",placeholder:"Specific-category ref"},null,512),[[me,X.authorisationRef]])])]),a("label",Ay,[N[36]||(N[36]=a("span",{class:"eyebrow mb-1 block"},"FDR log URL (automatic path)",-1)),ie(a("input",{"onUpdate:modelValue":N[12]||(N[12]=$=>X.rawFdrLogUrl=$),class:"field",placeholder:"Link to the stored flight-data-recorder export"},null,512),[[me,X.rawFdrLogUrl]])]),a("button",{class:"mt-4 flex items-center gap-1.5 text-sm font-semibold text-accent",onClick:N[13]||(N[13]=$=>de.value=!de.value)},[A(J,{name:de.value?"x":"plus",size:14},null,8,["name"]),N[37]||(N[37]=z(" Operational details (weather, airspace, incidents) ",-1))]),de.value?(p(),m("div",My,[a("label",Ey,[N[38]||(N[38]=a("span",{class:"eyebrow mb-1 block"},"Weather / wind",-1)),ie(a("input",{"onUpdate:modelValue":N[14]||(N[14]=$=>X.weather=$),class:"field",placeholder:"6 m/s NW, CAVOK"},null,512),[[me,X.weather]])]),a("label",Oy,[N[39]||(N[39]=a("span",{class:"eyebrow mb-1 block"},"Airspace / NOTAM ref",-1)),ie(a("input",{"onUpdate:modelValue":N[15]||(N[15]=$=>X.airspaceRef=$),class:"field"},null,512),[[me,X.airspaceRef]])]),a("label",zy,[N[40]||(N[40]=a("span",{class:"eyebrow mb-1 block"},"Observer",-1)),ie(a("input",{"onUpdate:modelValue":N[16]||(N[16]=$=>X.observer=$),class:"field"},null,512),[[me,X.observer]])]),a("label",$y,[N[41]||(N[41]=a("span",{class:"eyebrow mb-1 block"},"Incidents / anomalies",-1)),ie(a("input",{"onUpdate:modelValue":N[17]||(N[17]=$=>X.incidents=$),class:"field",placeholder:"RTH trigger, GPS dropout…"},null,512),[[me,X.incidents]])]),a("label",Iy,[N[42]||(N[42]=a("span",{class:"eyebrow mb-1 block"},"Notes",-1)),ie(a("textarea",{"onUpdate:modelValue":N[18]||(N[18]=$=>X.notes=$),rows:"2",class:"field"},null,512),[[me,X.notes]])])])):I("",!0),a("div",Ny,[a("button",{class:"btn-accent",disabled:Se.value,onClick:Ze},w(Se.value?"Saving…":te.value?"Save changes":"Log flight"),9,Dy),a("button",{class:"btn-ghost",onClick:Te},"Cancel"),fe.value?(p(),m("span",Fy,w(fe.value),1)):I("",!0)])])):I("",!0),a("div",Ry,[f.value?(p(),m("div",By,"Loading…")):u.value.length?(p(),m("div",Vy,[a("table",Zy,[a("thead",null,[a("tr",Hy,[(p(),m(le,null,Ie(["Date","Drone","Area / route","Alt","Pilot","Compliance",""],$=>a("th",{key:$,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},w($),1)),64))])]),a("tbody",null,[(p(!0),m(le,null,Ie(u.value,$=>{var Ye,we,ge,ue;return p(),m(le,{key:$.id},[a("tr",{class:Ce(["border-b border-line last:border-0",te.value===$.id?"bg-accent-soft":""])},[a("td",jy,[z(w(($.operationDate||"").slice(0,10))+" ",1),$.startTime?(p(),m("span",Wy,w($.startTime),1)):I("",!0)]),a("td",Ky,w($.droneName||"—"),1),a("td",{class:"max-w-[220px] truncate px-5 py-3 text-ink-secondary",title:$.areaRoute},w($.areaRoute||"—"),9,Gy),a("td",qy,w($.maxAltitudeAgl?$.maxAltitudeAgl+" m":"—"),1),a("td",Yy,w($.pilotName||"—"),1),a("td",Jy,[a("button",{class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",s[y($).tone]]),onClick:ft=>T($.id)},[y($).tone==="danger"?(p(),nt(J,{key:0,name:"alertTriangle",size:12})):y($).tone==="success"?(p(),nt(J,{key:1,name:"check",size:12})):I("",!0),z(" "+w(y($).label),1)],10,Xy)]),a("td",Qy,[he.value===$.id?(p(),m(le,{key:0},[N[45]||(N[45]=a("span",{class:"mr-2 text-xs text-ink-muted"},"Delete?",-1)),a("button",{class:"btn-ghost mr-1",onClick:N[19]||(N[19]=ft=>he.value="")},"Cancel"),a("button",{class:"rounded bg-danger px-3 py-1.5 text-sm font-semibold text-white transition hover:brightness-110",onClick:ft=>Q($)},"Delete",8,ex)],64)):(p(),m(le,{key:1},[a("button",{class:"btn-ghost mr-1 inline-flex items-center gap-1",onClick:ft=>Oe($)},[A(J,{name:"sliders",size:13}),N[46]||(N[46]=z(" Edit",-1))],8,tx),a("button",{class:"btn-ghost inline-flex items-center gap-1",onClick:ft=>he.value=$.id},[A(J,{name:"trash",size:13})],8,nx)],64))])],2),C.value===$.id?(p(),m("tr",ix,[a("td",ox,[a("div",sx,[a("span",ax,[N[47]||(N[47]=z("Logging path: ",-1)),a("b",rx,w(((Ye=$.compliance)==null?void 0:Ye.loggingPath)||"—"),1)]),a("span",lx,[N[48]||(N[48]=z("Category: ",-1)),a("b",ux,w($.category||"—"),1)]),a("span",cx,[N[49]||(N[49]=z("Retain until: ",-1)),a("b",dx,w(($.retentionUntil||"").slice(0,10)||"—"),1)]),(we=$.compliance)!=null&&we.exempt?(p(),m("span",fx,[N[50]||(N[50]=z("Exempt: ",-1)),a("b",hx,w($.compliance.exemptReason),1)])):I("",!0)]),(((ge=$.compliance)==null?void 0:ge.redFlags)||[]).length?(p(),m("ul",px,[(p(!0),m(le,null,Ie($.compliance.redFlags,(ft,pe)=>(p(),m("li",{key:pe,class:"flex items-start gap-2 text-xs text-danger-fg"},[A(J,{name:"alertTriangle",size:13,class:"mt-px shrink-0"}),z(" "+w(ft),1)]))),128))])):(ue=$.compliance)!=null&&ue.exempt?I("",!0):(p(),m("div",mx,"No compliance gaps detected."))])])):I("",!0)],64)}),128))])])])):(p(),m("div",Uy,[A(J,{name:"book",size:26,class:"text-ink-muted"}),N[43]||(N[43]=a("div",{class:"mt-3 text-sm font-medium text-ink-secondary"},"No flights logged yet",-1)),N[44]||(N[44]=a("div",{class:"mt-1 text-xs text-ink-muted"},"Log your first operation to start the 5-year retention record.",-1))]))])]))}},vx={class:"mx-auto flex max-w-[1240px] flex-col gap-5 p-7"},_x={class:"flex flex-wrap items-center gap-3"},bx={class:"ml-auto flex items-center gap-2"},yx={class:"grid grid-cols-4 gap-4 max-[900px]:grid-cols-2"},xx={class:"eyebrow"},wx={key:0,class:"panel border-danger/40 p-4 text-sm text-danger-fg"},kx={key:1,class:"panel p-5"},Sx={class:"mb-4 flex items-center justify-between"},Tx={class:"eyebrow"},Px={class:"grid grid-cols-3 gap-3 max-[760px]:grid-cols-1"},Cx={class:"block"},Lx={class:"block"},Ax={class:"block"},Mx={class:"block"},Ex={class:"block"},Ox={class:"block"},zx={class:"block"},$x={class:"block"},Ix={class:"block"},Nx={class:"block"},Dx=["value"],Fx={class:"mt-3 flex flex-wrap gap-6"},Rx={class:"flex items-center gap-2 text-sm text-ink-secondary"},Bx={class:"flex items-center gap-2 text-sm text-ink-secondary"},Ux={class:"mt-4 flex items-center gap-3"},Vx=["disabled"],Zx={key:0,class:"text-sm text-danger-fg"},Hx={class:"panel overflow-hidden p-0"},jx={key:0,class:"px-5 py-12 text-center text-sm text-ink-muted"},Wx={key:1,class:"grid place-items-center px-5 py-16 text-center"},Kx={key:2,class:"overflow-x-auto"},Gx={class:"w-full border-collapse text-sm"},qx={class:"text-left"},Yx={class:"px-5 py-3"},Jx={class:"flex items-center gap-2"},Xx={class:"font-semibold text-ink"},Qx={key:0,class:"text-xs text-ink-muted"},e0={key:1,class:"text-xs text-ink-muted"},t0={class:"px-5 py-3 font-mono text-xs text-ink-secondary"},n0={key:0,class:"text-[11px] text-ink-muted",title:"Flight controller SN — reported by the aircraft, not its registered serial"},i0={class:"px-5 py-3 font-mono text-xs text-ink-secondary"},o0={class:"px-5 py-3 font-mono text-xs text-ink-secondary"},s0={class:"px-5 py-3 font-mono text-xs text-ink-secondary"},a0={class:"px-5 py-3"},r0={key:1,class:"text-ink-muted"},l0={class:"whitespace-nowrap px-5 py-3 text-right"},u0=["onClick"],c0=["onClick"],d0=["onClick"],f0={__name:"Drones",props:{connectedFcSerials:{type:Array,default:()=>[]}},emits:["deleted"],setup(t,{expose:i,emit:s}){const l=t,u=s,f={success:"bg-success-soft text-success-fg",accent:"bg-accent-soft text-accent-soft-fg",neutral:"bg-surface-2 text-ink-secondary"},h=Y([]),_=Y(!1),y=Y("");async function C(){_.value=!0,y.value="";const Q=await pl();Q.ok||(y.value=Q.status===503?"Drone storage is not configured on the API Server (service account missing).":"Could not load your drones."),h.value=Q.drones,_.value=!1}fi(C),i({reload:C});const T=ce(()=>new Set(l.connectedFcSerials.filter(Boolean)));function M(Q){return!!Q.flightControllerSerial&&T.value.has(Q.flightControllerSerial)}const H=["","C0","C1","C2","C3","C4","C5","C6"];function j(){return{name:"",model:"",serial:"",flightControllerSerial:"",firmware:"",controllerFirmware:"",registration:"",operatorNumber:"",mtomGrams:"",isToy:!1,autologsFlights:!1,cClass:""}}const K=Y(!1),F=Y(""),te=gt(j()),X=Y(""),fe=Y(!1);function Se(){Object.assign(te,j()),F.value="",X.value="",K.value=!0}function de(Q){Object.assign(te,{name:Q.name||"",model:Q.model||"",serial:Q.serial||"",flightControllerSerial:Q.flightControllerSerial||"",firmware:Q.firmware||"",controllerFirmware:Q.controllerFirmware||"",registration:Q.registration||"",operatorNumber:Q.operatorNumber||"",mtomGrams:Q.mtomGrams||"",isToy:!!Q.isToy,autologsFlights:!!Q.autologsFlights,cClass:Q.cClass||""}),F.value=Q.id,X.value="",K.value=!0}function Fe(){K.value=!1,F.value=""}async function Oe(){var O;if(X.value="",!te.name.trim()&&!te.model.trim()&&!te.serial.trim()&&!te.flightControllerSerial.trim()){X.value="Give the drone a custom name, model or serial.";return}fe.value=!0;const Q={...te,mtomGrams:Number(te.mtomGrams)||0},B=F.value?await Cp(F.value,Q):await Tp(Q);if(fe.value=!1,!B.ok){X.value=((O=B.body)==null?void 0:O.error)||"Could not save the drone.";return}K.value=!1,await C()}const Te=Y("");async function Ze(Q){var O;const B=await Lp(Q.id);Te.value="",B.ok?(u("deleted",Q.flightControllerSerial),await C()):X.value=((O=B.body)==null?void 0:O.error)||"Could not delete the drone."}const he=ce(()=>({fleet:h.value.length,connected:h.value.filter(M).length,unnamed:h.value.filter(Q=>!(Q.name||"").trim()).length,unregistered:h.value.filter(Q=>!(Q.registration||"").trim()).length}));return(Q,B)=>(p(),m("div",vx,[a("div",_x,[B[14]||(B[14]=a("div",null,[a("div",{class:"eyebrow"},"Fleet"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Drones you fly")],-1)),a("div",bx,[a("button",{class:"btn-accent inline-flex items-center gap-2",onClick:Se},[A(J,{name:"plus",size:15}),B[13]||(B[13]=z(" Add drone ",-1))])])]),a("div",yx,[(p(!0),m(le,null,Ie([{label:"Drones in fleet",value:he.value.fleet,tone:"neutral"},{label:"Connected now",value:he.value.connected,tone:he.value.connected?"success":"neutral"},{label:"Awaiting a name",value:he.value.unnamed,tone:"neutral"},{label:"No registration",value:he.value.unregistered,tone:"neutral"}],O=>(p(),m("div",{key:O.label,class:"panel p-5"},[a("div",xx,w(O.label),1),a("div",{class:Ce(["mt-2 text-[30px] font-bold leading-none tracking-tightest",O.tone==="success"?"text-success-fg":"text-ink"])},w(O.value),3)]))),128))]),y.value?(p(),m("div",wx,w(y.value),1)):I("",!0),K.value?(p(),m("div",kx,[a("div",Sx,[a("div",null,[a("div",Tx,w(F.value?"Edit drone":"New drone"),1),B[15]||(B[15]=a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Aircraft registry",-1))]),a("button",{class:"btn-icon",onClick:Fe},[A(J,{name:"x",size:16})])]),a("div",Px,[a("label",Cx,[B[16]||(B[16]=a("span",{class:"eyebrow mb-1 block"},"Custom name",-1)),ie(a("input",{"onUpdate:modelValue":B[0]||(B[0]=O=>te.name=O),class:"field",placeholder:"Mavic-01"},null,512),[[me,te.name]])]),a("label",Lx,[B[17]||(B[17]=a("span",{class:"eyebrow mb-1 block"},"Model",-1)),ie(a("input",{"onUpdate:modelValue":B[1]||(B[1]=O=>te.model=O),class:"field",placeholder:"DJI Mavic 3 Enterprise"},null,512),[[me,te.model]])]),a("label",Ax,[B[18]||(B[18]=a("span",{class:"eyebrow mb-1 block"},"Serial number",-1)),ie(a("input",{"onUpdate:modelValue":B[2]||(B[2]=O=>te.serial=O),class:"field",placeholder:"08QDE3H012032E"},null,512),[[me,te.serial]]),B[19]||(B[19]=a("span",{class:"mt-1 block text-xs text-ink-muted"},"From the sticker on the airframe.",-1))]),a("label",Mx,[B[20]||(B[20]=a("span",{class:"eyebrow mb-1 block"},"Flight controller SN",-1)),ie(a("input",{"onUpdate:modelValue":B[3]||(B[3]=O=>te.flightControllerSerial=O),class:"field",placeholder:"08RDE1J00103H1"},null,512),[[me,te.flightControllerSerial]]),B[21]||(B[21]=a("span",{class:"mt-1 block text-xs text-ink-muted"},"Auto-filled on connect.",-1))]),a("label",Ex,[B[22]||(B[22]=a("span",{class:"eyebrow mb-1 block"},"Drone firmware",-1)),ie(a("input",{"onUpdate:modelValue":B[4]||(B[4]=O=>te.firmware=O),class:"field",placeholder:"03.02.35.05"},null,512),[[me,te.firmware]])]),a("label",Ox,[B[23]||(B[23]=a("span",{class:"eyebrow mb-1 block"},"Controller firmware",-1)),ie(a("input",{"onUpdate:modelValue":B[5]||(B[5]=O=>te.controllerFirmware=O),class:"field",placeholder:"01.03.0800"},null,512),[[me,te.controllerFirmware]])]),a("label",zx,[B[24]||(B[24]=a("span",{class:"eyebrow mb-1 block"},"Registration (FAA/CAA)",-1)),ie(a("input",{"onUpdate:modelValue":B[6]||(B[6]=O=>te.registration=O),class:"field",placeholder:"FA3X7K9PLM"},null,512),[[me,te.registration]])]),a("label",$x,[B[25]||(B[25]=a("span",{class:"eyebrow mb-1 block"},"Operator no. (EU)",-1)),ie(a("input",{"onUpdate:modelValue":B[7]||(B[7]=O=>te.operatorNumber=O),class:"field",placeholder:"DNK…"},null,512),[[me,te.operatorNumber]])]),a("label",Ix,[B[26]||(B[26]=a("span",{class:"eyebrow mb-1 block"},"MTOM (grams)",-1)),ie(a("input",{"onUpdate:modelValue":B[8]||(B[8]=O=>te.mtomGrams=O),type:"number",min:"0",class:"field",placeholder:"920"},null,512),[[me,te.mtomGrams]])]),a("label",Nx,[B[27]||(B[27]=a("span",{class:"eyebrow mb-1 block"},"C-class",-1)),ie(a("select",{"onUpdate:modelValue":B[9]||(B[9]=O=>te.cClass=O),class:"field"},[(p(),m(le,null,Ie(H,O=>a("option",{key:O,value:O},w(O||"— none —"),9,Dx)),64))],512),[[Ot,te.cClass]])])]),B[30]||(B[30]=a("p",{class:"mt-3 text-xs text-ink-muted"}," Model, flight controller SN and both firmware versions fill themselves in when the drone connects — anything you type here is kept as-is. The serial number is the one you register the drone under, and only you can supply it: the SDK cannot read it off the aircraft. ",-1)),a("div",Fx,[a("label",Rx,[ie(a("input",{"onUpdate:modelValue":B[10]||(B[10]=O=>te.autologsFlights=O),type:"checkbox",class:"h-4 w-4 accent-[var(--accent)]"},null,512),[[Va,te.autologsFlights]]),B[28]||(B[28]=z(" Auto-logs flights (onboard FDR) ",-1))]),a("label",Bx,[ie(a("input",{"onUpdate:modelValue":B[11]||(B[11]=O=>te.isToy=O),type:"checkbox",class:"h-4 w-4 accent-[var(--accent)]"},null,512),[[Va,te.isToy]]),B[29]||(B[29]=z(" Toy drone (logbook-exempt) ",-1))])]),a("div",Ux,[a("button",{class:"btn-accent",disabled:fe.value,onClick:Oe},w(fe.value?"Saving…":F.value?"Save changes":"Add drone"),9,Vx),a("button",{class:"btn-ghost",onClick:Fe},"Cancel"),X.value?(p(),m("span",Zx,w(X.value),1)):I("",!0)])])):I("",!0),a("div",Hx,[_.value?(p(),m("div",jx,"Loading…")):h.value.length?(p(),m("div",Kx,[a("table",Gx,[a("thead",null,[a("tr",qx,[(p(),m(le,null,Ie(["Drone","Serial","Firmware","Ctrl FW","Registration","Class",""],O=>a("th",{key:O,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},w(O),1)),64))])]),a("tbody",null,[(p(!0),m(le,null,Ie(h.value,O=>(p(),m("tr",{key:O.id,class:Ce(["border-b border-line last:border-0",F.value===O.id?"bg-accent-soft":""])},[a("td",Yx,[a("div",Jx,[a("span",Xx,w(O.displayName),1),M(O)?(p(),m("span",{key:0,class:Ce(["inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-semibold",f.success])},[A(J,{name:"signal",size:11}),B[33]||(B[33]=z(" connected ",-1))],2)):I("",!0)]),O.name&&O.model?(p(),m("div",Qx,w(O.model),1)):O.name?I("",!0):(p(),m("div",e0,"no custom name yet"))]),a("td",t0,[z(w(O.serial||"—")+" ",1),O.flightControllerSerial?(p(),m("div",n0," FC "+w(O.flightControllerSerial),1)):I("",!0)]),a("td",i0,w(O.firmware||"—"),1),a("td",o0,w(O.controllerFirmware||"—"),1),a("td",s0,w(O.registration||"—"),1),a("td",a0,[O.cClass?(p(),m("span",{key:0,class:Ce(["inline-flex rounded-full px-2 py-0.5 text-[11px] font-semibold",f.accent])},w(O.cClass),3)):(p(),m("span",r0,"—")),O.isToy?(p(),m("span",{key:2,class:Ce(["ml-1 inline-flex rounded-full px-2 py-0.5 text-[11px] font-semibold",f.neutral])},"toy",2)):I("",!0)]),a("td",l0,[Te.value===O.id?(p(),m(le,{key:0},[B[34]||(B[34]=a("span",{class:"mr-2 text-xs text-ink-muted"},"Delete?",-1)),a("button",{class:"btn-ghost mr-1",onClick:B[12]||(B[12]=N=>Te.value="")},"Cancel"),a("button",{class:"rounded bg-danger px-3 py-1.5 text-sm font-semibold text-white transition hover:brightness-110",onClick:N=>Ze(O)},"Delete",8,u0)],64)):(p(),m(le,{key:1},[a("button",{class:"btn-ghost mr-1 inline-flex items-center gap-1",onClick:N=>de(O)},[A(J,{name:"sliders",size:13}),B[35]||(B[35]=z(" Edit",-1))],8,c0),a("button",{class:"btn-ghost inline-flex items-center gap-1",onClick:N=>Te.value=O.id},[A(J,{name:"trash",size:13})],8,d0)],64))])],2))),128))])])])):(p(),m("div",Wx,[A(J,{name:"drone",size:26,class:"text-ink-muted"}),B[31]||(B[31]=a("div",{class:"mt-3 text-sm font-medium text-ink-secondary"},"No drones yet",-1)),B[32]||(B[32]=a("div",{class:"mt-1 text-xs text-ink-muted"}," Connect a drone in the Fly App and it lands here by itself — or add one by hand. ",-1))]))])]))}},h0={class:"mx-auto flex max-w-[1240px] flex-col gap-5 p-7"},p0={class:"flex flex-wrap items-center gap-3"},m0={class:"inline-flex flex-wrap rounded-lg border border-line bg-surface-1 p-0.5"},g0=["onClick"],v0={class:"ml-auto"},_0={class:"grid grid-cols-4 gap-4 max-[900px]:grid-cols-2"},b0={class:"eyebrow"},y0={key:0,class:"panel border-danger/40 p-4 text-sm text-danger-fg"},x0={key:1,class:"panel p-5"},w0={class:"mb-4 flex items-center justify-between"},k0={class:"eyebrow"},S0={class:"mt-0.5 text-base font-semibold text-ink"},T0={class:"grid grid-cols-3 gap-3 max-[760px]:grid-cols-1"},P0={class:"col-span-2 block max-[760px]:col-span-1"},C0={class:"block"},L0=["value"],A0={class:"block"},M0=["value"],E0={class:"block"},O0=["value"],z0={class:"block"},$0={class:"block"},I0={class:"block"},N0={class:"block"},D0=["value"],F0={class:"block"},R0={class:"block"},B0={class:"block"},U0=["value"],V0={class:"mt-3 block"},Z0={key:0,class:"mt-3"},H0={class:"eyebrow mb-1 block"},j0={key:1,class:"mt-3 text-xs text-ink-muted"},W0={class:"mt-4 flex items-center gap-3"},K0=["disabled"],G0={key:0,class:"text-sm text-danger-fg"},q0={class:"panel overflow-hidden p-0"},Y0={key:0,class:"px-5 py-12 text-center text-sm text-ink-muted"},J0={key:1,class:"grid place-items-center px-5 py-16 text-center"},X0={class:"mt-3 text-sm font-medium text-ink-secondary"},Q0={class:"mt-1 text-xs text-ink-muted"},ew={key:2,class:"overflow-x-auto"},tw={class:"w-full border-collapse text-sm"},nw={class:"text-left"},iw={class:"px-5 py-3"},ow={class:"font-semibold text-ink"},sw={key:0,class:"font-mono text-[11px] text-ink-muted"},aw={class:"px-5 py-3 text-ink-secondary"},rw={class:"px-5 py-3 text-ink-secondary"},lw={class:"px-5 py-3"},uw=["onClick"],cw={key:0,class:"mt-0.5 font-mono text-[10.5px] text-ink-muted"},dw={class:"px-5 py-3 font-mono text-ink-secondary"},fw={class:"whitespace-nowrap px-5 py-3 text-right"},hw=["onClick"],pw=["onClick"],mw=["href"],gw=["onClick"],vw=["onClick"],_w=["onClick"],bw={key:0,class:"border-b border-line bg-surface-2"},yw={colspan:"6",class:"px-5 py-3"},xw={class:"flex flex-wrap gap-x-8 gap-y-1.5 text-xs"},ww={class:"text-ink-secondary"},kw={class:"text-ink"},Sw={class:"text-ink-secondary"},Tw={class:"text-ink"},Pw={key:0,class:"text-ink-secondary"},Cw={class:"text-ink"},Lw={key:1,class:"text-ink-secondary"},Aw={class:"font-mono text-ink"},Mw={key:2,class:"text-ink-secondary"},Ew={class:"font-mono text-ink"},Ow={class:"text-ink-secondary"},zw={class:"text-ink"},$w={key:0,class:"mt-2 space-y-1"},Iw={key:1,class:"mt-2 text-xs text-success-fg"},Nw={key:2,class:"mt-2 text-xs text-ink-secondary"},Dw={class:"flex max-h-[90vh] w-full max-w-[920px] flex-col overflow-hidden rounded-lg border border-line bg-surface-1 shadow-2xl"},Fw={class:"flex items-center gap-3 border-b border-line px-5 py-3"},Rw={class:"min-w-0"},Bw={class:"truncate text-sm font-semibold text-ink"},Uw={class:"truncate font-mono text-[11px] text-ink-muted"},Vw={class:"ml-auto flex items-center gap-2"},Zw=["href"],Hw=["href"],jw={class:"flex-1 overflow-auto bg-surface-2"},Ww=["src","alt"],Kw=["src","title"],Gw={key:2,class:"grid place-items-center px-6 py-16 text-center"},qw={class:"mt-1 text-xs text-ink-muted"},Yw=["href"],Jw={__name:"Documents",props:{email:{type:String,default:""},role:{type:String,default:"user"},organization:{type:String,default:""},organizationName:{type:String,default:""}},setup(t){const i={success:"bg-success-soft text-success-fg",warning:"bg-amber-soft text-amber-fg",danger:"bg-danger-soft text-danger-fg",accent:"bg-accent-soft text-accent-soft-fg",neutral:"bg-surface-2 text-ink-secondary"},s=[{value:"certificate",label:"Pilot certificate"},{value:"medical",label:"Medical / training"},{value:"insurance",label:"Insurance / liability"},{value:"background_check",label:"Background check / waiver"},{value:"registration",label:"Aircraft registration"},{value:"maintenance",label:"Maintenance log"},{value:"conformity",label:"Conformity / compliance"},{value:"firmware",label:"Firmware / software"},{value:"incident",label:"Incident / repair report"},{value:"flight_log",label:"Flight log"},{value:"checklist",label:"Pre-flight checklist"},{value:"airspace_auth",label:"Airspace authorisation"},{value:"mission_plan",label:"Mission plan / flight path"},{value:"risk_assessment",label:"Risk assessment / survey"},{value:"contract",label:"Contract / SOW"},{value:"client_insurance",label:"Client insurance cert"},{value:"delivery_report",label:"Delivery / media handoff"},{value:"other",label:"Other"}],l=Object.fromEntries(s.map(x=>[x.value,x.label])),u=[{value:"pilot",label:"Pilot"},{value:"aircraft",label:"Aircraft"},{value:"organization",label:"Organization"},{value:"client",label:"Client"},{value:"other",label:"Other"}],f=[{value:"active",label:"Active"},{value:"pending_review",label:"Pending review"},{value:"archived",label:"Archived"}],h=[{value:"pilot",label:"Pilot"},{value:"ops",label:"Ops manager"},{value:"admin",label:"Admin"},{value:"client",label:"Client-facing"}],_=Y([]),y=Y([]),C=Y(!1),T=Y("");async function M(){C.value=!0,T.value="";const[x,b]=await Promise.all([$p(),pl()]);x.ok||(T.value=x.status===503?"Document storage is not configured on the API Server (service account missing).":"Could not load documents."),_.value=x.documents,y.value=b.drones||[],C.value=!1}fi(M);const H=Y("all"),j=[["all","All"],["expiring","Expiring soon"],["expired","Expired"],["pending","Pending review"],["archived","Archived"]],K=ce(()=>{const x=_.value;switch(H.value){case"expiring":return x.filter(b=>{var S;return((S=b.expiry)==null?void 0:S.state)==="expiring_soon"&&b.status!=="archived"});case"expired":return x.filter(b=>{var S;return((S=b.expiry)==null?void 0:S.state)==="expired"&&b.status!=="archived"});case"pending":return x.filter(b=>b.status==="pending_review");case"archived":return x.filter(b=>b.status==="archived");default:return x.filter(b=>b.status!=="archived")}});function F(x){if(x.status==="archived")return{tone:"neutral",label:"Superseded",icon:""};const b=x.expiry||{};return b.state==="expired"?{tone:"danger",label:"Expired",icon:"alertTriangle"}:b.state==="expiring_soon"?{tone:"warning",label:`Expires in ${b.daysUntilExpiry}d`,icon:"clock"}:b.state==="valid"?{tone:"success",label:"Valid",icon:"check"}:{tone:"neutral",label:"No expiry",icon:""}}const te=Y("");function X(x){te.value=te.value===x?"":x}function fe(x){return x.ownerDrone?x.ownerDroneName||"Aircraft":x.ownerRef?x.ownerRef:x.ownerType==="pilot"?"Pilot":x.ownerType?x.ownerType.charAt(0).toUpperCase()+x.ownerType.slice(1):"—"}const Se=["png","jpg","jpeg","gif","webp","svg","bmp","avif"],de=["pdf","txt","csv","log","json","md","html","htm","xml"];function Fe(x){const b=(x||"").split(".").pop().toLowerCase();return Se.includes(b)?"image":de.includes(b)?"frame":"none"}const Oe=Y(null),Te=ce(()=>Oe.value?Fe(Oe.value.fileName):"none"),Ze=ce(()=>Oe.value?Fp(Oe.value.id):"");function he(x){Oe.value=x}function Q(){Oe.value=null}function B(x){x.key==="Escape"&&Oe.value&&Q()}fi(()=>window.addEventListener("keydown",B)),us(()=>window.removeEventListener("keydown",B));function O(){return{title:"",docType:"certificate",ownerType:"pilot",ownerDrone:"",ownerRef:"",reference:"",jurisdiction:"",issueDate:"",expiryDate:"",status:"active",accessTier:"ops",notes:""}}const N=Y(!1),$=Y(""),Ye=Y(""),we=Y(""),ge=gt(O()),ue=Y(null),ft=Y(null),pe=Y(""),Ue=Y(!1);function Ve(){ue.value=null,ft.value&&(ft.value.value="")}function wt(){Object.assign(ge,O()),$.value="",Ye.value="",we.value="",Ve(),pe.value="",N.value=!0}function st(x){Object.assign(ge,{title:x.title||"",docType:x.docType||"certificate",ownerType:x.ownerType||"pilot",ownerDrone:x.ownerDrone||"",ownerRef:x.ownerRef||"",reference:x.reference||"",jurisdiction:x.jurisdiction||"",issueDate:x.issueDate||"",expiryDate:x.expiryDate||"",status:x.status||"active",accessTier:x.accessTier||"ops",notes:x.notes||""}),$.value=x.id,Ye.value="",we.value="",Ve(),pe.value="",N.value=!0}function Le(x){st(x),$.value="",Ye.value=x.id,we.value=x.title,ge.status="active"}function De(){N.value=!1,$.value="",Ye.value=""}function zt(x){var b;ue.value=((b=x.target.files)==null?void 0:b[0])||null}async function At(){var b;if(pe.value="",!ge.title.trim()){pe.value="Give the document a title.";return}Ue.value=!0;let x;if($.value)x=await Np($.value,{...ge});else{const S={...ge};Ye.value&&(S.replaces=Ye.value),x=await Ip(S,ue.value)}if(Ue.value=!1,!x.ok){pe.value=((b=x.body)==null?void 0:b.error)||"Could not save the document.";return}N.value=!1,$.value="",Ye.value="",await M()}const Ut=Y("");async function Pt(x){var S;const b=await Dp(x.id);Ut.value="",b.ok?await M():pe.value=((S=b.body)==null?void 0:S.error)||"Could not delete the document."}const kt=ce(()=>{const x=_.value.filter(b=>b.status!=="archived");return{total:x.length,expiring:x.filter(b=>{var S;return((S=b.expiry)==null?void 0:S.state)==="expiring_soon"}).length,expired:x.filter(b=>{var S;return((S=b.expiry)==null?void 0:S.state)==="expired"}).length,pending:_.value.filter(b=>b.status==="pending_review").length}});return(x,b)=>(p(),m("div",h0,[a("div",p0,[a("div",m0,[(p(),m(le,null,Ie(j,S=>a("button",{key:S[0],class:Ce(["rounded-md px-3.5 py-1.5 text-sm font-semibold transition",H.value===S[0]?"bg-accent-soft text-accent-soft-fg":"text-ink-secondary hover:text-ink"]),onClick:W=>H.value=S[0]},w(S[1]),11,g0)),64))]),a("div",v0,[a("button",{class:"btn-accent inline-flex items-center gap-2",onClick:wt},[A(J,{name:"upload",size:15}),b[13]||(b[13]=z(" Add document ",-1))])])]),a("div",_0,[(p(!0),m(le,null,Ie([{label:"Documents on file",value:kt.value.total,tone:"neutral"},{label:"Expiring soon",value:kt.value.expiring,tone:kt.value.expiring?"warning":"neutral"},{label:"Expired",value:kt.value.expired,tone:kt.value.expired?"danger":"success"},{label:"Pending review",value:kt.value.pending,tone:kt.value.pending?"accent":"neutral"}],S=>(p(),m("div",{key:S.label,class:"panel p-5"},[a("div",b0,w(S.label),1),a("div",{class:Ce(["mt-2 text-[30px] font-bold leading-none tracking-tightest",S.tone==="danger"?"text-danger-fg":S.tone==="warning"?"text-amber-fg":S.tone==="success"?"text-success-fg":S.tone==="accent"?"text-accent-soft-fg":"text-ink"])},w(S.value),3)]))),128))]),T.value?(p(),m("div",y0,w(T.value),1)):I("",!0),N.value?(p(),m("div",x0,[a("div",w0,[a("div",null,[a("div",k0,w($.value?"Edit document":Ye.value?"New version":"New document"),1),a("div",S0,w(Ye.value?`Supersedes “${we.value}”`:"Compliance & operational document"),1)]),a("button",{class:"btn-icon",onClick:De},[A(J,{name:"x",size:16})])]),a("div",T0,[a("label",P0,[b[14]||(b[14]=a("span",{class:"eyebrow mb-1 block"},"Title",-1)),ie(a("input",{"onUpdate:modelValue":b[0]||(b[0]=S=>ge.title=S),class:"field",placeholder:"A2 Remote Pilot Certificate — J. Dariusz"},null,512),[[me,ge.title]])]),a("label",C0,[b[15]||(b[15]=a("span",{class:"eyebrow mb-1 block"},"Type",-1)),ie(a("select",{"onUpdate:modelValue":b[1]||(b[1]=S=>ge.docType=S),class:"field"},[(p(),m(le,null,Ie(s,S=>a("option",{key:S.value,value:S.value},w(S.label),9,L0)),64))],512),[[Ot,ge.docType]])]),a("label",A0,[b[16]||(b[16]=a("span",{class:"eyebrow mb-1 block"},"Owner type",-1)),ie(a("select",{"onUpdate:modelValue":b[2]||(b[2]=S=>ge.ownerType=S),class:"field"},[(p(),m(le,null,Ie(u,S=>a("option",{key:S.value,value:S.value},w(S.label),9,M0)),64))],512),[[Ot,ge.ownerType]])]),a("label",E0,[b[18]||(b[18]=a("span",{class:"eyebrow mb-1 block"},"Aircraft (if any)",-1)),ie(a("select",{"onUpdate:modelValue":b[3]||(b[3]=S=>ge.ownerDrone=S),class:"field"},[b[17]||(b[17]=a("option",{value:""},"— none —",-1)),(p(!0),m(le,null,Ie(y.value,S=>(p(),m("option",{key:S.id,value:S.id},w(S.name)+w(S.model?` · ${S.model}`:""),9,O0))),128))],512),[[Ot,ge.ownerDrone]])]),a("label",z0,[b[19]||(b[19]=a("span",{class:"eyebrow mb-1 block"},"Owner reference",-1)),ie(a("input",{"onUpdate:modelValue":b[4]||(b[4]=S=>ge.ownerRef=S),class:"field",placeholder:"Client name / serial / site"},null,512),[[me,ge.ownerRef]])]),a("label",$0,[b[20]||(b[20]=a("span",{class:"eyebrow mb-1 block"},"Reference / number",-1)),ie(a("input",{"onUpdate:modelValue":b[5]||(b[5]=S=>ge.reference=S),class:"field",placeholder:"Cert / registration / policy no."},null,512),[[me,ge.reference]])]),a("label",I0,[b[21]||(b[21]=a("span",{class:"eyebrow mb-1 block"},"Jurisdiction",-1)),ie(a("input",{"onUpdate:modelValue":b[6]||(b[6]=S=>ge.jurisdiction=S),class:"field",placeholder:"DK / EASA / FAA"},null,512),[[me,ge.jurisdiction]])]),a("label",N0,[b[22]||(b[22]=a("span",{class:"eyebrow mb-1 block"},"Access tier",-1)),ie(a("select",{"onUpdate:modelValue":b[7]||(b[7]=S=>ge.accessTier=S),class:"field"},[(p(),m(le,null,Ie(h,S=>a("option",{key:S.value,value:S.value},w(S.label),9,D0)),64))],512),[[Ot,ge.accessTier]])]),a("label",F0,[b[23]||(b[23]=a("span",{class:"eyebrow mb-1 block"},"Issue date",-1)),ie(a("input",{"onUpdate:modelValue":b[8]||(b[8]=S=>ge.issueDate=S),type:"date",class:"field"},null,512),[[me,ge.issueDate]])]),a("label",R0,[b[24]||(b[24]=a("span",{class:"eyebrow mb-1 block"},"Expiry date",-1)),ie(a("input",{"onUpdate:modelValue":b[9]||(b[9]=S=>ge.expiryDate=S),type:"date",class:"field"},null,512),[[me,ge.expiryDate]])]),a("label",B0,[b[25]||(b[25]=a("span",{class:"eyebrow mb-1 block"},"Status",-1)),ie(a("select",{"onUpdate:modelValue":b[10]||(b[10]=S=>ge.status=S),class:"field"},[(p(),m(le,null,Ie(f,S=>a("option",{key:S.value,value:S.value},w(S.label),9,U0)),64))],512),[[Ot,ge.status]])])]),a("label",V0,[b[26]||(b[26]=a("span",{class:"eyebrow mb-1 block"},"Notes",-1)),ie(a("textarea",{"onUpdate:modelValue":b[11]||(b[11]=S=>ge.notes=S),rows:"2",class:"field",placeholder:"Conditions, renewal contacts, anything worth recording"},null,512),[[me,ge.notes]])]),$.value?(p(),m("div",j0,[...b[28]||(b[28]=[z(" Editing updates metadata only. To replace the file, close this and use ",-1),a("b",{class:"text-ink-secondary"},"New version",-1),z(" on the document — the old version is kept for audit. ",-1)])])):(p(),m("div",Z0,[a("span",H0,"File "+w(Ye.value?"(new version)":"(optional)"),1),a("input",{ref_key:"fileInput",ref:ft,type:"file",class:"field",onChange:zt},null,544),b[27]||(b[27]=a("p",{class:"mt-1 text-xs text-ink-muted"}," Stored in PocketBase for now (object storage later). Max 50 MB. ",-1))])),a("div",W0,[a("button",{class:"btn-accent",disabled:Ue.value,onClick:At},w(Ue.value?"Saving…":$.value?"Save changes":Ye.value?"Upload new version":"Add document"),9,K0),a("button",{class:"btn-ghost",onClick:De},"Cancel"),pe.value?(p(),m("span",G0,w(pe.value),1)):I("",!0)])])):I("",!0),a("div",q0,[C.value?(p(),m("div",Y0,"Loading…")):K.value.length?(p(),m("div",ew,[a("table",tw,[a("thead",null,[a("tr",nw,[(p(),m(le,null,Ie(["Title","Type","Owner","Expiry","Ver",""],S=>a("th",{key:S,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},w(S),1)),64))])]),a("tbody",null,[(p(!0),m(le,null,Ie(K.value,S=>{var W,V;return p(),m(le,{key:S.id},[a("tr",{class:Ce(["border-b border-line last:border-0",$.value===S.id?"bg-accent-soft":""])},[a("td",iw,[a("div",ow,w(S.title),1),S.reference?(p(),m("div",sw,w(S.reference),1)):I("",!0)]),a("td",aw,w(Ee(l)[S.docType]||S.docType||"—"),1),a("td",rw,w(fe(S)),1),a("td",lw,[a("button",{class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",i[F(S).tone]]),onClick:G=>X(S.id)},[F(S).icon?(p(),nt(J,{key:0,name:F(S).icon,size:12},null,8,["name"])):I("",!0),z(" "+w(F(S).label),1)],10,uw),S.expiryDate?(p(),m("div",cw,w(S.expiryDate),1)):I("",!0)]),a("td",dw,"v"+w(S.version||1),1),a("td",fw,[Ut.value===S.id?(p(),m(le,{key:0},[b[29]||(b[29]=a("span",{class:"mr-2 text-xs text-ink-muted"},"Delete?",-1)),a("button",{class:"btn-ghost mr-1",onClick:b[12]||(b[12]=G=>Ut.value="")},"Cancel"),a("button",{class:"rounded bg-danger px-3 py-1.5 text-sm font-semibold text-white transition hover:brightness-110",onClick:G=>Pt(S)},"Delete",8,hw)],64)):(p(),m(le,{key:1},[S.hasFile?(p(),m("button",{key:0,class:"btn-ghost mr-1 inline-flex items-center gap-1",title:"Preview",onClick:G=>he(S)},[A(J,{name:"eye",size:13})],8,pw)):I("",!0),S.hasFile?(p(),m("a",{key:1,href:Ee(zr)(S.id),class:"btn-ghost mr-1 inline-flex items-center gap-1",title:"Download file"},[A(J,{name:"download",size:13})],8,mw)):I("",!0),a("button",{class:"btn-ghost mr-1 inline-flex items-center gap-1",title:"Upload new version",onClick:G=>Le(S)},[A(J,{name:"upload",size:13})],8,gw),a("button",{class:"btn-ghost mr-1 inline-flex items-center gap-1",onClick:G=>st(S)},[A(J,{name:"sliders",size:13}),b[30]||(b[30]=z(" Edit",-1))],8,vw),a("button",{class:"btn-ghost inline-flex items-center gap-1",onClick:G=>Ut.value=S.id},[A(J,{name:"trash",size:13})],8,_w)],64))])],2),te.value===S.id?(p(),m("tr",bw,[a("td",yw,[a("div",xw,[a("span",ww,[b[31]||(b[31]=z("Status: ",-1)),a("b",kw,w(S.status||"—"),1)]),a("span",Sw,[b[32]||(b[32]=z("Access: ",-1)),a("b",Tw,w(S.accessTier||"—"),1)]),S.jurisdiction?(p(),m("span",Pw,[b[33]||(b[33]=z("Jurisdiction: ",-1)),a("b",Cw,w(S.jurisdiction),1)])):I("",!0),S.issueDate?(p(),m("span",Lw,[b[34]||(b[34]=z("Issued: ",-1)),a("b",Aw,w(S.issueDate),1)])):I("",!0),S.expiryDate?(p(),m("span",Mw,[b[35]||(b[35]=z("Expires: ",-1)),a("b",Ew,w(S.expiryDate),1)])):I("",!0),a("span",Ow,[b[36]||(b[36]=z("File: ",-1)),a("b",zw,w(S.hasFile?S.fileName:"none"),1)])]),(((W=S.expiry)==null?void 0:W.flags)||[]).length?(p(),m("ul",$w,[(p(!0),m(le,null,Ie(S.expiry.flags,(G,re)=>(p(),m("li",{key:re,class:Ce(["flex items-start gap-2 text-xs",S.expiry.state==="expired"?"text-danger-fg":S.expiry.state==="expiring_soon"?"text-amber-fg":"text-ink-secondary"])},[A(J,{name:"alertTriangle",size:13,class:"mt-px shrink-0"}),z(" "+w(G),1)],2))),128))])):((V=S.expiry)==null?void 0:V.state)==="valid"?(p(),m("div",Iw,"In force — no action needed.")):I("",!0),S.notes?(p(),m("div",Nw,[b[37]||(b[37]=a("span",{class:"text-ink-muted"},"Notes:",-1)),z(" "+w(S.notes),1)])):I("",!0)])])):I("",!0)],64)}),128))])])])):(p(),m("div",J0,[A(J,{name:"fileText",size:26,class:"text-ink-muted"}),a("div",X0,w(H.value==="all"?"No documents on file yet":"Nothing in this view"),1),a("div",Q0,w(H.value==="all"?"Add certificates, registrations, insurance and authorisations to track their expiry.":"Try a different filter."),1)]))]),(p(),nt(cf,{to:"body"},[Oe.value?(p(),m("div",{key:0,class:"fixed inset-0 z-50 grid place-items-center p-4",style:{background:"color-mix(in srgb, black 60%, transparent)"},onClick:hl(Q,["self"])},[a("div",Dw,[a("div",Fw,[a("div",Rw,[a("div",Bw,w(Oe.value.title),1),a("div",Uw,w(Oe.value.fileName),1)]),a("div",Vw,[a("a",{href:Ze.value,target:"_blank",rel:"noopener",class:"btn-ghost inline-flex items-center gap-1.5",title:"Open in new tab"},[A(J,{name:"globe",size:14}),b[38]||(b[38]=z(" New tab ",-1))],8,Zw),a("a",{href:Ee(zr)(Oe.value.id),class:"btn-ghost inline-flex items-center gap-1.5",title:"Download"},[A(J,{name:"download",size:14}),b[39]||(b[39]=z(" Download ",-1))],8,Hw),a("button",{class:"btn-icon",title:"Close",onClick:Q},[A(J,{name:"x",size:16})])])]),a("div",jw,[Te.value==="image"?(p(),m("img",{key:0,src:Ze.value,alt:Oe.value.title,class:"mx-auto block max-w-full"},null,8,Ww)):Te.value==="frame"?(p(),m("iframe",{key:1,src:Ze.value,class:"h-[74vh] w-full border-0 bg-white",title:Oe.value.title},null,8,Kw)):(p(),m("div",Gw,[A(J,{name:"fileText",size:28,class:"text-ink-muted"}),b[41]||(b[41]=a("div",{class:"mt-3 text-sm font-medium text-ink-secondary"},"Preview isn't available for this file type",-1)),a("div",qw,w(Oe.value.fileName),1),a("a",{href:Ee(zr)(Oe.value.id),class:"btn-accent mt-4 inline-flex items-center gap-2"},[A(J,{name:"download",size:15}),b[40]||(b[40]=z(" Download instead ",-1))],8,Yw)]))])])])):I("",!0)]))]))}},Xw={class:"grid h-full grid-cols-[248px_1fr] max-[900px]:grid-cols-1"},Qw={class:"flex flex-col border-r border-line bg-surface-1 px-4 py-5 max-[900px]:hidden"},e2={class:"flex items-center gap-2.5 px-2 pb-5"},t2={class:"flex flex-col gap-0.5"},n2=["onClick"],i2={class:"mt-auto flex flex-col gap-2.5"},o2={class:"rounded-lg bg-surface-2 p-3"},s2={class:"flex items-center gap-2"},a2={class:"text-xs font-semibold text-ink"},r2={class:"mt-1.5 block font-mono text-[10.5px] text-ink-muted"},l2={class:"flex items-center gap-2.5 px-2 py-1"},u2={class:"grid h-8 w-8 place-items-center rounded-full bg-[var(--navy-800)] text-xs font-bold text-white"},c2={class:"min-w-0 flex-1"},d2={class:"truncate text-[13px] font-semibold text-ink"},f2={class:"flex items-center gap-1.5 text-[11px] text-ink-muted"},h2=["title"],p2={class:"overflow-y-auto"},m2={class:"sticky top-0 z-10 flex items-center gap-4 border-b border-line px-7 py-3.5",style:{background:"color-mix(in srgb, var(--bg-app) 82%, transparent)","backdrop-filter":"blur(10px)"}},g2={class:"mt-0.5 text-[22px] font-bold tracking-tightest text-ink"},v2={class:"ml-auto flex items-center gap-3"},_2={class:"flex h-10 w-60 items-center gap-2 rounded border border-line-strong bg-surface-1 px-3 max-[1100px]:hidden"},b2={key:0,class:"mx-auto flex max-w-[1240px] flex-col gap-5 p-7"},y2={class:"grid grid-cols-4 gap-4 max-[1100px]:grid-cols-2 max-[560px]:grid-cols-1"},x2={class:"flex items-center justify-between"},w2={class:"eyebrow"},k2={class:"mt-2.5 text-[34px] font-bold leading-none tracking-tightest text-ink"},S2={class:"grid grid-cols-[1.6fr_1fr] gap-5 max-[1100px]:grid-cols-1"},T2={class:"panel p-5"},P2={class:"mb-3.5 flex items-center justify-between"},C2={class:"flex items-center gap-2"},L2={class:"relative z-[1200]"},A2={class:"panel absolute right-0 z-[1200] mt-1.5 w-72 p-3.5 shadow-lg"},M2={class:"flex items-center justify-between gap-3"},E2={class:"mb-1.5 flex items-center justify-between"},O2={class:"font-mono text-[11px] text-ink-muted"},z2=["value"],$2={key:0,class:"mt-1.5 text-[11px] text-ink-muted"},I2={key:0,class:"mt-2.5 text-xs text-ink-muted"},N2={key:1,class:"mt-2.5 text-xs text-ink-muted"},D2={key:2,class:"mt-2.5 text-xs text-ink-muted"},F2={class:"flex flex-col gap-5"},R2={class:"panel p-5"},B2={class:"mb-3.5 flex items-center justify-between"},U2={class:"flex items-center gap-3"},V2={class:"text-5xl leading-none"},Z2={class:"min-w-0"},H2={class:"flex items-baseline gap-1"},j2={class:"text-[34px] font-bold leading-none tracking-tightest text-ink"},W2={class:"text-lg font-semibold text-ink-secondary"},K2={class:"mt-1 truncate text-sm capitalize text-ink-secondary"},G2={class:"mt-1.5 truncate text-xs text-ink-muted"},q2={class:"mt-4 grid grid-cols-2 gap-2.5"},Y2={class:"rounded-lg bg-surface-2 px-3 py-2"},J2={class:"mt-0.5 font-mono text-sm text-ink"},X2={class:"rounded-lg bg-surface-2 px-3 py-2"},Q2={class:"mt-0.5 font-mono text-sm text-ink"},ek={class:"rounded-lg bg-surface-2 px-3 py-2"},tk={class:"mt-0.5 font-mono text-sm text-ink"},nk={key:0},ik={class:"rounded-lg bg-surface-2 px-3 py-2"},ok={class:"mt-0.5 font-mono text-sm text-ink"},sk={key:0},ak={key:0,class:"mt-3 text-[11px] text-ink-muted"},rk={key:1,class:"grid place-items-center py-8 text-center"},lk={class:"mt-0.5 text-xs text-ink-muted"},uk={key:2,class:"grid place-items-center py-8 text-center text-sm text-ink-muted"},ck={class:"panel p-5"},dk={class:"mb-3.5 flex items-center justify-between"},fk={class:"grid place-items-center py-10 text-center"},hk={class:"panel overflow-hidden p-0"},pk={class:"flex items-center justify-between px-5 py-4"},mk={class:"flex gap-2"},gk={key:0,class:"px-5 py-12 text-center text-sm text-ink-muted"},vk={key:1,class:"overflow-x-auto"},_k={class:"w-full border-collapse text-sm"},bk={class:"text-left"},yk=["onClick"],xk={class:"px-5 py-3 font-mono font-bold text-ink"},wk={class:"px-5 py-3 text-ink-secondary"},kk={class:"px-5 py-3"},Sk={class:"px-5 py-3 font-mono text-ink-secondary"},Tk={class:"px-5 py-3"},Pk={key:0,class:"flex items-center gap-2"},Ck={class:"h-1.5 w-12 overflow-hidden rounded bg-surface-2"},Lk={class:"font-mono text-xs text-ink-secondary"},Ak={key:1,class:"font-mono text-xs text-ink-muted"},Mk={class:"px-5 py-3 font-mono text-ink-secondary"},Ek={class:"px-5 py-3 text-right"},Ok=["onClick"],zk={key:1,class:"p-7"},$k={class:"mb-4 flex flex-wrap items-center gap-3"},Ik={class:"font-mono text-mode font-bold text-ink"},Nk={key:0,class:"rounded-full bg-danger-soft px-2.5 py-0.5 font-mono text-[10px] font-bold uppercase tracking-caps text-danger-fg"},Dk={key:1,class:"ml-auto flex flex-wrap gap-1.5"},Fk=["onClick"],Rk={key:0,class:"panel grid place-items-center p-16 text-center"},Bk={class:"pill"},Uk={class:"pill"},Vk={class:"pill"},Zk={class:"mt-1 text-sm font-semibold text-ink"},Hk={class:"pill"},jk={class:"mt-1 font-mono text-sm font-bold tabular text-ink"},Wk={class:"grid grid-cols-2 gap-4 max-[820px]:grid-cols-1"},Kk={class:"panel p-4"},Gk={class:"flex items-center gap-4"},qk={class:"h-9 flex-1 overflow-hidden rounded border border-line bg-surface-2"},Yk={class:"readout"},Jk={class:"panel p-4"},Xk={class:"readout"},Qk={class:"panel p-4"},eS={class:"space-y-1.5 text-sm"},tS={class:"flex justify-between"},nS={class:"text-ink"},iS={class:"flex justify-between"},oS={class:"text-ink"},sS={class:"flex justify-between"},aS={class:"font-mono tabular text-ink"},rS={class:"flex justify-between"},lS={class:"font-mono tabular text-ink"},uS={class:"panel p-4"},cS={class:"space-y-1.5 text-sm"},dS={class:"flex justify-between"},fS={class:"font-mono tabular text-ink"},hS={class:"flex justify-between"},pS={class:"font-mono tabular text-ink"},mS={class:"flex justify-between"},gS={class:"font-mono tabular text-ink"},vS={class:"panel col-span-2 p-4 max-[820px]:col-span-1"},_S={class:"panel p-4"},bS={class:"flex flex-wrap gap-2"},yS={class:"mt-2 min-h-[16px] text-xs text-ink-muted"},xS={class:"panel p-4"},wS={class:"h-[180px] overflow-y-auto font-mono text-xs"},kS={class:"text-ink-muted"},SS={class:"font-semibold text-accent"},TS={class:"break-all text-ink"},PS={key:6,class:"p-7"},CS={class:"panel grid place-items-center p-16 text-center"},LS={class:"mt-3 text-sm font-medium text-ink-secondary"},AS={key:0,class:"mt-1 text-xs text-ink-muted"},MS={key:1,class:"mt-1 text-xs text-ink-muted"},ES="34,-25,72,45",OS=600*1e3,zS={__name:"Dashboard",props:{email:{type:String,default:""},role:{type:String,default:"user"},organization:{type:String,default:""},organizationName:{type:String,default:""}},emits:["logout"],setup(t,{emit:i}){const s=t,l=i,u=gt({}),f=gt({}),h=Y(null),_=Y(!1),y=gt([]),C=Y(""),T=Y([]),M=gt({unavailable:!1,detail:"",loaded:!1,plan:"",recommendedInterval:30}),H=ce(()=>T.value.filter(U=>!U.onGround).length),j=Y(!1);let K=null;const F=[{value:"auto",label:"Auto"},{value:5,label:"5s"},{value:10,label:"10s"},{value:15,label:"15s"},{value:30,label:"30s"},{value:60,label:"60s"},{value:120,label:"120s"}],te=ce(()=>{if(be.airTrafficInterval==="auto")return M.recommendedInterval||30;const U=Number(be.airTrafficInterval);return Number.isFinite(U)&&U>0?U:30}),X=Y(null);let fe=!1;function Se(){if(!(fe||X.value!==null)){if(typeof navigator>"u"||!navigator.geolocation){X.value=!1;return}fe=!0,navigator.geolocation.getCurrentPosition(U=>{X.value={lat:U.coords.latitude,lng:U.coords.longitude},fe=!1},()=>{X.value=!1,fe=!1},{timeout:8e3,maximumAge:6e5})}}function de(U,E,Me){const tt=U&&U.telemetry||{},It=tt[E],St=tt[Me];return typeof It=="number"&&typeof St=="number"&&(It||St)?{lat:It,lng:St}:null}function Fe(){const U=de(W.value,"latitude","longitude")||S.value.map(tt=>de(u[tt],"latitude","longitude")).find(Boolean);if(U){const tt=$r(U.lat,U.lng);if(tt)return tt.bbox}const E=de(W.value,"phoneLatitude","phoneLongitude")||S.value.map(tt=>de(u[tt],"phoneLatitude","phoneLongitude")).find(Boolean);if(E){const tt=$r(E.lat,E.lng);if(tt)return tt.bbox}if(Se(),X.value){const tt=$r(X.value.lat,X.value.lng);if(tt)return tt.bbox}const Me=xm(be.region);return Me||ES}async function Oe(){if(!be.showAirTraffic)return;const U=be.autoBbox?Fe():void 0,{states:E,unavailable:Me,detail:tt,plan:It,recommendedInterval:St}=await mp(U);T.value=E,M.unavailable=Me,M.detail=tt,M.plan=It||"",St&&(M.recommendedInterval=St),M.loaded=!0}function Te(){K&&clearInterval(K),K=setInterval(()=>{Le.value==="Overview"&&be.showAirTraffic&&Oe()},te.value*1e3)}function Ze(){Oe(),Te()}function he(){K&&clearInterval(K),K=null}const Q=gt({loaded:!1,unavailable:!1,detail:"",data:null,units:"metric",source:"",updatedAt:0});let B=null;function O(){const U=de(W.value,"latitude","longitude")||S.value.map(Me=>de(u[Me],"latitude","longitude")).find(Boolean);if(U)return{lat:U.lat,lng:U.lng,source:"drone"};const E=de(W.value,"phoneLatitude","phoneLongitude")||S.value.map(Me=>de(u[Me],"phoneLatitude","phoneLongitude")).find(Boolean);return E?{lat:E.lat,lng:E.lng,source:"phone"}:X.value?{lat:X.value.lat,lng:X.value.lng,source:"browser"}:null}async function N(){const U=O(),E=await Sp(U?U.lat:void 0,U?U.lng:void 0);if(Q.loaded=!0,Q.units=E.units||"metric",E.unavailable||!E.weather){Q.unavailable=!0,Q.detail=E.detail||"Weather is unavailable.",Q.data=null;return}Q.unavailable=!1,Q.detail="",Q.data=E.weather,Q.source=U?U.source:"default",Q.updatedAt=Date.now()}function $(){B&&clearInterval(B),B=setInterval(()=>{Le.value==="Overview"&&N()},OS)}function Ye(){N(),$()}function we(){B&&clearInterval(B),B=null}const ge=ce(()=>Q.units==="imperial"?"°F":Q.units==="standard"?"K":"°C"),ue=ce(()=>Q.units==="imperial"?"mph":"m/s");function ft(U){const E=(U||"").slice(0,2);return E==="01"?(U||"").endsWith("n")?"🌙":"☀️":{"02":"🌤️","03":"⛅","04":"☁️","09":"🌧️",10:"🌦️",11:"⛈️",13:"❄️",50:"🌫️"}[E]||"🌡️"}const pe=ce(()=>ft(Q.data&&Q.data.icon)),Ue=ce(()=>{const U=Q.data;return U?U.country?`${U.location}, ${U.country}`:U.location||"Unknown location":""}),Ve=ce(()=>Q.source==="drone"?"at aircraft location":Q.source==="phone"||Q.source==="browser"?"at your location":"default location"),wt=ce(()=>Q.updatedAt?new Date(Q.updatedAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"");function st(U,E=0){return typeof U=="number"?U.toFixed(E):"—"}const Le=Y("Overview"),De=[["grid","Overview"],["radio","Live flights"],["route","Routes"],["calendar","Schedule"],["drone","Drones"],["book","Logbook"],["fileText","Documents"],["server","Drives"],["settings","Settings"]],zt=ce(()=>(De.find(([,U])=>U===Le.value)||["grid"])[0]),At=Y(""),Ut=Y(""),Pt=Y("");let kt=null,x=null,b=!1;const S=ce(()=>Object.keys(u).sort((U,E)=>(u[E].online?1:0)-(u[U].online?1:0)||U.localeCompare(E))),W=ce(()=>h.value?u[h.value]:null),V=ce(()=>W.value&&W.value.telemetry||{}),G=ce(()=>!!(W.value&&W.value.online)),re=ce(()=>{const U=V.value;return typeof U.latitude=="number"&&typeof U.longitude=="number"&&(U.latitude||U.longitude)?{lat:U.latitude,lng:U.longitude}:null}),ae=ce(()=>h.value&&f[h.value]||[]),oe=ce(()=>{const U=V.value;return typeof U.velocityX=="number"&&typeof U.velocityY=="number"?Math.hypot(U.velocityX,U.velocityY):null});function ee(U){return U.online?U.connected?["In flight","success"]:["Standby","accent"]:["Offline","neutral"]}function ve(U){const E=U&&U.telemetry||{};return typeof E.velocityX=="number"&&typeof E.velocityY=="number"?Math.hypot(E.velocityX,E.velocityY):null}const se=ce(()=>S.value.map(U=>{const E=u[U],Me=E.telemetry||{},[tt,It]=ee(E);return{id:U,mission:E.model||(E.connected?"Drone linked":E.online?"App online":"No signal"),status:tt,tone:It,alt:typeof Me.altitude=="number"?Me.altitude.toFixed(0)+" m":"—",battery:typeof Me.batteryPercent=="number"?Me.batteryPercent:null,speed:ve(E)}})),ke=ce(()=>S.value.map(U=>u[U].connected?u[U].flightControllerSerial:"").filter(Boolean)),Pe=ce(()=>S.value.filter(U=>u[U].online).length),Re=ce(()=>S.value.filter(U=>u[U].online&&u[U].connected).length),Ke=ce(()=>S.value.filter(U=>!u[U].online).length),Ge=ce(()=>{const U=S.value.map(E=>{var Me;return(Me=u[E].telemetry)==null?void 0:Me.batteryPercent}).filter(E=>typeof E=="number");return U.length?Math.round(U.reduce((E,Me)=>E+Me,0)/U.length):null}),pt=ce(()=>[{label:"Active flights",value:String(Re.value),delta:`${Pe.value} online`,tone:"success",icon:"radio"},{label:"Avg battery",value:Ge.value==null?"—":Ge.value+"%",delta:Ge.value==null?"no telemetry":Ge.value<40?"low — watch":"nominal",tone:Ge.value!=null&&Ge.value<40?"danger":"neutral",icon:"battery"},{label:"Fleet size",value:String(S.value.length),delta:`${Re.value} in flight`,tone:"neutral",icon:"grid"},{label:"Offline",value:String(Ke.value),delta:Ke.value?"needs attention":"all reachable",tone:Ke.value?"warning":"success",icon:"signal"}]),ht={success:"bg-success-soft text-success-fg",warning:"bg-amber-soft text-amber-fg",danger:"bg-danger-soft text-danger-fg",accent:"bg-accent-soft text-accent-soft-fg",neutral:"bg-surface-2 text-ink-secondary"},Vt={success:"text-success-fg",danger:"text-danger-fg",warning:"text-amber-fg",neutral:"text-ink-muted",accent:"text-accent-soft-fg"},Jt=ce(()=>{var Me,tt,It;const E=(s.email||"PV").split("@")[0].split(/[.\-_ ]+/).filter(Boolean);return((((Me=E[0])==null?void 0:Me[0])||"P")+(((tt=E[1])==null?void 0:tt[0])||((It=E[0])==null?void 0:It[1])||"V")).toUpperCase()}),Zt={superadmin:"Superadmin",admin:"Admin",user:"Operator"},pn=ce(()=>Zt[s.role]||"Operator"),Ct=ce(()=>s.organizationName||(s.role==="superadmin"?"All organizations":"No organization")),$t=new Set,kn=Y(null);async function zi(U){var It,St,Et;if(!U.connected||!U.flightControllerSerial)return;const E={flightControllerSerial:U.flightControllerSerial,model:U.model||"",firmware:U.firmware||"",controllerFirmware:U.controllerFirmware||""},Me=[E.flightControllerSerial,E.model,E.firmware,E.controllerFirmware].join("|");if($t.has(Me))return;$t.add(Me);const tt=await Pp(E);if(!tt.ok){(tt.status===0||tt.status>=500)&&$t.delete(Me);return}((It=tt.body)!=null&&It.created||(St=tt.body)!=null&&St.updated)&&((Et=kn.value)==null||Et.reload())}function at(U){if(U)for(const E of $t)E.startsWith(`${U}|`)&&$t.delete(E)}function Sn(U){var Me;u[U.deviceId]=U,zi(U);const E=U.telemetry||{};typeof E.latitude=="number"&&typeof E.longitude=="number"&&(E.latitude||E.longitude)&&(f[U.deviceId]||(f[U.deviceId]=[]),f[U.deviceId].push([E.latitude,E.longitude]),f[U.deviceId].length>1e3&&f[U.deviceId].shift()),(!h.value||U.online&&!((Me=u[h.value])!=null&&Me.online))&&(h.value=U.deviceId)}function $i(U){delete u[U],delete f[U],h.value===U&&(h.value=S.value[0]||null)}function rt(U){y.unshift({t:ku(Date.now()),tag:U.type||"?",text:JSON.stringify(hi(U))}),y.length>200&&y.pop()}function hi(U){const E={...U};return delete E.type,E}function pi(){const U=location.protocol==="https:"?"wss":"ws";kt=new WebSocket(`${U}://${location.host}/bff/ws`),kt.onopen=()=>_.value=!0,kt.onclose=()=>{_.value=!1,b||(x=setTimeout(pi,1500))},kt.onerror=()=>kt&&kt.close(),kt.onmessage=E=>{let Me;try{Me=JSON.parse(E.data)}catch{return}Me.type==="snapshot"?(Me.devices||[]).forEach(Sn):Me.type==="update"&&Me.device?(Sn(Me.device),Me.event&&Me.device.deviceId===h.value&&rt(Me.event)):Me.type==="removed"&&Me.deviceId&&$i(Me.deviceId)}}async function Ii(){if(!h.value)return Pt.value="No device selected.";if(!At.value.trim())return Pt.value="Enter a command name.";let U;if(Ut.value.trim())try{U=JSON.parse(Ut.value)}catch{return Pt.value="Payload is not valid JSON."}const{ok:E,body:Me}=await Rp(h.value,At.value.trim(),U);Pt.value=E?`Sent "${At.value.trim()}".`:`Error: ${Me.error||"failed"}`}function Gt(U,E,Me=""){return typeof U=="number"?U.toFixed(E)+Me:"—"}function jn(U){h.value=U,Le.value="Live flights"}return Bt(Le,U=>{U==="Overview"&&(Oe(),N())}),Bt(()=>be.showAirTraffic,U=>{U?Oe():T.value=[]}),Bt(te,Te),fi(async()=>{(await np()).forEach(Sn),pi(),Ze(),Ye()}),us(()=>{b=!0,x&&clearTimeout(x),kt&&kt.close(),he(),we()}),(U,E)=>{var Me,tt,It,St,Et;return p(),m("div",Xw,[a("aside",Qw,[a("div",e2,[A(nd,{size:26}),E[11]||(E[11]=a("span",{class:"text-[19px] tracking-tightest"},[a("span",{class:"font-medium text-ink-secondary"},"Pilot"),a("span",{class:"font-bold text-ink"},"Vault")],-1))]),a("nav",t2,[(p(),m(le,null,Ie(De,([Z,_t])=>a("button",{key:_t,class:Ce(["flex items-center gap-3 rounded px-3 py-2.5 text-left text-sm transition",Le.value===_t?"bg-accent-soft font-semibold text-accent-soft-fg":"font-medium text-ink-secondary hover:bg-surface-2"]),onClick:bt=>Le.value=_t},[A(J,{name:Z,size:18,stroke:Le.value===_t?2.2:1.8},null,8,["name","stroke"]),z(" "+w(_t),1)],10,n2)),64))]),a("div",i2,[a("div",o2,[a("div",s2,[a("span",{class:Ce(["h-2 w-2 rounded-full",_.value?"bg-ready":"bg-caution"])},null,2),a("span",a2,w(_.value?"Link healthy":"Reconnecting…"),1)]),a("span",r2,"API gateway · "+w(_.value?"streaming":"retrying"),1)]),a("div",l2,[a("div",u2,w(Jt.value),1),a("div",c2,[a("div",d2,w(t.email||"Operator"),1),a("div",f2,[A(J,{name:"grid",size:11,class:"shrink-0"}),a("span",{class:"truncate",title:`${pn.value} · ${Ct.value}`},w(pn.value)+" · "+w(Ct.value),9,h2)])]),a("button",{class:"text-ink-muted transition hover:text-ink",title:"Log out","aria-label":"Log out",onClick:E[0]||(E[0]=Z=>l("logout"))},[A(J,{name:"logout",size:16})])])])]),a("main",p2,[a("header",m2,[a("div",null,[E[12]||(E[12]=a("div",{class:"eyebrow"},"Live operations",-1)),a("h1",g2,w(Le.value),1)]),a("div",v2,[a("div",_2,[A(J,{name:"search",size:16,class:"text-ink-muted"}),ie(a("input",{"onUpdate:modelValue":E[1]||(E[1]=Z=>C.value=Z),placeholder:"Search drones, routes…",class:"w-full border-none bg-transparent text-sm text-ink outline-none placeholder:text-ink-muted"},null,512),[[me,C.value]])]),a("button",{class:"btn-accent flex items-center gap-2",onClick:E[2]||(E[2]=Z=>Le.value="Live flights")},[A(J,{name:"radio",size:16}),E[13]||(E[13]=z(" Live flights ",-1))])])]),Le.value==="Overview"?(p(),m("div",b2,[a("div",y2,[(p(!0),m(le,null,Ie(pt.value,Z=>(p(),m("div",{key:Z.label,class:"panel p-5"},[a("div",x2,[a("span",w2,w(Z.label),1),A(J,{name:Z.icon,size:16,class:"text-ink-muted"},null,8,["name"])]),a("div",k2,w(Z.value),1),a("span",{class:Ce(["mt-2 block font-mono text-[11px]",Vt[Z.tone]])},w(Z.delta),3)]))),128))]),a("div",S2,[a("div",T2,[a("div",P2,[E[18]||(E[18]=a("div",null,[a("div",{class:"eyebrow"},"Airspace"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Live map")],-1)),a("div",C2,[Ee(be).showAirTraffic&&H.value?(p(),m("span",{key:0,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",ht.accent]),title:"Live aircraft from OpenSky Network"},[A(J,{name:"radio",size:12}),z(w(H.value)+" aircraft ",1)],2)):I("",!0),Re.value?(p(),m("span",{key:1,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",ht.success])},[E[14]||(E[14]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Re.value)+" drones ",1)],2)):I("",!0),a("div",L2,[a("button",{type:"button",class:Ce(["grid h-7 w-7 place-items-center rounded-md text-ink-muted transition hover:bg-surface-2 hover:text-ink",j.value?"bg-surface-2 text-ink":""]),title:"Map settings","aria-label":"Map settings",onClick:E[3]||(E[3]=Z=>j.value=!j.value)},[A(J,{name:"settings",size:16})],2),j.value?(p(),m(le,{key:0},[a("div",{class:"fixed inset-0 z-[1190]",onClick:E[4]||(E[4]=Z=>j.value=!1)}),a("div",A2,[E[17]||(E[17]=a("div",{class:"eyebrow mb-2.5"},"Map settings",-1)),a("label",M2,[E[15]||(E[15]=a("span",{class:"text-sm text-ink-secondary"},"Show live air traffic",-1)),A(nn,{modelValue:Ee(be).showAirTraffic,"onUpdate:modelValue":E[5]||(E[5]=Z=>Ee(be).showAirTraffic=Z)},null,8,["modelValue"])]),a("div",{class:Ce(["mt-3.5",Ee(be).showAirTraffic?"":"pointer-events-none opacity-40"])},[a("div",E2,[E[16]||(E[16]=a("span",{class:"text-sm text-ink-secondary"},"Refresh interval",-1)),a("span",O2,"every "+w(te.value)+"s",1)]),ie(a("select",{"onUpdate:modelValue":E[6]||(E[6]=Z=>Ee(be).airTrafficInterval=Z),class:"field"},[(p(),m(le,null,Ie(F,Z=>a("option",{key:Z.value,value:Z.value},w(Z.label)+w(Z.value==="auto"?` (plan: ${M.recommendedInterval}s)`:""),9,z2)),64))],512),[[Ot,Ee(be).airTrafficInterval]]),M.plan?(p(),m("p",$2," OpenSky plan: "+w(M.plan),1)):I("",!0)],2)])],64)):I("",!0)])])]),A(Cu,{position:re.value,trail:ae.value,aircraft:Ee(be).showAirTraffic?T.value:[]},null,8,["position","trail","aircraft"]),Ee(be).showAirTraffic?M.loaded&&M.unavailable?(p(),m("p",N2,w(M.detail||"Live air traffic is unavailable."),1)):(p(),m("p",D2," Live air traffic from OpenSky Network · updates every "+w(te.value)+"s ",1)):(p(),m("p",I2," Live air traffic hidden · enable it in Map settings "))]),a("div",F2,[a("div",R2,[a("div",B2,[E[19]||(E[19]=a("div",null,[a("div",{class:"eyebrow"},"Conditions"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Weather")],-1)),A(J,{name:"sun",size:16,class:"text-ink-muted"})]),Q.data?(p(),m(le,{key:0},[a("div",U2,[a("div",V2,w(pe.value),1),a("div",Z2,[a("div",H2,[a("span",j2,w(st(Q.data.temp)),1),a("span",W2,w(ge.value),1)]),a("div",K2,w(Q.data.description||"—"),1)])]),a("div",G2,w(Ue.value)+" · "+w(Ve.value),1),a("div",q2,[a("div",Y2,[E[20]||(E[20]=a("div",{class:"eyebrow"},"Feels like",-1)),a("div",J2,w(st(Q.data.feelsLike))+w(ge.value),1)]),a("div",X2,[E[21]||(E[21]=a("div",{class:"eyebrow"},"Wind",-1)),a("div",Q2,w(st(Q.data.windSpeed,1))+" "+w(ue.value),1)]),a("div",ek,[E[22]||(E[22]=a("div",{class:"eyebrow"},"Humidity",-1)),a("div",tk,[z(w(st(Q.data.humidity)),1),Q.data.humidity!=null?(p(),m("span",nk,"%")):I("",!0)])]),a("div",ik,[E[23]||(E[23]=a("div",{class:"eyebrow"},"Cloud cover",-1)),a("div",ok,[z(w(st(Q.data.clouds)),1),Q.data.clouds!=null?(p(),m("span",sk,"%")):I("",!0)])])]),wt.value?(p(),m("div",ak,"Updated "+w(wt.value)+" · OpenWeather",1)):I("",!0)],64)):Q.loaded&&Q.unavailable?(p(),m("div",rk,[A(J,{name:"sun",size:24,class:"text-ink-muted"}),E[24]||(E[24]=a("div",{class:"mt-2 text-sm font-medium text-ink-secondary"},"Weather unavailable",-1)),a("div",lk,w(Q.detail),1)])):(p(),m("div",uk," Loading weather… "))]),a("div",ck,[a("div",dk,[E[25]||(E[25]=a("div",null,[a("div",{class:"eyebrow"},"Today"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Schedule")],-1)),A(J,{name:"clock",size:16,class:"text-ink-muted"})]),a("div",fk,[A(J,{name:"calendar",size:24,class:"text-ink-muted"}),E[26]||(E[26]=a("div",{class:"mt-2 text-sm font-medium text-ink-secondary"},"No missions scheduled",-1)),E[27]||(E[27]=a("div",{class:"mt-0.5 text-xs text-ink-muted"},"Scheduling is not wired to a backend yet.",-1))])])])]),a("div",hk,[a("div",pk,[E[30]||(E[30]=a("div",null,[a("div",{class:"eyebrow"},"Fleet"),a("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Aircraft status")],-1)),a("div",mk,[a("span",{class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",ht.success])},[E[28]||(E[28]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Re.value)+" in flight ",1)],2),Ke.value?(p(),m("span",{key:0,class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",ht.warning])},[E[29]||(E[29]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Ke.value)+" offline ",1)],2)):I("",!0)])]),se.value.length?(p(),m("div",vk,[a("table",_k,[a("thead",null,[a("tr",bk,[(p(),m(le,null,Ie(["Aircraft","Mission","Status","Alt","Battery","Speed",""],Z=>a("th",{key:Z,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},w(Z),1)),64))])]),a("tbody",null,[(p(!0),m(le,null,Ie(se.value,(Z,_t)=>(p(),m("tr",{key:Z.id,class:Ce(["cursor-pointer transition hover:bg-surface-2",_tjn(Z.id)},[a("td",xk,w(Z.id),1),a("td",wk,w(Z.mission),1),a("td",kk,[a("span",{class:Ce(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",ht[Z.tone]])},[E[31]||(E[31]=a("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),z(w(Z.status),1)],2)]),a("td",Sk,w(Z.alt),1),a("td",Tk,[Z.battery!=null?(p(),m("div",Pk,[a("div",Ck,[a("div",{class:Ce(["h-full",Z.battery<40?"bg-caution":"bg-ready"]),style:Eo({width:Z.battery+"%"})},null,6)]),a("span",Lk,w(Z.battery)+"%",1)])):(p(),m("span",Ak,"—"))]),a("td",Mk,[z(w(Z.speed==null?"—":Z.speed.toFixed(1))+" ",1),E[32]||(E[32]=a("span",{class:"text-ink-muted"},"m/s",-1))]),a("td",Ek,[a("button",{class:"btn-ghost inline-flex items-center gap-1.5 whitespace-nowrap",onClick:hl(bt=>jn(Z.id),["stop"])},[A(J,{name:"play",size:14}),E[33]||(E[33]=z(" Track ",-1))],8,Ok)])],10,yk))),128))])])])):(p(),m("div",gk," No aircraft connected yet. Devices appear here as they come online. "))])])):Le.value==="Live flights"?(p(),m("div",zk,[a("div",$k,[a("span",Ik,w(h.value||"No device selected"),1),W.value&&!G.value?(p(),m("span",Nk,"Offline")):I("",!0),S.value.length?(p(),m("div",Dk,[(p(!0),m(le,null,Ie(S.value,Z=>(p(),m("button",{key:Z,class:Ce(["flex items-center gap-2 rounded border px-3 py-1.5 font-mono text-xs font-bold transition",Z===h.value?"border-accent bg-accent-soft text-accent-soft-fg":"border-line bg-surface-1 text-ink-secondary hover:border-line-strong"]),onClick:_t=>h.value=Z},[a("span",{class:Ce(["h-2 w-2 rounded-full",u[Z].online?"bg-ready":"bg-ink-muted"])},null,2),z(" "+w(Z),1)],10,Fk))),128))])):I("",!0)]),S.value.length?(p(),m(le,{key:1},[a("div",{class:Ce(["mb-4 grid gap-3",!G.value&&W.value?"opacity-60":""]),style:{"grid-template-columns":"repeat(auto-fit, minmax(150px, 1fr))"}},[a("div",Bk,[E[36]||(E[36]=a("div",{class:"eyebrow"},"Registration",-1)),a("div",{class:Ce(["mt-1 text-sm font-semibold",G.value?((Me=W.value)==null?void 0:Me.registration)==="success"?"text-success-fg":"text-danger-fg":"text-ink"])},w(G.value&&((tt=W.value)!=null&&tt.registration)?W.value.registration:"—"),3)]),a("div",Uk,[E[37]||(E[37]=a("div",{class:"eyebrow"},"Drone link",-1)),a("div",{class:Ce(["mt-1 text-sm font-semibold",G.value?(It=W.value)!=null&&It.connected?"text-success-fg":"text-danger-fg":"text-ink"])},w(W.value?G.value?W.value.connected?"connected":"no drone":"app offline":"—"),3)]),a("div",Vk,[E[38]||(E[38]=a("div",{class:"eyebrow"},"Model",-1)),a("div",Zk,w(((St=W.value)==null?void 0:St.model)||"—"),1)]),a("div",Hk,[E[39]||(E[39]=a("div",{class:"eyebrow"},"Last update",-1)),a("div",jk,w((Et=W.value)!=null&&Et.lastSeenMs?Ee(ku)(W.value.lastSeenMs):"—"),1)])],2),a("div",Wk,[a("div",Kk,[E[41]||(E[41]=a("div",{class:"mb-3 eyebrow"},"Battery",-1)),a("div",Gk,[a("div",qk,[a("div",{class:Ce(["h-full transition-all",typeof V.value.batteryPercent=="number"?V.value.batteryPercent<20?"bg-warning":V.value.batteryPercent<40?"bg-caution":"bg-ready":""]),style:Eo({width:(typeof V.value.batteryPercent=="number"?V.value.batteryPercent:0)+"%"})},null,6)]),a("div",Yk,[z(w(typeof V.value.batteryPercent=="number"?V.value.batteryPercent:"—"),1),E[40]||(E[40]=a("span",{class:"text-sm text-ink-secondary"},"%",-1))])])]),a("div",Jk,[E[43]||(E[43]=a("div",{class:"mb-3 eyebrow"},"Altitude",-1)),a("div",Xk,[z(w(Gt(V.value.altitude,1)),1),E[42]||(E[42]=a("span",{class:"text-sm text-ink-secondary"}," m",-1))])]),a("div",Qk,[E[48]||(E[48]=a("div",{class:"mb-3 eyebrow"},"Flight",-1)),a("div",eS,[a("div",tS,[E[44]||(E[44]=a("span",{class:"text-ink-secondary"},"Mode",-1)),a("b",nS,w(V.value.flightMode||"—"),1)]),a("div",iS,[E[45]||(E[45]=a("span",{class:"text-ink-secondary"},"Flying",-1)),a("b",oS,w(V.value.isFlying==null?"—":V.value.isFlying?"yes":"no"),1)]),a("div",sS,[E[46]||(E[46]=a("span",{class:"text-ink-secondary"},"GPS sats",-1)),a("b",aS,w(V.value.satelliteCount==null?"—":V.value.satelliteCount),1)]),a("div",rS,[E[47]||(E[47]=a("span",{class:"text-ink-secondary"},"Speed (H)",-1)),a("b",lS,w(oe.value==null?"—":Gt(oe.value,2," m/s")),1)])])]),a("div",uS,[E[52]||(E[52]=a("div",{class:"mb-3 eyebrow"},"Position",-1)),a("div",cS,[a("div",dS,[E[49]||(E[49]=a("span",{class:"text-ink-secondary"},"Latitude",-1)),a("b",fS,w(Gt(V.value.latitude,6)),1)]),a("div",hS,[E[50]||(E[50]=a("span",{class:"text-ink-secondary"},"Longitude",-1)),a("b",pS,w(Gt(V.value.longitude,6)),1)]),a("div",mS,[E[51]||(E[51]=a("span",{class:"text-ink-secondary"},"Vert. speed",-1)),a("b",gS,w(Gt(typeof V.value.velocityZ=="number"?-V.value.velocityZ:void 0,2," m/s")),1)])])]),a("div",vS,[E[53]||(E[53]=a("div",{class:"mb-3 eyebrow"},"Track",-1)),A(Cu,{position:re.value,trail:ae.value},null,8,["position","trail"])]),a("div",_S,[E[54]||(E[54]=a("div",{class:"mb-3 eyebrow"},"Send command",-1)),a("div",bS,[ie(a("input",{"onUpdate:modelValue":E[7]||(E[7]=Z=>At.value=Z),class:"field flex-1",placeholder:"command (e.g. startConnection)"},null,512),[[me,At.value]]),ie(a("input",{"onUpdate:modelValue":E[8]||(E[8]=Z=>Ut.value=Z),class:"field flex-1",placeholder:"payload JSON (optional)"},null,512),[[me,Ut.value]]),a("button",{class:"btn-accent",onClick:Ii},"Send")]),a("div",yS,w(Pt.value),1)]),a("div",xS,[E[55]||(E[55]=a("div",{class:"mb-3 eyebrow"},"Event log",-1)),a("div",wS,[(p(!0),m(le,null,Ie(y,(Z,_t)=>(p(),m("div",{key:_t,class:"border-b border-line py-1"},[a("span",kS,w(Z.t),1),a("span",SS,w(Z.tag),1),a("span",TS,w(Z.text),1)]))),128))])])])],64)):(p(),m("div",Rk,[A(J,{name:"radio",size:28,class:"text-ink-muted"}),E[34]||(E[34]=a("div",{class:"mt-3 text-sm font-medium text-ink-secondary"},"No aircraft online",-1)),E[35]||(E[35]=a("div",{class:"mt-1 text-xs text-ink-muted"},"Live telemetry appears here once a drone connects.",-1))]))])):Le.value==="Logbook"?(p(),nt(gx,{key:2,email:t.email,role:t.role,organization:t.organization,"organization-name":t.organizationName},null,8,["email","role","organization","organization-name"])):Le.value==="Drones"?(p(),nt(f0,{key:3,ref_key:"dronesView",ref:kn,"connected-fc-serials":ke.value,onDeleted:at},null,8,["connected-fc-serials"])):Le.value==="Documents"?(p(),nt(Jw,{key:4,email:t.email,role:t.role,organization:t.organization,"organization-name":t.organizationName},null,8,["email","role","organization","organization-name"])):Le.value==="Settings"?(p(),nt(ey,{key:5,email:t.email,role:t.role,organization:t.organization,"organization-name":t.organizationName,onLogout:E[9]||(E[9]=Z=>l("logout"))},null,8,["email","role","organization","organization-name"])):(p(),m("div",PS,[a("div",CS,[A(J,{name:zt.value,size:28,class:"text-ink-muted"},null,8,["name"]),a("div",LS,w(Le.value),1),Le.value==="Drives"?(p(),m("div",AS,[E[56]||(E[56]=z(" Browse and transfer files here once a drive is connected. Configure drives in ",-1)),a("button",{class:"font-semibold text-accent hover:underline",onClick:E[10]||(E[10]=Z=>Le.value="Settings")},"Settings → Integrations"),E[57]||(E[57]=z(". ",-1))])):(p(),m("div",MS,"This section is part of the console shell and has no backend yet."))])]))])])}}},$S={key:0,class:"h-full"},IS={key:1,class:"grid h-full place-items-center text-ink-muted text-sm"},NS={__name:"App",setup(t){const i=Y(!1),s=Y(null),l=Y("user"),u=Y(""),f=Y(""),h=Y("");function _(T){l.value=T&&T.role||"user",u.value=T&&T.organization||"",f.value=T&&T.organizationName||""}fi(async()=>{h.value=(await Qh()).apiBase||"";const T=await _u();T&&(s.value=T.email,_(T),await Tu()),i.value=!0});async function y(T){s.value=T,_(await _u()),await Tu()}async function C(){Hp(),await tp(),s.value=null,l.value="user",u.value="",f.value=""}return(T,M)=>i.value?(p(),m("div",$S,[s.value?(p(),nt(zS,{key:0,email:s.value,role:l.value,organization:u.value,"organization-name":f.value,onLogout:C},null,8,["email","role","organization","organization-name"])):(p(),nt(rm,{key:1,"default-api-base":h.value,onSignedIn:y},null,8,["default-api-base"]))])):(p(),m("div",IS,"Loading…"))}};qh(NS).mount("#app"); diff --git a/Web App/server/dist/index.html b/Web App/server/dist/index.html index 7704325..d6331cc 100644 --- a/Web App/server/dist/index.html +++ b/Web App/server/dist/index.html @@ -35,8 +35,8 @@ })() PilotVault — Control Panel - - + +
diff --git a/Web App/web/src/api.js b/Web App/web/src/api.js index 31ae00e..e297258 100644 --- a/Web App/web/src/api.js +++ b/Web App/web/src/api.js @@ -346,9 +346,10 @@ export async function createDrone(drone) { return { ok: r.ok, status: r.status, body: await r.json().catch(() => ({})) } } -// Upsert the drone a connected device just reported, keyed by serial. Safe to -// call on every connection event: the server refreshes an existing entry rather -// than duplicating it, and answers { created, updated }. +// Upsert the drone a connected device just reported, keyed by the flight +// controller's serial (the only one an aircraft reports). Safe to call on every +// connection event: the server refreshes an existing entry rather than +// duplicating it, and answers { created, updated }. export async function autoAddDrone(identity) { try { const r = await fetch('/bff/drones/auto', { diff --git a/Web App/web/src/components/Dashboard.vue b/Web App/web/src/components/Dashboard.vue index 87c854e..cbbc28d 100644 --- a/Web App/web/src/components/Dashboard.vue +++ b/Web App/web/src/components/Dashboard.vue @@ -311,10 +311,15 @@ const fleet = computed(() => }), ) -// Serials of aircraft connected right now — lets the Drones section flag which -// fleet entry is the drone in front of the pilot. -const connectedSerials = computed(() => - ids.value.map((id) => (devices[id].connected ? devices[id].serial : '')).filter(Boolean), +// Flight-controller serials of aircraft connected right now — lets the Drones +// section flag which fleet entry is the drone in front of the pilot. Keyed on +// the flight controller's serial because that is the only one an aircraft +// reports; the airframe serial on a fleet entry is hand-entered and no connected +// device ever knows it. +const connectedFcSerials = computed(() => + ids.value + .map((id) => (devices[id].connected ? devices[id].flightControllerSerial : '')) + .filter(Boolean), ) const onlineCount = computed(() => ids.value.filter((id) => devices[id].online).length) const flyingCount = computed(() => @@ -391,9 +396,10 @@ const orgLabel = computed( /* ---------- fleet auto-registration ---------- */ // Connecting a drone in the Fly App should be enough to get it into the pilot's -// fleet — nobody wants to retype a serial off an airframe. Every device update -// carrying a connected aircraft's serial is offered to the server, which upserts -// on serial (see POST /api/drones/auto). +// fleet — nobody wants to retype an airframe's identity. Every device update +// carrying a connected aircraft's flight-controller serial is offered to the +// server, which upserts on it (see POST /api/drones/auto). The airframe serial +// is not part of this: the SDK cannot read it, so the pilot enters it by hand. // // upsert() runs on every telemetry frame, so the identity tuple is remembered // and only a *change* is sent: without that this would fire a request per frame. @@ -404,14 +410,19 @@ const sentIdentities = new Set() const dronesView = ref(null) async function autoRegister(d) { - if (!d.connected || !d.serial) return + if (!d.connected || !d.flightControllerSerial) return const identity = { - serial: d.serial, + flightControllerSerial: d.flightControllerSerial, model: d.model || '', firmware: d.firmware || '', controllerFirmware: d.controllerFirmware || '', } - const key = [identity.serial, identity.model, identity.firmware, identity.controllerFirmware].join('|') + const key = [ + identity.flightControllerSerial, + identity.model, + identity.firmware, + identity.controllerFirmware, + ].join('|') if (sentIdentities.has(key)) return sentIdentities.add(key) @@ -432,10 +443,10 @@ async function autoRegister(d) { // A drone deleted from the fleet must be able to come back: without this, its // identity tuple stays in sentIdentities and every later event short-circuits, // so a drone deleted while connected would not reappear until a page reload. -function forgetIdentity(serial) { - if (!serial) return +function forgetIdentity(fcSerial) { + if (!fcSerial) return for (const key of sentIdentities) { - if (key.startsWith(`${serial}|`)) sentIdentities.delete(key) + if (key.startsWith(`${fcSerial}|`)) sentIdentities.delete(key) } } @@ -1046,7 +1057,7 @@ onBeforeUnmount(() => { - diff --git a/Web App/web/src/components/Drones.vue b/Web App/web/src/components/Drones.vue index 0c20e49..f61eaec 100644 --- a/Web App/web/src/components/Drones.vue +++ b/Web App/web/src/components/Drones.vue @@ -6,9 +6,10 @@ import { getDrones, createDrone, updateDrone, deleteDrone } from '../api.js' // Org/role scoping is enforced server-side, so this component needs no identity // of its own — only which aircraft are connected right now. const props = defineProps({ - // Serials of the aircraft currently connected to a device, so the fleet can - // show which entry is the drone in front of the pilot right now. - connectedSerials: { type: Array, default: () => [] }, + // Flight-controller serials of the aircraft currently connected to a device, so + // the fleet can show which entry is the drone in front of the pilot right now. + // Not the airframe serials: a connected aircraft cannot report one. + connectedFcSerials: { type: Array, default: () => [] }, }) // Deleting a drone has to reach the auto-registration bookkeeping in Dashboard, @@ -41,9 +42,9 @@ async function loadAll() { onMounted(loadAll) defineExpose({ reload: loadAll }) -const connected = computed(() => new Set(props.connectedSerials.filter(Boolean))) +const connected = computed(() => new Set(props.connectedFcSerials.filter(Boolean))) function isConnected(d) { - return !!d.serial && connected.value.has(d.serial) + return !!d.flightControllerSerial && connected.value.has(d.flightControllerSerial) } /* ---------------- drone form ---------------- */ @@ -51,7 +52,8 @@ function isConnected(d) { const C_CLASSES = ['', 'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6'] function blankDrone() { return { - name: '', model: '', serial: '', firmware: '', controllerFirmware: '', + name: '', model: '', serial: '', flightControllerSerial: '', + firmware: '', controllerFirmware: '', registration: '', operatorNumber: '', mtomGrams: '', isToy: false, autologsFlights: false, cClass: '', } @@ -71,6 +73,10 @@ function newDrone() { function editDrone(d) { Object.assign(form, { name: d.name || '', model: d.model || '', serial: d.serial || '', + // Carried through untouched: the save is a whole-record write, so dropping + // this would blank the key the aircraft is recognised by on its next connect + // — and the fleet would grow a duplicate entry for the same drone. + flightControllerSerial: d.flightControllerSerial || '', firmware: d.firmware || '', controllerFirmware: d.controllerFirmware || '', registration: d.registration || '', operatorNumber: d.operatorNumber || '', mtomGrams: d.mtomGrams || '', isToy: !!d.isToy, @@ -86,7 +92,7 @@ function cancel() { } async function save() { msg.value = '' - if (!form.name.trim() && !form.model.trim() && !form.serial.trim()) { + if (!form.name.trim() && !form.model.trim() && !form.serial.trim() && !form.flightControllerSerial.trim()) { msg.value = 'Give the drone a custom name, model or serial.' return } @@ -107,7 +113,7 @@ async function removeDrone(d) { const res = await deleteDrone(d.id) confirmId.value = '' if (res.ok) { - emit('deleted', d.serial) + emit('deleted', d.flightControllerSerial) await loadAll() } else msg.value = res.body?.error || 'Could not delete the drone.' } @@ -171,12 +177,17 @@ const stats = computed(() => ({ + + From the sticker on the airframe. + + @@ -191,8 +202,9 @@ const stats = computed(() => ({

- Model, serial and both firmware versions fill themselves in when the drone connects — anything - you type here is kept as-is. + Model, flight controller SN and both firmware versions fill themselves in when the drone + connects — anything you type here is kept as-is. The serial number is the one you register the + drone under, and only you can supply it: the SDK cannot read it off the aircraft.

@@ -249,7 +261,16 @@ const stats = computed(() => ({
{{ d.model }}
no custom name yet
- {{ d.serial || '—' }} + + {{ d.serial || '—' }} + +
+ FC {{ d.flightControllerSerial }} +
+ {{ d.firmware || '—' }} {{ d.controllerFirmware || '—' }} {{ d.registration || '—' }}