@magmacomputing/tempo-plugin-geo 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,12 +5,26 @@ All notable changes to the `@magmacomputing/tempo-plugin-geo` project will be do
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [1.0.0] - 2026-09-07
8
+ ## [1.0.0] - 2026-09-08
9
+
10
+ ### Changed (Breaking Changes)
11
+ - **Consolidated `Tempo.geo` Namespace**:
12
+ - Removed loose static methods mounted directly on the `Tempo` root class (`Tempo.geoLookup`, `Tempo.resolveGeoCoordinates`, `Tempo.serverGeoLocation`, `Tempo.geoLocation`) to prevent flat base class pollution.
13
+ - All static geolocation utilities are now organized under the dedicated, immutable **`Tempo.geo`** namespace (`Tempo.geo.lookup`, `Tempo.geo.resolve`, `Tempo.geo.server`, `Tempo.geo.browser`, `Tempo.geo.stash`, `Tempo.geo.clear`, `Tempo.geo.get`, and `Tempo.geo.current`).
14
+ - Standalone tree-shakeable functions (`geoLookup`, `resolveGeoCoordinates`, `serverGeoLocation`, etc.) remain available as direct named exports from the package for tree-shaking.
15
+ - **Storage Key Scoping**:
16
+ - Standardized ambient coordinate storage on `_magma_geo_`.
9
17
 
10
18
  ### Added
19
+ - **24-Hour TTL Caching & Multi-Tenant Partitioning**:
20
+ - Added automatic 24-hour TTL caching for `Tempo.geo.lookup()` with `{ refresh: true }` cache bypass support.
21
+ - Added multi-tenant partitioning in `Tempo.geo.stash()`, `Tempo.geo.get()`, and `Tempo.geo.clear()`, scoping storage under `_magma_geo_:<tenant-id>`.
22
+ - Added `Tempo.geo.current` read-only getter to inspect active ambient coordinates snapshot.
23
+ - **Immutability Hardening**:
24
+ - The `Tempo.geo` namespace and attached utilities are recursively frozen via `deepFreeze()`.
11
25
  - **Stable Community Release**:
12
26
  - Official 1.0.0 release of `@magmacomputing/tempo-plugin-geo`.
13
- - Configured npm Trusted Publisher automation for CI/CD publishing.
27
+ - Configured npm Trusted Publisher automation for CI/CD publishing with Sigstore provenance.
14
28
 
15
29
  ## [0.1.0] - 2026-09-07
16
30
 
package/README.md CHANGED
@@ -6,50 +6,145 @@
6
6
  <a href="https://www.npmjs.com/package/@magmacomputing/tempo-plugin-geo"><img src="https://img.shields.io/npm/v/@magmacomputing/tempo-plugin-geo?style=flat-square" alt="npm version" style="display: inline-block; margin: 0 4px;"></a> <a href="https://www.npmjs.com/package/@magmacomputing/tempo"><img src="https://img.shields.io/npm/dependency-version/@magmacomputing/tempo-plugin-geo/peer/@magmacomputing/tempo?style=flat-square" alt="npm peer dependency version" style="display: inline-block; margin: 0 4px;"></a> <a href="https://www.npmjs.com/package/@magmacomputing/tempo-plugin-geo"><img src="https://img.shields.io/npm/l/@magmacomputing/tempo-plugin-geo?style=flat-square" alt="License" style="display: inline-block; margin: 0 4px;"></a> <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-Ready-blue?logo=typescript&style=flat-square" alt="TypeScript Ready" style="display: inline-block; margin: 0 4px;"></a> <a href="https://magmacomputing.github.io/magma/doc/9-plugins/geo.index.html"><img src="https://img.shields.io/badge/Docs-VitePress-brightgreen?logo=vitepress&style=flat-square" alt="Documentation" style="display: inline-block; margin: 0 4px;"></a>
7
7
  </p>
8
8
 
9
- A Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that provides IP geolocation lookup, browser hardware location services, and coordinate resolution.
9
+ A Community plugin for the [Tempo](https://github.com/magmacomputing/magma) ecosystem that provides IP geolocation lookup, browser hardware location services, coordinate normalization, and 24-hour cached coordinate stashing.
10
+
11
+ By keeping geolocation logic in this plugin, core `@magmacomputing/tempo` remains zero-network and purely deterministic.
10
12
 
11
13
  👉 **[View the full documentation on our GitHub Pages](https://magmacomputing.github.io/magma/doc/9-plugins/geo.index.html)**
12
14
 
15
+ ---
16
+
13
17
  ## Installation
14
18
 
15
19
  ```bash
16
20
  npm install @magmacomputing/tempo-plugin-geo
17
21
  ```
18
22
 
23
+ ---
24
+
19
25
  ## Usage
20
26
 
21
- ### Functional Paradigm (Tree-Shakeable)
27
+ ### 1. Fluent OOP with Namespaced `Tempo.geo`
28
+
29
+ Installing `GeoPlugin` mounts an immutable, locked-down **`Tempo.geo`** namespace onto the `Tempo` class:
22
30
 
23
31
  ```typescript
24
32
  import { Tempo } from '@magmacomputing/tempo';
25
- import { geoLookup, resolveGeoCoordinates } from '@magmacomputing/tempo-plugin-geo';
33
+ import { GeoPlugin } from '@magmacomputing/tempo-plugin-geo';
34
+
35
+ Tempo.use(GeoPlugin);
36
+
37
+ // 1. Universal Geolocation Lookup (cached for 24h)
38
+ const lookupResult = await Tempo.geo.lookup();
39
+ console.log(lookupResult.lat, lookupResult.lng, lookupResult.city);
40
+
41
+ // 2. Inspect Current Ambient / Global Coordinates
42
+ console.log(Tempo.geo.current); // { latitude: ..., longitude: ..., city: ... }
26
43
 
27
- // Automatically resolves coordinates via browser hardware GPS or server IP lookup
28
- const geo = await geoLookup();
29
- const t = new Tempo({ geo });
44
+ // 3. Force Fresh Network Lookup (bypassing 24h cache)
45
+ const fresh = await Tempo.geo.lookup({ refresh: true });
30
46
 
31
- console.log(t.geo?.latitude, t.geo?.longitude);
47
+ // 4. Enrich a Tempo Instance Asynchronously
48
+ const t = new Tempo();
49
+ const localTime = await t.geoLocate();
50
+ console.log(localTime.geo?.latitude, localTime.geo?.longitude);
32
51
  ```
33
52
 
34
- ### Fluent OOP Paradigm
53
+ ### 2. Functional Tree-Shakeable APIs
54
+
55
+ All underlying utilities can be imported as standalone tree-shakeable functions without augmenting `Tempo`:
35
56
 
36
57
  ```typescript
37
58
  import { Tempo } from '@magmacomputing/tempo';
38
- import { GeoPlugin } from '@magmacomputing/tempo-plugin-geo';
59
+ import {
60
+ geoLookup,
61
+ resolveGeoCoordinates,
62
+ stashGeo,
63
+ clearStashedGeo,
64
+ getStashedGeo,
65
+ } from '@magmacomputing/tempo-plugin-geo';
66
+
67
+ // Standalone lookup & instance creation
68
+ const coords = await geoLookup();
69
+ const t = new Tempo('2026-06-21', { geo: coords });
70
+ ```
39
71
 
40
- Tempo.use(GeoPlugin);
72
+ ---
41
73
 
42
- const t = new Tempo();
74
+ ## The `Tempo.geo` API Surface
43
75
 
44
- // Resolve coordinates asynchronously and return a new enriched Tempo instance
45
- const localTime = await t.geoLocate();
46
- console.log(localTime.geo?.latitude, localTime.geo?.longitude);
47
- ```
76
+ | Method / Property | Description |
77
+ | :--- | :--- |
78
+ | `Tempo.geo.lookup(opts?)` | Universal geolocation lookup (browser hardware GPS or server IP lookup) cached for 24h. Supports `{ refresh: true }`. |
79
+ | `Tempo.geo.resolve(input, opts?)` | Asynchronously resolves coordinates from an instance, configuration, or ambient storage cache. |
80
+ | `Tempo.geo.coerce(input)` | Pure function normalizing various coordinate formats (`lat/lng`, `latitude/longitude`, etc.) into a canonical `GeoConfig`. |
81
+ | `Tempo.geo.stash(coords, ttl?, keyOrOpts?)` | Stashes coordinates in storage with an optional custom TTL (default: 24h) and multi-tenant partitioning. |
82
+ | `Tempo.geo.clear(keyOrOpts?)` | Purges stashed coordinates from storage. |
83
+ | `Tempo.geo.get(keyOrOpts?)` | Reads stashed coordinates for the specified tenant/IP or ambient default. |
84
+ | `Tempo.geo.current` | **Read-only getter** returning the active global/ambient coordinates snapshot (`getStashedGeo() ?? Tempo.config.geo`). |
85
+ | `Tempo.geo.server(opts?)` | Low-level server-side IP geolocation handler. |
86
+ | `Tempo.geo.browser(opts?)` | Low-level browser Geolocation API handler. |
87
+
88
+ ---
89
+
90
+ ## ⚠️ Critical Operational Warnings
91
+
92
+ ### 1. Server Context vs. Client Context
93
+
94
+ > [!WARNING]
95
+ > **Ambient IP lookup on a server resolves the SERVER's location, NOT the user's location.**
96
+
97
+ - In a server environment (Node.js, Deno, Bun, Edge runtimes), calling `Tempo.geo.lookup()` without options will query the **datacenter's public outbound IP address**.
98
+ - If your server runs in AWS `us-east-1` (Virginia) and an Australian user hits your API, calling ambient `Tempo.geo.lookup()` will resolve to Virginia!
99
+ - **Best Practice for Backends**:
100
+ - Always extract the client IP from trusted reverse proxy headers (e.g., `X-Forwarded-For`, `CF-Connecting-IP`) and pass it explicitly:
101
+ ```typescript
102
+ const userCoords = await Tempo.geo.lookup({ ip: clientIp });
103
+ const userTime = new Tempo(date, { geo: userCoords });
104
+ ```
105
+ - Or receive explicit GPS/browser coordinates from the frontend client request payload.
106
+
107
+ ---
108
+
109
+ ### 2. Multi-Tenant Key Isolation
48
110
 
49
- ## Documentation
111
+ > [!CAUTION]
112
+ > **Unpartitioned ambient storage is shared. In multi-tenant environments, always use unique keys or instance-level options.**
50
113
 
51
- For full API reference and configuration options, please visit the official **[Geo Plugin Documentation ↗](https://magmacomputing.github.io/magma/doc/9-plugins/geo.index.html)**.
114
+ - Ambient storage stores coordinates under `_magma_geo_` by default.
115
+ - In a shared process or server handling requests for multiple tenants or distinct users, calling `stash()` or ambient `lookup()` without a key will cause tenants to **overwrite each other's cached coordinates**!
116
+ - **Solution A: Multi-Tenant Key Scoping**:
117
+ Pass a tenant identifier or user ID as the key:
118
+ ```typescript
119
+ // Stash coordinates partitioned for tenant A:
120
+ Tempo.geo.stash(tenantACoords, undefined, 'tenant-alpha');
121
+
122
+ // Lookup / retrieve for a specific tenant:
123
+ const coords = Tempo.geo.get('tenant-alpha');
124
+ Tempo.geo.clear('tenant-alpha');
125
+ ```
126
+ The cache automatically partitions keys under `_magma_geo_:<tenant-id>`, guaranteeing strict isolation.
127
+
128
+ - **Solution B: Instance-Level Configuration (Recommended)**:
129
+ Avoid ambient storage altogether by binding coordinates directly to `Tempo` instances:
130
+ ```typescript
131
+ const tenantTime = new Tempo(date, { geo: tenantCoords });
132
+ ```
133
+ Instance-level coordinates are completely local, immutable, and never touch shared memory or ambient caches.
134
+
135
+ ---
136
+
137
+ ## Security & Immutability
138
+
139
+ In keeping with Tempo's strict immutability principles, the `Tempo.geo` namespace is fully locked down:
140
+
141
+ - **Deeply Frozen**: The entire `Tempo.geo` namespace and its attached utilities are recursively frozen.
142
+ - **Tamper-Proof**: Protected against modification, deletion, or monkey-patching. Any attempt to reassign `Tempo.geo` or mutate its methods (e.g. `Tempo.geo.lookup = ...`) will throw a `TypeError` in strict mode.
143
+ - **Pure Instance Operations**: Instance methods like `t.geoLocate()` always return a new, enriched `Tempo` instance, preserving the immutability of the original instance.
144
+
145
+ ---
52
146
 
53
147
  ## Licensing
54
148
 
55
149
  This is a **Community** plugin. It is completely free and open-source for personal and commercial use under the MIT license.
150
+
package/dist/index.d.ts CHANGED
@@ -1,15 +1,38 @@
1
1
  import { type TempoPlugin } from '@magmacomputing/tempo/plugin/sdk';
2
- import { geoLookup, resolveGeoCoordinates, coerceGeo, getStashedGeo, type GeoLookupResult, type GeoConfig, type CoordinateInput } from '@magmacomputing/library/runtime/mapper.library.js';
2
+ import { geoLookup, resolveGeoCoordinates, coerceGeo, getStashedGeo, stashGeo, clearStashedGeo, GEO_PROPERTIES, haversineDistance, solarOffset, type GeoLookupResult, type ResolvedCoordinates, type GeoConfig, type CoordinateInput, type DistanceUnit, type SolarOffsetOptions, type SolarOffsetUnit } from '@magmacomputing/library/runtime/mapper.library.js';
3
3
  import { serverGeoLocation, serverGeoCoords, serverMapHemisphere, type ServerMapOpts, type ServerGeolocationResult } from '@magmacomputing/library/server/mapper.library.js';
4
4
  import { geoLocation } from '@magmacomputing/library/browser/mapper.library.js';
5
- export { geoLookup, resolveGeoCoordinates, coerceGeo, getStashedGeo, serverGeoLocation, serverGeoCoords, serverMapHemisphere, geoLocation, };
6
- export type { GeoLookupResult, GeoConfig, CoordinateInput, ServerMapOpts, ServerGeolocationResult, };
7
- type GeoLookupFn = typeof geoLookup;
8
- type ResolveGeoCoordinatesFn = typeof resolveGeoCoordinates;
9
- type ServerGeoLocationFn = typeof serverGeoLocation;
10
- type GeoLocationFn = typeof geoLocation;
5
+ export { geoLookup, resolveGeoCoordinates, coerceGeo, getStashedGeo, stashGeo, clearStashedGeo, GEO_PROPERTIES, haversineDistance, solarOffset, serverGeoLocation, serverGeoCoords, serverMapHemisphere, geoLocation, };
6
+ export type { GeoLookupResult, ResolvedCoordinates, GeoConfig, CoordinateInput, DistanceUnit, SolarOffsetOptions, SolarOffsetUnit, ServerMapOpts, ServerGeolocationResult, };
11
7
  /**
12
- * GeoPlugin installs geolocation lookup and coordinate resolution helpers onto Tempo.
8
+ * Cohesive static namespace for geolocation operations on Tempo.
9
+ */
10
+ export interface TempoGeoNamespace {
11
+ /** Asynchronous universal geolocation lookup (browser hardware or server IP) with 24h caching */
12
+ readonly lookup: typeof geoLookup;
13
+ /** Asynchronously resolves coordinates from an instance, config, or ambient storage */
14
+ readonly resolve: typeof resolveGeoCoordinates;
15
+ /** Coerces coordinates and configurations into a canonical GeoConfig object */
16
+ readonly coerce: typeof coerceGeo;
17
+ /** Calculates Great-Circle distance between two coordinates using Haversine formula */
18
+ readonly distance: typeof haversineDistance;
19
+ /** Calculates Natural Solar Time Offset between civil clock time and actual solar noon */
20
+ readonly solarOffset: typeof solarOffset;
21
+ /** Explicitly stashes coordinates into storage with optional TTL (default 24h) and multi-tenant partitioning */
22
+ readonly stash: typeof stashGeo;
23
+ /** Clears stashed coordinates from storage */
24
+ readonly clear: typeof clearStashedGeo;
25
+ /** Retrieves stashed coordinates from storage */
26
+ readonly get: typeof getStashedGeo;
27
+ /** Low-level server-side IP geolocation handler */
28
+ readonly server: typeof serverGeoLocation;
29
+ /** Low-level browser geolocation API handler */
30
+ readonly browser: typeof geoLocation;
31
+ /** Current ambient or global coordinates snapshot (reads getStashedGeo() ?? Tempo.config.geo) */
32
+ readonly current: GeoConfig | undefined;
33
+ }
34
+ /**
35
+ * GeoPlugin installs geolocation lookup and coordinate resolution helpers onto Tempo under the `Tempo.geo` namespace.
13
36
  */
14
37
  export declare const GeoPlugin: TempoPlugin;
15
38
  export declare const geoPlugin: TempoPlugin;
@@ -23,15 +46,17 @@ declare module '@magmacomputing/tempo' {
23
46
  /**
24
47
  * Resolves coordinates for this instance via explicit coordinates or automatic IP/hardware lookup.
25
48
  */
26
- geoLookup(opts?: Record<string, any>): Promise<{
27
- lat: number;
28
- lng: number;
29
- } | null>;
49
+ geoLookup(opts?: Record<string, any>): Promise<ResolvedCoordinates | null>;
50
+ /**
51
+ * Calculates Great-Circle distance from this instance's coordinates to target coordinates using Haversine formula.
52
+ */
53
+ geoDistance(other: any, unit?: DistanceUnit): number;
54
+ /**
55
+ * Calculates Natural Solar Time Offset between civil clock time and actual solar noon for this instance.
56
+ */
57
+ geoSolarOffset(options?: SolarOffsetOptions): number;
30
58
  }
31
59
  namespace Tempo {
32
- let geoLookup: GeoLookupFn;
33
- let resolveGeoCoordinates: ResolveGeoCoordinatesFn;
34
- let serverGeoLocation: ServerGeoLocationFn;
35
- let geoLocation: GeoLocationFn;
60
+ let geo: TempoGeoNamespace;
36
61
  }
37
62
  }
@@ -1 +1 @@
1
- "use strict";var Magma;((Magma||={}).plugins||={}).geo=(()=>{var cr=Object.create;var xe=Object.defineProperty;var ur=Object.getOwnPropertyDescriptor;var lr=Object.getOwnPropertyNames;var fr=Object.getPrototypeOf,pr=Object.prototype.hasOwnProperty;var b=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var mr=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Q=(e,t)=>{for(var r in t)xe(e,r,{get:t[r],enumerable:!0})},Se=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lr(t))!pr.call(e,i)&&i!==r&&xe(e,i,{get:()=>t[i],enumerable:!(n=ur(t,i))||n.enumerable});return e},ue=(e,t,r)=>(Se(e,t,"default"),r&&Se(r,t,"default")),yt=(e,t,r)=>(r=e!=null?cr(fr(e)):{},Se(t||!e||!e.__esModule?xe(r,"default",{value:e,enumerable:!0}):r,e)),gr=e=>Se(xe({},"__esModule",{value:!0}),e);var Ze=mr((Qr,ht)=>{"use strict";ht.exports=window.Magma.pluginSdk});var yr,hr,wr,br,Sr,xr,Tr,Or,wt,Er,bt,d,M=b(()=>{"use strict";yr=Symbol.for("$LibraryTarget"),hr=Symbol.for("$LibraryDiscover"),wr=Symbol.for("$LibraryExtensible"),br=Symbol.for("nodejs.util.inspect.custom"),Sr=Symbol.for("$LibraryLogConfig"),xr=Symbol.for("$LibraryRegistry"),Tr=Symbol.for("$LibraryRegister"),Or=Symbol.for("$LibrarySerializerRegistry"),wt=Symbol.for("$LibraryMutable"),Er=Symbol.for("$LibraryIdentity"),bt=Symbol.for("$LibraryUnwrapped"),d={$Target:yr,$Discover:hr,$Extensible:wr,$Inspect:br,$LogConfig:Sr,$Registry:xr,$Register:Tr,$SerializerRegistry:Or,$Identity:Er,$Mutable:wt,$Unwrapped:bt}});function ee(e){let t=e,r=0,n=50;for(;t;){let i=t[d.$Target];if(!i||r>=n)break;t=i,r++}return t}function E(e,t=!1){if(!e||typeof e!="object")return[];let r=ee(e);if(!t){let l=Reflect.ownKeys(r),p=[];for(let m of l){let O=Object.getOwnPropertyDescriptor(r,m);O&&O.enumerable&&p.push([m,r[m]])}return p}let n=[],i=50,o=0,s=r;for(;s&&s!==Object.prototype&&o++<i;)n.push(ee(s)),s=Object.getPrototypeOf(s);let a=[],c=new Set;for(let l of n.reverse()){let p=Reflect.ownKeys(l);for(let m of p){if(c.has(m))continue;let O=Object.getOwnPropertyDescriptor(l,m);!O||!O.enumerable||(c.add(m),a.push([m,r[m]]))}}return a}function le(e,t=!1){return E(e,t).map(([r])=>r)}function St(e,t=!1){return E(e,t).map(([r,n])=>n)}function Oe(e,t,r){return t?Oe(e.map(t,r)):Array.from(new Set(e))}var F=b(()=>{"use strict";M()});var je,xt,Ee,H,z,_r,Pr,_e,A=b(()=>{"use strict";M();F();je=[],xt=e=>{if(e===null)return"Null";if(e===void 0)return"Undefined";let t=typeof e;if(t==="string")return"String";if(t==="number")return"Number";if(t==="boolean")return"Boolean";if(t==="bigint")return"BigInt";if(t==="symbol")return"Symbol";try{let r=t==="object"?ee(e):e;return Object.prototype.toString.call(r).slice(8,-1)}catch{return t==="function"?"Function":"Object"}},Ee=e=>{try{let t=e?.[Symbol.toStringTag]??e?.prototype?.[Symbol.toStringTag];if(typeof t=="string")return t}catch{}},H=(e,...t)=>{let r=e;try{r=e?.[d.$Target]??e}catch{r=e}let n=xt(r);switch(n){case"Function":try{return Pr(r)?"Class":"Function"}catch{return"Function"}case"Object":{try{if("length"in r&&Object.keys(r).every(o=>o==="length"||Number.isFinite(Number(o))))return"ArrayLike";for(let o of t){let s=o.class?.[d.$Target]??o.class;if(r===s||s&&r instanceof s)return o.type}let i=globalThis[d.$Registry]??[];for(let o of[...je,...i]){let s=o.class?.[d.$Target]??o.class;if(r===s||s&&r instanceof s)return o.type}}catch{return"Object"}return"Object"}default:return n}},z=(e,...t)=>({type:H(e,...t),value:e}),_r=/^\s*(class\s|\[native code\])/,Pr=e=>{if(typeof e!="function")return!1;let t=e?.[d.$Target]??e;if(!("prototype"in t))return!1;let r=t?.name,n=Ee(t);if(t?.[d.$Identity]||t?.prototype?.[d.$Identity]||typeof n=="string"&&n.startsWith("Temporal."))return!0;if(typeof n=="string"&&n.endsWith("Function"))return!1;if((globalThis[d.$Registry]??[]).some(o=>(o.class?.[d.$Target]??o.class)===t||r&&o.type===r||n&&o.type===n))return!0;try{let o=Function.prototype.toString.call(t);if(_r.test(o))return!0;let s=Object.getOwnPropertyDescriptor(t,"prototype");if(s&&s.writable===!1&&!Object.isFrozen(t))return!0;let a=t.prototype;if(a&&Object.getOwnPropertyNames(a).length>2)return!0}catch{return!1}return!1},_e=(e,t)=>{if(typeof e!="function")return;let r=Ee(e),n=t??r??e.name;n&&!["Object","Function",""].includes(n)&&(je.some(i=>i.class===e)||je.push({class:e,type:n}))}});var N,Pe,Ne,y,g,He,V,I,Nr,U,Tt,te,h,Y,x,w,Ie,De,$e,Z,T=b(()=>{"use strict";M();A();N=(e,...t)=>t.includes(H(e)),Pe=e=>N(e,"String","Number","BigInt","Boolean","Symbol","Undefined","Void","Null","Empty"),Ne=e=>!Pe(e),y=e=>N(e,"String"),g=e=>Number.isFinite(e),He=e=>N(e,"BigInt"),V=e=>N(e,"Array"),I=e=>N(e,"Object"),Nr=e=>N(e,"Date"),U=e=>N(e,"Symbol"),Tt=e=>N(e,"Symbol")&&Symbol.keyFor(e)!==void 0,te=e=>e!=="__proto__"&&e!=="constructor"&&e!=="prototype",h=e=>N(e,"Null","Undefined","Void","Empty"),Y=e=>N(e,"Undefined","Void","Empty"),x=e=>!h(e),w=e=>N(e,"Function","AsyncFunction","GeneratorFunction","AsyncGeneratorFunction"),Ie=e=>N(e,"Map"),De=e=>N(e,"Set"),$e=(e,t)=>N(e,"Error")&&(t?e instanceof t:!0),Z=e=>h(e)||I(e)&&Reflect.ownKeys(e).length===0||y(e)&&e.trim().length===0||typeof e=="number"&&Number.isNaN(e)||V(e)&&e.length===0||De(e)&&e.size===0||Ie(e)&&e.size===0||ArrayBuffer.isView(e)&&e.byteLength===0||Nr(e)&&Number.isNaN(e.getTime())});function Ve(e,t,r=new WeakSet){let n=t instanceof WeakSet?t:t?.skip??Ir;return Pe(e)||r.has(e)||n.has(e)||e instanceof Date||e instanceof RegExp||e instanceof Error||e instanceof Map||e instanceof Set||e instanceof Promise||e?.[Symbol.toStringTag]==="Enumify"||e[d.$Extensible]?e:(r.add(e),E(e).forEach(([i,o])=>{te(i)&&Ve(o,{skip:n},r)}),Object.freeze(e))}var _,q,Ir,fe=b(()=>{"use strict";F();T();M();_={Unknown:"unknown",Browser:"browser",WebWorker:"web-worker",NodeJS:"nodejs",Deno:"deno",GoogleAppsScript:"google-apps-script"},q=()=>{let e=globalThis;try{if(x(e.SpreadsheetApp))return{global:e,type:_.GoogleAppsScript};if(x(e.window?.document))return{global:e,type:_.Browser};if(w(e.importScripts)||x(e.WorkerGlobalScope)&&e instanceof e.WorkerGlobalScope)return{global:e,type:_.WebWorker};if(x(e.Deno))return{global:e,type:_.Deno};if(x(e.process?.versions?.node)&&e.process?.release?.name==="node")return{global:e,type:_.NodeJS}}catch{}return{global:e,type:_.Unknown}},Ir=new WeakSet});function K(e){return x(e)?w(e)?e():e:t=>w(t)?t():t}var Re,Ot=b(()=>{"use strict";F();T();A();Re=e=>{if(h(e)||!I(e))return e;let t=V(e)?[]:{};return le(e).forEach(r=>{te(r)&&(t[r]=Re(e[r]))}),t};K.stringSymbol=K();K.symbolRegExp=K();K.symbolString=K();K.stringString=K()});function Et(e){return Object.fromEntries(E(e,!0))}var _t=b(()=>{"use strict";F();A();T()});function Nt(e,t={},r=!1){let{frozen:n,lock:i,appendOnly:o,onGet:s,keys:a,bind:c,skip:l}=t,p=new Set,m,O,$=ee(e);i&&Ve($,l?{skip:l}:void 0),_e($);let J={isExtensible:f=>Reflect.isExtensible(f),getPrototypeOf:f=>Reflect.getPrototypeOf(f),setPrototypeOf:(f,u)=>{if(n)throw new TypeError("Security: Prototype mutation attempt on protected object");return Reflect.setPrototypeOf(f,u)},getOwnPropertyDescriptor:(f,u)=>{if(!(a&&!a.includes(u))){if(a){if(s&&!U(u)&&!p.has(u)){p.add(u);try{let P=s(u,f);if(x(P))return{enumerable:!0,configurable:!0,value:P}}finally{p.delete(u)}}return{enumerable:!0,configurable:!0}}return Reflect.getOwnPropertyDescriptor(f,u)}},ownKeys:f=>{if(a)return a;if(s&&!p.has(d.$Discover)){p.add(d.$Discover);try{s(d.$Discover,f)}finally{p.delete(d.$Discover)}}return Reflect.ownKeys(f)},has:(f,u)=>a?a.includes(u):Reflect.has(f,u),deleteProperty:(f,u)=>{if(n)throw new TypeError(`Cannot delete property '${String(u)}' from a protected object.`);if(o&&Reflect.has(f,u))throw new Error(`Security: Deletion attempt on protected key '${String(u)}'`);return Reflect.deleteProperty(f,u)},defineProperty:(f,u,P)=>{if(n&&!Object.isFrozen(f))throw new TypeError(`Cannot define property '${String(u)}' on a frozen object.`);if(o&&Reflect.has(f,u))throw new Error(`Security: Mutation attempt on protected key '${String(u)}'`);return Reflect.defineProperty(f,u,P)},set:(f,u,P,L)=>{if(n&&L===O)throw new TypeError(`Cannot set property '${String(u)}' on a frozen object.`);if(o){if(Array.isArray(f)&&u==="length"&&P<f.length)throw new Error("Security: Truncation attempt on protected array.");if(!(Array.isArray(f)&&u==="length")&&Reflect.has(f,u))throw new Error(`Security: Mutation attempt on protected key '${String(u)}'`)}return Reflect.set(f,u,P,L)},get:(f,u,P)=>{if(u===d.$Target)return P===O?f:void 0;if(n&&(u===d.$Inspect||u==="toJSON")){let v=Object.getOwnPropertyDescriptor(f,u);return v&&w(v.value)?v.value:(m||(m=()=>Et(f)),m)}if(a&&!a.includes(u))return;if(s&&!U(u)&&!Reflect.has(f,u)&&!p.has(u)){p.add(u);try{let v=s(u,f);if(x(v))return v}finally{p.delete(u)}}let L=Reflect.get(f,u,P);if(c&&u!=="constructor"&&w(L)){let v=Object.getOwnPropertyDescriptor(f,u);if(v&&!v.configurable&&!v.writable)return L;let ce=Pt.get(L);ce||(ce=new WeakMap,Pt.set(L,ce));let gt=ce.get(f);if(gt)return gt;let dt=L.bind(f);return ce.set(f,dt),dt}return L}};if(r){let f=Proxy.revocable($,J);return O=f.proxy,{proxy:f.proxy,revoke:f.revoke}}return O=new Proxy($,J),O}function It(e,t=!0,r=t,n=new WeakSet){return Nt(e,{frozen:t,lock:r,skip:n,bind:t})}function pe(e,t=new WeakSet){return Nt(e,{frozen:!0,lock:!0,skip:t,bind:!0})}var Pt,ve=b(()=>{"use strict";M();_t();fe();F();T();A();Pt=new WeakMap});function me(e,t=new WeakSet){return JSON.stringify(e,function(r,n){if(n===void 0)return"\0__undefined__\0";if(He(n))return`\0__bigint:${n}__\0`;if(w(n))return`function:${n.name||"anonymous"}`;if(Ne(n)){if(t.has(n))return"<Circular>";if(t.add(n),Ie(n))return`map:[${Array.from(n.entries()).map(i=>me(i,t)).sort().join(",")}]`;if(De(n))return`set:[${Array.from(n).map(i=>me(i,t)).sort().join(",")}]`}return n})}function $t(e){return function t(...r){return r.length>=e.length?e(...r):(...n)=>t(...r,...n)}}function X(e){let t=new Map;return function(...r){let n=me(this!==void 0&&this!==globalThis?[this,...r]:r);if(!t.has(n)){let i=e.apply(this,r);t.set(n,i)}return t.get(n)}}function ge(e,t){return{enumerable:!1,configurable:!1,writable:!1,value:function(...r){let n=`${String(e)},${me(r)}`,i=Dt.get(this);if(i||(i=new Map,Dt.set(this,i)),!i.has(n)){let o=t.apply(this,r);pe(o),i.set(n,o)}return i.get(n)}}}var Dt,Ae=b(()=>{"use strict";ve();T();Dt=new WeakMap});var Rt=b(()=>{"use strict"});function Dr(e,t){return Z(e)?t:C(t)}function $r(e,t){return vr(t)}function At(e){let t=encodeURI(e);return t.includes("%")&&(t=t.replace(Rr,r=>Mt[r.toUpperCase()]??decodeURI(r))),t}function vr(e){if(y(e))try{return decodeURI(e)}catch{}return e}function de(e){return!N(e,"Function","AsyncFunction","WeakMap","WeakSet","WeakRef")}function Ar(e,t){return`{"$${e}":${t}}`}function Ct(e){return C(U(e)?`${Tt(e)?"@":""}@(${e.description??""})`:e)}function Ft(e){let[t,r,n]=e.toString().match(Cr)||[null,void 0,void 0];switch(!0){case U(e):case h(t):case(x(r)&&Y(n)):return e;case x(r):return Symbol.for(n);case Y(r):default:return Symbol(n)}}function k(e){return C(e,!1)}function C(e,t=!0){let r=z(e),n=$t(Ar)(r.type);switch(r.type){case"String":return t||(t=r.value==="true"||r.value==="false"||r.value==="null"||parseFloat(r.value).toString()===r.value),t?JSON.stringify(At(r.value)):At(r.value);case"Boolean":case"Null":case"Number":return JSON.stringify(r.value);case"Void":case"Undefined":return n(JSON.stringify("void"));case"BigInt":return n(r.value.toString());case"Object":return`{${E(r.value).filter(([,o])=>de(o)).map(([o,s])=>`${Ct(o)}: ${C(s)}`).join(",")}}`;case"Array":return`[${r.value.filter(o=>de(o)).map(o=>C(o)).join(",")}]`;case"Map":{let i=Array.from(r.value.entries()).filter(([,o])=>de(o)).map(([o,s])=>`[${C(o)}, ${C(s)}]`).join(",");return n(`[${i}]`)}case"Set":{let i=Array.from(r.value.values()).filter(o=>de(o)).map(o=>C(o)).join(",");return n(`[${i}]`)}case"Symbol":return n(Ct(r.value));case"RegExp":return n(C({source:r.value.source,flags:r.value.flags}));default:{let i=r.value;switch(!0){case!de(i):return;case w(i.toJSON):return n(C(i.toJSON()));case w(i.toString):{let o=i.toString();return n(o.includes('"')?o:JSON.stringify(o))}case w(i.valueOf):return n(JSON.stringify(i.valueOf()));default:return n(JSON.stringify(i,Dr))}}}}function re(e,t){if(!y(e))return e;let r;try{r=JSON.parse(e,$r)}catch(n){return e.startsWith('"')&&e.endsWith('"')?(console.warn(`objectify.parse: -> ${e}, ${n.message}`),e):re(`"${e}"`,t)}switch(!0){case(e.startsWith("{")&&e.endsWith("}")):case(e.startsWith("[")&&e.endsWith("]")):return qe(r,t);default:return r}}function qe(e,t){return I(e)?Ye(E(e).reduce((r,[n,i])=>Object.assign(r,{[Ft(n)]:Ye(qe(i,t))}),{}),t):V(e)?St(e).map(r=>Ye(qe(r,t))):e}function Ye(e,t){if(!I(e)||le(e).length!==1)return e;let[r,n]=E(e)[0];if(!String(r).startsWith("$"))return e;let i=r.substring(1);try{switch(i){case"String":case"Boolean":case"Object":case"Array":return n;case"Number":return Number(n);case"BigInt":return BigInt(n);case"Null":return null;case"Undefined":case"Empty":case"Void":return t?.();case"Date":return new Date(n);case"RegExp":return!I(n)||!y(n.source)?e:new RegExp(n.source,n.flags);case"Symbol":return Ft(n);case"Map":return V(n)?new Map(n):e;case"Set":return V(n)?new Set(n):e;default:let o=Ce.get(r);return o?Reflect.construct(o,[n]):(console.warn(`objectify: dont know how to deserialize '${i}'`),e)}}catch{return e}}var Ce,vt,Lt,Mt,Rr,Cr,ne=b(()=>{"use strict";Ae();F();Rt();A();T();M();Ce=globalThis[d.$SerializerRegistry]??=new Map,vt=e=>{try{let t=e?.prototype?.[Symbol.toStringTag]??e?.[Symbol.toStringTag];return y(t)?t:void 0}catch{return}},Lt=(e,t)=>{let r=e.startsWith("$")?e:`$${e}`;if(Ce.has(r)){let n=Ce.get(r),i=vt(n),o=vt(t),s=n.name||i,a=t.name||o||(e.startsWith("$")?e.slice(1):e);if(n===t||n.toString()===t.toString()||!!t[d.$Identity]&&n[d.$Identity]===t[d.$Identity]||!!t[d.$Target]&&n[d.$Target]===t[d.$Target]||!!s&&!!a&&s===a)return;throw new Error(`[registerSerializable] Collision: '${r}' is already registered with ${n.name||"anonymous constructor"}`)}Ce.set(r,t)};Mt={"%20":" ","%22":'"',"%3B":";","%3C":"<","%3E":">","%5B":"[","%5D":"]","%5E":"^","%7B":"{","%7C":"|","%7D":"}"},Rr=new RegExp(Object.keys(Mt).join("|"),"gi");Cr=/^@(@)?\(([^\)]*)\)$/});var kt=b(()=>{"use strict";ne();T()});function Gt(e){if($e(e))return e;let t=new Error(I(e)&&y(e.message)?e.message:String(e));return I(e)&&(t.name=y(e.name)?e.name:"Error","code"in e&&(y(e.code)||g(e.code))&&(t.code=e.code),"stack"in e&&y(e.stack)&&(t.stack=e.stack)),t}var ro,no,Wt=b(()=>{"use strict";ne();A();T();kt();ro=BigInt(Number.MAX_SAFE_INTEGER),no=BigInt(Number.MIN_SAFE_INTEGER)});var Bt=b(()=>{"use strict";Wt();if(typeof globalThis.Temporal>"u")throw new Error("Temporal API is not available. Node 20+ with a polyfill (e.g. @js-temporal/polyfill) is highly recommended. Native Temporal is fully reliable only on Node 26+ (while Node 22 may have instabilities).");try{if(typeof Temporal.Now.zonedDateTimeISO=="function"&&typeof Temporal.Now.zonedDateTimeISO().add!="function")throw new Error("Incomplete Temporal implementation")}catch(e){let t=Gt(e);if(console.warn("Tempo: Native Temporal implementation appears incomplete. Consider loading a polyfill.",t),t.message!=="Incomplete Temporal implementation")throw t}});function Jt(){return Temporal.Now.instant()}function zt(e,t=2024){let r=Temporal.ZonedDateTime.from({year:t,month:1,day:1,hour:0,minute:0,second:0,timeZone:e}).offsetNanoseconds,n=Temporal.ZonedDateTime.from({year:t,month:7,day:1,hour:0,minute:0,second:0,timeZone:e}).offsetNanoseconds;return{jan:r,jul:n}}var Xe=b(()=>{"use strict";Bt();T()});function Fr(){return Mr().resolvedOptions()}function Le(e=Fr().timeZone){try{let{jan:t,jul:r}=zt(e),i=["Australia","Antarctica","Africa/Johannesburg","America/Argentina/Buenos_Aires","America/Sao_Paulo"].some(o=>e.startsWith(o));switch(!0){case r>t:return"north";case r<t:return"south";default:return i?"south":void 0}}catch{return}}var mo,go,Mr,yo,ho,wo,Qe=b(()=>{"use strict";Xe();Ae();T();mo=X((e,t="narrow",r="always")=>new Intl.RelativeTimeFormat(e,{style:t,numeric:r})),go=X((e,t="conjunction",r="long")=>new Intl.ListFormat(e,{type:t,style:r})),Mr=X((e,t)=>new Intl.DateTimeFormat(e,t)),yo=X((e,t)=>{try{return new Intl.PluralRules(e,t)}catch{return{select:()=>"other"}}}),ho=X((e,t)=>new Intl.NumberFormat(e,t)),wo=X((e,t)=>{try{let r=new Intl.DurationFormat(e,t);if(w(r.format))return r;throw new Error("No format method")}catch{return{format:n=>String(n)}}})});function oe(e,t,r,n,i,o){function s(P){if(P!==void 0&&typeof P!="function")throw new TypeError("Function expected");return P}for(var a=n.kind,c=a==="getter"?"get":a==="setter"?"set":"value",l=!t&&e?n.static?e:e.prototype:null,p=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),m,O=!1,$=r.length-1;$>=0;$--){var J={};for(var f in n)J[f]=f==="access"?{}:n[f];for(var f in n.access)J.access[f]=n.access[f];J.addInitializer=function(P){if(O)throw new TypeError("Cannot add initializers after decoration has completed");o.push(s(P||null))};var u=(0,r[$])(a==="accessor"?{get:p.get,set:p.set}:p[c],J);if(a==="accessor"){if(u===void 0)continue;if(u===null||typeof u!="object")throw new TypeError("Object expected");(m=s(u.get))&&(p.get=m),(m=s(u.set))&&(p.set=m),(m=s(u.init))&&i.unshift(m)}else(m=s(u))&&(a==="field"?i.unshift(m):p[c]=m)}l&&Object.defineProperty(l,n.name,p),O=!0}function ie(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0}var Me=b(()=>{"use strict"});function Ut(e,t){return Ee(e)??(Y(t)?e.name||void 0:String(t))}function Zt(e,{kind:t,name:r,addInitializer:n}){let i=Ut(e,r);if(i&&_e(e,i),t==="class")return i&&n(()=>Lt(i,e)),e;throw new Error(`@Serializable decorating unknown 'kind': ${t} (${r})`)}function se(e,t){let r=(n,i,o)=>{let s=n.prototype,a=i??Ut(n,o);if(a&&(s&&!Object.hasOwn(s,Symbol.toStringTag)&&Object.defineProperty(s,Symbol.toStringTag,{value:a,configurable:!0,writable:!1,enumerable:!1}),!n.name||n.name!==a))try{Object.defineProperty(n,"name",{value:a,configurable:!0,writable:!1,enumerable:!1})}catch{}return n};return typeof e=="function"&&t?.kind==="class"?r(e,void 0,t.name):(n,i)=>r(n,y(e)?e:void 0,i?.name)}var Fe=b(()=>{"use strict";M();ve();T();ne();A()});function G(e){return{enumerable:!1,configurable:!1,writable:!1,value:e}}function ae(e,t=!0){let n=H(this)!=="Module"&&w(this?.has)?this:Gr,i=z(e),o=Object.create(n);switch(i.type){case"Enumify":case"Object":Object.defineProperties(o,Object.getOwnPropertyDescriptors(i.value));break;case"Array":i.value.forEach((s,a)=>{if(g(s))throw new Error("Enumify: numeric keys are not supported");o[s]=a});break;default:throw new Error(`Enumify: invalid argument type: ${i.type}`)}return It(o,!0,t)}var kr,Gr,Co,Kt=b(()=>{"use strict";Me();A();T();F();ve();Fe();Ae();kr="Enumify",Gr=pe(Object.create(null,{keys:ge("keys",function(){return E(this,!0).map(([e])=>e)}),values:ge("values",function(){return E(this,!0).map(([e,t])=>t)}),entries:ge("entries",function(){return E(this,!0).map(([e,t])=>Object.freeze([e,t]))}),invert:ge("invert",function(){return Object.fromEntries(this.entries().map(([e,t])=>[t,e]))}),has:G(function(e){return this.keys().includes(e)}),count:G(function(){return this.keys().length}),includes:G(function(e){return this.values().includes(e)}),keyOf:G(function(e){return this.invert()[e]}),extend:G(function(e,t){return ae.call(this,e,t)}),forEach:G(function(e,t){this.entries().forEach((r,n)=>e.call(t,r,n,this))}),filter:G(function(e,t){return ae(this.entries().reduce((r,n,i)=>e.call(t,n,i,this)?Object.assign(r,{[n[0]]:n[1]}):r,{}))}),map:G(function(e,t){return ae(this.entries().reduce((r,n,i)=>Object.assign(r,{[n[0]]:e.call(t,n,i,this)}),{}))}),[Symbol.iterator]:G(function*(){for(let e of this.entries())yield e}),[Symbol.toStringTag]:{enumerable:!1,configurable:!1,writable:!1,value:kr}}));Co=(()=>{let e=[Zt,se("Enumify")],t,r=[],n;var i=class{static{n=this}static{let o=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;oe(null,t={value:n},e,{kind:"class",name:n.name,metadata:o},null,r),i=n=t.value,o&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),ie(n,r)}constructor(o){return ae(o)}};return i=n})()});function Wr(e,t=R.Info){return g(e)?e>=R.Off&&e<=R.Trace?e:t:y(e)?jt[e.toLowerCase()]??t:t}var R,D,jt,ke,et=b(()=>{"use strict";Me();T();Kt();M();Fe();R=ae(["Off","Error","Warn","Info","Debug","Trace"]),D={Off:"off",Log:"log",Info:"info",Warn:"warn",Debug:"debug",Trace:"trace",Error:"error"},jt={[D.Off]:R.Off,[D.Error]:R.Error,[D.Warn]:R.Warn,[D.Info]:R.Info,[D.Log]:R.Info,[D.Debug]:R.Debug,[D.Trace]:R.Trace};ke=(()=>{let e=[se("Logger")],t,r=[],n;var i=class{static{n=this}static{let o=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;oe(null,t={value:n},e,{kind:"class",name:n.name,metadata:o},null,r),i=n=t.value,o&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),ie(n,r)}#r;level;constructor(o,s=R.Info){this.#r=o.startsWith("[")?o:`[${o}]`,this.level=s}#e(o,...s){let a;if(s.length>0&&I(s[0]))try{s[0][d.$LogConfig]&&(a=s.shift())}catch{}let c=this.level;if(a){if(a.silent===!0)return;a.debug!==void 0&&(c=Wr(a.debug,c))}if(c===R.Off||(jt[o]??0)>c)return;let p=s.map(m=>{if($e(m))return m.message;if(I(m))try{let O=m.constructor?.name??"Object";if(O==="Object"){let $=Object.keys(m);return`{ ${$.slice(0,3).join(", ")}${$.length>3?`, ... (+${$.length-3} more)`:""} }`}return`[${O}]`}catch{return"[Object]"}return String(m)}).filter(m=>!Z(m)).join(" ");Z(p)||console[o](`${this.#r} ${p}`)}log=(...o)=>this.#e(D.Log,...o);info=(...o)=>this.#e(D.Info,...o);warn=(...o)=>this.#e(D.Warn,...o);debug=(...o)=>this.#e(D.Debug,...o);trace=(...o)=>this.#e(D.Trace,...o);error=(...o)=>this.#e(D.Error,...o)};return i=n})()});var Br,Vt,Ht,tt,rt,jo,Yt=b(()=>{"use strict";ne();fe();T();Br=q(),Vt=()=>{let e=new Map;return{get length(){return e.size},clear:()=>e.clear(),getItem:t=>e.get(t)??null,key:t=>Array.from(e.keys())[t]??null,removeItem:t=>{e.delete(t)},setItem:(t,r)=>{e.set(t,String(r))}}},Ht=new Map,tt=e=>{let t=Ht.get(e);return t||(t=Vt(),Ht.set(e,t)),t},rt=(e="localStorage")=>{try{let t=globalThis?.[e];if(t&&typeof t.getItem=="function"&&typeof t.setItem=="function"&&typeof t.removeItem=="function"&&typeof t.clear=="function"&&typeof t.key=="function"&&typeof t.length=="number")return t}catch{}return tt(e)},jo=Br.type===_.Browser?rt():Vt()});var qt={};Q(qt,{WebStore:()=>Jr});var ye,Jr,Xt=b(()=>{"use strict";Me();F();ne();A();T();Yt();Fe();ye={Local:"local",Session:"session"},Jr=(()=>{let e=[se("WebStore")],t,r=[],n;var i=class{static{n=this}static{let o=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;oe(null,t={value:n},e,{kind:"class",name:n.name,metadata:o},null,r),i=n=t.value,o&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),ie(n,r)}static _localInstance;static _sessionInstance;static get local(){return i._localInstance??=new i(ye.Local)}static get session(){return i._sessionInstance??=new i(ye.Session)}#r;#e;get#o(){if(this.#e)return this.#e;let o=this.#r===ye.Local?"localStorage":"sessionStorage";return this.#e=rt(o)}#n(o){try{return o(this.#o)}catch{let a=this.#r===ye.Local?"localStorage":"sessionStorage",c=tt(a);return this.#e=c,o(c)}}constructor(o=ye.Local){this.#r=o}get(o,s){let a=this.#n(c=>c.getItem(k(o)));return y(a)?re(a):s??null}set(o,s,a={merge:!0}){if(h(o))return this.clear();let c=this.get(o),l=z(s);switch(l.type){case"Undefined":return this.del(o);case"Object":return c??={},this.#t(o,a.merge?Object.assign(c,l.value):l.value);case"Array":return c??=[],this.#t(o,a.merge?Oe(c.concat(l.value)):s);case"Map":return c??=new Map,a.merge?(l.value.forEach((p,m)=>c.set(m,p)),this.#t(o,c)):this.#t(o,l.value);case"Set":return c??=new Set,a.merge?(l.value.forEach(p=>c.add(p)),this.#t(o,c)):this.#t(o,l.value);default:return this.#t(o,l.value)}}clear(){try{this.#n(o=>o.clear())}catch(o){console.warn("[WebStore] Failed to clear storage:",o)}return this}del(...o){return o.forEach(s=>{try{this.#n(a=>a.removeItem(k(s)))}catch(a){console.warn(`[WebStore] Failed to removeItem for key '${String(s)}':`,a)}}),this}keys(...o){return this.entries(...o).map(([s])=>s)}values(...o){return this.entries(...o).map(([,s])=>s)}entries(...o){let s=new Set(o.map(c=>k(c))),a=[];return this.#n(c=>{for(let l=0;l<c.length;l++){let p=c.key(l);if(p!==null&&(Z(o)||s.has(p))){let m=c.getItem(p);a.push([re(p),re(m)])}}}),a}from(o){return E(o).forEach(([s,a])=>this.set(s,a)),this}#t(o,s){try{this.#n(a=>a.setItem(k(o),k(s)))}catch(a){console.warn(`[WebStore] Failed to setItem for key '${String(o)}':`,a)}return this}};return i=n})()});var er={};Q(er,{geoCoords:()=>Qt,geoLocation:()=>he,mapAddress:()=>Zr,mapHemisphere:()=>Ur,mapQuery:()=>it});var We,zr,S,ot,W,nt,Ge,he,Qt,it,Ur,Zr,st=b(()=>{"use strict";Ot();fe();T();Xe();Qe();et();We={catch:!0,debug:0},zr=q(),S={},ot="_map_",W=new ke("[Mapper]"),nt=null,Ge=()=>(nt||(nt=new Promise((e,t)=>{zr.type===_.Browser?Promise.resolve().then(()=>(Xt(),qt)).then(({WebStore:r})=>{let n=new r("local");Object.assign(S,n.get(ot,{})),e(n)}).catch(t):e(void 0)})),nt),he=(e={})=>Ge().then(()=>new Promise((t,r)=>{e=Object.assign({},We,e);let n=e.catch?t:r;typeof navigator<"u"&&"geolocation"in navigator?navigator.geolocation.getCurrentPosition(i=>{let o=S.geolocation?.coords,s=o?.latitude?.toFixed(3),a=o?.longitude?.toFixed(3),c=S.geolocation?.timestamp??0,l=i.coords.latitude.toFixed(3)!==s,p=i.coords.longitude.toFixed(3)!==a,m=c<Jt().epochMilliseconds-36e5;(l||p||m)&&(Object.assign(S,{georesponse:null}),W.info(e,"GeoLocation: device update")),Object.assign(S,{geolocation:Re(i)}),t(S.geolocation)},i=>{Object.assign(S,{geolocation:{error:i.message},georesponse:null}),n(S.geolocation)}):(Object.assign(S,{geolocation:{error:"Not Supported"},georesponse:null}),n(S.geolocation))})).finally(()=>{(S.geolocation?.error?W.error:W.info)(e,"geoLocation: ",S.geolocation),Ge().then(r=>r?.set(ot,S))}),Qt=e=>new Promise((t,r)=>{if(!h(e))return t(e);he().then(n=>h(n.error)?{location:{lat:n.coords.latitude,lng:n.coords.longitude}}:null).then(n=>t(n)).catch(n=>r(n))}),it=(e,t={})=>Ge().then(()=>new Promise((r,n)=>{t=Object.assign({},We,t);let i=t.catch?r:n;Qt(e).then(o=>{switch(!0){case!(typeof window<"u"&&"google"in window&&"maps"in window.google):throw new Error("Google Maps API not configured");case h(o):throw new Error("Cannot determine Coordinates");case h(e):{let s=S.geolocation&&S.georesponse,a=h(S.geolocation?.error)&&h(S.georesponse?.error);if(s&&a)return t.debug&&W.debug(t,"mapQuery: cache"),r(S.georesponse)}default:new window.google.maps.Geocoder().geocode(o).then(s=>r(S.georesponse=Re(s)))}}).catch(o=>{Object.assign(S,{georesponse:{error:o.message}}),i(S.georesponse)})})).finally(()=>{t.debug&&(S.georesponse?.error?W.error:W.debug)(t,"mapQuery: ",S.georesponse),Ge().then(r=>r?.set(ot,S))}),Ur=(e,t={})=>it(e,t).then(r=>{if(t=Object.assign({},We,t),h(r.error))return t.debug&&W.debug(t,"sphere: ",r),r.results[0].geometry.location.lat()>=0?"north":"south";let n=Le();if(h(n)&&t.catch===!1)throw new Error("Cannot determine Hemisphere");return n}).catch(r=>{if(t.debug&&W.warn(t,"mapHemisphere: ",r.message),t.catch===!1)throw r;return null}),Zr=(e,t={})=>it(e,t).then(r=>{if(!h(r.error))throw new Error(r.error);return r.results[0]}).then(({formatted_address:r,address_components:n})=>n.reduce((i,o)=>(o.types.filter(s=>s!=="political").forEach(s=>i[s]=(i[s]?i[s]+",":"").concat(o.short_name)),i),{formatted_address:r})).catch(r=>{if(t=Object.assign({},We,t),t.debug&&W.warn(t,"mapAddress: ",r.message),t.catch===!1)throw r;return null})});var ir={};Q(ir,{HTTP:()=>nr,HttpError:()=>B,METHOD:()=>or,fetchHead:()=>jr,fetchRequest:()=>Kr});var at,tr,nr,or,B,rr,Kr,jr,sr=b(()=>{"use strict";T();at=2e3,tr=/\);?$/,nr={Ok:200,PermRedirect:301,TempRedirect:302,BadRequest:400,Unauthorised:401,Forbidden:403},or={Head:"HEAD",Get:"GET",Put:"PUT",Delete:"DELETE",Post:"POST"},B=class extends Error{status;statusText;body;constructor(t,r,n){super(`${t}: ${r}`),this.status=t,this.statusText=r,this.body=n,this.name="HttpError"}},rr=async(e,t)=>{let r=e.headers?.get?.("Content-Length")||e.headers?.get?.("content-length");if(r){let a=parseInt(r,10);if(g(a)&&a>t){try{await e.body?.cancel()}catch{}throw new B(413,`Content-Length (${a}) exceeds limit (${t} bytes)`,null)}}if(!e.body){let a;if(w(e.text))a=await e.text();else if(w(e.json)){let l=await e.json();a=JSON.stringify(l)??""}else a="";let c=new TextEncoder().encode(a).byteLength;if(c>t)throw new B(413,`Payload length (${c}) exceeds limit (${t} bytes)`,null);return a}let n=e.body.getReader(),i=new TextDecoder,o=0,s="";try{for(;;){let{done:a,value:c}=await n.read();if(a)break;if(c){if(o+=c.byteLength,o>t){try{await n.cancel()}catch{}throw new B(413,`Streamed payload exceeded limit (${t} bytes)`,null)}s+=i.decode(c,{stream:!0})}}return s+=i.decode(),s}finally{try{n.releaseLock()}catch{}}},Kr=(e,t={},r={})=>{let n={...t,signal:t.signal?AbortSignal.any([t.signal,AbortSignal.timeout(r.timeout??at)]):AbortSignal.timeout(r.timeout??at)};return fetch(e,n).then(async i=>{if(i.ok){let a=(i.headers?.get?.("Content-Type")||i.headers?.get?.("content-type")||"").includes("application/json");if(x(r.maxBytes)){let c=await rr(i,r.maxBytes);if(r.rawText)return c;if(r.prefix){let l=c.startsWith(r.prefix)?c.substring(r.prefix.length).replace(tr,""):c;return JSON.parse(l)}if(a)return JSON.parse(c);try{return JSON.parse(c)}catch{return c}}if(r.rawText)return w(i.text)?await i.text():"";if(r.prefix){let c=await i.text(),l=c.startsWith(r.prefix)?c.substring(r.prefix.length).replace(tr,""):c;return JSON.parse(l)}if(w(i.text)){let c=await i.text();try{return JSON.parse(c)}catch{return c}}return w(i.json)?await i.json():""}let o=null;try{let s=x(r.maxBytes)?await rr(i,r.maxBytes):w(i.text)?await i.text():"";try{o=JSON.parse(s)}catch{o=s}}catch(s){if(s instanceof B&&s.status===413)throw s}throw new B(i.status,i.statusText,o)})},jr=e=>{let t=AbortSignal.timeout(at),r={method:or.Head,signal:t};return fetch(e,r).then(({ok:n,status:i,statusText:o,headers:s})=>{if(n||i===nr.Forbidden)return{status:i,headers:s};throw new B(i,o,null)})}});var ft={};Q(ft,{serverGeoCoords:()=>Be,serverGeoLocation:()=>we,serverMapHemisphere:()=>lt});var ar,ct,ut,Hr,we,Be,lt,Je=b(()=>{"use strict";T();Qe();et();ar=new ke("[ServerMapper]"),ct={endpoint:"https://ipwho.is/",timeout:3e3,catch:!0,debug:0},ut=null,Hr=()=>(ut||(ut=Promise.resolve().then(()=>(sr(),ir))),ut),we=async(e={})=>{let t={...ct,...e},r=t.catch!==!1;try{let n=t.endpoint||ct.endpoint,i=t.timeout??ct.timeout,{fetchRequest:o}=await Hr(),s=await o(n,{},{...g(i)?{timeout:i}:{},maxBytes:64*1024});if(typeof s!="object"||h(s))throw new Error("Geolocation lookup failed");if(s.status==="fail"||s.success===!1)throw new Error(s.message||s.reason||"Geolocation lookup failed");let a=g(s.lat)?s.lat:s.latitude,c=g(s.lon)?s.lon:s.lng??s.longitude;if(!g(a)||!g(c))throw new Error("Geolocation lookup failed");let l=y(s.timezone)?s.timezone:s.timezone?.id??s.timeZone,p={lat:a,lng:c,latitude:a,longitude:c,...y(s.country||s.countryName||s.country_name)?{country:s.country||s.countryName||s.country_name}:{},...y(s.city||s.cityName||s.city_name)?{city:s.city||s.cityName||s.city_name}:{},...y(l)?{timezone:l}:{},...y(s.query||s.ip||s.ip_address)?{query:s.query||s.ip||s.ip_address}:{},status:"success"};return t.debug&&ar.info(t,"serverGeoLocation success: ",p),p}catch(n){let i=n?.message||"Server geolocation error";if(t.debug&&ar.error(t,"serverGeoLocation error: ",i),!r)throw n;return{error:i,status:"fail"}}},Be=async(e,t)=>{if(!h(e)){let n=e.latitude??e.lat,i=e.longitude??e.lng??e.lon??e.long;if(g(n)&&g(i))return{lat:n,lng:i}}let r=await we(t);return h(r.error)&&g(r.lat)&&g(r.lng)?{lat:r.lat,lng:r.lng}:null},lt=async(e,t)=>{let r=await Be(e,t);return r?r.lat>=0?"north":"south":Le()??null}});var qr={};Q(qr,{GeoPlugin:()=>mt,coerceGeo:()=>pt,default:()=>Yr,geoLocation:()=>he,geoLookup:()=>Ue,geoPlugin:()=>Vr,getStashedGeo:()=>ze,resolveGeoCoordinates:()=>be,serverGeoCoords:()=>Be,serverGeoLocation:()=>we,serverMapHemisphere:()=>lt});var j={};Q(j,{definePlugin:()=>Ke,defineTerm:()=>dr});ue(j,yt(Ze()));var Te=yt(Ze()),Ke=e=>(0,Te.definePlugin)({...e,version:"0.1.0"}),dr=e=>(0,Te.defineTerm)({...e,version:"0.1.0"});fe();T();var pt=e=>{if(h(e)||typeof e!="object")return;let t=e.geo??e,r=e.config?.geo??e.config,n=t?.latitude??t?.lat??e.latitude??e.lat??r?.latitude??r?.lat,i=t?.longitude??t?.lng??t?.lon??t?.long??e.longitude??e.lng??e.lon??e.long??r?.longitude??r?.lng??r?.lon??r?.long,o=t?.elevation??e.elevation??r?.elevation,s=t?.sphere??e.sphere??r?.sphere,a=t?.country??e.country??r?.country,c=t?.city??e.city??r?.city,l={};if(g(n)&&(l.latitude=n),g(i)&&(l.longitude=i),g(o)&&(l.elevation=o),(s==="north"||s==="south")&&(l.sphere=s),y(a)&&(l.country=a),y(c)&&(l.city=c),t&&typeof t=="object")for(let p of Object.keys(t))te(p)&&!["latitude","lat","longitude","lng","lon","long","elevation","sphere","country","city"].includes(p)&&(l[p]=t[p]);return Object.keys(l).length>0?l:void 0},ze=()=>{let{type:e}=q();if(e===_.Browser||e===_.WebWorker)try{if(typeof localStorage<"u"){let t=localStorage.getItem("_map_");if(t){let n=JSON.parse(t)?.geolocation?.coords;if(g(n?.latitude)&&g(n?.longitude))return{latitude:n.latitude,longitude:n.longitude}}}}catch{}},Ue=async(e={})=>{let{type:t}=q();switch(t){case _.Browser:{let{geoLocation:r}=await Promise.resolve().then(()=>(st(),er)),n=await r(e);if(n.error)return{error:n.error};let i=n.coords?.latitude,o=n.coords?.longitude;return{lat:i,lng:o,latitude:i,longitude:o,...n}}case _.WebWorker:{let r=ze();if(r&&g(r.latitude)&&g(r.longitude))return{lat:r.latitude,lng:r.longitude,latitude:r.latitude,longitude:r.longitude};let{serverGeoLocation:n}=await Promise.resolve().then(()=>(Je(),ft));return n(e)}case _.NodeJS:case _.Deno:default:{let{serverGeoLocation:r}=await Promise.resolve().then(()=>(Je(),ft));return r(e)}}},be=async(e,t={})=>{let r=pt(e);if(r&&g(r.latitude)&&g(r.longitude))return{lat:r.latitude,lng:r.longitude};let n=ze();if(n&&g(n.latitude)&&g(n.longitude))return{lat:n.latitude,lng:n.longitude};let i=await Ue(t);return h(i.error)&&g(i.lat)&&g(i.lng)?{lat:i.lat,lng:i.lng}:null};Je();st();var mt=Ke({name:"geo",install(e){e.geoLookup=Ue,e.resolveGeoCoordinates=be,e.serverGeoLocation=we,e.geoLocation=he,e.prototype.geoLocate=async function(t){let r=await be(this,t);if(r){let n=typeof this.config.geo=="object"&&this.config.geo!==null?this.config.geo:{};return new e(this,{...this.config,geo:{...n,latitude:r.lat,longitude:r.lng}})}return this},e.prototype.geoLookup=async function(t){return be(this,t)}}}),Vr=mt,Yr=mt;return gr(qr);})();
1
+ "use strict";var Magma;((Magma||={}).plugins||={}).geo=(()=>{var $r=Object.create;var Ce=Object.defineProperty;var Cr=Object.getOwnPropertyDescriptor;var Mr=Object.getOwnPropertyNames;var Ar=Object.getPrototypeOf,Lr=Object.prototype.hasOwnProperty;var T=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var Fr=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},ce=(e,t)=>{for(var r in t)Ce(e,r,{get:t[r],enumerable:!0})},$e=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Mr(t))!Lr.call(e,s)&&s!==r&&Ce(e,s,{get:()=>t[s],enumerable:!(n=Cr(t,s))||n.enumerable});return e},ye=(e,t,r)=>($e(e,t,"default"),r&&$e(r,t,"default")),Ct=(e,t,r)=>(r=e!=null?$r(Ar(e)):{},$e(t||!e||!e.__esModule?Ce(r,"default",{value:e,enumerable:!0}):r,e)),zr=e=>$e(Ce({},"__esModule",{value:!0}),e);var rt=Fr((On,Mt)=>{"use strict";Mt.exports=window.Magma.pluginSdk});var Wr,kr,Ur,Br,Jr,Zr,Kr,jr,At,qr,Lt,y,U=T(()=>{"use strict";Wr=Symbol.for("$LibraryTarget"),kr=Symbol.for("$LibraryDiscover"),Ur=Symbol.for("$LibraryExtensible"),Br=Symbol.for("nodejs.util.inspect.custom"),Jr=Symbol.for("$LibraryLogConfig"),Zr=Symbol.for("$LibraryRegistry"),Kr=Symbol.for("$LibraryRegister"),jr=Symbol.for("$LibrarySerializerRegistry"),At=Symbol.for("$LibraryMutable"),qr=Symbol.for("$LibraryIdentity"),Lt=Symbol.for("$LibraryUnwrapped"),y={$Target:Wr,$Discover:kr,$Extensible:Ur,$Inspect:Br,$LogConfig:Jr,$Registry:Zr,$Register:Kr,$SerializerRegistry:jr,$Identity:qr,$Mutable:At,$Unwrapped:Lt}});function le(e){let t=e,r=0,n=50;for(;t;){let s=t[y.$Target];if(!s||r>=n)break;t=s,r++}return t}function I(e,t=!1){if(!e||typeof e!="object")return[];let r=le(e);if(!t){let l=Reflect.ownKeys(r),u=[];for(let d of l){let h=Object.getOwnPropertyDescriptor(r,d);h&&h.enumerable&&u.push([d,r[d]])}return u}let n=[],s=50,i=0,o=r;for(;o&&o!==Object.prototype&&i++<s;)n.push(le(o)),o=Object.getPrototypeOf(o);let a=[],c=new Set;for(let l of n.reverse()){let u=Reflect.ownKeys(l);for(let d of u){if(c.has(d))continue;let h=Object.getOwnPropertyDescriptor(l,d);!h||!h.enumerable||(c.add(d),a.push([d,r[d]]))}}return a}function we(e,t=!1){return I(e,t).map(([r])=>r)}function Ft(e,t=!1){return I(e,t).map(([r,n])=>n)}function Ae(e,t,r){return t?Ae(e.map(t,r)):Array.from(new Set(e))}var B=T(()=>{"use strict";U()});var ot,zt,Le,ne,q,Vr,Yr,Fe,G=T(()=>{"use strict";U();B();ot=[],zt=e=>{if(e===null)return"Null";if(e===void 0)return"Undefined";let t=typeof e;if(t==="string")return"String";if(t==="number")return"Number";if(t==="boolean")return"Boolean";if(t==="bigint")return"BigInt";if(t==="symbol")return"Symbol";try{let r=t==="object"?le(e):e;return Object.prototype.toString.call(r).slice(8,-1)}catch{return t==="function"?"Function":"Object"}},Le=e=>{try{let t=e?.[Symbol.toStringTag]??e?.prototype?.[Symbol.toStringTag];if(typeof t=="string")return t}catch{}},ne=(e,...t)=>{let r=e;try{r=e?.[y.$Target]??e}catch{r=e}let n=zt(r);switch(n){case"Function":try{return Yr(r)?"Class":"Function"}catch{return"Function"}case"Object":{try{if("length"in r&&Object.keys(r).every(i=>i==="length"||Number.isFinite(Number(i))))return"ArrayLike";for(let i of t){let o=i.class?.[y.$Target]??i.class;if(r===o||o&&r instanceof o)return i.type}let s=globalThis[y.$Registry]??[];for(let i of[...ot,...s]){let o=i.class?.[y.$Target]??i.class;if(r===o||o&&r instanceof o)return i.type}}catch{return"Object"}return"Object"}default:return n}},q=(e,...t)=>({type:ne(e,...t),value:e}),Vr=/^\s*(class\s|\[native code\])/,Yr=e=>{if(typeof e!="function")return!1;let t=e?.[y.$Target]??e;if(!("prototype"in t))return!1;let r=t?.name,n=Le(t);if(t?.[y.$Identity]||t?.prototype?.[y.$Identity]||typeof n=="string"&&n.startsWith("Temporal."))return!0;if(typeof n=="string"&&n.endsWith("Function"))return!1;if((globalThis[y.$Registry]??[]).some(i=>(i.class?.[y.$Target]??i.class)===t||r&&i.type===r||n&&i.type===n))return!0;try{let i=Function.prototype.toString.call(t);if(Vr.test(i))return!0;let o=Object.getOwnPropertyDescriptor(t,"prototype");if(o&&o.writable===!1&&!Object.isFrozen(t))return!0;let a=t.prototype;if(a&&Object.getOwnPropertyNames(a).length>2)return!0}catch{return!1}return!1},Fe=(e,t)=>{if(typeof e!="function")return;let r=Le(e),n=t??r??e.name;n&&!["Object","Function",""].includes(n)&&(ot.some(s=>s.class===e)||ot.push({class:e,type:n}))}});var $,ue,F,g,Gt,m,it,oe,N,st,V,Wt,J,x,Y,O,b,ze,Ge,We,C,_=T(()=>{"use strict";U();G();$=(e,...t)=>t.includes(ne(e)),ue=e=>$(e,"String","Number","BigInt","Boolean","Symbol","Undefined","Void","Null","Empty"),F=e=>!ue(e),g=e=>$(e,"String"),Gt=e=>g(e)&&e.trim().length>0,m=e=>Number.isFinite(e),it=e=>$(e,"BigInt"),oe=e=>$(e,"Array"),N=e=>$(e,"Object"),st=e=>$(e,"Date"),V=e=>$(e,"Symbol"),Wt=e=>$(e,"Symbol")&&Symbol.keyFor(e)!==void 0,J=e=>e!=="__proto__"&&e!=="constructor"&&e!=="prototype",x=e=>$(e,"Null","Undefined","Void","Empty"),Y=e=>$(e,"Undefined","Void","Empty"),O=e=>!x(e),b=e=>$(e,"Function","AsyncFunction","GeneratorFunction","AsyncGeneratorFunction"),ze=e=>$(e,"Map"),Ge=e=>$(e,"Set"),We=(e,t)=>$(e,"Error")&&(t?e instanceof t:!0),C=e=>x(e)||N(e)&&Reflect.ownKeys(e).length===0||g(e)&&e.trim().length===0||typeof e=="number"&&Number.isNaN(e)||oe(e)&&e.length===0||Ge(e)&&e.size===0||ze(e)&&e.size===0||ArrayBuffer.isView(e)&&e.byteLength===0||st(e)&&Number.isNaN(e.getTime())});function at(e,t,r=new WeakSet){let n=t instanceof WeakSet?t:t?.skip??Hr;return ue(e)||r.has(e)||n.has(e)||e instanceof Date||e instanceof RegExp||e instanceof Error||e instanceof Map||e instanceof Set||e instanceof Promise||e?.[Symbol.toStringTag]==="Enumify"||e[y.$Extensible]?e:(r.add(e),I(e).forEach(([s,i])=>{J(s)&&at(i,{skip:n},r)}),Object.freeze(e))}var S,fe,Hr,be=T(()=>{"use strict";B();_();U();S={Unknown:"unknown",Browser:"browser",WebWorker:"web-worker",NodeJS:"nodejs",Deno:"deno",GoogleAppsScript:"google-apps-script"},fe=()=>{let e=globalThis;try{if(O(e.SpreadsheetApp))return{global:e,type:S.GoogleAppsScript};if(O(e.window?.document))return{global:e,type:S.Browser};if(b(e.importScripts)||O(e.WorkerGlobalScope)&&e instanceof e.WorkerGlobalScope)return{global:e,type:S.WebWorker};if(O(e.Deno))return{global:e,type:S.Deno};if(O(e.process?.versions?.node)&&e.process?.release?.name==="node")return{global:e,type:S.NodeJS}}catch{}return{global:e,type:S.Unknown}},Hr=new WeakSet});function kt(e){return Object.fromEntries(I(e,!0))}var Ut=T(()=>{"use strict";B();G();_()});function Jt(e,t={},r=!1){let{frozen:n,lock:s,appendOnly:i,onGet:o,keys:a,bind:c,skip:l}=t,u=new Set,d,h,P=le(e);s&&at(P,l?{skip:l}:void 0),Fe(P);let v={isExtensible:f=>Reflect.isExtensible(f),getPrototypeOf:f=>Reflect.getPrototypeOf(f),setPrototypeOf:(f,p)=>{if(n)throw new TypeError("Security: Prototype mutation attempt on protected object");return Reflect.setPrototypeOf(f,p)},getOwnPropertyDescriptor:(f,p)=>{if(!(a&&!a.includes(p))){if(a){if(o&&!V(p)&&!u.has(p)){u.add(p);try{let w=o(p,f);if(O(w))return{enumerable:!0,configurable:!0,value:w}}finally{u.delete(p)}}return{enumerable:!0,configurable:!0}}return Reflect.getOwnPropertyDescriptor(f,p)}},ownKeys:f=>{if(a)return a;if(o&&!u.has(y.$Discover)){u.add(y.$Discover);try{o(y.$Discover,f)}finally{u.delete(y.$Discover)}}return Reflect.ownKeys(f)},has:(f,p)=>a?a.includes(p):Reflect.has(f,p),deleteProperty:(f,p)=>{if(n)throw new TypeError(`Cannot delete property '${String(p)}' from a protected object.`);if(i&&Reflect.has(f,p))throw new Error(`Security: Deletion attempt on protected key '${String(p)}'`);return Reflect.deleteProperty(f,p)},defineProperty:(f,p,w)=>{if(n&&!Object.isFrozen(f))throw new TypeError(`Cannot define property '${String(p)}' on a frozen object.`);if(i&&Reflect.has(f,p))throw new Error(`Security: Mutation attempt on protected key '${String(p)}'`);return Reflect.defineProperty(f,p,w)},set:(f,p,w,D)=>{if(n&&D===h)throw new TypeError(`Cannot set property '${String(p)}' on a frozen object.`);if(i){if(Array.isArray(f)&&p==="length"&&w<f.length)throw new Error("Security: Truncation attempt on protected array.");if(!(Array.isArray(f)&&p==="length")&&Reflect.has(f,p))throw new Error(`Security: Mutation attempt on protected key '${String(p)}'`)}return Reflect.set(f,p,w,D)},get:(f,p,w)=>{if(p===y.$Target)return w===h?f:void 0;if(n&&(p===y.$Inspect||p==="toJSON")){let R=Object.getOwnPropertyDescriptor(f,p);return R&&b(R.value)?R.value:(d||(d=()=>kt(f)),d)}if(a&&!a.includes(p))return;if(o&&!V(p)&&!Reflect.has(f,p)&&!u.has(p)){u.add(p);try{let R=o(p,f);if(O(R))return R}finally{u.delete(p)}}let D=Reflect.get(f,p,w);if(c&&p!=="constructor"&&b(D)){let R=Object.getOwnPropertyDescriptor(f,p);if(R&&!R.configurable&&!R.writable)return D;let he=Bt.get(D);he||(he=new WeakMap,Bt.set(D,he));let Rt=he.get(f);if(Rt)return Rt;let $t=D.bind(f);return he.set(f,$t),$t}return D}};if(r){let f=Proxy.revocable(P,v);return h=f.proxy,{proxy:f.proxy,revoke:f.revoke}}return h=new Proxy(P,v),h}function Zt(e,t=!0,r=t,n=new WeakSet){return Jt(e,{frozen:t,lock:r,skip:n,bind:t})}function Se(e,t=new WeakSet){return Jt(e,{frozen:!0,lock:!0,skip:t,bind:!0})}var Bt,ke=T(()=>{"use strict";U();Ut();be();B();_();G();Bt=new WeakMap});function xe(e,t=new WeakSet){return JSON.stringify(e,function(r,n){if(n===void 0)return"\0__undefined__\0";if(it(n))return`\0__bigint:${n}__\0`;if(b(n))return`function:${n.name||"anonymous"}`;if(F(n)){if(t.has(n))return"<Circular>";if(t.add(n),ze(n))return`map:[${Array.from(n.entries()).map(s=>xe(s,t)).sort().join(",")}]`;if(Ge(n))return`set:[${Array.from(n).map(s=>xe(s,t)).sort().join(",")}]`}return n})}function jt(e){return function t(...r){return r.length>=e.length?e(...r):(...n)=>t(...r,...n)}}function ie(e){let t=new Map;return function(...r){let n=xe(this!==void 0&&this!==globalThis?[this,...r]:r);if(!t.has(n)){let s=e.apply(this,r);t.set(n,s)}return t.get(n)}}function Te(e,t){return{enumerable:!1,configurable:!1,writable:!1,value:function(...r){let n=`${String(e)},${xe(r)}`,s=Kt.get(this);if(s||(s=new Map,Kt.set(this,s)),!s.has(n)){let i=t.apply(this,r);Se(i),s.set(n,i)}return s.get(n)}}}var Kt,Ue=T(()=>{"use strict";ke();_();Kt=new WeakMap});var qt=T(()=>{"use strict"});function Xr(e,t){return C(e)?t:W(t)}function Qr(e,t){return tn(t)}function Yt(e){let t=encodeURI(e);return t.includes("%")&&(t=t.replace(en,r=>Qt[r.toUpperCase()]??decodeURI(r))),t}function tn(e){if(g(e))try{return decodeURI(e)}catch{}return e}function Oe(e){return!$(e,"Function","AsyncFunction","WeakMap","WeakSet","WeakRef")}function rn(e,t){return`{"$${e}":${t}}`}function Ht(e){return W(V(e)?`${Wt(e)?"@":""}@(${e.description??""})`:e)}function er(e){let[t,r,n]=e.toString().match(nn)||[null,void 0,void 0];switch(!0){case V(e):case x(t):case(O(r)&&Y(n)):return e;case O(r):return Symbol.for(n);case Y(r):default:return Symbol(n)}}function k(e){return W(e,!1)}function W(e,t=!0){let r=q(e),n=jt(rn)(r.type);switch(r.type){case"String":return t||(t=r.value==="true"||r.value==="false"||r.value==="null"||parseFloat(r.value).toString()===r.value),t?JSON.stringify(Yt(r.value)):Yt(r.value);case"Boolean":case"Null":case"Number":return JSON.stringify(r.value);case"Void":case"Undefined":return n(JSON.stringify("void"));case"BigInt":return n(r.value.toString());case"Object":return`{${I(r.value).filter(([,i])=>Oe(i)).map(([i,o])=>`${Ht(i)}: ${W(o)}`).join(",")}}`;case"Array":return`[${r.value.filter(i=>Oe(i)).map(i=>W(i)).join(",")}]`;case"Map":{let s=Array.from(r.value.entries()).filter(([,i])=>Oe(i)).map(([i,o])=>`[${W(i)}, ${W(o)}]`).join(",");return n(`[${s}]`)}case"Set":{let s=Array.from(r.value.values()).filter(i=>Oe(i)).map(i=>W(i)).join(",");return n(`[${s}]`)}case"Symbol":return n(Ht(r.value));case"RegExp":return n(W({source:r.value.source,flags:r.value.flags}));default:{let s=r.value;switch(!0){case!Oe(s):return;case b(s.toJSON):return n(W(s.toJSON()));case b(s.toString):{let i=s.toString();return n(i.includes('"')?i:JSON.stringify(i))}case b(s.valueOf):return n(JSON.stringify(s.valueOf()));default:return n(JSON.stringify(s,Xr))}}}}function se(e,t){if(!g(e))return e;let r;try{r=JSON.parse(e,Qr)}catch(n){return e.startsWith('"')&&e.endsWith('"')?(console.warn(`objectify.parse: -> ${e}, ${n.message}`),e):se(`"${e}"`,t)}switch(!0){case(e.startsWith("{")&&e.endsWith("}")):case(e.startsWith("[")&&e.endsWith("]")):return lt(r,t);default:return r}}function lt(e,t){return N(e)?ct(I(e).reduce((r,[n,s])=>Object.assign(r,{[er(n)]:ct(lt(s,t))}),{}),t):oe(e)?Ft(e).map(r=>ct(lt(r,t))):e}function ct(e,t){if(!N(e)||we(e).length!==1)return e;let[r,n]=I(e)[0];if(!String(r).startsWith("$"))return e;let s=r.substring(1);try{switch(s){case"String":case"Boolean":case"Object":case"Array":return n;case"Number":return Number(n);case"BigInt":return BigInt(n);case"Null":return null;case"Undefined":case"Empty":case"Void":return t?.();case"Date":return new Date(n);case"RegExp":return!N(n)||!g(n.source)?e:new RegExp(n.source,n.flags);case"Symbol":return er(n);case"Map":return oe(n)?new Map(n):e;case"Set":return oe(n)?new Set(n):e;default:let i=Be.get(r);return i?Reflect.construct(i,[n]):(console.warn(`objectify: dont know how to deserialize '${s}'`),e)}}catch{return e}}var Be,Vt,Xt,Qt,en,nn,pe=T(()=>{"use strict";Ue();B();qt();G();_();U();Be=globalThis[y.$SerializerRegistry]??=new Map,Vt=e=>{try{let t=e?.prototype?.[Symbol.toStringTag]??e?.[Symbol.toStringTag];return g(t)?t:void 0}catch{return}},Xt=(e,t)=>{let r=e.startsWith("$")?e:`$${e}`;if(Be.has(r)){let n=Be.get(r),s=Vt(n),i=Vt(t),o=n.name||s,a=t.name||i||(e.startsWith("$")?e.slice(1):e);if(n===t||n.toString()===t.toString()||!!t[y.$Identity]&&n[y.$Identity]===t[y.$Identity]||!!t[y.$Target]&&n[y.$Target]===t[y.$Target]||!!o&&!!a&&o===a)return;throw new Error(`[registerSerializable] Collision: '${r}' is already registered with ${n.name||"anonymous constructor"}`)}Be.set(r,t)};Qt={"%20":" ","%22":'"',"%3B":";","%3C":"<","%3E":">","%5B":"[","%5D":"]","%5E":"^","%7B":"{","%7C":"|","%7D":"}"},en=new RegExp(Object.keys(Qt).join("|"),"gi");nn=/^@(@)?\(([^\)]*)\)$/});function H(e,t,r,n,s,i){function o(w){if(w!==void 0&&typeof w!="function")throw new TypeError("Function expected");return w}for(var a=n.kind,c=a==="getter"?"get":a==="setter"?"set":"value",l=!t&&e?n.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,h=!1,P=r.length-1;P>=0;P--){var v={};for(var f in n)v[f]=f==="access"?{}:n[f];for(var f in n.access)v.access[f]=n.access[f];v.addInitializer=function(w){if(h)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(w||null))};var p=(0,r[P])(a==="accessor"?{get:u.get,set:u.set}:u[c],v);if(a==="accessor"){if(p===void 0)continue;if(p===null||typeof p!="object")throw new TypeError("Object expected");(d=o(p.get))&&(u.get=d),(d=o(p.set))&&(u.set=d),(d=o(p.init))&&s.unshift(d)}else(d=o(p))&&(a==="field"?s.unshift(d):u[c]=d)}l&&Object.defineProperty(l,n.name,u),h=!0}function X(e,t,r){for(var n=arguments.length>2,s=0;s<t.length;s++)r=n?t[s].call(e,r):t[s].call(e);return n?r:void 0}var Ee=T(()=>{"use strict"});function tr(e,t){return Le(e)??(Y(t)?e.name||void 0:String(t))}function rr(e,{kind:t,name:r,addInitializer:n}){let s=tr(e,r);if(s&&Fe(e,s),t==="class")return s&&n(()=>Xt(s,e)),e;throw new Error(`@Serializable decorating unknown 'kind': ${t} (${r})`)}function Q(e,t){let r=(n,s,i)=>{let o=n.prototype,a=s??tr(n,i);if(a&&(o&&!Object.hasOwn(o,Symbol.toStringTag)&&Object.defineProperty(o,Symbol.toStringTag,{value:a,configurable:!0,writable:!1,enumerable:!1}),!n.name||n.name!==a))try{Object.defineProperty(n,"name",{value:a,configurable:!0,writable:!1,enumerable:!1})}catch{}return n};return typeof e=="function"&&t?.kind==="class"?r(e,void 0,t.name):(n,s)=>r(n,g(e)?e:void 0,s?.name)}var _e=T(()=>{"use strict";U();ke();_();pe();G()});var ut,nr=T(()=>{"use strict";Ee();_();_e();ut=(()=>{let e=[Q("BoundedCache")],t,r=[],n,s=Map;var i=class extends s{static{n=this}static{let o=typeof Symbol=="function"&&Symbol.metadata?Object.create(s[Symbol.metadata]??null):void 0;H(null,t={value:n},e,{kind:"class",name:n.name,metadata:o},null,r),i=n=t.value,o&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),X(n,r)}#t=new Map;#e=new Set;#r=new Map;maxSize;ttl;constructor(o=1e3,a=1440*60*1e3){super(),this.maxSize=o,this.ttl=a}get isBoundedCache(){return!0}#n(o){let a=this.#t.get(o);return a===void 0?!1:Date.now()>a}evictExpired(){if(this.#t.size===0)return;let o=Date.now();for(let[a,c]of this.#t.entries())o>c&&this.delete(a)}setStatic(o,a){return super.has(o)&&super.delete(o),super.set(o,a),this.#e.add(o),this.#t.delete(o),this.#r.delete(o),this}isStatic(o){return this.#e.has(o)}get(o){if(this.#n(o)){this.delete(o);return}if(!super.has(o))return;let a=super.get(o);return super.delete(o),super.set(o,a),a}has(o){return this.#n(o)?(this.delete(o),!1):super.has(o)}get size(){return this.evictExpired(),super.size}forEach(o,a){this.evictExpired(),super.forEach(o,a)}set(o,a,c){this.evictExpired();let l=this.#t.get(o);for(super.has(o)&&super.delete(o),super.set(o,a),this.#e.delete(o),O(c)?c!==1/0?(this.#t.set(o,Date.now()+c),this.#r.set(o,c)):(this.#t.delete(o),this.#r.delete(o)):l!==void 0?this.#t.set(o,l):this.ttl!==1/0?(this.#t.set(o,Date.now()+this.ttl),this.#r.delete(o)):(this.#t.delete(o),this.#r.delete(o));this.size-this.#e.size>this.maxSize;){let u=!1,d=super.keys(),h=d.next();for(;!h.done;){let P=h.value;if(!this.#e.has(P)){this.delete(P),u=!0;break}h=d.next()}if(!u)break}return this}delete(o){return this.#e.delete(o),this.#t.delete(o),this.#r.delete(o),super.delete(o)}deletePrefix(o){let a=String(o).trim().toLowerCase();if(C(a))return 0;let c=[];for(let l of super.keys())g(l)&&l.toLowerCase().startsWith(a)&&c.push(l);for(let l of c)this.delete(l);return c.length}clear(o){if(o===void 0){this.#e.clear(),this.#t.clear(),this.#r.clear(),super.clear();return}let a=0;for(let c of super.keys()){if(a>=o)break;this.#e.has(c)||(this.delete(c),a++)}}keys(){return this.evictExpired(),super.keys()}values(){return this.evictExpired(),super.values()}entries(){return this.evictExpired(),super.entries()}[Symbol.iterator](){return this.evictExpired(),super[Symbol.iterator]()}toJSON(){this.evictExpired();let o=[];for(let[a,c]of super.entries())typeof a=="string"&&o.push([a,c]);return Object.fromEntries(o)}static fromEntries(o,a=1e3,c=1440*60*1e3){let l=new i(a,c);for(let[u,d]of o)l.set(u,d);return l}};return i=n})()});function sr(e,t){let r;if(Y(e))return t??{};switch(A.type){case S.Browser:r=ft.getItem(e);break;case S.NodeJS:r=Pe.has(e)?Pe.get(e):on(e);break;case S.Deno:r=A.global.Deno.env.get(e);break;case S.GoogleAppsScript:r=A.global.PropertiesService?.getUserProperties().getProperty(e);break;case S.WebWorker:case S.Unknown:r=void 0;break;default:throw new Error(`Cannot determine Javascript context: ${A.type}`)}return g(r)?se(r):t}function mt(e,t,r){let n=O(t)?k(t):void 0,s=O(n);switch(A.type){case S.Browser:try{s?ft.setItem(e,n):ft.removeItem(e)}catch(i){console.warn(`[Storage] Failed to ${s?"setItem":"removeItem"} for key '${e}':`,i)}break;case S.NodeJS:s?r?.static?Pe.setStatic(e,n):Pe.set(e,n,r?.ttl):Pe.set(e,void 0,r?.ttl);break;case S.Deno:s?A.global.Deno.env.set(e,n):A.global.Deno.env.delete(e);break;case S.GoogleAppsScript:s?A.global.PropertiesService?.getUserProperties().setProperty(e,n):A.global.PropertiesService?.getUserProperties().deleteProperty(e);break;case S.WebWorker:case S.Unknown:break;default:throw new Error(`Cannot determine Javascript context: ${A.type}`)}}var A,ir,or,pt,dt,ft,Pe,on,gt=T(()=>{"use strict";pe();be();_();nr();A=fe(),ir=(e=1e3,t=1/0)=>{let r=new ut(e,t);return{get length(){return r.size},clear:()=>r.clear(),getItem:n=>r.get(n)??null,key:n=>Array.from(r.keys())[n]??null,removeItem:n=>{r.delete(n)},setItem:(n,s)=>{r.set(n,String(s))}}},or=new Map,pt=e=>{let t=or.get(e);return t||(t=ir(),or.set(e,t)),t},dt=(e="localStorage")=>{try{let t=globalThis?.[e];if(t&&typeof t.getItem=="function"&&typeof t.setItem=="function"&&typeof t.removeItem=="function"&&typeof t.clear=="function"&&typeof t.key=="function"&&typeof t.length=="number")return t}catch{}return pt(e)},ft=A.type===S.Browser?dt():ir(),Pe=new ut(1e3,1/0),on=e=>{try{let t=Reflect.get(A.global,"process");if(!t||typeof t!="object")return;let r=Reflect.get(t,"env");return!r||typeof r!="object"?void 0:Reflect.get(r,e)}catch{return}}});function te(e){return O(e)?b(e)?e():e:t=>b(t)?t():t}var Je,ar=T(()=>{"use strict";B();_();G();Je=e=>{if(x(e)||!N(e))return e;let t=oe(e)?[]:{};return we(e).forEach(r=>{J(r)&&(t[r]=Je(e[r]))}),t};te.stringSymbol=te();te.symbolRegExp=te();te.symbolString=te();te.stringString=te()});var cr=T(()=>{"use strict";pe();_()});function lr(e){if(We(e))return e;let t=new Error(N(e)&&g(e.message)?e.message:String(e));return N(e)&&(t.name=g(e.name)?e.name:"Error","code"in e&&(g(e.code)||m(e.code))&&(t.code=e.code),"stack"in e&&g(e.stack)&&(t.stack=e.stack)),t}var Zo,Ko,ur=T(()=>{"use strict";pe();G();_();cr();Zo=BigInt(Number.MAX_SAFE_INTEGER),Ko=BigInt(Number.MIN_SAFE_INTEGER)});var fr=T(()=>{"use strict";ur();if(typeof globalThis.Temporal>"u")throw new Error("Temporal API is not available. Node 20+ with a polyfill (e.g. @js-temporal/polyfill) is highly recommended. Native Temporal is fully reliable only on Node 26+ (while Node 22 may have instabilities).");try{if(typeof Temporal.Now.zonedDateTimeISO=="function"&&typeof Temporal.Now.zonedDateTimeISO().add!="function")throw new Error("Incomplete Temporal implementation")}catch(e){let t=lr(e);if(console.warn("Tempo: Native Temporal implementation appears incomplete. Consider loading a polyfill.",t),t.message!=="Incomplete Temporal implementation")throw t}});function pr(){return Temporal.Now.instant()}function dr(e,t=2024){let r=Temporal.ZonedDateTime.from({year:t,month:1,day:1,hour:0,minute:0,second:0,timeZone:e}).offsetNanoseconds,n=Temporal.ZonedDateTime.from({year:t,month:7,day:1,hour:0,minute:0,second:0,timeZone:e}).offsetNanoseconds;return{jan:r,jul:n}}var ht=T(()=>{"use strict";fr();_()});function cn(){return an().resolvedOptions()}function Ze(e=cn().timeZone){try{let{jan:t,jul:r}=dr(e),s=["Australia","Antarctica","Africa/Johannesburg","America/Argentina/Buenos_Aires","America/Sao_Paulo"].some(i=>e.startsWith(i));switch(!0){case r>t:return"north";case r<t:return"south";default:return s?"south":void 0}}catch{return}}var ri,ni,an,oi,ii,si,yt=T(()=>{"use strict";ht();Ue();_();ri=ie((e,t="narrow",r="always")=>new Intl.RelativeTimeFormat(e,{style:t,numeric:r})),ni=ie((e,t="conjunction",r="long")=>new Intl.ListFormat(e,{type:t,style:r})),an=ie((e,t)=>new Intl.DateTimeFormat(e,t)),oi=ie((e,t)=>{try{return new Intl.PluralRules(e,t)}catch{return{select:()=>"other"}}}),ii=ie((e,t)=>new Intl.NumberFormat(e,t)),si=ie((e,t)=>{try{let r=new Intl.DurationFormat(e,t);if(b(r.format))return r;throw new Error("No format method")}catch{return{format:n=>String(n)}}})});function Z(e){return{enumerable:!1,configurable:!1,writable:!1,value:e}}function de(e,t=!0){let n=ne(this)!=="Module"&&b(this?.has)?this:un,s=q(e),i=Object.create(n);switch(s.type){case"Enumify":case"Object":Object.defineProperties(i,Object.getOwnPropertyDescriptors(s.value));break;case"Array":s.value.forEach((o,a)=>{if(m(o))throw new Error("Enumify: numeric keys are not supported");i[o]=a});break;default:throw new Error(`Enumify: invalid argument type: ${s.type}`)}return Zt(i,!0,t)}var ln,un,gi,mr=T(()=>{"use strict";Ee();G();_();B();ke();_e();Ue();ln="Enumify",un=Se(Object.create(null,{keys:Te("keys",function(){return I(this,!0).map(([e])=>e)}),values:Te("values",function(){return I(this,!0).map(([e,t])=>t)}),entries:Te("entries",function(){return I(this,!0).map(([e,t])=>Object.freeze([e,t]))}),invert:Te("invert",function(){return Object.fromEntries(this.entries().map(([e,t])=>[t,e]))}),has:Z(function(e){return this.keys().includes(e)}),count:Z(function(){return this.keys().length}),includes:Z(function(e){return this.values().includes(e)}),keyOf:Z(function(e){return this.invert()[e]}),extend:Z(function(e,t){return de.call(this,e,t)}),forEach:Z(function(e,t){this.entries().forEach((r,n)=>e.call(t,r,n,this))}),filter:Z(function(e,t){return de(this.entries().reduce((r,n,s)=>e.call(t,n,s,this)?Object.assign(r,{[n[0]]:n[1]}):r,{}))}),map:Z(function(e,t){return de(this.entries().reduce((r,n,s)=>Object.assign(r,{[n[0]]:e.call(t,n,s,this)}),{}))}),[Symbol.iterator]:Z(function*(){for(let e of this.entries())yield e}),[Symbol.toStringTag]:{enumerable:!1,configurable:!1,writable:!1,value:ln}}));gi=(()=>{let e=[rr,Q("Enumify")],t,r=[],n;var s=class{static{n=this}static{let i=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;H(null,t={value:n},e,{kind:"class",name:n.name,metadata:i},null,r),s=n=t.value,i&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),X(n,r)}constructor(i){return de(i)}};return s=n})()});function fn(e,t=L.Info){return m(e)?e>=L.Off&&e<=L.Trace?e:t:g(e)?gr[e.toLowerCase()]??t:t}var L,M,gr,Ke,wt=T(()=>{"use strict";Ee();_();mr();U();_e();L=de(["Off","Error","Warn","Info","Debug","Trace"]),M={Off:"off",Log:"log",Info:"info",Warn:"warn",Debug:"debug",Trace:"trace",Error:"error"},gr={[M.Off]:L.Off,[M.Error]:L.Error,[M.Warn]:L.Warn,[M.Info]:L.Info,[M.Log]:L.Info,[M.Debug]:L.Debug,[M.Trace]:L.Trace};Ke=(()=>{let e=[Q("Logger")],t,r=[],n;var s=class{static{n=this}static{let i=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;H(null,t={value:n},e,{kind:"class",name:n.name,metadata:i},null,r),s=n=t.value,i&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),X(n,r)}#t;level;constructor(i,o=L.Info){this.#t=i.startsWith("[")?i:`[${i}]`,this.level=o}#e(i,...o){let a;if(o.length>0&&N(o[0]))try{o[0][y.$LogConfig]&&(a=o.shift())}catch{}let c=this.level;if(a){if(a.silent===!0)return;a.debug!==void 0&&(c=fn(a.debug,c))}if(c===L.Off||(gr[i]??0)>c)return;let u=o.map(d=>{if(We(d))return d.message;if(N(d))try{let h=d.constructor?.name??"Object";if(h==="Object"){let P=Object.keys(d);return`{ ${P.slice(0,3).join(", ")}${P.length>3?`, ... (+${P.length-3} more)`:""} }`}return`[${h}]`}catch{return"[Object]"}return String(d)}).filter(d=>!C(d)).join(" ");C(u)||console[i](`${this.#t} ${u}`)}log=(...i)=>this.#e(M.Log,...i);info=(...i)=>this.#e(M.Info,...i);warn=(...i)=>this.#e(M.Warn,...i);debug=(...i)=>this.#e(M.Debug,...i);trace=(...i)=>this.#e(M.Trace,...i);error=(...i)=>this.#e(M.Error,...i)};return s=n})()});var hr={};ce(hr,{WebStore:()=>pn});var Ne,pn,yr=T(()=>{"use strict";Ee();B();pe();G();_();gt();_e();Ne={Local:"local",Session:"session"},pn=(()=>{let e=[Q("WebStore")],t,r=[],n;var s=class{static{n=this}static{let i=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;H(null,t={value:n},e,{kind:"class",name:n.name,metadata:i},null,r),s=n=t.value,i&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),X(n,r)}static _localInstance;static _sessionInstance;static get local(){return s._localInstance??=new s(Ne.Local)}static get session(){return s._sessionInstance??=new s(Ne.Session)}#t;#e;get#r(){if(this.#e)return this.#e;let i=this.#t===Ne.Local?"localStorage":"sessionStorage";return this.#e=dt(i)}#n(i){try{return i(this.#r)}catch{let a=this.#t===Ne.Local?"localStorage":"sessionStorage",c=pt(a);return this.#e=c,i(c)}}constructor(i=Ne.Local){this.#t=i}get(i,o){let a=this.#n(c=>c.getItem(k(i)));return g(a)?se(a):o??null}set(i,o,a={merge:!0}){if(x(i))return this.clear();let c=this.get(i),l=q(o);switch(l.type){case"Undefined":return this.del(i);case"Object":return c??={},this.#o(i,a.merge?Object.assign(c,l.value):l.value);case"Array":return c??=[],this.#o(i,a.merge?Ae(c.concat(l.value)):o);case"Map":return c??=new Map,a.merge?(l.value.forEach((u,d)=>c.set(d,u)),this.#o(i,c)):this.#o(i,l.value);case"Set":return c??=new Set,a.merge?(l.value.forEach(u=>c.add(u)),this.#o(i,c)):this.#o(i,l.value);default:return this.#o(i,l.value)}}clear(){try{this.#n(i=>i.clear())}catch(i){console.warn("[WebStore] Failed to clear storage:",i)}return this}del(...i){return i.forEach(o=>{try{this.#n(a=>a.removeItem(k(o)))}catch(a){console.warn(`[WebStore] Failed to removeItem for key '${String(o)}':`,a)}}),this}keys(...i){return this.entries(...i).map(([o])=>o)}values(...i){return this.entries(...i).map(([,o])=>o)}entries(...i){let o=new Set(i.map(c=>k(c))),a=[];return this.#n(c=>{for(let l=0;l<c.length;l++){let u=c.key(l);if(u!==null&&(C(i)||o.has(u))){let d=c.getItem(u);a.push([se(u),se(d)])}}}),a}from(i){return I(i).forEach(([o,a])=>this.set(o,a)),this}#o(i,o){try{this.#n(a=>a.setItem(k(i),k(o)))}catch(a){console.warn(`[WebStore] Failed to setItem for key '${String(i)}':`,a)}return this}};return s=n})()});var Sr={};ce(Sr,{geoCoords:()=>br,geoLocation:()=>ve,mapAddress:()=>mn,mapHemisphere:()=>dn,mapQuery:()=>xt});var qe,wr,E,St,K,bt,je,ve,br,xt,dn,mn,Tt=T(()=>{"use strict";ar();be();_();ht();yt();wt();qe={catch:!0,debug:0},wr=fe(),E={},St="_magma_browser_map_",K=new Ke("[Mapper]"),bt=null,je=()=>(bt||(bt=new Promise((e,t)=>{wr.type===S.Browser?Promise.resolve().then(()=>(yr(),hr)).then(({WebStore:r})=>{let n=new r("local");Object.assign(E,n.get(St,{})),e(n)}).catch(t):e(void 0)})),bt),ve=(e={})=>je().then(()=>new Promise((t,r)=>{e=Object.assign({},qe,e);let n=e.catch?t:r;typeof navigator<"u"&&"geolocation"in navigator?navigator.geolocation.getCurrentPosition(s=>{let i=E.geolocation?.coords,o=i?.latitude?.toFixed(3),a=i?.longitude?.toFixed(3),c=E.geolocation?.timestamp??0,l=s.coords.latitude.toFixed(3)!==o,u=s.coords.longitude.toFixed(3)!==a,d=c<pr().epochMilliseconds-36e5;(l||u||d)&&(Object.assign(E,{georesponse:null}),K.info(e,"GeoLocation: device update")),Object.assign(E,{geolocation:Je(s)}),t(E.geolocation)},s=>{Object.assign(E,{geolocation:{error:s.message},georesponse:null}),n(E.geolocation)}):(Object.assign(E,{geolocation:{error:"Not Supported"},georesponse:null}),n(E.geolocation))})).finally(()=>{(E.geolocation?.error?K.error:K.info)(e,"geoLocation: ",E.geolocation),je().then(r=>r?.set(St,E))}),br=e=>new Promise((t,r)=>{if(!x(e))return t(e);ve().then(n=>x(n.error)?{location:{lat:n.coords.latitude,lng:n.coords.longitude}}:null).then(n=>t(n)).catch(n=>r(n))}),xt=(e,t={})=>je().then(()=>new Promise((r,n)=>{t=Object.assign({},qe,t);let s=t.catch?r:n;br(e).then(i=>{switch(!0){case(wr.type!==S.Browser||!window.google?.maps):throw new Error("Google Maps API not configured");case x(i):throw new Error("Cannot determine Coordinates");case x(e):{let o=E.geolocation&&E.georesponse,a=x(E.geolocation?.error)&&x(E.georesponse?.error);if(o&&a)return t.debug&&K.debug(t,"mapQuery: cache"),r(E.georesponse)}default:new window.google.maps.Geocoder().geocode(i).then(o=>r(E.georesponse=Je(o)))}}).catch(i=>{Object.assign(E,{georesponse:{error:i.message}}),s(E.georesponse)})})).finally(()=>{t.debug&&(E.georesponse?.error?K.error:K.debug)(t,"mapQuery: ",E.georesponse),je().then(r=>r?.set(St,E))}),dn=(e,t={})=>xt(e,t).then(r=>{if(t=Object.assign({},qe,t),x(r.error))return t.debug&&K.debug(t,"sphere: ",r),r.results[0].geometry.location.lat()>=0?"north":"south";let n=Ze();if(x(n)&&t.catch===!1)throw new Error("Cannot determine Hemisphere");return n}).catch(r=>{if(t.debug&&K.warn(t,"mapHemisphere: ",r.message),t.catch===!1)throw r;return null}),mn=(e,t={})=>xt(e,t).then(r=>{if(!x(r.error))throw new Error(r.error);return r.results[0]}).then(({formatted_address:r,address_components:n})=>n.reduce((s,i)=>(i.types.filter(o=>o!=="political").forEach(o=>s[o]=(s[o]?s[o]+",":"").concat(i.short_name)),s),{formatted_address:r})).catch(r=>{if(t=Object.assign({},qe,t),t.debug&&K.warn(t,"mapAddress: ",r.message),t.catch===!1)throw r;return null})});var _r={};ce(_r,{HTTP:()=>Or,HttpError:()=>j,METHOD:()=>Er,fetchHead:()=>hn,fetchRequest:()=>gn});var Ot,xr,Or,Er,j,Tr,gn,hn,Pr=T(()=>{"use strict";_();Ot=2e3,xr=/\);?$/,Or={Ok:200,PermRedirect:301,TempRedirect:302,BadRequest:400,Unauthorised:401,Forbidden:403},Er={Head:"HEAD",Get:"GET",Put:"PUT",Delete:"DELETE",Post:"POST"},j=class extends Error{status;statusText;body;constructor(t,r,n){super(`${t}: ${r}`),this.status=t,this.statusText=r,this.body=n,this.name="HttpError"}},Tr=async(e,t)=>{let r=e.headers?.get?.("Content-Length")||e.headers?.get?.("content-length");if(r){let a=parseInt(r,10);if(m(a)&&a>t){try{await e.body?.cancel()}catch{}throw new j(413,`Content-Length (${a}) exceeds limit (${t} bytes)`,null)}}if(!e.body){let a;if(b(e.text))a=await e.text();else if(b(e.json)){let l=await e.json();a=JSON.stringify(l)??""}else a="";let c=new TextEncoder().encode(a).byteLength;if(c>t)throw new j(413,`Payload length (${c}) exceeds limit (${t} bytes)`,null);return a}let n=e.body.getReader(),s=new TextDecoder,i=0,o="";try{for(;;){let{done:a,value:c}=await n.read();if(a)break;if(c){if(i+=c.byteLength,i>t){try{await n.cancel()}catch{}throw new j(413,`Streamed payload exceeded limit (${t} bytes)`,null)}o+=s.decode(c,{stream:!0})}}return o+=s.decode(),o}finally{try{n.releaseLock()}catch{}}},gn=(e,t={},r={})=>{let n={...t,signal:t.signal?AbortSignal.any([t.signal,AbortSignal.timeout(r.timeout??Ot)]):AbortSignal.timeout(r.timeout??Ot)};return fetch(e,n).then(async s=>{if(s.ok){let a=(s.headers?.get?.("Content-Type")||s.headers?.get?.("content-type")||"").includes("application/json");if(O(r.maxBytes)){let c=await Tr(s,r.maxBytes);if(r.rawText)return c;if(r.prefix){let l=c.startsWith(r.prefix)?c.substring(r.prefix.length).replace(xr,""):c;return JSON.parse(l)}if(a)return JSON.parse(c);try{return JSON.parse(c)}catch{return c}}if(r.rawText)return b(s.text)?await s.text():"";if(r.prefix){let c=await s.text(),l=c.startsWith(r.prefix)?c.substring(r.prefix.length).replace(xr,""):c;return JSON.parse(l)}if(b(s.text)){let c=await s.text();try{return JSON.parse(c)}catch{return c}}return b(s.json)?await s.json():""}let i=null;try{let o=O(r.maxBytes)?await Tr(s,r.maxBytes):b(s.text)?await s.text():"";try{i=JSON.parse(o)}catch{i=o}}catch(o){if(o instanceof j&&o.status===413)throw o}throw new j(s.status,s.statusText,i)})},hn=e=>{let t=AbortSignal.timeout(Ot),r={method:Er.Head,signal:t};return fetch(e,r).then(({ok:n,status:s,statusText:i,headers:o})=>{if(n||s===Or.Forbidden)return{status:s,headers:o};throw new j(s,i,null)})}});var vr={};ce(vr,{serverGeoCoords:()=>Ve,serverGeoLocation:()=>De,serverMapHemisphere:()=>Nt});var Nr,Pt,Et,_t,yn,De,Ve,Nt,vt=T(()=>{"use strict";_();yt();wt();Nr=new Ke("[ServerMapper]"),Pt="https://ipwho.is",Et={endpoint:`${Pt}/`,timeout:3e3,catch:!0,debug:0},_t=null,yn=()=>(_t||(_t=Promise.resolve().then(()=>(Pr(),_r))),_t),De=async(e={})=>{let t={...Et,...e},r=t.catch!==!1;try{let n=t.endpoint||Et.endpoint;if(g(t.ip)){let d=encodeURIComponent(t.ip.trim());if((n.endsWith("/")?n.slice(0,-1):n)===Pt)n=`${Pt}/${d}`;else if(n.includes("{ip}"))n=n.replace("{ip}",d);else if(d!=="")throw new Error(`Custom endpoint must include an '{ip}' placeholder to resolve a specific IP: ${n}`)}let s=t.timeout??Et.timeout,{fetchRequest:i}=await yn(),o=await i(n,{},{...m(s)?{timeout:s}:{},maxBytes:64*1024});if(typeof o!="object"||x(o))throw new Error("Geolocation lookup failed");if(o.status==="fail"||o.success===!1)throw new Error(o.message||o.reason||"Geolocation lookup failed");let a=m(o.lat)?o.lat:o.latitude,c=m(o.lon)?o.lon:o.lng??o.longitude;if(!m(a)||!m(c))throw new Error("Geolocation lookup failed");let l=g(o.timezone)?o.timezone:o.timezone?.id??o.timeZone,u={lat:a,lng:c,latitude:a,longitude:c,...g(o.country||o.countryName||o.country_name)?{country:o.country||o.countryName||o.country_name}:{},...g(o.city||o.cityName||o.city_name)?{city:o.city||o.cityName||o.city_name}:{},...g(l)?{timezone:l}:{},...g(o.query||o.ip||o.ip_address)?{query:o.query||o.ip||o.ip_address}:{},status:"success"};return t.debug&&Nr.info(t,"serverGeoLocation success: ",u),u}catch(n){let s=n?.message||"Server geolocation error";if(t.debug&&Nr.error(t,"serverGeoLocation error: ",s),!r)throw n;return{error:s,status:"fail"}}},Ve=async(e,t)=>{if(!x(e)){let n=e.latitude??e.lat,s=e.longitude??e.lng??e.lon??e.long;if(m(n)&&m(s))return{lat:n,lng:s}}let r=await De(t);return x(r.error)&&m(r.lat)&&m(r.lng)?{lat:r.lat,lng:r.lng}:null},Nt=async(e,t)=>{let r=await Ve(e,t);return r?r.lat>=0?"north":"south":Ze()??null}});var xn={};ce(xn,{GEO_PROPERTIES:()=>Ie,GeoPlugin:()=>It,clearStashedGeo:()=>Xe,coerceGeo:()=>re,default:()=>Sn,geoLocation:()=>ve,geoLookup:()=>Qe,geoPlugin:()=>bn,getStashedGeo:()=>ge,haversineDistance:()=>et,resolveGeoCoordinates:()=>Re,serverGeoCoords:()=>Ve,serverGeoLocation:()=>De,serverMapHemisphere:()=>Nt,solarOffset:()=>tt,stashGeo:()=>He});var z={};ce(z,{definePlugin:()=>nt,defineTerm:()=>Gr});ye(z,Ct(rt()));var Me=Ct(rt()),nt=e=>(0,Me.definePlugin)({...e,version:"1.0.0"}),Gr=e=>(0,Me.defineTerm)({...e,version:"1.0.0"});be();_();gt();_();function ee(...e){for(let t of e){let r=b(t)?t():t;if(r!==void 0)return r}}var Ye="_magma_geo_",Dr=1440*60*1e3,Ie=["latitude","lat","longitude","lng","lon","long","elevation","sphere","country","city","timezone","tz"],Ir=e=>m(e)&&e>=-90&&e<=90?Math.round(e*1e3)/1e3:void 0,Rr=e=>m(e)&&e>=-180&&e<=180?Math.round(e*1e3)/1e3:void 0,me=(e,t)=>{let r=Ir(e),n=Rr(t);return r!==void 0&&n!==void 0?{lat:r,lng:n}:void 0},ae=(e,t)=>{if(e==="north"||e==="south"||e==="equator")return e;if(m(t))return t>.001?"north":t<-.001?"south":"equator"},re=e=>{if(g(e)&&e.includes(",")){let p=e.split(",").map(w=>w.trim()).map(w=>w===""?NaN:Number(w));if(p.length>=2&&!isNaN(p[0])&&!isNaN(p[1])){let w=me(p[0],p[1]);if(w){let D={latitude:w.lat,longitude:w.lng},R=ae(void 0,w.lat);return R&&(D.sphere=R),D}}return}if(ue(e))return;if(Array.isArray(e)&&e.length>=2){let f=me(e[0],e[1]);if(f){let p={latitude:f.lat,longitude:f.lng},w=ae(void 0,f.lat);return w&&(p.sphere=w),p}return}let t=e.geo??e,r=e.config?.geo??e.config,n=ee(t?.latitude,t?.lat,e.latitude,e.lat,r?.latitude,r?.lat),s=ee(t?.longitude,t?.lng,t?.lon,t?.long,e.longitude,e.lng,e.lon,e.long,r?.longitude,r?.lng,r?.lon,r?.long),i=ee(t?.elevation,e.elevation,r?.elevation),o=ee(t?.sphere,e.sphere,r?.sphere),a=ee(t?.country,e.country,r?.country),c=ee(t?.city,e.city,r?.city),l=ee(t?.timezone,t?.tz,e.timezone,e.tz,r?.timezone,r?.tz),u={},d=Ir(n),h=Rr(s);d!==void 0&&(u.latitude=d),h!==void 0&&(u.longitude=h),m(i)&&(u.elevation=Math.round(i*1e3)/1e3);let P=ae(o,u.latitude);P&&(u.sphere=P),g(a)&&(u.country=a),g(c)&&(u.city=c),g(l)&&(u.timezone=l);let v=F(e.geo)?e.geo:F(e.config?.geo)?e.config.geo:void 0;if(F(v))for(let f of Object.keys(v))J(f)&&!Ie.includes(f)&&(u[f]=v[f]);return Object.keys(u).length>0?u:void 0},Dt=e=>{if(g(e)&&!C(e)){let t=e.trim();return t.startsWith(Ye)?t:`${Ye}:${t}`}if(e&&N(e)){let t=e.key??e.ip??e.query;if(g(t)&&!C(t))return`${Ye}:${t.trim()}`}return Ye},ge=e=>{let t=Dt(e);try{let r=sr(t)??(typeof localStorage<"u"?localStorage.getItem(t):void 0);if(!r)return;let n=g(r)&&(r.startsWith("{")||r.startsWith("["))?JSON.parse(r):r;if(N(n)&&m(n._expires)&&Date.now()>n._expires){Xe(e);return}if(g(n)&&n.includes(",")){let s=n.split(",").map(o=>parseFloat(o.trim())),i=me(s[0],s[1]);if(i)return{latitude:i.lat,longitude:i.lng,sphere:ae(void 0,i.lat)}}if(N(n)){let s=n.geolocation?.coords??n.coords??n,i=s?.latitude??s?.lat,o=s?.longitude??s?.lng??s?.lon??s?.long,a=me(i,o);if(a){let c={latitude:a.lat,longitude:a.lng},l=n.elevation??s.elevation;return m(l)&&(c.elevation=Math.round(l*1e3)/1e3),c.sphere=ae(n.sphere,a.lat),g(n.country)&&(c.country=n.country),g(n.city)&&(c.city=n.city),g(n.timezone)&&(c.timezone=n.timezone),c}}}catch{}},He=(e,t=Dr,r)=>{let n=Dt(r),s=m(t)&&t>0?{...e,_expires:Date.now()+t}:e;mt(n,s,{ttl:t})},Xe=e=>{let t=Dt(e);mt(t,void 0)},Qe=async(e={})=>{if(e.refresh!==!0){let a=ge(e);if(a&&m(a.latitude)&&m(a.longitude)){let{latitude:c,longitude:l,...u}=a;return{...u,status:"cached",lat:c,lng:l,latitude:c,longitude:l}}}let{type:r}=fe(),n;switch(r){case S.Browser:{let{geoLocation:a}=await Promise.resolve().then(()=>(Tt(),Sr)),c=await a(e);if(c.error)return{error:c.error};let l=c.coords?.latitude,u=c.coords?.longitude;n={...c,lat:l,lng:u,latitude:l,longitude:u};break}case S.WebWorker:case S.NodeJS:case S.Deno:default:{let{serverGeoLocation:a}=await Promise.resolve().then(()=>(vt(),vr));n=await a(e);break}}let s=n.latitude??n.lat,i=n.longitude??n.lng,o=me(s,i);if(x(n.error)&&o){let a=ae(n.sphere,o.lat);n.lat=o.lat,n.lng=o.lng,n.latitude=o.lat,n.longitude=o.lng,n.sphere=a;let c={latitude:o.lat,longitude:o.lng,sphere:a,...g(n.city)?{city:n.city}:{},...g(n.country)?{country:n.country}:{},...m(n.elevation)?{elevation:Math.round(n.elevation*1e3)/1e3}:{},...g(n.timezone)?{timezone:n.timezone}:{}};try{let l=m(e.ttl)?e.ttl:Dr;He(c,l,e)}catch{}}return n},Re=async(e,t={})=>{let r=re(e);if(r&&m(r.latitude)&&m(r.longitude))return{...r,lat:r.latitude,lng:r.longitude};let n=t.refresh===!0?void 0:ge(t);if(n&&m(n.latitude)&&m(n.longitude))return{...n,lat:n.latitude,lng:n.longitude};let s=await Qe(t),i=me(s.lat,s.lng);if(x(s.error)&&i){let o=ae(s.sphere,i.lat);return{...s,lat:i.lat,lng:i.lng,latitude:i.lat,longitude:i.lng,sphere:o}}return null};function et(e,t,r="km"){let n=re(e),s=re(t);if(!n||!s||!m(n.latitude)||!m(n.longitude)||!m(s.latitude)||!m(s.longitude))return NaN;let i=Math.PI/180,o=n.latitude*i,a=n.longitude*i,c=s.latitude*i,l=s.longitude*i,u=c-o,d=l-a,h=Math.sin(u/2)**2+Math.cos(o)*Math.cos(c)*Math.sin(d/2)**2,P=2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h)),v;r==="miles"?v=3958.7613:r==="m"?v=63710088e-1:v=6371.0088;let f=v*P;return r==="m"?Math.round(f):Math.round(f*1e3)/1e3}var wn=(e,t)=>{try{if(typeof Temporal<"u"&&typeof Temporal.Instant?.fromEpochMilliseconds=="function")return Temporal.Instant.fromEpochMilliseconds(t).toZonedDateTimeISO(e).offsetNanoseconds/6e10;let n=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset",year:"numeric"}).formatToParts(new Date(t)).find(s=>s.type==="timeZoneName")?.value;if(n){if(n==="GMT"||n==="UTC")return 0;let s=n.match(/GMT([+-])(\d{2}):(\d{2})/);if(s)return(s[1]==="-"?-1:1)*(parseInt(s[2],10)*60+parseInt(s[3],10))}}catch{}};function tt(e,t){let r=re(e);if(!r||!m(r.latitude)||!m(r.longitude)||isNaN(r.latitude)||isNaN(r.longitude))return NaN;let n=r.longitude,s=t?.timeZone??(F(e)?e.timezone??e.tz:void 0)??r.timezone,i=t?.date??(F(e)&&m(e.epoch?.ms)?e.epoch.ms:Date.now()),o=typeof i=="number"?i:g(i)?Date.parse(i):st(i)?i.getTime():F(i)&&m(i?.epoch?.ms)?i.epoch.ms:Date.now();if(!Number.isFinite(o))return NaN;let a=Gt(s)?wn(s,o):void 0,c=a!==void 0?a/60*15:Math.round(n/15)*15,u=(n-c)*4;if(t?.apparent){let f=new Date(o),p=Date.UTC(f.getUTCFullYear(),0,1),w=Math.floor((o-p)/864e5)+1,D=2*Math.PI/365*(w-1),R=229.18*(75e-6+.001868*Math.cos(D)-.032077*Math.sin(D)-.014615*Math.cos(2*D)-.040849*Math.sin(2*D));u+=R}let d=t?.unit??"minutes",h;d==="seconds"?h=u*60:d==="hours"?h=u/60:h=u;let P=t?.precision??2,v=Math.pow(10,P);return Math.round(h*v)/v}vt();Tt();_();var It=nt({name:"geo",install(e){Object.defineProperty(e,"geo",{value:(0,z.deepFreeze)({lookup:Qe,resolve:Re,coerce:re,distance:et,solarOffset:tt,stash:He,clear:Xe,get:ge,server:De,browser:ve,get current(){return ge()??e.config?.geo}}),writable:!1,configurable:!1,enumerable:!1}),e.prototype.geoLocate=async function(r){let n=r?.setTimezone!==!1,s=await Re(this,r);if(s){let i=typeof this.config.geo=="object"&&this.config.geo!==null?this.config.geo:{},o={};for(let h of Object.keys(i))J(h)&&!Ie.includes(h)&&(o[h]=i[h]);let a=re(r)??{};if(r&&typeof r=="object")for(let h of Object.keys(r))J(h)&&!["setTimezone","refresh","ttl","endpoint","timeout","catch","debug","geo"].includes(h)&&(Ie.includes(h)||(o[h]=r[h]));let c=m(s?.elevation)?s.elevation:m(i.elevation)?i.elevation:void 0,l={...o,...s,...m(c)?{elevation:c}:{},...a};m(l.latitude)&&(l.latitude=Math.round(l.latitude*1e3)/1e3),m(l.longitude)&&(l.longitude=Math.round(l.longitude*1e3)/1e3),!l.sphere&&m(l.latitude)&&(l.sphere=l.latitude>.001?"north":l.latitude<-.001?"south":"equator");let u=this,d=l.timezone;return n&&g(d)&&!C(d)&&(u=this.set({timeZone:d})),new e(u,{...u.config,geo:(0,z.deepFreeze)(l),...l.sphere?{sphere:l.sphere}:{}})}return this},e.prototype.geoLookup=async function(r){return Re(this,r)},e.prototype.geoDistance=function(r,n){return et(this,r,n)},e.prototype.geoSolarOffset=function(r){return tt(this,r)}}}),bn=It,Sn=It;return zr(xn);})();