@camstack/addon-pipeline 0.1.8 → 0.1.10

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.
@@ -1,5 +1,5 @@
1
1
  import { i as _e, b as x, A as be, n as ve } from "./__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_trpc_mf_1_client__loadShare__.mjs-DeouEaSs.mjs";
2
- import { _ as V, a as Ee } from "./__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-C-URP6DW.mjs";
2
+ import { _ as V, a as Ee } from "./__mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-ezH__dL2.mjs";
3
3
  class Pe {
4
4
  constructor() {
5
5
  this.keyToValue = /* @__PURE__ */ new Map(), this.valueToKey = /* @__PURE__ */ new Map();
@@ -34,7 +34,7 @@ class q {
34
34
  return this.kv.getByKey(t);
35
35
  }
36
36
  }
37
- class Ce extends q {
37
+ class ke extends q {
38
38
  constructor() {
39
39
  super((t) => t.name), this.classToAllowedProps = /* @__PURE__ */ new Map();
40
40
  }
@@ -45,7 +45,7 @@ class Ce extends q {
45
45
  return this.classToAllowedProps.get(t);
46
46
  }
47
47
  }
48
- function ke(e) {
48
+ function Ce(e) {
49
49
  if ("values" in Object)
50
50
  return Object.values(e);
51
51
  const t = [];
@@ -54,7 +54,7 @@ function ke(e) {
54
54
  return t;
55
55
  }
56
56
  function Se(e, t) {
57
- const r = ke(e);
57
+ const r = Ce(e);
58
58
  if ("find" in r)
59
59
  return r.find(t);
60
60
  const s = r;
@@ -91,7 +91,7 @@ class Re {
91
91
  return this.transfomers[t];
92
92
  }
93
93
  }
94
- const Ie = (e) => Object.prototype.toString.call(e).slice(8, -1), W = (e) => typeof e > "u", Te = (e) => e === null, P = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, T = (e) => P(e) && Object.keys(e).length === 0, g = (e) => Array.isArray(e), Ae = (e) => typeof e == "string", Me = (e) => typeof e == "number" && !isNaN(e), Oe = (e) => typeof e == "boolean", De = (e) => e instanceof RegExp, C = (e) => e instanceof Map, k = (e) => e instanceof Set, K = (e) => Ie(e) === "Symbol", Le = (e) => e instanceof Date && !isNaN(e.valueOf()), Y = (e) => e instanceof Error, U = (e) => typeof e == "number" && isNaN(e), Ne = (e) => Oe(e) || Te(e) || W(e) || Me(e) || Ae(e) || K(e), xe = (e) => typeof e == "bigint", Ve = (e) => e === 1 / 0 || e === -1 / 0, Be = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), Ue = (e) => e instanceof URL, A = (e) => e.replace(/\\/g, "\\\\").replace(/\./g, "\\."), I = (e) => e.map(String).map(A).join("."), E = (e, t) => {
94
+ const Te = (e) => Object.prototype.toString.call(e).slice(8, -1), W = (e) => typeof e > "u", Ie = (e) => e === null, P = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, I = (e) => P(e) && Object.keys(e).length === 0, g = (e) => Array.isArray(e), Ae = (e) => typeof e == "string", Me = (e) => typeof e == "number" && !isNaN(e), Oe = (e) => typeof e == "boolean", De = (e) => e instanceof RegExp, k = (e) => e instanceof Map, C = (e) => e instanceof Set, K = (e) => Te(e) === "Symbol", Le = (e) => e instanceof Date && !isNaN(e.valueOf()), Y = (e) => e instanceof Error, U = (e) => typeof e == "number" && isNaN(e), Ne = (e) => Oe(e) || Ie(e) || W(e) || Me(e) || Ae(e) || K(e), xe = (e) => typeof e == "bigint", Ve = (e) => e === 1 / 0 || e === -1 / 0, Be = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), Ue = (e) => e instanceof URL, A = (e) => e.replace(/\\/g, "\\\\").replace(/\./g, "\\."), T = (e) => e.map(String).map(A).join("."), E = (e, t) => {
95
95
  const r = [];
96
96
  let s = "";
97
97
  for (let i = 0; i < e.length; i++) {
@@ -149,14 +149,14 @@ const G = [
149
149
  return new RegExp(t, r);
150
150
  }),
151
151
  y(
152
- k,
152
+ C,
153
153
  "set",
154
154
  // (sets only exist in es6+)
155
155
  // eslint-disable-next-line es5/no-es6-methods
156
156
  (e) => [...e.values()],
157
157
  (e) => new Set(e)
158
158
  ),
159
- y(C, "map", (e) => [...e.entries()], (e) => new Map(e)),
159
+ y(k, "map", (e) => [...e.entries()], (e) => new Map(e)),
160
160
  y((e) => U(e) || Ve(e), "number", (e) => U(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
161
161
  y((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
162
162
  y(Ue, "URL", (e) => e.toString(), (e) => new URL(e))
@@ -193,7 +193,7 @@ const H = R((e, t) => K(e) ? !!t.symbolRegistry.getIdentifier(e) : !1, (e, t) =>
193
193
  function Z(e, t) {
194
194
  return e?.constructor ? !!t.classRegistry.getIdentifier(e.constructor) : !1;
195
195
  }
196
- const Q = R(Z, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
196
+ const j = R(Z, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
197
197
  const r = t.classRegistry.getAllowedProps(e.constructor);
198
198
  if (!r)
199
199
  return { ...e };
@@ -206,12 +206,12 @@ const Q = R(Z, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)]
206
206
  if (!s)
207
207
  throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
208
208
  return Object.assign(Object.create(s.prototype), e);
209
- }), j = R((e, t) => !!t.customTransformerRegistry.findApplicable(e), (e, t) => ["custom", t.customTransformerRegistry.findApplicable(e).name], (e, t) => t.customTransformerRegistry.findApplicable(e).serialize(e), (e, t, r) => {
209
+ }), Q = R((e, t) => !!t.customTransformerRegistry.findApplicable(e), (e, t) => ["custom", t.customTransformerRegistry.findApplicable(e).name], (e, t) => t.customTransformerRegistry.findApplicable(e).serialize(e), (e, t, r) => {
210
210
  const s = r.customTransformerRegistry.findByName(t[1]);
211
211
  if (!s)
212
212
  throw new Error("Trying to deserialize unknown custom value");
213
213
  return s.deserialize(e);
214
- }), Fe = [Q, H, j, X], z = (e, t) => {
214
+ }), Fe = [j, H, Q, X], z = (e, t) => {
215
215
  const r = B(Fe, (n) => n.isApplicable(e, t));
216
216
  if (r)
217
217
  return {
@@ -234,9 +234,9 @@ const $e = (e, t, r) => {
234
234
  case "symbol":
235
235
  return H.untransform(e, t, r);
236
236
  case "class":
237
- return Q.untransform(e, t, r);
238
- case "custom":
239
237
  return j.untransform(e, t, r);
238
+ case "custom":
239
+ return Q.untransform(e, t, r);
240
240
  case "typed-array":
241
241
  return X.untransform(e, t, r);
242
242
  default:
@@ -268,9 +268,9 @@ const qe = (e, t) => {
268
268
  ee(t);
269
269
  for (let r = 0; r < t.length; r++) {
270
270
  const s = t[r];
271
- if (k(e))
271
+ if (C(e))
272
272
  e = b(e, +s);
273
- else if (C(e)) {
273
+ else if (k(e)) {
274
274
  const n = +s, i = +t[++r] == 0 ? "key" : "value", o = b(e, n);
275
275
  switch (i) {
276
276
  case "key":
@@ -295,10 +295,10 @@ const qe = (e, t) => {
295
295
  s = s[a];
296
296
  } else if (P(s))
297
297
  s = s[o];
298
- else if (k(s)) {
298
+ else if (C(s)) {
299
299
  const a = +o;
300
300
  s = b(s, a);
301
- } else if (C(s)) {
301
+ } else if (k(s)) {
302
302
  if (i === t.length - 2)
303
303
  break;
304
304
  const c = +o, f = +t[++i] == 0 ? "key" : "value", h = b(s, c);
@@ -313,11 +313,11 @@ const qe = (e, t) => {
313
313
  }
314
314
  }
315
315
  const n = t[t.length - 1];
316
- if (g(s) ? s[+n] = r(s[+n]) : P(s) && (s[n] = r(s[n])), k(s)) {
316
+ if (g(s) ? s[+n] = r(s[+n]) : P(s) && (s[n] = r(s[n])), C(s)) {
317
317
  const i = b(s, +n), o = r(i);
318
318
  i !== o && (s.delete(i), s.add(o));
319
319
  }
320
- if (C(s)) {
320
+ if (k(s)) {
321
321
  const i = +t[t.length - 2], o = b(s, i);
322
322
  switch (+n == 0 ? "key" : "value") {
323
323
  case "key": {
@@ -374,7 +374,7 @@ function Ke(e, t, r) {
374
374
  v(t, n);
375
375
  return e;
376
376
  }
377
- const Ye = (e, t) => P(e) || g(e) || C(e) || k(e) || Y(e) || Z(e, t);
377
+ const Ye = (e, t) => P(e) || g(e) || k(e) || C(e) || Y(e) || Z(e, t);
378
378
  function Ge(e, t, r) {
379
379
  const s = r.get(e);
380
380
  s ? s.push(t) : r.set(e, [t]);
@@ -387,8 +387,8 @@ function He(e, t) {
387
387
  return;
388
388
  t || (n = n.map((a) => a.map(String)).sort((a, c) => a.length - c.length));
389
389
  const [i, ...o] = n;
390
- i.length === 0 ? s = o.map(I) : r[I(i)] = o.map(I);
391
- }), s ? T(r) ? [s] : [s, r] : T(r) ? void 0 : r;
390
+ i.length === 0 ? s = o.map(T) : r[T(i)] = o.map(T);
391
+ }), s ? I(r) ? [s] : [s, r] : I(r) ? void 0 : r;
392
392
  }
393
393
  const re = (e, t, r, s, n = [], i = [], o = /* @__PURE__ */ new Map()) => {
394
394
  const a = Ne(e);
@@ -422,7 +422,7 @@ const re = (e, t, r, s, n = [], i = [], o = /* @__PURE__ */ new Map()) => {
422
422
  p[A(m) + "." + we] = w;
423
423
  });
424
424
  });
425
- const d = T(p) ? {
425
+ const d = I(p) ? {
426
426
  transformedValue: h,
427
427
  annotations: c ? [c.type] : void 0
428
428
  } : {
@@ -470,7 +470,7 @@ class l {
470
470
  * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
471
471
  */
472
472
  constructor({ dedupe: t = !1 } = {}) {
473
- this.classRegistry = new Ce(), this.symbolRegistry = new q((r) => r.description ?? ""), this.customTransformerRegistry = new Re(), this.allowedErrorProps = [], this.dedupe = t;
473
+ this.classRegistry = new ke(), this.symbolRegistry = new q((r) => r.description ?? ""), this.customTransformerRegistry = new Re(), this.allowedErrorProps = [], this.dedupe = t;
474
474
  }
475
475
  serialize(t) {
476
476
  const r = /* @__PURE__ */ new Map(), s = re(t, r, this, this.dedupe), n = {
@@ -530,7 +530,7 @@ l.registerClass;
530
530
  l.registerCustom;
531
531
  l.registerSymbol;
532
532
  l.allowErrorProps;
533
- const Qe = 1e4, je = 3e3, Je = 2e3, et = 3e4;
533
+ const je = 1e4, Qe = 3e3, Je = 2e3, et = 3e4;
534
534
  class tt {
535
535
  /** Active server base URL. Mutable via `switchServerUrl()` so the
536
536
  * endpoint-race helper can pivot the transport onto a LAN candidate
@@ -758,6 +758,21 @@ class tt {
758
758
  // ── Auth ──────────────────────────────────────────────────────────
759
759
  async login(t, r) {
760
760
  const s = await this._trpcClient.auth.login.mutate({ username: t, password: r });
761
+ if (typeof s == "object" && s !== null && "token" in s) {
762
+ const n = s, i = n.token;
763
+ typeof i == "string" && n.requiresTotp !== !0 && this.setToken(i);
764
+ }
765
+ return s;
766
+ }
767
+ /**
768
+ * Second leg of the 2FA login. The caller passes the challenge
769
+ * token returned by `login` (when `requiresTotp: true`) plus the
770
+ * 6-digit code from the user's authenticator app. On success the
771
+ * server mints the real session JWT, which we set as the active
772
+ * token on this client.
773
+ */
774
+ async loginVerifyTotp(t, r) {
775
+ const s = await this._trpcClient.auth.loginVerifyTotp.mutate({ challengeToken: t, code: r });
761
776
  if (typeof s == "object" && s !== null && "token" in s) {
762
777
  const n = s.token;
763
778
  typeof n == "string" && this.setToken(n);
@@ -978,8 +993,8 @@ class tt {
978
993
  retryDelayMs: (i) => Math.min(s * Math.pow(2, i), n),
979
994
  keepAlive: {
980
995
  enabled: !0,
981
- intervalMs: Qe,
982
- pongTimeoutMs: je
996
+ intervalMs: je,
997
+ pongTimeoutMs: Qe
983
998
  },
984
999
  onOpen: () => {
985
1000
  this._connectionVersion += 1, this.emitConnectionEvent("connected");
@@ -1296,7 +1311,7 @@ const ie = [
1296
1311
  "plate"
1297
1312
  /* Plate */
1298
1313
  ], at = [...L];
1299
- function Ct(e, t) {
1314
+ function kt(e, t) {
1300
1315
  switch (e) {
1301
1316
  case "critical":
1302
1317
  return ge;
@@ -1340,7 +1355,7 @@ const $ = {
1340
1355
  sensor: "sensor",
1341
1356
  media_player: "media_player",
1342
1357
  script: "script"
1343
- }, kt = {
1358
+ }, Ct = {
1344
1359
  light: "light",
1345
1360
  switch: "switch",
1346
1361
  input_boolean: "switch",
@@ -1403,7 +1418,7 @@ const lt = [
1403
1418
  "Sensor",
1404
1419
  "Select",
1405
1420
  "Program"
1406
- ], It = new Set(lt), ct = [
1421
+ ], Tt = new Set(lt), ct = [
1407
1422
  "light",
1408
1423
  "switch",
1409
1424
  "input_boolean",
@@ -1417,7 +1432,7 @@ const lt = [
1417
1432
  "siren",
1418
1433
  "media_player",
1419
1434
  "script"
1420
- ], Tt = new Set(ct), N = [
1435
+ ], It = new Set(ct), N = [
1421
1436
  {
1422
1437
  id: "liveStream",
1423
1438
  label: "Live Stream",
@@ -1568,11 +1583,11 @@ export {
1568
1583
  L as DEFAULT_ENABLED_CLASSES,
1569
1584
  ne as DetectionClass,
1570
1585
  ct as ELIGIBLE_HA_DOMAINS,
1571
- Tt as ELIGIBLE_HA_DOMAINS_SET,
1586
+ It as ELIGIBLE_HA_DOMAINS_SET,
1572
1587
  lt as ELIGIBLE_SCRYPTED_DEVICE_TYPES,
1573
- It as ELIGIBLE_SCRYPTED_DEVICE_TYPES_SET,
1588
+ Tt as ELIGIBLE_SCRYPTED_DEVICE_TYPES_SET,
1574
1589
  N as FEATURE_MATRIX,
1575
- kt as HA_DOMAIN_TYPE_MAP,
1590
+ Ct as HA_DOMAIN_TYPE_MAP,
1576
1591
  $ as RAW_TO_CANONICAL,
1577
1592
  St as SCRYPTED_TYPE_TO_CANONICAL,
1578
1593
  tt as System,
@@ -1589,7 +1604,7 @@ export {
1589
1604
  le as faceClasses,
1590
1605
  Ot as getBackendRequiredFeatures,
1591
1606
  Rt as getCanonicalDeviceType,
1592
- Ct as getClassesForTimelinePreset,
1607
+ kt as getClassesForTimelinePreset,
1593
1608
  Lt as getNextEvalInterval,
1594
1609
  Et as getParentClass,
1595
1610
  Pt as getParentDetectionClass,