const QR_PREFIX = "EDUMIND1";
function buildQrPayload(deviceCode, categoryCode) {
  return `${QR_PREFIX}|${deviceCode}|${categoryCode ?? ""}`;
}
function parseScan(raw) {
  const value = raw.trim();
  if (!value) return null;
  if (value.startsWith(QR_PREFIX + "|")) {
    const parts = value.split("|");
    const code = parts[1]?.trim();
    if (!code) return null;
    return { code, categoryCode: parts[2]?.trim() || null };
  }
  if (value.includes("/")) {
    const last = value.split(/[/?#]/).filter(Boolean).pop();
    if (last) return { code: last.toUpperCase(), categoryCode: null };
  }
  return { code: value.toUpperCase(), categoryCode: null };
}

export { buildQrPayload as b, parseScan as p };
//# sourceMappingURL=qr.js-BYghGLdS.js.map
