@camstack/ui-library 0.1.50 → 0.1.51
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/composites/copy-button.d.ts +12 -0
- package/dist/composites/device-export-panel.d.ts +16 -0
- package/dist/composites/error-box.d.ts +19 -0
- package/dist/composites/index.d.ts +7 -0
- package/dist/composites/qr-code.d.ts +12 -0
- package/dist/generated/system-hooks.d.ts +8 -0
- package/dist/index.cjs +2088 -448
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1635 -4
- package/dist/index.js.map +1 -1
- package/package.json +7 -1
package/dist/index.js
CHANGED
|
@@ -13,8 +13,9 @@ import * as __mfHostTrpcClient from "@trpc/client";
|
|
|
13
13
|
import { createTRPCClient, createWSClient, httpLink, splitLink, wsLink } from "@trpc/client";
|
|
14
14
|
import * as __mfHostTrpcReactQuery from "@trpc/react-query";
|
|
15
15
|
import { createTRPCReact } from "@trpc/react-query";
|
|
16
|
-
import { ALL_CAPABILITY_DEFINITIONS, EventCategory, KNOWN_CAP_NAMES, createDeviceProxy } from "@camstack/types";
|
|
16
|
+
import { ALL_CAPABILITY_DEFINITIONS, DeviceExportStatusSchema, EventCategory, ExposedDeviceSchema, KNOWN_CAP_NAMES, createDeviceProxy } from "@camstack/types";
|
|
17
17
|
import { createSystem } from "@camstack/sdk";
|
|
18
|
+
import { z } from "zod";
|
|
18
19
|
//#region ../../node_modules/clsx/dist/clsx.mjs
|
|
19
20
|
function r(e) {
|
|
20
21
|
var t, f, n = "";
|
|
@@ -7968,6 +7969,68 @@ var PowerOff = createLucideIcon("power-off", [
|
|
|
7968
7969
|
key: "1ooewy"
|
|
7969
7970
|
}]
|
|
7970
7971
|
]);
|
|
7972
|
+
var QrCode$1 = createLucideIcon("qr-code", [
|
|
7973
|
+
["rect", {
|
|
7974
|
+
width: "5",
|
|
7975
|
+
height: "5",
|
|
7976
|
+
x: "3",
|
|
7977
|
+
y: "3",
|
|
7978
|
+
rx: "1",
|
|
7979
|
+
key: "1tu5fj"
|
|
7980
|
+
}],
|
|
7981
|
+
["rect", {
|
|
7982
|
+
width: "5",
|
|
7983
|
+
height: "5",
|
|
7984
|
+
x: "16",
|
|
7985
|
+
y: "3",
|
|
7986
|
+
rx: "1",
|
|
7987
|
+
key: "1v8r4q"
|
|
7988
|
+
}],
|
|
7989
|
+
["rect", {
|
|
7990
|
+
width: "5",
|
|
7991
|
+
height: "5",
|
|
7992
|
+
x: "3",
|
|
7993
|
+
y: "16",
|
|
7994
|
+
rx: "1",
|
|
7995
|
+
key: "1x03jg"
|
|
7996
|
+
}],
|
|
7997
|
+
["path", {
|
|
7998
|
+
d: "M21 16h-3a2 2 0 0 0-2 2v3",
|
|
7999
|
+
key: "177gqh"
|
|
8000
|
+
}],
|
|
8001
|
+
["path", {
|
|
8002
|
+
d: "M21 21v.01",
|
|
8003
|
+
key: "ents32"
|
|
8004
|
+
}],
|
|
8005
|
+
["path", {
|
|
8006
|
+
d: "M12 7v3a2 2 0 0 1-2 2H7",
|
|
8007
|
+
key: "8crl2c"
|
|
8008
|
+
}],
|
|
8009
|
+
["path", {
|
|
8010
|
+
d: "M3 12h.01",
|
|
8011
|
+
key: "nlz23k"
|
|
8012
|
+
}],
|
|
8013
|
+
["path", {
|
|
8014
|
+
d: "M12 3h.01",
|
|
8015
|
+
key: "n36tog"
|
|
8016
|
+
}],
|
|
8017
|
+
["path", {
|
|
8018
|
+
d: "M12 16v.01",
|
|
8019
|
+
key: "133mhm"
|
|
8020
|
+
}],
|
|
8021
|
+
["path", {
|
|
8022
|
+
d: "M16 12h1",
|
|
8023
|
+
key: "1slzba"
|
|
8024
|
+
}],
|
|
8025
|
+
["path", {
|
|
8026
|
+
d: "M21 12v.01",
|
|
8027
|
+
key: "1lwtk9"
|
|
8028
|
+
}],
|
|
8029
|
+
["path", {
|
|
8030
|
+
d: "M12 21v-1",
|
|
8031
|
+
key: "1880an"
|
|
8032
|
+
}]
|
|
8033
|
+
]);
|
|
7971
8034
|
var Radar = createLucideIcon("radar", [
|
|
7972
8035
|
["path", {
|
|
7973
8036
|
d: "M19.07 4.93A10 10 0 0 0 6.99 3.34",
|
|
@@ -8153,6 +8216,40 @@ var Server = createLucideIcon("server", [
|
|
|
8153
8216
|
key: "nzw8ys"
|
|
8154
8217
|
}]
|
|
8155
8218
|
]);
|
|
8219
|
+
var Share2 = createLucideIcon("share-2", [
|
|
8220
|
+
["circle", {
|
|
8221
|
+
cx: "18",
|
|
8222
|
+
cy: "5",
|
|
8223
|
+
r: "3",
|
|
8224
|
+
key: "gq8acd"
|
|
8225
|
+
}],
|
|
8226
|
+
["circle", {
|
|
8227
|
+
cx: "6",
|
|
8228
|
+
cy: "12",
|
|
8229
|
+
r: "3",
|
|
8230
|
+
key: "w7nqdw"
|
|
8231
|
+
}],
|
|
8232
|
+
["circle", {
|
|
8233
|
+
cx: "18",
|
|
8234
|
+
cy: "19",
|
|
8235
|
+
r: "3",
|
|
8236
|
+
key: "1xt0gg"
|
|
8237
|
+
}],
|
|
8238
|
+
["line", {
|
|
8239
|
+
x1: "8.59",
|
|
8240
|
+
x2: "15.42",
|
|
8241
|
+
y1: "13.51",
|
|
8242
|
+
y2: "17.49",
|
|
8243
|
+
key: "47mynk"
|
|
8244
|
+
}],
|
|
8245
|
+
["line", {
|
|
8246
|
+
x1: "15.41",
|
|
8247
|
+
x2: "8.59",
|
|
8248
|
+
y1: "6.51",
|
|
8249
|
+
y2: "10.49",
|
|
8250
|
+
key: "1n3mei"
|
|
8251
|
+
}]
|
|
8252
|
+
]);
|
|
8156
8253
|
var Shield = createLucideIcon("shield", [["path", {
|
|
8157
8254
|
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
|
8158
8255
|
key: "oel41y"
|
|
@@ -8360,6 +8457,10 @@ var TriangleAlert = createLucideIcon("triangle-alert", [
|
|
|
8360
8457
|
key: "p32p05"
|
|
8361
8458
|
}]
|
|
8362
8459
|
]);
|
|
8460
|
+
var Unlink2 = createLucideIcon("unlink-2", [["path", {
|
|
8461
|
+
d: "M15 7h2a5 5 0 0 1 0 10h-2m-6 0H7A5 5 0 0 1 7 7h2",
|
|
8462
|
+
key: "1re2ne"
|
|
8463
|
+
}]]);
|
|
8363
8464
|
var Upload = createLucideIcon("upload", [
|
|
8364
8465
|
["path", {
|
|
8365
8466
|
d: "M12 3v12",
|
|
@@ -10780,7 +10881,7 @@ function ProviderBadge({ provider, showLabel = true, className }) {
|
|
|
10780
10881
|
}
|
|
10781
10882
|
//#endregion
|
|
10782
10883
|
//#region src/composites/version-badge.tsx
|
|
10783
|
-
var VARIANT_STYLES = {
|
|
10884
|
+
var VARIANT_STYLES$1 = {
|
|
10784
10885
|
success: "bg-emerald-400 text-emerald-950",
|
|
10785
10886
|
warning: "bg-amber-400 text-amber-950",
|
|
10786
10887
|
danger: "bg-red-400 text-red-950",
|
|
@@ -10793,7 +10894,7 @@ var VARIANT_STYLES = {
|
|
|
10793
10894
|
*/
|
|
10794
10895
|
function SemanticBadge({ children, variant = "neutral", mono, className }) {
|
|
10795
10896
|
return /* @__PURE__ */ jsx("span", {
|
|
10796
|
-
className: cn("inline-flex items-center rounded-md px-2 py-0.5 text-[11px] font-bold leading-tight", mono && "font-mono", VARIANT_STYLES[variant], className),
|
|
10897
|
+
className: cn("inline-flex items-center rounded-md px-2 py-0.5 text-[11px] font-bold leading-tight", mono && "font-mono", VARIANT_STYLES$1[variant], className),
|
|
10797
10898
|
children
|
|
10798
10899
|
});
|
|
10799
10900
|
}
|
|
@@ -10882,6 +10983,55 @@ function EmptyState({ icon: Icon, title, description, action, className }) {
|
|
|
10882
10983
|
});
|
|
10883
10984
|
}
|
|
10884
10985
|
//#endregion
|
|
10986
|
+
//#region src/composites/error-box.tsx
|
|
10987
|
+
var VARIANT_STYLES = {
|
|
10988
|
+
danger: {
|
|
10989
|
+
box: "border-danger/40 bg-danger/10",
|
|
10990
|
+
icon: "text-danger",
|
|
10991
|
+
title: "text-danger",
|
|
10992
|
+
message: "text-danger"
|
|
10993
|
+
},
|
|
10994
|
+
warning: {
|
|
10995
|
+
box: "border-amber-500/40 bg-amber-500/10",
|
|
10996
|
+
icon: "text-amber-600 dark:text-amber-400",
|
|
10997
|
+
title: "text-amber-700 dark:text-amber-300",
|
|
10998
|
+
message: "text-amber-700 dark:text-amber-300"
|
|
10999
|
+
}
|
|
11000
|
+
};
|
|
11001
|
+
function ErrorBox({ message, title, onRetry, action, variant = "danger", className }) {
|
|
11002
|
+
const styles = VARIANT_STYLES[variant];
|
|
11003
|
+
const Icon = variant === "warning" ? TriangleAlert : CircleAlert;
|
|
11004
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
11005
|
+
role: "alert",
|
|
11006
|
+
className: cn("flex items-start gap-2.5 rounded border px-3 py-2.5", styles.box, className),
|
|
11007
|
+
children: [
|
|
11008
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
11009
|
+
className: cn("h-4 w-4 mt-0.5 shrink-0", styles.icon),
|
|
11010
|
+
"aria-hidden": "true"
|
|
11011
|
+
}),
|
|
11012
|
+
/* @__PURE__ */ jsxs("div", {
|
|
11013
|
+
className: "flex-1 min-w-0",
|
|
11014
|
+
children: [title && /* @__PURE__ */ jsx("p", {
|
|
11015
|
+
className: cn("text-xs font-semibold", styles.title),
|
|
11016
|
+
children: title
|
|
11017
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
11018
|
+
className: cn("text-xs break-words", styles.message, title ? "mt-0.5" : ""),
|
|
11019
|
+
children: message
|
|
11020
|
+
})]
|
|
11021
|
+
}),
|
|
11022
|
+
action ?? (onRetry && /* @__PURE__ */ jsxs("button", {
|
|
11023
|
+
type: "button",
|
|
11024
|
+
onClick: onRetry,
|
|
11025
|
+
className: cn("shrink-0 inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium", "border border-current/30 hover:bg-current/10 transition-colors", styles.message),
|
|
11026
|
+
children: [/* @__PURE__ */ jsx(RefreshCw, {
|
|
11027
|
+
className: "h-3 w-3",
|
|
11028
|
+
"aria-hidden": "true"
|
|
11029
|
+
}), "Retry"]
|
|
11030
|
+
}))
|
|
11031
|
+
]
|
|
11032
|
+
});
|
|
11033
|
+
}
|
|
11034
|
+
//#endregion
|
|
10885
11035
|
//#region src/composites/confirm-dialog.tsx
|
|
10886
11036
|
var ConfirmContext = createSharedContext("camstack:confirm-dialog", null);
|
|
10887
11037
|
function useConfirm() {
|
|
@@ -15626,6 +15776,14 @@ var useAddonsRollbackPackage = trpc.addons.rollbackPackage.useMutation;
|
|
|
15626
15776
|
var useAddonsForceRefresh = trpc.addons.forceRefresh.useMutation;
|
|
15627
15777
|
/** Generated alias around `trpc.addons.restartServer.useMutation`. */
|
|
15628
15778
|
var useAddonsRestartServer = trpc.addons.restartServer.useMutation;
|
|
15779
|
+
/** Generated alias around `trpc.addons.getLastRestart.useQuery`. */
|
|
15780
|
+
var useAddonsGetLastRestart = trpc.addons.getLastRestart.useQuery;
|
|
15781
|
+
/** Generated alias around `trpc.addons.listFrameworkPackages.useQuery`. */
|
|
15782
|
+
var useAddonsListFrameworkPackages = trpc.addons.listFrameworkPackages.useQuery;
|
|
15783
|
+
/** Generated alias around `trpc.addons.listCapabilityProviders.useQuery`. */
|
|
15784
|
+
var useAddonsListCapabilityProviders = trpc.addons.listCapabilityProviders.useQuery;
|
|
15785
|
+
/** Generated alias around `trpc.addons.updateFrameworkPackage.useMutation`. */
|
|
15786
|
+
var useAddonsUpdateFrameworkPackage = trpc.addons.updateFrameworkPackage.useMutation;
|
|
15629
15787
|
/** Generated alias around `trpc.addons.getVersions.useQuery`. */
|
|
15630
15788
|
var useAddonsGetVersions = trpc.addons.getVersions.useQuery;
|
|
15631
15789
|
/** Generated alias around `trpc.addons.restartAddon.useMutation`. */
|
|
@@ -20077,6 +20235,1479 @@ function StreamBrokerSelector({ deviceId, value, onChange, disabled, label, clas
|
|
|
20077
20235
|
});
|
|
20078
20236
|
}
|
|
20079
20237
|
//#endregion
|
|
20238
|
+
//#region ../../node_modules/qrcode.react/lib/esm/index.js
|
|
20239
|
+
var __defProp = Object.defineProperty;
|
|
20240
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
20241
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
20242
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
20243
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
20244
|
+
enumerable: true,
|
|
20245
|
+
configurable: true,
|
|
20246
|
+
writable: true,
|
|
20247
|
+
value
|
|
20248
|
+
}) : obj[key] = value;
|
|
20249
|
+
var __spreadValues = (a, b) => {
|
|
20250
|
+
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
20251
|
+
if (__getOwnPropSymbols) {
|
|
20252
|
+
for (var prop of __getOwnPropSymbols(b)) if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
20253
|
+
}
|
|
20254
|
+
return a;
|
|
20255
|
+
};
|
|
20256
|
+
var __objRest = (source, exclude) => {
|
|
20257
|
+
var target = {};
|
|
20258
|
+
for (var prop in source) if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop];
|
|
20259
|
+
if (source != null && __getOwnPropSymbols) {
|
|
20260
|
+
for (var prop of __getOwnPropSymbols(source)) if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) target[prop] = source[prop];
|
|
20261
|
+
}
|
|
20262
|
+
return target;
|
|
20263
|
+
};
|
|
20264
|
+
/**
|
|
20265
|
+
* @license QR Code generator library (TypeScript)
|
|
20266
|
+
* Copyright (c) Project Nayuki.
|
|
20267
|
+
* SPDX-License-Identifier: MIT
|
|
20268
|
+
*/
|
|
20269
|
+
var qrcodegen;
|
|
20270
|
+
((qrcodegen2) => {
|
|
20271
|
+
const _QrCode = class _QrCode {
|
|
20272
|
+
constructor(version, errorCorrectionLevel, dataCodewords, msk) {
|
|
20273
|
+
this.version = version;
|
|
20274
|
+
this.errorCorrectionLevel = errorCorrectionLevel;
|
|
20275
|
+
this.modules = [];
|
|
20276
|
+
this.isFunction = [];
|
|
20277
|
+
if (version < _QrCode.MIN_VERSION || version > _QrCode.MAX_VERSION) throw new RangeError("Version value out of range");
|
|
20278
|
+
if (msk < -1 || msk > 7) throw new RangeError("Mask value out of range");
|
|
20279
|
+
this.size = version * 4 + 17;
|
|
20280
|
+
let row = [];
|
|
20281
|
+
for (let i = 0; i < this.size; i++) row.push(false);
|
|
20282
|
+
for (let i = 0; i < this.size; i++) {
|
|
20283
|
+
this.modules.push(row.slice());
|
|
20284
|
+
this.isFunction.push(row.slice());
|
|
20285
|
+
}
|
|
20286
|
+
this.drawFunctionPatterns();
|
|
20287
|
+
const allCodewords = this.addEccAndInterleave(dataCodewords);
|
|
20288
|
+
this.drawCodewords(allCodewords);
|
|
20289
|
+
if (msk == -1) {
|
|
20290
|
+
let minPenalty = 1e9;
|
|
20291
|
+
for (let i = 0; i < 8; i++) {
|
|
20292
|
+
this.applyMask(i);
|
|
20293
|
+
this.drawFormatBits(i);
|
|
20294
|
+
const penalty = this.getPenaltyScore();
|
|
20295
|
+
if (penalty < minPenalty) {
|
|
20296
|
+
msk = i;
|
|
20297
|
+
minPenalty = penalty;
|
|
20298
|
+
}
|
|
20299
|
+
this.applyMask(i);
|
|
20300
|
+
}
|
|
20301
|
+
}
|
|
20302
|
+
assert(0 <= msk && msk <= 7);
|
|
20303
|
+
this.mask = msk;
|
|
20304
|
+
this.applyMask(msk);
|
|
20305
|
+
this.drawFormatBits(msk);
|
|
20306
|
+
this.isFunction = [];
|
|
20307
|
+
}
|
|
20308
|
+
static encodeText(text, ecl) {
|
|
20309
|
+
const segs = qrcodegen2.QrSegment.makeSegments(text);
|
|
20310
|
+
return _QrCode.encodeSegments(segs, ecl);
|
|
20311
|
+
}
|
|
20312
|
+
static encodeBinary(data, ecl) {
|
|
20313
|
+
const seg = qrcodegen2.QrSegment.makeBytes(data);
|
|
20314
|
+
return _QrCode.encodeSegments([seg], ecl);
|
|
20315
|
+
}
|
|
20316
|
+
static encodeSegments(segs, ecl, minVersion = 1, maxVersion = 40, mask = -1, boostEcl = true) {
|
|
20317
|
+
if (!(_QrCode.MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= _QrCode.MAX_VERSION) || mask < -1 || mask > 7) throw new RangeError("Invalid value");
|
|
20318
|
+
let version;
|
|
20319
|
+
let dataUsedBits;
|
|
20320
|
+
for (version = minVersion;; version++) {
|
|
20321
|
+
const dataCapacityBits2 = _QrCode.getNumDataCodewords(version, ecl) * 8;
|
|
20322
|
+
const usedBits = QrSegment.getTotalBits(segs, version);
|
|
20323
|
+
if (usedBits <= dataCapacityBits2) {
|
|
20324
|
+
dataUsedBits = usedBits;
|
|
20325
|
+
break;
|
|
20326
|
+
}
|
|
20327
|
+
if (version >= maxVersion) throw new RangeError("Data too long");
|
|
20328
|
+
}
|
|
20329
|
+
for (const newEcl of [
|
|
20330
|
+
_QrCode.Ecc.MEDIUM,
|
|
20331
|
+
_QrCode.Ecc.QUARTILE,
|
|
20332
|
+
_QrCode.Ecc.HIGH
|
|
20333
|
+
]) if (boostEcl && dataUsedBits <= _QrCode.getNumDataCodewords(version, newEcl) * 8) ecl = newEcl;
|
|
20334
|
+
let bb = [];
|
|
20335
|
+
for (const seg of segs) {
|
|
20336
|
+
appendBits(seg.mode.modeBits, 4, bb);
|
|
20337
|
+
appendBits(seg.numChars, seg.mode.numCharCountBits(version), bb);
|
|
20338
|
+
for (const b of seg.getData()) bb.push(b);
|
|
20339
|
+
}
|
|
20340
|
+
assert(bb.length == dataUsedBits);
|
|
20341
|
+
const dataCapacityBits = _QrCode.getNumDataCodewords(version, ecl) * 8;
|
|
20342
|
+
assert(bb.length <= dataCapacityBits);
|
|
20343
|
+
appendBits(0, Math.min(4, dataCapacityBits - bb.length), bb);
|
|
20344
|
+
appendBits(0, (8 - bb.length % 8) % 8, bb);
|
|
20345
|
+
assert(bb.length % 8 == 0);
|
|
20346
|
+
for (let padByte = 236; bb.length < dataCapacityBits; padByte ^= 253) appendBits(padByte, 8, bb);
|
|
20347
|
+
let dataCodewords = [];
|
|
20348
|
+
while (dataCodewords.length * 8 < bb.length) dataCodewords.push(0);
|
|
20349
|
+
bb.forEach((b, i) => dataCodewords[i >>> 3] |= b << 7 - (i & 7));
|
|
20350
|
+
return new _QrCode(version, ecl, dataCodewords, mask);
|
|
20351
|
+
}
|
|
20352
|
+
getModule(x, y) {
|
|
20353
|
+
return 0 <= x && x < this.size && 0 <= y && y < this.size && this.modules[y][x];
|
|
20354
|
+
}
|
|
20355
|
+
getModules() {
|
|
20356
|
+
return this.modules;
|
|
20357
|
+
}
|
|
20358
|
+
drawFunctionPatterns() {
|
|
20359
|
+
for (let i = 0; i < this.size; i++) {
|
|
20360
|
+
this.setFunctionModule(6, i, i % 2 == 0);
|
|
20361
|
+
this.setFunctionModule(i, 6, i % 2 == 0);
|
|
20362
|
+
}
|
|
20363
|
+
this.drawFinderPattern(3, 3);
|
|
20364
|
+
this.drawFinderPattern(this.size - 4, 3);
|
|
20365
|
+
this.drawFinderPattern(3, this.size - 4);
|
|
20366
|
+
const alignPatPos = this.getAlignmentPatternPositions();
|
|
20367
|
+
const numAlign = alignPatPos.length;
|
|
20368
|
+
for (let i = 0; i < numAlign; i++) for (let j = 0; j < numAlign; j++) if (!(i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0)) this.drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);
|
|
20369
|
+
this.drawFormatBits(0);
|
|
20370
|
+
this.drawVersion();
|
|
20371
|
+
}
|
|
20372
|
+
drawFormatBits(mask) {
|
|
20373
|
+
const data = this.errorCorrectionLevel.formatBits << 3 | mask;
|
|
20374
|
+
let rem = data;
|
|
20375
|
+
for (let i = 0; i < 10; i++) rem = rem << 1 ^ (rem >>> 9) * 1335;
|
|
20376
|
+
const bits = (data << 10 | rem) ^ 21522;
|
|
20377
|
+
assert(bits >>> 15 == 0);
|
|
20378
|
+
for (let i = 0; i <= 5; i++) this.setFunctionModule(8, i, getBit(bits, i));
|
|
20379
|
+
this.setFunctionModule(8, 7, getBit(bits, 6));
|
|
20380
|
+
this.setFunctionModule(8, 8, getBit(bits, 7));
|
|
20381
|
+
this.setFunctionModule(7, 8, getBit(bits, 8));
|
|
20382
|
+
for (let i = 9; i < 15; i++) this.setFunctionModule(14 - i, 8, getBit(bits, i));
|
|
20383
|
+
for (let i = 0; i < 8; i++) this.setFunctionModule(this.size - 1 - i, 8, getBit(bits, i));
|
|
20384
|
+
for (let i = 8; i < 15; i++) this.setFunctionModule(8, this.size - 15 + i, getBit(bits, i));
|
|
20385
|
+
this.setFunctionModule(8, this.size - 8, true);
|
|
20386
|
+
}
|
|
20387
|
+
drawVersion() {
|
|
20388
|
+
if (this.version < 7) return;
|
|
20389
|
+
let rem = this.version;
|
|
20390
|
+
for (let i = 0; i < 12; i++) rem = rem << 1 ^ (rem >>> 11) * 7973;
|
|
20391
|
+
const bits = this.version << 12 | rem;
|
|
20392
|
+
assert(bits >>> 18 == 0);
|
|
20393
|
+
for (let i = 0; i < 18; i++) {
|
|
20394
|
+
const color = getBit(bits, i);
|
|
20395
|
+
const a = this.size - 11 + i % 3;
|
|
20396
|
+
const b = Math.floor(i / 3);
|
|
20397
|
+
this.setFunctionModule(a, b, color);
|
|
20398
|
+
this.setFunctionModule(b, a, color);
|
|
20399
|
+
}
|
|
20400
|
+
}
|
|
20401
|
+
drawFinderPattern(x, y) {
|
|
20402
|
+
for (let dy = -4; dy <= 4; dy++) for (let dx = -4; dx <= 4; dx++) {
|
|
20403
|
+
const dist = Math.max(Math.abs(dx), Math.abs(dy));
|
|
20404
|
+
const xx = x + dx;
|
|
20405
|
+
const yy = y + dy;
|
|
20406
|
+
if (0 <= xx && xx < this.size && 0 <= yy && yy < this.size) this.setFunctionModule(xx, yy, dist != 2 && dist != 4);
|
|
20407
|
+
}
|
|
20408
|
+
}
|
|
20409
|
+
drawAlignmentPattern(x, y) {
|
|
20410
|
+
for (let dy = -2; dy <= 2; dy++) for (let dx = -2; dx <= 2; dx++) this.setFunctionModule(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) != 1);
|
|
20411
|
+
}
|
|
20412
|
+
setFunctionModule(x, y, isDark) {
|
|
20413
|
+
this.modules[y][x] = isDark;
|
|
20414
|
+
this.isFunction[y][x] = true;
|
|
20415
|
+
}
|
|
20416
|
+
addEccAndInterleave(data) {
|
|
20417
|
+
const ver = this.version;
|
|
20418
|
+
const ecl = this.errorCorrectionLevel;
|
|
20419
|
+
if (data.length != _QrCode.getNumDataCodewords(ver, ecl)) throw new RangeError("Invalid argument");
|
|
20420
|
+
const numBlocks = _QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
|
|
20421
|
+
const blockEccLen = _QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver];
|
|
20422
|
+
const rawCodewords = Math.floor(_QrCode.getNumRawDataModules(ver) / 8);
|
|
20423
|
+
const numShortBlocks = numBlocks - rawCodewords % numBlocks;
|
|
20424
|
+
const shortBlockLen = Math.floor(rawCodewords / numBlocks);
|
|
20425
|
+
let blocks = [];
|
|
20426
|
+
const rsDiv = _QrCode.reedSolomonComputeDivisor(blockEccLen);
|
|
20427
|
+
for (let i = 0, k = 0; i < numBlocks; i++) {
|
|
20428
|
+
let dat = data.slice(k, k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1));
|
|
20429
|
+
k += dat.length;
|
|
20430
|
+
const ecc = _QrCode.reedSolomonComputeRemainder(dat, rsDiv);
|
|
20431
|
+
if (i < numShortBlocks) dat.push(0);
|
|
20432
|
+
blocks.push(dat.concat(ecc));
|
|
20433
|
+
}
|
|
20434
|
+
let result = [];
|
|
20435
|
+
for (let i = 0; i < blocks[0].length; i++) blocks.forEach((block, j) => {
|
|
20436
|
+
if (i != shortBlockLen - blockEccLen || j >= numShortBlocks) result.push(block[i]);
|
|
20437
|
+
});
|
|
20438
|
+
assert(result.length == rawCodewords);
|
|
20439
|
+
return result;
|
|
20440
|
+
}
|
|
20441
|
+
drawCodewords(data) {
|
|
20442
|
+
if (data.length != Math.floor(_QrCode.getNumRawDataModules(this.version) / 8)) throw new RangeError("Invalid argument");
|
|
20443
|
+
let i = 0;
|
|
20444
|
+
for (let right = this.size - 1; right >= 1; right -= 2) {
|
|
20445
|
+
if (right == 6) right = 5;
|
|
20446
|
+
for (let vert = 0; vert < this.size; vert++) for (let j = 0; j < 2; j++) {
|
|
20447
|
+
const x = right - j;
|
|
20448
|
+
const y = (right + 1 & 2) == 0 ? this.size - 1 - vert : vert;
|
|
20449
|
+
if (!this.isFunction[y][x] && i < data.length * 8) {
|
|
20450
|
+
this.modules[y][x] = getBit(data[i >>> 3], 7 - (i & 7));
|
|
20451
|
+
i++;
|
|
20452
|
+
}
|
|
20453
|
+
}
|
|
20454
|
+
}
|
|
20455
|
+
assert(i == data.length * 8);
|
|
20456
|
+
}
|
|
20457
|
+
applyMask(mask) {
|
|
20458
|
+
if (mask < 0 || mask > 7) throw new RangeError("Mask value out of range");
|
|
20459
|
+
for (let y = 0; y < this.size; y++) for (let x = 0; x < this.size; x++) {
|
|
20460
|
+
let invert;
|
|
20461
|
+
switch (mask) {
|
|
20462
|
+
case 0:
|
|
20463
|
+
invert = (x + y) % 2 == 0;
|
|
20464
|
+
break;
|
|
20465
|
+
case 1:
|
|
20466
|
+
invert = y % 2 == 0;
|
|
20467
|
+
break;
|
|
20468
|
+
case 2:
|
|
20469
|
+
invert = x % 3 == 0;
|
|
20470
|
+
break;
|
|
20471
|
+
case 3:
|
|
20472
|
+
invert = (x + y) % 3 == 0;
|
|
20473
|
+
break;
|
|
20474
|
+
case 4:
|
|
20475
|
+
invert = (Math.floor(x / 3) + Math.floor(y / 2)) % 2 == 0;
|
|
20476
|
+
break;
|
|
20477
|
+
case 5:
|
|
20478
|
+
invert = x * y % 2 + x * y % 3 == 0;
|
|
20479
|
+
break;
|
|
20480
|
+
case 6:
|
|
20481
|
+
invert = (x * y % 2 + x * y % 3) % 2 == 0;
|
|
20482
|
+
break;
|
|
20483
|
+
case 7:
|
|
20484
|
+
invert = ((x + y) % 2 + x * y % 3) % 2 == 0;
|
|
20485
|
+
break;
|
|
20486
|
+
default: throw new Error("Unreachable");
|
|
20487
|
+
}
|
|
20488
|
+
if (!this.isFunction[y][x] && invert) this.modules[y][x] = !this.modules[y][x];
|
|
20489
|
+
}
|
|
20490
|
+
}
|
|
20491
|
+
getPenaltyScore() {
|
|
20492
|
+
let result = 0;
|
|
20493
|
+
for (let y = 0; y < this.size; y++) {
|
|
20494
|
+
let runColor = false;
|
|
20495
|
+
let runX = 0;
|
|
20496
|
+
let runHistory = [
|
|
20497
|
+
0,
|
|
20498
|
+
0,
|
|
20499
|
+
0,
|
|
20500
|
+
0,
|
|
20501
|
+
0,
|
|
20502
|
+
0,
|
|
20503
|
+
0
|
|
20504
|
+
];
|
|
20505
|
+
for (let x = 0; x < this.size; x++) if (this.modules[y][x] == runColor) {
|
|
20506
|
+
runX++;
|
|
20507
|
+
if (runX == 5) result += _QrCode.PENALTY_N1;
|
|
20508
|
+
else if (runX > 5) result++;
|
|
20509
|
+
} else {
|
|
20510
|
+
this.finderPenaltyAddHistory(runX, runHistory);
|
|
20511
|
+
if (!runColor) result += this.finderPenaltyCountPatterns(runHistory) * _QrCode.PENALTY_N3;
|
|
20512
|
+
runColor = this.modules[y][x];
|
|
20513
|
+
runX = 1;
|
|
20514
|
+
}
|
|
20515
|
+
result += this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) * _QrCode.PENALTY_N3;
|
|
20516
|
+
}
|
|
20517
|
+
for (let x = 0; x < this.size; x++) {
|
|
20518
|
+
let runColor = false;
|
|
20519
|
+
let runY = 0;
|
|
20520
|
+
let runHistory = [
|
|
20521
|
+
0,
|
|
20522
|
+
0,
|
|
20523
|
+
0,
|
|
20524
|
+
0,
|
|
20525
|
+
0,
|
|
20526
|
+
0,
|
|
20527
|
+
0
|
|
20528
|
+
];
|
|
20529
|
+
for (let y = 0; y < this.size; y++) if (this.modules[y][x] == runColor) {
|
|
20530
|
+
runY++;
|
|
20531
|
+
if (runY == 5) result += _QrCode.PENALTY_N1;
|
|
20532
|
+
else if (runY > 5) result++;
|
|
20533
|
+
} else {
|
|
20534
|
+
this.finderPenaltyAddHistory(runY, runHistory);
|
|
20535
|
+
if (!runColor) result += this.finderPenaltyCountPatterns(runHistory) * _QrCode.PENALTY_N3;
|
|
20536
|
+
runColor = this.modules[y][x];
|
|
20537
|
+
runY = 1;
|
|
20538
|
+
}
|
|
20539
|
+
result += this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) * _QrCode.PENALTY_N3;
|
|
20540
|
+
}
|
|
20541
|
+
for (let y = 0; y < this.size - 1; y++) for (let x = 0; x < this.size - 1; x++) {
|
|
20542
|
+
const color = this.modules[y][x];
|
|
20543
|
+
if (color == this.modules[y][x + 1] && color == this.modules[y + 1][x] && color == this.modules[y + 1][x + 1]) result += _QrCode.PENALTY_N2;
|
|
20544
|
+
}
|
|
20545
|
+
let dark = 0;
|
|
20546
|
+
for (const row of this.modules) dark = row.reduce((sum, color) => sum + (color ? 1 : 0), dark);
|
|
20547
|
+
const total = this.size * this.size;
|
|
20548
|
+
const k = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;
|
|
20549
|
+
assert(0 <= k && k <= 9);
|
|
20550
|
+
result += k * _QrCode.PENALTY_N4;
|
|
20551
|
+
assert(0 <= result && result <= 2568888);
|
|
20552
|
+
return result;
|
|
20553
|
+
}
|
|
20554
|
+
getAlignmentPatternPositions() {
|
|
20555
|
+
if (this.version == 1) return [];
|
|
20556
|
+
else {
|
|
20557
|
+
const numAlign = Math.floor(this.version / 7) + 2;
|
|
20558
|
+
const step = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2;
|
|
20559
|
+
let result = [6];
|
|
20560
|
+
for (let pos = this.size - 7; result.length < numAlign; pos -= step) result.splice(1, 0, pos);
|
|
20561
|
+
return result;
|
|
20562
|
+
}
|
|
20563
|
+
}
|
|
20564
|
+
static getNumRawDataModules(ver) {
|
|
20565
|
+
if (ver < _QrCode.MIN_VERSION || ver > _QrCode.MAX_VERSION) throw new RangeError("Version number out of range");
|
|
20566
|
+
let result = (16 * ver + 128) * ver + 64;
|
|
20567
|
+
if (ver >= 2) {
|
|
20568
|
+
const numAlign = Math.floor(ver / 7) + 2;
|
|
20569
|
+
result -= (25 * numAlign - 10) * numAlign - 55;
|
|
20570
|
+
if (ver >= 7) result -= 36;
|
|
20571
|
+
}
|
|
20572
|
+
assert(208 <= result && result <= 29648);
|
|
20573
|
+
return result;
|
|
20574
|
+
}
|
|
20575
|
+
static getNumDataCodewords(ver, ecl) {
|
|
20576
|
+
return Math.floor(_QrCode.getNumRawDataModules(ver) / 8) - _QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * _QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
|
|
20577
|
+
}
|
|
20578
|
+
static reedSolomonComputeDivisor(degree) {
|
|
20579
|
+
if (degree < 1 || degree > 255) throw new RangeError("Degree out of range");
|
|
20580
|
+
let result = [];
|
|
20581
|
+
for (let i = 0; i < degree - 1; i++) result.push(0);
|
|
20582
|
+
result.push(1);
|
|
20583
|
+
let root = 1;
|
|
20584
|
+
for (let i = 0; i < degree; i++) {
|
|
20585
|
+
for (let j = 0; j < result.length; j++) {
|
|
20586
|
+
result[j] = _QrCode.reedSolomonMultiply(result[j], root);
|
|
20587
|
+
if (j + 1 < result.length) result[j] ^= result[j + 1];
|
|
20588
|
+
}
|
|
20589
|
+
root = _QrCode.reedSolomonMultiply(root, 2);
|
|
20590
|
+
}
|
|
20591
|
+
return result;
|
|
20592
|
+
}
|
|
20593
|
+
static reedSolomonComputeRemainder(data, divisor) {
|
|
20594
|
+
let result = divisor.map((_) => 0);
|
|
20595
|
+
for (const b of data) {
|
|
20596
|
+
const factor = b ^ result.shift();
|
|
20597
|
+
result.push(0);
|
|
20598
|
+
divisor.forEach((coef, i) => result[i] ^= _QrCode.reedSolomonMultiply(coef, factor));
|
|
20599
|
+
}
|
|
20600
|
+
return result;
|
|
20601
|
+
}
|
|
20602
|
+
static reedSolomonMultiply(x, y) {
|
|
20603
|
+
if (x >>> 8 != 0 || y >>> 8 != 0) throw new RangeError("Byte out of range");
|
|
20604
|
+
let z = 0;
|
|
20605
|
+
for (let i = 7; i >= 0; i--) {
|
|
20606
|
+
z = z << 1 ^ (z >>> 7) * 285;
|
|
20607
|
+
z ^= (y >>> i & 1) * x;
|
|
20608
|
+
}
|
|
20609
|
+
assert(z >>> 8 == 0);
|
|
20610
|
+
return z;
|
|
20611
|
+
}
|
|
20612
|
+
finderPenaltyCountPatterns(runHistory) {
|
|
20613
|
+
const n = runHistory[1];
|
|
20614
|
+
assert(n <= this.size * 3);
|
|
20615
|
+
const core = n > 0 && runHistory[2] == n && runHistory[3] == n * 3 && runHistory[4] == n && runHistory[5] == n;
|
|
20616
|
+
return (core && runHistory[0] >= n * 4 && runHistory[6] >= n ? 1 : 0) + (core && runHistory[6] >= n * 4 && runHistory[0] >= n ? 1 : 0);
|
|
20617
|
+
}
|
|
20618
|
+
finderPenaltyTerminateAndCount(currentRunColor, currentRunLength, runHistory) {
|
|
20619
|
+
if (currentRunColor) {
|
|
20620
|
+
this.finderPenaltyAddHistory(currentRunLength, runHistory);
|
|
20621
|
+
currentRunLength = 0;
|
|
20622
|
+
}
|
|
20623
|
+
currentRunLength += this.size;
|
|
20624
|
+
this.finderPenaltyAddHistory(currentRunLength, runHistory);
|
|
20625
|
+
return this.finderPenaltyCountPatterns(runHistory);
|
|
20626
|
+
}
|
|
20627
|
+
finderPenaltyAddHistory(currentRunLength, runHistory) {
|
|
20628
|
+
if (runHistory[0] == 0) currentRunLength += this.size;
|
|
20629
|
+
runHistory.pop();
|
|
20630
|
+
runHistory.unshift(currentRunLength);
|
|
20631
|
+
}
|
|
20632
|
+
};
|
|
20633
|
+
_QrCode.MIN_VERSION = 1;
|
|
20634
|
+
_QrCode.MAX_VERSION = 40;
|
|
20635
|
+
_QrCode.PENALTY_N1 = 3;
|
|
20636
|
+
_QrCode.PENALTY_N2 = 3;
|
|
20637
|
+
_QrCode.PENALTY_N3 = 40;
|
|
20638
|
+
_QrCode.PENALTY_N4 = 10;
|
|
20639
|
+
_QrCode.ECC_CODEWORDS_PER_BLOCK = [
|
|
20640
|
+
[
|
|
20641
|
+
-1,
|
|
20642
|
+
7,
|
|
20643
|
+
10,
|
|
20644
|
+
15,
|
|
20645
|
+
20,
|
|
20646
|
+
26,
|
|
20647
|
+
18,
|
|
20648
|
+
20,
|
|
20649
|
+
24,
|
|
20650
|
+
30,
|
|
20651
|
+
18,
|
|
20652
|
+
20,
|
|
20653
|
+
24,
|
|
20654
|
+
26,
|
|
20655
|
+
30,
|
|
20656
|
+
22,
|
|
20657
|
+
24,
|
|
20658
|
+
28,
|
|
20659
|
+
30,
|
|
20660
|
+
28,
|
|
20661
|
+
28,
|
|
20662
|
+
28,
|
|
20663
|
+
28,
|
|
20664
|
+
30,
|
|
20665
|
+
30,
|
|
20666
|
+
26,
|
|
20667
|
+
28,
|
|
20668
|
+
30,
|
|
20669
|
+
30,
|
|
20670
|
+
30,
|
|
20671
|
+
30,
|
|
20672
|
+
30,
|
|
20673
|
+
30,
|
|
20674
|
+
30,
|
|
20675
|
+
30,
|
|
20676
|
+
30,
|
|
20677
|
+
30,
|
|
20678
|
+
30,
|
|
20679
|
+
30,
|
|
20680
|
+
30,
|
|
20681
|
+
30
|
|
20682
|
+
],
|
|
20683
|
+
[
|
|
20684
|
+
-1,
|
|
20685
|
+
10,
|
|
20686
|
+
16,
|
|
20687
|
+
26,
|
|
20688
|
+
18,
|
|
20689
|
+
24,
|
|
20690
|
+
16,
|
|
20691
|
+
18,
|
|
20692
|
+
22,
|
|
20693
|
+
22,
|
|
20694
|
+
26,
|
|
20695
|
+
30,
|
|
20696
|
+
22,
|
|
20697
|
+
22,
|
|
20698
|
+
24,
|
|
20699
|
+
24,
|
|
20700
|
+
28,
|
|
20701
|
+
28,
|
|
20702
|
+
26,
|
|
20703
|
+
26,
|
|
20704
|
+
26,
|
|
20705
|
+
26,
|
|
20706
|
+
28,
|
|
20707
|
+
28,
|
|
20708
|
+
28,
|
|
20709
|
+
28,
|
|
20710
|
+
28,
|
|
20711
|
+
28,
|
|
20712
|
+
28,
|
|
20713
|
+
28,
|
|
20714
|
+
28,
|
|
20715
|
+
28,
|
|
20716
|
+
28,
|
|
20717
|
+
28,
|
|
20718
|
+
28,
|
|
20719
|
+
28,
|
|
20720
|
+
28,
|
|
20721
|
+
28,
|
|
20722
|
+
28,
|
|
20723
|
+
28,
|
|
20724
|
+
28
|
|
20725
|
+
],
|
|
20726
|
+
[
|
|
20727
|
+
-1,
|
|
20728
|
+
13,
|
|
20729
|
+
22,
|
|
20730
|
+
18,
|
|
20731
|
+
26,
|
|
20732
|
+
18,
|
|
20733
|
+
24,
|
|
20734
|
+
18,
|
|
20735
|
+
22,
|
|
20736
|
+
20,
|
|
20737
|
+
24,
|
|
20738
|
+
28,
|
|
20739
|
+
26,
|
|
20740
|
+
24,
|
|
20741
|
+
20,
|
|
20742
|
+
30,
|
|
20743
|
+
24,
|
|
20744
|
+
28,
|
|
20745
|
+
28,
|
|
20746
|
+
26,
|
|
20747
|
+
30,
|
|
20748
|
+
28,
|
|
20749
|
+
30,
|
|
20750
|
+
30,
|
|
20751
|
+
30,
|
|
20752
|
+
30,
|
|
20753
|
+
28,
|
|
20754
|
+
30,
|
|
20755
|
+
30,
|
|
20756
|
+
30,
|
|
20757
|
+
30,
|
|
20758
|
+
30,
|
|
20759
|
+
30,
|
|
20760
|
+
30,
|
|
20761
|
+
30,
|
|
20762
|
+
30,
|
|
20763
|
+
30,
|
|
20764
|
+
30,
|
|
20765
|
+
30,
|
|
20766
|
+
30,
|
|
20767
|
+
30
|
|
20768
|
+
],
|
|
20769
|
+
[
|
|
20770
|
+
-1,
|
|
20771
|
+
17,
|
|
20772
|
+
28,
|
|
20773
|
+
22,
|
|
20774
|
+
16,
|
|
20775
|
+
22,
|
|
20776
|
+
28,
|
|
20777
|
+
26,
|
|
20778
|
+
26,
|
|
20779
|
+
24,
|
|
20780
|
+
28,
|
|
20781
|
+
24,
|
|
20782
|
+
28,
|
|
20783
|
+
22,
|
|
20784
|
+
24,
|
|
20785
|
+
24,
|
|
20786
|
+
30,
|
|
20787
|
+
28,
|
|
20788
|
+
28,
|
|
20789
|
+
26,
|
|
20790
|
+
28,
|
|
20791
|
+
30,
|
|
20792
|
+
24,
|
|
20793
|
+
30,
|
|
20794
|
+
30,
|
|
20795
|
+
30,
|
|
20796
|
+
30,
|
|
20797
|
+
30,
|
|
20798
|
+
30,
|
|
20799
|
+
30,
|
|
20800
|
+
30,
|
|
20801
|
+
30,
|
|
20802
|
+
30,
|
|
20803
|
+
30,
|
|
20804
|
+
30,
|
|
20805
|
+
30,
|
|
20806
|
+
30,
|
|
20807
|
+
30,
|
|
20808
|
+
30,
|
|
20809
|
+
30,
|
|
20810
|
+
30
|
|
20811
|
+
]
|
|
20812
|
+
];
|
|
20813
|
+
_QrCode.NUM_ERROR_CORRECTION_BLOCKS = [
|
|
20814
|
+
[
|
|
20815
|
+
-1,
|
|
20816
|
+
1,
|
|
20817
|
+
1,
|
|
20818
|
+
1,
|
|
20819
|
+
1,
|
|
20820
|
+
1,
|
|
20821
|
+
2,
|
|
20822
|
+
2,
|
|
20823
|
+
2,
|
|
20824
|
+
2,
|
|
20825
|
+
4,
|
|
20826
|
+
4,
|
|
20827
|
+
4,
|
|
20828
|
+
4,
|
|
20829
|
+
4,
|
|
20830
|
+
6,
|
|
20831
|
+
6,
|
|
20832
|
+
6,
|
|
20833
|
+
6,
|
|
20834
|
+
7,
|
|
20835
|
+
8,
|
|
20836
|
+
8,
|
|
20837
|
+
9,
|
|
20838
|
+
9,
|
|
20839
|
+
10,
|
|
20840
|
+
12,
|
|
20841
|
+
12,
|
|
20842
|
+
12,
|
|
20843
|
+
13,
|
|
20844
|
+
14,
|
|
20845
|
+
15,
|
|
20846
|
+
16,
|
|
20847
|
+
17,
|
|
20848
|
+
18,
|
|
20849
|
+
19,
|
|
20850
|
+
19,
|
|
20851
|
+
20,
|
|
20852
|
+
21,
|
|
20853
|
+
22,
|
|
20854
|
+
24,
|
|
20855
|
+
25
|
|
20856
|
+
],
|
|
20857
|
+
[
|
|
20858
|
+
-1,
|
|
20859
|
+
1,
|
|
20860
|
+
1,
|
|
20861
|
+
1,
|
|
20862
|
+
2,
|
|
20863
|
+
2,
|
|
20864
|
+
4,
|
|
20865
|
+
4,
|
|
20866
|
+
4,
|
|
20867
|
+
5,
|
|
20868
|
+
5,
|
|
20869
|
+
5,
|
|
20870
|
+
8,
|
|
20871
|
+
9,
|
|
20872
|
+
9,
|
|
20873
|
+
10,
|
|
20874
|
+
10,
|
|
20875
|
+
11,
|
|
20876
|
+
13,
|
|
20877
|
+
14,
|
|
20878
|
+
16,
|
|
20879
|
+
17,
|
|
20880
|
+
17,
|
|
20881
|
+
18,
|
|
20882
|
+
20,
|
|
20883
|
+
21,
|
|
20884
|
+
23,
|
|
20885
|
+
25,
|
|
20886
|
+
26,
|
|
20887
|
+
28,
|
|
20888
|
+
29,
|
|
20889
|
+
31,
|
|
20890
|
+
33,
|
|
20891
|
+
35,
|
|
20892
|
+
37,
|
|
20893
|
+
38,
|
|
20894
|
+
40,
|
|
20895
|
+
43,
|
|
20896
|
+
45,
|
|
20897
|
+
47,
|
|
20898
|
+
49
|
|
20899
|
+
],
|
|
20900
|
+
[
|
|
20901
|
+
-1,
|
|
20902
|
+
1,
|
|
20903
|
+
1,
|
|
20904
|
+
2,
|
|
20905
|
+
2,
|
|
20906
|
+
4,
|
|
20907
|
+
4,
|
|
20908
|
+
6,
|
|
20909
|
+
6,
|
|
20910
|
+
8,
|
|
20911
|
+
8,
|
|
20912
|
+
8,
|
|
20913
|
+
10,
|
|
20914
|
+
12,
|
|
20915
|
+
16,
|
|
20916
|
+
12,
|
|
20917
|
+
17,
|
|
20918
|
+
16,
|
|
20919
|
+
18,
|
|
20920
|
+
21,
|
|
20921
|
+
20,
|
|
20922
|
+
23,
|
|
20923
|
+
23,
|
|
20924
|
+
25,
|
|
20925
|
+
27,
|
|
20926
|
+
29,
|
|
20927
|
+
34,
|
|
20928
|
+
34,
|
|
20929
|
+
35,
|
|
20930
|
+
38,
|
|
20931
|
+
40,
|
|
20932
|
+
43,
|
|
20933
|
+
45,
|
|
20934
|
+
48,
|
|
20935
|
+
51,
|
|
20936
|
+
53,
|
|
20937
|
+
56,
|
|
20938
|
+
59,
|
|
20939
|
+
62,
|
|
20940
|
+
65,
|
|
20941
|
+
68
|
|
20942
|
+
],
|
|
20943
|
+
[
|
|
20944
|
+
-1,
|
|
20945
|
+
1,
|
|
20946
|
+
1,
|
|
20947
|
+
2,
|
|
20948
|
+
4,
|
|
20949
|
+
4,
|
|
20950
|
+
4,
|
|
20951
|
+
5,
|
|
20952
|
+
6,
|
|
20953
|
+
8,
|
|
20954
|
+
8,
|
|
20955
|
+
11,
|
|
20956
|
+
11,
|
|
20957
|
+
16,
|
|
20958
|
+
16,
|
|
20959
|
+
18,
|
|
20960
|
+
16,
|
|
20961
|
+
19,
|
|
20962
|
+
21,
|
|
20963
|
+
25,
|
|
20964
|
+
25,
|
|
20965
|
+
25,
|
|
20966
|
+
34,
|
|
20967
|
+
30,
|
|
20968
|
+
32,
|
|
20969
|
+
35,
|
|
20970
|
+
37,
|
|
20971
|
+
40,
|
|
20972
|
+
42,
|
|
20973
|
+
45,
|
|
20974
|
+
48,
|
|
20975
|
+
51,
|
|
20976
|
+
54,
|
|
20977
|
+
57,
|
|
20978
|
+
60,
|
|
20979
|
+
63,
|
|
20980
|
+
66,
|
|
20981
|
+
70,
|
|
20982
|
+
74,
|
|
20983
|
+
77,
|
|
20984
|
+
81
|
|
20985
|
+
]
|
|
20986
|
+
];
|
|
20987
|
+
qrcodegen2.QrCode = _QrCode;
|
|
20988
|
+
function appendBits(val, len, bb) {
|
|
20989
|
+
if (len < 0 || len > 31 || val >>> len != 0) throw new RangeError("Value out of range");
|
|
20990
|
+
for (let i = len - 1; i >= 0; i--) bb.push(val >>> i & 1);
|
|
20991
|
+
}
|
|
20992
|
+
function getBit(x, i) {
|
|
20993
|
+
return (x >>> i & 1) != 0;
|
|
20994
|
+
}
|
|
20995
|
+
function assert(cond) {
|
|
20996
|
+
if (!cond) throw new Error("Assertion error");
|
|
20997
|
+
}
|
|
20998
|
+
const _QrSegment = class _QrSegment {
|
|
20999
|
+
constructor(mode, numChars, bitData) {
|
|
21000
|
+
this.mode = mode;
|
|
21001
|
+
this.numChars = numChars;
|
|
21002
|
+
this.bitData = bitData;
|
|
21003
|
+
if (numChars < 0) throw new RangeError("Invalid argument");
|
|
21004
|
+
this.bitData = bitData.slice();
|
|
21005
|
+
}
|
|
21006
|
+
static makeBytes(data) {
|
|
21007
|
+
let bb = [];
|
|
21008
|
+
for (const b of data) appendBits(b, 8, bb);
|
|
21009
|
+
return new _QrSegment(_QrSegment.Mode.BYTE, data.length, bb);
|
|
21010
|
+
}
|
|
21011
|
+
static makeNumeric(digits) {
|
|
21012
|
+
if (!_QrSegment.isNumeric(digits)) throw new RangeError("String contains non-numeric characters");
|
|
21013
|
+
let bb = [];
|
|
21014
|
+
for (let i = 0; i < digits.length;) {
|
|
21015
|
+
const n = Math.min(digits.length - i, 3);
|
|
21016
|
+
appendBits(parseInt(digits.substring(i, i + n), 10), n * 3 + 1, bb);
|
|
21017
|
+
i += n;
|
|
21018
|
+
}
|
|
21019
|
+
return new _QrSegment(_QrSegment.Mode.NUMERIC, digits.length, bb);
|
|
21020
|
+
}
|
|
21021
|
+
static makeAlphanumeric(text) {
|
|
21022
|
+
if (!_QrSegment.isAlphanumeric(text)) throw new RangeError("String contains unencodable characters in alphanumeric mode");
|
|
21023
|
+
let bb = [];
|
|
21024
|
+
let i;
|
|
21025
|
+
for (i = 0; i + 2 <= text.length; i += 2) {
|
|
21026
|
+
let temp = _QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)) * 45;
|
|
21027
|
+
temp += _QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i + 1));
|
|
21028
|
+
appendBits(temp, 11, bb);
|
|
21029
|
+
}
|
|
21030
|
+
if (i < text.length) appendBits(_QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)), 6, bb);
|
|
21031
|
+
return new _QrSegment(_QrSegment.Mode.ALPHANUMERIC, text.length, bb);
|
|
21032
|
+
}
|
|
21033
|
+
static makeSegments(text) {
|
|
21034
|
+
if (text == "") return [];
|
|
21035
|
+
else if (_QrSegment.isNumeric(text)) return [_QrSegment.makeNumeric(text)];
|
|
21036
|
+
else if (_QrSegment.isAlphanumeric(text)) return [_QrSegment.makeAlphanumeric(text)];
|
|
21037
|
+
else return [_QrSegment.makeBytes(_QrSegment.toUtf8ByteArray(text))];
|
|
21038
|
+
}
|
|
21039
|
+
static makeEci(assignVal) {
|
|
21040
|
+
let bb = [];
|
|
21041
|
+
if (assignVal < 0) throw new RangeError("ECI assignment value out of range");
|
|
21042
|
+
else if (assignVal < 128) appendBits(assignVal, 8, bb);
|
|
21043
|
+
else if (assignVal < 16384) {
|
|
21044
|
+
appendBits(2, 2, bb);
|
|
21045
|
+
appendBits(assignVal, 14, bb);
|
|
21046
|
+
} else if (assignVal < 1e6) {
|
|
21047
|
+
appendBits(6, 3, bb);
|
|
21048
|
+
appendBits(assignVal, 21, bb);
|
|
21049
|
+
} else throw new RangeError("ECI assignment value out of range");
|
|
21050
|
+
return new _QrSegment(_QrSegment.Mode.ECI, 0, bb);
|
|
21051
|
+
}
|
|
21052
|
+
static isNumeric(text) {
|
|
21053
|
+
return _QrSegment.NUMERIC_REGEX.test(text);
|
|
21054
|
+
}
|
|
21055
|
+
static isAlphanumeric(text) {
|
|
21056
|
+
return _QrSegment.ALPHANUMERIC_REGEX.test(text);
|
|
21057
|
+
}
|
|
21058
|
+
getData() {
|
|
21059
|
+
return this.bitData.slice();
|
|
21060
|
+
}
|
|
21061
|
+
static getTotalBits(segs, version) {
|
|
21062
|
+
let result = 0;
|
|
21063
|
+
for (const seg of segs) {
|
|
21064
|
+
const ccbits = seg.mode.numCharCountBits(version);
|
|
21065
|
+
if (seg.numChars >= 1 << ccbits) return Infinity;
|
|
21066
|
+
result += 4 + ccbits + seg.bitData.length;
|
|
21067
|
+
}
|
|
21068
|
+
return result;
|
|
21069
|
+
}
|
|
21070
|
+
static toUtf8ByteArray(str) {
|
|
21071
|
+
str = encodeURI(str);
|
|
21072
|
+
let result = [];
|
|
21073
|
+
for (let i = 0; i < str.length; i++) if (str.charAt(i) != "%") result.push(str.charCodeAt(i));
|
|
21074
|
+
else {
|
|
21075
|
+
result.push(parseInt(str.substring(i + 1, i + 3), 16));
|
|
21076
|
+
i += 2;
|
|
21077
|
+
}
|
|
21078
|
+
return result;
|
|
21079
|
+
}
|
|
21080
|
+
};
|
|
21081
|
+
_QrSegment.NUMERIC_REGEX = /^[0-9]*$/;
|
|
21082
|
+
_QrSegment.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/;
|
|
21083
|
+
_QrSegment.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
21084
|
+
let QrSegment = _QrSegment;
|
|
21085
|
+
qrcodegen2.QrSegment = _QrSegment;
|
|
21086
|
+
})(qrcodegen || (qrcodegen = {}));
|
|
21087
|
+
((qrcodegen2) => {
|
|
21088
|
+
((QrCode2) => {
|
|
21089
|
+
const _Ecc = class _Ecc {
|
|
21090
|
+
constructor(ordinal, formatBits) {
|
|
21091
|
+
this.ordinal = ordinal;
|
|
21092
|
+
this.formatBits = formatBits;
|
|
21093
|
+
}
|
|
21094
|
+
};
|
|
21095
|
+
_Ecc.LOW = new _Ecc(0, 1);
|
|
21096
|
+
_Ecc.MEDIUM = new _Ecc(1, 0);
|
|
21097
|
+
_Ecc.QUARTILE = new _Ecc(2, 3);
|
|
21098
|
+
_Ecc.HIGH = new _Ecc(3, 2);
|
|
21099
|
+
QrCode2.Ecc = _Ecc;
|
|
21100
|
+
})(qrcodegen2.QrCode || (qrcodegen2.QrCode = {}));
|
|
21101
|
+
})(qrcodegen || (qrcodegen = {}));
|
|
21102
|
+
((qrcodegen2) => {
|
|
21103
|
+
((QrSegment2) => {
|
|
21104
|
+
const _Mode = class _Mode {
|
|
21105
|
+
constructor(modeBits, numBitsCharCount) {
|
|
21106
|
+
this.modeBits = modeBits;
|
|
21107
|
+
this.numBitsCharCount = numBitsCharCount;
|
|
21108
|
+
}
|
|
21109
|
+
numCharCountBits(ver) {
|
|
21110
|
+
return this.numBitsCharCount[Math.floor((ver + 7) / 17)];
|
|
21111
|
+
}
|
|
21112
|
+
};
|
|
21113
|
+
_Mode.NUMERIC = new _Mode(1, [
|
|
21114
|
+
10,
|
|
21115
|
+
12,
|
|
21116
|
+
14
|
|
21117
|
+
]);
|
|
21118
|
+
_Mode.ALPHANUMERIC = new _Mode(2, [
|
|
21119
|
+
9,
|
|
21120
|
+
11,
|
|
21121
|
+
13
|
|
21122
|
+
]);
|
|
21123
|
+
_Mode.BYTE = new _Mode(4, [
|
|
21124
|
+
8,
|
|
21125
|
+
16,
|
|
21126
|
+
16
|
|
21127
|
+
]);
|
|
21128
|
+
_Mode.KANJI = new _Mode(8, [
|
|
21129
|
+
8,
|
|
21130
|
+
10,
|
|
21131
|
+
12
|
|
21132
|
+
]);
|
|
21133
|
+
_Mode.ECI = new _Mode(7, [
|
|
21134
|
+
0,
|
|
21135
|
+
0,
|
|
21136
|
+
0
|
|
21137
|
+
]);
|
|
21138
|
+
QrSegment2.Mode = _Mode;
|
|
21139
|
+
})(qrcodegen2.QrSegment || (qrcodegen2.QrSegment = {}));
|
|
21140
|
+
})(qrcodegen || (qrcodegen = {}));
|
|
21141
|
+
var qrcodegen_default = qrcodegen;
|
|
21142
|
+
/**
|
|
21143
|
+
* @license qrcode.react
|
|
21144
|
+
* Copyright (c) Paul O'Shannessy
|
|
21145
|
+
* SPDX-License-Identifier: ISC
|
|
21146
|
+
*/
|
|
21147
|
+
var ERROR_LEVEL_MAP = {
|
|
21148
|
+
L: qrcodegen_default.QrCode.Ecc.LOW,
|
|
21149
|
+
M: qrcodegen_default.QrCode.Ecc.MEDIUM,
|
|
21150
|
+
Q: qrcodegen_default.QrCode.Ecc.QUARTILE,
|
|
21151
|
+
H: qrcodegen_default.QrCode.Ecc.HIGH
|
|
21152
|
+
};
|
|
21153
|
+
var DEFAULT_SIZE$1 = 128;
|
|
21154
|
+
var DEFAULT_LEVEL = "L";
|
|
21155
|
+
var DEFAULT_BGCOLOR = "#FFFFFF";
|
|
21156
|
+
var DEFAULT_FGCOLOR = "#000000";
|
|
21157
|
+
var DEFAULT_INCLUDEMARGIN = false;
|
|
21158
|
+
var DEFAULT_MINVERSION = 1;
|
|
21159
|
+
var SPEC_MARGIN_SIZE = 4;
|
|
21160
|
+
var DEFAULT_MARGIN_SIZE = 0;
|
|
21161
|
+
var DEFAULT_IMG_SCALE = .1;
|
|
21162
|
+
function generatePath(modules, margin = 0) {
|
|
21163
|
+
const ops = [];
|
|
21164
|
+
modules.forEach(function(row, y) {
|
|
21165
|
+
let start = null;
|
|
21166
|
+
row.forEach(function(cell, x) {
|
|
21167
|
+
if (!cell && start !== null) {
|
|
21168
|
+
ops.push(`M${start + margin} ${y + margin}h${x - start}v1H${start + margin}z`);
|
|
21169
|
+
start = null;
|
|
21170
|
+
return;
|
|
21171
|
+
}
|
|
21172
|
+
if (x === row.length - 1) {
|
|
21173
|
+
if (!cell) return;
|
|
21174
|
+
if (start === null) ops.push(`M${x + margin},${y + margin} h1v1H${x + margin}z`);
|
|
21175
|
+
else ops.push(`M${start + margin},${y + margin} h${x + 1 - start}v1H${start + margin}z`);
|
|
21176
|
+
return;
|
|
21177
|
+
}
|
|
21178
|
+
if (cell && start === null) start = x;
|
|
21179
|
+
});
|
|
21180
|
+
});
|
|
21181
|
+
return ops.join("");
|
|
21182
|
+
}
|
|
21183
|
+
function excavateModules(modules, excavation) {
|
|
21184
|
+
return modules.slice().map((row, y) => {
|
|
21185
|
+
if (y < excavation.y || y >= excavation.y + excavation.h) return row;
|
|
21186
|
+
return row.map((cell, x) => {
|
|
21187
|
+
if (x < excavation.x || x >= excavation.x + excavation.w) return cell;
|
|
21188
|
+
return false;
|
|
21189
|
+
});
|
|
21190
|
+
});
|
|
21191
|
+
}
|
|
21192
|
+
function getImageSettings(cells, size, margin, imageSettings) {
|
|
21193
|
+
if (imageSettings == null) return null;
|
|
21194
|
+
const numCells = cells.length + margin * 2;
|
|
21195
|
+
const defaultSize = Math.floor(size * DEFAULT_IMG_SCALE);
|
|
21196
|
+
const scale = numCells / size;
|
|
21197
|
+
const w = (imageSettings.width || defaultSize) * scale;
|
|
21198
|
+
const h = (imageSettings.height || defaultSize) * scale;
|
|
21199
|
+
const x = imageSettings.x == null ? cells.length / 2 - w / 2 : imageSettings.x * scale;
|
|
21200
|
+
const y = imageSettings.y == null ? cells.length / 2 - h / 2 : imageSettings.y * scale;
|
|
21201
|
+
const opacity = imageSettings.opacity == null ? 1 : imageSettings.opacity;
|
|
21202
|
+
let excavation = null;
|
|
21203
|
+
if (imageSettings.excavate) {
|
|
21204
|
+
let floorX = Math.floor(x);
|
|
21205
|
+
let floorY = Math.floor(y);
|
|
21206
|
+
excavation = {
|
|
21207
|
+
x: floorX,
|
|
21208
|
+
y: floorY,
|
|
21209
|
+
w: Math.ceil(w + x - floorX),
|
|
21210
|
+
h: Math.ceil(h + y - floorY)
|
|
21211
|
+
};
|
|
21212
|
+
}
|
|
21213
|
+
const crossOrigin = imageSettings.crossOrigin;
|
|
21214
|
+
return {
|
|
21215
|
+
x,
|
|
21216
|
+
y,
|
|
21217
|
+
h,
|
|
21218
|
+
w,
|
|
21219
|
+
excavation,
|
|
21220
|
+
opacity,
|
|
21221
|
+
crossOrigin
|
|
21222
|
+
};
|
|
21223
|
+
}
|
|
21224
|
+
function getMarginSize(includeMargin, marginSize) {
|
|
21225
|
+
if (marginSize != null) return Math.max(Math.floor(marginSize), 0);
|
|
21226
|
+
return includeMargin ? SPEC_MARGIN_SIZE : DEFAULT_MARGIN_SIZE;
|
|
21227
|
+
}
|
|
21228
|
+
function useQRCode({ value, level, minVersion, includeMargin, marginSize, imageSettings, size, boostLevel }) {
|
|
21229
|
+
let qrcode = React.useMemo(() => {
|
|
21230
|
+
const segments = (Array.isArray(value) ? value : [value]).reduce((accum, v) => {
|
|
21231
|
+
accum.push(...qrcodegen_default.QrSegment.makeSegments(v));
|
|
21232
|
+
return accum;
|
|
21233
|
+
}, []);
|
|
21234
|
+
return qrcodegen_default.QrCode.encodeSegments(segments, ERROR_LEVEL_MAP[level], minVersion, void 0, void 0, boostLevel);
|
|
21235
|
+
}, [
|
|
21236
|
+
value,
|
|
21237
|
+
level,
|
|
21238
|
+
minVersion,
|
|
21239
|
+
boostLevel
|
|
21240
|
+
]);
|
|
21241
|
+
const { cells, margin, numCells, calculatedImageSettings } = React.useMemo(() => {
|
|
21242
|
+
let cells2 = qrcode.getModules();
|
|
21243
|
+
const margin2 = getMarginSize(includeMargin, marginSize);
|
|
21244
|
+
return {
|
|
21245
|
+
cells: cells2,
|
|
21246
|
+
margin: margin2,
|
|
21247
|
+
numCells: cells2.length + margin2 * 2,
|
|
21248
|
+
calculatedImageSettings: getImageSettings(cells2, size, margin2, imageSettings)
|
|
21249
|
+
};
|
|
21250
|
+
}, [
|
|
21251
|
+
qrcode,
|
|
21252
|
+
size,
|
|
21253
|
+
imageSettings,
|
|
21254
|
+
includeMargin,
|
|
21255
|
+
marginSize
|
|
21256
|
+
]);
|
|
21257
|
+
return {
|
|
21258
|
+
qrcode,
|
|
21259
|
+
margin,
|
|
21260
|
+
cells,
|
|
21261
|
+
numCells,
|
|
21262
|
+
calculatedImageSettings
|
|
21263
|
+
};
|
|
21264
|
+
}
|
|
21265
|
+
var SUPPORTS_PATH2D = function() {
|
|
21266
|
+
try {
|
|
21267
|
+
new Path2D().addPath(new Path2D());
|
|
21268
|
+
} catch (e) {
|
|
21269
|
+
return false;
|
|
21270
|
+
}
|
|
21271
|
+
return true;
|
|
21272
|
+
}();
|
|
21273
|
+
var QRCodeCanvas = React.forwardRef(function QRCodeCanvas2(props, forwardedRef) {
|
|
21274
|
+
const _a = props, { value, size = DEFAULT_SIZE$1, level = DEFAULT_LEVEL, bgColor = DEFAULT_BGCOLOR, fgColor = DEFAULT_FGCOLOR, includeMargin = DEFAULT_INCLUDEMARGIN, minVersion = DEFAULT_MINVERSION, boostLevel, marginSize, imageSettings } = _a;
|
|
21275
|
+
const _b = __objRest(_a, [
|
|
21276
|
+
"value",
|
|
21277
|
+
"size",
|
|
21278
|
+
"level",
|
|
21279
|
+
"bgColor",
|
|
21280
|
+
"fgColor",
|
|
21281
|
+
"includeMargin",
|
|
21282
|
+
"minVersion",
|
|
21283
|
+
"boostLevel",
|
|
21284
|
+
"marginSize",
|
|
21285
|
+
"imageSettings"
|
|
21286
|
+
]), { style } = _b, otherProps = __objRest(_b, ["style"]);
|
|
21287
|
+
const imgSrc = imageSettings == null ? void 0 : imageSettings.src;
|
|
21288
|
+
const _canvas = React.useRef(null);
|
|
21289
|
+
const _image = React.useRef(null);
|
|
21290
|
+
const setCanvasRef = React.useCallback((node) => {
|
|
21291
|
+
_canvas.current = node;
|
|
21292
|
+
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
21293
|
+
else if (forwardedRef) forwardedRef.current = node;
|
|
21294
|
+
}, [forwardedRef]);
|
|
21295
|
+
const [isImgLoaded, setIsImageLoaded] = React.useState(false);
|
|
21296
|
+
const { margin, cells, numCells, calculatedImageSettings } = useQRCode({
|
|
21297
|
+
value,
|
|
21298
|
+
level,
|
|
21299
|
+
minVersion,
|
|
21300
|
+
boostLevel,
|
|
21301
|
+
includeMargin,
|
|
21302
|
+
marginSize,
|
|
21303
|
+
imageSettings,
|
|
21304
|
+
size
|
|
21305
|
+
});
|
|
21306
|
+
React.useEffect(() => {
|
|
21307
|
+
if (_canvas.current != null) {
|
|
21308
|
+
const canvas = _canvas.current;
|
|
21309
|
+
const ctx = canvas.getContext("2d");
|
|
21310
|
+
if (!ctx) return;
|
|
21311
|
+
let cellsToDraw = cells;
|
|
21312
|
+
const image = _image.current;
|
|
21313
|
+
const haveImageToRender = calculatedImageSettings != null && image !== null && image.complete && image.naturalHeight !== 0 && image.naturalWidth !== 0;
|
|
21314
|
+
if (haveImageToRender) {
|
|
21315
|
+
if (calculatedImageSettings.excavation != null) cellsToDraw = excavateModules(cells, calculatedImageSettings.excavation);
|
|
21316
|
+
}
|
|
21317
|
+
const pixelRatio = window.devicePixelRatio || 1;
|
|
21318
|
+
canvas.height = canvas.width = size * pixelRatio;
|
|
21319
|
+
const scale = size / numCells * pixelRatio;
|
|
21320
|
+
ctx.scale(scale, scale);
|
|
21321
|
+
ctx.fillStyle = bgColor;
|
|
21322
|
+
ctx.fillRect(0, 0, numCells, numCells);
|
|
21323
|
+
ctx.fillStyle = fgColor;
|
|
21324
|
+
if (SUPPORTS_PATH2D) ctx.fill(new Path2D(generatePath(cellsToDraw, margin)));
|
|
21325
|
+
else cells.forEach(function(row, rdx) {
|
|
21326
|
+
row.forEach(function(cell, cdx) {
|
|
21327
|
+
if (cell) ctx.fillRect(cdx + margin, rdx + margin, 1, 1);
|
|
21328
|
+
});
|
|
21329
|
+
});
|
|
21330
|
+
if (calculatedImageSettings) ctx.globalAlpha = calculatedImageSettings.opacity;
|
|
21331
|
+
if (haveImageToRender) ctx.drawImage(image, calculatedImageSettings.x + margin, calculatedImageSettings.y + margin, calculatedImageSettings.w, calculatedImageSettings.h);
|
|
21332
|
+
}
|
|
21333
|
+
});
|
|
21334
|
+
React.useEffect(() => {
|
|
21335
|
+
setIsImageLoaded(false);
|
|
21336
|
+
}, [imgSrc]);
|
|
21337
|
+
const canvasStyle = __spreadValues({
|
|
21338
|
+
height: size,
|
|
21339
|
+
width: size
|
|
21340
|
+
}, style);
|
|
21341
|
+
let img = null;
|
|
21342
|
+
if (imgSrc != null) img = /* @__PURE__ */ React.createElement("img", {
|
|
21343
|
+
src: imgSrc,
|
|
21344
|
+
key: imgSrc,
|
|
21345
|
+
style: { display: "none" },
|
|
21346
|
+
onLoad: () => {
|
|
21347
|
+
setIsImageLoaded(true);
|
|
21348
|
+
},
|
|
21349
|
+
ref: _image,
|
|
21350
|
+
crossOrigin: calculatedImageSettings == null ? void 0 : calculatedImageSettings.crossOrigin
|
|
21351
|
+
});
|
|
21352
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("canvas", __spreadValues({
|
|
21353
|
+
style: canvasStyle,
|
|
21354
|
+
height: size,
|
|
21355
|
+
width: size,
|
|
21356
|
+
ref: setCanvasRef,
|
|
21357
|
+
role: "img"
|
|
21358
|
+
}, otherProps)), img);
|
|
21359
|
+
});
|
|
21360
|
+
QRCodeCanvas.displayName = "QRCodeCanvas";
|
|
21361
|
+
var QRCodeSVG = React.forwardRef(function QRCodeSVG2(props, forwardedRef) {
|
|
21362
|
+
const _a = props, { value, size = DEFAULT_SIZE$1, level = DEFAULT_LEVEL, bgColor = DEFAULT_BGCOLOR, fgColor = DEFAULT_FGCOLOR, includeMargin = DEFAULT_INCLUDEMARGIN, minVersion = DEFAULT_MINVERSION, boostLevel, title, marginSize, imageSettings } = _a, otherProps = __objRest(_a, [
|
|
21363
|
+
"value",
|
|
21364
|
+
"size",
|
|
21365
|
+
"level",
|
|
21366
|
+
"bgColor",
|
|
21367
|
+
"fgColor",
|
|
21368
|
+
"includeMargin",
|
|
21369
|
+
"minVersion",
|
|
21370
|
+
"boostLevel",
|
|
21371
|
+
"title",
|
|
21372
|
+
"marginSize",
|
|
21373
|
+
"imageSettings"
|
|
21374
|
+
]);
|
|
21375
|
+
const { margin, cells, numCells, calculatedImageSettings } = useQRCode({
|
|
21376
|
+
value,
|
|
21377
|
+
level,
|
|
21378
|
+
minVersion,
|
|
21379
|
+
boostLevel,
|
|
21380
|
+
includeMargin,
|
|
21381
|
+
marginSize,
|
|
21382
|
+
imageSettings,
|
|
21383
|
+
size
|
|
21384
|
+
});
|
|
21385
|
+
let cellsToDraw = cells;
|
|
21386
|
+
let image = null;
|
|
21387
|
+
if (imageSettings != null && calculatedImageSettings != null) {
|
|
21388
|
+
if (calculatedImageSettings.excavation != null) cellsToDraw = excavateModules(cells, calculatedImageSettings.excavation);
|
|
21389
|
+
image = /* @__PURE__ */ React.createElement("image", {
|
|
21390
|
+
href: imageSettings.src,
|
|
21391
|
+
height: calculatedImageSettings.h,
|
|
21392
|
+
width: calculatedImageSettings.w,
|
|
21393
|
+
x: calculatedImageSettings.x + margin,
|
|
21394
|
+
y: calculatedImageSettings.y + margin,
|
|
21395
|
+
preserveAspectRatio: "none",
|
|
21396
|
+
opacity: calculatedImageSettings.opacity,
|
|
21397
|
+
crossOrigin: calculatedImageSettings.crossOrigin
|
|
21398
|
+
});
|
|
21399
|
+
}
|
|
21400
|
+
const fgPath = generatePath(cellsToDraw, margin);
|
|
21401
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({
|
|
21402
|
+
height: size,
|
|
21403
|
+
width: size,
|
|
21404
|
+
viewBox: `0 0 ${numCells} ${numCells}`,
|
|
21405
|
+
ref: forwardedRef,
|
|
21406
|
+
role: "img"
|
|
21407
|
+
}, otherProps), !!title && /* @__PURE__ */ React.createElement("title", null, title), /* @__PURE__ */ React.createElement("path", {
|
|
21408
|
+
fill: bgColor,
|
|
21409
|
+
d: `M0,0 h${numCells}v${numCells}H0z`,
|
|
21410
|
+
shapeRendering: "crispEdges"
|
|
21411
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
21412
|
+
fill: fgColor,
|
|
21413
|
+
d: fgPath,
|
|
21414
|
+
shapeRendering: "crispEdges"
|
|
21415
|
+
}), image);
|
|
21416
|
+
});
|
|
21417
|
+
QRCodeSVG.displayName = "QRCodeSVG";
|
|
21418
|
+
//#endregion
|
|
21419
|
+
//#region src/composites/qr-code.tsx
|
|
21420
|
+
var DEFAULT_SIZE = 192;
|
|
21421
|
+
function QrCode({ value, size = DEFAULT_SIZE, className, alt }) {
|
|
21422
|
+
const trimmed = value.trim();
|
|
21423
|
+
if (trimmed.length === 0) return null;
|
|
21424
|
+
return /* @__PURE__ */ jsx("div", {
|
|
21425
|
+
className: cn("inline-flex rounded-md bg-white p-2", className),
|
|
21426
|
+
children: /* @__PURE__ */ jsx(QRCodeSVG, {
|
|
21427
|
+
value: trimmed,
|
|
21428
|
+
size,
|
|
21429
|
+
marginSize: 1,
|
|
21430
|
+
title: alt ?? "QR code"
|
|
21431
|
+
})
|
|
21432
|
+
});
|
|
21433
|
+
}
|
|
21434
|
+
//#endregion
|
|
21435
|
+
//#region src/composites/copy-button.tsx
|
|
21436
|
+
/**
|
|
21437
|
+
* `CopyButton` — a compact button that copies a string `value` to the
|
|
21438
|
+
* clipboard via `navigator.clipboard.writeText`, showing a brief
|
|
21439
|
+
* "copied" check state. Addon-agnostic; used wherever a secret / URL
|
|
21440
|
+
* needs a one-click copy affordance (export setup panels, etc.).
|
|
21441
|
+
*/
|
|
21442
|
+
var COPIED_RESET_MS = 2e3;
|
|
21443
|
+
function CopyButton({ value, label, className, disabled }) {
|
|
21444
|
+
const [copied, setCopied] = useState(false);
|
|
21445
|
+
const handleCopy = useCallback(() => {
|
|
21446
|
+
if (!value) return;
|
|
21447
|
+
navigator.clipboard.writeText(value).then(() => {
|
|
21448
|
+
setCopied(true);
|
|
21449
|
+
setTimeout(() => setCopied(false), COPIED_RESET_MS);
|
|
21450
|
+
});
|
|
21451
|
+
}, [value]);
|
|
21452
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
21453
|
+
size: "sm",
|
|
21454
|
+
variant: "ghost",
|
|
21455
|
+
type: "button",
|
|
21456
|
+
disabled: disabled || value.length === 0,
|
|
21457
|
+
onClick: handleCopy,
|
|
21458
|
+
className: cn(className),
|
|
21459
|
+
"aria-label": copied ? "Copied" : `Copy ${label ?? "value"}`,
|
|
21460
|
+
children: [copied ? /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5 text-success" }) : /* @__PURE__ */ jsx(Copy, { className: "h-3.5 w-3.5" }), label ? /* @__PURE__ */ jsx("span", {
|
|
21461
|
+
className: "ml-1",
|
|
21462
|
+
children: copied ? "Copied" : label
|
|
21463
|
+
}) : null]
|
|
21464
|
+
});
|
|
21465
|
+
}
|
|
21466
|
+
//#endregion
|
|
21467
|
+
//#region src/composites/device-export-panel.tsx
|
|
21468
|
+
/**
|
|
21469
|
+
* DeviceExportPanel — generic, addon-agnostic surface for the
|
|
21470
|
+
* `device-export` capability.
|
|
21471
|
+
*
|
|
21472
|
+
* Renders the COMMON device-export surface for a single export addon
|
|
21473
|
+
* (HomeAssistant via MQTT, HomeKit/HAP, Alexa Smart Home, …):
|
|
21474
|
+
*
|
|
21475
|
+
* - a link-state status badge + exposed-device count from `getStatus`,
|
|
21476
|
+
* - the exposed-devices table from `listExposedDevices` (device name,
|
|
21477
|
+
* status, stream preference) with a per-row unexpose action
|
|
21478
|
+
* (`unexposeDevice`),
|
|
21479
|
+
* - an empty state directing the operator to the device-details page.
|
|
21480
|
+
*
|
|
21481
|
+
* This composite is the reusable replacement for the per-addon
|
|
21482
|
+
* Module-Federation overview tables that each export addon used to
|
|
21483
|
+
* ship. It is driven entirely by the `device-export` cap — there are no
|
|
21484
|
+
* Alexa / HAP / MQTT specifics here. Mount it next to an export addon's
|
|
21485
|
+
* standard settings form (e.g. in the addon-settings modal).
|
|
21486
|
+
*
|
|
21487
|
+
* Routing note: `device-export` is a collection cap; the codegen'd
|
|
21488
|
+
* router resolves `{ nodeId }` to the first registered provider. Export
|
|
21489
|
+
* addons are all `hub-only`, so the panel queries `nodeId: 'hub'`. When
|
|
21490
|
+
* multiple device-export addons are co-installed the cap-router today
|
|
21491
|
+
* resolves to the first provider only (per-provider routing is a
|
|
21492
|
+
* separate follow-up) — identical behaviour to the pages it replaces.
|
|
21493
|
+
*/
|
|
21494
|
+
var ExposedDeviceArraySchema = z.array(ExposedDeviceSchema);
|
|
21495
|
+
var STATUS_POLL_INTERVAL_MS = 1e4;
|
|
21496
|
+
function statusVariant(state) {
|
|
21497
|
+
if (state === "linked") return "success";
|
|
21498
|
+
if (state === "error") return "danger";
|
|
21499
|
+
return "warning";
|
|
21500
|
+
}
|
|
21501
|
+
function capitaliseLinkState(state) {
|
|
21502
|
+
if (state === "linked") return "Linked";
|
|
21503
|
+
if (state === "unlinked") return "Unlinked";
|
|
21504
|
+
if (state === "error") return "Error";
|
|
21505
|
+
return state;
|
|
21506
|
+
}
|
|
21507
|
+
/**
|
|
21508
|
+
* A single label/value row in the Setup section. `secret` rows mask the
|
|
21509
|
+
* value behind a reveal toggle; every row gets a copy button.
|
|
21510
|
+
*/
|
|
21511
|
+
function SetupFieldRow({ field }) {
|
|
21512
|
+
const [revealed, setRevealed] = useState(false);
|
|
21513
|
+
const isSecret = field.secret === true;
|
|
21514
|
+
const displayValue = isSecret && !revealed ? "•".repeat(Math.min(field.value.length, 24)) : field.value;
|
|
21515
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
21516
|
+
className: "flex items-center gap-2 py-1.5",
|
|
21517
|
+
children: [
|
|
21518
|
+
/* @__PURE__ */ jsx("span", {
|
|
21519
|
+
className: "text-[11px] text-foreground-subtle w-32 shrink-0",
|
|
21520
|
+
children: field.label
|
|
21521
|
+
}),
|
|
21522
|
+
/* @__PURE__ */ jsx("span", {
|
|
21523
|
+
className: "flex-1 min-w-0 truncate font-mono text-xs text-foreground",
|
|
21524
|
+
children: displayValue || "—"
|
|
21525
|
+
}),
|
|
21526
|
+
isSecret && /* @__PURE__ */ jsx(Button, {
|
|
21527
|
+
size: "sm",
|
|
21528
|
+
variant: "ghost",
|
|
21529
|
+
type: "button",
|
|
21530
|
+
"aria-label": revealed ? "Hide value" : "Reveal value",
|
|
21531
|
+
onClick: () => setRevealed((v) => !v),
|
|
21532
|
+
children: revealed ? /* @__PURE__ */ jsx(EyeOff, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(Eye, { className: "h-3.5 w-3.5" })
|
|
21533
|
+
}),
|
|
21534
|
+
/* @__PURE__ */ jsx(CopyButton, {
|
|
21535
|
+
value: field.value,
|
|
21536
|
+
label: field.label
|
|
21537
|
+
})
|
|
21538
|
+
]
|
|
21539
|
+
});
|
|
21540
|
+
}
|
|
21541
|
+
/**
|
|
21542
|
+
* Generic "Setup" section — pairing QR + copyable label/value rows +
|
|
21543
|
+
* operator note. Driven entirely by the cap's `setup` block; renders
|
|
21544
|
+
* nothing addon-specific.
|
|
21545
|
+
*/
|
|
21546
|
+
function SetupSection({ setup }) {
|
|
21547
|
+
const fields = setup.fields ?? [];
|
|
21548
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
21549
|
+
className: "border-b border-border bg-surface-hover/10",
|
|
21550
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
21551
|
+
className: "flex items-center gap-2 px-4 py-2 border-b border-border",
|
|
21552
|
+
children: [/* @__PURE__ */ jsx(QrCode$1, { className: "h-3.5 w-3.5 text-foreground-subtle shrink-0" }), /* @__PURE__ */ jsx("span", {
|
|
21553
|
+
className: "text-[11px] font-semibold text-foreground-subtle uppercase tracking-wide",
|
|
21554
|
+
children: "Setup"
|
|
21555
|
+
})]
|
|
21556
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
21557
|
+
className: "flex flex-col gap-3 p-4 sm:flex-row sm:items-start",
|
|
21558
|
+
children: [setup.qr && /* @__PURE__ */ jsx("div", {
|
|
21559
|
+
className: "shrink-0",
|
|
21560
|
+
children: /* @__PURE__ */ jsx(QrCode, {
|
|
21561
|
+
value: setup.qr,
|
|
21562
|
+
alt: "Pairing QR code"
|
|
21563
|
+
})
|
|
21564
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
21565
|
+
className: "flex-1 min-w-0",
|
|
21566
|
+
children: [setup.note && /* @__PURE__ */ jsx("p", {
|
|
21567
|
+
className: "text-xs text-foreground-muted whitespace-pre-line mb-2",
|
|
21568
|
+
children: setup.note
|
|
21569
|
+
}), fields.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
21570
|
+
className: "divide-y divide-border-subtle",
|
|
21571
|
+
children: fields.map((field) => /* @__PURE__ */ jsx(SetupFieldRow, { field }, field.label))
|
|
21572
|
+
})]
|
|
21573
|
+
})]
|
|
21574
|
+
})]
|
|
21575
|
+
});
|
|
21576
|
+
}
|
|
21577
|
+
/**
|
|
21578
|
+
* Generic device-export panel. Addon-agnostic — only the `device-export`
|
|
21579
|
+
* cap drives it.
|
|
21580
|
+
*/
|
|
21581
|
+
function DeviceExportPanel({ addonId, onOpenDevice }) {
|
|
21582
|
+
const queryClient = useQueryClient();
|
|
21583
|
+
const statusQuery = useDeviceExportGetStatus({ nodeId: "hub" }, {
|
|
21584
|
+
refetchInterval: STATUS_POLL_INTERVAL_MS,
|
|
21585
|
+
retry: false
|
|
21586
|
+
});
|
|
21587
|
+
const exposedQuery = useDeviceExportListExposedDevices({ nodeId: "hub" }, {
|
|
21588
|
+
refetchInterval: STATUS_POLL_INTERVAL_MS,
|
|
21589
|
+
retry: false
|
|
21590
|
+
});
|
|
21591
|
+
const unexposeMutation = useDeviceExportUnexposeDevice({ onSuccess: () => {
|
|
21592
|
+
queryClient.invalidateQueries({ queryKey: [["deviceExport"]] });
|
|
21593
|
+
} });
|
|
21594
|
+
const status = useMemo(() => {
|
|
21595
|
+
const parsed = DeviceExportStatusSchema.safeParse(statusQuery.data);
|
|
21596
|
+
return parsed.success ? parsed.data : null;
|
|
21597
|
+
}, [statusQuery.data]);
|
|
21598
|
+
const exposed = useMemo(() => {
|
|
21599
|
+
const parsed = ExposedDeviceArraySchema.safeParse(exposedQuery.data);
|
|
21600
|
+
return parsed.success ? parsed.data : [];
|
|
21601
|
+
}, [exposedQuery.data]);
|
|
21602
|
+
const linkState = status?.linkState ?? "unlinked";
|
|
21603
|
+
const rows = useMemo(() => exposed.map((entry) => ({
|
|
21604
|
+
deviceId: entry.deviceId,
|
|
21605
|
+
displayName: entry.exposedAs ?? `Device ${entry.deviceId}`,
|
|
21606
|
+
streamPreference: "auto",
|
|
21607
|
+
linkState
|
|
21608
|
+
})), [exposed, linkState]);
|
|
21609
|
+
const loading = statusQuery.isLoading || exposedQuery.isLoading;
|
|
21610
|
+
const exposedCount = status?.exposedDeviceCount ?? rows.length;
|
|
21611
|
+
const columns = useMemo(() => [
|
|
21612
|
+
{
|
|
21613
|
+
key: "device",
|
|
21614
|
+
header: "Device",
|
|
21615
|
+
render: (row) => /* @__PURE__ */ jsxs("div", {
|
|
21616
|
+
className: "flex flex-col",
|
|
21617
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
21618
|
+
className: "text-foreground font-medium",
|
|
21619
|
+
children: row.displayName
|
|
21620
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
21621
|
+
className: "text-foreground-subtle text-xs font-mono",
|
|
21622
|
+
children: ["#", row.deviceId]
|
|
21623
|
+
})]
|
|
21624
|
+
})
|
|
21625
|
+
},
|
|
21626
|
+
{
|
|
21627
|
+
key: "status",
|
|
21628
|
+
header: "Status",
|
|
21629
|
+
render: (row) => /* @__PURE__ */ jsx(Badge, {
|
|
21630
|
+
variant: statusVariant(row.linkState),
|
|
21631
|
+
children: capitaliseLinkState(row.linkState)
|
|
21632
|
+
})
|
|
21633
|
+
},
|
|
21634
|
+
{
|
|
21635
|
+
key: "stream",
|
|
21636
|
+
header: "Stream",
|
|
21637
|
+
render: (row) => /* @__PURE__ */ jsx("span", {
|
|
21638
|
+
className: "text-xs text-foreground-subtle font-mono",
|
|
21639
|
+
children: row.streamPreference === "auto" ? "Auto" : row.streamPreference
|
|
21640
|
+
})
|
|
21641
|
+
},
|
|
21642
|
+
{
|
|
21643
|
+
key: "actions",
|
|
21644
|
+
header: "",
|
|
21645
|
+
align: "right",
|
|
21646
|
+
render: (row) => /* @__PURE__ */ jsxs("div", {
|
|
21647
|
+
className: "flex items-center justify-end gap-2",
|
|
21648
|
+
children: [onOpenDevice && /* @__PURE__ */ jsxs(Button, {
|
|
21649
|
+
size: "sm",
|
|
21650
|
+
variant: "ghost",
|
|
21651
|
+
onClick: () => onOpenDevice(row.deviceId),
|
|
21652
|
+
children: [/* @__PURE__ */ jsx(ExternalLink, { className: "h-3.5 w-3.5 mr-1" }), "Open"]
|
|
21653
|
+
}), /* @__PURE__ */ jsxs(Button, {
|
|
21654
|
+
size: "sm",
|
|
21655
|
+
variant: "ghost",
|
|
21656
|
+
disabled: unexposeMutation.isPending,
|
|
21657
|
+
onClick: () => unexposeMutation.mutate({
|
|
21658
|
+
deviceId: row.deviceId,
|
|
21659
|
+
nodeId: "hub"
|
|
21660
|
+
}),
|
|
21661
|
+
children: [/* @__PURE__ */ jsx(Unlink2, { className: "h-3.5 w-3.5 mr-1" }), "Unexpose"]
|
|
21662
|
+
})]
|
|
21663
|
+
})
|
|
21664
|
+
}
|
|
21665
|
+
], [onOpenDevice, unexposeMutation]);
|
|
21666
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
21667
|
+
className: "rounded-lg border border-border bg-surface overflow-hidden",
|
|
21668
|
+
children: [
|
|
21669
|
+
/* @__PURE__ */ jsxs("div", {
|
|
21670
|
+
className: "flex items-center justify-between gap-3 px-4 py-2.5 border-b border-border bg-surface-hover/20",
|
|
21671
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
21672
|
+
className: "flex items-center gap-2 min-w-0",
|
|
21673
|
+
children: [
|
|
21674
|
+
/* @__PURE__ */ jsx(Share2, { className: "h-3.5 w-3.5 text-foreground-subtle shrink-0" }),
|
|
21675
|
+
/* @__PURE__ */ jsx("span", {
|
|
21676
|
+
className: "text-[11px] font-semibold text-foreground-subtle uppercase tracking-wide",
|
|
21677
|
+
children: "Exported devices"
|
|
21678
|
+
}),
|
|
21679
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
21680
|
+
variant: statusVariant(linkState),
|
|
21681
|
+
children: capitaliseLinkState(linkState)
|
|
21682
|
+
}),
|
|
21683
|
+
/* @__PURE__ */ jsxs("span", {
|
|
21684
|
+
className: "text-[11px] text-foreground-subtle",
|
|
21685
|
+
children: [exposedCount, " exposed"]
|
|
21686
|
+
})
|
|
21687
|
+
]
|
|
21688
|
+
}), loading && /* @__PURE__ */ jsx(LoaderCircle, { className: "h-3.5 w-3.5 animate-spin text-foreground-subtle" })]
|
|
21689
|
+
}),
|
|
21690
|
+
status?.error && /* @__PURE__ */ jsx("div", {
|
|
21691
|
+
className: "px-4 py-3 border-b border-border",
|
|
21692
|
+
children: /* @__PURE__ */ jsx(ErrorBox, { message: status.error })
|
|
21693
|
+
}),
|
|
21694
|
+
status?.setup && /* @__PURE__ */ jsx(SetupSection, { setup: status.setup }),
|
|
21695
|
+
rows.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
|
|
21696
|
+
icon: Share2,
|
|
21697
|
+
title: "No devices exposed",
|
|
21698
|
+
description: `Expose a camera to "${addonId}" from its device-details page to surface it in the connected ecosystem.`
|
|
21699
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
21700
|
+
className: "p-3",
|
|
21701
|
+
children: /* @__PURE__ */ jsx(DataTable, {
|
|
21702
|
+
columns,
|
|
21703
|
+
rows,
|
|
21704
|
+
rowKey: (row) => row.deviceId
|
|
21705
|
+
})
|
|
21706
|
+
})
|
|
21707
|
+
]
|
|
21708
|
+
});
|
|
21709
|
+
}
|
|
21710
|
+
//#endregion
|
|
20080
21711
|
//#region src/composites/audio-waveform.tsx
|
|
20081
21712
|
/**
|
|
20082
21713
|
* Canvas-based audio waveform visualization.
|
|
@@ -24224,6 +25855,6 @@ function useEventInvalidation(queryKey, categories) {
|
|
|
24224
25855
|
]);
|
|
24225
25856
|
}
|
|
24226
25857
|
//#endregion
|
|
24227
|
-
export { AddonGlobalSettingsForm, AgentStepEditor, AppShell, AudioClassificationList, AudioLevelWaveform, AudioWaveform, BTN_COMPACT, BTN_COMPACT_DANGER, BTN_COMPACT_PRIMARY, BTN_COMPACT_WARNING, Badge, BatteryBadge, BottomSheet, Breadcrumb, Button, CHIP_ACTIVE, CHIP_BASE, CHIP_INACTIVE, CLASS_COLORS, CameraStreamPlayer, Card, Checkbox, CodeBlock, CollapsibleCard, ConfigFormBuilder, FormField as ConfigFormField, ConfigSchemaField, ConfirmActionButton, ConfirmDialogProvider, CustomFieldRenderersProvider, DEFAULT_COLOR, DataTable, DetectionCanvas, DetectionOverlay, DetectionResultTree, DevShell, DeviceActivityPanel, DeviceCard, DeviceContextProvider, DeviceGrid, DeviceItem, DeviceList, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DiscoveryPanel, DoorbellRecentPanel, Dropdown, DropdownContent, DropdownItem, DropdownTrigger, EmptyState, EventStream, FilterBar, FloatingEventStream, FloatingLogStream, FloatingPanel, FormField$1 as FormField, GRID_GAP, GRID_PAIRED, GRID_QUICK_STATS, INPUT_COMPACT, IconButton, ImageSelector, InferenceConfigSelector, Input, KebabMenu, KeyValueList, LIST_ROW, Label, LogStream, LoginForm, MobileDrawer, NodeMultiSelectField, NodePicker, NodeSelectField, PHASE_CONFIG, PTZOverlay, PageHeader, PhaseIcon, PipelineBuilder, PipelineRuntimeSelector, PipelineStep, PipelineTreeMatrix, PlayerOverlaysProvider, Popover, PopoverContent, PopoverTrigger, ProviderBadge, ResponseLog, SECTION_BODY, SECTION_CARD, SECTION_HEADER, SPLIT_PANEL_OUTER, SPLIT_PANEL_SIDE, STACK_GAP, ScopePicker, ScrollArea, Select, SemanticBadge, Separator, Sidebar, SidebarItem, Skeleton, SlideOverPanel, SnapshotButton, StatCard, StateValuesStream, StatusBadge, StepTimings, StepTreeMaster, StreamBrokerSelector, StreamPanel, Switch, SystemProvider, TEXT_FIELD_LABEL, TEXT_HINT, TEXT_METRIC, TEXT_SECTION_LABEL, TEXT_VALUE, Tabs, TabsContent, TabsList, TabsTrigger, ThemeProvider, Tooltip, TooltipContent, TooltipTrigger, VersionBadge, WidgetRegistryProvider, WidgetSlot, ZoneEditingProvider, buildStepTreeFromSchema, cn, createSharedContext, createTheme, darkColors, defaultTheme, deriveDeviceKind, ensureMfHostInit, getClassColor, getPhaseVisual, isFieldVisible, lightColors, mirror, mountAddonPage, providerIcons, statusIcons, themeToCss, trpc, useAccessoriesGetStatus, useAddonPagesListPages, useAddonSettingsGetDeviceSettings, useAddonSettingsGetGlobalSettings, useAddonSettingsUpdateDeviceSettings, useAddonSettingsUpdateGlobalSettings, useAddonWidgetsListWidgets, useAddonsApplyAutoUpdateToAll, useAddonsCustom, useAddonsForceRefresh, useAddonsGetAddonAutoUpdate, useAddonsGetAutoUpdateSettings, useAddonsGetLogs, useAddonsGetVersions, useAddonsInstallFromWorkspace, useAddonsInstallPackage, useAddonsIsWorkspaceAvailable, useAddonsList, useAddonsListPackages, useAddonsListUpdates, useAddonsListWorkspacePackages, useAddonsOnAddonLogs, useAddonsReloadPackages, useAddonsRestartAddon, useAddonsRestartServer, useAddonsRetryLoad, useAddonsRollbackPackage, useAddonsSearchAvailable, useAddonsSetAddonAutoUpdate, useAddonsSetAutoUpdateSettings, useAddonsUninstallPackage, useAddonsUpdatePackage, useAlertsDismiss, useAlertsEmit, useAlertsGetUnreadCount, useAlertsList, useAlertsMarkAllRead, useAlertsMarkRead, useAlertsUpdate, useAllWidgets, useAudioAnalysisApplyDeviceSettingsPatch, useAudioAnalysisGetDeviceLiveContribution, useAudioAnalysisGetDeviceSettingsContribution, useAudioAnalysisResolveDeviceSettings, useAudioAnalyzerAnalyseChunk, useAudioAnalyzerClassify, useAudioAnalyzerDispose, useAudioAnalyzerIsReady, useAudioAnalyzerReprobeAudioEngine, useAudioCodecCanHandle, useAudioCodecCloseSession, useAudioCodecCreateDecodeSession, useAudioCodecCreateEncodeSession, useAudioCodecFlushEncode, useAudioCodecListActiveSessions, useAudioCodecListSupportedCodecs, useAudioCodecPullEncoded, useAudioCodecPullPcm, useAudioCodecPushEncodedFrame, useAudioCodecPushPcm, useAudioMetricsGetCurrentSnapshot, useAudioMetricsGetHistory, useAuthenticationListProviders, useAuthenticationSetProviderEnabled, useBackupDelete, useBackupGetEntries, useBackupList, useBackupListArchives, useBackupListDestinations, useBackupListLocations, useBackupPreviewSchedule, useBackupRestore, useBackupTrigger, useBackupUpsertDestinationPolicy, useBatteryGetStatus, useBrightnessGetStatus, useBrightnessSetBrightness, useCameraCredentialsGetCredentials, useCameraCredentialsGetStatus, useCameraStreamsGetBrokerStreams, useCameraStreamsGetCameraStreams, useCameraStreamsGetRtspEntries, useClusterNodes, useConfirm, useCustomFieldRenderer, useDebouncedString, useDecoderCreateSession, useDecoderDestroySession, useDecoderGetInfo, useDecoderGetStats, useDecoderListActiveSessions, useDecoderOpenStream, useDecoderPullFrames, useDecoderPushPacket, useDecoderReprobeHwaccel, useDecoderSupportsCodec, useDecoderUpdateConfig, useDetectionPipelineApplyDeviceSettingsPatch, useDetectionPipelineGetDeviceLiveContribution, useDetectionPipelineGetDeviceSettingsContribution, useDevShell, useDevice, useDeviceBattery, useDeviceCapability, useDeviceDetections, useDeviceDiscoveryAdoptDevice, useDeviceDiscoveryGetStatus, useDeviceDiscoveryListDiscovered, useDeviceDiscoveryRefreshDiscovery, useDeviceDiscoveryReleaseDevice, useDeviceExportApplyDeviceSettingsPatch, useDeviceExportExposeDevice, useDeviceExportGetDeviceLiveContribution, useDeviceExportGetDeviceSettingsContribution, useDeviceExportGetStatus, useDeviceExportListExposedDevices, useDeviceExportListSupportedDeviceKinds, useDeviceExportUnexposeDevice, useDeviceId, useDeviceManagerAddLocation, useDeviceManagerAdoptDevice, useDeviceManagerAllocateDeviceId, useDeviceManagerCreateDevice, useDeviceManagerDisable, useDeviceManagerDiscoverDevices, useDeviceManagerEnable, useDeviceManagerGetAllBindings, useDeviceManagerGetBindings, useDeviceManagerGetChildren, useDeviceManagerGetConfigSchema, useDeviceManagerGetCreationSchema, useDeviceManagerGetDevice, useDeviceManagerGetDeviceAggregate, useDeviceManagerGetDeviceLiveInfoAggregate, useDeviceManagerGetDeviceSettingsAggregate, useDeviceManagerGetDeviceStatusAggregate, useDeviceManagerGetSettingsSchema, useDeviceManagerGetStreamProfileMap, useDeviceManagerGetStreamSources, useDeviceManagerListAll, useDeviceManagerListBindableCapsForDeviceType, useDeviceManagerListLocations, useDeviceManagerListPersistedByAddon, useDeviceManagerListWrappersForCap, useDeviceManagerLoadConfig, useDeviceManagerLoadMeta, useDeviceManagerLoadRuntimeState, useDeviceManagerPersistConfig, useDeviceManagerProbeStreams, useDeviceManagerRegisterDevice, useDeviceManagerRemove, useDeviceManagerRemoveDevice, useDeviceManagerRemoveLocation, useDeviceManagerSetDisabled, useDeviceManagerSetLocation, useDeviceManagerSetMetadata, useDeviceManagerSetName, useDeviceManagerSetStreamProfileMap, useDeviceManagerSetWrapperActive, useDeviceManagerTestCreationField, useDeviceManagerTestField, useDeviceManagerUpdateConfig, useDeviceManagerUpdateDeviceField, useDeviceManagerUpdateDeviceFieldsBatch, useDeviceOpsGetConfigEntries, useDeviceOpsGetSettingsSchema, useDeviceOpsGetStreamSources, useDeviceOpsRemoveDevice, useDeviceOpsSetConfig, useDeviceProviderAdoptDiscoveredDevice, useDeviceProviderCreateDevice, useDeviceProviderDiscoverDevices, useDeviceProviderGetChildCreationSchema, useDeviceProviderGetDevices, useDeviceProviderGetStatus, useDeviceProviderStart, useDeviceProviderStop, useDeviceProviderSupportsDiscovery, useDeviceProviderSupportsManualCreation, useDeviceProviderTestCreationField, useDeviceProxy, useDeviceSnapshot, useDeviceSnapshotImage, useDeviceState, useDeviceStateGetAllSnapshots, useDeviceStateGetCapSlice, useDeviceStateGetSnapshot, useDeviceStateSetCapSlice, useDeviceStateSlice, useDeviceStatusGetStatus, useDeviceWebrtc, useDevices, useDoorbellEvents, useDoorbellGetStatus, useEventInvalidation, useEventStreamLatest, useEventStreamMap, useEventsGetEventClipUrl, useEventsGetEventThumbnail, useEventsGetEvents, useFeatureProbeGetStatus, useIntegrationsCreate, useIntegrationsDelete, useIntegrationsGet, useIntegrationsGetAvailableTypes, useIntegrationsGetByAddonId, useIntegrationsGetSettings, useIntegrationsList, useIntegrationsSetSettings, useIntegrationsTestConnection, useIntegrationsUpdate, useIntercomEndTalkSession, useIntercomGetStatus, useIntercomHandleAnswer, useIntercomPushTalkPcm, useIntercomStartSession, useIntercomStartTalkSession, useIntercomStopSession, useIsMidWidth, useIsMobile, useLiveBuffer, useLiveEvent, useLocalNetworkGetAllowedAddresses, useLocalNetworkGetConnectionEndpoints, useLocalNetworkGetPreferred, useLocalNetworkList, useLocalNetworkResetAllowlistToBestMatch, useLocalNetworkSetAllowedAddresses, useMeshNetworkGetStatus, useMeshNetworkJoin, useMeshNetworkLeave, useMeshNetworkListPeers, useMeshNetworkLogout, useMeshNetworkStartLogin, useMeshNetworkTestConnection, useMeshOrchestratorJoinProvider, useMeshOrchestratorLeaveProvider, useMeshOrchestratorListProviderPeers, useMeshOrchestratorListProviders, useMeshOrchestratorLogoutProvider, useMeshOrchestratorStartLoginProvider, useMetricsProviderCollectSnapshot, useMetricsProviderGetAddonStats, useMetricsProviderGetCached, useMetricsProviderGetCpuTemperature, useMetricsProviderGetCurrent, useMetricsProviderGetDiskSpace, useMetricsProviderGetGpuInfo, useMetricsProviderGetProcessStats, useMetricsProviderKillProcess, useMetricsProviderListAddonInstances, useMetricsProviderListNodeProcesses, useMotionDetectionAnalyze, useMotionDetectionApplyDeviceSettingsPatch, useMotionDetectionGetDeviceLiveContribution, useMotionDetectionGetDeviceSettingsContribution, useMotionDetectionRemoveCamera, useMotionDetectionReset, useMotionGetStatus, useMotionIsDetected, useMotionTriggerGetStatus, useMotionTriggerSetMotionTrigger, useMqttBrokerAddBroker, useMqttBrokerGetBrokerConfig, useMqttBrokerGetStatus, useMqttBrokerListBrokers, useMqttBrokerRemoveBroker, useMqttBrokerStartEmbeddedBroker, useMqttBrokerStopEmbeddedBroker, useMqttBrokerTestConnection, useNativeObjectDetectionGetStatus, useNetworkQualityGetAllStats, useNetworkQualityGetDeviceStats, useNetworkQualityReportClientStats, useNodesClusterAddonStatus, useNodesDeployAddon, useNodesExecuteQuery, useNodesGetNodeAddons, useNodesRenameNode, useNodesRestartAddon, useNodesRestartNode, useNodesRestartProcess, useNodesSetProcessLogLevel, useNodesShutdownNode, useNodesTopology, useNodesUndeployAddon, useNotificationOutputSend, useNotificationOutputSendTest, useOptionalSystem, useOptionalWidgetRegistry, useOsdGetStatus, useOsdSetOverlay, usePTZ, usePipelineAnalyticsApplyDeviceSettingsPatch, usePipelineAnalyticsClearTracks, usePipelineAnalyticsGetActiveTracks, usePipelineAnalyticsGetAudioEvents, usePipelineAnalyticsGetDeviceLiveContribution, usePipelineAnalyticsGetDeviceSettingsContribution, usePipelineAnalyticsGetEventMedia, usePipelineAnalyticsGetMotionEvents, usePipelineAnalyticsGetObjectEvents, usePipelineAnalyticsGetTrack, usePipelineAnalyticsGetTrackMedia, usePipelineAnalyticsListTracks, usePipelineExecutorCacheFrameInPool, usePipelineExecutorDeleteModel, usePipelineExecutorDeleteTemplate, usePipelineExecutorDetect, usePipelineExecutorDownloadModel, usePipelineExecutorGetAddonModels, usePipelineExecutorGetAudioCapabilities, usePipelineExecutorGetAvailableEngines, usePipelineExecutorGetCapabilities, usePipelineExecutorGetDefaultSteps, usePipelineExecutorGetDetectionConfigSchema, usePipelineExecutorGetEffectiveTuning, usePipelineExecutorGetGlobalPipelineConfig, usePipelineExecutorGetGlobalSteps, usePipelineExecutorGetOrchestratorConfigSchema, usePipelineExecutorGetReferenceAudio, usePipelineExecutorGetReferenceAudioFiles, usePipelineExecutorGetReferenceImage, usePipelineExecutorGetSchema, usePipelineExecutorGetSelectedEngine, usePipelineExecutorGetVideoPipelineSteps, usePipelineExecutorInferCached, usePipelineExecutorKillEngine, usePipelineExecutorListLoadedEngines, usePipelineExecutorListReferenceImages, usePipelineExecutorListTemplates, usePipelineExecutorReprobeEngine, usePipelineExecutorRunAudioTest, usePipelineExecutorRunPipeline, usePipelineExecutorRunPipelineBatch, usePipelineExecutorSaveTemplate, usePipelineExecutorSetVideoPipelineSteps, usePipelineExecutorSpinEngine, usePipelineExecutorUncacheFrame, usePipelineExecutorUpdateTemplate, usePipelineOrchestratorApplyDeviceSettingsPatch, usePipelineOrchestratorAssignAudio, usePipelineOrchestratorAssignDecoder, usePipelineOrchestratorAssignPipeline, usePipelineOrchestratorDeleteTemplate, usePipelineOrchestratorGetAgentLoad, usePipelineOrchestratorGetAgentSettings, usePipelineOrchestratorGetAudioAssignment, usePipelineOrchestratorGetAudioAssignments, usePipelineOrchestratorGetAudioNodeLoad, usePipelineOrchestratorGetCameraMetrics, usePipelineOrchestratorGetCameraSettings, usePipelineOrchestratorGetCameraStepOverrides, usePipelineOrchestratorGetCapabilityBindings, usePipelineOrchestratorGetDecoderAssignment, usePipelineOrchestratorGetDecoderAssignments, usePipelineOrchestratorGetDeviceLiveContribution, usePipelineOrchestratorGetDeviceSettingsContribution, usePipelineOrchestratorGetGlobalMetrics, usePipelineOrchestratorGetPipelineAssignment, usePipelineOrchestratorGetPipelineAssignments, usePipelineOrchestratorListAgentSettings, usePipelineOrchestratorListTemplates, usePipelineOrchestratorRebalance, usePipelineOrchestratorRemoveAgentSettings, usePipelineOrchestratorResolvePipeline, usePipelineOrchestratorSaveTemplate, usePipelineOrchestratorSetAgentAddonDefaults, usePipelineOrchestratorSetCameraPipelineForAgent, usePipelineOrchestratorSetCameraStepOverride, usePipelineOrchestratorSetCameraStepToggle, usePipelineOrchestratorSetCapabilityBinding, usePipelineOrchestratorUnassignAudio, usePipelineOrchestratorUnassignDecoder, usePipelineOrchestratorUnassignPipeline, usePipelineOrchestratorUpdateTemplate, usePipelineRunnerAttachCamera, usePipelineRunnerDetachCamera, usePipelineRunnerGetAllCameraMetrics, usePipelineRunnerGetCameraMetrics, usePipelineRunnerGetLocalCameras, usePipelineRunnerGetLocalLoad, usePipelineRunnerGetLocalMetrics, usePipelineRunnerReportMotion, usePlatformProbeGetCapabilities, usePlatformProbeGetHardware, usePlatformProbeGetHardwareEncoders, usePlatformProbeRefreshHardwareEncoders, usePlatformProbeResolveHwAccel, usePlatformProbeResolveInferenceConfig, usePlayerOverlayLayer, usePlayerOverlayLayers, usePlayerToolbarButton, usePlayerToolbarButtons, usePtzAutotrackGetSettings, usePtzAutotrackGetStatus, usePtzAutotrackSetEnabled, usePtzAutotrackSetSettings, usePtzContinuousMove, usePtzGetPosition, usePtzGetPresets, usePtzGetStatus, usePtzGoHome, usePtzGoToPreset, usePtzMove, usePtzStop, useRebootReboot, useRecordingEngineDisable, useRecordingEngineEnable, useRecordingEngineEstimateGlobalStorage, useRecordingEngineEstimateStorage, useRecordingEngineGetAvailability, useRecordingEngineGetConfig, useRecordingEngineGetMotionStats, useRecordingEngineGetPlaylist, useRecordingEngineGetPolicy, useRecordingEngineGetPolicyStatus, useRecordingEngineGetRetentionConfig, useRecordingEngineGetSegments, useRecordingEngineGetStatus, useRecordingEngineGetStorageUsage, useRecordingEngineGetThumbnail, useRecordingEngineSetPolicy, useRecordingEngineUpdateConfig, useRecordingEngineUpdateRetentionConfig, useRecordingGetPlaybackUrl, useRecordingGetSegments, useRecordingGetThumbnailAt, useRemoteAccessListProviders, useRemoteAccessStartProvider, useRemoteAccessStopProvider, useSettingsStoreCount, useSettingsStoreDeclareCollection, useSettingsStoreDelete, useSettingsStoreGet, useSettingsStoreInsert, useSettingsStoreIsEmpty, useSettingsStoreQuery, useSettingsStoreSet, useSettingsStoreUpdate, useSnapshotApplyDeviceSettingsPatch, useSnapshotGetDeviceLiveContribution, useSnapshotGetDeviceSettingsContribution, useSnapshotGetSnapshot, useSnapshotGetStatus, useSnapshotInvalidateCache, useSnapshotProviderGetSnapshot, useSnapshotProviderSupportsDevice, useStorageAbortUpload, useStorageBeginDownload, useStorageBeginUpload, useStorageDelete, useStorageDeleteLocation, useStorageEndDownload, useStorageExists, useStorageFinalizeUpload, useStorageGetAvailableSpace, useStorageGetDefaultLocation, useStorageList, useStorageListLocations, useStorageListProviders, useStorageRead, useStorageReadChunk, useStorageResolve, useStorageTestConfig, useStorageTestLocation, useStorageUpsertLocation, useStorageWrite, useStorageWriteChunk, useStreamBrokerApplyDeviceSettingsPatch, useStreamBrokerAssignProfile, useStreamBrokerGetAllRtspEntries, useStreamBrokerGetBroker, useStreamBrokerGetBrokerStats, useStreamBrokerGetDeviceLiveContribution, useStreamBrokerGetDeviceSettingsContribution, useStreamBrokerGetPreBufferInfo, useStreamBrokerGetRtspEntry, useStreamBrokerGetRtspPort, useStreamBrokerGetStreamUrl, useStreamBrokerGetStreamWithCodec, useStreamBrokerIsRtspEnabled, useStreamBrokerKillClient, useStreamBrokerListAllCameraStreams, useStreamBrokerListAllProfileSlots, useStreamBrokerListClients, useStreamBrokerPublishCameraStream, useStreamBrokerRegenerateRtspToken, useStreamBrokerReleaseStreamWithCodec, useStreamBrokerRestartProfile, useStreamBrokerRetractCameraStream, useStreamBrokerSetPreBufferDuration, useStreamBrokerSetRtspEnabled, useStreamBrokerUnassignProfile, useSwitchGetStatus, useSwitchSetState, useSystem, useSystemFeatureFlags, useSystemForceRetentionCleanup, useSystemGetRetentionConfig, useSystemHealth, useSystemInfo, useSystemMutation, useSystemNetworkAddresses, useSystemQuery, useSystemSetRetentionConfig, useThemeMode, useToastOnToast, useTurnOrchestratorGetAllServers, useTurnOrchestratorListProviders, useTurnOrchestratorSetProviderEnabled, useTurnProviderGetTurnServers, useUserManagementConfirmTotp, useUserManagementCreateApiKey, useUserManagementCreateScopedToken, useUserManagementCreateUser, useUserManagementDeleteUser, useUserManagementDisableTotp, useUserManagementGetTotpStatus, useUserManagementListApiKeys, useUserManagementListScopedTokens, useUserManagementListUsers, useUserManagementResetPassword, useUserManagementRevokeApiKey, useUserManagementRevokeScopedToken, useUserManagementSetUserScopes, useUserManagementSetupTotp, useUserManagementUpdateUser, useUserManagementValidateApiKey, useUserManagementValidateCredentials, useUserManagementValidateScopedToken, useUserManagementVerifyTotp, useWebrtcSessionCloseSession, useWebrtcSessionCreateSession, useWebrtcSessionHandleAnswer, useWebrtcSessionHandleOffer, useWebrtcSessionHasAdaptiveBitrate, useWebrtcSessionListStreams, useWidget, useWidgetMetadata, useWidgetRegistry, useZoneAnalyticsGetCameraHistory, useZoneAnalyticsGetCurrentSnapshot, useZoneAnalyticsGetUnzonedHistory, useZoneAnalyticsGetZoneHistory, useZoneEditing, useZoneRulesListRules, useZoneRulesSetRules, useZonesAddZone, useZonesListZones, useZonesRemoveZone, useZonesUpdateZone, validateScopes };
|
|
25858
|
+
export { AddonGlobalSettingsForm, AgentStepEditor, AppShell, AudioClassificationList, AudioLevelWaveform, AudioWaveform, BTN_COMPACT, BTN_COMPACT_DANGER, BTN_COMPACT_PRIMARY, BTN_COMPACT_WARNING, Badge, BatteryBadge, BottomSheet, Breadcrumb, Button, CHIP_ACTIVE, CHIP_BASE, CHIP_INACTIVE, CLASS_COLORS, CameraStreamPlayer, Card, Checkbox, CodeBlock, CollapsibleCard, ConfigFormBuilder, FormField as ConfigFormField, ConfigSchemaField, ConfirmActionButton, ConfirmDialogProvider, CopyButton, CustomFieldRenderersProvider, DEFAULT_COLOR, DataTable, DetectionCanvas, DetectionOverlay, DetectionResultTree, DevShell, DeviceActivityPanel, DeviceCard, DeviceContextProvider, DeviceExportPanel, DeviceGrid, DeviceItem, DeviceList, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DiscoveryPanel, DoorbellRecentPanel, Dropdown, DropdownContent, DropdownItem, DropdownTrigger, EmptyState, ErrorBox, EventStream, FilterBar, FloatingEventStream, FloatingLogStream, FloatingPanel, FormField$1 as FormField, GRID_GAP, GRID_PAIRED, GRID_QUICK_STATS, INPUT_COMPACT, IconButton, ImageSelector, InferenceConfigSelector, Input, KebabMenu, KeyValueList, LIST_ROW, Label, LogStream, LoginForm, MobileDrawer, NodeMultiSelectField, NodePicker, NodeSelectField, PHASE_CONFIG, PTZOverlay, PageHeader, PhaseIcon, PipelineBuilder, PipelineRuntimeSelector, PipelineStep, PipelineTreeMatrix, PlayerOverlaysProvider, Popover, PopoverContent, PopoverTrigger, ProviderBadge, QrCode, ResponseLog, SECTION_BODY, SECTION_CARD, SECTION_HEADER, SPLIT_PANEL_OUTER, SPLIT_PANEL_SIDE, STACK_GAP, ScopePicker, ScrollArea, Select, SemanticBadge, Separator, Sidebar, SidebarItem, Skeleton, SlideOverPanel, SnapshotButton, StatCard, StateValuesStream, StatusBadge, StepTimings, StepTreeMaster, StreamBrokerSelector, StreamPanel, Switch, SystemProvider, TEXT_FIELD_LABEL, TEXT_HINT, TEXT_METRIC, TEXT_SECTION_LABEL, TEXT_VALUE, Tabs, TabsContent, TabsList, TabsTrigger, ThemeProvider, Tooltip, TooltipContent, TooltipTrigger, VersionBadge, WidgetRegistryProvider, WidgetSlot, ZoneEditingProvider, buildStepTreeFromSchema, cn, createSharedContext, createTheme, darkColors, defaultTheme, deriveDeviceKind, ensureMfHostInit, getClassColor, getPhaseVisual, isFieldVisible, lightColors, mirror, mountAddonPage, providerIcons, statusIcons, themeToCss, trpc, useAccessoriesGetStatus, useAddonPagesListPages, useAddonSettingsGetDeviceSettings, useAddonSettingsGetGlobalSettings, useAddonSettingsUpdateDeviceSettings, useAddonSettingsUpdateGlobalSettings, useAddonWidgetsListWidgets, useAddonsApplyAutoUpdateToAll, useAddonsCustom, useAddonsForceRefresh, useAddonsGetAddonAutoUpdate, useAddonsGetAutoUpdateSettings, useAddonsGetLastRestart, useAddonsGetLogs, useAddonsGetVersions, useAddonsInstallFromWorkspace, useAddonsInstallPackage, useAddonsIsWorkspaceAvailable, useAddonsList, useAddonsListCapabilityProviders, useAddonsListFrameworkPackages, useAddonsListPackages, useAddonsListUpdates, useAddonsListWorkspacePackages, useAddonsOnAddonLogs, useAddonsReloadPackages, useAddonsRestartAddon, useAddonsRestartServer, useAddonsRetryLoad, useAddonsRollbackPackage, useAddonsSearchAvailable, useAddonsSetAddonAutoUpdate, useAddonsSetAutoUpdateSettings, useAddonsUninstallPackage, useAddonsUpdateFrameworkPackage, useAddonsUpdatePackage, useAlertsDismiss, useAlertsEmit, useAlertsGetUnreadCount, useAlertsList, useAlertsMarkAllRead, useAlertsMarkRead, useAlertsUpdate, useAllWidgets, useAudioAnalysisApplyDeviceSettingsPatch, useAudioAnalysisGetDeviceLiveContribution, useAudioAnalysisGetDeviceSettingsContribution, useAudioAnalysisResolveDeviceSettings, useAudioAnalyzerAnalyseChunk, useAudioAnalyzerClassify, useAudioAnalyzerDispose, useAudioAnalyzerIsReady, useAudioAnalyzerReprobeAudioEngine, useAudioCodecCanHandle, useAudioCodecCloseSession, useAudioCodecCreateDecodeSession, useAudioCodecCreateEncodeSession, useAudioCodecFlushEncode, useAudioCodecListActiveSessions, useAudioCodecListSupportedCodecs, useAudioCodecPullEncoded, useAudioCodecPullPcm, useAudioCodecPushEncodedFrame, useAudioCodecPushPcm, useAudioMetricsGetCurrentSnapshot, useAudioMetricsGetHistory, useAuthenticationListProviders, useAuthenticationSetProviderEnabled, useBackupDelete, useBackupGetEntries, useBackupList, useBackupListArchives, useBackupListDestinations, useBackupListLocations, useBackupPreviewSchedule, useBackupRestore, useBackupTrigger, useBackupUpsertDestinationPolicy, useBatteryGetStatus, useBrightnessGetStatus, useBrightnessSetBrightness, useCameraCredentialsGetCredentials, useCameraCredentialsGetStatus, useCameraStreamsGetBrokerStreams, useCameraStreamsGetCameraStreams, useCameraStreamsGetRtspEntries, useClusterNodes, useConfirm, useCustomFieldRenderer, useDebouncedString, useDecoderCreateSession, useDecoderDestroySession, useDecoderGetInfo, useDecoderGetStats, useDecoderListActiveSessions, useDecoderOpenStream, useDecoderPullFrames, useDecoderPushPacket, useDecoderReprobeHwaccel, useDecoderSupportsCodec, useDecoderUpdateConfig, useDetectionPipelineApplyDeviceSettingsPatch, useDetectionPipelineGetDeviceLiveContribution, useDetectionPipelineGetDeviceSettingsContribution, useDevShell, useDevice, useDeviceBattery, useDeviceCapability, useDeviceDetections, useDeviceDiscoveryAdoptDevice, useDeviceDiscoveryGetStatus, useDeviceDiscoveryListDiscovered, useDeviceDiscoveryRefreshDiscovery, useDeviceDiscoveryReleaseDevice, useDeviceExportApplyDeviceSettingsPatch, useDeviceExportExposeDevice, useDeviceExportGetDeviceLiveContribution, useDeviceExportGetDeviceSettingsContribution, useDeviceExportGetStatus, useDeviceExportListExposedDevices, useDeviceExportListSupportedDeviceKinds, useDeviceExportUnexposeDevice, useDeviceId, useDeviceManagerAddLocation, useDeviceManagerAdoptDevice, useDeviceManagerAllocateDeviceId, useDeviceManagerCreateDevice, useDeviceManagerDisable, useDeviceManagerDiscoverDevices, useDeviceManagerEnable, useDeviceManagerGetAllBindings, useDeviceManagerGetBindings, useDeviceManagerGetChildren, useDeviceManagerGetConfigSchema, useDeviceManagerGetCreationSchema, useDeviceManagerGetDevice, useDeviceManagerGetDeviceAggregate, useDeviceManagerGetDeviceLiveInfoAggregate, useDeviceManagerGetDeviceSettingsAggregate, useDeviceManagerGetDeviceStatusAggregate, useDeviceManagerGetSettingsSchema, useDeviceManagerGetStreamProfileMap, useDeviceManagerGetStreamSources, useDeviceManagerListAll, useDeviceManagerListBindableCapsForDeviceType, useDeviceManagerListLocations, useDeviceManagerListPersistedByAddon, useDeviceManagerListWrappersForCap, useDeviceManagerLoadConfig, useDeviceManagerLoadMeta, useDeviceManagerLoadRuntimeState, useDeviceManagerPersistConfig, useDeviceManagerProbeStreams, useDeviceManagerRegisterDevice, useDeviceManagerRemove, useDeviceManagerRemoveDevice, useDeviceManagerRemoveLocation, useDeviceManagerSetDisabled, useDeviceManagerSetLocation, useDeviceManagerSetMetadata, useDeviceManagerSetName, useDeviceManagerSetStreamProfileMap, useDeviceManagerSetWrapperActive, useDeviceManagerTestCreationField, useDeviceManagerTestField, useDeviceManagerUpdateConfig, useDeviceManagerUpdateDeviceField, useDeviceManagerUpdateDeviceFieldsBatch, useDeviceOpsGetConfigEntries, useDeviceOpsGetSettingsSchema, useDeviceOpsGetStreamSources, useDeviceOpsRemoveDevice, useDeviceOpsSetConfig, useDeviceProviderAdoptDiscoveredDevice, useDeviceProviderCreateDevice, useDeviceProviderDiscoverDevices, useDeviceProviderGetChildCreationSchema, useDeviceProviderGetDevices, useDeviceProviderGetStatus, useDeviceProviderStart, useDeviceProviderStop, useDeviceProviderSupportsDiscovery, useDeviceProviderSupportsManualCreation, useDeviceProviderTestCreationField, useDeviceProxy, useDeviceSnapshot, useDeviceSnapshotImage, useDeviceState, useDeviceStateGetAllSnapshots, useDeviceStateGetCapSlice, useDeviceStateGetSnapshot, useDeviceStateSetCapSlice, useDeviceStateSlice, useDeviceStatusGetStatus, useDeviceWebrtc, useDevices, useDoorbellEvents, useDoorbellGetStatus, useEventInvalidation, useEventStreamLatest, useEventStreamMap, useEventsGetEventClipUrl, useEventsGetEventThumbnail, useEventsGetEvents, useFeatureProbeGetStatus, useIntegrationsCreate, useIntegrationsDelete, useIntegrationsGet, useIntegrationsGetAvailableTypes, useIntegrationsGetByAddonId, useIntegrationsGetSettings, useIntegrationsList, useIntegrationsSetSettings, useIntegrationsTestConnection, useIntegrationsUpdate, useIntercomEndTalkSession, useIntercomGetStatus, useIntercomHandleAnswer, useIntercomPushTalkPcm, useIntercomStartSession, useIntercomStartTalkSession, useIntercomStopSession, useIsMidWidth, useIsMobile, useLiveBuffer, useLiveEvent, useLocalNetworkGetAllowedAddresses, useLocalNetworkGetConnectionEndpoints, useLocalNetworkGetPreferred, useLocalNetworkList, useLocalNetworkResetAllowlistToBestMatch, useLocalNetworkSetAllowedAddresses, useMeshNetworkGetStatus, useMeshNetworkJoin, useMeshNetworkLeave, useMeshNetworkListPeers, useMeshNetworkLogout, useMeshNetworkStartLogin, useMeshNetworkTestConnection, useMeshOrchestratorJoinProvider, useMeshOrchestratorLeaveProvider, useMeshOrchestratorListProviderPeers, useMeshOrchestratorListProviders, useMeshOrchestratorLogoutProvider, useMeshOrchestratorStartLoginProvider, useMetricsProviderCollectSnapshot, useMetricsProviderGetAddonStats, useMetricsProviderGetCached, useMetricsProviderGetCpuTemperature, useMetricsProviderGetCurrent, useMetricsProviderGetDiskSpace, useMetricsProviderGetGpuInfo, useMetricsProviderGetProcessStats, useMetricsProviderKillProcess, useMetricsProviderListAddonInstances, useMetricsProviderListNodeProcesses, useMotionDetectionAnalyze, useMotionDetectionApplyDeviceSettingsPatch, useMotionDetectionGetDeviceLiveContribution, useMotionDetectionGetDeviceSettingsContribution, useMotionDetectionRemoveCamera, useMotionDetectionReset, useMotionGetStatus, useMotionIsDetected, useMotionTriggerGetStatus, useMotionTriggerSetMotionTrigger, useMqttBrokerAddBroker, useMqttBrokerGetBrokerConfig, useMqttBrokerGetStatus, useMqttBrokerListBrokers, useMqttBrokerRemoveBroker, useMqttBrokerStartEmbeddedBroker, useMqttBrokerStopEmbeddedBroker, useMqttBrokerTestConnection, useNativeObjectDetectionGetStatus, useNetworkQualityGetAllStats, useNetworkQualityGetDeviceStats, useNetworkQualityReportClientStats, useNodesClusterAddonStatus, useNodesDeployAddon, useNodesExecuteQuery, useNodesGetNodeAddons, useNodesRenameNode, useNodesRestartAddon, useNodesRestartNode, useNodesRestartProcess, useNodesSetProcessLogLevel, useNodesShutdownNode, useNodesTopology, useNodesUndeployAddon, useNotificationOutputSend, useNotificationOutputSendTest, useOptionalSystem, useOptionalWidgetRegistry, useOsdGetStatus, useOsdSetOverlay, usePTZ, usePipelineAnalyticsApplyDeviceSettingsPatch, usePipelineAnalyticsClearTracks, usePipelineAnalyticsGetActiveTracks, usePipelineAnalyticsGetAudioEvents, usePipelineAnalyticsGetDeviceLiveContribution, usePipelineAnalyticsGetDeviceSettingsContribution, usePipelineAnalyticsGetEventMedia, usePipelineAnalyticsGetMotionEvents, usePipelineAnalyticsGetObjectEvents, usePipelineAnalyticsGetTrack, usePipelineAnalyticsGetTrackMedia, usePipelineAnalyticsListTracks, usePipelineExecutorCacheFrameInPool, usePipelineExecutorDeleteModel, usePipelineExecutorDeleteTemplate, usePipelineExecutorDetect, usePipelineExecutorDownloadModel, usePipelineExecutorGetAddonModels, usePipelineExecutorGetAudioCapabilities, usePipelineExecutorGetAvailableEngines, usePipelineExecutorGetCapabilities, usePipelineExecutorGetDefaultSteps, usePipelineExecutorGetDetectionConfigSchema, usePipelineExecutorGetEffectiveTuning, usePipelineExecutorGetGlobalPipelineConfig, usePipelineExecutorGetGlobalSteps, usePipelineExecutorGetOrchestratorConfigSchema, usePipelineExecutorGetReferenceAudio, usePipelineExecutorGetReferenceAudioFiles, usePipelineExecutorGetReferenceImage, usePipelineExecutorGetSchema, usePipelineExecutorGetSelectedEngine, usePipelineExecutorGetVideoPipelineSteps, usePipelineExecutorInferCached, usePipelineExecutorKillEngine, usePipelineExecutorListLoadedEngines, usePipelineExecutorListReferenceImages, usePipelineExecutorListTemplates, usePipelineExecutorReprobeEngine, usePipelineExecutorRunAudioTest, usePipelineExecutorRunPipeline, usePipelineExecutorRunPipelineBatch, usePipelineExecutorSaveTemplate, usePipelineExecutorSetVideoPipelineSteps, usePipelineExecutorSpinEngine, usePipelineExecutorUncacheFrame, usePipelineExecutorUpdateTemplate, usePipelineOrchestratorApplyDeviceSettingsPatch, usePipelineOrchestratorAssignAudio, usePipelineOrchestratorAssignDecoder, usePipelineOrchestratorAssignPipeline, usePipelineOrchestratorDeleteTemplate, usePipelineOrchestratorGetAgentLoad, usePipelineOrchestratorGetAgentSettings, usePipelineOrchestratorGetAudioAssignment, usePipelineOrchestratorGetAudioAssignments, usePipelineOrchestratorGetAudioNodeLoad, usePipelineOrchestratorGetCameraMetrics, usePipelineOrchestratorGetCameraSettings, usePipelineOrchestratorGetCameraStepOverrides, usePipelineOrchestratorGetCapabilityBindings, usePipelineOrchestratorGetDecoderAssignment, usePipelineOrchestratorGetDecoderAssignments, usePipelineOrchestratorGetDeviceLiveContribution, usePipelineOrchestratorGetDeviceSettingsContribution, usePipelineOrchestratorGetGlobalMetrics, usePipelineOrchestratorGetPipelineAssignment, usePipelineOrchestratorGetPipelineAssignments, usePipelineOrchestratorListAgentSettings, usePipelineOrchestratorListTemplates, usePipelineOrchestratorRebalance, usePipelineOrchestratorRemoveAgentSettings, usePipelineOrchestratorResolvePipeline, usePipelineOrchestratorSaveTemplate, usePipelineOrchestratorSetAgentAddonDefaults, usePipelineOrchestratorSetCameraPipelineForAgent, usePipelineOrchestratorSetCameraStepOverride, usePipelineOrchestratorSetCameraStepToggle, usePipelineOrchestratorSetCapabilityBinding, usePipelineOrchestratorUnassignAudio, usePipelineOrchestratorUnassignDecoder, usePipelineOrchestratorUnassignPipeline, usePipelineOrchestratorUpdateTemplate, usePipelineRunnerAttachCamera, usePipelineRunnerDetachCamera, usePipelineRunnerGetAllCameraMetrics, usePipelineRunnerGetCameraMetrics, usePipelineRunnerGetLocalCameras, usePipelineRunnerGetLocalLoad, usePipelineRunnerGetLocalMetrics, usePipelineRunnerReportMotion, usePlatformProbeGetCapabilities, usePlatformProbeGetHardware, usePlatformProbeGetHardwareEncoders, usePlatformProbeRefreshHardwareEncoders, usePlatformProbeResolveHwAccel, usePlatformProbeResolveInferenceConfig, usePlayerOverlayLayer, usePlayerOverlayLayers, usePlayerToolbarButton, usePlayerToolbarButtons, usePtzAutotrackGetSettings, usePtzAutotrackGetStatus, usePtzAutotrackSetEnabled, usePtzAutotrackSetSettings, usePtzContinuousMove, usePtzGetPosition, usePtzGetPresets, usePtzGetStatus, usePtzGoHome, usePtzGoToPreset, usePtzMove, usePtzStop, useRebootReboot, useRecordingEngineDisable, useRecordingEngineEnable, useRecordingEngineEstimateGlobalStorage, useRecordingEngineEstimateStorage, useRecordingEngineGetAvailability, useRecordingEngineGetConfig, useRecordingEngineGetMotionStats, useRecordingEngineGetPlaylist, useRecordingEngineGetPolicy, useRecordingEngineGetPolicyStatus, useRecordingEngineGetRetentionConfig, useRecordingEngineGetSegments, useRecordingEngineGetStatus, useRecordingEngineGetStorageUsage, useRecordingEngineGetThumbnail, useRecordingEngineSetPolicy, useRecordingEngineUpdateConfig, useRecordingEngineUpdateRetentionConfig, useRecordingGetPlaybackUrl, useRecordingGetSegments, useRecordingGetThumbnailAt, useRemoteAccessListProviders, useRemoteAccessStartProvider, useRemoteAccessStopProvider, useSettingsStoreCount, useSettingsStoreDeclareCollection, useSettingsStoreDelete, useSettingsStoreGet, useSettingsStoreInsert, useSettingsStoreIsEmpty, useSettingsStoreQuery, useSettingsStoreSet, useSettingsStoreUpdate, useSnapshotApplyDeviceSettingsPatch, useSnapshotGetDeviceLiveContribution, useSnapshotGetDeviceSettingsContribution, useSnapshotGetSnapshot, useSnapshotGetStatus, useSnapshotInvalidateCache, useSnapshotProviderGetSnapshot, useSnapshotProviderSupportsDevice, useStorageAbortUpload, useStorageBeginDownload, useStorageBeginUpload, useStorageDelete, useStorageDeleteLocation, useStorageEndDownload, useStorageExists, useStorageFinalizeUpload, useStorageGetAvailableSpace, useStorageGetDefaultLocation, useStorageList, useStorageListLocations, useStorageListProviders, useStorageRead, useStorageReadChunk, useStorageResolve, useStorageTestConfig, useStorageTestLocation, useStorageUpsertLocation, useStorageWrite, useStorageWriteChunk, useStreamBrokerApplyDeviceSettingsPatch, useStreamBrokerAssignProfile, useStreamBrokerGetAllRtspEntries, useStreamBrokerGetBroker, useStreamBrokerGetBrokerStats, useStreamBrokerGetDeviceLiveContribution, useStreamBrokerGetDeviceSettingsContribution, useStreamBrokerGetPreBufferInfo, useStreamBrokerGetRtspEntry, useStreamBrokerGetRtspPort, useStreamBrokerGetStreamUrl, useStreamBrokerGetStreamWithCodec, useStreamBrokerIsRtspEnabled, useStreamBrokerKillClient, useStreamBrokerListAllCameraStreams, useStreamBrokerListAllProfileSlots, useStreamBrokerListClients, useStreamBrokerPublishCameraStream, useStreamBrokerRegenerateRtspToken, useStreamBrokerReleaseStreamWithCodec, useStreamBrokerRestartProfile, useStreamBrokerRetractCameraStream, useStreamBrokerSetPreBufferDuration, useStreamBrokerSetRtspEnabled, useStreamBrokerUnassignProfile, useSwitchGetStatus, useSwitchSetState, useSystem, useSystemFeatureFlags, useSystemForceRetentionCleanup, useSystemGetRetentionConfig, useSystemHealth, useSystemInfo, useSystemMutation, useSystemNetworkAddresses, useSystemQuery, useSystemSetRetentionConfig, useThemeMode, useToastOnToast, useTurnOrchestratorGetAllServers, useTurnOrchestratorListProviders, useTurnOrchestratorSetProviderEnabled, useTurnProviderGetTurnServers, useUserManagementConfirmTotp, useUserManagementCreateApiKey, useUserManagementCreateScopedToken, useUserManagementCreateUser, useUserManagementDeleteUser, useUserManagementDisableTotp, useUserManagementGetTotpStatus, useUserManagementListApiKeys, useUserManagementListScopedTokens, useUserManagementListUsers, useUserManagementResetPassword, useUserManagementRevokeApiKey, useUserManagementRevokeScopedToken, useUserManagementSetUserScopes, useUserManagementSetupTotp, useUserManagementUpdateUser, useUserManagementValidateApiKey, useUserManagementValidateCredentials, useUserManagementValidateScopedToken, useUserManagementVerifyTotp, useWebrtcSessionCloseSession, useWebrtcSessionCreateSession, useWebrtcSessionHandleAnswer, useWebrtcSessionHandleOffer, useWebrtcSessionHasAdaptiveBitrate, useWebrtcSessionListStreams, useWidget, useWidgetMetadata, useWidgetRegistry, useZoneAnalyticsGetCameraHistory, useZoneAnalyticsGetCurrentSnapshot, useZoneAnalyticsGetUnzonedHistory, useZoneAnalyticsGetZoneHistory, useZoneEditing, useZoneRulesListRules, useZoneRulesSetRules, useZonesAddZone, useZonesListZones, useZonesRemoveZone, useZonesUpdateZone, validateScopes };
|
|
24228
25859
|
|
|
24229
25860
|
//# sourceMappingURL=index.js.map
|