@magmacomputing/tempo-plugin-geo 1.0.0 → 1.1.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 +8 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.global.min.js +1 -1
- package/dist/index.js +492 -132
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ 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.1.0] - 2026-09-16
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Plugin Options Merging & Callable Plugin Support**:
|
|
12
|
+
- `GeoPlugin.install` now accepts resolved options passed by `Tempo.use(GeoPlugin, options)` or `Tempo.use(GeoPlugin(options))` or tuple syntax `[GeoPlugin, options]`.
|
|
13
|
+
- Merges class defaults (`installedClass.config?.pluginOptions?.geo`), plugin registration options, instance options, and call-site options prior to coordinate resolution and lookup.
|
|
14
|
+
- Ensures call-site options override configured defaults (such as `timeout` and `highAccuracy`) while preserving existing coordinate resolution behavior.
|
|
15
|
+
|
|
8
16
|
## [1.0.0] - 2026-09-08
|
|
9
17
|
|
|
10
18
|
### Changed (Breaking Changes)
|
package/dist/index.d.ts
CHANGED
|
@@ -31,11 +31,19 @@ export interface TempoGeoNamespace {
|
|
|
31
31
|
/** Current ambient or global coordinates snapshot (reads getStashedGeo() ?? Tempo.config.geo) */
|
|
32
32
|
readonly current: GeoConfig | undefined;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Options for configuring the Geo plugin.
|
|
36
|
+
*/
|
|
37
|
+
export type GeoPluginOptions = Partial<GeoConfig> & {
|
|
38
|
+
timeout?: number;
|
|
39
|
+
highAccuracy?: boolean;
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
};
|
|
34
42
|
/**
|
|
35
43
|
* GeoPlugin installs geolocation lookup and coordinate resolution helpers onto Tempo under the `Tempo.geo` namespace.
|
|
36
44
|
*/
|
|
37
|
-
export declare const GeoPlugin: TempoPlugin
|
|
38
|
-
export declare const geoPlugin: TempoPlugin
|
|
45
|
+
export declare const GeoPlugin: TempoPlugin<GeoPluginOptions>;
|
|
46
|
+
export declare const geoPlugin: TempoPlugin<GeoPluginOptions>;
|
|
39
47
|
export default GeoPlugin;
|
|
40
48
|
declare module '@magmacomputing/tempo' {
|
|
41
49
|
interface Tempo {
|
package/dist/index.global.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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);})();
|
|
1
|
+
"use strict";var Magma;((Magma||={}).plugins||={}).geo=(()=>{var qr=Object.create;var Be=Object.defineProperty;var Hr=Object.getOwnPropertyDescriptor;var Vr=Object.getOwnPropertyNames;var Xr=Object.getPrototypeOf,Qr=Object.prototype.hasOwnProperty;var E=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var en=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},ge=(e,t)=>{for(var r in t)Be(e,r,{get:t[r],enumerable:!0})},Je=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Vr(t))!Qr.call(e,o)&&o!==r&&Be(e,o,{get:()=>t[o],enumerable:!(n=Hr(t,o))||n.enumerable});return e},Oe=(e,t,r)=>(Je(e,t,"default"),r&&Je(r,t,"default")),jt=(e,t,r)=>(r=e!=null?qr(Xr(e)):{},Je(t||!e||!e.__esModule?Be(r,"default",{value:e,enumerable:!0}):r,e)),tn=e=>Je(Be({},"__esModule",{value:!0}),e);var pt=en((ao,Yt)=>{"use strict";Yt.exports=window.Magma.pluginSdk});var nn,on,sn,an,cn,ln,un,fn,qt,pn,Ht,w,Z=E(()=>{"use strict";nn=Symbol.for("$LibraryTarget"),on=Symbol.for("$LibraryDiscover"),sn=Symbol.for("$LibraryExtensible"),an=Symbol.for("nodejs.util.inspect.custom"),cn=Symbol.for("$LibraryLogConfig"),ln=Symbol.for("$LibraryRegistry"),un=Symbol.for("$LibraryRegister"),fn=Symbol.for("$LibrarySerializerRegistry"),qt=Symbol.for("$LibraryMutable"),pn=Symbol.for("$LibraryIdentity"),Ht=Symbol.for("$LibraryUnwrapped"),w={$Target:nn,$Discover:on,$Extensible:sn,$Inspect:an,$LogConfig:cn,$Registry:ln,$Register:un,$SerializerRegistry:fn,$Identity:pn,$Mutable:qt,$Unwrapped:Ht}});function he(e){let t=e,r=0,n=50;for(;t;){let o=t[w.$Target];if(!o||r>=n)break;t=o,r++}return t}function C(e,t=!1){if(!e||typeof e!="object")return[];let r=he(e);if(!t){let u=Reflect.ownKeys(r),f=[];for(let d of u){let h=Object.getOwnPropertyDescriptor(r,d);h&&h.enumerable&&f.push([d,r[d]])}return f}let n=[],o=50,s=0,i=r;for(;i&&i!==Object.prototype&&s++<o;)n.push(he(i)),i=Object.getPrototypeOf(i);let a=[],c=new Set;for(let u of n.reverse()){let f=Reflect.ownKeys(u);for(let d of f){if(c.has(d))continue;let h=Object.getOwnPropertyDescriptor(u,d);!h||!h.enumerable||(c.add(d),a.push([d,r[d]]))}}return a}function Ke(e,t=!1){return C(e,t).map(([r])=>r)}function Vt(e,t=!1){return C(e,t).map(([r,n])=>n)}function je(e,t,r){return t?je(e.map(t,r)):Array.from(new Set(e))}var K=E(()=>{"use strict";Z()});var mt,gt,Ye,ue,V,dn,mn,qe,J=E(()=>{"use strict";Z();K();mt=[],gt=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"?he(e):e;return Object.prototype.toString.call(r).slice(8,-1)}catch{return t==="function"?"Function":"Object"}},Ye=e=>{try{let t=e?.[Symbol.toStringTag]??e?.prototype?.[Symbol.toStringTag];if(typeof t=="string")return t}catch{}},ue=(e,...t)=>{let r=e;try{r=e?.[w.$Target]??e}catch{r=e}let n=gt(r);switch(n){case"Function":try{return mn(r)?"Class":"Function"}catch{return"Function"}case"Object":{try{if("length"in r&&Object.keys(r).every(s=>s==="length"||Number.isFinite(Number(s))))return"ArrayLike";for(let s of t){let i=s.class?.[w.$Target]??s.class;if(r===i||i&&r instanceof i)return s.type}let o=globalThis[w.$Registry]??[];for(let s of[...mt,...o]){let i=s.class?.[w.$Target]??s.class;if(r===i||i&&r instanceof i)return s.type}}catch{return"Object"}return"Object"}default:return n}},V=(e,...t)=>({type:ue(e,...t),value:e}),dn=/^\s*(class\s|\[native code\])/,mn=e=>{if(typeof e!="function")return!1;let t=e?.[w.$Target]??e;if(!("prototype"in t))return!1;let r=t?.name,n=Ye(t);if(t?.[w.$Identity]||t?.prototype?.[w.$Identity]||typeof n=="string"&&n.startsWith("Temporal."))return!0;if(typeof n=="string"&&n.endsWith("Function"))return!1;if((globalThis[w.$Registry]??[]).some(s=>(s.class?.[w.$Target]??s.class)===t||r&&s.type===r||n&&s.type===n))return!0;try{let s=Function.prototype.toString.call(t);if(dn.test(s))return!0;let i=Object.getOwnPropertyDescriptor(t,"prototype");if(i&&i.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},qe=(e,t)=>{if(typeof e!="function")return;let r=Ye(e),n=t??r??e.name;n&&!["Object","Function",""].includes(n)&&(mt.some(o=>o.class===e)||mt.push({class:e,type:n}))}});function He(e){switch(typeof e){case"number":return Number.isFinite(e);case"bigint":return!0;case"string":{let r=e.trim();return r.length===0?!1:gn.test(r)||g(Number(r))}default:return!1}}var W,X,$,Xt,m,Qt,g,gn,ht,fe,er,T,Ee,tr,Q,yt,k,_,j,N,S,A,_e,Ne,Ve,Pe,R,P=E(()=>{"use strict";Z();J();W=(e,...t)=>t.includes(ue(e)),X=e=>e===null||typeof e!="object"&&typeof e!="function",$=e=>!X(e),Xt=e=>Symbol.iterator in Object(e)&&!m(e),m=e=>typeof e=="string",Qt=e=>typeof e=="string"&&e.trim().length>0,g=e=>Number.isFinite(e),gn=/^[+-]?[0-9]+n$/;ht=e=>typeof e=="bigint",fe=e=>Array.isArray(e),er=e=>gt(e)==="Object"&&"length"in e&&Object.keys(e).every(t=>t==="length"||g(Number(t))),T=e=>W(e,"Object"),Ee=e=>W(e,"Date"),tr=e=>W(e,"RegExp"),Q=e=>typeof e=="symbol",yt=e=>typeof e=="symbol"&&Symbol.keyFor(e)!==void 0,k=e=>e!=="__proto__"&&e!=="constructor"&&e!=="prototype",_=e=>e==null||W(e,"Void","Empty"),j=e=>e===void 0||W(e,"Void","Empty"),N=e=>e!=null&&!_(e),S=e=>W(e,"Function","AsyncFunction","GeneratorFunction","AsyncGeneratorFunction"),A=e=>typeof e=="function",_e=e=>W(e,"Map"),Ne=e=>W(e,"Set"),Ve=(e,t)=>W(e,"Error")&&(t?e instanceof t:!0),Pe=e=>typeof Intl<"u"&&typeof Intl.Locale=="function"&&e instanceof Intl.Locale,R=e=>_(e)||T(e)&&Reflect.ownKeys(e).length===0||m(e)&&e.trim().length===0||typeof e=="number"&&Number.isNaN(e)||fe(e)&&e.length===0||Ne(e)&&e.size===0||_e(e)&&e.size===0||ArrayBuffer.isView(e)&&e.byteLength===0||Ee(e)&&Number.isNaN(e.getTime())});function wt(e,t,r=new WeakSet){let n=t instanceof WeakSet?t:t?.skip??hn;return X(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[w.$Extensible]?e:(r.add(e),C(e).forEach(([o,s])=>{k(o)&&wt(s,{skip:n},r)}),Object.freeze(e))}var x,ye,hn,De=E(()=>{"use strict";K();P();Z();x={Unknown:"unknown",Browser:"browser",WebWorker:"web-worker",NodeJS:"nodejs",Deno:"deno",GoogleAppsScript:"google-apps-script"},ye=()=>{let e=globalThis;try{if(N(e.SpreadsheetApp))return{global:e,type:x.GoogleAppsScript};if(N(e.window?.document))return{global:e,type:x.Browser};if(S(e.importScripts)||N(e.WorkerGlobalScope)&&e instanceof e.WorkerGlobalScope)return{global:e,type:x.WebWorker};if(N(e.Deno))return{global:e,type:x.Deno};if(N(e.process?.versions?.node)&&e.process?.release?.name==="node")return{global:e,type:x.NodeJS}}catch{}return{global:e,type:x.Unknown}},hn=new WeakSet});function rr(e){return Object.fromEntries(C(e,!0))}var nr=E(()=>{"use strict";K();J();P()});function ir(e,t={},r=!1){let{frozen:n,lock:o,appendOnly:s,onGet:i,keys:a,bind:c,skip:u}=t,f=new Set,d,h,b=he(e);o&&wt(b,u?{skip:u}:void 0),qe(b);let O={isExtensible:l=>Reflect.isExtensible(l),getPrototypeOf:l=>Reflect.getPrototypeOf(l),setPrototypeOf:(l,p)=>{if(n)throw new TypeError("Security: Prototype mutation attempt on protected object");return Reflect.setPrototypeOf(l,p)},getOwnPropertyDescriptor:(l,p)=>{if(!(a&&!a.includes(p))){if(a){if(i&&!Q(p)&&!f.has(p)){f.add(p);try{let y=i(p,l);if(N(y))return{enumerable:!0,configurable:!0,value:y}}finally{f.delete(p)}}return{enumerable:!0,configurable:!0}}return Reflect.getOwnPropertyDescriptor(l,p)}},ownKeys:l=>{if(a)return a;if(i&&!f.has(w.$Discover)){f.add(w.$Discover);try{i(w.$Discover,l)}finally{f.delete(w.$Discover)}}return Reflect.ownKeys(l)},has:(l,p)=>a?a.includes(p):Reflect.has(l,p),deleteProperty:(l,p)=>{if(n)throw new TypeError(`Cannot delete property '${String(p)}' from a protected object.`);if(s&&Reflect.has(l,p))throw new Error(`Security: Deletion attempt on protected key '${String(p)}'`);return Reflect.deleteProperty(l,p)},defineProperty:(l,p,y)=>{if(n&&!Object.isFrozen(l))throw new TypeError(`Cannot define property '${String(p)}' on a frozen object.`);if(s&&Reflect.has(l,p))throw new Error(`Security: Mutation attempt on protected key '${String(p)}'`);return Reflect.defineProperty(l,p,y)},set:(l,p,y,I)=>{if(n&&I===h)throw new TypeError(`Cannot set property '${String(p)}' on a frozen object.`);if(s){if(Array.isArray(l)&&p==="length"&&y<l.length)throw new Error("Security: Truncation attempt on protected array.");if(!(Array.isArray(l)&&p==="length")&&Reflect.has(l,p))throw new Error(`Security: Mutation attempt on protected key '${String(p)}'`)}return Reflect.set(l,p,y,I)},get:(l,p,y)=>{if(p===w.$Target)return y===h?l:void 0;if(n&&(p===w.$Inspect||p==="toJSON")){let v=Object.getOwnPropertyDescriptor(l,p);return v&&S(v.value)?v.value:(d||(d=()=>rr(l)),d)}if(a&&!a.includes(p))return;if(i&&!Q(p)&&!Reflect.has(l,p)&&!f.has(p)){f.add(p);try{let v=i(p,l);if(N(v))return v}finally{f.delete(p)}}let I=Reflect.get(l,p,y);if(c&&p!=="constructor"&&S(I)){let v=Object.getOwnPropertyDescriptor(l,p);if(v&&!v.configurable&&!v.writable)return I;let ce=or.get(I);ce||(ce=new WeakMap,or.set(I,ce));let le=ce.get(l);if(le)return le;let Kt=I.bind(l);return ce.set(l,Kt),Kt}return I}};if(r){let l=Proxy.revocable(b,O);return h=l.proxy,{proxy:l.proxy,revoke:l.revoke}}return h=new Proxy(b,O),h}function sr(e,t=!0,r=t,n=new WeakSet){return ir(e,{frozen:t,lock:r,skip:n,bind:t})}function Ie(e,t=new WeakSet){return ir(e,{frozen:!0,lock:!0,skip:t,bind:!0})}var or,Xe=E(()=>{"use strict";Z();nr();De();K();P();J();or=new WeakMap});function ve(e,t=new WeakSet){return JSON.stringify(e,function(r,n){if(n===void 0)return"\0__undefined__\0";if(ht(n))return`\0__bigint:${n}__\0`;if(S(n))return`function:${n.name||"anonymous"}`;if($(n)){if(t.has(n))return"<Circular>";if(t.add(n),Pe(n))return n.toString();if(_e(n))return`map:[${Array.from(n.entries()).map(o=>ve(o,t)).sort().join(",")}]`;if(Ne(n))return`set:[${Array.from(n).map(o=>ve(o,t)).sort().join(",")}]`}return n})}function cr(e){return function t(...r){return r.length>=e.length?e(...r):(...n)=>t(...r,...n)}}function M(e){let t=new Map;return function(...r){let n=ve(this!==void 0&&this!==globalThis?[this,...r]:r);if(!t.has(n)){let o=e.apply(this,r);t.set(n,o)}return t.get(n)}}function Re(e,t){return{enumerable:!1,configurable:!1,writable:!1,value:function(...r){let n=`${String(e)},${ve(r)}`,o=ar.get(this);if(o||(o=new Map,ar.set(this,o)),!o.has(n)){let s=t.apply(this,r);Ie(s),o.set(n,s)}return o.get(n)}}}var ar,Qe=E(()=>{"use strict";Xe();P();ar=new WeakMap});function lr(e){try{return JSON.parse(JSON.stringify(e))}catch(t){throw console.warn("Could not clean object:",t?.message??t),t}}var ur=E(()=>{"use strict";P()});function te(e){return N(e)?S(e)?e():e:t=>S(t)?t():t}var wn,ee,St=E(()=>{"use strict";K();P();J();wn=e=>{let t=new Set,r=e,n=0;for(;r&&r!==Object.prototype&&n++<10;){let o=Object.getOwnPropertyDescriptors(r);for(let[s,i]of Object.entries(o))k(s)&&(i.enumerable||S(i.get))&&t.add(s);r=Object.getPrototypeOf(r)}return Array.from(t)},ee=e=>{if(X(e)||S(e))return e;if(fe(e))return e.map(r=>ee(r));if(Ee(e)||tr(e)||_e(e)||Ne(e))return e;try{if(S(e.toJSON))return ee(e.toJSON())}catch{}let t={};for(let r of wn(e))try{t[r]=ee(e[r])}catch{}return t};te.stringSymbol=te();te.symbolRegExp=te();te.symbolString=te();te.stringString=te()});function mr(e,t){try{return globalThis.structuredClone(e,t)}catch{return lr(e)}}function Sn(e,t){return xn(t)}function pr(e){let t=encodeURI(e);return t.includes("%")&&(t=t.replace(bn,r=>gr[r.toUpperCase()]??decodeURI(r))),t}function xn(e){if(m(e))try{return decodeURI(e)}catch{}return e}function Ce(e){return!W(e,"Function","AsyncFunction","WeakMap","WeakSet","WeakRef")}function Tn(e,t){return`{"$${e}":${t}}`}function On(e){return F(Q(e)?`${yt(e)?"@":""}@(${e.description??""})`:e)}function bt(e){let[t,r,n]=e.toString().match(En)||[null,void 0,void 0];switch(!0){case Q(e):case _(t):case(N(r)&&j(n)):return e;case N(r):return Symbol.for(n);case j(r):default:return Symbol(n)}}function B(e,t){let r=pe;pe=t?.compact!==!1;try{let n=F(e,!1);if(t?.signed){if(!m(t.secret)||!t.secret)throw new TypeError("stringify: signed serialization requires an explicit secret string");return`$sig:${hr(n,t.secret)}:${n}`}return n}finally{pe=r}}function F(e,t=!0){let r=V(e),n=cr(Tn)(r.type);switch(r.type){case"String":{let o=r.value;return o.startsWith("~")&&(o=`~${o}`),t||(t=o==="true"||o==="false"||o==="null"||parseFloat(o).toString()===o||o.startsWith("~")),t?JSON.stringify(pr(o)):pr(o)}case"Boolean":case"Null":case"Number":return JSON.stringify(r.value);case"Void":case"Undefined":return pe?JSON.stringify("~u"):n(JSON.stringify("void"));case"BigInt":return pe?JSON.stringify(`~n${r.value.toString()}`):n(r.value.toString());case"Date":return pe?JSON.stringify(`~t${r.value.getTime()}`):n(F(r.value.toJSON()));case"Object":return`{${C(r.value).filter(([,s])=>Ce(s)).map(([s,i])=>`${On(s)}: ${F(i)}`).join(",")}}`;case"Array":return`[${r.value.filter(s=>Ce(s)).map(s=>F(s)).join(",")}]`;case"Map":{let o=Array.from(r.value.entries()).filter(([,s])=>Ce(s)).map(([s,i])=>`[${F(s)}, ${F(i)}]`).join(",");return n(`[${o}]`)}case"Set":{let o=Array.from(r.value.values()).filter(s=>Ce(s)).map(s=>F(s)).join(",");return n(`[${o}]`)}case"Symbol":{let o=`${yt(r.value)?"@":""}@(${r.value.description??""})`;return pe?JSON.stringify(`~y${o}`):n(JSON.stringify(o))}case"RegExp":return n(F({source:r.value.source,flags:r.value.flags}));default:{let o=r.value;switch(!0){case!Ce(o):return;case S(o.toJSON):return n(F(o.toJSON()));case(S(o.toString)&&o.toString!==Object.prototype.toString):{let s=o.toString();return n(s.includes('"')?s:JSON.stringify(s))}case(S(o.valueOf)&&o.valueOf!==Object.prototype.valueOf):return n(JSON.stringify(o.valueOf()));default:{let s=ee(o);return $(s)&&Object.keys(s).length>0?F(s):n(JSON.stringify(o,(i,a)=>R(i)?a:F(a)))}}}}}function de(e,t){if(!m(e))return e;let r=S(t)?{sentinel:t}:t??{};if(e.startsWith("$sig:")){let o=e.indexOf(":",5);if(o!==-1){let s=e.substring(5,o),i=e.substring(o+1);if(!m(r.secret)||!r.secret){if(console.warn("objectify: signature verification requires an explicit secret string"),r.throwOnError)throw new TypeError("objectify: signature verification requires an explicit secret string");return e}let a=hr(i,r.secret);if(!Nn(s,a)){if(console.warn("objectify: signature verification failed"),r.throwOnError)throw new Error("objectify: signature verification failed");return e}e=i}else if(r.requireSigned){if(console.warn("objectify: malformed signed payload"),r.throwOnError)throw new Error("objectify: malformed signed payload");return e}}else if(r.requireSigned){if(console.warn("objectify: unsigned string rejected by requireSigned policy"),r.throwOnError)throw new Error("objectify: unsigned string rejected by requireSigned policy");return e}let n;try{n=JSON.parse(e,Sn)}catch(o){return e.startsWith('"')&&e.endsWith('"')?(console.warn(`objectify.parse: -> ${e}, ${o.message}`),e):de(`"${e}"`,r.requireSigned?{...r,requireSigned:!1}:r)}switch(!0){case(e.startsWith("{")&&e.endsWith("}")):case(e.startsWith("[")&&e.endsWith("]")):return xt(n,r,0);default:return Ae(n,r)}}function xt(e,t,r=0){let n=t.maxDepth??Pn;return r>=n?e:T(e)?Ae(C(e).filter(([o])=>k(o)).reduce((o,[s,i])=>Object.assign(o,{[bt(s)]:Ae(xt(i,t,r+1),t)}),{}),t):fe(e)?Vt(e).map(o=>Ae(xt(o,t,r+1),t)):Ae(e,t)}function Ae(e,t){if(m(e)&&e.startsWith("~"))try{if(e.startsWith("~~"))return e.substring(1);if(e.startsWith("~n"))return BigInt(e.substring(2));if(e.startsWith("~t")){let s=e.substring(2),i=new Date(He(s)?Number(s):s);return isNaN(i.getTime())?e:i}if(e==="~u")return t.sentinel?.();if(e.startsWith("~y"))return bt(e.substring(2))}catch{return e}if(!T(e)||Ke(e).length!==1)return e;let[r,n]=C(e)[0];if(!String(r).startsWith("$"))return e;let o=r.substring(1);try{switch(o){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.sentinel?.();case"Date":return new Date(n);case"RegExp":return t.allowRegExp===!1||!T(n)||!m(n.source)||n.source.length>Dn?e:new RegExp(n.source,n.flags);case"Symbol":return bt(n);case"Map":return fe(n)?new Map(n):e;case"Set":return fe(n)?new Set(n):e;default:{if(t.allowClasses===!1||t.allowedClasses&&!(t.allowedClasses instanceof Set?t.allowedClasses.has(r)||t.allowedClasses.has(o):t.allowedClasses.includes(r)||t.allowedClasses.includes(o)))return e;let s=et.get(r);return s?Reflect.construct(s,[n]):(console.warn(`objectify: dont know how to deserialize '${o}'`),e)}}}catch{return e}}var et,fr,dr,gr,bn,En,_n,hr,Nn,pe,Pn,Dn,we=E(()=>{"use strict";Qe();K();ur();St();J();P();Z();et=globalThis[w.$SerializerRegistry]??=new Map,fr=e=>{try{let t=e?.prototype?.[Symbol.toStringTag]??e?.[Symbol.toStringTag];return m(t)?t:void 0}catch{return}},dr=(e,t)=>{let r=e.startsWith("$")?e:`$${e}`;if(et.has(r)){let n=et.get(r),o=fr(n),s=fr(t),i=n.name||o,a=t.name||s||(e.startsWith("$")?e.slice(1):e);if(n===t||n.toString()===t.toString()||!!t[w.$Identity]&&n[w.$Identity]===t[w.$Identity]||!!t[w.$Target]&&n[w.$Target]===t[w.$Target]||!!i&&!!a&&i===a)return;throw new Error(`[registerSerializable] Collision: '${r}' is already registered with ${n.name||"anonymous constructor"}`)}et.set(r,t)};gr={"%20":" ","%22":'"',"%3B":";","%3C":"<","%3E":">","%5B":"[","%5D":"]","%5E":"^","%7B":"{","%7C":"|","%7D":"}"},bn=new RegExp(Object.keys(gr).join("|"),"gi");En=/^@(@)?\(([^\)]*)\)$/;_n=globalThis.crypto?.randomUUID?globalThis.crypto.randomUUID().split("-")[0]:Math.random().toString(36).slice(2,10),hr=(e,t=_n)=>{let r=2166136261,n=2654435769,o=`${t}:${e}`;for(let s=0;s<o.length;s++){let i=o.charCodeAt(s);r=Math.imul(r^i,16777619),n=Math.imul(n^i,2246822507)}return(r>>>0).toString(16).padStart(8,"0")+(n>>>0).toString(16).padStart(8,"0")},Nn=(e,t)=>{if(!m(e)||!m(t)||e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e.charCodeAt(n)^t.charCodeAt(n);return r===0},pe=!0;Pn=64,Dn=512});function re(e,t,r,n,o,s){function i(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}for(var a=n.kind,c=a==="getter"?"get":a==="setter"?"set":"value",u=!t&&e?n.static?e:e.prototype:null,f=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),d,h=!1,b=r.length-1;b>=0;b--){var O={};for(var l in n)O[l]=l==="access"?{}:n[l];for(var l in n.access)O.access[l]=n.access[l];O.addInitializer=function(y){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(i(y||null))};var p=(0,r[b])(a==="accessor"?{get:f.get,set:f.set}:f[c],O);if(a==="accessor"){if(p===void 0)continue;if(p===null||typeof p!="object")throw new TypeError("Object expected");(d=i(p.get))&&(f.get=d),(d=i(p.set))&&(f.set=d),(d=i(p.init))&&o.unshift(d)}else(d=i(p))&&(a==="field"?o.unshift(d):f[c]=d)}u&&Object.defineProperty(u,n.name,f),h=!0}function ne(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}var $e=E(()=>{"use strict"});function yr(e,t){return Ye(e)??(j(t)?e.name||void 0:String(t))}function wr(e,{kind:t,name:r,addInitializer:n}){let o=yr(e,r);if(o&&qe(e,o),t==="class")return o&&n(()=>dr(o,e)),e;throw new Error(`@Serializable decorating unknown 'kind': ${t} (${r})`)}function oe(e,t){let r=(n,o,s)=>{let i=n.prototype,a=o??yr(n,s);if(a&&(i&&!Object.hasOwn(i,Symbol.toStringTag)&&Object.defineProperty(i,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 A(e)&&t?.kind==="class"?r(e,void 0,t.name):(n,o)=>r(n,m(e)?e:void 0,o?.name)}var Me=E(()=>{"use strict";Z();Xe();P();we();J()});var Tt,Sr=E(()=>{"use strict";$e();P();Me();Tt=(()=>{let e=[oe("BoundedCache")],t,r=[],n,o=Map;var s=class extends o{static{n=this}static{let i=typeof Symbol=="function"&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;re(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}),ne(n,r)}#t=new Map;#e=new Set;#r=new Map;maxSize;ttl;constructor(i=1e3,a=1440*60*1e3){super(),this.maxSize=i,this.ttl=a}get isBoundedCache(){return!0}#n(i){let a=this.#t.get(i);return a===void 0?!1:Date.now()>a}evictExpired(){if(this.#t.size===0)return;let i=Date.now();for(let[a,c]of this.#t.entries())i>c&&this.delete(a)}setStatic(i,a){return super.has(i)&&super.delete(i),super.set(i,a),this.#e.add(i),this.#t.delete(i),this.#r.delete(i),this}isStatic(i){return this.#e.has(i)}get(i){if(this.#n(i)){this.delete(i);return}if(!super.has(i))return;let a=super.get(i);return super.delete(i),super.set(i,a),a}has(i){return this.#n(i)?(this.delete(i),!1):super.has(i)}get size(){return this.evictExpired(),super.size}forEach(i,a){this.evictExpired(),super.forEach(i,a)}set(i,a,c){this.evictExpired();let u=this.#t.get(i);for(super.has(i)&&super.delete(i),super.set(i,a),this.#e.delete(i),N(c)?c!==1/0?(this.#t.set(i,Date.now()+c),this.#r.set(i,c)):(this.#t.delete(i),this.#r.delete(i)):u!==void 0?this.#t.set(i,u):this.ttl!==1/0?(this.#t.set(i,Date.now()+this.ttl),this.#r.delete(i)):(this.#t.delete(i),this.#r.delete(i));this.size-this.#e.size>this.maxSize;){let f=!1,d=super.keys(),h=d.next();for(;!h.done;){let b=h.value;if(!this.#e.has(b)){this.delete(b),f=!0;break}h=d.next()}if(!f)break}return this}delete(i){return this.#e.delete(i),this.#t.delete(i),this.#r.delete(i),super.delete(i)}deletePrefix(i){let a=String(i).trim().toLowerCase();if(R(a))return 0;let c=[];for(let u of super.keys())m(u)&&u.toLowerCase().startsWith(a)&&c.push(u);for(let u of c)this.delete(u);return c.length}clear(i){if(i===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>=i)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 i=[];for(let[a,c]of super.entries())m(a)&&i.push([a,c]);return Object.fromEntries(i)}static fromEntries(i,a=1e3,c=1440*60*1e3){let u=new s(a,c);for(let[f,d]of i)u.set(f,d);return u}};return s=n})()});function Tr(e,t){let r;if(j(e))return t??{};switch(z.type){case x.Browser:r=Ot.getItem(e);break;case x.NodeJS:r=Le.has(e)?Le.get(e):In(e);break;case x.Deno:r=z.global.Deno.env.get(e);break;case x.GoogleAppsScript:r=z.global.PropertiesService?.getUserProperties().getProperty(e);break;case x.WebWorker:case x.Unknown:r=void 0;break;default:throw new Error(`Cannot determine Javascript context: ${z.type}`)}return m(r)?de(r):t}function Nt(e,t,r){let n=N(t)?B(t):void 0,o=N(n);switch(z.type){case x.Browser:try{o?Ot.setItem(e,n):Ot.removeItem(e)}catch(s){console.warn(`[Storage] Failed to ${o?"setItem":"removeItem"} for key '${e}':`,s)}break;case x.NodeJS:o?r?.static?Le.setStatic(e,n):Le.set(e,n,r?.ttl):Le.set(e,void 0,r?.ttl);break;case x.Deno:o?z.global.Deno.env.set(e,n):z.global.Deno.env.delete(e);break;case x.GoogleAppsScript:o?z.global.PropertiesService?.getUserProperties().setProperty(e,n):z.global.PropertiesService?.getUserProperties().deleteProperty(e);break;case x.WebWorker:case x.Unknown:break;default:throw new Error(`Cannot determine Javascript context: ${z.type}`)}}var z,xr,br,Et,_t,Ot,Le,In,Pt=E(()=>{"use strict";we();De();P();Sr();z=ye(),xr=(e=1e3,t=1/0)=>{let r=new Tt(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,o)=>{r.set(n,String(o))}}},br=new Map,Et=e=>{let t=br.get(e);return t||(t=xr(),br.set(e,t)),t},_t=(e="localStorage")=>{try{let t=globalThis?.[e];if(t&&A(t.getItem)&&A(t.setItem)&&A(t.removeItem)&&A(t.clear)&&A(t.key)&&g(t.length))return t}catch{}return Et(e)},Ot=z.type===x.Browser?_t():xr(),Le=new Tt(1e3,1/0),In=e=>{try{let t=Reflect.get(z.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}}});var Or=E(()=>{"use strict";we();P()});function Er(e=[],t){let r=n=>j(t)||N(n)?n:mr(t);return er(e)||Xt(e)&&!m(e)?Array.from(e,r):[e]}function _r(e){if(Ve(e))return e;let t=new Error(T(e)&&m(e.message)?e.message:String(e));return T(e)&&(t.name=m(e.name)?e.name:"Error","code"in e&&(m(e.code)||g(e.code))&&(t.code=e.code),"stack"in e&&m(e.stack)&&(t.stack=e.stack)),t}var Pi,Di,Dt=E(()=>{"use strict";we();J();P();Or();Pi=BigInt(Number.MAX_SAFE_INTEGER),Di=BigInt(Number.MIN_SAFE_INTEGER)});var Nr=E(()=>{"use strict";Dt();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=_r(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 It=E(()=>{"use strict";Nr();P()});function Fe(e,t,r){if(e){if(A(e[t]))return e[t]();if(r&&r in e)return e[r]}}function Un(e){return e?Mn.has(e)?5:$n.has(e)?6:An.has(e)?7:1:1}function Jn(e){return e?e==="IR"?Wn:e==="AF"?kn:Ln.has(e)?Gn:Ir:Ir}function Bn(e,t){let r=e?.script??(A(e?.maximize)?e.maximize().script:void 0);return r&&zn.has(r)||t&&Fn.has(t)?"rtl":"ltr"}var vn,Rn,Se,se,Gi,Wi,Rt,ki,Cn,Ui,An,$n,Mn,Ln,Fn,zn,Ir,Gn,Wn,kn,vt,Ji,Bi,Zn,Kn,vr,Zi,tt,Ki,Ct=E(()=>{"use strict";It();Qe();P();Dt();vn=/_/g,Rn=/[.@]/,Se=e=>typeof Intl<"u"&&(!e||Object.hasOwn(Intl,e)&&A(Intl[e])),se=e=>{if(Pe(e)&&(e=e.toString()),!m(e))return;let t=e.trim();if(R(t))return;let r=t.split(Rn)[0];if(!R(r))return r.replace(vn,"-")},Gi=M((e,t)=>new Intl.RelativeTimeFormat(se(e),t)),Wi=M((e,t)=>new Intl.ListFormat(se(e),t)),Rt=M((e,t)=>new Intl.DateTimeFormat(se(e),t)),ki=M((e,t)=>{try{return new Intl.PluralRules(se(e),t)}catch{return{select:()=>"other"}}}),Cn=M((e,t)=>new Intl.NumberFormat(se(e),t)),Ui=M((e,t)=>{try{let r=new Intl.DurationFormat(se(e),t);if(S(r.format))return r;throw new Error("No format method")}catch{return{format:n=>String(n)}}});An=new Set(["US","CA","MX","BR","IL","JP","TW","HK","MO","PH","SG","TH","IN","KR","CO","PE","VE","ZA"]),$n=new Set(["SA","AF","BH","DJ","DZ","EG","IQ","IR","JO","KW","LY","OM","QA","SD","SY","YE"]),Mn=new Set(["MV"]),Ln=new Set(["SA","BH","DJ","DZ","EG","IQ","JO","KW","LY","OM","QA","SD","SY","YE"]),Fn=new Set(["ar","he","fa","ur","yi","ps","sd","ug","ckb"]),zn=new Set(["Arab","Hebr","Thaa","Syrc","Mand","Samr","Nkoo"]),Ir=Object.freeze([6,7]),Gn=Object.freeze([5,6]),Wn=Object.freeze([5]),kn=Object.freeze([4,5]);vt=M(e=>{if(Pe(e))return e;if(Se("Locale"))try{let t=se(e);return new Intl.Locale(t||"en-US")}catch{return}}),Ji=M(e=>{let t=vt(e)??vt("en-US"),r=t?.baseName??vr(e)??"en-US",n=t?.language??r.split("-")[0]?.toLowerCase(),o=[];for(let le of r.split("-").slice(1)){if(le.length===1)break;o.push(le)}let s=t?.region??(A(t?.maximize)?t.maximize().region:void 0)??o.find(le=>/^[a-zA-Z]{2}$|^\d{3}$/.test(le))?.toUpperCase(),i=t?.script??(A(t?.maximize)?t.maximize().script:void 0),a=Fe(t,"getWeekInfo","weekInfo"),c=a?.firstDay??Un(s),u=Array.isArray(a?.weekend)?Object.freeze([...a.weekend]):Jn(s),d=Fe(t,"getHourCycles","hourCycles")??t?.hourCycle??(Se("DateTimeFormat")?Rt(r,{hour:"numeric"}).resolvedOptions().hourCycle:void 0),h=Array.isArray(d)&&d.length>0?Object.freeze([...d]):m(d)?Object.freeze([d]):Object.freeze(["h23"]),b=Fe(t,"getTextInfo","textInfo"),O=b?.direction==="rtl"||b?.direction==="ltr"?b.direction:Bn(t,n),p=Fe(t,"getNumberingSystems","numberingSystems")??t?.numberingSystem??(Se("NumberFormat")?Cn(r).resolvedOptions().numberingSystem:void 0),y=Array.isArray(p)&&p.length>0?Object.freeze([...p]):m(p)?Object.freeze([p]):Object.freeze(["latn"]),I=Fe(t,"getTimeZones","timeZones"),v=Array.isArray(I)&&I.length>0?Object.freeze([...I]):Object.freeze([]),ce=Object.freeze({firstDay:c,weekend:u});return Object.freeze({locale:t,baseName:r,language:n,region:s,script:i,weekInfo:ce,firstDay:c,weekend:u,hourCycle:h[0],hourCycles:h,direction:O,numberingSystem:y[0],numberingSystems:y,timeZones:v})}),Bi=M((e="latn")=>{if(!(!e||e==="latn"||!Se("NumberFormat")))try{let t=new Intl.NumberFormat(`en-u-nu-${e}`,{useGrouping:!1}),r=Array.from({length:10},(n,o)=>t.format(o));return r[0]==="0"&&r[9]==="9"?void 0:Object.freeze(r)}catch{return}}),Zn=Object.freeze({locale:"en-US",calendar:"iso8601",numberingSystem:"latn",timeZone:"UTC"}),Kn=M(()=>Se("DateTimeFormat")?Object.freeze(Rt().resolvedOptions()):Zn),vr=M(e=>{let t=se(e);if(t){if(Se("getCanonicalLocales"))try{return Intl.getCanonicalLocales(t)[0]}catch{return}return vt(t)?.baseName??t}}),Zi=M(e=>Object.freeze(Er(e).map(t=>vr(t)).filter(Boolean))),tt=M((e=Kn().timeZone)=>{try{let{jan:t,jul:r}=Dr(e),o=["Australia","Antarctica","Africa/Johannesburg","America/Argentina/Buenos_Aires","America/Sao_Paulo"].some(s=>e.startsWith(s));switch(!0){case r>t:return"north";case r<t:return"south";default:return o?"south":void 0}}catch{return}}),Ki=M(e=>{try{let t=new Date(2024,11,24),r=Rt(e).formatToParts(t);return r[0].type==="month"&&r[0].value==="12"}catch{return!1}})});function Y(e){return{enumerable:!1,configurable:!1,writable:!1,value:e}}function be(e,t=!0){let n=ue(this)!=="Module"&&S(this?.has)?this:Yn,o=V(e),s=Object.create(n);switch(o.type){case"Enumify":case"Object":Object.defineProperties(s,Object.getOwnPropertyDescriptors(o.value));break;case"Array":o.value.forEach((i,a)=>{if(g(i))throw new Error("Enumify: numeric keys are not supported");s[i]=a});break;default:throw new Error(`Enumify: invalid argument type: ${o.type}`)}return sr(s,!0,t)}var jn,Yn,ts,Rr=E(()=>{"use strict";$e();J();P();K();Xe();Me();Qe();jn="Enumify",Yn=Ie(Object.create(null,{keys:Re("keys",function(){return C(this,!0).map(([e])=>e)}),values:Re("values",function(){return C(this,!0).map(([e,t])=>t)}),entries:Re("entries",function(){return C(this,!0).map(([e,t])=>Object.freeze([e,t]))}),invert:Re("invert",function(){return Object.fromEntries(this.entries().map(([e,t])=>[t,e]))}),has:Y(function(e){return this.keys().includes(e)}),count:Y(function(){return this.keys().length}),includes:Y(function(e){return this.values().includes(e)}),keyOf:Y(function(e){return this.invert()[e]}),extend:Y(function(e,t){return be.call(this,e,t)}),forEach:Y(function(e,t){this.entries().forEach((r,n)=>e.call(t,r,n,this))}),filter:Y(function(e,t){return be(this.entries().reduce((r,n,o)=>e.call(t,n,o,this)?Object.assign(r,{[n[0]]:n[1]}):r,{}))}),map:Y(function(e,t){return be(this.entries().reduce((r,n,o)=>Object.assign(r,{[n[0]]:e.call(t,n,o,this)}),{}))}),[Symbol.iterator]:Y(function*(){for(let e of this.entries())yield e}),[Symbol.toStringTag]:{enumerable:!1,configurable:!1,writable:!1,value:jn}}));ts=(()=>{let e=[wr,oe("Enumify")],t,r=[],n;var o=class{static{n=this}static{let s=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;re(null,t={value:n},e,{kind:"class",name:n.name,metadata:s},null,r),o=n=t.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),ne(n,r)}constructor(s){return be(s)}};return o=n})()});function qn(e,t=G.Info){return g(e)?e>=G.Off&&e<=G.Trace?e:t:m(e)?Cr[e.toLowerCase()]??t:t}var G,L,Cr,rt,At=E(()=>{"use strict";$e();P();Rr();Z();Me();G=be(["Off","Error","Warn","Info","Debug","Trace"]),L={Off:"off",Log:"log",Info:"info",Warn:"warn",Debug:"debug",Trace:"trace",Error:"error"},Cr={[L.Off]:G.Off,[L.Error]:G.Error,[L.Warn]:G.Warn,[L.Info]:G.Info,[L.Log]:G.Info,[L.Debug]:G.Debug,[L.Trace]:G.Trace};rt=(()=>{let e=[oe("Logger")],t,r=[],n;var o=class{static{n=this}static{let s=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;re(null,t={value:n},e,{kind:"class",name:n.name,metadata:s},null,r),o=n=t.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),ne(n,r)}#t;level;constructor(s,i=G.Info){this.#t=s.startsWith("[")?s:`[${s}]`,this.level=i}#e(s,...i){let a;if(i.length>0&&T(i[0]))try{i[0][w.$LogConfig]&&(a=i.shift())}catch{}let c=this.level;if(a){if(a.silent===!0)return;a.debug!==void 0&&(c=qn(a.debug,c))}if(c===G.Off||(Cr[s]??0)>c)return;let f=i.map(d=>{if(Ve(d))return d.message;if(T(d))try{let h=d.constructor?.name??"Object";if(h==="Object"){let b=Object.keys(d);return`{ ${b.slice(0,3).join(", ")}${b.length>3?`, ... (+${b.length-3} more)`:""} }`}return`[${h}]`}catch{return"[Object]"}return String(d)}).filter(d=>!R(d)).join(" ");R(f)||console[s](`${this.#t} ${f}`)}log=(...s)=>this.#e(L.Log,...s);info=(...s)=>this.#e(L.Info,...s);warn=(...s)=>this.#e(L.Warn,...s);debug=(...s)=>this.#e(L.Debug,...s);trace=(...s)=>this.#e(L.Trace,...s);error=(...s)=>this.#e(L.Error,...s)};return o=n})()});var Ar={};ge(Ar,{WebStore:()=>Hn});var ze,Hn,$r=E(()=>{"use strict";$e();K();we();J();P();Pt();Me();ze={Local:"local",Session:"session"},Hn=(()=>{let e=[oe("WebStore")],t,r=[],n;var o=class{static{n=this}static{let s=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;re(null,t={value:n},e,{kind:"class",name:n.name,metadata:s},null,r),o=n=t.value,s&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),ne(n,r)}static _localInstance;static _sessionInstance;static get local(){return o._localInstance??=new o(ze.Local)}static get session(){return o._sessionInstance??=new o(ze.Session)}#t;#e;get#r(){if(this.#e)return this.#e;let s=this.#t===ze.Local?"localStorage":"sessionStorage";return this.#e=_t(s)}#n(s){try{return s(this.#r)}catch{let a=this.#t===ze.Local?"localStorage":"sessionStorage",c=Et(a);return this.#e=c,s(c)}}constructor(s=ze.Local){this.#t=s}get(s,i){let a=this.#n(c=>c.getItem(B(s)));return m(a)?de(a):i??null}set(s,i,a={merge:!0}){if(_(s))return this.clear();let c=this.get(s),u=V(i);switch(u.type){case"Undefined":return this.del(s);case"Object":return c??={},this.#o(s,a.merge?Object.assign(c,u.value):u.value);case"Array":return c??=[],this.#o(s,a.merge?je(c.concat(u.value)):i);case"Map":return c??=new Map,a.merge?(u.value.forEach((f,d)=>c.set(d,f)),this.#o(s,c)):this.#o(s,u.value);case"Set":return c??=new Set,a.merge?(u.value.forEach(f=>c.add(f)),this.#o(s,c)):this.#o(s,u.value);default:return this.#o(s,u.value)}}clear(){try{this.#n(s=>s.clear())}catch(s){console.warn("[WebStore] Failed to clear storage:",s)}return this}del(...s){return s.forEach(i=>{try{this.#n(a=>a.removeItem(B(i)))}catch(a){console.warn(`[WebStore] Failed to removeItem for key '${String(i)}':`,a)}}),this}keys(...s){return this.entries(...s).map(([i])=>i)}values(...s){return this.entries(...s).map(([,i])=>i)}entries(...s){let i=new Set(s.map(c=>B(c))),a=[];return this.#n(c=>{for(let u=0;u<c.length;u++){let f=c.key(u);if(f!==null&&(R(s)||i.has(f))){let d=c.getItem(f);a.push([de(f),de(d)])}}}),a}from(s){return C(s).forEach(([i,a])=>this.set(i,a)),this}#o(s,i){try{this.#n(a=>a.setItem(B(s),B(i)))}catch(a){console.warn(`[WebStore] Failed to setItem for key '${String(s)}':`,a)}return this}};return o=n})()});var Fr={};ge(Fr,{geoCoords:()=>Lr,geoLocation:()=>Ge,mapAddress:()=>Xn,mapHemisphere:()=>Vn,mapQuery:()=>Lt});var ot,Mr,D,Mt,q,$t,nt,Ge,Lr,Lt,Vn,Xn,Ft=E(()=>{"use strict";St();De();P();It();Ct();At();ot={catch:!0,debug:0},Mr=ye(),D={},Mt="_magma_browser_map_",q=new rt("[Mapper]"),$t=null,nt=()=>($t||($t=new Promise((e,t)=>{Mr.type===x.Browser?Promise.resolve().then(()=>($r(),Ar)).then(({WebStore:r})=>{let n=new r("local"),o=n.get(Mt,{});$(o)&&(o.geolocation&&(!o.geolocation.coords||o.geolocation.$GeolocationPosition)&&delete o.geolocation,Object.assign(D,o)),e(n)}).catch(t):e(void 0)})),$t),Ge=(e={})=>nt().then(()=>new Promise((t,r)=>{e=Object.assign({},ot,e);let n=e.catch?t:r;typeof navigator<"u"&&"geolocation"in navigator?navigator.geolocation.getCurrentPosition(o=>{let s=D.geolocation?.coords,i=s?.latitude?.toFixed(3),a=s?.longitude?.toFixed(3),c=D.geolocation?.timestamp??0,u=o.coords.latitude.toFixed(3)!==i,f=o.coords.longitude.toFixed(3)!==a,d=c<Pr().epochMilliseconds-36e5;(u||f||d)&&(Object.assign(D,{georesponse:null}),q.info(e,"GeoLocation: device update")),Object.assign(D,{geolocation:ee(o)}),t(D.geolocation)},o=>{Object.assign(D,{geolocation:{error:o.message},georesponse:null}),n(D.geolocation)}):(Object.assign(D,{geolocation:{error:"Not Supported"},georesponse:null}),n(D.geolocation))})).finally(()=>{(D.geolocation?.error?q.error:q.info)(e,"geoLocation: ",D.geolocation),nt().then(r=>r?.set(Mt,D))}),Lr=e=>new Promise((t,r)=>{if(!_(e))return t(e);Ge().then(n=>_(n.error)?{location:{lat:n.coords.latitude,lng:n.coords.longitude}}:null).then(n=>t(n)).catch(n=>r(n))}),Lt=(e,t={})=>nt().then(()=>new Promise((r,n)=>{t=Object.assign({},ot,t);let o=t.catch?r:n;Lr(e).then(s=>{switch(!0){case(Mr.type!==x.Browser||!window.google?.maps):throw new Error("Google Maps API not configured");case _(s):throw new Error("Cannot determine Coordinates");case _(e):{let i=D.geolocation&&D.georesponse,a=_(D.geolocation?.error)&&_(D.georesponse?.error);if(i&&a)return t.debug&&q.debug(t,"mapQuery: cache"),r(D.georesponse)}default:new window.google.maps.Geocoder().geocode(s).then(i=>r(D.georesponse=ee(i)))}}).catch(s=>{Object.assign(D,{georesponse:{error:s.message}}),o(D.georesponse)})})).finally(()=>{t.debug&&(D.georesponse?.error?q.error:q.debug)(t,"mapQuery: ",D.georesponse),nt().then(r=>r?.set(Mt,D))}),Vn=(e,t={})=>Lt(e,t).then(r=>{if(t=Object.assign({},ot,t),_(r.error))return t.debug&&q.debug(t,"sphere: ",r),r.results[0].geometry.location.lat()>=0?"north":"south";let n=tt();if(_(n)&&t.catch===!1)throw new Error("Cannot determine Hemisphere");return n}).catch(r=>{if(t.debug&&q.warn(t,"mapHemisphere: ",r.message),t.catch===!1)throw r;return null}),Xn=(e,t={})=>Lt(e,t).then(r=>{if(!_(r.error))throw new Error(r.error);return r.results[0]}).then(({formatted_address:r,address_components:n})=>n.reduce((o,s)=>(s.types.filter(i=>i!=="political").forEach(i=>o[i]=(o[i]?o[i]+",":"").concat(s.short_name)),o),{formatted_address:r})).catch(r=>{if(t=Object.assign({},ot,t),t.debug&&q.warn(t,"mapAddress: ",r.message),t.catch===!1)throw r;return null})});var Ur={};ge(Ur,{HTTP:()=>Wr,HttpError:()=>H,METHOD:()=>kr,fetchHead:()=>eo,fetchRequest:()=>Qn});var zt,zr,Wr,kr,H,Gr,Qn,eo,Jr=E(()=>{"use strict";P();zt=2e3,zr=/\);?$/,Wr={Ok:200,PermRedirect:301,TempRedirect:302,BadRequest:400,Unauthorised:401,Forbidden:403},kr={Head:"HEAD",Get:"GET",Put:"PUT",Delete:"DELETE",Post:"POST"},H=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"}},Gr=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 H(413,`Content-Length (${a}) exceeds limit (${t} bytes)`,null)}}if(!e.body){let a;if(S(e.text))a=await e.text();else if(S(e.json)){let u=await e.json();a=JSON.stringify(u)??""}else a="";let c=new TextEncoder().encode(a).byteLength;if(c>t)throw new H(413,`Payload length (${c}) exceeds limit (${t} bytes)`,null);return a}let n=e.body.getReader(),o=new TextDecoder,s=0,i="";try{for(;;){let{done:a,value:c}=await n.read();if(a)break;if(c){if(s+=c.byteLength,s>t){try{await n.cancel()}catch{}throw new H(413,`Streamed payload exceeded limit (${t} bytes)`,null)}i+=o.decode(c,{stream:!0})}}return i+=o.decode(),i}finally{try{n.releaseLock()}catch{}}},Qn=(e,t={},r={})=>{let n={...t,signal:t.signal?AbortSignal.any([t.signal,AbortSignal.timeout(r.timeout??zt)]):AbortSignal.timeout(r.timeout??zt)};return fetch(e,n).then(async o=>{if(o.ok){let a=(o.headers?.get?.("Content-Type")||o.headers?.get?.("content-type")||"").includes("application/json");if(N(r.maxBytes)){let c=await Gr(o,r.maxBytes);if(r.rawText)return c;if(r.prefix){let u=c.startsWith(r.prefix)?c.substring(r.prefix.length).replace(zr,""):c;return JSON.parse(u)}if(a)return JSON.parse(c);try{return JSON.parse(c)}catch{return c}}if(r.rawText)return S(o.text)?await o.text():"";if(r.prefix){let c=await o.text(),u=c.startsWith(r.prefix)?c.substring(r.prefix.length).replace(zr,""):c;return JSON.parse(u)}if(S(o.text)){let c=await o.text();try{return JSON.parse(c)}catch{return c}}return S(o.json)?await o.json():""}let s=null;try{let i=N(r.maxBytes)?await Gr(o,r.maxBytes):S(o.text)?await o.text():"";try{s=JSON.parse(i)}catch{s=i}}catch(i){if(i instanceof H&&i.status===413)throw i}throw new H(o.status,o.statusText,s)})},eo=e=>{let t=AbortSignal.timeout(zt),r={method:kr.Head,signal:t};return fetch(e,r).then(({ok:n,status:o,statusText:s,headers:i})=>{if(n||o===Wr.Forbidden)return{status:o,headers:i};throw new H(o,s,null)})}});var Zr={};ge(Zr,{serverGeoCoords:()=>it,serverGeoLocation:()=>We,serverMapHemisphere:()=>Ut});var Br,kt,Gt,Wt,to,We,it,Ut,Jt=E(()=>{"use strict";P();Ct();At();Br=new rt("[ServerMapper]"),kt="https://ipwho.is",Gt={endpoint:`${kt}/`,timeout:3e3,catch:!0,debug:0},Wt=null,to=()=>(Wt||(Wt=Promise.resolve().then(()=>(Jr(),Ur))),Wt),We=async(e={})=>{let t={...Gt,...e},r=t.catch!==!1;try{let n=t.endpoint||Gt.endpoint;if(m(t.ip)){let d=encodeURIComponent(t.ip.trim());if((n.endsWith("/")?n.slice(0,-1):n)===kt)n=`${kt}/${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 o=t.timeout??Gt.timeout,{fetchRequest:s}=await to(),i=await s(n,{},{...g(o)?{timeout:o}:{},maxBytes:64*1024});if(typeof i!="object"||_(i))throw new Error("Geolocation lookup failed");if(i.status==="fail"||i.success===!1)throw new Error(i.message||i.reason||"Geolocation lookup failed");let a=g(i.lat)?i.lat:i.latitude,c=g(i.lon)?i.lon:i.lng??i.longitude;if(!g(a)||!g(c))throw new Error("Geolocation lookup failed");let u=m(i.timezone)?i.timezone:i.timezone?.id??i.timeZone,f={lat:a,lng:c,latitude:a,longitude:c,...m(i.country||i.countryName||i.country_name)?{country:i.country||i.countryName||i.country_name}:{},...m(i.city||i.cityName||i.city_name)?{city:i.city||i.cityName||i.city_name}:{},...m(u)?{timezone:u}:{},...m(i.query||i.ip||i.ip_address)?{query:i.query||i.ip||i.ip_address}:{},status:"success"};return t.debug&&Br.info(t,"serverGeoLocation success: ",f),f}catch(n){let o=n?.message||"Server geolocation error";if(t.debug&&Br.error(t,"serverGeoLocation error: ",o),!r)throw n;return{error:o,status:"fail"}}},it=async(e,t)=>{if(!_(e)){let n=e.latitude??e.lat,o=e.longitude??e.lng??e.lon??e.long;if(g(n)&&g(o))return{lat:n,lng:o}}let r=await We(t);return _(r.error)&&g(r.lat)&&g(r.lng)?{lat:r.lat,lng:r.lng}:null},Ut=async(e,t)=>{let r=await it(e,t);return r?r.lat>=0?"north":"south":tt()??null}});var io={};ge(io,{GEO_PROPERTIES:()=>ke,GeoPlugin:()=>Zt,clearStashedGeo:()=>ct,coerceGeo:()=>ae,default:()=>oo,geoLocation:()=>Ge,geoLookup:()=>lt,geoPlugin:()=>no,getStashedGeo:()=>Te,haversineDistance:()=>ut,resolveGeoCoordinates:()=>Ue,serverGeoCoords:()=>it,serverGeoLocation:()=>We,serverMapHemisphere:()=>Ut,solarOffset:()=>ft,stashGeo:()=>at});var U={};ge(U,{definePlugin:()=>dt,defineTerm:()=>rn});Oe(U,jt(pt()));var Ze=jt(pt()),dt=e=>(0,Ze.definePlugin)({...e,version:"1.1.0"}),rn=e=>(0,Ze.defineTerm)({...e,version:"1.1.0"});De();P();Pt();P();function ie(...e){for(let t of e){let r=S(t)?t():t;if(r!==void 0)return r}}var st="_magma_geo_",Kr=1440*60*1e3,ke=["latitude","lat","longitude","lng","lon","long","elevation","sphere","country","city","timezone","tz"],jr=e=>g(e)&&e>=-90&&e<=90?Math.round(e*1e3)/1e3:void 0,Yr=e=>g(e)&&e>=-180&&e<=180?Math.round(e*1e3)/1e3:void 0,xe=(e,t)=>{let r=jr(e),n=Yr(t);return r!==void 0&&n!==void 0?{lat:r,lng:n}:void 0},me=(e,t)=>{if(e==="north"||e==="south"||e==="equator")return e;if(g(t))return t>.001?"north":t<-.001?"south":"equator"},ae=e=>{if(m(e)&&e.includes(",")){let p=e.split(",").map(y=>y.trim()).map(y=>y===""?NaN:Number(y));if(p.length>=2&&!isNaN(p[0])&&!isNaN(p[1])){let y=xe(p[0],p[1]);if(y){let I={latitude:y.lat,longitude:y.lng},v=me(void 0,y.lat);return v&&(I.sphere=v),I}}return}if(X(e))return;if(Array.isArray(e)&&e.length>=2){let l=xe(e[0],e[1]);if(l){let p={latitude:l.lat,longitude:l.lng},y=me(void 0,l.lat);return y&&(p.sphere=y),p}return}let t=e.geo??e,r=e.config?.geo??e.config,n=ie(t?.latitude,t?.lat,e.latitude,e.lat,r?.latitude,r?.lat),o=ie(t?.longitude,t?.lng,t?.lon,t?.long,e.longitude,e.lng,e.lon,e.long,r?.longitude,r?.lng,r?.lon,r?.long),s=ie(t?.elevation,e.elevation,r?.elevation),i=ie(t?.sphere,e.sphere,r?.sphere),a=ie(t?.country,e.country,r?.country),c=ie(t?.city,e.city,r?.city),u=ie(t?.timezone,t?.tz,e.timezone,e.tz,r?.timezone,r?.tz),f={},d=jr(n),h=Yr(o);d!==void 0&&(f.latitude=d),h!==void 0&&(f.longitude=h),g(s)&&(f.elevation=Math.round(s*1e3)/1e3);let b=me(i,f.latitude);b&&(f.sphere=b),m(a)&&(f.country=a),m(c)&&(f.city=c),m(u)&&(f.timezone=u);let O=$(e.geo)?e.geo:$(e.config?.geo)?e.config.geo:void 0;if($(O))for(let l of Object.keys(O))k(l)&&!ke.includes(l)&&(f[l]=O[l]);return Object.keys(f).length>0?f:void 0},Bt=e=>{if(m(e)&&!R(e)){let t=e.trim();return t.startsWith(st)?t:`${st}:${t}`}if(e&&T(e)){let t=e.key??e.ip??e.query;if(m(t)&&!R(t))return`${st}:${t.trim()}`}return st},Te=e=>{let t=Bt(e);try{let r=Tr(t)??(typeof localStorage<"u"?localStorage.getItem(t):void 0);if(!r)return;let n=m(r)&&(r.startsWith("{")||r.startsWith("["))?JSON.parse(r):r;if(T(n)&&g(n._expires)&&Date.now()>n._expires){ct(e);return}if(m(n)&&n.includes(",")){let o=n.split(",").map(i=>parseFloat(i.trim())),s=xe(o[0],o[1]);if(s)return{latitude:s.lat,longitude:s.lng,sphere:me(void 0,s.lat)}}if(T(n)){let o=n.geolocation?.coords??n.coords??n,s=o?.latitude??o?.lat,i=o?.longitude??o?.lng??o?.lon??o?.long,a=xe(s,i);if(a){let c={latitude:a.lat,longitude:a.lng},u=n.elevation??o.elevation;return g(u)&&(c.elevation=Math.round(u*1e3)/1e3),c.sphere=me(n.sphere,a.lat),m(n.country)&&(c.country=n.country),m(n.city)&&(c.city=n.city),m(n.timezone)&&(c.timezone=n.timezone),c}}}catch{}},at=(e,t=Kr,r)=>{let n=Bt(r),o=g(t)&&t>0?{...e,_expires:Date.now()+t}:e;Nt(n,o,{ttl:t})},ct=e=>{let t=Bt(e);Nt(t,void 0)},lt=async(e={})=>{if(e.refresh!==!0){let a=Te(e);if(a&&g(a.latitude)&&g(a.longitude)){let{latitude:c,longitude:u,...f}=a;return{...f,status:"cached",lat:c,lng:u,latitude:c,longitude:u}}}let{type:r}=ye(),n;switch(r){case x.Browser:{let{geoLocation:a}=await Promise.resolve().then(()=>(Ft(),Fr)),c=await a(e);if(c.error)return{error:c.error};let u=c.coords?.latitude,f=c.coords?.longitude;n={...c,lat:u,lng:f,latitude:u,longitude:f};break}case x.WebWorker:case x.NodeJS:case x.Deno:default:{let{serverGeoLocation:a}=await Promise.resolve().then(()=>(Jt(),Zr));n=await a(e);break}}let o=n.latitude??n.lat,s=n.longitude??n.lng,i=xe(o,s);if(_(n.error)&&i){let a=me(n.sphere,i.lat);n.lat=i.lat,n.lng=i.lng,n.latitude=i.lat,n.longitude=i.lng,n.sphere=a;let c={latitude:i.lat,longitude:i.lng,sphere:a,...m(n.city)?{city:n.city}:{},...m(n.country)?{country:n.country}:{},...g(n.elevation)?{elevation:Math.round(n.elevation*1e3)/1e3}:{},...m(n.timezone)?{timezone:n.timezone}:{}};try{let u=g(e.ttl)?e.ttl:Kr;at(c,u,e)}catch{}}return n},Ue=async(e,t={})=>{let r=ae(e);if(r&&g(r.latitude)&&g(r.longitude))return{...r,lat:r.latitude,lng:r.longitude};let n=t.refresh===!0?void 0:Te(t);if(n&&g(n.latitude)&&g(n.longitude))return{...n,lat:n.latitude,lng:n.longitude};let o=await lt(t),s=xe(o.lat,o.lng);if(_(o.error)&&s){let i=me(o.sphere,s.lat);return{...o,lat:s.lat,lng:s.lng,latitude:s.lat,longitude:s.lng,sphere:i}}return null};function ut(e,t,r="km"){let n=ae(e),o=ae(t);if(!n||!o||!g(n.latitude)||!g(n.longitude)||!g(o.latitude)||!g(o.longitude))return NaN;let s=Math.PI/180,i=n.latitude*s,a=n.longitude*s,c=o.latitude*s,u=o.longitude*s,f=c-i,d=u-a,h=Math.sin(f/2)**2+Math.cos(i)*Math.cos(c)*Math.sin(d/2)**2,b=2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h)),O;r==="miles"?O=3958.7613:r==="m"?O=63710088e-1:O=6371.0088;let l=O*b;return r==="m"?Math.round(l):Math.round(l*1e3)/1e3}var ro=(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(o=>o.type==="timeZoneName")?.value;if(n){if(n==="GMT"||n==="UTC")return 0;let o=n.match(/GMT([+-])(\d{2}):(\d{2})/);if(o)return(o[1]==="-"?-1:1)*(parseInt(o[2],10)*60+parseInt(o[3],10))}}catch{}};function ft(e,t){let r=ae(e);if(!r||!g(r.latitude)||!g(r.longitude)||isNaN(r.latitude)||isNaN(r.longitude))return NaN;let n=r.longitude,o=t?.timeZone??($(e)?e.timezone??e.tz:void 0)??r.timezone,s=t?.date??($(e)&&g(e.epoch?.ms)?e.epoch.ms:Date.now()),i=typeof s=="number"?s:m(s)?Date.parse(s):Ee(s)?s.getTime():$(s)&&g(s?.epoch?.ms)?s.epoch.ms:Date.now();if(!Number.isFinite(i))return NaN;let a=Qt(o)?ro(o,i):void 0,c=a!==void 0?a/60*15:Math.round(n/15)*15,f=(n-c)*4;if(t?.apparent){let l=new Date(i),p=Date.UTC(l.getUTCFullYear(),0,1),y=Math.floor((i-p)/864e5)+1,I=2*Math.PI/365*(y-1),v=229.18*(75e-6+.001868*Math.cos(I)-.032077*Math.sin(I)-.014615*Math.cos(2*I)-.040849*Math.sin(2*I));f+=v}let d=t?.unit??"minutes",h;d==="seconds"?h=f*60:d==="hours"?h=f/60:h=f;let b=t?.precision??2,O=Math.pow(10,b);return Math.round(h*O)/O}Jt();Ft();P();var Zt=dt({name:"geo",install(e,t){let r=e||this,n=(o,s)=>{let i=r.config?.pluginOptions?.geo,a=s?.config?.pluginOptions?.geo;return{...T(t)?t:{},...T(i)?i:{},...T(a)?a:{},...T(o)?o:{}}};Object.hasOwn(r,"geo")||Object.defineProperty(r,"geo",{value:(0,U.deepFreeze)({lookup:s=>lt(n(s)),resolve:(s,i)=>Ue(s,n(i,s)),coerce:ae,distance:ut,solarOffset:ft,stash:at,clear:ct,get:Te,server:We,browser:Ge,get current(){return Te()??r.config?.geo}}),writable:!1,configurable:!1,enumerable:!1}),e.prototype.geoLocate=async function(o){let s=n(o,this),i=s?.setTimezone!==!1,a=await Ue(this,s);if(a){let c=T(this.config.geo)?this.config.geo:{},u={};for(let l of Object.keys(c))k(l)&&!ke.includes(l)&&(u[l]=c[l]);let f=ae(o)??{};if(T(o))for(let l of Object.keys(o))k(l)&&!["setTimezone","refresh","ttl","endpoint","timeout","catch","debug","geo"].includes(l)&&(ke.includes(l)||(u[l]=o[l]));let d=g(a?.elevation)?a.elevation:g(c.elevation)?c.elevation:void 0,h={...u,...a,...g(d)?{elevation:d}:{},...f};g(h.latitude)&&(h.latitude=Math.round(h.latitude*1e3)/1e3),g(h.longitude)&&(h.longitude=Math.round(h.longitude*1e3)/1e3),!h.sphere&&g(h.latitude)&&(h.sphere=h.latitude>.001?"north":h.latitude<-.001?"south":"equator");let b=this,O=h.timezone;return i&&m(O)&&!R(O)&&(b=this.set({timeZone:O})),new e(b,{...b.config,geo:(0,U.deepFreeze)(h),...h.sphere?{sphere:h.sphere}:{}})}return this},e.prototype.geoLookup=async function(o){return Ue(this,n(o,this))},e.prototype.geoDistance=function(o,s){return ut(this,o,s)},e.prototype.geoSolarOffset=function(o){return ft(this,o)}}}),no=Zt,oo=Zt;return tn(io);})();
|
package/dist/index.js
CHANGED
|
@@ -257,32 +257,55 @@ var init_type_library = __esm({
|
|
|
257
257
|
});
|
|
258
258
|
|
|
259
259
|
// ../../library/dist/common/primitives/assertion.library.js
|
|
260
|
-
|
|
260
|
+
function isNumeric(str) {
|
|
261
|
+
const type = typeof str;
|
|
262
|
+
switch (type) {
|
|
263
|
+
case "number":
|
|
264
|
+
return Number.isFinite(str);
|
|
265
|
+
case "bigint":
|
|
266
|
+
return true;
|
|
267
|
+
case "string": {
|
|
268
|
+
const val = str.trim();
|
|
269
|
+
if (val.length === 0)
|
|
270
|
+
return false;
|
|
271
|
+
return RE_BIGINT_LITERAL.test(val) || isNumber(Number(val));
|
|
272
|
+
}
|
|
273
|
+
default:
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
var isType, isPrimitive, isReference, isIterable, isString, isText, isNumber, RE_BIGINT_LITERAL, isInteger, isArray, isArrayLike, isObject, isDate, isRegExp, isSymbol, isSymbolFor, isSafeKey, isNullish, isUndefined, isDefined, isFunction, isCallable, isMap, isSet, isError, isLocale, isEmpty;
|
|
261
278
|
var init_assertion_library = __esm({
|
|
262
279
|
"../../library/dist/common/primitives/assertion.library.js"() {
|
|
263
280
|
"use strict";
|
|
264
281
|
init_symbol_library();
|
|
265
282
|
init_type_library();
|
|
266
283
|
isType = (obj, ...types) => types.includes(getType(obj));
|
|
267
|
-
isPrimitive = (obj) =>
|
|
284
|
+
isPrimitive = (obj) => obj === null || typeof obj !== "object" && typeof obj !== "function";
|
|
268
285
|
isReference = (obj) => !isPrimitive(obj);
|
|
269
|
-
|
|
270
|
-
|
|
286
|
+
isIterable = (obj) => Symbol.iterator in Object(obj) && !isString(obj);
|
|
287
|
+
isString = (obj) => typeof obj === "string";
|
|
288
|
+
isText = (obj) => typeof obj === "string" && obj.trim().length > 0;
|
|
271
289
|
isNumber = (obj) => Number.isFinite(obj);
|
|
272
|
-
|
|
273
|
-
|
|
290
|
+
RE_BIGINT_LITERAL = /^[+-]?[0-9]+n$/;
|
|
291
|
+
isInteger = (obj) => typeof obj === "bigint";
|
|
292
|
+
isArray = (obj) => Array.isArray(obj);
|
|
293
|
+
isArrayLike = (obj) => protoType(obj) === "Object" && "length" in obj && Object.keys(obj).every((key) => key === "length" || isNumber(Number(key)));
|
|
274
294
|
isObject = (obj) => isType(obj, "Object");
|
|
275
295
|
isDate = (obj) => isType(obj, "Date");
|
|
276
|
-
|
|
277
|
-
|
|
296
|
+
isRegExp = (obj) => isType(obj, "RegExp");
|
|
297
|
+
isSymbol = (obj) => typeof obj === "symbol";
|
|
298
|
+
isSymbolFor = (obj) => typeof obj === "symbol" && Symbol.keyFor(obj) !== void 0;
|
|
278
299
|
isSafeKey = (key) => key !== "__proto__" && key !== "constructor" && key !== "prototype";
|
|
279
|
-
isNullish = (obj) => isType(obj, "
|
|
280
|
-
isUndefined = (obj) => isType(obj, "
|
|
281
|
-
isDefined = (obj) => !isNullish(obj);
|
|
300
|
+
isNullish = (obj) => obj === null || obj === void 0 || isType(obj, "Void", "Empty");
|
|
301
|
+
isUndefined = (obj) => obj === void 0 || isType(obj, "Void", "Empty");
|
|
302
|
+
isDefined = (obj) => obj !== null && obj !== void 0 && !isNullish(obj);
|
|
282
303
|
isFunction = (obj) => isType(obj, "Function", "AsyncFunction", "GeneratorFunction", "AsyncGeneratorFunction");
|
|
304
|
+
isCallable = (obj) => typeof obj === "function";
|
|
283
305
|
isMap = (obj) => isType(obj, "Map");
|
|
284
306
|
isSet = (obj) => isType(obj, "Set");
|
|
285
307
|
isError = (err, constructor) => isType(err, "Error") && (constructor ? err instanceof constructor : true);
|
|
308
|
+
isLocale = (obj) => typeof Intl !== "undefined" && typeof Intl.Locale === "function" && obj instanceof Intl.Locale;
|
|
286
309
|
isEmpty = (obj) => isNullish(obj) || isObject(obj) && Reflect.ownKeys(obj).length === 0 || isString(obj) && obj.trim().length === 0 || typeof obj === "number" && Number.isNaN(obj) || isArray(obj) && obj.length === 0 || isSet(obj) && obj.size === 0 || isMap(obj) && obj.size === 0 || ArrayBuffer.isView(obj) && obj.byteLength === 0 || isDate(obj) && Number.isNaN(obj.getTime());
|
|
287
310
|
}
|
|
288
311
|
});
|
|
@@ -514,6 +537,8 @@ function serialize(val, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
514
537
|
if (seen.has(value2))
|
|
515
538
|
return "<Circular>";
|
|
516
539
|
seen.add(value2);
|
|
540
|
+
if (isLocale(value2))
|
|
541
|
+
return value2.toString();
|
|
517
542
|
if (isMap(value2))
|
|
518
543
|
return `map:[${Array.from(value2.entries()).map((e) => serialize(e, seen)).sort().join(",")}]`;
|
|
519
544
|
if (isSet(value2))
|
|
@@ -570,15 +595,86 @@ var init_function_library = __esm({
|
|
|
570
595
|
});
|
|
571
596
|
|
|
572
597
|
// ../../library/dist/common/runtime/json.library.js
|
|
598
|
+
function cleanify(obj) {
|
|
599
|
+
try {
|
|
600
|
+
return JSON.parse(JSON.stringify(obj));
|
|
601
|
+
} catch (error) {
|
|
602
|
+
console.warn("Could not clean object:", error?.message ?? error);
|
|
603
|
+
throw error;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
573
606
|
var init_json_library = __esm({
|
|
574
607
|
"../../library/dist/common/runtime/json.library.js"() {
|
|
575
608
|
"use strict";
|
|
609
|
+
init_assertion_library();
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
// ../../library/dist/common/primitives/object.library.js
|
|
614
|
+
function looseIndex(arg) {
|
|
615
|
+
if (isDefined(arg))
|
|
616
|
+
return isFunction(arg) ? arg() : arg;
|
|
617
|
+
return (obj) => isFunction(obj) ? obj() : obj;
|
|
618
|
+
}
|
|
619
|
+
var getObjectKeys, asObject;
|
|
620
|
+
var init_object_library = __esm({
|
|
621
|
+
"../../library/dist/common/primitives/object.library.js"() {
|
|
622
|
+
"use strict";
|
|
623
|
+
init_primitive_library();
|
|
624
|
+
init_assertion_library();
|
|
625
|
+
init_type_library();
|
|
626
|
+
getObjectKeys = (obj) => {
|
|
627
|
+
const keys = /* @__PURE__ */ new Set();
|
|
628
|
+
let curr = obj;
|
|
629
|
+
let depth = 0;
|
|
630
|
+
while (curr && curr !== Object.prototype && depth++ < 10) {
|
|
631
|
+
const descs = Object.getOwnPropertyDescriptors(curr);
|
|
632
|
+
for (const [key, desc] of Object.entries(descs)) {
|
|
633
|
+
if (!isSafeKey(key))
|
|
634
|
+
continue;
|
|
635
|
+
if (desc.enumerable || isFunction(desc.get)) {
|
|
636
|
+
keys.add(key);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
curr = Object.getPrototypeOf(curr);
|
|
640
|
+
}
|
|
641
|
+
return Array.from(keys);
|
|
642
|
+
};
|
|
643
|
+
asObject = (obj) => {
|
|
644
|
+
if (isPrimitive(obj) || isFunction(obj))
|
|
645
|
+
return obj;
|
|
646
|
+
if (isArray(obj))
|
|
647
|
+
return obj.map((item) => asObject(item));
|
|
648
|
+
if (isDate(obj) || isRegExp(obj) || isMap(obj) || isSet(obj))
|
|
649
|
+
return obj;
|
|
650
|
+
try {
|
|
651
|
+
if (isFunction(obj.toJSON))
|
|
652
|
+
return asObject(obj.toJSON());
|
|
653
|
+
} catch {
|
|
654
|
+
}
|
|
655
|
+
const temp = {};
|
|
656
|
+
for (const key of getObjectKeys(obj)) {
|
|
657
|
+
try {
|
|
658
|
+
temp[key] = asObject(obj[key]);
|
|
659
|
+
} catch {
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
return temp;
|
|
663
|
+
};
|
|
664
|
+
looseIndex.stringSymbol = looseIndex();
|
|
665
|
+
looseIndex.symbolRegExp = looseIndex();
|
|
666
|
+
looseIndex.symbolString = looseIndex();
|
|
667
|
+
looseIndex.stringString = looseIndex();
|
|
576
668
|
}
|
|
577
669
|
});
|
|
578
670
|
|
|
579
671
|
// ../../library/dist/common/runtime/serialize.library.js
|
|
580
|
-
function
|
|
581
|
-
|
|
672
|
+
function clone(obj, opts) {
|
|
673
|
+
try {
|
|
674
|
+
return globalThis.structuredClone(obj, opts);
|
|
675
|
+
} catch {
|
|
676
|
+
return cleanify(obj);
|
|
677
|
+
}
|
|
582
678
|
}
|
|
583
679
|
function reviver(_key, val) {
|
|
584
680
|
return decode(val);
|
|
@@ -624,19 +720,34 @@ function toSymbol(value2) {
|
|
|
624
720
|
return Symbol(desc);
|
|
625
721
|
}
|
|
626
722
|
}
|
|
627
|
-
function stringify(obj) {
|
|
628
|
-
|
|
723
|
+
function stringify(obj, options) {
|
|
724
|
+
const prevCompact = activeCompact;
|
|
725
|
+
activeCompact = options?.compact !== false;
|
|
726
|
+
try {
|
|
727
|
+
const str = stringize(obj, false);
|
|
728
|
+
if (options?.signed) {
|
|
729
|
+
if (!isString(options.secret) || !options.secret)
|
|
730
|
+
throw new TypeError("stringify: signed serialization requires an explicit secret string");
|
|
731
|
+
return `$sig:${fastDigest(str, options.secret)}:${str}`;
|
|
732
|
+
}
|
|
733
|
+
return str;
|
|
734
|
+
} finally {
|
|
735
|
+
activeCompact = prevCompact;
|
|
736
|
+
}
|
|
629
737
|
}
|
|
630
738
|
function stringize(obj, recurse = true) {
|
|
631
739
|
const arg = asType(obj);
|
|
632
740
|
const one = curry(oneKey)(arg.type);
|
|
633
741
|
switch (arg.type) {
|
|
634
|
-
case "String":
|
|
742
|
+
case "String": {
|
|
743
|
+
let strVal = arg.value;
|
|
744
|
+
if (strVal.startsWith("~"))
|
|
745
|
+
strVal = `~${strVal}`;
|
|
635
746
|
if (!recurse) {
|
|
636
|
-
recurse =
|
|
747
|
+
recurse = strVal === "true" || strVal === "false" || strVal === "null" || parseFloat(strVal).toString() === strVal || strVal.startsWith("~");
|
|
637
748
|
}
|
|
638
|
-
return recurse ? JSON.stringify(encode(
|
|
639
|
-
|
|
749
|
+
return recurse ? JSON.stringify(encode(strVal)) : encode(strVal);
|
|
750
|
+
}
|
|
640
751
|
case "Boolean":
|
|
641
752
|
case "Null":
|
|
642
753
|
case "Number":
|
|
@@ -644,11 +755,13 @@ function stringize(obj, recurse = true) {
|
|
|
644
755
|
// JSON.stringify will correctly handle these
|
|
645
756
|
case "Void":
|
|
646
757
|
case "Undefined":
|
|
647
|
-
return one(JSON.stringify("void"));
|
|
758
|
+
return activeCompact ? JSON.stringify("~u") : one(JSON.stringify("void"));
|
|
648
759
|
// preserve 'undefined' values
|
|
649
760
|
case "BigInt":
|
|
650
|
-
return one(arg.value.toString());
|
|
761
|
+
return activeCompact ? JSON.stringify(`~n${arg.value.toString()}`) : one(arg.value.toString());
|
|
651
762
|
// even though BigInt has a toString method, it is not supported in JSON.stringify
|
|
763
|
+
case "Date":
|
|
764
|
+
return activeCompact ? JSON.stringify(`~t${arg.value.getTime()}`) : one(stringize(arg.value.toJSON()));
|
|
652
765
|
case "Object": {
|
|
653
766
|
const obj2 = ownEntries(arg.value).filter(([, val]) => isStringable(val)).map(([key, val]) => `${fromSymbol(key)}: ${stringize(val)}`).join(",");
|
|
654
767
|
return `{${obj2}}`;
|
|
@@ -665,8 +778,10 @@ function stringize(obj, recurse = true) {
|
|
|
665
778
|
const set = Array.from(arg.value.values()).filter((val) => isStringable(val)).map((val) => stringize(val)).join(",");
|
|
666
779
|
return one(`[${set}]`);
|
|
667
780
|
}
|
|
668
|
-
case "Symbol":
|
|
669
|
-
|
|
781
|
+
case "Symbol": {
|
|
782
|
+
const symStr = `${isSymbolFor(arg.value) ? "@" : ""}@(${arg.value.description ?? ""})`;
|
|
783
|
+
return activeCompact ? JSON.stringify(`~y${symStr}`) : one(JSON.stringify(symStr));
|
|
784
|
+
}
|
|
670
785
|
case "RegExp":
|
|
671
786
|
return one(stringize({ source: arg.value.source, flags: arg.value.flags }));
|
|
672
787
|
case "Class":
|
|
@@ -677,21 +792,55 @@ function stringize(obj, recurse = true) {
|
|
|
677
792
|
return void 0;
|
|
678
793
|
case isFunction(value2.toJSON):
|
|
679
794
|
return one(stringize(value2.toJSON()));
|
|
680
|
-
case isFunction(value2.toString): {
|
|
795
|
+
case (isFunction(value2.toString) && value2.toString !== Object.prototype.toString): {
|
|
681
796
|
const str = value2.toString();
|
|
682
797
|
return one(str.includes('"') ? str : JSON.stringify(str));
|
|
683
798
|
}
|
|
684
|
-
case isFunction(value2.valueOf):
|
|
799
|
+
case (isFunction(value2.valueOf) && value2.valueOf !== Object.prototype.valueOf):
|
|
685
800
|
return one(JSON.stringify(value2.valueOf()));
|
|
686
|
-
default:
|
|
687
|
-
|
|
801
|
+
default: {
|
|
802
|
+
const plain = asObject(value2);
|
|
803
|
+
return isReference(plain) && Object.keys(plain).length > 0 ? stringize(plain) : one(JSON.stringify(value2, (key, o) => isEmpty(key) ? o : stringize(o)));
|
|
804
|
+
}
|
|
688
805
|
}
|
|
689
806
|
}
|
|
690
807
|
}
|
|
691
808
|
}
|
|
692
|
-
function objectify(str,
|
|
809
|
+
function objectify(str, optionsOrSentinel) {
|
|
693
810
|
if (!isString(str))
|
|
694
811
|
return str;
|
|
812
|
+
const options = isFunction(optionsOrSentinel) ? { sentinel: optionsOrSentinel } : optionsOrSentinel ?? {};
|
|
813
|
+
if (str.startsWith("$sig:")) {
|
|
814
|
+
const secondColon = str.indexOf(":", 5);
|
|
815
|
+
if (secondColon !== -1) {
|
|
816
|
+
const sig = str.substring(5, secondColon);
|
|
817
|
+
const payload = str.substring(secondColon + 1);
|
|
818
|
+
if (!isString(options.secret) || !options.secret) {
|
|
819
|
+
console.warn("objectify: signature verification requires an explicit secret string");
|
|
820
|
+
if (options.throwOnError)
|
|
821
|
+
throw new TypeError("objectify: signature verification requires an explicit secret string");
|
|
822
|
+
return str;
|
|
823
|
+
}
|
|
824
|
+
const expectedSig = fastDigest(payload, options.secret);
|
|
825
|
+
if (!constantTimeEqual(sig, expectedSig)) {
|
|
826
|
+
console.warn("objectify: signature verification failed");
|
|
827
|
+
if (options.throwOnError)
|
|
828
|
+
throw new Error("objectify: signature verification failed");
|
|
829
|
+
return str;
|
|
830
|
+
}
|
|
831
|
+
str = payload;
|
|
832
|
+
} else if (options.requireSigned) {
|
|
833
|
+
console.warn("objectify: malformed signed payload");
|
|
834
|
+
if (options.throwOnError)
|
|
835
|
+
throw new Error("objectify: malformed signed payload");
|
|
836
|
+
return str;
|
|
837
|
+
}
|
|
838
|
+
} else if (options.requireSigned) {
|
|
839
|
+
console.warn("objectify: unsigned string rejected by requireSigned policy");
|
|
840
|
+
if (options.throwOnError)
|
|
841
|
+
throw new Error("objectify: unsigned string rejected by requireSigned policy");
|
|
842
|
+
return str;
|
|
843
|
+
}
|
|
695
844
|
let parse;
|
|
696
845
|
try {
|
|
697
846
|
parse = JSON.parse(str, reviver);
|
|
@@ -700,28 +849,50 @@ function objectify(str, sentinel) {
|
|
|
700
849
|
console.warn(`objectify.parse: -> ${str}, ${error.message}`);
|
|
701
850
|
return str;
|
|
702
851
|
} else
|
|
703
|
-
return objectify(`"${str}"`,
|
|
852
|
+
return objectify(`"${str}"`, options.requireSigned ? { ...options, requireSigned: false } : options);
|
|
704
853
|
}
|
|
705
854
|
switch (true) {
|
|
706
855
|
case (str.startsWith("{") && str.endsWith("}")):
|
|
707
856
|
// looks like Object
|
|
708
857
|
case (str.startsWith("[") && str.endsWith("]")):
|
|
709
|
-
return traverse(parse,
|
|
858
|
+
return traverse(parse, options, 0);
|
|
710
859
|
// recurse into object
|
|
711
860
|
default:
|
|
712
|
-
return parse;
|
|
861
|
+
return typeify(parse, options);
|
|
713
862
|
}
|
|
714
863
|
}
|
|
715
|
-
function traverse(obj,
|
|
864
|
+
function traverse(obj, options, depth = 0) {
|
|
865
|
+
const maxDepth = options.maxDepth ?? MAX_TRAVERSE_DEPTH;
|
|
866
|
+
if (depth >= maxDepth)
|
|
867
|
+
return obj;
|
|
716
868
|
if (isObject(obj)) {
|
|
717
|
-
return typeify(ownEntries(obj).reduce((acc, [key, val]) => Object.assign(acc, { [toSymbol(key)]: typeify(traverse(val,
|
|
869
|
+
return typeify(ownEntries(obj).filter(([key]) => isSafeKey(key)).reduce((acc, [key, val]) => Object.assign(acc, { [toSymbol(key)]: typeify(traverse(val, options, depth + 1), options) }), {}), options);
|
|
718
870
|
}
|
|
719
871
|
if (isArray(obj)) {
|
|
720
|
-
return ownValues(obj).map((val) => typeify(traverse(val,
|
|
872
|
+
return ownValues(obj).map((val) => typeify(traverse(val, options, depth + 1), options));
|
|
721
873
|
}
|
|
722
|
-
return obj;
|
|
874
|
+
return typeify(obj, options);
|
|
723
875
|
}
|
|
724
|
-
function typeify(json,
|
|
876
|
+
function typeify(json, options) {
|
|
877
|
+
if (isString(json) && json.startsWith("~")) {
|
|
878
|
+
try {
|
|
879
|
+
if (json.startsWith("~~"))
|
|
880
|
+
return json.substring(1);
|
|
881
|
+
if (json.startsWith("~n"))
|
|
882
|
+
return BigInt(json.substring(2));
|
|
883
|
+
if (json.startsWith("~t")) {
|
|
884
|
+
const timeVal = json.substring(2);
|
|
885
|
+
const d = new Date(isNumeric(timeVal) ? Number(timeVal) : timeVal);
|
|
886
|
+
return isNaN(d.getTime()) ? json : d;
|
|
887
|
+
}
|
|
888
|
+
if (json === "~u")
|
|
889
|
+
return options.sentinel?.();
|
|
890
|
+
if (json.startsWith("~y"))
|
|
891
|
+
return toSymbol(json.substring(2));
|
|
892
|
+
} catch {
|
|
893
|
+
return json;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
725
896
|
if (!isObject(json) || ownKeys(json).length !== 1)
|
|
726
897
|
return json;
|
|
727
898
|
const [$type, value2] = ownEntries(json)[0];
|
|
@@ -745,12 +916,14 @@ function typeify(json, sentinel) {
|
|
|
745
916
|
case "Undefined":
|
|
746
917
|
case "Empty":
|
|
747
918
|
case "Void":
|
|
748
|
-
return sentinel?.();
|
|
919
|
+
return options.sentinel?.();
|
|
749
920
|
// run Sentinel function to handle undefined values
|
|
750
921
|
case "Date":
|
|
751
922
|
return new Date(value2);
|
|
752
923
|
case "RegExp":
|
|
753
|
-
if (
|
|
924
|
+
if (options.allowRegExp === false)
|
|
925
|
+
return json;
|
|
926
|
+
if (!isObject(value2) || !isString(value2.source) || value2.source.length > MAX_REGEXP_SOURCE_LENGTH)
|
|
754
927
|
return json;
|
|
755
928
|
return new RegExp(value2.source, value2.flags);
|
|
756
929
|
case "Symbol":
|
|
@@ -763,25 +936,34 @@ function typeify(json, sentinel) {
|
|
|
763
936
|
if (!isArray(value2))
|
|
764
937
|
return json;
|
|
765
938
|
return new Set(value2);
|
|
766
|
-
default:
|
|
939
|
+
default: {
|
|
940
|
+
if (options.allowClasses === false)
|
|
941
|
+
return json;
|
|
942
|
+
if (options.allowedClasses) {
|
|
943
|
+
const allowed = options.allowedClasses instanceof Set ? options.allowedClasses.has($type) || options.allowedClasses.has(type) : options.allowedClasses.includes($type) || options.allowedClasses.includes(type);
|
|
944
|
+
if (!allowed)
|
|
945
|
+
return json;
|
|
946
|
+
}
|
|
767
947
|
const cls = Registry.get($type);
|
|
768
948
|
if (!cls) {
|
|
769
949
|
console.warn(`objectify: dont know how to deserialize '${type}'`);
|
|
770
950
|
return json;
|
|
771
951
|
}
|
|
772
952
|
return Reflect.construct(cls, [value2]);
|
|
953
|
+
}
|
|
773
954
|
}
|
|
774
955
|
} catch {
|
|
775
956
|
return json;
|
|
776
957
|
}
|
|
777
958
|
}
|
|
778
|
-
var Registry, getSafeTag2, registerSerializable, SAFE_URI_MAP, RE_SAFE_URI_CODES, symKey;
|
|
959
|
+
var Registry, getSafeTag2, registerSerializable, SAFE_URI_MAP, RE_SAFE_URI_CODES, symKey, RUNTIME_SALT, fastDigest, constantTimeEqual, activeCompact, MAX_TRAVERSE_DEPTH, MAX_REGEXP_SOURCE_LENGTH;
|
|
779
960
|
var init_serialize_library = __esm({
|
|
780
961
|
"../../library/dist/common/runtime/serialize.library.js"() {
|
|
781
962
|
"use strict";
|
|
782
963
|
init_function_library();
|
|
783
964
|
init_primitive_library();
|
|
784
965
|
init_json_library();
|
|
966
|
+
init_object_library();
|
|
785
967
|
init_type_library();
|
|
786
968
|
init_assertion_library();
|
|
787
969
|
init_symbol_library();
|
|
@@ -824,6 +1006,31 @@ var init_serialize_library = __esm({
|
|
|
824
1006
|
};
|
|
825
1007
|
RE_SAFE_URI_CODES = new RegExp(Object.keys(SAFE_URI_MAP).join("|"), "gi");
|
|
826
1008
|
symKey = /^@(@)?\(([^\)]*)\)$/;
|
|
1009
|
+
RUNTIME_SALT = globalThis.crypto?.randomUUID ? globalThis.crypto.randomUUID().split("-")[0] : Math.random().toString(36).slice(2, 10);
|
|
1010
|
+
fastDigest = (str, secret = RUNTIME_SALT) => {
|
|
1011
|
+
let h1 = 2166136261;
|
|
1012
|
+
let h2 = 2654435769;
|
|
1013
|
+
const input = `${secret}:${str}`;
|
|
1014
|
+
for (let i = 0; i < input.length; i++) {
|
|
1015
|
+
const c = input.charCodeAt(i);
|
|
1016
|
+
h1 = Math.imul(h1 ^ c, 16777619);
|
|
1017
|
+
h2 = Math.imul(h2 ^ c, 2246822507);
|
|
1018
|
+
}
|
|
1019
|
+
return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
|
|
1020
|
+
};
|
|
1021
|
+
constantTimeEqual = (a, b) => {
|
|
1022
|
+
if (!isString(a) || !isString(b))
|
|
1023
|
+
return false;
|
|
1024
|
+
if (a.length !== b.length)
|
|
1025
|
+
return false;
|
|
1026
|
+
let result = 0;
|
|
1027
|
+
for (let i = 0; i < a.length; i++)
|
|
1028
|
+
result |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
1029
|
+
return result === 0;
|
|
1030
|
+
};
|
|
1031
|
+
activeCompact = true;
|
|
1032
|
+
MAX_TRAVERSE_DEPTH = 64;
|
|
1033
|
+
MAX_REGEXP_SOURCE_LENGTH = 512;
|
|
827
1034
|
}
|
|
828
1035
|
});
|
|
829
1036
|
|
|
@@ -917,7 +1124,7 @@ function StringTag(tagOrValue, context3) {
|
|
|
917
1124
|
}
|
|
918
1125
|
return value2;
|
|
919
1126
|
};
|
|
920
|
-
if (
|
|
1127
|
+
if (isCallable(tagOrValue) && context3?.kind === "class")
|
|
921
1128
|
return applyTag(tagOrValue, void 0, context3.name);
|
|
922
1129
|
return (value2, ctx) => {
|
|
923
1130
|
return applyTag(value2, isString(tagOrValue) ? tagOrValue : void 0, ctx?.name);
|
|
@@ -1230,7 +1437,7 @@ var init_cache_class = __esm({
|
|
|
1230
1437
|
this.evictExpired();
|
|
1231
1438
|
const stringEntries = [];
|
|
1232
1439
|
for (const [k, v] of super.entries()) {
|
|
1233
|
-
if (
|
|
1440
|
+
if (isString(k))
|
|
1234
1441
|
stringEntries.push([k, v]);
|
|
1235
1442
|
}
|
|
1236
1443
|
return Object.fromEntries(stringEntries);
|
|
@@ -1354,7 +1561,7 @@ var init_storage_library = __esm({
|
|
|
1354
1561
|
getSafeStorage = (name = "localStorage") => {
|
|
1355
1562
|
try {
|
|
1356
1563
|
const target = globalThis?.[name];
|
|
1357
|
-
if (target &&
|
|
1564
|
+
if (target && isCallable(target.getItem) && isCallable(target.setItem) && isCallable(target.removeItem) && isCallable(target.clear) && isCallable(target.key) && isNumber(target.length))
|
|
1358
1565
|
return target;
|
|
1359
1566
|
} catch {
|
|
1360
1567
|
}
|
|
@@ -1378,37 +1585,6 @@ var init_storage_library = __esm({
|
|
|
1378
1585
|
}
|
|
1379
1586
|
});
|
|
1380
1587
|
|
|
1381
|
-
// ../../library/dist/common/primitives/object.library.js
|
|
1382
|
-
function looseIndex(arg) {
|
|
1383
|
-
if (isDefined(arg))
|
|
1384
|
-
return isFunction(arg) ? arg() : arg;
|
|
1385
|
-
return (obj) => isFunction(obj) ? obj() : obj;
|
|
1386
|
-
}
|
|
1387
|
-
var asObject;
|
|
1388
|
-
var init_object_library = __esm({
|
|
1389
|
-
"../../library/dist/common/primitives/object.library.js"() {
|
|
1390
|
-
"use strict";
|
|
1391
|
-
init_primitive_library();
|
|
1392
|
-
init_assertion_library();
|
|
1393
|
-
init_type_library();
|
|
1394
|
-
asObject = (obj) => {
|
|
1395
|
-
if (isNullish(obj) || !isObject(obj))
|
|
1396
|
-
return obj;
|
|
1397
|
-
const temp = isArray(obj) ? [] : {};
|
|
1398
|
-
ownKeys(obj).forEach((key) => {
|
|
1399
|
-
if (!isSafeKey(key))
|
|
1400
|
-
return;
|
|
1401
|
-
temp[key] = asObject(obj[key]);
|
|
1402
|
-
});
|
|
1403
|
-
return temp;
|
|
1404
|
-
};
|
|
1405
|
-
looseIndex.stringSymbol = looseIndex();
|
|
1406
|
-
looseIndex.symbolRegExp = looseIndex();
|
|
1407
|
-
looseIndex.symbolString = looseIndex();
|
|
1408
|
-
looseIndex.stringString = looseIndex();
|
|
1409
|
-
}
|
|
1410
|
-
});
|
|
1411
|
-
|
|
1412
1588
|
// ../../library/dist/common/primitives/string.library.js
|
|
1413
1589
|
var init_string_library = __esm({
|
|
1414
1590
|
"../../library/dist/common/primitives/string.library.js"() {
|
|
@@ -1419,6 +1595,10 @@ var init_string_library = __esm({
|
|
|
1419
1595
|
});
|
|
1420
1596
|
|
|
1421
1597
|
// ../../library/dist/common/primitives/coercion.library.js
|
|
1598
|
+
function asArray(arr = [], fill) {
|
|
1599
|
+
const mapFn = (val) => isUndefined(fill) || isDefined(val) ? val : clone(fill);
|
|
1600
|
+
return isArrayLike(arr) || isIterable(arr) && !isString(arr) ? Array.from(arr, mapFn) : [arr];
|
|
1601
|
+
}
|
|
1422
1602
|
function asError(err) {
|
|
1423
1603
|
if (isError(err))
|
|
1424
1604
|
return err;
|
|
@@ -1486,55 +1666,87 @@ var init_temporal_library = __esm({
|
|
|
1486
1666
|
});
|
|
1487
1667
|
|
|
1488
1668
|
// ../../library/dist/common/runtime/international.library.js
|
|
1489
|
-
function
|
|
1490
|
-
|
|
1491
|
-
}
|
|
1492
|
-
function getHemisphere(timeZone = getDateTimeFormat().timeZone) {
|
|
1493
|
-
try {
|
|
1494
|
-
const { jan, jul } = getOffsets(timeZone);
|
|
1495
|
-
const southPrefixes = ["Australia", "Antarctica", "Africa/Johannesburg", "America/Argentina/Buenos_Aires", "America/Sao_Paulo"];
|
|
1496
|
-
const isSouthZone = southPrefixes.some((p) => timeZone.startsWith(p));
|
|
1497
|
-
switch (true) {
|
|
1498
|
-
case jul > jan:
|
|
1499
|
-
return "north";
|
|
1500
|
-
case jul < jan:
|
|
1501
|
-
return "south";
|
|
1502
|
-
default:
|
|
1503
|
-
return isSouthZone ? "south" : void 0;
|
|
1504
|
-
}
|
|
1505
|
-
} catch (e) {
|
|
1669
|
+
function getPropOrCall(obj, method, fallbackProp) {
|
|
1670
|
+
if (!obj)
|
|
1506
1671
|
return void 0;
|
|
1507
|
-
|
|
1672
|
+
if (isCallable(obj[method]))
|
|
1673
|
+
return obj[method]();
|
|
1674
|
+
if (fallbackProp && fallbackProp in obj)
|
|
1675
|
+
return obj[fallbackProp];
|
|
1676
|
+
return void 0;
|
|
1677
|
+
}
|
|
1678
|
+
function getFallbackFirstDay(region) {
|
|
1679
|
+
if (!region)
|
|
1680
|
+
return 1;
|
|
1681
|
+
if (FRIDAY_START_REGIONS.has(region))
|
|
1682
|
+
return 5;
|
|
1683
|
+
if (SATURDAY_START_REGIONS.has(region))
|
|
1684
|
+
return 6;
|
|
1685
|
+
if (SUNDAY_START_REGIONS.has(region))
|
|
1686
|
+
return 7;
|
|
1687
|
+
return 1;
|
|
1688
|
+
}
|
|
1689
|
+
function getFallbackWeekend(region) {
|
|
1690
|
+
if (!region)
|
|
1691
|
+
return WEEKEND_SAT_SUN;
|
|
1692
|
+
if (region === "IR")
|
|
1693
|
+
return WEEKEND_FRI;
|
|
1694
|
+
if (region === "AF")
|
|
1695
|
+
return WEEKEND_THU_FRI;
|
|
1696
|
+
if (FRI_SAT_WEEKEND_REGIONS.has(region))
|
|
1697
|
+
return WEEKEND_FRI_SAT;
|
|
1698
|
+
return WEEKEND_SAT_SUN;
|
|
1508
1699
|
}
|
|
1509
|
-
|
|
1700
|
+
function getFallbackDirection(loc, language) {
|
|
1701
|
+
const script = loc?.script ?? (isCallable(loc?.maximize) ? loc.maximize().script : void 0);
|
|
1702
|
+
return script && RTL_SCRIPTS.has(script) || language && RTL_LANGUAGES.has(language) ? "rtl" : "ltr";
|
|
1703
|
+
}
|
|
1704
|
+
var RE_UNDERSCORE, RE_LOCALE_CLEANSE, hasIntl, cleanLocaleTag, getRTF, getLF, getDTF, getPR, getNF, getDF, SUNDAY_START_REGIONS, SATURDAY_START_REGIONS, FRIDAY_START_REGIONS, FRI_SAT_WEEKEND_REGIONS, RTL_LANGUAGES, RTL_SCRIPTS, WEEKEND_SAT_SUN, WEEKEND_FRI_SAT, WEEKEND_FRI, WEEKEND_THU_FRI, getLC, getLI, getDigitsMap, FALLBACK_DTF_OPTIONS, getDateTimeFormat, canonicalLocale, canonicalLocales, getHemisphere, probeMDY;
|
|
1510
1705
|
var init_international_library = __esm({
|
|
1511
1706
|
"../../library/dist/common/runtime/international.library.js"() {
|
|
1512
1707
|
"use strict";
|
|
1513
1708
|
init_temporal_library();
|
|
1514
1709
|
init_function_library();
|
|
1515
1710
|
init_assertion_library();
|
|
1516
|
-
|
|
1517
|
-
|
|
1711
|
+
init_coercion_library();
|
|
1712
|
+
RE_UNDERSCORE = /_/g;
|
|
1713
|
+
RE_LOCALE_CLEANSE = /[.@]/;
|
|
1714
|
+
hasIntl = (feature) => typeof Intl !== "undefined" && (!feature || Object.hasOwn(Intl, feature) && isCallable(Intl[feature]));
|
|
1715
|
+
cleanLocaleTag = (tag2) => {
|
|
1716
|
+
if (isLocale(tag2))
|
|
1717
|
+
tag2 = tag2.toString();
|
|
1718
|
+
if (!isString(tag2))
|
|
1719
|
+
return void 0;
|
|
1720
|
+
const trimmed = tag2.trim();
|
|
1721
|
+
if (isEmpty(trimmed))
|
|
1722
|
+
return void 0;
|
|
1723
|
+
const stripped = trimmed.split(RE_LOCALE_CLEANSE)[0];
|
|
1724
|
+
if (isEmpty(stripped))
|
|
1725
|
+
return void 0;
|
|
1726
|
+
return stripped.replace(RE_UNDERSCORE, "-");
|
|
1727
|
+
};
|
|
1728
|
+
getRTF = memoizeFunction((locale, options) => {
|
|
1729
|
+
return new Intl.RelativeTimeFormat(cleanLocaleTag(locale), options);
|
|
1518
1730
|
});
|
|
1519
|
-
getLF = memoizeFunction((locale,
|
|
1520
|
-
return new Intl.ListFormat(locale,
|
|
1731
|
+
getLF = memoizeFunction((locale, options) => {
|
|
1732
|
+
return new Intl.ListFormat(cleanLocaleTag(locale), options);
|
|
1521
1733
|
});
|
|
1522
1734
|
getDTF = memoizeFunction((locale, options) => {
|
|
1523
|
-
return new Intl.DateTimeFormat(locale, options);
|
|
1735
|
+
return new Intl.DateTimeFormat(cleanLocaleTag(locale), options);
|
|
1524
1736
|
});
|
|
1525
1737
|
getPR = memoizeFunction((locale, options) => {
|
|
1526
1738
|
try {
|
|
1527
|
-
return new Intl.PluralRules(locale, options);
|
|
1739
|
+
return new Intl.PluralRules(cleanLocaleTag(locale), options);
|
|
1528
1740
|
} catch (e) {
|
|
1529
1741
|
return { select: () => "other" };
|
|
1530
1742
|
}
|
|
1531
1743
|
});
|
|
1532
1744
|
getNF = memoizeFunction((locale, options) => {
|
|
1533
|
-
return new Intl.NumberFormat(locale, options);
|
|
1745
|
+
return new Intl.NumberFormat(cleanLocaleTag(locale), options);
|
|
1534
1746
|
});
|
|
1535
1747
|
getDF = memoizeFunction((locale, options) => {
|
|
1536
1748
|
try {
|
|
1537
|
-
const df = new Intl.DurationFormat(locale, options);
|
|
1749
|
+
const df = new Intl.DurationFormat(cleanLocaleTag(locale), options);
|
|
1538
1750
|
if (isFunction(df.format))
|
|
1539
1751
|
return df;
|
|
1540
1752
|
throw new Error("No format method");
|
|
@@ -1542,6 +1754,135 @@ var init_international_library = __esm({
|
|
|
1542
1754
|
return { format: (duration) => String(duration) };
|
|
1543
1755
|
}
|
|
1544
1756
|
});
|
|
1757
|
+
SUNDAY_START_REGIONS = /* @__PURE__ */ new Set(["US", "CA", "MX", "BR", "IL", "JP", "TW", "HK", "MO", "PH", "SG", "TH", "IN", "KR", "CO", "PE", "VE", "ZA"]);
|
|
1758
|
+
SATURDAY_START_REGIONS = /* @__PURE__ */ new Set(["SA", "AF", "BH", "DJ", "DZ", "EG", "IQ", "IR", "JO", "KW", "LY", "OM", "QA", "SD", "SY", "YE"]);
|
|
1759
|
+
FRIDAY_START_REGIONS = /* @__PURE__ */ new Set(["MV"]);
|
|
1760
|
+
FRI_SAT_WEEKEND_REGIONS = /* @__PURE__ */ new Set(["SA", "BH", "DJ", "DZ", "EG", "IQ", "JO", "KW", "LY", "OM", "QA", "SD", "SY", "YE"]);
|
|
1761
|
+
RTL_LANGUAGES = /* @__PURE__ */ new Set(["ar", "he", "fa", "ur", "yi", "ps", "sd", "ug", "ckb"]);
|
|
1762
|
+
RTL_SCRIPTS = /* @__PURE__ */ new Set(["Arab", "Hebr", "Thaa", "Syrc", "Mand", "Samr", "Nkoo"]);
|
|
1763
|
+
WEEKEND_SAT_SUN = Object.freeze([6, 7]);
|
|
1764
|
+
WEEKEND_FRI_SAT = Object.freeze([5, 6]);
|
|
1765
|
+
WEEKEND_FRI = Object.freeze([5]);
|
|
1766
|
+
WEEKEND_THU_FRI = Object.freeze([4, 5]);
|
|
1767
|
+
getLC = memoizeFunction((localeTag) => {
|
|
1768
|
+
if (isLocale(localeTag))
|
|
1769
|
+
return localeTag;
|
|
1770
|
+
if (!hasIntl("Locale"))
|
|
1771
|
+
return void 0;
|
|
1772
|
+
try {
|
|
1773
|
+
const cleaned = cleanLocaleTag(localeTag);
|
|
1774
|
+
return new Intl.Locale(cleaned || "en-US");
|
|
1775
|
+
} catch {
|
|
1776
|
+
return void 0;
|
|
1777
|
+
}
|
|
1778
|
+
});
|
|
1779
|
+
getLI = memoizeFunction((localeTag) => {
|
|
1780
|
+
const loc = getLC(localeTag) ?? getLC("en-US");
|
|
1781
|
+
const baseName = loc?.baseName ?? canonicalLocale(localeTag) ?? "en-US";
|
|
1782
|
+
const language = loc?.language ?? baseName.split("-")[0]?.toLowerCase();
|
|
1783
|
+
const regionSubtags = [];
|
|
1784
|
+
for (const sub of baseName.split("-").slice(1)) {
|
|
1785
|
+
if (sub.length === 1)
|
|
1786
|
+
break;
|
|
1787
|
+
regionSubtags.push(sub);
|
|
1788
|
+
}
|
|
1789
|
+
const region = loc?.region ?? (isCallable(loc?.maximize) ? loc.maximize().region : void 0) ?? regionSubtags.find((subtag) => /^[a-zA-Z]{2}$|^\d{3}$/.test(subtag))?.toUpperCase();
|
|
1790
|
+
const script = loc?.script ?? (isCallable(loc?.maximize) ? loc.maximize().script : void 0);
|
|
1791
|
+
const rawWeek = getPropOrCall(loc, "getWeekInfo", "weekInfo");
|
|
1792
|
+
const firstDay = rawWeek?.firstDay ?? getFallbackFirstDay(region);
|
|
1793
|
+
const weekend = Array.isArray(rawWeek?.weekend) ? Object.freeze([...rawWeek.weekend]) : getFallbackWeekend(region);
|
|
1794
|
+
const rawCycles = getPropOrCall(loc, "getHourCycles", "hourCycles") ?? loc?.hourCycle;
|
|
1795
|
+
const resolvedHc = rawCycles ?? (hasIntl("DateTimeFormat") ? getDTF(baseName, { hour: "numeric" }).resolvedOptions().hourCycle : void 0);
|
|
1796
|
+
const hourCycles = Array.isArray(resolvedHc) && resolvedHc.length > 0 ? Object.freeze([...resolvedHc]) : isString(resolvedHc) ? Object.freeze([resolvedHc]) : Object.freeze(["h23"]);
|
|
1797
|
+
const rawText = getPropOrCall(loc, "getTextInfo", "textInfo");
|
|
1798
|
+
const direction = rawText?.direction === "rtl" || rawText?.direction === "ltr" ? rawText.direction : getFallbackDirection(loc, language);
|
|
1799
|
+
const rawSystems = getPropOrCall(loc, "getNumberingSystems", "numberingSystems") ?? loc?.numberingSystem;
|
|
1800
|
+
const resolvedNs = rawSystems ?? (hasIntl("NumberFormat") ? getNF(baseName).resolvedOptions().numberingSystem : void 0);
|
|
1801
|
+
const numberingSystems = Array.isArray(resolvedNs) && resolvedNs.length > 0 ? Object.freeze([...resolvedNs]) : isString(resolvedNs) ? Object.freeze([resolvedNs]) : Object.freeze(["latn"]);
|
|
1802
|
+
const rawTimeZones = getPropOrCall(loc, "getTimeZones", "timeZones");
|
|
1803
|
+
const timeZones = Array.isArray(rawTimeZones) && rawTimeZones.length > 0 ? Object.freeze([...rawTimeZones]) : Object.freeze([]);
|
|
1804
|
+
const weekInfo = Object.freeze({ firstDay, weekend });
|
|
1805
|
+
return Object.freeze({
|
|
1806
|
+
locale: loc,
|
|
1807
|
+
baseName,
|
|
1808
|
+
language,
|
|
1809
|
+
region,
|
|
1810
|
+
script,
|
|
1811
|
+
weekInfo,
|
|
1812
|
+
firstDay,
|
|
1813
|
+
weekend,
|
|
1814
|
+
hourCycle: hourCycles[0],
|
|
1815
|
+
hourCycles,
|
|
1816
|
+
direction,
|
|
1817
|
+
numberingSystem: numberingSystems[0],
|
|
1818
|
+
numberingSystems,
|
|
1819
|
+
timeZones
|
|
1820
|
+
});
|
|
1821
|
+
});
|
|
1822
|
+
getDigitsMap = memoizeFunction((numberingSystem = "latn") => {
|
|
1823
|
+
if (!numberingSystem || numberingSystem === "latn" || !hasIntl("NumberFormat"))
|
|
1824
|
+
return void 0;
|
|
1825
|
+
try {
|
|
1826
|
+
const nf = new Intl.NumberFormat(`en-u-nu-${numberingSystem}`, { useGrouping: false });
|
|
1827
|
+
const digits = Array.from({ length: 10 }, (_, i) => nf.format(i));
|
|
1828
|
+
if (digits[0] === "0" && digits[9] === "9")
|
|
1829
|
+
return void 0;
|
|
1830
|
+
return Object.freeze(digits);
|
|
1831
|
+
} catch {
|
|
1832
|
+
return void 0;
|
|
1833
|
+
}
|
|
1834
|
+
});
|
|
1835
|
+
FALLBACK_DTF_OPTIONS = Object.freeze({
|
|
1836
|
+
locale: "en-US",
|
|
1837
|
+
calendar: "iso8601",
|
|
1838
|
+
numberingSystem: "latn",
|
|
1839
|
+
timeZone: "UTC"
|
|
1840
|
+
});
|
|
1841
|
+
getDateTimeFormat = memoizeFunction(() => {
|
|
1842
|
+
return hasIntl("DateTimeFormat") ? Object.freeze(getDTF().resolvedOptions()) : FALLBACK_DTF_OPTIONS;
|
|
1843
|
+
});
|
|
1844
|
+
canonicalLocale = memoizeFunction((locale) => {
|
|
1845
|
+
const cleaned = cleanLocaleTag(locale);
|
|
1846
|
+
if (!cleaned)
|
|
1847
|
+
return void 0;
|
|
1848
|
+
if (hasIntl("getCanonicalLocales")) {
|
|
1849
|
+
try {
|
|
1850
|
+
return Intl.getCanonicalLocales(cleaned)[0];
|
|
1851
|
+
} catch {
|
|
1852
|
+
return void 0;
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
return getLC(cleaned)?.baseName ?? cleaned;
|
|
1856
|
+
});
|
|
1857
|
+
canonicalLocales = memoizeFunction((locales) => {
|
|
1858
|
+
return Object.freeze(asArray(locales).map((l) => canonicalLocale(l)).filter(Boolean));
|
|
1859
|
+
});
|
|
1860
|
+
getHemisphere = memoizeFunction((timeZone = getDateTimeFormat().timeZone) => {
|
|
1861
|
+
try {
|
|
1862
|
+
const { jan, jul } = getOffsets(timeZone);
|
|
1863
|
+
const southPrefixes = ["Australia", "Antarctica", "Africa/Johannesburg", "America/Argentina/Buenos_Aires", "America/Sao_Paulo"];
|
|
1864
|
+
const isSouthZone = southPrefixes.some((p) => timeZone.startsWith(p));
|
|
1865
|
+
switch (true) {
|
|
1866
|
+
case jul > jan:
|
|
1867
|
+
return "north";
|
|
1868
|
+
case jul < jan:
|
|
1869
|
+
return "south";
|
|
1870
|
+
default:
|
|
1871
|
+
return isSouthZone ? "south" : void 0;
|
|
1872
|
+
}
|
|
1873
|
+
} catch (e) {
|
|
1874
|
+
return void 0;
|
|
1875
|
+
}
|
|
1876
|
+
});
|
|
1877
|
+
probeMDY = memoizeFunction((locale) => {
|
|
1878
|
+
try {
|
|
1879
|
+
const date = new Date(2024, 11, 24);
|
|
1880
|
+
const parts = getDTF(locale).formatToParts(date);
|
|
1881
|
+
return parts[0].type === "month" && parts[0].value === "12";
|
|
1882
|
+
} catch {
|
|
1883
|
+
return false;
|
|
1884
|
+
}
|
|
1885
|
+
});
|
|
1545
1886
|
}
|
|
1546
1887
|
});
|
|
1547
1888
|
|
|
@@ -2028,7 +2369,12 @@ var init_mapper_library = __esm({
|
|
|
2028
2369
|
if (context2.type === CONTEXT.Browser) {
|
|
2029
2370
|
Promise.resolve().then(() => (init_webstore_class(), webstore_class_exports)).then(({ WebStore: WebStore2 }) => {
|
|
2030
2371
|
const local = new WebStore2("local");
|
|
2031
|
-
|
|
2372
|
+
const stashed = local.get(MAP_KEY, {});
|
|
2373
|
+
if (isReference(stashed)) {
|
|
2374
|
+
if (stashed.geolocation && (!stashed.geolocation.coords || stashed.geolocation.$GeolocationPosition))
|
|
2375
|
+
delete stashed.geolocation;
|
|
2376
|
+
Object.assign(mapStore, stashed);
|
|
2377
|
+
}
|
|
2032
2378
|
resolve(local);
|
|
2033
2379
|
}).catch(reject);
|
|
2034
2380
|
} else {
|
|
@@ -2428,8 +2774,8 @@ __export(sdk_exports, {
|
|
|
2428
2774
|
__reExport(sdk_exports, sdk_star);
|
|
2429
2775
|
import * as sdk_star from "@magmacomputing/tempo/plugin/sdk";
|
|
2430
2776
|
import { definePlugin as originalPlugin, defineTerm as originalTerm } from "@magmacomputing/tempo/plugin/sdk";
|
|
2431
|
-
var definePlugin = (config) => originalPlugin({ ...config, version: "1.
|
|
2432
|
-
var defineTerm = (config) => originalTerm({ ...config, version: "1.
|
|
2777
|
+
var definePlugin = (config) => originalPlugin({ ...config, version: "1.1.0" });
|
|
2778
|
+
var defineTerm = (config) => originalTerm({ ...config, version: "1.1.0" });
|
|
2433
2779
|
|
|
2434
2780
|
// ../../library/dist/common/runtime/mapper.library.js
|
|
2435
2781
|
init_utility_library();
|
|
@@ -2801,40 +3147,54 @@ init_mapper_library();
|
|
|
2801
3147
|
init_assertion_library();
|
|
2802
3148
|
var GeoPlugin = definePlugin({
|
|
2803
3149
|
name: "geo",
|
|
2804
|
-
install(TempoClass) {
|
|
2805
|
-
const
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
browser: geoLocation,
|
|
2816
|
-
get current() {
|
|
2817
|
-
return getStashedGeo() ?? TempoClass.config?.geo;
|
|
2818
|
-
}
|
|
3150
|
+
install(TempoClass, options) {
|
|
3151
|
+
const installedClass = TempoClass || this;
|
|
3152
|
+
const getEffectiveOptions = (callSiteOpts, instance) => {
|
|
3153
|
+
const classOpts = installedClass.config?.pluginOptions?.geo;
|
|
3154
|
+
const instanceOpts = instance?.config?.pluginOptions?.geo;
|
|
3155
|
+
return {
|
|
3156
|
+
...isObject(options) ? options : {},
|
|
3157
|
+
...isObject(classOpts) ? classOpts : {},
|
|
3158
|
+
...isObject(instanceOpts) ? instanceOpts : {},
|
|
3159
|
+
...isObject(callSiteOpts) ? callSiteOpts : {}
|
|
3160
|
+
};
|
|
2819
3161
|
};
|
|
2820
|
-
Object.
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
3162
|
+
if (!Object.hasOwn(installedClass, "geo")) {
|
|
3163
|
+
const geoNamespace = {
|
|
3164
|
+
lookup: (opts) => geoLookup(getEffectiveOptions(opts)),
|
|
3165
|
+
resolve: (target, opts) => resolveGeoCoordinates(target, getEffectiveOptions(opts, target)),
|
|
3166
|
+
coerce: coerceGeo,
|
|
3167
|
+
distance: haversineDistance,
|
|
3168
|
+
solarOffset,
|
|
3169
|
+
stash: stashGeo,
|
|
3170
|
+
clear: clearStashedGeo,
|
|
3171
|
+
get: getStashedGeo,
|
|
3172
|
+
server: serverGeoLocation,
|
|
3173
|
+
browser: geoLocation,
|
|
3174
|
+
get current() {
|
|
3175
|
+
return getStashedGeo() ?? installedClass.config?.geo;
|
|
3176
|
+
}
|
|
3177
|
+
};
|
|
3178
|
+
Object.defineProperty(installedClass, "geo", {
|
|
3179
|
+
value: (0, sdk_exports.deepFreeze)(geoNamespace),
|
|
3180
|
+
writable: false,
|
|
3181
|
+
configurable: false,
|
|
3182
|
+
enumerable: false
|
|
3183
|
+
});
|
|
3184
|
+
}
|
|
2826
3185
|
TempoClass.prototype.geoLocate = async function(opts) {
|
|
2827
|
-
const
|
|
2828
|
-
const
|
|
3186
|
+
const effectiveOpts = getEffectiveOptions(opts, this);
|
|
3187
|
+
const setTimezone = effectiveOpts?.setTimezone !== false;
|
|
3188
|
+
const coords = await resolveGeoCoordinates(this, effectiveOpts);
|
|
2829
3189
|
if (coords) {
|
|
2830
|
-
const existingGeo =
|
|
3190
|
+
const existingGeo = isObject(this.config.geo) ? this.config.geo : {};
|
|
2831
3191
|
const customKeys = {};
|
|
2832
3192
|
for (const key of Object.keys(existingGeo)) {
|
|
2833
3193
|
if (isSafeKey(key) && !GEO_PROPERTIES.includes(key))
|
|
2834
3194
|
customKeys[key] = existingGeo[key];
|
|
2835
3195
|
}
|
|
2836
3196
|
const callSiteGeo = coerceGeo(opts) ?? {};
|
|
2837
|
-
if (opts
|
|
3197
|
+
if (isObject(opts)) {
|
|
2838
3198
|
for (const key of Object.keys(opts)) {
|
|
2839
3199
|
if (isSafeKey(key) && !["setTimezone", "refresh", "ttl", "endpoint", "timeout", "catch", "debug", "geo"].includes(key)) {
|
|
2840
3200
|
if (!GEO_PROPERTIES.includes(key))
|
|
@@ -2867,13 +3227,13 @@ var GeoPlugin = definePlugin({
|
|
|
2867
3227
|
return this;
|
|
2868
3228
|
};
|
|
2869
3229
|
TempoClass.prototype.geoLookup = async function(opts) {
|
|
2870
|
-
return resolveGeoCoordinates(this, opts);
|
|
3230
|
+
return resolveGeoCoordinates(this, getEffectiveOptions(opts, this));
|
|
2871
3231
|
};
|
|
2872
3232
|
TempoClass.prototype.geoDistance = function(other, unit) {
|
|
2873
3233
|
return haversineDistance(this, other, unit);
|
|
2874
3234
|
};
|
|
2875
|
-
TempoClass.prototype.geoSolarOffset = function(
|
|
2876
|
-
return solarOffset(this,
|
|
3235
|
+
TempoClass.prototype.geoSolarOffset = function(options2) {
|
|
3236
|
+
return solarOffset(this, options2);
|
|
2877
3237
|
};
|
|
2878
3238
|
}
|
|
2879
3239
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magmacomputing/tempo-plugin-geo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Tempo community plugin for IP geolocation lookup, browser hardware location services, and coordinate resolution.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|