@trakit/objects 0.0.11 → 0.0.13
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/Accounts/User.d.ts +3 -1
- package/Assets/Asset.d.ts +3 -1
- package/Companies/Company.d.ts +20 -1
- package/Providers/Provider.d.ts +12 -1
- package/index.d.ts +18 -2
- package/index.js +1 -0
- package/package.json +1 -1
- package/trakit-objects.min.js +2 -2
package/Accounts/User.d.ts
CHANGED
|
@@ -21,7 +21,6 @@ import { UserSSO } from "./UserSSO";
|
|
|
21
21
|
* A grouping of credentials, information, preferences, and permissions for a person or machine to login to the system and access its resources.
|
|
22
22
|
*/
|
|
23
23
|
export declare class User extends BaseCompound implements IEnabled, IBelongCompany, IHavePermissions, IHavePreferences {
|
|
24
|
-
#private;
|
|
25
24
|
/**
|
|
26
25
|
*
|
|
27
26
|
*/
|
|
@@ -40,6 +39,7 @@ export declare class User extends BaseCompound implements IEnabled, IBelongCompa
|
|
|
40
39
|
* The {@link Company} to which this user belongs.
|
|
41
40
|
*/
|
|
42
41
|
get company(): Company;
|
|
42
|
+
protected _general: UserGeneral;
|
|
43
43
|
/**
|
|
44
44
|
*
|
|
45
45
|
*/
|
|
@@ -96,6 +96,7 @@ export declare class User extends BaseCompound implements IEnabled, IBelongCompa
|
|
|
96
96
|
*/
|
|
97
97
|
get notify(): UserNotifications[];
|
|
98
98
|
set notify(value: UserNotifications[]);
|
|
99
|
+
protected _advanced: UserAdvanced;
|
|
99
100
|
/**
|
|
100
101
|
*
|
|
101
102
|
*/
|
|
@@ -116,6 +117,7 @@ export declare class User extends BaseCompound implements IEnabled, IBelongCompa
|
|
|
116
117
|
*/
|
|
117
118
|
get permissions(): Permission[];
|
|
118
119
|
set permissions(value: Permission[]);
|
|
120
|
+
protected _authentication: UserAuthentication;
|
|
119
121
|
/**
|
|
120
122
|
*
|
|
121
123
|
*/
|
package/Assets/Asset.d.ts
CHANGED
|
@@ -24,7 +24,6 @@ import { AssetType } from "./AssetType";
|
|
|
24
24
|
* The full details of an Asset, containing all the properties from the {@link AssetGeneral} and {@link AssetAdvanced} objects.
|
|
25
25
|
*/
|
|
26
26
|
export declare class Asset extends BaseCompound implements IIdUlong, INamed, IIconic, IBelongCompany, ILabelled, IPictured, ISuspendable {
|
|
27
|
-
#private;
|
|
28
27
|
/**
|
|
29
28
|
*
|
|
30
29
|
*/
|
|
@@ -46,6 +45,7 @@ export declare class Asset extends BaseCompound implements IIdUlong, INamed, IIc
|
|
|
46
45
|
* Type of asset.
|
|
47
46
|
*/
|
|
48
47
|
get kind(): AssetType;
|
|
48
|
+
protected _general: AssetGeneral;
|
|
49
49
|
/**
|
|
50
50
|
*
|
|
51
51
|
*/
|
|
@@ -143,6 +143,7 @@ export declare class Asset extends BaseCompound implements IIdUlong, INamed, IIc
|
|
|
143
143
|
*/
|
|
144
144
|
get serial(): string;
|
|
145
145
|
set serial(value: string);
|
|
146
|
+
protected _advanced: AssetAdvanced;
|
|
146
147
|
/**
|
|
147
148
|
*
|
|
148
149
|
*/
|
|
@@ -197,6 +198,7 @@ export declare class Asset extends BaseCompound implements IIdUlong, INamed, IIc
|
|
|
197
198
|
*/
|
|
198
199
|
get engineHours(): double;
|
|
199
200
|
set engineHours(value: double);
|
|
201
|
+
protected _dispatch: AssetDispatch;
|
|
200
202
|
/**
|
|
201
203
|
*
|
|
202
204
|
*/
|
package/Companies/Company.d.ts
CHANGED
|
@@ -7,7 +7,11 @@ import { IIdUlong } from '../API/Interfaces/IIdUlong';
|
|
|
7
7
|
import { INamed } from '../API/Interfaces/INamed';
|
|
8
8
|
import { JsonObject, codified, ulong } from '../API/Types';
|
|
9
9
|
import { Picture } from '../Images/Picture';
|
|
10
|
+
import { CompanyDirectory } from './CompanyDirectory';
|
|
11
|
+
import { CompanyGeneral } from './CompanyGeneral';
|
|
12
|
+
import { CompanyPolicy } from './CompanyPolicy';
|
|
10
13
|
import { CompanyReseller } from './CompanyReseller';
|
|
14
|
+
import { CompanyStyle } from './CompanyStyle';
|
|
11
15
|
import { LabelStyle } from './LabelStyle';
|
|
12
16
|
import { PasswordPolicy } from './PasswordPolicy';
|
|
13
17
|
import { SessionPolicy } from './SessionPolicy';
|
|
@@ -15,7 +19,6 @@ import { SessionPolicy } from './SessionPolicy';
|
|
|
15
19
|
* The full company object which contains all fields.
|
|
16
20
|
*/
|
|
17
21
|
export declare class Company extends BaseCompound implements IIdUlong, INamed, IAmCompany, IBelongCompany {
|
|
18
|
-
#private;
|
|
19
22
|
/**
|
|
20
23
|
*
|
|
21
24
|
*/
|
|
@@ -35,6 +38,10 @@ export declare class Company extends BaseCompound implements IIdUlong, INamed, I
|
|
|
35
38
|
*/
|
|
36
39
|
get parentId(): number;
|
|
37
40
|
set parentId(value: number);
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
protected _general: CompanyGeneral;
|
|
38
45
|
/**
|
|
39
46
|
* The organizational name.
|
|
40
47
|
*/
|
|
@@ -50,11 +57,19 @@ export declare class Company extends BaseCompound implements IIdUlong, INamed, I
|
|
|
50
57
|
*/
|
|
51
58
|
get references(): Map<string, string>;
|
|
52
59
|
set references(value: Map<string, string>);
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
protected _directory: CompanyDirectory;
|
|
53
64
|
/**
|
|
54
65
|
* The list of Contacts from this and other companies broken down by contact role.
|
|
55
66
|
*/
|
|
56
67
|
get employees(): Map<string, ulong[]>;
|
|
57
68
|
set employees(value: Map<string, ulong[]>);
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
protected _policy: CompanyPolicy;
|
|
58
73
|
/**
|
|
59
74
|
* The session lifetime policy.
|
|
60
75
|
*/
|
|
@@ -65,6 +80,10 @@ export declare class Company extends BaseCompound implements IIdUlong, INamed, I
|
|
|
65
80
|
*/
|
|
66
81
|
get passwordPolicy(): PasswordPolicy;
|
|
67
82
|
set passwordPolicy(value: PasswordPolicy);
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
*/
|
|
86
|
+
protected _style: CompanyStyle;
|
|
68
87
|
/**
|
|
69
88
|
* The styles for labels added to Assets, Places, and other things.
|
|
70
89
|
*/
|
package/Providers/Provider.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ import { ProviderType } from "./ProviderType";
|
|
|
19
19
|
* A device, modem, or service which provides events from the field.
|
|
20
20
|
*/
|
|
21
21
|
export declare class Provider extends BaseCompound implements INamed, IBelongCompany, ISuspendable {
|
|
22
|
-
#private;
|
|
23
22
|
/**
|
|
24
23
|
*
|
|
25
24
|
*/
|
|
@@ -41,6 +40,10 @@ export declare class Provider extends BaseCompound implements INamed, IBelongCom
|
|
|
41
40
|
* The kind of communication protocol this device uses.
|
|
42
41
|
*/
|
|
43
42
|
get kind(): ProviderType;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
protected _general: ProviderGeneral;
|
|
44
47
|
get general(): ProviderGeneral;
|
|
45
48
|
/**
|
|
46
49
|
* This thing's name.
|
|
@@ -100,6 +103,10 @@ export declare class Provider extends BaseCompound implements INamed, IBelongCom
|
|
|
100
103
|
*/
|
|
101
104
|
get sim(): string;
|
|
102
105
|
set sim(value: string);
|
|
106
|
+
/**
|
|
107
|
+
*
|
|
108
|
+
*/
|
|
109
|
+
protected _advanced: ProviderAdvanced;
|
|
103
110
|
get advanced(): ProviderAdvanced;
|
|
104
111
|
/**
|
|
105
112
|
* The last IP address of the device.
|
|
@@ -116,6 +123,10 @@ export declare class Provider extends BaseCompound implements INamed, IBelongCom
|
|
|
116
123
|
*/
|
|
117
124
|
get snf(): Map<string, string>;
|
|
118
125
|
set snf(value: Map<string, string>);
|
|
126
|
+
/**
|
|
127
|
+
*
|
|
128
|
+
*/
|
|
129
|
+
protected _control: ProviderControl;
|
|
119
130
|
get control(): ProviderControl;
|
|
120
131
|
/**
|
|
121
132
|
* Collection of commands for this provider.
|
package/index.d.ts
CHANGED
|
@@ -42,9 +42,25 @@ import { Radial } from "./API/Geometry/Radial";
|
|
|
42
42
|
import { Rectangle } from "./API/Geometry/Rectangle";
|
|
43
43
|
import { Size } from "./API/Geometry/Size";
|
|
44
44
|
import { GUID } from "./API/Guid";
|
|
45
|
+
import { IAmCompany } from "./API/Interfaces/IAmCompany";
|
|
46
|
+
import { IBelongAsset } from "./API/Interfaces/IBelongAsset";
|
|
47
|
+
import { IBelongBillingProfile } from "./API/Interfaces/IBelongBillingProfile";
|
|
48
|
+
import { IBelongCompany } from "./API/Interfaces/IBelongCompany";
|
|
45
49
|
import { IDeserializable } from "./API/Interfaces/IDeserializable";
|
|
50
|
+
import { IEnabled } from "./API/Interfaces/IEnabled";
|
|
51
|
+
import { IFileSize } from "./API/Interfaces/IFileSize";
|
|
52
|
+
import { IGlobal } from "./API/Interfaces/IGlobal";
|
|
53
|
+
import { IHavePermissions } from "./API/Interfaces/IHavePermissions";
|
|
54
|
+
import { IHavePreferences } from "./API/Interfaces/IHavePreferences";
|
|
55
|
+
import { IIconic } from "./API/Interfaces/IIconic";
|
|
56
|
+
import { IIdUlong } from "./API/Interfaces/IIdUlong";
|
|
57
|
+
import { ILabelled } from "./API/Interfaces/ILabelled";
|
|
58
|
+
import { INamed } from "./API/Interfaces/INamed";
|
|
59
|
+
import { IPictured } from "./API/Interfaces/IPictured";
|
|
46
60
|
import { IRequestable } from "./API/Interfaces/IRequestable";
|
|
47
61
|
import { ISerializable } from "./API/Interfaces/ISerializable";
|
|
62
|
+
import { ISuspendable } from "./API/Interfaces/ISuspendable";
|
|
63
|
+
import { IVisual } from "./API/Interfaces/IVisual";
|
|
48
64
|
import { SearchPattern } from "./API/SearchPattern";
|
|
49
65
|
import { TIMESPAN_PARSE, TIMESPAN_STRINGIFY, TimeSpan } from "./API/TimeSpan";
|
|
50
66
|
import { Timezone } from "./API/Timezone";
|
|
@@ -188,7 +204,7 @@ import { ReportType } from "./Reports/ReportType";
|
|
|
188
204
|
/**
|
|
189
205
|
* Version number for this release.
|
|
190
206
|
*/
|
|
191
|
-
export declare const version = "0.0.
|
|
207
|
+
export declare const version = "0.0.13";
|
|
192
208
|
/**
|
|
193
209
|
* The names of all main object types in the Trak-iT Object Model.
|
|
194
210
|
*/
|
|
@@ -212,7 +228,7 @@ export declare const storage: {
|
|
|
212
228
|
* Common types used throughout the application.
|
|
213
229
|
* These are simply numbers or strings of a specific format.
|
|
214
230
|
*/
|
|
215
|
-
export type { JsonArray, JsonObject, JsonValue, byte, double, int, long, phone, sbyte, short, single, uint, ulong, ushort, codified, colour, datetime, datetimetemplate, email, expression, guid, ipv4, nothing, polyline, timespan, url,
|
|
231
|
+
export type { JsonArray, JsonObject, JsonValue, byte, double, int, long, phone, sbyte, short, single, uint, ulong, ushort, codified, colour, datetime, datetimetemplate, email, expression, guid, ipv4, nothing, polyline, timespan, url, IAmCompany, IBelongBillingProfile, IBelongCompany, IBelongAsset, IDeserializable, IEnabled, IFileSize, IGlobal, IHavePermissions, IHavePreferences, IIconic, IIdUlong, ILabelled, INamed, IPictured, IRequestable, ISerializable, ISuspendable, IVisual, };
|
|
216
232
|
/**
|
|
217
233
|
* A group of utility functions for common tasks like dealing with strings.
|
|
218
234
|
*/
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './trakit-objects.min.js';
|
package/package.json
CHANGED
package/trakit-objects.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
function t(t){const s=[];for(let e=0,i=t.length;e<i;e++)s.indexOf(t[e])<0&&s.push(t[e]);return s}function s(t,s){const e=[];for(let i=0,n=t.length;i<n;i++){let n=!1;for(let e=0,r=s.length;e<r&&(n=t[i]===s[e],!n);e++);n||e.push(t[i])}return e}function e(t){return t.id}function i(t){return t.toJSON()}function n(t,s){return this[s]}function r(t){if(t instanceof Array)return t.map(r);if(t instanceof Date)return new Date(t);if(t instanceof Map){const s=new Map;return t.forEach(((t,e)=>s.set(e,r(t)))),s}if(t instanceof Set){const s=new Set;return t.forEach((t=>s.add(r(t)))),s}return t instanceof RegExp?new RegExp(t.source,(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")):h(t)||a(t)&&!u(t)?null:"object"==typeof t?{...t}:t}function h(t){return null==t}function a(t){return"number"==typeof t||t instanceof Number}function o(t){return"string"==typeof t||t instanceof String}function u(t){return a(t)&&!isNaN(t)&&isFinite(t)}function c(t,s){let e=as(10,s||0);return os(t*e)/e}function l(t,s){return cs(t*t+s*s)}function d(t){return Ft(t,10)}function m(t){return new Date(t instanceof Date?t.valueOf():a(t)?t:Date.parse(String(t)))}function p(t,s,e){const i=new Array(t.length);let n=[0,t.length-1];for(;n.length>0;){const r=n.shift(),h=n.shift();if(i[r]=i[h]=!0,h-r>1){let i=-1,a=0;const o=t[r],c=t[h];for(let e=r+1;e<h;e++){const n=s(o,t[e],c);if(!u(n))throw new RangeError("triangleHeight returned NaN");n>a&&(a=n,i=e)}i>-1&&a>=e&&(n.push(r,i),n.push(i,h))}}return i}function g(t){let s=d(t);if(s){const t=s>gs;t&&(s-=gs),(s<=2e9||s>=999e7)&&(s=NaN),t&&s&&(s+=gs)}return s||NaN}function f(t,s,e=0,i=10){const n=t.toString(i).split(".");return e&&1===n.length&&n.push("0"),n[0].length<s&&(n[0]="0".repeat(s-n[0].length)+n[0]),n[1]&&n[1].length<e&&(n[1]+="0".repeat(e-n[1].length)),n.join(".")}function N(t,s=!0){return w(t,((t,e)=>[t,"function"==typeof e?.toJSON?e.toJSON():s?r(e):e]))}function w(t,s){const e={};for(let[i,n]of t.entries()){const[t,r]=s(i,n);e[t]=r}return e}function y(t,s){const e=new Map;for(const[i,n]of Object.entries(t)){const[t,r]=s(i,n);e.set(t,r)}return e}function S(t,s=!1){return y(t,((t,e)=>[t,s?r(e):e]))}function v(t,s=!1){return y(t,((t,e)=>[J(t),s?r(e):e]))}function T(t){return u(t.valueOf())?t.toISOString():null}function b(t){return u(t)?t:null}function O(t){const s=[...fs];for(let e=0;e<s.length;e++){const i=t[e];s[e]="boolean"==typeof i?i:1===d(i)}return s}function C(t){let s="";for(let e=0;e<7;e++)s+=t[e]?"1":"0";return s}function J(t){if(!o(t))throw new TypeError("input value is not a string");let s=!0,e="";for(let i=0,n=(t=t.toLowerCase()).length;i<n;i++){const n=t[i],r=Ns[n],h=(r||n).charCodeAt(0),a=!r&&ws.indexOf(n)>-1,o=!a&&(h>=97&&h<=122||h>=48&&h<=57);o?e+=r||n:a||s||(e+="-"),a||(s=!o)}return s?e.slice(0,-1):e}function k(t,s){const e=[];for(let[i,n]of t.entries())s.includes(i)&&e.push(n);return e}function x(t,s){const e=[];for(let i of t.values())i.companyId===s&&e.push(i);return e}function U(t){return t=J(t),ue.find((s=>s.code===t))}function I(t,s,e){s.forEach((function(s){Te.indexOf(s.kind)<0?M(t,s.kind,s.level,e):(s.labels&&s.labels.length?s.labels:Oe).forEach((function(i){M(t,s.kind+" "+i,s.level,e)}))}))}function M(t,s,e,i){const n=t.get(s);(!n||n[0]===le.revoke||be.indexOf(e)>be.indexOf(n[1]))&&t.set(s,[le.grant,e,i])}function A(t,s,e){s.forEach((function(s){Te.indexOf(s.kind)<0?D(t,s.kind,s.level,e):(s.labels&&s.labels.length?s.labels:Oe).forEach((function(i){D(t,s.kind+" "+i,s.level,e)}))}))}function D(t,s,e,i){const n=t.get(s),r=be.indexOf(e);n&&r?(n[0]===le.grant&&r<=be.indexOf(n[1])||n[0]===le.revoke&&r<be.indexOf(n[1]))&&t.set(s,[n[0],be[r-1],i]):t.set(s,[le.revoke,e,i])}function P(t){return t.kind==this}function E(t){return t.method===le.grant&&t.companyId==this}function z(t){return t.method===le.revoke&&t.companyId==this}function K(t){return!R(t)}function R(t){return Te.indexOf(t.kind)<0}function B(t,s){return t.order>s.order?-1:t.order<s.order?1:0}function L(t,s,e,i,n){const r=[],h=[],a=new Map;return i=i??t,n||t!==i||ve.forEach((function(t){a.set(t,[le.grant,ce.read,0])})),I(a,s.filter(E,i),1),A(a,s.filter(z,i),1),I(a,e.filter(E,i),2),A(a,e.filter(z,i),2),a.forEach((function(t,s){const e=s.split(" "),n=e[0],a=e[1]||"";a?h.push(new Se(i,n,t[1],t[0],"*"===a?[]:[a],t[2])):t[0]===le.grant&&r.push(new Se(i,n,t[1],t[0],[],0))})),r.concat(h.reduce((function(t,s){if(s.labels.length){const e=t.find((function(t){return t.kind===s.kind&&t.method===s.method&&t.level===s.level&&t.order<=s.order}));e?e.labels.length&&e.labels.push(s.labels[0]):t.push(s)}else{for(let e,i=0;e=t[i];i++)e.kind===s.kind&&e.method===s.method&&be.indexOf(e.level)<=be.indexOf(s.level)&&e.order<=s.order&&t.splice(i--,1);t.push(s)}return t}),[])).sort(B).map((function(t){return new fe(t.companyId,t.kind,t.level,t.method,t.labels)}))}function j(t,s,e,i){s||(s=[]),e||(e=[]);const n=new Map;return n.set(t,L(t,s,e,t,!!i)),s.concat(e).forEach((function(r){const h=r.companyId;n.has(h)||n.set(h,L(t,s,e,h,!!i))})),n}function H(t,s,e,i,n){return L(t,s||[],e||[],u(i)?i:t,!!n)}function q(t,s,e,i){return H(t,(s||[]).filter(R),(e||[]).filter(R),i)}function G(t,s,e,i){return be.indexOf(V(t,s,e))>=be.indexOf(ce[i]||ce.read)}function V(t,s,e){if(0===t)return ce.full;if(!u(t))throw new TypeError("userCompanyId must be a number");const i=(s||[]).find(P,e);return i&&i.method===le.grant?i.level:void 0}function F(t,s,e,i){return H(t,(s||[]).filter(K),(e||[]).filter(K),i).filter(K)}function W(t,s,e,i,n,r){return be.indexOf(_(t,s,e,i,n))>=be.indexOf(ce[r]||ce.read)}function _(t,e,i,n,r){if(0===t)return ce.full;if(!u(t))throw new TypeError("userCompanyId must be a number");i||(i=[]),r&&r.length||(r=i);let h=null,a=null,o=null;return(e||[]).forEach((function(t){if(t.kind===n){const s=t.labels&&t.labels.length?t.labels:i.concat(r);if(t.method===le.grant){switch(t.level){case ce.full:o||(o=[]);case ce.update:a||(a=[]);case ce.read:h||(h=[])}s.forEach((function(s){switch(t.level){case ce.full:o.indexOf(s)<0&&o.push(s);case ce.update:a.indexOf(s)<0&&a.push(s);case ce.read:h.indexOf(s)<0&&h.push(s)}}))}else if(s.length)s.forEach((function(s){let e;switch(t.level){case ce.read:h&&(e=h.indexOf(s))>-1&&h.splice(e,1);case ce.update:a&&(e=a.indexOf(s))>-1&&a.splice(e,1);case ce.full:o&&(e=o.indexOf(s))>-1&&o.splice(e,1)}})),h&&!h.length&&(h=null),a&&!a.length&&(a=null),o&&!o.length&&(o=null);else switch(t.level){case ce.read:h&&(h=null);case ce.update:a&&(a=null);case ce.full:o&&(o=null)}}})),o&&!s(r,o).length?ce.full:a&&!s(r,a).length?ce.update:h&&function(t,s){const e=[];for(let i=0,n=t.length;i<n;i++)for(let n=0,r=s.length;n<r;n++)t[i]===s[n]&&e.push(t[i]);return e}(r,h).length||!i.length?ce.read:void 0}function Y(t,s,e,i){return G(t,s,e,i)}function $(s,e,i,n){if(!u(s))throw new TypeError("userCompanyId must be a number");const r=[];return i&&i.length&&(e||(e=[]),i.forEach((function(h){if(Te.indexOf(h.kind)>-1){n||(n=[]);const a=t(n.concat(h.labels||[]));for(let t=0,o=a.length;t<o;t++){const o=_(s,e,n,h.kind,[a[t]]),u=_(s,i,n,h.kind,[a[t]]);if(X(o,u)){r.push(new ye(ge.vertical,h.companyId,h.kind,u,[a[t]],o,[a[t]]));break}}}else{const t=e.find((function(t){return t.kind==h.kind}));X(t?.level,h.level)&&r.push(new ye(ge.vertical,h.companyId,h.kind,h.level,null,t?.level,null))}}))),r}function Z(s,e,i,n,r,h){if(0===s)return null;r=r||[],h=h||[];const a=t((e||[]).map((t=>t.companyId)));switch(a.length){case 1:break;case 0:throw new Error("Zero permissions given.");default:throw new Error("Permissions given for more than one company.")}const o=_(s,e,n,i,r),u=_(s,e,n,i,h);return X(o,u)?new ye(ge.horizontal,a[0],i,u,h.length>0?h:n||[],o,r.length>0?r:n||[]):null}function X(t,s){return be.indexOf(s)>be.indexOf(t)}function Q(t){return t*Fe}function tt(t){return t*We}function st(t){return t*Ye}function et(t){return t/Fe}function it(t){return t/We}function nt(t){return t/Ye}function rt(t){return ri/t}function ht(t){return hi/t}function at(t){return 100/(1/Fe)/t}function ot(t,s=3,e=",",i=e,n="."){if(!(s>0))throw new TypeError("size must be greater than zero.");const r=t<0?"-":"",h=Qt(t).toString().split("."),a=[],o=[];for(let t=h[0].length;t>0;t-=s)a.unshift(h[0].slice(hs(0,t-s),t));if(h.length>1)for(let t=0,e=h[1].length;t<e;t+=s)o.push(h[1].slice(t,t+s));return r+a.join(e)+(o.length?(n??"")+o.join(i):"")}function ut(t){return 0===c(is(t*ms),9)}function ct(t,s=90){return a(t)?t>s?s:t<-s?-s:t:NaN}function lt(t,s=NaN){return t=a(t)?Qt(t%=360)>180?t+(t<0?360:-360):t:NaN,u(s)&&ut(s)&&(t=0),t}function dt(t,s){const e=ct(t.lat),i=ct(s.lat),n=lt(t.lng,e),r=lt(s.lng,i);if(ut(e))return e>0?180:0;{const t=e*ms,s=i*ms,h=(r-n)*ms,a=is(s);return(es(us(h)*a,is(t)*us(s)-us(t)*a*is(h))*ds+360)%360}}function mt(t,s){const e=ct(t.lat),i=ct(s.lat),n=lt(t.lng,e),r=lt(s.lng,i),h=e*ms,a=i*ms,o=r*ms-n*ms,u=as(us((a-h)/2),2),c=as(us(o/2),2),l=u+is(h)*is(a)*c;return 2*es(cs(l),cs(1-l))*ci}function pt(t,s,e){if(mt(t,e)<mi)return mt(t,s);const i=ct(t.lat),n=ct(s.lat),r=ct(e.lat),h=lt(t.lng,i),a=lt(s.lng,n),o=lt(e.lng,r),u=i*ms,l=h*ms,d=n*ms,m=a*ms,p=r*ms,g=o*ms,f=us(u),N=is(u),w=us(l),y=is(l),S=us(d),v=is(d),T=us(m),b=is(m),O=us(p),C=is(p),J=us(g),k=is(g),x=f*O+N*C*(y*k+w*J);return ts(c((f*(C*v*k*T-C*v*J*b)+N*y*(C*S*J-O*v*T)+N*w*(O*v*b-C*S*k))/cs(1-x*x),15))*ci}function gt(t,s,e){let i=ct(t.lat),n=lt(t.lng,i);if(s>=mi){const t=s/ci,r=e*ms,h=i*ms,a=n*ms,o=ts(c(us(h)*is(t)+is(h)*us(t)*is(r),15)),u=a+es(us(r)*us(t)*is(h),is(t)-us(h)*us(o));i=o*ds,n=u*ds}if(!u(i)||!u(n))throw new Error("Either latitude or longitude is NaN");return{lat:i,lng:n}}function ft(t,s){const e=ct(t.lat),i=ct(s.lat),n=lt(t.lng,e),r=lt(s.lng,i),h=e*ms,a=n*ms,o=i*ms,c=(r-n)*ms,l=is(o)*is(c),d=is(o)*us(c),m=es(us(h)+us(o),cs((is(h)+l)*(is(h)+l)+d*d)),p=a+es(d,is(h)+l);if(!u(m)||!u(p))throw new Error("latitude or longitude is NaN");return{lat:m*ds,lng:p*ds}}function Nt(t,s,e){return Qt(pt(t,s,e))}function wt(t,s){const e=[];let i=t*s<<1;for(i<0&&(i=~i);i>=32;)e.push(63+(32|31&i)),i>>=5;return e.push(i+63),String.fromCharCode(...e)}function yt(t,s=6){const e=as(10,s);let i=wt(t[0].lat,e)+wt(t[0].lng,e);for(let s=1;s<t.length;s++){const n=t[s],r=t[s-1];i+=wt(n.lat-r.lat,e)+wt(n.lng-r.lng,e)}return i}function St(t,s=6){function e(){let s=0,e=0,i=0;do{s=t.charCodeAt(h++)-63,i|=(31&s)<<e,e+=5}while(s>=32);return 1&i?~(i>>1):i>>1}const i=t.length,n=[],r=as(10,s||6);let h=0,a=h,o=h;for(;h<i;)n.push({lat:(a+=e())/r,lng:(o+=e())/r});return n}function vt(t){const s=[...t],e=t.length;let i=0,n=0,r=e-1;if(e>1)for(let t=0;t<e;t++){const h=s[t];for(let a=t+1;a<e;a++){const e=mt(h,s[a]);e>i&&(n=t,r=a,i=e)}}return[i,n,r]}function Tt(t,s,e){const i=mt(t,s)/ci,n=mt(s,e)/ci,r=mt(e,t)/ci,h=(i+n+r)/2,a=ls(h/2)*ls((h-i)/2)*ls((h-n)/2)*ls((h-r)/2);return 4*ss(cs(Qt(a)))}function bt(t,s,e){const i=ct(t.lat),n=lt(t.lng,i),r=ct(s.lat),h=lt(s.lng,r),a=ct(e.lat),o=lt(e.lng,a),u=i*ms,c=n*ms,l=r*ms,d=h*ms,m=a*ms,p=o*ms,g=is(u)*is(c),f=is(u)*us(c),N=us(u),w=is(l)*is(d),y=is(l)*us(d),S=us(l),v=is(m)*is(p),T=is(m)*us(p),b=us(m);return g*y*b+w*T*N+v*f*S-g*T*S-w*f*b-v*y*N<0?-1:1}function Ot(t){return!!t&&a(t.x)&&a(t.y)}function Ct(t){return a(t?.r)&&Ot(t)}function Jt(t){return!!t&&a(t.top)&&a(t.left)&&a(t.bottom)&&a(t.right)}function kt(t){return{left:t.left,top:t.top,right:t.right,bottom:t.bottom}}function xt(t,s){let e=0;return t.x===s.x&&t.y===s.y||(e=es(s.y-t.y,s.x-t.x)*ds+90),(e+360)%360}function Ut(t,s){return l(s.x-t.x,s.y-t.y)}function It(t,s){return t.x<s.x?-1:t.x>s.x?1:t.y<s.y?-1:t.y>s.y?1:0}function Mt(t,s){const e=(s-90)*ms;return{x:c(is(e)*t,14),y:c(us(e)*t,14)}}function At(t,s,e){const i=Ut(t,e);return i>0?Pt([t,s,e])/i*2:Ut(t,s)}function Dt(t,s,e){return At(t,s,e)}function Pt(t){let s=t.slice(),e=0,i=0,n=s.length-1,r=s[i],h=s[n];for(r.x===h.x&&r.y===h.y||(n=s.push(r)-1);i<n;i++)r=s[i],h=s[i+1],e+=r.x*h.y-r.y*h.x;return Qt(e/2)}function Et(t){let s=NaN,e=NaN,i=NaN,n=NaN;for(let r=0;r<t.length;r++){const h=t[r].x,a=t[r].y;h>s||(s=h),h<i||(i=h),a>e||(e=a),a<n||(n=a)}return{left:s,top:e,right:i,bottom:n}}function zt(t,s){return!(s.y<t.top||s.x<t.left||s.x>t.right||s.y>t.bottom)}function Kt(t){return!!t&&a(t.lat)&&a(t.lng)}function Rt(t){return!!t&&a(t.north)&&a(t.west)&&a(t.south)&&a(t.west)}function Bt(t,s,e){return t[e+26]=s,t}function Lt(t){let s=(t.match(bi)||[])[0]||"",e="!"===(s[0]||"").trim()?"!":"",i=s&&J(t.substring(0,s.length-1))||"";if(i){i=e+i;let n=this.operators.get(i);n||this.operators.set(i,n=[]),t.substring(s.length).split(Oi).forEach(jt,n)}else(t=t.trim())&&t.split(Oi).forEach(jt,this.terms)}function jt(t){if(t){const s="!"===t[0]?"!":"";switch(s&&(t=t.substring(1)),t[0]){case"*":return this.push(s+t);case"#":case"$":t=s+t[0]+J(t.substring(1));break;default:t=s+J(t)}t&&this.indexOf(t)<0&&this.push(t)}}function Ht(t){let s=t.indexOf("*");if(s<0)for(;(s=t.indexOf(""))>-1;)t.splice(s,1);else t.length=0}function qt(t,s){return[J(t),new Cn(s)]}class Gt{constructor(t){t&&this.fromJSON(t)}}class Vt extends Gt{t=-1;get v(){return[this.t]}updateVersion(t){if(t instanceof Array)return this.updateVersion(t[0]);{const s=t+1||0,e=this.t+1||0,i=!e||s>e;return i&&(this.t=s-1),i}}updateVersions(t=[]){return t?.map((t=>this.updateVersion(t)))}}const Ft=parseInt,Wt=parseFloat,_t=Object,Yt=_t.keys,$t=_t.freeze,Zt=Math,Xt=Zt.PI,Qt=Zt.abs,ts=Zt.asin,ss=Zt.atan,es=Zt.atan2,is=Zt.cos,ns=Zt.floor,rs=Zt.log,hs=Zt.max,as=Zt.pow,os=Zt.round,us=Zt.sin,cs=Zt.sqrt,ls=Zt.tan,ds=180/Xt,ms=Xt/180,ps=globalThis.location,gs=1e10,fs=[!1,!1,!1,!1,!1,!1,!1],Ns={ⱥ:"a",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ā:"a",ă:"a",ą:"a",ǎ:"a",ǟ:"a",ǡ:"a",ǻ:"a",ȁ:"a",ȃ:"a",ȧ:"a",ɐ:"a",a:"a",ḁ:"a",ẚ:"a",ạ:"a",ả:"a",ấ:"a",ầ:"a",ẩ:"a",ẫ:"a",ậ:"a",ắ:"a",ằ:"a",ẳ:"a",ẵ:"a",ặ:"a","ⓐ":"a",ꜳ:"aa",æ:"ae",ǣ:"ae",ǽ:"ae",ꜵ:"ao",ꜷ:"au",ꜹ:"av",ꜻ:"av",ꜽ:"ay",ƀ:"b",ƃ:"b",ɓ:"b",b:"b",ḃ:"b",ḅ:"b",ḇ:"b","ⓑ":"b",ç:"c",ć:"c",ĉ:"c",ċ:"c",č:"c",ƈ:"c",ꜿ:"c",ȼ:"c",c:"c",ḉ:"c",ↄ:"c","ⓒ":"c",ď:"d",đ:"d",ƌ:"d",ꝺ:"d",ɖ:"d",ɗ:"d",d:"d",ḋ:"d",ḍ:"d",ḏ:"d",ḑ:"d",ḓ:"d","ⓓ":"d",ð:"d",dž:"dz",dz:"dz",è:"e",é:"e",ê:"e",ë:"e",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",ǝ:"e",ȅ:"e",ȇ:"e",ȩ:"e",ɇ:"e",ɛ:"e",e:"e",ḕ:"e",ḗ:"e",ḙ:"e",ḛ:"e",ḝ:"e",ẹ:"e",ẻ:"e",ẽ:"e",ế:"e",ề:"e",ể:"e",ễ:"e",ệ:"e","ⓔ":"e",ƒ:"f",ꝼ:"f",f:"f",ḟ:"f","ⓕ":"f",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",ꝿ:"g",ꞡ:"g",ǥ:"g",ǧ:"g",ǵ:"g",ɠ:"g",g:"g",ᵹ:"g",ḡ:"g","ⓖ":"g",ⱨ:"h",ⱶ:"h",ĥ:"h",ħ:"h",ȟ:"h",ɥ:"h",h:"h",ḣ:"h",ḥ:"h",ḧ:"h",ḩ:"h",ḫ:"h",ẖ:"h","ⓗ":"h",ƕ:"hv",ì:"i",í:"i",î:"i",ï:"i",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",ǐ:"i",ȉ:"i",ȋ:"i",ɨ:"i",i:"i",ḭ:"i",ḯ:"i","̇":"i",ỉ:"i",ị:"i","ⓘ":"i",i:"i",ij:"ij",ĵ:"j",ǰ:"j",ɉ:"j",j:"j","ⓙ":"j",ⱪ:"k",ķ:"k",ƙ:"k",ꝁ:"k",ꝃ:"k",ꝅ:"k",ꞣ:"k",ǩ:"k",k:"k",ḱ:"k",ḳ:"k",ḵ:"k","ⓚ":"k",ĸ:"k",ⱡ:"l",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",ſ:"l",ƚ:"l",ꝇ:"l",ꝉ:"l",ꞁ:"l",ɫ:"l",l:"l",ḷ:"l",ḹ:"l",ḻ:"l",ḽ:"l","ⓛ":"l",lj:"lj",ɯ:"m",ɱ:"m",m:"m",ḿ:"m",ṁ:"m",ṃ:"m","ⓜ":"m",ñ:"n",ń:"n",ņ:"n",ň:"n",ʼn:"n",ƞ:"n",ꞑ:"n",ꞥ:"n",ǹ:"n",ɲ:"n",n:"n",ṅ:"n",ṇ:"n",ṉ:"n",ṋ:"n","ⓝ":"n",ŋ:"n",nj:"nj",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ō:"o",ŏ:"o",ő:"o",ơ:"o",ꝋ:"o",ꝍ:"o",ǒ:"o",ǫ:"o",ǭ:"o",ǿ:"o",ȍ:"o",ȏ:"o",ȫ:"o",ȭ:"o",ȯ:"o",ȱ:"o",ɔ:"o",ɵ:"o",o:"o",ṍ:"o",ṏ:"o",ṑ:"o",ṓ:"o",ọ:"o",ỏ:"o",ố:"o",ồ:"o",ổ:"o",ỗ:"o",ộ:"o",ớ:"o",ờ:"o",ở:"o",ỡ:"o",ợ:"o","ⓞ":"o","":"oe","":"oe",œ:"oe",ƣ:"oi",ꝏ:"oo",ȣ:"ou",ƥ:"p",ꝑ:"p",ꝓ:"p",ꝕ:"p",p:"p",ᵽ:"p",ṕ:"p",ṗ:"p","ⓟ":"p",ꝗ:"q",ꝙ:"q",ɋ:"q",q:"q","ⓠ":"q",ŕ:"r",ŗ:"r",ř:"r",ꝛ:"r",ꞃ:"r",ꞧ:"r",ȑ:"r",ȓ:"r",ɍ:"r",ɽ:"r",r:"r",ṙ:"r",ṛ:"r",ṝ:"r",ṟ:"r","ⓡ":"r",ß:"s",ś:"s",ŝ:"s",ş:"s",š:"s",ꞅ:"s",ꞩ:"s",ș:"s",ȿ:"s",s:"s",ṡ:"s",ṣ:"s",ṥ:"s",ṧ:"s",ṩ:"s",ẛ:"s","ⓢ":"s",ⱦ:"t",ţ:"t",ť:"t",ŧ:"t",ꞇ:"t",ƭ:"t",ț:"t",ʈ:"t",t:"t",ṫ:"t",ṭ:"t",ṯ:"t",ṱ:"t",ẗ:"t","ⓣ":"t",þ:"th",ꜩ:"tz",ù:"u",ú:"u",û:"u",ü:"u",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",ư:"u",ǔ:"u",ǖ:"u",ǘ:"u",ǚ:"u",ǜ:"u",ȕ:"u",ȗ:"u",ʉ:"u",u:"u",ṳ:"u",ṵ:"u",ṷ:"u",ṹ:"u",ṻ:"u",ụ:"u",ủ:"u",ứ:"u",ừ:"u",ử:"u",ữ:"u",ự:"u","ⓤ":"u",ꝟ:"v",ʋ:"v",ʌ:"v",v:"v",ṽ:"v",ṿ:"v","ⓥ":"v",ꝡ:"vy",ⱳ:"w",ŵ:"w",w:"w",ẁ:"w",ẃ:"w",ẅ:"w",ẇ:"w",ẉ:"w",ẘ:"w","ⓦ":"w",x:"x",ẋ:"x",ẍ:"x","ⓧ":"x",ý:"y",ÿ:"y",ŷ:"y",ƴ:"y",ȳ:"y",ɏ:"y",y:"y",ẏ:"y",ẙ:"y",ỳ:"y",ỵ:"y",ỷ:"y",ỹ:"y",ỿ:"y","ⓨ":"y",ⱬ:"z",ź:"z",ż:"z",ž:"z",ꝣ:"z",ƶ:"z",ȥ:"z",ɀ:"z",z:"z",ẑ:"z",ẓ:"z",ẕ:"z","ⓩ":"z"},ws=['"',"'","^","`","«","´","»","ʺ","˝","ˮ","˶","ײ","״","᳓","“","”","‟","″","‶","〃","""],ys="["+ws.join("")+"]*",Ss=new Map,vs=new Map,Ts=new Map,bs=new Map,Os=new Map,Cs=new Map,Js=new Map,ks=new Map,xs=new Map,Us=new Map,Is=new Map,Ms=new Map,As=new Map,Ds=new Map,Ps=new Map,Es=new Map,zs=new Map,Ks=new Map,Rs=new Map,Bs=new Map,Ls=new Map,js=new Map,Hs=new Map,qs=new Map,Gs=new Map,Vs=new Map,Fs=new Map,Ws=new Map,_s=new Map,Ys=new Map,$s=new Map,Zs=new Map,Xs=new Map,Qs=new Map,te=new Map,se="Email",ee="Mobile",ie="Office",ne="Fax",re="Address",he="Website";class ae extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";otherNames=new Map;emails=new Map;phones=new Map;addresses=new Map;urls=new Map;dates=new Map;options=new Map;roles=[];pictureIds=[];get pictures(){return k(Ls,this.pictureIds)}set pictures(t){this.pictureIds=t?.map(e)??[]}get email(){return this.emails.get(se)??""}set email(t){t?this.emails.set(se,t):this.emails.delete(se)}get mobile(){return this.phones.get(ee)??NaN}set mobile(t){t?this.phones.set(ee,t):this.phones.delete(ee)}get office(){return this.phones.get(ie)??NaN}set office(t){t?this.phones.set(ie,t):this.phones.delete(ie)}get fax(){return this.phones.get(ne)??NaN}set fax(t){t?this.phones.set(ne,t):this.phones.delete(ne)}get address(){return this.addresses.get(re)??""}set address(t){t?this.addresses.set(re,t):this.addresses.delete(re)}get url(){return this.urls.get(he)??""}set url(t){t?this.urls.set(he,t):this.urls.delete(he)}toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,name:this.name||"",notes:this.notes||"",otherNames:N(this.otherNames),emails:N(this.emails),phones:N(this.phones),addresses:N(this.addresses),urls:N(this.urls),dates:N(this.dates),options:N(this.options),roles:[...this.roles],pictures:[...this.pictureIds]}}fromJSON(t,s){const e=this.updateVersion(t.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.emails=S(t.emails||{},!1),this.phones=S(t.phones||{},!1),this.addresses=S(t.addresses||{},!1),this.urls=S(t.urls||{},!1),this.dates=y(t.dates||{},((t,s)=>[t,m(s)])),this.options=S(t.options||{},!1),this.otherNames=S(t.otherNames||{},!1),this.roles=t.roles?.map(J)??[],this.pictureIds=t.pictures?.map(d)??[]),e}getKey(){return this.id}}class oe{static fromJSON(t){return new oe(t.code,t.name,t.offset,t.dst)}static utc=new oe("utc","UTC",0,!1);code;name;offset;dst;constructor(t,s,e,i){this.code=J(t||""),this.name=s||t||"",this.offset=e||0,this.dst=!!i}toJSON(){return{code:this.code,name:this.name,offset:this.offset,dst:this.dst}}getKey(){return this.code}}const ue=[new oe("dateline-standard-time","International Date Line West (UTC-12:00)",-720,!1),new oe("utc-11","Coordinated Universal Time-11 (UTC-11:00)",-660,!1),new oe("aleutian-standard-time","Aleutian Islands (UTC-10:00)",-600,!0),new oe("hawaiian-standard-time","Hawaii (UTC-10:00)",-600,!1),new oe("marquesas-standard-time","Marquesas Islands (UTC-09:30)",-570,!1),new oe("alaskan-standard-time","Alaska (UTC-09:00)",-540,!0),new oe("utc-09","Coordinated Universal Time-09 (UTC-09:00)",-540,!1),new oe("pacific-standard-time-mexico","Baja California (UTC-08:00)",-480,!0),new oe("utc-08","Coordinated Universal Time-08 (UTC-08:00)",-480,!1),new oe("pacific-standard-time","Pacific Time (US & Canada) (UTC-08:00)",-480,!0),new oe("us-mountain-standard-time","Arizona (UTC-07:00)",-420,!1),new oe("mountain-standard-time-mexico","La Paz, Mazatlan (UTC-07:00)",-420,!0),new oe("mountain-standard-time","Mountain Time (US & Canada) (UTC-07:00)",-420,!0),new oe("yukon-standard-time","Yukon (UTC-07:00)",-420,!0),new oe("central-america-standard-time","Central America (UTC-06:00)",-360,!1),new oe("central-standard-time","Central Time (US & Canada) (UTC-06:00)",-360,!0),new oe("easter-island-standard-time","Easter Island (UTC-06:00)",-360,!0),new oe("central-standard-time-mexico","Guadalajara, Mexico City, Monterrey (UTC-06:00)",-360,!0),new oe("canada-central-standard-time","Saskatchewan (UTC-06:00)",-360,!1),new oe("sa-pacific-standard-time","Bogota, Lima, Quito, Rio Branco (UTC-05:00)",-300,!1),new oe("eastern-standard-time-mexico","Chetumal (UTC-05:00)",-300,!0),new oe("eastern-standard-time","Eastern Time (US & Canada) (UTC-05:00)",-300,!0),new oe("haiti-standard-time","Haiti (UTC-05:00)",-300,!0),new oe("cuba-standard-time","Havana (UTC-05:00)",-300,!0),new oe("us-eastern-standard-time","Indiana (East) (UTC-05:00)",-300,!0),new oe("turks-and-caicos-standard-time","Turks and Caicos (UTC-05:00)",-300,!0),new oe("paraguay-standard-time","Asuncion (UTC-04:00)",-240,!0),new oe("atlantic-standard-time","Atlantic Time (Canada) (UTC-04:00)",-240,!0),new oe("venezuela-standard-time","Caracas (UTC-04:00)",-240,!0),new oe("central-brazilian-standard-time","Cuiaba (UTC-04:00)",-240,!0),new oe("sa-western-standard-time","Georgetown, La Paz, Manaus, San Juan (UTC-04:00)",-240,!1),new oe("pacific-sa-standard-time","Santiago (UTC-04:00)",-240,!0),new oe("newfoundland-standard-time","Newfoundland (UTC-03:30)",-210,!0),new oe("tocantins-standard-time","Araguaina (UTC-03:00)",-180,!0),new oe("e-south-america-standard-time","Brasilia (UTC-03:00)",-180,!0),new oe("sa-eastern-standard-time","Cayenne, Fortaleza (UTC-03:00)",-180,!1),new oe("argentina-standard-time","City of Buenos Aires (UTC-03:00)",-180,!0),new oe("montevideo-standard-time","Montevideo (UTC-03:00)",-180,!0),new oe("magallanes-standard-time","Punta Arenas (UTC-03:00)",-180,!0),new oe("saint-pierre-standard-time","Saint Pierre and Miquelon (UTC-03:00)",-180,!0),new oe("bahia-standard-time","Salvador (UTC-03:00)",-180,!0),new oe("utc-02","Coordinated Universal Time-02 (UTC-02:00)",-120,!1),new oe("greenland-standard-time","Greenland (UTC-02:00)",-120,!0),new oe("mid-atlantic-standard-time","Mid-Atlantic - Old (UTC-02:00)",-120,!0),new oe("azores-standard-time","Azores (UTC-01:00)",-60,!0),new oe("cape-verde-standard-time","Cabo Verde Is. (UTC-01:00)",-60,!1),new oe("utc","Coordinated Universal Time (UTC)",0,!1),new oe("gmt-standard-time","Dublin, Edinburgh, Lisbon, London (UTC+00:00)",0,!0),new oe("greenwich-standard-time","Monrovia, Reykjavik (UTC+00:00)",0,!1),new oe("sao-tome-standard-time","Sao Tome (UTC+00:00)",0,!0),new oe("morocco-standard-time","Casablanca (UTC+01:00)",0,!0),new oe("w-europe-standard-time","Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna (UTC+01:00)",60,!0),new oe("central-europe-standard-time","Belgrade, Bratislava, Budapest, Ljubljana, Prague (UTC+01:00)",60,!0),new oe("romance-standard-time","Brussels, Copenhagen, Madrid, Paris (UTC+01:00)",60,!0),new oe("central-european-standard-time","Sarajevo, Skopje, Warsaw, Zagreb (UTC+01:00)",60,!0),new oe("w-central-africa-standard-time","West Central Africa (UTC+01:00)",60,!1),new oe("gtb-standard-time","Athens, Bucharest (UTC+02:00)",120,!0),new oe("middle-east-standard-time","Beirut (UTC+02:00)",120,!0),new oe("egypt-standard-time","Cairo (UTC+02:00)",120,!0),new oe("e-europe-standard-time","Chisinau (UTC+02:00)",120,!0),new oe("west-bank-standard-time","Gaza, Hebron (UTC+02:00)",120,!0),new oe("south-africa-standard-time","Harare, Pretoria (UTC+02:00)",120,!1),new oe("fle-standard-time","Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius (UTC+02:00)",120,!0),new oe("israel-standard-time","Jerusalem (UTC+02:00)",120,!0),new oe("south-sudan-standard-time","Juba (UTC+02:00)",120,!0),new oe("kaliningrad-standard-time","Kaliningrad (UTC+02:00)",120,!0),new oe("sudan-standard-time","Khartoum (UTC+02:00)",120,!0),new oe("libya-standard-time","Tripoli (UTC+02:00)",120,!0),new oe("namibia-standard-time","Windhoek (UTC+02:00)",120,!0),new oe("jordan-standard-time","Amman (UTC+03:00)",180,!0),new oe("arabic-standard-time","Baghdad (UTC+03:00)",180,!0),new oe("syria-standard-time","Damascus (UTC+03:00)",180,!0),new oe("turkey-standard-time","Istanbul (UTC+03:00)",180,!0),new oe("arab-standard-time","Kuwait, Riyadh (UTC+03:00)",180,!1),new oe("belarus-standard-time","Minsk (UTC+03:00)",180,!0),new oe("russian-standard-time","Moscow, St. Petersburg (UTC+03:00)",180,!0),new oe("e-africa-standard-time","Nairobi (UTC+03:00)",180,!1),new oe("volgograd-standard-time","Volgograd (UTC+04:00)",180,!0),new oe("iran-standard-time","Tehran (UTC+03:30)",210,!0),new oe("arabian-standard-time","Abu Dhabi, Muscat (UTC+04:00)",240,!1),new oe("astrakhan-standard-time","Astrakhan, Ulyanovsk (UTC+04:00)",240,!0),new oe("azerbaijan-standard-time","Baku (UTC+04:00)",240,!0),new oe("russia-time-zone-3","Izhevsk, Samara (UTC+04:00)",240,!0),new oe("mauritius-standard-time","Port Louis (UTC+04:00)",240,!0),new oe("saratov-standard-time","Saratov (UTC+04:00)",240,!0),new oe("georgian-standard-time","Tbilisi (UTC+04:00)",240,!1),new oe("caucasus-standard-time","Yerevan (UTC+04:00)",240,!0),new oe("afghanistan-standard-time","Kabul (UTC+04:30)",270,!1),new oe("west-asia-standard-time","Ashgabat, Tashkent (UTC+05:00)",300,!1),new oe("qyzylorda-standard-time","Astana (UTC+05:00)",300,!0),new oe("ekaterinburg-standard-time","Ekaterinburg (UTC+05:00)",300,!0),new oe("pakistan-standard-time","Islamabad, Karachi (UTC+05:00)",300,!0),new oe("india-standard-time","Chennai, Kolkata, Mumbai, New Delhi (UTC+05:30)",330,!1),new oe("sri-lanka-standard-time","Sri Jayawardenepura (UTC+05:30)",330,!1),new oe("nepal-standard-time","Kathmandu (UTC+05:45)",345,!1),new oe("central-asia-standard-time","Bishkek (UTC+06:00)",360,!1),new oe("bangladesh-standard-time","Dhaka (UTC+06:00)",360,!0),new oe("omsk-standard-time","Omsk (UTC+06:00)",360,!0),new oe("myanmar-standard-time","Yangon (Rangoon) (UTC+06:30)",390,!1),new oe("se-asia-standard-time","Bangkok, Hanoi, Jakarta (UTC+07:00)",420,!1),new oe("altai-standard-time","Barnaul, Gorno-Altaysk (UTC+07:00)",420,!0),new oe("w-mongolia-standard-time","Hovd (UTC+07:00)",420,!0),new oe("north-asia-standard-time","Krasnoyarsk (UTC+07:00)",420,!0),new oe("n-central-asia-standard-time","Novosibirsk (UTC+07:00)",420,!0),new oe("tomsk-standard-time","Tomsk (UTC+07:00)",420,!0),new oe("china-standard-time","Beijing, Chongqing, Hong Kong, Urumqi (UTC+08:00)",480,!1),new oe("north-asia-east-standard-time","Irkutsk (UTC+08:00)",480,!0),new oe("singapore-standard-time","Kuala Lumpur, Singapore (UTC+08:00)",480,!1),new oe("w-australia-standard-time","Perth (UTC+08:00)",480,!0),new oe("taipei-standard-time","Taipei (UTC+08:00)",480,!1),new oe("ulaanbaatar-standard-time","Ulaanbaatar (UTC+08:00)",480,!0),new oe("aus-central-w-standard-time","Eucla (UTC+08:45)",525,!1),new oe("transbaikal-standard-time","Chita (UTC+09:00)",540,!0),new oe("tokyo-standard-time","Osaka, Sapporo, Tokyo (UTC+09:00)",540,!1),new oe("north-korea-standard-time","Pyongyang (UTC+09:00)",540,!0),new oe("korea-standard-time","Seoul (UTC+09:00)",540,!1),new oe("yakutsk-standard-time","Yakutsk (UTC+09:00)",540,!0),new oe("cen-australia-standard-time","Adelaide (UTC+09:30)",570,!0),new oe("aus-central-standard-time","Darwin (UTC+09:30)",570,!1),new oe("e-australia-standard-time","Brisbane (UTC+10:00)",600,!1),new oe("aus-eastern-standard-time","Canberra, Melbourne, Sydney (UTC+10:00)",600,!0),new oe("west-pacific-standard-time","Guam, Port Moresby (UTC+10:00)",600,!1),new oe("tasmania-standard-time","Hobart (UTC+10:00)",600,!0),new oe("vladivostok-standard-time","Vladivostok (UTC+10:00)",600,!0),new oe("lord-howe-standard-time","Lord Howe Island (UTC+10:30)",630,!0),new oe("bougainville-standard-time","Bougainville Island (UTC+11:00)",660,!0),new oe("russia-time-zone-10","Chokurdakh (UTC+11:00)",660,!0),new oe("magadan-standard-time","Magadan (UTC+11:00)",660,!0),new oe("norfolk-standard-time","Norfolk Island (UTC+11:00)",660,!0),new oe("sakhalin-standard-time","Sakhalin (UTC+11:00)",660,!0),new oe("central-pacific-standard-time","Solomon Is., New Caledonia (UTC+11:00)",660,!1),new oe("russia-time-zone-11","Anadyr, Petropavlovsk-Kamchatsky (UTC+12:00)",720,!0),new oe("new-zealand-standard-time","Auckland, Wellington (UTC+12:00)",720,!0),new oe("utc-12","Coordinated Universal Time+12 (UTC+12:00)",720,!1),new oe("fiji-standard-time","Fiji (UTC+12:00)",720,!0),new oe("kamchatka-standard-time","Petropavlovsk-Kamchatsky - Old (UTC+12:00)",720,!0),new oe("chatham-islands-standard-time","Chatham Islands (UTC+12:45)",765,!0),new oe("utc-13","Coordinated Universal Time+13 (UTC+13:00)",780,!1),new oe("tonga-standard-time","Nuku'alofa (UTC+13:00)",780,!0),new oe("samoa-standard-time","Samoa (UTC+13:00)",780,!0),new oe("line-islands-standard-time","Kiritimati Island (UTC+14:00)",840,!1)];var ce,le,de,me,pe,ge;!function(t){t.read="read",t.update="update",t.full="full"}(ce||(ce={})),function(t){t.grant="grant",t.revoke="revoke"}(le||(le={})),function(t){t.companyGeneral="companyGeneral",t.companyDirectory="companyDirectory",t.companyLabels="companyLabels",t.companyPolicies="companyPolicies",t.companyReseller="companyReseller",t.companyCreate="companyCreate",t.assetGeneral="assetGeneral",t.assetAdvanced="assetAdvanced",t.assetMessage="assetMessage",t.assetDispatch="assetDispatch",t.placeGeneral="placeGeneral",t.providerGeneral="providerGeneral",t.providerAdvanced="providerAdvanced",t.providerControl="providerControl",t.providerConfiguration="providerConfiguration",t.providerConfigType="providerConfigType",t.providerScript="providerScript",t.providerCommand="providerCommand",t.reportResult="reportResult",t.reportTemplate="reportTemplate",t.reportSchedule="reportSchedule",t.userGeneral="userGeneral",t.userAdvanced="userAdvanced",t.userGroup="userGroup",t.machine="machine",t.session="session",t.behaviour="behaviour",t.behaviourLog="behaviourLog",t.behaviourScript="behaviourScript",t.dispatchTask="dispatchTask",t.dispatchTemplate="dispatchTemplate",t.contact="contact",t.hosCarrier="hosCarrier",t.hosEvent="hosEvent",t.hosInspection="hosInspection",t.maintenanceJob="maintenanceJob",t.maintenanceSchedule="maintenanceSchedule",t.analyticRule="analyticRule",t.analyticSummary="analyticSummary",t.icon="icon",t.picture="picture",t.document="document",t.billingProfile="billingProfile",t.billingHosting="billingHosting",t.billingDiscount="billingDiscount",t.billingLicense="billingLicense",t.billingReport="billingReport",t.formTemplate="formTemplate",t.formResult="formResult",t.dispatchJob="dispatchJob"}(de||(de={}));class fe{static fromJSON(t){return new fe(t.company,t.kind,t.level,t.method,t.labels)}companyId;get company(){return Ss.get(this.companyId)}kind;get type(){return this.kind.toString()}set type(t){const s=de[t];if(!s)throw new Error("Unknown PermissionType");this.kind=s}level;method;labels;constructor(t,s,e=ce.read,i=le.grant,n){this.companyId=d(t),this.kind=de[s],this.level=ce[e]||ce.read,this.method=le[i]||le.grant,this.labels=n||[]}toJSON(){return{company:b(this.companyId),kind:de[this.kind]||null,level:ce[this.level]||null,method:le[this.method]||null,labels:[...this.labels]}}}!function(t){t.metric="metric",t.standard="standard"}(me||(me={}));class Ne extends Vt{key="";companyId=NaN;get company(){return Ss.get(this.companyId)}enabled=!1;secret="";nickname="";notes="";notBefore=m();notAfter=m();timezone=oe.utc;language="";formats=new Map;measurements=new Map;options=new Map;groupIds=[];get groups(){return k(Os,this.groupIds)}set groups(t){this.groupIds=t?.map(e)??[]}permissions=[];services=[];referrers=[];ipRanges=[];insecure=!1;toJSON(){return{key:this.key,v:[...this.v],company:this.companyId,nickname:this.nickname,notes:this.notes,enabled:!!this.enabled,notBefore:T(this.notBefore),notAfter:T(this.notAfter),timezone:this.timezone?.code||oe.utc.code,language:this.language,formats:N(this.formats),measurements:N(this.measurements),options:N(this.options),groups:[...this.groupIds],permissions:this.permissions?.map(i)??[],services:[...this.services],referrers:[...this.referrers],ipRanges:[...this.ipRanges],insecure:!!this.insecure}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.key||(this.key=t.key||""),this.companyId=d(t.company),this.secret="string"==typeof t.secret?t.secret:"",this.nickname=t.nickname||"",this.notes=t.notes||"",this.enabled=!!t.enabled,this.notBefore=m(t.notBefore),this.notAfter=m(t.notAfter),this.timezone=U(t.timezone||"")||oe.utc,this.language=t.language||"",this.formats=v(t.formats||{}),this.measurements=y(t.measurements||{},((t,s)=>[J(t),me[s]??me.metric])),this.options=v(t.options||{}),this.groupIds=(t.groups||[]).map(d),this.permissions=(t.permissions||[]).map(fe.fromJSON),this.services=t.services||[],this.referrers=t.referrers||[],this.ipRanges=t.ipRanges||[],this.insecure=!!t.insecure),e}getKey(){return this.key}async createHmacSignature(t,s="GET",e=0,i=new Date){const n=(new TextEncoder).encode([this.key,i.toISOString().replace(/[-T:]/g,"").slice(0,14),s.toUpperCase(),t.toString(),e].join("\n")),r=await crypto.subtle.importKey("raw",Uint8Array.from(atob(this.secret),(t=>t.charCodeAt(0))),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),h=new Uint8Array(await crypto.subtle.sign("HMAC",r,n));return btoa(String.fromCharCode(...h))}}!function(t){t.popup="popup",t.sms="sms",t.email="email"}(pe||(pe={}));class we{level;labels;constructor(t,s){this.level=t||null,this.labels=s||null}toJSON(){return{level:this.level,labels:this.labels?.slice()??null}}}class ye{static fromJSON(t){return new ye(t?.direction,t?.company,t?.kind,t?.after?.level,t?.after?.labels,t?.before?.level,t?.before?.labels)}direction;company;kind;after;before;constructor(t,s,e,i,n,r,h){this.direction=t,this.company=s,this.kind=e,this.after=new we(i,n),this.before=new we(r,h)}toJSON(){return{direction:this.direction,company:this.company,kind:this.kind,after:this.after.toJSON(),before:this.before.toJSON()}}}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(ge||(ge={}));class Se extends fe{order;constructor(t,s,e=ce.read,i=le.grant,n,r){super(t,s,e,i,n),this.order=r}}const ve=[de.companyGeneral,de.companyLabels,de.companyPolicies,de.icon,de.picture],Te=[de.assetGeneral,de.assetAdvanced,de.assetDispatch,de.placeGeneral,de.dispatchJob,de.dispatchTemplate,de.formResult,de.formTemplate],be=[ce.read,ce.update,ce.full],Oe=["*"];var Ce,Je,ke;!function(t){t.notFound="notFound",t.created="created",t.active="active",t.idle="idle",t.passwordExpired="passwordExpired",t.expired="expired"}(Ce||(Ce={}));class xe{handle;companyId;get company(){return Ss.get(this.companyId)}ipAddress;userAgent;sockets;login;status;created;expiry;lastCommand;lastActivity;get active(){return this.sockets>0}constructor(t){t&&this.fromJSON(t)}fromJSON(t,s){return t&&(this.handle=t.handle||"",this.companyId=d(t.company),this.login=t.login||"",this.status=Ce[t.status]||Ce.notFound,this.userAgent=t.userAgent||"",this.ipAddress=t.ipAddress||"",this.created=m(t.created),this.expiry=m(t.expires),this.lastActivity=m(t.lastActivity),this.lastCommand=t.lastCommand||"",this.sockets=d(t.sockets)||0),!!t}toJSON(){return{handle:this.handle||"",company:this.companyId||null,login:this.login||"",status:Ce[this.status]||Ce.notFound,userAgent:this.userAgent||"",ipAddress:this.ipAddress||"",created:this.created.toISOString(),expires:this.expiry.toISOString(),lastActivity:this.lastActivity.toISOString(),lastCommand:this.lastCommand||"",sockets:this.sockets||0}}getKey(){return this.handle}}class Ue extends Vt{get v(){return this.pieces.map((t=>t?.v[0]??-1))}}class Ie extends Vt{login="";companyId=NaN;get company(){return Ss.get(this.companyId)}groupIds=[];get groups(){return k(Os,this.groupIds)}set groups(t){this.groupIds=t?.map(e)??[]}permissions=[];toJSON(){return{login:this.login.toLowerCase(),v:[...this.v],company:this.companyId,groups:[...this.groupIds],permissions:this.permissions.map(i)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.login||(this.login=(t.login||"").toLowerCase()),this.companyId=d(t.company),this.groupIds=t.groups||[],this.permissions=(t.permissions||[]).map(fe.fromJSON)),e}getKey(){return this.login}}!function(t){t.app="app",t.sms="sms",t.email="email"}(Je||(Je={}));class Me{static fromJSON(t){return new Me(t.enabled,t.kind,t.address,t.verified,t.setupDate,t.lastAuthentication)}enabled;kind;address;verified;setupDate;lastAuthentication;constructor(t,s,e,i,n,r){this.enabled=!!t,this.kind=Je[s],this.address=e||"",this.verified=!!i,this.setupDate=m(n),this.lastAuthentication=m(r)}toJSON(){return{enabled:!!this.enabled,kind:Je[this.kind]||null,address:this.address??"",verified:!!this.verified,setupDate:T(this.setupDate),lastAuthentication:T(this.lastAuthentication)}}}!function(t){t.google="google",t.apple="apple",t.facebook="facebook",t.twitter="twitter",t.microsoft="microsoft"}(ke||(ke={}));class Ae{static fromJSON(t){return new Ae(t.enabled,t.provider,t.lastAuthentication,t.externalId)}enabled;provider;lastAuthentication;externalId;constructor(t,s,e,i){this.enabled=!!t,this.provider=ke[s],this.lastAuthentication=m(e),this.externalId=i||""}toJSON(){return{enabled:!!this.enabled,provider:ke[this.provider]||null,lastAuthentication:T(this.lastAuthentication),externalId:this.externalId||null}}}class De extends Vt{login="";companyId=NaN;get company(){return Ss.get(this.companyId)}passwordExpired=!1;mfa=[];sso=new Ae;toJSON(){return{login:this.login.toLowerCase(),v:[...this.v],company:this.companyId,passwordExpired:!!this.passwordExpired,mfa:this.mfa?.map(i)||null,sso:this.sso?.toJSON()||null}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.login||(this.login=(t.login||"").toLowerCase()),this.companyId=d(t.company),this.passwordExpired=!!t.passwordExpired,this.mfa=(t.mfa||[]).map((t=>Me.fromJSON(t))),this.sso=Ae.fromJSON(t.sso||{})),e}getKey(){return this.login}}const Pe=1e3,Ee=6e4,ze=36e5,Ke=864e5,Re=/^(-)?(?:(\d+)\.)?(\d*):(\d*)(?::(\d+)(?:\.(\d+))?)?$/;class Be{static fromDays(t){return new Be(t*Ke)}static fromHours(t){return new Be(t*ze)}static fromMinutes(t){return new Be(t*Ee)}static fromSeconds(t){return new Be(t*Pe)}static fromMilliseconds(t){return new Be(t)}#t=0;constructor(t){h(t)||this.add(t)}get days(){return ns(Qt(this.#t)/Ke)*(this.#t<0?-1:1)}get hours(){return ns((Qt(this.#t)-Qt(this.days)*Ke)/ze)*(this.#t<0?-1:1)}get minutes(){return ns((Qt(this.#t)-(Qt(this.days)*Ke+Qt(this.hours)*ze))/Ee)*(this.#t<0?-1:1)}get seconds(){return ns((Qt(this.#t)-(Qt(this.days)*Ke+Qt(this.hours)*ze+Qt(this.minutes)*Ee))/Pe)*(this.#t<0?-1:1)}get milliseconds(){return ns(Qt(this.#t)-(Qt(this.days)*Ke+Qt(this.hours)*ze+Qt(this.minutes)*Ee+Qt(this.seconds)*Pe))*(this.#t<0?-1:1)}get totalDays(){return this.#t/Ke}get totalHours(){return this.#t/ze}get totalMinutes(){return this.#t/Ee}get totalSeconds(){return this.#t/Pe}get totalMilliseconds(){return this.#t}toString(t=""){if(t){const s=t.split(/(\\.|[hHmstT]{1,2}|[df]{1,6})/gm),e=s.includes("d");return s.slice(1,s.length-1).reduce(((t,s)=>{switch(s[0]||""){case"d":t+=f(this.days,s.length);break;case"H":t+=f(this.hours+(e?0:24*this.days),s.length);break;case"h":t+=f(this.hours%12,s.length);break;case"m":t+=f(this.minutes,s.length);break;case"s":t+=f(this.seconds,s.length);break;case"f":t+=f(this.milliseconds/Pe,0,s.length).substring(2);break;default:t+=s}return t}),this.#t<0?"-":"")}{const t=Qt(this.days),s=Qt(this.hours),e=Qt(this.minutes),i=Qt(this.seconds),n=Qt(this.milliseconds);return(this.#t<0?"-":"")+(t?t+".":"")+(s>9?s:"0"+s)+":"+(e>9?e:"0"+e)+":"+(i>9?i:"0"+i)+(n?(n/Pe).toString().slice(1):"")}}toJSON=this.toString;valueOf(){return this.#t}add(t,s=!1){if(a(t?.valueOf()))this.#t+=t.valueOf()*(s?-1:1);else if(t=String(t).trim()){const e=t.match(Re)||[,,Wt(t)];let i;"-"===e[1]&&(s=!s),(i=Wt(e[2]))&&this.add(i*Ke,s),(i=Wt(e[3]))&&this.add(i*ze,s),(i=Wt(e[4]))&&this.add(i*Ee,s),(i=Wt(e[5]))&&this.add(i*Pe,s),(i=Wt((e[6]+"000").slice(0,-e[6]?.length)))&&this.add(i,s)}return this.#t}subtract(t,s=!1){return this.add(t,!s)}}class Le{static fromJSON(t){return new Le(t.name,t.enabled,t.weekdays,t.start,t.end,t.email,t.sms,t.online,t.offline)}name;enabled;weekdays;start;end;email;sms;online;offline;constructor(t,s,e,i,n,r,h,a,o){this.name=t||"",this.enabled=!!s,this.weekdays=O(e||[]),this.start=new Be(i),this.end=new Be(n),this.email=r||"",this.sms=g(h),this.online=[...a||[]],this.offline=[...o||[]]}toJSON(){return{name:this.name||"",enabled:!!this.enabled,weekdays:C(this.weekdays),start:u(this.start.valueOf())?this.start.toString():"00:00:00",end:u(this.end.valueOf())?this.end.toString():"00:00:00",email:this.email||"",sms:this.sms||null,online:this.online.slice(),offline:this.offline.slice()}}}class je extends Vt{login="";companyId=NaN;get company(){return Ss.get(this.companyId)}passwordExpired=!1;enabled=!1;nickname="";contactId=NaN;get contact(){return vs.get(this.contactId)}set contact(t){this.contactId=t.id}timezone=oe.utc;language="";formats=new Map;measurements=new Map;options=new Map;notify=[];toJSON(){return{login:this.login.toLowerCase(),v:[...this.v],company:this.companyId,nickname:this.nickname,enabled:!!this.enabled,contact:!!this.contactId,passwordExpired:!!this.passwordExpired,timezone:this.timezone?.code??oe.utc.code,language:this.language,formats:N(this.formats),measurements:N(this.measurements),options:N(this.options),notify:this.notify.map(i)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.login||(this.login=(t.login||"").toLowerCase()),this.companyId=d(t.company),this.nickname=t.nickname||"",this.enabled=!!t.enabled,this.contactId=d(t.contact),this.passwordExpired=!!t.passwordExpired,this.timezone=U(t.timezone||"")||oe.utc,this.language=t.language||"",this.formats=v(t.formats||{}),this.measurements=y(t.measurements||{},((t,s)=>[J(t),me[s]??me.metric])),this.options=v(t.options||{}),this.notify=(t.notify||[]).map((t=>Le.fromJSON(t)))),e}getKey(){return this.login}}class He extends Ue{get pieces(){return[this.#s,this.#e,this.#i]}get login(){return this.general.login??this.advanced.login}get companyId(){return this.general.companyId??this.advanced.companyId}get company(){return this.general.company}#s=new je;get general(){return this.#s}get enabled(){return this.general.enabled}set enabled(t){this.general.enabled=t}get nickname(){return this.general.nickname}set nickname(t){this.general.nickname=t}get contactId(){return this.general.contactId}set contactId(t){this.general.contactId=t||NaN}get contact(){return this.general.contact}set contact(t){this.general.contactId=t?.id||NaN}get timezone(){return this.general.timezone}set timezone(t){this.general.timezone=t}get language(){return this.general.language}set language(t){this.general.language=t}get formats(){return this.general.formats}set formats(t){this.general.formats=t}get measurements(){return this.general.measurements}set measurements(t){this.general.measurements=t}get options(){return this.general.options}set options(t){this.general.options=t}get notify(){return this.general.notify}set notify(t){this.general.notify=t}#e=new Ie;get advanced(){return this.#e}get groupIds(){return this.advanced.groupIds}set groupIds(t){this.advanced.groupIds=t}get groups(){return this.advanced.groups}set groups(t){this.advanced.groups=t}get permissions(){return this.advanced.permissions}set permissions(t){this.advanced.permissions=t}#i=new De;get authentication(){return this.#i}get passwordExpired(){return this.#i.passwordExpired}set passwordExpired(t){this.#i.passwordExpired=t}get mfa(){return this.#i.mfa}set mfa(t){this.#i.mfa=t}get sso(){return this.#i.sso}set sso(t){this.#i.sso=t}toJSON(){return{...this.#s.toJSON(),...this.#e.toJSON(),...this.#i.toJSON(),v:[...this.v]}}fromJSON(t,s){const e=t?.v||[],i=this.#s.fromJSON({...t,v:e.slice(0,1)},s),n=this.#e.fromJSON({...t,v:e.slice(1,2)},s),r=this.#i.fromJSON({...t,v:e.slice(2,3)},s);return i||n||r}getKey(){return this.login}}class qe extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";permissions=[];toJSON(){return{id:this.id,v:[...this.v],company:this.companyId,name:this.name||"",notes:this.notes||"",permissions:this.permissions?.map(i)??[]}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.permissions=(t.permissions||[]).map(fe.fromJSON)),e}getKey(){return this.id}}const Ge=10.763910416709722,Ve=3.587970138903241,Fe=.6213711922373338,We=3.2808398950131235,_e=1.0936132983377078,Ye=.3937007874015748,$e=.14503773773375084,Ze=5/9,Xe=.2641720523581484,Qe=.03381402270184299,ti=.2199692482990878,si=.035195079727854045,ei=2.2046226218487757,ii=.03527396194958041,ni=1.1023113109243878,ri=3.7854117840000003*Fe*100,hi=4.54609*Fe*100,ai={fromTo:function t(s,e,i){const n=ai[e.toLowerCase()+"To"+i[0].toUpperCase()+i.slice(1).toLowerCase()];if(!n||n===t)throw new Error("No converter for "+e+" to "+i);return n(s)},sqmToSqft:function(t){return t*Ge},sqftToSqm:function(t){return t/Ge},sqmToSqy:function(t){return t*Ve},yftToSqm:function(t){return t/Ve},sqkmToSqmi:function(t){return.3861021585424459*t},sqmiToSqkm:function(t){return t/Fe},haToAc:function(t){return 2.471053814671653*t},acToHa:function(t){return t/Fe},kmToMi:Q,miToKm:et,mToYd:function(t){return t*_e},ydToM:function(t){return t/_e},mToFt:tt,ftToM:it,cmToIn:st,inToCm:nt,mpgToL100km:rt,mpgUKToL100km:ht,mpkwhToKwh100kim:at,l100kmToMpg:rt,l100kmToMpgUK:ht,kwh100kimToMpkwh:at,kpaToPsi:function(t){return t*$e},psiToKpa:function(t){return t/$e},kphToMph:Q,mphToKph:et,mpsToFtps:tt,ftpsToMps:it,cmpsToInps:st,inpsToCmps:nt,cToF:function(t){return 1.8*t+32},fToC:function(t){return(t-32)*Ze},lToGal:function(t){return t*Xe},lToGalUK:function(t){return t*ti},galToL:function(t){return t/Xe},galUKToL:function(t){return t/ti},mlToFloz:function(t){return t*Qe},mlToFlozUK:function(t){return t*si},flozToMl:function(t){return t/Qe},flozUKToMl:function(t){return t/si},kgToLbs:function(t){return t*ei},lbsToKg:function(t){return t/ei},gToOz:function(t){return t*ii},ozToG:function(t){return t/ii},tToTon:function(t){return t*ni},tonToT:function(t){return t/ni},tToTonUK:function(t){return t*ei},tonUKToT:function(t){return t/.9842065276110606}},oi=["B","KB","MB","GB","TB","PB","EB","ZB","YB","XB","SB","DB"],ui=oi.indexOf("MB"),ci=6378137,li=1/298.257223563,di=6356752.314245179,mi=1e-9;class pi{static fromJSON(t){return new pi(t?.width,t?.height)}width;height;constructor(t,s){this.width=Wt(t),this.height=Wt(s)}toString(t=","){return[this.width,this.height].join(t??"")}toJSON(){return{width:this.width,height:this.height}}isEqual(t,s=18){return function(t){return!!t&&a(t.width)&&a(t.height)}(t)&&(c(this.width,s)==c(t.width,s)||isNaN(this.width)&&isNaN(t.width))&&(c(this.height,s)==c(t.height,s)||isNaN(this.height)&&isNaN(t.height))}resize(t=1,s=t){return new pi(this.width*t,this.height*s)}resizeToWidth(t){return u(t)||(t=this.width),this.resize(t/this.width)}resizeToHeight(t){return u(t)||(t=this.height),this.resize(t/this.height)}}class gi{static fromJSON(t){const s=u(t?.left),e=u(t?.top),i=u(t?.right),n=u(t?.bottom),r=u(t?.width),h=u(t?.height);return new gi(s?t.left:i&&r?t.right-t.width:NaN,e?t.top:n&&h?t.bottom-t.height:NaN,i?t.right:s&&r?t.left+t.width:NaN,n?t.bottom:e&&h?t.top+t.height:NaN)}left=NaN;top=NaN;right=NaN;bottom=NaN;get width(){return this.right-this.left}get height(){return this.bottom-this.top}constructor(...t){u(t[0])&&u(t[1])&&u(t[2])&&u(t[3])?(this.left=t[0],this.top=t[1],this.right=t[2],this.bottom=t[3]):this.#n(t)}toString(t=","){return this.validate(),[this.left,this.top,this.right,this.bottom].join(t??"")}toJSON(){return this.validate(),{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}isEqual(t,s=18){return this.validate(),Jt(t)&&c(this.top,s)==c(t.top,s)&&c(this.left,s)==c(t.left,s)&&c(this.bottom,s)==c(t.bottom,s)&&c(this.right,s)==c(t.right,s)}isValid(){return!(this.top>this.bottom||this.right<this.left||this.width!==Qt(this.right-this.left)||this.height!==Qt(this.bottom-this.top))}isEmpty(){return this.isValid()&&this.width+this.height===0}contains(t){return zt(this,t)}overlaps(t){return!(t.left>this.right||t.right<this.left||t.top>this.bottom||t.bottom<this.top)}copy(){return this.validate(),new gi(this)}getCentre(){return this.validate(),new Ni(this.left+this.width/2,this.top+this.height/2)}getSize(){return this.validate(),new pi(this.width,this.height)}getTopLeft(){return this.validate(),new Ni(this.left,this.top)}getTopRight(){return this.validate(),new Ni(this.right,this.top)}getBottomLeft(){return this.validate(),new Ni(this.left,this.bottom)}getBottomRight(){return this.validate(),new Ni(this.right,this.bottom)}#n(t){t instanceof Array?t.forEach(this.#n,this):Ct(t)?(this.#n({x:t.x+t.r,y:t.y+t.r}),this.#n({x:t.x-t.r,y:t.y-t.r})):Ot(t)?((t.y<this.top||!u(this.top))&&(this.top=t.y),(t.x<this.left||!u(this.left))&&(this.left=t.x),(t.x>this.right||!u(this.right))&&(this.right=t.x),(t.y>this.bottom||!u(this.bottom))&&(this.bottom=t.y)):Jt(t)&&(this.#n({x:t.left,y:t.top}),this.#n({x:t.right,y:t.bottom}))}validate(){const t=this.top,s=this.left,e=this.bottom,i=this.right;return this.top=t<e?t:e,this.bottom=t>e?t:e,this.left=s<i?s:i,this.right=s>i?s:i,this}expand(t){return this.#n(t),this}extend(t){return this.#n(t),this.validate()}grow(t=0,s=0,e=""){return a(t)||(t=0),a(s)||(s=0),o(e)||(e=""),e.indexOf("top")>-1?this.top-=s:e.indexOf("bottom")>-1?this.bottom+=s:(this.top-=s/2,this.bottom+=s/2),e.indexOf("left")>-1?this.left-=t:e.indexOf("right")>-1?this.right+=t:(this.left-=t/2,this.right+=t/2),this.validate()}translateTo(t,s){return this.offsetTo(Mt(t,s))}offsetTo(t){const s=this.toOffset(t);return this.left=s.left,this.top=s.top,this.right=s.right,this.bottom=s.bottom,this}toTranslated(t,s){return this.toOffset(Mt(t,s))}toOffset(t){return this.validate(),new gi(new Ni(this.left+t.x,this.top+t.y),new Ni(this.right+t.x,this.bottom+t.y))}toRadial(t=!1){this.validate();const s=this.getCentre();return new fi(s.x,s.y,t?this.width>this.height?Ut(s,{x:this.left,y:this.top+this.height/2}):Ut(s,{x:this.left+this.width/2,y:this.top}):Ut(s,{x:this.left,y:this.top}))}}class fi{static fromJSON(t){return new fi(t?.x,t?.y,t?.r)}x=NaN;y=NaN;r=NaN;constructor(...t){u(t[0])&&u(t[1])&&u(t[2])?(this.x=t[0],this.y=t[1],this.r=t[2]):this.h(t)}toString(t=","){return[this.x,this.y,this.r].join(t??"")}toJSON(){return{x:this.x,y:this.y,r:this.r}}copy(){return new fi(this.x,this.y,this.r)}isEqual(t,s=18){return Ct(t)&&(c(this.x,s)===c(t.x,s)||isNaN(this.x)&&isNaN(t.x))&&(c(this.y,s)===c(t.y,s)||isNaN(this.y)&&isNaN(t.y))&&(c(this.r,s)===c(t.r,s)||isNaN(this.r)&&isNaN(t.r))}contains(t){return Ut(this,t)<=this.r}overlaps(t){return Ut(this,t)<=this.r+t.r}getCentre(){return new Ni(this.x,this.y)}getSize(){return new pi(2*this.r,2*this.r)}h(t){if(t instanceof Array)t.forEach(this.h,this);else{const s=this.getCentre();let e;Ct(t)?(e=Ut(s,t)+t.r)>this.r&&(this.r=e):Ot(t)&&(e=Ut(s,t))>this.r&&(this.r=e)}}extend(t){return this.h(t),this}grow(t){return this.r+=t,this}translateTo(t,s){return this.offsetTo(Mt(t,s))}offsetTo(t){const s=this.toOffset(t);return this.x=s.x,this.y=s.y,this}toTranslated(t,s){return this.toOffset(Mt(t,s))}toOffset(t){return new fi(this.x+t.x,this.y+t.y,this.r)}toRectangle(t=!1){const s=t?this.getCentre():null,e=s?s.toOffset(Mt(this.r,-45)):new Ni(this.x-this.r,this.y-this.r),i=s?s.toOffset(Mt(this.r,135)):new Ni(this.x+this.r,this.y+this.r);return new gi(e,i)}}class Ni{static fromJSON(t){return new Ni(t?.x,t?.y)}x;y;constructor(t,s){this.x=Wt(t),this.y=Wt(s)}toString(t=","){return[this.x,this.y].join(t??"")}toJSON(){return{x:this.x,y:this.y}}copy(){return new Ni(this.x,this.y)}isEqual(t,s=18){return Ot(t)&&(c(this.x,s)===c(t.x,s)||isNaN(this.x)&&isNaN(t.x))&&(c(this.y,s)===c(t.y,s)||isNaN(this.y)&&isNaN(t.y))}distanceTo(t){return Ut(this,t)}angleTo(t){return xt(this,t)}translateTo(t,s){return this.offsetTo(Mt(t,s))}offsetTo(t){const s=this.toOffset(t);return this.x=s.x,this.y=s.y,this}toTranslated(t,s){return this.toOffset(Mt(t,s))}toOffset(t){return new Ni(this.x+t.x,this.y+t.y)}toRadial(t){return new fi(this.x,this.y,t)}}class wi{static fromJSON(t){const s=new wi;return Rt(t)&&(s.east=t.east,s.north=t.north,s.west=t.west,s.south=t.south),s.validate()}north=NaN;east=NaN;south=NaN;west=NaN;constructor(...t){t.forEach((t=>this.h(t)))}toString(t=","){return[this.north,this.east,this.south,this.west].join(t??"")}toJSON(){return this.validate(),{north:this.north,east:this.east,south:this.south,west:this.west}}isEqual(t,s=1e-9){return Rt(t)&&mt(this.getNorthEast(),{lat:t.north,lng:t.east})<s&&mt(this.getSouthWest(),{lat:t.south,lng:t.west})<s}isValid(){return this.north>=this.south&&this.east>=this.west&&!(Qt(this.north)>90||Qt(this.south)>90||Qt(this.east)>180&&Qt(this.east)>180)}isEmpty(){return this.isValid()&&(mt(this.getNorthEast(),this.getNorthWest())<mi||mt(this.getNorthEast(),this.getSouthEast())<mi)}contains(t){this.validate();const s=ct(t.lat),e=lt(t.lng,s)+360;return e<=lt(this.east)+360&&e>=lt(this.west)+360&&pt(this.getNorthWest(),{lat:s,lng:e},this.getNorthEast())<=0&&pt(this.getSouthWest(),{lat:s,lng:e},this.getSouthEast())>=0}encloses(t){this.validate();const s=ct(t.north),e=lt(t.east,s)+360,i=ct(t.south),n=lt(t.west,i)+360;return e<=lt(this.east)+360&&n>=lt(this.west)+360&&pt(this.getNorthWest(),{lat:t.north,lng:t.west},this.getNorthEast())<=0&&pt(this.getSouthWest(),{lat:t.south,lng:t.east},this.getSouthEast())>=0}overlaps(t){this.validate();const s=new wi(t);return this.contains(s.getNorthEast())||this.contains(s.getNorthWest())||this.contains(s.getSouthWest())||this.contains(s.getSouthEast())||s.encloses(this)}h(t){if(t instanceof Array)t.forEach(this.h,this);else if(Rt(t)){const s=ct(t.north),e=lt(t.east,s),i=ct(t.south),n=lt(t.west,i);if((e>this.east||!u(this.east))&&(this.east=e),(n<this.west||!u(this.west))&&(this.west=n),!u(this.north)||s>this.north&&(this.east===e||this.west===n))this.north=s;else if(u(s)){const t={lat:s,lng:e},i=pt(this.getNorthWest(),t,this.getNorthEast());i>0&&(this.north=gt(t,i,0).lat)}if(!u(this.south)||i<this.south&&(this.east===e||this.west===n))this.south=i;else if(u(i)){const t={lat:i,lng:n},s=pt(this.getSouthEast(),t,this.getSouthWest());s>0&&(this.south=gt(t,s,180).lat)}}else if(Kt(t)){const s=ct(t.lat),e=lt(t.lng,s);if((e>this.east||!u(this.east))&&(this.east=e),(e<this.west||!u(this.west))&&(this.west=e),!u(this.north)||s>this.north&&(this.east===e||this.west===e))this.north=s;else if(u(s)){const t={lat:s,lng:e},i=pt(this.getNorthWest(),t,this.getNorthEast());i>0&&(this.north=gt(t,i,0).lat)}if(!u(this.south)||s<this.south&&(this.east===e||this.west===e))this.south=s;else if(u(s)){const t={lat:s,lng:e},i=pt(this.getSouthEast(),t,this.getSouthWest());i>0&&(this.south=gt(t,i,180).lat)}}}expand(t){return this.h(t),this}extend(t){return this.h(t),this.validate()}getCentre(){const t=this.getNorthEast(),s=this.getSouthWest(),e=gt(t,mt(t,s)/2,dt(t,s));return new yi(e.lat,e.lng)}getNorthEast(){return new yi(this.north,this.east)}getNorthWest(){return new yi(this.north,this.west)}getSouthEast(){return new yi(this.south,this.east)}getSouthWest(){return new yi(this.south,this.west)}getNorthMiddle(){const t=ft(this.getNorthEast(),this.getNorthWest());return new yi(t.lat,t.lng)}getSouthMiddle(){const t=ft(this.getSouthEast(),this.getSouthWest());return new yi(t.lat,t.lng)}getEastMiddle(){const t=ft(this.getNorthEast(),this.getSouthEast());return new yi(t.lat,t.lng)}getWestMiddle(){const t=ft(this.getNorthWest(),this.getSouthWest());return new yi(t.lat,t.lng)}getDiagonalDistance(){return mt(this.getNorthEast(),this.getSouthWest())}getLatitudinalDistance(){return mt(this.getNorthEast(),this.getSouthEast())}getLongitudinalDistance(){return Qt(this.north)<Qt(this.south)?mt(this.getNorthEast(),this.getNorthWest()):mt(this.getSouthEast(),this.getSouthWest())}validate(){const t=ct(this.north),s=lt(this.east,t),e=ct(this.south),i=lt(this.west,e);return this.north=t>e?t:e,this.south=e<t?e:t,this.east=s>i?s:i,this.west=i<s?i:s,this}}class yi{static INVALID=new yi(0,0);static fromJSON(t){return new yi(t?.lat,t?.lng)}static fromString(t,s=","){const e=t?.split(s??",");return new yi(e?.[0],e?.[1])}lat;lng;constructor(t,s){this.lat=ct(t),this.lng=lt(s)}toString(t=","){return[c(this.lat,6),c(this.lng,6)].join(t??",")}toJSON(){return this.isValid()?{lat:c(this.lat,6),lng:c(this.lng,6)}:{lat:0,lng:0}}isEqual(t,s=1e-9){return Kt(t)&&mt(this,t)<s}isValid(){return u(this.lat)&&u(this.lng)&&!this.isEqual(yi.INVALID)}distanceTo(t){return mt(this,t)}bearingTo(t){return dt(this,t)}toTranslated(t,s){const e=gt(this,t,s);return new yi(e.lat,e.lng)}toBetween(t){const s=ft(this,t);return new yi(s.lat,s.lng)}toRadians(t=1){const s=us(this.lat*ms);return new Ni((1+this.lng/180)*t,(1-.5/Xt*rs((1+s)/(1-s)))*t)}toBounds(t){const s=l(t,t);return new wi(gt(this,s,45),gt(this,s,-135))}}class Si{static fromJSON(t){return new Si(t.number,t.street,t.city,t.region,t.province,t.country,t.postal,t.isToll)}number;street;city;region;province;country;postal;isToll;constructor(t,s,e,i,n,r,h,a){this.number=String(t??"").trim(),this.street=String(s??"").trim(),this.city=String(e??"").trim(),this.region=String(i??"").trim(),this.province=String(n??"").trim(),this.country=String(r??"").trim(),this.postal=String(h??"").trim(),this.isToll=!!a}toString(){const t=[];return this.street&&t.push((this.number?this.number+" ":"")+this.street),this.city&&t.push(this.city),this.region&&t.push(this.region),this.province&&t.push(this.province),this.country&&t.push(this.country),this.postal&&t.push(this.postal),t.join(", ")}toJSON(){return{number:this.number,street:this.street,city:this.city,region:this.region,province:this.province,country:this.country,postal:this.postal,isToll:this.isToll}}}class vi extends yi{static fromJSON(t){return new vi(t?.lat,t?.lng,t?.speed,t?.bearing,t?.accuracy,t?.dts,t?.address,t?.speedLimit,t?.altitude,t?.streetAddress)}speed;bearing;altitude;accuracy;date=m();get dts(){return this.date.toISOString()}streetAddress=null;speedLimit;origin="";address;constructor(t,s,e,i,n,r,h,a,o,u){super(t,s),this.speed=!e||(e=Wt(e))<0?0:e,this.bearing=lt(Wt(i)),this.accuracy=Wt(n),this.date=m(r),this.address=String(h??""),this.speedLimit=Wt(a),this.altitude=Wt(o),u&&(this.streetAddress=Si.fromJSON(u))}toString(t=","){return t=t??"","("+super.toString(t)+t+this.speed+t+this.bearing+t+this.accuracy+t+this.altitude+t+T(this.date)+t+this.speedLimit+")"+(this.streetAddress?.toString()??this.address)}toJSON(){return{...super.toJSON(),dts:this.dts||"",speed:b(this.speed),speedLimit:b(this.speedLimit),bearing:b(this.bearing),altitude:b(this.altitude),accuracy:b(this.accuracy),address:this.address,streetAddress:this.streetAddress?.toJSON()||null}}isEqual(t){return!!(super.isEqual(t)&&a(t.speed)&&(t.speed===this.speed||isNaN(t.speed)&&isNaN(this.speed))&&a(t.bearing)&&(t.bearing===this.bearing||isNaN(t.bearing)&&isNaN(this.bearing))&&a(t.accuracy)&&(t.accuracy===this.accuracy||isNaN(t.accuracy)&&isNaN(this.accuracy))&&(t.dts||t.date instanceof Date)&&(t.dts===this.dts||t.date?.valueOf()===this.date.valueOf()||isNaN(t.date?.valueOf())&&isNaN(this.date.valueOf()))&&a(t.speedLimit)&&(t.speedLimit===this.speedLimit||isNaN(t.speedLimit)&&isNaN(this.speedLimit))&&a(t.altitude)&&(t.altitude===this.altitude||isNaN(t.altitude)&&isNaN(this.altitude))&&J(t.address)===J(this.address))}}const Ti=(ps?ps.protocol+ps.host+ps.pathname:(new Date).valueOf().toString(16)).match(/[a-z0-9]/gim).reduce((function(t,s){return t+Ft(s,36)}),0).toString(16).split("").reduce((function(t,s,e){return t[e]=s,t})," - -4 - - ".split("")),bi=/^!?[a-z0-9\-]+:/gim,Oi=/(!?(?:[#$]?[a-z0-9\-]+|"[^"]+"|'[^']+'|\*))/gim,Ci=/(?:!?[a-z0-9\-]+:\s*)?(?:(?:(!?(?:[#$]?[a-z0-9\-]+|"[^"]*"|'[^']*'|\*))(?:,\s*)?)+)?/gim,Ji=/("[^"]*"|'[^']*'|\|)/gm;class ki{static parse(t){const s=(t??"").split(Ji),e=[];let i="";for(let t=0,n=s.length;t<n;t++)"|"!==s[t]?i+=s[t]:(i&&e.push(new ki(i)),i="");return i&&e.push(new ki(i)),e}static stringify(t){const s=(t||[]).map((t=>t.toString()));return 0===s.length?null:s.some((t=>"*"===t))?"*":s.join("|")}operators=new Map;terms=[];constructor(t=""){const s=t?t.match(Ci):null;var e;s?.length&&(e=this,s.forEach(Lt,e),e.operators.forEach(Ht),Ht(e.terms))}get wildcard(){return!this.terms.length&&!this.operators.size}toString(){const t=[];return this.operators.forEach(((s,e)=>t.push(e+":"+(s?.join(",")||"*")))),(t.join(" ")+" "+this.terms.join(",")).trim()||"*"}toJSON=this.toString;copy(){const t=new ki;return this.operators.forEach(((s,e)=>t.operators.set(e,[...s]))),t.terms=[...this.terms],t}}class xi{static fromJSON(t){return new xi(t.name,t.simple,t.complex,t.raw,t.unit,t.provider,t.asset,t.dts,t.global)}name="";simple="";complex="";raw=null;unit="";providerId="";get provider(){return Fs.get(this.providerId)}assetId=NaN;get asset(){return Js.get(this.assetId)}dts=m();global=!1;constructor(t,s,e,i,n,r,h,a,o){this.name=t||"",this.simple=s||"",this.complex=e||"",this.raw=i||null,this.unit=n||"",this.providerId=r||"",this.assetId=d(h),this.dts=m(a),this.global=!!o}toJSON(){return{name:this.name,simple:this.simple,complex:this.complex,raw:this.raw||u(this.raw)||"string"==typeof this.raw?this.raw:null,provider:this.providerId||"",asset:b(this.assetId),dts:T(this.dts),global:!!this.global}}}var Ui,Ii,Mi,Ai,Di,Pi,Ei,zi,Ki,Ri,Bi,Li,ji,Hi,qi,Gi,Vi,Fi;!function(t){t.enter="enter",t.inside="inside",t.exit="exit"}(Ui||(Ui={}));class Wi{static fromJSON(t){return new Wi(t.kind,t.enter,t.latest)}kind=Ui.inside;enter=m();latest=m();constructor(t,s,e){this.kind=Ui[t]||Ui.inside,this.enter=m(s),this.latest=m(e)}toJSON(){return{kind:Ui[this.kind]||Ui.inside,enter:T(this.enter),latest:T(this.latest)}}}class _i extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}position=null;odometer=NaN;tags=[];attributes=new Map;providerIds=[];get providers(){return k(Fs,this.providerIds)}set providers(t){this.providerIds=t?.map((t=>t.id))??[]}relationshipIds=[];get relationships(){return k(Js,this.relationshipIds)}set relationships(t){this.relationshipIds=t?.map(e)??[]}places=new Map;engineHours=NaN;toJSON(){const t={id:this.id||null,v:[...this.v],company:this.companyId,position:this.position?.toJSON()||null,odometer:this.odometer||0,tags:[...this.tags],attributes:N(this.attributes),providers:[...this.providerIds],relationships:[...this.relationshipIds],places:N(this.places)};return u(this.engineHours)&&(t.engineHours=this.engineHours),t}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id=d(t.id),this.companyId=d(t.company),this.position=t.position?vi.fromJSON(t.position):null,this.odometer=Wt(t.odometer),this.tags=[...t.tags||[]],this.attributes=y(t.attributes||{},((t,s)=>[t,new xi(s)])),this.relationshipIds=(t.relationships||[]).map(d),this.places=y(t.places||{},((t,s)=>[d(t),new Wi(s)])),this.engineHours=Wt(t.engineHours)),e}getKey(){return this.id}}class Yi{static fromJSON(t){return new Yi(t.distance,t.duration,t.instructions,t.path,t.directions?.map(Yi.fromJSON),t.job,t.step)}distance;duration;instructions="";path;directions;job;step;constructor(t,s,e,i,n,r,h){this.distance=Wt(t),this.duration=new Be(s),this.instructions=e||"",this.path=i?.map(yi.fromJSON)??[],this.directions=n??[],this.job=d(r),this.step=d(h)}toJSON(){return{distance:this.distance||0,duration:this.duration.toString()||null,instructions:this.instructions||"",path:this.path.map(i),directions:this.directions.map(i),job:this.job||null,step:this.step||null}}}class $i extends Vt{static fromJSON(t){return new $i(t)}id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}jobIds=[];get jobs(){return k(zs,this.jobIds)}set jobs(t){this.jobIds=t?.map(e)??[]}directions=[];lastDispatched=m();toJSON(){return{id:this.id||null,v:[...this.v],companyId:this.companyId||null,jobs:[...this.jobIds],directions:this.directions.map((t=>t.toJSON())),lastDispatched:this.lastDispatched.toISOString()}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id=d(t.id),this.companyId=d(t.company),this.jobIds=(t.jobs||[]).map(d),this.directions=(t.directions||[]).map(Yi.fromJSON),this.lastDispatched=m(t.lastDispatched)),e}getKey(){return this.id}}!function(t){t.asset="asset",t.person="person",t.trailer="trailer",t.vehicle="vehicle"}(Ii||(Ii={}));class Zi extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}kind=Ii.asset;name="";iconId=NaN;get icon(){return js.get(this.iconId)}set icon(t){this.iconId=t?.id??NaN}notes="";labels=[];pictureIds=[];get pictures(){return k(Ls,this.pictureIds)}set pictures(t){this.pictureIds=t?.map(e)??[]}messagingAddress="";references=new Map;contactId=NaN;get contact(){return vs.get(this.contactId)}set contact(t){this.contactId=t.id}vin="";plate="";make="";model="";year=NaN;colour="";serial="";toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,kind:Ii[this.kind]||null,name:this.name||"",notes:this.notes||"",icon:this.iconId,labels:[...this.labels],...this.suspended?{suspended:!0,since:T(this.since)}:{references:N(this.references),messagingAddress:this.messagingAddress,pictures:[...this.pictureIds],contact:this.contactId,vin:this.vin||"",plate:this.plate||"",make:this.make||"",model:this.model||"",year:this.year||null,colour:this.colour||"",serial:this.serial||""}}}fromJSON(t,s){!t.kind&&u(t.engineHours)&&(t.kind=Ii.vehicle);const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id=d(t.id),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.suspended=!!t.suspended,this.since=m(t.since),this.references=S(t.references||{}),this.labels=[...t.labels||[]],this.iconId=d(t.icon),this.pictureIds=(t.pictures||[]).map(d),this.messagingAddress=t.messagingAddress||"",this.contactId=d(t.contact),this.plate=t.plate||"",this.vin=t.vin||"",this.make=t.make||"",this.model=t.model||"",this.year=d(t.year)||0,this.colour=t.colour||"",this.serial=t.serial||""),e}getKey(){return this.id}suspended=!1;since=m()}class Xi extends Ue{get pieces(){return[this.#s,this.#e,this.#r]}get id(){return this.#s.id??this.#e.id??this.#r.id}get companyId(){return this.#s.companyId??this.#e.companyId??this.#r.companyId}get company(){return this.#s.company??this.#e.company??this.#r.company}get kind(){return this.#s.kind}#s=new Zi;get general(){return this.#s}get name(){return this.#s.name}set name(t){this.#s.name=t}get notes(){return this.#s.notes}set notes(t){this.#s.notes=t}get iconId(){return this.#s.iconId}set iconId(t){this.#s.iconId=t}get icon(){return this.#s.icon}set icon(t){this.#s.icon=t}get labels(){return this.#s.labels}set labels(t){this.#s.labels=t}get pictureIds(){return this.#s.pictureIds}set pictureIds(t){this.#s.pictureIds=t}get pictures(){return this.#s.pictures}set pictures(t){this.#s.pictures=t}get messagingAddress(){return this.#s.messagingAddress}set messagingAddress(t){this.#s.messagingAddress=t}get references(){return this.#s.references}set references(t){this.#s.references=t}get contactId(){return this.general.contactId}set contactId(t){this.general.contactId=t}get contact(){return this.general.contact}set contact(t){this.general.contact=t}get plate(){return this.general.plate}get vin(){return this.general.vin}set vin(t){this.general.vin=t}get make(){return this.general.make}set make(t){this.general.make=t}get model(){return this.general.model}set model(t){this.general.model=t}get year(){return this.general.year}set year(t){this.general.year=t}get colour(){return this.general.colour}set colour(t){this.general.colour=t}get serial(){return this.general.serial}set serial(t){this.general.serial=t}#e=new _i;get advanced(){return this.#e}get position(){return this.#e.position}set position(t){this.#e.position=t}get odometer(){return this.#e.odometer}set odometer(t){this.#e.odometer=t}get tags(){return this.#e.tags}set tags(t){this.#e.tags=t}get attributes(){return this.#e.attributes}set attributes(t){this.#e.attributes=t}get providerIds(){return this.#e.providerIds}get providers(){return this.#e.providers}get relationshipIds(){return this.#e.relationshipIds}set relationshipIds(t){this.#e.relationshipIds=t}get relationships(){return this.#e.relationships}set relationships(t){this.#e.relationships=t}get places(){return this.#e.places}set places(t){this.#e.places=t}get engineHours(){return this.advanced.engineHours}set engineHours(t){this.advanced.engineHours=t}#r=new $i;get dispatch(){return this.#r}toJSON(){return this.#s.suspended?this.#s.toJSON():{...this.#s.toJSON(),...this.#e.toJSON(),...this.#r.toJSON(),v:[...this.v]}}fromJSON(t,s){const e=t?.v,i=this.#s.fromJSON({...t,v:e.slice(0,1)},s),n=this.#e.fromJSON({...t,v:e.slice(1,2)},s),r=this.#r.fromJSON({...t,v:e.slice(2,3)},s);return i||n||r}getKey(){return this.id}get suspended(){return this.#s.suspended}get since(){return this.#s.since}}!function(t){t.boolean="boolean",t.number="number",t.text="text",t.json="json"}(Mi||(Mi={}));class Qi{static fromJSON(t){return new Qi(t.kind||t.type,t.value,t.notes,t.context)}kind;value;notes;context;constructor(t,s,e,i){this.kind=Mi[t]||Mi.text,this.value=s||"",this.notes=e||"",this.context=i||""}toJSON(){return{kind:Mi[this.kind]||Mi.text,value:this.value||"",notes:this.notes||"",context:this.context||""}}}class tn extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}scriptId=NaN;get script(){return Us.get(this.scriptId)}name="";notes="";priority=255;targets=null;filters=null;parameters=new Map;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId||null,script:this.scriptId||null,name:this.name||"",notes:this.notes||"",targets:ki.stringify(this.targets),filters:ki.stringify(this.filters),priority:this.priority||255,parameters:N(this.parameters)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.scriptId=d(t.script),this.name=t.name||"",this.notes=t.notes||"",this.priority=d(t.priority),this.targets=ki.parse(t.targets),this.filters=ki.parse(t.filters),this.parameters=y(t.parameters||{},((t,s)=>[t,Qi.fromJSON(s)]))),e}getKey(){return this.id}}!function(t){t.log="log",t.info="info",t.warn="warn",t.err="err"}(Ai||(Ai={}));class sn extends Vt{id=NaN;assetId=NaN;get asset(){return Js.get(this.assetId)}companyId=NaN;get company(){return Ss.get(this.companyId)}behaviourId=NaN;get behaviour(){return xs.get(this.behaviourId)}scriptId=NaN;get script(){return Us.get(this.scriptId)}kind=Ai.log;dts=m();message="";line=NaN;character=NaN;toJSON(){return{id:this.id||null,v:[...this.v],asset:this.assetId||null,company:this.companyId||null,behaviour:this.behaviourId||null,script:this.scriptId||null,kind:Ai[this.kind]||Ai.log,dts:T(this.dts),message:this.message||"",line:this.line||-1,character:this.character||-1}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.assetId=d(t.asset),this.companyId=d(t.company),this.behaviourId=d(t.behaviour),this.scriptId=d(t.script),this.kind=Ai[t.kind]||Ai.log,this.dts=m(t.dts),this.message=t.message||"",this.line=d(t.line),this.character=d(t.character)),e}getKey(){return this.id}}class en extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";global=!1;source="";filters=null;parameters=new Map;fill="";stroke="";graphic="";toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId||null,name:this.name||"",notes:this.notes||"",global:!!this.global,source:this.source||"",filters:ki.stringify(this.filters),parameters:N(this.parameters),fill:this.fill||"",stroke:this.stroke||"",graphic:this.graphic||""}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.global=!!t.global,this.source=t.source||"",this.filters=ki.parse(t.filters),this.parameters=y(t.parameters||{},((t,s)=>[t,Qi.fromJSON(s)])),this.fill=t.fill||"",this.stroke=t.stroke||"",this.graphic=t.graphic||""),e}getKey(){return this.id}}!function(t){t.CAD="CAD",t.USD="USD",t.EURO="EURO"}(Di||(Di={})),function(t){t.monthly="monthly",t.quarterly="quarterly",t.annually="annually"}(Pi||(Pi={}));class nn{static fromJSON(t){return new nn(t.limit,t.amount)}limit=NaN;amount=NaN;constructor(t,s){this.limit=d(t),this.amount=Wt(s)}toJSON(){return{limit:b(this.limit),amount:b(this.amount)}}}class rn extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}targetId=NaN;get target(){return Ss.get(this.targetId)}billeeId=NaN;get billee(){return Ss.get(this.billeeId)}name="";notes="";messages=[];cycle=Pi.monthly;cycleStart=m();cycleEnd=m();cyclePostDated=!1;currency=Di.CAD;googleServicesEnabled=!1;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,target:this.targetId,billee:this.billeeId,name:this.name||"",notes:this.notes||"",messages:this.messages?.map(i)??[],cycle:Pi[this.cycle]||Pi.monthly,currency:Di[this.currency]||Di.CAD,cycleStart:u(this.cycleStart.valueOf())?this.cycleStart.toISOString():null,cycleEnd:u(this.cycleStart.valueOf())?this.cycleEnd.toISOString():null,cyclePostDated:!!this.cyclePostDated,googleServicesEnabled:!!this.googleServicesEnabled}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.targetId=d(t.target),this.billeeId=d(t.billee),this.name=t.name||"",this.notes=t.notes||"",this.messages=(t.messages||[]).map(nn.fromJSON),this.cycle=Pi[t.cycle]||Pi.monthly,this.cycleStart=m(t.cycleStart),this.cycleEnd=m(t.cycleEnd),this.cyclePostDated=!!t.cyclePostDated,this.currency=Di[t.cycle]||Di.CAD,this.googleServicesEnabled=!!t.googleServicesEnabled),e}getKey(){return this.id}}class hn extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}profileId=NaN;get profile(){return Ms.get(this.profileId)}name="";notes="";reference="";sku="";start=m();end=m();amount=NaN;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,profile:this.profileId,name:this.name||"",notes:this.notes||"",reference:this.reference||"",sku:this.sku||"",start:T(this.start),end:T(this.end),amount:b(this.amount)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.profileId=d(t.profile),this.name=t.name||"",this.notes=t.notes||"",this.reference=t.reference||"",this.sku=t.sku||"",this.start=m(t.start),this.end=m(t.end),this.amount=Wt(t.amount)),e}getKey(){return this.id}}class an extends hn{limit=NaN;targets=null;suspended=!1;toJSON(){return{...super.toJSON(),limit:b(this.limit),targets:ki.stringify(this.targets),suspended:!!this.suspended}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return super.fromJSON(t,e),e&&(this.limit=Wt(t.limit),this.targets=ki.parse(t.targets),this.suspended=!!t.suspended),e}}!function(t){t.smartwitness="smartwitness",t.bewhere="bewhere",t.calamp="calamp"}(Ei||(Ei={}));class on extends an{kind=Ei.bewhere;toJSON(){return{...super.toJSON(),kind:Ei[this.kind]}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return super.fromJSON(t,e),e&&(this.kind=Ei[t.kind]),e}}!function(t){t.mobile="mobile",t.vehicle="vehicle",t.asset="asset",t.dispatch="dispatch",t.elogs="elogs",t.inventory="inventory",t.cargo="cargo",t.forms="forms",t.streetview="streetview"}(zi||(zi={}));class un extends an{service=zi.asset;toJSON(){return{...super.toJSON(),service:zi[this.service]}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return super.fromJSON(t,e),e&&(this.service=zi[t.kind]),e}}!function(t){t.unknown="unknown",t.airlink="airlink",t.bluetree="bluetree",t.genx="genx",t.lmu="lmu",t.ttu="ttu",t.spiderAT="spiderAT",t.spiderMT="spiderMT",t.mobile="mobile",t.datatrans="datatrans",t.xirgo="xirgo",t.lbs="lbs",t.titan="titan",t.concox="concox",t.aspenta="aspenta",t.json="json",t.smartwitness="smartwitness",t.calamp="calamp",t.enfora="enfora",t.bewhere="bewhere",t.atrack="atrack",t.teltonika="teltonika"}(Ki||(Ki={}));class cn{static fromJSON(t){return new cn(t.provider,t.kind,t.name,t.notes,t.created,t.deleted,t.phoneNumber,t.firmware,t.billableDays,t.cost,t.total)}providerId="";get provider(){return Fs.get(this.providerId)}set provider(t){this.providerId=t?.id}kind;name="";notes="";created=m();deleted=m();phoneNumber=NaN;firmware="";billableDays=NaN;cost=NaN;total=NaN;constructor(t,s,e,i,n,r,h,a,o,u,c){this.providerId=t||"",this.kind=Ki[s]||Ki.unknown,this.name=e||"",this.notes=i||"",this.created=m(n),this.deleted=m(r),this.phoneNumber=g(h),this.firmware=a||"",this.billableDays=Wt(o),this.cost=Wt(u),this.total=Wt(c)}toJSON(){return{provider:this.providerId,kind:Ki[this.kind]??Ki.unknown,name:this.name||"",notes:this.notes||"",created:T(this.created),deleted:T(this.deleted),phoneNumber:b(this.phoneNumber),firmware:this.firmware||"",billableDays:b(this.billableDays),cost:b(this.cost),total:b(this.total)}}}class ln{static fromJSON(t){return new ln(t.asset,t.kind,t.name,t.notes,t.created,t.deleted,t.suspended,t.restored,t.revived,t.labels,t.providers,t.phoneNumbers,t.updatedDts,t.billableDays,t.cost,t.suspendedDays,t.suspendedCost,t.total)}assetId=NaN;get asset(){return Js.get(this.assetId)}set asset(t){this.assetId=t?.id||NaN}kind=Ii.asset;name="";notes="";created=m();deleted=m();suspended=m();restored=m();revived=m();labels=[];providerIds=[];get providers(){return k(Fs,this.providerIds)}set providers(t){this.providerIds=t?.map((t=>t.id))??[]}phoneNumbers=[];updatedDts=m();billableDays=NaN;cost=NaN;suspendedDays=NaN;suspendedCost=NaN;total=NaN;constructor(t,s,e,i,n,r,h,a,o,u,c,l,p,f,N,w,y,S){this.assetId=d(t),this.kind=Ii[s]||Ii.asset,this.name=e||"",this.notes=i||"",this.created=m(n),this.deleted=m(r),this.suspended=m(h),this.restored=m(a),this.revived=m(o),this.labels=u?.map(J)??[],this.providerIds=c||[],this.phoneNumbers=l?.map(g)??[],this.updatedDts=m(p),this.billableDays=Wt(f),this.cost=Wt(N),this.suspendedDays=Wt(w),this.suspendedCost=Wt(y),this.total=Wt(S)}toJSON(){return{asset:b(this.assetId),kind:Ii[this.kind]||null,name:this.name||"",notes:this.notes||"",created:T(this.created),deleted:T(this.deleted),suspended:T(this.suspended),restored:T(this.restored),revived:T(this.revived),labels:[...this.labels],providers:[...this.providerIds],phoneNumbers:[...this.phoneNumbers],revupdatedDtsived:T(this.updatedDts),billableDays:this.billableDays||0,cost:this.cost||0,suspendedDays:this.suspendedDays||0,suspendedCost:this.suspendedCost||0,total:this.total||0}}}class dn{static fromJSON(t){return new dn(t.target,t.services?.map(ln.fromJSON),t.licenses?.map(cn.fromJSON))}targetId=NaN;get target(){return Ss.get(this.targetId)}services=[];licenses=[];constructor(t,s,e){this.targetId=d(t),this.services=[...s||[]],this.licenses=[...e||[]]}toJSON(){return{target:b(this.targetId),services:[...this.services||[]],licenses:[...this.licenses||[]]}}}!function(t){t.created="created",t.queued="queued",t.running="running",t.completed="completed",t.failed="failed"}(Ri||(Ri={}));class mn{static fromJSON(t){return new mn(t.sku,t.cost,t.count,t.total)}sku="";cost=NaN;count=NaN;total=NaN;constructor(t,s,e,i){this.sku=t||"",this.cost=Wt(s),this.count=d(e),this.total=Wt(i)}toJSON(){return{sku:this.sku||"",cost:b(this.cost),count:b(this.count),total:b(this.total)}}}class pn{static fromJSON(t){return new pn(t.target,t.parent,t.name,t.notes,t.hosting?.map(mn.fromJSON))}targetId=NaN;get target(){return Ss.get(this.targetId)}parentId=NaN;get parent(){return Ss.get(this.parentId)}name="";notes="";hosting=[];constructor(t,s,e,i,n){this.targetId=d(t),this.parentId=d(s),this.name=e||"",this.notes=i||"",this.hosting=[...n||[]]}toJSON(){return{target:b(this.targetId),parent:b(this.parentId),name:this.name||"",notes:this.notes||"",hosting:this.hosting?.map(i)??[]}}}class gn extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}billeeId=NaN;get billee(){return Ss.get(this.billeeId)}profileId=NaN;get profile(){return Ms.get(this.profileId)}name="";notes="";startDate=m();endDate=m();total=NaN;currency=Di.CAD;status=Ri.created;error="";summary=[];breakdown=[];toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,billee:this.billeeId,profile:this.profileId,name:this.name||"",notes:this.notes||"",startDate:T(this.startDate),endDate:T(this.endDate),total:this.total||0,currency:Di[this.currency]||Di.CAD,status:Ri[this.status]||Ri.created,error:this.error||"",summary:this.summary?.map(i)??[],breakdown:this.breakdown?.map(i)??[]}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.billeeId=d(t.billee),this.profileId=d(t.profile),this.name=t.name||"",this.notes=t.notes||"",this.startDate=m(t.startDate),this.endDate=m(t.endDate),this.total=Wt(t.total),this.currency=Di[t.cycle]||Di.CAD,this.status=Ri[t.status]||Ri.created,this.error=t.error||"",this.summary=(t.summary||[]).map(pn.fromJSON),this.breakdown=(t.breakdown||[]).map(dn.fromJSON)),e}getKey(){return this.id}}class fn{static fromJSON(t){return new fn(t.fill,t.stroke)}fill="";stroke="";constructor(t,s){this.fill=t||"",this.stroke=s||""}toJSON(){return{fill:this.fill||"",stroke:this.stroke||""}}}class Nn extends Vt{id=NaN;parentId=NaN;get parent(){return Ss.get(this.parentId)}employees=new Map;toJSON(){return{id:b(this.id),v:[...this.v],parent:this.parentId,directory:N(this.employees)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.parentId=d(t.parent),this.employees=S(t.directory||{})),e}getKey(){return this.id}set companyId(t){this.parentId=t}get companyId(){return this.parentId}set company(t){this.parentId=t?.id??NaN}get company(){return this.parent}}class wn extends Vt{id=NaN;parentId=NaN;get parent(){return Ss.get(this.parentId)}name="";notes="";references=new Map;toJSON(){return{id:b(this.id),v:[...this.v],parent:this.parentId,name:this.name,notes:this.notes,references:N(this.references)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.parentId=d(t.parent),this.name=t.name||"",this.notes=t.notes||"",this.references=S(t.references||{})),e}getKey(){return this.id}set companyId(t){this.parentId=t}get companyId(){return this.parentId}set company(t){this.parentId=t?.id??NaN}get company(){return this.parent}}!function(t){t.never="never",t.days="days",t.sessions="sessions"}(Bi||(Bi={}));class yn{static fromJSON(t){return new yn(t.minimumLength,t.includeLetters,t.includeNumbers,t.includeUpperLower,t.includeSpecial,t.expireMode,t.expireThreshold)}minimumLength;includeLetters;includeNumbers;includeUpperLower;includeSpecial;expireMode;expireThreshold;constructor(t,s,e,i,n,r,h){this.minimumLength=d(t),this.includeLetters=!!s,this.includeNumbers=!!e,this.includeUpperLower=!!i,this.includeSpecial=!!n,this.expireMode=Bi[r]??Bi.never,this.expireThreshold=d(h)}toJSON(){return{minimumLength:b(this.minimumLength),includeLetters:!!this.includeLetters,includeNumbers:!!this.includeNumbers,includeUpperLower:!!this.includeUpperLower,includeSpecial:!!this.includeSpecial,expireMode:this.expireMode,expireThreshold:b(this.expireThreshold)}}}!function(t){t.allow="allow",t.deny="deny",t.replace="replace"}(Li||(Li={}));class Sn{static fromJSON(t){return new Sn(t.applications,t.ipv4Ranges,t.multiUser,t.idleAllowed,t.expireTimeout,t.maxSessions)}applications;ipv4Ranges;multiUser;idleAllowed;expireTimeout;maxSessions;constructor(t,s,e,i,n,r){this.applications=[...t||[]],this.ipv4Ranges=[...s||[]],this.multiUser=Li[e]||Li.allow,this.idleAllowed=!!i,this.expireTimeout=d(n)||0,this.maxSessions=d(r)||0}toJSON(){return{applications:[...this.applications],ipv4Ranges:[...this.ipv4Ranges],multiUser:Li[this.multiUser]||Li.allow,idleAllowed:!!this.idleAllowed,expireTimeout:b(this.expireTimeout),maxSessions:b(this.maxSessions)}}}class vn extends Vt{id=NaN;parentId=NaN;get parent(){return Ss.get(this.parentId)}sessionPolicy=new Sn;passwordPolicy=new yn;toJSON(){return{id:b(this.id),v:[...this.v],parent:this.parentId,sessionPolicy:this.sessionPolicy?.toJSON()??null,passwordPolicy:this.passwordPolicy?.toJSON()??null}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.parentId=d(t.parent),this.sessionPolicy=Sn.fromJSON(t.sessionPolicy),this.passwordPolicy=yn.fromJSON(t.passwordPolicy)),e}getKey(){return this.id}set companyId(t){this.parentId=t}get companyId(){return this.parentId}set company(t){this.parentId=t?.id??NaN}get company(){return this.parent}}!function(t){t.IMAP="IMAP",t.POP3="POP3"}(ji||(ji={})),function(t){t.SMTP="SMTP"}(Hi||(Hi={}));class Tn{static fromJSON(t){return new Tn(t.incomingType,t.incomingAddress,t.incomingPort,t.incomingLogin,t.incomingSecure,t.incomingMessageNumber,t.outgoingType,t.outgoingAddress,t.outgoingPort,t.outgoingLogin,t.outgoingSecure,t.outgoingReplyTo)}incomingType=ji.IMAP;incomingAddress="";incomingPort=NaN;incomingLogin="";incomingSecure=!1;incomingMessageNumber=NaN;outgoingType=Hi.SMTP;outgoingAddress="";outgoingPort=NaN;outgoingLogin="";outgoingSecure=!1;outgoingReplyTo="";constructor(t,s,e,i,n,r,h,a,o,u,c,l){this.incomingType=ji[t]||ji.IMAP,this.incomingAddress=s||"",this.incomingPort=d(e),this.incomingLogin=i||"",this.incomingSecure=!!n,this.incomingMessageNumber=d(r),this.outgoingType=Hi[h]||Hi.SMTP,this.outgoingAddress=a||"",this.outgoingPort=d(o),this.outgoingLogin=u||"",this.outgoingSecure=!!c,this.outgoingReplyTo=l||""}toJSON(){return{incomingType:ji[this.incomingType]||ji.IMAP,incomingAddress:this.incomingAddress||"",incomingPort:b(this.incomingPort),incomingLogin:this.incomingLogin||"",incomingSecure:!!this.incomingSecure,incomingMessageNumber:b(this.incomingMessageNumber),outgoingType:Hi[this.outgoingType]||Hi.SMTP,outgoingAddress:this.outgoingAddress||"",outgoingPort:b(this.outgoingPort),outgoingLogin:this.outgoingLogin||"",outgoingSecure:!!this.outgoingSecure,outgoingReplyTo:this.outgoingReplyTo||""}}}class bn{static fromJSON(t){return new bn(t.notifyLimit,S(t.phoneNumbers||{}))}notifyLimit=NaN;phoneNumbers=new Map;constructor(t,s){this.notifyLimit=d(t),this.phoneNumbers=s??new Map}toJSON(){return{notifyLimit:b(this.notifyLimit),phoneNumbers:N(this.phoneNumbers)}}}class On extends Vt{id=NaN;parentId=NaN;get parent(){return Ss.get(this.parentId)}contactInfo=new Map;serviceName="";logo="";icon="";favourite="";domain="";website=new Map;graphics=new Map;languages=[];gamut=new Map;notifyEmail=new Tn;notifySms=new bn;termsPreamble="";termsUpdated=m();recoverSubject="";recoverBody="";recoverIsHtml=!1;toJSON(){return{id:b(this.id),v:[...this.v],parent:this.parentId,contactInfo:N(this.contactInfo),serviceName:this.serviceName||"",logo:this.logo||"",icon:this.icon||"",favourite:this.favourite||"",domain:this.domain||"",website:N(this.website),graphics:N(this.graphics),languages:[...this.languages],gamut:N(this.gamut),notifyEmail:this.notifyEmail.toJSON(),notifySms:this.notifySms.toJSON(),termsPreamble:this.termsPreamble||"",termsUpdated:this.termsUpdated.valueOf()?this.termsUpdated.toISOString():null,recoverSubject:this.recoverSubject||"",recoverBody:this.recoverBody||"",recoverIsHtml:!!this.recoverIsHtml}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.parentId=d(t.parent),this.contactInfo=y(t.contactInfo||{},((t,s)=>[t,d(s)])),this.serviceName=t.serviceName||"",this.logo=t.logo||"",this.icon=t.icon||"",this.favourite=t.favourite||"",this.domain=t.domain||t.URN||t.urn||"",this.website=S(t.website||{}),this.graphics=S(t.graphics||{}),this.gamut=y(t.gamut||{},((t,s)=>[t,fn.fromJSON(s)])),this.languages=[...t.languages||[]],this.notifyEmail=Tn.fromJSON(t.notifyEmail),this.notifySms=bn.fromJSON(t.notifySms),this.termsPreamble=t.termsPreamble||"",this.termsUpdated=m(t.termsUpdated),this.recoverSubject=t.recoverSubject||"",this.recoverBody=t.recoverBody||"",this.recoverIsHtml=!!t.recoverIsHtml),e}getKey(){return this.id}set companyId(t){this.parentId=t}get companyId(){return this.parentId}set company(t){this.parentId=t?.id??NaN}get company(){return this.parent}}class Cn{static fromJSON(t){return new Cn(t.name,t.fill,t.stroke,t.graphic,t.notes)}name="";fill="";stroke="";graphic="";notes="";get code(){return J(this.name)}constructor(t,s,e,i,n){this.name=t||"",this.fill=s||"",this.stroke=e||"",this.graphic=i||"",this.notes=n||""}toJSON(){return{name:this.name,notes:this.notes,fill:this.fill,stroke:this.stroke,graphic:this.graphic}}}class Jn extends Vt{id=NaN;parentId=NaN;get parent(){return Ss.get(this.parentId)}labels=new Map;tags=new Map;toJSON(){return{id:b(this.id),v:[...this.v],parent:this.parentId,labels:N(this.labels),tags:N(this.tags)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.parentId=d(t.parent),this.labels=y(t.labels,qt),this.tags=y(t.tags,qt)),e}getKey(){return this.id}set companyId(t){this.parentId=t}get companyId(){return this.parentId}set company(t){this.parentId=t?.id??NaN}get company(){return this.parent}}class kn extends Ue{get pieces(){return[this.#s,null,this.#h,this.#a,this.#o,this.reseller]}get id(){return this.#s.id??this.#h.id??this.#o.id??this.#a.id??this.reseller?.id}get parent(){return this.#s.parent??this.#h.parent??this.#o.parent??this.#a.parent??this.reseller?.parent}set parent(t){this.parentId=t?.id??NaN}get parentId(){return this.parent?.id??NaN}set parentId(t){this.#s.parentId=t,this.#h.parentId=t,this.#o.parentId=t,this.#a.parentId=t,this.reseller&&(this.reseller.parentId=t)}#s=new wn;get name(){return this.#s.name}set name(t){this.#s.name=t}get notes(){return this.#s.notes}set notes(t){this.#s.notes=t}get references(){return this.#s.references}set references(t){this.#s.references=t}#h=new Nn;get employees(){return this.#h.employees}set employees(t){this.#h.employees=t}#o=new vn;get sessionPolicy(){return this.#o.sessionPolicy}set sessionPolicy(t){this.#o.sessionPolicy=t}get passwordPolicy(){return this.#o.passwordPolicy}set passwordPolicy(t){this.#o.passwordPolicy=t}#a=new Jn;get labels(){return this.#a.labels}set labels(t){this.#a.labels=t}get tags(){return this.#a.tags}set tags(t){this.#a.tags=t}reseller=null;toJSON(){return{...this.#s?.toJSON(),...this.#h?.toJSON(),...this.#a?.toJSON(),...this.#o?.toJSON(),...this.reseller?.toJSON(),v:[...this.v]}}fromJSON(t,s){const e=t?.v||[],i=this.#s.fromJSON({...t,v:e.slice(0,1)},s),n=this.#h.fromJSON({...t,v:e.slice(2,3)},s),r=this.#a.fromJSON({...t,v:e.slice(3,4)},s),h=this.#o.fromJSON({...t,v:e.slice(4,5)},s);let a;return e[5]>0?(a=!this.reseller,a&&(this.reseller=new On),a=this.reseller?.fromJSON({v:e.slice(5,6)},s)??a):(a=!!this.reseller,this.reseller=null),i||n||r||h||a}getKey(){return this.id}set companyId(t){this.parentId=t}get companyId(){return this.parentId}set company(t){this.parentId=t?.id??NaN}get company(){return this.parent}get contacts(){return x(vs,this.id)}get pictures(){return x(Ls,this.id)}}!function(t){t.standby="standby",t.low="low",t.medium="medium",t.high="high",t.urgent="urgent"}(qi||(qi={}));class xn{static fromJSON(t){return new xn(t.updated,t.latlng)}updated=m();latlng;constructor(t,s){this.updated=m(t),this.latlng=s?yi.fromJSON(s):null}toJSON(){return{updated:T(this.updated),latlng:this.latlng?.toJSON()??null}}}!function(t){t.pending="pending",t.onRoute="onRoute",t.arrived="arrived",t.completed="completed"}(Gi||(Gi={}));class Un{static fromJSON(t){return new Un(t.id,t.name||"",y(t.states||{},((t,s)=>[t,xn.fromJSON(s)])),t.eta,t.duration,t.place,t.address,t.latlng,t.notes,t.signature,t.signatory)}id=NaN;name="";get status(){let t=Gi.pending,s=m(0);for(let[e,i]of this.states)i.updated>s&&(t=e,s=i.updated);return t}get updated(){let t=m(0);for(let[s,e]of this.states)e.updated>t&&(t=e.updated);return t}states=new Map;eta=m();duration=new Be;get timeOnSite(){return this.duration.totalSeconds??0}set timeOnSite(t){this.duration=Be.fromSeconds(t)}placeId=NaN;get place(){return Vs.get(this.placeId)}set place(t){this.placeId=t?.id??NaN}address="";latlng;notes="";signature=!1;signatory="";constructor(t,s,e,i,n,r,h,a,o,u,c){this.id=d(t),this.address=h||"",this.duration=new Be(n),this.eta=m(i),this.latlng=a?yi.fromJSON(a):null,this.name=s||"",this.notes=o||"",this.placeId=d(r),this.signature=!!u,this.signatory=c||"",this.states=e??new Map}toJSON(){return{id:this.id||null,address:this.address||"",duration:this.duration.toString()??null,eta:this.eta.toISOString(),latlng:this.latlng?.toJSON()??null,name:this.name||"",notes:this.notes||"",place:this.placeId||null,signature:!!this.signature,signatory:this.signatory||"",states:N(this.states)}}}class In extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}assetId=NaN;get asset(){return Js.get(this.assetId)}set asset(t){this.assetId=t?.id||NaN}name="";references=new Map;instructions="";formIds=[];get forms(){return k(Bs,this.formIds)}set forms(t){this.formIds=t?.map(e)??[]}priority=qi.medium;labels=[];tags=[];steps=[];created=m();driver="";toJSON(){return{id:this.id||null,company:this.companyId||null,v:[...this.v],driver:this.driver||"",created:T(this.created),name:this.name||"",instructions:this.instructions||"",priority:this.priority||qi.standby,references:N(this.references),labels:[...this.labels],tags:this.tags||[],forms:[...this.formIds],steps:(this.steps||[]).map(i)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.created=m(t.created),this.assetId=d(t.asset)||NaN,this.driver=t.driver||"",this.name=t.name||"",this.instructions=t.instructions||"",this.priority=qi[t.priority]||qi.standby,this.references=S(t.references||{}),this.labels=[...t.labels||[]],this.tags=[...t.tags||[]],this.formIds=(t.forms||[]).map(d),this.steps=(t.steps||[]).map((t=>new Un(t)))),e}getKey(){return this.id}}!function(t){t.created="created",t.queued="queued",t.onRoute="onRoute",t.arrived="arrived",t.completed="completed",t.cancelled="cancelled",t.pickedUp="pickedUp",t.droppedOff="droppedOff",t.waiting="waiting",t.damaged="damaged",t.unsuccessful="unsuccessful"}(Vi||(Vi={}));class Mn extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}assetId=NaN;get asset(){return Js.get(this.assetId)}set asset(t){this.assetId=t?.id||NaN}name="";references=new Map;placeId=NaN;get place(){return Vs.get(this.placeId)}set place(t){this.placeId=t?.id||NaN}address="";latlng=yi.INVALID;status=Vi.created;created=m();eta=m();duration=new Be;arrived=m();completed=m();instructions="";signature=!1;signatory="";notes="";attachmentIds=[];get attachments(){return k(Ks,this.attachmentIds)}set attachments(t){this.attachmentIds=t?.map(e)??[]}updatedBy="";updatedUtc=m();toJSON(){return{id:this.id||null,company:this.companyId||null,asset:this.assetId||null,v:[...this.v],name:this.name||"",references:N(this.references),place:this.placeId||null,address:this.address||"",latlng:this.latlng.toJSON(),status:Vi[this.status]||null,created:T(this.created),eta:T(this.eta),duration:this.duration.toString(),arrived:T(this.arrived),completed:T(this.completed),instructions:this.instructions||"",signature:!!this.signature,signatory:this.signatory||"",notes:this.notes||"",attachments:[...this.attachmentIds],updatedBy:this.updatedBy||"",updatedUtc:T(this.updatedUtc)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.assetId=d(t.asset),this.name=t.name||"",this.references=S(t.references||{}),this.placeId=d(t.place),this.address=t.address||"",this.latlng=t.latlng?yi.fromJSON(t.latlng):yi.INVALID,this.status=Vi[t.status]||Vi.created,this.created=m(t.created),this.eta=m(t.eta),this.duration=new Be(t.duration),this.arrived=m(t.arrived),this.completed=m(t.completed),this.instructions=t.instructions||"",this.signature=!!t.signature,this.signatory=t.signatory||"",this.notes=t.notes||"",this.attachmentIds=(t.attachments||[]).map(d),this.updatedBy=t.updatedBy||"",this.updatedUtc=m(t.updatedUtc)),e}getKey(){return this.id}}class An extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";src="";bytes=NaN;mime="";expiry=m();references=new Map;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,name:this.name||"",notes:this.notes||"",src:this.src||"",mime:this.mime||"",bytes:this.bytes||0,expiry:T(this.expiry),references:S(this.references)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.src=t.src||"",this.mime=t.mime||"",this.bytes=d(t.bytes)||0,this.expiry=m(t.expiry),this.references=S(t.references||{})),e}getKey(){return this.id}}!function(t){t.text="text",t.choice="choice",t.dropdown="dropdown",t.checkbox="checkbox",t.toggle="toggle",t.numeric="numeric",t.range="range",t.distance="distance",t.area="area",t.temperature="temperature",t.weight="weight",t.volume="volume",t.pressure="pressure",t.speed="speed",t.fuelEconomy="fuelEconomy",t.currency="currency",t.datetime="datetime",t.date="date",t.time="time",t.duration="duration",t.signature="signature",t.pictures="pictures",t.files="files",t.timezone="timezone"}(Fi||(Fi={}));class Dn{static fromJSON;get supported(){throw new Error("getter not implemented.")}kind;id;name;notes;required;value;editable;constructor(t,s,e,i,n,r,h){if(this.id=d(t),this.kind=Fi[e],this.name=s||"",this.notes=i||"",this.required=!!n,this.value=r??null,this.editable=!!h,!this.supported.includes(this.kind))throw new Error(`kind "${this.kind||""}" is not supported by this field type.`)}toJSON(){return{id:this.id||null,kind:this.kind,name:this.name||"",notes:this.notes||"",required:!!this.required,value:this.value??null,editable:!!this.editable}}}class Pn extends Dn{static split(t){return t?.split(",").map((t=>t.trim()))??[]}get supported(){return[Fi.pictures,Fi.files]}minimum;maximum;constructor(t,s,e,i,n,r,h,a,o){super(t,s,e,r,h,a,o),this.minimum=d(i),this.maximum=d(n)}toJSON(){return{...super.toJSON(),minimum:b(this.minimum),maximum:b(this.maximum)}}isValid(t){const s=Pn.split(t);return s.length>0&&(!u(this.minimum)||this.minimum<=s.length)&&(!u(this.maximum)||this.maximum>=s.length)&&s.every((function(t){return u(d(t))}))}}class En extends Dn{static DEFAULT_CHOICES=["true","false",""];static normalize(t){return[...t??[],null,null,null].slice(0,3).map(((t,s)=>t?.trim()??En.DEFAULT_CHOICES[s]))}get supported(){return[Fi.checkbox,Fi.toggle]}choices;constructor(t,s,e,i,n,r,h,a){super(t,s,e,n,r,h,a),this.choices=En.normalize(i)}toJSON(){return{...super.toJSON(),choices:[...this.choices]}}isValid(t){return En.normalize(this.choices).slice(0,this.required?2:3).includes(String(t??"").trim())}}const zn=/(?<!\\),/;class Kn extends Dn{static split(t){return t?.split(zn).map(Kn.unescape)??[]}static escape(t){return t?.trim()?.replaceAll(",","\\,")}static unescape(t){return t?.trim().replaceAll("\\,",",")}get supported(){return[Fi.choice,Fi.dropdown]}choices;minimum;maximum;constructor(t,s,e,i,n,r,h,a,o,u){super(t,s,e,h,a,o,u),this.choices=i??new Map,this.minimum=d(n),this.maximum=d(r)}toJSON(){return{...super.toJSON(),choices:N(this.choices),minimum:b(this.minimum),maximum:b(this.maximum)}}isValid(t){const s=Kn.split(t);return s.length>0&&(!u(this.minimum)||this.minimum<=s.length)&&(!u(this.maximum)||this.maximum>=s.length)&&s.filter((t=>this.choices.has(t))).length==s.length}}class Rn extends Dn{get supported(){return[Fi.date,Fi.datetime]}minimum;maximum;constructor(t,s,e,i,n,r,h,a,o){super(t,s,e,r,h,a,o),this.minimum=m(i),this.maximum=m(n)}toJSON(){return{...super.toJSON(),minimum:T(this.minimum),maximum:T(this.maximum)}}isValid(t){let s=m(t),e=u(s.valueOf()),i=m(this.minimum),n=m(this.maximum);return e&&this.kind==Fi.date&&(s=new Date(s.getFullYear(),s.getMonth(),s.getDate()),i=new Date(i.getFullYear(),i.getMonth(),i.getDate()),n=new Date(n.getFullYear(),n.getMonth(),n.getDate())),e&&(!u(i.valueOf())||i<=s)&&(!u(n.valueOf())||n>=s)}}var Bn,Ln,jn,Hn;!function(t){t.small="small",t.medium="medium",t.large="large"}(Bn||(Bn={}));class qn extends Dn{get supported(){return[Fi.numeric,Fi.range,Fi.distance,Fi.area,Fi.temperature,Fi.weight,Fi.volume,Fi.pressure,Fi.speed,Fi.fuelEconomy,Fi.currency]}size;precision;step;units;minimum;maximum;constructor(t,s,e,i,n,r,h,a,o,u,c,l,m){super(t,s,e,u,c,l,m),this.size=Bn[i]??Bn.medium,this.precision=d(n),this.step=Wt(r),this.units=h||"",this.minimum=Wt(a),this.maximum=Wt(o)}toJSON(){return{...super.toJSON(),size:Bn[this.size]??Bn.medium,precision:b(this.precision),step:b(this.step),units:this.units||"",minimum:b(this.minimum),maximum:b(this.maximum)}}isValid(t){let s=this.minimum,e=this.maximum,i=Wt(t),n=u(i);return n&&(i=c(i,this.precision),u(s)&&(s=c(s,this.precision)),u(e)&&(e=c(e,this.precision))),n&&(!u(s)||s<=i)&&(!u(e)||e>=i)}}class Gn extends Dn{get supported(){return[Fi.signature]}constructor(t,s,e,i,n,r){super(t,s,Fi.signature,e,i,n,r)}isValid(t){return!!String(t??"").trim()}}class Vn extends Dn{get supported(){return[Fi.text]}rows;minimum;maximum;constructor(t,s,e,i,n,r,h,a,o){super(t,s,Fi.text,r,h,a,o),this.rows=d(e),this.minimum=Wt(i),this.maximum=Wt(n)}toJSON(){return{...super.toJSON(),rows:b(this.rows),minimum:b(this.minimum),maximum:b(this.maximum)}}isValid(t){return!!(t=String(t??"").trim())&&(!u(this.minimum)||this.minimum<=t.length)&&(!u(this.maximum)||this.maximum>=t.length)}}class Fn extends Dn{static MINIMUM_TIME_OF_DAY=Be.fromDays(0);static MAXIMUM_TIME_OF_DAY=Be.fromDays(1);get supported(){return[Fi.time,Fi.duration]}minimum;maximum;constructor(t,s,e,i,n,r,h,a,o){super(t,s,e,r,h,a,o),this.minimum=i||u(i)?new Be(i):null,this.maximum=n||u(n)?new Be(n):null}toJSON(){return{...super.toJSON(),minimum:u(this.minimum?.valueOf())?this.minimum.toString():null,maximum:u(this.maximum?.valueOf())?this.maximum.toString():null}}isValid(t){let s=!h(t),e=new Be(t),i=this.minimum,n=this.maximum;return s&&this.kind==Fi.time&&((!u(i?.valueOf())||i<Fn.MINIMUM_TIME_OF_DAY)&&(i=Fn.MINIMUM_TIME_OF_DAY),(!u(n?.valueOf())||n>Fn.MAXIMUM_TIME_OF_DAY)&&(n=Fn.MAXIMUM_TIME_OF_DAY)),s&&(!u(i?.valueOf())||i<=e)&&(!u(n?.valueOf())||n>=e)}}class Wn extends Dn{get supported(){return[Fi.timezone]}constructor(t,s,e,i,n,r){super(t,s,Fi.timezone,e,i,n,r)}isValid(t){return!(!(t=String(t??""))||!U(t))}}Dn.fromJSON=function(t){switch(t.kind){case Fi.text:return new Vn(t.id,t.name,t.rows,t.minimum,t.maximum,t.notes,t.required,t.value,t.editable);case Fi.choice:case Fi.dropdown:return new Kn(t.id,t.name,t.kind,S(t.choices),t.minimum,t.maximum,t.notes,t.required,t.value,t.editable);case Fi.checkbox:case Fi.toggle:return new En(t.id,t.name,t.kind,t.choices,t.notes,t.required,t.value,t.editable);case Fi.area:case Fi.numeric:case Fi.range:case Fi.distance:case Fi.temperature:case Fi.weight:case Fi.volume:case Fi.pressure:case Fi.speed:case Fi.fuelEconomy:case Fi.currency:return new qn(t.id,t.name,t.kind,t.size,t.precision,t.step,t.units,t.minimum,t.maximum,t.notes,t.required,t.value,t.editable);case Fi.datetime:case Fi.date:return new Rn(t.id,t.name,t.kind,t.minimum,t.maximum,t.notes,t.required,t.value,t.editable);case Fi.duration:case Fi.time:return new Fn(t.id,t.name,t.kind,t.minimum,t.maximum,t.notes,t.required,t.value,t.editable);case Fi.signature:return new Gn(t.id,t.name,t.notes,t.required,t.value,t.editable);case Fi.pictures:case Fi.files:return new Pn(t.id,t.name,t.kind,t.minimum,t.maximum,t.notes,t.required,t.value,t.editable);case Fi.timezone:return new Wn(t.id,t.name,t.notes,t.required,t.value,t.editable);default:throw new Error("kind unsupported")}};class _n extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}templateId=NaN;get template(){return Rs.get(this.templateId)}set template(t){this.templateId=t?.id??NaN}assetId=NaN;get asset(){return Js.get(this.assetId)}name="";notes="";labels=[];fields=new Map;completed=m();latlng=null;driver="";getKey(){return this.id}toJSON(){return{id:this.id,company:this.companyId,v:[...this.v],template:this.templateId||null,asset:this.assetId||null,name:this.name||"",notes:this.notes||"",labels:[...this.labels],fields:N(this.fields),completed:T(this.completed),latlng:this.latlng?.toJSON()??null,driver:this.driver||null}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id=d(t.id),this.companyId=d(t.company),this.templateId=d(t.template),this.assetId=d(t.asset),this.name=t.name||"",this.notes=t.notes||"",this.labels=[...t.labels||[]],this.fields=function(t,s=!1){return y(t,((t,e)=>[d(t),s?r(e):e]))}(t.fields||{}),this.completed=m(t.completed),this.latlng=t.latlng?yi.fromJSON(t.latlng):null,this.driver=t.driver||""),e}}class Yn extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";labels=[];fill="";stroke="";graphic="";fields=[];getKey(){return this.id}toJSON(){return{id:b(this.id),company:b(this.companyId),v:[...this.v],name:this.name||"",notes:this.notes||"",labels:[...this.labels],fields:this.fields.map(i),fill:this.fill||"",stroke:this.stroke||"",graphic:this.graphic||""}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.companyId),this.name=t.name||"",this.notes=t.notes||"",this.labels=[...t.labels||[]],this.fields=(t.fields||[]).map(Dn.fromJSON),this.fill=t.fill||"",this.stroke=t.stroke||"",this.graphic=t.graphic||""),e}}class $n{bytes;size;providerId;get provider(){return Fs.get(this.providerId)}companyId;get company(){return Ss.get(this.companyId)}assetId;get asset(){return Js.get(this.assetId)}camera;latitude;longitude;speed;heading;altitude;constructor(t){t&&this.fromJSON(t)}fromJSON(t,s){return t&&(this.bytes=d(t.bytes),this.size=t.size?pi.fromJSON(t.size):new pi(0,0),this.providerId=t.provider||"",this.companyId=d(t.company),this.assetId=d(t.asset),this.camera=d(t.camera),this.latitude=Wt(t.latitude),this.longitude=Wt(t.longitude),this.speed=Wt(t.speed),this.heading=Wt(t.heading),this.altitude=Wt(t.altitude)),!!t}toJSON(){return{bytes:b(this.bytes),size:this.size.toJSON(),provider:this.providerId||"",company:b(this.companyId),asset:b(this.assetId),camera:b(this.camera),latitude:b(this.latitude),longitude:b(this.longitude),speed:b(this.speed),heading:b(this.heading),altitude:b(this.altitude)}}}!function(t){t.unknown="unknown",t.image="image",t.video="video"}(Ln||(Ln={}));class Zn extends $n{guid;kind;fps;start;end;get duration(){return new Be(this.end-this.start)}eventName;fromJSON(t,s){const e=super.fromJSON(t,s)||!!t;return t&&(this.guid=t.guid||"",this.kind=Ln[t.kind]||Ln.unknown,this.fps=Wt(t.fps),this.start=m(t.start),this.end=m(t.end),this.eventName=t.eventName||""),e}toJSON(){return{...super.toJSON(),guid:this.guid||"",kind:Ln[this.kind]||Ln.unknown,fps:b(this.fps),start:T(this.start),end:T(this.end),eventName:this.eventName||""}}getKey(){return this.guid}}class Xn extends $n{kind=Ln.image;dts;fromJSON(t,s){const e=super.fromJSON(t,s)||!!t;return t&&(this.dts=m(t.dts)),e}toJSON(){return{...super.toJSON(),kind:Ln.image,dts:T(this.dts)}}getKey(){return(b(this.assetId)??0)+"-"+this.providerId+"-"+this.camera}}!function(t){t.fills="fills",t.shadows="shadows",t.outlines="outlines",t.markers="markers",t.labels="labels",t.drawings="drawings",t.edits="edits"}(jn||(jn={}));class Qn{static fromJSON(t){return new Qn(t.tags,t.src,t.size,t.anchor,t.layer,t.zIndex,t.rotates)}tags;src;size;anchor;layer;zIndex;rotates;constructor(t,s,e,i,n,r,h){this.tags=[...t||[]],this.src=s||"",this.size=pi.fromJSON(e),this.anchor=Ni.fromJSON(i),this.layer=jn[n]||jn.markers,this.zIndex=d(r)||0,this.rotates=!!h}toJSON(){return{tags:[...this.tags],src:this.src||"",size:this.size.toJSON(),anchor:this.anchor.toJSON(),layer:jn[this.layer]||jn.markers,zIndex:b(this.zIndex),rotates:!!this.rotates}}isEqual(t){return!!t&&this.tags.length===t.tags.length&&this.tags.every(((s,e)=>s===t.tags[e]))&&this.src===t.src&&this.size.isEqual(t.size)&&this.anchor.isEqual(t.anchor)&&this.layer===t.layer&&this.zIndex===t.zIndex&&this.rotates===t.rotates}}class tr{static fromJSON(t){return new tr(t?.anchor,t?.align,t?.colour)}anchor;align;colour;constructor(t,s,e){this.anchor=Ni.fromJSON(t),this.align=s||"right top",this.colour=e||"#cccccc"}toJSON(){return{align:this.align||"",anchor:this.anchor.toJSON(),colour:this.colour||""}}isEqual(t){return!!t&&this.align===t.align&&this.anchor.isEqual(t.anchor)&&this.colour===t.colour}}class sr extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}category="";name="";notes="";global=!1;usage=[];label=new tr;badge=new tr;glyphs=[];toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,category:this.category||"",name:this.name||"",notes:this.notes||"",global:!!this.global,usage:[...this.usage],label:this.label.toJSON(),badge:this.badge.toJSON(),glyphs:this.glyphs.map(i)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id=d(t.id),this.companyId=d(t.company),this.category=t.category||"",this.name=t.name||"",this.notes=t.notes||"",this.global=!!t.global,this.usage=t.usage?.map(J)??[],this.label=tr.fromJSON(t.label),this.badge=tr.fromJSON(t.badge),this.glyphs=t.glyphs?.map((t=>Qn.fromJSON(t)))??[]),e}getKey(){return this.id}}class er extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";src="";size=new pi(0,0);focals=[];bytes=NaN;uses=NaN;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,name:this.name||"",notes:this.notes||"",src:this.src||"",size:this.size.toJSON(),focals:this.focals.map(i),bytes:u(this.bytes)?this.bytes:null,uses:u(this.uses)?this.uses:null}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.src=t.src||"",this.size=pi.fromJSON(t.size),this.focals=(t.focals||[]).map((t=>gi.fromJSON(t))),this.bytes=d(t.bytes),this.uses=d(t.uses)),e}getKey(){return this.id}}class ir{static fromJSON(t){return new ir(t.asset,t.date,t.odometer,t.engineHours,t.lastJob)}assetId;get asset(){return Js.get(this.assetId)}date;odometer;engineHours;lastJobId;get lastJob(){return Gs.get(this.lastJobId)}constructor(t,s,e,i,n){this.assetId=d(t),this.date=m(s),this.odometer=Wt(e),this.engineHours=Wt(i),this.lastJobId=d(n)}toJSON(){return{asset:this.assetId||null,date:T(this.date),odometer:this.odometer||0,engineHours:this.engineHours||0,lastJob:this.lastJobId||null}}}!function(t){t.pending="pending",t.pastdue="pastdue",t.completed="completed",t.cancelled="cancelled"}(Hn||(Hn={}));class nr extends Vt{id=NaN;assetId=NaN;get asset(){return Js.get(this.assetId)}companyId=NaN;get company(){return Ss.get(this.companyId)}scheduleId=NaN;get schedule(){return qs.get(this.scheduleId)}set schedule(t){this.scheduleId=t?.id}name="";notes="";status=Hn.pending;created=m();completed=m();odometer=NaN;engineHours=NaN;garage="";duration=new Be;cost=NaN;reference="";technician="";pictureIds=[];get pictures(){return k(Ls,this.pictureIds)}set pictures(t){this.pictureIds=t?.map(e)??[]}toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,asset:this.assetId,schedule:this.scheduleId,name:this.name||"",notes:this.notes||"",status:this.status,created:T(this.created),completed:T(this.completed),odometer:this.odometer,engineHours:this.engineHours,garage:this.garage,cost:this.cost,duration:this.duration.toString(),reference:this.reference,technician:this.technician,pictures:[...this.pictureIds]}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.assetId=d(t.asset),this.scheduleId=d(t.schedule),this.name=t.name||"",this.notes=t.notes||"",this.status=Hn[t.status]||Hn.pending,this.created=m(t.created),this.completed=m(t.completed),this.odometer=Wt(t.odometer),this.engineHours=Wt(t.engineHours),this.garage=t.garage||"",this.cost=Wt(t.cost),this.duration=new Be(t.duration),this.reference=t.reference||"",this.technician=t.technician||"",this.pictureIds=(t.pictures||[]).map(d)),e}getKey(){return this.id}}class rr extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";targets=null;notify=[];fill="";stroke="";graphic="";predictionDays=14;recurDays=NaN;recurDistance=NaN;recurEngineHours=NaN;intervals=new Map;garage="";duration=new Be;cost=NaN;reference="";toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,name:this.name||"",notes:this.notes||"",notify:[...this.notify],targets:ki.stringify(this.targets),fill:this.fill||"",stroke:this.stroke||"",graphic:this.graphic||"",garage:this.garage||"",cost:this.cost||0,duration:this.duration.toString(),reference:this.reference||"",predictionDays:this.predictionDays||14,recurDays:this.recurDays||null,recurDistance:this.recurDistance||null,recurEngineHours:this.recurEngineHours||null,intervals:N(this.intervals)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.notify=t.notify||[],this.targets=ki.parse(t.targets),this.fill=t.fill||"",this.stroke=t.stroke||"",this.graphic=t.graphic||"",this.garage=t.garage||"",this.cost=Wt(t.cost),this.duration=new Be(t.duration),this.reference=t.reference||"",this.predictionDays=d(t.predictionDays)||14,this.recurDays=d(t.recurDays),this.recurDistance=Wt(t.recurDistance),this.recurEngineHours=Wt(t.recurEngineHours),this.intervals=y(t.intervals||{},((t,s)=>[d(t),ir.fromJSON(s)]))),e}getKey(){return this.id}}var hr,ar,or,ur,cr,lr,dr,mr,pr,gr,fr,Nr,wr,yr;!function(t){t.low="low",t.normal="normal",t.high="high"}(hr||(hr={})),function(t){t.created="created",t.processed="processed",t.failed="failed",t.throttled="throttled",t.bounceback="bounceback",t.acknowledged="acknowledged"}(ar||(ar={})),function(t){t.unknown="unknown",t.sms="sms",t.email="email",t.pnd="pnd",t.gcm="gcm",t.apn="apn",t.socket="socket"}(or||(or={}));class Sr extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}status=ar.created;kind=or.unknown;to="";from="";body="";processed=m();delivered=m();subject="";assetId=NaN;get asset(){return Js.get(this.assetId)}userLogin="";get user(){return bs.get(this.userLogin)}toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,status:ar[this.status]||ar.created,kind:or[this.kind]||or.unknown,to:this.to||"",from:this.from||"",body:this.body||"",processed:T(this.processed),delivered:T(this.delivered),subject:this.subject||"",asset:this.assetId,user:this.userLogin||""}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.status=ar[t.status]||ar.created,this.kind=or[t.kind]||or.unknown,this.to=t.to||"",this.from=t.from||"",this.body=t.body||"",this.processed=m(t.processed),this.delivered=m(t.delivered),this.subject=t.subject||"",this.assetId=d(t.asset),this.userLogin=t.userLogin||""),e}getKey(){return this.id}}class vr extends Sr{priority=hr.normal;toJSON(){return{...super.toJSON(),priority:hr[this.priority]||hr.normal}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return super.fromJSON(t,e),e&&(this.priority=hr[t.folder]||hr.normal),e}}!function(t){t.inbox="inbox",t.archive="archive"}(ur||(ur={}));class Tr extends Sr{folder=ur.archive;incoming=!1;readBy="";toJSON(){return{...super.toJSON(),folder:ur[this.folder]||ur.archive,incoming:!!this.incoming,readBy:this.readBy||""}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return super.fromJSON(t,e),e&&(this.folder=ur[t.folder]||ur.archive,this.incoming=!!t.incoming,this.readBy=t.readBy||""),e}}!function(t){t.point="point",t.radial="radial",t.polygon="polygon",t.rectangle="rectangle"}(cr||(cr={}));class br extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}kind=cr.point;name="";address="";iconId=NaN;get icon(){return js.get(this.iconId)}set icon(t){this.iconId=t?.id??NaN}notes="";labels=[];colour="";pictureIds=[];get pictures(){return k(Ls,this.pictureIds)}set pictures(t){this.pictureIds=t?.map(e)??[]}reference="";anchor=null;radius=NaN;points=null;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,icon:this.iconId,name:this.name||"",notes:this.notes||"",address:this.address||"",kind:cr[this.kind]||cr.point,labels:[...this.labels],colour:this.colour||"",pictures:[...this.pictureIds],reference:this.reference||"",anchor:this.anchor?.toJSON()??null,radius:this.radius||null,shape:this.points?.length>0?yt(this.points||[]):null}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.iconId=d(t.icon),this.name=t.name||"",this.notes=t.notes||"",this.address=t.address||"",this.kind=cr[t.kind]||cr.point,this.labels=(t.labels||[]).map(J),this.colour=t.colour||"",this.pictureIds=(t.pictures||[]).map(d),this.reference=t.reference||"",this.anchor=t.anchor?yi.fromJSON(t.anchor):null,this.radius=Wt(t.radius),this.points=("string"==typeof t.shape?St(t.shape,6):t.shape?t.shape:null)?.map(yi.fromJSON)??null),e}getKey(){return this.id}}class Or extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}scriptId=NaN;get script(){return Ws.get(this.scriptId)}set script(t){this.scriptId=t?.id??NaN}name="";notes="";parameters=new Map;geofences=null;toJSON(){return{id:b(this.id),v:[...this.v],company:b(this.companyId),script:b(this.scriptId),name:this.name||"",notes:this.notes||"",parameters:N(this.parameters),geofences:ki.stringify(this.geofences)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.scriptId=d(t.script),this.name=t.name||"",this.notes=t.notes||"",this.parameters=S(t.parameters||{}),this.geofences=ki.parse(t.geofences)),e}getKey(){return this.id}}class Cr extends Gt{code="";companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";password="";userLogin="";get user(){return bs.get(this.userLogin)}configId=NaN;get config(){return _s.get(this.configId)??$s.get(this.configId)}kind=Ki.unknown;since=m();completed=m();expires=m();identifier="";assetId=NaN;get asset(){return Js.get(this.assetId)}phoneNumber=NaN;toJSON(){return{code:this.code||null,company:this.companyId||null,name:this.name||"",notes:this.notes||"",password:this.password||"",user:this.userLogin||"",config:this.configId||null,kind:Ki[this.kind]||Ki.unknown,since:T(this.since),completed:T(this.completed),expires:T(this.expires),identifier:this.identifier||"",asset:this.assetId||null,phoneNumber:this.phoneNumber||null}}fromJSON(t,s){return u(d(this.code))||(this.code=t.code),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.password=t.password||"",this.userLogin=t.userLogin||"",this.configId=d(t.config),this.kind=Ki[t.kind]||Ki.unknown,this.since=m(t.password),this.completed=m(t.completed),this.expires=m(t.expires),this.identifier=t.identifier||"",this.assetId=d(t.asset),this.phoneNumber=g(t.phoneNumber),!0}getKey(){return this.code}}class Jr{static fromJSON(t){return new Jr(t.content,t.replace,t.condition,t.validate)}content;replace;condition;validate;constructor(t,s,e,i){this.content=t||"",this.replace=s||"",this.condition=e||"",this.validate=i||""}toJSON(){return{content:this.content||"",replace:this.replace||"",condition:this.condition||"",validate:this.validate||""}}}!function(t){t.boolean="boolean",t.number="number",t.text="text"}(lr||(lr={}));class kr{static fromJSON(t){return new kr(t.kind,t.value,t.notes,t.context,t.order,t.advanced)}kind;value;notes;context;order;advanced;constructor(t,s,e,i,n,r){this.kind=lr[t]||lr.text,this.value=s||"",this.notes=e||"",this.context=i||"",this.order=d(n),this.advanced=!!r}toJSON(){return{kind:lr[this.kind]||lr.text,value:this.value||"",notes:this.notes||"",context:this.context||"",order:d(this.order)||0,advanced:!!this.advanced}}}class xr extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";fill="";stroke="";graphic="";global=!1;kind=Ki.unknown;blocks=[];parameters=new Map;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,name:this.name||"",notes:this.notes||"",fill:this.fill||"",stroke:this.stroke||"",graphic:this.graphic||"",global:!!this.global,kind:Ki[this.kind]||Ki.unknown,blocks:this.blocks.map(i),parameters:N(this.parameters)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.fill=t.fill||"",this.stroke=t.stroke||"",this.graphic=t.graphic||"",this.global=!!t.global,this.kind=Ki[t.kind]||Ki.unknown,this.blocks=t.blocks?.map(Jr.fromJSON)??[],this.parameters=y(t.parameters||{},((t,s)=>[t,kr.fromJSON(s)]))),e}getKey(){return this.id}}class Ur extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";typeId=NaN;get type(){return Ys.get(this.typeId)}scriptParameters=new Map;geofences=[];toJSON(){return{id:this.id,company:this.companyId,v:[...this.v],name:this.name||"",notes:this.notes||"",type:this.typeId||null,scriptParameters:N(this.scriptParameters),geofences:this.geofences||""}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.typeId=d(t.type),this.scriptParameters=S(t.scriptParameters||{}),this.geofences=t.geofences||[]),e}getKey(){return this.id}}class Ir{static nodesFromJSON(t){const s=new Map;return Yt(t).forEach((e=>s.set(e,Ir.fromJSON(t[e]||{})))),s}static fromJSON(t){return new Ir(t.id,t.notes,t.isAdvanced,t.type,t.min,t.max,t.value,t.unit,Ir.nodesFromJSON(t.nodes))}isAdvanced;id;value;min;max;type;unit;notes;nodes;constructor(t,s,e,i,n,r,h,a,o){this.id=t||"",this.notes=s||"",this.isAdvanced=!!e,this.type=i||"",this.min=n,this.max=r,this.value=h,this.unit=a||"",this.nodes=o||new Map}toJSON(){return{id:this.id||"",value:this.value,min:this.min,max:this.max,type:this.type||"",unit:this.unit||"",notes:this.notes||"",isAdvanced:!!this.isAdvanced,nodes:N(this.nodes)}}}class Mr extends Vt{id=NaN;name="";notes="";providerType=Ki.unknown;maxGeofenceCount=NaN;minGeofenceCount=NaN;scriptOptions=new Map;geofenceTypes=[];toJSON(){return{id:this.id,v:[...this.v],name:this.name||"",notes:this.notes||"",providerType:Ki[this.providerType]||Ki.unknown,maxGeofenceCount:b(this.maxGeofenceCount),minGeofenceCount:b(this.minGeofenceCount),scriptOptions:N(this.scriptOptions),geofenceTypes:this.geofenceTypes.map((t=>cr[t]||null))}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.name=t.name||"",this.notes=t.notes||"",this.providerType=Ki[t.providerType]||Ki.unknown,this.maxGeofenceCount=d(t.maxGeofenceCount),this.minGeofenceCount=d(t.minGeofenceCount),this.scriptOptions=Ir.nodesFromJSON(t.scriptOptions),this.geofenceTypes=t.geofenceTypes?.map((t=>cr[t]))??[]),e}getKey(){return this.id}}class Ar{static fromJSON;maxGeofenceCount;constructor(t){this.maxGeofenceCount=d(t)||0}toJSON(){return{type:cr[this.type]||null,maxGeofenceCount:this.maxGeofenceCount||0}}}class Dr extends Ar{get type(){return cr.radial}minRadius;maxRadius;constructor(t,s,e){super(t),this.minRadius=Wt(s),this.maxRadius=Wt(e)}toJSON(){return{...super.toJSON(),minRadius:b(this.minRadius),maxRadius:b(this.maxRadius)}}}class Pr extends Ar{get type(){return cr.point}}class Er extends Ar{get type(){return cr.polygon}maxVertices;constructor(t,s){super(t),this.maxVertices=d(s)}toJSON(){return{...super.toJSON(),maxVertices:b(this.maxVertices)}}}class zr extends Ar{get type(){return cr.rectangle}maxLength;maxWidth;constructor(t,s,e){super(t),this.maxLength=d(s),this.maxWidth=d(e)}toJSON(){return{...super.toJSON(),maxLength:b(this.maxLength),maxWidth:b(this.maxWidth)}}}Ar.fromJSON=function(t){switch(cr[t.type]){case cr.point:return new Pr(t.maxGeofenceCount);case cr.radial:return new Dr(t.maxGeofenceCount,t.minRadius,t.maxRadius);case cr.rectangle:return new zr(t.maxGeofenceCount,t.maxLength,t.maxWidth);case cr.polygon:return new Er(t.maxGeofenceCount,t.maxVertices);default:throw new Error("Unsopported type:"+t.type)}};class Kr{static fromJSON(t){return new Kr(t.value,t.dts,t.unit)}value=null;dts=m();unit="";constructor(t,s,e){this.value=h(t)?null:t,this.dts=m(s),this.unit=e||""}toJSON(){return{value:h(this.value)?null:this.value,dts:T(this.dts),unit:this.unit||""}}}class Rr extends Vt{id="";companyId=NaN;get company(){return Ss.get(this.companyId)}set company(t){this.companyId=t?.id??NaN}lastIP="";attributes=new Map;snf=new Map;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,lastIP:this.lastIP||"",attributes:w(this.attributes,((t,s)=>[t,N(s)])),snf:N(this.snf)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id=t.id||"",this.companyId=d(t.company),this.lastIP=t.lastIP||"",this.attributes=y(t.attributes||{},((t,s)=>[t,y(s||{},((t,s)=>[t,Kr.fromJSON(s)]))])),this.snf=S(t.snf||{})),e}getKey(){return this.id}}!function(t){t.created="created",t.pending="pending",t.inProgress="inProgress",t.completed="completed",t.failed="failed",t.cancelled="cancelled"}(dr||(dr={}));class Br{static fromJSON(t){return new Br(t.status,t.parameters,t.created,t.processed)}status=dr.created;parameters=[];created=m();processed=m();constructor(t,s,e,i){this.status=dr[t]||dr.created,this.parameters=[...s||[]],this.created=m(e),this.processed=m(i)}toJSON(){return{status:dr[this.status]||dr.created,parameters:[...this.parameters||[]],created:T(this.created),processed:T(this.processed)}}}!function(t){t.unknown="unknown",t.config="config",t.geofence="geofence",t.dispatch="dispatch",t.gps="gps",t.status="status",t.output="output",t.custom="custom"}(mr||(mr={}));class Lr extends Vt{id="";companyId=NaN;get company(){return Ss.get(this.companyId)}set company(t){this.companyId=t?.id??NaN}commands=new Map;toJSON(){return{id:this.id||null,v:[...this.v],company:b(this.companyId),commands:N(this.commands)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id||(this.id=t.id||""),this.companyId=d(t.company),this.commands=y(t.commands||{},((t,s)=>[mr[t],Br.fromJSON(s)]))),e}getKey(){return this.id}}class jr extends Vt{id="";companyId=NaN;get company(){return Ss.get(this.companyId)}set company(t){this.companyId=t?.id??NaN}name="";notes="";kind=Ki.unknown;assetId=NaN;get asset(){return Js.get(this.assetId)}set asset(t){this.assetId=t?.id??NaN}configurationId=NaN;get configuration(){return _s.get(this.configurationId)??$s.get(this.configurationId)}set configuration(t){this.configurationId=t?.id||NaN}password="";firmware="";phoneNumber=NaN;information=new Map;sim="";toJSON(){return{id:this.id||null,v:[...this.v],company:b(this.companyId),name:this.name||"",notes:this.notes||"",kind:Ki[this.kind]||Ki.unknown,configuration:b(this.configurationId),...this.suspended?{suspended:!0,since:T(this.since)}:{asset:b(this.assetId),password:this.password||"",firmware:this.firmware||"",phoneNumber:b(this.phoneNumber),information:N(this.information),sim:this.sim||""}}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id||(this.id=t.id||""),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.kind=Ki[t.kind]||Ki.unknown,this.assetId=d(t.asset),this.configurationId=d(t.configuration),this.password=t.password||"",this.firmware=t.firmware||"",this.phoneNumber=g(t.phoneNumber),this.information=S(t.information||{}),this.sim=t.sim||"",this.suspended=!!t.suspended,this.since=m(t.since)),e}getKey(){return this.id}suspended=!1;since=m()}class Hr extends Ue{get pieces(){return[this.#s,this.#e,this.#u]}get id(){return this.#s.id??this.#e.id??this.#u.id}get companyId(){return this.#s.companyId??this.#e.companyId??this.#u.companyId}get company(){return this.#s.company??this.#e.company??this.#u.company}set company(t){this.general.company=t,this.advanced.company=t,this.control.company=t}get kind(){return this.#s.kind}#s=new jr;get general(){return this.#s}get name(){return this.#s.name}set name(t){this.#s.name=t}get notes(){return this.#s.notes}set notes(t){this.#s.notes=t}get assetId(){return this.#s.assetId}set assetId(t){this.#s.assetId=t}get asset(){return this.#s.asset}set asset(t){this.#s.asset=t}get configurationId(){return this.#s.configurationId}set configurationId(t){this.#s.configurationId=t}get configuration(){return this.#s.configuration}set configuration(t){this.#s.configuration=t}get password(){return this.#s.password}set password(t){this.#s.password=t}get firmware(){return this.#s.firmware}set firmware(t){this.#s.firmware=t}get phoneNumber(){return this.#s.phoneNumber}set phoneNumber(t){this.#s.phoneNumber=t??NaN}get information(){return this.#s.information}set information(t){this.#s.information=t}get sim(){return this.#s.sim}set sim(t){this.#s.sim=t}#e=new Rr;get advanced(){return this.#e}get lastIP(){return this.#e.lastIP}set lastIP(t){this.#e.lastIP=t}get attributes(){return this.#e.attributes}set attributes(t){this.#e.attributes=t}get snf(){return this.#e.snf}set snf(t){this.#e.snf=t}#u=new Lr;get control(){return this.#u}get commands(){return this.#u.commands}set commands(t){this.#u.commands=t}toJSON(){return this.suspended?this.#s.toJSON():{...this.#s.toJSON(),...this.#e.toJSON(),control:this.#u.toJSON(),v:[...this.v]}}fromJSON(t,s){const e=t?.v??[],i=this.#s.fromJSON({...t,v:e.slice(0,1)},s),n=this.#e.fromJSON({...t,v:e.slice(1,2)},s),r=this.#u.fromJSON({...t.control,v:e.slice(2,3)},s);return i||n||r}getKey(){return this.id}get suspended(){return this.#s.suspended}get since(){return this.#s.since}}class qr{static fromJSON;assetId;get asset(){return Js.get(this.assetId)}instance;summaryInstances;general;advanced;constructor(t,s,e,i,n){this.assetId=d(t),this.instance=d(s),this.summaryInstances=e?.map(d)??[],this.general=i||null,this.advanced=n||null}toJSON(){return{asset:b(this.assetId),instance:b(this.instance),summaryInstances:[...this.summaryInstances||[]],general:this.general?.toJSON()??null,advanced:this.advanced?.toJSON()??null}}}class Gr extends qr{job;constructor(t,s,e,i,n,r){super(s,e,i,n,r),this.job=t}toJSON(){return{...super.toJSON(),job:this.job.toJSON()}}}class Vr extends qr{message;constructor(t,s,e,i,n,r){super(s,e,i,n,r),this.message=t}toJSON(){return{...super.toJSON(),message:this.message.toJSON()}}}class Fr extends qr{task;constructor(t,s,e,i,n,r){super(s,e,i,n,r),this.task=t}toJSON(){return{...super.toJSON(),task:this.task.toJSON()}}}qr.fromJSON=function(t){return"object"==typeof t.job?new Gr(new In(t.job),t.asset,t.instance,t.summaryInstances?.map(d),t.general?new Zi(t.general):null,t.advanced?new _i(t.advanced):null):"object"==typeof t.message?new Vr(new Tr(t.message),t.asset,t.instance,t.summaryInstances?.map(d),t.general?new Zi(t.general):null,t.advanced?new _i(t.advanced):null):"object"==typeof t.task?new Fr(new Mn(t.task),t.asset,t.instance,t.summaryInstances?.map(d),t.general?new Zi(t.general):null,t.advanced?new _i(t.advanced):null):new qr(t.asset,t.instance,t.summaryInstances?.map(d),t.general?new Zi(t.general):null,t.advanced?new _i(t.advanced):null)},function(t){t.none="none",t.inclusive="inclusive",t.exclusive="exclusive"}(pr||(pr={}));class Wr{static fromJSON(t){return new Wr(t.users,ki.parse(t.assets))}users;assets;constructor(t,s){this.users=[...t||[]],this.assets=s||null}toJSON(){return{users:[...this.users||[]],assets:ki.stringify(this.assets)}}}!function(t){t.startDate="startDate",t.endDate="endDate",t.timeOfDay="timeOfDay",t.tags="tags",t.duration="duration",t.prolonged="prolonged",t.distance="distance",t.rubicon="rubicon",t.collate="collate",t.attributes="attributes"}(gr||(gr={}));class _r{static fromJSON(t){return new _r(t.kind,t.value)}kind;value;constructor(t,s){this.kind=gr[t],this.value=s||""}toJSON(){return{kind:gr[this.kind]||"",value:this.value||""}}}class Yr{static fromJSON(t){return new Yr(t.condition,t.duration,t.points)}condition;duration;points;constructor(t,s,e){this.condition=t||"",this.duration=new Be(s),this.points=Wt(e)}toJSON(){return{condition:this.condition||"",duration:this.duration.toString(),points:b(this.points)}}}class $r{static fromJSON(t){return new $r(t.baseScore,t.parameters?.map(Yr.fromJSON))}baseScore;parameters;constructor(t,s){this.baseScore=Wt(t),this.parameters=s??[]}toJSON(){return{baseScore:b(this.baseScore),parameters:this.parameters.map(i)}}}class Zr{static fromJSON(t){return new Zr(t.parameters?.map(_r.fromJSON),ki.parse(t.targets),t.filtering,ki.parse(t.places),t.regions,t.scorecardRules?$r.fromJSON(t.scorecardRules):null)}parameters;targets;filtering;places;regions;scorecardRules;constructor(t,s,e,i,n,r){this.parameters=t??[],this.targets=s||null,this.filtering=pr[e]||pr.none,this.places=i||null,this.regions=n??[],this.scorecardRules=r||null}toJSON(){return{parameters:this.parameters.map(i),targets:ki.stringify(this.targets),filtering:pr[this.filtering]||pr.none,places:ki.stringify(this.places),regions:[...this.regions],scorecardRules:this.scorecardRules?.toJSON()??null}}}!function(t){t.once="once",t.daily="daily",t.weekly="weekly",t.monthly="monthly",t.quarterly="quarterly",t.annually="annually"}(fr||(fr={}));class Xr{static fromJSON(t){return new Xr(t.kind,t.weekdays,t.weekday,t.start,t.end,t.iterations,t.lastResult,t.nextStartDate,t.nextEndDate,t.lastStartDate,t.lastEndDate)}kind;weekdays;weekday;start;end;#c;get iterations(){return this.#c}#l;get lastResult(){return this.#l}#d;get nextStartDate(){return this.#d}#m;get nextEndDate(){return this.#m}#p;get lastStartDate(){return this.#p}#g;get lastEndDate(){return this.#g}constructor(t,s,e,i,n,r,h,a,o,u,c){this.kind=fr[t]||fr.once,this.weekdays=O(s||fs),this.weekday=d(e),this.start=m(i),this.end=m(n),this.#c=d(r),this.#l=d(h),this.#d=m(a),this.#m=m(o),this.#p=m(u),this.#g=m(c)}toJSON(){return{kind:fr[this.kind]||fr.once,weekdays:C(this.weekdays),weekday:b(this.weekday),start:T(this.start),end:T(this.end),iterations:b(this.iterations),lastResult:b(this.lastResult),nextStartDate:T(this.nextStartDate),nextEndDate:T(this.nextEndDate),lastStartDate:T(this.lastStartDate),lastEndDate:T(this.lastEndDate)}}}class Qr{static fromJSON(t){return new Qr(t.asset,t.score,y(t.rulePoints||{},((t,s)=>[t,Wt(s)])))}assetId;get asset(){return Js.get(this.assetId)}score;rulePoints;constructor(t,s,e){this.assetId=d(t),this.score=Wt(s),this.rulePoints=e??new Map}toJSON(){return{asset:this.assetId||null,score:this.score||0,rulePoints:N(this.rulePoints)||{}}}}!function(t){t.created="created",t.queued="queued",t.running="running",t.saving="saving",t.completed="completed",t.failed="failed"}(Nr||(Nr={}));class th{static fromJSON(t){return new th(t.asset,t.stateDetail,t.summaryCount,t.duration,t.distance)}assetId;get asset(){return Js.get(this.assetId)}stateDetail;summaryCount;duration;distance;constructor(t,s,e,i,n){this.assetId=d(t),this.stateDetail=s||"",this.summaryCount=d(e),this.duration=new Be(i),this.distance=Wt(n)}toJSON(){return{asset:b(this.assetId),stateDetail:this.stateDetail||"",summaryCount:b(this.summaryCount),duration:this.duration.toString(),distance:b(this.distance)}}}!function(t){t.full="full",t.tags="tags",t.places="places",t.messages="messages",t.tasks="tasks",t.attributes="attributes",t.regions="regions",t.jobs="jobs",t.positions="positions"}(wr||(wr={}));class sh extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}kind=wr.full;name="";notes="";options=new Zr;templateId=NaN;get template(){return Xs.get(this.templateId)}scheduleId=NaN;get schedule(){return Qs.get(this.scheduleId)}archive=!1;timezone=oe.utc;runBy="";created=m();completed=m();status=Nr.created;progress=NaN;bounds=null;targeted=[];filtered=[];totals=[];scorecards=[];error="";toJSON(){return{id:b(this.id),company:b(this.companyId),kind:wr[this.kind],name:this.name||"",notes:this.notes||"",options:this.options.toJSON(),template:b(this.templateId),schedule:b(this.scheduleId),archive:!!this.archive,timezone:this.timezone?.code??"",runBy:this.runBy||"",created:u(this.created.valueOf())?this.created.toISOString():null,completed:u(this.completed.valueOf())?this.completed.toISOString():null,status:Nr[this.status]||Nr.created,progress:this.progress||0,bounds:this.bounds?.toJSON()??null,targeted:this.targeted||null,filtered:this.filtered||null,totals:this.totals||null,scorecards:this.scorecards||null,error:this.error||""}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.kind=wr[t.kind],this.name=t.name||"",this.notes=t.notes||"",this.options=Zr.fromJSON(t.options),this.templateId=d(t.template),this.scheduleId=d(t.schedule),this.archive=!!t.archive,this.timezone=U(t.timezone)||oe.utc,this.runBy=t.runBy||"",this.created=m(t.created),this.completed=m(t.completed),this.status=Nr[t.status]||Nr.created,this.progress=d(t.progress),this.bounds=wi.fromJSON(t.bounds),this.targeted=(t.targeted||[]).map(d),this.filtered=(t.filtered||[]).map(d),this.totals=(t.totals||[]).map(th.fromJSON),this.scorecards=(t.scorecards||[]).map(Qr.fromJSON),this.error=t.error||""),e}getKey(){return this.id}}class eh extends sh{summary=new Map;breakdown=new Map}class ih extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}templateId=NaN;get template(){return Xs.get(this.templateId)}owner="";name="";notes="";enabled=!1;repetition=null;options=null;notify=null;toJSON(){return{id:this.id||null,company:this.companyId||null,template:this.templateId||null,v:[...this.v],name:this.name||"",notes:this.notes||"",owner:this.owner||"",enabled:!!this.enabled,repetition:this.repetition?.toJSON()??null,options:this.options?.toJSON()??null,notify:this.notify?.toJSON()??null}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.templateId=d(t.template),this.name=t.name||"",this.notes=t.notes||"",this.owner=t.owner||"",this.enabled=!!t.enabled,this.repetition=t.repetition?Xr.fromJSON(t.repetition):null,this.options=t.options?Zr.fromJSON(t.options):null,this.notify=t.notify?Wr.fromJSON(t.notify):null),e}getKey(){return this.id}}!function(t){t.outsideRange="outsideRange",t.targeted="targeted",t.stateMatch="stateMatch",t.split="split",t.filterMatch="filterMatch"}(yr||(yr={}));class nh{static fromJSON(t){return new nh(t.asset,t.stateDetail,t.instance,t.instancesCount,t.startingUtc,t.startingReason,t.endingUtc,t.endingReason,t.distance,t.polyline,t.firstState?new Xi(t.firstState):null,t.lastState?new Xi(t.lastState):null)}assetId;get asset(){return Js.get(this.assetId)}stateDetail;instance;instancesCount;startingUtc;startingReason;endingUtc;endingReason;distance;get duration(){return Be.fromMilliseconds(this.endingUtc-this.startingUtc)}polyline;firstState;lastState;constructor(t,s,e,i,n,r,h,a,o,u,c,l){this.assetId=d(t),this.stateDetail=s||"",this.instance=d(e),this.instancesCount=d(i),this.startingUtc=m(n),this.startingReason=yr[r]||yr.outsideRange,this.endingUtc=m(h),this.endingReason=yr[a]||yr.outsideRange,this.distance=Wt(o),this.polyline=u?.map(yi.fromJSON)??[],this.firstState=c||null,this.lastState=l||null}toJSON(){return{asset:b(this.assetId),stateDetail:this.stateDetail||"",instance:b(this.instance),instancesCount:b(this.instancesCount),startingUtc:T(this.startingUtc),startingReason:yr[this.startingReason]||yr.outsideRange,endingUtc:T(this.endingUtc),endingReason:yr[this.endingReason]||yr.outsideRange,distance:b(this.distance),polyline:this.polyline.map(i),firstState:this.firstState?.toJSON()??null,lastState:this.lastState?.toJSON()??null}}}class rh extends Vt{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}kind=wr.full;name="";notes="";options=null;fill="";stroke="";graphic="";toJSON(){return{id:this.id||null,company:this.companyId||null,v:[...this.v],name:this.name||"",notes:this.notes||"",options:this.options?.toJSON()??null,fill:this.fill||"",stroke:this.stroke||"",graphic:this.graphic||""}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.options=t.options?Zr.fromJSON(t.options):null,this.fill=t.fill||"",this.stroke=t.stroke||"",this.graphic=t.graphic||""),e}getKey(){return this.id}}
|
|
1
|
+
function t(t){const s=[];for(let e=0,i=t.length;e<i;e++)s.indexOf(t[e])<0&&s.push(t[e]);return s}function s(t,s){const e=[];for(let i=0,n=t.length;i<n;i++){let n=!1;for(let e=0,r=s.length;e<r&&(n=t[i]===s[e],!n);e++);n||e.push(t[i])}return e}function e(t){return t.id}function i(t){return t.toJSON()}function n(t,s){return this[s]}function r(t){if(t instanceof Array)return t.map(r);if(t instanceof Date)return new Date(t);if(t instanceof Map){const s=new Map;return t.forEach(((t,e)=>s.set(e,r(t)))),s}if(t instanceof Set){const s=new Set;return t.forEach((t=>s.add(r(t)))),s}return t instanceof RegExp?new RegExp(t.source,(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")):h(t)||a(t)&&!u(t)?null:"object"==typeof t?{...t}:t}function h(t){return null==t}function a(t){return"number"==typeof t||t instanceof Number}function o(t){return"string"==typeof t||t instanceof String}function u(t){return a(t)&&!isNaN(t)&&isFinite(t)}function c(t,s){let e=as(10,s||0);return os(t*e)/e}function l(t,s){return cs(t*t+s*s)}function d(t){return Vt(t,10)}function m(t){return new Date(t instanceof Date?t.valueOf():a(t)?t:Date.parse(String(t)))}function p(t,s,e){const i=new Array(t.length);let n=[0,t.length-1];for(;n.length>0;){const r=n.shift(),h=n.shift();if(i[r]=i[h]=!0,h-r>1){let i=-1,a=0;const o=t[r],c=t[h];for(let e=r+1;e<h;e++){const n=s(o,t[e],c);if(!u(n))throw new RangeError("triangleHeight returned NaN");n>a&&(a=n,i=e)}i>-1&&a>=e&&(n.push(r,i),n.push(i,h))}}return i}function g(t){let s=d(t);if(s){const t=s>gs;t&&(s-=gs),(s<=2e9||s>=999e7)&&(s=NaN),t&&s&&(s+=gs)}return s||NaN}function f(t,s,e=0,i=10){const n=t.toString(i).split(".");return e&&1===n.length&&n.push("0"),n[0].length<s&&(n[0]="0".repeat(s-n[0].length)+n[0]),n[1]&&n[1].length<e&&(n[1]+="0".repeat(e-n[1].length)),n.join(".")}function N(t,s=!0){return w(t,((t,e)=>[t,"function"==typeof e?.toJSON?e.toJSON():s?r(e):e]))}function w(t,s){const e={};for(let[i,n]of t.entries()){const[t,r]=s(i,n);e[t]=r}return e}function y(t,s){const e=new Map;for(const[i,n]of Object.entries(t)){const[t,r]=s(i,n);e.set(t,r)}return e}function S(t,s=!1){return y(t,((t,e)=>[t,s?r(e):e]))}function v(t,s=!1){return y(t,((t,e)=>[J(t),s?r(e):e]))}function T(t){return u(t.valueOf())?t.toISOString():null}function b(t){return u(t)?t:null}function O(t){const s=[...fs];for(let e=0;e<s.length;e++){const i=t[e];s[e]="boolean"==typeof i?i:1===d(i)}return s}function C(t){let s="";for(let e=0;e<7;e++)s+=t[e]?"1":"0";return s}function J(t){if(!o(t))throw new TypeError("input value is not a string");let s=!0,e="";for(let i=0,n=(t=t.toLowerCase()).length;i<n;i++){const n=t[i],r=Ns[n],h=(r||n).charCodeAt(0),a=!r&&ws.indexOf(n)>-1,o=!a&&(h>=97&&h<=122||h>=48&&h<=57);o?e+=r||n:a||s||(e+="-"),a||(s=!o)}return s?e.slice(0,-1):e}function k(t,s){const e=[];for(let[i,n]of t.entries())s.includes(i)&&e.push(n);return e}function x(t,s){const e=[];for(let i of t.values())i.companyId===s&&e.push(i);return e}function U(t){return t=J(t),ue.find((s=>s.code===t))}function I(t,s,e){s.forEach((function(s){Te.indexOf(s.kind)<0?M(t,s.kind,s.level,e):(s.labels&&s.labels.length?s.labels:Oe).forEach((function(i){M(t,s.kind+" "+i,s.level,e)}))}))}function M(t,s,e,i){const n=t.get(s);(!n||n[0]===le.revoke||be.indexOf(e)>be.indexOf(n[1]))&&t.set(s,[le.grant,e,i])}function A(t,s,e){s.forEach((function(s){Te.indexOf(s.kind)<0?D(t,s.kind,s.level,e):(s.labels&&s.labels.length?s.labels:Oe).forEach((function(i){D(t,s.kind+" "+i,s.level,e)}))}))}function D(t,s,e,i){const n=t.get(s),r=be.indexOf(e);n&&r?(n[0]===le.grant&&r<=be.indexOf(n[1])||n[0]===le.revoke&&r<be.indexOf(n[1]))&&t.set(s,[n[0],be[r-1],i]):t.set(s,[le.revoke,e,i])}function P(t){return t.kind==this}function E(t){return t.method===le.grant&&t.companyId==this}function z(t){return t.method===le.revoke&&t.companyId==this}function K(t){return!R(t)}function R(t){return Te.indexOf(t.kind)<0}function B(t,s){return t.order>s.order?-1:t.order<s.order?1:0}function L(t,s,e,i,n){const r=[],h=[],a=new Map;return i=i??t,n||t!==i||ve.forEach((function(t){a.set(t,[le.grant,ce.read,0])})),I(a,s.filter(E,i),1),A(a,s.filter(z,i),1),I(a,e.filter(E,i),2),A(a,e.filter(z,i),2),a.forEach((function(t,s){const e=s.split(" "),n=e[0],a=e[1]||"";a?h.push(new Se(i,n,t[1],t[0],"*"===a?[]:[a],t[2])):t[0]===le.grant&&r.push(new Se(i,n,t[1],t[0],[],0))})),r.concat(h.reduce((function(t,s){if(s.labels.length){const e=t.find((function(t){return t.kind===s.kind&&t.method===s.method&&t.level===s.level&&t.order<=s.order}));e?e.labels.length&&e.labels.push(s.labels[0]):t.push(s)}else{for(let e,i=0;e=t[i];i++)e.kind===s.kind&&e.method===s.method&&be.indexOf(e.level)<=be.indexOf(s.level)&&e.order<=s.order&&t.splice(i--,1);t.push(s)}return t}),[])).sort(B).map((function(t){return new fe(t.companyId,t.kind,t.level,t.method,t.labels)}))}function j(t,s,e,i){s||(s=[]),e||(e=[]);const n=new Map;return n.set(t,L(t,s,e,t,!!i)),s.concat(e).forEach((function(r){const h=r.companyId;n.has(h)||n.set(h,L(t,s,e,h,!!i))})),n}function H(t,s,e,i,n){return L(t,s||[],e||[],u(i)?i:t,!!n)}function q(t,s,e,i){return H(t,(s||[]).filter(R),(e||[]).filter(R),i)}function G(t,s,e,i){return be.indexOf(_(t,s,e))>=be.indexOf(ce[i]||ce.read)}function _(t,s,e){if(0===t)return ce.full;if(!u(t))throw new TypeError("userCompanyId must be a number");const i=(s||[]).find(P,e);return i&&i.method===le.grant?i.level:void 0}function V(t,s,e,i){return H(t,(s||[]).filter(K),(e||[]).filter(K),i).filter(K)}function F(t,s,e,i,n,r){return be.indexOf(W(t,s,e,i,n))>=be.indexOf(ce[r]||ce.read)}function W(t,e,i,n,r){if(0===t)return ce.full;if(!u(t))throw new TypeError("userCompanyId must be a number");i||(i=[]),r&&r.length||(r=i);let h=null,a=null,o=null;return(e||[]).forEach((function(t){if(t.kind===n){const s=t.labels&&t.labels.length?t.labels:i.concat(r);if(t.method===le.grant){switch(t.level){case ce.full:o||(o=[]);case ce.update:a||(a=[]);case ce.read:h||(h=[])}s.forEach((function(s){switch(t.level){case ce.full:o.indexOf(s)<0&&o.push(s);case ce.update:a.indexOf(s)<0&&a.push(s);case ce.read:h.indexOf(s)<0&&h.push(s)}}))}else if(s.length)s.forEach((function(s){let e;switch(t.level){case ce.read:h&&(e=h.indexOf(s))>-1&&h.splice(e,1);case ce.update:a&&(e=a.indexOf(s))>-1&&a.splice(e,1);case ce.full:o&&(e=o.indexOf(s))>-1&&o.splice(e,1)}})),h&&!h.length&&(h=null),a&&!a.length&&(a=null),o&&!o.length&&(o=null);else switch(t.level){case ce.read:h&&(h=null);case ce.update:a&&(a=null);case ce.full:o&&(o=null)}}})),o&&!s(r,o).length?ce.full:a&&!s(r,a).length?ce.update:h&&function(t,s){const e=[];for(let i=0,n=t.length;i<n;i++)for(let n=0,r=s.length;n<r;n++)t[i]===s[n]&&e.push(t[i]);return e}(r,h).length||!i.length?ce.read:void 0}function Y(t,s,e,i){return G(t,s,e,i)}function $(s,e,i,n){if(!u(s))throw new TypeError("userCompanyId must be a number");const r=[];return i&&i.length&&(e||(e=[]),i.forEach((function(h){if(Te.indexOf(h.kind)>-1){n||(n=[]);const a=t(n.concat(h.labels||[]));for(let t=0,o=a.length;t<o;t++){const o=W(s,e,n,h.kind,[a[t]]),u=W(s,i,n,h.kind,[a[t]]);if(X(o,u)){r.push(new ye(ge.vertical,h.companyId,h.kind,u,[a[t]],o,[a[t]]));break}}}else{const t=e.find((function(t){return t.kind==h.kind}));X(t?.level,h.level)&&r.push(new ye(ge.vertical,h.companyId,h.kind,h.level,null,t?.level,null))}}))),r}function Z(s,e,i,n,r,h){if(0===s)return null;r=r||[],h=h||[];const a=t((e||[]).map((t=>t.companyId)));switch(a.length){case 1:break;case 0:throw new Error("Zero permissions given.");default:throw new Error("Permissions given for more than one company.")}const o=W(s,e,n,i,r),u=W(s,e,n,i,h);return X(o,u)?new ye(ge.horizontal,a[0],i,u,h.length>0?h:n||[],o,r.length>0?r:n||[]):null}function X(t,s){return be.indexOf(s)>be.indexOf(t)}function Q(t){return t*Ve}function tt(t){return t*Fe}function st(t){return t*Ye}function et(t){return t/Ve}function it(t){return t/Fe}function nt(t){return t/Ye}function rt(t){return ri/t}function ht(t){return hi/t}function at(t){return 100/(1/Ve)/t}function ot(t,s=3,e=",",i=e,n="."){if(!(s>0))throw new TypeError("size must be greater than zero.");const r=t<0?"-":"",h=Qt(t).toString().split("."),a=[],o=[];for(let t=h[0].length;t>0;t-=s)a.unshift(h[0].slice(hs(0,t-s),t));if(h.length>1)for(let t=0,e=h[1].length;t<e;t+=s)o.push(h[1].slice(t,t+s));return r+a.join(e)+(o.length?(n??"")+o.join(i):"")}function ut(t){return 0===c(is(t*ms),9)}function ct(t,s=90){return a(t)?t>s?s:t<-s?-s:t:NaN}function lt(t,s=NaN){return t=a(t)?Qt(t%=360)>180?t+(t<0?360:-360):t:NaN,u(s)&&ut(s)&&(t=0),t}function dt(t,s){const e=ct(t.lat),i=ct(s.lat),n=lt(t.lng,e),r=lt(s.lng,i);if(ut(e))return e>0?180:0;{const t=e*ms,s=i*ms,h=(r-n)*ms,a=is(s);return(es(us(h)*a,is(t)*us(s)-us(t)*a*is(h))*ds+360)%360}}function mt(t,s){const e=ct(t.lat),i=ct(s.lat),n=lt(t.lng,e),r=lt(s.lng,i),h=e*ms,a=i*ms,o=r*ms-n*ms,u=as(us((a-h)/2),2),c=as(us(o/2),2),l=u+is(h)*is(a)*c;return 2*es(cs(l),cs(1-l))*ci}function pt(t,s,e){if(mt(t,e)<mi)return mt(t,s);const i=ct(t.lat),n=ct(s.lat),r=ct(e.lat),h=lt(t.lng,i),a=lt(s.lng,n),o=lt(e.lng,r),u=i*ms,l=h*ms,d=n*ms,m=a*ms,p=r*ms,g=o*ms,f=us(u),N=is(u),w=us(l),y=is(l),S=us(d),v=is(d),T=us(m),b=is(m),O=us(p),C=is(p),J=us(g),k=is(g),x=f*O+N*C*(y*k+w*J);return ts(c((f*(C*v*k*T-C*v*J*b)+N*y*(C*S*J-O*v*T)+N*w*(O*v*b-C*S*k))/cs(1-x*x),15))*ci}function gt(t,s,e){let i=ct(t.lat),n=lt(t.lng,i);if(s>=mi){const t=s/ci,r=e*ms,h=i*ms,a=n*ms,o=ts(c(us(h)*is(t)+is(h)*us(t)*is(r),15)),u=a+es(us(r)*us(t)*is(h),is(t)-us(h)*us(o));i=o*ds,n=u*ds}if(!u(i)||!u(n))throw new Error("Either latitude or longitude is NaN");return{lat:i,lng:n}}function ft(t,s){const e=ct(t.lat),i=ct(s.lat),n=lt(t.lng,e),r=lt(s.lng,i),h=e*ms,a=n*ms,o=i*ms,c=(r-n)*ms,l=is(o)*is(c),d=is(o)*us(c),m=es(us(h)+us(o),cs((is(h)+l)*(is(h)+l)+d*d)),p=a+es(d,is(h)+l);if(!u(m)||!u(p))throw new Error("latitude or longitude is NaN");return{lat:m*ds,lng:p*ds}}function Nt(t,s,e){return Qt(pt(t,s,e))}function wt(t,s){const e=[];let i=t*s<<1;for(i<0&&(i=~i);i>=32;)e.push(63+(32|31&i)),i>>=5;return e.push(i+63),String.fromCharCode(...e)}function yt(t,s=6){const e=as(10,s);let i=wt(t[0].lat,e)+wt(t[0].lng,e);for(let s=1;s<t.length;s++){const n=t[s],r=t[s-1];i+=wt(n.lat-r.lat,e)+wt(n.lng-r.lng,e)}return i}function St(t,s=6){function e(){let s=0,e=0,i=0;do{s=t.charCodeAt(h++)-63,i|=(31&s)<<e,e+=5}while(s>=32);return 1&i?~(i>>1):i>>1}const i=t.length,n=[],r=as(10,s||6);let h=0,a=h,o=h;for(;h<i;)n.push({lat:(a+=e())/r,lng:(o+=e())/r});return n}function vt(t){const s=[...t],e=t.length;let i=0,n=0,r=e-1;if(e>1)for(let t=0;t<e;t++){const h=s[t];for(let a=t+1;a<e;a++){const e=mt(h,s[a]);e>i&&(n=t,r=a,i=e)}}return[i,n,r]}function Tt(t,s,e){const i=mt(t,s)/ci,n=mt(s,e)/ci,r=mt(e,t)/ci,h=(i+n+r)/2,a=ls(h/2)*ls((h-i)/2)*ls((h-n)/2)*ls((h-r)/2);return 4*ss(cs(Qt(a)))}function bt(t,s,e){const i=ct(t.lat),n=lt(t.lng,i),r=ct(s.lat),h=lt(s.lng,r),a=ct(e.lat),o=lt(e.lng,a),u=i*ms,c=n*ms,l=r*ms,d=h*ms,m=a*ms,p=o*ms,g=is(u)*is(c),f=is(u)*us(c),N=us(u),w=is(l)*is(d),y=is(l)*us(d),S=us(l),v=is(m)*is(p),T=is(m)*us(p),b=us(m);return g*y*b+w*T*N+v*f*S-g*T*S-w*f*b-v*y*N<0?-1:1}function Ot(t){return!!t&&a(t.x)&&a(t.y)}function Ct(t){return a(t?.r)&&Ot(t)}function Jt(t){return!!t&&a(t.top)&&a(t.left)&&a(t.bottom)&&a(t.right)}function kt(t){return{left:t.left,top:t.top,right:t.right,bottom:t.bottom}}function xt(t,s){let e=0;return t.x===s.x&&t.y===s.y||(e=es(s.y-t.y,s.x-t.x)*ds+90),(e+360)%360}function Ut(t,s){return l(s.x-t.x,s.y-t.y)}function It(t,s){return t.x<s.x?-1:t.x>s.x?1:t.y<s.y?-1:t.y>s.y?1:0}function Mt(t,s){const e=(s-90)*ms;return{x:c(is(e)*t,14),y:c(us(e)*t,14)}}function At(t,s,e){const i=Ut(t,e);return i>0?Pt([t,s,e])/i*2:Ut(t,s)}function Dt(t,s,e){return At(t,s,e)}function Pt(t){let s=t.slice(),e=0,i=0,n=s.length-1,r=s[i],h=s[n];for(r.x===h.x&&r.y===h.y||(n=s.push(r)-1);i<n;i++)r=s[i],h=s[i+1],e+=r.x*h.y-r.y*h.x;return Qt(e/2)}function Et(t){let s=NaN,e=NaN,i=NaN,n=NaN;for(let r=0;r<t.length;r++){const h=t[r].x,a=t[r].y;h>s||(s=h),h<i||(i=h),a>e||(e=a),a<n||(n=a)}return{left:s,top:e,right:i,bottom:n}}function zt(t,s){return!(s.y<t.top||s.x<t.left||s.x>t.right||s.y>t.bottom)}function Kt(t){return!!t&&a(t.lat)&&a(t.lng)}function Rt(t){return!!t&&a(t.north)&&a(t.west)&&a(t.south)&&a(t.west)}function Bt(t,s,e){return t[e+26]=s,t}function Lt(t){let s=(t.match(bi)||[])[0]||"",e="!"===(s[0]||"").trim()?"!":"",i=s&&J(t.substring(0,s.length-1))||"";if(i){i=e+i;let n=this.operators.get(i);n||this.operators.set(i,n=[]),t.substring(s.length).split(Oi).forEach(jt,n)}else(t=t.trim())&&t.split(Oi).forEach(jt,this.terms)}function jt(t){if(t){const s="!"===t[0]?"!":"";switch(s&&(t=t.substring(1)),t[0]){case"*":return this.push(s+t);case"#":case"$":t=s+t[0]+J(t.substring(1));break;default:t=s+J(t)}t&&this.indexOf(t)<0&&this.push(t)}}function Ht(t){let s=t.indexOf("*");if(s<0)for(;(s=t.indexOf(""))>-1;)t.splice(s,1);else t.length=0}function qt(t,s){return[J(t),new Cn(s)]}class Gt{constructor(t){t&&this.fromJSON(t)}}class _t extends Gt{t=-1;get v(){return[this.t]}updateVersion(t){if(t instanceof Array)return this.updateVersion(t[0]);{const s=t+1||0,e=this.t+1||0,i=!e||s>e;return i&&(this.t=s-1),i}}updateVersions(t=[]){return t?.map((t=>this.updateVersion(t)))}}const Vt=parseInt,Ft=parseFloat,Wt=Object,Yt=Wt.keys,$t=Wt.freeze,Zt=Math,Xt=Zt.PI,Qt=Zt.abs,ts=Zt.asin,ss=Zt.atan,es=Zt.atan2,is=Zt.cos,ns=Zt.floor,rs=Zt.log,hs=Zt.max,as=Zt.pow,os=Zt.round,us=Zt.sin,cs=Zt.sqrt,ls=Zt.tan,ds=180/Xt,ms=Xt/180,ps=globalThis.location,gs=1e10,fs=[!1,!1,!1,!1,!1,!1,!1],Ns={ⱥ:"a",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ā:"a",ă:"a",ą:"a",ǎ:"a",ǟ:"a",ǡ:"a",ǻ:"a",ȁ:"a",ȃ:"a",ȧ:"a",ɐ:"a",a:"a",ḁ:"a",ẚ:"a",ạ:"a",ả:"a",ấ:"a",ầ:"a",ẩ:"a",ẫ:"a",ậ:"a",ắ:"a",ằ:"a",ẳ:"a",ẵ:"a",ặ:"a","ⓐ":"a",ꜳ:"aa",æ:"ae",ǣ:"ae",ǽ:"ae",ꜵ:"ao",ꜷ:"au",ꜹ:"av",ꜻ:"av",ꜽ:"ay",ƀ:"b",ƃ:"b",ɓ:"b",b:"b",ḃ:"b",ḅ:"b",ḇ:"b","ⓑ":"b",ç:"c",ć:"c",ĉ:"c",ċ:"c",č:"c",ƈ:"c",ꜿ:"c",ȼ:"c",c:"c",ḉ:"c",ↄ:"c","ⓒ":"c",ď:"d",đ:"d",ƌ:"d",ꝺ:"d",ɖ:"d",ɗ:"d",d:"d",ḋ:"d",ḍ:"d",ḏ:"d",ḑ:"d",ḓ:"d","ⓓ":"d",ð:"d",dž:"dz",dz:"dz",è:"e",é:"e",ê:"e",ë:"e",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",ǝ:"e",ȅ:"e",ȇ:"e",ȩ:"e",ɇ:"e",ɛ:"e",e:"e",ḕ:"e",ḗ:"e",ḙ:"e",ḛ:"e",ḝ:"e",ẹ:"e",ẻ:"e",ẽ:"e",ế:"e",ề:"e",ể:"e",ễ:"e",ệ:"e","ⓔ":"e",ƒ:"f",ꝼ:"f",f:"f",ḟ:"f","ⓕ":"f",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",ꝿ:"g",ꞡ:"g",ǥ:"g",ǧ:"g",ǵ:"g",ɠ:"g",g:"g",ᵹ:"g",ḡ:"g","ⓖ":"g",ⱨ:"h",ⱶ:"h",ĥ:"h",ħ:"h",ȟ:"h",ɥ:"h",h:"h",ḣ:"h",ḥ:"h",ḧ:"h",ḩ:"h",ḫ:"h",ẖ:"h","ⓗ":"h",ƕ:"hv",ì:"i",í:"i",î:"i",ï:"i",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",ǐ:"i",ȉ:"i",ȋ:"i",ɨ:"i",i:"i",ḭ:"i",ḯ:"i","̇":"i",ỉ:"i",ị:"i","ⓘ":"i",i:"i",ij:"ij",ĵ:"j",ǰ:"j",ɉ:"j",j:"j","ⓙ":"j",ⱪ:"k",ķ:"k",ƙ:"k",ꝁ:"k",ꝃ:"k",ꝅ:"k",ꞣ:"k",ǩ:"k",k:"k",ḱ:"k",ḳ:"k",ḵ:"k","ⓚ":"k",ĸ:"k",ⱡ:"l",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",ſ:"l",ƚ:"l",ꝇ:"l",ꝉ:"l",ꞁ:"l",ɫ:"l",l:"l",ḷ:"l",ḹ:"l",ḻ:"l",ḽ:"l","ⓛ":"l",lj:"lj",ɯ:"m",ɱ:"m",m:"m",ḿ:"m",ṁ:"m",ṃ:"m","ⓜ":"m",ñ:"n",ń:"n",ņ:"n",ň:"n",ʼn:"n",ƞ:"n",ꞑ:"n",ꞥ:"n",ǹ:"n",ɲ:"n",n:"n",ṅ:"n",ṇ:"n",ṉ:"n",ṋ:"n","ⓝ":"n",ŋ:"n",nj:"nj",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ō:"o",ŏ:"o",ő:"o",ơ:"o",ꝋ:"o",ꝍ:"o",ǒ:"o",ǫ:"o",ǭ:"o",ǿ:"o",ȍ:"o",ȏ:"o",ȫ:"o",ȭ:"o",ȯ:"o",ȱ:"o",ɔ:"o",ɵ:"o",o:"o",ṍ:"o",ṏ:"o",ṑ:"o",ṓ:"o",ọ:"o",ỏ:"o",ố:"o",ồ:"o",ổ:"o",ỗ:"o",ộ:"o",ớ:"o",ờ:"o",ở:"o",ỡ:"o",ợ:"o","ⓞ":"o","":"oe","":"oe",œ:"oe",ƣ:"oi",ꝏ:"oo",ȣ:"ou",ƥ:"p",ꝑ:"p",ꝓ:"p",ꝕ:"p",p:"p",ᵽ:"p",ṕ:"p",ṗ:"p","ⓟ":"p",ꝗ:"q",ꝙ:"q",ɋ:"q",q:"q","ⓠ":"q",ŕ:"r",ŗ:"r",ř:"r",ꝛ:"r",ꞃ:"r",ꞧ:"r",ȑ:"r",ȓ:"r",ɍ:"r",ɽ:"r",r:"r",ṙ:"r",ṛ:"r",ṝ:"r",ṟ:"r","ⓡ":"r",ß:"s",ś:"s",ŝ:"s",ş:"s",š:"s",ꞅ:"s",ꞩ:"s",ș:"s",ȿ:"s",s:"s",ṡ:"s",ṣ:"s",ṥ:"s",ṧ:"s",ṩ:"s",ẛ:"s","ⓢ":"s",ⱦ:"t",ţ:"t",ť:"t",ŧ:"t",ꞇ:"t",ƭ:"t",ț:"t",ʈ:"t",t:"t",ṫ:"t",ṭ:"t",ṯ:"t",ṱ:"t",ẗ:"t","ⓣ":"t",þ:"th",ꜩ:"tz",ù:"u",ú:"u",û:"u",ü:"u",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",ư:"u",ǔ:"u",ǖ:"u",ǘ:"u",ǚ:"u",ǜ:"u",ȕ:"u",ȗ:"u",ʉ:"u",u:"u",ṳ:"u",ṵ:"u",ṷ:"u",ṹ:"u",ṻ:"u",ụ:"u",ủ:"u",ứ:"u",ừ:"u",ử:"u",ữ:"u",ự:"u","ⓤ":"u",ꝟ:"v",ʋ:"v",ʌ:"v",v:"v",ṽ:"v",ṿ:"v","ⓥ":"v",ꝡ:"vy",ⱳ:"w",ŵ:"w",w:"w",ẁ:"w",ẃ:"w",ẅ:"w",ẇ:"w",ẉ:"w",ẘ:"w","ⓦ":"w",x:"x",ẋ:"x",ẍ:"x","ⓧ":"x",ý:"y",ÿ:"y",ŷ:"y",ƴ:"y",ȳ:"y",ɏ:"y",y:"y",ẏ:"y",ẙ:"y",ỳ:"y",ỵ:"y",ỷ:"y",ỹ:"y",ỿ:"y","ⓨ":"y",ⱬ:"z",ź:"z",ż:"z",ž:"z",ꝣ:"z",ƶ:"z",ȥ:"z",ɀ:"z",z:"z",ẑ:"z",ẓ:"z",ẕ:"z","ⓩ":"z"},ws=['"',"'","^","`","«","´","»","ʺ","˝","ˮ","˶","ײ","״","᳓","“","”","‟","″","‶","〃","""],ys="["+ws.join("")+"]*",Ss=new Map,vs=new Map,Ts=new Map,bs=new Map,Os=new Map,Cs=new Map,Js=new Map,ks=new Map,xs=new Map,Us=new Map,Is=new Map,Ms=new Map,As=new Map,Ds=new Map,Ps=new Map,Es=new Map,zs=new Map,Ks=new Map,Rs=new Map,Bs=new Map,Ls=new Map,js=new Map,Hs=new Map,qs=new Map,Gs=new Map,_s=new Map,Vs=new Map,Fs=new Map,Ws=new Map,Ys=new Map,$s=new Map,Zs=new Map,Xs=new Map,Qs=new Map,te=new Map,se="Email",ee="Mobile",ie="Office",ne="Fax",re="Address",he="Website";class ae extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";otherNames=new Map;emails=new Map;phones=new Map;addresses=new Map;urls=new Map;dates=new Map;options=new Map;roles=[];pictureIds=[];get pictures(){return k(Ls,this.pictureIds)}set pictures(t){this.pictureIds=t?.map(e)??[]}get email(){return this.emails.get(se)??""}set email(t){t?this.emails.set(se,t):this.emails.delete(se)}get mobile(){return this.phones.get(ee)??NaN}set mobile(t){t?this.phones.set(ee,t):this.phones.delete(ee)}get office(){return this.phones.get(ie)??NaN}set office(t){t?this.phones.set(ie,t):this.phones.delete(ie)}get fax(){return this.phones.get(ne)??NaN}set fax(t){t?this.phones.set(ne,t):this.phones.delete(ne)}get address(){return this.addresses.get(re)??""}set address(t){t?this.addresses.set(re,t):this.addresses.delete(re)}get url(){return this.urls.get(he)??""}set url(t){t?this.urls.set(he,t):this.urls.delete(he)}toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,name:this.name||"",notes:this.notes||"",otherNames:N(this.otherNames),emails:N(this.emails),phones:N(this.phones),addresses:N(this.addresses),urls:N(this.urls),dates:N(this.dates),options:N(this.options),roles:[...this.roles],pictures:[...this.pictureIds]}}fromJSON(t,s){const e=this.updateVersion(t.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.emails=S(t.emails||{},!1),this.phones=S(t.phones||{},!1),this.addresses=S(t.addresses||{},!1),this.urls=S(t.urls||{},!1),this.dates=y(t.dates||{},((t,s)=>[t,m(s)])),this.options=S(t.options||{},!1),this.otherNames=S(t.otherNames||{},!1),this.roles=t.roles?.map(J)??[],this.pictureIds=t.pictures?.map(d)??[]),e}getKey(){return this.id}}class oe{static fromJSON(t){return new oe(t.code,t.name,t.offset,t.dst)}static utc=new oe("utc","UTC",0,!1);code;name;offset;dst;constructor(t,s,e,i){this.code=J(t||""),this.name=s||t||"",this.offset=e||0,this.dst=!!i}toJSON(){return{code:this.code,name:this.name,offset:this.offset,dst:this.dst}}getKey(){return this.code}}const ue=[new oe("dateline-standard-time","International Date Line West (UTC-12:00)",-720,!1),new oe("utc-11","Coordinated Universal Time-11 (UTC-11:00)",-660,!1),new oe("aleutian-standard-time","Aleutian Islands (UTC-10:00)",-600,!0),new oe("hawaiian-standard-time","Hawaii (UTC-10:00)",-600,!1),new oe("marquesas-standard-time","Marquesas Islands (UTC-09:30)",-570,!1),new oe("alaskan-standard-time","Alaska (UTC-09:00)",-540,!0),new oe("utc-09","Coordinated Universal Time-09 (UTC-09:00)",-540,!1),new oe("pacific-standard-time-mexico","Baja California (UTC-08:00)",-480,!0),new oe("utc-08","Coordinated Universal Time-08 (UTC-08:00)",-480,!1),new oe("pacific-standard-time","Pacific Time (US & Canada) (UTC-08:00)",-480,!0),new oe("us-mountain-standard-time","Arizona (UTC-07:00)",-420,!1),new oe("mountain-standard-time-mexico","La Paz, Mazatlan (UTC-07:00)",-420,!0),new oe("mountain-standard-time","Mountain Time (US & Canada) (UTC-07:00)",-420,!0),new oe("yukon-standard-time","Yukon (UTC-07:00)",-420,!0),new oe("central-america-standard-time","Central America (UTC-06:00)",-360,!1),new oe("central-standard-time","Central Time (US & Canada) (UTC-06:00)",-360,!0),new oe("easter-island-standard-time","Easter Island (UTC-06:00)",-360,!0),new oe("central-standard-time-mexico","Guadalajara, Mexico City, Monterrey (UTC-06:00)",-360,!0),new oe("canada-central-standard-time","Saskatchewan (UTC-06:00)",-360,!1),new oe("sa-pacific-standard-time","Bogota, Lima, Quito, Rio Branco (UTC-05:00)",-300,!1),new oe("eastern-standard-time-mexico","Chetumal (UTC-05:00)",-300,!0),new oe("eastern-standard-time","Eastern Time (US & Canada) (UTC-05:00)",-300,!0),new oe("haiti-standard-time","Haiti (UTC-05:00)",-300,!0),new oe("cuba-standard-time","Havana (UTC-05:00)",-300,!0),new oe("us-eastern-standard-time","Indiana (East) (UTC-05:00)",-300,!0),new oe("turks-and-caicos-standard-time","Turks and Caicos (UTC-05:00)",-300,!0),new oe("paraguay-standard-time","Asuncion (UTC-04:00)",-240,!0),new oe("atlantic-standard-time","Atlantic Time (Canada) (UTC-04:00)",-240,!0),new oe("venezuela-standard-time","Caracas (UTC-04:00)",-240,!0),new oe("central-brazilian-standard-time","Cuiaba (UTC-04:00)",-240,!0),new oe("sa-western-standard-time","Georgetown, La Paz, Manaus, San Juan (UTC-04:00)",-240,!1),new oe("pacific-sa-standard-time","Santiago (UTC-04:00)",-240,!0),new oe("newfoundland-standard-time","Newfoundland (UTC-03:30)",-210,!0),new oe("tocantins-standard-time","Araguaina (UTC-03:00)",-180,!0),new oe("e-south-america-standard-time","Brasilia (UTC-03:00)",-180,!0),new oe("sa-eastern-standard-time","Cayenne, Fortaleza (UTC-03:00)",-180,!1),new oe("argentina-standard-time","City of Buenos Aires (UTC-03:00)",-180,!0),new oe("montevideo-standard-time","Montevideo (UTC-03:00)",-180,!0),new oe("magallanes-standard-time","Punta Arenas (UTC-03:00)",-180,!0),new oe("saint-pierre-standard-time","Saint Pierre and Miquelon (UTC-03:00)",-180,!0),new oe("bahia-standard-time","Salvador (UTC-03:00)",-180,!0),new oe("utc-02","Coordinated Universal Time-02 (UTC-02:00)",-120,!1),new oe("greenland-standard-time","Greenland (UTC-02:00)",-120,!0),new oe("mid-atlantic-standard-time","Mid-Atlantic - Old (UTC-02:00)",-120,!0),new oe("azores-standard-time","Azores (UTC-01:00)",-60,!0),new oe("cape-verde-standard-time","Cabo Verde Is. (UTC-01:00)",-60,!1),new oe("utc","Coordinated Universal Time (UTC)",0,!1),new oe("gmt-standard-time","Dublin, Edinburgh, Lisbon, London (UTC+00:00)",0,!0),new oe("greenwich-standard-time","Monrovia, Reykjavik (UTC+00:00)",0,!1),new oe("sao-tome-standard-time","Sao Tome (UTC+00:00)",0,!0),new oe("morocco-standard-time","Casablanca (UTC+01:00)",0,!0),new oe("w-europe-standard-time","Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna (UTC+01:00)",60,!0),new oe("central-europe-standard-time","Belgrade, Bratislava, Budapest, Ljubljana, Prague (UTC+01:00)",60,!0),new oe("romance-standard-time","Brussels, Copenhagen, Madrid, Paris (UTC+01:00)",60,!0),new oe("central-european-standard-time","Sarajevo, Skopje, Warsaw, Zagreb (UTC+01:00)",60,!0),new oe("w-central-africa-standard-time","West Central Africa (UTC+01:00)",60,!1),new oe("gtb-standard-time","Athens, Bucharest (UTC+02:00)",120,!0),new oe("middle-east-standard-time","Beirut (UTC+02:00)",120,!0),new oe("egypt-standard-time","Cairo (UTC+02:00)",120,!0),new oe("e-europe-standard-time","Chisinau (UTC+02:00)",120,!0),new oe("west-bank-standard-time","Gaza, Hebron (UTC+02:00)",120,!0),new oe("south-africa-standard-time","Harare, Pretoria (UTC+02:00)",120,!1),new oe("fle-standard-time","Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius (UTC+02:00)",120,!0),new oe("israel-standard-time","Jerusalem (UTC+02:00)",120,!0),new oe("south-sudan-standard-time","Juba (UTC+02:00)",120,!0),new oe("kaliningrad-standard-time","Kaliningrad (UTC+02:00)",120,!0),new oe("sudan-standard-time","Khartoum (UTC+02:00)",120,!0),new oe("libya-standard-time","Tripoli (UTC+02:00)",120,!0),new oe("namibia-standard-time","Windhoek (UTC+02:00)",120,!0),new oe("jordan-standard-time","Amman (UTC+03:00)",180,!0),new oe("arabic-standard-time","Baghdad (UTC+03:00)",180,!0),new oe("syria-standard-time","Damascus (UTC+03:00)",180,!0),new oe("turkey-standard-time","Istanbul (UTC+03:00)",180,!0),new oe("arab-standard-time","Kuwait, Riyadh (UTC+03:00)",180,!1),new oe("belarus-standard-time","Minsk (UTC+03:00)",180,!0),new oe("russian-standard-time","Moscow, St. Petersburg (UTC+03:00)",180,!0),new oe("e-africa-standard-time","Nairobi (UTC+03:00)",180,!1),new oe("volgograd-standard-time","Volgograd (UTC+04:00)",180,!0),new oe("iran-standard-time","Tehran (UTC+03:30)",210,!0),new oe("arabian-standard-time","Abu Dhabi, Muscat (UTC+04:00)",240,!1),new oe("astrakhan-standard-time","Astrakhan, Ulyanovsk (UTC+04:00)",240,!0),new oe("azerbaijan-standard-time","Baku (UTC+04:00)",240,!0),new oe("russia-time-zone-3","Izhevsk, Samara (UTC+04:00)",240,!0),new oe("mauritius-standard-time","Port Louis (UTC+04:00)",240,!0),new oe("saratov-standard-time","Saratov (UTC+04:00)",240,!0),new oe("georgian-standard-time","Tbilisi (UTC+04:00)",240,!1),new oe("caucasus-standard-time","Yerevan (UTC+04:00)",240,!0),new oe("afghanistan-standard-time","Kabul (UTC+04:30)",270,!1),new oe("west-asia-standard-time","Ashgabat, Tashkent (UTC+05:00)",300,!1),new oe("qyzylorda-standard-time","Astana (UTC+05:00)",300,!0),new oe("ekaterinburg-standard-time","Ekaterinburg (UTC+05:00)",300,!0),new oe("pakistan-standard-time","Islamabad, Karachi (UTC+05:00)",300,!0),new oe("india-standard-time","Chennai, Kolkata, Mumbai, New Delhi (UTC+05:30)",330,!1),new oe("sri-lanka-standard-time","Sri Jayawardenepura (UTC+05:30)",330,!1),new oe("nepal-standard-time","Kathmandu (UTC+05:45)",345,!1),new oe("central-asia-standard-time","Bishkek (UTC+06:00)",360,!1),new oe("bangladesh-standard-time","Dhaka (UTC+06:00)",360,!0),new oe("omsk-standard-time","Omsk (UTC+06:00)",360,!0),new oe("myanmar-standard-time","Yangon (Rangoon) (UTC+06:30)",390,!1),new oe("se-asia-standard-time","Bangkok, Hanoi, Jakarta (UTC+07:00)",420,!1),new oe("altai-standard-time","Barnaul, Gorno-Altaysk (UTC+07:00)",420,!0),new oe("w-mongolia-standard-time","Hovd (UTC+07:00)",420,!0),new oe("north-asia-standard-time","Krasnoyarsk (UTC+07:00)",420,!0),new oe("n-central-asia-standard-time","Novosibirsk (UTC+07:00)",420,!0),new oe("tomsk-standard-time","Tomsk (UTC+07:00)",420,!0),new oe("china-standard-time","Beijing, Chongqing, Hong Kong, Urumqi (UTC+08:00)",480,!1),new oe("north-asia-east-standard-time","Irkutsk (UTC+08:00)",480,!0),new oe("singapore-standard-time","Kuala Lumpur, Singapore (UTC+08:00)",480,!1),new oe("w-australia-standard-time","Perth (UTC+08:00)",480,!0),new oe("taipei-standard-time","Taipei (UTC+08:00)",480,!1),new oe("ulaanbaatar-standard-time","Ulaanbaatar (UTC+08:00)",480,!0),new oe("aus-central-w-standard-time","Eucla (UTC+08:45)",525,!1),new oe("transbaikal-standard-time","Chita (UTC+09:00)",540,!0),new oe("tokyo-standard-time","Osaka, Sapporo, Tokyo (UTC+09:00)",540,!1),new oe("north-korea-standard-time","Pyongyang (UTC+09:00)",540,!0),new oe("korea-standard-time","Seoul (UTC+09:00)",540,!1),new oe("yakutsk-standard-time","Yakutsk (UTC+09:00)",540,!0),new oe("cen-australia-standard-time","Adelaide (UTC+09:30)",570,!0),new oe("aus-central-standard-time","Darwin (UTC+09:30)",570,!1),new oe("e-australia-standard-time","Brisbane (UTC+10:00)",600,!1),new oe("aus-eastern-standard-time","Canberra, Melbourne, Sydney (UTC+10:00)",600,!0),new oe("west-pacific-standard-time","Guam, Port Moresby (UTC+10:00)",600,!1),new oe("tasmania-standard-time","Hobart (UTC+10:00)",600,!0),new oe("vladivostok-standard-time","Vladivostok (UTC+10:00)",600,!0),new oe("lord-howe-standard-time","Lord Howe Island (UTC+10:30)",630,!0),new oe("bougainville-standard-time","Bougainville Island (UTC+11:00)",660,!0),new oe("russia-time-zone-10","Chokurdakh (UTC+11:00)",660,!0),new oe("magadan-standard-time","Magadan (UTC+11:00)",660,!0),new oe("norfolk-standard-time","Norfolk Island (UTC+11:00)",660,!0),new oe("sakhalin-standard-time","Sakhalin (UTC+11:00)",660,!0),new oe("central-pacific-standard-time","Solomon Is., New Caledonia (UTC+11:00)",660,!1),new oe("russia-time-zone-11","Anadyr, Petropavlovsk-Kamchatsky (UTC+12:00)",720,!0),new oe("new-zealand-standard-time","Auckland, Wellington (UTC+12:00)",720,!0),new oe("utc-12","Coordinated Universal Time+12 (UTC+12:00)",720,!1),new oe("fiji-standard-time","Fiji (UTC+12:00)",720,!0),new oe("kamchatka-standard-time","Petropavlovsk-Kamchatsky - Old (UTC+12:00)",720,!0),new oe("chatham-islands-standard-time","Chatham Islands (UTC+12:45)",765,!0),new oe("utc-13","Coordinated Universal Time+13 (UTC+13:00)",780,!1),new oe("tonga-standard-time","Nuku'alofa (UTC+13:00)",780,!0),new oe("samoa-standard-time","Samoa (UTC+13:00)",780,!0),new oe("line-islands-standard-time","Kiritimati Island (UTC+14:00)",840,!1)];var ce,le,de,me,pe,ge;!function(t){t.read="read",t.update="update",t.full="full"}(ce||(ce={})),function(t){t.grant="grant",t.revoke="revoke"}(le||(le={})),function(t){t.companyGeneral="companyGeneral",t.companyDirectory="companyDirectory",t.companyLabels="companyLabels",t.companyPolicies="companyPolicies",t.companyReseller="companyReseller",t.companyCreate="companyCreate",t.assetGeneral="assetGeneral",t.assetAdvanced="assetAdvanced",t.assetMessage="assetMessage",t.assetDispatch="assetDispatch",t.placeGeneral="placeGeneral",t.providerGeneral="providerGeneral",t.providerAdvanced="providerAdvanced",t.providerControl="providerControl",t.providerConfiguration="providerConfiguration",t.providerConfigType="providerConfigType",t.providerScript="providerScript",t.providerCommand="providerCommand",t.reportResult="reportResult",t.reportTemplate="reportTemplate",t.reportSchedule="reportSchedule",t.userGeneral="userGeneral",t.userAdvanced="userAdvanced",t.userGroup="userGroup",t.machine="machine",t.session="session",t.behaviour="behaviour",t.behaviourLog="behaviourLog",t.behaviourScript="behaviourScript",t.dispatchTask="dispatchTask",t.dispatchTemplate="dispatchTemplate",t.contact="contact",t.hosCarrier="hosCarrier",t.hosEvent="hosEvent",t.hosInspection="hosInspection",t.maintenanceJob="maintenanceJob",t.maintenanceSchedule="maintenanceSchedule",t.analyticRule="analyticRule",t.analyticSummary="analyticSummary",t.icon="icon",t.picture="picture",t.document="document",t.billingProfile="billingProfile",t.billingHosting="billingHosting",t.billingDiscount="billingDiscount",t.billingLicense="billingLicense",t.billingReport="billingReport",t.formTemplate="formTemplate",t.formResult="formResult",t.dispatchJob="dispatchJob"}(de||(de={}));class fe{static fromJSON(t){return new fe(t.company,t.kind,t.level,t.method,t.labels)}companyId;get company(){return Ss.get(this.companyId)}kind;get type(){return this.kind.toString()}set type(t){const s=de[t];if(!s)throw new Error("Unknown PermissionType");this.kind=s}level;method;labels;constructor(t,s,e=ce.read,i=le.grant,n){this.companyId=d(t),this.kind=de[s],this.level=ce[e]||ce.read,this.method=le[i]||le.grant,this.labels=n||[]}toJSON(){return{company:b(this.companyId),kind:de[this.kind]||null,level:ce[this.level]||null,method:le[this.method]||null,labels:[...this.labels]}}}!function(t){t.metric="metric",t.standard="standard"}(me||(me={}));class Ne extends _t{key="";companyId=NaN;get company(){return Ss.get(this.companyId)}enabled=!1;secret="";nickname="";notes="";notBefore=m();notAfter=m();timezone=oe.utc;language="";formats=new Map;measurements=new Map;options=new Map;groupIds=[];get groups(){return k(Os,this.groupIds)}set groups(t){this.groupIds=t?.map(e)??[]}permissions=[];services=[];referrers=[];ipRanges=[];insecure=!1;toJSON(){return{key:this.key,v:[...this.v],company:this.companyId,nickname:this.nickname,notes:this.notes,enabled:!!this.enabled,notBefore:T(this.notBefore),notAfter:T(this.notAfter),timezone:this.timezone?.code||oe.utc.code,language:this.language,formats:N(this.formats),measurements:N(this.measurements),options:N(this.options),groups:[...this.groupIds],permissions:this.permissions?.map(i)??[],services:[...this.services],referrers:[...this.referrers],ipRanges:[...this.ipRanges],insecure:!!this.insecure}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.key||(this.key=t.key||""),this.companyId=d(t.company),this.secret="string"==typeof t.secret?t.secret:"",this.nickname=t.nickname||"",this.notes=t.notes||"",this.enabled=!!t.enabled,this.notBefore=m(t.notBefore),this.notAfter=m(t.notAfter),this.timezone=U(t.timezone||"")||oe.utc,this.language=t.language||"",this.formats=v(t.formats||{}),this.measurements=y(t.measurements||{},((t,s)=>[J(t),me[s]??me.metric])),this.options=v(t.options||{}),this.groupIds=(t.groups||[]).map(d),this.permissions=(t.permissions||[]).map(fe.fromJSON),this.services=t.services||[],this.referrers=t.referrers||[],this.ipRanges=t.ipRanges||[],this.insecure=!!t.insecure),e}getKey(){return this.key}async createHmacSignature(t,s="GET",e=0,i=new Date){const n=(new TextEncoder).encode([this.key,i.toISOString().replace(/[-T:]/g,"").slice(0,14),s.toUpperCase(),t.toString(),e].join("\n")),r=await crypto.subtle.importKey("raw",Uint8Array.from(atob(this.secret),(t=>t.charCodeAt(0))),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),h=new Uint8Array(await crypto.subtle.sign("HMAC",r,n));return btoa(String.fromCharCode(...h))}}!function(t){t.popup="popup",t.sms="sms",t.email="email"}(pe||(pe={}));class we{level;labels;constructor(t,s){this.level=t||null,this.labels=s||null}toJSON(){return{level:this.level,labels:this.labels?.slice()??null}}}class ye{static fromJSON(t){return new ye(t?.direction,t?.company,t?.kind,t?.after?.level,t?.after?.labels,t?.before?.level,t?.before?.labels)}direction;company;kind;after;before;constructor(t,s,e,i,n,r,h){this.direction=t,this.company=s,this.kind=e,this.after=new we(i,n),this.before=new we(r,h)}toJSON(){return{direction:this.direction,company:this.company,kind:this.kind,after:this.after.toJSON(),before:this.before.toJSON()}}}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(ge||(ge={}));class Se extends fe{order;constructor(t,s,e=ce.read,i=le.grant,n,r){super(t,s,e,i,n),this.order=r}}const ve=[de.companyGeneral,de.companyLabels,de.companyPolicies,de.icon,de.picture],Te=[de.assetGeneral,de.assetAdvanced,de.assetDispatch,de.placeGeneral,de.dispatchJob,de.dispatchTemplate,de.formResult,de.formTemplate],be=[ce.read,ce.update,ce.full],Oe=["*"];var Ce,Je,ke;!function(t){t.notFound="notFound",t.created="created",t.active="active",t.idle="idle",t.passwordExpired="passwordExpired",t.expired="expired"}(Ce||(Ce={}));class xe{handle;companyId;get company(){return Ss.get(this.companyId)}ipAddress;userAgent;sockets;login;status;created;expiry;lastCommand;lastActivity;get active(){return this.sockets>0}constructor(t){t&&this.fromJSON(t)}fromJSON(t,s){return t&&(this.handle=t.handle||"",this.companyId=d(t.company),this.login=t.login||"",this.status=Ce[t.status]||Ce.notFound,this.userAgent=t.userAgent||"",this.ipAddress=t.ipAddress||"",this.created=m(t.created),this.expiry=m(t.expires),this.lastActivity=m(t.lastActivity),this.lastCommand=t.lastCommand||"",this.sockets=d(t.sockets)||0),!!t}toJSON(){return{handle:this.handle||"",company:this.companyId||null,login:this.login||"",status:Ce[this.status]||Ce.notFound,userAgent:this.userAgent||"",ipAddress:this.ipAddress||"",created:this.created.toISOString(),expires:this.expiry.toISOString(),lastActivity:this.lastActivity.toISOString(),lastCommand:this.lastCommand||"",sockets:this.sockets||0}}getKey(){return this.handle}}class Ue extends _t{get v(){return this.pieces.map((t=>t?.v[0]??-1))}}class Ie extends _t{login="";companyId=NaN;get company(){return Ss.get(this.companyId)}groupIds=[];get groups(){return k(Os,this.groupIds)}set groups(t){this.groupIds=t?.map(e)??[]}permissions=[];toJSON(){return{login:this.login.toLowerCase(),v:[...this.v],company:this.companyId,groups:[...this.groupIds],permissions:this.permissions.map(i)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.login||(this.login=(t.login||"").toLowerCase()),this.companyId=d(t.company),this.groupIds=t.groups||[],this.permissions=(t.permissions||[]).map(fe.fromJSON)),e}getKey(){return this.login}}!function(t){t.app="app",t.sms="sms",t.email="email"}(Je||(Je={}));class Me{static fromJSON(t){return new Me(t.enabled,t.kind,t.address,t.verified,t.setupDate,t.lastAuthentication)}enabled;kind;address;verified;setupDate;lastAuthentication;constructor(t,s,e,i,n,r){this.enabled=!!t,this.kind=Je[s],this.address=e||"",this.verified=!!i,this.setupDate=m(n),this.lastAuthentication=m(r)}toJSON(){return{enabled:!!this.enabled,kind:Je[this.kind]||null,address:this.address??"",verified:!!this.verified,setupDate:T(this.setupDate),lastAuthentication:T(this.lastAuthentication)}}}!function(t){t.google="google",t.apple="apple",t.facebook="facebook",t.twitter="twitter",t.microsoft="microsoft"}(ke||(ke={}));class Ae{static fromJSON(t){return new Ae(t.enabled,t.provider,t.lastAuthentication,t.externalId)}enabled;provider;lastAuthentication;externalId;constructor(t,s,e,i){this.enabled=!!t,this.provider=ke[s],this.lastAuthentication=m(e),this.externalId=i||""}toJSON(){return{enabled:!!this.enabled,provider:ke[this.provider]||null,lastAuthentication:T(this.lastAuthentication),externalId:this.externalId||null}}}class De extends _t{login="";companyId=NaN;get company(){return Ss.get(this.companyId)}passwordExpired=!1;mfa=[];sso=new Ae;toJSON(){return{login:this.login.toLowerCase(),v:[...this.v],company:this.companyId,passwordExpired:!!this.passwordExpired,mfa:this.mfa?.map(i)||null,sso:this.sso?.toJSON()||null}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.login||(this.login=(t.login||"").toLowerCase()),this.companyId=d(t.company),this.passwordExpired=!!t.passwordExpired,this.mfa=(t.mfa||[]).map((t=>Me.fromJSON(t))),this.sso=Ae.fromJSON(t.sso||{})),e}getKey(){return this.login}}const Pe=1e3,Ee=6e4,ze=36e5,Ke=864e5,Re=/^(-)?(?:(\d+)\.)?(\d*):(\d*)(?::(\d+)(?:\.(\d+))?)?$/;class Be{static fromDays(t){return new Be(t*Ke)}static fromHours(t){return new Be(t*ze)}static fromMinutes(t){return new Be(t*Ee)}static fromSeconds(t){return new Be(t*Pe)}static fromMilliseconds(t){return new Be(t)}#t=0;constructor(t){h(t)||this.add(t)}get days(){return ns(Qt(this.#t)/Ke)*(this.#t<0?-1:1)}get hours(){return ns((Qt(this.#t)-Qt(this.days)*Ke)/ze)*(this.#t<0?-1:1)}get minutes(){return ns((Qt(this.#t)-(Qt(this.days)*Ke+Qt(this.hours)*ze))/Ee)*(this.#t<0?-1:1)}get seconds(){return ns((Qt(this.#t)-(Qt(this.days)*Ke+Qt(this.hours)*ze+Qt(this.minutes)*Ee))/Pe)*(this.#t<0?-1:1)}get milliseconds(){return ns(Qt(this.#t)-(Qt(this.days)*Ke+Qt(this.hours)*ze+Qt(this.minutes)*Ee+Qt(this.seconds)*Pe))*(this.#t<0?-1:1)}get totalDays(){return this.#t/Ke}get totalHours(){return this.#t/ze}get totalMinutes(){return this.#t/Ee}get totalSeconds(){return this.#t/Pe}get totalMilliseconds(){return this.#t}toString(t=""){if(t){const s=t.split(/(\\.|[hHmstT]{1,2}|[df]{1,6})/gm),e=s.includes("d");return s.slice(1,s.length-1).reduce(((t,s)=>{switch(s[0]||""){case"d":t+=f(this.days,s.length);break;case"H":t+=f(this.hours+(e?0:24*this.days),s.length);break;case"h":t+=f(this.hours%12,s.length);break;case"m":t+=f(this.minutes,s.length);break;case"s":t+=f(this.seconds,s.length);break;case"f":t+=f(this.milliseconds/Pe,0,s.length).substring(2);break;default:t+=s}return t}),this.#t<0?"-":"")}{const t=Qt(this.days),s=Qt(this.hours),e=Qt(this.minutes),i=Qt(this.seconds),n=Qt(this.milliseconds);return(this.#t<0?"-":"")+(t?t+".":"")+(s>9?s:"0"+s)+":"+(e>9?e:"0"+e)+":"+(i>9?i:"0"+i)+(n?(n/Pe).toString().slice(1):"")}}toJSON=this.toString;valueOf(){return this.#t}add(t,s=!1){if(a(t?.valueOf()))this.#t+=t.valueOf()*(s?-1:1);else if(t=String(t).trim()){const e=t.match(Re)||[,,Ft(t)];let i;"-"===e[1]&&(s=!s),(i=Ft(e[2]))&&this.add(i*Ke,s),(i=Ft(e[3]))&&this.add(i*ze,s),(i=Ft(e[4]))&&this.add(i*Ee,s),(i=Ft(e[5]))&&this.add(i*Pe,s),(i=Ft((e[6]+"000").slice(0,-e[6]?.length)))&&this.add(i,s)}return this.#t}subtract(t,s=!1){return this.add(t,!s)}}class Le{static fromJSON(t){return new Le(t.name,t.enabled,t.weekdays,t.start,t.end,t.email,t.sms,t.online,t.offline)}name;enabled;weekdays;start;end;email;sms;online;offline;constructor(t,s,e,i,n,r,h,a,o){this.name=t||"",this.enabled=!!s,this.weekdays=O(e||[]),this.start=new Be(i),this.end=new Be(n),this.email=r||"",this.sms=g(h),this.online=[...a||[]],this.offline=[...o||[]]}toJSON(){return{name:this.name||"",enabled:!!this.enabled,weekdays:C(this.weekdays),start:u(this.start.valueOf())?this.start.toString():"00:00:00",end:u(this.end.valueOf())?this.end.toString():"00:00:00",email:this.email||"",sms:this.sms||null,online:this.online.slice(),offline:this.offline.slice()}}}class je extends _t{login="";companyId=NaN;get company(){return Ss.get(this.companyId)}passwordExpired=!1;enabled=!1;nickname="";contactId=NaN;get contact(){return vs.get(this.contactId)}set contact(t){this.contactId=t.id}timezone=oe.utc;language="";formats=new Map;measurements=new Map;options=new Map;notify=[];toJSON(){return{login:this.login.toLowerCase(),v:[...this.v],company:this.companyId,nickname:this.nickname,enabled:!!this.enabled,contact:!!this.contactId,passwordExpired:!!this.passwordExpired,timezone:this.timezone?.code??oe.utc.code,language:this.language,formats:N(this.formats),measurements:N(this.measurements),options:N(this.options),notify:this.notify.map(i)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.login||(this.login=(t.login||"").toLowerCase()),this.companyId=d(t.company),this.nickname=t.nickname||"",this.enabled=!!t.enabled,this.contactId=d(t.contact),this.passwordExpired=!!t.passwordExpired,this.timezone=U(t.timezone||"")||oe.utc,this.language=t.language||"",this.formats=v(t.formats||{}),this.measurements=y(t.measurements||{},((t,s)=>[J(t),me[s]??me.metric])),this.options=v(t.options||{}),this.notify=(t.notify||[]).map((t=>Le.fromJSON(t)))),e}getKey(){return this.login}}class He extends Ue{get pieces(){return[this.h,this.o,this.u]}get login(){return this.general.login??this.advanced.login}get companyId(){return this.general.companyId??this.advanced.companyId}get company(){return this.general.company}h=new je;get general(){return this.h}get enabled(){return this.general.enabled}set enabled(t){this.general.enabled=t}get nickname(){return this.general.nickname}set nickname(t){this.general.nickname=t}get contactId(){return this.general.contactId}set contactId(t){this.general.contactId=t||NaN}get contact(){return this.general.contact}set contact(t){this.general.contactId=t?.id||NaN}get timezone(){return this.general.timezone}set timezone(t){this.general.timezone=t}get language(){return this.general.language}set language(t){this.general.language=t}get formats(){return this.general.formats}set formats(t){this.general.formats=t}get measurements(){return this.general.measurements}set measurements(t){this.general.measurements=t}get options(){return this.general.options}set options(t){this.general.options=t}get notify(){return this.general.notify}set notify(t){this.general.notify=t}o=new Ie;get advanced(){return this.o}get groupIds(){return this.advanced.groupIds}set groupIds(t){this.advanced.groupIds=t}get groups(){return this.advanced.groups}set groups(t){this.advanced.groups=t}get permissions(){return this.advanced.permissions}set permissions(t){this.advanced.permissions=t}u=new De;get authentication(){return this.u}get passwordExpired(){return this.u.passwordExpired}set passwordExpired(t){this.u.passwordExpired=t}get mfa(){return this.u.mfa}set mfa(t){this.u.mfa=t}get sso(){return this.u.sso}set sso(t){this.u.sso=t}toJSON(){return{...this.h.toJSON(),...this.o.toJSON(),...this.u.toJSON(),v:[...this.v]}}fromJSON(t,s){const e=t?.v||[],i=this.h.fromJSON({...t,v:e.slice(0,1)},s),n=this.o.fromJSON({...t,v:e.slice(1,2)},s),r=this.u.fromJSON({...t,v:e.slice(2,3)},s);return i||n||r}getKey(){return this.login}}class qe extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";permissions=[];toJSON(){return{id:this.id,v:[...this.v],company:this.companyId,name:this.name||"",notes:this.notes||"",permissions:this.permissions?.map(i)??[]}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.permissions=(t.permissions||[]).map(fe.fromJSON)),e}getKey(){return this.id}}const Ge=10.763910416709722,_e=3.587970138903241,Ve=.6213711922373338,Fe=3.2808398950131235,We=1.0936132983377078,Ye=.3937007874015748,$e=.14503773773375084,Ze=5/9,Xe=.2641720523581484,Qe=.03381402270184299,ti=.2199692482990878,si=.035195079727854045,ei=2.2046226218487757,ii=.03527396194958041,ni=1.1023113109243878,ri=3.7854117840000003*Ve*100,hi=4.54609*Ve*100,ai={fromTo:function t(s,e,i){const n=ai[e.toLowerCase()+"To"+i[0].toUpperCase()+i.slice(1).toLowerCase()];if(!n||n===t)throw new Error("No converter for "+e+" to "+i);return n(s)},sqmToSqft:function(t){return t*Ge},sqftToSqm:function(t){return t/Ge},sqmToSqy:function(t){return t*_e},yftToSqm:function(t){return t/_e},sqkmToSqmi:function(t){return.3861021585424459*t},sqmiToSqkm:function(t){return t/Ve},haToAc:function(t){return 2.471053814671653*t},acToHa:function(t){return t/Ve},kmToMi:Q,miToKm:et,mToYd:function(t){return t*We},ydToM:function(t){return t/We},mToFt:tt,ftToM:it,cmToIn:st,inToCm:nt,mpgToL100km:rt,mpgUKToL100km:ht,mpkwhToKwh100kim:at,l100kmToMpg:rt,l100kmToMpgUK:ht,kwh100kimToMpkwh:at,kpaToPsi:function(t){return t*$e},psiToKpa:function(t){return t/$e},kphToMph:Q,mphToKph:et,mpsToFtps:tt,ftpsToMps:it,cmpsToInps:st,inpsToCmps:nt,cToF:function(t){return 1.8*t+32},fToC:function(t){return(t-32)*Ze},lToGal:function(t){return t*Xe},lToGalUK:function(t){return t*ti},galToL:function(t){return t/Xe},galUKToL:function(t){return t/ti},mlToFloz:function(t){return t*Qe},mlToFlozUK:function(t){return t*si},flozToMl:function(t){return t/Qe},flozUKToMl:function(t){return t/si},kgToLbs:function(t){return t*ei},lbsToKg:function(t){return t/ei},gToOz:function(t){return t*ii},ozToG:function(t){return t/ii},tToTon:function(t){return t*ni},tonToT:function(t){return t/ni},tToTonUK:function(t){return t*ei},tonUKToT:function(t){return t/.9842065276110606}},oi=["B","KB","MB","GB","TB","PB","EB","ZB","YB","XB","SB","DB"],ui=oi.indexOf("MB"),ci=6378137,li=1/298.257223563,di=6356752.314245179,mi=1e-9;class pi{static fromJSON(t){return new pi(t?.width,t?.height)}width;height;constructor(t,s){this.width=Ft(t),this.height=Ft(s)}toString(t=","){return[this.width,this.height].join(t??"")}toJSON(){return{width:this.width,height:this.height}}isEqual(t,s=18){return function(t){return!!t&&a(t.width)&&a(t.height)}(t)&&(c(this.width,s)==c(t.width,s)||isNaN(this.width)&&isNaN(t.width))&&(c(this.height,s)==c(t.height,s)||isNaN(this.height)&&isNaN(t.height))}resize(t=1,s=t){return new pi(this.width*t,this.height*s)}resizeToWidth(t){return u(t)||(t=this.width),this.resize(t/this.width)}resizeToHeight(t){return u(t)||(t=this.height),this.resize(t/this.height)}}class gi{static fromJSON(t){const s=u(t?.left),e=u(t?.top),i=u(t?.right),n=u(t?.bottom),r=u(t?.width),h=u(t?.height);return new gi(s?t.left:i&&r?t.right-t.width:NaN,e?t.top:n&&h?t.bottom-t.height:NaN,i?t.right:s&&r?t.left+t.width:NaN,n?t.bottom:e&&h?t.top+t.height:NaN)}left=NaN;top=NaN;right=NaN;bottom=NaN;get width(){return this.right-this.left}get height(){return this.bottom-this.top}constructor(...t){u(t[0])&&u(t[1])&&u(t[2])&&u(t[3])?(this.left=t[0],this.top=t[1],this.right=t[2],this.bottom=t[3]):this.#s(t)}toString(t=","){return this.validate(),[this.left,this.top,this.right,this.bottom].join(t??"")}toJSON(){return this.validate(),{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}isEqual(t,s=18){return this.validate(),Jt(t)&&c(this.top,s)==c(t.top,s)&&c(this.left,s)==c(t.left,s)&&c(this.bottom,s)==c(t.bottom,s)&&c(this.right,s)==c(t.right,s)}isValid(){return!(this.top>this.bottom||this.right<this.left||this.width!==Qt(this.right-this.left)||this.height!==Qt(this.bottom-this.top))}isEmpty(){return this.isValid()&&this.width+this.height===0}contains(t){return zt(this,t)}overlaps(t){return!(t.left>this.right||t.right<this.left||t.top>this.bottom||t.bottom<this.top)}copy(){return this.validate(),new gi(this)}getCentre(){return this.validate(),new Ni(this.left+this.width/2,this.top+this.height/2)}getSize(){return this.validate(),new pi(this.width,this.height)}getTopLeft(){return this.validate(),new Ni(this.left,this.top)}getTopRight(){return this.validate(),new Ni(this.right,this.top)}getBottomLeft(){return this.validate(),new Ni(this.left,this.bottom)}getBottomRight(){return this.validate(),new Ni(this.right,this.bottom)}#s(t){t instanceof Array?t.forEach(this.#s,this):Ct(t)?(this.#s({x:t.x+t.r,y:t.y+t.r}),this.#s({x:t.x-t.r,y:t.y-t.r})):Ot(t)?((t.y<this.top||!u(this.top))&&(this.top=t.y),(t.x<this.left||!u(this.left))&&(this.left=t.x),(t.x>this.right||!u(this.right))&&(this.right=t.x),(t.y>this.bottom||!u(this.bottom))&&(this.bottom=t.y)):Jt(t)&&(this.#s({x:t.left,y:t.top}),this.#s({x:t.right,y:t.bottom}))}validate(){const t=this.top,s=this.left,e=this.bottom,i=this.right;return this.top=t<e?t:e,this.bottom=t>e?t:e,this.left=s<i?s:i,this.right=s>i?s:i,this}expand(t){return this.#s(t),this}extend(t){return this.#s(t),this.validate()}grow(t=0,s=0,e=""){return a(t)||(t=0),a(s)||(s=0),o(e)||(e=""),e.indexOf("top")>-1?this.top-=s:e.indexOf("bottom")>-1?this.bottom+=s:(this.top-=s/2,this.bottom+=s/2),e.indexOf("left")>-1?this.left-=t:e.indexOf("right")>-1?this.right+=t:(this.left-=t/2,this.right+=t/2),this.validate()}translateTo(t,s){return this.offsetTo(Mt(t,s))}offsetTo(t){const s=this.toOffset(t);return this.left=s.left,this.top=s.top,this.right=s.right,this.bottom=s.bottom,this}toTranslated(t,s){return this.toOffset(Mt(t,s))}toOffset(t){return this.validate(),new gi(new Ni(this.left+t.x,this.top+t.y),new Ni(this.right+t.x,this.bottom+t.y))}toRadial(t=!1){this.validate();const s=this.getCentre();return new fi(s.x,s.y,t?this.width>this.height?Ut(s,{x:this.left,y:this.top+this.height/2}):Ut(s,{x:this.left+this.width/2,y:this.top}):Ut(s,{x:this.left,y:this.top}))}}class fi{static fromJSON(t){return new fi(t?.x,t?.y,t?.r)}x=NaN;y=NaN;r=NaN;constructor(...t){u(t[0])&&u(t[1])&&u(t[2])?(this.x=t[0],this.y=t[1],this.r=t[2]):this.l(t)}toString(t=","){return[this.x,this.y,this.r].join(t??"")}toJSON(){return{x:this.x,y:this.y,r:this.r}}copy(){return new fi(this.x,this.y,this.r)}isEqual(t,s=18){return Ct(t)&&(c(this.x,s)===c(t.x,s)||isNaN(this.x)&&isNaN(t.x))&&(c(this.y,s)===c(t.y,s)||isNaN(this.y)&&isNaN(t.y))&&(c(this.r,s)===c(t.r,s)||isNaN(this.r)&&isNaN(t.r))}contains(t){return Ut(this,t)<=this.r}overlaps(t){return Ut(this,t)<=this.r+t.r}getCentre(){return new Ni(this.x,this.y)}getSize(){return new pi(2*this.r,2*this.r)}l(t){if(t instanceof Array)t.forEach(this.l,this);else{const s=this.getCentre();let e;Ct(t)?(e=Ut(s,t)+t.r)>this.r&&(this.r=e):Ot(t)&&(e=Ut(s,t))>this.r&&(this.r=e)}}extend(t){return this.l(t),this}grow(t){return this.r+=t,this}translateTo(t,s){return this.offsetTo(Mt(t,s))}offsetTo(t){const s=this.toOffset(t);return this.x=s.x,this.y=s.y,this}toTranslated(t,s){return this.toOffset(Mt(t,s))}toOffset(t){return new fi(this.x+t.x,this.y+t.y,this.r)}toRectangle(t=!1){const s=t?this.getCentre():null,e=s?s.toOffset(Mt(this.r,-45)):new Ni(this.x-this.r,this.y-this.r),i=s?s.toOffset(Mt(this.r,135)):new Ni(this.x+this.r,this.y+this.r);return new gi(e,i)}}class Ni{static fromJSON(t){return new Ni(t?.x,t?.y)}x;y;constructor(t,s){this.x=Ft(t),this.y=Ft(s)}toString(t=","){return[this.x,this.y].join(t??"")}toJSON(){return{x:this.x,y:this.y}}copy(){return new Ni(this.x,this.y)}isEqual(t,s=18){return Ot(t)&&(c(this.x,s)===c(t.x,s)||isNaN(this.x)&&isNaN(t.x))&&(c(this.y,s)===c(t.y,s)||isNaN(this.y)&&isNaN(t.y))}distanceTo(t){return Ut(this,t)}angleTo(t){return xt(this,t)}translateTo(t,s){return this.offsetTo(Mt(t,s))}offsetTo(t){const s=this.toOffset(t);return this.x=s.x,this.y=s.y,this}toTranslated(t,s){return this.toOffset(Mt(t,s))}toOffset(t){return new Ni(this.x+t.x,this.y+t.y)}toRadial(t){return new fi(this.x,this.y,t)}}class wi{static fromJSON(t){const s=new wi;return Rt(t)&&(s.east=t.east,s.north=t.north,s.west=t.west,s.south=t.south),s.validate()}north=NaN;east=NaN;south=NaN;west=NaN;constructor(...t){t.forEach((t=>this.l(t)))}toString(t=","){return[this.north,this.east,this.south,this.west].join(t??"")}toJSON(){return this.validate(),{north:this.north,east:this.east,south:this.south,west:this.west}}isEqual(t,s=1e-9){return Rt(t)&&mt(this.getNorthEast(),{lat:t.north,lng:t.east})<s&&mt(this.getSouthWest(),{lat:t.south,lng:t.west})<s}isValid(){return this.north>=this.south&&this.east>=this.west&&!(Qt(this.north)>90||Qt(this.south)>90||Qt(this.east)>180&&Qt(this.east)>180)}isEmpty(){return this.isValid()&&(mt(this.getNorthEast(),this.getNorthWest())<mi||mt(this.getNorthEast(),this.getSouthEast())<mi)}contains(t){this.validate();const s=ct(t.lat),e=lt(t.lng,s)+360;return e<=lt(this.east)+360&&e>=lt(this.west)+360&&pt(this.getNorthWest(),{lat:s,lng:e},this.getNorthEast())<=0&&pt(this.getSouthWest(),{lat:s,lng:e},this.getSouthEast())>=0}encloses(t){this.validate();const s=ct(t.north),e=lt(t.east,s)+360,i=ct(t.south),n=lt(t.west,i)+360;return e<=lt(this.east)+360&&n>=lt(this.west)+360&&pt(this.getNorthWest(),{lat:t.north,lng:t.west},this.getNorthEast())<=0&&pt(this.getSouthWest(),{lat:t.south,lng:t.east},this.getSouthEast())>=0}overlaps(t){this.validate();const s=new wi(t);return this.contains(s.getNorthEast())||this.contains(s.getNorthWest())||this.contains(s.getSouthWest())||this.contains(s.getSouthEast())||s.encloses(this)}l(t){if(t instanceof Array)t.forEach(this.l,this);else if(Rt(t)){const s=ct(t.north),e=lt(t.east,s),i=ct(t.south),n=lt(t.west,i);if((e>this.east||!u(this.east))&&(this.east=e),(n<this.west||!u(this.west))&&(this.west=n),!u(this.north)||s>this.north&&(this.east===e||this.west===n))this.north=s;else if(u(s)){const t={lat:s,lng:e},i=pt(this.getNorthWest(),t,this.getNorthEast());i>0&&(this.north=gt(t,i,0).lat)}if(!u(this.south)||i<this.south&&(this.east===e||this.west===n))this.south=i;else if(u(i)){const t={lat:i,lng:n},s=pt(this.getSouthEast(),t,this.getSouthWest());s>0&&(this.south=gt(t,s,180).lat)}}else if(Kt(t)){const s=ct(t.lat),e=lt(t.lng,s);if((e>this.east||!u(this.east))&&(this.east=e),(e<this.west||!u(this.west))&&(this.west=e),!u(this.north)||s>this.north&&(this.east===e||this.west===e))this.north=s;else if(u(s)){const t={lat:s,lng:e},i=pt(this.getNorthWest(),t,this.getNorthEast());i>0&&(this.north=gt(t,i,0).lat)}if(!u(this.south)||s<this.south&&(this.east===e||this.west===e))this.south=s;else if(u(s)){const t={lat:s,lng:e},i=pt(this.getSouthEast(),t,this.getSouthWest());i>0&&(this.south=gt(t,i,180).lat)}}}expand(t){return this.l(t),this}extend(t){return this.l(t),this.validate()}getCentre(){const t=this.getNorthEast(),s=this.getSouthWest(),e=gt(t,mt(t,s)/2,dt(t,s));return new yi(e.lat,e.lng)}getNorthEast(){return new yi(this.north,this.east)}getNorthWest(){return new yi(this.north,this.west)}getSouthEast(){return new yi(this.south,this.east)}getSouthWest(){return new yi(this.south,this.west)}getNorthMiddle(){const t=ft(this.getNorthEast(),this.getNorthWest());return new yi(t.lat,t.lng)}getSouthMiddle(){const t=ft(this.getSouthEast(),this.getSouthWest());return new yi(t.lat,t.lng)}getEastMiddle(){const t=ft(this.getNorthEast(),this.getSouthEast());return new yi(t.lat,t.lng)}getWestMiddle(){const t=ft(this.getNorthWest(),this.getSouthWest());return new yi(t.lat,t.lng)}getDiagonalDistance(){return mt(this.getNorthEast(),this.getSouthWest())}getLatitudinalDistance(){return mt(this.getNorthEast(),this.getSouthEast())}getLongitudinalDistance(){return Qt(this.north)<Qt(this.south)?mt(this.getNorthEast(),this.getNorthWest()):mt(this.getSouthEast(),this.getSouthWest())}validate(){const t=ct(this.north),s=lt(this.east,t),e=ct(this.south),i=lt(this.west,e);return this.north=t>e?t:e,this.south=e<t?e:t,this.east=s>i?s:i,this.west=i<s?i:s,this}}class yi{static INVALID=new yi(0,0);static fromJSON(t){return new yi(t?.lat,t?.lng)}static fromString(t,s=","){const e=t?.split(s??",");return new yi(e?.[0],e?.[1])}lat;lng;constructor(t,s){this.lat=ct(t),this.lng=lt(s)}toString(t=","){return[c(this.lat,6),c(this.lng,6)].join(t??",")}toJSON(){return this.isValid()?{lat:c(this.lat,6),lng:c(this.lng,6)}:{lat:0,lng:0}}isEqual(t,s=1e-9){return Kt(t)&&mt(this,t)<s}isValid(){return u(this.lat)&&u(this.lng)&&!this.isEqual(yi.INVALID)}distanceTo(t){return mt(this,t)}bearingTo(t){return dt(this,t)}toTranslated(t,s){const e=gt(this,t,s);return new yi(e.lat,e.lng)}toBetween(t){const s=ft(this,t);return new yi(s.lat,s.lng)}toRadians(t=1){const s=us(this.lat*ms);return new Ni((1+this.lng/180)*t,(1-.5/Xt*rs((1+s)/(1-s)))*t)}toBounds(t){const s=l(t,t);return new wi(gt(this,s,45),gt(this,s,-135))}}class Si{static fromJSON(t){return new Si(t.number,t.street,t.city,t.region,t.province,t.country,t.postal,t.isToll)}number;street;city;region;province;country;postal;isToll;constructor(t,s,e,i,n,r,h,a){this.number=String(t??"").trim(),this.street=String(s??"").trim(),this.city=String(e??"").trim(),this.region=String(i??"").trim(),this.province=String(n??"").trim(),this.country=String(r??"").trim(),this.postal=String(h??"").trim(),this.isToll=!!a}toString(){const t=[];return this.street&&t.push((this.number?this.number+" ":"")+this.street),this.city&&t.push(this.city),this.region&&t.push(this.region),this.province&&t.push(this.province),this.country&&t.push(this.country),this.postal&&t.push(this.postal),t.join(", ")}toJSON(){return{number:this.number,street:this.street,city:this.city,region:this.region,province:this.province,country:this.country,postal:this.postal,isToll:this.isToll}}}class vi extends yi{static fromJSON(t){return new vi(t?.lat,t?.lng,t?.speed,t?.bearing,t?.accuracy,t?.dts,t?.address,t?.speedLimit,t?.altitude,t?.streetAddress)}speed;bearing;altitude;accuracy;date=m();get dts(){return this.date.toISOString()}streetAddress=null;speedLimit;origin="";address;constructor(t,s,e,i,n,r,h,a,o,u){super(t,s),this.speed=!e||(e=Ft(e))<0?0:e,this.bearing=lt(Ft(i)),this.accuracy=Ft(n),this.date=m(r),this.address=String(h??""),this.speedLimit=Ft(a),this.altitude=Ft(o),u&&(this.streetAddress=Si.fromJSON(u))}toString(t=","){return t=t??"","("+super.toString(t)+t+this.speed+t+this.bearing+t+this.accuracy+t+this.altitude+t+T(this.date)+t+this.speedLimit+")"+(this.streetAddress?.toString()??this.address)}toJSON(){return{...super.toJSON(),dts:this.dts||"",speed:b(this.speed),speedLimit:b(this.speedLimit),bearing:b(this.bearing),altitude:b(this.altitude),accuracy:b(this.accuracy),address:this.address,streetAddress:this.streetAddress?.toJSON()||null}}isEqual(t){return!!(super.isEqual(t)&&a(t.speed)&&(t.speed===this.speed||isNaN(t.speed)&&isNaN(this.speed))&&a(t.bearing)&&(t.bearing===this.bearing||isNaN(t.bearing)&&isNaN(this.bearing))&&a(t.accuracy)&&(t.accuracy===this.accuracy||isNaN(t.accuracy)&&isNaN(this.accuracy))&&(t.dts||t.date instanceof Date)&&(t.dts===this.dts||t.date?.valueOf()===this.date.valueOf()||isNaN(t.date?.valueOf())&&isNaN(this.date.valueOf()))&&a(t.speedLimit)&&(t.speedLimit===this.speedLimit||isNaN(t.speedLimit)&&isNaN(this.speedLimit))&&a(t.altitude)&&(t.altitude===this.altitude||isNaN(t.altitude)&&isNaN(this.altitude))&&J(t.address)===J(this.address))}}const Ti=(ps?ps.protocol+ps.host+ps.pathname:(new Date).valueOf().toString(16)).match(/[a-z0-9]/gim).reduce((function(t,s){return t+Vt(s,36)}),0).toString(16).split("").reduce((function(t,s,e){return t[e]=s,t})," - -4 - - ".split("")),bi=/^!?[a-z0-9\-]+:/gim,Oi=/(!?(?:[#$]?[a-z0-9\-]+|"[^"]+"|'[^']+'|\*))/gim,Ci=/(?:!?[a-z0-9\-]+:\s*)?(?:(?:(!?(?:[#$]?[a-z0-9\-]+|"[^"]*"|'[^']*'|\*))(?:,\s*)?)+)?/gim,Ji=/("[^"]*"|'[^']*'|\|)/gm;class ki{static parse(t){const s=(t??"").split(Ji),e=[];let i="";for(let t=0,n=s.length;t<n;t++)"|"!==s[t]?i+=s[t]:(i&&e.push(new ki(i)),i="");return i&&e.push(new ki(i)),e}static stringify(t){const s=(t||[]).map((t=>t.toString()));return 0===s.length?null:s.some((t=>"*"===t))?"*":s.join("|")}operators=new Map;terms=[];constructor(t=""){const s=t?t.match(Ci):null;var e;s?.length&&(e=this,s.forEach(Lt,e),e.operators.forEach(Ht),Ht(e.terms))}get wildcard(){return!this.terms.length&&!this.operators.size}toString(){const t=[];return this.operators.forEach(((s,e)=>t.push(e+":"+(s?.join(",")||"*")))),(t.join(" ")+" "+this.terms.join(",")).trim()||"*"}toJSON=this.toString;copy(){const t=new ki;return this.operators.forEach(((s,e)=>t.operators.set(e,[...s]))),t.terms=[...this.terms],t}}class xi{static fromJSON(t){return new xi(t.name,t.simple,t.complex,t.raw,t.unit,t.provider,t.asset,t.dts,t.global)}name="";simple="";complex="";raw=null;unit="";providerId="";get provider(){return Vs.get(this.providerId)}assetId=NaN;get asset(){return Js.get(this.assetId)}dts=m();global=!1;constructor(t,s,e,i,n,r,h,a,o){this.name=t||"",this.simple=s||"",this.complex=e||"",this.raw=i||null,this.unit=n||"",this.providerId=r||"",this.assetId=d(h),this.dts=m(a),this.global=!!o}toJSON(){return{name:this.name,simple:this.simple,complex:this.complex,raw:this.raw||u(this.raw)||"string"==typeof this.raw?this.raw:null,provider:this.providerId||"",asset:b(this.assetId),dts:T(this.dts),global:!!this.global}}}var Ui,Ii,Mi,Ai,Di,Pi,Ei,zi,Ki,Ri,Bi,Li,ji,Hi,qi,Gi,_i,Vi;!function(t){t.enter="enter",t.inside="inside",t.exit="exit"}(Ui||(Ui={}));class Fi{static fromJSON(t){return new Fi(t.kind,t.enter,t.latest)}kind=Ui.inside;enter=m();latest=m();constructor(t,s,e){this.kind=Ui[t]||Ui.inside,this.enter=m(s),this.latest=m(e)}toJSON(){return{kind:Ui[this.kind]||Ui.inside,enter:T(this.enter),latest:T(this.latest)}}}class Wi extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}position=null;odometer=NaN;tags=[];attributes=new Map;providerIds=[];get providers(){return k(Vs,this.providerIds)}set providers(t){this.providerIds=t?.map((t=>t.id))??[]}relationshipIds=[];get relationships(){return k(Js,this.relationshipIds)}set relationships(t){this.relationshipIds=t?.map(e)??[]}places=new Map;engineHours=NaN;toJSON(){const t={id:this.id||null,v:[...this.v],company:this.companyId,position:this.position?.toJSON()||null,odometer:this.odometer||0,tags:[...this.tags],attributes:N(this.attributes),providers:[...this.providerIds],relationships:[...this.relationshipIds],places:N(this.places)};return u(this.engineHours)&&(t.engineHours=this.engineHours),t}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id=d(t.id),this.companyId=d(t.company),this.position=t.position?vi.fromJSON(t.position):null,this.odometer=Ft(t.odometer),this.tags=[...t.tags||[]],this.attributes=y(t.attributes||{},((t,s)=>[t,new xi(s)])),this.relationshipIds=(t.relationships||[]).map(d),this.places=y(t.places||{},((t,s)=>[d(t),new Fi(s)])),this.engineHours=Ft(t.engineHours)),e}getKey(){return this.id}}class Yi{static fromJSON(t){return new Yi(t.distance,t.duration,t.instructions,t.path,t.directions?.map(Yi.fromJSON),t.job,t.step)}distance;duration;instructions="";path;directions;job;step;constructor(t,s,e,i,n,r,h){this.distance=Ft(t),this.duration=new Be(s),this.instructions=e||"",this.path=i?.map(yi.fromJSON)??[],this.directions=n??[],this.job=d(r),this.step=d(h)}toJSON(){return{distance:this.distance||0,duration:this.duration.toString()||null,instructions:this.instructions||"",path:this.path.map(i),directions:this.directions.map(i),job:this.job||null,step:this.step||null}}}class $i extends _t{static fromJSON(t){return new $i(t)}id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}jobIds=[];get jobs(){return k(zs,this.jobIds)}set jobs(t){this.jobIds=t?.map(e)??[]}directions=[];lastDispatched=m();toJSON(){return{id:this.id||null,v:[...this.v],companyId:this.companyId||null,jobs:[...this.jobIds],directions:this.directions.map((t=>t.toJSON())),lastDispatched:this.lastDispatched.toISOString()}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id=d(t.id),this.companyId=d(t.company),this.jobIds=(t.jobs||[]).map(d),this.directions=(t.directions||[]).map(Yi.fromJSON),this.lastDispatched=m(t.lastDispatched)),e}getKey(){return this.id}}!function(t){t.asset="asset",t.person="person",t.trailer="trailer",t.vehicle="vehicle"}(Ii||(Ii={}));class Zi extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}kind=Ii.asset;name="";iconId=NaN;get icon(){return js.get(this.iconId)}set icon(t){this.iconId=t?.id??NaN}notes="";labels=[];pictureIds=[];get pictures(){return k(Ls,this.pictureIds)}set pictures(t){this.pictureIds=t?.map(e)??[]}messagingAddress="";references=new Map;contactId=NaN;get contact(){return vs.get(this.contactId)}set contact(t){this.contactId=t.id}vin="";plate="";make="";model="";year=NaN;colour="";serial="";toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,kind:Ii[this.kind]||null,name:this.name||"",notes:this.notes||"",icon:this.iconId,labels:[...this.labels],...this.suspended?{suspended:!0,since:T(this.since)}:{references:N(this.references),messagingAddress:this.messagingAddress,pictures:[...this.pictureIds],contact:this.contactId,vin:this.vin||"",plate:this.plate||"",make:this.make||"",model:this.model||"",year:this.year||null,colour:this.colour||"",serial:this.serial||""}}}fromJSON(t,s){!t.kind&&u(t.engineHours)&&(t.kind=Ii.vehicle);const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id=d(t.id),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.suspended=!!t.suspended,this.since=m(t.since),this.references=S(t.references||{}),this.labels=[...t.labels||[]],this.iconId=d(t.icon),this.pictureIds=(t.pictures||[]).map(d),this.messagingAddress=t.messagingAddress||"",this.contactId=d(t.contact),this.plate=t.plate||"",this.vin=t.vin||"",this.make=t.make||"",this.model=t.model||"",this.year=d(t.year)||0,this.colour=t.colour||"",this.serial=t.serial||""),e}getKey(){return this.id}suspended=!1;since=m()}class Xi extends Ue{get pieces(){return[this.h,this.o,this.m]}get id(){return this.h.id??this.o.id??this.m.id}get companyId(){return this.h.companyId??this.o.companyId??this.m.companyId}get company(){return this.h.company??this.o.company??this.m.company}get kind(){return this.h.kind}h=new Zi;get general(){return this.h}get name(){return this.h.name}set name(t){this.h.name=t}get notes(){return this.h.notes}set notes(t){this.h.notes=t}get iconId(){return this.h.iconId}set iconId(t){this.h.iconId=t}get icon(){return this.h.icon}set icon(t){this.h.icon=t}get labels(){return this.h.labels}set labels(t){this.h.labels=t}get pictureIds(){return this.h.pictureIds}set pictureIds(t){this.h.pictureIds=t}get pictures(){return this.h.pictures}set pictures(t){this.h.pictures=t}get messagingAddress(){return this.h.messagingAddress}set messagingAddress(t){this.h.messagingAddress=t}get references(){return this.h.references}set references(t){this.h.references=t}get contactId(){return this.general.contactId}set contactId(t){this.general.contactId=t}get contact(){return this.general.contact}set contact(t){this.general.contact=t}get plate(){return this.general.plate}get vin(){return this.general.vin}set vin(t){this.general.vin=t}get make(){return this.general.make}set make(t){this.general.make=t}get model(){return this.general.model}set model(t){this.general.model=t}get year(){return this.general.year}set year(t){this.general.year=t}get colour(){return this.general.colour}set colour(t){this.general.colour=t}get serial(){return this.general.serial}set serial(t){this.general.serial=t}o=new Wi;get advanced(){return this.o}get position(){return this.o.position}set position(t){this.o.position=t}get odometer(){return this.o.odometer}set odometer(t){this.o.odometer=t}get tags(){return this.o.tags}set tags(t){this.o.tags=t}get attributes(){return this.o.attributes}set attributes(t){this.o.attributes=t}get providerIds(){return this.o.providerIds}get providers(){return this.o.providers}get relationshipIds(){return this.o.relationshipIds}set relationshipIds(t){this.o.relationshipIds=t}get relationships(){return this.o.relationships}set relationships(t){this.o.relationships=t}get places(){return this.o.places}set places(t){this.o.places=t}get engineHours(){return this.advanced.engineHours}set engineHours(t){this.advanced.engineHours=t}m=new $i;get dispatch(){return this.m}toJSON(){return this.h.suspended?this.h.toJSON():{...this.h.toJSON(),...this.o.toJSON(),...this.m.toJSON(),v:[...this.v]}}fromJSON(t,s){const e=t?.v,i=this.h.fromJSON({...t,v:e.slice(0,1)},s),n=this.o.fromJSON({...t,v:e.slice(1,2)},s),r=this.m.fromJSON({...t,v:e.slice(2,3)},s);return i||n||r}getKey(){return this.id}get suspended(){return this.h.suspended}get since(){return this.h.since}}!function(t){t.boolean="boolean",t.number="number",t.text="text",t.json="json"}(Mi||(Mi={}));class Qi{static fromJSON(t){return new Qi(t.kind||t.type,t.value,t.notes,t.context)}kind;value;notes;context;constructor(t,s,e,i){this.kind=Mi[t]||Mi.text,this.value=s||"",this.notes=e||"",this.context=i||""}toJSON(){return{kind:Mi[this.kind]||Mi.text,value:this.value||"",notes:this.notes||"",context:this.context||""}}}class tn extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}scriptId=NaN;get script(){return Us.get(this.scriptId)}name="";notes="";priority=255;targets=null;filters=null;parameters=new Map;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId||null,script:this.scriptId||null,name:this.name||"",notes:this.notes||"",targets:ki.stringify(this.targets),filters:ki.stringify(this.filters),priority:this.priority||255,parameters:N(this.parameters)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.scriptId=d(t.script),this.name=t.name||"",this.notes=t.notes||"",this.priority=d(t.priority),this.targets=ki.parse(t.targets),this.filters=ki.parse(t.filters),this.parameters=y(t.parameters||{},((t,s)=>[t,Qi.fromJSON(s)]))),e}getKey(){return this.id}}!function(t){t.log="log",t.info="info",t.warn="warn",t.err="err"}(Ai||(Ai={}));class sn extends _t{id=NaN;assetId=NaN;get asset(){return Js.get(this.assetId)}companyId=NaN;get company(){return Ss.get(this.companyId)}behaviourId=NaN;get behaviour(){return xs.get(this.behaviourId)}scriptId=NaN;get script(){return Us.get(this.scriptId)}kind=Ai.log;dts=m();message="";line=NaN;character=NaN;toJSON(){return{id:this.id||null,v:[...this.v],asset:this.assetId||null,company:this.companyId||null,behaviour:this.behaviourId||null,script:this.scriptId||null,kind:Ai[this.kind]||Ai.log,dts:T(this.dts),message:this.message||"",line:this.line||-1,character:this.character||-1}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.assetId=d(t.asset),this.companyId=d(t.company),this.behaviourId=d(t.behaviour),this.scriptId=d(t.script),this.kind=Ai[t.kind]||Ai.log,this.dts=m(t.dts),this.message=t.message||"",this.line=d(t.line),this.character=d(t.character)),e}getKey(){return this.id}}class en extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";global=!1;source="";filters=null;parameters=new Map;fill="";stroke="";graphic="";toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId||null,name:this.name||"",notes:this.notes||"",global:!!this.global,source:this.source||"",filters:ki.stringify(this.filters),parameters:N(this.parameters),fill:this.fill||"",stroke:this.stroke||"",graphic:this.graphic||""}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.global=!!t.global,this.source=t.source||"",this.filters=ki.parse(t.filters),this.parameters=y(t.parameters||{},((t,s)=>[t,Qi.fromJSON(s)])),this.fill=t.fill||"",this.stroke=t.stroke||"",this.graphic=t.graphic||""),e}getKey(){return this.id}}!function(t){t.CAD="CAD",t.USD="USD",t.EURO="EURO"}(Di||(Di={})),function(t){t.monthly="monthly",t.quarterly="quarterly",t.annually="annually"}(Pi||(Pi={}));class nn{static fromJSON(t){return new nn(t.limit,t.amount)}limit=NaN;amount=NaN;constructor(t,s){this.limit=d(t),this.amount=Ft(s)}toJSON(){return{limit:b(this.limit),amount:b(this.amount)}}}class rn extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}targetId=NaN;get target(){return Ss.get(this.targetId)}billeeId=NaN;get billee(){return Ss.get(this.billeeId)}name="";notes="";messages=[];cycle=Pi.monthly;cycleStart=m();cycleEnd=m();cyclePostDated=!1;currency=Di.CAD;googleServicesEnabled=!1;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,target:this.targetId,billee:this.billeeId,name:this.name||"",notes:this.notes||"",messages:this.messages?.map(i)??[],cycle:Pi[this.cycle]||Pi.monthly,currency:Di[this.currency]||Di.CAD,cycleStart:u(this.cycleStart.valueOf())?this.cycleStart.toISOString():null,cycleEnd:u(this.cycleStart.valueOf())?this.cycleEnd.toISOString():null,cyclePostDated:!!this.cyclePostDated,googleServicesEnabled:!!this.googleServicesEnabled}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.targetId=d(t.target),this.billeeId=d(t.billee),this.name=t.name||"",this.notes=t.notes||"",this.messages=(t.messages||[]).map(nn.fromJSON),this.cycle=Pi[t.cycle]||Pi.monthly,this.cycleStart=m(t.cycleStart),this.cycleEnd=m(t.cycleEnd),this.cyclePostDated=!!t.cyclePostDated,this.currency=Di[t.cycle]||Di.CAD,this.googleServicesEnabled=!!t.googleServicesEnabled),e}getKey(){return this.id}}class hn extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}profileId=NaN;get profile(){return Ms.get(this.profileId)}name="";notes="";reference="";sku="";start=m();end=m();amount=NaN;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,profile:this.profileId,name:this.name||"",notes:this.notes||"",reference:this.reference||"",sku:this.sku||"",start:T(this.start),end:T(this.end),amount:b(this.amount)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.profileId=d(t.profile),this.name=t.name||"",this.notes=t.notes||"",this.reference=t.reference||"",this.sku=t.sku||"",this.start=m(t.start),this.end=m(t.end),this.amount=Ft(t.amount)),e}getKey(){return this.id}}class an extends hn{limit=NaN;targets=null;suspended=!1;toJSON(){return{...super.toJSON(),limit:b(this.limit),targets:ki.stringify(this.targets),suspended:!!this.suspended}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return super.fromJSON(t,e),e&&(this.limit=Ft(t.limit),this.targets=ki.parse(t.targets),this.suspended=!!t.suspended),e}}!function(t){t.smartwitness="smartwitness",t.bewhere="bewhere",t.calamp="calamp"}(Ei||(Ei={}));class on extends an{kind=Ei.bewhere;toJSON(){return{...super.toJSON(),kind:Ei[this.kind]}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return super.fromJSON(t,e),e&&(this.kind=Ei[t.kind]),e}}!function(t){t.mobile="mobile",t.vehicle="vehicle",t.asset="asset",t.dispatch="dispatch",t.elogs="elogs",t.inventory="inventory",t.cargo="cargo",t.forms="forms",t.streetview="streetview"}(zi||(zi={}));class un extends an{service=zi.asset;toJSON(){return{...super.toJSON(),service:zi[this.service]}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return super.fromJSON(t,e),e&&(this.service=zi[t.kind]),e}}!function(t){t.unknown="unknown",t.airlink="airlink",t.bluetree="bluetree",t.genx="genx",t.lmu="lmu",t.ttu="ttu",t.spiderAT="spiderAT",t.spiderMT="spiderMT",t.mobile="mobile",t.datatrans="datatrans",t.xirgo="xirgo",t.lbs="lbs",t.titan="titan",t.concox="concox",t.aspenta="aspenta",t.json="json",t.smartwitness="smartwitness",t.calamp="calamp",t.enfora="enfora",t.bewhere="bewhere",t.atrack="atrack",t.teltonika="teltonika"}(Ki||(Ki={}));class cn{static fromJSON(t){return new cn(t.provider,t.kind,t.name,t.notes,t.created,t.deleted,t.phoneNumber,t.firmware,t.billableDays,t.cost,t.total)}providerId="";get provider(){return Vs.get(this.providerId)}set provider(t){this.providerId=t?.id}kind;name="";notes="";created=m();deleted=m();phoneNumber=NaN;firmware="";billableDays=NaN;cost=NaN;total=NaN;constructor(t,s,e,i,n,r,h,a,o,u,c){this.providerId=t||"",this.kind=Ki[s]||Ki.unknown,this.name=e||"",this.notes=i||"",this.created=m(n),this.deleted=m(r),this.phoneNumber=g(h),this.firmware=a||"",this.billableDays=Ft(o),this.cost=Ft(u),this.total=Ft(c)}toJSON(){return{provider:this.providerId,kind:Ki[this.kind]??Ki.unknown,name:this.name||"",notes:this.notes||"",created:T(this.created),deleted:T(this.deleted),phoneNumber:b(this.phoneNumber),firmware:this.firmware||"",billableDays:b(this.billableDays),cost:b(this.cost),total:b(this.total)}}}class ln{static fromJSON(t){return new ln(t.asset,t.kind,t.name,t.notes,t.created,t.deleted,t.suspended,t.restored,t.revived,t.labels,t.providers,t.phoneNumbers,t.updatedDts,t.billableDays,t.cost,t.suspendedDays,t.suspendedCost,t.total)}assetId=NaN;get asset(){return Js.get(this.assetId)}set asset(t){this.assetId=t?.id||NaN}kind=Ii.asset;name="";notes="";created=m();deleted=m();suspended=m();restored=m();revived=m();labels=[];providerIds=[];get providers(){return k(Vs,this.providerIds)}set providers(t){this.providerIds=t?.map((t=>t.id))??[]}phoneNumbers=[];updatedDts=m();billableDays=NaN;cost=NaN;suspendedDays=NaN;suspendedCost=NaN;total=NaN;constructor(t,s,e,i,n,r,h,a,o,u,c,l,p,f,N,w,y,S){this.assetId=d(t),this.kind=Ii[s]||Ii.asset,this.name=e||"",this.notes=i||"",this.created=m(n),this.deleted=m(r),this.suspended=m(h),this.restored=m(a),this.revived=m(o),this.labels=u?.map(J)??[],this.providerIds=c||[],this.phoneNumbers=l?.map(g)??[],this.updatedDts=m(p),this.billableDays=Ft(f),this.cost=Ft(N),this.suspendedDays=Ft(w),this.suspendedCost=Ft(y),this.total=Ft(S)}toJSON(){return{asset:b(this.assetId),kind:Ii[this.kind]||null,name:this.name||"",notes:this.notes||"",created:T(this.created),deleted:T(this.deleted),suspended:T(this.suspended),restored:T(this.restored),revived:T(this.revived),labels:[...this.labels],providers:[...this.providerIds],phoneNumbers:[...this.phoneNumbers],revupdatedDtsived:T(this.updatedDts),billableDays:this.billableDays||0,cost:this.cost||0,suspendedDays:this.suspendedDays||0,suspendedCost:this.suspendedCost||0,total:this.total||0}}}class dn{static fromJSON(t){return new dn(t.target,t.services?.map(ln.fromJSON),t.licenses?.map(cn.fromJSON))}targetId=NaN;get target(){return Ss.get(this.targetId)}services=[];licenses=[];constructor(t,s,e){this.targetId=d(t),this.services=[...s||[]],this.licenses=[...e||[]]}toJSON(){return{target:b(this.targetId),services:[...this.services||[]],licenses:[...this.licenses||[]]}}}!function(t){t.created="created",t.queued="queued",t.running="running",t.completed="completed",t.failed="failed"}(Ri||(Ri={}));class mn{static fromJSON(t){return new mn(t.sku,t.cost,t.count,t.total)}sku="";cost=NaN;count=NaN;total=NaN;constructor(t,s,e,i){this.sku=t||"",this.cost=Ft(s),this.count=d(e),this.total=Ft(i)}toJSON(){return{sku:this.sku||"",cost:b(this.cost),count:b(this.count),total:b(this.total)}}}class pn{static fromJSON(t){return new pn(t.target,t.parent,t.name,t.notes,t.hosting?.map(mn.fromJSON))}targetId=NaN;get target(){return Ss.get(this.targetId)}parentId=NaN;get parent(){return Ss.get(this.parentId)}name="";notes="";hosting=[];constructor(t,s,e,i,n){this.targetId=d(t),this.parentId=d(s),this.name=e||"",this.notes=i||"",this.hosting=[...n||[]]}toJSON(){return{target:b(this.targetId),parent:b(this.parentId),name:this.name||"",notes:this.notes||"",hosting:this.hosting?.map(i)??[]}}}class gn extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}billeeId=NaN;get billee(){return Ss.get(this.billeeId)}profileId=NaN;get profile(){return Ms.get(this.profileId)}name="";notes="";startDate=m();endDate=m();total=NaN;currency=Di.CAD;status=Ri.created;error="";summary=[];breakdown=[];toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,billee:this.billeeId,profile:this.profileId,name:this.name||"",notes:this.notes||"",startDate:T(this.startDate),endDate:T(this.endDate),total:this.total||0,currency:Di[this.currency]||Di.CAD,status:Ri[this.status]||Ri.created,error:this.error||"",summary:this.summary?.map(i)??[],breakdown:this.breakdown?.map(i)??[]}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.billeeId=d(t.billee),this.profileId=d(t.profile),this.name=t.name||"",this.notes=t.notes||"",this.startDate=m(t.startDate),this.endDate=m(t.endDate),this.total=Ft(t.total),this.currency=Di[t.cycle]||Di.CAD,this.status=Ri[t.status]||Ri.created,this.error=t.error||"",this.summary=(t.summary||[]).map(pn.fromJSON),this.breakdown=(t.breakdown||[]).map(dn.fromJSON)),e}getKey(){return this.id}}class fn{static fromJSON(t){return new fn(t.fill,t.stroke)}fill="";stroke="";constructor(t,s){this.fill=t||"",this.stroke=s||""}toJSON(){return{fill:this.fill||"",stroke:this.stroke||""}}}class Nn extends _t{id=NaN;parentId=NaN;get parent(){return Ss.get(this.parentId)}employees=new Map;toJSON(){return{id:b(this.id),v:[...this.v],parent:this.parentId,directory:N(this.employees)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.parentId=d(t.parent),this.employees=S(t.directory||{})),e}getKey(){return this.id}set companyId(t){this.parentId=t}get companyId(){return this.parentId}set company(t){this.parentId=t?.id??NaN}get company(){return this.parent}}class wn extends _t{id=NaN;parentId=NaN;get parent(){return Ss.get(this.parentId)}name="";notes="";references=new Map;toJSON(){return{id:b(this.id),v:[...this.v],parent:this.parentId,name:this.name,notes:this.notes,references:N(this.references)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.parentId=d(t.parent),this.name=t.name||"",this.notes=t.notes||"",this.references=S(t.references||{})),e}getKey(){return this.id}set companyId(t){this.parentId=t}get companyId(){return this.parentId}set company(t){this.parentId=t?.id??NaN}get company(){return this.parent}}!function(t){t.never="never",t.days="days",t.sessions="sessions"}(Bi||(Bi={}));class yn{static fromJSON(t){return new yn(t.minimumLength,t.includeLetters,t.includeNumbers,t.includeUpperLower,t.includeSpecial,t.expireMode,t.expireThreshold)}minimumLength;includeLetters;includeNumbers;includeUpperLower;includeSpecial;expireMode;expireThreshold;constructor(t,s,e,i,n,r,h){this.minimumLength=d(t),this.includeLetters=!!s,this.includeNumbers=!!e,this.includeUpperLower=!!i,this.includeSpecial=!!n,this.expireMode=Bi[r]??Bi.never,this.expireThreshold=d(h)}toJSON(){return{minimumLength:b(this.minimumLength),includeLetters:!!this.includeLetters,includeNumbers:!!this.includeNumbers,includeUpperLower:!!this.includeUpperLower,includeSpecial:!!this.includeSpecial,expireMode:this.expireMode,expireThreshold:b(this.expireThreshold)}}}!function(t){t.allow="allow",t.deny="deny",t.replace="replace"}(Li||(Li={}));class Sn{static fromJSON(t){return new Sn(t.applications,t.ipv4Ranges,t.multiUser,t.idleAllowed,t.expireTimeout,t.maxSessions)}applications;ipv4Ranges;multiUser;idleAllowed;expireTimeout;maxSessions;constructor(t,s,e,i,n,r){this.applications=[...t||[]],this.ipv4Ranges=[...s||[]],this.multiUser=Li[e]||Li.allow,this.idleAllowed=!!i,this.expireTimeout=d(n)||0,this.maxSessions=d(r)||0}toJSON(){return{applications:[...this.applications],ipv4Ranges:[...this.ipv4Ranges],multiUser:Li[this.multiUser]||Li.allow,idleAllowed:!!this.idleAllowed,expireTimeout:b(this.expireTimeout),maxSessions:b(this.maxSessions)}}}class vn extends _t{id=NaN;parentId=NaN;get parent(){return Ss.get(this.parentId)}sessionPolicy=new Sn;passwordPolicy=new yn;toJSON(){return{id:b(this.id),v:[...this.v],parent:this.parentId,sessionPolicy:this.sessionPolicy?.toJSON()??null,passwordPolicy:this.passwordPolicy?.toJSON()??null}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.parentId=d(t.parent),this.sessionPolicy=Sn.fromJSON(t.sessionPolicy),this.passwordPolicy=yn.fromJSON(t.passwordPolicy)),e}getKey(){return this.id}set companyId(t){this.parentId=t}get companyId(){return this.parentId}set company(t){this.parentId=t?.id??NaN}get company(){return this.parent}}!function(t){t.IMAP="IMAP",t.POP3="POP3"}(ji||(ji={})),function(t){t.SMTP="SMTP"}(Hi||(Hi={}));class Tn{static fromJSON(t){return new Tn(t.incomingType,t.incomingAddress,t.incomingPort,t.incomingLogin,t.incomingSecure,t.incomingMessageNumber,t.outgoingType,t.outgoingAddress,t.outgoingPort,t.outgoingLogin,t.outgoingSecure,t.outgoingReplyTo)}incomingType=ji.IMAP;incomingAddress="";incomingPort=NaN;incomingLogin="";incomingSecure=!1;incomingMessageNumber=NaN;outgoingType=Hi.SMTP;outgoingAddress="";outgoingPort=NaN;outgoingLogin="";outgoingSecure=!1;outgoingReplyTo="";constructor(t,s,e,i,n,r,h,a,o,u,c,l){this.incomingType=ji[t]||ji.IMAP,this.incomingAddress=s||"",this.incomingPort=d(e),this.incomingLogin=i||"",this.incomingSecure=!!n,this.incomingMessageNumber=d(r),this.outgoingType=Hi[h]||Hi.SMTP,this.outgoingAddress=a||"",this.outgoingPort=d(o),this.outgoingLogin=u||"",this.outgoingSecure=!!c,this.outgoingReplyTo=l||""}toJSON(){return{incomingType:ji[this.incomingType]||ji.IMAP,incomingAddress:this.incomingAddress||"",incomingPort:b(this.incomingPort),incomingLogin:this.incomingLogin||"",incomingSecure:!!this.incomingSecure,incomingMessageNumber:b(this.incomingMessageNumber),outgoingType:Hi[this.outgoingType]||Hi.SMTP,outgoingAddress:this.outgoingAddress||"",outgoingPort:b(this.outgoingPort),outgoingLogin:this.outgoingLogin||"",outgoingSecure:!!this.outgoingSecure,outgoingReplyTo:this.outgoingReplyTo||""}}}class bn{static fromJSON(t){return new bn(t.notifyLimit,S(t.phoneNumbers||{}))}notifyLimit=NaN;phoneNumbers=new Map;constructor(t,s){this.notifyLimit=d(t),this.phoneNumbers=s??new Map}toJSON(){return{notifyLimit:b(this.notifyLimit),phoneNumbers:N(this.phoneNumbers)}}}class On extends _t{id=NaN;parentId=NaN;get parent(){return Ss.get(this.parentId)}contactInfo=new Map;serviceName="";logo="";icon="";favourite="";domain="";website=new Map;graphics=new Map;languages=[];gamut=new Map;notifyEmail=new Tn;notifySms=new bn;termsPreamble="";termsUpdated=m();recoverSubject="";recoverBody="";recoverIsHtml=!1;toJSON(){return{id:b(this.id),v:[...this.v],parent:this.parentId,contactInfo:N(this.contactInfo),serviceName:this.serviceName||"",logo:this.logo||"",icon:this.icon||"",favourite:this.favourite||"",domain:this.domain||"",website:N(this.website),graphics:N(this.graphics),languages:[...this.languages],gamut:N(this.gamut),notifyEmail:this.notifyEmail.toJSON(),notifySms:this.notifySms.toJSON(),termsPreamble:this.termsPreamble||"",termsUpdated:this.termsUpdated.valueOf()?this.termsUpdated.toISOString():null,recoverSubject:this.recoverSubject||"",recoverBody:this.recoverBody||"",recoverIsHtml:!!this.recoverIsHtml}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.parentId=d(t.parent),this.contactInfo=y(t.contactInfo||{},((t,s)=>[t,d(s)])),this.serviceName=t.serviceName||"",this.logo=t.logo||"",this.icon=t.icon||"",this.favourite=t.favourite||"",this.domain=t.domain||t.URN||t.urn||"",this.website=S(t.website||{}),this.graphics=S(t.graphics||{}),this.gamut=y(t.gamut||{},((t,s)=>[t,fn.fromJSON(s)])),this.languages=[...t.languages||[]],this.notifyEmail=Tn.fromJSON(t.notifyEmail),this.notifySms=bn.fromJSON(t.notifySms),this.termsPreamble=t.termsPreamble||"",this.termsUpdated=m(t.termsUpdated),this.recoverSubject=t.recoverSubject||"",this.recoverBody=t.recoverBody||"",this.recoverIsHtml=!!t.recoverIsHtml),e}getKey(){return this.id}set companyId(t){this.parentId=t}get companyId(){return this.parentId}set company(t){this.parentId=t?.id??NaN}get company(){return this.parent}}class Cn{static fromJSON(t){return new Cn(t.name,t.fill,t.stroke,t.graphic,t.notes)}name="";fill="";stroke="";graphic="";notes="";get code(){return J(this.name)}constructor(t,s,e,i,n){this.name=t||"",this.fill=s||"",this.stroke=e||"",this.graphic=i||"",this.notes=n||""}toJSON(){return{name:this.name,notes:this.notes,fill:this.fill,stroke:this.stroke,graphic:this.graphic}}}class Jn extends _t{id=NaN;parentId=NaN;get parent(){return Ss.get(this.parentId)}labels=new Map;tags=new Map;toJSON(){return{id:b(this.id),v:[...this.v],parent:this.parentId,labels:N(this.labels),tags:N(this.tags)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.parentId=d(t.parent),this.labels=y(t.labels,qt),this.tags=y(t.tags,qt)),e}getKey(){return this.id}set companyId(t){this.parentId=t}get companyId(){return this.parentId}set company(t){this.parentId=t?.id??NaN}get company(){return this.parent}}class kn extends Ue{get pieces(){return[this.h,null,this.p,this.N,this.S,this.reseller]}get id(){return this.h.id??this.p.id??this.S.id??this.N.id??this.reseller?.id}get parent(){return this.h.parent??this.p.parent??this.S.parent??this.N.parent??this.reseller?.parent}set parent(t){this.parentId=t?.id??NaN}get parentId(){return this.parent?.id??NaN}set parentId(t){this.h.parentId=t,this.p.parentId=t,this.S.parentId=t,this.N.parentId=t,this.reseller&&(this.reseller.parentId=t)}h=new wn;get name(){return this.h.name}set name(t){this.h.name=t}get notes(){return this.h.notes}set notes(t){this.h.notes=t}get references(){return this.h.references}set references(t){this.h.references=t}p=new Nn;get employees(){return this.p.employees}set employees(t){this.p.employees=t}S=new vn;get sessionPolicy(){return this.S.sessionPolicy}set sessionPolicy(t){this.S.sessionPolicy=t}get passwordPolicy(){return this.S.passwordPolicy}set passwordPolicy(t){this.S.passwordPolicy=t}N=new Jn;get labels(){return this.N.labels}set labels(t){this.N.labels=t}get tags(){return this.N.tags}set tags(t){this.N.tags=t}reseller=null;toJSON(){return{...this.h?.toJSON(),...this.p?.toJSON(),...this.N?.toJSON(),...this.S?.toJSON(),...this.reseller?.toJSON(),v:[...this.v]}}fromJSON(t,s){const e=t?.v||[],i=this.h.fromJSON({...t,v:e.slice(0,1)},s),n=this.p.fromJSON({...t,v:e.slice(2,3)},s),r=this.N.fromJSON({...t,v:e.slice(3,4)},s),h=this.S.fromJSON({...t,v:e.slice(4,5)},s);let a;return e[5]>0?(a=!this.reseller,a&&(this.reseller=new On),a=this.reseller?.fromJSON({v:e.slice(5,6)},s)??a):(a=!!this.reseller,this.reseller=null),i||n||r||h||a}getKey(){return this.id}set companyId(t){this.parentId=t}get companyId(){return this.parentId}set company(t){this.parentId=t?.id??NaN}get company(){return this.parent}get contacts(){return x(vs,this.id)}get pictures(){return x(Ls,this.id)}}!function(t){t.standby="standby",t.low="low",t.medium="medium",t.high="high",t.urgent="urgent"}(qi||(qi={}));class xn{static fromJSON(t){return new xn(t.updated,t.latlng)}updated=m();latlng;constructor(t,s){this.updated=m(t),this.latlng=s?yi.fromJSON(s):null}toJSON(){return{updated:T(this.updated),latlng:this.latlng?.toJSON()??null}}}!function(t){t.pending="pending",t.onRoute="onRoute",t.arrived="arrived",t.completed="completed"}(Gi||(Gi={}));class Un{static fromJSON(t){return new Un(t.id,t.name||"",y(t.states||{},((t,s)=>[t,xn.fromJSON(s)])),t.eta,t.duration,t.place,t.address,t.latlng,t.notes,t.signature,t.signatory)}id=NaN;name="";get status(){let t=Gi.pending,s=m(0);for(let[e,i]of this.states)i.updated>s&&(t=e,s=i.updated);return t}get updated(){let t=m(0);for(let[s,e]of this.states)e.updated>t&&(t=e.updated);return t}states=new Map;eta=m();duration=new Be;get timeOnSite(){return this.duration.totalSeconds??0}set timeOnSite(t){this.duration=Be.fromSeconds(t)}placeId=NaN;get place(){return _s.get(this.placeId)}set place(t){this.placeId=t?.id??NaN}address="";latlng;notes="";signature=!1;signatory="";constructor(t,s,e,i,n,r,h,a,o,u,c){this.id=d(t),this.address=h||"",this.duration=new Be(n),this.eta=m(i),this.latlng=a?yi.fromJSON(a):null,this.name=s||"",this.notes=o||"",this.placeId=d(r),this.signature=!!u,this.signatory=c||"",this.states=e??new Map}toJSON(){return{id:this.id||null,address:this.address||"",duration:this.duration.toString()??null,eta:this.eta.toISOString(),latlng:this.latlng?.toJSON()??null,name:this.name||"",notes:this.notes||"",place:this.placeId||null,signature:!!this.signature,signatory:this.signatory||"",states:N(this.states)}}}class In extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}assetId=NaN;get asset(){return Js.get(this.assetId)}set asset(t){this.assetId=t?.id||NaN}name="";references=new Map;instructions="";formIds=[];get forms(){return k(Bs,this.formIds)}set forms(t){this.formIds=t?.map(e)??[]}priority=qi.medium;labels=[];tags=[];steps=[];created=m();driver="";toJSON(){return{id:this.id||null,company:this.companyId||null,v:[...this.v],driver:this.driver||"",created:T(this.created),name:this.name||"",instructions:this.instructions||"",priority:this.priority||qi.standby,references:N(this.references),labels:[...this.labels],tags:this.tags||[],forms:[...this.formIds],steps:(this.steps||[]).map(i)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.created=m(t.created),this.assetId=d(t.asset)||NaN,this.driver=t.driver||"",this.name=t.name||"",this.instructions=t.instructions||"",this.priority=qi[t.priority]||qi.standby,this.references=S(t.references||{}),this.labels=[...t.labels||[]],this.tags=[...t.tags||[]],this.formIds=(t.forms||[]).map(d),this.steps=(t.steps||[]).map((t=>new Un(t)))),e}getKey(){return this.id}}!function(t){t.created="created",t.queued="queued",t.onRoute="onRoute",t.arrived="arrived",t.completed="completed",t.cancelled="cancelled",t.pickedUp="pickedUp",t.droppedOff="droppedOff",t.waiting="waiting",t.damaged="damaged",t.unsuccessful="unsuccessful"}(_i||(_i={}));class Mn extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}assetId=NaN;get asset(){return Js.get(this.assetId)}set asset(t){this.assetId=t?.id||NaN}name="";references=new Map;placeId=NaN;get place(){return _s.get(this.placeId)}set place(t){this.placeId=t?.id||NaN}address="";latlng=yi.INVALID;status=_i.created;created=m();eta=m();duration=new Be;arrived=m();completed=m();instructions="";signature=!1;signatory="";notes="";attachmentIds=[];get attachments(){return k(Ks,this.attachmentIds)}set attachments(t){this.attachmentIds=t?.map(e)??[]}updatedBy="";updatedUtc=m();toJSON(){return{id:this.id||null,company:this.companyId||null,asset:this.assetId||null,v:[...this.v],name:this.name||"",references:N(this.references),place:this.placeId||null,address:this.address||"",latlng:this.latlng.toJSON(),status:_i[this.status]||null,created:T(this.created),eta:T(this.eta),duration:this.duration.toString(),arrived:T(this.arrived),completed:T(this.completed),instructions:this.instructions||"",signature:!!this.signature,signatory:this.signatory||"",notes:this.notes||"",attachments:[...this.attachmentIds],updatedBy:this.updatedBy||"",updatedUtc:T(this.updatedUtc)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.assetId=d(t.asset),this.name=t.name||"",this.references=S(t.references||{}),this.placeId=d(t.place),this.address=t.address||"",this.latlng=t.latlng?yi.fromJSON(t.latlng):yi.INVALID,this.status=_i[t.status]||_i.created,this.created=m(t.created),this.eta=m(t.eta),this.duration=new Be(t.duration),this.arrived=m(t.arrived),this.completed=m(t.completed),this.instructions=t.instructions||"",this.signature=!!t.signature,this.signatory=t.signatory||"",this.notes=t.notes||"",this.attachmentIds=(t.attachments||[]).map(d),this.updatedBy=t.updatedBy||"",this.updatedUtc=m(t.updatedUtc)),e}getKey(){return this.id}}class An extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";src="";bytes=NaN;mime="";expiry=m();references=new Map;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,name:this.name||"",notes:this.notes||"",src:this.src||"",mime:this.mime||"",bytes:this.bytes||0,expiry:T(this.expiry),references:S(this.references)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.src=t.src||"",this.mime=t.mime||"",this.bytes=d(t.bytes)||0,this.expiry=m(t.expiry),this.references=S(t.references||{})),e}getKey(){return this.id}}!function(t){t.text="text",t.choice="choice",t.dropdown="dropdown",t.checkbox="checkbox",t.toggle="toggle",t.numeric="numeric",t.range="range",t.distance="distance",t.area="area",t.temperature="temperature",t.weight="weight",t.volume="volume",t.pressure="pressure",t.speed="speed",t.fuelEconomy="fuelEconomy",t.currency="currency",t.datetime="datetime",t.date="date",t.time="time",t.duration="duration",t.signature="signature",t.pictures="pictures",t.files="files",t.timezone="timezone"}(Vi||(Vi={}));class Dn{static fromJSON;get supported(){throw new Error("getter not implemented.")}kind;id;name;notes;required;value;editable;constructor(t,s,e,i,n,r,h){if(this.id=d(t),this.kind=Vi[e],this.name=s||"",this.notes=i||"",this.required=!!n,this.value=r??null,this.editable=!!h,!this.supported.includes(this.kind))throw new Error(`kind "${this.kind||""}" is not supported by this field type.`)}toJSON(){return{id:this.id||null,kind:this.kind,name:this.name||"",notes:this.notes||"",required:!!this.required,value:this.value??null,editable:!!this.editable}}}class Pn extends Dn{static split(t){return t?.split(",").map((t=>t.trim()))??[]}get supported(){return[Vi.pictures,Vi.files]}minimum;maximum;constructor(t,s,e,i,n,r,h,a,o){super(t,s,e,r,h,a,o),this.minimum=d(i),this.maximum=d(n)}toJSON(){return{...super.toJSON(),minimum:b(this.minimum),maximum:b(this.maximum)}}isValid(t){const s=Pn.split(t);return s.length>0&&(!u(this.minimum)||this.minimum<=s.length)&&(!u(this.maximum)||this.maximum>=s.length)&&s.every((function(t){return u(d(t))}))}}class En extends Dn{static DEFAULT_CHOICES=["true","false",""];static normalize(t){return[...t??[],null,null,null].slice(0,3).map(((t,s)=>t?.trim()??En.DEFAULT_CHOICES[s]))}get supported(){return[Vi.checkbox,Vi.toggle]}choices;constructor(t,s,e,i,n,r,h,a){super(t,s,e,n,r,h,a),this.choices=En.normalize(i)}toJSON(){return{...super.toJSON(),choices:[...this.choices]}}isValid(t){return En.normalize(this.choices).slice(0,this.required?2:3).includes(String(t??"").trim())}}const zn=/(?<!\\),/;class Kn extends Dn{static split(t){return t?.split(zn).map(Kn.unescape)??[]}static escape(t){return t?.trim()?.replaceAll(",","\\,")}static unescape(t){return t?.trim().replaceAll("\\,",",")}get supported(){return[Vi.choice,Vi.dropdown]}choices;minimum;maximum;constructor(t,s,e,i,n,r,h,a,o,u){super(t,s,e,h,a,o,u),this.choices=i??new Map,this.minimum=d(n),this.maximum=d(r)}toJSON(){return{...super.toJSON(),choices:N(this.choices),minimum:b(this.minimum),maximum:b(this.maximum)}}isValid(t){const s=Kn.split(t);return s.length>0&&(!u(this.minimum)||this.minimum<=s.length)&&(!u(this.maximum)||this.maximum>=s.length)&&s.filter((t=>this.choices.has(t))).length==s.length}}class Rn extends Dn{get supported(){return[Vi.date,Vi.datetime]}minimum;maximum;constructor(t,s,e,i,n,r,h,a,o){super(t,s,e,r,h,a,o),this.minimum=m(i),this.maximum=m(n)}toJSON(){return{...super.toJSON(),minimum:T(this.minimum),maximum:T(this.maximum)}}isValid(t){let s=m(t),e=u(s.valueOf()),i=m(this.minimum),n=m(this.maximum);return e&&this.kind==Vi.date&&(s=new Date(s.getFullYear(),s.getMonth(),s.getDate()),i=new Date(i.getFullYear(),i.getMonth(),i.getDate()),n=new Date(n.getFullYear(),n.getMonth(),n.getDate())),e&&(!u(i.valueOf())||i<=s)&&(!u(n.valueOf())||n>=s)}}var Bn,Ln,jn,Hn;!function(t){t.small="small",t.medium="medium",t.large="large"}(Bn||(Bn={}));class qn extends Dn{get supported(){return[Vi.numeric,Vi.range,Vi.distance,Vi.area,Vi.temperature,Vi.weight,Vi.volume,Vi.pressure,Vi.speed,Vi.fuelEconomy,Vi.currency]}size;precision;step;units;minimum;maximum;constructor(t,s,e,i,n,r,h,a,o,u,c,l,m){super(t,s,e,u,c,l,m),this.size=Bn[i]??Bn.medium,this.precision=d(n),this.step=Ft(r),this.units=h||"",this.minimum=Ft(a),this.maximum=Ft(o)}toJSON(){return{...super.toJSON(),size:Bn[this.size]??Bn.medium,precision:b(this.precision),step:b(this.step),units:this.units||"",minimum:b(this.minimum),maximum:b(this.maximum)}}isValid(t){let s=this.minimum,e=this.maximum,i=Ft(t),n=u(i);return n&&(i=c(i,this.precision),u(s)&&(s=c(s,this.precision)),u(e)&&(e=c(e,this.precision))),n&&(!u(s)||s<=i)&&(!u(e)||e>=i)}}class Gn extends Dn{get supported(){return[Vi.signature]}constructor(t,s,e,i,n,r){super(t,s,Vi.signature,e,i,n,r)}isValid(t){return!!String(t??"").trim()}}class _n extends Dn{get supported(){return[Vi.text]}rows;minimum;maximum;constructor(t,s,e,i,n,r,h,a,o){super(t,s,Vi.text,r,h,a,o),this.rows=d(e),this.minimum=Ft(i),this.maximum=Ft(n)}toJSON(){return{...super.toJSON(),rows:b(this.rows),minimum:b(this.minimum),maximum:b(this.maximum)}}isValid(t){return!!(t=String(t??"").trim())&&(!u(this.minimum)||this.minimum<=t.length)&&(!u(this.maximum)||this.maximum>=t.length)}}class Vn extends Dn{static MINIMUM_TIME_OF_DAY=Be.fromDays(0);static MAXIMUM_TIME_OF_DAY=Be.fromDays(1);get supported(){return[Vi.time,Vi.duration]}minimum;maximum;constructor(t,s,e,i,n,r,h,a,o){super(t,s,e,r,h,a,o),this.minimum=i||u(i)?new Be(i):null,this.maximum=n||u(n)?new Be(n):null}toJSON(){return{...super.toJSON(),minimum:u(this.minimum?.valueOf())?this.minimum.toString():null,maximum:u(this.maximum?.valueOf())?this.maximum.toString():null}}isValid(t){let s=!h(t),e=new Be(t),i=this.minimum,n=this.maximum;return s&&this.kind==Vi.time&&((!u(i?.valueOf())||i<Vn.MINIMUM_TIME_OF_DAY)&&(i=Vn.MINIMUM_TIME_OF_DAY),(!u(n?.valueOf())||n>Vn.MAXIMUM_TIME_OF_DAY)&&(n=Vn.MAXIMUM_TIME_OF_DAY)),s&&(!u(i?.valueOf())||i<=e)&&(!u(n?.valueOf())||n>=e)}}class Fn extends Dn{get supported(){return[Vi.timezone]}constructor(t,s,e,i,n,r){super(t,s,Vi.timezone,e,i,n,r)}isValid(t){return!(!(t=String(t??""))||!U(t))}}Dn.fromJSON=function(t){switch(t.kind){case Vi.text:return new _n(t.id,t.name,t.rows,t.minimum,t.maximum,t.notes,t.required,t.value,t.editable);case Vi.choice:case Vi.dropdown:return new Kn(t.id,t.name,t.kind,S(t.choices),t.minimum,t.maximum,t.notes,t.required,t.value,t.editable);case Vi.checkbox:case Vi.toggle:return new En(t.id,t.name,t.kind,t.choices,t.notes,t.required,t.value,t.editable);case Vi.area:case Vi.numeric:case Vi.range:case Vi.distance:case Vi.temperature:case Vi.weight:case Vi.volume:case Vi.pressure:case Vi.speed:case Vi.fuelEconomy:case Vi.currency:return new qn(t.id,t.name,t.kind,t.size,t.precision,t.step,t.units,t.minimum,t.maximum,t.notes,t.required,t.value,t.editable);case Vi.datetime:case Vi.date:return new Rn(t.id,t.name,t.kind,t.minimum,t.maximum,t.notes,t.required,t.value,t.editable);case Vi.duration:case Vi.time:return new Vn(t.id,t.name,t.kind,t.minimum,t.maximum,t.notes,t.required,t.value,t.editable);case Vi.signature:return new Gn(t.id,t.name,t.notes,t.required,t.value,t.editable);case Vi.pictures:case Vi.files:return new Pn(t.id,t.name,t.kind,t.minimum,t.maximum,t.notes,t.required,t.value,t.editable);case Vi.timezone:return new Fn(t.id,t.name,t.notes,t.required,t.value,t.editable);default:throw new Error("kind unsupported")}};class Wn extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}templateId=NaN;get template(){return Rs.get(this.templateId)}set template(t){this.templateId=t?.id??NaN}assetId=NaN;get asset(){return Js.get(this.assetId)}name="";notes="";labels=[];fields=new Map;completed=m();latlng=null;driver="";getKey(){return this.id}toJSON(){return{id:this.id,company:this.companyId,v:[...this.v],template:this.templateId||null,asset:this.assetId||null,name:this.name||"",notes:this.notes||"",labels:[...this.labels],fields:N(this.fields),completed:T(this.completed),latlng:this.latlng?.toJSON()??null,driver:this.driver||null}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id=d(t.id),this.companyId=d(t.company),this.templateId=d(t.template),this.assetId=d(t.asset),this.name=t.name||"",this.notes=t.notes||"",this.labels=[...t.labels||[]],this.fields=function(t,s=!1){return y(t,((t,e)=>[d(t),s?r(e):e]))}(t.fields||{}),this.completed=m(t.completed),this.latlng=t.latlng?yi.fromJSON(t.latlng):null,this.driver=t.driver||""),e}}class Yn extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";labels=[];fill="";stroke="";graphic="";fields=[];getKey(){return this.id}toJSON(){return{id:b(this.id),company:b(this.companyId),v:[...this.v],name:this.name||"",notes:this.notes||"",labels:[...this.labels],fields:this.fields.map(i),fill:this.fill||"",stroke:this.stroke||"",graphic:this.graphic||""}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.companyId),this.name=t.name||"",this.notes=t.notes||"",this.labels=[...t.labels||[]],this.fields=(t.fields||[]).map(Dn.fromJSON),this.fill=t.fill||"",this.stroke=t.stroke||"",this.graphic=t.graphic||""),e}}class $n{bytes;size;providerId;get provider(){return Vs.get(this.providerId)}companyId;get company(){return Ss.get(this.companyId)}assetId;get asset(){return Js.get(this.assetId)}camera;latitude;longitude;speed;heading;altitude;constructor(t){t&&this.fromJSON(t)}fromJSON(t,s){return t&&(this.bytes=d(t.bytes),this.size=t.size?pi.fromJSON(t.size):new pi(0,0),this.providerId=t.provider||"",this.companyId=d(t.company),this.assetId=d(t.asset),this.camera=d(t.camera),this.latitude=Ft(t.latitude),this.longitude=Ft(t.longitude),this.speed=Ft(t.speed),this.heading=Ft(t.heading),this.altitude=Ft(t.altitude)),!!t}toJSON(){return{bytes:b(this.bytes),size:this.size.toJSON(),provider:this.providerId||"",company:b(this.companyId),asset:b(this.assetId),camera:b(this.camera),latitude:b(this.latitude),longitude:b(this.longitude),speed:b(this.speed),heading:b(this.heading),altitude:b(this.altitude)}}}!function(t){t.unknown="unknown",t.image="image",t.video="video"}(Ln||(Ln={}));class Zn extends $n{guid;kind;fps;start;end;get duration(){return new Be(this.end-this.start)}eventName;fromJSON(t,s){const e=super.fromJSON(t,s)||!!t;return t&&(this.guid=t.guid||"",this.kind=Ln[t.kind]||Ln.unknown,this.fps=Ft(t.fps),this.start=m(t.start),this.end=m(t.end),this.eventName=t.eventName||""),e}toJSON(){return{...super.toJSON(),guid:this.guid||"",kind:Ln[this.kind]||Ln.unknown,fps:b(this.fps),start:T(this.start),end:T(this.end),eventName:this.eventName||""}}getKey(){return this.guid}}class Xn extends $n{kind=Ln.image;dts;fromJSON(t,s){const e=super.fromJSON(t,s)||!!t;return t&&(this.dts=m(t.dts)),e}toJSON(){return{...super.toJSON(),kind:Ln.image,dts:T(this.dts)}}getKey(){return(b(this.assetId)??0)+"-"+this.providerId+"-"+this.camera}}!function(t){t.fills="fills",t.shadows="shadows",t.outlines="outlines",t.markers="markers",t.labels="labels",t.drawings="drawings",t.edits="edits"}(jn||(jn={}));class Qn{static fromJSON(t){return new Qn(t.tags,t.src,t.size,t.anchor,t.layer,t.zIndex,t.rotates)}tags;src;size;anchor;layer;zIndex;rotates;constructor(t,s,e,i,n,r,h){this.tags=[...t||[]],this.src=s||"",this.size=pi.fromJSON(e),this.anchor=Ni.fromJSON(i),this.layer=jn[n]||jn.markers,this.zIndex=d(r)||0,this.rotates=!!h}toJSON(){return{tags:[...this.tags],src:this.src||"",size:this.size.toJSON(),anchor:this.anchor.toJSON(),layer:jn[this.layer]||jn.markers,zIndex:b(this.zIndex),rotates:!!this.rotates}}isEqual(t){return!!t&&this.tags.length===t.tags.length&&this.tags.every(((s,e)=>s===t.tags[e]))&&this.src===t.src&&this.size.isEqual(t.size)&&this.anchor.isEqual(t.anchor)&&this.layer===t.layer&&this.zIndex===t.zIndex&&this.rotates===t.rotates}}class tr{static fromJSON(t){return new tr(t?.anchor,t?.align,t?.colour)}anchor;align;colour;constructor(t,s,e){this.anchor=Ni.fromJSON(t),this.align=s||"right top",this.colour=e||"#cccccc"}toJSON(){return{align:this.align||"",anchor:this.anchor.toJSON(),colour:this.colour||""}}isEqual(t){return!!t&&this.align===t.align&&this.anchor.isEqual(t.anchor)&&this.colour===t.colour}}class sr extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}category="";name="";notes="";global=!1;usage=[];label=new tr;badge=new tr;glyphs=[];toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,category:this.category||"",name:this.name||"",notes:this.notes||"",global:!!this.global,usage:[...this.usage],label:this.label.toJSON(),badge:this.badge.toJSON(),glyphs:this.glyphs.map(i)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id=d(t.id),this.companyId=d(t.company),this.category=t.category||"",this.name=t.name||"",this.notes=t.notes||"",this.global=!!t.global,this.usage=t.usage?.map(J)??[],this.label=tr.fromJSON(t.label),this.badge=tr.fromJSON(t.badge),this.glyphs=t.glyphs?.map((t=>Qn.fromJSON(t)))??[]),e}getKey(){return this.id}}class er extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";src="";size=new pi(0,0);focals=[];bytes=NaN;uses=NaN;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,name:this.name||"",notes:this.notes||"",src:this.src||"",size:this.size.toJSON(),focals:this.focals.map(i),bytes:u(this.bytes)?this.bytes:null,uses:u(this.uses)?this.uses:null}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.src=t.src||"",this.size=pi.fromJSON(t.size),this.focals=(t.focals||[]).map((t=>gi.fromJSON(t))),this.bytes=d(t.bytes),this.uses=d(t.uses)),e}getKey(){return this.id}}class ir{static fromJSON(t){return new ir(t.asset,t.date,t.odometer,t.engineHours,t.lastJob)}assetId;get asset(){return Js.get(this.assetId)}date;odometer;engineHours;lastJobId;get lastJob(){return Gs.get(this.lastJobId)}constructor(t,s,e,i,n){this.assetId=d(t),this.date=m(s),this.odometer=Ft(e),this.engineHours=Ft(i),this.lastJobId=d(n)}toJSON(){return{asset:this.assetId||null,date:T(this.date),odometer:this.odometer||0,engineHours:this.engineHours||0,lastJob:this.lastJobId||null}}}!function(t){t.pending="pending",t.pastdue="pastdue",t.completed="completed",t.cancelled="cancelled"}(Hn||(Hn={}));class nr extends _t{id=NaN;assetId=NaN;get asset(){return Js.get(this.assetId)}companyId=NaN;get company(){return Ss.get(this.companyId)}scheduleId=NaN;get schedule(){return qs.get(this.scheduleId)}set schedule(t){this.scheduleId=t?.id}name="";notes="";status=Hn.pending;created=m();completed=m();odometer=NaN;engineHours=NaN;garage="";duration=new Be;cost=NaN;reference="";technician="";pictureIds=[];get pictures(){return k(Ls,this.pictureIds)}set pictures(t){this.pictureIds=t?.map(e)??[]}toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,asset:this.assetId,schedule:this.scheduleId,name:this.name||"",notes:this.notes||"",status:this.status,created:T(this.created),completed:T(this.completed),odometer:this.odometer,engineHours:this.engineHours,garage:this.garage,cost:this.cost,duration:this.duration.toString(),reference:this.reference,technician:this.technician,pictures:[...this.pictureIds]}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.assetId=d(t.asset),this.scheduleId=d(t.schedule),this.name=t.name||"",this.notes=t.notes||"",this.status=Hn[t.status]||Hn.pending,this.created=m(t.created),this.completed=m(t.completed),this.odometer=Ft(t.odometer),this.engineHours=Ft(t.engineHours),this.garage=t.garage||"",this.cost=Ft(t.cost),this.duration=new Be(t.duration),this.reference=t.reference||"",this.technician=t.technician||"",this.pictureIds=(t.pictures||[]).map(d)),e}getKey(){return this.id}}class rr extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";targets=null;notify=[];fill="";stroke="";graphic="";predictionDays=14;recurDays=NaN;recurDistance=NaN;recurEngineHours=NaN;intervals=new Map;garage="";duration=new Be;cost=NaN;reference="";toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,name:this.name||"",notes:this.notes||"",notify:[...this.notify],targets:ki.stringify(this.targets),fill:this.fill||"",stroke:this.stroke||"",graphic:this.graphic||"",garage:this.garage||"",cost:this.cost||0,duration:this.duration.toString(),reference:this.reference||"",predictionDays:this.predictionDays||14,recurDays:this.recurDays||null,recurDistance:this.recurDistance||null,recurEngineHours:this.recurEngineHours||null,intervals:N(this.intervals)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.notify=t.notify||[],this.targets=ki.parse(t.targets),this.fill=t.fill||"",this.stroke=t.stroke||"",this.graphic=t.graphic||"",this.garage=t.garage||"",this.cost=Ft(t.cost),this.duration=new Be(t.duration),this.reference=t.reference||"",this.predictionDays=d(t.predictionDays)||14,this.recurDays=d(t.recurDays),this.recurDistance=Ft(t.recurDistance),this.recurEngineHours=Ft(t.recurEngineHours),this.intervals=y(t.intervals||{},((t,s)=>[d(t),ir.fromJSON(s)]))),e}getKey(){return this.id}}var hr,ar,or,ur,cr,lr,dr,mr,pr,gr,fr,Nr,wr,yr;!function(t){t.low="low",t.normal="normal",t.high="high"}(hr||(hr={})),function(t){t.created="created",t.processed="processed",t.failed="failed",t.throttled="throttled",t.bounceback="bounceback",t.acknowledged="acknowledged"}(ar||(ar={})),function(t){t.unknown="unknown",t.sms="sms",t.email="email",t.pnd="pnd",t.gcm="gcm",t.apn="apn",t.socket="socket"}(or||(or={}));class Sr extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}status=ar.created;kind=or.unknown;to="";from="";body="";processed=m();delivered=m();subject="";assetId=NaN;get asset(){return Js.get(this.assetId)}userLogin="";get user(){return bs.get(this.userLogin)}toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,status:ar[this.status]||ar.created,kind:or[this.kind]||or.unknown,to:this.to||"",from:this.from||"",body:this.body||"",processed:T(this.processed),delivered:T(this.delivered),subject:this.subject||"",asset:this.assetId,user:this.userLogin||""}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.status=ar[t.status]||ar.created,this.kind=or[t.kind]||or.unknown,this.to=t.to||"",this.from=t.from||"",this.body=t.body||"",this.processed=m(t.processed),this.delivered=m(t.delivered),this.subject=t.subject||"",this.assetId=d(t.asset),this.userLogin=t.userLogin||""),e}getKey(){return this.id}}class vr extends Sr{priority=hr.normal;toJSON(){return{...super.toJSON(),priority:hr[this.priority]||hr.normal}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return super.fromJSON(t,e),e&&(this.priority=hr[t.folder]||hr.normal),e}}!function(t){t.inbox="inbox",t.archive="archive"}(ur||(ur={}));class Tr extends Sr{folder=ur.archive;incoming=!1;readBy="";toJSON(){return{...super.toJSON(),folder:ur[this.folder]||ur.archive,incoming:!!this.incoming,readBy:this.readBy||""}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return super.fromJSON(t,e),e&&(this.folder=ur[t.folder]||ur.archive,this.incoming=!!t.incoming,this.readBy=t.readBy||""),e}}!function(t){t.point="point",t.radial="radial",t.polygon="polygon",t.rectangle="rectangle"}(cr||(cr={}));class br extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}kind=cr.point;name="";address="";iconId=NaN;get icon(){return js.get(this.iconId)}set icon(t){this.iconId=t?.id??NaN}notes="";labels=[];colour="";pictureIds=[];get pictures(){return k(Ls,this.pictureIds)}set pictures(t){this.pictureIds=t?.map(e)??[]}reference="";anchor=null;radius=NaN;points=null;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,icon:this.iconId,name:this.name||"",notes:this.notes||"",address:this.address||"",kind:cr[this.kind]||cr.point,labels:[...this.labels],colour:this.colour||"",pictures:[...this.pictureIds],reference:this.reference||"",anchor:this.anchor?.toJSON()??null,radius:this.radius||null,shape:this.points?.length>0?yt(this.points||[]):null}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.iconId=d(t.icon),this.name=t.name||"",this.notes=t.notes||"",this.address=t.address||"",this.kind=cr[t.kind]||cr.point,this.labels=(t.labels||[]).map(J),this.colour=t.colour||"",this.pictureIds=(t.pictures||[]).map(d),this.reference=t.reference||"",this.anchor=t.anchor?yi.fromJSON(t.anchor):null,this.radius=Ft(t.radius),this.points=("string"==typeof t.shape?St(t.shape,6):t.shape?t.shape:null)?.map(yi.fromJSON)??null),e}getKey(){return this.id}}class Or extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}scriptId=NaN;get script(){return Fs.get(this.scriptId)}set script(t){this.scriptId=t?.id??NaN}name="";notes="";parameters=new Map;geofences=null;toJSON(){return{id:b(this.id),v:[...this.v],company:b(this.companyId),script:b(this.scriptId),name:this.name||"",notes:this.notes||"",parameters:N(this.parameters),geofences:ki.stringify(this.geofences)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.scriptId=d(t.script),this.name=t.name||"",this.notes=t.notes||"",this.parameters=S(t.parameters||{}),this.geofences=ki.parse(t.geofences)),e}getKey(){return this.id}}class Cr extends Gt{code="";companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";password="";userLogin="";get user(){return bs.get(this.userLogin)}configId=NaN;get config(){return Ws.get(this.configId)??$s.get(this.configId)}kind=Ki.unknown;since=m();completed=m();expires=m();identifier="";assetId=NaN;get asset(){return Js.get(this.assetId)}phoneNumber=NaN;toJSON(){return{code:this.code||null,company:this.companyId||null,name:this.name||"",notes:this.notes||"",password:this.password||"",user:this.userLogin||"",config:this.configId||null,kind:Ki[this.kind]||Ki.unknown,since:T(this.since),completed:T(this.completed),expires:T(this.expires),identifier:this.identifier||"",asset:this.assetId||null,phoneNumber:this.phoneNumber||null}}fromJSON(t,s){return u(d(this.code))||(this.code=t.code),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.password=t.password||"",this.userLogin=t.userLogin||"",this.configId=d(t.config),this.kind=Ki[t.kind]||Ki.unknown,this.since=m(t.password),this.completed=m(t.completed),this.expires=m(t.expires),this.identifier=t.identifier||"",this.assetId=d(t.asset),this.phoneNumber=g(t.phoneNumber),!0}getKey(){return this.code}}class Jr{static fromJSON(t){return new Jr(t.content,t.replace,t.condition,t.validate)}content;replace;condition;validate;constructor(t,s,e,i){this.content=t||"",this.replace=s||"",this.condition=e||"",this.validate=i||""}toJSON(){return{content:this.content||"",replace:this.replace||"",condition:this.condition||"",validate:this.validate||""}}}!function(t){t.boolean="boolean",t.number="number",t.text="text"}(lr||(lr={}));class kr{static fromJSON(t){return new kr(t.kind,t.value,t.notes,t.context,t.order,t.advanced)}kind;value;notes;context;order;advanced;constructor(t,s,e,i,n,r){this.kind=lr[t]||lr.text,this.value=s||"",this.notes=e||"",this.context=i||"",this.order=d(n),this.advanced=!!r}toJSON(){return{kind:lr[this.kind]||lr.text,value:this.value||"",notes:this.notes||"",context:this.context||"",order:d(this.order)||0,advanced:!!this.advanced}}}class xr extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";fill="";stroke="";graphic="";global=!1;kind=Ki.unknown;blocks=[];parameters=new Map;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,name:this.name||"",notes:this.notes||"",fill:this.fill||"",stroke:this.stroke||"",graphic:this.graphic||"",global:!!this.global,kind:Ki[this.kind]||Ki.unknown,blocks:this.blocks.map(i),parameters:N(this.parameters)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.fill=t.fill||"",this.stroke=t.stroke||"",this.graphic=t.graphic||"",this.global=!!t.global,this.kind=Ki[t.kind]||Ki.unknown,this.blocks=t.blocks?.map(Jr.fromJSON)??[],this.parameters=y(t.parameters||{},((t,s)=>[t,kr.fromJSON(s)]))),e}getKey(){return this.id}}class Ur extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}name="";notes="";typeId=NaN;get type(){return Ys.get(this.typeId)}scriptParameters=new Map;geofences=[];toJSON(){return{id:this.id,company:this.companyId,v:[...this.v],name:this.name||"",notes:this.notes||"",type:this.typeId||null,scriptParameters:N(this.scriptParameters),geofences:this.geofences||""}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.typeId=d(t.type),this.scriptParameters=S(t.scriptParameters||{}),this.geofences=t.geofences||[]),e}getKey(){return this.id}}class Ir{static nodesFromJSON(t){const s=new Map;return Yt(t).forEach((e=>s.set(e,Ir.fromJSON(t[e]||{})))),s}static fromJSON(t){return new Ir(t.id,t.notes,t.isAdvanced,t.type,t.min,t.max,t.value,t.unit,Ir.nodesFromJSON(t.nodes))}isAdvanced;id;value;min;max;type;unit;notes;nodes;constructor(t,s,e,i,n,r,h,a,o){this.id=t||"",this.notes=s||"",this.isAdvanced=!!e,this.type=i||"",this.min=n,this.max=r,this.value=h,this.unit=a||"",this.nodes=o||new Map}toJSON(){return{id:this.id||"",value:this.value,min:this.min,max:this.max,type:this.type||"",unit:this.unit||"",notes:this.notes||"",isAdvanced:!!this.isAdvanced,nodes:N(this.nodes)}}}class Mr extends _t{id=NaN;name="";notes="";providerType=Ki.unknown;maxGeofenceCount=NaN;minGeofenceCount=NaN;scriptOptions=new Map;geofenceTypes=[];toJSON(){return{id:this.id,v:[...this.v],name:this.name||"",notes:this.notes||"",providerType:Ki[this.providerType]||Ki.unknown,maxGeofenceCount:b(this.maxGeofenceCount),minGeofenceCount:b(this.minGeofenceCount),scriptOptions:N(this.scriptOptions),geofenceTypes:this.geofenceTypes.map((t=>cr[t]||null))}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.name=t.name||"",this.notes=t.notes||"",this.providerType=Ki[t.providerType]||Ki.unknown,this.maxGeofenceCount=d(t.maxGeofenceCount),this.minGeofenceCount=d(t.minGeofenceCount),this.scriptOptions=Ir.nodesFromJSON(t.scriptOptions),this.geofenceTypes=t.geofenceTypes?.map((t=>cr[t]))??[]),e}getKey(){return this.id}}class Ar{static fromJSON;maxGeofenceCount;constructor(t){this.maxGeofenceCount=d(t)||0}toJSON(){return{type:cr[this.type]||null,maxGeofenceCount:this.maxGeofenceCount||0}}}class Dr extends Ar{get type(){return cr.radial}minRadius;maxRadius;constructor(t,s,e){super(t),this.minRadius=Ft(s),this.maxRadius=Ft(e)}toJSON(){return{...super.toJSON(),minRadius:b(this.minRadius),maxRadius:b(this.maxRadius)}}}class Pr extends Ar{get type(){return cr.point}}class Er extends Ar{get type(){return cr.polygon}maxVertices;constructor(t,s){super(t),this.maxVertices=d(s)}toJSON(){return{...super.toJSON(),maxVertices:b(this.maxVertices)}}}class zr extends Ar{get type(){return cr.rectangle}maxLength;maxWidth;constructor(t,s,e){super(t),this.maxLength=d(s),this.maxWidth=d(e)}toJSON(){return{...super.toJSON(),maxLength:b(this.maxLength),maxWidth:b(this.maxWidth)}}}Ar.fromJSON=function(t){switch(cr[t.type]){case cr.point:return new Pr(t.maxGeofenceCount);case cr.radial:return new Dr(t.maxGeofenceCount,t.minRadius,t.maxRadius);case cr.rectangle:return new zr(t.maxGeofenceCount,t.maxLength,t.maxWidth);case cr.polygon:return new Er(t.maxGeofenceCount,t.maxVertices);default:throw new Error("Unsopported type:"+t.type)}};class Kr{static fromJSON(t){return new Kr(t.value,t.dts,t.unit)}value=null;dts=m();unit="";constructor(t,s,e){this.value=h(t)?null:t,this.dts=m(s),this.unit=e||""}toJSON(){return{value:h(this.value)?null:this.value,dts:T(this.dts),unit:this.unit||""}}}class Rr extends _t{id="";companyId=NaN;get company(){return Ss.get(this.companyId)}set company(t){this.companyId=t?.id??NaN}lastIP="";attributes=new Map;snf=new Map;toJSON(){return{id:this.id||null,v:[...this.v],company:this.companyId,lastIP:this.lastIP||"",attributes:w(this.attributes,((t,s)=>[t,N(s)])),snf:N(this.snf)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id=t.id||"",this.companyId=d(t.company),this.lastIP=t.lastIP||"",this.attributes=y(t.attributes||{},((t,s)=>[t,y(s||{},((t,s)=>[t,Kr.fromJSON(s)]))])),this.snf=S(t.snf||{})),e}getKey(){return this.id}}!function(t){t.created="created",t.pending="pending",t.inProgress="inProgress",t.completed="completed",t.failed="failed",t.cancelled="cancelled"}(dr||(dr={}));class Br{static fromJSON(t){return new Br(t.status,t.parameters,t.created,t.processed)}status=dr.created;parameters=[];created=m();processed=m();constructor(t,s,e,i){this.status=dr[t]||dr.created,this.parameters=[...s||[]],this.created=m(e),this.processed=m(i)}toJSON(){return{status:dr[this.status]||dr.created,parameters:[...this.parameters||[]],created:T(this.created),processed:T(this.processed)}}}!function(t){t.unknown="unknown",t.config="config",t.geofence="geofence",t.dispatch="dispatch",t.gps="gps",t.status="status",t.output="output",t.custom="custom"}(mr||(mr={}));class Lr extends _t{id="";companyId=NaN;get company(){return Ss.get(this.companyId)}set company(t){this.companyId=t?.id??NaN}commands=new Map;toJSON(){return{id:this.id||null,v:[...this.v],company:b(this.companyId),commands:N(this.commands)}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id||(this.id=t.id||""),this.companyId=d(t.company),this.commands=y(t.commands||{},((t,s)=>[mr[t],Br.fromJSON(s)]))),e}getKey(){return this.id}}class jr extends _t{id="";companyId=NaN;get company(){return Ss.get(this.companyId)}set company(t){this.companyId=t?.id??NaN}name="";notes="";kind=Ki.unknown;assetId=NaN;get asset(){return Js.get(this.assetId)}set asset(t){this.assetId=t?.id??NaN}configurationId=NaN;get configuration(){return Ws.get(this.configurationId)??$s.get(this.configurationId)}set configuration(t){this.configurationId=t?.id||NaN}password="";firmware="";phoneNumber=NaN;information=new Map;sim="";toJSON(){return{id:this.id||null,v:[...this.v],company:b(this.companyId),name:this.name||"",notes:this.notes||"",kind:Ki[this.kind]||Ki.unknown,configuration:b(this.configurationId),...this.suspended?{suspended:!0,since:T(this.since)}:{asset:b(this.assetId),password:this.password||"",firmware:this.firmware||"",phoneNumber:b(this.phoneNumber),information:N(this.information),sim:this.sim||""}}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(this.id||(this.id=t.id||""),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.kind=Ki[t.kind]||Ki.unknown,this.assetId=d(t.asset),this.configurationId=d(t.configuration),this.password=t.password||"",this.firmware=t.firmware||"",this.phoneNumber=g(t.phoneNumber),this.information=S(t.information||{}),this.sim=t.sim||"",this.suspended=!!t.suspended,this.since=m(t.since)),e}getKey(){return this.id}suspended=!1;since=m()}class Hr extends Ue{get pieces(){return[this.h,this.o,this.T]}get id(){return this.h.id??this.o.id??this.T.id}get companyId(){return this.h.companyId??this.o.companyId??this.T.companyId}get company(){return this.h.company??this.o.company??this.T.company}set company(t){this.general.company=t,this.advanced.company=t,this.control.company=t}get kind(){return this.h.kind}h=new jr;get general(){return this.h}get name(){return this.h.name}set name(t){this.h.name=t}get notes(){return this.h.notes}set notes(t){this.h.notes=t}get assetId(){return this.h.assetId}set assetId(t){this.h.assetId=t}get asset(){return this.h.asset}set asset(t){this.h.asset=t}get configurationId(){return this.h.configurationId}set configurationId(t){this.h.configurationId=t}get configuration(){return this.h.configuration}set configuration(t){this.h.configuration=t}get password(){return this.h.password}set password(t){this.h.password=t}get firmware(){return this.h.firmware}set firmware(t){this.h.firmware=t}get phoneNumber(){return this.h.phoneNumber}set phoneNumber(t){this.h.phoneNumber=t??NaN}get information(){return this.h.information}set information(t){this.h.information=t}get sim(){return this.h.sim}set sim(t){this.h.sim=t}o=new Rr;get advanced(){return this.o}get lastIP(){return this.o.lastIP}set lastIP(t){this.o.lastIP=t}get attributes(){return this.o.attributes}set attributes(t){this.o.attributes=t}get snf(){return this.o.snf}set snf(t){this.o.snf=t}T=new Lr;get control(){return this.T}get commands(){return this.T.commands}set commands(t){this.T.commands=t}toJSON(){return this.suspended?this.h.toJSON():{...this.h.toJSON(),...this.o.toJSON(),control:this.T.toJSON(),v:[...this.v]}}fromJSON(t,s){const e=t?.v??[],i=this.h.fromJSON({...t,v:e.slice(0,1)},s),n=this.o.fromJSON({...t,v:e.slice(1,2)},s),r=this.T.fromJSON({...t.control,v:e.slice(2,3)},s);return i||n||r}getKey(){return this.id}get suspended(){return this.h.suspended}get since(){return this.h.since}}class qr{static fromJSON;assetId;get asset(){return Js.get(this.assetId)}instance;summaryInstances;general;advanced;constructor(t,s,e,i,n){this.assetId=d(t),this.instance=d(s),this.summaryInstances=e?.map(d)??[],this.general=i||null,this.advanced=n||null}toJSON(){return{asset:b(this.assetId),instance:b(this.instance),summaryInstances:[...this.summaryInstances||[]],general:this.general?.toJSON()??null,advanced:this.advanced?.toJSON()??null}}}class Gr extends qr{job;constructor(t,s,e,i,n,r){super(s,e,i,n,r),this.job=t}toJSON(){return{...super.toJSON(),job:this.job.toJSON()}}}class _r extends qr{message;constructor(t,s,e,i,n,r){super(s,e,i,n,r),this.message=t}toJSON(){return{...super.toJSON(),message:this.message.toJSON()}}}class Vr extends qr{task;constructor(t,s,e,i,n,r){super(s,e,i,n,r),this.task=t}toJSON(){return{...super.toJSON(),task:this.task.toJSON()}}}qr.fromJSON=function(t){return"object"==typeof t.job?new Gr(new In(t.job),t.asset,t.instance,t.summaryInstances?.map(d),t.general?new Zi(t.general):null,t.advanced?new Wi(t.advanced):null):"object"==typeof t.message?new _r(new Tr(t.message),t.asset,t.instance,t.summaryInstances?.map(d),t.general?new Zi(t.general):null,t.advanced?new Wi(t.advanced):null):"object"==typeof t.task?new Vr(new Mn(t.task),t.asset,t.instance,t.summaryInstances?.map(d),t.general?new Zi(t.general):null,t.advanced?new Wi(t.advanced):null):new qr(t.asset,t.instance,t.summaryInstances?.map(d),t.general?new Zi(t.general):null,t.advanced?new Wi(t.advanced):null)},function(t){t.none="none",t.inclusive="inclusive",t.exclusive="exclusive"}(pr||(pr={}));class Fr{static fromJSON(t){return new Fr(t.users,ki.parse(t.assets))}users;assets;constructor(t,s){this.users=[...t||[]],this.assets=s||null}toJSON(){return{users:[...this.users||[]],assets:ki.stringify(this.assets)}}}!function(t){t.startDate="startDate",t.endDate="endDate",t.timeOfDay="timeOfDay",t.tags="tags",t.duration="duration",t.prolonged="prolonged",t.distance="distance",t.rubicon="rubicon",t.collate="collate",t.attributes="attributes"}(gr||(gr={}));class Wr{static fromJSON(t){return new Wr(t.kind,t.value)}kind;value;constructor(t,s){this.kind=gr[t],this.value=s||""}toJSON(){return{kind:gr[this.kind]||"",value:this.value||""}}}class Yr{static fromJSON(t){return new Yr(t.condition,t.duration,t.points)}condition;duration;points;constructor(t,s,e){this.condition=t||"",this.duration=new Be(s),this.points=Ft(e)}toJSON(){return{condition:this.condition||"",duration:this.duration.toString(),points:b(this.points)}}}class $r{static fromJSON(t){return new $r(t.baseScore,t.parameters?.map(Yr.fromJSON))}baseScore;parameters;constructor(t,s){this.baseScore=Ft(t),this.parameters=s??[]}toJSON(){return{baseScore:b(this.baseScore),parameters:this.parameters.map(i)}}}class Zr{static fromJSON(t){return new Zr(t.parameters?.map(Wr.fromJSON),ki.parse(t.targets),t.filtering,ki.parse(t.places),t.regions,t.scorecardRules?$r.fromJSON(t.scorecardRules):null)}parameters;targets;filtering;places;regions;scorecardRules;constructor(t,s,e,i,n,r){this.parameters=t??[],this.targets=s||null,this.filtering=pr[e]||pr.none,this.places=i||null,this.regions=n??[],this.scorecardRules=r||null}toJSON(){return{parameters:this.parameters.map(i),targets:ki.stringify(this.targets),filtering:pr[this.filtering]||pr.none,places:ki.stringify(this.places),regions:[...this.regions],scorecardRules:this.scorecardRules?.toJSON()??null}}}!function(t){t.once="once",t.daily="daily",t.weekly="weekly",t.monthly="monthly",t.quarterly="quarterly",t.annually="annually"}(fr||(fr={}));class Xr{static fromJSON(t){return new Xr(t.kind,t.weekdays,t.weekday,t.start,t.end,t.iterations,t.lastResult,t.nextStartDate,t.nextEndDate,t.lastStartDate,t.lastEndDate)}kind;weekdays;weekday;start;end;#e;get iterations(){return this.#e}#i;get lastResult(){return this.#i}#n;get nextStartDate(){return this.#n}#r;get nextEndDate(){return this.#r}#h;get lastStartDate(){return this.#h}#a;get lastEndDate(){return this.#a}constructor(t,s,e,i,n,r,h,a,o,u,c){this.kind=fr[t]||fr.once,this.weekdays=O(s||fs),this.weekday=d(e),this.start=m(i),this.end=m(n),this.#e=d(r),this.#i=d(h),this.#n=m(a),this.#r=m(o),this.#h=m(u),this.#a=m(c)}toJSON(){return{kind:fr[this.kind]||fr.once,weekdays:C(this.weekdays),weekday:b(this.weekday),start:T(this.start),end:T(this.end),iterations:b(this.iterations),lastResult:b(this.lastResult),nextStartDate:T(this.nextStartDate),nextEndDate:T(this.nextEndDate),lastStartDate:T(this.lastStartDate),lastEndDate:T(this.lastEndDate)}}}class Qr{static fromJSON(t){return new Qr(t.asset,t.score,y(t.rulePoints||{},((t,s)=>[t,Ft(s)])))}assetId;get asset(){return Js.get(this.assetId)}score;rulePoints;constructor(t,s,e){this.assetId=d(t),this.score=Ft(s),this.rulePoints=e??new Map}toJSON(){return{asset:this.assetId||null,score:this.score||0,rulePoints:N(this.rulePoints)||{}}}}!function(t){t.created="created",t.queued="queued",t.running="running",t.saving="saving",t.completed="completed",t.failed="failed"}(Nr||(Nr={}));class th{static fromJSON(t){return new th(t.asset,t.stateDetail,t.summaryCount,t.duration,t.distance)}assetId;get asset(){return Js.get(this.assetId)}stateDetail;summaryCount;duration;distance;constructor(t,s,e,i,n){this.assetId=d(t),this.stateDetail=s||"",this.summaryCount=d(e),this.duration=new Be(i),this.distance=Ft(n)}toJSON(){return{asset:b(this.assetId),stateDetail:this.stateDetail||"",summaryCount:b(this.summaryCount),duration:this.duration.toString(),distance:b(this.distance)}}}!function(t){t.full="full",t.tags="tags",t.places="places",t.messages="messages",t.tasks="tasks",t.attributes="attributes",t.regions="regions",t.jobs="jobs",t.positions="positions"}(wr||(wr={}));class sh extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}kind=wr.full;name="";notes="";options=new Zr;templateId=NaN;get template(){return Xs.get(this.templateId)}scheduleId=NaN;get schedule(){return Qs.get(this.scheduleId)}archive=!1;timezone=oe.utc;runBy="";created=m();completed=m();status=Nr.created;progress=NaN;bounds=null;targeted=[];filtered=[];totals=[];scorecards=[];error="";toJSON(){return{id:b(this.id),company:b(this.companyId),kind:wr[this.kind],name:this.name||"",notes:this.notes||"",options:this.options.toJSON(),template:b(this.templateId),schedule:b(this.scheduleId),archive:!!this.archive,timezone:this.timezone?.code??"",runBy:this.runBy||"",created:u(this.created.valueOf())?this.created.toISOString():null,completed:u(this.completed.valueOf())?this.completed.toISOString():null,status:Nr[this.status]||Nr.created,progress:this.progress||0,bounds:this.bounds?.toJSON()??null,targeted:this.targeted||null,filtered:this.filtered||null,totals:this.totals||null,scorecards:this.scorecards||null,error:this.error||""}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.kind=wr[t.kind],this.name=t.name||"",this.notes=t.notes||"",this.options=Zr.fromJSON(t.options),this.templateId=d(t.template),this.scheduleId=d(t.schedule),this.archive=!!t.archive,this.timezone=U(t.timezone)||oe.utc,this.runBy=t.runBy||"",this.created=m(t.created),this.completed=m(t.completed),this.status=Nr[t.status]||Nr.created,this.progress=d(t.progress),this.bounds=wi.fromJSON(t.bounds),this.targeted=(t.targeted||[]).map(d),this.filtered=(t.filtered||[]).map(d),this.totals=(t.totals||[]).map(th.fromJSON),this.scorecards=(t.scorecards||[]).map(Qr.fromJSON),this.error=t.error||""),e}getKey(){return this.id}}class eh extends sh{summary=new Map;breakdown=new Map}class ih extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}templateId=NaN;get template(){return Xs.get(this.templateId)}owner="";name="";notes="";enabled=!1;repetition=null;options=null;notify=null;toJSON(){return{id:this.id||null,company:this.companyId||null,template:this.templateId||null,v:[...this.v],name:this.name||"",notes:this.notes||"",owner:this.owner||"",enabled:!!this.enabled,repetition:this.repetition?.toJSON()??null,options:this.options?.toJSON()??null,notify:this.notify?.toJSON()??null}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.templateId=d(t.template),this.name=t.name||"",this.notes=t.notes||"",this.owner=t.owner||"",this.enabled=!!t.enabled,this.repetition=t.repetition?Xr.fromJSON(t.repetition):null,this.options=t.options?Zr.fromJSON(t.options):null,this.notify=t.notify?Fr.fromJSON(t.notify):null),e}getKey(){return this.id}}!function(t){t.outsideRange="outsideRange",t.targeted="targeted",t.stateMatch="stateMatch",t.split="split",t.filterMatch="filterMatch"}(yr||(yr={}));class nh{static fromJSON(t){return new nh(t.asset,t.stateDetail,t.instance,t.instancesCount,t.startingUtc,t.startingReason,t.endingUtc,t.endingReason,t.distance,t.polyline,t.firstState?new Xi(t.firstState):null,t.lastState?new Xi(t.lastState):null)}assetId;get asset(){return Js.get(this.assetId)}stateDetail;instance;instancesCount;startingUtc;startingReason;endingUtc;endingReason;distance;get duration(){return Be.fromMilliseconds(this.endingUtc-this.startingUtc)}polyline;firstState;lastState;constructor(t,s,e,i,n,r,h,a,o,u,c,l){this.assetId=d(t),this.stateDetail=s||"",this.instance=d(e),this.instancesCount=d(i),this.startingUtc=m(n),this.startingReason=yr[r]||yr.outsideRange,this.endingUtc=m(h),this.endingReason=yr[a]||yr.outsideRange,this.distance=Ft(o),this.polyline=u?.map(yi.fromJSON)??[],this.firstState=c||null,this.lastState=l||null}toJSON(){return{asset:b(this.assetId),stateDetail:this.stateDetail||"",instance:b(this.instance),instancesCount:b(this.instancesCount),startingUtc:T(this.startingUtc),startingReason:yr[this.startingReason]||yr.outsideRange,endingUtc:T(this.endingUtc),endingReason:yr[this.endingReason]||yr.outsideRange,distance:b(this.distance),polyline:this.polyline.map(i),firstState:this.firstState?.toJSON()??null,lastState:this.lastState?.toJSON()??null}}}class rh extends _t{id=NaN;companyId=NaN;get company(){return Ss.get(this.companyId)}kind=wr.full;name="";notes="";options=null;fill="";stroke="";graphic="";toJSON(){return{id:this.id||null,company:this.companyId||null,v:[...this.v],name:this.name||"",notes:this.notes||"",options:this.options?.toJSON()??null,fill:this.fill||"",stroke:this.stroke||"",graphic:this.graphic||""}}fromJSON(t,s){const e=this.updateVersion(t?.v)||!(!s||!t);return e&&(u(this.id)||(this.id=d(t.id)),this.companyId=d(t.company),this.name=t.name||"",this.notes=t.notes||"",this.options=t.options?Zr.fromJSON(t.options):null,this.fill=t.fill||"",this.stroke=t.stroke||"",this.graphic=t.graphic||""),e}getKey(){return this.id}}
|
|
2
2
|
/**
|
|
3
3
|
* Trak-iT API Object Model.
|
|
4
4
|
* {@link https://github.com/trakitwireless/trakit-ts-objects|Object definition.}
|
|
5
5
|
* All of the Trak-iT APIs use the same object definitions. Use this package in your TypeScript or JavaScript project.
|
|
6
6
|
* Last updated on Friday December 19, 2025
|
|
7
7
|
* @copyright Trak-iT Wireless Inc. 2025
|
|
8
|
-
*/const hh="0.0.11",ah={Company:kn,CompanyGeneral:wn,CompanyStyle:Jn,CompanyDirectory:Nn,CompanyPolicy:vn,CompanyReseller:On,Contact:ae,Machine:Ne,Session:xe,User:He,UserGeneral:je,UserAdvanced:Ie,UserGroup:qe,Asset:Xi,AssetGeneral:Zi,AssetAdvanced:_i,AssetDispatch:$i,AssetAlert:vr,AssetMessage:Tr,Behaviour:tn,BehaviourScript:en,BehaviourLog:sn,BillableHostingLicense:on,BillableHostingRule:un,BillingProfile:rn,BillingReport:gn,DispatchJob:In,DispatchTask:Mn,Document:An,FormResult:_n,FormTemplate:Yn,Dashcam:Zn,Icon:sr,Picture:er,MaintenanceSchedule:rr,MaintenanceJob:nr,Place:br,Provider:Hr,ProviderGeneral:jr,ProviderAdvanced:Rr,ProviderControl:Lr,ProviderScript:xr,ProviderConfig:Or,ProviderConfigurationType:Mr,ProviderConfiguration:Ur,ProviderRegistration:Cr,ReportTemplate:rh,ReportSchedule:ih,ReportResult:sh},oh={Company:Ss,CompanyGeneral:Ss,CompanyStyle:Ss,CompanyDirectory:Ss,CompanyPolicy:Ss,CompanyReseller:Ss,Contact:vs,Machine:Ts,Session:Cs,User:bs,UserGeneral:bs,UserAdvanced:bs,UserGroup:Os,Asset:Js,AssetGeneral:Js,AssetAdvanced:Js,AssetDispatch:Js,AssetAlert:ks,AssetMessage:ks,Behaviour:xs,BehaviourScript:Us,BehaviourLog:Is,BillingProfile:Ms,BillingReport:As,BillableHostingRule:Ds,BillableHostingLicense:Ps,DispatchTask:Es,DispatchJob:zs,Document:Ks,FormTemplate:Rs,FormResult:Bs,Dashcam:Hs,Icon:js,Picture:Ls,MaintenanceSchedule:qs,MaintenanceJob:Gs,Place:Vs,Provider:Fs,ProviderGeneral:Fs,ProviderAdvanced:Fs,ProviderControl:Fs,ProviderScript:Ws,ProviderConfig:_s,ProviderConfigurationType:Ys,ProviderConfiguration:$s,ProviderRegistration:Zs,ReportTemplate:Xs,ReportSchedule:Qs,ReportResult:te},uh={capitalize:function(t,s=!0){return t?.length?t[0][s?"toUpperCase":"toLowerCase"]()+t.slice(1):""},codify:J,date:m,douglasPeucker:function(t,s,e){if(!Array.isArray(t))throw new TypeError("source is not an Array.");if(!("function"==typeof(i=s)||i instanceof Function))throw new TypeError("triangleHeight is not an Function.");var i;if(!u(e)||e<0)throw new TypeError("tolerance is not an Number or less than zero.");return t.length<3?[...t]:t.filter(n,p(t,s,e))},fileSize:function(t,s=0,e="MB",i=3,n=",",r=n,h="."){let a=0;if(t){const s=oi.includes(e)?oi.indexOf(e):ui;for(;a<s&&t>=1024;)t/=1024,a++}return ot(c(t,s),i,n,r,h)+" "+oi[a]},findTimeZoneById:U,guid:function(){const t=(new Date).valueOf().toString(16).substring(1).split("").reduce(Bt,[...Ti]);for(let s=0;s<36;s++)if(" "===t[s]){let e=16*Zt.random()|0;t[s]=(19!==s?e:3&e|8).toString(16)}return t.join("")},highlight:function(t,s,[e,i]=["<b>","</b>"]){if(!t||!s?.length)return t;let n,r="",h=0;const a=new RegExp(s.map((t=>J(t).split("-").map((t=>t.split("").map((t=>ys+t)).join("")+ys)).join("[^a-z0-9]+"))).join("|"),"gim");for(;n=a.exec(t);)r+=t.slice(h,n.index)+e+n[0]+i,h=n.index+n[0].length;return r+t.slice(h)},id:d,isNothing:h,isntNaN:u,numberGroups:ot,roundTo:c,parseTime:function(t){return new Be(t).totalSeconds},phoneNumber:g,pluralize:function(t){return t.endsWith("y")?t.slice(0,-1)+"ies":t.endsWith("ch")?t+"es":t+"s"},singularize:function(t){return t.endsWith("ies")?t.slice(0,-3)+"y":t.endsWith("ches")?t.slice(0,-2):t.endsWith("s")?t.slice(0,-1):t},stringifyTime:function(t){return new Be(t*Pe).toString()}},ch=ai,lh={toPassword:function(t){return encodeURIComponent([...h(t)?"":String(t)].reduce((function(t,s){return t+String.fromCharCode(111^s.charCodeAt(0))}),""))},fromPassword:function(t){return[...decodeURIComponent(h(t)?"":String(t))].reduce((function(t,s){return t+String.fromCharCode(111^s.charCodeAt(0))}),"")}},dh={fromMap:N,fromMapPredicate:w,toMap:S,toMapPredicate:y},mh={pathLength:function(t){let s=0,e=0,i=t.length-1,n=t[e],r=n;for(;e<i;e++)n=t[e],r=t[e+1],s+=l(r.x-n.x,r.y-n.y);return s},pathOrthogonal:At,pathReduce:function(t,s=0){return t.length<3?t.slice():(s>0||(s=0),t.filter(n,p(t,Dt,s)))},pointAngle:xt,pointDistance:Ut,pointPythagora:l,pointVector:Mt,polyArea:Pt,polyContains:function(t,s){let e=t.slice(),i=0,n=e.length,r=n-1,h=!1;if(e[i].x===e[r].x&&e[i].y===e[r].y&&(e.pop(),n=e.length,r=n-1),zt(Et(e),s))for(;i<n;r=i++){const t=e[i],n=e[r];t.y>s.y!=n.y>s.y&&s.x<(n.x-t.x)*(s.y-t.y)/(n.y-t.y)+t.x&&(h=!h)}return h},polyReduce:function(t,s=0){let e=[...t],i=t.length;if(i<3)return e;{let t=0,r=0;s>0||(s=0);for(let s=0;s<i;s++){const n=e[s];for(let h=s+1;h<i;h++){const i=Ut(n,e[h]);i>t&&(r=s,t=i)}}return e=e.splice(r,i).concat(e),Ut(e[0],e[i-1])>0&&(i=e.push(e[0])),e=e.filter(n,p(e,Dt,s)),i=e.length,Ut(e[0],e[i-1])<=0&&e.pop(),e}},polyWrapper:function(t){let s=t.slice().sort(It),e=s[0],i=[e];for(;s.length>1;){let t=0,n=0,r=360;for(let i=0,h=s.length;i<h;i++){const a=s[i],o=xt(e,a),u=Ut(e,a);a!==e&&(u?(o<r||o===r&&u>n)&&(o===r&&(s.splice(t,1),i--,h--),r=o,n=u,t=i):(s.splice(i--,1),h--))}if(0===t)break;i.push(e=s.splice(t,1)[0])}return i},radialCircumference:function(t){return 2*Xt*t},radialArea:function(t){return Xt*(t*t)},radialSmallest:function(t,s){let e=t[0],i=0;switch(t.length){case 1:return{x:e.x,y:e.y,r:i};case 2:return function(t){const s=function(t){return{x:t.left+(t.right-t.left)/2,y:t.top+(t.bottom-t.top)/2}}(t);t.right,t.left,t.bottom,t.top;return{x:s.x,y:s.y,r:Ut(s,{x:t.left,y:t.top})}}(Et(t))}s||(s=1e4);for(let n=0;n<s;n++){let s=t[0],r=0;for(let i=0;i<t.length;i++){const n=t[i],h=Ut(e,n);h>r&&(s=n,r=h)}e={x:e.x+1/(n+1)*(s.x-e.x),y:e.y+1/(n+1)*(s.y-e.y)},i=r}return{x:e.x,y:e.y,r:i}},radialOverlapsRectangle:function(t,s){const e=kt(s),i=kt(s);return e.top-=t.r,e.bottom+=t.r,i.left-=t.r,i.right+=t.r,zt(e,t)||zt(i,t)||Ut(t,{x:s.left,y:s.top})<=t.r||Ut(t,{x:s.right,y:s.top})<=t.r||Ut(t,{x:s.left,y:s.bottom})<=t.r||Ut(t,{x:s.right,y:s.bottom})<=t.r}},ph={earthRadius:ci,clampLat:ct,clampLng:lt,pathLength:function(t){const s=[...t],e=s.length-1;for(let t=0,i=0;t<e;t++)i+=mt(s[t],s[t+1]);return length},pathReduce:function(t,s){return t.length<3?[...t]:(s>0||(s=0),t.filter(n,p(t,Nt,s)))},pathEncode:yt,pathDecode:St,pointAngle:dt,pointDistance:mt,pointMiddle:ft,pointOrthogonal:pt,pointTranslate:gt,pointVincenty:function(t,s){const e=ct(t.lat),i=ct(s.lat),n=lt(t.lng,e),r=(lt(s.lng,i)-n)*ms,h=ss((1-li)*ls(e*ms)),a=ss((1-li)*ls(e*ms)),o=us(h),c=is(h),l=us(a),d=is(a);let m,p,g,f,N,w,y,S,v,T,b=r,O=100;do{if(p=us(b),g=is(b),f=cs(d*p*(d*p)+(c*l-o*d*g)*(c*l-o*d*g)),0===f)return 0;N=o*l+c*d*g,w=es(f,N),y=c*d*p/f,S=1-y*y,v=N-2*o*l/S,T=li/16*S*(4+li*(4-3*S)),u(v)||(v=0),m=b,b=r+(1-T)*li*y*(w+T*f*(v+T*N*(2*v*v-1)))}while(Qt(b-m)>1e-12&&--O>0);if(!O)return 0;const C=272331606107.5547*S/40408299984661.445,J=C/1024*(256+C*(C*(74-47*C)-128));return di*(1+C/16384*(4096+C*(C*(320-175*C)-768)))*(w-J*f*(v+J/4*(N*(2*v*v-1)-J/6*v*(4*f*f-3)*(4*v*v-3))))},polyArea:function(t){const s=[...t];let e,i=0,n=0,r=s.length-1,h=s[n],a=s[r];if(h&&a&&mt(h,a)<=mi&&(s.pop(),r--),r<1)throw new Error("Not enough coordinates");if(r>1)for(n=1;n<r;n++)e=s[n],a=s[n+1],i+=Tt(h,e,a)*bt(h,e,a);return Qt(40680631590769*i)},polyContains:function(t,s){throw"not implemented"},polyReduce:function(t,s=1e-9){let e=[...t],i=t.length;if(i>2){const[t,r,h]=vt(e);s>0||(s=mi),e=e.splice(r,i).concat(e),mt(e[0],e[i-1])>s&&(i=e.push(e[0])),e=e.filter(n,p(e,Nt,s)),i=e.length,mt(e[0],e[i-1])<=s&&e.pop()}return e},polyWidest:vt},gh={computeAll:j,compute:H,computeAllSimple:function(t,s,e){return j(t,(s||[]).filter(R),(e||[]).filter(R))},computeSimple:q,computeSimpleLevels:function(t,s,e,i){const n=new Map;return q(t,s,e,i).forEach((function(t){n.set(t.kind,t.level)})),n},getSimpleLevel:function(t,s,e,i,n){return V(t,q(t,s,e,i),n)},hasSimple:function(t,s,e,i,n,r){return G(t,q(t,s,e,i),n,r)},findSimple:G,findSimpleLevel:V,computeAllComplex:function(t,s,e){const i=new Map;return j(t,(s||[]).filter(K),(e||[]).filter(K)).forEach((function(t,s){for(let s,e=0;s=t[e];e++)K(s)||t.splice(e--,1);t.length>0&&i.set(s,t)})),i},computeComplex:F,getComplexLevel:function(t,s,e,i,n,r,h){return _(t,F(t,s,e,i),n,r,h)},findComplexLevel:_,hasComplex:function(t,s,e,i,n,r,h,a){return W(t,F(t,s,e,i),n,r,h,a)},findComplex:W,hasAnyComplex:function(t,s,e,i,n,r){return Y(t,F(t,s,e,i),n,r)},findAnyComplex:Y,findAllEscalations:function(t,s,e,i){const n=new Map;return e.forEach((function(e,r){if(s.has(r)){const h=$(t,s.get(r),e,i&&i.get(r));h.length&&n.set(r,h)}else n.set(r,e.map((function(t){return new ye(ge.vertical,t.companyId,t.kind,t.level,t.labels)})))})),n},findEscalations:$,findAllLabelEscalations:function(t,s,e,i,n,r){const h=[];return(e||[]).length>0&&e.forEach((function(e){const a=Z(t,s,e,i,n,r);a&&h.push(a)})),h},findLabelEscalation:Z,implied:$t(ve),simple:$t(s(Yt(de),Te)),complex:$t(Te)};export{hr as AlertPriority,Xi as Asset,_i as AssetAdvanced,vr as AssetAlert,xi as AssetAttribute,$i as AssetDispatch,Zi as AssetGeneral,Tr as AssetMessage,Wi as AssetPlaceStatus,Ui as AssetPlaceStatusType,Ii as AssetType,Gt as Base,Vt as BaseComponent,Ue as BaseCompound,tn as Behaviour,sn as BehaviourLog,Ai as BehaviourLogType,Qi as BehaviourParameter,Mi as BehaviourParameterType,en as BehaviourScript,on as BillableHostingLicense,Ei as BillableHostingLicenseType,un as BillableHostingRule,zi as BillableHostingType,Di as BillingCurrency,Pi as BillingCycle,rn as BillingProfile,gn as BillingReport,dn as BillingReportBreakdown,mn as BillingReportHostingSummary,cn as BillingReportLicenseBreakdown,ln as BillingReportServiceBreakdown,Ri as BillingReportStatus,pn as BillingReportSummary,fn as ColourStyle,kn as Company,Nn as CompanyDirectory,wn as CompanyGeneral,vn as CompanyPolicy,On as CompanyReseller,Jn as CompanyStyle,ae as Contact,Zn as Dashcam,$n as DashcamBase,Xn as DashcamLive,Ln as DashcamMediaType,Yi as DispatchDirection,In as DispatchJob,qi as DispatchJobPriority,Un as DispatchStep,xn as DispatchStepState,Gi as DispatchStepStatus,Mn as DispatchTask,Vi as DispatchTaskStatus,An as Document,Pn as FormFieldAttachments,Dn as FormFieldBase,En as FormFieldBoolean,Kn as FormFieldChoice,Rn as FormFieldDate,qn as FormFieldNumeric,Bn as FormFieldNumericSize,Gn as FormFieldSignature,Vn as FormFieldText,Fn as FormFieldTime,Wn as FormFieldTimezone,Fi as FormFieldType,_n as FormResult,Yn as FormTemplate,sr as Icon,Qn as IconGlyph,tr as IconLabel,jn as IconLayer,Cn as LabelStyle,yi as LatLng,wi as LatLngBounds,Ne as Machine,ir as MaintenanceInterval,nr as MaintenanceJob,Hn as MaintenanceJobStatus,rr as MaintenanceSchedule,ur as MessageFolder,ar as MessageStatus,or as MessageType,pe as NotificationMethod,Tn as NotificationServerEmail,bn as NotificationServerSms,Bi as PasswordExpiryMode,yn as PasswordPolicy,fe as Permission,ye as PermissionEscalation,we as PermissionEscalationState,ge as PermissionEscalationType,ce as PermissionLevel,le as PermissionMethod,de as PermissionType,er as Picture,br as Place,cr as PlaceType,Ni as Point,vi as Position,Hr as Provider,Rr as ProviderAdvanced,Br as ProviderCommand,dr as ProviderCommandStatus,mr as ProviderCommandType,Or as ProviderConfig,Ur as ProviderConfiguration,Ir as ProviderConfigurationNode,Mr as ProviderConfigurationType,Lr as ProviderControl,Kr as ProviderData,jr as ProviderGeneral,Ar as ProviderGeofenceBase,Dr as ProviderGeofenceCircular,Pr as ProviderGeofencePoint,Er as ProviderGeofencePolygon,zr as ProviderGeofenceRectangle,Cr as ProviderRegistration,xr as ProviderScript,Jr as ProviderScriptBlock,kr as ProviderScriptParameter,lr as ProviderScriptParameterType,Ki as ProviderType,fi as Radial,gi as Rectangle,qr as ReportBreakdown,Gr as ReportBreakdownJob,Vr as ReportBreakdownMessage,Fr as ReportBreakdownTask,pr as ReportFilterMode,Wr as ReportNotifications,Zr as ReportOptions,_r as ReportParameter,gr as ReportParameterType,Xr as ReportRecurrence,fr as ReportRecurrenceType,sh as ReportResult,eh as ReportResultData,ih as ReportSchedule,Qr as ReportScorecard,Yr as ReportScorecardParameter,$r as ReportScorecardRules,Nr as ReportStatus,nh as ReportSummary,yr as ReportSummaryReason,rh as ReportTemplate,th as ReportTotal,wr as ReportType,ki as SearchPattern,xe as Session,Li as SessionMultiUser,Sn as SessionPolicy,Ce as SessionStatus,pi as Size,Si as StreetAddress,me as SystemsOfUnits,Be as TimeSpan,oe as Timezone,He as User,Ie as UserAdvanced,je as UserGeneral,qe as UserGroup,Le as UserNotifications,gh as authorizer,ah as classes,ch as convert,lh as encoding,ph as geography,mh as geometry,dh as serialization,oh as storage,uh as utility,hh as version};
|
|
8
|
+
*/const hh="0.0.13",ah={Company:kn,CompanyGeneral:wn,CompanyStyle:Jn,CompanyDirectory:Nn,CompanyPolicy:vn,CompanyReseller:On,Contact:ae,Machine:Ne,Session:xe,User:He,UserGeneral:je,UserAdvanced:Ie,UserGroup:qe,Asset:Xi,AssetGeneral:Zi,AssetAdvanced:Wi,AssetDispatch:$i,AssetAlert:vr,AssetMessage:Tr,Behaviour:tn,BehaviourScript:en,BehaviourLog:sn,BillableHostingLicense:on,BillableHostingRule:un,BillingProfile:rn,BillingReport:gn,DispatchJob:In,DispatchTask:Mn,Document:An,FormResult:Wn,FormTemplate:Yn,Dashcam:Zn,Icon:sr,Picture:er,MaintenanceSchedule:rr,MaintenanceJob:nr,Place:br,Provider:Hr,ProviderGeneral:jr,ProviderAdvanced:Rr,ProviderControl:Lr,ProviderScript:xr,ProviderConfig:Or,ProviderConfigurationType:Mr,ProviderConfiguration:Ur,ProviderRegistration:Cr,ReportTemplate:rh,ReportSchedule:ih,ReportResult:sh},oh={Company:Ss,CompanyGeneral:Ss,CompanyStyle:Ss,CompanyDirectory:Ss,CompanyPolicy:Ss,CompanyReseller:Ss,Contact:vs,Machine:Ts,Session:Cs,User:bs,UserGeneral:bs,UserAdvanced:bs,UserGroup:Os,Asset:Js,AssetGeneral:Js,AssetAdvanced:Js,AssetDispatch:Js,AssetAlert:ks,AssetMessage:ks,Behaviour:xs,BehaviourScript:Us,BehaviourLog:Is,BillingProfile:Ms,BillingReport:As,BillableHostingRule:Ds,BillableHostingLicense:Ps,DispatchTask:Es,DispatchJob:zs,Document:Ks,FormTemplate:Rs,FormResult:Bs,Dashcam:Hs,Icon:js,Picture:Ls,MaintenanceSchedule:qs,MaintenanceJob:Gs,Place:_s,Provider:Vs,ProviderGeneral:Vs,ProviderAdvanced:Vs,ProviderControl:Vs,ProviderScript:Fs,ProviderConfig:Ws,ProviderConfigurationType:Ys,ProviderConfiguration:$s,ProviderRegistration:Zs,ReportTemplate:Xs,ReportSchedule:Qs,ReportResult:te},uh={capitalize:function(t,s=!0){return t?.length?t[0][s?"toUpperCase":"toLowerCase"]()+t.slice(1):""},codify:J,date:m,douglasPeucker:function(t,s,e){if(!Array.isArray(t))throw new TypeError("source is not an Array.");if(!("function"==typeof(i=s)||i instanceof Function))throw new TypeError("triangleHeight is not an Function.");var i;if(!u(e)||e<0)throw new TypeError("tolerance is not an Number or less than zero.");return t.length<3?[...t]:t.filter(n,p(t,s,e))},fileSize:function(t,s=0,e="MB",i=3,n=",",r=n,h="."){let a=0;if(t){const s=oi.includes(e)?oi.indexOf(e):ui;for(;a<s&&t>=1024;)t/=1024,a++}return ot(c(t,s),i,n,r,h)+" "+oi[a]},findTimeZoneById:U,guid:function(){const t=(new Date).valueOf().toString(16).substring(1).split("").reduce(Bt,[...Ti]);for(let s=0;s<36;s++)if(" "===t[s]){let e=16*Zt.random()|0;t[s]=(19!==s?e:3&e|8).toString(16)}return t.join("")},highlight:function(t,s,[e,i]=["<b>","</b>"]){if(!t||!s?.length)return t;let n,r="",h=0;const a=new RegExp(s.map((t=>J(t).split("-").map((t=>t.split("").map((t=>ys+t)).join("")+ys)).join("[^a-z0-9]+"))).join("|"),"gim");for(;n=a.exec(t);)r+=t.slice(h,n.index)+e+n[0]+i,h=n.index+n[0].length;return r+t.slice(h)},id:d,isNothing:h,isntNaN:u,numberGroups:ot,roundTo:c,parseTime:function(t){return new Be(t).totalSeconds},phoneNumber:g,pluralize:function(t){return t.endsWith("y")?t.slice(0,-1)+"ies":t.endsWith("ch")?t+"es":t+"s"},singularize:function(t){return t.endsWith("ies")?t.slice(0,-3)+"y":t.endsWith("ches")?t.slice(0,-2):t.endsWith("s")?t.slice(0,-1):t},stringifyTime:function(t){return new Be(t*Pe).toString()}},ch=ai,lh={toPassword:function(t){return encodeURIComponent([...h(t)?"":String(t)].reduce((function(t,s){return t+String.fromCharCode(111^s.charCodeAt(0))}),""))},fromPassword:function(t){return[...decodeURIComponent(h(t)?"":String(t))].reduce((function(t,s){return t+String.fromCharCode(111^s.charCodeAt(0))}),"")}},dh={fromMap:N,fromMapPredicate:w,toMap:S,toMapPredicate:y},mh={pathLength:function(t){let s=0,e=0,i=t.length-1,n=t[e],r=n;for(;e<i;e++)n=t[e],r=t[e+1],s+=l(r.x-n.x,r.y-n.y);return s},pathOrthogonal:At,pathReduce:function(t,s=0){return t.length<3?t.slice():(s>0||(s=0),t.filter(n,p(t,Dt,s)))},pointAngle:xt,pointDistance:Ut,pointPythagora:l,pointVector:Mt,polyArea:Pt,polyContains:function(t,s){let e=t.slice(),i=0,n=e.length,r=n-1,h=!1;if(e[i].x===e[r].x&&e[i].y===e[r].y&&(e.pop(),n=e.length,r=n-1),zt(Et(e),s))for(;i<n;r=i++){const t=e[i],n=e[r];t.y>s.y!=n.y>s.y&&s.x<(n.x-t.x)*(s.y-t.y)/(n.y-t.y)+t.x&&(h=!h)}return h},polyReduce:function(t,s=0){let e=[...t],i=t.length;if(i<3)return e;{let t=0,r=0;s>0||(s=0);for(let s=0;s<i;s++){const n=e[s];for(let h=s+1;h<i;h++){const i=Ut(n,e[h]);i>t&&(r=s,t=i)}}return e=e.splice(r,i).concat(e),Ut(e[0],e[i-1])>0&&(i=e.push(e[0])),e=e.filter(n,p(e,Dt,s)),i=e.length,Ut(e[0],e[i-1])<=0&&e.pop(),e}},polyWrapper:function(t){let s=t.slice().sort(It),e=s[0],i=[e];for(;s.length>1;){let t=0,n=0,r=360;for(let i=0,h=s.length;i<h;i++){const a=s[i],o=xt(e,a),u=Ut(e,a);a!==e&&(u?(o<r||o===r&&u>n)&&(o===r&&(s.splice(t,1),i--,h--),r=o,n=u,t=i):(s.splice(i--,1),h--))}if(0===t)break;i.push(e=s.splice(t,1)[0])}return i},radialCircumference:function(t){return 2*Xt*t},radialArea:function(t){return Xt*(t*t)},radialSmallest:function(t,s){let e=t[0],i=0;switch(t.length){case 1:return{x:e.x,y:e.y,r:i};case 2:return function(t){const s=function(t){return{x:t.left+(t.right-t.left)/2,y:t.top+(t.bottom-t.top)/2}}(t);t.right,t.left,t.bottom,t.top;return{x:s.x,y:s.y,r:Ut(s,{x:t.left,y:t.top})}}(Et(t))}s||(s=1e4);for(let n=0;n<s;n++){let s=t[0],r=0;for(let i=0;i<t.length;i++){const n=t[i],h=Ut(e,n);h>r&&(s=n,r=h)}e={x:e.x+1/(n+1)*(s.x-e.x),y:e.y+1/(n+1)*(s.y-e.y)},i=r}return{x:e.x,y:e.y,r:i}},radialOverlapsRectangle:function(t,s){const e=kt(s),i=kt(s);return e.top-=t.r,e.bottom+=t.r,i.left-=t.r,i.right+=t.r,zt(e,t)||zt(i,t)||Ut(t,{x:s.left,y:s.top})<=t.r||Ut(t,{x:s.right,y:s.top})<=t.r||Ut(t,{x:s.left,y:s.bottom})<=t.r||Ut(t,{x:s.right,y:s.bottom})<=t.r}},ph={earthRadius:ci,clampLat:ct,clampLng:lt,pathLength:function(t){const s=[...t],e=s.length-1;for(let t=0,i=0;t<e;t++)i+=mt(s[t],s[t+1]);return length},pathReduce:function(t,s){return t.length<3?[...t]:(s>0||(s=0),t.filter(n,p(t,Nt,s)))},pathEncode:yt,pathDecode:St,pointAngle:dt,pointDistance:mt,pointMiddle:ft,pointOrthogonal:pt,pointTranslate:gt,pointVincenty:function(t,s){const e=ct(t.lat),i=ct(s.lat),n=lt(t.lng,e),r=(lt(s.lng,i)-n)*ms,h=ss((1-li)*ls(e*ms)),a=ss((1-li)*ls(e*ms)),o=us(h),c=is(h),l=us(a),d=is(a);let m,p,g,f,N,w,y,S,v,T,b=r,O=100;do{if(p=us(b),g=is(b),f=cs(d*p*(d*p)+(c*l-o*d*g)*(c*l-o*d*g)),0===f)return 0;N=o*l+c*d*g,w=es(f,N),y=c*d*p/f,S=1-y*y,v=N-2*o*l/S,T=li/16*S*(4+li*(4-3*S)),u(v)||(v=0),m=b,b=r+(1-T)*li*y*(w+T*f*(v+T*N*(2*v*v-1)))}while(Qt(b-m)>1e-12&&--O>0);if(!O)return 0;const C=272331606107.5547*S/40408299984661.445,J=C/1024*(256+C*(C*(74-47*C)-128));return di*(1+C/16384*(4096+C*(C*(320-175*C)-768)))*(w-J*f*(v+J/4*(N*(2*v*v-1)-J/6*v*(4*f*f-3)*(4*v*v-3))))},polyArea:function(t){const s=[...t];let e,i=0,n=0,r=s.length-1,h=s[n],a=s[r];if(h&&a&&mt(h,a)<=mi&&(s.pop(),r--),r<1)throw new Error("Not enough coordinates");if(r>1)for(n=1;n<r;n++)e=s[n],a=s[n+1],i+=Tt(h,e,a)*bt(h,e,a);return Qt(40680631590769*i)},polyContains:function(t,s){throw"not implemented"},polyReduce:function(t,s=1e-9){let e=[...t],i=t.length;if(i>2){const[t,r,h]=vt(e);s>0||(s=mi),e=e.splice(r,i).concat(e),mt(e[0],e[i-1])>s&&(i=e.push(e[0])),e=e.filter(n,p(e,Nt,s)),i=e.length,mt(e[0],e[i-1])<=s&&e.pop()}return e},polyWidest:vt},gh={computeAll:j,compute:H,computeAllSimple:function(t,s,e){return j(t,(s||[]).filter(R),(e||[]).filter(R))},computeSimple:q,computeSimpleLevels:function(t,s,e,i){const n=new Map;return q(t,s,e,i).forEach((function(t){n.set(t.kind,t.level)})),n},getSimpleLevel:function(t,s,e,i,n){return _(t,q(t,s,e,i),n)},hasSimple:function(t,s,e,i,n,r){return G(t,q(t,s,e,i),n,r)},findSimple:G,findSimpleLevel:_,computeAllComplex:function(t,s,e){const i=new Map;return j(t,(s||[]).filter(K),(e||[]).filter(K)).forEach((function(t,s){for(let s,e=0;s=t[e];e++)K(s)||t.splice(e--,1);t.length>0&&i.set(s,t)})),i},computeComplex:V,getComplexLevel:function(t,s,e,i,n,r,h){return W(t,V(t,s,e,i),n,r,h)},findComplexLevel:W,hasComplex:function(t,s,e,i,n,r,h,a){return F(t,V(t,s,e,i),n,r,h,a)},findComplex:F,hasAnyComplex:function(t,s,e,i,n,r){return Y(t,V(t,s,e,i),n,r)},findAnyComplex:Y,findAllEscalations:function(t,s,e,i){const n=new Map;return e.forEach((function(e,r){if(s.has(r)){const h=$(t,s.get(r),e,i&&i.get(r));h.length&&n.set(r,h)}else n.set(r,e.map((function(t){return new ye(ge.vertical,t.companyId,t.kind,t.level,t.labels)})))})),n},findEscalations:$,findAllLabelEscalations:function(t,s,e,i,n,r){const h=[];return(e||[]).length>0&&e.forEach((function(e){const a=Z(t,s,e,i,n,r);a&&h.push(a)})),h},findLabelEscalation:Z,implied:$t(ve),simple:$t(s(Yt(de),Te)),complex:$t(Te)};export{hr as AlertPriority,Xi as Asset,Wi as AssetAdvanced,vr as AssetAlert,xi as AssetAttribute,$i as AssetDispatch,Zi as AssetGeneral,Tr as AssetMessage,Fi as AssetPlaceStatus,Ui as AssetPlaceStatusType,Ii as AssetType,Gt as Base,_t as BaseComponent,Ue as BaseCompound,tn as Behaviour,sn as BehaviourLog,Ai as BehaviourLogType,Qi as BehaviourParameter,Mi as BehaviourParameterType,en as BehaviourScript,on as BillableHostingLicense,Ei as BillableHostingLicenseType,un as BillableHostingRule,zi as BillableHostingType,Di as BillingCurrency,Pi as BillingCycle,rn as BillingProfile,gn as BillingReport,dn as BillingReportBreakdown,mn as BillingReportHostingSummary,cn as BillingReportLicenseBreakdown,ln as BillingReportServiceBreakdown,Ri as BillingReportStatus,pn as BillingReportSummary,fn as ColourStyle,kn as Company,Nn as CompanyDirectory,wn as CompanyGeneral,vn as CompanyPolicy,On as CompanyReseller,Jn as CompanyStyle,ae as Contact,Zn as Dashcam,$n as DashcamBase,Xn as DashcamLive,Ln as DashcamMediaType,Yi as DispatchDirection,In as DispatchJob,qi as DispatchJobPriority,Un as DispatchStep,xn as DispatchStepState,Gi as DispatchStepStatus,Mn as DispatchTask,_i as DispatchTaskStatus,An as Document,Pn as FormFieldAttachments,Dn as FormFieldBase,En as FormFieldBoolean,Kn as FormFieldChoice,Rn as FormFieldDate,qn as FormFieldNumeric,Bn as FormFieldNumericSize,Gn as FormFieldSignature,_n as FormFieldText,Vn as FormFieldTime,Fn as FormFieldTimezone,Vi as FormFieldType,Wn as FormResult,Yn as FormTemplate,sr as Icon,Qn as IconGlyph,tr as IconLabel,jn as IconLayer,Cn as LabelStyle,yi as LatLng,wi as LatLngBounds,Ne as Machine,ir as MaintenanceInterval,nr as MaintenanceJob,Hn as MaintenanceJobStatus,rr as MaintenanceSchedule,ur as MessageFolder,ar as MessageStatus,or as MessageType,pe as NotificationMethod,Tn as NotificationServerEmail,bn as NotificationServerSms,Bi as PasswordExpiryMode,yn as PasswordPolicy,fe as Permission,ye as PermissionEscalation,we as PermissionEscalationState,ge as PermissionEscalationType,ce as PermissionLevel,le as PermissionMethod,de as PermissionType,er as Picture,br as Place,cr as PlaceType,Ni as Point,vi as Position,Hr as Provider,Rr as ProviderAdvanced,Br as ProviderCommand,dr as ProviderCommandStatus,mr as ProviderCommandType,Or as ProviderConfig,Ur as ProviderConfiguration,Ir as ProviderConfigurationNode,Mr as ProviderConfigurationType,Lr as ProviderControl,Kr as ProviderData,jr as ProviderGeneral,Ar as ProviderGeofenceBase,Dr as ProviderGeofenceCircular,Pr as ProviderGeofencePoint,Er as ProviderGeofencePolygon,zr as ProviderGeofenceRectangle,Cr as ProviderRegistration,xr as ProviderScript,Jr as ProviderScriptBlock,kr as ProviderScriptParameter,lr as ProviderScriptParameterType,Ki as ProviderType,fi as Radial,gi as Rectangle,qr as ReportBreakdown,Gr as ReportBreakdownJob,_r as ReportBreakdownMessage,Vr as ReportBreakdownTask,pr as ReportFilterMode,Fr as ReportNotifications,Zr as ReportOptions,Wr as ReportParameter,gr as ReportParameterType,Xr as ReportRecurrence,fr as ReportRecurrenceType,sh as ReportResult,eh as ReportResultData,ih as ReportSchedule,Qr as ReportScorecard,Yr as ReportScorecardParameter,$r as ReportScorecardRules,Nr as ReportStatus,nh as ReportSummary,yr as ReportSummaryReason,rh as ReportTemplate,th as ReportTotal,wr as ReportType,ki as SearchPattern,xe as Session,Li as SessionMultiUser,Sn as SessionPolicy,Ce as SessionStatus,pi as Size,Si as StreetAddress,me as SystemsOfUnits,Be as TimeSpan,oe as Timezone,He as User,Ie as UserAdvanced,je as UserGeneral,qe as UserGroup,Le as UserNotifications,gh as authorizer,ah as classes,ch as convert,lh as encoding,ph as geography,mh as geometry,dh as serialization,oh as storage,uh as utility,hh as version};
|