@techolution-ai/computer-vision
Version:
A JavaScript/TypeScript library for computer vision applications, providing tools for image processing, scanning, and MQTT-based messaging.
123 lines (122 loc) • 3.99 kB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/scanner/status.tsx
var status_exports = {};
__export(status_exports, {
default: () => ScannerStatus,
defaultStatusMap: () => defaultStatusMap
});
module.exports = __toCommonJS(status_exports);
var import_react = require("react");
var import_status_item = __toESM(require("./status-item.cjs"), 1);
var import_idle = __toESM(require("../assets/idle.gif"), 1);
var import_status = require("./styles/status.css");
var import_scan_complete = __toESM(require("./scan-complete.cjs"), 1);
var import_jsx_runtime = require("react/jsx-runtime");
var defaultStatusMap = {
idle: {
message: "Place an object in the screening zone",
icon: import_idle.default,
slotProps: {
icon: {
style: {
width: "150px",
height: "150px"
}
}
}
},
motion: {
message: "Motion detected"
},
scanning: {
message: "Scanning for details"
},
not_recognized: {
message: "Product not recognized. Please hold the product closer to the camera"
},
product_placement: {
message: "Place the product with the label facing up in the scanning area"
},
center_scan: {
message: "Move product label inside scanning zone"
},
glare_scan: {
message: "Move product label to avoid glare"
},
scanned: {
render: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_scan_complete.default, {})
},
camera_loading: {
message: "Loading Camera ..."
}
};
function ScannerStatus({
children,
status,
// onSetup,
statusMap,
...restProps
}) {
const finalStatusMap = (0, import_react.useMemo)(() => {
return statusMap ?? defaultStatusMap;
}, [statusMap]);
const findStatusByKeyword = () => {
if (!status) return null;
const statusDetails = finalStatusMap[status];
if (!statusDetails) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_status_item.default, { message: status });
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_status_item.default,
{
message: statusDetails.message,
icon: statusDetails.icon,
render: statusDetails.render,
slotProps: "slotProps" in statusDetails ? statusDetails.slotProps : {}
}
);
};
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
"div",
{
...restProps,
style: {
position: "relative",
...restProps.style
},
children: [
children,
findStatusByKeyword()
]
}
);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
defaultStatusMap
});
//# sourceMappingURL=status.cjs.map