From 58d2e61cad2119c92ef9b920b0bacd13bb4dded5 Mon Sep 17 00:00:00 2001 From: jokerxue <2509699647@qq.com> Date: Mon, 13 Apr 2026 17:13:18 +0800 Subject: [PATCH] 最新代码 --- 打印机安卓基座/README.md | 2 ++ 打印机安卓基座/native-fast-printer/android-src/src/com/foodlabel/nativeprinter/NativeFastPrinterModule.java | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 打印机安卓基座/native-fast-printer/android-src/src/com/foodlabel/nativeprinter/template/NativeTemplateCommandBuilder.java | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------ 美国版/Food Labeling Management App UniApp/.hbuilderx/launch.json | 4 ++-- 美国版/Food Labeling Management App UniApp/docs/native-fast-printer-custom-base.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 美国版/Food Labeling Management App UniApp/nativeplugins/native-fast-printer/README.md | 20 ++++++++++++++++++-- 美国版/Food Labeling Management App UniApp/package.json | 1 + 美国版/Food Labeling Management App UniApp/scripts/sync-native-fast-printer.ps1 | 45 +++++++++++++++++++++++++++++++++++++++++++++ 美国版/Food Labeling Management App UniApp/src/manifest.json | 5 ++++- 美国版/Food Labeling Management App UniApp/src/pages/labels/bluetooth.vue | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 美国版/Food Labeling Management App UniApp/src/pages/labels/preview.vue | 776 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------- 美国版/Food Labeling Management App UniApp/src/pages/more/print-log.vue | 24 +++++++++++++++++++++--- 美国版/Food Labeling Management App UniApp/src/pages/more/printers.vue | 31 ++++++++++++++++++++++++++++++- 美国版/Food Labeling Management App UniApp/src/utils/labelPreview/renderLabelPreviewCanvas.ts | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 美国版/Food Labeling Management App UniApp/src/utils/print/bluetoothTool.d.ts | 15 +++++++++++++++ 美国版/Food Labeling Management App UniApp/src/utils/print/bluetoothTool.js | 24 +++++++++++++++++++++--- 美国版/Food Labeling Management App UniApp/src/utils/print/hydrateTemplateImagesForPrint.ts | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------ 美国版/Food Labeling Management App UniApp/src/utils/print/manager/printerManager.ts | 204 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------ 美国版/Food Labeling Management App UniApp/src/utils/print/nativeBitmapPatch.ts | 6 +++++- 美国版/Food Labeling Management App UniApp/src/utils/print/nativeFastPrinter.ts | 43 +++++++++++++++++++++++++++++++++++++++++++ 美国版/Food Labeling Management App UniApp/src/utils/print/nativeTemplateElementSupport.ts | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 美国版/Food Labeling Management App UniApp/src/utils/print/printerConnection.ts | 244 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------- 美国版/Food Labeling Management App UniApp/src/utils/print/systemTemplateAdapter.ts | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------- 美国版/Food Labeling Management App UniApp/src/utils/printFromPrintDataList.ts | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------ 美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Dtos/Label/LabelGetListOutputDto.cs | 5 +++++ 美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Dtos/LabelTemplate/LabelTemplateElementDto.cs | 6 ++++++ 美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/DbModels/FlLabelTemplateElementDbEntity.cs | 3 +++ 美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/LabelAppService.cs | 3 +++ 美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/LabelTemplateAppService.cs | 2 ++ 美国版/Food Labeling Management Platform/build/assets/index-SKuXxqbM.js | 458 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 美国版/Food Labeling Management Platform/build/assets/index-rOdDFGrB.js | 458 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 美国版/Food Labeling Management Platform/build/index.html | 2 +- 美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateDataEntryView.tsx | 26 +++++++++++++++++++------- 美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/ElementsPanel.tsx | 15 +++++++-------- 美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/LabelCanvas.tsx | 637 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------- 美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/PropertiesPanel.tsx | 584 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------- 美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/index.tsx | 23 ++++++++++++++++++----- 美国版/Food Labeling Management Platform/src/components/labels/LabelTemplatesView.tsx | 42 ++++-------------------------------------- 美国版/Food Labeling Management Platform/src/components/labels/LabelsList.tsx | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 美国版/Food Labeling Management Platform/src/components/layout/Sidebar.tsx | 1 - 美国版/Food Labeling Management Platform/src/components/products/ProductsView.tsx | 219 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------ 美国版/Food Labeling Management Platform/src/services/labelTemplateService.ts | 27 ++++++++++++++++++--------- 美国版/Food Labeling Management Platform/src/types/labelTemplate.ts | 365 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------- 43 files changed, 4184 insertions(+), 1102 deletions(-) create mode 100644 美国版/Food Labeling Management App UniApp/docs/native-fast-printer-custom-base.md create mode 100644 美国版/Food Labeling Management App UniApp/scripts/sync-native-fast-printer.ps1 create mode 100644 美国版/Food Labeling Management App UniApp/src/utils/print/bluetoothTool.d.ts create mode 100644 美国版/Food Labeling Management Platform/build/assets/index-SKuXxqbM.js delete mode 100644 美国版/Food Labeling Management Platform/build/assets/index-rOdDFGrB.js diff --git a/打印机安卓基座/README.md b/打印机安卓基座/README.md index 3293924..b954daf 100644 --- a/打印机安卓基座/README.md +++ b/打印机安卓基座/README.md @@ -13,4 +13,6 @@ - 再执行: - `native-fast-printer/sync-to-uniapp.sh` +**1.2.0+**:新增 `printCommandBytes`(JS 将 TSC 指令 Base64 后交给佳博 SDK 写出),供整页光栅等路径走基座下发,避免仅依赖 JS 经典蓝牙慢发。 + 当前目录只放这套原生打印基座代码,不再混放其他 SDK、参考项目或历史实验代码。 diff --git a/打印机安卓基座/native-fast-printer/android-src/src/com/foodlabel/nativeprinter/NativeFastPrinterModule.java b/打印机安卓基座/native-fast-printer/android-src/src/com/foodlabel/nativeprinter/NativeFastPrinterModule.java index 692dd2f..8d0f0ae 100644 --- a/打印机安卓基座/native-fast-printer/android-src/src/com/foodlabel/nativeprinter/NativeFastPrinterModule.java +++ b/打印机安卓基座/native-fast-printer/android-src/src/com/foodlabel/nativeprinter/NativeFastPrinterModule.java @@ -13,11 +13,13 @@ import com.taobao.weex.bridge.JSCallback; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import android.util.Base64; + import io.dcloud.feature.uniapp.common.UniModule; public class NativeFastPrinterModule extends UniModule { private static final String BACKEND = "gprinter-sdk"; - private static final String PLUGIN_VERSION = "1.1.0"; + private static final String PLUGIN_VERSION = "1.2.0"; private static final Object LOCK = new Object(); private static final ExecutorService PRINT_EXECUTOR = Executors.newSingleThreadExecutor(); private static final NativePrintDebugState DEBUG_STATE = new NativePrintDebugState(BACKEND, PLUGIN_VERSION); @@ -132,6 +134,71 @@ public class NativeFastPrinterModule extends UniModule { }); } + /** + * 将 JS 侧已生成的 TSC/指令字节(Base64)经佳博 SDK 写出。 + * 用于整页光栅等路径,避免再走 JS 经典蓝牙 socket(慢、易超时)。 + */ + @JSMethod(uiThread = false) + public void printCommandBytes(JSONObject params, JSCallback callback) { + String deviceId = SafeJson.getString(params, "deviceId", ""); + String deviceName = SafeJson.getString(params, "deviceName", ""); + String base64 = SafeJson.getString(params, "base64", ""); + + if (base64 == null || base64.trim().isEmpty()) { + if (callback != null) { + callback.invoke(errorResult(9011012, "base64 is empty.").toJsonString()); + } + return; + } + + PluginResult connectResult = ensureConnected(deviceId, deviceName); + if (!connectResult.success) { + if (callback != null) { + callback.invoke(connectResult.toJsonString()); + } + return; + } + + DEBUG_STATE.setStage("printCommandBytes:queued"); + if (callback != null) { + callback.invoke(debugResult(PluginResult.ok(true, DEBUG_STATE.getCurrentDeviceId(), DEBUG_STATE.getCurrentDeviceName(), "printCommandBytes:queued")).toJsonString()); + } + + PRINT_EXECUTOR.execute(new Runnable() { + @Override + public void run() { + try { + byte[] bytes = Base64.decode(base64, Base64.DEFAULT); + if (bytes == null || bytes.length == 0) { + DEBUG_STATE.setError("decoded bytes empty"); + DEBUG_STATE.setStage("printCommandBytes:error"); + return; + } + long writeStarted = System.currentTimeMillis(); + synchronized (LOCK) { + if (!BLUETOOTH_TRANSPORT.isConnected()) { + errorResult(9011005, "Bluetooth printer transport is not ready."); + return; + } + DEBUG_STATE.setStage("write-raw-command"); + boolean ok = BLUETOOTH_TRANSPORT.write(bytes); + if (!ok) { + errorResult(9011011, "Printer writeDataImmediately returned false."); + return; + } + } + DEBUG_STATE.setWriteMs(Math.max(0L, System.currentTimeMillis() - writeStarted)); + DEBUG_STATE.markPrinted(System.currentTimeMillis()); + DEBUG_STATE.setStage("printCommandBytes:ok"); + DEBUG_STATE.clearError(); + } catch (Throwable e) { + DEBUG_STATE.setError(ThrowableUtils.unwrap(e)); + DEBUG_STATE.setStage("printCommandBytes:error"); + } + } + }); + } + private PluginResult ensureConnected(String deviceId, String deviceName) { synchronized (LOCK) { PluginResult result = BLUETOOTH_TRANSPORT.ensureConnected(deviceId, deviceName, DEBUG_STATE); diff --git a/打印机安卓基座/native-fast-printer/android-src/src/com/foodlabel/nativeprinter/template/NativeTemplateCommandBuilder.java b/打印机安卓基座/native-fast-printer/android-src/src/com/foodlabel/nativeprinter/template/NativeTemplateCommandBuilder.java index 78b41d9..0430939 100644 --- a/打印机安卓基座/native-fast-printer/android-src/src/com/foodlabel/nativeprinter/template/NativeTemplateCommandBuilder.java +++ b/打印机安卓基座/native-fast-printer/android-src/src/com/foodlabel/nativeprinter/template/NativeTemplateCommandBuilder.java @@ -20,6 +20,11 @@ import java.util.regex.Pattern; public final class NativeTemplateCommandBuilder { private static final double DESIGN_DPI = 96.0; + /** + * 与 JS 光栅路径 clearTopRasterRows 等效:热敏头可印区相对模板顶边常有一小段空白, + * 全部为 0 时顶部中文位图/TEXT 易被裁切;略下移与整页光栅观感一致。 + */ + private static final int LABEL_TOP_MARGIN_DOTS = 18; private static final int TEXT_PADDING_DOTS = 6; private static final int DEFAULT_THRESHOLD = 180; private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("\\{\\{\\s*([\\w.-]+)\\s*\\}\\}"); @@ -83,8 +88,12 @@ public final class NativeTemplateCommandBuilder { } else { nativeTextCount++; int scale = resolveTextScale(getDouble(config, "fontSize", 14), dpi); + if ("TEXT_PRICE".equals(type)) { + // 价格行与普通文案保持接近视觉粗细,避免看起来偏“粗黑”。 + scale = Math.max(1, scale - 1); + } int x = resolveTextX(align, getDouble(element, "x", 0), getDouble(element, "width", 0), dpi, text, scale); - int y = pxToDots(getDouble(element, "y", 0), dpi); + int y = yDots(getDouble(element, "y", 0), dpi); int rotation = "vertical".equalsIgnoreCase(getString(element, "rotation", "horizontal")) ? 90 : 0; addLine(out, "TEXT " + x + "," + y + ",\"TSS24.BF2\"," + rotation + "," + scale + "," + scale + ",\"" + escapeTscString(text) + "\""); } @@ -92,26 +101,51 @@ public final class NativeTemplateCommandBuilder { } if ("QRCODE".equals(type)) { - qrCodeCount++; + String sourceLike = getString(config, "src", getString(config, "data", getString(config, "url", ""))); + if (isImageLikeSource(sourceLike)) { + BitmapPatch patch = createImagePatch(element, config, dpi, sourceLike); + if (patch != null) { + imagePatchCount++; + writeBitmapPatch(out, patch); + } + continue; + } String value = resolveElementDataValue(type, config, data); if (value.isEmpty()) continue; + if (isImageLikeSource(value)) { + BitmapPatch patch = createImagePatch(element, config, dpi, value); + if (patch != null) { + imagePatchCount++; + writeBitmapPatch(out, patch); + } + continue; + } + qrCodeCount++; String level = normalizeQrLevel(getString(config, "errorLevel", "M")); int x = pxToDots(getDouble(element, "x", 0), dpi); - int y = pxToDots(getDouble(element, "y", 0), dpi); + int y = yDots(getDouble(element, "y", 0), dpi); int size = resolveQrModuleSize(getDouble(element, "width", 0), getDouble(element, "height", 0), dpi, value, level); addLine(out, "QRCODE " + x + "," + y + "," + level + "," + size + ",A,0,\"" + escapeTscString(value) + "\""); continue; } if ("BARCODE".equals(type)) { - barcodeCount++; String value = resolveElementDataValue(type, config, data); if (value.isEmpty()) continue; + barcodeCount++; int x = pxToDots(getDouble(element, "x", 0), dpi); - int y = pxToDots(getDouble(element, "y", 0), dpi); + int y = yDots(getDouble(element, "y", 0), dpi); int height = Math.max(20, pxToDots(getDouble(element, "height", 0), dpi)); int readable = getBoolean(config, "showText", true) ? 1 : 0; String orientation = getString(config, "orientation", getString(element, "rotation", "horizontal")); + if ("vertical".equalsIgnoreCase(orientation)) { + BitmapPatch patch = createVerticalBarcodePatch(element, config, dpi, value); + if (patch != null) { + imagePatchCount++; + writeBitmapPatch(out, patch); + } + continue; + } int rotation = "vertical".equalsIgnoreCase(orientation) ? 90 : 0; int narrow = clamp(getDouble(element, "width", 0) / Math.max(40.0, value.length() * 6.0), 1, 4); int wide = clamp(getDouble(element, "width", 0) / Math.max(24.0, value.length() * 3.0), 2, 6); @@ -132,7 +166,7 @@ public final class NativeTemplateCommandBuilder { if ("BLANK".equals(type) && "line".equalsIgnoreCase(getString(element, "border", ""))) { lineCount++; int x = pxToDots(getDouble(element, "x", 0), dpi); - int y = pxToDots(getDouble(element, "y", 0), dpi); + int y = yDots(getDouble(element, "y", 0), dpi); int width = Math.max(1, pxToDots(getDouble(element, "width", 0), dpi)); int height = Math.max(1, pxToDots(getDouble(element, "height", 1), dpi)); addLine(out, "BAR " + x + "," + y + "," + width + "," + height); @@ -171,7 +205,8 @@ public final class NativeTemplateCommandBuilder { } catch (Exception ignored) { } } - return prefix + raw + suffix; + raw = trimLeadingCurrencyIfPrefixed(raw, prefix); + return normalizePriceCurrencySymbol(prefix + raw + suffix); } if (hasText && "TEXT_STATIC".equals(type)) { return applyTemplateData(configText, data); @@ -266,6 +301,10 @@ public final class NativeTemplateCommandBuilder { private static boolean shouldRasterizeText(String text, String type) { if (text == null || text.isEmpty()) return false; + if ("TEXT_PRICE".equals(type) && isSimplePriceLikeText(text)) { + // 价格行优先走原生 TEXT:避免位图二值化导致的糊边/左侧杂点。 + return false; + } for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); if (c < 32 || c > 126) { @@ -281,6 +320,36 @@ public final class NativeTemplateCommandBuilder { } } + private static boolean isSimplePriceLikeText(String text) { + String s = text == null ? "" : text.trim(); + if (s.isEmpty()) return false; + // 允许货币符号 + 数字/小数点/逗号/空格,统一按原生字体输出。 + return s.matches("^[¥¥$€£]?\\s*[-+]?\\d+(?:[.,]\\d{1,2})?\\s*$"); + } + + private static String normalizePriceCurrencySymbol(String value) { + if (value == null || value.isEmpty()) return ""; + return value.replace('¥', '¥'); + } + + private static String trimLeadingCurrencyIfPrefixed(String raw, String prefix) { + if (raw == null || raw.isEmpty()) return ""; + String p = prefix == null ? "" : prefix.trim(); + if (p.isEmpty()) return raw; + char c = p.charAt(0); + if (c != '¥' && c != '¥' && c != '$' && c != '€' && c != '£') return raw; + String s = raw.trim(); + while (!s.isEmpty()) { + char ch = s.charAt(0); + if (ch == '¥' || ch == '¥' || ch == '$' || ch == '€' || ch == '£') { + s = s.substring(1).trim(); + continue; + } + break; + } + return s; + } + private static BitmapPatch createTextPatch(JSONObject element, String type, JSONObject config, String text, int dpi, String align) { int contentWidth = Math.max(8, pxToDots(getDouble(element, "width", 0), dpi)); Paint paint = new Paint(); @@ -290,7 +359,8 @@ public final class NativeTemplateCommandBuilder { paint.setColor(Color.BLACK); int fontSizeDots = Math.max(14, pxToDots(getDouble(config, "fontSize", 14), dpi)); paint.setTextSize(fontSizeDots); - boolean bold = "bold".equalsIgnoreCase(getString(config, "fontWeight", "")) || "TEXT_PRICE".equals(type); + /** 不再对 TEXT_PRICE 强制加粗:fakeBold + 粗体会糊边、measureText 偏窄,右对齐时左侧易出现杂点 */ + boolean bold = "bold".equalsIgnoreCase(getString(config, "fontWeight", "")); paint.setFakeBoldText(bold); paint.setTypeface(bold ? Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD) : Typeface.SANS_SERIF); @@ -327,21 +397,112 @@ public final class NativeTemplateCommandBuilder { if ("center".equals(align)) { drawX = horizontalPadding + Math.max(0, (drawableWidth - lineWidth) / 2f); } else if ("right".equals(align)) { - drawX = horizontalPadding + Math.max(0, drawableWidth - lineWidth); + /** ¥ 等字符 measureText 常偏窄,右对齐时真实笔画会略凸向左,易在位图左缘挤出杂点 */ + float w = lineWidth; + if ("TEXT_PRICE".equals(type)) { + w += Math.max(2f, paint.getTextSize() * 0.12f); + } + drawX = horizontalPadding + Math.max(0, drawableWidth - w); } float baseline = topOffset + i * lineHeight - metrics.top; canvas.drawText(line, drawX, baseline, paint); } BitmapPatch patch = new BitmapPatch(Math.max(0, pxToDots(getDouble(element, "x", 0), dpi) - horizontalPadding), - Math.max(0, pxToDots(getDouble(element, "y", 0), dpi) - verticalPadding), + Math.max(0, yDots(getDouble(element, "y", 0), dpi) - verticalPadding), invertMonochrome(bitmapToMonochrome(bitmap, DEFAULT_THRESHOLD))); bitmap.recycle(); return patch; } private static BitmapPatch createImagePatch(JSONObject element, JSONObject config, int dpi) { - String source = getString(config, "src", getString(config, "data", getString(config, "url", ""))); + return createImagePatch(element, config, dpi, null); + } + + private static BitmapPatch createVerticalBarcodePatch(JSONObject element, JSONObject config, int dpi, String value) { + int width = ensureMultipleOf8(Math.max(8, pxToDots(getDouble(element, "width", 0), dpi))); + int height = Math.max(12, pxToDots(getDouble(element, "height", 0), dpi)); + Bitmap outputBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(outputBitmap); + canvas.drawColor(Color.WHITE); + + int pad = 2; + boolean showText = getBoolean(config, "showText", true); + int textBandWidth = (showText && value != null && !value.isEmpty()) ? Math.max(10, (int) Math.round(width * 0.18)) : 0; + int barAreaWidth = Math.max(8, width - textBandWidth - pad * 2); + int innerHeight = Math.max(10, height - pad * 2); + + int[] modules = barcodeModulesFromValue(value); + Paint barPaint = new Paint(); + barPaint.setAntiAlias(false); + barPaint.setColor(Color.BLACK); + if (modules.length > 0) { + double moduleH = (double) innerHeight / (double) modules.length; + double cursorY = pad; + for (int i = 0; i < modules.length; i++) { + if (modules[i] == 1) { + float top = (float) cursorY; + float bottom = (float) (cursorY + Math.max(0.7, moduleH * 0.86)); + canvas.drawRect(pad, top, pad + barAreaWidth, bottom, barPaint); + } + cursorY += moduleH; + } + } + + if (showText && value != null && !value.isEmpty() && textBandWidth > 0) { + Paint txt = new Paint(); + txt.setAntiAlias(true); + txt.setColor(Color.BLACK); + int font = Math.max(9, Math.min(11, (int) Math.floor(textBandWidth * 0.75))); + txt.setTextSize(font); + txt.setTextAlign(Paint.Align.CENTER); + float cx = width - textBandWidth / 2f; + float cy = height / 2f; + canvas.save(); + // 竖排文本按模板端习惯:从下到上 + canvas.rotate(-90f, cx, cy); + Paint.FontMetrics fm = txt.getFontMetrics(); + float baseline = cy - (fm.ascent + fm.descent) / 2f; + canvas.drawText(value, cx, baseline, txt); + canvas.restore(); + } + + BitmapPatch patch = new BitmapPatch( + pxToDots(getDouble(element, "x", 0), dpi), + yDots(getDouble(element, "y", 0), dpi), + bitmapToMonochrome(outputBitmap, (int) getDouble(config, "threshold", DEFAULT_THRESHOLD)) + ); + outputBitmap.recycle(); + return patch; + } + + private static int[] barcodeModulesFromValue(String value) { + String s = value == null ? "" : value.trim(); + if (s.isEmpty()) return new int[0]; + java.util.ArrayList m = new java.util.ArrayList<>(); + // quiet + start + int[] start = new int[]{1, 0, 1, 0, 1, 0, 1, 0}; + for (int v : start) m.add(v); + for (int i = 0; i < s.length(); i++) { + int code = s.charAt(i) & 0xFF; + int key = (code ^ (i * 13) ^ (s.length() * 7)) & 0x1F; + for (int b = 4; b >= 0; b--) { + m.add((key >> b) & 1); + } + m.add(0); + } + int[] stop = new int[]{1, 0, 1, 1, 0, 1, 0, 1}; + for (int v : stop) m.add(v); + int[] out = new int[m.size()]; + for (int i = 0; i < m.size(); i++) out[i] = m.get(i); + return out; + } + + private static BitmapPatch createImagePatch(JSONObject element, JSONObject config, int dpi, String sourceOverride) { + String source = sourceOverride; + if (source == null || source.isEmpty()) { + source = getString(config, "src", getString(config, "data", getString(config, "url", ""))); + } if (source.isEmpty()) return null; Bitmap sourceBitmap = decodeBitmap(source); if (sourceBitmap == null) return null; @@ -377,7 +538,7 @@ public final class NativeTemplateCommandBuilder { canvas.drawBitmap(scaledBitmap, targetLeft, targetTop, paint); BitmapPatch patch = new BitmapPatch(pxToDots(getDouble(element, "x", 0), dpi), - pxToDots(getDouble(element, "y", 0), dpi), + yDots(getDouble(element, "y", 0), dpi), bitmapToMonochrome(outputBitmap, (int) getDouble(config, "threshold", DEFAULT_THRESHOLD))); scaledBitmap.recycle(); @@ -386,6 +547,18 @@ public final class NativeTemplateCommandBuilder { return patch; } + private static boolean isImageLikeSource(String source) { + if (source == null) return false; + String s = source.trim().toLowerCase(); + if (s.isEmpty()) return false; + if (s.startsWith("data:image/")) return true; + if (s.startsWith("file://")) return true; + if (s.startsWith("/picture/") || s.startsWith("picture/")) return true; + if (s.startsWith("/static/") || s.startsWith("static/")) return true; + if (s.matches("^[a-z]:[\\\\/].*")) return true; + return s.matches(".*\\.(png|jpe?g|gif|webp|bmp)(\\?.*)?$"); + } + private static Bitmap decodeBitmap(String source) { try { if (source.startsWith("data:image/")) { @@ -599,6 +772,11 @@ public final class NativeTemplateCommandBuilder { return Math.max(0, (int) Math.round(value * dpi / DESIGN_DPI)); } + /** 模板 y(px)→ 点阵 y,并加上与光栅路径一致的上边距,减轻顶部裁切 */ + private static int yDots(double yPx, int dpi) { + return Math.max(0, pxToDots(yPx, dpi) + LABEL_TOP_MARGIN_DOTS); + } + private static double toMillimeter(double value, String unit) { if ("mm".equalsIgnoreCase(unit)) return value; if ("cm".equalsIgnoreCase(unit)) return value * 10; diff --git a/美国版/Food Labeling Management App UniApp/.hbuilderx/launch.json b/美国版/Food Labeling Management App UniApp/.hbuilderx/launch.json index 07b129c..29998cf 100644 --- a/美国版/Food Labeling Management App UniApp/.hbuilderx/launch.json +++ b/美国版/Food Labeling Management App UniApp/.hbuilderx/launch.json @@ -2,8 +2,8 @@ "version" : "1.0", "configurations" : [ { - "customPlaygroundType" : "device", - "playground" : "standard", + "customPlaygroundType" : "local", + "playground" : "custom", "type" : "uni-app:app-android" } ] diff --git a/美国版/Food Labeling Management App UniApp/docs/native-fast-printer-custom-base.md b/美国版/Food Labeling Management App UniApp/docs/native-fast-printer-custom-base.md new file mode 100644 index 0000000..941fbff --- /dev/null +++ b/美国版/Food Labeling Management App UniApp/docs/native-fast-printer-custom-base.md @@ -0,0 +1,53 @@ +# native-fast-printer 自定义基座接入(Windows) + +本文用于当前项目一键接入 `native-fast-printer`,并打出可安装的 Android 自定义基座。 + +## 0. 现状确认 + +本项目已具备以下前提: + +- `src/manifest.json` 已声明 `app-plus.nativePlugins.native-fast-printer` +- `nativeplugins/native-fast-printer` 目录可用 +- 打印逻辑已在运行时检查插件可用性 + +你只需要执行同步 + 在 HBuilderX 打自定义基座。 + +## 1. 同步插件到 uniapp 目录 + +在仓库根目录执行: + +```powershell +powershell -ExecutionPolicy Bypass -File ".\美国版\Food Labeling Management App UniApp\scripts\sync-native-fast-printer.ps1" +``` + +成功后会输出 `SRC AAR` / `DST AAR` 的大小与时间戳。 + +## 2. HBuilderX 打包自定义基座(Android) + +1. 用 HBuilderX 打开目录:`美国版/Food Labeling Management App UniApp` +2. 进入 `发行 -> 原生App-云打包` +3. 选择 `Android` +4. 关键项: + - 勾选 `自定义基座` + - 勾选 `使用本地 nativeplugins` + - 确认插件列表包含 `native-fast-printer` +5. 开始打包并下载生成的 APK(自定义基座) +6. 卸载设备旧包,安装这个新 APK + +## 3. 安装后验收 + +1. 打开蓝牙页,连接目标打印机 +2. 执行测试打印 +3. 进入正式打印页打印 1 张 +4. 若插件成功生效,不应再出现 `NATIVE_FAST_PRINTER_PLUGIN_NOT_FOUND` + +## 4. 常见问题 + +- 打包后仍提示插件不存在 + 多数是安装了旧包。请先卸载旧包再安装新 APK。 + +- HBuilderX 未识别 native plugin + 检查 `nativeplugins/native-fast-printer/package.json` 是否存在且 `id` 为 `native-fast-printer`。 + +- 需要更新原生代码 + 修改 `打印机安卓基座/native-fast-printer` 后,重新生成 AAR 并再次执行第 1 步同步。 diff --git a/美国版/Food Labeling Management App UniApp/nativeplugins/native-fast-printer/README.md b/美国版/Food Labeling Management App UniApp/nativeplugins/native-fast-printer/README.md index b2b5996..77c40a8 100644 --- a/美国版/Food Labeling Management App UniApp/nativeplugins/native-fast-printer/README.md +++ b/美国版/Food Labeling Management App UniApp/nativeplugins/native-fast-printer/README.md @@ -13,12 +13,28 @@ ```js const printer = uni.requireNativePlugin('native-fast-printer') ``` -fan + ## 方法 - `connect(params, callback)` - `disconnect(callback)` - `isConnected(callback)` - `printTemplate(params, callback)` +## 源码位置 +- 当前目录是源码主目录 +- `美国版/Food Labeling Management App UniApp/nativeplugins/native-fast-printer/` 是同步后的 uni-app 打包镜像 + +## 目录结构 +- `android-src/src/com/foodlabel/nativeprinter/` + - `NativeFastPrinterModule.java`:uni-app 原生模块入口 + - `transport/`:蓝牙连接与 SDK 传输层 + - `template/`:系统模板 JSON → TSC 指令 + - `debug/`:调试状态与统计信息 + - `support/`:结果对象、JSON 读取、异常展开 +- `android/`:编译产物 AAR +- `sync-to-uniapp.sh`:同步到 uni-app 打包镜像 + ## 说明 -修改源码后可执行 `android-src/build-aar.sh` 重新生成 AAR。 +1. 修改源码后执行 `android-src/build-aar.sh` +2. 再执行 `sync-to-uniapp.sh` +3. 重新打包 uni-app 自定义基座 diff --git a/美国版/Food Labeling Management App UniApp/package.json b/美国版/Food Labeling Management App UniApp/package.json index d91e925..b4f445b 100644 --- a/美国版/Food Labeling Management App UniApp/package.json +++ b/美国版/Food Labeling Management App UniApp/package.json @@ -2,6 +2,7 @@ "name": "food-labeling-management-app-uniapp", "version": "0.0.0", "scripts": { + "sync:native-fast-printer": "powershell -ExecutionPolicy Bypass -File scripts/sync-native-fast-printer.ps1", "dev:custom": "uni -p", "dev:h5": "uni", "dev:h5:ssr": "uni --ssr", diff --git a/美国版/Food Labeling Management App UniApp/scripts/sync-native-fast-printer.ps1 b/美国版/Food Labeling Management App UniApp/scripts/sync-native-fast-printer.ps1 new file mode 100644 index 0000000..2a2fa34 --- /dev/null +++ b/美国版/Food Labeling Management App UniApp/scripts/sync-native-fast-printer.ps1 @@ -0,0 +1,45 @@ +$ErrorActionPreference = "Stop" + +$appRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path +$repoRoot = Split-Path -Parent (Split-Path -Parent $appRoot) +$dstPluginRoot = Join-Path $appRoot "nativeplugins\native-fast-printer" +$manifestPath = Join-Path $appRoot "src\manifest.json" + +Write-Host "[1/4] Validate source plugin files..." +$sourceAarItem = Get-ChildItem -LiteralPath $repoRoot -Recurse -File -Filter "native_fast_printer-release.aar" | + Where-Object { $_.FullName -notlike "*\nativeplugins\native-fast-printer\android\*" } | + Select-Object -First 1 +if ($null -eq $sourceAarItem) { + throw "AAR not found under repository root: $repoRoot" +} + +$srcPluginRoot = Split-Path -Parent (Split-Path -Parent $sourceAarItem.FullName) +$srcAar = $sourceAarItem.FullName +$srcPkg = Join-Path $srcPluginRoot "package.json" +$srcReadme = Join-Path $srcPluginRoot "README.md" +if (!(Test-Path -LiteralPath $srcPkg)) { throw "package.json not found: $srcPkg" } +if (!(Test-Path -LiteralPath $srcReadme)) { throw "README.md not found: $srcReadme" } + +Write-Host "[2/4] Sync files into uniapp nativeplugins..." +if (Test-Path -LiteralPath $dstPluginRoot) { + Remove-Item -LiteralPath $dstPluginRoot -Recurse -Force +} +New-Item -ItemType Directory -Path (Join-Path $dstPluginRoot "android") -Force | Out-Null +Copy-Item -LiteralPath $srcPkg -Destination (Join-Path $dstPluginRoot "package.json") +Copy-Item -LiteralPath $srcReadme -Destination (Join-Path $dstPluginRoot "README.md") +Copy-Item -LiteralPath $srcAar -Destination (Join-Path $dstPluginRoot "android\native_fast_printer-release.aar") + +Write-Host "[3/4] Validate manifest plugin declaration..." +if (!(Test-Path -LiteralPath $manifestPath)) { throw "manifest not found: $manifestPath" } +$manifestContent = Get-Content -LiteralPath $manifestPath -Raw +if ($manifestContent -notmatch '"native-fast-printer"\s*:\s*\{') { + throw "manifest.json missing app-plus.nativePlugins.native-fast-printer declaration" +} + +Write-Host "[4/4] Print summary..." +$srcInfo = Get-Item -LiteralPath $srcAar +$dstAar = Join-Path $dstPluginRoot "android\native_fast_printer-release.aar" +$dstInfo = Get-Item -LiteralPath $dstAar +Write-Host "SRC AAR: $($srcInfo.Length) bytes, $($srcInfo.LastWriteTime.ToString("s"))" +Write-Host "DST AAR: $($dstInfo.Length) bytes, $($dstInfo.LastWriteTime.ToString("s"))" +Write-Host "Done: native-fast-printer synced. Next: build custom base in HBuilderX." diff --git a/美国版/Food Labeling Management App UniApp/src/manifest.json b/美国版/Food Labeling Management App UniApp/src/manifest.json index 8287d82..fdb5ff2 100644 --- a/美国版/Food Labeling Management App UniApp/src/manifest.json +++ b/美国版/Food Labeling Management App UniApp/src/manifest.json @@ -1,6 +1,6 @@ { "name" : "food.labeling", - "appid" : "__UNI__1BFD76D", + "appid" : "__UNI__5C033BE", "description" : "", "versionName" : "1.0.5", "versionCode" : 105, @@ -16,6 +16,9 @@ "autoclose" : true, "delay" : 0 }, + "compatible" : { + "ignoreVersion" : true + }, /* 模块配置 */ "modules" : { "Camera" : {}, diff --git a/美国版/Food Labeling Management App UniApp/src/pages/labels/bluetooth.vue b/美国版/Food Labeling Management App UniApp/src/pages/labels/bluetooth.vue index 009b940..0f428f9 100644 --- a/美国版/Food Labeling Management App UniApp/src/pages/labels/bluetooth.vue +++ b/美国版/Food Labeling Management App UniApp/src/pages/labels/bluetooth.vue @@ -190,6 +190,7 @@ import { ensureBluetoothPermissions } from '../../utils/print/bluetoothPermissio import { getNativeFastPrinterDebugInfo, getNativeFastPrinterState, + isNativeFastPrinterAvailable, } from '../../utils/print/nativeFastPrinter' import { connectBluetoothPrinter, @@ -530,20 +531,96 @@ const handleUseBuiltin = () => { } const testPrinting = ref(false) +function withTimeout (promise: Promise, ms: number, message: string): Promise { + return new Promise((resolve, reject) => { + const tid = setTimeout(() => reject(new Error(message)), ms) + promise.then( + (v) => { + clearTimeout(tid) + resolve(v) + }, + (e) => { + clearTimeout(tid) + reject(e) + } + ) + }) +} + +function buildTestPrintDebugText (): string { + const summary = getCurrentPrinterSummary() + const classicState = typeof classicBluetooth?.getDebugState === 'function' + ? classicBluetooth.getDebugState() + : null + const lines: string[] = [ + `driver=${summary.driverKey || '-'}/${summary.driverName || '-'}`, + `protocol=${summary.protocol || '-'}`, + `deviceType=${summary.deviceType || '-'}`, + `transport=${(summary as any).transportMode || '-'}`, + ] + if (classicState) { + lines.push(`state=${classicState.connectionState || '-'}`) + lines.push(`connected=${String(!!classicState.socketConnected)}`) + lines.push(`outputReady=${String(!!classicState.outputReady)}`) + lines.push(`sendMode=${classicState.lastSendMode || '-'}`) + if (classicState.lastSendError || classicState.lastError) { + lines.push(`lastError=${classicState.lastSendError || classicState.lastError}`) + } + } + return lines.join('\n') +} + /** 自检测试页,不落库接口 9(仅预览页业务打印成功后上报) */ const handleTestPrint = async () => { if (testPrinting.value) return + const summaryPreflight = getCurrentPrinterSummary() + const classicStatePreflight = typeof classicBluetooth?.getDebugState === 'function' + ? classicBluetooth.getDebugState() + : null + const isVirtualBtPrinter = String(classicStatePreflight?.deviceName || '').toLowerCase().includes('virtual bt printer') + || String(summaryPreflight.driverName || '').toLowerCase().includes('virtual bt printer') + if ( + summaryPreflight.type === 'bluetooth' && + summaryPreflight.driverKey === 'd320fax' && + isVirtualBtPrinter && + !isNativeFastPrinterAvailable() + ) { + uni.showModal({ + title: 'Print Not Supported In Current Build', + content: + 'Virtual BT Printer (D320FAX) requires native-fast-printer in this app build. Please use a build that includes this plugin, or switch to a non-virtual Bluetooth printer.', + showCancel: false, + }) + return + } testPrinting.value = true + let watchdog: ReturnType | null = null try { uni.showLoading({ title: 'Sending test job...', mask: true }) - await testPrintCurrentPrinter() - await refreshNativeDebug() + watchdog = setTimeout(() => { + try { uni.hideLoading() } catch (_) {} + console.warn('[bluetooth] TEST_PRINT_TIMEOUT watchdog', buildTestPrintDebugText()) + }, 35000) + + await Promise.race([ + testPrintCurrentPrinter((percent) => { + if (percent > 0 && percent < 100) { + uni.showLoading({ title: `Sending ${percent}%`, mask: true }) + } + }), + new Promise((_, reject) => setTimeout(() => reject(new Error('TEST_PRINT_TIMEOUT')), 25000)), + ]) + await withTimeout(refreshNativeDebug(), 1500, 'DEBUG_TIMEOUT') uni.hideLoading() uni.showToast({ title: 'Test print sent!', icon: 'success' }) } catch (e: any) { - await refreshNativeDebug() + try { await withTimeout(refreshNativeDebug(), 1200, 'DEBUG_TIMEOUT') } catch (_) {} uni.hideLoading() const msg = (e && e.message) ? e.message : 'Please check printer connection.' + if (msg === 'TEST_PRINT_TIMEOUT' || msg === 'DEBUG_TIMEOUT') { + console.warn('[bluetooth] test print timeout', msg, buildTestPrintDebugText()) + return + } if (msg === 'BUILTIN_PLUGIN_NOT_FOUND') { uni.showModal({ title: 'Use Bluetooth Mode', @@ -552,13 +629,15 @@ const handleTestPrint = async () => { success: () => { switchType('bluetooth') }, }) } else { + const debugText = buildTestPrintDebugText() uni.showModal({ title: 'Print Failed', - content: msg, + content: `${msg}\n\n${debugText}`.trim(), showCancel: false, }) } } finally { + if (watchdog) clearTimeout(watchdog) testPrinting.value = false } } diff --git a/美国版/Food Labeling Management App UniApp/src/pages/labels/preview.vue b/美国版/Food Labeling Management App UniApp/src/pages/labels/preview.vue index 65c94f1..8b2d49c 100644 --- a/美国版/Food Labeling Management App UniApp/src/pages/labels/preview.vue +++ b/美国版/Food Labeling Management App UniApp/src/pages/labels/preview.vue @@ -80,13 +80,47 @@ {{ freeFieldNameLabel(el) }} - + + + + @@ -169,6 +203,37 @@ + + + + {{ pickerDialogTitle }} + + + {{ y }} + + + {{ m }} + + + {{ d }} + + + {{ h }} + + + {{ m }} + + + + Cancel + Confirm + + + @@ -186,7 +251,10 @@ import { getCurrentPrinterDriver, printImageForCurrentPrinter, printLabelPrintJobPayloadForCurrentPrinter, + printSystemTemplateForCurrentPrinter, } from '../../utils/print/manager/printerManager' +import classicBluetooth from '../../utils/print/bluetoothTool.js' +import { getNativeFastPrinterState, isNativeFastPrinterAvailable } from '../../utils/print/nativeFastPrinter' import type { SystemLabelTemplate, SystemTemplateElementBase } from '../../utils/print/types/printer' import { fetchLabelMultipleOptionById } from '../../services/labelMultipleOption' import { @@ -227,10 +295,17 @@ import { renderLabelPreviewCanvasToTempPathForPrint, renderLabelPreviewToTempPath, } from '../../utils/labelPreview/renderLabelPreviewCanvas' -import { templateHasUnsupportedNativeFastElements } from '../../utils/print/nativeTemplateElementSupport' +import { + hydrateSystemTemplateImagesForPrint, + resetHydrateImageDebugRecords, +} from '../../utils/print/hydrateTemplateImagesForPrint' +import { + normalizeTemplateForNativeFastJob, + templateHasUnsupportedNativeFastElements, +} from '../../utils/print/nativeTemplateElementSupport' import { isTemplateWithinNativeFastPrintBounds } from '../../utils/print/templatePhysicalMm' import { isPrinterReadySync } from '../../utils/print/printerReadiness' -import { getBluetoothConnection } from '../../utils/print/printerConnection' +import { ensureNativeClassicTransportIfPossible, getBluetoothConnection } from '../../utils/print/printerConnection' import { isUsAppSessionExpiredError } from '../../utils/usAppApiRequest' const statusBarHeight = getStatusBarHeight() @@ -244,6 +319,106 @@ const showNoPrinterModal = ref(false) const btConnected = ref(false) const btDeviceName = ref('') +function buildPrintDebugText(extra?: Record): string { + const summary = getCurrentPrinterSummary() + const conn = getBluetoothConnection() + const classicState = typeof classicBluetooth?.getDebugState === 'function' + ? classicBluetooth.getDebugState() + : null + const native = getNativeFastPrinterState() || {} + const lines: string[] = [ + `mode=${summary.type || '-'}`, + `driver=${summary.driverKey || '-'}/${summary.driverName || '-'}`, + `protocol=${summary.protocol || '-'}`, + `deviceType=${summary.deviceType || '-'}`, + conn?.deviceId ? `device=${conn.deviceId}` : '', + conn?.deviceName ? `deviceName=${conn.deviceName}` : '', + (conn as any)?.transportMode ? `transport=${String((conn as any).transportMode)}` : '', + native?.available === false ? `nativeFast=${native.lastError || 'unavailable'}` : '', + ].filter(Boolean) + if (classicState) { + lines.push(`classicState=${classicState.connectionState || '-'}`) + lines.push(`connected=${String(!!classicState.socketConnected)}`) + lines.push(`outputReady=${String(!!classicState.outputReady)}`) + lines.push(`sendMode=${classicState.lastSendMode || '-'}`) + if (classicState.lastSocketStrategy) lines.push(`socket=${classicState.lastSocketStrategy}`) + if (classicState.lastSendError) lines.push(`sendError=${classicState.lastSendError}`) + if (classicState.lastSendError || classicState.lastError) { + lines.push(`lastError=${classicState.lastSendError || classicState.lastError}`) + } + } + if (extra) { + Object.keys(extra).forEach((k) => { + const v = (extra as any)[k] + if (v === undefined || v === null || v === '') return + lines.push(`${k}=${String(v)}`) + }) + } + return lines.join('\n') +} + +function withTimeout(promise: Promise, ms: number, message: string): Promise { + return new Promise((resolve, reject) => { + const tid = setTimeout(() => reject(new Error(message)), ms) + promise.then( + (v) => { clearTimeout(tid); resolve(v) }, + (e) => { clearTimeout(tid); reject(e) }, + ) + }) +} + +/** 打印进度:全程 0–100%;节流避免经典蓝牙按块回调时 showLoading 过频卡顿(从 0 第一次前进允许 1%) */ +let lastShownPrintPct = -999 +function showPrintProgress (percent: number) { + const p = Math.max(0, Math.min(100, Math.round(percent))) + const firstStepFromZero = lastShownPrintPct === 0 && p > 0 + if ( + !firstStepFromZero && + p !== 0 && + p !== 100 && + Math.abs(p - lastShownPrintPct) < 2 + ) { + return + } + lastShownPrintPct = p + try { + uni.showLoading({ title: `Printing ${p}%`, mask: true }) + } catch (_) {} +} + +async function ensureClassicReadyForPrint(): Promise { + const summary = getCurrentPrinterSummary() + const conn = getBluetoothConnection() + if (summary.type !== 'bluetooth' || conn?.deviceType !== 'classic') return + await ensureNativeClassicTransportIfPossible() + await new Promise((resolve, reject) => { + const tryConnect = typeof classicBluetooth?.connDevice === 'function' + if (!tryConnect) { + reject(new Error('CLASSIC_CONNECT_API_MISSING')) + return + } + let settled = false + const timeoutId = setTimeout(() => { + if (settled) return + settled = true + reject(new Error('CLASSIC_CONNECT_TIMEOUT')) + }, 8000) + try { + classicBluetooth.connDevice(conn.deviceId, (ok: boolean) => { + if (settled) return + settled = true + clearTimeout(timeoutId) + if (ok) resolve() + else reject(new Error(classicBluetooth.getLastError?.() || 'CLASSIC_CONNECT_FAILED')) + }) + } catch (e: any) { + if (settled) return + settled = true + clearTimeout(timeoutId) + reject(e instanceof Error ? e : new Error(String(e || 'CLASSIC_CONNECT_EXCEPTION'))) + } + }) +} const labelCode = ref('') const productId = ref('') @@ -266,6 +441,27 @@ const printOptionSelections = ref>({}) const dictLabelsByElementId = ref>({}) const dictValuesByElementId = ref>({}) const printFreeFieldValues = ref>({}) +const pickerDialogVisible = ref(false) +const pickerMode = ref<'date' | 'time'>('date') +const pickerSelection = ref([0, 0, 0]) +const pickerTargetId = ref('') +const pickerTargetKind = ref<'date' | 'time' | 'datetime'>('date') +const pickerTargetFormat = ref('') +const pickerDialogTitle = computed(() => (pickerMode.value === 'date' ? 'Select date' : 'Select time')) +const pickerYears = computed(() => { + const now = new Date().getFullYear() + return Array.from({ length: 21 }, (_, i) => String(now - 10 + i)) +}) +const pickerMonths = computed(() => Array.from({ length: 12 }, (_, i) => String(i + 1).padStart(2, '0'))) +const pickerHours = computed(() => Array.from({ length: 24 }, (_, i) => String(i).padStart(2, '0'))) +const pickerMinutes = computed(() => Array.from({ length: 60 }, (_, i) => String(i).padStart(2, '0'))) +const pickerDays = computed(() => { + if (pickerMode.value !== 'date') return [] + const year = Number(pickerYears.value[pickerSelection.value[0]] || new Date().getFullYear()) + const month = Number(pickerMonths.value[pickerSelection.value[1]] || 1) + const dayCount = new Date(year, month, 0).getDate() + return Array.from({ length: dayCount }, (_, i) => String(i + 1).padStart(2, '0')) +}) let freeFieldPreviewTimer: ReturnType | null = null @@ -324,6 +520,188 @@ function freeFieldPlaceholder(el: SystemTemplateElementBase): string { return '' } +function freeFieldDateFormat(el: SystemTemplateElementBase): string { + const c = el.config || {} + return String(c.format ?? c.Format ?? '').trim() +} + +function freeFieldInputKind(el: SystemTemplateElementBase): 'text' | 'date' | 'time' | 'datetime' { + const type = String(el.type || '').toUpperCase() + const c = el.config || {} + const inputType = String(c.inputType ?? c.InputType ?? '').toLowerCase() + if (type === 'TIME') return 'time' + if (type === 'DATE' && inputType === 'datetime') return 'datetime' + if (type === 'DATE') return 'date' + return 'text' +} + +function todayYmd(): string { + const d = new Date() + const y = d.getFullYear() + const m = String(d.getMonth() + 1).padStart(2, '0') + const day = String(d.getDate()).padStart(2, '0') + return `${y}-${m}-${day}` +} + +function pickerDateValue(raw: string | undefined, format: string): string { + const v = String(raw || '').trim() + if (!v) return todayYmd() + const datePart = v.split(' ')[0] + if (/^\d{4}-\d{2}-\d{2}$/.test(datePart)) return datePart + if (/^\d{2}\/\d{2}\/\d{4}$/.test(datePart)) { + const [a, b, c] = datePart.split('/') + if (format.startsWith('DD/')) return `${c}-${b}-${a}` + return `${c}-${a}-${b}` + } + return todayYmd() +} + +function pickerTimeValue(raw: string | undefined): string { + const v = String(raw || '').trim() + const m = v.match(/(\d{2}:\d{2})/) + return m?.[1] || '12:00' +} + +function formatYmdByPattern(ymd: string, format: string): string { + const [y, m, d] = ymd.split('-') + if (!y || !m || !d) return ymd + if (format.startsWith('DD/')) return `${d}/${m}/${y}` + if (format.startsWith('MM/')) return `${m}/${d}/${y}` + return `${y}-${m}-${d}` +} + +function displayDateValue(raw: string | undefined, format: string, fallback: string): string { + const v = String(raw || '').trim() + if (v) return v.split(' ')[0] + return fallback || 'Select date' +} + +function displayTimeValue(raw: string | undefined): string { + const v = String(raw || '').trim() + const m = v.match(/(\d{2}:\d{2})/) + return m?.[1] || 'Select time' +} + +function parseExistingDateParts(raw: string): { y: string; m: string; d: string } { + const v = String(raw || '').trim() + if (!v) { + const t = todayYmd().split('-') + return { y: t[0], m: t[1], d: t[2] } + } + const datePart = v.split(' ')[0] + if (/^\d{4}-\d{2}-\d{2}$/.test(datePart)) { + const [y, m, d] = datePart.split('-') + return { y, m, d } + } + if (/^\d{2}\/\d{2}\/\d{4}$/.test(datePart)) { + const [a, b, c] = datePart.split('/') + return { y: c, m: b, d: a } + } + const t = todayYmd().split('-') + return { y: t[0], m: t[1], d: t[2] } +} + +function openFreeFieldPicker(el: SystemTemplateElementBase, mode: 'date' | 'time') { + pickerTargetId.value = el.id + pickerTargetKind.value = freeFieldInputKind(el) + pickerTargetFormat.value = freeFieldDateFormat(el) + pickerMode.value = mode + const currentRaw = String(printFreeFieldValues.value[el.id] || '').trim() + if (mode === 'date') { + const p = parseExistingDateParts(currentRaw) + const yi = Math.max(0, pickerYears.value.indexOf(p.y)) + const mi = Math.max(0, pickerMonths.value.indexOf(p.m)) + const dd = Array.from({ length: new Date(Number(p.y), Number(p.m), 0).getDate() }, (_, i) => String(i + 1).padStart(2, '0')) + const di = Math.max(0, dd.indexOf(p.d)) + pickerSelection.value = [yi, mi, di] + } else { + const hhmm = pickerTimeValue(currentRaw).split(':') + const hi = Math.max(0, pickerHours.value.indexOf(hhmm[0] || '12')) + const mi = Math.max(0, pickerMinutes.value.indexOf(hhmm[1] || '00')) + pickerSelection.value = [hi, mi] + } + pickerDialogVisible.value = true +} + +function closeFreeFieldPicker() { + pickerDialogVisible.value = false +} + +function onPickerViewChange(e: { detail?: { value?: number[] } }) { + const v = e.detail?.value || [] + pickerSelection.value = Array.isArray(v) ? v : [] +} + +function confirmFreeFieldPicker() { + const id = pickerTargetId.value + if (!id) { + pickerDialogVisible.value = false + return + } + const prev = String(printFreeFieldValues.value[id] || '').trim() + if (pickerMode.value === 'date') { + const y = pickerYears.value[pickerSelection.value[0]] || String(new Date().getFullYear()) + const m = pickerMonths.value[pickerSelection.value[1]] || '01' + const d = pickerDays.value[pickerSelection.value[2]] || '01' + const formatted = formatYmdByPattern(`${y}-${m}-${d}`, pickerTargetFormat.value || 'YYYY-MM-DD') + if (pickerTargetKind.value === 'datetime') { + const timePart = pickerTimeValue(prev) + printFreeFieldValues.value = { ...printFreeFieldValues.value, [id]: `${formatted} ${timePart}` } + } else { + printFreeFieldValues.value = { ...printFreeFieldValues.value, [id]: formatted } + } + } else { + const h = pickerHours.value[pickerSelection.value[0]] || '12' + const m = pickerMinutes.value[pickerSelection.value[1]] || '00' + const hhmm = `${h}:${m}` + if (pickerTargetKind.value === 'datetime') { + const datePart = prev.split(' ')[0] || formatYmdByPattern(todayYmd(), pickerTargetFormat.value || 'YYYY-MM-DD') + printFreeFieldValues.value = { ...printFreeFieldValues.value, [id]: `${datePart} ${hhmm}` } + } else { + printFreeFieldValues.value = { ...printFreeFieldValues.value, [id]: hhmm } + } + } + if (freeFieldPreviewTimer != null) clearTimeout(freeFieldPreviewTimer) + freeFieldPreviewTimer = setTimeout(() => { + freeFieldPreviewTimer = null + void refreshPreviewFromSelections() + }, 180) + pickerDialogVisible.value = false +} + +function onFreeFieldDateChange(el: SystemTemplateElementBase, e: { detail?: { value?: string } }) { + const ymd = String(e.detail?.value || '').trim() + if (!ymd) return + const id = el.id + const kind = freeFieldInputKind(el) + const formatted = formatYmdByPattern(ymd, freeFieldDateFormat(el)) + const prev = String(printFreeFieldValues.value[id] || '').trim() + if (kind === 'datetime') { + const timePart = pickerTimeValue(prev) + printFreeFieldValues.value = { ...printFreeFieldValues.value, [id]: `${formatted} ${timePart}` } + } else { + printFreeFieldValues.value = { ...printFreeFieldValues.value, [id]: formatted } + } + if (freeFieldPreviewTimer != null) clearTimeout(freeFieldPreviewTimer) + freeFieldPreviewTimer = setTimeout(() => { + freeFieldPreviewTimer = null + void refreshPreviewFromSelections() + }, 180) +} + +function onFreeFieldTimeChange(elementId: string, e: { detail?: { value?: string } }) { + const timeVal = String(e.detail?.value || '').trim() + if (!timeVal) return + const prev = String(printFreeFieldValues.value[elementId] || '').trim() + const datePart = prev.split(' ')[0] || formatYmdByPattern(todayYmd(), 'YYYY-MM-DD') + printFreeFieldValues.value = { ...printFreeFieldValues.value, [elementId]: `${datePart} ${timeVal}` } + if (freeFieldPreviewTimer != null) clearTimeout(freeFieldPreviewTimer) + freeFieldPreviewTimer = setTimeout(() => { + freeFieldPreviewTimer = null + void refreshPreviewFromSelections() + }, 180) +} + function onFreeFieldInput(elementId: string, e: { detail?: { value?: string } }) { const v = e.detail?.value ?? '' printFreeFieldValues.value = { ...printFreeFieldValues.value, [elementId]: v } @@ -585,8 +963,56 @@ const handlePrint = async () => { } } + try { + await ensureClassicReadyForPrint() + } catch (e: any) { + const msg = e?.message ? String(e.message) : 'CLASSIC_NOT_READY' + uni.showModal({ + title: 'Printer Not Ready', + content: `${msg}\n\n${buildPrintDebugText({ stage: 'preflight' })}`.trim(), + showCancel: false, + }) + return + } + + // Virtual BT Printer 在当前基座缺少 native-fast-printer 插件时容易出现“发送中卡死”。 + // 先 fail-fast,避免进入长时间无响应流程。 + const summaryPreflight = getCurrentPrinterSummary() + const connPreflight = getBluetoothConnection() + const isVirtualBtPrinter = String(connPreflight?.deviceName || '').toLowerCase().includes('virtual bt printer') + if ( + summaryPreflight.type === 'bluetooth' && + summaryPreflight.driverKey === 'd320fax' && + isVirtualBtPrinter && + !isNativeFastPrinterAvailable() + ) { + uni.showModal({ + title: 'Print Not Supported In Current Build', + content: + 'Virtual BT Printer (D320FAX) requires native-fast-printer in this app build. Please use a build that includes this plugin, or switch to a non-virtual Bluetooth printer.', + showCancel: false, + }) + return + } + isPrinting.value = true + let watchdog: ReturnType | null = null + let globalWatchdog: ReturnType | null = null + const startedAt = Date.now() + let printStage = 'start' + let timeoutHandledByWatchdog = false try { + lastShownPrintPct = -999 + globalWatchdog = setTimeout(() => { + timeoutHandledByWatchdog = true + try { uni.hideLoading() } catch (_) {} + isPrinting.value = false + console.warn( + '[preview] PRINT_TIMEOUT_GLOBAL', + buildPrintDebugText({ stage: printStage, elapsedMs: Date.now() - startedAt, qty: printQty.value }), + ) + }, 70000) + uni.showLoading({ title: 'Rendering…', mask: true }) /** 按 label-template-*.json 结构组装 template + printInputJson;出纸与 Test Print 相同:PNG → Bitmap → TSC → BLE */ const mergedForPrint = computeMergedPreviewTemplate() @@ -600,36 +1026,201 @@ const handlePrint = async () => { printOptionSelections.value, printFreeFieldValues.value ) - const labelPrintJobPayload = buildLabelPrintJobPayload(tmpl, printInputJson, { - labelCode: labelCode.value, - productId: productId.value || undefined, - printQuantity: printQty.value, - locationId: getCurrentStoreId() || undefined, - }) - setLastLabelPrintJobPayload(labelPrintJobPayload) - + printStage = 'payload-ready' /** - * 原生 printTemplate:① 物理尺寸超常见标签幅宽则回退光栅;② 含 WEIGHT/DATE/LOGO 等原生未实现类型时回退光栅(与画布一致,避免假成功)。 + * 一体机(经典蓝牙 + native-fast-printer 基座,如 Virtual BT):走原生 printLabelPrintJob。 + * 普通蓝牙(BLE 或 classic+JS socket):canPrintCurrentLabelViaNativeFastJob 为 false,走下方光栅/直发 TSC。 */ + const tmplForNativeJob = normalizeTemplateForNativeFastJob(tmpl, printInputJson as any) const useNativeTemplatePrint = canPrintCurrentLabelViaNativeFastJob() && isTemplateWithinNativeFastPrintBounds(tmpl) - && !templateHasUnsupportedNativeFastElements(tmpl) + && !templateHasUnsupportedNativeFastElements(tmplForNativeJob) + /** 基座只认本地路径;http(s)、/picture/ 须先下载,否则 IMAGE 整块丢失 */ + let tmplForNativePayload = tmplForNativeJob if (useNativeTemplatePrint) { + resetHydrateImageDebugRecords() + tmplForNativePayload = await hydrateSystemTemplateImagesForPrint(tmplForNativeJob) + } + const labelPrintJobPayload = buildLabelPrintJobPayload( + useNativeTemplatePrint ? tmplForNativePayload : tmpl, + printInputJson, + { + labelCode: labelCode.value, + productId: productId.value || undefined, + printQuantity: printQty.value, + locationId: getCurrentStoreId() || undefined, + }, + ) + setLastLabelPrintJobPayload(labelPrintJobPayload) + + /** + * 原生 printTemplate:物理尺寸超幅宽则回退光栅;规范化后仍有原生未覆盖元素则回退光栅。 + */ + + if (useNativeTemplatePrint) { + printStage = 'native-print-start' /** 经典蓝牙 + native-fast-printer:template + printInputJson → 原生 printTemplate(仅物理尺寸在热敏标签可打范围内) */ uni.showLoading({ title: 'Printing…', mask: true }) - await printLabelPrintJobPayloadForCurrentPrinter( + watchdog = setTimeout(() => { + timeoutHandledByWatchdog = true + try { uni.hideLoading() } catch (_) {} + isPrinting.value = false + console.warn( + '[preview] PRINT_TIMEOUT native-fast', + buildPrintDebugText({ branch: 'native-fast', stage: printStage, elapsedMs: Date.now() - startedAt, qty: printQty.value }), + ) + }, 45000) + await withTimeout(printLabelPrintJobPayloadForCurrentPrinter( labelPrintJobPayload, { printQty: printQty.value }, (percent) => { - if (percent > 5 && percent < 100) { - uni.showLoading({ title: `Printing ${percent}%`, mask: true }) - } + showPrintProgress(percent) } - ) + ), 40000, 'PRINT_TIMEOUT') + printStage = 'native-print-done' } else { + printStage = 'raster-layout' const driver = getCurrentPrinterDriver() + if (driver.key === 'd320fax') { + const connNow = getBluetoothConnection() + const isVirtualBtPrinter = String(connNow?.deviceName || '').toLowerCase().includes('virtual bt printer') + /** Virtual 整页光栅与屏幕预览同源,可打出 ¥/价格;直发模板在部分环境位图字失败会缺底行 */ + /** 大图光栅 + 慢机可能 >8min;与原生 printCommandBytes 对齐后一般会快很多 */ + const virtualJobMs = 720000 + const nonVirtualRasterMs = 220000 + const nonVirtualDirectMs = 480000 + const globalCapMs = isVirtualBtPrinter ? 780000 : 540000 + const branchWatchMs = isVirtualBtPrinter ? 760000 : 520000 + if (globalWatchdog) { + clearTimeout(globalWatchdog) + globalWatchdog = null + } + globalWatchdog = setTimeout(() => { + timeoutHandledByWatchdog = true + try { uni.hideLoading() } catch (_) {} + isPrinting.value = false + console.warn( + '[preview] PRINT_TIMEOUT_GLOBAL d320fax', + buildPrintDebugText({ stage: printStage, elapsedMs: Date.now() - startedAt, qty: printQty.value }), + ) + }, globalCapMs) + watchdog = setTimeout(() => { + timeoutHandledByWatchdog = true + try { uni.hideLoading() } catch (_) {} + isPrinting.value = false + console.warn( + '[preview] PRINT_TIMEOUT d320fax', + buildPrintDebugText({ branch: 'd320fax', stage: printStage, elapsedMs: Date.now() - startedAt, qty: printQty.value }), + ) + }, branchWatchMs) + if (isVirtualBtPrinter) { + showPrintProgress(0) + try { + printStage = 'd320fax-virtual-raster-start' + await withTimeout( + printSystemTemplateForCurrentPrinter( + tmpl, + printInputJson as any, + { + printQty: printQty.value, + canvasRaster: { + canvasId: 'labelPreviewCanvas', + componentInstance: instance, + applyLayout: (layout) => { + canvasCssW.value = layout.outW + canvasCssH.value = layout.outH + }, + }, + }, + (percent) => showPrintProgress(percent), + ), + virtualJobMs, + 'PRINT_TIMEOUT_RASTER', + ) + printStage = 'd320fax-virtual-raster-done' + } catch (e: any) { + const msg = e?.message ? String(e.message) : '' + // 超时时底层可能仍在发送,若立刻回退直发会导致“一次点击出两张”。 + if (msg.includes('PRINT_TIMEOUT')) { + throw e + } + printStage = 'd320fax-virtual-direct-fallback-start' + showPrintProgress(0) + await withTimeout( + printSystemTemplateForCurrentPrinter( + tmpl, + printInputJson as any, + { printQty: printQty.value }, + (percent) => showPrintProgress(percent), + ), + virtualJobMs, + 'PRINT_TIMEOUT_DIRECT', + ) + printStage = 'd320fax-virtual-direct-fallback-done' + } + } else { + printStage = 'd320fax-raster-start' + showPrintProgress(0) + try { + await withTimeout( + printSystemTemplateForCurrentPrinter( + tmpl, + printInputJson as any, + { + printQty: printQty.value, + canvasRaster: { + canvasId: 'labelPreviewCanvas', + componentInstance: instance, + applyLayout: (layout) => { + canvasCssW.value = layout.outW + canvasCssH.value = layout.outH + }, + }, + }, + (percent) => showPrintProgress(percent), + ), + nonVirtualRasterMs, + 'PRINT_TIMEOUT_RASTER', + ) + printStage = 'd320fax-raster-done' + } catch (e: any) { + const msg = e?.message ? String(e.message) : '' + // 超时时底层可能仍在发送,若立刻回退直发会导致“一次点击出两张”。 + if (msg.includes('PRINT_TIMEOUT')) { + throw e + } + printStage = 'd320fax-direct-fallback-start' + showPrintProgress(0) + await withTimeout( + printSystemTemplateForCurrentPrinter( + tmpl, + printInputJson as any, + { printQty: printQty.value }, + (percent) => showPrintProgress(percent), + ), + nonVirtualDirectMs, + 'PRINT_TIMEOUT_DIRECT_FALLBACK', + ) + printStage = 'd320fax-direct-fallback-done' + } + } + } else { + /** 非 d320fax 整页光栅可能超过 70s,避免 PRINT_TIMEOUT_GLOBAL 先误报 */ + if (globalWatchdog) { + clearTimeout(globalWatchdog) + globalWatchdog = null + } + globalWatchdog = setTimeout(() => { + timeoutHandledByWatchdog = true + try { uni.hideLoading() } catch (_) {} + isPrinting.value = false + console.warn( + '[preview] PRINT_TIMEOUT_GLOBAL raster', + buildPrintDebugText({ stage: printStage, elapsedMs: Date.now() - startedAt, qty: printQty.value }), + ) + }, 360000) const maxDots = driver.imageMaxWidthDots || (driver.protocol === 'esc' ? 384 : 576) const layout = getLabelPrintRasterLayout(tmpl, maxDots, driver.imageDpi || 203) @@ -645,10 +1236,30 @@ const handlePrint = async () => { tmpl, layout ) - - uni.showLoading({ title: 'Printing…', mask: true }) + printStage = 'raster-image-ready' + + showPrintProgress(0) + const genericRasterJobMs = 300000 + watchdog = setTimeout(() => { + timeoutHandledByWatchdog = true + try { uni.hideLoading() } catch (_) {} + isPrinting.value = false + console.warn( + '[preview] PRINT_TIMEOUT raster', + buildPrintDebugText({ + branch: 'raster', + stage: printStage, + elapsedMs: Date.now() - startedAt, + qty: printQty.value, + outW: layout.outW, + outH: layout.outH, + tmpPath: tmpPath ? 'ok' : 'empty', + }), + ) + }, genericRasterJobMs + 30000) /** 与历史验证路径一致:临时 PNG → 解码光栅 → TSC(避免预览页 canvasGetImageData 与打印机页行为不一致) */ - await printImageForCurrentPrinter( + printStage = 'raster-print-start' + await withTimeout(printImageForCurrentPrinter( tmpPath, { printQty: printQty.value, @@ -657,11 +1268,11 @@ const handlePrint = async () => { targetHeightDots: layout.outH, }, (percent) => { - if (percent > 5 && percent < 100) { - uni.showLoading({ title: `Printing ${percent}%`, mask: true }) - } + showPrintProgress(percent) } - ) + ), genericRasterJobMs, 'PRINT_TIMEOUT') + printStage = 'raster-print-done' + } } /** 接口 9:仅本页业务标签出纸后落库(打印机设置/蓝牙 Test Print 不会执行此段) */ @@ -731,7 +1342,13 @@ const handlePrint = async () => { }) } catch (e: any) { uni.hideLoading() + if (timeoutHandledByWatchdog) return const msg = e?.message ? String(e.message) : 'Print failed' + /** withTimeout 触发的超时:不弹窗,仅日志(watchdog 已静默结束打印态) */ + if (msg.includes('PRINT_TIMEOUT')) { + console.warn('[preview] print job timeout (promise)', msg, buildPrintDebugText({ stage: printStage, elapsedMs: Date.now() - startedAt, qty: printQty.value })) + return + } if (msg === 'BUILTIN_PLUGIN_NOT_FOUND' || (msg && msg.indexOf('Built-in printer') !== -1)) { uni.showModal({ title: 'Built-in Print Not Available', @@ -744,16 +1361,27 @@ const handlePrint = async () => { }, }) } else { - uni.showToast({ title: msg, icon: 'none', duration: 3000 }) + uni.showModal({ + title: 'Print Failed', + content: `${msg}\n\n${buildPrintDebugText({ stage: printStage, elapsedMs: Date.now() - startedAt, qty: printQty.value })}`.trim(), + showCancel: false, + }) } } finally { + try { + uni.hideLoading() + } catch (_) {} + if (watchdog) clearTimeout(watchdog) + if (globalWatchdog) clearTimeout(globalWatchdog) const t = systemTemplate.value if (t && instance) { const sz = getPreviewCanvasCssSize(t, 720) canvasCssW.value = sz.width canvasCssH.value = sz.height } - isPrinting.value = false + if (!timeoutHandledByWatchdog) { + isPrinting.value = false + } } } @@ -984,7 +1612,7 @@ const handlePrint = async () => { .chip-row { display: flex; flex-wrap: wrap; - gap: 16rpx; + gap: 22rpx; } .chip { @@ -1021,6 +1649,86 @@ const handlePrint = async () => { border-radius: 12rpx; } +.picker-input { + display: flex; + align-items: center; +} + +.datetime-picker-row { + display: flex; + gap: 16rpx; +} + +.datetime-picker-row picker { + flex: 1; +} + +.picker-dialog-mask { + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.45); + z-index: 2000; + display: flex; + align-items: center; + justify-content: center; + padding: 24rpx; +} + +.picker-dialog { + width: 100%; + max-width: 680rpx; + background: #fff; + border-radius: 20rpx; + overflow: hidden; +} + +.picker-dialog-title { + font-size: 30rpx; + font-weight: 600; + color: #111827; + text-align: center; + padding: 20rpx 24rpx 8rpx; +} + +.picker-view-box { + width: 100%; + height: 420rpx; +} + +.picker-item { + height: 72rpx; + line-height: 72rpx; + text-align: center; + font-size: 30rpx; + color: #111827; +} + +.picker-dialog-actions { + display: flex; + border-top: 1rpx solid #e5e7eb; +} + +.picker-btn { + flex: 1; + height: 88rpx; + line-height: 88rpx; + text-align: center; + font-size: 30rpx; +} + +.picker-btn-cancel { + color: #6b7280; + border-right: 1rpx solid #e5e7eb; +} + +.picker-btn-confirm { + color: var(--theme-primary); + font-weight: 600; +} + .section-title { font-size: 30rpx; font-weight: 600; diff --git a/美国版/Food Labeling Management App UniApp/src/pages/more/print-log.vue b/美国版/Food Labeling Management App UniApp/src/pages/more/print-log.vue index d1e9c4d..6570b44 100644 --- a/美国版/Food Labeling Management App UniApp/src/pages/more/print-log.vue +++ b/美国版/Food Labeling Management App UniApp/src/pages/more/print-log.vue @@ -37,6 +37,7 @@ @@ -162,6 +163,7 @@ const viewMode = ref<'card' | 'list'>('card') const reprintCanvasW = ref(400) const reprintCanvasH = ref(400) +const contentHeight = ref(0) /** 须在 setup 顶层取实例,异步回调里 getCurrentInstance() 为 null */ const reprintCanvasComponentProxy = getCurrentInstance()?.proxy @@ -174,6 +176,22 @@ const applyReprintCanvasLayout: NonNullable { + const inst = getCurrentInstance()?.proxy + if (!inst) return + await nextTick() + const windowHeight = Number(uni.getSystemInfoSync().windowHeight || 0) + const q = uni.createSelectorQuery().in(inst as any) + q.select('.header-hero').boundingClientRect() + q.select('.view-toggle').boundingClientRect() + q.exec((rects: any[]) => { + const headerH = Number(rects?.[0]?.height || 0) + const toggleH = Number(rects?.[1]?.height || 0) + const safe = Math.max(260, Math.round(windowHeight - headerH - toggleH)) + contentHeight.value = safe + }) +} + const items = ref([]) const loading = ref(false) const loadingMore = ref(false) @@ -258,6 +276,7 @@ function onScrollToLower () { } onShow(() => { + computeContentHeight() loadPage(true) }) @@ -273,7 +292,7 @@ const handleReprint = async (row: PrintLogItemDto) => { } uni.showLoading({ title: 'Rendering…', mask: true }) try { - /** 整页 canvas 光栅:与 Label Preview 页「非 native 快打」同路径,图片/中文/¥ 与屏幕一致 */ + /** 与预览一致:一体机/基座可走 native printTemplate,否则整页光栅;图片会先 hydration 再送基座 */ await printFromPrintLogRow(row, { printQty: 1, onProgress: (pct) => { @@ -375,10 +394,9 @@ const goBack = () => { } .content { - flex: 1; padding: 24rpx 28rpx 40rpx; box-sizing: border-box; - height: 0; + min-height: 260px; } .log-list { diff --git a/美国版/Food Labeling Management App UniApp/src/pages/more/printers.vue b/美国版/Food Labeling Management App UniApp/src/pages/more/printers.vue index 8914521..61927bc 100644 --- a/美国版/Food Labeling Management App UniApp/src/pages/more/printers.vue +++ b/美国版/Food Labeling Management App UniApp/src/pages/more/printers.vue @@ -202,6 +202,28 @@ const refreshStatus = () => { : null } +function buildClassicDebugSnapshot (): string { + const summary = getCurrentPrinterSummary() + const debugState = typeof classicBluetooth?.getDebugState === 'function' + ? classicBluetooth.getDebugState() + : null + const lines: string[] = [ + `driver=${summary.driverKey || '-'}/${summary.driverName || '-'}`, + `protocol=${summary.protocol || '-'}`, + `deviceType=${summary.deviceType || '-'}`, + ] + if (debugState) { + lines.push(`classicState=${debugState.connectionState || '-'}`) + lines.push(`connected=${String(!!debugState.socketConnected)}`) + lines.push(`outputReady=${String(!!debugState.outputReady)}`) + lines.push(`sendMode=${debugState.lastSendMode || '-'}`) + if (debugState.lastSendError || debugState.lastError) { + lines.push(`lastError=${debugState.lastSendError || debugState.lastError}`) + } + } + return lines.join('\n') +} + const getTypeLabel = (type?: string) => { switch (type) { case 'classic': return t('printers.classic') @@ -440,7 +462,14 @@ const doTestPrint = async () => { showCancel: false, }) } else { - uni.showToast({ title: t('printers.testPrintFail') + ': ' + msg, icon: 'none' }) + /** 默认系统弹框:不设置大小,直接把调试日志写入 content,便于拍照/复制 */ + const debugText = buildClassicDebugSnapshot() + uni.showModal({ + title: 'Print Failed', + content: `${msg}\n\n${debugText}`.trim(), + confirmText: 'OK', + showCancel: false, + }) } } } diff --git a/美国版/Food Labeling Management App UniApp/src/utils/labelPreview/renderLabelPreviewCanvas.ts b/美国版/Food Labeling Management App UniApp/src/utils/labelPreview/renderLabelPreviewCanvas.ts index 3c1ba91..e73e0b1 100644 --- a/美国版/Food Labeling Management App UniApp/src/utils/labelPreview/renderLabelPreviewCanvas.ts +++ b/美国版/Food Labeling Management App UniApp/src/utils/labelPreview/renderLabelPreviewCanvas.ts @@ -108,9 +108,13 @@ function wrapTextToWidth(text: string, maxChars: number): string[] { function previewTextForElement(element: SystemTemplateElementBase): string { const type = String(element.type || '').toUpperCase() const config = element.config || {} - if (type === 'QRCODE' || type === 'BARCODE') { + if (type === 'QRCODE') { return cfgStr(config, ['data', 'Data', 'value', 'Value']) } + if (type === 'BARCODE') { + // 平台模板条码值常见键:data / barcodeData(含大小写变体) + return cfgStr(config, ['data', 'Data', 'barcodeData', 'BarcodeData', 'value', 'Value']) + } const vst = String(element.valueSourceType || '').toUpperCase() const inputType = String(config.inputType ?? config.InputType ?? '').toLowerCase() const hasDict = !!(config.multipleOptionId ?? config.MultipleOptionId) @@ -164,6 +168,113 @@ function previewExportPixelRatio(): number { } } +function barcodeModulesFromValue(value: string): number[] { + const s = String(value || '').trim() + if (!s) return [] + const modules: number[] = [] + // quiet + start(轻量预览编码:保证视觉稳定,非扫描级编码) + modules.push(1, 0, 1, 0, 1, 0, 1, 0) + for (let i = 0; i < s.length; i++) { + const code = s.charCodeAt(i) & 0xff + // 用 5bit 模块 + 分隔位,避免在窄宽度里“整块发黑”。 + const key = (code ^ (i * 13) ^ (s.length * 7)) & 0x1f + for (let b = 4; b >= 0; b--) modules.push((key >> b) & 1) + modules.push(0) + } + // stop + modules.push(1, 0, 1, 1, 0, 1, 0, 1) + return modules +} + +function drawBarcodeLikePreview( + ctx: UniApp.CanvasContext, + x: number, + y: number, + w: number, + h: number, + value: string, + options?: { orientation?: string; showText?: boolean } +): void { + const bw = Math.max(40, w || 140) + const bh = Math.max(28, h || 56) + const showText = options?.showText !== false + const pad = 2 + const modules = barcodeModulesFromValue(value) + const orientation = String(options?.orientation || 'horizontal').toLowerCase() + const isVertical = orientation === 'vertical' + + ctx.setFillStyle('#ffffff') + ctx.fillRect(x, y, bw, bh) + if (!modules.length) return + + const txt = String(value || '').trim() + ctx.setFillStyle('#111827') + + if (!isVertical) { + const textH = showText && txt ? Math.max(10, Math.round(bh * 0.2)) : 0 + const barH = Math.max(10, bh - textH - pad * 2) + const innerW = Math.max(8, bw - pad * 2) + const moduleW = innerW / modules.length + let cursor = x + pad + for (let i = 0; i < modules.length; i++) { + if (modules[i] === 1) { + const rw = Math.max(0.7, moduleW * 0.86) + ctx.fillRect(cursor, y + pad, rw, barH) + } + cursor += moduleW + } + if (showText && txt) { + ctx.setFontSize(Math.max(9, Math.min(12, Math.round(textH * 0.8)))) + ctx.setTextAlign('center') + ctx.fillText(txt, x + bw / 2, y + bh - 2) + ctx.setTextAlign('left') + } + return + } + + // vertical:条码在左,data 竖排在右 + const textBandW = showText && txt ? Math.max(10, Math.round(bw * 0.18)) : 0 + const barW = Math.max(10, bw - textBandW - pad * 2) + const innerH = Math.max(10, bh - pad * 2) + const moduleH = innerH / modules.length + let cursorY = y + pad + for (let i = 0; i < modules.length; i++) { + if (modules[i] === 1) { + const rh = Math.max(0.7, moduleH * 0.86) + ctx.fillRect(x + pad, cursorY, barW, rh) + } + cursorY += moduleH + } + if (showText && txt) { + const font = Math.max(9, Math.min(11, Math.floor(textBandW * 0.75))) + const cx = x + bw - textBandW / 2 + const cy = y + bh / 2 + const anyCtx = ctx as any + if (typeof anyCtx.save === 'function' && typeof anyCtx.rotate === 'function') { + anyCtx.save() + anyCtx.translate(cx, cy) + // 竖排文本按模板端习惯:从下到上 + anyCtx.rotate(-Math.PI / 2) + ctx.setFontSize(font) + ctx.setTextAlign('center') + ctx.fillText(txt, 0, Math.min(font * 0.35, 4)) + ctx.setTextAlign('left') + anyCtx.restore() + } else { + // 低端环境兜底:不旋转能力时退化为逐字竖排 + let ty = y + pad + font + ctx.setFontSize(font) + ctx.setTextAlign('center') + for (let i = 0; i < txt.length; i++) { + ctx.fillText(txt[i], cx, ty) + ty += font + 1 + if (ty > y + bh - 1) break + } + ctx.setTextAlign('left') + } + } +} + /** 与屏幕预览 / 位图打印共用绘制逻辑(坐标系:设计宽 cw × ch,ctx 已 scale) */ function runLabelPreviewCanvasDraw( canvasId: string, @@ -242,6 +353,14 @@ function runLabelPreviewCanvasDraw( } } + if (type === 'BARCODE' && d) { + const orientation = cfgStr(config, ['orientation', 'Orientation'], 'horizontal') + const showText = String(config.showText ?? config.ShowText ?? 'true').toLowerCase() !== 'false' + drawBarcodeLikePreview(ctx, x, y, w || 140, h || 56, d, { orientation, showText }) + next() + return + } + // 管理端可把二维码默认值存为上传图片路径,须按位图绘制而非占位符文本 if (type === 'QRCODE' && d && storedValueLooksLikeImagePath(d)) { const src = resolveMediaUrlForApp(d) diff --git a/美国版/Food Labeling Management App UniApp/src/utils/print/bluetoothTool.d.ts b/美国版/Food Labeling Management App UniApp/src/utils/print/bluetoothTool.d.ts new file mode 100644 index 0000000..3a2808b --- /dev/null +++ b/美国版/Food Labeling Management App UniApp/src/utils/print/bluetoothTool.d.ts @@ -0,0 +1,15 @@ +declare module './bluetoothTool.js' { + const blueToothTool: any + export default blueToothTool +} + +declare module '../bluetoothTool.js' { + const blueToothTool: any + export default blueToothTool +} + +declare module '../../utils/print/bluetoothTool.js' { + const blueToothTool: any + export default blueToothTool +} + diff --git a/美国版/Food Labeling Management App UniApp/src/utils/print/bluetoothTool.js b/美国版/Food Labeling Management App UniApp/src/utils/print/bluetoothTool.js index c48ba0c..f592d25 100644 --- a/美国版/Food Labeling Management App UniApp/src/utils/print/bluetoothTool.js +++ b/美国版/Food Labeling Management App UniApp/src/utils/print/bluetoothTool.js @@ -548,7 +548,11 @@ var blueToothTool = { // #endif return false }, - sendByteData (byteData) { + /** + * @param {any} byteData + * @param {(percent0to99: number) => void} [onProgress] 按已写字节占比回调 0–99(完成由 sendByteDataAsync 再报 100) + */ + sendByteData (byteData, onProgress) { // #ifdef APP-PLUS if (!btOutStream) { this.state.outputReady = false @@ -567,6 +571,7 @@ var blueToothTool = { } try { const CHUNK_SIZE = 4096 + const total = byteData && byteData.length ? byteData.length : 0 this.state.lastSendMode = 'chunk-write' this.state.lastSendError = '' for (let i = 0; i < byteData.length; i += CHUNK_SIZE) { @@ -580,6 +585,15 @@ var blueToothTool = { invoke(btOutStream, 'write', normalizeWriteByte(signedChunk[j])) } } + if (typeof onProgress === 'function' && total > 0) { + const sent = Math.min(total, i + chunk.length) + const pct = Math.min(99, Math.floor((sent / total) * 100)) + try { + onProgress(pct) + } catch (pe) { + console.error('sendByteData onProgress failed:', pe) + } + } } return true } catch (e) { @@ -592,7 +606,11 @@ var blueToothTool = { // #endif return false }, - sendByteDataAsync (byteData, callback) { + /** + * @param {(ok: boolean, errorMessage?: string) => void} callback + * @param {(percent0to99: number) => void} [onProgress] 发送过程中 0–99 + */ + sendByteDataAsync (byteData, callback, onProgress) { // #ifdef APP-PLUS if (!btOutStream) { this.state.outputReady = false @@ -619,7 +637,7 @@ var blueToothTool = { let ok = false let errorMessage = '' try { - ok = this.sendByteData(byteData) + ok = this.sendByteData(byteData, onProgress) if (!ok) { errorMessage = this.getLastError() || 'Classic Bluetooth send failed' } diff --git a/美国版/Food Labeling Management App UniApp/src/utils/print/hydrateTemplateImagesForPrint.ts b/美国版/Food Labeling Management App UniApp/src/utils/print/hydrateTemplateImagesForPrint.ts index 8b9e847..655c0fb 100644 --- a/美国版/Food Labeling Management App UniApp/src/utils/print/hydrateTemplateImagesForPrint.ts +++ b/美国版/Food Labeling Management App UniApp/src/utils/print/hydrateTemplateImagesForPrint.ts @@ -5,6 +5,51 @@ import { resolveMediaUrlForApp, storedValueLooksLikeImagePath } from '../resolveMediaUrl' import type { SystemLabelTemplate, SystemTemplateElementBase } from './types/printer' +type HydrateDebugStage = 'skip' | 'download-success' | 'download-failed' | 'no-need-download' +type HydrateDebugRecord = { + stage: HydrateDebugStage + payload: Record +} + +const hydrateDebugRecords: HydrateDebugRecord[] = [] +const MAX_HYDRATE_DEBUG_RECORDS = 40 + +function logHydrateDebug ( + stage: HydrateDebugStage, + payload: Record, +): void { + hydrateDebugRecords.push({ stage, payload: { ...payload } }) + if (hydrateDebugRecords.length > MAX_HYDRATE_DEBUG_RECORDS) { + hydrateDebugRecords.splice(0, hydrateDebugRecords.length - MAX_HYDRATE_DEBUG_RECORDS) + } + try { + console.log('[print-image-hydrate]', stage, JSON.stringify(payload)) + } catch { + console.log('[print-image-hydrate]', stage, payload) + } +} + +export function resetHydrateImageDebugRecords (): void { + hydrateDebugRecords.length = 0 +} + +export function getHydrateImageDebugReport (): string { + if (!hydrateDebugRecords.length) return 'No hydrate image records.' + const lines: string[] = [] + hydrateDebugRecords.forEach((r, i) => { + const p = r.payload || {} + lines.push(`#${i + 1} ${r.stage}`) + if (p.elementId != null && p.elementId !== '') lines.push(`id=${String(p.elementId)}`) + if (p.type != null && p.type !== '') lines.push(`type=${String(p.type)}`) + if (p.reason != null && p.reason !== '') lines.push(`reason=${String(p.reason)}`) + if (p.raw != null && p.raw !== '') lines.push(`raw=${String(p.raw)}`) + if (p.resolvedUrl != null && p.resolvedUrl !== '') lines.push(`resolved=${String(p.resolvedUrl)}`) + if (p.tempFilePath != null && p.tempFilePath !== '') lines.push(`temp=${String(p.tempFilePath)}`) + lines.push('---') + }) + return lines.join('\n') +} + /** 与 usAppApiRequest 一致:静态图 /picture/ 常需登录态,无头下载会 401 → 解码失败、纸面空白 */ function downloadAuthHeaders (): Record { const h: Record = {} @@ -29,8 +74,14 @@ function needsDownloadForDecode (raw: string): boolean { if (!s) return false if (s.startsWith('data:')) return false if (s.startsWith('file://')) return false + if (s.startsWith('_doc/') || s.startsWith('_www/') || /^[A-Za-z]:[\\/]/.test(s)) return false if (/^https?:\/\//i.test(s)) return true - if (s.startsWith('/picture/') || s.startsWith('/static/')) return true + if ( + s.startsWith('/picture/') + || s.startsWith('/static/') + || s.startsWith('picture/') + || s.startsWith('static/') + ) return true return false } @@ -41,14 +92,28 @@ function downloadUrlToTempFile (url: string): Promise { return } try { + let done = false + const timer = setTimeout(() => { + if (done) return + done = true + resolve(null) + }, 6000) uni.downloadFile({ url, header: downloadAuthHeaders(), success: (res) => { + if (done) return + done = true + clearTimeout(timer) if (res.statusCode === 200 && res.tempFilePath) resolve(res.tempFilePath) else resolve(null) }, - fail: () => resolve(null), + fail: () => { + if (done) return + done = true + clearTimeout(timer) + resolve(null) + }, }) } catch { resolve(null) @@ -56,33 +121,82 @@ function downloadUrlToTempFile (url: string): Promise { }) } -async function resolveToLocalPathIfNeeded (raw: string): Promise { +async function resolveToLocalPathIfNeeded ( + raw: string, + debugMeta: Record, +): Promise { const trimmed = String(raw || '').trim() - if (!trimmed) return null - if (!needsDownloadForDecode(trimmed)) return null + if (!trimmed) { + logHydrateDebug('skip', { ...debugMeta, reason: 'empty-source' }) + return null + } + if (!needsDownloadForDecode(trimmed)) { + logHydrateDebug('no-need-download', { ...debugMeta, raw: trimmed }) + return null + } const url = resolveMediaUrlForApp(trimmed) - if (!url) return null - return downloadUrlToTempFile(url) + if (!url) { + logHydrateDebug('download-failed', { + ...debugMeta, + raw: trimmed, + reason: 'resolveMediaUrlForApp-empty', + }) + return null + } + const local = await downloadUrlToTempFile(url) + if (local) { + let finalLocal = local + // #ifdef APP-PLUS + try { + const plusAny = (globalThis as any)?.plus + const converted = plusAny?.io?.convertLocalFileSystemURL?.(local) + if (converted && typeof converted === 'string') { + finalLocal = converted + } + } catch (_) {} + // #endif + logHydrateDebug('download-success', { + ...debugMeta, + raw: trimmed, + resolvedUrl: url, + tempFilePath: finalLocal, + }) + return finalLocal + } + logHydrateDebug('download-failed', { + ...debugMeta, + raw: trimmed, + resolvedUrl: url, + reason: 'downloadFile-null', + }) + return null } async function hydrateElement (el: SystemTemplateElementBase): Promise { const type = String(el.type || '').toUpperCase() const cfg = { ...(el.config || {}) } as Record + const debugMeta = { + elementId: String(el.id || ''), + type, + } if (type === 'IMAGE' || type === 'LOGO') { - const raw = cfgStr(cfg, ['src', 'url', 'Src', 'Url']) - const local = await resolveToLocalPathIfNeeded(raw) + const raw = cfgStr(cfg, ['src', 'url', 'data', 'Src', 'Url', 'Data']) + const local = await resolveToLocalPathIfNeeded(raw, debugMeta) if (!local) return el return { ...el, - config: { ...cfg, src: local, url: local, Src: local, Url: local }, + config: { ...cfg, src: local, url: local, data: local, Src: local, Url: local, Data: local }, } } if (type === 'QRCODE') { const raw = cfgStr(cfg, ['data', 'Data']) - if (!raw || !storedValueLooksLikeImagePath(raw)) return el - const local = await resolveToLocalPathIfNeeded(raw) + if (!raw || !storedValueLooksLikeImagePath(raw)) { + logHydrateDebug('skip', { ...debugMeta, raw, reason: 'qrcode-data-not-image-path' }) + return el + } + const local = await resolveToLocalPathIfNeeded(raw, debugMeta) if (!local) return el return { ...el, diff --git a/美国版/Food Labeling Management App UniApp/src/utils/print/manager/printerManager.ts b/美国版/Food Labeling Management App UniApp/src/utils/print/manager/printerManager.ts index 3079bcb..7bf84b8 100644 --- a/美国版/Food Labeling Management App UniApp/src/utils/print/manager/printerManager.ts +++ b/美国版/Food Labeling Management App UniApp/src/utils/print/manager/printerManager.ts @@ -5,10 +5,12 @@ import { getBluetoothConnection, getCurrentPrinterDriverKey, getPrinterType, + isNativeBaseClassicBluetoothTransport, sendToPrinter, setBluetoothConnection, setBuiltinPrinter, } from '../printerConnection' +// @ts-ignore - js bridge module (app-plus only) import classicBluetooth from '../bluetoothTool.js' import { rasterizeImageData, rasterizeImageForPrinter } from '../imageRaster' import { buildEscPosImageData, buildEscPosTemplateData } from '../protocols/escPosBuilder' @@ -50,7 +52,15 @@ function getPrinterTypeDisplayName (type: '' | 'bluetooth' | 'builtin'): string function connectClassicBluetooth (device: PrinterCandidate, driver: PrinterDriver): Promise { return new Promise((resolve, reject) => { // #ifdef APP-PLUS - const shouldUseGenericClassicOnly = driver.key === 'gp-d320fx' + /** + * 一体机 / Virtual BT / d320fax:在已集成 native-fast-printer(安卓基座 AAR)时优先走佳博 SDK 连接; + * 不再强制仅用 JS 经典蓝牙,否则光栅大包易超时,且与「走基座」需求不符。 + * gp-d320fx、ESC 等仍走通用 socket。 + */ + const shouldUseGenericClassicOnly = + driver.key === 'gp-d320fx' || + driver.key === 'generic-tsc' || + driver.protocol === 'esc' const connectClassicSocketFallback = () => { try { @@ -68,7 +78,27 @@ function connectClassicBluetooth (device: PrinterCandidate, driver: PrinterDrive driverKey: driver.key, mtu: driver.preferredBleMtu || 20, }) - resolve() + /** + * connDevice 回调 ok 可能早于 socket/outputStream 就绪; + * 若立刻测试打印,会出现 state=idle、outputReady=false。 + */ + const start = Date.now() + const poll = () => { + const st = typeof classicBluetooth.getDebugState === 'function' + ? classicBluetooth.getDebugState() + : null + const ready = !!st?.outputReady && (!!st?.socketConnected || String(st?.connectionState || '').toLowerCase() === 'connected') + if (ready) { + resolve() + return + } + if (Date.now() - start > 2500) { + reject(new Error('Classic Bluetooth connection is not ready')) + return + } + setTimeout(poll, 120) + } + poll() return } const message = typeof classicBluetooth.getLastError === 'function' @@ -350,10 +380,8 @@ export function getCurrentPrinterSummary (): CurrentPrinterSummary { } function canUseNativeFastTemplatePrint (driver: PrinterDriver): boolean { - const connection = getBluetoothConnection() return driver.protocol === 'tsc' - && connection?.deviceType === 'classic' - && connection?.transportMode === 'native-plugin' + && isNativeBaseClassicBluetoothTransport() && isNativeFastPrinterAvailable() } @@ -435,6 +463,106 @@ export async function testPrintCurrentPrinter (onProgress?: (percent: number) => return driver } } + + // d320fax 在部分安卓设备上经 sendToPrinter Promise 链会无回调卡住;测试页走经典蓝牙直发更稳定。 + if (driver.key === 'd320fax' && connection?.deviceType === 'classic') { + // #ifdef APP-PLUS + try { + const payload = driver.buildTestPrintData().map((byte) => { + const v = byte & 0xff + return v >= 128 ? v - 256 : v + }) + if (onProgress) onProgress(10) + /** + * 部分设备会出现“连接状态看似为 connected,但实际输出流不可写”的假连接。 + * 测试打印前强制重连一次 classic socket,确保 btOutStream 新鲜可用。 + */ + await new Promise((resolve, reject) => { + if (typeof classicBluetooth?.connDevice !== 'function') { + reject(new Error('D320FAX_CLASSIC_CONN_API_MISSING')) + return + } + let done = false + const timer = setTimeout(() => { + if (done) return + done = true + reject(new Error('D320FAX_CLASSIC_RECONNECT_TIMEOUT')) + }, 8000) + try { + classicBluetooth.connDevice(connection.deviceId, (ok: boolean) => { + if (done) return + done = true + clearTimeout(timer) + if (ok) resolve() + else reject(new Error(classicBluetooth.getLastError?.() || 'D320FAX_CLASSIC_RECONNECT_FAILED')) + }) + } catch (e: any) { + if (done) return + done = true + clearTimeout(timer) + reject(e instanceof Error ? e : new Error(String(e || 'D320FAX_CLASSIC_RECONNECT_EXCEPTION'))) + } + }) + if (typeof classicBluetooth?.ensureConnection === 'function') { + classicBluetooth.ensureConnection(connection.deviceId) + } + if (onProgress) onProgress(30) + const ok = await new Promise((resolve) => { + let done = false + const timer = setTimeout(() => { + if (done) return + done = true + resolve(false) + }, 10000) + try { + if (typeof classicBluetooth?.sendByteDataAsync === 'function') { + const started = classicBluetooth.sendByteDataAsync(payload, (sendOk: boolean) => { + if (done) return + done = true + clearTimeout(timer) + resolve(!!sendOk) + }) + if (started === false) { + done = true + clearTimeout(timer) + resolve(false) + } + return + } + done = true + clearTimeout(timer) + resolve(false) + } catch { + done = true + clearTimeout(timer) + resolve(false) + } + }) + if (!ok) { + const err = typeof classicBluetooth?.getLastError === 'function' + ? classicBluetooth.getLastError() + : '' + const debug = typeof classicBluetooth?.getDebugState === 'function' + ? classicBluetooth.getDebugState() + : null + const details = [ + `device=${connection.deviceId}`, + `state=${String(debug?.connectionState || '-')}`, + `connected=${String(!!debug?.socketConnected)}`, + `outputReady=${String(!!debug?.outputReady)}`, + `sendMode=${String(debug?.lastSendMode || '-')}`, + err ? `lastError=${err}` : '', + ].filter(Boolean).join('\n') + throw new Error(`D320FAX_CLASSIC_SEND_TIMEOUT_OR_FAILED\n${details}`) + } + if (onProgress) onProgress(100) + return driver + } catch (e: any) { + throw (e instanceof Error ? e : new Error(String(e || 'D320FAX_CLASSIC_SEND_EXCEPTION'))) + } + // #endif + } + await sendToPrinter(driver.buildTestPrintData(), onProgress) return driver } @@ -454,8 +582,9 @@ export async function printImageForCurrentPrinter ( onProgress?: (percent: number) => void ): Promise { const driver = getCurrentPrinterDriver() + if (onProgress) onProgress(2) const raster = await rasterizeImageForPrinter(imageSource, driver, options) - if (onProgress) onProgress(5) + if (onProgress) onProgress(18) let data: number[] = [] if (driver.protocol === 'esc') { @@ -464,7 +593,13 @@ export async function printImageForCurrentPrinter ( data = buildTscImageData(raster, options, driver.imageDpi || 203) } - await sendToPrinter(data, onProgress) + if (onProgress) onProgress(22) + await sendToPrinter(data, (p) => { + if (!onProgress) return + const u = Math.min(100, Math.max(0, Math.round(p))) + onProgress(22 + Math.round((u / 100) * 78)) + }) + if (onProgress) onProgress(100) return driver } @@ -523,19 +658,25 @@ export async function printSystemTemplateForCurrentPrinter ( const canvasRaster = options.canvasRaster if (canvasRaster) { + if (onProgress) onProgress(1) const maxDots = driver.imageMaxWidthDots || (driver.protocol === 'esc' ? 384 : 576) const layout = getLabelPrintRasterLayout(template, maxDots, driver.imageDpi || 203) + if (onProgress) onProgress(4) if (canvasRaster.applyLayout) { await canvasRaster.applyLayout(layout) } + if (onProgress) onProgress(7) await new Promise((r) => setTimeout(r, 50)) + if (onProgress) onProgress(9) const tmpPath = await renderLabelPreviewCanvasToTempPathForPrint( canvasRaster.canvasId, canvasRaster.componentInstance, template, layout, ) + if (onProgress) onProgress(12) + /** 光栅后续 0–100 映射到整单 12–100,避免子步骤从 2% 覆盖掉前面已到 12% */ await printImageForCurrentPrinter( tmpPath, { @@ -544,14 +685,40 @@ export async function printSystemTemplateForCurrentPrinter ( targetWidthDots: layout.outW, targetHeightDots: layout.outH, }, - onProgress, + onProgress + ? (p) => { + onProgress(12 + Math.round((Math.min(100, Math.max(0, p)) / 100) * 88)) + } + : undefined, ) return driver } - const templateReady = await hydrateSystemTemplateImagesForPrint(template) - const connection = getBluetoothConnection() + /** + * d320fax + classic 历史上存在卡顿风险,这里对图片 hydration 增加总超时兜底: + * - 成功:使用本地化后的图片路径,提高 IMAGE/QRCODE 出图概率 + * - 超时/失败:自动回退原模板,保证仍可继续出纸 + */ + if (onProgress) onProgress(1) + const preferStableForD320faxClassic = driver.key === 'd320fax' && connection?.deviceType === 'classic' + let templateReady = template + if (preferStableForD320faxClassic) { + try { + if (onProgress) onProgress(3) + templateReady = await Promise.race([ + hydrateSystemTemplateImagesForPrint(template), + new Promise((resolve) => setTimeout(() => resolve(template), 8000)), + ]) + } catch { + templateReady = template + } + } else { + if (onProgress) onProgress(3) + templateReady = await hydrateSystemTemplateImagesForPrint(template) + } + if (onProgress) onProgress(12) + if ( driver.protocol === 'tsc' && connection?.deviceType === 'classic' @@ -576,15 +743,28 @@ export async function printSystemTemplateForCurrentPrinter ( } } + if (onProgress) onProgress(14) const structuredTemplate = adaptSystemLabelTemplate(templateReady, data, { dpi: driver.imageDpi || 203, printQty: options.printQty || 1, - disableBitmapText: driver.key === 'gp-d320fx', + disableBitmapText: driver.key === 'gp-d320fx' || driver.key === 'd320fax', + /** + * d320fax 内置字库对货币符号兼容差,TEXT_PRICE 容易整段丢失。 + * 仅恢复“货币文本位图”兜底(非全量位图文本),兼顾稳定性与 ¥ 展示。 + */ + allowCurrencyBitmapWhenDisabled: true, }) + if (onProgress) onProgress(16) const bytes = driver.protocol === 'esc' ? buildEscPosTemplateData(structuredTemplate) : buildTscTemplateData(structuredTemplate) - await sendToPrinter(bytes, onProgress) + if (onProgress) onProgress(18) + await sendToPrinter(bytes, (p) => { + if (!onProgress) return + const u = Math.min(100, Math.max(0, Math.round(p))) + onProgress(18 + Math.round((u / 100) * 82)) + }) + if (onProgress) onProgress(100) return driver } diff --git a/美国版/Food Labeling Management App UniApp/src/utils/print/nativeBitmapPatch.ts b/美国版/Food Labeling Management App UniApp/src/utils/print/nativeBitmapPatch.ts index e56cbea..27c560b 100644 --- a/美国版/Food Labeling Management App UniApp/src/utils/print/nativeBitmapPatch.ts +++ b/美国版/Food Labeling Management App UniApp/src/utils/print/nativeBitmapPatch.ts @@ -176,7 +176,11 @@ export function shouldRasterizeTextElement (text: string, type: string): boolean const normalizedType = String(type || '').toUpperCase() const normalizedText = normalizePrinterLikeText(text) if (!normalizedText) return false - if (normalizedType === 'TEXT_PRICE' && /[€£¥¥]/.test(normalizedText)) return true + /** + * TEXT_PRICE:d320fax 等走 TSC 内置字体时常丢整行(¥、小数点、数字组合)。 + * 只要非空一律走位图,与画布一致;App 端 createTextBitmapPatch 失败时再回退 TSC。 + */ + if (normalizedType === 'TEXT_PRICE') return true if (/[€£¥¥éÉáàâäãåæçèêëìíîïñòóôöõøùúûüýÿœšž]/.test(normalizedText)) return true return /[^\x20-\x7E]/.test(normalizedText) } diff --git a/美国版/Food Labeling Management App UniApp/src/utils/print/nativeFastPrinter.ts b/美国版/Food Labeling Management App UniApp/src/utils/print/nativeFastPrinter.ts index 3edc65b..4e1cd01 100644 --- a/美国版/Food Labeling Management App UniApp/src/utils/print/nativeFastPrinter.ts +++ b/美国版/Food Labeling Management App UniApp/src/utils/print/nativeFastPrinter.ts @@ -269,6 +269,49 @@ export function printNativeFastFromLabelPrintJob (options: { }) } +/** + * 将已生成的 TSC 等指令字节(Base64)交给原生佳博通道写出;与 connect 使用同一 GprinterBluetoothTransport。 + * 需基座 AAR ≥ 1.2.0(含 printCommandBytes);旧包会走 sendToPrinter 回退到 JS 经典蓝牙。 + */ +export function printNativeCommandBytes (options: { + deviceId: string + deviceName?: string + base64: string +}) { + return wrapCallback('printCommandBytes', 600000, (resolve, reject) => { + try { + const nativePlugin = ensureNativePlugin() + if (typeof nativePlugin.printCommandBytes !== 'function') { + reject(new Error('NATIVE_PRINT_COMMAND_BYTES_NOT_SUPPORTED')) + return + } + nativePlugin.printCommandBytes({ + deviceId: options.deviceId, + deviceName: options.deviceName || '', + base64: options.base64, + }, (raw: any) => { + const res = parsePluginResult(raw) + updateNativeState({ + ...res, + lastAction: 'printCommandBytes', + }) + if (res.code === 1 || res.success === true) { + resolve(res) + return + } + reject(new Error(res.msg || res.errMsg || 'NATIVE_PRINT_COMMAND_BYTES_FAILED')) + }) + } catch (error: any) { + reject(error instanceof Error ? error : new Error(String(error || 'NATIVE_PRINT_COMMAND_BYTES_FAILED'))) + } + }) +} + +export function isNativePrintCommandBytesSupported (): boolean { + const plugin = getNativePlugin() + return !!plugin && typeof plugin.printCommandBytes === 'function' +} + export function printNativeFastTemplate (options: { deviceId: string deviceName?: string diff --git a/美国版/Food Labeling Management App UniApp/src/utils/print/nativeTemplateElementSupport.ts b/美国版/Food Labeling Management App UniApp/src/utils/print/nativeTemplateElementSupport.ts index 2cc51e7..383d89b 100644 --- a/美国版/Food Labeling Management App UniApp/src/utils/print/nativeTemplateElementSupport.ts +++ b/美国版/Food Labeling Management App UniApp/src/utils/print/nativeTemplateElementSupport.ts @@ -2,16 +2,65 @@ * Android NativeTemplateCommandBuilder 仅处理:TEXT_*、QRCODE、BARCODE、IMAGE、 * 以及 border=line 的 BLANK;其余类型在原生路径下会被静默跳过(与画布预览不一致)。 */ -import type { SystemLabelTemplate, SystemTemplateElementBase } from './types/printer' +import type { + LabelTemplateData, + SystemLabelTemplate, + SystemTemplateElementBase, +} from './types/printer' +import { applyTemplateData } from './templateRenderer' function isElementHandledByNativeFastPrinter (el: SystemTemplateElementBase): boolean { const type = String(el.type || '').toUpperCase() if (type.startsWith('TEXT_')) return true - if (type === 'QRCODE' || type === 'BARCODE' || type === 'IMAGE') return true + if (type === 'QRCODE' || type === 'IMAGE') return true + if (type === 'BARCODE') return true if (type === 'BLANK') return true return false } +/** + * 将 WEIGHT / DATE / TIME / DURATION 转为 TEXT_STATIC(展示文案与合并后的 config.text 一致), + * LOGO → IMAGE,使同一套模板可走 native printTemplate,避免仅因元素类型名而整页光栅(进度长期停在 ~12–14%)。 + */ +export function normalizeTemplateForNativeFastJob ( + template: SystemLabelTemplate, + data: LabelTemplateData +): SystemLabelTemplate { + const elements = (template.elements || []).map((el) => { + const type = String(el.type || '').toUpperCase() + const config = (el.config || {}) as Record + if (type === 'LOGO') { + return { ...el, type: 'IMAGE' as typeof el.type } + } + if (type === 'WEIGHT' || type === 'DATE' || type === 'TIME' || type === 'DURATION') { + let text = '' + /** 与 renderLabelPreviewCanvas.previewTextForElement 一致:后端 AUTO_DB 的 DATE/TIME 常把算好的展示串写在 format 而非 text */ + let raw = String(config.text ?? config.Text ?? '').trim() + if (!raw) { + raw = String(config.format ?? config.Format ?? '').trim() + } + if (!raw) { + raw = String(config.value ?? config.Value ?? '').trim() + } + if (raw) { + text = applyTemplateData(raw, data) + } else if (type === 'WEIGHT') { + const v = String(config.value ?? config.Value ?? '') + const u = String(config.unit ?? config.Unit ?? '') + if (v && u && !v.endsWith(u)) text = `${v}${u}` + else text = v || u + } + return { + ...el, + type: 'TEXT_STATIC' as typeof el.type, + config: { ...config, text }, + } + } + return el + }) + return { ...template, elements } +} + /** 存在任一原生不支持的元素时,预览打印应走光栅,避免「成功但缺内容/不出纸」与画布不一致 */ export function templateHasUnsupportedNativeFastElements (template: SystemLabelTemplate): boolean { for (const el of template.elements || []) { diff --git a/美国版/Food Labeling Management App UniApp/src/utils/print/printerConnection.ts b/美国版/Food Labeling Management App UniApp/src/utils/print/printerConnection.ts index 9c2021e..55442c3 100644 --- a/美国版/Food Labeling Management App UniApp/src/utils/print/printerConnection.ts +++ b/美国版/Food Labeling Management App UniApp/src/utils/print/printerConnection.ts @@ -10,6 +10,12 @@ import { normalizeBleUuid, } from './bleWriteModeRules' import { getPrinterDriverByKey } from './manager/driverRegistry' +import { + connectNativeFastPrinter, + isNativeFastPrinterAvailable, + isNativePrintCommandBytesSupported, + printNativeCommandBytes, +} from './nativeFastPrinter' const STORAGE_PRINTER_TYPE = 'printerType' const STORAGE_BT_DEVICE_ID = 'btDeviceId' @@ -68,7 +74,7 @@ export function setBluetoothConnection (info: { uni.setStorageSync(STORAGE_BT_DEVICE_TYPE, info.deviceType || 'ble') uni.setStorageSync( STORAGE_BT_TRANSPORT_MODE, - info.transportMode || (info.deviceType === 'classic' ? 'native-plugin' : 'generic') + info.transportMode || (info.deviceType === 'classic' ? 'generic' : 'generic') ) uni.setStorageSync(STORAGE_BLE_MTU, info.mtu != null ? info.mtu : BLE_MTU_DEFAULT) uni.setStorageSync(STORAGE_PRINTER_DRIVER_KEY, info.driverKey || '') @@ -127,6 +133,11 @@ export function getBluetoothConnection (): { const transportMode = (uni.getStorageSync(STORAGE_BT_TRANSPORT_MODE) as 'native-plugin' | 'generic') || 'generic' if (!deviceId) return null if (deviceType === 'classic') { + /** + * 必须原样返回 STORAGE_BT_TRANSPORT_MODE(即上面的 transportMode)。 + * 此前误把 native-plugin 读时改回 generic,导致「永远不走安卓基座 / printCommandBytes」, + * 一体机只能走 JS 经典蓝牙,极慢且易卡在 31% 等进度。 + */ return { deviceId, deviceName: uni.getStorageSync(STORAGE_BT_DEVICE_NAME) || 'Printer', @@ -134,7 +145,7 @@ export function getBluetoothConnection (): { characteristicId: '', deviceType: 'classic', transportMode, - mtu: BLE_MTU_DEFAULT, + mtu: Number(uni.getStorageSync(STORAGE_BLE_MTU)) || BLE_MTU_DEFAULT, bleWriteUsesNoResponse: false, } } @@ -153,6 +164,54 @@ export function getBluetoothConnection (): { } } +/** + * 经典蓝牙且当前为 generic 时,在插件与 printCommandBytes 可用时尝试 connectNativeFastPrinter 并写入 native-plugin, + * 避免仍显示已连蓝牙但实际全程 JS 分包下发(极慢、易卡进度)。 + */ +export async function ensureNativeClassicTransportIfPossible (): Promise { + const conn = getBluetoothConnection() + if (!conn || conn.deviceType !== 'classic') return false + if (conn.transportMode === 'native-plugin') return true + if (!isNativeFastPrinterAvailable() || !isNativePrintCommandBytesSupported()) return false + const driverKey = getCurrentPrinterDriverKey() + const name = String(conn.deviceName || '').toLowerCase() + const preferNative = + driverKey === 'd320fax' || + name.includes('virtual bt') || + name.includes('gprinter') || + name.includes('d320') + if (!preferNative) return false + try { + await connectNativeFastPrinter({ + deviceId: conn.deviceId, + deviceName: conn.deviceName || '', + }) + setBluetoothConnection({ + deviceId: conn.deviceId, + deviceName: conn.deviceName, + serviceId: conn.serviceId, + characteristicId: conn.characteristicId, + deviceType: 'classic', + transportMode: 'native-plugin', + mtu: conn.mtu, + driverKey: getCurrentPrinterDriverKey(), + }) + return true + } catch (e) { + console.warn('[printer] ensureNativeClassicTransportIfPossible failed', e) + return false + } +} + +/** + * 经典蓝牙已走 native-fast-printer 基座链路(常见:一体机「Virtual BT Printer」/ 佳博 SDK)。 + * 预览与打印日志重打在此模式下应走原生 printTemplate;否则走 BLE 或 JS 经典蓝牙光栅/直发 TSC。 + */ +export function isNativeBaseClassicBluetoothTransport (): boolean { + const conn = getBluetoothConnection() + return conn?.deviceType === 'classic' && conn?.transportMode === 'native-plugin' +} + export function isBuiltinConnected (): boolean { return getPrinterType() === 'builtin' } @@ -222,6 +281,12 @@ export function sendToPrinter ( if (type === 'bluetooth') { const conn = getBluetoothConnection() if (conn && conn.deviceType === 'classic') { + if (conn.transportMode === 'native-plugin' && isNativePrintCommandBytesSupported()) { + return sendViaNativeClassicPlugin(data, onProgress).catch((err) => { + console.warn('[printer] native printCommandBytes failed, fallback JS classic', err) + return sendViaClassic(data, onProgress) + }) + } return sendViaClassic(data, onProgress) } return sendViaBle(data, onProgress) @@ -605,6 +670,57 @@ function sendViaBle ( return runWritesWithPayloadSize(mtuToPayloadSize(conn.mtu || BLE_MTU_DEFAULT)) } +/** 大包/虚拟蓝牙写入慢:按字节量拉长等待,避免 JS 已超时拒绝但底层仍在写出(纸已出、接口 9 未落库) */ +export function estimateClassicSendTimeoutMs (byteLength: number): number { + const n = Math.max(0, Math.floor(byteLength || 0)) + const base = 90000 + const perByte = Math.floor(n / 400) + return Math.min(600000, Math.max(60000, base + perByte)) +} + +function numberArrayToBase64 (data: number[]): string { + const u8 = new Uint8Array(data.length) + for (let i = 0; i < data.length; i++) u8[i] = data[i] & 0xff + try { + const u = uni as any + if (typeof u.arrayBufferToBase64 === 'function') { + return u.arrayBufferToBase64(u8.buffer) + } + } catch (_) {} + let binary = '' + for (let i = 0; i < u8.length; i++) binary += String.fromCharCode(u8[i]) + if (typeof btoa !== 'undefined') return btoa(binary) + return '' +} + +/** + * 经典蓝牙已走 native-fast-printer 佳博 SDK 时,整页光栅字节经 printCommandBytes 下发,避免 JS 蓝牙慢发。 + */ +function sendViaNativeClassicPlugin ( + data: number[], + onProgress?: (percent: number) => void +): Promise { + const conn = getBluetoothConnection() + if (!conn || conn.deviceType !== 'classic' || conn.transportMode !== 'native-plugin') { + return Promise.reject(new Error('NATIVE_CLASSIC_TRANSPORT_NOT_ACTIVE')) + } + if (!isNativePrintCommandBytesSupported()) { + return Promise.reject(new Error('NATIVE_PRINT_COMMAND_BYTES_NOT_SUPPORTED')) + } + const base64 = numberArrayToBase64(data) + if (!base64) { + return Promise.reject(new Error('BASE64_ENCODE_FAILED')) + } + if (onProgress) onProgress(5) + return printNativeCommandBytes({ + deviceId: conn.deviceId, + deviceName: conn.deviceName, + base64, + }).then(() => { + if (onProgress) onProgress(100) + }) +} + function sendViaClassic ( data: number[], onProgress?: (percent: number) => void @@ -614,6 +730,11 @@ function sendViaClassic ( if (!conn || conn.deviceType !== 'classic') { return Promise.reject(new Error('Classic Bluetooth printer not connected.')) } + const sendData = data.map((byte) => { + const value = byte & 0xff + return value >= 128 ? value - 256 : value + }) + const sendTimeoutMs = estimateClassicSendTimeoutMs(sendData.length) return new Promise((resolve, reject) => { let settled = false const finish = (fn: () => void) => { @@ -626,62 +747,93 @@ function sendViaClassic ( finish(() => { reject(buildClassicBluetoothError('Classic Bluetooth send timeout', conn.deviceId)) }) - }, 15000) + }, sendTimeoutMs + 25000) try { if (!classicBluetooth) { finish(() => reject(new Error('Classic Bluetooth not available'))) return } - const debugState = typeof classicBluetooth.getDebugState === 'function' - ? classicBluetooth.getDebugState() - : null - const connectionState = String(debugState?.connectionState || '').trim().toLowerCase() - const ready = debugState - ? (!!debugState.outputReady && (!!debugState.socketConnected || connectionState === 'connected')) - : true - if (!ready) { - const errorMessage = typeof classicBluetooth.getLastError === 'function' - ? classicBluetooth.getLastError() - : '' - finish(() => reject(buildClassicBluetoothError(errorMessage || 'Classic Bluetooth connection is not ready', conn.deviceId))) - return + const isReady = () => { + const debugState = typeof classicBluetooth.getDebugState === 'function' + ? classicBluetooth.getDebugState() + : null + const connectionState = String(debugState?.connectionState || '').trim().toLowerCase() + const ready = debugState + ? (!!debugState.outputReady && (!!debugState.socketConnected || connectionState === 'connected')) + : true + return { ready, debugState } } - const sendData = data.map((byte) => { - const value = byte & 0xff - return value >= 128 ? value - 256 : value - }) - - if (typeof classicBluetooth.sendByteDataAsync === 'function') { - classicBluetooth.sendByteDataAsync(sendData, (ok: boolean, errorMessage?: string) => { - finish(() => { - if (onProgress) onProgress(100) - if (ok) { - resolve() - return - } - reject(buildClassicBluetoothError( - errorMessage || classicBluetooth.getLastError?.() || 'Classic Bluetooth send failed', - conn.deviceId - )) - }) - }) - return + const sendNow = () => { + if (typeof classicBluetooth.sendByteDataAsync === 'function') { + let callbackSettled = false + const asyncTimeoutTimer = setTimeout(() => { + if (callbackSettled) return + callbackSettled = true + finish(() => reject(buildClassicBluetoothError('Classic Bluetooth async send timeout', conn.deviceId))) + }, sendTimeoutMs) + const started = classicBluetooth.sendByteDataAsync( + sendData, + (ok: boolean, errorMessage?: string) => { + callbackSettled = true + clearTimeout(asyncTimeoutTimer) + finish(() => { + if (onProgress) onProgress(100) + if (ok) { + resolve() + return + } + reject(buildClassicBluetoothError( + errorMessage || classicBluetooth.getLastError?.() || 'Classic Bluetooth send failed', + conn.deviceId + )) + }) + }, + (chunkPct: number) => { + if (onProgress && typeof chunkPct === 'number') { + try { + onProgress(Math.max(0, Math.min(99, Math.floor(chunkPct)))) + } catch (_) {} + } + }, + ) + if (started === false) { + clearTimeout(asyncTimeoutTimer) + finish(() => reject(buildClassicBluetoothError('Classic Bluetooth async send start failed', conn.deviceId))) + } + return + } + finish(() => reject(buildClassicBluetoothError('Classic Bluetooth async API missing', conn.deviceId))) } - const ok = classicBluetooth.sendByteData(sendData) - finish(() => { - if (onProgress) onProgress(100) - if (ok) { - resolve() + const waitReadyAndSend = (startMs: number) => { + const { ready } = isReady() + if (ready) { + sendNow() return } - const errorMessage = typeof classicBluetooth.getLastError === 'function' - ? classicBluetooth.getLastError() - : '' - reject(buildClassicBluetoothError(errorMessage || 'Classic Bluetooth send failed', conn.deviceId)) - }) + if (Date.now() - startMs > 1500) { + const errorMessage = typeof classicBluetooth.getLastError === 'function' + ? classicBluetooth.getLastError() + : '' + finish(() => reject(buildClassicBluetoothError(errorMessage || 'Classic Bluetooth connection is not ready', conn.deviceId))) + return + } + setTimeout(() => waitReadyAndSend(startMs), 120) + } + + /** + * 新型号/部分安卓机:连接建立慢,或页面切换后 socket 丢失但 UI 仍显示已连。 + * 发送前补连一次,再等短时间就绪。 + */ + try { + const { ready } = isReady() + if (!ready && typeof classicBluetooth.ensureConnection === 'function') { + classicBluetooth.ensureConnection(conn.deviceId) + } + } catch (_) {} + waitReadyAndSend(Date.now()) } catch (e: any) { finish(() => reject(buildClassicBluetoothError(e?.message || String(e || 'Classic Bluetooth send exception'), conn.deviceId))) } diff --git a/美国版/Food Labeling Management App UniApp/src/utils/print/systemTemplateAdapter.ts b/美国版/Food Labeling Management App UniApp/src/utils/print/systemTemplateAdapter.ts index b2c727c..e391573 100644 --- a/美国版/Food Labeling Management App UniApp/src/utils/print/systemTemplateAdapter.ts +++ b/美国版/Food Labeling Management App UniApp/src/utils/print/systemTemplateAdapter.ts @@ -129,9 +129,9 @@ function formatPriceValue ( rawValue: string, config: Record ): string { - const prefix = getConfigString(config, ['prefix'], '') - const suffix = getConfigString(config, ['suffix'], '') - const decimal = getConfigNumber(config, ['decimal'], -1) + const prefix = getConfigString(config, ['prefix', 'Prefix'], '') + const suffix = getConfigString(config, ['suffix', 'Suffix'], '') + const decimal = getConfigNumber(config, ['decimal', 'Decimal'], -1) const numericValue = Number(rawValue) const value = !Number.isNaN(numericValue) && Number.isFinite(numericValue) && decimal >= 0 ? numericValue.toFixed(decimal) @@ -174,13 +174,24 @@ function resolveElementText ( if (type === 'TEXT_PRICE') { const bindingKey = resolveBindingKey(element) const boundValue = resolveTemplateFieldValue(data, bindingKey) - const rawCfg = getConfigString(config, ['text', 'Text']) + const rawCfg = getConfigString(config, [ + 'text', + 'Text', + 'value', + 'Value', + 'displayText', + 'DisplayText', + 'displayValue', + 'DisplayValue', + 'defaultValue', + 'DefaultValue', + ]) /** FIXED:重打快照里价格已在 config.text,勿用空 data 绑定出 0 */ if (vst === 'FIXED' && rawCfg.trim()) { return formatPriceValue(rawCfg, config) } - const baseValue = boundValue || (hasText ? applyTemplateData(String(config.text), data) : '') - return baseValue ? formatPriceValue(baseValue, config) : '' + const baseValue = boundValue || (rawCfg ? applyTemplateData(rawCfg, data) : '') + return baseValue.trim() ? formatPriceValue(baseValue, config) : '' } /** FIXED:TEXT_PRODUCT 等勿在 data 为空时仍走 productName 绑定(与快照 config.text 冲突) */ @@ -321,6 +332,30 @@ function sanitizeTextForTscBuiltinFont (text: string): string { .replace(/¥/g, '\u00A5') } +/** 估算 TSC 项底部点坐标,用于避免 SIZE 高度略小于内容时裁掉最后一行(常见于底部价格) */ +function estimateTscItemBottomDots (item: TscTemplateItem): number { + switch (item.type) { + case 'bitmap': + return item.y + item.image.height + case 'text': { + const scale = item.yScale || 1 + return item.y + Math.round(24 * scale * 2) + } + case 'qrcode': { + const cw = item.cellWidth || 4 + return item.y + cw * 72 + } + case 'barcode': + return item.y + Math.max(20, Math.round(item.height || 80)) + case 'bar': + return item.y + item.height + case 'box': + return item.y + item.height + default: + return 0 + } +} + function buildTscTemplate ( template: SystemLabelTemplate, data: LabelTemplateData, @@ -328,10 +363,11 @@ function buildTscTemplate ( printQty: number, options: { disableBitmapText?: boolean + allowCurrencyBitmapWhenDisabled?: boolean } = {} ): StructuredTscTemplate { const widthMm = roundNumber(toMillimeter(template.width, template.unit || 'inch')) - const heightMm = roundNumber(toMillimeter(template.height, template.unit || 'inch')) + let heightMm = roundNumber(toMillimeter(template.height, template.unit || 'inch')) const items: TscTemplateItem[] = [] const pageWidth = templateWidthPx(template) @@ -356,13 +392,16 @@ function buildTscTemplate ( const align = resolveElementAlign(element, pageWidth) /** - * gp-d320fx 等机型默认 disableBitmapText(走 TSC 文本);但内置字库把 ¥(0xA5) 打成字母 Y。 - * 含货币符号时仍尝试 Android 位图文本,成功则纸面与预览一致。 + * gp-d320fx / d320fax 等 disableBitmapText 时:内置字库对 ¥ 与 TEXT_PRICE 整行常异常。 + * 在 allowCurrencyBitmapWhenDisabled 下对 TEXT_PRICE 一律尝试位图(不仅限于含货币符),与预览一致。 */ const currencyGlyph = /[\u00A5\uFFE5€£¥]/.test(text) + const allowBitmapWhenDisabled = + options.allowCurrencyBitmapWhenDisabled !== false && + (currencyGlyph || type === 'TEXT_PRICE') const tryTextBitmap = shouldRasterizeTextElement(text, type) && - (!options.disableBitmapText || currencyGlyph) + (!options.disableBitmapText || allowBitmapWhenDisabled) if (tryTextBitmap) { const bitmapPatch = createTextBitmapPatch({ element, @@ -444,10 +483,22 @@ function buildTscTemplate ( } if (type === 'IMAGE') { - const bitmapPatch = createImageBitmapPatch({ + let bitmapPatch = createImageBitmapPatch({ element, dpi, }) + if (!bitmapPatch) { + const boundImage = resolveElementDataValue(element, data) + if (storedValueLooksLikeImagePath(boundImage)) { + bitmapPatch = createImageBitmapPatch({ + element: { + ...element, + config: { ...config, src: boundImage, url: boundImage, Src: boundImage, Url: boundImage }, + }, + dpi, + }) + } + } if (bitmapPatch) items.push(bitmapPatch) return } @@ -463,6 +514,15 @@ function buildTscTemplate ( } }) + const maxBottomDots = items.reduce( + (acc, it) => Math.max(acc, estimateTscItemBottomDots(it)), + 0 + ) + const templateHeightDots = Math.max(1, Math.round((heightMm / 25.4) * dpi)) + if (maxBottomDots > templateHeightDots - 2) { + heightMm = roundNumber(Math.max(heightMm, (maxBottomDots / dpi) * 25.4 + 2)) + } + return { widthMm, heightMm, @@ -563,6 +623,7 @@ export function adaptSystemLabelTemplate ( dpi?: number printQty?: number disableBitmapText?: boolean + allowCurrencyBitmapWhenDisabled?: boolean } = {} ): StructuredLabelTemplate { const dpi = options.dpi || 203 @@ -571,6 +632,7 @@ export function adaptSystemLabelTemplate ( key: template.id || template.name || 'system-label-template', tsc: buildTscTemplate(template, data, dpi, printQty, { disableBitmapText: options.disableBitmapText, + allowCurrencyBitmapWhenDisabled: options.allowCurrencyBitmapWhenDisabled, }), esc: buildEscTemplate(template, data, printQty), } diff --git a/美国版/Food Labeling Management App UniApp/src/utils/printFromPrintDataList.ts b/美国版/Food Labeling Management App UniApp/src/utils/printFromPrintDataList.ts index be23972..2f4a96c 100644 --- a/美国版/Food Labeling Management App UniApp/src/utils/printFromPrintDataList.ts +++ b/美国版/Food Labeling Management App UniApp/src/utils/printFromPrintDataList.ts @@ -4,9 +4,28 @@ import { sortElementsForPreview, } from './labelPreview/normalizePreviewTemplate' import { + canPrintCurrentLabelViaNativeFastJob, + printLabelPrintJobPayloadForCurrentPrinter, printSystemTemplateForCurrentPrinter, type SystemTemplatePrintCanvasRasterOptions, } from './print/manager/printerManager' +import { + buildLabelPrintJobPayload, + setLastLabelPrintJobPayload, +} from './labelPreview/buildLabelPrintPayload' +import { getCurrentStoreId } from './stores' +import { + ensureNativeClassicTransportIfPossible, +} from './print/printerConnection' +import { + hydrateSystemTemplateImagesForPrint, + resetHydrateImageDebugRecords, +} from './print/hydrateTemplateImagesForPrint' +import { + normalizeTemplateForNativeFastJob, + templateHasUnsupportedNativeFastElements, +} from './print/nativeTemplateElementSupport' +import { isTemplateWithinNativeFastPrintBounds } from './print/templatePhysicalMm' import type { LabelTemplateData, SystemLabelTemplate, @@ -327,6 +346,52 @@ export type PrintFromPrintLogOptions = { } /** + * 与 Label Preview 一致:一体机(经典蓝牙 + native-plugin 基座)且模板可走原生时走 printLabelPrintJob + 本地图片 hydration; + * 普通蓝牙仍走 canvas 光栅或直发 TSC。 + */ +async function printReprintTemplateWithPreviewStrategy ( + tmpl: SystemLabelTemplate, + row: PrintLogItemDto, + options: PrintFromPrintLogOptions, +): Promise { + await ensureNativeClassicTransportIfPossible() + const templateData = labelTemplateDataForSnapshotReprint() + const printInputJson: Record = {} + const tmplForNative = normalizeTemplateForNativeFastJob(tmpl, printInputJson as any) + const useNative = + canPrintCurrentLabelViaNativeFastJob() + && isTemplateWithinNativeFastPrintBounds(tmpl) + && !templateHasUnsupportedNativeFastElements(tmplForNative) + + const printQty = options.printQty ?? 1 + + if (useNative) { + resetHydrateImageDebugRecords() + const hydrated = await hydrateSystemTemplateImagesForPrint(tmplForNative) + const payload = buildLabelPrintJobPayload(hydrated, printInputJson, { + labelCode: row.labelCode, + productId: row.productId ?? undefined, + printQuantity: printQty, + locationId: getCurrentStoreId() || undefined, + }) + setLastLabelPrintJobPayload(payload) + await printLabelPrintJobPayloadForCurrentPrinter( + payload, + { printQty }, + options.onProgress, + ) + return + } + + await printSystemTemplateForCurrentPrinter( + tmpl, + templateData, + { printQty, canvasRaster: options.canvasRaster }, + options.onProgress, + ) +} + +/** * 使用接口 10 返回的 `printDataList` 组装模板并走当前打印机。 */ function logReprintJson (label: string, data: unknown): void { @@ -382,12 +447,7 @@ export async function printFromPrintDataListRow ( logReprintJson('bake + sort 后送打印机模板 tmpl', tmpl) - await printSystemTemplateForCurrentPrinter( - tmpl, - templateData, - { printQty: options.printQty ?? 1, canvasRaster: options.canvasRaster }, - options.onProgress - ) + await printReprintTemplateWithPreviewStrategy(tmpl, row, options) } /** @@ -519,10 +579,5 @@ export async function printFromMergedTemplateJsonString ( logReprintJson('bake + sort 后送打印机模板 tmpl', tmpl) logReprintJson('templateData(快照重打为空对象)', templateData) - await printSystemTemplateForCurrentPrinter( - tmpl, - templateData, - { printQty: options.printQty ?? 1, canvasRaster: options.canvasRaster }, - options.onProgress - ) + await printReprintTemplateWithPreviewStrategy(tmpl, row, options) } diff --git a/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Dtos/Label/LabelGetListOutputDto.cs b/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Dtos/Label/LabelGetListOutputDto.cs index 6c3574e..ea08c0b 100644 --- a/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Dtos/Label/LabelGetListOutputDto.cs +++ b/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Dtos/Label/LabelGetListOutputDto.cs @@ -19,6 +19,11 @@ public class LabelGetListOutputDto public string TemplateName { get; set; } = string.Empty; + /// + /// 绑定模板的编码(与详情接口一致,供管理端「录入数据」等按模板操作) + /// + public string TemplateCode { get; set; } = string.Empty; + public string LabelTypeName { get; set; } = string.Empty; public bool State { get; set; } diff --git a/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Dtos/LabelTemplate/LabelTemplateElementDto.cs b/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Dtos/LabelTemplate/LabelTemplateElementDto.cs index 4e24238..5b6cf03 100644 --- a/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Dtos/LabelTemplate/LabelTemplateElementDto.cs +++ b/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Dtos/LabelTemplate/LabelTemplateElementDto.cs @@ -13,6 +13,12 @@ public class LabelTemplateElementDto [JsonPropertyName("type")] public string ElementType { get; set; } = string.Empty; + /// + /// 元素附加类型(分组前缀 + 控件名),如 label_Duration + /// + [JsonPropertyName("typeAdd")] + public string? TypeAdd { get; set; } + [JsonPropertyName("elementName")] public string ElementName { get; set; } = string.Empty; diff --git a/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/DbModels/FlLabelTemplateElementDbEntity.cs b/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/DbModels/FlLabelTemplateElementDbEntity.cs index c9f2f8f..3f20d9f 100644 --- a/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/DbModels/FlLabelTemplateElementDbEntity.cs +++ b/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/DbModels/FlLabelTemplateElementDbEntity.cs @@ -14,6 +14,9 @@ public class FlLabelTemplateElementDbEntity public string ElementType { get; set; } = string.Empty; + [SugarColumn(ColumnName = "TypeAdd")] + public string? TypeAdd { get; set; } + [SugarColumn(ColumnName = "ElementName")] public string ElementName { get; set; } = string.Empty; diff --git a/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/LabelAppService.cs b/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/LabelAppService.cs index 74b1434..f17c480 100644 --- a/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/LabelAppService.cs +++ b/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/LabelAppService.cs @@ -127,6 +127,7 @@ public class LabelAppService : ApplicationService, ILabelAppService LabelCategoryName = c.CategoryName, LabelTypeName = t.TypeName, TemplateName = tpl.TemplateName, + TemplateCode = tpl.TemplateCode, l.State, LastEdited = l.LastModificationTime ?? l.CreationTime }) @@ -196,6 +197,7 @@ public class LabelAppService : ApplicationService, ILabelAppService ProductCategoryName = string.IsNullOrWhiteSpace(productCategoryNameValue) ? "无" : productCategoryNameValue, Products = products, TemplateName = x.TemplateName ?? string.Empty, + TemplateCode = x.TemplateCode ?? string.Empty, LabelTypeName = x.LabelTypeName ?? string.Empty, State = x.State, LastEdited = x.LastEdited, @@ -695,6 +697,7 @@ public class LabelAppService : ApplicationService, ILabelAppService { Id = el.ElementKey, ElementType = el.ElementType, + TypeAdd = el.TypeAdd, ElementName = el.ElementName, PosX = el.PosX, PosY = el.PosY, diff --git a/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/LabelTemplateAppService.cs b/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/LabelTemplateAppService.cs index d713d61..6a9a07e 100644 --- a/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/LabelTemplateAppService.cs +++ b/美国版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application/Services/LabelTemplateAppService.cs @@ -157,6 +157,7 @@ public class LabelTemplateAppService : ApplicationService, ILabelTemplateAppServ { Id = e.ElementKey, ElementType = e.ElementType, + TypeAdd = e.TypeAdd, ElementName = e.ElementName, PosX = e.PosX, PosY = e.PosY, @@ -391,6 +392,7 @@ public class LabelTemplateAppService : ApplicationService, ILabelTemplateAppServ TemplateId = templateDbId, ElementKey = e.Id, ElementType = e.ElementType, + TypeAdd = string.IsNullOrWhiteSpace(e.TypeAdd) ? null : e.TypeAdd.Trim(), ElementName = elementName, PosX = e.PosX, PosY = e.PosY, diff --git a/美国版/Food Labeling Management Platform/build/assets/index-SKuXxqbM.js b/美国版/Food Labeling Management Platform/build/assets/index-SKuXxqbM.js new file mode 100644 index 0000000..3d58650 --- /dev/null +++ b/美国版/Food Labeling Management Platform/build/assets/index-SKuXxqbM.js @@ -0,0 +1,458 @@ +function Zz(e,t){for(var r=0;rn[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();var Uf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _y={exports:{}},Fc={},Cy={exports:{}},ot={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var xE;function e8(){if(xE)return ot;xE=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.iterator;function m(U){return U===null||typeof U!="object"?null:(U=p&&U[p]||U["@@iterator"],typeof U=="function"?U:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,x={};function w(U,z,B){this.props=U,this.context=z,this.refs=x,this.updater=B||v}w.prototype.isReactComponent={},w.prototype.setState=function(U,z){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,z,"setState")},w.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function j(){}j.prototype=w.prototype;function N(U,z,B){this.props=U,this.context=z,this.refs=x,this.updater=B||v}var C=N.prototype=new j;C.constructor=N,y(C,w.prototype),C.isPureReactComponent=!0;var A=Array.isArray,E=Object.prototype.hasOwnProperty,O={current:null},T={key:!0,ref:!0,__self:!0,__source:!0};function k(U,z,B){var X,Q={},re=null,G=null;if(z!=null)for(X in z.ref!==void 0&&(G=z.ref),z.key!==void 0&&(re=""+z.key),z)E.call(z,X)&&!T.hasOwnProperty(X)&&(Q[X]=z[X]);var Z=arguments.length-2;if(Z===1)Q.children=B;else if(1>>1,z=F[U];if(0>>1;Ua(Q,D))rea(G,Q)?(F[U]=G,F[re]=D,U=re):(F[U]=Q,F[X]=D,U=X);else if(rea(G,D))F[U]=G,F[re]=D,U=re;else break e}}return te}function a(F,te){var D=F.sortIndex-te.sortIndex;return D!==0?D:F.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,u=s.now();e.unstable_now=function(){return s.now()-u}}var d=[],c=[],f=1,p=null,m=3,v=!1,y=!1,x=!1,w=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(F){for(var te=r(c);te!==null;){if(te.callback===null)n(c);else if(te.startTime<=F)n(c),te.sortIndex=te.expirationTime,t(d,te);else break;te=r(c)}}function A(F){if(x=!1,C(F),!y)if(r(d)!==null)y=!0,V(E);else{var te=r(c);te!==null&&K(A,te.startTime-F)}}function E(F,te){y=!1,x&&(x=!1,j(k),k=-1),v=!0;var D=m;try{for(C(te),p=r(d);p!==null&&(!(p.expirationTime>te)||F&&!$());){var U=p.callback;if(typeof U=="function"){p.callback=null,m=p.priorityLevel;var z=U(p.expirationTime<=te);te=e.unstable_now(),typeof z=="function"?p.callback=z:p===r(d)&&n(d),C(te)}else n(d);p=r(d)}if(p!==null)var B=!0;else{var X=r(c);X!==null&&K(A,X.startTime-te),B=!1}return B}finally{p=null,m=D,v=!1}}var O=!1,T=null,k=-1,M=5,L=-1;function $(){return!(e.unstable_now()-LF||125U?(F.sortIndex=D,t(c,F),r(d)===null&&F===r(c)&&(x?(j(k),k=-1):x=!0,K(A,D-U))):(F.sortIndex=z,t(d,F),y||v||(y=!0,V(E))),F},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(F){var te=m;return function(){var D=m;m=te;try{return F.apply(this,arguments)}finally{m=D}}}})(Py)),Py}var NE;function a8(){return NE||(NE=1,Oy.exports=n8()),Oy.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var _E;function i8(){if(_E)return rn;_E=1;var e=Sm(),t=a8();function r(l){for(var h="https://reactjs.org/docs/error-decoder.html?invariant="+l,g=1;g"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,c=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},p={};function m(l){return d.call(p,l)?!0:d.call(f,l)?!1:c.test(l)?p[l]=!0:(f[l]=!0,!1)}function v(l,h,g,S){if(g!==null&&g.type===0)return!1;switch(typeof h){case"function":case"symbol":return!0;case"boolean":return S?!1:g!==null?!g.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function y(l,h,g,S){if(h===null||typeof h>"u"||v(l,h,g,S))return!0;if(S)return!1;if(g!==null)switch(g.type){case 3:return!h;case 4:return h===!1;case 5:return isNaN(h);case 6:return isNaN(h)||1>h}return!1}function x(l,h,g,S,_,P,R){this.acceptsBooleans=h===2||h===3||h===4,this.attributeName=S,this.attributeNamespace=_,this.mustUseProperty=g,this.propertyName=l,this.type=h,this.sanitizeURL=P,this.removeEmptyString=R}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){w[l]=new x(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var h=l[0];w[h]=new x(h,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){w[l]=new x(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){w[l]=new x(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){w[l]=new x(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){w[l]=new x(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){w[l]=new x(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){w[l]=new x(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){w[l]=new x(l,5,!1,l.toLowerCase(),null,!1,!1)});var j=/[\-:]([a-z])/g;function N(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var h=l.replace(j,N);w[h]=new x(h,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var h=l.replace(j,N);w[h]=new x(h,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var h=l.replace(j,N);w[h]=new x(h,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){w[l]=new x(l,1,!1,l.toLowerCase(),null,!1,!1)}),w.xlinkHref=new x("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){w[l]=new x(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,h,g,S){var _=w.hasOwnProperty(h)?w[h]:null;(_!==null?_.type!==0:S||!(2J||_[R]!==P[J]){var ae=` +`+_[R].replace(" at new "," at ");return l.displayName&&ae.includes("")&&(ae=ae.replace("",l.displayName)),ae}while(1<=R&&0<=J);break}}}finally{B=!1,Error.prepareStackTrace=g}return(l=l?l.displayName||l.name:"")?z(l):""}function Q(l){switch(l.tag){case 5:return z(l.type);case 16:return z("Lazy");case 13:return z("Suspense");case 19:return z("SuspenseList");case 0:case 2:case 15:return l=X(l.type,!1),l;case 11:return l=X(l.type.render,!1),l;case 1:return l=X(l.type,!0),l;default:return""}}function re(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case T:return"Fragment";case O:return"Portal";case M:return"Profiler";case k:return"StrictMode";case H:return"Suspense";case Y:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case $:return(l.displayName||"Context")+".Consumer";case L:return(l._context.displayName||"Context")+".Provider";case I:var h=l.render;return l=l.displayName,l||(l=h.displayName||h.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case W:return h=l.displayName||null,h!==null?h:re(l.type)||"Memo";case V:h=l._payload,l=l._init;try{return re(l(h))}catch{}}return null}function G(l){var h=l.type;switch(l.tag){case 24:return"Cache";case 9:return(h.displayName||"Context")+".Consumer";case 10:return(h._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=h.render,l=l.displayName||l.name||"",h.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return h;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return re(h);case 8:return h===k?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h}return null}function Z(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ee(l){var h=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function ce(l){var h=ee(l)?"checked":"value",g=Object.getOwnPropertyDescriptor(l.constructor.prototype,h),S=""+l[h];if(!l.hasOwnProperty(h)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var _=g.get,P=g.set;return Object.defineProperty(l,h,{configurable:!0,get:function(){return _.call(this)},set:function(R){S=""+R,P.call(this,R)}}),Object.defineProperty(l,h,{enumerable:g.enumerable}),{getValue:function(){return S},setValue:function(R){S=""+R},stopTracking:function(){l._valueTracker=null,delete l[h]}}}}function ve(l){l._valueTracker||(l._valueTracker=ce(l))}function ne(l){if(!l)return!1;var h=l._valueTracker;if(!h)return!0;var g=h.getValue(),S="";return l&&(S=ee(l)?l.checked?"true":"false":l.value),l=S,l!==g?(h.setValue(l),!0):!1}function Ce(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function pe(l,h){var g=h.checked;return D({},h,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:g??l._wrapperState.initialChecked})}function Pe(l,h){var g=h.defaultValue==null?"":h.defaultValue,S=h.checked!=null?h.checked:h.defaultChecked;g=Z(h.value!=null?h.value:g),l._wrapperState={initialChecked:S,initialValue:g,controlled:h.type==="checkbox"||h.type==="radio"?h.checked!=null:h.value!=null}}function $e(l,h){h=h.checked,h!=null&&C(l,"checked",h,!1)}function Fe(l,h){$e(l,h);var g=Z(h.value),S=h.type;if(g!=null)S==="number"?(g===0&&l.value===""||l.value!=g)&&(l.value=""+g):l.value!==""+g&&(l.value=""+g);else if(S==="submit"||S==="reset"){l.removeAttribute("value");return}h.hasOwnProperty("value")?ct(l,h.type,g):h.hasOwnProperty("defaultValue")&&ct(l,h.type,Z(h.defaultValue)),h.checked==null&&h.defaultChecked!=null&&(l.defaultChecked=!!h.defaultChecked)}function dt(l,h,g){if(h.hasOwnProperty("value")||h.hasOwnProperty("defaultValue")){var S=h.type;if(!(S!=="submit"&&S!=="reset"||h.value!==void 0&&h.value!==null))return;h=""+l._wrapperState.initialValue,g||h===l.value||(l.value=h),l.defaultValue=h}g=l.name,g!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,g!==""&&(l.name=g)}function ct(l,h,g){(h!=="number"||Ce(l.ownerDocument)!==l)&&(g==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+g&&(l.defaultValue=""+g))}var St=Array.isArray;function Ot(l,h,g,S){if(l=l.options,h){h={};for(var _=0;_"+h.valueOf().toString()+"",h=Kt.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;h.firstChild;)l.appendChild(h.firstChild)}});function Vt(l,h){if(h){var g=l.firstChild;if(g&&g===l.lastChild&&g.nodeType===3){g.nodeValue=h;return}}l.textContent=h}var vr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ur=["Webkit","ms","Moz","O"];Object.keys(vr).forEach(function(l){Ur.forEach(function(h){h=h+l.charAt(0).toUpperCase()+l.substring(1),vr[h]=vr[l]})});function Ka(l,h,g){return h==null||typeof h=="boolean"||h===""?"":g||typeof h!="number"||h===0||vr.hasOwnProperty(l)&&vr[l]?(""+h).trim():h+"px"}function Na(l,h){l=l.style;for(var g in h)if(h.hasOwnProperty(g)){var S=g.indexOf("--")===0,_=Ka(g,h[g],S);g==="float"&&(g="cssFloat"),S?l.setProperty(g,_):l[g]=_}}var Pi=D({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ie(l,h){if(h){if(Pi[l]&&(h.children!=null||h.dangerouslySetInnerHTML!=null))throw Error(r(137,l));if(h.dangerouslySetInnerHTML!=null){if(h.children!=null)throw Error(r(60));if(typeof h.dangerouslySetInnerHTML!="object"||!("__html"in h.dangerouslySetInnerHTML))throw Error(r(61))}if(h.style!=null&&typeof h.style!="object")throw Error(r(62))}}function ke(l,h){if(l.indexOf("-")===-1)return typeof h.is=="string";switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Xe=null;function Ht(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var Bt=null,_a=null,kn=null;function Ya(l){if(l=Nc(l)){if(typeof Bt!="function")throw Error(r(280));var h=l.stateNode;h&&(h=nf(h),Bt(l.stateNode,l.type,h))}}function et(l){_a?kn?kn.push(l):kn=[l]:_a=l}function er(){if(_a){var l=_a,h=kn;if(kn=_a=null,Ya(l),h)for(l=0;l>>=0,l===0?32:31-(mB(l)/gB|0)|0}var Fd=64,Bd=4194304;function oc(l){switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function zd(l,h){var g=l.pendingLanes;if(g===0)return 0;var S=0,_=l.suspendedLanes,P=l.pingedLanes,R=g&268435455;if(R!==0){var J=R&~_;J!==0?S=oc(J):(P&=R,P!==0&&(S=oc(P)))}else R=g&~_,R!==0?S=oc(R):P!==0&&(S=oc(P));if(S===0)return 0;if(h!==0&&h!==S&&(h&_)===0&&(_=S&-S,P=h&-h,_>=P||_===16&&(P&4194240)!==0))return h;if((S&4)!==0&&(S|=g&16),h=l.entangledLanes,h!==0)for(l=l.entanglements,h&=S;0g;g++)h.push(l);return h}function sc(l,h,g){l.pendingLanes|=h,h!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,h=31-Qn(h),l[h]=g}function bB(l,h){var g=l.pendingLanes&~h;l.pendingLanes=h,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=h,l.mutableReadLanes&=h,l.entangledLanes&=h,h=l.entanglements;var S=l.eventTimes;for(l=l.expirationTimes;0=mc),f_=" ",h_=!1;function p_(l,h){switch(l){case"keyup":return KB.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function m_(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ps=!1;function XB(l,h){switch(l){case"compositionend":return m_(h);case"keypress":return h.which!==32?null:(h_=!0,f_);case"textInput":return l=h.data,l===f_&&h_?null:l;default:return null}}function JB(l,h){if(ps)return l==="compositionend"||!iv&&p_(l,h)?(l=o_(),Wd=Zg=Li=null,ps=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(h.ctrlKey||h.altKey||h.metaKey)||h.ctrlKey&&h.altKey){if(h.char&&1=h)return{node:g,offset:h-l};l=S}e:{for(;g;){if(g.nextSibling){g=g.nextSibling;break e}g=g.parentNode}g=void 0}g=S_(g)}}function N_(l,h){return l&&h?l===h?!0:l&&l.nodeType===3?!1:h&&h.nodeType===3?N_(l,h.parentNode):"contains"in l?l.contains(h):l.compareDocumentPosition?!!(l.compareDocumentPosition(h)&16):!1:!1}function __(){for(var l=window,h=Ce();h instanceof l.HTMLIFrameElement;){try{var g=typeof h.contentWindow.location.href=="string"}catch{g=!1}if(g)l=h.contentWindow;else break;h=Ce(l.document)}return h}function lv(l){var h=l&&l.nodeName&&l.nodeName.toLowerCase();return h&&(h==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||h==="textarea"||l.contentEditable==="true")}function oz(l){var h=__(),g=l.focusedElem,S=l.selectionRange;if(h!==g&&g&&g.ownerDocument&&N_(g.ownerDocument.documentElement,g)){if(S!==null&&lv(g)){if(h=S.start,l=S.end,l===void 0&&(l=h),"selectionStart"in g)g.selectionStart=h,g.selectionEnd=Math.min(l,g.value.length);else if(l=(h=g.ownerDocument||document)&&h.defaultView||window,l.getSelection){l=l.getSelection();var _=g.textContent.length,P=Math.min(S.start,_);S=S.end===void 0?P:Math.min(S.end,_),!l.extend&&P>S&&(_=S,S=P,P=_),_=j_(g,P);var R=j_(g,S);_&&R&&(l.rangeCount!==1||l.anchorNode!==_.node||l.anchorOffset!==_.offset||l.focusNode!==R.node||l.focusOffset!==R.offset)&&(h=h.createRange(),h.setStart(_.node,_.offset),l.removeAllRanges(),P>S?(l.addRange(h),l.extend(R.node,R.offset)):(h.setEnd(R.node,R.offset),l.addRange(h)))}}for(h=[],l=g;l=l.parentNode;)l.nodeType===1&&h.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g=document.documentMode,ms=null,cv=null,xc=null,uv=!1;function C_(l,h,g){var S=g.window===g?g.document:g.nodeType===9?g:g.ownerDocument;uv||ms==null||ms!==Ce(S)||(S=ms,"selectionStart"in S&&lv(S)?S={start:S.selectionStart,end:S.selectionEnd}:(S=(S.ownerDocument&&S.ownerDocument.defaultView||window).getSelection(),S={anchorNode:S.anchorNode,anchorOffset:S.anchorOffset,focusNode:S.focusNode,focusOffset:S.focusOffset}),xc&&yc(xc,S)||(xc=S,S=ef(cv,"onSelect"),0bs||(l.current=Sv[bs],Sv[bs]=null,bs--)}function Rt(l,h){bs++,Sv[bs]=l.current,l.current=h}var zi={},kr=Bi(zi),Jr=Bi(!1),xo=zi;function ws(l,h){var g=l.type.contextTypes;if(!g)return zi;var S=l.stateNode;if(S&&S.__reactInternalMemoizedUnmaskedChildContext===h)return S.__reactInternalMemoizedMaskedChildContext;var _={},P;for(P in g)_[P]=h[P];return S&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=h,l.__reactInternalMemoizedMaskedChildContext=_),_}function Qr(l){return l=l.childContextTypes,l!=null}function af(){$t(Jr),$t(kr)}function z_(l,h,g){if(kr.current!==zi)throw Error(r(168));Rt(kr,h),Rt(Jr,g)}function q_(l,h,g){var S=l.stateNode;if(h=h.childContextTypes,typeof S.getChildContext!="function")return g;S=S.getChildContext();for(var _ in S)if(!(_ in h))throw Error(r(108,G(l)||"Unknown",_));return D({},g,S)}function of(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||zi,xo=kr.current,Rt(kr,l),Rt(Jr,Jr.current),!0}function U_(l,h,g){var S=l.stateNode;if(!S)throw Error(r(169));g?(l=q_(l,h,xo),S.__reactInternalMemoizedMergedChildContext=l,$t(Jr),$t(kr),Rt(kr,l)):$t(Jr),Rt(Jr,g)}var Ja=null,sf=!1,jv=!1;function V_(l){Ja===null?Ja=[l]:Ja.push(l)}function yz(l){sf=!0,V_(l)}function qi(){if(!jv&&Ja!==null){jv=!0;var l=0,h=jt;try{var g=Ja;for(jt=1;l>=R,_-=R,Qa=1<<32-Qn(h)+_|g<<_|S,Za=P+l}else Qa=1<Je?(wr=Ue,Ue=null):wr=Ue.sibling;var ft=be(se,Ue,le[Je],Ne);if(ft===null){Ue===null&&(Ue=wr);break}l&&Ue&&ft.alternate===null&&h(se,Ue),oe=P(ft,oe,Je),qe===null?Le=ft:qe.sibling=ft,qe=ft,Ue=wr}if(Je===le.length)return g(se,Ue),zt&&wo(se,Je),Le;if(Ue===null){for(;JeJe?(wr=Ue,Ue=null):wr=Ue.sibling;var Ji=be(se,Ue,ft.value,Ne);if(Ji===null){Ue===null&&(Ue=wr);break}l&&Ue&&Ji.alternate===null&&h(se,Ue),oe=P(Ji,oe,Je),qe===null?Le=Ji:qe.sibling=Ji,qe=Ji,Ue=wr}if(ft.done)return g(se,Ue),zt&&wo(se,Je),Le;if(Ue===null){for(;!ft.done;Je++,ft=le.next())ft=Se(se,ft.value,Ne),ft!==null&&(oe=P(ft,oe,Je),qe===null?Le=ft:qe.sibling=ft,qe=ft);return zt&&wo(se,Je),Le}for(Ue=S(se,Ue);!ft.done;Je++,ft=le.next())ft=Oe(Ue,se,Je,ft.value,Ne),ft!==null&&(l&&ft.alternate!==null&&Ue.delete(ft.key===null?Je:ft.key),oe=P(ft,oe,Je),qe===null?Le=ft:qe.sibling=ft,qe=ft);return l&&Ue.forEach(function(Qz){return h(se,Qz)}),zt&&wo(se,Je),Le}function rr(se,oe,le,Ne){if(typeof le=="object"&&le!==null&&le.type===T&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case E:e:{for(var Le=le.key,qe=oe;qe!==null;){if(qe.key===Le){if(Le=le.type,Le===T){if(qe.tag===7){g(se,qe.sibling),oe=_(qe,le.props.children),oe.return=se,se=oe;break e}}else if(qe.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===V&&X_(Le)===qe.type){g(se,qe.sibling),oe=_(qe,le.props),oe.ref=_c(se,qe,le),oe.return=se,se=oe;break e}g(se,qe);break}else h(se,qe);qe=qe.sibling}le.type===T?(oe=Po(le.props.children,se.mode,Ne,le.key),oe.return=se,se=oe):(Ne=Mf(le.type,le.key,le.props,null,se.mode,Ne),Ne.ref=_c(se,oe,le),Ne.return=se,se=Ne)}return R(se);case O:e:{for(qe=le.key;oe!==null;){if(oe.key===qe)if(oe.tag===4&&oe.stateNode.containerInfo===le.containerInfo&&oe.stateNode.implementation===le.implementation){g(se,oe.sibling),oe=_(oe,le.children||[]),oe.return=se,se=oe;break e}else{g(se,oe);break}else h(se,oe);oe=oe.sibling}oe=by(le,se.mode,Ne),oe.return=se,se=oe}return R(se);case V:return qe=le._init,rr(se,oe,qe(le._payload),Ne)}if(St(le))return Re(se,oe,le,Ne);if(te(le))return De(se,oe,le,Ne);df(se,le)}return typeof le=="string"&&le!==""||typeof le=="number"?(le=""+le,oe!==null&&oe.tag===6?(g(se,oe.sibling),oe=_(oe,le),oe.return=se,se=oe):(g(se,oe),oe=xy(le,se.mode,Ne),oe.return=se,se=oe),R(se)):g(se,oe)}return rr}var _s=J_(!0),Q_=J_(!1),ff=Bi(null),hf=null,Cs=null,Pv=null;function Av(){Pv=Cs=hf=null}function Tv(l){var h=ff.current;$t(ff),l._currentValue=h}function kv(l,h,g){for(;l!==null;){var S=l.alternate;if((l.childLanes&h)!==h?(l.childLanes|=h,S!==null&&(S.childLanes|=h)):S!==null&&(S.childLanes&h)!==h&&(S.childLanes|=h),l===g)break;l=l.return}}function Es(l,h){hf=l,Pv=Cs=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&h)!==0&&(Zr=!0),l.firstContext=null)}function Dn(l){var h=l._currentValue;if(Pv!==l)if(l={context:l,memoizedValue:h,next:null},Cs===null){if(hf===null)throw Error(r(308));Cs=l,hf.dependencies={lanes:0,firstContext:l}}else Cs=Cs.next=l;return h}var So=null;function Rv(l){So===null?So=[l]:So.push(l)}function Z_(l,h,g,S){var _=h.interleaved;return _===null?(g.next=g,Rv(h)):(g.next=_.next,_.next=g),h.interleaved=g,ei(l,S)}function ei(l,h){l.lanes|=h;var g=l.alternate;for(g!==null&&(g.lanes|=h),g=l,l=l.return;l!==null;)l.childLanes|=h,g=l.alternate,g!==null&&(g.childLanes|=h),g=l,l=l.return;return g.tag===3?g.stateNode:null}var Ui=!1;function Iv(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function eC(l,h){l=l.updateQueue,h.updateQueue===l&&(h.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function ti(l,h){return{eventTime:l,lane:h,tag:0,payload:null,callback:null,next:null}}function Vi(l,h,g){var S=l.updateQueue;if(S===null)return null;if(S=S.shared,(ut&2)!==0){var _=S.pending;return _===null?h.next=h:(h.next=_.next,_.next=h),S.pending=h,ei(l,g)}return _=S.interleaved,_===null?(h.next=h,Rv(S)):(h.next=_.next,_.next=h),S.interleaved=h,ei(l,g)}function pf(l,h,g){if(h=h.updateQueue,h!==null&&(h=h.shared,(g&4194240)!==0)){var S=h.lanes;S&=l.pendingLanes,g|=S,h.lanes=g,Kg(l,g)}}function tC(l,h){var g=l.updateQueue,S=l.alternate;if(S!==null&&(S=S.updateQueue,g===S)){var _=null,P=null;if(g=g.firstBaseUpdate,g!==null){do{var R={eventTime:g.eventTime,lane:g.lane,tag:g.tag,payload:g.payload,callback:g.callback,next:null};P===null?_=P=R:P=P.next=R,g=g.next}while(g!==null);P===null?_=P=h:P=P.next=h}else _=P=h;g={baseState:S.baseState,firstBaseUpdate:_,lastBaseUpdate:P,shared:S.shared,effects:S.effects},l.updateQueue=g;return}l=g.lastBaseUpdate,l===null?g.firstBaseUpdate=h:l.next=h,g.lastBaseUpdate=h}function mf(l,h,g,S){var _=l.updateQueue;Ui=!1;var P=_.firstBaseUpdate,R=_.lastBaseUpdate,J=_.shared.pending;if(J!==null){_.shared.pending=null;var ae=J,ue=ae.next;ae.next=null,R===null?P=ue:R.next=ue,R=ae;var we=l.alternate;we!==null&&(we=we.updateQueue,J=we.lastBaseUpdate,J!==R&&(J===null?we.firstBaseUpdate=ue:J.next=ue,we.lastBaseUpdate=ae))}if(P!==null){var Se=_.baseState;R=0,we=ue=ae=null,J=P;do{var be=J.lane,Oe=J.eventTime;if((S&be)===be){we!==null&&(we=we.next={eventTime:Oe,lane:0,tag:J.tag,payload:J.payload,callback:J.callback,next:null});e:{var Re=l,De=J;switch(be=h,Oe=g,De.tag){case 1:if(Re=De.payload,typeof Re=="function"){Se=Re.call(Oe,Se,be);break e}Se=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=De.payload,be=typeof Re=="function"?Re.call(Oe,Se,be):Re,be==null)break e;Se=D({},Se,be);break e;case 2:Ui=!0}}J.callback!==null&&J.lane!==0&&(l.flags|=64,be=_.effects,be===null?_.effects=[J]:be.push(J))}else Oe={eventTime:Oe,lane:be,tag:J.tag,payload:J.payload,callback:J.callback,next:null},we===null?(ue=we=Oe,ae=Se):we=we.next=Oe,R|=be;if(J=J.next,J===null){if(J=_.shared.pending,J===null)break;be=J,J=be.next,be.next=null,_.lastBaseUpdate=be,_.shared.pending=null}}while(!0);if(we===null&&(ae=Se),_.baseState=ae,_.firstBaseUpdate=ue,_.lastBaseUpdate=we,h=_.shared.interleaved,h!==null){_=h;do R|=_.lane,_=_.next;while(_!==h)}else P===null&&(_.shared.lanes=0);_o|=R,l.lanes=R,l.memoizedState=Se}}function rC(l,h,g){if(l=h.effects,h.effects=null,l!==null)for(h=0;hg?g:4,l(!0);var S=Fv.transition;Fv.transition={};try{l(!1),h()}finally{jt=g,Fv.transition=S}}function wC(){return Ln().memoizedState}function Sz(l,h,g){var S=Ki(l);if(g={lane:S,action:g,hasEagerState:!1,eagerState:null,next:null},SC(l))jC(h,g);else if(g=Z_(l,h,g,S),g!==null){var _=Hr();aa(g,l,S,_),NC(g,h,S)}}function jz(l,h,g){var S=Ki(l),_={lane:S,action:g,hasEagerState:!1,eagerState:null,next:null};if(SC(l))jC(h,_);else{var P=l.alternate;if(l.lanes===0&&(P===null||P.lanes===0)&&(P=h.lastRenderedReducer,P!==null))try{var R=h.lastRenderedState,J=P(R,g);if(_.hasEagerState=!0,_.eagerState=J,Zn(J,R)){var ae=h.interleaved;ae===null?(_.next=_,Rv(h)):(_.next=ae.next,ae.next=_),h.interleaved=_;return}}catch{}finally{}g=Z_(l,h,_,S),g!==null&&(_=Hr(),aa(g,l,S,_),NC(g,h,S))}}function SC(l){var h=l.alternate;return l===Gt||h!==null&&h===Gt}function jC(l,h){Pc=yf=!0;var g=l.pending;g===null?h.next=h:(h.next=g.next,g.next=h),l.pending=h}function NC(l,h,g){if((g&4194240)!==0){var S=h.lanes;S&=l.pendingLanes,g|=S,h.lanes=g,Kg(l,g)}}var wf={readContext:Dn,useCallback:Rr,useContext:Rr,useEffect:Rr,useImperativeHandle:Rr,useInsertionEffect:Rr,useLayoutEffect:Rr,useMemo:Rr,useReducer:Rr,useRef:Rr,useState:Rr,useDebugValue:Rr,useDeferredValue:Rr,useTransition:Rr,useMutableSource:Rr,useSyncExternalStore:Rr,useId:Rr,unstable_isNewReconciler:!1},Nz={readContext:Dn,useCallback:function(l,h){return Pa().memoizedState=[l,h===void 0?null:h],l},useContext:Dn,useEffect:hC,useImperativeHandle:function(l,h,g){return g=g!=null?g.concat([l]):null,xf(4194308,4,gC.bind(null,h,l),g)},useLayoutEffect:function(l,h){return xf(4194308,4,l,h)},useInsertionEffect:function(l,h){return xf(4,2,l,h)},useMemo:function(l,h){var g=Pa();return h=h===void 0?null:h,l=l(),g.memoizedState=[l,h],l},useReducer:function(l,h,g){var S=Pa();return h=g!==void 0?g(h):h,S.memoizedState=S.baseState=h,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:h},S.queue=l,l=l.dispatch=Sz.bind(null,Gt,l),[S.memoizedState,l]},useRef:function(l){var h=Pa();return l={current:l},h.memoizedState=l},useState:dC,useDebugValue:Wv,useDeferredValue:function(l){return Pa().memoizedState=l},useTransition:function(){var l=dC(!1),h=l[0];return l=wz.bind(null,l[1]),Pa().memoizedState=l,[h,l]},useMutableSource:function(){},useSyncExternalStore:function(l,h,g){var S=Gt,_=Pa();if(zt){if(g===void 0)throw Error(r(407));g=g()}else{if(g=h(),br===null)throw Error(r(349));(No&30)!==0||oC(S,h,g)}_.memoizedState=g;var P={value:g,getSnapshot:h};return _.queue=P,hC(lC.bind(null,S,P,l),[l]),S.flags|=2048,kc(9,sC.bind(null,S,P,g,h),void 0,null),g},useId:function(){var l=Pa(),h=br.identifierPrefix;if(zt){var g=Za,S=Qa;g=(S&~(1<<32-Qn(S)-1)).toString(32)+g,h=":"+h+"R"+g,g=Ac++,0<\/script>",l=l.removeChild(l.firstChild)):typeof S.is=="string"?l=R.createElement(g,{is:S.is}):(l=R.createElement(g),g==="select"&&(R=l,S.multiple?R.multiple=!0:S.size&&(R.size=S.size))):l=R.createElementNS(l,g),l[Ea]=h,l[jc]=S,VC(l,h,!1,!1),h.stateNode=l;e:{switch(R=ke(g,S),g){case"dialog":Lt("cancel",l),Lt("close",l),_=S;break;case"iframe":case"object":case"embed":Lt("load",l),_=S;break;case"video":case"audio":for(_=0;_ks&&(h.flags|=128,S=!0,Rc(P,!1),h.lanes=4194304)}else{if(!S)if(l=gf(R),l!==null){if(h.flags|=128,S=!0,g=l.updateQueue,g!==null&&(h.updateQueue=g,h.flags|=4),Rc(P,!0),P.tail===null&&P.tailMode==="hidden"&&!R.alternate&&!zt)return Ir(h),null}else 2*tr()-P.renderingStartTime>ks&&g!==1073741824&&(h.flags|=128,S=!0,Rc(P,!1),h.lanes=4194304);P.isBackwards?(R.sibling=h.child,h.child=R):(g=P.last,g!==null?g.sibling=R:h.child=R,P.last=R)}return P.tail!==null?(h=P.tail,P.rendering=h,P.tail=h.sibling,P.renderingStartTime=tr(),h.sibling=null,g=Wt.current,Rt(Wt,S?g&1|2:g&1),h):(Ir(h),null);case 22:case 23:return gy(),S=h.memoizedState!==null,l!==null&&l.memoizedState!==null!==S&&(h.flags|=8192),S&&(h.mode&1)!==0?(mn&1073741824)!==0&&(Ir(h),h.subtreeFlags&6&&(h.flags|=8192)):Ir(h),null;case 24:return null;case 25:return null}throw Error(r(156,h.tag))}function kz(l,h){switch(_v(h),h.tag){case 1:return Qr(h.type)&&af(),l=h.flags,l&65536?(h.flags=l&-65537|128,h):null;case 3:return Os(),$t(Jr),$t(kr),$v(),l=h.flags,(l&65536)!==0&&(l&128)===0?(h.flags=l&-65537|128,h):null;case 5:return Dv(h),null;case 13:if($t(Wt),l=h.memoizedState,l!==null&&l.dehydrated!==null){if(h.alternate===null)throw Error(r(340));Ns()}return l=h.flags,l&65536?(h.flags=l&-65537|128,h):null;case 19:return $t(Wt),null;case 4:return Os(),null;case 10:return Tv(h.type._context),null;case 22:case 23:return gy(),null;case 24:return null;default:return null}}var _f=!1,Mr=!1,Rz=typeof WeakSet=="function"?WeakSet:Set,Ae=null;function As(l,h){var g=l.ref;if(g!==null)if(typeof g=="function")try{g(null)}catch(S){Yt(l,h,S)}else g.current=null}function ay(l,h,g){try{g()}catch(S){Yt(l,h,S)}}var GC=!1;function Iz(l,h){if(gv=Vd,l=__(),lv(l)){if("selectionStart"in l)var g={start:l.selectionStart,end:l.selectionEnd};else e:{g=(g=l.ownerDocument)&&g.defaultView||window;var S=g.getSelection&&g.getSelection();if(S&&S.rangeCount!==0){g=S.anchorNode;var _=S.anchorOffset,P=S.focusNode;S=S.focusOffset;try{g.nodeType,P.nodeType}catch{g=null;break e}var R=0,J=-1,ae=-1,ue=0,we=0,Se=l,be=null;t:for(;;){for(var Oe;Se!==g||_!==0&&Se.nodeType!==3||(J=R+_),Se!==P||S!==0&&Se.nodeType!==3||(ae=R+S),Se.nodeType===3&&(R+=Se.nodeValue.length),(Oe=Se.firstChild)!==null;)be=Se,Se=Oe;for(;;){if(Se===l)break t;if(be===g&&++ue===_&&(J=R),be===P&&++we===S&&(ae=R),(Oe=Se.nextSibling)!==null)break;Se=be,be=Se.parentNode}Se=Oe}g=J===-1||ae===-1?null:{start:J,end:ae}}else g=null}g=g||{start:0,end:0}}else g=null;for(vv={focusedElem:l,selectionRange:g},Vd=!1,Ae=h;Ae!==null;)if(h=Ae,l=h.child,(h.subtreeFlags&1028)!==0&&l!==null)l.return=h,Ae=l;else for(;Ae!==null;){h=Ae;try{var Re=h.alternate;if((h.flags&1024)!==0)switch(h.tag){case 0:case 11:case 15:break;case 1:if(Re!==null){var De=Re.memoizedProps,rr=Re.memoizedState,se=h.stateNode,oe=se.getSnapshotBeforeUpdate(h.elementType===h.type?De:ta(h.type,De),rr);se.__reactInternalSnapshotBeforeUpdate=oe}break;case 3:var le=h.stateNode.containerInfo;le.nodeType===1?le.textContent="":le.nodeType===9&&le.documentElement&&le.removeChild(le.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Ne){Yt(h,h.return,Ne)}if(l=h.sibling,l!==null){l.return=h.return,Ae=l;break}Ae=h.return}return Re=GC,GC=!1,Re}function Ic(l,h,g){var S=h.updateQueue;if(S=S!==null?S.lastEffect:null,S!==null){var _=S=S.next;do{if((_.tag&l)===l){var P=_.destroy;_.destroy=void 0,P!==void 0&&ay(h,g,P)}_=_.next}while(_!==S)}}function Cf(l,h){if(h=h.updateQueue,h=h!==null?h.lastEffect:null,h!==null){var g=h=h.next;do{if((g.tag&l)===l){var S=g.create;g.destroy=S()}g=g.next}while(g!==h)}}function iy(l){var h=l.ref;if(h!==null){var g=l.stateNode;switch(l.tag){case 5:l=g;break;default:l=g}typeof h=="function"?h(l):h.current=l}}function KC(l){var h=l.alternate;h!==null&&(l.alternate=null,KC(h)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(h=l.stateNode,h!==null&&(delete h[Ea],delete h[jc],delete h[wv],delete h[gz],delete h[vz])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function YC(l){return l.tag===5||l.tag===3||l.tag===4}function XC(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||YC(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function oy(l,h,g){var S=l.tag;if(S===5||S===6)l=l.stateNode,h?g.nodeType===8?g.parentNode.insertBefore(l,h):g.insertBefore(l,h):(g.nodeType===8?(h=g.parentNode,h.insertBefore(l,g)):(h=g,h.appendChild(l)),g=g._reactRootContainer,g!=null||h.onclick!==null||(h.onclick=rf));else if(S!==4&&(l=l.child,l!==null))for(oy(l,h,g),l=l.sibling;l!==null;)oy(l,h,g),l=l.sibling}function sy(l,h,g){var S=l.tag;if(S===5||S===6)l=l.stateNode,h?g.insertBefore(l,h):g.appendChild(l);else if(S!==4&&(l=l.child,l!==null))for(sy(l,h,g),l=l.sibling;l!==null;)sy(l,h,g),l=l.sibling}var Er=null,ra=!1;function Hi(l,h,g){for(g=g.child;g!==null;)JC(l,h,g),g=g.sibling}function JC(l,h,g){if(Ca&&typeof Ca.onCommitFiberUnmount=="function")try{Ca.onCommitFiberUnmount($d,g)}catch{}switch(g.tag){case 5:Mr||As(g,h);case 6:var S=Er,_=ra;Er=null,Hi(l,h,g),Er=S,ra=_,Er!==null&&(ra?(l=Er,g=g.stateNode,l.nodeType===8?l.parentNode.removeChild(g):l.removeChild(g)):Er.removeChild(g.stateNode));break;case 18:Er!==null&&(ra?(l=Er,g=g.stateNode,l.nodeType===8?bv(l.parentNode,g):l.nodeType===1&&bv(l,g),fc(l)):bv(Er,g.stateNode));break;case 4:S=Er,_=ra,Er=g.stateNode.containerInfo,ra=!0,Hi(l,h,g),Er=S,ra=_;break;case 0:case 11:case 14:case 15:if(!Mr&&(S=g.updateQueue,S!==null&&(S=S.lastEffect,S!==null))){_=S=S.next;do{var P=_,R=P.destroy;P=P.tag,R!==void 0&&((P&2)!==0||(P&4)!==0)&&ay(g,h,R),_=_.next}while(_!==S)}Hi(l,h,g);break;case 1:if(!Mr&&(As(g,h),S=g.stateNode,typeof S.componentWillUnmount=="function"))try{S.props=g.memoizedProps,S.state=g.memoizedState,S.componentWillUnmount()}catch(J){Yt(g,h,J)}Hi(l,h,g);break;case 21:Hi(l,h,g);break;case 22:g.mode&1?(Mr=(S=Mr)||g.memoizedState!==null,Hi(l,h,g),Mr=S):Hi(l,h,g);break;default:Hi(l,h,g)}}function QC(l){var h=l.updateQueue;if(h!==null){l.updateQueue=null;var g=l.stateNode;g===null&&(g=l.stateNode=new Rz),h.forEach(function(S){var _=Uz.bind(null,l,S);g.has(S)||(g.add(S),S.then(_,_))})}}function na(l,h){var g=h.deletions;if(g!==null)for(var S=0;S_&&(_=R),S&=~P}if(S=_,S=tr()-S,S=(120>S?120:480>S?480:1080>S?1080:1920>S?1920:3e3>S?3e3:4320>S?4320:1960*Dz(S/1960))-S,10l?16:l,Gi===null)var S=!1;else{if(l=Gi,Gi=null,Tf=0,(ut&6)!==0)throw Error(r(331));var _=ut;for(ut|=4,Ae=l.current;Ae!==null;){var P=Ae,R=P.child;if((Ae.flags&16)!==0){var J=P.deletions;if(J!==null){for(var ae=0;aetr()-uy?Eo(l,0):cy|=g),tn(l,h)}function dE(l,h){h===0&&((l.mode&1)===0?h=1:(h=Bd,Bd<<=1,(Bd&130023424)===0&&(Bd=4194304)));var g=Hr();l=ei(l,h),l!==null&&(sc(l,h,g),tn(l,g))}function qz(l){var h=l.memoizedState,g=0;h!==null&&(g=h.retryLane),dE(l,g)}function Uz(l,h){var g=0;switch(l.tag){case 13:var S=l.stateNode,_=l.memoizedState;_!==null&&(g=_.retryLane);break;case 19:S=l.stateNode;break;default:throw Error(r(314))}S!==null&&S.delete(h),dE(l,g)}var fE;fE=function(l,h,g){if(l!==null)if(l.memoizedProps!==h.pendingProps||Jr.current)Zr=!0;else{if((l.lanes&g)===0&&(h.flags&128)===0)return Zr=!1,Az(l,h,g);Zr=(l.flags&131072)!==0}else Zr=!1,zt&&(h.flags&1048576)!==0&&H_(h,cf,h.index);switch(h.lanes=0,h.tag){case 2:var S=h.type;Nf(l,h),l=h.pendingProps;var _=ws(h,kr.current);Es(h,g),_=zv(null,h,S,l,_,g);var P=qv();return h.flags|=1,typeof _=="object"&&_!==null&&typeof _.render=="function"&&_.$$typeof===void 0?(h.tag=1,h.memoizedState=null,h.updateQueue=null,Qr(S)?(P=!0,of(h)):P=!1,h.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,Iv(h),_.updater=Sf,h.stateNode=_,_._reactInternals=h,Kv(h,S,l,g),h=Qv(null,h,S,!0,P,g)):(h.tag=0,zt&&P&&Nv(h),Vr(null,h,_,g),h=h.child),h;case 16:S=h.elementType;e:{switch(Nf(l,h),l=h.pendingProps,_=S._init,S=_(S._payload),h.type=S,_=h.tag=Hz(S),l=ta(S,l),_){case 0:h=Jv(null,h,S,l,g);break e;case 1:h=$C(null,h,S,l,g);break e;case 11:h=RC(null,h,S,l,g);break e;case 14:h=IC(null,h,S,ta(S.type,l),g);break e}throw Error(r(306,S,""))}return h;case 0:return S=h.type,_=h.pendingProps,_=h.elementType===S?_:ta(S,_),Jv(l,h,S,_,g);case 1:return S=h.type,_=h.pendingProps,_=h.elementType===S?_:ta(S,_),$C(l,h,S,_,g);case 3:e:{if(FC(h),l===null)throw Error(r(387));S=h.pendingProps,P=h.memoizedState,_=P.element,eC(l,h),mf(h,S,null,g);var R=h.memoizedState;if(S=R.element,P.isDehydrated)if(P={element:S,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},h.updateQueue.baseState=P,h.memoizedState=P,h.flags&256){_=Ps(Error(r(423)),h),h=BC(l,h,S,g,_);break e}else if(S!==_){_=Ps(Error(r(424)),h),h=BC(l,h,S,g,_);break e}else for(pn=Fi(h.stateNode.containerInfo.firstChild),hn=h,zt=!0,ea=null,g=Q_(h,null,S,g),h.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling;else{if(Ns(),S===_){h=ri(l,h,g);break e}Vr(l,h,S,g)}h=h.child}return h;case 5:return nC(h),l===null&&Ev(h),S=h.type,_=h.pendingProps,P=l!==null?l.memoizedProps:null,R=_.children,yv(S,_)?R=null:P!==null&&yv(S,P)&&(h.flags|=32),LC(l,h),Vr(l,h,R,g),h.child;case 6:return l===null&&Ev(h),null;case 13:return zC(l,h,g);case 4:return Mv(h,h.stateNode.containerInfo),S=h.pendingProps,l===null?h.child=_s(h,null,S,g):Vr(l,h,S,g),h.child;case 11:return S=h.type,_=h.pendingProps,_=h.elementType===S?_:ta(S,_),RC(l,h,S,_,g);case 7:return Vr(l,h,h.pendingProps,g),h.child;case 8:return Vr(l,h,h.pendingProps.children,g),h.child;case 12:return Vr(l,h,h.pendingProps.children,g),h.child;case 10:e:{if(S=h.type._context,_=h.pendingProps,P=h.memoizedProps,R=_.value,Rt(ff,S._currentValue),S._currentValue=R,P!==null)if(Zn(P.value,R)){if(P.children===_.children&&!Jr.current){h=ri(l,h,g);break e}}else for(P=h.child,P!==null&&(P.return=h);P!==null;){var J=P.dependencies;if(J!==null){R=P.child;for(var ae=J.firstContext;ae!==null;){if(ae.context===S){if(P.tag===1){ae=ti(-1,g&-g),ae.tag=2;var ue=P.updateQueue;if(ue!==null){ue=ue.shared;var we=ue.pending;we===null?ae.next=ae:(ae.next=we.next,we.next=ae),ue.pending=ae}}P.lanes|=g,ae=P.alternate,ae!==null&&(ae.lanes|=g),kv(P.return,g,h),J.lanes|=g;break}ae=ae.next}}else if(P.tag===10)R=P.type===h.type?null:P.child;else if(P.tag===18){if(R=P.return,R===null)throw Error(r(341));R.lanes|=g,J=R.alternate,J!==null&&(J.lanes|=g),kv(R,g,h),R=P.sibling}else R=P.child;if(R!==null)R.return=P;else for(R=P;R!==null;){if(R===h){R=null;break}if(P=R.sibling,P!==null){P.return=R.return,R=P;break}R=R.return}P=R}Vr(l,h,_.children,g),h=h.child}return h;case 9:return _=h.type,S=h.pendingProps.children,Es(h,g),_=Dn(_),S=S(_),h.flags|=1,Vr(l,h,S,g),h.child;case 14:return S=h.type,_=ta(S,h.pendingProps),_=ta(S.type,_),IC(l,h,S,_,g);case 15:return MC(l,h,h.type,h.pendingProps,g);case 17:return S=h.type,_=h.pendingProps,_=h.elementType===S?_:ta(S,_),Nf(l,h),h.tag=1,Qr(S)?(l=!0,of(h)):l=!1,Es(h,g),CC(h,S,_),Kv(h,S,_,g),Qv(null,h,S,!0,l,g);case 19:return UC(l,h,g);case 22:return DC(l,h,g)}throw Error(r(156,h.tag))};function hE(l,h){return WN(l,h)}function Vz(l,h,g,S){this.tag=l,this.key=g,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=h,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=S,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fn(l,h,g,S){return new Vz(l,h,g,S)}function yy(l){return l=l.prototype,!(!l||!l.isReactComponent)}function Hz(l){if(typeof l=="function")return yy(l)?1:0;if(l!=null){if(l=l.$$typeof,l===I)return 11;if(l===W)return 14}return 2}function Xi(l,h){var g=l.alternate;return g===null?(g=Fn(l.tag,h,l.key,l.mode),g.elementType=l.elementType,g.type=l.type,g.stateNode=l.stateNode,g.alternate=l,l.alternate=g):(g.pendingProps=h,g.type=l.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=l.flags&14680064,g.childLanes=l.childLanes,g.lanes=l.lanes,g.child=l.child,g.memoizedProps=l.memoizedProps,g.memoizedState=l.memoizedState,g.updateQueue=l.updateQueue,h=l.dependencies,g.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},g.sibling=l.sibling,g.index=l.index,g.ref=l.ref,g}function Mf(l,h,g,S,_,P){var R=2;if(S=l,typeof l=="function")yy(l)&&(R=1);else if(typeof l=="string")R=5;else e:switch(l){case T:return Po(g.children,_,P,h);case k:R=8,_|=8;break;case M:return l=Fn(12,g,h,_|2),l.elementType=M,l.lanes=P,l;case H:return l=Fn(13,g,h,_),l.elementType=H,l.lanes=P,l;case Y:return l=Fn(19,g,h,_),l.elementType=Y,l.lanes=P,l;case K:return Df(g,_,P,h);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case L:R=10;break e;case $:R=9;break e;case I:R=11;break e;case W:R=14;break e;case V:R=16,S=null;break e}throw Error(r(130,l==null?l:typeof l,""))}return h=Fn(R,g,h,_),h.elementType=l,h.type=S,h.lanes=P,h}function Po(l,h,g,S){return l=Fn(7,l,S,h),l.lanes=g,l}function Df(l,h,g,S){return l=Fn(22,l,S,h),l.elementType=K,l.lanes=g,l.stateNode={isHidden:!1},l}function xy(l,h,g){return l=Fn(6,l,null,h),l.lanes=g,l}function by(l,h,g){return h=Fn(4,l.children!==null?l.children:[],l.key,h),h.lanes=g,h.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},h}function Wz(l,h,g,S,_){this.tag=h,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Gg(0),this.expirationTimes=Gg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gg(0),this.identifierPrefix=S,this.onRecoverableError=_,this.mutableSourceEagerHydrationData=null}function wy(l,h,g,S,_,P,R,J,ae){return l=new Wz(l,h,g,J,ae),h===1?(h=1,P===!0&&(h|=8)):h=0,P=Fn(3,null,null,h),l.current=P,P.stateNode=l,P.memoizedState={element:S,isDehydrated:g,cache:null,transitions:null,pendingSuspenseBoundaries:null},Iv(P),l}function Gz(l,h,g){var S=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ey.exports=i8(),Ey.exports}var EE;function o8(){if(EE)return Vf;EE=1;var e=EM();return Vf.createRoot=e.createRoot,Vf.hydrateRoot=e.hydrateRoot,Vf}var s8=o8(),b=Sm();const q=mt(b),XS=Zz({__proto__:null,default:q},[b]);var nd=EM();const OM=mt(nd);function l8(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const c8=e=>{switch(e){case"success":return f8;case"info":return p8;case"warning":return h8;case"error":return m8;default:return null}},u8=Array(12).fill(0),d8=({visible:e,className:t})=>q.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},q.createElement("div",{className:"sonner-spinner"},u8.map((r,n)=>q.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),f8=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),h8=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),p8=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),m8=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),g8=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},q.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),q.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),v8=()=>{const[e,t]=q.useState(document.hidden);return q.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let sw=1;class y8{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:n,...a}=t,i=typeof t?.id=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:sw++,s=this.toasts.find(d=>d.id===i),u=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),s?this.toasts=this.toasts.map(d=>d.id===i?(this.publish({...d,...t,id:i,title:n}),{...d,...t,id:i,dismissible:u,title:n}):d):this.addToast({title:n,...a,dismissible:u,id:i}),i},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const a=Promise.resolve(t instanceof Function?t():t);let i=n!==void 0,s;const u=a.then(async c=>{if(s=["resolve",c],q.isValidElement(c))i=!1,this.create({id:n,type:"default",message:c});else if(b8(c)&&!c.ok){i=!1;const p=typeof r.error=="function"?await r.error(`HTTP error! status: ${c.status}`):r.error,m=typeof r.description=="function"?await r.description(`HTTP error! status: ${c.status}`):r.description,y=typeof p=="object"&&!q.isValidElement(p)?p:{message:p};this.create({id:n,type:"error",description:m,...y})}else if(c instanceof Error){i=!1;const p=typeof r.error=="function"?await r.error(c):r.error,m=typeof r.description=="function"?await r.description(c):r.description,y=typeof p=="object"&&!q.isValidElement(p)?p:{message:p};this.create({id:n,type:"error",description:m,...y})}else if(r.success!==void 0){i=!1;const p=typeof r.success=="function"?await r.success(c):r.success,m=typeof r.description=="function"?await r.description(c):r.description,y=typeof p=="object"&&!q.isValidElement(p)?p:{message:p};this.create({id:n,type:"success",description:m,...y})}}).catch(async c=>{if(s=["reject",c],r.error!==void 0){i=!1;const f=typeof r.error=="function"?await r.error(c):r.error,p=typeof r.description=="function"?await r.description(c):r.description,v=typeof f=="object"&&!q.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:p,...v})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),d=()=>new Promise((c,f)=>u.then(()=>s[0]==="reject"?f(s[1]):c(s[1])).catch(f));return typeof n!="string"&&typeof n!="number"?{unwrap:d}:Object.assign(n,{unwrap:d})},this.custom=(t,r)=>{const n=r?.id||sw++;return this.create({jsx:t(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const an=new y8,x8=(e,t)=>{const r=t?.id||sw++;return an.addToast({title:e,...t,id:r}),r},b8=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",w8=x8,S8=()=>an.toasts,j8=()=>an.getActiveToasts(),me=Object.assign(w8,{success:an.success,info:an.info,warning:an.warning,error:an.error,custom:an.custom,message:an.message,promise:an.promise,dismiss:an.dismiss,loading:an.loading},{getHistory:S8,getToasts:j8});l8("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Hf(e){return e.label!==void 0}const N8=3,_8="24px",C8="16px",OE=4e3,E8=356,O8=14,P8=45,A8=200;function Ta(...e){return e.filter(Boolean).join(" ")}function T8(e){const[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}const k8=e=>{var t,r,n,a,i,s,u,d,c;const{invert:f,toast:p,unstyled:m,interacting:v,setHeights:y,visibleToasts:x,heights:w,index:j,toasts:N,expanded:C,removeToast:A,defaultRichColors:E,closeButton:O,style:T,cancelButtonStyle:k,actionButtonStyle:M,className:L="",descriptionClassName:$="",duration:I,position:H,gap:Y,expandByDefault:W,classNames:V,icons:K,closeButtonAriaLabel:F="Close toast"}=e,[te,D]=q.useState(null),[U,z]=q.useState(null),[B,X]=q.useState(!1),[Q,re]=q.useState(!1),[G,Z]=q.useState(!1),[ee,ce]=q.useState(!1),[ve,ne]=q.useState(!1),[Ce,pe]=q.useState(0),[Pe,$e]=q.useState(0),Fe=q.useRef(p.duration||I||OE),dt=q.useRef(null),ct=q.useRef(null),St=j===0,Ot=j+1<=x,it=p.type,Pt=p.dismissible!==!1,Ut=p.className||"",Ar=p.descriptionClassName||"",_r=q.useMemo(()=>w.findIndex(et=>et.toastId===p.id)||0,[w,p.id]),qr=q.useMemo(()=>{var et;return(et=p.closeButton)!=null?et:O},[p.closeButton,O]),Kt=q.useMemo(()=>p.duration||I||OE,[p.duration,I]),_t=q.useRef(0),Vt=q.useRef(0),vr=q.useRef(0),Ur=q.useRef(null),[Ka,Na]=H.split("-"),Pi=q.useMemo(()=>w.reduce((et,er,lr)=>lr>=_r?et:et+er.height,0),[w,_r]),ie=v8(),ke=p.invert||f,Xe=it==="loading";Vt.current=q.useMemo(()=>_r*Y+Pi,[_r,Pi]),q.useEffect(()=>{Fe.current=Kt},[Kt]),q.useEffect(()=>{X(!0)},[]),q.useEffect(()=>{const et=ct.current;if(et){const er=et.getBoundingClientRect().height;return $e(er),y(lr=>[{toastId:p.id,height:er,position:p.position},...lr]),()=>y(lr=>lr.filter(Tr=>Tr.toastId!==p.id))}},[y,p.id]),q.useLayoutEffect(()=>{if(!B)return;const et=ct.current,er=et.style.height;et.style.height="auto";const lr=et.getBoundingClientRect().height;et.style.height=er,$e(lr),y(Tr=>Tr.find(nr=>nr.toastId===p.id)?Tr.map(nr=>nr.toastId===p.id?{...nr,height:lr}:nr):[{toastId:p.id,height:lr,position:p.position},...Tr])},[B,p.title,p.description,y,p.id,p.jsx,p.action,p.cancel]);const Ht=q.useCallback(()=>{re(!0),pe(Vt.current),y(et=>et.filter(er=>er.toastId!==p.id)),setTimeout(()=>{A(p)},A8)},[p,A,y,Vt]);q.useEffect(()=>{if(p.promise&&it==="loading"||p.duration===1/0||p.type==="loading")return;let et;return C||v||ie?(()=>{if(vr.current<_t.current){const Tr=new Date().getTime()-_t.current;Fe.current=Fe.current-Tr}vr.current=new Date().getTime()})():(()=>{Fe.current!==1/0&&(_t.current=new Date().getTime(),et=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),Ht()},Fe.current))})(),()=>clearTimeout(et)},[C,v,p,it,ie,Ht]),q.useEffect(()=>{p.delete&&(Ht(),p.onDismiss==null||p.onDismiss.call(p,p))},[Ht,p.delete]);function Bt(){var et;if(K?.loading){var er;return q.createElement("div",{className:Ta(V?.loader,p==null||(er=p.classNames)==null?void 0:er.loader,"sonner-loader"),"data-visible":it==="loading"},K.loading)}return q.createElement(d8,{className:Ta(V?.loader,p==null||(et=p.classNames)==null?void 0:et.loader),visible:it==="loading"})}const _a=p.icon||K?.[it]||c8(it);var kn,Ya;return q.createElement("li",{tabIndex:0,ref:ct,className:Ta(L,Ut,V?.toast,p==null||(t=p.classNames)==null?void 0:t.toast,V?.default,V?.[it],p==null||(r=p.classNames)==null?void 0:r[it]),"data-sonner-toast":"","data-rich-colors":(kn=p.richColors)!=null?kn:E,"data-styled":!(p.jsx||p.unstyled||m),"data-mounted":B,"data-promise":!!p.promise,"data-swiped":ve,"data-removed":Q,"data-visible":Ot,"data-y-position":Ka,"data-x-position":Na,"data-index":j,"data-front":St,"data-swiping":G,"data-dismissible":Pt,"data-type":it,"data-invert":ke,"data-swipe-out":ee,"data-swipe-direction":U,"data-expanded":!!(C||W&&B),"data-testid":p.testId,style:{"--index":j,"--toasts-before":j,"--z-index":N.length-j,"--offset":`${Q?Ce:Vt.current}px`,"--initial-height":W?"auto":`${Pe}px`,...T,...p.style},onDragEnd:()=>{Z(!1),D(null),Ur.current=null},onPointerDown:et=>{et.button!==2&&(Xe||!Pt||(dt.current=new Date,pe(Vt.current),et.target.setPointerCapture(et.pointerId),et.target.tagName!=="BUTTON"&&(Z(!0),Ur.current={x:et.clientX,y:et.clientY})))},onPointerUp:()=>{var et,er,lr;if(ee||!Pt)return;Ur.current=null;const Tr=Number(((et=ct.current)==null?void 0:et.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ai=Number(((er=ct.current)==null?void 0:er.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),nr=new Date().getTime()-((lr=dt.current)==null?void 0:lr.getTime()),yr=te==="x"?Tr:Ai,Ti=Math.abs(yr)/nr;if(Math.abs(yr)>=P8||Ti>.11){pe(Vt.current),p.onDismiss==null||p.onDismiss.call(p,p),z(te==="x"?Tr>0?"right":"left":Ai>0?"down":"up"),Ht(),ce(!0);return}else{var Cr,dn;(Cr=ct.current)==null||Cr.style.setProperty("--swipe-amount-x","0px"),(dn=ct.current)==null||dn.style.setProperty("--swipe-amount-y","0px")}ne(!1),Z(!1),D(null)},onPointerMove:et=>{var er,lr,Tr;if(!Ur.current||!Pt||((er=window.getSelection())==null?void 0:er.toString().length)>0)return;const nr=et.clientY-Ur.current.y,yr=et.clientX-Ur.current.x;var Ti;const Cr=(Ti=e.swipeDirections)!=null?Ti:T8(H);!te&&(Math.abs(yr)>1||Math.abs(nr)>1)&&D(Math.abs(yr)>Math.abs(nr)?"x":"y");let dn={x:0,y:0};const ki=Rn=>1/(1.5+Math.abs(Rn)/20);if(te==="y"){if(Cr.includes("top")||Cr.includes("bottom"))if(Cr.includes("top")&&nr<0||Cr.includes("bottom")&&nr>0)dn.y=nr;else{const Rn=nr*ki(nr);dn.y=Math.abs(Rn)0)dn.x=yr;else{const Rn=yr*ki(yr);dn.x=Math.abs(Rn)0||Math.abs(dn.y)>0)&&ne(!0),(lr=ct.current)==null||lr.style.setProperty("--swipe-amount-x",`${dn.x}px`),(Tr=ct.current)==null||Tr.style.setProperty("--swipe-amount-y",`${dn.y}px`)}},qr&&!p.jsx&&it!=="loading"?q.createElement("button",{"aria-label":F,"data-disabled":Xe,"data-close-button":!0,onClick:Xe||!Pt?()=>{}:()=>{Ht(),p.onDismiss==null||p.onDismiss.call(p,p)},className:Ta(V?.closeButton,p==null||(n=p.classNames)==null?void 0:n.closeButton)},(Ya=K?.close)!=null?Ya:g8):null,(it||p.icon||p.promise)&&p.icon!==null&&(K?.[it]!==null||p.icon)?q.createElement("div",{"data-icon":"",className:Ta(V?.icon,p==null||(a=p.classNames)==null?void 0:a.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||Bt():null,p.type!=="loading"?_a:null):null,q.createElement("div",{"data-content":"",className:Ta(V?.content,p==null||(i=p.classNames)==null?void 0:i.content)},q.createElement("div",{"data-title":"",className:Ta(V?.title,p==null||(s=p.classNames)==null?void 0:s.title)},p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title),p.description?q.createElement("div",{"data-description":"",className:Ta($,Ar,V?.description,p==null||(u=p.classNames)==null?void 0:u.description)},typeof p.description=="function"?p.description():p.description):null),q.isValidElement(p.cancel)?p.cancel:p.cancel&&Hf(p.cancel)?q.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||k,onClick:et=>{Hf(p.cancel)&&Pt&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,et),Ht())},className:Ta(V?.cancelButton,p==null||(d=p.classNames)==null?void 0:d.cancelButton)},p.cancel.label):null,q.isValidElement(p.action)?p.action:p.action&&Hf(p.action)?q.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||M,onClick:et=>{Hf(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,et),!et.defaultPrevented&&Ht())},className:Ta(V?.actionButton,p==null||(c=p.classNames)==null?void 0:c.actionButton)},p.action.label):null)};function PE(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function R8(e,t){const r={};return[e,t].forEach((n,a)=>{const i=a===1,s=i?"--mobile-offset":"--offset",u=i?C8:_8;function d(c){["top","right","bottom","left"].forEach(f=>{r[`${s}-${f}`]=typeof c=="number"?`${c}px`:c})}typeof n=="number"||typeof n=="string"?d(n):typeof n=="object"?["top","right","bottom","left"].forEach(c=>{n[c]===void 0?r[`${s}-${c}`]=u:r[`${s}-${c}`]=typeof n[c]=="number"?`${n[c]}px`:n[c]}):d(u)}),r}const I8=q.forwardRef(function(t,r){const{id:n,invert:a,position:i="bottom-right",hotkey:s=["altKey","KeyT"],expand:u,closeButton:d,className:c,offset:f,mobileOffset:p,theme:m="light",richColors:v,duration:y,style:x,visibleToasts:w=N8,toastOptions:j,dir:N=PE(),gap:C=O8,icons:A,containerAriaLabel:E="Notifications"}=t,[O,T]=q.useState([]),k=q.useMemo(()=>n?O.filter(B=>B.toasterId===n):O.filter(B=>!B.toasterId),[O,n]),M=q.useMemo(()=>Array.from(new Set([i].concat(k.filter(B=>B.position).map(B=>B.position)))),[k,i]),[L,$]=q.useState([]),[I,H]=q.useState(!1),[Y,W]=q.useState(!1),[V,K]=q.useState(m!=="system"?m:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),F=q.useRef(null),te=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),D=q.useRef(null),U=q.useRef(!1),z=q.useCallback(B=>{T(X=>{var Q;return(Q=X.find(re=>re.id===B.id))!=null&&Q.delete||an.dismiss(B.id),X.filter(({id:re})=>re!==B.id)})},[]);return q.useEffect(()=>an.subscribe(B=>{if(B.dismiss){requestAnimationFrame(()=>{T(X=>X.map(Q=>Q.id===B.id?{...Q,delete:!0}:Q))});return}setTimeout(()=>{OM.flushSync(()=>{T(X=>{const Q=X.findIndex(re=>re.id===B.id);return Q!==-1?[...X.slice(0,Q),{...X[Q],...B},...X.slice(Q+1)]:[B,...X]})})})}),[O]),q.useEffect(()=>{if(m!=="system"){K(m);return}if(m==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?K("dark"):K("light")),typeof window>"u")return;const B=window.matchMedia("(prefers-color-scheme: dark)");try{B.addEventListener("change",({matches:X})=>{K(X?"dark":"light")})}catch{B.addListener(({matches:Q})=>{try{K(Q?"dark":"light")}catch(re){console.error(re)}})}},[m]),q.useEffect(()=>{O.length<=1&&H(!1)},[O]),q.useEffect(()=>{const B=X=>{var Q;if(s.every(Z=>X[Z]||X.code===Z)){var G;H(!0),(G=F.current)==null||G.focus()}X.code==="Escape"&&(document.activeElement===F.current||(Q=F.current)!=null&&Q.contains(document.activeElement))&&H(!1)};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[s]),q.useEffect(()=>{if(F.current)return()=>{D.current&&(D.current.focus({preventScroll:!0}),D.current=null,U.current=!1)}},[F.current]),q.createElement("section",{ref:r,"aria-label":`${E} ${te}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((B,X)=>{var Q;const[re,G]=B.split("-");return k.length?q.createElement("ol",{key:B,dir:N==="auto"?PE():N,tabIndex:-1,ref:F,className:c,"data-sonner-toaster":!0,"data-sonner-theme":V,"data-y-position":re,"data-x-position":G,style:{"--front-toast-height":`${((Q=L[0])==null?void 0:Q.height)||0}px`,"--width":`${E8}px`,"--gap":`${C}px`,...x,...R8(f,p)},onBlur:Z=>{U.current&&!Z.currentTarget.contains(Z.relatedTarget)&&(U.current=!1,D.current&&(D.current.focus({preventScroll:!0}),D.current=null))},onFocus:Z=>{Z.target instanceof HTMLElement&&Z.target.dataset.dismissible==="false"||U.current||(U.current=!0,D.current=Z.relatedTarget)},onMouseEnter:()=>H(!0),onMouseMove:()=>H(!0),onMouseLeave:()=>{Y||H(!1)},onDragEnd:()=>H(!1),onPointerDown:Z=>{Z.target instanceof HTMLElement&&Z.target.dataset.dismissible==="false"||W(!0)},onPointerUp:()=>W(!1)},k.filter(Z=>!Z.position&&X===0||Z.position===B).map((Z,ee)=>{var ce,ve;return q.createElement(k8,{key:Z.id,icons:A,index:ee,toast:Z,defaultRichColors:v,duration:(ce=j?.duration)!=null?ce:y,className:j?.className,descriptionClassName:j?.descriptionClassName,invert:a,visibleToasts:w,closeButton:(ve=j?.closeButton)!=null?ve:d,interacting:Y,position:B,style:j?.style,unstyled:j?.unstyled,classNames:j?.classNames,cancelButtonStyle:j?.cancelButtonStyle,actionButtonStyle:j?.actionButtonStyle,closeButtonAriaLabel:j?.closeButtonAriaLabel,removeToast:z,toasts:k.filter(ne=>ne.position==Z.position),heights:L.filter(ne=>ne.position==Z.position),setHeights:$,expandByDefault:u,gap:C,expanded:I,swipeDirections:t.swipeDirections})})):null}))});/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const M8=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),D8=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),AE=e=>{const t=D8(e);return t.charAt(0).toUpperCase()+t.slice(1)},PM=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var L8={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $8=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:i,iconNode:s,...u},d)=>b.createElement("svg",{ref:d,...L8,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:PM("lucide",a),...u},[...s.map(([c,f])=>b.createElement(c,f)),...Array.isArray(i)?i:[i]]));/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ze=(e,t)=>{const r=b.forwardRef(({className:n,...a},i)=>b.createElement($8,{ref:i,iconNode:t,className:PM(`lucide-${M8(AE(e))}`,`lucide-${e}`,n),...a}));return r.displayName=AE(e),r};/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const F8=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]],B8=ze("arrow-down-a-z",F8);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const z8=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],q8=ze("arrow-down-right",z8);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const U8=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],AM=ze("arrow-left",U8);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const V8=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],H8=ze("arrow-up-down",V8);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const W8=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],TM=ze("arrow-up-right",W8);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const G8=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],K8=ze("calendar",G8);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Y8=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],X8=ze("chart-column",Y8);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const J8=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],kM=ze("check",J8);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Q8=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ll=ze("chevron-down",Q8);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Z8=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],RM=ze("chevron-left",Z8);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const e6=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],cl=ze("chevron-right",e6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const t6=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],r6=ze("chevron-up",t6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const n6=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],IM=ze("chevrons-up-down",n6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const a6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],np=ze("circle-help",a6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const i6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],o6=ze("circle-user",i6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const s6=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],l6=ze("clipboard-list",s6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const c6=[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]],u6=ze("coffee",c6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const d6=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],JS=ze("download",d6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const f6=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],pi=ze("ellipsis",f6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const h6=[["path",{d:"M14.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"16lz6z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 13.1a2 2 0 0 0-1 1.76v3.24a2 2 0 0 0 .97 1.78L6 21.7a2 2 0 0 0 2.03.01L11 19.9a2 2 0 0 0 1-1.76V14.9a2 2 0 0 0-.97-1.78L8 11.3a2 2 0 0 0-2.03-.01Z",key:"99pj1s"}],["path",{d:"M7 17v5",key:"1yj1jh"}],["path",{d:"M11.7 14.2 7 17l-4.7-2.8",key:"1yk8tc"}]],MM=ze("file-box",h6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const p6=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ul=ze("file-text",p6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const m6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],g6=ze("grid-3x3",m6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const v6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],y6=ze("image",v6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const x6=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],DM=ze("layers",x6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const b6=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],LM=ze("layout-dashboard",b6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const w6=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],S6=ze("list",w6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const j6=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],N6=ze("log-out",j6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _6=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],ql=ze("map-pin",_6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const C6=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],E6=ze("menu",C6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const O6=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],mu=ze("package",O6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const P6=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Qh=ze("pencil",P6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const A6=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],T6=ze("pin",A6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const k6=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ln=ze("plus",k6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const R6=[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]],$M=ze("printer",R6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const I6=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],M6=ze("refresh-cw",I6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const D6=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],L6=ze("save",D6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $6=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],jm=ze("search",$6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const F6=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ap=ze("settings",F6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const B6=[["path",{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",key:"oel41y"}]],z6=ze("shield",B6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const q6=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Cn=ze("square-pen",q6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const U6=[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]],V6=ze("store",U6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const H6=[["path",{d:"m18 2 4 4",key:"22kx64"}],["path",{d:"m17 7 3-3",key:"1w1zoj"}],["path",{d:"M19 9 8.7 19.3c-1 1-2.5 1-3.4 0l-.6-.6c-1-1-1-2.5 0-3.4L15 5",key:"1exhtz"}],["path",{d:"m9 11 4 4",key:"rovt3i"}],["path",{d:"m5 19-3 3",key:"59f2uf"}],["path",{d:"m14 4 6 6",key:"yqp9t2"}]],Ay=ze("syringe",H6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const W6=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]],G6=ze("tablet",W6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const K6=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],ip=ze("tag",K6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Y6=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],X6=ze("timer",Y6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const J6=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],Et=ze("trash-2",J6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Q6=[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]],Z6=ze("trending-up",Q6);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const eq=[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]],FM=ze("type",eq);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tq=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],rq=ze("upload",tq);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nq=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],aq=ze("user",nq);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iq=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]],QS=ze("users",iq);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oq=[["path",{d:"M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2",key:"cjf0a3"}],["path",{d:"M7 2v20",key:"1473qp"}],["path",{d:"M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7",key:"j28e5"}]],sq=ze("utensils",oq);/** + * @license lucide-react v0.487.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lq=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],no=ze("x",lq);function BM(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t{const r=new Array(e.length+t.length);for(let n=0;n({classGroupId:e,validator:t}),zM=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),op="-",TE=[],dq="arbitrary..",fq=e=>{const t=pq(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return hq(s);const u=s.split(op),d=u[0]===""&&u.length>1?1:0;return qM(u,d,t)},getConflictingClassGroupIds:(s,u)=>{if(u){const d=n[s],c=r[s];return d?c?cq(c,d):d:c||TE}return r[s]||TE}}},qM=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const a=e[t],i=r.nextPart.get(a);if(i){const c=qM(e,t+1,i);if(c)return c}const s=r.validators;if(s===null)return;const u=t===0?e.join(op):e.slice(t).join(op),d=s.length;for(let c=0;ce.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?dq+n:void 0})(),pq=e=>{const{theme:t,classGroups:r}=e;return mq(r,t)},mq=(e,t)=>{const r=zM();for(const n in e){const a=e[n];ZS(a,r,n,t)}return r},ZS=(e,t,r,n)=>{const a=e.length;for(let i=0;i{if(typeof e=="string"){vq(e,t,r);return}if(typeof e=="function"){yq(e,t,r,n);return}xq(e,t,r,n)},vq=(e,t,r)=>{const n=e===""?t:UM(t,e);n.classGroupId=r},yq=(e,t,r,n)=>{if(bq(e)){ZS(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(uq(r,e))},xq=(e,t,r,n)=>{const a=Object.entries(e),i=a.length;for(let s=0;s{let r=e;const n=t.split(op),a=n.length;for(let i=0;i"isThemeGetter"in e&&e.isThemeGetter===!0,wq=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(i,s)=>{r[i]=s,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(i){let s=r[i];if(s!==void 0)return s;if((s=n[i])!==void 0)return a(i,s),s},set(i,s){i in r?r[i]=s:a(i,s)}}},lw="!",kE=":",Sq=[],RE=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),jq=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const i=[];let s=0,u=0,d=0,c;const f=a.length;for(let x=0;xd?c-d:void 0;return RE(i,v,m,y)};if(t){const a=t+kE,i=n;n=s=>s.startsWith(a)?i(s.slice(a.length)):RE(Sq,!1,s,void 0,!0)}if(r){const a=n;n=i=>r({className:i,parseClassName:a})}return n},Nq=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let a=[];for(let i=0;i0&&(a.sort(),n.push(...a),a=[]),n.push(s)):a.push(s)}return a.length>0&&(a.sort(),n.push(...a)),n}},_q=e=>({cache:wq(e.cacheSize),parseClassName:jq(e),sortModifiers:Nq(e),...fq(e)}),Cq=/\s+/,Eq=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,s=[],u=e.trim().split(Cq);let d="";for(let c=u.length-1;c>=0;c-=1){const f=u[c],{isExternal:p,modifiers:m,hasImportantModifier:v,baseClassName:y,maybePostfixModifierPosition:x}=r(f);if(p){d=f+(d.length>0?" "+d:d);continue}let w=!!x,j=n(w?y.substring(0,x):y);if(!j){if(!w){d=f+(d.length>0?" "+d:d);continue}if(j=n(y),!j){d=f+(d.length>0?" "+d:d);continue}w=!1}const N=m.length===0?"":m.length===1?m[0]:i(m).join(":"),C=v?N+lw:N,A=C+j;if(s.indexOf(A)>-1)continue;s.push(A);const E=a(j,w);for(let O=0;O0?" "+d:d)}return d},Oq=(...e)=>{let t=0,r,n,a="";for(;t{if(typeof e=="string")return e;let t,r="";for(let n=0;n{let r,n,a,i;const s=d=>{const c=t.reduce((f,p)=>p(f),e());return r=_q(c),n=r.cache.get,a=r.cache.set,i=u,u(d)},u=d=>{const c=n(d);if(c)return c;const f=Eq(d,r);return a(d,f),f};return i=s,(...d)=>i(Oq(...d))},Aq=[],dr=e=>{const t=r=>r[e]||Aq;return t.isThemeGetter=!0,t},HM=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,WM=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Tq=/^\d+\/\d+$/,kq=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Rq=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Iq=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Mq=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Dq=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Is=e=>Tq.test(e),at=e=>!!e&&!Number.isNaN(Number(e)),Qi=e=>!!e&&Number.isInteger(Number(e)),Ty=e=>e.endsWith("%")&&at(e.slice(0,-1)),ai=e=>kq.test(e),Lq=()=>!0,$q=e=>Rq.test(e)&&!Iq.test(e),GM=()=>!1,Fq=e=>Mq.test(e),Bq=e=>Dq.test(e),zq=e=>!Ie(e)&&!Me(e),qq=e=>Ul(e,XM,GM),Ie=e=>HM.test(e),Ao=e=>Ul(e,JM,$q),ky=e=>Ul(e,Gq,at),IE=e=>Ul(e,KM,GM),Uq=e=>Ul(e,YM,Bq),Wf=e=>Ul(e,QM,Fq),Me=e=>WM.test(e),Bc=e=>Vl(e,JM),Vq=e=>Vl(e,Kq),ME=e=>Vl(e,KM),Hq=e=>Vl(e,XM),Wq=e=>Vl(e,YM),Gf=e=>Vl(e,QM,!0),Ul=(e,t,r)=>{const n=HM.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Vl=(e,t,r=!1)=>{const n=WM.exec(e);return n?n[1]?t(n[1]):r:!1},KM=e=>e==="position"||e==="percentage",YM=e=>e==="image"||e==="url",XM=e=>e==="length"||e==="size"||e==="bg-size",JM=e=>e==="length",Gq=e=>e==="number",Kq=e=>e==="family-name",QM=e=>e==="shadow",Yq=()=>{const e=dr("color"),t=dr("font"),r=dr("text"),n=dr("font-weight"),a=dr("tracking"),i=dr("leading"),s=dr("breakpoint"),u=dr("container"),d=dr("spacing"),c=dr("radius"),f=dr("shadow"),p=dr("inset-shadow"),m=dr("text-shadow"),v=dr("drop-shadow"),y=dr("blur"),x=dr("perspective"),w=dr("aspect"),j=dr("ease"),N=dr("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...A(),Me,Ie],O=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],k=()=>[Me,Ie,d],M=()=>[Is,"full","auto",...k()],L=()=>[Qi,"none","subgrid",Me,Ie],$=()=>["auto",{span:["full",Qi,Me,Ie]},Qi,Me,Ie],I=()=>[Qi,"auto",Me,Ie],H=()=>["auto","min","max","fr",Me,Ie],Y=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...k()],K=()=>[Is,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],F=()=>[e,Me,Ie],te=()=>[...A(),ME,IE,{position:[Me,Ie]}],D=()=>["no-repeat",{repeat:["","x","y","space","round"]}],U=()=>["auto","cover","contain",Hq,qq,{size:[Me,Ie]}],z=()=>[Ty,Bc,Ao],B=()=>["","none","full",c,Me,Ie],X=()=>["",at,Bc,Ao],Q=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>[at,Ty,ME,IE],Z=()=>["","none",y,Me,Ie],ee=()=>["none",at,Me,Ie],ce=()=>["none",at,Me,Ie],ve=()=>[at,Me,Ie],ne=()=>[Is,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ai],breakpoint:[ai],color:[Lq],container:[ai],"drop-shadow":[ai],ease:["in","out","in-out"],font:[zq],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ai],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ai],shadow:[ai],spacing:["px",at],text:[ai],"text-shadow":[ai],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Is,Ie,Me,w]}],container:["container"],columns:[{columns:[at,Ie,Me,u]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{start:M()}],end:[{end:M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[Qi,"auto",Me,Ie]}],basis:[{basis:[Is,"full","auto",u,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[at,Is,"auto","initial","none",Ie]}],grow:[{grow:["",at,Me,Ie]}],shrink:[{shrink:["",at,Me,Ie]}],order:[{order:[Qi,"first","last","none",Me,Ie]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":H()}],"auto-rows":[{"auto-rows":H()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...Y(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...Y()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":Y()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[u,"screen",...K()]}],"min-w":[{"min-w":[u,"screen","none",...K()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[s]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",r,Bc,Ao]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Me,ky]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ty,Ie]}],"font-family":[{font:[Vq,Ie,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,Me,Ie]}],"line-clamp":[{"line-clamp":[at,"none",Me,ky]}],leading:[{leading:[i,...k()]}],"list-image":[{"list-image":["none",Me,Ie]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Me,Ie]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Q(),"wavy"]}],"text-decoration-thickness":[{decoration:[at,"from-font","auto",Me,Ao]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[at,"auto",Me,Ie]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Me,Ie]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Me,Ie]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:te()}],"bg-repeat":[{bg:D()}],"bg-size":[{bg:U()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Qi,Me,Ie],radial:["",Me,Ie],conic:[Qi,Me,Ie]},Wq,Uq]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:X()}],"border-w-x":[{"border-x":X()}],"border-w-y":[{"border-y":X()}],"border-w-s":[{"border-s":X()}],"border-w-e":[{"border-e":X()}],"border-w-t":[{"border-t":X()}],"border-w-r":[{"border-r":X()}],"border-w-b":[{"border-b":X()}],"border-w-l":[{"border-l":X()}],"divide-x":[{"divide-x":X()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":X()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Q(),"hidden","none"]}],"divide-style":[{divide:[...Q(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...Q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[at,Me,Ie]}],"outline-w":[{outline:["",at,Bc,Ao]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",f,Gf,Wf]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",p,Gf,Wf]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[at,Ao]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":X()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",m,Gf,Wf]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[at,Me,Ie]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[at]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[Me,Ie]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[at]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:te()}],"mask-repeat":[{mask:D()}],"mask-size":[{mask:U()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Me,Ie]}],filter:[{filter:["","none",Me,Ie]}],blur:[{blur:Z()}],brightness:[{brightness:[at,Me,Ie]}],contrast:[{contrast:[at,Me,Ie]}],"drop-shadow":[{"drop-shadow":["","none",v,Gf,Wf]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",at,Me,Ie]}],"hue-rotate":[{"hue-rotate":[at,Me,Ie]}],invert:[{invert:["",at,Me,Ie]}],saturate:[{saturate:[at,Me,Ie]}],sepia:[{sepia:["",at,Me,Ie]}],"backdrop-filter":[{"backdrop-filter":["","none",Me,Ie]}],"backdrop-blur":[{"backdrop-blur":Z()}],"backdrop-brightness":[{"backdrop-brightness":[at,Me,Ie]}],"backdrop-contrast":[{"backdrop-contrast":[at,Me,Ie]}],"backdrop-grayscale":[{"backdrop-grayscale":["",at,Me,Ie]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[at,Me,Ie]}],"backdrop-invert":[{"backdrop-invert":["",at,Me,Ie]}],"backdrop-opacity":[{"backdrop-opacity":[at,Me,Ie]}],"backdrop-saturate":[{"backdrop-saturate":[at,Me,Ie]}],"backdrop-sepia":[{"backdrop-sepia":["",at,Me,Ie]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Me,Ie]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[at,"initial",Me,Ie]}],ease:[{ease:["linear","initial",j,Me,Ie]}],delay:[{delay:[at,Me,Ie]}],animate:[{animate:["none",N,Me,Ie]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,Me,Ie]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:ee()}],"rotate-x":[{"rotate-x":ee()}],"rotate-y":[{"rotate-y":ee()}],"rotate-z":[{"rotate-z":ee()}],scale:[{scale:ce()}],"scale-x":[{"scale-x":ce()}],"scale-y":[{"scale-y":ce()}],"scale-z":[{"scale-z":ce()}],"scale-3d":["scale-3d"],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[Me,Ie,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ne()}],"translate-x":[{"translate-x":ne()}],"translate-y":[{"translate-y":ne()}],"translate-z":[{"translate-z":ne()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Me,Ie]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Me,Ie]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[at,Bc,Ao,ky]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Xq=Pq(Yq);function Ee(...e){return Xq(nt(e))}function DE(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Gn(...e){return t=>{let r=!1;const n=e.map(a=>{const i=DE(a,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let a=0;a{const{children:i,...s}=n,u=b.Children.toArray(i),d=u.find(eU);if(d){const c=d.props.children,f=u.map(p=>p===d?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:p);return o.jsx(t,{...s,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,f):null})}return o.jsx(t,{...s,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function Qq(e){const t=b.forwardRef((r,n)=>{const{children:a,...i}=r;if(b.isValidElement(a)){const s=rU(a),u=tU(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Gn(n,s):s),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Zq=Symbol("radix.slottable");function eU(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Zq}function tU(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function rU(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var nU=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ze=nU.reduce((e,t)=>{const r=Jq(`Primitive.${t}`),n=b.forwardRef((a,i)=>{const{asChild:s,...u}=a,d=s?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(d,{...u,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function aU(e,t){e&&nd.flushSync(()=>e.dispatchEvent(t))}var sr=globalThis?.document?b.useLayoutEffect:()=>{};function iU(e,t){return b.useReducer((r,n)=>t[r][n]??r,e)}var An=e=>{const{present:t,children:r}=e,n=oU(t),a=typeof r=="function"?r({present:n.isPresent}):b.Children.only(r),i=lt(n.ref,sU(a));return typeof r=="function"||n.isPresent?b.cloneElement(a,{ref:i}):null};An.displayName="Presence";function oU(e){const[t,r]=b.useState(),n=b.useRef(null),a=b.useRef(e),i=b.useRef("none"),s=e?"mounted":"unmounted",[u,d]=iU(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const c=Kf(n.current);i.current=u==="mounted"?c:"none"},[u]),sr(()=>{const c=n.current,f=a.current;if(f!==e){const m=i.current,v=Kf(c);e?d("MOUNT"):v==="none"||c?.display==="none"?d("UNMOUNT"):d(f&&m!==v?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,d]),sr(()=>{if(t){let c;const f=t.ownerDocument.defaultView??window,p=v=>{const x=Kf(n.current).includes(CSS.escape(v.animationName));if(v.target===t&&x&&(d("ANIMATION_END"),!a.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",c=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},m=v=>{v.target===t&&(i.current=Kf(n.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(c),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:b.useCallback(c=>{n.current=c?getComputedStyle(c):null,r(c)},[])}}function Kf(e){return e?.animationName||"none"}function sU(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function lU(e,t){const r=b.createContext(t),n=i=>{const{children:s,...u}=i,d=b.useMemo(()=>u,Object.values(u));return o.jsx(r.Provider,{value:d,children:s})};n.displayName=e+"Provider";function a(i){const s=b.useContext(r);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[n,a]}function Ni(e,t=[]){let r=[];function n(i,s){const u=b.createContext(s),d=r.length;r=[...r,s];const c=p=>{const{scope:m,children:v,...y}=p,x=m?.[e]?.[d]||u,w=b.useMemo(()=>y,Object.values(y));return o.jsx(x.Provider,{value:w,children:v})};c.displayName=i+"Provider";function f(p,m){const v=m?.[e]?.[d]||u,y=b.useContext(v);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[c,f]}const a=()=>{const i=r.map(s=>b.createContext(s));return function(u){const d=u?.[e]||i;return b.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return a.scopeName=e,[n,cU(a,...t)]}function cU(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const s=n.reduce((u,{useScope:d,scopeName:c})=>{const p=d(i)[`__scope${c}`];return{...u,...p}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}function Gr(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>(...r)=>t.current?.(...r),[])}var uU=b.createContext(void 0);function ZM(e){const t=b.useContext(uU);return e||t||"ltr"}function cw(e,[t,r]){return Math.min(r,Math.max(t,e))}function tt(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e?.(a),r===!1||!a.defaultPrevented)return t?.(a)}}function dU(e,t){return b.useReducer((r,n)=>t[r][n]??r,e)}var ej="ScrollArea",[eD]=Ni(ej),[fU,Yn]=eD(ej),tD=b.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:i=600,...s}=e,[u,d]=b.useState(null),[c,f]=b.useState(null),[p,m]=b.useState(null),[v,y]=b.useState(null),[x,w]=b.useState(null),[j,N]=b.useState(0),[C,A]=b.useState(0),[E,O]=b.useState(!1),[T,k]=b.useState(!1),M=lt(t,$=>d($)),L=ZM(a);return o.jsx(fU,{scope:r,type:n,dir:L,scrollHideDelay:i,scrollArea:u,viewport:c,onViewportChange:f,content:p,onContentChange:m,scrollbarX:v,onScrollbarXChange:y,scrollbarXEnabled:E,onScrollbarXEnabledChange:O,scrollbarY:x,onScrollbarYChange:w,scrollbarYEnabled:T,onScrollbarYEnabledChange:k,onCornerWidthChange:N,onCornerHeightChange:A,children:o.jsx(Ze.div,{dir:L,...s,ref:M,style:{position:"relative","--radix-scroll-area-corner-width":j+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})})});tD.displayName=ej;var rD="ScrollAreaViewport",nD=b.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:a,...i}=e,s=Yn(rD,r),u=b.useRef(null),d=lt(t,u,s.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),o.jsx(Ze.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:o.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});nD.displayName=rD;var Va="ScrollAreaScrollbar",aD=b.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Yn(Va,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=a,u=e.orientation==="horizontal";return b.useEffect(()=>(u?i(!0):s(!0),()=>{u?i(!1):s(!1)}),[u,i,s]),a.type==="hover"?o.jsx(hU,{...n,ref:t,forceMount:r}):a.type==="scroll"?o.jsx(pU,{...n,ref:t,forceMount:r}):a.type==="auto"?o.jsx(iD,{...n,ref:t,forceMount:r}):a.type==="always"?o.jsx(tj,{...n,ref:t}):null});aD.displayName=Va;var hU=b.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Yn(Va,e.__scopeScrollArea),[i,s]=b.useState(!1);return b.useEffect(()=>{const u=a.scrollArea;let d=0;if(u){const c=()=>{window.clearTimeout(d),s(!0)},f=()=>{d=window.setTimeout(()=>s(!1),a.scrollHideDelay)};return u.addEventListener("pointerenter",c),u.addEventListener("pointerleave",f),()=>{window.clearTimeout(d),u.removeEventListener("pointerenter",c),u.removeEventListener("pointerleave",f)}}},[a.scrollArea,a.scrollHideDelay]),o.jsx(An,{present:r||i,children:o.jsx(iD,{"data-state":i?"visible":"hidden",...n,ref:t})})}),pU=b.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Yn(Va,e.__scopeScrollArea),i=e.orientation==="horizontal",s=_m(()=>d("SCROLL_END"),100),[u,d]=dU("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return b.useEffect(()=>{if(u==="idle"){const c=window.setTimeout(()=>d("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(c)}},[u,a.scrollHideDelay,d]),b.useEffect(()=>{const c=a.viewport,f=i?"scrollLeft":"scrollTop";if(c){let p=c[f];const m=()=>{const v=c[f];p!==v&&(d("SCROLL"),s()),p=v};return c.addEventListener("scroll",m),()=>c.removeEventListener("scroll",m)}},[a.viewport,i,d,s]),o.jsx(An,{present:r||u!=="hidden",children:o.jsx(tj,{"data-state":u==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:tt(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:tt(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),iD=b.forwardRef((e,t)=>{const r=Yn(Va,e.__scopeScrollArea),{forceMount:n,...a}=e,[i,s]=b.useState(!1),u=e.orientation==="horizontal",d=_m(()=>{if(r.viewport){const c=r.viewport.offsetWidth{const{orientation:r="vertical",...n}=e,a=Yn(Va,e.__scopeScrollArea),i=b.useRef(null),s=b.useRef(0),[u,d]=b.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=uD(u.viewport,u.content),f={...n,sizes:u,onSizesChange:d,hasThumb:c>0&&c<1,onThumbChange:m=>i.current=m,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:m=>s.current=m};function p(m,v){return bU(m,s.current,u,v)}return r==="horizontal"?o.jsx(mU,{...f,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollLeft,v=LE(m,u,a.dir);i.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:m=>{a.viewport&&(a.viewport.scrollLeft=m)},onDragScroll:m=>{a.viewport&&(a.viewport.scrollLeft=p(m,a.dir))}}):r==="vertical"?o.jsx(gU,{...f,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollTop,v=LE(m,u);i.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:m=>{a.viewport&&(a.viewport.scrollTop=m)},onDragScroll:m=>{a.viewport&&(a.viewport.scrollTop=p(m))}}):null}),mU=b.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,i=Yn(Va,e.__scopeScrollArea),[s,u]=b.useState(),d=b.useRef(null),c=lt(t,d,i.onScrollbarXChange);return b.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),o.jsx(sD,{"data-orientation":"horizontal",...a,ref:c,sizes:r,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Nm(r)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,p)=>{if(i.viewport){const m=i.viewport.scrollLeft+f.deltaX;e.onWheelScroll(m),fD(m,p)&&f.preventDefault()}},onResize:()=>{d.current&&i.viewport&&s&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:lp(s.paddingLeft),paddingEnd:lp(s.paddingRight)}})}})}),gU=b.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,i=Yn(Va,e.__scopeScrollArea),[s,u]=b.useState(),d=b.useRef(null),c=lt(t,d,i.onScrollbarYChange);return b.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),o.jsx(sD,{"data-orientation":"vertical",...a,ref:c,sizes:r,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Nm(r)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,p)=>{if(i.viewport){const m=i.viewport.scrollTop+f.deltaY;e.onWheelScroll(m),fD(m,p)&&f.preventDefault()}},onResize:()=>{d.current&&i.viewport&&s&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:lp(s.paddingTop),paddingEnd:lp(s.paddingBottom)}})}})}),[vU,oD]=eD(Va),sD=b.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:u,onThumbPositionChange:d,onDragScroll:c,onWheelScroll:f,onResize:p,...m}=e,v=Yn(Va,r),[y,x]=b.useState(null),w=lt(t,M=>x(M)),j=b.useRef(null),N=b.useRef(""),C=v.viewport,A=n.content-n.viewport,E=Gr(f),O=Gr(d),T=_m(p,10);function k(M){if(j.current){const L=M.clientX-j.current.left,$=M.clientY-j.current.top;c({x:L,y:$})}}return b.useEffect(()=>{const M=L=>{const $=L.target;y?.contains($)&&E(L,A)};return document.addEventListener("wheel",M,{passive:!1}),()=>document.removeEventListener("wheel",M,{passive:!1})},[C,y,A,E]),b.useEffect(O,[n,O]),dl(y,T),dl(v.content,T),o.jsx(vU,{scope:r,scrollbar:y,hasThumb:a,onThumbChange:Gr(i),onThumbPointerUp:Gr(s),onThumbPositionChange:O,onThumbPointerDown:Gr(u),children:o.jsx(Ze.div,{...m,ref:w,style:{position:"absolute",...m.style},onPointerDown:tt(e.onPointerDown,M=>{M.button===0&&(M.target.setPointerCapture(M.pointerId),j.current=y.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),k(M))}),onPointerMove:tt(e.onPointerMove,k),onPointerUp:tt(e.onPointerUp,M=>{const L=M.target;L.hasPointerCapture(M.pointerId)&&L.releasePointerCapture(M.pointerId),document.body.style.webkitUserSelect=N.current,v.viewport&&(v.viewport.style.scrollBehavior=""),j.current=null})})})}),sp="ScrollAreaThumb",lD=b.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=oD(sp,e.__scopeScrollArea);return o.jsx(An,{present:r||a.hasThumb,children:o.jsx(yU,{ref:t,...n})})}),yU=b.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...a}=e,i=Yn(sp,r),s=oD(sp,r),{onThumbPositionChange:u}=s,d=lt(t,p=>s.onThumbChange(p)),c=b.useRef(void 0),f=_m(()=>{c.current&&(c.current(),c.current=void 0)},100);return b.useEffect(()=>{const p=i.viewport;if(p){const m=()=>{if(f(),!c.current){const v=wU(p,u);c.current=v,u()}};return u(),p.addEventListener("scroll",m),()=>p.removeEventListener("scroll",m)}},[i.viewport,f,u]),o.jsx(Ze.div,{"data-state":s.hasThumb?"visible":"hidden",...a,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:tt(e.onPointerDownCapture,p=>{const v=p.target.getBoundingClientRect(),y=p.clientX-v.left,x=p.clientY-v.top;s.onThumbPointerDown({x:y,y:x})}),onPointerUp:tt(e.onPointerUp,s.onThumbPointerUp)})});lD.displayName=sp;var rj="ScrollAreaCorner",cD=b.forwardRef((e,t)=>{const r=Yn(rj,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?o.jsx(xU,{...e,ref:t}):null});cD.displayName=rj;var xU=b.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,a=Yn(rj,r),[i,s]=b.useState(0),[u,d]=b.useState(0),c=!!(i&&u);return dl(a.scrollbarX,()=>{const f=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(f),d(f)}),dl(a.scrollbarY,()=>{const f=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(f),s(f)}),c?o.jsx(Ze.div,{...n,ref:t,style:{width:i,height:u,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function lp(e){return e?parseInt(e,10):0}function uD(e,t){const r=e/t;return isNaN(r)?0:r}function Nm(e){const t=uD(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function bU(e,t,r,n="ltr"){const a=Nm(r),i=a/2,s=t||i,u=a-s,d=r.scrollbar.paddingStart+s,c=r.scrollbar.size-r.scrollbar.paddingEnd-u,f=r.content-r.viewport,p=n==="ltr"?[0,f]:[f*-1,0];return dD([d,c],p)(e)}function LE(e,t,r="ltr"){const n=Nm(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-a,s=t.content-t.viewport,u=i-n,d=r==="ltr"?[0,s]:[s*-1,0],c=cw(e,d);return dD([0,s],[0,u])(c)}function dD(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function fD(e,t){return e>0&&e{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return(function a(){const i={left:e.scrollLeft,top:e.scrollTop},s=r.left!==i.left,u=r.top!==i.top;(s||u)&&t(),r=i,n=window.requestAnimationFrame(a)})(),()=>window.cancelAnimationFrame(n)};function _m(e,t){const r=Gr(e),n=b.useRef(0);return b.useEffect(()=>()=>window.clearTimeout(n.current),[]),b.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function dl(e,t){const r=Gr(t);sr(()=>{let n=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return a.observe(e),()=>{window.cancelAnimationFrame(n),a.unobserve(e)}}},[e,r])}var SU=tD,jU=nD,NU=cD;function fl({className:e,children:t,...r}){return o.jsxs(SU,{"data-slot":"scroll-area",className:Ee("relative",e),...r,children:[o.jsx(jU,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),o.jsx(_U,{}),o.jsx(NU,{})]})}function _U({className:e,orientation:t="vertical",...r}){return o.jsx(aD,{"data-slot":"scroll-area-scrollbar",orientation:t,className:Ee("flex touch-none p-px transition-colors select-none",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...r,children:o.jsx(lD,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}const CU="/assets/773f0c39e1986271e9144596caac519f934a6ae6-Cou8J2R8.png";function EU({currentView:e,setCurrentView:t}){const[r,n]=b.useState(!0),a=[{name:"Dashboard",icon:LM,type:"item"},{type:"header",name:"MODULES"},{name:"Labeling",icon:ip,type:"sub",isOpen:r,toggle:()=>n(!r),children:[{name:"Labels",icon:ip},{name:"Label Categories",icon:DM},{name:"Label Types",icon:FM},{name:"Label Templates",icon:MM},{name:"Multiple Options",icon:ap}]},{type:"header",name:"MANAGEMENT"},{name:"Location Manager",icon:ql,type:"item"},{name:"Account Management",icon:QS,type:"item"},{name:"Menu Management",icon:mu,type:"item"},{name:"System Menu",icon:ap,type:"item"},{name:"Reports",icon:ul,type:"item"},{name:"Support",icon:np,type:"item"},{name:"Log Out",icon:N6,type:"item"}];return o.jsxs("div",{className:"w-64 bg-[#1e3a8a] text-white flex flex-col h-screen border-r border-blue-800 shadow-xl z-20 shrink-0",children:[o.jsx("div",{className:"flex items-center justify-center border-b border-blue-800/50 bg-white px-4 shrink-0",style:{height:90},children:o.jsx("img",{src:CU,alt:"MedVantage",className:"h-16 w-auto object-contain"})}),o.jsx(fl,{className:"flex-1 py-4",children:o.jsx("div",{className:"px-3 space-y-1",children:a.map((i,s)=>i.type==="header"?o.jsx("div",{className:"px-4 py-2 mt-4 text-xs font-semibold text-blue-300 uppercase tracking-wider",children:i.name},s):i.type==="sub"?o.jsxs("div",{className:"space-y-1",children:[o.jsxs("button",{onClick:i.toggle,className:Ee("w-full flex items-center justify-between px-4 py-2.5 text-sm font-medium rounded-lg transition-colors","hover:bg-blue-800/50 text-blue-100"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(i.icon,{className:"w-4 h-4"}),i.name]}),i.isOpen?o.jsx(ll,{className:"w-4 h-4"}):o.jsx(cl,{className:"w-4 h-4"})]}),i.isOpen&&o.jsx("div",{className:"pl-4 space-y-1",children:i.children?.map((u,d)=>o.jsxs("button",{onClick:()=>t(u.name),className:Ee("w-full flex items-center gap-3 px-4 py-2 text-sm font-medium rounded-lg transition-colors border-l-2",e===u.name?"bg-blue-800 border-blue-400 text-white":"border-transparent hover:bg-blue-800/30 text-blue-200 hover:text-white"),children:[o.jsx("div",{className:"w-1 h-1 rounded-full bg-current"}),u.name]},d))})]},s):o.jsxs("button",{onClick:()=>t(i.name),className:Ee("w-full flex items-center gap-3 px-4 py-2.5 text-sm font-medium rounded-lg transition-colors",e===i.name?"bg-blue-700 text-white shadow-md shadow-blue-900/20":i.name==="Log Out"?"text-red-300 hover:bg-red-900/20 hover:text-red-200":"text-blue-100 hover:bg-blue-800 hover:text-white"),children:[o.jsx(i.icon,{className:"w-4 h-4"}),i.name]},s))})})]})}function ye({className:e,type:t,...r}){return o.jsx("input",{type:t,"data-slot":"input",className:Ee("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border px-3 py-1 text-base bg-input-background transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}var OU=Symbol.for("react.lazy"),cp=XS[" use ".trim().toString()];function PU(e){return typeof e=="object"&&e!==null&&"then"in e}function hD(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===OU&&"_payload"in e&&PU(e._payload)}function nj(e){const t=AU(e),r=b.forwardRef((n,a)=>{let{children:i,...s}=n;hD(i)&&typeof cp=="function"&&(i=cp(i._payload));const u=b.Children.toArray(i),d=u.find(kU);if(d){const c=d.props.children,f=u.map(p=>p===d?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:p);return o.jsx(t,{...s,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,f):null})}return o.jsx(t,{...s,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}var pD=nj("Slot");function AU(e){const t=b.forwardRef((r,n)=>{let{children:a,...i}=r;if(hD(a)&&typeof cp=="function"&&(a=cp(a._payload)),b.isValidElement(a)){const s=IU(a),u=RU(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Gn(n,s):s),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var TU=Symbol("radix.slottable");function kU(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===TU}function RU(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function IU(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}const $E=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,FE=nt,mD=(e,t)=>r=>{var n;if(t?.variants==null)return FE(e,r?.class,r?.className);const{variants:a,defaultVariants:i}=t,s=Object.keys(a).map(c=>{const f=r?.[c],p=i?.[c];if(f===null)return null;const m=$E(f)||$E(p);return a[c][m]}),u=r&&Object.entries(r).reduce((c,f)=>{let[p,m]=f;return m===void 0||(c[p]=m),c},{}),d=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((c,f)=>{let{class:p,className:m,...v}=f;return Object.entries(v).every(y=>{let[x,w]=y;return Array.isArray(w)?w.includes({...i,...u}[x]):{...i,...u}[x]===w})?[...c,p,m]:c},[]);return FE(e,s,d,r?.class,r?.className)},gD=mD("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background text-foreground hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),he=b.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...a},i)=>{const s=n?pD:"button";return o.jsx(s,{ref:i,"data-slot":"button",className:Ee(gD({variant:t,size:r,className:e})),...a})});he.displayName="Button";function MU(e,t=[]){let r=[];function n(i,s){const u=b.createContext(s);u.displayName=i+"Context";const d=r.length;r=[...r,s];const c=p=>{const{scope:m,children:v,...y}=p,x=m?.[e]?.[d]||u,w=b.useMemo(()=>y,Object.values(y));return o.jsx(x.Provider,{value:w,children:v})};c.displayName=i+"Provider";function f(p,m){const v=m?.[e]?.[d]||u,y=b.useContext(v);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[c,f]}const a=()=>{const i=r.map(s=>b.createContext(s));return function(u){const d=u?.[e]||i;return b.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return a.scopeName=e,[n,DU(a,...t)]}function DU(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const s=n.reduce((u,{useScope:d,scopeName:c})=>{const p=d(i)[`__scope${c}`];return{...u,...p}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var LU=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],aj=LU.reduce((e,t)=>{const r=nj(`Primitive.${t}`),n=b.forwardRef((a,i)=>{const{asChild:s,...u}=a,d=s?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(d,{...u,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Ry={exports:{}},Iy={};/** + * @license React + * use-sync-external-store-shim.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var BE;function $U(){if(BE)return Iy;BE=1;var e=Sm();function t(p,m){return p===m&&(p!==0||1/p===1/m)||p!==p&&m!==m}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,a=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function u(p,m){var v=m(),y=n({inst:{value:v,getSnapshot:m}}),x=y[0].inst,w=y[1];return i(function(){x.value=v,x.getSnapshot=m,d(x)&&w({inst:x})},[p,v,m]),a(function(){return d(x)&&w({inst:x}),p(function(){d(x)&&w({inst:x})})},[p]),s(v),v}function d(p){var m=p.getSnapshot;p=p.value;try{var v=m();return!r(p,v)}catch{return!0}}function c(p,m){return m()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:u;return Iy.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Iy}var zE;function FU(){return zE||(zE=1,Ry.exports=$U()),Ry.exports}var BU=FU();function zU(){return BU.useSyncExternalStore(qU,()=>!0,()=>!1)}function qU(){return()=>{}}var ij="Avatar",[UU]=MU(ij),[VU,vD]=UU(ij),yD=b.forwardRef((e,t)=>{const{__scopeAvatar:r,...n}=e,[a,i]=b.useState("idle");return o.jsx(VU,{scope:r,imageLoadingStatus:a,onImageLoadingStatusChange:i,children:o.jsx(aj.span,{...n,ref:t})})});yD.displayName=ij;var xD="AvatarImage",bD=b.forwardRef((e,t)=>{const{__scopeAvatar:r,src:n,onLoadingStatusChange:a=()=>{},...i}=e,s=vD(xD,r),u=HU(n,i),d=Gr(c=>{a(c),s.onImageLoadingStatusChange(c)});return sr(()=>{u!=="idle"&&d(u)},[u,d]),u==="loaded"?o.jsx(aj.img,{...i,ref:t,src:n}):null});bD.displayName=xD;var wD="AvatarFallback",SD=b.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:n,...a}=e,i=vD(wD,r),[s,u]=b.useState(n===void 0);return b.useEffect(()=>{if(n!==void 0){const d=window.setTimeout(()=>u(!0),n);return()=>window.clearTimeout(d)}},[n]),s&&i.imageLoadingStatus!=="loaded"?o.jsx(aj.span,{...a,ref:t}):null});SD.displayName=wD;function qE(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function HU(e,{referrerPolicy:t,crossOrigin:r}){const n=zU(),a=b.useRef(null),i=n?(a.current||(a.current=new window.Image),a.current):null,[s,u]=b.useState(()=>qE(i,e));return sr(()=>{u(qE(i,e))},[i,e]),sr(()=>{const d=p=>()=>{u(p)};if(!i)return;const c=d("loaded"),f=d("error");return i.addEventListener("load",c),i.addEventListener("error",f),t&&(i.referrerPolicy=t),typeof r=="string"&&(i.crossOrigin=r),()=>{i.removeEventListener("load",c),i.removeEventListener("error",f)}},[i,r,t]),s}var WU=yD,GU=bD,KU=SD;function YU({className:e,...t}){return o.jsx(WU,{"data-slot":"avatar",className:Ee("relative flex size-10 shrink-0 overflow-hidden rounded-full",e),...t})}function XU({className:e,...t}){return o.jsx(GU,{"data-slot":"avatar-image",className:Ee("aspect-square size-full",e),...t})}function JU({className:e,...t}){return o.jsx(KU,{"data-slot":"avatar-fallback",className:Ee("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}function QU({title:e}){const t=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});return o.jsxs("header",{className:"bg-white border-b border-gray-200 px-8 flex items-center justify-between shadow-sm sticky top-0 z-10 shrink-0",style:{height:90},children:[o.jsxs("div",{children:[o.jsxs("h1",{className:"text-2xl font-bold",style:{color:"rgb(43, 50, 143)"},children:[e," Overview"]}),o.jsxs("p",{className:"text-sm text-gray-500 mt-1 flex items-center gap-2",children:[t," | Last updated: Just now"]})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("div",{className:"flex items-center w-64 h-9 rounded-md border border-gray-200 bg-gray-50 focus-within:bg-white focus-within:ring-2 focus-within:ring-ring/50 focus-within:border-ring transition-colors overflow-hidden",children:[o.jsx(jm,{className:"h-4 w-4 text-gray-400 shrink-0 ml-3 pointer-events-none"}),o.jsx(ye,{type:"search",placeholder:"Search...",className:"flex-1 min-w-0 border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 py-2 px-2 h-full"})]}),o.jsx(he,{variant:"ghost",size:"icon",className:"text-gray-500 hover:text-gray-700",children:o.jsx(ap,{className:"w-5 h-5"})}),o.jsx("div",{className:"h-8 w-px bg-gray-200 mx-2"}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("div",{className:"text-right hidden md:block",children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Admin User"}),o.jsx("div",{className:"text-xs text-gray-500",children:"Administrator"})]}),o.jsxs(YU,{className:"h-10 w-10 border border-gray-200",children:[o.jsx(XU,{src:"https://github.com/shadcn.png"}),o.jsx(JU,{children:"AD"})]})]})]})]})}function ZU({children:e,currentView:t,setCurrentView:r}){return o.jsxs("div",{className:"flex h-screen bg-gray-50 overflow-hidden font-sans",children:[o.jsx(EU,{currentView:t,setCurrentView:r}),o.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[o.jsx(QU,{title:t}),o.jsx("div",{className:"px-8 mt-8 shrink-0",children:o.jsxs("nav",{className:"flex items-center gap-2 text-sm font-normal","aria-label":"Breadcrumb",children:[o.jsx("button",{type:"button",onClick:()=>r("Dashboard"),className:"text-gray-500 hover:text-gray-700 transition-colors",children:"Home"}),o.jsx(cl,{className:"w-4 h-4 text-gray-500 shrink-0"}),o.jsx("span",{style:{color:"rgb(43, 50, 143)"},children:t})]})}),o.jsx("main",{className:"flex-1 overflow-y-auto p-8",children:o.jsx("div",{className:"w-full h-full",children:e})})]})]})}function wn({className:e,...t}){return o.jsx("div",{"data-slot":"card",className:Ee("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border",e),...t})}function ca({className:e,...t}){return o.jsx("div",{"data-slot":"card-header",className:Ee("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 pt-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function ua({className:e,...t}){return o.jsx("h4",{"data-slot":"card-title",className:Ee("leading-none",e),...t})}function up({className:e,...t}){return o.jsx("p",{"data-slot":"card-description",className:Ee("text-muted-foreground",e),...t})}function Un({className:e,...t}){return o.jsx("div",{"data-slot":"card-content",className:Ee("px-6 [&:last-child]:pb-6",e),...t})}const e9=mD("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function $r({className:e,variant:t,asChild:r=!1,...n}){const a=r?pD:"span";return o.jsx(a,{"data-slot":"badge",className:Ee(e9({variant:t}),e),...n})}var My,UE;function cn(){if(UE)return My;UE=1;var e=Array.isArray;return My=e,My}var Dy,VE;function jD(){if(VE)return Dy;VE=1;var e=typeof Uf=="object"&&Uf&&Uf.Object===Object&&Uf;return Dy=e,Dy}var Ly,HE;function Ha(){if(HE)return Ly;HE=1;var e=jD(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Ly=r,Ly}var $y,WE;function ad(){if(WE)return $y;WE=1;var e=Ha(),t=e.Symbol;return $y=t,$y}var Fy,GE;function t9(){if(GE)return Fy;GE=1;var e=ad(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,a=e?e.toStringTag:void 0;function i(s){var u=r.call(s,a),d=s[a];try{s[a]=void 0;var c=!0}catch{}var f=n.call(s);return c&&(u?s[a]=d:delete s[a]),f}return Fy=i,Fy}var By,KE;function r9(){if(KE)return By;KE=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return By=r,By}var zy,YE;function _i(){if(YE)return zy;YE=1;var e=ad(),t=t9(),r=r9(),n="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function s(u){return u==null?u===void 0?a:n:i&&i in Object(u)?t(u):r(u)}return zy=s,zy}var qy,XE;function Ci(){if(XE)return qy;XE=1;function e(t){return t!=null&&typeof t=="object"}return qy=e,qy}var Uy,JE;function Hl(){if(JE)return Uy;JE=1;var e=_i(),t=Ci(),r="[object Symbol]";function n(a){return typeof a=="symbol"||t(a)&&e(a)==r}return Uy=n,Uy}var Vy,QE;function oj(){if(QE)return Vy;QE=1;var e=cn(),t=Hl(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(i,s){if(e(i))return!1;var u=typeof i;return u=="number"||u=="symbol"||u=="boolean"||i==null||t(i)?!0:n.test(i)||!r.test(i)||s!=null&&i in Object(s)}return Vy=a,Vy}var Hy,ZE;function co(){if(ZE)return Hy;ZE=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Hy=e,Hy}var Wy,eO;function sj(){if(eO)return Wy;eO=1;var e=_i(),t=co(),r="[object AsyncFunction]",n="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function s(u){if(!t(u))return!1;var d=e(u);return d==n||d==a||d==r||d==i}return Wy=s,Wy}var Gy,tO;function n9(){if(tO)return Gy;tO=1;var e=Ha(),t=e["__core-js_shared__"];return Gy=t,Gy}var Ky,rO;function a9(){if(rO)return Ky;rO=1;var e=n9(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return Ky=r,Ky}var Yy,nO;function ND(){if(nO)return Yy;nO=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return Yy=r,Yy}var Xy,aO;function i9(){if(aO)return Xy;aO=1;var e=sj(),t=a9(),r=co(),n=ND(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,s=Function.prototype,u=Object.prototype,d=s.toString,c=u.hasOwnProperty,f=RegExp("^"+d.call(c).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(m){if(!r(m)||t(m))return!1;var v=e(m)?f:i;return v.test(n(m))}return Xy=p,Xy}var Jy,iO;function o9(){if(iO)return Jy;iO=1;function e(t,r){return t?.[r]}return Jy=e,Jy}var Qy,oO;function os(){if(oO)return Qy;oO=1;var e=i9(),t=o9();function r(n,a){var i=t(n,a);return e(i)?i:void 0}return Qy=r,Qy}var Zy,sO;function Cm(){if(sO)return Zy;sO=1;var e=os(),t=e(Object,"create");return Zy=t,Zy}var e0,lO;function s9(){if(lO)return e0;lO=1;var e=Cm();function t(){this.__data__=e?e(null):{},this.size=0}return e0=t,e0}var t0,cO;function l9(){if(cO)return t0;cO=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return t0=e,t0}var r0,uO;function c9(){if(uO)return r0;uO=1;var e=Cm(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function a(i){var s=this.__data__;if(e){var u=s[i];return u===t?void 0:u}return n.call(s,i)?s[i]:void 0}return r0=a,r0}var n0,dO;function u9(){if(dO)return n0;dO=1;var e=Cm(),t=Object.prototype,r=t.hasOwnProperty;function n(a){var i=this.__data__;return e?i[a]!==void 0:r.call(i,a)}return n0=n,n0}var a0,fO;function d9(){if(fO)return a0;fO=1;var e=Cm(),t="__lodash_hash_undefined__";function r(n,a){var i=this.__data__;return this.size+=this.has(n)?0:1,i[n]=e&&a===void 0?t:a,this}return a0=r,a0}var i0,hO;function f9(){if(hO)return i0;hO=1;var e=s9(),t=l9(),r=c9(),n=u9(),a=d9();function i(s){var u=-1,d=s==null?0:s.length;for(this.clear();++u-1}return d0=t,d0}var f0,bO;function v9(){if(bO)return f0;bO=1;var e=Em();function t(r,n){var a=this.__data__,i=e(a,r);return i<0?(++this.size,a.push([r,n])):a[i][1]=n,this}return f0=t,f0}var h0,wO;function Om(){if(wO)return h0;wO=1;var e=h9(),t=p9(),r=m9(),n=g9(),a=v9();function i(s){var u=-1,d=s==null?0:s.length;for(this.clear();++u0?1:-1},Fo=function(t){return Ho(t)&&t.indexOf("%")===t.length-1},_e=function(t){return B9(t)&&!id(t)},z9=function(t){return rt(t)},mr=function(t){return _e(t)||Ho(t)},q9=0,Gl=function(t){var r=++q9;return"".concat(t||"").concat(r)},Yr=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!_e(t)&&!Ho(t))return n;var i;if(Fo(t)){var s=t.indexOf("%");i=r*parseFloat(t.slice(0,s))/100}else i=+t;return id(i)&&(i=n),a&&i>r&&(i=r),i},to=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},U9=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function X9(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function dw(e){"@babel/helpers - typeof";return dw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dw(e)}var YO={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},di=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},XO=null,F0=null,pj=function e(t){if(t===XO&&Array.isArray(F0))return F0;var r=[];return b.Children.forEach(t,function(n){rt(n)||(D9.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),F0=r,XO=t,r};function On(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(a){return di(a)}):n=[di(t)],pj(e).forEach(function(a){var i=En(a,"type.displayName")||En(a,"type.name");n.indexOf(i)!==-1&&r.push(a)}),r}function bn(e,t){var r=On(e,t);return r&&r[0]}var JO=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,a=r.height;return!(!_e(n)||n<=0||!_e(a)||a<=0)},J9=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],Q9=function(t){return t&&t.type&&Ho(t.type)&&J9.indexOf(t.type)>=0},Z9=function(t){return t&&dw(t)==="object"&&"clipDot"in t},e7=function(t,r,n,a){var i,s=(i=$0?.[a])!==null&&i!==void 0?i:[];return r.startsWith("data-")||!Qe(t)&&(a&&s.includes(r)||W9.includes(r))||n&&hj.includes(r)},Ke=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(b.isValidElement(t)&&(a=t.props),!Wl(a))return null;var i={};return Object.keys(a).forEach(function(s){var u;e7((u=a)===null||u===void 0?void 0:u[s],s,r,n)&&(i[s]=a[s])}),i},fw=function e(t,r){if(t===r)return!0;var n=b.Children.count(t);if(n!==b.Children.count(r))return!1;if(n===0)return!0;if(n===1)return QO(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function i7(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function pw(e){var t=e.children,r=e.width,n=e.height,a=e.viewBox,i=e.className,s=e.style,u=e.title,d=e.desc,c=a7(e,n7),f=a||{width:r,height:n,x:0,y:0},p=nt("recharts-surface",i);return q.createElement("svg",hw({},Ke(c,!0,"svg"),{className:p,width:r,height:n,style:s,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),q.createElement("title",null,u),q.createElement("desc",null,d),t)}var o7=["children","className"];function mw(){return mw=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function l7(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var ht=q.forwardRef(function(e,t){var r=e.children,n=e.className,a=s7(e,o7),i=nt("recharts-layer",n);return q.createElement("g",mw({className:i},Ke(a,!0),{ref:t}),r)}),ma=function(t,r){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;ii?0:i+r),n=n>i?i:n,n<0&&(n+=i),i=r>n?0:n-r>>>0,r>>>=0;for(var s=Array(i);++a=i?r:e(r,n,a)}return z0=t,z0}var q0,rP;function AD(){if(rP)return q0;rP=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",a=t+r+n,i="\\ufe0e\\ufe0f",s="\\u200d",u=RegExp("["+s+e+a+i+"]");function d(c){return u.test(c)}return q0=d,q0}var U0,nP;function d7(){if(nP)return U0;nP=1;function e(t){return t.split("")}return U0=e,U0}var V0,aP;function f7(){if(aP)return V0;aP=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",a=t+r+n,i="\\ufe0e\\ufe0f",s="["+e+"]",u="["+a+"]",d="\\ud83c[\\udffb-\\udfff]",c="(?:"+u+"|"+d+")",f="[^"+e+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",m="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",y=c+"?",x="["+i+"]?",w="(?:"+v+"(?:"+[f,p,m].join("|")+")"+x+y+")*",j=x+y+w,N="(?:"+[f+u+"?",u,p,m,s].join("|")+")",C=RegExp(d+"(?="+d+")|"+N+j,"g");function A(E){return E.match(C)||[]}return V0=A,V0}var H0,iP;function h7(){if(iP)return H0;iP=1;var e=d7(),t=AD(),r=f7();function n(a){return t(a)?r(a):e(a)}return H0=n,H0}var W0,oP;function p7(){if(oP)return W0;oP=1;var e=u7(),t=AD(),r=h7(),n=CD();function a(i){return function(s){s=n(s);var u=t(s)?r(s):void 0,d=u?u[0]:s.charAt(0),c=u?e(u,1).join(""):s.slice(1);return d[i]()+c}}return W0=a,W0}var G0,sP;function m7(){if(sP)return G0;sP=1;var e=p7(),t=e("toUpperCase");return G0=t,G0}var g7=m7();const Tm=mt(g7);function Mt(e){return function(){return e}}const TD=Math.cos,hp=Math.sin,Sa=Math.sqrt,pp=Math.PI,km=2*pp,gw=Math.PI,vw=2*gw,Do=1e-6,v7=vw-Do;function kD(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return kD;const r=10**t;return function(n){this._+=n[0];for(let a=1,i=n.length;aDo)if(!(Math.abs(p*d-c*f)>Do)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let v=n-s,y=a-u,x=d*d+c*c,w=v*v+y*y,j=Math.sqrt(x),N=Math.sqrt(m),C=i*Math.tan((gw-Math.acos((x+m-w)/(2*j*N)))/2),A=C/N,E=C/j;Math.abs(A-1)>Do&&this._append`L${t+A*f},${r+A*p}`,this._append`A${i},${i},0,0,${+(p*v>f*y)},${this._x1=t+E*d},${this._y1=r+E*c}`}}arc(t,r,n,a,i,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(a),d=n*Math.sin(a),c=t+u,f=r+d,p=1^s,m=s?a-i:i-a;this._x1===null?this._append`M${c},${f}`:(Math.abs(this._x1-c)>Do||Math.abs(this._y1-f)>Do)&&this._append`L${c},${f}`,n&&(m<0&&(m=m%vw+vw),m>v7?this._append`A${n},${n},0,1,${p},${t-u},${r-d}A${n},${n},0,1,${p},${this._x1=c},${this._y1=f}`:m>Do&&this._append`A${n},${n},0,${+(m>=gw)},${p},${this._x1=t+n*Math.cos(i)},${this._y1=r+n*Math.sin(i)}`)}rect(t,r,n,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+a}h${-n}Z`}toString(){return this._}}function mj(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new x7(t)}function gj(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function RD(e){this._context=e}RD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Rm(e){return new RD(e)}function ID(e){return e[0]}function MD(e){return e[1]}function DD(e,t){var r=Mt(!0),n=null,a=Rm,i=null,s=mj(u);e=typeof e=="function"?e:e===void 0?ID:Mt(e),t=typeof t=="function"?t:t===void 0?MD:Mt(t);function u(d){var c,f=(d=gj(d)).length,p,m=!1,v;for(n==null&&(i=a(v=s())),c=0;c<=f;++c)!(c=v;--y)u.point(C[y],A[y]);u.lineEnd(),u.areaEnd()}j&&(C[m]=+e(w,m,p),A[m]=+t(w,m,p),u.point(n?+n(w,m,p):C[m],r?+r(w,m,p):A[m]))}if(N)return u=null,N+""||null}function f(){return DD().defined(a).curve(s).context(i)}return c.x=function(p){return arguments.length?(e=typeof p=="function"?p:Mt(+p),n=null,c):e},c.x0=function(p){return arguments.length?(e=typeof p=="function"?p:Mt(+p),c):e},c.x1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:Mt(+p),c):n},c.y=function(p){return arguments.length?(t=typeof p=="function"?p:Mt(+p),r=null,c):t},c.y0=function(p){return arguments.length?(t=typeof p=="function"?p:Mt(+p),c):t},c.y1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:Mt(+p),c):r},c.lineX0=c.lineY0=function(){return f().x(e).y(t)},c.lineY1=function(){return f().x(e).y(r)},c.lineX1=function(){return f().x(n).y(t)},c.defined=function(p){return arguments.length?(a=typeof p=="function"?p:Mt(!!p),c):a},c.curve=function(p){return arguments.length?(s=p,i!=null&&(u=s(i)),c):s},c.context=function(p){return arguments.length?(p==null?i=u=null:u=s(i=p),c):i},c}class LD{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function b7(e){return new LD(e,!0)}function w7(e){return new LD(e,!1)}const vj={draw(e,t){const r=Sa(t/pp);e.moveTo(r,0),e.arc(0,0,r,0,km)}},S7={draw(e,t){const r=Sa(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},$D=Sa(1/3),j7=$D*2,N7={draw(e,t){const r=Sa(t/j7),n=r*$D;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},_7={draw(e,t){const r=Sa(t),n=-r/2;e.rect(n,n,r,r)}},C7=.8908130915292852,FD=hp(pp/10)/hp(7*pp/10),E7=hp(km/10)*FD,O7=-TD(km/10)*FD,P7={draw(e,t){const r=Sa(t*C7),n=E7*r,a=O7*r;e.moveTo(0,-r),e.lineTo(n,a);for(let i=1;i<5;++i){const s=km*i/5,u=TD(s),d=hp(s);e.lineTo(d*r,-u*r),e.lineTo(u*n-d*a,d*n+u*a)}e.closePath()}},K0=Sa(3),A7={draw(e,t){const r=-Sa(t/(K0*3));e.moveTo(0,r*2),e.lineTo(-K0*r,-r),e.lineTo(K0*r,-r),e.closePath()}},Bn=-.5,zn=Sa(3)/2,yw=1/Sa(12),T7=(yw/2+1)*3,k7={draw(e,t){const r=Sa(t/T7),n=r/2,a=r*yw,i=n,s=r*yw+r,u=-i,d=s;e.moveTo(n,a),e.lineTo(i,s),e.lineTo(u,d),e.lineTo(Bn*n-zn*a,zn*n+Bn*a),e.lineTo(Bn*i-zn*s,zn*i+Bn*s),e.lineTo(Bn*u-zn*d,zn*u+Bn*d),e.lineTo(Bn*n+zn*a,Bn*a-zn*n),e.lineTo(Bn*i+zn*s,Bn*s-zn*i),e.lineTo(Bn*u+zn*d,Bn*d-zn*u),e.closePath()}};function R7(e,t){let r=null,n=mj(a);e=typeof e=="function"?e:Mt(e||vj),t=typeof t=="function"?t:Mt(t===void 0?64:+t);function a(){let i;if(r||(r=i=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),i)return r=null,i+""||null}return a.type=function(i){return arguments.length?(e=typeof i=="function"?i:Mt(i),a):e},a.size=function(i){return arguments.length?(t=typeof i=="function"?i:Mt(+i),a):t},a.context=function(i){return arguments.length?(r=i??null,a):r},a}function mp(){}function gp(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function BD(e){this._context=e}BD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:gp(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:gp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function I7(e){return new BD(e)}function zD(e){this._context=e}zD.prototype={areaStart:mp,areaEnd:mp,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:gp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function M7(e){return new zD(e)}function qD(e){this._context=e}qD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:gp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function D7(e){return new qD(e)}function UD(e){this._context=e}UD.prototype={areaStart:mp,areaEnd:mp,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function L7(e){return new UD(e)}function lP(e){return e<0?-1:1}function cP(e,t,r){var n=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(n||a<0&&-0),s=(r-e._y1)/(a||n<0&&-0),u=(i*a+s*n)/(n+a);return(lP(i)+lP(s))*Math.min(Math.abs(i),Math.abs(s),.5*Math.abs(u))||0}function uP(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Y0(e,t,r){var n=e._x0,a=e._y0,i=e._x1,s=e._y1,u=(i-n)/3;e._context.bezierCurveTo(n+u,a+u*t,i-u,s-u*r,i,s)}function vp(e){this._context=e}vp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Y0(this,this._t0,uP(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Y0(this,uP(this,r=cP(this,e,t)),r);break;default:Y0(this,this._t0,r=cP(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function VD(e){this._context=new HD(e)}(VD.prototype=Object.create(vp.prototype)).point=function(e,t){vp.prototype.point.call(this,t,e)};function HD(e){this._context=e}HD.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,a,i){this._context.bezierCurveTo(t,e,n,r,i,a)}};function $7(e){return new vp(e)}function F7(e){return new VD(e)}function WD(e){this._context=e}WD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=dP(e),a=dP(t),i=0,s=1;s=0;--t)a[t]=(s[t]-a[t+1])/i[t];for(i[r-1]=(e[r]+a[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function z7(e){return new Im(e,.5)}function q7(e){return new Im(e,0)}function U7(e){return new Im(e,1)}function hl(e,t){if((s=e.length)>1)for(var r=1,n,a,i=e[t[0]],s,u=i.length;r=0;)r[t]=t;return r}function V7(e,t){return e[t]}function H7(e){const t=[];return t.key=e,t}function W7(){var e=Mt([]),t=xw,r=hl,n=V7;function a(i){var s=Array.from(e.apply(this,arguments),H7),u,d=s.length,c=-1,f;for(const p of i)for(u=0,++c;u0){for(var r,n,a=0,i=e[0].length,s;a0){for(var r=0,n=e[t[0]],a,i=n.length;r0)||!((i=(a=e[t[0]]).length)>0))){for(var r=0,n=1,a,i,s;n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function tV(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var GD={symbolCircle:vj,symbolCross:S7,symbolDiamond:N7,symbolSquare:_7,symbolStar:P7,symbolTriangle:A7,symbolWye:k7},rV=Math.PI/180,nV=function(t){var r="symbol".concat(Tm(t));return GD[r]||vj},aV=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*rV;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},iV=function(t,r){GD["symbol".concat(Tm(t))]=r},yj=function(t){var r=t.type,n=r===void 0?"circle":r,a=t.size,i=a===void 0?64:a,s=t.sizeType,u=s===void 0?"area":s,d=eV(t,X7),c=hP(hP({},d),{},{type:n,size:i,sizeType:u}),f=function(){var w=nV(n),j=R7().type(w).size(aV(i,u,n));return j()},p=c.className,m=c.cx,v=c.cy,y=Ke(c,!0);return m===+m&&v===+v&&i===+i?q.createElement("path",bw({},y,{className:nt("recharts-symbols",p),transform:"translate(".concat(m,", ").concat(v,")"),d:f()})):null};yj.registerSymbol=iV;function pl(e){"@babel/helpers - typeof";return pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pl(e)}function ww(){return ww=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var N=v.inactive?c:v.color;return q.createElement("li",ww({className:w,style:p,key:"legend-item-".concat(y)},Wo(n.props,v,y)),q.createElement(pw,{width:s,height:s,viewBox:f,style:m},n.renderIcon(v)),q.createElement("span",{className:"recharts-legend-item-text",style:{color:N}},x?x(j,v,y):j))})}},{key:"render",value:function(){var n=this.props,a=n.payload,i=n.layout,s=n.align;if(!a||!a.length)return null;var u={padding:0,margin:0,textAlign:i==="horizontal"?s:"left"};return q.createElement("ul",{className:"recharts-default-legend",style:u},this.renderItems())}}])})(b.PureComponent);vu(xj,"displayName","Legend");vu(xj,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var X0,mP;function mV(){if(mP)return X0;mP=1;var e=Om();function t(){this.__data__=new e,this.size=0}return X0=t,X0}var J0,gP;function gV(){if(gP)return J0;gP=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return J0=e,J0}var Q0,vP;function vV(){if(vP)return Q0;vP=1;function e(t){return this.__data__.get(t)}return Q0=e,Q0}var Z0,yP;function yV(){if(yP)return Z0;yP=1;function e(t){return this.__data__.has(t)}return Z0=e,Z0}var ex,xP;function xV(){if(xP)return ex;xP=1;var e=Om(),t=cj(),r=uj(),n=200;function a(i,s){var u=this.__data__;if(u instanceof e){var d=u.__data__;if(!t||d.lengthv))return!1;var x=p.get(s),w=p.get(u);if(x&&w)return x==u&&w==s;var j=-1,N=!0,C=d&a?new e:void 0;for(p.set(s,u),p.set(u,s);++j-1&&n%1==0&&n-1&&r%1==0&&r<=e}return Sx=t,Sx}var jx,UP;function kV(){if(UP)return jx;UP=1;var e=_i(),t=jj(),r=Ci(),n="[object Arguments]",a="[object Array]",i="[object Boolean]",s="[object Date]",u="[object Error]",d="[object Function]",c="[object Map]",f="[object Number]",p="[object Object]",m="[object RegExp]",v="[object Set]",y="[object String]",x="[object WeakMap]",w="[object ArrayBuffer]",j="[object DataView]",N="[object Float32Array]",C="[object Float64Array]",A="[object Int8Array]",E="[object Int16Array]",O="[object Int32Array]",T="[object Uint8Array]",k="[object Uint8ClampedArray]",M="[object Uint16Array]",L="[object Uint32Array]",$={};$[N]=$[C]=$[A]=$[E]=$[O]=$[T]=$[k]=$[M]=$[L]=!0,$[n]=$[a]=$[w]=$[i]=$[j]=$[s]=$[u]=$[d]=$[c]=$[f]=$[p]=$[m]=$[v]=$[y]=$[x]=!1;function I(H){return r(H)&&t(H.length)&&!!$[e(H)]}return jx=I,jx}var Nx,VP;function nL(){if(VP)return Nx;VP=1;function e(t){return function(r){return t(r)}}return Nx=e,Nx}var au={exports:{}};au.exports;var HP;function RV(){return HP||(HP=1,(function(e,t){var r=jD(),n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===n,s=i&&r.process,u=(function(){try{var d=a&&a.require&&a.require("util").types;return d||s&&s.binding&&s.binding("util")}catch{}})();e.exports=u})(au,au.exports)),au.exports}var _x,WP;function aL(){if(WP)return _x;WP=1;var e=kV(),t=nL(),r=RV(),n=r&&r.isTypedArray,a=n?t(n):e;return _x=a,_x}var Cx,GP;function IV(){if(GP)return Cx;GP=1;var e=PV(),t=wj(),r=cn(),n=rL(),a=Sj(),i=aL(),s=Object.prototype,u=s.hasOwnProperty;function d(c,f){var p=r(c),m=!p&&t(c),v=!p&&!m&&n(c),y=!p&&!m&&!v&&i(c),x=p||m||v||y,w=x?e(c.length,String):[],j=w.length;for(var N in c)(f||u.call(c,N))&&!(x&&(N=="length"||v&&(N=="offset"||N=="parent")||y&&(N=="buffer"||N=="byteLength"||N=="byteOffset")||a(N,j)))&&w.push(N);return w}return Cx=d,Cx}var Ex,KP;function MV(){if(KP)return Ex;KP=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,a=typeof n=="function"&&n.prototype||e;return r===a}return Ex=t,Ex}var Ox,YP;function iL(){if(YP)return Ox;YP=1;function e(t,r){return function(n){return t(r(n))}}return Ox=e,Ox}var Px,XP;function DV(){if(XP)return Px;XP=1;var e=iL(),t=e(Object.keys,Object);return Px=t,Px}var Ax,JP;function LV(){if(JP)return Ax;JP=1;var e=MV(),t=DV(),r=Object.prototype,n=r.hasOwnProperty;function a(i){if(!e(i))return t(i);var s=[];for(var u in Object(i))n.call(i,u)&&u!="constructor"&&s.push(u);return s}return Ax=a,Ax}var Tx,QP;function od(){if(QP)return Tx;QP=1;var e=sj(),t=jj();function r(n){return n!=null&&t(n.length)&&!e(n)}return Tx=r,Tx}var kx,ZP;function Mm(){if(ZP)return kx;ZP=1;var e=IV(),t=LV(),r=od();function n(a){return r(a)?e(a):t(a)}return kx=n,kx}var Rx,eA;function $V(){if(eA)return Rx;eA=1;var e=_V(),t=OV(),r=Mm();function n(a){return e(a,r,t)}return Rx=n,Rx}var Ix,tA;function FV(){if(tA)return Ix;tA=1;var e=$V(),t=1,r=Object.prototype,n=r.hasOwnProperty;function a(i,s,u,d,c,f){var p=u&t,m=e(i),v=m.length,y=e(s),x=y.length;if(v!=x&&!p)return!1;for(var w=v;w--;){var j=m[w];if(!(p?j in s:n.call(s,j)))return!1}var N=f.get(i),C=f.get(s);if(N&&C)return N==s&&C==i;var A=!0;f.set(i,s),f.set(s,i);for(var E=p;++w-1}return ob=t,ob}var sb,OA;function iH(){if(OA)return sb;OA=1;function e(t,r,n){for(var a=-1,i=t==null?0:t.length;++a=s){var j=c?null:a(d);if(j)return i(j);y=!1,m=n,w=new e}else w=c?[]:x;e:for(;++p=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function bH(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function wH(e){return e.value}function SH(e,t){if(q.isValidElement(e))return q.cloneElement(e,t);if(typeof e=="function")return q.createElement(e,t);t.ref;var r=xH(t,dH);return q.createElement(xj,r)}var DA=1,nl=(function(e){function t(){var r;fH(this,t);for(var n=arguments.length,a=new Array(n),i=0;iDA||Math.abs(a.height-this.lastBoundingBox.height)>DA)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,n&&n(a)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?ii({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var a=this.props,i=a.layout,s=a.align,u=a.verticalAlign,d=a.margin,c=a.chartWidth,f=a.chartHeight,p,m;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(s==="center"&&i==="vertical"){var v=this.getBBoxSnapshot();p={left:((c||0)-v.width)/2}}else p=s==="right"?{right:d&&d.right||0}:{left:d&&d.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(u==="middle"){var y=this.getBBoxSnapshot();m={top:((f||0)-y.height)/2}}else m=u==="bottom"?{bottom:d&&d.bottom||0}:{top:d&&d.top||0};return ii(ii({},p),m)}},{key:"render",value:function(){var n=this,a=this.props,i=a.content,s=a.width,u=a.height,d=a.wrapperStyle,c=a.payloadUniqBy,f=a.payload,p=ii(ii({position:"absolute",width:s||"auto",height:u||"auto"},this.getDefaultPosition(d)),d);return q.createElement("div",{className:"recharts-legend-wrapper",style:p,ref:function(v){n.wrapperNode=v}},SH(i,ii(ii({},this.props),{},{payload:uL(f,c,wH)})))}}],[{key:"getWithHeight",value:function(n,a){var i=ii(ii({},this.defaultProps),n.props),s=i.layout;return s==="vertical"&&_e(n.props.height)?{height:n.props.height}:s==="horizontal"?{width:n.props.width||a}:null}}])})(b.PureComponent);Dm(nl,"displayName","Legend");Dm(nl,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var fb,LA;function jH(){if(LA)return fb;LA=1;var e=ad(),t=wj(),r=cn(),n=e?e.isConcatSpreadable:void 0;function a(i){return r(i)||t(i)||!!(n&&i&&i[n])}return fb=a,fb}var hb,$A;function hL(){if($A)return hb;$A=1;var e=tL(),t=jH();function r(n,a,i,s,u){var d=-1,c=n.length;for(i||(i=t),u||(u=[]);++d0&&i(f)?a>1?r(f,a-1,i,s,u):e(u,f):s||(u[u.length]=f)}return u}return hb=r,hb}var pb,FA;function NH(){if(FA)return pb;FA=1;function e(t){return function(r,n,a){for(var i=-1,s=Object(r),u=a(r),d=u.length;d--;){var c=u[t?d:++i];if(n(s[c],c,s)===!1)break}return r}}return pb=e,pb}var mb,BA;function _H(){if(BA)return mb;BA=1;var e=NH(),t=e();return mb=t,mb}var gb,zA;function pL(){if(zA)return gb;zA=1;var e=_H(),t=Mm();function r(n,a){return n&&e(n,a,t)}return gb=r,gb}var vb,qA;function CH(){if(qA)return vb;qA=1;var e=od();function t(r,n){return function(a,i){if(a==null)return a;if(!e(a))return r(a,i);for(var s=a.length,u=n?s:-1,d=Object(a);(n?u--:++un||u&&d&&f&&!c&&!p||i&&d&&f||!a&&f||!s)return 1;if(!i&&!u&&!p&&r=c)return f;var p=a[i];return f*(p=="desc"?-1:1)}}return r.index-n.index}return Sb=t,Sb}var jb,KA;function AH(){if(KA)return jb;KA=1;var e=dj(),t=fj(),r=Wa(),n=mL(),a=EH(),i=nL(),s=PH(),u=Kl(),d=cn();function c(f,p,m){p.length?p=e(p,function(x){return d(x)?function(w){return t(w,x.length===1?x[0]:x)}:x}):p=[u];var v=-1;p=e(p,i(r));var y=n(f,function(x,w,j){var N=e(p,function(C){return C(x)});return{criteria:N,index:++v,value:x}});return a(y,function(x,w){return s(x,w,m)})}return jb=c,jb}var Nb,YA;function TH(){if(YA)return Nb;YA=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return Nb=e,Nb}var _b,XA;function kH(){if(XA)return _b;XA=1;var e=TH(),t=Math.max;function r(n,a,i){return a=t(a===void 0?n.length-1:a,0),function(){for(var s=arguments,u=-1,d=t(s.length-a,0),c=Array(d);++u0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return Pb=n,Pb}var Ab,tT;function DH(){if(tT)return Ab;tT=1;var e=IH(),t=MH(),r=t(e);return Ab=r,Ab}var Tb,rT;function LH(){if(rT)return Tb;rT=1;var e=Kl(),t=kH(),r=DH();function n(a,i){return r(t(a,i,e),a+"")}return Tb=n,Tb}var kb,nT;function Lm(){if(nT)return kb;nT=1;var e=lj(),t=od(),r=Sj(),n=co();function a(i,s,u){if(!n(u))return!1;var d=typeof s;return(d=="number"?t(u)&&r(s,u.length):d=="string"&&s in u)?e(u[s],i):!1}return kb=a,kb}var Rb,aT;function $H(){if(aT)return Rb;aT=1;var e=hL(),t=AH(),r=LH(),n=Lm(),a=r(function(i,s){if(i==null)return[];var u=s.length;return u>1&&n(i,s[0],s[1])?s=[]:u>2&&n(s[0],s[1],s[2])&&(s=[s[0]]),t(i,e(s,1),[])});return Rb=a,Rb}var FH=$H();const Cj=mt(FH);function yu(e){"@babel/helpers - typeof";return yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yu(e)}function Nw(){return Nw=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t.x),"".concat(zc,"-left"),_e(r)&&t&&_e(t.x)&&r=t.y),"".concat(zc,"-top"),_e(n)&&t&&_e(t.y)&&nx?Math.max(f,d[n]):Math.max(p,d[n])}function eW(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function tW(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,a=e.position,i=e.reverseDirection,s=e.tooltipBox,u=e.useTranslate3d,d=e.viewBox,c,f,p;return s.height>0&&s.width>0&&r?(f=sT({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:a,reverseDirection:i,tooltipDimension:s.width,viewBox:d,viewBoxDimension:d.width}),p=sT({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:a,reverseDirection:i,tooltipDimension:s.height,viewBox:d,viewBoxDimension:d.height}),c=eW({translateX:f,translateY:p,useTranslate3d:u})):c=QH,{cssProperties:c,cssClasses:ZH({translateX:f,translateY:p,coordinate:r})}}function gl(e){"@babel/helpers - typeof";return gl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gl(e)}function lT(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function cT(e){for(var t=1;tuT||Math.abs(n.height-this.state.lastBoundingBox.height)>uT)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,a=this.props,i=a.active,s=a.allowEscapeViewBox,u=a.animationDuration,d=a.animationEasing,c=a.children,f=a.coordinate,p=a.hasPayload,m=a.isAnimationActive,v=a.offset,y=a.position,x=a.reverseDirection,w=a.useTranslate3d,j=a.viewBox,N=a.wrapperStyle,C=tW({allowEscapeViewBox:s,coordinate:f,offsetTopLeft:v,position:y,reverseDirection:x,tooltipBox:this.state.lastBoundingBox,useTranslate3d:w,viewBox:j}),A=C.cssClasses,E=C.cssProperties,O=cT(cT({transition:m&&i?"transform ".concat(u,"ms ").concat(d):void 0},E),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&p?"visible":"hidden",position:"absolute",top:0,left:0},N);return q.createElement("div",{tabIndex:-1,className:A,style:O,ref:function(k){n.wrapperNode=k}},c)}}])})(b.PureComponent),dW=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},ss={isSsr:dW()};function vl(e){"@babel/helpers - typeof";return vl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vl(e)}function dT(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function fT(e){for(var t=1;t0;return q.createElement(uW,{allowEscapeViewBox:s,animationDuration:u,animationEasing:d,isAnimationActive:m,active:i,coordinate:f,hasPayload:O,offset:v,position:w,reverseDirection:j,useTranslate3d:N,viewBox:C,wrapperStyle:A},wW(c,fT(fT({},this.props),{},{payload:E})))}}])})(b.PureComponent);Ej(Sn,"displayName","Tooltip");Ej(Sn,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!ss.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var Mb,hT;function SW(){if(hT)return Mb;hT=1;var e=Ha(),t=function(){return e.Date.now()};return Mb=t,Mb}var Db,pT;function jW(){if(pT)return Db;pT=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return Db=t,Db}var Lb,mT;function NW(){if(mT)return Lb;mT=1;var e=jW(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return Lb=r,Lb}var $b,gT;function wL(){if(gT)return $b;gT=1;var e=NW(),t=co(),r=Hl(),n=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,u=parseInt;function d(c){if(typeof c=="number")return c;if(r(c))return n;if(t(c)){var f=typeof c.valueOf=="function"?c.valueOf():c;c=t(f)?f+"":f}if(typeof c!="string")return c===0?c:+c;c=e(c);var p=i.test(c);return p||s.test(c)?u(c.slice(2),p?2:8):a.test(c)?n:+c}return $b=d,$b}var Fb,vT;function _W(){if(vT)return Fb;vT=1;var e=co(),t=SW(),r=wL(),n="Expected a function",a=Math.max,i=Math.min;function s(u,d,c){var f,p,m,v,y,x,w=0,j=!1,N=!1,C=!0;if(typeof u!="function")throw new TypeError(n);d=r(d)||0,e(c)&&(j=!!c.leading,N="maxWait"in c,m=N?a(r(c.maxWait)||0,d):m,C="trailing"in c?!!c.trailing:C);function A(H){var Y=f,W=p;return f=p=void 0,w=H,v=u.apply(W,Y),v}function E(H){return w=H,y=setTimeout(k,d),j?A(H):v}function O(H){var Y=H-x,W=H-w,V=d-Y;return N?i(V,m-W):V}function T(H){var Y=H-x,W=H-w;return x===void 0||Y>=d||Y<0||N&&W>=m}function k(){var H=t();if(T(H))return M(H);y=setTimeout(k,O(H))}function M(H){return y=void 0,C&&f?A(H):(f=p=void 0,v)}function L(){y!==void 0&&clearTimeout(y),w=0,f=x=p=y=void 0}function $(){return y===void 0?v:M(t())}function I(){var H=t(),Y=T(H);if(f=arguments,p=this,x=H,Y){if(y===void 0)return E(x);if(N)return clearTimeout(y),y=setTimeout(k,d),A(x)}return y===void 0&&(y=setTimeout(k,d)),v}return I.cancel=L,I.flush=$,I}return Fb=s,Fb}var Bb,yT;function CW(){if(yT)return Bb;yT=1;var e=_W(),t=co(),r="Expected a function";function n(a,i,s){var u=!0,d=!0;if(typeof a!="function")throw new TypeError(r);return t(s)&&(u="leading"in s?!!s.leading:u,d="trailing"in s?!!s.trailing:d),e(a,i,{leading:u,maxWait:i,trailing:d})}return Bb=n,Bb}var EW=CW();const SL=mt(EW);function bu(e){"@babel/helpers - typeof";return bu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bu(e)}function xT(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Jf(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(H=SL(H,x,{trailing:!0,leading:!1}));var Y=new ResizeObserver(H),W=E.current.getBoundingClientRect(),V=W.width,K=W.height;return $(V,K),Y.observe(E.current),function(){Y.disconnect()}},[$,x]);var I=b.useMemo(function(){var H=M.containerWidth,Y=M.containerHeight;if(H<0||Y<0)return null;ma(Fo(s)||Fo(d),`The width(%s) and height(%s) are both fixed numbers, + maybe you don't need to use a ResponsiveContainer.`,s,d),ma(!r||r>0,"The aspect(%s) must be greater than zero.",r);var W=Fo(s)?H:s,V=Fo(d)?Y:d;r&&r>0&&(W?V=W/r:V&&(W=V*r),m&&V>m&&(V=m)),ma(W>0||V>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,W,V,s,d,f,p,r);var K=!Array.isArray(v)&&di(v.type).endsWith("Chart");return q.Children.map(v,function(F){return q.isValidElement(F)?b.cloneElement(F,Jf({width:W,height:V},K?{style:Jf({height:"100%",width:"100%",maxHeight:V,maxWidth:W},F.props.style)}:{})):F})},[r,v,d,m,p,f,M,s]);return q.createElement("div",{id:w?"".concat(w):void 0,className:nt("recharts-responsive-container",j),style:Jf(Jf({},A),{},{width:s,height:d,minWidth:f,minHeight:p,maxHeight:m}),ref:E},I)}),$m=function(t){return null};$m.displayName="Cell";function wu(e){"@babel/helpers - typeof";return wu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wu(e)}function wT(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ow(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||ss.isSsr)return{width:0,height:0};var n=zW(r),a=JSON.stringify({text:t,copyStyle:n});if(Ms.widthCache[a])return Ms.widthCache[a];try{var i=document.getElementById(ST);i||(i=document.createElement("span"),i.setAttribute("id",ST),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var s=Ow(Ow({},BW),n);Object.assign(i.style,s),i.textContent="".concat(t);var u=i.getBoundingClientRect(),d={width:u.width,height:u.height};return Ms.widthCache[a]=d,++Ms.cacheCount>FW&&(Ms.cacheCount=0,Ms.widthCache={}),d}catch{return{width:0,height:0}}},qW=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Su(e){"@babel/helpers - typeof";return Su=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Su(e)}function jp(e,t){return WW(e)||HW(e,t)||VW(e,t)||UW()}function UW(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VW(e,t){if(e){if(typeof e=="string")return jT(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return jT(e,t)}}function jT(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function oG(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function PT(e,t){return uG(e)||cG(e,t)||lG(e,t)||sG()}function sG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lG(e,t){if(e){if(typeof e=="string")return AT(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return AT(e,t)}}function AT(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[];return W.reduce(function(V,K){var F=K.word,te=K.width,D=V[V.length-1];if(D&&(a==null||i||D.width+te+nK.width?V:K})};if(!f)return v;for(var x="…",w=function(W){var V=p.slice(0,W),K=CL({breakAll:c,style:d,children:V+x}).wordsWithComputedWidth,F=m(K),te=F.length>s||y(F).width>Number(a);return[te,F]},j=0,N=p.length-1,C=0,A;j<=N&&C<=p.length-1;){var E=Math.floor((j+N)/2),O=E-1,T=w(O),k=PT(T,2),M=k[0],L=k[1],$=w(E),I=PT($,1),H=I[0];if(!M&&!H&&(j=E+1),M&&H&&(N=E-1),!M&&H){A=L;break}C++}return A||v},TT=function(t){var r=rt(t)?[]:t.toString().split(_L);return[{words:r}]},fG=function(t){var r=t.width,n=t.scaleToFit,a=t.children,i=t.style,s=t.breakAll,u=t.maxLines;if((r||n)&&!ss.isSsr){var d,c,f=CL({breakAll:s,children:a,style:i});if(f){var p=f.wordsWithComputedWidth,m=f.spaceWidth;d=p,c=m}else return TT(a);return dG({breakAll:s,children:a,maxLines:u,style:i},d,c,r,n)}return TT(a)},kT="#808080",Go=function(t){var r=t.x,n=r===void 0?0:r,a=t.y,i=a===void 0?0:a,s=t.lineHeight,u=s===void 0?"1em":s,d=t.capHeight,c=d===void 0?"0.71em":d,f=t.scaleToFit,p=f===void 0?!1:f,m=t.textAnchor,v=m===void 0?"start":m,y=t.verticalAnchor,x=y===void 0?"end":y,w=t.fill,j=w===void 0?kT:w,N=OT(t,aG),C=b.useMemo(function(){return fG({breakAll:N.breakAll,children:N.children,maxLines:N.maxLines,scaleToFit:p,style:N.style,width:N.width})},[N.breakAll,N.children,N.maxLines,p,N.style,N.width]),A=N.dx,E=N.dy,O=N.angle,T=N.className,k=N.breakAll,M=OT(N,iG);if(!mr(n)||!mr(i))return null;var L=n+(_e(A)?A:0),$=i+(_e(E)?E:0),I;switch(x){case"start":I=zb("calc(".concat(c,")"));break;case"middle":I=zb("calc(".concat((C.length-1)/2," * -").concat(u," + (").concat(c," / 2))"));break;default:I=zb("calc(".concat(C.length-1," * -").concat(u,")"));break}var H=[];if(p){var Y=C[0].width,W=N.width;H.push("scale(".concat((_e(W)?W/Y:1)/Y,")"))}return O&&H.push("rotate(".concat(O,", ").concat(L,", ").concat($,")")),H.length&&(M.transform=H.join(" ")),q.createElement("text",Pw({},Ke(M,!0),{x:L,y:$,className:nt("recharts-text",T),textAnchor:v,fill:j.includes("url")?kT:j}),C.map(function(V,K){var F=V.words.join(k?"":" ");return q.createElement("tspan",{x:L,dy:K===0?I:u,key:"".concat(F,"-").concat(K)},F)}))};function ao(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function hG(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Oj(e){let t,r,n;e.length!==2?(t=ao,r=(u,d)=>ao(e(u),d),n=(u,d)=>e(u)-d):(t=e===ao||e===hG?e:pG,r=e,n=e);function a(u,d,c=0,f=u.length){if(c>>1;r(u[p],d)<0?c=p+1:f=p}while(c>>1;r(u[p],d)<=0?c=p+1:f=p}while(cc&&n(u[p-1],d)>-n(u[p],d)?p-1:p}return{left:a,center:s,right:i}}function pG(){return 0}function EL(e){return e===null?NaN:+e}function*mG(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const gG=Oj(ao),sd=gG.right;Oj(EL).center;class RT extends Map{constructor(t,r=xG){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,a]of t)this.set(n,a)}get(t){return super.get(IT(this,t))}has(t){return super.has(IT(this,t))}set(t,r){return super.set(vG(this,t),r)}delete(t){return super.delete(yG(this,t))}}function IT({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function vG({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function yG({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function xG(e){return e!==null&&typeof e=="object"?e.valueOf():e}function bG(e=ao){if(e===ao)return OL;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function OL(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const wG=Math.sqrt(50),SG=Math.sqrt(10),jG=Math.sqrt(2);function Np(e,t,r){const n=(t-e)/Math.max(0,r),a=Math.floor(Math.log10(n)),i=n/Math.pow(10,a),s=i>=wG?10:i>=SG?5:i>=jG?2:1;let u,d,c;return a<0?(c=Math.pow(10,-a)/s,u=Math.round(e*c),d=Math.round(t*c),u/ct&&--d,c=-c):(c=Math.pow(10,a)*s,u=Math.round(e/c),d=Math.round(t/c),u*ct&&--d),d0))return[];if(e===t)return[e];const n=t=a))return[];const u=i-a+1,d=new Array(u);if(n)if(s<0)for(let c=0;c=n)&&(r=n);return r}function DT(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function PL(e,t,r=0,n=1/0,a){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(a=a===void 0?OL:bG(a);n>r;){if(n-r>600){const d=n-r+1,c=t-r+1,f=Math.log(d),p=.5*Math.exp(2*f/3),m=.5*Math.sqrt(f*p*(d-p)/d)*(c-d/2<0?-1:1),v=Math.max(r,Math.floor(t-c*p/d+m)),y=Math.min(n,Math.floor(t+(d-c)*p/d+m));PL(e,t,v,y,a)}const i=e[t];let s=r,u=n;for(qc(e,r,t),a(e[n],i)>0&&qc(e,r,n);s0;)--u}a(e[r],i)===0?qc(e,r,u):(++u,qc(e,u,n)),u<=t&&(r=u+1),t<=u&&(n=u-1)}return e}function qc(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function NG(e,t,r){if(e=Float64Array.from(mG(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return DT(e);if(t>=1)return MT(e);var n,a=(n-1)*t,i=Math.floor(a),s=MT(PL(e,i).subarray(0,i+1)),u=DT(e.subarray(i+1));return s+(u-s)*(a-i)}}function _G(e,t,r=EL){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,a=(n-1)*t,i=Math.floor(a),s=+r(e[i],i,e),u=+r(e[i+1],i+1,e);return s+(u-s)*(a-i)}}function CG(e,t,r){e=+e,t=+t,r=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+r;for(var n=-1,a=Math.max(0,Math.ceil((t-e)/r))|0,i=new Array(a);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Zf(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Zf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=OG.exec(e))?new on(t[1],t[2],t[3],1):(t=PG.exec(e))?new on(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=AG.exec(e))?Zf(t[1],t[2],t[3],t[4]):(t=TG.exec(e))?Zf(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=kG.exec(e))?UT(t[1],t[2]/100,t[3]/100,1):(t=RG.exec(e))?UT(t[1],t[2]/100,t[3]/100,t[4]):LT.hasOwnProperty(e)?BT(LT[e]):e==="transparent"?new on(NaN,NaN,NaN,0):null}function BT(e){return new on(e>>16&255,e>>8&255,e&255,1)}function Zf(e,t,r,n){return n<=0&&(e=t=r=NaN),new on(e,t,r,n)}function DG(e){return e instanceof ld||(e=Cu(e)),e?(e=e.rgb(),new on(e.r,e.g,e.b,e.opacity)):new on}function Iw(e,t,r,n){return arguments.length===1?DG(e):new on(e,t,r,n??1)}function on(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}Aj(on,Iw,TL(ld,{brighter(e){return e=e==null?_p:Math.pow(_p,e),new on(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Nu:Math.pow(Nu,e),new on(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new on(Uo(this.r),Uo(this.g),Uo(this.b),Cp(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:zT,formatHex:zT,formatHex8:LG,formatRgb:qT,toString:qT}));function zT(){return`#${Bo(this.r)}${Bo(this.g)}${Bo(this.b)}`}function LG(){return`#${Bo(this.r)}${Bo(this.g)}${Bo(this.b)}${Bo((isNaN(this.opacity)?1:this.opacity)*255)}`}function qT(){const e=Cp(this.opacity);return`${e===1?"rgb(":"rgba("}${Uo(this.r)}, ${Uo(this.g)}, ${Uo(this.b)}${e===1?")":`, ${e})`}`}function Cp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Uo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Bo(e){return e=Uo(e),(e<16?"0":"")+e.toString(16)}function UT(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new ha(e,t,r,n)}function kL(e){if(e instanceof ha)return new ha(e.h,e.s,e.l,e.opacity);if(e instanceof ld||(e=Cu(e)),!e)return new ha;if(e instanceof ha)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,a=Math.min(t,r,n),i=Math.max(t,r,n),s=NaN,u=i-a,d=(i+a)/2;return u?(t===i?s=(r-n)/u+(r0&&d<1?0:s,new ha(s,u,d,e.opacity)}function $G(e,t,r,n){return arguments.length===1?kL(e):new ha(e,t,r,n??1)}function ha(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Aj(ha,$G,TL(ld,{brighter(e){return e=e==null?_p:Math.pow(_p,e),new ha(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Nu:Math.pow(Nu,e),new ha(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,a=2*r-n;return new on(qb(e>=240?e-240:e+120,a,n),qb(e,a,n),qb(e<120?e+240:e-120,a,n),this.opacity)},clamp(){return new ha(VT(this.h),eh(this.s),eh(this.l),Cp(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Cp(this.opacity);return`${e===1?"hsl(":"hsla("}${VT(this.h)}, ${eh(this.s)*100}%, ${eh(this.l)*100}%${e===1?")":`, ${e})`}`}}));function VT(e){return e=(e||0)%360,e<0?e+360:e}function eh(e){return Math.max(0,Math.min(1,e||0))}function qb(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const Tj=e=>()=>e;function FG(e,t){return function(r){return e+r*t}}function BG(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function zG(e){return(e=+e)==1?RL:function(t,r){return r-t?BG(t,r,e):Tj(isNaN(t)?r:t)}}function RL(e,t){var r=t-e;return r?FG(e,r):Tj(isNaN(e)?t:e)}const HT=(function e(t){var r=zG(t);function n(a,i){var s=r((a=Iw(a)).r,(i=Iw(i)).r),u=r(a.g,i.g),d=r(a.b,i.b),c=RL(a.opacity,i.opacity);return function(f){return a.r=s(f),a.g=u(f),a.b=d(f),a.opacity=c(f),a+""}}return n.gamma=e,n})(1);function qG(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),a;return function(i){for(a=0;ar&&(i=t.slice(r,i),u[s]?u[s]+=i:u[++s]=i),(n=n[0])===(a=a[0])?u[s]?u[s]+=a:u[++s]=a:(u[++s]=null,d.push({i:s,x:Ep(n,a)})),r=Ub.lastIndex;return rt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function ZG(e,t,r){var n=e[0],a=e[1],i=t[0],s=t[1];return a2?eK:ZG,d=c=null,p}function p(m){return m==null||isNaN(m=+m)?i:(d||(d=u(e.map(n),t,r)))(n(s(m)))}return p.invert=function(m){return s(a((c||(c=u(t,e.map(n),Ep)))(m)))},p.domain=function(m){return arguments.length?(e=Array.from(m,Op),f()):e.slice()},p.range=function(m){return arguments.length?(t=Array.from(m),f()):t.slice()},p.rangeRound=function(m){return t=Array.from(m),r=kj,f()},p.clamp=function(m){return arguments.length?(s=m?!0:Xr,f()):s!==Xr},p.interpolate=function(m){return arguments.length?(r=m,f()):r},p.unknown=function(m){return arguments.length?(i=m,p):i},function(m,v){return n=m,a=v,f()}}function Rj(){return Fm()(Xr,Xr)}function tK(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Pp(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function yl(e){return e=Pp(Math.abs(e)),e?e[1]:NaN}function rK(e,t){return function(r,n){for(var a=r.length,i=[],s=0,u=e[0],d=0;a>0&&u>0&&(d+u+1>n&&(u=Math.max(1,n-d)),i.push(r.substring(a-=u,a+u)),!((d+=u+1)>n));)u=e[s=(s+1)%e.length];return i.reverse().join(t)}}function nK(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var aK=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Eu(e){if(!(t=aK.exec(e)))throw new Error("invalid format: "+e);var t;return new Ij({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Eu.prototype=Ij.prototype;function Ij(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Ij.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function iK(e){e:for(var t=e.length,r=1,n=-1,a;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(a+1):e}var Ap;function oK(e,t){var r=Pp(e,t);if(!r)return Ap=void 0,e.toPrecision(t);var n=r[0],a=r[1],i=a-(Ap=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,s=n.length;return i===s?n:i>s?n+new Array(i-s+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+Pp(e,Math.max(0,t+i-1))[0]}function GT(e,t){var r=Pp(e,t);if(!r)return e+"";var n=r[0],a=r[1];return a<0?"0."+new Array(-a).join("0")+n:n.length>a+1?n.slice(0,a+1)+"."+n.slice(a+1):n+new Array(a-n.length+2).join("0")}const KT={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:tK,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>GT(e*100,t),r:GT,s:oK,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function YT(e){return e}var XT=Array.prototype.map,JT=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function sK(e){var t=e.grouping===void 0||e.thousands===void 0?YT:rK(XT.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?YT:nK(XT.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"−":e.minus+"",d=e.nan===void 0?"NaN":e.nan+"";function c(p,m){p=Eu(p);var v=p.fill,y=p.align,x=p.sign,w=p.symbol,j=p.zero,N=p.width,C=p.comma,A=p.precision,E=p.trim,O=p.type;O==="n"?(C=!0,O="g"):KT[O]||(A===void 0&&(A=12),E=!0,O="g"),(j||v==="0"&&y==="=")&&(j=!0,v="0",y="=");var T=(m&&m.prefix!==void 0?m.prefix:"")+(w==="$"?r:w==="#"&&/[boxX]/.test(O)?"0"+O.toLowerCase():""),k=(w==="$"?n:/[%p]/.test(O)?s:"")+(m&&m.suffix!==void 0?m.suffix:""),M=KT[O],L=/[defgprs%]/.test(O);A=A===void 0?6:/[gprs]/.test(O)?Math.max(1,Math.min(21,A)):Math.max(0,Math.min(20,A));function $(I){var H=T,Y=k,W,V,K;if(O==="c")Y=M(I)+Y,I="";else{I=+I;var F=I<0||1/I<0;if(I=isNaN(I)?d:M(Math.abs(I),A),E&&(I=iK(I)),F&&+I==0&&x!=="+"&&(F=!1),H=(F?x==="("?x:u:x==="-"||x==="("?"":x)+H,Y=(O==="s"&&!isNaN(I)&&Ap!==void 0?JT[8+Ap/3]:"")+Y+(F&&x==="("?")":""),L){for(W=-1,V=I.length;++WK||K>57){Y=(K===46?a+I.slice(W+1):I.slice(W))+Y,I=I.slice(0,W);break}}}C&&!j&&(I=t(I,1/0));var te=H.length+I.length+Y.length,D=te>1)+H+I+Y+D.slice(te);break;default:I=D+H+I+Y;break}return i(I)}return $.toString=function(){return p+""},$}function f(p,m){var v=Math.max(-8,Math.min(8,Math.floor(yl(m)/3)))*3,y=Math.pow(10,-v),x=c((p=Eu(p),p.type="f",p),{suffix:JT[8+v/3]});return function(w){return x(y*w)}}return{format:c,formatPrefix:f}}var th,Mj,IL;lK({thousands:",",grouping:[3],currency:["$",""]});function lK(e){return th=sK(e),Mj=th.format,IL=th.formatPrefix,th}function cK(e){return Math.max(0,-yl(Math.abs(e)))}function uK(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(yl(t)/3)))*3-yl(Math.abs(e)))}function dK(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,yl(t)-yl(e))+1}function ML(e,t,r,n){var a=kw(e,t,r),i;switch(n=Eu(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=uK(a,s))&&(n.precision=i),IL(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=dK(a,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=cK(a))&&(n.precision=i-(n.type==="%")*2);break}}return Mj(n)}function uo(e){var t=e.domain;return e.ticks=function(r){var n=t();return Aw(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var a=t();return ML(a[0],a[a.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),a=0,i=n.length-1,s=n[a],u=n[i],d,c,f=10;for(u0;){if(c=Tw(s,u,r),c===d)return n[a]=s,n[i]=u,t(n);if(c>0)s=Math.floor(s/c)*c,u=Math.ceil(u/c)*c;else if(c<0)s=Math.ceil(s*c)/c,u=Math.floor(u*c)/c;else break;d=c}return e},e}function Tp(){var e=Rj();return e.copy=function(){return cd(e,Tp())},Xn.apply(e,arguments),uo(e)}function DL(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,Op),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return DL(e).unknown(t)},e=arguments.length?Array.from(e,Op):[0,1],uo(r)}function LL(e,t){e=e.slice();var r=0,n=e.length-1,a=e[r],i=e[n],s;return iMath.pow(e,t)}function gK(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function e2(e){return(t,r)=>-e(-t,r)}function Dj(e){const t=e(QT,ZT),r=t.domain;let n=10,a,i;function s(){return a=gK(n),i=mK(n),r()[0]<0?(a=e2(a),i=e2(i),e(fK,hK)):e(QT,ZT),t}return t.base=function(u){return arguments.length?(n=+u,s()):n},t.domain=function(u){return arguments.length?(r(u),s()):r()},t.ticks=u=>{const d=r();let c=d[0],f=d[d.length-1];const p=f0){for(;m<=v;++m)for(y=1;yf)break;j.push(x)}}else for(;m<=v;++m)for(y=n-1;y>=1;--y)if(x=m>0?y/i(-m):y*i(m),!(xf)break;j.push(x)}j.length*2{if(u==null&&(u=10),d==null&&(d=n===10?"s":","),typeof d!="function"&&(!(n%1)&&(d=Eu(d)).precision==null&&(d.trim=!0),d=Mj(d)),u===1/0)return d;const c=Math.max(1,n*u/t.ticks().length);return f=>{let p=f/i(Math.round(a(f)));return p*nr(LL(r(),{floor:u=>i(Math.floor(a(u))),ceil:u=>i(Math.ceil(a(u)))})),t}function $L(){const e=Dj(Fm()).domain([1,10]);return e.copy=()=>cd(e,$L()).base(e.base()),Xn.apply(e,arguments),e}function t2(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function r2(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Lj(e){var t=1,r=e(t2(t),r2(t));return r.constant=function(n){return arguments.length?e(t2(t=+n),r2(t)):t},uo(r)}function FL(){var e=Lj(Fm());return e.copy=function(){return cd(e,FL()).constant(e.constant())},Xn.apply(e,arguments)}function n2(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function vK(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function yK(e){return e<0?-e*e:e*e}function $j(e){var t=e(Xr,Xr),r=1;function n(){return r===1?e(Xr,Xr):r===.5?e(vK,yK):e(n2(r),n2(1/r))}return t.exponent=function(a){return arguments.length?(r=+a,n()):r},uo(t)}function Fj(){var e=$j(Fm());return e.copy=function(){return cd(e,Fj()).exponent(e.exponent())},Xn.apply(e,arguments),e}function xK(){return Fj.apply(null,arguments).exponent(.5)}function a2(e){return Math.sign(e)*e*e}function bK(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function BL(){var e=Rj(),t=[0,1],r=!1,n;function a(i){var s=bK(e(i));return isNaN(s)?n:r?Math.round(s):s}return a.invert=function(i){return e.invert(a2(i))},a.domain=function(i){return arguments.length?(e.domain(i),a):e.domain()},a.range=function(i){return arguments.length?(e.range((t=Array.from(i,Op)).map(a2)),a):t.slice()},a.rangeRound=function(i){return a.range(i).round(!0)},a.round=function(i){return arguments.length?(r=!!i,a):r},a.clamp=function(i){return arguments.length?(e.clamp(i),a):e.clamp()},a.unknown=function(i){return arguments.length?(n=i,a):n},a.copy=function(){return BL(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Xn.apply(a,arguments),uo(a)}function zL(){var e=[],t=[],r=[],n;function a(){var s=0,u=Math.max(1,t.length);for(r=new Array(u-1);++s0?r[u-1]:e[0],u=r?[n[r-1],t]:[n[c-1],n[c]]},s.unknown=function(d){return arguments.length&&(i=d),s},s.thresholds=function(){return n.slice()},s.copy=function(){return qL().domain([e,t]).range(a).unknown(i)},Xn.apply(uo(s),arguments)}function UL(){var e=[.5],t=[0,1],r,n=1;function a(i){return i!=null&&i<=i?t[sd(e,i,0,n)]:r}return a.domain=function(i){return arguments.length?(e=Array.from(i),n=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(i){return arguments.length?(t=Array.from(i),n=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(i){var s=t.indexOf(i);return[e[s-1],e[s]]},a.unknown=function(i){return arguments.length?(r=i,a):r},a.copy=function(){return UL().domain(e).range(t).unknown(r)},Xn.apply(a,arguments)}const Vb=new Date,Hb=new Date;function gr(e,t,r,n){function a(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return a.floor=i=>(e(i=new Date(+i)),i),a.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),a.round=i=>{const s=a(i),u=a.ceil(i);return i-s(t(i=new Date(+i),s==null?1:Math.floor(s)),i),a.range=(i,s,u)=>{const d=[];if(i=a.ceil(i),u=u==null?1:Math.floor(u),!(i0))return d;let c;do d.push(c=new Date(+i)),t(i,u),e(i);while(cgr(s=>{if(s>=s)for(;e(s),!i(s);)s.setTime(s-1)},(s,u)=>{if(s>=s)if(u<0)for(;++u<=0;)for(;t(s,-1),!i(s););else for(;--u>=0;)for(;t(s,1),!i(s););}),r&&(a.count=(i,s)=>(Vb.setTime(+i),Hb.setTime(+s),e(Vb),e(Hb),Math.floor(r(Vb,Hb))),a.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?a.filter(n?s=>n(s)%i===0:s=>a.count(0,s)%i===0):a)),a}const kp=gr(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);kp.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?gr(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):kp);kp.range;const li=1e3,Hn=li*60,ci=Hn*60,mi=ci*24,Bj=mi*7,i2=mi*30,Wb=mi*365,zo=gr(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*li)},(e,t)=>(t-e)/li,e=>e.getUTCSeconds());zo.range;const zj=gr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*li)},(e,t)=>{e.setTime(+e+t*Hn)},(e,t)=>(t-e)/Hn,e=>e.getMinutes());zj.range;const qj=gr(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Hn)},(e,t)=>(t-e)/Hn,e=>e.getUTCMinutes());qj.range;const Uj=gr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*li-e.getMinutes()*Hn)},(e,t)=>{e.setTime(+e+t*ci)},(e,t)=>(t-e)/ci,e=>e.getHours());Uj.range;const Vj=gr(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*ci)},(e,t)=>(t-e)/ci,e=>e.getUTCHours());Vj.range;const ud=gr(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Hn)/mi,e=>e.getDate()-1);ud.range;const Bm=gr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/mi,e=>e.getUTCDate()-1);Bm.range;const VL=gr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/mi,e=>Math.floor(e/mi));VL.range;function ls(e){return gr(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*Hn)/Bj)}const zm=ls(0),Rp=ls(1),wK=ls(2),SK=ls(3),xl=ls(4),jK=ls(5),NK=ls(6);zm.range;Rp.range;wK.range;SK.range;xl.range;jK.range;NK.range;function cs(e){return gr(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/Bj)}const qm=cs(0),Ip=cs(1),_K=cs(2),CK=cs(3),bl=cs(4),EK=cs(5),OK=cs(6);qm.range;Ip.range;_K.range;CK.range;bl.range;EK.range;OK.range;const Hj=gr(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Hj.range;const Wj=gr(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Wj.range;const gi=gr(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());gi.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:gr(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});gi.range;const vi=gr(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());vi.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:gr(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});vi.range;function HL(e,t,r,n,a,i){const s=[[zo,1,li],[zo,5,5*li],[zo,15,15*li],[zo,30,30*li],[i,1,Hn],[i,5,5*Hn],[i,15,15*Hn],[i,30,30*Hn],[a,1,ci],[a,3,3*ci],[a,6,6*ci],[a,12,12*ci],[n,1,mi],[n,2,2*mi],[r,1,Bj],[t,1,i2],[t,3,3*i2],[e,1,Wb]];function u(c,f,p){const m=fw).right(s,m);if(v===s.length)return e.every(kw(c/Wb,f/Wb,p));if(v===0)return kp.every(Math.max(kw(c,f,p),1));const[y,x]=s[m/s[v-1][2]53)return null;"w"in ne||(ne.w=1),"Z"in ne?(pe=Kb(Uc(ne.y,0,1)),Pe=pe.getUTCDay(),pe=Pe>4||Pe===0?Ip.ceil(pe):Ip(pe),pe=Bm.offset(pe,(ne.V-1)*7),ne.y=pe.getUTCFullYear(),ne.m=pe.getUTCMonth(),ne.d=pe.getUTCDate()+(ne.w+6)%7):(pe=Gb(Uc(ne.y,0,1)),Pe=pe.getDay(),pe=Pe>4||Pe===0?Rp.ceil(pe):Rp(pe),pe=ud.offset(pe,(ne.V-1)*7),ne.y=pe.getFullYear(),ne.m=pe.getMonth(),ne.d=pe.getDate()+(ne.w+6)%7)}else("W"in ne||"U"in ne)&&("w"in ne||(ne.w="u"in ne?ne.u%7:"W"in ne?1:0),Pe="Z"in ne?Kb(Uc(ne.y,0,1)).getUTCDay():Gb(Uc(ne.y,0,1)).getDay(),ne.m=0,ne.d="W"in ne?(ne.w+6)%7+ne.W*7-(Pe+5)%7:ne.w+ne.U*7-(Pe+6)%7);return"Z"in ne?(ne.H+=ne.Z/100|0,ne.M+=ne.Z%100,Kb(ne)):Gb(ne)}}function k(ee,ce,ve,ne){for(var Ce=0,pe=ce.length,Pe=ve.length,$e,Fe;Ce=Pe)return-1;if($e=ce.charCodeAt(Ce++),$e===37){if($e=ce.charAt(Ce++),Fe=E[$e in o2?ce.charAt(Ce++):$e],!Fe||(ne=Fe(ee,ve,ne))<0)return-1}else if($e!=ve.charCodeAt(ne++))return-1}return ne}function M(ee,ce,ve){var ne=c.exec(ce.slice(ve));return ne?(ee.p=f.get(ne[0].toLowerCase()),ve+ne[0].length):-1}function L(ee,ce,ve){var ne=v.exec(ce.slice(ve));return ne?(ee.w=y.get(ne[0].toLowerCase()),ve+ne[0].length):-1}function $(ee,ce,ve){var ne=p.exec(ce.slice(ve));return ne?(ee.w=m.get(ne[0].toLowerCase()),ve+ne[0].length):-1}function I(ee,ce,ve){var ne=j.exec(ce.slice(ve));return ne?(ee.m=N.get(ne[0].toLowerCase()),ve+ne[0].length):-1}function H(ee,ce,ve){var ne=x.exec(ce.slice(ve));return ne?(ee.m=w.get(ne[0].toLowerCase()),ve+ne[0].length):-1}function Y(ee,ce,ve){return k(ee,t,ce,ve)}function W(ee,ce,ve){return k(ee,r,ce,ve)}function V(ee,ce,ve){return k(ee,n,ce,ve)}function K(ee){return s[ee.getDay()]}function F(ee){return i[ee.getDay()]}function te(ee){return d[ee.getMonth()]}function D(ee){return u[ee.getMonth()]}function U(ee){return a[+(ee.getHours()>=12)]}function z(ee){return 1+~~(ee.getMonth()/3)}function B(ee){return s[ee.getUTCDay()]}function X(ee){return i[ee.getUTCDay()]}function Q(ee){return d[ee.getUTCMonth()]}function re(ee){return u[ee.getUTCMonth()]}function G(ee){return a[+(ee.getUTCHours()>=12)]}function Z(ee){return 1+~~(ee.getUTCMonth()/3)}return{format:function(ee){var ce=O(ee+="",C);return ce.toString=function(){return ee},ce},parse:function(ee){var ce=T(ee+="",!1);return ce.toString=function(){return ee},ce},utcFormat:function(ee){var ce=O(ee+="",A);return ce.toString=function(){return ee},ce},utcParse:function(ee){var ce=T(ee+="",!0);return ce.toString=function(){return ee},ce}}}var o2={"-":"",_:" ",0:"0"},Nr=/^\s*\d+/,IK=/^%/,MK=/[\\^$*+?|[\]().{}]/g;function pt(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i[t.toLowerCase(),r]))}function LK(e,t,r){var n=Nr.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function $K(e,t,r){var n=Nr.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function FK(e,t,r){var n=Nr.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function BK(e,t,r){var n=Nr.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function zK(e,t,r){var n=Nr.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function s2(e,t,r){var n=Nr.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function l2(e,t,r){var n=Nr.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function qK(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function UK(e,t,r){var n=Nr.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function VK(e,t,r){var n=Nr.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function c2(e,t,r){var n=Nr.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function HK(e,t,r){var n=Nr.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function u2(e,t,r){var n=Nr.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function WK(e,t,r){var n=Nr.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function GK(e,t,r){var n=Nr.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function KK(e,t,r){var n=Nr.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function YK(e,t,r){var n=Nr.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function XK(e,t,r){var n=IK.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function JK(e,t,r){var n=Nr.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function QK(e,t,r){var n=Nr.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function d2(e,t){return pt(e.getDate(),t,2)}function ZK(e,t){return pt(e.getHours(),t,2)}function eY(e,t){return pt(e.getHours()%12||12,t,2)}function tY(e,t){return pt(1+ud.count(gi(e),e),t,3)}function WL(e,t){return pt(e.getMilliseconds(),t,3)}function rY(e,t){return WL(e,t)+"000"}function nY(e,t){return pt(e.getMonth()+1,t,2)}function aY(e,t){return pt(e.getMinutes(),t,2)}function iY(e,t){return pt(e.getSeconds(),t,2)}function oY(e){var t=e.getDay();return t===0?7:t}function sY(e,t){return pt(zm.count(gi(e)-1,e),t,2)}function GL(e){var t=e.getDay();return t>=4||t===0?xl(e):xl.ceil(e)}function lY(e,t){return e=GL(e),pt(xl.count(gi(e),e)+(gi(e).getDay()===4),t,2)}function cY(e){return e.getDay()}function uY(e,t){return pt(Rp.count(gi(e)-1,e),t,2)}function dY(e,t){return pt(e.getFullYear()%100,t,2)}function fY(e,t){return e=GL(e),pt(e.getFullYear()%100,t,2)}function hY(e,t){return pt(e.getFullYear()%1e4,t,4)}function pY(e,t){var r=e.getDay();return e=r>=4||r===0?xl(e):xl.ceil(e),pt(e.getFullYear()%1e4,t,4)}function mY(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+pt(t/60|0,"0",2)+pt(t%60,"0",2)}function f2(e,t){return pt(e.getUTCDate(),t,2)}function gY(e,t){return pt(e.getUTCHours(),t,2)}function vY(e,t){return pt(e.getUTCHours()%12||12,t,2)}function yY(e,t){return pt(1+Bm.count(vi(e),e),t,3)}function KL(e,t){return pt(e.getUTCMilliseconds(),t,3)}function xY(e,t){return KL(e,t)+"000"}function bY(e,t){return pt(e.getUTCMonth()+1,t,2)}function wY(e,t){return pt(e.getUTCMinutes(),t,2)}function SY(e,t){return pt(e.getUTCSeconds(),t,2)}function jY(e){var t=e.getUTCDay();return t===0?7:t}function NY(e,t){return pt(qm.count(vi(e)-1,e),t,2)}function YL(e){var t=e.getUTCDay();return t>=4||t===0?bl(e):bl.ceil(e)}function _Y(e,t){return e=YL(e),pt(bl.count(vi(e),e)+(vi(e).getUTCDay()===4),t,2)}function CY(e){return e.getUTCDay()}function EY(e,t){return pt(Ip.count(vi(e)-1,e),t,2)}function OY(e,t){return pt(e.getUTCFullYear()%100,t,2)}function PY(e,t){return e=YL(e),pt(e.getUTCFullYear()%100,t,2)}function AY(e,t){return pt(e.getUTCFullYear()%1e4,t,4)}function TY(e,t){var r=e.getUTCDay();return e=r>=4||r===0?bl(e):bl.ceil(e),pt(e.getUTCFullYear()%1e4,t,4)}function kY(){return"+0000"}function h2(){return"%"}function p2(e){return+e}function m2(e){return Math.floor(+e/1e3)}var Ds,XL,JL;RY({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function RY(e){return Ds=RK(e),XL=Ds.format,Ds.parse,JL=Ds.utcFormat,Ds.utcParse,Ds}function IY(e){return new Date(e)}function MY(e){return e instanceof Date?+e:+new Date(+e)}function Gj(e,t,r,n,a,i,s,u,d,c){var f=Rj(),p=f.invert,m=f.domain,v=c(".%L"),y=c(":%S"),x=c("%I:%M"),w=c("%I %p"),j=c("%a %d"),N=c("%b %d"),C=c("%B"),A=c("%Y");function E(O){return(d(O)t(a/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(a,i)=>NG(e,i/n))},r.copy=function(){return t$(t).domain(e)},Ei.apply(r,arguments)}function Vm(){var e=0,t=.5,r=1,n=1,a,i,s,u,d,c=Xr,f,p=!1,m;function v(x){return isNaN(x=+x)?m:(x=.5+((x=+f(x))-i)*(n*xr}return Xb=e,Xb}var Jb,x2;function BY(){if(x2)return Jb;x2=1;var e=Hm(),t=i$(),r=Kl();function n(a){return a&&a.length?e(a,r,t):void 0}return Jb=n,Jb}var zY=BY();const Wm=mt(zY);var Qb,b2;function o$(){if(b2)return Qb;b2=1;function e(t,r){return te.e^i.s<0?1:-1;for(n=i.d.length,a=e.d.length,t=0,r=ne.d[t]^i.s<0?1:-1;return n===a?0:n>a^i.s<0?1:-1};Te.decimalPlaces=Te.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*Ft;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};Te.dividedBy=Te.div=function(e){return fi(this,new this.constructor(e))};Te.dividedToIntegerBy=Te.idiv=function(e){var t=this,r=t.constructor;return Tt(fi(t,new r(e),0,1),r.precision)};Te.equals=Te.eq=function(e){return!this.cmp(e)};Te.exponent=function(){return or(this)};Te.greaterThan=Te.gt=function(e){return this.cmp(e)>0};Te.greaterThanOrEqualTo=Te.gte=function(e){return this.cmp(e)>=0};Te.isInteger=Te.isint=function(){return this.e>this.d.length-2};Te.isNegative=Te.isneg=function(){return this.s<0};Te.isPositive=Te.ispos=function(){return this.s>0};Te.isZero=function(){return this.s===0};Te.lessThan=Te.lt=function(e){return this.cmp(e)<0};Te.lessThanOrEqualTo=Te.lte=function(e){return this.cmp(e)<1};Te.logarithm=Te.log=function(e){var t,r=this,n=r.constructor,a=n.precision,i=a+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(_n))throw Error(Kn+"NaN");if(r.s<1)throw Error(Kn+(r.s?"NaN":"-Infinity"));return r.eq(_n)?new n(0):(qt=!1,t=fi(Ou(r,i),Ou(e,i),i),qt=!0,Tt(t,a))};Te.minus=Te.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?u$(t,e):l$(t,(e.s=-e.s,e))};Te.modulo=Te.mod=function(e){var t,r=this,n=r.constructor,a=n.precision;if(e=new n(e),!e.s)throw Error(Kn+"NaN");return r.s?(qt=!1,t=fi(r,e,0,1).times(e),qt=!0,r.minus(t)):Tt(new n(r),a)};Te.naturalExponential=Te.exp=function(){return c$(this)};Te.naturalLogarithm=Te.ln=function(){return Ou(this)};Te.negated=Te.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Te.plus=Te.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?l$(t,e):u$(t,(e.s=-e.s,e))};Te.precision=Te.sd=function(e){var t,r,n,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Vo+e);if(t=or(a)+1,n=a.d.length-1,r=n*Ft+1,n=a.d[n],n){for(;n%10==0;n/=10)r--;for(n=a.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};Te.squareRoot=Te.sqrt=function(){var e,t,r,n,a,i,s,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(Kn+"NaN")}for(e=or(u),qt=!1,a=Math.sqrt(+u),a==0||a==1/0?(t=Ma(u.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=Jl((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new d(t)):n=new d(a.toString()),r=d.precision,a=s=r+3;;)if(i=n,n=i.plus(fi(u,i,s+2)).times(.5),Ma(i.d).slice(0,s)===(t=Ma(n.d)).slice(0,s)){if(t=t.slice(s-3,s+1),a==s&&t=="4999"){if(Tt(i,r+1,0),i.times(i).eq(u)){n=i;break}}else if(t!="9999")break;s+=4}return qt=!0,Tt(n,r)};Te.times=Te.mul=function(e){var t,r,n,a,i,s,u,d,c,f=this,p=f.constructor,m=f.d,v=(e=new p(e)).d;if(!f.s||!e.s)return new p(0);for(e.s*=f.s,r=f.e+e.e,d=m.length,c=v.length,d=0;){for(t=0,a=d+n;a>n;)u=i[a]+v[n]*m[a-n-1]+t,i[a--]=u%Sr|0,t=u/Sr|0;i[a]=(i[a]+t)%Sr|0}for(;!i[--s];)i.pop();return t?++r:i.shift(),e.d=i,e.e=r,qt?Tt(e,p.precision):e};Te.toDecimalPlaces=Te.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Ba(e,0,Xl),t===void 0?t=n.rounding:Ba(t,0,8),Tt(r,e+or(r)+1,t))};Te.toExponential=function(e,t){var r,n=this,a=n.constructor;return e===void 0?r=Ko(n,!0):(Ba(e,0,Xl),t===void 0?t=a.rounding:Ba(t,0,8),n=Tt(new a(n),e+1,t),r=Ko(n,!0,e+1)),r};Te.toFixed=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?Ko(a):(Ba(e,0,Xl),t===void 0?t=i.rounding:Ba(t,0,8),n=Tt(new i(a),e+or(a)+1,t),r=Ko(n.abs(),!1,e+or(n)+1),a.isneg()&&!a.isZero()?"-"+r:r)};Te.toInteger=Te.toint=function(){var e=this,t=e.constructor;return Tt(new t(e),or(e)+1,t.rounding)};Te.toNumber=function(){return+this};Te.toPower=Te.pow=function(e){var t,r,n,a,i,s,u=this,d=u.constructor,c=12,f=+(e=new d(e));if(!e.s)return new d(_n);if(u=new d(u),!u.s){if(e.s<1)throw Error(Kn+"Infinity");return u}if(u.eq(_n))return u;if(n=d.precision,e.eq(_n))return Tt(u,n);if(t=e.e,r=e.d.length-1,s=t>=r,i=u.s,s){if((r=f<0?-f:f)<=s$){for(a=new d(_n),t=Math.ceil(n/Ft+4),qt=!1;r%2&&(a=a.times(u),C2(a.d,t)),r=Jl(r/2),r!==0;)u=u.times(u),C2(u.d,t);return qt=!0,e.s<0?new d(_n).div(a):Tt(a,n)}}else if(i<0)throw Error(Kn+"NaN");return i=i<0&&e.d[Math.max(t,r)]&1?-1:1,u.s=1,qt=!1,a=e.times(Ou(u,n+c)),qt=!0,a=c$(a),a.s=i,a};Te.toPrecision=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?(r=or(a),n=Ko(a,r<=i.toExpNeg||r>=i.toExpPos)):(Ba(e,1,Xl),t===void 0?t=i.rounding:Ba(t,0,8),a=Tt(new i(a),e,t),r=or(a),n=Ko(a,e<=r||r<=i.toExpNeg,e)),n};Te.toSignificantDigits=Te.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Ba(e,1,Xl),t===void 0?t=n.rounding:Ba(t,0,8)),Tt(new n(r),e,t)};Te.toString=Te.valueOf=Te.val=Te.toJSON=Te[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=or(e),r=e.constructor;return Ko(e,t<=r.toExpNeg||t>=r.toExpPos)};function l$(e,t){var r,n,a,i,s,u,d,c,f=e.constructor,p=f.precision;if(!e.s||!t.s)return t.s||(t=new f(e)),qt?Tt(t,p):t;if(d=e.d,c=t.d,s=e.e,a=t.e,d=d.slice(),i=s-a,i){for(i<0?(n=d,i=-i,u=c.length):(n=c,a=s,u=d.length),s=Math.ceil(p/Ft),u=s>u?s+1:u+1,i>u&&(i=u,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(u=d.length,i=c.length,u-i<0&&(i=u,n=c,c=d,d=n),r=0;i;)r=(d[--i]=d[i]+c[i]+r)/Sr|0,d[i]%=Sr;for(r&&(d.unshift(r),++a),u=d.length;d[--u]==0;)d.pop();return t.d=d,t.e=a,qt?Tt(t,p):t}function Ba(e,t,r){if(e!==~~e||er)throw Error(Vo+e)}function Ma(e){var t,r,n,a=e.length-1,i="",s=e[0];if(a>0){for(i+=s,t=1;ts?1:-1;else for(u=d=0;ua[u]?1:-1;break}return d}function r(n,a,i){for(var s=0;i--;)n[i]-=s,s=n[i]1;)n.shift()}return function(n,a,i,s){var u,d,c,f,p,m,v,y,x,w,j,N,C,A,E,O,T,k,M=n.constructor,L=n.s==a.s?1:-1,$=n.d,I=a.d;if(!n.s)return new M(n);if(!a.s)throw Error(Kn+"Division by zero");for(d=n.e-a.e,T=I.length,E=$.length,v=new M(L),y=v.d=[],c=0;I[c]==($[c]||0);)++c;if(I[c]>($[c]||0)&&--d,i==null?N=i=M.precision:s?N=i+(or(n)-or(a))+1:N=i,N<0)return new M(0);if(N=N/Ft+2|0,c=0,T==1)for(f=0,I=I[0],N++;(c1&&(I=e(I,f),$=e($,f),T=I.length,E=$.length),A=T,x=$.slice(0,T),w=x.length;w=Sr/2&&++O;do f=0,u=t(I,x,T,w),u<0?(j=x[0],T!=w&&(j=j*Sr+(x[1]||0)),f=j/O|0,f>1?(f>=Sr&&(f=Sr-1),p=e(I,f),m=p.length,w=x.length,u=t(p,x,m,w),u==1&&(f--,r(p,T16)throw Error(Xj+or(e));if(!e.s)return new f(_n);for(qt=!1,u=p,s=new f(.03125);e.abs().gte(.1);)e=e.times(s),c+=5;for(n=Math.log(Lo(2,c))/Math.LN10*2+5|0,u+=n,r=a=i=new f(_n),f.precision=u;;){if(a=Tt(a.times(e),u),r=r.times(++d),s=i.plus(fi(a,r,u)),Ma(s.d).slice(0,u)===Ma(i.d).slice(0,u)){for(;c--;)i=Tt(i.times(i),u);return f.precision=p,t==null?(qt=!0,Tt(i,p)):i}i=s}}function or(e){for(var t=e.e*Ft,r=e.d[0];r>=10;r/=10)t++;return t}function n1(e,t,r){if(t>e.LN10.sd())throw qt=!0,r&&(e.precision=r),Error(Kn+"LN10 precision limit exceeded");return Tt(new e(e.LN10),t)}function eo(e){for(var t="";e--;)t+="0";return t}function Ou(e,t){var r,n,a,i,s,u,d,c,f,p=1,m=10,v=e,y=v.d,x=v.constructor,w=x.precision;if(v.s<1)throw Error(Kn+(v.s?"NaN":"-Infinity"));if(v.eq(_n))return new x(0);if(t==null?(qt=!1,c=w):c=t,v.eq(10))return t==null&&(qt=!0),n1(x,c);if(c+=m,x.precision=c,r=Ma(y),n=r.charAt(0),i=or(v),Math.abs(i)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)v=v.times(e),r=Ma(v.d),n=r.charAt(0),p++;i=or(v),n>1?(v=new x("0."+r),i++):v=new x(n+"."+r.slice(1))}else return d=n1(x,c+2,w).times(i+""),v=Ou(new x(n+"."+r.slice(1)),c-m).plus(d),x.precision=w,t==null?(qt=!0,Tt(v,w)):v;for(u=s=v=fi(v.minus(_n),v.plus(_n),c),f=Tt(v.times(v),c),a=3;;){if(s=Tt(s.times(f),c),d=u.plus(fi(s,new x(a),c)),Ma(d.d).slice(0,c)===Ma(u.d).slice(0,c))return u=u.times(2),i!==0&&(u=u.plus(n1(x,c+2,w).times(i+""))),u=fi(u,new x(p),c),x.precision=w,t==null?(qt=!0,Tt(u,w)):u;u=d,a+=2}}function _2(e,t){var r,n,a;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(n,a),t){if(a-=n,r=r-n-1,e.e=Jl(r/Ft),e.d=[],n=(r+1)%Ft,r<0&&(n+=Ft),nMp||e.e<-Mp))throw Error(Xj+r)}else e.s=0,e.e=0,e.d=[0];return e}function Tt(e,t,r){var n,a,i,s,u,d,c,f,p=e.d;for(s=1,i=p[0];i>=10;i/=10)s++;if(n=t-s,n<0)n+=Ft,a=t,c=p[f=0];else{if(f=Math.ceil((n+1)/Ft),i=p.length,f>=i)return e;for(c=i=p[f],s=1;i>=10;i/=10)s++;n%=Ft,a=n-Ft+s}if(r!==void 0&&(i=Lo(10,s-a-1),u=c/i%10|0,d=t<0||p[f+1]!==void 0||c%i,d=r<4?(u||d)&&(r==0||r==(e.s<0?3:2)):u>5||u==5&&(r==4||d||r==6&&(n>0?a>0?c/Lo(10,s-a):0:p[f-1])%10&1||r==(e.s<0?8:7))),t<1||!p[0])return d?(i=or(e),p.length=1,t=t-i-1,p[0]=Lo(10,(Ft-t%Ft)%Ft),e.e=Jl(-t/Ft)||0):(p.length=1,p[0]=e.e=e.s=0),e;if(n==0?(p.length=f,i=1,f--):(p.length=f+1,i=Lo(10,Ft-n),p[f]=a>0?(c/Lo(10,s-a)%Lo(10,a)|0)*i:0),d)for(;;)if(f==0){(p[0]+=i)==Sr&&(p[0]=1,++e.e);break}else{if(p[f]+=i,p[f]!=Sr)break;p[f--]=0,i=1}for(n=p.length;p[--n]===0;)p.pop();if(qt&&(e.e>Mp||e.e<-Mp))throw Error(Xj+or(e));return e}function u$(e,t){var r,n,a,i,s,u,d,c,f,p,m=e.constructor,v=m.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new m(e),qt?Tt(t,v):t;if(d=e.d,p=t.d,n=t.e,c=e.e,d=d.slice(),s=c-n,s){for(f=s<0,f?(r=d,s=-s,u=p.length):(r=p,n=c,u=d.length),a=Math.max(Math.ceil(v/Ft),u)+2,s>a&&(s=a,r.length=1),r.reverse(),a=s;a--;)r.push(0);r.reverse()}else{for(a=d.length,u=p.length,f=a0;--a)d[u++]=0;for(a=p.length;a>s;){if(d[--a]0?i=i.charAt(0)+"."+i.slice(1)+eo(n):s>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+eo(-a-1)+i,r&&(n=r-s)>0&&(i+=eo(n))):a>=s?(i+=eo(a+1-s),r&&(n=r-a-1)>0&&(i=i+"."+eo(n))):((n=a+1)0&&(a+1===s&&(i+="."),i+=eo(n))),e.s<0?"-"+i:i}function C2(e,t){if(e.length>t)return e.length=t,!0}function d$(e){var t,r,n;function a(i){var s=this;if(!(s instanceof a))return new a(i);if(s.constructor=a,i instanceof a){s.s=i.s,s.e=i.e,s.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(Vo+i);if(i>0)s.s=1;else if(i<0)i=-i,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(i===~~i&&i<1e7){s.e=0,s.d=[i];return}return _2(s,i.toString())}else if(typeof i!="string")throw Error(Vo+i);if(i.charCodeAt(0)===45?(i=i.slice(1),s.s=-1):s.s=1,JY.test(i))_2(s,i);else throw Error(Vo+i)}if(a.prototype=Te,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=d$,a.config=a.set=QY,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(Vo+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(Vo+r+": "+n);return this}var Jj=d$(XY);_n=new Jj(1);const Ct=Jj;function ZY(e){return nX(e)||rX(e)||tX(e)||eX()}function eX(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tX(e,t){if(e){if(typeof e=="string")return Lw(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Lw(e,t)}}function rX(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function nX(e){if(Array.isArray(e))return Lw(e)}function Lw(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t?r.apply(void 0,a):e(t-s,E2(function(){for(var u=arguments.length,d=new Array(u),c=0;ce.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,a=!1,i=void 0;try{for(var s=e[Symbol.iterator](),u;!(n=(u=s.next()).done)&&(r.push(u.value),!(t&&r.length===t));n=!0);}catch(d){a=!0,i=d}finally{try{!n&&s.return!=null&&s.return()}finally{if(a)throw i}}return r}}function yX(e){if(Array.isArray(e))return e}function g$(e){var t=Pu(e,2),r=t[0],n=t[1],a=r,i=n;return r>n&&(a=n,i=r),[a,i]}function v$(e,t,r){if(e.lte(0))return new Ct(0);var n=Ym.getDigitCount(e.toNumber()),a=new Ct(10).pow(n),i=e.div(a),s=n!==1?.05:.1,u=new Ct(Math.ceil(i.div(s).toNumber())).add(r).mul(s),d=u.mul(a);return t?d:new Ct(Math.ceil(d))}function xX(e,t,r){var n=1,a=new Ct(e);if(!a.isint()&&r){var i=Math.abs(e);i<1?(n=new Ct(10).pow(Ym.getDigitCount(e)-1),a=new Ct(Math.floor(a.div(n).toNumber())).mul(n)):i>1&&(a=new Ct(Math.floor(e)))}else e===0?a=new Ct(Math.floor((t-1)/2)):r||(a=new Ct(Math.floor(e)));var s=Math.floor((t-1)/2),u=sX(oX(function(d){return a.add(new Ct(d-s).mul(n)).toNumber()}),$w);return u(0,t)}function y$(e,t,r,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new Ct(0),tickMin:new Ct(0),tickMax:new Ct(0)};var i=v$(new Ct(t).sub(e).div(r-1),n,a),s;e<=0&&t>=0?s=new Ct(0):(s=new Ct(e).add(t).div(2),s=s.sub(new Ct(s).mod(i)));var u=Math.ceil(s.sub(e).div(i).toNumber()),d=Math.ceil(new Ct(t).sub(s).div(i).toNumber()),c=u+d+1;return c>r?y$(e,t,r,n,a+1):(c0?d+(r-c):d,u=t>0?u:u+(r-c)),{step:i,tickMin:s.sub(new Ct(u).mul(i)),tickMax:s.add(new Ct(d).mul(i))})}function bX(e){var t=Pu(e,2),r=t[0],n=t[1],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(a,2),u=g$([r,n]),d=Pu(u,2),c=d[0],f=d[1];if(c===-1/0||f===1/0){var p=f===1/0?[c].concat(Bw($w(0,a-1).map(function(){return 1/0}))):[].concat(Bw($w(0,a-1).map(function(){return-1/0})),[f]);return r>n?Fw(p):p}if(c===f)return xX(c,a,i);var m=y$(c,f,s,i),v=m.step,y=m.tickMin,x=m.tickMax,w=Ym.rangeStep(y,x.add(new Ct(.1).mul(v)),v);return r>n?Fw(w):w}function wX(e,t){var r=Pu(e,2),n=r[0],a=r[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=g$([n,a]),u=Pu(s,2),d=u[0],c=u[1];if(d===-1/0||c===1/0)return[n,a];if(d===c)return[d];var f=Math.max(t,2),p=v$(new Ct(c).sub(d).div(f-1),i,0),m=[].concat(Bw(Ym.rangeStep(new Ct(d),new Ct(c).sub(new Ct(.99).mul(p)),p)),[c]);return n>a?Fw(m):m}var SX=p$(bX),jX=p$(wX),NX="Invariant failed";function Yo(e,t){throw new Error(NX)}var _X=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function wl(e){"@babel/helpers - typeof";return wl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wl(e)}function Dp(){return Dp=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function kX(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function RX(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function IX(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,s=-1,u=(r=n?.length)!==null&&r!==void 0?r:0;if(u<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var d=i.range,c=0;c0?a[c-1].coordinate:a[u-1].coordinate,p=a[c].coordinate,m=c>=u-1?a[0].coordinate:a[c+1].coordinate,v=void 0;if(Kr(p-f)!==Kr(m-p)){var y=[];if(Kr(m-p)===Kr(d[1]-d[0])){v=m;var x=p+d[1]-d[0];y[0]=Math.min(x,(x+f)/2),y[1]=Math.max(x,(x+f)/2)}else{v=f;var w=m+d[1]-d[0];y[0]=Math.min(p,(w+p)/2),y[1]=Math.max(p,(w+p)/2)}var j=[Math.min(p,(v+p)/2),Math.max(p,(v+p)/2)];if(t>j[0]&&t<=j[1]||t>=y[0]&&t<=y[1]){s=a[c].index;break}}else{var N=Math.min(f,m),C=Math.max(f,m);if(t>(N+p)/2&&t<=(C+p)/2){s=a[c].index;break}}}else for(var A=0;A0&&A(n[A].coordinate+n[A-1].coordinate)/2&&t<=(n[A].coordinate+n[A+1].coordinate)/2||A===u-1&&t>(n[A].coordinate+n[A-1].coordinate)/2){s=n[A].index;break}return s},Qj=function(t){var r,n=t,a=n.type.displayName,i=(r=t.type)!==null&&r!==void 0&&r.defaultProps?Qt(Qt({},t.type.defaultProps),t.props):t.props,s=i.stroke,u=i.fill,d;switch(a){case"Line":d=s;break;case"Area":case"Radar":d=s&&s!=="none"?s:u;break;default:d=u;break}return d},JX=function(t){var r=t.barSize,n=t.totalSize,a=t.stackGroups,i=a===void 0?{}:a;if(!i)return{};for(var s={},u=Object.keys(i),d=0,c=u.length;d=0});if(j&&j.length){var N=j[0].type.defaultProps,C=N!==void 0?Qt(Qt({},N),j[0].props):j[0].props,A=C.barSize,E=C[w];s[E]||(s[E]=[]);var O=rt(A)?r:A;s[E].push({item:j[0],stackList:j.slice(1),barSize:rt(O)?void 0:Yr(O,n,0)})}}return s},QX=function(t){var r=t.barGap,n=t.barCategoryGap,a=t.bandSize,i=t.sizeList,s=i===void 0?[]:i,u=t.maxBarSize,d=s.length;if(d<1)return null;var c=Yr(r,a,0,!0),f,p=[];if(s[0].barSize===+s[0].barSize){var m=!1,v=a/d,y=s.reduce(function(A,E){return A+E.barSize||0},0);y+=(d-1)*c,y>=a&&(y-=(d-1)*c,c=0),y>=a&&v>0&&(m=!0,v*=.9,y=d*v);var x=(a-y)/2>>0,w={offset:x-c,size:0};f=s.reduce(function(A,E){var O={item:E.item,position:{offset:w.offset+w.size+c,size:m?v:E.barSize}},T=[].concat(A2(A),[O]);return w=T[T.length-1].position,E.stackList&&E.stackList.length&&E.stackList.forEach(function(k){T.push({item:k,position:w})}),T},p)}else{var j=Yr(n,a,0,!0);a-2*j-(d-1)*c<=0&&(c=0);var N=(a-2*j-(d-1)*c)/d;N>1&&(N>>=0);var C=u===+u?Math.min(N,u):N;f=s.reduce(function(A,E,O){var T=[].concat(A2(A),[{item:E.item,position:{offset:j+(N+c)*O+(N-C)/2,size:C}}]);return E.stackList&&E.stackList.length&&E.stackList.forEach(function(k){T.push({item:k,position:T[T.length-1].position})}),T},p)}return f},ZX=function(t,r,n,a){var i=n.children,s=n.width,u=n.margin,d=s-(u.left||0)-(u.right||0),c=S$({children:i,legendWidth:d});if(c){var f=a||{},p=f.width,m=f.height,v=c.align,y=c.verticalAlign,x=c.layout;if((x==="vertical"||x==="horizontal"&&y==="middle")&&v!=="center"&&_e(t[v]))return Qt(Qt({},t),{},il({},v,t[v]+(p||0)));if((x==="horizontal"||x==="vertical"&&v==="center")&&y!=="middle"&&_e(t[y]))return Qt(Qt({},t),{},il({},y,t[y]+(m||0)))}return t},eJ=function(t,r,n){return rt(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},j$=function(t,r,n,a,i){var s=r.props.children,u=On(s,fd).filter(function(c){return eJ(a,i,c.props.direction)});if(u&&u.length){var d=u.map(function(c){return c.props.dataKey});return t.reduce(function(c,f){var p=pr(f,n);if(rt(p))return c;var m=Array.isArray(p)?[Gm(p),Wm(p)]:[p,p],v=d.reduce(function(y,x){var w=pr(f,x,0),j=m[0]-Math.abs(Array.isArray(w)?w[0]:w),N=m[1]+Math.abs(Array.isArray(w)?w[1]:w);return[Math.min(j,y[0]),Math.max(N,y[1])]},[1/0,-1/0]);return[Math.min(v[0],c[0]),Math.max(v[1],c[1])]},[1/0,-1/0])}return null},tJ=function(t,r,n,a,i){var s=r.map(function(u){return j$(t,u,n,i,a)}).filter(function(u){return!rt(u)});return s&&s.length?s.reduce(function(u,d){return[Math.min(u[0],d[0]),Math.max(u[1],d[1])]},[1/0,-1/0]):null},N$=function(t,r,n,a,i){var s=r.map(function(d){var c=d.props.dataKey;return n==="number"&&c&&j$(t,d,c,a)||cu(t,c,n,i)});if(n==="number")return s.reduce(function(d,c){return[Math.min(d[0],c[0]),Math.max(d[1],c[1])]},[1/0,-1/0]);var u={};return s.reduce(function(d,c){for(var f=0,p=c.length;f=2?Kr(u[0]-u[1])*2*c:c,r&&(t.ticks||t.niceTicks)){var f=(t.ticks||t.niceTicks).map(function(p){var m=i?i.indexOf(p):p;return{coordinate:a(m)+c,value:p,offset:c}});return f.filter(function(p){return!id(p.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(p,m){return{coordinate:a(p)+c,value:p,index:m,offset:c}}):a.ticks&&!n?a.ticks(t.tickCount).map(function(p){return{coordinate:a(p)+c,value:p,offset:c}}):a.domain().map(function(p,m){return{coordinate:a(p)+c,value:i?i[p]:p,index:m,offset:c}})},a1=new WeakMap,rh=function(t,r){if(typeof r!="function")return t;a1.has(t)||a1.set(t,new WeakMap);var n=a1.get(t);if(n.has(r))return n.get(r);var a=function(){t.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,a),a},E$=function(t,r,n){var a=t.scale,i=t.type,s=t.layout,u=t.axisType;if(a==="auto")return s==="radial"&&u==="radiusAxis"?{scale:ju(),realScaleType:"band"}:s==="radial"&&u==="angleAxis"?{scale:Tp(),realScaleType:"linear"}:i==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:lu(),realScaleType:"point"}:i==="category"?{scale:ju(),realScaleType:"band"}:{scale:Tp(),realScaleType:"linear"};if(Ho(a)){var d="scale".concat(Tm(a));return{scale:(g2[d]||lu)(),realScaleType:g2[d]?d:"point"}}return Qe(a)?{scale:a}:{scale:lu(),realScaleType:"point"}},k2=1e-4,O$=function(t){var r=t.domain();if(!(!r||r.length<=2)){var n=r.length,a=t.range(),i=Math.min(a[0],a[1])-k2,s=Math.max(a[0],a[1])+k2,u=t(r[0]),d=t(r[n-1]);(us||ds)&&t.domain([r[0],r[n-1]])}},rJ=function(t,r){if(!t)return null;for(var n=0,a=t.length;na)&&(i[1]=a),i[0]>a&&(i[0]=a),i[1]=0?(t[u][n][0]=i,t[u][n][1]=i+d,i=t[u][n][1]):(t[u][n][0]=s,t[u][n][1]=s+d,s=t[u][n][1])}},iJ=function(t){var r=t.length;if(!(r<=0))for(var n=0,a=t[0].length;n=0?(t[s][n][0]=i,t[s][n][1]=i+u,i=t[s][n][1]):(t[s][n][0]=0,t[s][n][1]=0)}},oJ={sign:aJ,expand:G7,none:hl,silhouette:K7,wiggle:Y7,positive:iJ},sJ=function(t,r,n){var a=r.map(function(u){return u.props.dataKey}),i=oJ[n],s=W7().keys(a).value(function(u,d){return+pr(u,d,0)}).order(xw).offset(i);return s(t)},lJ=function(t,r,n,a,i,s){if(!t)return null;var u=s?r.reverse():r,d={},c=u.reduce(function(p,m){var v,y=(v=m.type)!==null&&v!==void 0&&v.defaultProps?Qt(Qt({},m.type.defaultProps),m.props):m.props,x=y.stackId,w=y.hide;if(w)return p;var j=y[n],N=p[j]||{hasStack:!1,stackGroups:{}};if(mr(x)){var C=N.stackGroups[x]||{numericAxisId:n,cateAxisId:a,items:[]};C.items.push(m),N.hasStack=!0,N.stackGroups[x]=C}else N.stackGroups[Gl("_stackId_")]={numericAxisId:n,cateAxisId:a,items:[m]};return Qt(Qt({},p),{},il({},j,N))},d),f={};return Object.keys(c).reduce(function(p,m){var v=c[m];if(v.hasStack){var y={};v.stackGroups=Object.keys(v.stackGroups).reduce(function(x,w){var j=v.stackGroups[w];return Qt(Qt({},x),{},il({},w,{numericAxisId:n,cateAxisId:a,items:j.items,stackedData:sJ(t,j.items,i)}))},y)}return Qt(Qt({},p),{},il({},m,v))},f)},P$=function(t,r){var n=r.realScaleType,a=r.type,i=r.tickCount,s=r.originalDomain,u=r.allowDecimals,d=n||r.scale;if(d!=="auto"&&d!=="linear")return null;if(i&&a==="number"&&s&&(s[0]==="auto"||s[1]==="auto")){var c=t.domain();if(!c.length)return null;var f=SX(c,i,u);return t.domain([Gm(f),Wm(f)]),{niceTicks:f}}if(i&&a==="number"){var p=t.domain(),m=jX(p,i,u);return{niceTicks:m}}return null};function R2(e){var t=e.axis,r=e.ticks,n=e.bandSize,a=e.entry,i=e.index,s=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!rt(a[t.dataKey])){var u=dp(r,"value",a[t.dataKey]);if(u)return u.coordinate+n/2}return r[i]?r[i].coordinate+n/2:null}var d=pr(a,rt(s)?t.dataKey:s);return rt(d)?null:t.scale(d)}var I2=function(t){var r=t.axis,n=t.ticks,a=t.offset,i=t.bandSize,s=t.entry,u=t.index;if(r.type==="category")return n[u]?n[u].coordinate+a:null;var d=pr(s,r.dataKey,r.domain[u]);return rt(d)?null:r.scale(d)-i/2+a},cJ=function(t){var r=t.numericAxis,n=r.scale.domain();if(r.type==="number"){var a=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return a<=0&&i>=0?0:i<0?i:a}return n[0]},uJ=function(t,r){var n,a=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Qt(Qt({},t.type.defaultProps),t.props):t.props,i=a.stackId;if(mr(i)){var s=r[i];if(s){var u=s.items.indexOf(t);return u>=0?s.stackedData[u]:null}}return null},dJ=function(t){return t.reduce(function(r,n){return[Gm(n.concat([r[0]]).filter(_e)),Wm(n.concat([r[1]]).filter(_e))]},[1/0,-1/0])},A$=function(t,r,n){return Object.keys(t).reduce(function(a,i){var s=t[i],u=s.stackedData,d=u.reduce(function(c,f){var p=dJ(f.slice(r,n+1));return[Math.min(c[0],p[0]),Math.max(c[1],p[1])]},[1/0,-1/0]);return[Math.min(d[0],a[0]),Math.max(d[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},M2=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,D2=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Vw=function(t,r,n){if(Qe(t))return t(r,n);if(!Array.isArray(t))return r;var a=[];if(_e(t[0]))a[0]=n?t[0]:Math.min(t[0],r[0]);else if(M2.test(t[0])){var i=+M2.exec(t[0])[1];a[0]=r[0]-i}else Qe(t[0])?a[0]=t[0](r[0]):a[0]=r[0];if(_e(t[1]))a[1]=n?t[1]:Math.max(t[1],r[1]);else if(D2.test(t[1])){var s=+D2.exec(t[1])[1];a[1]=r[1]+s}else Qe(t[1])?a[1]=t[1](r[1]):a[1]=r[1];return a},$p=function(t,r,n){if(t&&t.scale&&t.scale.bandwidth){var a=t.scale.bandwidth();if(!n||a>0)return a}if(t&&r&&r.length>=2){for(var i=Cj(r,function(p){return p.coordinate}),s=1/0,u=1,d=i.length;ue.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},bJ=function(t,r,n,a,i){var s=t.width,u=t.height,d=t.startAngle,c=t.endAngle,f=Yr(t.cx,s,s/2),p=Yr(t.cy,u,u/2),m=R$(s,u,n),v=Yr(t.innerRadius,m,0),y=Yr(t.outerRadius,m,m*.8),x=Object.keys(r);return x.reduce(function(w,j){var N=r[j],C=N.domain,A=N.reversed,E;if(rt(N.range))a==="angleAxis"?E=[d,c]:a==="radiusAxis"&&(E=[v,y]),A&&(E=[E[1],E[0]]);else{E=N.range;var O=E,T=pJ(O,2);d=T[0],c=T[1]}var k=E$(N,i),M=k.realScaleType,L=k.scale;L.domain(C).range(E),O$(L);var $=P$(L,si(si({},N),{},{realScaleType:M})),I=si(si(si({},N),$),{},{range:E,radius:y,realScaleType:M,scale:L,cx:f,cy:p,innerRadius:v,outerRadius:y,startAngle:d,endAngle:c});return si(si({},w),{},k$({},j,I))},{})},wJ=function(t,r){var n=t.x,a=t.y,i=r.x,s=r.y;return Math.sqrt(Math.pow(n-i,2)+Math.pow(a-s,2))},SJ=function(t,r){var n=t.x,a=t.y,i=r.cx,s=r.cy,u=wJ({x:n,y:a},{x:i,y:s});if(u<=0)return{radius:u};var d=(n-i)/u,c=Math.acos(d);return a>s&&(c=2*Math.PI-c),{radius:u,angle:xJ(c),angleInRadian:c}},jJ=function(t){var r=t.startAngle,n=t.endAngle,a=Math.floor(r/360),i=Math.floor(n/360),s=Math.min(a,i);return{startAngle:r-s*360,endAngle:n-s*360}},NJ=function(t,r){var n=r.startAngle,a=r.endAngle,i=Math.floor(n/360),s=Math.floor(a/360),u=Math.min(i,s);return t+u*360},B2=function(t,r){var n=t.x,a=t.y,i=SJ({x:n,y:a},r),s=i.radius,u=i.angle,d=r.innerRadius,c=r.outerRadius;if(sc)return!1;if(s===0)return!0;var f=jJ(r),p=f.startAngle,m=f.endAngle,v=u,y;if(p<=m){for(;v>m;)v-=360;for(;v=p&&v<=m}else{for(;v>p;)v-=360;for(;v=m&&v<=p}return y?si(si({},r),{},{radius:s,angle:NJ(v,r)}):null},I$=function(t){return!b.isValidElement(t)&&!Qe(t)&&typeof t!="boolean"?t.className:""};function Ru(e){"@babel/helpers - typeof";return Ru=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ru(e)}var _J=["offset"];function CJ(e){return AJ(e)||PJ(e)||OJ(e)||EJ()}function EJ(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function OJ(e,t){if(e){if(typeof e=="string")return Hw(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Hw(e,t)}}function PJ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function AJ(e){if(Array.isArray(e))return Hw(e)}function Hw(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function kJ(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function z2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function hr(e){for(var t=1;t=0?1:-1,C,A;a==="insideStart"?(C=v+N*s,A=x):a==="insideEnd"?(C=y-N*s,A=!x):a==="end"&&(C=y+N*s,A=x),A=j<=0?A:!A;var E=Dt(c,f,w,C),O=Dt(c,f,w,C+(A?1:-1)*359),T="M".concat(E.x,",").concat(E.y,` + A`).concat(w,",").concat(w,",0,1,").concat(A?0:1,`, + `).concat(O.x,",").concat(O.y),k=rt(t.id)?Gl("recharts-radial-line-"):t.id;return q.createElement("text",Iu({},n,{dominantBaseline:"central",className:nt("recharts-radial-bar-label",u)}),q.createElement("defs",null,q.createElement("path",{id:k,d:T})),q.createElement("textPath",{xlinkHref:"#".concat(k)},r))},FJ=function(t){var r=t.viewBox,n=t.offset,a=t.position,i=r,s=i.cx,u=i.cy,d=i.innerRadius,c=i.outerRadius,f=i.startAngle,p=i.endAngle,m=(f+p)/2;if(a==="outside"){var v=Dt(s,u,c+n,m),y=v.x,x=v.y;return{x:y,y:x,textAnchor:y>=s?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:s,y:u,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:s,y:u,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:s,y:u,textAnchor:"middle",verticalAnchor:"end"};var w=(d+c)/2,j=Dt(s,u,w,m),N=j.x,C=j.y;return{x:N,y:C,textAnchor:"middle",verticalAnchor:"middle"}},BJ=function(t){var r=t.viewBox,n=t.parentViewBox,a=t.offset,i=t.position,s=r,u=s.x,d=s.y,c=s.width,f=s.height,p=f>=0?1:-1,m=p*a,v=p>0?"end":"start",y=p>0?"start":"end",x=c>=0?1:-1,w=x*a,j=x>0?"end":"start",N=x>0?"start":"end";if(i==="top"){var C={x:u+c/2,y:d-p*a,textAnchor:"middle",verticalAnchor:v};return hr(hr({},C),n?{height:Math.max(d-n.y,0),width:c}:{})}if(i==="bottom"){var A={x:u+c/2,y:d+f+m,textAnchor:"middle",verticalAnchor:y};return hr(hr({},A),n?{height:Math.max(n.y+n.height-(d+f),0),width:c}:{})}if(i==="left"){var E={x:u-w,y:d+f/2,textAnchor:j,verticalAnchor:"middle"};return hr(hr({},E),n?{width:Math.max(E.x-n.x,0),height:f}:{})}if(i==="right"){var O={x:u+c+w,y:d+f/2,textAnchor:N,verticalAnchor:"middle"};return hr(hr({},O),n?{width:Math.max(n.x+n.width-O.x,0),height:f}:{})}var T=n?{width:c,height:f}:{};return i==="insideLeft"?hr({x:u+w,y:d+f/2,textAnchor:N,verticalAnchor:"middle"},T):i==="insideRight"?hr({x:u+c-w,y:d+f/2,textAnchor:j,verticalAnchor:"middle"},T):i==="insideTop"?hr({x:u+c/2,y:d+m,textAnchor:"middle",verticalAnchor:y},T):i==="insideBottom"?hr({x:u+c/2,y:d+f-m,textAnchor:"middle",verticalAnchor:v},T):i==="insideTopLeft"?hr({x:u+w,y:d+m,textAnchor:N,verticalAnchor:y},T):i==="insideTopRight"?hr({x:u+c-w,y:d+m,textAnchor:j,verticalAnchor:y},T):i==="insideBottomLeft"?hr({x:u+w,y:d+f-m,textAnchor:N,verticalAnchor:v},T):i==="insideBottomRight"?hr({x:u+c-w,y:d+f-m,textAnchor:j,verticalAnchor:v},T):Wl(i)&&(_e(i.x)||Fo(i.x))&&(_e(i.y)||Fo(i.y))?hr({x:u+Yr(i.x,c),y:d+Yr(i.y,f),textAnchor:"end",verticalAnchor:"end"},T):hr({x:u+c/2,y:d+f/2,textAnchor:"middle",verticalAnchor:"middle"},T)},zJ=function(t){return"cx"in t&&_e(t.cx)};function jr(e){var t=e.offset,r=t===void 0?5:t,n=TJ(e,_J),a=hr({offset:r},n),i=a.viewBox,s=a.position,u=a.value,d=a.children,c=a.content,f=a.className,p=f===void 0?"":f,m=a.textBreakAll;if(!i||rt(u)&&rt(d)&&!b.isValidElement(c)&&!Qe(c))return null;if(b.isValidElement(c))return b.cloneElement(c,a);var v;if(Qe(c)){if(v=b.createElement(c,a),b.isValidElement(v))return v}else v=DJ(a);var y=zJ(i),x=Ke(a,!0);if(y&&(s==="insideStart"||s==="insideEnd"||s==="end"))return $J(a,v,x);var w=y?FJ(a):BJ(a);return q.createElement(Go,Iu({className:nt("recharts-label",p)},x,w,{breakAll:m}),v)}jr.displayName="Label";var M$=function(t){var r=t.cx,n=t.cy,a=t.angle,i=t.startAngle,s=t.endAngle,u=t.r,d=t.radius,c=t.innerRadius,f=t.outerRadius,p=t.x,m=t.y,v=t.top,y=t.left,x=t.width,w=t.height,j=t.clockWise,N=t.labelViewBox;if(N)return N;if(_e(x)&&_e(w)){if(_e(p)&&_e(m))return{x:p,y:m,width:x,height:w};if(_e(v)&&_e(y))return{x:v,y,width:x,height:w}}return _e(p)&&_e(m)?{x:p,y:m,width:0,height:0}:_e(r)&&_e(n)?{cx:r,cy:n,startAngle:i||a||0,endAngle:s||a||0,innerRadius:c||0,outerRadius:f||d||u||0,clockWise:j}:t.viewBox?t.viewBox:{}},qJ=function(t,r){return t?t===!0?q.createElement(jr,{key:"label-implicit",viewBox:r}):mr(t)?q.createElement(jr,{key:"label-implicit",viewBox:r,value:t}):b.isValidElement(t)?t.type===jr?b.cloneElement(t,{key:"label-implicit",viewBox:r}):q.createElement(jr,{key:"label-implicit",content:t,viewBox:r}):Qe(t)?q.createElement(jr,{key:"label-implicit",content:t,viewBox:r}):Wl(t)?q.createElement(jr,Iu({viewBox:r},t,{key:"label-implicit"})):null:null},UJ=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var a=t.children,i=M$(t),s=On(a,jr).map(function(d,c){return b.cloneElement(d,{viewBox:r||i,key:"label-".concat(c)})});if(!n)return s;var u=qJ(t.label,r||i);return[u].concat(CJ(s))};jr.parseViewBox=M$;jr.renderCallByParent=UJ;var i1,q2;function VJ(){if(q2)return i1;q2=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return i1=e,i1}var HJ=VJ();const WJ=mt(HJ);function Mu(e){"@babel/helpers - typeof";return Mu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mu(e)}var GJ=["valueAccessor"],KJ=["data","dataKey","clockWise","id","textBreakAll"];function YJ(e){return ZJ(e)||QJ(e)||JJ(e)||XJ()}function XJ(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function JJ(e,t){if(e){if(typeof e=="string")return Ww(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ww(e,t)}}function QJ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ZJ(e){if(Array.isArray(e))return Ww(e)}function Ww(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function nQ(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var aQ=function(t){return Array.isArray(t.value)?WJ(t.value):t.value};function hi(e){var t=e.valueAccessor,r=t===void 0?aQ:t,n=H2(e,GJ),a=n.data,i=n.dataKey,s=n.clockWise,u=n.id,d=n.textBreakAll,c=H2(n,KJ);return!a||!a.length?null:q.createElement(ht,{className:"recharts-label-list"},a.map(function(f,p){var m=rt(i)?r(f,p):pr(f&&f.payload,i),v=rt(u)?{}:{id:"".concat(u,"-").concat(p)};return q.createElement(jr,Bp({},Ke(f,!0),c,v,{parentViewBox:f.parentViewBox,value:m,textBreakAll:d,viewBox:jr.parseViewBox(rt(s)?f:V2(V2({},f),{},{clockWise:s})),key:"label-".concat(p),index:p}))}))}hi.displayName="LabelList";function iQ(e,t){return e?e===!0?q.createElement(hi,{key:"labelList-implicit",data:t}):q.isValidElement(e)||Qe(e)?q.createElement(hi,{key:"labelList-implicit",data:t,content:e}):Wl(e)?q.createElement(hi,Bp({data:t},e,{key:"labelList-implicit"})):null:null}function oQ(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,a=On(n,hi).map(function(s,u){return b.cloneElement(s,{data:t,key:"labelList-".concat(u)})});if(!r)return a;var i=iQ(e.label,t);return[i].concat(YJ(a))}hi.renderCallByParent=oQ;function Du(e){"@babel/helpers - typeof";return Du=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Du(e)}function Gw(){return Gw=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(s>c),`, + `).concat(p.x,",").concat(p.y,` + `);if(a>0){var v=Dt(r,n,a,s),y=Dt(r,n,a,c);m+="L ".concat(y.x,",").concat(y.y,` + A `).concat(a,",").concat(a,`,0, + `).concat(+(Math.abs(d)>180),",").concat(+(s<=c),`, + `).concat(v.x,",").concat(v.y," Z")}else m+="L ".concat(r,",").concat(n," Z");return m},dQ=function(t){var r=t.cx,n=t.cy,a=t.innerRadius,i=t.outerRadius,s=t.cornerRadius,u=t.forceCornerRadius,d=t.cornerIsExternal,c=t.startAngle,f=t.endAngle,p=Kr(f-c),m=nh({cx:r,cy:n,radius:i,angle:c,sign:p,cornerRadius:s,cornerIsExternal:d}),v=m.circleTangency,y=m.lineTangency,x=m.theta,w=nh({cx:r,cy:n,radius:i,angle:f,sign:-p,cornerRadius:s,cornerIsExternal:d}),j=w.circleTangency,N=w.lineTangency,C=w.theta,A=d?Math.abs(c-f):Math.abs(c-f)-x-C;if(A<0)return u?"M ".concat(y.x,",").concat(y.y,` + a`).concat(s,",").concat(s,",0,0,1,").concat(s*2,`,0 + a`).concat(s,",").concat(s,",0,0,1,").concat(-s*2,`,0 + `):D$({cx:r,cy:n,innerRadius:a,outerRadius:i,startAngle:c,endAngle:f});var E="M ".concat(y.x,",").concat(y.y,` + A`).concat(s,",").concat(s,",0,0,").concat(+(p<0),",").concat(v.x,",").concat(v.y,` + A`).concat(i,",").concat(i,",0,").concat(+(A>180),",").concat(+(p<0),",").concat(j.x,",").concat(j.y,` + A`).concat(s,",").concat(s,",0,0,").concat(+(p<0),",").concat(N.x,",").concat(N.y,` + `);if(a>0){var O=nh({cx:r,cy:n,radius:a,angle:c,sign:p,isExternal:!0,cornerRadius:s,cornerIsExternal:d}),T=O.circleTangency,k=O.lineTangency,M=O.theta,L=nh({cx:r,cy:n,radius:a,angle:f,sign:-p,isExternal:!0,cornerRadius:s,cornerIsExternal:d}),$=L.circleTangency,I=L.lineTangency,H=L.theta,Y=d?Math.abs(c-f):Math.abs(c-f)-M-H;if(Y<0&&s===0)return"".concat(E,"L").concat(r,",").concat(n,"Z");E+="L".concat(I.x,",").concat(I.y,` + A`).concat(s,",").concat(s,",0,0,").concat(+(p<0),",").concat($.x,",").concat($.y,` + A`).concat(a,",").concat(a,",0,").concat(+(Y>180),",").concat(+(p>0),",").concat(T.x,",").concat(T.y,` + A`).concat(s,",").concat(s,",0,0,").concat(+(p<0),",").concat(k.x,",").concat(k.y,"Z")}else E+="L".concat(r,",").concat(n,"Z");return E},fQ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},L$=function(t){var r=G2(G2({},fQ),t),n=r.cx,a=r.cy,i=r.innerRadius,s=r.outerRadius,u=r.cornerRadius,d=r.forceCornerRadius,c=r.cornerIsExternal,f=r.startAngle,p=r.endAngle,m=r.className;if(s0&&Math.abs(f-p)<360?w=dQ({cx:n,cy:a,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,y/2),forceCornerRadius:d,cornerIsExternal:c,startAngle:f,endAngle:p}):w=D$({cx:n,cy:a,innerRadius:i,outerRadius:s,startAngle:f,endAngle:p}),q.createElement("path",Gw({},Ke(r,!0),{className:v,d:w,role:"img"}))};function Lu(e){"@babel/helpers - typeof";return Lu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lu(e)}function Kw(){return Kw=Object.assign?Object.assign.bind():function(e){for(var t=1;tNQ.call(e,t));function us(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const EQ="__v",OQ="__o",PQ="_owner",{getOwnPropertyDescriptor:tk,keys:rk}=Object;function AQ(e,t){return e.byteLength===t.byteLength&&qp(new Uint8Array(e),new Uint8Array(t))}function TQ(e,t,r){let n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function kQ(e,t){return e.byteLength===t.byteLength&&qp(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function RQ(e,t){return us(e.getTime(),t.getTime())}function IQ(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function MQ(e,t){return e===t}function nk(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const a=new Array(n),i=e.entries();let s,u,d=0;for(;(s=i.next())&&!s.done;){const c=t.entries();let f=!1,p=0;for(;(u=c.next())&&!u.done;){if(a[p]){p++;continue}const m=s.value,v=u.value;if(r.equals(m[0],v[0],d,p,e,t,r)&&r.equals(m[1],v[1],m[0],v[0],e,t,r)){f=a[p]=!0;break}p++}if(!f)return!1;d++}return!0}const DQ=us;function LQ(e,t,r){const n=rk(e);let a=n.length;if(rk(t).length!==a)return!1;for(;a-- >0;)if(!$$(e,t,r,n[a]))return!1;return!0}function Kc(e,t,r){const n=ek(e);let a=n.length;if(ek(t).length!==a)return!1;let i,s,u;for(;a-- >0;)if(i=n[a],!$$(e,t,r,i)||(s=tk(e,i),u=tk(t,i),(s||u)&&(!s||!u||s.configurable!==u.configurable||s.enumerable!==u.enumerable||s.writable!==u.writable)))return!1;return!0}function $Q(e,t){return us(e.valueOf(),t.valueOf())}function FQ(e,t){return e.source===t.source&&e.flags===t.flags}function ak(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const a=new Array(n),i=e.values();let s,u;for(;(s=i.next())&&!s.done;){const d=t.values();let c=!1,f=0;for(;(u=d.next())&&!u.done;){if(!a[f]&&r.equals(s.value,u.value,s.value,u.value,e,t,r)){c=a[f]=!0;break}f++}if(!c)return!1}return!0}function qp(e,t){let r=e.byteLength;if(t.byteLength!==r||e.byteOffset!==t.byteOffset)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function BQ(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function $$(e,t,r,n){return(n===PQ||n===OQ||n===EQ)&&(e.$$typeof||t.$$typeof)?!0:CQ(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}const zQ="[object ArrayBuffer]",qQ="[object Arguments]",UQ="[object Boolean]",VQ="[object DataView]",HQ="[object Date]",WQ="[object Error]",GQ="[object Map]",KQ="[object Number]",YQ="[object Object]",XQ="[object RegExp]",JQ="[object Set]",QQ="[object String]",ZQ={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},eZ="[object URL]",tZ=Object.prototype.toString;function rZ({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:s,areNumbersEqual:u,areObjectsEqual:d,arePrimitiveWrappersEqual:c,areRegExpsEqual:f,areSetsEqual:p,areTypedArraysEqual:m,areUrlsEqual:v,unknownTagComparators:y}){return function(w,j,N){if(w===j)return!0;if(w==null||j==null)return!1;const C=typeof w;if(C!==typeof j)return!1;if(C!=="object")return C==="number"?u(w,j,N):C==="function"?i(w,j,N):!1;const A=w.constructor;if(A!==j.constructor)return!1;if(A===Object)return d(w,j,N);if(Array.isArray(w))return t(w,j,N);if(A===Date)return n(w,j,N);if(A===RegExp)return f(w,j,N);if(A===Map)return s(w,j,N);if(A===Set)return p(w,j,N);const E=tZ.call(w);if(E===HQ)return n(w,j,N);if(E===XQ)return f(w,j,N);if(E===GQ)return s(w,j,N);if(E===JQ)return p(w,j,N);if(E===YQ)return typeof w.then!="function"&&typeof j.then!="function"&&d(w,j,N);if(E===eZ)return v(w,j,N);if(E===WQ)return a(w,j,N);if(E===qQ)return d(w,j,N);if(ZQ[E])return m(w,j,N);if(E===zQ)return e(w,j,N);if(E===VQ)return r(w,j,N);if(E===UQ||E===KQ||E===QQ)return c(w,j,N);if(y){let O=y[E];if(!O){const T=_Q(w);T&&(O=y[T])}if(O)return O(w,j,N)}return!1}}function nZ({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:AQ,areArraysEqual:r?Kc:TQ,areDataViewsEqual:kQ,areDatesEqual:RQ,areErrorsEqual:IQ,areFunctionsEqual:MQ,areMapsEqual:r?c1(nk,Kc):nk,areNumbersEqual:DQ,areObjectsEqual:r?Kc:LQ,arePrimitiveWrappersEqual:$Q,areRegExpsEqual:FQ,areSetsEqual:r?c1(ak,Kc):ak,areTypedArraysEqual:r?c1(qp,Kc):qp,areUrlsEqual:BQ,unknownTagComparators:void 0};if(t&&(n=Object.assign({},n,t(n))),e){const a=ih(n.areArraysEqual),i=ih(n.areMapsEqual),s=ih(n.areObjectsEqual),u=ih(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:s,areSetsEqual:u})}return n}function aZ(e){return function(t,r,n,a,i,s,u){return e(t,r,u)}}function iZ({circular:e,comparator:t,createState:r,equals:n,strict:a}){if(r)return function(u,d){const{cache:c=e?new WeakMap:void 0,meta:f}=r();return t(u,d,{cache:c,equals:n,meta:f,strict:a})};if(e)return function(u,d){return t(u,d,{cache:new WeakMap,equals:n,meta:void 0,strict:a})};const i={cache:void 0,equals:n,meta:void 0,strict:a};return function(u,d){return t(u,d,i)}}const oZ=ho();ho({strict:!0});ho({circular:!0});ho({circular:!0,strict:!0});ho({createInternalComparator:()=>us});ho({strict:!0,createInternalComparator:()=>us});ho({circular:!0,createInternalComparator:()=>us});ho({circular:!0,createInternalComparator:()=>us,strict:!0});function ho(e={}){const{circular:t=!1,createInternalComparator:r,createState:n,strict:a=!1}=e,i=nZ(e),s=rZ(i),u=r?r(s):aZ(s);return iZ({circular:t,comparator:s,createState:n,equals:u,strict:a})}function sZ(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function ik(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function a(i){r<0&&(r=i),i-r>t?(e(i),r=-1):sZ(a)};requestAnimationFrame(n)}function Yw(e){"@babel/helpers - typeof";return Yw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yw(e)}function lZ(e){return fZ(e)||dZ(e)||uZ(e)||cZ()}function cZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uZ(e,t){if(e){if(typeof e=="string")return ok(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ok(e,t)}}function ok(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?1:j<0?0:j},x=function(j){for(var N=j>1?1:j,C=N,A=0;A<8;++A){var E=p(C)-N,O=v(C);if(Math.abs(E-N)0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,a=t.damping,i=a===void 0?8:a,s=t.dt,u=s===void 0?17:s,d=function(f,p,m){var v=-(f-p)*n,y=m*i,x=m+(v-y)*u/1e3,w=m*u/1e3+f;return Math.abs(w-p)e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function UZ(e,t){if(e==null)return{};var r={},n=Object.keys(e),a,i;for(i=0;i=0)&&(r[a]=e[a]);return r}function u1(e){return GZ(e)||WZ(e)||HZ(e)||VZ()}function VZ(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function HZ(e,t){if(e){if(typeof e=="string")return eS(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eS(e,t)}}function WZ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function GZ(e){if(Array.isArray(e))return eS(e)}function eS(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Hp(e){return Hp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Hp(e)}var za=(function(e){QZ(r,e);var t=ZZ(r);function r(n,a){var i;KZ(this,r),i=t.call(this,n,a);var s=i.props,u=s.isActive,d=s.attributeName,c=s.from,f=s.to,p=s.steps,m=s.children,v=s.duration;if(i.handleStyleChange=i.handleStyleChange.bind(nS(i)),i.changeStyle=i.changeStyle.bind(nS(i)),!u||v<=0)return i.state={style:{}},typeof m=="function"&&(i.state={style:f}),rS(i);if(p&&p.length)i.state={style:p[0].style};else if(c){if(typeof m=="function")return i.state={style:c},rS(i);i.state={style:d?iu({},d,c):c}}else i.state={style:{}};return i}return XZ(r,[{key:"componentDidMount",value:function(){var a=this.props,i=a.isActive,s=a.canBegin;this.mounted=!0,!(!i||!s)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(a){var i=this.props,s=i.isActive,u=i.canBegin,d=i.attributeName,c=i.shouldReAnimate,f=i.to,p=i.from,m=this.state.style;if(u){if(!s){var v={style:d?iu({},d,f):f};this.state&&m&&(d&&m[d]!==f||!d&&m!==f)&&this.setState(v);return}if(!(oZ(a.to,f)&&a.canBegin&&a.isActive)){var y=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var x=y||c?p:a.to;if(this.state&&m){var w={style:d?iu({},d,x):x};(d&&m[d]!==x||!d&&m!==x)&&this.setState(w)}this.runAnimation(ia(ia({},this.props),{},{from:x,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var a=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),a&&a()}},{key:"handleStyleChange",value:function(a){this.changeStyle(a)}},{key:"changeStyle",value:function(a){this.mounted&&this.setState({style:a})}},{key:"runJSAnimation",value:function(a){var i=this,s=a.from,u=a.to,d=a.duration,c=a.easing,f=a.begin,p=a.onAnimationEnd,m=a.onAnimationStart,v=BZ(s,u,PZ(c),d,this.changeStyle),y=function(){i.stopJSAnimation=v()};this.manager.start([m,f,y,d,p])}},{key:"runStepAnimation",value:function(a){var i=this,s=a.steps,u=a.begin,d=a.onAnimationStart,c=s[0],f=c.style,p=c.duration,m=p===void 0?0:p,v=function(x,w,j){if(j===0)return x;var N=w.duration,C=w.easing,A=C===void 0?"ease":C,E=w.style,O=w.properties,T=w.onAnimationEnd,k=j>0?s[j-1]:w,M=O||Object.keys(E);if(typeof A=="function"||A==="spring")return[].concat(u1(x),[i.runJSAnimation.bind(i,{from:k.style,to:E,duration:N,easing:A}),N]);var L=ck(M,N,A),$=ia(ia(ia({},k.style),E),{},{transition:L});return[].concat(u1(x),[$,N,T]).filter(vZ)};return this.manager.start([d].concat(u1(s.reduce(v,[f,Math.max(m,u)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=hZ());var i=a.begin,s=a.duration,u=a.attributeName,d=a.to,c=a.easing,f=a.onAnimationStart,p=a.onAnimationEnd,m=a.steps,v=a.children,y=this.manager;if(this.unSubscribe=y.subscribe(this.handleStyleChange),typeof c=="function"||typeof v=="function"||c==="spring"){this.runJSAnimation(a);return}if(m.length>1){this.runStepAnimation(a);return}var x=u?iu({},u,d):d,w=ck(Object.keys(x),s,c);y.start([f,i,ia(ia({},x),{},{transition:w}),s,p])}},{key:"render",value:function(){var a=this.props,i=a.children;a.begin;var s=a.duration;a.attributeName,a.easing;var u=a.isActive;a.steps,a.from,a.to,a.canBegin,a.onAnimationEnd,a.shouldReAnimate,a.onAnimationReStart;var d=qZ(a,zZ),c=b.Children.count(i),f=this.state.style;if(typeof i=="function")return i(f);if(!u||c===0||s<=0)return i;var p=function(v){var y=v.props,x=y.style,w=x===void 0?{}:x,j=y.className,N=b.cloneElement(v,ia(ia({},d),{},{style:ia(ia({},w),f),className:j}));return N};return c===1?p(b.Children.only(i)):q.createElement("div",null,b.Children.map(i,function(m){return p(m)}))}}]),r})(b.PureComponent);za.displayName="Animate";za.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};za.propTypes={from:yt.oneOfType([yt.object,yt.string]),to:yt.oneOfType([yt.object,yt.string]),attributeName:yt.string,duration:yt.number,begin:yt.number,easing:yt.oneOfType([yt.string,yt.func]),steps:yt.arrayOf(yt.shape({duration:yt.number.isRequired,style:yt.object.isRequired,easing:yt.oneOfType([yt.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),yt.func]),properties:yt.arrayOf("string"),onAnimationEnd:yt.func})),children:yt.oneOfType([yt.node,yt.func]),isActive:yt.bool,canBegin:yt.bool,onAnimationEnd:yt.func,shouldReAnimate:yt.bool,onAnimationStart:yt.func,onAnimationReStart:yt.func};function Bu(e){"@babel/helpers - typeof";return Bu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bu(e)}function Wp(){return Wp=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0?1:-1,d=n>=0?1:-1,c=a>=0&&n>=0||a<0&&n<0?1:0,f;if(s>0&&i instanceof Array){for(var p=[0,0,0,0],m=0,v=4;ms?s:i[m];f="M".concat(t,",").concat(r+u*p[0]),p[0]>0&&(f+="A ".concat(p[0],",").concat(p[0],",0,0,").concat(c,",").concat(t+d*p[0],",").concat(r)),f+="L ".concat(t+n-d*p[1],",").concat(r),p[1]>0&&(f+="A ".concat(p[1],",").concat(p[1],",0,0,").concat(c,`, + `).concat(t+n,",").concat(r+u*p[1])),f+="L ".concat(t+n,",").concat(r+a-u*p[2]),p[2]>0&&(f+="A ".concat(p[2],",").concat(p[2],",0,0,").concat(c,`, + `).concat(t+n-d*p[2],",").concat(r+a)),f+="L ".concat(t+d*p[3],",").concat(r+a),p[3]>0&&(f+="A ".concat(p[3],",").concat(p[3],",0,0,").concat(c,`, + `).concat(t,",").concat(r+a-u*p[3])),f+="Z"}else if(s>0&&i===+i&&i>0){var y=Math.min(s,i);f="M ".concat(t,",").concat(r+u*y,` + A `).concat(y,",").concat(y,",0,0,").concat(c,",").concat(t+d*y,",").concat(r,` + L `).concat(t+n-d*y,",").concat(r,` + A `).concat(y,",").concat(y,",0,0,").concat(c,",").concat(t+n,",").concat(r+u*y,` + L `).concat(t+n,",").concat(r+a-u*y,` + A `).concat(y,",").concat(y,",0,0,").concat(c,",").concat(t+n-d*y,",").concat(r+a,` + L `).concat(t+d*y,",").concat(r+a,` + A `).concat(y,",").concat(y,",0,0,").concat(c,",").concat(t,",").concat(r+a-u*y," Z")}else f="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(a," h ").concat(-n," Z");return f},cee=function(t,r){if(!t||!r)return!1;var n=t.x,a=t.y,i=r.x,s=r.y,u=r.width,d=r.height;if(Math.abs(u)>0&&Math.abs(d)>0){var c=Math.min(i,i+u),f=Math.max(i,i+u),p=Math.min(s,s+d),m=Math.max(s,s+d);return n>=c&&n<=f&&a>=p&&a<=m}return!1},uee={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Zj=function(t){var r=vk(vk({},uee),t),n=b.useRef(),a=b.useState(-1),i=tee(a,2),s=i[0],u=i[1];b.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var A=n.current.getTotalLength();A&&u(A)}catch{}},[]);var d=r.x,c=r.y,f=r.width,p=r.height,m=r.radius,v=r.className,y=r.animationEasing,x=r.animationDuration,w=r.animationBegin,j=r.isAnimationActive,N=r.isUpdateAnimationActive;if(d!==+d||c!==+c||f!==+f||p!==+p||f===0||p===0)return null;var C=nt("recharts-rectangle",v);return N?q.createElement(za,{canBegin:s>0,from:{width:f,height:p,x:d,y:c},to:{width:f,height:p,x:d,y:c},duration:x,animationEasing:y,isActive:N},function(A){var E=A.width,O=A.height,T=A.x,k=A.y;return q.createElement(za,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:w,duration:x,isActive:j,easing:y},q.createElement("path",Wp({},Ke(r,!0),{className:C,d:yk(T,k,E,O,m),ref:n})))}):q.createElement("path",Wp({},Ke(r,!0),{className:C,d:yk(d,c,f,p,m)}))},dee=["points","className","baseLinePoints","connectNulls"];function Js(){return Js=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function hee(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function xk(e){return vee(e)||gee(e)||mee(e)||pee()}function pee(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mee(e,t){if(e){if(typeof e=="string")return aS(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return aS(e,t)}}function gee(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function vee(e){if(Array.isArray(e))return aS(e)}function aS(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(n){bk(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),bk(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},du=function(t,r){var n=yee(t);r&&(n=[n.reduce(function(i,s){return[].concat(xk(i),xk(s))},[])]);var a=n.map(function(i){return i.reduce(function(s,u,d){return"".concat(s).concat(d===0?"M":"L").concat(u.x,",").concat(u.y)},"")}).join("");return n.length===1?"".concat(a,"Z"):a},xee=function(t,r,n){var a=du(t,n);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(du(r.reverse(),n).slice(1))},bee=function(t){var r=t.points,n=t.className,a=t.baseLinePoints,i=t.connectNulls,s=fee(t,dee);if(!r||!r.length)return null;var u=nt("recharts-polygon",n);if(a&&a.length){var d=s.stroke&&s.stroke!=="none",c=xee(r,a,i);return q.createElement("g",{className:u},q.createElement("path",Js({},Ke(s,!0),{fill:c.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:c})),d?q.createElement("path",Js({},Ke(s,!0),{fill:"none",d:du(r,i)})):null,d?q.createElement("path",Js({},Ke(s,!0),{fill:"none",d:du(a,i)})):null)}var f=du(r,i);return q.createElement("path",Js({},Ke(s,!0),{fill:f.slice(-1)==="Z"?s.fill:"none",className:u,d:f}))};function iS(){return iS=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Eee(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Oee=function(t,r,n,a,i,s){return"M".concat(t,",").concat(i,"v").concat(a,"M").concat(s,",").concat(r,"h").concat(n)},Pee=function(t){var r=t.x,n=r===void 0?0:r,a=t.y,i=a===void 0?0:a,s=t.top,u=s===void 0?0:s,d=t.left,c=d===void 0?0:d,f=t.width,p=f===void 0?0:f,m=t.height,v=m===void 0?0:m,y=t.className,x=Cee(t,wee),w=See({x:n,y:i,top:u,left:c,width:p,height:v},x);return!_e(n)||!_e(i)||!_e(p)||!_e(v)||!_e(u)||!_e(c)?null:q.createElement("path",oS({},Ke(w,!0),{className:nt("recharts-cross",y),d:Oee(n,i,p,v,u,c)}))},d1,Sk;function Aee(){if(Sk)return d1;Sk=1;var e=Hm(),t=i$(),r=Wa();function n(a,i){return a&&a.length?e(a,r(i,2),t):void 0}return d1=n,d1}var Tee=Aee();const kee=mt(Tee);var f1,jk;function Ree(){if(jk)return f1;jk=1;var e=Hm(),t=Wa(),r=o$();function n(a,i){return a&&a.length?e(a,t(i,2),r):void 0}return f1=n,f1}var Iee=Ree();const Mee=mt(Iee);var Dee=["cx","cy","angle","ticks","axisLine"],Lee=["ticks","tick","angle","tickFormatter","stroke"];function jl(e){"@babel/helpers - typeof";return jl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jl(e)}function fu(){return fu=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function $ee(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Fee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ck(e,t){for(var r=0;rPk?s=a==="outer"?"start":"end":i<-Pk?s=a==="outer"?"end":"start":s="middle",s}},{key:"renderAxisLine",value:function(){var n=this.props,a=n.cx,i=n.cy,s=n.radius,u=n.axisLine,d=n.axisLineType,c=Ro(Ro({},Ke(this.props,!1)),{},{fill:"none"},Ke(u,!1));if(d==="circle")return q.createElement(Xm,$o({className:"recharts-polar-angle-axis-line"},c,{cx:a,cy:i,r:s}));var f=this.props.ticks,p=f.map(function(m){return Dt(a,i,s,m.coordinate)});return q.createElement(bee,$o({className:"recharts-polar-angle-axis-line"},c,{points:p}))}},{key:"renderTicks",value:function(){var n=this,a=this.props,i=a.ticks,s=a.tick,u=a.tickLine,d=a.tickFormatter,c=a.stroke,f=Ke(this.props,!1),p=Ke(s,!1),m=Ro(Ro({},f),{},{fill:"none"},Ke(u,!1)),v=i.map(function(y,x){var w=n.getTickLineCoord(y),j=n.getTickTextAnchor(y),N=Ro(Ro(Ro({textAnchor:j},f),{},{stroke:"none",fill:c},p),{},{index:x,payload:y,x:w.x2,y:w.y2});return q.createElement(ht,$o({className:nt("recharts-polar-angle-axis-tick",I$(s)),key:"tick-".concat(y.coordinate)},Wo(n.props,y,x)),u&&q.createElement("line",$o({className:"recharts-polar-angle-axis-tick-line"},m,w)),s&&t.renderTickItem(s,N,d?d(y.value,x):y.value))});return q.createElement(ht,{className:"recharts-polar-angle-axis-ticks"},v)}},{key:"render",value:function(){var n=this.props,a=n.ticks,i=n.radius,s=n.axisLine;return i<=0||!a||!a.length?null:q.createElement(ht,{className:nt("recharts-polar-angle-axis",this.props.className)},s&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,a,i){var s;return q.isValidElement(n)?s=q.cloneElement(n,a):Qe(n)?s=n(a):s=q.createElement(Go,$o({},a,{className:"recharts-polar-angle-axis-tick-value"}),i),s}}])})(b.PureComponent);Zm(eg,"displayName","PolarAngleAxis");Zm(eg,"axisType","angleAxis");Zm(eg,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var h1,Ak;function ete(){if(Ak)return h1;Ak=1;var e=iL(),t=e(Object.getPrototypeOf,Object);return h1=t,h1}var p1,Tk;function tte(){if(Tk)return p1;Tk=1;var e=_i(),t=ete(),r=Ci(),n="[object Object]",a=Function.prototype,i=Object.prototype,s=a.toString,u=i.hasOwnProperty,d=s.call(Object);function c(f){if(!r(f)||e(f)!=n)return!1;var p=t(f);if(p===null)return!0;var m=u.call(p,"constructor")&&p.constructor;return typeof m=="function"&&m instanceof m&&s.call(m)==d}return p1=c,p1}var rte=tte();const nte=mt(rte);var m1,kk;function ate(){if(kk)return m1;kk=1;var e=_i(),t=Ci(),r="[object Boolean]";function n(a){return a===!0||a===!1||t(a)&&e(a)==r}return m1=n,m1}var ite=ate();const ote=mt(ite);function qu(e){"@babel/helpers - typeof";return qu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qu(e)}function Yp(){return Yp=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0,from:{upperWidth:0,lowerWidth:0,height:m,x:d,y:c},to:{upperWidth:f,lowerWidth:p,height:m,x:d,y:c},duration:x,animationEasing:y,isActive:j},function(C){var A=C.upperWidth,E=C.lowerWidth,O=C.height,T=C.x,k=C.y;return q.createElement(za,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:w,duration:x,easing:y},q.createElement("path",Yp({},Ke(r,!0),{className:N,d:Dk(T,k,A,E,O),ref:n})))}):q.createElement("g",null,q.createElement("path",Yp({},Ke(r,!0),{className:N,d:Dk(d,c,f,p,m)})))},vte=["option","shapeType","propTransformer","activeClassName","isActive"];function Uu(e){"@babel/helpers - typeof";return Uu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uu(e)}function yte(e,t){if(e==null)return{};var r=xte(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function xte(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Lk(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Xp(e){for(var t=1;t0?En(C,"paddingAngle",0):0;if(E){var T=jn(E.endAngle-E.startAngle,C.endAngle-C.startAngle),k=It(It({},C),{},{startAngle:N+O,endAngle:N+T(x)+O});w.push(k),N=k.endAngle}else{var M=C.endAngle,L=C.startAngle,$=jn(0,M-L),I=$(x),H=It(It({},C),{},{startAngle:N+O,endAngle:N+I+O});w.push(H),N=H.endAngle}}),q.createElement(ht,null,n.renderSectorsStatically(w))})}},{key:"attachKeyboardHandlers",value:function(n){var a=this;n.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var s=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[s].focus(),a.setState({sectorToFocus:s});break}case"ArrowRight":{var u=--a.state.sectorToFocus<0?a.sectorRefs.length-1:a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[u].focus(),a.setState({sectorToFocus:u});break}case"Escape":{a.sectorRefs[a.state.sectorToFocus].blur(),a.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,a=n.sectors,i=n.isAnimationActive,s=this.state.prevSectors;return i&&a&&a.length&&(!s||!dd(s,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,a=this.props,i=a.hide,s=a.sectors,u=a.className,d=a.label,c=a.cx,f=a.cy,p=a.innerRadius,m=a.outerRadius,v=a.isAnimationActive,y=this.state.isAnimationFinished;if(i||!s||!s.length||!_e(c)||!_e(f)||!_e(p)||!_e(m))return null;var x=nt("recharts-pie",u);return q.createElement(ht,{tabIndex:this.props.rootTabIndex,className:x,ref:function(j){n.pieRef=j}},this.renderSectors(),d&&this.renderLabels(s),jr.renderCallByParent(this.props,null,!1),(!v||y)&&hi.renderCallByParent(this.props,s,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,a){return a.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==a.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:n.sectors!==a.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,a){return n>a?"start":n=360?N:N-1)*d,A=w-N*v-C,E=a.reduce(function(k,M){var L=pr(M,j,0);return k+(_e(L)?L:0)},0),O;if(E>0){var T;O=a.map(function(k,M){var L=pr(k,j,0),$=pr(k,f,M),I=(_e(L)?L:0)/E,H;M?H=T.endAngle+Kr(x)*d*(L!==0?1:0):H=s;var Y=H+Kr(x)*((L!==0?v:0)+I*A),W=(H+Y)/2,V=(y.innerRadius+y.outerRadius)/2,K=[{name:$,value:L,payload:k,dataKey:j,type:m}],F=Dt(y.cx,y.cy,V,W);return T=It(It(It({percent:I,cornerRadius:i,name:$,tooltipPayload:K,midAngle:W,middleRadius:V,tooltipPosition:F},k),y),{},{value:pr(k,j),startAngle:H,endAngle:Y,payload:k,paddingAngle:Kr(x)*d}),T})}return It(It({},y),{},{sectors:O,data:a})});var g1,zk;function Bte(){if(zk)return g1;zk=1;var e=Math.ceil,t=Math.max;function r(n,a,i,s){for(var u=-1,d=t(e((a-n)/(i||1)),0),c=Array(d);d--;)c[s?d:++u]=n,n+=i;return c}return g1=r,g1}var v1,qk;function Q$(){if(qk)return v1;qk=1;var e=wL(),t=1/0,r=17976931348623157e292;function n(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var i=a<0?-1:1;return i*r}return a===a?a:0}return v1=n,v1}var y1,Uk;function zte(){if(Uk)return y1;Uk=1;var e=Bte(),t=Lm(),r=Q$();function n(a){return function(i,s,u){return u&&typeof u!="number"&&t(i,s,u)&&(s=u=void 0),i=r(i),s===void 0?(s=i,i=0):s=r(s),u=u===void 0?i0&&n.handleDrag(a.changedTouches[0])}),xn(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=n.props,i=a.endIndex,s=a.onDragEnd,u=a.startIndex;s?.({endIndex:i,startIndex:u})}),n.detachDragEndListener()}),xn(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),xn(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),xn(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),xn(n,"handleSlideDragStart",function(a){var i=Yk(a)?a.changedTouches[0]:a;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return Zte(t,e),Yte(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var a=n.startX,i=n.endX,s=this.state.scaleValues,u=this.props,d=u.gap,c=u.data,f=c.length-1,p=Math.min(a,i),m=Math.max(a,i),v=t.getIndexInRange(s,p),y=t.getIndexInRange(s,m);return{startIndex:v-v%d,endIndex:y===f?f:y-y%d}}},{key:"getTextOfTick",value:function(n){var a=this.props,i=a.data,s=a.tickFormatter,u=a.dataKey,d=pr(i[n],u,n);return Qe(s)?s(d,n):d}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var a=this.state,i=a.slideMoveStartX,s=a.startX,u=a.endX,d=this.props,c=d.x,f=d.width,p=d.travellerWidth,m=d.startIndex,v=d.endIndex,y=d.onChange,x=n.pageX-i;x>0?x=Math.min(x,c+f-p-u,c+f-p-s):x<0&&(x=Math.max(x,c-s,c-u));var w=this.getIndex({startX:s+x,endX:u+x});(w.startIndex!==m||w.endIndex!==v)&&y&&y(w),this.setState({startX:s+x,endX:u+x,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,a){var i=Yk(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var a=this.state,i=a.brushMoveStartX,s=a.movingTravellerId,u=a.endX,d=a.startX,c=this.state[s],f=this.props,p=f.x,m=f.width,v=f.travellerWidth,y=f.onChange,x=f.gap,w=f.data,j={startX:this.state.startX,endX:this.state.endX},N=n.pageX-i;N>0?N=Math.min(N,p+m-v-c):N<0&&(N=Math.max(N,p-c)),j[s]=c+N;var C=this.getIndex(j),A=C.startIndex,E=C.endIndex,O=function(){var k=w.length-1;return s==="startX"&&(u>d?A%x===0:E%x===0)||ud?E%x===0:A%x===0)||u>d&&E===k};this.setState(xn(xn({},s,c+N),"brushMoveStartX",n.pageX),function(){y&&O()&&y(C)})}},{key:"handleTravellerMoveKeyboard",value:function(n,a){var i=this,s=this.state,u=s.scaleValues,d=s.startX,c=s.endX,f=this.state[a],p=u.indexOf(f);if(p!==-1){var m=p+n;if(!(m===-1||m>=u.length)){var v=u[m];a==="startX"&&v>=c||a==="endX"&&v<=d||this.setState(xn({},a,v),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,a=n.x,i=n.y,s=n.width,u=n.height,d=n.fill,c=n.stroke;return q.createElement("rect",{stroke:c,fill:d,x:a,y:i,width:s,height:u})}},{key:"renderPanorama",value:function(){var n=this.props,a=n.x,i=n.y,s=n.width,u=n.height,d=n.data,c=n.children,f=n.padding,p=b.Children.only(c);return p?q.cloneElement(p,{x:a,y:i,width:s,height:u,margin:f,compact:!0,data:d}):null}},{key:"renderTravellerLayer",value:function(n,a){var i,s,u=this,d=this.props,c=d.y,f=d.travellerWidth,p=d.height,m=d.traveller,v=d.ariaLabel,y=d.data,x=d.startIndex,w=d.endIndex,j=Math.max(n,this.props.x),N=b1(b1({},Ke(this.props,!1)),{},{x:j,y:c,width:f,height:p}),C=v||"Min value: ".concat((i=y[x])===null||i===void 0?void 0:i.name,", Max value: ").concat((s=y[w])===null||s===void 0?void 0:s.name);return q.createElement(ht,{tabIndex:0,role:"slider","aria-label":C,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(E){["ArrowLeft","ArrowRight"].includes(E.key)&&(E.preventDefault(),E.stopPropagation(),u.handleTravellerMoveKeyboard(E.key==="ArrowRight"?1:-1,a))},onFocus:function(){u.setState({isTravellerFocused:!0})},onBlur:function(){u.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(m,N))}},{key:"renderSlide",value:function(n,a){var i=this.props,s=i.y,u=i.height,d=i.stroke,c=i.travellerWidth,f=Math.min(n,a)+c,p=Math.max(Math.abs(a-n)-c,0);return q.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:d,fillOpacity:.2,x:f,y:s,width:p,height:u})}},{key:"renderText",value:function(){var n=this.props,a=n.startIndex,i=n.endIndex,s=n.y,u=n.height,d=n.travellerWidth,c=n.stroke,f=this.state,p=f.startX,m=f.endX,v=5,y={pointerEvents:"none",fill:c};return q.createElement(ht,{className:"recharts-brush-texts"},q.createElement(Go,Zp({textAnchor:"end",verticalAnchor:"middle",x:Math.min(p,m)-v,y:s+u/2},y),this.getTextOfTick(a)),q.createElement(Go,Zp({textAnchor:"start",verticalAnchor:"middle",x:Math.max(p,m)+d+v,y:s+u/2},y),this.getTextOfTick(i)))}},{key:"render",value:function(){var n=this.props,a=n.data,i=n.className,s=n.children,u=n.x,d=n.y,c=n.width,f=n.height,p=n.alwaysShowText,m=this.state,v=m.startX,y=m.endX,x=m.isTextActive,w=m.isSlideMoving,j=m.isTravellerMoving,N=m.isTravellerFocused;if(!a||!a.length||!_e(u)||!_e(d)||!_e(c)||!_e(f)||c<=0||f<=0)return null;var C=nt("recharts-brush",i),A=q.Children.count(s)===1,E=Gte("userSelect","none");return q.createElement(ht,{className:C,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:E},this.renderBackground(),A&&this.renderPanorama(),this.renderSlide(v,y),this.renderTravellerLayer(v,"startX"),this.renderTravellerLayer(y,"endX"),(x||w||j||N||p)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var a=n.x,i=n.y,s=n.width,u=n.height,d=n.stroke,c=Math.floor(i+u/2)-1;return q.createElement(q.Fragment,null,q.createElement("rect",{x:a,y:i,width:s,height:u,fill:d,stroke:"none"}),q.createElement("line",{x1:a+1,y1:c,x2:a+s-1,y2:c,fill:"none",stroke:"#fff"}),q.createElement("line",{x1:a+1,y1:c+2,x2:a+s-1,y2:c+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,a){var i;return q.isValidElement(n)?i=q.cloneElement(n,a):Qe(n)?i=n(a):i=t.renderDefaultTraveller(a),i}},{key:"getDerivedStateFromProps",value:function(n,a){var i=n.data,s=n.width,u=n.x,d=n.travellerWidth,c=n.updateId,f=n.startIndex,p=n.endIndex;if(i!==a.prevData||c!==a.prevUpdateId)return b1({prevData:i,prevTravellerWidth:d,prevUpdateId:c,prevX:u,prevWidth:s},i&&i.length?tre({data:i,width:s,x:u,travellerWidth:d,startIndex:f,endIndex:p}):{scale:null,scaleValues:null});if(a.scale&&(s!==a.prevWidth||u!==a.prevX||d!==a.prevTravellerWidth)){a.scale.range([u,u+s-d]);var m=a.scale.domain().map(function(v){return a.scale(v)});return{prevData:i,prevTravellerWidth:d,prevUpdateId:c,prevX:u,prevWidth:s,startX:a.scale(n.startIndex),endX:a.scale(n.endIndex),scaleValues:m}}return null}},{key:"getIndexInRange",value:function(n,a){for(var i=n.length,s=0,u=i-1;u-s>1;){var d=Math.floor((s+u)/2);n[d]>a?u=d:s=d}return a>=n[u]?u:s}}])})(b.PureComponent);xn(El,"displayName","Brush");xn(El,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var w1,Xk;function rre(){if(Xk)return w1;Xk=1;var e=_j();function t(r,n){var a;return e(r,function(i,s,u){return a=n(i,s,u),!a}),!!a}return w1=t,w1}var S1,Jk;function nre(){if(Jk)return S1;Jk=1;var e=QD(),t=Wa(),r=rre(),n=cn(),a=Lm();function i(s,u,d){var c=n(s)?e:r;return d&&a(s,u,d)&&(u=void 0),c(s,t(u,3))}return S1=i,S1}var are=nre();const ire=mt(are);var $a=function(t,r){var n=t.alwaysShow,a=t.ifOverflow;return n&&(a="extendDomain"),a===r},j1,Qk;function ore(){if(Qk)return j1;Qk=1;var e=gL();function t(r,n,a){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):r[n]=a}return j1=t,j1}var N1,Zk;function sre(){if(Zk)return N1;Zk=1;var e=ore(),t=pL(),r=Wa();function n(a,i){var s={};return i=r(i,3),t(a,function(u,d,c){e(s,d,i(u,d,c))}),s}return N1=n,N1}var lre=sre();const cre=mt(lre);var _1,eR;function ure(){if(eR)return _1;eR=1;function e(t,r){for(var n=-1,a=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function xre(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function bre(e,t){var r=e.x,n=e.y,a=yre(e,pre),i="".concat(r),s=parseInt(i,10),u="".concat(n),d=parseInt(u,10),c="".concat(t.height||a.height),f=parseInt(c,10),p="".concat(t.width||a.width),m=parseInt(p,10);return Yc(Yc(Yc(Yc(Yc({},t),a),s?{x:s}:{}),d?{y:d}:{}),{},{height:f,width:m,name:t.name,radius:t.radius})}function aR(e){return q.createElement(Y$,dS({shapeType:"rectangle",propTransformer:bre,activeClassName:"recharts-active-bar"},e))}var wre=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,a){if(typeof t=="number")return t;var i=_e(n)||z9(n);return i?t(n,a):(i||Yo(),r)}},Sre=["value","background"],n4;function Ol(e){"@babel/helpers - typeof";return Ol=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ol(e)}function jre(e,t){if(e==null)return{};var r=Nre(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Nre(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function tm(){return tm=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(W)0&&Math.abs(Y)0&&(H=Math.min((X||0)-(Y[Q-1]||0),H))}),Number.isFinite(H)){var W=H/I,V=x.layout==="vertical"?n.height:n.width;if(x.padding==="gap"&&(T=W*V/2),x.padding==="no-gap"){var K=Yr(t.barCategoryGap,W*V),F=W*V/2;T=F-K-(F-K)/V*K}}}a==="xAxis"?k=[n.left+(C.left||0)+(T||0),n.left+n.width-(C.right||0)-(T||0)]:a==="yAxis"?k=d==="horizontal"?[n.top+n.height-(C.bottom||0),n.top+(C.top||0)]:[n.top+(C.top||0)+(T||0),n.top+n.height-(C.bottom||0)-(T||0)]:k=x.range,E&&(k=[k[1],k[0]]);var te=E$(x,i,m),D=te.scale,U=te.realScaleType;D.domain(j).range(k),O$(D);var z=P$(D,da(da({},x),{},{realScaleType:U}));a==="xAxis"?($=w==="top"&&!A||w==="bottom"&&A,M=n.left,L=p[O]-$*x.height):a==="yAxis"&&($=w==="left"&&!A||w==="right"&&A,M=p[O]-$*x.width,L=n.top);var B=da(da(da({},x),z),{},{realScaleType:U,x:M,y:L,scale:D,width:a==="xAxis"?n.width:x.width,height:a==="yAxis"?n.height:x.height});return B.bandSize=$p(B,z),!x.hide&&a==="xAxis"?p[O]+=($?-1:1)*B.height:x.hide||(p[O]+=($?-1:1)*B.width),da(da({},v),{},ng({},y,B))},{})},l4=function(t,r){var n=t.x,a=t.y,i=r.x,s=r.y;return{x:Math.min(n,i),y:Math.min(a,s),width:Math.abs(i-n),height:Math.abs(s-a)}},Mre=function(t){var r=t.x1,n=t.y1,a=t.x2,i=t.y2;return l4({x:r,y:n},{x:a,y:i})},c4=(function(){function e(t){kre(this,e),this.scale=t}return Rre(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.bandAware,i=n.position;if(r!==void 0){if(i)switch(i){case"start":return this.scale(r);case"middle":{var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+s}case"end":{var u=this.bandwidth?this.bandwidth():0;return this.scale(r)+u}default:return this.scale(r)}if(a){var d=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+d}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),a=n[0],i=n[n.length-1];return a<=i?r>=a&&r<=i:r>=i&&r<=a}}],[{key:"create",value:function(r){return new e(r)}}])})();ng(c4,"EPS",1e-4);var eN=function(t){var r=Object.keys(t).reduce(function(n,a){return da(da({},n),{},ng({},a,c4.create(t[a])))},{});return da(da({},r),{},{apply:function(a){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=i.bandAware,u=i.position;return cre(a,function(d,c){return r[c].apply(d,{bandAware:s,position:u})})},isInRange:function(a){return r4(a,function(i,s){return r[s].isInRange(i)})}})};function Dre(e){return(e%180+180)%180}var Lre=function(t){var r=t.width,n=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=Dre(a),s=i*Math.PI/180,u=Math.atan(n/r),d=s>u&&s-1?d[c?i[f]:f]:void 0}}return O1=n,O1}var P1,uR;function Fre(){if(uR)return P1;uR=1;var e=Q$();function t(r){var n=e(r),a=n%1;return n===n?a?n-a:n:0}return P1=t,P1}var A1,dR;function Bre(){if(dR)return A1;dR=1;var e=cL(),t=Wa(),r=Fre(),n=Math.max;function a(i,s,u){var d=i==null?0:i.length;if(!d)return-1;var c=u==null?0:r(u);return c<0&&(c=n(d+c,0)),e(i,t(s,3),c)}return A1=a,A1}var T1,fR;function zre(){if(fR)return T1;fR=1;var e=$re(),t=Bre(),r=e(t);return T1=r,T1}var qre=zre();const Ure=mt(qre);var Vre=_D();const Hre=mt(Vre);var Wre=Hre(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),tN=b.createContext(void 0),rN=b.createContext(void 0),u4=b.createContext(void 0),d4=b.createContext({}),f4=b.createContext(void 0),h4=b.createContext(0),p4=b.createContext(0),hR=function(t){var r=t.state,n=r.xAxisMap,a=r.yAxisMap,i=r.offset,s=t.clipPathId,u=t.children,d=t.width,c=t.height,f=Wre(i);return q.createElement(tN.Provider,{value:n},q.createElement(rN.Provider,{value:a},q.createElement(d4.Provider,{value:i},q.createElement(u4.Provider,{value:f},q.createElement(f4.Provider,{value:s},q.createElement(h4.Provider,{value:c},q.createElement(p4.Provider,{value:d},u)))))))},Gre=function(){return b.useContext(f4)},m4=function(t){var r=b.useContext(tN);r==null&&Yo();var n=r[t];return n==null&&Yo(),n},Kre=function(){var t=b.useContext(tN);return to(t)},Yre=function(){var t=b.useContext(rN),r=Ure(t,function(n){return r4(n.domain,Number.isFinite)});return r||to(t)},g4=function(t){var r=b.useContext(rN);r==null&&Yo();var n=r[t];return n==null&&Yo(),n},Xre=function(){var t=b.useContext(u4);return t},Jre=function(){return b.useContext(d4)},nN=function(){return b.useContext(p4)},aN=function(){return b.useContext(h4)};function Pl(e){"@babel/helpers - typeof";return Pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pl(e)}function Qre(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zre(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);re*a)return!1;var i=r();return e*(t-e*i/2-n)>=0&&e*(t+e*i/2-a)<=0}function Ine(e,t){return j4(e,t+1)}function Mne(e,t,r,n,a){for(var i=(n||[]).slice(),s=t.start,u=t.end,d=0,c=1,f=s,p=function(){var y=n?.[d];if(y===void 0)return{v:j4(n,c)};var x=d,w,j=function(){return w===void 0&&(w=r(y,x)),w},N=y.coordinate,C=d===0||om(e,N,j,f,u);C||(d=0,f=s,c+=1),C&&(f=N+e*(j()/2+a),d+=c)},m;c<=i.length;)if(m=p(),m)return m.v;return[]}function Ku(e){"@babel/helpers - typeof";return Ku=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ku(e)}function wR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Dr(e){for(var t=1;t0?v.coordinate-w*e:v.coordinate})}else i[m]=v=Dr(Dr({},v),{},{tickCoord:v.coordinate});var j=om(e,v.tickCoord,x,u,d);j&&(d=v.tickCoord-e*(x()/2+a),i[m]=Dr(Dr({},v),{},{isShow:!0}))},f=s-1;f>=0;f--)c(f);return i}function Bne(e,t,r,n,a,i){var s=(n||[]).slice(),u=s.length,d=t.start,c=t.end;if(i){var f=n[u-1],p=r(f,u-1),m=e*(f.coordinate+e*p/2-c);s[u-1]=f=Dr(Dr({},f),{},{tickCoord:m>0?f.coordinate-m*e:f.coordinate});var v=om(e,f.tickCoord,function(){return p},d,c);v&&(c=f.tickCoord-e*(p/2+a),s[u-1]=Dr(Dr({},f),{},{isShow:!0}))}for(var y=i?u-1:u,x=function(N){var C=s[N],A,E=function(){return A===void 0&&(A=r(C,N)),A};if(N===0){var O=e*(C.coordinate-e*E()/2-d);s[N]=C=Dr(Dr({},C),{},{tickCoord:O<0?C.coordinate-O*e:C.coordinate})}else s[N]=C=Dr(Dr({},C),{},{tickCoord:C.coordinate});var T=om(e,C.tickCoord,E,d,c);T&&(d=C.tickCoord+e*(E()/2+a),s[N]=Dr(Dr({},C),{},{isShow:!0}))},w=0;w=2?Kr(a[1].coordinate-a[0].coordinate):1,j=Rne(i,w,v);return d==="equidistantPreserveStart"?Mne(w,j,x,a,s):(d==="preserveStart"||d==="preserveStartEnd"?m=Bne(w,j,x,a,s,d==="preserveStartEnd"):m=Fne(w,j,x,a,s),m.filter(function(N){return N.isShow}))}var zne=["viewBox"],qne=["viewBox"],Une=["ticks"];function kl(e){"@babel/helpers - typeof";return kl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kl(e)}function Zs(){return Zs=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Vne(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Hne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jR(e,t){for(var r=0;r0?d(this.props):d(v)),s<=0||u<=0||!y||!y.length?null:q.createElement(ht,{className:nt("recharts-cartesian-axis",c),ref:function(w){n.layerReference=w}},i&&this.renderAxisLine(),this.renderTicks(y,this.state.fontSize,this.state.letterSpacing),jr.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,a,i){var s,u=nt(a.className,"recharts-cartesian-axis-tick-value");return q.isValidElement(n)?s=q.cloneElement(n,fr(fr({},a),{},{className:u})):Qe(n)?s=n(fr(fr({},a),{},{className:u})):s=q.createElement(Go,Zs({},a,{className:"recharts-cartesian-axis-tick-value"}),i),s}}])})(b.Component);lN(Ql,"displayName","CartesianAxis");lN(Ql,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var Qne=["x1","y1","x2","y2","key"],Zne=["offset"];function Xo(e){"@babel/helpers - typeof";return Xo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xo(e)}function NR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Lr(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function nae(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var aae=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,a=t.x,i=t.y,s=t.width,u=t.height,d=t.ry;return q.createElement("rect",{x:a,y:i,ry:d,width:s,height:u,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function C4(e,t){var r;if(q.isValidElement(e))r=q.cloneElement(e,t);else if(Qe(e))r=e(t);else{var n=t.x1,a=t.y1,i=t.x2,s=t.y2,u=t.key,d=_R(t,Qne),c=Ke(d,!1);c.offset;var f=_R(c,Zne);r=q.createElement("line",qo({},f,{x1:n,y1:a,x2:i,y2:s,fill:"none",key:u}))}return r}function iae(e){var t=e.x,r=e.width,n=e.horizontal,a=n===void 0?!0:n,i=e.horizontalPoints;if(!a||!i||!i.length)return null;var s=i.map(function(u,d){var c=Lr(Lr({},e),{},{x1:t,y1:u,x2:t+r,y2:u,key:"line-".concat(d),index:d});return C4(a,c)});return q.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function oae(e){var t=e.y,r=e.height,n=e.vertical,a=n===void 0?!0:n,i=e.verticalPoints;if(!a||!i||!i.length)return null;var s=i.map(function(u,d){var c=Lr(Lr({},e),{},{x1:u,y1:t,x2:u,y2:t+r,key:"line-".concat(d),index:d});return C4(a,c)});return q.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function sae(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,a=e.y,i=e.width,s=e.height,u=e.horizontalPoints,d=e.horizontal,c=d===void 0?!0:d;if(!c||!t||!t.length)return null;var f=u.map(function(m){return Math.round(m+a-a)}).sort(function(m,v){return m-v});a!==f[0]&&f.unshift(0);var p=f.map(function(m,v){var y=!f[v+1],x=y?a+s-m:f[v+1]-m;if(x<=0)return null;var w=v%t.length;return q.createElement("rect",{key:"react-".concat(v),y:m,x:n,height:x,width:i,stroke:"none",fill:t[w],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return q.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},p)}function lae(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,a=e.fillOpacity,i=e.x,s=e.y,u=e.width,d=e.height,c=e.verticalPoints;if(!r||!n||!n.length)return null;var f=c.map(function(m){return Math.round(m+i-i)}).sort(function(m,v){return m-v});i!==f[0]&&f.unshift(0);var p=f.map(function(m,v){var y=!f[v+1],x=y?i+u-m:f[v+1]-m;if(x<=0)return null;var w=v%n.length;return q.createElement("rect",{key:"react-".concat(v),x:m,y:s,width:x,height:d,stroke:"none",fill:n[w],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return q.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},p)}var cae=function(t,r){var n=t.xAxis,a=t.width,i=t.height,s=t.offset;return C$(sN(Lr(Lr(Lr({},Ql.defaultProps),n),{},{ticks:ui(n,!0),viewBox:{x:0,y:0,width:a,height:i}})),s.left,s.left+s.width,r)},uae=function(t,r){var n=t.yAxis,a=t.width,i=t.height,s=t.offset;return C$(sN(Lr(Lr(Lr({},Ql.defaultProps),n),{},{ticks:ui(n,!0),viewBox:{x:0,y:0,width:a,height:i}})),s.top,s.top+s.height,r)},Ls={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function lm(e){var t,r,n,a,i,s,u=nN(),d=aN(),c=Jre(),f=Lr(Lr({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:Ls.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:Ls.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:Ls.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:Ls.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:Ls.vertical,verticalFill:(s=e.verticalFill)!==null&&s!==void 0?s:Ls.verticalFill,x:_e(e.x)?e.x:c.left,y:_e(e.y)?e.y:c.top,width:_e(e.width)?e.width:c.width,height:_e(e.height)?e.height:c.height}),p=f.x,m=f.y,v=f.width,y=f.height,x=f.syncWithTicks,w=f.horizontalValues,j=f.verticalValues,N=Kre(),C=Yre();if(!_e(v)||v<=0||!_e(y)||y<=0||!_e(p)||p!==+p||!_e(m)||m!==+m)return null;var A=f.verticalCoordinatesGenerator||cae,E=f.horizontalCoordinatesGenerator||uae,O=f.horizontalPoints,T=f.verticalPoints;if((!O||!O.length)&&Qe(E)){var k=w&&w.length,M=E({yAxis:C?Lr(Lr({},C),{},{ticks:k?w:C.ticks}):void 0,width:u,height:d,offset:c},k?!0:x);ma(Array.isArray(M),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Xo(M),"]")),Array.isArray(M)&&(O=M)}if((!T||!T.length)&&Qe(A)){var L=j&&j.length,$=A({xAxis:N?Lr(Lr({},N),{},{ticks:L?j:N.ticks}):void 0,width:u,height:d,offset:c},L?!0:x);ma(Array.isArray($),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Xo($),"]")),Array.isArray($)&&(T=$)}return q.createElement("g",{className:"recharts-cartesian-grid"},q.createElement(aae,{fill:f.fill,fillOpacity:f.fillOpacity,x:f.x,y:f.y,width:f.width,height:f.height,ry:f.ry}),q.createElement(iae,qo({},f,{offset:c,horizontalPoints:O,xAxis:N,yAxis:C})),q.createElement(oae,qo({},f,{offset:c,verticalPoints:T,xAxis:N,yAxis:C})),q.createElement(sae,qo({},f,{horizontalPoints:O})),q.createElement(lae,qo({},f,{verticalPoints:T})))}lm.displayName="CartesianGrid";var dae=["type","layout","connectNulls","ref"],fae=["key"];function Rl(e){"@babel/helpers - typeof";return Rl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rl(e)}function CR(e,t){if(e==null)return{};var r=hae(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function hae(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function hu(){return hu=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);rp){v=[].concat($s(d.slice(0,y)),[p-x]);break}var w=v.length%2===0?[0,m]:[m];return[].concat($s(t.repeat(d,f)),$s(v),w).map(function(j){return"".concat(j,"px")}).join(", ")}),fa(r,"id",Gl("recharts-line-")),fa(r,"pathRef",function(s){r.mainCurve=s}),fa(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),fa(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return jae(t,e),xae(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,s=i.points,u=i.xAxis,d=i.yAxis,c=i.layout,f=i.children,p=On(f,fd);if(!p)return null;var m=function(x,w){return{x:x.x,y:x.y,value:x.value,errorVal:pr(x.payload,w)}},v={clipPath:n?"url(#clipPath-".concat(a,")"):null};return q.createElement(ht,v,p.map(function(y){return q.cloneElement(y,{key:"bar-".concat(y.props.dataKey),data:s,xAxis:u,yAxis:d,layout:c,dataPointFormatter:m})}))}},{key:"renderDots",value:function(n,a,i){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var u=this.props,d=u.dot,c=u.points,f=u.dataKey,p=Ke(this.props,!1),m=Ke(d,!0),v=c.map(function(x,w){var j=yn(yn(yn({key:"dot-".concat(w),r:3},p),m),{},{index:w,cx:x.x,cy:x.y,value:x.value,dataKey:f,payload:x.payload,points:c});return t.renderDotItem(d,j)}),y={clipPath:n?"url(#clipPath-".concat(a?"":"dots-").concat(i,")"):null};return q.createElement(ht,hu({className:"recharts-line-dots",key:"dots"},y),v)}},{key:"renderCurveStatically",value:function(n,a,i,s){var u=this.props,d=u.type,c=u.layout,f=u.connectNulls;u.ref;var p=CR(u,dae),m=yn(yn(yn({},Ke(p,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:a?"url(#clipPath-".concat(i,")"):null,points:n},s),{},{type:d,layout:c,connectNulls:f});return q.createElement(zp,hu({},m,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,a){var i=this,s=this.props,u=s.points,d=s.strokeDasharray,c=s.isAnimationActive,f=s.animationBegin,p=s.animationDuration,m=s.animationEasing,v=s.animationId,y=s.animateNewValues,x=s.width,w=s.height,j=this.state,N=j.prevPoints,C=j.totalLength;return q.createElement(za,{begin:f,duration:p,isActive:c,easing:m,from:{t:0},to:{t:1},key:"line-".concat(v),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(A){var E=A.t;if(N){var O=N.length/u.length,T=u.map(function(I,H){var Y=Math.floor(H*O);if(N[Y]){var W=N[Y],V=jn(W.x,I.x),K=jn(W.y,I.y);return yn(yn({},I),{},{x:V(E),y:K(E)})}if(y){var F=jn(x*2,I.x),te=jn(w/2,I.y);return yn(yn({},I),{},{x:F(E),y:te(E)})}return yn(yn({},I),{},{x:I.x,y:I.y})});return i.renderCurveStatically(T,n,a)}var k=jn(0,C),M=k(E),L;if(d){var $="".concat(d).split(/[,\s]+/gim).map(function(I){return parseFloat(I)});L=i.getStrokeDasharray(M,C,$)}else L=i.generateSimpleStrokeDasharray(C,M);return i.renderCurveStatically(u,n,a,{strokeDasharray:L})})}},{key:"renderCurve",value:function(n,a){var i=this.props,s=i.points,u=i.isAnimationActive,d=this.state,c=d.prevPoints,f=d.totalLength;return u&&s&&s.length&&(!c&&f>0||!dd(c,s))?this.renderCurveWithAnimation(n,a):this.renderCurveStatically(s,n,a)}},{key:"render",value:function(){var n,a=this.props,i=a.hide,s=a.dot,u=a.points,d=a.className,c=a.xAxis,f=a.yAxis,p=a.top,m=a.left,v=a.width,y=a.height,x=a.isAnimationActive,w=a.id;if(i||!u||!u.length)return null;var j=this.state.isAnimationFinished,N=u.length===1,C=nt("recharts-line",d),A=c&&c.allowDataOverflow,E=f&&f.allowDataOverflow,O=A||E,T=rt(w)?this.id:w,k=(n=Ke(s,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},M=k.r,L=M===void 0?3:M,$=k.strokeWidth,I=$===void 0?2:$,H=Z9(s)?s:{},Y=H.clipDot,W=Y===void 0?!0:Y,V=L*2+I;return q.createElement(ht,{className:C},A||E?q.createElement("defs",null,q.createElement("clipPath",{id:"clipPath-".concat(T)},q.createElement("rect",{x:A?m:m-v/2,y:E?p:p-y/2,width:A?v:v*2,height:E?y:y*2})),!W&&q.createElement("clipPath",{id:"clipPath-dots-".concat(T)},q.createElement("rect",{x:m-V/2,y:p-V/2,width:v+V,height:y+V}))):null,!N&&this.renderCurve(O,T),this.renderErrorBar(O,T),(N||s)&&this.renderDots(O,W,T),(!x||j)&&hi.renderCallByParent(this.props,u))}}],[{key:"getDerivedStateFromProps",value:function(n,a){return n.animationId!==a.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:a.curPoints}:n.points!==a.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,a){for(var i=n.length%2!==0?[].concat($s(n),[0]):n,s=[],u=0;ue.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function hie(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function pie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mie(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?s:t&&t.length&&_e(a)&&_e(i)?t.slice(a,i+1):[]};function z4(e){return e==="number"?[0,"auto"]:void 0}var AS=function(t,r,n,a){var i=t.graphicalItems,s=t.tooltipAxis,u=lg(r,t);return n<0||!i||!i.length||n>=u.length?null:i.reduce(function(d,c){var f,p=(f=c.props.data)!==null&&f!==void 0?f:r;p&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(p=p.slice(t.dataStartIndex,t.dataEndIndex+1));var m;if(s.dataKey&&!s.allowDuplicatedCategory){var v=p===void 0?u:p;m=dp(v,s.dataKey,a)}else m=p&&p[n]||u[n];return m?[].concat(Ll(d),[T$(c,m)]):d},[])},MR=function(t,r,n,a){var i=a||{x:t.chartX,y:t.chartY},s=Eie(i,n),u=t.orderedTooltipTicks,d=t.tooltipAxis,c=t.tooltipTicks,f=XX(s,u,c,d);if(f>=0&&c){var p=c[f]&&c[f].value,m=AS(t,r,f,p),v=Oie(n,u,f,i);return{activeTooltipIndex:f,activeLabel:p,activePayload:m,activeCoordinate:v}}return null},Pie=function(t,r){var n=r.axes,a=r.graphicalItems,i=r.axisType,s=r.axisIdKey,u=r.stackGroups,d=r.dataStartIndex,c=r.dataEndIndex,f=t.layout,p=t.children,m=t.stackOffset,v=_$(f,i);return n.reduce(function(y,x){var w,j=x.type.defaultProps!==void 0?ge(ge({},x.type.defaultProps),x.props):x.props,N=j.type,C=j.dataKey,A=j.allowDataOverflow,E=j.allowDuplicatedCategory,O=j.scale,T=j.ticks,k=j.includeHidden,M=j[s];if(y[M])return y;var L=lg(t.data,{graphicalItems:a.filter(function(z){var B,X=s in z.props?z.props[s]:(B=z.type.defaultProps)===null||B===void 0?void 0:B[s];return X===M}),dataStartIndex:d,dataEndIndex:c}),$=L.length,I,H,Y;tie(j.domain,A,N)&&(I=Vw(j.domain,null,A),v&&(N==="number"||O!=="auto")&&(Y=cu(L,C,"category")));var W=z4(N);if(!I||I.length===0){var V,K=(V=j.domain)!==null&&V!==void 0?V:W;if(C){if(I=cu(L,C,N),N==="category"&&v){var F=U9(I);E&&F?(H=I,I=Qp(0,$)):E||(I=L2(K,I,x).reduce(function(z,B){return z.indexOf(B)>=0?z:[].concat(Ll(z),[B])},[]))}else if(N==="category")E?I=I.filter(function(z){return z!==""&&!rt(z)}):I=L2(K,I,x).reduce(function(z,B){return z.indexOf(B)>=0||B===""||rt(B)?z:[].concat(Ll(z),[B])},[]);else if(N==="number"){var te=tJ(L,a.filter(function(z){var B,X,Q=s in z.props?z.props[s]:(B=z.type.defaultProps)===null||B===void 0?void 0:B[s],re="hide"in z.props?z.props.hide:(X=z.type.defaultProps)===null||X===void 0?void 0:X.hide;return Q===M&&(k||!re)}),C,i,f);te&&(I=te)}v&&(N==="number"||O!=="auto")&&(Y=cu(L,C,"category"))}else v?I=Qp(0,$):u&&u[M]&&u[M].hasStack&&N==="number"?I=m==="expand"?[0,1]:A$(u[M].stackGroups,d,c):I=N$(L,a.filter(function(z){var B=s in z.props?z.props[s]:z.type.defaultProps[s],X="hide"in z.props?z.props.hide:z.type.defaultProps.hide;return B===M&&(k||!X)}),N,f,!0);if(N==="number")I=ES(p,I,M,i,T),K&&(I=Vw(K,I,A));else if(N==="category"&&K){var D=K,U=I.every(function(z){return D.indexOf(z)>=0});U&&(I=D)}}return ge(ge({},y),{},Ye({},M,ge(ge({},j),{},{axisType:i,domain:I,categoricalDomain:Y,duplicateDomain:H,originalDomain:(w=j.domain)!==null&&w!==void 0?w:W,isCategorical:v,layout:f})))},{})},Aie=function(t,r){var n=r.graphicalItems,a=r.Axis,i=r.axisType,s=r.axisIdKey,u=r.stackGroups,d=r.dataStartIndex,c=r.dataEndIndex,f=t.layout,p=t.children,m=lg(t.data,{graphicalItems:n,dataStartIndex:d,dataEndIndex:c}),v=m.length,y=_$(f,i),x=-1;return n.reduce(function(w,j){var N=j.type.defaultProps!==void 0?ge(ge({},j.type.defaultProps),j.props):j.props,C=N[s],A=z4("number");if(!w[C]){x++;var E;return y?E=Qp(0,v):u&&u[C]&&u[C].hasStack?(E=A$(u[C].stackGroups,d,c),E=ES(p,E,C,i)):(E=Vw(A,N$(m,n.filter(function(O){var T,k,M=s in O.props?O.props[s]:(T=O.type.defaultProps)===null||T===void 0?void 0:T[s],L="hide"in O.props?O.props.hide:(k=O.type.defaultProps)===null||k===void 0?void 0:k.hide;return M===C&&!L}),"number",f),a.defaultProps.allowDataOverflow),E=ES(p,E,C,i)),ge(ge({},w),{},Ye({},C,ge(ge({axisType:i},a.defaultProps),{},{hide:!0,orientation:En(_ie,"".concat(i,".").concat(x%2),null),domain:E,originalDomain:A,isCategorical:y,layout:f})))}return w},{})},Tie=function(t,r){var n=r.axisType,a=n===void 0?"xAxis":n,i=r.AxisComp,s=r.graphicalItems,u=r.stackGroups,d=r.dataStartIndex,c=r.dataEndIndex,f=t.children,p="".concat(a,"Id"),m=On(f,i),v={};return m&&m.length?v=Pie(t,{axes:m,graphicalItems:s,axisType:a,axisIdKey:p,stackGroups:u,dataStartIndex:d,dataEndIndex:c}):s&&s.length&&(v=Aie(t,{Axis:i,graphicalItems:s,axisType:a,axisIdKey:p,stackGroups:u,dataStartIndex:d,dataEndIndex:c})),v},kie=function(t){var r=to(t),n=ui(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:Cj(n,function(a){return a.coordinate}),tooltipAxis:r,tooltipAxisBandSize:$p(r,n)}},DR=function(t){var r=t.children,n=t.defaultShowTooltip,a=bn(r,El),i=0,s=0;return t.data&&t.data.length!==0&&(s=t.data.length-1),a&&a.props&&(a.props.startIndex>=0&&(i=a.props.startIndex),a.props.endIndex>=0&&(s=a.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!n}},Rie=function(t){return!t||!t.length?!1:t.some(function(r){var n=di(r&&r.type);return n&&n.indexOf("Bar")>=0})},LR=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Iie=function(t,r){var n=t.props,a=t.graphicalItems,i=t.xAxisMap,s=i===void 0?{}:i,u=t.yAxisMap,d=u===void 0?{}:u,c=n.width,f=n.height,p=n.children,m=n.margin||{},v=bn(p,El),y=bn(p,nl),x=Object.keys(d).reduce(function(E,O){var T=d[O],k=T.orientation;return!T.mirror&&!T.hide?ge(ge({},E),{},Ye({},k,E[k]+T.width)):E},{left:m.left||0,right:m.right||0}),w=Object.keys(s).reduce(function(E,O){var T=s[O],k=T.orientation;return!T.mirror&&!T.hide?ge(ge({},E),{},Ye({},k,En(E,"".concat(k))+T.height)):E},{top:m.top||0,bottom:m.bottom||0}),j=ge(ge({},w),x),N=j.bottom;v&&(j.bottom+=v.props.height||El.defaultProps.height),y&&r&&(j=ZX(j,a,n,r));var C=c-j.left-j.right,A=f-j.top-j.bottom;return ge(ge({brushBottom:N},j),{},{width:Math.max(C,0),height:Math.max(A,0)})},Mie=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},cN=function(t){var r=t.chartName,n=t.GraphicalChild,a=t.defaultTooltipEventType,i=a===void 0?"axis":a,s=t.validateTooltipEventTypes,u=s===void 0?["axis"]:s,d=t.axisComponents,c=t.legendContent,f=t.formatAxisMap,p=t.defaultProps,m=function(j,N){var C=N.graphicalItems,A=N.stackGroups,E=N.offset,O=N.updateId,T=N.dataStartIndex,k=N.dataEndIndex,M=j.barSize,L=j.layout,$=j.barGap,I=j.barCategoryGap,H=j.maxBarSize,Y=LR(L),W=Y.numericAxisName,V=Y.cateAxisName,K=Rie(C),F=[];return C.forEach(function(te,D){var U=lg(j.data,{graphicalItems:[te],dataStartIndex:T,dataEndIndex:k}),z=te.type.defaultProps!==void 0?ge(ge({},te.type.defaultProps),te.props):te.props,B=z.dataKey,X=z.maxBarSize,Q=z["".concat(W,"Id")],re=z["".concat(V,"Id")],G={},Z=d.reduce(function(Ot,it){var Pt=N["".concat(it.axisType,"Map")],Ut=z["".concat(it.axisType,"Id")];Pt&&Pt[Ut]||it.axisType==="zAxis"||Yo();var Ar=Pt[Ut];return ge(ge({},Ot),{},Ye(Ye({},it.axisType,Ar),"".concat(it.axisType,"Ticks"),ui(Ar)))},G),ee=Z[V],ce=Z["".concat(V,"Ticks")],ve=A&&A[Q]&&A[Q].hasStack&&uJ(te,A[Q].stackGroups),ne=di(te.type).indexOf("Bar")>=0,Ce=$p(ee,ce),pe=[],Pe=K&&JX({barSize:M,stackGroups:A,totalSize:Mie(Z,V)});if(ne){var $e,Fe,dt=rt(X)?H:X,ct=($e=(Fe=$p(ee,ce,!0))!==null&&Fe!==void 0?Fe:dt)!==null&&$e!==void 0?$e:0;pe=QX({barGap:$,barCategoryGap:I,bandSize:ct!==Ce?ct:Ce,sizeList:Pe[re],maxBarSize:dt}),ct!==Ce&&(pe=pe.map(function(Ot){return ge(ge({},Ot),{},{position:ge(ge({},Ot.position),{},{offset:Ot.position.offset-ct/2})})}))}var St=te&&te.type&&te.type.getComposedData;St&&F.push({props:ge(ge({},St(ge(ge({},Z),{},{displayedData:U,props:j,dataKey:B,item:te,bandSize:Ce,barPosition:pe,offset:E,stackedData:ve,layout:L,dataStartIndex:T,dataEndIndex:k}))),{},Ye(Ye(Ye({key:te.key||"item-".concat(D)},W,Z[W]),V,Z[V]),"animationId",O)),childIndex:r7(te,j.children),item:te})}),F},v=function(j,N){var C=j.props,A=j.dataStartIndex,E=j.dataEndIndex,O=j.updateId;if(!JO({props:C}))return null;var T=C.children,k=C.layout,M=C.stackOffset,L=C.data,$=C.reverseStackOrder,I=LR(k),H=I.numericAxisName,Y=I.cateAxisName,W=On(T,n),V=lJ(L,W,"".concat(H,"Id"),"".concat(Y,"Id"),M,$),K=d.reduce(function(z,B){var X="".concat(B.axisType,"Map");return ge(ge({},z),{},Ye({},X,Tie(C,ge(ge({},B),{},{graphicalItems:W,stackGroups:B.axisType===H&&V,dataStartIndex:A,dataEndIndex:E}))))},{}),F=Iie(ge(ge({},K),{},{props:C,graphicalItems:W}),N?.legendBBox);Object.keys(K).forEach(function(z){K[z]=f(C,K[z],F,z.replace("Map",""),r)});var te=K["".concat(Y,"Map")],D=kie(te),U=m(C,ge(ge({},K),{},{dataStartIndex:A,dataEndIndex:E,updateId:O,graphicalItems:W,stackGroups:V,offset:F}));return ge(ge({formattedGraphicalItems:U,graphicalItems:W,offset:F,stackGroups:V},D),K)},y=(function(w){function j(N){var C,A,E;return pie(this,j),E=vie(this,j,[N]),Ye(E,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Ye(E,"accessibilityManager",new eie),Ye(E,"handleLegendBBoxUpdate",function(O){if(O){var T=E.state,k=T.dataStartIndex,M=T.dataEndIndex,L=T.updateId;E.setState(ge({legendBBox:O},v({props:E.props,dataStartIndex:k,dataEndIndex:M,updateId:L},ge(ge({},E.state),{},{legendBBox:O}))))}}),Ye(E,"handleReceiveSyncEvent",function(O,T,k){if(E.props.syncId===O){if(k===E.eventEmitterSymbol&&typeof E.props.syncMethod!="function")return;E.applySyncEvent(T)}}),Ye(E,"handleBrushChange",function(O){var T=O.startIndex,k=O.endIndex;if(T!==E.state.dataStartIndex||k!==E.state.dataEndIndex){var M=E.state.updateId;E.setState(function(){return ge({dataStartIndex:T,dataEndIndex:k},v({props:E.props,dataStartIndex:T,dataEndIndex:k,updateId:M},E.state))}),E.triggerSyncEvent({dataStartIndex:T,dataEndIndex:k})}}),Ye(E,"handleMouseEnter",function(O){var T=E.getMouseInfo(O);if(T){var k=ge(ge({},T),{},{isTooltipActive:!0});E.setState(k),E.triggerSyncEvent(k);var M=E.props.onMouseEnter;Qe(M)&&M(k,O)}}),Ye(E,"triggeredAfterMouseMove",function(O){var T=E.getMouseInfo(O),k=T?ge(ge({},T),{},{isTooltipActive:!0}):{isTooltipActive:!1};E.setState(k),E.triggerSyncEvent(k);var M=E.props.onMouseMove;Qe(M)&&M(k,O)}),Ye(E,"handleItemMouseEnter",function(O){E.setState(function(){return{isTooltipActive:!0,activeItem:O,activePayload:O.tooltipPayload,activeCoordinate:O.tooltipPosition||{x:O.cx,y:O.cy}}})}),Ye(E,"handleItemMouseLeave",function(){E.setState(function(){return{isTooltipActive:!1}})}),Ye(E,"handleMouseMove",function(O){O.persist(),E.throttleTriggeredAfterMouseMove(O)}),Ye(E,"handleMouseLeave",function(O){E.throttleTriggeredAfterMouseMove.cancel();var T={isTooltipActive:!1};E.setState(T),E.triggerSyncEvent(T);var k=E.props.onMouseLeave;Qe(k)&&k(T,O)}),Ye(E,"handleOuterEvent",function(O){var T=t7(O),k=En(E.props,"".concat(T));if(T&&Qe(k)){var M,L;/.*touch.*/i.test(T)?L=E.getMouseInfo(O.changedTouches[0]):L=E.getMouseInfo(O),k((M=L)!==null&&M!==void 0?M:{},O)}}),Ye(E,"handleClick",function(O){var T=E.getMouseInfo(O);if(T){var k=ge(ge({},T),{},{isTooltipActive:!0});E.setState(k),E.triggerSyncEvent(k);var M=E.props.onClick;Qe(M)&&M(k,O)}}),Ye(E,"handleMouseDown",function(O){var T=E.props.onMouseDown;if(Qe(T)){var k=E.getMouseInfo(O);T(k,O)}}),Ye(E,"handleMouseUp",function(O){var T=E.props.onMouseUp;if(Qe(T)){var k=E.getMouseInfo(O);T(k,O)}}),Ye(E,"handleTouchMove",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&E.throttleTriggeredAfterMouseMove(O.changedTouches[0])}),Ye(E,"handleTouchStart",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&E.handleMouseDown(O.changedTouches[0])}),Ye(E,"handleTouchEnd",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&E.handleMouseUp(O.changedTouches[0])}),Ye(E,"handleDoubleClick",function(O){var T=E.props.onDoubleClick;if(Qe(T)){var k=E.getMouseInfo(O);T(k,O)}}),Ye(E,"handleContextMenu",function(O){var T=E.props.onContextMenu;if(Qe(T)){var k=E.getMouseInfo(O);T(k,O)}}),Ye(E,"triggerSyncEvent",function(O){E.props.syncId!==void 0&&I1.emit(M1,E.props.syncId,O,E.eventEmitterSymbol)}),Ye(E,"applySyncEvent",function(O){var T=E.props,k=T.layout,M=T.syncMethod,L=E.state.updateId,$=O.dataStartIndex,I=O.dataEndIndex;if(O.dataStartIndex!==void 0||O.dataEndIndex!==void 0)E.setState(ge({dataStartIndex:$,dataEndIndex:I},v({props:E.props,dataStartIndex:$,dataEndIndex:I,updateId:L},E.state)));else if(O.activeTooltipIndex!==void 0){var H=O.chartX,Y=O.chartY,W=O.activeTooltipIndex,V=E.state,K=V.offset,F=V.tooltipTicks;if(!K)return;if(typeof M=="function")W=M(F,O);else if(M==="value"){W=-1;for(var te=0;te=0){var ve,ne;if(H.dataKey&&!H.allowDuplicatedCategory){var Ce=typeof H.dataKey=="function"?ce:"payload.".concat(H.dataKey.toString());ve=dp(te,Ce,W),ne=D&&U&&dp(U,Ce,W)}else ve=te?.[Y],ne=D&&U&&U[Y];if(re||Q){var pe=O.props.activeIndex!==void 0?O.props.activeIndex:Y;return[b.cloneElement(O,ge(ge(ge({},M.props),Z),{},{activeIndex:pe})),null,null]}if(!rt(ve))return[ee].concat(Ll(E.renderActivePoints({item:M,activePoint:ve,basePoint:ne,childIndex:Y,isRange:D})))}else{var Pe,$e=(Pe=E.getItemByXY(E.state.activeCoordinate))!==null&&Pe!==void 0?Pe:{graphicalItem:ee},Fe=$e.graphicalItem,dt=Fe.item,ct=dt===void 0?O:dt,St=Fe.childIndex,Ot=ge(ge(ge({},M.props),Z),{},{activeIndex:St});return[b.cloneElement(ct,Ot),null,null]}return D?[ee,null,null]:[ee,null]}),Ye(E,"renderCustomized",function(O,T,k){return b.cloneElement(O,ge(ge({key:"recharts-customized-".concat(k)},E.props),E.state))}),Ye(E,"renderMap",{CartesianGrid:{handler:sh,once:!0},ReferenceArea:{handler:E.renderReferenceElement},ReferenceLine:{handler:sh},ReferenceDot:{handler:E.renderReferenceElement},XAxis:{handler:sh},YAxis:{handler:sh},Brush:{handler:E.renderBrush,once:!0},Bar:{handler:E.renderGraphicChild},Line:{handler:E.renderGraphicChild},Area:{handler:E.renderGraphicChild},Radar:{handler:E.renderGraphicChild},RadialBar:{handler:E.renderGraphicChild},Scatter:{handler:E.renderGraphicChild},Pie:{handler:E.renderGraphicChild},Funnel:{handler:E.renderGraphicChild},Tooltip:{handler:E.renderCursor,once:!0},PolarGrid:{handler:E.renderPolarGrid,once:!0},PolarAngleAxis:{handler:E.renderPolarAxis},PolarRadiusAxis:{handler:E.renderPolarAxis},Customized:{handler:E.renderCustomized}}),E.clipPathId="".concat((C=N.id)!==null&&C!==void 0?C:Gl("recharts"),"-clip"),E.throttleTriggeredAfterMouseMove=SL(E.triggeredAfterMouseMove,(A=N.throttleDelay)!==null&&A!==void 0?A:1e3/60),E.state={},E}return bie(j,w),gie(j,[{key:"componentDidMount",value:function(){var C,A;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(C=this.props.margin.left)!==null&&C!==void 0?C:0,top:(A=this.props.margin.top)!==null&&A!==void 0?A:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var C=this.props,A=C.children,E=C.data,O=C.height,T=C.layout,k=bn(A,Sn);if(k){var M=k.props.defaultIndex;if(!(typeof M!="number"||M<0||M>this.state.tooltipTicks.length-1)){var L=this.state.tooltipTicks[M]&&this.state.tooltipTicks[M].value,$=AS(this.state,E,M,L),I=this.state.tooltipTicks[M].coordinate,H=(this.state.offset.top+O)/2,Y=T==="horizontal",W=Y?{x:I,y:H}:{y:I,x:H},V=this.state.formattedGraphicalItems.find(function(F){var te=F.item;return te.type.name==="Scatter"});V&&(W=ge(ge({},W),V.props.points[M].tooltipPosition),$=V.props.points[M].tooltipPayload);var K={activeTooltipIndex:M,isTooltipActive:!0,activeLabel:L,activePayload:$,activeCoordinate:W};this.setState(K),this.renderCursor(k),this.accessibilityManager.setIndex(M)}}}},{key:"getSnapshotBeforeUpdate",value:function(C,A){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==A.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==C.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==C.margin){var E,O;this.accessibilityManager.setDetails({offset:{left:(E=this.props.margin.left)!==null&&E!==void 0?E:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0}})}return null}},{key:"componentDidUpdate",value:function(C){fw([bn(C.children,Sn)],[bn(this.props.children,Sn)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var C=bn(this.props.children,Sn);if(C&&typeof C.props.shared=="boolean"){var A=C.props.shared?"axis":"item";return u.indexOf(A)>=0?A:i}return i}},{key:"getMouseInfo",value:function(C){if(!this.container)return null;var A=this.container,E=A.getBoundingClientRect(),O=qW(E),T={chartX:Math.round(C.pageX-O.left),chartY:Math.round(C.pageY-O.top)},k=E.width/A.offsetWidth||1,M=this.inRange(T.chartX,T.chartY,k);if(!M)return null;var L=this.state,$=L.xAxisMap,I=L.yAxisMap,H=this.getTooltipEventType(),Y=MR(this.state,this.props.data,this.props.layout,M);if(H!=="axis"&&$&&I){var W=to($).scale,V=to(I).scale,K=W&&W.invert?W.invert(T.chartX):null,F=V&&V.invert?V.invert(T.chartY):null;return ge(ge({},T),{},{xValue:K,yValue:F},Y)}return Y?ge(ge({},T),Y):null}},{key:"inRange",value:function(C,A){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,O=this.props.layout,T=C/E,k=A/E;if(O==="horizontal"||O==="vertical"){var M=this.state.offset,L=T>=M.left&&T<=M.left+M.width&&k>=M.top&&k<=M.top+M.height;return L?{x:T,y:k}:null}var $=this.state,I=$.angleAxisMap,H=$.radiusAxisMap;if(I&&H){var Y=to(I);return B2({x:T,y:k},Y)}return null}},{key:"parseEventsOfWrapper",value:function(){var C=this.props.children,A=this.getTooltipEventType(),E=bn(C,Sn),O={};E&&A==="axis"&&(E.props.trigger==="click"?O={onClick:this.handleClick}:O={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var T=fp(this.props,this.handleOuterEvent);return ge(ge({},T),O)}},{key:"addListener",value:function(){I1.on(M1,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){I1.removeListener(M1,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(C,A,E){for(var O=this.state.formattedGraphicalItems,T=0,k=O.length;To.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg border border-gray-100 hover:bg-gray-100 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-600 font-bold text-xs",children:e.template.substring(0,2)}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-gray-900",children:e.product}),o.jsxs("p",{className:"text-xs text-gray-500",children:[e.id," • ",e.user]})]})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("span",{className:"text-xs text-gray-500 font-medium",children:e.time}),o.jsx($r,{variant:"secondary",className:e.status==="expired"?"bg-red-100 text-red-700":"bg-green-100 text-green-700",children:e.status})]})]},e.id))})})]})]}),o.jsx("div",{className:"space-y-6",children:o.jsxs(wn,{className:"shadow-sm border-gray-200",children:[o.jsx(ca,{children:o.jsxs(ua,{className:"text-base font-bold text-gray-800 flex items-center gap-2",children:[o.jsx(mu,{className:"w-5 h-5 text-gray-500"}),"By Category"]})}),o.jsxs(Un,{children:[o.jsxs("div",{className:"h-[200px] relative",children:[o.jsx(Sp,{width:"100%",height:"100%",children:o.jsxs(Lie,{children:[o.jsx(Oi,{data:L1,cx:"50%",cy:"50%",innerRadius:60,outerRadius:80,paddingAngle:5,dataKey:"value",children:L1.map((e,t)=>o.jsx($m,{fill:e.color},`cell-${t}`))}),o.jsx(Sn,{})]})}),o.jsxs("div",{className:"absolute inset-0 flex items-center justify-center flex-col pointer-events-none",children:[o.jsx("span",{className:"text-2xl font-bold text-gray-900",children:"1000"}),o.jsx("span",{className:"text-xs text-gray-500",children:"Total"})]})]}),o.jsx("div",{className:"mt-4 space-y-2",children:L1.map(e=>o.jsxs("div",{className:"flex items-center justify-between text-sm",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:e.color}}),o.jsx("span",{className:"text-gray-600",children:e.name})]}),o.jsx("span",{className:"font-medium text-gray-900",children:e.value})]},e.name))})]})]})})]})]})}function Fs({title:e,value:t,trend:r,trendUp:n,icon:a,color:i,bgColor:s}){return o.jsx(wn,{className:"border-gray-200 shadow-sm hover:shadow-md transition-shadow",children:o.jsxs(Un,{className:"p-6",children:[o.jsxs("div",{className:"flex justify-between items-start",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium text-gray-500 mb-1",children:e}),o.jsx("h3",{className:"text-2xl font-bold text-gray-900",children:t})]}),o.jsx("div",{className:`p-2 rounded-lg ${s}`,children:o.jsx(a,{className:`w-5 h-5 ${i}`})})]}),o.jsxs("div",{className:"mt-4 flex items-center text-sm",children:[n?o.jsx(TM,{className:"w-4 h-4 text-green-500 mr-1"}):o.jsx(q8,{className:"w-4 h-4 text-red-500 mr-1"}),o.jsx("span",{className:n?"text-green-600 font-medium":"text-red-600 font-medium",children:r}),o.jsx("span",{className:"text-gray-400 ml-1",children:"Vs. last period"})]})]})})}function zie({title:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[1,2,3,4].map(t=>o.jsxs(wn,{children:[o.jsx(ca,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:o.jsxs(ua,{className:"text-sm font-medium",children:["Metric ",t]})}),o.jsxs(Un,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"000"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"+0.0% from last month"})]})]},t))}),o.jsx(wn,{className:"min-h-[400px] flex items-center justify-center border-dashed",children:o.jsxs("div",{className:"text-center text-muted-foreground",children:[o.jsxs("h3",{className:"text-lg font-medium",children:[e," Module"]}),o.jsx("p",{children:"This module is currently under development."})]})})]})}function Fr({className:e,...t}){return o.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:o.jsx("table",{"data-slot":"table",className:Ee("w-full caption-bottom text-sm",e),...t})})}function Br({className:e,...t}){return o.jsx("thead",{"data-slot":"table-header",className:Ee("[&_tr]:border-b",e),...t})}function zr({className:e,...t}){return o.jsx("tbody",{"data-slot":"table-body",className:Ee("[&_tr:last-child]:border-0",e),...t})}function Be({className:e,...t}){return o.jsx("tr",{"data-slot":"table-row",className:Ee("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function xe({className:e,...t}){return o.jsx("th",{"data-slot":"table-head",className:Ee("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function fe({className:e,...t}){return o.jsx("td",{"data-slot":"table-cell",className:Ee("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function $R(e){const t=qie(e),r=b.forwardRef((n,a)=>{const{children:i,...s}=n,u=b.Children.toArray(i),d=u.find(Vie);if(d){const c=d.props.children,f=u.map(p=>p===d?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:p);return o.jsx(t,{...s,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,f):null})}return o.jsx(t,{...s,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function qie(e){const t=b.forwardRef((r,n)=>{const{children:a,...i}=r;if(b.isValidElement(a)){const s=Wie(a),u=Hie(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Gn(n,s):s),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Uie=Symbol("radix.slottable");function Vie(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Uie}function Hie(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function Wie(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Gie(e){const t=e+"CollectionProvider",[r,n]=Ni(t),[a,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),s=x=>{const{scope:w,children:j}=x,N=q.useRef(null),C=q.useRef(new Map).current;return o.jsx(a,{scope:w,itemMap:C,collectionRef:N,children:j})};s.displayName=t;const u=e+"CollectionSlot",d=$R(u),c=q.forwardRef((x,w)=>{const{scope:j,children:N}=x,C=i(u,j),A=lt(w,C.collectionRef);return o.jsx(d,{ref:A,children:N})});c.displayName=u;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=$R(f),v=q.forwardRef((x,w)=>{const{scope:j,children:N,...C}=x,A=q.useRef(null),E=lt(w,A),O=i(f,j);return q.useEffect(()=>(O.itemMap.set(A,{ref:A,...C}),()=>void O.itemMap.delete(A))),o.jsx(m,{[p]:"",ref:E,children:N})});v.displayName=f;function y(x){const w=i(e+"CollectionConsumer",x);return q.useCallback(()=>{const N=w.collectionRef.current;if(!N)return[];const C=Array.from(N.querySelectorAll(`[${p}]`));return Array.from(w.itemMap.values()).sort((O,T)=>C.indexOf(O.ref.current)-C.indexOf(T.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:s,Slot:c,ItemSlot:v},y,n]}function Kie(e,t=globalThis?.document){const r=Gr(e);b.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Yie="DismissableLayer",TS="dismissableLayer.update",Xie="dismissableLayer.pointerDownOutside",Jie="dismissableLayer.focusOutside",FR,U4=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),hd=b.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:s,onDismiss:u,...d}=e,c=b.useContext(U4),[f,p]=b.useState(null),m=f?.ownerDocument??globalThis?.document,[,v]=b.useState({}),y=lt(t,T=>p(T)),x=Array.from(c.layers),[w]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),j=x.indexOf(w),N=f?x.indexOf(f):-1,C=c.layersWithOutsidePointerEventsDisabled.size>0,A=N>=j,E=eoe(T=>{const k=T.target,M=[...c.branches].some(L=>L.contains(k));!A||M||(a?.(T),s?.(T),T.defaultPrevented||u?.())},m),O=toe(T=>{const k=T.target;[...c.branches].some(L=>L.contains(k))||(i?.(T),s?.(T),T.defaultPrevented||u?.())},m);return Kie(T=>{N===c.layers.size-1&&(n?.(T),!T.defaultPrevented&&u&&(T.preventDefault(),u()))},m),b.useEffect(()=>{if(f)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(FR=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(f)),c.layers.add(f),BR(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=FR)}},[f,m,r,c]),b.useEffect(()=>()=>{f&&(c.layers.delete(f),c.layersWithOutsidePointerEventsDisabled.delete(f),BR())},[f,c]),b.useEffect(()=>{const T=()=>v({});return document.addEventListener(TS,T),()=>document.removeEventListener(TS,T)},[]),o.jsx(Ze.div,{...d,ref:y,style:{pointerEvents:C?A?"auto":"none":void 0,...e.style},onFocusCapture:tt(e.onFocusCapture,O.onFocusCapture),onBlurCapture:tt(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:tt(e.onPointerDownCapture,E.onPointerDownCapture)})});hd.displayName=Yie;var Qie="DismissableLayerBranch",Zie=b.forwardRef((e,t)=>{const r=b.useContext(U4),n=b.useRef(null),a=lt(t,n);return b.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),o.jsx(Ze.div,{...e,ref:a})});Zie.displayName=Qie;function eoe(e,t=globalThis?.document){const r=Gr(e),n=b.useRef(!1),a=b.useRef(()=>{});return b.useEffect(()=>{const i=u=>{if(u.target&&!n.current){let d=function(){V4(Xie,r,c,{discrete:!0})};const c={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=d,t.addEventListener("click",a.current,{once:!0})):d()}else t.removeEventListener("click",a.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function toe(e,t=globalThis?.document){const r=Gr(e),n=b.useRef(!1);return b.useEffect(()=>{const a=i=>{i.target&&!n.current&&V4(Jie,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function BR(){const e=new CustomEvent(TS);document.dispatchEvent(e)}function V4(e,t,r,{discrete:n}){const a=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?aU(a,i):a.dispatchEvent(i)}var $1=0;function uN(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??zR()),document.body.insertAdjacentElement("beforeend",e[1]??zR()),$1++,()=>{$1===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),$1--}},[])}function zR(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var F1="focusScope.autoFocusOnMount",B1="focusScope.autoFocusOnUnmount",qR={bubbles:!1,cancelable:!0},roe="FocusScope",cg=b.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...s}=e,[u,d]=b.useState(null),c=Gr(a),f=Gr(i),p=b.useRef(null),m=lt(t,x=>d(x)),v=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(n){let x=function(C){if(v.paused||!u)return;const A=C.target;u.contains(A)?p.current=A:Zi(p.current,{select:!0})},w=function(C){if(v.paused||!u)return;const A=C.relatedTarget;A!==null&&(u.contains(A)||Zi(p.current,{select:!0}))},j=function(C){if(document.activeElement===document.body)for(const E of C)E.removedNodes.length>0&&Zi(u)};document.addEventListener("focusin",x),document.addEventListener("focusout",w);const N=new MutationObserver(j);return u&&N.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",w),N.disconnect()}}},[n,u,v.paused]),b.useEffect(()=>{if(u){VR.add(v);const x=document.activeElement;if(!u.contains(x)){const j=new CustomEvent(F1,qR);u.addEventListener(F1,c),u.dispatchEvent(j),j.defaultPrevented||(noe(loe(H4(u)),{select:!0}),document.activeElement===x&&Zi(u))}return()=>{u.removeEventListener(F1,c),setTimeout(()=>{const j=new CustomEvent(B1,qR);u.addEventListener(B1,f),u.dispatchEvent(j),j.defaultPrevented||Zi(x??document.body,{select:!0}),u.removeEventListener(B1,f),VR.remove(v)},0)}}},[u,c,f,v]);const y=b.useCallback(x=>{if(!r&&!n||v.paused)return;const w=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,j=document.activeElement;if(w&&j){const N=x.currentTarget,[C,A]=aoe(N);C&&A?!x.shiftKey&&j===A?(x.preventDefault(),r&&Zi(C,{select:!0})):x.shiftKey&&j===C&&(x.preventDefault(),r&&Zi(A,{select:!0})):j===N&&x.preventDefault()}},[r,n,v.paused]);return o.jsx(Ze.div,{tabIndex:-1,...s,ref:m,onKeyDown:y})});cg.displayName=roe;function noe(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Zi(n,{select:t}),document.activeElement!==r)return}function aoe(e){const t=H4(e),r=UR(t,e),n=UR(t.reverse(),e);return[r,n]}function H4(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function UR(e,t){for(const r of e)if(!ioe(r,{upTo:t}))return r}function ioe(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function ooe(e){return e instanceof HTMLInputElement&&"select"in e}function Zi(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&ooe(e)&&t&&e.select()}}var VR=soe();function soe(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=HR(e,t),e.unshift(t)},remove(t){e=HR(e,t),e[0]?.resume()}}}function HR(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function loe(e){return e.filter(t=>t.tagName!=="A")}var coe=XS[" useId ".trim().toString()]||(()=>{}),uoe=0;function sn(e){const[t,r]=b.useState(coe());return sr(()=>{r(n=>n??String(uoe++))},[e]),e||(t?`radix-${t}`:"")}const doe=["top","right","bottom","left"],oo=Math.min,Nn=Math.max,hm=Math.round,lh=Math.floor,Fa=e=>({x:e,y:e}),foe={left:"right",right:"left",bottom:"top",top:"bottom"},hoe={start:"end",end:"start"};function kS(e,t,r){return Nn(e,oo(t,r))}function yi(e,t){return typeof e=="function"?e(t):e}function xi(e){return e.split("-")[0]}function ec(e){return e.split("-")[1]}function dN(e){return e==="x"?"y":"x"}function fN(e){return e==="y"?"height":"width"}const poe=new Set(["top","bottom"]);function Da(e){return poe.has(xi(e))?"y":"x"}function hN(e){return dN(Da(e))}function moe(e,t,r){r===void 0&&(r=!1);const n=ec(e),a=hN(e),i=fN(a);let s=a==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=pm(s)),[s,pm(s)]}function goe(e){const t=pm(e);return[RS(e),t,RS(t)]}function RS(e){return e.replace(/start|end/g,t=>hoe[t])}const WR=["left","right"],GR=["right","left"],voe=["top","bottom"],yoe=["bottom","top"];function xoe(e,t,r){switch(e){case"top":case"bottom":return r?t?GR:WR:t?WR:GR;case"left":case"right":return t?voe:yoe;default:return[]}}function boe(e,t,r,n){const a=ec(e);let i=xoe(xi(e),r==="start",n);return a&&(i=i.map(s=>s+"-"+a),t&&(i=i.concat(i.map(RS)))),i}function pm(e){return e.replace(/left|right|bottom|top/g,t=>foe[t])}function woe(e){return{top:0,right:0,bottom:0,left:0,...e}}function W4(e){return typeof e!="number"?woe(e):{top:e,right:e,bottom:e,left:e}}function mm(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function KR(e,t,r){let{reference:n,floating:a}=e;const i=Da(t),s=hN(t),u=fN(s),d=xi(t),c=i==="y",f=n.x+n.width/2-a.width/2,p=n.y+n.height/2-a.height/2,m=n[u]/2-a[u]/2;let v;switch(d){case"top":v={x:f,y:n.y-a.height};break;case"bottom":v={x:f,y:n.y+n.height};break;case"right":v={x:n.x+n.width,y:p};break;case"left":v={x:n.x-a.width,y:p};break;default:v={x:n.x,y:n.y}}switch(ec(t)){case"start":v[s]-=m*(r&&c?-1:1);break;case"end":v[s]+=m*(r&&c?-1:1);break}return v}async function Soe(e,t){var r;t===void 0&&(t={});const{x:n,y:a,platform:i,rects:s,elements:u,strategy:d}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:m=!1,padding:v=0}=yi(t,e),y=W4(v),w=u[m?p==="floating"?"reference":"floating":p],j=mm(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(w)))==null||r?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(u.floating)),boundary:c,rootBoundary:f,strategy:d})),N=p==="floating"?{x:n,y:a,width:s.floating.width,height:s.floating.height}:s.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),A=await(i.isElement==null?void 0:i.isElement(C))?await(i.getScale==null?void 0:i.getScale(C))||{x:1,y:1}:{x:1,y:1},E=mm(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:N,offsetParent:C,strategy:d}):N);return{top:(j.top-E.top+y.top)/A.y,bottom:(E.bottom-j.bottom+y.bottom)/A.y,left:(j.left-E.left+y.left)/A.x,right:(E.right-j.right+y.right)/A.x}}const joe=async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:i=[],platform:s}=r,u=i.filter(Boolean),d=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:a}),{x:f,y:p}=KR(c,n,d),m=n,v={},y=0;for(let w=0;w({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:i,platform:s,elements:u,middlewareData:d}=t,{element:c,padding:f=0}=yi(e,t)||{};if(c==null)return{};const p=W4(f),m={x:r,y:n},v=hN(a),y=fN(v),x=await s.getDimensions(c),w=v==="y",j=w?"top":"left",N=w?"bottom":"right",C=w?"clientHeight":"clientWidth",A=i.reference[y]+i.reference[v]-m[v]-i.floating[y],E=m[v]-i.reference[v],O=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let T=O?O[C]:0;(!T||!await(s.isElement==null?void 0:s.isElement(O)))&&(T=u.floating[C]||i.floating[y]);const k=A/2-E/2,M=T/2-x[y]/2-1,L=oo(p[j],M),$=oo(p[N],M),I=L,H=T-x[y]-$,Y=T/2-x[y]/2+k,W=kS(I,Y,H),V=!d.arrow&&ec(a)!=null&&Y!==W&&i.reference[y]/2-(YY<=0)){var $,I;const Y=((($=i.flip)==null?void 0:$.index)||0)+1,W=T[Y];if(W&&(!(p==="alignment"?N!==Da(W):!1)||L.every(F=>Da(F.placement)===N?F.overflows[0]>0:!0)))return{data:{index:Y,overflows:L},reset:{placement:W}};let V=(I=L.filter(K=>K.overflows[0]<=0).sort((K,F)=>K.overflows[1]-F.overflows[1])[0])==null?void 0:I.placement;if(!V)switch(v){case"bestFit":{var H;const K=(H=L.filter(F=>{if(O){const te=Da(F.placement);return te===N||te==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(te=>te>0).reduce((te,D)=>te+D,0)]).sort((F,te)=>F[1]-te[1])[0])==null?void 0:H[0];K&&(V=K);break}case"initialPlacement":V=u;break}if(a!==V)return{reset:{placement:V}}}return{}}}};function YR(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function XR(e){return doe.some(t=>e[t]>=0)}const Coe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...i}=yi(e,t);switch(a){case"referenceHidden":{const s=await n.detectOverflow(t,{...i,elementContext:"reference"}),u=YR(s,r.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:XR(u)}}}case"escaped":{const s=await n.detectOverflow(t,{...i,altBoundary:!0}),u=YR(s,r.floating);return{data:{escapedOffsets:u,escaped:XR(u)}}}default:return{}}}}},G4=new Set(["left","top"]);async function Eoe(e,t){const{placement:r,platform:n,elements:a}=e,i=await(n.isRTL==null?void 0:n.isRTL(a.floating)),s=xi(r),u=ec(r),d=Da(r)==="y",c=G4.has(s)?-1:1,f=i&&d?-1:1,p=yi(t,e);let{mainAxis:m,crossAxis:v,alignmentAxis:y}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof y=="number"&&(v=u==="end"?y*-1:y),d?{x:v*f,y:m*c}:{x:m*c,y:v*f}}const Ooe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:i,placement:s,middlewareData:u}=t,d=await Eoe(t,e);return s===((r=u.offset)==null?void 0:r.placement)&&(n=u.arrow)!=null&&n.alignmentOffset?{}:{x:a+d.x,y:i+d.y,data:{...d,placement:s}}}}},Poe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a,platform:i}=t,{mainAxis:s=!0,crossAxis:u=!1,limiter:d={fn:j=>{let{x:N,y:C}=j;return{x:N,y:C}}},...c}=yi(e,t),f={x:r,y:n},p=await i.detectOverflow(t,c),m=Da(xi(a)),v=dN(m);let y=f[v],x=f[m];if(s){const j=v==="y"?"top":"left",N=v==="y"?"bottom":"right",C=y+p[j],A=y-p[N];y=kS(C,y,A)}if(u){const j=m==="y"?"top":"left",N=m==="y"?"bottom":"right",C=x+p[j],A=x-p[N];x=kS(C,x,A)}const w=d.fn({...t,[v]:y,[m]:x});return{...w,data:{x:w.x-r,y:w.y-n,enabled:{[v]:s,[m]:u}}}}}},Aoe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:i,middlewareData:s}=t,{offset:u=0,mainAxis:d=!0,crossAxis:c=!0}=yi(e,t),f={x:r,y:n},p=Da(a),m=dN(p);let v=f[m],y=f[p];const x=yi(u,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(d){const C=m==="y"?"height":"width",A=i.reference[m]-i.floating[C]+w.mainAxis,E=i.reference[m]+i.reference[C]-w.mainAxis;vE&&(v=E)}if(c){var j,N;const C=m==="y"?"width":"height",A=G4.has(xi(a)),E=i.reference[p]-i.floating[C]+(A&&((j=s.offset)==null?void 0:j[p])||0)+(A?0:w.crossAxis),O=i.reference[p]+i.reference[C]+(A?0:((N=s.offset)==null?void 0:N[p])||0)-(A?w.crossAxis:0);yO&&(y=O)}return{[m]:v,[p]:y}}}},Toe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:i,platform:s,elements:u}=t,{apply:d=()=>{},...c}=yi(e,t),f=await s.detectOverflow(t,c),p=xi(a),m=ec(a),v=Da(a)==="y",{width:y,height:x}=i.floating;let w,j;p==="top"||p==="bottom"?(w=p,j=m===(await(s.isRTL==null?void 0:s.isRTL(u.floating))?"start":"end")?"left":"right"):(j=p,w=m==="end"?"top":"bottom");const N=x-f.top-f.bottom,C=y-f.left-f.right,A=oo(x-f[w],N),E=oo(y-f[j],C),O=!t.middlewareData.shift;let T=A,k=E;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(k=C),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(T=N),O&&!m){const L=Nn(f.left,0),$=Nn(f.right,0),I=Nn(f.top,0),H=Nn(f.bottom,0);v?k=y-2*(L!==0||$!==0?L+$:Nn(f.left,f.right)):T=x-2*(I!==0||H!==0?I+H:Nn(f.top,f.bottom))}await d({...t,availableWidth:k,availableHeight:T});const M=await s.getDimensions(u.floating);return y!==M.width||x!==M.height?{reset:{rects:!0}}:{}}}};function ug(){return typeof window<"u"}function tc(e){return K4(e)?(e.nodeName||"").toLowerCase():"#document"}function Pn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ga(e){var t;return(t=(K4(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function K4(e){return ug()?e instanceof Node||e instanceof Pn(e).Node:!1}function ga(e){return ug()?e instanceof Element||e instanceof Pn(e).Element:!1}function qa(e){return ug()?e instanceof HTMLElement||e instanceof Pn(e).HTMLElement:!1}function JR(e){return!ug()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Pn(e).ShadowRoot}const koe=new Set(["inline","contents"]);function pd(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=va(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!koe.has(a)}const Roe=new Set(["table","td","th"]);function Ioe(e){return Roe.has(tc(e))}const Moe=[":popover-open",":modal"];function dg(e){return Moe.some(t=>{try{return e.matches(t)}catch{return!1}})}const Doe=["transform","translate","scale","rotate","perspective"],Loe=["transform","translate","scale","rotate","perspective","filter"],$oe=["paint","layout","strict","content"];function pN(e){const t=mN(),r=ga(e)?va(e):e;return Doe.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||Loe.some(n=>(r.willChange||"").includes(n))||$oe.some(n=>(r.contain||"").includes(n))}function Foe(e){let t=so(e);for(;qa(t)&&!$l(t);){if(pN(t))return t;if(dg(t))return null;t=so(t)}return null}function mN(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Boe=new Set(["html","body","#document"]);function $l(e){return Boe.has(tc(e))}function va(e){return Pn(e).getComputedStyle(e)}function fg(e){return ga(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function so(e){if(tc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||JR(e)&&e.host||Ga(e);return JR(t)?t.host:t}function Y4(e){const t=so(e);return $l(t)?e.ownerDocument?e.ownerDocument.body:e.body:qa(t)&&pd(t)?t:Y4(t)}function Ju(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const a=Y4(e),i=a===((n=e.ownerDocument)==null?void 0:n.body),s=Pn(a);if(i){const u=IS(s);return t.concat(s,s.visualViewport||[],pd(a)?a:[],u&&r?Ju(u):[])}return t.concat(a,Ju(a,[],r))}function IS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function X4(e){const t=va(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=qa(e),i=a?e.offsetWidth:r,s=a?e.offsetHeight:n,u=hm(r)!==i||hm(n)!==s;return u&&(r=i,n=s),{width:r,height:n,$:u}}function gN(e){return ga(e)?e:e.contextElement}function ol(e){const t=gN(e);if(!qa(t))return Fa(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:i}=X4(t);let s=(i?hm(r.width):r.width)/n,u=(i?hm(r.height):r.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!u||!Number.isFinite(u))&&(u=1),{x:s,y:u}}const zoe=Fa(0);function J4(e){const t=Pn(e);return!mN()||!t.visualViewport?zoe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qoe(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Pn(e)?!1:t}function Zo(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const a=e.getBoundingClientRect(),i=gN(e);let s=Fa(1);t&&(n?ga(n)&&(s=ol(n)):s=ol(e));const u=qoe(i,r,n)?J4(i):Fa(0);let d=(a.left+u.x)/s.x,c=(a.top+u.y)/s.y,f=a.width/s.x,p=a.height/s.y;if(i){const m=Pn(i),v=n&&ga(n)?Pn(n):n;let y=m,x=IS(y);for(;x&&n&&v!==y;){const w=ol(x),j=x.getBoundingClientRect(),N=va(x),C=j.left+(x.clientLeft+parseFloat(N.paddingLeft))*w.x,A=j.top+(x.clientTop+parseFloat(N.paddingTop))*w.y;d*=w.x,c*=w.y,f*=w.x,p*=w.y,d+=C,c+=A,y=Pn(x),x=IS(y)}}return mm({width:f,height:p,x:d,y:c})}function hg(e,t){const r=fg(e).scrollLeft;return t?t.left+r:Zo(Ga(e)).left+r}function Q4(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-hg(e,r),a=r.top+t.scrollTop;return{x:n,y:a}}function Uoe(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const i=a==="fixed",s=Ga(n),u=t?dg(t.floating):!1;if(n===s||u&&i)return r;let d={scrollLeft:0,scrollTop:0},c=Fa(1);const f=Fa(0),p=qa(n);if((p||!p&&!i)&&((tc(n)!=="body"||pd(s))&&(d=fg(n)),qa(n))){const v=Zo(n);c=ol(n),f.x=v.x+n.clientLeft,f.y=v.y+n.clientTop}const m=s&&!p&&!i?Q4(s,d):Fa(0);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-d.scrollLeft*c.x+f.x+m.x,y:r.y*c.y-d.scrollTop*c.y+f.y+m.y}}function Voe(e){return Array.from(e.getClientRects())}function Hoe(e){const t=Ga(e),r=fg(e),n=e.ownerDocument.body,a=Nn(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=Nn(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-r.scrollLeft+hg(e);const u=-r.scrollTop;return va(n).direction==="rtl"&&(s+=Nn(t.clientWidth,n.clientWidth)-a),{width:a,height:i,x:s,y:u}}const QR=25;function Woe(e,t){const r=Pn(e),n=Ga(e),a=r.visualViewport;let i=n.clientWidth,s=n.clientHeight,u=0,d=0;if(a){i=a.width,s=a.height;const f=mN();(!f||f&&t==="fixed")&&(u=a.offsetLeft,d=a.offsetTop)}const c=hg(n);if(c<=0){const f=n.ownerDocument,p=f.body,m=getComputedStyle(p),v=f.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,y=Math.abs(n.clientWidth-p.clientWidth-v);y<=QR&&(i-=y)}else c<=QR&&(i+=c);return{width:i,height:s,x:u,y:d}}const Goe=new Set(["absolute","fixed"]);function Koe(e,t){const r=Zo(e,!0,t==="fixed"),n=r.top+e.clientTop,a=r.left+e.clientLeft,i=qa(e)?ol(e):Fa(1),s=e.clientWidth*i.x,u=e.clientHeight*i.y,d=a*i.x,c=n*i.y;return{width:s,height:u,x:d,y:c}}function ZR(e,t,r){let n;if(t==="viewport")n=Woe(e,r);else if(t==="document")n=Hoe(Ga(e));else if(ga(t))n=Koe(t,r);else{const a=J4(e);n={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return mm(n)}function Z4(e,t){const r=so(e);return r===t||!ga(r)||$l(r)?!1:va(r).position==="fixed"||Z4(r,t)}function Yoe(e,t){const r=t.get(e);if(r)return r;let n=Ju(e,[],!1).filter(u=>ga(u)&&tc(u)!=="body"),a=null;const i=va(e).position==="fixed";let s=i?so(e):e;for(;ga(s)&&!$l(s);){const u=va(s),d=pN(s);!d&&u.position==="fixed"&&(a=null),(i?!d&&!a:!d&&u.position==="static"&&!!a&&Goe.has(a.position)||pd(s)&&!d&&Z4(e,s))?n=n.filter(f=>f!==s):a=u,s=so(s)}return t.set(e,n),n}function Xoe(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const s=[...r==="clippingAncestors"?dg(t)?[]:Yoe(t,this._c):[].concat(r),n],u=s[0],d=s.reduce((c,f)=>{const p=ZR(t,f,a);return c.top=Nn(p.top,c.top),c.right=oo(p.right,c.right),c.bottom=oo(p.bottom,c.bottom),c.left=Nn(p.left,c.left),c},ZR(t,u,a));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function Joe(e){const{width:t,height:r}=X4(e);return{width:t,height:r}}function Qoe(e,t,r){const n=qa(t),a=Ga(t),i=r==="fixed",s=Zo(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const d=Fa(0);function c(){d.x=hg(a)}if(n||!n&&!i)if((tc(t)!=="body"||pd(a))&&(u=fg(t)),n){const v=Zo(t,!0,i,t);d.x=v.x+t.clientLeft,d.y=v.y+t.clientTop}else a&&c();i&&!n&&a&&c();const f=a&&!n&&!i?Q4(a,u):Fa(0),p=s.left+u.scrollLeft-d.x-f.x,m=s.top+u.scrollTop-d.y-f.y;return{x:p,y:m,width:s.width,height:s.height}}function z1(e){return va(e).position==="static"}function eI(e,t){if(!qa(e)||va(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Ga(e)===r&&(r=r.ownerDocument.body),r}function e3(e,t){const r=Pn(e);if(dg(e))return r;if(!qa(e)){let a=so(e);for(;a&&!$l(a);){if(ga(a)&&!z1(a))return a;a=so(a)}return r}let n=eI(e,t);for(;n&&Ioe(n)&&z1(n);)n=eI(n,t);return n&&$l(n)&&z1(n)&&!pN(n)?r:n||Foe(e)||r}const Zoe=async function(e){const t=this.getOffsetParent||e3,r=this.getDimensions,n=await r(e.floating);return{reference:Qoe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function ese(e){return va(e).direction==="rtl"}const tse={convertOffsetParentRelativeRectToViewportRelativeRect:Uoe,getDocumentElement:Ga,getClippingRect:Xoe,getOffsetParent:e3,getElementRects:Zoe,getClientRects:Voe,getDimensions:Joe,getScale:ol,isElement:ga,isRTL:ese};function t3(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function rse(e,t){let r=null,n;const a=Ga(e);function i(){var u;clearTimeout(n),(u=r)==null||u.disconnect(),r=null}function s(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),i();const c=e.getBoundingClientRect(),{left:f,top:p,width:m,height:v}=c;if(u||t(),!m||!v)return;const y=lh(p),x=lh(a.clientWidth-(f+m)),w=lh(a.clientHeight-(p+v)),j=lh(f),C={rootMargin:-y+"px "+-x+"px "+-w+"px "+-j+"px",threshold:Nn(0,oo(1,d))||1};let A=!0;function E(O){const T=O[0].intersectionRatio;if(T!==d){if(!A)return s();T?s(!1,T):n=setTimeout(()=>{s(!1,1e-7)},1e3)}T===1&&!t3(c,e.getBoundingClientRect())&&s(),A=!1}try{r=new IntersectionObserver(E,{...C,root:a.ownerDocument})}catch{r=new IntersectionObserver(E,C)}r.observe(e)}return s(!0),i}function nse(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=n,c=gN(e),f=a||i?[...c?Ju(c):[],...Ju(t)]:[];f.forEach(j=>{a&&j.addEventListener("scroll",r,{passive:!0}),i&&j.addEventListener("resize",r)});const p=c&&u?rse(c,r):null;let m=-1,v=null;s&&(v=new ResizeObserver(j=>{let[N]=j;N&&N.target===c&&v&&(v.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var C;(C=v)==null||C.observe(t)})),r()}),c&&!d&&v.observe(c),v.observe(t));let y,x=d?Zo(e):null;d&&w();function w(){const j=Zo(e);x&&!t3(x,j)&&r(),x=j,y=requestAnimationFrame(w)}return r(),()=>{var j;f.forEach(N=>{a&&N.removeEventListener("scroll",r),i&&N.removeEventListener("resize",r)}),p?.(),(j=v)==null||j.disconnect(),v=null,d&&cancelAnimationFrame(y)}}const ase=Ooe,ise=Poe,ose=_oe,sse=Toe,lse=Coe,tI=Noe,cse=Aoe,use=(e,t,r)=>{const n=new Map,a={platform:tse,...r},i={...a.platform,_c:n};return joe(e,t,{...a,platform:i})};var dse=typeof document<"u",fse=function(){},ep=dse?b.useLayoutEffect:fse;function gm(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!gm(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;n--!==0;){const i=a[n];if(!(i==="_owner"&&e.$$typeof)&&!gm(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function r3(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function rI(e,t){const r=r3(e);return Math.round(t*r)/r}function q1(e){const t=b.useRef(e);return ep(()=>{t.current=e}),t}function hse(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:i,floating:s}={},transform:u=!0,whileElementsMounted:d,open:c}=e,[f,p]=b.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,v]=b.useState(n);gm(m,n)||v(n);const[y,x]=b.useState(null),[w,j]=b.useState(null),N=b.useCallback(F=>{F!==O.current&&(O.current=F,x(F))},[]),C=b.useCallback(F=>{F!==T.current&&(T.current=F,j(F))},[]),A=i||y,E=s||w,O=b.useRef(null),T=b.useRef(null),k=b.useRef(f),M=d!=null,L=q1(d),$=q1(a),I=q1(c),H=b.useCallback(()=>{if(!O.current||!T.current)return;const F={placement:t,strategy:r,middleware:m};$.current&&(F.platform=$.current),use(O.current,T.current,F).then(te=>{const D={...te,isPositioned:I.current!==!1};Y.current&&!gm(k.current,D)&&(k.current=D,nd.flushSync(()=>{p(D)}))})},[m,t,r,$,I]);ep(()=>{c===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,p(F=>({...F,isPositioned:!1})))},[c]);const Y=b.useRef(!1);ep(()=>(Y.current=!0,()=>{Y.current=!1}),[]),ep(()=>{if(A&&(O.current=A),E&&(T.current=E),A&&E){if(L.current)return L.current(A,E,H);H()}},[A,E,H,L,M]);const W=b.useMemo(()=>({reference:O,floating:T,setReference:N,setFloating:C}),[N,C]),V=b.useMemo(()=>({reference:A,floating:E}),[A,E]),K=b.useMemo(()=>{const F={position:r,left:0,top:0};if(!V.floating)return F;const te=rI(V.floating,f.x),D=rI(V.floating,f.y);return u?{...F,transform:"translate("+te+"px, "+D+"px)",...r3(V.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:te,top:D}},[r,u,V.floating,f.x,f.y]);return b.useMemo(()=>({...f,update:H,refs:W,elements:V,floatingStyles:K}),[f,H,W,V,K])}const pse=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:a}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?tI({element:n.current,padding:a}).fn(r):{}:n?tI({element:n,padding:a}).fn(r):{}}}},mse=(e,t)=>({...ase(e),options:[e,t]}),gse=(e,t)=>({...ise(e),options:[e,t]}),vse=(e,t)=>({...cse(e),options:[e,t]}),yse=(e,t)=>({...ose(e),options:[e,t]}),xse=(e,t)=>({...sse(e),options:[e,t]}),bse=(e,t)=>({...lse(e),options:[e,t]}),wse=(e,t)=>({...pse(e),options:[e,t]});var Sse="Arrow",n3=b.forwardRef((e,t)=>{const{children:r,width:n=10,height:a=5,...i}=e;return o.jsx(Ze.svg,{...i,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});n3.displayName=Sse;var jse=n3;function vN(e){const[t,r]=b.useState(void 0);return sr(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let s,u;if("borderBoxSize"in i){const d=i.borderBoxSize,c=Array.isArray(d)?d[0]:d;s=c.inlineSize,u=c.blockSize}else s=e.offsetWidth,u=e.offsetHeight;r({width:s,height:u})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var yN="Popper",[a3,rc]=Ni(yN),[Nse,i3]=a3(yN),o3=e=>{const{__scopePopper:t,children:r}=e,[n,a]=b.useState(null);return o.jsx(Nse,{scope:t,anchor:n,onAnchorChange:a,children:r})};o3.displayName=yN;var s3="PopperAnchor",l3=b.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...a}=e,i=i3(s3,r),s=b.useRef(null),u=lt(t,s),d=b.useRef(null);return b.useEffect(()=>{const c=d.current;d.current=n?.current||s.current,c!==d.current&&i.onAnchorChange(d.current)}),n?null:o.jsx(Ze.div,{...a,ref:u})});l3.displayName=s3;var xN="PopperContent",[_se,Cse]=a3(xN),c3=b.forwardRef((e,t)=>{const{__scopePopper:r,side:n="bottom",sideOffset:a=0,align:i="center",alignOffset:s=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:c=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:v="optimized",onPlaced:y,...x}=e,w=i3(xN,r),[j,N]=b.useState(null),C=lt(t,G=>N(G)),[A,E]=b.useState(null),O=vN(A),T=O?.width??0,k=O?.height??0,M=n+(i!=="center"?"-"+i:""),L=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},$=Array.isArray(c)?c:[c],I=$.length>0,H={padding:L,boundary:$.filter(Ose),altBoundary:I},{refs:Y,floatingStyles:W,placement:V,isPositioned:K,middlewareData:F}=hse({strategy:"fixed",placement:M,whileElementsMounted:(...G)=>nse(...G,{animationFrame:v==="always"}),elements:{reference:w.anchor},middleware:[mse({mainAxis:a+k,alignmentAxis:s}),d&&gse({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?vse():void 0,...H}),d&&yse({...H}),xse({...H,apply:({elements:G,rects:Z,availableWidth:ee,availableHeight:ce})=>{const{width:ve,height:ne}=Z.reference,Ce=G.floating.style;Ce.setProperty("--radix-popper-available-width",`${ee}px`),Ce.setProperty("--radix-popper-available-height",`${ce}px`),Ce.setProperty("--radix-popper-anchor-width",`${ve}px`),Ce.setProperty("--radix-popper-anchor-height",`${ne}px`)}}),A&&wse({element:A,padding:u}),Pse({arrowWidth:T,arrowHeight:k}),m&&bse({strategy:"referenceHidden",...H})]}),[te,D]=f3(V),U=Gr(y);sr(()=>{K&&U?.()},[K,U]);const z=F.arrow?.x,B=F.arrow?.y,X=F.arrow?.centerOffset!==0,[Q,re]=b.useState();return sr(()=>{j&&re(window.getComputedStyle(j).zIndex)},[j]),o.jsx("div",{ref:Y.setFloating,"data-radix-popper-content-wrapper":"",style:{...W,transform:K?W.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(_se,{scope:r,placedSide:te,onArrowChange:E,arrowX:z,arrowY:B,shouldHideArrow:X,children:o.jsx(Ze.div,{"data-side":te,"data-align":D,...x,ref:C,style:{...x.style,animation:K?void 0:"none"}})})})});c3.displayName=xN;var u3="PopperArrow",Ese={top:"bottom",right:"left",bottom:"top",left:"right"},d3=b.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,i=Cse(u3,n),s=Ese[i.placedSide];return o.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:o.jsx(jse,{...a,ref:r,style:{...a.style,display:"block"}})})});d3.displayName=u3;function Ose(e){return e!==null}var Pse=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,s=a.arrow?.centerOffset!==0,u=s?0:e.arrowWidth,d=s?0:e.arrowHeight,[c,f]=f3(r),p={start:"0%",center:"50%",end:"100%"}[f],m=(a.arrow?.x??0)+u/2,v=(a.arrow?.y??0)+d/2;let y="",x="";return c==="bottom"?(y=s?p:`${m}px`,x=`${-d}px`):c==="top"?(y=s?p:`${m}px`,x=`${n.floating.height+d}px`):c==="right"?(y=`${-d}px`,x=s?p:`${v}px`):c==="left"&&(y=`${n.floating.width+d}px`,x=s?p:`${v}px`),{data:{x:y,y:x}}}});function f3(e){const[t,r="center"]=e.split("-");return[t,r]}var bN=o3,pg=l3,wN=c3,SN=d3,Ase="Portal",md=b.forwardRef((e,t)=>{const{container:r,...n}=e,[a,i]=b.useState(!1);sr(()=>i(!0),[]);const s=r||a&&globalThis?.document?.body;return s?OM.createPortal(o.jsx(Ze.div,{...n,ref:t}),s):null});md.displayName=Ase;function Tse(e){const t=kse(e),r=b.forwardRef((n,a)=>{const{children:i,...s}=n,u=b.Children.toArray(i),d=u.find(Ise);if(d){const c=d.props.children,f=u.map(p=>p===d?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:p);return o.jsx(t,{...s,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,f):null})}return o.jsx(t,{...s,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function kse(e){const t=b.forwardRef((r,n)=>{const{children:a,...i}=r;if(b.isValidElement(a)){const s=Dse(a),u=Mse(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Gn(n,s):s),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Rse=Symbol("radix.slottable");function Ise(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Rse}function Mse(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function Dse(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Lse=XS[" useInsertionEffect ".trim().toString()]||sr;function es({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,i,s]=$se({defaultProp:t,onChange:r}),u=e!==void 0,d=u?e:a;{const f=b.useRef(e!==void 0);b.useEffect(()=>{const p=f.current;p!==u&&console.warn(`${n} is changing from ${p?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=u},[u,n])}const c=b.useCallback(f=>{if(u){const p=Fse(f)?f(e):f;p!==e&&s.current?.(p)}else i(f)},[u,e,i,s]);return[d,c]}function $se({defaultProp:e,onChange:t}){const[r,n]=b.useState(e),a=b.useRef(r),i=b.useRef(t);return Lse(()=>{i.current=t},[t]),b.useEffect(()=>{a.current!==r&&(i.current?.(r),a.current=r)},[r,a]),[r,n,i]}function Fse(e){return typeof e=="function"}function jN(e){const t=b.useRef({value:e,previous:e});return b.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var h3=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Bse="VisuallyHidden",p3=b.forwardRef((e,t)=>o.jsx(Ze.span,{...e,ref:t,style:{...h3,...e.style}}));p3.displayName=Bse;var zse=p3,qse=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Bs=new WeakMap,ch=new WeakMap,uh={},U1=0,m3=function(e){return e&&(e.host||m3(e.parentNode))},Use=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=m3(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Vse=function(e,t,r,n){var a=Use(t,Array.isArray(e)?e:[e]);uh[r]||(uh[r]=new WeakMap);var i=uh[r],s=[],u=new Set,d=new Set(a),c=function(p){!p||u.has(p)||(u.add(p),c(p.parentNode))};a.forEach(c);var f=function(p){!p||d.has(p)||Array.prototype.forEach.call(p.children,function(m){if(u.has(m))f(m);else try{var v=m.getAttribute(n),y=v!==null&&v!=="false",x=(Bs.get(m)||0)+1,w=(i.get(m)||0)+1;Bs.set(m,x),i.set(m,w),s.push(m),x===1&&y&&ch.set(m,!0),w===1&&m.setAttribute(r,"true"),y||m.setAttribute(n,"true")}catch(j){console.error("aria-hidden: cannot operate on ",m,j)}})};return f(t),u.clear(),U1++,function(){s.forEach(function(p){var m=Bs.get(p)-1,v=i.get(p)-1;Bs.set(p,m),i.set(p,v),m||(ch.has(p)||p.removeAttribute(n),ch.delete(p)),v||p.removeAttribute(r)}),U1--,U1||(Bs=new WeakMap,Bs=new WeakMap,ch=new WeakMap,uh={})}},NN=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=qse(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),Vse(n,a,r,"aria-hidden")):function(){return null}},Ia=function(){return Ia=Object.assign||function(t){for(var r,n=1,a=arguments.length;n"u")return sle;var t=lle(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},ule=x3(),sl="data-scroll-locked",dle=function(e,t,r,n){var a=e.left,i=e.top,s=e.right,u=e.gap;return r===void 0&&(r="margin"),` + .`.concat(Wse,` { + overflow: hidden `).concat(n,`; + padding-right: `).concat(u,"px ").concat(n,`; + } + body[`).concat(sl,`] { + overflow: hidden `).concat(n,`; + overscroll-behavior: contain; + `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&` + padding-left: `.concat(a,`px; + padding-top: `).concat(i,`px; + padding-right: `).concat(s,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(u,"px ").concat(n,`; + `),r==="padding"&&"padding-right: ".concat(u,"px ").concat(n,";")].filter(Boolean).join(""),` + } + + .`).concat(tp,` { + right: `).concat(u,"px ").concat(n,`; + } + + .`).concat(rp,` { + margin-right: `).concat(u,"px ").concat(n,`; + } + + .`).concat(tp," .").concat(tp,` { + right: 0 `).concat(n,`; + } + + .`).concat(rp," .").concat(rp,` { + margin-right: 0 `).concat(n,`; + } + + body[`).concat(sl,`] { + `).concat(Gse,": ").concat(u,`px; + } +`)},aI=function(){var e=parseInt(document.body.getAttribute(sl)||"0",10);return isFinite(e)?e:0},fle=function(){b.useEffect(function(){return document.body.setAttribute(sl,(aI()+1).toString()),function(){var e=aI()-1;e<=0?document.body.removeAttribute(sl):document.body.setAttribute(sl,e.toString())}},[])},hle=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=n===void 0?"margin":n;fle();var i=b.useMemo(function(){return cle(a)},[a]);return b.createElement(ule,{styles:dle(i,!t,a,r?"":"!important")})},MS=!1;if(typeof window<"u")try{var dh=Object.defineProperty({},"passive",{get:function(){return MS=!0,!0}});window.addEventListener("test",dh,dh),window.removeEventListener("test",dh,dh)}catch{MS=!1}var zs=MS?{passive:!1}:!1,ple=function(e){return e.tagName==="TEXTAREA"},b3=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!ple(e)&&r[t]==="visible")},mle=function(e){return b3(e,"overflowY")},gle=function(e){return b3(e,"overflowX")},iI=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=w3(e,n);if(a){var i=S3(e,n),s=i[1],u=i[2];if(s>u)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},vle=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},yle=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},w3=function(e,t){return e==="v"?mle(t):gle(t)},S3=function(e,t){return e==="v"?vle(t):yle(t)},xle=function(e,t){return e==="h"&&t==="rtl"?-1:1},ble=function(e,t,r,n,a){var i=xle(e,window.getComputedStyle(t).direction),s=i*n,u=r.target,d=t.contains(u),c=!1,f=s>0,p=0,m=0;do{if(!u)break;var v=S3(e,u),y=v[0],x=v[1],w=v[2],j=x-w-i*y;(y||j)&&w3(e,u)&&(p+=j,m+=y);var N=u.parentNode;u=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!d&&u!==document.body||d&&(t.contains(u)||t===u));return(f&&Math.abs(p)<1||!f&&Math.abs(m)<1)&&(c=!0),c},fh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},oI=function(e){return[e.deltaX,e.deltaY]},sI=function(e){return e&&"current"in e?e.current:e},wle=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Sle=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},jle=0,qs=[];function Nle(e){var t=b.useRef([]),r=b.useRef([0,0]),n=b.useRef(),a=b.useState(jle++)[0],i=b.useState(x3)[0],s=b.useRef(e);b.useEffect(function(){s.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var x=Hse([e.lockRef.current],(e.shards||[]).map(sI),!0).filter(Boolean);return x.forEach(function(w){return w.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),x.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var u=b.useCallback(function(x,w){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!s.current.allowPinchZoom;var j=fh(x),N=r.current,C="deltaX"in x?x.deltaX:N[0]-j[0],A="deltaY"in x?x.deltaY:N[1]-j[1],E,O=x.target,T=Math.abs(C)>Math.abs(A)?"h":"v";if("touches"in x&&T==="h"&&O.type==="range")return!1;var k=window.getSelection(),M=k&&k.anchorNode,L=M?M===O||M.contains(O):!1;if(L)return!1;var $=iI(T,O);if(!$)return!0;if($?E=T:(E=T==="v"?"h":"v",$=iI(T,O)),!$)return!1;if(!n.current&&"changedTouches"in x&&(C||A)&&(n.current=E),!E)return!0;var I=n.current||E;return ble(I,w,x,I==="h"?C:A)},[]),d=b.useCallback(function(x){var w=x;if(!(!qs.length||qs[qs.length-1]!==i)){var j="deltaY"in w?oI(w):fh(w),N=t.current.filter(function(E){return E.name===w.type&&(E.target===w.target||w.target===E.shadowParent)&&wle(E.delta,j)})[0];if(N&&N.should){w.cancelable&&w.preventDefault();return}if(!N){var C=(s.current.shards||[]).map(sI).filter(Boolean).filter(function(E){return E.contains(w.target)}),A=C.length>0?u(w,C[0]):!s.current.noIsolation;A&&w.cancelable&&w.preventDefault()}}},[]),c=b.useCallback(function(x,w,j,N){var C={name:x,delta:w,target:j,should:N,shadowParent:_le(j)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(A){return A!==C})},1)},[]),f=b.useCallback(function(x){r.current=fh(x),n.current=void 0},[]),p=b.useCallback(function(x){c(x.type,oI(x),x.target,u(x,e.lockRef.current))},[]),m=b.useCallback(function(x){c(x.type,fh(x),x.target,u(x,e.lockRef.current))},[]);b.useEffect(function(){return qs.push(i),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",d,zs),document.addEventListener("touchmove",d,zs),document.addEventListener("touchstart",f,zs),function(){qs=qs.filter(function(x){return x!==i}),document.removeEventListener("wheel",d,zs),document.removeEventListener("touchmove",d,zs),document.removeEventListener("touchstart",f,zs)}},[]);var v=e.removeScrollBar,y=e.inert;return b.createElement(b.Fragment,null,y?b.createElement(i,{styles:Sle(a)}):null,v?b.createElement(hle,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function _le(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Cle=ele(y3,Nle);var gg=b.forwardRef(function(e,t){return b.createElement(mg,Ia({},e,{ref:t,sideCar:Cle}))});gg.classNames=mg.classNames;var Ele=[" ","Enter","ArrowUp","ArrowDown"],Ole=[" ","Enter"],ts="Select",[vg,yg,Ple]=Gie(ts),[nc]=Ni(ts,[Ple,rc]),xg=rc(),[Ale,po]=nc(ts),[Tle,kle]=nc(ts),j3=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:a,onOpenChange:i,value:s,defaultValue:u,onValueChange:d,dir:c,name:f,autoComplete:p,disabled:m,required:v,form:y}=e,x=xg(t),[w,j]=b.useState(null),[N,C]=b.useState(null),[A,E]=b.useState(!1),O=ZM(c),[T,k]=es({prop:n,defaultProp:a??!1,onChange:i,caller:ts}),[M,L]=es({prop:s,defaultProp:u,onChange:d,caller:ts}),$=b.useRef(null),I=w?y||!!w.closest("form"):!0,[H,Y]=b.useState(new Set),W=Array.from(H).map(V=>V.props.value).join(";");return o.jsx(bN,{...x,children:o.jsxs(Ale,{required:v,scope:t,trigger:w,onTriggerChange:j,valueNode:N,onValueNodeChange:C,valueNodeHasChildren:A,onValueNodeHasChildrenChange:E,contentId:sn(),value:M,onValueChange:L,open:T,onOpenChange:k,dir:O,triggerPointerDownPosRef:$,disabled:m,children:[o.jsx(vg.Provider,{scope:t,children:o.jsx(Tle,{scope:e.__scopeSelect,onNativeOptionAdd:b.useCallback(V=>{Y(K=>new Set(K).add(V))},[]),onNativeOptionRemove:b.useCallback(V=>{Y(K=>{const F=new Set(K);return F.delete(V),F})},[]),children:r})}),I?o.jsxs(H3,{"aria-hidden":!0,required:v,tabIndex:-1,name:f,autoComplete:p,value:M,onChange:V=>L(V.target.value),disabled:m,form:y,children:[M===void 0?o.jsx("option",{value:""}):null,Array.from(H)]},W):null]})})};j3.displayName=ts;var N3="SelectTrigger",_3=b.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...a}=e,i=xg(r),s=po(N3,r),u=s.disabled||n,d=lt(t,s.onTriggerChange),c=yg(r),f=b.useRef("touch"),[p,m,v]=G3(x=>{const w=c().filter(C=>!C.disabled),j=w.find(C=>C.value===s.value),N=K3(w,x,j);N!==void 0&&s.onValueChange(N.value)}),y=x=>{u||(s.onOpenChange(!0),v()),x&&(s.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})};return o.jsx(pg,{asChild:!0,...i,children:o.jsx(Ze.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":W3(s.value)?"":void 0,...a,ref:d,onClick:tt(a.onClick,x=>{x.currentTarget.focus(),f.current!=="mouse"&&y(x)}),onPointerDown:tt(a.onPointerDown,x=>{f.current=x.pointerType;const w=x.target;w.hasPointerCapture(x.pointerId)&&w.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(y(x),x.preventDefault())}),onKeyDown:tt(a.onKeyDown,x=>{const w=p.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&m(x.key),!(w&&x.key===" ")&&Ele.includes(x.key)&&(y(),x.preventDefault())})})})});_3.displayName=N3;var C3="SelectValue",E3=b.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,children:i,placeholder:s="",...u}=e,d=po(C3,r),{onValueNodeHasChildrenChange:c}=d,f=i!==void 0,p=lt(t,d.onValueNodeChange);return sr(()=>{c(f)},[c,f]),o.jsx(Ze.span,{...u,ref:p,style:{pointerEvents:"none"},children:W3(d.value)?o.jsx(o.Fragment,{children:s}):i})});E3.displayName=C3;var Rle="SelectIcon",O3=b.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...a}=e;return o.jsx(Ze.span,{"aria-hidden":!0,...a,ref:t,children:n||"▼"})});O3.displayName=Rle;var Ile="SelectPortal",P3=e=>o.jsx(md,{asChild:!0,...e});P3.displayName=Ile;var rs="SelectContent",A3=b.forwardRef((e,t)=>{const r=po(rs,e.__scopeSelect),[n,a]=b.useState();if(sr(()=>{a(new DocumentFragment)},[]),!r.open){const i=n;return i?nd.createPortal(o.jsx(T3,{scope:e.__scopeSelect,children:o.jsx(vg.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),i):null}return o.jsx(k3,{...e,ref:t})});A3.displayName=rs;var la=10,[T3,mo]=nc(rs),Mle="SelectContentImpl",Dle=Tse("SelectContent.RemoveScroll"),k3=b.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:s,side:u,sideOffset:d,align:c,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:v,sticky:y,hideWhenDetached:x,avoidCollisions:w,...j}=e,N=po(rs,r),[C,A]=b.useState(null),[E,O]=b.useState(null),T=lt(t,G=>A(G)),[k,M]=b.useState(null),[L,$]=b.useState(null),I=yg(r),[H,Y]=b.useState(!1),W=b.useRef(!1);b.useEffect(()=>{if(C)return NN(C)},[C]),uN();const V=b.useCallback(G=>{const[Z,...ee]=I().map(ne=>ne.ref.current),[ce]=ee.slice(-1),ve=document.activeElement;for(const ne of G)if(ne===ve||(ne?.scrollIntoView({block:"nearest"}),ne===Z&&E&&(E.scrollTop=0),ne===ce&&E&&(E.scrollTop=E.scrollHeight),ne?.focus(),document.activeElement!==ve))return},[I,E]),K=b.useCallback(()=>V([k,C]),[V,k,C]);b.useEffect(()=>{H&&K()},[H,K]);const{onOpenChange:F,triggerPointerDownPosRef:te}=N;b.useEffect(()=>{if(C){let G={x:0,y:0};const Z=ce=>{G={x:Math.abs(Math.round(ce.pageX)-(te.current?.x??0)),y:Math.abs(Math.round(ce.pageY)-(te.current?.y??0))}},ee=ce=>{G.x<=10&&G.y<=10?ce.preventDefault():C.contains(ce.target)||F(!1),document.removeEventListener("pointermove",Z),te.current=null};return te.current!==null&&(document.addEventListener("pointermove",Z),document.addEventListener("pointerup",ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Z),document.removeEventListener("pointerup",ee,{capture:!0})}}},[C,F,te]),b.useEffect(()=>{const G=()=>F(!1);return window.addEventListener("blur",G),window.addEventListener("resize",G),()=>{window.removeEventListener("blur",G),window.removeEventListener("resize",G)}},[F]);const[D,U]=G3(G=>{const Z=I().filter(ve=>!ve.disabled),ee=Z.find(ve=>ve.ref.current===document.activeElement),ce=K3(Z,G,ee);ce&&setTimeout(()=>ce.ref.current.focus())}),z=b.useCallback((G,Z,ee)=>{const ce=!W.current&&!ee;(N.value!==void 0&&N.value===Z||ce)&&(M(G),ce&&(W.current=!0))},[N.value]),B=b.useCallback(()=>C?.focus(),[C]),X=b.useCallback((G,Z,ee)=>{const ce=!W.current&&!ee;(N.value!==void 0&&N.value===Z||ce)&&$(G)},[N.value]),Q=n==="popper"?DS:R3,re=Q===DS?{side:u,sideOffset:d,align:c,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:v,sticky:y,hideWhenDetached:x,avoidCollisions:w}:{};return o.jsx(T3,{scope:r,content:C,viewport:E,onViewportChange:O,itemRefCallback:z,selectedItem:k,onItemLeave:B,itemTextRefCallback:X,focusSelectedItem:K,selectedItemText:L,position:n,isPositioned:H,searchRef:D,children:o.jsx(gg,{as:Dle,allowPinchZoom:!0,children:o.jsx(cg,{asChild:!0,trapped:N.open,onMountAutoFocus:G=>{G.preventDefault()},onUnmountAutoFocus:tt(a,G=>{N.trigger?.focus({preventScroll:!0}),G.preventDefault()}),children:o.jsx(hd,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:G=>G.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:o.jsx(Q,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:G=>G.preventDefault(),...j,...re,onPlaced:()=>Y(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...j.style},onKeyDown:tt(j.onKeyDown,G=>{const Z=G.ctrlKey||G.altKey||G.metaKey;if(G.key==="Tab"&&G.preventDefault(),!Z&&G.key.length===1&&U(G.key),["ArrowUp","ArrowDown","Home","End"].includes(G.key)){let ce=I().filter(ve=>!ve.disabled).map(ve=>ve.ref.current);if(["ArrowUp","End"].includes(G.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(G.key)){const ve=G.target,ne=ce.indexOf(ve);ce=ce.slice(ne+1)}setTimeout(()=>V(ce)),G.preventDefault()}})})})})})})});k3.displayName=Mle;var Lle="SelectItemAlignedPosition",R3=b.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...a}=e,i=po(rs,r),s=mo(rs,r),[u,d]=b.useState(null),[c,f]=b.useState(null),p=lt(t,T=>f(T)),m=yg(r),v=b.useRef(!1),y=b.useRef(!0),{viewport:x,selectedItem:w,selectedItemText:j,focusSelectedItem:N}=s,C=b.useCallback(()=>{if(i.trigger&&i.valueNode&&u&&c&&x&&w&&j){const T=i.trigger.getBoundingClientRect(),k=c.getBoundingClientRect(),M=i.valueNode.getBoundingClientRect(),L=j.getBoundingClientRect();if(i.dir!=="rtl"){const ve=L.left-k.left,ne=M.left-ve,Ce=T.left-ne,pe=T.width+Ce,Pe=Math.max(pe,k.width),$e=window.innerWidth-la,Fe=cw(ne,[la,Math.max(la,$e-Pe)]);u.style.minWidth=pe+"px",u.style.left=Fe+"px"}else{const ve=k.right-L.right,ne=window.innerWidth-M.right-ve,Ce=window.innerWidth-T.right-ne,pe=T.width+Ce,Pe=Math.max(pe,k.width),$e=window.innerWidth-la,Fe=cw(ne,[la,Math.max(la,$e-Pe)]);u.style.minWidth=pe+"px",u.style.right=Fe+"px"}const $=m(),I=window.innerHeight-la*2,H=x.scrollHeight,Y=window.getComputedStyle(c),W=parseInt(Y.borderTopWidth,10),V=parseInt(Y.paddingTop,10),K=parseInt(Y.borderBottomWidth,10),F=parseInt(Y.paddingBottom,10),te=W+V+H+F+K,D=Math.min(w.offsetHeight*5,te),U=window.getComputedStyle(x),z=parseInt(U.paddingTop,10),B=parseInt(U.paddingBottom,10),X=T.top+T.height/2-la,Q=I-X,re=w.offsetHeight/2,G=w.offsetTop+re,Z=W+V+G,ee=te-Z;if(Z<=X){const ve=$.length>0&&w===$[$.length-1].ref.current;u.style.bottom="0px";const ne=c.clientHeight-x.offsetTop-x.offsetHeight,Ce=Math.max(Q,re+(ve?B:0)+ne+K),pe=Z+Ce;u.style.height=pe+"px"}else{const ve=$.length>0&&w===$[0].ref.current;u.style.top="0px";const Ce=Math.max(X,W+x.offsetTop+(ve?z:0)+re)+ee;u.style.height=Ce+"px",x.scrollTop=Z-X+x.offsetTop}u.style.margin=`${la}px 0`,u.style.minHeight=D+"px",u.style.maxHeight=I+"px",n?.(),requestAnimationFrame(()=>v.current=!0)}},[m,i.trigger,i.valueNode,u,c,x,w,j,i.dir,n]);sr(()=>C(),[C]);const[A,E]=b.useState();sr(()=>{c&&E(window.getComputedStyle(c).zIndex)},[c]);const O=b.useCallback(T=>{T&&y.current===!0&&(C(),N?.(),y.current=!1)},[C,N]);return o.jsx(Fle,{scope:r,contentWrapper:u,shouldExpandOnScrollRef:v,onScrollButtonChange:O,children:o.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:A},children:o.jsx(Ze.div,{...a,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});R3.displayName=Lle;var $le="SelectPopperPosition",DS=b.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:a=la,...i}=e,s=xg(r);return o.jsx(wN,{...s,...i,ref:t,align:n,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});DS.displayName=$le;var[Fle,_N]=nc(rs,{}),LS="SelectViewport",I3=b.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...a}=e,i=mo(LS,r),s=_N(LS,r),u=lt(t,i.onViewportChange),d=b.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),o.jsx(vg.Slot,{scope:r,children:o.jsx(Ze.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:tt(a.onScroll,c=>{const f=c.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=s;if(m?.current&&p){const v=Math.abs(d.current-f.scrollTop);if(v>0){const y=window.innerHeight-la*2,x=parseFloat(p.style.minHeight),w=parseFloat(p.style.height),j=Math.max(x,w);if(j0?A:0,p.style.justifyContent="flex-end")}}}d.current=f.scrollTop})})})]})});I3.displayName=LS;var M3="SelectGroup",[Ble,zle]=nc(M3),qle=b.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=sn();return o.jsx(Ble,{scope:r,id:a,children:o.jsx(Ze.div,{role:"group","aria-labelledby":a,...n,ref:t})})});qle.displayName=M3;var D3="SelectLabel",Ule=b.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=zle(D3,r);return o.jsx(Ze.div,{id:a.id,...n,ref:t})});Ule.displayName=D3;var vm="SelectItem",[Vle,L3]=nc(vm),$3=b.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:a=!1,textValue:i,...s}=e,u=po(vm,r),d=mo(vm,r),c=u.value===n,[f,p]=b.useState(i??""),[m,v]=b.useState(!1),y=lt(t,N=>d.itemRefCallback?.(N,n,a)),x=sn(),w=b.useRef("touch"),j=()=>{a||(u.onValueChange(n),u.onOpenChange(!1))};if(n==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(Vle,{scope:r,value:n,disabled:a,textId:x,isSelected:c,onItemTextChange:b.useCallback(N=>{p(C=>C||(N?.textContent??"").trim())},[]),children:o.jsx(vg.ItemSlot,{scope:r,value:n,disabled:a,textValue:f,children:o.jsx(Ze.div,{role:"option","aria-labelledby":x,"data-highlighted":m?"":void 0,"aria-selected":c&&m,"data-state":c?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...s,ref:y,onFocus:tt(s.onFocus,()=>v(!0)),onBlur:tt(s.onBlur,()=>v(!1)),onClick:tt(s.onClick,()=>{w.current!=="mouse"&&j()}),onPointerUp:tt(s.onPointerUp,()=>{w.current==="mouse"&&j()}),onPointerDown:tt(s.onPointerDown,N=>{w.current=N.pointerType}),onPointerMove:tt(s.onPointerMove,N=>{w.current=N.pointerType,a?d.onItemLeave?.():w.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:tt(s.onPointerLeave,N=>{N.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:tt(s.onKeyDown,N=>{d.searchRef?.current!==""&&N.key===" "||(Ole.includes(N.key)&&j(),N.key===" "&&N.preventDefault())})})})})});$3.displayName=vm;var ou="SelectItemText",F3=b.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,...i}=e,s=po(ou,r),u=mo(ou,r),d=L3(ou,r),c=kle(ou,r),[f,p]=b.useState(null),m=lt(t,j=>p(j),d.onItemTextChange,j=>u.itemTextRefCallback?.(j,d.value,d.disabled)),v=f?.textContent,y=b.useMemo(()=>o.jsx("option",{value:d.value,disabled:d.disabled,children:v},d.value),[d.disabled,d.value,v]),{onNativeOptionAdd:x,onNativeOptionRemove:w}=c;return sr(()=>(x(y),()=>w(y)),[x,w,y]),o.jsxs(o.Fragment,{children:[o.jsx(Ze.span,{id:d.textId,...i,ref:m}),d.isSelected&&s.valueNode&&!s.valueNodeHasChildren?nd.createPortal(i.children,s.valueNode):null]})});F3.displayName=ou;var B3="SelectItemIndicator",z3=b.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return L3(B3,r).isSelected?o.jsx(Ze.span,{"aria-hidden":!0,...n,ref:t}):null});z3.displayName=B3;var $S="SelectScrollUpButton",q3=b.forwardRef((e,t)=>{const r=mo($S,e.__scopeSelect),n=_N($S,e.__scopeSelect),[a,i]=b.useState(!1),s=lt(t,n.onScrollButtonChange);return sr(()=>{if(r.viewport&&r.isPositioned){let u=function(){const c=d.scrollTop>0;i(c)};const d=r.viewport;return u(),d.addEventListener("scroll",u),()=>d.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),a?o.jsx(V3,{...e,ref:s,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=r;u&&d&&(u.scrollTop=u.scrollTop-d.offsetHeight)}}):null});q3.displayName=$S;var FS="SelectScrollDownButton",U3=b.forwardRef((e,t)=>{const r=mo(FS,e.__scopeSelect),n=_N(FS,e.__scopeSelect),[a,i]=b.useState(!1),s=lt(t,n.onScrollButtonChange);return sr(()=>{if(r.viewport&&r.isPositioned){let u=function(){const c=d.scrollHeight-d.clientHeight,f=Math.ceil(d.scrollTop)d.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),a?o.jsx(V3,{...e,ref:s,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=r;u&&d&&(u.scrollTop=u.scrollTop+d.offsetHeight)}}):null});U3.displayName=FS;var V3=b.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...a}=e,i=mo("SelectScrollButton",r),s=b.useRef(null),u=yg(r),d=b.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return b.useEffect(()=>()=>d(),[d]),sr(()=>{u().find(f=>f.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[u]),o.jsx(Ze.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:tt(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(n,50))}),onPointerMove:tt(a.onPointerMove,()=>{i.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(n,50))}),onPointerLeave:tt(a.onPointerLeave,()=>{d()})})}),Hle="SelectSeparator",Wle=b.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return o.jsx(Ze.div,{"aria-hidden":!0,...n,ref:t})});Wle.displayName=Hle;var BS="SelectArrow",Gle=b.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=xg(r),i=po(BS,r),s=mo(BS,r);return i.open&&s.position==="popper"?o.jsx(SN,{...a,...n,ref:t}):null});Gle.displayName=BS;var Kle="SelectBubbleInput",H3=b.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const a=b.useRef(null),i=lt(n,a),s=jN(t);return b.useEffect(()=>{const u=a.current;if(!u)return;const d=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(d,"value").set;if(s!==t&&f){const p=new Event("change",{bubbles:!0});f.call(u,t),u.dispatchEvent(p)}},[s,t]),o.jsx(Ze.select,{...r,style:{...h3,...r.style},ref:i,defaultValue:t})});H3.displayName=Kle;function W3(e){return e===""||e===void 0}function G3(e){const t=Gr(e),r=b.useRef(""),n=b.useRef(0),a=b.useCallback(s=>{const u=r.current+s;t(u),(function d(c){r.current=c,window.clearTimeout(n.current),c!==""&&(n.current=window.setTimeout(()=>d(""),1e3))})(u)},[t]),i=b.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,a,i]}function K3(e,t,r){const a=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=r?e.indexOf(r):-1;let s=Yle(e,Math.max(i,0));a.length===1&&(s=s.filter(c=>c!==r));const d=s.find(c=>c.textValue.toLowerCase().startsWith(a.toLowerCase()));return d!==r?d:void 0}function Yle(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Xle=j3,Jle=_3,Qle=E3,Zle=O3,ece=P3,tce=A3,rce=I3,nce=$3,ace=F3,ice=z3,oce=q3,sce=U3;function Ve({...e}){return o.jsx(Xle,{"data-slot":"select",...e})}function He({...e}){return o.jsx(Qle,{"data-slot":"select-value",...e})}function We({className:e,size:t="default",children:r,...n}){return o.jsxs(Jle,{"data-slot":"select-trigger","data-size":t,className:Ee("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between gap-2 rounded-md border bg-input-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n,children:[r,o.jsx(Zle,{asChild:!0,children:o.jsx(ll,{className:"size-4 opacity-50"})})]})}function Ge({className:e,children:t,position:r="popper",...n}){return o.jsx(ece,{children:o.jsxs(tce,{"data-slot":"select-content",className:Ee("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[o.jsx(lce,{}),o.jsx(rce,{className:Ee("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),o.jsx(cce,{})]})})}function je({className:e,children:t,...r}){return o.jsxs(nce,{"data-slot":"select-item",className:Ee("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[o.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:o.jsx(ice,{children:o.jsx(kM,{className:"size-4"})})}),o.jsx(ace,{children:t})]})}function lce({className:e,...t}){return o.jsx(oce,{"data-slot":"select-scroll-up-button",className:Ee("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(r6,{className:"size-4"})})}function cce({className:e,...t}){return o.jsx(sce,{"data-slot":"select-scroll-down-button",className:Ee("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(ll,{className:"size-4"})})}function uce(e){const t=dce(e),r=b.forwardRef((n,a)=>{const{children:i,...s}=n,u=b.Children.toArray(i),d=u.find(hce);if(d){const c=d.props.children,f=u.map(p=>p===d?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:p);return o.jsx(t,{...s,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,f):null})}return o.jsx(t,{...s,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function dce(e){const t=b.forwardRef((r,n)=>{const{children:a,...i}=r;if(b.isValidElement(a)){const s=mce(a),u=pce(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Gn(n,s):s),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var fce=Symbol("radix.slottable");function hce(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===fce}function pce(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function mce(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var bg="Dialog",[Y3]=Ni(bg),[gce,ja]=Y3(bg),X3=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:a,onOpenChange:i,modal:s=!0}=e,u=b.useRef(null),d=b.useRef(null),[c,f]=es({prop:n,defaultProp:a??!1,onChange:i,caller:bg});return o.jsx(gce,{scope:t,triggerRef:u,contentRef:d,contentId:sn(),titleId:sn(),descriptionId:sn(),open:c,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(p=>!p),[f]),modal:s,children:r})};X3.displayName=bg;var J3="DialogTrigger",vce=b.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=ja(J3,r),i=lt(t,a.triggerRef);return o.jsx(Ze.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":ON(a.open),...n,ref:i,onClick:tt(e.onClick,a.onOpenToggle)})});vce.displayName=J3;var CN="DialogPortal",[yce,Q3]=Y3(CN,{forceMount:void 0}),Z3=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:a}=e,i=ja(CN,t);return o.jsx(yce,{scope:t,forceMount:r,children:b.Children.map(n,s=>o.jsx(An,{present:r||i.open,children:o.jsx(md,{asChild:!0,container:a,children:s})}))})};Z3.displayName=CN;var ym="DialogOverlay",e5=b.forwardRef((e,t)=>{const r=Q3(ym,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,i=ja(ym,e.__scopeDialog);return i.modal?o.jsx(An,{present:n||i.open,children:o.jsx(bce,{...a,ref:t})}):null});e5.displayName=ym;var xce=uce("DialogOverlay.RemoveScroll"),bce=b.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=ja(ym,r);return o.jsx(gg,{as:xce,allowPinchZoom:!0,shards:[a.contentRef],children:o.jsx(Ze.div,{"data-state":ON(a.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),ns="DialogContent",t5=b.forwardRef((e,t)=>{const r=Q3(ns,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,i=ja(ns,e.__scopeDialog);return o.jsx(An,{present:n||i.open,children:i.modal?o.jsx(wce,{...a,ref:t}):o.jsx(Sce,{...a,ref:t})})});t5.displayName=ns;var wce=b.forwardRef((e,t)=>{const r=ja(ns,e.__scopeDialog),n=b.useRef(null),a=lt(t,r.contentRef,n);return b.useEffect(()=>{const i=n.current;if(i)return NN(i)},[]),o.jsx(r5,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:tt(e.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:tt(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,u=s.button===0&&s.ctrlKey===!0;(s.button===2||u)&&i.preventDefault()}),onFocusOutside:tt(e.onFocusOutside,i=>i.preventDefault())})}),Sce=b.forwardRef((e,t)=>{const r=ja(ns,e.__scopeDialog),n=b.useRef(!1),a=b.useRef(!1);return o.jsx(r5,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(n.current||r.triggerRef.current?.focus(),i.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=i.target;r.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),r5=b.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:i,...s}=e,u=ja(ns,r),d=b.useRef(null),c=lt(t,d);return uN(),o.jsxs(o.Fragment,{children:[o.jsx(cg,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:i,children:o.jsx(hd,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":ON(u.open),...s,ref:c,onDismiss:()=>u.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(jce,{titleId:u.titleId}),o.jsx(_ce,{contentRef:d,descriptionId:u.descriptionId})]})]})}),EN="DialogTitle",n5=b.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=ja(EN,r);return o.jsx(Ze.h2,{id:a.titleId,...n,ref:t})});n5.displayName=EN;var a5="DialogDescription",i5=b.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=ja(a5,r);return o.jsx(Ze.p,{id:a.descriptionId,...n,ref:t})});i5.displayName=a5;var o5="DialogClose",s5=b.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=ja(o5,r);return o.jsx(Ze.button,{type:"button",...n,ref:t,onClick:tt(e.onClick,()=>a.onOpenChange(!1))})});s5.displayName=o5;function ON(e){return e?"open":"closed"}var l5="DialogTitleWarning",[pme,c5]=lU(l5,{contentName:ns,titleName:EN,docsSlug:"dialog"}),jce=({titleId:e})=>{const t=c5(l5),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Nce="DialogDescriptionWarning",_ce=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${c5(Nce).contentName}}.`;return b.useEffect(()=>{const a=e.current?.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},u5=X3,d5=Z3,f5=e5,h5=t5,Cce=n5,Ece=i5,Oce=s5;function xt({...e}){return o.jsx(u5,{"data-slot":"dialog",...e})}function Pce({...e}){return o.jsx(d5,{"data-slot":"dialog-portal",...e})}const p5=b.forwardRef(({className:e,...t},r)=>o.jsx(f5,{ref:r,"data-slot":"dialog-overlay",className:Ee("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t}));p5.displayName="DialogOverlay";const gt=b.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Pce,{"data-slot":"dialog-portal",children:[o.jsx(p5,{}),o.jsxs(h5,{ref:n,"data-slot":"dialog-content",className:Ee("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...r,children:[t,o.jsxs(Oce,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[o.jsx(no,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));gt.displayName="DialogContent";function bt({className:e,...t}){return o.jsx("div",{"data-slot":"dialog-header",className:Ee("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Nt({className:e,...t}){return o.jsx("div",{"data-slot":"dialog-footer",className:Ee("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function wt({className:e,...t}){return o.jsx(Cce,{"data-slot":"dialog-title",className:Ee("text-lg leading-none font-semibold",e),...t})}function kt({className:e,...t}){return o.jsx(Ece,{"data-slot":"dialog-description",className:Ee("text-muted-foreground text-sm",e),...t})}var Ace=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Tce=Ace.reduce((e,t)=>{const r=nj(`Primitive.${t}`),n=b.forwardRef((a,i)=>{const{asChild:s,...u}=a,d=s?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(d,{...u,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),kce="Label",m5=b.forwardRef((e,t)=>o.jsx(Tce.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));m5.displayName=kce;var Rce=m5;function de({className:e,...t}){return o.jsx(Rce,{"data-slot":"label",className:Ee("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}var wg="Switch",[Ice]=Ni(wg),[Mce,Dce]=Ice(wg),g5=b.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:a,defaultChecked:i,required:s,disabled:u,value:d="on",onCheckedChange:c,form:f,...p}=e,[m,v]=b.useState(null),y=lt(t,C=>v(C)),x=b.useRef(!1),w=m?f||!!m.closest("form"):!0,[j,N]=es({prop:a,defaultProp:i??!1,onChange:c,caller:wg});return o.jsxs(Mce,{scope:r,checked:j,disabled:u,children:[o.jsx(Ze.button,{type:"button",role:"switch","aria-checked":j,"aria-required":s,"data-state":b5(j),"data-disabled":u?"":void 0,disabled:u,value:d,...p,ref:y,onClick:tt(e.onClick,C=>{N(A=>!A),w&&(x.current=C.isPropagationStopped(),x.current||C.stopPropagation())})}),w&&o.jsx(x5,{control:m,bubbles:!x.current,name:n,value:d,checked:j,required:s,disabled:u,form:f,style:{transform:"translateX(-100%)"}})]})});g5.displayName=wg;var v5="SwitchThumb",y5=b.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,a=Dce(v5,r);return o.jsx(Ze.span,{"data-state":b5(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});y5.displayName=v5;var Lce="SwitchBubbleInput",x5=b.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...a},i)=>{const s=b.useRef(null),u=lt(s,i),d=jN(r),c=vN(t);return b.useEffect(()=>{const f=s.current;if(!f)return;const p=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==r&&v){const y=new Event("click",{bubbles:n});v.call(f,r),f.dispatchEvent(y)}},[d,r,n]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:u,style:{...a.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});x5.displayName=Lce;function b5(e){return e?"checked":"unchecked"}var $ce=g5,Fce=y5;function Zt({className:e,...t}){return o.jsx($ce,{"data-slot":"switch",className:Ee("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-switch-background focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:o.jsx(Fce,{"data-slot":"switch-thumb",className:Ee("bg-card dark:data-[state=unchecked]:bg-card-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}function Ua(e){return Math.max(1,e)}function Bce(e){const t=zce(e),r=b.forwardRef((n,a)=>{const{children:i,...s}=n,u=b.Children.toArray(i),d=u.find(Uce);if(d){const c=d.props.children,f=u.map(p=>p===d?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:p);return o.jsx(t,{...s,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,f):null})}return o.jsx(t,{...s,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function zce(e){const t=b.forwardRef((r,n)=>{const{children:a,...i}=r;if(b.isValidElement(a)){const s=Hce(a),u=Vce(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Gn(n,s):s),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qce=Symbol("radix.slottable");function Uce(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===qce}function Vce(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function Hce(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Sg="Popover",[w5]=Ni(Sg,[rc]),gd=rc(),[Wce,go]=w5(Sg),S5=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:a,onOpenChange:i,modal:s=!1}=e,u=gd(t),d=b.useRef(null),[c,f]=b.useState(!1),[p,m]=es({prop:n,defaultProp:a??!1,onChange:i,caller:Sg});return o.jsx(bN,{...u,children:o.jsx(Wce,{scope:t,contentId:sn(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:b.useCallback(()=>m(v=>!v),[m]),hasCustomAnchor:c,onCustomAnchorAdd:b.useCallback(()=>f(!0),[]),onCustomAnchorRemove:b.useCallback(()=>f(!1),[]),modal:s,children:r})})};S5.displayName=Sg;var j5="PopoverAnchor",Gce=b.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=go(j5,r),i=gd(r),{onCustomAnchorAdd:s,onCustomAnchorRemove:u}=a;return b.useEffect(()=>(s(),()=>u()),[s,u]),o.jsx(pg,{...i,...n,ref:t})});Gce.displayName=j5;var N5="PopoverTrigger",_5=b.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=go(N5,r),i=gd(r),s=lt(t,a.triggerRef),u=o.jsx(Ze.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":A5(a.open),...n,ref:s,onClick:tt(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?u:o.jsx(pg,{asChild:!0,...i,children:u})});_5.displayName=N5;var PN="PopoverPortal",[Kce,Yce]=w5(PN,{forceMount:void 0}),C5=e=>{const{__scopePopover:t,forceMount:r,children:n,container:a}=e,i=go(PN,t);return o.jsx(Kce,{scope:t,forceMount:r,children:o.jsx(An,{present:r||i.open,children:o.jsx(md,{asChild:!0,container:a,children:n})})})};C5.displayName=PN;var Fl="PopoverContent",E5=b.forwardRef((e,t)=>{const r=Yce(Fl,e.__scopePopover),{forceMount:n=r.forceMount,...a}=e,i=go(Fl,e.__scopePopover);return o.jsx(An,{present:n||i.open,children:i.modal?o.jsx(Jce,{...a,ref:t}):o.jsx(Qce,{...a,ref:t})})});E5.displayName=Fl;var Xce=Bce("PopoverContent.RemoveScroll"),Jce=b.forwardRef((e,t)=>{const r=go(Fl,e.__scopePopover),n=b.useRef(null),a=lt(t,n),i=b.useRef(!1);return b.useEffect(()=>{const s=n.current;if(s)return NN(s)},[]),o.jsx(gg,{as:Xce,allowPinchZoom:!0,children:o.jsx(O5,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:tt(e.onCloseAutoFocus,s=>{s.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:tt(e.onPointerDownOutside,s=>{const u=s.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,c=u.button===2||d;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:tt(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),Qce=b.forwardRef((e,t)=>{const r=go(Fl,e.__scopePopover),n=b.useRef(!1),a=b.useRef(!1);return o.jsx(O5,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(n.current||r.triggerRef.current?.focus(),i.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=i.target;r.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),O5=b.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:c,onInteractOutside:f,...p}=e,m=go(Fl,r),v=gd(r);return uN(),o.jsx(cg,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:i,children:o.jsx(hd,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:f,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:c,onDismiss:()=>m.onOpenChange(!1),children:o.jsx(wN,{"data-state":A5(m.open),role:"dialog",id:m.contentId,...v,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),P5="PopoverClose",Zce=b.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=go(P5,r);return o.jsx(Ze.button,{type:"button",...n,ref:t,onClick:tt(e.onClick,()=>a.onOpenChange(!1))})});Zce.displayName=P5;var eue="PopoverArrow",tue=b.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=gd(r);return o.jsx(SN,{...a,...n,ref:t})});tue.displayName=eue;function A5(e){return e?"open":"closed"}var rue=S5,nue=_5,aue=C5,iue=E5;function ya({...e}){return o.jsx(rue,{"data-slot":"popover",...e})}function xa({...e}){return o.jsx(nue,{"data-slot":"popover-trigger",...e})}function ba({className:e,align:t="center",sideOffset:r=4,...n}){return o.jsx(aue,{children:o.jsx(iue,{"data-slot":"popover-content",align:t,sideOffset:r,className:Ee("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...n})})}var jg="Checkbox",[oue]=Ni(jg),[sue,AN]=oue(jg);function lue(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:a,disabled:i,form:s,name:u,onCheckedChange:d,required:c,value:f="on",internal_do_not_use_render:p}=e,[m,v]=es({prop:r,defaultProp:a??!1,onChange:d,caller:jg}),[y,x]=b.useState(null),[w,j]=b.useState(null),N=b.useRef(!1),C=y?!!s||!!y.closest("form"):!0,A={checked:m,disabled:i,setChecked:v,control:y,setControl:x,name:u,form:s,value:f,hasConsumerStoppedPropagationRef:N,required:c,defaultChecked:io(a)?!1:a,isFormControl:C,bubbleInput:w,setBubbleInput:j};return o.jsx(sue,{scope:t,...A,children:cue(p)?p(A):n})}var T5="CheckboxTrigger",k5=b.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},a)=>{const{control:i,value:s,disabled:u,checked:d,required:c,setControl:f,setChecked:p,hasConsumerStoppedPropagationRef:m,isFormControl:v,bubbleInput:y}=AN(T5,e),x=lt(a,f),w=b.useRef(d);return b.useEffect(()=>{const j=i?.form;if(j){const N=()=>p(w.current);return j.addEventListener("reset",N),()=>j.removeEventListener("reset",N)}},[i,p]),o.jsx(Ze.button,{type:"button",role:"checkbox","aria-checked":io(d)?"mixed":d,"aria-required":c,"data-state":$5(d),"data-disabled":u?"":void 0,disabled:u,value:s,...n,ref:x,onKeyDown:tt(t,j=>{j.key==="Enter"&&j.preventDefault()}),onClick:tt(r,j=>{p(N=>io(N)?!0:!N),y&&v&&(m.current=j.isPropagationStopped(),m.current||j.stopPropagation())})})});k5.displayName=T5;var R5=b.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:a,defaultChecked:i,required:s,disabled:u,value:d,onCheckedChange:c,form:f,...p}=e;return o.jsx(lue,{__scopeCheckbox:r,checked:a,defaultChecked:i,disabled:u,required:s,onCheckedChange:c,name:n,form:f,value:d,internal_do_not_use_render:({isFormControl:m})=>o.jsxs(o.Fragment,{children:[o.jsx(k5,{...p,ref:t,__scopeCheckbox:r}),m&&o.jsx(L5,{__scopeCheckbox:r})]})})});R5.displayName=jg;var I5="CheckboxIndicator",M5=b.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...a}=e,i=AN(I5,r);return o.jsx(An,{present:n||io(i.checked)||i.checked===!0,children:o.jsx(Ze.span,{"data-state":$5(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});M5.displayName=I5;var D5="CheckboxBubbleInput",L5=b.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:a,checked:i,defaultChecked:s,required:u,disabled:d,name:c,value:f,form:p,bubbleInput:m,setBubbleInput:v}=AN(D5,e),y=lt(r,v),x=jN(i),w=vN(n);b.useEffect(()=>{const N=m;if(!N)return;const C=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(C,"checked").set,O=!a.current;if(x!==i&&E){const T=new Event("click",{bubbles:O});N.indeterminate=io(i),E.call(N,io(i)?!1:i),N.dispatchEvent(T)}},[m,x,i,a]);const j=b.useRef(io(i)?!1:i);return o.jsx(Ze.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??j.current,required:u,disabled:d,name:c,value:f,form:p,...t,tabIndex:-1,ref:y,style:{...t.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});L5.displayName=D5;function cue(e){return typeof e=="function"}function io(e){return e==="indeterminate"}function $5(e){return io(e)?"indeterminate":e?"checked":"unchecked"}function Qu({className:e,...t}){return o.jsx(R5,{"data-slot":"checkbox",className:Ee("peer border bg-input-background dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:o.jsx(M5,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:o.jsx(kM,{className:"size-3.5"})})})}var lI=1,uue=.9,due=.8,fue=.17,G1=.1,K1=.999,hue=.9999,pue=.99,mue=/[\\\/_+.#"@\[\(\{&]/,gue=/[\\\/_+.#"@\[\(\{&]/g,vue=/[\s-]/,F5=/[\s-]/g;function zS(e,t,r,n,a,i,s){if(i===t.length)return a===e.length?lI:pue;var u=`${a},${i}`;if(s[u]!==void 0)return s[u];for(var d=n.charAt(i),c=r.indexOf(d,a),f=0,p,m,v,y;c>=0;)p=zS(e,t,r,n,c+1,i+1,s),p>f&&(c===a?p*=lI:mue.test(e.charAt(c-1))?(p*=due,v=e.slice(a,c-1).match(gue),v&&a>0&&(p*=Math.pow(K1,v.length))):vue.test(e.charAt(c-1))?(p*=uue,y=e.slice(a,c-1).match(F5),y&&a>0&&(p*=Math.pow(K1,y.length))):(p*=fue,a>0&&(p*=Math.pow(K1,c-a))),e.charAt(c)!==t.charAt(i)&&(p*=hue)),(pp&&(p=m*G1)),p>f&&(f=p),c=r.indexOf(d,c+1);return s[u]=f,f}function cI(e){return e.toLowerCase().replace(F5," ")}function yue(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,zS(e,t,cI(e),cI(t),0,0,{})}var Xc='[cmdk-group=""]',Y1='[cmdk-group-items=""]',xue='[cmdk-group-heading=""]',B5='[cmdk-item=""]',uI=`${B5}:not([aria-disabled="true"])`,qS="cmdk-item-select",Ks="data-value",bue=(e,t,r)=>yue(e,t,r),z5=b.createContext(void 0),vd=()=>b.useContext(z5),q5=b.createContext(void 0),TN=()=>b.useContext(q5),U5=b.createContext(void 0),V5=b.forwardRef((e,t)=>{let r=Ys(()=>{var z,B;return{search:"",value:(B=(z=e.value)!=null?z:e.defaultValue)!=null?B:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=Ys(()=>new Set),a=Ys(()=>new Map),i=Ys(()=>new Map),s=Ys(()=>new Set),u=H5(e),{label:d,children:c,value:f,onValueChange:p,filter:m,shouldFilter:v,loop:y,disablePointerSelection:x=!1,vimBindings:w=!0,...j}=e,N=sn(),C=sn(),A=sn(),E=b.useRef(null),O=Tue();as(()=>{if(f!==void 0){let z=f.trim();r.current.value=z,T.emit()}},[f]),as(()=>{O(6,H)},[]);let T=b.useMemo(()=>({subscribe:z=>(s.current.add(z),()=>s.current.delete(z)),snapshot:()=>r.current,setState:(z,B,X)=>{var Q,re,G,Z;if(!Object.is(r.current[z],B)){if(r.current[z]=B,z==="search")I(),L(),O(1,$);else if(z==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ee=document.getElementById(A);ee?ee.focus():(Q=document.getElementById(N))==null||Q.focus()}if(O(7,()=>{var ee;r.current.selectedItemId=(ee=Y())==null?void 0:ee.id,T.emit()}),X||O(5,H),((re=u.current)==null?void 0:re.value)!==void 0){let ee=B??"";(Z=(G=u.current).onValueChange)==null||Z.call(G,ee);return}}T.emit()}},emit:()=>{s.current.forEach(z=>z())}}),[]),k=b.useMemo(()=>({value:(z,B,X)=>{var Q;B!==((Q=i.current.get(z))==null?void 0:Q.value)&&(i.current.set(z,{value:B,keywords:X}),r.current.filtered.items.set(z,M(B,X)),O(2,()=>{L(),T.emit()}))},item:(z,B)=>(n.current.add(z),B&&(a.current.has(B)?a.current.get(B).add(z):a.current.set(B,new Set([z]))),O(3,()=>{I(),L(),r.current.value||$(),T.emit()}),()=>{i.current.delete(z),n.current.delete(z),r.current.filtered.items.delete(z);let X=Y();O(4,()=>{I(),X?.getAttribute("id")===z&&$(),T.emit()})}),group:z=>(a.current.has(z)||a.current.set(z,new Set),()=>{i.current.delete(z),a.current.delete(z)}),filter:()=>u.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>u.current.disablePointerSelection,listId:N,inputId:A,labelId:C,listInnerRef:E}),[]);function M(z,B){var X,Q;let re=(Q=(X=u.current)==null?void 0:X.filter)!=null?Q:bue;return z?re(z,r.current.search,B):0}function L(){if(!r.current.search||u.current.shouldFilter===!1)return;let z=r.current.filtered.items,B=[];r.current.filtered.groups.forEach(Q=>{let re=a.current.get(Q),G=0;re.forEach(Z=>{let ee=z.get(Z);G=Math.max(ee,G)}),B.push([Q,G])});let X=E.current;W().sort((Q,re)=>{var G,Z;let ee=Q.getAttribute("id"),ce=re.getAttribute("id");return((G=z.get(ce))!=null?G:0)-((Z=z.get(ee))!=null?Z:0)}).forEach(Q=>{let re=Q.closest(Y1);re?re.appendChild(Q.parentElement===re?Q:Q.closest(`${Y1} > *`)):X.appendChild(Q.parentElement===X?Q:Q.closest(`${Y1} > *`))}),B.sort((Q,re)=>re[1]-Q[1]).forEach(Q=>{var re;let G=(re=E.current)==null?void 0:re.querySelector(`${Xc}[${Ks}="${encodeURIComponent(Q[0])}"]`);G?.parentElement.appendChild(G)})}function $(){let z=W().find(X=>X.getAttribute("aria-disabled")!=="true"),B=z?.getAttribute(Ks);T.setState("value",B||void 0)}function I(){var z,B,X,Q;if(!r.current.search||u.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let re=0;for(let G of n.current){let Z=(B=(z=i.current.get(G))==null?void 0:z.value)!=null?B:"",ee=(Q=(X=i.current.get(G))==null?void 0:X.keywords)!=null?Q:[],ce=M(Z,ee);r.current.filtered.items.set(G,ce),ce>0&&re++}for(let[G,Z]of a.current)for(let ee of Z)if(r.current.filtered.items.get(ee)>0){r.current.filtered.groups.add(G);break}r.current.filtered.count=re}function H(){var z,B,X;let Q=Y();Q&&(((z=Q.parentElement)==null?void 0:z.firstChild)===Q&&((X=(B=Q.closest(Xc))==null?void 0:B.querySelector(xue))==null||X.scrollIntoView({block:"nearest"})),Q.scrollIntoView({block:"nearest"}))}function Y(){var z;return(z=E.current)==null?void 0:z.querySelector(`${B5}[aria-selected="true"]`)}function W(){var z;return Array.from(((z=E.current)==null?void 0:z.querySelectorAll(uI))||[])}function V(z){let B=W()[z];B&&T.setState("value",B.getAttribute(Ks))}function K(z){var B;let X=Y(),Q=W(),re=Q.findIndex(Z=>Z===X),G=Q[re+z];(B=u.current)!=null&&B.loop&&(G=re+z<0?Q[Q.length-1]:re+z===Q.length?Q[0]:Q[re+z]),G&&T.setState("value",G.getAttribute(Ks))}function F(z){let B=Y(),X=B?.closest(Xc),Q;for(;X&&!Q;)X=z>0?Pue(X,Xc):Aue(X,Xc),Q=X?.querySelector(uI);Q?T.setState("value",Q.getAttribute(Ks)):K(z)}let te=()=>V(W().length-1),D=z=>{z.preventDefault(),z.metaKey?te():z.altKey?F(1):K(1)},U=z=>{z.preventDefault(),z.metaKey?V(0):z.altKey?F(-1):K(-1)};return b.createElement(Ze.div,{ref:t,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:z=>{var B;(B=j.onKeyDown)==null||B.call(j,z);let X=z.nativeEvent.isComposing||z.keyCode===229;if(!(z.defaultPrevented||X))switch(z.key){case"n":case"j":{w&&z.ctrlKey&&D(z);break}case"ArrowDown":{D(z);break}case"p":case"k":{w&&z.ctrlKey&&U(z);break}case"ArrowUp":{U(z);break}case"Home":{z.preventDefault(),V(0);break}case"End":{z.preventDefault(),te();break}case"Enter":{z.preventDefault();let Q=Y();if(Q){let re=new Event(qS);Q.dispatchEvent(re)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:k.inputId,id:k.labelId,style:Rue},d),Ng(e,z=>b.createElement(q5.Provider,{value:T},b.createElement(z5.Provider,{value:k},z))))}),wue=b.forwardRef((e,t)=>{var r,n;let a=sn(),i=b.useRef(null),s=b.useContext(U5),u=vd(),d=H5(e),c=(n=(r=d.current)==null?void 0:r.forceMount)!=null?n:s?.forceMount;as(()=>{if(!c)return u.item(a,s?.id)},[c]);let f=W5(a,i,[e.value,e.children,i],e.keywords),p=TN(),m=lo(O=>O.value&&O.value===f.current),v=lo(O=>c||u.filter()===!1?!0:O.search?O.filtered.items.get(a)>0:!0);b.useEffect(()=>{let O=i.current;if(!(!O||e.disabled))return O.addEventListener(qS,y),()=>O.removeEventListener(qS,y)},[v,e.onSelect,e.disabled]);function y(){var O,T;x(),(T=(O=d.current).onSelect)==null||T.call(O,f.current)}function x(){p.setState("value",f.current,!0)}if(!v)return null;let{disabled:w,value:j,onSelect:N,forceMount:C,keywords:A,...E}=e;return b.createElement(Ze.div,{ref:Gn(i,t),...E,id:a,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!m,"data-disabled":!!w,"data-selected":!!m,onPointerMove:w||u.getDisablePointerSelection()?void 0:x,onClick:w?void 0:y},e.children)}),Sue=b.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:a,...i}=e,s=sn(),u=b.useRef(null),d=b.useRef(null),c=sn(),f=vd(),p=lo(v=>a||f.filter()===!1?!0:v.search?v.filtered.groups.has(s):!0);as(()=>f.group(s),[]),W5(s,u,[e.value,e.heading,d]);let m=b.useMemo(()=>({id:s,forceMount:a}),[a]);return b.createElement(Ze.div,{ref:Gn(u,t),...i,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},r&&b.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:c},r),Ng(e,v=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?c:void 0},b.createElement(U5.Provider,{value:m},v))))}),jue=b.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,a=b.useRef(null),i=lo(s=>!s.search);return!r&&!i?null:b.createElement(Ze.div,{ref:Gn(a,t),...n,"cmdk-separator":"",role:"separator"})}),Nue=b.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,a=e.value!=null,i=TN(),s=lo(c=>c.search),u=lo(c=>c.selectedItemId),d=vd();return b.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),b.createElement(Ze.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":u,id:d.inputId,type:"text",value:a?e.value:s,onChange:c=>{a||i.setState("search",c.target.value),r?.(c.target.value)}})}),_ue=b.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...a}=e,i=b.useRef(null),s=b.useRef(null),u=lo(c=>c.selectedItemId),d=vd();return b.useEffect(()=>{if(s.current&&i.current){let c=s.current,f=i.current,p,m=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let v=c.offsetHeight;f.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return m.observe(c),()=>{cancelAnimationFrame(p),m.unobserve(c)}}},[]),b.createElement(Ze.div,{ref:Gn(i,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":u,"aria-label":n,id:d.listId},Ng(e,c=>b.createElement("div",{ref:Gn(s,d.listInnerRef),"cmdk-list-sizer":""},c)))}),Cue=b.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:a,contentClassName:i,container:s,...u}=e;return b.createElement(u5,{open:r,onOpenChange:n},b.createElement(d5,{container:s},b.createElement(f5,{"cmdk-overlay":"",className:a}),b.createElement(h5,{"aria-label":e.label,"cmdk-dialog":"",className:i},b.createElement(V5,{ref:t,...u}))))}),Eue=b.forwardRef((e,t)=>lo(r=>r.filtered.count===0)?b.createElement(Ze.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Oue=b.forwardRef((e,t)=>{let{progress:r,children:n,label:a="Loading...",...i}=e;return b.createElement(Ze.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Ng(e,s=>b.createElement("div",{"aria-hidden":!0},s)))}),ac=Object.assign(V5,{List:_ue,Item:wue,Input:Nue,Group:Sue,Separator:jue,Dialog:Cue,Empty:Eue,Loading:Oue});function Pue(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function Aue(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function H5(e){let t=b.useRef(e);return as(()=>{t.current=e}),t}var as=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Ys(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function lo(e){let t=TN(),r=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,r,r)}function W5(e,t,r,n=[]){let a=b.useRef(),i=vd();return as(()=>{var s;let u=(()=>{var c;for(let f of r){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(c=f.current.textContent)==null?void 0:c.trim():a.current}})(),d=n.map(c=>c.trim());i.value(e,u,d),(s=t.current)==null||s.setAttribute(Ks,u),a.current=u}),a}var Tue=()=>{let[e,t]=b.useState(),r=Ys(()=>new Map);return as(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,a)=>{r.current.set(n,a),t({})}};function kue(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Ng({asChild:e,children:t},r){return e&&b.isValidElement(t)?b.cloneElement(kue(t),{ref:t.ref},r(t.props.children)):r(t)}var Rue={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function G5({className:e,...t}){return o.jsx(ac,{"data-slot":"command",className:Ee("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function K5({className:e,...t}){return o.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[o.jsx(jm,{className:"size-4 shrink-0 opacity-50"}),o.jsx(ac.Input,{"data-slot":"command-input",className:Ee("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function Y5({className:e,...t}){return o.jsx(ac.List,{"data-slot":"command-list",className:Ee("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function X5({...e}){return o.jsx(ac.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function US({className:e,...t}){return o.jsx(ac.Group,{"data-slot":"command-group",className:Ee("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function VS({className:e,...t}){return o.jsx(ac.Item,{"data-slot":"command-item",className:Ee("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function Wn({value:e,onValueChange:t,options:r,placeholder:n="Select…",searchPlaceholder:a="Search…",emptyText:i="No matching results.",disabled:s,className:u}){const[d,c]=b.useState(!1),f=e?r.find(m=>m.value===e):void 0,p=e?f?.label??e:null;return o.jsxs(ya,{open:d,onOpenChange:c,children:[o.jsx(xa,{asChild:!0,children:o.jsxs(he,{type:"button",variant:"outline",role:"combobox","aria-expanded":d,disabled:s,className:Ee("w-full justify-between h-10 px-3 font-normal border border-gray-300 bg-white",u),children:[o.jsx("span",{className:Ee("truncate text-left text-sm",!p&&"text-gray-500"),children:p??n}),o.jsx(IM,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsxs(ba,{className:"p-0 w-[var(--radix-popover-trigger-width)] max-w-[min(100vw-2rem,400px)]",align:"start",children:[o.jsxs(G5,{children:[o.jsx(K5,{placeholder:a}),o.jsxs(Y5,{children:[o.jsx(X5,{children:i}),o.jsx(US,{children:r.map(m=>o.jsx(VS,{value:`${m.label} ${m.value}`,onSelect:()=>{t(m.value),c(!1)},className:Ee("cursor-pointer rounded-md px-2 py-2 transition-colors","hover:bg-gray-100 hover:text-gray-900","data-[selected=true]:bg-gray-100",e===m.value&&"bg-blue-50 text-gray-900 font-medium data-[selected=true]:bg-blue-100"),children:o.jsx("span",{className:"truncate",children:m.label})},m.value))})]})]}),e?o.jsx("div",{className:"border-t border-gray-100 px-2 py-1.5",children:o.jsx("button",{type:"button",className:"text-xs text-gray-500 hover:text-gray-900 underline-offset-2 hover:underline",onClick:()=>{t(""),c(!1)},children:"Clear selection"})}):null]})]})}function bi({className:e,...t}){return o.jsx("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:Ee("mx-auto flex w-full justify-center",e),...t})}function wi({className:e,...t}){return o.jsx("ul",{"data-slot":"pagination-content",className:Ee("flex flex-row items-center gap-1",e),...t})}function At({...e}){return o.jsx("li",{"data-slot":"pagination-item",...e})}function wa({className:e,isActive:t,size:r="icon",...n}){return o.jsx("a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:Ee(gD({variant:t?"outline":"ghost",size:r}),e),...n})}function Si({className:e,...t}){return o.jsxs(wa,{"aria-label":"Go to previous page",size:"default",className:Ee("gap-1 px-2.5 sm:pl-2.5",e),...t,children:[o.jsx(RM,{}),o.jsx("span",{className:"hidden sm:block",children:"Previous"})]})}function ji({className:e,...t}){return o.jsxs(wa,{"aria-label":"Go to next page",size:"default",className:Ee("gap-1 px-2.5 sm:pr-2.5",e),...t,children:[o.jsx("span",{className:"hidden sm:block",children:"Next"}),o.jsx(cl,{})]})}class Iue extends Error{status;payload;constructor(t,r,n){super(t),this.name="ApiError",this.status=r,this.payload=n}}function Mue(e,t){if(!e)return t;const r=e.endsWith("/")?e.slice(0,-1):e,n=t.startsWith("/")?t:`/${t}`;return`${r}${n}`}function Due(e){const t=new URLSearchParams;for(const[n,a]of Object.entries(e))if(!(a==null||a==="")){if(typeof a=="boolean"){t.set(n,a?"true":"false");continue}t.set(n,String(a))}const r=t.toString();return r?`?${r}`:""}function Lue(e){const r=e?.error?.message?.trim();return r||null}function dI(e){if(Array.isArray(e))return{items:e,totalCount:e.length};if(!e||typeof e!="object")return e;const t=e,r="TotalCount"in t||"Items"in t,n="totalCount"in t||"items"in t;if(r&&!n)return{...t,totalCount:t.TotalCount,items:t.Items};if(!("items"in t)&&Array.isArray(t.data)&&typeof t.totalCount=="number")return{...t,items:t.data};if(!("items"in t)&&Array.isArray(t.Data)&&typeof t.TotalCount=="number")return{...t,totalCount:t.TotalCount,items:t.Data};if(Array.isArray(t.items)&&typeof t.totalCount!="number"){const a=t.TotalCount;return{...t,totalCount:typeof a=="number"?a:t.items.length}}return e}function un(e={}){const t=e.baseUrl??"http://flus-test.3ffoodsafety.com"??"http://localhost:19001",r=e.getToken;async function n(a){const i=a.prefix??"/api/app",s=Mue(t,`${i}${a.path}${Due(a.query??{})}`),u={"Content-Type":"application/json"},d=r?.();d&&(u.Authorization=`Bearer ${d}`);const c=await fetch(s,{method:a.method,headers:u,body:a.body===void 0?void 0:JSON.stringify(a.body),signal:a.signal}),m=(c.headers.get("content-type")??"").includes("application/json")?await c.json().catch(()=>null):await c.text().catch(()=>"");if(!c.ok){const y=Lue(m)??(typeof m=="string"&&m.trim()?m:"Request failed.");throw new Iue(y,c.status,m)}return m&&typeof m=="object"&&"data"in m?dI(m.data??null):dI(m)}return{requestJson:n}}const yd=un({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),xd="/label";async function $ue(e,t){return yd.requestJson({path:xd,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,LocationId:e.locationId,ProductId:e.productId,LabelCategoryId:e.labelCategoryId,LabelTypeId:e.labelTypeId,TemplateCode:e.templateCode,State:e.state},signal:t})}async function J5(e,t){return yd.requestJson({path:`${xd}/${encodeURIComponent(e)}`,method:"GET",signal:t})}async function Fue(e){return yd.requestJson({path:xd,method:"POST",body:{labelCode:e.labelCode,labelName:e.labelName,templateCode:e.templateCode,locationId:e.locationId,labelCategoryId:e.labelCategoryId,labelTypeId:e.labelTypeId,productIds:e.productIds,labelInfoJson:e.labelInfoJson,state:e.state??!0}})}async function Bue(e,t){return yd.requestJson({path:`${xd}/${encodeURIComponent(e)}`,method:"PUT",body:{labelName:t.labelName,templateCode:t.templateCode,locationId:t.locationId,labelCategoryId:t.labelCategoryId,labelTypeId:t.labelTypeId,productIds:t.productIds,labelInfoJson:t.labelInfoJson,state:t.state??!0}})}async function zue(e){await yd.requestJson({path:`${xd}/${encodeURIComponent(e)}`,method:"DELETE"})}const _g=un({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}});async function bd(e,t){return _g.requestJson({path:"/location",method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,Partner:e.partner,GroupName:e.groupName,State:e.state},signal:t})}async function que(e){return _g.requestJson({path:"/location",method:"POST",body:{partner:e.partner,groupName:e.groupName,locationCode:e.locationCode,locationName:e.locationName,street:e.street,city:e.city,stateCode:e.stateCode,country:e.country,zipCode:e.zipCode,phone:e.phone,email:e.email,latitude:e.latitude,longitude:e.longitude,state:e.state??!0}})}async function Uue(e,t){return _g.requestJson({path:`/location/${encodeURIComponent(e)}`,method:"PUT",body:{partner:t.partner,groupName:t.groupName,locationCode:t.locationCode,locationName:t.locationName,street:t.street,city:t.city,stateCode:t.stateCode,country:t.country,zipCode:t.zipCode,phone:t.phone,email:t.email,latitude:t.latitude,longitude:t.longitude,state:t.state??!0}})}async function Vue(e){await _g.requestJson({path:`/location/${encodeURIComponent(e)}`,method:"DELETE"})}const Cg=un({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Eg="/label-category";async function Q5(e,t){return Cg.requestJson({path:Eg,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,State:e.state},signal:t})}async function Hue(e){return Cg.requestJson({path:Eg,method:"POST",body:{categoryCode:e.categoryCode,categoryName:e.categoryName,categoryPhotoUrl:e.categoryPhotoUrl,state:e.state??!0,orderNum:e.orderNum}})}async function Wue(e,t){return Cg.requestJson({path:`${Eg}/${encodeURIComponent(e)}`,method:"PUT",body:{categoryCode:t.categoryCode,categoryName:t.categoryName,categoryPhotoUrl:t.categoryPhotoUrl,state:t.state??!0,orderNum:t.orderNum}})}async function Gue(e){await Cg.requestJson({path:`${Eg}/${encodeURIComponent(e)}`,method:"DELETE"})}const Og=un({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Pg="/label-type";async function kN(e,t){return Og.requestJson({path:Pg,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,State:e.state},signal:t})}async function Kue(e){return Og.requestJson({path:Pg,method:"POST",body:{typeCode:e.typeCode,typeName:e.typeName,state:e.state??!0,orderNum:e.orderNum}})}async function Yue(e,t){return Og.requestJson({path:`${Pg}/${encodeURIComponent(e)}`,method:"PUT",body:{typeCode:t.typeCode,typeName:t.typeName,state:t.state??!0,orderNum:t.orderNum}})}async function Xue(e){await Og.requestJson({path:`${Pg}/${encodeURIComponent(e)}`,method:"DELETE"})}const xm=[{key:"fat",label:"Total Fat",defaultUnit:"g"},{key:"saturatedFat",label:"Saturated Fat",defaultUnit:"g"},{key:"transFat",label:"Trans Fat",defaultUnit:"g"},{key:"cholesterol",label:"Cholesterol",defaultUnit:"mg"},{key:"sodium",label:"Sodium",defaultUnit:"mg"},{key:"carbs",label:"Total Carbohydrates",defaultUnit:"g"},{key:"dietaryFiber",label:"Dietary Fiber",defaultUnit:"g"},{key:"totalSugar",label:"Total Sugar",defaultUnit:"g"},{key:"protein",label:"Protein",defaultUnit:"g"},{key:"vitaminA",label:"Vitamin A",defaultUnit:"mcg"},{key:"vitaminC",label:"Vitamin C",defaultUnit:"mg"},{key:"calcium",label:"Calcium",defaultUnit:"mg"},{key:"iron",label:"Iron",defaultUnit:"mg"}],Z5=["Template","Label","Auto-generated","Print input"],eF={模版信息:"Template",模板信息:"Template",标签信息:"Label",自动生成:"Auto-generated",打印时输入:"Print input"};function RN(e){const t=String(e??"").trim();return Z5.includes(t)?t:eF[t]??"Template"}function tF(e){const t=String(e??"").trim();return Z5.includes(t)||t in eF}function rF(e){const t=RN(String(e));return t==="Auto-generated"?"AUTO_DB":t==="Print input"?"PRINT_INPUT":"FIXED"}function Jue(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"")||"field"}function Que(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Zue(e,t){const r=Jue(e),n=new RegExp(`^${Que(r)}(\\d+)$`,"i"),a=[];for(const s of t){const u=(s.elementName??"").trim();if(!u)continue;const d=u.match(n);d&&a.push(parseInt(d[1],10)),u.toLowerCase()===r&&a.push(1)}const i=a.length>0?Math.max(...a)+1:1;return`${r}${i}`}const ede={Template:"template",Label:"label","Auto-generated":"auto","Print input":"print"};function IN(e,t){const r=ede[e],n=(t??"").trim()||"Field";return`${r}_${n}`}const tde=/^(template|label|auto|print)_/;function rde(e){return tde.test(e.trim())}function nF(e){const t=e.config??{},r=Jn(e.type);if(Bl(e)){if(r==="TEXT_STATIC"){const n=t.inputType;return n==="number"?"Number":n==="options"?"Multiple Options":"Text"}if(r==="DATE")return"Date & Time";if(r==="WEIGHT")return"Weight"}switch(r){case"TEXT_PRODUCT":return"Label Name";case"TEXT_PRICE":return"Price";case"NUTRITION":return"Nutrition Facts";case"DURATION":return"Duration";case"DATE":return"Current Date";case"TIME":return"Current Time";case"BARCODE":return"Barcode";case"QRCODE":return"QR Code";case"BLANK":return"Blank Space";case"IMAGE":return"Image";case"WEIGHT_PRICE":return"Weight Price";case"TEXT_STATIC":return"Text";default:return r.replace(/_/g," ")}}function nde(){return`template-${Date.now()}`}function ade(){return`el-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function ide(e){return{id:e??nde(),name:"Unnamed template",labelType:"PRICE",unit:"cm",width:6,height:4,appliedLocation:"ALL",appliedLocationIds:[],showRuler:!0,showGrid:!0,elements:[]}}const X1=[{name:'2"×1"',width:2,height:1,unit:"inch"},{name:'2"×2"',width:2,height:2,unit:"inch"},{name:'3"×1"',width:3,height:1,unit:"inch"},{name:'3"×2"',width:3,height:2,unit:"inch"},{name:'4"×2"',width:4,height:2,unit:"inch"},{name:'4"×6"',width:4,height:6,unit:"inch"},{name:"6cm×4cm",width:6,height:4,unit:"cm"},{name:"10cm×6cm",width:10,height:6,unit:"cm"},{name:"A4",width:21,height:29.7,unit:"cm"},{name:"A5",width:14.8,height:21,unit:"cm"}];function ode(e,t=20,r=20){const n=ade(),i={TEXT_STATIC:{width:120,height:24,config:{text:"Text",fontFamily:"Arial",fontSize:14,fontWeight:"normal",textAlign:"left"}},TEXT_PRODUCT:{width:120,height:24,config:{text:"Product name",fontFamily:"Arial",fontSize:14,fontWeight:"normal",textAlign:"left"}},TEXT_PRICE:{width:80,height:24,config:{text:"0.00",decimal:2,fontFamily:"Arial",fontSize:14,fontWeight:"bold",textAlign:"right"}},BARCODE:{width:160,height:48,config:{barcodeType:"CODE128",data:"123456789",showText:!0,orientation:"horizontal"}},QRCODE:{width:80,height:80,config:{data:"https://example.com",errorLevel:"M"}},IMAGE:{width:60,height:60,config:{src:"",scaleMode:"contain"}},DATE:{width:120,height:24,config:{format:"DD/MM/YYYY",offsetDays:0,fontSize:14,textAlign:"left"}},TIME:{width:100,height:24,config:{format:"HH:mm",offsetDays:0}},DURATION:{width:120,height:24,config:{format:"Days",durationValue:3,fontSize:14,textAlign:"left"}},WEIGHT:{width:80,height:24,config:{unit:"g",value:500,fontSize:14,textAlign:"left"}},WEIGHT_PRICE:{width:100,height:24,config:{unitPrice:10,weight:.5,currency:"$"}},BLANK:{width:40,height:24,config:{}},NUTRITION:{width:200,height:120,config:{nutritionTitleFontSize:16,servingsPerContainer:"",servingSize:"",calories:"120",fat:"5",protein:"3",carbs:"10",layout:"standard",fixedNutrients:xm.map(s=>({key:s.key,label:s.label,value:s.key==="fat"?"5":s.key==="protein"?"3":s.key==="carbs"?"10":"",unit:s.defaultUnit??""})),extraNutrients:[]}}}[e];return{id:n,type:e,x:t,y:r,width:i.width,height:i.height,rotation:"horizontal",border:"none",config:{...i.config}}}function MN(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?{...e}:{};return delete t.prefix,delete t.Prefix,t}function aF(e){return e.map((t,r)=>({id:t.id,elementName:(t.elementName??"").trim(),type:Jn(t.type),typeAdd:$N(t),x:t.x,y:t.y,width:t.width,height:t.height,rotation:t.rotation,border:t.border,zIndex:t.zIndex??r+1,orderNum:t.orderNum??r+1,valueSourceType:sF(t),...t.inputKey!=null&&String(t.inputKey).trim()!==""?{inputKey:String(t.inputKey).trim()}:{},isRequiredInput:t.isRequiredInput??!1,config:MN(t.config??{})}))}function DN(e){const t=String(e.appliedLocation??"").trim().toUpperCase();return t==="ALL"?"ALL":t==="SPECIFIED"||(e.appliedLocationIds?.length??0)>0?"SPECIFIED":"ALL"}function Bl(e){const t=Jn(e.type);if(String(e.valueSourceType??"").trim().toUpperCase()==="PRINT_INPUT")return!0;const n=e.config??{};return t==="TEXT_STATIC"&&n.inputType!=null&&String(n.inputType).trim()!==""||t==="DATE"&&(n.inputType==="datetime"||n.inputType==="date")||t==="WEIGHT"}function sde(e){const t=e.config??{},r=Jn(e.type),n=typeof t.text=="string"?t.text.trim():"";if(n)return n;const a=t.inputType;return a==="number"?"Number":a==="text"?"Text":a==="options"?"Multiple Options":a==="datetime"||a==="date"?"Date & Time":r==="WEIGHT"?"Weight":r.replace(/_/g," ")}function lde(e){const t=e,r=e.inputKey??t.InputKey;return typeof r=="string"?r.trim():""}function iF(e){return Jn(e.type)==="BLANK"}function cde(e){const t=String(e.typeAdd??(LN.test(String(e.type??"").trim())?String(e.type??"").trim():$N(e))).trim().toLowerCase(),r=new Set(["template_text","template_price","template_logo","template_image","label_label name","label_text","label_price","label_duration date","label_duration time","label_duration","label_label type","label_expiration alert"]),n=Jn(e.type),a=oF(e);return iF(e)||n==="BARCODE"||n==="NUTRITION"?!1:a==="FIXED"&&r.has(t)}function ude(e){const t=Jn(e.type),r=(e.elementName??"").trim();if(r)return r;const n=lde(e);if(n)return n;const a=e.config??{};return t==="TEXT_PRODUCT"?(typeof a.text=="string"?a.text.trim():"")||"Product name":t==="TEXT_PRICE"?(typeof a.text=="string"?a.text.trim():"")||"Price":t==="IMAGE"?"Image":sde(e)}function fI(e){return[...e].sort((t,r)=>{const n=t.orderNum??0,a=r.orderNum??0;if(n!==a)return n-a;const i=t.zIndex??0,s=r.zIndex??0;return i!==s?i-s:0})}function oF(e){const t=String(e.valueSourceType??"").trim().toUpperCase();if(t==="FIXED"&&Bl({...e,valueSourceType:""}))return"PRINT_INPUT";if(t==="FIXED"||t==="AUTO_DB"||t==="PRINT_INPUT")return t;const r=(e.libraryCategory??"").trim();if(r.startsWith("print_"))return"PRINT_INPUT";if(r.startsWith("auto_"))return"AUTO_DB";if(r.startsWith("template_")||r.startsWith("label_"))return"FIXED";const n=e.libraryCategory??"";return tF(n)?rF(RN(n)):Bl({...e,valueSourceType:""})?"PRINT_INPUT":"FIXED"}function sF(e){return oF(e)}function lF(e){const t=Jn(e.type);if(Bl(e))return"Print input";switch(t){case"TEXT_PRODUCT":case"NUTRITION":case"DURATION":case"TEXT_PRICE":case"WEIGHT_PRICE":return"Label";case"DATE":case"TIME":return"Auto-generated";case"TEXT_STATIC":case"BARCODE":case"QRCODE":case"IMAGE":case"BLANK":default:return"Template"}}const dde=new Set(["TEXT_STATIC","TEXT_PRODUCT","TEXT_PRICE","BARCODE","QRCODE","IMAGE","DATE","TIME","DURATION","WEIGHT","WEIGHT_PRICE","BLANK","NUTRITION"]),LN=/^(template|label|auto|print)_(.+)$/i,fde={"template|text":"TEXT_STATIC","template|qr code":"QRCODE","template|barcode":"BARCODE","template|blank space":"BLANK","template|price":"TEXT_PRICE","template|image":"IMAGE","template|logo":"IMAGE","label|label name":"TEXT_PRODUCT","label|text":"TEXT_STATIC","label|qr code":"QRCODE","label|barcode":"BARCODE","label|nutrition facts":"NUTRITION","label|price":"TEXT_PRICE","label|duration date":"DATE","label|duration time":"TIME","label|duration":"DURATION","label|image":"IMAGE","label|label type":"TEXT_STATIC","label|how-to":"TEXT_STATIC","label|expiration alert":"TEXT_STATIC","auto|company":"TEXT_STATIC","auto|employee":"TEXT_STATIC","auto|current date":"DATE","auto|current time":"TIME","auto|label id":"TEXT_STATIC","print|text":"TEXT_STATIC","print|weight":"WEIGHT","print|number":"TEXT_STATIC","print|date & time":"DATE","print|multiple options":"TEXT_STATIC"};function hde(e){return String(e??"").trim().toLowerCase().replace(/\s+/g," ")}function Jn(e){const t=String(e??"").trim();if(dde.has(t))return t;const r=t.match(LN);if(r){const n=r[1].toLowerCase(),a=hde(r[2]),i=fde[`${n}|${a}`];if(i)return i}return"TEXT_STATIC"}function cF(e,t){return IN(e,t)}function $N(e){const t=String(e.type??"").trim();if(LN.test(t))return t;const r=lF(e),n=nF(e);return cF(r,n)}function pde(e){const t=e.libraryCategory?.trim();if(t&&rde(t))return t;const r=t&&tF(t)?RN(t):lF(e),n=nF(e);return IN(r,n)}const wd=un({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Sd="/label-template";function mde(e){const t=e;if(!t||typeof t!="object")return"";const r=t.id??t.templateCode??t.TemplateCode;return typeof r=="string"?r.trim():String(r??"").trim()}function gde(e){return Array.isArray(e)?e.map(t=>{const r=t,n=r.inputKey??r.InputKey,a=r.elementName??r.ElementName,i=r.typeAdd??r.TypeAdd,s=r.libraryCategory??r.LibraryCategory;let u;if(typeof s=="string"){const c=s.trim();c&&(u=c)}const d=r.config&&typeof r.config=="object"&&!Array.isArray(r.config)?r.config:{};return{...r,elementName:typeof a=="string"?a.trim():void 0,typeAdd:typeof i=="string"?i.trim():void 0,inputKey:typeof n=="string"?n:r.inputKey??null,libraryCategory:u,config:MN(d)}}):[]}function vde(e){if(e==null||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[r,n]of Object.entries(e))n==null?t[r]="":typeof n=="string"?t[r]=n:typeof n=="number"||typeof n=="boolean"?t[r]=String(n):t[r]=JSON.stringify(n);return t}function yde(e){return Array.isArray(e)?e.map((t,r)=>{const n=t,a=n.defaultValues??n.DefaultValues??n.defaultValuesJson??n.DefaultValuesJson;return{productId:String(n.productId??n.ProductId??"").trim(),labelTypeId:String(n.labelTypeId??n.LabelTypeId??"").trim(),defaultValues:vde(a),orderNum:Number(n.orderNum??n.OrderNum??r+1)||r+1}}):[]}function Ag(e){const t=e,n=((Array.isArray(t.appliedLocationIds)?t.appliedLocationIds:null)??(Array.isArray(t.AppliedLocationIds)?t.AppliedLocationIds:null)??[]).map(v=>String(v)),a=mde(e),i=t.templateName??t.TemplateName,s=t.templateCode??t.TemplateCode,u=t.locationText??t.LocationText,d=t.sizeText??t.SizeText,c=t.contentsCount??t.ContentsCount,f=typeof c=="number"?c:void 0,p=t.lastEdited??t.LastEdited,m=(typeof t.name=="string"&&t.name.trim()?t.name:null)??(typeof i=="string"&&String(i).trim()?String(i):null);return{...t,id:a,name:m??t.name,templateName:(typeof i=="string"?i:null)??t.templateName,templateCode:(typeof s=="string"?s:null)??t.templateCode,locationText:(typeof u=="string"?u:null)??t.locationText,sizeText:(typeof d=="string"?d:null)??t.sizeText,contentsCount:f??t.contentsCount,lastEdited:(typeof p=="string"?p:null)??t.lastEdited,appliedLocationIds:n,elements:gde(t.elements),templateProductDefaults:yde(t.templateProductDefaults??t.TemplateProductDefaults)}}async function uF(e,t){const r=await wd.requestJson({path:Sd,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,LocationId:e.locationId,LabelType:e.labelType,State:e.state},signal:t}),n=(r.items??[]).map(a=>Ag(a));return{...r,items:n}}async function dF(e,t){const r=await wd.requestJson({path:`${Sd}/${encodeURIComponent(e)}`,method:"GET",signal:t});return Ag(r)}async function xde(e){const t=await wd.requestJson({path:Sd,method:"POST",body:{id:e.id,name:e.name,labelType:e.labelType,unit:e.unit,width:e.width,height:e.height,appliedLocation:e.appliedLocation,showRuler:e.showRuler??!0,showGrid:e.showGrid??!0,state:e.state??!0,elements:e.elements,appliedLocationIds:e.appliedLocationIds??[]}});return Ag(t)}async function fF(e,t){const r={id:t.id,name:t.name,labelType:t.labelType,unit:t.unit,width:t.width,height:t.height,appliedLocation:t.appliedLocation,showRuler:t.showRuler??!0,showGrid:t.showGrid??!0,state:t.state??!0,elements:t.elements,appliedLocationIds:t.appliedLocationIds??[]};t.templateProductDefaults!==void 0&&(r.templateProductDefaults=t.templateProductDefaults.map((a,i)=>({productId:a.productId,labelTypeId:a.labelTypeId,defaultValues:a.defaultValues,orderNum:a.orderNum??i+1})));const n=await wd.requestJson({path:`${Sd}/${encodeURIComponent(e)}`,method:"PUT",body:r});return Ag(n)}async function bde(e){await wd.requestJson({path:`${Sd}/${encodeURIComponent(e)}`,method:"DELETE"})}const jd=un({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Nd="/product";function Tg(e){const t=e,r=String(t?.id??t?.Id??"").trim();return{...t,id:r,productCode:t?.productCode??t?.ProductCode,productName:t?.productName??t?.ProductName,categoryId:t?.categoryId??t?.CategoryId,categoryName:t?.categoryName??t?.CategoryName,productImageUrl:t?.productImageUrl??t?.ProductImageUrl,state:typeof t?.state=="boolean"?t.state:typeof t?.State=="boolean"?t.State:null}}async function bm(e,t){const r=await jd.requestJson({path:Nd,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,State:e.state},signal:t});return{...r,items:(r.items??[]).map(n=>Tg(n))}}async function wde(e,t){const r=await jd.requestJson({path:`${Nd}/${encodeURIComponent(e)}`,method:"GET",signal:t});return Tg(r)}async function Sde(e){const t=await jd.requestJson({path:Nd,method:"POST",body:{productCode:e.productCode,productName:e.productName,categoryId:e.categoryId?.trim()?e.categoryId.trim():null,productImageUrl:e.productImageUrl??null,state:e.state??!0}});return Tg(t)}async function jde(e,t){const r=await jd.requestJson({path:`${Nd}/${encodeURIComponent(e)}`,method:"PUT",body:{productCode:t.productCode,productName:t.productName,categoryId:t.categoryId?.trim()?t.categoryId.trim():null,productImageUrl:t.productImageUrl??null,state:t.state??!0}});return Tg(r)}async function Nde(e){await jd.requestJson({path:`${Nd}/${encodeURIComponent(e)}`,method:"DELETE"})}const _de="/api/app/picture/category/upload";function Cde(e,t){const r=e.replace(/\/$/,""),n=t.startsWith("/")?t:`/${t}`;return`${r}${n}`}const hF=5*1024*1024;function pF(){return"http://flus-test.3ffoodsafety.com".replace(/\/$/,"")??"http://localhost:19001"}function Ede(){try{return localStorage.getItem("access_token")??localStorage.getItem("token")}catch{return null}}function hI(e){if(typeof e=="string"&&e.trim()){const r=e.trim();if(/^https?:\/\//i.test(r)||r.startsWith("/")||r.startsWith("data:"))return r}if(!e||typeof e!="object")return null;const t=e;for(const r of["url","Url","fileUrl","FileUrl","imageUrl","ImageUrl","path","Path"]){const n=t[r];if(typeof n=="string"&&n.trim())return n.trim()}return null}function Ode(e){if(!e||typeof e!="object")return e;const t=e;return"data"in t&&t.data!==void 0?t.data:"result"in t&&t.result!==void 0?t.result:e}function Pde(e,t){if(e&&typeof e=="object"){const r=e,n=r.errors??r.Errors;if(typeof n=="string"&&n.trim())return n.trim();const a=r.error;if(a&&typeof a.message=="string"&&a.message.trim())return a.message.trim()}return`Upload failed (${t})`}function Zu(e){const t=(e??"").trim();if(!t)return"";if(t.startsWith("data:")||/^https?:\/\//i.test(t))return t;const r=pF();return t.startsWith("/")?`${r}${t}`:`${r}/${t}`}function Ade(e){if(e.size>hF)throw new Error("Image must be 5 MB or smaller.");const t=/^(image\/(jpeg|png|webp|gif))$/i.test(e.type),r=/\.(jpe?g|png|webp|gif)$/i.test(e.name);if(!t&&!r)throw new Error("Only JPG, PNG, WebP, and GIF are allowed.")}async function Tde(e,t){Ade(e);const r=t?.subDir?.trim();if(r&&r.includes(".."))throw new Error("Invalid subDir.");const n=Cde(pF(),_de),a=new FormData;a.append("file",e),r&&a.append("subDir",r);const i={},s=Ede();s&&(i.Authorization=`Bearer ${s}`);const u=await fetch(n,{method:"POST",body:a,headers:i,signal:t?.signal}),d=await u.text();let c=d;try{c=d?JSON.parse(d):null}catch{c=d}if(!u.ok)throw new Error(Pde(c,u.status));const f=Ode(c),p=hI(f)??hI(c);if(!p)throw new Error("Upload response did not contain a usable image URL.");return p}function _d({value:e,onChange:t,disabled:r,hint:n,emptyLabel:a="",accept:i="image/jpeg,image/png,image/webp,image/gif",maxSizeMb:s=hF/(1024*1024),className:u,boxClassName:d,uploadSubDir:c,oneImageOnly:f}){const p=b.useRef(null),[m,v]=b.useState(!1),y=async N=>{const C=N.target.files?.[0];if(N.target.value="",!!C){if(!C.type.startsWith("image/")){me.error("Please select an image file.");return}if(C.size>s*1024*1024){me.error(`Image must be ${s} MB or smaller.`);return}v(!0);try{const A=await Tde(C,{subDir:c});t(A),me.success("Image uploaded.")}catch(A){const E=A instanceof Error?A.message:String(A);me.error("Upload failed",{description:E||void 0})}finally{v(!1)}}},x=r||m,w=()=>{x||p.current?.click()},j="w-full max-w-[200px] aspect-square rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2";return o.jsxs("div",{className:Ee("space-y-2",u),children:[o.jsx("input",{ref:p,type:"file",accept:i,className:"sr-only",disabled:x,multiple:!1,onChange:y}),e?o.jsxs("div",{className:Ee("group relative overflow-hidden rounded-md border-2 border-dashed border-gray-300 bg-gray-50/80",j,d),children:[o.jsxs("button",{type:"button",disabled:x,onClick:w,className:"relative h-full w-full p-0","aria-label":"Replace image",children:[o.jsx("img",{src:Zu(e),alt:"",className:"h-full w-full object-contain",onError:N=>{N.target.style.opacity="0.2"}}),o.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-black/0 text-sm font-medium text-white opacity-0 transition group-hover:bg-black/45 group-hover:opacity-100",children:"Click to replace"})]}),o.jsx("button",{type:"button",disabled:x,onClick:N=>{N.stopPropagation(),t("")},className:"absolute right-1.5 top-1.5 flex h-7 w-7 items-center justify-center rounded-full bg-white/95 text-gray-600 shadow-sm ring-1 ring-gray-200 transition hover:bg-white hover:text-gray-900 disabled:opacity-50","aria-label":"Remove image",children:o.jsx(no,{className:"h-4 w-4"})})]}):o.jsx("button",{type:"button",disabled:x,onClick:w,"aria-label":a||"Upload image",className:Ee(j,"flex border-2 border-dashed border-gray-300 bg-gray-50/80 text-gray-400",a&&!m?"flex-col items-center justify-center gap-2":"items-center justify-center","hover:border-gray-400 hover:bg-gray-100/90 hover:text-gray-500","disabled:pointer-events-none disabled:opacity-50",d),children:m?o.jsx("span",{className:"px-3 text-center text-sm font-normal text-gray-500",children:"Uploading…"}):o.jsxs(o.Fragment,{children:[o.jsx(ln,{className:"h-10 w-10 shrink-0 stroke-[1.25]","aria-hidden":!0}),a?o.jsx("span",{className:"px-3 text-center text-sm font-normal leading-tight text-gray-400",children:a}):null]})}),f?o.jsx("p",{className:"text-xs text-muted-foreground",children:"One image only. Replace or clear to change."}):null,n?o.jsx("p",{className:"text-xs text-muted-foreground",children:n}):null]})}function J1(){try{return crypto.randomUUID()}catch{return`row-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}}const kde="h-[100px] w-[100px] min-h-[100px] min-w-[100px] max-h-[100px] max-w-[100px] shrink-0 aspect-auto";function Rde(e){const t=Jn(e.type);return t==="IMAGE"||t==="QRCODE"?!0:(e.elementName??"").trim().toLowerCase().includes("qrcode")}function Ide({element:e,value:t,onValueChange:r}){return Rde(e)?o.jsx(_d,{value:t,onChange:r,uploadSubDir:"label-template-data",oneImageOnly:!0,boxClassName:kde,hint:"Upload stores full URL/path for save."}):o.jsx(ye,{value:t,onChange:n=>r(n.target.value),placeholder:"—",className:"h-10 border-gray-300"})}function Mde({templateCode:e,onBack:t,contextHint:r}){const[n,a]=b.useState(!0),[i,s]=b.useState(!1),[u,d]=b.useState(""),[c,f]=b.useState(null),[p,m]=b.useState([]),[v,y]=b.useState([]),[x,w]=b.useState([]),[j,N]=b.useState([]),C=b.useMemo(()=>v.map(L=>{const $=(L.productName??L.productCode??"").trim()||L.id;return{value:L.id,label:$}}),[v]),A=b.useMemo(()=>x.map(L=>{const $=(L.typeName??L.typeCode??"").trim()||L.id;return{value:L.id,label:$}}),[x]);b.useEffect(()=>{let L=!1;return(async()=>{a(!0);try{const[$,I,H]=await Promise.all([dF(e),bm({skipCount:Ua(1),maxResultCount:500}),kN({skipCount:Ua(1),maxResultCount:500})]);if(L)return;const Y=($.templateName??$.name??"").trim()||($.templateCode??$.id??"").trim()||e;d(Y);const W=fI($.elements??[]).filter(cde);m(W),y(I.items??[]),w(H.items??[]),f($);const V=$.templateProductDefaults??[],K=V.length>0?[...V].sort((F,te)=>(F.orderNum??0)-(te.orderNum??0)):[];K.length>0?N(K.map(F=>({id:J1(),productId:F.productId,labelTypeId:F.labelTypeId,fieldValues:{...F.defaultValues}}))):N([{id:J1(),productId:"",labelTypeId:"",fieldValues:{}}])}catch($){L||(me.error("Failed to load template or options.",{description:$ instanceof Error?$.message:"Please try again."}),d(e),m([]),N([]),f(null))}finally{L||a(!1)}})(),()=>{L=!0}},[e]);const E=b.useCallback(()=>{N(L=>[...L,{id:J1(),productId:"",labelTypeId:"",fieldValues:{}}])},[]),O=b.useCallback(L=>{N($=>$.length<=1?$:$.filter(I=>I.id!==L))},[]),T=b.useCallback((L,$)=>{N(I=>I.map(H=>H.id===L?{...H,...$}:H))},[]),k=b.useCallback((L,$,I)=>{N(H=>H.map(Y=>Y.id!==L?Y:{...Y,fieldValues:{...Y.fieldValues,[$]:I}}))},[]),M=b.useCallback(async()=>{if(!c){me.error("Template not loaded",{description:"Please reload the page and try again."});return}if(j.filter(V=>V.productId.trim()||V.labelTypeId.trim()).some(V=>!V.productId.trim()||!V.labelTypeId.trim())){me.error("Product and label type required",{description:"Each row that you started must have both Product and Label type selected."});return}const H=j.filter(V=>V.productId.trim()&&V.labelTypeId.trim()).map((V,K)=>{const F={};for(const te of p)F[te.id]=V.fieldValues[te.id]??"";return{productId:V.productId.trim(),labelTypeId:V.labelTypeId.trim(),defaultValues:F,orderNum:K+1}}),Y=fI(c.elements??[]);if(Y.length===0){me.error("Template has no elements",{description:"Cannot save this template."});return}const W=DN(c);s(!0);try{const V=await fF(e,{id:c.id,name:(c.name??c.templateName??"").trim()||e,labelType:c.labelType??"PRICE",unit:c.unit??"inch",width:Number(c.width??2),height:Number(c.height??2),appliedLocation:W,showRuler:c.showRuler??!0,showGrid:c.showGrid??!0,state:c.state??!0,elements:aF(Y),appliedLocationIds:W==="ALL"?[]:c.appliedLocationIds??[],templateProductDefaults:H});f(V),me.success("Saved",{description:"Template product defaults were updated on the server."})}catch(V){me.error("Save failed",{description:V instanceof Error?V.message:"Please try again."})}finally{s(!1)}},[e,c,j,p]);return o.jsxs("div",{className:"h-full flex flex-col min-h-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-3 pb-4 border-b border-gray-200 shrink-0",children:[o.jsxs(he,{type:"button",variant:"outline",className:"h-10 gap-2",onClick:t,children:[o.jsx(AM,{className:"h-4 w-4"}),"Back"]}),o.jsxs("div",{className:"flex-1 min-w-[200px]",children:[o.jsx("div",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Label template"}),o.jsx("h2",{className:"text-lg font-semibold text-gray-900 truncate",title:u,children:u}),r?o.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",title:r,children:r}):null]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(he,{type:"button",variant:"outline",className:"h-10 gap-1",onClick:E,children:[o.jsx(ln,{className:"h-4 w-4"}),"Add row"]}),o.jsx(he,{type:"button",className:"h-10 bg-blue-600 hover:bg-blue-700",onClick:()=>void M(),disabled:i||n||!c,children:i?"Saving…":"Save"})]})]}),o.jsxs("p",{className:"text-sm text-gray-600 py-3 shrink-0",children:["Bind product and label type per row. Values are saved with the template (edit API) as"," ",o.jsx("span",{className:"font-medium",children:"templateProductDefaults"})," (interface doc section 4.4). Only"," ",o.jsx("span",{className:"font-medium",children:"manual input"})," controls appear here (",o.jsx("span",{className:"font-medium",children:"PRINT_INPUT"})," and Duration series). Non-manual controls such as"," ",o.jsx("span",{className:"font-medium",children:"AUTO_DB / NUTRITION"})," are excluded."," ",o.jsx("span",{className:"font-medium",children:"BARCODE"})," is excluded here and must be generated from print-time input/data. Column headers use"," ",o.jsx("span",{className:"font-medium",children:"elementName"}),"."]}),o.jsx("div",{className:"flex-1 min-h-0 overflow-auto rounded-md border bg-white shadow-sm",children:n?o.jsx("div",{className:"p-10 text-center text-sm text-gray-500",children:"Loading…"}):p.length===0?o.jsxs("div",{className:"p-10 text-center text-sm text-gray-600",children:["No manual input fields (",o.jsx("span",{className:"font-medium",children:"PRINT_INPUT / Duration series"}),") in this template."]}):o.jsxs(Fr,{children:[o.jsx(Br,{children:o.jsxs(Be,{className:"bg-gray-50 hover:bg-gray-50",children:[o.jsx(xe,{className:"font-bold text-gray-900 w-[200px] min-w-[160px]",children:"Product"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[180px] min-w-[140px]",children:"Label type"}),p.map(L=>o.jsx(xe,{className:"font-bold text-gray-900 min-w-[120px] whitespace-nowrap",title:L.id,children:ude(L)},L.id)),o.jsx(xe,{className:"w-[72px] text-center font-bold text-gray-900",children:" "})]})}),o.jsx(zr,{children:j.map(L=>o.jsxs(Be,{className:"hover:bg-gray-50",children:[o.jsx(fe,{className:"align-top py-2",children:o.jsx(Wn,{value:L.productId,onValueChange:$=>T(L.id,{productId:$}),options:C,placeholder:"Select product",searchPlaceholder:"Search product…"})}),o.jsx(fe,{className:"align-top py-2",children:o.jsx(Wn,{value:L.labelTypeId,onValueChange:$=>T(L.id,{labelTypeId:$}),options:A,placeholder:"Select label type",searchPlaceholder:"Search type…"})}),p.map($=>o.jsx(fe,{className:"align-top py-2",children:o.jsx(Ide,{element:$,value:L.fieldValues[$.id]??"",onValueChange:I=>k(L.id,$.id,I)})},$.id)),o.jsx(fe,{className:"text-center align-top py-2",children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 text-red-600 hover:text-red-700 hover:bg-red-50","aria-label":"Remove row",onClick:()=>O(L.id),disabled:j.length<=1,children:o.jsx(Et,{className:"h-4 w-4"})})})]},L.id))})]})})]})}function pa(e){const t=(e??"").trim();return t||"None"}function hh(e){return(e.labelCode??e.id??"").trim()||"None"}function pI(e){const t=e,r=e.templateCode,n=t.TemplateCode;return((typeof r=="string"?r:typeof n=="string"?n:"")||"").trim()}function Dde(e){const t=(e.products??"").trim();if(t)return t;const r=(e.productName??"").trim();if(r)return r;const n=e.productIds?.length??0;return n>0?`${n} product(s)`:"None"}function Lde(e){const t=(e.lastEdited??"").trim();if(t)return t;const r=e.creationTime;if(r)try{return new Date(r).toLocaleString()}catch{return String(r)}return"None"}function mI(e){const t=e.productIds;return{labelName:e.labelName??"",templateCode:e.templateCode??"",locationId:e.locationId??"",labelCategoryId:e.labelCategoryId??"",labelTypeId:e.labelTypeId??"",productIds:Array.isArray(t)?[...t]:[],labelInfoJson:e.labelInfoJson??null,state:e.state??!0}}function ed(e){return(e.templateCode??e.id??"").trim()}function mF(e){const t=(e.templateName??e.name??"").trim()||"None",r=ed(e)||"None";return`${t} (${r})`}function gF(e){const[t,r]=b.useState(!1),[n,a]=b.useState([]),[i,s]=b.useState([]),[u,d]=b.useState([]),[c,f]=b.useState([]),[p,m]=b.useState([]);b.useEffect(()=>{if(!e)return;let y=!1;return(async()=>{r(!0);try{const[x,w,j,N,C]=await Promise.all([uF({skipCount:1,maxResultCount:500}),bd({skipCount:1,maxResultCount:500}),Q5({skipCount:1,maxResultCount:500}),kN({skipCount:1,maxResultCount:500}),bm({skipCount:1,maxResultCount:500})]);if(y)return;a(x.items??[]),s(w.items??[]),d(j.items??[]),f(N.items??[]),m(C.items??[])}catch(x){y||(me.error("Failed to load options",{description:x?.message?String(x.message):"Check network or sign-in."}),a([]),s([]),d([]),f([]),m([]))}finally{y||r(!1)}})(),()=>{y=!0}},[e]);const v=b.useMemo(()=>p.map(y=>{const x=(y.productName??y.productCode??"").trim()||y.id;return{id:y.id,name:x}}),[p]);return{loading:t,templates:n,locations:i,categories:u,types:c,productOptions:v}}function vF({value:e,onChange:t,disabled:r,productOptions:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>{if(e.length===0)return"Select products (multi-select)";const c=e.map(p=>n.find(m=>m.id===p)?.name??p).slice(0,2),f=e.length>2?`, ${e.length} total`:"";return`${c.join(", ")}${f}`},[e,n]),u=b.useCallback((c,f)=>{const p=new Set(e);f?p.add(c):p.delete(c),t(Array.from(p))},[e,t]),d=b.useMemo(()=>e.filter(c=>!n.some(f=>f.id===c)),[e,n]);return o.jsxs(ya,{open:a,onOpenChange:i,children:[o.jsx(xa,{asChild:!0,children:o.jsxs(he,{type:"button",variant:"outline",role:"combobox",disabled:r,className:"w-full justify-between h-10 px-3 font-normal border border-gray-300 bg-white",children:[o.jsx("span",{className:"truncate text-left text-sm",children:s}),o.jsx(IM,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(ba,{className:"w-[var(--radix-popover-trigger-width)] max-w-[min(100vw-2rem,400px)] p-0",align:"start",children:o.jsxs(G5,{children:[o.jsx(K5,{placeholder:"Search products…"}),o.jsxs(Y5,{children:[o.jsx(X5,{children:"No matching products."}),o.jsxs(US,{children:[n.map(c=>o.jsxs(VS,{value:`${c.name} ${c.id}`,onSelect:()=>{u(c.id,!e.includes(c.id))},className:"cursor-pointer",children:[o.jsx(Qu,{className:"pointer-events-none",checked:e.includes(c.id)}),o.jsxs("span",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"font-medium",children:c.name}),o.jsx("span",{className:"block text-xs text-gray-400 truncate",children:c.id})]})]},c.id)),d.length>0?o.jsx(US,{heading:"Linked (not in current list, can deselect)",children:d.map(c=>o.jsxs(VS,{value:c,onSelect:()=>{u(c,!e.includes(c))},className:"cursor-pointer",children:[o.jsx(Qu,{className:"pointer-events-none",checked:e.includes(c)}),o.jsx("span",{className:"text-xs font-mono truncate",children:c})]},c))}):null]})]})]})})]})}function $de(){const[e,t]=b.useState(null),[r,n]=b.useState(void 0),[a,i]=b.useState(!1),[s,u]=b.useState(!1),[d,c]=b.useState(!1),[f,p]=b.useState(null),[m,v]=b.useState(null),[y,x]=b.useState([]),[w,j]=b.useState(!1),[N,C]=b.useState(0),[A,E]=b.useState(0),[O,T]=b.useState(null),[k,M]=b.useState(""),[L,$]=b.useState("all"),[I,H]=b.useState("all"),[Y,W]=b.useState("all"),[V,K]=b.useState("all"),[F,te]=b.useState("all"),[D,U]=b.useState(1),[z,B]=b.useState(10),X=b.useRef(null),Q=b.useRef(null),[re,G]=b.useState("");b.useEffect(()=>(Q.current&&window.clearTimeout(Q.current),Q.current=window.setTimeout(()=>G(k.trim()),300),()=>{Q.current&&window.clearTimeout(Q.current)}),[k]);const Z=Math.max(1,Math.ceil(N/z));b.useEffect(()=>{U(1)},[re,L,I,Y,V,F,z]),b.useEffect(()=>((async()=>{X.current?.abort();const Pe=new AbortController;X.current=Pe,j(!0);try{const $e=Ua(D),Fe=await $ue({skipCount:$e,maxResultCount:z,keyword:re||void 0,locationId:L!=="all"?L:void 0,labelCategoryId:I!=="all"?I:void 0,labelTypeId:Y!=="all"?Y:void 0,templateCode:V!=="all"?V:void 0,state:F==="all"?void 0:F==="true"},Pe.signal);x(Fe.items??[]),C(Fe.totalCount??0)}catch($e){if($e?.name==="AbortError")return;me.error("Failed to load labels.",{description:$e?.message?String($e.message):"Please try again."}),x([]),C(0)}finally{j(!1)}})(),()=>X.current?.abort()),[re,L,I,Y,V,F,D,z,A]);const ee=()=>E(pe=>pe+1),ce=pe=>{T(null),p(pe),u(!0)},ve=pe=>{T(null),v(pe),c(!0)},ne=async pe=>{T(null);let Pe=pI(pe);if(!Pe){const dt=hh(pe);if(dt==="None"){me.error("No template bound",{description:"Missing label code. Edit this label and select a template before entering template data."});return}const ct=me.loading("Loading label…");try{const St=await J5(dt);Pe=pI(St)}catch(St){me.dismiss(ct),me.error("Failed to load label",{description:St instanceof Error?St.message:"Please try again."});return}me.dismiss(ct)}if(!Pe){me.error("No template bound",{description:"Edit this label and select a template before entering template data."});return}const $e=(pe.labelName??"").trim()||hh(pe),Fe=hh(pe);n(`Bound label: ${$e} (${Fe}) — template defaults apply to this template.`),t(Pe)},Ce=()=>{t(null),n(void 0),ee()};return e?o.jsx("div",{className:"h-[calc(100vh-8rem)] min-h-[500px] flex flex-col pt-2",children:o.jsx(Mde,{templateCode:e,onBack:Ce,contextHint:r})}):o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"pb-4",children:o.jsx("div",{className:"flex flex-col gap-4",children:o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ye,{placeholder:"Search",value:k,onChange:pe=>M(pe.target.value),style:{height:40,boxSizing:"border-box"},className:"bg-white border border-gray-300 rounded-md w-40 shrink-0 placeholder:text-gray-500"}),o.jsxs(Ve,{value:L,onValueChange:$,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Location"})}),o.jsx(Ge,{children:o.jsx(je,{value:"all",children:"All Locations"})})]}),o.jsxs(Ve,{value:I,onValueChange:H,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Category"})}),o.jsx(Ge,{children:o.jsx(je,{value:"all",children:"All Categories"})})]}),o.jsxs(Ve,{value:Y,onValueChange:W,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Type"})}),o.jsx(Ge,{children:o.jsx(je,{value:"all",children:"All Types"})})]}),o.jsxs(Ve,{value:F,onValueChange:te,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"State"})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"all",children:"All States"}),o.jsx(je,{value:"true",children:"Active"}),o.jsx(je,{value:"false",children:"Inactive"})]})]}),o.jsx("div",{className:"flex-1"}),o.jsxs(he,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0",onClick:()=>i(!0),children:["New Label ",o.jsx(ln,{className:"ml-1 h-4 w-4"})]})]})})}),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:o.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:o.jsxs(Fr,{children:[o.jsx(Br,{children:o.jsxs(Be,{className:"bg-gray-50 hover:bg-gray-50",children:[o.jsx(xe,{className:"font-bold text-gray-900 w-[120px]",children:"Label Code"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[140px]",children:"Label Name"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[120px]",children:"Location"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[140px]",children:"Category"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[140px]",children:"Type"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[120px]",children:"Template"}),o.jsx(xe,{className:"font-bold text-gray-900",children:"Products"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[100px]",children:"State"}),o.jsx(xe,{className:"font-bold text-gray-900",children:"Last Edited"}),o.jsx(xe,{className:"font-bold text-gray-900 text-center w-[100px]",children:"Actions"})]})}),o.jsx(zr,{children:w?o.jsx(Be,{children:o.jsx(fe,{colSpan:10,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):y.length===0?o.jsx(Be,{children:o.jsx(fe,{colSpan:10,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):y.map(pe=>o.jsxs(Be,{className:"hover:bg-gray-50",children:[o.jsx(fe,{className:"font-medium whitespace-nowrap",children:hh(pe)}),o.jsx(fe,{className:"whitespace-nowrap",children:pa(pe.labelName)}),o.jsx(fe,{className:"text-gray-600 whitespace-nowrap",children:pa(pe.locationName??pe.locationId)}),o.jsx(fe,{className:"text-gray-600 whitespace-nowrap",children:pa(pe.labelCategoryName??pe.labelCategoryId)}),o.jsx(fe,{className:"text-gray-600 whitespace-nowrap",children:pa(pe.labelTypeName??pe.labelTypeId)}),o.jsx(fe,{className:"text-gray-600 whitespace-nowrap",children:pa(pe.templateName??pe.templateCode)}),o.jsx(fe,{className:"text-gray-600 whitespace-nowrap",children:Dde(pe)}),o.jsx(fe,{children:o.jsx($r,{className:pe.state===!0?"bg-green-600":"bg-gray-400",children:pe.state===!0?"Active":"Inactive"})}),o.jsx(fe,{className:"text-gray-500 tabular-nums font-numeric whitespace-nowrap",children:Lde(pe)}),o.jsx(fe,{className:"text-center",children:o.jsxs(ya,{open:O===pe.id,onOpenChange:Pe=>T(Pe?pe.id:null),children:[o.jsx(xa,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:o.jsx(pi,{className:"h-4 w-4 text-gray-500"})})}),o.jsxs(ba,{align:"end",className:"w-48 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",title:"Add data to this label’s bound template",onClick:()=>ne(pe),children:[o.jsx(l6,{className:"w-4 h-4"}),"Enter Data"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>ce(pe),children:[o.jsx(Cn,{className:"w-4 h-4"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>ve(pe),children:[o.jsx(Et,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},pe.id))})]})})}),o.jsx("div",{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[o.jsxs("div",{children:["Showing ",N===0?0:(D-1)*z+1,"-",Math.min(D*z,N)," of ",N]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String(z),onValueChange:pe=>B(Number(pe)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(pe=>o.jsxs(je,{value:String(pe),children:[pe," / page"]},pe))})]}),o.jsx(bi,{className:"mx-0 w-auto justify-end",children:o.jsxs(wi,{children:[o.jsx(At,{children:o.jsx(Si,{href:"#",size:"default",onClick:pe=>{pe.preventDefault(),U(Pe=>Math.max(1,Pe-1))},"aria-disabled":D<=1,className:D<=1?"pointer-events-none opacity-50":""})}),o.jsx(At,{children:o.jsxs(wa,{href:"#",isActive:!0,size:"default",onClick:pe=>pe.preventDefault(),children:["Page ",D," / ",Z]})}),o.jsx(At,{children:o.jsx(ji,{href:"#",size:"default",onClick:pe=>{pe.preventDefault(),U(Pe=>Math.min(Z,Pe+1))},"aria-disabled":D>=Z,className:D>=Z?"pointer-events-none opacity-50":""})})]})})]})]})}),o.jsx(Fde,{open:a,onOpenChange:i,onCreated:()=>{U(1),ee()}}),o.jsx(Bde,{open:s,label:f,onOpenChange:pe=>{u(pe),pe||p(null)},onUpdated:ee}),o.jsx(zde,{open:d,label:m,onOpenChange:pe=>{c(pe),pe||v(null)},onDeleted:ee})]})}function Fde({open:e,onOpenChange:t,onCreated:r}){const{loading:n,templates:a,locations:i,categories:s,types:u,productOptions:d}=gF(e),[c,f]=b.useState(!1),[p,m]=b.useState({labelCode:"",labelName:"",templateCode:"",locationId:"",labelCategoryId:"",labelTypeId:"",productIds:[],labelInfoJson:null,state:!0}),v=()=>{m({labelCode:"",labelName:"",templateCode:"",locationId:"",labelCategoryId:"",labelTypeId:"",productIds:[],labelInfoJson:null,state:!0})};b.useEffect(()=>{e||v()},[e]);const y=async()=>{if(!p.labelCode.trim()||!p.labelName.trim()||!p.templateCode.trim()||!p.locationId.trim()||!p.labelCategoryId.trim()||!p.labelTypeId.trim()){me.error("Validation failed",{description:"Fill all required fields and select template, location, category, and type."});return}if(p.productIds.length===0){me.error("Validation failed",{description:"Select at least one product."});return}f(!0);try{await Fue(p),me.success("Label created.",{description:"The label has been created successfully."}),t(!1),r()}catch(C){me.error("Failed to create label.",{description:C?.message?String(C.message):"Please try again."})}finally{f(!1)}},x=b.useMemo(()=>a.filter(C=>ed(C)).map(C=>({value:ed(C),label:mF(C)})),[a]),w=b.useMemo(()=>i.map(C=>({value:C.id,label:pa(C.locationName??C.locationCode??C.id)})),[i]),j=b.useMemo(()=>s.map(C=>({value:C.id,label:pa(C.categoryName??C.categoryCode??C.id)})),[s]),N=b.useMemo(()=>u.map(C=>({value:C.id,label:pa(C.typeName??C.typeCode??C.id)})),[u]);return o.jsx(xt,{open:e,onOpenChange:t,children:o.jsxs(gt,{className:"sm:max-w-[600px]",children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Add New Label"}),o.jsx(kt,{children:"Enter the details for the new label."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Label Code *"}),o.jsx(ye,{className:"h-10",placeholder:"e.g. LBL_TEST_001",value:p.labelCode,onChange:C=>m(A=>({...A,labelCode:C.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Label Name *"}),o.jsx(ye,{className:"h-10",placeholder:"e.g. Breakfast label",value:p.labelName,onChange:C=>m(A=>({...A,labelName:C.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Label Template *"}),o.jsx(Wn,{value:p.templateCode,onValueChange:C=>m(A=>({...A,templateCode:C})),options:x,placeholder:"Select template",searchPlaceholder:"Search template…",emptyText:"No templates found.",disabled:n})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Location *"}),o.jsx(Wn,{value:p.locationId,onValueChange:C=>m(A=>({...A,locationId:C})),options:w,placeholder:"Select location",searchPlaceholder:"Search location…",emptyText:"No locations found.",disabled:n})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Label Category *"}),o.jsx(Wn,{value:p.labelCategoryId,onValueChange:C=>m(A=>({...A,labelCategoryId:C})),options:j,placeholder:"Select category",searchPlaceholder:"Search category…",emptyText:"No categories found.",disabled:n})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Label Type *"}),o.jsx(Wn,{value:p.labelTypeId,onValueChange:C=>m(A=>({...A,labelTypeId:C})),options:N,placeholder:"Select type",searchPlaceholder:"Search type…",emptyText:"No types found.",disabled:n})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Product * (multi-select)"}),o.jsx(vF,{value:p.productIds,onChange:C=>m(A=>({...A,productIds:C})),disabled:n,productOptions:d})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Zt,{checked:p.state,onCheckedChange:C=>m(A=>({...A,state:C}))})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{disabled:c||n,onClick:y,children:c?"Creating…":"Create"})]})]})})}function Bde({open:e,label:t,onOpenChange:r,onUpdated:n}){const{loading:a,templates:i,locations:s,categories:u,types:d,productOptions:c}=gF(e),[f,p]=b.useState(!1),[m,v]=b.useState(!1),[y,x]=b.useState({labelName:"",templateCode:"",locationId:"",labelCategoryId:"",labelTypeId:"",productIds:[],labelInfoJson:null,state:!0});b.useEffect(()=>{if(!e||!t?.id)return;const E=t.id;x(mI(t));const O=new AbortController;let T=!1;return v(!0),(async()=>{try{const k=await J5(E,O.signal);if(T)return;x(mI(k))}catch(k){if(T||k?.name==="AbortError")return;me.error("Failed to load label details.",{description:k?.message?String(k.message):"Form shows list data only; check network."})}finally{T||v(!1)}})(),()=>{T=!0,O.abort()}},[e,t]);const w=async()=>{if(t?.id){if(!y.labelName.trim()||!y.templateCode.trim()||!y.locationId.trim()||!y.labelCategoryId.trim()||!y.labelTypeId.trim()){me.error("Validation failed",{description:"Fill all required fields and select template, location, category, and type."});return}if(y.productIds.length===0){me.error("Validation failed",{description:"Select at least one product."});return}p(!0);try{await Bue(t.id,y),me.success("Label updated.",{description:"The label has been updated successfully."}),r(!1),n()}catch(E){me.error("Failed to update label.",{description:E?.message?String(E.message):"Please try again."})}finally{p(!1)}}},j=b.useMemo(()=>{const E=i.filter(T=>ed(T)).map(T=>({value:ed(T),label:mF(T)})),O=y.templateCode;return O&&!E.some(T=>T.value===O)?[{value:O,label:`${O} (current)`},...E]:E},[i,y.templateCode]),N=b.useMemo(()=>{const E=s.map(T=>({value:T.id,label:pa(T.locationName??T.locationCode??T.id)})),O=y.locationId;return O&&!E.some(T=>T.value===O)?[{value:O,label:`${O} (current)`},...E]:E},[s,y.locationId]),C=b.useMemo(()=>{const E=u.map(T=>({value:T.id,label:pa(T.categoryName??T.categoryCode??T.id)})),O=y.labelCategoryId;return O&&!E.some(T=>T.value===O)?[{value:O,label:`${O} (current)`},...E]:E},[u,y.labelCategoryId]),A=b.useMemo(()=>{const E=d.map(T=>({value:T.id,label:pa(T.typeName??T.typeCode??T.id)})),O=y.labelTypeId;return O&&!E.some(T=>T.value===O)?[{value:O,label:`${O} (current)`},...E]:E},[d,y.labelTypeId]);return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-[600px]",children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Edit Label"}),o.jsx(kt,{children:m?"Loading label details…":"Update the label details."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Label Name *"}),o.jsx(ye,{className:"h-10",placeholder:"e.g. Breakfast label",value:y.labelName,onChange:E=>x(O=>({...O,labelName:E.target.value})),disabled:m})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Label Template *"}),o.jsx(Wn,{value:y.templateCode,onValueChange:E=>x(O=>({...O,templateCode:E})),options:j,placeholder:"Select template",searchPlaceholder:"Search template…",emptyText:"No templates found.",disabled:a||m})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Location *"}),o.jsx(Wn,{value:y.locationId,onValueChange:E=>x(O=>({...O,locationId:E})),options:N,placeholder:"Select location",searchPlaceholder:"Search location…",emptyText:"No locations found.",disabled:a||m})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Label Category *"}),o.jsx(Wn,{value:y.labelCategoryId,onValueChange:E=>x(O=>({...O,labelCategoryId:E})),options:C,placeholder:"Select category",searchPlaceholder:"Search category…",emptyText:"No categories found.",disabled:a||m})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Label Type *"}),o.jsx(Wn,{value:y.labelTypeId,onValueChange:E=>x(O=>({...O,labelTypeId:E})),options:A,placeholder:"Select type",searchPlaceholder:"Search type…",emptyText:"No types found.",disabled:a||m})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Product * (multi-select)"}),o.jsx(vF,{value:y.productIds,onChange:E=>x(O=>({...O,productIds:E})),disabled:a||m,productOptions:c})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Zt,{checked:y.state,onCheckedChange:E=>x(O=>({...O,state:E})),disabled:m})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{disabled:f||a||m,onClick:w,children:f?"Updating…":"Update"})]})]})})}function zde({open:e,label:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>(t?.labelName??"").trim()||t?.labelCode||t?.id||"this label",[t]),u=async()=>{if(t?.id){i(!0);try{await zue(t.id),me.success("Label deleted.",{description:"The label has been removed successfully."}),r(!1),n()}catch(d){me.error("Failed to delete label.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Delete Label"}),o.jsx(kt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(Nt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Et,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}function gI(e){const t=(e??"").trim();return t||"None"}function qde(){const[e,t]=b.useState(!1),[r,n]=b.useState(!1),[a,i]=b.useState(!1),[s,u]=b.useState(null),[d,c]=b.useState(null),[f,p]=b.useState([]),[m,v]=b.useState(!1),[y,x]=b.useState(0),[w,j]=b.useState(0),[N,C]=b.useState(null),[A,E]=b.useState(""),[O,T]=b.useState("all"),[k,M]=b.useState(1),[L,$]=b.useState(10),I=b.useRef(null),H=b.useRef(null),[Y,W]=b.useState("");b.useEffect(()=>(H.current&&window.clearTimeout(H.current),H.current=window.setTimeout(()=>W(A.trim()),300),()=>{H.current&&window.clearTimeout(H.current)}),[A]);const V=Math.max(1,Math.ceil(y/L));b.useEffect(()=>{M(1)},[Y,O,L]),b.useEffect(()=>((async()=>{I.current?.abort();const U=new AbortController;I.current=U,v(!0);try{const z=Ua(k),B=await Q5({skipCount:z,maxResultCount:L,keyword:Y||void 0,state:O==="all"?void 0:O==="true"},U.signal);p(B.items??[]),x(B.totalCount??0)}catch(z){if(z?.name==="AbortError")return;me.error("Failed to load label categories.",{description:z?.message?String(z.message):"Please try again."}),p([]),x(0)}finally{v(!1)}})(),()=>I.current?.abort()),[Y,O,k,L,w]);const K=()=>j(D=>D+1),F=D=>{C(null),u(D),n(!0)},te=D=>{C(null),c(D),i(!0)};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"pb-4",children:o.jsx("div",{className:"flex flex-col gap-4",children:o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ye,{placeholder:"Search",value:A,onChange:D=>E(D.target.value),style:{height:40,boxSizing:"border-box"},className:"bg-white border border-gray-300 rounded-md w-40 shrink-0 placeholder:text-gray-500"}),o.jsxs(Ve,{value:O,onValueChange:T,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"State"})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"all",children:"All States"}),o.jsx(je,{value:"true",children:"Active"}),o.jsx(je,{value:"false",children:"Inactive"})]})]}),o.jsx("div",{className:"flex-1"}),o.jsxs(he,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0",onClick:()=>t(!0),children:["New Label Category ",o.jsx(ln,{className:"ml-1 h-4 w-4"})]})]})})}),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:o.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:o.jsxs(Fr,{children:[o.jsx(Br,{children:o.jsxs(Be,{className:"bg-gray-50 hover:bg-gray-50",children:[o.jsx(xe,{className:"font-bold text-gray-900 w-[250px]",children:"Label Category"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[200px]",children:"Category Code"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[200px]",children:"Category Photo"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[100px]",children:"State"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[100px]",children:"Order"}),o.jsx(xe,{className:"font-bold text-gray-900",children:"Last Edited"}),o.jsx(xe,{className:"font-bold text-gray-900 text-center w-[100px]",children:"Actions"})]})}),o.jsx(zr,{children:m?o.jsx(Be,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):f.length===0?o.jsx(Be,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):f.map(D=>o.jsxs(Be,{className:"hover:bg-gray-50",children:[o.jsx(fe,{className:"font-medium",children:gI(D.categoryName)}),o.jsx(fe,{className:"text-gray-600",children:gI(D.categoryCode)}),o.jsx(fe,{children:D.categoryPhotoUrl?.trim()?o.jsx("img",{src:Zu(D.categoryPhotoUrl),alt:"",className:"w-9 h-9 rounded object-cover border border-gray-200"}):o.jsx("span",{className:"text-gray-400 text-sm",children:"—"})}),o.jsx(fe,{children:o.jsx($r,{className:D.state?"bg-green-600":"bg-gray-400",children:D.state?"Active":"Inactive"})}),o.jsx(fe,{className:"font-numeric",children:D.orderNum??"None"}),o.jsx(fe,{className:"text-gray-500 tabular-nums font-numeric",children:D.creationTime?new Date(D.creationTime).toLocaleString():"None"}),o.jsx(fe,{className:"text-center",children:o.jsxs(ya,{open:N===D.id,onOpenChange:U=>C(U?D.id:null),children:[o.jsx(xa,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:o.jsx(pi,{className:"h-4 w-4 text-gray-500"})})}),o.jsxs(ba,{align:"end",className:"w-40 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>F(D),children:[o.jsx(Cn,{className:"w-4 h-4"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>te(D),children:[o.jsx(Et,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},D.id))})]})})}),o.jsx("div",{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[o.jsxs("div",{children:["Showing ",y===0?0:(k-1)*L+1,"-",Math.min(k*L,y)," of ",y]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String(L),onValueChange:D=>$(Number(D)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(D=>o.jsxs(je,{value:String(D),children:[D," / page"]},D))})]}),o.jsx(bi,{className:"mx-0 w-auto justify-end",children:o.jsxs(wi,{children:[o.jsx(At,{children:o.jsx(Si,{href:"#",size:"default",onClick:D=>{D.preventDefault(),M(U=>Math.max(1,U-1))},"aria-disabled":k<=1,className:k<=1?"pointer-events-none opacity-50":""})}),o.jsx(At,{children:o.jsxs(wa,{href:"#",isActive:!0,size:"default",onClick:D=>D.preventDefault(),children:["Page ",k," / ",V]})}),o.jsx(At,{children:o.jsx(ji,{href:"#",size:"default",onClick:D=>{D.preventDefault(),M(U=>Math.min(V,U+1))},"aria-disabled":k>=V,className:k>=V?"pointer-events-none opacity-50":""})})]})})]})]})}),o.jsx(Ude,{open:e,onOpenChange:t,onCreated:()=>{M(1),K()}}),o.jsx(Vde,{open:r,category:s,onOpenChange:D=>{n(D),D||u(null)},onUpdated:K}),o.jsx(Hde,{open:a,category:d,onOpenChange:D=>{i(D),D||c(null)},onDeleted:K})]})}function Ude({open:e,onOpenChange:t,onCreated:r}){const[n,a]=b.useState(!1),[i,s]=b.useState({categoryCode:"",categoryName:"",categoryPhotoUrl:null,state:!0,orderNum:null}),u=()=>{s({categoryCode:"",categoryName:"",categoryPhotoUrl:null,state:!0,orderNum:null})};b.useEffect(()=>{e||u()},[e]);const d=async()=>{if(!i.categoryCode.trim()||!i.categoryName.trim()){me.error("Validation failed",{description:"Category Code and Category Name are required."});return}if(i.orderNum===null||i.orderNum===void 0||!Number.isFinite(i.orderNum)){me.error("Validation failed",{description:"Order is required."});return}a(!0);try{await Hue(i),me.success("Label category created.",{description:"The label category has been created successfully."}),t(!1),r()}catch(c){me.error("Failed to create label category.",{description:c?.message?String(c.message):"Please try again."})}finally{a(!1)}};return o.jsx(xt,{open:e,onOpenChange:t,children:o.jsxs(gt,{className:"sm:max-w-[600px]",children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Add New Label Category"}),o.jsx(kt,{children:"Enter the details for the new label category."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Category Code *"}),o.jsx(ye,{placeholder:"e.g. CAT_PREP",value:i.categoryCode,onChange:c=>s(f=>({...f,categoryCode:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Category Name *"}),o.jsx(ye,{placeholder:"e.g. Prep",value:i.categoryName,onChange:c=>s(f=>({...f,categoryName:c.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Category photo"}),o.jsx(_d,{value:i.categoryPhotoUrl??"",onChange:c=>s(f=>({...f,categoryPhotoUrl:c||null})),uploadSubDir:"category",oneImageOnly:!0,hint:"JPG, PNG, WebP, or GIF — max 5 MB. Saved as CategoryPhotoUrl."})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Order *"}),o.jsx(ye,{type:"number",placeholder:"e.g. 1",value:i.orderNum??"",onChange:c=>s(f=>({...f,orderNum:c.target.value?Number(c.target.value):null}))})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Zt,{checked:i.state,onCheckedChange:c=>s(f=>({...f,state:c}))})]})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{disabled:n,onClick:d,children:n?"Creating...":"Create"})]})]})})}function Vde({open:e,category:t,onOpenChange:r,onUpdated:n}){const[a,i]=b.useState(!1),[s,u]=b.useState(!1),[d,c]=b.useState({categoryCode:"",categoryName:"",categoryPhotoUrl:null,state:!0,orderNum:null});b.useEffect(()=>{e&&t&&c({categoryCode:t.categoryCode??"",categoryName:t.categoryName??"",categoryPhotoUrl:t.categoryPhotoUrl??null,state:t.state??!0,orderNum:t.orderNum??null})},[e,t]);const f=async()=>{if(t?.id){if(!d.categoryCode.trim()||!d.categoryName.trim()){me.error("Validation failed",{description:"Category Code and Category Name are required."});return}if(d.orderNum===null||d.orderNum===void 0||!Number.isFinite(d.orderNum)){me.error("Validation failed",{description:"Order is required."});return}i(!0);try{await Wue(t.id,d),me.success("Label category updated.",{description:"The label category has been updated successfully."}),r(!1),n()}catch(p){me.error("Failed to update label category.",{description:p?.message?String(p.message):"Please try again."})}finally{i(!1)}}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-[600px]",children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Edit Label Category"}),o.jsx(kt,{children:"Update the label category details."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Category Code *"}),o.jsx(ye,{placeholder:"e.g. CAT_PREP",value:d.categoryCode,onChange:p=>c(m=>({...m,categoryCode:p.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Category Name *"}),o.jsx(ye,{placeholder:"e.g. Prep",value:d.categoryName,onChange:p=>c(m=>({...m,categoryName:p.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Category photo"}),o.jsx(_d,{value:d.categoryPhotoUrl??"",onChange:p=>c(m=>({...m,categoryPhotoUrl:p||null})),uploadSubDir:"category",oneImageOnly:!0,hint:"JPG, PNG, WebP, or GIF — max 5 MB. Saved as CategoryPhotoUrl."})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Order *"}),o.jsx(ye,{type:"number",placeholder:"e.g. 1",value:d.orderNum??"",onChange:p=>c(m=>({...m,orderNum:p.target.value?Number(p.target.value):null}))})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Zt,{checked:d.state,onCheckedChange:p=>c(m=>({...m,state:p}))})]})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{disabled:a,onClick:f,children:a?"Updating...":"Update"})]})]})})}function Hde({open:e,category:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>(t?.categoryName??"").trim()||t?.categoryCode||"this category",[t]),u=async()=>{if(t?.id){i(!0);try{await Gue(t.id),me.success("Label category deleted.",{description:"The label category has been removed successfully."}),r(!1),n()}catch(d){me.error("Failed to delete label category.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Delete Label Category"}),o.jsx(kt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(Nt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Et,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}function vI(e){const t=(e??"").trim();return t||"None"}function Wde(){const[e,t]=b.useState(!1),[r,n]=b.useState(!1),[a,i]=b.useState(!1),[s,u]=b.useState(null),[d,c]=b.useState(null),[f,p]=b.useState([]),[m,v]=b.useState(!1),[y,x]=b.useState(0),[w,j]=b.useState(0),[N,C]=b.useState(null),[A,E]=b.useState(""),[O,T]=b.useState("all"),[k,M]=b.useState(1),[L,$]=b.useState(10),I=b.useRef(null),H=b.useRef(null),[Y,W]=b.useState("");b.useEffect(()=>(H.current&&window.clearTimeout(H.current),H.current=window.setTimeout(()=>W(A.trim()),300),()=>{H.current&&window.clearTimeout(H.current)}),[A]);const V=Math.max(1,Math.ceil(y/L));b.useEffect(()=>{M(1)},[Y,O,L]),b.useEffect(()=>((async()=>{I.current?.abort();const U=new AbortController;I.current=U,v(!0);try{const z=Ua(k),B=await kN({skipCount:z,maxResultCount:L,keyword:Y||void 0,state:O==="all"?void 0:O==="true"},U.signal);p(B.items??[]),x(B.totalCount??0)}catch(z){if(z?.name==="AbortError")return;me.error("Failed to load label types.",{description:z?.message?String(z.message):"Please try again."}),p([]),x(0)}finally{v(!1)}})(),()=>I.current?.abort()),[Y,O,k,L,w]);const K=()=>j(D=>D+1),F=D=>{C(null),u(D),n(!0)},te=D=>{C(null),c(D),i(!0)};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"pb-4",children:o.jsx("div",{className:"flex flex-col gap-4",children:o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ye,{placeholder:"Search",value:A,onChange:D=>E(D.target.value),style:{height:40,boxSizing:"border-box"},className:"bg-white border border-gray-300 rounded-md w-40 shrink-0 placeholder:text-gray-500"}),o.jsxs(Ve,{value:O,onValueChange:T,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"State"})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"all",children:"All States"}),o.jsx(je,{value:"true",children:"Active"}),o.jsx(je,{value:"false",children:"Inactive"})]})]}),o.jsx("div",{className:"flex-1"}),o.jsxs(he,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0",onClick:()=>t(!0),children:["New Label Type ",o.jsx(ln,{className:"ml-1 h-4 w-4"})]})]})})}),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:o.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:o.jsxs(Fr,{children:[o.jsx(Br,{children:o.jsxs(Be,{className:"bg-gray-50 hover:bg-gray-50",children:[o.jsx(xe,{className:"font-bold text-gray-900 w-[250px]",children:"Label Types"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[200px]",children:"Type Code"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[100px]",children:"State"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[100px]",children:"Order"}),o.jsx(xe,{className:"font-bold text-gray-900",children:"Last Edited"}),o.jsx(xe,{className:"font-bold text-gray-900 text-center w-[100px]",children:"Actions"})]})}),o.jsx(zr,{children:m?o.jsx(Be,{children:o.jsx(fe,{colSpan:6,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):f.length===0?o.jsx(Be,{children:o.jsx(fe,{colSpan:6,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):f.map(D=>o.jsxs(Be,{className:"hover:bg-gray-50",children:[o.jsx(fe,{className:"font-medium",children:vI(D.typeName)}),o.jsx(fe,{className:"text-gray-600",children:vI(D.typeCode)}),o.jsx(fe,{children:o.jsx($r,{className:D.state?"bg-green-600":"bg-gray-400",children:D.state?"Active":"Inactive"})}),o.jsx(fe,{className:"font-numeric",children:D.orderNum??"None"}),o.jsx(fe,{className:"text-gray-500 tabular-nums font-numeric",children:D.creationTime?new Date(D.creationTime).toLocaleString():"None"}),o.jsx(fe,{className:"text-center",children:o.jsxs(ya,{open:N===D.id,onOpenChange:U=>C(U?D.id:null),children:[o.jsx(xa,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:o.jsx(pi,{className:"h-4 w-4 text-gray-500"})})}),o.jsxs(ba,{align:"end",className:"w-40 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>F(D),children:[o.jsx(Cn,{className:"w-4 h-4"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>te(D),children:[o.jsx(Et,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},D.id))})]})})}),o.jsx("div",{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[o.jsxs("div",{children:["Showing ",y===0?0:(k-1)*L+1,"-",Math.min(k*L,y)," of ",y]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String(L),onValueChange:D=>$(Number(D)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(D=>o.jsxs(je,{value:String(D),children:[D," / page"]},D))})]}),o.jsx(bi,{className:"mx-0 w-auto justify-end",children:o.jsxs(wi,{children:[o.jsx(At,{children:o.jsx(Si,{href:"#",size:"default",onClick:D=>{D.preventDefault(),M(U=>Math.max(1,U-1))},"aria-disabled":k<=1,className:k<=1?"pointer-events-none opacity-50":""})}),o.jsx(At,{children:o.jsxs(wa,{href:"#",isActive:!0,size:"default",onClick:D=>D.preventDefault(),children:["Page ",k," / ",V]})}),o.jsx(At,{children:o.jsx(ji,{href:"#",size:"default",onClick:D=>{D.preventDefault(),M(U=>Math.min(V,U+1))},"aria-disabled":k>=V,className:k>=V?"pointer-events-none opacity-50":""})})]})})]})]})}),o.jsx(Gde,{open:e,onOpenChange:t,onCreated:()=>{M(1),K()}}),o.jsx(Kde,{open:r,type:s,onOpenChange:D=>{n(D),D||u(null)},onUpdated:K}),o.jsx(Yde,{open:a,type:d,onOpenChange:D=>{i(D),D||c(null)},onDeleted:K})]})}function Gde({open:e,onOpenChange:t,onCreated:r}){const[n,a]=b.useState(!1),[i,s]=b.useState({typeCode:"",typeName:"",state:!0,orderNum:null}),u=()=>{s({typeCode:"",typeName:"",state:!0,orderNum:null})};b.useEffect(()=>{e||u()},[e]);const d=async()=>{if(!i.typeCode.trim()||!i.typeName.trim()){me.error("Validation failed",{description:"Type Code and Type Name are required."});return}if(i.orderNum===null||i.orderNum===void 0||!Number.isFinite(i.orderNum)){me.error("Validation failed",{description:"Order is required."});return}a(!0);try{await Kue(i),me.success("Label type created.",{description:"The label type has been created successfully."}),t(!1),r()}catch(c){me.error("Failed to create label type.",{description:c?.message?String(c.message):"Please try again."})}finally{a(!1)}};return o.jsx(xt,{open:e,onOpenChange:t,children:o.jsxs(gt,{className:"sm:max-w-[600px]",children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Add New Label Type"}),o.jsx(kt,{children:"Enter the details for the new label type."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Type Code *"}),o.jsx(ye,{placeholder:"e.g. TYPE_DEFROST",value:i.typeCode,onChange:c=>s(f=>({...f,typeCode:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Type Name *"}),o.jsx(ye,{placeholder:"e.g. Defrost",value:i.typeName,onChange:c=>s(f=>({...f,typeName:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Order *"}),o.jsx(ye,{type:"number",placeholder:"e.g. 1",value:i.orderNum??"",onChange:c=>s(f=>({...f,orderNum:c.target.value?Number(c.target.value):null}))})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Zt,{checked:i.state,onCheckedChange:c=>s(f=>({...f,state:c}))})]})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{disabled:n,onClick:d,children:n?"Creating...":"Create"})]})]})})}function Kde({open:e,type:t,onOpenChange:r,onUpdated:n}){const[a,i]=b.useState(!1),[s,u]=b.useState({typeCode:"",typeName:"",state:!0,orderNum:null});b.useEffect(()=>{e&&t&&u({typeCode:t.typeCode??"",typeName:t.typeName??"",state:t.state??!0,orderNum:t.orderNum??null})},[e,t]);const d=async()=>{if(t?.id){if(!s.typeCode.trim()||!s.typeName.trim()){me.error("Validation failed",{description:"Type Code and Type Name are required."});return}if(s.orderNum===null||s.orderNum===void 0||!Number.isFinite(s.orderNum)){me.error("Validation failed",{description:"Order is required."});return}i(!0);try{await Yue(t.id,s),me.success("Label type updated.",{description:"The label type has been updated successfully."}),r(!1),n()}catch(c){me.error("Failed to update label type.",{description:c?.message?String(c.message):"Please try again."})}finally{i(!1)}}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-[600px]",children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Edit Label Type"}),o.jsx(kt,{children:"Update the label type details."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Type Code *"}),o.jsx(ye,{placeholder:"e.g. TYPE_DEFROST",value:s.typeCode,onChange:c=>u(f=>({...f,typeCode:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Type Name *"}),o.jsx(ye,{placeholder:"e.g. Defrost",value:s.typeName,onChange:c=>u(f=>({...f,typeName:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Order *"}),o.jsx(ye,{type:"number",placeholder:"e.g. 1",value:s.orderNum??"",onChange:c=>u(f=>({...f,orderNum:c.target.value?Number(c.target.value):null}))})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Zt,{checked:s.state,onCheckedChange:c=>u(f=>({...f,state:c}))})]})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{disabled:a,onClick:d,children:a?"Updating...":"Update"})]})]})})}function Yde({open:e,type:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>(t?.typeName??"").trim()||t?.typeCode||"this type",[t]),u=async()=>{if(t?.id){i(!0);try{await Xue(t.id),me.success("Label type deleted.",{description:"The label type has been removed successfully."}),r(!1),n()}catch(d){me.error("Failed to delete label type.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Delete Label Type"}),o.jsx(kt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(Nt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Et,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}const Xde=[{title:"Template",items:[{label:"Text",type:"TEXT_STATIC"},{label:"QR Code",type:"QRCODE"},{label:"Barcode",type:"BARCODE"},{label:"Blank Space",type:"BLANK"},{label:"Price",type:"TEXT_PRICE"},{label:"Image",type:"IMAGE"},{label:"Logo",type:"IMAGE"}]},{title:"Label",items:[{label:"Label Name",type:"TEXT_PRODUCT"},{label:"Text",type:"TEXT_STATIC"},{label:"QR Code",type:"QRCODE"},{label:"Barcode",type:"BARCODE"},{label:"Nutrition Facts",type:"NUTRITION"},{label:"Price",type:"TEXT_PRICE"},{label:"Duration Date",type:"DATE"},{label:"Duration Time",type:"TIME"},{label:"Duration",type:"DURATION"},{label:"Image",type:"IMAGE"},{label:"Label Type",type:"TEXT_STATIC"},{label:"How-to",type:"TEXT_STATIC"},{label:"Expiration Alert",type:"TEXT_STATIC"}]},{title:"Auto-generated",items:[{label:"Company",type:"TEXT_STATIC"},{label:"Employee",type:"TEXT_STATIC"},{label:"Current Date",type:"DATE"},{label:"Current Time",type:"TIME"},{label:"Label ID",type:"TEXT_STATIC"}]},{title:"Print input",subtitle:"Click to add to canvas",items:[{label:"Text",type:"TEXT_STATIC",config:{inputType:"text"}},{label:"Weight",type:"WEIGHT"},{label:"Number",type:"TEXT_STATIC",config:{inputType:"number",text:"0"}},{label:"Date & Time",type:"DATE",config:{inputType:"datetime",format:"YYYY-MM-DD HH:mm"}},{label:"Multiple Options",type:"TEXT_STATIC",config:{inputType:"options",multipleOptionId:"",selectedOptionValues:[],text:"Text",fontFamily:"Arial",fontSize:14,fontWeight:"normal",textAlign:"left"}}]}];function Jde({onAddElement:e}){return o.jsxs("div",{className:"w-44 shrink-0 border-r border-gray-200 bg-white flex flex-col h-full",children:[o.jsx("div",{className:"px-2 py-2 border-b border-gray-200 font-semibold text-gray-800 text-sm",children:"Elements"}),o.jsx(fl,{className:"flex-1",children:o.jsx("div",{className:"p-1.5 space-y-3",children:Xde.map(t=>o.jsxs("div",{children:[o.jsx("div",{className:"px-2 py-1 text-xs font-medium text-gray-500 uppercase tracking-wide",children:t.title}),t.subtitle&&o.jsx("div",{className:"px-2 py-0.5 text-[10px] text-gray-400",children:t.subtitle}),o.jsx("div",{className:"grid grid-cols-2 gap-1 mt-0.5",children:t.items.map((r,n)=>o.jsx("button",{type:"button",onClick:()=>e(r.type,r.config,t.title,r.label),className:"text-left px-2 py-1 text-xs rounded hover:bg-gray-100 border border-transparent hover:border-gray-200 truncate",children:r.label},`${t.title}-${r.label}-${n}`))})]},t.title))})})]})}var ph={},Jc={},mh={},yI;function Tn(){if(yI)return mh;yI=1,Object.defineProperty(mh,"__esModule",{value:!0});function e(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}var t=function r(n,a){e(this,r),this.data=n,this.text=a.text||n,this.options=a};return mh.default=t,mh}var xI;function Qde(){if(xI)return Jc;xI=1,Object.defineProperty(Jc,"__esModule",{value:!0}),Jc.CODE39=void 0;var e=(function(){function x(w,j){for(var N=0;N=200){w=m.shift()-105;var j=n.SWAP[w];j!==void 0?x=f.next(m,v+1,j):((y===n.SET_A||y===n.SET_B)&&w===n.SHIFT&&(m[0]=y===n.SET_A?m[0]>95?m[0]-96:m[0]:m[0]<32?m[0]+96:m[0]),x=f.next(m,v+1,y))}else w=f.correctIndex(m,y),x=f.next(m,v+1,y);var N=f.getBar(w),C=w*v;return{result:N+x.result,checksum:C+x.checksum}}}]),f})(r.default);return vh.default=d,vh}var yh={},SI;function Zde(){if(SI)return yh;SI=1,Object.defineProperty(yh,"__esModule",{value:!0});var e=Cd(),t=function(u){return u.match(new RegExp("^"+e.A_CHARS+"*"))[0].length},r=function(u){return u.match(new RegExp("^"+e.B_CHARS+"*"))[0].length},n=function(u){return u.match(new RegExp("^"+e.C_CHARS+"*"))[0]};function a(s,u){var d=u?e.A_CHARS:e.B_CHARS,c=s.match(new RegExp("^("+d+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(c)return c[1]+"Ì"+i(s.substring(c[1].length));var f=s.match(new RegExp("^"+d+"+"))[0];return f.length===s.length?s:f+String.fromCharCode(u?205:206)+a(s.substring(f.length),!u)}function i(s){var u=n(s),d=u.length;if(d===s.length)return s;s=s.substring(d);var c=t(s)>=r(s);return u+String.fromCharCode(c?206:205)+a(s,c)}return yh.default=function(s){var u=void 0,d=n(s).length;if(d>=2)u=e.C_START_CHAR+i(s);else{var c=t(s)>r(s);u=(c?e.A_START_CHAR:e.B_START_CHAR)+a(s,c)}return u.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(f,p){return"Ë"+p})},yh}var jI;function efe(){if(jI)return gh;jI=1,Object.defineProperty(gh,"__esModule",{value:!0});var e=kg(),t=a(e),r=Zde(),n=a(r);function a(c){return c&&c.__esModule?c:{default:c}}function i(c,f){if(!(c instanceof f))throw new TypeError("Cannot call a class as a function")}function s(c,f){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:c}function u(c,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);c.prototype=Object.create(f&&f.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(c,f):c.__proto__=f)}var d=(function(c){u(f,c);function f(p,m){if(i(this,f),/^[\x00-\x7F\xC8-\xD3]+$/.test(p))var v=s(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,(0,n.default)(p),m));else var v=s(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,p,m));return s(v)}return f})(t.default);return gh.default=d,gh}var xh={},NI;function tfe(){if(NI)return xh;NI=1,Object.defineProperty(xh,"__esModule",{value:!0});var e=(function(){function c(f,p){for(var m=0;my.width*10?y.width*10:y.fontSize,x.guardHeight=y.height+x.fontSize/2+y.textMargin,x}return e(m,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(y,x){return this.text.substr(y,x)}},{key:"leftEncode",value:function(y,x){return(0,n.default)(y,x)}},{key:"rightText",value:function(y,x){return this.text.substr(y,x)}},{key:"rightEncode",value:function(y,x){return(0,n.default)(y,x)}},{key:"encodeGuarded",value:function(){var y={fontSize:this.fontSize},x={height:this.guardHeight};return[{data:t.SIDE_BIN,options:x},{data:this.leftEncode(),text:this.leftText(),options:y},{data:t.MIDDLE_BIN,options:x},{data:this.rightEncode(),text:this.rightText(),options:y},{data:t.SIDE_BIN,options:x}]}},{key:"encodeFlat",value:function(){var y=[t.SIDE_BIN,this.leftEncode(),t.MIDDLE_BIN,this.rightEncode(),t.SIDE_BIN];return{data:y.join(""),text:this.text}}}]),m})(i.default);return jh.default=f,jh}var TI;function ife(){if(TI)return Sh;TI=1,Object.defineProperty(Sh,"__esModule",{value:!0});var e=(function(){function p(m,v){for(var y=0;yy.width*10?x.fontSize=y.width*10:x.fontSize=y.fontSize,x.guardHeight=y.height+x.fontSize/2+y.textMargin,x}return e(m,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==f(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var y="";return y+="101",y+=(0,r.default)(this.data.substr(0,6),"LLLLLL"),y+="01010",y+=(0,r.default)(this.data.substr(6,6),"RRRRRR"),y+="101",{data:y,text:this.text}}},{key:"guardedEncoding",value:function(){var y=[];return this.displayValue&&y.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),y.push({data:"101"+(0,r.default)(this.data[0],"L"),options:{height:this.guardHeight}}),y.push({data:(0,r.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),y.push({data:"01010",options:{height:this.guardHeight}}),y.push({data:(0,r.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),y.push({data:(0,r.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&y.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),y}}]),m})(a.default);function f(p){var m=0,v;for(v=1;v<11;v+=2)m+=parseInt(p[v]);for(v=0;v<11;v+=2)m+=parseInt(p[v])*3;return(10-m%10)%10}return Qc.default=c,Qc}var Oh={},DI;function cfe(){if(DI)return Oh;DI=1,Object.defineProperty(Oh,"__esModule",{value:!0});var e=(function(){function y(x,w){for(var j=0;jj.width*10?N.fontSize=j.width*10:N.fontSize=j.fontSize,N.guardHeight=j.height+N.fontSize/2+j.textMargin,N}return e(x,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var j="";return j+="101",j+=this.encodeMiddleDigits(),j+="010101",{data:j,text:this.text}}},{key:"guardedEncoding",value:function(){var j=[];return this.displayValue&&j.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),j.push({data:"101",options:{height:this.guardHeight}}),j.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),j.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&j.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),j}},{key:"encodeMiddleDigits",value:function(){var j=this.upcA[0],N=this.upcA[this.upcA.length-1],C=p[parseInt(N)][parseInt(j)];return(0,r.default)(this.middleDigits,C)}}]),x})(a.default);function v(y,x){for(var w=parseInt(y[y.length-1]),j=f[w],N="",C=0,A=0;A=3&&this.number<=131070}}]),c})(r.default);return eu.pharmacode=u,eu}var tu={},XI;function bfe(){if(XI)return tu;XI=1,Object.defineProperty(tu,"__esModule",{value:!0}),tu.codabar=void 0;var e=(function(){function d(c,f){for(var p=0;p":["(%)","I"],"?":["(%)","J"],"@":["(%)","V"],"[":["(%)","K"],"\\":["(%)","L"],"]":["(%)","M"],"^":["(%)","N"],_:["(%)","O"],"`":["(%)","W"],a:["(+)","A"],b:["(+)","B"],c:["(+)","C"],d:["(+)","D"],e:["(+)","E"],f:["(+)","F"],g:["(+)","G"],h:["(+)","H"],i:["(+)","I"],j:["(+)","J"],k:["(+)","K"],l:["(+)","L"],m:["(+)","M"],n:["(+)","N"],o:["(+)","O"],p:["(+)","P"],q:["(+)","Q"],r:["(+)","R"],s:["(+)","S"],t:["(+)","T"],u:["(+)","U"],v:["(+)","V"],w:["(+)","W"],x:["(+)","X"],y:["(+)","Y"],z:["(+)","Z"],"{":["(%)","P"],"|":["(%)","Q"],"}":["(%)","R"],"~":["(%)","S"],"":["(%)","T"]}),Vs}var QI;function wF(){if(QI)return Dh;QI=1,Object.defineProperty(Dh,"__esModule",{value:!0});var e=(function(){function c(f,p){for(var m=0;m0?f.fontSize+f.textMargin:0)+f.marginTop+f.marginBottom}function a(c,f,p){if(p.displayValue&&ff&&(f=c[p].height);return f}function d(c,f,p){var m;if(p)m=p;else if(typeof document<"u")m=document.createElement("canvas").getContext("2d");else return 0;m.font=f.fontOptions+" "+f.fontSize+"px "+f.font;var v=m.measureText(c);if(!v)return 0;var y=v.width;return y}return vn.getMaximumHeightOfEncodings=u,vn.getEncodingHeight=n,vn.getBarcodePadding=a,vn.calculateEncodingAttributes=i,vn.getTotalWidthOfEncodings=s,vn}var uM;function Pfe(){if(uM)return Wh;uM=1,Object.defineProperty(Wh,"__esModule",{value:!0});var e=(function(){function u(d,c){for(var f=0;f0?(v=0,p.textAlign="left"):c.textAlign=="right"?(v=f.width-1,p.textAlign="right"):(v=f.width/2,p.textAlign="center"),p.fillText(f.text,v,y)}}},{key:"moveCanvasDrawing",value:function(c){var f=this.canvas.getContext("2d");f.translate(c.width,0)}},{key:"restoreCanvas",value:function(){var c=this.canvas.getContext("2d");c.restore()}}]),u})();return Wh.default=s,Wh}var Gh={},dM;function Afe(){if(dM)return Gh;dM=1,Object.defineProperty(Gh,"__esModule",{value:!0});var e=(function(){function d(c,f){for(var p=0;p0&&(this.drawRect(w-p.width*x,y,p.width*x,p.height,f),x=0);x>0&&this.drawRect(w-p.width*(x-1),y,p.width*x,p.height,f)}},{key:"drawSVGText",value:function(f,p,m){var v=this.document.createElementNS(s,"text");if(p.displayValue){var y,x;v.setAttribute("font-family",p.font),v.setAttribute("font-size",p.fontSize),p.fontOptions.includes("bold")&&v.setAttribute("font-weight","bold"),p.fontOptions.includes("italic")&&v.setAttribute("font-style","italic"),p.textPosition=="top"?x=p.fontSize-p.textMargin:x=p.height+p.textMargin+p.fontSize,p.textAlign=="left"||m.barcodePadding>0?(y=0,v.setAttribute("text-anchor","start")):p.textAlign=="right"?(y=m.width-1,v.setAttribute("text-anchor","end")):(y=m.width/2,v.setAttribute("text-anchor","middle")),v.setAttribute("x",y),v.setAttribute("y",x),v.appendChild(this.document.createTextNode(m.text)),f.appendChild(v)}}},{key:"setSvgAttributes",value:function(f,p){var m=this.svg;m.setAttribute("width",f+"px"),m.setAttribute("height",p+"px"),m.setAttribute("x","0px"),m.setAttribute("y","0px"),m.setAttribute("viewBox","0 0 "+f+" "+p),m.setAttribute("xmlns",s),m.setAttribute("version","1.1")}},{key:"createGroup",value:function(f,p,m){var v=this.document.createElementNS(s,"g");return v.setAttribute("transform","translate("+f+", "+p+")"),m.appendChild(v),v}},{key:"setGroupOptions",value:function(f,p){f.setAttribute("fill",p.lineColor)}},{key:"drawRect",value:function(f,p,m,v,y){var x=this.document.createElementNS(s,"rect");return x.setAttribute("x",f),x.setAttribute("y",p),x.setAttribute("width",m),x.setAttribute("height",v),y.appendChild(x),x}}]),d})();return Gh.default=u,Gh}var Kh={},fM;function Tfe(){if(fM)return Kh;fM=1,Object.defineProperty(Kh,"__esModule",{value:!0});var e=(function(){function n(a,i){for(var s=0;s"u"?"undefined":e(f))==="object"&&!f.nodeName)return{element:f,renderer:a.default.ObjectRenderer};throw new i.InvalidElementException}}function d(f){var p=document.querySelectorAll(f);if(p.length!==0){for(var m=[],v=0;v"u")throw Error("No element to render on was provided.");return H._renderProperties=(0,c.default)(L),H._encodings=[],H._options=w.default,H._errorHandler=new v.default(H),typeof $<"u"&&(I=I||{},I.format||(I.format=T()),H.options(I)[I.format]($,I).render()),H};C.getModule=function(M){return t.default[M]};for(var A in t.default)t.default.hasOwnProperty(A)&&E(t.default,A);function E(M,L){N.prototype[L]=N.prototype[L.toUpperCase()]=N.prototype[L.toLowerCase()]=function($,I){var H=this;return H._errorHandler.wrapBarcodeCall(function(){I.text=typeof I.text>"u"?void 0:""+I.text;var Y=(0,n.default)(H._options,I);Y=(0,p.default)(Y);var W=M[L],V=O($,W,Y);return H._encodings.push(V),H})}}function O(M,L,$){M=""+M;var I=new L(M,$);if(!I.valid())throw new y.InvalidInputException(I.constructor.name,M);var H=I.encode();H=(0,i.default)(H);for(var Y=0;Yt in e?$fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,HS=(e,t)=>{for(var r in t||(t={}))CF.call(t,r)&&yM(e,r,t[r]);if(wm)for(var r of wm(t))EF.call(t,r)&&yM(e,r,t[r]);return e},WS=(e,t)=>{var r={};for(var n in e)CF.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&wm)for(var n of wm(e))t.indexOf(n)<0&&EF.call(e,n)&&(r[n]=e[n]);return r};/** + * @license QR Code generator library (TypeScript) + * Copyright (c) Project Nayuki. + * SPDX-License-Identifier: MIT + */var is;(e=>{const t=class st{constructor(d,c,f,p){if(this.version=d,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],dst.MAX_VERSION)throw new RangeError("Version value out of range");if(p<-1||p>7)throw new RangeError("Mask value out of range");this.size=d*4+17;let m=[];for(let y=0;y7)throw new RangeError("Invalid value");let y,x;for(y=f;;y++){const C=st.getNumDataCodewords(y,c)*8,A=s.getTotalBits(d,y);if(A<=C){x=A;break}if(y>=p)throw new RangeError("Data too long")}for(const C of[st.Ecc.MEDIUM,st.Ecc.QUARTILE,st.Ecc.HIGH])v&&x<=st.getNumDataCodewords(y,C)*8&&(c=C);let w=[];for(const C of d){r(C.mode.modeBits,4,w),r(C.numChars,C.mode.numCharCountBits(y),w);for(const A of C.getData())w.push(A)}a(w.length==x);const j=st.getNumDataCodewords(y,c)*8;a(w.length<=j),r(0,Math.min(4,j-w.length),w),r(0,(8-w.length%8)%8,w),a(w.length%8==0);for(let C=236;w.lengthN[A>>>3]|=C<<7-(A&7)),new st(y,c,N,m)}getModule(d,c){return 0<=d&&d>>9)*1335;const p=(c<<10|f)^21522;a(p>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,n(p,m));this.setFunctionModule(8,7,n(p,6)),this.setFunctionModule(8,8,n(p,7)),this.setFunctionModule(7,8,n(p,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,n(p,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,n(p,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,n(p,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let d=this.version;for(let f=0;f<12;f++)d=d<<1^(d>>>11)*7973;const c=this.version<<12|d;a(c>>>18==0);for(let f=0;f<18;f++){const p=n(c,f),m=this.size-11+f%3,v=Math.floor(f/3);this.setFunctionModule(m,v,p),this.setFunctionModule(v,m,p)}}drawFinderPattern(d,c){for(let f=-4;f<=4;f++)for(let p=-4;p<=4;p++){const m=Math.max(Math.abs(p),Math.abs(f)),v=d+p,y=c+f;0<=v&&v{(C!=x-m||E>=y)&&N.push(A[C])});return a(N.length==v),N}drawCodewords(d){if(d.length!=Math.floor(st.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let f=this.size-1;f>=1;f-=2){f==6&&(f=5);for(let p=0;p>>3],7-(c&7)),c++)}}a(c==d.length*8)}applyMask(d){if(d<0||d>7)throw new RangeError("Mask value out of range");for(let c=0;c5&&d++):(this.finderPenaltyAddHistory(y,x),v||(d+=this.finderPenaltyCountPatterns(x)*st.PENALTY_N3),v=this.modules[m][w],y=1);d+=this.finderPenaltyTerminateAndCount(v,y,x)*st.PENALTY_N3}for(let m=0;m5&&d++):(this.finderPenaltyAddHistory(y,x),v||(d+=this.finderPenaltyCountPatterns(x)*st.PENALTY_N3),v=this.modules[w][m],y=1);d+=this.finderPenaltyTerminateAndCount(v,y,x)*st.PENALTY_N3}for(let m=0;mv+(y?1:0),c);const f=this.size*this.size,p=Math.ceil(Math.abs(c*20-f*10)/f)-1;return a(0<=p&&p<=9),d+=p*st.PENALTY_N4,a(0<=d&&d<=2568888),d}getAlignmentPatternPositions(){if(this.version==1)return[];{const d=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(d*2-2))*2;let f=[6];for(let p=this.size-7;f.lengthst.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*d+128)*d+64;if(d>=2){const f=Math.floor(d/7)+2;c-=(25*f-10)*f-55,d>=7&&(c-=36)}return a(208<=c&&c<=29648),c}static getNumDataCodewords(d,c){return Math.floor(st.getNumRawDataModules(d)/8)-st.ECC_CODEWORDS_PER_BLOCK[c.ordinal][d]*st.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][d]}static reedSolomonComputeDivisor(d){if(d<1||d>255)throw new RangeError("Degree out of range");let c=[];for(let p=0;p0);for(const p of d){const m=p^f.shift();f.push(0),c.forEach((v,y)=>f[y]^=st.reedSolomonMultiply(v,m))}return f}static reedSolomonMultiply(d,c){if(d>>>8||c>>>8)throw new RangeError("Byte out of range");let f=0;for(let p=7;p>=0;p--)f=f<<1^(f>>>7)*285,f^=(c>>>p&1)*d;return a(f>>>8==0),f}finderPenaltyCountPatterns(d){const c=d[1];a(c<=this.size*3);const f=c>0&&d[2]==c&&d[3]==c*3&&d[4]==c&&d[5]==c;return(f&&d[0]>=c*4&&d[6]>=c?1:0)+(f&&d[6]>=c*4&&d[0]>=c?1:0)}finderPenaltyTerminateAndCount(d,c,f){return d&&(this.finderPenaltyAddHistory(c,f),c=0),c+=this.size,this.finderPenaltyAddHistory(c,f),this.finderPenaltyCountPatterns(f)}finderPenaltyAddHistory(d,c){c[0]==0&&(d+=this.size),c.pop(),c.unshift(d)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function r(u,d,c){if(d<0||d>31||u>>>d)throw new RangeError("Value out of range");for(let f=d-1;f>=0;f--)c.push(u>>>f&1)}function n(u,d){return(u>>>d&1)!=0}function a(u){if(!u)throw new Error("Assertion error")}const i=class Jt{constructor(d,c,f){if(this.mode=d,this.numChars=c,this.bitData=f,c<0)throw new RangeError("Invalid argument");this.bitData=f.slice()}static makeBytes(d){let c=[];for(const f of d)r(f,8,c);return new Jt(Jt.Mode.BYTE,d.length,c)}static makeNumeric(d){if(!Jt.isNumeric(d))throw new RangeError("String contains non-numeric characters");let c=[];for(let f=0;f=1<{(t=>{const r=class{constructor(a,i){this.ordinal=a,this.formatBits=i}};r.LOW=new r(0,1),r.MEDIUM=new r(1,0),r.QUARTILE=new r(2,3),r.HIGH=new r(3,2),t.Ecc=r})(e.QrCode||(e.QrCode={}))})(is||(is={}));(e=>{(t=>{const r=class{constructor(a,i){this.modeBits=a,this.numBitsCharCount=i}numCharCountBits(a){return this.numBitsCharCount[Math.floor((a+7)/17)]}};r.NUMERIC=new r(1,[10,12,14]),r.ALPHANUMERIC=new r(2,[9,11,13]),r.BYTE=new r(4,[8,16,16]),r.KANJI=new r(8,[8,10,12]),r.ECI=new r(7,[0,0,0]),t.Mode=r})(e.QrSegment||(e.QrSegment={}))})(is||(is={}));var tl=is;/** + * @license qrcode.react + * Copyright (c) Paul O'Shannessy + * SPDX-License-Identifier: ISC + */var Ffe={L:tl.QrCode.Ecc.LOW,M:tl.QrCode.Ecc.MEDIUM,Q:tl.QrCode.Ecc.QUARTILE,H:tl.QrCode.Ecc.HIGH},OF=128,PF="L",AF="#FFFFFF",TF="#000000",kF=!1,RF=1,Bfe=4,zfe=0,qfe=.1;function IF(e,t=0){const r=[];return e.forEach(function(n,a){let i=null;n.forEach(function(s,u){if(!s&&i!==null){r.push(`M${i+t} ${a+t}h${u-i}v1H${i+t}z`),i=null;return}if(u===n.length-1){if(!s)return;i===null?r.push(`M${u+t},${a+t} h1v1H${u+t}z`):r.push(`M${i+t},${a+t} h${u+1-i}v1H${i+t}z`);return}s&&i===null&&(i=u)})}),r.join("")}function MF(e,t){return e.slice().map((r,n)=>n=t.y+t.h?r:r.map((a,i)=>i=t.x+t.w?a:!1))}function Ufe(e,t,r,n){if(n==null)return null;const a=e.length+r*2,i=Math.floor(t*qfe),s=a/t,u=(n.width||i)*s,d=(n.height||i)*s,c=n.x==null?e.length/2-u/2:n.x*s,f=n.y==null?e.length/2-d/2:n.y*s,p=n.opacity==null?1:n.opacity;let m=null;if(n.excavate){let y=Math.floor(c),x=Math.floor(f),w=Math.ceil(u+c-y),j=Math.ceil(d+f-x);m={x:y,y:x,w,h:j}}const v=n.crossOrigin;return{x:c,y:f,h:d,w:u,excavation:m,opacity:p,crossOrigin:v}}function Vfe(e,t){return t!=null?Math.max(Math.floor(t),0):e?Bfe:zfe}function DF({value:e,level:t,minVersion:r,includeMargin:n,marginSize:a,imageSettings:i,size:s,boostLevel:u}){let d=q.useMemo(()=>{const y=(Array.isArray(e)?e:[e]).reduce((x,w)=>(x.push(...tl.QrSegment.makeSegments(w)),x),[]);return tl.QrCode.encodeSegments(y,Ffe[t],r,void 0,void 0,u)},[e,t,r,u]);const{cells:c,margin:f,numCells:p,calculatedImageSettings:m}=q.useMemo(()=>{let v=d.getModules();const y=Vfe(n,a),x=v.length+y*2,w=Ufe(v,s,y,i);return{cells:v,margin:y,numCells:x,calculatedImageSettings:w}},[d,s,i,n,a]);return{qrcode:d,margin:f,cells:c,numCells:p,calculatedImageSettings:m}}var Hfe=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Wfe=q.forwardRef(function(t,r){const n=t,{value:a,size:i=OF,level:s=PF,bgColor:u=AF,fgColor:d=TF,includeMargin:c=kF,minVersion:f=RF,boostLevel:p,marginSize:m,imageSettings:v}=n,x=WS(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:w}=x,j=WS(x,["style"]),N=v?.src,C=q.useRef(null),A=q.useRef(null),E=q.useCallback(Y=>{C.current=Y,typeof r=="function"?r(Y):r&&(r.current=Y)},[r]),[O,T]=q.useState(!1),{margin:k,cells:M,numCells:L,calculatedImageSettings:$}=DF({value:a,level:s,minVersion:f,boostLevel:p,includeMargin:c,marginSize:m,imageSettings:v,size:i});q.useEffect(()=>{if(C.current!=null){const Y=C.current,W=Y.getContext("2d");if(!W)return;let V=M;const K=A.current,F=$!=null&&K!==null&&K.complete&&K.naturalHeight!==0&&K.naturalWidth!==0;F&&$.excavation!=null&&(V=MF(M,$.excavation));const te=window.devicePixelRatio||1;Y.height=Y.width=i*te;const D=i/L*te;W.scale(D,D),W.fillStyle=u,W.fillRect(0,0,L,L),W.fillStyle=d,Hfe?W.fill(new Path2D(IF(V,k))):M.forEach(function(U,z){U.forEach(function(B,X){B&&W.fillRect(X+k,z+k,1,1)})}),$&&(W.globalAlpha=$.opacity),F&&W.drawImage(K,$.x+k,$.y+k,$.w,$.h)}}),q.useEffect(()=>{T(!1)},[N]);const I=HS({height:i,width:i},w);let H=null;return N!=null&&(H=q.createElement("img",{src:N,key:N,style:{display:"none"},onLoad:()=>{T(!0)},ref:A,crossOrigin:$?.crossOrigin})),q.createElement(q.Fragment,null,q.createElement("canvas",HS({style:I,height:i,width:i,ref:E,role:"img"},j)),H)});Wfe.displayName="QRCodeCanvas";var LF=q.forwardRef(function(t,r){const n=t,{value:a,size:i=OF,level:s=PF,bgColor:u=AF,fgColor:d=TF,includeMargin:c=kF,minVersion:f=RF,boostLevel:p,title:m,marginSize:v,imageSettings:y}=n,x=WS(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:w,cells:j,numCells:N,calculatedImageSettings:C}=DF({value:a,level:s,minVersion:f,boostLevel:p,includeMargin:c,marginSize:v,imageSettings:y,size:i});let A=j,E=null;y!=null&&C!=null&&(C.excavation!=null&&(A=MF(j,C.excavation)),E=q.createElement("image",{href:y.src,height:C.h,width:C.w,x:C.x+w,y:C.y+w,preserveAspectRatio:"none",opacity:C.opacity,crossOrigin:C.crossOrigin}));const O=IF(A,w);return q.createElement("svg",HS({height:i,width:i,viewBox:`0 0 ${N} ${N}`,ref:r,role:"img"},x),!!m&&q.createElement("title",null,m),q.createElement("path",{fill:u,d:`M0,0 h${N}v${N}H0z`,shapeRendering:"crispEdges"}),q.createElement("path",{fill:d,d:O,shapeRendering:"crispEdges"}),E)});LF.displayName="QRCodeSVG";function Gfe({data:e,width:t,height:r,showText:n,orientation:a="horizontal"}){const i=b.useRef(null),s=a==="vertical",u=Math.max(20,(s?t:r)-(n?14:4));b.useEffect(()=>{if(i.current&&e)try{Lfe(i.current,e,{format:"CODE128",width:1,height:u,displayValue:n!==!1,margin:2,fontOptions:"",fontSize:10})}catch{}},[e,u,n]);const d=o.jsx("svg",{ref:i,className:"w-full h-full min-h-0",style:{maxHeight:s?t:r}});return s?o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("div",{style:{transform:"rotate(-90deg)",transformOrigin:"center center",width:r,height:t,display:"flex",alignItems:"center",justifyContent:"center"},children:d})}):d}const pu=8;function Ws(e){return Math.round(e/pu)*pu}function Ra(e,t){return t==="cm"?e*37.8:e*96}function Xh(e,t){return t==="cm"?e/37.8:e/96}function xM(e,t,r){const n=String(e.prefix??"").trim(),a=String(e.multipleOptionName??e.MultipleOptionName??"").trim(),i=r.filter(Boolean).join(", "),s=t||"…";return n?i?`${n}${i}`:`${n}${s}`:a?`${a}: ${i||s}`:i||s}function Kfe(e){const t=e.extraNutrients;return Array.isArray(t)?t.map((r,n)=>{const a=r;return{id:String(a.id??`extra-${n}`),name:String(a.name??""),value:String(a.value??""),unit:String(a.unit??"")}}):[]}function Z1(e,t,r){const n=r==="value"?t:`${t}Unit`,a=e[n];if(a!=null&&String(a).trim()!=="")return String(a).trim();const s=(Array.isArray(e.fixedNutrients)?e.fixedNutrients:[]).find(u=>String(u.key??"").trim()===t);return String(s?.[r]??"").trim()}function Yfe(e,t){const r=String(t.getFullYear()),n=r.slice(-2),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),u=String(t.getMinutes()).padStart(2,"0"),d=t.toLocaleString("en-US",{month:"long"}).toUpperCase(),c=t.toLocaleString("en-US",{weekday:"long"}).toUpperCase(),f=t.toLocaleString("en-US",{weekday:"short"}).toUpperCase();switch(t.toLocaleString("en-US",{month:"short"}).toUpperCase(),e){case"DD/MM/YYYY":return`${i}/${a}/${r}`;case"MM/DD/YYYY":return`${a}/${i}/${r}`;case"DD/MM/YY":return`${i}/${a}/${n}`;case"MM/DD/YY":return`${a}/${i}/${n}`;case"MM/YY":return`${a}/${n}`;case"MM/DD":return`${a}/${i}`;case"MM":return a;case"DD":return i;case"YY":return n;case"FULLY DAY(WEDNESDAY)":return c;case"DAY (WED)":return f;case"MONTH (DECEMBER)":return d;case"YEAR (2025)":return r;case"DD MONTH YEAR (25 DECEMBER 2025)":return`${i} ${d} ${r}`;default:return e.replace("YYYY",r).replace("YY",n).replace("MM",a).replace("DD",i).replace("HH",s).replace("mm",u)}}const Xfe=new Set(["Minutes","Hours","Days","Weeks","Months (30 Day)","Years"]);function Jfe(e){const t=String(e??"").trim().toLowerCase();return t==="milligrams"?"mg":t==="grams"?"g":t==="ounces"?"oz":t==="pounds"?"lb":t==="kilograms"?"kg":t==="lb"||t==="kg"||t==="mg"||t==="g"||t==="oz"?t:"g"}function $F({el:e,isAppPrintField:t}){const r=e.config,n=Jn(e.type),a=e.rotation==="vertical",i={fontSize:r?.fontSize??14,fontFamily:r?.fontFamily??"Arial",fontWeight:r?.fontWeight??"normal",textAlign:r?.textAlign??"left",color:r?.color??"#000"},u=a&&(n==="TEXT_STATIC"||n==="TEXT_PRODUCT"||n==="TEXT_PRICE")?{writingMode:"vertical-rl",textOrientation:"mixed"}:{},d=a?{transform:"rotate(-90deg)",transformOrigin:"center center"}:{},c=r?.inputType;if(n==="TEXT_STATIC"){const f=r?.text??"Text";if(t){if(c==="options"){const m=Array.isArray(r?.selectedOptionValues)?r.selectedOptionValues:[],v=xM(r,f,m);return o.jsx("div",{className:"w-full h-full px-1 flex flex-col justify-center overflow-hidden pointer-events-none text-gray-600 italic text-[11px] leading-tight break-all",style:{...i,...u},title:"Filled in mobile app when printing",children:v})}const p=c==="number"?r?.text??"0":f;return o.jsx("div",{className:"w-full h-full px-1 flex items-center overflow-hidden pointer-events-none text-gray-600 italic text-[11px]",style:{...i,...u},title:"Filled in mobile app when printing",children:p})}if(c==="number")return o.jsx("input",{type:"number",readOnly:!0,value:r?.text??"0",className:"w-full h-full min-w-0 border border-gray-300 bg-white rounded px-1 pointer-events-none",style:{...i,...u,textAlign:"right"}});if(c==="options"){const p=Array.isArray(r?.selectedOptionValues)?r.selectedOptionValues:[],m=xM(r,f,p),v=p.length===0;return o.jsx("div",{className:Ee("w-full h-full px-1 overflow-hidden whitespace-pre-wrap break-all leading-tight",v&&"text-gray-400"),style:{...i,...u},title:m,children:m})}return c==="text"?o.jsx("input",{type:"text",readOnly:!0,value:f,className:"w-full h-full min-w-0 border border-gray-300 bg-white rounded px-1 pointer-events-none",style:{...i,...u}}):o.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-pre-wrap break-all leading-tight",style:{...i,...u},children:f})}if(n==="TEXT_PRODUCT"){const f=r?.text??"Product name";return o.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-pre-wrap break-all leading-tight",style:{...i,...u},children:f})}if(n==="TEXT_PRICE"){const f=r?.text??"0.00";return o.jsx("div",{className:"w-full h-full px-1 overflow-hidden flex items-center",style:{...i,...u,justifyContent:i.textAlign==="center"?"center":i.textAlign==="right"?"flex-end":"flex-start"},children:o.jsx("span",{children:f})})}if(n==="BARCODE"){const f=r?.data??"123456789",p=r?.showText!==!1,m=r?.orientation==="vertical"?"vertical":"horizontal";return o.jsx("div",{className:"flex flex-col items-center justify-center w-full h-full overflow-hidden p-0.5",children:o.jsx("div",{className:"flex-1 w-full min-h-0 flex items-center justify-center",children:o.jsx(Gfe,{data:f,width:e.width,height:e.height,showText:p,orientation:m})})})}if(n==="QRCODE"){const f=r?.data??"https://example.com",p=Math.min(e.width,e.height)-4;return o.jsx("div",{className:"w-full h-full flex items-center justify-center p-0.5",children:o.jsx(LF,{value:f,size:Math.max(20,p),level:"M",includeMargin:!1})})}if(n==="IMAGE"){const f=r?.src,p=a?{transform:"rotate(-90deg)"}:{};return f?o.jsx("div",{className:"w-full h-full flex items-center justify-center overflow-hidden",children:o.jsx("img",{src:Zu(f),alt:"",className:"max-w-full max-h-full object-contain",style:p})}):o.jsx("div",{className:"w-full h-full flex flex-col items-center justify-center bg-gray-100 text-gray-500 text-[10px] border border-dashed border-gray-300",style:p,children:o.jsx("span",{className:"font-medium",children:"Logo"})})}if(n==="DATE"){const f=String(r?.inputType??r?.InputType??"").toLowerCase(),p=(typeof r?.format=="string"&&r.format.trim()?r.format:typeof r?.Format=="string"&&r.Format.trim()?r.Format:f==="datetime"?"YYYY-MM-DD HH:mm":"DD/MM/YYYY")??(f==="datetime"?"YYYY-MM-DD HH:mm":"DD/MM/YYYY"),m=Number(r?.offsetDays??r?.OffsetDays??0)||0,v=new Date;v.setDate(v.getDate()+m);const y=Yfe(p,v);return f==="datetime"||f==="date"?t?o.jsx("div",{className:"w-full h-full flex items-center justify-center overflow-hidden",children:o.jsx("div",{className:"px-1 flex items-center justify-center overflow-hidden pointer-events-none text-[10px] text-center whitespace-nowrap",style:{...i,...d},title:`Format: ${p}`,children:p})}):o.jsx("div",{className:"w-full h-full flex items-center justify-center overflow-hidden",children:o.jsx("input",{type:"date",readOnly:!0,value:"2025-02-01",className:"w-full h-full min-w-0 border border-gray-300 bg-white rounded px-1 pointer-events-none text-[10px]",style:{...i,...d}})}):o.jsx("div",{className:"w-full h-full flex items-center justify-center overflow-hidden",children:o.jsx("div",{className:"px-1 overflow-hidden whitespace-nowrap",style:{...i,...d},children:y})})}if(n==="TIME"){const p="HH:mm".replace("HH","12").replace("mm","30");return o.jsx("div",{className:"w-full h-full flex items-center justify-center overflow-hidden",children:o.jsx("div",{className:"px-1 overflow-hidden whitespace-nowrap",style:{...i,...d},children:p})})}if(n==="DURATION"){const f=(typeof r?.format=="string"&&r.format.trim()?r.format:typeof r?.Format=="string"&&r.Format.trim()?r.Format:"Days")??"Days",p=Xfe.has(f)?f:"Days",m=r?.durationValue??r?.value??r?.offsetDays??r?.DurationValue??r?.Value??r?.OffsetDays,y=`${Number.isFinite(Number(m))?Number(m):3} ${p}`;return o.jsx("div",{className:"w-full h-full flex items-center justify-center overflow-hidden",children:o.jsx("div",{className:"px-1 overflow-hidden whitespace-nowrap",style:{...i,...d},children:y})})}if(n==="WEIGHT"){const f=r?.value??r?.Value,p=f==null||f===""?500:typeof f=="number"?f:Number(f),m=Number.isFinite(p)?p:500,v=Jfe((typeof r?.unit=="string"&&r.unit.trim()?r.unit:typeof r?.Unit=="string"&&r.Unit.trim()?r.Unit:"g")??"g"),y=r?.fontSize??r?.FontSize,x=Number.isFinite(Number(y))?Number(y):14,w=String(r?.textAlign??r?.TextAlign??"left").toLowerCase(),j=w==="center"||w==="right"?w:"left";return o.jsx("div",{className:"w-full h-full flex items-center justify-center overflow-hidden",children:o.jsxs("div",{className:"px-1 overflow-hidden whitespace-nowrap",style:{...i,...d,fontSize:x,textAlign:j},children:[m,v]})})}if(n==="WEIGHT_PRICE"){const f=r?.unitPrice??10,p=r?.weight??.5,m=r?.currency??"$";return o.jsxs("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:i,children:[m,(f*p).toFixed(2)]})}if(n==="NUTRITION"){const f=String(r.servingsPerContainer??r.ServingsPerContainer??"").trim(),p=String(r.servingSize??r.ServingSize??"").trim(),m=String(r.calories??r.Calories??Z1(r,"calories","value")??"").trim(),v=Number(r.nutritionTitleFontSize??r.NutritionTitleFontSize??16)||16,y=xm.map(C=>{const A=Z1(r,C.key,"value"),E=Z1(r,C.key,"unit");return A?{id:C.key,label:C.label,value:A,unit:E}:null}).filter(Boolean),x=Kfe(r).filter(C=>C.value.trim()).map(C=>({id:C.id,label:C.name.trim()||"Other",value:C.value.trim(),unit:C.unit.trim()})),w=[...y,...x],j=(C,A)=>{const E=String(C??"").trim(),O=String(A??"").trim();return!E&&!O?"":`<${E}${O?` ${O}`:""}`},N=o.jsxs("div",{className:"text-[10px] p-1 w-full h-full overflow-hidden flex flex-col leading-tight bg-white",children:[o.jsx("div",{className:"font-bold border-b border-black pb-0.5",style:{fontSize:`${v}px`},children:"Nutrition Facts"}),m?o.jsxs("div",{className:"flex items-center justify-between py-0.5 mt-0.5",children:[o.jsx("span",{className:"font-semibold text-[10px]",children:"Calories"}),o.jsx("span",{className:"font-semibold text-[10px]",children:j(m,"")})]}):null,f?o.jsxs("div",{className:"flex items-center justify-between py-0.5 text-[10px]",children:[o.jsx("span",{children:"Servings Per Container"}),o.jsx("span",{children:f})]}):null,p?o.jsxs("div",{className:"flex items-center justify-between pb-0.5 text-[10px]",children:[o.jsx("span",{children:"Serving Size"}),o.jsx("span",{children:p})]}):null,o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden pt-0.5",children:w.length===0?o.jsx("div",{className:"text-[7px] text-gray-500",children:"No nutrients"}):w.slice(0,18).map(C=>o.jsxs("div",{className:"flex items-center justify-between py-[1px] text-[10px]",children:[o.jsx("span",{className:"truncate font-medium",children:C.label}),o.jsx("span",{className:"shrink-0 font-medium",children:j(C.value,C.unit)})]},C.id))})]});return o.jsx("div",{className:"w-full h-full flex items-center justify-center overflow-hidden",children:o.jsx("div",{className:"shrink-0",style:a?{width:e.height,height:e.width,transform:"rotate(-90deg)",transformOrigin:"center center"}:{width:"100%",height:"100%"},children:N})})}return n==="BLANK"?o.jsx("div",{className:"w-full h-full border border-dashed border-gray-200"}):o.jsx("div",{className:"text-gray-500 text-[10px] px-1 truncate w-full flex items-center justify-center",children:e.type.replace(/_/g," ")})}function Qfe(e){return e==="top"||e==="bottom"?"ns-resize":e==="left"||e==="right"?"ew-resize":e==="top-left"||e==="bottom-right"?"nwse-resize":"nesw-resize"}function Zfe({template:e,selectedId:t,onSelect:r,onUpdateElement:n,onDeleteElement:a,onTemplateChange:i,scale:s=1,onZoomIn:u,onZoomOut:d,onPreview:c}){const f=b.useRef(null),p=b.useRef(null),m=b.useRef(null),v=b.useRef(null),y=b.useRef(null),x=b.useRef(null),w=b.useRef(null),[j,N]=q.useState(!1),[C,A]=q.useState(!1),[E,O]=q.useState(null),T=b.useRef(null),[k,M]=q.useState({x:0,y:0}),L=b.useRef(null),$=Ra(e.width,e.unit),I=Ra(e.height,e.unit),H=e.showGrid!==!1,Y=b.useCallback((B,X)=>{if(j||B.button===1)return;B.stopPropagation(),r(X),p.current?.focus();const Q=e.elements.find(G=>G.id===X);if(!Q)return;const re=document.getElementById(`element-${X}`);re&&(re.classList.add("z-50","opacity-90","shadow-xl","ring-2","ring-blue-400","ring-offset-2"),re.style.cursor="grabbing"),m.current={id:X,startX:B.clientX,startY:B.clientY,elX:Q.x,elY:Q.y},x.current={id:X,x:Q.x,y:Q.y},B.currentTarget.setPointerCapture?.(B.pointerId)},[e.elements,r,j]),W=b.useCallback(B=>{w.current!==null&&cancelAnimationFrame(w.current),w.current=requestAnimationFrame(()=>{B(),w.current=null})},[]),V=b.useCallback((B,X)=>{B.stopPropagation(),y.current={edge:X,startX:B.clientX,startY:B.clientY,startW:e.width,startH:e.height,startElements:e.elements.map(re=>({id:re.id,x:re.x,y:re.y}))};const Q=Qfe(X);O(Q),document.body.style.cursor=Q,B.currentTarget.setPointerCapture?.(B.pointerId)},[e.width,e.height,e.elements]),K=b.useCallback(B=>{if(C&&L.current){const X=B.clientX-L.current.startX,Q=B.clientY-L.current.startY;M({x:L.current.x+X,y:L.current.y+Q});return}if(C&&T.current&&f.current){const X=B.clientX-T.current.x,Q=B.clientY-T.current.y;f.current.scrollLeft=T.current.scrollLeft-X,f.current.scrollTop=T.current.scrollTop-Q;return}if(m.current){const{id:X,startX:Q,startY:re,elX:G,elY:Z}=m.current,ee=B.clientX,ce=B.clientY;W(()=>{const ve=(ee-Q)/s,ne=(ce-re)/s,Ce=Math.max(0,G+ve),pe=Math.max(0,Z+ne),Pe=Ws(Ce),$e=Ws(pe),Fe=document.getElementById(`element-${X}`);Fe&&(Fe.style.left=`${Pe}px`,Fe.style.top=`${$e}px`),x.current={id:X,x:Pe,y:$e}})}if(v.current){const{id:X,corner:Q,startX:re,startY:G,w:Z,h:ee,elX:ce,elY:ve}=v.current,ne=B.clientX,Ce=B.clientY;W(()=>{const pe=(ne-re)/s,Pe=(Ce-G)/s;let $e=Z,Fe=ee,dt=ce,ct=ve;Q.includes("e")&&($e=Math.max(20,Z+pe)),Q.includes("w")&&($e=Math.max(20,Z-pe),dt=ce+pe),Q.includes("s")&&(Fe=Math.max(12,ee+Pe)),Q.includes("n")&&(Fe=Math.max(12,ee-Pe),ct=ve+Pe);const St=Ws($e),Ot=Ws(Fe),it=Ws(dt),Pt=Ws(ct),Ut=document.getElementById(`element-${X}`);Ut&&(Ut.style.width=`${St}px`,Ut.style.height=`${Ot}px`,Ut.style.left=`${it}px`,Ut.style.top=`${Pt}px`),x.current={id:X,width:St,height:Ot,x:it,y:Pt}})}if(y.current&&i){const{edge:X,startX:Q,startY:re,startW:G,startH:Z,startElements:ee}=y.current,ce=B.clientX,ve=B.clientY;W(()=>{const ne=(ce-Q)/s,Ce=(ve-re)/s,pe=1,Pe=Ra(G,e.unit),$e=Ra(Z,e.unit),Fe=Ra(pe,e.unit),dt=Ra(pe,e.unit),ct=X==="top"||X==="top-left"||X==="top-right",St=X==="bottom"||X==="bottom-left"||X==="bottom-right",Ot=X==="left"||X==="top-left"||X==="bottom-left",it=X==="right"||X==="top-right"||X==="bottom-right";let Pt=G,Ut=Z,Ar=0,_r=0;if(it){const Kt=Math.max(Fe,Pe+ne);Pt=Math.max(pe,Math.round(Xh(Kt,e.unit)))}if(St){const Kt=Math.max(dt,$e+Ce);Ut=Math.max(pe,Math.round(Xh(Kt,e.unit)))}if(Ot){const Kt=Math.max(Fe,Pe-ne);Pt=Math.max(pe,Math.round(Xh(Kt,e.unit)));const _t=Ra(Pt,e.unit);Ar=Pe-_t}if(ct){const Kt=Math.max(dt,$e-Ce);Ut=Math.max(pe,Math.round(Xh(Kt,e.unit)));const _t=Ra(Ut,e.unit);_r=$e-_t}const qr={};if((Ot||it)&&(qr.width=Pt),(ct||St)&&(qr.height=Ut),(Ar!==0||_r!==0)&&ee.length>0){const Kt=new Map(ee.map(_t=>[_t.id,_t]));qr.elements=e.elements.map(_t=>{const Vt=Kt.get(_t.id);if(!Vt)return _t;const vr=Math.max(0,Vt.x-Ar),Ur=Math.max(0,Vt.y-_r);return vr===_t.x&&Ur===_t.y?_t:{..._t,x:vr,y:Ur}})}i(qr)})}},[C,i,s,e.unit,W]),F=b.useCallback(()=>{C&&(A(!1),T.current=null,L.current=null),w.current!==null&&(cancelAnimationFrame(w.current),w.current=null);const B=m.current?.id||v.current?.id;if(B){const X=document.getElementById(`element-${B}`);X&&(X.classList.remove("z-50","opacity-90","shadow-xl","ring-2","ring-blue-400","ring-offset-2"),X.style.cursor="")}if(x.current){const{id:X,...Q}=x.current;n(X,Q),x.current=null}m.current=null,v.current=null,y.current=null,O(null),document.body.style.cursor=""},[n]);b.useEffect(()=>{const B=Q=>{Q.code==="Space"&&!Q.repeat&&N(!0)},X=Q=>{Q.code==="Space"&&(N(!1),A(!1),T.current=null,L.current=null)};return window.addEventListener("keydown",B),window.addEventListener("keyup",X),()=>{window.removeEventListener("keydown",B),window.removeEventListener("keyup",X)}},[]),b.useEffect(()=>{if(E)return document.body.style.cursor=E,()=>{document.body.style.cursor=""}},[E]),b.useEffect(()=>{const B=f.current;if(!B)return;const X=()=>{B.scrollLeft=Math.max(0,(B.scrollWidth-B.clientWidth)/2),B.scrollTop=Math.max(0,(B.scrollHeight-B.clientHeight)/2)},Q=requestAnimationFrame(X),re=setTimeout(X,100);return()=>{cancelAnimationFrame(Q),clearTimeout(re)}},[s,$,I]);const te=b.useCallback(B=>{if(!t)return;if(B.key==="Delete"||B.key==="Backspace"){B.preventDefault();const Z=e.elements.findIndex(ee=>ee.id===t);if(Z>=0){const ee=e.elements.filter(ce=>ce.id!==t);a(t),r(ee[Z]?.id??ee[Z-1]?.id??null)}return}const X=e.elements.find(Z=>Z.id===t);if(!X)return;const Q=B.shiftKey?1:pu;let re=0,G=0;switch(B.key){case"ArrowLeft":re=-Q;break;case"ArrowRight":re=Q;break;case"ArrowUp":G=-Q;break;case"ArrowDown":G=-Q;break;default:return}B.key==="ArrowDown"&&(G=Q),B.preventDefault(),n(X.id,{x:Math.max(0,X.x+re),y:Math.max(0,X.y+G)})},[t,e.elements,n,a,r]),D=B=>{(j||B.button===1)&&(B.preventDefault(),A(!0),T.current={x:B.clientX,y:B.clientY,scrollLeft:f.current?.scrollLeft||0,scrollTop:f.current?.scrollTop||0},B.currentTarget.setPointerCapture(B.pointerId))},U=B=>{if(C&&T.current&&f.current){const X=B.clientX-T.current.x,Q=B.clientY-T.current.y;f.current.scrollLeft=T.current.scrollLeft-X,f.current.scrollTop=T.current.scrollTop-Q}},z=B=>{C&&(A(!1),T.current=null)};return o.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden bg-gray-100",children:[o.jsxs("div",{className:"shrink-0 px-4 py-2 border-b border-gray-200 bg-white flex items-center justify-between gap-2 flex-wrap z-10",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Label Preview"}),o.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c&&o.jsx("button",{type:"button",onClick:c,className:"h-8 px-3 rounded border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 text-xs font-medium shadow-sm transition-all active:scale-95",children:"Preview"}),i&&o.jsxs(o.Fragment,{children:[o.jsxs(Ve,{value:(()=>{const B=X1.findIndex(X=>X.width===e.width&&X.height===e.height&&X.unit===e.unit);return B>=0?String(B):"custom"})(),onValueChange:B=>{if(B==="custom")return;const X=X1[Number(B)];X&&i({width:X.width,height:X.height,unit:X.unit})},children:[o.jsx(We,{className:"h-8 w-[130px] text-xs",children:o.jsx(He,{placeholder:"Canvas size"})}),o.jsxs(Ge,{children:[X1.map((B,X)=>o.jsx(je,{value:String(X),className:"text-xs",children:B.name},X)),o.jsx(je,{value:"custom",className:"text-xs text-gray-500",children:"Custom"})]})]}),o.jsx("button",{type:"button",onClick:()=>i({showGrid:!H}),className:Ee("h-8 px-3 rounded border text-xs font-medium shadow-sm transition-colors",H?"border-gray-300 bg-white text-gray-700 hover:bg-gray-50":"border-gray-300 bg-gray-100 text-gray-500"),children:H?"Hide grid":"Show grid"})]}),o.jsxs("div",{className:"flex items-center gap-1 bg-white rounded border border-gray-300 p-0.5 shadow-sm h-8",children:[o.jsx("button",{type:"button",onClick:d,disabled:!d,className:"h-6 w-6 rounded hover:bg-gray-100 text-gray-600 disabled:opacity-50 disabled:pointer-events-none flex items-center justify-center text-sm font-medium active:scale-90 transition-transform",title:"Zoom out",children:"−"}),o.jsxs("span",{className:"min-w-[3rem] text-center text-xs text-gray-600 font-medium",children:[Math.round(s*100),"%"]}),o.jsx("button",{type:"button",onClick:u,disabled:!u,className:"h-6 w-6 rounded hover:bg-gray-100 text-gray-600 disabled:opacity-50 disabled:pointer-events-none flex items-center justify-center text-sm font-medium active:scale-90 transition-transform",title:"Zoom in",children:"+"})]})]})]}),o.jsx("div",{ref:f,className:Ee("flex-1 overflow-auto bg-gray-100 relative",j?"cursor-grab active:cursor-grabbing":""),onPointerDown:D,onPointerMove:U,onPointerUp:z,onPointerLeave:z,children:o.jsx("div",{style:{minWidth:"100%",minHeight:"100%",width:"fit-content",height:"fit-content",display:"flex",padding:50,boxSizing:"border-box",transform:`translate(${k.x}px, ${k.y}px)`},children:o.jsxs("div",{ref:p,tabIndex:0,className:Ee("relative bg-white shadow-lg border border-dashed border-gray-300 origin-top-left outline-none m-auto",C?"cursor-grabbing":"cursor-grab"),style:{width:$,height:I,transform:`scale(${s})`,backgroundImage:H?`linear-gradient(to right, rgba(0,0,0,0.06) 1px, transparent 1px), + linear-gradient(to bottom, rgba(0,0,0,0.06) 1px, transparent 1px)`:void 0,backgroundSize:H?`${pu}px ${pu}px`:void 0,pointerEvents:j?"none":"auto",cursor:E??void 0},onClick:B=>{const X=B.target,Q=X.closest('[id^="element-"]'),re=X.closest('[data-paper-resize-handle="true"]')||X.closest('[title*="Drag to resize paper"]')||X.closest('[title*="Drag to increase paper height"]')||X.closest('[title*="Drag to increase paper width"]');!Q&&!re&&r(null)},onPointerDown:B=>{const X=B.target,Q=X.closest('[id^="element-"]'),re=X.closest('[data-paper-resize-handle="true"]')||X.closest('[title*="Drag to resize paper"]')||X.closest('[title*="Drag to increase paper height"]')||X.closest('[title*="Drag to increase paper width"]');p.current?.contains(X)&&!Q&&!re&&!m.current&&!v.current&&(j||B.button===1)&&(B.preventDefault(),B.stopPropagation(),A(!0),L.current={x:k.x,y:k.y,startX:B.clientX,startY:B.clientY},T.current={x:B.clientX,y:B.clientY,scrollLeft:f.current?.scrollLeft??0,scrollTop:f.current?.scrollTop??0},B.currentTarget.setPointerCapture?.(B.pointerId))},onPointerMove:K,onPointerUp:F,onKeyDown:te,children:[e.showRuler&&o.jsxs("div",{className:"absolute top-0 left-0 right-0 h-5 border-b border-gray-300 bg-gray-50 text-[10px] text-gray-500 flex items-center px-1 pointer-events-none select-none",children:[e.unit," ",e.width," × ",e.height]}),i&&o.jsx("div",{className:"absolute left-0 right-0 h-3 cursor-ns-resize flex items-center justify-center bg-gray-200/80 hover:bg-blue-400/30 border-b border-gray-300 text-[10px] text-gray-500 transition-colors",style:{top:e.showRuler?20:0},title:"Drag to resize paper (top edge)","data-paper-resize-handle":"true",onPointerDown:B=>V(B,"top"),children:"⋮"}),i&&o.jsx("div",{className:"absolute top-0 bottom-0 w-3 cursor-ew-resize flex items-center justify-center bg-gray-200/80 hover:bg-blue-400/30 border-r border-gray-300 text-[10px] text-gray-500 transition-colors",style:{top:e.showRuler?20:0},title:"Drag to resize paper (left edge)","data-paper-resize-handle":"true",onPointerDown:B=>V(B,"left"),children:"⋮"}),i&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"absolute w-3 h-3 bg-gray-200/90 hover:bg-blue-400/30 border border-gray-300 cursor-nwse-resize transition-colors",style:{left:0,top:e.showRuler?20:0},title:"Drag to resize paper (top-left corner)","data-paper-resize-handle":"true",onPointerDown:B=>V(B,"top-left")}),o.jsx("div",{className:"absolute w-3 h-3 bg-gray-200/90 hover:bg-blue-400/30 border border-gray-300 cursor-nesw-resize transition-colors",style:{right:0,top:e.showRuler?20:0},title:"Drag to resize paper (top-right corner)","data-paper-resize-handle":"true",onPointerDown:B=>V(B,"top-right")}),o.jsx("div",{className:"absolute w-3 h-3 bg-gray-200/90 hover:bg-blue-400/30 border border-gray-300 cursor-nesw-resize transition-colors",style:{left:0,bottom:0},title:"Drag to resize paper (bottom-left corner)","data-paper-resize-handle":"true",onPointerDown:B=>V(B,"bottom-left")}),o.jsx("div",{className:"absolute w-3 h-3 bg-gray-200/90 hover:bg-blue-400/30 border border-gray-300 cursor-nwse-resize transition-colors",style:{right:0,bottom:0},title:"Drag to resize paper (bottom-right corner)","data-paper-resize-handle":"true",onPointerDown:B=>V(B,"bottom-right")})]}),i&&o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-3 cursor-ns-resize flex items-center justify-center bg-gray-200/80 hover:bg-blue-400/30 border-t border-gray-300 text-[10px] text-gray-500 transition-colors",title:"Drag to resize paper (bottom edge)","data-paper-resize-handle":"true",onPointerDown:B=>V(B,"bottom"),children:"⋮"}),i&&o.jsx("div",{className:"absolute top-0 right-0 bottom-0 w-3 cursor-ew-resize flex items-center justify-center bg-gray-200/80 hover:bg-blue-400/30 border-l border-gray-300 text-[10px] text-gray-500 transition-colors",title:"Drag to resize paper (right edge)","data-paper-resize-handle":"true",onPointerDown:B=>V(B,"right"),children:"⋮"}),e.elements.map(B=>{const X=Bl(B);return o.jsxs("div",{id:`element-${B.id}`,className:Ee("absolute box-border cursor-move overflow-hidden transition-shadow",B.border==="line"&&"border border-gray-400",B.border==="dotted"&&"border border-dotted border-gray-400",t===B.id&&"ring-2 ring-blue-500 ring-offset-1 z-10"),style:{left:B.x,top:B.y,width:B.width,height:B.height},onClick:Q=>{Q.stopPropagation(),r(B.id)},onPointerDown:Q=>Y(Q,B.id),children:[o.jsx("div",{className:Ee("w-full h-full min-h-0 relative",X&&"rounded-sm border-2 border-dashed border-amber-500/85 bg-amber-50/35"),children:o.jsx($F,{el:B,isAppPrintField:X})}),t===B.id&&o.jsxs(o.Fragment,{children:[["nw","ne","sw","se"].map(Q=>o.jsx("div",{className:"absolute w-4 h-4 bg-white border-2 border-blue-500 rounded-full z-20 shadow-md hover:scale-110 transition-transform",style:{cursor:"nwse-resize",top:Q.startsWith("n")?-6:void 0,bottom:Q.startsWith("s")?-6:void 0,left:Q.endsWith("w")?-6:void 0,right:Q.endsWith("e")?-6:void 0},onPointerDown:re=>{re.stopPropagation();const G=e.elements.find(Z=>Z.id===B.id);v.current={id:B.id,corner:Q,startX:re.clientX,startY:re.clientY,w:G.width,h:G.height,elX:G.x,elY:G.y},re.currentTarget.setPointerCapture?.(re.pointerId)}},Q)),["n","s","w","e"].map(Q=>o.jsx("div",{className:"absolute bg-blue-500/50 border border-white/50 rounded-sm z-10 shadow-sm hover:bg-blue-600",style:{cursor:Q==="n"||Q==="s"?"ns-resize":"ew-resize",width:Q==="n"||Q==="s"?"20px":"6px",height:Q==="n"||Q==="s"?"6px":"20px",top:Q==="n"?-3:Q==="s"?void 0:"50%",bottom:Q==="s"?-3:void 0,left:Q==="w"?-3:Q==="e"?void 0:"50%",right:Q==="e"?-3:void 0,transform:Q==="n"||Q==="s"?"translateX(-50%)":"translateY(-50%)"},onPointerDown:re=>{re.stopPropagation();const G=e.elements.find(ee=>ee.id===B.id),Z=document.getElementById(`element-${B.id}`);Z&&Z.classList.add("z-50","opacity-90"),v.current={id:B.id,corner:Q,startX:re.clientX,startY:re.clientY,w:G.width,h:G.height,elX:G.x,elY:G.y},re.currentTarget.setPointerCapture?.(re.pointerId)}},Q))]})]},B.id)})]})})})]})}function ehe({template:e,maxWidth:t=480}){const r=Ra(e.width,e.unit),n=Ra(e.height,e.unit),a=Math.min(0,...e.elements.map(v=>v.x)),i=Math.min(0,...e.elements.map(v=>v.y)),s=Math.max(r,...e.elements.map(v=>v.x+v.width)),u=Math.max(n,...e.elements.map(v=>v.y+v.height)),d=Math.max(1,s-a),c=Math.max(1,u-i),f=t?Math.min(t/d,t/c,2):1,p=d*f,m=c*f;return o.jsx("div",{className:"inline-flex items-center justify-center p-4 bg-gray-100 rounded",style:{minWidth:p+32},children:o.jsx("div",{style:{width:p,height:m},className:"relative bg-white shadow-lg overflow-hidden",children:o.jsx("div",{className:"origin-top-left",style:{position:"absolute",left:0,top:0,width:d,height:c,transform:`scale(${f})`,transformOrigin:"0 0"},children:e.elements.map(v=>{const y=Bl(v);return o.jsx("div",{className:"absolute box-border overflow-hidden pointer-events-none flex items-center justify-center text-xs",style:{left:v.x-a,top:v.y-i,width:v.width,height:v.height,border:v.border==="line"?"1px solid #999":v.border==="dotted"?"1px dotted #999":void 0},children:o.jsx("div",{className:Ee("w-full h-full min-h-0 relative",y&&"rounded-sm border-2 border-dashed border-amber-500/85 bg-amber-50/35"),children:o.jsx($F,{el:v,isAppPrintField:y})})},v.id)})})})})}const Mg=un({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Dg="/label-multiple-option";function the(e){if(e==null)return[];if(Array.isArray(e))return e.map(t=>String(t));if(typeof e=="string"){const t=e.trim();if(!t)return[];try{const r=JSON.parse(t);return Array.isArray(r)?r.map(n=>String(n)):[]}catch{return[]}}return[]}function FN(e){return{...e,optionValuesJson:the(e.optionValuesJson)}}function rhe(e){return{totalCount:e.totalCount??0,items:(e.items??[]).map(FN)}}function FF(e){return JSON.stringify(e)}async function BF(e,t){const r=await Mg.requestJson({path:Dg,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,State:e.state},signal:t});return rhe(r)}async function nhe(e){const t=await Mg.requestJson({path:Dg,method:"POST",body:{optionCode:e.optionCode,optionName:e.optionName,optionValuesJson:FF(e.optionValuesJson),state:e.state??!0,orderNum:e.orderNum}});return FN(t)}async function ahe(e,t){const r=await Mg.requestJson({path:`${Dg}/${encodeURIComponent(e)}`,method:"PUT",body:{optionCode:t.optionCode,optionName:t.optionName,optionValuesJson:FF(t.optionValuesJson),state:t.state??!0,orderNum:t.orderNum}});return FN(r)}async function ihe(e){await Mg.requestJson({path:`${Dg}/${encodeURIComponent(e)}`,method:"DELETE"})}const bM=["DD/MM/YYYY","MM/DD/YYYY","DD/MM/YY","MM/DD/YY","MM/YY","MM/DD","MM","DD","YY","FULLY DAY(WEDNESDAY)","DAY (WED)","MONTH (DECEMBER)","YEAR (2025)","DD MONTH YEAR (25 DECEMBER 2025)"],wM="YYYY-MM-DD HH:mm",ohe=["Minutes","Hours","Days","Weeks","Months (30 Day)","Years"];function she({template:e,selectedElement:t,onTemplateChange:r,onElementChange:n,onDeleteElement:a,readOnlyTemplateCode:i=!1}){if(t){const s=iF(t);return o.jsxs("div",{className:"w-72 shrink-0 border-l border-gray-200 bg-white flex flex-col h-full",children:[o.jsx("div",{className:"px-3 py-2 border-b border-gray-200 font-semibold text-gray-800",children:"Properties (Element)"}),o.jsx(fl,{className:"flex-1",children:o.jsxs("div",{className:"p-3 space-y-3",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"X"}),o.jsx(ye,{type:"number",value:t.x,onChange:u=>n(t.id,{x:Number(u.target.value)||0}),className:"h-8 text-sm"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Y"}),o.jsx(ye,{type:"number",value:t.y,onChange:u=>n(t.id,{y:Number(u.target.value)||0}),className:"h-8 text-sm"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Width"}),o.jsx(ye,{type:"number",value:t.width,onChange:u=>n(t.id,{width:Math.max(1,Number(u.target.value)||0)}),className:"h-8 text-sm"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Height"}),o.jsx(ye,{type:"number",value:t.height,onChange:u=>n(t.id,{height:Math.max(1,Number(u.target.value)||0)}),className:"h-8 text-sm"})]})]}),s?null:o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Rotation"}),o.jsxs(Ve,{value:t.rotation,onValueChange:u=>n(t.id,{rotation:u}),children:[o.jsx(We,{className:"h-8 text-sm",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"horizontal",children:"horizontal"}),o.jsx(je,{value:"vertical",children:"vertical"})]})]})]}),s?null:o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Border"}),o.jsxs(Ve,{value:t.border,onValueChange:u=>n(t.id,{border:u}),children:[o.jsx(We,{className:"h-8 text-sm",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"none",children:"none"}),o.jsx(je,{value:"line",children:"line"}),o.jsx(je,{value:"dotted",children:"dotted"})]})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Element name"}),o.jsx(ye,{value:(t.elementName??"").trim(),onChange:u=>n(t.id,{elementName:u.target.value}),className:"h-8 text-sm mt-1",placeholder:"e.g. text1"}),o.jsx("p",{className:"text-[10px] text-gray-400 mt-1",children:"Required for save; used as data-entry column header (elementName)."})]}),o.jsx(dhe,{element:t,onChange:u=>n(t.id,{config:{...t.config,...u}})}),a&&o.jsx("div",{className:"pt-4 border-t border-gray-100",children:o.jsxs(he,{variant:"destructive",className:"w-full gap-2",onClick:()=>a(t.id),children:[o.jsx(Et,{className:"h-4 w-4 shrink-0"}),"Delete Element"]})})]})})]})}return o.jsxs("div",{className:"w-72 shrink-0 border-l border-gray-200 bg-white flex flex-col h-full",children:[o.jsx("div",{className:"px-3 py-2 border-b border-gray-200 font-semibold text-gray-800",children:"Properties (Template)"}),o.jsx(fl,{className:"flex-1",children:o.jsxs("div",{className:"p-3 space-y-3",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Template Code"}),o.jsx(ye,{value:e.id,disabled:i,onChange:s=>r({id:s.target.value.trim()}),className:"h-8 text-sm mt-1",placeholder:"e.g. TPL_TEST_001"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Template Name"}),o.jsx(ye,{value:e.name,onChange:s=>r({name:s.target.value}),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Width"}),o.jsx(ye,{type:"number",value:e.width,onChange:s=>r({width:Math.max(.1,Number(s.target.value)||0)}),className:"h-8 text-sm"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Height"}),o.jsx(ye,{type:"number",value:e.height,onChange:s=>r({height:Math.max(.1,Number(s.target.value)||0)}),className:"h-8 text-sm"})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Unit"}),o.jsxs(Ve,{value:e.unit,onValueChange:s=>r({unit:s}),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"cm",children:"cm"}),o.jsx(je,{value:"inch",children:"inch"})]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Zt,{checked:e.showRuler,onCheckedChange:s=>r({showRuler:s})}),o.jsx(de,{className:"text-xs",children:"Show Ruler"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Zt,{checked:e.showGrid??!0,onCheckedChange:s=>r({showGrid:s})}),o.jsx(de,{className:"text-xs",children:"Show Grid"})]})]})})]})}const ew="__none__";function lhe({cfg:e,onPatch:t}){const[r,n]=b.useState([]),[a,i]=b.useState(!1);b.useEffect(()=>{let p=!1;return i(!0),BF({skipCount:1,maxResultCount:500}).then(m=>{p||n(m.items??[])}).catch(()=>{p||n([])}).finally(()=>{p||i(!1)}),()=>{p=!0}},[]);const s=(e.multipleOptionId??"").trim(),u=Array.isArray(e.selectedOptionValues)?e.selectedOptionValues:[],d=r.find(p=>p.id===s),c=d?.optionValuesJson??[];b.useEffect(()=>{if(!s||r.length===0)return;const p=r.find(y=>y.id===s),m=String(p?.optionName??"").trim();if(!p||!m)return;const v=String(e.multipleOptionName??"").trim();m!==v&&t({multipleOptionName:m})},[s,r,e.multipleOptionName,t]);const f=s||ew;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Option dictionary"}),o.jsxs(Ve,{value:f,onValueChange:p=>{if(p===ew){t({multipleOptionId:"",multipleOptionName:"",selectedOptionValues:[]});return}const m=r.find(w=>w.id===p),v=new Set(m?.optionValuesJson??[]),y=u.filter(w=>v.has(w)),x=String(m?.optionName??m?.optionCode??"").trim();t({multipleOptionId:p,multipleOptionName:x,selectedOptionValues:y})},disabled:a,children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{placeholder:a?"Loading…":"Select from Multiple Options"})}),o.jsxs(Ge,{children:[o.jsx(je,{value:ew,children:"— None —"}),r.map(p=>o.jsx(je,{value:p.id,children:p.optionName??p.optionCode??p.id},p.id))]})]}),o.jsx("p",{className:"text-[10px] text-gray-400 mt-1",children:"Data comes from the Multiple Options tab (label-multiple-option list)."})]}),d&&c.length>0?o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Values (multi-select)"}),o.jsx("div",{className:"mt-1 max-h-44 overflow-y-auto border border-gray-200 rounded-md p-2 space-y-2 bg-gray-50/50",children:c.map(p=>o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx(Qu,{className:"shrink-0",checked:u.includes(p),onCheckedChange:m=>{const v=new Set(u);m?v.add(p):v.delete(p),t({selectedOptionValues:Array.from(v)})}}),o.jsx("span",{className:"text-xs truncate",title:p,children:p})]},p))})]}):s?o.jsx("p",{className:"text-[10px] text-amber-600",children:"No values in this dictionary or still loading."}):null]})}function tw({cfg:e,update:t,textAlignDefault:r}){return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Text"}),o.jsx(ye,{value:e.text??"0.00",onChange:n=>t("text",n.target.value),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Font Size"}),o.jsx(ye,{type:"number",value:e.fontSize??14,onChange:n=>t("fontSize",Number(n.target.value)||14),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Text Align"}),o.jsxs(Ve,{value:e.textAlign??r,onValueChange:n=>t("textAlign",n),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"left",children:"Left"}),o.jsx(je,{value:"center",children:"Center"}),o.jsx(je,{value:"right",children:"Right"})]})]})]})]})}function ka(e,t,r){for(const n of t){const a=e[n];if(a!=null&&String(a).trim()!=="")return String(a).trim()}return r}function Gs(e,t,r){for(const n of t){const a=e[n];if(a==null||a==="")continue;const i=typeof a=="number"?a:Number(a);if(Number.isFinite(i))return i}return r}const zF=[{value:"lb",label:"Lb"},{value:"kg",label:"Kg"},{value:"mg",label:"Milligrams"},{value:"g",label:"Grams"},{value:"oz",label:"Ounces"}];function che(e){const t=String(e??"").trim().toLowerCase();return t==="milligrams"?"mg":t==="grams"?"g":t==="ounces"?"oz":t==="pounds"?"lb":t==="kilograms"?"kg":zF.some(r=>r.value===t)?t:"g"}function uhe(e){const t=e.extraNutrients;return Array.isArray(t)?t.map((r,n)=>{const a=r;return{id:String(a.id??`extra-${n}`),name:String(a.name??""),value:String(a.value??""),unit:String(a.unit??"")}}):[]}function Jh(e,t,r){const n=r==="value"?t:`${t}Unit`,a=e[n];if(a!=null&&String(a).trim()!=="")return String(a).trim();const s=(Array.isArray(e.fixedNutrients)?e.fixedNutrients:[]).find(u=>String(u.key??"").trim()===t);return String(s?.[r]??"").trim()}function dhe({element:e,onChange:t}){const r=e.config,n=Jn(e.type),a=(i,s)=>t({[i]:s});switch(n){case"TEXT_STATIC":return r.inputType==="options"?o.jsxs(o.Fragment,{children:[o.jsx(lhe,{cfg:r,onPatch:t}),o.jsx(tw,{cfg:r,update:a,textAlignDefault:"left"})]}):o.jsx(tw,{cfg:r,update:a,textAlignDefault:"right"});case"TEXT_PRODUCT":case"TEXT_PRICE":return o.jsx(tw,{cfg:r,update:a,textAlignDefault:"right"});case"BARCODE":return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Data"}),o.jsx(ye,{value:r.data??"123456789",onChange:i=>a("data",i.target.value),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Orientation"}),o.jsxs(Ve,{value:r.orientation??"horizontal",onValueChange:i=>a("orientation",i),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"horizontal",children:"Horizontal"}),o.jsx(je,{value:"vertical",children:"Vertical"})]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Zt,{checked:r.showText!==!1,onCheckedChange:i=>a("showText",i)}),o.jsx(de,{className:"text-xs",children:"Show Text"})]})]});case"QRCODE":return o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Data (URL)"}),o.jsx(ye,{value:r.data??"https://example.com",onChange:i=>a("data",i.target.value),className:"h-8 text-sm mt-1"})]});case"IMAGE":return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Image URL / path"}),o.jsx(ye,{value:r.src??"",onChange:i=>a("src",i.target.value),className:"h-8 text-sm mt-1",placeholder:"https://... or /picture/..."})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Scale Mode"}),o.jsxs(Ve,{value:r.scaleMode??"contain",onValueChange:i=>a("scaleMode",i),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"contain",children:"Contain"}),o.jsx(je,{value:"cover",children:"Cover"}),o.jsx(je,{value:"fill",children:"Fill"})]})]})]})]});case"DATE":{const i=String(r.inputType??r.InputType??"").toLowerCase(),s=i==="datetime"||i==="date",u=ka(r,["format","Format"],i==="datetime"?wM:"DD/MM/YYYY"),d=i==="datetime"?[wM,...bM]:[...bM];return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Format"}),o.jsxs(Ve,{value:u,onValueChange:c=>a("format",c),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsx(Ge,{children:d.map(c=>o.jsx(je,{value:c,children:c},c))})]}),s?o.jsx("p",{className:"text-[10px] text-gray-400 mt-1",children:"Shown as placeholder on the label until the app fills the date at print time."}):null]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Font Size"}),o.jsx(ye,{type:"number",value:Gs(r,["fontSize","FontSize"],14),onChange:c=>a("fontSize",Number(c.target.value)||14),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Text Align"}),o.jsxs(Ve,{value:ka(r,["textAlign","TextAlign"],"left"),onValueChange:c=>a("textAlign",c),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"left",children:"Left"}),o.jsx(je,{value:"center",children:"Center"}),o.jsx(je,{value:"right",children:"Right"})]})]})]})]})}case"TIME":return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Format"}),o.jsx(ye,{value:"HH:mm",className:"h-8 text-sm mt-1",readOnly:!0})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Font Size"}),o.jsx(ye,{type:"number",value:Gs(r,["fontSize","FontSize"],14),onChange:i=>a("fontSize",Number(i.target.value)||14),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Text Align"}),o.jsxs(Ve,{value:ka(r,["textAlign","TextAlign"],"left"),onValueChange:i=>a("textAlign",i),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"left",children:"Left"}),o.jsx(je,{value:"center",children:"Center"}),o.jsx(je,{value:"right",children:"Right"})]})]})]})]});case"DURATION":return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Format"}),o.jsxs(Ve,{value:ka(r,["format","Format"],"Days"),onValueChange:i=>a("format",i),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsx(Ge,{children:ohe.map(i=>o.jsx(je,{value:i,children:i},i))})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Font Size"}),o.jsx(ye,{type:"number",value:Gs(r,["fontSize","FontSize"],14),onChange:i=>a("fontSize",Number(i.target.value)||14),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Text Align"}),o.jsxs(Ve,{value:ka(r,["textAlign","TextAlign"],"left"),onValueChange:i=>a("textAlign",i),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"left",children:"Left"}),o.jsx(je,{value:"center",children:"Center"}),o.jsx(je,{value:"right",children:"Right"})]})]})]})]});case"WEIGHT":{const i=che(ka(r,["unit","Unit"],"g")),s=ka(r,["textAlign","TextAlign"],"left"),u=Gs(r,["fontSize","FontSize"],14);return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Value"}),o.jsx(ye,{type:"number",value:Gs(r,["value","Value"],500),onChange:d=>a("value",Number(d.target.value)||0),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Unit"}),o.jsxs(Ve,{value:i,onValueChange:d=>a("unit",d),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsx(Ge,{children:zF.map(d=>o.jsx(je,{value:d.value,children:d.label},d.value))})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Font Size"}),o.jsx(ye,{type:"number",value:u,onChange:d=>a("fontSize",Math.max(1,Number(d.target.value)||14)),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Text Align"}),o.jsxs(Ve,{value:s,onValueChange:d=>a("textAlign",d),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"left",children:"Left"}),o.jsx(je,{value:"center",children:"Center"}),o.jsx(je,{value:"right",children:"Right"})]})]})]})]})}case"WEIGHT_PRICE":return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Unit Price"}),o.jsx(ye,{type:"number",value:r.unitPrice??10,onChange:i=>a("unitPrice",Number(i.target.value)||0),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Weight"}),o.jsx(ye,{type:"number",step:"0.1",value:r.weight??.5,onChange:i=>a("weight",Number(i.target.value)||0),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Currency"}),o.jsx(ye,{value:r.currency??"$",onChange:i=>a("currency",i.target.value),className:"h-8 text-sm mt-1"})]})]});case"NUTRITION":{const i=uhe(r),s=(f,p,m)=>{const v=xm.map(w=>{const j={key:w.key,label:w.label,value:Jh(r,w.key,"value"),unit:Jh(r,w.key,"unit")};return w.key!==f?j:{...j,[p]:m}}),y={fixedNutrients:v},x=v.find(w=>w.key===f);x&&(y[f]=x.value,y[`${f}Unit`]=x.unit),t(y)},u=()=>{const f=[...i,{id:`extra-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,name:"",value:"",unit:""}];a("extraNutrients",f)},d=(f,p,m)=>{const v=i.map(y=>y.id===f?{...y,[p]:m}:y);a("extraNutrients",v)},c=f=>{a("extraNutrients",i.filter(p=>p.id!==f))};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"Nutrition summary"}),o.jsxs("div",{className:"space-y-2 mt-1",children:[o.jsxs("div",{className:"grid grid-cols-[1fr_90px] gap-2 items-center",children:[o.jsx("span",{className:"text-xs text-gray-600",children:"Nutrition Facts title (px)"}),o.jsx(ye,{type:"number",value:Gs(r,["nutritionTitleFontSize","NutritionTitleFontSize"],16),onChange:f=>a("nutritionTitleFontSize",Math.max(10,Number(f.target.value)||16)),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"grid grid-cols-[1fr_90px] gap-2 items-center",children:[o.jsx("span",{className:"text-xs text-gray-600",children:"Servings Per Container"}),o.jsx(ye,{value:ka(r,["servingsPerContainer","ServingsPerContainer"],""),onChange:f=>a("servingsPerContainer",f.target.value),className:"h-8 text-sm",placeholder:"e.g. 8"})]}),o.jsxs("div",{className:"grid grid-cols-[1fr_90px] gap-2 items-center",children:[o.jsx("span",{className:"text-xs text-gray-600",children:"Serving Size"}),o.jsx(ye,{value:ka(r,["servingSize","ServingSize"],""),onChange:f=>a("servingSize",f.target.value),className:"h-8 text-sm",placeholder:"e.g. 1 cup"})]}),o.jsxs("div",{className:"grid grid-cols-[1fr_90px] gap-2 items-center",children:[o.jsx("span",{className:"text-xs text-gray-600",children:"Calories"}),o.jsx(ye,{value:ka(r,["calories","Calories"],""),onChange:f=>a("calories",f.target.value),className:"h-8 text-sm",placeholder:"e.g. 120"})]})]})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsx(de,{className:"text-xs",children:"Nutrition table"}),o.jsx(he,{type:"button",variant:"outline",className:"h-7 px-2 text-xs",onClick:u,children:"Add nutrient"})]}),o.jsxs("div",{className:"space-y-1.5 mt-1",children:[o.jsxs("div",{className:"grid grid-cols-[1fr_78px_58px_26px] gap-1.5 items-center text-[10px] text-gray-500 px-0.5",children:[o.jsx("span",{children:"Name"}),o.jsx("span",{children:"Value"}),o.jsx("span",{children:"Unit"}),o.jsx("span",{})]}),xm.map(f=>o.jsxs("div",{className:"grid grid-cols-[1fr_78px_58px_26px] gap-1.5 items-center",children:[o.jsx("span",{className:"text-xs text-gray-600",children:f.label}),o.jsx(ye,{value:Jh(r,f.key,"value"),onChange:p=>s(f.key,"value",p.target.value),className:"h-8 text-sm",placeholder:"Value"}),o.jsx(ye,{value:Jh(r,f.key,"unit")||(f.defaultUnit??""),onChange:p=>s(f.key,"unit",p.target.value),className:"h-8 text-sm",placeholder:"Unit"}),o.jsx("span",{})]},f.key))]})]}),o.jsxs("div",{className:"space-y-2",children:[i.length===0?o.jsx("p",{className:"text-[10px] text-gray-400",children:"No custom nutrients yet."}):i.map(f=>o.jsxs("div",{className:"grid grid-cols-[1fr_78px_58px_26px] gap-1.5 items-center",children:[o.jsx(ye,{value:f.name,onChange:p=>d(f.id,"name",p.target.value),className:"h-8 text-sm",placeholder:"Name"}),o.jsx(ye,{value:f.value,onChange:p=>d(f.id,"value",p.target.value),className:"h-8 text-sm",placeholder:"Value"}),o.jsx(ye,{value:f.unit,onChange:p=>d(f.id,"unit",p.target.value),className:"h-8 text-sm",placeholder:"Unit"}),o.jsx(he,{type:"button",variant:"ghost",className:"h-8 w-8 p-0 text-gray-500 hover:text-red-600",onClick:()=>c(f.id),"aria-label":"Delete nutrient",children:o.jsx(Et,{className:"h-3.5 w-3.5"})})]},f.id)),o.jsx("div",{className:"text-[10px] text-gray-400",children:"Unit is appended after value in template preview."})]})]})}case"BLANK":return o.jsx("div",{className:"text-xs text-gray-500",children:"Blank spacer; no configuration needed."});default:return o.jsxs("div",{className:"text-xs text-gray-500",children:["Config for ",n," (edit in code if needed)"]})}}const fhe=.5,hhe=2,SM=.25,phe=1;function mhe({templateId:e,initialTemplate:t,onClose:r,onSaved:n}){const[a,i]=b.useState(()=>t?{...t}:ide(e??void 0)),[s,u]=b.useState(null),[d,c]=b.useState(phe),[f,p]=b.useState(!1),m=a.elements.find(C=>C.id===s)??null,v=b.useCallback((C,A,E,O)=>{let T="";i(k=>{const M=(D,U)=>U==="cm"?D*37.8:D*96,L=M(k.width,k.unit),$=M(k.height,k.unit);let I=ode(C,0,0);const H=8,Y=D=>Math.round(D/H)*H;let W=(L-I.width)/2,V=($-I.height)/2;const K=(D,U,z,B)=>k.elements.some(X=>{const Q=X.x+X.width,re=X.y+X.height,G=D+z,Z=U+B;return!(D>=Q||G<=X.x||U>=re||Z<=X.y)});if(K(W,V,I.width,I.height)){const D=H*2;let U=!1;for(let z=V;z<$-I.height&&!U;z+=D)for(let B=W;B=0&&!U;z-=D)for(let B=W;B>=0&&!U;B-=D)K(B,z,I.width,I.height)||(W=B,V=z,U=!0)}I={...I,x:Math.max(0,Y(W)),y:Math.max(0,Y(V))},A&&Object.keys(A).length>0&&(I.config={...I.config,...A});const F=Zue(O,k.elements),te=rF(E);return I={...I,type:I.type,typeAdd:cF(E,O),libraryCategory:IN(E,O),valueSourceType:te,elementName:F},T=I.id,{...k,elements:[...k.elements,I]}}),u(T)},[a.width,a.height,a.unit]),y=b.useCallback((C,A)=>{i(E=>({...E,elements:E.elements.map(O=>O.id===C?{...O,...A}:O)}))},[]),x=b.useCallback(C=>{i(A=>({...A,elements:A.elements.filter(E=>E.id!==C)})),u(null)},[]),w=b.useCallback(C=>{i(A=>({...A,...C}))},[]),j=b.useCallback(async()=>{try{const C=(a.id??"").trim();if(!C){me.error("Template code is required.",{description:"Please enter a template code (e.g. TPL_TEST_001)."});return}if(a.appliedLocation==="SPECIFIED"&&!(a.appliedLocationIds?.length??0)){me.error("Locations required.",{description:"When using specified locations, select at least one location."});return}if(a.elements.find(T=>!(T.elementName??"").trim())){me.error("Component name required.",{description:"Each element must have a non-empty element name."});return}if(a.elements.find(T=>{if(T.type!=="TEXT_STATIC")return!1;const k=T.config;return String(k?.inputType??"").toLowerCase()!=="options"?!1:!String(k?.multipleOptionId??k?.MultipleOptionId??"").trim()})){me.error("Option dictionary required.",{description:"Each Multiple Options element must have an Option dictionary selected in the properties panel."});return}const O={id:C,name:a.name,labelType:a.labelType,unit:a.unit,width:a.width,height:a.height,appliedLocation:a.appliedLocation,showRuler:a.showRuler,showGrid:a.showGrid??!0,state:!0,elements:aF(a.elements),appliedLocationIds:a.appliedLocation==="ALL"?[]:a.appliedLocationIds??[]};e?(await fF(C,O),me.success("Template updated.",{description:"The template has been updated successfully."})):(await xde(O),me.success("Template created.",{description:"The template has been created successfully."})),n(),r()}catch(C){me.error("Failed to save template.",{description:C?.message?String(C.message):"Please try again."})}},[a,e,n,r]),N=b.useCallback(()=>{const C={...a,elements:a.elements.map(T=>({...T,type:Jn(T.type),typeAdd:$N(T),elementName:(T.elementName??"").trim(),valueSourceType:sF(T),libraryCategory:pde(T),config:MN(T.config??{})}))},A=new Blob([JSON.stringify(C,null,2)],{type:"application/json"}),E=URL.createObjectURL(A),O=document.createElement("a");O.href=E,O.download=`label-template-${a.id}.json`,O.click(),URL.revokeObjectURL(E)},[a]);return o.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200 bg-white shrink-0",children:[o.jsxs(he,{variant:"outline",size:"sm",onClick:r,children:[o.jsx(AM,{className:"w-4 h-4 mr-1"}),"Back"]}),o.jsx("span",{className:"text-sm font-medium text-gray-700 truncate flex-1",children:a.name}),o.jsxs(he,{size:"sm",onClick:N,variant:"outline",children:[o.jsx(JS,{className:"w-4 h-4 mr-1"}),"Export JSON"]}),o.jsxs(he,{size:"sm",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:j,children:[o.jsx(L6,{className:"w-4 h-4 mr-1"}),"Save"]})]}),o.jsxs("div",{className:"flex flex-1 min-h-0",children:[o.jsx(Jde,{onAddElement:v}),o.jsx(Zfe,{template:a,selectedId:s,onSelect:u,onUpdateElement:y,onDeleteElement:x,onTemplateChange:w,scale:d,onZoomIn:()=>c(C=>Math.min(hhe,C+SM)),onZoomOut:()=>c(C=>Math.max(fhe,C-SM)),onPreview:()=>p(!0)}),o.jsx(xt,{open:f,onOpenChange:p,children:o.jsxs(gt,{className:"max-w-[90vw] max-h-[90vh] p-0 overflow-hidden flex flex-col",children:[o.jsx(bt,{className:"shrink-0 px-6 py-4 border-b bg-white",children:o.jsx(wt,{children:"Label preview"})}),o.jsx("div",{className:"flex-1 min-h-0 overflow-x-auto overflow-y-auto p-4 bg-gray-50",children:o.jsx("div",{className:"min-w-max",children:o.jsx(ehe,{template:a,maxWidth:0})})})]})}),o.jsx(she,{template:a,selectedElement:m,onTemplateChange:w,onElementChange:y,onDeleteElement:x,readOnlyTemplateCode:!!e})]})]})}function rw(e){const t=(e??"").trim();return t||"None"}function ghe(e,t){if(DN(e)==="ALL")return"All";const n=e.appliedLocationIds??[];if(n.length===0)return"Specified (0)";const a=n.map(i=>t.find(s=>s.id===i)?.locationName?.trim()||i);return a.length<=2?a.join(", "):`${a.slice(0,2).join(", ")} +${a.length-2}`}function vhe(e){const t=(e.templateName??e.name??"").trim();return t||"None"}function yhe(e){const t=(e.templateCode??e.id??"").trim();return t||"None"}function xhe(e,t){const r=(e.locationText??"").trim();return r||ghe(e,t)}function bhe(e){return typeof e.contentsCount=="number"?e.contentsCount:e.elements?.length??0}function whe(e){const t=(e.sizeText??"").trim();if(t)return t;const r=e.width,n=e.height,a=e.unit;return r!=null&&n!=null&&a?`${r}×${n} ${a}`:"None"}function She(){const[e,t]=b.useState([]),[r,n]=b.useState("list"),[a,i]=b.useState(null),[s,u]=b.useState(null),[d,c]=b.useState(!1),[f,p]=b.useState(0),[m,v]=b.useState(0),[y,x]=b.useState(null),[w,j]=b.useState(!1),[N,C]=b.useState(null),[A,E]=b.useState(""),[O,T]=b.useState("all"),[k,M]=b.useState("all"),[L,$]=b.useState("all"),[I,H]=b.useState(1),[Y,W]=b.useState(10),[V,K]=b.useState([]),F=b.useRef(null),te=b.useRef(null),[D,U]=b.useState("");b.useEffect(()=>(te.current&&window.clearTimeout(te.current),te.current=window.setTimeout(()=>U(A.trim()),300),()=>{te.current&&window.clearTimeout(te.current)}),[A]);const z=Math.max(1,Math.ceil(f/Y));b.useEffect(()=>{let Z=!1;return(async()=>{try{const ee=await bd({skipCount:1,maxResultCount:500});Z||K(ee.items??[])}catch{Z||K([])}})(),()=>{Z=!0}},[]),b.useEffect(()=>{H(1)},[D,O,k,L,Y]),b.useEffect(()=>r!=="list"?void 0:((async()=>{F.current?.abort();const ee=new AbortController;F.current=ee,c(!0);try{const ce=Ua(I),ve=await uF({skipCount:ce,maxResultCount:Y,keyword:D||void 0,locationId:O!=="all"?O:void 0,labelType:k!=="all"?k:void 0,state:L==="all"?void 0:L==="true"},ee.signal);t(ve.items??[]),p(ve.totalCount??0)}catch(ce){if(ce?.name==="AbortError")return;me.error("Failed to load label templates.",{description:ce?.message?String(ce.message):"Please try again."}),t([]),p(0)}finally{c(!1)}})(),()=>F.current?.abort()),[D,O,k,L,I,Y,m,r]);const B=()=>v(Z=>Z+1),X=()=>{i(null),u(null),n("editor")},Q=async Z=>{i(Z),c(!0);try{const ee=await dF(Z),ce={id:ee.id,name:(ee.name??ee.templateName??"").trim()||"Unnamed template",labelType:ee.labelType??"PRICE",unit:ee.unit??"cm",width:ee.width??6,height:ee.height??4,appliedLocation:DN(ee),appliedLocationIds:[...ee.appliedLocationIds??[]],showRuler:ee.showRuler??!0,showGrid:ee.showGrid??!0,elements:(ee.elements??[]).map((ve,ne)=>{const Ce=ve,pe=(Ce.elementName??"").trim();return{...Ce,elementName:pe||`element${ne+1}`}})};u(ce),n("editor")}catch(ee){me.error("Failed to load template.",{description:ee?.message?String(ee.message):"Please try again."})}finally{c(!1)}},re=()=>{n("list"),i(null),u(null)},G=Z=>{x(null),C(Z),j(!0)};return r==="editor"?o.jsx("div",{className:"h-[calc(100vh-8rem)] min-h-[500px] flex flex-col",children:o.jsx(mhe,{templateId:a,initialTemplate:s,onClose:re,onSaved:B})}):o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"pb-4",children:o.jsx("div",{className:"flex flex-col gap-4",children:o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ye,{placeholder:"Search",value:A,onChange:Z=>E(Z.target.value),style:{height:40,boxSizing:"border-box"},className:"bg-white border border-gray-300 rounded-md w-40 shrink-0 placeholder:text-gray-500"}),o.jsxs(Ve,{value:O,onValueChange:T,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Location"})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"all",children:"All Locations"}),V.map(Z=>o.jsx(je,{value:Z.id,children:rw(Z.locationName??Z.locationCode??Z.id)},Z.id))]})]}),o.jsxs(Ve,{value:k,onValueChange:M,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Label Type"})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"all",children:"All Types"}),o.jsx(je,{value:"PRICE",children:"PRICE"}),o.jsx(je,{value:"NUTRITION",children:"NUTRITION"}),o.jsx(je,{value:"SHIPPING",children:"SHIPPING"})]})]}),o.jsxs(Ve,{value:L,onValueChange:$,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"State"})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"all",children:"All States"}),o.jsx(je,{value:"true",children:"Active"}),o.jsx(je,{value:"false",children:"Inactive"})]})]}),o.jsx("div",{className:"flex-1"}),o.jsxs(he,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0",onClick:X,children:["New Label Template ",o.jsx(ln,{className:"ml-1 w-4 h-4"})]})]})})}),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:o.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:o.jsxs(Fr,{children:[o.jsx(Br,{children:o.jsxs(Be,{className:"bg-gray-50 hover:bg-gray-50",children:[o.jsx(xe,{className:"font-bold text-gray-900 w-[180px]",children:"Label Template"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[120px]",children:"Template Code"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[120px]",children:"Location"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[100px]",children:"Label Type"}),o.jsx(xe,{className:"font-bold text-gray-900",children:"Contents"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[150px]",children:"Size"}),o.jsx(xe,{className:"font-bold text-gray-900 text-center w-[100px]",children:"Actions"})]})}),o.jsx(zr,{children:d?o.jsx(Be,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):e.length===0?o.jsx(Be,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:'No templates yet. Click "New Label Template" to create one.'})}):e.map(Z=>o.jsxs(Be,{className:"hover:bg-gray-50",children:[o.jsx(fe,{className:"font-medium whitespace-nowrap overflow-hidden text-ellipsis max-w-[180px]",children:vhe(Z)}),o.jsx(fe,{className:"text-gray-600 whitespace-nowrap overflow-hidden text-ellipsis max-w-[140px]",children:yhe(Z)}),o.jsx(fe,{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[140px]",children:rw(xhe(Z,V))}),o.jsx(fe,{className:"whitespace-nowrap",children:rw(Z.labelType)}),o.jsxs(fe,{className:"text-sm text-gray-600 whitespace-nowrap",children:[bhe(Z)," element(s)"]}),o.jsx(fe,{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[160px]",children:whe(Z)}),o.jsx(fe,{className:"text-center",children:o.jsxs(ya,{open:y===Z.id,onOpenChange:ee=>x(ee?Z.id:null),children:[o.jsx(xa,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:o.jsx(pi,{className:"h-4 w-4 text-gray-500"})})}),o.jsxs(ba,{align:"end",className:"w-40 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>Q(Z.id),children:[o.jsx(Qh,{className:"w-4 h-4"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>G(Z),children:[o.jsx(Et,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},Z.id))})]})})}),o.jsx("div",{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[o.jsxs("div",{children:["Showing ",f===0?0:(I-1)*Y+1,"-",Math.min(I*Y,f)," of ",f]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String(Y),onValueChange:Z=>W(Number(Z)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(Z=>o.jsxs(je,{value:String(Z),children:[Z," / page"]},Z))})]}),o.jsx(bi,{className:"mx-0 w-auto justify-end",children:o.jsxs(wi,{children:[o.jsx(At,{children:o.jsx(Si,{href:"#",size:"default",onClick:Z=>{Z.preventDefault(),H(ee=>Math.max(1,ee-1))},"aria-disabled":I<=1,className:I<=1?"pointer-events-none opacity-50":""})}),o.jsx(At,{children:o.jsxs(wa,{href:"#",isActive:!0,size:"default",onClick:Z=>Z.preventDefault(),children:["Page ",I," / ",z]})}),o.jsx(At,{children:o.jsx(ji,{href:"#",size:"default",onClick:Z=>{Z.preventDefault(),H(ee=>Math.min(z,ee+1))},"aria-disabled":I>=z,className:I>=z?"pointer-events-none opacity-50":""})})]})})]})]})}),o.jsx(jhe,{open:w,template:N,onOpenChange:Z=>{j(Z),Z||C(null)},onDeleted:B})]})}function jhe({open:e,template:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>(t?.templateName??t?.name??"").trim()||(t?.templateCode??t?.id??"").trim()||"this template",[t]),u=async()=>{if(t?.id){i(!0);try{await bde(t.id),me.success("Label template deleted.",{description:"The label template has been removed successfully."}),r(!1),n()}catch(d){me.error("Failed to delete label template.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Delete Label Template"}),o.jsx(kt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(Nt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Et,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}function jM(e){const t=(e??"").trim();return t||"None"}function Nhe(){const[e,t]=b.useState(!1),[r,n]=b.useState(!1),[a,i]=b.useState(!1),[s,u]=b.useState(null),[d,c]=b.useState(null),[f,p]=b.useState([]),[m,v]=b.useState(!1),[y,x]=b.useState(0),[w,j]=b.useState(0),[N,C]=b.useState(null),[A,E]=b.useState(""),[O,T]=b.useState("all"),[k,M]=b.useState(1),[L,$]=b.useState(10),I=b.useRef(null),H=b.useRef(null),[Y,W]=b.useState("");b.useEffect(()=>(H.current&&window.clearTimeout(H.current),H.current=window.setTimeout(()=>W(A.trim()),300),()=>{H.current&&window.clearTimeout(H.current)}),[A]);const V=Math.max(1,Math.ceil(y/L));b.useEffect(()=>{M(1)},[Y,O,L]),b.useEffect(()=>((async()=>{I.current?.abort();const U=new AbortController;I.current=U,v(!0);try{const z=Ua(k),B=await BF({skipCount:z,maxResultCount:L,keyword:Y||void 0,state:O==="all"?void 0:O==="true"},U.signal);p(B.items??[]),x(B.totalCount??0)}catch(z){if(z?.name==="AbortError")return;me.error("Failed to load multiple options.",{description:z?.message?String(z.message):"Please try again."}),p([]),x(0)}finally{v(!1)}})(),()=>I.current?.abort()),[Y,O,k,L,w]);const K=()=>j(D=>D+1),F=D=>{C(null),u(D),n(!0)},te=D=>{C(null),c(D),i(!0)};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"pb-4",children:o.jsx("div",{className:"flex flex-col gap-4",children:o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ye,{placeholder:"Search",value:A,onChange:D=>E(D.target.value),style:{height:40,boxSizing:"border-box"},className:"bg-white border border-gray-300 rounded-md w-40 shrink-0 placeholder:text-gray-500"}),o.jsxs(Ve,{value:O,onValueChange:T,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"State"})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"all",children:"All States"}),o.jsx(je,{value:"true",children:"Active"}),o.jsx(je,{value:"false",children:"Inactive"})]})]}),o.jsx("div",{className:"flex-1"}),o.jsxs(he,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0",onClick:()=>t(!0),children:["New Multiple Options ",o.jsx(ln,{className:"ml-1 h-4 w-4"})]})]})})}),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:o.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:o.jsxs(Fr,{children:[o.jsx(Br,{children:o.jsxs(Be,{className:"bg-gray-50 hover:bg-gray-50",children:[o.jsx(xe,{className:"font-bold text-gray-900 w-[200px]",children:"Multiple Option Name"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[200px]",children:"Option Code"}),o.jsx(xe,{className:"font-bold text-gray-900",children:"Contents"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[100px]",children:"State"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[100px]",children:"Order"}),o.jsx(xe,{className:"font-bold text-gray-900 w-[180px]",children:"Last Edited"}),o.jsx(xe,{className:"font-bold text-gray-900 text-center w-[100px]",children:"Actions"})]})}),o.jsx(zr,{children:m?o.jsx(Be,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):f.length===0?o.jsx(Be,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):f.map(D=>o.jsxs(Be,{className:"hover:bg-gray-50",children:[o.jsx(fe,{className:"font-medium",children:jM(D.optionName)}),o.jsx(fe,{className:"text-gray-600",children:jM(D.optionCode)}),o.jsx(fe,{className:"text-gray-600",children:D.optionValuesJson&&D.optionValuesJson.length>0?D.optionValuesJson.join("; "):"None"}),o.jsx(fe,{children:o.jsx($r,{className:D.state?"bg-green-600":"bg-gray-400",children:D.state?"Active":"Inactive"})}),o.jsx(fe,{className:"font-numeric",children:D.orderNum??"None"}),o.jsx(fe,{className:"text-gray-500 tabular-nums font-numeric",children:D.creationTime?new Date(D.creationTime).toLocaleString():"None"}),o.jsx(fe,{className:"text-center",children:o.jsxs(ya,{open:N===D.id,onOpenChange:U=>C(U?D.id:null),children:[o.jsx(xa,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:o.jsx(pi,{className:"h-4 w-4 text-gray-500"})})}),o.jsxs(ba,{align:"end",className:"w-40 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>F(D),children:[o.jsx(Cn,{className:"w-4 h-4"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>te(D),children:[o.jsx(Et,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},D.id))})]})})}),o.jsx("div",{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[o.jsxs("div",{children:["Showing ",y===0?0:(k-1)*L+1,"-",Math.min(k*L,y)," of ",y]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String(L),onValueChange:D=>$(Number(D)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(D=>o.jsxs(je,{value:String(D),children:[D," / page"]},D))})]}),o.jsx(bi,{className:"mx-0 w-auto justify-end",children:o.jsxs(wi,{children:[o.jsx(At,{children:o.jsx(Si,{href:"#",size:"default",onClick:D=>{D.preventDefault(),M(U=>Math.max(1,U-1))},"aria-disabled":k<=1,className:k<=1?"pointer-events-none opacity-50":""})}),o.jsx(At,{children:o.jsxs(wa,{href:"#",isActive:!0,size:"default",onClick:D=>D.preventDefault(),children:["Page ",k," / ",V]})}),o.jsx(At,{children:o.jsx(ji,{href:"#",size:"default",onClick:D=>{D.preventDefault(),M(U=>Math.min(V,U+1))},"aria-disabled":k>=V,className:k>=V?"pointer-events-none opacity-50":""})})]})})]})]})}),o.jsx(_he,{open:e,onOpenChange:t,onCreated:()=>{M(1),K()}}),o.jsx(Che,{open:r,option:s,onOpenChange:D=>{n(D),D||u(null)},onUpdated:K}),o.jsx(Ehe,{open:a,option:d,onOpenChange:D=>{i(D),D||c(null)},onDeleted:K})]})}function _he({open:e,onOpenChange:t,onCreated:r}){const[n,a]=b.useState(!1),[i,s]=b.useState({optionCode:"",optionName:"",optionValuesJson:[],state:!0,orderNum:null}),[u,d]=b.useState(""),c=()=>{s({optionCode:"",optionName:"",optionValuesJson:[],state:!0,orderNum:null}),d("")};b.useEffect(()=>{e||c()},[e]);const f=()=>{const v=u.trim();if(v){if(i.optionValuesJson.includes(v)){me.error("Duplicate value",{description:"This value already exists."});return}s(y=>({...y,optionValuesJson:[...y.optionValuesJson,v]})),d("")}},p=v=>{s(y=>({...y,optionValuesJson:y.optionValuesJson.filter((x,w)=>w!==v)}))},m=async()=>{if(!i.optionCode.trim()||!i.optionName.trim()){me.error("Validation failed",{description:"Option Code and Option Name are required."});return}if(i.optionValuesJson.length===0){me.error("Validation failed",{description:"At least one option value is required."});return}if(i.orderNum===null||i.orderNum===void 0||!Number.isFinite(i.orderNum)){me.error("Validation failed",{description:"Order is required."});return}a(!0);try{await nhe(i),me.success("Multiple option created.",{description:"The multiple option has been created successfully."}),t(!1),r()}catch(v){me.error("Failed to create multiple option.",{description:v?.message?String(v.message):"Please try again."})}finally{a(!1)}};return o.jsx(xt,{open:e,onOpenChange:t,children:o.jsxs(gt,{className:"sm:max-w-[600px]",children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Add New Multiple Option"}),o.jsx(kt,{children:"Enter the details for the new multiple option."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Option Code *"}),o.jsx(ye,{placeholder:"e.g. OPT_ALLERGENS",value:i.optionCode,onChange:v=>s(y=>({...y,optionCode:v.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Option Name *"}),o.jsx(ye,{placeholder:"e.g. Allergens",value:i.optionName,onChange:v=>s(y=>({...y,optionName:v.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Option Values *"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ye,{placeholder:"Enter a value and press Add",value:u,onChange:v=>d(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),f())}}),o.jsx(he,{type:"button",onClick:f,variant:"outline",children:"Add"})]}),i.optionValuesJson.length>0&&o.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:i.optionValuesJson.map((v,y)=>o.jsxs($r,{variant:"secondary",className:"flex items-center gap-1",children:[v,o.jsx("button",{type:"button",onClick:()=>p(y),className:"ml-1 hover:text-red-600",children:o.jsx(no,{className:"h-3 w-3"})})]},y))})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Order *"}),o.jsx(ye,{type:"number",placeholder:"e.g. 1",value:i.orderNum??"",onChange:v=>s(y=>({...y,orderNum:v.target.value?Number(v.target.value):null}))})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Zt,{checked:i.state,onCheckedChange:v=>s(y=>({...y,state:v}))})]})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{disabled:n,onClick:m,children:n?"Creating...":"Create"})]})]})})}function Che({open:e,option:t,onOpenChange:r,onUpdated:n}){const[a,i]=b.useState(!1),[s,u]=b.useState({optionCode:"",optionName:"",optionValuesJson:[],state:!0,orderNum:null}),[d,c]=b.useState("");b.useEffect(()=>{e&&t&&(u({optionCode:t.optionCode??"",optionName:t.optionName??"",optionValuesJson:t.optionValuesJson??[],state:t.state??!0,orderNum:t.orderNum??null}),c(""))},[e,t]);const f=()=>{const v=d.trim();if(v){if(s.optionValuesJson.includes(v)){me.error("Duplicate value",{description:"This value already exists."});return}u(y=>({...y,optionValuesJson:[...y.optionValuesJson,v]})),c("")}},p=v=>{u(y=>({...y,optionValuesJson:y.optionValuesJson.filter((x,w)=>w!==v)}))},m=async()=>{if(t?.id){if(!s.optionCode.trim()||!s.optionName.trim()){me.error("Validation failed",{description:"Option Code and Option Name are required."});return}if(s.optionValuesJson.length===0){me.error("Validation failed",{description:"At least one option value is required."});return}if(s.orderNum===null||s.orderNum===void 0||!Number.isFinite(s.orderNum)){me.error("Validation failed",{description:"Order is required."});return}i(!0);try{await ahe(t.id,s),me.success("Multiple option updated.",{description:"The multiple option has been updated successfully."}),r(!1),n()}catch(v){me.error("Failed to update multiple option.",{description:v?.message?String(v.message):"Please try again."})}finally{i(!1)}}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-[600px]",children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Edit Multiple Option"}),o.jsx(kt,{children:"Update the multiple option details."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Option Code *"}),o.jsx(ye,{placeholder:"e.g. OPT_ALLERGENS",value:s.optionCode,onChange:v=>u(y=>({...y,optionCode:v.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Option Name *"}),o.jsx(ye,{placeholder:"e.g. Allergens",value:s.optionName,onChange:v=>u(y=>({...y,optionName:v.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Option Values *"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ye,{placeholder:"Enter a value and press Add",value:d,onChange:v=>c(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),f())}}),o.jsx(he,{type:"button",onClick:f,variant:"outline",children:"Add"})]}),s.optionValuesJson.length>0&&o.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:s.optionValuesJson.map((v,y)=>o.jsxs($r,{variant:"secondary",className:"flex items-center gap-1",children:[v,o.jsx("button",{type:"button",onClick:()=>p(y),className:"ml-1 hover:text-red-600",children:o.jsx(no,{className:"h-3 w-3"})})]},y))})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Order *"}),o.jsx(ye,{type:"number",placeholder:"e.g. 1",value:s.orderNum??"",onChange:v=>u(y=>({...y,orderNum:v.target.value?Number(v.target.value):null}))})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Zt,{checked:s.state,onCheckedChange:v=>u(y=>({...y,state:v}))})]})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{disabled:a,onClick:m,children:a?"Updating...":"Update"})]})]})})}function Ehe({open:e,option:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>(t?.optionName??"").trim()||t?.optionCode||"this option",[t]),u=async()=>{if(t?.id){i(!0);try{await ihe(t.id),me.success("Multiple option deleted.",{description:"The multiple option has been removed successfully."}),r(!1),n()}catch(d){me.error("Failed to delete multiple option.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Delete Multiple Option"}),o.jsx(kt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(Nt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Et,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}function Ohe({currentView:e="Labels",onViewChange:t}){const r=["Labels","Label Categories","Label Types","Label Templates","Multiple Options"],n=a=>{t&&t(a)};return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"w-full border-b border-gray-200",children:o.jsx("div",{className:"flex overflow-x-auto bg-white",children:r.map(a=>o.jsx("div",{onClick:()=>n(a),style:e===a?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:`px-4 py-2.5 text-sm font-medium whitespace-nowrap cursor-pointer transition-colors -mb-px ${e===a?"text-blue-600":"border-b-2 border-b-transparent text-gray-600 hover:text-gray-800"}`,children:a},a))})}),o.jsxs("div",{className:"min-h-[400px]",children:[e==="Labels"&&o.jsx($de,{}),e==="Label Categories"&&o.jsx(qde,{}),e==="Label Types"&&o.jsx(Wde,{}),e==="Label Templates"&&o.jsx(She,{}),e==="Multiple Options"&&o.jsx(Nhe,{}),!["Labels","Label Categories","Label Types","Label Templates","Multiple Options"].includes(e)&&o.jsxs("div",{className:"flex items-center justify-center h-64 text-gray-400",children:[e," content coming soon..."]})]})]})}function Phe(){const[e,t]=b.useState([{id:"1",name:"Pop",isOpen:!0,subcategories:[{id:"1-1",name:"2024",isOpen:!0,files:[{id:"f1",name:"uuuuu",date:"10/23/24, 12:21 AM",type:"image"},{id:"f2",name:"664EF167-DFCE-49C1-A417-DC09FEDF78D7.jpg",date:"11/24/25, 8:40 PM",type:"image"}]}]},{id:"2",name:"Training",isOpen:!0,subcategories:[{id:"2-1",name:"BOH",isOpen:!1,files:[]},{id:"2-2",name:"FOH",isOpen:!0,files:[]}]},{id:"3",name:"ww",isOpen:!1,subcategories:[]}]),r=a=>{t(i=>i.map(s=>s.id===a?{...s,isOpen:!s.isOpen}:s))},n=(a,i)=>{t(s=>s.map(u=>u.id!==a?u:{...u,subcategories:u.subcategories.map(d=>d.id===i?{...d,isOpen:!d.isOpen}:d)}))};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ye,{className:"bg-white border border-black rounded-md h-10 w-[150px]"}),o.jsx("span",{className:"text-sm text-black whitespace-nowrap",children:"Search"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Ve,{defaultValue:"all",children:[o.jsx(We,{className:"bg-white border border-black rounded-md h-10 w-[100px]",children:o.jsx(He,{placeholder:"Location"})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"all",children:"all"}),o.jsx(je,{value:"loc-a",children:"Location A"})]})]}),o.jsx("span",{className:"text-sm text-black whitespace-nowrap",children:"Location"})]})]}),o.jsxs("div",{className:"bg-gray-100 p-2 flex justify-between items-center border-b border-gray-200",children:[o.jsx("h1",{className:"text-xl font-medium text-gray-700",children:"Information"}),o.jsxs("div",{className:"flex items-center gap-4 text-gray-600",children:[o.jsx("div",{className:"flex items-center gap-1 bg-gray-700 text-white text-[10px] px-1 py-0.5 rounded-sm font-bold",children:"NEW"}),o.jsx(V6,{className:"h-5 w-5"}),o.jsx("span",{className:"font-medium",children:"55789"})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("button",{className:"w-full bg-[#2c7bb6] hover:bg-[#256b9e] text-white py-2 px-4 flex items-center gap-2 text-sm font-medium rounded-sm",children:[o.jsx(ln,{className:"h-4 w-4"}),"New Category",o.jsx(np,{className:"h-4 w-4 opacity-70"})]}),o.jsx("div",{className:"space-y-4",children:e.map(a=>o.jsxs("div",{className:"border border-gray-300 rounded-sm overflow-hidden",children:[o.jsxs("div",{className:"bg-gradient-to-b from-gray-50 to-gray-100 border-b border-gray-200 p-2 flex items-center justify-between",children:[o.jsxs("button",{onClick:()=>r(a.id),className:"flex items-center gap-2 text-gray-700 font-medium text-sm flex-1 text-left",children:[a.isOpen?o.jsx(ll,{className:"h-4 w-4 text-[#2c7bb6]"}):o.jsx(cl,{className:"h-4 w-4 text-[#2c7bb6]"}),a.name]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{className:"text-gray-400 hover:text-gray-600",children:o.jsx(Qh,{className:"h-4 w-4"})}),o.jsx("button",{className:"text-red-400 hover:text-red-600",children:o.jsx(no,{className:"h-4 w-4"})})]})]}),a.isOpen&&o.jsxs("div",{className:"p-2 space-y-3 bg-white",children:[o.jsxs("button",{className:"w-full bg-[#2c7bb6] hover:bg-[#256b9e] text-white py-2 px-4 flex items-center gap-2 text-sm font-medium rounded-sm",children:[o.jsx(ln,{className:"h-4 w-4"}),"New Subcategory",o.jsx(np,{className:"h-4 w-4 opacity-70"})]}),o.jsxs("div",{className:"space-y-3",children:[a.subcategories.map(i=>o.jsxs("div",{className:"border border-gray-200 rounded-sm",children:[o.jsxs("div",{className:"bg-white border-b border-gray-200 p-2 flex items-center justify-between",children:[o.jsxs("button",{onClick:()=>n(a.id,i.id),className:"flex items-center gap-2 text-gray-700 font-medium text-sm flex-1 text-left",children:[i.isOpen?o.jsx(ll,{className:"h-4 w-4 text-[#2c7bb6]"}):o.jsx(cl,{className:"h-4 w-4 text-[#2c7bb6]"}),i.name]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{className:"text-gray-400 hover:text-gray-600",children:o.jsx(Qh,{className:"h-4 w-4"})}),o.jsx("button",{className:"text-red-400 hover:text-red-600",children:o.jsx(no,{className:"h-4 w-4"})})]})]}),i.isOpen&&o.jsxs("div",{className:"p-3 bg-gray-50/50",children:[o.jsx("div",{className:"mb-2 text-xs font-bold text-gray-500 uppercase tracking-wide",children:"Files"}),o.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 justify-end",children:[o.jsx(he,{size:"sm",className:"h-8 bg-[#4CAF50] hover:bg-[#43a047] text-white text-xs border-none rounded-sm",children:"Upload Your Own File(s)"}),o.jsx(he,{size:"sm",className:"h-8 bg-[#4CAF50] hover:bg-[#43a047] text-white text-xs border-none rounded-sm",children:"Create A Custom File"}),o.jsx(he,{size:"sm",className:"h-8 bg-[#2c7bb6] hover:bg-[#256b9e] text-white text-xs border-none rounded-sm",children:"Edit File Permissions"}),o.jsxs(he,{size:"sm",className:"h-8 bg-[#2c7bb6] hover:bg-[#256b9e] text-white text-xs border-none rounded-sm gap-1",children:["Sort (A-Z) ",o.jsx(H8,{className:"h-3 w-3"})]})]}),o.jsx("div",{className:"space-y-1",children:i.files.length>0?i.files.map(s=>o.jsxs("div",{className:"flex items-center bg-gray-200/50 p-2 border border-gray-200 rounded-sm text-sm hover:bg-gray-200 transition-colors",children:[o.jsx("div",{className:"flex-shrink-0 mr-3",children:s.type==="image"?o.jsx(y6,{className:"h-5 w-5 text-[#2c7bb6]"}):o.jsx(ul,{className:"h-5 w-5 text-[#2c7bb6]"})}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("div",{className:"font-medium text-gray-700 truncate",children:s.name})}),o.jsx("div",{className:"text-xs text-gray-500 mr-4 whitespace-nowrap",children:s.date}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{className:"p-1 text-gray-400 hover:text-gray-600 bg-white border border-gray-300 rounded-sm",children:o.jsx(ul,{className:"h-3 w-3"})}),o.jsx("button",{className:"p-1 text-gray-400 hover:text-gray-600 bg-white border border-gray-300 rounded-sm",children:o.jsx(Qh,{className:"h-3 w-3"})}),o.jsx("button",{className:"p-1 text-red-400 hover:text-red-600 bg-white border border-gray-300 rounded-sm",children:o.jsx(no,{className:"h-3 w-3"})})]})]},s.id)):o.jsx("div",{className:"p-4 border-2 border-dashed border-gray-300 rounded-sm text-center text-gray-400 text-sm",children:"No files in this subcategory"})})]})]},i.id)),a.subcategories.length===0&&o.jsx("div",{className:"p-2 text-sm text-gray-400 italic",children:"No subcategories"})]})]})]},a.id))})]})]})}const Ahe=[{id:1,title:"Coffee - 2 hrs",subtitle:"1 min - Completes at 12:05 PM",totalTime:7200,remainingTime:0,status:"expired",icon:u6},{id:2,title:"Clean Tablet",subtitle:"1 hrs - Completes at 12:37 PM",totalTime:3600,remainingTime:237,status:"running",icon:G6},{id:3,title:"Replace Sanitizer Towels",subtitle:"1 hrs - Completes at 12:37 PM",totalTime:3600,remainingTime:238,status:"running",icon:Et},{id:4,title:"Take Out Trash",subtitle:"1 hrs - Completes at 01:03 PM",totalTime:3600,remainingTime:58,status:"running",icon:Et},{id:5,title:"Change Utensils",subtitle:"1 hrs - Completes at 01:03 PM",totalTime:3600,remainingTime:58,status:"running",icon:sq},{id:6,title:"Sanitize Surfaces",subtitle:"1 hrs - Completes at 02:00 PM",totalTime:3600,remainingTime:2157,status:"running",icon:Ay},{id:7,title:"Check Temperatures",subtitle:"1 hrs - Completes at 02:00 PM",totalTime:3600,remainingTime:2158,status:"running",icon:Ay},{id:8,title:"Ranch 4 hrs",subtitle:"4 hrs - Completes at 04:04 PM",totalTime:14400,remainingTime:2158,status:"running",icon:Ay}];function The({timer:e}){const t=(e.totalTime-e.remainingTime)/e.totalTime*100,r=e.remainingTime===0,n=a=>{if(a<=0)return"0s";const i=Math.floor(a/60),s=a%60;return`${i.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`};return o.jsxs("div",{className:"bg-gray-200 rounded-xl p-4 flex flex-col items-center relative shadow-sm h-[280px]",children:[o.jsxs("div",{className:"text-center mb-2",children:[o.jsx("h3",{className:"text-lg font-medium text-gray-800 leading-tight",children:e.title}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:e.subtitle})]}),o.jsxs("div",{className:"relative w-32 h-32 my-auto flex items-center justify-center",children:[o.jsxs("svg",{className:"w-full h-full transform -rotate-90",children:[o.jsx("circle",{cx:"64",cy:"64",r:"56",stroke:"white",strokeWidth:"12",fill:"transparent"}),o.jsx("circle",{cx:"64",cy:"64",r:"56",stroke:r?"#ef4444":"#3b82f6",strokeWidth:"12",fill:"transparent",strokeDasharray:351.86,strokeDashoffset:r?0:351.86*(t/100),className:"transition-all duration-1000 ease-linear"})]}),o.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[o.jsx("span",{className:Ee("text-3xl font-bold",r?"text-red-500":"text-gray-800"),children:r?"0s":n(e.remainingTime)}),o.jsx("span",{className:Ee("text-[10px] font-medium uppercase mt-1",r?"text-red-400":"text-gray-400"),children:"Remaining"})]})]}),o.jsxs("div",{className:"w-full flex justify-between items-end mt-2",children:[o.jsx(T6,{className:"w-5 h-5 text-blue-700 fill-current"}),o.jsx("div",{className:"flex flex-col items-center",children:o.jsx("div",{className:"w-10 h-10 rounded-full border-2 border-gray-300 flex items-center justify-center text-gray-400 mb-1",children:o.jsx(e.icon,{className:"w-5 h-5"})})}),o.jsx("div",{className:"flex flex-col items-end",children:o.jsx("span",{className:"text-xs text-blue-600 font-bold mb-2 cursor-pointer",children:"EDIT"})})]}),o.jsx("button",{className:"absolute bottom-12 right-4 bg-blue-600 rounded-full p-1 text-white hover:bg-blue-700 shadow-md",children:o.jsx(no,{className:"w-4 h-4"})})]})}function khe(){const[e,t]=b.useState(!0);return o.jsxs("div",{className:"h-full flex flex-col bg-gray-50 relative",children:[o.jsxs("div",{className:"bg-white border-b border-gray-200 px-4 py-3 flex items-center justify-between shadow-sm z-10",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("button",{className:"flex items-center text-blue-500 text-lg font-medium",children:[o.jsx(RM,{className:"w-6 h-6"}),"Back"]}),o.jsx(E6,{className:"w-6 h-6 text-gray-500"})]}),o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"bg-blue-600 p-1.5 rounded-md",children:o.jsx(X6,{className:"w-5 h-5 text-white"})}),o.jsx("h1",{className:"text-xl font-bold text-blue-900",children:"Timers"})]}),o.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 font-medium",children:[o.jsx("span",{children:"86016"}),o.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"})]})]}),o.jsxs("div",{className:"flex items-center gap-4 text-blue-500 font-medium",children:[o.jsx(aq,{className:"w-6 h-6 text-gray-400"}),o.jsxs("button",{className:"flex items-center gap-1",children:[o.jsx(ln,{className:"w-5 h-5"}),"Add Timer"]})]})]}),o.jsxs("div",{className:"bg-gray-700 text-white px-6 py-2 flex items-center justify-between",children:[o.jsx("div",{className:"flex-1"})," ",o.jsx("div",{className:"font-medium",children:"Today, December 15"}),o.jsxs("div",{className:"flex-1 flex justify-end items-center gap-4",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(g6,{className:"w-5 h-5 text-gray-300"}),o.jsx(S6,{className:"w-5 h-5 text-gray-500"})]}),o.jsx(B8,{className:"w-5 h-5 text-blue-400"})]})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Ahe.map(r=>o.jsx(The,{timer:r},r.id))})}),e&&o.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-[1px]",children:o.jsx("div",{className:"bg-black text-white rounded-xl shadow-2xl w-[600px] max-w-full overflow-hidden border border-gray-800",children:o.jsxs("div",{className:"p-8 text-center space-y-6",children:[o.jsx("h2",{className:"text-3xl font-medium text-blue-500",children:"Coffee - 2 hrs"}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx("p",{className:"text-2xl font-light",children:"Timer expired at 12:05 PM"}),o.jsx("p",{className:"text-2xl font-light",children:"Please discard the coffee"})]}),o.jsx("div",{className:"flex justify-end",children:o.jsx("span",{className:"bg-gray-200 text-black text-[10px] px-1 rounded-sm opacity-50",children:"TACT_Img_Timer-Notification@2x"})}),o.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-8",children:[o.jsx(he,{onClick:()=>t(!1),className:"bg-blue-700 hover:bg-blue-600 text-white h-14 text-xl font-medium rounded-lg",children:"Mute"}),o.jsx(he,{onClick:()=>t(!1),className:"bg-blue-600 hover:bg-blue-500 text-white h-14 text-xl font-medium rounded-lg",children:"Restart"}),o.jsx(he,{onClick:()=>t(!1),className:"bg-blue-800 hover:bg-blue-700 text-white h-14 text-xl font-medium rounded-lg",children:"Acknowledge"})]})]})})})]})}const Ad=un({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Td="/product-category";async function NM(e,t){return Ad.requestJson({path:Td,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,State:e.state},signal:t})}async function Rhe(e,t){return Ad.requestJson({path:`${Td}/${encodeURIComponent(e)}`,method:"GET",signal:t})}async function Ihe(e){return Ad.requestJson({path:Td,method:"POST",body:{categoryCode:e.categoryCode,categoryName:e.categoryName,categoryPhotoUrl:e.categoryPhotoUrl??null,state:e.state??!0,orderNum:e.orderNum??0}})}async function Mhe(e,t){return Ad.requestJson({path:`${Td}/${encodeURIComponent(e)}`,method:"PUT",body:{categoryCode:t.categoryCode,categoryName:t.categoryName,categoryPhotoUrl:t.categoryPhotoUrl??null,state:t.state??!0,orderNum:t.orderNum??0}})}async function Dhe(e){await Ad.requestJson({path:`${Td}/${encodeURIComponent(e)}`,method:"DELETE"})}const Lg=un({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),$g="/product-location";function Lhe(e){const t=e;return{id:t?.id??t?.Id,locationId:t?.locationId??t?.LocationId,productId:t?.productId??t?.ProductId}}async function $he(e,t){const r=await Lg.requestJson({path:$g,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,LocationId:e.locationId,ProductId:e.productId},signal:t});return{...r,items:(r.items??[]).map(n=>Lhe(n))}}async function qF(e,t){const r=await Lg.requestJson({path:`${$g}/${encodeURIComponent(e)}`,method:"GET",signal:t});return Array.isArray(r?.productIds)?r.productIds.map(String):Array.isArray(r?.items)?(r.items??[]).map(n=>n?.productId).filter(n=>typeof n=="string"&&n.length>0):[]}async function UF(e){return Lg.requestJson({path:$g,method:"POST",body:{locationId:e.locationId,productIds:e.productIds}})}async function Fhe(e,t){return Lg.requestJson({path:`${$g}/${encodeURIComponent(e)}`,method:"PUT",body:{productIds:t.productIds}})}function nn(e){const t=(e??"").trim();return t||"—"}async function Bhe(e){const t=new Map;try{const r=await $he({skipCount:1,maxResultCount:2e3},e);for(const n of r.items??[]){const a=(n.productId??"").trim(),i=(n.locationId??"").trim();if(!a||!i)continue;t.has(a)||t.set(a,[]);const s=t.get(a);s.includes(i)||s.push(i)}}catch{}return t}async function zhe(e,t,r){const n=[...new Set(r.filter(Boolean))];for(const a of n){if(a===t)continue;const i=await qF(a);i.includes(e)&&await Fhe(a,{productIds:i.filter(s=>s!==e)})}t.trim()&&await UF({locationId:t,productIds:[e]})}function qhe(){const[e,t]=b.useState("products"),[r,n]=b.useState([]),[a,i]=b.useState(0),[s,u]=b.useState(!1),[d,c]=b.useState(new Map),[f,p]=b.useState([]),[m,v]=b.useState([]),[y,x]=b.useState(0),[w,j]=b.useState([]),[N,C]=b.useState(0),[A,E]=b.useState(!1),[O,T]=b.useState(1),[k,M]=b.useState(10),[L,$]=b.useState(0),I=b.useRef(null),[H,Y]=b.useState(""),[W,V]=b.useState(""),K=b.useRef(null),[F,te]=b.useState("all"),[D,U]=b.useState("all"),[z,B]=b.useState("all"),[X,Q]=b.useState(1),[re,G]=b.useState(10),[Z,ee]=b.useState(0),ce=b.useRef(null),[ve,ne]=b.useState(!1),[Ce,pe]=b.useState(!1),[Pe,$e]=b.useState(null),[Fe,dt]=b.useState(null),[ct,St]=b.useState(null),[Ot,it]=b.useState(null),[Pt,Ut]=b.useState(null),[Ar,_r]=b.useState(null);b.useEffect(()=>(K.current&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>V(H.trim()),300),()=>{K.current&&window.clearTimeout(K.current)}),[H]),b.useEffect(()=>{let ie=!1;return(async()=>{try{const[ke,Xe]=await Promise.all([bd({skipCount:1,maxResultCount:500}),NM({skipCount:1,maxResultCount:500,sorting:"OrderNum desc"})]);if(ie)return;p(ke.items??[]),v(Xe.items??[])}catch{ie||(p([]),v([]))}})(),()=>{ie=!0}},[y]);const qr=()=>x(ie=>ie+1);b.useEffect(()=>{Q(1)},[W,F,D,z,re]),b.useEffect(()=>{T(1)},[W,z,k]);const Kt=F!=="all"||D!=="all";b.useEffect(()=>e!=="products"?void 0:((async()=>{ce.current?.abort();const ke=new AbortController;ce.current=ke,u(!0);try{const Xe=await Bhe(ke.signal);if(ke.signal.aborted)return;if(c(Xe),Kt){const Ht=await bm({skipCount:1,maxResultCount:500,keyword:W||void 0,state:z==="all"?void 0:z==="true"},ke.signal);if(ke.signal.aborted)return;let Bt=Ht.items??[];if(F!=="all"){const Ya=new Set(await qF(F));Bt=Bt.filter(et=>Ya.has(et.id))}D!=="all"&&(Bt=Bt.filter(Ya=>(Ya.categoryId??"").trim()===D));const _a=Bt.length;i(_a);const kn=(X-1)*re;n(Bt.slice(kn,kn+re))}else{const Ht=Ua(X),Bt=await bm({skipCount:Ht,maxResultCount:re,keyword:W||void 0,state:z==="all"?void 0:z==="true"},ke.signal);if(ke.signal.aborted)return;n(Bt.items??[]),i(Bt.totalCount??0)}}catch(Xe){if(Xe?.name==="AbortError")return;me.error("Failed to load products",{description:Xe?.message?String(Xe.message):"Please try again."}),n([]),i(0)}finally{ke.signal.aborted||u(!1)}})(),()=>ce.current?.abort()),[e,W,F,D,z,X,re,Z,Kt]);const _t=Math.max(1,Math.ceil(N/k)||1);b.useEffect(()=>{T(ie=>{const ke=Math.max(1,Math.ceil(N/k)||1);return ie>ke?ke:ie})},[N,k]),b.useEffect(()=>e!=="categories"?void 0:((async()=>{I.current?.abort();const ke=new AbortController;I.current=ke,E(!0);try{const Xe=Ua(O),Ht=await NM({skipCount:Xe,maxResultCount:k,sorting:"OrderNum desc",keyword:W||void 0,state:z==="all"?void 0:z==="true"},ke.signal);if(ke.signal.aborted)return;j(Ht.items??[]),C(Ht.totalCount??0)}catch(Xe){if(Xe?.name==="AbortError")return;me.error("Failed to load categories",{description:Xe?.message?String(Xe.message):"Please try again."}),j([]),C(0)}finally{ke.signal.aborted||E(!1)}})(),()=>I.current?.abort()),[e,W,z,O,k,L]);const Vt=()=>ee(ie=>ie+1),vr=()=>{$(ie=>ie+1),qr()},Ur=b.useMemo(()=>f.map(ie=>({value:ie.id,label:nn(ie.locationName??ie.locationCode??ie.id)})),[f]),Ka=b.useMemo(()=>m.map(ie=>({value:(ie.id??"").trim(),label:nn(ie.categoryName??ie.categoryCode??ie.id)})).filter(ie=>ie.value),[m]),Na=Math.max(1,Math.ceil(a/re)),Pi=b.useCallback(ie=>{const ke=f.find(Xe=>Xe.id===ie);return nn(ke?.locationName??ke?.locationCode??ie)},[f]);return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"pb-4",children:[o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[o.jsxs("div",{className:"flex items-center w-40 shrink-0 rounded-md border border-gray-300 bg-white overflow-hidden",style:{height:40},children:[o.jsx(jm,{className:"h-4 w-4 text-gray-400 shrink-0 ml-2.5 pointer-events-none"}),o.jsx(ye,{placeholder:"Search...",value:H,onChange:ie=>Y(ie.target.value),className:"flex-1 min-w-0 border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 py-2 px-2 h-full placeholder:text-gray-500"})]}),o.jsxs(Ve,{value:"all",disabled:!0,children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0 opacity-70",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Partner"})}),o.jsx(Ge,{children:o.jsx(je,{value:"all",children:"All partners"})})]}),o.jsxs(Ve,{value:"all",disabled:!0,children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0 opacity-70",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Group"})}),o.jsx(Ge,{children:o.jsx(je,{value:"all",children:"All groups"})})]}),o.jsxs(Ve,{value:F,onValueChange:te,children:[o.jsx(We,{className:"w-[160px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Location"})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"all",children:"All Locations"}),f.map(ie=>o.jsx(je,{value:ie.id,children:nn(ie.locationName??ie.locationCode??ie.id)},ie.id))]})]}),o.jsxs(Ve,{value:D,onValueChange:U,children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Category"})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"all",children:"All Categories"}),Ka.map(ie=>o.jsx(je,{value:ie.value,children:ie.label},ie.value))]})]}),o.jsxs(Ve,{value:z,onValueChange:B,children:[o.jsx(We,{className:"w-[120px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"State"})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"all",children:"All states"}),o.jsx(je,{value:"true",children:"Active"}),o.jsx(je,{value:"false",children:"Inactive"})]})]})]}),o.jsxs("div",{className:"flex flex-nowrap items-center justify-end gap-3 min-w-0 overflow-x-auto pb-0.5 [scrollbar-width:thin]",children:[o.jsxs(he,{variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 bg-white hover:bg-gray-50 gap-2 shrink-0",disabled:!0,children:[o.jsx(rq,{className:"w-4 h-4"})," Bulk Import"]}),o.jsxs(he,{variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 bg-white hover:bg-gray-50 gap-2 shrink-0",disabled:!0,children:[o.jsx(JS,{className:"w-4 h-4"})," Bulk Export"]}),o.jsxs(he,{variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 bg-white hover:bg-gray-50 gap-2 shrink-0",disabled:!0,children:[o.jsx(Cn,{className:"w-4 h-4"})," Bulk Edit"]}),e==="products"?o.jsxs(he,{className:"h-10 rounded-md bg-blue-600 text-white hover:bg-blue-700 font-medium gap-1 shrink-0",onClick:()=>{it(null),ne(!0)},children:["New Product ",o.jsx(ln,{className:"w-4 h-4"})]}):o.jsxs(he,{className:"h-10 rounded-md bg-blue-600 text-white hover:bg-blue-700 font-medium gap-1 shrink-0",onClick:()=>{$e(null),pe(!0)},children:["New Category ",o.jsx(ln,{className:"w-4 h-4"})]})]})]}),o.jsx("div",{className:"w-full border-b border-gray-200 mt-4",children:o.jsxs("div",{className:"flex overflow-x-auto w-fit",children:[o.jsx("button",{type:"button",onClick:()=>t("products"),style:e==="products"?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:`px-4 py-2.5 text-sm font-medium whitespace-nowrap cursor-pointer transition-colors -mb-px border-b-2 ${e==="products"?"text-blue-600":"border-b-transparent text-gray-600 hover:text-gray-800"}`,children:"Products"}),o.jsx("button",{type:"button",onClick:()=>t("categories"),style:e==="categories"?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:`px-4 py-2.5 text-sm font-medium whitespace-nowrap cursor-pointer transition-colors -mb-px border-b-2 ${e==="categories"?"text-blue-600":"border-b-transparent text-gray-600 hover:text-gray-800"}`,children:"Categories"})]})})]}),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:e==="products"?o.jsxs("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden",children:[o.jsxs(Fr,{children:[o.jsx(Br,{children:o.jsxs(Be,{className:"bg-gray-100 hover:bg-gray-100",children:[o.jsx(xe,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Location"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Product Category"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Product"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Product ID"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Product Code"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Status"}),o.jsx(xe,{className:"text-gray-900 font-bold text-center whitespace-nowrap",children:"Actions"})]})}),o.jsx(zr,{children:s?o.jsx(Be,{children:o.jsx(fe,{colSpan:7,className:"text-center text-gray-500 py-10",children:"Loading..."})}):r.length===0?o.jsx(Be,{children:o.jsx(fe,{colSpan:7,className:"text-center text-gray-500 py-10",children:"No products found."})}):r.map(ie=>{const ke=d.get(ie.id)??[],Xe=ke.length===0?"—":ke.map(Bt=>Pi(Bt)).join(", "),Ht=ie.state!==!1;return o.jsxs(Be,{children:[o.jsx(fe,{className:"border-r text-sm max-w-[200px] truncate",title:Xe,children:Xe}),o.jsx(fe,{className:"border-r text-gray-900 font-medium whitespace-nowrap",children:nn(ie.categoryName)}),o.jsx(fe,{className:"border-r text-gray-900 font-medium",children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[ie.productImageUrl?o.jsx("img",{src:Zu(ie.productImageUrl),alt:"",className:"w-8 h-8 rounded object-cover border border-gray-200 shrink-0"}):o.jsx(mu,{className:"w-4 h-4 text-gray-400 shrink-0"}),o.jsx("span",{className:"truncate",children:nn(ie.productName)})]})}),o.jsx(fe,{className:"border-r font-mono text-sm text-gray-600 whitespace-nowrap",children:ie.id}),o.jsx(fe,{className:"border-r font-mono text-sm text-gray-600 whitespace-nowrap",children:nn(ie.productCode)}),o.jsx(fe,{className:"border-r whitespace-nowrap",children:o.jsx($r,{variant:Ht?"default":"secondary",className:Ht?"bg-green-600":"bg-gray-400",children:Ht?"active":"inactive"})}),o.jsx(fe,{className:"text-center whitespace-nowrap",children:o.jsxs(ya,{open:Ar===ie.id,onOpenChange:Bt=>_r(Bt?ie.id:null),children:[o.jsx(xa,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",children:o.jsx(pi,{className:"h-4 w-4"})})}),o.jsxs(ba,{align:"end",className:"w-36 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start h-9 px-2 font-normal",onClick:async()=>{_r(null);try{const Bt=await wde(ie.id);it(Bt),ne(!0)}catch(Bt){me.error("Failed to load product",{description:Bt?.message?String(Bt.message):""})}},children:[o.jsx(Cn,{className:"w-4 h-4 mr-2"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>{_r(null),Ut(ie)},children:[o.jsx(Et,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},ie.id)})})]}),o.jsxs("div",{className:"flex items-center justify-between px-3 py-2 text-sm text-gray-600 border-t border-gray-100",children:[o.jsxs("span",{children:["Showing ",a===0?0:(X-1)*re+1,"-",Math.min(X*re,a)," of ",a]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Ve,{value:String(re),onValueChange:ie=>G(Number(ie)),children:[o.jsx(We,{className:"w-[100px] h-9",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(ie=>o.jsxs(je,{value:String(ie),children:[ie," / page"]},ie))})]}),o.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:X<=1,onClick:()=>Q(ie=>Math.max(1,ie-1)),children:"Prev"}),o.jsxs("span",{className:"text-xs tabular-nums",children:["Page ",X," / ",Na]}),o.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:X>=Na,onClick:()=>Q(ie=>Math.min(Na,ie+1)),children:"Next"})]})]})]}):o.jsxs("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden flex flex-col",children:[o.jsxs(Fr,{children:[o.jsx(Br,{children:o.jsxs(Be,{className:"bg-gray-100 hover:bg-gray-100",children:[o.jsx(xe,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Category Name"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Code"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Photo"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Order"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Status"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Last edited"}),o.jsx(xe,{className:"text-gray-900 font-bold text-center whitespace-nowrap w-[72px]",children:"Actions"})]})}),o.jsx(zr,{children:A?o.jsx(Be,{children:o.jsx(fe,{colSpan:7,className:"text-center text-gray-500 py-10",children:"Loading..."})}):w.length===0?o.jsx(Be,{children:o.jsx(fe,{colSpan:7,className:"text-center text-gray-500 py-10",children:"No categories found."})}):w.map(ie=>{const ke=ie.state!==!1;return o.jsxs(Be,{children:[o.jsx(fe,{className:"border-r font-medium text-gray-900",children:nn(ie.categoryName)}),o.jsx(fe,{className:"border-r text-gray-600 font-mono text-sm",children:nn(ie.categoryCode)}),o.jsx(fe,{className:"border-r",children:ie.categoryPhotoUrl?o.jsx("img",{src:Zu(ie.categoryPhotoUrl),alt:"",className:"w-9 h-9 rounded object-cover border border-gray-200"}):o.jsx("span",{className:"text-gray-400 text-sm",children:"—"})}),o.jsx(fe,{className:"border-r text-gray-700",children:ie.orderNum??"—"}),o.jsx(fe,{className:"border-r whitespace-nowrap",children:o.jsx($r,{variant:ke?"default":"secondary",className:ke?"bg-green-600":"bg-gray-400",children:ke?"active":"inactive"})}),o.jsx(fe,{className:"border-r text-gray-600 text-sm",children:nn(ie.lastEdited)}),o.jsx(fe,{className:"text-center whitespace-nowrap",children:o.jsxs(ya,{open:ct===ie.id,onOpenChange:Xe=>St(Xe?ie.id:null),children:[o.jsx(xa,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",children:o.jsx(pi,{className:"h-4 w-4"})})}),o.jsxs(ba,{align:"end",className:"w-36 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start h-9 px-2 font-normal",onClick:async()=>{St(null);try{const Xe=await Rhe(ie.id);$e(Xe),pe(!0)}catch(Xe){me.error("Failed to load category",{description:Xe?.message?String(Xe.message):""})}},children:[o.jsx(Cn,{className:"w-4 h-4 mr-2"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>{St(null),dt(ie)},children:[o.jsx(Et,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},ie.id)})})]}),o.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 bg-white flex flex-wrap items-center justify-between gap-3 shrink-0",children:[o.jsxs("div",{className:"text-sm text-gray-600",children:["Showing ",N===0?0:(O-1)*k+1,"-",Math.min(O*k,N)," of ",N]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String(k),onValueChange:ie=>M(Number(ie)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(ie=>o.jsxs(je,{value:String(ie),children:[ie," / page"]},ie))})]}),o.jsx(bi,{className:"mx-0 w-auto justify-end",children:o.jsxs(wi,{children:[o.jsx(At,{children:o.jsx(Si,{href:"#",size:"default",onClick:ie=>{ie.preventDefault(),T(ke=>Math.max(1,ke-1))},"aria-disabled":O<=1,className:O<=1?"pointer-events-none opacity-50":""})}),o.jsx(At,{children:o.jsxs(wa,{href:"#",isActive:!0,size:"default",onClick:ie=>ie.preventDefault(),children:["Page ",O," / ",_t]})}),o.jsx(At,{children:o.jsx(ji,{href:"#",size:"default",onClick:ie=>{ie.preventDefault(),T(ke=>Math.min(_t,ke+1))},"aria-disabled":O>=_t,className:O>=_t?"pointer-events-none opacity-50":""})})]})})]})]})]})}),o.jsx(Uhe,{open:ve,onOpenChange:ie=>{ne(ie),ie||it(null)},editing:Ot,locationOptions:Ur,categoryOptions:Ka,locationMap:d,onSaved:()=>{Vt(),ne(!1),it(null)}}),o.jsx(Vhe,{open:!!Pt,product:Pt,onOpenChange:ie=>{ie||Ut(null)},onDeleted:Vt}),o.jsx(Hhe,{open:Ce,category:Pe,onOpenChange:ie=>{pe(ie),ie||$e(null)},onSaved:()=>{vr(),pe(!1),$e(null)}}),o.jsx(Whe,{open:!!Fe,category:Fe,onOpenChange:ie=>{ie||dt(null)},onDeleted:vr})]})}function Uhe({open:e,onOpenChange:t,editing:r,locationOptions:n,categoryOptions:a,locationMap:i,onSaved:s}){const[u,d]=b.useState(!1),[c,f]=b.useState(""),[p,m]=b.useState(""),[v,y]=b.useState(""),[x,w]=b.useState(""),[j,N]=b.useState(!0),[C,A]=b.useState("");b.useEffect(()=>{if(e)if(r){f(r.productCode??""),m(r.productName??""),y((r.categoryId??"").trim()),w(r.productImageUrl??""),N(r.state!==!1);const O=i.get(r.id)??[];A(O[0]??"")}else f(""),m(""),y(""),w(""),N(!0),A("")},[e,r,i]);const E=async()=>{if(!c.trim()||!p.trim()){me.error("Validation",{description:"Product code and name are required."});return}if(!C.trim()){me.error("Validation",{description:"Select a store to bind this product."});return}const O={productCode:c.trim(),productName:p.trim(),categoryId:v.trim()||null,productImageUrl:x.trim()||null,state:j};d(!0);try{if(r){await jde(r.id,O);const T=i.get(r.id)??[];await zhe(r.id,C.trim(),T)}else{const T=await Sde(O);await UF({locationId:C.trim(),productIds:[T.id]})}me.success(r?"Product updated.":"Product created."),s()}catch(T){me.error(r?"Update failed":"Create failed",{description:T?.message?String(T.message):""})}finally{d(!1)}};return o.jsx(xt,{open:e,onOpenChange:t,children:o.jsxs(gt,{className:"w-[min(50%,calc(100vw-2rem))] max-w-none sm:max-w-none max-h-[90vh] overflow-y-auto",children:[o.jsxs(bt,{children:[o.jsx(wt,{children:r?"Edit Product":"Add New Product"}),o.jsx(kt,{children:r?"Update product and store binding.":"Create a product and bind it to a store."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Product code *"}),o.jsx(ye,{className:"h-10",value:c,onChange:O=>f(O.target.value),placeholder:"e.g. PRD_TEST_001"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Product name *"}),o.jsx(ye,{className:"h-10",value:p,onChange:O=>m(O.target.value),placeholder:"e.g. Chicken"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Category"}),o.jsx(Wn,{value:v,onValueChange:y,options:a,placeholder:"Select category (optional)",searchPlaceholder:"Search category…",emptyText:"No categories."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Product image"}),o.jsx(_d,{value:x,onChange:w,uploadSubDir:"product",oneImageOnly:!0,hint:"POST /api/app/picture/category/upload (subDir: product). JPG/PNG/WebP/GIF, max 5 MB."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Bind to store *"}),o.jsx(Wn,{value:C,onValueChange:A,options:n,placeholder:"Select location",searchPlaceholder:"Search location…",emptyText:"No locations."})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 h-10 bg-white",children:[o.jsx("span",{className:"text-sm font-medium",children:"Enabled"}),o.jsx(Zt,{checked:j,onCheckedChange:N})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{type:"button",disabled:u,onClick:E,className:"bg-blue-600 hover:bg-blue-700 text-white",children:u?"Saving…":r?"Save":"Create"})]})]})})}function Vhe({open:e,product:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=async()=>{if(t?.id){i(!0);try{await Nde(t.id),me.success("Product deleted."),r(!1),n()}catch(u){me.error("Delete failed",{description:u?.message?String(u.message):""})}finally{i(!1)}}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-md",children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Delete product"}),o.jsx(kt,{children:"This cannot be undone."})]}),o.jsxs("p",{className:"text-sm text-gray-700 py-2",children:["Delete ",o.jsx("span",{className:"font-medium",children:nn(t?.productName)})," (",nn(t?.productCode),")?"]}),o.jsxs(Nt,{children:[o.jsx(he,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{type:"button",variant:"destructive",className:"gap-2",disabled:a,onClick:s,children:[o.jsx(Et,{className:"h-4 w-4 shrink-0"}),a?"Deleting…":"Delete"]})]})]})})}function Hhe({open:e,category:t,onOpenChange:r,onSaved:n}){const a=!!t?.id,[i,s]=b.useState(!1),[u,d]=b.useState(""),[c,f]=b.useState(""),[p,m]=b.useState(""),[v,y]=b.useState("0"),[x,w]=b.useState(!0);b.useEffect(()=>{e&&(t?(d(t.categoryCode??""),f(t.categoryName??""),m(t.categoryPhotoUrl??""),y(t.orderNum===null||t.orderNum===void 0?"0":String(t.orderNum)),w(t.state!==!1)):(d(""),f(""),m(""),y("0"),w(!0)))},[e,t]);const j=async()=>{if(!u.trim()||!c.trim()){me.error("Validation",{description:"Category code and name are required."});return}const N=Number(v);if(!Number.isFinite(N)){me.error("Validation",{description:"Order must be a number."});return}const C={categoryCode:u.trim(),categoryName:c.trim(),categoryPhotoUrl:p.trim()||null,state:x,orderNum:N};s(!0);try{a&&t?.id?(await Mhe(t.id,C),me.success("Category updated.")):(await Ihe(C),me.success("Category created.")),n()}catch(A){me.error(a?"Update failed":"Create failed",{description:A?.message?String(A.message):""})}finally{s(!1)}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"w-[min(50%,calc(100vw-2rem))] max-w-none sm:max-w-none max-h-[90vh] overflow-y-auto",children:[o.jsxs(bt,{children:[o.jsx(wt,{children:a?"Edit Category":"New Category"}),o.jsx(kt,{children:a?"Update product category (API: /api/app/product-category).":"Create a product category."})]}),o.jsxs("div",{className:"grid gap-4 py-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Category code *"}),o.jsx(ye,{className:"h-10",value:u,onChange:N=>d(N.target.value),placeholder:"e.g. CAT_PREP"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Category name *"}),o.jsx(ye,{className:"h-10",value:c,onChange:N=>f(N.target.value),placeholder:"e.g. Prep"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Category photo"}),o.jsx(_d,{value:p,onChange:m,uploadSubDir:"category",oneImageOnly:!0,hint:"POST /api/app/picture/category/upload. Max 5 MB."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Order *"}),o.jsx(ye,{className:"h-10",type:"number",value:v,onChange:N=>y(N.target.value),placeholder:"0"})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 h-10 bg-white",children:[o.jsx("span",{className:"text-sm font-medium",children:"Enabled"}),o.jsx(Zt,{checked:x,onCheckedChange:w})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{type:"button",disabled:i,onClick:j,className:"bg-blue-600 hover:bg-blue-700 text-white",children:i?"Saving…":a?"Save":"Create"})]})]})})}function Whe({open:e,category:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=async()=>{if(t?.id){i(!0);try{await Dhe(t.id),me.success("Category deleted."),r(!1),n()}catch(u){me.error("Delete failed",{description:u?.message?String(u.message):""})}finally{i(!1)}}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-md",children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Delete category"}),o.jsx(kt,{children:"This cannot be undone."})]}),o.jsxs("p",{className:"text-sm text-gray-700 py-2",children:["Delete ",o.jsx("span",{className:"font-medium",children:nn(t?.categoryName)})," (",nn(t?.categoryCode),")?"]}),o.jsxs(Nt,{children:[o.jsx(he,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{type:"button",variant:"destructive",className:"gap-2",disabled:a,onClick:s,children:[o.jsx(Et,{className:"h-4 w-4 shrink-0"}),a?"Deleting…":"Delete"]})]})]})})}const kd=un({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Rd="/rbac-menu";function td(e){if(!e||typeof e!="object")return{id:""};const t=e;return{id:String(t.id??t.Id??""),orderNum:t.orderNum??t.OrderNum,state:t.state??t.State,menuName:t.menuName??t.MenuName,routerName:t.routerName??t.RouterName,menuType:t.menuType??t.MenuType,permissionCode:t.permissionCode??t.PermissionCode,parentId:t.parentId??t.ParentId,menuIcon:t.menuIcon??t.MenuIcon,routeUrl:t.routeUrl??t.RouteUrl,link:t.link??t.Link,isCache:t.isCache??t.IsCache,isShow:t.isShow??t.IsShow,remark:t.remark??t.Remark,component:t.component??t.Component,menuSource:t.menuSource??t.MenuSource,query:t.query??t.Query,concurrencyStamp:t.concurrencyStamp??t.ConcurrencyStamp}}function Ghe(e){if(Array.isArray(e))return{items:e.map(td),totalCount:e.length};const t=e,r=t.items??t.Items??[],n=typeof t.totalCount=="number"?t.totalCount:typeof t.TotalCount=="number"?t.TotalCount:r.length;return{items:r.map(td),totalCount:n}}async function VF(e,t){const r=await kd.requestJson({path:Rd,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword},signal:t});return Ghe(r)}function GS(e){const t=td(e),r=e,n=r?.children??r?.Children,a=Array.isArray(n)?n.map(GS):void 0;return{...t,children:a}}function Khe(e){if(Array.isArray(e))return e.map(GS);if(!e||typeof e!="object")return[];const t=e,r=t.items??t.Items??t.data??t.Data;return Array.isArray(r)?r.map(GS):[]}async function Yhe(e){const t=await kd.requestJson({path:`${Rd}/tree`,method:"GET",signal:e});return Khe(t)}async function Xhe(e){const t=new Map;let r=1;const n=500;for(;;){const i=(await VF({skipCount:r,maxResultCount:n},e)).items??[];for(const s of i)s.menuType!==0||!s.id||t.has(s.id)||t.set(s.id,s);if(i.length100))break}return Array.from(t.values()).sort((a,i)=>(a.orderNum??0)-(i.orderNum??0))}async function Jhe(e){const t=await kd.requestJson({path:Rd,method:"POST",body:e});return td(t)}async function Qhe(e,t){const r=await kd.requestJson({path:`${Rd}/${encodeURIComponent(e)}`,method:"PUT",body:t});return td(r)}async function Zhe(e){e.length&&await kd.requestJson({path:Rd,method:"DELETE",body:e})}async function epe(e){await Zhe([e])}const HF=un({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),WF="/rbac-role-menu";async function tpe(e){await HF.requestJson({path:`${WF}/set`,method:"POST",body:e})}async function rpe(e){await HF.requestJson({path:WF,method:"DELETE",body:e})}const npe=un({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),ape="/role";async function GF(e,t){return npe.requestJson({path:ape,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,RoleName:e.roleName,RoleCode:e.roleCode,State:e.state},signal:t})}const Fg=un({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Bg="/rbac-role";async function ipe(e){return Fg.requestJson({path:Bg,method:"POST",body:e})}async function ope(e,t){return Fg.requestJson({path:`${Bg}/${encodeURIComponent(e)}`,method:"PUT",body:t})}function spe(e){if(!e||typeof e!="object")return[];const t=e,r=Array.isArray(t.menuIds)?t.menuIds:Array.isArray(t.MenuIds)?t.MenuIds:void 0;if(r)return r.map(String);const n=t.data??t.Data;if(n&&typeof n=="object"){const i=n,s=Array.isArray(i.menuIds)?i.menuIds:Array.isArray(i.MenuIds)?i.MenuIds:void 0;if(s)return s.map(String)}const a=Array.isArray(t.roleMenus)?t.roleMenus:Array.isArray(t.RoleMenus)?t.RoleMenus:void 0;if(Array.isArray(a)){const i=[];for(const s of a){if(!s||typeof s!="object")continue;const u=s,d=u.menuId??u.MenuId??u.id??u.Id;d&&i.push(String(d))}return i}return[]}async function lpe(e){e.length&&await Fg.requestJson({path:Bg,method:"DELETE",body:e})}async function cpe(e){await lpe([e])}async function upe(e,t){const r=await Fg.requestJson({path:`${Bg}/${encodeURIComponent(e)}`,method:"GET",signal:t});return spe(r)}const Id=un({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Md="/team-member";function dpe(e){if(!Array.isArray(e))return[];const t=[];for(const r of e)if(r!=null){if(typeof r=="string"||typeof r=="number"){t.push(String(r));continue}if(typeof r=="object"){const n=r,a=n.id??n.Id??n.locationId??n.LocationId??n.location_id??n.locationID;a!=null&&t.push(String(a))}}return t}function fpe(e){if(!Array.isArray(e))return[];const t=[];for(const r of e)if(r!=null){if(typeof r=="string"||typeof r=="number"){t.push(String(r));continue}if(typeof r=="object"){const n=r,a=n.locationCode??n.LocationCode??n.code??n.Code??n.location_code??n.locationCodeId,i=n.locationName??n.LocationName??n.name??n.Name??n.location_name,s=n.id??n.Id??n.locationId??n.LocationId,u=a==null?"":String(a).trim(),d=i==null?"":String(i).trim(),c=s==null?"":String(s).trim();u&&d?t.push(`${u} - ${d}`):d?t.push(d):u?t.push(u):c&&t.push(c)}}return t}function zg(e){if(!e||typeof e!="object")return{id:""};const t=e,r=String(t.id??t.Id??t.userId??t.UserId??t.user_id??t.UserID??t.memberId??t.MemberId??""),n=t.fullName??t.FullName??t.name??t.Name,a=t.userName??t.UserName??t.username??t.UserName,i=t.email??t.Email,s=t.phone??t.Phone;let u=t.roleId??t.RoleId,d=t.roleName??t.RoleName??t.roleName??t.Role;const c=t.role??t.Role;if((!u||!d)&&c&&typeof c=="object"){const w=c;u=w.id??w.Id??w.roleId??w.RoleId??u,d=w.roleName??w.RoleName??w.name??w.Name??w.role??w.Role??d}const f=t.state??t.State,p=typeof f=="boolean"?f:f==="true"?!0:f==="false"?!1:void 0,m=t.locationIds??t.LocationIds??t.assignedLocationIds??t.AssignedLocationIds??t.location_id_list??t.LocationIdList;let v=dpe(m);const y=t.locations??t.Locations??t.assignedLocations??t.AssignedLocations??t.locationNames??t.LocationNames;let x=fpe(y);if(v.length===0&&Array.isArray(y)){const w=[];for(const j of y){if(typeof j!="object"||!j)continue;const N=j,C=N.id??N.Id??N.locationId??N.LocationId;C!=null&&w.push(String(C))}w.length&&(v=w)}return{id:r,fullName:n,userName:a,email:i,phone:s,roleId:u,roleName:d,locationIds:v,locations:x,state:p??(t.status?String(t.status).toLowerCase()==="active":void 0)}}async function hpe(e,t){const r=await Id.requestJson({path:Md,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Keyword:e.keyword},signal:t}),n=r.items??[];return{totalCount:r.totalCount??0,items:n.map(zg)}}async function ppe(e,t){const r=await Id.requestJson({path:`${Md}/${encodeURIComponent(e)}`,method:"GET",signal:t});return zg(r)}function KF(e){if(e==null||e==="")return null;const t=String(e).trim();return t?Number(t.replace(/\D/g,""))||0:null}function mpe(e){const t=e.phone!=null&&e.phone!==""?KF(String(e.phone)):null;return{fullName:e.fullName,userName:e.userName,password:e.password,email:e.email??null,phone:t,roleId:e.roleId,locationIds:e.locationIds,locations:e.locationIds,state:e.state}}function gpe(e){const t=e.phone!=null&&e.phone!==""?KF(String(e.phone)):null,r={fullName:e.fullName,userName:e.userName,email:e.email??null,phone:t,roleId:e.roleId,locationIds:e.locationIds,locations:e.locationIds,state:e.state};return e.password&&(r.password=e.password),r}async function vpe(e){const t=await Id.requestJson({path:Md,method:"POST",body:mpe(e)});return zg(t)}async function ype(e,t){const r=await Id.requestJson({path:`${Md}/${encodeURIComponent(e)}`,method:"PUT",body:gpe(t)});return zg(r)}async function xpe(e){await Id.requestJson({path:`${Md}/${encodeURIComponent(e)}`,method:"DELETE"})}const YF=[{id:"p1",name:"Global Foods Inc.",status:"active",contact:"admin@globalfoods.com",phone:"+1 (555) 100-2000"},{id:"p2",name:"Local Eateries Co.",status:"active",contact:"support@localeateries.com",phone:"+1 (555) 200-3000"}],bpe=[{id:"g1",name:"West Coast Region",partner:"Global Foods Inc.",status:"active"},{id:"g2",name:"East Coast Region",partner:"Global Foods Inc.",status:"inactive"}];function wpe(){const[e,t]=b.useState("Roles"),[r,n]=b.useState([]),[a,i]=b.useState(0),[s,u]=b.useState(!1),[d,c]=b.useState(0),[f,p]=b.useState(1),[m,v]=b.useState(10),y=Math.max(1,Math.ceil(a/m)),x=b.useRef(null),[w,j]=b.useState(""),N=b.useRef(null),[C,A]=b.useState(""),[E,O]=b.useState(YF),[T,k]=b.useState(bpe),[M,L]=b.useState([]),[$,I]=b.useState(!1),[H,Y]=b.useState(0),[W,V]=b.useState(0),[K,F]=b.useState(1),[te,D]=b.useState(10),U=Math.max(1,Math.ceil(H/te)),z=b.useRef(null),[B,X]=b.useState(""),Q=b.useRef(null),[re,G]=b.useState(""),[Z,ee]=b.useState(null),[ce,ve]=b.useState(!1),[ne,Ce]=b.useState(null),[pe,Pe]=b.useState(!1),[$e,Fe]=b.useState(null),[dt,ct]=b.useState(!1),[St,Ot]=b.useState(null),[it,Pt]=b.useState(!1),[Ut,Ar]=b.useState(null),[_r,qr]=b.useState(!1),[Kt,_t]=b.useState(!1),[Vt,vr]=b.useState(!1),Ur=()=>{alert(`Exporting ${e} list to PDF...`)};b.useEffect(()=>(N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>A(w.trim()),300),()=>{N.current&&window.clearTimeout(N.current)}),[w]),b.useEffect(()=>(Q.current&&window.clearTimeout(Q.current),Q.current=window.setTimeout(()=>G(B.trim()),300),()=>{Q.current&&window.clearTimeout(Q.current)}),[B]),b.useEffect(()=>{p(1)},[C,m]),b.useEffect(()=>{F(1)},[re,te]),b.useEffect(()=>e!=="Roles"?void 0:((async()=>{x.current?.abort();const ke=new AbortController;x.current=ke,u(!0);try{const Xe=await GF({skipCount:Math.max(1,f),maxResultCount:m,roleName:C||void 0},ke.signal);n(Xe.items??[]),i(Xe.totalCount??0)}catch(Xe){if(Xe?.name==="AbortError")return;me.error("Failed to load roles.",{description:Xe?.message?String(Xe.message):"Please try again."}),n([]),i(0)}finally{u(!1)}})(),()=>x.current?.abort()),[e,C,f,m,d]),b.useEffect(()=>e!=="Team Member"?void 0:((async()=>{z.current?.abort();const ke=new AbortController;z.current=ke,I(!0);try{const Xe=await hpe({skipCount:Math.max(1,K),maxResultCount:te,keyword:re||void 0},ke.signal);L(Xe.items??[]),Y(Xe.totalCount??0)}catch(Xe){if(Xe?.name==="AbortError")return;me.error("Failed to load team members.",{description:Xe?.message?String(Xe.message):"Please try again."}),L([]),Y(0)}finally{I(!1)}})(),()=>z.current?.abort()),[e,re,K,te,W]);const Ka=()=>{switch(e){case"Roles":Fe(null),Pe(!0);break;case"Partner":qr(!0);break;case"Group":_t(!0);break;case"Team Member":ee(null),vr(!0);break}},Na=()=>{const ie=e==="Team Member";return o.jsxs("div",{className:"flex flex-col gap-4 pb-4",children:[o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ye,{placeholder:"Search",value:e==="Roles"?w:e==="Team Member"?B:"",onChange:ke=>{e==="Roles"&&j(ke.target.value),e==="Team Member"&&X(ke.target.value)},style:{height:40,boxSizing:"border-box"},className:"border border-gray-300 rounded-md w-40 shrink-0 bg-white placeholder:text-gray-500"}),o.jsx("div",{className:"flex-1"}),ie&&o.jsxs(o.Fragment,{children:[o.jsx(he,{variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 px-4 bg-white hover:bg-gray-50 shrink-0",children:"Bulk Import"}),o.jsx(he,{variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 px-4 bg-white hover:bg-gray-50 shrink-0",children:"Bulk Edit"})]}),o.jsx(he,{variant:"outline",onClick:Ur,className:"h-10 border border-gray-300 rounded-md text-gray-900 px-4 bg-white hover:bg-gray-50 shrink-0",children:"Bulk Export (PDF)"}),o.jsx(he,{className:"h-10 bg-blue-600 hover:bg-blue-700 text-white rounded-md px-6 font-medium shrink-0",onClick:Ka,children:"New+"})]}),o.jsx("div",{className:"w-full border-b border-gray-200",children:o.jsx("div",{className:"flex overflow-x-auto w-fit",children:["Roles","Partner","Group","Team Member"].map(ke=>o.jsx("button",{onClick:()=>t(ke),style:e===ke?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:Ee("px-4 py-2.5 text-sm font-medium whitespace-nowrap cursor-pointer transition-colors -mb-px border-b-2",e===ke?"text-blue-600":"border-b-transparent text-gray-600 hover:text-gray-800"),children:ke},ke))})})]})},Pi=()=>{switch(e){case"Roles":return o.jsxs("div",{className:"flex flex-col",children:[o.jsxs(Fr,{children:[o.jsx(Br,{children:o.jsxs(Be,{className:"bg-gray-100",children:[o.jsx(xe,{className:"font-bold text-black border-r",children:"Role Name"}),o.jsx(xe,{className:"font-bold text-black border-r",children:"Role Code"}),o.jsx(xe,{className:"font-bold text-black border-r",children:"Status"}),o.jsx(xe,{className:"font-bold text-black border-r",children:"Order"}),o.jsx(xe,{className:"font-bold text-black text-center",children:"Actions"})]})}),o.jsx(zr,{children:r.length===0?o.jsx(Be,{children:o.jsx(fe,{colSpan:5,className:"text-center text-sm text-gray-500 py-10",children:s?"Loading...":"No data"})}):r.map(ie=>o.jsxs(Be,{children:[o.jsx(fe,{className:"font-medium border-r",children:ie.roleName??"N/A"}),o.jsx(fe,{className:"border-r text-gray-600",children:ie.roleCode??"N/A"}),o.jsx(fe,{className:"border-r",children:o.jsx($r,{className:ie.state?"bg-green-600":"bg-gray-400",children:ie.state?"Active":"Inactive"})}),o.jsx(fe,{className:"border-r text-gray-600",children:ie.orderNum??"N/A"}),o.jsxs(fe,{className:"text-center",children:[o.jsx(he,{variant:"ghost",size:"sm",onClick:()=>{Ot(ie),ct(!0)},title:"Menu Permissions",children:o.jsx(z6,{className:"w-4 h-4 text-blue-600"})}),o.jsx(he,{variant:"ghost",size:"sm",onClick:()=>{Fe(ie),Pe(!0)},children:o.jsx(Cn,{className:"w-4 h-4 text-gray-500"})}),o.jsx(he,{variant:"ghost",size:"sm",onClick:async()=>{Ar(ie),Pt(!0)},title:"Delete role",children:o.jsx(Et,{className:"w-4 h-4 text-red-600"})})]})]},ie.id))})]}),o.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 bg-white flex flex-wrap items-center justify-between gap-3",children:[o.jsxs("div",{className:"text-sm text-gray-600",children:["Showing ",a===0?0:(f-1)*m+1,"-",Math.min(f*m,a)," of ",a]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String(m),onValueChange:ie=>v(Number(ie)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(ie=>o.jsxs(je,{value:String(ie),children:[ie," / page"]},ie))})]}),o.jsx(bi,{className:"mx-0 w-auto justify-end",children:o.jsxs(wi,{children:[o.jsx(At,{children:o.jsx(Si,{href:"#",size:"default",onClick:ie=>{ie.preventDefault(),p(ke=>Math.max(1,ke-1))},"aria-disabled":f<=1,className:f<=1?"pointer-events-none opacity-50":""})}),o.jsx(At,{children:o.jsxs(wa,{href:"#",isActive:!0,size:"default",onClick:ie=>ie.preventDefault(),children:["Page ",f," / ",y]})}),o.jsx(At,{children:o.jsx(ji,{href:"#",size:"default",onClick:ie=>{ie.preventDefault(),p(ke=>Math.min(y,ke+1))},"aria-disabled":f>=y,className:f>=y?"pointer-events-none opacity-50":""})})]})})]})]})]});case"Partner":return o.jsxs(Fr,{children:[o.jsx(Br,{children:o.jsxs(Be,{className:"bg-gray-100",children:[o.jsx(xe,{className:"font-bold text-black border-r",children:"Partner Name"}),o.jsx(xe,{className:"font-bold text-black border-r",children:"Contact"}),o.jsx(xe,{className:"font-bold text-black border-r",children:"Phone"}),o.jsx(xe,{className:"font-bold text-black border-r",children:"Status"}),o.jsx(xe,{className:"font-bold text-black text-center",children:"Actions"})]})}),o.jsx(zr,{children:E.map(ie=>o.jsxs(Be,{children:[o.jsx(fe,{className:"font-medium border-r",children:ie.name}),o.jsx(fe,{className:"border-r",children:ie.contact}),o.jsx(fe,{className:"border-r text-gray-600",children:ie.phone}),o.jsx(fe,{className:"border-r",children:o.jsx($r,{className:ie.status==="active"?"bg-green-600":"bg-gray-400",children:ie.status})}),o.jsx(fe,{className:"text-center",children:o.jsx(he,{variant:"ghost",size:"sm",children:o.jsx(Cn,{className:"w-4 h-4 text-gray-500"})})})]},ie.id))})]});case"Group":return o.jsxs(Fr,{children:[o.jsx(Br,{children:o.jsxs(Be,{className:"bg-gray-100",children:[o.jsx(xe,{className:"font-bold text-black border-r",children:"Group Name"}),o.jsx(xe,{className:"font-bold text-black border-r",children:"Parent Partner"}),o.jsx(xe,{className:"font-bold text-black border-r",children:"Status"}),o.jsx(xe,{className:"font-bold text-black text-center",children:"Actions"})]})}),o.jsx(zr,{children:T.map(ie=>o.jsxs(Be,{children:[o.jsx(fe,{className:"font-medium border-r",children:ie.name}),o.jsx(fe,{className:"border-r",children:ie.partner}),o.jsx(fe,{className:"border-r",children:o.jsx($r,{className:ie.status==="active"?"bg-green-600":"bg-gray-400",children:ie.status})}),o.jsx(fe,{className:"text-center",children:o.jsx(he,{variant:"ghost",size:"sm",children:o.jsx(Cn,{className:"w-4 h-4 text-gray-500"})})})]},ie.id))})]});case"Team Member":return o.jsxs(o.Fragment,{children:[o.jsxs(Fr,{children:[o.jsx(Br,{children:o.jsxs(Be,{className:"bg-gray-100",children:[o.jsx(xe,{className:"font-bold text-black border-r",children:"Name"}),o.jsx(xe,{className:"font-bold text-black border-r",children:"Email"}),o.jsx(xe,{className:"font-bold text-black border-r",children:"Phone"}),o.jsx(xe,{className:"font-bold text-black border-r",children:"Role"}),o.jsx(xe,{className:"font-bold text-black border-r",children:"Assigned Locations"}),o.jsx(xe,{className:"font-bold text-black border-r",children:"Status"}),o.jsx(xe,{className:"font-bold text-black text-center",children:"Actions"})]})}),o.jsx(zr,{children:$?o.jsx(Be,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):M.length===0?o.jsx(Be,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):M.map(ie=>o.jsxs(Be,{children:[o.jsx(fe,{className:"font-medium border-r",children:ie.fullName??ie.userName??"N/A"}),o.jsx(fe,{className:"border-r text-gray-600",children:ie.email??"N/A"}),o.jsx(fe,{className:"border-r text-gray-600",children:ie.phone??"N/A"}),o.jsx(fe,{className:"border-r",children:o.jsx($r,{variant:"outline",className:"font-normal",children:ie.roleName??ie.roleId??"N/A"})}),o.jsx(fe,{className:"border-r",children:o.jsxs("div",{className:"flex flex-col gap-1",children:[(ie.locations?.length?ie.locations:ie.locationIds??[]).map(ke=>o.jsxs("div",{className:"flex items-center gap-1 text-xs text-gray-600",children:[o.jsx(ql,{className:"w-3 h-3"})," ",ke]},ke)),!ie.locations?.length&&!(ie.locationIds?.length??0)&&o.jsx("div",{className:"text-xs text-gray-500",children:"None"})]})}),o.jsx(fe,{className:"border-r",children:o.jsx($r,{className:ie.state?"bg-green-600":"bg-gray-400",children:ie.state?"Active":"Inactive"})}),o.jsx(fe,{className:"text-center",children:o.jsxs("div",{className:"flex items-center justify-center gap-2",children:[o.jsx(he,{variant:"ghost",size:"sm",onClick:()=>{ee(ie),vr(!0)},title:"Edit",children:o.jsx(Cn,{className:"w-4 h-4 text-gray-500"})}),o.jsx(he,{variant:"ghost",size:"sm",onClick:()=>{Ce(ie),ve(!0)},title:"Delete",children:o.jsx(Et,{className:"w-4 h-4 text-red-600"})})]})})]},ie.id))})]}),o.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 bg-white flex flex-wrap items-center justify-between gap-3",children:[o.jsxs("div",{className:"text-sm text-gray-600",children:["Showing ",H===0?0:(K-1)*te+1,"-",Math.min(K*te,H)," of ",H]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String(te),onValueChange:ie=>D(Number(ie)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(ie=>o.jsxs(je,{value:String(ie),children:[ie," / page"]},ie))})]}),o.jsx(bi,{className:"mx-0 w-auto justify-end",children:o.jsxs(wi,{children:[o.jsx(At,{children:o.jsx(Si,{href:"#",size:"default",onClick:ie=>{ie.preventDefault(),F(ke=>Math.max(1,ke-1))},"aria-disabled":K<=1,className:K<=1?"pointer-events-none opacity-50":""})}),o.jsx(At,{children:o.jsxs(wa,{href:"#",isActive:!0,size:"default",onClick:ie=>ie.preventDefault(),children:["Page ",K," / ",U]})}),o.jsx(At,{children:o.jsx(ji,{href:"#",size:"default",onClick:ie=>{ie.preventDefault(),F(ke=>Math.min(U,ke+1))},"aria-disabled":K>=U,className:K>=U?"pointer-events-none opacity-50":""})})]})})]})]})]})}};return o.jsxs("div",{className:"h-full flex flex-col",children:[Na(),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:o.jsx("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md",children:Pi()})}),o.jsx(Spe,{open:pe,role:$e,onOpenChange:ie=>{Pe(ie),ie||Fe(null)},onSaved:()=>{p(1),c(ie=>ie+1)}}),o.jsx(jpe,{open:dt,role:St,onOpenChange:ie=>{ct(ie),ie||Ot(null)}}),o.jsx(Npe,{open:it,role:Ut,onOpenChange:ie=>{Pt(ie),ie||Ar(null)},onDeleted:()=>c(ie=>ie+1)}),o.jsx(_pe,{open:_r,onOpenChange:qr}),o.jsx(Cpe,{open:Kt,onOpenChange:_t}),o.jsx(Epe,{open:Vt,member:Z,onOpenChange:ie=>{vr(ie),ie||ee(null)},onSaved:()=>{F(1),V(ie=>ie+1)}}),o.jsx(Ope,{open:ce,member:ne,onOpenChange:ie=>{ve(ie),ie||Ce(null)},onDeleted:()=>{V(ie=>ie+1)}})]})}function Spe({open:e,role:t,onOpenChange:r,onSaved:n}){const a=!!t?.id,[i,s]=b.useState(!1),[u,d]=b.useState(""),[c,f]=b.useState(""),[p,m]=b.useState(""),[v,y]=b.useState(""),[x,w]=b.useState(!0);b.useEffect(()=>{e&&(s(!1),d(t?.roleName??""),f(t?.roleCode??""),m(t?.remark??""),y(t?.orderNum===null||t?.orderNum===void 0?"":String(t.orderNum)),w(t?.state??!0))},[e,t]);const j=b.useMemo(()=>!!(u.trim()&&c.trim()&&v.trim()),[u,c,v]),N=A=>{const E=A.trim();if(!E)return null;const O=Number.parseInt(E,10);return Number.isFinite(O)?O:null},C=async()=>{if(console.log("submit",t),!j){me.error("Please fill in required fields.",{description:"Role Name, Role Code, and Order are required."});return}s(!0);try{const A={roleName:u.trim(),roleCode:c.trim(),remark:p.trim()?p.trim():null,state:!!x,orderNum:N(v)};a&&t?.id?(await ope(t.id,A),me.success("Role updated.",{description:"Role fields have been saved successfully."})):(await ipe(A),me.success("Role created.",{description:"A new role has been created successfully."})),r(!1),n()}catch(A){me.error(a?"Failed to update role.":"Failed to create role.",{description:A?.message?String(A.message):"Please try again."})}finally{s(!1)}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-[600px]",children:[o.jsxs(bt,{children:[o.jsx(wt,{children:a?"Edit Role":"Create Role"}),o.jsx(kt,{children:a?"Update role fields and save changes.":"Fill out the form to create a new role."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Role Name *"}),o.jsx(ye,{value:u,onChange:A=>d(A.target.value),placeholder:"e.g. Inventory Specialist"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Role Code *"}),o.jsx(ye,{value:c,onChange:A=>f(A.target.value),placeholder:"e.g. inventory_specialist"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Remark"}),o.jsx(ye,{value:p,onChange:A=>m(A.target.value),placeholder:"Optional"})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Order *"}),o.jsx(ye,{value:v,onChange:A=>y(A.target.value),placeholder:"e.g. 10"})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Zt,{checked:x,onCheckedChange:w})]})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{disabled:i,onClick:C,className:"bg-blue-600 text-white hover:bg-blue-700",children:i?"Saving...":"Save"})]})]})})}function jpe({open:e,role:t,onOpenChange:r}){const n=t?.id??"",a=t?.roleName??"",[i,s]=b.useState(!1),[u,d]=b.useState([]),[c,f]=b.useState(new Set),[p,m]=b.useState(new Set),[v,y]=b.useState(!1),x=b.useRef(null),[w,j]=b.useState(""),N=b.useRef(null),[C,A]=b.useState("");b.useEffect(()=>(N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>A(w.trim()),300),()=>{N.current&&window.clearTimeout(N.current)}),[w]),b.useEffect(()=>e?(s(!1),m(new Set),f(new Set),(async()=>{x.current?.abort();const V=new AbortController;x.current=V,y(!0);try{const K=await Yhe(V.signal);if(d(K??[]),n){const F=await upe(n,V.signal);m(new Set(F))}}catch(K){if(K?.name==="AbortError")return;me.error("Failed to load menus.",{description:K?.message?String(K.message):"Please try again."}),d([]),m(new Set)}finally{y(!1)}})(),()=>x.current?.abort()):void 0,[e,n]);const E=b.useMemo(()=>{const W=V=>V.reduce((K,F)=>K+1+(F.children?W(F.children):0),0);return W(u)},[u]),O=b.useMemo(()=>{const W=C.trim().toLowerCase();if(!W)return u;const V=F=>{const te=(F.menuName??"").toLowerCase(),D=(F.routeUrl??"").toLowerCase();return te.includes(W)||D.includes(W)},K=F=>{const te=[];for(const D of F){const U=D.children?K(D.children):[];(V(D)||U.length)&&te.push({...D,children:U.length?U:void 0})}return te};return K(u)},[u,C]);b.useEffect(()=>{if(!C.trim())return;const V=new Set,K=F=>{for(const te of F)te.children?.length&&V.add(te.id),te.children?.length&&K(te.children)};K(O),f(V)},[C,O]);const T=W=>{const V=[],K=F=>{F.id&&V.push(F.id),F.children?.length&&F.children.forEach(K)};return K(W),V},k=W=>{const V=T(W);if(!V.length)return{checked:!1,indeterminate:!1};let K=0;for(const F of V)p.has(F)&&(K+=1);return K===0?{checked:!1,indeterminate:!1}:K===V.length?{checked:!0,indeterminate:!1}:{checked:!1,indeterminate:!0}},M=(W,V)=>{m(K=>{const F=new Set(K),te=T(W);return V?te.forEach(D=>F.add(D)):te.forEach(D=>F.delete(D)),F})},L=W=>{f(V=>{const K=new Set(V);return K.has(W)?K.delete(W):K.add(W),K})},$=W=>{const V=C.trim(),K=W??"";if(!V)return K||"N/A";const F=K.toLowerCase().indexOf(V.toLowerCase());if(F<0)return K||"N/A";const te=K.slice(0,F),D=K.slice(F,F+V.length),U=K.slice(F+V.length);return o.jsxs("span",{children:[te,o.jsx("span",{className:"bg-yellow-200 rounded px-0.5",children:D}),U]})},I=({node:W,depth:V})=>{const K=!!W.children?.length,F=c.has(W.id),{checked:te,indeterminate:D}=k(W);return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2 py-1",style:{paddingLeft:V*16},children:[o.jsx("button",{type:"button",className:Ee("h-6 w-6 flex items-center justify-center rounded hover:bg-gray-100",!K&&"opacity-0 pointer-events-none"),onClick:()=>K&&L(W.id),"aria-label":K?F?"Collapse":"Expand":"No children",children:K?F?o.jsx(ll,{className:"h-4 w-4"}):o.jsx(cl,{className:"h-4 w-4"}):null}),o.jsx(Qu,{id:`perm-menu-${W.id}`,checked:D?"indeterminate":te,onCheckedChange:U=>M(W,!!U)}),o.jsx("label",{htmlFor:`perm-menu-${W.id}`,className:"text-sm leading-none cursor-pointer select-none",children:$(W.menuName??W.routeUrl??W.id)})]}),K&&F&&o.jsx("div",{children:W.children.map(U=>o.jsx(I,{node:U,depth:V+1},U.id))})]})},H=async()=>{if(console.log("submit",t),!!n){s(!0);try{await tpe({roleId:n,menuIds:Array.from(p)}),me.success("Role menu permissions saved.",{description:"Menu permissions have been updated successfully."}),r(!1)}catch(W){me.error("Failed to save menu permissions.",{description:W?.message?String(W.message):"Please try again."})}finally{s(!1)}}},Y=async()=>{if(!(!n||p.size===0)){s(!0);try{await rpe({roleId:n,menuIds:Array.from(p)}),m(new Set),me.success("Role menu permissions cleared.",{description:"Selected permissions have been removed."})}catch(W){me.error("Failed to delete menu permissions.",{description:W?.message?String(W.message):"Please try again."})}finally{s(!1)}}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-none",style:{width:"50%"},children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Menu Permissions"}),o.jsx(kt,{children:a?`Set menu permissions for role: ${a}`:"Set menu permissions for this role."})]}),o.jsx("div",{className:"space-y-4 py-4",children:o.jsxs("div",{className:"rounded border border-gray-200 bg-white",children:[o.jsx("div",{className:"px-3 py-2 text-xs text-gray-500 border-b border-gray-200",children:o.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[o.jsx("div",{children:v?"Loading menus...":`Total ${E} menus`}),o.jsx(ye,{value:w,onChange:W=>j(W.target.value),placeholder:"Search menus",className:"h-8 w-44 bg-white"})]})}),o.jsx(fl,{className:"h-72",children:o.jsxs("div",{className:"p-3 space-y-2",children:[O.map(W=>o.jsx(I,{node:W,depth:0},W.id)),!v&&O.length===0&&o.jsx("div",{className:"text-sm text-gray-500 py-6 text-center",children:"No menus."})]})})]})}),o.jsxs(Nt,{className:"flex flex-row justify-end gap-2",children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{variant:"destructive",className:"gap-2",disabled:i||p.size===0||!n,onClick:Y,children:[o.jsx(Et,{className:"h-4 w-4 shrink-0"}),"Delete Selected"]}),o.jsx(he,{disabled:i||!n,onClick:H,className:"bg-blue-600 text-white hover:bg-blue-700",children:i?"Saving...":"Save"})]})]})})}function Npe({open:e,role:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>(t?.roleName??"").trim()||t?.roleCode||t?.id||"this role",[t]),u=async()=>{if(console.log("submit",t),!!t?.id){i(!0);try{await cpe(t.id),me.success("Role deleted.",{description:"The role has been removed successfully."}),r(!1),n()}catch(d){me.error("Failed to delete role.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Delete Role"}),o.jsx(kt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(Nt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Et,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}function _pe({open:e,onOpenChange:t}){return o.jsx(xt,{open:e,onOpenChange:t,children:o.jsxs(gt,{children:[o.jsx(bt,{children:o.jsx(wt,{children:"Create New Partner"})}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Partner Name"}),o.jsx(ye,{placeholder:"Company Name"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Contact Email"}),o.jsx(ye,{placeholder:"admin@partner.com"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Phone Number"}),o.jsx(ye,{type:"tel",placeholder:"+1 (555) 000-0000"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Zt,{id:"partner-status",defaultChecked:!0}),o.jsx(de,{htmlFor:"partner-status",children:"Active"})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{onClick:()=>t(!1),className:"bg-blue-600 text-white hover:bg-blue-700",children:"Save Partner"})]})]})})}function Cpe({open:e,onOpenChange:t}){return o.jsx(xt,{open:e,onOpenChange:t,children:o.jsxs(gt,{children:[o.jsx(bt,{children:o.jsx(wt,{children:"Create New Group"})}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Group Name"}),o.jsx(ye,{placeholder:"e.g. West Coast Region"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Assign to Partner"}),o.jsxs(Ve,{children:[o.jsx(We,{children:o.jsx(He,{placeholder:"Select Partner"})}),o.jsx(Ge,{children:YF.map(r=>o.jsx(je,{value:r.id,children:r.name},r.id))})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Zt,{id:"group-status",defaultChecked:!0}),o.jsx(de,{htmlFor:"group-status",children:"Active"})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{onClick:()=>t(!1),className:"bg-blue-600 text-white hover:bg-blue-700",children:"Save Group"})]})]})})}function Epe({open:e,member:t,onOpenChange:r,onSaved:n}){const a=!!t?.id,[i,s]=b.useState(!1),[u,d]=b.useState(""),[c,f]=b.useState(""),[p,m]=b.useState(""),[v,y]=b.useState(""),[x,w]=b.useState(""),[j,N]=b.useState(""),[C,A]=b.useState(!0),[E,O]=b.useState(new Set),[T,k]=b.useState([]),[M,L]=b.useState(!1),[$,I]=b.useState([]),[H,Y]=b.useState(!1),[W,V]=b.useState(""),K=b.useRef(null),F=()=>{d(""),f(""),m(""),y(""),w(""),N(""),A(!0),O(new Set)},te=async re=>{const G=[];let Z=1;const ee=100;for(;;){const ve=await GF({skipCount:Z,maxResultCount:ee},re);if(G.push(...ve.items??[]),!ve.items||ve.items.length200))break}const ce=new Map;for(const ve of G)ve.id&&!ce.has(ve.id)&&ce.set(ve.id,ve);return Array.from(ce.values())},D=async re=>{const G=[];let Z=1;const ee=200;for(;;){const ve=await bd({skipCount:Z,maxResultCount:ee},re);if(G.push(...ve.items??[]),!ve.items||ve.items.length200))break}const ce=new Map;for(const ve of G)ve.id&&!ce.has(ve.id)&&ce.set(ve.id,ve);return Array.from(ce.values())};b.useEffect(()=>{if(!e)return;K.current?.abort();const re=new AbortController;return K.current=re,s(!1),F(),L(!0),Y(!0),(async()=>{try{const[Z,ee]=await Promise.all([te(re.signal),D(re.signal)]);if(k(Z),I(ee),t?.id){const ce=await ppe(t.id,re.signal);d(ce.fullName??""),f(ce.userName??""),y(ce.email??""),w(ce.phone!=null?String(ce.phone):"");let ve=(ce.roleId??"").toString().trim();if(!ve&&ce.roleName){const Ce=String(ce.roleName).trim().toLowerCase(),pe=Z.find(Pe=>{const $e=String(Pe.roleName??"").trim().toLowerCase(),Fe=String(Pe.roleCode??"").trim().toLowerCase(),dt=String(Pe.id??"").trim().toLowerCase();return $e===Ce||Fe===Ce||dt===Ce});pe?.id&&(ve=pe.id)}N(ve),A(!!ce.state);const ne=ce.locationIds&&ce.locationIds.length?ce.locationIds:[];if(ne.length)O(new Set(ne));else if(ce.locations?.length){const Ce=new Set(ce.locations),pe=new Set;for(const Pe of ee){const $e=`${(Pe.locationCode??"").trim()} - ${(Pe.locationName??"").trim()}`.trim(),Fe=(Pe.locationName??"").trim(),dt=(Pe.locationCode??"").trim();(Ce.has($e)||Ce.has(Fe)||Ce.has(dt))&&pe.add(Pe.id)}O(pe)}}}catch(Z){Z?.name!=="AbortError"&&me.error("Failed to load user form.",{description:Z?.message?String(Z.message):"Please try again."})}finally{L(!1),Y(!1)}})(),()=>re.abort()},[e,t?.id]);const U=b.useMemo(()=>!(!u.trim()||!c.trim()||!v.trim()||!String(x??"").trim()||!j.trim()||E.size===0||!a&&!p.trim()),[u,c,v,x,j,E,a,p]),z=(re,G)=>{O(Z=>{const ee=new Set(Z);return G?ee.add(re):ee.delete(re),ee})},B=async re=>{if(re?.preventDefault(),re?.stopPropagation(),console.log("[MemberDialog] submit called",{isEdit:a,memberId:t?.id,canSubmit:U,roleId:j,fullName:u,userName:c,selectedLocationIds:E.size}),!U){const G=[];u.trim()||G.push("Full Name"),c.trim()||G.push("User Name"),v.trim()||G.push("Email"),String(x??"").trim()||G.push("Phone"),j.trim()||G.push("Role"),E.size===0&&G.push("Locations"),!a&&!p.trim()&&G.push("Password"),me.error("Missing required fields.",{description:`Please fill: ${G.join(", ")}.`});return}if(!a&&!t?.id){s(!0);try{const G=Array.from(E);console.log("[MemberDialog] Creating user",{fullName:u,userName:c,roleId:j,locationIds:G}),await vpe({fullName:u.trim(),userName:c.trim(),password:p.trim(),email:v.trim(),phone:String(x).trim(),roleId:j.trim(),locationIds:G,state:C}),me.success("User created.",{description:"A new user has been created successfully."}),r(!1),n()}catch(G){console.error("[MemberDialog] Create error",G),me.error("Failed to create user.",{description:G?.message?String(G.message):"Please try again."})}finally{s(!1)}}else if(a&&t?.id){s(!0);try{const G=Array.from(E);console.log("[MemberDialog] Updating user",{id:t.id,fullName:u,userName:c,roleId:j,locationIds:G}),await ype(t.id,{fullName:u.trim(),userName:c.trim(),password:p.trim()?p.trim():null,email:v.trim(),phone:String(x).trim(),roleId:j.trim(),locationIds:G,state:C}),me.success("User updated.",{description:"Changes have been saved successfully."}),r(!1),n()}catch(G){console.error("[MemberDialog] Update error",G),me.error("Failed to update user.",{description:G?.message?String(G.message):"Please try again."})}finally{s(!1)}}else console.error("[MemberDialog] Invalid state",{isEdit:a,memberId:t?.id}),me.error("Invalid form state.",{description:"Please refresh and try again."})},X=re=>{const G=(re.locationCode??"").trim(),Z=(re.locationName??"").trim();return G&&Z?`${G} - ${Z}`:Z||G||re.id},Q=b.useMemo(()=>{const re=W.trim().toLowerCase();return re?$.filter(G=>X(G).toLowerCase().includes(re)):$},[$,W]);return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-none",style:{width:"50%"},children:[o.jsxs(bt,{children:[o.jsx(wt,{children:a?"Edit User":"New User"}),o.jsx(kt,{children:"Role is single-select; Locations is multi-select."})]}),o.jsxs("div",{className:"space-y-4 py-4 max-h-[70vh] overflow-y-auto pr-1",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Full Name *"}),o.jsx(ye,{value:u,onChange:re=>d(re.target.value),placeholder:"John Doe"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"User Name *"}),o.jsx(ye,{value:c,onChange:re=>f(re.target.value),placeholder:"username"})]})]}),!a&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Password *"}),o.jsx(ye,{type:"password",value:p,onChange:re=>m(re.target.value),placeholder:"Enter password",autoComplete:"new-password",className:"w-full"})]}),a&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Password (Optional)"}),o.jsx(ye,{type:"password",value:p,onChange:re=>m(re.target.value),placeholder:"Enter new password (optional)",autoComplete:"new-password",className:"w-full"})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Email *"}),o.jsx(ye,{value:v,onChange:re=>y(re.target.value),placeholder:"john@example.com"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Phone *"}),o.jsx(ye,{value:x,onChange:re=>w(re.target.value),placeholder:"+1 (555) 000-0000"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Role *"}),o.jsxs(Ve,{value:j||"",onValueChange:re=>{const G=re&&re.trim()?re.trim():"";console.log("[MemberDialog] Role changed",{old:j,new:G,v:re}),N(G)},disabled:M,children:[o.jsx(We,{className:"h-10 rounded-md border border-gray-200 bg-white",children:o.jsx(He,{placeholder:M?"Loading roles...":"Select role"})}),o.jsx(Ge,{children:T.map(re=>o.jsx(je,{value:re.id,children:re.roleName??re.roleCode??re.id},re.id))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Locations *"}),o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(ye,{value:W,onChange:re=>V(re.target.value),placeholder:"Search locations",className:"h-9"}),o.jsxs("div",{className:"text-xs text-gray-500 shrink-0",children:[E.size," selected"]})]}),o.jsx(fl,{className:"h-[180px] w-full border rounded-md p-2",children:o.jsx("div",{className:"space-y-2",children:H?o.jsx("div",{className:"text-sm text-gray-500 py-2",children:"Loading..."}):Q.map(re=>o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Qu,{id:`loc-${re.id}`,checked:E.has(re.id),onCheckedChange:G=>z(re.id,!!G)}),o.jsx("label",{htmlFor:`loc-${re.id}`,className:"text-sm cursor-pointer w-full hover:bg-gray-50 p-1 rounded",children:X(re)})]},re.id))})}),o.jsx("p",{className:"text-xs text-gray-500",children:"* Users must be assigned to at least one location."})]}),o.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[o.jsx(Zt,{id:"member-status",checked:C,onCheckedChange:A}),o.jsx(de,{htmlFor:"member-status",children:C?"Active":"Inactive"})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{disabled:i||!U,onClick:re=>{re.preventDefault(),re.stopPropagation(),B(re)},className:"bg-blue-600 text-white hover:bg-blue-700",children:i?"Saving...":a?"Save":"Create"})]})]})})}function Ope({open:e,member:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>{const d=(t?.fullName??"").trim(),c=(t?.userName??"").trim();return d||c||"this user"},[t?.fullName,t?.userName]),u=async()=>{if(console.log("submit",t),!!t?.id){i(!0);try{await xpe(t.id),me.success("User deleted.",{description:"The user has been removed successfully."}),r(!1),n()}catch(d){me.error("Failed to delete user.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Delete User"}),o.jsx(kt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(Nt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{variant:"outline",className:"min-w-24",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{variant:"destructive",className:"min-w-24 gap-2",disabled:a,onClick:u,children:[o.jsx(Et,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}const Ppe=[{id:"1-251201",productName:"Whole Milk",category:"Dairy",template:'2"x2" Basic',printedAt:"2024-03-20 09:30 AM",printedBy:"Alice Johnson",location:"Downtown Store (101)",expiryDate:"2024-03-27",status:"Valid"},{id:"2-251201",productName:"Ground Beef",category:"Meat",template:'2"x2" Basic',printedAt:"2024-03-20 10:15 AM",printedBy:"Bob Smith",location:"Uptown Store (102)",expiryDate:"2024-03-23",status:"Valid"},{id:"3-251201",productName:"Croissant",category:"Bakery",template:'2"x2" Basic',printedAt:"2024-03-19 14:00 PM",printedBy:"Charlie Brown",location:"Downtown Store (101)",expiryDate:"2024-03-20",status:"Expired"},{id:"4-251201",productName:"Caesar Salad",category:"Deli",template:`2"x6" G'n'G !!!`,printedAt:"2024-03-18 11:45 AM",printedBy:"Alice Johnson",location:"Downtown Store (101)",expiryDate:"2024-03-21",status:"Expiring Soon"},{id:"5-251201",productName:"Orange Juice",category:"Beverage",template:'2"x2" Basic',printedAt:"2024-03-18 08:20 AM",printedBy:"Bob Smith",location:"Airport Kiosk (201)",expiryDate:"2024-03-25",status:"Valid"}],Ape=[{name:"Dairy",count:450},{name:"Meat",count:320},{name:"Bakery",count:280},{name:"Deli",count:190},{name:"Produce",count:150},{name:"Beverage",count:120}],Tpe=[{date:"Mon",count:120},{date:"Tue",count:132},{date:"Wed",count:101},{date:"Thu",count:134},{date:"Fri",count:190},{date:"Sat",count:230},{date:"Sun",count:210}];function kpe(){const[e,t]=b.useState("print-log"),r=n=>{me.success(`Reprinting label ${n}`,{description:"Watermark 'RePrint' applied."})};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"pb-4",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[o.jsxs(Ve,{defaultValue:"partner-a",children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Partner"})}),o.jsx(Ge,{children:o.jsx(je,{value:"partner-a",children:"Partner A"})})]}),o.jsxs(Ve,{defaultValue:"group-b",children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Group"})}),o.jsx(Ge,{children:o.jsx(je,{value:"group-b",children:"Group B"})})]}),o.jsxs(Ve,{defaultValue:"loc-12345",children:[o.jsx(We,{className:"w-[160px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Location"})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"loc-12345",children:"Downtown Store"}),o.jsx(je,{value:"all",children:"All Locations"})]})]}),o.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Period Search:"}),o.jsxs("div",{className:"flex items-center bg-white border border-gray-300 rounded-md h-10 px-2",style:{minHeight:40},children:[o.jsx(K8,{className:"w-4 h-4 text-gray-500 mr-2 shrink-0"}),o.jsx("input",{type:"date",className:"text-sm outline-none w-32 bg-transparent"}),o.jsx("span",{className:"mx-2 text-gray-400",children:"-"}),o.jsx("input",{type:"date",className:"text-sm outline-none w-32 bg-transparent"})]})]}),o.jsxs("div",{className:"flex items-center w-64 rounded-md border border-gray-300 bg-white overflow-hidden shrink-0",style:{height:40},children:[o.jsx(jm,{className:"h-4 w-4 text-gray-400 shrink-0 ml-3 pointer-events-none"}),o.jsx(ye,{placeholder:"Search Product or Category...",className:"flex-1 min-w-0 border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 py-2 px-2 h-full placeholder:text-gray-500"})]}),o.jsx("div",{className:"flex-1 min-w-2"}),o.jsxs(he,{variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 bg-white hover:bg-gray-50 gap-2 shrink-0",children:[o.jsx(JS,{className:"w-4 h-4"})," Export Report"]})]}),o.jsx("div",{className:"w-full border-b border-gray-200 mt-4",children:o.jsxs("div",{className:"flex overflow-x-auto w-fit",children:[o.jsx("button",{onClick:()=>t("print-log"),style:e==="print-log"?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:Ee("px-4 py-2.5 text-sm font-medium whitespace-nowrap cursor-pointer transition-colors -mb-px border-b-2",e==="print-log"?"text-blue-600":"border-b-transparent text-gray-600 hover:text-gray-800"),children:"Print Log"}),o.jsx("button",{onClick:()=>t("label-report"),style:e==="label-report"?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:Ee("px-4 py-2.5 text-sm font-medium whitespace-nowrap cursor-pointer transition-colors -mb-px border-b-2",e==="label-report"?"text-blue-600":"border-b-transparent text-gray-600 hover:text-gray-800"),children:"Label Report"})]})})]}),o.jsxs("div",{className:"flex-1 overflow-auto pt-6",children:[e==="print-log"&&o.jsx("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden",children:o.jsxs(Fr,{children:[o.jsx(Br,{children:o.jsxs(Be,{className:"bg-gray-100 hover:bg-gray-100",children:[o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Label ID"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Product Name"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Category"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Template"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Printed At"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Printed By"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Location"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Expiry Date"}),o.jsx(xe,{className:"text-gray-900 font-bold text-center",children:"Action"})]})}),o.jsx(zr,{children:Ppe.map(n=>o.jsxs(Be,{children:[o.jsx(fe,{className:"border-r font-numeric text-gray-600",children:n.id}),o.jsx(fe,{className:"border-r font-medium",children:n.productName}),o.jsx(fe,{className:"border-r",children:o.jsx($r,{variant:"secondary",className:"bg-blue-50 text-blue-700 hover:bg-blue-50 border-blue-200",children:n.category})}),o.jsx(fe,{className:"border-r text-gray-600 text-sm",children:(()=>{const a=n.template.endsWith(" !!!"),i=a?n.template.slice(0,-4):n.template,s=i.lastIndexOf(" "),u=i.slice(0,s+1),d=i.slice(s+1);return o.jsxs(o.Fragment,{children:[u,o.jsx("span",{className:"font-bold text-gray-900",children:d}),a&&o.jsx("span",{className:"text-red-600",children:" !!!"})]})})()}),o.jsx(fe,{className:"border-r text-gray-600 text-sm font-numeric",children:n.printedAt}),o.jsx(fe,{className:"border-r text-gray-600 text-sm",children:n.printedBy}),o.jsx(fe,{className:"border-r text-gray-600 text-sm font-numeric",children:n.location}),o.jsx(fe,{className:"border-r",children:o.jsx("span",{className:Ee("text-sm font-medium font-numeric",n.status==="Expired"?"text-red-600":n.status==="Expiring Soon"?"text-orange-500":"text-green-600"),children:n.expiryDate})}),o.jsx(fe,{className:"text-center",children:o.jsxs(he,{size:"sm",variant:"outline",className:"h-8 gap-1 hover:bg-gray-100 border-gray-300",onClick:()=>r(n.id),children:[o.jsx($M,{className:"w-3 h-3"})," Reprint"]})})]},n.id))})]})}),e==="label-report"&&o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[o.jsxs(wn,{children:[o.jsxs(ca,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(ua,{className:"text-sm font-medium",children:"Total Labels Printed"}),o.jsx(ul,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Un,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"2,543"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"+20.1% from last month"})]})]}),o.jsxs(wn,{children:[o.jsxs(ca,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(ua,{className:"text-sm font-medium",children:"Most Printed Category"}),o.jsx(X8,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Un,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"Dairy"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"450 labels generated"})]})]}),o.jsxs(wn,{children:[o.jsxs(ca,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(ua,{className:"text-sm font-medium",children:"Top Product"}),o.jsx(TM,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Un,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"Whole Milk"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"182 labels generated"})]})]}),o.jsxs(wn,{children:[o.jsxs(ca,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(ua,{className:"text-sm font-medium",children:"Avg. Daily Prints"}),o.jsx(M6,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Un,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"85"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"+12% from last week"})]})]})]}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[o.jsxs(wn,{className:"col-span-1",children:[o.jsxs(ca,{children:[o.jsx(ua,{children:"Labels by Category"}),o.jsx(up,{children:"Distribution of printed labels across product categories."})]}),o.jsx(Un,{className:"h-[300px]",children:o.jsx(Sp,{width:"100%",height:"100%",children:o.jsxs(Die,{data:Ape,children:[o.jsx(lm,{strokeDasharray:"3 3",vertical:!1}),o.jsx(Jo,{dataKey:"name",fontSize:12,tickLine:!1,axisLine:!1}),o.jsx(Qo,{fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:n=>`${n}`}),o.jsx(Sn,{}),o.jsx(ds,{dataKey:"count",fill:"#facc15",radius:[4,4,0,0]})]})})})]}),o.jsxs(wn,{className:"col-span-1",children:[o.jsxs(ca,{children:[o.jsx(ua,{children:"Print Volume Trends"}),o.jsx(up,{children:"Daily label printing volume for the last 7 days."})]}),o.jsx(Un,{className:"h-[300px]",children:o.jsx(Sp,{width:"100%",height:"100%",children:o.jsxs(q4,{data:Tpe,children:[o.jsx(lm,{strokeDasharray:"3 3",vertical:!1}),o.jsx(Jo,{dataKey:"date",fontSize:12,tickLine:!1,axisLine:!1}),o.jsx(Qo,{fontSize:12,tickLine:!1,axisLine:!1}),o.jsx(Sn,{}),o.jsx(Zl,{type:"monotone",dataKey:"count",stroke:"#dc2626",strokeWidth:2,dot:{r:4},activeDot:{r:6}})]})})})]})]}),o.jsxs(wn,{children:[o.jsx(ca,{children:o.jsx(ua,{children:"Most Used Products"})}),o.jsx(Un,{children:o.jsxs(Fr,{children:[o.jsx(Br,{children:o.jsxs(Be,{children:[o.jsx(xe,{children:"Product Name"}),o.jsx(xe,{children:"Category"}),o.jsx(xe,{className:"text-right",children:"Total Printed"}),o.jsx(xe,{className:"text-right",children:"Usage %"})]})}),o.jsxs(zr,{children:[o.jsxs(Be,{children:[o.jsx(fe,{className:"font-medium",children:"Whole Milk"}),o.jsx(fe,{children:"Dairy"}),o.jsx(fe,{className:"text-right",children:"182"}),o.jsx(fe,{className:"text-right",children:"7.2%"})]}),o.jsxs(Be,{children:[o.jsx(fe,{className:"font-medium",children:"Ground Beef 80/20"}),o.jsx(fe,{children:"Meat"}),o.jsx(fe,{className:"text-right",children:"145"}),o.jsx(fe,{className:"text-right",children:"5.7%"})]}),o.jsxs(Be,{children:[o.jsx(fe,{className:"font-medium",children:"Chicken Breast"}),o.jsx(fe,{children:"Meat"}),o.jsx(fe,{className:"text-right",children:"132"}),o.jsx(fe,{className:"text-right",children:"5.2%"})]}),o.jsxs(Be,{children:[o.jsx(fe,{className:"font-medium",children:"Sliced Ham"}),o.jsx(fe,{children:"Deli"}),o.jsx(fe,{className:"text-right",children:"98"}),o.jsx(fe,{className:"text-right",children:"3.8%"})]})]})]})})]})]})]})]})}var Rpe=Symbol("radix.slottable");function Ipe(e){const t=({children:r})=>o.jsx(o.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Rpe,t}var[qg]=Ni("Tooltip",[rc]),Ug=rc(),XF="TooltipProvider",Mpe=700,KS="tooltip.open",[Dpe,BN]=qg(XF),JF=e=>{const{__scopeTooltip:t,delayDuration:r=Mpe,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:i}=e,s=b.useRef(!0),u=b.useRef(!1),d=b.useRef(0);return b.useEffect(()=>{const c=d.current;return()=>window.clearTimeout(c)},[]),o.jsx(Dpe,{scope:t,isOpenDelayedRef:s,delayDuration:r,onOpen:b.useCallback(()=>{window.clearTimeout(d.current),s.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>s.current=!0,n)},[n]),isPointerInTransitRef:u,onPointerInTransitChange:b.useCallback(c=>{u.current=c},[]),disableHoverableContent:a,children:i})};JF.displayName=XF;var rd="Tooltip",[Lpe,Dd]=qg(rd),QF=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:a,onOpenChange:i,disableHoverableContent:s,delayDuration:u}=e,d=BN(rd,e.__scopeTooltip),c=Ug(t),[f,p]=b.useState(null),m=sn(),v=b.useRef(0),y=s??d.disableHoverableContent,x=u??d.delayDuration,w=b.useRef(!1),[j,N]=es({prop:n,defaultProp:a??!1,onChange:T=>{T?(d.onOpen(),document.dispatchEvent(new CustomEvent(KS))):d.onClose(),i?.(T)},caller:rd}),C=b.useMemo(()=>j?w.current?"delayed-open":"instant-open":"closed",[j]),A=b.useCallback(()=>{window.clearTimeout(v.current),v.current=0,w.current=!1,N(!0)},[N]),E=b.useCallback(()=>{window.clearTimeout(v.current),v.current=0,N(!1)},[N]),O=b.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{w.current=!0,N(!0),v.current=0},x)},[x,N]);return b.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),o.jsx(bN,{...c,children:o.jsx(Lpe,{scope:t,contentId:m,open:j,stateAttribute:C,trigger:f,onTriggerChange:p,onTriggerEnter:b.useCallback(()=>{d.isOpenDelayedRef.current?O():A()},[d.isOpenDelayedRef,O,A]),onTriggerLeave:b.useCallback(()=>{y?E():(window.clearTimeout(v.current),v.current=0)},[E,y]),onOpen:A,onClose:E,disableHoverableContent:y,children:r})})};QF.displayName=rd;var YS="TooltipTrigger",ZF=b.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=Dd(YS,r),i=BN(YS,r),s=Ug(r),u=b.useRef(null),d=lt(t,u,a.onTriggerChange),c=b.useRef(!1),f=b.useRef(!1),p=b.useCallback(()=>c.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),o.jsx(pg,{asChild:!0,...s,children:o.jsx(Ze.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:d,onPointerMove:tt(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),f.current=!0)}),onPointerLeave:tt(e.onPointerLeave,()=>{a.onTriggerLeave(),f.current=!1}),onPointerDown:tt(e.onPointerDown,()=>{a.open&&a.onClose(),c.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:tt(e.onFocus,()=>{c.current||a.onOpen()}),onBlur:tt(e.onBlur,a.onClose),onClick:tt(e.onClick,a.onClose)})})});ZF.displayName=YS;var zN="TooltipPortal",[$pe,Fpe]=qg(zN,{forceMount:void 0}),eB=e=>{const{__scopeTooltip:t,forceMount:r,children:n,container:a}=e,i=Dd(zN,t);return o.jsx($pe,{scope:t,forceMount:r,children:o.jsx(An,{present:r||i.open,children:o.jsx(md,{asChild:!0,container:a,children:n})})})};eB.displayName=zN;var zl="TooltipContent",tB=b.forwardRef((e,t)=>{const r=Fpe(zl,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...i}=e,s=Dd(zl,e.__scopeTooltip);return o.jsx(An,{present:n||s.open,children:s.disableHoverableContent?o.jsx(rB,{side:a,...i,ref:t}):o.jsx(Bpe,{side:a,...i,ref:t})})}),Bpe=b.forwardRef((e,t)=>{const r=Dd(zl,e.__scopeTooltip),n=BN(zl,e.__scopeTooltip),a=b.useRef(null),i=lt(t,a),[s,u]=b.useState(null),{trigger:d,onClose:c}=r,f=a.current,{onPointerInTransitChange:p}=n,m=b.useCallback(()=>{u(null),p(!1)},[p]),v=b.useCallback((y,x)=>{const w=y.currentTarget,j={x:y.clientX,y:y.clientY},N=Vpe(j,w.getBoundingClientRect()),C=Hpe(j,N),A=Wpe(x.getBoundingClientRect()),E=Kpe([...C,...A]);u(E),p(!0)},[p]);return b.useEffect(()=>()=>m(),[m]),b.useEffect(()=>{if(d&&f){const y=w=>v(w,f),x=w=>v(w,d);return d.addEventListener("pointerleave",y),f.addEventListener("pointerleave",x),()=>{d.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",x)}}},[d,f,v,m]),b.useEffect(()=>{if(s){const y=x=>{const w=x.target,j={x:x.clientX,y:x.clientY},N=d?.contains(w)||f?.contains(w),C=!Gpe(j,s);N?m():C&&(m(),c())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[d,f,s,c,m]),o.jsx(rB,{...e,ref:i})}),[zpe,qpe]=qg(rd,{isInside:!1}),Upe=Ipe("TooltipContent"),rB=b.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:s,...u}=e,d=Dd(zl,r),c=Ug(r),{onClose:f}=d;return b.useEffect(()=>(document.addEventListener(KS,f),()=>document.removeEventListener(KS,f)),[f]),b.useEffect(()=>{if(d.trigger){const p=m=>{m.target?.contains(d.trigger)&&f()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,f]),o.jsx(hd,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:p=>p.preventDefault(),onDismiss:f,children:o.jsxs(wN,{"data-state":d.stateAttribute,...c,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(Upe,{children:n}),o.jsx(zpe,{scope:r,isInside:!0,children:o.jsx(zse,{id:d.contentId,role:"tooltip",children:a||n})})]})})});tB.displayName=zl;var nB="TooltipArrow",aB=b.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=Ug(r);return qpe(nB,r).isInside?null:o.jsx(SN,{...a,...n,ref:t})});aB.displayName=nB;function Vpe(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(r,n,a,i)){case i:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function Hpe(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function Wpe(e){const{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function Gpe(e,t){const{x:r,y:n}=e;let a=!1;for(let i=0,s=t.length-1;in!=m>n&&r<(p-c)*(n-f)/(m-f)+c&&(a=!a)}return a}function Kpe(e){const t=e.slice();return t.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),Ype(t)}function Ype(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(a.y-s.y)>=(i.y-s.y)*(a.x-s.x))t.pop();else break}t.push(a)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const a=e[n];for(;r.length>=2;){const i=r[r.length-1],s=r[r.length-2];if((i.x-s.x)*(a.y-s.y)>=(i.y-s.y)*(a.x-s.x))r.pop();else break}r.push(a)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var Xpe=JF,Jpe=QF,Qpe=ZF,Zpe=eB,eme=tB,tme=aB;function rme({delayDuration:e=0,...t}){return o.jsx(Xpe,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function nw({...e}){return o.jsx(rme,{children:o.jsx(Jpe,{"data-slot":"tooltip",...e})})}function aw({...e}){return o.jsx(Qpe,{"data-slot":"tooltip-trigger",...e})}function iw({className:e,sideOffset:t=0,children:r,...n}){return o.jsx(Zpe,{children:o.jsxs(eme,{"data-slot":"tooltip-content",sideOffset:t,className:Ee("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...n,children:[r,o.jsx(tme,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function sa(e){const t=(e??"").trim();return t||"N/A"}function nme(e,t){return e==null||t===null||t===void 0||!Number.isFinite(e)||!Number.isFinite(t)?"N/A":`${e}, ${t}`}function iB(e){const t=[];e.locationCode.trim()||t.push("Location ID"),e.locationName.trim()||t.push("Location Name"),(e.street??"").trim()||t.push("Street"),(e.city??"").trim()||t.push("City"),(e.stateCode??"").trim()||t.push("State"),(e.country??"").trim()||t.push("Country"),(e.zipCode??"").trim()||t.push("Zip Code"),(e.phone??"").trim()||t.push("Phone Number"),(e.email??"").trim()||t.push("Email");const r=e.latitude,n=e.longitude;return(r==null||!Number.isFinite(r))&&t.push("Latitude"),(n==null||!Number.isFinite(n))&&t.push("Longitude"),t}function ame(){const[e,t]=b.useState(!1),[r,n]=b.useState(!1),[a,i]=b.useState(!1),[s,u]=b.useState(null),[d,c]=b.useState(null),[f,p]=b.useState([]),[m,v]=b.useState(!1),[y,x]=b.useState(0),[w,j]=b.useState(0),[N,C]=b.useState(null),[A,E]=b.useState(""),[O,T]=b.useState("all"),[k,M]=b.useState("all"),[L,$]=b.useState("all"),[I,H]=b.useState(1),[Y,W]=b.useState(10),V=b.useRef(null),K=b.useRef(null),[F,te]=b.useState("");b.useEffect(()=>(K.current&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>te(A.trim()),300),()=>{K.current&&window.clearTimeout(K.current)}),[A]);const D=b.useMemo(()=>{const G=new Set;for(const Z of f){const ee=(Z.partner??"").trim();ee&&G.add(ee)}return["all",...Array.from(G).sort((Z,ee)=>Z.localeCompare(ee))]},[f]),U=b.useMemo(()=>{const G=new Set;for(const Z of f){const ee=(Z.groupName??"").trim();ee&&G.add(ee)}return["all",...Array.from(G).sort((Z,ee)=>Z.localeCompare(ee))]},[f]),z=b.useMemo(()=>{const G=new Set;for(const Z of f){const ee=(Z.locationCode??"").trim();ee&&G.add(ee)}return["all",...Array.from(G).sort((Z,ee)=>Z.localeCompare(ee))]},[f]),B=Math.max(1,Math.ceil(y/Y));b.useEffect(()=>{H(1)},[F,O,k,L,Y]),b.useEffect(()=>((async()=>{V.current?.abort();const Z=new AbortController;V.current=Z,v(!0);try{const ee=Ua(I),ve=await bd({skipCount:ee,maxResultCount:Y,keyword:(L!=="all"?L:F)||void 0,partner:O!=="all"?O:void 0,groupName:k!=="all"?k:void 0},Z.signal);p(ve.items??[]),x(ve.totalCount??0)}catch(ee){if(ee?.name==="AbortError")return;me.error("Failed to load locations.",{description:ee?.message?String(ee.message):"Please try again."}),p([]),x(0)}finally{v(!1)}})(),()=>V.current?.abort()),[F,O,k,L,I,Y,w]);const X=()=>j(G=>G+1),Q=G=>{C(null),u(G),n(!0)},re=G=>{C(null),c(G),i(!0)};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"pb-4",children:o.jsx("div",{className:"flex flex-col gap-4",children:o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ye,{placeholder:"Search",value:A,onChange:G=>E(G.target.value),style:{height:40,boxSizing:"border-box"},className:"border border-gray-300 rounded-md w-40 shrink-0 bg-white placeholder:text-gray-500"}),o.jsxs(Ve,{value:O,onValueChange:T,children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Partner"})}),o.jsx(Ge,{children:D.map(G=>o.jsx(je,{value:G,children:G==="all"?"Partner (All)":G},G))})]}),o.jsxs(Ve,{value:k,onValueChange:M,children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Group"})}),o.jsx(Ge,{children:U.map(G=>o.jsx(je,{value:G,children:G==="all"?"Group (All)":G},G))})]}),o.jsxs(Ve,{value:L,onValueChange:$,children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Location"})}),o.jsx(Ge,{children:z.map(G=>o.jsx(je,{value:G,children:G==="all"?"All Locations":G},G))})]}),o.jsx("div",{className:"flex-1"}),o.jsxs(nw,{children:[o.jsx(aw,{asChild:!0,children:o.jsx("span",{children:o.jsx(he,{disabled:!0,variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 px-4 bg-white hover:bg-gray-50 shrink-0",children:"Bulk Import"})})}),o.jsx(iw,{children:"Not supported yet"})]}),o.jsxs(nw,{children:[o.jsx(aw,{asChild:!0,children:o.jsx("span",{children:o.jsx(he,{disabled:!0,variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 px-4 bg-white hover:bg-gray-50 shrink-0",children:"Bulk Export"})})}),o.jsx(iw,{children:"Not supported yet"})]}),o.jsxs(nw,{children:[o.jsx(aw,{asChild:!0,children:o.jsx("span",{children:o.jsx(he,{disabled:!0,variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 px-4 bg-white hover:bg-gray-50 shrink-0",children:"Bulk Edit"})})}),o.jsx(iw,{children:"Not supported yet"})]}),o.jsx(he,{className:"h-10 bg-blue-600 hover:bg-blue-700 text-white rounded-md px-6 font-medium shrink-0",onClick:()=>t(!0),children:"New"})]})})}),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:o.jsx("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden",children:o.jsxs(Fr,{children:[o.jsx(Br,{children:o.jsxs(Be,{className:"bg-gray-100 hover:bg-gray-100",children:[o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Partner"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Group"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Location ID"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Location Name"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Street"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"City"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"State"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Country"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Zip Code"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Phone"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Email"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"GPS"}),o.jsx(xe,{className:"text-gray-900 font-bold border-r",children:"Active"}),o.jsx(xe,{className:"text-gray-900 font-bold text-center",children:"Actions"})]})}),o.jsx(zr,{children:m?o.jsx(Be,{children:o.jsx(fe,{colSpan:14,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):f.length===0?o.jsx(Be,{children:o.jsx(fe,{colSpan:14,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):f.map(G=>o.jsxs(Be,{children:[o.jsx(fe,{className:"border-r text-gray-600 max-w-[140px] truncate",children:sa(G.partner)}),o.jsx(fe,{className:"border-r text-gray-600 max-w-[140px] truncate",children:sa(G.groupName)}),o.jsx(fe,{className:"border-r font-numeric text-gray-600",children:sa(G.locationCode??G.id)}),o.jsx(fe,{className:"border-r font-medium text-black",children:sa(G.locationName)}),o.jsx(fe,{className:"border-r text-gray-600 max-w-[140px] truncate",children:sa(G.street)}),o.jsx(fe,{className:"border-r text-gray-600",children:sa(G.city)}),o.jsx(fe,{className:"border-r text-gray-600",children:sa(G.stateCode)}),o.jsx(fe,{className:"border-r text-gray-600",children:sa(G.country)}),o.jsx(fe,{className:"border-r text-gray-600 font-numeric",children:sa(G.zipCode)}),o.jsx(fe,{className:"border-r text-gray-600 whitespace-nowrap",children:sa(G.phone)}),o.jsx(fe,{className:"border-r text-gray-600 text-sm max-w-[180px] truncate",children:sa(G.email)}),o.jsx(fe,{className:"border-r text-gray-500 font-numeric text-xs",children:nme(G.latitude,G.longitude)}),o.jsx(fe,{className:"border-r",children:o.jsx($r,{className:G.state?"bg-green-600":"bg-gray-400",children:G.state?"Yes":"No"})}),o.jsx(fe,{className:"text-center",children:o.jsxs(ya,{open:N===G.id,onOpenChange:Z=>C(Z?G.id:null),children:[o.jsx(xa,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:o.jsx(pi,{className:"h-4 w-4 text-gray-500"})})}),o.jsxs(ba,{align:"end",className:"w-40 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>Q(G),children:[o.jsx(Cn,{className:"w-4 h-4"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>re(G),children:[o.jsx(Et,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},G.id))})]})})}),o.jsx("div",{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[o.jsxs("div",{children:["Showing ",y===0?0:(I-1)*Y+1,"-",Math.min(I*Y,y)," of ",y]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String(Y),onValueChange:G=>W(Number(G)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(G=>o.jsxs(je,{value:String(G),children:[G," / page"]},G))})]}),o.jsx(bi,{className:"mx-0 w-auto justify-end",children:o.jsxs(wi,{children:[o.jsx(At,{children:o.jsx(Si,{href:"#",size:"default",onClick:G=>{G.preventDefault(),H(Z=>Math.max(1,Z-1))},"aria-disabled":I<=1,className:I<=1?"pointer-events-none opacity-50":""})}),o.jsx(At,{children:o.jsxs(wa,{href:"#",isActive:!0,size:"default",onClick:G=>G.preventDefault(),children:["Page ",I," / ",B]})}),o.jsx(At,{children:o.jsx(ji,{href:"#",size:"default",onClick:G=>{G.preventDefault(),H(Z=>Math.min(B,Z+1))},"aria-disabled":I>=B,className:I>=B?"pointer-events-none opacity-50":""})})]})})]})]})}),o.jsx(ime,{open:e,onOpenChange:t,onCreated:()=>{H(1),X()}}),o.jsx(sme,{open:r,location:s,onOpenChange:G=>{n(G),G||u(null)},onUpdated:()=>{X()}}),o.jsx(lme,{open:a,location:d,onOpenChange:G=>{i(G),G||c(null)},onDeleted:()=>{X()}})]})}function ime({open:e,onOpenChange:t,onCreated:r}){const[n,a]=b.useState(!1),[i,s]=b.useState({partner:"",groupName:"",locationCode:"",locationName:"",street:"",city:"",stateCode:"",country:"",zipCode:"",phone:"",email:"",latitude:null,longitude:null,state:!0}),u=()=>{s({partner:"",groupName:"",locationCode:"",locationName:"",street:"",city:"",stateCode:"",country:"",zipCode:"",phone:"",email:"",latitude:null,longitude:null,state:!0})};b.useEffect(()=>{e||(u(),a(!1))},[e]);const d=async()=>{const c=iB(i);if(c.length){me.error("Please fill in required fields.",{description:`Missing: ${c.join(", ")}.`});return}a(!0);try{await que({...i,locationCode:i.locationCode.trim(),locationName:i.locationName.trim(),partner:i.partner?.trim()?i.partner.trim():null,groupName:i.groupName?.trim()?i.groupName.trim():null,street:(i.street??"").trim(),city:(i.city??"").trim(),stateCode:(i.stateCode??"").trim(),country:(i.country??"").trim(),zipCode:(i.zipCode??"").trim(),phone:(i.phone??"").trim(),email:(i.email??"").trim(),latitude:i.latitude,longitude:i.longitude}),me.success("Location created.",{description:"The location has been added successfully."}),t(!1),r()}catch(f){me.error("Failed to create location.",{description:f?.message?String(f.message):"Please try again."})}finally{a(!1)}};return o.jsx(xt,{open:e,onOpenChange:t,children:o.jsxs(gt,{className:"sm:max-w-[600px]",children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Add New Location"}),o.jsx(kt,{children:"Enter the details for the new store location."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Partner"}),o.jsx(ye,{placeholder:"e.g. Global Foods Inc.",value:i.partner??"",onChange:c=>s(f=>({...f,partner:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Group"}),o.jsx(ye,{placeholder:"e.g. East Coast Region",value:i.groupName??"",onChange:c=>s(f=>({...f,groupName:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[o.jsxs("div",{className:"space-y-2 col-span-1",children:[o.jsx(de,{children:"Location ID *"}),o.jsx(ye,{placeholder:"e.g. 12345",value:i.locationCode,onChange:c=>s(f=>({...f,locationCode:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2 col-span-2",children:[o.jsx(de,{children:"Location Name *"}),o.jsx(ye,{placeholder:"e.g. Downtown Store",value:i.locationName,onChange:c=>s(f=>({...f,locationName:c.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Street *"}),o.jsx(ye,{placeholder:"e.g. 123 Main St",value:i.street??"",onChange:c=>s(f=>({...f,street:c.target.value}))})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"City *"}),o.jsx(ye,{placeholder:"e.g. New York",value:i.city??"",onChange:c=>s(f=>({...f,city:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"State *"}),o.jsx(ye,{placeholder:"e.g. NY",value:i.stateCode??"",onChange:c=>s(f=>({...f,stateCode:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Country *"}),o.jsx(ye,{placeholder:"e.g. USA",value:i.country??"",onChange:c=>s(f=>({...f,country:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Zip Code *"}),o.jsx(ye,{placeholder:"e.g. 10001",value:i.zipCode??"",onChange:c=>s(f=>({...f,zipCode:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Phone Number *"}),o.jsx(ye,{placeholder:"+1 (555) 000-0000",value:i.phone??"",onChange:c=>s(f=>({...f,phone:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Email *"}),o.jsx(ye,{placeholder:"store@example.com",value:i.email??"",onChange:c=>s(f=>({...f,email:c.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(de,{className:"flex items-center gap-2",children:[o.jsx(ql,{className:"w-4 h-4"})," GPS Coordinates *"]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ye,{placeholder:"Latitude (e.g. 40.7128)",value:i.latitude===null||i.latitude===void 0?"":String(i.latitude),onChange:c=>{const f=c.target.value.trim();s(p=>({...p,latitude:f?Number(f):null}))}}),o.jsx(ye,{placeholder:"Longitude (e.g. -74.0060)",value:i.longitude===null||i.longitude===void 0?"":String(i.longitude),onChange:c=>{const f=c.target.value.trim();s(p=>({...p,longitude:f?Number(f):null}))}})]})]}),o.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[o.jsx(Zt,{id:"loc-status",checked:!!i.state,onCheckedChange:c=>s(f=>({...f,state:c}))}),o.jsx(de,{htmlFor:"loc-status",children:"Active Location"})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{disabled:n,onClick:d,className:"bg-blue-600 text-white hover:bg-blue-700",children:n?"Creating...":"Create Location"})]})]})})}function ome(e){return{partner:e.partner??"",groupName:e.groupName??"",locationCode:e.locationCode??"",locationName:e.locationName??"",street:e.street??"",city:e.city??"",stateCode:e.stateCode??"",country:e.country??"",zipCode:e.zipCode??"",phone:e.phone??"",email:e.email??"",latitude:e.latitude??null,longitude:e.longitude??null,state:!!e.state}}function sme({open:e,location:t,onOpenChange:r,onUpdated:n}){const[a,i]=b.useState(!1),[s,u]=b.useState({partner:"",groupName:"",locationCode:"",locationName:"",street:"",city:"",stateCode:"",country:"",zipCode:"",phone:"",email:"",latitude:null,longitude:null,state:!0});b.useEffect(()=>{e&&t&&(u(ome(t)),i(!1)),e||i(!1)},[e,t]);const d=async()=>{if(!t?.id)return;const c=iB(s);if(c.length){me.error("Please fill in required fields.",{description:`Missing: ${c.join(", ")}.`});return}i(!0);try{await Uue(t.id,{...s,locationCode:s.locationCode.trim(),locationName:s.locationName.trim(),partner:s.partner?.trim()?s.partner.trim():null,groupName:s.groupName?.trim()?s.groupName.trim():null,street:(s.street??"").trim(),city:(s.city??"").trim(),stateCode:(s.stateCode??"").trim(),country:(s.country??"").trim(),zipCode:(s.zipCode??"").trim(),phone:(s.phone??"").trim(),email:(s.email??"").trim(),latitude:s.latitude,longitude:s.longitude}),me.success("Location updated.",{description:"The changes have been saved successfully."}),r(!1),n()}catch(f){me.error("Failed to update location.",{description:f?.message?String(f.message):"Please try again."})}finally{i(!1)}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-[600px]",children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Edit Location"}),o.jsx(kt,{children:"Update the details for this store location."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Partner"}),o.jsx(ye,{placeholder:"e.g. Global Foods Inc.",value:s.partner??"",onChange:c=>u(f=>({...f,partner:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Group"}),o.jsx(ye,{placeholder:"e.g. East Coast Region",value:s.groupName??"",onChange:c=>u(f=>({...f,groupName:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[o.jsxs("div",{className:"space-y-2 col-span-1",children:[o.jsx(de,{children:"Location ID *"}),o.jsx(ye,{placeholder:"e.g. 12345",value:s.locationCode,onChange:c=>u(f=>({...f,locationCode:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2 col-span-2",children:[o.jsx(de,{children:"Location Name *"}),o.jsx(ye,{placeholder:"e.g. Downtown Store",value:s.locationName,onChange:c=>u(f=>({...f,locationName:c.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Street *"}),o.jsx(ye,{placeholder:"e.g. 123 Main St",value:s.street??"",onChange:c=>u(f=>({...f,street:c.target.value}))})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"City *"}),o.jsx(ye,{placeholder:"e.g. New York",value:s.city??"",onChange:c=>u(f=>({...f,city:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"State *"}),o.jsx(ye,{placeholder:"e.g. NY",value:s.stateCode??"",onChange:c=>u(f=>({...f,stateCode:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Country *"}),o.jsx(ye,{placeholder:"e.g. USA",value:s.country??"",onChange:c=>u(f=>({...f,country:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Zip Code *"}),o.jsx(ye,{placeholder:"e.g. 10001",value:s.zipCode??"",onChange:c=>u(f=>({...f,zipCode:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Phone Number *"}),o.jsx(ye,{placeholder:"+1 (555) 000-0000",value:s.phone??"",onChange:c=>u(f=>({...f,phone:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Email *"}),o.jsx(ye,{placeholder:"store@example.com",value:s.email??"",onChange:c=>u(f=>({...f,email:c.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(de,{className:"flex items-center gap-2",children:[o.jsx(ql,{className:"w-4 h-4"})," GPS Coordinates *"]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ye,{placeholder:"Latitude (e.g. 40.7128)",value:s.latitude===null||s.latitude===void 0?"":String(s.latitude),onChange:c=>{const f=c.target.value.trim();u(p=>({...p,latitude:f?Number(f):null}))}}),o.jsx(ye,{placeholder:"Longitude (e.g. -74.0060)",value:s.longitude===null||s.longitude===void 0?"":String(s.longitude),onChange:c=>{const f=c.target.value.trim();u(p=>({...p,longitude:f?Number(f):null}))}})]})]}),o.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[o.jsx(Zt,{id:"loc-status-edit",checked:!!s.state,onCheckedChange:c=>u(f=>({...f,state:c}))}),o.jsx(de,{htmlFor:"loc-status-edit",children:"Active Location"})]})]}),o.jsxs(Nt,{children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{disabled:a,onClick:d,className:"bg-blue-600 text-white hover:bg-blue-700",children:a?"Saving...":"Save Changes"})]})]})})}function lme({open:e,location:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>{const d=(t?.locationCode??"").trim(),c=(t?.locationName??"").trim();return d&&c?`${d} - ${c}`:d||c||"this location"},[t?.locationCode,t?.locationName]),u=async()=>{if(t?.id){i(!0);try{await Vue(t.id),me.success("Location deleted.",{description:"The location has been removed successfully."}),r(!1),n()}catch(d){me.error("Failed to delete location.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Delete Location"}),o.jsx(kt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(Nt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Et,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}function cme({className:e,...t}){return o.jsx("textarea",{"data-slot":"textarea",className:Ee("resize-none border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-input-background px-3 py-2 text-base transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}const _M={Settings:ap,LayoutDashboard:LM,Tag:ip,MapPin:ql,Users:QS,Package:mu,FileText:ul,HelpCircle:np,Layers:DM,Type:FM,FileBox:MM};function ow(e){const t=(e??"").trim();return t||"N/A"}function ume(e){const t=e.trim();if(!t)return null;const r=Number.parseInt(t,10);return Number.isFinite(r)?r:null}function dme(){const[e,t]=b.useState([]),[r,n]=b.useState(!1),[a,i]=b.useState(0),[s,u]=b.useState(null),[d,c]=b.useState(""),f=b.useRef(null),[p,m]=b.useState(""),[v,y]=b.useState(!1),[x,w]=b.useState(!1),[j,N]=b.useState(!1),[C,A]=b.useState(null),[E,O]=b.useState(null),T=b.useRef(null);b.useEffect(()=>(f.current&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>m(d.trim()),300),()=>{f.current&&window.clearTimeout(f.current)}),[d]),b.useEffect(()=>((async()=>{T.current?.abort();const I=new AbortController;T.current=I,n(!0);try{const H=await VF({skipCount:1,maxResultCount:5e3,keyword:p||void 0},I.signal);t(H.items??[])}catch(H){if(H?.name==="AbortError")return;me.error("Failed to load system menus.",{description:H?.message?String(H.message):"Please try again."}),t([])}finally{n(!1)}})(),()=>T.current?.abort()),[p,a]);const k=()=>i($=>$+1),M=$=>{u(null),A($),w(!0)},L=$=>{u(null),O($),N(!0)};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"pb-4",children:o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ye,{placeholder:"Search",value:d,onChange:$=>c($.target.value),style:{height:40,boxSizing:"border-box"},className:"border border-gray-300 rounded-md w-40 shrink-0 bg-white placeholder:text-gray-500"}),o.jsx("div",{className:"flex-1"}),o.jsxs(he,{className:"bg-blue-600 text-white hover:bg-blue-700",onClick:()=>y(!0),children:[o.jsx(ln,{className:"w-4 h-4 mr-2"}),"New Menu"]})]})}),o.jsx("div",{className:"flex-1 flex flex-col min-h-0 bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden",children:o.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:o.jsxs(Fr,{children:[o.jsx(Br,{className:"bg-gray-50 sticky top-0 z-10",children:o.jsxs(Be,{className:"hover:bg-gray-50",children:[o.jsx(xe,{className:"font-semibold text-gray-900",children:"Menu Name"}),o.jsx(xe,{className:"font-semibold text-gray-900",children:"Route URL"}),o.jsx(xe,{className:"font-semibold text-gray-900",children:"Router Name"}),o.jsx(xe,{className:"font-semibold text-gray-900",children:"Type"}),o.jsx(xe,{className:"font-semibold text-gray-900",children:"Order"}),o.jsx(xe,{className:"font-semibold text-gray-900",children:"Visible"}),o.jsx(xe,{className:"font-semibold text-gray-900",children:"Enabled"}),o.jsx(xe,{className:"font-semibold text-gray-900 w-16 text-right",children:"Actions"})]})}),o.jsx(zr,{children:e.length===0?o.jsx(Be,{children:o.jsx(fe,{colSpan:8,className:"text-center py-10 text-gray-500",children:r?"Loading...":"No data"})}):e.map($=>o.jsxs(Be,{className:"hover:bg-gray-50",children:[o.jsx(fe,{className:"font-medium text-gray-900",children:ow($.menuName)}),o.jsx(fe,{className:"text-gray-700",children:ow($.routeUrl)}),o.jsx(fe,{className:"text-gray-700",children:ow($.routerName)}),o.jsx(fe,{className:"text-gray-700",children:$.menuType??"N/A"}),o.jsx(fe,{className:"text-gray-700",children:$.orderNum??"N/A"}),o.jsx(fe,{className:"text-gray-700",children:$.isShow?"Yes":"No"}),o.jsx(fe,{className:"text-gray-700",children:$.state?"Yes":"No"}),o.jsx(fe,{className:"text-right",children:o.jsxs(ya,{open:s===$.id,onOpenChange:I=>u(I?$.id:null),children:[o.jsx(xa,{asChild:!0,children:o.jsx(he,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:o.jsx(pi,{className:"h-4 w-4"})})}),o.jsx(ba,{className:"w-44 p-2",align:"end",children:o.jsxs("div",{className:"flex flex-col",children:[o.jsxs(he,{variant:"ghost",className:"justify-start",onClick:()=>M($),children:[o.jsx(Cn,{className:"w-4 h-4 mr-2"}),"Edit"]}),o.jsxs(he,{variant:"ghost",className:"justify-start text-red-600 hover:text-red-700",onClick:()=>L($),children:[o.jsx(Et,{className:"w-4 h-4 mr-2"}),"Delete"]})]})})]})})]},$.id))})]})})}),o.jsx(CM,{mode:"create",open:v,menu:null,onOpenChange:y,onSaved:k}),o.jsx(CM,{mode:"edit",open:x,menu:C,onOpenChange:w,onSaved:k}),o.jsx(fme,{open:j,menu:E,onOpenChange:N,onDeleted:k})]})}function CM({mode:e,open:t,menu:r,onOpenChange:n,onSaved:a}){const i=e==="edit",[s,u]=b.useState(!1),[d,c]=b.useState(""),[f,p]=b.useState(""),[m,v]=b.useState(""),[y,x]=b.useState("menu"),[w,j]=b.useState(""),[N,C]=b.useState(""),[A,E]=b.useState([]),[O,T]=b.useState(!1),[k,M]=b.useState(""),[L,$]=b.useState(""),[I,H]=b.useState(""),[Y,W]=b.useState(""),[V,K]=b.useState(""),[F,te]=b.useState(""),[D,U]=b.useState(!1),[z,B]=b.useState(!0),[X,Q]=b.useState(!0);b.useEffect(()=>{if(!t)return;u(!1),c(r?.menuName??""),p(r?.routerName??""),v(r?.routeUrl??""),x(r?.menuType===0?"directory":"menu"),j(r?.permissionCode??"");const ne=String(r?.parentId??"").trim();C(!ne||ne==="00000000-0000-0000-0000-000000000000"?"":ne),M(r?.menuIcon??""),$(r?.orderNum===null||r?.orderNum===void 0?"":String(r.orderNum)),H(r?.link??""),W(r?.component??""),K(r?.query??""),te(r?.remark??""),U(!!r?.isCache),B(r?.isShow??!0),Q(r?.state??!0)},[t,r]);const re="__parent_root__";b.useEffect(()=>{if(!t)return;let ne=!1;return T(!0),Xhe().then(Ce=>{ne||E(Ce)}).catch(()=>{ne||E([])}).finally(()=>{ne||T(!1)}),()=>{ne=!0}},[t]);const G=ne=>!ne.trim()||ne==="00000000-0000-0000-0000-000000000000",Z=b.useMemo(()=>{const ne=A.filter(pe=>pe.id&&pe.id!==r?.id),Ce=(N||"").trim();return Ce&&!G(Ce)&&!ne.some(pe=>pe.id===Ce)?[...ne,{id:Ce,menuName:`(Current parent) ${Ce}`}]:ne},[A,N,r?.id]),ee=G(N)?re:N,ce=b.useMemo(()=>!!(d.trim()&&m.trim()&&L.trim()),[d,m,L]),ve=async()=>{if(!ce){me.error("Please fill in required fields.",{description:"Menu Name, Route URL, and Order are required."});return}u(!0);try{const ne={menuName:d.trim(),routerName:f.trim()?f.trim():null,routeUrl:m.trim(),menuType:y==="directory"?0:1,permissionCode:w.trim()?w.trim():null,parentId:G(N)?null:N.trim(),menuIcon:k||null,orderNum:ume(L),link:I.trim()?I.trim():null,component:Y.trim()?Y.trim():null,query:V.trim()?V.trim():null,remark:F.trim()?F.trim():null,isCache:D,isShow:z,state:X};if(i){if(!r?.id)throw new Error("Missing id.");await Qhe(r.id,ne),me.success("Menu updated.",{description:"Changes have been saved successfully."})}else await Jhe(ne),me.success("Menu created.",{description:"A new menu has been created successfully."});n(!1),a()}catch(ne){me.error(i?"Failed to update menu.":"Failed to create menu.",{description:ne?.message?String(ne.message):"Please try again."})}finally{u(!1)}};return o.jsx(xt,{open:t,onOpenChange:n,children:o.jsxs(gt,{className:"sm:max-w-none",style:{width:"70%"},children:[o.jsxs(bt,{children:[o.jsx(wt,{children:i?"Edit System Menu":"New System Menu"}),o.jsx(kt,{children:i?"Update system menu fields and save changes.":"Fill out the form to create a new system menu."})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-6 py-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Menu Name *"}),o.jsx(ye,{value:d,onChange:ne=>c(ne.target.value),placeholder:"e.g. Location Manager"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Route URL *"}),o.jsx(ye,{value:m,onChange:ne=>v(ne.target.value),placeholder:"e.g. /location"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Router Name"}),o.jsx(ye,{value:f,onChange:ne=>p(ne.target.value),placeholder:"e.g. location"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Menu Type"}),o.jsxs(Ve,{value:y,onValueChange:ne=>x(ne),children:[o.jsx(We,{className:"h-10 rounded-md border border-gray-200 bg-white",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"directory",children:"Directory"}),o.jsx(je,{value:"menu",children:"Menu"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Permission Code"}),o.jsx(ye,{value:w,onChange:ne=>j(ne.target.value),placeholder:"e.g. sys:menu"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Parent"}),o.jsxs(Ve,{value:ee,disabled:O,onValueChange:ne=>C(ne===re?"":ne),children:[o.jsx(We,{className:"h-10 rounded-md border border-gray-200 bg-white",children:o.jsx(He,{placeholder:O?"Loading…":"Select parent directory"})}),o.jsxs(Ge,{children:[o.jsx(je,{value:re,children:"Root (no parent)"}),Z.map(ne=>o.jsx(je,{value:ne.id,children:ne.menuName?.trim()||ne.id},ne.id))]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Menu Icon"}),o.jsxs(Ve,{value:k||"none",onValueChange:ne=>M(ne==="none"?"":ne),children:[o.jsx(We,{className:"h-10 rounded-md border border-gray-200 bg-white",children:o.jsx(He,{placeholder:"Select an icon"})}),o.jsxs(Ge,{children:[o.jsx(je,{value:"none",children:"None"}),Object.keys(_M).map(ne=>{const Ce=_M[ne];return o.jsx(je,{value:ne,children:o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(Ce,{className:"h-4 w-4"}),ne]})},ne)})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Order *"}),o.jsx(ye,{value:L,onChange:ne=>$(ne.target.value),placeholder:"e.g. 10"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Link"}),o.jsx(ye,{value:I,onChange:ne=>H(ne.target.value),placeholder:"Optional"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Component"}),o.jsx(ye,{value:Y,onChange:ne=>W(ne.target.value),placeholder:"Optional"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Query"}),o.jsx(ye,{value:V,onChange:ne=>K(ne.target.value),placeholder:"Optional"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"Remark"}),o.jsx(cme,{value:F,onChange:ne=>te(ne.target.value),placeholder:"Optional"})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Cache"}),o.jsx(Zt,{checked:D,onCheckedChange:U})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Visible"}),o.jsx(Zt,{checked:z,onCheckedChange:B})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Zt,{checked:X,onCheckedChange:Q})]})]}),o.jsxs(Nt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),o.jsx(he,{className:"min-w-24 bg-blue-600 text-white hover:bg-blue-700",disabled:s,onClick:ve,children:s?"Saving...":i?"Save Changes":"Create"})]})]})})}function fme({open:e,menu:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>{const d=(t?.menuName??"").trim(),c=(t?.routeUrl??"").trim();return d&&c?`${d} (${c})`:d||c||"this menu"},[t?.menuName,t?.routeUrl]),u=async()=>{if(t?.id){i(!0);try{await epe(t.id),me.success("Menu deleted.",{description:"The menu has been removed successfully."}),r(!1),n()}catch(d){me.error("Failed to delete menu.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(xt,{open:e,onOpenChange:r,children:o.jsxs(gt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(bt,{children:[o.jsx(wt,{children:"Delete System Menu"}),o.jsx(kt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(Nt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Et,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}function hme(){const[e,t]=b.useState("Dashboard"),r=()=>{switch(e){case"Dashboard":return o.jsx(Bie,{});case"Training":return o.jsx(Phe,{});case"Alerts":return o.jsx(khe,{});case"Menu Management":return o.jsx(qhe,{});case"System Menu":return o.jsx(dme,{});case"Account Management":return o.jsx(wpe,{});case"Reports":return o.jsx(kpe,{});case"Location Manager":return o.jsx(ame,{});case"Labels":case"Label Categories":case"Label Types":case"Label Templates":case"Multiple Options":return o.jsx(Ohe,{currentView:e,onViewChange:t});default:return o.jsx(zie,{title:e})}};return o.jsxs(o.Fragment,{children:[o.jsx(ZU,{currentView:e,setCurrentView:t,children:r()}),o.jsx(I8,{position:"top-center",richColors:!0,closeButton:!0,expand:!1})]})}s8.createRoot(document.getElementById("root")).render(o.jsx(hme,{})); diff --git a/美国版/Food Labeling Management Platform/build/assets/index-rOdDFGrB.js b/美国版/Food Labeling Management Platform/build/assets/index-rOdDFGrB.js deleted file mode 100644 index d203aba..0000000 --- a/美国版/Food Labeling Management Platform/build/assets/index-rOdDFGrB.js +++ /dev/null @@ -1,458 +0,0 @@ -function R8(e,t){for(var r=0;rn[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();var Bf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ht(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xy={exports:{}},Lc={},by={exports:{}},it={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var lE;function I8(){if(lE)return it;lE=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.iterator;function m(L){return L===null||typeof L!="object"?null:(L=p&&L[p]||L["@@iterator"],typeof L=="function"?L:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,y={};function w(L,I,X){this.props=L,this.context=I,this.refs=y,this.updater=X||v}w.prototype.isReactComponent={},w.prototype.setState=function(L,I){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,I,"setState")},w.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function j(){}j.prototype=w.prototype;function _(L,I,X){this.props=L,this.context=I,this.refs=y,this.updater=X||v}var C=_.prototype=new j;C.constructor=_,x(C,w.prototype),C.isPureReactComponent=!0;var A=Array.isArray,E=Object.prototype.hasOwnProperty,O={current:null},T={key:!0,ref:!0,__self:!0,__source:!0};function k(L,I,X){var ee,ie={},re=null,K=null;if(I!=null)for(ee in I.ref!==void 0&&(K=I.ref),I.key!==void 0&&(re=""+I.key),I)E.call(I,ee)&&!T.hasOwnProperty(ee)&&(ie[ee]=I[ee]);var Z=arguments.length-2;if(Z===1)ie.children=X;else if(1>>1,I=B[L];if(0>>1;La(ie,R))rea(K,ie)?(B[L]=K,B[re]=R,L=re):(B[L]=ie,B[ee]=R,L=ee);else if(rea(K,R))B[L]=K,B[re]=R,L=re;else break e}}return Q}function a(B,Q){var R=B.sortIndex-Q.sortIndex;return R!==0?R:B.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,u=s.now();e.unstable_now=function(){return s.now()-u}}var d=[],c=[],h=1,p=null,m=3,v=!1,x=!1,y=!1,w=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(B){for(var Q=r(c);Q!==null;){if(Q.callback===null)n(c);else if(Q.startTime<=B)n(c),Q.sortIndex=Q.expirationTime,t(d,Q);else break;Q=r(c)}}function A(B){if(y=!1,C(B),!x)if(r(d)!==null)x=!0,H(E);else{var Q=r(c);Q!==null&&W(A,Q.startTime-B)}}function E(B,Q){x=!1,y&&(y=!1,j(k),k=-1),v=!0;var R=m;try{for(C(Q),p=r(d);p!==null&&(!(p.expirationTime>Q)||B&&!z());){var L=p.callback;if(typeof L=="function"){p.callback=null,m=p.priorityLevel;var I=L(p.expirationTime<=Q);Q=e.unstable_now(),typeof I=="function"?p.callback=I:p===r(d)&&n(d),C(Q)}else n(d);p=r(d)}if(p!==null)var X=!0;else{var ee=r(c);ee!==null&&W(A,ee.startTime-Q),X=!1}return X}finally{p=null,m=R,v=!1}}var O=!1,T=null,k=-1,M=5,$=-1;function z(){return!(e.unstable_now()-$B||125L?(B.sortIndex=R,t(c,B),r(d)===null&&B===r(c)&&(y?(j(k),k=-1):y=!0,W(A,R-L))):(B.sortIndex=I,t(d,B),x||v||(x=!0,H(E))),B},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(B){var Q=m;return function(){var R=m;m=Q;try{return B.apply(this,arguments)}finally{m=R}}}})(jy)),jy}var hE;function $8(){return hE||(hE=1,Sy.exports=L8()),Sy.exports}/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var pE;function B8(){if(pE)return Yr;pE=1;var e=gm(),t=$8();function r(l){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+l,g=1;g"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,c=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h={},p={};function m(l){return d.call(p,l)?!0:d.call(h,l)?!1:c.test(l)?p[l]=!0:(h[l]=!0,!1)}function v(l,f,g,S){if(g!==null&&g.type===0)return!1;switch(typeof f){case"function":case"symbol":return!0;case"boolean":return S?!1:g!==null?!g.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function x(l,f,g,S){if(f===null||typeof f>"u"||v(l,f,g,S))return!0;if(S)return!1;if(g!==null)switch(g.type){case 3:return!f;case 4:return f===!1;case 5:return isNaN(f);case 6:return isNaN(f)||1>f}return!1}function y(l,f,g,S,N,P,D){this.acceptsBooleans=f===2||f===3||f===4,this.attributeName=S,this.attributeNamespace=N,this.mustUseProperty=g,this.propertyName=l,this.type=f,this.sanitizeURL=P,this.removeEmptyString=D}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){w[l]=new y(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var f=l[0];w[f]=new y(f,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){w[l]=new y(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){w[l]=new y(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){w[l]=new y(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){w[l]=new y(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){w[l]=new y(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){w[l]=new y(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){w[l]=new y(l,5,!1,l.toLowerCase(),null,!1,!1)});var j=/[\-:]([a-z])/g;function _(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var f=l.replace(j,_);w[f]=new y(f,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var f=l.replace(j,_);w[f]=new y(f,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var f=l.replace(j,_);w[f]=new y(f,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){w[l]=new y(l,1,!1,l.toLowerCase(),null,!1,!1)}),w.xlinkHref=new y("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){w[l]=new y(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,f,g,S){var N=w.hasOwnProperty(f)?w[f]:null;(N!==null?N.type!==0:S||!(2J||N[D]!==P[J]){var te=` -`+N[D].replace(" at new "," at ");return l.displayName&&te.includes("")&&(te=te.replace("",l.displayName)),te}while(1<=D&&0<=J);break}}}finally{X=!1,Error.prepareStackTrace=g}return(l=l?l.displayName||l.name:"")?I(l):""}function ie(l){switch(l.tag){case 5:return I(l.type);case 16:return I("Lazy");case 13:return I("Suspense");case 19:return I("SuspenseList");case 0:case 2:case 15:return l=ee(l.type,!1),l;case 11:return l=ee(l.type.render,!1),l;case 1:return l=ee(l.type,!0),l;default:return""}}function re(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case T:return"Fragment";case O:return"Portal";case M:return"Profiler";case k:return"StrictMode";case V:return"Suspense";case G:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case z:return(l.displayName||"Context")+".Consumer";case $:return(l._context.displayName||"Context")+".Provider";case F:var f=l.render;return l=l.displayName,l||(l=f.displayName||f.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case U:return f=l.displayName||null,f!==null?f:re(l.type)||"Memo";case H:f=l._payload,l=l._init;try{return re(l(f))}catch{}}return null}function K(l){var f=l.type;switch(l.tag){case 24:return"Cache";case 9:return(f.displayName||"Context")+".Consumer";case 10:return(f._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=f.render,l=l.displayName||l.name||"",f.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return f;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return re(f);case 8:return f===k?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof f=="function")return f.displayName||f.name||null;if(typeof f=="string")return f}return null}function Z(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ne(l){var f=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(f==="checkbox"||f==="radio")}function de(l){var f=ne(l)?"checked":"value",g=Object.getOwnPropertyDescriptor(l.constructor.prototype,f),S=""+l[f];if(!l.hasOwnProperty(f)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var N=g.get,P=g.set;return Object.defineProperty(l,f,{configurable:!0,get:function(){return N.call(this)},set:function(D){S=""+D,P.call(this,D)}}),Object.defineProperty(l,f,{enumerable:g.enumerable}),{getValue:function(){return S},setValue:function(D){S=""+D},stopTracking:function(){l._valueTracker=null,delete l[f]}}}}function ge(l){l._valueTracker||(l._valueTracker=de(l))}function Y(l){if(!l)return!1;var f=l._valueTracker;if(!f)return!0;var g=f.getValue(),S="";return l&&(S=ne(l)?l.checked?"true":"false":l.value),l=S,l!==g?(f.setValue(l),!0):!1}function we(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function Ce(l,f){var g=f.checked;return R({},f,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:g??l._wrapperState.initialChecked})}function Be(l,f){var g=f.defaultValue==null?"":f.defaultValue,S=f.checked!=null?f.checked:f.defaultChecked;g=Z(f.value!=null?f.value:g),l._wrapperState={initialChecked:S,initialValue:g,controlled:f.type==="checkbox"||f.type==="radio"?f.checked!=null:f.value!=null}}function et(l,f){f=f.checked,f!=null&&C(l,"checked",f,!1)}function tt(l,f){et(l,f);var g=Z(f.value),S=f.type;if(g!=null)S==="number"?(g===0&&l.value===""||l.value!=g)&&(l.value=""+g):l.value!==""+g&&(l.value=""+g);else if(S==="submit"||S==="reset"){l.removeAttribute("value");return}f.hasOwnProperty("value")?jt(l,f.type,g):f.hasOwnProperty("defaultValue")&&jt(l,f.type,Z(f.defaultValue)),f.checked==null&&f.defaultChecked!=null&&(l.defaultChecked=!!f.defaultChecked)}function St(l,f,g){if(f.hasOwnProperty("value")||f.hasOwnProperty("defaultValue")){var S=f.type;if(!(S!=="submit"&&S!=="reset"||f.value!==void 0&&f.value!==null))return;f=""+l._wrapperState.initialValue,g||f===l.value||(l.value=f),l.defaultValue=f}g=l.name,g!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,g!==""&&(l.name=g)}function jt(l,f,g){(f!=="number"||we(l.ownerDocument)!==l)&&(g==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+g&&(l.defaultValue=""+g))}var Kt=Array.isArray;function _t(l,f,g,S){if(l=l.options,f){f={};for(var N=0;N"+f.valueOf().toString()+"",f=Pn.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;f.firstChild;)l.appendChild(f.firstChild)}});function br(l,f){if(f){var g=l.firstChild;if(g&&g===l.lastChild&&g.nodeType===3){g.nodeValue=f;return}}l.textContent=f}var Dr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},An=["Webkit","ms","Moz","O"];Object.keys(Dr).forEach(function(l){An.forEach(function(f){f=f+l.charAt(0).toUpperCase()+l.substring(1),Dr[f]=Dr[l]})});function Ha(l,f,g){return f==null||typeof f=="boolean"||f===""?"":g||typeof f!="number"||f===0||Dr.hasOwnProperty(l)&&Dr[l]?(""+f).trim():f+"px"}function ja(l,f){l=l.style;for(var g in f)if(f.hasOwnProperty(g)){var S=g.indexOf("--")===0,N=Ha(g,f[g],S);g==="float"&&(g="cssFloat"),S?l.setProperty(g,N):l[g]=N}}var Ci=R({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ae(l,f){if(f){if(Ci[l]&&(f.children!=null||f.dangerouslySetInnerHTML!=null))throw Error(r(137,l));if(f.dangerouslySetInnerHTML!=null){if(f.children!=null)throw Error(r(60));if(typeof f.dangerouslySetInnerHTML!="object"||!("__html"in f.dangerouslySetInnerHTML))throw Error(r(61))}if(f.style!=null&&typeof f.style!="object")throw Error(r(62))}}function Te(l,f){if(l.indexOf("-")===-1)return typeof f.is=="string";switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ke=null;function Ft(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var Lt=null,Na=null,Tn=null;function Wa(l){if(l=Sc(l)){if(typeof Lt!="function")throw Error(r(280));var f=l.stateNode;f&&(f=Zd(f),Lt(l.stateNode,l.type,f))}}function Qe(l){Na?Tn?Tn.push(l):Tn=[l]:Na=l}function Xt(){if(Na){var l=Na,f=Tn;if(Tn=Na=null,Wa(l),f)for(l=0;l>>=0,l===0?32:31-(XB(l)/YB|0)|0}var Md=64,Dd=4194304;function ac(l){switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function Ld(l,f){var g=l.pendingLanes;if(g===0)return 0;var S=0,N=l.suspendedLanes,P=l.pingedLanes,D=g&268435455;if(D!==0){var J=D&~N;J!==0?S=ac(J):(P&=D,P!==0&&(S=ac(P)))}else D=g&~N,D!==0?S=ac(D):P!==0&&(S=ac(P));if(S===0)return 0;if(f!==0&&f!==S&&(f&N)===0&&(N=S&-S,P=f&-f,N>=P||N===16&&(P&4194240)!==0))return f;if((S&4)!==0&&(S|=g&16),f=l.entangledLanes,f!==0)for(l=l.entanglements,f&=S;0g;g++)f.push(l);return f}function ic(l,f,g){l.pendingLanes|=f,f!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,f=31-Yn(f),l[f]=g}function eF(l,f){var g=l.pendingLanes&~f;l.pendingLanes=f,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=f,l.mutableReadLanes&=f,l.entangledLanes&=f,f=l.entanglements;var S=l.eventTimes;for(l=l.expirationTimes;0=hc),t_=" ",r_=!1;function n_(l,f){switch(l){case"keyup":return OF.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function a_(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ds=!1;function AF(l,f){switch(l){case"compositionend":return a_(f);case"keypress":return f.which!==32?null:(r_=!0,t_);case"textInput":return l=f.data,l===t_&&r_?null:l;default:return null}}function TF(l,f){if(ds)return l==="compositionend"||!Zg&&n_(l,f)?(l=XN(),qd=Gg=Ii=null,ds=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(f.ctrlKey||f.altKey||f.metaKey)||f.ctrlKey&&f.altKey){if(f.char&&1=f)return{node:g,offset:f-l};l=S}e:{for(;g;){if(g.nextSibling){g=g.nextSibling;break e}g=g.parentNode}g=void 0}g=d_(g)}}function h_(l,f){return l&&f?l===f?!0:l&&l.nodeType===3?!1:f&&f.nodeType===3?h_(l,f.parentNode):"contains"in l?l.contains(f):l.compareDocumentPosition?!!(l.compareDocumentPosition(f)&16):!1:!1}function p_(){for(var l=window,f=we();f instanceof l.HTMLIFrameElement;){try{var g=typeof f.contentWindow.location.href=="string"}catch{g=!1}if(g)l=f.contentWindow;else break;f=we(l.document)}return f}function rv(l){var f=l&&l.nodeName&&l.nodeName.toLowerCase();return f&&(f==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||f==="textarea"||l.contentEditable==="true")}function FF(l){var f=p_(),g=l.focusedElem,S=l.selectionRange;if(f!==g&&g&&g.ownerDocument&&h_(g.ownerDocument.documentElement,g)){if(S!==null&&rv(g)){if(f=S.start,l=S.end,l===void 0&&(l=f),"selectionStart"in g)g.selectionStart=f,g.selectionEnd=Math.min(l,g.value.length);else if(l=(f=g.ownerDocument||document)&&f.defaultView||window,l.getSelection){l=l.getSelection();var N=g.textContent.length,P=Math.min(S.start,N);S=S.end===void 0?P:Math.min(S.end,N),!l.extend&&P>S&&(N=S,S=P,P=N),N=f_(g,P);var D=f_(g,S);N&&D&&(l.rangeCount!==1||l.anchorNode!==N.node||l.anchorOffset!==N.offset||l.focusNode!==D.node||l.focusOffset!==D.offset)&&(f=f.createRange(),f.setStart(N.node,N.offset),l.removeAllRanges(),P>S?(l.addRange(f),l.extend(D.node,D.offset)):(f.setEnd(D.node,D.offset),l.addRange(f)))}}for(f=[],l=g;l=l.parentNode;)l.nodeType===1&&f.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g=document.documentMode,fs=null,nv=null,vc=null,av=!1;function m_(l,f,g){var S=g.window===g?g.document:g.nodeType===9?g:g.ownerDocument;av||fs==null||fs!==we(S)||(S=fs,"selectionStart"in S&&rv(S)?S={start:S.selectionStart,end:S.selectionEnd}:(S=(S.ownerDocument&&S.ownerDocument.defaultView||window).getSelection(),S={anchorNode:S.anchorNode,anchorOffset:S.anchorOffset,focusNode:S.focusNode,focusOffset:S.focusOffset}),vc&&gc(vc,S)||(vc=S,S=Yd(nv,"onSelect"),0vs||(l.current=gv[vs],gv[vs]=null,vs--)}function At(l,f){vs++,gv[vs]=l.current,l.current=f}var $i={},Cr=Li($i),Hr=Li(!1),go=$i;function ys(l,f){var g=l.type.contextTypes;if(!g)return $i;var S=l.stateNode;if(S&&S.__reactInternalMemoizedUnmaskedChildContext===f)return S.__reactInternalMemoizedMaskedChildContext;var N={},P;for(P in g)N[P]=f[P];return S&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=f,l.__reactInternalMemoizedMaskedChildContext=N),N}function Wr(l){return l=l.childContextTypes,l!=null}function ef(){Mt(Hr),Mt(Cr)}function A_(l,f,g){if(Cr.current!==$i)throw Error(r(168));At(Cr,f),At(Hr,g)}function T_(l,f,g){var S=l.stateNode;if(f=f.childContextTypes,typeof S.getChildContext!="function")return g;S=S.getChildContext();for(var N in S)if(!(N in f))throw Error(r(108,K(l)||"Unknown",N));return R({},g,S)}function tf(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||$i,go=Cr.current,At(Cr,l),At(Hr,Hr.current),!0}function k_(l,f,g){var S=l.stateNode;if(!S)throw Error(r(169));g?(l=T_(l,f,go),S.__reactInternalMemoizedMergedChildContext=l,Mt(Hr),Mt(Cr),At(Cr,l)):Mt(Hr),At(Hr,g)}var Ka=null,rf=!1,vv=!1;function R_(l){Ka===null?Ka=[l]:Ka.push(l)}function QF(l){rf=!0,R_(l)}function Bi(){if(!vv&&Ka!==null){vv=!0;var l=0,f=bt;try{var g=Ka;for(bt=1;l>=D,N-=D,Xa=1<<32-Yn(f)+N|g<Xe?(gr=ze,ze=null):gr=ze.sibling;var ut=xe(se,ze,le[Xe],je);if(ut===null){ze===null&&(ze=gr);break}l&&ze&&ut.alternate===null&&f(se,ze),oe=P(ut,oe,Xe),Fe===null?De=ut:Fe.sibling=ut,Fe=ut,ze=gr}if(Xe===le.length)return g(se,ze),$t&&yo(se,Xe),De;if(ze===null){for(;XeXe?(gr=ze,ze=null):gr=ze.sibling;var Ki=xe(se,ze,ut.value,je);if(Ki===null){ze===null&&(ze=gr);break}l&&ze&&Ki.alternate===null&&f(se,ze),oe=P(Ki,oe,Xe),Fe===null?De=Ki:Fe.sibling=Ki,Fe=Ki,ze=gr}if(ut.done)return g(se,ze),$t&&yo(se,Xe),De;if(ze===null){for(;!ut.done;Xe++,ut=le.next())ut=Se(se,ut.value,je),ut!==null&&(oe=P(ut,oe,Xe),Fe===null?De=ut:Fe.sibling=ut,Fe=ut);return $t&&yo(se,Xe),De}for(ze=S(se,ze);!ut.done;Xe++,ut=le.next())ut=Oe(ze,se,Xe,ut.value,je),ut!==null&&(l&&ut.alternate!==null&&ze.delete(ut.key===null?Xe:ut.key),oe=P(ut,oe,Xe),Fe===null?De=ut:Fe.sibling=ut,Fe=ut);return l&&ze.forEach(function(k8){return f(se,k8)}),$t&&yo(se,Xe),De}function Jt(se,oe,le,je){if(typeof le=="object"&&le!==null&&le.type===T&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case E:e:{for(var De=le.key,Fe=oe;Fe!==null;){if(Fe.key===De){if(De=le.type,De===T){if(Fe.tag===7){g(se,Fe.sibling),oe=N(Fe,le.props.children),oe.return=se,se=oe;break e}}else if(Fe.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===H&&B_(De)===Fe.type){g(se,Fe.sibling),oe=N(Fe,le.props),oe.ref=jc(se,Fe,le),oe.return=se,se=oe;break e}g(se,Fe);break}else f(se,Fe);Fe=Fe.sibling}le.type===T?(oe=Co(le.props.children,se.mode,je,le.key),oe.return=se,se=oe):(je=Tf(le.type,le.key,le.props,null,se.mode,je),je.ref=jc(se,oe,le),je.return=se,se=je)}return D(se);case O:e:{for(Fe=le.key;oe!==null;){if(oe.key===Fe)if(oe.tag===4&&oe.stateNode.containerInfo===le.containerInfo&&oe.stateNode.implementation===le.implementation){g(se,oe.sibling),oe=N(oe,le.children||[]),oe.return=se,se=oe;break e}else{g(se,oe);break}else f(se,oe);oe=oe.sibling}oe=py(le,se.mode,je),oe.return=se,se=oe}return D(se);case H:return Fe=le._init,Jt(se,oe,Fe(le._payload),je)}if(Kt(le))return ke(se,oe,le,je);if(Q(le))return Me(se,oe,le,je);sf(se,le)}return typeof le=="string"&&le!==""||typeof le=="number"?(le=""+le,oe!==null&&oe.tag===6?(g(se,oe.sibling),oe=N(oe,le),oe.return=se,se=oe):(g(se,oe),oe=hy(le,se.mode,je),oe.return=se,se=oe),D(se)):g(se,oe)}return Jt}var Ss=F_(!0),z_=F_(!1),lf=Li(null),cf=null,js=null,jv=null;function Nv(){jv=js=cf=null}function _v(l){var f=lf.current;Mt(lf),l._currentValue=f}function Cv(l,f,g){for(;l!==null;){var S=l.alternate;if((l.childLanes&f)!==f?(l.childLanes|=f,S!==null&&(S.childLanes|=f)):S!==null&&(S.childLanes&f)!==f&&(S.childLanes|=f),l===g)break;l=l.return}}function Ns(l,f){cf=l,jv=js=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&f)!==0&&(Gr=!0),l.firstContext=null)}function Mn(l){var f=l._currentValue;if(jv!==l)if(l={context:l,memoizedValue:f,next:null},js===null){if(cf===null)throw Error(r(308));js=l,cf.dependencies={lanes:0,firstContext:l}}else js=js.next=l;return f}var xo=null;function Ev(l){xo===null?xo=[l]:xo.push(l)}function q_(l,f,g,S){var N=f.interleaved;return N===null?(g.next=g,Ev(f)):(g.next=N.next,N.next=g),f.interleaved=g,Ja(l,S)}function Ja(l,f){l.lanes|=f;var g=l.alternate;for(g!==null&&(g.lanes|=f),g=l,l=l.return;l!==null;)l.childLanes|=f,g=l.alternate,g!==null&&(g.childLanes|=f),g=l,l=l.return;return g.tag===3?g.stateNode:null}var Fi=!1;function Ov(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function U_(l,f){l=l.updateQueue,f.updateQueue===l&&(f.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function Qa(l,f){return{eventTime:l,lane:f,tag:0,payload:null,callback:null,next:null}}function zi(l,f,g){var S=l.updateQueue;if(S===null)return null;if(S=S.shared,(lt&2)!==0){var N=S.pending;return N===null?f.next=f:(f.next=N.next,N.next=f),S.pending=f,Ja(l,g)}return N=S.interleaved,N===null?(f.next=f,Ev(S)):(f.next=N.next,N.next=f),S.interleaved=f,Ja(l,g)}function uf(l,f,g){if(f=f.updateQueue,f!==null&&(f=f.shared,(g&4194240)!==0)){var S=f.lanes;S&=l.pendingLanes,g|=S,f.lanes=g,qg(l,g)}}function V_(l,f){var g=l.updateQueue,S=l.alternate;if(S!==null&&(S=S.updateQueue,g===S)){var N=null,P=null;if(g=g.firstBaseUpdate,g!==null){do{var D={eventTime:g.eventTime,lane:g.lane,tag:g.tag,payload:g.payload,callback:g.callback,next:null};P===null?N=P=D:P=P.next=D,g=g.next}while(g!==null);P===null?N=P=f:P=P.next=f}else N=P=f;g={baseState:S.baseState,firstBaseUpdate:N,lastBaseUpdate:P,shared:S.shared,effects:S.effects},l.updateQueue=g;return}l=g.lastBaseUpdate,l===null?g.firstBaseUpdate=f:l.next=f,g.lastBaseUpdate=f}function df(l,f,g,S){var N=l.updateQueue;Fi=!1;var P=N.firstBaseUpdate,D=N.lastBaseUpdate,J=N.shared.pending;if(J!==null){N.shared.pending=null;var te=J,ce=te.next;te.next=null,D===null?P=ce:D.next=ce,D=te;var be=l.alternate;be!==null&&(be=be.updateQueue,J=be.lastBaseUpdate,J!==D&&(J===null?be.firstBaseUpdate=ce:J.next=ce,be.lastBaseUpdate=te))}if(P!==null){var Se=N.baseState;D=0,be=ce=te=null,J=P;do{var xe=J.lane,Oe=J.eventTime;if((S&xe)===xe){be!==null&&(be=be.next={eventTime:Oe,lane:0,tag:J.tag,payload:J.payload,callback:J.callback,next:null});e:{var ke=l,Me=J;switch(xe=f,Oe=g,Me.tag){case 1:if(ke=Me.payload,typeof ke=="function"){Se=ke.call(Oe,Se,xe);break e}Se=ke;break e;case 3:ke.flags=ke.flags&-65537|128;case 0:if(ke=Me.payload,xe=typeof ke=="function"?ke.call(Oe,Se,xe):ke,xe==null)break e;Se=R({},Se,xe);break e;case 2:Fi=!0}}J.callback!==null&&J.lane!==0&&(l.flags|=64,xe=N.effects,xe===null?N.effects=[J]:xe.push(J))}else Oe={eventTime:Oe,lane:xe,tag:J.tag,payload:J.payload,callback:J.callback,next:null},be===null?(ce=be=Oe,te=Se):be=be.next=Oe,D|=xe;if(J=J.next,J===null){if(J=N.shared.pending,J===null)break;xe=J,J=xe.next,xe.next=null,N.lastBaseUpdate=xe,N.shared.pending=null}}while(!0);if(be===null&&(te=Se),N.baseState=te,N.firstBaseUpdate=ce,N.lastBaseUpdate=be,f=N.shared.interleaved,f!==null){N=f;do D|=N.lane,N=N.next;while(N!==f)}else P===null&&(N.shared.lanes=0);So|=D,l.lanes=D,l.memoizedState=Se}}function H_(l,f,g){if(l=f.effects,f.effects=null,l!==null)for(f=0;fg?g:4,l(!0);var S=Rv.transition;Rv.transition={};try{l(!1),f()}finally{bt=g,Rv.transition=S}}function uC(){return Dn().memoizedState}function r8(l,f,g){var S=Hi(l);if(g={lane:S,action:g,hasEagerState:!1,eagerState:null,next:null},dC(l))fC(f,g);else if(g=q_(l,f,g,S),g!==null){var N=$r();ra(g,l,S,N),hC(g,f,S)}}function n8(l,f,g){var S=Hi(l),N={lane:S,action:g,hasEagerState:!1,eagerState:null,next:null};if(dC(l))fC(f,N);else{var P=l.alternate;if(l.lanes===0&&(P===null||P.lanes===0)&&(P=f.lastRenderedReducer,P!==null))try{var D=f.lastRenderedState,J=P(D,g);if(N.hasEagerState=!0,N.eagerState=J,Jn(J,D)){var te=f.interleaved;te===null?(N.next=N,Ev(f)):(N.next=te.next,te.next=N),f.interleaved=N;return}}catch{}finally{}g=q_(l,f,N,S),g!==null&&(N=$r(),ra(g,l,S,N),hC(g,f,S))}}function dC(l){var f=l.alternate;return l===qt||f!==null&&f===qt}function fC(l,f){Ec=pf=!0;var g=l.pending;g===null?f.next=f:(f.next=g.next,g.next=f),l.pending=f}function hC(l,f,g){if((g&4194240)!==0){var S=f.lanes;S&=l.pendingLanes,g|=S,f.lanes=g,qg(l,g)}}var vf={readContext:Mn,useCallback:Er,useContext:Er,useEffect:Er,useImperativeHandle:Er,useInsertionEffect:Er,useLayoutEffect:Er,useMemo:Er,useReducer:Er,useRef:Er,useState:Er,useDebugValue:Er,useDeferredValue:Er,useTransition:Er,useMutableSource:Er,useSyncExternalStore:Er,useId:Er,unstable_isNewReconciler:!1},a8={readContext:Mn,useCallback:function(l,f){return Oa().memoizedState=[l,f===void 0?null:f],l},useContext:Mn,useEffect:rC,useImperativeHandle:function(l,f,g){return g=g!=null?g.concat([l]):null,mf(4194308,4,iC.bind(null,f,l),g)},useLayoutEffect:function(l,f){return mf(4194308,4,l,f)},useInsertionEffect:function(l,f){return mf(4,2,l,f)},useMemo:function(l,f){var g=Oa();return f=f===void 0?null:f,l=l(),g.memoizedState=[l,f],l},useReducer:function(l,f,g){var S=Oa();return f=g!==void 0?g(f):f,S.memoizedState=S.baseState=f,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:f},S.queue=l,l=l.dispatch=r8.bind(null,qt,l),[S.memoizedState,l]},useRef:function(l){var f=Oa();return l={current:l},f.memoizedState=l},useState:eC,useDebugValue:Fv,useDeferredValue:function(l){return Oa().memoizedState=l},useTransition:function(){var l=eC(!1),f=l[0];return l=t8.bind(null,l[1]),Oa().memoizedState=l,[f,l]},useMutableSource:function(){},useSyncExternalStore:function(l,f,g){var S=qt,N=Oa();if($t){if(g===void 0)throw Error(r(407));g=g()}else{if(g=f(),mr===null)throw Error(r(349));(wo&30)!==0||X_(S,f,g)}N.memoizedState=g;var P={value:g,getSnapshot:f};return N.queue=P,rC(J_.bind(null,S,P,l),[l]),S.flags|=2048,Ac(9,Y_.bind(null,S,P,g,f),void 0,null),g},useId:function(){var l=Oa(),f=mr.identifierPrefix;if($t){var g=Ya,S=Xa;g=(S&~(1<<32-Yn(S)-1)).toString(32)+g,f=":"+f+"R"+g,g=Oc++,0<\/script>",l=l.removeChild(l.firstChild)):typeof S.is=="string"?l=D.createElement(g,{is:S.is}):(l=D.createElement(g),g==="select"&&(D=l,S.multiple?D.multiple=!0:S.size&&(D.size=S.size))):l=D.createElementNS(l,g),l[Ca]=f,l[wc]=S,RC(l,f,!1,!1),f.stateNode=l;e:{switch(D=Te(g,S),g){case"dialog":It("cancel",l),It("close",l),N=S;break;case"iframe":case"object":case"embed":It("load",l),N=S;break;case"video":case"audio":for(N=0;NPs&&(f.flags|=128,S=!0,Tc(P,!1),f.lanes=4194304)}else{if(!S)if(l=ff(D),l!==null){if(f.flags|=128,S=!0,g=l.updateQueue,g!==null&&(f.updateQueue=g,f.flags|=4),Tc(P,!0),P.tail===null&&P.tailMode==="hidden"&&!D.alternate&&!$t)return Or(f),null}else 2*Yt()-P.renderingStartTime>Ps&&g!==1073741824&&(f.flags|=128,S=!0,Tc(P,!1),f.lanes=4194304);P.isBackwards?(D.sibling=f.child,f.child=D):(g=P.last,g!==null?g.sibling=D:f.child=D,P.last=D)}return P.tail!==null?(f=P.tail,P.rendering=f,P.tail=f.sibling,P.renderingStartTime=Yt(),f.sibling=null,g=zt.current,At(zt,S?g&1|2:g&1),f):(Or(f),null);case 22:case 23:return uy(),S=f.memoizedState!==null,l!==null&&l.memoizedState!==null!==S&&(f.flags|=8192),S&&(f.mode&1)!==0?(un&1073741824)!==0&&(Or(f),f.subtreeFlags&6&&(f.flags|=8192)):Or(f),null;case 24:return null;case 25:return null}throw Error(r(156,f.tag))}function f8(l,f){switch(xv(f),f.tag){case 1:return Wr(f.type)&&ef(),l=f.flags,l&65536?(f.flags=l&-65537|128,f):null;case 3:return _s(),Mt(Hr),Mt(Cr),kv(),l=f.flags,(l&65536)!==0&&(l&128)===0?(f.flags=l&-65537|128,f):null;case 5:return Av(f),null;case 13:if(Mt(zt),l=f.memoizedState,l!==null&&l.dehydrated!==null){if(f.alternate===null)throw Error(r(340));ws()}return l=f.flags,l&65536?(f.flags=l&-65537|128,f):null;case 19:return Mt(zt),null;case 4:return _s(),null;case 10:return _v(f.type._context),null;case 22:case 23:return uy(),null;case 24:return null;default:return null}}var wf=!1,Pr=!1,h8=typeof WeakSet=="function"?WeakSet:Set,Pe=null;function Es(l,f){var g=l.ref;if(g!==null)if(typeof g=="function")try{g(null)}catch(S){Ut(l,f,S)}else g.current=null}function Qv(l,f,g){try{g()}catch(S){Ut(l,f,S)}}var DC=!1;function p8(l,f){if(uv=Fd,l=p_(),rv(l)){if("selectionStart"in l)var g={start:l.selectionStart,end:l.selectionEnd};else e:{g=(g=l.ownerDocument)&&g.defaultView||window;var S=g.getSelection&&g.getSelection();if(S&&S.rangeCount!==0){g=S.anchorNode;var N=S.anchorOffset,P=S.focusNode;S=S.focusOffset;try{g.nodeType,P.nodeType}catch{g=null;break e}var D=0,J=-1,te=-1,ce=0,be=0,Se=l,xe=null;t:for(;;){for(var Oe;Se!==g||N!==0&&Se.nodeType!==3||(J=D+N),Se!==P||S!==0&&Se.nodeType!==3||(te=D+S),Se.nodeType===3&&(D+=Se.nodeValue.length),(Oe=Se.firstChild)!==null;)xe=Se,Se=Oe;for(;;){if(Se===l)break t;if(xe===g&&++ce===N&&(J=D),xe===P&&++be===S&&(te=D),(Oe=Se.nextSibling)!==null)break;Se=xe,xe=Se.parentNode}Se=Oe}g=J===-1||te===-1?null:{start:J,end:te}}else g=null}g=g||{start:0,end:0}}else g=null;for(dv={focusedElem:l,selectionRange:g},Fd=!1,Pe=f;Pe!==null;)if(f=Pe,l=f.child,(f.subtreeFlags&1028)!==0&&l!==null)l.return=f,Pe=l;else for(;Pe!==null;){f=Pe;try{var ke=f.alternate;if((f.flags&1024)!==0)switch(f.tag){case 0:case 11:case 15:break;case 1:if(ke!==null){var Me=ke.memoizedProps,Jt=ke.memoizedState,se=f.stateNode,oe=se.getSnapshotBeforeUpdate(f.elementType===f.type?Me:Zn(f.type,Me),Jt);se.__reactInternalSnapshotBeforeUpdate=oe}break;case 3:var le=f.stateNode.containerInfo;le.nodeType===1?le.textContent="":le.nodeType===9&&le.documentElement&&le.removeChild(le.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(je){Ut(f,f.return,je)}if(l=f.sibling,l!==null){l.return=f.return,Pe=l;break}Pe=f.return}return ke=DC,DC=!1,ke}function kc(l,f,g){var S=f.updateQueue;if(S=S!==null?S.lastEffect:null,S!==null){var N=S=S.next;do{if((N.tag&l)===l){var P=N.destroy;N.destroy=void 0,P!==void 0&&Qv(f,g,P)}N=N.next}while(N!==S)}}function Sf(l,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var g=f=f.next;do{if((g.tag&l)===l){var S=g.create;g.destroy=S()}g=g.next}while(g!==f)}}function Zv(l){var f=l.ref;if(f!==null){var g=l.stateNode;switch(l.tag){case 5:l=g;break;default:l=g}typeof f=="function"?f(l):f.current=l}}function LC(l){var f=l.alternate;f!==null&&(l.alternate=null,LC(f)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(f=l.stateNode,f!==null&&(delete f[Ca],delete f[wc],delete f[mv],delete f[YF],delete f[JF])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function $C(l){return l.tag===5||l.tag===3||l.tag===4}function BC(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||$C(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function ey(l,f,g){var S=l.tag;if(S===5||S===6)l=l.stateNode,f?g.nodeType===8?g.parentNode.insertBefore(l,f):g.insertBefore(l,f):(g.nodeType===8?(f=g.parentNode,f.insertBefore(l,g)):(f=g,f.appendChild(l)),g=g._reactRootContainer,g!=null||f.onclick!==null||(f.onclick=Qd));else if(S!==4&&(l=l.child,l!==null))for(ey(l,f,g),l=l.sibling;l!==null;)ey(l,f,g),l=l.sibling}function ty(l,f,g){var S=l.tag;if(S===5||S===6)l=l.stateNode,f?g.insertBefore(l,f):g.appendChild(l);else if(S!==4&&(l=l.child,l!==null))for(ty(l,f,g),l=l.sibling;l!==null;)ty(l,f,g),l=l.sibling}var Sr=null,ea=!1;function qi(l,f,g){for(g=g.child;g!==null;)FC(l,f,g),g=g.sibling}function FC(l,f,g){if(_a&&typeof _a.onCommitFiberUnmount=="function")try{_a.onCommitFiberUnmount(Id,g)}catch{}switch(g.tag){case 5:Pr||Es(g,f);case 6:var S=Sr,N=ea;Sr=null,qi(l,f,g),Sr=S,ea=N,Sr!==null&&(ea?(l=Sr,g=g.stateNode,l.nodeType===8?l.parentNode.removeChild(g):l.removeChild(g)):Sr.removeChild(g.stateNode));break;case 18:Sr!==null&&(ea?(l=Sr,g=g.stateNode,l.nodeType===8?pv(l.parentNode,g):l.nodeType===1&&pv(l,g),uc(l)):pv(Sr,g.stateNode));break;case 4:S=Sr,N=ea,Sr=g.stateNode.containerInfo,ea=!0,qi(l,f,g),Sr=S,ea=N;break;case 0:case 11:case 14:case 15:if(!Pr&&(S=g.updateQueue,S!==null&&(S=S.lastEffect,S!==null))){N=S=S.next;do{var P=N,D=P.destroy;P=P.tag,D!==void 0&&((P&2)!==0||(P&4)!==0)&&Qv(g,f,D),N=N.next}while(N!==S)}qi(l,f,g);break;case 1:if(!Pr&&(Es(g,f),S=g.stateNode,typeof S.componentWillUnmount=="function"))try{S.props=g.memoizedProps,S.state=g.memoizedState,S.componentWillUnmount()}catch(J){Ut(g,f,J)}qi(l,f,g);break;case 21:qi(l,f,g);break;case 22:g.mode&1?(Pr=(S=Pr)||g.memoizedState!==null,qi(l,f,g),Pr=S):qi(l,f,g);break;default:qi(l,f,g)}}function zC(l){var f=l.updateQueue;if(f!==null){l.updateQueue=null;var g=l.stateNode;g===null&&(g=l.stateNode=new h8),f.forEach(function(S){var N=j8.bind(null,l,S);g.has(S)||(g.add(S),S.then(N,N))})}}function ta(l,f){var g=f.deletions;if(g!==null)for(var S=0;SN&&(N=D),S&=~P}if(S=N,S=Yt()-S,S=(120>S?120:480>S?480:1080>S?1080:1920>S?1920:3e3>S?3e3:4320>S?4320:1960*g8(S/1960))-S,10l?16:l,Vi===null)var S=!1;else{if(l=Vi,Vi=null,Ef=0,(lt&6)!==0)throw Error(r(331));var N=lt;for(lt|=4,Pe=l.current;Pe!==null;){var P=Pe,D=P.child;if((Pe.flags&16)!==0){var J=P.deletions;if(J!==null){for(var te=0;teYt()-ay?No(l,0):ny|=g),Xr(l,f)}function eE(l,f){f===0&&((l.mode&1)===0?f=1:(f=Dd,Dd<<=1,(Dd&130023424)===0&&(Dd=4194304)));var g=$r();l=Ja(l,f),l!==null&&(ic(l,f,g),Xr(l,g))}function S8(l){var f=l.memoizedState,g=0;f!==null&&(g=f.retryLane),eE(l,g)}function j8(l,f){var g=0;switch(l.tag){case 13:var S=l.stateNode,N=l.memoizedState;N!==null&&(g=N.retryLane);break;case 19:S=l.stateNode;break;default:throw Error(r(314))}S!==null&&S.delete(f),eE(l,g)}var tE;tE=function(l,f,g){if(l!==null)if(l.memoizedProps!==f.pendingProps||Hr.current)Gr=!0;else{if((l.lanes&g)===0&&(f.flags&128)===0)return Gr=!1,u8(l,f,g);Gr=(l.flags&131072)!==0}else Gr=!1,$t&&(f.flags&1048576)!==0&&I_(f,af,f.index);switch(f.lanes=0,f.tag){case 2:var S=f.type;bf(l,f),l=f.pendingProps;var N=ys(f,Cr.current);Ns(f,g),N=Mv(null,f,S,l,N,g);var P=Dv();return f.flags|=1,typeof N=="object"&&N!==null&&typeof N.render=="function"&&N.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,Wr(S)?(P=!0,tf(f)):P=!1,f.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,Ov(f),N.updater=yf,f.stateNode=N,N._reactInternals=f,qv(f,S,l,g),f=Wv(null,f,S,!0,P,g)):(f.tag=0,$t&&P&&yv(f),Lr(null,f,N,g),f=f.child),f;case 16:S=f.elementType;e:{switch(bf(l,f),l=f.pendingProps,N=S._init,S=N(S._payload),f.type=S,N=f.tag=_8(S),l=Zn(S,l),N){case 0:f=Hv(null,f,S,l,g);break e;case 1:f=EC(null,f,S,l,g);break e;case 11:f=SC(null,f,S,l,g);break e;case 14:f=jC(null,f,S,Zn(S.type,l),g);break e}throw Error(r(306,S,""))}return f;case 0:return S=f.type,N=f.pendingProps,N=f.elementType===S?N:Zn(S,N),Hv(l,f,S,N,g);case 1:return S=f.type,N=f.pendingProps,N=f.elementType===S?N:Zn(S,N),EC(l,f,S,N,g);case 3:e:{if(OC(f),l===null)throw Error(r(387));S=f.pendingProps,P=f.memoizedState,N=P.element,U_(l,f),df(f,S,null,g);var D=f.memoizedState;if(S=D.element,P.isDehydrated)if(P={element:S,isDehydrated:!1,cache:D.cache,pendingSuspenseBoundaries:D.pendingSuspenseBoundaries,transitions:D.transitions},f.updateQueue.baseState=P,f.memoizedState=P,f.flags&256){N=Cs(Error(r(423)),f),f=PC(l,f,S,g,N);break e}else if(S!==N){N=Cs(Error(r(424)),f),f=PC(l,f,S,g,N);break e}else for(cn=Di(f.stateNode.containerInfo.firstChild),ln=f,$t=!0,Qn=null,g=z_(f,null,S,g),f.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling;else{if(ws(),S===N){f=Za(l,f,g);break e}Lr(l,f,S,g)}f=f.child}return f;case 5:return W_(f),l===null&&wv(f),S=f.type,N=f.pendingProps,P=l!==null?l.memoizedProps:null,D=N.children,fv(S,N)?D=null:P!==null&&fv(S,P)&&(f.flags|=32),CC(l,f),Lr(l,f,D,g),f.child;case 6:return l===null&&wv(f),null;case 13:return AC(l,f,g);case 4:return Pv(f,f.stateNode.containerInfo),S=f.pendingProps,l===null?f.child=Ss(f,null,S,g):Lr(l,f,S,g),f.child;case 11:return S=f.type,N=f.pendingProps,N=f.elementType===S?N:Zn(S,N),SC(l,f,S,N,g);case 7:return Lr(l,f,f.pendingProps,g),f.child;case 8:return Lr(l,f,f.pendingProps.children,g),f.child;case 12:return Lr(l,f,f.pendingProps.children,g),f.child;case 10:e:{if(S=f.type._context,N=f.pendingProps,P=f.memoizedProps,D=N.value,At(lf,S._currentValue),S._currentValue=D,P!==null)if(Jn(P.value,D)){if(P.children===N.children&&!Hr.current){f=Za(l,f,g);break e}}else for(P=f.child,P!==null&&(P.return=f);P!==null;){var J=P.dependencies;if(J!==null){D=P.child;for(var te=J.firstContext;te!==null;){if(te.context===S){if(P.tag===1){te=Qa(-1,g&-g),te.tag=2;var ce=P.updateQueue;if(ce!==null){ce=ce.shared;var be=ce.pending;be===null?te.next=te:(te.next=be.next,be.next=te),ce.pending=te}}P.lanes|=g,te=P.alternate,te!==null&&(te.lanes|=g),Cv(P.return,g,f),J.lanes|=g;break}te=te.next}}else if(P.tag===10)D=P.type===f.type?null:P.child;else if(P.tag===18){if(D=P.return,D===null)throw Error(r(341));D.lanes|=g,J=D.alternate,J!==null&&(J.lanes|=g),Cv(D,g,f),D=P.sibling}else D=P.child;if(D!==null)D.return=P;else for(D=P;D!==null;){if(D===f){D=null;break}if(P=D.sibling,P!==null){P.return=D.return,D=P;break}D=D.return}P=D}Lr(l,f,N.children,g),f=f.child}return f;case 9:return N=f.type,S=f.pendingProps.children,Ns(f,g),N=Mn(N),S=S(N),f.flags|=1,Lr(l,f,S,g),f.child;case 14:return S=f.type,N=Zn(S,f.pendingProps),N=Zn(S.type,N),jC(l,f,S,N,g);case 15:return NC(l,f,f.type,f.pendingProps,g);case 17:return S=f.type,N=f.pendingProps,N=f.elementType===S?N:Zn(S,N),bf(l,f),f.tag=1,Wr(S)?(l=!0,tf(f)):l=!1,Ns(f,g),mC(f,S,N),qv(f,S,N,g),Wv(null,f,S,!0,l,g);case 19:return kC(l,f,g);case 22:return _C(l,f,g)}throw Error(r(156,f.tag))};function rE(l,f){return MN(l,f)}function N8(l,f,g,S){this.tag=l,this.key=g,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=S,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $n(l,f,g,S){return new N8(l,f,g,S)}function fy(l){return l=l.prototype,!(!l||!l.isReactComponent)}function _8(l){if(typeof l=="function")return fy(l)?1:0;if(l!=null){if(l=l.$$typeof,l===F)return 11;if(l===U)return 14}return 2}function Gi(l,f){var g=l.alternate;return g===null?(g=$n(l.tag,f,l.key,l.mode),g.elementType=l.elementType,g.type=l.type,g.stateNode=l.stateNode,g.alternate=l,l.alternate=g):(g.pendingProps=f,g.type=l.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=l.flags&14680064,g.childLanes=l.childLanes,g.lanes=l.lanes,g.child=l.child,g.memoizedProps=l.memoizedProps,g.memoizedState=l.memoizedState,g.updateQueue=l.updateQueue,f=l.dependencies,g.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},g.sibling=l.sibling,g.index=l.index,g.ref=l.ref,g}function Tf(l,f,g,S,N,P){var D=2;if(S=l,typeof l=="function")fy(l)&&(D=1);else if(typeof l=="string")D=5;else e:switch(l){case T:return Co(g.children,N,P,f);case k:D=8,N|=8;break;case M:return l=$n(12,g,f,N|2),l.elementType=M,l.lanes=P,l;case V:return l=$n(13,g,f,N),l.elementType=V,l.lanes=P,l;case G:return l=$n(19,g,f,N),l.elementType=G,l.lanes=P,l;case W:return kf(g,N,P,f);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case $:D=10;break e;case z:D=9;break e;case F:D=11;break e;case U:D=14;break e;case H:D=16,S=null;break e}throw Error(r(130,l==null?l:typeof l,""))}return f=$n(D,g,f,N),f.elementType=l,f.type=S,f.lanes=P,f}function Co(l,f,g,S){return l=$n(7,l,S,f),l.lanes=g,l}function kf(l,f,g,S){return l=$n(22,l,S,f),l.elementType=W,l.lanes=g,l.stateNode={isHidden:!1},l}function hy(l,f,g){return l=$n(6,l,null,f),l.lanes=g,l}function py(l,f,g){return f=$n(4,l.children!==null?l.children:[],l.key,f),f.lanes=g,f.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},f}function C8(l,f,g,S,N){this.tag=f,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zg(0),this.expirationTimes=zg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zg(0),this.identifierPrefix=S,this.onRecoverableError=N,this.mutableSourceEagerHydrationData=null}function my(l,f,g,S,N,P,D,J,te){return l=new C8(l,f,g,J,te),f===1?(f=1,P===!0&&(f|=8)):f=0,P=$n(3,null,null,f),l.current=P,P.stateNode=l,P.memoizedState={element:S,isDehydrated:g,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ov(P),l}function E8(l,f,g){var S=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),wy.exports=B8(),wy.exports}var gE;function F8(){if(gE)return Ff;gE=1;var e=pM();return Ff.createRoot=e.createRoot,Ff.hydrateRoot=e.hydrateRoot,Ff}var z8=F8(),b=gm();const q=ht(b),VS=R8({__proto__:null,default:q},[b]);var ed=pM();const mM=ht(ed);function q8(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const U8=e=>{switch(e){case"success":return W8;case"info":return K8;case"warning":return G8;case"error":return X8;default:return null}},V8=Array(12).fill(0),H8=({visible:e,className:t})=>q.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},q.createElement("div",{className:"sonner-spinner"},V8.map((r,n)=>q.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),W8=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),G8=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),K8=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),X8=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},q.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Y8=q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},q.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),q.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),J8=()=>{const[e,t]=q.useState(document.hidden);return q.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let tw=1;class Q8{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:n,...a}=t,i=typeof t?.id=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:tw++,s=this.toasts.find(d=>d.id===i),u=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),s?this.toasts=this.toasts.map(d=>d.id===i?(this.publish({...d,...t,id:i,title:n}),{...d,...t,id:i,dismissible:u,title:n}):d):this.addToast({title:n,...a,dismissible:u,id:i}),i},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const a=Promise.resolve(t instanceof Function?t():t);let i=n!==void 0,s;const u=a.then(async c=>{if(s=["resolve",c],q.isValidElement(c))i=!1,this.create({id:n,type:"default",message:c});else if(ez(c)&&!c.ok){i=!1;const p=typeof r.error=="function"?await r.error(`HTTP error! status: ${c.status}`):r.error,m=typeof r.description=="function"?await r.description(`HTTP error! status: ${c.status}`):r.description,x=typeof p=="object"&&!q.isValidElement(p)?p:{message:p};this.create({id:n,type:"error",description:m,...x})}else if(c instanceof Error){i=!1;const p=typeof r.error=="function"?await r.error(c):r.error,m=typeof r.description=="function"?await r.description(c):r.description,x=typeof p=="object"&&!q.isValidElement(p)?p:{message:p};this.create({id:n,type:"error",description:m,...x})}else if(r.success!==void 0){i=!1;const p=typeof r.success=="function"?await r.success(c):r.success,m=typeof r.description=="function"?await r.description(c):r.description,x=typeof p=="object"&&!q.isValidElement(p)?p:{message:p};this.create({id:n,type:"success",description:m,...x})}}).catch(async c=>{if(s=["reject",c],r.error!==void 0){i=!1;const h=typeof r.error=="function"?await r.error(c):r.error,p=typeof r.description=="function"?await r.description(c):r.description,v=typeof h=="object"&&!q.isValidElement(h)?h:{message:h};this.create({id:n,type:"error",description:p,...v})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),d=()=>new Promise((c,h)=>u.then(()=>s[0]==="reject"?h(s[1]):c(s[1])).catch(h));return typeof n!="string"&&typeof n!="number"?{unwrap:d}:Object.assign(n,{unwrap:d})},this.custom=(t,r)=>{const n=r?.id||tw++;return this.create({jsx:t(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Qr=new Q8,Z8=(e,t)=>{const r=t?.id||tw++;return Qr.addToast({title:e,...t,id:r}),r},ez=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",tz=Z8,rz=()=>Qr.toasts,nz=()=>Qr.getActiveToasts(),pe=Object.assign(tz,{success:Qr.success,info:Qr.info,warning:Qr.warning,error:Qr.error,custom:Qr.custom,message:Qr.message,promise:Qr.promise,dismiss:Qr.dismiss,loading:Qr.loading},{getHistory:rz,getToasts:nz});q8("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function zf(e){return e.label!==void 0}const az=3,iz="24px",oz="16px",vE=4e3,sz=356,lz=14,cz=45,uz=200;function Aa(...e){return e.filter(Boolean).join(" ")}function dz(e){const[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}const fz=e=>{var t,r,n,a,i,s,u,d,c;const{invert:h,toast:p,unstyled:m,interacting:v,setHeights:x,visibleToasts:y,heights:w,index:j,toasts:_,expanded:C,removeToast:A,defaultRichColors:E,closeButton:O,style:T,cancelButtonStyle:k,actionButtonStyle:M,className:$="",descriptionClassName:z="",duration:F,position:V,gap:G,expandByDefault:U,classNames:H,icons:W,closeButtonAriaLabel:B="Close toast"}=e,[Q,R]=q.useState(null),[L,I]=q.useState(null),[X,ee]=q.useState(!1),[ie,re]=q.useState(!1),[K,Z]=q.useState(!1),[ne,de]=q.useState(!1),[ge,Y]=q.useState(!1),[we,Ce]=q.useState(0),[Be,et]=q.useState(0),tt=q.useRef(p.duration||F||vE),St=q.useRef(null),jt=q.useRef(null),Kt=j===0,_t=j+1<=y,ct=p.type,nr=p.dismissible!==!1,En=p.className||"",On=p.descriptionClassName||"",an=q.useMemo(()=>w.findIndex(Qe=>Qe.toastId===p.id)||0,[w,p.id]),Sa=q.useMemo(()=>{var Qe;return(Qe=p.closeButton)!=null?Qe:O},[p.closeButton,O]),Pn=q.useMemo(()=>p.duration||F||vE,[p.duration,F]),Vr=q.useRef(0),br=q.useRef(0),Dr=q.useRef(0),An=q.useRef(null),[Ha,ja]=V.split("-"),Ci=q.useMemo(()=>w.reduce((Qe,Xt,ar)=>ar>=an?Qe:Qe+Xt.height,0),[w,an]),ae=J8(),Te=p.invert||h,Ke=ct==="loading";br.current=q.useMemo(()=>an*G+Ci,[an,Ci]),q.useEffect(()=>{tt.current=Pn},[Pn]),q.useEffect(()=>{ee(!0)},[]),q.useEffect(()=>{const Qe=jt.current;if(Qe){const Xt=Qe.getBoundingClientRect().height;return et(Xt),x(ar=>[{toastId:p.id,height:Xt,position:p.position},...ar]),()=>x(ar=>ar.filter(_r=>_r.toastId!==p.id))}},[x,p.id]),q.useLayoutEffect(()=>{if(!X)return;const Qe=jt.current,Xt=Qe.style.height;Qe.style.height="auto";const ar=Qe.getBoundingClientRect().height;Qe.style.height=Xt,et(ar),x(_r=>_r.find(Qt=>Qt.toastId===p.id)?_r.map(Qt=>Qt.toastId===p.id?{...Qt,height:ar}:Qt):[{toastId:p.id,height:ar,position:p.position},..._r])},[X,p.title,p.description,x,p.id,p.jsx,p.action,p.cancel]);const Ft=q.useCallback(()=>{re(!0),Ce(br.current),x(Qe=>Qe.filter(Xt=>Xt.toastId!==p.id)),setTimeout(()=>{A(p)},uz)},[p,A,x,br]);q.useEffect(()=>{if(p.promise&&ct==="loading"||p.duration===1/0||p.type==="loading")return;let Qe;return C||v||ae?(()=>{if(Dr.current{tt.current!==1/0&&(Vr.current=new Date().getTime(),Qe=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),Ft()},tt.current))})(),()=>clearTimeout(Qe)},[C,v,p,ct,ae,Ft]),q.useEffect(()=>{p.delete&&(Ft(),p.onDismiss==null||p.onDismiss.call(p,p))},[Ft,p.delete]);function Lt(){var Qe;if(W?.loading){var Xt;return q.createElement("div",{className:Aa(H?.loader,p==null||(Xt=p.classNames)==null?void 0:Xt.loader,"sonner-loader"),"data-visible":ct==="loading"},W.loading)}return q.createElement(H8,{className:Aa(H?.loader,p==null||(Qe=p.classNames)==null?void 0:Qe.loader),visible:ct==="loading"})}const Na=p.icon||W?.[ct]||U8(ct);var Tn,Wa;return q.createElement("li",{tabIndex:0,ref:jt,className:Aa($,En,H?.toast,p==null||(t=p.classNames)==null?void 0:t.toast,H?.default,H?.[ct],p==null||(r=p.classNames)==null?void 0:r[ct]),"data-sonner-toast":"","data-rich-colors":(Tn=p.richColors)!=null?Tn:E,"data-styled":!(p.jsx||p.unstyled||m),"data-mounted":X,"data-promise":!!p.promise,"data-swiped":ge,"data-removed":ie,"data-visible":_t,"data-y-position":Ha,"data-x-position":ja,"data-index":j,"data-front":Kt,"data-swiping":K,"data-dismissible":nr,"data-type":ct,"data-invert":Te,"data-swipe-out":ne,"data-swipe-direction":L,"data-expanded":!!(C||U&&X),"data-testid":p.testId,style:{"--index":j,"--toasts-before":j,"--z-index":_.length-j,"--offset":`${ie?we:br.current}px`,"--initial-height":U?"auto":`${Be}px`,...T,...p.style},onDragEnd:()=>{Z(!1),R(null),An.current=null},onPointerDown:Qe=>{Qe.button!==2&&(Ke||!nr||(St.current=new Date,Ce(br.current),Qe.target.setPointerCapture(Qe.pointerId),Qe.target.tagName!=="BUTTON"&&(Z(!0),An.current={x:Qe.clientX,y:Qe.clientY})))},onPointerUp:()=>{var Qe,Xt,ar;if(ne||!nr)return;An.current=null;const _r=Number(((Qe=jt.current)==null?void 0:Qe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ei=Number(((Xt=jt.current)==null?void 0:Xt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Qt=new Date().getTime()-((ar=St.current)==null?void 0:ar.getTime()),hr=Q==="x"?_r:Ei,Oi=Math.abs(hr)/Qt;if(Math.abs(hr)>=cz||Oi>.11){Ce(br.current),p.onDismiss==null||p.onDismiss.call(p,p),I(Q==="x"?_r>0?"right":"left":Ei>0?"down":"up"),Ft(),de(!0);return}else{var wr,on;(wr=jt.current)==null||wr.style.setProperty("--swipe-amount-x","0px"),(on=jt.current)==null||on.style.setProperty("--swipe-amount-y","0px")}Y(!1),Z(!1),R(null)},onPointerMove:Qe=>{var Xt,ar,_r;if(!An.current||!nr||((Xt=window.getSelection())==null?void 0:Xt.toString().length)>0)return;const Qt=Qe.clientY-An.current.y,hr=Qe.clientX-An.current.x;var Oi;const wr=(Oi=e.swipeDirections)!=null?Oi:dz(V);!Q&&(Math.abs(hr)>1||Math.abs(Qt)>1)&&R(Math.abs(hr)>Math.abs(Qt)?"x":"y");let on={x:0,y:0};const Pi=kn=>1/(1.5+Math.abs(kn)/20);if(Q==="y"){if(wr.includes("top")||wr.includes("bottom"))if(wr.includes("top")&&Qt<0||wr.includes("bottom")&&Qt>0)on.y=Qt;else{const kn=Qt*Pi(Qt);on.y=Math.abs(kn)0)on.x=hr;else{const kn=hr*Pi(hr);on.x=Math.abs(kn)0||Math.abs(on.y)>0)&&Y(!0),(ar=jt.current)==null||ar.style.setProperty("--swipe-amount-x",`${on.x}px`),(_r=jt.current)==null||_r.style.setProperty("--swipe-amount-y",`${on.y}px`)}},Sa&&!p.jsx&&ct!=="loading"?q.createElement("button",{"aria-label":B,"data-disabled":Ke,"data-close-button":!0,onClick:Ke||!nr?()=>{}:()=>{Ft(),p.onDismiss==null||p.onDismiss.call(p,p)},className:Aa(H?.closeButton,p==null||(n=p.classNames)==null?void 0:n.closeButton)},(Wa=W?.close)!=null?Wa:Y8):null,(ct||p.icon||p.promise)&&p.icon!==null&&(W?.[ct]!==null||p.icon)?q.createElement("div",{"data-icon":"",className:Aa(H?.icon,p==null||(a=p.classNames)==null?void 0:a.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||Lt():null,p.type!=="loading"?Na:null):null,q.createElement("div",{"data-content":"",className:Aa(H?.content,p==null||(i=p.classNames)==null?void 0:i.content)},q.createElement("div",{"data-title":"",className:Aa(H?.title,p==null||(s=p.classNames)==null?void 0:s.title)},p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title),p.description?q.createElement("div",{"data-description":"",className:Aa(z,On,H?.description,p==null||(u=p.classNames)==null?void 0:u.description)},typeof p.description=="function"?p.description():p.description):null),q.isValidElement(p.cancel)?p.cancel:p.cancel&&zf(p.cancel)?q.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||k,onClick:Qe=>{zf(p.cancel)&&nr&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,Qe),Ft())},className:Aa(H?.cancelButton,p==null||(d=p.classNames)==null?void 0:d.cancelButton)},p.cancel.label):null,q.isValidElement(p.action)?p.action:p.action&&zf(p.action)?q.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||M,onClick:Qe=>{zf(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,Qe),!Qe.defaultPrevented&&Ft())},className:Aa(H?.actionButton,p==null||(c=p.classNames)==null?void 0:c.actionButton)},p.action.label):null)};function yE(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function hz(e,t){const r={};return[e,t].forEach((n,a)=>{const i=a===1,s=i?"--mobile-offset":"--offset",u=i?oz:iz;function d(c){["top","right","bottom","left"].forEach(h=>{r[`${s}-${h}`]=typeof c=="number"?`${c}px`:c})}typeof n=="number"||typeof n=="string"?d(n):typeof n=="object"?["top","right","bottom","left"].forEach(c=>{n[c]===void 0?r[`${s}-${c}`]=u:r[`${s}-${c}`]=typeof n[c]=="number"?`${n[c]}px`:n[c]}):d(u)}),r}const pz=q.forwardRef(function(t,r){const{id:n,invert:a,position:i="bottom-right",hotkey:s=["altKey","KeyT"],expand:u,closeButton:d,className:c,offset:h,mobileOffset:p,theme:m="light",richColors:v,duration:x,style:y,visibleToasts:w=az,toastOptions:j,dir:_=yE(),gap:C=lz,icons:A,containerAriaLabel:E="Notifications"}=t,[O,T]=q.useState([]),k=q.useMemo(()=>n?O.filter(X=>X.toasterId===n):O.filter(X=>!X.toasterId),[O,n]),M=q.useMemo(()=>Array.from(new Set([i].concat(k.filter(X=>X.position).map(X=>X.position)))),[k,i]),[$,z]=q.useState([]),[F,V]=q.useState(!1),[G,U]=q.useState(!1),[H,W]=q.useState(m!=="system"?m:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),B=q.useRef(null),Q=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),R=q.useRef(null),L=q.useRef(!1),I=q.useCallback(X=>{T(ee=>{var ie;return(ie=ee.find(re=>re.id===X.id))!=null&&ie.delete||Qr.dismiss(X.id),ee.filter(({id:re})=>re!==X.id)})},[]);return q.useEffect(()=>Qr.subscribe(X=>{if(X.dismiss){requestAnimationFrame(()=>{T(ee=>ee.map(ie=>ie.id===X.id?{...ie,delete:!0}:ie))});return}setTimeout(()=>{mM.flushSync(()=>{T(ee=>{const ie=ee.findIndex(re=>re.id===X.id);return ie!==-1?[...ee.slice(0,ie),{...ee[ie],...X},...ee.slice(ie+1)]:[X,...ee]})})})}),[O]),q.useEffect(()=>{if(m!=="system"){W(m);return}if(m==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?W("dark"):W("light")),typeof window>"u")return;const X=window.matchMedia("(prefers-color-scheme: dark)");try{X.addEventListener("change",({matches:ee})=>{W(ee?"dark":"light")})}catch{X.addListener(({matches:ie})=>{try{W(ie?"dark":"light")}catch(re){console.error(re)}})}},[m]),q.useEffect(()=>{O.length<=1&&V(!1)},[O]),q.useEffect(()=>{const X=ee=>{var ie;if(s.every(Z=>ee[Z]||ee.code===Z)){var K;V(!0),(K=B.current)==null||K.focus()}ee.code==="Escape"&&(document.activeElement===B.current||(ie=B.current)!=null&&ie.contains(document.activeElement))&&V(!1)};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[s]),q.useEffect(()=>{if(B.current)return()=>{R.current&&(R.current.focus({preventScroll:!0}),R.current=null,L.current=!1)}},[B.current]),q.createElement("section",{ref:r,"aria-label":`${E} ${Q}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((X,ee)=>{var ie;const[re,K]=X.split("-");return k.length?q.createElement("ol",{key:X,dir:_==="auto"?yE():_,tabIndex:-1,ref:B,className:c,"data-sonner-toaster":!0,"data-sonner-theme":H,"data-y-position":re,"data-x-position":K,style:{"--front-toast-height":`${((ie=$[0])==null?void 0:ie.height)||0}px`,"--width":`${sz}px`,"--gap":`${C}px`,...y,...hz(h,p)},onBlur:Z=>{L.current&&!Z.currentTarget.contains(Z.relatedTarget)&&(L.current=!1,R.current&&(R.current.focus({preventScroll:!0}),R.current=null))},onFocus:Z=>{Z.target instanceof HTMLElement&&Z.target.dataset.dismissible==="false"||L.current||(L.current=!0,R.current=Z.relatedTarget)},onMouseEnter:()=>V(!0),onMouseMove:()=>V(!0),onMouseLeave:()=>{G||V(!1)},onDragEnd:()=>V(!1),onPointerDown:Z=>{Z.target instanceof HTMLElement&&Z.target.dataset.dismissible==="false"||U(!0)},onPointerUp:()=>U(!1)},k.filter(Z=>!Z.position&&ee===0||Z.position===X).map((Z,ne)=>{var de,ge;return q.createElement(fz,{key:Z.id,icons:A,index:ne,toast:Z,defaultRichColors:v,duration:(de=j?.duration)!=null?de:x,className:j?.className,descriptionClassName:j?.descriptionClassName,invert:a,visibleToasts:w,closeButton:(ge=j?.closeButton)!=null?ge:d,interacting:G,position:X,style:j?.style,unstyled:j?.unstyled,classNames:j?.classNames,cancelButtonStyle:j?.cancelButtonStyle,actionButtonStyle:j?.actionButtonStyle,closeButtonAriaLabel:j?.closeButtonAriaLabel,removeToast:I,toasts:k.filter(Y=>Y.position==Z.position),heights:$.filter(Y=>Y.position==Z.position),setHeights:z,expandByDefault:u,gap:C,expanded:F,swipeDirections:t.swipeDirections})})):null}))});/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mz=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),gz=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),xE=e=>{const t=gz(e);return t.charAt(0).toUpperCase()+t.slice(1)},gM=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var vz={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yz=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:i,iconNode:s,...u},d)=>b.createElement("svg",{ref:d,...vz,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:gM("lucide",a),...u},[...s.map(([c,h])=>b.createElement(c,h)),...Array.isArray(i)?i:[i]]));/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $e=(e,t)=>{const r=b.forwardRef(({className:n,...a},i)=>b.createElement(yz,{ref:i,iconNode:t,className:gM(`lucide-${mz(xE(e))}`,`lucide-${e}`,n),...a}));return r.displayName=xE(e),r};/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xz=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]],bz=$e("arrow-down-a-z",xz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wz=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],Sz=$e("arrow-down-right",wz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jz=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],vM=$e("arrow-left",jz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Nz=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],_z=$e("arrow-up-down",Nz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Cz=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],yM=$e("arrow-up-right",Cz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ez=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Oz=$e("calendar",Ez);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pz=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Az=$e("chart-column",Pz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Tz=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],xM=$e("check",Tz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kz=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],al=$e("chevron-down",kz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Rz=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],bM=$e("chevron-left",Rz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Iz=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],il=$e("chevron-right",Iz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Mz=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Dz=$e("chevron-up",Mz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Lz=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],wM=$e("chevrons-up-down",Lz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Jh=$e("circle-help",$z);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Bz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],Fz=$e("circle-user",Bz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zz=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],qz=$e("clipboard-list",zz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Uz=[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]],Vz=$e("coffee",Uz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Hz=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],HS=$e("download",Hz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Wz=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],di=$e("ellipsis",Wz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Gz=[["path",{d:"M14.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"16lz6z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 13.1a2 2 0 0 0-1 1.76v3.24a2 2 0 0 0 .97 1.78L6 21.7a2 2 0 0 0 2.03.01L11 19.9a2 2 0 0 0 1-1.76V14.9a2 2 0 0 0-.97-1.78L8 11.3a2 2 0 0 0-2.03-.01Z",key:"99pj1s"}],["path",{d:"M7 17v5",key:"1yj1jh"}],["path",{d:"M11.7 14.2 7 17l-4.7-2.8",key:"1yk8tc"}]],SM=$e("file-box",Gz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Kz=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ol=$e("file-text",Kz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Xz=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Yz=$e("grid-3x3",Xz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Jz=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Qz=$e("image",Jz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Zz=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],jM=$e("layers",Zz);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const e6=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],NM=$e("layout-dashboard",e6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const t6=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],r6=$e("list",t6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const n6=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],a6=$e("log-out",n6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const i6=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],Bl=$e("map-pin",i6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const o6=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],s6=$e("menu",o6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const l6=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],hu=$e("package",l6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const c6=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Wh=$e("pencil",c6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const u6=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],d6=$e("pin",u6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const f6=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],tn=$e("plus",f6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const h6=[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]],_M=$e("printer",h6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const p6=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],m6=$e("refresh-cw",p6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const g6=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],v6=$e("save",g6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const y6=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],vm=$e("search",y6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const x6=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Qh=$e("settings",x6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const b6=[["path",{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",key:"oel41y"}]],w6=$e("shield",b6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const S6=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],wn=$e("square-pen",S6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const j6=[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]],N6=$e("store",j6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _6=[["path",{d:"m18 2 4 4",key:"22kx64"}],["path",{d:"m17 7 3-3",key:"1w1zoj"}],["path",{d:"M19 9 8.7 19.3c-1 1-2.5 1-3.4 0l-.6-.6c-1-1-1-2.5 0-3.4L15 5",key:"1exhtz"}],["path",{d:"m9 11 4 4",key:"rovt3i"}],["path",{d:"m5 19-3 3",key:"59f2uf"}],["path",{d:"m14 4 6 6",key:"yqp9t2"}]],Ny=$e("syringe",_6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const C6=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]],E6=$e("tablet",C6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const O6=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Zh=$e("tag",O6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const P6=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],A6=$e("timer",P6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const T6=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],Ot=$e("trash-2",T6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const k6=[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]],R6=$e("trending-up",k6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const I6=[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]],CM=$e("type",I6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const M6=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],D6=$e("upload",M6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const L6=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],$6=$e("user",L6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const B6=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]],WS=$e("users",B6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const F6=[["path",{d:"M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2",key:"cjf0a3"}],["path",{d:"M7 2v20",key:"1473qp"}],["path",{d:"M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7",key:"j28e5"}]],z6=$e("utensils",F6);/** - * @license lucide-react v0.487.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const q6=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],eo=$e("x",q6);function EM(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t{const r=new Array(e.length+t.length);for(let n=0;n({classGroupId:e,validator:t}),OM=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),ep="-",bE=[],H6="arbitrary..",W6=e=>{const t=K6(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return G6(s);const u=s.split(ep),d=u[0]===""&&u.length>1?1:0;return PM(u,d,t)},getConflictingClassGroupIds:(s,u)=>{if(u){const d=n[s],c=r[s];return d?c?U6(c,d):d:c||bE}return r[s]||bE}}},PM=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const a=e[t],i=r.nextPart.get(a);if(i){const c=PM(e,t+1,i);if(c)return c}const s=r.validators;if(s===null)return;const u=t===0?e.join(ep):e.slice(t).join(ep),d=s.length;for(let c=0;ce.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?H6+n:void 0})(),K6=e=>{const{theme:t,classGroups:r}=e;return X6(r,t)},X6=(e,t)=>{const r=OM();for(const n in e){const a=e[n];GS(a,r,n,t)}return r},GS=(e,t,r,n)=>{const a=e.length;for(let i=0;i{if(typeof e=="string"){J6(e,t,r);return}if(typeof e=="function"){Q6(e,t,r,n);return}Z6(e,t,r,n)},J6=(e,t,r)=>{const n=e===""?t:AM(t,e);n.classGroupId=r},Q6=(e,t,r,n)=>{if(eq(e)){GS(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(V6(r,e))},Z6=(e,t,r,n)=>{const a=Object.entries(e),i=a.length;for(let s=0;s{let r=e;const n=t.split(ep),a=n.length;for(let i=0;i"isThemeGetter"in e&&e.isThemeGetter===!0,tq=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(i,s)=>{r[i]=s,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(i){let s=r[i];if(s!==void 0)return s;if((s=n[i])!==void 0)return a(i,s),s},set(i,s){i in r?r[i]=s:a(i,s)}}},rw="!",wE=":",rq=[],SE=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),nq=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const i=[];let s=0,u=0,d=0,c;const h=a.length;for(let y=0;yd?c-d:void 0;return SE(i,v,m,x)};if(t){const a=t+wE,i=n;n=s=>s.startsWith(a)?i(s.slice(a.length)):SE(rq,!1,s,void 0,!0)}if(r){const a=n;n=i=>r({className:i,parseClassName:a})}return n},aq=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let a=[];for(let i=0;i0&&(a.sort(),n.push(...a),a=[]),n.push(s)):a.push(s)}return a.length>0&&(a.sort(),n.push(...a)),n}},iq=e=>({cache:tq(e.cacheSize),parseClassName:nq(e),sortModifiers:aq(e),...W6(e)}),oq=/\s+/,sq=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,s=[],u=e.trim().split(oq);let d="";for(let c=u.length-1;c>=0;c-=1){const h=u[c],{isExternal:p,modifiers:m,hasImportantModifier:v,baseClassName:x,maybePostfixModifierPosition:y}=r(h);if(p){d=h+(d.length>0?" "+d:d);continue}let w=!!y,j=n(w?x.substring(0,y):x);if(!j){if(!w){d=h+(d.length>0?" "+d:d);continue}if(j=n(x),!j){d=h+(d.length>0?" "+d:d);continue}w=!1}const _=m.length===0?"":m.length===1?m[0]:i(m).join(":"),C=v?_+rw:_,A=C+j;if(s.indexOf(A)>-1)continue;s.push(A);const E=a(j,w);for(let O=0;O0?" "+d:d)}return d},lq=(...e)=>{let t=0,r,n,a="";for(;t{if(typeof e=="string")return e;let t,r="";for(let n=0;n{let r,n,a,i;const s=d=>{const c=t.reduce((h,p)=>p(h),e());return r=iq(c),n=r.cache.get,a=r.cache.set,i=u,u(d)},u=d=>{const c=n(d);if(c)return c;const h=sq(d,r);return a(d,h),h};return i=s,(...d)=>i(lq(...d))},uq=[],sr=e=>{const t=r=>r[e]||uq;return t.isThemeGetter=!0,t},kM=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,RM=/^\((?:(\w[\w-]*):)?(.+)\)$/i,dq=/^\d+\/\d+$/,fq=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,hq=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,pq=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,mq=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,gq=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ts=e=>dq.test(e),at=e=>!!e&&!Number.isNaN(Number(e)),Xi=e=>!!e&&Number.isInteger(Number(e)),_y=e=>e.endsWith("%")&&at(e.slice(0,-1)),ti=e=>fq.test(e),vq=()=>!0,yq=e=>hq.test(e)&&!pq.test(e),IM=()=>!1,xq=e=>mq.test(e),bq=e=>gq.test(e),wq=e=>!Re(e)&&!Ie(e),Sq=e=>Fl(e,LM,IM),Re=e=>kM.test(e),Eo=e=>Fl(e,$M,yq),Cy=e=>Fl(e,Eq,at),jE=e=>Fl(e,MM,IM),jq=e=>Fl(e,DM,bq),qf=e=>Fl(e,BM,xq),Ie=e=>RM.test(e),$c=e=>zl(e,$M),Nq=e=>zl(e,Oq),NE=e=>zl(e,MM),_q=e=>zl(e,LM),Cq=e=>zl(e,DM),Uf=e=>zl(e,BM,!0),Fl=(e,t,r)=>{const n=kM.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},zl=(e,t,r=!1)=>{const n=RM.exec(e);return n?n[1]?t(n[1]):r:!1},MM=e=>e==="position"||e==="percentage",DM=e=>e==="image"||e==="url",LM=e=>e==="length"||e==="size"||e==="bg-size",$M=e=>e==="length",Eq=e=>e==="number",Oq=e=>e==="family-name",BM=e=>e==="shadow",Pq=()=>{const e=sr("color"),t=sr("font"),r=sr("text"),n=sr("font-weight"),a=sr("tracking"),i=sr("leading"),s=sr("breakpoint"),u=sr("container"),d=sr("spacing"),c=sr("radius"),h=sr("shadow"),p=sr("inset-shadow"),m=sr("text-shadow"),v=sr("drop-shadow"),x=sr("blur"),y=sr("perspective"),w=sr("aspect"),j=sr("ease"),_=sr("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...A(),Ie,Re],O=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],k=()=>[Ie,Re,d],M=()=>[Ts,"full","auto",...k()],$=()=>[Xi,"none","subgrid",Ie,Re],z=()=>["auto",{span:["full",Xi,Ie,Re]},Xi,Ie,Re],F=()=>[Xi,"auto",Ie,Re],V=()=>["auto","min","max","fr",Ie,Re],G=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...k()],W=()=>[Ts,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],B=()=>[e,Ie,Re],Q=()=>[...A(),NE,jE,{position:[Ie,Re]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",_q,Sq,{size:[Ie,Re]}],I=()=>[_y,$c,Eo],X=()=>["","none","full",c,Ie,Re],ee=()=>["",at,$c,Eo],ie=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[at,_y,NE,jE],Z=()=>["","none",x,Ie,Re],ne=()=>["none",at,Ie,Re],de=()=>["none",at,Ie,Re],ge=()=>[at,Ie,Re],Y=()=>[Ts,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ti],breakpoint:[ti],color:[vq],container:[ti],"drop-shadow":[ti],ease:["in","out","in-out"],font:[wq],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ti],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ti],shadow:[ti],spacing:["px",at],text:[ti],"text-shadow":[ti],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ts,Re,Ie,w]}],container:["container"],columns:[{columns:[at,Re,Ie,u]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{start:M()}],end:[{end:M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[Xi,"auto",Ie,Re]}],basis:[{basis:[Ts,"full","auto",u,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[at,Ts,"auto","initial","none",Re]}],grow:[{grow:["",at,Ie,Re]}],shrink:[{shrink:["",at,Ie,Re]}],order:[{order:[Xi,"first","last","none",Ie,Re]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:z()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:z()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":V()}],"auto-rows":[{"auto-rows":V()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...G(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...G()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":G()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[u,"screen",...W()]}],"min-w":[{"min-w":[u,"screen","none",...W()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[s]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",r,$c,Eo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Ie,Cy]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",_y,Re]}],"font-family":[{font:[Nq,Re,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,Ie,Re]}],"line-clamp":[{"line-clamp":[at,"none",Ie,Cy]}],leading:[{leading:[i,...k()]}],"list-image":[{"list-image":["none",Ie,Re]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ie,Re]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[at,"from-font","auto",Ie,Eo]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[at,"auto",Ie,Re]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ie,Re]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ie,Re]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Xi,Ie,Re],radial:["",Ie,Re],conic:[Xi,Ie,Re]},Cq,jq]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:X()}],"rounded-s":[{"rounded-s":X()}],"rounded-e":[{"rounded-e":X()}],"rounded-t":[{"rounded-t":X()}],"rounded-r":[{"rounded-r":X()}],"rounded-b":[{"rounded-b":X()}],"rounded-l":[{"rounded-l":X()}],"rounded-ss":[{"rounded-ss":X()}],"rounded-se":[{"rounded-se":X()}],"rounded-ee":[{"rounded-ee":X()}],"rounded-es":[{"rounded-es":X()}],"rounded-tl":[{"rounded-tl":X()}],"rounded-tr":[{"rounded-tr":X()}],"rounded-br":[{"rounded-br":X()}],"rounded-bl":[{"rounded-bl":X()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[at,Ie,Re]}],"outline-w":[{outline:["",at,$c,Eo]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",h,Uf,qf]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",p,Uf,qf]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[at,Eo]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",m,Uf,qf]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[at,Ie,Re]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[at]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[Ie,Re]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[at]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ie,Re]}],filter:[{filter:["","none",Ie,Re]}],blur:[{blur:Z()}],brightness:[{brightness:[at,Ie,Re]}],contrast:[{contrast:[at,Ie,Re]}],"drop-shadow":[{"drop-shadow":["","none",v,Uf,qf]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",at,Ie,Re]}],"hue-rotate":[{"hue-rotate":[at,Ie,Re]}],invert:[{invert:["",at,Ie,Re]}],saturate:[{saturate:[at,Ie,Re]}],sepia:[{sepia:["",at,Ie,Re]}],"backdrop-filter":[{"backdrop-filter":["","none",Ie,Re]}],"backdrop-blur":[{"backdrop-blur":Z()}],"backdrop-brightness":[{"backdrop-brightness":[at,Ie,Re]}],"backdrop-contrast":[{"backdrop-contrast":[at,Ie,Re]}],"backdrop-grayscale":[{"backdrop-grayscale":["",at,Ie,Re]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[at,Ie,Re]}],"backdrop-invert":[{"backdrop-invert":["",at,Ie,Re]}],"backdrop-opacity":[{"backdrop-opacity":[at,Ie,Re]}],"backdrop-saturate":[{"backdrop-saturate":[at,Ie,Re]}],"backdrop-sepia":[{"backdrop-sepia":["",at,Ie,Re]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ie,Re]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[at,"initial",Ie,Re]}],ease:[{ease:["linear","initial",j,Ie,Re]}],delay:[{delay:[at,Ie,Re]}],animate:[{animate:["none",_,Ie,Re]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[y,Ie,Re]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:ne()}],"rotate-x":[{"rotate-x":ne()}],"rotate-y":[{"rotate-y":ne()}],"rotate-z":[{"rotate-z":ne()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":["scale-3d"],skew:[{skew:ge()}],"skew-x":[{"skew-x":ge()}],"skew-y":[{"skew-y":ge()}],transform:[{transform:[Ie,Re,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Y()}],"translate-x":[{"translate-x":Y()}],"translate-y":[{"translate-y":Y()}],"translate-z":[{"translate-z":Y()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ie,Re]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ie,Re]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[at,$c,Eo,Cy]}],stroke:[{stroke:["none",...B()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Aq=cq(Pq);function Ee(...e){return Aq(nt(e))}function _E(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Wn(...e){return t=>{let r=!1;const n=e.map(a=>{const i=_E(a,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let a=0;a{const{children:i,...s}=n,u=b.Children.toArray(i),d=u.find(Iq);if(d){const c=d.props.children,h=u.map(p=>p===d?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:p);return o.jsx(t,{...s,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,h):null})}return o.jsx(t,{...s,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function kq(e){const t=b.forwardRef((r,n)=>{const{children:a,...i}=r;if(b.isValidElement(a)){const s=Dq(a),u=Mq(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Wn(n,s):s),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Rq=Symbol("radix.slottable");function Iq(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Rq}function Mq(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function Dq(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Lq=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Je=Lq.reduce((e,t)=>{const r=Tq(`Primitive.${t}`),n=b.forwardRef((a,i)=>{const{asChild:s,...u}=a,d=s?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(d,{...u,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function $q(e,t){e&&ed.flushSync(()=>e.dispatchEvent(t))}var rr=globalThis?.document?b.useLayoutEffect:()=>{};function Bq(e,t){return b.useReducer((r,n)=>t[r][n]??r,e)}var _n=e=>{const{present:t,children:r}=e,n=Fq(t),a=typeof r=="function"?r({present:n.isPresent}):b.Children.only(r),i=st(n.ref,zq(a));return typeof r=="function"||n.isPresent?b.cloneElement(a,{ref:i}):null};_n.displayName="Presence";function Fq(e){const[t,r]=b.useState(),n=b.useRef(null),a=b.useRef(e),i=b.useRef("none"),s=e?"mounted":"unmounted",[u,d]=Bq(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const c=Vf(n.current);i.current=u==="mounted"?c:"none"},[u]),rr(()=>{const c=n.current,h=a.current;if(h!==e){const m=i.current,v=Vf(c);e?d("MOUNT"):v==="none"||c?.display==="none"?d("UNMOUNT"):d(h&&m!==v?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,d]),rr(()=>{if(t){let c;const h=t.ownerDocument.defaultView??window,p=v=>{const y=Vf(n.current).includes(CSS.escape(v.animationName));if(v.target===t&&y&&(d("ANIMATION_END"),!a.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",c=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},m=v=>{v.target===t&&(i.current=Vf(n.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{h.clearTimeout(c),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:b.useCallback(c=>{n.current=c?getComputedStyle(c):null,r(c)},[])}}function Vf(e){return e?.animationName||"none"}function zq(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function qq(e,t){const r=b.createContext(t),n=i=>{const{children:s,...u}=i,d=b.useMemo(()=>u,Object.values(u));return o.jsx(r.Provider,{value:d,children:s})};n.displayName=e+"Provider";function a(i){const s=b.useContext(r);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[n,a]}function wi(e,t=[]){let r=[];function n(i,s){const u=b.createContext(s),d=r.length;r=[...r,s];const c=p=>{const{scope:m,children:v,...x}=p,y=m?.[e]?.[d]||u,w=b.useMemo(()=>x,Object.values(x));return o.jsx(y.Provider,{value:w,children:v})};c.displayName=i+"Provider";function h(p,m){const v=m?.[e]?.[d]||u,x=b.useContext(v);if(x)return x;if(s!==void 0)return s;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[c,h]}const a=()=>{const i=r.map(s=>b.createContext(s));return function(u){const d=u?.[e]||i;return b.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return a.scopeName=e,[n,Uq(a,...t)]}function Uq(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const s=n.reduce((u,{useScope:d,scopeName:c})=>{const p=d(i)[`__scope${c}`];return{...u,...p}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}function Fr(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>(...r)=>t.current?.(...r),[])}var Vq=b.createContext(void 0);function FM(e){const t=b.useContext(Vq);return e||t||"ltr"}function nw(e,[t,r]){return Math.min(r,Math.max(t,e))}function Ze(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e?.(a),r===!1||!a.defaultPrevented)return t?.(a)}}function Hq(e,t){return b.useReducer((r,n)=>t[r][n]??r,e)}var KS="ScrollArea",[zM]=wi(KS),[Wq,Kn]=zM(KS),qM=b.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:i=600,...s}=e,[u,d]=b.useState(null),[c,h]=b.useState(null),[p,m]=b.useState(null),[v,x]=b.useState(null),[y,w]=b.useState(null),[j,_]=b.useState(0),[C,A]=b.useState(0),[E,O]=b.useState(!1),[T,k]=b.useState(!1),M=st(t,z=>d(z)),$=FM(a);return o.jsx(Wq,{scope:r,type:n,dir:$,scrollHideDelay:i,scrollArea:u,viewport:c,onViewportChange:h,content:p,onContentChange:m,scrollbarX:v,onScrollbarXChange:x,scrollbarXEnabled:E,onScrollbarXEnabledChange:O,scrollbarY:y,onScrollbarYChange:w,scrollbarYEnabled:T,onScrollbarYEnabledChange:k,onCornerWidthChange:_,onCornerHeightChange:A,children:o.jsx(Je.div,{dir:$,...s,ref:M,style:{position:"relative","--radix-scroll-area-corner-width":j+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})})});qM.displayName=KS;var UM="ScrollAreaViewport",VM=b.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:a,...i}=e,s=Kn(UM,r),u=b.useRef(null),d=st(t,u,s.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),o.jsx(Je.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:o.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});VM.displayName=UM;var za="ScrollAreaScrollbar",HM=b.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Kn(za,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=a,u=e.orientation==="horizontal";return b.useEffect(()=>(u?i(!0):s(!0),()=>{u?i(!1):s(!1)}),[u,i,s]),a.type==="hover"?o.jsx(Gq,{...n,ref:t,forceMount:r}):a.type==="scroll"?o.jsx(Kq,{...n,ref:t,forceMount:r}):a.type==="auto"?o.jsx(WM,{...n,ref:t,forceMount:r}):a.type==="always"?o.jsx(XS,{...n,ref:t}):null});HM.displayName=za;var Gq=b.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Kn(za,e.__scopeScrollArea),[i,s]=b.useState(!1);return b.useEffect(()=>{const u=a.scrollArea;let d=0;if(u){const c=()=>{window.clearTimeout(d),s(!0)},h=()=>{d=window.setTimeout(()=>s(!1),a.scrollHideDelay)};return u.addEventListener("pointerenter",c),u.addEventListener("pointerleave",h),()=>{window.clearTimeout(d),u.removeEventListener("pointerenter",c),u.removeEventListener("pointerleave",h)}}},[a.scrollArea,a.scrollHideDelay]),o.jsx(_n,{present:r||i,children:o.jsx(WM,{"data-state":i?"visible":"hidden",...n,ref:t})})}),Kq=b.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Kn(za,e.__scopeScrollArea),i=e.orientation==="horizontal",s=xm(()=>d("SCROLL_END"),100),[u,d]=Hq("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return b.useEffect(()=>{if(u==="idle"){const c=window.setTimeout(()=>d("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(c)}},[u,a.scrollHideDelay,d]),b.useEffect(()=>{const c=a.viewport,h=i?"scrollLeft":"scrollTop";if(c){let p=c[h];const m=()=>{const v=c[h];p!==v&&(d("SCROLL"),s()),p=v};return c.addEventListener("scroll",m),()=>c.removeEventListener("scroll",m)}},[a.viewport,i,d,s]),o.jsx(_n,{present:r||u!=="hidden",children:o.jsx(XS,{"data-state":u==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:Ze(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Ze(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),WM=b.forwardRef((e,t)=>{const r=Kn(za,e.__scopeScrollArea),{forceMount:n,...a}=e,[i,s]=b.useState(!1),u=e.orientation==="horizontal",d=xm(()=>{if(r.viewport){const c=r.viewport.offsetWidth{const{orientation:r="vertical",...n}=e,a=Kn(za,e.__scopeScrollArea),i=b.useRef(null),s=b.useRef(0),[u,d]=b.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=JM(u.viewport,u.content),h={...n,sizes:u,onSizesChange:d,hasThumb:c>0&&c<1,onThumbChange:m=>i.current=m,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:m=>s.current=m};function p(m,v){return eU(m,s.current,u,v)}return r==="horizontal"?o.jsx(Xq,{...h,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollLeft,v=CE(m,u,a.dir);i.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:m=>{a.viewport&&(a.viewport.scrollLeft=m)},onDragScroll:m=>{a.viewport&&(a.viewport.scrollLeft=p(m,a.dir))}}):r==="vertical"?o.jsx(Yq,{...h,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollTop,v=CE(m,u);i.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:m=>{a.viewport&&(a.viewport.scrollTop=m)},onDragScroll:m=>{a.viewport&&(a.viewport.scrollTop=p(m))}}):null}),Xq=b.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,i=Kn(za,e.__scopeScrollArea),[s,u]=b.useState(),d=b.useRef(null),c=st(t,d,i.onScrollbarXChange);return b.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),o.jsx(KM,{"data-orientation":"horizontal",...a,ref:c,sizes:r,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ym(r)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,p)=>{if(i.viewport){const m=i.viewport.scrollLeft+h.deltaX;e.onWheelScroll(m),ZM(m,p)&&h.preventDefault()}},onResize:()=>{d.current&&i.viewport&&s&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:rp(s.paddingLeft),paddingEnd:rp(s.paddingRight)}})}})}),Yq=b.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,i=Kn(za,e.__scopeScrollArea),[s,u]=b.useState(),d=b.useRef(null),c=st(t,d,i.onScrollbarYChange);return b.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),o.jsx(KM,{"data-orientation":"vertical",...a,ref:c,sizes:r,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ym(r)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,p)=>{if(i.viewport){const m=i.viewport.scrollTop+h.deltaY;e.onWheelScroll(m),ZM(m,p)&&h.preventDefault()}},onResize:()=>{d.current&&i.viewport&&s&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:rp(s.paddingTop),paddingEnd:rp(s.paddingBottom)}})}})}),[Jq,GM]=zM(za),KM=b.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:u,onThumbPositionChange:d,onDragScroll:c,onWheelScroll:h,onResize:p,...m}=e,v=Kn(za,r),[x,y]=b.useState(null),w=st(t,M=>y(M)),j=b.useRef(null),_=b.useRef(""),C=v.viewport,A=n.content-n.viewport,E=Fr(h),O=Fr(d),T=xm(p,10);function k(M){if(j.current){const $=M.clientX-j.current.left,z=M.clientY-j.current.top;c({x:$,y:z})}}return b.useEffect(()=>{const M=$=>{const z=$.target;x?.contains(z)&&E($,A)};return document.addEventListener("wheel",M,{passive:!1}),()=>document.removeEventListener("wheel",M,{passive:!1})},[C,x,A,E]),b.useEffect(O,[n,O]),sl(x,T),sl(v.content,T),o.jsx(Jq,{scope:r,scrollbar:x,hasThumb:a,onThumbChange:Fr(i),onThumbPointerUp:Fr(s),onThumbPositionChange:O,onThumbPointerDown:Fr(u),children:o.jsx(Je.div,{...m,ref:w,style:{position:"absolute",...m.style},onPointerDown:Ze(e.onPointerDown,M=>{M.button===0&&(M.target.setPointerCapture(M.pointerId),j.current=x.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),k(M))}),onPointerMove:Ze(e.onPointerMove,k),onPointerUp:Ze(e.onPointerUp,M=>{const $=M.target;$.hasPointerCapture(M.pointerId)&&$.releasePointerCapture(M.pointerId),document.body.style.webkitUserSelect=_.current,v.viewport&&(v.viewport.style.scrollBehavior=""),j.current=null})})})}),tp="ScrollAreaThumb",XM=b.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=GM(tp,e.__scopeScrollArea);return o.jsx(_n,{present:r||a.hasThumb,children:o.jsx(Qq,{ref:t,...n})})}),Qq=b.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...a}=e,i=Kn(tp,r),s=GM(tp,r),{onThumbPositionChange:u}=s,d=st(t,p=>s.onThumbChange(p)),c=b.useRef(void 0),h=xm(()=>{c.current&&(c.current(),c.current=void 0)},100);return b.useEffect(()=>{const p=i.viewport;if(p){const m=()=>{if(h(),!c.current){const v=tU(p,u);c.current=v,u()}};return u(),p.addEventListener("scroll",m),()=>p.removeEventListener("scroll",m)}},[i.viewport,h,u]),o.jsx(Je.div,{"data-state":s.hasThumb?"visible":"hidden",...a,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Ze(e.onPointerDownCapture,p=>{const v=p.target.getBoundingClientRect(),x=p.clientX-v.left,y=p.clientY-v.top;s.onThumbPointerDown({x,y})}),onPointerUp:Ze(e.onPointerUp,s.onThumbPointerUp)})});XM.displayName=tp;var YS="ScrollAreaCorner",YM=b.forwardRef((e,t)=>{const r=Kn(YS,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?o.jsx(Zq,{...e,ref:t}):null});YM.displayName=YS;var Zq=b.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,a=Kn(YS,r),[i,s]=b.useState(0),[u,d]=b.useState(0),c=!!(i&&u);return sl(a.scrollbarX,()=>{const h=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(h),d(h)}),sl(a.scrollbarY,()=>{const h=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(h),s(h)}),c?o.jsx(Je.div,{...n,ref:t,style:{width:i,height:u,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function rp(e){return e?parseInt(e,10):0}function JM(e,t){const r=e/t;return isNaN(r)?0:r}function ym(e){const t=JM(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function eU(e,t,r,n="ltr"){const a=ym(r),i=a/2,s=t||i,u=a-s,d=r.scrollbar.paddingStart+s,c=r.scrollbar.size-r.scrollbar.paddingEnd-u,h=r.content-r.viewport,p=n==="ltr"?[0,h]:[h*-1,0];return QM([d,c],p)(e)}function CE(e,t,r="ltr"){const n=ym(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-a,s=t.content-t.viewport,u=i-n,d=r==="ltr"?[0,s]:[s*-1,0],c=nw(e,d);return QM([0,s],[0,u])(c)}function QM(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function ZM(e,t){return e>0&&e{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return(function a(){const i={left:e.scrollLeft,top:e.scrollTop},s=r.left!==i.left,u=r.top!==i.top;(s||u)&&t(),r=i,n=window.requestAnimationFrame(a)})(),()=>window.cancelAnimationFrame(n)};function xm(e,t){const r=Fr(e),n=b.useRef(0);return b.useEffect(()=>()=>window.clearTimeout(n.current),[]),b.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function sl(e,t){const r=Fr(t);rr(()=>{let n=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return a.observe(e),()=>{window.cancelAnimationFrame(n),a.unobserve(e)}}},[e,r])}var rU=qM,nU=VM,aU=YM;function ll({className:e,children:t,...r}){return o.jsxs(rU,{"data-slot":"scroll-area",className:Ee("relative",e),...r,children:[o.jsx(nU,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),o.jsx(iU,{}),o.jsx(aU,{})]})}function iU({className:e,orientation:t="vertical",...r}){return o.jsx(HM,{"data-slot":"scroll-area-scrollbar",orientation:t,className:Ee("flex touch-none p-px transition-colors select-none",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...r,children:o.jsx(XM,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}const oU="/assets/773f0c39e1986271e9144596caac519f934a6ae6-Cou8J2R8.png";function sU({currentView:e,setCurrentView:t}){const[r,n]=b.useState(!0),a=[{name:"Dashboard",icon:NM,type:"item"},{type:"header",name:"MODULES"},{name:"Labeling",icon:Zh,type:"sub",isOpen:r,toggle:()=>n(!r),children:[{name:"Labels",icon:Zh},{name:"Label Categories",icon:jM},{name:"Label Types",icon:CM},{name:"Label Templates",icon:SM},{name:"Multiple Options",icon:Qh}]},{type:"header",name:"MANAGEMENT"},{name:"Location Manager",icon:Bl,type:"item"},{type:"header",name:"SYSTEM MANAGEMENT"},{name:"Account Management",icon:WS,type:"item"},{name:"Menu Management",icon:hu,type:"item"},{name:"System Menu",icon:Qh,type:"item"},{name:"Reports",icon:ol,type:"item"},{name:"Support",icon:Jh,type:"item"},{name:"Log Out",icon:a6,type:"item"}];return o.jsxs("div",{className:"w-64 bg-[#1e3a8a] text-white flex flex-col h-screen border-r border-blue-800 shadow-xl z-20 shrink-0",children:[o.jsx("div",{className:"flex items-center justify-center border-b border-blue-800/50 bg-white px-4 shrink-0",style:{height:90},children:o.jsx("img",{src:oU,alt:"MedVantage",className:"h-16 w-auto object-contain"})}),o.jsx(ll,{className:"flex-1 py-4",children:o.jsx("div",{className:"px-3 space-y-1",children:a.map((i,s)=>i.type==="header"?o.jsx("div",{className:"px-4 py-2 mt-4 text-xs font-semibold text-blue-300 uppercase tracking-wider",children:i.name},s):i.type==="sub"?o.jsxs("div",{className:"space-y-1",children:[o.jsxs("button",{onClick:i.toggle,className:Ee("w-full flex items-center justify-between px-4 py-2.5 text-sm font-medium rounded-lg transition-colors","hover:bg-blue-800/50 text-blue-100"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(i.icon,{className:"w-4 h-4"}),i.name]}),i.isOpen?o.jsx(al,{className:"w-4 h-4"}):o.jsx(il,{className:"w-4 h-4"})]}),i.isOpen&&o.jsx("div",{className:"pl-4 space-y-1",children:i.children?.map((u,d)=>o.jsxs("button",{onClick:()=>t(u.name),className:Ee("w-full flex items-center gap-3 px-4 py-2 text-sm font-medium rounded-lg transition-colors border-l-2",e===u.name?"bg-blue-800 border-blue-400 text-white":"border-transparent hover:bg-blue-800/30 text-blue-200 hover:text-white"),children:[o.jsx("div",{className:"w-1 h-1 rounded-full bg-current"}),u.name]},d))})]},s):o.jsxs("button",{onClick:()=>t(i.name),className:Ee("w-full flex items-center gap-3 px-4 py-2.5 text-sm font-medium rounded-lg transition-colors",e===i.name?"bg-blue-700 text-white shadow-md shadow-blue-900/20":i.name==="Log Out"?"text-red-300 hover:bg-red-900/20 hover:text-red-200":"text-blue-100 hover:bg-blue-800 hover:text-white"),children:[o.jsx(i.icon,{className:"w-4 h-4"}),i.name]},s))})})]})}function ve({className:e,type:t,...r}){return o.jsx("input",{type:t,"data-slot":"input",className:Ee("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border px-3 py-1 text-base bg-input-background transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}var lU=Symbol.for("react.lazy"),np=VS[" use ".trim().toString()];function cU(e){return typeof e=="object"&&e!==null&&"then"in e}function eD(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===lU&&"_payload"in e&&cU(e._payload)}function JS(e){const t=uU(e),r=b.forwardRef((n,a)=>{let{children:i,...s}=n;eD(i)&&typeof np=="function"&&(i=np(i._payload));const u=b.Children.toArray(i),d=u.find(fU);if(d){const c=d.props.children,h=u.map(p=>p===d?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:p);return o.jsx(t,{...s,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,h):null})}return o.jsx(t,{...s,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}var tD=JS("Slot");function uU(e){const t=b.forwardRef((r,n)=>{let{children:a,...i}=r;if(eD(a)&&typeof np=="function"&&(a=np(a._payload)),b.isValidElement(a)){const s=pU(a),u=hU(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Wn(n,s):s),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var dU=Symbol("radix.slottable");function fU(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===dU}function hU(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function pU(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}const EE=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,OE=nt,rD=(e,t)=>r=>{var n;if(t?.variants==null)return OE(e,r?.class,r?.className);const{variants:a,defaultVariants:i}=t,s=Object.keys(a).map(c=>{const h=r?.[c],p=i?.[c];if(h===null)return null;const m=EE(h)||EE(p);return a[c][m]}),u=r&&Object.entries(r).reduce((c,h)=>{let[p,m]=h;return m===void 0||(c[p]=m),c},{}),d=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((c,h)=>{let{class:p,className:m,...v}=h;return Object.entries(v).every(x=>{let[y,w]=x;return Array.isArray(w)?w.includes({...i,...u}[y]):{...i,...u}[y]===w})?[...c,p,m]:c},[]);return OE(e,s,d,r?.class,r?.className)},nD=rD("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background text-foreground hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),he=b.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...a},i)=>{const s=n?tD:"button";return o.jsx(s,{ref:i,"data-slot":"button",className:Ee(nD({variant:t,size:r,className:e})),...a})});he.displayName="Button";function mU(e,t=[]){let r=[];function n(i,s){const u=b.createContext(s);u.displayName=i+"Context";const d=r.length;r=[...r,s];const c=p=>{const{scope:m,children:v,...x}=p,y=m?.[e]?.[d]||u,w=b.useMemo(()=>x,Object.values(x));return o.jsx(y.Provider,{value:w,children:v})};c.displayName=i+"Provider";function h(p,m){const v=m?.[e]?.[d]||u,x=b.useContext(v);if(x)return x;if(s!==void 0)return s;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[c,h]}const a=()=>{const i=r.map(s=>b.createContext(s));return function(u){const d=u?.[e]||i;return b.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return a.scopeName=e,[n,gU(a,...t)]}function gU(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const s=n.reduce((u,{useScope:d,scopeName:c})=>{const p=d(i)[`__scope${c}`];return{...u,...p}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var vU=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],QS=vU.reduce((e,t)=>{const r=JS(`Primitive.${t}`),n=b.forwardRef((a,i)=>{const{asChild:s,...u}=a,d=s?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(d,{...u,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Ey={exports:{}},Oy={};/** - * @license React - * use-sync-external-store-shim.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var PE;function yU(){if(PE)return Oy;PE=1;var e=gm();function t(p,m){return p===m&&(p!==0||1/p===1/m)||p!==p&&m!==m}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,a=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function u(p,m){var v=m(),x=n({inst:{value:v,getSnapshot:m}}),y=x[0].inst,w=x[1];return i(function(){y.value=v,y.getSnapshot=m,d(y)&&w({inst:y})},[p,v,m]),a(function(){return d(y)&&w({inst:y}),p(function(){d(y)&&w({inst:y})})},[p]),s(v),v}function d(p){var m=p.getSnapshot;p=p.value;try{var v=m();return!r(p,v)}catch{return!0}}function c(p,m){return m()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:u;return Oy.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,Oy}var AE;function xU(){return AE||(AE=1,Ey.exports=yU()),Ey.exports}var bU=xU();function wU(){return bU.useSyncExternalStore(SU,()=>!0,()=>!1)}function SU(){return()=>{}}var ZS="Avatar",[jU]=mU(ZS),[NU,aD]=jU(ZS),iD=b.forwardRef((e,t)=>{const{__scopeAvatar:r,...n}=e,[a,i]=b.useState("idle");return o.jsx(NU,{scope:r,imageLoadingStatus:a,onImageLoadingStatusChange:i,children:o.jsx(QS.span,{...n,ref:t})})});iD.displayName=ZS;var oD="AvatarImage",sD=b.forwardRef((e,t)=>{const{__scopeAvatar:r,src:n,onLoadingStatusChange:a=()=>{},...i}=e,s=aD(oD,r),u=_U(n,i),d=Fr(c=>{a(c),s.onImageLoadingStatusChange(c)});return rr(()=>{u!=="idle"&&d(u)},[u,d]),u==="loaded"?o.jsx(QS.img,{...i,ref:t,src:n}):null});sD.displayName=oD;var lD="AvatarFallback",cD=b.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:n,...a}=e,i=aD(lD,r),[s,u]=b.useState(n===void 0);return b.useEffect(()=>{if(n!==void 0){const d=window.setTimeout(()=>u(!0),n);return()=>window.clearTimeout(d)}},[n]),s&&i.imageLoadingStatus!=="loaded"?o.jsx(QS.span,{...a,ref:t}):null});cD.displayName=lD;function TE(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function _U(e,{referrerPolicy:t,crossOrigin:r}){const n=wU(),a=b.useRef(null),i=n?(a.current||(a.current=new window.Image),a.current):null,[s,u]=b.useState(()=>TE(i,e));return rr(()=>{u(TE(i,e))},[i,e]),rr(()=>{const d=p=>()=>{u(p)};if(!i)return;const c=d("loaded"),h=d("error");return i.addEventListener("load",c),i.addEventListener("error",h),t&&(i.referrerPolicy=t),typeof r=="string"&&(i.crossOrigin=r),()=>{i.removeEventListener("load",c),i.removeEventListener("error",h)}},[i,r,t]),s}var CU=iD,EU=sD,OU=cD;function PU({className:e,...t}){return o.jsx(CU,{"data-slot":"avatar",className:Ee("relative flex size-10 shrink-0 overflow-hidden rounded-full",e),...t})}function AU({className:e,...t}){return o.jsx(EU,{"data-slot":"avatar-image",className:Ee("aspect-square size-full",e),...t})}function TU({className:e,...t}){return o.jsx(OU,{"data-slot":"avatar-fallback",className:Ee("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}function kU({title:e}){const t=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});return o.jsxs("header",{className:"bg-white border-b border-gray-200 px-8 flex items-center justify-between shadow-sm sticky top-0 z-10 shrink-0",style:{height:90},children:[o.jsxs("div",{children:[o.jsxs("h1",{className:"text-2xl font-bold",style:{color:"rgb(43, 50, 143)"},children:[e," Overview"]}),o.jsxs("p",{className:"text-sm text-gray-500 mt-1 flex items-center gap-2",children:[t," | Last updated: Just now"]})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("div",{className:"flex items-center w-64 h-9 rounded-md border border-gray-200 bg-gray-50 focus-within:bg-white focus-within:ring-2 focus-within:ring-ring/50 focus-within:border-ring transition-colors overflow-hidden",children:[o.jsx(vm,{className:"h-4 w-4 text-gray-400 shrink-0 ml-3 pointer-events-none"}),o.jsx(ve,{type:"search",placeholder:"Search...",className:"flex-1 min-w-0 border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 py-2 px-2 h-full"})]}),o.jsx(he,{variant:"ghost",size:"icon",className:"text-gray-500 hover:text-gray-700",children:o.jsx(Qh,{className:"w-5 h-5"})}),o.jsx("div",{className:"h-8 w-px bg-gray-200 mx-2"}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("div",{className:"text-right hidden md:block",children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Admin User"}),o.jsx("div",{className:"text-xs text-gray-500",children:"Administrator"})]}),o.jsxs(PU,{className:"h-10 w-10 border border-gray-200",children:[o.jsx(AU,{src:"https://github.com/shadcn.png"}),o.jsx(TU,{children:"AD"})]})]})]})]})}function RU({children:e,currentView:t,setCurrentView:r}){return o.jsxs("div",{className:"flex h-screen bg-gray-50 overflow-hidden font-sans",children:[o.jsx(sU,{currentView:t,setCurrentView:r}),o.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[o.jsx(kU,{title:t}),o.jsx("div",{className:"px-8 mt-8 shrink-0",children:o.jsxs("nav",{className:"flex items-center gap-2 text-sm font-normal","aria-label":"Breadcrumb",children:[o.jsx("button",{type:"button",onClick:()=>r("Dashboard"),className:"text-gray-500 hover:text-gray-700 transition-colors",children:"Home"}),o.jsx(il,{className:"w-4 h-4 text-gray-500 shrink-0"}),o.jsx("span",{style:{color:"rgb(43, 50, 143)"},children:t})]})}),o.jsx("main",{className:"flex-1 overflow-y-auto p-8",children:o.jsx("div",{className:"w-full h-full",children:e})})]})]})}function gn({className:e,...t}){return o.jsx("div",{"data-slot":"card",className:Ee("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border",e),...t})}function sa({className:e,...t}){return o.jsx("div",{"data-slot":"card-header",className:Ee("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 pt-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function la({className:e,...t}){return o.jsx("h4",{"data-slot":"card-title",className:Ee("leading-none",e),...t})}function ap({className:e,...t}){return o.jsx("p",{"data-slot":"card-description",className:Ee("text-muted-foreground",e),...t})}function qn({className:e,...t}){return o.jsx("div",{"data-slot":"card-content",className:Ee("px-6 [&:last-child]:pb-6",e),...t})}const IU=rD("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function kr({className:e,variant:t,asChild:r=!1,...n}){const a=r?tD:"span";return o.jsx(a,{"data-slot":"badge",className:Ee(IU({variant:t}),e),...n})}var Py,kE;function rn(){if(kE)return Py;kE=1;var e=Array.isArray;return Py=e,Py}var Ay,RE;function uD(){if(RE)return Ay;RE=1;var e=typeof Bf=="object"&&Bf&&Bf.Object===Object&&Bf;return Ay=e,Ay}var Ty,IE;function qa(){if(IE)return Ty;IE=1;var e=uD(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Ty=r,Ty}var ky,ME;function td(){if(ME)return ky;ME=1;var e=qa(),t=e.Symbol;return ky=t,ky}var Ry,DE;function MU(){if(DE)return Ry;DE=1;var e=td(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,a=e?e.toStringTag:void 0;function i(s){var u=r.call(s,a),d=s[a];try{s[a]=void 0;var c=!0}catch{}var h=n.call(s);return c&&(u?s[a]=d:delete s[a]),h}return Ry=i,Ry}var Iy,LE;function DU(){if(LE)return Iy;LE=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Iy=r,Iy}var My,$E;function Si(){if($E)return My;$E=1;var e=td(),t=MU(),r=DU(),n="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function s(u){return u==null?u===void 0?a:n:i&&i in Object(u)?t(u):r(u)}return My=s,My}var Dy,BE;function ji(){if(BE)return Dy;BE=1;function e(t){return t!=null&&typeof t=="object"}return Dy=e,Dy}var Ly,FE;function ql(){if(FE)return Ly;FE=1;var e=Si(),t=ji(),r="[object Symbol]";function n(a){return typeof a=="symbol"||t(a)&&e(a)==r}return Ly=n,Ly}var $y,zE;function ej(){if(zE)return $y;zE=1;var e=rn(),t=ql(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(i,s){if(e(i))return!1;var u=typeof i;return u=="number"||u=="symbol"||u=="boolean"||i==null||t(i)?!0:n.test(i)||!r.test(i)||s!=null&&i in Object(s)}return $y=a,$y}var By,qE;function oo(){if(qE)return By;qE=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return By=e,By}var Fy,UE;function tj(){if(UE)return Fy;UE=1;var e=Si(),t=oo(),r="[object AsyncFunction]",n="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function s(u){if(!t(u))return!1;var d=e(u);return d==n||d==a||d==r||d==i}return Fy=s,Fy}var zy,VE;function LU(){if(VE)return zy;VE=1;var e=qa(),t=e["__core-js_shared__"];return zy=t,zy}var qy,HE;function $U(){if(HE)return qy;HE=1;var e=LU(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return qy=r,qy}var Uy,WE;function dD(){if(WE)return Uy;WE=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return Uy=r,Uy}var Vy,GE;function BU(){if(GE)return Vy;GE=1;var e=tj(),t=$U(),r=oo(),n=dD(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,s=Function.prototype,u=Object.prototype,d=s.toString,c=u.hasOwnProperty,h=RegExp("^"+d.call(c).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(m){if(!r(m)||t(m))return!1;var v=e(m)?h:i;return v.test(n(m))}return Vy=p,Vy}var Hy,KE;function FU(){if(KE)return Hy;KE=1;function e(t,r){return t?.[r]}return Hy=e,Hy}var Wy,XE;function ns(){if(XE)return Wy;XE=1;var e=BU(),t=FU();function r(n,a){var i=t(n,a);return e(i)?i:void 0}return Wy=r,Wy}var Gy,YE;function bm(){if(YE)return Gy;YE=1;var e=ns(),t=e(Object,"create");return Gy=t,Gy}var Ky,JE;function zU(){if(JE)return Ky;JE=1;var e=bm();function t(){this.__data__=e?e(null):{},this.size=0}return Ky=t,Ky}var Xy,QE;function qU(){if(QE)return Xy;QE=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Xy=e,Xy}var Yy,ZE;function UU(){if(ZE)return Yy;ZE=1;var e=bm(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function a(i){var s=this.__data__;if(e){var u=s[i];return u===t?void 0:u}return n.call(s,i)?s[i]:void 0}return Yy=a,Yy}var Jy,eO;function VU(){if(eO)return Jy;eO=1;var e=bm(),t=Object.prototype,r=t.hasOwnProperty;function n(a){var i=this.__data__;return e?i[a]!==void 0:r.call(i,a)}return Jy=n,Jy}var Qy,tO;function HU(){if(tO)return Qy;tO=1;var e=bm(),t="__lodash_hash_undefined__";function r(n,a){var i=this.__data__;return this.size+=this.has(n)?0:1,i[n]=e&&a===void 0?t:a,this}return Qy=r,Qy}var Zy,rO;function WU(){if(rO)return Zy;rO=1;var e=zU(),t=qU(),r=UU(),n=VU(),a=HU();function i(s){var u=-1,d=s==null?0:s.length;for(this.clear();++u-1}return i0=t,i0}var o0,cO;function JU(){if(cO)return o0;cO=1;var e=wm();function t(r,n){var a=this.__data__,i=e(a,r);return i<0?(++this.size,a.push([r,n])):a[i][1]=n,this}return o0=t,o0}var s0,uO;function Sm(){if(uO)return s0;uO=1;var e=GU(),t=KU(),r=XU(),n=YU(),a=JU();function i(s){var u=-1,d=s==null?0:s.length;for(this.clear();++u0?1:-1},Do=function(t){return qo(t)&&t.indexOf("%")===t.length-1},_e=function(t){return b9(t)&&!rd(t)},w9=function(t){return rt(t)},dr=function(t){return _e(t)||qo(t)},S9=0,Vl=function(t){var r=++S9;return"".concat(t||"").concat(r)},qr=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!_e(t)&&!qo(t))return n;var i;if(Do(t)){var s=t.indexOf("%");i=r*parseFloat(t.slice(0,s))/100}else i=+t;return rd(i)&&(i=n),a&&i>r&&(i=r),i},Qi=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},j9=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function A9(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function iw(e){"@babel/helpers - typeof";return iw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},iw(e)}var $O={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},li=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},BO=null,R0=null,lj=function e(t){if(t===BO&&Array.isArray(R0))return R0;var r=[];return b.Children.forEach(t,function(n){rt(n)||(g9.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),R0=r,BO=t,r};function jn(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(a){return li(a)}):n=[li(t)],lj(e).forEach(function(a){var i=Sn(a,"type.displayName")||Sn(a,"type.name");n.indexOf(i)!==-1&&r.push(a)}),r}function mn(e,t){var r=jn(e,t);return r&&r[0]}var FO=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,a=r.height;return!(!_e(n)||n<=0||!_e(a)||a<=0)},T9=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],k9=function(t){return t&&t.type&&qo(t.type)&&T9.indexOf(t.type)>=0},R9=function(t){return t&&iw(t)==="object"&&"clipDot"in t},I9=function(t,r,n,a){var i,s=(i=k0?.[a])!==null&&i!==void 0?i:[];return r.startsWith("data-")||!Ye(t)&&(a&&s.includes(r)||C9.includes(r))||n&&sj.includes(r)},qe=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(b.isValidElement(t)&&(a=t.props),!Ul(a))return null;var i={};return Object.keys(a).forEach(function(s){var u;I9((u=a)===null||u===void 0?void 0:u[s],s,r,n)&&(i[s]=a[s])}),i},ow=function e(t,r){if(t===r)return!0;var n=b.Children.count(t);if(n!==b.Children.count(r))return!1;if(n===0)return!0;if(n===1)return zO(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function B9(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function lw(e){var t=e.children,r=e.width,n=e.height,a=e.viewBox,i=e.className,s=e.style,u=e.title,d=e.desc,c=$9(e,L9),h=a||{width:r,height:n,x:0,y:0},p=nt("recharts-surface",i);return q.createElement("svg",sw({},qe(c,!0,"svg"),{className:p,width:r,height:n,style:s,viewBox:"".concat(h.x," ").concat(h.y," ").concat(h.width," ").concat(h.height)}),q.createElement("title",null,u),q.createElement("desc",null,d),t)}var F9=["children","className"];function cw(){return cw=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function q9(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var dt=q.forwardRef(function(e,t){var r=e.children,n=e.className,a=z9(e,F9),i=nt("recharts-layer",n);return q.createElement("g",cw({className:i},qe(a,!0),{ref:t}),r)}),ha=function(t,r){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;ii?0:i+r),n=n>i?i:n,n<0&&(n+=i),i=r>n?0:n-r>>>0,r>>>=0;for(var s=Array(i);++a=i?r:e(r,n,a)}return M0=t,M0}var D0,HO;function vD(){if(HO)return D0;HO=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",a=t+r+n,i="\\ufe0e\\ufe0f",s="\\u200d",u=RegExp("["+s+e+a+i+"]");function d(c){return u.test(c)}return D0=d,D0}var L0,WO;function H9(){if(WO)return L0;WO=1;function e(t){return t.split("")}return L0=e,L0}var $0,GO;function W9(){if(GO)return $0;GO=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",a=t+r+n,i="\\ufe0e\\ufe0f",s="["+e+"]",u="["+a+"]",d="\\ud83c[\\udffb-\\udfff]",c="(?:"+u+"|"+d+")",h="[^"+e+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",m="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",x=c+"?",y="["+i+"]?",w="(?:"+v+"(?:"+[h,p,m].join("|")+")"+y+x+")*",j=y+x+w,_="(?:"+[h+u+"?",u,p,m,s].join("|")+")",C=RegExp(d+"(?="+d+")|"+_+j,"g");function A(E){return E.match(C)||[]}return $0=A,$0}var B0,KO;function G9(){if(KO)return B0;KO=1;var e=H9(),t=vD(),r=W9();function n(a){return t(a)?r(a):e(a)}return B0=n,B0}var F0,XO;function K9(){if(XO)return F0;XO=1;var e=V9(),t=vD(),r=G9(),n=hD();function a(i){return function(s){s=n(s);var u=t(s)?r(s):void 0,d=u?u[0]:s.charAt(0),c=u?e(u,1).join(""):s.slice(1);return d[i]()+c}}return F0=a,F0}var z0,YO;function X9(){if(YO)return z0;YO=1;var e=K9(),t=e("toUpperCase");return z0=t,z0}var Y9=X9();const _m=ht(Y9);function kt(e){return function(){return e}}const yD=Math.cos,sp=Math.sin,ba=Math.sqrt,lp=Math.PI,Cm=2*lp,uw=Math.PI,dw=2*uw,Ro=1e-6,J9=dw-Ro;function xD(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return xD;const r=10**t;return function(n){this._+=n[0];for(let a=1,i=n.length;aRo)if(!(Math.abs(p*d-c*h)>Ro)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let v=n-s,x=a-u,y=d*d+c*c,w=v*v+x*x,j=Math.sqrt(y),_=Math.sqrt(m),C=i*Math.tan((uw-Math.acos((y+m-w)/(2*j*_)))/2),A=C/_,E=C/j;Math.abs(A-1)>Ro&&this._append`L${t+A*h},${r+A*p}`,this._append`A${i},${i},0,0,${+(p*v>h*x)},${this._x1=t+E*d},${this._y1=r+E*c}`}}arc(t,r,n,a,i,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(a),d=n*Math.sin(a),c=t+u,h=r+d,p=1^s,m=s?a-i:i-a;this._x1===null?this._append`M${c},${h}`:(Math.abs(this._x1-c)>Ro||Math.abs(this._y1-h)>Ro)&&this._append`L${c},${h}`,n&&(m<0&&(m=m%dw+dw),m>J9?this._append`A${n},${n},0,1,${p},${t-u},${r-d}A${n},${n},0,1,${p},${this._x1=c},${this._y1=h}`:m>Ro&&this._append`A${n},${n},0,${+(m>=uw)},${p},${this._x1=t+n*Math.cos(i)},${this._y1=r+n*Math.sin(i)}`)}rect(t,r,n,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+a}h${-n}Z`}toString(){return this._}}function cj(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new Z9(t)}function uj(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function bD(e){this._context=e}bD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Em(e){return new bD(e)}function wD(e){return e[0]}function SD(e){return e[1]}function jD(e,t){var r=kt(!0),n=null,a=Em,i=null,s=cj(u);e=typeof e=="function"?e:e===void 0?wD:kt(e),t=typeof t=="function"?t:t===void 0?SD:kt(t);function u(d){var c,h=(d=uj(d)).length,p,m=!1,v;for(n==null&&(i=a(v=s())),c=0;c<=h;++c)!(c=v;--x)u.point(C[x],A[x]);u.lineEnd(),u.areaEnd()}j&&(C[m]=+e(w,m,p),A[m]=+t(w,m,p),u.point(n?+n(w,m,p):C[m],r?+r(w,m,p):A[m]))}if(_)return u=null,_+""||null}function h(){return jD().defined(a).curve(s).context(i)}return c.x=function(p){return arguments.length?(e=typeof p=="function"?p:kt(+p),n=null,c):e},c.x0=function(p){return arguments.length?(e=typeof p=="function"?p:kt(+p),c):e},c.x1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:kt(+p),c):n},c.y=function(p){return arguments.length?(t=typeof p=="function"?p:kt(+p),r=null,c):t},c.y0=function(p){return arguments.length?(t=typeof p=="function"?p:kt(+p),c):t},c.y1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:kt(+p),c):r},c.lineX0=c.lineY0=function(){return h().x(e).y(t)},c.lineY1=function(){return h().x(e).y(r)},c.lineX1=function(){return h().x(n).y(t)},c.defined=function(p){return arguments.length?(a=typeof p=="function"?p:kt(!!p),c):a},c.curve=function(p){return arguments.length?(s=p,i!=null&&(u=s(i)),c):s},c.context=function(p){return arguments.length?(p==null?i=u=null:u=s(i=p),c):i},c}class ND{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function e7(e){return new ND(e,!0)}function t7(e){return new ND(e,!1)}const dj={draw(e,t){const r=ba(t/lp);e.moveTo(r,0),e.arc(0,0,r,0,Cm)}},r7={draw(e,t){const r=ba(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},_D=ba(1/3),n7=_D*2,a7={draw(e,t){const r=ba(t/n7),n=r*_D;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},i7={draw(e,t){const r=ba(t),n=-r/2;e.rect(n,n,r,r)}},o7=.8908130915292852,CD=sp(lp/10)/sp(7*lp/10),s7=sp(Cm/10)*CD,l7=-yD(Cm/10)*CD,c7={draw(e,t){const r=ba(t*o7),n=s7*r,a=l7*r;e.moveTo(0,-r),e.lineTo(n,a);for(let i=1;i<5;++i){const s=Cm*i/5,u=yD(s),d=sp(s);e.lineTo(d*r,-u*r),e.lineTo(u*n-d*a,d*n+u*a)}e.closePath()}},q0=ba(3),u7={draw(e,t){const r=-ba(t/(q0*3));e.moveTo(0,r*2),e.lineTo(-q0*r,-r),e.lineTo(q0*r,-r),e.closePath()}},Bn=-.5,Fn=ba(3)/2,fw=1/ba(12),d7=(fw/2+1)*3,f7={draw(e,t){const r=ba(t/d7),n=r/2,a=r*fw,i=n,s=r*fw+r,u=-i,d=s;e.moveTo(n,a),e.lineTo(i,s),e.lineTo(u,d),e.lineTo(Bn*n-Fn*a,Fn*n+Bn*a),e.lineTo(Bn*i-Fn*s,Fn*i+Bn*s),e.lineTo(Bn*u-Fn*d,Fn*u+Bn*d),e.lineTo(Bn*n+Fn*a,Bn*a-Fn*n),e.lineTo(Bn*i+Fn*s,Bn*s-Fn*i),e.lineTo(Bn*u+Fn*d,Bn*d-Fn*u),e.closePath()}};function h7(e,t){let r=null,n=cj(a);e=typeof e=="function"?e:kt(e||dj),t=typeof t=="function"?t:kt(t===void 0?64:+t);function a(){let i;if(r||(r=i=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),i)return r=null,i+""||null}return a.type=function(i){return arguments.length?(e=typeof i=="function"?i:kt(i),a):e},a.size=function(i){return arguments.length?(t=typeof i=="function"?i:kt(+i),a):t},a.context=function(i){return arguments.length?(r=i??null,a):r},a}function cp(){}function up(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function ED(e){this._context=e}ED.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:up(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:up(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function p7(e){return new ED(e)}function OD(e){this._context=e}OD.prototype={areaStart:cp,areaEnd:cp,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:up(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function m7(e){return new OD(e)}function PD(e){this._context=e}PD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:up(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function g7(e){return new PD(e)}function AD(e){this._context=e}AD.prototype={areaStart:cp,areaEnd:cp,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function v7(e){return new AD(e)}function JO(e){return e<0?-1:1}function QO(e,t,r){var n=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(n||a<0&&-0),s=(r-e._y1)/(a||n<0&&-0),u=(i*a+s*n)/(n+a);return(JO(i)+JO(s))*Math.min(Math.abs(i),Math.abs(s),.5*Math.abs(u))||0}function ZO(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function U0(e,t,r){var n=e._x0,a=e._y0,i=e._x1,s=e._y1,u=(i-n)/3;e._context.bezierCurveTo(n+u,a+u*t,i-u,s-u*r,i,s)}function dp(e){this._context=e}dp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:U0(this,this._t0,ZO(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,U0(this,ZO(this,r=QO(this,e,t)),r);break;default:U0(this,this._t0,r=QO(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function TD(e){this._context=new kD(e)}(TD.prototype=Object.create(dp.prototype)).point=function(e,t){dp.prototype.point.call(this,t,e)};function kD(e){this._context=e}kD.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,a,i){this._context.bezierCurveTo(t,e,n,r,i,a)}};function y7(e){return new dp(e)}function x7(e){return new TD(e)}function RD(e){this._context=e}RD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=eP(e),a=eP(t),i=0,s=1;s=0;--t)a[t]=(s[t]-a[t+1])/i[t];for(i[r-1]=(e[r]+a[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function w7(e){return new Om(e,.5)}function S7(e){return new Om(e,0)}function j7(e){return new Om(e,1)}function cl(e,t){if((s=e.length)>1)for(var r=1,n,a,i=e[t[0]],s,u=i.length;r=0;)r[t]=t;return r}function N7(e,t){return e[t]}function _7(e){const t=[];return t.key=e,t}function C7(){var e=kt([]),t=hw,r=cl,n=N7;function a(i){var s=Array.from(e.apply(this,arguments),_7),u,d=s.length,c=-1,h;for(const p of i)for(u=0,++c;u0){for(var r,n,a=0,i=e[0].length,s;a0){for(var r=0,n=e[t[0]],a,i=n.length;r0)||!((i=(a=e[t[0]]).length)>0))){for(var r=0,n=1,a,i,s;n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function M7(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var ID={symbolCircle:dj,symbolCross:r7,symbolDiamond:a7,symbolSquare:i7,symbolStar:c7,symbolTriangle:u7,symbolWye:f7},D7=Math.PI/180,L7=function(t){var r="symbol".concat(_m(t));return ID[r]||dj},$7=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*D7;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},B7=function(t,r){ID["symbol".concat(_m(t))]=r},fj=function(t){var r=t.type,n=r===void 0?"circle":r,a=t.size,i=a===void 0?64:a,s=t.sizeType,u=s===void 0?"area":s,d=I7(t,A7),c=rP(rP({},d),{},{type:n,size:i,sizeType:u}),h=function(){var w=L7(n),j=h7().type(w).size($7(i,u,n));return j()},p=c.className,m=c.cx,v=c.cy,x=qe(c,!0);return m===+m&&v===+v&&i===+i?q.createElement("path",pw({},x,{className:nt("recharts-symbols",p),transform:"translate(".concat(m,", ").concat(v,")"),d:h()})):null};fj.registerSymbol=B7;function ul(e){"@babel/helpers - typeof";return ul=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ul(e)}function mw(){return mw=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var _=v.inactive?c:v.color;return q.createElement("li",mw({className:w,style:p,key:"legend-item-".concat(x)},Uo(n.props,v,x)),q.createElement(lw,{width:s,height:s,viewBox:h,style:m},n.renderIcon(v)),q.createElement("span",{className:"recharts-legend-item-text",style:{color:_}},y?y(j,v,x):j))})}},{key:"render",value:function(){var n=this.props,a=n.payload,i=n.layout,s=n.align;if(!a||!a.length)return null;var u={padding:0,margin:0,textAlign:i==="horizontal"?s:"left"};return q.createElement("ul",{className:"recharts-default-legend",style:u},this.renderItems())}}])})(b.PureComponent);mu(hj,"displayName","Legend");mu(hj,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var V0,aP;function X7(){if(aP)return V0;aP=1;var e=Sm();function t(){this.__data__=new e,this.size=0}return V0=t,V0}var H0,iP;function Y7(){if(iP)return H0;iP=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return H0=e,H0}var W0,oP;function J7(){if(oP)return W0;oP=1;function e(t){return this.__data__.get(t)}return W0=e,W0}var G0,sP;function Q7(){if(sP)return G0;sP=1;function e(t){return this.__data__.has(t)}return G0=e,G0}var K0,lP;function Z7(){if(lP)return K0;lP=1;var e=Sm(),t=nj(),r=aj(),n=200;function a(i,s){var u=this.__data__;if(u instanceof e){var d=u.__data__;if(!t||d.lengthv))return!1;var y=p.get(s),w=p.get(u);if(y&&w)return y==u&&w==s;var j=-1,_=!0,C=d&a?new e:void 0;for(p.set(s,u),p.set(u,s);++j-1&&n%1==0&&n-1&&r%1==0&&r<=e}return gx=t,gx}var vx,kP;function fV(){if(kP)return vx;kP=1;var e=Si(),t=vj(),r=ji(),n="[object Arguments]",a="[object Array]",i="[object Boolean]",s="[object Date]",u="[object Error]",d="[object Function]",c="[object Map]",h="[object Number]",p="[object Object]",m="[object RegExp]",v="[object Set]",x="[object String]",y="[object WeakMap]",w="[object ArrayBuffer]",j="[object DataView]",_="[object Float32Array]",C="[object Float64Array]",A="[object Int8Array]",E="[object Int16Array]",O="[object Int32Array]",T="[object Uint8Array]",k="[object Uint8ClampedArray]",M="[object Uint16Array]",$="[object Uint32Array]",z={};z[_]=z[C]=z[A]=z[E]=z[O]=z[T]=z[k]=z[M]=z[$]=!0,z[n]=z[a]=z[w]=z[i]=z[j]=z[s]=z[u]=z[d]=z[c]=z[h]=z[p]=z[m]=z[v]=z[x]=z[y]=!1;function F(V){return r(V)&&t(V.length)&&!!z[e(V)]}return vx=F,vx}var yx,RP;function VD(){if(RP)return yx;RP=1;function e(t){return function(r){return t(r)}}return yx=e,yx}var ru={exports:{}};ru.exports;var IP;function hV(){return IP||(IP=1,(function(e,t){var r=uD(),n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===n,s=i&&r.process,u=(function(){try{var d=a&&a.require&&a.require("util").types;return d||s&&s.binding&&s.binding("util")}catch{}})();e.exports=u})(ru,ru.exports)),ru.exports}var xx,MP;function HD(){if(MP)return xx;MP=1;var e=fV(),t=VD(),r=hV(),n=r&&r.isTypedArray,a=n?t(n):e;return xx=a,xx}var bx,DP;function pV(){if(DP)return bx;DP=1;var e=cV(),t=mj(),r=rn(),n=UD(),a=gj(),i=HD(),s=Object.prototype,u=s.hasOwnProperty;function d(c,h){var p=r(c),m=!p&&t(c),v=!p&&!m&&n(c),x=!p&&!m&&!v&&i(c),y=p||m||v||x,w=y?e(c.length,String):[],j=w.length;for(var _ in c)(h||u.call(c,_))&&!(y&&(_=="length"||v&&(_=="offset"||_=="parent")||x&&(_=="buffer"||_=="byteLength"||_=="byteOffset")||a(_,j)))&&w.push(_);return w}return bx=d,bx}var wx,LP;function mV(){if(LP)return wx;LP=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,a=typeof n=="function"&&n.prototype||e;return r===a}return wx=t,wx}var Sx,$P;function WD(){if($P)return Sx;$P=1;function e(t,r){return function(n){return t(r(n))}}return Sx=e,Sx}var jx,BP;function gV(){if(BP)return jx;BP=1;var e=WD(),t=e(Object.keys,Object);return jx=t,jx}var Nx,FP;function vV(){if(FP)return Nx;FP=1;var e=mV(),t=gV(),r=Object.prototype,n=r.hasOwnProperty;function a(i){if(!e(i))return t(i);var s=[];for(var u in Object(i))n.call(i,u)&&u!="constructor"&&s.push(u);return s}return Nx=a,Nx}var _x,zP;function nd(){if(zP)return _x;zP=1;var e=tj(),t=vj();function r(n){return n!=null&&t(n.length)&&!e(n)}return _x=r,_x}var Cx,qP;function Pm(){if(qP)return Cx;qP=1;var e=pV(),t=vV(),r=nd();function n(a){return r(a)?e(a):t(a)}return Cx=n,Cx}var Ex,UP;function yV(){if(UP)return Ex;UP=1;var e=iV(),t=lV(),r=Pm();function n(a){return e(a,r,t)}return Ex=n,Ex}var Ox,VP;function xV(){if(VP)return Ox;VP=1;var e=yV(),t=1,r=Object.prototype,n=r.hasOwnProperty;function a(i,s,u,d,c,h){var p=u&t,m=e(i),v=m.length,x=e(s),y=x.length;if(v!=y&&!p)return!1;for(var w=v;w--;){var j=m[w];if(!(p?j in s:n.call(s,j)))return!1}var _=h.get(i),C=h.get(s);if(_&&C)return _==s&&C==i;var A=!0;h.set(i,s),h.set(s,i);for(var E=p;++w-1}return eb=t,eb}var tb,v2;function BV(){if(v2)return tb;v2=1;function e(t,r,n){for(var a=-1,i=t==null?0:t.length;++a=s){var j=c?null:a(d);if(j)return i(j);x=!1,m=n,w=new e}else w=c?[]:y;e:for(;++p=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function eH(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function tH(e){return e.value}function rH(e,t){if(q.isValidElement(e))return q.cloneElement(e,t);if(typeof e=="function")return q.createElement(e,t);t.ref;var r=ZV(t,HV);return q.createElement(hj,r)}var _2=1,Zs=(function(e){function t(){var r;WV(this,t);for(var n=arguments.length,a=new Array(n),i=0;i_2||Math.abs(a.height-this.lastBoundingBox.height)>_2)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,n&&n(a)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?ri({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var a=this.props,i=a.layout,s=a.align,u=a.verticalAlign,d=a.margin,c=a.chartWidth,h=a.chartHeight,p,m;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(s==="center"&&i==="vertical"){var v=this.getBBoxSnapshot();p={left:((c||0)-v.width)/2}}else p=s==="right"?{right:d&&d.right||0}:{left:d&&d.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(u==="middle"){var x=this.getBBoxSnapshot();m={top:((h||0)-x.height)/2}}else m=u==="bottom"?{bottom:d&&d.bottom||0}:{top:d&&d.top||0};return ri(ri({},p),m)}},{key:"render",value:function(){var n=this,a=this.props,i=a.content,s=a.width,u=a.height,d=a.wrapperStyle,c=a.payloadUniqBy,h=a.payload,p=ri(ri({position:"absolute",width:s||"auto",height:u||"auto"},this.getDefaultPosition(d)),d);return q.createElement("div",{className:"recharts-legend-wrapper",style:p,ref:function(v){n.wrapperNode=v}},rH(i,ri(ri({},this.props),{},{payload:JD(h,c,tH)})))}}],[{key:"getWithHeight",value:function(n,a){var i=ri(ri({},this.defaultProps),n.props),s=i.layout;return s==="vertical"&&_e(n.props.height)?{height:n.props.height}:s==="horizontal"?{width:n.props.width||a}:null}}])})(b.PureComponent);Am(Zs,"displayName","Legend");Am(Zs,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var ob,C2;function nH(){if(C2)return ob;C2=1;var e=td(),t=mj(),r=rn(),n=e?e.isConcatSpreadable:void 0;function a(i){return r(i)||t(i)||!!(n&&i&&i[n])}return ob=a,ob}var sb,E2;function eL(){if(E2)return sb;E2=1;var e=qD(),t=nH();function r(n,a,i,s,u){var d=-1,c=n.length;for(i||(i=t),u||(u=[]);++d0&&i(h)?a>1?r(h,a-1,i,s,u):e(u,h):s||(u[u.length]=h)}return u}return sb=r,sb}var lb,O2;function aH(){if(O2)return lb;O2=1;function e(t){return function(r,n,a){for(var i=-1,s=Object(r),u=a(r),d=u.length;d--;){var c=u[t?d:++i];if(n(s[c],c,s)===!1)break}return r}}return lb=e,lb}var cb,P2;function iH(){if(P2)return cb;P2=1;var e=aH(),t=e();return cb=t,cb}var ub,A2;function tL(){if(A2)return ub;A2=1;var e=iH(),t=Pm();function r(n,a){return n&&e(n,a,t)}return ub=r,ub}var db,T2;function oH(){if(T2)return db;T2=1;var e=nd();function t(r,n){return function(a,i){if(a==null)return a;if(!e(a))return r(a,i);for(var s=a.length,u=n?s:-1,d=Object(a);(n?u--:++un||u&&d&&h&&!c&&!p||i&&d&&h||!a&&h||!s)return 1;if(!i&&!u&&!p&&r=c)return h;var p=a[i];return h*(p=="desc"?-1:1)}}return r.index-n.index}return gb=t,gb}var vb,L2;function uH(){if(L2)return vb;L2=1;var e=ij(),t=oj(),r=Ua(),n=rL(),a=sH(),i=VD(),s=cH(),u=Hl(),d=rn();function c(h,p,m){p.length?p=e(p,function(y){return d(y)?function(w){return t(w,y.length===1?y[0]:y)}:y}):p=[u];var v=-1;p=e(p,i(r));var x=n(h,function(y,w,j){var _=e(p,function(C){return C(y)});return{criteria:_,index:++v,value:y}});return a(x,function(y,w){return s(y,w,m)})}return vb=c,vb}var yb,$2;function dH(){if($2)return yb;$2=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return yb=e,yb}var xb,B2;function fH(){if(B2)return xb;B2=1;var e=dH(),t=Math.max;function r(n,a,i){return a=t(a===void 0?n.length-1:a,0),function(){for(var s=arguments,u=-1,d=t(s.length-a,0),c=Array(d);++u0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return jb=n,jb}var Nb,V2;function gH(){if(V2)return Nb;V2=1;var e=pH(),t=mH(),r=t(e);return Nb=r,Nb}var _b,H2;function vH(){if(H2)return _b;H2=1;var e=Hl(),t=fH(),r=gH();function n(a,i){return r(t(a,i,e),a+"")}return _b=n,_b}var Cb,W2;function Tm(){if(W2)return Cb;W2=1;var e=rj(),t=nd(),r=gj(),n=oo();function a(i,s,u){if(!n(u))return!1;var d=typeof s;return(d=="number"?t(u)&&r(s,u.length):d=="string"&&s in u)?e(u[s],i):!1}return Cb=a,Cb}var Eb,G2;function yH(){if(G2)return Eb;G2=1;var e=eL(),t=uH(),r=vH(),n=Tm(),a=r(function(i,s){if(i==null)return[];var u=s.length;return u>1&&n(i,s[0],s[1])?s=[]:u>2&&n(s[0],s[1],s[2])&&(s=[s[0]]),t(i,e(s,1),[])});return Eb=a,Eb}var xH=yH();const bj=ht(xH);function gu(e){"@babel/helpers - typeof";return gu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gu(e)}function yw(){return yw=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t.x),"".concat(Bc,"-left"),_e(r)&&t&&_e(t.x)&&r=t.y),"".concat(Bc,"-top"),_e(n)&&t&&_e(t.y)&&ny?Math.max(h,d[n]):Math.max(p,d[n])}function IH(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function MH(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,a=e.position,i=e.reverseDirection,s=e.tooltipBox,u=e.useTranslate3d,d=e.viewBox,c,h,p;return s.height>0&&s.width>0&&r?(h=Y2({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:a,reverseDirection:i,tooltipDimension:s.width,viewBox:d,viewBoxDimension:d.width}),p=Y2({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:a,reverseDirection:i,tooltipDimension:s.height,viewBox:d,viewBoxDimension:d.height}),c=IH({translateX:h,translateY:p,useTranslate3d:u})):c=kH,{cssProperties:c,cssClasses:RH({translateX:h,translateY:p,coordinate:r})}}function fl(e){"@babel/helpers - typeof";return fl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fl(e)}function J2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Q2(e){for(var t=1;tZ2||Math.abs(n.height-this.state.lastBoundingBox.height)>Z2)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,a=this.props,i=a.active,s=a.allowEscapeViewBox,u=a.animationDuration,d=a.animationEasing,c=a.children,h=a.coordinate,p=a.hasPayload,m=a.isAnimationActive,v=a.offset,x=a.position,y=a.reverseDirection,w=a.useTranslate3d,j=a.viewBox,_=a.wrapperStyle,C=MH({allowEscapeViewBox:s,coordinate:h,offsetTopLeft:v,position:x,reverseDirection:y,tooltipBox:this.state.lastBoundingBox,useTranslate3d:w,viewBox:j}),A=C.cssClasses,E=C.cssProperties,O=Q2(Q2({transition:m&&i?"transform ".concat(u,"ms ").concat(d):void 0},E),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&p?"visible":"hidden",position:"absolute",top:0,left:0},_);return q.createElement("div",{tabIndex:-1,className:A,style:O,ref:function(k){n.wrapperNode=k}},c)}}])})(b.PureComponent),HH=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},as={isSsr:HH()};function hl(e){"@babel/helpers - typeof";return hl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hl(e)}function eA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function tA(e){for(var t=1;t0;return q.createElement(VH,{allowEscapeViewBox:s,animationDuration:u,animationEasing:d,isAnimationActive:m,active:i,coordinate:h,hasPayload:O,offset:v,position:w,reverseDirection:j,useTranslate3d:_,viewBox:C,wrapperStyle:A},tW(c,tA(tA({},this.props),{},{payload:E})))}}])})(b.PureComponent);wj(vn,"displayName","Tooltip");wj(vn,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!as.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var Pb,rA;function rW(){if(rA)return Pb;rA=1;var e=qa(),t=function(){return e.Date.now()};return Pb=t,Pb}var Ab,nA;function nW(){if(nA)return Ab;nA=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return Ab=t,Ab}var Tb,aA;function aW(){if(aA)return Tb;aA=1;var e=nW(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return Tb=r,Tb}var kb,iA;function lL(){if(iA)return kb;iA=1;var e=aW(),t=oo(),r=ql(),n=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,u=parseInt;function d(c){if(typeof c=="number")return c;if(r(c))return n;if(t(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=t(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=e(c);var p=i.test(c);return p||s.test(c)?u(c.slice(2),p?2:8):a.test(c)?n:+c}return kb=d,kb}var Rb,oA;function iW(){if(oA)return Rb;oA=1;var e=oo(),t=rW(),r=lL(),n="Expected a function",a=Math.max,i=Math.min;function s(u,d,c){var h,p,m,v,x,y,w=0,j=!1,_=!1,C=!0;if(typeof u!="function")throw new TypeError(n);d=r(d)||0,e(c)&&(j=!!c.leading,_="maxWait"in c,m=_?a(r(c.maxWait)||0,d):m,C="trailing"in c?!!c.trailing:C);function A(V){var G=h,U=p;return h=p=void 0,w=V,v=u.apply(U,G),v}function E(V){return w=V,x=setTimeout(k,d),j?A(V):v}function O(V){var G=V-y,U=V-w,H=d-G;return _?i(H,m-U):H}function T(V){var G=V-y,U=V-w;return y===void 0||G>=d||G<0||_&&U>=m}function k(){var V=t();if(T(V))return M(V);x=setTimeout(k,O(V))}function M(V){return x=void 0,C&&h?A(V):(h=p=void 0,v)}function $(){x!==void 0&&clearTimeout(x),w=0,h=y=p=x=void 0}function z(){return x===void 0?v:M(t())}function F(){var V=t(),G=T(V);if(h=arguments,p=this,y=V,G){if(x===void 0)return E(y);if(_)return clearTimeout(x),x=setTimeout(k,d),A(y)}return x===void 0&&(x=setTimeout(k,d)),v}return F.cancel=$,F.flush=z,F}return Rb=s,Rb}var Ib,sA;function oW(){if(sA)return Ib;sA=1;var e=iW(),t=oo(),r="Expected a function";function n(a,i,s){var u=!0,d=!0;if(typeof a!="function")throw new TypeError(r);return t(s)&&(u="leading"in s?!!s.leading:u,d="trailing"in s?!!s.trailing:d),e(a,i,{leading:u,maxWait:i,trailing:d})}return Ib=n,Ib}var sW=oW();const cL=ht(sW);function yu(e){"@babel/helpers - typeof";return yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yu(e)}function lA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Gf(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(V=cL(V,y,{trailing:!0,leading:!1}));var G=new ResizeObserver(V),U=E.current.getBoundingClientRect(),H=U.width,W=U.height;return z(H,W),G.observe(E.current),function(){G.disconnect()}},[z,y]);var F=b.useMemo(function(){var V=M.containerWidth,G=M.containerHeight;if(V<0||G<0)return null;ha(Do(s)||Do(d),`The width(%s) and height(%s) are both fixed numbers, - maybe you don't need to use a ResponsiveContainer.`,s,d),ha(!r||r>0,"The aspect(%s) must be greater than zero.",r);var U=Do(s)?V:s,H=Do(d)?G:d;r&&r>0&&(U?H=U/r:H&&(U=H*r),m&&H>m&&(H=m)),ha(U>0||H>0,`The width(%s) and height(%s) of chart should be greater than 0, - please check the style of container, or the props width(%s) and height(%s), - or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the - height and width.`,U,H,s,d,h,p,r);var W=!Array.isArray(v)&&li(v.type).endsWith("Chart");return q.Children.map(v,function(B){return q.isValidElement(B)?b.cloneElement(B,Gf({width:U,height:H},W?{style:Gf({height:"100%",width:"100%",maxHeight:H,maxWidth:U},B.props.style)}:{})):B})},[r,v,d,m,p,h,M,s]);return q.createElement("div",{id:w?"".concat(w):void 0,className:nt("recharts-responsive-container",j),style:Gf(Gf({},A),{},{width:s,height:d,minWidth:h,minHeight:p,maxHeight:m}),ref:E},F)}),km=function(t){return null};km.displayName="Cell";function xu(e){"@babel/helpers - typeof";return xu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xu(e)}function uA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Sw(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||as.isSsr)return{width:0,height:0};var n=wW(r),a=JSON.stringify({text:t,copyStyle:n});if(ks.widthCache[a])return ks.widthCache[a];try{var i=document.getElementById(dA);i||(i=document.createElement("span"),i.setAttribute("id",dA),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var s=Sw(Sw({},bW),n);Object.assign(i.style,s),i.textContent="".concat(t);var u=i.getBoundingClientRect(),d={width:u.width,height:u.height};return ks.widthCache[a]=d,++ks.cacheCount>xW&&(ks.cacheCount=0,ks.widthCache={}),d}catch{return{width:0,height:0}}},SW=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function bu(e){"@babel/helpers - typeof";return bu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bu(e)}function vp(e,t){return CW(e)||_W(e,t)||NW(e,t)||jW()}function jW(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NW(e,t){if(e){if(typeof e=="string")return fA(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fA(e,t)}}function fA(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function FW(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function yA(e,t){return VW(e)||UW(e,t)||qW(e,t)||zW()}function zW(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qW(e,t){if(e){if(typeof e=="string")return xA(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xA(e,t)}}function xA(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[];return U.reduce(function(H,W){var B=W.word,Q=W.width,R=H[H.length-1];if(R&&(a==null||i||R.width+Q+nW.width?H:W})};if(!h)return v;for(var y="…",w=function(U){var H=p.slice(0,U),W=hL({breakAll:c,style:d,children:H+y}).wordsWithComputedWidth,B=m(W),Q=B.length>s||x(B).width>Number(a);return[Q,B]},j=0,_=p.length-1,C=0,A;j<=_&&C<=p.length-1;){var E=Math.floor((j+_)/2),O=E-1,T=w(O),k=yA(T,2),M=k[0],$=k[1],z=w(E),F=yA(z,1),V=F[0];if(!M&&!V&&(j=E+1),M&&V&&(_=E-1),!M&&V){A=$;break}C++}return A||v},bA=function(t){var r=rt(t)?[]:t.toString().split(fL);return[{words:r}]},WW=function(t){var r=t.width,n=t.scaleToFit,a=t.children,i=t.style,s=t.breakAll,u=t.maxLines;if((r||n)&&!as.isSsr){var d,c,h=hL({breakAll:s,children:a,style:i});if(h){var p=h.wordsWithComputedWidth,m=h.spaceWidth;d=p,c=m}else return bA(a);return HW({breakAll:s,children:a,maxLines:u,style:i},d,c,r,n)}return bA(a)},wA="#808080",Vo=function(t){var r=t.x,n=r===void 0?0:r,a=t.y,i=a===void 0?0:a,s=t.lineHeight,u=s===void 0?"1em":s,d=t.capHeight,c=d===void 0?"0.71em":d,h=t.scaleToFit,p=h===void 0?!1:h,m=t.textAnchor,v=m===void 0?"start":m,x=t.verticalAnchor,y=x===void 0?"end":x,w=t.fill,j=w===void 0?wA:w,_=vA(t,$W),C=b.useMemo(function(){return WW({breakAll:_.breakAll,children:_.children,maxLines:_.maxLines,scaleToFit:p,style:_.style,width:_.width})},[_.breakAll,_.children,_.maxLines,p,_.style,_.width]),A=_.dx,E=_.dy,O=_.angle,T=_.className,k=_.breakAll,M=vA(_,BW);if(!dr(n)||!dr(i))return null;var $=n+(_e(A)?A:0),z=i+(_e(E)?E:0),F;switch(y){case"start":F=Mb("calc(".concat(c,")"));break;case"middle":F=Mb("calc(".concat((C.length-1)/2," * -").concat(u," + (").concat(c," / 2))"));break;default:F=Mb("calc(".concat(C.length-1," * -").concat(u,")"));break}var V=[];if(p){var G=C[0].width,U=_.width;V.push("scale(".concat((_e(U)?U/G:1)/G,")"))}return O&&V.push("rotate(".concat(O,", ").concat($,", ").concat(z,")")),V.length&&(M.transform=V.join(" ")),q.createElement("text",jw({},qe(M,!0),{x:$,y:z,className:nt("recharts-text",T),textAnchor:v,fill:j.includes("url")?wA:j}),C.map(function(H,W){var B=H.words.join(k?"":" ");return q.createElement("tspan",{x:$,dy:W===0?F:u,key:"".concat(B,"-").concat(W)},B)}))};function to(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function GW(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Sj(e){let t,r,n;e.length!==2?(t=to,r=(u,d)=>to(e(u),d),n=(u,d)=>e(u)-d):(t=e===to||e===GW?e:KW,r=e,n=e);function a(u,d,c=0,h=u.length){if(c>>1;r(u[p],d)<0?c=p+1:h=p}while(c>>1;r(u[p],d)<=0?c=p+1:h=p}while(cc&&n(u[p-1],d)>-n(u[p],d)?p-1:p}return{left:a,center:s,right:i}}function KW(){return 0}function pL(e){return e===null?NaN:+e}function*XW(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const YW=Sj(to),ad=YW.right;Sj(pL).center;class SA extends Map{constructor(t,r=ZW){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,a]of t)this.set(n,a)}get(t){return super.get(jA(this,t))}has(t){return super.has(jA(this,t))}set(t,r){return super.set(JW(this,t),r)}delete(t){return super.delete(QW(this,t))}}function jA({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function JW({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function QW({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function ZW(e){return e!==null&&typeof e=="object"?e.valueOf():e}function eG(e=to){if(e===to)return mL;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function mL(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const tG=Math.sqrt(50),rG=Math.sqrt(10),nG=Math.sqrt(2);function yp(e,t,r){const n=(t-e)/Math.max(0,r),a=Math.floor(Math.log10(n)),i=n/Math.pow(10,a),s=i>=tG?10:i>=rG?5:i>=nG?2:1;let u,d,c;return a<0?(c=Math.pow(10,-a)/s,u=Math.round(e*c),d=Math.round(t*c),u/ct&&--d,c=-c):(c=Math.pow(10,a)*s,u=Math.round(e/c),d=Math.round(t/c),u*ct&&--d),d0))return[];if(e===t)return[e];const n=t=a))return[];const u=i-a+1,d=new Array(u);if(n)if(s<0)for(let c=0;c=n)&&(r=n);return r}function _A(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function gL(e,t,r=0,n=1/0,a){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(a=a===void 0?mL:eG(a);n>r;){if(n-r>600){const d=n-r+1,c=t-r+1,h=Math.log(d),p=.5*Math.exp(2*h/3),m=.5*Math.sqrt(h*p*(d-p)/d)*(c-d/2<0?-1:1),v=Math.max(r,Math.floor(t-c*p/d+m)),x=Math.min(n,Math.floor(t+(d-c)*p/d+m));gL(e,t,v,x,a)}const i=e[t];let s=r,u=n;for(Fc(e,r,t),a(e[n],i)>0&&Fc(e,r,n);s0;)--u}a(e[r],i)===0?Fc(e,r,u):(++u,Fc(e,u,n)),u<=t&&(r=u+1),t<=u&&(n=u-1)}return e}function Fc(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function aG(e,t,r){if(e=Float64Array.from(XW(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return _A(e);if(t>=1)return NA(e);var n,a=(n-1)*t,i=Math.floor(a),s=NA(gL(e,i).subarray(0,i+1)),u=_A(e.subarray(i+1));return s+(u-s)*(a-i)}}function iG(e,t,r=pL){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,a=(n-1)*t,i=Math.floor(a),s=+r(e[i],i,e),u=+r(e[i+1],i+1,e);return s+(u-s)*(a-i)}}function oG(e,t,r){e=+e,t=+t,r=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+r;for(var n=-1,a=Math.max(0,Math.ceil((t-e)/r))|0,i=new Array(a);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Xf(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Xf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=lG.exec(e))?new Zr(t[1],t[2],t[3],1):(t=cG.exec(e))?new Zr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=uG.exec(e))?Xf(t[1],t[2],t[3],t[4]):(t=dG.exec(e))?Xf(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=fG.exec(e))?kA(t[1],t[2]/100,t[3]/100,1):(t=hG.exec(e))?kA(t[1],t[2]/100,t[3]/100,t[4]):CA.hasOwnProperty(e)?PA(CA[e]):e==="transparent"?new Zr(NaN,NaN,NaN,0):null}function PA(e){return new Zr(e>>16&255,e>>8&255,e&255,1)}function Xf(e,t,r,n){return n<=0&&(e=t=r=NaN),new Zr(e,t,r,n)}function gG(e){return e instanceof id||(e=Nu(e)),e?(e=e.rgb(),new Zr(e.r,e.g,e.b,e.opacity)):new Zr}function Ow(e,t,r,n){return arguments.length===1?gG(e):new Zr(e,t,r,n??1)}function Zr(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}Nj(Zr,Ow,yL(id,{brighter(e){return e=e==null?xp:Math.pow(xp,e),new Zr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Su:Math.pow(Su,e),new Zr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Zr(Fo(this.r),Fo(this.g),Fo(this.b),bp(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:AA,formatHex:AA,formatHex8:vG,formatRgb:TA,toString:TA}));function AA(){return`#${Lo(this.r)}${Lo(this.g)}${Lo(this.b)}`}function vG(){return`#${Lo(this.r)}${Lo(this.g)}${Lo(this.b)}${Lo((isNaN(this.opacity)?1:this.opacity)*255)}`}function TA(){const e=bp(this.opacity);return`${e===1?"rgb(":"rgba("}${Fo(this.r)}, ${Fo(this.g)}, ${Fo(this.b)}${e===1?")":`, ${e})`}`}function bp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Fo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Lo(e){return e=Fo(e),(e<16?"0":"")+e.toString(16)}function kA(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new da(e,t,r,n)}function xL(e){if(e instanceof da)return new da(e.h,e.s,e.l,e.opacity);if(e instanceof id||(e=Nu(e)),!e)return new da;if(e instanceof da)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,a=Math.min(t,r,n),i=Math.max(t,r,n),s=NaN,u=i-a,d=(i+a)/2;return u?(t===i?s=(r-n)/u+(r0&&d<1?0:s,new da(s,u,d,e.opacity)}function yG(e,t,r,n){return arguments.length===1?xL(e):new da(e,t,r,n??1)}function da(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Nj(da,yG,yL(id,{brighter(e){return e=e==null?xp:Math.pow(xp,e),new da(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Su:Math.pow(Su,e),new da(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,a=2*r-n;return new Zr(Db(e>=240?e-240:e+120,a,n),Db(e,a,n),Db(e<120?e+240:e-120,a,n),this.opacity)},clamp(){return new da(RA(this.h),Yf(this.s),Yf(this.l),bp(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=bp(this.opacity);return`${e===1?"hsl(":"hsla("}${RA(this.h)}, ${Yf(this.s)*100}%, ${Yf(this.l)*100}%${e===1?")":`, ${e})`}`}}));function RA(e){return e=(e||0)%360,e<0?e+360:e}function Yf(e){return Math.max(0,Math.min(1,e||0))}function Db(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const _j=e=>()=>e;function xG(e,t){return function(r){return e+r*t}}function bG(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function wG(e){return(e=+e)==1?bL:function(t,r){return r-t?bG(t,r,e):_j(isNaN(t)?r:t)}}function bL(e,t){var r=t-e;return r?xG(e,r):_j(isNaN(e)?t:e)}const IA=(function e(t){var r=wG(t);function n(a,i){var s=r((a=Ow(a)).r,(i=Ow(i)).r),u=r(a.g,i.g),d=r(a.b,i.b),c=bL(a.opacity,i.opacity);return function(h){return a.r=s(h),a.g=u(h),a.b=d(h),a.opacity=c(h),a+""}}return n.gamma=e,n})(1);function SG(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),a;return function(i){for(a=0;ar&&(i=t.slice(r,i),u[s]?u[s]+=i:u[++s]=i),(n=n[0])===(a=a[0])?u[s]?u[s]+=a:u[++s]=a:(u[++s]=null,d.push({i:s,x:wp(n,a)})),r=Lb.lastIndex;return rt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function RG(e,t,r){var n=e[0],a=e[1],i=t[0],s=t[1];return a2?IG:RG,d=c=null,p}function p(m){return m==null||isNaN(m=+m)?i:(d||(d=u(e.map(n),t,r)))(n(s(m)))}return p.invert=function(m){return s(a((c||(c=u(t,e.map(n),wp)))(m)))},p.domain=function(m){return arguments.length?(e=Array.from(m,Sp),h()):e.slice()},p.range=function(m){return arguments.length?(t=Array.from(m),h()):t.slice()},p.rangeRound=function(m){return t=Array.from(m),r=Cj,h()},p.clamp=function(m){return arguments.length?(s=m?!0:Ur,h()):s!==Ur},p.interpolate=function(m){return arguments.length?(r=m,h()):r},p.unknown=function(m){return arguments.length?(i=m,p):i},function(m,v){return n=m,a=v,h()}}function Ej(){return Rm()(Ur,Ur)}function MG(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function jp(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function pl(e){return e=jp(Math.abs(e)),e?e[1]:NaN}function DG(e,t){return function(r,n){for(var a=r.length,i=[],s=0,u=e[0],d=0;a>0&&u>0&&(d+u+1>n&&(u=Math.max(1,n-d)),i.push(r.substring(a-=u,a+u)),!((d+=u+1)>n));)u=e[s=(s+1)%e.length];return i.reverse().join(t)}}function LG(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var $G=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function _u(e){if(!(t=$G.exec(e)))throw new Error("invalid format: "+e);var t;return new Oj({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}_u.prototype=Oj.prototype;function Oj(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Oj.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function BG(e){e:for(var t=e.length,r=1,n=-1,a;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(a+1):e}var Np;function FG(e,t){var r=jp(e,t);if(!r)return Np=void 0,e.toPrecision(t);var n=r[0],a=r[1],i=a-(Np=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,s=n.length;return i===s?n:i>s?n+new Array(i-s+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+jp(e,Math.max(0,t+i-1))[0]}function DA(e,t){var r=jp(e,t);if(!r)return e+"";var n=r[0],a=r[1];return a<0?"0."+new Array(-a).join("0")+n:n.length>a+1?n.slice(0,a+1)+"."+n.slice(a+1):n+new Array(a-n.length+2).join("0")}const LA={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:MG,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>DA(e*100,t),r:DA,s:FG,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function $A(e){return e}var BA=Array.prototype.map,FA=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function zG(e){var t=e.grouping===void 0||e.thousands===void 0?$A:DG(BA.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?$A:LG(BA.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"−":e.minus+"",d=e.nan===void 0?"NaN":e.nan+"";function c(p,m){p=_u(p);var v=p.fill,x=p.align,y=p.sign,w=p.symbol,j=p.zero,_=p.width,C=p.comma,A=p.precision,E=p.trim,O=p.type;O==="n"?(C=!0,O="g"):LA[O]||(A===void 0&&(A=12),E=!0,O="g"),(j||v==="0"&&x==="=")&&(j=!0,v="0",x="=");var T=(m&&m.prefix!==void 0?m.prefix:"")+(w==="$"?r:w==="#"&&/[boxX]/.test(O)?"0"+O.toLowerCase():""),k=(w==="$"?n:/[%p]/.test(O)?s:"")+(m&&m.suffix!==void 0?m.suffix:""),M=LA[O],$=/[defgprs%]/.test(O);A=A===void 0?6:/[gprs]/.test(O)?Math.max(1,Math.min(21,A)):Math.max(0,Math.min(20,A));function z(F){var V=T,G=k,U,H,W;if(O==="c")G=M(F)+G,F="";else{F=+F;var B=F<0||1/F<0;if(F=isNaN(F)?d:M(Math.abs(F),A),E&&(F=BG(F)),B&&+F==0&&y!=="+"&&(B=!1),V=(B?y==="("?y:u:y==="-"||y==="("?"":y)+V,G=(O==="s"&&!isNaN(F)&&Np!==void 0?FA[8+Np/3]:"")+G+(B&&y==="("?")":""),$){for(U=-1,H=F.length;++UW||W>57){G=(W===46?a+F.slice(U+1):F.slice(U))+G,F=F.slice(0,U);break}}}C&&!j&&(F=t(F,1/0));var Q=V.length+F.length+G.length,R=Q<_?new Array(_-Q+1).join(v):"";switch(C&&j&&(F=t(R+F,R.length?_-G.length:1/0),R=""),x){case"<":F=V+F+G+R;break;case"=":F=V+R+F+G;break;case"^":F=R.slice(0,Q=R.length>>1)+V+F+G+R.slice(Q);break;default:F=R+V+F+G;break}return i(F)}return z.toString=function(){return p+""},z}function h(p,m){var v=Math.max(-8,Math.min(8,Math.floor(pl(m)/3)))*3,x=Math.pow(10,-v),y=c((p=_u(p),p.type="f",p),{suffix:FA[8+v/3]});return function(w){return y(x*w)}}return{format:c,formatPrefix:h}}var Jf,Pj,wL;qG({thousands:",",grouping:[3],currency:["$",""]});function qG(e){return Jf=zG(e),Pj=Jf.format,wL=Jf.formatPrefix,Jf}function UG(e){return Math.max(0,-pl(Math.abs(e)))}function VG(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(pl(t)/3)))*3-pl(Math.abs(e)))}function HG(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,pl(t)-pl(e))+1}function SL(e,t,r,n){var a=Cw(e,t,r),i;switch(n=_u(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=VG(a,s))&&(n.precision=i),wL(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=HG(a,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=UG(a))&&(n.precision=i-(n.type==="%")*2);break}}return Pj(n)}function so(e){var t=e.domain;return e.ticks=function(r){var n=t();return Nw(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var a=t();return SL(a[0],a[a.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),a=0,i=n.length-1,s=n[a],u=n[i],d,c,h=10;for(u0;){if(c=_w(s,u,r),c===d)return n[a]=s,n[i]=u,t(n);if(c>0)s=Math.floor(s/c)*c,u=Math.ceil(u/c)*c;else if(c<0)s=Math.ceil(s*c)/c,u=Math.floor(u*c)/c;else break;d=c}return e},e}function _p(){var e=Ej();return e.copy=function(){return od(e,_p())},Xn.apply(e,arguments),so(e)}function jL(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,Sp),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return jL(e).unknown(t)},e=arguments.length?Array.from(e,Sp):[0,1],so(r)}function NL(e,t){e=e.slice();var r=0,n=e.length-1,a=e[r],i=e[n],s;return iMath.pow(e,t)}function YG(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function UA(e){return(t,r)=>-e(-t,r)}function Aj(e){const t=e(zA,qA),r=t.domain;let n=10,a,i;function s(){return a=YG(n),i=XG(n),r()[0]<0?(a=UA(a),i=UA(i),e(WG,GG)):e(zA,qA),t}return t.base=function(u){return arguments.length?(n=+u,s()):n},t.domain=function(u){return arguments.length?(r(u),s()):r()},t.ticks=u=>{const d=r();let c=d[0],h=d[d.length-1];const p=h0){for(;m<=v;++m)for(x=1;xh)break;j.push(y)}}else for(;m<=v;++m)for(x=n-1;x>=1;--x)if(y=m>0?x/i(-m):x*i(m),!(yh)break;j.push(y)}j.length*2{if(u==null&&(u=10),d==null&&(d=n===10?"s":","),typeof d!="function"&&(!(n%1)&&(d=_u(d)).precision==null&&(d.trim=!0),d=Pj(d)),u===1/0)return d;const c=Math.max(1,n*u/t.ticks().length);return h=>{let p=h/i(Math.round(a(h)));return p*nr(NL(r(),{floor:u=>i(Math.floor(a(u))),ceil:u=>i(Math.ceil(a(u)))})),t}function _L(){const e=Aj(Rm()).domain([1,10]);return e.copy=()=>od(e,_L()).base(e.base()),Xn.apply(e,arguments),e}function VA(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function HA(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Tj(e){var t=1,r=e(VA(t),HA(t));return r.constant=function(n){return arguments.length?e(VA(t=+n),HA(t)):t},so(r)}function CL(){var e=Tj(Rm());return e.copy=function(){return od(e,CL()).constant(e.constant())},Xn.apply(e,arguments)}function WA(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function JG(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function QG(e){return e<0?-e*e:e*e}function kj(e){var t=e(Ur,Ur),r=1;function n(){return r===1?e(Ur,Ur):r===.5?e(JG,QG):e(WA(r),WA(1/r))}return t.exponent=function(a){return arguments.length?(r=+a,n()):r},so(t)}function Rj(){var e=kj(Rm());return e.copy=function(){return od(e,Rj()).exponent(e.exponent())},Xn.apply(e,arguments),e}function ZG(){return Rj.apply(null,arguments).exponent(.5)}function GA(e){return Math.sign(e)*e*e}function eK(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function EL(){var e=Ej(),t=[0,1],r=!1,n;function a(i){var s=eK(e(i));return isNaN(s)?n:r?Math.round(s):s}return a.invert=function(i){return e.invert(GA(i))},a.domain=function(i){return arguments.length?(e.domain(i),a):e.domain()},a.range=function(i){return arguments.length?(e.range((t=Array.from(i,Sp)).map(GA)),a):t.slice()},a.rangeRound=function(i){return a.range(i).round(!0)},a.round=function(i){return arguments.length?(r=!!i,a):r},a.clamp=function(i){return arguments.length?(e.clamp(i),a):e.clamp()},a.unknown=function(i){return arguments.length?(n=i,a):n},a.copy=function(){return EL(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Xn.apply(a,arguments),so(a)}function OL(){var e=[],t=[],r=[],n;function a(){var s=0,u=Math.max(1,t.length);for(r=new Array(u-1);++s0?r[u-1]:e[0],u=r?[n[r-1],t]:[n[c-1],n[c]]},s.unknown=function(d){return arguments.length&&(i=d),s},s.thresholds=function(){return n.slice()},s.copy=function(){return PL().domain([e,t]).range(a).unknown(i)},Xn.apply(so(s),arguments)}function AL(){var e=[.5],t=[0,1],r,n=1;function a(i){return i!=null&&i<=i?t[ad(e,i,0,n)]:r}return a.domain=function(i){return arguments.length?(e=Array.from(i),n=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(i){return arguments.length?(t=Array.from(i),n=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(i){var s=t.indexOf(i);return[e[s-1],e[s]]},a.unknown=function(i){return arguments.length?(r=i,a):r},a.copy=function(){return AL().domain(e).range(t).unknown(r)},Xn.apply(a,arguments)}const $b=new Date,Bb=new Date;function fr(e,t,r,n){function a(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return a.floor=i=>(e(i=new Date(+i)),i),a.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),a.round=i=>{const s=a(i),u=a.ceil(i);return i-s(t(i=new Date(+i),s==null?1:Math.floor(s)),i),a.range=(i,s,u)=>{const d=[];if(i=a.ceil(i),u=u==null?1:Math.floor(u),!(i0))return d;let c;do d.push(c=new Date(+i)),t(i,u),e(i);while(cfr(s=>{if(s>=s)for(;e(s),!i(s);)s.setTime(s-1)},(s,u)=>{if(s>=s)if(u<0)for(;++u<=0;)for(;t(s,-1),!i(s););else for(;--u>=0;)for(;t(s,1),!i(s););}),r&&(a.count=(i,s)=>($b.setTime(+i),Bb.setTime(+s),e($b),e(Bb),Math.floor(r($b,Bb))),a.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?a.filter(n?s=>n(s)%i===0:s=>a.count(0,s)%i===0):a)),a}const Cp=fr(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Cp.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?fr(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):Cp);Cp.range;const ii=1e3,Vn=ii*60,oi=Vn*60,fi=oi*24,Ij=fi*7,KA=fi*30,Fb=fi*365,$o=fr(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*ii)},(e,t)=>(t-e)/ii,e=>e.getUTCSeconds());$o.range;const Mj=fr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ii)},(e,t)=>{e.setTime(+e+t*Vn)},(e,t)=>(t-e)/Vn,e=>e.getMinutes());Mj.range;const Dj=fr(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Vn)},(e,t)=>(t-e)/Vn,e=>e.getUTCMinutes());Dj.range;const Lj=fr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ii-e.getMinutes()*Vn)},(e,t)=>{e.setTime(+e+t*oi)},(e,t)=>(t-e)/oi,e=>e.getHours());Lj.range;const $j=fr(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*oi)},(e,t)=>(t-e)/oi,e=>e.getUTCHours());$j.range;const sd=fr(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Vn)/fi,e=>e.getDate()-1);sd.range;const Im=fr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/fi,e=>e.getUTCDate()-1);Im.range;const TL=fr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/fi,e=>Math.floor(e/fi));TL.range;function is(e){return fr(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*Vn)/Ij)}const Mm=is(0),Ep=is(1),tK=is(2),rK=is(3),ml=is(4),nK=is(5),aK=is(6);Mm.range;Ep.range;tK.range;rK.range;ml.range;nK.range;aK.range;function os(e){return fr(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/Ij)}const Dm=os(0),Op=os(1),iK=os(2),oK=os(3),gl=os(4),sK=os(5),lK=os(6);Dm.range;Op.range;iK.range;oK.range;gl.range;sK.range;lK.range;const Bj=fr(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Bj.range;const Fj=fr(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Fj.range;const hi=fr(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());hi.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:fr(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});hi.range;const pi=fr(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());pi.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:fr(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});pi.range;function kL(e,t,r,n,a,i){const s=[[$o,1,ii],[$o,5,5*ii],[$o,15,15*ii],[$o,30,30*ii],[i,1,Vn],[i,5,5*Vn],[i,15,15*Vn],[i,30,30*Vn],[a,1,oi],[a,3,3*oi],[a,6,6*oi],[a,12,12*oi],[n,1,fi],[n,2,2*fi],[r,1,Ij],[t,1,KA],[t,3,3*KA],[e,1,Fb]];function u(c,h,p){const m=hw).right(s,m);if(v===s.length)return e.every(Cw(c/Fb,h/Fb,p));if(v===0)return Cp.every(Math.max(Cw(c,h,p),1));const[x,y]=s[m/s[v-1][2]53)return null;"w"in Y||(Y.w=1),"Z"in Y?(Ce=qb(zc(Y.y,0,1)),Be=Ce.getUTCDay(),Ce=Be>4||Be===0?Op.ceil(Ce):Op(Ce),Ce=Im.offset(Ce,(Y.V-1)*7),Y.y=Ce.getUTCFullYear(),Y.m=Ce.getUTCMonth(),Y.d=Ce.getUTCDate()+(Y.w+6)%7):(Ce=zb(zc(Y.y,0,1)),Be=Ce.getDay(),Ce=Be>4||Be===0?Ep.ceil(Ce):Ep(Ce),Ce=sd.offset(Ce,(Y.V-1)*7),Y.y=Ce.getFullYear(),Y.m=Ce.getMonth(),Y.d=Ce.getDate()+(Y.w+6)%7)}else("W"in Y||"U"in Y)&&("w"in Y||(Y.w="u"in Y?Y.u%7:"W"in Y?1:0),Be="Z"in Y?qb(zc(Y.y,0,1)).getUTCDay():zb(zc(Y.y,0,1)).getDay(),Y.m=0,Y.d="W"in Y?(Y.w+6)%7+Y.W*7-(Be+5)%7:Y.w+Y.U*7-(Be+6)%7);return"Z"in Y?(Y.H+=Y.Z/100|0,Y.M+=Y.Z%100,qb(Y)):zb(Y)}}function k(ne,de,ge,Y){for(var we=0,Ce=de.length,Be=ge.length,et,tt;we=Be)return-1;if(et=de.charCodeAt(we++),et===37){if(et=de.charAt(we++),tt=E[et in XA?de.charAt(we++):et],!tt||(Y=tt(ne,ge,Y))<0)return-1}else if(et!=ge.charCodeAt(Y++))return-1}return Y}function M(ne,de,ge){var Y=c.exec(de.slice(ge));return Y?(ne.p=h.get(Y[0].toLowerCase()),ge+Y[0].length):-1}function $(ne,de,ge){var Y=v.exec(de.slice(ge));return Y?(ne.w=x.get(Y[0].toLowerCase()),ge+Y[0].length):-1}function z(ne,de,ge){var Y=p.exec(de.slice(ge));return Y?(ne.w=m.get(Y[0].toLowerCase()),ge+Y[0].length):-1}function F(ne,de,ge){var Y=j.exec(de.slice(ge));return Y?(ne.m=_.get(Y[0].toLowerCase()),ge+Y[0].length):-1}function V(ne,de,ge){var Y=y.exec(de.slice(ge));return Y?(ne.m=w.get(Y[0].toLowerCase()),ge+Y[0].length):-1}function G(ne,de,ge){return k(ne,t,de,ge)}function U(ne,de,ge){return k(ne,r,de,ge)}function H(ne,de,ge){return k(ne,n,de,ge)}function W(ne){return s[ne.getDay()]}function B(ne){return i[ne.getDay()]}function Q(ne){return d[ne.getMonth()]}function R(ne){return u[ne.getMonth()]}function L(ne){return a[+(ne.getHours()>=12)]}function I(ne){return 1+~~(ne.getMonth()/3)}function X(ne){return s[ne.getUTCDay()]}function ee(ne){return i[ne.getUTCDay()]}function ie(ne){return d[ne.getUTCMonth()]}function re(ne){return u[ne.getUTCMonth()]}function K(ne){return a[+(ne.getUTCHours()>=12)]}function Z(ne){return 1+~~(ne.getUTCMonth()/3)}return{format:function(ne){var de=O(ne+="",C);return de.toString=function(){return ne},de},parse:function(ne){var de=T(ne+="",!1);return de.toString=function(){return ne},de},utcFormat:function(ne){var de=O(ne+="",A);return de.toString=function(){return ne},de},utcParse:function(ne){var de=T(ne+="",!0);return de.toString=function(){return ne},de}}}var XA={"-":"",_:" ",0:"0"},xr=/^\s*\d+/,pK=/^%/,mK=/[\\^$*+?|[\]().{}]/g;function ft(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i[t.toLowerCase(),r]))}function vK(e,t,r){var n=xr.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function yK(e,t,r){var n=xr.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function xK(e,t,r){var n=xr.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function bK(e,t,r){var n=xr.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function wK(e,t,r){var n=xr.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function YA(e,t,r){var n=xr.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function JA(e,t,r){var n=xr.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function SK(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function jK(e,t,r){var n=xr.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function NK(e,t,r){var n=xr.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function QA(e,t,r){var n=xr.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function _K(e,t,r){var n=xr.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function ZA(e,t,r){var n=xr.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function CK(e,t,r){var n=xr.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function EK(e,t,r){var n=xr.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function OK(e,t,r){var n=xr.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function PK(e,t,r){var n=xr.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function AK(e,t,r){var n=pK.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function TK(e,t,r){var n=xr.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function kK(e,t,r){var n=xr.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function eT(e,t){return ft(e.getDate(),t,2)}function RK(e,t){return ft(e.getHours(),t,2)}function IK(e,t){return ft(e.getHours()%12||12,t,2)}function MK(e,t){return ft(1+sd.count(hi(e),e),t,3)}function RL(e,t){return ft(e.getMilliseconds(),t,3)}function DK(e,t){return RL(e,t)+"000"}function LK(e,t){return ft(e.getMonth()+1,t,2)}function $K(e,t){return ft(e.getMinutes(),t,2)}function BK(e,t){return ft(e.getSeconds(),t,2)}function FK(e){var t=e.getDay();return t===0?7:t}function zK(e,t){return ft(Mm.count(hi(e)-1,e),t,2)}function IL(e){var t=e.getDay();return t>=4||t===0?ml(e):ml.ceil(e)}function qK(e,t){return e=IL(e),ft(ml.count(hi(e),e)+(hi(e).getDay()===4),t,2)}function UK(e){return e.getDay()}function VK(e,t){return ft(Ep.count(hi(e)-1,e),t,2)}function HK(e,t){return ft(e.getFullYear()%100,t,2)}function WK(e,t){return e=IL(e),ft(e.getFullYear()%100,t,2)}function GK(e,t){return ft(e.getFullYear()%1e4,t,4)}function KK(e,t){var r=e.getDay();return e=r>=4||r===0?ml(e):ml.ceil(e),ft(e.getFullYear()%1e4,t,4)}function XK(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ft(t/60|0,"0",2)+ft(t%60,"0",2)}function tT(e,t){return ft(e.getUTCDate(),t,2)}function YK(e,t){return ft(e.getUTCHours(),t,2)}function JK(e,t){return ft(e.getUTCHours()%12||12,t,2)}function QK(e,t){return ft(1+Im.count(pi(e),e),t,3)}function ML(e,t){return ft(e.getUTCMilliseconds(),t,3)}function ZK(e,t){return ML(e,t)+"000"}function eX(e,t){return ft(e.getUTCMonth()+1,t,2)}function tX(e,t){return ft(e.getUTCMinutes(),t,2)}function rX(e,t){return ft(e.getUTCSeconds(),t,2)}function nX(e){var t=e.getUTCDay();return t===0?7:t}function aX(e,t){return ft(Dm.count(pi(e)-1,e),t,2)}function DL(e){var t=e.getUTCDay();return t>=4||t===0?gl(e):gl.ceil(e)}function iX(e,t){return e=DL(e),ft(gl.count(pi(e),e)+(pi(e).getUTCDay()===4),t,2)}function oX(e){return e.getUTCDay()}function sX(e,t){return ft(Op.count(pi(e)-1,e),t,2)}function lX(e,t){return ft(e.getUTCFullYear()%100,t,2)}function cX(e,t){return e=DL(e),ft(e.getUTCFullYear()%100,t,2)}function uX(e,t){return ft(e.getUTCFullYear()%1e4,t,4)}function dX(e,t){var r=e.getUTCDay();return e=r>=4||r===0?gl(e):gl.ceil(e),ft(e.getUTCFullYear()%1e4,t,4)}function fX(){return"+0000"}function rT(){return"%"}function nT(e){return+e}function aT(e){return Math.floor(+e/1e3)}var Rs,LL,$L;hX({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function hX(e){return Rs=hK(e),LL=Rs.format,Rs.parse,$L=Rs.utcFormat,Rs.utcParse,Rs}function pX(e){return new Date(e)}function mX(e){return e instanceof Date?+e:+new Date(+e)}function zj(e,t,r,n,a,i,s,u,d,c){var h=Ej(),p=h.invert,m=h.domain,v=c(".%L"),x=c(":%S"),y=c("%I:%M"),w=c("%I %p"),j=c("%a %d"),_=c("%b %d"),C=c("%B"),A=c("%Y");function E(O){return(d(O)t(a/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(a,i)=>aG(e,i/n))},r.copy=function(){return qL(t).domain(e)},Ni.apply(r,arguments)}function $m(){var e=0,t=.5,r=1,n=1,a,i,s,u,d,c=Ur,h,p=!1,m;function v(y){return isNaN(y=+y)?m:(y=.5+((y=+h(y))-i)*(n*yr}return Vb=e,Vb}var Hb,lT;function bX(){if(lT)return Hb;lT=1;var e=Bm(),t=WL(),r=Hl();function n(a){return a&&a.length?e(a,r,t):void 0}return Hb=n,Hb}var wX=bX();const Fm=ht(wX);var Wb,cT;function GL(){if(cT)return Wb;cT=1;function e(t,r){return te.e^i.s<0?1:-1;for(n=i.d.length,a=e.d.length,t=0,r=ne.d[t]^i.s<0?1:-1;return n===a?0:n>a^i.s<0?1:-1};Ae.decimalPlaces=Ae.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*Dt;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};Ae.dividedBy=Ae.div=function(e){return ci(this,new this.constructor(e))};Ae.dividedToIntegerBy=Ae.idiv=function(e){var t=this,r=t.constructor;return Et(ci(t,new r(e),0,1),r.precision)};Ae.equals=Ae.eq=function(e){return!this.cmp(e)};Ae.exponent=function(){return tr(this)};Ae.greaterThan=Ae.gt=function(e){return this.cmp(e)>0};Ae.greaterThanOrEqualTo=Ae.gte=function(e){return this.cmp(e)>=0};Ae.isInteger=Ae.isint=function(){return this.e>this.d.length-2};Ae.isNegative=Ae.isneg=function(){return this.s<0};Ae.isPositive=Ae.ispos=function(){return this.s>0};Ae.isZero=function(){return this.s===0};Ae.lessThan=Ae.lt=function(e){return this.cmp(e)<0};Ae.lessThanOrEqualTo=Ae.lte=function(e){return this.cmp(e)<1};Ae.logarithm=Ae.log=function(e){var t,r=this,n=r.constructor,a=n.precision,i=a+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(bn))throw Error(Gn+"NaN");if(r.s<1)throw Error(Gn+(r.s?"NaN":"-Infinity"));return r.eq(bn)?new n(0):(Bt=!1,t=ci(Cu(r,i),Cu(e,i),i),Bt=!0,Et(t,a))};Ae.minus=Ae.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?JL(t,e):XL(t,(e.s=-e.s,e))};Ae.modulo=Ae.mod=function(e){var t,r=this,n=r.constructor,a=n.precision;if(e=new n(e),!e.s)throw Error(Gn+"NaN");return r.s?(Bt=!1,t=ci(r,e,0,1).times(e),Bt=!0,r.minus(t)):Et(new n(r),a)};Ae.naturalExponential=Ae.exp=function(){return YL(this)};Ae.naturalLogarithm=Ae.ln=function(){return Cu(this)};Ae.negated=Ae.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Ae.plus=Ae.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?XL(t,e):JL(t,(e.s=-e.s,e))};Ae.precision=Ae.sd=function(e){var t,r,n,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(zo+e);if(t=tr(a)+1,n=a.d.length-1,r=n*Dt+1,n=a.d[n],n){for(;n%10==0;n/=10)r--;for(n=a.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};Ae.squareRoot=Ae.sqrt=function(){var e,t,r,n,a,i,s,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(Gn+"NaN")}for(e=tr(u),Bt=!1,a=Math.sqrt(+u),a==0||a==1/0?(t=ka(u.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=Kl((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new d(t)):n=new d(a.toString()),r=d.precision,a=s=r+3;;)if(i=n,n=i.plus(ci(u,i,s+2)).times(.5),ka(i.d).slice(0,s)===(t=ka(n.d)).slice(0,s)){if(t=t.slice(s-3,s+1),a==s&&t=="4999"){if(Et(i,r+1,0),i.times(i).eq(u)){n=i;break}}else if(t!="9999")break;s+=4}return Bt=!0,Et(n,r)};Ae.times=Ae.mul=function(e){var t,r,n,a,i,s,u,d,c,h=this,p=h.constructor,m=h.d,v=(e=new p(e)).d;if(!h.s||!e.s)return new p(0);for(e.s*=h.s,r=h.e+e.e,d=m.length,c=v.length,d=0;){for(t=0,a=d+n;a>n;)u=i[a]+v[n]*m[a-n-1]+t,i[a--]=u%vr|0,t=u/vr|0;i[a]=(i[a]+t)%vr|0}for(;!i[--s];)i.pop();return t?++r:i.shift(),e.d=i,e.e=r,Bt?Et(e,p.precision):e};Ae.toDecimalPlaces=Ae.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(La(e,0,Gl),t===void 0?t=n.rounding:La(t,0,8),Et(r,e+tr(r)+1,t))};Ae.toExponential=function(e,t){var r,n=this,a=n.constructor;return e===void 0?r=Ho(n,!0):(La(e,0,Gl),t===void 0?t=a.rounding:La(t,0,8),n=Et(new a(n),e+1,t),r=Ho(n,!0,e+1)),r};Ae.toFixed=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?Ho(a):(La(e,0,Gl),t===void 0?t=i.rounding:La(t,0,8),n=Et(new i(a),e+tr(a)+1,t),r=Ho(n.abs(),!1,e+tr(n)+1),a.isneg()&&!a.isZero()?"-"+r:r)};Ae.toInteger=Ae.toint=function(){var e=this,t=e.constructor;return Et(new t(e),tr(e)+1,t.rounding)};Ae.toNumber=function(){return+this};Ae.toPower=Ae.pow=function(e){var t,r,n,a,i,s,u=this,d=u.constructor,c=12,h=+(e=new d(e));if(!e.s)return new d(bn);if(u=new d(u),!u.s){if(e.s<1)throw Error(Gn+"Infinity");return u}if(u.eq(bn))return u;if(n=d.precision,e.eq(bn))return Et(u,n);if(t=e.e,r=e.d.length-1,s=t>=r,i=u.s,s){if((r=h<0?-h:h)<=KL){for(a=new d(bn),t=Math.ceil(n/Dt+4),Bt=!1;r%2&&(a=a.times(u),mT(a.d,t)),r=Kl(r/2),r!==0;)u=u.times(u),mT(u.d,t);return Bt=!0,e.s<0?new d(bn).div(a):Et(a,n)}}else if(i<0)throw Error(Gn+"NaN");return i=i<0&&e.d[Math.max(t,r)]&1?-1:1,u.s=1,Bt=!1,a=e.times(Cu(u,n+c)),Bt=!0,a=YL(a),a.s=i,a};Ae.toPrecision=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?(r=tr(a),n=Ho(a,r<=i.toExpNeg||r>=i.toExpPos)):(La(e,1,Gl),t===void 0?t=i.rounding:La(t,0,8),a=Et(new i(a),e,t),r=tr(a),n=Ho(a,e<=r||r<=i.toExpNeg,e)),n};Ae.toSignificantDigits=Ae.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(La(e,1,Gl),t===void 0?t=n.rounding:La(t,0,8)),Et(new n(r),e,t)};Ae.toString=Ae.valueOf=Ae.val=Ae.toJSON=Ae[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=tr(e),r=e.constructor;return Ho(e,t<=r.toExpNeg||t>=r.toExpPos)};function XL(e,t){var r,n,a,i,s,u,d,c,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s||(t=new h(e)),Bt?Et(t,p):t;if(d=e.d,c=t.d,s=e.e,a=t.e,d=d.slice(),i=s-a,i){for(i<0?(n=d,i=-i,u=c.length):(n=c,a=s,u=d.length),s=Math.ceil(p/Dt),u=s>u?s+1:u+1,i>u&&(i=u,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(u=d.length,i=c.length,u-i<0&&(i=u,n=c,c=d,d=n),r=0;i;)r=(d[--i]=d[i]+c[i]+r)/vr|0,d[i]%=vr;for(r&&(d.unshift(r),++a),u=d.length;d[--u]==0;)d.pop();return t.d=d,t.e=a,Bt?Et(t,p):t}function La(e,t,r){if(e!==~~e||er)throw Error(zo+e)}function ka(e){var t,r,n,a=e.length-1,i="",s=e[0];if(a>0){for(i+=s,t=1;ts?1:-1;else for(u=d=0;ua[u]?1:-1;break}return d}function r(n,a,i){for(var s=0;i--;)n[i]-=s,s=n[i]1;)n.shift()}return function(n,a,i,s){var u,d,c,h,p,m,v,x,y,w,j,_,C,A,E,O,T,k,M=n.constructor,$=n.s==a.s?1:-1,z=n.d,F=a.d;if(!n.s)return new M(n);if(!a.s)throw Error(Gn+"Division by zero");for(d=n.e-a.e,T=F.length,E=z.length,v=new M($),x=v.d=[],c=0;F[c]==(z[c]||0);)++c;if(F[c]>(z[c]||0)&&--d,i==null?_=i=M.precision:s?_=i+(tr(n)-tr(a))+1:_=i,_<0)return new M(0);if(_=_/Dt+2|0,c=0,T==1)for(h=0,F=F[0],_++;(c1&&(F=e(F,h),z=e(z,h),T=F.length,E=z.length),A=T,y=z.slice(0,T),w=y.length;w=vr/2&&++O;do h=0,u=t(F,y,T,w),u<0?(j=y[0],T!=w&&(j=j*vr+(y[1]||0)),h=j/O|0,h>1?(h>=vr&&(h=vr-1),p=e(F,h),m=p.length,w=y.length,u=t(p,y,m,w),u==1&&(h--,r(p,T16)throw Error(Vj+tr(e));if(!e.s)return new h(bn);for(Bt=!1,u=p,s=new h(.03125);e.abs().gte(.1);)e=e.times(s),c+=5;for(n=Math.log(Io(2,c))/Math.LN10*2+5|0,u+=n,r=a=i=new h(bn),h.precision=u;;){if(a=Et(a.times(e),u),r=r.times(++d),s=i.plus(ci(a,r,u)),ka(s.d).slice(0,u)===ka(i.d).slice(0,u)){for(;c--;)i=Et(i.times(i),u);return h.precision=p,t==null?(Bt=!0,Et(i,p)):i}i=s}}function tr(e){for(var t=e.e*Dt,r=e.d[0];r>=10;r/=10)t++;return t}function Jb(e,t,r){if(t>e.LN10.sd())throw Bt=!0,r&&(e.precision=r),Error(Gn+"LN10 precision limit exceeded");return Et(new e(e.LN10),t)}function Ji(e){for(var t="";e--;)t+="0";return t}function Cu(e,t){var r,n,a,i,s,u,d,c,h,p=1,m=10,v=e,x=v.d,y=v.constructor,w=y.precision;if(v.s<1)throw Error(Gn+(v.s?"NaN":"-Infinity"));if(v.eq(bn))return new y(0);if(t==null?(Bt=!1,c=w):c=t,v.eq(10))return t==null&&(Bt=!0),Jb(y,c);if(c+=m,y.precision=c,r=ka(x),n=r.charAt(0),i=tr(v),Math.abs(i)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)v=v.times(e),r=ka(v.d),n=r.charAt(0),p++;i=tr(v),n>1?(v=new y("0."+r),i++):v=new y(n+"."+r.slice(1))}else return d=Jb(y,c+2,w).times(i+""),v=Cu(new y(n+"."+r.slice(1)),c-m).plus(d),y.precision=w,t==null?(Bt=!0,Et(v,w)):v;for(u=s=v=ci(v.minus(bn),v.plus(bn),c),h=Et(v.times(v),c),a=3;;){if(s=Et(s.times(h),c),d=u.plus(ci(s,new y(a),c)),ka(d.d).slice(0,c)===ka(u.d).slice(0,c))return u=u.times(2),i!==0&&(u=u.plus(Jb(y,c+2,w).times(i+""))),u=ci(u,new y(p),c),y.precision=w,t==null?(Bt=!0,Et(u,w)):u;u=d,a+=2}}function pT(e,t){var r,n,a;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(n,a),t){if(a-=n,r=r-n-1,e.e=Kl(r/Dt),e.d=[],n=(r+1)%Dt,r<0&&(n+=Dt),nPp||e.e<-Pp))throw Error(Vj+r)}else e.s=0,e.e=0,e.d=[0];return e}function Et(e,t,r){var n,a,i,s,u,d,c,h,p=e.d;for(s=1,i=p[0];i>=10;i/=10)s++;if(n=t-s,n<0)n+=Dt,a=t,c=p[h=0];else{if(h=Math.ceil((n+1)/Dt),i=p.length,h>=i)return e;for(c=i=p[h],s=1;i>=10;i/=10)s++;n%=Dt,a=n-Dt+s}if(r!==void 0&&(i=Io(10,s-a-1),u=c/i%10|0,d=t<0||p[h+1]!==void 0||c%i,d=r<4?(u||d)&&(r==0||r==(e.s<0?3:2)):u>5||u==5&&(r==4||d||r==6&&(n>0?a>0?c/Io(10,s-a):0:p[h-1])%10&1||r==(e.s<0?8:7))),t<1||!p[0])return d?(i=tr(e),p.length=1,t=t-i-1,p[0]=Io(10,(Dt-t%Dt)%Dt),e.e=Kl(-t/Dt)||0):(p.length=1,p[0]=e.e=e.s=0),e;if(n==0?(p.length=h,i=1,h--):(p.length=h+1,i=Io(10,Dt-n),p[h]=a>0?(c/Io(10,s-a)%Io(10,a)|0)*i:0),d)for(;;)if(h==0){(p[0]+=i)==vr&&(p[0]=1,++e.e);break}else{if(p[h]+=i,p[h]!=vr)break;p[h--]=0,i=1}for(n=p.length;p[--n]===0;)p.pop();if(Bt&&(e.e>Pp||e.e<-Pp))throw Error(Vj+tr(e));return e}function JL(e,t){var r,n,a,i,s,u,d,c,h,p,m=e.constructor,v=m.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new m(e),Bt?Et(t,v):t;if(d=e.d,p=t.d,n=t.e,c=e.e,d=d.slice(),s=c-n,s){for(h=s<0,h?(r=d,s=-s,u=p.length):(r=p,n=c,u=d.length),a=Math.max(Math.ceil(v/Dt),u)+2,s>a&&(s=a,r.length=1),r.reverse(),a=s;a--;)r.push(0);r.reverse()}else{for(a=d.length,u=p.length,h=a0;--a)d[u++]=0;for(a=p.length;a>s;){if(d[--a]0?i=i.charAt(0)+"."+i.slice(1)+Ji(n):s>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+Ji(-a-1)+i,r&&(n=r-s)>0&&(i+=Ji(n))):a>=s?(i+=Ji(a+1-s),r&&(n=r-a-1)>0&&(i=i+"."+Ji(n))):((n=a+1)0&&(a+1===s&&(i+="."),i+=Ji(n))),e.s<0?"-"+i:i}function mT(e,t){if(e.length>t)return e.length=t,!0}function QL(e){var t,r,n;function a(i){var s=this;if(!(s instanceof a))return new a(i);if(s.constructor=a,i instanceof a){s.s=i.s,s.e=i.e,s.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(zo+i);if(i>0)s.s=1;else if(i<0)i=-i,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(i===~~i&&i<1e7){s.e=0,s.d=[i];return}return pT(s,i.toString())}else if(typeof i!="string")throw Error(zo+i);if(i.charCodeAt(0)===45?(i=i.slice(1),s.s=-1):s.s=1,TX.test(i))pT(s,i);else throw Error(zo+i)}if(a.prototype=Ae,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=QL,a.config=a.set=kX,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(zo+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(zo+r+": "+n);return this}var Hj=QL(AX);bn=new Hj(1);const Nt=Hj;function RX(e){return LX(e)||DX(e)||MX(e)||IX()}function IX(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function MX(e,t){if(e){if(typeof e=="string")return Tw(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Tw(e,t)}}function DX(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function LX(e){if(Array.isArray(e))return Tw(e)}function Tw(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t?r.apply(void 0,a):e(t-s,gT(function(){for(var u=arguments.length,d=new Array(u),c=0;ce.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,a=!1,i=void 0;try{for(var s=e[Symbol.iterator](),u;!(n=(u=s.next()).done)&&(r.push(u.value),!(t&&r.length===t));n=!0);}catch(d){a=!0,i=d}finally{try{!n&&s.return!=null&&s.return()}finally{if(a)throw i}}return r}}function QX(e){if(Array.isArray(e))return e}function n$(e){var t=Eu(e,2),r=t[0],n=t[1],a=r,i=n;return r>n&&(a=n,i=r),[a,i]}function a$(e,t,r){if(e.lte(0))return new Nt(0);var n=Um.getDigitCount(e.toNumber()),a=new Nt(10).pow(n),i=e.div(a),s=n!==1?.05:.1,u=new Nt(Math.ceil(i.div(s).toNumber())).add(r).mul(s),d=u.mul(a);return t?d:new Nt(Math.ceil(d))}function ZX(e,t,r){var n=1,a=new Nt(e);if(!a.isint()&&r){var i=Math.abs(e);i<1?(n=new Nt(10).pow(Um.getDigitCount(e)-1),a=new Nt(Math.floor(a.div(n).toNumber())).mul(n)):i>1&&(a=new Nt(Math.floor(e)))}else e===0?a=new Nt(Math.floor((t-1)/2)):r||(a=new Nt(Math.floor(e)));var s=Math.floor((t-1)/2),u=zX(FX(function(d){return a.add(new Nt(d-s).mul(n)).toNumber()}),kw);return u(0,t)}function i$(e,t,r,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new Nt(0),tickMin:new Nt(0),tickMax:new Nt(0)};var i=a$(new Nt(t).sub(e).div(r-1),n,a),s;e<=0&&t>=0?s=new Nt(0):(s=new Nt(e).add(t).div(2),s=s.sub(new Nt(s).mod(i)));var u=Math.ceil(s.sub(e).div(i).toNumber()),d=Math.ceil(new Nt(t).sub(s).div(i).toNumber()),c=u+d+1;return c>r?i$(e,t,r,n,a+1):(c0?d+(r-c):d,u=t>0?u:u+(r-c)),{step:i,tickMin:s.sub(new Nt(u).mul(i)),tickMax:s.add(new Nt(d).mul(i))})}function eY(e){var t=Eu(e,2),r=t[0],n=t[1],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(a,2),u=n$([r,n]),d=Eu(u,2),c=d[0],h=d[1];if(c===-1/0||h===1/0){var p=h===1/0?[c].concat(Iw(kw(0,a-1).map(function(){return 1/0}))):[].concat(Iw(kw(0,a-1).map(function(){return-1/0})),[h]);return r>n?Rw(p):p}if(c===h)return ZX(c,a,i);var m=i$(c,h,s,i),v=m.step,x=m.tickMin,y=m.tickMax,w=Um.rangeStep(x,y.add(new Nt(.1).mul(v)),v);return r>n?Rw(w):w}function tY(e,t){var r=Eu(e,2),n=r[0],a=r[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=n$([n,a]),u=Eu(s,2),d=u[0],c=u[1];if(d===-1/0||c===1/0)return[n,a];if(d===c)return[d];var h=Math.max(t,2),p=a$(new Nt(c).sub(d).div(h-1),i,0),m=[].concat(Iw(Um.rangeStep(new Nt(d),new Nt(c).sub(new Nt(.99).mul(p)),p)),[c]);return n>a?Rw(m):m}var rY=t$(eY),nY=t$(tY),aY="Invariant failed";function Wo(e,t){throw new Error(aY)}var iY=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function vl(e){"@babel/helpers - typeof";return vl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vl(e)}function Ap(){return Ap=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function fY(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function hY(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pY(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,s=-1,u=(r=n?.length)!==null&&r!==void 0?r:0;if(u<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var d=i.range,c=0;c0?a[c-1].coordinate:a[u-1].coordinate,p=a[c].coordinate,m=c>=u-1?a[0].coordinate:a[c+1].coordinate,v=void 0;if(zr(p-h)!==zr(m-p)){var x=[];if(zr(m-p)===zr(d[1]-d[0])){v=m;var y=p+d[1]-d[0];x[0]=Math.min(y,(y+h)/2),x[1]=Math.max(y,(y+h)/2)}else{v=h;var w=m+d[1]-d[0];x[0]=Math.min(p,(w+p)/2),x[1]=Math.max(p,(w+p)/2)}var j=[Math.min(p,(v+p)/2),Math.max(p,(v+p)/2)];if(t>j[0]&&t<=j[1]||t>=x[0]&&t<=x[1]){s=a[c].index;break}}else{var _=Math.min(h,m),C=Math.max(h,m);if(t>(_+p)/2&&t<=(C+p)/2){s=a[c].index;break}}}else for(var A=0;A0&&A(n[A].coordinate+n[A-1].coordinate)/2&&t<=(n[A].coordinate+n[A+1].coordinate)/2||A===u-1&&t>(n[A].coordinate+n[A-1].coordinate)/2){s=n[A].index;break}return s},Wj=function(t){var r,n=t,a=n.type.displayName,i=(r=t.type)!==null&&r!==void 0&&r.defaultProps?Wt(Wt({},t.type.defaultProps),t.props):t.props,s=i.stroke,u=i.fill,d;switch(a){case"Line":d=s;break;case"Area":case"Radar":d=s&&s!=="none"?s:u;break;default:d=u;break}return d},TY=function(t){var r=t.barSize,n=t.totalSize,a=t.stackGroups,i=a===void 0?{}:a;if(!i)return{};for(var s={},u=Object.keys(i),d=0,c=u.length;d=0});if(j&&j.length){var _=j[0].type.defaultProps,C=_!==void 0?Wt(Wt({},_),j[0].props):j[0].props,A=C.barSize,E=C[w];s[E]||(s[E]=[]);var O=rt(A)?r:A;s[E].push({item:j[0],stackList:j.slice(1),barSize:rt(O)?void 0:qr(O,n,0)})}}return s},kY=function(t){var r=t.barGap,n=t.barCategoryGap,a=t.bandSize,i=t.sizeList,s=i===void 0?[]:i,u=t.maxBarSize,d=s.length;if(d<1)return null;var c=qr(r,a,0,!0),h,p=[];if(s[0].barSize===+s[0].barSize){var m=!1,v=a/d,x=s.reduce(function(A,E){return A+E.barSize||0},0);x+=(d-1)*c,x>=a&&(x-=(d-1)*c,c=0),x>=a&&v>0&&(m=!0,v*=.9,x=d*v);var y=(a-x)/2>>0,w={offset:y-c,size:0};h=s.reduce(function(A,E){var O={item:E.item,position:{offset:w.offset+w.size+c,size:m?v:E.barSize}},T=[].concat(xT(A),[O]);return w=T[T.length-1].position,E.stackList&&E.stackList.length&&E.stackList.forEach(function(k){T.push({item:k,position:w})}),T},p)}else{var j=qr(n,a,0,!0);a-2*j-(d-1)*c<=0&&(c=0);var _=(a-2*j-(d-1)*c)/d;_>1&&(_>>=0);var C=u===+u?Math.min(_,u):_;h=s.reduce(function(A,E,O){var T=[].concat(xT(A),[{item:E.item,position:{offset:j+(_+c)*O+(_-C)/2,size:C}}]);return E.stackList&&E.stackList.length&&E.stackList.forEach(function(k){T.push({item:k,position:T[T.length-1].position})}),T},p)}return h},RY=function(t,r,n,a){var i=n.children,s=n.width,u=n.margin,d=s-(u.left||0)-(u.right||0),c=c$({children:i,legendWidth:d});if(c){var h=a||{},p=h.width,m=h.height,v=c.align,x=c.verticalAlign,y=c.layout;if((y==="vertical"||y==="horizontal"&&x==="middle")&&v!=="center"&&_e(t[v]))return Wt(Wt({},t),{},tl({},v,t[v]+(p||0)));if((y==="horizontal"||y==="vertical"&&v==="center")&&x!=="middle"&&_e(t[x]))return Wt(Wt({},t),{},tl({},x,t[x]+(m||0)))}return t},IY=function(t,r,n){return rt(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},u$=function(t,r,n,a,i){var s=r.props.children,u=jn(s,cd).filter(function(c){return IY(a,i,c.props.direction)});if(u&&u.length){var d=u.map(function(c){return c.props.dataKey});return t.reduce(function(c,h){var p=ur(h,n);if(rt(p))return c;var m=Array.isArray(p)?[zm(p),Fm(p)]:[p,p],v=d.reduce(function(x,y){var w=ur(h,y,0),j=m[0]-Math.abs(Array.isArray(w)?w[0]:w),_=m[1]+Math.abs(Array.isArray(w)?w[1]:w);return[Math.min(j,x[0]),Math.max(_,x[1])]},[1/0,-1/0]);return[Math.min(v[0],c[0]),Math.max(v[1],c[1])]},[1/0,-1/0])}return null},MY=function(t,r,n,a,i){var s=r.map(function(u){return u$(t,u,n,i,a)}).filter(function(u){return!rt(u)});return s&&s.length?s.reduce(function(u,d){return[Math.min(u[0],d[0]),Math.max(u[1],d[1])]},[1/0,-1/0]):null},d$=function(t,r,n,a,i){var s=r.map(function(d){var c=d.props.dataKey;return n==="number"&&c&&u$(t,d,c,a)||su(t,c,n,i)});if(n==="number")return s.reduce(function(d,c){return[Math.min(d[0],c[0]),Math.max(d[1],c[1])]},[1/0,-1/0]);var u={};return s.reduce(function(d,c){for(var h=0,p=c.length;h=2?zr(u[0]-u[1])*2*c:c,r&&(t.ticks||t.niceTicks)){var h=(t.ticks||t.niceTicks).map(function(p){var m=i?i.indexOf(p):p;return{coordinate:a(m)+c,value:p,offset:c}});return h.filter(function(p){return!rd(p.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(p,m){return{coordinate:a(p)+c,value:p,index:m,offset:c}}):a.ticks&&!n?a.ticks(t.tickCount).map(function(p){return{coordinate:a(p)+c,value:p,offset:c}}):a.domain().map(function(p,m){return{coordinate:a(p)+c,value:i?i[p]:p,index:m,offset:c}})},Qb=new WeakMap,Qf=function(t,r){if(typeof r!="function")return t;Qb.has(t)||Qb.set(t,new WeakMap);var n=Qb.get(t);if(n.has(r))return n.get(r);var a=function(){t.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,a),a},p$=function(t,r,n){var a=t.scale,i=t.type,s=t.layout,u=t.axisType;if(a==="auto")return s==="radial"&&u==="radiusAxis"?{scale:wu(),realScaleType:"band"}:s==="radial"&&u==="angleAxis"?{scale:_p(),realScaleType:"linear"}:i==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:ou(),realScaleType:"point"}:i==="category"?{scale:wu(),realScaleType:"band"}:{scale:_p(),realScaleType:"linear"};if(qo(a)){var d="scale".concat(_m(a));return{scale:(iT[d]||ou)(),realScaleType:iT[d]?d:"point"}}return Ye(a)?{scale:a}:{scale:ou(),realScaleType:"point"}},wT=1e-4,m$=function(t){var r=t.domain();if(!(!r||r.length<=2)){var n=r.length,a=t.range(),i=Math.min(a[0],a[1])-wT,s=Math.max(a[0],a[1])+wT,u=t(r[0]),d=t(r[n-1]);(us||ds)&&t.domain([r[0],r[n-1]])}},DY=function(t,r){if(!t)return null;for(var n=0,a=t.length;na)&&(i[1]=a),i[0]>a&&(i[0]=a),i[1]=0?(t[u][n][0]=i,t[u][n][1]=i+d,i=t[u][n][1]):(t[u][n][0]=s,t[u][n][1]=s+d,s=t[u][n][1])}},BY=function(t){var r=t.length;if(!(r<=0))for(var n=0,a=t[0].length;n=0?(t[s][n][0]=i,t[s][n][1]=i+u,i=t[s][n][1]):(t[s][n][0]=0,t[s][n][1]=0)}},FY={sign:$Y,expand:E7,none:cl,silhouette:O7,wiggle:P7,positive:BY},zY=function(t,r,n){var a=r.map(function(u){return u.props.dataKey}),i=FY[n],s=C7().keys(a).value(function(u,d){return+ur(u,d,0)}).order(hw).offset(i);return s(t)},qY=function(t,r,n,a,i,s){if(!t)return null;var u=s?r.reverse():r,d={},c=u.reduce(function(p,m){var v,x=(v=m.type)!==null&&v!==void 0&&v.defaultProps?Wt(Wt({},m.type.defaultProps),m.props):m.props,y=x.stackId,w=x.hide;if(w)return p;var j=x[n],_=p[j]||{hasStack:!1,stackGroups:{}};if(dr(y)){var C=_.stackGroups[y]||{numericAxisId:n,cateAxisId:a,items:[]};C.items.push(m),_.hasStack=!0,_.stackGroups[y]=C}else _.stackGroups[Vl("_stackId_")]={numericAxisId:n,cateAxisId:a,items:[m]};return Wt(Wt({},p),{},tl({},j,_))},d),h={};return Object.keys(c).reduce(function(p,m){var v=c[m];if(v.hasStack){var x={};v.stackGroups=Object.keys(v.stackGroups).reduce(function(y,w){var j=v.stackGroups[w];return Wt(Wt({},y),{},tl({},w,{numericAxisId:n,cateAxisId:a,items:j.items,stackedData:zY(t,j.items,i)}))},x)}return Wt(Wt({},p),{},tl({},m,v))},h)},g$=function(t,r){var n=r.realScaleType,a=r.type,i=r.tickCount,s=r.originalDomain,u=r.allowDecimals,d=n||r.scale;if(d!=="auto"&&d!=="linear")return null;if(i&&a==="number"&&s&&(s[0]==="auto"||s[1]==="auto")){var c=t.domain();if(!c.length)return null;var h=rY(c,i,u);return t.domain([zm(h),Fm(h)]),{niceTicks:h}}if(i&&a==="number"){var p=t.domain(),m=nY(p,i,u);return{niceTicks:m}}return null};function ST(e){var t=e.axis,r=e.ticks,n=e.bandSize,a=e.entry,i=e.index,s=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!rt(a[t.dataKey])){var u=ip(r,"value",a[t.dataKey]);if(u)return u.coordinate+n/2}return r[i]?r[i].coordinate+n/2:null}var d=ur(a,rt(s)?t.dataKey:s);return rt(d)?null:t.scale(d)}var jT=function(t){var r=t.axis,n=t.ticks,a=t.offset,i=t.bandSize,s=t.entry,u=t.index;if(r.type==="category")return n[u]?n[u].coordinate+a:null;var d=ur(s,r.dataKey,r.domain[u]);return rt(d)?null:r.scale(d)-i/2+a},UY=function(t){var r=t.numericAxis,n=r.scale.domain();if(r.type==="number"){var a=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return a<=0&&i>=0?0:i<0?i:a}return n[0]},VY=function(t,r){var n,a=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Wt(Wt({},t.type.defaultProps),t.props):t.props,i=a.stackId;if(dr(i)){var s=r[i];if(s){var u=s.items.indexOf(t);return u>=0?s.stackedData[u]:null}}return null},HY=function(t){return t.reduce(function(r,n){return[zm(n.concat([r[0]]).filter(_e)),Fm(n.concat([r[1]]).filter(_e))]},[1/0,-1/0])},v$=function(t,r,n){return Object.keys(t).reduce(function(a,i){var s=t[i],u=s.stackedData,d=u.reduce(function(c,h){var p=HY(h.slice(r,n+1));return[Math.min(c[0],p[0]),Math.max(c[1],p[1])]},[1/0,-1/0]);return[Math.min(d[0],a[0]),Math.max(d[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},NT=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,_T=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,$w=function(t,r,n){if(Ye(t))return t(r,n);if(!Array.isArray(t))return r;var a=[];if(_e(t[0]))a[0]=n?t[0]:Math.min(t[0],r[0]);else if(NT.test(t[0])){var i=+NT.exec(t[0])[1];a[0]=r[0]-i}else Ye(t[0])?a[0]=t[0](r[0]):a[0]=r[0];if(_e(t[1]))a[1]=n?t[1]:Math.max(t[1],r[1]);else if(_T.test(t[1])){var s=+_T.exec(t[1])[1];a[1]=r[1]+s}else Ye(t[1])?a[1]=t[1](r[1]):a[1]=r[1];return a},kp=function(t,r,n){if(t&&t.scale&&t.scale.bandwidth){var a=t.scale.bandwidth();if(!n||a>0)return a}if(t&&r&&r.length>=2){for(var i=bj(r,function(p){return p.coordinate}),s=1/0,u=1,d=i.length;ue.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},eJ=function(t,r,n,a,i){var s=t.width,u=t.height,d=t.startAngle,c=t.endAngle,h=qr(t.cx,s,s/2),p=qr(t.cy,u,u/2),m=b$(s,u,n),v=qr(t.innerRadius,m,0),x=qr(t.outerRadius,m,m*.8),y=Object.keys(r);return y.reduce(function(w,j){var _=r[j],C=_.domain,A=_.reversed,E;if(rt(_.range))a==="angleAxis"?E=[d,c]:a==="radiusAxis"&&(E=[v,x]),A&&(E=[E[1],E[0]]);else{E=_.range;var O=E,T=KY(O,2);d=T[0],c=T[1]}var k=p$(_,i),M=k.realScaleType,$=k.scale;$.domain(C).range(E),m$($);var z=g$($,ai(ai({},_),{},{realScaleType:M})),F=ai(ai(ai({},_),z),{},{range:E,radius:x,realScaleType:M,scale:$,cx:h,cy:p,innerRadius:v,outerRadius:x,startAngle:d,endAngle:c});return ai(ai({},w),{},x$({},j,F))},{})},tJ=function(t,r){var n=t.x,a=t.y,i=r.x,s=r.y;return Math.sqrt(Math.pow(n-i,2)+Math.pow(a-s,2))},rJ=function(t,r){var n=t.x,a=t.y,i=r.cx,s=r.cy,u=tJ({x:n,y:a},{x:i,y:s});if(u<=0)return{radius:u};var d=(n-i)/u,c=Math.acos(d);return a>s&&(c=2*Math.PI-c),{radius:u,angle:ZY(c),angleInRadian:c}},nJ=function(t){var r=t.startAngle,n=t.endAngle,a=Math.floor(r/360),i=Math.floor(n/360),s=Math.min(a,i);return{startAngle:r-s*360,endAngle:n-s*360}},aJ=function(t,r){var n=r.startAngle,a=r.endAngle,i=Math.floor(n/360),s=Math.floor(a/360),u=Math.min(i,s);return t+u*360},PT=function(t,r){var n=t.x,a=t.y,i=rJ({x:n,y:a},r),s=i.radius,u=i.angle,d=r.innerRadius,c=r.outerRadius;if(sc)return!1;if(s===0)return!0;var h=nJ(r),p=h.startAngle,m=h.endAngle,v=u,x;if(p<=m){for(;v>m;)v-=360;for(;v=p&&v<=m}else{for(;v>p;)v-=360;for(;v=m&&v<=p}return x?ai(ai({},r),{},{radius:s,angle:aJ(v,r)}):null},w$=function(t){return!b.isValidElement(t)&&!Ye(t)&&typeof t!="boolean"?t.className:""};function Tu(e){"@babel/helpers - typeof";return Tu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tu(e)}var iJ=["offset"];function oJ(e){return uJ(e)||cJ(e)||lJ(e)||sJ()}function sJ(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lJ(e,t){if(e){if(typeof e=="string")return Bw(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Bw(e,t)}}function cJ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function uJ(e){if(Array.isArray(e))return Bw(e)}function Bw(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function fJ(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function AT(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function cr(e){for(var t=1;t=0?1:-1,C,A;a==="insideStart"?(C=v+_*s,A=y):a==="insideEnd"?(C=x-_*s,A=!y):a==="end"&&(C=x+_*s,A=y),A=j<=0?A:!A;var E=Rt(c,h,w,C),O=Rt(c,h,w,C+(A?1:-1)*359),T="M".concat(E.x,",").concat(E.y,` - A`).concat(w,",").concat(w,",0,1,").concat(A?0:1,`, - `).concat(O.x,",").concat(O.y),k=rt(t.id)?Vl("recharts-radial-line-"):t.id;return q.createElement("text",ku({},n,{dominantBaseline:"central",className:nt("recharts-radial-bar-label",u)}),q.createElement("defs",null,q.createElement("path",{id:k,d:T})),q.createElement("textPath",{xlinkHref:"#".concat(k)},r))},xJ=function(t){var r=t.viewBox,n=t.offset,a=t.position,i=r,s=i.cx,u=i.cy,d=i.innerRadius,c=i.outerRadius,h=i.startAngle,p=i.endAngle,m=(h+p)/2;if(a==="outside"){var v=Rt(s,u,c+n,m),x=v.x,y=v.y;return{x,y,textAnchor:x>=s?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:s,y:u,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:s,y:u,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:s,y:u,textAnchor:"middle",verticalAnchor:"end"};var w=(d+c)/2,j=Rt(s,u,w,m),_=j.x,C=j.y;return{x:_,y:C,textAnchor:"middle",verticalAnchor:"middle"}},bJ=function(t){var r=t.viewBox,n=t.parentViewBox,a=t.offset,i=t.position,s=r,u=s.x,d=s.y,c=s.width,h=s.height,p=h>=0?1:-1,m=p*a,v=p>0?"end":"start",x=p>0?"start":"end",y=c>=0?1:-1,w=y*a,j=y>0?"end":"start",_=y>0?"start":"end";if(i==="top"){var C={x:u+c/2,y:d-p*a,textAnchor:"middle",verticalAnchor:v};return cr(cr({},C),n?{height:Math.max(d-n.y,0),width:c}:{})}if(i==="bottom"){var A={x:u+c/2,y:d+h+m,textAnchor:"middle",verticalAnchor:x};return cr(cr({},A),n?{height:Math.max(n.y+n.height-(d+h),0),width:c}:{})}if(i==="left"){var E={x:u-w,y:d+h/2,textAnchor:j,verticalAnchor:"middle"};return cr(cr({},E),n?{width:Math.max(E.x-n.x,0),height:h}:{})}if(i==="right"){var O={x:u+c+w,y:d+h/2,textAnchor:_,verticalAnchor:"middle"};return cr(cr({},O),n?{width:Math.max(n.x+n.width-O.x,0),height:h}:{})}var T=n?{width:c,height:h}:{};return i==="insideLeft"?cr({x:u+w,y:d+h/2,textAnchor:_,verticalAnchor:"middle"},T):i==="insideRight"?cr({x:u+c-w,y:d+h/2,textAnchor:j,verticalAnchor:"middle"},T):i==="insideTop"?cr({x:u+c/2,y:d+m,textAnchor:"middle",verticalAnchor:x},T):i==="insideBottom"?cr({x:u+c/2,y:d+h-m,textAnchor:"middle",verticalAnchor:v},T):i==="insideTopLeft"?cr({x:u+w,y:d+m,textAnchor:_,verticalAnchor:x},T):i==="insideTopRight"?cr({x:u+c-w,y:d+m,textAnchor:j,verticalAnchor:x},T):i==="insideBottomLeft"?cr({x:u+w,y:d+h-m,textAnchor:_,verticalAnchor:v},T):i==="insideBottomRight"?cr({x:u+c-w,y:d+h-m,textAnchor:j,verticalAnchor:v},T):Ul(i)&&(_e(i.x)||Do(i.x))&&(_e(i.y)||Do(i.y))?cr({x:u+qr(i.x,c),y:d+qr(i.y,h),textAnchor:"end",verticalAnchor:"end"},T):cr({x:u+c/2,y:d+h/2,textAnchor:"middle",verticalAnchor:"middle"},T)},wJ=function(t){return"cx"in t&&_e(t.cx)};function yr(e){var t=e.offset,r=t===void 0?5:t,n=dJ(e,iJ),a=cr({offset:r},n),i=a.viewBox,s=a.position,u=a.value,d=a.children,c=a.content,h=a.className,p=h===void 0?"":h,m=a.textBreakAll;if(!i||rt(u)&&rt(d)&&!b.isValidElement(c)&&!Ye(c))return null;if(b.isValidElement(c))return b.cloneElement(c,a);var v;if(Ye(c)){if(v=b.createElement(c,a),b.isValidElement(v))return v}else v=gJ(a);var x=wJ(i),y=qe(a,!0);if(x&&(s==="insideStart"||s==="insideEnd"||s==="end"))return yJ(a,v,y);var w=x?xJ(a):bJ(a);return q.createElement(Vo,ku({className:nt("recharts-label",p)},y,w,{breakAll:m}),v)}yr.displayName="Label";var S$=function(t){var r=t.cx,n=t.cy,a=t.angle,i=t.startAngle,s=t.endAngle,u=t.r,d=t.radius,c=t.innerRadius,h=t.outerRadius,p=t.x,m=t.y,v=t.top,x=t.left,y=t.width,w=t.height,j=t.clockWise,_=t.labelViewBox;if(_)return _;if(_e(y)&&_e(w)){if(_e(p)&&_e(m))return{x:p,y:m,width:y,height:w};if(_e(v)&&_e(x))return{x:v,y:x,width:y,height:w}}return _e(p)&&_e(m)?{x:p,y:m,width:0,height:0}:_e(r)&&_e(n)?{cx:r,cy:n,startAngle:i||a||0,endAngle:s||a||0,innerRadius:c||0,outerRadius:h||d||u||0,clockWise:j}:t.viewBox?t.viewBox:{}},SJ=function(t,r){return t?t===!0?q.createElement(yr,{key:"label-implicit",viewBox:r}):dr(t)?q.createElement(yr,{key:"label-implicit",viewBox:r,value:t}):b.isValidElement(t)?t.type===yr?b.cloneElement(t,{key:"label-implicit",viewBox:r}):q.createElement(yr,{key:"label-implicit",content:t,viewBox:r}):Ye(t)?q.createElement(yr,{key:"label-implicit",content:t,viewBox:r}):Ul(t)?q.createElement(yr,ku({viewBox:r},t,{key:"label-implicit"})):null:null},jJ=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var a=t.children,i=S$(t),s=jn(a,yr).map(function(d,c){return b.cloneElement(d,{viewBox:r||i,key:"label-".concat(c)})});if(!n)return s;var u=SJ(t.label,r||i);return[u].concat(oJ(s))};yr.parseViewBox=S$;yr.renderCallByParent=jJ;var Zb,TT;function NJ(){if(TT)return Zb;TT=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return Zb=e,Zb}var _J=NJ();const CJ=ht(_J);function Ru(e){"@babel/helpers - typeof";return Ru=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ru(e)}var EJ=["valueAccessor"],OJ=["data","dataKey","clockWise","id","textBreakAll"];function PJ(e){return RJ(e)||kJ(e)||TJ(e)||AJ()}function AJ(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TJ(e,t){if(e){if(typeof e=="string")return Fw(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Fw(e,t)}}function kJ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function RJ(e){if(Array.isArray(e))return Fw(e)}function Fw(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function LJ(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var $J=function(t){return Array.isArray(t.value)?CJ(t.value):t.value};function ui(e){var t=e.valueAccessor,r=t===void 0?$J:t,n=IT(e,EJ),a=n.data,i=n.dataKey,s=n.clockWise,u=n.id,d=n.textBreakAll,c=IT(n,OJ);return!a||!a.length?null:q.createElement(dt,{className:"recharts-label-list"},a.map(function(h,p){var m=rt(i)?r(h,p):ur(h&&h.payload,i),v=rt(u)?{}:{id:"".concat(u,"-").concat(p)};return q.createElement(yr,Ip({},qe(h,!0),c,v,{parentViewBox:h.parentViewBox,value:m,textBreakAll:d,viewBox:yr.parseViewBox(rt(s)?h:RT(RT({},h),{},{clockWise:s})),key:"label-".concat(p),index:p}))}))}ui.displayName="LabelList";function BJ(e,t){return e?e===!0?q.createElement(ui,{key:"labelList-implicit",data:t}):q.isValidElement(e)||Ye(e)?q.createElement(ui,{key:"labelList-implicit",data:t,content:e}):Ul(e)?q.createElement(ui,Ip({data:t},e,{key:"labelList-implicit"})):null:null}function FJ(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,a=jn(n,ui).map(function(s,u){return b.cloneElement(s,{data:t,key:"labelList-".concat(u)})});if(!r)return a;var i=BJ(e.label,t);return[i].concat(PJ(a))}ui.renderCallByParent=FJ;function Iu(e){"@babel/helpers - typeof";return Iu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Iu(e)}function zw(){return zw=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(s>c),`, - `).concat(p.x,",").concat(p.y,` - `);if(a>0){var v=Rt(r,n,a,s),x=Rt(r,n,a,c);m+="L ".concat(x.x,",").concat(x.y,` - A `).concat(a,",").concat(a,`,0, - `).concat(+(Math.abs(d)>180),",").concat(+(s<=c),`, - `).concat(v.x,",").concat(v.y," Z")}else m+="L ".concat(r,",").concat(n," Z");return m},HJ=function(t){var r=t.cx,n=t.cy,a=t.innerRadius,i=t.outerRadius,s=t.cornerRadius,u=t.forceCornerRadius,d=t.cornerIsExternal,c=t.startAngle,h=t.endAngle,p=zr(h-c),m=Zf({cx:r,cy:n,radius:i,angle:c,sign:p,cornerRadius:s,cornerIsExternal:d}),v=m.circleTangency,x=m.lineTangency,y=m.theta,w=Zf({cx:r,cy:n,radius:i,angle:h,sign:-p,cornerRadius:s,cornerIsExternal:d}),j=w.circleTangency,_=w.lineTangency,C=w.theta,A=d?Math.abs(c-h):Math.abs(c-h)-y-C;if(A<0)return u?"M ".concat(x.x,",").concat(x.y,` - a`).concat(s,",").concat(s,",0,0,1,").concat(s*2,`,0 - a`).concat(s,",").concat(s,",0,0,1,").concat(-s*2,`,0 - `):j$({cx:r,cy:n,innerRadius:a,outerRadius:i,startAngle:c,endAngle:h});var E="M ".concat(x.x,",").concat(x.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(p<0),",").concat(v.x,",").concat(v.y,` - A`).concat(i,",").concat(i,",0,").concat(+(A>180),",").concat(+(p<0),",").concat(j.x,",").concat(j.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(p<0),",").concat(_.x,",").concat(_.y,` - `);if(a>0){var O=Zf({cx:r,cy:n,radius:a,angle:c,sign:p,isExternal:!0,cornerRadius:s,cornerIsExternal:d}),T=O.circleTangency,k=O.lineTangency,M=O.theta,$=Zf({cx:r,cy:n,radius:a,angle:h,sign:-p,isExternal:!0,cornerRadius:s,cornerIsExternal:d}),z=$.circleTangency,F=$.lineTangency,V=$.theta,G=d?Math.abs(c-h):Math.abs(c-h)-M-V;if(G<0&&s===0)return"".concat(E,"L").concat(r,",").concat(n,"Z");E+="L".concat(F.x,",").concat(F.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(p<0),",").concat(z.x,",").concat(z.y,` - A`).concat(a,",").concat(a,",0,").concat(+(G>180),",").concat(+(p>0),",").concat(T.x,",").concat(T.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(p<0),",").concat(k.x,",").concat(k.y,"Z")}else E+="L".concat(r,",").concat(n,"Z");return E},WJ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},N$=function(t){var r=DT(DT({},WJ),t),n=r.cx,a=r.cy,i=r.innerRadius,s=r.outerRadius,u=r.cornerRadius,d=r.forceCornerRadius,c=r.cornerIsExternal,h=r.startAngle,p=r.endAngle,m=r.className;if(s0&&Math.abs(h-p)<360?w=HJ({cx:n,cy:a,innerRadius:i,outerRadius:s,cornerRadius:Math.min(y,x/2),forceCornerRadius:d,cornerIsExternal:c,startAngle:h,endAngle:p}):w=j$({cx:n,cy:a,innerRadius:i,outerRadius:s,startAngle:h,endAngle:p}),q.createElement("path",zw({},qe(r,!0),{className:v,d:w,role:"img"}))};function Mu(e){"@babel/helpers - typeof";return Mu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mu(e)}function qw(){return qw=Object.assign?Object.assign.bind():function(e){for(var t=1;taQ.call(e,t));function ss(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const sQ="__v",lQ="__o",cQ="_owner",{getOwnPropertyDescriptor:VT,keys:HT}=Object;function uQ(e,t){return e.byteLength===t.byteLength&&Dp(new Uint8Array(e),new Uint8Array(t))}function dQ(e,t,r){let n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function fQ(e,t){return e.byteLength===t.byteLength&&Dp(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function hQ(e,t){return ss(e.getTime(),t.getTime())}function pQ(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function mQ(e,t){return e===t}function WT(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const a=new Array(n),i=e.entries();let s,u,d=0;for(;(s=i.next())&&!s.done;){const c=t.entries();let h=!1,p=0;for(;(u=c.next())&&!u.done;){if(a[p]){p++;continue}const m=s.value,v=u.value;if(r.equals(m[0],v[0],d,p,e,t,r)&&r.equals(m[1],v[1],m[0],v[0],e,t,r)){h=a[p]=!0;break}p++}if(!h)return!1;d++}return!0}const gQ=ss;function vQ(e,t,r){const n=HT(e);let a=n.length;if(HT(t).length!==a)return!1;for(;a-- >0;)if(!_$(e,t,r,n[a]))return!1;return!0}function Wc(e,t,r){const n=UT(e);let a=n.length;if(UT(t).length!==a)return!1;let i,s,u;for(;a-- >0;)if(i=n[a],!_$(e,t,r,i)||(s=VT(e,i),u=VT(t,i),(s||u)&&(!s||!u||s.configurable!==u.configurable||s.enumerable!==u.enumerable||s.writable!==u.writable)))return!1;return!0}function yQ(e,t){return ss(e.valueOf(),t.valueOf())}function xQ(e,t){return e.source===t.source&&e.flags===t.flags}function GT(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const a=new Array(n),i=e.values();let s,u;for(;(s=i.next())&&!s.done;){const d=t.values();let c=!1,h=0;for(;(u=d.next())&&!u.done;){if(!a[h]&&r.equals(s.value,u.value,s.value,u.value,e,t,r)){c=a[h]=!0;break}h++}if(!c)return!1}return!0}function Dp(e,t){let r=e.byteLength;if(t.byteLength!==r||e.byteOffset!==t.byteOffset)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function bQ(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function _$(e,t,r,n){return(n===cQ||n===lQ||n===sQ)&&(e.$$typeof||t.$$typeof)?!0:oQ(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}const wQ="[object ArrayBuffer]",SQ="[object Arguments]",jQ="[object Boolean]",NQ="[object DataView]",_Q="[object Date]",CQ="[object Error]",EQ="[object Map]",OQ="[object Number]",PQ="[object Object]",AQ="[object RegExp]",TQ="[object Set]",kQ="[object String]",RQ={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},IQ="[object URL]",MQ=Object.prototype.toString;function DQ({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:s,areNumbersEqual:u,areObjectsEqual:d,arePrimitiveWrappersEqual:c,areRegExpsEqual:h,areSetsEqual:p,areTypedArraysEqual:m,areUrlsEqual:v,unknownTagComparators:x}){return function(w,j,_){if(w===j)return!0;if(w==null||j==null)return!1;const C=typeof w;if(C!==typeof j)return!1;if(C!=="object")return C==="number"?u(w,j,_):C==="function"?i(w,j,_):!1;const A=w.constructor;if(A!==j.constructor)return!1;if(A===Object)return d(w,j,_);if(Array.isArray(w))return t(w,j,_);if(A===Date)return n(w,j,_);if(A===RegExp)return h(w,j,_);if(A===Map)return s(w,j,_);if(A===Set)return p(w,j,_);const E=MQ.call(w);if(E===_Q)return n(w,j,_);if(E===AQ)return h(w,j,_);if(E===EQ)return s(w,j,_);if(E===TQ)return p(w,j,_);if(E===PQ)return typeof w.then!="function"&&typeof j.then!="function"&&d(w,j,_);if(E===IQ)return v(w,j,_);if(E===CQ)return a(w,j,_);if(E===SQ)return d(w,j,_);if(RQ[E])return m(w,j,_);if(E===wQ)return e(w,j,_);if(E===NQ)return r(w,j,_);if(E===jQ||E===OQ||E===kQ)return c(w,j,_);if(x){let O=x[E];if(!O){const T=iQ(w);T&&(O=x[T])}if(O)return O(w,j,_)}return!1}}function LQ({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:uQ,areArraysEqual:r?Wc:dQ,areDataViewsEqual:fQ,areDatesEqual:hQ,areErrorsEqual:pQ,areFunctionsEqual:mQ,areMapsEqual:r?n1(WT,Wc):WT,areNumbersEqual:gQ,areObjectsEqual:r?Wc:vQ,arePrimitiveWrappersEqual:yQ,areRegExpsEqual:xQ,areSetsEqual:r?n1(GT,Wc):GT,areTypedArraysEqual:r?n1(Dp,Wc):Dp,areUrlsEqual:bQ,unknownTagComparators:void 0};if(t&&(n=Object.assign({},n,t(n))),e){const a=th(n.areArraysEqual),i=th(n.areMapsEqual),s=th(n.areObjectsEqual),u=th(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:s,areSetsEqual:u})}return n}function $Q(e){return function(t,r,n,a,i,s,u){return e(t,r,u)}}function BQ({circular:e,comparator:t,createState:r,equals:n,strict:a}){if(r)return function(u,d){const{cache:c=e?new WeakMap:void 0,meta:h}=r();return t(u,d,{cache:c,equals:n,meta:h,strict:a})};if(e)return function(u,d){return t(u,d,{cache:new WeakMap,equals:n,meta:void 0,strict:a})};const i={cache:void 0,equals:n,meta:void 0,strict:a};return function(u,d){return t(u,d,i)}}const FQ=co();co({strict:!0});co({circular:!0});co({circular:!0,strict:!0});co({createInternalComparator:()=>ss});co({strict:!0,createInternalComparator:()=>ss});co({circular:!0,createInternalComparator:()=>ss});co({circular:!0,createInternalComparator:()=>ss,strict:!0});function co(e={}){const{circular:t=!1,createInternalComparator:r,createState:n,strict:a=!1}=e,i=LQ(e),s=DQ(i),u=r?r(s):$Q(s);return BQ({circular:t,comparator:s,createState:n,equals:u,strict:a})}function zQ(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function KT(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function a(i){r<0&&(r=i),i-r>t?(e(i),r=-1):zQ(a)};requestAnimationFrame(n)}function Uw(e){"@babel/helpers - typeof";return Uw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uw(e)}function qQ(e){return WQ(e)||HQ(e)||VQ(e)||UQ()}function UQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VQ(e,t){if(e){if(typeof e=="string")return XT(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return XT(e,t)}}function XT(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?1:j<0?0:j},y=function(j){for(var _=j>1?1:j,C=_,A=0;A<8;++A){var E=p(C)-_,O=v(C);if(Math.abs(E-_)0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,a=t.damping,i=a===void 0?8:a,s=t.dt,u=s===void 0?17:s,d=function(h,p,m){var v=-(h-p)*n,x=m*i,y=m+(v-x)*u/1e3,w=m*u/1e3+h;return Math.abs(w-p)e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function jZ(e,t){if(e==null)return{};var r={},n=Object.keys(e),a,i;for(i=0;i=0)&&(r[a]=e[a]);return r}function a1(e){return EZ(e)||CZ(e)||_Z(e)||NZ()}function NZ(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _Z(e,t){if(e){if(typeof e=="string")return Kw(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Kw(e,t)}}function CZ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function EZ(e){if(Array.isArray(e))return Kw(e)}function Kw(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Bp(e){return Bp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Bp(e)}var $a=(function(e){kZ(r,e);var t=RZ(r);function r(n,a){var i;OZ(this,r),i=t.call(this,n,a);var s=i.props,u=s.isActive,d=s.attributeName,c=s.from,h=s.to,p=s.steps,m=s.children,v=s.duration;if(i.handleStyleChange=i.handleStyleChange.bind(Jw(i)),i.changeStyle=i.changeStyle.bind(Jw(i)),!u||v<=0)return i.state={style:{}},typeof m=="function"&&(i.state={style:h}),Yw(i);if(p&&p.length)i.state={style:p[0].style};else if(c){if(typeof m=="function")return i.state={style:c},Yw(i);i.state={style:d?nu({},d,c):c}}else i.state={style:{}};return i}return AZ(r,[{key:"componentDidMount",value:function(){var a=this.props,i=a.isActive,s=a.canBegin;this.mounted=!0,!(!i||!s)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(a){var i=this.props,s=i.isActive,u=i.canBegin,d=i.attributeName,c=i.shouldReAnimate,h=i.to,p=i.from,m=this.state.style;if(u){if(!s){var v={style:d?nu({},d,h):h};this.state&&m&&(d&&m[d]!==h||!d&&m!==h)&&this.setState(v);return}if(!(FQ(a.to,h)&&a.canBegin&&a.isActive)){var x=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var y=x||c?p:a.to;if(this.state&&m){var w={style:d?nu({},d,y):y};(d&&m[d]!==y||!d&&m!==y)&&this.setState(w)}this.runAnimation(na(na({},this.props),{},{from:y,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var a=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),a&&a()}},{key:"handleStyleChange",value:function(a){this.changeStyle(a)}},{key:"changeStyle",value:function(a){this.mounted&&this.setState({style:a})}},{key:"runJSAnimation",value:function(a){var i=this,s=a.from,u=a.to,d=a.duration,c=a.easing,h=a.begin,p=a.onAnimationEnd,m=a.onAnimationStart,v=bZ(s,u,cZ(c),d,this.changeStyle),x=function(){i.stopJSAnimation=v()};this.manager.start([m,h,x,d,p])}},{key:"runStepAnimation",value:function(a){var i=this,s=a.steps,u=a.begin,d=a.onAnimationStart,c=s[0],h=c.style,p=c.duration,m=p===void 0?0:p,v=function(y,w,j){if(j===0)return y;var _=w.duration,C=w.easing,A=C===void 0?"ease":C,E=w.style,O=w.properties,T=w.onAnimationEnd,k=j>0?s[j-1]:w,M=O||Object.keys(E);if(typeof A=="function"||A==="spring")return[].concat(a1(y),[i.runJSAnimation.bind(i,{from:k.style,to:E,duration:_,easing:A}),_]);var $=QT(M,_,A),z=na(na(na({},k.style),E),{},{transition:$});return[].concat(a1(y),[z,_,T]).filter(JQ)};return this.manager.start([d].concat(a1(s.reduce(v,[h,Math.max(m,u)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=GQ());var i=a.begin,s=a.duration,u=a.attributeName,d=a.to,c=a.easing,h=a.onAnimationStart,p=a.onAnimationEnd,m=a.steps,v=a.children,x=this.manager;if(this.unSubscribe=x.subscribe(this.handleStyleChange),typeof c=="function"||typeof v=="function"||c==="spring"){this.runJSAnimation(a);return}if(m.length>1){this.runStepAnimation(a);return}var y=u?nu({},u,d):d,w=QT(Object.keys(y),s,c);x.start([h,i,na(na({},y),{},{transition:w}),s,p])}},{key:"render",value:function(){var a=this.props,i=a.children;a.begin;var s=a.duration;a.attributeName,a.easing;var u=a.isActive;a.steps,a.from,a.to,a.canBegin,a.onAnimationEnd,a.shouldReAnimate,a.onAnimationReStart;var d=SZ(a,wZ),c=b.Children.count(i),h=this.state.style;if(typeof i=="function")return i(h);if(!u||c===0||s<=0)return i;var p=function(v){var x=v.props,y=x.style,w=y===void 0?{}:y,j=x.className,_=b.cloneElement(v,na(na({},d),{},{style:na(na({},w),h),className:j}));return _};return c===1?p(b.Children.only(i)):q.createElement("div",null,b.Children.map(i,function(m){return p(m)}))}}]),r})(b.PureComponent);$a.displayName="Animate";$a.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};$a.propTypes={from:gt.oneOfType([gt.object,gt.string]),to:gt.oneOfType([gt.object,gt.string]),attributeName:gt.string,duration:gt.number,begin:gt.number,easing:gt.oneOfType([gt.string,gt.func]),steps:gt.arrayOf(gt.shape({duration:gt.number.isRequired,style:gt.object.isRequired,easing:gt.oneOfType([gt.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),gt.func]),properties:gt.arrayOf("string"),onAnimationEnd:gt.func})),children:gt.oneOfType([gt.node,gt.func]),isActive:gt.bool,canBegin:gt.bool,onAnimationEnd:gt.func,shouldReAnimate:gt.bool,onAnimationStart:gt.func,onAnimationReStart:gt.func};function $u(e){"@babel/helpers - typeof";return $u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$u(e)}function Fp(){return Fp=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0?1:-1,d=n>=0?1:-1,c=a>=0&&n>=0||a<0&&n<0?1:0,h;if(s>0&&i instanceof Array){for(var p=[0,0,0,0],m=0,v=4;ms?s:i[m];h="M".concat(t,",").concat(r+u*p[0]),p[0]>0&&(h+="A ".concat(p[0],",").concat(p[0],",0,0,").concat(c,",").concat(t+d*p[0],",").concat(r)),h+="L ".concat(t+n-d*p[1],",").concat(r),p[1]>0&&(h+="A ".concat(p[1],",").concat(p[1],",0,0,").concat(c,`, - `).concat(t+n,",").concat(r+u*p[1])),h+="L ".concat(t+n,",").concat(r+a-u*p[2]),p[2]>0&&(h+="A ".concat(p[2],",").concat(p[2],",0,0,").concat(c,`, - `).concat(t+n-d*p[2],",").concat(r+a)),h+="L ".concat(t+d*p[3],",").concat(r+a),p[3]>0&&(h+="A ".concat(p[3],",").concat(p[3],",0,0,").concat(c,`, - `).concat(t,",").concat(r+a-u*p[3])),h+="Z"}else if(s>0&&i===+i&&i>0){var x=Math.min(s,i);h="M ".concat(t,",").concat(r+u*x,` - A `).concat(x,",").concat(x,",0,0,").concat(c,",").concat(t+d*x,",").concat(r,` - L `).concat(t+n-d*x,",").concat(r,` - A `).concat(x,",").concat(x,",0,0,").concat(c,",").concat(t+n,",").concat(r+u*x,` - L `).concat(t+n,",").concat(r+a-u*x,` - A `).concat(x,",").concat(x,",0,0,").concat(c,",").concat(t+n-d*x,",").concat(r+a,` - L `).concat(t+d*x,",").concat(r+a,` - A `).concat(x,",").concat(x,",0,0,").concat(c,",").concat(t,",").concat(r+a-u*x," Z")}else h="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(a," h ").concat(-n," Z");return h},UZ=function(t,r){if(!t||!r)return!1;var n=t.x,a=t.y,i=r.x,s=r.y,u=r.width,d=r.height;if(Math.abs(u)>0&&Math.abs(d)>0){var c=Math.min(i,i+u),h=Math.max(i,i+u),p=Math.min(s,s+d),m=Math.max(s,s+d);return n>=c&&n<=h&&a>=p&&a<=m}return!1},VZ={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Gj=function(t){var r=ok(ok({},VZ),t),n=b.useRef(),a=b.useState(-1),i=MZ(a,2),s=i[0],u=i[1];b.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var A=n.current.getTotalLength();A&&u(A)}catch{}},[]);var d=r.x,c=r.y,h=r.width,p=r.height,m=r.radius,v=r.className,x=r.animationEasing,y=r.animationDuration,w=r.animationBegin,j=r.isAnimationActive,_=r.isUpdateAnimationActive;if(d!==+d||c!==+c||h!==+h||p!==+p||h===0||p===0)return null;var C=nt("recharts-rectangle",v);return _?q.createElement($a,{canBegin:s>0,from:{width:h,height:p,x:d,y:c},to:{width:h,height:p,x:d,y:c},duration:y,animationEasing:x,isActive:_},function(A){var E=A.width,O=A.height,T=A.x,k=A.y;return q.createElement($a,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:w,duration:y,isActive:j,easing:x},q.createElement("path",Fp({},qe(r,!0),{className:C,d:sk(T,k,E,O,m),ref:n})))}):q.createElement("path",Fp({},qe(r,!0),{className:C,d:sk(d,c,h,p,m)}))},HZ=["points","className","baseLinePoints","connectNulls"];function Gs(){return Gs=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function GZ(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function lk(e){return JZ(e)||YZ(e)||XZ(e)||KZ()}function KZ(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function XZ(e,t){if(e){if(typeof e=="string")return Qw(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Qw(e,t)}}function YZ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function JZ(e){if(Array.isArray(e))return Qw(e)}function Qw(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(n){ck(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),ck(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},cu=function(t,r){var n=QZ(t);r&&(n=[n.reduce(function(i,s){return[].concat(lk(i),lk(s))},[])]);var a=n.map(function(i){return i.reduce(function(s,u,d){return"".concat(s).concat(d===0?"M":"L").concat(u.x,",").concat(u.y)},"")}).join("");return n.length===1?"".concat(a,"Z"):a},ZZ=function(t,r,n){var a=cu(t,n);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(cu(r.reverse(),n).slice(1))},eee=function(t){var r=t.points,n=t.className,a=t.baseLinePoints,i=t.connectNulls,s=WZ(t,HZ);if(!r||!r.length)return null;var u=nt("recharts-polygon",n);if(a&&a.length){var d=s.stroke&&s.stroke!=="none",c=ZZ(r,a,i);return q.createElement("g",{className:u},q.createElement("path",Gs({},qe(s,!0),{fill:c.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:c})),d?q.createElement("path",Gs({},qe(s,!0),{fill:"none",d:cu(r,i)})):null,d?q.createElement("path",Gs({},qe(s,!0),{fill:"none",d:cu(a,i)})):null)}var h=cu(r,i);return q.createElement("path",Gs({},qe(s,!0),{fill:h.slice(-1)==="Z"?s.fill:"none",className:u,d:h}))};function Zw(){return Zw=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function see(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var lee=function(t,r,n,a,i,s){return"M".concat(t,",").concat(i,"v").concat(a,"M").concat(s,",").concat(r,"h").concat(n)},cee=function(t){var r=t.x,n=r===void 0?0:r,a=t.y,i=a===void 0?0:a,s=t.top,u=s===void 0?0:s,d=t.left,c=d===void 0?0:d,h=t.width,p=h===void 0?0:h,m=t.height,v=m===void 0?0:m,x=t.className,y=oee(t,tee),w=ree({x:n,y:i,top:u,left:c,width:p,height:v},y);return!_e(n)||!_e(i)||!_e(p)||!_e(v)||!_e(u)||!_e(c)?null:q.createElement("path",eS({},qe(w,!0),{className:nt("recharts-cross",x),d:lee(n,i,p,v,u,c)}))},i1,dk;function uee(){if(dk)return i1;dk=1;var e=Bm(),t=WL(),r=Ua();function n(a,i){return a&&a.length?e(a,r(i,2),t):void 0}return i1=n,i1}var dee=uee();const fee=ht(dee);var o1,fk;function hee(){if(fk)return o1;fk=1;var e=Bm(),t=Ua(),r=GL();function n(a,i){return a&&a.length?e(a,t(i,2),r):void 0}return o1=n,o1}var pee=hee();const mee=ht(pee);var gee=["cx","cy","angle","ticks","axisLine"],vee=["ticks","tick","angle","tickFormatter","stroke"];function xl(e){"@babel/helpers - typeof";return xl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xl(e)}function uu(){return uu=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function yee(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function xee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mk(e,t){for(var r=0;ryk?s=a==="outer"?"start":"end":i<-yk?s=a==="outer"?"end":"start":s="middle",s}},{key:"renderAxisLine",value:function(){var n=this.props,a=n.cx,i=n.cy,s=n.radius,u=n.axisLine,d=n.axisLineType,c=Ao(Ao({},qe(this.props,!1)),{},{fill:"none"},qe(u,!1));if(d==="circle")return q.createElement(Vm,Mo({className:"recharts-polar-angle-axis-line"},c,{cx:a,cy:i,r:s}));var h=this.props.ticks,p=h.map(function(m){return Rt(a,i,s,m.coordinate)});return q.createElement(eee,Mo({className:"recharts-polar-angle-axis-line"},c,{points:p}))}},{key:"renderTicks",value:function(){var n=this,a=this.props,i=a.ticks,s=a.tick,u=a.tickLine,d=a.tickFormatter,c=a.stroke,h=qe(this.props,!1),p=qe(s,!1),m=Ao(Ao({},h),{},{fill:"none"},qe(u,!1)),v=i.map(function(x,y){var w=n.getTickLineCoord(x),j=n.getTickTextAnchor(x),_=Ao(Ao(Ao({textAnchor:j},h),{},{stroke:"none",fill:c},p),{},{index:y,payload:x,x:w.x2,y:w.y2});return q.createElement(dt,Mo({className:nt("recharts-polar-angle-axis-tick",w$(s)),key:"tick-".concat(x.coordinate)},Uo(n.props,x,y)),u&&q.createElement("line",Mo({className:"recharts-polar-angle-axis-tick-line"},m,w)),s&&t.renderTickItem(s,_,d?d(x.value,y):x.value))});return q.createElement(dt,{className:"recharts-polar-angle-axis-ticks"},v)}},{key:"render",value:function(){var n=this.props,a=n.ticks,i=n.radius,s=n.axisLine;return i<=0||!a||!a.length?null:q.createElement(dt,{className:nt("recharts-polar-angle-axis",this.props.className)},s&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,a,i){var s;return q.isValidElement(n)?s=q.cloneElement(n,a):Ye(n)?s=n(a):s=q.createElement(Vo,Mo({},a,{className:"recharts-polar-angle-axis-tick-value"}),i),s}}])})(b.PureComponent);Gm(Km,"displayName","PolarAngleAxis");Gm(Km,"axisType","angleAxis");Gm(Km,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var s1,xk;function Iee(){if(xk)return s1;xk=1;var e=WD(),t=e(Object.getPrototypeOf,Object);return s1=t,s1}var l1,bk;function Mee(){if(bk)return l1;bk=1;var e=Si(),t=Iee(),r=ji(),n="[object Object]",a=Function.prototype,i=Object.prototype,s=a.toString,u=i.hasOwnProperty,d=s.call(Object);function c(h){if(!r(h)||e(h)!=n)return!1;var p=t(h);if(p===null)return!0;var m=u.call(p,"constructor")&&p.constructor;return typeof m=="function"&&m instanceof m&&s.call(m)==d}return l1=c,l1}var Dee=Mee();const Lee=ht(Dee);var c1,wk;function $ee(){if(wk)return c1;wk=1;var e=Si(),t=ji(),r="[object Boolean]";function n(a){return a===!0||a===!1||t(a)&&e(a)==r}return c1=n,c1}var Bee=$ee();const Fee=ht(Bee);function Fu(e){"@babel/helpers - typeof";return Fu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fu(e)}function Up(){return Up=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0,from:{upperWidth:0,lowerWidth:0,height:m,x:d,y:c},to:{upperWidth:h,lowerWidth:p,height:m,x:d,y:c},duration:y,animationEasing:x,isActive:j},function(C){var A=C.upperWidth,E=C.lowerWidth,O=C.height,T=C.x,k=C.y;return q.createElement($a,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:w,duration:y,easing:x},q.createElement("path",Up({},qe(r,!0),{className:_,d:_k(T,k,A,E,O),ref:n})))}):q.createElement("g",null,q.createElement("path",Up({},qe(r,!0),{className:_,d:_k(d,c,h,p,m)})))},Jee=["option","shapeType","propTransformer","activeClassName","isActive"];function zu(e){"@babel/helpers - typeof";return zu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zu(e)}function Qee(e,t){if(e==null)return{};var r=Zee(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Zee(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Ck(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Vp(e){for(var t=1;t0?Sn(C,"paddingAngle",0):0;if(E){var T=yn(E.endAngle-E.startAngle,C.endAngle-C.startAngle),k=Tt(Tt({},C),{},{startAngle:_+O,endAngle:_+T(y)+O});w.push(k),_=k.endAngle}else{var M=C.endAngle,$=C.startAngle,z=yn(0,M-$),F=z(y),V=Tt(Tt({},C),{},{startAngle:_+O,endAngle:_+F+O});w.push(V),_=V.endAngle}}),q.createElement(dt,null,n.renderSectorsStatically(w))})}},{key:"attachKeyboardHandlers",value:function(n){var a=this;n.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var s=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[s].focus(),a.setState({sectorToFocus:s});break}case"ArrowRight":{var u=--a.state.sectorToFocus<0?a.sectorRefs.length-1:a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[u].focus(),a.setState({sectorToFocus:u});break}case"Escape":{a.sectorRefs[a.state.sectorToFocus].blur(),a.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,a=n.sectors,i=n.isAnimationActive,s=this.state.prevSectors;return i&&a&&a.length&&(!s||!ld(s,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,a=this.props,i=a.hide,s=a.sectors,u=a.className,d=a.label,c=a.cx,h=a.cy,p=a.innerRadius,m=a.outerRadius,v=a.isAnimationActive,x=this.state.isAnimationFinished;if(i||!s||!s.length||!_e(c)||!_e(h)||!_e(p)||!_e(m))return null;var y=nt("recharts-pie",u);return q.createElement(dt,{tabIndex:this.props.rootTabIndex,className:y,ref:function(j){n.pieRef=j}},this.renderSectors(),d&&this.renderLabels(s),yr.renderCallByParent(this.props,null,!1),(!v||x)&&ui.renderCallByParent(this.props,s,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,a){return a.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==a.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:n.sectors!==a.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,a){return n>a?"start":n=360?_:_-1)*d,A=w-_*v-C,E=a.reduce(function(k,M){var $=ur(M,j,0);return k+(_e($)?$:0)},0),O;if(E>0){var T;O=a.map(function(k,M){var $=ur(k,j,0),z=ur(k,h,M),F=(_e($)?$:0)/E,V;M?V=T.endAngle+zr(y)*d*($!==0?1:0):V=s;var G=V+zr(y)*(($!==0?v:0)+F*A),U=(V+G)/2,H=(x.innerRadius+x.outerRadius)/2,W=[{name:z,value:$,payload:k,dataKey:j,type:m}],B=Rt(x.cx,x.cy,H,U);return T=Tt(Tt(Tt({percent:F,cornerRadius:i,name:z,tooltipPayload:W,midAngle:U,middleRadius:H,tooltipPosition:B},k),x),{},{value:ur(k,j),startAngle:V,endAngle:G,payload:k,paddingAngle:zr(y)*d}),T})}return Tt(Tt({},x),{},{sectors:O,data:a})});var u1,Ak;function bte(){if(Ak)return u1;Ak=1;var e=Math.ceil,t=Math.max;function r(n,a,i,s){for(var u=-1,d=t(e((a-n)/(i||1)),0),c=Array(d);d--;)c[s?d:++u]=n,n+=i;return c}return u1=r,u1}var d1,Tk;function B$(){if(Tk)return d1;Tk=1;var e=lL(),t=1/0,r=17976931348623157e292;function n(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var i=a<0?-1:1;return i*r}return a===a?a:0}return d1=n,d1}var f1,kk;function wte(){if(kk)return f1;kk=1;var e=bte(),t=Tm(),r=B$();function n(a){return function(i,s,u){return u&&typeof u!="number"&&t(i,s,u)&&(s=u=void 0),i=r(i),s===void 0?(s=i,i=0):s=r(s),u=u===void 0?i0&&n.handleDrag(a.changedTouches[0])}),pn(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=n.props,i=a.endIndex,s=a.onDragEnd,u=a.startIndex;s?.({endIndex:i,startIndex:u})}),n.detachDragEndListener()}),pn(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),pn(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),pn(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),pn(n,"handleSlideDragStart",function(a){var i=$k(a)?a.changedTouches[0]:a;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return Rte(t,e),Pte(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var a=n.startX,i=n.endX,s=this.state.scaleValues,u=this.props,d=u.gap,c=u.data,h=c.length-1,p=Math.min(a,i),m=Math.max(a,i),v=t.getIndexInRange(s,p),x=t.getIndexInRange(s,m);return{startIndex:v-v%d,endIndex:x===h?h:x-x%d}}},{key:"getTextOfTick",value:function(n){var a=this.props,i=a.data,s=a.tickFormatter,u=a.dataKey,d=ur(i[n],u,n);return Ye(s)?s(d,n):d}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var a=this.state,i=a.slideMoveStartX,s=a.startX,u=a.endX,d=this.props,c=d.x,h=d.width,p=d.travellerWidth,m=d.startIndex,v=d.endIndex,x=d.onChange,y=n.pageX-i;y>0?y=Math.min(y,c+h-p-u,c+h-p-s):y<0&&(y=Math.max(y,c-s,c-u));var w=this.getIndex({startX:s+y,endX:u+y});(w.startIndex!==m||w.endIndex!==v)&&x&&x(w),this.setState({startX:s+y,endX:u+y,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,a){var i=$k(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var a=this.state,i=a.brushMoveStartX,s=a.movingTravellerId,u=a.endX,d=a.startX,c=this.state[s],h=this.props,p=h.x,m=h.width,v=h.travellerWidth,x=h.onChange,y=h.gap,w=h.data,j={startX:this.state.startX,endX:this.state.endX},_=n.pageX-i;_>0?_=Math.min(_,p+m-v-c):_<0&&(_=Math.max(_,p-c)),j[s]=c+_;var C=this.getIndex(j),A=C.startIndex,E=C.endIndex,O=function(){var k=w.length-1;return s==="startX"&&(u>d?A%y===0:E%y===0)||ud?E%y===0:A%y===0)||u>d&&E===k};this.setState(pn(pn({},s,c+_),"brushMoveStartX",n.pageX),function(){x&&O()&&x(C)})}},{key:"handleTravellerMoveKeyboard",value:function(n,a){var i=this,s=this.state,u=s.scaleValues,d=s.startX,c=s.endX,h=this.state[a],p=u.indexOf(h);if(p!==-1){var m=p+n;if(!(m===-1||m>=u.length)){var v=u[m];a==="startX"&&v>=c||a==="endX"&&v<=d||this.setState(pn({},a,v),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,a=n.x,i=n.y,s=n.width,u=n.height,d=n.fill,c=n.stroke;return q.createElement("rect",{stroke:c,fill:d,x:a,y:i,width:s,height:u})}},{key:"renderPanorama",value:function(){var n=this.props,a=n.x,i=n.y,s=n.width,u=n.height,d=n.data,c=n.children,h=n.padding,p=b.Children.only(c);return p?q.cloneElement(p,{x:a,y:i,width:s,height:u,margin:h,compact:!0,data:d}):null}},{key:"renderTravellerLayer",value:function(n,a){var i,s,u=this,d=this.props,c=d.y,h=d.travellerWidth,p=d.height,m=d.traveller,v=d.ariaLabel,x=d.data,y=d.startIndex,w=d.endIndex,j=Math.max(n,this.props.x),_=p1(p1({},qe(this.props,!1)),{},{x:j,y:c,width:h,height:p}),C=v||"Min value: ".concat((i=x[y])===null||i===void 0?void 0:i.name,", Max value: ").concat((s=x[w])===null||s===void 0?void 0:s.name);return q.createElement(dt,{tabIndex:0,role:"slider","aria-label":C,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(E){["ArrowLeft","ArrowRight"].includes(E.key)&&(E.preventDefault(),E.stopPropagation(),u.handleTravellerMoveKeyboard(E.key==="ArrowRight"?1:-1,a))},onFocus:function(){u.setState({isTravellerFocused:!0})},onBlur:function(){u.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(m,_))}},{key:"renderSlide",value:function(n,a){var i=this.props,s=i.y,u=i.height,d=i.stroke,c=i.travellerWidth,h=Math.min(n,a)+c,p=Math.max(Math.abs(a-n)-c,0);return q.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:d,fillOpacity:.2,x:h,y:s,width:p,height:u})}},{key:"renderText",value:function(){var n=this.props,a=n.startIndex,i=n.endIndex,s=n.y,u=n.height,d=n.travellerWidth,c=n.stroke,h=this.state,p=h.startX,m=h.endX,v=5,x={pointerEvents:"none",fill:c};return q.createElement(dt,{className:"recharts-brush-texts"},q.createElement(Vo,Gp({textAnchor:"end",verticalAnchor:"middle",x:Math.min(p,m)-v,y:s+u/2},x),this.getTextOfTick(a)),q.createElement(Vo,Gp({textAnchor:"start",verticalAnchor:"middle",x:Math.max(p,m)+d+v,y:s+u/2},x),this.getTextOfTick(i)))}},{key:"render",value:function(){var n=this.props,a=n.data,i=n.className,s=n.children,u=n.x,d=n.y,c=n.width,h=n.height,p=n.alwaysShowText,m=this.state,v=m.startX,x=m.endX,y=m.isTextActive,w=m.isSlideMoving,j=m.isTravellerMoving,_=m.isTravellerFocused;if(!a||!a.length||!_e(u)||!_e(d)||!_e(c)||!_e(h)||c<=0||h<=0)return null;var C=nt("recharts-brush",i),A=q.Children.count(s)===1,E=Ete("userSelect","none");return q.createElement(dt,{className:C,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:E},this.renderBackground(),A&&this.renderPanorama(),this.renderSlide(v,x),this.renderTravellerLayer(v,"startX"),this.renderTravellerLayer(x,"endX"),(y||w||j||_||p)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var a=n.x,i=n.y,s=n.width,u=n.height,d=n.stroke,c=Math.floor(i+u/2)-1;return q.createElement(q.Fragment,null,q.createElement("rect",{x:a,y:i,width:s,height:u,fill:d,stroke:"none"}),q.createElement("line",{x1:a+1,y1:c,x2:a+s-1,y2:c,fill:"none",stroke:"#fff"}),q.createElement("line",{x1:a+1,y1:c+2,x2:a+s-1,y2:c+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,a){var i;return q.isValidElement(n)?i=q.cloneElement(n,a):Ye(n)?i=n(a):i=t.renderDefaultTraveller(a),i}},{key:"getDerivedStateFromProps",value:function(n,a){var i=n.data,s=n.width,u=n.x,d=n.travellerWidth,c=n.updateId,h=n.startIndex,p=n.endIndex;if(i!==a.prevData||c!==a.prevUpdateId)return p1({prevData:i,prevTravellerWidth:d,prevUpdateId:c,prevX:u,prevWidth:s},i&&i.length?Mte({data:i,width:s,x:u,travellerWidth:d,startIndex:h,endIndex:p}):{scale:null,scaleValues:null});if(a.scale&&(s!==a.prevWidth||u!==a.prevX||d!==a.prevTravellerWidth)){a.scale.range([u,u+s-d]);var m=a.scale.domain().map(function(v){return a.scale(v)});return{prevData:i,prevTravellerWidth:d,prevUpdateId:c,prevX:u,prevWidth:s,startX:a.scale(n.startIndex),endX:a.scale(n.endIndex),scaleValues:m}}return null}},{key:"getIndexInRange",value:function(n,a){for(var i=n.length,s=0,u=i-1;u-s>1;){var d=Math.floor((s+u)/2);n[d]>a?u=d:s=d}return a>=n[u]?u:s}}])})(b.PureComponent);pn(jl,"displayName","Brush");pn(jl,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var m1,Bk;function Dte(){if(Bk)return m1;Bk=1;var e=xj();function t(r,n){var a;return e(r,function(i,s,u){return a=n(i,s,u),!a}),!!a}return m1=t,m1}var g1,Fk;function Lte(){if(Fk)return g1;Fk=1;var e=BD(),t=Ua(),r=Dte(),n=rn(),a=Tm();function i(s,u,d){var c=n(s)?e:r;return d&&a(s,u,d)&&(u=void 0),c(s,t(u,3))}return g1=i,g1}var $te=Lte();const Bte=ht($te);var Ma=function(t,r){var n=t.alwaysShow,a=t.ifOverflow;return n&&(a="extendDomain"),a===r},v1,zk;function Fte(){if(zk)return v1;zk=1;var e=nL();function t(r,n,a){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):r[n]=a}return v1=t,v1}var y1,qk;function zte(){if(qk)return y1;qk=1;var e=Fte(),t=tL(),r=Ua();function n(a,i){var s={};return i=r(i,3),t(a,function(u,d,c){e(s,d,i(u,d,c))}),s}return y1=n,y1}var qte=zte();const Ute=ht(qte);var x1,Uk;function Vte(){if(Uk)return x1;Uk=1;function e(t,r){for(var n=-1,a=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Zte(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ere(e,t){var r=e.x,n=e.y,a=Qte(e,Kte),i="".concat(r),s=parseInt(i,10),u="".concat(n),d=parseInt(u,10),c="".concat(t.height||a.height),h=parseInt(c,10),p="".concat(t.width||a.width),m=parseInt(p,10);return Gc(Gc(Gc(Gc(Gc({},t),a),s?{x:s}:{}),d?{y:d}:{}),{},{height:h,width:m,name:t.name,radius:t.radius})}function Gk(e){return q.createElement(D$,iS({shapeType:"rectangle",propTransformer:ere,activeClassName:"recharts-active-bar"},e))}var tre=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,a){if(typeof t=="number")return t;var i=_e(n)||w9(n);return i?t(n,a):(i||Wo(),r)}},rre=["value","background"],V$;function Nl(e){"@babel/helpers - typeof";return Nl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nl(e)}function nre(e,t){if(e==null)return{};var r=are(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function are(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Xp(){return Xp=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(U)0&&Math.abs(G)0&&(V=Math.min((ee||0)-(G[ie-1]||0),V))}),Number.isFinite(V)){var U=V/F,H=y.layout==="vertical"?n.height:n.width;if(y.padding==="gap"&&(T=U*H/2),y.padding==="no-gap"){var W=qr(t.barCategoryGap,U*H),B=U*H/2;T=B-W-(B-W)/H*W}}}a==="xAxis"?k=[n.left+(C.left||0)+(T||0),n.left+n.width-(C.right||0)-(T||0)]:a==="yAxis"?k=d==="horizontal"?[n.top+n.height-(C.bottom||0),n.top+(C.top||0)]:[n.top+(C.top||0)+(T||0),n.top+n.height-(C.bottom||0)-(T||0)]:k=y.range,E&&(k=[k[1],k[0]]);var Q=p$(y,i,m),R=Q.scale,L=Q.realScaleType;R.domain(j).range(k),m$(R);var I=g$(R,ca(ca({},y),{},{realScaleType:L}));a==="xAxis"?(z=w==="top"&&!A||w==="bottom"&&A,M=n.left,$=p[O]-z*y.height):a==="yAxis"&&(z=w==="left"&&!A||w==="right"&&A,M=p[O]-z*y.width,$=n.top);var X=ca(ca(ca({},y),I),{},{realScaleType:L,x:M,y:$,scale:R,width:a==="xAxis"?n.width:y.width,height:a==="yAxis"?n.height:y.height});return X.bandSize=kp(X,I),!y.hide&&a==="xAxis"?p[O]+=(z?-1:1)*X.height:y.hide||(p[O]+=(z?-1:1)*X.width),ca(ca({},v),{},Jm({},x,X))},{})},X$=function(t,r){var n=t.x,a=t.y,i=r.x,s=r.y;return{x:Math.min(n,i),y:Math.min(a,s),width:Math.abs(i-n),height:Math.abs(s-a)}},mre=function(t){var r=t.x1,n=t.y1,a=t.x2,i=t.y2;return X$({x:r,y:n},{x:a,y:i})},Y$=(function(){function e(t){fre(this,e),this.scale=t}return hre(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.bandAware,i=n.position;if(r!==void 0){if(i)switch(i){case"start":return this.scale(r);case"middle":{var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+s}case"end":{var u=this.bandwidth?this.bandwidth():0;return this.scale(r)+u}default:return this.scale(r)}if(a){var d=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+d}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),a=n[0],i=n[n.length-1];return a<=i?r>=a&&r<=i:r>=i&&r<=a}}],[{key:"create",value:function(r){return new e(r)}}])})();Jm(Y$,"EPS",1e-4);var Kj=function(t){var r=Object.keys(t).reduce(function(n,a){return ca(ca({},n),{},Jm({},a,Y$.create(t[a])))},{});return ca(ca({},r),{},{apply:function(a){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=i.bandAware,u=i.position;return Ute(a,function(d,c){return r[c].apply(d,{bandAware:s,position:u})})},isInRange:function(a){return U$(a,function(i,s){return r[s].isInRange(i)})}})};function gre(e){return(e%180+180)%180}var vre=function(t){var r=t.width,n=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=gre(a),s=i*Math.PI/180,u=Math.atan(n/r),d=s>u&&s-1?d[c?i[h]:h]:void 0}}return S1=n,S1}var j1,Zk;function xre(){if(Zk)return j1;Zk=1;var e=B$();function t(r){var n=e(r),a=n%1;return n===n?a?n-a:n:0}return j1=t,j1}var N1,eR;function bre(){if(eR)return N1;eR=1;var e=YD(),t=Ua(),r=xre(),n=Math.max;function a(i,s,u){var d=i==null?0:i.length;if(!d)return-1;var c=u==null?0:r(u);return c<0&&(c=n(d+c,0)),e(i,t(s,3),c)}return N1=a,N1}var _1,tR;function wre(){if(tR)return _1;tR=1;var e=yre(),t=bre(),r=e(t);return _1=r,_1}var Sre=wre();const jre=ht(Sre);var Nre=fD();const _re=ht(Nre);var Cre=_re(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),Xj=b.createContext(void 0),Yj=b.createContext(void 0),J$=b.createContext(void 0),Q$=b.createContext({}),Z$=b.createContext(void 0),e4=b.createContext(0),t4=b.createContext(0),rR=function(t){var r=t.state,n=r.xAxisMap,a=r.yAxisMap,i=r.offset,s=t.clipPathId,u=t.children,d=t.width,c=t.height,h=Cre(i);return q.createElement(Xj.Provider,{value:n},q.createElement(Yj.Provider,{value:a},q.createElement(Q$.Provider,{value:i},q.createElement(J$.Provider,{value:h},q.createElement(Z$.Provider,{value:s},q.createElement(e4.Provider,{value:c},q.createElement(t4.Provider,{value:d},u)))))))},Ere=function(){return b.useContext(Z$)},r4=function(t){var r=b.useContext(Xj);r==null&&Wo();var n=r[t];return n==null&&Wo(),n},Ore=function(){var t=b.useContext(Xj);return Qi(t)},Pre=function(){var t=b.useContext(Yj),r=jre(t,function(n){return U$(n.domain,Number.isFinite)});return r||Qi(t)},n4=function(t){var r=b.useContext(Yj);r==null&&Wo();var n=r[t];return n==null&&Wo(),n},Are=function(){var t=b.useContext(J$);return t},Tre=function(){return b.useContext(Q$)},Jj=function(){return b.useContext(t4)},Qj=function(){return b.useContext(e4)};function _l(e){"@babel/helpers - typeof";return _l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_l(e)}function kre(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rre(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);re*a)return!1;var i=r();return e*(t-e*i/2-n)>=0&&e*(t+e*i/2-a)<=0}function pne(e,t){return u4(e,t+1)}function mne(e,t,r,n,a){for(var i=(n||[]).slice(),s=t.start,u=t.end,d=0,c=1,h=s,p=function(){var x=n?.[d];if(x===void 0)return{v:u4(n,c)};var y=d,w,j=function(){return w===void 0&&(w=r(x,y)),w},_=x.coordinate,C=d===0||em(e,_,j,h,u);C||(d=0,h=s,c+=1),C&&(h=_+e*(j()/2+a),d+=c)},m;c<=i.length;)if(m=p(),m)return m.v;return[]}function Wu(e){"@babel/helpers - typeof";return Wu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wu(e)}function uR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ar(e){for(var t=1;t0?v.coordinate-w*e:v.coordinate})}else i[m]=v=Ar(Ar({},v),{},{tickCoord:v.coordinate});var j=em(e,v.tickCoord,y,u,d);j&&(d=v.tickCoord-e*(y()/2+a),i[m]=Ar(Ar({},v),{},{isShow:!0}))},h=s-1;h>=0;h--)c(h);return i}function bne(e,t,r,n,a,i){var s=(n||[]).slice(),u=s.length,d=t.start,c=t.end;if(i){var h=n[u-1],p=r(h,u-1),m=e*(h.coordinate+e*p/2-c);s[u-1]=h=Ar(Ar({},h),{},{tickCoord:m>0?h.coordinate-m*e:h.coordinate});var v=em(e,h.tickCoord,function(){return p},d,c);v&&(c=h.tickCoord-e*(p/2+a),s[u-1]=Ar(Ar({},h),{},{isShow:!0}))}for(var x=i?u-1:u,y=function(_){var C=s[_],A,E=function(){return A===void 0&&(A=r(C,_)),A};if(_===0){var O=e*(C.coordinate-e*E()/2-d);s[_]=C=Ar(Ar({},C),{},{tickCoord:O<0?C.coordinate-O*e:C.coordinate})}else s[_]=C=Ar(Ar({},C),{},{tickCoord:C.coordinate});var T=em(e,C.tickCoord,E,d,c);T&&(d=C.tickCoord+e*(E()/2+a),s[_]=Ar(Ar({},C),{},{isShow:!0}))},w=0;w=2?zr(a[1].coordinate-a[0].coordinate):1,j=hne(i,w,v);return d==="equidistantPreserveStart"?mne(w,j,y,a,s):(d==="preserveStart"||d==="preserveStartEnd"?m=bne(w,j,y,a,s,d==="preserveStartEnd"):m=xne(w,j,y,a,s),m.filter(function(_){return _.isShow}))}var wne=["viewBox"],Sne=["viewBox"],jne=["ticks"];function Ol(e){"@babel/helpers - typeof";return Ol=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ol(e)}function Xs(){return Xs=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Nne(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function _ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fR(e,t){for(var r=0;r0?d(this.props):d(v)),s<=0||u<=0||!x||!x.length?null:q.createElement(dt,{className:nt("recharts-cartesian-axis",c),ref:function(w){n.layerReference=w}},i&&this.renderAxisLine(),this.renderTicks(x,this.state.fontSize,this.state.letterSpacing),yr.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,a,i){var s,u=nt(a.className,"recharts-cartesian-axis-tick-value");return q.isValidElement(n)?s=q.cloneElement(n,lr(lr({},a),{},{className:u})):Ye(n)?s=n(lr(lr({},a),{},{className:u})):s=q.createElement(Vo,Xs({},a,{className:"recharts-cartesian-axis-tick-value"}),i),s}}])})(b.Component);rN(Xl,"displayName","CartesianAxis");rN(Xl,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var kne=["x1","y1","x2","y2","key"],Rne=["offset"];function Go(e){"@babel/helpers - typeof";return Go=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Go(e)}function hR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Tr(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Lne(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var $ne=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,a=t.x,i=t.y,s=t.width,u=t.height,d=t.ry;return q.createElement("rect",{x:a,y:i,ry:d,width:s,height:u,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function h4(e,t){var r;if(q.isValidElement(e))r=q.cloneElement(e,t);else if(Ye(e))r=e(t);else{var n=t.x1,a=t.y1,i=t.x2,s=t.y2,u=t.key,d=pR(t,kne),c=qe(d,!1);c.offset;var h=pR(c,Rne);r=q.createElement("line",Bo({},h,{x1:n,y1:a,x2:i,y2:s,fill:"none",key:u}))}return r}function Bne(e){var t=e.x,r=e.width,n=e.horizontal,a=n===void 0?!0:n,i=e.horizontalPoints;if(!a||!i||!i.length)return null;var s=i.map(function(u,d){var c=Tr(Tr({},e),{},{x1:t,y1:u,x2:t+r,y2:u,key:"line-".concat(d),index:d});return h4(a,c)});return q.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function Fne(e){var t=e.y,r=e.height,n=e.vertical,a=n===void 0?!0:n,i=e.verticalPoints;if(!a||!i||!i.length)return null;var s=i.map(function(u,d){var c=Tr(Tr({},e),{},{x1:u,y1:t,x2:u,y2:t+r,key:"line-".concat(d),index:d});return h4(a,c)});return q.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function zne(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,a=e.y,i=e.width,s=e.height,u=e.horizontalPoints,d=e.horizontal,c=d===void 0?!0:d;if(!c||!t||!t.length)return null;var h=u.map(function(m){return Math.round(m+a-a)}).sort(function(m,v){return m-v});a!==h[0]&&h.unshift(0);var p=h.map(function(m,v){var x=!h[v+1],y=x?a+s-m:h[v+1]-m;if(y<=0)return null;var w=v%t.length;return q.createElement("rect",{key:"react-".concat(v),y:m,x:n,height:y,width:i,stroke:"none",fill:t[w],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return q.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},p)}function qne(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,a=e.fillOpacity,i=e.x,s=e.y,u=e.width,d=e.height,c=e.verticalPoints;if(!r||!n||!n.length)return null;var h=c.map(function(m){return Math.round(m+i-i)}).sort(function(m,v){return m-v});i!==h[0]&&h.unshift(0);var p=h.map(function(m,v){var x=!h[v+1],y=x?i+u-m:h[v+1]-m;if(y<=0)return null;var w=v%n.length;return q.createElement("rect",{key:"react-".concat(v),x:m,y:s,width:y,height:d,stroke:"none",fill:n[w],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return q.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},p)}var Une=function(t,r){var n=t.xAxis,a=t.width,i=t.height,s=t.offset;return h$(tN(Tr(Tr(Tr({},Xl.defaultProps),n),{},{ticks:si(n,!0),viewBox:{x:0,y:0,width:a,height:i}})),s.left,s.left+s.width,r)},Vne=function(t,r){var n=t.yAxis,a=t.width,i=t.height,s=t.offset;return h$(tN(Tr(Tr(Tr({},Xl.defaultProps),n),{},{ticks:si(n,!0),viewBox:{x:0,y:0,width:a,height:i}})),s.top,s.top+s.height,r)},Is={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function rm(e){var t,r,n,a,i,s,u=Jj(),d=Qj(),c=Tre(),h=Tr(Tr({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:Is.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:Is.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:Is.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:Is.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:Is.vertical,verticalFill:(s=e.verticalFill)!==null&&s!==void 0?s:Is.verticalFill,x:_e(e.x)?e.x:c.left,y:_e(e.y)?e.y:c.top,width:_e(e.width)?e.width:c.width,height:_e(e.height)?e.height:c.height}),p=h.x,m=h.y,v=h.width,x=h.height,y=h.syncWithTicks,w=h.horizontalValues,j=h.verticalValues,_=Ore(),C=Pre();if(!_e(v)||v<=0||!_e(x)||x<=0||!_e(p)||p!==+p||!_e(m)||m!==+m)return null;var A=h.verticalCoordinatesGenerator||Une,E=h.horizontalCoordinatesGenerator||Vne,O=h.horizontalPoints,T=h.verticalPoints;if((!O||!O.length)&&Ye(E)){var k=w&&w.length,M=E({yAxis:C?Tr(Tr({},C),{},{ticks:k?w:C.ticks}):void 0,width:u,height:d,offset:c},k?!0:y);ha(Array.isArray(M),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Go(M),"]")),Array.isArray(M)&&(O=M)}if((!T||!T.length)&&Ye(A)){var $=j&&j.length,z=A({xAxis:_?Tr(Tr({},_),{},{ticks:$?j:_.ticks}):void 0,width:u,height:d,offset:c},$?!0:y);ha(Array.isArray(z),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Go(z),"]")),Array.isArray(z)&&(T=z)}return q.createElement("g",{className:"recharts-cartesian-grid"},q.createElement($ne,{fill:h.fill,fillOpacity:h.fillOpacity,x:h.x,y:h.y,width:h.width,height:h.height,ry:h.ry}),q.createElement(Bne,Bo({},h,{offset:c,horizontalPoints:O,xAxis:_,yAxis:C})),q.createElement(Fne,Bo({},h,{offset:c,verticalPoints:T,xAxis:_,yAxis:C})),q.createElement(zne,Bo({},h,{horizontalPoints:O})),q.createElement(qne,Bo({},h,{verticalPoints:T})))}rm.displayName="CartesianGrid";var Hne=["type","layout","connectNulls","ref"],Wne=["key"];function Pl(e){"@babel/helpers - typeof";return Pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pl(e)}function mR(e,t){if(e==null)return{};var r=Gne(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Gne(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function du(){return du=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);rp){v=[].concat(Ms(d.slice(0,x)),[p-y]);break}var w=v.length%2===0?[0,m]:[m];return[].concat(Ms(t.repeat(d,h)),Ms(v),w).map(function(j){return"".concat(j,"px")}).join(", ")}),ua(r,"id",Vl("recharts-line-")),ua(r,"pathRef",function(s){r.mainCurve=s}),ua(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),ua(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return nae(t,e),Zne(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,s=i.points,u=i.xAxis,d=i.yAxis,c=i.layout,h=i.children,p=jn(h,cd);if(!p)return null;var m=function(y,w){return{x:y.x,y:y.y,value:y.value,errorVal:ur(y.payload,w)}},v={clipPath:n?"url(#clipPath-".concat(a,")"):null};return q.createElement(dt,v,p.map(function(x){return q.cloneElement(x,{key:"bar-".concat(x.props.dataKey),data:s,xAxis:u,yAxis:d,layout:c,dataPointFormatter:m})}))}},{key:"renderDots",value:function(n,a,i){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var u=this.props,d=u.dot,c=u.points,h=u.dataKey,p=qe(this.props,!1),m=qe(d,!0),v=c.map(function(y,w){var j=hn(hn(hn({key:"dot-".concat(w),r:3},p),m),{},{index:w,cx:y.x,cy:y.y,value:y.value,dataKey:h,payload:y.payload,points:c});return t.renderDotItem(d,j)}),x={clipPath:n?"url(#clipPath-".concat(a?"":"dots-").concat(i,")"):null};return q.createElement(dt,du({className:"recharts-line-dots",key:"dots"},x),v)}},{key:"renderCurveStatically",value:function(n,a,i,s){var u=this.props,d=u.type,c=u.layout,h=u.connectNulls;u.ref;var p=mR(u,Hne),m=hn(hn(hn({},qe(p,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:a?"url(#clipPath-".concat(i,")"):null,points:n},s),{},{type:d,layout:c,connectNulls:h});return q.createElement(Mp,du({},m,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,a){var i=this,s=this.props,u=s.points,d=s.strokeDasharray,c=s.isAnimationActive,h=s.animationBegin,p=s.animationDuration,m=s.animationEasing,v=s.animationId,x=s.animateNewValues,y=s.width,w=s.height,j=this.state,_=j.prevPoints,C=j.totalLength;return q.createElement($a,{begin:h,duration:p,isActive:c,easing:m,from:{t:0},to:{t:1},key:"line-".concat(v),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(A){var E=A.t;if(_){var O=_.length/u.length,T=u.map(function(F,V){var G=Math.floor(V*O);if(_[G]){var U=_[G],H=yn(U.x,F.x),W=yn(U.y,F.y);return hn(hn({},F),{},{x:H(E),y:W(E)})}if(x){var B=yn(y*2,F.x),Q=yn(w/2,F.y);return hn(hn({},F),{},{x:B(E),y:Q(E)})}return hn(hn({},F),{},{x:F.x,y:F.y})});return i.renderCurveStatically(T,n,a)}var k=yn(0,C),M=k(E),$;if(d){var z="".concat(d).split(/[,\s]+/gim).map(function(F){return parseFloat(F)});$=i.getStrokeDasharray(M,C,z)}else $=i.generateSimpleStrokeDasharray(C,M);return i.renderCurveStatically(u,n,a,{strokeDasharray:$})})}},{key:"renderCurve",value:function(n,a){var i=this.props,s=i.points,u=i.isAnimationActive,d=this.state,c=d.prevPoints,h=d.totalLength;return u&&s&&s.length&&(!c&&h>0||!ld(c,s))?this.renderCurveWithAnimation(n,a):this.renderCurveStatically(s,n,a)}},{key:"render",value:function(){var n,a=this.props,i=a.hide,s=a.dot,u=a.points,d=a.className,c=a.xAxis,h=a.yAxis,p=a.top,m=a.left,v=a.width,x=a.height,y=a.isAnimationActive,w=a.id;if(i||!u||!u.length)return null;var j=this.state.isAnimationFinished,_=u.length===1,C=nt("recharts-line",d),A=c&&c.allowDataOverflow,E=h&&h.allowDataOverflow,O=A||E,T=rt(w)?this.id:w,k=(n=qe(s,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},M=k.r,$=M===void 0?3:M,z=k.strokeWidth,F=z===void 0?2:z,V=R9(s)?s:{},G=V.clipDot,U=G===void 0?!0:G,H=$*2+F;return q.createElement(dt,{className:C},A||E?q.createElement("defs",null,q.createElement("clipPath",{id:"clipPath-".concat(T)},q.createElement("rect",{x:A?m:m-v/2,y:E?p:p-x/2,width:A?v:v*2,height:E?x:x*2})),!U&&q.createElement("clipPath",{id:"clipPath-dots-".concat(T)},q.createElement("rect",{x:m-H/2,y:p-H/2,width:v+H,height:x+H}))):null,!_&&this.renderCurve(O,T),this.renderErrorBar(O,T),(_||s)&&this.renderDots(O,U,T),(!y||j)&&ui.renderCallByParent(this.props,u))}}],[{key:"getDerivedStateFromProps",value:function(n,a){return n.animationId!==a.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:a.curPoints}:n.points!==a.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,a){for(var i=n.length%2!==0?[].concat(Ms(n),[0]):n,s=[],u=0;ue.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Gae(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Kae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xae(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?s:t&&t.length&&_e(a)&&_e(i)?t.slice(a,i+1):[]};function O4(e){return e==="number"?[0,"auto"]:void 0}var NS=function(t,r,n,a){var i=t.graphicalItems,s=t.tooltipAxis,u=rg(r,t);return n<0||!i||!i.length||n>=u.length?null:i.reduce(function(d,c){var h,p=(h=c.props.data)!==null&&h!==void 0?h:r;p&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(p=p.slice(t.dataStartIndex,t.dataEndIndex+1));var m;if(s.dataKey&&!s.allowDuplicatedCategory){var v=p===void 0?u:p;m=ip(v,s.dataKey,a)}else m=p&&p[n]||u[n];return m?[].concat(Rl(d),[y$(c,m)]):d},[])},NR=function(t,r,n,a){var i=a||{x:t.chartX,y:t.chartY},s=sie(i,n),u=t.orderedTooltipTicks,d=t.tooltipAxis,c=t.tooltipTicks,h=AY(s,u,c,d);if(h>=0&&c){var p=c[h]&&c[h].value,m=NS(t,r,h,p),v=lie(n,u,h,i);return{activeTooltipIndex:h,activeLabel:p,activePayload:m,activeCoordinate:v}}return null},cie=function(t,r){var n=r.axes,a=r.graphicalItems,i=r.axisType,s=r.axisIdKey,u=r.stackGroups,d=r.dataStartIndex,c=r.dataEndIndex,h=t.layout,p=t.children,m=t.stackOffset,v=f$(h,i);return n.reduce(function(x,y){var w,j=y.type.defaultProps!==void 0?me(me({},y.type.defaultProps),y.props):y.props,_=j.type,C=j.dataKey,A=j.allowDataOverflow,E=j.allowDuplicatedCategory,O=j.scale,T=j.ticks,k=j.includeHidden,M=j[s];if(x[M])return x;var $=rg(t.data,{graphicalItems:a.filter(function(I){var X,ee=s in I.props?I.props[s]:(X=I.type.defaultProps)===null||X===void 0?void 0:X[s];return ee===M}),dataStartIndex:d,dataEndIndex:c}),z=$.length,F,V,G;Mae(j.domain,A,_)&&(F=$w(j.domain,null,A),v&&(_==="number"||O!=="auto")&&(G=su($,C,"category")));var U=O4(_);if(!F||F.length===0){var H,W=(H=j.domain)!==null&&H!==void 0?H:U;if(C){if(F=su($,C,_),_==="category"&&v){var B=j9(F);E&&B?(V=F,F=Wp(0,z)):E||(F=CT(W,F,y).reduce(function(I,X){return I.indexOf(X)>=0?I:[].concat(Rl(I),[X])},[]))}else if(_==="category")E?F=F.filter(function(I){return I!==""&&!rt(I)}):F=CT(W,F,y).reduce(function(I,X){return I.indexOf(X)>=0||X===""||rt(X)?I:[].concat(Rl(I),[X])},[]);else if(_==="number"){var Q=MY($,a.filter(function(I){var X,ee,ie=s in I.props?I.props[s]:(X=I.type.defaultProps)===null||X===void 0?void 0:X[s],re="hide"in I.props?I.props.hide:(ee=I.type.defaultProps)===null||ee===void 0?void 0:ee.hide;return ie===M&&(k||!re)}),C,i,h);Q&&(F=Q)}v&&(_==="number"||O!=="auto")&&(G=su($,C,"category"))}else v?F=Wp(0,z):u&&u[M]&&u[M].hasStack&&_==="number"?F=m==="expand"?[0,1]:v$(u[M].stackGroups,d,c):F=d$($,a.filter(function(I){var X=s in I.props?I.props[s]:I.type.defaultProps[s],ee="hide"in I.props?I.props.hide:I.type.defaultProps.hide;return X===M&&(k||!ee)}),_,h,!0);if(_==="number")F=wS(p,F,M,i,T),W&&(F=$w(W,F,A));else if(_==="category"&&W){var R=W,L=F.every(function(I){return R.indexOf(I)>=0});L&&(F=R)}}return me(me({},x),{},Ue({},M,me(me({},j),{},{axisType:i,domain:F,categoricalDomain:G,duplicateDomain:V,originalDomain:(w=j.domain)!==null&&w!==void 0?w:U,isCategorical:v,layout:h})))},{})},uie=function(t,r){var n=r.graphicalItems,a=r.Axis,i=r.axisType,s=r.axisIdKey,u=r.stackGroups,d=r.dataStartIndex,c=r.dataEndIndex,h=t.layout,p=t.children,m=rg(t.data,{graphicalItems:n,dataStartIndex:d,dataEndIndex:c}),v=m.length,x=f$(h,i),y=-1;return n.reduce(function(w,j){var _=j.type.defaultProps!==void 0?me(me({},j.type.defaultProps),j.props):j.props,C=_[s],A=O4("number");if(!w[C]){y++;var E;return x?E=Wp(0,v):u&&u[C]&&u[C].hasStack?(E=v$(u[C].stackGroups,d,c),E=wS(p,E,C,i)):(E=$w(A,d$(m,n.filter(function(O){var T,k,M=s in O.props?O.props[s]:(T=O.type.defaultProps)===null||T===void 0?void 0:T[s],$="hide"in O.props?O.props.hide:(k=O.type.defaultProps)===null||k===void 0?void 0:k.hide;return M===C&&!$}),"number",h),a.defaultProps.allowDataOverflow),E=wS(p,E,C,i)),me(me({},w),{},Ue({},C,me(me({axisType:i},a.defaultProps),{},{hide:!0,orientation:Sn(iie,"".concat(i,".").concat(y%2),null),domain:E,originalDomain:A,isCategorical:x,layout:h})))}return w},{})},die=function(t,r){var n=r.axisType,a=n===void 0?"xAxis":n,i=r.AxisComp,s=r.graphicalItems,u=r.stackGroups,d=r.dataStartIndex,c=r.dataEndIndex,h=t.children,p="".concat(a,"Id"),m=jn(h,i),v={};return m&&m.length?v=cie(t,{axes:m,graphicalItems:s,axisType:a,axisIdKey:p,stackGroups:u,dataStartIndex:d,dataEndIndex:c}):s&&s.length&&(v=uie(t,{Axis:i,graphicalItems:s,axisType:a,axisIdKey:p,stackGroups:u,dataStartIndex:d,dataEndIndex:c})),v},fie=function(t){var r=Qi(t),n=si(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:bj(n,function(a){return a.coordinate}),tooltipAxis:r,tooltipAxisBandSize:kp(r,n)}},_R=function(t){var r=t.children,n=t.defaultShowTooltip,a=mn(r,jl),i=0,s=0;return t.data&&t.data.length!==0&&(s=t.data.length-1),a&&a.props&&(a.props.startIndex>=0&&(i=a.props.startIndex),a.props.endIndex>=0&&(s=a.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!n}},hie=function(t){return!t||!t.length?!1:t.some(function(r){var n=li(r&&r.type);return n&&n.indexOf("Bar")>=0})},CR=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},pie=function(t,r){var n=t.props,a=t.graphicalItems,i=t.xAxisMap,s=i===void 0?{}:i,u=t.yAxisMap,d=u===void 0?{}:u,c=n.width,h=n.height,p=n.children,m=n.margin||{},v=mn(p,jl),x=mn(p,Zs),y=Object.keys(d).reduce(function(E,O){var T=d[O],k=T.orientation;return!T.mirror&&!T.hide?me(me({},E),{},Ue({},k,E[k]+T.width)):E},{left:m.left||0,right:m.right||0}),w=Object.keys(s).reduce(function(E,O){var T=s[O],k=T.orientation;return!T.mirror&&!T.hide?me(me({},E),{},Ue({},k,Sn(E,"".concat(k))+T.height)):E},{top:m.top||0,bottom:m.bottom||0}),j=me(me({},w),y),_=j.bottom;v&&(j.bottom+=v.props.height||jl.defaultProps.height),x&&r&&(j=RY(j,a,n,r));var C=c-j.left-j.right,A=h-j.top-j.bottom;return me(me({brushBottom:_},j),{},{width:Math.max(C,0),height:Math.max(A,0)})},mie=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},nN=function(t){var r=t.chartName,n=t.GraphicalChild,a=t.defaultTooltipEventType,i=a===void 0?"axis":a,s=t.validateTooltipEventTypes,u=s===void 0?["axis"]:s,d=t.axisComponents,c=t.legendContent,h=t.formatAxisMap,p=t.defaultProps,m=function(j,_){var C=_.graphicalItems,A=_.stackGroups,E=_.offset,O=_.updateId,T=_.dataStartIndex,k=_.dataEndIndex,M=j.barSize,$=j.layout,z=j.barGap,F=j.barCategoryGap,V=j.maxBarSize,G=CR($),U=G.numericAxisName,H=G.cateAxisName,W=hie(C),B=[];return C.forEach(function(Q,R){var L=rg(j.data,{graphicalItems:[Q],dataStartIndex:T,dataEndIndex:k}),I=Q.type.defaultProps!==void 0?me(me({},Q.type.defaultProps),Q.props):Q.props,X=I.dataKey,ee=I.maxBarSize,ie=I["".concat(U,"Id")],re=I["".concat(H,"Id")],K={},Z=d.reduce(function(_t,ct){var nr=_["".concat(ct.axisType,"Map")],En=I["".concat(ct.axisType,"Id")];nr&&nr[En]||ct.axisType==="zAxis"||Wo();var On=nr[En];return me(me({},_t),{},Ue(Ue({},ct.axisType,On),"".concat(ct.axisType,"Ticks"),si(On)))},K),ne=Z[H],de=Z["".concat(H,"Ticks")],ge=A&&A[ie]&&A[ie].hasStack&&VY(Q,A[ie].stackGroups),Y=li(Q.type).indexOf("Bar")>=0,we=kp(ne,de),Ce=[],Be=W&&TY({barSize:M,stackGroups:A,totalSize:mie(Z,H)});if(Y){var et,tt,St=rt(ee)?V:ee,jt=(et=(tt=kp(ne,de,!0))!==null&&tt!==void 0?tt:St)!==null&&et!==void 0?et:0;Ce=kY({barGap:z,barCategoryGap:F,bandSize:jt!==we?jt:we,sizeList:Be[re],maxBarSize:St}),jt!==we&&(Ce=Ce.map(function(_t){return me(me({},_t),{},{position:me(me({},_t.position),{},{offset:_t.position.offset-jt/2})})}))}var Kt=Q&&Q.type&&Q.type.getComposedData;Kt&&B.push({props:me(me({},Kt(me(me({},Z),{},{displayedData:L,props:j,dataKey:X,item:Q,bandSize:we,barPosition:Ce,offset:E,stackedData:ge,layout:$,dataStartIndex:T,dataEndIndex:k}))),{},Ue(Ue(Ue({key:Q.key||"item-".concat(R)},U,Z[U]),H,Z[H]),"animationId",O)),childIndex:D9(Q,j.children),item:Q})}),B},v=function(j,_){var C=j.props,A=j.dataStartIndex,E=j.dataEndIndex,O=j.updateId;if(!FO({props:C}))return null;var T=C.children,k=C.layout,M=C.stackOffset,$=C.data,z=C.reverseStackOrder,F=CR(k),V=F.numericAxisName,G=F.cateAxisName,U=jn(T,n),H=qY($,U,"".concat(V,"Id"),"".concat(G,"Id"),M,z),W=d.reduce(function(I,X){var ee="".concat(X.axisType,"Map");return me(me({},I),{},Ue({},ee,die(C,me(me({},X),{},{graphicalItems:U,stackGroups:X.axisType===V&&H,dataStartIndex:A,dataEndIndex:E}))))},{}),B=pie(me(me({},W),{},{props:C,graphicalItems:U}),_?.legendBBox);Object.keys(W).forEach(function(I){W[I]=h(C,W[I],B,I.replace("Map",""),r)});var Q=W["".concat(G,"Map")],R=fie(Q),L=m(C,me(me({},W),{},{dataStartIndex:A,dataEndIndex:E,updateId:O,graphicalItems:U,stackGroups:H,offset:B}));return me(me({formattedGraphicalItems:L,graphicalItems:U,offset:B,stackGroups:H},R),W)},x=(function(w){function j(_){var C,A,E;return Kae(this,j),E=Jae(this,j,[_]),Ue(E,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Ue(E,"accessibilityManager",new Iae),Ue(E,"handleLegendBBoxUpdate",function(O){if(O){var T=E.state,k=T.dataStartIndex,M=T.dataEndIndex,$=T.updateId;E.setState(me({legendBBox:O},v({props:E.props,dataStartIndex:k,dataEndIndex:M,updateId:$},me(me({},E.state),{},{legendBBox:O}))))}}),Ue(E,"handleReceiveSyncEvent",function(O,T,k){if(E.props.syncId===O){if(k===E.eventEmitterSymbol&&typeof E.props.syncMethod!="function")return;E.applySyncEvent(T)}}),Ue(E,"handleBrushChange",function(O){var T=O.startIndex,k=O.endIndex;if(T!==E.state.dataStartIndex||k!==E.state.dataEndIndex){var M=E.state.updateId;E.setState(function(){return me({dataStartIndex:T,dataEndIndex:k},v({props:E.props,dataStartIndex:T,dataEndIndex:k,updateId:M},E.state))}),E.triggerSyncEvent({dataStartIndex:T,dataEndIndex:k})}}),Ue(E,"handleMouseEnter",function(O){var T=E.getMouseInfo(O);if(T){var k=me(me({},T),{},{isTooltipActive:!0});E.setState(k),E.triggerSyncEvent(k);var M=E.props.onMouseEnter;Ye(M)&&M(k,O)}}),Ue(E,"triggeredAfterMouseMove",function(O){var T=E.getMouseInfo(O),k=T?me(me({},T),{},{isTooltipActive:!0}):{isTooltipActive:!1};E.setState(k),E.triggerSyncEvent(k);var M=E.props.onMouseMove;Ye(M)&&M(k,O)}),Ue(E,"handleItemMouseEnter",function(O){E.setState(function(){return{isTooltipActive:!0,activeItem:O,activePayload:O.tooltipPayload,activeCoordinate:O.tooltipPosition||{x:O.cx,y:O.cy}}})}),Ue(E,"handleItemMouseLeave",function(){E.setState(function(){return{isTooltipActive:!1}})}),Ue(E,"handleMouseMove",function(O){O.persist(),E.throttleTriggeredAfterMouseMove(O)}),Ue(E,"handleMouseLeave",function(O){E.throttleTriggeredAfterMouseMove.cancel();var T={isTooltipActive:!1};E.setState(T),E.triggerSyncEvent(T);var k=E.props.onMouseLeave;Ye(k)&&k(T,O)}),Ue(E,"handleOuterEvent",function(O){var T=M9(O),k=Sn(E.props,"".concat(T));if(T&&Ye(k)){var M,$;/.*touch.*/i.test(T)?$=E.getMouseInfo(O.changedTouches[0]):$=E.getMouseInfo(O),k((M=$)!==null&&M!==void 0?M:{},O)}}),Ue(E,"handleClick",function(O){var T=E.getMouseInfo(O);if(T){var k=me(me({},T),{},{isTooltipActive:!0});E.setState(k),E.triggerSyncEvent(k);var M=E.props.onClick;Ye(M)&&M(k,O)}}),Ue(E,"handleMouseDown",function(O){var T=E.props.onMouseDown;if(Ye(T)){var k=E.getMouseInfo(O);T(k,O)}}),Ue(E,"handleMouseUp",function(O){var T=E.props.onMouseUp;if(Ye(T)){var k=E.getMouseInfo(O);T(k,O)}}),Ue(E,"handleTouchMove",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&E.throttleTriggeredAfterMouseMove(O.changedTouches[0])}),Ue(E,"handleTouchStart",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&E.handleMouseDown(O.changedTouches[0])}),Ue(E,"handleTouchEnd",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&E.handleMouseUp(O.changedTouches[0])}),Ue(E,"handleDoubleClick",function(O){var T=E.props.onDoubleClick;if(Ye(T)){var k=E.getMouseInfo(O);T(k,O)}}),Ue(E,"handleContextMenu",function(O){var T=E.props.onContextMenu;if(Ye(T)){var k=E.getMouseInfo(O);T(k,O)}}),Ue(E,"triggerSyncEvent",function(O){E.props.syncId!==void 0&&O1.emit(P1,E.props.syncId,O,E.eventEmitterSymbol)}),Ue(E,"applySyncEvent",function(O){var T=E.props,k=T.layout,M=T.syncMethod,$=E.state.updateId,z=O.dataStartIndex,F=O.dataEndIndex;if(O.dataStartIndex!==void 0||O.dataEndIndex!==void 0)E.setState(me({dataStartIndex:z,dataEndIndex:F},v({props:E.props,dataStartIndex:z,dataEndIndex:F,updateId:$},E.state)));else if(O.activeTooltipIndex!==void 0){var V=O.chartX,G=O.chartY,U=O.activeTooltipIndex,H=E.state,W=H.offset,B=H.tooltipTicks;if(!W)return;if(typeof M=="function")U=M(B,O);else if(M==="value"){U=-1;for(var Q=0;Q=0){var ge,Y;if(V.dataKey&&!V.allowDuplicatedCategory){var we=typeof V.dataKey=="function"?de:"payload.".concat(V.dataKey.toString());ge=ip(Q,we,U),Y=R&&L&&ip(L,we,U)}else ge=Q?.[G],Y=R&&L&&L[G];if(re||ie){var Ce=O.props.activeIndex!==void 0?O.props.activeIndex:G;return[b.cloneElement(O,me(me(me({},M.props),Z),{},{activeIndex:Ce})),null,null]}if(!rt(ge))return[ne].concat(Rl(E.renderActivePoints({item:M,activePoint:ge,basePoint:Y,childIndex:G,isRange:R})))}else{var Be,et=(Be=E.getItemByXY(E.state.activeCoordinate))!==null&&Be!==void 0?Be:{graphicalItem:ne},tt=et.graphicalItem,St=tt.item,jt=St===void 0?O:St,Kt=tt.childIndex,_t=me(me(me({},M.props),Z),{},{activeIndex:Kt});return[b.cloneElement(jt,_t),null,null]}return R?[ne,null,null]:[ne,null]}),Ue(E,"renderCustomized",function(O,T,k){return b.cloneElement(O,me(me({key:"recharts-customized-".concat(k)},E.props),E.state))}),Ue(E,"renderMap",{CartesianGrid:{handler:nh,once:!0},ReferenceArea:{handler:E.renderReferenceElement},ReferenceLine:{handler:nh},ReferenceDot:{handler:E.renderReferenceElement},XAxis:{handler:nh},YAxis:{handler:nh},Brush:{handler:E.renderBrush,once:!0},Bar:{handler:E.renderGraphicChild},Line:{handler:E.renderGraphicChild},Area:{handler:E.renderGraphicChild},Radar:{handler:E.renderGraphicChild},RadialBar:{handler:E.renderGraphicChild},Scatter:{handler:E.renderGraphicChild},Pie:{handler:E.renderGraphicChild},Funnel:{handler:E.renderGraphicChild},Tooltip:{handler:E.renderCursor,once:!0},PolarGrid:{handler:E.renderPolarGrid,once:!0},PolarAngleAxis:{handler:E.renderPolarAxis},PolarRadiusAxis:{handler:E.renderPolarAxis},Customized:{handler:E.renderCustomized}}),E.clipPathId="".concat((C=_.id)!==null&&C!==void 0?C:Vl("recharts"),"-clip"),E.throttleTriggeredAfterMouseMove=cL(E.triggeredAfterMouseMove,(A=_.throttleDelay)!==null&&A!==void 0?A:1e3/60),E.state={},E}return eie(j,w),Yae(j,[{key:"componentDidMount",value:function(){var C,A;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(C=this.props.margin.left)!==null&&C!==void 0?C:0,top:(A=this.props.margin.top)!==null&&A!==void 0?A:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var C=this.props,A=C.children,E=C.data,O=C.height,T=C.layout,k=mn(A,vn);if(k){var M=k.props.defaultIndex;if(!(typeof M!="number"||M<0||M>this.state.tooltipTicks.length-1)){var $=this.state.tooltipTicks[M]&&this.state.tooltipTicks[M].value,z=NS(this.state,E,M,$),F=this.state.tooltipTicks[M].coordinate,V=(this.state.offset.top+O)/2,G=T==="horizontal",U=G?{x:F,y:V}:{y:F,x:V},H=this.state.formattedGraphicalItems.find(function(B){var Q=B.item;return Q.type.name==="Scatter"});H&&(U=me(me({},U),H.props.points[M].tooltipPosition),z=H.props.points[M].tooltipPayload);var W={activeTooltipIndex:M,isTooltipActive:!0,activeLabel:$,activePayload:z,activeCoordinate:U};this.setState(W),this.renderCursor(k),this.accessibilityManager.setIndex(M)}}}},{key:"getSnapshotBeforeUpdate",value:function(C,A){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==A.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==C.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==C.margin){var E,O;this.accessibilityManager.setDetails({offset:{left:(E=this.props.margin.left)!==null&&E!==void 0?E:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0}})}return null}},{key:"componentDidUpdate",value:function(C){ow([mn(C.children,vn)],[mn(this.props.children,vn)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var C=mn(this.props.children,vn);if(C&&typeof C.props.shared=="boolean"){var A=C.props.shared?"axis":"item";return u.indexOf(A)>=0?A:i}return i}},{key:"getMouseInfo",value:function(C){if(!this.container)return null;var A=this.container,E=A.getBoundingClientRect(),O=SW(E),T={chartX:Math.round(C.pageX-O.left),chartY:Math.round(C.pageY-O.top)},k=E.width/A.offsetWidth||1,M=this.inRange(T.chartX,T.chartY,k);if(!M)return null;var $=this.state,z=$.xAxisMap,F=$.yAxisMap,V=this.getTooltipEventType(),G=NR(this.state,this.props.data,this.props.layout,M);if(V!=="axis"&&z&&F){var U=Qi(z).scale,H=Qi(F).scale,W=U&&U.invert?U.invert(T.chartX):null,B=H&&H.invert?H.invert(T.chartY):null;return me(me({},T),{},{xValue:W,yValue:B},G)}return G?me(me({},T),G):null}},{key:"inRange",value:function(C,A){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,O=this.props.layout,T=C/E,k=A/E;if(O==="horizontal"||O==="vertical"){var M=this.state.offset,$=T>=M.left&&T<=M.left+M.width&&k>=M.top&&k<=M.top+M.height;return $?{x:T,y:k}:null}var z=this.state,F=z.angleAxisMap,V=z.radiusAxisMap;if(F&&V){var G=Qi(F);return PT({x:T,y:k},G)}return null}},{key:"parseEventsOfWrapper",value:function(){var C=this.props.children,A=this.getTooltipEventType(),E=mn(C,vn),O={};E&&A==="axis"&&(E.props.trigger==="click"?O={onClick:this.handleClick}:O={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var T=op(this.props,this.handleOuterEvent);return me(me({},T),O)}},{key:"addListener",value:function(){O1.on(P1,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){O1.removeListener(P1,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(C,A,E){for(var O=this.state.formattedGraphicalItems,T=0,k=O.length;To.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg border border-gray-100 hover:bg-gray-100 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-600 font-bold text-xs",children:e.template.substring(0,2)}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-gray-900",children:e.product}),o.jsxs("p",{className:"text-xs text-gray-500",children:[e.id," • ",e.user]})]})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("span",{className:"text-xs text-gray-500 font-medium",children:e.time}),o.jsx(kr,{variant:"secondary",className:e.status==="expired"?"bg-red-100 text-red-700":"bg-green-100 text-green-700",children:e.status})]})]},e.id))})})]})]}),o.jsx("div",{className:"space-y-6",children:o.jsxs(gn,{className:"shadow-sm border-gray-200",children:[o.jsx(sa,{children:o.jsxs(la,{className:"text-base font-bold text-gray-800 flex items-center gap-2",children:[o.jsx(hu,{className:"w-5 h-5 text-gray-500"}),"By Category"]})}),o.jsxs(qn,{children:[o.jsxs("div",{className:"h-[200px] relative",children:[o.jsx(gp,{width:"100%",height:"100%",children:o.jsxs(vie,{children:[o.jsx(_i,{data:T1,cx:"50%",cy:"50%",innerRadius:60,outerRadius:80,paddingAngle:5,dataKey:"value",children:T1.map((e,t)=>o.jsx(km,{fill:e.color},`cell-${t}`))}),o.jsx(vn,{})]})}),o.jsxs("div",{className:"absolute inset-0 flex items-center justify-center flex-col pointer-events-none",children:[o.jsx("span",{className:"text-2xl font-bold text-gray-900",children:"1000"}),o.jsx("span",{className:"text-xs text-gray-500",children:"Total"})]})]}),o.jsx("div",{className:"mt-4 space-y-2",children:T1.map(e=>o.jsxs("div",{className:"flex items-center justify-between text-sm",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:e.color}}),o.jsx("span",{className:"text-gray-600",children:e.name})]}),o.jsx("span",{className:"font-medium text-gray-900",children:e.value})]},e.name))})]})]})})]})]})}function Ds({title:e,value:t,trend:r,trendUp:n,icon:a,color:i,bgColor:s}){return o.jsx(gn,{className:"border-gray-200 shadow-sm hover:shadow-md transition-shadow",children:o.jsxs(qn,{className:"p-6",children:[o.jsxs("div",{className:"flex justify-between items-start",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium text-gray-500 mb-1",children:e}),o.jsx("h3",{className:"text-2xl font-bold text-gray-900",children:t})]}),o.jsx("div",{className:`p-2 rounded-lg ${s}`,children:o.jsx(a,{className:`w-5 h-5 ${i}`})})]}),o.jsxs("div",{className:"mt-4 flex items-center text-sm",children:[n?o.jsx(yM,{className:"w-4 h-4 text-green-500 mr-1"}):o.jsx(Sz,{className:"w-4 h-4 text-red-500 mr-1"}),o.jsx("span",{className:n?"text-green-600 font-medium":"text-red-600 font-medium",children:r}),o.jsx("span",{className:"text-gray-400 ml-1",children:"Vs. last period"})]})]})})}function wie({title:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[1,2,3,4].map(t=>o.jsxs(gn,{children:[o.jsx(sa,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:o.jsxs(la,{className:"text-sm font-medium",children:["Metric ",t]})}),o.jsxs(qn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"000"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"+0.0% from last month"})]})]},t))}),o.jsx(gn,{className:"min-h-[400px] flex items-center justify-center border-dashed",children:o.jsxs("div",{className:"text-center text-muted-foreground",children:[o.jsxs("h3",{className:"text-lg font-medium",children:[e," Module"]}),o.jsx("p",{children:"This module is currently under development."})]})})]})}function Rr({className:e,...t}){return o.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:o.jsx("table",{"data-slot":"table",className:Ee("w-full caption-bottom text-sm",e),...t})})}function Ir({className:e,...t}){return o.jsx("thead",{"data-slot":"table-header",className:Ee("[&_tr]:border-b",e),...t})}function Mr({className:e,...t}){return o.jsx("tbody",{"data-slot":"table-body",className:Ee("[&_tr:last-child]:border-0",e),...t})}function Le({className:e,...t}){return o.jsx("tr",{"data-slot":"table-row",className:Ee("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function ye({className:e,...t}){return o.jsx("th",{"data-slot":"table-head",className:Ee("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function fe({className:e,...t}){return o.jsx("td",{"data-slot":"table-cell",className:Ee("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function ER(e){const t=Sie(e),r=b.forwardRef((n,a)=>{const{children:i,...s}=n,u=b.Children.toArray(i),d=u.find(Nie);if(d){const c=d.props.children,h=u.map(p=>p===d?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:p);return o.jsx(t,{...s,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,h):null})}return o.jsx(t,{...s,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function Sie(e){const t=b.forwardRef((r,n)=>{const{children:a,...i}=r;if(b.isValidElement(a)){const s=Cie(a),u=_ie(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Wn(n,s):s),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jie=Symbol("radix.slottable");function Nie(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jie}function _ie(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function Cie(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Eie(e){const t=e+"CollectionProvider",[r,n]=wi(t),[a,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),s=y=>{const{scope:w,children:j}=y,_=q.useRef(null),C=q.useRef(new Map).current;return o.jsx(a,{scope:w,itemMap:C,collectionRef:_,children:j})};s.displayName=t;const u=e+"CollectionSlot",d=ER(u),c=q.forwardRef((y,w)=>{const{scope:j,children:_}=y,C=i(u,j),A=st(w,C.collectionRef);return o.jsx(d,{ref:A,children:_})});c.displayName=u;const h=e+"CollectionItemSlot",p="data-radix-collection-item",m=ER(h),v=q.forwardRef((y,w)=>{const{scope:j,children:_,...C}=y,A=q.useRef(null),E=st(w,A),O=i(h,j);return q.useEffect(()=>(O.itemMap.set(A,{ref:A,...C}),()=>void O.itemMap.delete(A))),o.jsx(m,{[p]:"",ref:E,children:_})});v.displayName=h;function x(y){const w=i(e+"CollectionConsumer",y);return q.useCallback(()=>{const _=w.collectionRef.current;if(!_)return[];const C=Array.from(_.querySelectorAll(`[${p}]`));return Array.from(w.itemMap.values()).sort((O,T)=>C.indexOf(O.ref.current)-C.indexOf(T.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:s,Slot:c,ItemSlot:v},x,n]}function Oie(e,t=globalThis?.document){const r=Fr(e);b.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Pie="DismissableLayer",_S="dismissableLayer.update",Aie="dismissableLayer.pointerDownOutside",Tie="dismissableLayer.focusOutside",OR,A4=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ud=b.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:s,onDismiss:u,...d}=e,c=b.useContext(A4),[h,p]=b.useState(null),m=h?.ownerDocument??globalThis?.document,[,v]=b.useState({}),x=st(t,T=>p(T)),y=Array.from(c.layers),[w]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),j=y.indexOf(w),_=h?y.indexOf(h):-1,C=c.layersWithOutsidePointerEventsDisabled.size>0,A=_>=j,E=Iie(T=>{const k=T.target,M=[...c.branches].some($=>$.contains(k));!A||M||(a?.(T),s?.(T),T.defaultPrevented||u?.())},m),O=Mie(T=>{const k=T.target;[...c.branches].some($=>$.contains(k))||(i?.(T),s?.(T),T.defaultPrevented||u?.())},m);return Oie(T=>{_===c.layers.size-1&&(n?.(T),!T.defaultPrevented&&u&&(T.preventDefault(),u()))},m),b.useEffect(()=>{if(h)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(OR=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(h)),c.layers.add(h),PR(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=OR)}},[h,m,r,c]),b.useEffect(()=>()=>{h&&(c.layers.delete(h),c.layersWithOutsidePointerEventsDisabled.delete(h),PR())},[h,c]),b.useEffect(()=>{const T=()=>v({});return document.addEventListener(_S,T),()=>document.removeEventListener(_S,T)},[]),o.jsx(Je.div,{...d,ref:x,style:{pointerEvents:C?A?"auto":"none":void 0,...e.style},onFocusCapture:Ze(e.onFocusCapture,O.onFocusCapture),onBlurCapture:Ze(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:Ze(e.onPointerDownCapture,E.onPointerDownCapture)})});ud.displayName=Pie;var kie="DismissableLayerBranch",Rie=b.forwardRef((e,t)=>{const r=b.useContext(A4),n=b.useRef(null),a=st(t,n);return b.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),o.jsx(Je.div,{...e,ref:a})});Rie.displayName=kie;function Iie(e,t=globalThis?.document){const r=Fr(e),n=b.useRef(!1),a=b.useRef(()=>{});return b.useEffect(()=>{const i=u=>{if(u.target&&!n.current){let d=function(){T4(Aie,r,c,{discrete:!0})};const c={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=d,t.addEventListener("click",a.current,{once:!0})):d()}else t.removeEventListener("click",a.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Mie(e,t=globalThis?.document){const r=Fr(e),n=b.useRef(!1);return b.useEffect(()=>{const a=i=>{i.target&&!n.current&&T4(Tie,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function PR(){const e=new CustomEvent(_S);document.dispatchEvent(e)}function T4(e,t,r,{discrete:n}){const a=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?$q(a,i):a.dispatchEvent(i)}var k1=0;function aN(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??AR()),document.body.insertAdjacentElement("beforeend",e[1]??AR()),k1++,()=>{k1===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),k1--}},[])}function AR(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var R1="focusScope.autoFocusOnMount",I1="focusScope.autoFocusOnUnmount",TR={bubbles:!1,cancelable:!0},Die="FocusScope",ng=b.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...s}=e,[u,d]=b.useState(null),c=Fr(a),h=Fr(i),p=b.useRef(null),m=st(t,y=>d(y)),v=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(n){let y=function(C){if(v.paused||!u)return;const A=C.target;u.contains(A)?p.current=A:Yi(p.current,{select:!0})},w=function(C){if(v.paused||!u)return;const A=C.relatedTarget;A!==null&&(u.contains(A)||Yi(p.current,{select:!0}))},j=function(C){if(document.activeElement===document.body)for(const E of C)E.removedNodes.length>0&&Yi(u)};document.addEventListener("focusin",y),document.addEventListener("focusout",w);const _=new MutationObserver(j);return u&&_.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",w),_.disconnect()}}},[n,u,v.paused]),b.useEffect(()=>{if(u){RR.add(v);const y=document.activeElement;if(!u.contains(y)){const j=new CustomEvent(R1,TR);u.addEventListener(R1,c),u.dispatchEvent(j),j.defaultPrevented||(Lie(qie(k4(u)),{select:!0}),document.activeElement===y&&Yi(u))}return()=>{u.removeEventListener(R1,c),setTimeout(()=>{const j=new CustomEvent(I1,TR);u.addEventListener(I1,h),u.dispatchEvent(j),j.defaultPrevented||Yi(y??document.body,{select:!0}),u.removeEventListener(I1,h),RR.remove(v)},0)}}},[u,c,h,v]);const x=b.useCallback(y=>{if(!r&&!n||v.paused)return;const w=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,j=document.activeElement;if(w&&j){const _=y.currentTarget,[C,A]=$ie(_);C&&A?!y.shiftKey&&j===A?(y.preventDefault(),r&&Yi(C,{select:!0})):y.shiftKey&&j===C&&(y.preventDefault(),r&&Yi(A,{select:!0})):j===_&&y.preventDefault()}},[r,n,v.paused]);return o.jsx(Je.div,{tabIndex:-1,...s,ref:m,onKeyDown:x})});ng.displayName=Die;function Lie(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Yi(n,{select:t}),document.activeElement!==r)return}function $ie(e){const t=k4(e),r=kR(t,e),n=kR(t.reverse(),e);return[r,n]}function k4(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function kR(e,t){for(const r of e)if(!Bie(r,{upTo:t}))return r}function Bie(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Fie(e){return e instanceof HTMLInputElement&&"select"in e}function Yi(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Fie(e)&&t&&e.select()}}var RR=zie();function zie(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=IR(e,t),e.unshift(t)},remove(t){e=IR(e,t),e[0]?.resume()}}}function IR(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function qie(e){return e.filter(t=>t.tagName!=="A")}var Uie=VS[" useId ".trim().toString()]||(()=>{}),Vie=0;function en(e){const[t,r]=b.useState(Uie());return rr(()=>{r(n=>n??String(Vie++))},[e]),e||(t?`radix-${t}`:"")}const Hie=["top","right","bottom","left"],no=Math.min,xn=Math.max,sm=Math.round,ah=Math.floor,Da=e=>({x:e,y:e}),Wie={left:"right",right:"left",bottom:"top",top:"bottom"},Gie={start:"end",end:"start"};function CS(e,t,r){return xn(e,no(t,r))}function mi(e,t){return typeof e=="function"?e(t):e}function gi(e){return e.split("-")[0]}function Jl(e){return e.split("-")[1]}function iN(e){return e==="x"?"y":"x"}function oN(e){return e==="y"?"height":"width"}const Kie=new Set(["top","bottom"]);function Ra(e){return Kie.has(gi(e))?"y":"x"}function sN(e){return iN(Ra(e))}function Xie(e,t,r){r===void 0&&(r=!1);const n=Jl(e),a=sN(e),i=oN(a);let s=a==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=lm(s)),[s,lm(s)]}function Yie(e){const t=lm(e);return[ES(e),t,ES(t)]}function ES(e){return e.replace(/start|end/g,t=>Gie[t])}const MR=["left","right"],DR=["right","left"],Jie=["top","bottom"],Qie=["bottom","top"];function Zie(e,t,r){switch(e){case"top":case"bottom":return r?t?DR:MR:t?MR:DR;case"left":case"right":return t?Jie:Qie;default:return[]}}function eoe(e,t,r,n){const a=Jl(e);let i=Zie(gi(e),r==="start",n);return a&&(i=i.map(s=>s+"-"+a),t&&(i=i.concat(i.map(ES)))),i}function lm(e){return e.replace(/left|right|bottom|top/g,t=>Wie[t])}function toe(e){return{top:0,right:0,bottom:0,left:0,...e}}function R4(e){return typeof e!="number"?toe(e):{top:e,right:e,bottom:e,left:e}}function cm(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function LR(e,t,r){let{reference:n,floating:a}=e;const i=Ra(t),s=sN(t),u=oN(s),d=gi(t),c=i==="y",h=n.x+n.width/2-a.width/2,p=n.y+n.height/2-a.height/2,m=n[u]/2-a[u]/2;let v;switch(d){case"top":v={x:h,y:n.y-a.height};break;case"bottom":v={x:h,y:n.y+n.height};break;case"right":v={x:n.x+n.width,y:p};break;case"left":v={x:n.x-a.width,y:p};break;default:v={x:n.x,y:n.y}}switch(Jl(t)){case"start":v[s]-=m*(r&&c?-1:1);break;case"end":v[s]+=m*(r&&c?-1:1);break}return v}async function roe(e,t){var r;t===void 0&&(t={});const{x:n,y:a,platform:i,rects:s,elements:u,strategy:d}=e,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:p="floating",altBoundary:m=!1,padding:v=0}=mi(t,e),x=R4(v),w=u[m?p==="floating"?"reference":"floating":p],j=cm(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(w)))==null||r?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(u.floating)),boundary:c,rootBoundary:h,strategy:d})),_=p==="floating"?{x:n,y:a,width:s.floating.width,height:s.floating.height}:s.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),A=await(i.isElement==null?void 0:i.isElement(C))?await(i.getScale==null?void 0:i.getScale(C))||{x:1,y:1}:{x:1,y:1},E=cm(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:_,offsetParent:C,strategy:d}):_);return{top:(j.top-E.top+x.top)/A.y,bottom:(E.bottom-j.bottom+x.bottom)/A.y,left:(j.left-E.left+x.left)/A.x,right:(E.right-j.right+x.right)/A.x}}const noe=async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:i=[],platform:s}=r,u=i.filter(Boolean),d=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:a}),{x:h,y:p}=LR(c,n,d),m=n,v={},x=0;for(let w=0;w({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:i,platform:s,elements:u,middlewareData:d}=t,{element:c,padding:h=0}=mi(e,t)||{};if(c==null)return{};const p=R4(h),m={x:r,y:n},v=sN(a),x=oN(v),y=await s.getDimensions(c),w=v==="y",j=w?"top":"left",_=w?"bottom":"right",C=w?"clientHeight":"clientWidth",A=i.reference[x]+i.reference[v]-m[v]-i.floating[x],E=m[v]-i.reference[v],O=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let T=O?O[C]:0;(!T||!await(s.isElement==null?void 0:s.isElement(O)))&&(T=u.floating[C]||i.floating[x]);const k=A/2-E/2,M=T/2-y[x]/2-1,$=no(p[j],M),z=no(p[_],M),F=$,V=T-y[x]-z,G=T/2-y[x]/2+k,U=CS(F,G,V),H=!d.arrow&&Jl(a)!=null&&G!==U&&i.reference[x]/2-(GG<=0)){var z,F;const G=(((z=i.flip)==null?void 0:z.index)||0)+1,U=T[G];if(U&&(!(p==="alignment"?_!==Ra(U):!1)||$.every(B=>Ra(B.placement)===_?B.overflows[0]>0:!0)))return{data:{index:G,overflows:$},reset:{placement:U}};let H=(F=$.filter(W=>W.overflows[0]<=0).sort((W,B)=>W.overflows[1]-B.overflows[1])[0])==null?void 0:F.placement;if(!H)switch(v){case"bestFit":{var V;const W=(V=$.filter(B=>{if(O){const Q=Ra(B.placement);return Q===_||Q==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(Q=>Q>0).reduce((Q,R)=>Q+R,0)]).sort((B,Q)=>B[1]-Q[1])[0])==null?void 0:V[0];W&&(H=W);break}case"initialPlacement":H=u;break}if(a!==H)return{reset:{placement:H}}}return{}}}};function $R(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function BR(e){return Hie.some(t=>e[t]>=0)}const ooe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...i}=mi(e,t);switch(a){case"referenceHidden":{const s=await n.detectOverflow(t,{...i,elementContext:"reference"}),u=$R(s,r.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:BR(u)}}}case"escaped":{const s=await n.detectOverflow(t,{...i,altBoundary:!0}),u=$R(s,r.floating);return{data:{escapedOffsets:u,escaped:BR(u)}}}default:return{}}}}},I4=new Set(["left","top"]);async function soe(e,t){const{placement:r,platform:n,elements:a}=e,i=await(n.isRTL==null?void 0:n.isRTL(a.floating)),s=gi(r),u=Jl(r),d=Ra(r)==="y",c=I4.has(s)?-1:1,h=i&&d?-1:1,p=mi(t,e);let{mainAxis:m,crossAxis:v,alignmentAxis:x}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof x=="number"&&(v=u==="end"?x*-1:x),d?{x:v*h,y:m*c}:{x:m*c,y:v*h}}const loe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:i,placement:s,middlewareData:u}=t,d=await soe(t,e);return s===((r=u.offset)==null?void 0:r.placement)&&(n=u.arrow)!=null&&n.alignmentOffset?{}:{x:a+d.x,y:i+d.y,data:{...d,placement:s}}}}},coe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a,platform:i}=t,{mainAxis:s=!0,crossAxis:u=!1,limiter:d={fn:j=>{let{x:_,y:C}=j;return{x:_,y:C}}},...c}=mi(e,t),h={x:r,y:n},p=await i.detectOverflow(t,c),m=Ra(gi(a)),v=iN(m);let x=h[v],y=h[m];if(s){const j=v==="y"?"top":"left",_=v==="y"?"bottom":"right",C=x+p[j],A=x-p[_];x=CS(C,x,A)}if(u){const j=m==="y"?"top":"left",_=m==="y"?"bottom":"right",C=y+p[j],A=y-p[_];y=CS(C,y,A)}const w=d.fn({...t,[v]:x,[m]:y});return{...w,data:{x:w.x-r,y:w.y-n,enabled:{[v]:s,[m]:u}}}}}},uoe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:i,middlewareData:s}=t,{offset:u=0,mainAxis:d=!0,crossAxis:c=!0}=mi(e,t),h={x:r,y:n},p=Ra(a),m=iN(p);let v=h[m],x=h[p];const y=mi(u,t),w=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(d){const C=m==="y"?"height":"width",A=i.reference[m]-i.floating[C]+w.mainAxis,E=i.reference[m]+i.reference[C]-w.mainAxis;vE&&(v=E)}if(c){var j,_;const C=m==="y"?"width":"height",A=I4.has(gi(a)),E=i.reference[p]-i.floating[C]+(A&&((j=s.offset)==null?void 0:j[p])||0)+(A?0:w.crossAxis),O=i.reference[p]+i.reference[C]+(A?0:((_=s.offset)==null?void 0:_[p])||0)-(A?w.crossAxis:0);xO&&(x=O)}return{[m]:v,[p]:x}}}},doe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:i,platform:s,elements:u}=t,{apply:d=()=>{},...c}=mi(e,t),h=await s.detectOverflow(t,c),p=gi(a),m=Jl(a),v=Ra(a)==="y",{width:x,height:y}=i.floating;let w,j;p==="top"||p==="bottom"?(w=p,j=m===(await(s.isRTL==null?void 0:s.isRTL(u.floating))?"start":"end")?"left":"right"):(j=p,w=m==="end"?"top":"bottom");const _=y-h.top-h.bottom,C=x-h.left-h.right,A=no(y-h[w],_),E=no(x-h[j],C),O=!t.middlewareData.shift;let T=A,k=E;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(k=C),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(T=_),O&&!m){const $=xn(h.left,0),z=xn(h.right,0),F=xn(h.top,0),V=xn(h.bottom,0);v?k=x-2*($!==0||z!==0?$+z:xn(h.left,h.right)):T=y-2*(F!==0||V!==0?F+V:xn(h.top,h.bottom))}await d({...t,availableWidth:k,availableHeight:T});const M=await s.getDimensions(u.floating);return x!==M.width||y!==M.height?{reset:{rects:!0}}:{}}}};function ag(){return typeof window<"u"}function Ql(e){return M4(e)?(e.nodeName||"").toLowerCase():"#document"}function Nn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Va(e){var t;return(t=(M4(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function M4(e){return ag()?e instanceof Node||e instanceof Nn(e).Node:!1}function pa(e){return ag()?e instanceof Element||e instanceof Nn(e).Element:!1}function Ba(e){return ag()?e instanceof HTMLElement||e instanceof Nn(e).HTMLElement:!1}function FR(e){return!ag()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Nn(e).ShadowRoot}const foe=new Set(["inline","contents"]);function dd(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=ma(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!foe.has(a)}const hoe=new Set(["table","td","th"]);function poe(e){return hoe.has(Ql(e))}const moe=[":popover-open",":modal"];function ig(e){return moe.some(t=>{try{return e.matches(t)}catch{return!1}})}const goe=["transform","translate","scale","rotate","perspective"],voe=["transform","translate","scale","rotate","perspective","filter"],yoe=["paint","layout","strict","content"];function lN(e){const t=cN(),r=pa(e)?ma(e):e;return goe.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||voe.some(n=>(r.willChange||"").includes(n))||yoe.some(n=>(r.contain||"").includes(n))}function xoe(e){let t=ao(e);for(;Ba(t)&&!Il(t);){if(lN(t))return t;if(ig(t))return null;t=ao(t)}return null}function cN(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const boe=new Set(["html","body","#document"]);function Il(e){return boe.has(Ql(e))}function ma(e){return Nn(e).getComputedStyle(e)}function og(e){return pa(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ao(e){if(Ql(e)==="html")return e;const t=e.assignedSlot||e.parentNode||FR(e)&&e.host||Va(e);return FR(t)?t.host:t}function D4(e){const t=ao(e);return Il(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ba(t)&&dd(t)?t:D4(t)}function Xu(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const a=D4(e),i=a===((n=e.ownerDocument)==null?void 0:n.body),s=Nn(a);if(i){const u=OS(s);return t.concat(s,s.visualViewport||[],dd(a)?a:[],u&&r?Xu(u):[])}return t.concat(a,Xu(a,[],r))}function OS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function L4(e){const t=ma(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Ba(e),i=a?e.offsetWidth:r,s=a?e.offsetHeight:n,u=sm(r)!==i||sm(n)!==s;return u&&(r=i,n=s),{width:r,height:n,$:u}}function uN(e){return pa(e)?e:e.contextElement}function rl(e){const t=uN(e);if(!Ba(t))return Da(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:i}=L4(t);let s=(i?sm(r.width):r.width)/n,u=(i?sm(r.height):r.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!u||!Number.isFinite(u))&&(u=1),{x:s,y:u}}const woe=Da(0);function $4(e){const t=Nn(e);return!cN()||!t.visualViewport?woe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Soe(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Nn(e)?!1:t}function Yo(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const a=e.getBoundingClientRect(),i=uN(e);let s=Da(1);t&&(n?pa(n)&&(s=rl(n)):s=rl(e));const u=Soe(i,r,n)?$4(i):Da(0);let d=(a.left+u.x)/s.x,c=(a.top+u.y)/s.y,h=a.width/s.x,p=a.height/s.y;if(i){const m=Nn(i),v=n&&pa(n)?Nn(n):n;let x=m,y=OS(x);for(;y&&n&&v!==x;){const w=rl(y),j=y.getBoundingClientRect(),_=ma(y),C=j.left+(y.clientLeft+parseFloat(_.paddingLeft))*w.x,A=j.top+(y.clientTop+parseFloat(_.paddingTop))*w.y;d*=w.x,c*=w.y,h*=w.x,p*=w.y,d+=C,c+=A,x=Nn(y),y=OS(x)}}return cm({width:h,height:p,x:d,y:c})}function sg(e,t){const r=og(e).scrollLeft;return t?t.left+r:Yo(Va(e)).left+r}function B4(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-sg(e,r),a=r.top+t.scrollTop;return{x:n,y:a}}function joe(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const i=a==="fixed",s=Va(n),u=t?ig(t.floating):!1;if(n===s||u&&i)return r;let d={scrollLeft:0,scrollTop:0},c=Da(1);const h=Da(0),p=Ba(n);if((p||!p&&!i)&&((Ql(n)!=="body"||dd(s))&&(d=og(n)),Ba(n))){const v=Yo(n);c=rl(n),h.x=v.x+n.clientLeft,h.y=v.y+n.clientTop}const m=s&&!p&&!i?B4(s,d):Da(0);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-d.scrollLeft*c.x+h.x+m.x,y:r.y*c.y-d.scrollTop*c.y+h.y+m.y}}function Noe(e){return Array.from(e.getClientRects())}function _oe(e){const t=Va(e),r=og(e),n=e.ownerDocument.body,a=xn(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=xn(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-r.scrollLeft+sg(e);const u=-r.scrollTop;return ma(n).direction==="rtl"&&(s+=xn(t.clientWidth,n.clientWidth)-a),{width:a,height:i,x:s,y:u}}const zR=25;function Coe(e,t){const r=Nn(e),n=Va(e),a=r.visualViewport;let i=n.clientWidth,s=n.clientHeight,u=0,d=0;if(a){i=a.width,s=a.height;const h=cN();(!h||h&&t==="fixed")&&(u=a.offsetLeft,d=a.offsetTop)}const c=sg(n);if(c<=0){const h=n.ownerDocument,p=h.body,m=getComputedStyle(p),v=h.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,x=Math.abs(n.clientWidth-p.clientWidth-v);x<=zR&&(i-=x)}else c<=zR&&(i+=c);return{width:i,height:s,x:u,y:d}}const Eoe=new Set(["absolute","fixed"]);function Ooe(e,t){const r=Yo(e,!0,t==="fixed"),n=r.top+e.clientTop,a=r.left+e.clientLeft,i=Ba(e)?rl(e):Da(1),s=e.clientWidth*i.x,u=e.clientHeight*i.y,d=a*i.x,c=n*i.y;return{width:s,height:u,x:d,y:c}}function qR(e,t,r){let n;if(t==="viewport")n=Coe(e,r);else if(t==="document")n=_oe(Va(e));else if(pa(t))n=Ooe(t,r);else{const a=$4(e);n={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return cm(n)}function F4(e,t){const r=ao(e);return r===t||!pa(r)||Il(r)?!1:ma(r).position==="fixed"||F4(r,t)}function Poe(e,t){const r=t.get(e);if(r)return r;let n=Xu(e,[],!1).filter(u=>pa(u)&&Ql(u)!=="body"),a=null;const i=ma(e).position==="fixed";let s=i?ao(e):e;for(;pa(s)&&!Il(s);){const u=ma(s),d=lN(s);!d&&u.position==="fixed"&&(a=null),(i?!d&&!a:!d&&u.position==="static"&&!!a&&Eoe.has(a.position)||dd(s)&&!d&&F4(e,s))?n=n.filter(h=>h!==s):a=u,s=ao(s)}return t.set(e,n),n}function Aoe(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const s=[...r==="clippingAncestors"?ig(t)?[]:Poe(t,this._c):[].concat(r),n],u=s[0],d=s.reduce((c,h)=>{const p=qR(t,h,a);return c.top=xn(p.top,c.top),c.right=no(p.right,c.right),c.bottom=no(p.bottom,c.bottom),c.left=xn(p.left,c.left),c},qR(t,u,a));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function Toe(e){const{width:t,height:r}=L4(e);return{width:t,height:r}}function koe(e,t,r){const n=Ba(t),a=Va(t),i=r==="fixed",s=Yo(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const d=Da(0);function c(){d.x=sg(a)}if(n||!n&&!i)if((Ql(t)!=="body"||dd(a))&&(u=og(t)),n){const v=Yo(t,!0,i,t);d.x=v.x+t.clientLeft,d.y=v.y+t.clientTop}else a&&c();i&&!n&&a&&c();const h=a&&!n&&!i?B4(a,u):Da(0),p=s.left+u.scrollLeft-d.x-h.x,m=s.top+u.scrollTop-d.y-h.y;return{x:p,y:m,width:s.width,height:s.height}}function M1(e){return ma(e).position==="static"}function UR(e,t){if(!Ba(e)||ma(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Va(e)===r&&(r=r.ownerDocument.body),r}function z4(e,t){const r=Nn(e);if(ig(e))return r;if(!Ba(e)){let a=ao(e);for(;a&&!Il(a);){if(pa(a)&&!M1(a))return a;a=ao(a)}return r}let n=UR(e,t);for(;n&&poe(n)&&M1(n);)n=UR(n,t);return n&&Il(n)&&M1(n)&&!lN(n)?r:n||xoe(e)||r}const Roe=async function(e){const t=this.getOffsetParent||z4,r=this.getDimensions,n=await r(e.floating);return{reference:koe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Ioe(e){return ma(e).direction==="rtl"}const Moe={convertOffsetParentRelativeRectToViewportRelativeRect:joe,getDocumentElement:Va,getClippingRect:Aoe,getOffsetParent:z4,getElementRects:Roe,getClientRects:Noe,getDimensions:Toe,getScale:rl,isElement:pa,isRTL:Ioe};function q4(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Doe(e,t){let r=null,n;const a=Va(e);function i(){var u;clearTimeout(n),(u=r)==null||u.disconnect(),r=null}function s(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),i();const c=e.getBoundingClientRect(),{left:h,top:p,width:m,height:v}=c;if(u||t(),!m||!v)return;const x=ah(p),y=ah(a.clientWidth-(h+m)),w=ah(a.clientHeight-(p+v)),j=ah(h),C={rootMargin:-x+"px "+-y+"px "+-w+"px "+-j+"px",threshold:xn(0,no(1,d))||1};let A=!0;function E(O){const T=O[0].intersectionRatio;if(T!==d){if(!A)return s();T?s(!1,T):n=setTimeout(()=>{s(!1,1e-7)},1e3)}T===1&&!q4(c,e.getBoundingClientRect())&&s(),A=!1}try{r=new IntersectionObserver(E,{...C,root:a.ownerDocument})}catch{r=new IntersectionObserver(E,C)}r.observe(e)}return s(!0),i}function Loe(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=n,c=uN(e),h=a||i?[...c?Xu(c):[],...Xu(t)]:[];h.forEach(j=>{a&&j.addEventListener("scroll",r,{passive:!0}),i&&j.addEventListener("resize",r)});const p=c&&u?Doe(c,r):null;let m=-1,v=null;s&&(v=new ResizeObserver(j=>{let[_]=j;_&&_.target===c&&v&&(v.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var C;(C=v)==null||C.observe(t)})),r()}),c&&!d&&v.observe(c),v.observe(t));let x,y=d?Yo(e):null;d&&w();function w(){const j=Yo(e);y&&!q4(y,j)&&r(),y=j,x=requestAnimationFrame(w)}return r(),()=>{var j;h.forEach(_=>{a&&_.removeEventListener("scroll",r),i&&_.removeEventListener("resize",r)}),p?.(),(j=v)==null||j.disconnect(),v=null,d&&cancelAnimationFrame(x)}}const $oe=loe,Boe=coe,Foe=ioe,zoe=doe,qoe=ooe,VR=aoe,Uoe=uoe,Voe=(e,t,r)=>{const n=new Map,a={platform:Moe,...r},i={...a.platform,_c:n};return noe(e,t,{...a,platform:i})};var Hoe=typeof document<"u",Woe=function(){},Kh=Hoe?b.useLayoutEffect:Woe;function um(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!um(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;n--!==0;){const i=a[n];if(!(i==="_owner"&&e.$$typeof)&&!um(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function U4(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function HR(e,t){const r=U4(e);return Math.round(t*r)/r}function D1(e){const t=b.useRef(e);return Kh(()=>{t.current=e}),t}function Goe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:i,floating:s}={},transform:u=!0,whileElementsMounted:d,open:c}=e,[h,p]=b.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,v]=b.useState(n);um(m,n)||v(n);const[x,y]=b.useState(null),[w,j]=b.useState(null),_=b.useCallback(B=>{B!==O.current&&(O.current=B,y(B))},[]),C=b.useCallback(B=>{B!==T.current&&(T.current=B,j(B))},[]),A=i||x,E=s||w,O=b.useRef(null),T=b.useRef(null),k=b.useRef(h),M=d!=null,$=D1(d),z=D1(a),F=D1(c),V=b.useCallback(()=>{if(!O.current||!T.current)return;const B={placement:t,strategy:r,middleware:m};z.current&&(B.platform=z.current),Voe(O.current,T.current,B).then(Q=>{const R={...Q,isPositioned:F.current!==!1};G.current&&!um(k.current,R)&&(k.current=R,ed.flushSync(()=>{p(R)}))})},[m,t,r,z,F]);Kh(()=>{c===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,p(B=>({...B,isPositioned:!1})))},[c]);const G=b.useRef(!1);Kh(()=>(G.current=!0,()=>{G.current=!1}),[]),Kh(()=>{if(A&&(O.current=A),E&&(T.current=E),A&&E){if($.current)return $.current(A,E,V);V()}},[A,E,V,$,M]);const U=b.useMemo(()=>({reference:O,floating:T,setReference:_,setFloating:C}),[_,C]),H=b.useMemo(()=>({reference:A,floating:E}),[A,E]),W=b.useMemo(()=>{const B={position:r,left:0,top:0};if(!H.floating)return B;const Q=HR(H.floating,h.x),R=HR(H.floating,h.y);return u?{...B,transform:"translate("+Q+"px, "+R+"px)",...U4(H.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:Q,top:R}},[r,u,H.floating,h.x,h.y]);return b.useMemo(()=>({...h,update:V,refs:U,elements:H,floatingStyles:W}),[h,V,U,H,W])}const Koe=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:a}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?VR({element:n.current,padding:a}).fn(r):{}:n?VR({element:n,padding:a}).fn(r):{}}}},Xoe=(e,t)=>({...$oe(e),options:[e,t]}),Yoe=(e,t)=>({...Boe(e),options:[e,t]}),Joe=(e,t)=>({...Uoe(e),options:[e,t]}),Qoe=(e,t)=>({...Foe(e),options:[e,t]}),Zoe=(e,t)=>({...zoe(e),options:[e,t]}),ese=(e,t)=>({...qoe(e),options:[e,t]}),tse=(e,t)=>({...Koe(e),options:[e,t]});var rse="Arrow",V4=b.forwardRef((e,t)=>{const{children:r,width:n=10,height:a=5,...i}=e;return o.jsx(Je.svg,{...i,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});V4.displayName=rse;var nse=V4;function dN(e){const[t,r]=b.useState(void 0);return rr(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let s,u;if("borderBoxSize"in i){const d=i.borderBoxSize,c=Array.isArray(d)?d[0]:d;s=c.inlineSize,u=c.blockSize}else s=e.offsetWidth,u=e.offsetHeight;r({width:s,height:u})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var fN="Popper",[H4,Zl]=wi(fN),[ase,W4]=H4(fN),G4=e=>{const{__scopePopper:t,children:r}=e,[n,a]=b.useState(null);return o.jsx(ase,{scope:t,anchor:n,onAnchorChange:a,children:r})};G4.displayName=fN;var K4="PopperAnchor",X4=b.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...a}=e,i=W4(K4,r),s=b.useRef(null),u=st(t,s),d=b.useRef(null);return b.useEffect(()=>{const c=d.current;d.current=n?.current||s.current,c!==d.current&&i.onAnchorChange(d.current)}),n?null:o.jsx(Je.div,{...a,ref:u})});X4.displayName=K4;var hN="PopperContent",[ise,ose]=H4(hN),Y4=b.forwardRef((e,t)=>{const{__scopePopper:r,side:n="bottom",sideOffset:a=0,align:i="center",alignOffset:s=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:c=[],collisionPadding:h=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:v="optimized",onPlaced:x,...y}=e,w=W4(hN,r),[j,_]=b.useState(null),C=st(t,K=>_(K)),[A,E]=b.useState(null),O=dN(A),T=O?.width??0,k=O?.height??0,M=n+(i!=="center"?"-"+i:""),$=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},z=Array.isArray(c)?c:[c],F=z.length>0,V={padding:$,boundary:z.filter(lse),altBoundary:F},{refs:G,floatingStyles:U,placement:H,isPositioned:W,middlewareData:B}=Goe({strategy:"fixed",placement:M,whileElementsMounted:(...K)=>Loe(...K,{animationFrame:v==="always"}),elements:{reference:w.anchor},middleware:[Xoe({mainAxis:a+k,alignmentAxis:s}),d&&Yoe({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Joe():void 0,...V}),d&&Qoe({...V}),Zoe({...V,apply:({elements:K,rects:Z,availableWidth:ne,availableHeight:de})=>{const{width:ge,height:Y}=Z.reference,we=K.floating.style;we.setProperty("--radix-popper-available-width",`${ne}px`),we.setProperty("--radix-popper-available-height",`${de}px`),we.setProperty("--radix-popper-anchor-width",`${ge}px`),we.setProperty("--radix-popper-anchor-height",`${Y}px`)}}),A&&tse({element:A,padding:u}),cse({arrowWidth:T,arrowHeight:k}),m&&ese({strategy:"referenceHidden",...V})]}),[Q,R]=Z4(H),L=Fr(x);rr(()=>{W&&L?.()},[W,L]);const I=B.arrow?.x,X=B.arrow?.y,ee=B.arrow?.centerOffset!==0,[ie,re]=b.useState();return rr(()=>{j&&re(window.getComputedStyle(j).zIndex)},[j]),o.jsx("div",{ref:G.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:W?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(ise,{scope:r,placedSide:Q,onArrowChange:E,arrowX:I,arrowY:X,shouldHideArrow:ee,children:o.jsx(Je.div,{"data-side":Q,"data-align":R,...y,ref:C,style:{...y.style,animation:W?void 0:"none"}})})})});Y4.displayName=hN;var J4="PopperArrow",sse={top:"bottom",right:"left",bottom:"top",left:"right"},Q4=b.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,i=ose(J4,n),s=sse[i.placedSide];return o.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:o.jsx(nse,{...a,ref:r,style:{...a.style,display:"block"}})})});Q4.displayName=J4;function lse(e){return e!==null}var cse=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,s=a.arrow?.centerOffset!==0,u=s?0:e.arrowWidth,d=s?0:e.arrowHeight,[c,h]=Z4(r),p={start:"0%",center:"50%",end:"100%"}[h],m=(a.arrow?.x??0)+u/2,v=(a.arrow?.y??0)+d/2;let x="",y="";return c==="bottom"?(x=s?p:`${m}px`,y=`${-d}px`):c==="top"?(x=s?p:`${m}px`,y=`${n.floating.height+d}px`):c==="right"?(x=`${-d}px`,y=s?p:`${v}px`):c==="left"&&(x=`${n.floating.width+d}px`,y=s?p:`${v}px`),{data:{x,y}}}});function Z4(e){const[t,r="center"]=e.split("-");return[t,r]}var pN=G4,lg=X4,mN=Y4,gN=Q4,use="Portal",fd=b.forwardRef((e,t)=>{const{container:r,...n}=e,[a,i]=b.useState(!1);rr(()=>i(!0),[]);const s=r||a&&globalThis?.document?.body;return s?mM.createPortal(o.jsx(Je.div,{...n,ref:t}),s):null});fd.displayName=use;function dse(e){const t=fse(e),r=b.forwardRef((n,a)=>{const{children:i,...s}=n,u=b.Children.toArray(i),d=u.find(pse);if(d){const c=d.props.children,h=u.map(p=>p===d?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:p);return o.jsx(t,{...s,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,h):null})}return o.jsx(t,{...s,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function fse(e){const t=b.forwardRef((r,n)=>{const{children:a,...i}=r;if(b.isValidElement(a)){const s=gse(a),u=mse(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Wn(n,s):s),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hse=Symbol("radix.slottable");function pse(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hse}function mse(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function gse(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var vse=VS[" useInsertionEffect ".trim().toString()]||rr;function Jo({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,i,s]=yse({defaultProp:t,onChange:r}),u=e!==void 0,d=u?e:a;{const h=b.useRef(e!==void 0);b.useEffect(()=>{const p=h.current;p!==u&&console.warn(`${n} is changing from ${p?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=u},[u,n])}const c=b.useCallback(h=>{if(u){const p=xse(h)?h(e):h;p!==e&&s.current?.(p)}else i(h)},[u,e,i,s]);return[d,c]}function yse({defaultProp:e,onChange:t}){const[r,n]=b.useState(e),a=b.useRef(r),i=b.useRef(t);return vse(()=>{i.current=t},[t]),b.useEffect(()=>{a.current!==r&&(i.current?.(r),a.current=r)},[r,a]),[r,n,i]}function xse(e){return typeof e=="function"}function vN(e){const t=b.useRef({value:e,previous:e});return b.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var e3=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),bse="VisuallyHidden",t3=b.forwardRef((e,t)=>o.jsx(Je.span,{...e,ref:t,style:{...e3,...e.style}}));t3.displayName=bse;var wse=t3,Sse=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ls=new WeakMap,ih=new WeakMap,oh={},L1=0,r3=function(e){return e&&(e.host||r3(e.parentNode))},jse=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=r3(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Nse=function(e,t,r,n){var a=jse(t,Array.isArray(e)?e:[e]);oh[r]||(oh[r]=new WeakMap);var i=oh[r],s=[],u=new Set,d=new Set(a),c=function(p){!p||u.has(p)||(u.add(p),c(p.parentNode))};a.forEach(c);var h=function(p){!p||d.has(p)||Array.prototype.forEach.call(p.children,function(m){if(u.has(m))h(m);else try{var v=m.getAttribute(n),x=v!==null&&v!=="false",y=(Ls.get(m)||0)+1,w=(i.get(m)||0)+1;Ls.set(m,y),i.set(m,w),s.push(m),y===1&&x&&ih.set(m,!0),w===1&&m.setAttribute(r,"true"),x||m.setAttribute(n,"true")}catch(j){console.error("aria-hidden: cannot operate on ",m,j)}})};return h(t),u.clear(),L1++,function(){s.forEach(function(p){var m=Ls.get(p)-1,v=i.get(p)-1;Ls.set(p,m),i.set(p,v),m||(ih.has(p)||p.removeAttribute(n),ih.delete(p)),v||p.removeAttribute(r)}),L1--,L1||(Ls=new WeakMap,Ls=new WeakMap,ih=new WeakMap,oh={})}},yN=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=Sse(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),Nse(n,a,r,"aria-hidden")):function(){return null}},Ta=function(){return Ta=Object.assign||function(t){for(var r,n=1,a=arguments.length;n"u")return zse;var t=qse(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},Vse=o3(),nl="data-scroll-locked",Hse=function(e,t,r,n){var a=e.left,i=e.top,s=e.right,u=e.gap;return r===void 0&&(r="margin"),` - .`.concat(Cse,` { - overflow: hidden `).concat(n,`; - padding-right: `).concat(u,"px ").concat(n,`; - } - body[`).concat(nl,`] { - overflow: hidden `).concat(n,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&` - padding-left: `.concat(a,`px; - padding-top: `).concat(i,`px; - padding-right: `).concat(s,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(u,"px ").concat(n,`; - `),r==="padding"&&"padding-right: ".concat(u,"px ").concat(n,";")].filter(Boolean).join(""),` - } - - .`).concat(Xh,` { - right: `).concat(u,"px ").concat(n,`; - } - - .`).concat(Yh,` { - margin-right: `).concat(u,"px ").concat(n,`; - } - - .`).concat(Xh," .").concat(Xh,` { - right: 0 `).concat(n,`; - } - - .`).concat(Yh," .").concat(Yh,` { - margin-right: 0 `).concat(n,`; - } - - body[`).concat(nl,`] { - `).concat(Ese,": ").concat(u,`px; - } -`)},GR=function(){var e=parseInt(document.body.getAttribute(nl)||"0",10);return isFinite(e)?e:0},Wse=function(){b.useEffect(function(){return document.body.setAttribute(nl,(GR()+1).toString()),function(){var e=GR()-1;e<=0?document.body.removeAttribute(nl):document.body.setAttribute(nl,e.toString())}},[])},Gse=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=n===void 0?"margin":n;Wse();var i=b.useMemo(function(){return Use(a)},[a]);return b.createElement(Vse,{styles:Hse(i,!t,a,r?"":"!important")})},PS=!1;if(typeof window<"u")try{var sh=Object.defineProperty({},"passive",{get:function(){return PS=!0,!0}});window.addEventListener("test",sh,sh),window.removeEventListener("test",sh,sh)}catch{PS=!1}var $s=PS?{passive:!1}:!1,Kse=function(e){return e.tagName==="TEXTAREA"},s3=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!Kse(e)&&r[t]==="visible")},Xse=function(e){return s3(e,"overflowY")},Yse=function(e){return s3(e,"overflowX")},KR=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=l3(e,n);if(a){var i=c3(e,n),s=i[1],u=i[2];if(s>u)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Jse=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},Qse=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},l3=function(e,t){return e==="v"?Xse(t):Yse(t)},c3=function(e,t){return e==="v"?Jse(t):Qse(t)},Zse=function(e,t){return e==="h"&&t==="rtl"?-1:1},ele=function(e,t,r,n,a){var i=Zse(e,window.getComputedStyle(t).direction),s=i*n,u=r.target,d=t.contains(u),c=!1,h=s>0,p=0,m=0;do{if(!u)break;var v=c3(e,u),x=v[0],y=v[1],w=v[2],j=y-w-i*x;(x||j)&&l3(e,u)&&(p+=j,m+=x);var _=u.parentNode;u=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!d&&u!==document.body||d&&(t.contains(u)||t===u));return(h&&Math.abs(p)<1||!h&&Math.abs(m)<1)&&(c=!0),c},lh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},XR=function(e){return[e.deltaX,e.deltaY]},YR=function(e){return e&&"current"in e?e.current:e},tle=function(e,t){return e[0]===t[0]&&e[1]===t[1]},rle=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},nle=0,Bs=[];function ale(e){var t=b.useRef([]),r=b.useRef([0,0]),n=b.useRef(),a=b.useState(nle++)[0],i=b.useState(o3)[0],s=b.useRef(e);b.useEffect(function(){s.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var y=_se([e.lockRef.current],(e.shards||[]).map(YR),!0).filter(Boolean);return y.forEach(function(w){return w.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),y.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var u=b.useCallback(function(y,w){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!s.current.allowPinchZoom;var j=lh(y),_=r.current,C="deltaX"in y?y.deltaX:_[0]-j[0],A="deltaY"in y?y.deltaY:_[1]-j[1],E,O=y.target,T=Math.abs(C)>Math.abs(A)?"h":"v";if("touches"in y&&T==="h"&&O.type==="range")return!1;var k=window.getSelection(),M=k&&k.anchorNode,$=M?M===O||M.contains(O):!1;if($)return!1;var z=KR(T,O);if(!z)return!0;if(z?E=T:(E=T==="v"?"h":"v",z=KR(T,O)),!z)return!1;if(!n.current&&"changedTouches"in y&&(C||A)&&(n.current=E),!E)return!0;var F=n.current||E;return ele(F,w,y,F==="h"?C:A)},[]),d=b.useCallback(function(y){var w=y;if(!(!Bs.length||Bs[Bs.length-1]!==i)){var j="deltaY"in w?XR(w):lh(w),_=t.current.filter(function(E){return E.name===w.type&&(E.target===w.target||w.target===E.shadowParent)&&tle(E.delta,j)})[0];if(_&&_.should){w.cancelable&&w.preventDefault();return}if(!_){var C=(s.current.shards||[]).map(YR).filter(Boolean).filter(function(E){return E.contains(w.target)}),A=C.length>0?u(w,C[0]):!s.current.noIsolation;A&&w.cancelable&&w.preventDefault()}}},[]),c=b.useCallback(function(y,w,j,_){var C={name:y,delta:w,target:j,should:_,shadowParent:ile(j)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(A){return A!==C})},1)},[]),h=b.useCallback(function(y){r.current=lh(y),n.current=void 0},[]),p=b.useCallback(function(y){c(y.type,XR(y),y.target,u(y,e.lockRef.current))},[]),m=b.useCallback(function(y){c(y.type,lh(y),y.target,u(y,e.lockRef.current))},[]);b.useEffect(function(){return Bs.push(i),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",d,$s),document.addEventListener("touchmove",d,$s),document.addEventListener("touchstart",h,$s),function(){Bs=Bs.filter(function(y){return y!==i}),document.removeEventListener("wheel",d,$s),document.removeEventListener("touchmove",d,$s),document.removeEventListener("touchstart",h,$s)}},[]);var v=e.removeScrollBar,x=e.inert;return b.createElement(b.Fragment,null,x?b.createElement(i,{styles:rle(a)}):null,v?b.createElement(Gse,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ile(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ole=Ise(i3,ale);var ug=b.forwardRef(function(e,t){return b.createElement(cg,Ta({},e,{ref:t,sideCar:ole}))});ug.classNames=cg.classNames;var sle=[" ","Enter","ArrowUp","ArrowDown"],lle=[" ","Enter"],Qo="Select",[dg,fg,cle]=Eie(Qo),[ec]=wi(Qo,[cle,Zl]),hg=Zl(),[ule,uo]=ec(Qo),[dle,fle]=ec(Qo),u3=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:a,onOpenChange:i,value:s,defaultValue:u,onValueChange:d,dir:c,name:h,autoComplete:p,disabled:m,required:v,form:x}=e,y=hg(t),[w,j]=b.useState(null),[_,C]=b.useState(null),[A,E]=b.useState(!1),O=FM(c),[T,k]=Jo({prop:n,defaultProp:a??!1,onChange:i,caller:Qo}),[M,$]=Jo({prop:s,defaultProp:u,onChange:d,caller:Qo}),z=b.useRef(null),F=w?x||!!w.closest("form"):!0,[V,G]=b.useState(new Set),U=Array.from(V).map(H=>H.props.value).join(";");return o.jsx(pN,{...y,children:o.jsxs(ule,{required:v,scope:t,trigger:w,onTriggerChange:j,valueNode:_,onValueNodeChange:C,valueNodeHasChildren:A,onValueNodeHasChildrenChange:E,contentId:en(),value:M,onValueChange:$,open:T,onOpenChange:k,dir:O,triggerPointerDownPosRef:z,disabled:m,children:[o.jsx(dg.Provider,{scope:t,children:o.jsx(dle,{scope:e.__scopeSelect,onNativeOptionAdd:b.useCallback(H=>{G(W=>new Set(W).add(H))},[]),onNativeOptionRemove:b.useCallback(H=>{G(W=>{const B=new Set(W);return B.delete(H),B})},[]),children:r})}),F?o.jsxs(k3,{"aria-hidden":!0,required:v,tabIndex:-1,name:h,autoComplete:p,value:M,onChange:H=>$(H.target.value),disabled:m,form:x,children:[M===void 0?o.jsx("option",{value:""}):null,Array.from(V)]},U):null]})})};u3.displayName=Qo;var d3="SelectTrigger",f3=b.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...a}=e,i=hg(r),s=uo(d3,r),u=s.disabled||n,d=st(t,s.onTriggerChange),c=fg(r),h=b.useRef("touch"),[p,m,v]=I3(y=>{const w=c().filter(C=>!C.disabled),j=w.find(C=>C.value===s.value),_=M3(w,y,j);_!==void 0&&s.onValueChange(_.value)}),x=y=>{u||(s.onOpenChange(!0),v()),y&&(s.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)})};return o.jsx(lg,{asChild:!0,...i,children:o.jsx(Je.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":R3(s.value)?"":void 0,...a,ref:d,onClick:Ze(a.onClick,y=>{y.currentTarget.focus(),h.current!=="mouse"&&x(y)}),onPointerDown:Ze(a.onPointerDown,y=>{h.current=y.pointerType;const w=y.target;w.hasPointerCapture(y.pointerId)&&w.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&y.pointerType==="mouse"&&(x(y),y.preventDefault())}),onKeyDown:Ze(a.onKeyDown,y=>{const w=p.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&m(y.key),!(w&&y.key===" ")&&sle.includes(y.key)&&(x(),y.preventDefault())})})})});f3.displayName=d3;var h3="SelectValue",p3=b.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,children:i,placeholder:s="",...u}=e,d=uo(h3,r),{onValueNodeHasChildrenChange:c}=d,h=i!==void 0,p=st(t,d.onValueNodeChange);return rr(()=>{c(h)},[c,h]),o.jsx(Je.span,{...u,ref:p,style:{pointerEvents:"none"},children:R3(d.value)?o.jsx(o.Fragment,{children:s}):i})});p3.displayName=h3;var hle="SelectIcon",m3=b.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...a}=e;return o.jsx(Je.span,{"aria-hidden":!0,...a,ref:t,children:n||"▼"})});m3.displayName=hle;var ple="SelectPortal",g3=e=>o.jsx(fd,{asChild:!0,...e});g3.displayName=ple;var Zo="SelectContent",v3=b.forwardRef((e,t)=>{const r=uo(Zo,e.__scopeSelect),[n,a]=b.useState();if(rr(()=>{a(new DocumentFragment)},[]),!r.open){const i=n;return i?ed.createPortal(o.jsx(y3,{scope:e.__scopeSelect,children:o.jsx(dg.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),i):null}return o.jsx(x3,{...e,ref:t})});v3.displayName=Zo;var oa=10,[y3,fo]=ec(Zo),mle="SelectContentImpl",gle=dse("SelectContent.RemoveScroll"),x3=b.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:s,side:u,sideOffset:d,align:c,alignOffset:h,arrowPadding:p,collisionBoundary:m,collisionPadding:v,sticky:x,hideWhenDetached:y,avoidCollisions:w,...j}=e,_=uo(Zo,r),[C,A]=b.useState(null),[E,O]=b.useState(null),T=st(t,K=>A(K)),[k,M]=b.useState(null),[$,z]=b.useState(null),F=fg(r),[V,G]=b.useState(!1),U=b.useRef(!1);b.useEffect(()=>{if(C)return yN(C)},[C]),aN();const H=b.useCallback(K=>{const[Z,...ne]=F().map(Y=>Y.ref.current),[de]=ne.slice(-1),ge=document.activeElement;for(const Y of K)if(Y===ge||(Y?.scrollIntoView({block:"nearest"}),Y===Z&&E&&(E.scrollTop=0),Y===de&&E&&(E.scrollTop=E.scrollHeight),Y?.focus(),document.activeElement!==ge))return},[F,E]),W=b.useCallback(()=>H([k,C]),[H,k,C]);b.useEffect(()=>{V&&W()},[V,W]);const{onOpenChange:B,triggerPointerDownPosRef:Q}=_;b.useEffect(()=>{if(C){let K={x:0,y:0};const Z=de=>{K={x:Math.abs(Math.round(de.pageX)-(Q.current?.x??0)),y:Math.abs(Math.round(de.pageY)-(Q.current?.y??0))}},ne=de=>{K.x<=10&&K.y<=10?de.preventDefault():C.contains(de.target)||B(!1),document.removeEventListener("pointermove",Z),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",Z),document.addEventListener("pointerup",ne,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Z),document.removeEventListener("pointerup",ne,{capture:!0})}}},[C,B,Q]),b.useEffect(()=>{const K=()=>B(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[B]);const[R,L]=I3(K=>{const Z=F().filter(ge=>!ge.disabled),ne=Z.find(ge=>ge.ref.current===document.activeElement),de=M3(Z,K,ne);de&&setTimeout(()=>de.ref.current.focus())}),I=b.useCallback((K,Z,ne)=>{const de=!U.current&&!ne;(_.value!==void 0&&_.value===Z||de)&&(M(K),de&&(U.current=!0))},[_.value]),X=b.useCallback(()=>C?.focus(),[C]),ee=b.useCallback((K,Z,ne)=>{const de=!U.current&&!ne;(_.value!==void 0&&_.value===Z||de)&&z(K)},[_.value]),ie=n==="popper"?AS:b3,re=ie===AS?{side:u,sideOffset:d,align:c,alignOffset:h,arrowPadding:p,collisionBoundary:m,collisionPadding:v,sticky:x,hideWhenDetached:y,avoidCollisions:w}:{};return o.jsx(y3,{scope:r,content:C,viewport:E,onViewportChange:O,itemRefCallback:I,selectedItem:k,onItemLeave:X,itemTextRefCallback:ee,focusSelectedItem:W,selectedItemText:$,position:n,isPositioned:V,searchRef:R,children:o.jsx(ug,{as:gle,allowPinchZoom:!0,children:o.jsx(ng,{asChild:!0,trapped:_.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:Ze(a,K=>{_.trigger?.focus({preventScroll:!0}),K.preventDefault()}),children:o.jsx(ud,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:o.jsx(ie,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:K=>K.preventDefault(),...j,...re,onPlaced:()=>G(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...j.style},onKeyDown:Ze(j.onKeyDown,K=>{const Z=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!Z&&K.key.length===1&&L(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let de=F().filter(ge=>!ge.disabled).map(ge=>ge.ref.current);if(["ArrowUp","End"].includes(K.key)&&(de=de.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const ge=K.target,Y=de.indexOf(ge);de=de.slice(Y+1)}setTimeout(()=>H(de)),K.preventDefault()}})})})})})})});x3.displayName=mle;var vle="SelectItemAlignedPosition",b3=b.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...a}=e,i=uo(Zo,r),s=fo(Zo,r),[u,d]=b.useState(null),[c,h]=b.useState(null),p=st(t,T=>h(T)),m=fg(r),v=b.useRef(!1),x=b.useRef(!0),{viewport:y,selectedItem:w,selectedItemText:j,focusSelectedItem:_}=s,C=b.useCallback(()=>{if(i.trigger&&i.valueNode&&u&&c&&y&&w&&j){const T=i.trigger.getBoundingClientRect(),k=c.getBoundingClientRect(),M=i.valueNode.getBoundingClientRect(),$=j.getBoundingClientRect();if(i.dir!=="rtl"){const ge=$.left-k.left,Y=M.left-ge,we=T.left-Y,Ce=T.width+we,Be=Math.max(Ce,k.width),et=window.innerWidth-oa,tt=nw(Y,[oa,Math.max(oa,et-Be)]);u.style.minWidth=Ce+"px",u.style.left=tt+"px"}else{const ge=k.right-$.right,Y=window.innerWidth-M.right-ge,we=window.innerWidth-T.right-Y,Ce=T.width+we,Be=Math.max(Ce,k.width),et=window.innerWidth-oa,tt=nw(Y,[oa,Math.max(oa,et-Be)]);u.style.minWidth=Ce+"px",u.style.right=tt+"px"}const z=m(),F=window.innerHeight-oa*2,V=y.scrollHeight,G=window.getComputedStyle(c),U=parseInt(G.borderTopWidth,10),H=parseInt(G.paddingTop,10),W=parseInt(G.borderBottomWidth,10),B=parseInt(G.paddingBottom,10),Q=U+H+V+B+W,R=Math.min(w.offsetHeight*5,Q),L=window.getComputedStyle(y),I=parseInt(L.paddingTop,10),X=parseInt(L.paddingBottom,10),ee=T.top+T.height/2-oa,ie=F-ee,re=w.offsetHeight/2,K=w.offsetTop+re,Z=U+H+K,ne=Q-Z;if(Z<=ee){const ge=z.length>0&&w===z[z.length-1].ref.current;u.style.bottom="0px";const Y=c.clientHeight-y.offsetTop-y.offsetHeight,we=Math.max(ie,re+(ge?X:0)+Y+W),Ce=Z+we;u.style.height=Ce+"px"}else{const ge=z.length>0&&w===z[0].ref.current;u.style.top="0px";const we=Math.max(ee,U+y.offsetTop+(ge?I:0)+re)+ne;u.style.height=we+"px",y.scrollTop=Z-ee+y.offsetTop}u.style.margin=`${oa}px 0`,u.style.minHeight=R+"px",u.style.maxHeight=F+"px",n?.(),requestAnimationFrame(()=>v.current=!0)}},[m,i.trigger,i.valueNode,u,c,y,w,j,i.dir,n]);rr(()=>C(),[C]);const[A,E]=b.useState();rr(()=>{c&&E(window.getComputedStyle(c).zIndex)},[c]);const O=b.useCallback(T=>{T&&x.current===!0&&(C(),_?.(),x.current=!1)},[C,_]);return o.jsx(xle,{scope:r,contentWrapper:u,shouldExpandOnScrollRef:v,onScrollButtonChange:O,children:o.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:A},children:o.jsx(Je.div,{...a,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});b3.displayName=vle;var yle="SelectPopperPosition",AS=b.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:a=oa,...i}=e,s=hg(r);return o.jsx(mN,{...s,...i,ref:t,align:n,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});AS.displayName=yle;var[xle,xN]=ec(Zo,{}),TS="SelectViewport",w3=b.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...a}=e,i=fo(TS,r),s=xN(TS,r),u=st(t,i.onViewportChange),d=b.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),o.jsx(dg.Slot,{scope:r,children:o.jsx(Je.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Ze(a.onScroll,c=>{const h=c.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=s;if(m?.current&&p){const v=Math.abs(d.current-h.scrollTop);if(v>0){const x=window.innerHeight-oa*2,y=parseFloat(p.style.minHeight),w=parseFloat(p.style.height),j=Math.max(y,w);if(j0?A:0,p.style.justifyContent="flex-end")}}}d.current=h.scrollTop})})})]})});w3.displayName=TS;var S3="SelectGroup",[ble,wle]=ec(S3),Sle=b.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=en();return o.jsx(ble,{scope:r,id:a,children:o.jsx(Je.div,{role:"group","aria-labelledby":a,...n,ref:t})})});Sle.displayName=S3;var j3="SelectLabel",jle=b.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=wle(j3,r);return o.jsx(Je.div,{id:a.id,...n,ref:t})});jle.displayName=j3;var dm="SelectItem",[Nle,N3]=ec(dm),_3=b.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:a=!1,textValue:i,...s}=e,u=uo(dm,r),d=fo(dm,r),c=u.value===n,[h,p]=b.useState(i??""),[m,v]=b.useState(!1),x=st(t,_=>d.itemRefCallback?.(_,n,a)),y=en(),w=b.useRef("touch"),j=()=>{a||(u.onValueChange(n),u.onOpenChange(!1))};if(n==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(Nle,{scope:r,value:n,disabled:a,textId:y,isSelected:c,onItemTextChange:b.useCallback(_=>{p(C=>C||(_?.textContent??"").trim())},[]),children:o.jsx(dg.ItemSlot,{scope:r,value:n,disabled:a,textValue:h,children:o.jsx(Je.div,{role:"option","aria-labelledby":y,"data-highlighted":m?"":void 0,"aria-selected":c&&m,"data-state":c?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...s,ref:x,onFocus:Ze(s.onFocus,()=>v(!0)),onBlur:Ze(s.onBlur,()=>v(!1)),onClick:Ze(s.onClick,()=>{w.current!=="mouse"&&j()}),onPointerUp:Ze(s.onPointerUp,()=>{w.current==="mouse"&&j()}),onPointerDown:Ze(s.onPointerDown,_=>{w.current=_.pointerType}),onPointerMove:Ze(s.onPointerMove,_=>{w.current=_.pointerType,a?d.onItemLeave?.():w.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ze(s.onPointerLeave,_=>{_.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Ze(s.onKeyDown,_=>{d.searchRef?.current!==""&&_.key===" "||(lle.includes(_.key)&&j(),_.key===" "&&_.preventDefault())})})})})});_3.displayName=dm;var au="SelectItemText",C3=b.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,...i}=e,s=uo(au,r),u=fo(au,r),d=N3(au,r),c=fle(au,r),[h,p]=b.useState(null),m=st(t,j=>p(j),d.onItemTextChange,j=>u.itemTextRefCallback?.(j,d.value,d.disabled)),v=h?.textContent,x=b.useMemo(()=>o.jsx("option",{value:d.value,disabled:d.disabled,children:v},d.value),[d.disabled,d.value,v]),{onNativeOptionAdd:y,onNativeOptionRemove:w}=c;return rr(()=>(y(x),()=>w(x)),[y,w,x]),o.jsxs(o.Fragment,{children:[o.jsx(Je.span,{id:d.textId,...i,ref:m}),d.isSelected&&s.valueNode&&!s.valueNodeHasChildren?ed.createPortal(i.children,s.valueNode):null]})});C3.displayName=au;var E3="SelectItemIndicator",O3=b.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return N3(E3,r).isSelected?o.jsx(Je.span,{"aria-hidden":!0,...n,ref:t}):null});O3.displayName=E3;var kS="SelectScrollUpButton",P3=b.forwardRef((e,t)=>{const r=fo(kS,e.__scopeSelect),n=xN(kS,e.__scopeSelect),[a,i]=b.useState(!1),s=st(t,n.onScrollButtonChange);return rr(()=>{if(r.viewport&&r.isPositioned){let u=function(){const c=d.scrollTop>0;i(c)};const d=r.viewport;return u(),d.addEventListener("scroll",u),()=>d.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),a?o.jsx(T3,{...e,ref:s,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=r;u&&d&&(u.scrollTop=u.scrollTop-d.offsetHeight)}}):null});P3.displayName=kS;var RS="SelectScrollDownButton",A3=b.forwardRef((e,t)=>{const r=fo(RS,e.__scopeSelect),n=xN(RS,e.__scopeSelect),[a,i]=b.useState(!1),s=st(t,n.onScrollButtonChange);return rr(()=>{if(r.viewport&&r.isPositioned){let u=function(){const c=d.scrollHeight-d.clientHeight,h=Math.ceil(d.scrollTop)d.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),a?o.jsx(T3,{...e,ref:s,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=r;u&&d&&(u.scrollTop=u.scrollTop+d.offsetHeight)}}):null});A3.displayName=RS;var T3=b.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...a}=e,i=fo("SelectScrollButton",r),s=b.useRef(null),u=fg(r),d=b.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return b.useEffect(()=>()=>d(),[d]),rr(()=>{u().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[u]),o.jsx(Je.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Ze(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(n,50))}),onPointerMove:Ze(a.onPointerMove,()=>{i.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(n,50))}),onPointerLeave:Ze(a.onPointerLeave,()=>{d()})})}),_le="SelectSeparator",Cle=b.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return o.jsx(Je.div,{"aria-hidden":!0,...n,ref:t})});Cle.displayName=_le;var IS="SelectArrow",Ele=b.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=hg(r),i=uo(IS,r),s=fo(IS,r);return i.open&&s.position==="popper"?o.jsx(gN,{...a,...n,ref:t}):null});Ele.displayName=IS;var Ole="SelectBubbleInput",k3=b.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const a=b.useRef(null),i=st(n,a),s=vN(t);return b.useEffect(()=>{const u=a.current;if(!u)return;const d=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(d,"value").set;if(s!==t&&h){const p=new Event("change",{bubbles:!0});h.call(u,t),u.dispatchEvent(p)}},[s,t]),o.jsx(Je.select,{...r,style:{...e3,...r.style},ref:i,defaultValue:t})});k3.displayName=Ole;function R3(e){return e===""||e===void 0}function I3(e){const t=Fr(e),r=b.useRef(""),n=b.useRef(0),a=b.useCallback(s=>{const u=r.current+s;t(u),(function d(c){r.current=c,window.clearTimeout(n.current),c!==""&&(n.current=window.setTimeout(()=>d(""),1e3))})(u)},[t]),i=b.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,a,i]}function M3(e,t,r){const a=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=r?e.indexOf(r):-1;let s=Ple(e,Math.max(i,0));a.length===1&&(s=s.filter(c=>c!==r));const d=s.find(c=>c.textValue.toLowerCase().startsWith(a.toLowerCase()));return d!==r?d:void 0}function Ple(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Ale=u3,Tle=f3,kle=p3,Rle=m3,Ile=g3,Mle=v3,Dle=w3,Lle=_3,$le=C3,Ble=O3,Fle=P3,zle=A3;function Ve({...e}){return o.jsx(Ale,{"data-slot":"select",...e})}function He({...e}){return o.jsx(kle,{"data-slot":"select-value",...e})}function We({className:e,size:t="default",children:r,...n}){return o.jsxs(Tle,{"data-slot":"select-trigger","data-size":t,className:Ee("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between gap-2 rounded-md border bg-input-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n,children:[r,o.jsx(Rle,{asChild:!0,children:o.jsx(al,{className:"size-4 opacity-50"})})]})}function Ge({className:e,children:t,position:r="popper",...n}){return o.jsx(Ile,{children:o.jsxs(Mle,{"data-slot":"select-content",className:Ee("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[o.jsx(qle,{}),o.jsx(Dle,{className:Ee("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),o.jsx(Ule,{})]})})}function Ne({className:e,children:t,...r}){return o.jsxs(Lle,{"data-slot":"select-item",className:Ee("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[o.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:o.jsx(Ble,{children:o.jsx(xM,{className:"size-4"})})}),o.jsx($le,{children:t})]})}function qle({className:e,...t}){return o.jsx(Fle,{"data-slot":"select-scroll-up-button",className:Ee("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(Dz,{className:"size-4"})})}function Ule({className:e,...t}){return o.jsx(zle,{"data-slot":"select-scroll-down-button",className:Ee("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(al,{className:"size-4"})})}function Vle(e){const t=Hle(e),r=b.forwardRef((n,a)=>{const{children:i,...s}=n,u=b.Children.toArray(i),d=u.find(Gle);if(d){const c=d.props.children,h=u.map(p=>p===d?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:p);return o.jsx(t,{...s,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,h):null})}return o.jsx(t,{...s,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function Hle(e){const t=b.forwardRef((r,n)=>{const{children:a,...i}=r;if(b.isValidElement(a)){const s=Xle(a),u=Kle(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Wn(n,s):s),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Wle=Symbol("radix.slottable");function Gle(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Wle}function Kle(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function Xle(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var pg="Dialog",[D3]=wi(pg),[Yle,wa]=D3(pg),L3=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:a,onOpenChange:i,modal:s=!0}=e,u=b.useRef(null),d=b.useRef(null),[c,h]=Jo({prop:n,defaultProp:a??!1,onChange:i,caller:pg});return o.jsx(Yle,{scope:t,triggerRef:u,contentRef:d,contentId:en(),titleId:en(),descriptionId:en(),open:c,onOpenChange:h,onOpenToggle:b.useCallback(()=>h(p=>!p),[h]),modal:s,children:r})};L3.displayName=pg;var $3="DialogTrigger",Jle=b.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=wa($3,r),i=st(t,a.triggerRef);return o.jsx(Je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":SN(a.open),...n,ref:i,onClick:Ze(e.onClick,a.onOpenToggle)})});Jle.displayName=$3;var bN="DialogPortal",[Qle,B3]=D3(bN,{forceMount:void 0}),F3=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:a}=e,i=wa(bN,t);return o.jsx(Qle,{scope:t,forceMount:r,children:b.Children.map(n,s=>o.jsx(_n,{present:r||i.open,children:o.jsx(fd,{asChild:!0,container:a,children:s})}))})};F3.displayName=bN;var fm="DialogOverlay",z3=b.forwardRef((e,t)=>{const r=B3(fm,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,i=wa(fm,e.__scopeDialog);return i.modal?o.jsx(_n,{present:n||i.open,children:o.jsx(ece,{...a,ref:t})}):null});z3.displayName=fm;var Zle=Vle("DialogOverlay.RemoveScroll"),ece=b.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=wa(fm,r);return o.jsx(ug,{as:Zle,allowPinchZoom:!0,shards:[a.contentRef],children:o.jsx(Je.div,{"data-state":SN(a.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),es="DialogContent",q3=b.forwardRef((e,t)=>{const r=B3(es,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,i=wa(es,e.__scopeDialog);return o.jsx(_n,{present:n||i.open,children:i.modal?o.jsx(tce,{...a,ref:t}):o.jsx(rce,{...a,ref:t})})});q3.displayName=es;var tce=b.forwardRef((e,t)=>{const r=wa(es,e.__scopeDialog),n=b.useRef(null),a=st(t,r.contentRef,n);return b.useEffect(()=>{const i=n.current;if(i)return yN(i)},[]),o.jsx(U3,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ze(e.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Ze(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,u=s.button===0&&s.ctrlKey===!0;(s.button===2||u)&&i.preventDefault()}),onFocusOutside:Ze(e.onFocusOutside,i=>i.preventDefault())})}),rce=b.forwardRef((e,t)=>{const r=wa(es,e.__scopeDialog),n=b.useRef(!1),a=b.useRef(!1);return o.jsx(U3,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(n.current||r.triggerRef.current?.focus(),i.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=i.target;r.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),U3=b.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:i,...s}=e,u=wa(es,r),d=b.useRef(null),c=st(t,d);return aN(),o.jsxs(o.Fragment,{children:[o.jsx(ng,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:i,children:o.jsx(ud,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":SN(u.open),...s,ref:c,onDismiss:()=>u.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(nce,{titleId:u.titleId}),o.jsx(ice,{contentRef:d,descriptionId:u.descriptionId})]})]})}),wN="DialogTitle",V3=b.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=wa(wN,r);return o.jsx(Je.h2,{id:a.titleId,...n,ref:t})});V3.displayName=wN;var H3="DialogDescription",W3=b.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=wa(H3,r);return o.jsx(Je.p,{id:a.descriptionId,...n,ref:t})});W3.displayName=H3;var G3="DialogClose",K3=b.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=wa(G3,r);return o.jsx(Je.button,{type:"button",...n,ref:t,onClick:Ze(e.onClick,()=>a.onOpenChange(!1))})});K3.displayName=G3;function SN(e){return e?"open":"closed"}var X3="DialogTitleWarning",[qpe,Y3]=qq(X3,{contentName:es,titleName:wN,docsSlug:"dialog"}),nce=({titleId:e})=>{const t=Y3(X3),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},ace="DialogDescriptionWarning",ice=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Y3(ace).contentName}}.`;return b.useEffect(()=>{const a=e.current?.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},J3=L3,Q3=F3,Z3=z3,e5=q3,oce=V3,sce=W3,lce=K3;function vt({...e}){return o.jsx(J3,{"data-slot":"dialog",...e})}function cce({...e}){return o.jsx(Q3,{"data-slot":"dialog-portal",...e})}const t5=b.forwardRef(({className:e,...t},r)=>o.jsx(Z3,{ref:r,"data-slot":"dialog-overlay",className:Ee("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t}));t5.displayName="DialogOverlay";const pt=b.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(cce,{"data-slot":"dialog-portal",children:[o.jsx(t5,{}),o.jsxs(e5,{ref:n,"data-slot":"dialog-content",className:Ee("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...r,children:[t,o.jsxs(lce,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[o.jsx(eo,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));pt.displayName="DialogContent";function yt({className:e,...t}){return o.jsx("div",{"data-slot":"dialog-header",className:Ee("flex flex-col gap-2 text-center sm:text-left",e),...t})}function wt({className:e,...t}){return o.jsx("div",{"data-slot":"dialog-footer",className:Ee("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function xt({className:e,...t}){return o.jsx(oce,{"data-slot":"dialog-title",className:Ee("text-lg leading-none font-semibold",e),...t})}function Pt({className:e,...t}){return o.jsx(sce,{"data-slot":"dialog-description",className:Ee("text-muted-foreground text-sm",e),...t})}var uce=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dce=uce.reduce((e,t)=>{const r=JS(`Primitive.${t}`),n=b.forwardRef((a,i)=>{const{asChild:s,...u}=a,d=s?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(d,{...u,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),fce="Label",r5=b.forwardRef((e,t)=>o.jsx(dce.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));r5.displayName=fce;var hce=r5;function ue({className:e,...t}){return o.jsx(hce,{"data-slot":"label",className:Ee("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}var mg="Switch",[pce]=wi(mg),[mce,gce]=pce(mg),n5=b.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:a,defaultChecked:i,required:s,disabled:u,value:d="on",onCheckedChange:c,form:h,...p}=e,[m,v]=b.useState(null),x=st(t,C=>v(C)),y=b.useRef(!1),w=m?h||!!m.closest("form"):!0,[j,_]=Jo({prop:a,defaultProp:i??!1,onChange:c,caller:mg});return o.jsxs(mce,{scope:r,checked:j,disabled:u,children:[o.jsx(Je.button,{type:"button",role:"switch","aria-checked":j,"aria-required":s,"data-state":s5(j),"data-disabled":u?"":void 0,disabled:u,value:d,...p,ref:x,onClick:Ze(e.onClick,C=>{_(A=>!A),w&&(y.current=C.isPropagationStopped(),y.current||C.stopPropagation())})}),w&&o.jsx(o5,{control:m,bubbles:!y.current,name:n,value:d,checked:j,required:s,disabled:u,form:h,style:{transform:"translateX(-100%)"}})]})});n5.displayName=mg;var a5="SwitchThumb",i5=b.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,a=gce(a5,r);return o.jsx(Je.span,{"data-state":s5(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});i5.displayName=a5;var vce="SwitchBubbleInput",o5=b.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...a},i)=>{const s=b.useRef(null),u=st(s,i),d=vN(r),c=dN(t);return b.useEffect(()=>{const h=s.current;if(!h)return;const p=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==r&&v){const x=new Event("click",{bubbles:n});v.call(h,r),h.dispatchEvent(x)}},[d,r,n]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:u,style:{...a.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});o5.displayName=vce;function s5(e){return e?"checked":"unchecked"}var yce=n5,xce=i5;function Gt({className:e,...t}){return o.jsx(yce,{"data-slot":"switch",className:Ee("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-switch-background focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:o.jsx(xce,{"data-slot":"switch-thumb",className:Ee("bg-card dark:data-[state=unchecked]:bg-card-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}function Fa(e){return Math.max(1,e)}function bce(e){const t=wce(e),r=b.forwardRef((n,a)=>{const{children:i,...s}=n,u=b.Children.toArray(i),d=u.find(jce);if(d){const c=d.props.children,h=u.map(p=>p===d?b.Children.count(c)>1?b.Children.only(null):b.isValidElement(c)?c.props.children:null:p);return o.jsx(t,{...s,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,h):null})}return o.jsx(t,{...s,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function wce(e){const t=b.forwardRef((r,n)=>{const{children:a,...i}=r;if(b.isValidElement(a)){const s=_ce(a),u=Nce(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Wn(n,s):s),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Sce=Symbol("radix.slottable");function jce(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Sce}function Nce(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...u)=>{const d=i(...u);return a(...u),d}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function _ce(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var gg="Popover",[l5]=wi(gg,[Zl]),hd=Zl(),[Cce,ho]=l5(gg),c5=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:a,onOpenChange:i,modal:s=!1}=e,u=hd(t),d=b.useRef(null),[c,h]=b.useState(!1),[p,m]=Jo({prop:n,defaultProp:a??!1,onChange:i,caller:gg});return o.jsx(pN,{...u,children:o.jsx(Cce,{scope:t,contentId:en(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:b.useCallback(()=>m(v=>!v),[m]),hasCustomAnchor:c,onCustomAnchorAdd:b.useCallback(()=>h(!0),[]),onCustomAnchorRemove:b.useCallback(()=>h(!1),[]),modal:s,children:r})})};c5.displayName=gg;var u5="PopoverAnchor",Ece=b.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=ho(u5,r),i=hd(r),{onCustomAnchorAdd:s,onCustomAnchorRemove:u}=a;return b.useEffect(()=>(s(),()=>u()),[s,u]),o.jsx(lg,{...i,...n,ref:t})});Ece.displayName=u5;var d5="PopoverTrigger",f5=b.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=ho(d5,r),i=hd(r),s=st(t,a.triggerRef),u=o.jsx(Je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":v5(a.open),...n,ref:s,onClick:Ze(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?u:o.jsx(lg,{asChild:!0,...i,children:u})});f5.displayName=d5;var jN="PopoverPortal",[Oce,Pce]=l5(jN,{forceMount:void 0}),h5=e=>{const{__scopePopover:t,forceMount:r,children:n,container:a}=e,i=ho(jN,t);return o.jsx(Oce,{scope:t,forceMount:r,children:o.jsx(_n,{present:r||i.open,children:o.jsx(fd,{asChild:!0,container:a,children:n})})})};h5.displayName=jN;var Ml="PopoverContent",p5=b.forwardRef((e,t)=>{const r=Pce(Ml,e.__scopePopover),{forceMount:n=r.forceMount,...a}=e,i=ho(Ml,e.__scopePopover);return o.jsx(_n,{present:n||i.open,children:i.modal?o.jsx(Tce,{...a,ref:t}):o.jsx(kce,{...a,ref:t})})});p5.displayName=Ml;var Ace=bce("PopoverContent.RemoveScroll"),Tce=b.forwardRef((e,t)=>{const r=ho(Ml,e.__scopePopover),n=b.useRef(null),a=st(t,n),i=b.useRef(!1);return b.useEffect(()=>{const s=n.current;if(s)return yN(s)},[]),o.jsx(ug,{as:Ace,allowPinchZoom:!0,children:o.jsx(m5,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ze(e.onCloseAutoFocus,s=>{s.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:Ze(e.onPointerDownOutside,s=>{const u=s.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,c=u.button===2||d;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Ze(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),kce=b.forwardRef((e,t)=>{const r=ho(Ml,e.__scopePopover),n=b.useRef(!1),a=b.useRef(!1);return o.jsx(m5,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(n.current||r.triggerRef.current?.focus(),i.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=i.target;r.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),m5=b.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:c,onInteractOutside:h,...p}=e,m=ho(Ml,r),v=hd(r);return aN(),o.jsx(ng,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:i,children:o.jsx(ud,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:h,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:c,onDismiss:()=>m.onOpenChange(!1),children:o.jsx(mN,{"data-state":v5(m.open),role:"dialog",id:m.contentId,...v,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),g5="PopoverClose",Rce=b.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=ho(g5,r);return o.jsx(Je.button,{type:"button",...n,ref:t,onClick:Ze(e.onClick,()=>a.onOpenChange(!1))})});Rce.displayName=g5;var Ice="PopoverArrow",Mce=b.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=hd(r);return o.jsx(gN,{...a,...n,ref:t})});Mce.displayName=Ice;function v5(e){return e?"open":"closed"}var Dce=c5,Lce=f5,$ce=h5,Bce=p5;function ga({...e}){return o.jsx(Dce,{"data-slot":"popover",...e})}function va({...e}){return o.jsx(Lce,{"data-slot":"popover-trigger",...e})}function ya({className:e,align:t="center",sideOffset:r=4,...n}){return o.jsx($ce,{children:o.jsx(Bce,{"data-slot":"popover-content",align:t,sideOffset:r,className:Ee("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...n})})}var vg="Checkbox",[Fce]=wi(vg),[zce,NN]=Fce(vg);function qce(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:a,disabled:i,form:s,name:u,onCheckedChange:d,required:c,value:h="on",internal_do_not_use_render:p}=e,[m,v]=Jo({prop:r,defaultProp:a??!1,onChange:d,caller:vg}),[x,y]=b.useState(null),[w,j]=b.useState(null),_=b.useRef(!1),C=x?!!s||!!x.closest("form"):!0,A={checked:m,disabled:i,setChecked:v,control:x,setControl:y,name:u,form:s,value:h,hasConsumerStoppedPropagationRef:_,required:c,defaultChecked:ro(a)?!1:a,isFormControl:C,bubbleInput:w,setBubbleInput:j};return o.jsx(zce,{scope:t,...A,children:Uce(p)?p(A):n})}var y5="CheckboxTrigger",x5=b.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},a)=>{const{control:i,value:s,disabled:u,checked:d,required:c,setControl:h,setChecked:p,hasConsumerStoppedPropagationRef:m,isFormControl:v,bubbleInput:x}=NN(y5,e),y=st(a,h),w=b.useRef(d);return b.useEffect(()=>{const j=i?.form;if(j){const _=()=>p(w.current);return j.addEventListener("reset",_),()=>j.removeEventListener("reset",_)}},[i,p]),o.jsx(Je.button,{type:"button",role:"checkbox","aria-checked":ro(d)?"mixed":d,"aria-required":c,"data-state":_5(d),"data-disabled":u?"":void 0,disabled:u,value:s,...n,ref:y,onKeyDown:Ze(t,j=>{j.key==="Enter"&&j.preventDefault()}),onClick:Ze(r,j=>{p(_=>ro(_)?!0:!_),x&&v&&(m.current=j.isPropagationStopped(),m.current||j.stopPropagation())})})});x5.displayName=y5;var b5=b.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:a,defaultChecked:i,required:s,disabled:u,value:d,onCheckedChange:c,form:h,...p}=e;return o.jsx(qce,{__scopeCheckbox:r,checked:a,defaultChecked:i,disabled:u,required:s,onCheckedChange:c,name:n,form:h,value:d,internal_do_not_use_render:({isFormControl:m})=>o.jsxs(o.Fragment,{children:[o.jsx(x5,{...p,ref:t,__scopeCheckbox:r}),m&&o.jsx(N5,{__scopeCheckbox:r})]})})});b5.displayName=vg;var w5="CheckboxIndicator",S5=b.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...a}=e,i=NN(w5,r);return o.jsx(_n,{present:n||ro(i.checked)||i.checked===!0,children:o.jsx(Je.span,{"data-state":_5(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});S5.displayName=w5;var j5="CheckboxBubbleInput",N5=b.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:a,checked:i,defaultChecked:s,required:u,disabled:d,name:c,value:h,form:p,bubbleInput:m,setBubbleInput:v}=NN(j5,e),x=st(r,v),y=vN(i),w=dN(n);b.useEffect(()=>{const _=m;if(!_)return;const C=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(C,"checked").set,O=!a.current;if(y!==i&&E){const T=new Event("click",{bubbles:O});_.indeterminate=ro(i),E.call(_,ro(i)?!1:i),_.dispatchEvent(T)}},[m,y,i,a]);const j=b.useRef(ro(i)?!1:i);return o.jsx(Je.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??j.current,required:u,disabled:d,name:c,value:h,form:p,...t,tabIndex:-1,ref:x,style:{...t.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});N5.displayName=j5;function Uce(e){return typeof e=="function"}function ro(e){return e==="indeterminate"}function _5(e){return ro(e)?"indeterminate":e?"checked":"unchecked"}function Dl({className:e,...t}){return o.jsx(b5,{"data-slot":"checkbox",className:Ee("peer border bg-input-background dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:o.jsx(S5,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:o.jsx(xM,{className:"size-3.5"})})})}var JR=1,Vce=.9,Hce=.8,Wce=.17,z1=.1,q1=.999,Gce=.9999,Kce=.99,Xce=/[\\\/_+.#"@\[\(\{&]/,Yce=/[\\\/_+.#"@\[\(\{&]/g,Jce=/[\s-]/,C5=/[\s-]/g;function MS(e,t,r,n,a,i,s){if(i===t.length)return a===e.length?JR:Kce;var u=`${a},${i}`;if(s[u]!==void 0)return s[u];for(var d=n.charAt(i),c=r.indexOf(d,a),h=0,p,m,v,x;c>=0;)p=MS(e,t,r,n,c+1,i+1,s),p>h&&(c===a?p*=JR:Xce.test(e.charAt(c-1))?(p*=Hce,v=e.slice(a,c-1).match(Yce),v&&a>0&&(p*=Math.pow(q1,v.length))):Jce.test(e.charAt(c-1))?(p*=Vce,x=e.slice(a,c-1).match(C5),x&&a>0&&(p*=Math.pow(q1,x.length))):(p*=Wce,a>0&&(p*=Math.pow(q1,c-a))),e.charAt(c)!==t.charAt(i)&&(p*=Gce)),(pp&&(p=m*z1)),p>h&&(h=p),c=r.indexOf(d,c+1);return s[u]=h,h}function QR(e){return e.toLowerCase().replace(C5," ")}function Qce(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,MS(e,t,QR(e),QR(t),0,0,{})}var Kc='[cmdk-group=""]',U1='[cmdk-group-items=""]',Zce='[cmdk-group-heading=""]',E5='[cmdk-item=""]',ZR=`${E5}:not([aria-disabled="true"])`,DS="cmdk-item-select",Vs="data-value",eue=(e,t,r)=>Qce(e,t,r),O5=b.createContext(void 0),pd=()=>b.useContext(O5),P5=b.createContext(void 0),_N=()=>b.useContext(P5),A5=b.createContext(void 0),T5=b.forwardRef((e,t)=>{let r=Hs(()=>{var I,X;return{search:"",value:(X=(I=e.value)!=null?I:e.defaultValue)!=null?X:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=Hs(()=>new Set),a=Hs(()=>new Map),i=Hs(()=>new Map),s=Hs(()=>new Set),u=k5(e),{label:d,children:c,value:h,onValueChange:p,filter:m,shouldFilter:v,loop:x,disablePointerSelection:y=!1,vimBindings:w=!0,...j}=e,_=en(),C=en(),A=en(),E=b.useRef(null),O=due();ts(()=>{if(h!==void 0){let I=h.trim();r.current.value=I,T.emit()}},[h]),ts(()=>{O(6,V)},[]);let T=b.useMemo(()=>({subscribe:I=>(s.current.add(I),()=>s.current.delete(I)),snapshot:()=>r.current,setState:(I,X,ee)=>{var ie,re,K,Z;if(!Object.is(r.current[I],X)){if(r.current[I]=X,I==="search")F(),$(),O(1,z);else if(I==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ne=document.getElementById(A);ne?ne.focus():(ie=document.getElementById(_))==null||ie.focus()}if(O(7,()=>{var ne;r.current.selectedItemId=(ne=G())==null?void 0:ne.id,T.emit()}),ee||O(5,V),((re=u.current)==null?void 0:re.value)!==void 0){let ne=X??"";(Z=(K=u.current).onValueChange)==null||Z.call(K,ne);return}}T.emit()}},emit:()=>{s.current.forEach(I=>I())}}),[]),k=b.useMemo(()=>({value:(I,X,ee)=>{var ie;X!==((ie=i.current.get(I))==null?void 0:ie.value)&&(i.current.set(I,{value:X,keywords:ee}),r.current.filtered.items.set(I,M(X,ee)),O(2,()=>{$(),T.emit()}))},item:(I,X)=>(n.current.add(I),X&&(a.current.has(X)?a.current.get(X).add(I):a.current.set(X,new Set([I]))),O(3,()=>{F(),$(),r.current.value||z(),T.emit()}),()=>{i.current.delete(I),n.current.delete(I),r.current.filtered.items.delete(I);let ee=G();O(4,()=>{F(),ee?.getAttribute("id")===I&&z(),T.emit()})}),group:I=>(a.current.has(I)||a.current.set(I,new Set),()=>{i.current.delete(I),a.current.delete(I)}),filter:()=>u.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>u.current.disablePointerSelection,listId:_,inputId:A,labelId:C,listInnerRef:E}),[]);function M(I,X){var ee,ie;let re=(ie=(ee=u.current)==null?void 0:ee.filter)!=null?ie:eue;return I?re(I,r.current.search,X):0}function $(){if(!r.current.search||u.current.shouldFilter===!1)return;let I=r.current.filtered.items,X=[];r.current.filtered.groups.forEach(ie=>{let re=a.current.get(ie),K=0;re.forEach(Z=>{let ne=I.get(Z);K=Math.max(ne,K)}),X.push([ie,K])});let ee=E.current;U().sort((ie,re)=>{var K,Z;let ne=ie.getAttribute("id"),de=re.getAttribute("id");return((K=I.get(de))!=null?K:0)-((Z=I.get(ne))!=null?Z:0)}).forEach(ie=>{let re=ie.closest(U1);re?re.appendChild(ie.parentElement===re?ie:ie.closest(`${U1} > *`)):ee.appendChild(ie.parentElement===ee?ie:ie.closest(`${U1} > *`))}),X.sort((ie,re)=>re[1]-ie[1]).forEach(ie=>{var re;let K=(re=E.current)==null?void 0:re.querySelector(`${Kc}[${Vs}="${encodeURIComponent(ie[0])}"]`);K?.parentElement.appendChild(K)})}function z(){let I=U().find(ee=>ee.getAttribute("aria-disabled")!=="true"),X=I?.getAttribute(Vs);T.setState("value",X||void 0)}function F(){var I,X,ee,ie;if(!r.current.search||u.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let re=0;for(let K of n.current){let Z=(X=(I=i.current.get(K))==null?void 0:I.value)!=null?X:"",ne=(ie=(ee=i.current.get(K))==null?void 0:ee.keywords)!=null?ie:[],de=M(Z,ne);r.current.filtered.items.set(K,de),de>0&&re++}for(let[K,Z]of a.current)for(let ne of Z)if(r.current.filtered.items.get(ne)>0){r.current.filtered.groups.add(K);break}r.current.filtered.count=re}function V(){var I,X,ee;let ie=G();ie&&(((I=ie.parentElement)==null?void 0:I.firstChild)===ie&&((ee=(X=ie.closest(Kc))==null?void 0:X.querySelector(Zce))==null||ee.scrollIntoView({block:"nearest"})),ie.scrollIntoView({block:"nearest"}))}function G(){var I;return(I=E.current)==null?void 0:I.querySelector(`${E5}[aria-selected="true"]`)}function U(){var I;return Array.from(((I=E.current)==null?void 0:I.querySelectorAll(ZR))||[])}function H(I){let X=U()[I];X&&T.setState("value",X.getAttribute(Vs))}function W(I){var X;let ee=G(),ie=U(),re=ie.findIndex(Z=>Z===ee),K=ie[re+I];(X=u.current)!=null&&X.loop&&(K=re+I<0?ie[ie.length-1]:re+I===ie.length?ie[0]:ie[re+I]),K&&T.setState("value",K.getAttribute(Vs))}function B(I){let X=G(),ee=X?.closest(Kc),ie;for(;ee&&!ie;)ee=I>0?cue(ee,Kc):uue(ee,Kc),ie=ee?.querySelector(ZR);ie?T.setState("value",ie.getAttribute(Vs)):W(I)}let Q=()=>H(U().length-1),R=I=>{I.preventDefault(),I.metaKey?Q():I.altKey?B(1):W(1)},L=I=>{I.preventDefault(),I.metaKey?H(0):I.altKey?B(-1):W(-1)};return b.createElement(Je.div,{ref:t,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:I=>{var X;(X=j.onKeyDown)==null||X.call(j,I);let ee=I.nativeEvent.isComposing||I.keyCode===229;if(!(I.defaultPrevented||ee))switch(I.key){case"n":case"j":{w&&I.ctrlKey&&R(I);break}case"ArrowDown":{R(I);break}case"p":case"k":{w&&I.ctrlKey&&L(I);break}case"ArrowUp":{L(I);break}case"Home":{I.preventDefault(),H(0);break}case"End":{I.preventDefault(),Q();break}case"Enter":{I.preventDefault();let ie=G();if(ie){let re=new Event(DS);ie.dispatchEvent(re)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:k.inputId,id:k.labelId,style:hue},d),yg(e,I=>b.createElement(P5.Provider,{value:T},b.createElement(O5.Provider,{value:k},I))))}),tue=b.forwardRef((e,t)=>{var r,n;let a=en(),i=b.useRef(null),s=b.useContext(A5),u=pd(),d=k5(e),c=(n=(r=d.current)==null?void 0:r.forceMount)!=null?n:s?.forceMount;ts(()=>{if(!c)return u.item(a,s?.id)},[c]);let h=R5(a,i,[e.value,e.children,i],e.keywords),p=_N(),m=io(O=>O.value&&O.value===h.current),v=io(O=>c||u.filter()===!1?!0:O.search?O.filtered.items.get(a)>0:!0);b.useEffect(()=>{let O=i.current;if(!(!O||e.disabled))return O.addEventListener(DS,x),()=>O.removeEventListener(DS,x)},[v,e.onSelect,e.disabled]);function x(){var O,T;y(),(T=(O=d.current).onSelect)==null||T.call(O,h.current)}function y(){p.setState("value",h.current,!0)}if(!v)return null;let{disabled:w,value:j,onSelect:_,forceMount:C,keywords:A,...E}=e;return b.createElement(Je.div,{ref:Wn(i,t),...E,id:a,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!m,"data-disabled":!!w,"data-selected":!!m,onPointerMove:w||u.getDisablePointerSelection()?void 0:y,onClick:w?void 0:x},e.children)}),rue=b.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:a,...i}=e,s=en(),u=b.useRef(null),d=b.useRef(null),c=en(),h=pd(),p=io(v=>a||h.filter()===!1?!0:v.search?v.filtered.groups.has(s):!0);ts(()=>h.group(s),[]),R5(s,u,[e.value,e.heading,d]);let m=b.useMemo(()=>({id:s,forceMount:a}),[a]);return b.createElement(Je.div,{ref:Wn(u,t),...i,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},r&&b.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:c},r),yg(e,v=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?c:void 0},b.createElement(A5.Provider,{value:m},v))))}),nue=b.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,a=b.useRef(null),i=io(s=>!s.search);return!r&&!i?null:b.createElement(Je.div,{ref:Wn(a,t),...n,"cmdk-separator":"",role:"separator"})}),aue=b.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,a=e.value!=null,i=_N(),s=io(c=>c.search),u=io(c=>c.selectedItemId),d=pd();return b.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),b.createElement(Je.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":u,id:d.inputId,type:"text",value:a?e.value:s,onChange:c=>{a||i.setState("search",c.target.value),r?.(c.target.value)}})}),iue=b.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...a}=e,i=b.useRef(null),s=b.useRef(null),u=io(c=>c.selectedItemId),d=pd();return b.useEffect(()=>{if(s.current&&i.current){let c=s.current,h=i.current,p,m=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let v=c.offsetHeight;h.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return m.observe(c),()=>{cancelAnimationFrame(p),m.unobserve(c)}}},[]),b.createElement(Je.div,{ref:Wn(i,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":u,"aria-label":n,id:d.listId},yg(e,c=>b.createElement("div",{ref:Wn(s,d.listInnerRef),"cmdk-list-sizer":""},c)))}),oue=b.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:a,contentClassName:i,container:s,...u}=e;return b.createElement(J3,{open:r,onOpenChange:n},b.createElement(Q3,{container:s},b.createElement(Z3,{"cmdk-overlay":"",className:a}),b.createElement(e5,{"aria-label":e.label,"cmdk-dialog":"",className:i},b.createElement(T5,{ref:t,...u}))))}),sue=b.forwardRef((e,t)=>io(r=>r.filtered.count===0)?b.createElement(Je.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),lue=b.forwardRef((e,t)=>{let{progress:r,children:n,label:a="Loading...",...i}=e;return b.createElement(Je.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},yg(e,s=>b.createElement("div",{"aria-hidden":!0},s)))}),tc=Object.assign(T5,{List:iue,Item:tue,Input:aue,Group:rue,Separator:nue,Dialog:oue,Empty:sue,Loading:lue});function cue(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function uue(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function k5(e){let t=b.useRef(e);return ts(()=>{t.current=e}),t}var ts=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Hs(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function io(e){let t=_N(),r=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,r,r)}function R5(e,t,r,n=[]){let a=b.useRef(),i=pd();return ts(()=>{var s;let u=(()=>{var c;for(let h of r){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(c=h.current.textContent)==null?void 0:c.trim():a.current}})(),d=n.map(c=>c.trim());i.value(e,u,d),(s=t.current)==null||s.setAttribute(Vs,u),a.current=u}),a}var due=()=>{let[e,t]=b.useState(),r=Hs(()=>new Map);return ts(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,a)=>{r.current.set(n,a),t({})}};function fue(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function yg({asChild:e,children:t},r){return e&&b.isValidElement(t)?b.cloneElement(fue(t),{ref:t.ref},r(t.props.children)):r(t)}var hue={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function I5({className:e,...t}){return o.jsx(tc,{"data-slot":"command",className:Ee("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function M5({className:e,...t}){return o.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[o.jsx(vm,{className:"size-4 shrink-0 opacity-50"}),o.jsx(tc.Input,{"data-slot":"command-input",className:Ee("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function D5({className:e,...t}){return o.jsx(tc.List,{"data-slot":"command-list",className:Ee("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function L5({...e}){return o.jsx(tc.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function LS({className:e,...t}){return o.jsx(tc.Group,{"data-slot":"command-group",className:Ee("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function $S({className:e,...t}){return o.jsx(tc.Item,{"data-slot":"command-item",className:Ee("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function Hn({value:e,onValueChange:t,options:r,placeholder:n="Select…",searchPlaceholder:a="Search…",emptyText:i="No matching results.",disabled:s,className:u}){const[d,c]=b.useState(!1),h=e?r.find(m=>m.value===e):void 0,p=e?h?.label??e:null;return o.jsxs(ga,{open:d,onOpenChange:c,children:[o.jsx(va,{asChild:!0,children:o.jsxs(he,{type:"button",variant:"outline",role:"combobox","aria-expanded":d,disabled:s,className:Ee("w-full justify-between h-10 px-3 font-normal border border-gray-300 bg-white",u),children:[o.jsx("span",{className:Ee("truncate text-left text-sm",!p&&"text-gray-500"),children:p??n}),o.jsx(wM,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsxs(ya,{className:"p-0 w-[var(--radix-popover-trigger-width)] max-w-[min(100vw-2rem,400px)]",align:"start",children:[o.jsxs(I5,{children:[o.jsx(M5,{placeholder:a}),o.jsxs(D5,{children:[o.jsx(L5,{children:i}),o.jsx(LS,{children:r.map(m=>o.jsx($S,{value:`${m.label} ${m.value}`,onSelect:()=>{t(m.value),c(!1)},className:Ee("cursor-pointer rounded-md px-2 py-2 transition-colors","hover:bg-gray-100 hover:text-gray-900","data-[selected=true]:bg-gray-100",e===m.value&&"bg-blue-50 text-gray-900 font-medium data-[selected=true]:bg-blue-100"),children:o.jsx("span",{className:"truncate",children:m.label})},m.value))})]})]}),e?o.jsx("div",{className:"border-t border-gray-100 px-2 py-1.5",children:o.jsx("button",{type:"button",className:"text-xs text-gray-500 hover:text-gray-900 underline-offset-2 hover:underline",onClick:()=>{t(""),c(!1)},children:"Clear selection"})}):null]})]})}function vi({className:e,...t}){return o.jsx("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:Ee("mx-auto flex w-full justify-center",e),...t})}function yi({className:e,...t}){return o.jsx("ul",{"data-slot":"pagination-content",className:Ee("flex flex-row items-center gap-1",e),...t})}function Ct({...e}){return o.jsx("li",{"data-slot":"pagination-item",...e})}function xa({className:e,isActive:t,size:r="icon",...n}){return o.jsx("a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:Ee(nD({variant:t?"outline":"ghost",size:r}),e),...n})}function xi({className:e,...t}){return o.jsxs(xa,{"aria-label":"Go to previous page",size:"default",className:Ee("gap-1 px-2.5 sm:pl-2.5",e),...t,children:[o.jsx(bM,{}),o.jsx("span",{className:"hidden sm:block",children:"Previous"})]})}function bi({className:e,...t}){return o.jsxs(xa,{"aria-label":"Go to next page",size:"default",className:Ee("gap-1 px-2.5 sm:pr-2.5",e),...t,children:[o.jsx("span",{className:"hidden sm:block",children:"Next"}),o.jsx(il,{})]})}class pue extends Error{status;payload;constructor(t,r,n){super(t),this.name="ApiError",this.status=r,this.payload=n}}function mue(e,t){if(!e)return t;const r=e.endsWith("/")?e.slice(0,-1):e,n=t.startsWith("/")?t:`/${t}`;return`${r}${n}`}function gue(e){const t=new URLSearchParams;for(const[n,a]of Object.entries(e))if(!(a==null||a==="")){if(typeof a=="boolean"){t.set(n,a?"true":"false");continue}t.set(n,String(a))}const r=t.toString();return r?`?${r}`:""}function vue(e){const r=e?.error?.message?.trim();return r||null}function eI(e){if(Array.isArray(e))return{items:e,totalCount:e.length};if(!e||typeof e!="object")return e;const t=e,r="TotalCount"in t||"Items"in t,n="totalCount"in t||"items"in t;if(r&&!n)return{...t,totalCount:t.TotalCount,items:t.Items};if(!("items"in t)&&Array.isArray(t.data)&&typeof t.totalCount=="number")return{...t,items:t.data};if(!("items"in t)&&Array.isArray(t.Data)&&typeof t.TotalCount=="number")return{...t,totalCount:t.TotalCount,items:t.Data};if(Array.isArray(t.items)&&typeof t.totalCount!="number"){const a=t.TotalCount;return{...t,totalCount:typeof a=="number"?a:t.items.length}}return e}function nn(e={}){const t=e.baseUrl??"http://flus-test.3ffoodsafety.com"??"http://localhost:19001",r=e.getToken;async function n(a){const i=a.prefix??"/api/app",s=mue(t,`${i}${a.path}${gue(a.query??{})}`),u={"Content-Type":"application/json"},d=r?.();d&&(u.Authorization=`Bearer ${d}`);const c=await fetch(s,{method:a.method,headers:u,body:a.body===void 0?void 0:JSON.stringify(a.body),signal:a.signal}),m=(c.headers.get("content-type")??"").includes("application/json")?await c.json().catch(()=>null):await c.text().catch(()=>"");if(!c.ok){const x=vue(m)??(typeof m=="string"&&m.trim()?m:"Request failed.");throw new pue(x,c.status,m)}return m&&typeof m=="object"&&"data"in m?eI(m.data??null):eI(m)}return{requestJson:n}}const md=nn({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),gd="/label";async function yue(e,t){return md.requestJson({path:gd,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,LocationId:e.locationId,ProductId:e.productId,LabelCategoryId:e.labelCategoryId,LabelTypeId:e.labelTypeId,TemplateCode:e.templateCode,State:e.state},signal:t})}async function xue(e,t){return md.requestJson({path:`${gd}/${encodeURIComponent(e)}`,method:"GET",signal:t})}async function bue(e){return md.requestJson({path:gd,method:"POST",body:{labelCode:e.labelCode,labelName:e.labelName,templateCode:e.templateCode,locationId:e.locationId,labelCategoryId:e.labelCategoryId,labelTypeId:e.labelTypeId,productIds:e.productIds,labelInfoJson:e.labelInfoJson,state:e.state??!0}})}async function wue(e,t){return md.requestJson({path:`${gd}/${encodeURIComponent(e)}`,method:"PUT",body:{labelName:t.labelName,templateCode:t.templateCode,locationId:t.locationId,labelCategoryId:t.labelCategoryId,labelTypeId:t.labelTypeId,productIds:t.productIds,labelInfoJson:t.labelInfoJson,state:t.state??!0}})}async function Sue(e){await md.requestJson({path:`${gd}/${encodeURIComponent(e)}`,method:"DELETE"})}const xg=nn({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}});async function rc(e,t){return xg.requestJson({path:"/location",method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,Partner:e.partner,GroupName:e.groupName,State:e.state},signal:t})}async function jue(e){return xg.requestJson({path:"/location",method:"POST",body:{partner:e.partner,groupName:e.groupName,locationCode:e.locationCode,locationName:e.locationName,street:e.street,city:e.city,stateCode:e.stateCode,country:e.country,zipCode:e.zipCode,phone:e.phone,email:e.email,latitude:e.latitude,longitude:e.longitude,state:e.state??!0}})}async function Nue(e,t){return xg.requestJson({path:`/location/${encodeURIComponent(e)}`,method:"PUT",body:{partner:t.partner,groupName:t.groupName,locationCode:t.locationCode,locationName:t.locationName,street:t.street,city:t.city,stateCode:t.stateCode,country:t.country,zipCode:t.zipCode,phone:t.phone,email:t.email,latitude:t.latitude,longitude:t.longitude,state:t.state??!0}})}async function _ue(e){await xg.requestJson({path:`/location/${encodeURIComponent(e)}`,method:"DELETE"})}const bg=nn({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),wg="/label-category";async function $5(e,t){return bg.requestJson({path:wg,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,State:e.state},signal:t})}async function Cue(e){return bg.requestJson({path:wg,method:"POST",body:{categoryCode:e.categoryCode,categoryName:e.categoryName,categoryPhotoUrl:e.categoryPhotoUrl,state:e.state??!0,orderNum:e.orderNum}})}async function Eue(e,t){return bg.requestJson({path:`${wg}/${encodeURIComponent(e)}`,method:"PUT",body:{categoryCode:t.categoryCode,categoryName:t.categoryName,categoryPhotoUrl:t.categoryPhotoUrl,state:t.state??!0,orderNum:t.orderNum}})}async function Oue(e){await bg.requestJson({path:`${wg}/${encodeURIComponent(e)}`,method:"DELETE"})}const Sg=nn({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),jg="/label-type";async function CN(e,t){return Sg.requestJson({path:jg,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,State:e.state},signal:t})}async function Pue(e){return Sg.requestJson({path:jg,method:"POST",body:{typeCode:e.typeCode,typeName:e.typeName,state:e.state??!0,orderNum:e.orderNum}})}async function Aue(e,t){return Sg.requestJson({path:`${jg}/${encodeURIComponent(e)}`,method:"PUT",body:{typeCode:t.typeCode,typeName:t.typeName,state:t.state??!0,orderNum:t.orderNum}})}async function Tue(e){await Sg.requestJson({path:`${jg}/${encodeURIComponent(e)}`,method:"DELETE"})}const vd=nn({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),yd="/label-template";function kue(e){const t=e;if(!t||typeof t!="object")return"";const r=t.id??t.templateCode??t.TemplateCode;return typeof r=="string"?r.trim():String(r??"").trim()}function Rue(e){return Array.isArray(e)?e.map(t=>{const r=t,n=r.inputKey??r.InputKey,a=r.elementName??r.ElementName,i=r.libraryCategory??r.LibraryCategory;let s;if(typeof i=="string"){const u=i.trim();u&&(s=u)}return{...r,elementName:typeof a=="string"?a.trim():void 0,inputKey:typeof n=="string"?n:r.inputKey??null,libraryCategory:s,config:r.config&&typeof r.config=="object"?r.config:{}}}):[]}function Iue(e){if(e==null||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[r,n]of Object.entries(e))n==null?t[r]="":typeof n=="string"?t[r]=n:typeof n=="number"||typeof n=="boolean"?t[r]=String(n):t[r]=JSON.stringify(n);return t}function Mue(e){return Array.isArray(e)?e.map((t,r)=>{const n=t,a=n.defaultValues??n.DefaultValues??n.defaultValuesJson??n.DefaultValuesJson;return{productId:String(n.productId??n.ProductId??"").trim(),labelTypeId:String(n.labelTypeId??n.LabelTypeId??"").trim(),defaultValues:Iue(a),orderNum:Number(n.orderNum??n.OrderNum??r+1)||r+1}}):[]}function Ng(e){const t=e,n=((Array.isArray(t.appliedLocationIds)?t.appliedLocationIds:null)??(Array.isArray(t.AppliedLocationIds)?t.AppliedLocationIds:null)??[]).map(v=>String(v)),a=kue(e),i=t.templateName??t.TemplateName,s=t.templateCode??t.TemplateCode,u=t.locationText??t.LocationText,d=t.sizeText??t.SizeText,c=t.contentsCount??t.ContentsCount,h=typeof c=="number"?c:void 0,p=t.lastEdited??t.LastEdited,m=(typeof t.name=="string"&&t.name.trim()?t.name:null)??(typeof i=="string"&&String(i).trim()?String(i):null);return{...t,id:a,name:m??t.name,templateName:(typeof i=="string"?i:null)??t.templateName,templateCode:(typeof s=="string"?s:null)??t.templateCode,locationText:(typeof u=="string"?u:null)??t.locationText,sizeText:(typeof d=="string"?d:null)??t.sizeText,contentsCount:h??t.contentsCount,lastEdited:(typeof p=="string"?p:null)??t.lastEdited,appliedLocationIds:n,elements:Rue(t.elements),templateProductDefaults:Mue(t.templateProductDefaults??t.TemplateProductDefaults)}}async function B5(e,t){const r=await vd.requestJson({path:yd,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,LocationId:e.locationId,LabelType:e.labelType,State:e.state},signal:t}),n=(r.items??[]).map(a=>Ng(a));return{...r,items:n}}async function F5(e,t){const r=await vd.requestJson({path:`${yd}/${encodeURIComponent(e)}`,method:"GET",signal:t});return Ng(r)}async function Due(e){const t=await vd.requestJson({path:yd,method:"POST",body:{id:e.id,name:e.name,labelType:e.labelType,unit:e.unit,width:e.width,height:e.height,appliedLocation:e.appliedLocation,showRuler:e.showRuler??!0,showGrid:e.showGrid??!0,state:e.state??!0,elements:e.elements,appliedLocationIds:e.appliedLocationIds??[]}});return Ng(t)}async function z5(e,t){const r={id:t.id,name:t.name,labelType:t.labelType,unit:t.unit,width:t.width,height:t.height,appliedLocation:t.appliedLocation,showRuler:t.showRuler??!0,showGrid:t.showGrid??!0,state:t.state??!0,elements:t.elements,appliedLocationIds:t.appliedLocationIds??[]};t.templateProductDefaults!==void 0&&(r.templateProductDefaults=t.templateProductDefaults.map((a,i)=>({productId:a.productId,labelTypeId:a.labelTypeId,defaultValues:a.defaultValues,orderNum:a.orderNum??i+1})));const n=await vd.requestJson({path:`${yd}/${encodeURIComponent(e)}`,method:"PUT",body:r});return Ng(n)}async function Lue(e){await vd.requestJson({path:`${yd}/${encodeURIComponent(e)}`,method:"DELETE"})}const xd=nn({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),bd="/product";function _g(e){const t=e,r=String(t?.id??t?.Id??"").trim();return{...t,id:r,productCode:t?.productCode??t?.ProductCode,productName:t?.productName??t?.ProductName,categoryId:t?.categoryId??t?.CategoryId,categoryName:t?.categoryName??t?.CategoryName,productImageUrl:t?.productImageUrl??t?.ProductImageUrl,state:typeof t?.state=="boolean"?t.state:typeof t?.State=="boolean"?t.State:null}}async function hm(e,t){const r=await xd.requestJson({path:bd,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,State:e.state},signal:t});return{...r,items:(r.items??[]).map(n=>_g(n))}}async function $ue(e,t){const r=await xd.requestJson({path:`${bd}/${encodeURIComponent(e)}`,method:"GET",signal:t});return _g(r)}async function Bue(e){const t=await xd.requestJson({path:bd,method:"POST",body:{productCode:e.productCode,productName:e.productName,categoryId:e.categoryId?.trim()?e.categoryId.trim():null,productImageUrl:e.productImageUrl??null,state:e.state??!0}});return _g(t)}async function Fue(e,t){const r=await xd.requestJson({path:`${bd}/${encodeURIComponent(e)}`,method:"PUT",body:{productCode:t.productCode,productName:t.productName,categoryId:t.categoryId?.trim()?t.categoryId.trim():null,productImageUrl:t.productImageUrl??null,state:t.state??!0}});return _g(r)}async function zue(e){await xd.requestJson({path:`${bd}/${encodeURIComponent(e)}`,method:"DELETE"})}function fa(e){const t=(e??"").trim();return t||"None"}function que(e){return(e.labelCode??e.id??"").trim()||"None"}function Uue(e){const t=(e.products??"").trim();if(t)return t;const r=(e.productName??"").trim();if(r)return r;const n=e.productIds?.length??0;return n>0?`${n} product(s)`:"None"}function Vue(e){const t=(e.lastEdited??"").trim();if(t)return t;const r=e.creationTime;if(r)try{return new Date(r).toLocaleString()}catch{return String(r)}return"None"}function tI(e){const t=e.productIds;return{labelName:e.labelName??"",templateCode:e.templateCode??"",locationId:e.locationId??"",labelCategoryId:e.labelCategoryId??"",labelTypeId:e.labelTypeId??"",productIds:Array.isArray(t)?[...t]:[],labelInfoJson:e.labelInfoJson??null,state:e.state??!0}}function Yu(e){return(e.templateCode??e.id??"").trim()}function q5(e){const t=(e.templateName??e.name??"").trim()||"None",r=Yu(e)||"None";return`${t} (${r})`}function U5(e){const[t,r]=b.useState(!1),[n,a]=b.useState([]),[i,s]=b.useState([]),[u,d]=b.useState([]),[c,h]=b.useState([]),[p,m]=b.useState([]);b.useEffect(()=>{if(!e)return;let x=!1;return(async()=>{r(!0);try{const[y,w,j,_,C]=await Promise.all([B5({skipCount:1,maxResultCount:500}),rc({skipCount:1,maxResultCount:500}),$5({skipCount:1,maxResultCount:500}),CN({skipCount:1,maxResultCount:500}),hm({skipCount:1,maxResultCount:500})]);if(x)return;a(y.items??[]),s(w.items??[]),d(j.items??[]),h(_.items??[]),m(C.items??[])}catch(y){x||(pe.error("Failed to load options",{description:y?.message?String(y.message):"Check network or sign-in."}),a([]),s([]),d([]),h([]),m([]))}finally{x||r(!1)}})(),()=>{x=!0}},[e]);const v=b.useMemo(()=>p.map(x=>{const y=(x.productName??x.productCode??"").trim()||x.id;return{id:x.id,name:y}}),[p]);return{loading:t,templates:n,locations:i,categories:u,types:c,productOptions:v}}function V5({value:e,onChange:t,disabled:r,productOptions:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>{if(e.length===0)return"Select products (multi-select)";const c=e.map(p=>n.find(m=>m.id===p)?.name??p).slice(0,2),h=e.length>2?`, ${e.length} total`:"";return`${c.join(", ")}${h}`},[e,n]),u=b.useCallback((c,h)=>{const p=new Set(e);h?p.add(c):p.delete(c),t(Array.from(p))},[e,t]),d=b.useMemo(()=>e.filter(c=>!n.some(h=>h.id===c)),[e,n]);return o.jsxs(ga,{open:a,onOpenChange:i,children:[o.jsx(va,{asChild:!0,children:o.jsxs(he,{type:"button",variant:"outline",role:"combobox",disabled:r,className:"w-full justify-between h-10 px-3 font-normal border border-gray-300 bg-white",children:[o.jsx("span",{className:"truncate text-left text-sm",children:s}),o.jsx(wM,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(ya,{className:"w-[var(--radix-popover-trigger-width)] max-w-[min(100vw-2rem,400px)] p-0",align:"start",children:o.jsxs(I5,{children:[o.jsx(M5,{placeholder:"Search products…"}),o.jsxs(D5,{children:[o.jsx(L5,{children:"No matching products."}),o.jsxs(LS,{children:[n.map(c=>o.jsxs($S,{value:`${c.name} ${c.id}`,onSelect:()=>{u(c.id,!e.includes(c.id))},className:"cursor-pointer",children:[o.jsx(Dl,{className:"pointer-events-none",checked:e.includes(c.id)}),o.jsxs("span",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"font-medium",children:c.name}),o.jsx("span",{className:"block text-xs text-gray-400 truncate",children:c.id})]})]},c.id)),d.length>0?o.jsx(LS,{heading:"Linked (not in current list, can deselect)",children:d.map(c=>o.jsxs($S,{value:c,onSelect:()=>{u(c,!e.includes(c))},className:"cursor-pointer",children:[o.jsx(Dl,{className:"pointer-events-none",checked:e.includes(c)}),o.jsx("span",{className:"text-xs font-mono truncate",children:c})]},c))}):null]})]})]})})]})}function Hue(){const[e,t]=b.useState(!1),[r,n]=b.useState(!1),[a,i]=b.useState(!1),[s,u]=b.useState(null),[d,c]=b.useState(null),[h,p]=b.useState([]),[m,v]=b.useState(!1),[x,y]=b.useState(0),[w,j]=b.useState(0),[_,C]=b.useState(null),[A,E]=b.useState(""),[O,T]=b.useState("all"),[k,M]=b.useState("all"),[$,z]=b.useState("all"),[F,V]=b.useState("all"),[G,U]=b.useState("all"),[H,W]=b.useState(1),[B,Q]=b.useState(10),R=b.useRef(null),L=b.useRef(null),[I,X]=b.useState("");b.useEffect(()=>(L.current&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>X(A.trim()),300),()=>{L.current&&window.clearTimeout(L.current)}),[A]);const ee=Math.max(1,Math.ceil(x/B));b.useEffect(()=>{W(1)},[I,O,k,$,F,G,B]),b.useEffect(()=>((async()=>{R.current?.abort();const ne=new AbortController;R.current=ne,v(!0);try{const de=Fa(H),ge=await yue({skipCount:de,maxResultCount:B,keyword:I||void 0,locationId:O!=="all"?O:void 0,labelCategoryId:k!=="all"?k:void 0,labelTypeId:$!=="all"?$:void 0,templateCode:F!=="all"?F:void 0,state:G==="all"?void 0:G==="true"},ne.signal);p(ge.items??[]),y(ge.totalCount??0)}catch(de){if(de?.name==="AbortError")return;pe.error("Failed to load labels.",{description:de?.message?String(de.message):"Please try again."}),p([]),y(0)}finally{v(!1)}})(),()=>R.current?.abort()),[I,O,k,$,F,G,H,B,w]);const ie=()=>j(Z=>Z+1),re=Z=>{C(null),u(Z),n(!0)},K=Z=>{C(null),c(Z),i(!0)};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"pb-4",children:o.jsx("div",{className:"flex flex-col gap-4",children:o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ve,{placeholder:"Search",value:A,onChange:Z=>E(Z.target.value),style:{height:40,boxSizing:"border-box"},className:"bg-white border border-gray-300 rounded-md w-40 shrink-0 placeholder:text-gray-500"}),o.jsxs(Ve,{value:O,onValueChange:T,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Location"})}),o.jsx(Ge,{children:o.jsx(Ne,{value:"all",children:"All Locations"})})]}),o.jsxs(Ve,{value:k,onValueChange:M,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Category"})}),o.jsx(Ge,{children:o.jsx(Ne,{value:"all",children:"All Categories"})})]}),o.jsxs(Ve,{value:$,onValueChange:z,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Type"})}),o.jsx(Ge,{children:o.jsx(Ne,{value:"all",children:"All Types"})})]}),o.jsxs(Ve,{value:G,onValueChange:U,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"State"})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"all",children:"All States"}),o.jsx(Ne,{value:"true",children:"Active"}),o.jsx(Ne,{value:"false",children:"Inactive"})]})]}),o.jsx("div",{className:"flex-1"}),o.jsxs(he,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0",onClick:()=>t(!0),children:["New Label ",o.jsx(tn,{className:"ml-1 h-4 w-4"})]})]})})}),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:o.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:o.jsxs(Rr,{children:[o.jsx(Ir,{children:o.jsxs(Le,{className:"bg-gray-50 hover:bg-gray-50",children:[o.jsx(ye,{className:"font-bold text-gray-900 w-[120px]",children:"Label Code"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[140px]",children:"Label Name"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[120px]",children:"Location"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[140px]",children:"Category"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[140px]",children:"Type"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[120px]",children:"Template"}),o.jsx(ye,{className:"font-bold text-gray-900",children:"Products"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[100px]",children:"State"}),o.jsx(ye,{className:"font-bold text-gray-900",children:"Last Edited"}),o.jsx(ye,{className:"font-bold text-gray-900 text-center w-[100px]",children:"Actions"})]})}),o.jsx(Mr,{children:m?o.jsx(Le,{children:o.jsx(fe,{colSpan:10,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):h.length===0?o.jsx(Le,{children:o.jsx(fe,{colSpan:10,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):h.map(Z=>o.jsxs(Le,{className:"hover:bg-gray-50",children:[o.jsx(fe,{className:"font-medium whitespace-nowrap",children:que(Z)}),o.jsx(fe,{className:"whitespace-nowrap",children:fa(Z.labelName)}),o.jsx(fe,{className:"text-gray-600 whitespace-nowrap",children:fa(Z.locationName??Z.locationId)}),o.jsx(fe,{className:"text-gray-600 whitespace-nowrap",children:fa(Z.labelCategoryName??Z.labelCategoryId)}),o.jsx(fe,{className:"text-gray-600 whitespace-nowrap",children:fa(Z.labelTypeName??Z.labelTypeId)}),o.jsx(fe,{className:"text-gray-600 whitespace-nowrap",children:fa(Z.templateName??Z.templateCode)}),o.jsx(fe,{className:"text-gray-600 whitespace-nowrap",children:Uue(Z)}),o.jsx(fe,{children:o.jsx(kr,{className:Z.state===!0?"bg-green-600":"bg-gray-400",children:Z.state===!0?"Active":"Inactive"})}),o.jsx(fe,{className:"text-gray-500 tabular-nums font-numeric whitespace-nowrap",children:Vue(Z)}),o.jsx(fe,{className:"text-center",children:o.jsxs(ga,{open:_===Z.id,onOpenChange:ne=>C(ne?Z.id:null),children:[o.jsx(va,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:o.jsx(di,{className:"h-4 w-4 text-gray-500"})})}),o.jsxs(ya,{align:"end",className:"w-40 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>re(Z),children:[o.jsx(wn,{className:"w-4 h-4"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>K(Z),children:[o.jsx(Ot,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},Z.id))})]})})}),o.jsx("div",{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[o.jsxs("div",{children:["Showing ",x===0?0:(H-1)*B+1,"-",Math.min(H*B,x)," of ",x]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String(B),onValueChange:Z=>Q(Number(Z)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(Z=>o.jsxs(Ne,{value:String(Z),children:[Z," / page"]},Z))})]}),o.jsx(vi,{className:"mx-0 w-auto justify-end",children:o.jsxs(yi,{children:[o.jsx(Ct,{children:o.jsx(xi,{href:"#",size:"default",onClick:Z=>{Z.preventDefault(),W(ne=>Math.max(1,ne-1))},"aria-disabled":H<=1,className:H<=1?"pointer-events-none opacity-50":""})}),o.jsx(Ct,{children:o.jsxs(xa,{href:"#",isActive:!0,size:"default",onClick:Z=>Z.preventDefault(),children:["Page ",H," / ",ee]})}),o.jsx(Ct,{children:o.jsx(bi,{href:"#",size:"default",onClick:Z=>{Z.preventDefault(),W(ne=>Math.min(ee,ne+1))},"aria-disabled":H>=ee,className:H>=ee?"pointer-events-none opacity-50":""})})]})})]})]})}),o.jsx(Wue,{open:e,onOpenChange:t,onCreated:()=>{W(1),ie()}}),o.jsx(Gue,{open:r,label:s,onOpenChange:Z=>{n(Z),Z||u(null)},onUpdated:ie}),o.jsx(Kue,{open:a,label:d,onOpenChange:Z=>{i(Z),Z||c(null)},onDeleted:ie})]})}function Wue({open:e,onOpenChange:t,onCreated:r}){const{loading:n,templates:a,locations:i,categories:s,types:u,productOptions:d}=U5(e),[c,h]=b.useState(!1),[p,m]=b.useState({labelCode:"",labelName:"",templateCode:"",locationId:"",labelCategoryId:"",labelTypeId:"",productIds:[],labelInfoJson:null,state:!0}),v=()=>{m({labelCode:"",labelName:"",templateCode:"",locationId:"",labelCategoryId:"",labelTypeId:"",productIds:[],labelInfoJson:null,state:!0})};b.useEffect(()=>{e||v()},[e]);const x=async()=>{if(!p.labelCode.trim()||!p.labelName.trim()||!p.templateCode.trim()||!p.locationId.trim()||!p.labelCategoryId.trim()||!p.labelTypeId.trim()){pe.error("Validation failed",{description:"Fill all required fields and select template, location, category, and type."});return}if(p.productIds.length===0){pe.error("Validation failed",{description:"Select at least one product."});return}h(!0);try{await bue(p),pe.success("Label created.",{description:"The label has been created successfully."}),t(!1),r()}catch(C){pe.error("Failed to create label.",{description:C?.message?String(C.message):"Please try again."})}finally{h(!1)}},y=b.useMemo(()=>a.filter(C=>Yu(C)).map(C=>({value:Yu(C),label:q5(C)})),[a]),w=b.useMemo(()=>i.map(C=>({value:C.id,label:fa(C.locationName??C.locationCode??C.id)})),[i]),j=b.useMemo(()=>s.map(C=>({value:C.id,label:fa(C.categoryName??C.categoryCode??C.id)})),[s]),_=b.useMemo(()=>u.map(C=>({value:C.id,label:fa(C.typeName??C.typeCode??C.id)})),[u]);return o.jsx(vt,{open:e,onOpenChange:t,children:o.jsxs(pt,{className:"sm:max-w-[600px]",children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Add New Label"}),o.jsx(Pt,{children:"Enter the details for the new label."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Label Code *"}),o.jsx(ve,{className:"h-10",placeholder:"e.g. LBL_TEST_001",value:p.labelCode,onChange:C=>m(A=>({...A,labelCode:C.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Label Name *"}),o.jsx(ve,{className:"h-10",placeholder:"e.g. Breakfast label",value:p.labelName,onChange:C=>m(A=>({...A,labelName:C.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Label Template *"}),o.jsx(Hn,{value:p.templateCode,onValueChange:C=>m(A=>({...A,templateCode:C})),options:y,placeholder:"Select template",searchPlaceholder:"Search template…",emptyText:"No templates found.",disabled:n})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Location *"}),o.jsx(Hn,{value:p.locationId,onValueChange:C=>m(A=>({...A,locationId:C})),options:w,placeholder:"Select location",searchPlaceholder:"Search location…",emptyText:"No locations found.",disabled:n})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Label Category *"}),o.jsx(Hn,{value:p.labelCategoryId,onValueChange:C=>m(A=>({...A,labelCategoryId:C})),options:j,placeholder:"Select category",searchPlaceholder:"Search category…",emptyText:"No categories found.",disabled:n})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Label Type *"}),o.jsx(Hn,{value:p.labelTypeId,onValueChange:C=>m(A=>({...A,labelTypeId:C})),options:_,placeholder:"Select type",searchPlaceholder:"Search type…",emptyText:"No types found.",disabled:n})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Product * (multi-select)"}),o.jsx(V5,{value:p.productIds,onChange:C=>m(A=>({...A,productIds:C})),disabled:n,productOptions:d})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Gt,{checked:p.state,onCheckedChange:C=>m(A=>({...A,state:C}))})]})]}),o.jsxs(wt,{children:[o.jsx(he,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{disabled:c||n,onClick:x,children:c?"Creating…":"Create"})]})]})})}function Gue({open:e,label:t,onOpenChange:r,onUpdated:n}){const{loading:a,templates:i,locations:s,categories:u,types:d,productOptions:c}=U5(e),[h,p]=b.useState(!1),[m,v]=b.useState(!1),[x,y]=b.useState({labelName:"",templateCode:"",locationId:"",labelCategoryId:"",labelTypeId:"",productIds:[],labelInfoJson:null,state:!0});b.useEffect(()=>{if(!e||!t?.id)return;const E=t.id;y(tI(t));const O=new AbortController;let T=!1;return v(!0),(async()=>{try{const k=await xue(E,O.signal);if(T)return;y(tI(k))}catch(k){if(T||k?.name==="AbortError")return;pe.error("Failed to load label details.",{description:k?.message?String(k.message):"Form shows list data only; check network."})}finally{T||v(!1)}})(),()=>{T=!0,O.abort()}},[e,t]);const w=async()=>{if(t?.id){if(!x.labelName.trim()||!x.templateCode.trim()||!x.locationId.trim()||!x.labelCategoryId.trim()||!x.labelTypeId.trim()){pe.error("Validation failed",{description:"Fill all required fields and select template, location, category, and type."});return}if(x.productIds.length===0){pe.error("Validation failed",{description:"Select at least one product."});return}p(!0);try{await wue(t.id,x),pe.success("Label updated.",{description:"The label has been updated successfully."}),r(!1),n()}catch(E){pe.error("Failed to update label.",{description:E?.message?String(E.message):"Please try again."})}finally{p(!1)}}},j=b.useMemo(()=>{const E=i.filter(T=>Yu(T)).map(T=>({value:Yu(T),label:q5(T)})),O=x.templateCode;return O&&!E.some(T=>T.value===O)?[{value:O,label:`${O} (current)`},...E]:E},[i,x.templateCode]),_=b.useMemo(()=>{const E=s.map(T=>({value:T.id,label:fa(T.locationName??T.locationCode??T.id)})),O=x.locationId;return O&&!E.some(T=>T.value===O)?[{value:O,label:`${O} (current)`},...E]:E},[s,x.locationId]),C=b.useMemo(()=>{const E=u.map(T=>({value:T.id,label:fa(T.categoryName??T.categoryCode??T.id)})),O=x.labelCategoryId;return O&&!E.some(T=>T.value===O)?[{value:O,label:`${O} (current)`},...E]:E},[u,x.labelCategoryId]),A=b.useMemo(()=>{const E=d.map(T=>({value:T.id,label:fa(T.typeName??T.typeCode??T.id)})),O=x.labelTypeId;return O&&!E.some(T=>T.value===O)?[{value:O,label:`${O} (current)`},...E]:E},[d,x.labelTypeId]);return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-[600px]",children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Edit Label"}),o.jsx(Pt,{children:m?"Loading label details…":"Update the label details."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Label Name *"}),o.jsx(ve,{className:"h-10",placeholder:"e.g. Breakfast label",value:x.labelName,onChange:E=>y(O=>({...O,labelName:E.target.value})),disabled:m})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Label Template *"}),o.jsx(Hn,{value:x.templateCode,onValueChange:E=>y(O=>({...O,templateCode:E})),options:j,placeholder:"Select template",searchPlaceholder:"Search template…",emptyText:"No templates found.",disabled:a||m})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Location *"}),o.jsx(Hn,{value:x.locationId,onValueChange:E=>y(O=>({...O,locationId:E})),options:_,placeholder:"Select location",searchPlaceholder:"Search location…",emptyText:"No locations found.",disabled:a||m})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Label Category *"}),o.jsx(Hn,{value:x.labelCategoryId,onValueChange:E=>y(O=>({...O,labelCategoryId:E})),options:C,placeholder:"Select category",searchPlaceholder:"Search category…",emptyText:"No categories found.",disabled:a||m})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Label Type *"}),o.jsx(Hn,{value:x.labelTypeId,onValueChange:E=>y(O=>({...O,labelTypeId:E})),options:A,placeholder:"Select type",searchPlaceholder:"Search type…",emptyText:"No types found.",disabled:a||m})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Product * (multi-select)"}),o.jsx(V5,{value:x.productIds,onChange:E=>y(O=>({...O,productIds:E})),disabled:a||m,productOptions:c})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Gt,{checked:x.state,onCheckedChange:E=>y(O=>({...O,state:E})),disabled:m})]})]}),o.jsxs(wt,{children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{disabled:h||a||m,onClick:w,children:h?"Updating…":"Update"})]})]})})}function Kue({open:e,label:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>(t?.labelName??"").trim()||t?.labelCode||t?.id||"this label",[t]),u=async()=>{if(t?.id){i(!0);try{await Sue(t.id),pe.success("Label deleted.",{description:"The label has been removed successfully."}),r(!1),n()}catch(d){pe.error("Failed to delete label.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Delete Label"}),o.jsx(Pt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(wt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Ot,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}const Xue="/api/app/picture/category/upload";function Yue(e,t){const r=e.replace(/\/$/,""),n=t.startsWith("/")?t:`/${t}`;return`${r}${n}`}const H5=5*1024*1024;function W5(){return"http://flus-test.3ffoodsafety.com".replace(/\/$/,"")??"http://localhost:19001"}function Jue(){try{return localStorage.getItem("access_token")??localStorage.getItem("token")}catch{return null}}function rI(e){if(typeof e=="string"&&e.trim()){const r=e.trim();if(/^https?:\/\//i.test(r)||r.startsWith("/")||r.startsWith("data:"))return r}if(!e||typeof e!="object")return null;const t=e;for(const r of["url","Url","fileUrl","FileUrl","imageUrl","ImageUrl","path","Path"]){const n=t[r];if(typeof n=="string"&&n.trim())return n.trim()}return null}function Que(e){if(!e||typeof e!="object")return e;const t=e;return"data"in t&&t.data!==void 0?t.data:"result"in t&&t.result!==void 0?t.result:e}function Zue(e,t){if(e&&typeof e=="object"){const r=e,n=r.errors??r.Errors;if(typeof n=="string"&&n.trim())return n.trim();const a=r.error;if(a&&typeof a.message=="string"&&a.message.trim())return a.message.trim()}return`Upload failed (${t})`}function Ju(e){const t=(e??"").trim();if(!t)return"";if(t.startsWith("data:")||/^https?:\/\//i.test(t))return t;const r=W5();return t.startsWith("/")?`${r}${t}`:`${r}/${t}`}function ede(e){if(e.size>H5)throw new Error("Image must be 5 MB or smaller.");const t=/^(image\/(jpeg|png|webp|gif))$/i.test(e.type),r=/\.(jpe?g|png|webp|gif)$/i.test(e.name);if(!t&&!r)throw new Error("Only JPG, PNG, WebP, and GIF are allowed.")}async function tde(e,t){ede(e);const r=t?.subDir?.trim();if(r&&r.includes(".."))throw new Error("Invalid subDir.");const n=Yue(W5(),Xue),a=new FormData;a.append("file",e),r&&a.append("subDir",r);const i={},s=Jue();s&&(i.Authorization=`Bearer ${s}`);const u=await fetch(n,{method:"POST",body:a,headers:i,signal:t?.signal}),d=await u.text();let c=d;try{c=d?JSON.parse(d):null}catch{c=d}if(!u.ok)throw new Error(Zue(c,u.status));const h=Que(c),p=rI(h)??rI(c);if(!p)throw new Error("Upload response did not contain a usable image URL.");return p}function wd({value:e,onChange:t,disabled:r,hint:n,emptyLabel:a="Click to upload image",accept:i="image/jpeg,image/png,image/webp,image/gif",maxSizeMb:s=H5/(1024*1024),className:u,boxClassName:d,uploadSubDir:c,oneImageOnly:h}){const p=b.useRef(null),[m,v]=b.useState(!1),x=async _=>{const C=_.target.files?.[0];if(_.target.value="",!!C){if(!C.type.startsWith("image/")){pe.error("Please select an image file.");return}if(C.size>s*1024*1024){pe.error(`Image must be ${s} MB or smaller.`);return}v(!0);try{const A=await tde(C,{subDir:c});t(A),pe.success("Image uploaded.")}catch(A){const E=A instanceof Error?A.message:String(A);pe.error("Upload failed",{description:E||void 0})}finally{v(!1)}}},y=r||m,w=()=>{y||p.current?.click()},j="w-full max-w-[200px] aspect-square rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2";return o.jsxs("div",{className:Ee("space-y-2",u),children:[o.jsx("input",{ref:p,type:"file",accept:i,className:"sr-only",disabled:y,multiple:!1,onChange:x}),e?o.jsxs("div",{className:Ee("group relative overflow-hidden rounded-md border-2 border-dashed border-gray-300 bg-gray-50/80",j,d),children:[o.jsxs("button",{type:"button",disabled:y,onClick:w,className:"relative h-full w-full p-0","aria-label":"Replace image",children:[o.jsx("img",{src:Ju(e),alt:"",className:"h-full w-full object-contain",onError:_=>{_.target.style.opacity="0.2"}}),o.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-black/0 text-sm font-medium text-white opacity-0 transition group-hover:bg-black/45 group-hover:opacity-100",children:"Click to replace"})]}),o.jsx("button",{type:"button",disabled:y,onClick:_=>{_.stopPropagation(),t("")},className:"absolute right-1.5 top-1.5 flex h-7 w-7 items-center justify-center rounded-full bg-white/95 text-gray-600 shadow-sm ring-1 ring-gray-200 transition hover:bg-white hover:text-gray-900 disabled:opacity-50","aria-label":"Remove image",children:o.jsx(eo,{className:"h-4 w-4"})})]}):o.jsxs("button",{type:"button",disabled:y,onClick:w,className:Ee(j,"flex flex-col items-center justify-center gap-3 border-2 border-dashed border-gray-300 bg-gray-50/80 text-gray-400","hover:border-gray-400 hover:bg-gray-100/90 hover:text-gray-500","disabled:pointer-events-none disabled:opacity-50",d),children:[o.jsx(tn,{className:"h-10 w-10 shrink-0 stroke-[1.25]","aria-hidden":!0}),o.jsx("span",{className:"px-3 text-center text-sm font-normal leading-tight",children:m?"Uploading…":a})]}),h?o.jsx("p",{className:"text-xs text-muted-foreground",children:"One image only. Replace or clear to change."}):null,n?o.jsx("p",{className:"text-xs text-muted-foreground",children:n}):null]})}function nI(e){const t=(e??"").trim();return t||"None"}function rde(){const[e,t]=b.useState(!1),[r,n]=b.useState(!1),[a,i]=b.useState(!1),[s,u]=b.useState(null),[d,c]=b.useState(null),[h,p]=b.useState([]),[m,v]=b.useState(!1),[x,y]=b.useState(0),[w,j]=b.useState(0),[_,C]=b.useState(null),[A,E]=b.useState(""),[O,T]=b.useState("all"),[k,M]=b.useState(1),[$,z]=b.useState(10),F=b.useRef(null),V=b.useRef(null),[G,U]=b.useState("");b.useEffect(()=>(V.current&&window.clearTimeout(V.current),V.current=window.setTimeout(()=>U(A.trim()),300),()=>{V.current&&window.clearTimeout(V.current)}),[A]);const H=Math.max(1,Math.ceil(x/$));b.useEffect(()=>{M(1)},[G,O,$]),b.useEffect(()=>((async()=>{F.current?.abort();const L=new AbortController;F.current=L,v(!0);try{const I=Fa(k),X=await $5({skipCount:I,maxResultCount:$,keyword:G||void 0,state:O==="all"?void 0:O==="true"},L.signal);p(X.items??[]),y(X.totalCount??0)}catch(I){if(I?.name==="AbortError")return;pe.error("Failed to load label categories.",{description:I?.message?String(I.message):"Please try again."}),p([]),y(0)}finally{v(!1)}})(),()=>F.current?.abort()),[G,O,k,$,w]);const W=()=>j(R=>R+1),B=R=>{C(null),u(R),n(!0)},Q=R=>{C(null),c(R),i(!0)};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"pb-4",children:o.jsx("div",{className:"flex flex-col gap-4",children:o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ve,{placeholder:"Search",value:A,onChange:R=>E(R.target.value),style:{height:40,boxSizing:"border-box"},className:"bg-white border border-gray-300 rounded-md w-40 shrink-0 placeholder:text-gray-500"}),o.jsxs(Ve,{value:O,onValueChange:T,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"State"})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"all",children:"All States"}),o.jsx(Ne,{value:"true",children:"Active"}),o.jsx(Ne,{value:"false",children:"Inactive"})]})]}),o.jsx("div",{className:"flex-1"}),o.jsxs(he,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0",onClick:()=>t(!0),children:["New Label Category ",o.jsx(tn,{className:"ml-1 h-4 w-4"})]})]})})}),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:o.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:o.jsxs(Rr,{children:[o.jsx(Ir,{children:o.jsxs(Le,{className:"bg-gray-50 hover:bg-gray-50",children:[o.jsx(ye,{className:"font-bold text-gray-900 w-[250px]",children:"Label Category"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[200px]",children:"Category Code"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[200px]",children:"Category Photo"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[100px]",children:"State"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[100px]",children:"Order"}),o.jsx(ye,{className:"font-bold text-gray-900",children:"Last Edited"}),o.jsx(ye,{className:"font-bold text-gray-900 text-center w-[100px]",children:"Actions"})]})}),o.jsx(Mr,{children:m?o.jsx(Le,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):h.length===0?o.jsx(Le,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):h.map(R=>o.jsxs(Le,{className:"hover:bg-gray-50",children:[o.jsx(fe,{className:"font-medium",children:nI(R.categoryName)}),o.jsx(fe,{className:"text-gray-600",children:nI(R.categoryCode)}),o.jsx(fe,{children:R.categoryPhotoUrl?.trim()?o.jsx("img",{src:Ju(R.categoryPhotoUrl),alt:"",className:"w-9 h-9 rounded object-cover border border-gray-200"}):o.jsx("span",{className:"text-gray-400 text-sm",children:"—"})}),o.jsx(fe,{children:o.jsx(kr,{className:R.state?"bg-green-600":"bg-gray-400",children:R.state?"Active":"Inactive"})}),o.jsx(fe,{className:"font-numeric",children:R.orderNum??"None"}),o.jsx(fe,{className:"text-gray-500 tabular-nums font-numeric",children:R.creationTime?new Date(R.creationTime).toLocaleString():"None"}),o.jsx(fe,{className:"text-center",children:o.jsxs(ga,{open:_===R.id,onOpenChange:L=>C(L?R.id:null),children:[o.jsx(va,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:o.jsx(di,{className:"h-4 w-4 text-gray-500"})})}),o.jsxs(ya,{align:"end",className:"w-40 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>B(R),children:[o.jsx(wn,{className:"w-4 h-4"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>Q(R),children:[o.jsx(Ot,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},R.id))})]})})}),o.jsx("div",{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[o.jsxs("div",{children:["Showing ",x===0?0:(k-1)*$+1,"-",Math.min(k*$,x)," of ",x]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String($),onValueChange:R=>z(Number(R)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(R=>o.jsxs(Ne,{value:String(R),children:[R," / page"]},R))})]}),o.jsx(vi,{className:"mx-0 w-auto justify-end",children:o.jsxs(yi,{children:[o.jsx(Ct,{children:o.jsx(xi,{href:"#",size:"default",onClick:R=>{R.preventDefault(),M(L=>Math.max(1,L-1))},"aria-disabled":k<=1,className:k<=1?"pointer-events-none opacity-50":""})}),o.jsx(Ct,{children:o.jsxs(xa,{href:"#",isActive:!0,size:"default",onClick:R=>R.preventDefault(),children:["Page ",k," / ",H]})}),o.jsx(Ct,{children:o.jsx(bi,{href:"#",size:"default",onClick:R=>{R.preventDefault(),M(L=>Math.min(H,L+1))},"aria-disabled":k>=H,className:k>=H?"pointer-events-none opacity-50":""})})]})})]})]})}),o.jsx(nde,{open:e,onOpenChange:t,onCreated:()=>{M(1),W()}}),o.jsx(ade,{open:r,category:s,onOpenChange:R=>{n(R),R||u(null)},onUpdated:W}),o.jsx(ide,{open:a,category:d,onOpenChange:R=>{i(R),R||c(null)},onDeleted:W})]})}function nde({open:e,onOpenChange:t,onCreated:r}){const[n,a]=b.useState(!1),[i,s]=b.useState({categoryCode:"",categoryName:"",categoryPhotoUrl:null,state:!0,orderNum:null}),u=()=>{s({categoryCode:"",categoryName:"",categoryPhotoUrl:null,state:!0,orderNum:null})};b.useEffect(()=>{e||u()},[e]);const d=async()=>{if(!i.categoryCode.trim()||!i.categoryName.trim()){pe.error("Validation failed",{description:"Category Code and Category Name are required."});return}if(i.orderNum===null||i.orderNum===void 0||!Number.isFinite(i.orderNum)){pe.error("Validation failed",{description:"Order is required."});return}a(!0);try{await Cue(i),pe.success("Label category created.",{description:"The label category has been created successfully."}),t(!1),r()}catch(c){pe.error("Failed to create label category.",{description:c?.message?String(c.message):"Please try again."})}finally{a(!1)}};return o.jsx(vt,{open:e,onOpenChange:t,children:o.jsxs(pt,{className:"sm:max-w-[600px]",children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Add New Label Category"}),o.jsx(Pt,{children:"Enter the details for the new label category."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Category Code *"}),o.jsx(ve,{placeholder:"e.g. CAT_PREP",value:i.categoryCode,onChange:c=>s(h=>({...h,categoryCode:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Category Name *"}),o.jsx(ve,{placeholder:"e.g. Prep",value:i.categoryName,onChange:c=>s(h=>({...h,categoryName:c.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Category photo"}),o.jsx(wd,{value:i.categoryPhotoUrl??"",onChange:c=>s(h=>({...h,categoryPhotoUrl:c||null})),uploadSubDir:"category",oneImageOnly:!0,hint:"JPG, PNG, WebP, or GIF — max 5 MB. Saved as CategoryPhotoUrl."})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Order *"}),o.jsx(ve,{type:"number",placeholder:"e.g. 1",value:i.orderNum??"",onChange:c=>s(h=>({...h,orderNum:c.target.value?Number(c.target.value):null}))})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Gt,{checked:i.state,onCheckedChange:c=>s(h=>({...h,state:c}))})]})]})]}),o.jsxs(wt,{children:[o.jsx(he,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{disabled:n,onClick:d,children:n?"Creating...":"Create"})]})]})})}function ade({open:e,category:t,onOpenChange:r,onUpdated:n}){const[a,i]=b.useState(!1),[s,u]=b.useState(!1),[d,c]=b.useState({categoryCode:"",categoryName:"",categoryPhotoUrl:null,state:!0,orderNum:null});b.useEffect(()=>{e&&t&&c({categoryCode:t.categoryCode??"",categoryName:t.categoryName??"",categoryPhotoUrl:t.categoryPhotoUrl??null,state:t.state??!0,orderNum:t.orderNum??null})},[e,t]);const h=async()=>{if(t?.id){if(!d.categoryCode.trim()||!d.categoryName.trim()){pe.error("Validation failed",{description:"Category Code and Category Name are required."});return}if(d.orderNum===null||d.orderNum===void 0||!Number.isFinite(d.orderNum)){pe.error("Validation failed",{description:"Order is required."});return}i(!0);try{await Eue(t.id,d),pe.success("Label category updated.",{description:"The label category has been updated successfully."}),r(!1),n()}catch(p){pe.error("Failed to update label category.",{description:p?.message?String(p.message):"Please try again."})}finally{i(!1)}}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-[600px]",children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Edit Label Category"}),o.jsx(Pt,{children:"Update the label category details."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Category Code *"}),o.jsx(ve,{placeholder:"e.g. CAT_PREP",value:d.categoryCode,onChange:p=>c(m=>({...m,categoryCode:p.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Category Name *"}),o.jsx(ve,{placeholder:"e.g. Prep",value:d.categoryName,onChange:p=>c(m=>({...m,categoryName:p.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Category photo"}),o.jsx(wd,{value:d.categoryPhotoUrl??"",onChange:p=>c(m=>({...m,categoryPhotoUrl:p||null})),uploadSubDir:"category",oneImageOnly:!0,hint:"JPG, PNG, WebP, or GIF — max 5 MB. Saved as CategoryPhotoUrl."})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Order *"}),o.jsx(ve,{type:"number",placeholder:"e.g. 1",value:d.orderNum??"",onChange:p=>c(m=>({...m,orderNum:p.target.value?Number(p.target.value):null}))})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Gt,{checked:d.state,onCheckedChange:p=>c(m=>({...m,state:p}))})]})]})]}),o.jsxs(wt,{children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{disabled:a,onClick:h,children:a?"Updating...":"Update"})]})]})})}function ide({open:e,category:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>(t?.categoryName??"").trim()||t?.categoryCode||"this category",[t]),u=async()=>{if(t?.id){i(!0);try{await Oue(t.id),pe.success("Label category deleted.",{description:"The label category has been removed successfully."}),r(!1),n()}catch(d){pe.error("Failed to delete label category.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Delete Label Category"}),o.jsx(Pt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(wt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Ot,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}function aI(e){const t=(e??"").trim();return t||"None"}function ode(){const[e,t]=b.useState(!1),[r,n]=b.useState(!1),[a,i]=b.useState(!1),[s,u]=b.useState(null),[d,c]=b.useState(null),[h,p]=b.useState([]),[m,v]=b.useState(!1),[x,y]=b.useState(0),[w,j]=b.useState(0),[_,C]=b.useState(null),[A,E]=b.useState(""),[O,T]=b.useState("all"),[k,M]=b.useState(1),[$,z]=b.useState(10),F=b.useRef(null),V=b.useRef(null),[G,U]=b.useState("");b.useEffect(()=>(V.current&&window.clearTimeout(V.current),V.current=window.setTimeout(()=>U(A.trim()),300),()=>{V.current&&window.clearTimeout(V.current)}),[A]);const H=Math.max(1,Math.ceil(x/$));b.useEffect(()=>{M(1)},[G,O,$]),b.useEffect(()=>((async()=>{F.current?.abort();const L=new AbortController;F.current=L,v(!0);try{const I=Fa(k),X=await CN({skipCount:I,maxResultCount:$,keyword:G||void 0,state:O==="all"?void 0:O==="true"},L.signal);p(X.items??[]),y(X.totalCount??0)}catch(I){if(I?.name==="AbortError")return;pe.error("Failed to load label types.",{description:I?.message?String(I.message):"Please try again."}),p([]),y(0)}finally{v(!1)}})(),()=>F.current?.abort()),[G,O,k,$,w]);const W=()=>j(R=>R+1),B=R=>{C(null),u(R),n(!0)},Q=R=>{C(null),c(R),i(!0)};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"pb-4",children:o.jsx("div",{className:"flex flex-col gap-4",children:o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ve,{placeholder:"Search",value:A,onChange:R=>E(R.target.value),style:{height:40,boxSizing:"border-box"},className:"bg-white border border-gray-300 rounded-md w-40 shrink-0 placeholder:text-gray-500"}),o.jsxs(Ve,{value:O,onValueChange:T,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"State"})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"all",children:"All States"}),o.jsx(Ne,{value:"true",children:"Active"}),o.jsx(Ne,{value:"false",children:"Inactive"})]})]}),o.jsx("div",{className:"flex-1"}),o.jsxs(he,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0",onClick:()=>t(!0),children:["New Label Type ",o.jsx(tn,{className:"ml-1 h-4 w-4"})]})]})})}),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:o.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:o.jsxs(Rr,{children:[o.jsx(Ir,{children:o.jsxs(Le,{className:"bg-gray-50 hover:bg-gray-50",children:[o.jsx(ye,{className:"font-bold text-gray-900 w-[250px]",children:"Label Types"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[200px]",children:"Type Code"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[100px]",children:"State"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[100px]",children:"Order"}),o.jsx(ye,{className:"font-bold text-gray-900",children:"Last Edited"}),o.jsx(ye,{className:"font-bold text-gray-900 text-center w-[100px]",children:"Actions"})]})}),o.jsx(Mr,{children:m?o.jsx(Le,{children:o.jsx(fe,{colSpan:6,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):h.length===0?o.jsx(Le,{children:o.jsx(fe,{colSpan:6,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):h.map(R=>o.jsxs(Le,{className:"hover:bg-gray-50",children:[o.jsx(fe,{className:"font-medium",children:aI(R.typeName)}),o.jsx(fe,{className:"text-gray-600",children:aI(R.typeCode)}),o.jsx(fe,{children:o.jsx(kr,{className:R.state?"bg-green-600":"bg-gray-400",children:R.state?"Active":"Inactive"})}),o.jsx(fe,{className:"font-numeric",children:R.orderNum??"None"}),o.jsx(fe,{className:"text-gray-500 tabular-nums font-numeric",children:R.creationTime?new Date(R.creationTime).toLocaleString():"None"}),o.jsx(fe,{className:"text-center",children:o.jsxs(ga,{open:_===R.id,onOpenChange:L=>C(L?R.id:null),children:[o.jsx(va,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:o.jsx(di,{className:"h-4 w-4 text-gray-500"})})}),o.jsxs(ya,{align:"end",className:"w-40 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>B(R),children:[o.jsx(wn,{className:"w-4 h-4"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>Q(R),children:[o.jsx(Ot,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},R.id))})]})})}),o.jsx("div",{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[o.jsxs("div",{children:["Showing ",x===0?0:(k-1)*$+1,"-",Math.min(k*$,x)," of ",x]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String($),onValueChange:R=>z(Number(R)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(R=>o.jsxs(Ne,{value:String(R),children:[R," / page"]},R))})]}),o.jsx(vi,{className:"mx-0 w-auto justify-end",children:o.jsxs(yi,{children:[o.jsx(Ct,{children:o.jsx(xi,{href:"#",size:"default",onClick:R=>{R.preventDefault(),M(L=>Math.max(1,L-1))},"aria-disabled":k<=1,className:k<=1?"pointer-events-none opacity-50":""})}),o.jsx(Ct,{children:o.jsxs(xa,{href:"#",isActive:!0,size:"default",onClick:R=>R.preventDefault(),children:["Page ",k," / ",H]})}),o.jsx(Ct,{children:o.jsx(bi,{href:"#",size:"default",onClick:R=>{R.preventDefault(),M(L=>Math.min(H,L+1))},"aria-disabled":k>=H,className:k>=H?"pointer-events-none opacity-50":""})})]})})]})]})}),o.jsx(sde,{open:e,onOpenChange:t,onCreated:()=>{M(1),W()}}),o.jsx(lde,{open:r,type:s,onOpenChange:R=>{n(R),R||u(null)},onUpdated:W}),o.jsx(cde,{open:a,type:d,onOpenChange:R=>{i(R),R||c(null)},onDeleted:W})]})}function sde({open:e,onOpenChange:t,onCreated:r}){const[n,a]=b.useState(!1),[i,s]=b.useState({typeCode:"",typeName:"",state:!0,orderNum:null}),u=()=>{s({typeCode:"",typeName:"",state:!0,orderNum:null})};b.useEffect(()=>{e||u()},[e]);const d=async()=>{if(!i.typeCode.trim()||!i.typeName.trim()){pe.error("Validation failed",{description:"Type Code and Type Name are required."});return}if(i.orderNum===null||i.orderNum===void 0||!Number.isFinite(i.orderNum)){pe.error("Validation failed",{description:"Order is required."});return}a(!0);try{await Pue(i),pe.success("Label type created.",{description:"The label type has been created successfully."}),t(!1),r()}catch(c){pe.error("Failed to create label type.",{description:c?.message?String(c.message):"Please try again."})}finally{a(!1)}};return o.jsx(vt,{open:e,onOpenChange:t,children:o.jsxs(pt,{className:"sm:max-w-[600px]",children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Add New Label Type"}),o.jsx(Pt,{children:"Enter the details for the new label type."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Type Code *"}),o.jsx(ve,{placeholder:"e.g. TYPE_DEFROST",value:i.typeCode,onChange:c=>s(h=>({...h,typeCode:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Type Name *"}),o.jsx(ve,{placeholder:"e.g. Defrost",value:i.typeName,onChange:c=>s(h=>({...h,typeName:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Order *"}),o.jsx(ve,{type:"number",placeholder:"e.g. 1",value:i.orderNum??"",onChange:c=>s(h=>({...h,orderNum:c.target.value?Number(c.target.value):null}))})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Gt,{checked:i.state,onCheckedChange:c=>s(h=>({...h,state:c}))})]})]})]}),o.jsxs(wt,{children:[o.jsx(he,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{disabled:n,onClick:d,children:n?"Creating...":"Create"})]})]})})}function lde({open:e,type:t,onOpenChange:r,onUpdated:n}){const[a,i]=b.useState(!1),[s,u]=b.useState({typeCode:"",typeName:"",state:!0,orderNum:null});b.useEffect(()=>{e&&t&&u({typeCode:t.typeCode??"",typeName:t.typeName??"",state:t.state??!0,orderNum:t.orderNum??null})},[e,t]);const d=async()=>{if(t?.id){if(!s.typeCode.trim()||!s.typeName.trim()){pe.error("Validation failed",{description:"Type Code and Type Name are required."});return}if(s.orderNum===null||s.orderNum===void 0||!Number.isFinite(s.orderNum)){pe.error("Validation failed",{description:"Order is required."});return}i(!0);try{await Aue(t.id,s),pe.success("Label type updated.",{description:"The label type has been updated successfully."}),r(!1),n()}catch(c){pe.error("Failed to update label type.",{description:c?.message?String(c.message):"Please try again."})}finally{i(!1)}}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-[600px]",children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Edit Label Type"}),o.jsx(Pt,{children:"Update the label type details."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Type Code *"}),o.jsx(ve,{placeholder:"e.g. TYPE_DEFROST",value:s.typeCode,onChange:c=>u(h=>({...h,typeCode:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Type Name *"}),o.jsx(ve,{placeholder:"e.g. Defrost",value:s.typeName,onChange:c=>u(h=>({...h,typeName:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Order *"}),o.jsx(ve,{type:"number",placeholder:"e.g. 1",value:s.orderNum??"",onChange:c=>u(h=>({...h,orderNum:c.target.value?Number(c.target.value):null}))})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Gt,{checked:s.state,onCheckedChange:c=>u(h=>({...h,state:c}))})]})]})]}),o.jsxs(wt,{children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{disabled:a,onClick:d,children:a?"Updating...":"Update"})]})]})})}function cde({open:e,type:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>(t?.typeName??"").trim()||t?.typeCode||"this type",[t]),u=async()=>{if(t?.id){i(!0);try{await Tue(t.id),pe.success("Label type deleted.",{description:"The label type has been removed successfully."}),r(!1),n()}catch(d){pe.error("Failed to delete label type.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Delete Label Type"}),o.jsx(Pt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(wt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Ot,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}const ude=["模版信息","标签信息","自动生成","打印时输入"];function G5(e){return ude.includes(e)}function K5(e){return e==="自动生成"?"AUTO_DB":e==="打印时输入"?"PRINT_INPUT":"FIXED"}function dde(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"")||"field"}function fde(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hde(e,t){const r=dde(e),n=new RegExp(`^${fde(r)}(\\d+)$`,"i"),a=[];for(const s of t){const u=(s.elementName??"").trim();if(!u)continue;const d=u.match(n);d&&a.push(parseInt(d[1],10)),u.toLowerCase()===r&&a.push(1)}const i=a.length>0?Math.max(...a)+1:1;return`${r}${i}`}const pde={模版信息:"template",标签信息:"label",自动生成:"auto",打印时输入:"print"};function X5(e,t){const r=pde[e],n=(t??"").trim()||"Field";return`${r}_${n}`}const mde=/^(template|label|auto|print)_/;function gde(e){return mde.test(e.trim())}function vde(e){const t=e.config??{};if(Ll(e)){if(e.type==="TEXT_STATIC"){const r=t.inputType;return r==="number"?"Number":r==="options"?"Multiple Options":"Text"}if(e.type==="DATE")return"Date & Time";if(e.type==="WEIGHT")return"Weight"}switch(e.type){case"TEXT_PRODUCT":return"Label Name";case"TEXT_PRICE":return"Price";case"NUTRITION":return"Nutrition Facts";case"DURATION":return"Duration";case"DATE":return"Current Date";case"TIME":return"Current Time";case"BARCODE":return"Barcode";case"QRCODE":return"QR Code";case"BLANK":return"Blank Space";case"IMAGE":return"Image";case"WEIGHT_PRICE":return"Weight Price";case"TEXT_STATIC":return"Text";default:return e.type.replace(/_/g," ")}}function yde(){return`template-${Date.now()}`}function xde(){return`el-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function bde(e){return{id:e??yde(),name:"未命名模板",labelType:"PRICE",unit:"cm",width:6,height:4,appliedLocation:"ALL",appliedLocationIds:[],showRuler:!0,showGrid:!0,elements:[]}}const V1=[{name:'2"×1"',width:2,height:1,unit:"inch"},{name:'2"×2"',width:2,height:2,unit:"inch"},{name:'3"×1"',width:3,height:1,unit:"inch"},{name:'3"×2"',width:3,height:2,unit:"inch"},{name:'4"×2"',width:4,height:2,unit:"inch"},{name:'4"×6"',width:4,height:6,unit:"inch"},{name:"6cm×4cm",width:6,height:4,unit:"cm"},{name:"10cm×6cm",width:10,height:6,unit:"cm"},{name:"A4",width:21,height:29.7,unit:"cm"},{name:"A5",width:14.8,height:21,unit:"cm"}];function wde(e,t=20,r=20){const n=xde(),i={TEXT_STATIC:{width:120,height:24,config:{text:"文本",fontFamily:"Arial",fontSize:14,fontWeight:"normal",textAlign:"left"}},TEXT_PRODUCT:{width:120,height:24,config:{text:"商品名",fontFamily:"Arial",fontSize:14,fontWeight:"normal",textAlign:"left"}},TEXT_PRICE:{width:80,height:24,config:{text:"0.00",prefix:"¥",decimal:2,fontFamily:"Arial",fontSize:14,fontWeight:"bold",textAlign:"right"}},BARCODE:{width:160,height:48,config:{barcodeType:"CODE128",data:"123456789",showText:!0,orientation:"horizontal"}},QRCODE:{width:80,height:80,config:{data:"https://example.com",errorLevel:"M"}},IMAGE:{width:60,height:60,config:{src:"",scaleMode:"contain"}},DATE:{width:120,height:24,config:{format:"YYYY-MM-DD",offsetDays:0}},TIME:{width:100,height:24,config:{format:"HH:mm",offsetDays:0}},DURATION:{width:120,height:24,config:{format:"YYYY-MM-DD",offsetDays:3}},WEIGHT:{width:80,height:24,config:{unit:"g",value:500}},WEIGHT_PRICE:{width:100,height:24,config:{unitPrice:10,weight:.5,currency:"¥"}},BLANK:{width:40,height:24,config:{}},NUTRITION:{width:200,height:120,config:{calories:120,fat:"5g",protein:"3g",carbs:"10g",layout:"standard"}}}[e];return{id:n,type:e,x:t,y:r,width:i.width,height:i.height,rotation:"horizontal",border:"none",config:{...i.config}}}function Y5(e){return e.map((t,r)=>({id:t.id,elementName:(t.elementName??"").trim(),type:t.type,x:t.x,y:t.y,width:t.width,height:t.height,rotation:t.rotation,border:t.border,zIndex:t.zIndex??r+1,orderNum:t.orderNum??r+1,valueSourceType:Q5(t),...t.inputKey!=null&&String(t.inputKey).trim()!==""?{inputKey:String(t.inputKey).trim()}:{},isRequiredInput:t.isRequiredInput??!1,config:t.config??{}}))}function EN(e){const t=String(e.appliedLocation??"").trim().toUpperCase();return t==="ALL"?"ALL":t==="SPECIFIED"||(e.appliedLocationIds?.length??0)>0?"SPECIFIED":"ALL"}function Ll(e){if(String(e.valueSourceType??"").trim().toUpperCase()==="PRINT_INPUT")return!0;const r=e.config??{};return e.type==="TEXT_STATIC"&&r.inputType!=null&&String(r.inputType).trim()!==""||e.type==="DATE"&&(r.inputType==="datetime"||r.inputType==="date")||e.type==="WEIGHT"}function Sde(e){const t=e.config??{},r=typeof t.text=="string"?t.text.trim():"";if(r)return r;const n=t.inputType;return n==="number"?"Number":n==="text"?"Text":n==="options"?"Multiple Options":n==="datetime"||n==="date"?"Date & Time":e.type==="WEIGHT"?"Weight":e.type.replace(/_/g," ")}function jde(e){const t=e,r=e.inputKey??t.InputKey;return typeof r=="string"?r.trim():""}function Nde(e){return!(J5(e)!=="FIXED"||e.type==="BLANK")}function _de(e){const t=(e.elementName??"").trim();if(t)return t;const r=jde(e);if(r)return r;const n=e.config??{};return e.type==="TEXT_PRODUCT"?(typeof n.text=="string"?n.text.trim():"")||"Product name":e.type==="TEXT_PRICE"?(typeof n.text=="string"?n.text.trim():"")||"Price":e.type==="IMAGE"?"Image":Sde(e)}function iI(e){return[...e].sort((t,r)=>{const n=t.orderNum??0,a=r.orderNum??0;if(n!==a)return n-a;const i=t.zIndex??0,s=r.zIndex??0;return i!==s?i-s:0})}function J5(e){const t=String(e.valueSourceType??"").trim().toUpperCase();if(t==="FIXED"&&Ll({...e,valueSourceType:""}))return"PRINT_INPUT";if(t==="FIXED"||t==="AUTO_DB"||t==="PRINT_INPUT")return t;const r=(e.libraryCategory??"").trim();if(r.startsWith("print_"))return"PRINT_INPUT";if(r.startsWith("auto_"))return"AUTO_DB";if(r.startsWith("template_")||r.startsWith("label_"))return"FIXED";const n=e.libraryCategory??"";return G5(n)?K5(n):Ll({...e,valueSourceType:""})?"PRINT_INPUT":"FIXED"}function Q5(e){return J5(e)}function Cde(e){if(Ll(e))return"打印时输入";switch(e.type){case"TEXT_PRODUCT":case"NUTRITION":case"DURATION":case"TEXT_PRICE":case"WEIGHT_PRICE":return"标签信息";case"DATE":case"TIME":return"自动生成";case"TEXT_STATIC":case"BARCODE":case"QRCODE":case"IMAGE":case"BLANK":default:return"模版信息"}}function Ede(e){const t=e.libraryCategory?.trim();if(t&&gde(t))return t;const r=t&&G5(t)?t:Cde(e),n=vde(e);return X5(r,n)}const Ode=[{title:"模版信息",items:[{label:"Text",type:"TEXT_STATIC"},{label:"QR Code",type:"QRCODE"},{label:"Barcode",type:"BARCODE"},{label:"Blank Space",type:"BLANK"},{label:"Price",type:"TEXT_PRICE"},{label:"Image",type:"IMAGE"},{label:"Logo",type:"IMAGE"}]},{title:"标签信息",items:[{label:"Label Name",type:"TEXT_PRODUCT"},{label:"Text",type:"TEXT_STATIC"},{label:"QR Code",type:"QRCODE"},{label:"Barcode",type:"BARCODE"},{label:"Nutrition Facts",type:"NUTRITION"},{label:"Price",type:"TEXT_PRICE"},{label:"Duration Date",type:"DATE"},{label:"Duration Time",type:"TIME"},{label:"Duration",type:"DURATION"},{label:"Image",type:"IMAGE"},{label:"Label Type",type:"TEXT_STATIC"},{label:"How-to",type:"TEXT_STATIC"},{label:"Expiration Alert",type:"TEXT_STATIC"}]},{title:"自动生成",items:[{label:"Company",type:"TEXT_STATIC"},{label:"Employee",type:"TEXT_STATIC"},{label:"Current Date",type:"DATE"},{label:"Current Time",type:"TIME"},{label:"Label ID",type:"TEXT_STATIC"}]},{title:"打印时输入",subtitle:"点击添加到画布",items:[{label:"Text",type:"TEXT_STATIC",config:{inputType:"text"}},{label:"Weight",type:"WEIGHT"},{label:"Number",type:"TEXT_STATIC",config:{inputType:"number",text:"0"}},{label:"Date & Time",type:"DATE",config:{inputType:"datetime"}},{label:"Multiple Options",type:"TEXT_STATIC",config:{inputType:"options",multipleOptionId:"",selectedOptionValues:[],text:"文本",fontFamily:"Arial",fontSize:14,fontWeight:"normal",textAlign:"left",prefix:"¥"}}]}];function Pde({onAddElement:e}){return o.jsxs("div",{className:"w-44 shrink-0 border-r border-gray-200 bg-white flex flex-col h-full",children:[o.jsx("div",{className:"px-2 py-2 border-b border-gray-200 font-semibold text-gray-800 text-sm",children:"Elements"}),o.jsx(ll,{className:"flex-1",children:o.jsx("div",{className:"p-1.5 space-y-3",children:Ode.map(t=>o.jsxs("div",{children:[o.jsx("div",{className:"px-2 py-1 text-xs font-medium text-gray-500 uppercase tracking-wide",children:t.title}),t.subtitle&&o.jsx("div",{className:"px-2 py-0.5 text-[10px] text-gray-400",children:t.subtitle}),o.jsx("div",{className:"grid grid-cols-2 gap-1 mt-0.5",children:t.items.map((r,n)=>o.jsx("button",{type:"button",onClick:()=>e(r.type,r.config,t.title,r.label),className:"text-left px-2 py-1 text-xs rounded hover:bg-gray-100 border border-transparent hover:border-gray-200 truncate",children:r.label},`${t.title}-${r.label}-${n}`))})]},t.title))})})]})}var ch={},Xc={},uh={},oI;function Cn(){if(oI)return uh;oI=1,Object.defineProperty(uh,"__esModule",{value:!0});function e(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}var t=function r(n,a){e(this,r),this.data=n,this.text=a.text||n,this.options=a};return uh.default=t,uh}var sI;function Ade(){if(sI)return Xc;sI=1,Object.defineProperty(Xc,"__esModule",{value:!0}),Xc.CODE39=void 0;var e=(function(){function y(w,j){for(var _=0;_=200){w=m.shift()-105;var j=n.SWAP[w];j!==void 0?y=h.next(m,v+1,j):((x===n.SET_A||x===n.SET_B)&&w===n.SHIFT&&(m[0]=x===n.SET_A?m[0]>95?m[0]-96:m[0]:m[0]<32?m[0]+96:m[0]),y=h.next(m,v+1,x))}else w=h.correctIndex(m,x),y=h.next(m,v+1,x);var _=h.getBar(w),C=w*v;return{result:_+y.result,checksum:C+y.checksum}}}]),h})(r.default);return fh.default=d,fh}var hh={},uI;function Tde(){if(uI)return hh;uI=1,Object.defineProperty(hh,"__esModule",{value:!0});var e=Sd(),t=function(u){return u.match(new RegExp("^"+e.A_CHARS+"*"))[0].length},r=function(u){return u.match(new RegExp("^"+e.B_CHARS+"*"))[0].length},n=function(u){return u.match(new RegExp("^"+e.C_CHARS+"*"))[0]};function a(s,u){var d=u?e.A_CHARS:e.B_CHARS,c=s.match(new RegExp("^("+d+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(c)return c[1]+"Ì"+i(s.substring(c[1].length));var h=s.match(new RegExp("^"+d+"+"))[0];return h.length===s.length?s:h+String.fromCharCode(u?205:206)+a(s.substring(h.length),!u)}function i(s){var u=n(s),d=u.length;if(d===s.length)return s;s=s.substring(d);var c=t(s)>=r(s);return u+String.fromCharCode(c?206:205)+a(s,c)}return hh.default=function(s){var u=void 0,d=n(s).length;if(d>=2)u=e.C_START_CHAR+i(s);else{var c=t(s)>r(s);u=(c?e.A_START_CHAR:e.B_START_CHAR)+a(s,c)}return u.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(h,p){return"Ë"+p})},hh}var dI;function kde(){if(dI)return dh;dI=1,Object.defineProperty(dh,"__esModule",{value:!0});var e=Cg(),t=a(e),r=Tde(),n=a(r);function a(c){return c&&c.__esModule?c:{default:c}}function i(c,h){if(!(c instanceof h))throw new TypeError("Cannot call a class as a function")}function s(c,h){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h&&(typeof h=="object"||typeof h=="function")?h:c}function u(c,h){if(typeof h!="function"&&h!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof h);c.prototype=Object.create(h&&h.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),h&&(Object.setPrototypeOf?Object.setPrototypeOf(c,h):c.__proto__=h)}var d=(function(c){u(h,c);function h(p,m){if(i(this,h),/^[\x00-\x7F\xC8-\xD3]+$/.test(p))var v=s(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,(0,n.default)(p),m));else var v=s(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,p,m));return s(v)}return h})(t.default);return dh.default=d,dh}var ph={},fI;function Rde(){if(fI)return ph;fI=1,Object.defineProperty(ph,"__esModule",{value:!0});var e=(function(){function c(h,p){for(var m=0;mx.width*10?x.width*10:x.fontSize,y.guardHeight=x.height+y.fontSize/2+x.textMargin,y}return e(m,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(x,y){return this.text.substr(x,y)}},{key:"leftEncode",value:function(x,y){return(0,n.default)(x,y)}},{key:"rightText",value:function(x,y){return this.text.substr(x,y)}},{key:"rightEncode",value:function(x,y){return(0,n.default)(x,y)}},{key:"encodeGuarded",value:function(){var x={fontSize:this.fontSize},y={height:this.guardHeight};return[{data:t.SIDE_BIN,options:y},{data:this.leftEncode(),text:this.leftText(),options:x},{data:t.MIDDLE_BIN,options:y},{data:this.rightEncode(),text:this.rightText(),options:x},{data:t.SIDE_BIN,options:y}]}},{key:"encodeFlat",value:function(){var x=[t.SIDE_BIN,this.leftEncode(),t.MIDDLE_BIN,this.rightEncode(),t.SIDE_BIN];return{data:x.join(""),text:this.text}}}]),m})(i.default);return yh.default=h,yh}var xI;function Lde(){if(xI)return vh;xI=1,Object.defineProperty(vh,"__esModule",{value:!0});var e=(function(){function p(m,v){for(var x=0;xx.width*10?y.fontSize=x.width*10:y.fontSize=x.fontSize,y.guardHeight=x.height+y.fontSize/2+x.textMargin,y}return e(m,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==h(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var x="";return x+="101",x+=(0,r.default)(this.data.substr(0,6),"LLLLLL"),x+="01010",x+=(0,r.default)(this.data.substr(6,6),"RRRRRR"),x+="101",{data:x,text:this.text}}},{key:"guardedEncoding",value:function(){var x=[];return this.displayValue&&x.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),x.push({data:"101"+(0,r.default)(this.data[0],"L"),options:{height:this.guardHeight}}),x.push({data:(0,r.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),x.push({data:"01010",options:{height:this.guardHeight}}),x.push({data:(0,r.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),x.push({data:(0,r.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&x.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),x}}]),m})(a.default);function h(p){var m=0,v;for(v=1;v<11;v+=2)m+=parseInt(p[v]);for(v=0;v<11;v+=2)m+=parseInt(p[v])*3;return(10-m%10)%10}return Yc.default=c,Yc}var jh={},NI;function zde(){if(NI)return jh;NI=1,Object.defineProperty(jh,"__esModule",{value:!0});var e=(function(){function x(y,w){for(var j=0;jj.width*10?_.fontSize=j.width*10:_.fontSize=j.fontSize,_.guardHeight=j.height+_.fontSize/2+j.textMargin,_}return e(y,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var j="";return j+="101",j+=this.encodeMiddleDigits(),j+="010101",{data:j,text:this.text}}},{key:"guardedEncoding",value:function(){var j=[];return this.displayValue&&j.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),j.push({data:"101",options:{height:this.guardHeight}}),j.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),j.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&j.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),j}},{key:"encodeMiddleDigits",value:function(){var j=this.upcA[0],_=this.upcA[this.upcA.length-1],C=p[parseInt(_)][parseInt(j)];return(0,r.default)(this.middleDigits,C)}}]),y})(a.default);function v(x,y){for(var w=parseInt(x[x.length-1]),j=h[w],_="",C=0,A=0;A=3&&this.number<=131070}}]),c})(r.default);return Qc.pharmacode=u,Qc}var Zc={},$I;function Qde(){if($I)return Zc;$I=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.codabar=void 0;var e=(function(){function d(c,h){for(var p=0;p":["(%)","I"],"?":["(%)","J"],"@":["(%)","V"],"[":["(%)","K"],"\\":["(%)","L"],"]":["(%)","M"],"^":["(%)","N"],_:["(%)","O"],"`":["(%)","W"],a:["(+)","A"],b:["(+)","B"],c:["(+)","C"],d:["(+)","D"],e:["(+)","E"],f:["(+)","F"],g:["(+)","G"],h:["(+)","H"],i:["(+)","I"],j:["(+)","J"],k:["(+)","K"],l:["(+)","L"],m:["(+)","M"],n:["(+)","N"],o:["(+)","O"],p:["(+)","P"],q:["(+)","Q"],r:["(+)","R"],s:["(+)","S"],t:["(+)","T"],u:["(+)","U"],v:["(+)","V"],w:["(+)","W"],x:["(+)","X"],y:["(+)","Y"],z:["(+)","Z"],"{":["(%)","P"],"|":["(%)","Q"],"}":["(%)","R"],"~":["(%)","S"],"":["(%)","T"]}),zs}var FI;function rB(){if(FI)return Th;FI=1,Object.defineProperty(Th,"__esModule",{value:!0});var e=(function(){function c(h,p){for(var m=0;m0?h.fontSize+h.textMargin:0)+h.marginTop+h.marginBottom}function a(c,h,p){if(p.displayValue&&hh&&(h=c[p].height);return h}function d(c,h,p){var m;if(p)m=p;else if(typeof document<"u")m=document.createElement("canvas").getContext("2d");else return 0;m.font=h.fontOptions+" "+h.fontSize+"px "+h.font;var v=m.measureText(c);if(!v)return 0;var x=v.width;return x}return fn.getMaximumHeightOfEncodings=u,fn.getEncodingHeight=n,fn.getBarcodePadding=a,fn.calculateEncodingAttributes=i,fn.getTotalWidthOfEncodings=s,fn}var QI;function sfe(){if(QI)return zh;QI=1,Object.defineProperty(zh,"__esModule",{value:!0});var e=(function(){function u(d,c){for(var h=0;h0?(v=0,p.textAlign="left"):c.textAlign=="right"?(v=h.width-1,p.textAlign="right"):(v=h.width/2,p.textAlign="center"),p.fillText(h.text,v,x)}}},{key:"moveCanvasDrawing",value:function(c){var h=this.canvas.getContext("2d");h.translate(c.width,0)}},{key:"restoreCanvas",value:function(){var c=this.canvas.getContext("2d");c.restore()}}]),u})();return zh.default=s,zh}var qh={},ZI;function lfe(){if(ZI)return qh;ZI=1,Object.defineProperty(qh,"__esModule",{value:!0});var e=(function(){function d(c,h){for(var p=0;p0&&(this.drawRect(w-p.width*y,x,p.width*y,p.height,h),y=0);y>0&&this.drawRect(w-p.width*(y-1),x,p.width*y,p.height,h)}},{key:"drawSVGText",value:function(h,p,m){var v=this.document.createElementNS(s,"text");if(p.displayValue){var x,y;v.setAttribute("font-family",p.font),v.setAttribute("font-size",p.fontSize),p.fontOptions.includes("bold")&&v.setAttribute("font-weight","bold"),p.fontOptions.includes("italic")&&v.setAttribute("font-style","italic"),p.textPosition=="top"?y=p.fontSize-p.textMargin:y=p.height+p.textMargin+p.fontSize,p.textAlign=="left"||m.barcodePadding>0?(x=0,v.setAttribute("text-anchor","start")):p.textAlign=="right"?(x=m.width-1,v.setAttribute("text-anchor","end")):(x=m.width/2,v.setAttribute("text-anchor","middle")),v.setAttribute("x",x),v.setAttribute("y",y),v.appendChild(this.document.createTextNode(m.text)),h.appendChild(v)}}},{key:"setSvgAttributes",value:function(h,p){var m=this.svg;m.setAttribute("width",h+"px"),m.setAttribute("height",p+"px"),m.setAttribute("x","0px"),m.setAttribute("y","0px"),m.setAttribute("viewBox","0 0 "+h+" "+p),m.setAttribute("xmlns",s),m.setAttribute("version","1.1")}},{key:"createGroup",value:function(h,p,m){var v=this.document.createElementNS(s,"g");return v.setAttribute("transform","translate("+h+", "+p+")"),m.appendChild(v),v}},{key:"setGroupOptions",value:function(h,p){h.setAttribute("fill",p.lineColor)}},{key:"drawRect",value:function(h,p,m,v,x){var y=this.document.createElementNS(s,"rect");return y.setAttribute("x",h),y.setAttribute("y",p),y.setAttribute("width",m),y.setAttribute("height",v),x.appendChild(y),y}}]),d})();return qh.default=u,qh}var Uh={},eM;function cfe(){if(eM)return Uh;eM=1,Object.defineProperty(Uh,"__esModule",{value:!0});var e=(function(){function n(a,i){for(var s=0;s"u"?"undefined":e(h))==="object"&&!h.nodeName)return{element:h,renderer:a.default.ObjectRenderer};throw new i.InvalidElementException}}function d(h){var p=document.querySelectorAll(h);if(p.length!==0){for(var m=[],v=0;v"u")throw Error("No element to render on was provided.");return V._renderProperties=(0,c.default)($),V._encodings=[],V._options=w.default,V._errorHandler=new v.default(V),typeof z<"u"&&(F=F||{},F.format||(F.format=T()),V.options(F)[F.format](z,F).render()),V};C.getModule=function(M){return t.default[M]};for(var A in t.default)t.default.hasOwnProperty(A)&&E(t.default,A);function E(M,$){_.prototype[$]=_.prototype[$.toUpperCase()]=_.prototype[$.toLowerCase()]=function(z,F){var V=this;return V._errorHandler.wrapBarcodeCall(function(){F.text=typeof F.text>"u"?void 0:""+F.text;var G=(0,n.default)(V._options,F);G=(0,p.default)(G);var U=M[$],H=O(z,U,G);return V._encodings.push(H),V})}}function O(M,$,z){M=""+M;var F=new $(M,z);if(!F.valid())throw new x.InvalidInputException(F.constructor.name,M);var V=F.encode();V=(0,i.default)(V);for(var G=0;Gt in e?gfe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,BS=(e,t)=>{for(var r in t||(t={}))sB.call(t,r)&&oM(e,r,t[r]);if(pm)for(var r of pm(t))lB.call(t,r)&&oM(e,r,t[r]);return e},FS=(e,t)=>{var r={};for(var n in e)sB.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&pm)for(var n of pm(e))t.indexOf(n)<0&&lB.call(e,n)&&(r[n]=e[n]);return r};/** - * @license QR Code generator library (TypeScript) - * Copyright (c) Project Nayuki. - * SPDX-License-Identifier: MIT - */var rs;(e=>{const t=class ot{constructor(d,c,h,p){if(this.version=d,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],dot.MAX_VERSION)throw new RangeError("Version value out of range");if(p<-1||p>7)throw new RangeError("Mask value out of range");this.size=d*4+17;let m=[];for(let x=0;x7)throw new RangeError("Invalid value");let x,y;for(x=h;;x++){const C=ot.getNumDataCodewords(x,c)*8,A=s.getTotalBits(d,x);if(A<=C){y=A;break}if(x>=p)throw new RangeError("Data too long")}for(const C of[ot.Ecc.MEDIUM,ot.Ecc.QUARTILE,ot.Ecc.HIGH])v&&y<=ot.getNumDataCodewords(x,C)*8&&(c=C);let w=[];for(const C of d){r(C.mode.modeBits,4,w),r(C.numChars,C.mode.numCharCountBits(x),w);for(const A of C.getData())w.push(A)}a(w.length==y);const j=ot.getNumDataCodewords(x,c)*8;a(w.length<=j),r(0,Math.min(4,j-w.length),w),r(0,(8-w.length%8)%8,w),a(w.length%8==0);for(let C=236;w.length_[A>>>3]|=C<<7-(A&7)),new ot(x,c,_,m)}getModule(d,c){return 0<=d&&d>>9)*1335;const p=(c<<10|h)^21522;a(p>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,n(p,m));this.setFunctionModule(8,7,n(p,6)),this.setFunctionModule(8,8,n(p,7)),this.setFunctionModule(7,8,n(p,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,n(p,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,n(p,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,n(p,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let d=this.version;for(let h=0;h<12;h++)d=d<<1^(d>>>11)*7973;const c=this.version<<12|d;a(c>>>18==0);for(let h=0;h<18;h++){const p=n(c,h),m=this.size-11+h%3,v=Math.floor(h/3);this.setFunctionModule(m,v,p),this.setFunctionModule(v,m,p)}}drawFinderPattern(d,c){for(let h=-4;h<=4;h++)for(let p=-4;p<=4;p++){const m=Math.max(Math.abs(p),Math.abs(h)),v=d+p,x=c+h;0<=v&&v{(C!=y-m||E>=x)&&_.push(A[C])});return a(_.length==v),_}drawCodewords(d){if(d.length!=Math.floor(ot.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let h=this.size-1;h>=1;h-=2){h==6&&(h=5);for(let p=0;p>>3],7-(c&7)),c++)}}a(c==d.length*8)}applyMask(d){if(d<0||d>7)throw new RangeError("Mask value out of range");for(let c=0;c5&&d++):(this.finderPenaltyAddHistory(x,y),v||(d+=this.finderPenaltyCountPatterns(y)*ot.PENALTY_N3),v=this.modules[m][w],x=1);d+=this.finderPenaltyTerminateAndCount(v,x,y)*ot.PENALTY_N3}for(let m=0;m5&&d++):(this.finderPenaltyAddHistory(x,y),v||(d+=this.finderPenaltyCountPatterns(y)*ot.PENALTY_N3),v=this.modules[w][m],x=1);d+=this.finderPenaltyTerminateAndCount(v,x,y)*ot.PENALTY_N3}for(let m=0;mv+(x?1:0),c);const h=this.size*this.size,p=Math.ceil(Math.abs(c*20-h*10)/h)-1;return a(0<=p&&p<=9),d+=p*ot.PENALTY_N4,a(0<=d&&d<=2568888),d}getAlignmentPatternPositions(){if(this.version==1)return[];{const d=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(d*2-2))*2;let h=[6];for(let p=this.size-7;h.lengthot.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*d+128)*d+64;if(d>=2){const h=Math.floor(d/7)+2;c-=(25*h-10)*h-55,d>=7&&(c-=36)}return a(208<=c&&c<=29648),c}static getNumDataCodewords(d,c){return Math.floor(ot.getNumRawDataModules(d)/8)-ot.ECC_CODEWORDS_PER_BLOCK[c.ordinal][d]*ot.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][d]}static reedSolomonComputeDivisor(d){if(d<1||d>255)throw new RangeError("Degree out of range");let c=[];for(let p=0;p0);for(const p of d){const m=p^h.shift();h.push(0),c.forEach((v,x)=>h[x]^=ot.reedSolomonMultiply(v,m))}return h}static reedSolomonMultiply(d,c){if(d>>>8||c>>>8)throw new RangeError("Byte out of range");let h=0;for(let p=7;p>=0;p--)h=h<<1^(h>>>7)*285,h^=(c>>>p&1)*d;return a(h>>>8==0),h}finderPenaltyCountPatterns(d){const c=d[1];a(c<=this.size*3);const h=c>0&&d[2]==c&&d[3]==c*3&&d[4]==c&&d[5]==c;return(h&&d[0]>=c*4&&d[6]>=c?1:0)+(h&&d[6]>=c*4&&d[0]>=c?1:0)}finderPenaltyTerminateAndCount(d,c,h){return d&&(this.finderPenaltyAddHistory(c,h),c=0),c+=this.size,this.finderPenaltyAddHistory(c,h),this.finderPenaltyCountPatterns(h)}finderPenaltyAddHistory(d,c){c[0]==0&&(d+=this.size),c.pop(),c.unshift(d)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function r(u,d,c){if(d<0||d>31||u>>>d)throw new RangeError("Value out of range");for(let h=d-1;h>=0;h--)c.push(u>>>h&1)}function n(u,d){return(u>>>d&1)!=0}function a(u){if(!u)throw new Error("Assertion error")}const i=class Ht{constructor(d,c,h){if(this.mode=d,this.numChars=c,this.bitData=h,c<0)throw new RangeError("Invalid argument");this.bitData=h.slice()}static makeBytes(d){let c=[];for(const h of d)r(h,8,c);return new Ht(Ht.Mode.BYTE,d.length,c)}static makeNumeric(d){if(!Ht.isNumeric(d))throw new RangeError("String contains non-numeric characters");let c=[];for(let h=0;h=1<{(t=>{const r=class{constructor(a,i){this.ordinal=a,this.formatBits=i}};r.LOW=new r(0,1),r.MEDIUM=new r(1,0),r.QUARTILE=new r(2,3),r.HIGH=new r(3,2),t.Ecc=r})(e.QrCode||(e.QrCode={}))})(rs||(rs={}));(e=>{(t=>{const r=class{constructor(a,i){this.modeBits=a,this.numBitsCharCount=i}numCharCountBits(a){return this.numBitsCharCount[Math.floor((a+7)/17)]}};r.NUMERIC=new r(1,[10,12,14]),r.ALPHANUMERIC=new r(2,[9,11,13]),r.BYTE=new r(4,[8,16,16]),r.KANJI=new r(8,[8,10,12]),r.ECI=new r(7,[0,0,0]),t.Mode=r})(e.QrSegment||(e.QrSegment={}))})(rs||(rs={}));var Js=rs;/** - * @license qrcode.react - * Copyright (c) Paul O'Shannessy - * SPDX-License-Identifier: ISC - */var vfe={L:Js.QrCode.Ecc.LOW,M:Js.QrCode.Ecc.MEDIUM,Q:Js.QrCode.Ecc.QUARTILE,H:Js.QrCode.Ecc.HIGH},cB=128,uB="L",dB="#FFFFFF",fB="#000000",hB=!1,pB=1,yfe=4,xfe=0,bfe=.1;function mB(e,t=0){const r=[];return e.forEach(function(n,a){let i=null;n.forEach(function(s,u){if(!s&&i!==null){r.push(`M${i+t} ${a+t}h${u-i}v1H${i+t}z`),i=null;return}if(u===n.length-1){if(!s)return;i===null?r.push(`M${u+t},${a+t} h1v1H${u+t}z`):r.push(`M${i+t},${a+t} h${u+1-i}v1H${i+t}z`);return}s&&i===null&&(i=u)})}),r.join("")}function gB(e,t){return e.slice().map((r,n)=>n=t.y+t.h?r:r.map((a,i)=>i=t.x+t.w?a:!1))}function wfe(e,t,r,n){if(n==null)return null;const a=e.length+r*2,i=Math.floor(t*bfe),s=a/t,u=(n.width||i)*s,d=(n.height||i)*s,c=n.x==null?e.length/2-u/2:n.x*s,h=n.y==null?e.length/2-d/2:n.y*s,p=n.opacity==null?1:n.opacity;let m=null;if(n.excavate){let x=Math.floor(c),y=Math.floor(h),w=Math.ceil(u+c-x),j=Math.ceil(d+h-y);m={x,y,w,h:j}}const v=n.crossOrigin;return{x:c,y:h,h:d,w:u,excavation:m,opacity:p,crossOrigin:v}}function Sfe(e,t){return t!=null?Math.max(Math.floor(t),0):e?yfe:xfe}function vB({value:e,level:t,minVersion:r,includeMargin:n,marginSize:a,imageSettings:i,size:s,boostLevel:u}){let d=q.useMemo(()=>{const x=(Array.isArray(e)?e:[e]).reduce((y,w)=>(y.push(...Js.QrSegment.makeSegments(w)),y),[]);return Js.QrCode.encodeSegments(x,vfe[t],r,void 0,void 0,u)},[e,t,r,u]);const{cells:c,margin:h,numCells:p,calculatedImageSettings:m}=q.useMemo(()=>{let v=d.getModules();const x=Sfe(n,a),y=v.length+x*2,w=wfe(v,s,x,i);return{cells:v,margin:x,numCells:y,calculatedImageSettings:w}},[d,s,i,n,a]);return{qrcode:d,margin:h,cells:c,numCells:p,calculatedImageSettings:m}}var jfe=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Nfe=q.forwardRef(function(t,r){const n=t,{value:a,size:i=cB,level:s=uB,bgColor:u=dB,fgColor:d=fB,includeMargin:c=hB,minVersion:h=pB,boostLevel:p,marginSize:m,imageSettings:v}=n,y=FS(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:w}=y,j=FS(y,["style"]),_=v?.src,C=q.useRef(null),A=q.useRef(null),E=q.useCallback(G=>{C.current=G,typeof r=="function"?r(G):r&&(r.current=G)},[r]),[O,T]=q.useState(!1),{margin:k,cells:M,numCells:$,calculatedImageSettings:z}=vB({value:a,level:s,minVersion:h,boostLevel:p,includeMargin:c,marginSize:m,imageSettings:v,size:i});q.useEffect(()=>{if(C.current!=null){const G=C.current,U=G.getContext("2d");if(!U)return;let H=M;const W=A.current,B=z!=null&&W!==null&&W.complete&&W.naturalHeight!==0&&W.naturalWidth!==0;B&&z.excavation!=null&&(H=gB(M,z.excavation));const Q=window.devicePixelRatio||1;G.height=G.width=i*Q;const R=i/$*Q;U.scale(R,R),U.fillStyle=u,U.fillRect(0,0,$,$),U.fillStyle=d,jfe?U.fill(new Path2D(mB(H,k))):M.forEach(function(L,I){L.forEach(function(X,ee){X&&U.fillRect(ee+k,I+k,1,1)})}),z&&(U.globalAlpha=z.opacity),B&&U.drawImage(W,z.x+k,z.y+k,z.w,z.h)}}),q.useEffect(()=>{T(!1)},[_]);const F=BS({height:i,width:i},w);let V=null;return _!=null&&(V=q.createElement("img",{src:_,key:_,style:{display:"none"},onLoad:()=>{T(!0)},ref:A,crossOrigin:z?.crossOrigin})),q.createElement(q.Fragment,null,q.createElement("canvas",BS({style:F,height:i,width:i,ref:E,role:"img"},j)),V)});Nfe.displayName="QRCodeCanvas";var yB=q.forwardRef(function(t,r){const n=t,{value:a,size:i=cB,level:s=uB,bgColor:u=dB,fgColor:d=fB,includeMargin:c=hB,minVersion:h=pB,boostLevel:p,title:m,marginSize:v,imageSettings:x}=n,y=FS(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:w,cells:j,numCells:_,calculatedImageSettings:C}=vB({value:a,level:s,minVersion:h,boostLevel:p,includeMargin:c,marginSize:v,imageSettings:x,size:i});let A=j,E=null;x!=null&&C!=null&&(C.excavation!=null&&(A=gB(j,C.excavation)),E=q.createElement("image",{href:x.src,height:C.h,width:C.w,x:C.x+w,y:C.y+w,preserveAspectRatio:"none",opacity:C.opacity,crossOrigin:C.crossOrigin}));const O=mB(A,w);return q.createElement("svg",BS({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:r,role:"img"},y),!!m&&q.createElement("title",null,m),q.createElement("path",{fill:u,d:`M0,0 h${_}v${_}H0z`,shapeRendering:"crispEdges"}),q.createElement("path",{fill:d,d:O,shapeRendering:"crispEdges"}),E)});yB.displayName="QRCodeSVG";function _fe({data:e,width:t,height:r,showText:n,orientation:a="horizontal"}){const i=b.useRef(null),s=a==="vertical",u=Math.max(20,(s?t:r)-(n?14:4));b.useEffect(()=>{if(i.current&&e)try{mfe(i.current,e,{format:"CODE128",width:1,height:u,displayValue:n!==!1,margin:2,fontOptions:"",fontSize:10})}catch{}},[e,u,n]);const d=o.jsx("svg",{ref:i,className:"w-full h-full min-h-0",style:{maxHeight:s?t:r}});return s?o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("div",{style:{transform:"rotate(-90deg)",transformOrigin:"center center",width:r,height:t,display:"flex",alignItems:"center",justifyContent:"center"},children:d})}):d}const fu=8;function Us(e){return Math.round(e/fu)*fu}function mm(e,t){return t==="cm"?e*37.8:e*96}function sM(e,t){return t==="cm"?e/37.8:e/96}function lM(e,t,r){const n=String(e.prefix??"").trim(),a=String(e.multipleOptionName??e.MultipleOptionName??"").trim(),i=r.filter(Boolean).join(", "),s=t||"…";return n?i?`${n}${i}`:`${n}${s}`:a?`${a}: ${i||s}`:i||s}function xB({el:e,isAppPrintField:t}){const r=e.config,n=e.type,a={fontSize:r?.fontSize??14,fontFamily:r?.fontFamily??"Arial",fontWeight:r?.fontWeight??"normal",textAlign:r?.textAlign??"left",color:r?.color??"#000"},i=r?.inputType;if(n==="TEXT_STATIC"){const s=r?.text??"文本";if(t){if(i==="options"){const d=Array.isArray(r?.selectedOptionValues)?r.selectedOptionValues:[],c=lM(r,s,d);return o.jsx("div",{className:"w-full h-full px-1 flex flex-col justify-center overflow-hidden pointer-events-none text-gray-600 italic text-[11px] leading-tight break-all",style:a,title:"Filled in mobile app when printing",children:c})}const u=i==="number"?r?.text??"0":s;return o.jsx("div",{className:"w-full h-full px-1 flex items-center overflow-hidden pointer-events-none text-gray-600 italic text-[11px]",style:a,title:"Filled in mobile app when printing",children:u})}if(i==="number")return o.jsx("input",{type:"number",readOnly:!0,value:r?.text??"0",className:"w-full h-full min-w-0 border border-gray-300 bg-white rounded px-1 pointer-events-none",style:{...a,textAlign:"right"}});if(i==="options"){const u=Array.isArray(r?.selectedOptionValues)?r.selectedOptionValues:[],d=lM(r,s,u),c=u.length===0;return o.jsx("div",{className:Ee("w-full h-full px-1 overflow-hidden whitespace-pre-wrap break-all leading-tight",c&&"text-gray-400"),style:a,title:d,children:d})}return i==="text"?o.jsx("input",{type:"text",readOnly:!0,value:s,className:"w-full h-full min-w-0 border border-gray-300 bg-white rounded px-1 pointer-events-none",style:a}):o.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-pre-wrap break-all leading-tight",style:a,children:s})}if(n==="TEXT_PRODUCT"){const s=r?.text??"商品名";return o.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-pre-wrap break-all leading-tight",style:a,children:s})}if(n==="TEXT_PRICE"){const s=r?.prefix??"¥",u=r?.text??"0.00";return o.jsxs("div",{className:"w-full h-full px-1 overflow-hidden flex items-center",style:{...a,justifyContent:a.textAlign==="center"?"center":a.textAlign==="right"?"flex-end":"flex-start"},children:[o.jsx("span",{children:s}),o.jsx("span",{children:u})]})}if(n==="BARCODE"){const s=r?.data??"123456789",u=r?.showText!==!1,d=r?.orientation==="vertical"?"vertical":"horizontal";return o.jsx("div",{className:"flex flex-col items-center justify-center w-full h-full overflow-hidden p-0.5",children:o.jsx("div",{className:"flex-1 w-full min-h-0 flex items-center justify-center",children:o.jsx(_fe,{data:s,width:e.width,height:e.height,showText:u,orientation:d})})})}if(n==="QRCODE"){const s=r?.data??"https://example.com",u=Math.min(e.width,e.height)-4;return o.jsx("div",{className:"w-full h-full flex items-center justify-center p-0.5",children:o.jsx(yB,{value:s,size:Math.max(20,u),level:"M",includeMargin:!1})})}if(n==="IMAGE"){const s=r?.src;return s?o.jsx("img",{src:Ju(s),alt:"",className:"w-full h-full object-contain"}):o.jsx("div",{className:"w-full h-full flex flex-col items-center justify-center bg-gray-100 text-gray-500 text-[10px] border border-dashed border-gray-300",children:o.jsx("span",{className:"font-medium",children:"Logo"})})}if(n==="DATE"){const s=(typeof r?.format=="string"&&r.format.trim()?r.format:typeof r?.Format=="string"&&r.Format.trim()?r.Format:"YYYY-MM-DD")??"YYYY-MM-DD",u=s.replace("YYYY","2025").replace("MM","02").replace("DD","01"),d=String(r?.inputType??r?.InputType??"").toLowerCase();return d==="datetime"||d==="date"?t?o.jsx("div",{className:"w-full h-full px-1 flex items-center justify-center overflow-hidden pointer-events-none text-[10px] text-center whitespace-nowrap",style:a,title:`Format: ${s}`,children:s}):o.jsx("input",{type:"date",readOnly:!0,value:"2025-02-01",className:"w-full h-full min-w-0 border border-gray-300 bg-white rounded px-1 pointer-events-none text-[10px]",style:a}):o.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:a,children:u})}if(n==="TIME"){const u=((typeof r?.format=="string"&&r.format.trim()?r.format:typeof r?.Format=="string"&&r.Format.trim()?r.Format:"HH:mm")??"HH:mm").replace("HH","12").replace("mm","30");return o.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:a,children:u})}if(n==="DURATION")return o.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:a,children:"保质期 2025-02-04"});if(n==="WEIGHT"){const s=r?.value??r?.Value,u=s==null||s===""?500:typeof s=="number"?s:Number(s),d=Number.isFinite(u)?u:500,c=(typeof r?.unit=="string"&&r.unit.trim()?r.unit:typeof r?.Unit=="string"&&r.Unit.trim()?r.Unit:"g")??"g";return o.jsxs("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:a,children:[d,c]})}if(n==="WEIGHT_PRICE"){const s=r?.unitPrice??10,u=r?.weight??.5,d=r?.currency??"¥";return o.jsxs("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:a,children:[d,(s*u).toFixed(2)]})}if(n==="NUTRITION"){const s=r?.calories??120;return o.jsxs("div",{className:"text-[8px] p-0.5 w-full h-full overflow-hidden flex flex-col",children:[o.jsx("div",{className:"font-semibold border-b border-black",children:"Nutrition Facts"}),o.jsxs("div",{children:["Calories ",s]})]})}return n==="BLANK"?o.jsx("div",{className:"w-full h-full border border-dashed border-gray-200"}):o.jsx("div",{className:"text-gray-500 text-[10px] px-1 truncate w-full flex items-center justify-center",children:e.type.replace(/_/g," ")})}function Cfe({template:e,selectedId:t,onSelect:r,onUpdateElement:n,onDeleteElement:a,onTemplateChange:i,scale:s=1,onZoomIn:u,onZoomOut:d,onPreview:c}){const h=b.useRef(null),p=b.useRef(null),m=b.useRef(null),v=b.useRef(null),x=b.useRef(null),y=b.useRef(null),w=b.useRef(null),[j,_]=q.useState(!1),[C,A]=q.useState(!1),E=b.useRef(null),[O,T]=q.useState({x:0,y:0}),k=b.useRef(null),M=mm(e.width,e.unit),$=mm(e.height,e.unit),z=e.showGrid!==!1,F=b.useCallback((R,L)=>{if(j||R.button===1)return;R.stopPropagation(),r(L),p.current?.focus();const I=e.elements.find(ee=>ee.id===L);if(!I)return;const X=document.getElementById(`element-${L}`);X&&(X.classList.add("z-50","opacity-90","shadow-xl","ring-2","ring-blue-400","ring-offset-2"),X.style.cursor="grabbing"),m.current={id:L,startX:R.clientX,startY:R.clientY,elX:I.x,elY:I.y},y.current={id:L,x:I.x,y:I.y},R.currentTarget.setPointerCapture?.(R.pointerId)},[e.elements,r,j]),V=b.useCallback(R=>{w.current!==null&&cancelAnimationFrame(w.current),w.current=requestAnimationFrame(()=>{R(),w.current=null})},[]),G=b.useCallback(R=>{if(C&&k.current){const L=R.clientX-k.current.startX,I=R.clientY-k.current.startY;T({x:k.current.x+L,y:k.current.y+I});return}if(C&&E.current&&h.current){const L=R.clientX-E.current.x,I=R.clientY-E.current.y;h.current.scrollLeft=E.current.scrollLeft-L,h.current.scrollTop=E.current.scrollTop-I;return}if(m.current){const{id:L,startX:I,startY:X,elX:ee,elY:ie}=m.current,re=R.clientX,K=R.clientY;V(()=>{const Z=(re-I)/s,ne=(K-X)/s,de=Math.max(0,ee+Z),ge=Math.max(0,ie+ne),Y=Us(de),we=Us(ge),Ce=document.getElementById(`element-${L}`);Ce&&(Ce.style.left=`${Y}px`,Ce.style.top=`${we}px`),y.current={id:L,x:Y,y:we}})}if(v.current){const{id:L,corner:I,startX:X,startY:ee,w:ie,h:re,elX:K,elY:Z}=v.current,ne=R.clientX,de=R.clientY;V(()=>{const ge=(ne-X)/s,Y=(de-ee)/s;let we=ie,Ce=re,Be=K,et=Z;I.includes("e")&&(we=Math.max(20,ie+ge)),I.includes("w")&&(we=Math.max(20,ie-ge),Be=K+ge),I.includes("s")&&(Ce=Math.max(12,re+Y)),I.includes("n")&&(Ce=Math.max(12,re-Y),et=Z+Y);const tt=Us(we),St=Us(Ce),jt=Us(Be),Kt=Us(et),_t=document.getElementById(`element-${L}`);_t&&(_t.style.width=`${tt}px`,_t.style.height=`${St}px`,_t.style.left=`${jt}px`,_t.style.top=`${Kt}px`),y.current={id:L,width:tt,height:St,x:jt,y:Kt}})}if(x.current&&i){const{edge:L,startX:I,startY:X,startW:ee,startH:ie}=x.current,re=R.clientX,K=R.clientY;V(()=>{const Z=(re-I)/s,ne=(K-X)/s,de=sM(Z,e.unit),ge=sM(ne,e.unit);if(L==="bottom"){const Y=Math.max(1,ie+ge);i({height:Y})}else{const Y=Math.max(1,ee+de);i({width:Y})}})}},[C,i,s,e.unit,V]),U=b.useCallback(()=>{C&&(A(!1),E.current=null,k.current=null),w.current!==null&&(cancelAnimationFrame(w.current),w.current=null);const R=m.current?.id||v.current?.id;if(R){const L=document.getElementById(`element-${R}`);L&&(L.classList.remove("z-50","opacity-90","shadow-xl","ring-2","ring-blue-400","ring-offset-2"),L.style.cursor="")}if(y.current){const{id:L,...I}=y.current;n(L,I),y.current=null}m.current=null,v.current=null,x.current=null},[n]);b.useEffect(()=>{const R=I=>{I.code==="Space"&&!I.repeat&&_(!0)},L=I=>{I.code==="Space"&&(_(!1),A(!1),E.current=null,k.current=null)};return window.addEventListener("keydown",R),window.addEventListener("keyup",L),()=>{window.removeEventListener("keydown",R),window.removeEventListener("keyup",L)}},[]),b.useEffect(()=>{const R=h.current;if(!R)return;const L=()=>{R.scrollLeft=Math.max(0,(R.scrollWidth-R.clientWidth)/2),R.scrollTop=Math.max(0,(R.scrollHeight-R.clientHeight)/2)},I=requestAnimationFrame(L),X=setTimeout(L,100);return()=>{cancelAnimationFrame(I),clearTimeout(X)}},[s,M,$]);const H=b.useCallback(R=>{if(!t)return;if(R.key==="Delete"||R.key==="Backspace"){R.preventDefault();const ie=e.elements.findIndex(re=>re.id===t);if(ie>=0){const re=e.elements.filter(K=>K.id!==t);a(t),r(re[ie]?.id??re[ie-1]?.id??null)}return}const L=e.elements.find(ie=>ie.id===t);if(!L)return;const I=R.shiftKey?1:fu;let X=0,ee=0;switch(R.key){case"ArrowLeft":X=-I;break;case"ArrowRight":X=I;break;case"ArrowUp":ee=-I;break;case"ArrowDown":ee=-I;break;default:return}R.key==="ArrowDown"&&(ee=I),R.preventDefault(),n(L.id,{x:Math.max(0,L.x+X),y:Math.max(0,L.y+ee)})},[t,e.elements,n,a,r]),W=R=>{(j||R.button===1)&&(R.preventDefault(),A(!0),E.current={x:R.clientX,y:R.clientY,scrollLeft:h.current?.scrollLeft||0,scrollTop:h.current?.scrollTop||0},R.currentTarget.setPointerCapture(R.pointerId))},B=R=>{if(C&&E.current&&h.current){const L=R.clientX-E.current.x,I=R.clientY-E.current.y;h.current.scrollLeft=E.current.scrollLeft-L,h.current.scrollTop=E.current.scrollTop-I}},Q=R=>{C&&(A(!1),E.current=null)};return o.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden bg-gray-100",children:[o.jsxs("div",{className:"shrink-0 px-4 py-2 border-b border-gray-200 bg-white flex items-center justify-between gap-2 flex-wrap z-10",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Label Preview"}),o.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c&&o.jsx("button",{type:"button",onClick:c,className:"h-8 px-3 rounded border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 text-xs font-medium shadow-sm transition-all active:scale-95",children:"预览"}),i&&o.jsxs(o.Fragment,{children:[o.jsxs(Ve,{value:(()=>{const R=V1.findIndex(L=>L.width===e.width&&L.height===e.height&&L.unit===e.unit);return R>=0?String(R):"custom"})(),onValueChange:R=>{if(R==="custom")return;const L=V1[Number(R)];L&&i({width:L.width,height:L.height,unit:L.unit})},children:[o.jsx(We,{className:"h-8 w-[130px] text-xs",children:o.jsx(He,{placeholder:"画布大小"})}),o.jsxs(Ge,{children:[V1.map((R,L)=>o.jsx(Ne,{value:String(L),className:"text-xs",children:R.name},L)),o.jsx(Ne,{value:"custom",className:"text-xs text-gray-500",children:"自定义"})]})]}),o.jsx("button",{type:"button",onClick:()=>i({showGrid:!z}),className:Ee("h-8 px-3 rounded border text-xs font-medium shadow-sm transition-colors",z?"border-gray-300 bg-white text-gray-700 hover:bg-gray-50":"border-gray-300 bg-gray-100 text-gray-500"),children:z?"隐藏网格":"显示网格"})]}),o.jsxs("div",{className:"flex items-center gap-1 bg-white rounded border border-gray-300 p-0.5 shadow-sm h-8",children:[o.jsx("button",{type:"button",onClick:d,disabled:!d,className:"h-6 w-6 rounded hover:bg-gray-100 text-gray-600 disabled:opacity-50 disabled:pointer-events-none flex items-center justify-center text-sm font-medium active:scale-90 transition-transform",title:"缩小",children:"−"}),o.jsxs("span",{className:"min-w-[3rem] text-center text-xs text-gray-600 font-medium",children:[Math.round(s*100),"%"]}),o.jsx("button",{type:"button",onClick:u,disabled:!u,className:"h-6 w-6 rounded hover:bg-gray-100 text-gray-600 disabled:opacity-50 disabled:pointer-events-none flex items-center justify-center text-sm font-medium active:scale-90 transition-transform",title:"放大",children:"+"})]})]})]}),o.jsx("div",{ref:h,className:Ee("flex-1 overflow-auto bg-gray-100 relative",j?"cursor-grab active:cursor-grabbing":""),onPointerDown:W,onPointerMove:B,onPointerUp:Q,onPointerLeave:Q,children:o.jsx("div",{style:{minWidth:"100%",minHeight:"100%",width:"fit-content",height:"fit-content",display:"flex",padding:50,boxSizing:"border-box",transform:`translate(${O.x}px, ${O.y}px)`},children:o.jsxs("div",{ref:p,tabIndex:0,className:Ee("relative bg-white shadow-lg border border-dashed border-gray-300 origin-top-left outline-none m-auto",C?"cursor-grabbing":"cursor-grab"),style:{width:M,height:$,transform:`scale(${s})`,backgroundImage:z?`linear-gradient(to right, rgba(0,0,0,0.06) 1px, transparent 1px), - linear-gradient(to bottom, rgba(0,0,0,0.06) 1px, transparent 1px)`:void 0,backgroundSize:z?`${fu}px ${fu}px`:void 0,pointerEvents:j?"none":"auto"},onClick:R=>{const L=R.target,I=L.closest('[id^="element-"]'),X=L.closest('[title*="拖拽拉高"]')||L.closest('[title*="拖拽拉宽"]');!I&&!X&&r(null)},onPointerDown:R=>{const L=R.target,I=L.closest('[id^="element-"]'),X=L.closest('[title*="拖拽拉高"]')||L.closest('[title*="拖拽拉宽"]');p.current?.contains(L)&&!I&&!X&&!m.current&&!v.current&&(j||R.button===1)&&(R.preventDefault(),R.stopPropagation(),A(!0),k.current={x:O.x,y:O.y,startX:R.clientX,startY:R.clientY},E.current={x:R.clientX,y:R.clientY,scrollLeft:h.current?.scrollLeft??0,scrollTop:h.current?.scrollTop??0},R.currentTarget.setPointerCapture?.(R.pointerId))},onPointerMove:G,onPointerUp:U,onKeyDown:H,children:[e.showRuler&&o.jsxs("div",{className:"absolute top-0 left-0 right-0 h-5 border-b border-gray-300 bg-gray-50 text-[10px] text-gray-500 flex items-center px-1 pointer-events-none select-none",children:[e.unit," ",e.width," × ",e.height]}),i&&o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-3 cursor-ns-resize flex items-center justify-center bg-gray-200/80 hover:bg-blue-400/30 border-t border-gray-300 text-[10px] text-gray-500 transition-colors",title:"拖拽拉高纸张",onPointerDown:R=>{R.stopPropagation(),x.current={edge:"bottom",startX:R.clientX,startY:R.clientY,startW:e.width,startH:e.height},R.target.setPointerCapture?.(R.pointerId)},children:"⋮"}),i&&o.jsx("div",{className:"absolute top-0 right-0 bottom-0 w-3 cursor-ew-resize flex items-center justify-center bg-gray-200/80 hover:bg-blue-400/30 border-l border-gray-300 text-[10px] text-gray-500 transition-colors",title:"拖拽拉宽纸张",onPointerDown:R=>{R.stopPropagation(),x.current={edge:"right",startX:R.clientX,startY:R.clientY,startW:e.width,startH:e.height},R.target.setPointerCapture?.(R.pointerId)},children:"⋮"}),e.elements.map(R=>{const L=Ll(R);return o.jsxs("div",{id:`element-${R.id}`,className:Ee("absolute box-border cursor-move overflow-hidden transition-shadow",R.border==="line"&&"border border-gray-400",R.border==="dotted"&&"border border-dotted border-gray-400",t===R.id&&"ring-2 ring-blue-500 ring-offset-1 z-10"),style:{left:R.x,top:R.y,width:R.width,height:R.height},onClick:I=>{I.stopPropagation(),r(R.id)},onPointerDown:I=>F(I,R.id),children:[o.jsx("div",{className:Ee("w-full h-full min-h-0 relative",L&&"rounded-sm border-2 border-dashed border-amber-500/85 bg-amber-50/35"),children:o.jsx(xB,{el:R,isAppPrintField:L})}),t===R.id&&o.jsxs(o.Fragment,{children:[["nw","ne","sw","se"].map(I=>o.jsx("div",{className:"absolute w-4 h-4 bg-white border-2 border-blue-500 rounded-full z-20 shadow-md hover:scale-110 transition-transform",style:{cursor:"nwse-resize",top:I.startsWith("n")?-6:void 0,bottom:I.startsWith("s")?-6:void 0,left:I.endsWith("w")?-6:void 0,right:I.endsWith("e")?-6:void 0},onPointerDown:X=>{X.stopPropagation();const ee=e.elements.find(ie=>ie.id===R.id);v.current={id:R.id,corner:I,startX:X.clientX,startY:X.clientY,w:ee.width,h:ee.height,elX:ee.x,elY:ee.y},X.currentTarget.setPointerCapture?.(X.pointerId)}},I)),["n","s","w","e"].map(I=>o.jsx("div",{className:"absolute bg-blue-500/50 border border-white/50 rounded-sm z-10 shadow-sm hover:bg-blue-600",style:{cursor:I==="n"||I==="s"?"ns-resize":"ew-resize",width:I==="n"||I==="s"?"20px":"6px",height:I==="n"||I==="s"?"6px":"20px",top:I==="n"?-3:I==="s"?void 0:"50%",bottom:I==="s"?-3:void 0,left:I==="w"?-3:I==="e"?void 0:"50%",right:I==="e"?-3:void 0,transform:I==="n"||I==="s"?"translateX(-50%)":"translateY(-50%)"},onPointerDown:X=>{X.stopPropagation();const ee=e.elements.find(re=>re.id===R.id),ie=document.getElementById(`element-${R.id}`);ie&&ie.classList.add("z-50","opacity-90"),v.current={id:R.id,corner:I,startX:X.clientX,startY:X.clientY,w:ee.width,h:ee.height,elX:ee.x,elY:ee.y},X.currentTarget.setPointerCapture?.(X.pointerId)}},I))]})]},R.id)})]})})})]})}function Efe({template:e,maxWidth:t=480}){const r=mm(e.width,e.unit),n=mm(e.height,e.unit),a=t?Math.min(t/r,t/n,2):1,i=r*a,s=n*a;return o.jsx("div",{className:"flex items-center justify-center p-4 bg-gray-100 rounded",children:o.jsx("div",{style:{width:i,height:s},className:"relative bg-white shadow-lg overflow-hidden",children:o.jsx("div",{className:"origin-top-left",style:{position:"absolute",left:0,top:0,width:r,height:n,transform:`scale(${a})`,transformOrigin:"0 0"},children:e.elements.map(u=>{const d=Ll(u);return o.jsx("div",{className:"absolute box-border overflow-hidden pointer-events-none flex items-center justify-center text-xs",style:{left:u.x,top:u.y,width:u.width,height:u.height,border:u.border==="line"?"1px solid #999":u.border==="dotted"?"1px dotted #999":void 0},children:o.jsx("div",{className:Ee("w-full h-full min-h-0 relative",d&&"rounded-sm border-2 border-dashed border-amber-500/85 bg-amber-50/35"),children:o.jsx(xB,{el:u,isAppPrintField:d})})},u.id)})})})})}const Pg=nn({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Ag="/label-multiple-option";function Ofe(e){if(e==null)return[];if(Array.isArray(e))return e.map(t=>String(t));if(typeof e=="string"){const t=e.trim();if(!t)return[];try{const r=JSON.parse(t);return Array.isArray(r)?r.map(n=>String(n)):[]}catch{return[]}}return[]}function ON(e){return{...e,optionValuesJson:Ofe(e.optionValuesJson)}}function Pfe(e){return{totalCount:e.totalCount??0,items:(e.items??[]).map(ON)}}function bB(e){return JSON.stringify(e)}async function wB(e,t){const r=await Pg.requestJson({path:Ag,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,State:e.state},signal:t});return Pfe(r)}async function Afe(e){const t=await Pg.requestJson({path:Ag,method:"POST",body:{optionCode:e.optionCode,optionName:e.optionName,optionValuesJson:bB(e.optionValuesJson),state:e.state??!0,orderNum:e.orderNum}});return ON(t)}async function Tfe(e,t){const r=await Pg.requestJson({path:`${Ag}/${encodeURIComponent(e)}`,method:"PUT",body:{optionCode:t.optionCode,optionName:t.optionName,optionValuesJson:bB(t.optionValuesJson),state:t.state??!0,orderNum:t.orderNum}});return ON(r)}async function kfe(e){await Pg.requestJson({path:`${Ag}/${encodeURIComponent(e)}`,method:"DELETE"})}function Rfe({template:e,selectedElement:t,onTemplateChange:r,onElementChange:n,onDeleteElement:a,locations:i=[],readOnlyTemplateCode:s=!1}){return t?o.jsxs("div",{className:"w-72 shrink-0 border-l border-gray-200 bg-white flex flex-col h-full",children:[o.jsx("div",{className:"px-3 py-2 border-b border-gray-200 font-semibold text-gray-800",children:"Properties (Element)"}),o.jsx(ll,{className:"flex-1",children:o.jsxs("div",{className:"p-3 space-y-3",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"X"}),o.jsx(ve,{type:"number",value:t.x,onChange:u=>n(t.id,{x:Number(u.target.value)||0}),className:"h-8 text-sm"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Y"}),o.jsx(ve,{type:"number",value:t.y,onChange:u=>n(t.id,{y:Number(u.target.value)||0}),className:"h-8 text-sm"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Width"}),o.jsx(ve,{type:"number",value:t.width,onChange:u=>n(t.id,{width:Math.max(1,Number(u.target.value)||0)}),className:"h-8 text-sm"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Height"}),o.jsx(ve,{type:"number",value:t.height,onChange:u=>n(t.id,{height:Math.max(1,Number(u.target.value)||0)}),className:"h-8 text-sm"})]})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Rotation"}),o.jsxs(Ve,{value:t.rotation,onValueChange:u=>n(t.id,{rotation:u}),children:[o.jsx(We,{className:"h-8 text-sm",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"horizontal",children:"horizontal"}),o.jsx(Ne,{value:"vertical",children:"vertical"})]})]})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Border"}),o.jsxs(Ve,{value:t.border,onValueChange:u=>n(t.id,{border:u}),children:[o.jsx(We,{className:"h-8 text-sm",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"none",children:"none"}),o.jsx(Ne,{value:"line",children:"line"}),o.jsx(Ne,{value:"dotted",children:"dotted"})]})]})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Element name"}),o.jsx(ve,{value:(t.elementName??"").trim(),onChange:u=>n(t.id,{elementName:u.target.value}),className:"h-8 text-sm mt-1",placeholder:"e.g. text1"}),o.jsx("p",{className:"text-[10px] text-gray-400 mt-1",children:"Required for save; used as data-entry column header (elementName)."})]}),o.jsx(Mfe,{element:t,onChange:u=>n(t.id,{config:{...t.config,...u}})}),a&&o.jsx("div",{className:"pt-4 border-t border-gray-100",children:o.jsxs(he,{variant:"destructive",className:"w-full gap-2",onClick:()=>a(t.id),children:[o.jsx(Ot,{className:"h-4 w-4 shrink-0"}),"Delete Element"]})})]})})]}):o.jsxs("div",{className:"w-72 shrink-0 border-l border-gray-200 bg-white flex flex-col h-full",children:[o.jsx("div",{className:"px-3 py-2 border-b border-gray-200 font-semibold text-gray-800",children:"Properties (Template)"}),o.jsx(ll,{className:"flex-1",children:o.jsxs("div",{className:"p-3 space-y-3",children:[o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Template Code"}),o.jsx(ve,{value:e.id,disabled:s,onChange:u=>r({id:u.target.value.trim()}),className:"h-8 text-sm mt-1",placeholder:"e.g. TPL_TEST_001"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Template Name"}),o.jsx(ve,{value:e.name,onChange:u=>r({name:u.target.value}),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Label Type"}),o.jsxs(Ve,{value:e.labelType,onValueChange:u=>r({labelType:u}),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"PRICE",children:"PRICE"}),o.jsx(Ne,{value:"NUTRITION",children:"NUTRITION"}),o.jsx(Ne,{value:"SHIPPING",children:"SHIPPING"})]})]})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Applied Location"}),o.jsxs(Ve,{value:e.appliedLocation,onValueChange:u=>{r(u==="ALL"?{appliedLocation:u,appliedLocationIds:[]}:{appliedLocation:u})},children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"ALL",children:"All locations"}),o.jsx(Ne,{value:"SPECIFIED",children:"Specified locations"})]})]})]}),e.appliedLocation==="SPECIFIED"&&o.jsxs("div",{className:"rounded-md border border-gray-200 p-2 max-h-40 overflow-y-auto space-y-2",children:[o.jsx(ue,{className:"text-xs text-gray-600",children:"Select locations"}),i.length===0?o.jsx("p",{className:"text-xs text-gray-500",children:"No locations loaded."}):i.map(u=>{const d=(e.appliedLocationIds??[]).includes(u.id);return o.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[o.jsx(Dl,{checked:d,onCheckedChange:c=>{const h=c===!0,p=new Set(e.appliedLocationIds??[]);h?p.add(u.id):p.delete(u.id),r({appliedLocationIds:Array.from(p)})}}),o.jsx("span",{className:"truncate",children:(u.locationName??u.locationCode??u.id).trim()||u.id})]},u.id)})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Width"}),o.jsx(ve,{type:"number",value:e.width,onChange:u=>r({width:Math.max(.1,Number(u.target.value)||0)}),className:"h-8 text-sm"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Height"}),o.jsx(ve,{type:"number",value:e.height,onChange:u=>r({height:Math.max(.1,Number(u.target.value)||0)}),className:"h-8 text-sm"})]})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Unit"}),o.jsxs(Ve,{value:e.unit,onValueChange:u=>r({unit:u}),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"cm",children:"cm"}),o.jsx(Ne,{value:"inch",children:"inch"})]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Gt,{checked:e.showRuler,onCheckedChange:u=>r({showRuler:u})}),o.jsx(ue,{className:"text-xs",children:"Show Ruler"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Gt,{checked:e.showGrid??!0,onCheckedChange:u=>r({showGrid:u})}),o.jsx(ue,{className:"text-xs",children:"Show Grid"})]})]})})]})}const W1="__none__";function Ife({cfg:e,onPatch:t}){const[r,n]=b.useState([]),[a,i]=b.useState(!1);b.useEffect(()=>{let p=!1;return i(!0),wB({skipCount:1,maxResultCount:500}).then(m=>{p||n(m.items??[])}).catch(()=>{p||n([])}).finally(()=>{p||i(!1)}),()=>{p=!0}},[]);const s=(e.multipleOptionId??"").trim(),u=Array.isArray(e.selectedOptionValues)?e.selectedOptionValues:[],d=r.find(p=>p.id===s),c=d?.optionValuesJson??[];b.useEffect(()=>{if(!s||r.length===0)return;const p=r.find(x=>x.id===s),m=String(p?.optionName??"").trim();if(!p||!m)return;const v=String(e.multipleOptionName??"").trim();m!==v&&t({multipleOptionName:m})},[s,r,e.multipleOptionName,t]);const h=s||W1;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Option dictionary"}),o.jsxs(Ve,{value:h,onValueChange:p=>{if(p===W1){t({multipleOptionId:"",multipleOptionName:"",selectedOptionValues:[]});return}const m=r.find(w=>w.id===p),v=new Set(m?.optionValuesJson??[]),x=u.filter(w=>v.has(w)),y=String(m?.optionName??m?.optionCode??"").trim();t({multipleOptionId:p,multipleOptionName:y,selectedOptionValues:x})},disabled:a,children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{placeholder:a?"Loading…":"Select from Multiple Options"})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:W1,children:"— None —"}),r.map(p=>o.jsx(Ne,{value:p.id,children:p.optionName??p.optionCode??p.id},p.id))]})]}),o.jsx("p",{className:"text-[10px] text-gray-400 mt-1",children:"Data comes from the Multiple Options tab (label-multiple-option list)."})]}),d&&c.length>0?o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Values (multi-select)"}),o.jsx("div",{className:"mt-1 max-h-44 overflow-y-auto border border-gray-200 rounded-md p-2 space-y-2 bg-gray-50/50",children:c.map(p=>o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx(Dl,{className:"shrink-0",checked:u.includes(p),onCheckedChange:m=>{const v=new Set(u);m?v.add(p):v.delete(p),t({selectedOptionValues:Array.from(v)})}}),o.jsx("span",{className:"text-xs truncate",title:p,children:p})]},p))})]}):s?o.jsx("p",{className:"text-[10px] text-amber-600",children:"No values in this dictionary or still loading."}):null]})}function G1({cfg:e,update:t,textAlignDefault:r}){return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Text"}),o.jsx(ve,{value:e.text??"0.00",onChange:n=>t("text",n.target.value),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Prefix"}),o.jsx(ve,{value:e.prefix??"¥",onChange:n=>t("prefix",n.target.value),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Font Size"}),o.jsx(ve,{type:"number",value:e.fontSize??14,onChange:n=>t("fontSize",Number(n.target.value)||14),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Text Align"}),o.jsxs(Ve,{value:e.textAlign??r,onValueChange:n=>t("textAlign",n),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"left",children:"Left"}),o.jsx(Ne,{value:"center",children:"Center"}),o.jsx(Ne,{value:"right",children:"Right"})]})]})]})]})}function Hh(e,t,r){for(const n of t){const a=e[n];if(a!=null&&String(a).trim()!=="")return String(a).trim()}return r}function K1(e,t,r){for(const n of t){const a=e[n];if(a==null||a==="")continue;const i=typeof a=="number"?a:Number(a);if(Number.isFinite(i))return i}return r}function Mfe({element:e,onChange:t}){const r=e.config,n=(a,i)=>t({[a]:i});switch(e.type){case"TEXT_STATIC":return r.inputType==="options"?o.jsxs(o.Fragment,{children:[o.jsx(Ife,{cfg:r,onPatch:t}),o.jsx(G1,{cfg:r,update:n,textAlignDefault:"left"})]}):o.jsx(G1,{cfg:r,update:n,textAlignDefault:"right"});case"TEXT_PRODUCT":case"TEXT_PRICE":return o.jsx(G1,{cfg:r,update:n,textAlignDefault:"right"});case"BARCODE":return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Data"}),o.jsx(ve,{value:r.data??"123456789",onChange:a=>n("data",a.target.value),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"方向"}),o.jsxs(Ve,{value:r.orientation??"horizontal",onValueChange:a=>n("orientation",a),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"horizontal",children:"水平"}),o.jsx(Ne,{value:"vertical",children:"竖排"})]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Gt,{checked:r.showText!==!1,onCheckedChange:a=>n("showText",a)}),o.jsx(ue,{className:"text-xs",children:"Show Text"})]})]});case"QRCODE":return o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Data (URL)"}),o.jsx(ve,{value:r.data??"https://example.com",onChange:a=>n("data",a.target.value),className:"h-8 text-sm mt-1"})]});case"IMAGE":return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Image URL / path"}),o.jsx(ve,{value:r.src??"",onChange:a=>n("src",a.target.value),className:"h-8 text-sm mt-1",placeholder:"https://... or /picture/..."})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Scale Mode"}),o.jsxs(Ve,{value:r.scaleMode??"contain",onValueChange:a=>n("scaleMode",a),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"contain",children:"Contain"}),o.jsx(Ne,{value:"cover",children:"Cover"}),o.jsx(Ne,{value:"fill",children:"Fill"})]})]})]})]});case"DATE":{const a=String(r.inputType??r.InputType??"").toLowerCase(),i=a==="datetime"||a==="date";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Format"}),o.jsx(ve,{value:Hh(r,["format","Format"],"YYYY-MM-DD"),onChange:s=>n("format",s.target.value),className:"h-8 text-sm mt-1",placeholder:"YYYY-MM-DD"}),i?o.jsx("p",{className:"text-[10px] text-gray-400 mt-1",children:"Shown as placeholder on the label until the app fills the date at print time."}):null]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Offset Days"}),o.jsx(ve,{type:"number",value:K1(r,["offsetDays","OffsetDays"],0),onChange:s=>n("offsetDays",Number(s.target.value)||0),className:"h-8 text-sm mt-1"})]})]})}case"TIME":return o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Format"}),o.jsx(ve,{value:Hh(r,["format","Format"],"HH:mm"),onChange:a=>n("format",a.target.value),className:"h-8 text-sm mt-1",placeholder:"HH:mm"})]});case"DURATION":return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Format"}),o.jsx(ve,{value:Hh(r,["format","Format"],"YYYY-MM-DD"),onChange:a=>n("format",a.target.value),className:"h-8 text-sm mt-1",placeholder:"YYYY-MM-DD"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Offset Days"}),o.jsx(ve,{type:"number",value:K1(r,["offsetDays","OffsetDays"],3),onChange:a=>n("offsetDays",Number(a.target.value)||3),className:"h-8 text-sm mt-1"})]})]});case"WEIGHT":return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Value"}),o.jsx(ve,{type:"number",value:K1(r,["value","Value"],500),onChange:a=>n("value",Number(a.target.value)||0),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Unit"}),o.jsxs(Ve,{value:Hh(r,["unit","Unit"],"g"),onValueChange:a=>n("unit",a),children:[o.jsx(We,{className:"h-8 text-sm mt-1",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"g",children:"g"}),o.jsx(Ne,{value:"kg",children:"kg"}),o.jsx(Ne,{value:"oz",children:"oz"}),o.jsx(Ne,{value:"lb",children:"lb"})]})]})]})]});case"WEIGHT_PRICE":return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Unit Price"}),o.jsx(ve,{type:"number",value:r.unitPrice??10,onChange:a=>n("unitPrice",Number(a.target.value)||0),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Weight"}),o.jsx(ve,{type:"number",step:"0.1",value:r.weight??.5,onChange:a=>n("weight",Number(a.target.value)||0),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Currency"}),o.jsx(ve,{value:r.currency??"¥",onChange:a=>n("currency",a.target.value),className:"h-8 text-sm mt-1"})]})]});case"NUTRITION":return o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Calories"}),o.jsx(ve,{type:"number",value:r.calories??120,onChange:a=>n("calories",Number(a.target.value)||0),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Fat"}),o.jsx(ve,{value:r.fat??"5g",onChange:a=>n("fat",a.target.value),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Protein"}),o.jsx(ve,{value:r.protein??"3g",onChange:a=>n("protein",a.target.value),className:"h-8 text-sm mt-1"})]}),o.jsxs("div",{children:[o.jsx(ue,{className:"text-xs",children:"Carbs"}),o.jsx(ve,{value:r.carbs??"10g",onChange:a=>n("carbs",a.target.value),className:"h-8 text-sm mt-1"})]})]});case"BLANK":return o.jsx("div",{className:"text-xs text-gray-500",children:"Blank spacer; no configuration needed."});default:return o.jsxs("div",{className:"text-xs text-gray-500",children:["Config for ",e.type," (edit in code if needed)"]})}}const Dfe=.5,Lfe=2,cM=.25,$fe=1;function Bfe({templateId:e,initialTemplate:t,onClose:r,onSaved:n}){const[a,i]=b.useState(()=>t?{...t}:bde(e??void 0)),[s,u]=b.useState(null),[d,c]=b.useState($fe),[h,p]=b.useState(!1),[m,v]=b.useState([]);b.useEffect(()=>{let E=!1;return(async()=>{try{const O=await rc({skipCount:1,maxResultCount:500});E||v(O.items??[])}catch{E||v([])}})(),()=>{E=!0}},[]);const x=a.elements.find(E=>E.id===s)??null,y=b.useCallback((E,O,T,k)=>{let M="";i($=>{const z=(I,X)=>X==="cm"?I*37.8:I*96,F=z($.width,$.unit),V=z($.height,$.unit);let G=wde(E,0,0);const U=8,H=I=>Math.round(I/U)*U;let W=(F-G.width)/2,B=(V-G.height)/2;const Q=(I,X,ee,ie)=>$.elements.some(re=>{const K=re.x+re.width,Z=re.y+re.height,ne=I+ee,de=X+ie;return!(I>=K||ne<=re.x||X>=Z||de<=re.y)});if(Q(W,B,G.width,G.height)){const I=U*2;let X=!1;for(let ee=B;ee=0&&!X;ee-=I)for(let ie=W;ie>=0&&!X;ie-=I)Q(ie,ee,G.width,G.height)||(W=ie,B=ee,X=!0)}G={...G,x:Math.max(0,H(W)),y:Math.max(0,H(B))},O&&Object.keys(O).length>0&&(G.config={...G.config,...O});const R=hde(k,$.elements),L=K5(T);return G={...G,libraryCategory:X5(T,k),valueSourceType:L,elementName:R},M=G.id,{...$,elements:[...$.elements,G]}}),u(M)},[a.width,a.height,a.unit]),w=b.useCallback((E,O)=>{i(T=>({...T,elements:T.elements.map(k=>k.id===E?{...k,...O}:k)}))},[]),j=b.useCallback(E=>{i(O=>({...O,elements:O.elements.filter(T=>T.id!==E)})),u(null)},[]),_=b.useCallback(E=>{i(O=>({...O,...E}))},[]),C=b.useCallback(async()=>{try{const E=(a.id??"").trim();if(!E){pe.error("Template code is required.",{description:"Please enter a template code (e.g. TPL_TEST_001)."});return}if(a.appliedLocation==="SPECIFIED"&&!(a.appliedLocationIds?.length??0)){pe.error("Locations required.",{description:"When using specified locations, select at least one location."});return}if(a.elements.find(M=>!(M.elementName??"").trim())){pe.error("Component name required.",{description:"Each element must have a non-empty elementName (组件名字不能为空)."});return}if(a.elements.find(M=>{if(M.type!=="TEXT_STATIC")return!1;const $=M.config;return String($?.inputType??"").toLowerCase()!=="options"?!1:!String($?.multipleOptionId??$?.MultipleOptionId??"").trim()})){pe.error("Option dictionary required.",{description:"Each Multiple Options element must have an Option dictionary selected in the properties panel."});return}const k={id:E,name:a.name,labelType:a.labelType,unit:a.unit,width:a.width,height:a.height,appliedLocation:a.appliedLocation,showRuler:a.showRuler,showGrid:a.showGrid??!0,state:!0,elements:Y5(a.elements),appliedLocationIds:a.appliedLocation==="ALL"?[]:a.appliedLocationIds??[]};e?(await z5(E,k),pe.success("Template updated.",{description:"The template has been updated successfully."})):(await Due(k),pe.success("Template created.",{description:"The template has been created successfully."})),n(),r()}catch(E){pe.error("Failed to save template.",{description:E?.message?String(E.message):"Please try again."})}},[a,e,n,r]),A=b.useCallback(()=>{const E={...a,elements:a.elements.map(M=>({...M,elementName:(M.elementName??"").trim(),valueSourceType:Q5(M),libraryCategory:Ede(M)}))},O=new Blob([JSON.stringify(E,null,2)],{type:"application/json"}),T=URL.createObjectURL(O),k=document.createElement("a");k.href=T,k.download=`label-template-${a.id}.json`,k.click(),URL.revokeObjectURL(T)},[a]);return o.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200 bg-white shrink-0",children:[o.jsxs(he,{variant:"outline",size:"sm",onClick:r,children:[o.jsx(vM,{className:"w-4 h-4 mr-1"}),"Back"]}),o.jsx("span",{className:"text-sm font-medium text-gray-700 truncate flex-1",children:a.name}),o.jsxs(he,{size:"sm",onClick:A,variant:"outline",children:[o.jsx(HS,{className:"w-4 h-4 mr-1"}),"Export JSON"]}),o.jsxs(he,{size:"sm",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:C,children:[o.jsx(v6,{className:"w-4 h-4 mr-1"}),"Save"]})]}),o.jsxs("div",{className:"flex flex-1 min-h-0",children:[o.jsx(Pde,{onAddElement:y}),o.jsx(Cfe,{template:a,selectedId:s,onSelect:u,onUpdateElement:w,onDeleteElement:j,onTemplateChange:_,scale:d,onZoomIn:()=>c(E=>Math.min(Lfe,E+cM)),onZoomOut:()=>c(E=>Math.max(Dfe,E-cM)),onPreview:()=>p(!0)}),o.jsx(vt,{open:h,onOpenChange:p,children:o.jsxs(pt,{className:"max-w-[90vw] max-h-[90vh] overflow-auto",children:[o.jsx(yt,{children:o.jsx(xt,{children:"标签预览"})}),o.jsx(Efe,{template:a,maxWidth:500})]})}),o.jsx(Rfe,{template:a,selectedElement:x,onTemplateChange:_,onElementChange:w,onDeleteElement:j,locations:m,readOnlyTemplateCode:!!e})]})]})}function X1(){try{return crypto.randomUUID()}catch{return`row-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}}const Ffe="h-[100px] w-[100px] min-h-[100px] min-w-[100px] max-h-[100px] max-w-[100px] shrink-0 aspect-auto";function zfe(e){return e.type==="IMAGE"||e.type==="QRCODE"?!0:(e.elementName??"").trim().toLowerCase().includes("qrcode")}function qfe({element:e,value:t,onValueChange:r}){return zfe(e)?o.jsx(wd,{value:t,onChange:r,uploadSubDir:"label-template-data",oneImageOnly:!0,boxClassName:Ffe,hint:"Upload stores full URL/path for save."}):o.jsx(ve,{value:t,onChange:n=>r(n.target.value),placeholder:"—",className:"h-10 border-gray-300"})}function Ufe({templateCode:e,onBack:t}){const[r,n]=b.useState(!0),[a,i]=b.useState(!1),[s,u]=b.useState(""),[d,c]=b.useState(null),[h,p]=b.useState([]),[m,v]=b.useState([]),[x,y]=b.useState([]),[w,j]=b.useState([]),_=b.useMemo(()=>m.map(M=>{const $=(M.productName??M.productCode??"").trim()||M.id;return{value:M.id,label:$}}),[m]),C=b.useMemo(()=>x.map(M=>{const $=(M.typeName??M.typeCode??"").trim()||M.id;return{value:M.id,label:$}}),[x]);b.useEffect(()=>{let M=!1;return(async()=>{n(!0);try{const[$,z,F]=await Promise.all([F5(e),hm({skipCount:Fa(1),maxResultCount:500}),CN({skipCount:Fa(1),maxResultCount:500})]);if(M)return;const V=($.templateName??$.name??"").trim()||($.templateCode??$.id??"").trim()||e;u(V);const G=iI($.elements??[]).filter(Nde);p(G),v(z.items??[]),y(F.items??[]),c($);const U=$.templateProductDefaults??[],H=U.length>0?[...U].sort((W,B)=>(W.orderNum??0)-(B.orderNum??0)):[];H.length>0?j(H.map(W=>({id:X1(),productId:W.productId,labelTypeId:W.labelTypeId,fieldValues:{...W.defaultValues}}))):j([{id:X1(),productId:"",labelTypeId:"",fieldValues:{}}])}catch($){M||(pe.error("Failed to load template or options.",{description:$ instanceof Error?$.message:"Please try again."}),u(e),p([]),j([]),c(null))}finally{M||n(!1)}})(),()=>{M=!0}},[e]);const A=b.useCallback(()=>{j(M=>[...M,{id:X1(),productId:"",labelTypeId:"",fieldValues:{}}])},[]),E=b.useCallback(M=>{j($=>$.length<=1?$:$.filter(z=>z.id!==M))},[]),O=b.useCallback((M,$)=>{j(z=>z.map(F=>F.id===M?{...F,...$}:F))},[]),T=b.useCallback((M,$,z)=>{j(F=>F.map(V=>V.id!==M?V:{...V,fieldValues:{...V.fieldValues,[$]:z}}))},[]),k=b.useCallback(async()=>{if(!d){pe.error("Template not loaded",{description:"Please reload the page and try again."});return}if(w.filter(U=>U.productId.trim()||U.labelTypeId.trim()).some(U=>!U.productId.trim()||!U.labelTypeId.trim())){pe.error("Product and label type required",{description:"Each row that you started must have both Product and Label type selected."});return}const F=w.filter(U=>U.productId.trim()&&U.labelTypeId.trim()).map((U,H)=>{const W={};for(const B of h)W[B.id]=U.fieldValues[B.id]??"";return{productId:U.productId.trim(),labelTypeId:U.labelTypeId.trim(),defaultValues:W,orderNum:H+1}}),V=iI(d.elements??[]);if(V.length===0){pe.error("Template has no elements",{description:"Cannot save this template."});return}const G=EN(d);i(!0);try{const U=await z5(e,{id:d.id,name:(d.name??d.templateName??"").trim()||e,labelType:d.labelType??"PRICE",unit:d.unit??"inch",width:Number(d.width??2),height:Number(d.height??2),appliedLocation:G,showRuler:d.showRuler??!0,showGrid:d.showGrid??!0,state:d.state??!0,elements:Y5(V),appliedLocationIds:G==="ALL"?[]:d.appliedLocationIds??[],templateProductDefaults:F});c(U),pe.success("Saved",{description:"Template product defaults were updated on the server."})}catch(U){pe.error("Save failed",{description:U instanceof Error?U.message:"Please try again."})}finally{i(!1)}},[e,d,w,h]);return o.jsxs("div",{className:"h-full flex flex-col min-h-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-3 pb-4 border-b border-gray-200 shrink-0",children:[o.jsxs(he,{type:"button",variant:"outline",className:"h-10 gap-2",onClick:t,children:[o.jsx(vM,{className:"h-4 w-4"}),"Back"]}),o.jsxs("div",{className:"flex-1 min-w-[200px]",children:[o.jsx("div",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Label template"}),o.jsx("h2",{className:"text-lg font-semibold text-gray-900 truncate",title:s,children:s})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(he,{type:"button",variant:"outline",className:"h-10 gap-1",onClick:A,children:[o.jsx(tn,{className:"h-4 w-4"}),"Add row"]}),o.jsx(he,{type:"button",className:"h-10 bg-blue-600 hover:bg-blue-700",onClick:()=>void k(),disabled:a||r||!d,children:a?"Saving…":"Save"})]})]}),o.jsxs("p",{className:"text-sm text-gray-600 py-3 shrink-0",children:["Bind product and label type per row. Values are saved with the template (edit API) as"," ",o.jsx("span",{className:"font-medium",children:"templateProductDefaults"})," (interface doc section 4.4). Only"," ",o.jsx("span",{className:"font-medium",children:"FIXED"})," fields appear here."," ",o.jsx("span",{className:"font-medium",children:"AUTO_DB"})," and ",o.jsx("span",{className:"font-medium",children:"PRINT_INPUT"})," ","are resolved at print time in the app. Column headers use"," ",o.jsx("span",{className:"font-medium",children:"elementName"}),"."]}),o.jsx("div",{className:"flex-1 min-h-0 overflow-auto rounded-md border bg-white shadow-sm",children:r?o.jsx("div",{className:"p-10 text-center text-sm text-gray-500",children:"Loading…"}):h.length===0?o.jsxs("div",{className:"p-10 text-center text-sm text-gray-600",children:["No ",o.jsx("span",{className:"font-medium",children:"FIXED"})," elements in this template (or none besides blanks). AUTO_DB / PRINT_INPUT columns are hidden here by design."]}):o.jsxs(Rr,{children:[o.jsx(Ir,{children:o.jsxs(Le,{className:"bg-gray-50 hover:bg-gray-50",children:[o.jsx(ye,{className:"font-bold text-gray-900 w-[200px] min-w-[160px]",children:"Product"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[180px] min-w-[140px]",children:"Label type"}),h.map(M=>o.jsx(ye,{className:"font-bold text-gray-900 min-w-[120px] whitespace-nowrap",title:M.id,children:_de(M)},M.id)),o.jsx(ye,{className:"w-[72px] text-center font-bold text-gray-900",children:" "})]})}),o.jsx(Mr,{children:w.map(M=>o.jsxs(Le,{className:"hover:bg-gray-50",children:[o.jsx(fe,{className:"align-top py-2",children:o.jsx(Hn,{value:M.productId,onValueChange:$=>O(M.id,{productId:$}),options:_,placeholder:"Select product",searchPlaceholder:"Search product…"})}),o.jsx(fe,{className:"align-top py-2",children:o.jsx(Hn,{value:M.labelTypeId,onValueChange:$=>O(M.id,{labelTypeId:$}),options:C,placeholder:"Select label type",searchPlaceholder:"Search type…"})}),h.map($=>o.jsx(fe,{className:"align-top py-2",children:o.jsx(qfe,{element:$,value:M.fieldValues[$.id]??"",onValueChange:z=>T(M.id,$.id,z)})},$.id)),o.jsx(fe,{className:"text-center align-top py-2",children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 text-red-600 hover:text-red-700 hover:bg-red-50","aria-label":"Remove row",onClick:()=>E(M.id),disabled:w.length<=1,children:o.jsx(Ot,{className:"h-4 w-4"})})})]},M.id))})]})})]})}function Y1(e){const t=(e??"").trim();return t||"None"}function Vfe(e,t){if(EN(e)==="ALL")return"All";const n=e.appliedLocationIds??[];if(n.length===0)return"Specified (0)";const a=n.map(i=>t.find(s=>s.id===i)?.locationName?.trim()||i);return a.length<=2?a.join(", "):`${a.slice(0,2).join(", ")} +${a.length-2}`}function Hfe(e){const t=(e.templateName??e.name??"").trim();return t||"None"}function Wfe(e){const t=(e.templateCode??e.id??"").trim();return t||"None"}function Gfe(e,t){const r=(e.locationText??"").trim();return r||Vfe(e,t)}function Kfe(e){return typeof e.contentsCount=="number"?e.contentsCount:e.elements?.length??0}function Xfe(e){const t=(e.sizeText??"").trim();if(t)return t;const r=e.width,n=e.height,a=e.unit;return r!=null&&n!=null&&a?`${r}×${n} ${a}`:"None"}function Yfe(){const[e,t]=b.useState([]),[r,n]=b.useState("list"),[a,i]=b.useState(null),[s,u]=b.useState(null),[d,c]=b.useState(null),[h,p]=b.useState(!1),[m,v]=b.useState(0),[x,y]=b.useState(0),[w,j]=b.useState(null),[_,C]=b.useState(!1),[A,E]=b.useState(null),[O,T]=b.useState(""),[k,M]=b.useState("all"),[$,z]=b.useState("all"),[F,V]=b.useState("all"),[G,U]=b.useState(1),[H,W]=b.useState(10),[B,Q]=b.useState([]),R=b.useRef(null),L=b.useRef(null),[I,X]=b.useState("");b.useEffect(()=>(L.current&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>X(O.trim()),300),()=>{L.current&&window.clearTimeout(L.current)}),[O]);const ee=Math.max(1,Math.ceil(m/H));b.useEffect(()=>{let Y=!1;return(async()=>{try{const we=await rc({skipCount:1,maxResultCount:500});Y||Q(we.items??[])}catch{Y||Q([])}})(),()=>{Y=!0}},[]),b.useEffect(()=>{U(1)},[I,k,$,F,H]),b.useEffect(()=>r!=="list"?void 0:((async()=>{R.current?.abort();const we=new AbortController;R.current=we,p(!0);try{const Ce=Fa(G),Be=await B5({skipCount:Ce,maxResultCount:H,keyword:I||void 0,locationId:k!=="all"?k:void 0,labelType:$!=="all"?$:void 0,state:F==="all"?void 0:F==="true"},we.signal);t(Be.items??[]),v(Be.totalCount??0)}catch(Ce){if(Ce?.name==="AbortError")return;pe.error("Failed to load label templates.",{description:Ce?.message?String(Ce.message):"Please try again."}),t([]),v(0)}finally{p(!1)}})(),()=>R.current?.abort()),[I,k,$,F,G,H,x,r]);const ie=()=>y(Y=>Y+1),re=()=>{i(null),c(null),n("editor")},K=async Y=>{i(Y),p(!0);try{const we=await F5(Y),Ce={id:we.id,name:(we.name??we.templateName??"").trim()||"未命名模板",labelType:we.labelType??"PRICE",unit:we.unit??"cm",width:we.width??6,height:we.height??4,appliedLocation:EN(we),appliedLocationIds:[...we.appliedLocationIds??[]],showRuler:we.showRuler??!0,showGrid:we.showGrid??!0,elements:(we.elements??[]).map((Be,et)=>{const tt=Be,St=(tt.elementName??"").trim();return{...tt,elementName:St||`element${et+1}`}})};c(Ce),n("editor")}catch(we){pe.error("Failed to load template.",{description:we?.message?String(we.message):"Please try again."})}finally{p(!1)}},Z=()=>{n("list"),i(null),c(null)},ne=Y=>{j(null),u(Y),n("dataEntry")},de=()=>{n("list"),u(null)},ge=Y=>{j(null),E(Y),C(!0)};return r==="editor"?o.jsx("div",{className:"h-[calc(100vh-8rem)] min-h-[500px] flex flex-col",children:o.jsx(Bfe,{templateId:a,initialTemplate:d,onClose:Z,onSaved:ie})}):r==="dataEntry"&&s?o.jsx("div",{className:"h-[calc(100vh-8rem)] min-h-[500px] flex flex-col pt-2",children:o.jsx(Ufe,{templateCode:s,onBack:de})}):o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"pb-4",children:o.jsx("div",{className:"flex flex-col gap-4",children:o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ve,{placeholder:"Search",value:O,onChange:Y=>T(Y.target.value),style:{height:40,boxSizing:"border-box"},className:"bg-white border border-gray-300 rounded-md w-40 shrink-0 placeholder:text-gray-500"}),o.jsxs(Ve,{value:k,onValueChange:M,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Location"})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"all",children:"All Locations"}),B.map(Y=>o.jsx(Ne,{value:Y.id,children:Y1(Y.locationName??Y.locationCode??Y.id)},Y.id))]})]}),o.jsxs(Ve,{value:$,onValueChange:z,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Label Type"})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"all",children:"All Types"}),o.jsx(Ne,{value:"PRICE",children:"PRICE"}),o.jsx(Ne,{value:"NUTRITION",children:"NUTRITION"}),o.jsx(Ne,{value:"SHIPPING",children:"SHIPPING"})]})]}),o.jsxs(Ve,{value:F,onValueChange:V,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"State"})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"all",children:"All States"}),o.jsx(Ne,{value:"true",children:"Active"}),o.jsx(Ne,{value:"false",children:"Inactive"})]})]}),o.jsx("div",{className:"flex-1"}),o.jsxs(he,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0",onClick:re,children:["New Label Template ",o.jsx(tn,{className:"ml-1 w-4 h-4"})]})]})})}),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:o.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:o.jsxs(Rr,{children:[o.jsx(Ir,{children:o.jsxs(Le,{className:"bg-gray-50 hover:bg-gray-50",children:[o.jsx(ye,{className:"font-bold text-gray-900 w-[180px]",children:"Label Template"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[120px]",children:"Template Code"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[120px]",children:"Location"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[100px]",children:"Label Type"}),o.jsx(ye,{className:"font-bold text-gray-900",children:"Contents"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[150px]",children:"Size"}),o.jsx(ye,{className:"font-bold text-gray-900 text-center w-[100px]",children:"Actions"})]})}),o.jsx(Mr,{children:h?o.jsx(Le,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):e.length===0?o.jsx(Le,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:'No templates yet. Click "New Label Template" to create one.'})}):e.map(Y=>o.jsxs(Le,{className:"hover:bg-gray-50",children:[o.jsx(fe,{className:"font-medium whitespace-nowrap overflow-hidden text-ellipsis max-w-[180px]",children:Hfe(Y)}),o.jsx(fe,{className:"text-gray-600 whitespace-nowrap overflow-hidden text-ellipsis max-w-[140px]",children:Wfe(Y)}),o.jsx(fe,{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[140px]",children:Y1(Gfe(Y,B))}),o.jsx(fe,{className:"whitespace-nowrap",children:Y1(Y.labelType)}),o.jsxs(fe,{className:"text-sm text-gray-600 whitespace-nowrap",children:[Kfe(Y)," element(s)"]}),o.jsx(fe,{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[160px]",children:Xfe(Y)}),o.jsx(fe,{className:"text-center",children:o.jsxs(ga,{open:w===Y.id,onOpenChange:we=>j(we?Y.id:null),children:[o.jsx(va,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:o.jsx(di,{className:"h-4 w-4 text-gray-500"})})}),o.jsxs(ya,{align:"end",className:"w-48 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",title:"录入数据",onClick:()=>ne(Y.id),children:[o.jsx(qz,{className:"w-4 h-4"}),"Enter Data"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>K(Y.id),children:[o.jsx(Wh,{className:"w-4 h-4"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>ge(Y),children:[o.jsx(Ot,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},Y.id))})]})})}),o.jsx("div",{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[o.jsxs("div",{children:["Showing ",m===0?0:(G-1)*H+1,"-",Math.min(G*H,m)," of ",m]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String(H),onValueChange:Y=>W(Number(Y)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(Y=>o.jsxs(Ne,{value:String(Y),children:[Y," / page"]},Y))})]}),o.jsx(vi,{className:"mx-0 w-auto justify-end",children:o.jsxs(yi,{children:[o.jsx(Ct,{children:o.jsx(xi,{href:"#",size:"default",onClick:Y=>{Y.preventDefault(),U(we=>Math.max(1,we-1))},"aria-disabled":G<=1,className:G<=1?"pointer-events-none opacity-50":""})}),o.jsx(Ct,{children:o.jsxs(xa,{href:"#",isActive:!0,size:"default",onClick:Y=>Y.preventDefault(),children:["Page ",G," / ",ee]})}),o.jsx(Ct,{children:o.jsx(bi,{href:"#",size:"default",onClick:Y=>{Y.preventDefault(),U(we=>Math.min(ee,we+1))},"aria-disabled":G>=ee,className:G>=ee?"pointer-events-none opacity-50":""})})]})})]})]})}),o.jsx(Jfe,{open:_,template:A,onOpenChange:Y=>{C(Y),Y||E(null)},onDeleted:ie})]})}function Jfe({open:e,template:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>(t?.templateName??t?.name??"").trim()||(t?.templateCode??t?.id??"").trim()||"this template",[t]),u=async()=>{if(t?.id){i(!0);try{await Lue(t.id),pe.success("Label template deleted.",{description:"The label template has been removed successfully."}),r(!1),n()}catch(d){pe.error("Failed to delete label template.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Delete Label Template"}),o.jsx(Pt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(wt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Ot,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}function uM(e){const t=(e??"").trim();return t||"None"}function Qfe(){const[e,t]=b.useState(!1),[r,n]=b.useState(!1),[a,i]=b.useState(!1),[s,u]=b.useState(null),[d,c]=b.useState(null),[h,p]=b.useState([]),[m,v]=b.useState(!1),[x,y]=b.useState(0),[w,j]=b.useState(0),[_,C]=b.useState(null),[A,E]=b.useState(""),[O,T]=b.useState("all"),[k,M]=b.useState(1),[$,z]=b.useState(10),F=b.useRef(null),V=b.useRef(null),[G,U]=b.useState("");b.useEffect(()=>(V.current&&window.clearTimeout(V.current),V.current=window.setTimeout(()=>U(A.trim()),300),()=>{V.current&&window.clearTimeout(V.current)}),[A]);const H=Math.max(1,Math.ceil(x/$));b.useEffect(()=>{M(1)},[G,O,$]),b.useEffect(()=>((async()=>{F.current?.abort();const L=new AbortController;F.current=L,v(!0);try{const I=Fa(k),X=await wB({skipCount:I,maxResultCount:$,keyword:G||void 0,state:O==="all"?void 0:O==="true"},L.signal);p(X.items??[]),y(X.totalCount??0)}catch(I){if(I?.name==="AbortError")return;pe.error("Failed to load multiple options.",{description:I?.message?String(I.message):"Please try again."}),p([]),y(0)}finally{v(!1)}})(),()=>F.current?.abort()),[G,O,k,$,w]);const W=()=>j(R=>R+1),B=R=>{C(null),u(R),n(!0)},Q=R=>{C(null),c(R),i(!0)};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"pb-4",children:o.jsx("div",{className:"flex flex-col gap-4",children:o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ve,{placeholder:"Search",value:A,onChange:R=>E(R.target.value),style:{height:40,boxSizing:"border-box"},className:"bg-white border border-gray-300 rounded-md w-40 shrink-0 placeholder:text-gray-500"}),o.jsxs(Ve,{value:O,onValueChange:T,children:[o.jsx(We,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"State"})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"all",children:"All States"}),o.jsx(Ne,{value:"true",children:"Active"}),o.jsx(Ne,{value:"false",children:"Inactive"})]})]}),o.jsx("div",{className:"flex-1"}),o.jsxs(he,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0",onClick:()=>t(!0),children:["New Multiple Options ",o.jsx(tn,{className:"ml-1 h-4 w-4"})]})]})})}),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:o.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:o.jsxs(Rr,{children:[o.jsx(Ir,{children:o.jsxs(Le,{className:"bg-gray-50 hover:bg-gray-50",children:[o.jsx(ye,{className:"font-bold text-gray-900 w-[200px]",children:"Multiple Option Name"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[200px]",children:"Option Code"}),o.jsx(ye,{className:"font-bold text-gray-900",children:"Contents"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[100px]",children:"State"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[100px]",children:"Order"}),o.jsx(ye,{className:"font-bold text-gray-900 w-[180px]",children:"Last Edited"}),o.jsx(ye,{className:"font-bold text-gray-900 text-center w-[100px]",children:"Actions"})]})}),o.jsx(Mr,{children:m?o.jsx(Le,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):h.length===0?o.jsx(Le,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):h.map(R=>o.jsxs(Le,{className:"hover:bg-gray-50",children:[o.jsx(fe,{className:"font-medium",children:uM(R.optionName)}),o.jsx(fe,{className:"text-gray-600",children:uM(R.optionCode)}),o.jsx(fe,{className:"text-gray-600",children:R.optionValuesJson&&R.optionValuesJson.length>0?R.optionValuesJson.join("; "):"None"}),o.jsx(fe,{children:o.jsx(kr,{className:R.state?"bg-green-600":"bg-gray-400",children:R.state?"Active":"Inactive"})}),o.jsx(fe,{className:"font-numeric",children:R.orderNum??"None"}),o.jsx(fe,{className:"text-gray-500 tabular-nums font-numeric",children:R.creationTime?new Date(R.creationTime).toLocaleString():"None"}),o.jsx(fe,{className:"text-center",children:o.jsxs(ga,{open:_===R.id,onOpenChange:L=>C(L?R.id:null),children:[o.jsx(va,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:o.jsx(di,{className:"h-4 w-4 text-gray-500"})})}),o.jsxs(ya,{align:"end",className:"w-40 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>B(R),children:[o.jsx(wn,{className:"w-4 h-4"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>Q(R),children:[o.jsx(Ot,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},R.id))})]})})}),o.jsx("div",{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[o.jsxs("div",{children:["Showing ",x===0?0:(k-1)*$+1,"-",Math.min(k*$,x)," of ",x]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String($),onValueChange:R=>z(Number(R)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(R=>o.jsxs(Ne,{value:String(R),children:[R," / page"]},R))})]}),o.jsx(vi,{className:"mx-0 w-auto justify-end",children:o.jsxs(yi,{children:[o.jsx(Ct,{children:o.jsx(xi,{href:"#",size:"default",onClick:R=>{R.preventDefault(),M(L=>Math.max(1,L-1))},"aria-disabled":k<=1,className:k<=1?"pointer-events-none opacity-50":""})}),o.jsx(Ct,{children:o.jsxs(xa,{href:"#",isActive:!0,size:"default",onClick:R=>R.preventDefault(),children:["Page ",k," / ",H]})}),o.jsx(Ct,{children:o.jsx(bi,{href:"#",size:"default",onClick:R=>{R.preventDefault(),M(L=>Math.min(H,L+1))},"aria-disabled":k>=H,className:k>=H?"pointer-events-none opacity-50":""})})]})})]})]})}),o.jsx(Zfe,{open:e,onOpenChange:t,onCreated:()=>{M(1),W()}}),o.jsx(ehe,{open:r,option:s,onOpenChange:R=>{n(R),R||u(null)},onUpdated:W}),o.jsx(the,{open:a,option:d,onOpenChange:R=>{i(R),R||c(null)},onDeleted:W})]})}function Zfe({open:e,onOpenChange:t,onCreated:r}){const[n,a]=b.useState(!1),[i,s]=b.useState({optionCode:"",optionName:"",optionValuesJson:[],state:!0,orderNum:null}),[u,d]=b.useState(""),c=()=>{s({optionCode:"",optionName:"",optionValuesJson:[],state:!0,orderNum:null}),d("")};b.useEffect(()=>{e||c()},[e]);const h=()=>{const v=u.trim();if(v){if(i.optionValuesJson.includes(v)){pe.error("Duplicate value",{description:"This value already exists."});return}s(x=>({...x,optionValuesJson:[...x.optionValuesJson,v]})),d("")}},p=v=>{s(x=>({...x,optionValuesJson:x.optionValuesJson.filter((y,w)=>w!==v)}))},m=async()=>{if(!i.optionCode.trim()||!i.optionName.trim()){pe.error("Validation failed",{description:"Option Code and Option Name are required."});return}if(i.optionValuesJson.length===0){pe.error("Validation failed",{description:"At least one option value is required."});return}if(i.orderNum===null||i.orderNum===void 0||!Number.isFinite(i.orderNum)){pe.error("Validation failed",{description:"Order is required."});return}a(!0);try{await Afe(i),pe.success("Multiple option created.",{description:"The multiple option has been created successfully."}),t(!1),r()}catch(v){pe.error("Failed to create multiple option.",{description:v?.message?String(v.message):"Please try again."})}finally{a(!1)}};return o.jsx(vt,{open:e,onOpenChange:t,children:o.jsxs(pt,{className:"sm:max-w-[600px]",children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Add New Multiple Option"}),o.jsx(Pt,{children:"Enter the details for the new multiple option."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Option Code *"}),o.jsx(ve,{placeholder:"e.g. OPT_ALLERGENS",value:i.optionCode,onChange:v=>s(x=>({...x,optionCode:v.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Option Name *"}),o.jsx(ve,{placeholder:"e.g. Allergens",value:i.optionName,onChange:v=>s(x=>({...x,optionName:v.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Option Values *"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ve,{placeholder:"Enter a value and press Add",value:u,onChange:v=>d(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),h())}}),o.jsx(he,{type:"button",onClick:h,variant:"outline",children:"Add"})]}),i.optionValuesJson.length>0&&o.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:i.optionValuesJson.map((v,x)=>o.jsxs(kr,{variant:"secondary",className:"flex items-center gap-1",children:[v,o.jsx("button",{type:"button",onClick:()=>p(x),className:"ml-1 hover:text-red-600",children:o.jsx(eo,{className:"h-3 w-3"})})]},x))})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Order *"}),o.jsx(ve,{type:"number",placeholder:"e.g. 1",value:i.orderNum??"",onChange:v=>s(x=>({...x,orderNum:v.target.value?Number(v.target.value):null}))})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Gt,{checked:i.state,onCheckedChange:v=>s(x=>({...x,state:v}))})]})]})]}),o.jsxs(wt,{children:[o.jsx(he,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{disabled:n,onClick:m,children:n?"Creating...":"Create"})]})]})})}function ehe({open:e,option:t,onOpenChange:r,onUpdated:n}){const[a,i]=b.useState(!1),[s,u]=b.useState({optionCode:"",optionName:"",optionValuesJson:[],state:!0,orderNum:null}),[d,c]=b.useState("");b.useEffect(()=>{e&&t&&(u({optionCode:t.optionCode??"",optionName:t.optionName??"",optionValuesJson:t.optionValuesJson??[],state:t.state??!0,orderNum:t.orderNum??null}),c(""))},[e,t]);const h=()=>{const v=d.trim();if(v){if(s.optionValuesJson.includes(v)){pe.error("Duplicate value",{description:"This value already exists."});return}u(x=>({...x,optionValuesJson:[...x.optionValuesJson,v]})),c("")}},p=v=>{u(x=>({...x,optionValuesJson:x.optionValuesJson.filter((y,w)=>w!==v)}))},m=async()=>{if(t?.id){if(!s.optionCode.trim()||!s.optionName.trim()){pe.error("Validation failed",{description:"Option Code and Option Name are required."});return}if(s.optionValuesJson.length===0){pe.error("Validation failed",{description:"At least one option value is required."});return}if(s.orderNum===null||s.orderNum===void 0||!Number.isFinite(s.orderNum)){pe.error("Validation failed",{description:"Order is required."});return}i(!0);try{await Tfe(t.id,s),pe.success("Multiple option updated.",{description:"The multiple option has been updated successfully."}),r(!1),n()}catch(v){pe.error("Failed to update multiple option.",{description:v?.message?String(v.message):"Please try again."})}finally{i(!1)}}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-[600px]",children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Edit Multiple Option"}),o.jsx(Pt,{children:"Update the multiple option details."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Option Code *"}),o.jsx(ve,{placeholder:"e.g. OPT_ALLERGENS",value:s.optionCode,onChange:v=>u(x=>({...x,optionCode:v.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Option Name *"}),o.jsx(ve,{placeholder:"e.g. Allergens",value:s.optionName,onChange:v=>u(x=>({...x,optionName:v.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Option Values *"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ve,{placeholder:"Enter a value and press Add",value:d,onChange:v=>c(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),h())}}),o.jsx(he,{type:"button",onClick:h,variant:"outline",children:"Add"})]}),s.optionValuesJson.length>0&&o.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:s.optionValuesJson.map((v,x)=>o.jsxs(kr,{variant:"secondary",className:"flex items-center gap-1",children:[v,o.jsx("button",{type:"button",onClick:()=>p(x),className:"ml-1 hover:text-red-600",children:o.jsx(eo,{className:"h-3 w-3"})})]},x))})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Order *"}),o.jsx(ve,{type:"number",placeholder:"e.g. 1",value:s.orderNum??"",onChange:v=>u(x=>({...x,orderNum:v.target.value?Number(v.target.value):null}))})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Gt,{checked:s.state,onCheckedChange:v=>u(x=>({...x,state:v}))})]})]})]}),o.jsxs(wt,{children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{disabled:a,onClick:m,children:a?"Updating...":"Update"})]})]})})}function the({open:e,option:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>(t?.optionName??"").trim()||t?.optionCode||"this option",[t]),u=async()=>{if(t?.id){i(!0);try{await kfe(t.id),pe.success("Multiple option deleted.",{description:"The multiple option has been removed successfully."}),r(!1),n()}catch(d){pe.error("Failed to delete multiple option.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Delete Multiple Option"}),o.jsx(Pt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(wt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Ot,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}function rhe({currentView:e="Labels",onViewChange:t}){const r=["Labels","Label Categories","Label Types","Label Templates","Multiple Options"],n=a=>{t&&t(a)};return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"w-full border-b border-gray-200",children:o.jsx("div",{className:"flex overflow-x-auto bg-white",children:r.map(a=>o.jsx("div",{onClick:()=>n(a),style:e===a?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:`px-4 py-2.5 text-sm font-medium whitespace-nowrap cursor-pointer transition-colors -mb-px ${e===a?"text-blue-600":"border-b-2 border-b-transparent text-gray-600 hover:text-gray-800"}`,children:a},a))})}),o.jsxs("div",{className:"min-h-[400px]",children:[e==="Labels"&&o.jsx(Hue,{}),e==="Label Categories"&&o.jsx(rde,{}),e==="Label Types"&&o.jsx(ode,{}),e==="Label Templates"&&o.jsx(Yfe,{}),e==="Multiple Options"&&o.jsx(Qfe,{}),!["Labels","Label Categories","Label Types","Label Templates","Multiple Options"].includes(e)&&o.jsxs("div",{className:"flex items-center justify-center h-64 text-gray-400",children:[e," content coming soon..."]})]})]})}function nhe(){const[e,t]=b.useState([{id:"1",name:"Pop",isOpen:!0,subcategories:[{id:"1-1",name:"2024",isOpen:!0,files:[{id:"f1",name:"uuuuu",date:"10/23/24, 12:21 AM",type:"image"},{id:"f2",name:"664EF167-DFCE-49C1-A417-DC09FEDF78D7.jpg",date:"11/24/25, 8:40 PM",type:"image"}]}]},{id:"2",name:"Training",isOpen:!0,subcategories:[{id:"2-1",name:"BOH",isOpen:!1,files:[]},{id:"2-2",name:"FOH",isOpen:!0,files:[]}]},{id:"3",name:"ww",isOpen:!1,subcategories:[]}]),r=a=>{t(i=>i.map(s=>s.id===a?{...s,isOpen:!s.isOpen}:s))},n=(a,i)=>{t(s=>s.map(u=>u.id!==a?u:{...u,subcategories:u.subcategories.map(d=>d.id===i?{...d,isOpen:!d.isOpen}:d)}))};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ve,{className:"bg-white border border-black rounded-md h-10 w-[150px]"}),o.jsx("span",{className:"text-sm text-black whitespace-nowrap",children:"Search"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Ve,{defaultValue:"all",children:[o.jsx(We,{className:"bg-white border border-black rounded-md h-10 w-[100px]",children:o.jsx(He,{placeholder:"Location"})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"all",children:"all"}),o.jsx(Ne,{value:"loc-a",children:"Location A"})]})]}),o.jsx("span",{className:"text-sm text-black whitespace-nowrap",children:"Location"})]})]}),o.jsxs("div",{className:"bg-gray-100 p-2 flex justify-between items-center border-b border-gray-200",children:[o.jsx("h1",{className:"text-xl font-medium text-gray-700",children:"Information"}),o.jsxs("div",{className:"flex items-center gap-4 text-gray-600",children:[o.jsx("div",{className:"flex items-center gap-1 bg-gray-700 text-white text-[10px] px-1 py-0.5 rounded-sm font-bold",children:"NEW"}),o.jsx(N6,{className:"h-5 w-5"}),o.jsx("span",{className:"font-medium",children:"55789"})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("button",{className:"w-full bg-[#2c7bb6] hover:bg-[#256b9e] text-white py-2 px-4 flex items-center gap-2 text-sm font-medium rounded-sm",children:[o.jsx(tn,{className:"h-4 w-4"}),"New Category",o.jsx(Jh,{className:"h-4 w-4 opacity-70"})]}),o.jsx("div",{className:"space-y-4",children:e.map(a=>o.jsxs("div",{className:"border border-gray-300 rounded-sm overflow-hidden",children:[o.jsxs("div",{className:"bg-gradient-to-b from-gray-50 to-gray-100 border-b border-gray-200 p-2 flex items-center justify-between",children:[o.jsxs("button",{onClick:()=>r(a.id),className:"flex items-center gap-2 text-gray-700 font-medium text-sm flex-1 text-left",children:[a.isOpen?o.jsx(al,{className:"h-4 w-4 text-[#2c7bb6]"}):o.jsx(il,{className:"h-4 w-4 text-[#2c7bb6]"}),a.name]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{className:"text-gray-400 hover:text-gray-600",children:o.jsx(Wh,{className:"h-4 w-4"})}),o.jsx("button",{className:"text-red-400 hover:text-red-600",children:o.jsx(eo,{className:"h-4 w-4"})})]})]}),a.isOpen&&o.jsxs("div",{className:"p-2 space-y-3 bg-white",children:[o.jsxs("button",{className:"w-full bg-[#2c7bb6] hover:bg-[#256b9e] text-white py-2 px-4 flex items-center gap-2 text-sm font-medium rounded-sm",children:[o.jsx(tn,{className:"h-4 w-4"}),"New Subcategory",o.jsx(Jh,{className:"h-4 w-4 opacity-70"})]}),o.jsxs("div",{className:"space-y-3",children:[a.subcategories.map(i=>o.jsxs("div",{className:"border border-gray-200 rounded-sm",children:[o.jsxs("div",{className:"bg-white border-b border-gray-200 p-2 flex items-center justify-between",children:[o.jsxs("button",{onClick:()=>n(a.id,i.id),className:"flex items-center gap-2 text-gray-700 font-medium text-sm flex-1 text-left",children:[i.isOpen?o.jsx(al,{className:"h-4 w-4 text-[#2c7bb6]"}):o.jsx(il,{className:"h-4 w-4 text-[#2c7bb6]"}),i.name]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{className:"text-gray-400 hover:text-gray-600",children:o.jsx(Wh,{className:"h-4 w-4"})}),o.jsx("button",{className:"text-red-400 hover:text-red-600",children:o.jsx(eo,{className:"h-4 w-4"})})]})]}),i.isOpen&&o.jsxs("div",{className:"p-3 bg-gray-50/50",children:[o.jsx("div",{className:"mb-2 text-xs font-bold text-gray-500 uppercase tracking-wide",children:"Files"}),o.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 justify-end",children:[o.jsx(he,{size:"sm",className:"h-8 bg-[#4CAF50] hover:bg-[#43a047] text-white text-xs border-none rounded-sm",children:"Upload Your Own File(s)"}),o.jsx(he,{size:"sm",className:"h-8 bg-[#4CAF50] hover:bg-[#43a047] text-white text-xs border-none rounded-sm",children:"Create A Custom File"}),o.jsx(he,{size:"sm",className:"h-8 bg-[#2c7bb6] hover:bg-[#256b9e] text-white text-xs border-none rounded-sm",children:"Edit File Permissions"}),o.jsxs(he,{size:"sm",className:"h-8 bg-[#2c7bb6] hover:bg-[#256b9e] text-white text-xs border-none rounded-sm gap-1",children:["Sort (A-Z) ",o.jsx(_z,{className:"h-3 w-3"})]})]}),o.jsx("div",{className:"space-y-1",children:i.files.length>0?i.files.map(s=>o.jsxs("div",{className:"flex items-center bg-gray-200/50 p-2 border border-gray-200 rounded-sm text-sm hover:bg-gray-200 transition-colors",children:[o.jsx("div",{className:"flex-shrink-0 mr-3",children:s.type==="image"?o.jsx(Qz,{className:"h-5 w-5 text-[#2c7bb6]"}):o.jsx(ol,{className:"h-5 w-5 text-[#2c7bb6]"})}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("div",{className:"font-medium text-gray-700 truncate",children:s.name})}),o.jsx("div",{className:"text-xs text-gray-500 mr-4 whitespace-nowrap",children:s.date}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{className:"p-1 text-gray-400 hover:text-gray-600 bg-white border border-gray-300 rounded-sm",children:o.jsx(ol,{className:"h-3 w-3"})}),o.jsx("button",{className:"p-1 text-gray-400 hover:text-gray-600 bg-white border border-gray-300 rounded-sm",children:o.jsx(Wh,{className:"h-3 w-3"})}),o.jsx("button",{className:"p-1 text-red-400 hover:text-red-600 bg-white border border-gray-300 rounded-sm",children:o.jsx(eo,{className:"h-3 w-3"})})]})]},s.id)):o.jsx("div",{className:"p-4 border-2 border-dashed border-gray-300 rounded-sm text-center text-gray-400 text-sm",children:"No files in this subcategory"})})]})]},i.id)),a.subcategories.length===0&&o.jsx("div",{className:"p-2 text-sm text-gray-400 italic",children:"No subcategories"})]})]})]},a.id))})]})]})}const ahe=[{id:1,title:"Coffee - 2 hrs",subtitle:"1 min - Completes at 12:05 PM",totalTime:7200,remainingTime:0,status:"expired",icon:Vz},{id:2,title:"Clean Tablet",subtitle:"1 hrs - Completes at 12:37 PM",totalTime:3600,remainingTime:237,status:"running",icon:E6},{id:3,title:"Replace Sanitizer Towels",subtitle:"1 hrs - Completes at 12:37 PM",totalTime:3600,remainingTime:238,status:"running",icon:Ot},{id:4,title:"Take Out Trash",subtitle:"1 hrs - Completes at 01:03 PM",totalTime:3600,remainingTime:58,status:"running",icon:Ot},{id:5,title:"Change Utensils",subtitle:"1 hrs - Completes at 01:03 PM",totalTime:3600,remainingTime:58,status:"running",icon:z6},{id:6,title:"Sanitize Surfaces",subtitle:"1 hrs - Completes at 02:00 PM",totalTime:3600,remainingTime:2157,status:"running",icon:Ny},{id:7,title:"Check Temperatures",subtitle:"1 hrs - Completes at 02:00 PM",totalTime:3600,remainingTime:2158,status:"running",icon:Ny},{id:8,title:"Ranch 4 hrs",subtitle:"4 hrs - Completes at 04:04 PM",totalTime:14400,remainingTime:2158,status:"running",icon:Ny}];function ihe({timer:e}){const t=(e.totalTime-e.remainingTime)/e.totalTime*100,r=e.remainingTime===0,n=a=>{if(a<=0)return"0s";const i=Math.floor(a/60),s=a%60;return`${i.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`};return o.jsxs("div",{className:"bg-gray-200 rounded-xl p-4 flex flex-col items-center relative shadow-sm h-[280px]",children:[o.jsxs("div",{className:"text-center mb-2",children:[o.jsx("h3",{className:"text-lg font-medium text-gray-800 leading-tight",children:e.title}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:e.subtitle})]}),o.jsxs("div",{className:"relative w-32 h-32 my-auto flex items-center justify-center",children:[o.jsxs("svg",{className:"w-full h-full transform -rotate-90",children:[o.jsx("circle",{cx:"64",cy:"64",r:"56",stroke:"white",strokeWidth:"12",fill:"transparent"}),o.jsx("circle",{cx:"64",cy:"64",r:"56",stroke:r?"#ef4444":"#3b82f6",strokeWidth:"12",fill:"transparent",strokeDasharray:351.86,strokeDashoffset:r?0:351.86*(t/100),className:"transition-all duration-1000 ease-linear"})]}),o.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[o.jsx("span",{className:Ee("text-3xl font-bold",r?"text-red-500":"text-gray-800"),children:r?"0s":n(e.remainingTime)}),o.jsx("span",{className:Ee("text-[10px] font-medium uppercase mt-1",r?"text-red-400":"text-gray-400"),children:"Remaining"})]})]}),o.jsxs("div",{className:"w-full flex justify-between items-end mt-2",children:[o.jsx(d6,{className:"w-5 h-5 text-blue-700 fill-current"}),o.jsx("div",{className:"flex flex-col items-center",children:o.jsx("div",{className:"w-10 h-10 rounded-full border-2 border-gray-300 flex items-center justify-center text-gray-400 mb-1",children:o.jsx(e.icon,{className:"w-5 h-5"})})}),o.jsx("div",{className:"flex flex-col items-end",children:o.jsx("span",{className:"text-xs text-blue-600 font-bold mb-2 cursor-pointer",children:"EDIT"})})]}),o.jsx("button",{className:"absolute bottom-12 right-4 bg-blue-600 rounded-full p-1 text-white hover:bg-blue-700 shadow-md",children:o.jsx(eo,{className:"w-4 h-4"})})]})}function ohe(){const[e,t]=b.useState(!0);return o.jsxs("div",{className:"h-full flex flex-col bg-gray-50 relative",children:[o.jsxs("div",{className:"bg-white border-b border-gray-200 px-4 py-3 flex items-center justify-between shadow-sm z-10",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("button",{className:"flex items-center text-blue-500 text-lg font-medium",children:[o.jsx(bM,{className:"w-6 h-6"}),"Back"]}),o.jsx(s6,{className:"w-6 h-6 text-gray-500"})]}),o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"bg-blue-600 p-1.5 rounded-md",children:o.jsx(A6,{className:"w-5 h-5 text-white"})}),o.jsx("h1",{className:"text-xl font-bold text-blue-900",children:"Timers"})]}),o.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 font-medium",children:[o.jsx("span",{children:"86016"}),o.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"})]})]}),o.jsxs("div",{className:"flex items-center gap-4 text-blue-500 font-medium",children:[o.jsx($6,{className:"w-6 h-6 text-gray-400"}),o.jsxs("button",{className:"flex items-center gap-1",children:[o.jsx(tn,{className:"w-5 h-5"}),"Add Timer"]})]})]}),o.jsxs("div",{className:"bg-gray-700 text-white px-6 py-2 flex items-center justify-between",children:[o.jsx("div",{className:"flex-1"})," ",o.jsx("div",{className:"font-medium",children:"Today, December 15"}),o.jsxs("div",{className:"flex-1 flex justify-end items-center gap-4",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Yz,{className:"w-5 h-5 text-gray-300"}),o.jsx(r6,{className:"w-5 h-5 text-gray-500"})]}),o.jsx(bz,{className:"w-5 h-5 text-blue-400"})]})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:ahe.map(r=>o.jsx(ihe,{timer:r},r.id))})}),e&&o.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-[1px]",children:o.jsx("div",{className:"bg-black text-white rounded-xl shadow-2xl w-[600px] max-w-full overflow-hidden border border-gray-800",children:o.jsxs("div",{className:"p-8 text-center space-y-6",children:[o.jsx("h2",{className:"text-3xl font-medium text-blue-500",children:"Coffee - 2 hrs"}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx("p",{className:"text-2xl font-light",children:"Timer expired at 12:05 PM"}),o.jsx("p",{className:"text-2xl font-light",children:"Please discard the coffee"})]}),o.jsx("div",{className:"flex justify-end",children:o.jsx("span",{className:"bg-gray-200 text-black text-[10px] px-1 rounded-sm opacity-50",children:"TACT_Img_Timer-Notification@2x"})}),o.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-8",children:[o.jsx(he,{onClick:()=>t(!1),className:"bg-blue-700 hover:bg-blue-600 text-white h-14 text-xl font-medium rounded-lg",children:"Mute"}),o.jsx(he,{onClick:()=>t(!1),className:"bg-blue-600 hover:bg-blue-500 text-white h-14 text-xl font-medium rounded-lg",children:"Restart"}),o.jsx(he,{onClick:()=>t(!1),className:"bg-blue-800 hover:bg-blue-700 text-white h-14 text-xl font-medium rounded-lg",children:"Acknowledge"})]})]})})})]})}const Cd=nn({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Ed="/product-category";async function dM(e,t){return Cd.requestJson({path:Ed,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,State:e.state},signal:t})}async function she(e,t){return Cd.requestJson({path:`${Ed}/${encodeURIComponent(e)}`,method:"GET",signal:t})}async function lhe(e){return Cd.requestJson({path:Ed,method:"POST",body:{categoryCode:e.categoryCode,categoryName:e.categoryName,categoryPhotoUrl:e.categoryPhotoUrl??null,state:e.state??!0,orderNum:e.orderNum??0}})}async function che(e,t){return Cd.requestJson({path:`${Ed}/${encodeURIComponent(e)}`,method:"PUT",body:{categoryCode:t.categoryCode,categoryName:t.categoryName,categoryPhotoUrl:t.categoryPhotoUrl??null,state:t.state??!0,orderNum:t.orderNum??0}})}async function uhe(e){await Cd.requestJson({path:`${Ed}/${encodeURIComponent(e)}`,method:"DELETE"})}const Tg=nn({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),kg="/product-location";function dhe(e){const t=e;return{id:t?.id??t?.Id,locationId:t?.locationId??t?.LocationId,productId:t?.productId??t?.ProductId}}async function fhe(e,t){const r=await Tg.requestJson({path:kg,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,LocationId:e.locationId,ProductId:e.productId},signal:t});return{...r,items:(r.items??[]).map(n=>dhe(n))}}async function SB(e,t){const r=await Tg.requestJson({path:`${kg}/${encodeURIComponent(e)}`,method:"GET",signal:t});return Array.isArray(r?.productIds)?r.productIds.map(String):Array.isArray(r?.items)?(r.items??[]).map(n=>n?.productId).filter(n=>typeof n=="string"&&n.length>0):[]}async function jB(e){return Tg.requestJson({path:kg,method:"POST",body:{locationId:e.locationId,productIds:e.productIds}})}async function hhe(e,t){return Tg.requestJson({path:`${kg}/${encodeURIComponent(e)}`,method:"PUT",body:{productIds:t.productIds}})}function Jr(e){const t=(e??"").trim();return t||"—"}async function phe(e){const t=new Map;try{const r=await fhe({skipCount:1,maxResultCount:2e3},e);for(const n of r.items??[]){const a=(n.productId??"").trim(),i=(n.locationId??"").trim();if(!a||!i)continue;t.has(a)||t.set(a,[]);const s=t.get(a);s.includes(i)||s.push(i)}}catch{}return t}async function mhe(e,t,r){const n=[...new Set(r.filter(Boolean))];for(const a of n){if(a===t)continue;const i=await SB(a);i.includes(e)&&await hhe(a,{productIds:i.filter(s=>s!==e)})}t.trim()&&await jB({locationId:t,productIds:[e]})}function ghe(){const[e,t]=b.useState("products"),[r,n]=b.useState([]),[a,i]=b.useState(0),[s,u]=b.useState(!1),[d,c]=b.useState(new Map),[h,p]=b.useState([]),[m,v]=b.useState([]),[x,y]=b.useState(0),[w,j]=b.useState([]),[_,C]=b.useState(0),[A,E]=b.useState(!1),[O,T]=b.useState(1),[k,M]=b.useState(10),[$,z]=b.useState(0),F=b.useRef(null),[V,G]=b.useState(""),[U,H]=b.useState(""),W=b.useRef(null),[B,Q]=b.useState("all"),[R,L]=b.useState("all"),[I,X]=b.useState("all"),[ee,ie]=b.useState(1),[re,K]=b.useState(10),[Z,ne]=b.useState(0),de=b.useRef(null),[ge,Y]=b.useState(!1),[we,Ce]=b.useState(!1),[Be,et]=b.useState(null),[tt,St]=b.useState(null),[jt,Kt]=b.useState(null),[_t,ct]=b.useState(null),[nr,En]=b.useState(null),[On,an]=b.useState(null);b.useEffect(()=>(W.current&&window.clearTimeout(W.current),W.current=window.setTimeout(()=>H(V.trim()),300),()=>{W.current&&window.clearTimeout(W.current)}),[V]),b.useEffect(()=>{let ae=!1;return(async()=>{try{const[Te,Ke]=await Promise.all([rc({skipCount:1,maxResultCount:500}),dM({skipCount:1,maxResultCount:500,sorting:"OrderNum desc"})]);if(ae)return;p(Te.items??[]),v(Ke.items??[])}catch{ae||(p([]),v([]))}})(),()=>{ae=!0}},[x]);const Sa=()=>y(ae=>ae+1);b.useEffect(()=>{ie(1)},[U,B,R,I,re]),b.useEffect(()=>{T(1)},[U,I,k]);const Pn=B!=="all"||R!=="all";b.useEffect(()=>e!=="products"?void 0:((async()=>{de.current?.abort();const Te=new AbortController;de.current=Te,u(!0);try{const Ke=await phe(Te.signal);if(Te.signal.aborted)return;if(c(Ke),Pn){const Ft=await hm({skipCount:1,maxResultCount:500,keyword:U||void 0,state:I==="all"?void 0:I==="true"},Te.signal);if(Te.signal.aborted)return;let Lt=Ft.items??[];if(B!=="all"){const Wa=new Set(await SB(B));Lt=Lt.filter(Qe=>Wa.has(Qe.id))}R!=="all"&&(Lt=Lt.filter(Wa=>(Wa.categoryId??"").trim()===R));const Na=Lt.length;i(Na);const Tn=(ee-1)*re;n(Lt.slice(Tn,Tn+re))}else{const Ft=Fa(ee),Lt=await hm({skipCount:Ft,maxResultCount:re,keyword:U||void 0,state:I==="all"?void 0:I==="true"},Te.signal);if(Te.signal.aborted)return;n(Lt.items??[]),i(Lt.totalCount??0)}}catch(Ke){if(Ke?.name==="AbortError")return;pe.error("Failed to load products",{description:Ke?.message?String(Ke.message):"Please try again."}),n([]),i(0)}finally{Te.signal.aborted||u(!1)}})(),()=>de.current?.abort()),[e,U,B,R,I,ee,re,Z,Pn]);const Vr=Math.max(1,Math.ceil(_/k)||1);b.useEffect(()=>{T(ae=>{const Te=Math.max(1,Math.ceil(_/k)||1);return ae>Te?Te:ae})},[_,k]),b.useEffect(()=>e!=="categories"?void 0:((async()=>{F.current?.abort();const Te=new AbortController;F.current=Te,E(!0);try{const Ke=Fa(O),Ft=await dM({skipCount:Ke,maxResultCount:k,sorting:"OrderNum desc",keyword:U||void 0,state:I==="all"?void 0:I==="true"},Te.signal);if(Te.signal.aborted)return;j(Ft.items??[]),C(Ft.totalCount??0)}catch(Ke){if(Ke?.name==="AbortError")return;pe.error("Failed to load categories",{description:Ke?.message?String(Ke.message):"Please try again."}),j([]),C(0)}finally{Te.signal.aborted||E(!1)}})(),()=>F.current?.abort()),[e,U,I,O,k,$]);const br=()=>ne(ae=>ae+1),Dr=()=>{z(ae=>ae+1),Sa()},An=b.useMemo(()=>h.map(ae=>({value:ae.id,label:Jr(ae.locationName??ae.locationCode??ae.id)})),[h]),Ha=b.useMemo(()=>m.map(ae=>({value:(ae.id??"").trim(),label:Jr(ae.categoryName??ae.categoryCode??ae.id)})).filter(ae=>ae.value),[m]),ja=Math.max(1,Math.ceil(a/re)),Ci=b.useCallback(ae=>{const Te=h.find(Ke=>Ke.id===ae);return Jr(Te?.locationName??Te?.locationCode??ae)},[h]);return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"pb-4",children:[o.jsxs("div",{className:"flex flex-nowrap items-center gap-3 flex-wrap",children:[o.jsxs("div",{className:"flex items-center w-40 shrink-0 rounded-md border border-gray-300 bg-white overflow-hidden",style:{height:40},children:[o.jsx(vm,{className:"h-4 w-4 text-gray-400 shrink-0 ml-2.5 pointer-events-none"}),o.jsx(ve,{placeholder:"Search...",value:V,onChange:ae=>G(ae.target.value),className:"flex-1 min-w-0 border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 py-2 px-2 h-full placeholder:text-gray-500"})]}),o.jsxs(Ve,{value:"all",disabled:!0,children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0 opacity-70",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Partner"})}),o.jsx(Ge,{children:o.jsx(Ne,{value:"all",children:"All partners"})})]}),o.jsxs(Ve,{value:"all",disabled:!0,children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0 opacity-70",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Group"})}),o.jsx(Ge,{children:o.jsx(Ne,{value:"all",children:"All groups"})})]}),o.jsxs(Ve,{value:B,onValueChange:Q,children:[o.jsx(We,{className:"w-[160px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Location"})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"all",children:"All Locations"}),h.map(ae=>o.jsx(Ne,{value:ae.id,children:Jr(ae.locationName??ae.locationCode??ae.id)},ae.id))]})]}),o.jsxs(Ve,{value:R,onValueChange:L,children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Category"})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"all",children:"All Categories"}),Ha.map(ae=>o.jsx(Ne,{value:ae.value,children:ae.label},ae.value))]})]}),o.jsxs(Ve,{value:I,onValueChange:X,children:[o.jsx(We,{className:"w-[120px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"State"})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"all",children:"All states"}),o.jsx(Ne,{value:"true",children:"Active"}),o.jsx(Ne,{value:"false",children:"Inactive"})]})]}),o.jsx("div",{className:"flex-1 min-w-2"}),o.jsxs(he,{variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 bg-white hover:bg-gray-50 gap-2 shrink-0",disabled:!0,children:[o.jsx(D6,{className:"w-4 h-4"})," Bulk Import"]}),o.jsxs(he,{variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 bg-white hover:bg-gray-50 gap-2 shrink-0",disabled:!0,children:[o.jsx(HS,{className:"w-4 h-4"})," Bulk Export"]}),o.jsxs(he,{variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 bg-white hover:bg-gray-50 gap-2 shrink-0",disabled:!0,children:[o.jsx(wn,{className:"w-4 h-4"})," Bulk Edit"]}),e==="products"?o.jsxs(he,{className:"h-10 rounded-md bg-blue-600 text-white hover:bg-blue-700 font-medium gap-1 shrink-0",onClick:()=>{ct(null),Y(!0)},children:["New Product ",o.jsx(tn,{className:"w-4 h-4"})]}):o.jsxs(he,{className:"h-10 rounded-md bg-blue-600 text-white hover:bg-blue-700 font-medium gap-1 shrink-0",onClick:()=>{et(null),Ce(!0)},children:["New Category ",o.jsx(tn,{className:"w-4 h-4"})]})]}),o.jsx("div",{className:"w-full border-b border-gray-200 mt-4",children:o.jsxs("div",{className:"flex overflow-x-auto w-fit",children:[o.jsx("button",{type:"button",onClick:()=>t("products"),style:e==="products"?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:`px-4 py-2.5 text-sm font-medium whitespace-nowrap cursor-pointer transition-colors -mb-px border-b-2 ${e==="products"?"text-blue-600":"border-b-transparent text-gray-600 hover:text-gray-800"}`,children:"Products"}),o.jsx("button",{type:"button",onClick:()=>t("categories"),style:e==="categories"?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:`px-4 py-2.5 text-sm font-medium whitespace-nowrap cursor-pointer transition-colors -mb-px border-b-2 ${e==="categories"?"text-blue-600":"border-b-transparent text-gray-600 hover:text-gray-800"}`,children:"Categories"})]})})]}),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:e==="products"?o.jsxs("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden",children:[o.jsxs(Rr,{children:[o.jsx(Ir,{children:o.jsxs(Le,{className:"bg-gray-100 hover:bg-gray-100",children:[o.jsx(ye,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Location"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Product Category"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Product"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Product ID"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Product Code"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Status"}),o.jsx(ye,{className:"text-gray-900 font-bold text-center whitespace-nowrap",children:"Actions"})]})}),o.jsx(Mr,{children:s?o.jsx(Le,{children:o.jsx(fe,{colSpan:7,className:"text-center text-gray-500 py-10",children:"Loading..."})}):r.length===0?o.jsx(Le,{children:o.jsx(fe,{colSpan:7,className:"text-center text-gray-500 py-10",children:"No products found."})}):r.map(ae=>{const Te=d.get(ae.id)??[],Ke=Te.length===0?"—":Te.map(Lt=>Ci(Lt)).join(", "),Ft=ae.state!==!1;return o.jsxs(Le,{children:[o.jsx(fe,{className:"border-r text-sm max-w-[200px] truncate",title:Ke,children:Ke}),o.jsx(fe,{className:"border-r text-gray-900 font-medium whitespace-nowrap",children:Jr(ae.categoryName)}),o.jsx(fe,{className:"border-r text-gray-900 font-medium",children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[ae.productImageUrl?o.jsx("img",{src:Ju(ae.productImageUrl),alt:"",className:"w-8 h-8 rounded object-cover border border-gray-200 shrink-0"}):o.jsx(hu,{className:"w-4 h-4 text-gray-400 shrink-0"}),o.jsx("span",{className:"truncate",children:Jr(ae.productName)})]})}),o.jsx(fe,{className:"border-r font-mono text-sm text-gray-600 whitespace-nowrap",children:ae.id}),o.jsx(fe,{className:"border-r font-mono text-sm text-gray-600 whitespace-nowrap",children:Jr(ae.productCode)}),o.jsx(fe,{className:"border-r whitespace-nowrap",children:o.jsx(kr,{variant:Ft?"default":"secondary",className:Ft?"bg-green-600":"bg-gray-400",children:Ft?"active":"inactive"})}),o.jsx(fe,{className:"text-center whitespace-nowrap",children:o.jsxs(ga,{open:On===ae.id,onOpenChange:Lt=>an(Lt?ae.id:null),children:[o.jsx(va,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",children:o.jsx(di,{className:"h-4 w-4"})})}),o.jsxs(ya,{align:"end",className:"w-36 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start h-9 px-2 font-normal",onClick:async()=>{an(null);try{const Lt=await $ue(ae.id);ct(Lt),Y(!0)}catch(Lt){pe.error("Failed to load product",{description:Lt?.message?String(Lt.message):""})}},children:[o.jsx(wn,{className:"w-4 h-4 mr-2"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>{an(null),En(ae)},children:[o.jsx(Ot,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},ae.id)})})]}),o.jsxs("div",{className:"flex items-center justify-between px-3 py-2 text-sm text-gray-600 border-t border-gray-100",children:[o.jsxs("span",{children:["Showing ",a===0?0:(ee-1)*re+1,"-",Math.min(ee*re,a)," of ",a]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Ve,{value:String(re),onValueChange:ae=>K(Number(ae)),children:[o.jsx(We,{className:"w-[100px] h-9",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(ae=>o.jsxs(Ne,{value:String(ae),children:[ae," / page"]},ae))})]}),o.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:ee<=1,onClick:()=>ie(ae=>Math.max(1,ae-1)),children:"Prev"}),o.jsxs("span",{className:"text-xs tabular-nums",children:["Page ",ee," / ",ja]}),o.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:ee>=ja,onClick:()=>ie(ae=>Math.min(ja,ae+1)),children:"Next"})]})]})]}):o.jsxs("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden flex flex-col",children:[o.jsxs(Rr,{children:[o.jsx(Ir,{children:o.jsxs(Le,{className:"bg-gray-100 hover:bg-gray-100",children:[o.jsx(ye,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Category Name"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Code"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Photo"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Order"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Status"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Last edited"}),o.jsx(ye,{className:"text-gray-900 font-bold text-center whitespace-nowrap w-[72px]",children:"Actions"})]})}),o.jsx(Mr,{children:A?o.jsx(Le,{children:o.jsx(fe,{colSpan:7,className:"text-center text-gray-500 py-10",children:"Loading..."})}):w.length===0?o.jsx(Le,{children:o.jsx(fe,{colSpan:7,className:"text-center text-gray-500 py-10",children:"No categories found."})}):w.map(ae=>{const Te=ae.state!==!1;return o.jsxs(Le,{children:[o.jsx(fe,{className:"border-r font-medium text-gray-900",children:Jr(ae.categoryName)}),o.jsx(fe,{className:"border-r text-gray-600 font-mono text-sm",children:Jr(ae.categoryCode)}),o.jsx(fe,{className:"border-r",children:ae.categoryPhotoUrl?o.jsx("img",{src:Ju(ae.categoryPhotoUrl),alt:"",className:"w-9 h-9 rounded object-cover border border-gray-200"}):o.jsx("span",{className:"text-gray-400 text-sm",children:"—"})}),o.jsx(fe,{className:"border-r text-gray-700",children:ae.orderNum??"—"}),o.jsx(fe,{className:"border-r whitespace-nowrap",children:o.jsx(kr,{variant:Te?"default":"secondary",className:Te?"bg-green-600":"bg-gray-400",children:Te?"active":"inactive"})}),o.jsx(fe,{className:"border-r text-gray-600 text-sm",children:Jr(ae.lastEdited)}),o.jsx(fe,{className:"text-center whitespace-nowrap",children:o.jsxs(ga,{open:jt===ae.id,onOpenChange:Ke=>Kt(Ke?ae.id:null),children:[o.jsx(va,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",children:o.jsx(di,{className:"h-4 w-4"})})}),o.jsxs(ya,{align:"end",className:"w-36 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start h-9 px-2 font-normal",onClick:async()=>{Kt(null);try{const Ke=await she(ae.id);et(Ke),Ce(!0)}catch(Ke){pe.error("Failed to load category",{description:Ke?.message?String(Ke.message):""})}},children:[o.jsx(wn,{className:"w-4 h-4 mr-2"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>{Kt(null),St(ae)},children:[o.jsx(Ot,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},ae.id)})})]}),o.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 bg-white flex flex-wrap items-center justify-between gap-3 shrink-0",children:[o.jsxs("div",{className:"text-sm text-gray-600",children:["Showing ",_===0?0:(O-1)*k+1,"-",Math.min(O*k,_)," of ",_]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String(k),onValueChange:ae=>M(Number(ae)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(ae=>o.jsxs(Ne,{value:String(ae),children:[ae," / page"]},ae))})]}),o.jsx(vi,{className:"mx-0 w-auto justify-end",children:o.jsxs(yi,{children:[o.jsx(Ct,{children:o.jsx(xi,{href:"#",size:"default",onClick:ae=>{ae.preventDefault(),T(Te=>Math.max(1,Te-1))},"aria-disabled":O<=1,className:O<=1?"pointer-events-none opacity-50":""})}),o.jsx(Ct,{children:o.jsxs(xa,{href:"#",isActive:!0,size:"default",onClick:ae=>ae.preventDefault(),children:["Page ",O," / ",Vr]})}),o.jsx(Ct,{children:o.jsx(bi,{href:"#",size:"default",onClick:ae=>{ae.preventDefault(),T(Te=>Math.min(Vr,Te+1))},"aria-disabled":O>=Vr,className:O>=Vr?"pointer-events-none opacity-50":""})})]})})]})]})]})}),o.jsx(vhe,{open:ge,onOpenChange:ae=>{Y(ae),ae||ct(null)},editing:_t,locationOptions:An,categoryOptions:Ha,locationMap:d,onSaved:()=>{br(),Y(!1),ct(null)}}),o.jsx(yhe,{open:!!nr,product:nr,onOpenChange:ae=>{ae||En(null)},onDeleted:br}),o.jsx(xhe,{open:we,category:Be,onOpenChange:ae=>{Ce(ae),ae||et(null)},onSaved:()=>{Dr(),Ce(!1),et(null)}}),o.jsx(bhe,{open:!!tt,category:tt,onOpenChange:ae=>{ae||St(null)},onDeleted:Dr})]})}function vhe({open:e,onOpenChange:t,editing:r,locationOptions:n,categoryOptions:a,locationMap:i,onSaved:s}){const[u,d]=b.useState(!1),[c,h]=b.useState(""),[p,m]=b.useState(""),[v,x]=b.useState(""),[y,w]=b.useState(""),[j,_]=b.useState(!0),[C,A]=b.useState("");b.useEffect(()=>{if(e)if(r){h(r.productCode??""),m(r.productName??""),x((r.categoryId??"").trim()),w(r.productImageUrl??""),_(r.state!==!1);const O=i.get(r.id)??[];A(O[0]??"")}else h(""),m(""),x(""),w(""),_(!0),A("")},[e,r,i]);const E=async()=>{if(!c.trim()||!p.trim()){pe.error("Validation",{description:"Product code and name are required."});return}if(!C.trim()){pe.error("Validation",{description:"Select a store to bind this product."});return}const O={productCode:c.trim(),productName:p.trim(),categoryId:v.trim()||null,productImageUrl:y.trim()||null,state:j};d(!0);try{if(r){await Fue(r.id,O);const T=i.get(r.id)??[];await mhe(r.id,C.trim(),T)}else{const T=await Bue(O);await jB({locationId:C.trim(),productIds:[T.id]})}pe.success(r?"Product updated.":"Product created."),s()}catch(T){pe.error(r?"Update failed":"Create failed",{description:T?.message?String(T.message):""})}finally{d(!1)}};return o.jsx(vt,{open:e,onOpenChange:t,children:o.jsxs(pt,{className:"w-[min(50%,calc(100vw-2rem))] max-w-none sm:max-w-none max-h-[90vh] overflow-y-auto",children:[o.jsxs(yt,{children:[o.jsx(xt,{children:r?"Edit Product":"Add New Product"}),o.jsx(Pt,{children:r?"Update product and store binding.":"Create a product and bind it to a store."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Product code *"}),o.jsx(ve,{className:"h-10",value:c,onChange:O=>h(O.target.value),placeholder:"e.g. PRD_TEST_001"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Product name *"}),o.jsx(ve,{className:"h-10",value:p,onChange:O=>m(O.target.value),placeholder:"e.g. Chicken"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Category"}),o.jsx(Hn,{value:v,onValueChange:x,options:a,placeholder:"Select category (optional)",searchPlaceholder:"Search category…",emptyText:"No categories."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Product image"}),o.jsx(wd,{value:y,onChange:w,uploadSubDir:"product",oneImageOnly:!0,hint:"POST /api/app/picture/category/upload (subDir: product). JPG/PNG/WebP/GIF, max 5 MB."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Bind to store *"}),o.jsx(Hn,{value:C,onValueChange:A,options:n,placeholder:"Select location",searchPlaceholder:"Search location…",emptyText:"No locations."})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 h-10 bg-white",children:[o.jsx("span",{className:"text-sm font-medium",children:"Enabled"}),o.jsx(Gt,{checked:j,onCheckedChange:_})]})]}),o.jsxs(wt,{children:[o.jsx(he,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{type:"button",disabled:u,onClick:E,className:"bg-blue-600 hover:bg-blue-700 text-white",children:u?"Saving…":r?"Save":"Create"})]})]})})}function yhe({open:e,product:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=async()=>{if(t?.id){i(!0);try{await zue(t.id),pe.success("Product deleted."),r(!1),n()}catch(u){pe.error("Delete failed",{description:u?.message?String(u.message):""})}finally{i(!1)}}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-md",children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Delete product"}),o.jsx(Pt,{children:"This cannot be undone."})]}),o.jsxs("p",{className:"text-sm text-gray-700 py-2",children:["Delete ",o.jsx("span",{className:"font-medium",children:Jr(t?.productName)})," (",Jr(t?.productCode),")?"]}),o.jsxs(wt,{children:[o.jsx(he,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{type:"button",variant:"destructive",className:"gap-2",disabled:a,onClick:s,children:[o.jsx(Ot,{className:"h-4 w-4 shrink-0"}),a?"Deleting…":"Delete"]})]})]})})}function xhe({open:e,category:t,onOpenChange:r,onSaved:n}){const a=!!t?.id,[i,s]=b.useState(!1),[u,d]=b.useState(""),[c,h]=b.useState(""),[p,m]=b.useState(""),[v,x]=b.useState("0"),[y,w]=b.useState(!0);b.useEffect(()=>{e&&(t?(d(t.categoryCode??""),h(t.categoryName??""),m(t.categoryPhotoUrl??""),x(t.orderNum===null||t.orderNum===void 0?"0":String(t.orderNum)),w(t.state!==!1)):(d(""),h(""),m(""),x("0"),w(!0)))},[e,t]);const j=async()=>{if(!u.trim()||!c.trim()){pe.error("Validation",{description:"Category code and name are required."});return}const _=Number(v);if(!Number.isFinite(_)){pe.error("Validation",{description:"Order must be a number."});return}const C={categoryCode:u.trim(),categoryName:c.trim(),categoryPhotoUrl:p.trim()||null,state:y,orderNum:_};s(!0);try{a&&t?.id?(await che(t.id,C),pe.success("Category updated.")):(await lhe(C),pe.success("Category created.")),n()}catch(A){pe.error(a?"Update failed":"Create failed",{description:A?.message?String(A.message):""})}finally{s(!1)}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"w-[min(50%,calc(100vw-2rem))] max-w-none sm:max-w-none max-h-[90vh] overflow-y-auto",children:[o.jsxs(yt,{children:[o.jsx(xt,{children:a?"Edit Category":"New Category"}),o.jsx(Pt,{children:a?"Update product category (API: /api/app/product-category).":"Create a product category."})]}),o.jsxs("div",{className:"grid gap-4 py-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Category code *"}),o.jsx(ve,{className:"h-10",value:u,onChange:_=>d(_.target.value),placeholder:"e.g. CAT_PREP"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Category name *"}),o.jsx(ve,{className:"h-10",value:c,onChange:_=>h(_.target.value),placeholder:"e.g. Prep"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Category photo"}),o.jsx(wd,{value:p,onChange:m,uploadSubDir:"category",oneImageOnly:!0,hint:"POST /api/app/picture/category/upload. Max 5 MB."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Order *"}),o.jsx(ve,{className:"h-10",type:"number",value:v,onChange:_=>x(_.target.value),placeholder:"0"})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 h-10 bg-white",children:[o.jsx("span",{className:"text-sm font-medium",children:"Enabled"}),o.jsx(Gt,{checked:y,onCheckedChange:w})]})]}),o.jsxs(wt,{children:[o.jsx(he,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{type:"button",disabled:i,onClick:j,className:"bg-blue-600 hover:bg-blue-700 text-white",children:i?"Saving…":a?"Save":"Create"})]})]})})}function bhe({open:e,category:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=async()=>{if(t?.id){i(!0);try{await uhe(t.id),pe.success("Category deleted."),r(!1),n()}catch(u){pe.error("Delete failed",{description:u?.message?String(u.message):""})}finally{i(!1)}}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-md",children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Delete category"}),o.jsx(Pt,{children:"This cannot be undone."})]}),o.jsxs("p",{className:"text-sm text-gray-700 py-2",children:["Delete ",o.jsx("span",{className:"font-medium",children:Jr(t?.categoryName)})," (",Jr(t?.categoryCode),")?"]}),o.jsxs(wt,{children:[o.jsx(he,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{type:"button",variant:"destructive",className:"gap-2",disabled:a,onClick:s,children:[o.jsx(Ot,{className:"h-4 w-4 shrink-0"}),a?"Deleting…":"Delete"]})]})]})})}const Od=nn({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Pd="/rbac-menu";function Qu(e){if(!e||typeof e!="object")return{id:""};const t=e;return{id:String(t.id??t.Id??""),orderNum:t.orderNum??t.OrderNum,state:t.state??t.State,menuName:t.menuName??t.MenuName,routerName:t.routerName??t.RouterName,menuType:t.menuType??t.MenuType,permissionCode:t.permissionCode??t.PermissionCode,parentId:t.parentId??t.ParentId,menuIcon:t.menuIcon??t.MenuIcon,routeUrl:t.routeUrl??t.RouteUrl,link:t.link??t.Link,isCache:t.isCache??t.IsCache,isShow:t.isShow??t.IsShow,remark:t.remark??t.Remark,component:t.component??t.Component,menuSource:t.menuSource??t.MenuSource,query:t.query??t.Query,concurrencyStamp:t.concurrencyStamp??t.ConcurrencyStamp}}function whe(e){if(Array.isArray(e))return{items:e.map(Qu),totalCount:e.length};const t=e,r=t.items??t.Items??[],n=typeof t.totalCount=="number"?t.totalCount:typeof t.TotalCount=="number"?t.TotalCount:r.length;return{items:r.map(Qu),totalCount:n}}async function NB(e,t){const r=await Od.requestJson({path:Pd,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword},signal:t});return whe(r)}function zS(e){const t=Qu(e),r=e,n=r?.children??r?.Children,a=Array.isArray(n)?n.map(zS):void 0;return{...t,children:a}}function She(e){if(Array.isArray(e))return e.map(zS);if(!e||typeof e!="object")return[];const t=e,r=t.items??t.Items??t.data??t.Data;return Array.isArray(r)?r.map(zS):[]}async function jhe(e){const t=await Od.requestJson({path:`${Pd}/tree`,method:"GET",signal:e});return She(t)}async function Nhe(e){const t=new Map;let r=1;const n=500;for(;;){const i=(await NB({skipCount:r,maxResultCount:n},e)).items??[];for(const s of i)s.menuType!==0||!s.id||t.has(s.id)||t.set(s.id,s);if(i.length100))break}return Array.from(t.values()).sort((a,i)=>(a.orderNum??0)-(i.orderNum??0))}async function _he(e){const t=await Od.requestJson({path:Pd,method:"POST",body:e});return Qu(t)}async function Che(e,t){const r=await Od.requestJson({path:`${Pd}/${encodeURIComponent(e)}`,method:"PUT",body:t});return Qu(r)}async function Ehe(e){e.length&&await Od.requestJson({path:Pd,method:"DELETE",body:e})}async function Ohe(e){await Ehe([e])}const _B=nn({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),CB="/rbac-role-menu";async function Phe(e){await _B.requestJson({path:`${CB}/set`,method:"POST",body:e})}async function Ahe(e){await _B.requestJson({path:CB,method:"DELETE",body:e})}const The=nn({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),khe="/role";async function EB(e,t){return The.requestJson({path:khe,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,RoleName:e.roleName,RoleCode:e.roleCode,State:e.state},signal:t})}const Rg=nn({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Ig="/rbac-role";async function Rhe(e){return Rg.requestJson({path:Ig,method:"POST",body:e})}async function Ihe(e,t){return Rg.requestJson({path:`${Ig}/${encodeURIComponent(e)}`,method:"PUT",body:t})}function Mhe(e){if(!e||typeof e!="object")return[];const t=e,r=Array.isArray(t.menuIds)?t.menuIds:Array.isArray(t.MenuIds)?t.MenuIds:void 0;if(r)return r.map(String);const n=t.data??t.Data;if(n&&typeof n=="object"){const i=n,s=Array.isArray(i.menuIds)?i.menuIds:Array.isArray(i.MenuIds)?i.MenuIds:void 0;if(s)return s.map(String)}const a=Array.isArray(t.roleMenus)?t.roleMenus:Array.isArray(t.RoleMenus)?t.RoleMenus:void 0;if(Array.isArray(a)){const i=[];for(const s of a){if(!s||typeof s!="object")continue;const u=s,d=u.menuId??u.MenuId??u.id??u.Id;d&&i.push(String(d))}return i}return[]}async function Dhe(e){e.length&&await Rg.requestJson({path:Ig,method:"DELETE",body:e})}async function Lhe(e){await Dhe([e])}async function $he(e,t){const r=await Rg.requestJson({path:`${Ig}/${encodeURIComponent(e)}`,method:"GET",signal:t});return Mhe(r)}const Ad=nn({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Td="/team-member";function Bhe(e){if(!Array.isArray(e))return[];const t=[];for(const r of e)if(r!=null){if(typeof r=="string"||typeof r=="number"){t.push(String(r));continue}if(typeof r=="object"){const n=r,a=n.id??n.Id??n.locationId??n.LocationId??n.location_id??n.locationID;a!=null&&t.push(String(a))}}return t}function Fhe(e){if(!Array.isArray(e))return[];const t=[];for(const r of e)if(r!=null){if(typeof r=="string"||typeof r=="number"){t.push(String(r));continue}if(typeof r=="object"){const n=r,a=n.locationCode??n.LocationCode??n.code??n.Code??n.location_code??n.locationCodeId,i=n.locationName??n.LocationName??n.name??n.Name??n.location_name,s=n.id??n.Id??n.locationId??n.LocationId,u=a==null?"":String(a).trim(),d=i==null?"":String(i).trim(),c=s==null?"":String(s).trim();u&&d?t.push(`${u} - ${d}`):d?t.push(d):u?t.push(u):c&&t.push(c)}}return t}function Mg(e){if(!e||typeof e!="object")return{id:""};const t=e,r=String(t.id??t.Id??t.userId??t.UserId??t.user_id??t.UserID??t.memberId??t.MemberId??""),n=t.fullName??t.FullName??t.name??t.Name,a=t.userName??t.UserName??t.username??t.UserName,i=t.email??t.Email,s=t.phone??t.Phone;let u=t.roleId??t.RoleId,d=t.roleName??t.RoleName??t.roleName??t.Role;const c=t.role??t.Role;if((!u||!d)&&c&&typeof c=="object"){const w=c;u=w.id??w.Id??w.roleId??w.RoleId??u,d=w.roleName??w.RoleName??w.name??w.Name??w.role??w.Role??d}const h=t.state??t.State,p=typeof h=="boolean"?h:h==="true"?!0:h==="false"?!1:void 0,m=t.locationIds??t.LocationIds??t.assignedLocationIds??t.AssignedLocationIds??t.location_id_list??t.LocationIdList;let v=Bhe(m);const x=t.locations??t.Locations??t.assignedLocations??t.AssignedLocations??t.locationNames??t.LocationNames;let y=Fhe(x);if(v.length===0&&Array.isArray(x)){const w=[];for(const j of x){if(typeof j!="object"||!j)continue;const _=j,C=_.id??_.Id??_.locationId??_.LocationId;C!=null&&w.push(String(C))}w.length&&(v=w)}return{id:r,fullName:n,userName:a,email:i,phone:s,roleId:u,roleName:d,locationIds:v,locations:y,state:p??(t.status?String(t.status).toLowerCase()==="active":void 0)}}async function zhe(e,t){const r=await Ad.requestJson({path:Td,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Keyword:e.keyword},signal:t}),n=r.items??[];return{totalCount:r.totalCount??0,items:n.map(Mg)}}async function qhe(e,t){const r=await Ad.requestJson({path:`${Td}/${encodeURIComponent(e)}`,method:"GET",signal:t});return Mg(r)}function OB(e){if(e==null||e==="")return null;const t=String(e).trim();return t?Number(t.replace(/\D/g,""))||0:null}function Uhe(e){const t=e.phone!=null&&e.phone!==""?OB(String(e.phone)):null;return{fullName:e.fullName,userName:e.userName,password:e.password,email:e.email??null,phone:t,roleId:e.roleId,locationIds:e.locationIds,locations:e.locationIds,state:e.state}}function Vhe(e){const t=e.phone!=null&&e.phone!==""?OB(String(e.phone)):null,r={fullName:e.fullName,userName:e.userName,email:e.email??null,phone:t,roleId:e.roleId,locationIds:e.locationIds,locations:e.locationIds,state:e.state};return e.password&&(r.password=e.password),r}async function Hhe(e){const t=await Ad.requestJson({path:Td,method:"POST",body:Uhe(e)});return Mg(t)}async function Whe(e,t){const r=await Ad.requestJson({path:`${Td}/${encodeURIComponent(e)}`,method:"PUT",body:Vhe(t)});return Mg(r)}async function Ghe(e){await Ad.requestJson({path:`${Td}/${encodeURIComponent(e)}`,method:"DELETE"})}const PB=[{id:"p1",name:"Global Foods Inc.",status:"active",contact:"admin@globalfoods.com",phone:"+1 (555) 100-2000"},{id:"p2",name:"Local Eateries Co.",status:"active",contact:"support@localeateries.com",phone:"+1 (555) 200-3000"}],Khe=[{id:"g1",name:"West Coast Region",partner:"Global Foods Inc.",status:"active"},{id:"g2",name:"East Coast Region",partner:"Global Foods Inc.",status:"inactive"}];function Xhe(){const[e,t]=b.useState("Roles"),[r,n]=b.useState([]),[a,i]=b.useState(0),[s,u]=b.useState(!1),[d,c]=b.useState(0),[h,p]=b.useState(1),[m,v]=b.useState(10),x=Math.max(1,Math.ceil(a/m)),y=b.useRef(null),[w,j]=b.useState(""),_=b.useRef(null),[C,A]=b.useState(""),[E,O]=b.useState(PB),[T,k]=b.useState(Khe),[M,$]=b.useState([]),[z,F]=b.useState(!1),[V,G]=b.useState(0),[U,H]=b.useState(0),[W,B]=b.useState(1),[Q,R]=b.useState(10),L=Math.max(1,Math.ceil(V/Q)),I=b.useRef(null),[X,ee]=b.useState(""),ie=b.useRef(null),[re,K]=b.useState(""),[Z,ne]=b.useState(null),[de,ge]=b.useState(!1),[Y,we]=b.useState(null),[Ce,Be]=b.useState(!1),[et,tt]=b.useState(null),[St,jt]=b.useState(!1),[Kt,_t]=b.useState(null),[ct,nr]=b.useState(!1),[En,On]=b.useState(null),[an,Sa]=b.useState(!1),[Pn,Vr]=b.useState(!1),[br,Dr]=b.useState(!1),An=()=>{alert(`Exporting ${e} list to PDF...`)};b.useEffect(()=>(_.current&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>A(w.trim()),300),()=>{_.current&&window.clearTimeout(_.current)}),[w]),b.useEffect(()=>(ie.current&&window.clearTimeout(ie.current),ie.current=window.setTimeout(()=>K(X.trim()),300),()=>{ie.current&&window.clearTimeout(ie.current)}),[X]),b.useEffect(()=>{p(1)},[C,m]),b.useEffect(()=>{B(1)},[re,Q]),b.useEffect(()=>e!=="Roles"?void 0:((async()=>{y.current?.abort();const Te=new AbortController;y.current=Te,u(!0);try{const Ke=await EB({skipCount:Math.max(1,h),maxResultCount:m,roleName:C||void 0},Te.signal);n(Ke.items??[]),i(Ke.totalCount??0)}catch(Ke){if(Ke?.name==="AbortError")return;pe.error("Failed to load roles.",{description:Ke?.message?String(Ke.message):"Please try again."}),n([]),i(0)}finally{u(!1)}})(),()=>y.current?.abort()),[e,C,h,m,d]),b.useEffect(()=>e!=="Team Member"?void 0:((async()=>{I.current?.abort();const Te=new AbortController;I.current=Te,F(!0);try{const Ke=await zhe({skipCount:Math.max(1,W),maxResultCount:Q,keyword:re||void 0},Te.signal);$(Ke.items??[]),G(Ke.totalCount??0)}catch(Ke){if(Ke?.name==="AbortError")return;pe.error("Failed to load team members.",{description:Ke?.message?String(Ke.message):"Please try again."}),$([]),G(0)}finally{F(!1)}})(),()=>I.current?.abort()),[e,re,W,Q,U]);const Ha=()=>{switch(e){case"Roles":tt(null),Be(!0);break;case"Partner":Sa(!0);break;case"Group":Vr(!0);break;case"Team Member":ne(null),Dr(!0);break}},ja=()=>{const ae=e==="Team Member";return o.jsxs("div",{className:"flex flex-col gap-4 pb-4",children:[o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ve,{placeholder:"Search",value:e==="Roles"?w:e==="Team Member"?X:"",onChange:Te=>{e==="Roles"&&j(Te.target.value),e==="Team Member"&&ee(Te.target.value)},style:{height:40,boxSizing:"border-box"},className:"border border-gray-300 rounded-md w-40 shrink-0 bg-white placeholder:text-gray-500"}),o.jsx("div",{className:"flex-1"}),ae&&o.jsxs(o.Fragment,{children:[o.jsx(he,{variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 px-4 bg-white hover:bg-gray-50 shrink-0",children:"Bulk Import"}),o.jsx(he,{variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 px-4 bg-white hover:bg-gray-50 shrink-0",children:"Bulk Edit"})]}),o.jsx(he,{variant:"outline",onClick:An,className:"h-10 border border-gray-300 rounded-md text-gray-900 px-4 bg-white hover:bg-gray-50 shrink-0",children:"Bulk Export (PDF)"}),o.jsx(he,{className:"h-10 bg-blue-600 hover:bg-blue-700 text-white rounded-md px-6 font-medium shrink-0",onClick:Ha,children:"New+"})]}),o.jsx("div",{className:"w-full border-b border-gray-200",children:o.jsx("div",{className:"flex overflow-x-auto w-fit",children:["Roles","Partner","Group","Team Member"].map(Te=>o.jsx("button",{onClick:()=>t(Te),style:e===Te?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:Ee("px-4 py-2.5 text-sm font-medium whitespace-nowrap cursor-pointer transition-colors -mb-px border-b-2",e===Te?"text-blue-600":"border-b-transparent text-gray-600 hover:text-gray-800"),children:Te},Te))})})]})},Ci=()=>{switch(e){case"Roles":return o.jsxs("div",{className:"flex flex-col",children:[o.jsxs(Rr,{children:[o.jsx(Ir,{children:o.jsxs(Le,{className:"bg-gray-100",children:[o.jsx(ye,{className:"font-bold text-black border-r",children:"Role Name"}),o.jsx(ye,{className:"font-bold text-black border-r",children:"Role Code"}),o.jsx(ye,{className:"font-bold text-black border-r",children:"Status"}),o.jsx(ye,{className:"font-bold text-black border-r",children:"Order"}),o.jsx(ye,{className:"font-bold text-black text-center",children:"Actions"})]})}),o.jsx(Mr,{children:r.length===0?o.jsx(Le,{children:o.jsx(fe,{colSpan:5,className:"text-center text-sm text-gray-500 py-10",children:s?"Loading...":"No data"})}):r.map(ae=>o.jsxs(Le,{children:[o.jsx(fe,{className:"font-medium border-r",children:ae.roleName??"N/A"}),o.jsx(fe,{className:"border-r text-gray-600",children:ae.roleCode??"N/A"}),o.jsx(fe,{className:"border-r",children:o.jsx(kr,{className:ae.state?"bg-green-600":"bg-gray-400",children:ae.state?"Active":"Inactive"})}),o.jsx(fe,{className:"border-r text-gray-600",children:ae.orderNum??"N/A"}),o.jsxs(fe,{className:"text-center",children:[o.jsx(he,{variant:"ghost",size:"sm",onClick:()=>{_t(ae),jt(!0)},title:"Menu Permissions",children:o.jsx(w6,{className:"w-4 h-4 text-blue-600"})}),o.jsx(he,{variant:"ghost",size:"sm",onClick:()=>{tt(ae),Be(!0)},children:o.jsx(wn,{className:"w-4 h-4 text-gray-500"})}),o.jsx(he,{variant:"ghost",size:"sm",onClick:async()=>{On(ae),nr(!0)},title:"Delete role",children:o.jsx(Ot,{className:"w-4 h-4 text-red-600"})})]})]},ae.id))})]}),o.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 bg-white flex flex-wrap items-center justify-between gap-3",children:[o.jsxs("div",{className:"text-sm text-gray-600",children:["Showing ",a===0?0:(h-1)*m+1,"-",Math.min(h*m,a)," of ",a]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String(m),onValueChange:ae=>v(Number(ae)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(ae=>o.jsxs(Ne,{value:String(ae),children:[ae," / page"]},ae))})]}),o.jsx(vi,{className:"mx-0 w-auto justify-end",children:o.jsxs(yi,{children:[o.jsx(Ct,{children:o.jsx(xi,{href:"#",size:"default",onClick:ae=>{ae.preventDefault(),p(Te=>Math.max(1,Te-1))},"aria-disabled":h<=1,className:h<=1?"pointer-events-none opacity-50":""})}),o.jsx(Ct,{children:o.jsxs(xa,{href:"#",isActive:!0,size:"default",onClick:ae=>ae.preventDefault(),children:["Page ",h," / ",x]})}),o.jsx(Ct,{children:o.jsx(bi,{href:"#",size:"default",onClick:ae=>{ae.preventDefault(),p(Te=>Math.min(x,Te+1))},"aria-disabled":h>=x,className:h>=x?"pointer-events-none opacity-50":""})})]})})]})]})]});case"Partner":return o.jsxs(Rr,{children:[o.jsx(Ir,{children:o.jsxs(Le,{className:"bg-gray-100",children:[o.jsx(ye,{className:"font-bold text-black border-r",children:"Partner Name"}),o.jsx(ye,{className:"font-bold text-black border-r",children:"Contact"}),o.jsx(ye,{className:"font-bold text-black border-r",children:"Phone"}),o.jsx(ye,{className:"font-bold text-black border-r",children:"Status"}),o.jsx(ye,{className:"font-bold text-black text-center",children:"Actions"})]})}),o.jsx(Mr,{children:E.map(ae=>o.jsxs(Le,{children:[o.jsx(fe,{className:"font-medium border-r",children:ae.name}),o.jsx(fe,{className:"border-r",children:ae.contact}),o.jsx(fe,{className:"border-r text-gray-600",children:ae.phone}),o.jsx(fe,{className:"border-r",children:o.jsx(kr,{className:ae.status==="active"?"bg-green-600":"bg-gray-400",children:ae.status})}),o.jsx(fe,{className:"text-center",children:o.jsx(he,{variant:"ghost",size:"sm",children:o.jsx(wn,{className:"w-4 h-4 text-gray-500"})})})]},ae.id))})]});case"Group":return o.jsxs(Rr,{children:[o.jsx(Ir,{children:o.jsxs(Le,{className:"bg-gray-100",children:[o.jsx(ye,{className:"font-bold text-black border-r",children:"Group Name"}),o.jsx(ye,{className:"font-bold text-black border-r",children:"Parent Partner"}),o.jsx(ye,{className:"font-bold text-black border-r",children:"Status"}),o.jsx(ye,{className:"font-bold text-black text-center",children:"Actions"})]})}),o.jsx(Mr,{children:T.map(ae=>o.jsxs(Le,{children:[o.jsx(fe,{className:"font-medium border-r",children:ae.name}),o.jsx(fe,{className:"border-r",children:ae.partner}),o.jsx(fe,{className:"border-r",children:o.jsx(kr,{className:ae.status==="active"?"bg-green-600":"bg-gray-400",children:ae.status})}),o.jsx(fe,{className:"text-center",children:o.jsx(he,{variant:"ghost",size:"sm",children:o.jsx(wn,{className:"w-4 h-4 text-gray-500"})})})]},ae.id))})]});case"Team Member":return o.jsxs(o.Fragment,{children:[o.jsxs(Rr,{children:[o.jsx(Ir,{children:o.jsxs(Le,{className:"bg-gray-100",children:[o.jsx(ye,{className:"font-bold text-black border-r",children:"Name"}),o.jsx(ye,{className:"font-bold text-black border-r",children:"Email"}),o.jsx(ye,{className:"font-bold text-black border-r",children:"Phone"}),o.jsx(ye,{className:"font-bold text-black border-r",children:"Role"}),o.jsx(ye,{className:"font-bold text-black border-r",children:"Assigned Locations"}),o.jsx(ye,{className:"font-bold text-black border-r",children:"Status"}),o.jsx(ye,{className:"font-bold text-black text-center",children:"Actions"})]})}),o.jsx(Mr,{children:z?o.jsx(Le,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):M.length===0?o.jsx(Le,{children:o.jsx(fe,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):M.map(ae=>o.jsxs(Le,{children:[o.jsx(fe,{className:"font-medium border-r",children:ae.fullName??ae.userName??"N/A"}),o.jsx(fe,{className:"border-r text-gray-600",children:ae.email??"N/A"}),o.jsx(fe,{className:"border-r text-gray-600",children:ae.phone??"N/A"}),o.jsx(fe,{className:"border-r",children:o.jsx(kr,{variant:"outline",className:"font-normal",children:ae.roleName??ae.roleId??"N/A"})}),o.jsx(fe,{className:"border-r",children:o.jsxs("div",{className:"flex flex-col gap-1",children:[(ae.locations?.length?ae.locations:ae.locationIds??[]).map(Te=>o.jsxs("div",{className:"flex items-center gap-1 text-xs text-gray-600",children:[o.jsx(Bl,{className:"w-3 h-3"})," ",Te]},Te)),!ae.locations?.length&&!(ae.locationIds?.length??0)&&o.jsx("div",{className:"text-xs text-gray-500",children:"None"})]})}),o.jsx(fe,{className:"border-r",children:o.jsx(kr,{className:ae.state?"bg-green-600":"bg-gray-400",children:ae.state?"Active":"Inactive"})}),o.jsx(fe,{className:"text-center",children:o.jsxs("div",{className:"flex items-center justify-center gap-2",children:[o.jsx(he,{variant:"ghost",size:"sm",onClick:()=>{ne(ae),Dr(!0)},title:"Edit",children:o.jsx(wn,{className:"w-4 h-4 text-gray-500"})}),o.jsx(he,{variant:"ghost",size:"sm",onClick:()=>{we(ae),ge(!0)},title:"Delete",children:o.jsx(Ot,{className:"w-4 h-4 text-red-600"})})]})})]},ae.id))})]}),o.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 bg-white flex flex-wrap items-center justify-between gap-3",children:[o.jsxs("div",{className:"text-sm text-gray-600",children:["Showing ",V===0?0:(W-1)*Q+1,"-",Math.min(W*Q,V)," of ",V]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String(Q),onValueChange:ae=>R(Number(ae)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(ae=>o.jsxs(Ne,{value:String(ae),children:[ae," / page"]},ae))})]}),o.jsx(vi,{className:"mx-0 w-auto justify-end",children:o.jsxs(yi,{children:[o.jsx(Ct,{children:o.jsx(xi,{href:"#",size:"default",onClick:ae=>{ae.preventDefault(),B(Te=>Math.max(1,Te-1))},"aria-disabled":W<=1,className:W<=1?"pointer-events-none opacity-50":""})}),o.jsx(Ct,{children:o.jsxs(xa,{href:"#",isActive:!0,size:"default",onClick:ae=>ae.preventDefault(),children:["Page ",W," / ",L]})}),o.jsx(Ct,{children:o.jsx(bi,{href:"#",size:"default",onClick:ae=>{ae.preventDefault(),B(Te=>Math.min(L,Te+1))},"aria-disabled":W>=L,className:W>=L?"pointer-events-none opacity-50":""})})]})})]})]})]})}};return o.jsxs("div",{className:"h-full flex flex-col",children:[ja(),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:o.jsx("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md",children:Ci()})}),o.jsx(Yhe,{open:Ce,role:et,onOpenChange:ae=>{Be(ae),ae||tt(null)},onSaved:()=>{p(1),c(ae=>ae+1)}}),o.jsx(Jhe,{open:St,role:Kt,onOpenChange:ae=>{jt(ae),ae||_t(null)}}),o.jsx(Qhe,{open:ct,role:En,onOpenChange:ae=>{nr(ae),ae||On(null)},onDeleted:()=>c(ae=>ae+1)}),o.jsx(Zhe,{open:an,onOpenChange:Sa}),o.jsx(epe,{open:Pn,onOpenChange:Vr}),o.jsx(tpe,{open:br,member:Z,onOpenChange:ae=>{Dr(ae),ae||ne(null)},onSaved:()=>{B(1),H(ae=>ae+1)}}),o.jsx(rpe,{open:de,member:Y,onOpenChange:ae=>{ge(ae),ae||we(null)},onDeleted:()=>{H(ae=>ae+1)}})]})}function Yhe({open:e,role:t,onOpenChange:r,onSaved:n}){const a=!!t?.id,[i,s]=b.useState(!1),[u,d]=b.useState(""),[c,h]=b.useState(""),[p,m]=b.useState(""),[v,x]=b.useState(""),[y,w]=b.useState(!0);b.useEffect(()=>{e&&(s(!1),d(t?.roleName??""),h(t?.roleCode??""),m(t?.remark??""),x(t?.orderNum===null||t?.orderNum===void 0?"":String(t.orderNum)),w(t?.state??!0))},[e,t]);const j=b.useMemo(()=>!!(u.trim()&&c.trim()&&v.trim()),[u,c,v]),_=A=>{const E=A.trim();if(!E)return null;const O=Number.parseInt(E,10);return Number.isFinite(O)?O:null},C=async()=>{if(console.log("submit",t),!j){pe.error("Please fill in required fields.",{description:"Role Name, Role Code, and Order are required."});return}s(!0);try{const A={roleName:u.trim(),roleCode:c.trim(),remark:p.trim()?p.trim():null,state:!!y,orderNum:_(v)};a&&t?.id?(await Ihe(t.id,A),pe.success("Role updated.",{description:"Role fields have been saved successfully."})):(await Rhe(A),pe.success("Role created.",{description:"A new role has been created successfully."})),r(!1),n()}catch(A){pe.error(a?"Failed to update role.":"Failed to create role.",{description:A?.message?String(A.message):"Please try again."})}finally{s(!1)}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-[600px]",children:[o.jsxs(yt,{children:[o.jsx(xt,{children:a?"Edit Role":"Create Role"}),o.jsx(Pt,{children:a?"Update role fields and save changes.":"Fill out the form to create a new role."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Role Name *"}),o.jsx(ve,{value:u,onChange:A=>d(A.target.value),placeholder:"e.g. Inventory Specialist"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Role Code *"}),o.jsx(ve,{value:c,onChange:A=>h(A.target.value),placeholder:"e.g. inventory_specialist"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Remark"}),o.jsx(ve,{value:p,onChange:A=>m(A.target.value),placeholder:"Optional"})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Order *"}),o.jsx(ve,{value:v,onChange:A=>x(A.target.value),placeholder:"e.g. 10"})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Gt,{checked:y,onCheckedChange:w})]})]})]}),o.jsxs(wt,{children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{disabled:i,onClick:C,className:"bg-blue-600 text-white hover:bg-blue-700",children:i?"Saving...":"Save"})]})]})})}function Jhe({open:e,role:t,onOpenChange:r}){const n=t?.id??"",a=t?.roleName??"",[i,s]=b.useState(!1),[u,d]=b.useState([]),[c,h]=b.useState(new Set),[p,m]=b.useState(new Set),[v,x]=b.useState(!1),y=b.useRef(null),[w,j]=b.useState(""),_=b.useRef(null),[C,A]=b.useState("");b.useEffect(()=>(_.current&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>A(w.trim()),300),()=>{_.current&&window.clearTimeout(_.current)}),[w]),b.useEffect(()=>e?(s(!1),m(new Set),h(new Set),(async()=>{y.current?.abort();const H=new AbortController;y.current=H,x(!0);try{const W=await jhe(H.signal);if(d(W??[]),n){const B=await $he(n,H.signal);m(new Set(B))}}catch(W){if(W?.name==="AbortError")return;pe.error("Failed to load menus.",{description:W?.message?String(W.message):"Please try again."}),d([]),m(new Set)}finally{x(!1)}})(),()=>y.current?.abort()):void 0,[e,n]);const E=b.useMemo(()=>{const U=H=>H.reduce((W,B)=>W+1+(B.children?U(B.children):0),0);return U(u)},[u]),O=b.useMemo(()=>{const U=C.trim().toLowerCase();if(!U)return u;const H=B=>{const Q=(B.menuName??"").toLowerCase(),R=(B.routeUrl??"").toLowerCase();return Q.includes(U)||R.includes(U)},W=B=>{const Q=[];for(const R of B){const L=R.children?W(R.children):[];(H(R)||L.length)&&Q.push({...R,children:L.length?L:void 0})}return Q};return W(u)},[u,C]);b.useEffect(()=>{if(!C.trim())return;const H=new Set,W=B=>{for(const Q of B)Q.children?.length&&H.add(Q.id),Q.children?.length&&W(Q.children)};W(O),h(H)},[C,O]);const T=U=>{const H=[],W=B=>{B.id&&H.push(B.id),B.children?.length&&B.children.forEach(W)};return W(U),H},k=U=>{const H=T(U);if(!H.length)return{checked:!1,indeterminate:!1};let W=0;for(const B of H)p.has(B)&&(W+=1);return W===0?{checked:!1,indeterminate:!1}:W===H.length?{checked:!0,indeterminate:!1}:{checked:!1,indeterminate:!0}},M=(U,H)=>{m(W=>{const B=new Set(W),Q=T(U);return H?Q.forEach(R=>B.add(R)):Q.forEach(R=>B.delete(R)),B})},$=U=>{h(H=>{const W=new Set(H);return W.has(U)?W.delete(U):W.add(U),W})},z=U=>{const H=C.trim(),W=U??"";if(!H)return W||"N/A";const B=W.toLowerCase().indexOf(H.toLowerCase());if(B<0)return W||"N/A";const Q=W.slice(0,B),R=W.slice(B,B+H.length),L=W.slice(B+H.length);return o.jsxs("span",{children:[Q,o.jsx("span",{className:"bg-yellow-200 rounded px-0.5",children:R}),L]})},F=({node:U,depth:H})=>{const W=!!U.children?.length,B=c.has(U.id),{checked:Q,indeterminate:R}=k(U);return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2 py-1",style:{paddingLeft:H*16},children:[o.jsx("button",{type:"button",className:Ee("h-6 w-6 flex items-center justify-center rounded hover:bg-gray-100",!W&&"opacity-0 pointer-events-none"),onClick:()=>W&&$(U.id),"aria-label":W?B?"Collapse":"Expand":"No children",children:W?B?o.jsx(al,{className:"h-4 w-4"}):o.jsx(il,{className:"h-4 w-4"}):null}),o.jsx(Dl,{id:`perm-menu-${U.id}`,checked:R?"indeterminate":Q,onCheckedChange:L=>M(U,!!L)}),o.jsx("label",{htmlFor:`perm-menu-${U.id}`,className:"text-sm leading-none cursor-pointer select-none",children:z(U.menuName??U.routeUrl??U.id)})]}),W&&B&&o.jsx("div",{children:U.children.map(L=>o.jsx(F,{node:L,depth:H+1},L.id))})]})},V=async()=>{if(console.log("submit",t),!!n){s(!0);try{await Phe({roleId:n,menuIds:Array.from(p)}),pe.success("Role menu permissions saved.",{description:"Menu permissions have been updated successfully."}),r(!1)}catch(U){pe.error("Failed to save menu permissions.",{description:U?.message?String(U.message):"Please try again."})}finally{s(!1)}}},G=async()=>{if(!(!n||p.size===0)){s(!0);try{await Ahe({roleId:n,menuIds:Array.from(p)}),m(new Set),pe.success("Role menu permissions cleared.",{description:"Selected permissions have been removed."})}catch(U){pe.error("Failed to delete menu permissions.",{description:U?.message?String(U.message):"Please try again."})}finally{s(!1)}}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-none",style:{width:"50%"},children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Menu Permissions"}),o.jsx(Pt,{children:a?`Set menu permissions for role: ${a}`:"Set menu permissions for this role."})]}),o.jsx("div",{className:"space-y-4 py-4",children:o.jsxs("div",{className:"rounded border border-gray-200 bg-white",children:[o.jsx("div",{className:"px-3 py-2 text-xs text-gray-500 border-b border-gray-200",children:o.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[o.jsx("div",{children:v?"Loading menus...":`Total ${E} menus`}),o.jsx(ve,{value:w,onChange:U=>j(U.target.value),placeholder:"Search menus",className:"h-8 w-44 bg-white"})]})}),o.jsx(ll,{className:"h-72",children:o.jsxs("div",{className:"p-3 space-y-2",children:[O.map(U=>o.jsx(F,{node:U,depth:0},U.id)),!v&&O.length===0&&o.jsx("div",{className:"text-sm text-gray-500 py-6 text-center",children:"No menus."})]})})]})}),o.jsxs(wt,{className:"flex flex-row justify-end gap-2",children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{variant:"destructive",className:"gap-2",disabled:i||p.size===0||!n,onClick:G,children:[o.jsx(Ot,{className:"h-4 w-4 shrink-0"}),"Delete Selected"]}),o.jsx(he,{disabled:i||!n,onClick:V,className:"bg-blue-600 text-white hover:bg-blue-700",children:i?"Saving...":"Save"})]})]})})}function Qhe({open:e,role:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>(t?.roleName??"").trim()||t?.roleCode||t?.id||"this role",[t]),u=async()=>{if(console.log("submit",t),!!t?.id){i(!0);try{await Lhe(t.id),pe.success("Role deleted.",{description:"The role has been removed successfully."}),r(!1),n()}catch(d){pe.error("Failed to delete role.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Delete Role"}),o.jsx(Pt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(wt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Ot,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}function Zhe({open:e,onOpenChange:t}){return o.jsx(vt,{open:e,onOpenChange:t,children:o.jsxs(pt,{children:[o.jsx(yt,{children:o.jsx(xt,{children:"Create New Partner"})}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Partner Name"}),o.jsx(ve,{placeholder:"Company Name"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Contact Email"}),o.jsx(ve,{placeholder:"admin@partner.com"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Phone Number"}),o.jsx(ve,{type:"tel",placeholder:"+1 (555) 000-0000"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Gt,{id:"partner-status",defaultChecked:!0}),o.jsx(ue,{htmlFor:"partner-status",children:"Active"})]})]}),o.jsxs(wt,{children:[o.jsx(he,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{onClick:()=>t(!1),className:"bg-blue-600 text-white hover:bg-blue-700",children:"Save Partner"})]})]})})}function epe({open:e,onOpenChange:t}){return o.jsx(vt,{open:e,onOpenChange:t,children:o.jsxs(pt,{children:[o.jsx(yt,{children:o.jsx(xt,{children:"Create New Group"})}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Group Name"}),o.jsx(ve,{placeholder:"e.g. West Coast Region"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Assign to Partner"}),o.jsxs(Ve,{children:[o.jsx(We,{children:o.jsx(He,{placeholder:"Select Partner"})}),o.jsx(Ge,{children:PB.map(r=>o.jsx(Ne,{value:r.id,children:r.name},r.id))})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Gt,{id:"group-status",defaultChecked:!0}),o.jsx(ue,{htmlFor:"group-status",children:"Active"})]})]}),o.jsxs(wt,{children:[o.jsx(he,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{onClick:()=>t(!1),className:"bg-blue-600 text-white hover:bg-blue-700",children:"Save Group"})]})]})})}function tpe({open:e,member:t,onOpenChange:r,onSaved:n}){const a=!!t?.id,[i,s]=b.useState(!1),[u,d]=b.useState(""),[c,h]=b.useState(""),[p,m]=b.useState(""),[v,x]=b.useState(""),[y,w]=b.useState(""),[j,_]=b.useState(""),[C,A]=b.useState(!0),[E,O]=b.useState(new Set),[T,k]=b.useState([]),[M,$]=b.useState(!1),[z,F]=b.useState([]),[V,G]=b.useState(!1),[U,H]=b.useState(""),W=b.useRef(null),B=()=>{d(""),h(""),m(""),x(""),w(""),_(""),A(!0),O(new Set)},Q=async re=>{const K=[];let Z=1;const ne=100;for(;;){const ge=await EB({skipCount:Z,maxResultCount:ne},re);if(K.push(...ge.items??[]),!ge.items||ge.items.length200))break}const de=new Map;for(const ge of K)ge.id&&!de.has(ge.id)&&de.set(ge.id,ge);return Array.from(de.values())},R=async re=>{const K=[];let Z=1;const ne=200;for(;;){const ge=await rc({skipCount:Z,maxResultCount:ne},re);if(K.push(...ge.items??[]),!ge.items||ge.items.length200))break}const de=new Map;for(const ge of K)ge.id&&!de.has(ge.id)&&de.set(ge.id,ge);return Array.from(de.values())};b.useEffect(()=>{if(!e)return;W.current?.abort();const re=new AbortController;return W.current=re,s(!1),B(),$(!0),G(!0),(async()=>{try{const[Z,ne]=await Promise.all([Q(re.signal),R(re.signal)]);if(k(Z),F(ne),t?.id){const de=await qhe(t.id,re.signal);d(de.fullName??""),h(de.userName??""),x(de.email??""),w(de.phone!=null?String(de.phone):"");let ge=(de.roleId??"").toString().trim();if(!ge&&de.roleName){const we=String(de.roleName).trim().toLowerCase(),Ce=Z.find(Be=>{const et=String(Be.roleName??"").trim().toLowerCase(),tt=String(Be.roleCode??"").trim().toLowerCase(),St=String(Be.id??"").trim().toLowerCase();return et===we||tt===we||St===we});Ce?.id&&(ge=Ce.id)}_(ge),A(!!de.state);const Y=de.locationIds&&de.locationIds.length?de.locationIds:[];if(Y.length)O(new Set(Y));else if(de.locations?.length){const we=new Set(de.locations),Ce=new Set;for(const Be of ne){const et=`${(Be.locationCode??"").trim()} - ${(Be.locationName??"").trim()}`.trim(),tt=(Be.locationName??"").trim(),St=(Be.locationCode??"").trim();(we.has(et)||we.has(tt)||we.has(St))&&Ce.add(Be.id)}O(Ce)}}}catch(Z){Z?.name!=="AbortError"&&pe.error("Failed to load user form.",{description:Z?.message?String(Z.message):"Please try again."})}finally{$(!1),G(!1)}})(),()=>re.abort()},[e,t?.id]);const L=b.useMemo(()=>!(!u.trim()||!c.trim()||!v.trim()||!String(y??"").trim()||!j.trim()||E.size===0||!a&&!p.trim()),[u,c,v,y,j,E,a,p]),I=(re,K)=>{O(Z=>{const ne=new Set(Z);return K?ne.add(re):ne.delete(re),ne})},X=async re=>{if(re?.preventDefault(),re?.stopPropagation(),console.log("[MemberDialog] submit called",{isEdit:a,memberId:t?.id,canSubmit:L,roleId:j,fullName:u,userName:c,selectedLocationIds:E.size}),!L){const K=[];u.trim()||K.push("Full Name"),c.trim()||K.push("User Name"),v.trim()||K.push("Email"),String(y??"").trim()||K.push("Phone"),j.trim()||K.push("Role"),E.size===0&&K.push("Locations"),!a&&!p.trim()&&K.push("Password"),pe.error("Missing required fields.",{description:`Please fill: ${K.join(", ")}.`});return}if(!a&&!t?.id){s(!0);try{const K=Array.from(E);console.log("[MemberDialog] Creating user",{fullName:u,userName:c,roleId:j,locationIds:K}),await Hhe({fullName:u.trim(),userName:c.trim(),password:p.trim(),email:v.trim(),phone:String(y).trim(),roleId:j.trim(),locationIds:K,state:C}),pe.success("User created.",{description:"A new user has been created successfully."}),r(!1),n()}catch(K){console.error("[MemberDialog] Create error",K),pe.error("Failed to create user.",{description:K?.message?String(K.message):"Please try again."})}finally{s(!1)}}else if(a&&t?.id){s(!0);try{const K=Array.from(E);console.log("[MemberDialog] Updating user",{id:t.id,fullName:u,userName:c,roleId:j,locationIds:K}),await Whe(t.id,{fullName:u.trim(),userName:c.trim(),password:p.trim()?p.trim():null,email:v.trim(),phone:String(y).trim(),roleId:j.trim(),locationIds:K,state:C}),pe.success("User updated.",{description:"Changes have been saved successfully."}),r(!1),n()}catch(K){console.error("[MemberDialog] Update error",K),pe.error("Failed to update user.",{description:K?.message?String(K.message):"Please try again."})}finally{s(!1)}}else console.error("[MemberDialog] Invalid state",{isEdit:a,memberId:t?.id}),pe.error("Invalid form state.",{description:"Please refresh and try again."})},ee=re=>{const K=(re.locationCode??"").trim(),Z=(re.locationName??"").trim();return K&&Z?`${K} - ${Z}`:Z||K||re.id},ie=b.useMemo(()=>{const re=U.trim().toLowerCase();return re?z.filter(K=>ee(K).toLowerCase().includes(re)):z},[z,U]);return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-none",style:{width:"50%"},children:[o.jsxs(yt,{children:[o.jsx(xt,{children:a?"Edit User":"New User"}),o.jsx(Pt,{children:"Role is single-select; Locations is multi-select."})]}),o.jsxs("div",{className:"space-y-4 py-4 max-h-[70vh] overflow-y-auto pr-1",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Full Name *"}),o.jsx(ve,{value:u,onChange:re=>d(re.target.value),placeholder:"John Doe"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"User Name *"}),o.jsx(ve,{value:c,onChange:re=>h(re.target.value),placeholder:"username"})]})]}),!a&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Password *"}),o.jsx(ve,{type:"password",value:p,onChange:re=>m(re.target.value),placeholder:"Enter password",autoComplete:"new-password",className:"w-full"})]}),a&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Password (Optional)"}),o.jsx(ve,{type:"password",value:p,onChange:re=>m(re.target.value),placeholder:"Enter new password (optional)",autoComplete:"new-password",className:"w-full"})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Email *"}),o.jsx(ve,{value:v,onChange:re=>x(re.target.value),placeholder:"john@example.com"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Phone *"}),o.jsx(ve,{value:y,onChange:re=>w(re.target.value),placeholder:"+1 (555) 000-0000"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Role *"}),o.jsxs(Ve,{value:j||"",onValueChange:re=>{const K=re&&re.trim()?re.trim():"";console.log("[MemberDialog] Role changed",{old:j,new:K,v:re}),_(K)},disabled:M,children:[o.jsx(We,{className:"h-10 rounded-md border border-gray-200 bg-white",children:o.jsx(He,{placeholder:M?"Loading roles...":"Select role"})}),o.jsx(Ge,{children:T.map(re=>o.jsx(Ne,{value:re.id,children:re.roleName??re.roleCode??re.id},re.id))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Locations *"}),o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(ve,{value:U,onChange:re=>H(re.target.value),placeholder:"Search locations",className:"h-9"}),o.jsxs("div",{className:"text-xs text-gray-500 shrink-0",children:[E.size," selected"]})]}),o.jsx(ll,{className:"h-[180px] w-full border rounded-md p-2",children:o.jsx("div",{className:"space-y-2",children:V?o.jsx("div",{className:"text-sm text-gray-500 py-2",children:"Loading..."}):ie.map(re=>o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Dl,{id:`loc-${re.id}`,checked:E.has(re.id),onCheckedChange:K=>I(re.id,!!K)}),o.jsx("label",{htmlFor:`loc-${re.id}`,className:"text-sm cursor-pointer w-full hover:bg-gray-50 p-1 rounded",children:ee(re)})]},re.id))})}),o.jsx("p",{className:"text-xs text-gray-500",children:"* Users must be assigned to at least one location."})]}),o.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[o.jsx(Gt,{id:"member-status",checked:C,onCheckedChange:A}),o.jsx(ue,{htmlFor:"member-status",children:C?"Active":"Inactive"})]})]}),o.jsxs(wt,{children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{disabled:i||!L,onClick:re=>{re.preventDefault(),re.stopPropagation(),X(re)},className:"bg-blue-600 text-white hover:bg-blue-700",children:i?"Saving...":a?"Save":"Create"})]})]})})}function rpe({open:e,member:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>{const d=(t?.fullName??"").trim(),c=(t?.userName??"").trim();return d||c||"this user"},[t?.fullName,t?.userName]),u=async()=>{if(console.log("submit",t),!!t?.id){i(!0);try{await Ghe(t.id),pe.success("User deleted.",{description:"The user has been removed successfully."}),r(!1),n()}catch(d){pe.error("Failed to delete user.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Delete User"}),o.jsx(Pt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(wt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{variant:"outline",className:"min-w-24",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{variant:"destructive",className:"min-w-24 gap-2",disabled:a,onClick:u,children:[o.jsx(Ot,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}const npe=[{id:"1-251201",productName:"Whole Milk",category:"Dairy",template:'2"x2" Basic',printedAt:"2024-03-20 09:30 AM",printedBy:"Alice Johnson",location:"Downtown Store (101)",expiryDate:"2024-03-27",status:"Valid"},{id:"2-251201",productName:"Ground Beef",category:"Meat",template:'2"x2" Basic',printedAt:"2024-03-20 10:15 AM",printedBy:"Bob Smith",location:"Uptown Store (102)",expiryDate:"2024-03-23",status:"Valid"},{id:"3-251201",productName:"Croissant",category:"Bakery",template:'2"x2" Basic',printedAt:"2024-03-19 14:00 PM",printedBy:"Charlie Brown",location:"Downtown Store (101)",expiryDate:"2024-03-20",status:"Expired"},{id:"4-251201",productName:"Caesar Salad",category:"Deli",template:`2"x6" G'n'G !!!`,printedAt:"2024-03-18 11:45 AM",printedBy:"Alice Johnson",location:"Downtown Store (101)",expiryDate:"2024-03-21",status:"Expiring Soon"},{id:"5-251201",productName:"Orange Juice",category:"Beverage",template:'2"x2" Basic',printedAt:"2024-03-18 08:20 AM",printedBy:"Bob Smith",location:"Airport Kiosk (201)",expiryDate:"2024-03-25",status:"Valid"}],ape=[{name:"Dairy",count:450},{name:"Meat",count:320},{name:"Bakery",count:280},{name:"Deli",count:190},{name:"Produce",count:150},{name:"Beverage",count:120}],ipe=[{date:"Mon",count:120},{date:"Tue",count:132},{date:"Wed",count:101},{date:"Thu",count:134},{date:"Fri",count:190},{date:"Sat",count:230},{date:"Sun",count:210}];function ope(){const[e,t]=b.useState("print-log"),r=n=>{pe.success(`Reprinting label ${n}`,{description:"Watermark 'RePrint' applied."})};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"pb-4",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[o.jsxs(Ve,{defaultValue:"partner-a",children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Partner"})}),o.jsx(Ge,{children:o.jsx(Ne,{value:"partner-a",children:"Partner A"})})]}),o.jsxs(Ve,{defaultValue:"group-b",children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Group"})}),o.jsx(Ge,{children:o.jsx(Ne,{value:"group-b",children:"Group B"})})]}),o.jsxs(Ve,{defaultValue:"loc-12345",children:[o.jsx(We,{className:"w-[160px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Location"})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"loc-12345",children:"Downtown Store"}),o.jsx(Ne,{value:"all",children:"All Locations"})]})]}),o.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Period Search:"}),o.jsxs("div",{className:"flex items-center bg-white border border-gray-300 rounded-md h-10 px-2",style:{minHeight:40},children:[o.jsx(Oz,{className:"w-4 h-4 text-gray-500 mr-2 shrink-0"}),o.jsx("input",{type:"date",className:"text-sm outline-none w-32 bg-transparent"}),o.jsx("span",{className:"mx-2 text-gray-400",children:"-"}),o.jsx("input",{type:"date",className:"text-sm outline-none w-32 bg-transparent"})]})]}),o.jsxs("div",{className:"flex items-center w-64 rounded-md border border-gray-300 bg-white overflow-hidden shrink-0",style:{height:40},children:[o.jsx(vm,{className:"h-4 w-4 text-gray-400 shrink-0 ml-3 pointer-events-none"}),o.jsx(ve,{placeholder:"Search Product or Category...",className:"flex-1 min-w-0 border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 py-2 px-2 h-full placeholder:text-gray-500"})]}),o.jsx("div",{className:"flex-1 min-w-2"}),o.jsxs(he,{variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 bg-white hover:bg-gray-50 gap-2 shrink-0",children:[o.jsx(HS,{className:"w-4 h-4"})," Export Report"]})]}),o.jsx("div",{className:"w-full border-b border-gray-200 mt-4",children:o.jsxs("div",{className:"flex overflow-x-auto w-fit",children:[o.jsx("button",{onClick:()=>t("print-log"),style:e==="print-log"?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:Ee("px-4 py-2.5 text-sm font-medium whitespace-nowrap cursor-pointer transition-colors -mb-px border-b-2",e==="print-log"?"text-blue-600":"border-b-transparent text-gray-600 hover:text-gray-800"),children:"Print Log"}),o.jsx("button",{onClick:()=>t("label-report"),style:e==="label-report"?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:Ee("px-4 py-2.5 text-sm font-medium whitespace-nowrap cursor-pointer transition-colors -mb-px border-b-2",e==="label-report"?"text-blue-600":"border-b-transparent text-gray-600 hover:text-gray-800"),children:"Label Report"})]})})]}),o.jsxs("div",{className:"flex-1 overflow-auto pt-6",children:[e==="print-log"&&o.jsx("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden",children:o.jsxs(Rr,{children:[o.jsx(Ir,{children:o.jsxs(Le,{className:"bg-gray-100 hover:bg-gray-100",children:[o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Label ID"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Product Name"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Category"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Template"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Printed At"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Printed By"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Location"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Expiry Date"}),o.jsx(ye,{className:"text-gray-900 font-bold text-center",children:"Action"})]})}),o.jsx(Mr,{children:npe.map(n=>o.jsxs(Le,{children:[o.jsx(fe,{className:"border-r font-numeric text-gray-600",children:n.id}),o.jsx(fe,{className:"border-r font-medium",children:n.productName}),o.jsx(fe,{className:"border-r",children:o.jsx(kr,{variant:"secondary",className:"bg-blue-50 text-blue-700 hover:bg-blue-50 border-blue-200",children:n.category})}),o.jsx(fe,{className:"border-r text-gray-600 text-sm",children:(()=>{const a=n.template.endsWith(" !!!"),i=a?n.template.slice(0,-4):n.template,s=i.lastIndexOf(" "),u=i.slice(0,s+1),d=i.slice(s+1);return o.jsxs(o.Fragment,{children:[u,o.jsx("span",{className:"font-bold text-gray-900",children:d}),a&&o.jsx("span",{className:"text-red-600",children:" !!!"})]})})()}),o.jsx(fe,{className:"border-r text-gray-600 text-sm font-numeric",children:n.printedAt}),o.jsx(fe,{className:"border-r text-gray-600 text-sm",children:n.printedBy}),o.jsx(fe,{className:"border-r text-gray-600 text-sm font-numeric",children:n.location}),o.jsx(fe,{className:"border-r",children:o.jsx("span",{className:Ee("text-sm font-medium font-numeric",n.status==="Expired"?"text-red-600":n.status==="Expiring Soon"?"text-orange-500":"text-green-600"),children:n.expiryDate})}),o.jsx(fe,{className:"text-center",children:o.jsxs(he,{size:"sm",variant:"outline",className:"h-8 gap-1 hover:bg-gray-100 border-gray-300",onClick:()=>r(n.id),children:[o.jsx(_M,{className:"w-3 h-3"})," Reprint"]})})]},n.id))})]})}),e==="label-report"&&o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[o.jsxs(gn,{children:[o.jsxs(sa,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(la,{className:"text-sm font-medium",children:"Total Labels Printed"}),o.jsx(ol,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(qn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"2,543"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"+20.1% from last month"})]})]}),o.jsxs(gn,{children:[o.jsxs(sa,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(la,{className:"text-sm font-medium",children:"Most Printed Category"}),o.jsx(Az,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(qn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"Dairy"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"450 labels generated"})]})]}),o.jsxs(gn,{children:[o.jsxs(sa,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(la,{className:"text-sm font-medium",children:"Top Product"}),o.jsx(yM,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(qn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"Whole Milk"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"182 labels generated"})]})]}),o.jsxs(gn,{children:[o.jsxs(sa,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(la,{className:"text-sm font-medium",children:"Avg. Daily Prints"}),o.jsx(m6,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(qn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"85"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"+12% from last week"})]})]})]}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[o.jsxs(gn,{className:"col-span-1",children:[o.jsxs(sa,{children:[o.jsx(la,{children:"Labels by Category"}),o.jsx(ap,{children:"Distribution of printed labels across product categories."})]}),o.jsx(qn,{className:"h-[300px]",children:o.jsx(gp,{width:"100%",height:"100%",children:o.jsxs(gie,{data:ape,children:[o.jsx(rm,{strokeDasharray:"3 3",vertical:!1}),o.jsx(Ko,{dataKey:"name",fontSize:12,tickLine:!1,axisLine:!1}),o.jsx(Xo,{fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:n=>`${n}`}),o.jsx(vn,{}),o.jsx(ls,{dataKey:"count",fill:"#facc15",radius:[4,4,0,0]})]})})})]}),o.jsxs(gn,{className:"col-span-1",children:[o.jsxs(sa,{children:[o.jsx(la,{children:"Print Volume Trends"}),o.jsx(ap,{children:"Daily label printing volume for the last 7 days."})]}),o.jsx(qn,{className:"h-[300px]",children:o.jsx(gp,{width:"100%",height:"100%",children:o.jsxs(P4,{data:ipe,children:[o.jsx(rm,{strokeDasharray:"3 3",vertical:!1}),o.jsx(Ko,{dataKey:"date",fontSize:12,tickLine:!1,axisLine:!1}),o.jsx(Xo,{fontSize:12,tickLine:!1,axisLine:!1}),o.jsx(vn,{}),o.jsx(Yl,{type:"monotone",dataKey:"count",stroke:"#dc2626",strokeWidth:2,dot:{r:4},activeDot:{r:6}})]})})})]})]}),o.jsxs(gn,{children:[o.jsx(sa,{children:o.jsx(la,{children:"Most Used Products"})}),o.jsx(qn,{children:o.jsxs(Rr,{children:[o.jsx(Ir,{children:o.jsxs(Le,{children:[o.jsx(ye,{children:"Product Name"}),o.jsx(ye,{children:"Category"}),o.jsx(ye,{className:"text-right",children:"Total Printed"}),o.jsx(ye,{className:"text-right",children:"Usage %"})]})}),o.jsxs(Mr,{children:[o.jsxs(Le,{children:[o.jsx(fe,{className:"font-medium",children:"Whole Milk"}),o.jsx(fe,{children:"Dairy"}),o.jsx(fe,{className:"text-right",children:"182"}),o.jsx(fe,{className:"text-right",children:"7.2%"})]}),o.jsxs(Le,{children:[o.jsx(fe,{className:"font-medium",children:"Ground Beef 80/20"}),o.jsx(fe,{children:"Meat"}),o.jsx(fe,{className:"text-right",children:"145"}),o.jsx(fe,{className:"text-right",children:"5.7%"})]}),o.jsxs(Le,{children:[o.jsx(fe,{className:"font-medium",children:"Chicken Breast"}),o.jsx(fe,{children:"Meat"}),o.jsx(fe,{className:"text-right",children:"132"}),o.jsx(fe,{className:"text-right",children:"5.2%"})]}),o.jsxs(Le,{children:[o.jsx(fe,{className:"font-medium",children:"Sliced Ham"}),o.jsx(fe,{children:"Deli"}),o.jsx(fe,{className:"text-right",children:"98"}),o.jsx(fe,{className:"text-right",children:"3.8%"})]})]})]})})]})]})]})]})}var spe=Symbol("radix.slottable");function lpe(e){const t=({children:r})=>o.jsx(o.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=spe,t}var[Dg]=wi("Tooltip",[Zl]),Lg=Zl(),AB="TooltipProvider",cpe=700,qS="tooltip.open",[upe,PN]=Dg(AB),TB=e=>{const{__scopeTooltip:t,delayDuration:r=cpe,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:i}=e,s=b.useRef(!0),u=b.useRef(!1),d=b.useRef(0);return b.useEffect(()=>{const c=d.current;return()=>window.clearTimeout(c)},[]),o.jsx(upe,{scope:t,isOpenDelayedRef:s,delayDuration:r,onOpen:b.useCallback(()=>{window.clearTimeout(d.current),s.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>s.current=!0,n)},[n]),isPointerInTransitRef:u,onPointerInTransitChange:b.useCallback(c=>{u.current=c},[]),disableHoverableContent:a,children:i})};TB.displayName=AB;var Zu="Tooltip",[dpe,kd]=Dg(Zu),kB=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:a,onOpenChange:i,disableHoverableContent:s,delayDuration:u}=e,d=PN(Zu,e.__scopeTooltip),c=Lg(t),[h,p]=b.useState(null),m=en(),v=b.useRef(0),x=s??d.disableHoverableContent,y=u??d.delayDuration,w=b.useRef(!1),[j,_]=Jo({prop:n,defaultProp:a??!1,onChange:T=>{T?(d.onOpen(),document.dispatchEvent(new CustomEvent(qS))):d.onClose(),i?.(T)},caller:Zu}),C=b.useMemo(()=>j?w.current?"delayed-open":"instant-open":"closed",[j]),A=b.useCallback(()=>{window.clearTimeout(v.current),v.current=0,w.current=!1,_(!0)},[_]),E=b.useCallback(()=>{window.clearTimeout(v.current),v.current=0,_(!1)},[_]),O=b.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{w.current=!0,_(!0),v.current=0},y)},[y,_]);return b.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),o.jsx(pN,{...c,children:o.jsx(dpe,{scope:t,contentId:m,open:j,stateAttribute:C,trigger:h,onTriggerChange:p,onTriggerEnter:b.useCallback(()=>{d.isOpenDelayedRef.current?O():A()},[d.isOpenDelayedRef,O,A]),onTriggerLeave:b.useCallback(()=>{x?E():(window.clearTimeout(v.current),v.current=0)},[E,x]),onOpen:A,onClose:E,disableHoverableContent:x,children:r})})};kB.displayName=Zu;var US="TooltipTrigger",RB=b.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=kd(US,r),i=PN(US,r),s=Lg(r),u=b.useRef(null),d=st(t,u,a.onTriggerChange),c=b.useRef(!1),h=b.useRef(!1),p=b.useCallback(()=>c.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),o.jsx(lg,{asChild:!0,...s,children:o.jsx(Je.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:d,onPointerMove:Ze(e.onPointerMove,m=>{m.pointerType!=="touch"&&!h.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),h.current=!0)}),onPointerLeave:Ze(e.onPointerLeave,()=>{a.onTriggerLeave(),h.current=!1}),onPointerDown:Ze(e.onPointerDown,()=>{a.open&&a.onClose(),c.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Ze(e.onFocus,()=>{c.current||a.onOpen()}),onBlur:Ze(e.onBlur,a.onClose),onClick:Ze(e.onClick,a.onClose)})})});RB.displayName=US;var AN="TooltipPortal",[fpe,hpe]=Dg(AN,{forceMount:void 0}),IB=e=>{const{__scopeTooltip:t,forceMount:r,children:n,container:a}=e,i=kd(AN,t);return o.jsx(fpe,{scope:t,forceMount:r,children:o.jsx(_n,{present:r||i.open,children:o.jsx(fd,{asChild:!0,container:a,children:n})})})};IB.displayName=AN;var $l="TooltipContent",MB=b.forwardRef((e,t)=>{const r=hpe($l,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...i}=e,s=kd($l,e.__scopeTooltip);return o.jsx(_n,{present:n||s.open,children:s.disableHoverableContent?o.jsx(DB,{side:a,...i,ref:t}):o.jsx(ppe,{side:a,...i,ref:t})})}),ppe=b.forwardRef((e,t)=>{const r=kd($l,e.__scopeTooltip),n=PN($l,e.__scopeTooltip),a=b.useRef(null),i=st(t,a),[s,u]=b.useState(null),{trigger:d,onClose:c}=r,h=a.current,{onPointerInTransitChange:p}=n,m=b.useCallback(()=>{u(null),p(!1)},[p]),v=b.useCallback((x,y)=>{const w=x.currentTarget,j={x:x.clientX,y:x.clientY},_=ype(j,w.getBoundingClientRect()),C=xpe(j,_),A=bpe(y.getBoundingClientRect()),E=Spe([...C,...A]);u(E),p(!0)},[p]);return b.useEffect(()=>()=>m(),[m]),b.useEffect(()=>{if(d&&h){const x=w=>v(w,h),y=w=>v(w,d);return d.addEventListener("pointerleave",x),h.addEventListener("pointerleave",y),()=>{d.removeEventListener("pointerleave",x),h.removeEventListener("pointerleave",y)}}},[d,h,v,m]),b.useEffect(()=>{if(s){const x=y=>{const w=y.target,j={x:y.clientX,y:y.clientY},_=d?.contains(w)||h?.contains(w),C=!wpe(j,s);_?m():C&&(m(),c())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[d,h,s,c,m]),o.jsx(DB,{...e,ref:i})}),[mpe,gpe]=Dg(Zu,{isInside:!1}),vpe=lpe("TooltipContent"),DB=b.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:s,...u}=e,d=kd($l,r),c=Lg(r),{onClose:h}=d;return b.useEffect(()=>(document.addEventListener(qS,h),()=>document.removeEventListener(qS,h)),[h]),b.useEffect(()=>{if(d.trigger){const p=m=>{m.target?.contains(d.trigger)&&h()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,h]),o.jsx(ud,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:p=>p.preventDefault(),onDismiss:h,children:o.jsxs(mN,{"data-state":d.stateAttribute,...c,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(vpe,{children:n}),o.jsx(mpe,{scope:r,isInside:!0,children:o.jsx(wse,{id:d.contentId,role:"tooltip",children:a||n})})]})})});MB.displayName=$l;var LB="TooltipArrow",$B=b.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=Lg(r);return gpe(LB,r).isInside?null:o.jsx(gN,{...a,...n,ref:t})});$B.displayName=LB;function ype(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(r,n,a,i)){case i:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function xpe(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function bpe(e){const{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function wpe(e,t){const{x:r,y:n}=e;let a=!1;for(let i=0,s=t.length-1;in!=m>n&&r<(p-c)*(n-h)/(m-h)+c&&(a=!a)}return a}function Spe(e){const t=e.slice();return t.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),jpe(t)}function jpe(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(a.y-s.y)>=(i.y-s.y)*(a.x-s.x))t.pop();else break}t.push(a)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const a=e[n];for(;r.length>=2;){const i=r[r.length-1],s=r[r.length-2];if((i.x-s.x)*(a.y-s.y)>=(i.y-s.y)*(a.x-s.x))r.pop();else break}r.push(a)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var Npe=TB,_pe=kB,Cpe=RB,Epe=IB,Ope=MB,Ppe=$B;function Ape({delayDuration:e=0,...t}){return o.jsx(Npe,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function J1({...e}){return o.jsx(Ape,{children:o.jsx(_pe,{"data-slot":"tooltip",...e})})}function Q1({...e}){return o.jsx(Cpe,{"data-slot":"tooltip-trigger",...e})}function Z1({className:e,sideOffset:t=0,children:r,...n}){return o.jsx(Epe,{children:o.jsxs(Ope,{"data-slot":"tooltip-content",sideOffset:t,className:Ee("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...n,children:[r,o.jsx(Ppe,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function ia(e){const t=(e??"").trim();return t||"N/A"}function Tpe(e,t){return e==null||t===null||t===void 0||!Number.isFinite(e)||!Number.isFinite(t)?"N/A":`${e}, ${t}`}function BB(e){const t=[];e.locationCode.trim()||t.push("Location ID"),e.locationName.trim()||t.push("Location Name"),(e.street??"").trim()||t.push("Street"),(e.city??"").trim()||t.push("City"),(e.stateCode??"").trim()||t.push("State"),(e.country??"").trim()||t.push("Country"),(e.zipCode??"").trim()||t.push("Zip Code"),(e.phone??"").trim()||t.push("Phone Number"),(e.email??"").trim()||t.push("Email");const r=e.latitude,n=e.longitude;return(r==null||!Number.isFinite(r))&&t.push("Latitude"),(n==null||!Number.isFinite(n))&&t.push("Longitude"),t}function kpe(){const[e,t]=b.useState(!1),[r,n]=b.useState(!1),[a,i]=b.useState(!1),[s,u]=b.useState(null),[d,c]=b.useState(null),[h,p]=b.useState([]),[m,v]=b.useState(!1),[x,y]=b.useState(0),[w,j]=b.useState(0),[_,C]=b.useState(null),[A,E]=b.useState(""),[O,T]=b.useState("all"),[k,M]=b.useState("all"),[$,z]=b.useState("all"),[F,V]=b.useState(1),[G,U]=b.useState(10),H=b.useRef(null),W=b.useRef(null),[B,Q]=b.useState("");b.useEffect(()=>(W.current&&window.clearTimeout(W.current),W.current=window.setTimeout(()=>Q(A.trim()),300),()=>{W.current&&window.clearTimeout(W.current)}),[A]);const R=b.useMemo(()=>{const K=new Set;for(const Z of h){const ne=(Z.partner??"").trim();ne&&K.add(ne)}return["all",...Array.from(K).sort((Z,ne)=>Z.localeCompare(ne))]},[h]),L=b.useMemo(()=>{const K=new Set;for(const Z of h){const ne=(Z.groupName??"").trim();ne&&K.add(ne)}return["all",...Array.from(K).sort((Z,ne)=>Z.localeCompare(ne))]},[h]),I=b.useMemo(()=>{const K=new Set;for(const Z of h){const ne=(Z.locationCode??"").trim();ne&&K.add(ne)}return["all",...Array.from(K).sort((Z,ne)=>Z.localeCompare(ne))]},[h]),X=Math.max(1,Math.ceil(x/G));b.useEffect(()=>{V(1)},[B,O,k,$,G]),b.useEffect(()=>((async()=>{H.current?.abort();const Z=new AbortController;H.current=Z,v(!0);try{const ne=Fa(F),ge=await rc({skipCount:ne,maxResultCount:G,keyword:($!=="all"?$:B)||void 0,partner:O!=="all"?O:void 0,groupName:k!=="all"?k:void 0},Z.signal);p(ge.items??[]),y(ge.totalCount??0)}catch(ne){if(ne?.name==="AbortError")return;pe.error("Failed to load locations.",{description:ne?.message?String(ne.message):"Please try again."}),p([]),y(0)}finally{v(!1)}})(),()=>H.current?.abort()),[B,O,k,$,F,G,w]);const ee=()=>j(K=>K+1),ie=K=>{C(null),u(K),n(!0)},re=K=>{C(null),c(K),i(!0)};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"pb-4",children:o.jsx("div",{className:"flex flex-col gap-4",children:o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ve,{placeholder:"Search",value:A,onChange:K=>E(K.target.value),style:{height:40,boxSizing:"border-box"},className:"border border-gray-300 rounded-md w-40 shrink-0 bg-white placeholder:text-gray-500"}),o.jsxs(Ve,{value:O,onValueChange:T,children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Partner"})}),o.jsx(Ge,{children:R.map(K=>o.jsx(Ne,{value:K,children:K==="all"?"Partner (All)":K},K))})]}),o.jsxs(Ve,{value:k,onValueChange:M,children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Group"})}),o.jsx(Ge,{children:L.map(K=>o.jsx(Ne,{value:K,children:K==="all"?"Group (All)":K},K))})]}),o.jsxs(Ve,{value:$,onValueChange:z,children:[o.jsx(We,{className:"w-[140px] h-10 rounded-md border border-gray-300 bg-white font-medium text-gray-900 shrink-0",style:{height:40,boxSizing:"border-box"},children:o.jsx(He,{placeholder:"Location"})}),o.jsx(Ge,{children:I.map(K=>o.jsx(Ne,{value:K,children:K==="all"?"All Locations":K},K))})]}),o.jsx("div",{className:"flex-1"}),o.jsxs(J1,{children:[o.jsx(Q1,{asChild:!0,children:o.jsx("span",{children:o.jsx(he,{disabled:!0,variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 px-4 bg-white hover:bg-gray-50 shrink-0",children:"Bulk Import"})})}),o.jsx(Z1,{children:"Not supported yet"})]}),o.jsxs(J1,{children:[o.jsx(Q1,{asChild:!0,children:o.jsx("span",{children:o.jsx(he,{disabled:!0,variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 px-4 bg-white hover:bg-gray-50 shrink-0",children:"Bulk Export"})})}),o.jsx(Z1,{children:"Not supported yet"})]}),o.jsxs(J1,{children:[o.jsx(Q1,{asChild:!0,children:o.jsx("span",{children:o.jsx(he,{disabled:!0,variant:"outline",className:"h-10 border border-gray-300 rounded-md text-gray-900 px-4 bg-white hover:bg-gray-50 shrink-0",children:"Bulk Edit"})})}),o.jsx(Z1,{children:"Not supported yet"})]}),o.jsx(he,{className:"h-10 bg-blue-600 hover:bg-blue-700 text-white rounded-md px-6 font-medium shrink-0",onClick:()=>t(!0),children:"New"})]})})}),o.jsx("div",{className:"flex-1 overflow-auto pt-6",children:o.jsx("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden",children:o.jsxs(Rr,{children:[o.jsx(Ir,{children:o.jsxs(Le,{className:"bg-gray-100 hover:bg-gray-100",children:[o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Partner"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Group"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Location ID"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Location Name"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Street"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"City"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"State"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Country"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Zip Code"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Phone"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Email"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"GPS"}),o.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Active"}),o.jsx(ye,{className:"text-gray-900 font-bold text-center",children:"Actions"})]})}),o.jsx(Mr,{children:m?o.jsx(Le,{children:o.jsx(fe,{colSpan:14,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):h.length===0?o.jsx(Le,{children:o.jsx(fe,{colSpan:14,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):h.map(K=>o.jsxs(Le,{children:[o.jsx(fe,{className:"border-r text-gray-600 max-w-[140px] truncate",children:ia(K.partner)}),o.jsx(fe,{className:"border-r text-gray-600 max-w-[140px] truncate",children:ia(K.groupName)}),o.jsx(fe,{className:"border-r font-numeric text-gray-600",children:ia(K.locationCode??K.id)}),o.jsx(fe,{className:"border-r font-medium text-black",children:ia(K.locationName)}),o.jsx(fe,{className:"border-r text-gray-600 max-w-[140px] truncate",children:ia(K.street)}),o.jsx(fe,{className:"border-r text-gray-600",children:ia(K.city)}),o.jsx(fe,{className:"border-r text-gray-600",children:ia(K.stateCode)}),o.jsx(fe,{className:"border-r text-gray-600",children:ia(K.country)}),o.jsx(fe,{className:"border-r text-gray-600 font-numeric",children:ia(K.zipCode)}),o.jsx(fe,{className:"border-r text-gray-600 whitespace-nowrap",children:ia(K.phone)}),o.jsx(fe,{className:"border-r text-gray-600 text-sm max-w-[180px] truncate",children:ia(K.email)}),o.jsx(fe,{className:"border-r text-gray-500 font-numeric text-xs",children:Tpe(K.latitude,K.longitude)}),o.jsx(fe,{className:"border-r",children:o.jsx(kr,{className:K.state?"bg-green-600":"bg-gray-400",children:K.state?"Yes":"No"})}),o.jsx(fe,{className:"text-center",children:o.jsxs(ga,{open:_===K.id,onOpenChange:Z=>C(Z?K.id:null),children:[o.jsx(va,{asChild:!0,children:o.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:o.jsx(di,{className:"h-4 w-4 text-gray-500"})})}),o.jsxs(ya,{align:"end",className:"w-40 p-1",children:[o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>ie(K),children:[o.jsx(wn,{className:"w-4 h-4"}),"Edit"]}),o.jsxs(he,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>re(K),children:[o.jsx(Ot,{className:"w-4 h-4 shrink-0"}),"Delete"]})]})]})})]},K.id))})]})})}),o.jsx("div",{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[o.jsxs("div",{children:["Showing ",x===0?0:(F-1)*G+1,"-",Math.min(F*G,x)," of ",x]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(Ve,{value:String(G),onValueChange:K=>U(Number(K)),children:[o.jsx(We,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:o.jsx(He,{})}),o.jsx(Ge,{children:[10,20,50].map(K=>o.jsxs(Ne,{value:String(K),children:[K," / page"]},K))})]}),o.jsx(vi,{className:"mx-0 w-auto justify-end",children:o.jsxs(yi,{children:[o.jsx(Ct,{children:o.jsx(xi,{href:"#",size:"default",onClick:K=>{K.preventDefault(),V(Z=>Math.max(1,Z-1))},"aria-disabled":F<=1,className:F<=1?"pointer-events-none opacity-50":""})}),o.jsx(Ct,{children:o.jsxs(xa,{href:"#",isActive:!0,size:"default",onClick:K=>K.preventDefault(),children:["Page ",F," / ",X]})}),o.jsx(Ct,{children:o.jsx(bi,{href:"#",size:"default",onClick:K=>{K.preventDefault(),V(Z=>Math.min(X,Z+1))},"aria-disabled":F>=X,className:F>=X?"pointer-events-none opacity-50":""})})]})})]})]})}),o.jsx(Rpe,{open:e,onOpenChange:t,onCreated:()=>{V(1),ee()}}),o.jsx(Mpe,{open:r,location:s,onOpenChange:K=>{n(K),K||u(null)},onUpdated:()=>{ee()}}),o.jsx(Dpe,{open:a,location:d,onOpenChange:K=>{i(K),K||c(null)},onDeleted:()=>{ee()}})]})}function Rpe({open:e,onOpenChange:t,onCreated:r}){const[n,a]=b.useState(!1),[i,s]=b.useState({partner:"",groupName:"",locationCode:"",locationName:"",street:"",city:"",stateCode:"",country:"",zipCode:"",phone:"",email:"",latitude:null,longitude:null,state:!0}),u=()=>{s({partner:"",groupName:"",locationCode:"",locationName:"",street:"",city:"",stateCode:"",country:"",zipCode:"",phone:"",email:"",latitude:null,longitude:null,state:!0})};b.useEffect(()=>{e||(u(),a(!1))},[e]);const d=async()=>{const c=BB(i);if(c.length){pe.error("Please fill in required fields.",{description:`Missing: ${c.join(", ")}.`});return}a(!0);try{await jue({...i,locationCode:i.locationCode.trim(),locationName:i.locationName.trim(),partner:i.partner?.trim()?i.partner.trim():null,groupName:i.groupName?.trim()?i.groupName.trim():null,street:(i.street??"").trim(),city:(i.city??"").trim(),stateCode:(i.stateCode??"").trim(),country:(i.country??"").trim(),zipCode:(i.zipCode??"").trim(),phone:(i.phone??"").trim(),email:(i.email??"").trim(),latitude:i.latitude,longitude:i.longitude}),pe.success("Location created.",{description:"The location has been added successfully."}),t(!1),r()}catch(h){pe.error("Failed to create location.",{description:h?.message?String(h.message):"Please try again."})}finally{a(!1)}};return o.jsx(vt,{open:e,onOpenChange:t,children:o.jsxs(pt,{className:"sm:max-w-[600px]",children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Add New Location"}),o.jsx(Pt,{children:"Enter the details for the new store location."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Partner"}),o.jsx(ve,{placeholder:"e.g. Global Foods Inc.",value:i.partner??"",onChange:c=>s(h=>({...h,partner:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Group"}),o.jsx(ve,{placeholder:"e.g. East Coast Region",value:i.groupName??"",onChange:c=>s(h=>({...h,groupName:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[o.jsxs("div",{className:"space-y-2 col-span-1",children:[o.jsx(ue,{children:"Location ID *"}),o.jsx(ve,{placeholder:"e.g. 12345",value:i.locationCode,onChange:c=>s(h=>({...h,locationCode:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2 col-span-2",children:[o.jsx(ue,{children:"Location Name *"}),o.jsx(ve,{placeholder:"e.g. Downtown Store",value:i.locationName,onChange:c=>s(h=>({...h,locationName:c.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Street *"}),o.jsx(ve,{placeholder:"e.g. 123 Main St",value:i.street??"",onChange:c=>s(h=>({...h,street:c.target.value}))})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"City *"}),o.jsx(ve,{placeholder:"e.g. New York",value:i.city??"",onChange:c=>s(h=>({...h,city:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"State *"}),o.jsx(ve,{placeholder:"e.g. NY",value:i.stateCode??"",onChange:c=>s(h=>({...h,stateCode:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Country *"}),o.jsx(ve,{placeholder:"e.g. USA",value:i.country??"",onChange:c=>s(h=>({...h,country:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Zip Code *"}),o.jsx(ve,{placeholder:"e.g. 10001",value:i.zipCode??"",onChange:c=>s(h=>({...h,zipCode:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Phone Number *"}),o.jsx(ve,{placeholder:"+1 (555) 000-0000",value:i.phone??"",onChange:c=>s(h=>({...h,phone:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Email *"}),o.jsx(ve,{placeholder:"store@example.com",value:i.email??"",onChange:c=>s(h=>({...h,email:c.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(ue,{className:"flex items-center gap-2",children:[o.jsx(Bl,{className:"w-4 h-4"})," GPS Coordinates *"]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ve,{placeholder:"Latitude (e.g. 40.7128)",value:i.latitude===null||i.latitude===void 0?"":String(i.latitude),onChange:c=>{const h=c.target.value.trim();s(p=>({...p,latitude:h?Number(h):null}))}}),o.jsx(ve,{placeholder:"Longitude (e.g. -74.0060)",value:i.longitude===null||i.longitude===void 0?"":String(i.longitude),onChange:c=>{const h=c.target.value.trim();s(p=>({...p,longitude:h?Number(h):null}))}})]})]}),o.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[o.jsx(Gt,{id:"loc-status",checked:!!i.state,onCheckedChange:c=>s(h=>({...h,state:c}))}),o.jsx(ue,{htmlFor:"loc-status",children:"Active Location"})]})]}),o.jsxs(wt,{children:[o.jsx(he,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(he,{disabled:n,onClick:d,className:"bg-blue-600 text-white hover:bg-blue-700",children:n?"Creating...":"Create Location"})]})]})})}function Ipe(e){return{partner:e.partner??"",groupName:e.groupName??"",locationCode:e.locationCode??"",locationName:e.locationName??"",street:e.street??"",city:e.city??"",stateCode:e.stateCode??"",country:e.country??"",zipCode:e.zipCode??"",phone:e.phone??"",email:e.email??"",latitude:e.latitude??null,longitude:e.longitude??null,state:!!e.state}}function Mpe({open:e,location:t,onOpenChange:r,onUpdated:n}){const[a,i]=b.useState(!1),[s,u]=b.useState({partner:"",groupName:"",locationCode:"",locationName:"",street:"",city:"",stateCode:"",country:"",zipCode:"",phone:"",email:"",latitude:null,longitude:null,state:!0});b.useEffect(()=>{e&&t&&(u(Ipe(t)),i(!1)),e||i(!1)},[e,t]);const d=async()=>{if(!t?.id)return;const c=BB(s);if(c.length){pe.error("Please fill in required fields.",{description:`Missing: ${c.join(", ")}.`});return}i(!0);try{await Nue(t.id,{...s,locationCode:s.locationCode.trim(),locationName:s.locationName.trim(),partner:s.partner?.trim()?s.partner.trim():null,groupName:s.groupName?.trim()?s.groupName.trim():null,street:(s.street??"").trim(),city:(s.city??"").trim(),stateCode:(s.stateCode??"").trim(),country:(s.country??"").trim(),zipCode:(s.zipCode??"").trim(),phone:(s.phone??"").trim(),email:(s.email??"").trim(),latitude:s.latitude,longitude:s.longitude}),pe.success("Location updated.",{description:"The changes have been saved successfully."}),r(!1),n()}catch(h){pe.error("Failed to update location.",{description:h?.message?String(h.message):"Please try again."})}finally{i(!1)}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-[600px]",children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Edit Location"}),o.jsx(Pt,{children:"Update the details for this store location."})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Partner"}),o.jsx(ve,{placeholder:"e.g. Global Foods Inc.",value:s.partner??"",onChange:c=>u(h=>({...h,partner:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Group"}),o.jsx(ve,{placeholder:"e.g. East Coast Region",value:s.groupName??"",onChange:c=>u(h=>({...h,groupName:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[o.jsxs("div",{className:"space-y-2 col-span-1",children:[o.jsx(ue,{children:"Location ID *"}),o.jsx(ve,{placeholder:"e.g. 12345",value:s.locationCode,onChange:c=>u(h=>({...h,locationCode:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2 col-span-2",children:[o.jsx(ue,{children:"Location Name *"}),o.jsx(ve,{placeholder:"e.g. Downtown Store",value:s.locationName,onChange:c=>u(h=>({...h,locationName:c.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Street *"}),o.jsx(ve,{placeholder:"e.g. 123 Main St",value:s.street??"",onChange:c=>u(h=>({...h,street:c.target.value}))})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"City *"}),o.jsx(ve,{placeholder:"e.g. New York",value:s.city??"",onChange:c=>u(h=>({...h,city:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"State *"}),o.jsx(ve,{placeholder:"e.g. NY",value:s.stateCode??"",onChange:c=>u(h=>({...h,stateCode:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Country *"}),o.jsx(ve,{placeholder:"e.g. USA",value:s.country??"",onChange:c=>u(h=>({...h,country:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Zip Code *"}),o.jsx(ve,{placeholder:"e.g. 10001",value:s.zipCode??"",onChange:c=>u(h=>({...h,zipCode:c.target.value}))})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Phone Number *"}),o.jsx(ve,{placeholder:"+1 (555) 000-0000",value:s.phone??"",onChange:c=>u(h=>({...h,phone:c.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Email *"}),o.jsx(ve,{placeholder:"store@example.com",value:s.email??"",onChange:c=>u(h=>({...h,email:c.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(ue,{className:"flex items-center gap-2",children:[o.jsx(Bl,{className:"w-4 h-4"})," GPS Coordinates *"]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(ve,{placeholder:"Latitude (e.g. 40.7128)",value:s.latitude===null||s.latitude===void 0?"":String(s.latitude),onChange:c=>{const h=c.target.value.trim();u(p=>({...p,latitude:h?Number(h):null}))}}),o.jsx(ve,{placeholder:"Longitude (e.g. -74.0060)",value:s.longitude===null||s.longitude===void 0?"":String(s.longitude),onChange:c=>{const h=c.target.value.trim();u(p=>({...p,longitude:h?Number(h):null}))}})]})]}),o.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[o.jsx(Gt,{id:"loc-status-edit",checked:!!s.state,onCheckedChange:c=>u(h=>({...h,state:c}))}),o.jsx(ue,{htmlFor:"loc-status-edit",children:"Active Location"})]})]}),o.jsxs(wt,{children:[o.jsx(he,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(he,{disabled:a,onClick:d,className:"bg-blue-600 text-white hover:bg-blue-700",children:a?"Saving...":"Save Changes"})]})]})})}function Dpe({open:e,location:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>{const d=(t?.locationCode??"").trim(),c=(t?.locationName??"").trim();return d&&c?`${d} - ${c}`:d||c||"this location"},[t?.locationCode,t?.locationName]),u=async()=>{if(t?.id){i(!0);try{await _ue(t.id),pe.success("Location deleted.",{description:"The location has been removed successfully."}),r(!1),n()}catch(d){pe.error("Failed to delete location.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Delete Location"}),o.jsx(Pt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(wt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Ot,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}function Lpe({className:e,...t}){return o.jsx("textarea",{"data-slot":"textarea",className:Ee("resize-none border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-input-background px-3 py-2 text-base transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}const fM={Settings:Qh,LayoutDashboard:NM,Tag:Zh,MapPin:Bl,Users:WS,Package:hu,FileText:ol,HelpCircle:Jh,Layers:jM,Type:CM,FileBox:SM};function ew(e){const t=(e??"").trim();return t||"N/A"}function $pe(e){const t=e.trim();if(!t)return null;const r=Number.parseInt(t,10);return Number.isFinite(r)?r:null}function Bpe(){const[e,t]=b.useState([]),[r,n]=b.useState(!1),[a,i]=b.useState(0),[s,u]=b.useState(null),[d,c]=b.useState(""),h=b.useRef(null),[p,m]=b.useState(""),[v,x]=b.useState(!1),[y,w]=b.useState(!1),[j,_]=b.useState(!1),[C,A]=b.useState(null),[E,O]=b.useState(null),T=b.useRef(null);b.useEffect(()=>(h.current&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>m(d.trim()),300),()=>{h.current&&window.clearTimeout(h.current)}),[d]),b.useEffect(()=>((async()=>{T.current?.abort();const F=new AbortController;T.current=F,n(!0);try{const V=await NB({skipCount:1,maxResultCount:5e3,keyword:p||void 0},F.signal);t(V.items??[])}catch(V){if(V?.name==="AbortError")return;pe.error("Failed to load system menus.",{description:V?.message?String(V.message):"Please try again."}),t([])}finally{n(!1)}})(),()=>T.current?.abort()),[p,a]);const k=()=>i(z=>z+1),M=z=>{u(null),A(z),w(!0)},$=z=>{u(null),O(z),_(!0)};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"pb-4",children:o.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[o.jsx(ve,{placeholder:"Search",value:d,onChange:z=>c(z.target.value),style:{height:40,boxSizing:"border-box"},className:"border border-gray-300 rounded-md w-40 shrink-0 bg-white placeholder:text-gray-500"}),o.jsx("div",{className:"flex-1"}),o.jsxs(he,{className:"bg-blue-600 text-white hover:bg-blue-700",onClick:()=>x(!0),children:[o.jsx(tn,{className:"w-4 h-4 mr-2"}),"New Menu"]})]})}),o.jsx("div",{className:"flex-1 flex flex-col min-h-0 bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden",children:o.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:o.jsxs(Rr,{children:[o.jsx(Ir,{className:"bg-gray-50 sticky top-0 z-10",children:o.jsxs(Le,{className:"hover:bg-gray-50",children:[o.jsx(ye,{className:"font-semibold text-gray-900",children:"Menu Name"}),o.jsx(ye,{className:"font-semibold text-gray-900",children:"Route URL"}),o.jsx(ye,{className:"font-semibold text-gray-900",children:"Router Name"}),o.jsx(ye,{className:"font-semibold text-gray-900",children:"Type"}),o.jsx(ye,{className:"font-semibold text-gray-900",children:"Order"}),o.jsx(ye,{className:"font-semibold text-gray-900",children:"Visible"}),o.jsx(ye,{className:"font-semibold text-gray-900",children:"Enabled"}),o.jsx(ye,{className:"font-semibold text-gray-900 w-16 text-right",children:"Actions"})]})}),o.jsx(Mr,{children:e.length===0?o.jsx(Le,{children:o.jsx(fe,{colSpan:8,className:"text-center py-10 text-gray-500",children:r?"Loading...":"No data"})}):e.map(z=>o.jsxs(Le,{className:"hover:bg-gray-50",children:[o.jsx(fe,{className:"font-medium text-gray-900",children:ew(z.menuName)}),o.jsx(fe,{className:"text-gray-700",children:ew(z.routeUrl)}),o.jsx(fe,{className:"text-gray-700",children:ew(z.routerName)}),o.jsx(fe,{className:"text-gray-700",children:z.menuType??"N/A"}),o.jsx(fe,{className:"text-gray-700",children:z.orderNum??"N/A"}),o.jsx(fe,{className:"text-gray-700",children:z.isShow?"Yes":"No"}),o.jsx(fe,{className:"text-gray-700",children:z.state?"Yes":"No"}),o.jsx(fe,{className:"text-right",children:o.jsxs(ga,{open:s===z.id,onOpenChange:F=>u(F?z.id:null),children:[o.jsx(va,{asChild:!0,children:o.jsx(he,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:o.jsx(di,{className:"h-4 w-4"})})}),o.jsx(ya,{className:"w-44 p-2",align:"end",children:o.jsxs("div",{className:"flex flex-col",children:[o.jsxs(he,{variant:"ghost",className:"justify-start",onClick:()=>M(z),children:[o.jsx(wn,{className:"w-4 h-4 mr-2"}),"Edit"]}),o.jsxs(he,{variant:"ghost",className:"justify-start text-red-600 hover:text-red-700",onClick:()=>$(z),children:[o.jsx(Ot,{className:"w-4 h-4 mr-2"}),"Delete"]})]})})]})})]},z.id))})]})})}),o.jsx(hM,{mode:"create",open:v,menu:null,onOpenChange:x,onSaved:k}),o.jsx(hM,{mode:"edit",open:y,menu:C,onOpenChange:w,onSaved:k}),o.jsx(Fpe,{open:j,menu:E,onOpenChange:_,onDeleted:k})]})}function hM({mode:e,open:t,menu:r,onOpenChange:n,onSaved:a}){const i=e==="edit",[s,u]=b.useState(!1),[d,c]=b.useState(""),[h,p]=b.useState(""),[m,v]=b.useState(""),[x,y]=b.useState("menu"),[w,j]=b.useState(""),[_,C]=b.useState(""),[A,E]=b.useState([]),[O,T]=b.useState(!1),[k,M]=b.useState(""),[$,z]=b.useState(""),[F,V]=b.useState(""),[G,U]=b.useState(""),[H,W]=b.useState(""),[B,Q]=b.useState(""),[R,L]=b.useState(!1),[I,X]=b.useState(!0),[ee,ie]=b.useState(!0);b.useEffect(()=>{if(!t)return;u(!1),c(r?.menuName??""),p(r?.routerName??""),v(r?.routeUrl??""),y(r?.menuType===0?"directory":"menu"),j(r?.permissionCode??"");const Y=String(r?.parentId??"").trim();C(!Y||Y==="00000000-0000-0000-0000-000000000000"?"":Y),M(r?.menuIcon??""),z(r?.orderNum===null||r?.orderNum===void 0?"":String(r.orderNum)),V(r?.link??""),U(r?.component??""),W(r?.query??""),Q(r?.remark??""),L(!!r?.isCache),X(r?.isShow??!0),ie(r?.state??!0)},[t,r]);const re="__parent_root__";b.useEffect(()=>{if(!t)return;let Y=!1;return T(!0),Nhe().then(we=>{Y||E(we)}).catch(()=>{Y||E([])}).finally(()=>{Y||T(!1)}),()=>{Y=!0}},[t]);const K=Y=>!Y.trim()||Y==="00000000-0000-0000-0000-000000000000",Z=b.useMemo(()=>{const Y=A.filter(Ce=>Ce.id&&Ce.id!==r?.id),we=(_||"").trim();return we&&!K(we)&&!Y.some(Ce=>Ce.id===we)?[...Y,{id:we,menuName:`(Current parent) ${we}`}]:Y},[A,_,r?.id]),ne=K(_)?re:_,de=b.useMemo(()=>!!(d.trim()&&m.trim()&&$.trim()),[d,m,$]),ge=async()=>{if(!de){pe.error("Please fill in required fields.",{description:"Menu Name, Route URL, and Order are required."});return}u(!0);try{const Y={menuName:d.trim(),routerName:h.trim()?h.trim():null,routeUrl:m.trim(),menuType:x==="directory"?0:1,permissionCode:w.trim()?w.trim():null,parentId:K(_)?null:_.trim(),menuIcon:k||null,orderNum:$pe($),link:F.trim()?F.trim():null,component:G.trim()?G.trim():null,query:H.trim()?H.trim():null,remark:B.trim()?B.trim():null,isCache:R,isShow:I,state:ee};if(i){if(!r?.id)throw new Error("Missing id.");await Che(r.id,Y),pe.success("Menu updated.",{description:"Changes have been saved successfully."})}else await _he(Y),pe.success("Menu created.",{description:"A new menu has been created successfully."});n(!1),a()}catch(Y){pe.error(i?"Failed to update menu.":"Failed to create menu.",{description:Y?.message?String(Y.message):"Please try again."})}finally{u(!1)}};return o.jsx(vt,{open:t,onOpenChange:n,children:o.jsxs(pt,{className:"sm:max-w-none",style:{width:"70%"},children:[o.jsxs(yt,{children:[o.jsx(xt,{children:i?"Edit System Menu":"New System Menu"}),o.jsx(Pt,{children:i?"Update system menu fields and save changes.":"Fill out the form to create a new system menu."})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-6 py-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Menu Name *"}),o.jsx(ve,{value:d,onChange:Y=>c(Y.target.value),placeholder:"e.g. Location Manager"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Route URL *"}),o.jsx(ve,{value:m,onChange:Y=>v(Y.target.value),placeholder:"e.g. /location"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Router Name"}),o.jsx(ve,{value:h,onChange:Y=>p(Y.target.value),placeholder:"e.g. location"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Menu Type"}),o.jsxs(Ve,{value:x,onValueChange:Y=>y(Y),children:[o.jsx(We,{className:"h-10 rounded-md border border-gray-200 bg-white",children:o.jsx(He,{})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"directory",children:"Directory"}),o.jsx(Ne,{value:"menu",children:"Menu"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Permission Code"}),o.jsx(ve,{value:w,onChange:Y=>j(Y.target.value),placeholder:"e.g. sys:menu"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Parent"}),o.jsxs(Ve,{value:ne,disabled:O,onValueChange:Y=>C(Y===re?"":Y),children:[o.jsx(We,{className:"h-10 rounded-md border border-gray-200 bg-white",children:o.jsx(He,{placeholder:O?"Loading…":"Select parent directory"})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:re,children:"Root (no parent)"}),Z.map(Y=>o.jsx(Ne,{value:Y.id,children:Y.menuName?.trim()||Y.id},Y.id))]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Menu Icon"}),o.jsxs(Ve,{value:k||"none",onValueChange:Y=>M(Y==="none"?"":Y),children:[o.jsx(We,{className:"h-10 rounded-md border border-gray-200 bg-white",children:o.jsx(He,{placeholder:"Select an icon"})}),o.jsxs(Ge,{children:[o.jsx(Ne,{value:"none",children:"None"}),Object.keys(fM).map(Y=>{const we=fM[Y];return o.jsx(Ne,{value:Y,children:o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(we,{className:"h-4 w-4"}),Y]})},Y)})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Order *"}),o.jsx(ve,{value:$,onChange:Y=>z(Y.target.value),placeholder:"e.g. 10"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Link"}),o.jsx(ve,{value:F,onChange:Y=>V(Y.target.value),placeholder:"Optional"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Component"}),o.jsx(ve,{value:G,onChange:Y=>U(Y.target.value),placeholder:"Optional"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Query"}),o.jsx(ve,{value:H,onChange:Y=>W(Y.target.value),placeholder:"Optional"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{children:"Remark"}),o.jsx(Lpe,{value:B,onChange:Y=>Q(Y.target.value),placeholder:"Optional"})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Cache"}),o.jsx(Gt,{checked:R,onCheckedChange:L})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Visible"}),o.jsx(Gt,{checked:I,onCheckedChange:X})]}),o.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[o.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),o.jsx(Gt,{checked:ee,onCheckedChange:ie})]})]}),o.jsxs(wt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),o.jsx(he,{className:"min-w-24 bg-blue-600 text-white hover:bg-blue-700",disabled:s,onClick:ge,children:s?"Saving...":i?"Save Changes":"Create"})]})]})})}function Fpe({open:e,menu:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),s=b.useMemo(()=>{const d=(t?.menuName??"").trim(),c=(t?.routeUrl??"").trim();return d&&c?`${d} (${c})`:d||c||"this menu"},[t?.menuName,t?.routeUrl]),u=async()=>{if(t?.id){i(!0);try{await Ohe(t.id),pe.success("Menu deleted.",{description:"The menu has been removed successfully."}),r(!1),n()}catch(d){pe.error("Failed to delete menu.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return o.jsx(vt,{open:e,onOpenChange:r,children:o.jsxs(pt,{className:"sm:max-w-none",style:{width:"30%"},children:[o.jsxs(yt,{children:[o.jsx(xt,{children:"Delete System Menu"}),o.jsx(Pt,{children:"This action cannot be undone."})]}),o.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",o.jsx("span",{className:"font-medium",children:s}),"?"]}),o.jsxs(wt,{className:"flex-row flex-wrap justify-end",children:[o.jsx(he,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(he,{className:"min-w-24 gap-2",variant:"destructive",disabled:a,onClick:u,children:[o.jsx(Ot,{className:"h-4 w-4 shrink-0"}),a?"Deleting...":"Delete"]})]})]})})}function zpe(){const[e,t]=b.useState("Dashboard"),r=()=>{switch(e){case"Dashboard":return o.jsx(bie,{});case"Training":return o.jsx(nhe,{});case"Alerts":return o.jsx(ohe,{});case"Menu Management":return o.jsx(ghe,{});case"System Menu":return o.jsx(Bpe,{});case"Account Management":return o.jsx(Xhe,{});case"Reports":return o.jsx(ope,{});case"Location Manager":return o.jsx(kpe,{});case"Labels":case"Label Categories":case"Label Types":case"Label Templates":case"Multiple Options":return o.jsx(rhe,{currentView:e,onViewChange:t});default:return o.jsx(wie,{title:e})}};return o.jsxs(o.Fragment,{children:[o.jsx(RU,{currentView:e,setCurrentView:t,children:r()}),o.jsx(pz,{position:"top-center",richColors:!0,closeButton:!0,expand:!1})]})}z8.createRoot(document.getElementById("root")).render(o.jsx(zpe,{})); diff --git a/美国版/Food Labeling Management Platform/build/index.html b/美国版/Food Labeling Management Platform/build/index.html index 2497629..b2b28a7 100644 --- a/美国版/Food Labeling Management Platform/build/index.html +++ b/美国版/Food Labeling Management Platform/build/index.html @@ -5,7 +5,7 @@ Food Labeling Management Platform - + diff --git a/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateDataEntryView.tsx b/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateDataEntryView.tsx index 562bfd8..8654ea4 100644 --- a/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateDataEntryView.tsx +++ b/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateDataEntryView.tsx @@ -20,6 +20,7 @@ import { skipCountForPage } from '../../lib/paginationQuery'; import type { LabelElement, LabelTemplateDto, LabelType, Unit } from '../../types/labelTemplate'; import { appliedLocationToEditor, + canonicalElementType, dataEntryColumnLabel, isDataEntryTableColumnElement, labelElementsToApiPayload, @@ -49,7 +50,8 @@ const DATA_ENTRY_IMAGE_BOX = 'h-[100px] w-[100px] min-h-[100px] min-w-[100px] max-h-[100px] max-w-[100px] shrink-0 aspect-auto'; function dataEntryUsesImageUpload(element: LabelElement): boolean { - if (element.type === 'IMAGE' || element.type === 'QRCODE') return true; + const type = canonicalElementType(element.type); + if (type === 'IMAGE' || type === 'QRCODE') return true; const n = (element.elementName ?? '').trim().toLowerCase(); return n.includes('qrcode'); } @@ -88,9 +90,12 @@ function DataEntryValueCell({ export function LabelTemplateDataEntryView({ templateCode, onBack, + contextHint, }: { templateCode: string; onBack: () => void; + /** 从 Labels 进入时展示:当前编辑的是哪条标签绑定的模板 */ + contextHint?: string; }) { const [loading, setLoading] = useState(true); const [saving, setSaving] = useState(false); @@ -140,7 +145,8 @@ export function LabelTemplateDataEntryView({ setTemplateTitle(title); const elements = sortTemplateElementsForDisplay( (tpl.elements ?? []) as LabelElement[], - ).filter(isDataEntryTableColumnElement); + ) + .filter(isDataEntryTableColumnElement); setPrintFields(elements); setProducts(prodRes.items ?? []); setTypes(typeRes.items ?? []); @@ -311,6 +317,11 @@ export function LabelTemplateDataEntryView({

{templateTitle}

+ {contextHint ? ( +

+ {contextHint} +

+ ) : null}