een-api-toolkit 0.3.78 → 0.3.81

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/dist/index.js CHANGED
@@ -88,8 +88,8 @@ function se() {
88
88
  function d(e) {
89
89
  return { data: e, error: null };
90
90
  }
91
- function i(e, n, t, r) {
92
- return { data: null, error: { code: e, message: n, status: t, details: r } };
91
+ function r(e, n, t, i) {
92
+ return { data: null, error: { code: e, message: n, status: t, details: i } };
93
93
  }
94
94
  function Ve(e) {
95
95
  if (e)
@@ -106,16 +106,16 @@ function P(e) {
106
106
  if (!e || typeof e != "string")
107
107
  return !1;
108
108
  const n = e.toLowerCase().trim();
109
- return n ? De.some(
110
- (t) => n === t.substring(1) || n.endsWith(t)
111
- ) : !1;
109
+ return !n || !/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*$/.test(n) ? !1 : De.some(
110
+ (i) => n === i.substring(1) || n.endsWith(i)
111
+ );
112
112
  }
113
113
  let X = null;
114
114
  function Oe() {
115
115
  return X || (X = Promise.resolve().then(() => Fe).then((e) => e.refreshToken)), X;
116
116
  }
117
117
  const f = Ae("een-auth", () => {
118
- const e = A(null), n = A(null), t = A(null), r = A(null), a = A(null), o = A(443), c = A(null), u = A(null), h = A(!1);
118
+ const e = A(null), n = A(null), t = A(null), i = A(null), a = A(null), o = A(443), c = A(null), u = A(null), h = A(!1);
119
119
  let _ = null;
120
120
  const v = A(!1), g = A(null), O = B(() => !!e.value), b = B(() => a.value ? o.value === 443 ? `https://${a.value}` : `https://${a.value}:${o.value}` : null), U = B(() => n.value ? Date.now() >= n.value : !0), x = B(() => n.value ? Math.max(0, n.value - Date.now()) : 0);
121
121
  function W(l, R) {
@@ -125,7 +125,7 @@ const f = Ae("een-auth", () => {
125
125
  t.value = l, k();
126
126
  }
127
127
  function S(l) {
128
- r.value = l, k();
128
+ i.value = l, k();
129
129
  }
130
130
  function $(l) {
131
131
  let R, p = 443;
@@ -176,7 +176,7 @@ const f = Ae("een-auth", () => {
176
176
  v.value = !1, g.value = null;
177
177
  }
178
178
  function M() {
179
- u.value && (clearTimeout(u.value), u.value = null), e.value = null, n.value = null, t.value = null, r.value = null, a.value = null, o.value = 443, c.value = null, v.value = !1, g.value = null, Ee();
179
+ u.value && (clearTimeout(u.value), u.value = null), e.value = null, n.value = null, t.value = null, i.value = null, a.value = null, o.value = 443, c.value = null, v.value = !1, g.value = null, Ee();
180
180
  }
181
181
  function oe() {
182
182
  M(), s("Logged out");
@@ -187,7 +187,7 @@ const f = Ae("een-auth", () => {
187
187
  function k() {
188
188
  try {
189
189
  const l = J();
190
- e.value && l.setItem("een_token", e.value), n.value && l.setItem("een_tokenExpiration", String(n.value)), t.value && l.setItem("een_refreshTokenMarker", t.value), r.value && l.setItem("een_sessionId", r.value), a.value && l.setItem("een_hostname", a.value), o.value !== 443 && l.setItem("een_port", String(o.value)), c.value && l.setItem("een_userProfile", JSON.stringify(c.value));
190
+ e.value && l.setItem("een_token", e.value), n.value && l.setItem("een_tokenExpiration", String(n.value)), t.value && l.setItem("een_refreshTokenMarker", t.value), i.value && l.setItem("een_sessionId", i.value), a.value && l.setItem("een_hostname", a.value), o.value !== 443 && l.setItem("een_port", String(o.value)), c.value && l.setItem("een_userProfile", JSON.stringify(c.value));
191
191
  } catch (l) {
192
192
  s("Failed to save to storage:", l instanceof Error ? l.message : String(l));
193
193
  }
@@ -197,7 +197,7 @@ const f = Ae("een-auth", () => {
197
197
  const l = J();
198
198
  e.value = l.getItem("een_token");
199
199
  const R = l.getItem("een_tokenExpiration");
200
- n.value = R ? parseInt(R, 10) : null, t.value = l.getItem("een_refreshTokenMarker"), r.value = l.getItem("een_sessionId");
200
+ n.value = R ? parseInt(R, 10) : null, t.value = l.getItem("een_refreshTokenMarker"), i.value = l.getItem("een_sessionId");
201
201
  const p = l.getItem("een_hostname");
202
202
  if (p && !P(p)) {
203
203
  console.warn(`[EEN API Toolkit] Rejected stored hostname - clearing all auth data: ${p}`), M();
@@ -229,7 +229,7 @@ const f = Ae("een-auth", () => {
229
229
  token: e,
230
230
  tokenExpiration: n,
231
231
  refreshTokenMarker: t,
232
- sessionId: r,
232
+ sessionId: i,
233
233
  hostname: a,
234
234
  port: o,
235
235
  userProfile: c,
@@ -274,76 +274,76 @@ function me() {
274
274
  async function ue(e) {
275
275
  const n = Z();
276
276
  if (!n)
277
- return i("AUTH_FAILED", "Proxy URL not configured. Call initEenToolkit() or set VITE_PROXY_URL");
277
+ return r("AUTH_FAILED", "Proxy URL not configured. Call initEenToolkit() or set VITE_PROXY_URL");
278
278
  const t = new URLSearchParams({
279
279
  code: e,
280
280
  redirect_uri: se()
281
281
  });
282
282
  try {
283
- const r = await fetch(`${n}/proxy/getAccessToken?${t.toString()}`, {
283
+ const i = await fetch(`${n}/proxy/getAccessToken?${t.toString()}`, {
284
284
  method: "POST",
285
285
  credentials: "include",
286
286
  headers: {
287
287
  Accept: "application/json"
288
288
  }
289
289
  });
290
- if (!r.ok) {
291
- const o = await r.text().catch(() => "Unknown error");
292
- return i("AUTH_FAILED", `Token exchange failed: ${o}`, r.status);
290
+ if (!i.ok) {
291
+ const o = await i.text().catch(() => "Unknown error");
292
+ return r("AUTH_FAILED", `Token exchange failed: ${o}`, i.status);
293
293
  }
294
- const a = await r.json();
294
+ const a = await i.json();
295
295
  return s("Token received, expires in:", a.expiresIn), d(a);
296
- } catch (r) {
297
- return i("NETWORK_ERROR", `Failed to exchange code: ${String(r)}`);
296
+ } catch (i) {
297
+ return r("NETWORK_ERROR", `Failed to exchange code: ${String(i)}`);
298
298
  }
299
299
  }
300
300
  async function $e() {
301
301
  const e = Z();
302
302
  if (!e)
303
- return i("AUTH_FAILED", "Proxy URL not configured");
303
+ return r("AUTH_FAILED", "Proxy URL not configured");
304
304
  const n = f();
305
305
  try {
306
306
  const t = {
307
307
  Accept: "application/json"
308
308
  };
309
309
  n.sessionId && (t.Authorization = `Bearer ${n.sessionId}`);
310
- const r = await fetch(`${e}/proxy/refreshAccessToken`, {
310
+ const i = await fetch(`${e}/proxy/refreshAccessToken`, {
311
311
  method: "POST",
312
312
  credentials: "include",
313
313
  headers: t
314
314
  });
315
- if (!r.ok) {
316
- const o = await r.text().catch(() => "Unknown error");
317
- return i("AUTH_FAILED", `Token refresh failed: ${o}`, r.status);
315
+ if (!i.ok) {
316
+ const o = await i.text().catch(() => "Unknown error");
317
+ return r("AUTH_FAILED", `Token refresh failed: ${o}`, i.status);
318
318
  }
319
- const a = await r.json();
319
+ const a = await i.json();
320
320
  return n.setToken(a.accessToken, a.expiresIn), s("Token refreshed, expires in:", a.expiresIn), d(a);
321
321
  } catch (t) {
322
- return i("NETWORK_ERROR", `Failed to refresh token: ${String(t)}`);
322
+ return r("NETWORK_ERROR", `Failed to refresh token: ${String(t)}`);
323
323
  }
324
324
  }
325
325
  async function ke() {
326
326
  const e = Z();
327
327
  if (!e)
328
- return i("AUTH_FAILED", "Proxy URL not configured");
328
+ return r("AUTH_FAILED", "Proxy URL not configured");
329
329
  const n = f();
330
330
  try {
331
331
  const t = {
332
332
  Accept: "application/json"
333
333
  };
334
334
  n.sessionId && (t.Authorization = `Bearer ${n.sessionId}`);
335
- const r = await fetch(`${e}/proxy/revoke`, {
335
+ const i = await fetch(`${e}/proxy/revoke`, {
336
336
  method: "POST",
337
337
  credentials: "include",
338
338
  headers: t
339
339
  });
340
- if (n.logout(), !r.ok) {
341
- const a = await r.text().catch(() => "Unknown error");
342
- return i("AUTH_FAILED", `Token revocation failed: ${a}`, r.status);
340
+ if (n.logout(), !i.ok) {
341
+ const a = await i.text().catch(() => "Unknown error");
342
+ return r("AUTH_FAILED", `Token revocation failed: ${a}`, i.status);
343
343
  }
344
344
  return s("Token revoked"), d(void 0);
345
345
  } catch (t) {
346
- return n.logout(), i("NETWORK_ERROR", `Failed to revoke token: ${String(t)}`);
346
+ return n.logout(), r("NETWORK_ERROR", `Failed to revoke token: ${String(t)}`);
347
347
  }
348
348
  }
349
349
  async function we(e, n) {
@@ -353,22 +353,22 @@ async function we(e, n) {
353
353
  } catch {
354
354
  }
355
355
  if (!t)
356
- return i("AUTH_FAILED", "No OAuth state found. Please restart the login process.");
356
+ return r("AUTH_FAILED", "No OAuth state found. Please restart the login process.");
357
357
  if (!je(n, t))
358
- return i("AUTH_FAILED", "Invalid OAuth state. Possible CSRF attack.");
358
+ return r("AUTH_FAILED", "Invalid OAuth state. Possible CSRF attack.");
359
359
  s("State validated, exchanging code for token");
360
- const r = await ue(e);
361
- if (r.error)
362
- return r;
363
- const a = f(), o = r.data;
360
+ const i = await ue(e);
361
+ if (i.error)
362
+ return i;
363
+ const a = f(), o = i.data;
364
364
  return a.setToken(o.accessToken, o.expiresIn), a.setRefreshTokenMarker("present"), a.setSessionId(o.sessionId), a.setBaseUrl(o.httpsBaseUrl), s("Auth callback complete, user:", o.userEmail), d(o);
365
365
  }
366
366
  function je(e, n) {
367
367
  if (e.length !== n.length)
368
368
  return !1;
369
369
  let t = 0;
370
- for (let r = 0; r < e.length; r++)
371
- t |= e.charCodeAt(r) ^ n.charCodeAt(r);
370
+ for (let i = 0; i < e.length; i++)
371
+ t |= e.charCodeAt(i) ^ n.charCodeAt(i);
372
372
  return t === 0;
373
373
  }
374
374
  const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -382,9 +382,9 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
382
382
  async function Ke() {
383
383
  const e = f();
384
384
  if (!e.isAuthenticated)
385
- return i("AUTH_REQUIRED", "Authentication required");
385
+ return r("AUTH_REQUIRED", "Authentication required");
386
386
  if (!e.baseUrl)
387
- return i("AUTH_REQUIRED", "Base URL not configured");
387
+ return r("AUTH_REQUIRED", "Base URL not configured");
388
388
  const n = `${e.baseUrl}/api/v3.0/users/self`;
389
389
  s("Fetching current user:", n);
390
390
  try {
@@ -397,21 +397,21 @@ async function Ke() {
397
397
  });
398
398
  if (!t.ok)
399
399
  return ee(t);
400
- const r = await t.json();
401
- return s("Current user fetched:", r.email), e.setUserProfile(r), d(r);
400
+ const i = await t.json();
401
+ return s("Current user fetched:", i.email), e.setUserProfile(i), d(i);
402
402
  } catch (t) {
403
- return i("NETWORK_ERROR", `Failed to fetch current user: ${String(t)}`);
403
+ return r("NETWORK_ERROR", `Failed to fetch current user: ${String(t)}`);
404
404
  }
405
405
  }
406
406
  async function Ge(e) {
407
407
  const n = f();
408
408
  if (!n.isAuthenticated)
409
- return i("AUTH_REQUIRED", "Authentication required");
409
+ return r("AUTH_REQUIRED", "Authentication required");
410
410
  if (!n.baseUrl)
411
- return i("AUTH_REQUIRED", "Base URL not configured");
411
+ return r("AUTH_REQUIRED", "Base URL not configured");
412
412
  const t = new URLSearchParams();
413
413
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken), e?.include && e.include.length > 0 && t.append("include", e.include.join(","));
414
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/users${r ? `?${r}` : ""}`;
414
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/users${i ? `?${i}` : ""}`;
415
415
  s("Fetching users:", a);
416
416
  try {
417
417
  const o = await fetch(a, {
@@ -426,20 +426,20 @@ async function Ge(e) {
426
426
  const c = await o.json();
427
427
  return s("Users fetched:", c.results?.length ?? 0, "users"), d(c);
428
428
  } catch (o) {
429
- return i("NETWORK_ERROR", `Failed to fetch users: ${String(o)}`);
429
+ return r("NETWORK_ERROR", `Failed to fetch users: ${String(o)}`);
430
430
  }
431
431
  }
432
432
  async function Je(e, n) {
433
433
  const t = f();
434
434
  if (!t.isAuthenticated)
435
- return i("AUTH_REQUIRED", "Authentication required");
435
+ return r("AUTH_REQUIRED", "Authentication required");
436
436
  if (!t.baseUrl)
437
- return i("AUTH_REQUIRED", "Base URL not configured");
437
+ return r("AUTH_REQUIRED", "Base URL not configured");
438
438
  if (!e)
439
- return i("VALIDATION_ERROR", "User ID is required");
440
- const r = new URLSearchParams();
441
- n?.include && n.include.length > 0 && r.append("include", n.include.join(","));
442
- const a = r.toString(), o = `${t.baseUrl}/api/v3.0/users/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
439
+ return r("VALIDATION_ERROR", "User ID is required");
440
+ const i = new URLSearchParams();
441
+ n?.include && n.include.length > 0 && i.append("include", n.include.join(","));
442
+ const a = i.toString(), o = `${t.baseUrl}/api/v3.0/users/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
443
443
  s("Fetching user:", o);
444
444
  try {
445
445
  const c = await fetch(o, {
@@ -454,40 +454,40 @@ async function Je(e, n) {
454
454
  const u = await c.json();
455
455
  return s("User fetched:", u.email), d(u);
456
456
  } catch (c) {
457
- return i("NETWORK_ERROR", `Failed to fetch user: ${String(c)}`);
457
+ return r("NETWORK_ERROR", `Failed to fetch user: ${String(c)}`);
458
458
  }
459
459
  }
460
460
  async function ee(e) {
461
461
  const n = e.status;
462
462
  let t;
463
463
  try {
464
- const r = await e.json();
465
- t = r.message ?? r.error ?? e.statusText;
464
+ const i = await e.json();
465
+ t = i.message ?? i.error ?? e.statusText;
466
466
  } catch {
467
467
  t = e.statusText || "Unknown error";
468
468
  }
469
469
  switch (n) {
470
470
  case 401:
471
- return i("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
471
+ return r("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
472
472
  case 403:
473
- return i("FORBIDDEN", `Access denied: ${t}`, n);
473
+ return r("FORBIDDEN", `Access denied: ${t}`, n);
474
474
  case 404:
475
- return i("NOT_FOUND", `Not found: ${t}`, n);
475
+ return r("NOT_FOUND", `Not found: ${t}`, n);
476
476
  case 429:
477
- return i("RATE_LIMITED", `Rate limited: ${t}`, n);
477
+ return r("RATE_LIMITED", `Rate limited: ${t}`, n);
478
478
  default:
479
- return i("API_ERROR", `API error: ${t}`, n);
479
+ return r("API_ERROR", `API error: ${t}`, n);
480
480
  }
481
481
  }
482
482
  async function Xe(e) {
483
483
  const n = f();
484
484
  if (!n.isAuthenticated)
485
- return i("AUTH_REQUIRED", "Authentication required");
485
+ return r("AUTH_REQUIRED", "Authentication required");
486
486
  if (!n.baseUrl)
487
- return i("AUTH_REQUIRED", "Base URL not configured");
487
+ return r("AUTH_REQUIRED", "Base URL not configured");
488
488
  const t = new URLSearchParams();
489
489
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken), e?.include && e.include.length > 0 && t.append("include", e.include.join(",")), e?.sort && e.sort.length > 0 && t.append("sort", e.sort.join(",")), e?.locationId__in && e.locationId__in.length > 0 && t.append("locationId__in", e.locationId__in.join(",")), e?.bridgeId__in && e.bridgeId__in.length > 0 && t.append("bridgeId__in", e.bridgeId__in.join(",")), e?.multiCameraId && t.append("multiCameraId", e.multiCameraId), e?.multiCameraId__ne && t.append("multiCameraId__ne", e.multiCameraId__ne), e?.multiCameraId__in && e.multiCameraId__in.length > 0 && t.append("multiCameraId__in", e.multiCameraId__in.join(",")), e?.tags__contains && e.tags__contains.length > 0 && t.append("tags__contains", e.tags__contains.join(",")), e?.tags__any && e.tags__any.length > 0 && t.append("tags__any", e.tags__any.join(",")), e?.packages__contains && e.packages__contains.length > 0 && t.append("packages__contains", e.packages__contains.join(",")), e?.name && t.append("name", e.name), e?.name__contains && t.append("name__contains", e.name__contains), e?.name__in && e.name__in.length > 0 && t.append("name__in", e.name__in.join(",")), e?.id__in && e.id__in.length > 0 && t.append("id__in", e.id__in.join(",")), e?.id__notIn && e.id__notIn.length > 0 && t.append("id__notIn", e.id__notIn.join(",")), e?.id__contains && t.append("id__contains", e.id__contains), e?.layoutId && t.append("layoutId", e.layoutId), typeof e?.shared == "boolean" && t.append("shareDetails.shared", String(e.shared)), e?.sharedCameraAccount && t.append("shareDetails.accountId", e.sharedCameraAccount), typeof e?.firstResponder == "boolean" && t.append("shareDetails.firstResponder", String(e.firstResponder)), typeof e?.directToCloud == "boolean" && t.append("deviceInfo.directToCloud", String(e.directToCloud)), e?.speakerId__in && e.speakerId__in.length > 0 && t.append("speakerId__in", e.speakerId__in.join(",")), e?.q && t.append("q", e.q), typeof e?.qRelevance__gte == "number" && t.append("qRelevance__gte", String(e.qRelevance__gte)), e?.enabledAnalytics__contains && e.enabledAnalytics__contains.length > 0 && t.append("enabledAnalytics__contains", e.enabledAnalytics__contains.join(",")), e?.status__in && e.status__in.length > 0 && t.append("status__in", e.status__in.join(",")), e?.status__ne && t.append("status__ne", e.status__ne);
490
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/cameras${r ? `?${r}` : ""}`;
490
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/cameras${i ? `?${i}` : ""}`;
491
491
  s("Fetching cameras:", a);
492
492
  try {
493
493
  const o = await fetch(a, {
@@ -502,20 +502,20 @@ async function Xe(e) {
502
502
  const c = await o.json();
503
503
  return s("Cameras fetched:", c.results?.length ?? 0, "cameras"), d(c);
504
504
  } catch (o) {
505
- return i("NETWORK_ERROR", `Failed to fetch cameras: ${String(o)}`);
505
+ return r("NETWORK_ERROR", `Failed to fetch cameras: ${String(o)}`);
506
506
  }
507
507
  }
508
508
  async function Ye(e, n) {
509
509
  const t = f();
510
510
  if (!t.isAuthenticated)
511
- return i("AUTH_REQUIRED", "Authentication required");
511
+ return r("AUTH_REQUIRED", "Authentication required");
512
512
  if (!t.baseUrl)
513
- return i("AUTH_REQUIRED", "Base URL not configured");
513
+ return r("AUTH_REQUIRED", "Base URL not configured");
514
514
  if (!e)
515
- return i("VALIDATION_ERROR", "Camera ID is required");
516
- const r = new URLSearchParams();
517
- n?.include && n.include.length > 0 && r.append("include", n.include.join(","));
518
- const a = r.toString(), o = `${t.baseUrl}/api/v3.0/cameras/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
515
+ return r("VALIDATION_ERROR", "Camera ID is required");
516
+ const i = new URLSearchParams();
517
+ n?.include && n.include.length > 0 && i.append("include", n.include.join(","));
518
+ const a = i.toString(), o = `${t.baseUrl}/api/v3.0/cameras/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
519
519
  s("Fetching camera:", o);
520
520
  try {
521
521
  const c = await fetch(o, {
@@ -530,20 +530,20 @@ async function Ye(e, n) {
530
530
  const u = await c.json();
531
531
  return s("Camera fetched:", u.name), d(u);
532
532
  } catch (c) {
533
- return i("NETWORK_ERROR", `Failed to fetch camera: ${String(c)}`);
533
+ return r("NETWORK_ERROR", `Failed to fetch camera: ${String(c)}`);
534
534
  }
535
535
  }
536
536
  async function Ze(e, n) {
537
537
  const t = f();
538
538
  if (!t.isAuthenticated)
539
- return i("AUTH_REQUIRED", "Authentication required");
539
+ return r("AUTH_REQUIRED", "Authentication required");
540
540
  if (!t.baseUrl)
541
- return i("AUTH_REQUIRED", "Base URL not configured");
541
+ return r("AUTH_REQUIRED", "Base URL not configured");
542
542
  if (!e)
543
- return i("VALIDATION_ERROR", "Camera ID is required");
544
- const r = new URLSearchParams();
545
- n?.include && n.include.length > 0 && r.append("include", n.include.join(","));
546
- const a = r.toString(), o = `${t.baseUrl}/api/v3.0/cameras/${encodeURIComponent(e)}/settings${a ? `?${a}` : ""}`;
543
+ return r("VALIDATION_ERROR", "Camera ID is required");
544
+ const i = new URLSearchParams();
545
+ n?.include && n.include.length > 0 && i.append("include", n.include.join(","));
546
+ const a = i.toString(), o = `${t.baseUrl}/api/v3.0/cameras/${encodeURIComponent(e)}/settings${a ? `?${a}` : ""}`;
547
547
  s("Fetching camera settings:", o);
548
548
  try {
549
549
  const c = await fetch(o, {
@@ -558,40 +558,40 @@ async function Ze(e, n) {
558
558
  const u = await c.json();
559
559
  return s("Camera settings fetched for:", e), d(u);
560
560
  } catch (c) {
561
- return i("NETWORK_ERROR", `Failed to fetch camera settings: ${String(c)}`);
561
+ return r("NETWORK_ERROR", `Failed to fetch camera settings: ${String(c)}`);
562
562
  }
563
563
  }
564
564
  async function te(e) {
565
565
  const n = e.status;
566
566
  let t;
567
567
  try {
568
- const r = await e.json();
569
- t = r.message ?? r.error ?? e.statusText;
570
- } catch (r) {
571
- s("Failed to parse error response JSON:", r), t = e.statusText || "Unknown error";
568
+ const i = await e.json();
569
+ t = i.message ?? i.error ?? e.statusText;
570
+ } catch (i) {
571
+ s("Failed to parse error response JSON:", i), t = e.statusText || "Unknown error";
572
572
  }
573
573
  switch (n) {
574
574
  case 401:
575
- return i("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
575
+ return r("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
576
576
  case 403:
577
- return i("FORBIDDEN", `Access denied: ${t}`, n);
577
+ return r("FORBIDDEN", `Access denied: ${t}`, n);
578
578
  case 404:
579
- return i("NOT_FOUND", `Not found: ${t}`, n);
579
+ return r("NOT_FOUND", `Not found: ${t}`, n);
580
580
  case 429:
581
- return i("RATE_LIMITED", `Rate limited: ${t}`, n);
581
+ return r("RATE_LIMITED", `Rate limited: ${t}`, n);
582
582
  default:
583
- return i("API_ERROR", `API error: ${t}`, n);
583
+ return r("API_ERROR", `API error: ${t}`, n);
584
584
  }
585
585
  }
586
586
  async function et(e) {
587
587
  const n = f();
588
588
  if (!n.isAuthenticated)
589
- return i("AUTH_REQUIRED", "Authentication required");
589
+ return r("AUTH_REQUIRED", "Authentication required");
590
590
  if (!n.baseUrl)
591
- return i("AUTH_REQUIRED", "Base URL not configured");
591
+ return r("AUTH_REQUIRED", "Base URL not configured");
592
592
  const t = new URLSearchParams();
593
593
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken), e?.include && e.include.length > 0 && t.append("include", e.include.join(",")), e?.sort && e.sort.length > 0 && t.append("sort", e.sort.join(",")), e?.locationId__in && e.locationId__in.length > 0 && t.append("locationId__in", e.locationId__in.join(",")), e?.tags__contains && e.tags__contains.length > 0 && t.append("tags__contains", e.tags__contains.join(",")), e?.tags__any && e.tags__any.length > 0 && t.append("tags__any", e.tags__any.join(",")), e?.name && t.append("name", e.name), e?.name__contains && t.append("name__contains", e.name__contains), e?.name__in && e.name__in.length > 0 && t.append("name__in", e.name__in.join(",")), e?.id__in && e.id__in.length > 0 && t.append("id__in", e.id__in.join(",")), e?.id__notIn && e.id__notIn.length > 0 && t.append("id__notIn", e.id__notIn.join(",")), e?.q && t.append("q", e.q), typeof e?.qRelevance__gte == "number" && t.append("qRelevance__gte", String(e.qRelevance__gte)), e?.status__in && e.status__in.length > 0 && t.append("status__in", e.status__in.join(",")), e?.status__ne && t.append("status__ne", e.status__ne);
594
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/bridges${r ? `?${r}` : ""}`;
594
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/bridges${i ? `?${i}` : ""}`;
595
595
  s("Fetching bridges:", a);
596
596
  try {
597
597
  const o = await fetch(a, {
@@ -606,20 +606,20 @@ async function et(e) {
606
606
  const c = await o.json();
607
607
  return s("Bridges fetched:", c.results?.length ?? 0, "bridges"), d(c);
608
608
  } catch (o) {
609
- return i("NETWORK_ERROR", `Failed to fetch bridges: ${String(o)}`);
609
+ return r("NETWORK_ERROR", `Failed to fetch bridges: ${String(o)}`);
610
610
  }
611
611
  }
612
612
  async function tt(e, n) {
613
613
  const t = f();
614
614
  if (!t.isAuthenticated)
615
- return i("AUTH_REQUIRED", "Authentication required");
615
+ return r("AUTH_REQUIRED", "Authentication required");
616
616
  if (!t.baseUrl)
617
- return i("AUTH_REQUIRED", "Base URL not configured");
617
+ return r("AUTH_REQUIRED", "Base URL not configured");
618
618
  if (!e)
619
- return i("VALIDATION_ERROR", "Bridge ID is required");
620
- const r = new URLSearchParams();
621
- n?.include && n.include.length > 0 && r.append("include", n.include.join(","));
622
- const a = r.toString(), o = `${t.baseUrl}/api/v3.0/bridges/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
619
+ return r("VALIDATION_ERROR", "Bridge ID is required");
620
+ const i = new URLSearchParams();
621
+ n?.include && n.include.length > 0 && i.append("include", n.include.join(","));
622
+ const a = i.toString(), o = `${t.baseUrl}/api/v3.0/bridges/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
623
623
  s("Fetching bridge:", o);
624
624
  try {
625
625
  const c = await fetch(o, {
@@ -634,40 +634,40 @@ async function tt(e, n) {
634
634
  const u = await c.json();
635
635
  return s("Bridge fetched:", u.name), d(u);
636
636
  } catch (c) {
637
- return i("NETWORK_ERROR", `Failed to fetch bridge: ${String(c)}`);
637
+ return r("NETWORK_ERROR", `Failed to fetch bridge: ${String(c)}`);
638
638
  }
639
639
  }
640
640
  async function le(e) {
641
641
  const n = e.status;
642
642
  let t;
643
643
  try {
644
- const r = await e.json();
645
- t = r.message ?? r.error ?? e.statusText;
646
- } catch (r) {
647
- s("Failed to parse error response JSON:", r), t = e.statusText || "Unknown error";
644
+ const i = await e.json();
645
+ t = i.message ?? i.error ?? e.statusText;
646
+ } catch (i) {
647
+ s("Failed to parse error response JSON:", i), t = e.statusText || "Unknown error";
648
648
  }
649
649
  switch (n) {
650
650
  case 401:
651
- return i("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
651
+ return r("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
652
652
  case 403:
653
- return i("FORBIDDEN", `Access denied: ${t}`, n);
653
+ return r("FORBIDDEN", `Access denied: ${t}`, n);
654
654
  case 404:
655
- return i("NOT_FOUND", `Not found: ${t}`, n);
655
+ return r("NOT_FOUND", `Not found: ${t}`, n);
656
656
  case 429:
657
- return i("RATE_LIMITED", `Rate limited: ${t}`, n);
657
+ return r("RATE_LIMITED", `Rate limited: ${t}`, n);
658
658
  default:
659
- return i("API_ERROR", `API error: ${t}`, n);
659
+ return r("API_ERROR", `API error: ${t}`, n);
660
660
  }
661
661
  }
662
662
  async function nt(e) {
663
663
  const n = f();
664
664
  if (!n.isAuthenticated)
665
- return i("AUTH_REQUIRED", "Authentication required");
665
+ return r("AUTH_REQUIRED", "Authentication required");
666
666
  if (!n.baseUrl)
667
- return i("AUTH_REQUIRED", "Base URL not configured");
667
+ return r("AUTH_REQUIRED", "Base URL not configured");
668
668
  const t = new URLSearchParams();
669
669
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken), e?.include && e.include.length > 0 && t.append("include", e.include.join(",")), e?.sort && e.sort.length > 0 && t.append("sort", e.sort.join(",")), e?.name && t.append("name", e.name), e?.name__in && e.name__in.length > 0 && t.append("name__in", e.name__in.join(",")), e?.name__contains && t.append("name__contains", e.name__contains), e?.id__in && e.id__in.length > 0 && t.append("id__in", e.id__in.join(",")), e?.["layoutPanes.cameras.bridgeId"] && t.append("layoutPanes.cameras.bridgeId", e["layoutPanes.cameras.bridgeId"]), e?.q && t.append("q", e.q), typeof e?.qRelevance__gte == "number" && t.append("qRelevance__gte", String(e.qRelevance__gte));
670
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/layouts${r ? `?${r}` : ""}`;
670
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/layouts${i ? `?${i}` : ""}`;
671
671
  s("Fetching layouts:", a);
672
672
  try {
673
673
  const o = await fetch(a, {
@@ -682,20 +682,20 @@ async function nt(e) {
682
682
  const c = await o.json();
683
683
  return s("Layouts fetched:", c.results?.length ?? 0, "layouts"), d(c);
684
684
  } catch (o) {
685
- return i("NETWORK_ERROR", `Failed to fetch layouts: ${String(o)}`);
685
+ return r("NETWORK_ERROR", `Failed to fetch layouts: ${String(o)}`);
686
686
  }
687
687
  }
688
- async function it(e, n) {
688
+ async function rt(e, n) {
689
689
  const t = f();
690
690
  if (!t.isAuthenticated)
691
- return i("AUTH_REQUIRED", "Authentication required");
691
+ return r("AUTH_REQUIRED", "Authentication required");
692
692
  if (!t.baseUrl)
693
- return i("AUTH_REQUIRED", "Base URL not configured");
693
+ return r("AUTH_REQUIRED", "Base URL not configured");
694
694
  if (!e)
695
- return i("VALIDATION_ERROR", "Layout ID is required");
696
- const r = new URLSearchParams();
697
- n?.include && n.include.length > 0 && r.append("include", n.include.join(","));
698
- const a = r.toString(), o = `${t.baseUrl}/api/v3.0/layouts/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
695
+ return r("VALIDATION_ERROR", "Layout ID is required");
696
+ const i = new URLSearchParams();
697
+ n?.include && n.include.length > 0 && i.append("include", n.include.join(","));
698
+ const a = i.toString(), o = `${t.baseUrl}/api/v3.0/layouts/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
699
699
  s("Fetching layout:", o);
700
700
  try {
701
701
  const c = await fetch(o, {
@@ -710,26 +710,26 @@ async function it(e, n) {
710
710
  const u = await c.json();
711
711
  return s("Layout fetched:", u.name), d(u);
712
712
  } catch (c) {
713
- return i("NETWORK_ERROR", `Failed to fetch layout: ${String(c)}`);
713
+ return r("NETWORK_ERROR", `Failed to fetch layout: ${String(c)}`);
714
714
  }
715
715
  }
716
- async function rt(e) {
716
+ async function it(e) {
717
717
  const n = f();
718
718
  if (!n.isAuthenticated)
719
- return i("AUTH_REQUIRED", "Authentication required");
719
+ return r("AUTH_REQUIRED", "Authentication required");
720
720
  if (!n.baseUrl)
721
- return i("AUTH_REQUIRED", "Base URL not configured");
721
+ return r("AUTH_REQUIRED", "Base URL not configured");
722
722
  if (!e.name)
723
- return i("VALIDATION_ERROR", "Layout name is required");
723
+ return r("VALIDATION_ERROR", "Layout name is required");
724
724
  if (!e.settings)
725
- return i("VALIDATION_ERROR", "Layout settings are required");
725
+ return r("VALIDATION_ERROR", "Layout settings are required");
726
726
  const t = `${n.baseUrl}/api/v3.0/layouts`;
727
727
  s("Creating layout:", e.name);
728
- const r = {
728
+ const i = {
729
729
  name: e.name,
730
730
  settings: e.settings
731
731
  };
732
- e.panes && (r.panes = e.panes);
732
+ e.panes && (i.panes = e.panes);
733
733
  try {
734
734
  const a = await fetch(t, {
735
735
  method: "POST",
@@ -738,32 +738,32 @@ async function rt(e) {
738
738
  "Content-Type": "application/json",
739
739
  Authorization: `Bearer ${n.token}`
740
740
  },
741
- body: JSON.stringify(r)
741
+ body: JSON.stringify(i)
742
742
  });
743
743
  if (!a.ok)
744
744
  return j(a);
745
745
  const o = await a.json();
746
746
  return s("Layout created:", o.id, o.name), d(o);
747
747
  } catch (a) {
748
- return i("NETWORK_ERROR", `Failed to create layout: ${String(a)}`);
748
+ return r("NETWORK_ERROR", `Failed to create layout: ${String(a)}`);
749
749
  }
750
750
  }
751
751
  async function ot(e, n) {
752
752
  const t = f();
753
753
  if (!t.isAuthenticated)
754
- return i("AUTH_REQUIRED", "Authentication required");
754
+ return r("AUTH_REQUIRED", "Authentication required");
755
755
  if (!t.baseUrl)
756
- return i("AUTH_REQUIRED", "Base URL not configured");
756
+ return r("AUTH_REQUIRED", "Base URL not configured");
757
757
  if (!e)
758
- return i("VALIDATION_ERROR", "Layout ID is required");
758
+ return r("VALIDATION_ERROR", "Layout ID is required");
759
759
  if (n.name === void 0 && n.settings === void 0 && n.panes === void 0)
760
- return i("VALIDATION_ERROR", "At least one field (name, settings, or panes) must be provided for update");
761
- const r = `${t.baseUrl}/api/v3.0/layouts/${encodeURIComponent(e)}`;
760
+ return r("VALIDATION_ERROR", "At least one field (name, settings, or panes) must be provided for update");
761
+ const i = `${t.baseUrl}/api/v3.0/layouts/${encodeURIComponent(e)}`;
762
762
  s("Updating layout:", e);
763
763
  const a = {};
764
764
  n.name !== void 0 && (a.name = n.name), n.settings !== void 0 && (a.settings = n.settings), n.panes !== void 0 && (a.panes = n.panes);
765
765
  try {
766
- const o = await fetch(r, {
766
+ const o = await fetch(i, {
767
767
  method: "PATCH",
768
768
  headers: {
769
769
  Accept: "application/json",
@@ -774,54 +774,54 @@ async function ot(e, n) {
774
774
  });
775
775
  return o.ok ? (s("Layout updated:", e), d(void 0)) : j(o);
776
776
  } catch (o) {
777
- return i("NETWORK_ERROR", `Failed to update layout: ${String(o)}`);
777
+ return r("NETWORK_ERROR", `Failed to update layout: ${String(o)}`);
778
778
  }
779
779
  }
780
780
  async function at(e) {
781
781
  const n = f();
782
782
  if (!n.isAuthenticated)
783
- return i("AUTH_REQUIRED", "Authentication required");
783
+ return r("AUTH_REQUIRED", "Authentication required");
784
784
  if (!n.baseUrl)
785
- return i("AUTH_REQUIRED", "Base URL not configured");
785
+ return r("AUTH_REQUIRED", "Base URL not configured");
786
786
  if (!e)
787
- return i("VALIDATION_ERROR", "Layout ID is required");
787
+ return r("VALIDATION_ERROR", "Layout ID is required");
788
788
  const t = `${n.baseUrl}/api/v3.0/layouts/${encodeURIComponent(e)}`;
789
789
  s("Deleting layout:", e);
790
790
  try {
791
- const r = await fetch(t, {
791
+ const i = await fetch(t, {
792
792
  method: "DELETE",
793
793
  headers: {
794
794
  Accept: "application/json",
795
795
  Authorization: `Bearer ${n.token}`
796
796
  }
797
797
  });
798
- return r.ok ? (s("Layout deleted:", e), d(void 0)) : j(r);
799
- } catch (r) {
800
- return i("NETWORK_ERROR", `Failed to delete layout: ${String(r)}`);
798
+ return i.ok ? (s("Layout deleted:", e), d(void 0)) : j(i);
799
+ } catch (i) {
800
+ return r("NETWORK_ERROR", `Failed to delete layout: ${String(i)}`);
801
801
  }
802
802
  }
803
803
  async function j(e) {
804
804
  const n = e.status;
805
805
  let t;
806
806
  try {
807
- const r = await e.json();
808
- t = r.message ?? r.error ?? e.statusText;
809
- } catch (r) {
810
- s("Failed to parse error response JSON:", r), t = e.statusText || "Unknown error";
807
+ const i = await e.json();
808
+ t = i.message ?? i.error ?? e.statusText;
809
+ } catch (i) {
810
+ s("Failed to parse error response JSON:", i), t = e.statusText || "Unknown error";
811
811
  }
812
812
  switch (n) {
813
813
  case 400:
814
- return i("VALIDATION_ERROR", `Bad request: ${t}`, n);
814
+ return r("VALIDATION_ERROR", `Bad request: ${t}`, n);
815
815
  case 401:
816
- return i("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
816
+ return r("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
817
817
  case 403:
818
- return i("FORBIDDEN", `Access denied: ${t}`, n);
818
+ return r("FORBIDDEN", `Access denied: ${t}`, n);
819
819
  case 404:
820
- return i("NOT_FOUND", `Not found: ${t}`, n);
820
+ return r("NOT_FOUND", `Not found: ${t}`, n);
821
821
  case 429:
822
- return i("RATE_LIMITED", `Rate limited: ${t}`, n);
822
+ return r("RATE_LIMITED", `Rate limited: ${t}`, n);
823
823
  default:
824
- return i("API_ERROR", `API error: ${t}`, n);
824
+ return r("API_ERROR", `API error: ${t}`, n);
825
825
  }
826
826
  }
827
827
  const Le = 3e4;
@@ -830,38 +830,38 @@ function F(e = Le) {
830
830
  return { controller: n, timeoutId: t };
831
831
  }
832
832
  function de(e) {
833
- const n = new Uint8Array(e), t = 8192, r = [];
833
+ const n = new Uint8Array(e), t = 8192, i = [];
834
834
  for (let o = 0; o < n.byteLength; o += t) {
835
835
  const c = n.subarray(o, Math.min(o + t, n.byteLength));
836
836
  let u = "";
837
837
  for (let h = 0; h < c.length; h++)
838
838
  u += String.fromCharCode(c[h]);
839
- r.push(u);
839
+ i.push(u);
840
840
  }
841
- const a = r.join("");
841
+ const a = i.join("");
842
842
  return typeof btoa == "function" ? btoa(a) : Buffer.from(a, "binary").toString("base64");
843
843
  }
844
844
  async function ct(e) {
845
845
  const n = f();
846
846
  if (!n.isAuthenticated)
847
- return i("AUTH_REQUIRED", "Authentication required");
847
+ return r("AUTH_REQUIRED", "Authentication required");
848
848
  if (!n.baseUrl)
849
- return i("AUTH_REQUIRED", "Base URL not configured");
849
+ return r("AUTH_REQUIRED", "Base URL not configured");
850
850
  if (!e.deviceId)
851
- return i("VALIDATION_ERROR", "Device ID is required");
851
+ return r("VALIDATION_ERROR", "Device ID is required");
852
852
  if (!e.type)
853
- return i("VALIDATION_ERROR", "Stream type is required (preview or main)");
853
+ return r("VALIDATION_ERROR", "Stream type is required (preview or main)");
854
854
  if (!e.mediaType)
855
- return i("VALIDATION_ERROR", "Media type is required (video or image)");
855
+ return r("VALIDATION_ERROR", "Media type is required (video or image)");
856
856
  if (!e.startTimestamp)
857
- return i("VALIDATION_ERROR", "Start timestamp is required");
857
+ return r("VALIDATION_ERROR", "Start timestamp is required");
858
858
  const t = new URLSearchParams();
859
859
  t.append("deviceId", e.deviceId), t.append("type", e.type), t.append("mediaType", e.mediaType), t.append("startTimestamp__gte", e.startTimestamp), e.endTimestamp && t.append("endTimestamp__lte", e.endTimestamp), typeof e.coalesce == "boolean" && t.append("coalesce", String(e.coalesce)), e.include && e.include.length > 0 && t.append("include", e.include.join(",")), e.pageToken && t.append("pageToken", e.pageToken), typeof e.pageSize == "number" && t.append("pageSize", String(e.pageSize));
860
- const r = `${n.baseUrl}/api/v3.0/media?${t.toString()}`;
861
- s("Fetching media intervals:", r);
860
+ const i = `${n.baseUrl}/api/v3.0/media?${t.toString()}`;
861
+ s("Fetching media intervals:", i);
862
862
  const { controller: a, timeoutId: o } = F();
863
863
  try {
864
- const c = await fetch(r, {
864
+ const c = await fetch(i, {
865
865
  method: "GET",
866
866
  headers: {
867
867
  Accept: "application/json",
@@ -874,7 +874,7 @@ async function ct(e) {
874
874
  const u = await c.json();
875
875
  return s("Media intervals fetched:", u.results?.length ?? 0, "intervals"), d(u);
876
876
  } catch (c) {
877
- return c instanceof Error && c.name === "AbortError" ? i("NETWORK_ERROR", "Request timed out") : i("NETWORK_ERROR", `Failed to fetch media intervals: ${String(c)}`);
877
+ return c instanceof Error && c.name === "AbortError" ? r("NETWORK_ERROR", "Request timed out") : r("NETWORK_ERROR", `Failed to fetch media intervals: ${String(c)}`);
878
878
  } finally {
879
879
  clearTimeout(o);
880
880
  }
@@ -882,14 +882,14 @@ async function ct(e) {
882
882
  async function st(e) {
883
883
  const n = f();
884
884
  if (!n.isAuthenticated)
885
- return i("AUTH_REQUIRED", "Authentication required");
885
+ return r("AUTH_REQUIRED", "Authentication required");
886
886
  if (!n.baseUrl)
887
- return i("AUTH_REQUIRED", "Base URL not configured");
887
+ return r("AUTH_REQUIRED", "Base URL not configured");
888
888
  if (!e.deviceId)
889
- return i("VALIDATION_ERROR", "Device ID is required");
890
- const t = e.type ?? "preview", r = new URLSearchParams();
891
- r.append("deviceId", e.deviceId), r.append("type", t);
892
- const a = `${n.baseUrl}/api/v3.0/media/liveImage.jpeg?${r.toString()}`;
889
+ return r("VALIDATION_ERROR", "Device ID is required");
890
+ const t = e.type ?? "preview", i = new URLSearchParams();
891
+ i.append("deviceId", e.deviceId), i.append("type", t);
892
+ const a = `${n.baseUrl}/api/v3.0/media/liveImage.jpeg?${i.toString()}`;
893
893
  s("Fetching live image:", a);
894
894
  const { controller: o, timeoutId: c } = F();
895
895
  try {
@@ -910,7 +910,7 @@ async function st(e) {
910
910
  prevToken: _
911
911
  });
912
912
  } catch (u) {
913
- return u instanceof Error && u.name === "AbortError" ? i("NETWORK_ERROR", "Request timed out") : i("NETWORK_ERROR", `Failed to fetch live image: ${String(u)}`);
913
+ return u instanceof Error && u.name === "AbortError" ? r("NETWORK_ERROR", "Request timed out") : r("NETWORK_ERROR", `Failed to fetch live image: ${String(u)}`);
914
914
  } finally {
915
915
  clearTimeout(c);
916
916
  }
@@ -918,22 +918,22 @@ async function st(e) {
918
918
  async function ut(e) {
919
919
  const n = f();
920
920
  if (!n.isAuthenticated)
921
- return i("AUTH_REQUIRED", "Authentication required");
921
+ return r("AUTH_REQUIRED", "Authentication required");
922
922
  if (!n.baseUrl)
923
- return i("AUTH_REQUIRED", "Base URL not configured");
923
+ return r("AUTH_REQUIRED", "Base URL not configured");
924
924
  if (!e.deviceId && !e.pageToken)
925
- return i("VALIDATION_ERROR", "Either deviceId or pageToken is required");
925
+ return r("VALIDATION_ERROR", "Either deviceId or pageToken is required");
926
926
  if (!e.pageToken && !(e.timestamp__lt || e.timestamp__lte || e.timestamp || e.timestamp__gte || e.timestamp__gt))
927
- return i("VALIDATION_ERROR", "At least one timestamp parameter is required");
927
+ return r("VALIDATION_ERROR", "At least one timestamp parameter is required");
928
928
  if (e.include?.includes("overlaySvgHeader") && (!e.overlayId__in || e.overlayId__in.length === 0))
929
- return i("VALIDATION_ERROR", "At least one overlayId must be provided when requesting overlay headers");
929
+ return r("VALIDATION_ERROR", "At least one overlayId must be provided when requesting overlay headers");
930
930
  const t = new URLSearchParams();
931
931
  e.deviceId && t.append("deviceId", e.deviceId), e.pageToken && t.append("pageToken", e.pageToken), e.type && t.append("type", e.type), e.timestamp__lt && t.append("timestamp__lt", e.timestamp__lt), e.timestamp__lte && t.append("timestamp__lte", e.timestamp__lte), e.timestamp && t.append("timestamp", e.timestamp), e.timestamp__gte && t.append("timestamp__gte", e.timestamp__gte), e.timestamp__gt && t.append("timestamp__gt", e.timestamp__gt), e.overlayId__in && e.overlayId__in.length > 0 && t.append("overlayId__in", e.overlayId__in.join(",")), e.include && e.include.length > 0 && t.append("include", e.include.join(",")), typeof e.targetWidth == "number" && t.append("targetWidth", String(e.targetWidth)), typeof e.targetHeight == "number" && t.append("targetHeight", String(e.targetHeight));
932
- const r = `${n.baseUrl}/api/v3.0/media/recordedImage.jpeg?${t.toString()}`;
933
- s("Fetching recorded image:", r);
932
+ const i = `${n.baseUrl}/api/v3.0/media/recordedImage.jpeg?${t.toString()}`;
933
+ s("Fetching recorded image:", i);
934
934
  const { controller: a, timeoutId: o } = F();
935
935
  try {
936
- const c = await fetch(r, {
936
+ const c = await fetch(i, {
937
937
  method: "GET",
938
938
  headers: {
939
939
  Accept: "image/jpeg",
@@ -952,7 +952,7 @@ async function ut(e) {
952
952
  overlaySvg: v
953
953
  });
954
954
  } catch (c) {
955
- return c instanceof Error && c.name === "AbortError" ? i("NETWORK_ERROR", "Request timed out") : i("NETWORK_ERROR", `Failed to fetch recorded image: ${String(c)}`);
955
+ return c instanceof Error && c.name === "AbortError" ? r("NETWORK_ERROR", "Request timed out") : r("NETWORK_ERROR", `Failed to fetch recorded image: ${String(c)}`);
956
956
  } finally {
957
957
  clearTimeout(o);
958
958
  }
@@ -961,35 +961,35 @@ async function C(e) {
961
961
  const n = e.status;
962
962
  let t;
963
963
  try {
964
- const r = await e.json();
965
- t = r.message ?? r.error ?? e.statusText;
964
+ const i = await e.json();
965
+ t = i.message ?? i.error ?? e.statusText;
966
966
  } catch {
967
967
  t = e.statusText || "Unknown error";
968
968
  }
969
969
  switch (n) {
970
970
  case 401:
971
- return i("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
971
+ return r("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
972
972
  case 403:
973
- return i("FORBIDDEN", `Access denied: ${t}`, n);
973
+ return r("FORBIDDEN", `Access denied: ${t}`, n);
974
974
  case 404:
975
- return i("NOT_FOUND", `Not found: ${t}`, n);
975
+ return r("NOT_FOUND", `Not found: ${t}`, n);
976
976
  case 429:
977
- return i("RATE_LIMITED", `Rate limited: ${t}`, n);
977
+ return r("RATE_LIMITED", `Rate limited: ${t}`, n);
978
978
  case 503:
979
- return i("SERVICE_UNAVAILABLE", `Service unavailable: ${t}`, n);
979
+ return r("SERVICE_UNAVAILABLE", `Service unavailable: ${t}`, n);
980
980
  default:
981
- return i("API_ERROR", `API error: ${t}`, n);
981
+ return r("API_ERROR", `API error: ${t}`, n);
982
982
  }
983
983
  }
984
984
  async function Ne() {
985
985
  const e = f();
986
986
  if (!e.isAuthenticated)
987
- return i("AUTH_REQUIRED", "Authentication required");
987
+ return r("AUTH_REQUIRED", "Authentication required");
988
988
  if (!e.baseUrl)
989
- return i("AUTH_REQUIRED", "Base URL not configured");
989
+ return r("AUTH_REQUIRED", "Base URL not configured");
990
990
  const n = `${e.baseUrl}/api/v3.0/media/session`;
991
991
  s("Fetching media session:", n);
992
- const { controller: t, timeoutId: r } = F();
992
+ const { controller: t, timeoutId: i } = F();
993
993
  try {
994
994
  const a = await fetch(n, {
995
995
  method: "GET",
@@ -1004,34 +1004,34 @@ async function Ne() {
1004
1004
  const o = await a.json();
1005
1005
  return s("Media session URL received:", o.url), d(o);
1006
1006
  } catch (a) {
1007
- return a instanceof Error && a.name === "AbortError" ? i("NETWORK_ERROR", "Request timed out") : i("NETWORK_ERROR", `Failed to fetch media session: ${String(a)}`);
1007
+ return a instanceof Error && a.name === "AbortError" ? r("NETWORK_ERROR", "Request timed out") : r("NETWORK_ERROR", `Failed to fetch media session: ${String(a)}`);
1008
1008
  } finally {
1009
- clearTimeout(r);
1009
+ clearTimeout(i);
1010
1010
  }
1011
1011
  }
1012
1012
  async function lt() {
1013
1013
  const e = f();
1014
1014
  if (!e.isAuthenticated)
1015
- return i("AUTH_REQUIRED", "Authentication required");
1015
+ return r("AUTH_REQUIRED", "Authentication required");
1016
1016
  const n = await Ne();
1017
1017
  if (n.error)
1018
- return i(
1018
+ return r(
1019
1019
  n.error.code,
1020
1020
  `Failed to get media session: ${n.error.message}`,
1021
1021
  n.error.status
1022
1022
  );
1023
1023
  if (!n.data?.url)
1024
- return i("API_ERROR", "No session URL returned from media session endpoint");
1024
+ return r("API_ERROR", "No session URL returned from media session endpoint");
1025
1025
  const t = n.data.url;
1026
1026
  s("Calling session URL to set cookie:", t);
1027
1027
  try {
1028
1028
  const o = new URL(t);
1029
1029
  if (!P(o.hostname))
1030
- return i("VALIDATION_ERROR", `Session URL domain not allowed: ${o.hostname}`);
1030
+ return r("VALIDATION_ERROR", `Session URL domain not allowed: ${o.hostname}`);
1031
1031
  } catch {
1032
- return i("VALIDATION_ERROR", "Invalid session URL format");
1032
+ return r("VALIDATION_ERROR", "Invalid session URL format");
1033
1033
  }
1034
- const { controller: r, timeoutId: a } = F();
1034
+ const { controller: i, timeoutId: a } = F();
1035
1035
  try {
1036
1036
  const o = await fetch(t, {
1037
1037
  method: "GET",
@@ -1041,7 +1041,7 @@ async function lt() {
1041
1041
  Accept: "*/*",
1042
1042
  Authorization: `Bearer ${e.token}`
1043
1043
  },
1044
- signal: r.signal
1044
+ signal: i.signal
1045
1045
  });
1046
1046
  if (!o.ok && o.status !== 204) {
1047
1047
  const c = o.status;
@@ -1052,14 +1052,14 @@ async function lt() {
1052
1052
  } catch {
1053
1053
  u = o.statusText || "Unknown error";
1054
1054
  }
1055
- return i("API_ERROR", `Failed to set media session cookie: ${u}`, c);
1055
+ return r("API_ERROR", `Failed to set media session cookie: ${u}`, c);
1056
1056
  }
1057
1057
  return s("Media session cookie set successfully"), d({
1058
1058
  success: !0,
1059
1059
  sessionUrl: t
1060
1060
  });
1061
1061
  } catch (o) {
1062
- return o instanceof Error && o.name === "AbortError" ? i("NETWORK_ERROR", "Request timed out while setting session cookie") : i("NETWORK_ERROR", `Failed to set media session cookie: ${String(o)}`);
1062
+ return o instanceof Error && o.name === "AbortError" ? r("NETWORK_ERROR", "Request timed out while setting session cookie") : r("NETWORK_ERROR", `Failed to set media session cookie: ${String(o)}`);
1063
1063
  } finally {
1064
1064
  clearTimeout(a);
1065
1065
  }
@@ -1067,12 +1067,12 @@ async function lt() {
1067
1067
  async function dt(e) {
1068
1068
  const n = f();
1069
1069
  if (!n.isAuthenticated)
1070
- return i("AUTH_REQUIRED", "Authentication required");
1070
+ return r("AUTH_REQUIRED", "Authentication required");
1071
1071
  if (!n.baseUrl)
1072
- return i("AUTH_REQUIRED", "Base URL not configured");
1072
+ return r("AUTH_REQUIRED", "Base URL not configured");
1073
1073
  const t = new URLSearchParams();
1074
1074
  typeof e?.pageSize == "number" && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken), e?.deviceId && t.append("deviceId", e.deviceId), e?.deviceId__in && e.deviceId__in.length > 0 && t.append("deviceId__in", e.deviceId__in.join(",")), e?.type && t.append("type", e.type), e?.include && e.include.length > 0 && t.append("include", e.include.join(","));
1075
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/feeds${r ? `?${r}` : ""}`;
1075
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/feeds${i ? `?${i}` : ""}`;
1076
1076
  s("Fetching feeds:", a);
1077
1077
  try {
1078
1078
  const o = await fetch(a, {
@@ -1088,48 +1088,48 @@ async function dt(e) {
1088
1088
  const c = await o.json();
1089
1089
  return s("Feeds fetched:", c.results?.length ?? 0, "feeds"), d(c);
1090
1090
  } catch (o) {
1091
- return i("NETWORK_ERROR", `Failed to fetch feeds: ${String(o)}`);
1091
+ return r("NETWORK_ERROR", `Failed to fetch feeds: ${String(o)}`);
1092
1092
  }
1093
1093
  }
1094
1094
  async function qe(e) {
1095
1095
  const n = e.status;
1096
1096
  let t;
1097
1097
  try {
1098
- const r = await e.json();
1099
- t = r.message ?? r.error;
1100
- } catch (r) {
1101
- s("Failed to parse error response JSON:", r);
1098
+ const i = await e.json();
1099
+ t = i.message ?? i.error;
1100
+ } catch (i) {
1101
+ s("Failed to parse error response JSON:", i);
1102
1102
  }
1103
1103
  switch (n) {
1104
1104
  case 401:
1105
- return i("AUTH_REQUIRED", t || "Authentication failed", n);
1105
+ return r("AUTH_REQUIRED", t || "Authentication failed", n);
1106
1106
  case 403:
1107
- return i("FORBIDDEN", t || "Access denied", n);
1107
+ return r("FORBIDDEN", t || "Access denied", n);
1108
1108
  case 404:
1109
- return i("NOT_FOUND", t || "Not found", n);
1109
+ return r("NOT_FOUND", t || "Not found", n);
1110
1110
  case 429:
1111
- return i("RATE_LIMITED", t || "Rate limited", n);
1111
+ return r("RATE_LIMITED", t || "Rate limited", n);
1112
1112
  case 503:
1113
- return i("SERVICE_UNAVAILABLE", t || "Service unavailable", n);
1113
+ return r("SERVICE_UNAVAILABLE", t || "Service unavailable", n);
1114
1114
  default:
1115
- return i("API_ERROR", t || e.statusText || "API error", n);
1115
+ return r("API_ERROR", t || e.statusText || "API error", n);
1116
1116
  }
1117
1117
  }
1118
1118
  async function ft(e) {
1119
1119
  const n = f();
1120
1120
  if (!n.isAuthenticated)
1121
- return i("AUTH_REQUIRED", "Authentication required");
1121
+ return r("AUTH_REQUIRED", "Authentication required");
1122
1122
  if (!n.baseUrl)
1123
- return i("AUTH_REQUIRED", "Base URL not configured");
1123
+ return r("AUTH_REQUIRED", "Base URL not configured");
1124
1124
  if (!e.actor)
1125
- return i("VALIDATION_ERROR", "actor parameter is required");
1125
+ return r("VALIDATION_ERROR", "actor parameter is required");
1126
1126
  if (!e.type__in || e.type__in.length === 0)
1127
- return i("VALIDATION_ERROR", "type__in parameter is required and must not be empty");
1127
+ return r("VALIDATION_ERROR", "type__in parameter is required and must not be empty");
1128
1128
  if (!e.startTimestamp__gte)
1129
- return i("VALIDATION_ERROR", "startTimestamp__gte parameter is required");
1129
+ return r("VALIDATION_ERROR", "startTimestamp__gte parameter is required");
1130
1130
  const t = new URLSearchParams();
1131
1131
  t.append("actor", e.actor), t.append("type__in", e.type__in.join(",")), t.append("startTimestamp__gte", T(e.startTimestamp__gte)), e.pageSize && t.append("pageSize", String(e.pageSize)), e.pageToken && t.append("pageToken", e.pageToken), e.startTimestamp__lte && t.append("startTimestamp__lte", T(e.startTimestamp__lte)), e.endTimestamp__gte && t.append("endTimestamp__gte", T(e.endTimestamp__gte)), e.endTimestamp__lte && t.append("endTimestamp__lte", T(e.endTimestamp__lte)), e.sort && t.append("sort", e.sort), e.include && e.include.length > 0 && t.append("include", e.include.join(","));
1132
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/events${r ? `?${r}` : ""}`;
1132
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/events${i ? `?${i}` : ""}`;
1133
1133
  s("Fetching events:", a);
1134
1134
  try {
1135
1135
  const o = await fetch(a, {
@@ -1144,20 +1144,20 @@ async function ft(e) {
1144
1144
  const c = await o.json();
1145
1145
  return s("Events fetched:", c.results?.length ?? 0, "events"), d(c);
1146
1146
  } catch (o) {
1147
- return i("NETWORK_ERROR", `Failed to fetch events: ${String(o)}`);
1147
+ return r("NETWORK_ERROR", `Failed to fetch events: ${String(o)}`);
1148
1148
  }
1149
1149
  }
1150
1150
  async function gt(e, n) {
1151
1151
  const t = f();
1152
1152
  if (!t.isAuthenticated)
1153
- return i("AUTH_REQUIRED", "Authentication required");
1153
+ return r("AUTH_REQUIRED", "Authentication required");
1154
1154
  if (!t.baseUrl)
1155
- return i("AUTH_REQUIRED", "Base URL not configured");
1155
+ return r("AUTH_REQUIRED", "Base URL not configured");
1156
1156
  if (!e)
1157
- return i("VALIDATION_ERROR", "Event ID is required");
1158
- const r = new URLSearchParams();
1159
- n?.include && n.include.length > 0 && r.append("include", n.include.join(","));
1160
- const a = r.toString(), o = `${t.baseUrl}/api/v3.0/events/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
1157
+ return r("VALIDATION_ERROR", "Event ID is required");
1158
+ const i = new URLSearchParams();
1159
+ n?.include && n.include.length > 0 && i.append("include", n.include.join(","));
1160
+ const a = i.toString(), o = `${t.baseUrl}/api/v3.0/events/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
1161
1161
  s("Fetching event:", o);
1162
1162
  try {
1163
1163
  const c = await fetch(o, {
@@ -1172,18 +1172,18 @@ async function gt(e, n) {
1172
1172
  const u = await c.json();
1173
1173
  return s("Event fetched:", u.id), d(u);
1174
1174
  } catch (c) {
1175
- return i("NETWORK_ERROR", `Failed to fetch event: ${String(c)}`);
1175
+ return r("NETWORK_ERROR", `Failed to fetch event: ${String(c)}`);
1176
1176
  }
1177
1177
  }
1178
1178
  async function ht(e) {
1179
1179
  const n = f();
1180
1180
  if (!n.isAuthenticated)
1181
- return i("AUTH_REQUIRED", "Authentication required");
1181
+ return r("AUTH_REQUIRED", "Authentication required");
1182
1182
  if (!n.baseUrl)
1183
- return i("AUTH_REQUIRED", "Base URL not configured");
1183
+ return r("AUTH_REQUIRED", "Base URL not configured");
1184
1184
  const t = new URLSearchParams();
1185
1185
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken), e?.language && t.append("language", e.language);
1186
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/eventTypes${r ? `?${r}` : ""}`;
1186
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/eventTypes${i ? `?${i}` : ""}`;
1187
1187
  s("Fetching event types:", a);
1188
1188
  try {
1189
1189
  const o = await fetch(a, {
@@ -1198,20 +1198,20 @@ async function ht(e) {
1198
1198
  const c = await o.json();
1199
1199
  return s("Event types fetched:", c.results?.length ?? 0, "types"), d(c);
1200
1200
  } catch (o) {
1201
- return i("NETWORK_ERROR", `Failed to fetch event types: ${String(o)}`);
1201
+ return r("NETWORK_ERROR", `Failed to fetch event types: ${String(o)}`);
1202
1202
  }
1203
1203
  }
1204
1204
  async function _t(e) {
1205
1205
  const n = f();
1206
1206
  if (!n.isAuthenticated)
1207
- return i("AUTH_REQUIRED", "Authentication required");
1207
+ return r("AUTH_REQUIRED", "Authentication required");
1208
1208
  if (!n.baseUrl)
1209
- return i("AUTH_REQUIRED", "Base URL not configured");
1209
+ return r("AUTH_REQUIRED", "Base URL not configured");
1210
1210
  if (!e.actor)
1211
- return i("VALIDATION_ERROR", "actor parameter is required");
1211
+ return r("VALIDATION_ERROR", "actor parameter is required");
1212
1212
  const t = new URLSearchParams();
1213
1213
  t.append("actor", e.actor);
1214
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/events:listFieldValues${r ? `?${r}` : ""}`;
1214
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/events:listFieldValues${i ? `?${i}` : ""}`;
1215
1215
  s("Fetching event field values:", a);
1216
1216
  try {
1217
1217
  const o = await fetch(a, {
@@ -1226,29 +1226,29 @@ async function _t(e) {
1226
1226
  const c = await o.json();
1227
1227
  return s("Event field values fetched:", c.type?.length ?? 0, "types"), d(c);
1228
1228
  } catch (o) {
1229
- return i("NETWORK_ERROR", `Failed to fetch event field values: ${String(o)}`);
1229
+ return r("NETWORK_ERROR", `Failed to fetch event field values: ${String(o)}`);
1230
1230
  }
1231
1231
  }
1232
1232
  async function H(e) {
1233
1233
  const n = e.status;
1234
1234
  let t;
1235
1235
  try {
1236
- const r = await e.json();
1237
- t = r.message ?? r.error ?? e.statusText;
1238
- } catch (r) {
1239
- s("Failed to parse error response JSON:", r), t = e.statusText || "Unknown error";
1236
+ const i = await e.json();
1237
+ t = i.message ?? i.error ?? e.statusText;
1238
+ } catch (i) {
1239
+ s("Failed to parse error response JSON:", i), t = e.statusText || "Unknown error";
1240
1240
  }
1241
1241
  switch (n) {
1242
1242
  case 401:
1243
- return i("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
1243
+ return r("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
1244
1244
  case 403:
1245
- return i("FORBIDDEN", `Access denied: ${t}`, n);
1245
+ return r("FORBIDDEN", `Access denied: ${t}`, n);
1246
1246
  case 404:
1247
- return i("NOT_FOUND", `Not found: ${t}`, n);
1247
+ return r("NOT_FOUND", `Not found: ${t}`, n);
1248
1248
  case 429:
1249
- return i("RATE_LIMITED", `Rate limited: ${t}`, n);
1249
+ return r("RATE_LIMITED", `Rate limited: ${t}`, n);
1250
1250
  default:
1251
- return i("API_ERROR", `API error: ${t}`, n);
1251
+ return r("API_ERROR", `API error: ${t}`, n);
1252
1252
  }
1253
1253
  }
1254
1254
  const z = {
@@ -1591,8 +1591,8 @@ function fe(e) {
1591
1591
  function Rt(e) {
1592
1592
  const n = /* @__PURE__ */ new Set();
1593
1593
  for (const t of e) {
1594
- const r = fe(t);
1595
- for (const a of r)
1594
+ const i = fe(t);
1595
+ for (const a of i)
1596
1596
  n.add(`data.${a}`);
1597
1597
  }
1598
1598
  return Array.from(n);
@@ -1602,8 +1602,8 @@ function pt(e) {
1602
1602
  }
1603
1603
  function Et(e) {
1604
1604
  const n = [];
1605
- for (const [t, r] of Object.entries(z))
1606
- r.includes(e) && n.push(t);
1605
+ for (const [t, i] of Object.entries(z))
1606
+ i.includes(e) && n.push(t);
1607
1607
  return n;
1608
1608
  }
1609
1609
  function vt() {
@@ -1619,16 +1619,16 @@ function At() {
1619
1619
  async function It(e) {
1620
1620
  const n = f();
1621
1621
  if (!n.isAuthenticated)
1622
- return i("AUTH_REQUIRED", "Authentication required");
1622
+ return r("AUTH_REQUIRED", "Authentication required");
1623
1623
  if (!n.baseUrl)
1624
- return i("AUTH_REQUIRED", "Base URL not configured");
1624
+ return r("AUTH_REQUIRED", "Base URL not configured");
1625
1625
  if (!e.actor)
1626
- return i("VALIDATION_ERROR", "actor parameter is required");
1626
+ return r("VALIDATION_ERROR", "actor parameter is required");
1627
1627
  if (!e.eventType)
1628
- return i("VALIDATION_ERROR", "eventType parameter is required");
1628
+ return r("VALIDATION_ERROR", "eventType parameter is required");
1629
1629
  const t = new URLSearchParams();
1630
1630
  t.append("actor", e.actor), t.append("eventType", e.eventType), e.timestamp__gte && t.append("timestamp__gte", T(e.timestamp__gte)), e.timestamp__lte && t.append("timestamp__lte", T(e.timestamp__lte)), e.aggregateByMinutes !== void 0 && t.append("aggregateByMinutes", String(e.aggregateByMinutes));
1631
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/eventMetrics${r ? `?${r}` : ""}`;
1631
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/eventMetrics${i ? `?${i}` : ""}`;
1632
1632
  s("Fetching event metrics:", a);
1633
1633
  try {
1634
1634
  const o = await fetch(a, {
@@ -1643,40 +1643,40 @@ async function It(e) {
1643
1643
  const c = await o.json();
1644
1644
  return s("Event metrics fetched:", c.length, "metrics"), d(c);
1645
1645
  } catch (o) {
1646
- return i("NETWORK_ERROR", `Failed to fetch event metrics: ${String(o)}`);
1646
+ return r("NETWORK_ERROR", `Failed to fetch event metrics: ${String(o)}`);
1647
1647
  }
1648
1648
  }
1649
1649
  async function Be(e) {
1650
1650
  const n = e.status;
1651
1651
  let t;
1652
1652
  try {
1653
- const r = await e.json();
1654
- t = r.message ?? r.error ?? e.statusText;
1655
- } catch (r) {
1656
- s("Failed to parse error response JSON:", r), t = e.statusText || "Unknown error";
1653
+ const i = await e.json();
1654
+ t = i.message ?? i.error ?? e.statusText;
1655
+ } catch (i) {
1656
+ s("Failed to parse error response JSON:", i), t = e.statusText || "Unknown error";
1657
1657
  }
1658
1658
  switch (n) {
1659
1659
  case 401:
1660
- return i("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
1660
+ return r("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
1661
1661
  case 403:
1662
- return i("FORBIDDEN", `Access denied: ${t}`, n);
1662
+ return r("FORBIDDEN", `Access denied: ${t}`, n);
1663
1663
  case 404:
1664
- return i("NOT_FOUND", `Not found: ${t}`, n);
1664
+ return r("NOT_FOUND", `Not found: ${t}`, n);
1665
1665
  case 429:
1666
- return i("RATE_LIMITED", `Rate limited: ${t}`, n);
1666
+ return r("RATE_LIMITED", `Rate limited: ${t}`, n);
1667
1667
  default:
1668
- return i("API_ERROR", `API error: ${t}`, n);
1668
+ return r("API_ERROR", `API error: ${t}`, n);
1669
1669
  }
1670
1670
  }
1671
1671
  async function Tt(e) {
1672
1672
  const n = f();
1673
1673
  if (!n.isAuthenticated)
1674
- return i("AUTH_REQUIRED", "Authentication required");
1674
+ return r("AUTH_REQUIRED", "Authentication required");
1675
1675
  if (!n.baseUrl)
1676
- return i("AUTH_REQUIRED", "Base URL not configured");
1676
+ return r("AUTH_REQUIRED", "Base URL not configured");
1677
1677
  const t = new URLSearchParams();
1678
1678
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken), e?.timestamp__lte && t.append("timestamp__lte", T(e.timestamp__lte)), e?.timestamp__gte && t.append("timestamp__gte", T(e.timestamp__gte)), e?.creatorId && t.append("creatorId", e.creatorId), e?.alertType__in && e.alertType__in.length > 0 && t.append("alertType__in", e.alertType__in.join(",")), e?.actorId__in && e.actorId__in.length > 0 && t.append("actorId__in", e.actorId__in.join(",")), e?.actorType__in && e.actorType__in.length > 0 && t.append("actorType__in", e.actorType__in.join(",")), e?.actorAccountId && t.append("actorAccountId", e.actorAccountId), e?.ruleId && t.append("ruleId", e.ruleId), e?.ruleId__in && e.ruleId__in.length > 0 && t.append("ruleId__in", e.ruleId__in.join(",")), e?.eventId && t.append("eventId", e.eventId), e?.locationId__in && e.locationId__in.length > 0 && t.append("locationId__in", e.locationId__in.join(",")), e?.priority__gte !== void 0 && t.append("priority__gte", String(e.priority__gte)), e?.priority__lte !== void 0 && t.append("priority__lte", String(e.priority__lte)), e?.showInvalidAlerts !== void 0 && t.append("showInvalidAlerts", String(e.showInvalidAlerts)), e?.alertActionId__in && e.alertActionId__in.length > 0 && t.append("alertActionId__in", e.alertActionId__in.join(",")), e?.alertActionStatus__in && e.alertActionStatus__in.length > 0 && t.append("alertActionStatus__in", e.alertActionStatus__in.join(",")), e?.include && e.include.length > 0 && t.append("include", e.include.join(",")), e?.sort && e.sort.length > 0 && t.append("sort", e.sort.join(",")), e?.language && t.append("language", e.language);
1679
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/alerts${r ? `?${r}` : ""}`;
1679
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/alerts${i ? `?${i}` : ""}`;
1680
1680
  s("Fetching alerts:", a);
1681
1681
  try {
1682
1682
  const o = await fetch(a, {
@@ -1691,20 +1691,20 @@ async function Tt(e) {
1691
1691
  const c = await o.json();
1692
1692
  return s("Alerts fetched:", c.results?.length ?? 0, "alerts"), d(c);
1693
1693
  } catch (o) {
1694
- return i("NETWORK_ERROR", `Failed to fetch alerts: ${String(o)}`);
1694
+ return r("NETWORK_ERROR", `Failed to fetch alerts: ${String(o)}`);
1695
1695
  }
1696
1696
  }
1697
1697
  async function Ut(e, n) {
1698
1698
  const t = f();
1699
1699
  if (!t.isAuthenticated)
1700
- return i("AUTH_REQUIRED", "Authentication required");
1700
+ return r("AUTH_REQUIRED", "Authentication required");
1701
1701
  if (!t.baseUrl)
1702
- return i("AUTH_REQUIRED", "Base URL not configured");
1702
+ return r("AUTH_REQUIRED", "Base URL not configured");
1703
1703
  if (!e)
1704
- return i("VALIDATION_ERROR", "Alert ID is required");
1705
- const r = new URLSearchParams();
1706
- n?.include && n.include.length > 0 && r.append("include", n.include.join(","));
1707
- const a = r.toString(), o = `${t.baseUrl}/api/v3.0/alerts/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
1704
+ return r("VALIDATION_ERROR", "Alert ID is required");
1705
+ const i = new URLSearchParams();
1706
+ n?.include && n.include.length > 0 && i.append("include", n.include.join(","));
1707
+ const a = i.toString(), o = `${t.baseUrl}/api/v3.0/alerts/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
1708
1708
  s("Fetching alert:", o);
1709
1709
  try {
1710
1710
  const c = await fetch(o, {
@@ -1719,18 +1719,18 @@ async function Ut(e, n) {
1719
1719
  const u = await c.json();
1720
1720
  return s("Alert fetched:", u.id), d(u);
1721
1721
  } catch (c) {
1722
- return i("NETWORK_ERROR", `Failed to fetch alert: ${String(c)}`);
1722
+ return r("NETWORK_ERROR", `Failed to fetch alert: ${String(c)}`);
1723
1723
  }
1724
1724
  }
1725
1725
  async function yt(e) {
1726
1726
  const n = f();
1727
1727
  if (!n.isAuthenticated)
1728
- return i("AUTH_REQUIRED", "Authentication required");
1728
+ return r("AUTH_REQUIRED", "Authentication required");
1729
1729
  if (!n.baseUrl)
1730
- return i("AUTH_REQUIRED", "Base URL not configured");
1730
+ return r("AUTH_REQUIRED", "Base URL not configured");
1731
1731
  const t = new URLSearchParams();
1732
1732
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken);
1733
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/alertTypes${r ? `?${r}` : ""}`;
1733
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/alertTypes${i ? `?${i}` : ""}`;
1734
1734
  s("Fetching alert types:", a);
1735
1735
  try {
1736
1736
  const o = await fetch(a, {
@@ -1745,40 +1745,40 @@ async function yt(e) {
1745
1745
  const c = await o.json();
1746
1746
  return s("Alert types fetched:", c.results?.length ?? 0, "types"), d(c);
1747
1747
  } catch (o) {
1748
- return i("NETWORK_ERROR", `Failed to fetch alert types: ${String(o)}`);
1748
+ return r("NETWORK_ERROR", `Failed to fetch alert types: ${String(o)}`);
1749
1749
  }
1750
1750
  }
1751
1751
  async function ne(e) {
1752
1752
  const n = e.status;
1753
1753
  let t;
1754
1754
  try {
1755
- const r = await e.json();
1756
- t = r.message ?? r.error ?? e.statusText;
1757
- } catch (r) {
1758
- s("Failed to parse error response JSON:", r), t = e.statusText || "Unknown error";
1755
+ const i = await e.json();
1756
+ t = i.message ?? i.error ?? e.statusText;
1757
+ } catch (i) {
1758
+ s("Failed to parse error response JSON:", i), t = e.statusText || "Unknown error";
1759
1759
  }
1760
1760
  switch (n) {
1761
1761
  case 401:
1762
- return i("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
1762
+ return r("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
1763
1763
  case 403:
1764
- return i("FORBIDDEN", `Access denied: ${t}`, n);
1764
+ return r("FORBIDDEN", `Access denied: ${t}`, n);
1765
1765
  case 404:
1766
- return i("NOT_FOUND", `Not found: ${t}`, n);
1766
+ return r("NOT_FOUND", `Not found: ${t}`, n);
1767
1767
  case 429:
1768
- return i("RATE_LIMITED", `Rate limited: ${t}`, n);
1768
+ return r("RATE_LIMITED", `Rate limited: ${t}`, n);
1769
1769
  default:
1770
- return i("API_ERROR", `API error: ${t}`, n);
1770
+ return r("API_ERROR", `API error: ${t}`, n);
1771
1771
  }
1772
1772
  }
1773
1773
  async function St(e) {
1774
1774
  const n = f();
1775
1775
  if (!n.isAuthenticated)
1776
- return i("AUTH_REQUIRED", "Authentication required");
1776
+ return r("AUTH_REQUIRED", "Authentication required");
1777
1777
  if (!n.baseUrl)
1778
- return i("AUTH_REQUIRED", "Base URL not configured");
1778
+ return r("AUTH_REQUIRED", "Base URL not configured");
1779
1779
  const t = new URLSearchParams();
1780
1780
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken), e?.timestamp__lte && t.append("timestamp__lte", T(e.timestamp__lte)), e?.timestamp__gte && t.append("timestamp__gte", T(e.timestamp__gte)), e?.alertId && t.append("alertId", e.alertId), e?.alertType && t.append("alertType", e.alertType), e?.actorId && t.append("actorId", e.actorId), e?.actorType && t.append("actorType", e.actorType), e?.actorAccountId && t.append("actorAccountId", e.actorAccountId), e?.category && t.append("category", e.category), e?.userId && t.append("userId", e.userId), e?.read !== void 0 && t.append("read", String(e.read)), e?.status && t.append("status", e.status), e?.includeV1Notifications !== void 0 && t.append("includeV1Notifications", String(e.includeV1Notifications)), e?.sort && e.sort.length > 0 && t.append("sort", e.sort.join(",")), e?.language && t.append("language", e.language);
1781
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/notifications${r ? `?${r}` : ""}`;
1781
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/notifications${i ? `?${i}` : ""}`;
1782
1782
  s("Fetching notifications:", a);
1783
1783
  try {
1784
1784
  const o = await fetch(a, {
@@ -1793,66 +1793,66 @@ async function St(e) {
1793
1793
  const c = await o.json();
1794
1794
  return s("Notifications fetched:", c.results?.length ?? 0, "notifications"), d(c);
1795
1795
  } catch (o) {
1796
- return i("NETWORK_ERROR", `Failed to fetch notifications: ${String(o)}`);
1796
+ return r("NETWORK_ERROR", `Failed to fetch notifications: ${String(o)}`);
1797
1797
  }
1798
1798
  }
1799
1799
  async function Dt(e) {
1800
1800
  const n = f();
1801
1801
  if (!n.isAuthenticated)
1802
- return i("AUTH_REQUIRED", "Authentication required");
1802
+ return r("AUTH_REQUIRED", "Authentication required");
1803
1803
  if (!n.baseUrl)
1804
- return i("AUTH_REQUIRED", "Base URL not configured");
1804
+ return r("AUTH_REQUIRED", "Base URL not configured");
1805
1805
  if (!e)
1806
- return i("VALIDATION_ERROR", "Notification ID is required");
1806
+ return r("VALIDATION_ERROR", "Notification ID is required");
1807
1807
  const t = `${n.baseUrl}/api/v3.0/notifications/${encodeURIComponent(e)}`;
1808
1808
  s("Fetching notification:", t);
1809
1809
  try {
1810
- const r = await fetch(t, {
1810
+ const i = await fetch(t, {
1811
1811
  method: "GET",
1812
1812
  headers: {
1813
1813
  Accept: "application/json",
1814
1814
  Authorization: `Bearer ${n.token}`
1815
1815
  }
1816
1816
  });
1817
- if (!r.ok)
1818
- return ge(r);
1819
- const a = await r.json();
1817
+ if (!i.ok)
1818
+ return ge(i);
1819
+ const a = await i.json();
1820
1820
  return s("Notification fetched:", a.id), d(a);
1821
- } catch (r) {
1822
- return i("NETWORK_ERROR", `Failed to fetch notification: ${String(r)}`);
1821
+ } catch (i) {
1822
+ return r("NETWORK_ERROR", `Failed to fetch notification: ${String(i)}`);
1823
1823
  }
1824
1824
  }
1825
1825
  async function ge(e) {
1826
1826
  const n = e.status;
1827
1827
  let t;
1828
1828
  try {
1829
- const r = await e.json();
1830
- t = r.message ?? r.error ?? e.statusText;
1831
- } catch (r) {
1832
- s("Failed to parse error response JSON:", r), t = e.statusText || "Unknown error";
1829
+ const i = await e.json();
1830
+ t = i.message ?? i.error ?? e.statusText;
1831
+ } catch (i) {
1832
+ s("Failed to parse error response JSON:", i), t = e.statusText || "Unknown error";
1833
1833
  }
1834
1834
  switch (n) {
1835
1835
  case 401:
1836
- return i("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
1836
+ return r("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
1837
1837
  case 403:
1838
- return i("FORBIDDEN", `Access denied: ${t}`, n);
1838
+ return r("FORBIDDEN", `Access denied: ${t}`, n);
1839
1839
  case 404:
1840
- return i("NOT_FOUND", `Not found: ${t}`, n);
1840
+ return r("NOT_FOUND", `Not found: ${t}`, n);
1841
1841
  case 429:
1842
- return i("RATE_LIMITED", `Rate limited: ${t}`, n);
1842
+ return r("RATE_LIMITED", `Rate limited: ${t}`, n);
1843
1843
  default:
1844
- return i("API_ERROR", `API error: ${t}`, n);
1844
+ return r("API_ERROR", `API error: ${t}`, n);
1845
1845
  }
1846
1846
  }
1847
1847
  async function Ot(e) {
1848
1848
  const n = f();
1849
1849
  if (!n.isAuthenticated)
1850
- return i("AUTH_REQUIRED", "Authentication required");
1850
+ return r("AUTH_REQUIRED", "Authentication required");
1851
1851
  if (!n.baseUrl)
1852
- return i("AUTH_REQUIRED", "Base URL not configured");
1852
+ return r("AUTH_REQUIRED", "Base URL not configured");
1853
1853
  const t = new URLSearchParams();
1854
1854
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken);
1855
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/eventSubscriptions${r ? `?${r}` : ""}`;
1855
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/eventSubscriptions${i ? `?${i}` : ""}`;
1856
1856
  s("Fetching event subscriptions:", a);
1857
1857
  try {
1858
1858
  const o = await fetch(a, {
@@ -1867,55 +1867,55 @@ async function Ot(e) {
1867
1867
  const c = await o.json();
1868
1868
  return s("Event subscriptions fetched:", c.results?.length ?? 0, "subscriptions"), d(c);
1869
1869
  } catch (o) {
1870
- return i("NETWORK_ERROR", `Failed to fetch event subscriptions: ${String(o)}`);
1870
+ return r("NETWORK_ERROR", `Failed to fetch event subscriptions: ${String(o)}`);
1871
1871
  }
1872
1872
  }
1873
1873
  async function bt(e) {
1874
1874
  const n = f();
1875
1875
  if (!n.isAuthenticated)
1876
- return i("AUTH_REQUIRED", "Authentication required");
1876
+ return r("AUTH_REQUIRED", "Authentication required");
1877
1877
  if (!n.baseUrl)
1878
- return i("AUTH_REQUIRED", "Base URL not configured");
1878
+ return r("AUTH_REQUIRED", "Base URL not configured");
1879
1879
  if (!e)
1880
- return i("VALIDATION_ERROR", "Subscription ID is required");
1880
+ return r("VALIDATION_ERROR", "Subscription ID is required");
1881
1881
  const t = `${n.baseUrl}/api/v3.0/eventSubscriptions/${encodeURIComponent(e)}`;
1882
1882
  s("Fetching event subscription:", t);
1883
1883
  try {
1884
- const r = await fetch(t, {
1884
+ const i = await fetch(t, {
1885
1885
  method: "GET",
1886
1886
  headers: {
1887
1887
  Accept: "application/json",
1888
1888
  Authorization: `Bearer ${n.token}`
1889
1889
  }
1890
1890
  });
1891
- if (!r.ok)
1892
- return Q(r);
1893
- const a = await r.json();
1891
+ if (!i.ok)
1892
+ return Q(i);
1893
+ const a = await i.json();
1894
1894
  return s("Event subscription fetched:", a.id), d(a);
1895
- } catch (r) {
1896
- return i("NETWORK_ERROR", `Failed to fetch event subscription: ${String(r)}`);
1895
+ } catch (i) {
1896
+ return r("NETWORK_ERROR", `Failed to fetch event subscription: ${String(i)}`);
1897
1897
  }
1898
1898
  }
1899
1899
  async function mt(e) {
1900
1900
  const n = f();
1901
1901
  if (!n.isAuthenticated)
1902
- return i("AUTH_REQUIRED", "Authentication required");
1902
+ return r("AUTH_REQUIRED", "Authentication required");
1903
1903
  if (!n.baseUrl)
1904
- return i("AUTH_REQUIRED", "Base URL not configured");
1904
+ return r("AUTH_REQUIRED", "Base URL not configured");
1905
1905
  if (!e.deliveryConfig)
1906
- return i("VALIDATION_ERROR", "deliveryConfig is required");
1906
+ return r("VALIDATION_ERROR", "deliveryConfig is required");
1907
1907
  if (!e.filters || e.filters.length === 0)
1908
- return i("VALIDATION_ERROR", "At least one filter is required");
1909
- for (const r of e.filters) {
1910
- if (!r.actors || r.actors.length === 0)
1911
- return i("VALIDATION_ERROR", "Each filter must have at least one actor");
1912
- if (!r.types || r.types.length === 0)
1913
- return i("VALIDATION_ERROR", "Each filter must have at least one event type");
1908
+ return r("VALIDATION_ERROR", "At least one filter is required");
1909
+ for (const i of e.filters) {
1910
+ if (!i.actors || i.actors.length === 0)
1911
+ return r("VALIDATION_ERROR", "Each filter must have at least one actor");
1912
+ if (!i.types || i.types.length === 0)
1913
+ return r("VALIDATION_ERROR", "Each filter must have at least one event type");
1914
1914
  }
1915
1915
  const t = `${n.baseUrl}/api/v3.0/eventSubscriptions`;
1916
1916
  s("Creating event subscription:", t);
1917
1917
  try {
1918
- const r = await fetch(t, {
1918
+ const i = await fetch(t, {
1919
1919
  method: "POST",
1920
1920
  headers: {
1921
1921
  Accept: "application/json",
@@ -1924,53 +1924,53 @@ async function mt(e) {
1924
1924
  },
1925
1925
  body: JSON.stringify(e)
1926
1926
  });
1927
- if (!r.ok)
1928
- return Q(r);
1929
- const a = await r.json();
1927
+ if (!i.ok)
1928
+ return Q(i);
1929
+ const a = await i.json();
1930
1930
  return s("Event subscription created:", a.id), d(a);
1931
- } catch (r) {
1932
- return i("NETWORK_ERROR", `Failed to create event subscription: ${String(r)}`);
1931
+ } catch (i) {
1932
+ return r("NETWORK_ERROR", `Failed to create event subscription: ${String(i)}`);
1933
1933
  }
1934
1934
  }
1935
1935
  async function $t(e) {
1936
1936
  const n = f();
1937
1937
  if (!n.isAuthenticated)
1938
- return i("AUTH_REQUIRED", "Authentication required");
1938
+ return r("AUTH_REQUIRED", "Authentication required");
1939
1939
  if (!n.baseUrl)
1940
- return i("AUTH_REQUIRED", "Base URL not configured");
1940
+ return r("AUTH_REQUIRED", "Base URL not configured");
1941
1941
  if (!e)
1942
- return i("VALIDATION_ERROR", "Subscription ID is required");
1942
+ return r("VALIDATION_ERROR", "Subscription ID is required");
1943
1943
  const t = `${n.baseUrl}/api/v3.0/eventSubscriptions/${encodeURIComponent(e)}`;
1944
1944
  s("Deleting event subscription:", t);
1945
1945
  try {
1946
- const r = await fetch(t, {
1946
+ const i = await fetch(t, {
1947
1947
  method: "DELETE",
1948
1948
  headers: {
1949
1949
  Accept: "application/json",
1950
1950
  Authorization: `Bearer ${n.token}`
1951
1951
  }
1952
1952
  });
1953
- return r.ok ? (s("Event subscription deleted:", e), d(void 0)) : Q(r);
1954
- } catch (r) {
1955
- return i("NETWORK_ERROR", `Failed to delete event subscription: ${String(r)}`);
1953
+ return i.ok ? (s("Event subscription deleted:", e), d(void 0)) : Q(i);
1954
+ } catch (i) {
1955
+ return r("NETWORK_ERROR", `Failed to delete event subscription: ${String(i)}`);
1956
1956
  }
1957
1957
  }
1958
1958
  function kt(e, n) {
1959
1959
  const t = f();
1960
1960
  if (!t.isAuthenticated)
1961
- return i("AUTH_REQUIRED", "Authentication required");
1961
+ return r("AUTH_REQUIRED", "Authentication required");
1962
1962
  if (!t.token)
1963
- return i("AUTH_REQUIRED", "Access token not available");
1963
+ return r("AUTH_REQUIRED", "Access token not available");
1964
1964
  if (!e)
1965
- return i("VALIDATION_ERROR", "SSE URL is required");
1965
+ return r("VALIDATION_ERROR", "SSE URL is required");
1966
1966
  try {
1967
1967
  const g = new URL(e);
1968
1968
  if (!P(g.hostname))
1969
- return i("VALIDATION_ERROR", `SSE URL domain not allowed: ${g.hostname}`);
1969
+ return r("VALIDATION_ERROR", `SSE URL domain not allowed: ${g.hostname}`);
1970
1970
  } catch {
1971
- return i("VALIDATION_ERROR", "Invalid SSE URL format");
1971
+ return r("VALIDATION_ERROR", "Invalid SSE URL format");
1972
1972
  }
1973
- const r = 1024 * 1024;
1973
+ const i = 1024 * 1024;
1974
1974
  let a = "connecting", o = new AbortController(), c = !1;
1975
1975
  const u = (g) => {
1976
1976
  a = g, n.onStatusChange?.(a);
@@ -2002,7 +2002,7 @@ function kt(e, n) {
2002
2002
  s("SSE stream ended");
2003
2003
  break;
2004
2004
  }
2005
- if (U += b.decode(W, { stream: !0 }), U.length > r) {
2005
+ if (U += b.decode(W, { stream: !0 }), U.length > i) {
2006
2006
  s("SSE buffer exceeded maximum size, resetting"), U = "";
2007
2007
  continue;
2008
2008
  }
@@ -2042,33 +2042,33 @@ async function Q(e) {
2042
2042
  const n = e.status;
2043
2043
  let t;
2044
2044
  try {
2045
- const r = await e.json();
2046
- t = r.message ?? r.error ?? e.statusText;
2047
- } catch (r) {
2048
- s("Failed to parse error response JSON:", r), t = e.statusText || "Unknown error";
2045
+ const i = await e.json();
2046
+ t = i.message ?? i.error ?? e.statusText;
2047
+ } catch (i) {
2048
+ s("Failed to parse error response JSON:", i), t = e.statusText || "Unknown error";
2049
2049
  }
2050
2050
  switch (n) {
2051
2051
  case 401:
2052
- return i("AUTH_REQUIRED", t, n);
2052
+ return r("AUTH_REQUIRED", t, n);
2053
2053
  case 403:
2054
- return i("FORBIDDEN", t, n);
2054
+ return r("FORBIDDEN", t, n);
2055
2055
  case 404:
2056
- return i("NOT_FOUND", t, n);
2056
+ return r("NOT_FOUND", t, n);
2057
2057
  case 429:
2058
- return i("RATE_LIMITED", t, n);
2058
+ return r("RATE_LIMITED", t, n);
2059
2059
  default:
2060
- return i("API_ERROR", t, n);
2060
+ return r("API_ERROR", t, n);
2061
2061
  }
2062
2062
  }
2063
2063
  async function wt(e) {
2064
2064
  const n = f();
2065
2065
  if (!n.isAuthenticated)
2066
- return i("AUTH_REQUIRED", "Authentication required");
2066
+ return r("AUTH_REQUIRED", "Authentication required");
2067
2067
  if (!n.baseUrl)
2068
- return i("AUTH_REQUIRED", "Base URL not configured");
2068
+ return r("AUTH_REQUIRED", "Base URL not configured");
2069
2069
  const t = new URLSearchParams();
2070
2070
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken), e?.enabled !== void 0 && t.append("enabled", String(e.enabled)), e?.id__in && e.id__in.length > 0 && t.append("id__in", e.id__in.join(",")), e?.outputAlertType__in && e.outputAlertType__in.length > 0 && t.append("outputAlertType__in", e.outputAlertType__in.join(",")), e?.priority__gte !== void 0 && t.append("priority__gte", String(e.priority__gte)), e?.priority__lte !== void 0 && t.append("priority__lte", String(e.priority__lte));
2071
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/eventAlertConditionRules${r ? `?${r}` : ""}`;
2071
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/eventAlertConditionRules${i ? `?${i}` : ""}`;
2072
2072
  s("Fetching event alert condition rules:", a);
2073
2073
  try {
2074
2074
  const o = await fetch(a, {
@@ -2083,18 +2083,18 @@ async function wt(e) {
2083
2083
  const c = await o.json();
2084
2084
  return s("Event alert condition rules fetched:", c.results?.length ?? 0, "rules"), d(c);
2085
2085
  } catch (o) {
2086
- return i("NETWORK_ERROR", `Failed to fetch event alert condition rules: ${String(o)}`);
2086
+ return r("NETWORK_ERROR", `Failed to fetch event alert condition rules: ${String(o)}`);
2087
2087
  }
2088
2088
  }
2089
2089
  async function jt(e) {
2090
2090
  const n = f();
2091
2091
  if (!n.isAuthenticated)
2092
- return i("AUTH_REQUIRED", "Authentication required");
2092
+ return r("AUTH_REQUIRED", "Authentication required");
2093
2093
  if (!n.baseUrl)
2094
- return i("AUTH_REQUIRED", "Base URL not configured");
2094
+ return r("AUTH_REQUIRED", "Base URL not configured");
2095
2095
  const t = new URLSearchParams();
2096
2096
  e?.enabled !== void 0 && t.append("enabled", String(e.enabled));
2097
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/eventAlertConditionRules:listFieldValues${r ? `?${r}` : ""}`;
2097
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/eventAlertConditionRules:listFieldValues${i ? `?${i}` : ""}`;
2098
2098
  s("Fetching event alert condition rule field values:", a);
2099
2099
  try {
2100
2100
  const o = await fetch(a, {
@@ -2109,44 +2109,44 @@ async function jt(e) {
2109
2109
  const c = await o.json();
2110
2110
  return s("Event alert condition rule field values fetched"), d(c);
2111
2111
  } catch (o) {
2112
- return i("NETWORK_ERROR", `Failed to fetch field values: ${String(o)}`);
2112
+ return r("NETWORK_ERROR", `Failed to fetch field values: ${String(o)}`);
2113
2113
  }
2114
2114
  }
2115
2115
  async function Ft(e) {
2116
2116
  const n = f();
2117
2117
  if (!n.isAuthenticated)
2118
- return i("AUTH_REQUIRED", "Authentication required");
2118
+ return r("AUTH_REQUIRED", "Authentication required");
2119
2119
  if (!n.baseUrl)
2120
- return i("AUTH_REQUIRED", "Base URL not configured");
2120
+ return r("AUTH_REQUIRED", "Base URL not configured");
2121
2121
  if (!e)
2122
- return i("VALIDATION_ERROR", "Rule ID is required");
2122
+ return r("VALIDATION_ERROR", "Rule ID is required");
2123
2123
  const t = `${n.baseUrl}/api/v3.0/eventAlertConditionRules/${encodeURIComponent(e)}`;
2124
2124
  s("Fetching event alert condition rule:", t);
2125
2125
  try {
2126
- const r = await fetch(t, {
2126
+ const i = await fetch(t, {
2127
2127
  method: "GET",
2128
2128
  headers: {
2129
2129
  Accept: "application/json",
2130
2130
  Authorization: `Bearer ${n.token}`
2131
2131
  }
2132
2132
  });
2133
- if (!r.ok)
2134
- return y(r);
2135
- const a = await r.json();
2133
+ if (!i.ok)
2134
+ return y(i);
2135
+ const a = await i.json();
2136
2136
  return s("Event alert condition rule fetched:", a.id), d(a);
2137
- } catch (r) {
2138
- return i("NETWORK_ERROR", `Failed to fetch event alert condition rule: ${String(r)}`);
2137
+ } catch (i) {
2138
+ return r("NETWORK_ERROR", `Failed to fetch event alert condition rule: ${String(i)}`);
2139
2139
  }
2140
2140
  }
2141
2141
  async function Lt(e) {
2142
2142
  const n = f();
2143
2143
  if (!n.isAuthenticated)
2144
- return i("AUTH_REQUIRED", "Authentication required");
2144
+ return r("AUTH_REQUIRED", "Authentication required");
2145
2145
  if (!n.baseUrl)
2146
- return i("AUTH_REQUIRED", "Base URL not configured");
2146
+ return r("AUTH_REQUIRED", "Base URL not configured");
2147
2147
  const t = new URLSearchParams();
2148
2148
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken), e?.enabled !== void 0 && t.append("enabled", String(e.enabled)), e?.id__in && e.id__in.length > 0 && t.append("id__in", e.id__in.join(",")), e?.actorId__in && e.actorId__in.length > 0 && t.append("actorId__in", e.actorId__in.join(",")), e?.inputEventType__in && e.inputEventType__in.length > 0 && t.append("inputEventType__in", e.inputEventType__in.join(",")), e?.outputAlertType && t.append("outputAlertType", e.outputAlertType), e?.type && t.append("type", e.type), e?.include && e.include.length > 0 && t.append("include", e.include.join(","));
2149
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/alertConditionRules${r ? `?${r}` : ""}`;
2149
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/alertConditionRules${i ? `?${i}` : ""}`;
2150
2150
  s("Fetching alert condition rules:", a);
2151
2151
  try {
2152
2152
  const o = await fetch(a, {
@@ -2161,20 +2161,20 @@ async function Lt(e) {
2161
2161
  const c = await o.json();
2162
2162
  return s("Alert condition rules fetched:", c.results?.length ?? 0, "rules"), d(c);
2163
2163
  } catch (o) {
2164
- return i("NETWORK_ERROR", `Failed to fetch alert condition rules: ${String(o)}`);
2164
+ return r("NETWORK_ERROR", `Failed to fetch alert condition rules: ${String(o)}`);
2165
2165
  }
2166
2166
  }
2167
2167
  async function Nt(e, n) {
2168
2168
  const t = f();
2169
2169
  if (!t.isAuthenticated)
2170
- return i("AUTH_REQUIRED", "Authentication required");
2170
+ return r("AUTH_REQUIRED", "Authentication required");
2171
2171
  if (!t.baseUrl)
2172
- return i("AUTH_REQUIRED", "Base URL not configured");
2172
+ return r("AUTH_REQUIRED", "Base URL not configured");
2173
2173
  if (!e)
2174
- return i("VALIDATION_ERROR", "Rule ID is required");
2175
- const r = new URLSearchParams();
2176
- n?.include && n.include.length > 0 && r.append("include", n.include.join(","));
2177
- const a = r.toString(), o = `${t.baseUrl}/api/v3.0/alertConditionRules/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
2174
+ return r("VALIDATION_ERROR", "Rule ID is required");
2175
+ const i = new URLSearchParams();
2176
+ n?.include && n.include.length > 0 && i.append("include", n.include.join(","));
2177
+ const a = i.toString(), o = `${t.baseUrl}/api/v3.0/alertConditionRules/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
2178
2178
  s("Fetching alert condition rule:", o);
2179
2179
  try {
2180
2180
  const c = await fetch(o, {
@@ -2189,18 +2189,18 @@ async function Nt(e, n) {
2189
2189
  const u = await c.json();
2190
2190
  return s("Alert condition rule fetched:", u.id), d(u);
2191
2191
  } catch (c) {
2192
- return i("NETWORK_ERROR", `Failed to fetch alert condition rule: ${String(c)}`);
2192
+ return r("NETWORK_ERROR", `Failed to fetch alert condition rule: ${String(c)}`);
2193
2193
  }
2194
2194
  }
2195
2195
  async function qt(e) {
2196
2196
  const n = f();
2197
2197
  if (!n.isAuthenticated)
2198
- return i("AUTH_REQUIRED", "Authentication required");
2198
+ return r("AUTH_REQUIRED", "Authentication required");
2199
2199
  if (!n.baseUrl)
2200
- return i("AUTH_REQUIRED", "Base URL not configured");
2200
+ return r("AUTH_REQUIRED", "Base URL not configured");
2201
2201
  const t = new URLSearchParams();
2202
2202
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken), e?.enabled !== void 0 && t.append("enabled", String(e.enabled)), e?.id__in && e.id__in.length > 0 && t.append("id__in", e.id__in.join(",")), e?.alertType__in && e.alertType__in.length > 0 && t.append("alertType__in", e.alertType__in.join(",")), e?.actorId__in && e.actorId__in.length > 0 && t.append("actorId__in", e.actorId__in.join(",")), e?.alertActionId__in && e.alertActionId__in.length > 0 && t.append("alertActionId__in", e.alertActionId__in.join(",")), e?.ruleId__in && e.ruleId__in.length > 0 && t.append("ruleId__in", e.ruleId__in.join(","));
2203
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/alertActionRules${r ? `?${r}` : ""}`;
2203
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/alertActionRules${i ? `?${i}` : ""}`;
2204
2204
  s("Fetching alert action rules:", a);
2205
2205
  try {
2206
2206
  const o = await fetch(a, {
@@ -2215,44 +2215,44 @@ async function qt(e) {
2215
2215
  const c = await o.json();
2216
2216
  return s("Alert action rules fetched:", c.results?.length ?? 0, "rules"), d(c);
2217
2217
  } catch (o) {
2218
- return i("NETWORK_ERROR", `Failed to fetch alert action rules: ${String(o)}`);
2218
+ return r("NETWORK_ERROR", `Failed to fetch alert action rules: ${String(o)}`);
2219
2219
  }
2220
2220
  }
2221
2221
  async function Bt(e) {
2222
2222
  const n = f();
2223
2223
  if (!n.isAuthenticated)
2224
- return i("AUTH_REQUIRED", "Authentication required");
2224
+ return r("AUTH_REQUIRED", "Authentication required");
2225
2225
  if (!n.baseUrl)
2226
- return i("AUTH_REQUIRED", "Base URL not configured");
2226
+ return r("AUTH_REQUIRED", "Base URL not configured");
2227
2227
  if (!e)
2228
- return i("VALIDATION_ERROR", "Rule ID is required");
2228
+ return r("VALIDATION_ERROR", "Rule ID is required");
2229
2229
  const t = `${n.baseUrl}/api/v3.0/alertActionRules/${encodeURIComponent(e)}`;
2230
2230
  s("Fetching alert action rule:", t);
2231
2231
  try {
2232
- const r = await fetch(t, {
2232
+ const i = await fetch(t, {
2233
2233
  method: "GET",
2234
2234
  headers: {
2235
2235
  Accept: "application/json",
2236
2236
  Authorization: `Bearer ${n.token}`
2237
2237
  }
2238
2238
  });
2239
- if (!r.ok)
2240
- return y(r);
2241
- const a = await r.json();
2239
+ if (!i.ok)
2240
+ return y(i);
2241
+ const a = await i.json();
2242
2242
  return s("Alert action rule fetched:", a.id), d(a);
2243
- } catch (r) {
2244
- return i("NETWORK_ERROR", `Failed to fetch alert action rule: ${String(r)}`);
2243
+ } catch (i) {
2244
+ return r("NETWORK_ERROR", `Failed to fetch alert action rule: ${String(i)}`);
2245
2245
  }
2246
2246
  }
2247
2247
  async function Pt(e) {
2248
2248
  const n = f();
2249
2249
  if (!n.isAuthenticated)
2250
- return i("AUTH_REQUIRED", "Authentication required");
2250
+ return r("AUTH_REQUIRED", "Authentication required");
2251
2251
  if (!n.baseUrl)
2252
- return i("AUTH_REQUIRED", "Base URL not configured");
2252
+ return r("AUTH_REQUIRED", "Base URL not configured");
2253
2253
  const t = new URLSearchParams();
2254
2254
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken), e?.enabled !== void 0 && t.append("enabled", String(e.enabled)), e?.id__in && e.id__in.length > 0 && t.append("id__in", e.id__in.join(",")), e?.type__in && e.type__in.length > 0 && t.append("type__in", e.type__in.join(","));
2255
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/alertActions${r ? `?${r}` : ""}`;
2255
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/alertActions${i ? `?${i}` : ""}`;
2256
2256
  s("Fetching alert actions:", a);
2257
2257
  try {
2258
2258
  const o = await fetch(a, {
@@ -2267,81 +2267,81 @@ async function Pt(e) {
2267
2267
  const c = await o.json();
2268
2268
  return s("Alert actions fetched:", c.results?.length ?? 0, "actions"), d(c);
2269
2269
  } catch (o) {
2270
- return i("NETWORK_ERROR", `Failed to fetch alert actions: ${String(o)}`);
2270
+ return r("NETWORK_ERROR", `Failed to fetch alert actions: ${String(o)}`);
2271
2271
  }
2272
2272
  }
2273
2273
  async function Ct(e) {
2274
2274
  const n = f();
2275
2275
  if (!n.isAuthenticated)
2276
- return i("AUTH_REQUIRED", "Authentication required");
2276
+ return r("AUTH_REQUIRED", "Authentication required");
2277
2277
  if (!n.baseUrl)
2278
- return i("AUTH_REQUIRED", "Base URL not configured");
2278
+ return r("AUTH_REQUIRED", "Base URL not configured");
2279
2279
  if (!e)
2280
- return i("VALIDATION_ERROR", "Action ID is required");
2280
+ return r("VALIDATION_ERROR", "Action ID is required");
2281
2281
  const t = `${n.baseUrl}/api/v3.0/alertActions/${encodeURIComponent(e)}`;
2282
2282
  s("Fetching alert action:", t);
2283
2283
  try {
2284
- const r = await fetch(t, {
2284
+ const i = await fetch(t, {
2285
2285
  method: "GET",
2286
2286
  headers: {
2287
2287
  Accept: "application/json",
2288
2288
  Authorization: `Bearer ${n.token}`
2289
2289
  }
2290
2290
  });
2291
- if (!r.ok)
2292
- return y(r);
2293
- const a = await r.json();
2291
+ if (!i.ok)
2292
+ return y(i);
2293
+ const a = await i.json();
2294
2294
  return s("Alert action fetched:", a.id), d(a);
2295
- } catch (r) {
2296
- return i("NETWORK_ERROR", `Failed to fetch alert action: ${String(r)}`);
2295
+ } catch (i) {
2296
+ return r("NETWORK_ERROR", `Failed to fetch alert action: ${String(i)}`);
2297
2297
  }
2298
2298
  }
2299
2299
  async function y(e) {
2300
2300
  const n = e.status;
2301
2301
  let t;
2302
2302
  try {
2303
- const r = await e.json();
2304
- t = r.message ?? r.error ?? e.statusText;
2305
- } catch (r) {
2306
- s("Failed to parse error response JSON:", r), t = e.statusText || "Unknown error";
2303
+ const i = await e.json();
2304
+ t = i.message ?? i.error ?? e.statusText;
2305
+ } catch (i) {
2306
+ s("Failed to parse error response JSON:", i), t = e.statusText || "Unknown error";
2307
2307
  }
2308
2308
  switch (n) {
2309
2309
  case 401:
2310
- return i("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
2310
+ return r("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
2311
2311
  case 403:
2312
- return i("FORBIDDEN", `Access denied: ${t}`, n);
2312
+ return r("FORBIDDEN", `Access denied: ${t}`, n);
2313
2313
  case 404:
2314
- return i("NOT_FOUND", `Not found: ${t}`, n);
2314
+ return r("NOT_FOUND", `Not found: ${t}`, n);
2315
2315
  case 429:
2316
- return i("RATE_LIMITED", `Rate limited: ${t}`, n);
2316
+ return r("RATE_LIMITED", `Rate limited: ${t}`, n);
2317
2317
  default:
2318
- return i("API_ERROR", `API error: ${t}`, n);
2318
+ return r("API_ERROR", `API error: ${t}`, n);
2319
2319
  }
2320
2320
  }
2321
2321
  async function Ht(e) {
2322
2322
  const n = f();
2323
2323
  if (!n.isAuthenticated)
2324
- return i("AUTH_REQUIRED", "Authentication required");
2324
+ return r("AUTH_REQUIRED", "Authentication required");
2325
2325
  if (!n.baseUrl)
2326
- return i("AUTH_REQUIRED", "Base URL not configured");
2326
+ return r("AUTH_REQUIRED", "Base URL not configured");
2327
2327
  if (!e.cameraId)
2328
- return i("VALIDATION_ERROR", "Camera ID is required");
2328
+ return r("VALIDATION_ERROR", "Camera ID is required");
2329
2329
  if (!e.type)
2330
- return i("VALIDATION_ERROR", "Export type is required");
2330
+ return r("VALIDATION_ERROR", "Export type is required");
2331
2331
  if (!e.startTimestamp)
2332
- return i("VALIDATION_ERROR", "Start timestamp is required");
2332
+ return r("VALIDATION_ERROR", "Start timestamp is required");
2333
2333
  if (!e.endTimestamp)
2334
- return i("VALIDATION_ERROR", "End timestamp is required");
2334
+ return r("VALIDATION_ERROR", "End timestamp is required");
2335
2335
  const t = `${n.baseUrl}/api/v3.0/exports`;
2336
2336
  if (s("Creating export job:", t), (e.type === "timeLapse" || e.type === "bundle") && !e.playbackMultiplier)
2337
- return i("VALIDATION_ERROR", "Playback multiplier is required for timeLapse and bundle exports");
2337
+ return r("VALIDATION_ERROR", "Playback multiplier is required for timeLapse and bundle exports");
2338
2338
  if (e.playbackMultiplier !== void 0 && (e.playbackMultiplier < 1 || e.playbackMultiplier > 48))
2339
- return i("VALIDATION_ERROR", "Playback multiplier must be between 1 and 48");
2340
- const r = {
2339
+ return r("VALIDATION_ERROR", "Playback multiplier must be between 1 and 48");
2340
+ const i = {
2341
2341
  name: e.name || `Export-${Date.now()}`,
2342
2342
  directory: e.directory || "/"
2343
2343
  };
2344
- e.notes && (r.notes = e.notes), e.tags && e.tags.length > 0 && (r.tags = e.tags);
2344
+ e.notes && (i.notes = e.notes), e.tags && e.tags.length > 0 && (i.tags = e.tags);
2345
2345
  const a = {
2346
2346
  startTimestamp: e.startTimestamp,
2347
2347
  endTimestamp: e.endTimestamp
@@ -2349,7 +2349,7 @@ async function Ht(e) {
2349
2349
  deviceId: e.cameraId,
2350
2350
  // API uses deviceId, not cameraId
2351
2351
  type: e.type,
2352
- info: r,
2352
+ info: i,
2353
2353
  period: a
2354
2354
  };
2355
2355
  e.playbackMultiplier !== void 0 && (o.playbackMultiplier = e.playbackMultiplier), e.autoDelete !== void 0 && (o.autoDelete = e.autoDelete);
@@ -2368,40 +2368,40 @@ async function Ht(e) {
2368
2368
  const u = await c.json();
2369
2369
  return s("Export job created:", u.id), d(u);
2370
2370
  } catch (c) {
2371
- return i("NETWORK_ERROR", `Failed to create export job: ${String(c)}`);
2371
+ return r("NETWORK_ERROR", `Failed to create export job: ${String(c)}`);
2372
2372
  }
2373
2373
  }
2374
2374
  async function Pe(e) {
2375
2375
  const n = e.status;
2376
2376
  let t;
2377
2377
  try {
2378
- const r = await e.json();
2379
- t = r.message ?? r.error ?? e.statusText;
2378
+ const i = await e.json();
2379
+ t = i.message ?? i.error ?? e.statusText;
2380
2380
  } catch {
2381
2381
  t = e.statusText || "Unknown error";
2382
2382
  }
2383
2383
  switch (n) {
2384
2384
  case 401:
2385
- return i("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
2385
+ return r("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
2386
2386
  case 403:
2387
- return i("FORBIDDEN", `Access denied: ${t}`, n);
2387
+ return r("FORBIDDEN", `Access denied: ${t}`, n);
2388
2388
  case 404:
2389
- return i("NOT_FOUND", `Not found: ${t}`, n);
2389
+ return r("NOT_FOUND", `Not found: ${t}`, n);
2390
2390
  case 429:
2391
- return i("RATE_LIMITED", `Rate limited: ${t}`, n);
2391
+ return r("RATE_LIMITED", `Rate limited: ${t}`, n);
2392
2392
  default:
2393
- return i("API_ERROR", `API error: ${t}`, n);
2393
+ return r("API_ERROR", `API error: ${t}`, n);
2394
2394
  }
2395
2395
  }
2396
2396
  async function zt(e) {
2397
2397
  const n = f();
2398
2398
  if (!n.isAuthenticated)
2399
- return i("AUTH_REQUIRED", "Authentication required");
2399
+ return r("AUTH_REQUIRED", "Authentication required");
2400
2400
  if (!n.baseUrl)
2401
- return i("AUTH_REQUIRED", "Base URL not configured");
2401
+ return r("AUTH_REQUIRED", "Base URL not configured");
2402
2402
  const t = new URLSearchParams();
2403
2403
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken), e?.state__in && e.state__in.length > 0 && t.append("state__in", e.state__in.join(",")), e?.type && t.append("type", e.type), e?.type__in && e.type__in.length > 0 && t.append("type__in", e.type__in.join(",")), e?.createTimestamp__gte && t.append("createTimestamp__gte", e.createTimestamp__gte), e?.createTimestamp__lte && t.append("createTimestamp__lte", e.createTimestamp__lte), e?.userId && t.append("userId", e.userId), e?.sort && e.sort.length > 0 && t.append("sort", e.sort.join(","));
2404
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/jobs${r ? `?${r}` : ""}`;
2404
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/jobs${i ? `?${i}` : ""}`;
2405
2405
  s("Fetching jobs:", a);
2406
2406
  try {
2407
2407
  const o = await fetch(a, {
@@ -2412,24 +2412,24 @@ async function zt(e) {
2412
2412
  }
2413
2413
  });
2414
2414
  if (!o.ok)
2415
- return ie(o);
2415
+ return re(o);
2416
2416
  const c = await o.json();
2417
2417
  return s("Jobs fetched:", c.results?.length ?? 0, "jobs"), d(c);
2418
2418
  } catch (o) {
2419
- return i("NETWORK_ERROR", `Failed to fetch jobs: ${String(o)}`);
2419
+ return r("NETWORK_ERROR", `Failed to fetch jobs: ${String(o)}`);
2420
2420
  }
2421
2421
  }
2422
2422
  async function Qt(e, n) {
2423
2423
  const t = f();
2424
2424
  if (!t.isAuthenticated)
2425
- return i("AUTH_REQUIRED", "Authentication required");
2425
+ return r("AUTH_REQUIRED", "Authentication required");
2426
2426
  if (!t.baseUrl)
2427
- return i("AUTH_REQUIRED", "Base URL not configured");
2427
+ return r("AUTH_REQUIRED", "Base URL not configured");
2428
2428
  if (!e)
2429
- return i("VALIDATION_ERROR", "Job ID is required");
2430
- const r = new URLSearchParams();
2431
- n?.include && n.include.length > 0 && r.append("include", n.include.join(","));
2432
- const a = r.toString(), o = `${t.baseUrl}/api/v3.0/jobs/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
2429
+ return r("VALIDATION_ERROR", "Job ID is required");
2430
+ const i = new URLSearchParams();
2431
+ n?.include && n.include.length > 0 && i.append("include", n.include.join(","));
2432
+ const a = i.toString(), o = `${t.baseUrl}/api/v3.0/jobs/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
2433
2433
  s("Fetching job:", o);
2434
2434
  try {
2435
2435
  const c = await fetch(o, {
@@ -2440,66 +2440,66 @@ async function Qt(e, n) {
2440
2440
  }
2441
2441
  });
2442
2442
  if (!c.ok)
2443
- return ie(c);
2443
+ return re(c);
2444
2444
  const u = await c.json();
2445
2445
  return s("Job fetched:", u.arguments?.originalRequest?.name || u.id, "state:", u.state), d(u);
2446
2446
  } catch (c) {
2447
- return i("NETWORK_ERROR", `Failed to fetch job: ${String(c)}`);
2447
+ return r("NETWORK_ERROR", `Failed to fetch job: ${String(c)}`);
2448
2448
  }
2449
2449
  }
2450
2450
  async function xt(e) {
2451
2451
  const n = f();
2452
2452
  if (!n.isAuthenticated)
2453
- return i("AUTH_REQUIRED", "Authentication required");
2453
+ return r("AUTH_REQUIRED", "Authentication required");
2454
2454
  if (!n.baseUrl)
2455
- return i("AUTH_REQUIRED", "Base URL not configured");
2455
+ return r("AUTH_REQUIRED", "Base URL not configured");
2456
2456
  if (!e)
2457
- return i("VALIDATION_ERROR", "Job ID is required");
2457
+ return r("VALIDATION_ERROR", "Job ID is required");
2458
2458
  const t = `${n.baseUrl}/api/v3.0/jobs/${encodeURIComponent(e)}`;
2459
2459
  s("Deleting job:", t);
2460
2460
  try {
2461
- const r = await fetch(t, {
2461
+ const i = await fetch(t, {
2462
2462
  method: "DELETE",
2463
2463
  headers: {
2464
2464
  Authorization: `Bearer ${n.token}`
2465
2465
  }
2466
2466
  });
2467
- return r.ok ? (s("Job deleted:", e), d(void 0)) : ie(r);
2468
- } catch (r) {
2469
- return i("NETWORK_ERROR", `Failed to delete job: ${String(r)}`);
2467
+ return i.ok ? (s("Job deleted:", e), d(void 0)) : re(i);
2468
+ } catch (i) {
2469
+ return r("NETWORK_ERROR", `Failed to delete job: ${String(i)}`);
2470
2470
  }
2471
2471
  }
2472
- async function ie(e) {
2472
+ async function re(e) {
2473
2473
  const n = e.status;
2474
2474
  let t;
2475
2475
  try {
2476
- const r = await e.json();
2477
- t = r.message ?? r.error ?? e.statusText;
2476
+ const i = await e.json();
2477
+ t = i.message ?? i.error ?? e.statusText;
2478
2478
  } catch {
2479
2479
  t = e.statusText || "Unknown error";
2480
2480
  }
2481
2481
  switch (n) {
2482
2482
  case 401:
2483
- return i("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
2483
+ return r("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
2484
2484
  case 403:
2485
- return i("FORBIDDEN", `Access denied: ${t}`, n);
2485
+ return r("FORBIDDEN", `Access denied: ${t}`, n);
2486
2486
  case 404:
2487
- return i("NOT_FOUND", `Not found: ${t}`, n);
2487
+ return r("NOT_FOUND", `Not found: ${t}`, n);
2488
2488
  case 429:
2489
- return i("RATE_LIMITED", `Rate limited: ${t}`, n);
2489
+ return r("RATE_LIMITED", `Rate limited: ${t}`, n);
2490
2490
  default:
2491
- return i("API_ERROR", `API error: ${t}`, n);
2491
+ return r("API_ERROR", `API error: ${t}`, n);
2492
2492
  }
2493
2493
  }
2494
2494
  async function Wt(e) {
2495
2495
  const n = f();
2496
2496
  if (!n.isAuthenticated)
2497
- return i("AUTH_REQUIRED", "Authentication required");
2497
+ return r("AUTH_REQUIRED", "Authentication required");
2498
2498
  if (!n.baseUrl)
2499
- return i("AUTH_REQUIRED", "Base URL not configured");
2499
+ return r("AUTH_REQUIRED", "Base URL not configured");
2500
2500
  const t = new URLSearchParams();
2501
2501
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken), e?.include && e.include.length > 0 && t.append("include", e.include.join(",")), e?.type__in && e.type__in.length > 0 && t.append("type__in", e.type__in.join(",")), e?.cameraId && t.append("cameraId", e.cameraId), e?.cameraId__in && e.cameraId__in.length > 0 && t.append("cameraId__in", e.cameraId__in.join(",")), e?.jobId && t.append("jobId", e.jobId), e?.createTimestamp__gte && t.append("createTimestamp__gte", e.createTimestamp__gte), e?.createTimestamp__lte && t.append("createTimestamp__lte", e.createTimestamp__lte), e?.tags__contains && e.tags__contains.length > 0 && t.append("tags__contains", e.tags__contains.join(",")), e?.q && t.append("q", e.q), e?.sort && e.sort.length > 0 && t.append("sort", e.sort.join(","));
2502
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/files${r ? `?${r}` : ""}`;
2502
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/files${i ? `?${i}` : ""}`;
2503
2503
  s("Fetching files:", a);
2504
2504
  try {
2505
2505
  const o = await fetch(a, {
@@ -2514,20 +2514,20 @@ async function Wt(e) {
2514
2514
  const c = await o.json();
2515
2515
  return s("Files fetched:", c.results?.length ?? 0, "files"), d(c);
2516
2516
  } catch (o) {
2517
- return i("NETWORK_ERROR", `Failed to fetch files: ${String(o)}`);
2517
+ return r("NETWORK_ERROR", `Failed to fetch files: ${String(o)}`);
2518
2518
  }
2519
2519
  }
2520
2520
  async function Vt(e, n) {
2521
2521
  const t = f();
2522
2522
  if (!t.isAuthenticated)
2523
- return i("AUTH_REQUIRED", "Authentication required");
2523
+ return r("AUTH_REQUIRED", "Authentication required");
2524
2524
  if (!t.baseUrl)
2525
- return i("AUTH_REQUIRED", "Base URL not configured");
2525
+ return r("AUTH_REQUIRED", "Base URL not configured");
2526
2526
  if (!e)
2527
- return i("VALIDATION_ERROR", "File ID is required");
2528
- const r = new URLSearchParams();
2529
- n?.include && n.include.length > 0 && r.append("include", n.include.join(","));
2530
- const a = r.toString(), o = `${t.baseUrl}/api/v3.0/files/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
2527
+ return r("VALIDATION_ERROR", "File ID is required");
2528
+ const i = new URLSearchParams();
2529
+ n?.include && n.include.length > 0 && i.append("include", n.include.join(","));
2530
+ const a = i.toString(), o = `${t.baseUrl}/api/v3.0/files/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
2531
2531
  s("Fetching file:", o);
2532
2532
  try {
2533
2533
  const c = await fetch(o, {
@@ -2542,23 +2542,23 @@ async function Vt(e, n) {
2542
2542
  const u = await c.json();
2543
2543
  return s("File fetched:", u.name), d(u);
2544
2544
  } catch (c) {
2545
- return i("NETWORK_ERROR", `Failed to fetch file: ${String(c)}`);
2545
+ return r("NETWORK_ERROR", `Failed to fetch file: ${String(c)}`);
2546
2546
  }
2547
2547
  }
2548
2548
  async function Mt(e) {
2549
2549
  const n = f();
2550
2550
  if (!n.isAuthenticated)
2551
- return i("AUTH_REQUIRED", "Authentication required");
2551
+ return r("AUTH_REQUIRED", "Authentication required");
2552
2552
  if (!n.baseUrl)
2553
- return i("AUTH_REQUIRED", "Base URL not configured");
2553
+ return r("AUTH_REQUIRED", "Base URL not configured");
2554
2554
  if (!e.name)
2555
- return i("VALIDATION_ERROR", "File name is required");
2555
+ return r("VALIDATION_ERROR", "File name is required");
2556
2556
  const t = `${n.baseUrl}/api/v3.0/files`;
2557
2557
  s("Creating file:", t);
2558
- const r = {
2558
+ const i = {
2559
2559
  name: e.name
2560
2560
  };
2561
- e.type && (r.type = e.type), e.filename && (r.filename = e.filename), e.description && (r.description = e.description), e.tags && e.tags.length > 0 && (r.tags = e.tags), e.cameraId && (r.cameraId = e.cameraId);
2561
+ e.type && (i.type = e.type), e.filename && (i.filename = e.filename), e.description && (i.description = e.description), e.tags && e.tags.length > 0 && (i.tags = e.tags), e.cameraId && (i.cameraId = e.cameraId);
2562
2562
  try {
2563
2563
  const a = await fetch(t, {
2564
2564
  method: "POST",
@@ -2567,105 +2567,105 @@ async function Mt(e) {
2567
2567
  "Content-Type": "application/json",
2568
2568
  Authorization: `Bearer ${n.token}`
2569
2569
  },
2570
- body: JSON.stringify(r)
2570
+ body: JSON.stringify(i)
2571
2571
  });
2572
2572
  if (!a.ok)
2573
2573
  return L(a);
2574
2574
  const o = await a.json();
2575
2575
  return s("File created:", o.id), d(o);
2576
2576
  } catch (a) {
2577
- return i("NETWORK_ERROR", `Failed to create file: ${String(a)}`);
2577
+ return r("NETWORK_ERROR", `Failed to create file: ${String(a)}`);
2578
2578
  }
2579
2579
  }
2580
2580
  async function Kt(e) {
2581
2581
  const n = f();
2582
2582
  if (!n.isAuthenticated)
2583
- return i("AUTH_REQUIRED", "Authentication required");
2583
+ return r("AUTH_REQUIRED", "Authentication required");
2584
2584
  if (!n.baseUrl)
2585
- return i("AUTH_REQUIRED", "Base URL not configured");
2585
+ return r("AUTH_REQUIRED", "Base URL not configured");
2586
2586
  if (!e)
2587
- return i("VALIDATION_ERROR", "File ID is required");
2587
+ return r("VALIDATION_ERROR", "File ID is required");
2588
2588
  const t = `${n.baseUrl}/api/v3.0/files/${encodeURIComponent(e)}:download`;
2589
2589
  s("Downloading file:", t);
2590
2590
  try {
2591
- const r = await fetch(t, {
2591
+ const i = await fetch(t, {
2592
2592
  method: "GET",
2593
2593
  headers: {
2594
2594
  Authorization: `Bearer ${n.token}`
2595
2595
  }
2596
2596
  });
2597
- if (!r.ok)
2598
- return L(r);
2599
- const a = await r.blob(), o = r.headers.get("Content-Disposition");
2597
+ if (!i.ok)
2598
+ return L(i);
2599
+ const a = await i.blob(), o = i.headers.get("Content-Disposition");
2600
2600
  let c = "download";
2601
2601
  if (o) {
2602
2602
  const _ = o.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);
2603
2603
  _ && _[1] && (c = _[1].replace(/['"]/g, ""));
2604
2604
  }
2605
- const u = r.headers.get("Content-Type") || "application/octet-stream", h = {
2605
+ const u = i.headers.get("Content-Type") || "application/octet-stream", h = {
2606
2606
  blob: a,
2607
2607
  filename: c,
2608
2608
  contentType: u,
2609
2609
  size: a.size
2610
2610
  };
2611
2611
  return s("File downloaded:", c, a.size, "bytes"), d(h);
2612
- } catch (r) {
2613
- return i("NETWORK_ERROR", `Failed to download file: ${String(r)}`);
2612
+ } catch (i) {
2613
+ return r("NETWORK_ERROR", `Failed to download file: ${String(i)}`);
2614
2614
  }
2615
2615
  }
2616
2616
  async function Gt(e) {
2617
2617
  const n = f();
2618
2618
  if (!n.isAuthenticated)
2619
- return i("AUTH_REQUIRED", "Authentication required");
2619
+ return r("AUTH_REQUIRED", "Authentication required");
2620
2620
  if (!n.baseUrl)
2621
- return i("AUTH_REQUIRED", "Base URL not configured");
2621
+ return r("AUTH_REQUIRED", "Base URL not configured");
2622
2622
  if (!e)
2623
- return i("VALIDATION_ERROR", "File ID is required");
2623
+ return r("VALIDATION_ERROR", "File ID is required");
2624
2624
  const t = `${n.baseUrl}/api/v3.0/files/${encodeURIComponent(e)}`;
2625
2625
  s("Deleting file:", t);
2626
2626
  try {
2627
- const r = await fetch(t, {
2627
+ const i = await fetch(t, {
2628
2628
  method: "DELETE",
2629
2629
  headers: {
2630
2630
  Authorization: `Bearer ${n.token}`
2631
2631
  }
2632
2632
  });
2633
- return r.ok ? (s("File deleted (recycled):", e), d(void 0)) : L(r);
2634
- } catch (r) {
2635
- return i("NETWORK_ERROR", `Failed to delete file: ${String(r)}`);
2633
+ return i.ok ? (s("File deleted (recycled):", e), d(void 0)) : L(i);
2634
+ } catch (i) {
2635
+ return r("NETWORK_ERROR", `Failed to delete file: ${String(i)}`);
2636
2636
  }
2637
2637
  }
2638
2638
  async function L(e) {
2639
2639
  const n = e.status;
2640
2640
  let t;
2641
2641
  try {
2642
- const r = await e.json();
2643
- t = r.message ?? r.error ?? e.statusText;
2642
+ const i = await e.json();
2643
+ t = i.message ?? i.error ?? e.statusText;
2644
2644
  } catch {
2645
2645
  t = e.statusText || "Unknown error";
2646
2646
  }
2647
2647
  switch (n) {
2648
2648
  case 401:
2649
- return i("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
2649
+ return r("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
2650
2650
  case 403:
2651
- return i("FORBIDDEN", `Access denied: ${t}`, n);
2651
+ return r("FORBIDDEN", `Access denied: ${t}`, n);
2652
2652
  case 404:
2653
- return i("NOT_FOUND", `Not found: ${t}`, n);
2653
+ return r("NOT_FOUND", `Not found: ${t}`, n);
2654
2654
  case 429:
2655
- return i("RATE_LIMITED", `Rate limited: ${t}`, n);
2655
+ return r("RATE_LIMITED", `Rate limited: ${t}`, n);
2656
2656
  default:
2657
- return i("API_ERROR", `API error: ${t}`, n);
2657
+ return r("API_ERROR", `API error: ${t}`, n);
2658
2658
  }
2659
2659
  }
2660
2660
  async function Jt(e) {
2661
2661
  const n = f();
2662
2662
  if (!n.isAuthenticated)
2663
- return i("AUTH_REQUIRED", "Authentication required");
2663
+ return r("AUTH_REQUIRED", "Authentication required");
2664
2664
  if (!n.baseUrl)
2665
- return i("AUTH_REQUIRED", "Base URL not configured");
2665
+ return r("AUTH_REQUIRED", "Base URL not configured");
2666
2666
  const t = new URLSearchParams();
2667
2667
  e?.pageSize && t.append("pageSize", String(e.pageSize)), e?.pageToken && t.append("pageToken", e.pageToken), e?.status__in && e.status__in.length > 0 && t.append("status__in", e.status__in.join(",")), e?.cameraId && t.append("cameraId", e.cameraId), e?.cameraId__in && e.cameraId__in.length > 0 && t.append("cameraId__in", e.cameraId__in.join(",")), e?.jobId && t.append("jobId", e.jobId), e?.fileId && t.append("fileId", e.fileId), e?.createTimestamp__gte && t.append("createTimestamp__gte", e.createTimestamp__gte), e?.createTimestamp__lte && t.append("createTimestamp__lte", e.createTimestamp__lte), e?.q && t.append("q", e.q), e?.sort && e.sort.length > 0 && t.append("sort", e.sort.join(","));
2668
- const r = t.toString(), a = `${n.baseUrl}/api/v3.0/downloads${r ? `?${r}` : ""}`;
2668
+ const i = t.toString(), a = `${n.baseUrl}/api/v3.0/downloads${i ? `?${i}` : ""}`;
2669
2669
  s("Fetching downloads:", a);
2670
2670
  try {
2671
2671
  const o = await fetch(a, {
@@ -2676,24 +2676,24 @@ async function Jt(e) {
2676
2676
  }
2677
2677
  });
2678
2678
  if (!o.ok)
2679
- return re(o);
2679
+ return ie(o);
2680
2680
  const c = await o.json();
2681
2681
  return s("Downloads fetched:", c.results?.length ?? 0, "downloads"), d(c);
2682
2682
  } catch (o) {
2683
- return i("NETWORK_ERROR", `Failed to fetch downloads: ${String(o)}`);
2683
+ return r("NETWORK_ERROR", `Failed to fetch downloads: ${String(o)}`);
2684
2684
  }
2685
2685
  }
2686
2686
  async function Xt(e, n) {
2687
2687
  const t = f();
2688
2688
  if (!t.isAuthenticated)
2689
- return i("AUTH_REQUIRED", "Authentication required");
2689
+ return r("AUTH_REQUIRED", "Authentication required");
2690
2690
  if (!t.baseUrl)
2691
- return i("AUTH_REQUIRED", "Base URL not configured");
2691
+ return r("AUTH_REQUIRED", "Base URL not configured");
2692
2692
  if (!e)
2693
- return i("VALIDATION_ERROR", "Download ID is required");
2694
- const r = new URLSearchParams();
2695
- n?.include && n.include.length > 0 && r.append("include", n.include.join(","));
2696
- const a = r.toString(), o = `${t.baseUrl}/api/v3.0/downloads/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
2693
+ return r("VALIDATION_ERROR", "Download ID is required");
2694
+ const i = new URLSearchParams();
2695
+ n?.include && n.include.length > 0 && i.append("include", n.include.join(","));
2696
+ const a = i.toString(), o = `${t.baseUrl}/api/v3.0/downloads/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
2697
2697
  s("Fetching download:", o);
2698
2698
  try {
2699
2699
  const c = await fetch(o, {
@@ -2704,69 +2704,69 @@ async function Xt(e, n) {
2704
2704
  }
2705
2705
  });
2706
2706
  if (!c.ok)
2707
- return re(c);
2707
+ return ie(c);
2708
2708
  const u = await c.json();
2709
2709
  return s("Download fetched:", u.name, "status:", u.status), d(u);
2710
2710
  } catch (c) {
2711
- return i("NETWORK_ERROR", `Failed to fetch download: ${String(c)}`);
2711
+ return r("NETWORK_ERROR", `Failed to fetch download: ${String(c)}`);
2712
2712
  }
2713
2713
  }
2714
2714
  async function Yt(e) {
2715
2715
  const n = f();
2716
2716
  if (!n.isAuthenticated)
2717
- return i("AUTH_REQUIRED", "Authentication required");
2717
+ return r("AUTH_REQUIRED", "Authentication required");
2718
2718
  if (!n.baseUrl)
2719
- return i("AUTH_REQUIRED", "Base URL not configured");
2719
+ return r("AUTH_REQUIRED", "Base URL not configured");
2720
2720
  if (!e)
2721
- return i("VALIDATION_ERROR", "Download ID is required");
2721
+ return r("VALIDATION_ERROR", "Download ID is required");
2722
2722
  const t = `${n.baseUrl}/api/v3.0/downloads/${encodeURIComponent(e)}:download`;
2723
2723
  s("Downloading:", t);
2724
2724
  try {
2725
- const r = await fetch(t, {
2725
+ const i = await fetch(t, {
2726
2726
  method: "GET",
2727
2727
  headers: {
2728
2728
  Authorization: `Bearer ${n.token}`
2729
2729
  }
2730
2730
  });
2731
- if (!r.ok)
2732
- return re(r);
2733
- const a = await r.blob(), o = r.headers.get("Content-Disposition");
2731
+ if (!i.ok)
2732
+ return ie(i);
2733
+ const a = await i.blob(), o = i.headers.get("Content-Disposition");
2734
2734
  let c = "download";
2735
2735
  if (o) {
2736
2736
  const _ = o.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);
2737
2737
  _ && _[1] && (c = _[1].replace(/['"]/g, ""));
2738
2738
  }
2739
- const u = r.headers.get("Content-Type") || "application/octet-stream", h = {
2739
+ const u = i.headers.get("Content-Type") || "application/octet-stream", h = {
2740
2740
  blob: a,
2741
2741
  filename: c,
2742
2742
  contentType: u,
2743
2743
  size: a.size
2744
2744
  };
2745
2745
  return s("Downloaded:", c, a.size, "bytes"), d(h);
2746
- } catch (r) {
2747
- return i("NETWORK_ERROR", `Failed to download: ${String(r)}`);
2746
+ } catch (i) {
2747
+ return r("NETWORK_ERROR", `Failed to download: ${String(i)}`);
2748
2748
  }
2749
2749
  }
2750
- async function re(e) {
2750
+ async function ie(e) {
2751
2751
  const n = e.status;
2752
2752
  let t;
2753
2753
  try {
2754
- const r = await e.json();
2755
- t = r.message ?? r.error ?? e.statusText;
2754
+ const i = await e.json();
2755
+ t = i.message ?? i.error ?? e.statusText;
2756
2756
  } catch {
2757
2757
  t = e.statusText || "Unknown error";
2758
2758
  }
2759
2759
  switch (n) {
2760
2760
  case 401:
2761
- return i("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
2761
+ return r("AUTH_REQUIRED", `Authentication failed: ${t}`, n);
2762
2762
  case 403:
2763
- return i("FORBIDDEN", `Access denied: ${t}`, n);
2763
+ return r("FORBIDDEN", `Access denied: ${t}`, n);
2764
2764
  case 404:
2765
- return i("NOT_FOUND", `Not found: ${t}`, n);
2765
+ return r("NOT_FOUND", `Not found: ${t}`, n);
2766
2766
  case 429:
2767
- return i("RATE_LIMITED", `Rate limited: ${t}`, n);
2767
+ return r("RATE_LIMITED", `Rate limited: ${t}`, n);
2768
2768
  default:
2769
- return i("API_ERROR", `API error: ${t}`, n);
2769
+ return r("API_ERROR", `API error: ${t}`, n);
2770
2770
  }
2771
2771
  }
2772
2772
  export {
@@ -2776,7 +2776,7 @@ export {
2776
2776
  kt as connectToEventSubscription,
2777
2777
  mt as createEventSubscription,
2778
2778
  Ht as createExportJob,
2779
- rt as createLayout,
2779
+ it as createLayout,
2780
2780
  $t as deleteEventSubscription,
2781
2781
  Gt as deleteFile,
2782
2782
  xt as deleteJob,
@@ -2784,7 +2784,7 @@ export {
2784
2784
  Yt as downloadDownload,
2785
2785
  Kt as downloadFile,
2786
2786
  pt as eventTypeHasDataSchemas,
2787
- i as failure,
2787
+ r as failure,
2788
2788
  T as formatTimestamp,
2789
2789
  ue as getAccessToken,
2790
2790
  Ut as getAlert,
@@ -2814,7 +2814,7 @@ export {
2814
2814
  Vt as getFile,
2815
2815
  Rt as getIncludeParameterForEventTypes,
2816
2816
  Qt as getJob,
2817
- it as getLayout,
2817
+ rt as getLayout,
2818
2818
  nt as getLayouts,
2819
2819
  st as getLiveImage,
2820
2820
  Ne as getMediaSession,