diff --git a/label-template-template-1773988794039 (1).json b/label-template-template-1773988794039 (1).json deleted file mode 100644 index bbbacba..0000000 --- a/label-template-template-1773988794039 (1).json +++ /dev/null @@ -1,218 +0,0 @@ -{ - "id": "template-1773988794039", - "name": "未命名模板", - "labelType": "PRICE", - "unit": "inch", - "width": 4, - "height": 6, - "appliedLocation": "ALL", - "showRuler": true, - "showGrid": true, - "elements": [ - { - "id": "el-1773989351080-vqc03nr", - "type": "IMAGE", - "x": 32, - "y": 24, - "width": 60, - "height": 60, - "rotation": "horizontal", - "border": "none", - "config": { - "src": "", - "scaleMode": "contain" - } - }, - { - "id": "el-1773989452538-0ejrxoe", - "type": "TEXT_STATIC", - "x": 32, - "y": 104, - "width": 120, - "height": 24, - "rotation": "horizontal", - "border": "none", - "config": { - "text": "文本", - "fontFamily": "Arial", - "fontSize": 14, - "fontWeight": "normal", - "textAlign": "left" - } - }, - { - "id": "el-1773989466493-ibbroio", - "type": "QRCODE", - "x": 32, - "y": 136, - "width": 80, - "height": 80, - "rotation": "horizontal", - "border": "none", - "config": { - "data": "https://example.com", - "errorLevel": "M" - } - }, - { - "id": "el-1773989469008-f1l39qj", - "type": "BARCODE", - "x": 0, - "y": 224, - "width": 160, - "height": 48, - "rotation": "horizontal", - "border": "none", - "config": { - "barcodeType": "CODE128", - "data": "123456789", - "showText": true, - "orientation": "horizontal" - } - }, - { - "id": "el-1773989473436-j7fdeh2", - "type": "BLANK", - "x": 32, - "y": 288, - "width": 48, - "height": 32, - "rotation": "horizontal", - "border": "none", - "config": {} - }, - { - "id": "el-1773989483341-ifwcyjj", - "type": "TEXT_PRICE", - "x": 152, - "y": 24, - "width": 80, - "height": 24, - "rotation": "horizontal", - "border": "none", - "config": { - "text": "0.00", - "prefix": "¥", - "decimal": 2, - "fontFamily": "Arial", - "fontSize": 14, - "fontWeight": "bold", - "textAlign": "right" - } - }, - { - "id": "el-1773989498031-e4d61j8", - "type": "IMAGE", - "x": 192, - "y": 56, - "width": 60, - "height": 60, - "rotation": "horizontal", - "border": "none", - "config": { - "src": "", - "scaleMode": "contain" - } - }, - { - "id": "el-1773989505076-1lxccx7", - "type": "TEXT_PRODUCT", - "x": 200, - "y": 136, - "width": 120, - "height": 24, - "rotation": "horizontal", - "border": "none", - "config": { - "text": "商品名", - "fontFamily": "Arial", - "fontSize": 14, - "fontWeight": "normal", - "textAlign": "left" - } - }, - { - "id": "el-1773989509805-ax3392v", - "type": "TEXT_STATIC", - "x": 192, - "y": 160, - "width": 120, - "height": 24, - "rotation": "horizontal", - "border": "none", - "config": { - "text": "文本", - "fontFamily": "Arial", - "fontSize": 14, - "fontWeight": "normal", - "textAlign": "left" - } - }, - { - "id": "el-1773989512993-xt8bg7q", - "type": "QRCODE", - "x": 184, - "y": 184, - "width": 80, - "height": 80, - "rotation": "horizontal", - "border": "none", - "config": { - "data": "https://example.com", - "errorLevel": "M" - } - }, - { - "id": "el-1773989525383-eji8p2s", - "type": "BARCODE", - "x": 0, - "y": 288, - "width": 160, - "height": 48, - "rotation": "horizontal", - "border": "none", - "config": { - "barcodeType": "CODE128", - "data": "123456789", - "showText": true, - "orientation": "horizontal" - } - }, - { - "id": "el-1773989540159-dr2avdf", - "type": "NUTRITION", - "x": 184, - "y": 280, - "width": 200, - "height": 120, - "rotation": "horizontal", - "border": "none", - "config": { - "calories": 120, - "fat": "5g", - "protein": "3g", - "carbs": "10g", - "layout": "standard" - } - }, - { - "id": "el-1773989549679-mcxrdnw", - "type": "TEXT_PRICE", - "x": 24, - "y": 352, - "width": 80, - "height": 24, - "rotation": "horizontal", - "border": "none", - "config": { - "text": "0.00", - "prefix": "¥", - "decimal": 2, - "fontFamily": "Arial", - "fontSize": 14, - "fontWeight": "bold", - "textAlign": "right" - } - } - ] -} \ No newline at end of file diff --git a/label-template-template-1773998862063 (1).json b/label-template-template-1773998862063 (1).json new file mode 100644 index 0000000..179f6a2 --- /dev/null +++ b/label-template-template-1773998862063 (1).json @@ -0,0 +1,94 @@ +{ + "id": "template-1773998862063", + "name": "未命名模板", + "labelType": "PRICE", + "unit": "inch", + "width": 4, + "height": 2, + "appliedLocation": "ALL", + "showRuler": true, + "showGrid": true, + "elements": [ + { + "id": "el-1773998886036-34sylni", + "type": "TEXT_STATIC", + "x": 104, + "y": 16, + "width": 120, + "height": 24, + "rotation": "horizontal", + "border": "none", + "config": { + "text": "文本", + "fontFamily": "Arial", + "fontSize": 14, + "fontWeight": "normal", + "textAlign": "center" + } + }, + { + "id": "el-1773998909568-4jjwdx7", + "type": "TEXT_PRODUCT", + "x": 96, + "y": 128, + "width": 120, + "height": 24, + "rotation": "horizontal", + "border": "none", + "config": { + "text": "商品名", + "fontFamily": "Arial", + "fontSize": 14, + "fontWeight": "normal", + "textAlign": "left" + } + }, + { + "id": "el-1773998913096-cgabpx1", + "type": "TEXT_STATIC", + "x": 88, + "y": 152, + "width": 120, + "height": 24, + "rotation": "horizontal", + "border": "none", + "config": { + "text": "文本", + "fontFamily": "Arial", + "fontSize": 14, + "fontWeight": "normal", + "textAlign": "left" + } + }, + { + "id": "el-1773999052674-uzocw1j", + "type": "QRCODE", + "x": 128, + "y": 40, + "width": 80, + "height": 80, + "rotation": "horizontal", + "border": "none", + "config": { + "data": "12341千问请问抛弃我", + "errorLevel": "M" + } + }, + { + "id": "el-1773999078958-5tgoru7", + "type": "BARCODE", + "x": 208, + "y": 128, + "width": 160, + "height": 48, + "rotation": "horizontal", + "border": "none", + "config": { + "barcodeType": "CODE128", + "data": "14124151231", + "showText": true, + "orientation": "horizontal" + } + } + ] +} \ No newline at end of file diff --git a/标签模块接口对接说明(1).md b/标签模块接口对接说明(1).md new file mode 100644 index 0000000..5c603f0 --- /dev/null +++ b/标签模块接口对接说明(1).md @@ -0,0 +1,586 @@ +## 概述 + +美国版后端采用 ABP 动态接口(ConventionalControllers),宿主统一前缀为 `api/app`。 +Swagger 地址: + +- `http://localhost:19001/swagger` + +说明: +- 接口最终 URL 以 Swagger 展示为准(可在 Swagger 里搜索 `LabelCategory / LabelType / LabelMultipleOption / LabelTemplate / Label`)。 +- 本模块后端接口以各 AppService 的方法签名自动暴露。 +- 返回分页统一包含 `PageIndex / PageSize / TotalCount / TotalPages / Items`。 + +--- + +## Swagger 中如何找到 + +1. 启动后端宿主(`Yi.Abp.Web`),端口 `19001`。 +2. 打开 `http://localhost:19001/swagger`。 +3. 在接口分组里搜索以下关键词之一: + - `label-category` + - `label-type` + - `label-multiple-option` + - `label-template` + - `label` + +--- + +## 接口 1:Label Categories(标签分类) + +### 1.1 分页列表 + +方法:`GET /api/app/label-category` + +入参(`LabelCategoryGetListInputVo`,查询参数): + +- `skipCount`(int) +- `maxResultCount`(int) +- `sorting`(string,可选) +- `keyword`(string,可选) +- `state`(boolean,可选) + +示例(查询参数): + +```json +{ + "skipCount": 0, + "maxResultCount": 10, + "keyword": "Prep", + "state": true +} +``` + +### 1.2 详情 + +方法:`GET /api/app/label-category/{id}` + +入参: + +- `id`:分类 Id(字符串) + +### 1.3 新增 + +方法:`POST /api/app/label-category` + +入参(Body:`LabelCategoryCreateInputVo`): + +```json +{ + "categoryCode": "CAT_PREP", + "categoryName": "Prep", + "categoryPhotoUrl": "https://cdn.example.com/cat-prep.png", + "state": true, + "orderNum": 1 +} +``` + +### 1.4 编辑 + +方法:`PUT /api/app/label-category/{id}` + +入参(Body:`LabelCategoryUpdateInputVo`,字段同创建): + +```json +{ + "categoryCode": "CAT_PREP", + "categoryName": "Prep", + "categoryPhotoUrl": null, + "state": true, + "orderNum": 2 +} +``` + +### 1.5 删除(逻辑删除) + +方法:`DELETE /api/app/label-category/{id}` + +入参: + +- `id`:分类 Id(字符串) + +删除校验: +- 若该分类已被 `fl_label` 引用,则抛出友好错误,禁止删除。 + +--- + +## 接口 2:Label Types(标签类型) + +### 2.1 分页列表 + +方法:`GET /api/app/label-type` + +入参(`LabelTypeGetListInputVo`,查询参数): + +```json +{ + "skipCount": 0, + "maxResultCount": 10, + "keyword": "Defrost", + "state": true +} +``` + +### 2.2 详情 + +方法:`GET /api/app/label-type/{id}` + +入参: + +- `id`:类型 Id(字符串) + +### 2.3 新增 + +方法:`POST /api/app/label-type` + +入参(Body:`LabelTypeCreateInputVo`): + +```json +{ + "typeCode": "TYPE_DEFROST", + "typeName": "Defrost", + "state": true, + "orderNum": 1 +} +``` + +### 2.4 编辑 + +方法:`PUT /api/app/label-type/{id}` + +入参(Body:`LabelTypeUpdateInputVo`,字段同创建): + +```json +{ + "typeCode": "TYPE_DEFROST", + "typeName": "Defrost", + "state": true, + "orderNum": 2 +} +``` + +### 2.5 删除(逻辑删除) + +方法:`DELETE /api/app/label-type/{id}` + +删除校验: +- 若该类型已被 `fl_label` 引用,则禁止删除。 + +--- + +## 接口 3:Multiple Options(多选项字典) + +### 3.1 分页列表 + +方法:`GET /api/app/label-multiple-option` + +入参(`LabelMultipleOptionGetListInputVo`,查询参数): + +```json +{ + "skipCount": 0, + "maxResultCount": 10, + "keyword": "Allergens", + "state": true +} +``` + +### 3.2 详情 + +方法:`GET /api/app/label-multiple-option/{id}` + +入参: + +- `id`:多选项 Id(字符串) + +### 3.3 新增 + +方法:`POST /api/app/label-multiple-option` + +入参(Body:`LabelMultipleOptionCreateInputVo`): + +说明:`optionValuesJson` 为 **JSON 字符串**,值为 string 数组的序列化结果(与库表/后端 DTO 一致),例如 `["Peanuts","Dairy"]` 对应字符串 `"[\"Peanuts\",\"Dairy\"]"`。 + +```json +{ + "optionCode": "OPT_ALLERGENS", + "optionName": "Allergens", + "optionValuesJson": "[\"Peanuts\",\"Dairy\",\"Gluten\",\"Soy\"]", + "state": true, + "orderNum": 1 +} +``` + +### 3.4 编辑 + +方法:`PUT /api/app/label-multiple-option/{id}` + +入参(Body:`LabelMultipleOptionUpdateInputVo`,字段同创建): + +```json +{ + "optionCode": "OPT_ALLERGENS", + "optionName": "Allergens", + "optionValuesJson": "[\"Peanuts\",\"Dairy\"]", + "state": true, + "orderNum": 2 +} +``` + +### 3.5 删除(逻辑删除) + +方法:`DELETE /api/app/label-multiple-option/{id}` + +--- + +## 接口 4:Label Templates(标签模板) + +说明: +- 模板标识入参 `id` 使用 `fl_label_template.TemplateCode`。 +- 创建/编辑的 Body 字段名对齐你前端 editor JSON(`id/name/appliedLocation/elements/config`)。 + +### 4.1 分页列表 + +方法:`GET /api/app/label-template` + +入参(`LabelTemplateGetListInputVo`,查询参数): + +```json +{ + "skipCount": 0, + "maxResultCount": 10, + "keyword": "测试模板", + "locationId": "11111111-1111-1111-1111-111111111111", + "labelType": "PRICE", + "state": true +} +``` + +### 4.2 详情 + +方法:`GET /api/app/label-template/{id}` + +入参: + +- `id`:模板编码 `TemplateCode`(字符串) + +### 4.3 新增模板 + +方法:`POST /api/app/label-template` + +入参(Body:`LabelTemplateCreateInputVo`): + +```json +{ + "id": "TPL_TEST_001", + "name": "测试模板-价格签(4x6)", + "labelType": "PRICE", + "unit": "inch", + "width": 4, + "height": 6, + "appliedLocation": "ALL", + "showRuler": true, + "showGrid": true, + "state": true, + "elements": [ + { + "id": "el-fixed-title", + "type": "TEXT_STATIC", + "x": 32, + "y": 24, + "width": 160, + "height": 24, + "rotation": "horizontal", + "border": "none", + "zIndex": 1, + "orderNum": 1, + "valueSourceType": "FIXED", + "isRequiredInput": false, + "config": { + "text": "商品名", + "fontFamily": "Arial", + "fontSize": 14, + "fontWeight": "bold", + "textAlign": "left" + } + } + ], + "appliedLocationIds": [] +} +``` + +说明: +- 当 `appliedLocation=SPECIFIED` 时,`appliedLocationIds` 必须至少选择一个门店。 + +### 4.4 编辑模板 + +方法:`PUT /api/app/label-template/{id}` + +入参: +- Path:`id` 是当前模板编码(TemplateCode) +- Body:字段同新增(`id/name/elements/...`) + +示例(编辑:同样字段,appliedLocation 切到 SPECIFIED): + +```json +{ + "id": "TPL_TEST_001", + "name": "测试模板-价格签(4x6) v2", + "labelType": "PRICE", + "unit": "inch", + "width": 4, + "height": 6, + "appliedLocation": "SPECIFIED", + "showRuler": true, + "showGrid": true, + "state": true, + "elements": [], + "appliedLocationIds": ["11111111-1111-1111-1111-111111111111"] +} +``` + +版本: +- `VersionNo` 会在编辑时自动 `+1`。 +- `elements` 会按传入内容全量重建。 + +### 4.5 删除(逻辑删除) + +方法:`DELETE /api/app/label-template/{id}` + +入参: +- `id`:模板编码 `TemplateCode` + +删除校验: +- 若该模板已被 `fl_label` 引用,则禁止删除。 + +--- + +## 接口 5:Labels(按产品展示多个标签) + +说明: +- 列表接口按 `ProductId` 查询,一个产品会对应多条标签记录。 +- 标签详情/编辑/删除的 `id` 使用 `fl_label.LabelCode`。 + +### 5.1 分页列表(按产品) + +方法:`GET /api/app/label` + +入参(`LabelGetListInputVo`,查询参数): + +```json +{ + "skipCount": 0, + "maxResultCount": 10, + "sorting": "", + "keyword": "早餐", + "locationId": "11111111-1111-1111-1111-111111111111", + "productId": "22222222-2222-2222-2222-222222222222", + "labelCategoryId": "33333333-3333-3333-3333-333333333333", + "labelTypeId": "44444444-4444-4444-4444-444444444444", + "templateCode": "TPL_TEST_001", + "state": true +} +``` + +### 5.2 详情 + +方法:`GET /api/app/label/{id}` + +入参: +- `id`:标签编码 `LabelCode` + +返回: +- `productIds`:该标签绑定的产品Id 列表 + +### 5.3 新增标签 + +方法:`POST /api/app/label` + +入参(Body:`LabelCreateInputVo`): + +```json +{ + "labelCode": "LBL_TEST_001", + "labelName": "早餐标签", + "templateCode": "TPL_TEST_001", + "locationId": "11111111-1111-1111-1111-111111111111", + "labelCategoryId": "33333333-3333-3333-3333-333333333333", + "labelTypeId": "44444444-4444-4444-4444-444444444444", + "productIds": ["22222222-2222-2222-2222-222222222222"], + "labelInfoJson": { "note": "测试标签1" }, + "state": true +} +``` + +校验: +- `productIds` 至少 1 个 +- `templateCode/locationId/labelCategoryId/labelTypeId` 不能为空 + +### 5.4 编辑标签 + +方法:`PUT /api/app/label/{id}` + +入参: +- Path:`id` 为当前标签编码 `LabelCode` +- Body:字段同创建(`LabelUpdateInputVo`) + +```json +{ + "labelName": "早餐标签 v2", + "templateCode": "TPL_TEST_001", + "locationId": "11111111-1111-1111-1111-111111111111", + "labelCategoryId": "33333333-3333-3333-3333-333333333333", + "labelTypeId": "44444444-4444-4444-4444-444444444444", + "productIds": ["22222222-2222-2222-2222-222222222222"], + "labelInfoJson": { "note": "测试标签1 v2" }, + "state": true +} +``` + +关联维护: +- `fl_label_product` 会按新 `productIds` 重建。 + +### 5.5 删除标签(逻辑删除) + +方法:`DELETE /api/app/label/{id}` + +入参: +- `id`:标签编码 `LabelCode` + +删除行为: +- 逻辑删除 `fl_label` +- 删除该标签对应的 `fl_label_product` 关联 + +--- +## 接口 6:Products(产品) + +说明: +- 产品表:`fl_product` +- 删除为逻辑删除:`IsDeleted = true` + +### 6.1 分页列表 + +方法:`GET /api/app/product` + +入参(`ProductGetListInputVo`,查询参数): +```json +{ + "skipCount": 0, + "maxResultCount": 10, + "sorting": "", + "keyword": "Chicken", + "state": true +} +``` + +### 6.2 详情 + +方法:`GET /api/app/product/{id}` + +入参: +- `id`:产品Id(`fl_product.Id`) + +### 6.3 新增产品 + +方法:`POST /api/app/product` + +入参(Body:`ProductCreateInputVo`): +```json +{ + "productCode": "PRD_TEST_001", + "productName": "Chicken", + "categoryName": "Meat", + "productImageUrl": "https://example.com/img.png", + "state": true +} +``` + +校验: +- `productCode/productName` 不能为空 +- `productCode` 不能与未删除的数据重复 + +### 6.4 编辑产品 + +方法:`PUT /api/app/product/{id}` + +入参: +- Path:`id` 为当前产品Id(`fl_product.Id`) +- Body:字段同新增(`ProductUpdateInputVo`) + +### 6.5 删除(逻辑删除) + +方法:`DELETE /api/app/product/{id}` + +入参: +- `id`:产品Id + +--- +## 接口 7:Product-Location(门店-产品关联) + +说明: +- 关联表:`fl_location_product` +- 关联按门店进行批量替换: + - `Create`:在门店下新增未存在的 product 关联 + - `Update`:替换该门店下全部关联(先删后建) + - `Delete`:删除该门店下全部关联 + +### 7.1 分页列表 + +方法:`GET /api/app/product-location` + +入参(`ProductLocationGetListInputVo`,查询参数): +```json +{ + "skipCount": 0, + "maxResultCount": 10, + "sorting": "", + "locationId": "11111111-1111-1111-1111-111111111111", + "productId": "22222222-2222-2222-2222-222222222222" +} +``` + +### 7.2 获取门店下全部产品 + +方法:`GET /api/app/product-location/{id}` + +入参: +- `id`:门店Id(`location.Id`,string 表示) + +返回: +- 门店Id + 该门店关联的产品列表 + +### 7.3 新增/建立门店关联 + +方法:`POST /api/app/product-location` + +入参(Body:`ProductLocationCreateInputVo`): +```json +{ + "locationId": "11111111-1111-1111-1111-111111111111", + "productIds": ["22222222-2222-2222-2222-222222222222"] +} +``` + +校验: +- `locationId` 对应门店必须存在 +- `productIds` 必须都存在于 `fl_product` 且未删除 + +### 7.4 编辑/替换门店关联 + +方法:`PUT /api/app/product-location/{id}` + +入参: +- Path:`id` 为门店Id +- Body:`ProductLocationUpdateInputVo` +```json +{ + "productIds": ["22222222-2222-2222-2222-222222222222"] +} +``` + +### 7.5 删除门店关联(按门店删除全部) + +方法:`DELETE /api/app/product-location/{id}` + +入参: +- `id`:门店Id + diff --git a/泰额版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/LabelCanvas.tsx b/泰额版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/LabelCanvas.tsx index 43611b9..95e9dc2 100644 --- a/泰额版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/LabelCanvas.tsx +++ b/泰额版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/LabelCanvas.tsx @@ -1195,7 +1195,7 @@ export function LabelCanvas({ ); } -/** 仅用于预览:无网格、无标尺、无拖拽,按比例缩放 */ +/** Preview only: no grid, no rulers, no drag; scale to fit. */ export function LabelPreviewOnly({ template, maxWidth = 480, diff --git a/美国版/Food Labeling Management Platform/.env.local b/美国版/Food Labeling Management Platform/.env.local index 48c3f29..fa8ef16 100644 --- a/美国版/Food Labeling Management Platform/.env.local +++ b/美国版/Food Labeling Management Platform/.env.local @@ -1,2 +1,2 @@ -VITE_API_BASE_URL=http://192.168.31.87:19001 - +# VITE_API_BASE_URL=http://192.168.31.87:19001 +VITE_API_BASE_URL=http://flus-test.3ffoodsafety.com diff --git a/美国版/Food Labeling Management Platform/build/assets/index-TU5tblcP.js b/美国版/Food Labeling Management Platform/build/assets/index-TU5tblcP.js deleted file mode 100644 index 0bfa58f..0000000 --- a/美国版/Food Labeling Management Platform/build/assets/index-TU5tblcP.js +++ /dev/null @@ -1,458 +0,0 @@ -function h8(e,t){for(var r=0;rn[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=r(i);fetch(i.href,o)}})();var Xf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jg={exports:{}},Zl={},Og={exports:{}},Xe={};/** - * @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 dE;function p8(){if(dE)return Xe;dE=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),l=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.iterator;function m(M){return M===null||typeof M!="object"?null:(M=p&&M[p]||M["@@iterator"],typeof M=="function"?M:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,y={};function w(M,B,ee){this.props=M,this.context=B,this.refs=y,this.updater=ee||g}w.prototype.isReactComponent={},w.prototype.setState=function(M,B){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,B,"setState")},w.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function j(){}j.prototype=w.prototype;function O(M,B,ee){this.props=M,this.context=B,this.refs=y,this.updater=ee||g}var E=O.prototype=new j;E.constructor=O,b(E,w.prototype),E.isPureReactComponent=!0;var A=Array.isArray,N=Object.prototype.hasOwnProperty,C={current:null},T={key:!0,ref:!0,__self:!0,__source:!0};function R(M,B,ee){var ae,ie={},fe=null,K=null;if(B!=null)for(ae in B.ref!==void 0&&(K=B.ref),B.key!==void 0&&(fe=""+B.key),B)N.call(B,ae)&&!T.hasOwnProperty(ae)&&(ie[ae]=B[ae]);var ce=arguments.length-2;if(ce===1)ie.children=ee;else if(1>>1,B=D[M];if(0>>1;Mi(ie,J))fei(K,ie)?(D[M]=K,D[fe]=J,M=fe):(D[M]=ie,D[ae]=J,M=ae);else if(fei(K,J))D[M]=K,D[fe]=J,M=fe;else break e}}return Z}function i(D,Z){var J=D.sortIndex-Z.sortIndex;return J!==0?J:D.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,u=s.now();e.unstable_now=function(){return s.now()-u}}var f=[],l=[],h=1,p=null,m=3,g=!1,b=!1,y=!1,w=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(D){for(var Z=r(l);Z!==null;){if(Z.callback===null)n(l);else if(Z.startTime<=D)n(l),Z.sortIndex=Z.expirationTime,t(f,Z);else break;Z=r(l)}}function A(D){if(y=!1,E(D),!b)if(r(f)!==null)b=!0,H(N);else{var Z=r(l);Z!==null&&V(A,Z.startTime-D)}}function N(D,Z){b=!1,y&&(y=!1,j(R),R=-1),g=!0;var J=m;try{for(E(Z),p=r(f);p!==null&&(!(p.expirationTime>Z)||D&&!L());){var M=p.callback;if(typeof M=="function"){p.callback=null,m=p.priorityLevel;var B=M(p.expirationTime<=Z);Z=e.unstable_now(),typeof B=="function"?p.callback=B:p===r(f)&&n(f),E(Z)}else n(f);p=r(f)}if(p!==null)var ee=!0;else{var ae=r(l);ae!==null&&V(A,ae.startTime-Z),ee=!1}return ee}finally{p=null,m=J,g=!1}}var C=!1,T=null,R=-1,I=5,F=-1;function L(){return!(e.unstable_now()-FD||125M?(D.sortIndex=J,t(l,D),r(f)===null&&D===r(l)&&(y?(j(R),R=-1):y=!0,V(A,J-M))):(D.sortIndex=B,t(f,D),b||g||(b=!0,H(N))),D},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(D){var Z=m;return function(){var J=m;m=Z;try{return D.apply(this,arguments)}finally{m=J}}}})(Ng)),Ng}var gE;function y8(){return gE||(gE=1,Pg.exports=g8()),Pg.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 yE;function x8(){if(yE)return Tr;yE=1;var e=jp(),t=y8();function r(a){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+a,v=1;v"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,l=/^[: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(a){return f.call(p,a)?!0:f.call(h,a)?!1:l.test(a)?p[a]=!0:(h[a]=!0,!1)}function g(a,c,v,x){if(v!==null&&v.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return x?!1:v!==null?!v.acceptsBooleans:(a=a.toLowerCase().slice(0,5),a!=="data-"&&a!=="aria-");default:return!1}}function b(a,c,v,x){if(c===null||typeof c>"u"||g(a,c,v,x))return!0;if(x)return!1;if(v!==null)switch(v.type){case 3:return!c;case 4:return c===!1;case 5:return isNaN(c);case 6:return isNaN(c)||1>c}return!1}function y(a,c,v,x,_,P,k){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=x,this.attributeNamespace=_,this.mustUseProperty=v,this.propertyName=a,this.type=c,this.sanitizeURL=P,this.removeEmptyString=k}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){w[a]=new y(a,0,!1,a,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var c=a[0];w[c]=new y(c,1,!1,a[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(a){w[a]=new y(a,2,!1,a.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){w[a]=new y(a,2,!1,a,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(a){w[a]=new y(a,3,!1,a.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(a){w[a]=new y(a,3,!0,a,null,!1,!1)}),["capture","download"].forEach(function(a){w[a]=new y(a,4,!1,a,null,!1,!1)}),["cols","rows","size","span"].forEach(function(a){w[a]=new y(a,6,!1,a,null,!1,!1)}),["rowSpan","start"].forEach(function(a){w[a]=new y(a,5,!1,a.toLowerCase(),null,!1,!1)});var j=/[\-:]([a-z])/g;function O(a){return a[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(a){var c=a.replace(j,O);w[c]=new y(c,1,!1,a,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var c=a.replace(j,O);w[c]=new y(c,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(a){var c=a.replace(j,O);w[c]=new y(c,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(a){w[a]=new y(a,1,!1,a.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(a){w[a]=new y(a,1,!1,a.toLowerCase(),null,!0,!0)});function E(a,c,v,x){var _=w.hasOwnProperty(c)?w[c]:null;(_!==null?_.type!==0:x||!(2W||_[k]!==P[W]){var X=` -`+_[k].replace(" at new "," at ");return a.displayName&&X.includes("")&&(X=X.replace("",a.displayName)),X}while(1<=k&&0<=W);break}}}finally{ee=!1,Error.prepareStackTrace=v}return(a=a?a.displayName||a.name:"")?B(a):""}function ie(a){switch(a.tag){case 5:return B(a.type);case 16:return B("Lazy");case 13:return B("Suspense");case 19:return B("SuspenseList");case 0:case 2:case 15:return a=ae(a.type,!1),a;case 11:return a=ae(a.type.render,!1),a;case 1:return a=ae(a.type,!0),a;default:return""}}function fe(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case T:return"Fragment";case C:return"Portal";case I:return"Profiler";case R:return"StrictMode";case U:return"Suspense";case G:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case L:return(a.displayName||"Context")+".Consumer";case F:return(a._context.displayName||"Context")+".Provider";case $:var c=a.render;return a=a.displayName,a||(a=c.displayName||c.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case q:return c=a.displayName||null,c!==null?c:fe(a.type)||"Memo";case H:c=a._payload,a=a._init;try{return fe(a(c))}catch{}}return null}function K(a){var c=a.type;switch(a.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=c.render,a=a.displayName||a.name||"",c.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fe(c);case 8:return c===R?"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 c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function ce(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function te(a){var c=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function le(a){var c=te(a)?"checked":"value",v=Object.getOwnPropertyDescriptor(a.constructor.prototype,c),x=""+a[c];if(!a.hasOwnProperty(c)&&typeof v<"u"&&typeof v.get=="function"&&typeof v.set=="function"){var _=v.get,P=v.set;return Object.defineProperty(a,c,{configurable:!0,get:function(){return _.call(this)},set:function(k){x=""+k,P.call(this,k)}}),Object.defineProperty(a,c,{enumerable:v.enumerable}),{getValue:function(){return x},setValue:function(k){x=""+k},stopTracking:function(){a._valueTracker=null,delete a[c]}}}}function ge(a){a._valueTracker||(a._valueTracker=le(a))}function Y(a){if(!a)return!1;var c=a._valueTracker;if(!c)return!0;var v=c.getValue(),x="";return a&&(x=te(a)?a.checked?"true":"false":a.value),a=x,a!==v?(c.setValue(a),!0):!1}function _e(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}function Oe(a,c){var v=c.checked;return J({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:v??a._wrapperState.initialChecked})}function Ve(a,c){var v=c.defaultValue==null?"":c.defaultValue,x=c.checked!=null?c.checked:c.defaultChecked;v=ce(c.value!=null?c.value:v),a._wrapperState={initialChecked:x,initialValue:v,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function nt(a,c){c=c.checked,c!=null&&E(a,"checked",c,!1)}function lt(a,c){nt(a,c);var v=ce(c.value),x=c.type;if(v!=null)x==="number"?(v===0&&a.value===""||a.value!=v)&&(a.value=""+v):a.value!==""+v&&(a.value=""+v);else if(x==="submit"||x==="reset"){a.removeAttribute("value");return}c.hasOwnProperty("value")?ir(a,c.type,v):c.hasOwnProperty("defaultValue")&&ir(a,c.type,ce(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(a.defaultChecked=!!c.defaultChecked)}function nr(a,c,v){if(c.hasOwnProperty("value")||c.hasOwnProperty("defaultValue")){var x=c.type;if(!(x!=="submit"&&x!=="reset"||c.value!==void 0&&c.value!==null))return;c=""+a._wrapperState.initialValue,v||c===a.value||(a.value=c),a.defaultValue=c}v=a.name,v!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,v!==""&&(a.name=v)}function ir(a,c,v){(c!=="number"||_e(a.ownerDocument)!==a)&&(v==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+v&&(a.defaultValue=""+v))}var hr=Array.isArray;function Rt(a,c,v,x){if(a=a.options,c){c={};for(var _=0;_"+c.valueOf().toString()+"",c=wa.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;c.firstChild;)a.appendChild(c.firstChild)}});function jo(a,c){if(c){var v=a.firstChild;if(v&&v===a.lastChild&&v.nodeType===3){v.nodeValue=c;return}}a.textContent=c}var ci={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},Lm=["Webkit","ms","Moz","O"];Object.keys(ci).forEach(function(a){Lm.forEach(function(c){c=c+a.charAt(0).toUpperCase()+a.substring(1),ci[c]=ci[a]})});function Bu(a,c,v){return c==null||typeof c=="boolean"||c===""?"":v||typeof c!="number"||c===0||ci.hasOwnProperty(a)&&ci[a]?(""+c).trim():c+"px"}function Fu(a,c){a=a.style;for(var v in c)if(c.hasOwnProperty(v)){var x=v.indexOf("--")===0,_=Bu(v,c[v],x);v==="float"&&(v="cssFloat"),x?a.setProperty(v,_):a[v]=_}}var $m=J({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 ve(a,c){if(c){if($m[a]&&(c.children!=null||c.dangerouslySetInnerHTML!=null))throw Error(r(137,a));if(c.dangerouslySetInnerHTML!=null){if(c.children!=null)throw Error(r(60));if(typeof c.dangerouslySetInnerHTML!="object"||!("__html"in c.dangerouslySetInnerHTML))throw Error(r(61))}if(c.style!=null&&typeof c.style!="object")throw Error(r(62))}}function dt(a,c){if(a.indexOf("-")===-1)return typeof c.is=="string";switch(a){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 Jt=null;function Bm(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var Fm=null,Sa=null,_a=null;function A_(a){if(a=Ll(a)){if(typeof Fm!="function")throw Error(r(280));var c=a.stateNode;c&&(c=uf(c),Fm(a.stateNode,a.type,c))}}function C_(a){Sa?_a?_a.push(a):_a=[a]:Sa=a}function T_(){if(Sa){var a=Sa,c=_a;if(_a=Sa=null,A_(a),c)for(a=0;a>>=0,a===0?32:31-(A5(a)/C5|0)|0}var Hu=64,Vu=4194304;function xl(a){switch(a&-a){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 a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function Gu(a,c){var v=a.pendingLanes;if(v===0)return 0;var x=0,_=a.suspendedLanes,P=a.pingedLanes,k=v&268435455;if(k!==0){var W=k&~_;W!==0?x=xl(W):(P&=k,P!==0&&(x=xl(P)))}else k=v&~_,k!==0?x=xl(k):P!==0&&(x=xl(P));if(x===0)return 0;if(c!==0&&c!==x&&(c&_)===0&&(_=x&-x,P=c&-c,_>=P||_===16&&(P&4194240)!==0))return c;if((x&4)!==0&&(x|=v&16),c=a.entangledLanes,c!==0)for(a=a.entanglements,c&=x;0v;v++)c.push(a);return c}function bl(a,c,v){a.pendingLanes|=c,c!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,c=31-bn(c),a[c]=v}function M5(a,c){var v=a.pendingLanes&~c;a.pendingLanes=c,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=c,a.mutableReadLanes&=c,a.entangledLanes&=c,c=a.entanglements;var x=a.eventTimes;for(a=a.expirationTimes;0=Nl),oj=" ",aj=!1;function sj(a,c){switch(a){case"keyup":return lB.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function lj(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Ea=!1;function uB(a,c){switch(a){case"compositionend":return lj(c);case"keypress":return c.which!==32?null:(aj=!0,oj);case"textInput":return a=c.data,a===oj&&aj?null:a;default:return null}}function fB(a,c){if(Ea)return a==="compositionend"||!iv&&sj(a,c)?(a=J_(),Zu=Zm=Wi=null,Ea=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1=c)return{node:v,offset:c-a};a=x}e:{for(;v;){if(v.nextSibling){v=v.nextSibling;break e}v=v.parentNode}v=void 0}v=mj(v)}}function gj(a,c){return a&&c?a===c?!0:a&&a.nodeType===3?!1:c&&c.nodeType===3?gj(a,c.parentNode):"contains"in a?a.contains(c):a.compareDocumentPosition?!!(a.compareDocumentPosition(c)&16):!1:!1}function yj(){for(var a=window,c=_e();c instanceof a.HTMLIFrameElement;){try{var v=typeof c.contentWindow.location.href=="string"}catch{v=!1}if(v)a=c.contentWindow;else break;c=_e(a.document)}return c}function sv(a){var c=a&&a.nodeName&&a.nodeName.toLowerCase();return c&&(c==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||c==="textarea"||a.contentEditable==="true")}function bB(a){var c=yj(),v=a.focusedElem,x=a.selectionRange;if(c!==v&&v&&v.ownerDocument&&gj(v.ownerDocument.documentElement,v)){if(x!==null&&sv(v)){if(c=x.start,a=x.end,a===void 0&&(a=c),"selectionStart"in v)v.selectionStart=c,v.selectionEnd=Math.min(a,v.value.length);else if(a=(c=v.ownerDocument||document)&&c.defaultView||window,a.getSelection){a=a.getSelection();var _=v.textContent.length,P=Math.min(x.start,_);x=x.end===void 0?P:Math.min(x.end,_),!a.extend&&P>x&&(_=x,x=P,P=_),_=vj(v,P);var k=vj(v,x);_&&k&&(a.rangeCount!==1||a.anchorNode!==_.node||a.anchorOffset!==_.offset||a.focusNode!==k.node||a.focusOffset!==k.offset)&&(c=c.createRange(),c.setStart(_.node,_.offset),a.removeAllRanges(),P>x?(a.addRange(c),a.extend(k.node,k.offset)):(c.setEnd(k.node,k.offset),a.addRange(c)))}}for(c=[],a=v;a=a.parentNode;)a.nodeType===1&&c.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v=document.documentMode,Pa=null,lv=null,kl=null,cv=!1;function xj(a,c,v){var x=v.window===v?v.document:v.nodeType===9?v:v.ownerDocument;cv||Pa==null||Pa!==_e(x)||(x=Pa,"selectionStart"in x&&sv(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),kl&&Tl(kl,x)||(kl=x,x=sf(lv,"onSelect"),0ka||(a.current=wv[ka],wv[ka]=null,ka--)}function vt(a,c){ka++,wv[ka]=a.current,a.current=c}var Ki={},or=Gi(Ki),Er=Gi(!1),Po=Ki;function Ra(a,c){var v=a.type.contextTypes;if(!v)return Ki;var x=a.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===c)return x.__reactInternalMemoizedMaskedChildContext;var _={},P;for(P in v)_[P]=c[P];return x&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=c,a.__reactInternalMemoizedMaskedChildContext=_),_}function Pr(a){return a=a.childContextTypes,a!=null}function ff(){wt(Er),wt(or)}function Mj(a,c,v){if(or.current!==Ki)throw Error(r(168));vt(or,c),vt(Er,v)}function Ij(a,c,v){var x=a.stateNode;if(c=c.childContextTypes,typeof x.getChildContext!="function")return v;x=x.getChildContext();for(var _ in x)if(!(_ in c))throw Error(r(108,K(a)||"Unknown",_));return J({},v,x)}function df(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Ki,Po=or.current,vt(or,a),vt(Er,Er.current),!0}function Dj(a,c,v){var x=a.stateNode;if(!x)throw Error(r(169));v?(a=Ij(a,c,Po),x.__reactInternalMemoizedMergedChildContext=a,wt(Er),wt(or),vt(or,a)):wt(Er),vt(Er,v)}var fi=null,hf=!1,Sv=!1;function Lj(a){fi===null?fi=[a]:fi.push(a)}function kB(a){hf=!0,Lj(a)}function Xi(){if(!Sv&&fi!==null){Sv=!0;var a=0,c=ht;try{var v=fi;for(ht=1;a>=k,_-=k,di=1<<32-bn(c)+_|v<<_|x,hi=P+a}else di=1<ze?(Xt=$e,$e=null):Xt=$e.sibling;var ot=de(re,$e,ne[ze],xe);if(ot===null){$e===null&&($e=Xt);break}a&&$e&&ot.alternate===null&&c(re,$e),Q=P(ot,Q,ze),Le===null?Me=ot:Le.sibling=ot,Le=ot,$e=Xt}if(ze===ne.length)return v(re,$e),_t&&Ao(re,ze),Me;if($e===null){for(;zeze?(Xt=$e,$e=null):Xt=$e.sibling;var io=de(re,$e,ot.value,xe);if(io===null){$e===null&&($e=Xt);break}a&&$e&&io.alternate===null&&c(re,$e),Q=P(io,Q,ze),Le===null?Me=io:Le.sibling=io,Le=io,$e=Xt}if(ot.done)return v(re,$e),_t&&Ao(re,ze),Me;if($e===null){for(;!ot.done;ze++,ot=ne.next())ot=pe(re,ot.value,xe),ot!==null&&(Q=P(ot,Q,ze),Le===null?Me=ot:Le.sibling=ot,Le=ot);return _t&&Ao(re,ze),Me}for($e=x(re,$e);!ot.done;ze++,ot=ne.next())ot=je($e,re,ze,ot.value,xe),ot!==null&&(a&&ot.alternate!==null&&$e.delete(ot.key===null?ze:ot.key),Q=P(ot,Q,ze),Le===null?Me=ot:Le.sibling=ot,Le=ot);return a&&$e.forEach(function(d8){return c(re,d8)}),_t&&Ao(re,ze),Me}function kt(re,Q,ne,xe){if(typeof ne=="object"&&ne!==null&&ne.type===T&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case N:e:{for(var Me=ne.key,Le=Q;Le!==null;){if(Le.key===Me){if(Me=ne.type,Me===T){if(Le.tag===7){v(re,Le.sibling),Q=_(Le,ne.props.children),Q.return=re,re=Q;break e}}else if(Le.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===H&&Uj(Me)===Le.type){v(re,Le.sibling),Q=_(Le,ne.props),Q.ref=$l(re,Le,ne),Q.return=re,re=Q;break e}v(re,Le);break}else c(re,Le);Le=Le.sibling}ne.type===T?(Q=Lo(ne.props.children,re.mode,xe,ne.key),Q.return=re,re=Q):(xe=zf(ne.type,ne.key,ne.props,null,re.mode,xe),xe.ref=$l(re,Q,ne),xe.return=re,re=xe)}return k(re);case C:e:{for(Le=ne.key;Q!==null;){if(Q.key===Le)if(Q.tag===4&&Q.stateNode.containerInfo===ne.containerInfo&&Q.stateNode.implementation===ne.implementation){v(re,Q.sibling),Q=_(Q,ne.children||[]),Q.return=re,re=Q;break e}else{v(re,Q);break}else c(re,Q);Q=Q.sibling}Q=xg(ne,re.mode,xe),Q.return=re,re=Q}return k(re);case H:return Le=ne._init,kt(re,Q,Le(ne._payload),xe)}if(hr(ne))return Ae(re,Q,ne,xe);if(Z(ne))return ke(re,Q,ne,xe);gf(re,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"?(ne=""+ne,Q!==null&&Q.tag===6?(v(re,Q.sibling),Q=_(Q,ne),Q.return=re,re=Q):(v(re,Q),Q=yg(ne,re.mode,xe),Q.return=re,re=Q),k(re)):v(re,Q)}return kt}var La=Wj(!0),Hj=Wj(!1),yf=Gi(null),xf=null,$a=null,Nv=null;function Av(){Nv=$a=xf=null}function Cv(a){var c=yf.current;wt(yf),a._currentValue=c}function Tv(a,c,v){for(;a!==null;){var x=a.alternate;if((a.childLanes&c)!==c?(a.childLanes|=c,x!==null&&(x.childLanes|=c)):x!==null&&(x.childLanes&c)!==c&&(x.childLanes|=c),a===v)break;a=a.return}}function Ba(a,c){xf=a,Nv=$a=null,a=a.dependencies,a!==null&&a.firstContext!==null&&((a.lanes&c)!==0&&(Nr=!0),a.firstContext=null)}function nn(a){var c=a._currentValue;if(Nv!==a)if(a={context:a,memoizedValue:c,next:null},$a===null){if(xf===null)throw Error(r(308));$a=a,xf.dependencies={lanes:0,firstContext:a}}else $a=$a.next=a;return c}var Co=null;function kv(a){Co===null?Co=[a]:Co.push(a)}function Vj(a,c,v,x){var _=c.interleaved;return _===null?(v.next=v,kv(c)):(v.next=_.next,_.next=v),c.interleaved=v,pi(a,x)}function pi(a,c){a.lanes|=c;var v=a.alternate;for(v!==null&&(v.lanes|=c),v=a,a=a.return;a!==null;)a.childLanes|=c,v=a.alternate,v!==null&&(v.childLanes|=c),v=a,a=a.return;return v.tag===3?v.stateNode:null}var Yi=!1;function Rv(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Gj(a,c){a=a.updateQueue,c.updateQueue===a&&(c.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function mi(a,c){return{eventTime:a,lane:c,tag:0,payload:null,callback:null,next:null}}function Qi(a,c,v){var x=a.updateQueue;if(x===null)return null;if(x=x.shared,(it&2)!==0){var _=x.pending;return _===null?c.next=c:(c.next=_.next,_.next=c),x.pending=c,pi(a,v)}return _=x.interleaved,_===null?(c.next=c,kv(x)):(c.next=_.next,_.next=c),x.interleaved=c,pi(a,v)}function bf(a,c,v){if(c=c.updateQueue,c!==null&&(c=c.shared,(v&4194240)!==0)){var x=c.lanes;x&=a.pendingLanes,v|=x,c.lanes=v,Gm(a,v)}}function Kj(a,c){var v=a.updateQueue,x=a.alternate;if(x!==null&&(x=x.updateQueue,v===x)){var _=null,P=null;if(v=v.firstBaseUpdate,v!==null){do{var k={eventTime:v.eventTime,lane:v.lane,tag:v.tag,payload:v.payload,callback:v.callback,next:null};P===null?_=P=k:P=P.next=k,v=v.next}while(v!==null);P===null?_=P=c:P=P.next=c}else _=P=c;v={baseState:x.baseState,firstBaseUpdate:_,lastBaseUpdate:P,shared:x.shared,effects:x.effects},a.updateQueue=v;return}a=v.lastBaseUpdate,a===null?v.firstBaseUpdate=c:a.next=c,v.lastBaseUpdate=c}function wf(a,c,v,x){var _=a.updateQueue;Yi=!1;var P=_.firstBaseUpdate,k=_.lastBaseUpdate,W=_.shared.pending;if(W!==null){_.shared.pending=null;var X=W,oe=X.next;X.next=null,k===null?P=oe:k.next=oe,k=X;var he=a.alternate;he!==null&&(he=he.updateQueue,W=he.lastBaseUpdate,W!==k&&(W===null?he.firstBaseUpdate=oe:W.next=oe,he.lastBaseUpdate=X))}if(P!==null){var pe=_.baseState;k=0,he=oe=X=null,W=P;do{var de=W.lane,je=W.eventTime;if((x&de)===de){he!==null&&(he=he.next={eventTime:je,lane:0,tag:W.tag,payload:W.payload,callback:W.callback,next:null});e:{var Ae=a,ke=W;switch(de=c,je=v,ke.tag){case 1:if(Ae=ke.payload,typeof Ae=="function"){pe=Ae.call(je,pe,de);break e}pe=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=ke.payload,de=typeof Ae=="function"?Ae.call(je,pe,de):Ae,de==null)break e;pe=J({},pe,de);break e;case 2:Yi=!0}}W.callback!==null&&W.lane!==0&&(a.flags|=64,de=_.effects,de===null?_.effects=[W]:de.push(W))}else je={eventTime:je,lane:de,tag:W.tag,payload:W.payload,callback:W.callback,next:null},he===null?(oe=he=je,X=pe):he=he.next=je,k|=de;if(W=W.next,W===null){if(W=_.shared.pending,W===null)break;de=W,W=de.next,de.next=null,_.lastBaseUpdate=de,_.shared.pending=null}}while(!0);if(he===null&&(X=pe),_.baseState=X,_.firstBaseUpdate=oe,_.lastBaseUpdate=he,c=_.shared.interleaved,c!==null){_=c;do k|=_.lane,_=_.next;while(_!==c)}else P===null&&(_.shared.lanes=0);Ro|=k,a.lanes=k,a.memoizedState=pe}}function Xj(a,c,v){if(a=c.effects,c.effects=null,a!==null)for(c=0;cv?v:4,a(!0);var x=$v.transition;$v.transition={};try{a(!1),c()}finally{ht=v,$v.transition=x}}function pO(){return on().memoizedState}function DB(a,c,v){var x=to(a);if(v={lane:x,action:v,hasEagerState:!1,eagerState:null,next:null},mO(a))vO(c,v);else if(v=Vj(a,c,v,x),v!==null){var _=mr();En(v,a,x,_),gO(v,c,x)}}function LB(a,c,v){var x=to(a),_={lane:x,action:v,hasEagerState:!1,eagerState:null,next:null};if(mO(a))vO(c,_);else{var P=a.alternate;if(a.lanes===0&&(P===null||P.lanes===0)&&(P=c.lastRenderedReducer,P!==null))try{var k=c.lastRenderedState,W=P(k,v);if(_.hasEagerState=!0,_.eagerState=W,wn(W,k)){var X=c.interleaved;X===null?(_.next=_,kv(c)):(_.next=X.next,X.next=_),c.interleaved=_;return}}catch{}finally{}v=Vj(a,c,_,x),v!==null&&(_=mr(),En(v,a,x,_),gO(v,c,x))}}function mO(a){var c=a.alternate;return a===Et||c!==null&&c===Et}function vO(a,c){ql=jf=!0;var v=a.pending;v===null?c.next=c:(c.next=v.next,v.next=c),a.pending=c}function gO(a,c,v){if((v&4194240)!==0){var x=c.lanes;x&=a.pendingLanes,v|=x,c.lanes=v,Gm(a,v)}}var Pf={readContext:nn,useCallback:ar,useContext:ar,useEffect:ar,useImperativeHandle:ar,useInsertionEffect:ar,useLayoutEffect:ar,useMemo:ar,useReducer:ar,useRef:ar,useState:ar,useDebugValue:ar,useDeferredValue:ar,useTransition:ar,useMutableSource:ar,useSyncExternalStore:ar,useId:ar,unstable_isNewReconciler:!1},$B={readContext:nn,useCallback:function(a,c){return Hn().memoizedState=[a,c===void 0?null:c],a},useContext:nn,useEffect:aO,useImperativeHandle:function(a,c,v){return v=v!=null?v.concat([a]):null,Of(4194308,4,cO.bind(null,c,a),v)},useLayoutEffect:function(a,c){return Of(4194308,4,a,c)},useInsertionEffect:function(a,c){return Of(4,2,a,c)},useMemo:function(a,c){var v=Hn();return c=c===void 0?null:c,a=a(),v.memoizedState=[a,c],a},useReducer:function(a,c,v){var x=Hn();return c=v!==void 0?v(c):c,x.memoizedState=x.baseState=c,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:c},x.queue=a,a=a.dispatch=DB.bind(null,Et,a),[x.memoizedState,a]},useRef:function(a){var c=Hn();return a={current:a},c.memoizedState=a},useState:iO,useDebugValue:Hv,useDeferredValue:function(a){return Hn().memoizedState=a},useTransition:function(){var a=iO(!1),c=a[0];return a=IB.bind(null,a[1]),Hn().memoizedState=a,[c,a]},useMutableSource:function(){},useSyncExternalStore:function(a,c,v){var x=Et,_=Hn();if(_t){if(v===void 0)throw Error(r(407));v=v()}else{if(v=c(),Kt===null)throw Error(r(349));(ko&30)!==0||Jj(x,c,v)}_.memoizedState=v;var P={value:v,getSnapshot:c};return _.queue=P,aO(tO.bind(null,x,P,a),[a]),x.flags|=2048,Hl(9,eO.bind(null,x,P,v,c),void 0,null),v},useId:function(){var a=Hn(),c=Kt.identifierPrefix;if(_t){var v=hi,x=di;v=(x&~(1<<32-bn(x)-1)).toString(32)+v,c=":"+c+"R"+v,v=Ul++,0<\/script>",a=a.removeChild(a.firstChild)):typeof x.is=="string"?a=k.createElement(v,{is:x.is}):(a=k.createElement(v),v==="select"&&(k=a,x.multiple?k.multiple=!0:x.size&&(k.size=x.size))):a=k.createElementNS(a,v),a[Un]=c,a[Dl]=x,LO(a,c,!1,!1),c.stateNode=a;e:{switch(k=dt(v,x),v){case"dialog":bt("cancel",a),bt("close",a),_=x;break;case"iframe":case"object":case"embed":bt("load",a),_=x;break;case"video":case"audio":for(_=0;_Wa&&(c.flags|=128,x=!0,Vl(P,!1),c.lanes=4194304)}else{if(!x)if(a=Sf(k),a!==null){if(c.flags|=128,x=!0,v=a.updateQueue,v!==null&&(c.updateQueue=v,c.flags|=4),Vl(P,!0),P.tail===null&&P.tailMode==="hidden"&&!k.alternate&&!_t)return sr(c),null}else 2*Tt()-P.renderingStartTime>Wa&&v!==1073741824&&(c.flags|=128,x=!0,Vl(P,!1),c.lanes=4194304);P.isBackwards?(k.sibling=c.child,c.child=k):(v=P.last,v!==null?v.sibling=k:c.child=k,P.last=k)}return P.tail!==null?(c=P.tail,P.rendering=c,P.tail=c.sibling,P.renderingStartTime=Tt(),c.sibling=null,v=Ot.current,vt(Ot,x?v&1|2:v&1),c):(sr(c),null);case 22:case 23:return mg(),x=c.memoizedState!==null,a!==null&&a.memoizedState!==null!==x&&(c.flags|=8192),x&&(c.mode&1)!==0?(Fr&1073741824)!==0&&(sr(c),c.subtreeFlags&6&&(c.flags|=8192)):sr(c),null;case 24:return null;case 25:return null}throw Error(r(156,c.tag))}function VB(a,c){switch(jv(c),c.tag){case 1:return Pr(c.type)&&ff(),a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 3:return Fa(),wt(Er),wt(or),Lv(),a=c.flags,(a&65536)!==0&&(a&128)===0?(c.flags=a&-65537|128,c):null;case 5:return Iv(c),null;case 13:if(wt(Ot),a=c.memoizedState,a!==null&&a.dehydrated!==null){if(c.alternate===null)throw Error(r(340));Da()}return a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 19:return wt(Ot),null;case 4:return Fa(),null;case 10:return Cv(c.type._context),null;case 22:case 23:return mg(),null;case 24:return null;default:return null}}var Tf=!1,lr=!1,GB=typeof WeakSet=="function"?WeakSet:Set,Pe=null;function qa(a,c){var v=a.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(x){Pt(a,c,x)}else v.current=null}function ng(a,c,v){try{v()}catch(x){Pt(a,c,x)}}var FO=!1;function KB(a,c){if(mv=Yu,a=yj(),sv(a)){if("selectionStart"in a)var v={start:a.selectionStart,end:a.selectionEnd};else e:{v=(v=a.ownerDocument)&&v.defaultView||window;var x=v.getSelection&&v.getSelection();if(x&&x.rangeCount!==0){v=x.anchorNode;var _=x.anchorOffset,P=x.focusNode;x=x.focusOffset;try{v.nodeType,P.nodeType}catch{v=null;break e}var k=0,W=-1,X=-1,oe=0,he=0,pe=a,de=null;t:for(;;){for(var je;pe!==v||_!==0&&pe.nodeType!==3||(W=k+_),pe!==P||x!==0&&pe.nodeType!==3||(X=k+x),pe.nodeType===3&&(k+=pe.nodeValue.length),(je=pe.firstChild)!==null;)de=pe,pe=je;for(;;){if(pe===a)break t;if(de===v&&++oe===_&&(W=k),de===P&&++he===x&&(X=k),(je=pe.nextSibling)!==null)break;pe=de,de=pe.parentNode}pe=je}v=W===-1||X===-1?null:{start:W,end:X}}else v=null}v=v||{start:0,end:0}}else v=null;for(vv={focusedElem:a,selectionRange:v},Yu=!1,Pe=c;Pe!==null;)if(c=Pe,a=c.child,(c.subtreeFlags&1028)!==0&&a!==null)a.return=c,Pe=a;else for(;Pe!==null;){c=Pe;try{var Ae=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(Ae!==null){var ke=Ae.memoizedProps,kt=Ae.memoizedState,re=c.stateNode,Q=re.getSnapshotBeforeUpdate(c.elementType===c.type?ke:_n(c.type,ke),kt);re.__reactInternalSnapshotBeforeUpdate=Q}break;case 3:var ne=c.stateNode.containerInfo;ne.nodeType===1?ne.textContent="":ne.nodeType===9&&ne.documentElement&&ne.removeChild(ne.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(xe){Pt(c,c.return,xe)}if(a=c.sibling,a!==null){a.return=c.return,Pe=a;break}Pe=c.return}return Ae=FO,FO=!1,Ae}function Gl(a,c,v){var x=c.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var _=x=x.next;do{if((_.tag&a)===a){var P=_.destroy;_.destroy=void 0,P!==void 0&&ng(c,v,P)}_=_.next}while(_!==x)}}function kf(a,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var v=c=c.next;do{if((v.tag&a)===a){var x=v.create;v.destroy=x()}v=v.next}while(v!==c)}}function ig(a){var c=a.ref;if(c!==null){var v=a.stateNode;switch(a.tag){case 5:a=v;break;default:a=v}typeof c=="function"?c(a):c.current=a}}function zO(a){var c=a.alternate;c!==null&&(a.alternate=null,zO(c)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(c=a.stateNode,c!==null&&(delete c[Un],delete c[Dl],delete c[bv],delete c[CB],delete c[TB])),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function qO(a){return a.tag===5||a.tag===3||a.tag===4}function UO(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||qO(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function og(a,c,v){var x=a.tag;if(x===5||x===6)a=a.stateNode,c?v.nodeType===8?v.parentNode.insertBefore(a,c):v.insertBefore(a,c):(v.nodeType===8?(c=v.parentNode,c.insertBefore(a,v)):(c=v,c.appendChild(a)),v=v._reactRootContainer,v!=null||c.onclick!==null||(c.onclick=cf));else if(x!==4&&(a=a.child,a!==null))for(og(a,c,v),a=a.sibling;a!==null;)og(a,c,v),a=a.sibling}function ag(a,c,v){var x=a.tag;if(x===5||x===6)a=a.stateNode,c?v.insertBefore(a,c):v.appendChild(a);else if(x!==4&&(a=a.child,a!==null))for(ag(a,c,v),a=a.sibling;a!==null;)ag(a,c,v),a=a.sibling}var er=null,jn=!1;function Zi(a,c,v){for(v=v.child;v!==null;)WO(a,c,v),v=v.sibling}function WO(a,c,v){if(qn&&typeof qn.onCommitFiberUnmount=="function")try{qn.onCommitFiberUnmount(Wu,v)}catch{}switch(v.tag){case 5:lr||qa(v,c);case 6:var x=er,_=jn;er=null,Zi(a,c,v),er=x,jn=_,er!==null&&(jn?(a=er,v=v.stateNode,a.nodeType===8?a.parentNode.removeChild(v):a.removeChild(v)):er.removeChild(v.stateNode));break;case 18:er!==null&&(jn?(a=er,v=v.stateNode,a.nodeType===8?xv(a.parentNode,v):a.nodeType===1&&xv(a,v),Ol(a)):xv(er,v.stateNode));break;case 4:x=er,_=jn,er=v.stateNode.containerInfo,jn=!0,Zi(a,c,v),er=x,jn=_;break;case 0:case 11:case 14:case 15:if(!lr&&(x=v.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){_=x=x.next;do{var P=_,k=P.destroy;P=P.tag,k!==void 0&&((P&2)!==0||(P&4)!==0)&&ng(v,c,k),_=_.next}while(_!==x)}Zi(a,c,v);break;case 1:if(!lr&&(qa(v,c),x=v.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=v.memoizedProps,x.state=v.memoizedState,x.componentWillUnmount()}catch(W){Pt(v,c,W)}Zi(a,c,v);break;case 21:Zi(a,c,v);break;case 22:v.mode&1?(lr=(x=lr)||v.memoizedState!==null,Zi(a,c,v),lr=x):Zi(a,c,v);break;default:Zi(a,c,v)}}function HO(a){var c=a.updateQueue;if(c!==null){a.updateQueue=null;var v=a.stateNode;v===null&&(v=a.stateNode=new GB),c.forEach(function(x){var _=n8.bind(null,a,x);v.has(x)||(v.add(x),x.then(_,_))})}}function On(a,c){var v=c.deletions;if(v!==null)for(var x=0;x_&&(_=k),x&=~P}if(x=_,x=Tt()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*YB(x/1960))-x,10a?16:a,eo===null)var x=!1;else{if(a=eo,eo=null,Lf=0,(it&6)!==0)throw Error(r(331));var _=it;for(it|=4,Pe=a.current;Pe!==null;){var P=Pe,k=P.child;if((Pe.flags&16)!==0){var W=P.deletions;if(W!==null){for(var X=0;XTt()-cg?Io(a,0):lg|=v),Cr(a,c)}function iE(a,c){c===0&&((a.mode&1)===0?c=1:(c=Vu,Vu<<=1,(Vu&130023424)===0&&(Vu=4194304)));var v=mr();a=pi(a,c),a!==null&&(bl(a,c,v),Cr(a,v))}function r8(a){var c=a.memoizedState,v=0;c!==null&&(v=c.retryLane),iE(a,v)}function n8(a,c){var v=0;switch(a.tag){case 13:var x=a.stateNode,_=a.memoizedState;_!==null&&(v=_.retryLane);break;case 19:x=a.stateNode;break;default:throw Error(r(314))}x!==null&&x.delete(c),iE(a,v)}var oE;oE=function(a,c,v){if(a!==null)if(a.memoizedProps!==c.pendingProps||Er.current)Nr=!0;else{if((a.lanes&v)===0&&(c.flags&128)===0)return Nr=!1,WB(a,c,v);Nr=(a.flags&131072)!==0}else Nr=!1,_t&&(c.flags&1048576)!==0&&$j(c,mf,c.index);switch(c.lanes=0,c.tag){case 2:var x=c.type;Cf(a,c),a=c.pendingProps;var _=Ra(c,or.current);Ba(c,v),_=Fv(null,c,x,a,_,v);var P=zv();return c.flags|=1,typeof _=="object"&&_!==null&&typeof _.render=="function"&&_.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,Pr(x)?(P=!0,df(c)):P=!1,c.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,Rv(c),_.updater=Nf,c.stateNode=_,_._reactInternals=c,Gv(c,x,a,v),c=Qv(null,c,x,!0,P,v)):(c.tag=0,_t&&P&&_v(c),pr(null,c,_,v),c=c.child),c;case 16:x=c.elementType;e:{switch(Cf(a,c),a=c.pendingProps,_=x._init,x=_(x._payload),c.type=x,_=c.tag=o8(x),a=_n(x,a),_){case 0:c=Yv(null,c,x,a,v);break e;case 1:c=TO(null,c,x,a,v);break e;case 11:c=EO(null,c,x,a,v);break e;case 14:c=PO(null,c,x,_n(x.type,a),v);break e}throw Error(r(306,x,""))}return c;case 0:return x=c.type,_=c.pendingProps,_=c.elementType===x?_:_n(x,_),Yv(a,c,x,_,v);case 1:return x=c.type,_=c.pendingProps,_=c.elementType===x?_:_n(x,_),TO(a,c,x,_,v);case 3:e:{if(kO(c),a===null)throw Error(r(387));x=c.pendingProps,P=c.memoizedState,_=P.element,Gj(a,c),wf(c,x,null,v);var k=c.memoizedState;if(x=k.element,P.isDehydrated)if(P={element:x,isDehydrated:!1,cache:k.cache,pendingSuspenseBoundaries:k.pendingSuspenseBoundaries,transitions:k.transitions},c.updateQueue.baseState=P,c.memoizedState=P,c.flags&256){_=za(Error(r(423)),c),c=RO(a,c,x,v,_);break e}else if(x!==_){_=za(Error(r(424)),c),c=RO(a,c,x,v,_);break e}else for(Br=Vi(c.stateNode.containerInfo.firstChild),$r=c,_t=!0,Sn=null,v=Hj(c,null,x,v),c.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(Da(),x===_){c=vi(a,c,v);break e}pr(a,c,x,v)}c=c.child}return c;case 5:return Yj(c),a===null&&Ev(c),x=c.type,_=c.pendingProps,P=a!==null?a.memoizedProps:null,k=_.children,gv(x,_)?k=null:P!==null&&gv(x,P)&&(c.flags|=32),CO(a,c),pr(a,c,k,v),c.child;case 6:return a===null&&Ev(c),null;case 13:return MO(a,c,v);case 4:return Mv(c,c.stateNode.containerInfo),x=c.pendingProps,a===null?c.child=La(c,null,x,v):pr(a,c,x,v),c.child;case 11:return x=c.type,_=c.pendingProps,_=c.elementType===x?_:_n(x,_),EO(a,c,x,_,v);case 7:return pr(a,c,c.pendingProps,v),c.child;case 8:return pr(a,c,c.pendingProps.children,v),c.child;case 12:return pr(a,c,c.pendingProps.children,v),c.child;case 10:e:{if(x=c.type._context,_=c.pendingProps,P=c.memoizedProps,k=_.value,vt(yf,x._currentValue),x._currentValue=k,P!==null)if(wn(P.value,k)){if(P.children===_.children&&!Er.current){c=vi(a,c,v);break e}}else for(P=c.child,P!==null&&(P.return=c);P!==null;){var W=P.dependencies;if(W!==null){k=P.child;for(var X=W.firstContext;X!==null;){if(X.context===x){if(P.tag===1){X=mi(-1,v&-v),X.tag=2;var oe=P.updateQueue;if(oe!==null){oe=oe.shared;var he=oe.pending;he===null?X.next=X:(X.next=he.next,he.next=X),oe.pending=X}}P.lanes|=v,X=P.alternate,X!==null&&(X.lanes|=v),Tv(P.return,v,c),W.lanes|=v;break}X=X.next}}else if(P.tag===10)k=P.type===c.type?null:P.child;else if(P.tag===18){if(k=P.return,k===null)throw Error(r(341));k.lanes|=v,W=k.alternate,W!==null&&(W.lanes|=v),Tv(k,v,c),k=P.sibling}else k=P.child;if(k!==null)k.return=P;else for(k=P;k!==null;){if(k===c){k=null;break}if(P=k.sibling,P!==null){P.return=k.return,k=P;break}k=k.return}P=k}pr(a,c,_.children,v),c=c.child}return c;case 9:return _=c.type,x=c.pendingProps.children,Ba(c,v),_=nn(_),x=x(_),c.flags|=1,pr(a,c,x,v),c.child;case 14:return x=c.type,_=_n(x,c.pendingProps),_=_n(x.type,_),PO(a,c,x,_,v);case 15:return NO(a,c,c.type,c.pendingProps,v);case 17:return x=c.type,_=c.pendingProps,_=c.elementType===x?_:_n(x,_),Cf(a,c),c.tag=1,Pr(x)?(a=!0,df(c)):a=!1,Ba(c,v),xO(c,x,_),Gv(c,x,_,v),Qv(null,c,x,!0,a,v);case 19:return DO(a,c,v);case 22:return AO(a,c,v)}throw Error(r(156,c.tag))};function aE(a,c){return B_(a,c)}function i8(a,c,v,x){this.tag=a,this.key=v,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function sn(a,c,v,x){return new i8(a,c,v,x)}function gg(a){return a=a.prototype,!(!a||!a.isReactComponent)}function o8(a){if(typeof a=="function")return gg(a)?1:0;if(a!=null){if(a=a.$$typeof,a===$)return 11;if(a===q)return 14}return 2}function no(a,c){var v=a.alternate;return v===null?(v=sn(a.tag,c,a.key,a.mode),v.elementType=a.elementType,v.type=a.type,v.stateNode=a.stateNode,v.alternate=a,a.alternate=v):(v.pendingProps=c,v.type=a.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=a.flags&14680064,v.childLanes=a.childLanes,v.lanes=a.lanes,v.child=a.child,v.memoizedProps=a.memoizedProps,v.memoizedState=a.memoizedState,v.updateQueue=a.updateQueue,c=a.dependencies,v.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},v.sibling=a.sibling,v.index=a.index,v.ref=a.ref,v}function zf(a,c,v,x,_,P){var k=2;if(x=a,typeof a=="function")gg(a)&&(k=1);else if(typeof a=="string")k=5;else e:switch(a){case T:return Lo(v.children,_,P,c);case R:k=8,_|=8;break;case I:return a=sn(12,v,c,_|2),a.elementType=I,a.lanes=P,a;case U:return a=sn(13,v,c,_),a.elementType=U,a.lanes=P,a;case G:return a=sn(19,v,c,_),a.elementType=G,a.lanes=P,a;case V:return qf(v,_,P,c);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case F:k=10;break e;case L:k=9;break e;case $:k=11;break e;case q:k=14;break e;case H:k=16,x=null;break e}throw Error(r(130,a==null?a:typeof a,""))}return c=sn(k,v,c,_),c.elementType=a,c.type=x,c.lanes=P,c}function Lo(a,c,v,x){return a=sn(7,a,x,c),a.lanes=v,a}function qf(a,c,v,x){return a=sn(22,a,x,c),a.elementType=V,a.lanes=v,a.stateNode={isHidden:!1},a}function yg(a,c,v){return a=sn(6,a,null,c),a.lanes=v,a}function xg(a,c,v){return c=sn(4,a.children!==null?a.children:[],a.key,c),c.lanes=v,c.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},c}function a8(a,c,v,x,_){this.tag=c,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vm(0),this.expirationTimes=Vm(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vm(0),this.identifierPrefix=x,this.onRecoverableError=_,this.mutableSourceEagerHydrationData=null}function bg(a,c,v,x,_,P,k,W,X){return a=new a8(a,c,v,W,X),c===1?(c=1,P===!0&&(c|=8)):c=0,P=sn(3,null,null,c),a.current=P,P.stateNode=a,P.memoizedState={element:x,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},Rv(P),a}function s8(a,c,v){var x=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Eg.exports=x8(),Eg.exports}var bE;function b8(){if(bE)return Yf;bE=1;var e=aM();return Yf.createRoot=e.createRoot,Yf.hydrateRoot=e.hydrateRoot,Yf}var w8=b8(),S=jp();const z=ct(S),Uw=h8({__proto__:null,default:z},[S]);/** - * @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 S8=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_8=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),wE=e=>{const t=_8(e);return t.charAt(0).toUpperCase()+t.slice(1)},sM=(...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 j8={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 O8=S.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:o,iconNode:s,...u},f)=>S.createElement("svg",{ref:f,...j8,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:sM("lucide",i),...u},[...s.map(([l,h])=>S.createElement(l,h)),...Array.isArray(o)?o:[o]]));/** - * @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 De=(e,t)=>{const r=S.forwardRef(({className:n,...i},o)=>S.createElement(O8,{ref:o,iconNode:t,className:sM(`lucide-${S8(wE(e))}`,`lucide-${e}`,n),...i}));return r.displayName=wE(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 E8=[["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"}]],P8=De("arrow-down-a-z",E8);/** - * @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 N8=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],A8=De("arrow-down-right",N8);/** - * @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 C8=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],T8=De("arrow-left",C8);/** - * @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 k8=[["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"}]],R8=De("arrow-up-down",k8);/** - * @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=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],lM=De("arrow-up-right",M8);/** - * @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 I8=[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M8 5v14",key:"1ybrkv"}],["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"M17 5v14",key:"ycjyhj"}],["path",{d:"M21 5v14",key:"nzette"}]],D8=De("barcode",I8);/** - * @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 L8=[["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"}]],$8=De("calendar",L8);/** - * @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 B8=[["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"}]],F8=De("chart-column",B8);/** - * @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:"M20 6 9 17l-5-5",key:"1gmf2c"}]],cM=De("check",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 q8=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],xs=De("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 U8=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],uM=De("chevron-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 W8=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],bs=De("chevron-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 H8=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],V8=De("chevron-up",H8);/** - * @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=[["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"}]],oh=De("circle-help",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 K8=[["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"}]],X8=De("circle-user",K8);/** - * @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:"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"}]],Q8=De("coffee",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 Z8=[["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"}]],Ww=De("download",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 J8=[["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"}]],Hw=De("ellipsis",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 eF=[["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"}]],fM=De("file-box",eF);/** - * @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 tF=[["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"}]],ws=De("file-text",tF);/** - * @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 rF=[["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"}]],nF=De("grid-3x3",rF);/** - * @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 iF=[["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"}]],Jo=De("image",iF);/** - * @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 oF=[["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=De("layers",oF);/** - * @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 aF=[["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"}]],hM=De("layout-dashboard",aF);/** - * @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 sF=[["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"}]],lF=De("list",sF);/** - * @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 cF=[["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"}]],uF=De("log-out",cF);/** - * @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 fF=[["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"}]],Zs=De("map-pin",fF);/** - * @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 dF=[["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"}]],hF=De("menu",dF);/** - * @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 pF=[["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"}]],ah=De("package",pF);/** - * @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 mF=[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]],pM=De("palette",mF);/** - * @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 vF=[["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"}]],eh=De("pencil",vF);/** - * @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 gF=[["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"}]],yF=De("pin",gF);/** - * @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 xF=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Rr=De("plus",xF);/** - * @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 bF=[["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"}]],mM=De("printer",bF);/** - * @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 wF=[["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"}]],SF=De("refresh-cw",wF);/** - * @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 _F=[["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"}]],jF=De("save",_F);/** - * @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 OF=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Vw=De("search",OF);/** - * @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 EF=[["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"}]],sh=De("settings",EF);/** - * @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 PF=[["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"}]],NF=De("shield",PF);/** - * @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 AF=[["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"}]],co=De("square-pen",AF);/** - * @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 CF=[["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"}]],TF=De("store",CF);/** - * @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 kF=[["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"}]],Ag=De("syringe",kF);/** - * @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 RF=[["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"}]],MF=De("tablet",RF);/** - * @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 IF=[["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"}]],lh=De("tag",IF);/** - * @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 DF=[["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"}]],LF=De("timer",DF);/** - * @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 $F=[["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"}]],Nc=De("trash-2",$F);/** - * @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 BF=[["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"}]],FF=De("trending-up",BF);/** - * @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 zF=[["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"}]],Op=De("type",zF);/** - * @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 qF=[["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"}]],UF=De("upload",qF);/** - * @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 WF=[["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"}]],HF=De("user",WF);/** - * @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 VF=[["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"}]],Gw=De("users",VF);/** - * @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 GF=[["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"}]],KF=De("utensils",GF);/** - * @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 XF=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],xc=De("x",XF);function vM(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{const r=new Array(e.length+t.length);for(let n=0;n({classGroupId:e,validator:t}),gM=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),ch="-",SE=[],ZF="arbitrary..",JF=e=>{const t=t6(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return e6(s);const u=s.split(ch),f=u[0]===""&&u.length>1?1:0;return yM(u,f,t)},getConflictingClassGroupIds:(s,u)=>{if(u){const f=n[s],l=r[s];return f?l?YF(l,f):f:l||SE}return r[s]||SE}}},yM=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],o=r.nextPart.get(i);if(o){const l=yM(e,t+1,o);if(l)return l}const s=r.validators;if(s===null)return;const u=t===0?e.join(ch):e.slice(t).join(ch),f=s.length;for(let l=0;le.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?ZF+n:void 0})(),t6=e=>{const{theme:t,classGroups:r}=e;return r6(r,t)},r6=(e,t)=>{const r=gM();for(const n in e){const i=e[n];Kw(i,r,n,t)}return r},Kw=(e,t,r,n)=>{const i=e.length;for(let o=0;o{if(typeof e=="string"){i6(e,t,r);return}if(typeof e=="function"){o6(e,t,r,n);return}a6(e,t,r,n)},i6=(e,t,r)=>{const n=e===""?t:xM(t,e);n.classGroupId=r},o6=(e,t,r,n)=>{if(s6(e)){Kw(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(QF(r,e))},a6=(e,t,r,n)=>{const i=Object.entries(e),o=i.length;for(let s=0;s{let r=e;const n=t.split(ch),i=n.length;for(let o=0;o"isThemeGetter"in e&&e.isThemeGetter===!0,l6=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const i=(o,s)=>{r[o]=s,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(o){let s=r[o];if(s!==void 0)return s;if((s=n[o])!==void 0)return i(o,s),s},set(o,s){o in r?r[o]=s:i(o,s)}}},Jb="!",_E=":",c6=[],jE=(e,t,r,n,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),u6=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=i=>{const o=[];let s=0,u=0,f=0,l;const h=i.length;for(let y=0;yf?l-f:void 0;return jE(o,g,m,b)};if(t){const i=t+_E,o=n;n=s=>s.startsWith(i)?o(s.slice(i.length)):jE(c6,!1,s,void 0,!0)}if(r){const i=n;n=o=>r({className:o,parseClassName:i})}return n},f6=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let o=0;o0&&(i.sort(),n.push(...i),i=[]),n.push(s)):i.push(s)}return i.length>0&&(i.sort(),n.push(...i)),n}},d6=e=>({cache:l6(e.cacheSize),parseClassName:u6(e),sortModifiers:f6(e),...JF(e)}),h6=/\s+/,p6=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:o}=t,s=[],u=e.trim().split(h6);let f="";for(let l=u.length-1;l>=0;l-=1){const h=u[l],{isExternal:p,modifiers:m,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:y}=r(h);if(p){f=h+(f.length>0?" "+f:f);continue}let w=!!y,j=n(w?b.substring(0,y):b);if(!j){if(!w){f=h+(f.length>0?" "+f:f);continue}if(j=n(b),!j){f=h+(f.length>0?" "+f:f);continue}w=!1}const O=m.length===0?"":m.length===1?m[0]:o(m).join(":"),E=g?O+Jb:O,A=E+j;if(s.indexOf(A)>-1)continue;s.push(A);const N=i(j,w);for(let C=0;C0?" "+f:f)}return f},m6=(...e)=>{let t=0,r,n,i="";for(;t{if(typeof e=="string")return e;let t,r="";for(let n=0;n{let r,n,i,o;const s=f=>{const l=t.reduce((h,p)=>p(h),e());return r=d6(l),n=r.cache.get,i=r.cache.set,o=u,u(f)},u=f=>{const l=n(f);if(l)return l;const h=p6(f,r);return i(f,h),h};return o=s,(...f)=>o(m6(...f))},g6=[],zt=e=>{const t=r=>r[e]||g6;return t.isThemeGetter=!0,t},wM=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,SM=/^\((?:(\w[\w-]*):)?(.+)\)$/i,y6=/^\d+\/\d+$/,x6=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,b6=/\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$/,w6=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,S6=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_6=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Va=e=>y6.test(e),Ke=e=>!!e&&!Number.isNaN(Number(e)),oo=e=>!!e&&Number.isInteger(Number(e)),Cg=e=>e.endsWith("%")&&Ke(e.slice(0,-1)),yi=e=>x6.test(e),j6=()=>!0,O6=e=>b6.test(e)&&!w6.test(e),_M=()=>!1,E6=e=>S6.test(e),P6=e=>_6.test(e),N6=e=>!Ce(e)&&!Te(e),A6=e=>Js(e,EM,_M),Ce=e=>wM.test(e),$o=e=>Js(e,PM,O6),Tg=e=>Js(e,M6,Ke),OE=e=>Js(e,jM,_M),C6=e=>Js(e,OM,P6),Qf=e=>Js(e,NM,E6),Te=e=>SM.test(e),Jl=e=>el(e,PM),T6=e=>el(e,I6),EE=e=>el(e,jM),k6=e=>el(e,EM),R6=e=>el(e,OM),Zf=e=>el(e,NM,!0),Js=(e,t,r)=>{const n=wM.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},el=(e,t,r=!1)=>{const n=SM.exec(e);return n?n[1]?t(n[1]):r:!1},jM=e=>e==="position"||e==="percentage",OM=e=>e==="image"||e==="url",EM=e=>e==="length"||e==="size"||e==="bg-size",PM=e=>e==="length",M6=e=>e==="number",I6=e=>e==="family-name",NM=e=>e==="shadow",D6=()=>{const e=zt("color"),t=zt("font"),r=zt("text"),n=zt("font-weight"),i=zt("tracking"),o=zt("leading"),s=zt("breakpoint"),u=zt("container"),f=zt("spacing"),l=zt("radius"),h=zt("shadow"),p=zt("inset-shadow"),m=zt("text-shadow"),g=zt("drop-shadow"),b=zt("blur"),y=zt("perspective"),w=zt("aspect"),j=zt("ease"),O=zt("animate"),E=()=>["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"],N=()=>[...A(),Te,Ce],C=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],R=()=>[Te,Ce,f],I=()=>[Va,"full","auto",...R()],F=()=>[oo,"none","subgrid",Te,Ce],L=()=>["auto",{span:["full",oo,Te,Ce]},oo,Te,Ce],$=()=>[oo,"auto",Te,Ce],U=()=>["auto","min","max","fr",Te,Ce],G=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],q=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...R()],V=()=>[Va,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],D=()=>[e,Te,Ce],Z=()=>[...A(),EE,OE,{position:[Te,Ce]}],J=()=>["no-repeat",{repeat:["","x","y","space","round"]}],M=()=>["auto","cover","contain",k6,A6,{size:[Te,Ce]}],B=()=>[Cg,Jl,$o],ee=()=>["","none","full",l,Te,Ce],ae=()=>["",Ke,Jl,$o],ie=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[Ke,Cg,EE,OE],ce=()=>["","none",b,Te,Ce],te=()=>["none",Ke,Te,Ce],le=()=>["none",Ke,Te,Ce],ge=()=>[Ke,Te,Ce],Y=()=>[Va,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[yi],breakpoint:[yi],color:[j6],container:[yi],"drop-shadow":[yi],ease:["in","out","in-out"],font:[N6],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[yi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[yi],shadow:[yi],spacing:["px",Ke],text:[yi],"text-shadow":[yi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Va,Ce,Te,w]}],container:["container"],columns:[{columns:[Ke,Ce,Te,u]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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:N()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{start:I()}],end:[{end:I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[oo,"auto",Te,Ce]}],basis:[{basis:[Va,"full","auto",u,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ke,Va,"auto","initial","none",Ce]}],grow:[{grow:["",Ke,Te,Ce]}],shrink:[{shrink:["",Ke,Te,Ce]}],order:[{order:[oo,"first","last","none",Te,Ce]}],"grid-cols":[{"grid-cols":F()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":F()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":U()}],"auto-rows":[{"auto-rows":U()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...G(),"normal"]}],"justify-items":[{"justify-items":[...q(),"normal"]}],"justify-self":[{"justify-self":["auto",...q()]}],"align-content":[{content:["normal",...G()]}],"align-items":[{items:[...q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...q(),{baseline:["","last"]}]}],"place-content":[{"place-content":G()}],"place-items":[{"place-items":[...q(),"baseline"]}],"place-self":[{"place-self":["auto",...q()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],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":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],w:[{w:[u,"screen",...V()]}],"min-w":[{"min-w":[u,"screen","none",...V()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[s]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",r,Jl,$o]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Te,Tg]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Cg,Ce]}],"font-family":[{font:[T6,Ce,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:[i,Te,Ce]}],"line-clamp":[{"line-clamp":[Ke,"none",Te,Tg]}],leading:[{leading:[o,...R()]}],"list-image":[{"list-image":["none",Te,Ce]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Te,Ce]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ke,"from-font","auto",Te,$o]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[Ke,"auto",Te,Ce]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Te,Ce]}],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",Te,Ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Z()}],"bg-repeat":[{bg:J()}],"bg-size":[{bg:M()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},oo,Te,Ce],radial:["",Te,Ce],conic:[oo,Te,Ce]},R6,C6]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:ee()}],"rounded-s":[{"rounded-s":ee()}],"rounded-e":[{"rounded-e":ee()}],"rounded-t":[{"rounded-t":ee()}],"rounded-r":[{"rounded-r":ee()}],"rounded-b":[{"rounded-b":ee()}],"rounded-l":[{"rounded-l":ee()}],"rounded-ss":[{"rounded-ss":ee()}],"rounded-se":[{"rounded-se":ee()}],"rounded-ee":[{"rounded-ee":ee()}],"rounded-es":[{"rounded-es":ee()}],"rounded-tl":[{"rounded-tl":ee()}],"rounded-tr":[{"rounded-tr":ee()}],"rounded-br":[{"rounded-br":ee()}],"rounded-bl":[{"rounded-bl":ee()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ke,Te,Ce]}],"outline-w":[{outline:["",Ke,Jl,$o]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",h,Zf,Qf]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",p,Zf,Qf]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[Ke,$o]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",m,Zf,Qf]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[Ke,Te,Ce]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"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":[Ke]}],"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":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"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":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"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":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"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":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"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":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"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":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"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":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[Te,Ce]}],"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":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"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":[Ke]}],"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":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Z()}],"mask-repeat":[{mask:J()}],"mask-size":[{mask:M()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Te,Ce]}],filter:[{filter:["","none",Te,Ce]}],blur:[{blur:ce()}],brightness:[{brightness:[Ke,Te,Ce]}],contrast:[{contrast:[Ke,Te,Ce]}],"drop-shadow":[{"drop-shadow":["","none",g,Zf,Qf]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",Ke,Te,Ce]}],"hue-rotate":[{"hue-rotate":[Ke,Te,Ce]}],invert:[{invert:["",Ke,Te,Ce]}],saturate:[{saturate:[Ke,Te,Ce]}],sepia:[{sepia:["",Ke,Te,Ce]}],"backdrop-filter":[{"backdrop-filter":["","none",Te,Ce]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[Ke,Te,Ce]}],"backdrop-contrast":[{"backdrop-contrast":[Ke,Te,Ce]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ke,Te,Ce]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ke,Te,Ce]}],"backdrop-invert":[{"backdrop-invert":["",Ke,Te,Ce]}],"backdrop-opacity":[{"backdrop-opacity":[Ke,Te,Ce]}],"backdrop-saturate":[{"backdrop-saturate":[Ke,Te,Ce]}],"backdrop-sepia":[{"backdrop-sepia":["",Ke,Te,Ce]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Te,Ce]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ke,"initial",Te,Ce]}],ease:[{ease:["linear","initial",j,Te,Ce]}],delay:[{delay:[Ke,Te,Ce]}],animate:[{animate:["none",O,Te,Ce]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[y,Te,Ce]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:te()}],"rotate-x":[{"rotate-x":te()}],"rotate-y":[{"rotate-y":te()}],"rotate-z":[{"rotate-z":te()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:ge()}],"skew-x":[{"skew-x":ge()}],"skew-y":[{"skew-y":ge()}],transform:[{transform:[Te,Ce,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"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:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"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",Te,Ce]}],"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":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",Te,Ce]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[Ke,Jl,$o,Tg]}],stroke:[{stroke:["none",...D()]}],"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"]}},L6=v6(D6);function Re(...e){return L6(He(e))}var pu=aM();const $6=ct(pu);function PE(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ha(...e){return t=>{let r=!1;const n=e.map(i=>{const o=PE(i,t);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let i=0;i{const{children:o,...s}=n,u=S.Children.toArray(o),f=u.find(q6);if(f){const l=f.props.children,h=u.map(p=>p===f?S.Children.count(l)>1?S.Children.only(null):S.isValidElement(l)?l.props.children:null:p);return d.jsx(t,{...s,ref:i,children:S.isValidElement(l)?S.cloneElement(l,void 0,h):null})}return d.jsx(t,{...s,ref:i,children:o})});return r.displayName=`${e}.Slot`,r}function F6(e){const t=S.forwardRef((r,n)=>{const{children:i,...o}=r;if(S.isValidElement(i)){const s=W6(i),u=U6(o,i.props);return i.type!==S.Fragment&&(u.ref=n?ha(n,s):s),S.cloneElement(i,u)}return S.Children.count(i)>1?S.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var z6=Symbol("radix.slottable");function q6(e){return S.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===z6}function U6(e,t){const r={...t};for(const n in t){const i=e[n],o=t[n];/^on[A-Z]/.test(n)?i&&o?r[n]=(...u)=>{const f=o(...u);return i(...u),f}:i&&(r[n]=i):n==="style"?r[n]={...i,...o}:n==="className"&&(r[n]=[i,o].filter(Boolean).join(" "))}return{...e,...r}}function W6(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 H6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ue=H6.reduce((e,t)=>{const r=B6(`Primitive.${t}`),n=S.forwardRef((i,o)=>{const{asChild:s,...u}=i,f=s?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(f,{...u,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function V6(e,t){e&&pu.flushSync(()=>e.dispatchEvent(t))}var Lt=globalThis?.document?S.useLayoutEffect:()=>{};function G6(e,t){return S.useReducer((r,n)=>t[r][n]??r,e)}var Mr=e=>{const{present:t,children:r}=e,n=K6(t),i=typeof r=="function"?r({present:n.isPresent}):S.Children.only(r),o=Ze(n.ref,X6(i));return typeof r=="function"||n.isPresent?S.cloneElement(i,{ref:o}):null};Mr.displayName="Presence";function K6(e){const[t,r]=S.useState(),n=S.useRef(null),i=S.useRef(e),o=S.useRef("none"),s=e?"mounted":"unmounted",[u,f]=G6(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{const l=Jf(n.current);o.current=u==="mounted"?l:"none"},[u]),Lt(()=>{const l=n.current,h=i.current;if(h!==e){const m=o.current,g=Jf(l);e?f("MOUNT"):g==="none"||l?.display==="none"?f("UNMOUNT"):f(h&&m!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,f]),Lt(()=>{if(t){let l;const h=t.ownerDocument.defaultView??window,p=g=>{const y=Jf(n.current).includes(CSS.escape(g.animationName));if(g.target===t&&y&&(f("ANIMATION_END"),!i.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",l=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},m=g=>{g.target===t&&(o.current=Jf(n.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{h.clearTimeout(l),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:S.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function Jf(e){return e?.animationName||"none"}function X6(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 Y6(e,t){const r=S.createContext(t),n=o=>{const{children:s,...u}=o,f=S.useMemo(()=>u,Object.values(u));return d.jsx(r.Provider,{value:f,children:s})};n.displayName=e+"Provider";function i(o){const s=S.useContext(r);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[n,i]}function Bn(e,t=[]){let r=[];function n(o,s){const u=S.createContext(s),f=r.length;r=[...r,s];const l=p=>{const{scope:m,children:g,...b}=p,y=m?.[e]?.[f]||u,w=S.useMemo(()=>b,Object.values(b));return d.jsx(y.Provider,{value:w,children:g})};l.displayName=o+"Provider";function h(p,m){const g=m?.[e]?.[f]||u,b=S.useContext(g);if(b)return b;if(s!==void 0)return s;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[l,h]}const i=()=>{const o=r.map(s=>S.createContext(s));return function(u){const f=u?.[e]||o;return S.useMemo(()=>({[`__scope${e}`]:{...u,[e]:f}}),[u,f])}};return i.scopeName=e,[n,Q6(i,...t)]}function Q6(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=n.reduce((u,{useScope:f,scopeName:l})=>{const p=f(o)[`__scope${l}`];return{...u,...p}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}function fr(e){const t=S.useRef(e);return S.useEffect(()=>{t.current=e}),S.useMemo(()=>(...r)=>t.current?.(...r),[])}var Z6=S.createContext(void 0);function Ep(e){const t=S.useContext(Z6);return e||t||"ltr"}function e1(e,[t,r]){return Math.min(r,Math.max(t,e))}function Ie(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e?.(i),r===!1||!i.defaultPrevented)return t?.(i)}}function J6(e,t){return S.useReducer((r,n)=>t[r][n]??r,e)}var Xw="ScrollArea",[AM]=Bn(Xw),[ez,gn]=AM(Xw),CM=S.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:o=600,...s}=e,[u,f]=S.useState(null),[l,h]=S.useState(null),[p,m]=S.useState(null),[g,b]=S.useState(null),[y,w]=S.useState(null),[j,O]=S.useState(0),[E,A]=S.useState(0),[N,C]=S.useState(!1),[T,R]=S.useState(!1),I=Ze(t,L=>f(L)),F=Ep(i);return d.jsx(ez,{scope:r,type:n,dir:F,scrollHideDelay:o,scrollArea:u,viewport:l,onViewportChange:h,content:p,onContentChange:m,scrollbarX:g,onScrollbarXChange:b,scrollbarXEnabled:N,onScrollbarXEnabledChange:C,scrollbarY:y,onScrollbarYChange:w,scrollbarYEnabled:T,onScrollbarYEnabledChange:R,onCornerWidthChange:O,onCornerHeightChange:A,children:d.jsx(Ue.div,{dir:F,...s,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":j+"px","--radix-scroll-area-corner-height":E+"px",...e.style}})})});CM.displayName=Xw;var TM="ScrollAreaViewport",kM=S.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...o}=e,s=gn(TM,r),u=S.useRef(null),f=Ze(t,u,s.onViewportChange);return d.jsxs(d.Fragment,{children:[d.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:i}),d.jsx(Ue.div,{"data-radix-scroll-area-viewport":"",...o,ref:f,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:d.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});kM.displayName=TM;var ii="ScrollAreaScrollbar",RM=S.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=gn(ii,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:s}=i,u=e.orientation==="horizontal";return S.useEffect(()=>(u?o(!0):s(!0),()=>{u?o(!1):s(!1)}),[u,o,s]),i.type==="hover"?d.jsx(tz,{...n,ref:t,forceMount:r}):i.type==="scroll"?d.jsx(rz,{...n,ref:t,forceMount:r}):i.type==="auto"?d.jsx(MM,{...n,ref:t,forceMount:r}):i.type==="always"?d.jsx(Yw,{...n,ref:t}):null});RM.displayName=ii;var tz=S.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=gn(ii,e.__scopeScrollArea),[o,s]=S.useState(!1);return S.useEffect(()=>{const u=i.scrollArea;let f=0;if(u){const l=()=>{window.clearTimeout(f),s(!0)},h=()=>{f=window.setTimeout(()=>s(!1),i.scrollHideDelay)};return u.addEventListener("pointerenter",l),u.addEventListener("pointerleave",h),()=>{window.clearTimeout(f),u.removeEventListener("pointerenter",l),u.removeEventListener("pointerleave",h)}}},[i.scrollArea,i.scrollHideDelay]),d.jsx(Mr,{present:r||o,children:d.jsx(MM,{"data-state":o?"visible":"hidden",...n,ref:t})})}),rz=S.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=gn(ii,e.__scopeScrollArea),o=e.orientation==="horizontal",s=Np(()=>f("SCROLL_END"),100),[u,f]=J6("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 S.useEffect(()=>{if(u==="idle"){const l=window.setTimeout(()=>f("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(l)}},[u,i.scrollHideDelay,f]),S.useEffect(()=>{const l=i.viewport,h=o?"scrollLeft":"scrollTop";if(l){let p=l[h];const m=()=>{const g=l[h];p!==g&&(f("SCROLL"),s()),p=g};return l.addEventListener("scroll",m),()=>l.removeEventListener("scroll",m)}},[i.viewport,o,f,s]),d.jsx(Mr,{present:r||u!=="hidden",children:d.jsx(Yw,{"data-state":u==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:Ie(e.onPointerEnter,()=>f("POINTER_ENTER")),onPointerLeave:Ie(e.onPointerLeave,()=>f("POINTER_LEAVE"))})})}),MM=S.forwardRef((e,t)=>{const r=gn(ii,e.__scopeScrollArea),{forceMount:n,...i}=e,[o,s]=S.useState(!1),u=e.orientation==="horizontal",f=Np(()=>{if(r.viewport){const l=r.viewport.offsetWidth{const{orientation:r="vertical",...n}=e,i=gn(ii,e.__scopeScrollArea),o=S.useRef(null),s=S.useRef(0),[u,f]=S.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=BM(u.viewport,u.content),h={...n,sizes:u,onSizesChange:f,hasThumb:l>0&&l<1,onThumbChange:m=>o.current=m,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:m=>s.current=m};function p(m,g){return lz(m,s.current,u,g)}return r==="horizontal"?d.jsx(nz,{...h,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const m=i.viewport.scrollLeft,g=NE(m,u,i.dir);o.current.style.transform=`translate3d(${g}px, 0, 0)`}},onWheelScroll:m=>{i.viewport&&(i.viewport.scrollLeft=m)},onDragScroll:m=>{i.viewport&&(i.viewport.scrollLeft=p(m,i.dir))}}):r==="vertical"?d.jsx(iz,{...h,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const m=i.viewport.scrollTop,g=NE(m,u);o.current.style.transform=`translate3d(0, ${g}px, 0)`}},onWheelScroll:m=>{i.viewport&&(i.viewport.scrollTop=m)},onDragScroll:m=>{i.viewport&&(i.viewport.scrollTop=p(m))}}):null}),nz=S.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,o=gn(ii,e.__scopeScrollArea),[s,u]=S.useState(),f=S.useRef(null),l=Ze(t,f,o.onScrollbarXChange);return S.useEffect(()=>{f.current&&u(getComputedStyle(f.current))},[f]),d.jsx(DM,{"data-orientation":"horizontal",...i,ref:l,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Pp(r)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,p)=>{if(o.viewport){const m=o.viewport.scrollLeft+h.deltaX;e.onWheelScroll(m),zM(m,p)&&h.preventDefault()}},onResize:()=>{f.current&&o.viewport&&s&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:f.current.clientWidth,paddingStart:fh(s.paddingLeft),paddingEnd:fh(s.paddingRight)}})}})}),iz=S.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,o=gn(ii,e.__scopeScrollArea),[s,u]=S.useState(),f=S.useRef(null),l=Ze(t,f,o.onScrollbarYChange);return S.useEffect(()=>{f.current&&u(getComputedStyle(f.current))},[f]),d.jsx(DM,{"data-orientation":"vertical",...i,ref:l,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Pp(r)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,p)=>{if(o.viewport){const m=o.viewport.scrollTop+h.deltaY;e.onWheelScroll(m),zM(m,p)&&h.preventDefault()}},onResize:()=>{f.current&&o.viewport&&s&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:f.current.clientHeight,paddingStart:fh(s.paddingTop),paddingEnd:fh(s.paddingBottom)}})}})}),[oz,IM]=AM(ii),DM=S.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:o,onThumbPointerUp:s,onThumbPointerDown:u,onThumbPositionChange:f,onDragScroll:l,onWheelScroll:h,onResize:p,...m}=e,g=gn(ii,r),[b,y]=S.useState(null),w=Ze(t,I=>y(I)),j=S.useRef(null),O=S.useRef(""),E=g.viewport,A=n.content-n.viewport,N=fr(h),C=fr(f),T=Np(p,10);function R(I){if(j.current){const F=I.clientX-j.current.left,L=I.clientY-j.current.top;l({x:F,y:L})}}return S.useEffect(()=>{const I=F=>{const L=F.target;b?.contains(L)&&N(F,A)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[E,b,A,N]),S.useEffect(C,[n,C]),Ss(b,T),Ss(g.content,T),d.jsx(oz,{scope:r,scrollbar:b,hasThumb:i,onThumbChange:fr(o),onThumbPointerUp:fr(s),onThumbPositionChange:C,onThumbPointerDown:fr(u),children:d.jsx(Ue.div,{...m,ref:w,style:{position:"absolute",...m.style},onPointerDown:Ie(e.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),j.current=b.getBoundingClientRect(),O.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",g.viewport&&(g.viewport.style.scrollBehavior="auto"),R(I))}),onPointerMove:Ie(e.onPointerMove,R),onPointerUp:Ie(e.onPointerUp,I=>{const F=I.target;F.hasPointerCapture(I.pointerId)&&F.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=O.current,g.viewport&&(g.viewport.style.scrollBehavior=""),j.current=null})})})}),uh="ScrollAreaThumb",LM=S.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=IM(uh,e.__scopeScrollArea);return d.jsx(Mr,{present:r||i.hasThumb,children:d.jsx(az,{ref:t,...n})})}),az=S.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,o=gn(uh,r),s=IM(uh,r),{onThumbPositionChange:u}=s,f=Ze(t,p=>s.onThumbChange(p)),l=S.useRef(void 0),h=Np(()=>{l.current&&(l.current(),l.current=void 0)},100);return S.useEffect(()=>{const p=o.viewport;if(p){const m=()=>{if(h(),!l.current){const g=cz(p,u);l.current=g,u()}};return u(),p.addEventListener("scroll",m),()=>p.removeEventListener("scroll",m)}},[o.viewport,h,u]),d.jsx(Ue.div,{"data-state":s.hasThumb?"visible":"hidden",...i,ref:f,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Ie(e.onPointerDownCapture,p=>{const g=p.target.getBoundingClientRect(),b=p.clientX-g.left,y=p.clientY-g.top;s.onThumbPointerDown({x:b,y})}),onPointerUp:Ie(e.onPointerUp,s.onThumbPointerUp)})});LM.displayName=uh;var Qw="ScrollAreaCorner",$M=S.forwardRef((e,t)=>{const r=gn(Qw,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?d.jsx(sz,{...e,ref:t}):null});$M.displayName=Qw;var sz=S.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=gn(Qw,r),[o,s]=S.useState(0),[u,f]=S.useState(0),l=!!(o&&u);return Ss(i.scrollbarX,()=>{const h=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(h),f(h)}),Ss(i.scrollbarY,()=>{const h=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(h),s(h)}),l?d.jsx(Ue.div,{...n,ref:t,style:{width:o,height:u,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function fh(e){return e?parseInt(e,10):0}function BM(e,t){const r=e/t;return isNaN(r)?0:r}function Pp(e){const t=BM(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function lz(e,t,r,n="ltr"){const i=Pp(r),o=i/2,s=t||o,u=i-s,f=r.scrollbar.paddingStart+s,l=r.scrollbar.size-r.scrollbar.paddingEnd-u,h=r.content-r.viewport,p=n==="ltr"?[0,h]:[h*-1,0];return FM([f,l],p)(e)}function NE(e,t,r="ltr"){const n=Pp(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-i,s=t.content-t.viewport,u=o-n,f=r==="ltr"?[0,s]:[s*-1,0],l=e1(e,f);return FM([0,s],[0,u])(l)}function FM(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 i(){const o={left:e.scrollLeft,top:e.scrollTop},s=r.left!==o.left,u=r.top!==o.top;(s||u)&&t(),r=o,n=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(n)};function Np(e,t){const r=fr(e),n=S.useRef(0);return S.useEffect(()=>()=>window.clearTimeout(n.current),[]),S.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Ss(e,t){const r=fr(t);Lt(()=>{let n=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(e),()=>{window.cancelAnimationFrame(n),i.unobserve(e)}}},[e,r])}var uz=CM,fz=kM,dz=$M;function _s({className:e,children:t,...r}){return d.jsxs(uz,{"data-slot":"scroll-area",className:Re("relative",e),...r,children:[d.jsx(fz,{"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}),d.jsx(hz,{}),d.jsx(dz,{})]})}function hz({className:e,orientation:t="vertical",...r}){return d.jsx(RM,{"data-slot":"scroll-area-scrollbar",orientation:t,className:Re("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:d.jsx(LM,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}const pz="/assets/773f0c39e1986271e9144596caac519f934a6ae6-Cou8J2R8.png";function mz({currentView:e,setCurrentView:t}){const[r,n]=S.useState(!0),i=[{name:"Dashboard",icon:hM,type:"item"},{type:"header",name:"MODULES"},{name:"Labeling",icon:lh,type:"sub",isOpen:r,toggle:()=>n(!r),children:[{name:"Labels",icon:lh},{name:"Label Categories",icon:dM},{name:"Label Types",icon:Op},{name:"Label Templates",icon:fM},{name:"Multiple Options",icon:sh}]},{type:"header",name:"MANAGEMENT"},{name:"Location Manager",icon:Zs,type:"item"},{type:"header",name:"SYSTEM MANAGEMENT"},{name:"Account Management",icon:Gw,type:"item"},{name:"Menu Management",icon:ah,type:"item"},{name:"System Menu",icon:sh,type:"item"},{name:"Reports",icon:ws,type:"item"},{name:"Support",icon:oh,type:"item"},{name:"Log Out",icon:uF,type:"item"}];return d.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:[d.jsx("div",{className:"flex items-center justify-center border-b border-blue-800/50 bg-white px-4 shrink-0",style:{height:90},children:d.jsx("img",{src:pz,alt:"MedVantage",className:"h-16 w-auto object-contain"})}),d.jsx(_s,{className:"flex-1 py-4",children:d.jsx("div",{className:"px-3 space-y-1",children:i.map((o,s)=>o.type==="header"?d.jsx("div",{className:"px-4 py-2 mt-4 text-xs font-semibold text-blue-300 uppercase tracking-wider",children:o.name},s):o.type==="sub"?d.jsxs("div",{className:"space-y-1",children:[d.jsxs("button",{onClick:o.toggle,className:Re("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:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(o.icon,{className:"w-4 h-4"}),o.name]}),o.isOpen?d.jsx(xs,{className:"w-4 h-4"}):d.jsx(bs,{className:"w-4 h-4"})]}),o.isOpen&&d.jsx("div",{className:"pl-4 space-y-1",children:o.children?.map((u,f)=>d.jsxs("button",{onClick:()=>t(u.name),className:Re("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:[d.jsx("div",{className:"w-1 h-1 rounded-full bg-current"}),u.name]},f))})]},s):d.jsxs("button",{onClick:()=>t(o.name),className:Re("w-full flex items-center gap-3 px-4 py-2.5 text-sm font-medium rounded-lg transition-colors",e===o.name?"bg-blue-700 text-white shadow-md shadow-blue-900/20":o.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:[d.jsx(o.icon,{className:"w-4 h-4"}),o.name]},s))})})]})}function Se({className:e,type:t,...r}){return d.jsx("input",{type:t,"data-slot":"input",className:Re("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 vz=Symbol.for("react.lazy"),dh=Uw[" use ".trim().toString()];function gz(e){return typeof e=="object"&&e!==null&&"then"in e}function qM(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===vz&&"_payload"in e&&gz(e._payload)}function Zw(e){const t=yz(e),r=S.forwardRef((n,i)=>{let{children:o,...s}=n;qM(o)&&typeof dh=="function"&&(o=dh(o._payload));const u=S.Children.toArray(o),f=u.find(bz);if(f){const l=f.props.children,h=u.map(p=>p===f?S.Children.count(l)>1?S.Children.only(null):S.isValidElement(l)?l.props.children:null:p);return d.jsx(t,{...s,ref:i,children:S.isValidElement(l)?S.cloneElement(l,void 0,h):null})}return d.jsx(t,{...s,ref:i,children:o})});return r.displayName=`${e}.Slot`,r}var UM=Zw("Slot");function yz(e){const t=S.forwardRef((r,n)=>{let{children:i,...o}=r;if(qM(i)&&typeof dh=="function"&&(i=dh(i._payload)),S.isValidElement(i)){const s=Sz(i),u=wz(o,i.props);return i.type!==S.Fragment&&(u.ref=n?ha(n,s):s),S.cloneElement(i,u)}return S.Children.count(i)>1?S.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var xz=Symbol("radix.slottable");function bz(e){return S.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===xz}function wz(e,t){const r={...t};for(const n in t){const i=e[n],o=t[n];/^on[A-Z]/.test(n)?i&&o?r[n]=(...u)=>{const f=o(...u);return i(...u),f}:i&&(r[n]=i):n==="style"?r[n]={...i,...o}:n==="className"&&(r[n]=[i,o].filter(Boolean).join(" "))}return{...e,...r}}function Sz(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 AE=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,CE=He,WM=(e,t)=>r=>{var n;if(t?.variants==null)return CE(e,r?.class,r?.className);const{variants:i,defaultVariants:o}=t,s=Object.keys(i).map(l=>{const h=r?.[l],p=o?.[l];if(h===null)return null;const m=AE(h)||AE(p);return i[l][m]}),u=r&&Object.entries(r).reduce((l,h)=>{let[p,m]=h;return m===void 0||(l[p]=m),l},{}),f=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((l,h)=>{let{class:p,className:m,...g}=h;return Object.entries(g).every(b=>{let[y,w]=b;return Array.isArray(w)?w.includes({...o,...u}[y]):{...o,...u}[y]===w})?[...l,p,m]:l},[]);return CE(e,s,f,r?.class,r?.className)},HM=WM("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"}}),we=S.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...i},o)=>{const s=n?UM:"button";return d.jsx(s,{ref:o,"data-slot":"button",className:Re(HM({variant:t,size:r,className:e})),...i})});we.displayName="Button";function _z(e,t=[]){let r=[];function n(o,s){const u=S.createContext(s);u.displayName=o+"Context";const f=r.length;r=[...r,s];const l=p=>{const{scope:m,children:g,...b}=p,y=m?.[e]?.[f]||u,w=S.useMemo(()=>b,Object.values(b));return d.jsx(y.Provider,{value:w,children:g})};l.displayName=o+"Provider";function h(p,m){const g=m?.[e]?.[f]||u,b=S.useContext(g);if(b)return b;if(s!==void 0)return s;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[l,h]}const i=()=>{const o=r.map(s=>S.createContext(s));return function(u){const f=u?.[e]||o;return S.useMemo(()=>({[`__scope${e}`]:{...u,[e]:f}}),[u,f])}};return i.scopeName=e,[n,jz(i,...t)]}function jz(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=n.reduce((u,{useScope:f,scopeName:l})=>{const p=f(o)[`__scope${l}`];return{...u,...p}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var Oz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Jw=Oz.reduce((e,t)=>{const r=Zw(`Primitive.${t}`),n=S.forwardRef((i,o)=>{const{asChild:s,...u}=i,f=s?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(f,{...u,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),kg={exports:{}},Rg={};/** - * @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 TE;function Ez(){if(TE)return Rg;TE=1;var e=jp();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,i=e.useEffect,o=e.useLayoutEffect,s=e.useDebugValue;function u(p,m){var g=m(),b=n({inst:{value:g,getSnapshot:m}}),y=b[0].inst,w=b[1];return o(function(){y.value=g,y.getSnapshot=m,f(y)&&w({inst:y})},[p,g,m]),i(function(){return f(y)&&w({inst:y}),p(function(){f(y)&&w({inst:y})})},[p]),s(g),g}function f(p){var m=p.getSnapshot;p=p.value;try{var g=m();return!r(p,g)}catch{return!0}}function l(p,m){return m()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:u;return Rg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,Rg}var kE;function Pz(){return kE||(kE=1,kg.exports=Ez()),kg.exports}var Nz=Pz();function Az(){return Nz.useSyncExternalStore(Cz,()=>!0,()=>!1)}function Cz(){return()=>{}}var eS="Avatar",[Tz]=_z(eS),[kz,VM]=Tz(eS),GM=S.forwardRef((e,t)=>{const{__scopeAvatar:r,...n}=e,[i,o]=S.useState("idle");return d.jsx(kz,{scope:r,imageLoadingStatus:i,onImageLoadingStatusChange:o,children:d.jsx(Jw.span,{...n,ref:t})})});GM.displayName=eS;var KM="AvatarImage",XM=S.forwardRef((e,t)=>{const{__scopeAvatar:r,src:n,onLoadingStatusChange:i=()=>{},...o}=e,s=VM(KM,r),u=Rz(n,o),f=fr(l=>{i(l),s.onImageLoadingStatusChange(l)});return Lt(()=>{u!=="idle"&&f(u)},[u,f]),u==="loaded"?d.jsx(Jw.img,{...o,ref:t,src:n}):null});XM.displayName=KM;var YM="AvatarFallback",QM=S.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:n,...i}=e,o=VM(YM,r),[s,u]=S.useState(n===void 0);return S.useEffect(()=>{if(n!==void 0){const f=window.setTimeout(()=>u(!0),n);return()=>window.clearTimeout(f)}},[n]),s&&o.imageLoadingStatus!=="loaded"?d.jsx(Jw.span,{...i,ref:t}):null});QM.displayName=YM;function RE(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Rz(e,{referrerPolicy:t,crossOrigin:r}){const n=Az(),i=S.useRef(null),o=n?(i.current||(i.current=new window.Image),i.current):null,[s,u]=S.useState(()=>RE(o,e));return Lt(()=>{u(RE(o,e))},[o,e]),Lt(()=>{const f=p=>()=>{u(p)};if(!o)return;const l=f("loaded"),h=f("error");return o.addEventListener("load",l),o.addEventListener("error",h),t&&(o.referrerPolicy=t),typeof r=="string"&&(o.crossOrigin=r),()=>{o.removeEventListener("load",l),o.removeEventListener("error",h)}},[o,r,t]),s}var Mz=GM,Iz=XM,Dz=QM;function Lz({className:e,...t}){return d.jsx(Mz,{"data-slot":"avatar",className:Re("relative flex size-10 shrink-0 overflow-hidden rounded-full",e),...t})}function $z({className:e,...t}){return d.jsx(Iz,{"data-slot":"avatar-image",className:Re("aspect-square size-full",e),...t})}function Bz({className:e,...t}){return d.jsx(Dz,{"data-slot":"avatar-fallback",className:Re("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}function Fz({title:e}){const t=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});return d.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:[d.jsxs("div",{children:[d.jsxs("h1",{className:"text-2xl font-bold",style:{color:"rgb(43, 50, 143)"},children:[e," Overview"]}),d.jsxs("p",{className:"text-sm text-gray-500 mt-1 flex items-center gap-2",children:[t," | Last updated: Just now"]})]}),d.jsxs("div",{className:"flex items-center gap-4",children:[d.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:[d.jsx(Vw,{className:"h-4 w-4 text-gray-400 shrink-0 ml-3 pointer-events-none"}),d.jsx(Se,{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"})]}),d.jsx(we,{variant:"ghost",size:"icon",className:"text-gray-500 hover:text-gray-700",children:d.jsx(sh,{className:"w-5 h-5"})}),d.jsx("div",{className:"h-8 w-px bg-gray-200 mx-2"}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("div",{className:"text-right hidden md:block",children:[d.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Admin User"}),d.jsx("div",{className:"text-xs text-gray-500",children:"Administrator"})]}),d.jsxs(Lz,{className:"h-10 w-10 border border-gray-200",children:[d.jsx($z,{src:"https://github.com/shadcn.png"}),d.jsx(Bz,{children:"AD"})]})]})]})]})}function zz({children:e,currentView:t,setCurrentView:r}){return d.jsxs("div",{className:"flex h-screen bg-gray-50 overflow-hidden font-sans",children:[d.jsx(mz,{currentView:t,setCurrentView:r}),d.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[d.jsx(Fz,{title:t}),d.jsx("div",{className:"px-8 mt-8 shrink-0",children:d.jsxs("nav",{className:"flex items-center gap-2 text-sm font-normal","aria-label":"Breadcrumb",children:[d.jsx("button",{type:"button",onClick:()=>r("Dashboard"),className:"text-gray-500 hover:text-gray-700 transition-colors",children:"Home"}),d.jsx(bs,{className:"w-4 h-4 text-gray-500 shrink-0"}),d.jsx("span",{style:{color:"rgb(43, 50, 143)"},children:t})]})}),d.jsx("main",{className:"flex-1 overflow-y-auto p-8",children:d.jsx("div",{className:"w-full h-full",children:e})})]})]})}function Vr({className:e,...t}){return d.jsx("div",{"data-slot":"card",className:Re("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border",e),...t})}function Tn({className:e,...t}){return d.jsx("div",{"data-slot":"card-header",className:Re("@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 kn({className:e,...t}){return d.jsx("h4",{"data-slot":"card-title",className:Re("leading-none",e),...t})}function hh({className:e,...t}){return d.jsx("p",{"data-slot":"card-description",className:Re("text-muted-foreground",e),...t})}function dn({className:e,...t}){return d.jsx("div",{"data-slot":"card-content",className:Re("px-6 [&:last-child]:pb-6",e),...t})}const qz=WM("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 Gn({className:e,variant:t,asChild:r=!1,...n}){const i=r?UM:"span";return d.jsx(i,{"data-slot":"badge",className:Re(qz({variant:t}),e),...n})}var Mg,ME;function Ir(){if(ME)return Mg;ME=1;var e=Array.isArray;return Mg=e,Mg}var Ig,IE;function ZM(){if(IE)return Ig;IE=1;var e=typeof Xf=="object"&&Xf&&Xf.Object===Object&&Xf;return Ig=e,Ig}var Dg,DE;function oi(){if(DE)return Dg;DE=1;var e=ZM(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Dg=r,Dg}var Lg,LE;function mu(){if(LE)return Lg;LE=1;var e=oi(),t=e.Symbol;return Lg=t,Lg}var $g,$E;function Uz(){if($E)return $g;$E=1;var e=mu(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function o(s){var u=r.call(s,i),f=s[i];try{s[i]=void 0;var l=!0}catch{}var h=n.call(s);return l&&(u?s[i]=f:delete s[i]),h}return $g=o,$g}var Bg,BE;function Wz(){if(BE)return Bg;BE=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Bg=r,Bg}var Fg,FE;function Ii(){if(FE)return Fg;FE=1;var e=mu(),t=Uz(),r=Wz(),n="[object Null]",i="[object Undefined]",o=e?e.toStringTag:void 0;function s(u){return u==null?u===void 0?i:n:o&&o in Object(u)?t(u):r(u)}return Fg=s,Fg}var zg,zE;function Di(){if(zE)return zg;zE=1;function e(t){return t!=null&&typeof t=="object"}return zg=e,zg}var qg,qE;function tl(){if(qE)return qg;qE=1;var e=Ii(),t=Di(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return qg=n,qg}var Ug,UE;function tS(){if(UE)return Ug;UE=1;var e=Ir(),t=tl(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(o,s){if(e(o))return!1;var u=typeof o;return u=="number"||u=="symbol"||u=="boolean"||o==null||t(o)?!0:n.test(o)||!r.test(o)||s!=null&&o in Object(s)}return Ug=i,Ug}var Wg,WE;function vo(){if(WE)return Wg;WE=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Wg=e,Wg}var Hg,HE;function rS(){if(HE)return Hg;HE=1;var e=Ii(),t=vo(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function s(u){if(!t(u))return!1;var f=e(u);return f==n||f==i||f==r||f==o}return Hg=s,Hg}var Vg,VE;function Hz(){if(VE)return Vg;VE=1;var e=oi(),t=e["__core-js_shared__"];return Vg=t,Vg}var Gg,GE;function Vz(){if(GE)return Gg;GE=1;var e=Hz(),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 Gg=r,Gg}var Kg,KE;function JM(){if(KE)return Kg;KE=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 Kg=r,Kg}var Xg,XE;function Gz(){if(XE)return Xg;XE=1;var e=rS(),t=Vz(),r=vo(),n=JM(),i=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,s=Function.prototype,u=Object.prototype,f=s.toString,l=u.hasOwnProperty,h=RegExp("^"+f.call(l).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(m){if(!r(m)||t(m))return!1;var g=e(m)?h:o;return g.test(n(m))}return Xg=p,Xg}var Yg,YE;function Kz(){if(YE)return Yg;YE=1;function e(t,r){return t?.[r]}return Yg=e,Yg}var Qg,QE;function pa(){if(QE)return Qg;QE=1;var e=Gz(),t=Kz();function r(n,i){var o=t(n,i);return e(o)?o:void 0}return Qg=r,Qg}var Zg,ZE;function Ap(){if(ZE)return Zg;ZE=1;var e=pa(),t=e(Object,"create");return Zg=t,Zg}var Jg,JE;function Xz(){if(JE)return Jg;JE=1;var e=Ap();function t(){this.__data__=e?e(null):{},this.size=0}return Jg=t,Jg}var ey,eP;function Yz(){if(eP)return ey;eP=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return ey=e,ey}var ty,tP;function Qz(){if(tP)return ty;tP=1;var e=Ap(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(o){var s=this.__data__;if(e){var u=s[o];return u===t?void 0:u}return n.call(s,o)?s[o]:void 0}return ty=i,ty}var ry,rP;function Zz(){if(rP)return ry;rP=1;var e=Ap(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var o=this.__data__;return e?o[i]!==void 0:r.call(o,i)}return ry=n,ry}var ny,nP;function Jz(){if(nP)return ny;nP=1;var e=Ap(),t="__lodash_hash_undefined__";function r(n,i){var o=this.__data__;return this.size+=this.has(n)?0:1,o[n]=e&&i===void 0?t:i,this}return ny=r,ny}var iy,iP;function eq(){if(iP)return iy;iP=1;var e=Xz(),t=Yz(),r=Qz(),n=Zz(),i=Jz();function o(s){var u=-1,f=s==null?0:s.length;for(this.clear();++u-1}return uy=t,uy}var fy,fP;function oq(){if(fP)return fy;fP=1;var e=Cp();function t(r,n){var i=this.__data__,o=e(i,r);return o<0?(++this.size,i.push([r,n])):i[o][1]=n,this}return fy=t,fy}var dy,dP;function Tp(){if(dP)return dy;dP=1;var e=tq(),t=rq(),r=nq(),n=iq(),i=oq();function o(s){var u=-1,f=s==null?0:s.length;for(this.clear();++u0?1:-1},Go=function(t){return ea(t)&&t.indexOf("%")===t.length-1},be=function(t){return Nq(t)&&!vu(t)},Aq=function(t){return We(t)},Ht=function(t){return be(t)||ea(t)},Cq=0,nl=function(t){var r=++Cq;return"".concat(t||"").concat(r)},yr=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!be(t)&&!ea(t))return n;var o;if(Go(t)){var s=t.indexOf("%");o=r*parseFloat(t.slice(0,s))/100}else o=+t;return vu(o)&&(o=n),i&&o>r&&(o=r),o},lo=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},Tq=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function $q(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 r1(e){"@babel/helpers - typeof";return r1=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},r1(e)}var FP={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"},Ei=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},zP=null,$y=null,cS=function e(t){if(t===zP&&Array.isArray($y))return $y;var r=[];return S.Children.forEach(t,function(n){We(n)||(jq.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),$y=r,zP=t,r};function Zr(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(i){return Ei(i)}):n=[Ei(t)],cS(e).forEach(function(i){var o=Qr(i,"type.displayName")||Qr(i,"type.name");n.indexOf(o)!==-1&&r.push(i)}),r}function Hr(e,t){var r=Zr(e,t);return r&&r[0]}var qP=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,i=r.height;return!(!be(n)||n<=0||!be(i)||i<=0)},Bq=["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"],Fq=function(t){return t&&t.type&&ea(t.type)&&Bq.indexOf(t.type)>=0},zq=function(t){return t&&r1(t)==="object"&&"clipDot"in t},qq=function(t,r,n,i){var o,s=(o=Ly?.[i])!==null&&o!==void 0?o:[];return r.startsWith("data-")||!qe(t)&&(i&&s.includes(r)||Mq.includes(r))||n&&lS.includes(r)},Be=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(S.isValidElement(t)&&(i=t.props),!rl(i))return null;var o={};return Object.keys(i).forEach(function(s){var u;qq((u=i)===null||u===void 0?void 0:u[s],s,r,n)&&(o[s]=i[s])}),o},n1=function e(t,r){if(t===r)return!0;var n=S.Children.count(t);if(n!==S.Children.count(r))return!1;if(n===0)return!0;if(n===1)return UP(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Gq(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 o1(e){var t=e.children,r=e.width,n=e.height,i=e.viewBox,o=e.className,s=e.style,u=e.title,f=e.desc,l=Vq(e,Hq),h=i||{width:r,height:n,x:0,y:0},p=He("recharts-surface",o);return z.createElement("svg",i1({},Be(l,!0,"svg"),{className:p,width:r,height:n,style:s,viewBox:"".concat(h.x," ").concat(h.y," ").concat(h.width," ").concat(h.height)}),z.createElement("title",null,u),z.createElement("desc",null,f),t)}var Kq=["children","className"];function a1(){return a1=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 Yq(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 at=z.forwardRef(function(e,t){var r=e.children,n=e.className,i=Xq(e,Kq),o=He("recharts-layer",n);return z.createElement("g",a1({className:o},Be(i,!0),{ref:t}),r)}),Dn=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;oo?0:o+r),n=n>o?o:n,n<0&&(n+=o),o=r>n?0:n-r>>>0,r>>>=0;for(var s=Array(o);++i=o?r:e(r,n,i)}return Fy=t,Fy}var zy,GP;function oI(){if(GP)return zy;GP=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,o="\\ufe0e\\ufe0f",s="\\u200d",u=RegExp("["+s+e+i+o+"]");function f(l){return u.test(l)}return zy=f,zy}var qy,KP;function Jq(){if(KP)return qy;KP=1;function e(t){return t.split("")}return qy=e,qy}var Uy,XP;function e9(){if(XP)return Uy;XP=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,o="\\ufe0e\\ufe0f",s="["+e+"]",u="["+i+"]",f="\\ud83c[\\udffb-\\udfff]",l="(?:"+u+"|"+f+")",h="[^"+e+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",m="[\\ud800-\\udbff][\\udc00-\\udfff]",g="\\u200d",b=l+"?",y="["+o+"]?",w="(?:"+g+"(?:"+[h,p,m].join("|")+")"+y+b+")*",j=y+b+w,O="(?:"+[h+u+"?",u,p,m,s].join("|")+")",E=RegExp(f+"(?="+f+")|"+O+j,"g");function A(N){return N.match(E)||[]}return Uy=A,Uy}var Wy,YP;function t9(){if(YP)return Wy;YP=1;var e=Jq(),t=oI(),r=e9();function n(i){return t(i)?r(i):e(i)}return Wy=n,Wy}var Hy,QP;function r9(){if(QP)return Hy;QP=1;var e=Zq(),t=oI(),r=t9(),n=tI();function i(o){return function(s){s=n(s);var u=t(s)?r(s):void 0,f=u?u[0]:s.charAt(0),l=u?e(u,1).join(""):s.slice(1);return f[o]()+l}}return Hy=i,Hy}var Vy,ZP;function n9(){if(ZP)return Vy;ZP=1;var e=r9(),t=e("toUpperCase");return Vy=t,Vy}var i9=n9();const Mp=ct(i9);function yt(e){return function(){return e}}const aI=Math.cos,vh=Math.sin,Fn=Math.sqrt,gh=Math.PI,Ip=2*gh,s1=Math.PI,l1=2*s1,Wo=1e-6,o9=l1-Wo;function sI(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return sI;const r=10**t;return function(n){this._+=n[0];for(let i=1,o=n.length;iWo)if(!(Math.abs(p*f-l*h)>Wo)||!o)this._append`L${this._x1=t},${this._y1=r}`;else{let g=n-s,b=i-u,y=f*f+l*l,w=g*g+b*b,j=Math.sqrt(y),O=Math.sqrt(m),E=o*Math.tan((s1-Math.acos((y+m-w)/(2*j*O)))/2),A=E/O,N=E/j;Math.abs(A-1)>Wo&&this._append`L${t+A*h},${r+A*p}`,this._append`A${o},${o},0,0,${+(p*g>h*b)},${this._x1=t+N*f},${this._y1=r+N*l}`}}arc(t,r,n,i,o,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(i),f=n*Math.sin(i),l=t+u,h=r+f,p=1^s,m=s?i-o:o-i;this._x1===null?this._append`M${l},${h}`:(Math.abs(this._x1-l)>Wo||Math.abs(this._y1-h)>Wo)&&this._append`L${l},${h}`,n&&(m<0&&(m=m%l1+l1),m>o9?this._append`A${n},${n},0,1,${p},${t-u},${r-f}A${n},${n},0,1,${p},${this._x1=l},${this._y1=h}`:m>Wo&&this._append`A${n},${n},0,${+(m>=s1)},${p},${this._x1=t+n*Math.cos(o)},${this._y1=r+n*Math.sin(o)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function uS(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 s9(t)}function fS(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function lI(e){this._context=e}lI.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 Dp(e){return new lI(e)}function cI(e){return e[0]}function uI(e){return e[1]}function fI(e,t){var r=yt(!0),n=null,i=Dp,o=null,s=uS(u);e=typeof e=="function"?e:e===void 0?cI:yt(e),t=typeof t=="function"?t:t===void 0?uI:yt(t);function u(f){var l,h=(f=fS(f)).length,p,m=!1,g;for(n==null&&(o=i(g=s())),l=0;l<=h;++l)!(l=g;--b)u.point(E[b],A[b]);u.lineEnd(),u.areaEnd()}j&&(E[m]=+e(w,m,p),A[m]=+t(w,m,p),u.point(n?+n(w,m,p):E[m],r?+r(w,m,p):A[m]))}if(O)return u=null,O+""||null}function h(){return fI().defined(i).curve(s).context(o)}return l.x=function(p){return arguments.length?(e=typeof p=="function"?p:yt(+p),n=null,l):e},l.x0=function(p){return arguments.length?(e=typeof p=="function"?p:yt(+p),l):e},l.x1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:yt(+p),l):n},l.y=function(p){return arguments.length?(t=typeof p=="function"?p:yt(+p),r=null,l):t},l.y0=function(p){return arguments.length?(t=typeof p=="function"?p:yt(+p),l):t},l.y1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:yt(+p),l):r},l.lineX0=l.lineY0=function(){return h().x(e).y(t)},l.lineY1=function(){return h().x(e).y(r)},l.lineX1=function(){return h().x(n).y(t)},l.defined=function(p){return arguments.length?(i=typeof p=="function"?p:yt(!!p),l):i},l.curve=function(p){return arguments.length?(s=p,o!=null&&(u=s(o)),l):s},l.context=function(p){return arguments.length?(p==null?o=u=null:u=s(o=p),l):o},l}class dI{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 l9(e){return new dI(e,!0)}function c9(e){return new dI(e,!1)}const dS={draw(e,t){const r=Fn(t/gh);e.moveTo(r,0),e.arc(0,0,r,0,Ip)}},u9={draw(e,t){const r=Fn(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()}},hI=Fn(1/3),f9=hI*2,d9={draw(e,t){const r=Fn(t/f9),n=r*hI;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},h9={draw(e,t){const r=Fn(t),n=-r/2;e.rect(n,n,r,r)}},p9=.8908130915292852,pI=vh(gh/10)/vh(7*gh/10),m9=vh(Ip/10)*pI,v9=-aI(Ip/10)*pI,g9={draw(e,t){const r=Fn(t*p9),n=m9*r,i=v9*r;e.moveTo(0,-r),e.lineTo(n,i);for(let o=1;o<5;++o){const s=Ip*o/5,u=aI(s),f=vh(s);e.lineTo(f*r,-u*r),e.lineTo(u*n-f*i,f*n+u*i)}e.closePath()}},Gy=Fn(3),y9={draw(e,t){const r=-Fn(t/(Gy*3));e.moveTo(0,r*2),e.lineTo(-Gy*r,-r),e.lineTo(Gy*r,-r),e.closePath()}},ln=-.5,cn=Fn(3)/2,c1=1/Fn(12),x9=(c1/2+1)*3,b9={draw(e,t){const r=Fn(t/x9),n=r/2,i=r*c1,o=n,s=r*c1+r,u=-o,f=s;e.moveTo(n,i),e.lineTo(o,s),e.lineTo(u,f),e.lineTo(ln*n-cn*i,cn*n+ln*i),e.lineTo(ln*o-cn*s,cn*o+ln*s),e.lineTo(ln*u-cn*f,cn*u+ln*f),e.lineTo(ln*n+cn*i,ln*i-cn*n),e.lineTo(ln*o+cn*s,ln*s-cn*o),e.lineTo(ln*u+cn*f,ln*f-cn*u),e.closePath()}};function w9(e,t){let r=null,n=uS(i);e=typeof e=="function"?e:yt(e||dS),t=typeof t=="function"?t:yt(t===void 0?64:+t);function i(){let o;if(r||(r=o=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),o)return r=null,o+""||null}return i.type=function(o){return arguments.length?(e=typeof o=="function"?o:yt(o),i):e},i.size=function(o){return arguments.length?(t=typeof o=="function"?o:yt(+o),i):t},i.context=function(o){return arguments.length?(r=o??null,i):r},i}function yh(){}function xh(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 mI(e){this._context=e}mI.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:xh(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:xh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function S9(e){return new mI(e)}function vI(e){this._context=e}vI.prototype={areaStart:yh,areaEnd:yh,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:xh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function _9(e){return new vI(e)}function gI(e){this._context=e}gI.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:xh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function j9(e){return new gI(e)}function yI(e){this._context=e}yI.prototype={areaStart:yh,areaEnd:yh,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 O9(e){return new yI(e)}function JP(e){return e<0?-1:1}function e2(e,t,r){var n=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(n||i<0&&-0),s=(r-e._y1)/(i||n<0&&-0),u=(o*i+s*n)/(n+i);return(JP(o)+JP(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(u))||0}function t2(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Ky(e,t,r){var n=e._x0,i=e._y0,o=e._x1,s=e._y1,u=(o-n)/3;e._context.bezierCurveTo(n+u,i+u*t,o-u,s-u*r,o,s)}function bh(e){this._context=e}bh.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:Ky(this,this._t0,t2(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,Ky(this,t2(this,r=e2(this,e,t)),r);break;default:Ky(this,this._t0,r=e2(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function xI(e){this._context=new bI(e)}(xI.prototype=Object.create(bh.prototype)).point=function(e,t){bh.prototype.point.call(this,t,e)};function bI(e){this._context=e}bI.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,i,o){this._context.bezierCurveTo(t,e,n,r,o,i)}};function E9(e){return new bh(e)}function P9(e){return new xI(e)}function wI(e){this._context=e}wI.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=r2(e),i=r2(t),o=0,s=1;s=0;--t)i[t]=(s[t]-i[t+1])/o[t];for(o[r-1]=(e[r]+i[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 A9(e){return new Lp(e,.5)}function C9(e){return new Lp(e,0)}function T9(e){return new Lp(e,1)}function js(e,t){if((s=e.length)>1)for(var r=1,n,i,o=e[t[0]],s,u=o.length;r=0;)r[t]=t;return r}function k9(e,t){return e[t]}function R9(e){const t=[];return t.key=e,t}function M9(){var e=yt([]),t=u1,r=js,n=k9;function i(o){var s=Array.from(e.apply(this,arguments),R9),u,f=s.length,l=-1,h;for(const p of o)for(u=0,++l;u0){for(var r,n,i=0,o=e[0].length,s;i0){for(var r=0,n=e[t[0]],i,o=n.length;r0)||!((o=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,o,s;n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function U9(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 SI={symbolCircle:dS,symbolCross:u9,symbolDiamond:d9,symbolSquare:h9,symbolStar:g9,symbolTriangle:y9,symbolWye:b9},W9=Math.PI/180,H9=function(t){var r="symbol".concat(Mp(t));return SI[r]||dS},V9=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 i=18*W9;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),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}},G9=function(t,r){SI["symbol".concat(Mp(t))]=r},hS=function(t){var r=t.type,n=r===void 0?"circle":r,i=t.size,o=i===void 0?64:i,s=t.sizeType,u=s===void 0?"area":s,f=q9(t,$9),l=i2(i2({},f),{},{type:n,size:o,sizeType:u}),h=function(){var w=H9(n),j=w9().type(w).size(V9(o,u,n));return j()},p=l.className,m=l.cx,g=l.cy,b=Be(l,!0);return m===+m&&g===+g&&o===+o?z.createElement("path",f1({},b,{className:He("recharts-symbols",p),transform:"translate(".concat(m,", ").concat(g,")"),d:h()})):null};hS.registerSymbol=G9;function Os(e){"@babel/helpers - typeof";return Os=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},Os(e)}function d1(){return d1=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var O=g.inactive?l:g.color;return z.createElement("li",d1({className:w,style:p,key:"legend-item-".concat(b)},ta(n.props,g,b)),z.createElement(o1,{width:s,height:s,viewBox:h,style:m},n.renderIcon(g)),z.createElement("span",{className:"recharts-legend-item-text",style:{color:O}},y?y(j,g,b):j))})}},{key:"render",value:function(){var n=this.props,i=n.payload,o=n.layout,s=n.align;if(!i||!i.length)return null;var u={padding:0,margin:0,textAlign:o==="horizontal"?s:"left"};return z.createElement("ul",{className:"recharts-default-legend",style:u},this.renderItems())}}])})(S.PureComponent);Cc(pS,"displayName","Legend");Cc(pS,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Xy,a2;function nU(){if(a2)return Xy;a2=1;var e=Tp();function t(){this.__data__=new e,this.size=0}return Xy=t,Xy}var Yy,s2;function iU(){if(s2)return Yy;s2=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return Yy=e,Yy}var Qy,l2;function oU(){if(l2)return Qy;l2=1;function e(t){return this.__data__.get(t)}return Qy=e,Qy}var Zy,c2;function aU(){if(c2)return Zy;c2=1;function e(t){return this.__data__.has(t)}return Zy=e,Zy}var Jy,u2;function sU(){if(u2)return Jy;u2=1;var e=Tp(),t=iS(),r=oS(),n=200;function i(o,s){var u=this.__data__;if(u instanceof e){var f=u.__data__;if(!t||f.lengthg))return!1;var y=p.get(s),w=p.get(u);if(y&&w)return y==u&&w==s;var j=-1,O=!0,E=f&i?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 w0=t,w0}var S0,M2;function bU(){if(M2)return S0;M2=1;var e=Ii(),t=yS(),r=Di(),n="[object Arguments]",i="[object Array]",o="[object Boolean]",s="[object Date]",u="[object Error]",f="[object Function]",l="[object Map]",h="[object Number]",p="[object Object]",m="[object RegExp]",g="[object Set]",b="[object String]",y="[object WeakMap]",w="[object ArrayBuffer]",j="[object DataView]",O="[object Float32Array]",E="[object Float64Array]",A="[object Int8Array]",N="[object Int16Array]",C="[object Int32Array]",T="[object Uint8Array]",R="[object Uint8ClampedArray]",I="[object Uint16Array]",F="[object Uint32Array]",L={};L[O]=L[E]=L[A]=L[N]=L[C]=L[T]=L[R]=L[I]=L[F]=!0,L[n]=L[i]=L[w]=L[o]=L[j]=L[s]=L[u]=L[f]=L[l]=L[h]=L[p]=L[m]=L[g]=L[b]=L[y]=!1;function $(U){return r(U)&&t(U.length)&&!!L[e(U)]}return S0=$,S0}var _0,I2;function kI(){if(I2)return _0;I2=1;function e(t){return function(r){return t(r)}}return _0=e,_0}var vc={exports:{}};vc.exports;var D2;function wU(){return D2||(D2=1,(function(e,t){var r=ZM(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===n,s=o&&r.process,u=(function(){try{var f=i&&i.require&&i.require("util").types;return f||s&&s.binding&&s.binding("util")}catch{}})();e.exports=u})(vc,vc.exports)),vc.exports}var j0,L2;function RI(){if(L2)return j0;L2=1;var e=bU(),t=kI(),r=wU(),n=r&&r.isTypedArray,i=n?t(n):e;return j0=i,j0}var O0,$2;function SU(){if($2)return O0;$2=1;var e=gU(),t=vS(),r=Ir(),n=TI(),i=gS(),o=RI(),s=Object.prototype,u=s.hasOwnProperty;function f(l,h){var p=r(l),m=!p&&t(l),g=!p&&!m&&n(l),b=!p&&!m&&!g&&o(l),y=p||m||g||b,w=y?e(l.length,String):[],j=w.length;for(var O in l)(h||u.call(l,O))&&!(y&&(O=="length"||g&&(O=="offset"||O=="parent")||b&&(O=="buffer"||O=="byteLength"||O=="byteOffset")||i(O,j)))&&w.push(O);return w}return O0=f,O0}var E0,B2;function _U(){if(B2)return E0;B2=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||e;return r===i}return E0=t,E0}var P0,F2;function MI(){if(F2)return P0;F2=1;function e(t,r){return function(n){return t(r(n))}}return P0=e,P0}var N0,z2;function jU(){if(z2)return N0;z2=1;var e=MI(),t=e(Object.keys,Object);return N0=t,N0}var A0,q2;function OU(){if(q2)return A0;q2=1;var e=_U(),t=jU(),r=Object.prototype,n=r.hasOwnProperty;function i(o){if(!e(o))return t(o);var s=[];for(var u in Object(o))n.call(o,u)&&u!="constructor"&&s.push(u);return s}return A0=i,A0}var C0,U2;function gu(){if(U2)return C0;U2=1;var e=rS(),t=yS();function r(n){return n!=null&&t(n.length)&&!e(n)}return C0=r,C0}var T0,W2;function $p(){if(W2)return T0;W2=1;var e=SU(),t=OU(),r=gu();function n(i){return r(i)?e(i):t(i)}return T0=n,T0}var k0,H2;function EU(){if(H2)return k0;H2=1;var e=hU(),t=vU(),r=$p();function n(i){return e(i,r,t)}return k0=n,k0}var R0,V2;function PU(){if(V2)return R0;V2=1;var e=EU(),t=1,r=Object.prototype,n=r.hasOwnProperty;function i(o,s,u,f,l,h){var p=u&t,m=e(o),g=m.length,b=e(s),y=b.length;if(g!=y&&!p)return!1;for(var w=g;w--;){var j=m[w];if(!(p?j in s:n.call(s,j)))return!1}var O=h.get(o),E=h.get(s);if(O&&E)return O==s&&E==o;var A=!0;h.set(o,s),h.set(s,o);for(var N=p;++w-1}return ox=t,ox}var ax,xN;function GU(){if(xN)return ax;xN=1;function e(t,r,n){for(var i=-1,o=t==null?0:t.length;++i=s){var j=l?null:i(f);if(j)return o(j);b=!1,m=n,w=new e}else w=l?[]:y;e:for(;++p=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}function c7(e){return e.value}function u7(e,t){if(z.isValidElement(e))return z.cloneElement(e,t);if(typeof e=="function")return z.createElement(e,t);t.ref;var r=s7(t,JU);return z.createElement(pS,r)}var PN=1,ds=(function(e){function t(){var r;e7(this,t);for(var n=arguments.length,i=new Array(n),o=0;oPN||Math.abs(i.height-this.lastBoundingBox.height)>PN)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,n&&n(i)):(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?xi({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var i=this.props,o=i.layout,s=i.align,u=i.verticalAlign,f=i.margin,l=i.chartWidth,h=i.chartHeight,p,m;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(s==="center"&&o==="vertical"){var g=this.getBBoxSnapshot();p={left:((l||0)-g.width)/2}}else p=s==="right"?{right:f&&f.right||0}:{left:f&&f.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(u==="middle"){var b=this.getBBoxSnapshot();m={top:((h||0)-b.height)/2}}else m=u==="bottom"?{bottom:f&&f.bottom||0}:{top:f&&f.top||0};return xi(xi({},p),m)}},{key:"render",value:function(){var n=this,i=this.props,o=i.content,s=i.width,u=i.height,f=i.wrapperStyle,l=i.payloadUniqBy,h=i.payload,p=xi(xi({position:"absolute",width:s||"auto",height:u||"auto"},this.getDefaultPosition(f)),f);return z.createElement("div",{className:"recharts-legend-wrapper",style:p,ref:function(g){n.wrapperNode=g}},u7(o,xi(xi({},this.props),{},{payload:BI(h,l,c7)})))}}],[{key:"getWithHeight",value:function(n,i){var o=xi(xi({},this.defaultProps),n.props),s=o.layout;return s==="vertical"&&be(n.props.height)?{height:n.props.height}:s==="horizontal"?{width:n.props.width||i}:null}}])})(S.PureComponent);Bp(ds,"displayName","Legend");Bp(ds,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var fx,NN;function f7(){if(NN)return fx;NN=1;var e=mu(),t=vS(),r=Ir(),n=e?e.isConcatSpreadable:void 0;function i(o){return r(o)||t(o)||!!(n&&o&&o[n])}return fx=i,fx}var dx,AN;function qI(){if(AN)return dx;AN=1;var e=CI(),t=f7();function r(n,i,o,s,u){var f=-1,l=n.length;for(o||(o=t),u||(u=[]);++f0&&o(h)?i>1?r(h,i-1,o,s,u):e(u,h):s||(u[u.length]=h)}return u}return dx=r,dx}var hx,CN;function d7(){if(CN)return hx;CN=1;function e(t){return function(r,n,i){for(var o=-1,s=Object(r),u=i(r),f=u.length;f--;){var l=u[t?f:++o];if(n(s[l],l,s)===!1)break}return r}}return hx=e,hx}var px,TN;function h7(){if(TN)return px;TN=1;var e=d7(),t=e();return px=t,px}var mx,kN;function UI(){if(kN)return mx;kN=1;var e=h7(),t=$p();function r(n,i){return n&&e(n,i,t)}return mx=r,mx}var vx,RN;function p7(){if(RN)return vx;RN=1;var e=gu();function t(r,n){return function(i,o){if(i==null)return i;if(!e(i))return r(i,o);for(var s=i.length,u=n?s:-1,f=Object(i);(n?u--:++un||u&&f&&h&&!l&&!p||o&&f&&h||!i&&h||!s)return 1;if(!o&&!u&&!p&&r=l)return h;var p=i[o];return h*(p=="desc"?-1:1)}}return r.index-n.index}return wx=t,wx}var Sx,BN;function y7(){if(BN)return Sx;BN=1;var e=aS(),t=sS(),r=ai(),n=WI(),i=m7(),o=kI(),s=g7(),u=il(),f=Ir();function l(h,p,m){p.length?p=e(p,function(y){return f(y)?function(w){return t(w,y.length===1?y[0]:y)}:y}):p=[u];var g=-1;p=e(p,o(r));var b=n(h,function(y,w,j){var O=e(p,function(E){return E(y)});return{criteria:O,index:++g,value:y}});return i(b,function(y,w){return s(y,w,m)})}return Sx=l,Sx}var _x,FN;function x7(){if(FN)return _x;FN=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 _x=e,_x}var jx,zN;function b7(){if(zN)return jx;zN=1;var e=x7(),t=Math.max;function r(n,i,o){return i=t(i===void 0?n.length-1:i,0),function(){for(var s=arguments,u=-1,f=t(s.length-i,0),l=Array(f);++u0){if(++o>=e)return arguments[0]}else o=0;return i.apply(void 0,arguments)}}return Nx=n,Nx}var Ax,VN;function j7(){if(VN)return Ax;VN=1;var e=S7(),t=_7(),r=t(e);return Ax=r,Ax}var Cx,GN;function O7(){if(GN)return Cx;GN=1;var e=il(),t=b7(),r=j7();function n(i,o){return r(t(i,o,e),i+"")}return Cx=n,Cx}var Tx,KN;function Fp(){if(KN)return Tx;KN=1;var e=nS(),t=gu(),r=gS(),n=vo();function i(o,s,u){if(!n(u))return!1;var f=typeof s;return(f=="number"?t(u)&&r(s,u.length):f=="string"&&s in u)?e(u[s],o):!1}return Tx=i,Tx}var kx,XN;function E7(){if(XN)return kx;XN=1;var e=qI(),t=y7(),r=O7(),n=Fp(),i=r(function(o,s){if(o==null)return[];var u=s.length;return u>1&&n(o,s[0],s[1])?s=[]:u>2&&n(s[0],s[1],s[2])&&(s=[s[0]]),t(o,e(s,1),[])});return kx=i,kx}var P7=E7();const wS=ct(P7);function Tc(e){"@babel/helpers - typeof";return Tc=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},Tc(e)}function m1(){return m1=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(ec,"-left"),be(r)&&t&&be(t.x)&&r=t.y),"".concat(ec,"-top"),be(n)&&t&&be(t.y)&&ny?Math.max(h,f[n]):Math.max(p,f[n])}function q7(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 U7(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,i=e.position,o=e.reverseDirection,s=e.tooltipBox,u=e.useTranslate3d,f=e.viewBox,l,h,p;return s.height>0&&s.width>0&&r?(h=ZN({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:i,reverseDirection:o,tooltipDimension:s.width,viewBox:f,viewBoxDimension:f.width}),p=ZN({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:i,reverseDirection:o,tooltipDimension:s.height,viewBox:f,viewBoxDimension:f.height}),l=q7({translateX:h,translateY:p,useTranslate3d:u})):l=F7,{cssProperties:l,cssClasses:z7({translateX:h,translateY:p,coordinate:r})}}function Ps(e){"@babel/helpers - typeof";return Ps=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},Ps(e)}function JN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function eA(e){for(var t=1;ttA||Math.abs(n.height-this.state.lastBoundingBox.height)>tA)&&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,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,i=this.props,o=i.active,s=i.allowEscapeViewBox,u=i.animationDuration,f=i.animationEasing,l=i.children,h=i.coordinate,p=i.hasPayload,m=i.isAnimationActive,g=i.offset,b=i.position,y=i.reverseDirection,w=i.useTranslate3d,j=i.viewBox,O=i.wrapperStyle,E=U7({allowEscapeViewBox:s,coordinate:h,offsetTopLeft:g,position:b,reverseDirection:y,tooltipBox:this.state.lastBoundingBox,useTranslate3d:w,viewBox:j}),A=E.cssClasses,N=E.cssProperties,C=eA(eA({transition:m&&o?"transform ".concat(u,"ms ").concat(f):void 0},N),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&p?"visible":"hidden",position:"absolute",top:0,left:0},O);return z.createElement("div",{tabIndex:-1,className:A,style:C,ref:function(R){n.wrapperNode=R}},l)}}])})(S.PureComponent),J7=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},ma={isSsr:J7()};function Ns(e){"@babel/helpers - typeof";return Ns=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},Ns(e)}function rA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function nA(e){for(var t=1;t0;return z.createElement(Z7,{allowEscapeViewBox:s,animationDuration:u,animationEasing:f,isAnimationActive:m,active:o,coordinate:h,hasPayload:C,offset:g,position:w,reverseDirection:j,useTranslate3d:O,viewBox:E,wrapperStyle:A},cW(l,nA(nA({},this.props),{},{payload:N})))}}])})(S.PureComponent);SS(Gr,"displayName","Tooltip");SS(Gr,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!ma.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 Mx,iA;function uW(){if(iA)return Mx;iA=1;var e=oi(),t=function(){return e.Date.now()};return Mx=t,Mx}var Ix,oA;function fW(){if(oA)return Ix;oA=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return Ix=t,Ix}var Dx,aA;function dW(){if(aA)return Dx;aA=1;var e=fW(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return Dx=r,Dx}var Lx,sA;function YI(){if(sA)return Lx;sA=1;var e=dW(),t=vo(),r=tl(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,u=parseInt;function f(l){if(typeof l=="number")return l;if(r(l))return n;if(t(l)){var h=typeof l.valueOf=="function"?l.valueOf():l;l=t(h)?h+"":h}if(typeof l!="string")return l===0?l:+l;l=e(l);var p=o.test(l);return p||s.test(l)?u(l.slice(2),p?2:8):i.test(l)?n:+l}return Lx=f,Lx}var $x,lA;function hW(){if(lA)return $x;lA=1;var e=vo(),t=uW(),r=YI(),n="Expected a function",i=Math.max,o=Math.min;function s(u,f,l){var h,p,m,g,b,y,w=0,j=!1,O=!1,E=!0;if(typeof u!="function")throw new TypeError(n);f=r(f)||0,e(l)&&(j=!!l.leading,O="maxWait"in l,m=O?i(r(l.maxWait)||0,f):m,E="trailing"in l?!!l.trailing:E);function A(U){var G=h,q=p;return h=p=void 0,w=U,g=u.apply(q,G),g}function N(U){return w=U,b=setTimeout(R,f),j?A(U):g}function C(U){var G=U-y,q=U-w,H=f-G;return O?o(H,m-q):H}function T(U){var G=U-y,q=U-w;return y===void 0||G>=f||G<0||O&&q>=m}function R(){var U=t();if(T(U))return I(U);b=setTimeout(R,C(U))}function I(U){return b=void 0,E&&h?A(U):(h=p=void 0,g)}function F(){b!==void 0&&clearTimeout(b),w=0,h=y=p=b=void 0}function L(){return b===void 0?g:I(t())}function $(){var U=t(),G=T(U);if(h=arguments,p=this,y=U,G){if(b===void 0)return N(y);if(O)return clearTimeout(b),b=setTimeout(R,f),A(y)}return b===void 0&&(b=setTimeout(R,f)),g}return $.cancel=F,$.flush=L,$}return $x=s,$x}var Bx,cA;function pW(){if(cA)return Bx;cA=1;var e=hW(),t=vo(),r="Expected a function";function n(i,o,s){var u=!0,f=!0;if(typeof i!="function")throw new TypeError(r);return t(s)&&(u="leading"in s?!!s.leading:u,f="trailing"in s?!!s.trailing:f),e(i,o,{leading:u,maxWait:o,trailing:f})}return Bx=n,Bx}var mW=pW();const QI=ct(mW);function Rc(e){"@babel/helpers - typeof";return Rc=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},Rc(e)}function uA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function rd(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(U=QI(U,y,{trailing:!0,leading:!1}));var G=new ResizeObserver(U),q=N.current.getBoundingClientRect(),H=q.width,V=q.height;return L(H,V),G.observe(N.current),function(){G.disconnect()}},[L,y]);var $=S.useMemo(function(){var U=I.containerWidth,G=I.containerHeight;if(U<0||G<0)return null;Dn(Go(s)||Go(f),`The width(%s) and height(%s) are both fixed numbers, - maybe you don't need to use a ResponsiveContainer.`,s,f),Dn(!r||r>0,"The aspect(%s) must be greater than zero.",r);var q=Go(s)?U:s,H=Go(f)?G:f;r&&r>0&&(q?H=q/r:H&&(q=H*r),m&&H>m&&(H=m)),Dn(q>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.`,q,H,s,f,h,p,r);var V=!Array.isArray(g)&&Ei(g.type).endsWith("Chart");return z.Children.map(g,function(D){return z.isValidElement(D)?S.cloneElement(D,rd({width:q,height:H},V?{style:rd({height:"100%",width:"100%",maxHeight:H,maxWidth:q},D.props.style)}:{})):D})},[r,g,f,m,p,h,I,s]);return z.createElement("div",{id:w?"".concat(w):void 0,className:He("recharts-responsive-container",j),style:rd(rd({},A),{},{width:s,height:f,minWidth:h,minHeight:p,maxHeight:m}),ref:N},$)}),zp=function(t){return null};zp.displayName="Cell";function Mc(e){"@babel/helpers - typeof";return Mc=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},Mc(e)}function dA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function x1(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||ma.isSsr)return{width:0,height:0};var n=AW(r),i=JSON.stringify({text:t,copyStyle:n});if(Ga.widthCache[i])return Ga.widthCache[i];try{var o=document.getElementById(hA);o||(o=document.createElement("span"),o.setAttribute("id",hA),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var s=x1(x1({},NW),n);Object.assign(o.style,s),o.textContent="".concat(t);var u=o.getBoundingClientRect(),f={width:u.width,height:u.height};return Ga.widthCache[i]=f,++Ga.cacheCount>PW&&(Ga.cacheCount=0,Ga.widthCache={}),f}catch{return{width:0,height:0}}},CW=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Ic(e){"@babel/helpers - typeof";return Ic=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},Ic(e)}function Eh(e,t){return MW(e)||RW(e,t)||kW(e,t)||TW()}function TW(){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 kW(e,t){if(e){if(typeof e=="string")return pA(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 pA(e,t)}}function pA(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 KW(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 bA(e,t){return ZW(e)||QW(e,t)||YW(e,t)||XW()}function XW(){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 YW(e,t){if(e){if(typeof e=="string")return wA(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 wA(e,t)}}function wA(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 q.reduce(function(H,V){var D=V.word,Z=V.width,J=H[H.length-1];if(J&&(i==null||o||J.width+Z+nV.width?H:V})};if(!h)return g;for(var y="…",w=function(q){var H=p.slice(0,q),V=tD({breakAll:l,style:f,children:H+y}).wordsWithComputedWidth,D=m(V),Z=D.length>s||b(D).width>Number(i);return[Z,D]},j=0,O=p.length-1,E=0,A;j<=O&&E<=p.length-1;){var N=Math.floor((j+O)/2),C=N-1,T=w(C),R=bA(T,2),I=R[0],F=R[1],L=w(N),$=bA(L,1),U=$[0];if(!I&&!U&&(j=N+1),I&&U&&(O=N-1),!I&&U){A=F;break}E++}return A||g},SA=function(t){var r=We(t)?[]:t.toString().split(eD);return[{words:r}]},eH=function(t){var r=t.width,n=t.scaleToFit,i=t.children,o=t.style,s=t.breakAll,u=t.maxLines;if((r||n)&&!ma.isSsr){var f,l,h=tD({breakAll:s,children:i,style:o});if(h){var p=h.wordsWithComputedWidth,m=h.spaceWidth;f=p,l=m}else return SA(i);return JW({breakAll:s,children:i,maxLines:u,style:o},f,l,r,n)}return SA(i)},_A="#808080",ra=function(t){var r=t.x,n=r===void 0?0:r,i=t.y,o=i===void 0?0:i,s=t.lineHeight,u=s===void 0?"1em":s,f=t.capHeight,l=f===void 0?"0.71em":f,h=t.scaleToFit,p=h===void 0?!1:h,m=t.textAnchor,g=m===void 0?"start":m,b=t.verticalAnchor,y=b===void 0?"end":b,w=t.fill,j=w===void 0?_A:w,O=xA(t,VW),E=S.useMemo(function(){return eH({breakAll:O.breakAll,children:O.children,maxLines:O.maxLines,scaleToFit:p,style:O.style,width:O.width})},[O.breakAll,O.children,O.maxLines,p,O.style,O.width]),A=O.dx,N=O.dy,C=O.angle,T=O.className,R=O.breakAll,I=xA(O,GW);if(!Ht(n)||!Ht(o))return null;var F=n+(be(A)?A:0),L=o+(be(N)?N:0),$;switch(y){case"start":$=Fx("calc(".concat(l,")"));break;case"middle":$=Fx("calc(".concat((E.length-1)/2," * -").concat(u," + (").concat(l," / 2))"));break;default:$=Fx("calc(".concat(E.length-1," * -").concat(u,")"));break}var U=[];if(p){var G=E[0].width,q=O.width;U.push("scale(".concat((be(q)?q/G:1)/G,")"))}return C&&U.push("rotate(".concat(C,", ").concat(F,", ").concat(L,")")),U.length&&(I.transform=U.join(" ")),z.createElement("text",b1({},Be(I,!0),{x:F,y:L,className:He("recharts-text",T),textAnchor:g,fill:j.includes("url")?_A:j}),E.map(function(H,V){var D=H.words.join(R?"":" ");return z.createElement("tspan",{x:F,dy:V===0?$:u,key:"".concat(D,"-").concat(V)},D)}))};function fo(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function tH(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function _S(e){let t,r,n;e.length!==2?(t=fo,r=(u,f)=>fo(e(u),f),n=(u,f)=>e(u)-f):(t=e===fo||e===tH?e:rH,r=e,n=e);function i(u,f,l=0,h=u.length){if(l>>1;r(u[p],f)<0?l=p+1:h=p}while(l>>1;r(u[p],f)<=0?l=p+1:h=p}while(ll&&n(u[p-1],f)>-n(u[p],f)?p-1:p}return{left:i,center:s,right:o}}function rH(){return 0}function rD(e){return e===null?NaN:+e}function*nH(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const iH=_S(fo),yu=iH.right;_S(rD).center;class jA extends Map{constructor(t,r=sH){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,i]of t)this.set(n,i)}get(t){return super.get(OA(this,t))}has(t){return super.has(OA(this,t))}set(t,r){return super.set(oH(this,t),r)}delete(t){return super.delete(aH(this,t))}}function OA({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function oH({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function aH({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function sH(e){return e!==null&&typeof e=="object"?e.valueOf():e}function lH(e=fo){if(e===fo)return nD;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 nD(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const cH=Math.sqrt(50),uH=Math.sqrt(10),fH=Math.sqrt(2);function Ph(e,t,r){const n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),o=n/Math.pow(10,i),s=o>=cH?10:o>=uH?5:o>=fH?2:1;let u,f,l;return i<0?(l=Math.pow(10,-i)/s,u=Math.round(e*l),f=Math.round(t*l),u/lt&&--f,l=-l):(l=Math.pow(10,i)*s,u=Math.round(e/l),f=Math.round(t/l),u*lt&&--f),f0))return[];if(e===t)return[e];const n=t=i))return[];const u=o-i+1,f=new Array(u);if(n)if(s<0)for(let l=0;l=n)&&(r=n);return r}function PA(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function iD(e,t,r=0,n=1/0,i){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(i=i===void 0?nD:lH(i);n>r;){if(n-r>600){const f=n-r+1,l=t-r+1,h=Math.log(f),p=.5*Math.exp(2*h/3),m=.5*Math.sqrt(h*p*(f-p)/f)*(l-f/2<0?-1:1),g=Math.max(r,Math.floor(t-l*p/f+m)),b=Math.min(n,Math.floor(t+(f-l)*p/f+m));iD(e,t,g,b,i)}const o=e[t];let s=r,u=n;for(tc(e,r,t),i(e[n],o)>0&&tc(e,r,n);s0;)--u}i(e[r],o)===0?tc(e,r,u):(++u,tc(e,u,n)),u<=t&&(r=u+1),t<=u&&(n=u-1)}return e}function tc(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function dH(e,t,r){if(e=Float64Array.from(nH(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return PA(e);if(t>=1)return EA(e);var n,i=(n-1)*t,o=Math.floor(i),s=EA(iD(e,o).subarray(0,o+1)),u=PA(e.subarray(o+1));return s+(u-s)*(i-o)}}function hH(e,t,r=rD){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,i=(n-1)*t,o=Math.floor(i),s=+r(e[o],o,e),u=+r(e[o+1],o+1,e);return s+(u-s)*(i-o)}}function pH(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,o=new Array(i);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?id(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?id(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=vH.exec(e))?new kr(t[1],t[2],t[3],1):(t=gH.exec(e))?new kr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=yH.exec(e))?id(t[1],t[2],t[3],t[4]):(t=xH.exec(e))?id(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=bH.exec(e))?MA(t[1],t[2]/100,t[3]/100,1):(t=wH.exec(e))?MA(t[1],t[2]/100,t[3]/100,t[4]):NA.hasOwnProperty(e)?TA(NA[e]):e==="transparent"?new kr(NaN,NaN,NaN,0):null}function TA(e){return new kr(e>>16&255,e>>8&255,e&255,1)}function id(e,t,r,n){return n<=0&&(e=t=r=NaN),new kr(e,t,r,n)}function jH(e){return e instanceof xu||(e=Bc(e)),e?(e=e.rgb(),new kr(e.r,e.g,e.b,e.opacity)):new kr}function O1(e,t,r,n){return arguments.length===1?jH(e):new kr(e,t,r,n??1)}function kr(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}OS(kr,O1,aD(xu,{brighter(e){return e=e==null?Nh:Math.pow(Nh,e),new kr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Lc:Math.pow(Lc,e),new kr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new kr(Qo(this.r),Qo(this.g),Qo(this.b),Ah(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:kA,formatHex:kA,formatHex8:OH,formatRgb:RA,toString:RA}));function kA(){return`#${Ko(this.r)}${Ko(this.g)}${Ko(this.b)}`}function OH(){return`#${Ko(this.r)}${Ko(this.g)}${Ko(this.b)}${Ko((isNaN(this.opacity)?1:this.opacity)*255)}`}function RA(){const e=Ah(this.opacity);return`${e===1?"rgb(":"rgba("}${Qo(this.r)}, ${Qo(this.g)}, ${Qo(this.b)}${e===1?")":`, ${e})`}`}function Ah(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Qo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ko(e){return e=Qo(e),(e<16?"0":"")+e.toString(16)}function MA(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new In(e,t,r,n)}function sD(e){if(e instanceof In)return new In(e.h,e.s,e.l,e.opacity);if(e instanceof xu||(e=Bc(e)),!e)return new In;if(e instanceof In)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),o=Math.max(t,r,n),s=NaN,u=o-i,f=(o+i)/2;return u?(t===o?s=(r-n)/u+(r0&&f<1?0:s,new In(s,u,f,e.opacity)}function EH(e,t,r,n){return arguments.length===1?sD(e):new In(e,t,r,n??1)}function In(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}OS(In,EH,aD(xu,{brighter(e){return e=e==null?Nh:Math.pow(Nh,e),new In(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Lc:Math.pow(Lc,e),new In(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,i=2*r-n;return new kr(zx(e>=240?e-240:e+120,i,n),zx(e,i,n),zx(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new In(IA(this.h),od(this.s),od(this.l),Ah(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=Ah(this.opacity);return`${e===1?"hsl(":"hsla("}${IA(this.h)}, ${od(this.s)*100}%, ${od(this.l)*100}%${e===1?")":`, ${e})`}`}}));function IA(e){return e=(e||0)%360,e<0?e+360:e}function od(e){return Math.max(0,Math.min(1,e||0))}function zx(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 ES=e=>()=>e;function PH(e,t){return function(r){return e+r*t}}function NH(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 AH(e){return(e=+e)==1?lD:function(t,r){return r-t?NH(t,r,e):ES(isNaN(t)?r:t)}}function lD(e,t){var r=t-e;return r?PH(e,r):ES(isNaN(e)?t:e)}const DA=(function e(t){var r=AH(t);function n(i,o){var s=r((i=O1(i)).r,(o=O1(o)).r),u=r(i.g,o.g),f=r(i.b,o.b),l=lD(i.opacity,o.opacity);return function(h){return i.r=s(h),i.g=u(h),i.b=f(h),i.opacity=l(h),i+""}}return n.gamma=e,n})(1);function CH(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(o){for(i=0;ir&&(o=t.slice(r,o),u[s]?u[s]+=o:u[++s]=o),(n=n[0])===(i=i[0])?u[s]?u[s]+=i:u[++s]=i:(u[++s]=null,f.push({i:s,x:Ch(n,i)})),r=qx.lastIndex;return rt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function zH(e,t,r){var n=e[0],i=e[1],o=t[0],s=t[1];return i2?qH:zH,f=l=null,p}function p(m){return m==null||isNaN(m=+m)?o:(f||(f=u(e.map(n),t,r)))(n(s(m)))}return p.invert=function(m){return s(i((l||(l=u(t,e.map(n),Ch)))(m)))},p.domain=function(m){return arguments.length?(e=Array.from(m,Th),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=PS,h()},p.clamp=function(m){return arguments.length?(s=m?!0:xr,h()):s!==xr},p.interpolate=function(m){return arguments.length?(r=m,h()):r},p.unknown=function(m){return arguments.length?(o=m,p):o},function(m,g){return n=m,i=g,h()}}function NS(){return qp()(xr,xr)}function UH(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function kh(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 As(e){return e=kh(Math.abs(e)),e?e[1]:NaN}function WH(e,t){return function(r,n){for(var i=r.length,o=[],s=0,u=e[0],f=0;i>0&&u>0&&(f+u+1>n&&(u=Math.max(1,n-f)),o.push(r.substring(i-=u,i+u)),!((f+=u+1)>n));)u=e[s=(s+1)%e.length];return o.reverse().join(t)}}function HH(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var VH=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Fc(e){if(!(t=VH.exec(e)))throw new Error("invalid format: "+e);var t;return new AS({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]})}Fc.prototype=AS.prototype;function AS(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+""}AS.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 GH(e){e:for(var t=e.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var Rh;function KH(e,t){var r=kh(e,t);if(!r)return Rh=void 0,e.toPrecision(t);var n=r[0],i=r[1],o=i-(Rh=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=n.length;return o===s?n:o>s?n+new Array(o-s+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+kh(e,Math.max(0,t+o-1))[0]}function $A(e,t){var r=kh(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const BA={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:UH,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)=>$A(e*100,t),r:$A,s:KH,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function FA(e){return e}var zA=Array.prototype.map,qA=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function XH(e){var t=e.grouping===void 0||e.thousands===void 0?FA:WH(zA.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?FA:HH(zA.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"−":e.minus+"",f=e.nan===void 0?"NaN":e.nan+"";function l(p,m){p=Fc(p);var g=p.fill,b=p.align,y=p.sign,w=p.symbol,j=p.zero,O=p.width,E=p.comma,A=p.precision,N=p.trim,C=p.type;C==="n"?(E=!0,C="g"):BA[C]||(A===void 0&&(A=12),N=!0,C="g"),(j||g==="0"&&b==="=")&&(j=!0,g="0",b="=");var T=(m&&m.prefix!==void 0?m.prefix:"")+(w==="$"?r:w==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():""),R=(w==="$"?n:/[%p]/.test(C)?s:"")+(m&&m.suffix!==void 0?m.suffix:""),I=BA[C],F=/[defgprs%]/.test(C);A=A===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,A)):Math.max(0,Math.min(20,A));function L($){var U=T,G=R,q,H,V;if(C==="c")G=I($)+G,$="";else{$=+$;var D=$<0||1/$<0;if($=isNaN($)?f:I(Math.abs($),A),N&&($=GH($)),D&&+$==0&&y!=="+"&&(D=!1),U=(D?y==="("?y:u:y==="-"||y==="("?"":y)+U,G=(C==="s"&&!isNaN($)&&Rh!==void 0?qA[8+Rh/3]:"")+G+(D&&y==="("?")":""),F){for(q=-1,H=$.length;++qV||V>57){G=(V===46?i+$.slice(q+1):$.slice(q))+G,$=$.slice(0,q);break}}}E&&!j&&($=t($,1/0));var Z=U.length+$.length+G.length,J=Z>1)+U+$+G+J.slice(Z);break;default:$=J+U+$+G;break}return o($)}return L.toString=function(){return p+""},L}function h(p,m){var g=Math.max(-8,Math.min(8,Math.floor(As(m)/3)))*3,b=Math.pow(10,-g),y=l((p=Fc(p),p.type="f",p),{suffix:qA[8+g/3]});return function(w){return y(b*w)}}return{format:l,formatPrefix:h}}var ad,CS,cD;YH({thousands:",",grouping:[3],currency:["$",""]});function YH(e){return ad=XH(e),CS=ad.format,cD=ad.formatPrefix,ad}function QH(e){return Math.max(0,-As(Math.abs(e)))}function ZH(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(As(t)/3)))*3-As(Math.abs(e)))}function JH(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,As(t)-As(e))+1}function uD(e,t,r,n){var i=_1(e,t,r),o;switch(n=Fc(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(o=ZH(i,s))&&(n.precision=o),cD(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=JH(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=QH(i))&&(n.precision=o-(n.type==="%")*2);break}}return CS(n)}function go(e){var t=e.domain;return e.ticks=function(r){var n=t();return w1(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return uD(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,o=n.length-1,s=n[i],u=n[o],f,l,h=10;for(u0;){if(l=S1(s,u,r),l===f)return n[i]=s,n[o]=u,t(n);if(l>0)s=Math.floor(s/l)*l,u=Math.ceil(u/l)*l;else if(l<0)s=Math.ceil(s*l)/l,u=Math.floor(u*l)/l;else break;f=l}return e},e}function Mh(){var e=NS();return e.copy=function(){return bu(e,Mh())},yn.apply(e,arguments),go(e)}function fD(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,Th),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return fD(e).unknown(t)},e=arguments.length?Array.from(e,Th):[0,1],go(r)}function dD(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],o=e[n],s;return oMath.pow(e,t)}function iV(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 HA(e){return(t,r)=>-e(-t,r)}function TS(e){const t=e(UA,WA),r=t.domain;let n=10,i,o;function s(){return i=iV(n),o=nV(n),r()[0]<0?(i=HA(i),o=HA(o),e(eV,tV)):e(UA,WA),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 f=r();let l=f[0],h=f[f.length-1];const p=h0){for(;m<=g;++m)for(b=1;bh)break;j.push(y)}}else for(;m<=g;++m)for(b=n-1;b>=1;--b)if(y=m>0?b/o(-m):b*o(m),!(yh)break;j.push(y)}j.length*2{if(u==null&&(u=10),f==null&&(f=n===10?"s":","),typeof f!="function"&&(!(n%1)&&(f=Fc(f)).precision==null&&(f.trim=!0),f=CS(f)),u===1/0)return f;const l=Math.max(1,n*u/t.ticks().length);return h=>{let p=h/o(Math.round(i(h)));return p*nr(dD(r(),{floor:u=>o(Math.floor(i(u))),ceil:u=>o(Math.ceil(i(u)))})),t}function hD(){const e=TS(qp()).domain([1,10]);return e.copy=()=>bu(e,hD()).base(e.base()),yn.apply(e,arguments),e}function VA(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function GA(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function kS(e){var t=1,r=e(VA(t),GA(t));return r.constant=function(n){return arguments.length?e(VA(t=+n),GA(t)):t},go(r)}function pD(){var e=kS(qp());return e.copy=function(){return bu(e,pD()).constant(e.constant())},yn.apply(e,arguments)}function KA(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function oV(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function aV(e){return e<0?-e*e:e*e}function RS(e){var t=e(xr,xr),r=1;function n(){return r===1?e(xr,xr):r===.5?e(oV,aV):e(KA(r),KA(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},go(t)}function MS(){var e=RS(qp());return e.copy=function(){return bu(e,MS()).exponent(e.exponent())},yn.apply(e,arguments),e}function sV(){return MS.apply(null,arguments).exponent(.5)}function XA(e){return Math.sign(e)*e*e}function lV(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function mD(){var e=NS(),t=[0,1],r=!1,n;function i(o){var s=lV(e(o));return isNaN(s)?n:r?Math.round(s):s}return i.invert=function(o){return e.invert(XA(o))},i.domain=function(o){return arguments.length?(e.domain(o),i):e.domain()},i.range=function(o){return arguments.length?(e.range((t=Array.from(o,Th)).map(XA)),i):t.slice()},i.rangeRound=function(o){return i.range(o).round(!0)},i.round=function(o){return arguments.length?(r=!!o,i):r},i.clamp=function(o){return arguments.length?(e.clamp(o),i):e.clamp()},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return mD(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},yn.apply(i,arguments),go(i)}function vD(){var e=[],t=[],r=[],n;function i(){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[l-1],n[l]]},s.unknown=function(f){return arguments.length&&(o=f),s},s.thresholds=function(){return n.slice()},s.copy=function(){return gD().domain([e,t]).range(i).unknown(o)},yn.apply(go(s),arguments)}function yD(){var e=[.5],t=[0,1],r,n=1;function i(o){return o!=null&&o<=o?t[yu(e,o,0,n)]:r}return i.domain=function(o){return arguments.length?(e=Array.from(o),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var s=t.indexOf(o);return[e[s-1],e[s]]},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return yD().domain(e).range(t).unknown(r)},yn.apply(i,arguments)}const Ux=new Date,Wx=new Date;function Vt(e,t,r,n){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{const s=i(o),u=i.ceil(o);return o-s(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,u)=>{const f=[];if(o=i.ceil(o),u=u==null?1:Math.floor(u),!(o0))return f;let l;do f.push(l=new Date(+o)),t(o,u),e(o);while(lVt(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,u)=>{if(s>=s)if(u<0)for(;++u<=0;)for(;t(s,-1),!o(s););else for(;--u>=0;)for(;t(s,1),!o(s););}),r&&(i.count=(o,s)=>(Ux.setTime(+o),Wx.setTime(+s),e(Ux),e(Wx),Math.floor(r(Ux,Wx))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(n?s=>n(s)%o===0:s=>i.count(0,s)%o===0):i)),i}const Ih=Vt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Ih.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Vt(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):Ih);Ih.range;const _i=1e3,pn=_i*60,ji=pn*60,Ai=ji*24,IS=Ai*7,YA=Ai*30,Hx=Ai*365,Xo=Vt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*_i)},(e,t)=>(t-e)/_i,e=>e.getUTCSeconds());Xo.range;const DS=Vt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*_i)},(e,t)=>{e.setTime(+e+t*pn)},(e,t)=>(t-e)/pn,e=>e.getMinutes());DS.range;const LS=Vt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*pn)},(e,t)=>(t-e)/pn,e=>e.getUTCMinutes());LS.range;const $S=Vt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*_i-e.getMinutes()*pn)},(e,t)=>{e.setTime(+e+t*ji)},(e,t)=>(t-e)/ji,e=>e.getHours());$S.range;const BS=Vt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*ji)},(e,t)=>(t-e)/ji,e=>e.getUTCHours());BS.range;const wu=Vt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*pn)/Ai,e=>e.getDate()-1);wu.range;const Up=Vt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ai,e=>e.getUTCDate()-1);Up.range;const xD=Vt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ai,e=>Math.floor(e/Ai));xD.range;function va(e){return Vt(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())*pn)/IS)}const Wp=va(0),Dh=va(1),cV=va(2),uV=va(3),Cs=va(4),fV=va(5),dV=va(6);Wp.range;Dh.range;cV.range;uV.range;Cs.range;fV.range;dV.range;function ga(e){return Vt(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)/IS)}const Hp=ga(0),Lh=ga(1),hV=ga(2),pV=ga(3),Ts=ga(4),mV=ga(5),vV=ga(6);Hp.range;Lh.range;hV.range;pV.range;Ts.range;mV.range;vV.range;const FS=Vt(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());FS.range;const zS=Vt(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());zS.range;const Ci=Vt(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());Ci.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Vt(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)});Ci.range;const Ti=Vt(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());Ti.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Vt(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)});Ti.range;function bD(e,t,r,n,i,o){const s=[[Xo,1,_i],[Xo,5,5*_i],[Xo,15,15*_i],[Xo,30,30*_i],[o,1,pn],[o,5,5*pn],[o,15,15*pn],[o,30,30*pn],[i,1,ji],[i,3,3*ji],[i,6,6*ji],[i,12,12*ji],[n,1,Ai],[n,2,2*Ai],[r,1,IS],[t,1,YA],[t,3,3*YA],[e,1,Hx]];function u(l,h,p){const m=hw).right(s,m);if(g===s.length)return e.every(_1(l/Hx,h/Hx,p));if(g===0)return Ih.every(Math.max(_1(l,h,p),1));const[b,y]=s[m/s[g-1][2]53)return null;"w"in Y||(Y.w=1),"Z"in Y?(Oe=Gx(rc(Y.y,0,1)),Ve=Oe.getUTCDay(),Oe=Ve>4||Ve===0?Lh.ceil(Oe):Lh(Oe),Oe=Up.offset(Oe,(Y.V-1)*7),Y.y=Oe.getUTCFullYear(),Y.m=Oe.getUTCMonth(),Y.d=Oe.getUTCDate()+(Y.w+6)%7):(Oe=Vx(rc(Y.y,0,1)),Ve=Oe.getDay(),Oe=Ve>4||Ve===0?Dh.ceil(Oe):Dh(Oe),Oe=wu.offset(Oe,(Y.V-1)*7),Y.y=Oe.getFullYear(),Y.m=Oe.getMonth(),Y.d=Oe.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),Ve="Z"in Y?Gx(rc(Y.y,0,1)).getUTCDay():Vx(rc(Y.y,0,1)).getDay(),Y.m=0,Y.d="W"in Y?(Y.w+6)%7+Y.W*7-(Ve+5)%7:Y.w+Y.U*7-(Ve+6)%7);return"Z"in Y?(Y.H+=Y.Z/100|0,Y.M+=Y.Z%100,Gx(Y)):Vx(Y)}}function R(te,le,ge,Y){for(var _e=0,Oe=le.length,Ve=ge.length,nt,lt;_e=Ve)return-1;if(nt=le.charCodeAt(_e++),nt===37){if(nt=le.charAt(_e++),lt=N[nt in QA?le.charAt(_e++):nt],!lt||(Y=lt(te,ge,Y))<0)return-1}else if(nt!=ge.charCodeAt(Y++))return-1}return Y}function I(te,le,ge){var Y=l.exec(le.slice(ge));return Y?(te.p=h.get(Y[0].toLowerCase()),ge+Y[0].length):-1}function F(te,le,ge){var Y=g.exec(le.slice(ge));return Y?(te.w=b.get(Y[0].toLowerCase()),ge+Y[0].length):-1}function L(te,le,ge){var Y=p.exec(le.slice(ge));return Y?(te.w=m.get(Y[0].toLowerCase()),ge+Y[0].length):-1}function $(te,le,ge){var Y=j.exec(le.slice(ge));return Y?(te.m=O.get(Y[0].toLowerCase()),ge+Y[0].length):-1}function U(te,le,ge){var Y=y.exec(le.slice(ge));return Y?(te.m=w.get(Y[0].toLowerCase()),ge+Y[0].length):-1}function G(te,le,ge){return R(te,t,le,ge)}function q(te,le,ge){return R(te,r,le,ge)}function H(te,le,ge){return R(te,n,le,ge)}function V(te){return s[te.getDay()]}function D(te){return o[te.getDay()]}function Z(te){return f[te.getMonth()]}function J(te){return u[te.getMonth()]}function M(te){return i[+(te.getHours()>=12)]}function B(te){return 1+~~(te.getMonth()/3)}function ee(te){return s[te.getUTCDay()]}function ae(te){return o[te.getUTCDay()]}function ie(te){return f[te.getUTCMonth()]}function fe(te){return u[te.getUTCMonth()]}function K(te){return i[+(te.getUTCHours()>=12)]}function ce(te){return 1+~~(te.getUTCMonth()/3)}return{format:function(te){var le=C(te+="",E);return le.toString=function(){return te},le},parse:function(te){var le=T(te+="",!1);return le.toString=function(){return te},le},utcFormat:function(te){var le=C(te+="",A);return le.toString=function(){return te},le},utcParse:function(te){var le=T(te+="",!0);return le.toString=function(){return te},le}}}var QA={"-":"",_:" ",0:"0"},Zt=/^\s*\d+/,SV=/^%/,_V=/[\\^$*+?|[\]().{}]/g;function st(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",o=i.length;return n+(o[t.toLowerCase(),r]))}function OV(e,t,r){var n=Zt.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function EV(e,t,r){var n=Zt.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function PV(e,t,r){var n=Zt.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function NV(e,t,r){var n=Zt.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function AV(e,t,r){var n=Zt.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function ZA(e,t,r){var n=Zt.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function JA(e,t,r){var n=Zt.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function CV(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 TV(e,t,r){var n=Zt.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function kV(e,t,r){var n=Zt.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function eC(e,t,r){var n=Zt.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function RV(e,t,r){var n=Zt.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function tC(e,t,r){var n=Zt.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function MV(e,t,r){var n=Zt.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function IV(e,t,r){var n=Zt.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function DV(e,t,r){var n=Zt.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function LV(e,t,r){var n=Zt.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function $V(e,t,r){var n=SV.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function BV(e,t,r){var n=Zt.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function FV(e,t,r){var n=Zt.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function rC(e,t){return st(e.getDate(),t,2)}function zV(e,t){return st(e.getHours(),t,2)}function qV(e,t){return st(e.getHours()%12||12,t,2)}function UV(e,t){return st(1+wu.count(Ci(e),e),t,3)}function wD(e,t){return st(e.getMilliseconds(),t,3)}function WV(e,t){return wD(e,t)+"000"}function HV(e,t){return st(e.getMonth()+1,t,2)}function VV(e,t){return st(e.getMinutes(),t,2)}function GV(e,t){return st(e.getSeconds(),t,2)}function KV(e){var t=e.getDay();return t===0?7:t}function XV(e,t){return st(Wp.count(Ci(e)-1,e),t,2)}function SD(e){var t=e.getDay();return t>=4||t===0?Cs(e):Cs.ceil(e)}function YV(e,t){return e=SD(e),st(Cs.count(Ci(e),e)+(Ci(e).getDay()===4),t,2)}function QV(e){return e.getDay()}function ZV(e,t){return st(Dh.count(Ci(e)-1,e),t,2)}function JV(e,t){return st(e.getFullYear()%100,t,2)}function eG(e,t){return e=SD(e),st(e.getFullYear()%100,t,2)}function tG(e,t){return st(e.getFullYear()%1e4,t,4)}function rG(e,t){var r=e.getDay();return e=r>=4||r===0?Cs(e):Cs.ceil(e),st(e.getFullYear()%1e4,t,4)}function nG(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+st(t/60|0,"0",2)+st(t%60,"0",2)}function nC(e,t){return st(e.getUTCDate(),t,2)}function iG(e,t){return st(e.getUTCHours(),t,2)}function oG(e,t){return st(e.getUTCHours()%12||12,t,2)}function aG(e,t){return st(1+Up.count(Ti(e),e),t,3)}function _D(e,t){return st(e.getUTCMilliseconds(),t,3)}function sG(e,t){return _D(e,t)+"000"}function lG(e,t){return st(e.getUTCMonth()+1,t,2)}function cG(e,t){return st(e.getUTCMinutes(),t,2)}function uG(e,t){return st(e.getUTCSeconds(),t,2)}function fG(e){var t=e.getUTCDay();return t===0?7:t}function dG(e,t){return st(Hp.count(Ti(e)-1,e),t,2)}function jD(e){var t=e.getUTCDay();return t>=4||t===0?Ts(e):Ts.ceil(e)}function hG(e,t){return e=jD(e),st(Ts.count(Ti(e),e)+(Ti(e).getUTCDay()===4),t,2)}function pG(e){return e.getUTCDay()}function mG(e,t){return st(Lh.count(Ti(e)-1,e),t,2)}function vG(e,t){return st(e.getUTCFullYear()%100,t,2)}function gG(e,t){return e=jD(e),st(e.getUTCFullYear()%100,t,2)}function yG(e,t){return st(e.getUTCFullYear()%1e4,t,4)}function xG(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Ts(e):Ts.ceil(e),st(e.getUTCFullYear()%1e4,t,4)}function bG(){return"+0000"}function iC(){return"%"}function oC(e){return+e}function aC(e){return Math.floor(+e/1e3)}var Ka,OD,ED;wG({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 wG(e){return Ka=wV(e),OD=Ka.format,Ka.parse,ED=Ka.utcFormat,Ka.utcParse,Ka}function SG(e){return new Date(e)}function _G(e){return e instanceof Date?+e:+new Date(+e)}function qS(e,t,r,n,i,o,s,u,f,l){var h=NS(),p=h.invert,m=h.domain,g=l(".%L"),b=l(":%S"),y=l("%I:%M"),w=l("%I %p"),j=l("%a %d"),O=l("%b %d"),E=l("%B"),A=l("%Y");function N(C){return(f(C)t(i/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,o)=>dH(e,o/n))},r.copy=function(){return CD(t).domain(e)},Li.apply(r,arguments)}function Gp(){var e=0,t=.5,r=1,n=1,i,o,s,u,f,l=xr,h,p=!1,m;function g(y){return isNaN(y=+y)?m:(y=.5+((y=+h(y))-o)*(n*yr}return Xx=e,Xx}var Yx,uC;function NG(){if(uC)return Yx;uC=1;var e=Kp(),t=MD(),r=il();function n(i){return i&&i.length?e(i,r,t):void 0}return Yx=n,Yx}var AG=NG();const Xp=ct(AG);var Qx,fC;function ID(){if(fC)return Qx;fC=1;function e(t,r){return te.e^o.s<0?1:-1;for(n=o.d.length,i=e.d.length,t=0,r=ne.d[t]^o.s<0?1:-1;return n===i?0:n>i^o.s<0?1:-1};Ne.decimalPlaces=Ne.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*St;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};Ne.dividedBy=Ne.div=function(e){return Pi(this,new this.constructor(e))};Ne.dividedToIntegerBy=Ne.idiv=function(e){var t=this,r=t.constructor;return mt(Pi(t,new r(e),0,1),r.precision)};Ne.equals=Ne.eq=function(e){return!this.cmp(e)};Ne.exponent=function(){return Dt(this)};Ne.greaterThan=Ne.gt=function(e){return this.cmp(e)>0};Ne.greaterThanOrEqualTo=Ne.gte=function(e){return this.cmp(e)>=0};Ne.isInteger=Ne.isint=function(){return this.e>this.d.length-2};Ne.isNegative=Ne.isneg=function(){return this.s<0};Ne.isPositive=Ne.ispos=function(){return this.s>0};Ne.isZero=function(){return this.s===0};Ne.lessThan=Ne.lt=function(e){return this.cmp(e)<0};Ne.lessThanOrEqualTo=Ne.lte=function(e){return this.cmp(e)<1};Ne.logarithm=Ne.log=function(e){var t,r=this,n=r.constructor,i=n.precision,o=i+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Yr))throw Error(vn+"NaN");if(r.s<1)throw Error(vn+(r.s?"NaN":"-Infinity"));return r.eq(Yr)?new n(0):(jt=!1,t=Pi(zc(r,o),zc(e,o),o),jt=!0,mt(t,i))};Ne.minus=Ne.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?BD(t,e):LD(t,(e.s=-e.s,e))};Ne.modulo=Ne.mod=function(e){var t,r=this,n=r.constructor,i=n.precision;if(e=new n(e),!e.s)throw Error(vn+"NaN");return r.s?(jt=!1,t=Pi(r,e,0,1).times(e),jt=!0,r.minus(t)):mt(new n(r),i)};Ne.naturalExponential=Ne.exp=function(){return $D(this)};Ne.naturalLogarithm=Ne.ln=function(){return zc(this)};Ne.negated=Ne.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Ne.plus=Ne.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?LD(t,e):BD(t,(e.s=-e.s,e))};Ne.precision=Ne.sd=function(e){var t,r,n,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Zo+e);if(t=Dt(i)+1,n=i.d.length-1,r=n*St+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};Ne.squareRoot=Ne.sqrt=function(){var e,t,r,n,i,o,s,u=this,f=u.constructor;if(u.s<1){if(!u.s)return new f(0);throw Error(vn+"NaN")}for(e=Dt(u),jt=!1,i=Math.sqrt(+u),i==0||i==1/0?(t=Xn(u.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=sl((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new f(t)):n=new f(i.toString()),r=f.precision,i=s=r+3;;)if(o=n,n=o.plus(Pi(u,o,s+2)).times(.5),Xn(o.d).slice(0,s)===(t=Xn(n.d)).slice(0,s)){if(t=t.slice(s-3,s+1),i==s&&t=="4999"){if(mt(o,r+1,0),o.times(o).eq(u)){n=o;break}}else if(t!="9999")break;s+=4}return jt=!0,mt(n,r)};Ne.times=Ne.mul=function(e){var t,r,n,i,o,s,u,f,l,h=this,p=h.constructor,m=h.d,g=(e=new p(e)).d;if(!h.s||!e.s)return new p(0);for(e.s*=h.s,r=h.e+e.e,f=m.length,l=g.length,f=0;){for(t=0,i=f+n;i>n;)u=o[i]+g[n]*m[i-n-1]+t,o[i--]=u%Yt|0,t=u/Yt|0;o[i]=(o[i]+t)%Yt|0}for(;!o[--s];)o.pop();return t?++r:o.shift(),e.d=o,e.e=r,jt?mt(e,p.precision):e};Ne.toDecimalPlaces=Ne.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(ti(e,0,al),t===void 0?t=n.rounding:ti(t,0,8),mt(r,e+Dt(r)+1,t))};Ne.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=na(n,!0):(ti(e,0,al),t===void 0?t=i.rounding:ti(t,0,8),n=mt(new i(n),e+1,t),r=na(n,!0,e+1)),r};Ne.toFixed=function(e,t){var r,n,i=this,o=i.constructor;return e===void 0?na(i):(ti(e,0,al),t===void 0?t=o.rounding:ti(t,0,8),n=mt(new o(i),e+Dt(i)+1,t),r=na(n.abs(),!1,e+Dt(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};Ne.toInteger=Ne.toint=function(){var e=this,t=e.constructor;return mt(new t(e),Dt(e)+1,t.rounding)};Ne.toNumber=function(){return+this};Ne.toPower=Ne.pow=function(e){var t,r,n,i,o,s,u=this,f=u.constructor,l=12,h=+(e=new f(e));if(!e.s)return new f(Yr);if(u=new f(u),!u.s){if(e.s<1)throw Error(vn+"Infinity");return u}if(u.eq(Yr))return u;if(n=f.precision,e.eq(Yr))return mt(u,n);if(t=e.e,r=e.d.length-1,s=t>=r,o=u.s,s){if((r=h<0?-h:h)<=DD){for(i=new f(Yr),t=Math.ceil(n/St+4),jt=!1;r%2&&(i=i.times(u),gC(i.d,t)),r=sl(r/2),r!==0;)u=u.times(u),gC(u.d,t);return jt=!0,e.s<0?new f(Yr).div(i):mt(i,n)}}else if(o<0)throw Error(vn+"NaN");return o=o<0&&e.d[Math.max(t,r)]&1?-1:1,u.s=1,jt=!1,i=e.times(zc(u,n+l)),jt=!0,i=$D(i),i.s=o,i};Ne.toPrecision=function(e,t){var r,n,i=this,o=i.constructor;return e===void 0?(r=Dt(i),n=na(i,r<=o.toExpNeg||r>=o.toExpPos)):(ti(e,1,al),t===void 0?t=o.rounding:ti(t,0,8),i=mt(new o(i),e,t),r=Dt(i),n=na(i,e<=r||r<=o.toExpNeg,e)),n};Ne.toSignificantDigits=Ne.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(ti(e,1,al),t===void 0?t=n.rounding:ti(t,0,8)),mt(new n(r),e,t)};Ne.toString=Ne.valueOf=Ne.val=Ne.toJSON=Ne[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Dt(e),r=e.constructor;return na(e,t<=r.toExpNeg||t>=r.toExpPos)};function LD(e,t){var r,n,i,o,s,u,f,l,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s||(t=new h(e)),jt?mt(t,p):t;if(f=e.d,l=t.d,s=e.e,i=t.e,f=f.slice(),o=s-i,o){for(o<0?(n=f,o=-o,u=l.length):(n=l,i=s,u=f.length),s=Math.ceil(p/St),u=s>u?s+1:u+1,o>u&&(o=u,n.length=1),n.reverse();o--;)n.push(0);n.reverse()}for(u=f.length,o=l.length,u-o<0&&(o=u,n=l,l=f,f=n),r=0;o;)r=(f[--o]=f[o]+l[o]+r)/Yt|0,f[o]%=Yt;for(r&&(f.unshift(r),++i),u=f.length;f[--u]==0;)f.pop();return t.d=f,t.e=i,jt?mt(t,p):t}function ti(e,t,r){if(e!==~~e||er)throw Error(Zo+e)}function Xn(e){var t,r,n,i=e.length-1,o="",s=e[0];if(i>0){for(o+=s,t=1;ts?1:-1;else for(u=f=0;ui[u]?1:-1;break}return f}function r(n,i,o){for(var s=0;o--;)n[o]-=s,s=n[o]1;)n.shift()}return function(n,i,o,s){var u,f,l,h,p,m,g,b,y,w,j,O,E,A,N,C,T,R,I=n.constructor,F=n.s==i.s?1:-1,L=n.d,$=i.d;if(!n.s)return new I(n);if(!i.s)throw Error(vn+"Division by zero");for(f=n.e-i.e,T=$.length,N=L.length,g=new I(F),b=g.d=[],l=0;$[l]==(L[l]||0);)++l;if($[l]>(L[l]||0)&&--f,o==null?O=o=I.precision:s?O=o+(Dt(n)-Dt(i))+1:O=o,O<0)return new I(0);if(O=O/St+2|0,l=0,T==1)for(h=0,$=$[0],O++;(l1&&($=e($,h),L=e(L,h),T=$.length,N=L.length),A=T,y=L.slice(0,T),w=y.length;w=Yt/2&&++C;do h=0,u=t($,y,T,w),u<0?(j=y[0],T!=w&&(j=j*Yt+(y[1]||0)),h=j/C|0,h>1?(h>=Yt&&(h=Yt-1),p=e($,h),m=p.length,w=y.length,u=t(p,y,m,w),u==1&&(h--,r(p,T16)throw Error(HS+Dt(e));if(!e.s)return new h(Yr);for(jt=!1,u=p,s=new h(.03125);e.abs().gte(.1);)e=e.times(s),l+=5;for(n=Math.log(Ho(2,l))/Math.LN10*2+5|0,u+=n,r=i=o=new h(Yr),h.precision=u;;){if(i=mt(i.times(e),u),r=r.times(++f),s=o.plus(Pi(i,r,u)),Xn(s.d).slice(0,u)===Xn(o.d).slice(0,u)){for(;l--;)o=mt(o.times(o),u);return h.precision=p,t==null?(jt=!0,mt(o,p)):o}o=s}}function Dt(e){for(var t=e.e*St,r=e.d[0];r>=10;r/=10)t++;return t}function rb(e,t,r){if(t>e.LN10.sd())throw jt=!0,r&&(e.precision=r),Error(vn+"LN10 precision limit exceeded");return mt(new e(e.LN10),t)}function so(e){for(var t="";e--;)t+="0";return t}function zc(e,t){var r,n,i,o,s,u,f,l,h,p=1,m=10,g=e,b=g.d,y=g.constructor,w=y.precision;if(g.s<1)throw Error(vn+(g.s?"NaN":"-Infinity"));if(g.eq(Yr))return new y(0);if(t==null?(jt=!1,l=w):l=t,g.eq(10))return t==null&&(jt=!0),rb(y,l);if(l+=m,y.precision=l,r=Xn(b),n=r.charAt(0),o=Dt(g),Math.abs(o)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)g=g.times(e),r=Xn(g.d),n=r.charAt(0),p++;o=Dt(g),n>1?(g=new y("0."+r),o++):g=new y(n+"."+r.slice(1))}else return f=rb(y,l+2,w).times(o+""),g=zc(new y(n+"."+r.slice(1)),l-m).plus(f),y.precision=w,t==null?(jt=!0,mt(g,w)):g;for(u=s=g=Pi(g.minus(Yr),g.plus(Yr),l),h=mt(g.times(g),l),i=3;;){if(s=mt(s.times(h),l),f=u.plus(Pi(s,new y(i),l)),Xn(f.d).slice(0,l)===Xn(u.d).slice(0,l))return u=u.times(2),o!==0&&(u=u.plus(rb(y,l+2,w).times(o+""))),u=Pi(u,new y(p),l),y.precision=w,t==null?(jt=!0,mt(u,w)):u;u=f,i+=2}}function vC(e,t){var r,n,i;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(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(n,i),t){if(i-=n,r=r-n-1,e.e=sl(r/St),e.d=[],n=(r+1)%St,r<0&&(n+=St),n$h||e.e<-$h))throw Error(HS+r)}else e.s=0,e.e=0,e.d=[0];return e}function mt(e,t,r){var n,i,o,s,u,f,l,h,p=e.d;for(s=1,o=p[0];o>=10;o/=10)s++;if(n=t-s,n<0)n+=St,i=t,l=p[h=0];else{if(h=Math.ceil((n+1)/St),o=p.length,h>=o)return e;for(l=o=p[h],s=1;o>=10;o/=10)s++;n%=St,i=n-St+s}if(r!==void 0&&(o=Ho(10,s-i-1),u=l/o%10|0,f=t<0||p[h+1]!==void 0||l%o,f=r<4?(u||f)&&(r==0||r==(e.s<0?3:2)):u>5||u==5&&(r==4||f||r==6&&(n>0?i>0?l/Ho(10,s-i):0:p[h-1])%10&1||r==(e.s<0?8:7))),t<1||!p[0])return f?(o=Dt(e),p.length=1,t=t-o-1,p[0]=Ho(10,(St-t%St)%St),e.e=sl(-t/St)||0):(p.length=1,p[0]=e.e=e.s=0),e;if(n==0?(p.length=h,o=1,h--):(p.length=h+1,o=Ho(10,St-n),p[h]=i>0?(l/Ho(10,s-i)%Ho(10,i)|0)*o:0),f)for(;;)if(h==0){(p[0]+=o)==Yt&&(p[0]=1,++e.e);break}else{if(p[h]+=o,p[h]!=Yt)break;p[h--]=0,o=1}for(n=p.length;p[--n]===0;)p.pop();if(jt&&(e.e>$h||e.e<-$h))throw Error(HS+Dt(e));return e}function BD(e,t){var r,n,i,o,s,u,f,l,h,p,m=e.constructor,g=m.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new m(e),jt?mt(t,g):t;if(f=e.d,p=t.d,n=t.e,l=e.e,f=f.slice(),s=l-n,s){for(h=s<0,h?(r=f,s=-s,u=p.length):(r=p,n=l,u=f.length),i=Math.max(Math.ceil(g/St),u)+2,s>i&&(s=i,r.length=1),r.reverse(),i=s;i--;)r.push(0);r.reverse()}else{for(i=f.length,u=p.length,h=i0;--i)f[u++]=0;for(i=p.length;i>s;){if(f[--i]0?o=o.charAt(0)+"."+o.slice(1)+so(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+so(-i-1)+o,r&&(n=r-s)>0&&(o+=so(n))):i>=s?(o+=so(i+1-s),r&&(n=r-i-1)>0&&(o=o+"."+so(n))):((n=i+1)0&&(i+1===s&&(o+="."),o+=so(n))),e.s<0?"-"+o:o}function gC(e,t){if(e.length>t)return e.length=t,!0}function FD(e){var t,r,n;function i(o){var s=this;if(!(s instanceof i))return new i(o);if(s.constructor=i,o instanceof i){s.s=o.s,s.e=o.e,s.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(Zo+o);if(o>0)s.s=1;else if(o<0)o=-o,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(o===~~o&&o<1e7){s.e=0,s.d=[o];return}return vC(s,o.toString())}else if(typeof o!="string")throw Error(Zo+o);if(o.charCodeAt(0)===45?(o=o.slice(1),s.s=-1):s.s=1,BG.test(o))vC(s,o);else throw Error(Zo+o)}if(i.prototype=Ne,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=FD,i.config=i.set=FG,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&n<=i[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 VS=FD($G);Yr=new VS(1);const pt=VS;function zG(e){return HG(e)||WG(e)||UG(e)||qG()}function qG(){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 UG(e,t){if(e){if(typeof e=="string")return N1(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 N1(e,t)}}function WG(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function HG(e){if(Array.isArray(e))return N1(e)}function N1(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t?r.apply(void 0,i):e(t-s,yC(function(){for(var u=arguments.length,f=new Array(u),l=0;le.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,i=!1,o=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(f){i=!0,o=f}finally{try{!n&&s.return!=null&&s.return()}finally{if(i)throw o}}return r}}function aK(e){if(Array.isArray(e))return e}function HD(e){var t=qc(e,2),r=t[0],n=t[1],i=r,o=n;return r>n&&(i=n,o=r),[i,o]}function VD(e,t,r){if(e.lte(0))return new pt(0);var n=Zp.getDigitCount(e.toNumber()),i=new pt(10).pow(n),o=e.div(i),s=n!==1?.05:.1,u=new pt(Math.ceil(o.div(s).toNumber())).add(r).mul(s),f=u.mul(i);return t?f:new pt(Math.ceil(f))}function sK(e,t,r){var n=1,i=new pt(e);if(!i.isint()&&r){var o=Math.abs(e);o<1?(n=new pt(10).pow(Zp.getDigitCount(e)-1),i=new pt(Math.floor(i.div(n).toNumber())).mul(n)):o>1&&(i=new pt(Math.floor(e)))}else e===0?i=new pt(Math.floor((t-1)/2)):r||(i=new pt(Math.floor(e)));var s=Math.floor((t-1)/2),u=XG(KG(function(f){return i.add(new pt(f-s).mul(n)).toNumber()}),A1);return u(0,t)}function GD(e,t,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new pt(0),tickMin:new pt(0),tickMax:new pt(0)};var o=VD(new pt(t).sub(e).div(r-1),n,i),s;e<=0&&t>=0?s=new pt(0):(s=new pt(e).add(t).div(2),s=s.sub(new pt(s).mod(o)));var u=Math.ceil(s.sub(e).div(o).toNumber()),f=Math.ceil(new pt(t).sub(s).div(o).toNumber()),l=u+f+1;return l>r?GD(e,t,r,n,i+1):(l0?f+(r-l):f,u=t>0?u:u+(r-l)),{step:o,tickMin:s.sub(new pt(u).mul(o)),tickMax:s.add(new pt(f).mul(o))})}function lK(e){var t=qc(e,2),r=t[0],n=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(i,2),u=HD([r,n]),f=qc(u,2),l=f[0],h=f[1];if(l===-1/0||h===1/0){var p=h===1/0?[l].concat(T1(A1(0,i-1).map(function(){return 1/0}))):[].concat(T1(A1(0,i-1).map(function(){return-1/0})),[h]);return r>n?C1(p):p}if(l===h)return sK(l,i,o);var m=GD(l,h,s,o),g=m.step,b=m.tickMin,y=m.tickMax,w=Zp.rangeStep(b,y.add(new pt(.1).mul(g)),g);return r>n?C1(w):w}function cK(e,t){var r=qc(e,2),n=r[0],i=r[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=HD([n,i]),u=qc(s,2),f=u[0],l=u[1];if(f===-1/0||l===1/0)return[n,i];if(f===l)return[f];var h=Math.max(t,2),p=VD(new pt(l).sub(f).div(h-1),o,0),m=[].concat(T1(Zp.rangeStep(new pt(f),new pt(l).sub(new pt(.99).mul(p)),p)),[l]);return n>i?C1(m):m}var uK=UD(lK),fK=UD(cK),dK="Invariant failed";function ia(e,t){throw new Error(dK)}var hK=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function ks(e){"@babel/helpers - typeof";return ks=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},ks(e)}function Bh(){return Bh=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 bK(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 wK(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function SK(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]:[],i=arguments.length>2?arguments[2]:void 0,o=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(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var f=o.range,l=0;l0?i[l-1].coordinate:i[u-1].coordinate,p=i[l].coordinate,m=l>=u-1?i[0].coordinate:i[l+1].coordinate,g=void 0;if(gr(p-h)!==gr(m-p)){var b=[];if(gr(m-p)===gr(f[1]-f[0])){g=m;var y=p+f[1]-f[0];b[0]=Math.min(y,(y+h)/2),b[1]=Math.max(y,(y+h)/2)}else{g=h;var w=m+f[1]-f[0];b[0]=Math.min(p,(w+p)/2),b[1]=Math.max(p,(w+p)/2)}var j=[Math.min(p,(g+p)/2),Math.max(p,(g+p)/2)];if(t>j[0]&&t<=j[1]||t>=b[0]&&t<=b[1]){s=i[l].index;break}}else{var O=Math.min(h,m),E=Math.max(h,m);if(t>(O+p)/2&&t<=(E+p)/2){s=i[l].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},GS=function(t){var r,n=t,i=n.type.displayName,o=(r=t.type)!==null&&r!==void 0&&r.defaultProps?Ct(Ct({},t.type.defaultProps),t.props):t.props,s=o.stroke,u=o.fill,f;switch(i){case"Line":f=s;break;case"Area":case"Radar":f=s&&s!=="none"?s:u;break;default:f=u;break}return f},BK=function(t){var r=t.barSize,n=t.totalSize,i=t.stackGroups,o=i===void 0?{}:i;if(!o)return{};for(var s={},u=Object.keys(o),f=0,l=u.length;f=0});if(j&&j.length){var O=j[0].type.defaultProps,E=O!==void 0?Ct(Ct({},O),j[0].props):j[0].props,A=E.barSize,N=E[w];s[N]||(s[N]=[]);var C=We(A)?r:A;s[N].push({item:j[0],stackList:j.slice(1),barSize:We(C)?void 0:yr(C,n,0)})}}return s},FK=function(t){var r=t.barGap,n=t.barCategoryGap,i=t.bandSize,o=t.sizeList,s=o===void 0?[]:o,u=t.maxBarSize,f=s.length;if(f<1)return null;var l=yr(r,i,0,!0),h,p=[];if(s[0].barSize===+s[0].barSize){var m=!1,g=i/f,b=s.reduce(function(A,N){return A+N.barSize||0},0);b+=(f-1)*l,b>=i&&(b-=(f-1)*l,l=0),b>=i&&g>0&&(m=!0,g*=.9,b=f*g);var y=(i-b)/2>>0,w={offset:y-l,size:0};h=s.reduce(function(A,N){var C={item:N.item,position:{offset:w.offset+w.size+l,size:m?g:N.barSize}},T=[].concat(wC(A),[C]);return w=T[T.length-1].position,N.stackList&&N.stackList.length&&N.stackList.forEach(function(R){T.push({item:R,position:w})}),T},p)}else{var j=yr(n,i,0,!0);i-2*j-(f-1)*l<=0&&(l=0);var O=(i-2*j-(f-1)*l)/f;O>1&&(O>>=0);var E=u===+u?Math.min(O,u):O;h=s.reduce(function(A,N,C){var T=[].concat(wC(A),[{item:N.item,position:{offset:j+(O+l)*C+(O-E)/2,size:E}}]);return N.stackList&&N.stackList.length&&N.stackList.forEach(function(R){T.push({item:R,position:T[T.length-1].position})}),T},p)}return h},zK=function(t,r,n,i){var o=n.children,s=n.width,u=n.margin,f=s-(u.left||0)-(u.right||0),l=QD({children:o,legendWidth:f});if(l){var h=i||{},p=h.width,m=h.height,g=l.align,b=l.verticalAlign,y=l.layout;if((y==="vertical"||y==="horizontal"&&b==="middle")&&g!=="center"&&be(t[g]))return Ct(Ct({},t),{},ps({},g,t[g]+(p||0)));if((y==="horizontal"||y==="vertical"&&g==="center")&&b!=="middle"&&be(t[b]))return Ct(Ct({},t),{},ps({},b,t[b]+(m||0)))}return t},qK=function(t,r,n){return We(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},ZD=function(t,r,n,i,o){var s=r.props.children,u=Zr(s,_u).filter(function(l){return qK(i,o,l.props.direction)});if(u&&u.length){var f=u.map(function(l){return l.props.dataKey});return t.reduce(function(l,h){var p=Wt(h,n);if(We(p))return l;var m=Array.isArray(p)?[Yp(p),Xp(p)]:[p,p],g=f.reduce(function(b,y){var w=Wt(h,y,0),j=m[0]-Math.abs(Array.isArray(w)?w[0]:w),O=m[1]+Math.abs(Array.isArray(w)?w[1]:w);return[Math.min(j,b[0]),Math.max(O,b[1])]},[1/0,-1/0]);return[Math.min(g[0],l[0]),Math.max(g[1],l[1])]},[1/0,-1/0])}return null},UK=function(t,r,n,i,o){var s=r.map(function(u){return ZD(t,u,n,o,i)}).filter(function(u){return!We(u)});return s&&s.length?s.reduce(function(u,f){return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]):null},JD=function(t,r,n,i,o){var s=r.map(function(f){var l=f.props.dataKey;return n==="number"&&l&&ZD(t,f,l,i)||Sc(t,l,n,o)});if(n==="number")return s.reduce(function(f,l){return[Math.min(f[0],l[0]),Math.max(f[1],l[1])]},[1/0,-1/0]);var u={};return s.reduce(function(f,l){for(var h=0,p=l.length;h=2?gr(u[0]-u[1])*2*l:l,r&&(t.ticks||t.niceTicks)){var h=(t.ticks||t.niceTicks).map(function(p){var m=o?o.indexOf(p):p;return{coordinate:i(m)+l,value:p,offset:l}});return h.filter(function(p){return!vu(p.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(p,m){return{coordinate:i(p)+l,value:p,index:m,offset:l}}):i.ticks&&!n?i.ticks(t.tickCount).map(function(p){return{coordinate:i(p)+l,value:p,offset:l}}):i.domain().map(function(p,m){return{coordinate:i(p)+l,value:o?o[p]:p,index:m,offset:l}})},nb=new WeakMap,sd=function(t,r){if(typeof r!="function")return t;nb.has(t)||nb.set(t,new WeakMap);var n=nb.get(t);if(n.has(r))return n.get(r);var i=function(){t.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,i),i},rL=function(t,r,n){var i=t.scale,o=t.type,s=t.layout,u=t.axisType;if(i==="auto")return s==="radial"&&u==="radiusAxis"?{scale:Dc(),realScaleType:"band"}:s==="radial"&&u==="angleAxis"?{scale:Mh(),realScaleType:"linear"}:o==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:wc(),realScaleType:"point"}:o==="category"?{scale:Dc(),realScaleType:"band"}:{scale:Mh(),realScaleType:"linear"};if(ea(i)){var f="scale".concat(Mp(i));return{scale:(sC[f]||wc)(),realScaleType:sC[f]?f:"point"}}return qe(i)?{scale:i}:{scale:wc(),realScaleType:"point"}},_C=1e-4,nL=function(t){var r=t.domain();if(!(!r||r.length<=2)){var n=r.length,i=t.range(),o=Math.min(i[0],i[1])-_C,s=Math.max(i[0],i[1])+_C,u=t(r[0]),f=t(r[n-1]);(us||fs)&&t.domain([r[0],r[n-1]])}},WK=function(t,r){if(!t)return null;for(var n=0,i=t.length;ni)&&(o[1]=i),o[0]>i&&(o[0]=i),o[1]=0?(t[u][n][0]=o,t[u][n][1]=o+f,o=t[u][n][1]):(t[u][n][0]=s,t[u][n][1]=s+f,s=t[u][n][1])}},GK=function(t){var r=t.length;if(!(r<=0))for(var n=0,i=t[0].length;n=0?(t[s][n][0]=o,t[s][n][1]=o+u,o=t[s][n][1]):(t[s][n][0]=0,t[s][n][1]=0)}},KK={sign:VK,expand:I9,none:js,silhouette:D9,wiggle:L9,positive:GK},XK=function(t,r,n){var i=r.map(function(u){return u.props.dataKey}),o=KK[n],s=M9().keys(i).value(function(u,f){return+Wt(u,f,0)}).order(u1).offset(o);return s(t)},YK=function(t,r,n,i,o,s){if(!t)return null;var u=s?r.reverse():r,f={},l=u.reduce(function(p,m){var g,b=(g=m.type)!==null&&g!==void 0&&g.defaultProps?Ct(Ct({},m.type.defaultProps),m.props):m.props,y=b.stackId,w=b.hide;if(w)return p;var j=b[n],O=p[j]||{hasStack:!1,stackGroups:{}};if(Ht(y)){var E=O.stackGroups[y]||{numericAxisId:n,cateAxisId:i,items:[]};E.items.push(m),O.hasStack=!0,O.stackGroups[y]=E}else O.stackGroups[nl("_stackId_")]={numericAxisId:n,cateAxisId:i,items:[m]};return Ct(Ct({},p),{},ps({},j,O))},f),h={};return Object.keys(l).reduce(function(p,m){var g=l[m];if(g.hasStack){var b={};g.stackGroups=Object.keys(g.stackGroups).reduce(function(y,w){var j=g.stackGroups[w];return Ct(Ct({},y),{},ps({},w,{numericAxisId:n,cateAxisId:i,items:j.items,stackedData:XK(t,j.items,o)}))},b)}return Ct(Ct({},p),{},ps({},m,g))},h)},iL=function(t,r){var n=r.realScaleType,i=r.type,o=r.tickCount,s=r.originalDomain,u=r.allowDecimals,f=n||r.scale;if(f!=="auto"&&f!=="linear")return null;if(o&&i==="number"&&s&&(s[0]==="auto"||s[1]==="auto")){var l=t.domain();if(!l.length)return null;var h=uK(l,o,u);return t.domain([Yp(h),Xp(h)]),{niceTicks:h}}if(o&&i==="number"){var p=t.domain(),m=fK(p,o,u);return{niceTicks:m}}return null};function jC(e){var t=e.axis,r=e.ticks,n=e.bandSize,i=e.entry,o=e.index,s=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!We(i[t.dataKey])){var u=ph(r,"value",i[t.dataKey]);if(u)return u.coordinate+n/2}return r[o]?r[o].coordinate+n/2:null}var f=Wt(i,We(s)?t.dataKey:s);return We(f)?null:t.scale(f)}var OC=function(t){var r=t.axis,n=t.ticks,i=t.offset,o=t.bandSize,s=t.entry,u=t.index;if(r.type==="category")return n[u]?n[u].coordinate+i:null;var f=Wt(s,r.dataKey,r.domain[u]);return We(f)?null:r.scale(f)-o/2+i},QK=function(t){var r=t.numericAxis,n=r.scale.domain();if(r.type==="number"){var i=Math.min(n[0],n[1]),o=Math.max(n[0],n[1]);return i<=0&&o>=0?0:o<0?o:i}return n[0]},ZK=function(t,r){var n,i=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Ct(Ct({},t.type.defaultProps),t.props):t.props,o=i.stackId;if(Ht(o)){var s=r[o];if(s){var u=s.items.indexOf(t);return u>=0?s.stackedData[u]:null}}return null},JK=function(t){return t.reduce(function(r,n){return[Yp(n.concat([r[0]]).filter(be)),Xp(n.concat([r[1]]).filter(be))]},[1/0,-1/0])},oL=function(t,r,n){return Object.keys(t).reduce(function(i,o){var s=t[o],u=s.stackedData,f=u.reduce(function(l,h){var p=JK(h.slice(r,n+1));return[Math.min(l[0],p[0]),Math.max(l[1],p[1])]},[1/0,-1/0]);return[Math.min(f[0],i[0]),Math.max(f[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},EC=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,PC=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,I1=function(t,r,n){if(qe(t))return t(r,n);if(!Array.isArray(t))return r;var i=[];if(be(t[0]))i[0]=n?t[0]:Math.min(t[0],r[0]);else if(EC.test(t[0])){var o=+EC.exec(t[0])[1];i[0]=r[0]-o}else qe(t[0])?i[0]=t[0](r[0]):i[0]=r[0];if(be(t[1]))i[1]=n?t[1]:Math.max(t[1],r[1]);else if(PC.test(t[1])){var s=+PC.exec(t[1])[1];i[1]=r[1]+s}else qe(t[1])?i[1]=t[1](r[1]):i[1]=r[1];return i},zh=function(t,r,n){if(t&&t.scale&&t.scale.bandwidth){var i=t.scale.bandwidth();if(!n||i>0)return i}if(t&&r&&r.length>=2){for(var o=wS(r,function(p){return p.coordinate}),s=1/0,u=1,f=o.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},lX=function(t,r,n,i,o){var s=t.width,u=t.height,f=t.startAngle,l=t.endAngle,h=yr(t.cx,s,s/2),p=yr(t.cy,u,u/2),m=lL(s,u,n),g=yr(t.innerRadius,m,0),b=yr(t.outerRadius,m,m*.8),y=Object.keys(r);return y.reduce(function(w,j){var O=r[j],E=O.domain,A=O.reversed,N;if(We(O.range))i==="angleAxis"?N=[f,l]:i==="radiusAxis"&&(N=[g,b]),A&&(N=[N[1],N[0]]);else{N=O.range;var C=N,T=rX(C,2);f=T[0],l=T[1]}var R=rL(O,o),I=R.realScaleType,F=R.scale;F.domain(E).range(N),nL(F);var L=iL(F,wi(wi({},O),{},{realScaleType:I})),$=wi(wi(wi({},O),L),{},{range:N,radius:b,realScaleType:I,scale:F,cx:h,cy:p,innerRadius:g,outerRadius:b,startAngle:f,endAngle:l});return wi(wi({},w),{},sL({},j,$))},{})},cX=function(t,r){var n=t.x,i=t.y,o=r.x,s=r.y;return Math.sqrt(Math.pow(n-o,2)+Math.pow(i-s,2))},uX=function(t,r){var n=t.x,i=t.y,o=r.cx,s=r.cy,u=cX({x:n,y:i},{x:o,y:s});if(u<=0)return{radius:u};var f=(n-o)/u,l=Math.acos(f);return i>s&&(l=2*Math.PI-l),{radius:u,angle:sX(l),angleInRadian:l}},fX=function(t){var r=t.startAngle,n=t.endAngle,i=Math.floor(r/360),o=Math.floor(n/360),s=Math.min(i,o);return{startAngle:r-s*360,endAngle:n-s*360}},dX=function(t,r){var n=r.startAngle,i=r.endAngle,o=Math.floor(n/360),s=Math.floor(i/360),u=Math.min(o,s);return t+u*360},TC=function(t,r){var n=t.x,i=t.y,o=uX({x:n,y:i},r),s=o.radius,u=o.angle,f=r.innerRadius,l=r.outerRadius;if(sl)return!1;if(s===0)return!0;var h=fX(r),p=h.startAngle,m=h.endAngle,g=u,b;if(p<=m){for(;g>m;)g-=360;for(;g=p&&g<=m}else{for(;g>p;)g-=360;for(;g=m&&g<=p}return b?wi(wi({},r),{},{radius:s,angle:dX(g,r)}):null},cL=function(t){return!S.isValidElement(t)&&!qe(t)&&typeof t!="boolean"?t.className:""};function Vc(e){"@babel/helpers - typeof";return Vc=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},Vc(e)}var hX=["offset"];function pX(e){return yX(e)||gX(e)||vX(e)||mX()}function mX(){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 vX(e,t){if(e){if(typeof e=="string")return D1(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 D1(e,t)}}function gX(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function yX(e){if(Array.isArray(e))return D1(e)}function D1(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 bX(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 kC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ut(e){for(var t=1;t=0?1:-1,E,A;i==="insideStart"?(E=g+O*s,A=y):i==="insideEnd"?(E=b-O*s,A=!y):i==="end"&&(E=b+O*s,A=y),A=j<=0?A:!A;var N=xt(l,h,w,E),C=xt(l,h,w,E+(A?1:-1)*359),T="M".concat(N.x,",").concat(N.y,` - A`).concat(w,",").concat(w,",0,1,").concat(A?0:1,`, - `).concat(C.x,",").concat(C.y),R=We(t.id)?nl("recharts-radial-line-"):t.id;return z.createElement("text",Gc({},n,{dominantBaseline:"central",className:He("recharts-radial-bar-label",u)}),z.createElement("defs",null,z.createElement("path",{id:R,d:T})),z.createElement("textPath",{xlinkHref:"#".concat(R)},r))},PX=function(t){var r=t.viewBox,n=t.offset,i=t.position,o=r,s=o.cx,u=o.cy,f=o.innerRadius,l=o.outerRadius,h=o.startAngle,p=o.endAngle,m=(h+p)/2;if(i==="outside"){var g=xt(s,u,l+n,m),b=g.x,y=g.y;return{x:b,y,textAnchor:b>=s?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:s,y:u,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:s,y:u,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:s,y:u,textAnchor:"middle",verticalAnchor:"end"};var w=(f+l)/2,j=xt(s,u,w,m),O=j.x,E=j.y;return{x:O,y:E,textAnchor:"middle",verticalAnchor:"middle"}},NX=function(t){var r=t.viewBox,n=t.parentViewBox,i=t.offset,o=t.position,s=r,u=s.x,f=s.y,l=s.width,h=s.height,p=h>=0?1:-1,m=p*i,g=p>0?"end":"start",b=p>0?"start":"end",y=l>=0?1:-1,w=y*i,j=y>0?"end":"start",O=y>0?"start":"end";if(o==="top"){var E={x:u+l/2,y:f-p*i,textAnchor:"middle",verticalAnchor:g};return Ut(Ut({},E),n?{height:Math.max(f-n.y,0),width:l}:{})}if(o==="bottom"){var A={x:u+l/2,y:f+h+m,textAnchor:"middle",verticalAnchor:b};return Ut(Ut({},A),n?{height:Math.max(n.y+n.height-(f+h),0),width:l}:{})}if(o==="left"){var N={x:u-w,y:f+h/2,textAnchor:j,verticalAnchor:"middle"};return Ut(Ut({},N),n?{width:Math.max(N.x-n.x,0),height:h}:{})}if(o==="right"){var C={x:u+l+w,y:f+h/2,textAnchor:O,verticalAnchor:"middle"};return Ut(Ut({},C),n?{width:Math.max(n.x+n.width-C.x,0),height:h}:{})}var T=n?{width:l,height:h}:{};return o==="insideLeft"?Ut({x:u+w,y:f+h/2,textAnchor:O,verticalAnchor:"middle"},T):o==="insideRight"?Ut({x:u+l-w,y:f+h/2,textAnchor:j,verticalAnchor:"middle"},T):o==="insideTop"?Ut({x:u+l/2,y:f+m,textAnchor:"middle",verticalAnchor:b},T):o==="insideBottom"?Ut({x:u+l/2,y:f+h-m,textAnchor:"middle",verticalAnchor:g},T):o==="insideTopLeft"?Ut({x:u+w,y:f+m,textAnchor:O,verticalAnchor:b},T):o==="insideTopRight"?Ut({x:u+l-w,y:f+m,textAnchor:j,verticalAnchor:b},T):o==="insideBottomLeft"?Ut({x:u+w,y:f+h-m,textAnchor:O,verticalAnchor:g},T):o==="insideBottomRight"?Ut({x:u+l-w,y:f+h-m,textAnchor:j,verticalAnchor:g},T):rl(o)&&(be(o.x)||Go(o.x))&&(be(o.y)||Go(o.y))?Ut({x:u+yr(o.x,l),y:f+yr(o.y,h),textAnchor:"end",verticalAnchor:"end"},T):Ut({x:u+l/2,y:f+h/2,textAnchor:"middle",verticalAnchor:"middle"},T)},AX=function(t){return"cx"in t&&be(t.cx)};function Qt(e){var t=e.offset,r=t===void 0?5:t,n=xX(e,hX),i=Ut({offset:r},n),o=i.viewBox,s=i.position,u=i.value,f=i.children,l=i.content,h=i.className,p=h===void 0?"":h,m=i.textBreakAll;if(!o||We(u)&&We(f)&&!S.isValidElement(l)&&!qe(l))return null;if(S.isValidElement(l))return S.cloneElement(l,i);var g;if(qe(l)){if(g=S.createElement(l,i),S.isValidElement(g))return g}else g=jX(i);var b=AX(o),y=Be(i,!0);if(b&&(s==="insideStart"||s==="insideEnd"||s==="end"))return EX(i,g,y);var w=b?PX(i):NX(i);return z.createElement(ra,Gc({className:He("recharts-label",p)},y,w,{breakAll:m}),g)}Qt.displayName="Label";var uL=function(t){var r=t.cx,n=t.cy,i=t.angle,o=t.startAngle,s=t.endAngle,u=t.r,f=t.radius,l=t.innerRadius,h=t.outerRadius,p=t.x,m=t.y,g=t.top,b=t.left,y=t.width,w=t.height,j=t.clockWise,O=t.labelViewBox;if(O)return O;if(be(y)&&be(w)){if(be(p)&&be(m))return{x:p,y:m,width:y,height:w};if(be(g)&&be(b))return{x:g,y:b,width:y,height:w}}return be(p)&&be(m)?{x:p,y:m,width:0,height:0}:be(r)&&be(n)?{cx:r,cy:n,startAngle:o||i||0,endAngle:s||i||0,innerRadius:l||0,outerRadius:h||f||u||0,clockWise:j}:t.viewBox?t.viewBox:{}},CX=function(t,r){return t?t===!0?z.createElement(Qt,{key:"label-implicit",viewBox:r}):Ht(t)?z.createElement(Qt,{key:"label-implicit",viewBox:r,value:t}):S.isValidElement(t)?t.type===Qt?S.cloneElement(t,{key:"label-implicit",viewBox:r}):z.createElement(Qt,{key:"label-implicit",content:t,viewBox:r}):qe(t)?z.createElement(Qt,{key:"label-implicit",content:t,viewBox:r}):rl(t)?z.createElement(Qt,Gc({viewBox:r},t,{key:"label-implicit"})):null:null},TX=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 i=t.children,o=uL(t),s=Zr(i,Qt).map(function(f,l){return S.cloneElement(f,{viewBox:r||o,key:"label-".concat(l)})});if(!n)return s;var u=CX(t.label,r||o);return[u].concat(pX(s))};Qt.parseViewBox=uL;Qt.renderCallByParent=TX;var ib,RC;function kX(){if(RC)return ib;RC=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return ib=e,ib}var RX=kX();const MX=ct(RX);function Kc(e){"@babel/helpers - typeof";return Kc=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},Kc(e)}var IX=["valueAccessor"],DX=["data","dataKey","clockWise","id","textBreakAll"];function LX(e){return zX(e)||FX(e)||BX(e)||$X()}function $X(){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 BX(e,t){if(e){if(typeof e=="string")return L1(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 L1(e,t)}}function FX(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function zX(e){if(Array.isArray(e))return L1(e)}function L1(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 HX(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 VX=function(t){return Array.isArray(t.value)?MX(t.value):t.value};function Ni(e){var t=e.valueAccessor,r=t===void 0?VX:t,n=DC(e,IX),i=n.data,o=n.dataKey,s=n.clockWise,u=n.id,f=n.textBreakAll,l=DC(n,DX);return!i||!i.length?null:z.createElement(at,{className:"recharts-label-list"},i.map(function(h,p){var m=We(o)?r(h,p):Wt(h&&h.payload,o),g=We(u)?{}:{id:"".concat(u,"-").concat(p)};return z.createElement(Qt,Uh({},Be(h,!0),l,g,{parentViewBox:h.parentViewBox,value:m,textBreakAll:f,viewBox:Qt.parseViewBox(We(s)?h:IC(IC({},h),{},{clockWise:s})),key:"label-".concat(p),index:p}))}))}Ni.displayName="LabelList";function GX(e,t){return e?e===!0?z.createElement(Ni,{key:"labelList-implicit",data:t}):z.isValidElement(e)||qe(e)?z.createElement(Ni,{key:"labelList-implicit",data:t,content:e}):rl(e)?z.createElement(Ni,Uh({data:t},e,{key:"labelList-implicit"})):null:null}function KX(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,i=Zr(n,Ni).map(function(s,u){return S.cloneElement(s,{data:t,key:"labelList-".concat(u)})});if(!r)return i;var o=GX(e.label,t);return[o].concat(LX(i))}Ni.renderCallByParent=KX;function Xc(e){"@babel/helpers - typeof";return Xc=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},Xc(e)}function $1(){return $1=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(s>l),`, - `).concat(p.x,",").concat(p.y,` - `);if(i>0){var g=xt(r,n,i,s),b=xt(r,n,i,l);m+="L ".concat(b.x,",").concat(b.y,` - A `).concat(i,",").concat(i,`,0, - `).concat(+(Math.abs(f)>180),",").concat(+(s<=l),`, - `).concat(g.x,",").concat(g.y," Z")}else m+="L ".concat(r,",").concat(n," Z");return m},JX=function(t){var r=t.cx,n=t.cy,i=t.innerRadius,o=t.outerRadius,s=t.cornerRadius,u=t.forceCornerRadius,f=t.cornerIsExternal,l=t.startAngle,h=t.endAngle,p=gr(h-l),m=ld({cx:r,cy:n,radius:o,angle:l,sign:p,cornerRadius:s,cornerIsExternal:f}),g=m.circleTangency,b=m.lineTangency,y=m.theta,w=ld({cx:r,cy:n,radius:o,angle:h,sign:-p,cornerRadius:s,cornerIsExternal:f}),j=w.circleTangency,O=w.lineTangency,E=w.theta,A=f?Math.abs(l-h):Math.abs(l-h)-y-E;if(A<0)return u?"M ".concat(b.x,",").concat(b.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 - `):fL({cx:r,cy:n,innerRadius:i,outerRadius:o,startAngle:l,endAngle:h});var N="M ".concat(b.x,",").concat(b.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(p<0),",").concat(g.x,",").concat(g.y,` - A`).concat(o,",").concat(o,",0,").concat(+(A>180),",").concat(+(p<0),",").concat(j.x,",").concat(j.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(p<0),",").concat(O.x,",").concat(O.y,` - `);if(i>0){var C=ld({cx:r,cy:n,radius:i,angle:l,sign:p,isExternal:!0,cornerRadius:s,cornerIsExternal:f}),T=C.circleTangency,R=C.lineTangency,I=C.theta,F=ld({cx:r,cy:n,radius:i,angle:h,sign:-p,isExternal:!0,cornerRadius:s,cornerIsExternal:f}),L=F.circleTangency,$=F.lineTangency,U=F.theta,G=f?Math.abs(l-h):Math.abs(l-h)-I-U;if(G<0&&s===0)return"".concat(N,"L").concat(r,",").concat(n,"Z");N+="L".concat($.x,",").concat($.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(p<0),",").concat(L.x,",").concat(L.y,` - A`).concat(i,",").concat(i,",0,").concat(+(G>180),",").concat(+(p>0),",").concat(T.x,",").concat(T.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(p<0),",").concat(R.x,",").concat(R.y,"Z")}else N+="L".concat(r,",").concat(n,"Z");return N},eY={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},dL=function(t){var r=$C($C({},eY),t),n=r.cx,i=r.cy,o=r.innerRadius,s=r.outerRadius,u=r.cornerRadius,f=r.forceCornerRadius,l=r.cornerIsExternal,h=r.startAngle,p=r.endAngle,m=r.className;if(s0&&Math.abs(h-p)<360?w=JX({cx:n,cy:i,innerRadius:o,outerRadius:s,cornerRadius:Math.min(y,b/2),forceCornerRadius:f,cornerIsExternal:l,startAngle:h,endAngle:p}):w=fL({cx:n,cy:i,innerRadius:o,outerRadius:s,startAngle:h,endAngle:p}),z.createElement("path",$1({},Be(r,!0),{className:g,d:w,role:"img"}))};function Yc(e){"@babel/helpers - typeof";return Yc=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},Yc(e)}function B1(){return B1=Object.assign?Object.assign.bind():function(e){for(var t=1;tdY.call(e,t));function ya(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const mY="__v",vY="__o",gY="_owner",{getOwnPropertyDescriptor:VC,keys:GC}=Object;function yY(e,t){return e.byteLength===t.byteLength&&Hh(new Uint8Array(e),new Uint8Array(t))}function xY(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 bY(e,t){return e.byteLength===t.byteLength&&Hh(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function wY(e,t){return ya(e.getTime(),t.getTime())}function SY(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function _Y(e,t){return e===t}function KC(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const i=new Array(n),o=e.entries();let s,u,f=0;for(;(s=o.next())&&!s.done;){const l=t.entries();let h=!1,p=0;for(;(u=l.next())&&!u.done;){if(i[p]){p++;continue}const m=s.value,g=u.value;if(r.equals(m[0],g[0],f,p,e,t,r)&&r.equals(m[1],g[1],m[0],g[0],e,t,r)){h=i[p]=!0;break}p++}if(!h)return!1;f++}return!0}const jY=ya;function OY(e,t,r){const n=GC(e);let i=n.length;if(GC(t).length!==i)return!1;for(;i-- >0;)if(!hL(e,t,r,n[i]))return!1;return!0}function sc(e,t,r){const n=HC(e);let i=n.length;if(HC(t).length!==i)return!1;let o,s,u;for(;i-- >0;)if(o=n[i],!hL(e,t,r,o)||(s=VC(e,o),u=VC(t,o),(s||u)&&(!s||!u||s.configurable!==u.configurable||s.enumerable!==u.enumerable||s.writable!==u.writable)))return!1;return!0}function EY(e,t){return ya(e.valueOf(),t.valueOf())}function PY(e,t){return e.source===t.source&&e.flags===t.flags}function XC(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const i=new Array(n),o=e.values();let s,u;for(;(s=o.next())&&!s.done;){const f=t.values();let l=!1,h=0;for(;(u=f.next())&&!u.done;){if(!i[h]&&r.equals(s.value,u.value,s.value,u.value,e,t,r)){l=i[h]=!0;break}h++}if(!l)return!1}return!0}function Hh(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 NY(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 hL(e,t,r,n){return(n===gY||n===vY||n===mY)&&(e.$$typeof||t.$$typeof)?!0:pY(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}const AY="[object ArrayBuffer]",CY="[object Arguments]",TY="[object Boolean]",kY="[object DataView]",RY="[object Date]",MY="[object Error]",IY="[object Map]",DY="[object Number]",LY="[object Object]",$Y="[object RegExp]",BY="[object Set]",FY="[object String]",zY={"[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},qY="[object URL]",UY=Object.prototype.toString;function WY({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:i,areFunctionsEqual:o,areMapsEqual:s,areNumbersEqual:u,areObjectsEqual:f,arePrimitiveWrappersEqual:l,areRegExpsEqual:h,areSetsEqual:p,areTypedArraysEqual:m,areUrlsEqual:g,unknownTagComparators:b}){return function(w,j,O){if(w===j)return!0;if(w==null||j==null)return!1;const E=typeof w;if(E!==typeof j)return!1;if(E!=="object")return E==="number"?u(w,j,O):E==="function"?o(w,j,O):!1;const A=w.constructor;if(A!==j.constructor)return!1;if(A===Object)return f(w,j,O);if(Array.isArray(w))return t(w,j,O);if(A===Date)return n(w,j,O);if(A===RegExp)return h(w,j,O);if(A===Map)return s(w,j,O);if(A===Set)return p(w,j,O);const N=UY.call(w);if(N===RY)return n(w,j,O);if(N===$Y)return h(w,j,O);if(N===IY)return s(w,j,O);if(N===BY)return p(w,j,O);if(N===LY)return typeof w.then!="function"&&typeof j.then!="function"&&f(w,j,O);if(N===qY)return g(w,j,O);if(N===MY)return i(w,j,O);if(N===CY)return f(w,j,O);if(zY[N])return m(w,j,O);if(N===AY)return e(w,j,O);if(N===kY)return r(w,j,O);if(N===TY||N===DY||N===FY)return l(w,j,O);if(b){let C=b[N];if(!C){const T=hY(w);T&&(C=b[T])}if(C)return C(w,j,O)}return!1}}function HY({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:yY,areArraysEqual:r?sc:xY,areDataViewsEqual:bY,areDatesEqual:wY,areErrorsEqual:SY,areFunctionsEqual:_Y,areMapsEqual:r?lb(KC,sc):KC,areNumbersEqual:jY,areObjectsEqual:r?sc:OY,arePrimitiveWrappersEqual:EY,areRegExpsEqual:PY,areSetsEqual:r?lb(XC,sc):XC,areTypedArraysEqual:r?lb(Hh,sc):Hh,areUrlsEqual:NY,unknownTagComparators:void 0};if(t&&(n=Object.assign({},n,t(n))),e){const i=ud(n.areArraysEqual),o=ud(n.areMapsEqual),s=ud(n.areObjectsEqual),u=ud(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:s,areSetsEqual:u})}return n}function VY(e){return function(t,r,n,i,o,s,u){return e(t,r,u)}}function GY({circular:e,comparator:t,createState:r,equals:n,strict:i}){if(r)return function(u,f){const{cache:l=e?new WeakMap:void 0,meta:h}=r();return t(u,f,{cache:l,equals:n,meta:h,strict:i})};if(e)return function(u,f){return t(u,f,{cache:new WeakMap,equals:n,meta:void 0,strict:i})};const o={cache:void 0,equals:n,meta:void 0,strict:i};return function(u,f){return t(u,f,o)}}const KY=xo();xo({strict:!0});xo({circular:!0});xo({circular:!0,strict:!0});xo({createInternalComparator:()=>ya});xo({strict:!0,createInternalComparator:()=>ya});xo({circular:!0,createInternalComparator:()=>ya});xo({circular:!0,createInternalComparator:()=>ya,strict:!0});function xo(e={}){const{circular:t=!1,createInternalComparator:r,createState:n,strict:i=!1}=e,o=HY(e),s=WY(o),u=r?r(s):VY(s);return GY({circular:t,comparator:s,createState:n,equals:u,strict:i})}function XY(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function YC(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function i(o){r<0&&(r=o),o-r>t?(e(o),r=-1):XY(i)};requestAnimationFrame(n)}function F1(e){"@babel/helpers - typeof";return F1=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},F1(e)}function YY(e){return eQ(e)||JY(e)||ZY(e)||QY()}function QY(){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 ZY(e,t){if(e){if(typeof e=="string")return QC(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 QC(e,t)}}function QC(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 O=j>1?1:j,E=O,A=0;A<8;++A){var N=p(E)-O,C=g(E);if(Math.abs(N-O)0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,i=t.damping,o=i===void 0?8:i,s=t.dt,u=s===void 0?17:s,f=function(h,p,m){var g=-(h-p)*n,b=m*o,y=m+(g-b)*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 TQ(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,o;for(o=0;o=0)&&(r[i]=e[i]);return r}function cb(e){return IQ(e)||MQ(e)||RQ(e)||kQ()}function kQ(){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 RQ(e,t){if(e){if(typeof e=="string")return H1(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 H1(e,t)}}function MQ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function IQ(e){if(Array.isArray(e))return H1(e)}function H1(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 Kh(e){return Kh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Kh(e)}var ri=(function(e){FQ(r,e);var t=zQ(r);function r(n,i){var o;DQ(this,r),o=t.call(this,n,i);var s=o.props,u=s.isActive,f=s.attributeName,l=s.from,h=s.to,p=s.steps,m=s.children,g=s.duration;if(o.handleStyleChange=o.handleStyleChange.bind(K1(o)),o.changeStyle=o.changeStyle.bind(K1(o)),!u||g<=0)return o.state={style:{}},typeof m=="function"&&(o.state={style:h}),G1(o);if(p&&p.length)o.state={style:p[0].style};else if(l){if(typeof m=="function")return o.state={style:l},G1(o);o.state={style:f?gc({},f,l):l}}else o.state={style:{}};return o}return $Q(r,[{key:"componentDidMount",value:function(){var i=this.props,o=i.isActive,s=i.canBegin;this.mounted=!0,!(!o||!s)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var o=this.props,s=o.isActive,u=o.canBegin,f=o.attributeName,l=o.shouldReAnimate,h=o.to,p=o.from,m=this.state.style;if(u){if(!s){var g={style:f?gc({},f,h):h};this.state&&m&&(f&&m[f]!==h||!f&&m!==h)&&this.setState(g);return}if(!(KY(i.to,h)&&i.canBegin&&i.isActive)){var b=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var y=b||l?p:i.to;if(this.state&&m){var w={style:f?gc({},f,y):y};(f&&m[f]!==y||!f&&m!==y)&&this.setState(w)}this.runAnimation(Pn(Pn({},this.props),{},{from:y,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var o=this,s=i.from,u=i.to,f=i.duration,l=i.easing,h=i.begin,p=i.onAnimationEnd,m=i.onAnimationStart,g=NQ(s,u,gQ(l),f,this.changeStyle),b=function(){o.stopJSAnimation=g()};this.manager.start([m,h,b,f,p])}},{key:"runStepAnimation",value:function(i){var o=this,s=i.steps,u=i.begin,f=i.onAnimationStart,l=s[0],h=l.style,p=l.duration,m=p===void 0?0:p,g=function(y,w,j){if(j===0)return y;var O=w.duration,E=w.easing,A=E===void 0?"ease":E,N=w.style,C=w.properties,T=w.onAnimationEnd,R=j>0?s[j-1]:w,I=C||Object.keys(N);if(typeof A=="function"||A==="spring")return[].concat(cb(y),[o.runJSAnimation.bind(o,{from:R.style,to:N,duration:O,easing:A}),O]);var F=eT(I,O,A),L=Pn(Pn(Pn({},R.style),N),{},{transition:F});return[].concat(cb(y),[L,O,T]).filter(oQ)};return this.manager.start([f].concat(cb(s.reduce(g,[h,Math.max(m,u)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=tQ());var o=i.begin,s=i.duration,u=i.attributeName,f=i.to,l=i.easing,h=i.onAnimationStart,p=i.onAnimationEnd,m=i.steps,g=i.children,b=this.manager;if(this.unSubscribe=b.subscribe(this.handleStyleChange),typeof l=="function"||typeof g=="function"||l==="spring"){this.runJSAnimation(i);return}if(m.length>1){this.runStepAnimation(i);return}var y=u?gc({},u,f):f,w=eT(Object.keys(y),s,l);b.start([h,o,Pn(Pn({},y),{},{transition:w}),s,p])}},{key:"render",value:function(){var i=this.props,o=i.children;i.begin;var s=i.duration;i.attributeName,i.easing;var u=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var f=CQ(i,AQ),l=S.Children.count(o),h=this.state.style;if(typeof o=="function")return o(h);if(!u||l===0||s<=0)return o;var p=function(g){var b=g.props,y=b.style,w=y===void 0?{}:y,j=b.className,O=S.cloneElement(g,Pn(Pn({},f),{},{style:Pn(Pn({},w),h),className:j}));return O};return l===1?p(S.Children.only(o)):z.createElement("div",null,S.Children.map(o,function(m){return p(m)}))}}]),r})(S.PureComponent);ri.displayName="Animate";ri.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};ri.propTypes={from:ft.oneOfType([ft.object,ft.string]),to:ft.oneOfType([ft.object,ft.string]),attributeName:ft.string,duration:ft.number,begin:ft.number,easing:ft.oneOfType([ft.string,ft.func]),steps:ft.arrayOf(ft.shape({duration:ft.number.isRequired,style:ft.object.isRequired,easing:ft.oneOfType([ft.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),ft.func]),properties:ft.arrayOf("string"),onAnimationEnd:ft.func})),children:ft.oneOfType([ft.node,ft.func]),isActive:ft.bool,canBegin:ft.bool,onAnimationEnd:ft.func,shouldReAnimate:ft.bool,onAnimationStart:ft.func,onAnimationReStart:ft.func};function Jc(e){"@babel/helpers - typeof";return Jc=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},Jc(e)}function Xh(){return Xh=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,f=n>=0?1:-1,l=i>=0&&n>=0||i<0&&n<0?1:0,h;if(s>0&&o instanceof Array){for(var p=[0,0,0,0],m=0,g=4;ms?s:o[m];h="M".concat(t,",").concat(r+u*p[0]),p[0]>0&&(h+="A ".concat(p[0],",").concat(p[0],",0,0,").concat(l,",").concat(t+f*p[0],",").concat(r)),h+="L ".concat(t+n-f*p[1],",").concat(r),p[1]>0&&(h+="A ".concat(p[1],",").concat(p[1],",0,0,").concat(l,`, - `).concat(t+n,",").concat(r+u*p[1])),h+="L ".concat(t+n,",").concat(r+i-u*p[2]),p[2]>0&&(h+="A ".concat(p[2],",").concat(p[2],",0,0,").concat(l,`, - `).concat(t+n-f*p[2],",").concat(r+i)),h+="L ".concat(t+f*p[3],",").concat(r+i),p[3]>0&&(h+="A ".concat(p[3],",").concat(p[3],",0,0,").concat(l,`, - `).concat(t,",").concat(r+i-u*p[3])),h+="Z"}else if(s>0&&o===+o&&o>0){var b=Math.min(s,o);h="M ".concat(t,",").concat(r+u*b,` - A `).concat(b,",").concat(b,",0,0,").concat(l,",").concat(t+f*b,",").concat(r,` - L `).concat(t+n-f*b,",").concat(r,` - A `).concat(b,",").concat(b,",0,0,").concat(l,",").concat(t+n,",").concat(r+u*b,` - L `).concat(t+n,",").concat(r+i-u*b,` - A `).concat(b,",").concat(b,",0,0,").concat(l,",").concat(t+n-f*b,",").concat(r+i,` - L `).concat(t+f*b,",").concat(r+i,` - A `).concat(b,",").concat(b,",0,0,").concat(l,",").concat(t,",").concat(r+i-u*b," Z")}else h="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(i," h ").concat(-n," Z");return h},QQ=function(t,r){if(!t||!r)return!1;var n=t.x,i=t.y,o=r.x,s=r.y,u=r.width,f=r.height;if(Math.abs(u)>0&&Math.abs(f)>0){var l=Math.min(o,o+u),h=Math.max(o,o+u),p=Math.min(s,s+f),m=Math.max(s,s+f);return n>=l&&n<=h&&i>=p&&i<=m}return!1},ZQ={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},KS=function(t){var r=lT(lT({},ZQ),t),n=S.useRef(),i=S.useState(-1),o=UQ(i,2),s=o[0],u=o[1];S.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var A=n.current.getTotalLength();A&&u(A)}catch{}},[]);var f=r.x,l=r.y,h=r.width,p=r.height,m=r.radius,g=r.className,b=r.animationEasing,y=r.animationDuration,w=r.animationBegin,j=r.isAnimationActive,O=r.isUpdateAnimationActive;if(f!==+f||l!==+l||h!==+h||p!==+p||h===0||p===0)return null;var E=He("recharts-rectangle",g);return O?z.createElement(ri,{canBegin:s>0,from:{width:h,height:p,x:f,y:l},to:{width:h,height:p,x:f,y:l},duration:y,animationEasing:b,isActive:O},function(A){var N=A.width,C=A.height,T=A.x,R=A.y;return z.createElement(ri,{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:b},z.createElement("path",Xh({},Be(r,!0),{className:E,d:cT(T,R,N,C,m),ref:n})))}):z.createElement("path",Xh({},Be(r,!0),{className:E,d:cT(f,l,h,p,m)}))},JQ=["points","className","baseLinePoints","connectNulls"];function as(){return as=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 tZ(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 uT(e){return oZ(e)||iZ(e)||nZ(e)||rZ()}function rZ(){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 nZ(e,t){if(e){if(typeof e=="string")return X1(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 X1(e,t)}}function iZ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function oZ(e){if(Array.isArray(e))return X1(e)}function X1(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){fT(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),fT(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},jc=function(t,r){var n=aZ(t);r&&(n=[n.reduce(function(o,s){return[].concat(uT(o),uT(s))},[])]);var i=n.map(function(o){return o.reduce(function(s,u,f){return"".concat(s).concat(f===0?"M":"L").concat(u.x,",").concat(u.y)},"")}).join("");return n.length===1?"".concat(i,"Z"):i},sZ=function(t,r,n){var i=jc(t,n);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(jc(r.reverse(),n).slice(1))},lZ=function(t){var r=t.points,n=t.className,i=t.baseLinePoints,o=t.connectNulls,s=eZ(t,JQ);if(!r||!r.length)return null;var u=He("recharts-polygon",n);if(i&&i.length){var f=s.stroke&&s.stroke!=="none",l=sZ(r,i,o);return z.createElement("g",{className:u},z.createElement("path",as({},Be(s,!0),{fill:l.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:l})),f?z.createElement("path",as({},Be(s,!0),{fill:"none",d:jc(r,o)})):null,f?z.createElement("path",as({},Be(s,!0),{fill:"none",d:jc(i,o)})):null)}var h=jc(r,o);return z.createElement("path",as({},Be(s,!0),{fill:h.slice(-1)==="Z"?s.fill:"none",className:u,d:h}))};function Y1(){return Y1=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 mZ(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 vZ=function(t,r,n,i,o,s){return"M".concat(t,",").concat(o,"v").concat(i,"M").concat(s,",").concat(r,"h").concat(n)},gZ=function(t){var r=t.x,n=r===void 0?0:r,i=t.y,o=i===void 0?0:i,s=t.top,u=s===void 0?0:s,f=t.left,l=f===void 0?0:f,h=t.width,p=h===void 0?0:h,m=t.height,g=m===void 0?0:m,b=t.className,y=pZ(t,cZ),w=uZ({x:n,y:o,top:u,left:l,width:p,height:g},y);return!be(n)||!be(o)||!be(p)||!be(g)||!be(u)||!be(l)?null:z.createElement("path",Q1({},Be(w,!0),{className:He("recharts-cross",b),d:vZ(n,o,p,g,u,l)}))},ub,hT;function yZ(){if(hT)return ub;hT=1;var e=Kp(),t=MD(),r=ai();function n(i,o){return i&&i.length?e(i,r(o,2),t):void 0}return ub=n,ub}var xZ=yZ();const bZ=ct(xZ);var fb,pT;function wZ(){if(pT)return fb;pT=1;var e=Kp(),t=ai(),r=ID();function n(i,o){return i&&i.length?e(i,t(o,2),r):void 0}return fb=n,fb}var SZ=wZ();const _Z=ct(SZ);var jZ=["cx","cy","angle","ticks","axisLine"],OZ=["ticks","tick","angle","tickFormatter","stroke"];function Ms(e){"@babel/helpers - typeof";return Ms=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},Ms(e)}function Oc(){return Oc=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 EZ(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 PZ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gT(e,t){for(var r=0;rbT?s=i==="outer"?"start":"end":o<-bT?s=i==="outer"?"end":"start":s="middle",s}},{key:"renderAxisLine",value:function(){var n=this.props,i=n.cx,o=n.cy,s=n.radius,u=n.axisLine,f=n.axisLineType,l=zo(zo({},Be(this.props,!1)),{},{fill:"none"},Be(u,!1));if(f==="circle")return z.createElement(Jp,Vo({className:"recharts-polar-angle-axis-line"},l,{cx:i,cy:o,r:s}));var h=this.props.ticks,p=h.map(function(m){return xt(i,o,s,m.coordinate)});return z.createElement(lZ,Vo({className:"recharts-polar-angle-axis-line"},l,{points:p}))}},{key:"renderTicks",value:function(){var n=this,i=this.props,o=i.ticks,s=i.tick,u=i.tickLine,f=i.tickFormatter,l=i.stroke,h=Be(this.props,!1),p=Be(s,!1),m=zo(zo({},h),{},{fill:"none"},Be(u,!1)),g=o.map(function(b,y){var w=n.getTickLineCoord(b),j=n.getTickTextAnchor(b),O=zo(zo(zo({textAnchor:j},h),{},{stroke:"none",fill:l},p),{},{index:y,payload:b,x:w.x2,y:w.y2});return z.createElement(at,Vo({className:He("recharts-polar-angle-axis-tick",cL(s)),key:"tick-".concat(b.coordinate)},ta(n.props,b,y)),u&&z.createElement("line",Vo({className:"recharts-polar-angle-axis-tick-line"},m,w)),s&&t.renderTickItem(s,O,f?f(b.value,y):b.value))});return z.createElement(at,{className:"recharts-polar-angle-axis-ticks"},g)}},{key:"render",value:function(){var n=this.props,i=n.ticks,o=n.radius,s=n.axisLine;return o<=0||!i||!i.length?null:z.createElement(at,{className:He("recharts-polar-angle-axis",this.props.className)},s&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,i,o){var s;return z.isValidElement(n)?s=z.cloneElement(n,i):qe(n)?s=n(i):s=z.createElement(ra,Vo({},i,{className:"recharts-polar-angle-axis-tick-value"}),o),s}}])})(S.PureComponent);rm(nm,"displayName","PolarAngleAxis");rm(nm,"axisType","angleAxis");rm(nm,"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 db,wT;function qZ(){if(wT)return db;wT=1;var e=MI(),t=e(Object.getPrototypeOf,Object);return db=t,db}var hb,ST;function UZ(){if(ST)return hb;ST=1;var e=Ii(),t=qZ(),r=Di(),n="[object Object]",i=Function.prototype,o=Object.prototype,s=i.toString,u=o.hasOwnProperty,f=s.call(Object);function l(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)==f}return hb=l,hb}var WZ=UZ();const HZ=ct(WZ);var pb,_T;function VZ(){if(_T)return pb;_T=1;var e=Ii(),t=Di(),r="[object Boolean]";function n(i){return i===!0||i===!1||t(i)&&e(i)==r}return pb=n,pb}var GZ=VZ();const KZ=ct(GZ);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)}function Zh(){return Zh=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:f,y:l},to:{upperWidth:h,lowerWidth:p,height:m,x:f,y:l},duration:y,animationEasing:b,isActive:j},function(E){var A=E.upperWidth,N=E.lowerWidth,C=E.height,T=E.x,R=E.y;return z.createElement(ri,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:w,duration:y,easing:b},z.createElement("path",Zh({},Be(r,!0),{className:O,d:PT(T,R,A,N,C),ref:n})))}):z.createElement("g",null,z.createElement("path",Zh({},Be(r,!0),{className:O,d:PT(f,l,h,p,m)})))},oJ=["option","shapeType","propTransformer","activeClassName","isActive"];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)}function aJ(e,t){if(e==null)return{};var r=sJ(e,t),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function sJ(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 NT(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Jh(e){for(var t=1;t0?Qr(E,"paddingAngle",0):0;if(N){var T=Kr(N.endAngle-N.startAngle,E.endAngle-E.startAngle),R=gt(gt({},E),{},{startAngle:O+C,endAngle:O+T(y)+C});w.push(R),O=R.endAngle}else{var I=E.endAngle,F=E.startAngle,L=Kr(0,I-F),$=L(y),U=gt(gt({},E),{},{startAngle:O+C,endAngle:O+$+C});w.push(U),O=U.endAngle}}),z.createElement(at,null,n.renderSectorsStatically(w))})}},{key:"attachKeyboardHandlers",value:function(n){var i=this;n.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var s=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[s].focus(),i.setState({sectorToFocus:s});break}case"ArrowRight":{var u=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[u].focus(),i.setState({sectorToFocus:u});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,i=n.sectors,o=n.isAnimationActive,s=this.state.prevSectors;return o&&i&&i.length&&(!s||!Su(s,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,i=this.props,o=i.hide,s=i.sectors,u=i.className,f=i.label,l=i.cx,h=i.cy,p=i.innerRadius,m=i.outerRadius,g=i.isAnimationActive,b=this.state.isAnimationFinished;if(o||!s||!s.length||!be(l)||!be(h)||!be(p)||!be(m))return null;var y=He("recharts-pie",u);return z.createElement(at,{tabIndex:this.props.rootTabIndex,className:y,ref:function(j){n.pieRef=j}},this.renderSectors(),f&&this.renderLabels(s),Qt.renderCallByParent(this.props,null,!1),(!g||b)&&Ni.renderCallByParent(this.props,s,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return i.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:n.sectors!==i.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,i){return n>i?"start":n=360?O:O-1)*f,A=w-O*g-E,N=i.reduce(function(R,I){var F=Wt(I,j,0);return R+(be(F)?F:0)},0),C;if(N>0){var T;C=i.map(function(R,I){var F=Wt(R,j,0),L=Wt(R,h,I),$=(be(F)?F:0)/N,U;I?U=T.endAngle+gr(y)*f*(F!==0?1:0):U=s;var G=U+gr(y)*((F!==0?g:0)+$*A),q=(U+G)/2,H=(b.innerRadius+b.outerRadius)/2,V=[{name:L,value:F,payload:R,dataKey:j,type:m}],D=xt(b.cx,b.cy,H,q);return T=gt(gt(gt({percent:$,cornerRadius:o,name:L,tooltipPayload:V,midAngle:q,middleRadius:H,tooltipPosition:D},R),b),{},{value:Wt(R,j),startAngle:U,endAngle:G,payload:R,paddingAngle:gr(y)*f}),T})}return gt(gt({},b),{},{sectors:C,data:i})});var mb,kT;function NJ(){if(kT)return mb;kT=1;var e=Math.ceil,t=Math.max;function r(n,i,o,s){for(var u=-1,f=t(e((i-n)/(o||1)),0),l=Array(f);f--;)l[s?f:++u]=n,n+=o;return l}return mb=r,mb}var vb,RT;function PL(){if(RT)return vb;RT=1;var e=YI(),t=1/0,r=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var o=i<0?-1:1;return o*r}return i===i?i:0}return vb=n,vb}var gb,MT;function AJ(){if(MT)return gb;MT=1;var e=NJ(),t=Fp(),r=PL();function n(i){return function(o,s,u){return u&&typeof u!="number"&&t(o,s,u)&&(s=u=void 0),o=r(o),s===void 0?(s=o,o=0):s=r(s),u=u===void 0?o0&&n.handleDrag(i.changedTouches[0])}),Wr(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=n.props,o=i.endIndex,s=i.onDragEnd,u=i.startIndex;s?.({endIndex:o,startIndex:u})}),n.detachDragEndListener()}),Wr(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),Wr(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),Wr(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),Wr(n,"handleSlideDragStart",function(i){var o=FT(i)?i.changedTouches[0]:i;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return zJ(t,e),LJ(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var i=n.startX,o=n.endX,s=this.state.scaleValues,u=this.props,f=u.gap,l=u.data,h=l.length-1,p=Math.min(i,o),m=Math.max(i,o),g=t.getIndexInRange(s,p),b=t.getIndexInRange(s,m);return{startIndex:g-g%f,endIndex:b===h?h:b-b%f}}},{key:"getTextOfTick",value:function(n){var i=this.props,o=i.data,s=i.tickFormatter,u=i.dataKey,f=Wt(o[n],u,n);return qe(s)?s(f,n):f}},{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 i=this.state,o=i.slideMoveStartX,s=i.startX,u=i.endX,f=this.props,l=f.x,h=f.width,p=f.travellerWidth,m=f.startIndex,g=f.endIndex,b=f.onChange,y=n.pageX-o;y>0?y=Math.min(y,l+h-p-u,l+h-p-s):y<0&&(y=Math.max(y,l-s,l-u));var w=this.getIndex({startX:s+y,endX:u+y});(w.startIndex!==m||w.endIndex!==g)&&b&&b(w),this.setState({startX:s+y,endX:u+y,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,i){var o=FT(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var i=this.state,o=i.brushMoveStartX,s=i.movingTravellerId,u=i.endX,f=i.startX,l=this.state[s],h=this.props,p=h.x,m=h.width,g=h.travellerWidth,b=h.onChange,y=h.gap,w=h.data,j={startX:this.state.startX,endX:this.state.endX},O=n.pageX-o;O>0?O=Math.min(O,p+m-g-l):O<0&&(O=Math.max(O,p-l)),j[s]=l+O;var E=this.getIndex(j),A=E.startIndex,N=E.endIndex,C=function(){var R=w.length-1;return s==="startX"&&(u>f?A%y===0:N%y===0)||uf?N%y===0:A%y===0)||u>f&&N===R};this.setState(Wr(Wr({},s,l+O),"brushMoveStartX",n.pageX),function(){b&&C()&&b(E)})}},{key:"handleTravellerMoveKeyboard",value:function(n,i){var o=this,s=this.state,u=s.scaleValues,f=s.startX,l=s.endX,h=this.state[i],p=u.indexOf(h);if(p!==-1){var m=p+n;if(!(m===-1||m>=u.length)){var g=u[m];i==="startX"&&g>=l||i==="endX"&&g<=f||this.setState(Wr({},i,g),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,i=n.x,o=n.y,s=n.width,u=n.height,f=n.fill,l=n.stroke;return z.createElement("rect",{stroke:l,fill:f,x:i,y:o,width:s,height:u})}},{key:"renderPanorama",value:function(){var n=this.props,i=n.x,o=n.y,s=n.width,u=n.height,f=n.data,l=n.children,h=n.padding,p=S.Children.only(l);return p?z.cloneElement(p,{x:i,y:o,width:s,height:u,margin:h,compact:!0,data:f}):null}},{key:"renderTravellerLayer",value:function(n,i){var o,s,u=this,f=this.props,l=f.y,h=f.travellerWidth,p=f.height,m=f.traveller,g=f.ariaLabel,b=f.data,y=f.startIndex,w=f.endIndex,j=Math.max(n,this.props.x),O=xb(xb({},Be(this.props,!1)),{},{x:j,y:l,width:h,height:p}),E=g||"Min value: ".concat((o=b[y])===null||o===void 0?void 0:o.name,", Max value: ").concat((s=b[w])===null||s===void 0?void 0:s.name);return z.createElement(at,{tabIndex:0,role:"slider","aria-label":E,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(N){["ArrowLeft","ArrowRight"].includes(N.key)&&(N.preventDefault(),N.stopPropagation(),u.handleTravellerMoveKeyboard(N.key==="ArrowRight"?1:-1,i))},onFocus:function(){u.setState({isTravellerFocused:!0})},onBlur:function(){u.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(m,O))}},{key:"renderSlide",value:function(n,i){var o=this.props,s=o.y,u=o.height,f=o.stroke,l=o.travellerWidth,h=Math.min(n,i)+l,p=Math.max(Math.abs(i-n)-l,0);return z.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:f,fillOpacity:.2,x:h,y:s,width:p,height:u})}},{key:"renderText",value:function(){var n=this.props,i=n.startIndex,o=n.endIndex,s=n.y,u=n.height,f=n.travellerWidth,l=n.stroke,h=this.state,p=h.startX,m=h.endX,g=5,b={pointerEvents:"none",fill:l};return z.createElement(at,{className:"recharts-brush-texts"},z.createElement(ra,rp({textAnchor:"end",verticalAnchor:"middle",x:Math.min(p,m)-g,y:s+u/2},b),this.getTextOfTick(i)),z.createElement(ra,rp({textAnchor:"start",verticalAnchor:"middle",x:Math.max(p,m)+f+g,y:s+u/2},b),this.getTextOfTick(o)))}},{key:"render",value:function(){var n=this.props,i=n.data,o=n.className,s=n.children,u=n.x,f=n.y,l=n.width,h=n.height,p=n.alwaysShowText,m=this.state,g=m.startX,b=m.endX,y=m.isTextActive,w=m.isSlideMoving,j=m.isTravellerMoving,O=m.isTravellerFocused;if(!i||!i.length||!be(u)||!be(f)||!be(l)||!be(h)||l<=0||h<=0)return null;var E=He("recharts-brush",o),A=z.Children.count(s)===1,N=IJ("userSelect","none");return z.createElement(at,{className:E,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:N},this.renderBackground(),A&&this.renderPanorama(),this.renderSlide(g,b),this.renderTravellerLayer(g,"startX"),this.renderTravellerLayer(b,"endX"),(y||w||j||O||p)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var i=n.x,o=n.y,s=n.width,u=n.height,f=n.stroke,l=Math.floor(o+u/2)-1;return z.createElement(z.Fragment,null,z.createElement("rect",{x:i,y:o,width:s,height:u,fill:f,stroke:"none"}),z.createElement("line",{x1:i+1,y1:l,x2:i+s-1,y2:l,fill:"none",stroke:"#fff"}),z.createElement("line",{x1:i+1,y1:l+2,x2:i+s-1,y2:l+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,i){var o;return z.isValidElement(n)?o=z.cloneElement(n,i):qe(n)?o=n(i):o=t.renderDefaultTraveller(i),o}},{key:"getDerivedStateFromProps",value:function(n,i){var o=n.data,s=n.width,u=n.x,f=n.travellerWidth,l=n.updateId,h=n.startIndex,p=n.endIndex;if(o!==i.prevData||l!==i.prevUpdateId)return xb({prevData:o,prevTravellerWidth:f,prevUpdateId:l,prevX:u,prevWidth:s},o&&o.length?UJ({data:o,width:s,x:u,travellerWidth:f,startIndex:h,endIndex:p}):{scale:null,scaleValues:null});if(i.scale&&(s!==i.prevWidth||u!==i.prevX||f!==i.prevTravellerWidth)){i.scale.range([u,u+s-f]);var m=i.scale.domain().map(function(g){return i.scale(g)});return{prevData:o,prevTravellerWidth:f,prevUpdateId:l,prevX:u,prevWidth:s,startX:i.scale(n.startIndex),endX:i.scale(n.endIndex),scaleValues:m}}return null}},{key:"getIndexInRange",value:function(n,i){for(var o=n.length,s=0,u=o-1;u-s>1;){var f=Math.floor((s+u)/2);n[f]>i?u=f:s=f}return i>=n[u]?u:s}}])})(S.PureComponent);Wr($s,"displayName","Brush");Wr($s,"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 bb,zT;function WJ(){if(zT)return bb;zT=1;var e=bS();function t(r,n){var i;return e(r,function(o,s,u){return i=n(o,s,u),!i}),!!i}return bb=t,bb}var wb,qT;function HJ(){if(qT)return wb;qT=1;var e=PI(),t=ai(),r=WJ(),n=Ir(),i=Fp();function o(s,u,f){var l=n(s)?e:r;return f&&i(s,u,f)&&(u=void 0),l(s,t(u,3))}return wb=o,wb}var VJ=HJ();const GJ=ct(VJ);var Zn=function(t,r){var n=t.alwaysShow,i=t.ifOverflow;return n&&(i="extendDomain"),i===r},Sb,UT;function KJ(){if(UT)return Sb;UT=1;var e=HI();function t(r,n,i){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return Sb=t,Sb}var _b,WT;function XJ(){if(WT)return _b;WT=1;var e=KJ(),t=UI(),r=ai();function n(i,o){var s={};return o=r(o,3),t(i,function(u,f,l){e(s,f,o(u,f,l))}),s}return _b=n,_b}var YJ=XJ();const QJ=ct(YJ);var jb,HT;function ZJ(){if(HT)return jb;HT=1;function e(t,r){for(var n=-1,i=t==null?0:t.length;++n=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}function lee(e,t){var r=e.x,n=e.y,i=aee(e,ree),o="".concat(r),s=parseInt(o,10),u="".concat(n),f=parseInt(u,10),l="".concat(t.height||i.height),h=parseInt(l,10),p="".concat(t.width||i.width),m=parseInt(p,10);return lc(lc(lc(lc(lc({},t),i),s?{x:s}:{}),f?{y:f}:{}),{},{height:h,width:m,name:t.name,radius:t.radius})}function XT(e){return z.createElement(jL,rw({shapeType:"rectangle",propTransformer:lee,activeClassName:"recharts-active-bar"},e))}var cee=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,i){if(typeof t=="number")return t;var o=be(n)||Aq(n);return o?t(n,i):(o||ia(),r)}},uee=["value","background"],kL;function Bs(e){"@babel/helpers - typeof";return Bs=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},Bs(e)}function fee(e,t){if(e==null)return{};var r=dee(e,t),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function dee(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 ip(){return ip=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(q)0&&Math.abs(G)0&&(U=Math.min((ae||0)-(G[ie-1]||0),U))}),Number.isFinite(U)){var q=U/$,H=y.layout==="vertical"?n.height:n.width;if(y.padding==="gap"&&(T=q*H/2),y.padding==="no-gap"){var V=yr(t.barCategoryGap,q*H),D=q*H/2;T=D-V-(D-V)/H*V}}}i==="xAxis"?R=[n.left+(E.left||0)+(T||0),n.left+n.width-(E.right||0)-(T||0)]:i==="yAxis"?R=f==="horizontal"?[n.top+n.height-(E.bottom||0),n.top+(E.top||0)]:[n.top+(E.top||0)+(T||0),n.top+n.height-(E.bottom||0)-(T||0)]:R=y.range,N&&(R=[R[1],R[0]]);var Z=rL(y,o,m),J=Z.scale,M=Z.realScaleType;J.domain(j).range(R),nL(J);var B=iL(J,Rn(Rn({},y),{},{realScaleType:M}));i==="xAxis"?(L=w==="top"&&!A||w==="bottom"&&A,I=n.left,F=p[C]-L*y.height):i==="yAxis"&&(L=w==="left"&&!A||w==="right"&&A,I=p[C]-L*y.width,F=n.top);var ee=Rn(Rn(Rn({},y),B),{},{realScaleType:M,x:I,y:F,scale:J,width:i==="xAxis"?n.width:y.width,height:i==="yAxis"?n.height:y.height});return ee.bandSize=zh(ee,B),!y.hide&&i==="xAxis"?p[C]+=(L?-1:1)*ee.height:y.hide||(p[C]+=(L?-1:1)*ee.width),Rn(Rn({},g),{},am({},b,ee))},{})},LL=function(t,r){var n=t.x,i=t.y,o=r.x,s=r.y;return{x:Math.min(n,o),y:Math.min(i,s),width:Math.abs(o-n),height:Math.abs(s-i)}},_ee=function(t){var r=t.x1,n=t.y1,i=t.x2,o=t.y2;return LL({x:r,y:n},{x:i,y:o})},$L=(function(){function e(t){bee(this,e),this.scale=t}return wee(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]:{},i=n.bandAware,o=n.position;if(r!==void 0){if(o)switch(o){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(i){var f=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+f}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),i=n[0],o=n[n.length-1];return i<=o?r>=i&&r<=o:r>=o&&r<=i}}],[{key:"create",value:function(r){return new e(r)}}])})();am($L,"EPS",1e-4);var XS=function(t){var r=Object.keys(t).reduce(function(n,i){return Rn(Rn({},n),{},am({},i,$L.create(t[i])))},{});return Rn(Rn({},r),{},{apply:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=o.bandAware,u=o.position;return QJ(i,function(f,l){return r[l].apply(f,{bandAware:s,position:u})})},isInRange:function(i){return TL(i,function(o,s){return r[s].isInRange(o)})}})};function jee(e){return(e%180+180)%180}var Oee=function(t){var r=t.width,n=t.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=jee(i),s=o*Math.PI/180,u=Math.atan(n/r),f=s>u&&s-1?f[l?o[h]:h]:void 0}}return Pb=n,Pb}var Nb,tk;function Pee(){if(tk)return Nb;tk=1;var e=PL();function t(r){var n=e(r),i=n%1;return n===n?i?n-i:n:0}return Nb=t,Nb}var Ab,rk;function Nee(){if(rk)return Ab;rk=1;var e=$I(),t=ai(),r=Pee(),n=Math.max;function i(o,s,u){var f=o==null?0:o.length;if(!f)return-1;var l=u==null?0:r(u);return l<0&&(l=n(f+l,0)),e(o,t(s,3),l)}return Ab=i,Ab}var Cb,nk;function Aee(){if(nk)return Cb;nk=1;var e=Eee(),t=Nee(),r=e(t);return Cb=r,Cb}var Cee=Aee();const Tee=ct(Cee);var kee=eI();const Ree=ct(kee);var Mee=Ree(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("")}),YS=S.createContext(void 0),QS=S.createContext(void 0),BL=S.createContext(void 0),FL=S.createContext({}),zL=S.createContext(void 0),qL=S.createContext(0),UL=S.createContext(0),ik=function(t){var r=t.state,n=r.xAxisMap,i=r.yAxisMap,o=r.offset,s=t.clipPathId,u=t.children,f=t.width,l=t.height,h=Mee(o);return z.createElement(YS.Provider,{value:n},z.createElement(QS.Provider,{value:i},z.createElement(FL.Provider,{value:o},z.createElement(BL.Provider,{value:h},z.createElement(zL.Provider,{value:s},z.createElement(qL.Provider,{value:l},z.createElement(UL.Provider,{value:f},u)))))))},Iee=function(){return S.useContext(zL)},WL=function(t){var r=S.useContext(YS);r==null&&ia();var n=r[t];return n==null&&ia(),n},Dee=function(){var t=S.useContext(YS);return lo(t)},Lee=function(){var t=S.useContext(QS),r=Tee(t,function(n){return TL(n.domain,Number.isFinite)});return r||lo(t)},HL=function(t){var r=S.useContext(QS);r==null&&ia();var n=r[t];return n==null&&ia(),n},$ee=function(){var t=S.useContext(BL);return t},Bee=function(){return S.useContext(FL)},ZS=function(){return S.useContext(UL)},JS=function(){return S.useContext(qL)};function Fs(e){"@babel/helpers - typeof";return Fs=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},Fs(e)}function Fee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zee(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);re*i)return!1;var o=r();return e*(t-e*o/2-n)>=0&&e*(t+e*o/2-i)<=0}function Ste(e,t){return ZL(e,t+1)}function _te(e,t,r,n,i){for(var o=(n||[]).slice(),s=t.start,u=t.end,f=0,l=1,h=s,p=function(){var b=n?.[f];if(b===void 0)return{v:ZL(n,l)};var y=f,w,j=function(){return w===void 0&&(w=r(b,y)),w},O=b.coordinate,E=f===0||cp(e,O,j,h,u);E||(f=0,h=s,l+=1),E&&(h=O+e*(j()/2+i),f+=l)},m;l<=o.length;)if(m=p(),m)return m.v;return[]}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 dk(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function cr(e){for(var t=1;t0?g.coordinate-w*e:g.coordinate})}else o[m]=g=cr(cr({},g),{},{tickCoord:g.coordinate});var j=cp(e,g.tickCoord,y,u,f);j&&(f=g.tickCoord-e*(y()/2+i),o[m]=cr(cr({},g),{},{isShow:!0}))},h=s-1;h>=0;h--)l(h);return o}function Nte(e,t,r,n,i,o){var s=(n||[]).slice(),u=s.length,f=t.start,l=t.end;if(o){var h=n[u-1],p=r(h,u-1),m=e*(h.coordinate+e*p/2-l);s[u-1]=h=cr(cr({},h),{},{tickCoord:m>0?h.coordinate-m*e:h.coordinate});var g=cp(e,h.tickCoord,function(){return p},f,l);g&&(l=h.tickCoord-e*(p/2+i),s[u-1]=cr(cr({},h),{},{isShow:!0}))}for(var b=o?u-1:u,y=function(O){var E=s[O],A,N=function(){return A===void 0&&(A=r(E,O)),A};if(O===0){var C=e*(E.coordinate-e*N()/2-f);s[O]=E=cr(cr({},E),{},{tickCoord:C<0?E.coordinate-C*e:E.coordinate})}else s[O]=E=cr(cr({},E),{},{tickCoord:E.coordinate});var T=cp(e,E.tickCoord,N,f,l);T&&(f=E.tickCoord+e*(N()/2+i),s[O]=cr(cr({},E),{},{isShow:!0}))},w=0;w=2?gr(i[1].coordinate-i[0].coordinate):1,j=wte(o,w,g);return f==="equidistantPreserveStart"?_te(w,j,y,i,s):(f==="preserveStart"||f==="preserveStartEnd"?m=Nte(w,j,y,i,s,f==="preserveStartEnd"):m=Pte(w,j,y,i,s),m.filter(function(O){return O.isShow}))}var Ate=["viewBox"],Cte=["viewBox"],Tte=["ticks"];function Us(e){"@babel/helpers - typeof";return Us=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},Us(e)}function ls(){return ls=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 kte(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 Rte(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pk(e,t){for(var r=0;r0?f(this.props):f(g)),s<=0||u<=0||!b||!b.length?null:z.createElement(at,{className:He("recharts-cartesian-axis",l),ref:function(w){n.layerReference=w}},o&&this.renderAxisLine(),this.renderTicks(b,this.state.fontSize,this.state.letterSpacing),Qt.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,i,o){var s,u=He(i.className,"recharts-cartesian-axis-tick-value");return z.isValidElement(n)?s=z.cloneElement(n,qt(qt({},i),{},{className:u})):qe(n)?s=n(qt(qt({},i),{},{className:u})):s=z.createElement(ra,ls({},i,{className:"recharts-cartesian-axis-tick-value"}),o),s}}])})(S.Component);n_(ll,"displayName","CartesianAxis");n_(ll,"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 Fte=["x1","y1","x2","y2","key"],zte=["offset"];function oa(e){"@babel/helpers - typeof";return oa=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},oa(e)}function mk(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ur(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Hte(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 Vte=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,i=t.x,o=t.y,s=t.width,u=t.height,f=t.ry;return z.createElement("rect",{x:i,y:o,ry:f,width:s,height:u,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function t$(e,t){var r;if(z.isValidElement(e))r=z.cloneElement(e,t);else if(qe(e))r=e(t);else{var n=t.x1,i=t.y1,o=t.x2,s=t.y2,u=t.key,f=vk(t,Fte),l=Be(f,!1);l.offset;var h=vk(l,zte);r=z.createElement("line",Yo({},h,{x1:n,y1:i,x2:o,y2:s,fill:"none",key:u}))}return r}function Gte(e){var t=e.x,r=e.width,n=e.horizontal,i=n===void 0?!0:n,o=e.horizontalPoints;if(!i||!o||!o.length)return null;var s=o.map(function(u,f){var l=ur(ur({},e),{},{x1:t,y1:u,x2:t+r,y2:u,key:"line-".concat(f),index:f});return t$(i,l)});return z.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function Kte(e){var t=e.y,r=e.height,n=e.vertical,i=n===void 0?!0:n,o=e.verticalPoints;if(!i||!o||!o.length)return null;var s=o.map(function(u,f){var l=ur(ur({},e),{},{x1:u,y1:t,x2:u,y2:t+r,key:"line-".concat(f),index:f});return t$(i,l)});return z.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function Xte(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,i=e.y,o=e.width,s=e.height,u=e.horizontalPoints,f=e.horizontal,l=f===void 0?!0:f;if(!l||!t||!t.length)return null;var h=u.map(function(m){return Math.round(m+i-i)}).sort(function(m,g){return m-g});i!==h[0]&&h.unshift(0);var p=h.map(function(m,g){var b=!h[g+1],y=b?i+s-m:h[g+1]-m;if(y<=0)return null;var w=g%t.length;return z.createElement("rect",{key:"react-".concat(g),y:m,x:n,height:y,width:o,stroke:"none",fill:t[w],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return z.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},p)}function Yte(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,i=e.fillOpacity,o=e.x,s=e.y,u=e.width,f=e.height,l=e.verticalPoints;if(!r||!n||!n.length)return null;var h=l.map(function(m){return Math.round(m+o-o)}).sort(function(m,g){return m-g});o!==h[0]&&h.unshift(0);var p=h.map(function(m,g){var b=!h[g+1],y=b?o+u-m:h[g+1]-m;if(y<=0)return null;var w=g%n.length;return z.createElement("rect",{key:"react-".concat(g),x:m,y:s,width:y,height:f,stroke:"none",fill:n[w],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return z.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},p)}var Qte=function(t,r){var n=t.xAxis,i=t.width,o=t.height,s=t.offset;return tL(r_(ur(ur(ur({},ll.defaultProps),n),{},{ticks:Oi(n,!0),viewBox:{x:0,y:0,width:i,height:o}})),s.left,s.left+s.width,r)},Zte=function(t,r){var n=t.yAxis,i=t.width,o=t.height,s=t.offset;return tL(r_(ur(ur(ur({},ll.defaultProps),n),{},{ticks:Oi(n,!0),viewBox:{x:0,y:0,width:i,height:o}})),s.top,s.top+s.height,r)},Xa={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function fp(e){var t,r,n,i,o,s,u=ZS(),f=JS(),l=Bee(),h=ur(ur({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:Xa.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:Xa.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:Xa.horizontal,horizontalFill:(i=e.horizontalFill)!==null&&i!==void 0?i:Xa.horizontalFill,vertical:(o=e.vertical)!==null&&o!==void 0?o:Xa.vertical,verticalFill:(s=e.verticalFill)!==null&&s!==void 0?s:Xa.verticalFill,x:be(e.x)?e.x:l.left,y:be(e.y)?e.y:l.top,width:be(e.width)?e.width:l.width,height:be(e.height)?e.height:l.height}),p=h.x,m=h.y,g=h.width,b=h.height,y=h.syncWithTicks,w=h.horizontalValues,j=h.verticalValues,O=Dee(),E=Lee();if(!be(g)||g<=0||!be(b)||b<=0||!be(p)||p!==+p||!be(m)||m!==+m)return null;var A=h.verticalCoordinatesGenerator||Qte,N=h.horizontalCoordinatesGenerator||Zte,C=h.horizontalPoints,T=h.verticalPoints;if((!C||!C.length)&&qe(N)){var R=w&&w.length,I=N({yAxis:E?ur(ur({},E),{},{ticks:R?w:E.ticks}):void 0,width:u,height:f,offset:l},R?!0:y);Dn(Array.isArray(I),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(oa(I),"]")),Array.isArray(I)&&(C=I)}if((!T||!T.length)&&qe(A)){var F=j&&j.length,L=A({xAxis:O?ur(ur({},O),{},{ticks:F?j:O.ticks}):void 0,width:u,height:f,offset:l},F?!0:y);Dn(Array.isArray(L),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(oa(L),"]")),Array.isArray(L)&&(T=L)}return z.createElement("g",{className:"recharts-cartesian-grid"},z.createElement(Vte,{fill:h.fill,fillOpacity:h.fillOpacity,x:h.x,y:h.y,width:h.width,height:h.height,ry:h.ry}),z.createElement(Gte,Yo({},h,{offset:l,horizontalPoints:C,xAxis:O,yAxis:E})),z.createElement(Kte,Yo({},h,{offset:l,verticalPoints:T,xAxis:O,yAxis:E})),z.createElement(Xte,Yo({},h,{horizontalPoints:C})),z.createElement(Yte,Yo({},h,{verticalPoints:T})))}fp.displayName="CartesianGrid";var Jte=["type","layout","connectNulls","ref"],ere=["key"];function Ws(e){"@babel/helpers - typeof";return Ws=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},Ws(e)}function gk(e,t){if(e==null)return{};var r=tre(e,t),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function tre(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 Ec(){return Ec=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){g=[].concat(Ya(f.slice(0,b)),[p-y]);break}var w=g.length%2===0?[0,m]:[m];return[].concat(Ya(t.repeat(f,h)),Ya(g),w).map(function(j){return"".concat(j,"px")}).join(", ")}),Mn(r,"id",nl("recharts-line-")),Mn(r,"pathRef",function(s){r.mainCurve=s}),Mn(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),Mn(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return fre(t,e),sre(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,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,s=o.points,u=o.xAxis,f=o.yAxis,l=o.layout,h=o.children,p=Zr(h,_u);if(!p)return null;var m=function(y,w){return{x:y.x,y:y.y,value:y.value,errorVal:Wt(y.payload,w)}},g={clipPath:n?"url(#clipPath-".concat(i,")"):null};return z.createElement(at,g,p.map(function(b){return z.cloneElement(b,{key:"bar-".concat(b.props.dataKey),data:s,xAxis:u,yAxis:f,layout:l,dataPointFormatter:m})}))}},{key:"renderDots",value:function(n,i,o){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var u=this.props,f=u.dot,l=u.points,h=u.dataKey,p=Be(this.props,!1),m=Be(f,!0),g=l.map(function(y,w){var j=Ur(Ur(Ur({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:l});return t.renderDotItem(f,j)}),b={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(o,")"):null};return z.createElement(at,Ec({className:"recharts-line-dots",key:"dots"},b),g)}},{key:"renderCurveStatically",value:function(n,i,o,s){var u=this.props,f=u.type,l=u.layout,h=u.connectNulls;u.ref;var p=gk(u,Jte),m=Ur(Ur(Ur({},Be(p,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(o,")"):null,points:n},s),{},{type:f,layout:l,connectNulls:h});return z.createElement(Wh,Ec({},m,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,i){var o=this,s=this.props,u=s.points,f=s.strokeDasharray,l=s.isAnimationActive,h=s.animationBegin,p=s.animationDuration,m=s.animationEasing,g=s.animationId,b=s.animateNewValues,y=s.width,w=s.height,j=this.state,O=j.prevPoints,E=j.totalLength;return z.createElement(ri,{begin:h,duration:p,isActive:l,easing:m,from:{t:0},to:{t:1},key:"line-".concat(g),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(A){var N=A.t;if(O){var C=O.length/u.length,T=u.map(function($,U){var G=Math.floor(U*C);if(O[G]){var q=O[G],H=Kr(q.x,$.x),V=Kr(q.y,$.y);return Ur(Ur({},$),{},{x:H(N),y:V(N)})}if(b){var D=Kr(y*2,$.x),Z=Kr(w/2,$.y);return Ur(Ur({},$),{},{x:D(N),y:Z(N)})}return Ur(Ur({},$),{},{x:$.x,y:$.y})});return o.renderCurveStatically(T,n,i)}var R=Kr(0,E),I=R(N),F;if(f){var L="".concat(f).split(/[,\s]+/gim).map(function($){return parseFloat($)});F=o.getStrokeDasharray(I,E,L)}else F=o.generateSimpleStrokeDasharray(E,I);return o.renderCurveStatically(u,n,i,{strokeDasharray:F})})}},{key:"renderCurve",value:function(n,i){var o=this.props,s=o.points,u=o.isAnimationActive,f=this.state,l=f.prevPoints,h=f.totalLength;return u&&s&&s.length&&(!l&&h>0||!Su(l,s))?this.renderCurveWithAnimation(n,i):this.renderCurveStatically(s,n,i)}},{key:"render",value:function(){var n,i=this.props,o=i.hide,s=i.dot,u=i.points,f=i.className,l=i.xAxis,h=i.yAxis,p=i.top,m=i.left,g=i.width,b=i.height,y=i.isAnimationActive,w=i.id;if(o||!u||!u.length)return null;var j=this.state.isAnimationFinished,O=u.length===1,E=He("recharts-line",f),A=l&&l.allowDataOverflow,N=h&&h.allowDataOverflow,C=A||N,T=We(w)?this.id:w,R=(n=Be(s,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},I=R.r,F=I===void 0?3:I,L=R.strokeWidth,$=L===void 0?2:L,U=zq(s)?s:{},G=U.clipDot,q=G===void 0?!0:G,H=F*2+$;return z.createElement(at,{className:E},A||N?z.createElement("defs",null,z.createElement("clipPath",{id:"clipPath-".concat(T)},z.createElement("rect",{x:A?m:m-g/2,y:N?p:p-b/2,width:A?g:g*2,height:N?b:b*2})),!q&&z.createElement("clipPath",{id:"clipPath-dots-".concat(T)},z.createElement("rect",{x:m-H/2,y:p-H/2,width:g+H,height:b+H}))):null,!O&&this.renderCurve(C,T),this.renderErrorBar(C,T),(O||s)&&this.renderDots(C,q,T),(!y||j)&&Ni.renderCallByParent(this.props,u))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:i.curPoints}:n.points!==i.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,i){for(var o=n.length%2!==0?[].concat(Ya(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 tne(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 rne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nne(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?s:t&&t.length&&be(i)&&be(o)?t.slice(i,o+1):[]};function v$(e){return e==="number"?[0,"auto"]:void 0}var ww=function(t,r,n,i){var o=t.graphicalItems,s=t.tooltipAxis,u=fm(r,t);return n<0||!o||!o.length||n>=u.length?null:o.reduce(function(f,l){var h,p=(h=l.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 g=p===void 0?u:p;m=ph(g,s.dataKey,i)}else m=p&&p[n]||u[n];return m?[].concat(Ks(f),[aL(l,m)]):f},[])},Ek=function(t,r,n,i){var o=i||{x:t.chartX,y:t.chartY},s=mne(o,n),u=t.orderedTooltipTicks,f=t.tooltipAxis,l=t.tooltipTicks,h=$K(s,u,l,f);if(h>=0&&l){var p=l[h]&&l[h].value,m=ww(t,r,h,p),g=vne(n,u,h,o);return{activeTooltipIndex:h,activeLabel:p,activePayload:m,activeCoordinate:g}}return null},gne=function(t,r){var n=r.axes,i=r.graphicalItems,o=r.axisType,s=r.axisIdKey,u=r.stackGroups,f=r.dataStartIndex,l=r.dataEndIndex,h=t.layout,p=t.children,m=t.stackOffset,g=eL(h,o);return n.reduce(function(b,y){var w,j=y.type.defaultProps!==void 0?se(se({},y.type.defaultProps),y.props):y.props,O=j.type,E=j.dataKey,A=j.allowDataOverflow,N=j.allowDuplicatedCategory,C=j.scale,T=j.ticks,R=j.includeHidden,I=j[s];if(b[I])return b;var F=fm(t.data,{graphicalItems:i.filter(function(B){var ee,ae=s in B.props?B.props[s]:(ee=B.type.defaultProps)===null||ee===void 0?void 0:ee[s];return ae===I}),dataStartIndex:f,dataEndIndex:l}),L=F.length,$,U,G;Ure(j.domain,A,O)&&($=I1(j.domain,null,A),g&&(O==="number"||C!=="auto")&&(G=Sc(F,E,"category")));var q=v$(O);if(!$||$.length===0){var H,V=(H=j.domain)!==null&&H!==void 0?H:q;if(E){if($=Sc(F,E,O),O==="category"&&g){var D=Tq($);N&&D?(U=$,$=tp(0,L)):N||($=NC(V,$,y).reduce(function(B,ee){return B.indexOf(ee)>=0?B:[].concat(Ks(B),[ee])},[]))}else if(O==="category")N?$=$.filter(function(B){return B!==""&&!We(B)}):$=NC(V,$,y).reduce(function(B,ee){return B.indexOf(ee)>=0||ee===""||We(ee)?B:[].concat(Ks(B),[ee])},[]);else if(O==="number"){var Z=UK(F,i.filter(function(B){var ee,ae,ie=s in B.props?B.props[s]:(ee=B.type.defaultProps)===null||ee===void 0?void 0:ee[s],fe="hide"in B.props?B.props.hide:(ae=B.type.defaultProps)===null||ae===void 0?void 0:ae.hide;return ie===I&&(R||!fe)}),E,o,h);Z&&($=Z)}g&&(O==="number"||C!=="auto")&&(G=Sc(F,E,"category"))}else g?$=tp(0,L):u&&u[I]&&u[I].hasStack&&O==="number"?$=m==="expand"?[0,1]:oL(u[I].stackGroups,f,l):$=JD(F,i.filter(function(B){var ee=s in B.props?B.props[s]:B.type.defaultProps[s],ae="hide"in B.props?B.props.hide:B.type.defaultProps.hide;return ee===I&&(R||!ae)}),O,h,!0);if(O==="number")$=yw(p,$,I,o,T),V&&($=I1(V,$,A));else if(O==="category"&&V){var J=V,M=$.every(function(B){return J.indexOf(B)>=0});M&&($=J)}}return se(se({},b),{},Fe({},I,se(se({},j),{},{axisType:o,domain:$,categoricalDomain:G,duplicateDomain:U,originalDomain:(w=j.domain)!==null&&w!==void 0?w:q,isCategorical:g,layout:h})))},{})},yne=function(t,r){var n=r.graphicalItems,i=r.Axis,o=r.axisType,s=r.axisIdKey,u=r.stackGroups,f=r.dataStartIndex,l=r.dataEndIndex,h=t.layout,p=t.children,m=fm(t.data,{graphicalItems:n,dataStartIndex:f,dataEndIndex:l}),g=m.length,b=eL(h,o),y=-1;return n.reduce(function(w,j){var O=j.type.defaultProps!==void 0?se(se({},j.type.defaultProps),j.props):j.props,E=O[s],A=v$("number");if(!w[E]){y++;var N;return b?N=tp(0,g):u&&u[E]&&u[E].hasStack?(N=oL(u[E].stackGroups,f,l),N=yw(p,N,E,o)):(N=I1(A,JD(m,n.filter(function(C){var T,R,I=s in C.props?C.props[s]:(T=C.type.defaultProps)===null||T===void 0?void 0:T[s],F="hide"in C.props?C.props.hide:(R=C.type.defaultProps)===null||R===void 0?void 0:R.hide;return I===E&&!F}),"number",h),i.defaultProps.allowDataOverflow),N=yw(p,N,E,o)),se(se({},w),{},Fe({},E,se(se({axisType:o},i.defaultProps),{},{hide:!0,orientation:Qr(hne,"".concat(o,".").concat(y%2),null),domain:N,originalDomain:A,isCategorical:b,layout:h})))}return w},{})},xne=function(t,r){var n=r.axisType,i=n===void 0?"xAxis":n,o=r.AxisComp,s=r.graphicalItems,u=r.stackGroups,f=r.dataStartIndex,l=r.dataEndIndex,h=t.children,p="".concat(i,"Id"),m=Zr(h,o),g={};return m&&m.length?g=gne(t,{axes:m,graphicalItems:s,axisType:i,axisIdKey:p,stackGroups:u,dataStartIndex:f,dataEndIndex:l}):s&&s.length&&(g=yne(t,{Axis:o,graphicalItems:s,axisType:i,axisIdKey:p,stackGroups:u,dataStartIndex:f,dataEndIndex:l})),g},bne=function(t){var r=lo(t),n=Oi(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:wS(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:zh(r,n)}},Pk=function(t){var r=t.children,n=t.defaultShowTooltip,i=Hr(r,$s),o=0,s=0;return t.data&&t.data.length!==0&&(s=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(s=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!n}},wne=function(t){return!t||!t.length?!1:t.some(function(r){var n=Ei(r&&r.type);return n&&n.indexOf("Bar")>=0})},Nk=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"}},Sne=function(t,r){var n=t.props,i=t.graphicalItems,o=t.xAxisMap,s=o===void 0?{}:o,u=t.yAxisMap,f=u===void 0?{}:u,l=n.width,h=n.height,p=n.children,m=n.margin||{},g=Hr(p,$s),b=Hr(p,ds),y=Object.keys(f).reduce(function(N,C){var T=f[C],R=T.orientation;return!T.mirror&&!T.hide?se(se({},N),{},Fe({},R,N[R]+T.width)):N},{left:m.left||0,right:m.right||0}),w=Object.keys(s).reduce(function(N,C){var T=s[C],R=T.orientation;return!T.mirror&&!T.hide?se(se({},N),{},Fe({},R,Qr(N,"".concat(R))+T.height)):N},{top:m.top||0,bottom:m.bottom||0}),j=se(se({},w),y),O=j.bottom;g&&(j.bottom+=g.props.height||$s.defaultProps.height),b&&r&&(j=zK(j,i,n,r));var E=l-j.left-j.right,A=h-j.top-j.bottom;return se(se({brushBottom:O},j),{},{width:Math.max(E,0),height:Math.max(A,0)})},_ne=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},i_=function(t){var r=t.chartName,n=t.GraphicalChild,i=t.defaultTooltipEventType,o=i===void 0?"axis":i,s=t.validateTooltipEventTypes,u=s===void 0?["axis"]:s,f=t.axisComponents,l=t.legendContent,h=t.formatAxisMap,p=t.defaultProps,m=function(j,O){var E=O.graphicalItems,A=O.stackGroups,N=O.offset,C=O.updateId,T=O.dataStartIndex,R=O.dataEndIndex,I=j.barSize,F=j.layout,L=j.barGap,$=j.barCategoryGap,U=j.maxBarSize,G=Nk(F),q=G.numericAxisName,H=G.cateAxisName,V=wne(E),D=[];return E.forEach(function(Z,J){var M=fm(j.data,{graphicalItems:[Z],dataStartIndex:T,dataEndIndex:R}),B=Z.type.defaultProps!==void 0?se(se({},Z.type.defaultProps),Z.props):Z.props,ee=B.dataKey,ae=B.maxBarSize,ie=B["".concat(q,"Id")],fe=B["".concat(H,"Id")],K={},ce=f.reduce(function(Rt,$t){var li=O["".concat($t.axisType,"Map")],_o=B["".concat($t.axisType,"Id")];li&&li[_o]||$t.axisType==="zAxis"||ia();var Bi=li[_o];return se(se({},Rt),{},Fe(Fe({},$t.axisType,Bi),"".concat($t.axisType,"Ticks"),Oi(Bi)))},K),te=ce[H],le=ce["".concat(H,"Ticks")],ge=A&&A[ie]&&A[ie].hasStack&&ZK(Z,A[ie].stackGroups),Y=Ei(Z.type).indexOf("Bar")>=0,_e=zh(te,le),Oe=[],Ve=V&&BK({barSize:I,stackGroups:A,totalSize:_ne(ce,H)});if(Y){var nt,lt,nr=We(ae)?U:ae,ir=(nt=(lt=zh(te,le,!0))!==null&<!==void 0?lt:nr)!==null&&nt!==void 0?nt:0;Oe=FK({barGap:L,barCategoryGap:$,bandSize:ir!==_e?ir:_e,sizeList:Ve[fe],maxBarSize:nr}),ir!==_e&&(Oe=Oe.map(function(Rt){return se(se({},Rt),{},{position:se(se({},Rt.position),{},{offset:Rt.position.offset-ir/2})})}))}var hr=Z&&Z.type&&Z.type.getComposedData;hr&&D.push({props:se(se({},hr(se(se({},ce),{},{displayedData:M,props:j,dataKey:ee,item:Z,bandSize:_e,barPosition:Oe,offset:N,stackedData:ge,layout:F,dataStartIndex:T,dataEndIndex:R}))),{},Fe(Fe(Fe({key:Z.key||"item-".concat(J)},q,ce[q]),H,ce[H]),"animationId",C)),childIndex:Wq(Z,j.children),item:Z})}),D},g=function(j,O){var E=j.props,A=j.dataStartIndex,N=j.dataEndIndex,C=j.updateId;if(!qP({props:E}))return null;var T=E.children,R=E.layout,I=E.stackOffset,F=E.data,L=E.reverseStackOrder,$=Nk(R),U=$.numericAxisName,G=$.cateAxisName,q=Zr(T,n),H=YK(F,q,"".concat(U,"Id"),"".concat(G,"Id"),I,L),V=f.reduce(function(B,ee){var ae="".concat(ee.axisType,"Map");return se(se({},B),{},Fe({},ae,xne(E,se(se({},ee),{},{graphicalItems:q,stackGroups:ee.axisType===U&&H,dataStartIndex:A,dataEndIndex:N}))))},{}),D=Sne(se(se({},V),{},{props:E,graphicalItems:q}),O?.legendBBox);Object.keys(V).forEach(function(B){V[B]=h(E,V[B],D,B.replace("Map",""),r)});var Z=V["".concat(G,"Map")],J=bne(Z),M=m(E,se(se({},V),{},{dataStartIndex:A,dataEndIndex:N,updateId:C,graphicalItems:q,stackGroups:H,offset:D}));return se(se({formattedGraphicalItems:M,graphicalItems:q,offset:D,stackGroups:H},J),V)},b=(function(w){function j(O){var E,A,N;return rne(this,j),N=one(this,j,[O]),Fe(N,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Fe(N,"accessibilityManager",new qre),Fe(N,"handleLegendBBoxUpdate",function(C){if(C){var T=N.state,R=T.dataStartIndex,I=T.dataEndIndex,F=T.updateId;N.setState(se({legendBBox:C},g({props:N.props,dataStartIndex:R,dataEndIndex:I,updateId:F},se(se({},N.state),{},{legendBBox:C}))))}}),Fe(N,"handleReceiveSyncEvent",function(C,T,R){if(N.props.syncId===C){if(R===N.eventEmitterSymbol&&typeof N.props.syncMethod!="function")return;N.applySyncEvent(T)}}),Fe(N,"handleBrushChange",function(C){var T=C.startIndex,R=C.endIndex;if(T!==N.state.dataStartIndex||R!==N.state.dataEndIndex){var I=N.state.updateId;N.setState(function(){return se({dataStartIndex:T,dataEndIndex:R},g({props:N.props,dataStartIndex:T,dataEndIndex:R,updateId:I},N.state))}),N.triggerSyncEvent({dataStartIndex:T,dataEndIndex:R})}}),Fe(N,"handleMouseEnter",function(C){var T=N.getMouseInfo(C);if(T){var R=se(se({},T),{},{isTooltipActive:!0});N.setState(R),N.triggerSyncEvent(R);var I=N.props.onMouseEnter;qe(I)&&I(R,C)}}),Fe(N,"triggeredAfterMouseMove",function(C){var T=N.getMouseInfo(C),R=T?se(se({},T),{},{isTooltipActive:!0}):{isTooltipActive:!1};N.setState(R),N.triggerSyncEvent(R);var I=N.props.onMouseMove;qe(I)&&I(R,C)}),Fe(N,"handleItemMouseEnter",function(C){N.setState(function(){return{isTooltipActive:!0,activeItem:C,activePayload:C.tooltipPayload,activeCoordinate:C.tooltipPosition||{x:C.cx,y:C.cy}}})}),Fe(N,"handleItemMouseLeave",function(){N.setState(function(){return{isTooltipActive:!1}})}),Fe(N,"handleMouseMove",function(C){C.persist(),N.throttleTriggeredAfterMouseMove(C)}),Fe(N,"handleMouseLeave",function(C){N.throttleTriggeredAfterMouseMove.cancel();var T={isTooltipActive:!1};N.setState(T),N.triggerSyncEvent(T);var R=N.props.onMouseLeave;qe(R)&&R(T,C)}),Fe(N,"handleOuterEvent",function(C){var T=Uq(C),R=Qr(N.props,"".concat(T));if(T&&qe(R)){var I,F;/.*touch.*/i.test(T)?F=N.getMouseInfo(C.changedTouches[0]):F=N.getMouseInfo(C),R((I=F)!==null&&I!==void 0?I:{},C)}}),Fe(N,"handleClick",function(C){var T=N.getMouseInfo(C);if(T){var R=se(se({},T),{},{isTooltipActive:!0});N.setState(R),N.triggerSyncEvent(R);var I=N.props.onClick;qe(I)&&I(R,C)}}),Fe(N,"handleMouseDown",function(C){var T=N.props.onMouseDown;if(qe(T)){var R=N.getMouseInfo(C);T(R,C)}}),Fe(N,"handleMouseUp",function(C){var T=N.props.onMouseUp;if(qe(T)){var R=N.getMouseInfo(C);T(R,C)}}),Fe(N,"handleTouchMove",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&N.throttleTriggeredAfterMouseMove(C.changedTouches[0])}),Fe(N,"handleTouchStart",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&N.handleMouseDown(C.changedTouches[0])}),Fe(N,"handleTouchEnd",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&N.handleMouseUp(C.changedTouches[0])}),Fe(N,"handleDoubleClick",function(C){var T=N.props.onDoubleClick;if(qe(T)){var R=N.getMouseInfo(C);T(R,C)}}),Fe(N,"handleContextMenu",function(C){var T=N.props.onContextMenu;if(qe(T)){var R=N.getMouseInfo(C);T(R,C)}}),Fe(N,"triggerSyncEvent",function(C){N.props.syncId!==void 0&&Rb.emit(Mb,N.props.syncId,C,N.eventEmitterSymbol)}),Fe(N,"applySyncEvent",function(C){var T=N.props,R=T.layout,I=T.syncMethod,F=N.state.updateId,L=C.dataStartIndex,$=C.dataEndIndex;if(C.dataStartIndex!==void 0||C.dataEndIndex!==void 0)N.setState(se({dataStartIndex:L,dataEndIndex:$},g({props:N.props,dataStartIndex:L,dataEndIndex:$,updateId:F},N.state)));else if(C.activeTooltipIndex!==void 0){var U=C.chartX,G=C.chartY,q=C.activeTooltipIndex,H=N.state,V=H.offset,D=H.tooltipTicks;if(!V)return;if(typeof I=="function")q=I(D,C);else if(I==="value"){q=-1;for(var Z=0;Z=0){var ge,Y;if(U.dataKey&&!U.allowDuplicatedCategory){var _e=typeof U.dataKey=="function"?le:"payload.".concat(U.dataKey.toString());ge=ph(Z,_e,q),Y=J&&M&&ph(M,_e,q)}else ge=Z?.[G],Y=J&&M&&M[G];if(fe||ie){var Oe=C.props.activeIndex!==void 0?C.props.activeIndex:G;return[S.cloneElement(C,se(se(se({},I.props),ce),{},{activeIndex:Oe})),null,null]}if(!We(ge))return[te].concat(Ks(N.renderActivePoints({item:I,activePoint:ge,basePoint:Y,childIndex:G,isRange:J})))}else{var Ve,nt=(Ve=N.getItemByXY(N.state.activeCoordinate))!==null&&Ve!==void 0?Ve:{graphicalItem:te},lt=nt.graphicalItem,nr=lt.item,ir=nr===void 0?C:nr,hr=lt.childIndex,Rt=se(se(se({},I.props),ce),{},{activeIndex:hr});return[S.cloneElement(ir,Rt),null,null]}return J?[te,null,null]:[te,null]}),Fe(N,"renderCustomized",function(C,T,R){return S.cloneElement(C,se(se({key:"recharts-customized-".concat(R)},N.props),N.state))}),Fe(N,"renderMap",{CartesianGrid:{handler:dd,once:!0},ReferenceArea:{handler:N.renderReferenceElement},ReferenceLine:{handler:dd},ReferenceDot:{handler:N.renderReferenceElement},XAxis:{handler:dd},YAxis:{handler:dd},Brush:{handler:N.renderBrush,once:!0},Bar:{handler:N.renderGraphicChild},Line:{handler:N.renderGraphicChild},Area:{handler:N.renderGraphicChild},Radar:{handler:N.renderGraphicChild},RadialBar:{handler:N.renderGraphicChild},Scatter:{handler:N.renderGraphicChild},Pie:{handler:N.renderGraphicChild},Funnel:{handler:N.renderGraphicChild},Tooltip:{handler:N.renderCursor,once:!0},PolarGrid:{handler:N.renderPolarGrid,once:!0},PolarAngleAxis:{handler:N.renderPolarAxis},PolarRadiusAxis:{handler:N.renderPolarAxis},Customized:{handler:N.renderCustomized}}),N.clipPathId="".concat((E=O.id)!==null&&E!==void 0?E:nl("recharts"),"-clip"),N.throttleTriggeredAfterMouseMove=QI(N.triggeredAfterMouseMove,(A=O.throttleDelay)!==null&&A!==void 0?A:1e3/60),N.state={},N}return lne(j,w),ine(j,[{key:"componentDidMount",value:function(){var E,A;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(E=this.props.margin.left)!==null&&E!==void 0?E: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 E=this.props,A=E.children,N=E.data,C=E.height,T=E.layout,R=Hr(A,Gr);if(R){var I=R.props.defaultIndex;if(!(typeof I!="number"||I<0||I>this.state.tooltipTicks.length-1)){var F=this.state.tooltipTicks[I]&&this.state.tooltipTicks[I].value,L=ww(this.state,N,I,F),$=this.state.tooltipTicks[I].coordinate,U=(this.state.offset.top+C)/2,G=T==="horizontal",q=G?{x:$,y:U}:{y:$,x:U},H=this.state.formattedGraphicalItems.find(function(D){var Z=D.item;return Z.type.name==="Scatter"});H&&(q=se(se({},q),H.props.points[I].tooltipPosition),L=H.props.points[I].tooltipPayload);var V={activeTooltipIndex:I,isTooltipActive:!0,activeLabel:F,activePayload:L,activeCoordinate:q};this.setState(V),this.renderCursor(R),this.accessibilityManager.setIndex(I)}}}},{key:"getSnapshotBeforeUpdate",value:function(E,A){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==A.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==E.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==E.margin){var N,C;this.accessibilityManager.setDetails({offset:{left:(N=this.props.margin.left)!==null&&N!==void 0?N:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0}})}return null}},{key:"componentDidUpdate",value:function(E){n1([Hr(E.children,Gr)],[Hr(this.props.children,Gr)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var E=Hr(this.props.children,Gr);if(E&&typeof E.props.shared=="boolean"){var A=E.props.shared?"axis":"item";return u.indexOf(A)>=0?A:o}return o}},{key:"getMouseInfo",value:function(E){if(!this.container)return null;var A=this.container,N=A.getBoundingClientRect(),C=CW(N),T={chartX:Math.round(E.pageX-C.left),chartY:Math.round(E.pageY-C.top)},R=N.width/A.offsetWidth||1,I=this.inRange(T.chartX,T.chartY,R);if(!I)return null;var F=this.state,L=F.xAxisMap,$=F.yAxisMap,U=this.getTooltipEventType(),G=Ek(this.state,this.props.data,this.props.layout,I);if(U!=="axis"&&L&&$){var q=lo(L).scale,H=lo($).scale,V=q&&q.invert?q.invert(T.chartX):null,D=H&&H.invert?H.invert(T.chartY):null;return se(se({},T),{},{xValue:V,yValue:D},G)}return G?se(se({},T),G):null}},{key:"inRange",value:function(E,A){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,C=this.props.layout,T=E/N,R=A/N;if(C==="horizontal"||C==="vertical"){var I=this.state.offset,F=T>=I.left&&T<=I.left+I.width&&R>=I.top&&R<=I.top+I.height;return F?{x:T,y:R}:null}var L=this.state,$=L.angleAxisMap,U=L.radiusAxisMap;if($&&U){var G=lo($);return TC({x:T,y:R},G)}return null}},{key:"parseEventsOfWrapper",value:function(){var E=this.props.children,A=this.getTooltipEventType(),N=Hr(E,Gr),C={};N&&A==="axis"&&(N.props.trigger==="click"?C={onClick:this.handleClick}:C={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=mh(this.props,this.handleOuterEvent);return se(se({},T),C)}},{key:"addListener",value:function(){Rb.on(Mb,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Rb.removeListener(Mb,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(E,A,N){for(var C=this.state.formattedGraphicalItems,T=0,R=C.length;Td.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:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.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)}),d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-semibold text-gray-900",children:e.product}),d.jsxs("p",{className:"text-xs text-gray-500",children:[e.id," • ",e.user]})]})]}),d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("span",{className:"text-xs text-gray-500 font-medium",children:e.time}),d.jsx(Gn,{variant:"secondary",className:e.status==="expired"?"bg-red-100 text-red-700":"bg-green-100 text-green-700",children:e.status})]})]},e.id))})})]})]}),d.jsx("div",{className:"space-y-6",children:d.jsxs(Vr,{className:"shadow-sm border-gray-200",children:[d.jsx(Tn,{children:d.jsxs(kn,{className:"text-base font-bold text-gray-800 flex items-center gap-2",children:[d.jsx(ah,{className:"w-5 h-5 text-gray-500"}),"By Category"]})}),d.jsxs(dn,{children:[d.jsxs("div",{className:"h-[200px] relative",children:[d.jsx(Oh,{width:"100%",height:"100%",children:d.jsxs(One,{children:[d.jsx($i,{data:Db,cx:"50%",cy:"50%",innerRadius:60,outerRadius:80,paddingAngle:5,dataKey:"value",children:Db.map((e,t)=>d.jsx(zp,{fill:e.color},`cell-${t}`))}),d.jsx(Gr,{})]})}),d.jsxs("div",{className:"absolute inset-0 flex items-center justify-center flex-col pointer-events-none",children:[d.jsx("span",{className:"text-2xl font-bold text-gray-900",children:"1000"}),d.jsx("span",{className:"text-xs text-gray-500",children:"Total"})]})]}),d.jsx("div",{className:"mt-4 space-y-2",children:Db.map(e=>d.jsxs("div",{className:"flex items-center justify-between text-sm",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:e.color}}),d.jsx("span",{className:"text-gray-600",children:e.name})]}),d.jsx("span",{className:"font-medium text-gray-900",children:e.value})]},e.name))})]})]})})]})]})}function Qa({title:e,value:t,trend:r,trendUp:n,icon:i,color:o,bgColor:s}){return d.jsx(Vr,{className:"border-gray-200 shadow-sm hover:shadow-md transition-shadow",children:d.jsxs(dn,{className:"p-6",children:[d.jsxs("div",{className:"flex justify-between items-start",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-medium text-gray-500 mb-1",children:e}),d.jsx("h3",{className:"text-2xl font-bold text-gray-900",children:t})]}),d.jsx("div",{className:`p-2 rounded-lg ${s}`,children:d.jsx(i,{className:`w-5 h-5 ${o}`})})]}),d.jsxs("div",{className:"mt-4 flex items-center text-sm",children:[n?d.jsx(lM,{className:"w-4 h-4 text-green-500 mr-1"}):d.jsx(A8,{className:"w-4 h-4 text-red-500 mr-1"}),d.jsx("span",{className:n?"text-green-600 font-medium":"text-red-600 font-medium",children:r}),d.jsx("span",{className:"text-gray-400 ml-1",children:"Vs. last period"})]})]})})}function Ane({title:e}){return d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[1,2,3,4].map(t=>d.jsxs(Vr,{children:[d.jsx(Tn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:d.jsxs(kn,{className:"text-sm font-medium",children:["Metric ",t]})}),d.jsxs(dn,{children:[d.jsx("div",{className:"text-2xl font-bold",children:"000"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"+0.0% from last month"})]})]},t))}),d.jsx(Vr,{className:"min-h-[400px] flex items-center justify-center border-dashed",children:d.jsxs("div",{className:"text-center text-muted-foreground",children:[d.jsxs("h3",{className:"text-lg font-medium",children:[e," Module"]}),d.jsx("p",{children:"This module is currently under development."})]})})]})}function br({className:e,...t}){return d.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:d.jsx("table",{"data-slot":"table",className:Re("w-full caption-bottom text-sm",e),...t})})}function wr({className:e,...t}){return d.jsx("thead",{"data-slot":"table-header",className:Re("[&_tr]:border-b",e),...t})}function Sr({className:e,...t}){return d.jsx("tbody",{"data-slot":"table-body",className:Re("[&_tr:last-child]:border-0",e),...t})}function Ge({className:e,...t}){return d.jsx("tr",{"data-slot":"table-row",className:Re("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function ye({className:e,...t}){return d.jsx("th",{"data-slot":"table-head",className:Re("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 ue({className:e,...t}){return d.jsx("td",{"data-slot":"table-cell",className:Re("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function Ak(e){const t=Cne(e),r=S.forwardRef((n,i)=>{const{children:o,...s}=n,u=S.Children.toArray(o),f=u.find(kne);if(f){const l=f.props.children,h=u.map(p=>p===f?S.Children.count(l)>1?S.Children.only(null):S.isValidElement(l)?l.props.children:null:p);return d.jsx(t,{...s,ref:i,children:S.isValidElement(l)?S.cloneElement(l,void 0,h):null})}return d.jsx(t,{...s,ref:i,children:o})});return r.displayName=`${e}.Slot`,r}function Cne(e){const t=S.forwardRef((r,n)=>{const{children:i,...o}=r;if(S.isValidElement(i)){const s=Mne(i),u=Rne(o,i.props);return i.type!==S.Fragment&&(u.ref=n?ha(n,s):s),S.cloneElement(i,u)}return S.Children.count(i)>1?S.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Tne=Symbol("radix.slottable");function kne(e){return S.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Tne}function Rne(e,t){const r={...t};for(const n in t){const i=e[n],o=t[n];/^on[A-Z]/.test(n)?i&&o?r[n]=(...u)=>{const f=o(...u);return i(...u),f}:i&&(r[n]=i):n==="style"?r[n]={...i,...o}:n==="className"&&(r[n]=[i,o].filter(Boolean).join(" "))}return{...e,...r}}function Mne(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 y$(e){const t=e+"CollectionProvider",[r,n]=Bn(t),[i,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),s=y=>{const{scope:w,children:j}=y,O=z.useRef(null),E=z.useRef(new Map).current;return d.jsx(i,{scope:w,itemMap:E,collectionRef:O,children:j})};s.displayName=t;const u=e+"CollectionSlot",f=Ak(u),l=z.forwardRef((y,w)=>{const{scope:j,children:O}=y,E=o(u,j),A=Ze(w,E.collectionRef);return d.jsx(f,{ref:A,children:O})});l.displayName=u;const h=e+"CollectionItemSlot",p="data-radix-collection-item",m=Ak(h),g=z.forwardRef((y,w)=>{const{scope:j,children:O,...E}=y,A=z.useRef(null),N=Ze(w,A),C=o(h,j);return z.useEffect(()=>(C.itemMap.set(A,{ref:A,...E}),()=>void C.itemMap.delete(A))),d.jsx(m,{[p]:"",ref:N,children:O})});g.displayName=h;function b(y){const w=o(e+"CollectionConsumer",y);return z.useCallback(()=>{const O=w.collectionRef.current;if(!O)return[];const E=Array.from(O.querySelectorAll(`[${p}]`));return Array.from(w.itemMap.values()).sort((C,T)=>E.indexOf(C.ref.current)-E.indexOf(T.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:s,Slot:l,ItemSlot:g},b,n]}function Ine(e,t=globalThis?.document){const r=fr(e);S.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Dne="DismissableLayer",Sw="dismissableLayer.update",Lne="dismissableLayer.pointerDownOutside",$ne="dismissableLayer.focusOutside",Ck,x$=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ju=S.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:u,...f}=e,l=S.useContext(x$),[h,p]=S.useState(null),m=h?.ownerDocument??globalThis?.document,[,g]=S.useState({}),b=Ze(t,T=>p(T)),y=Array.from(l.layers),[w]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),j=y.indexOf(w),O=h?y.indexOf(h):-1,E=l.layersWithOutsidePointerEventsDisabled.size>0,A=O>=j,N=zne(T=>{const R=T.target,I=[...l.branches].some(F=>F.contains(R));!A||I||(i?.(T),s?.(T),T.defaultPrevented||u?.())},m),C=qne(T=>{const R=T.target;[...l.branches].some(F=>F.contains(R))||(o?.(T),s?.(T),T.defaultPrevented||u?.())},m);return Ine(T=>{O===l.layers.size-1&&(n?.(T),!T.defaultPrevented&&u&&(T.preventDefault(),u()))},m),S.useEffect(()=>{if(h)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Ck=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(h)),l.layers.add(h),Tk(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Ck)}},[h,m,r,l]),S.useEffect(()=>()=>{h&&(l.layers.delete(h),l.layersWithOutsidePointerEventsDisabled.delete(h),Tk())},[h,l]),S.useEffect(()=>{const T=()=>g({});return document.addEventListener(Sw,T),()=>document.removeEventListener(Sw,T)},[]),d.jsx(Ue.div,{...f,ref:b,style:{pointerEvents:E?A?"auto":"none":void 0,...e.style},onFocusCapture:Ie(e.onFocusCapture,C.onFocusCapture),onBlurCapture:Ie(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:Ie(e.onPointerDownCapture,N.onPointerDownCapture)})});ju.displayName=Dne;var Bne="DismissableLayerBranch",Fne=S.forwardRef((e,t)=>{const r=S.useContext(x$),n=S.useRef(null),i=Ze(t,n);return S.useEffect(()=>{const o=n.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),d.jsx(Ue.div,{...e,ref:i})});Fne.displayName=Bne;function zne(e,t=globalThis?.document){const r=fr(e),n=S.useRef(!1),i=S.useRef(()=>{});return S.useEffect(()=>{const o=u=>{if(u.target&&!n.current){let f=function(){b$(Lne,r,l,{discrete:!0})};const l={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=f,t.addEventListener("click",i.current,{once:!0})):f()}else t.removeEventListener("click",i.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function qne(e,t=globalThis?.document){const r=fr(e),n=S.useRef(!1);return S.useEffect(()=>{const i=o=>{o.target&&!n.current&&b$($ne,r,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Tk(){const e=new CustomEvent(Sw);document.dispatchEvent(e)}function b$(e,t,r,{discrete:n}){const i=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),n?V6(i,o):i.dispatchEvent(o)}var Lb=0;function o_(){S.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??kk()),document.body.insertAdjacentElement("beforeend",e[1]??kk()),Lb++,()=>{Lb===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Lb--}},[])}function kk(){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 $b="focusScope.autoFocusOnMount",Bb="focusScope.autoFocusOnUnmount",Rk={bubbles:!1,cancelable:!0},Une="FocusScope",dm=S.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=e,[u,f]=S.useState(null),l=fr(i),h=fr(o),p=S.useRef(null),m=Ze(t,y=>f(y)),g=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(n){let y=function(E){if(g.paused||!u)return;const A=E.target;u.contains(A)?p.current=A:ao(p.current,{select:!0})},w=function(E){if(g.paused||!u)return;const A=E.relatedTarget;A!==null&&(u.contains(A)||ao(p.current,{select:!0}))},j=function(E){if(document.activeElement===document.body)for(const N of E)N.removedNodes.length>0&&ao(u)};document.addEventListener("focusin",y),document.addEventListener("focusout",w);const O=new MutationObserver(j);return u&&O.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",w),O.disconnect()}}},[n,u,g.paused]),S.useEffect(()=>{if(u){Ik.add(g);const y=document.activeElement;if(!u.contains(y)){const j=new CustomEvent($b,Rk);u.addEventListener($b,l),u.dispatchEvent(j),j.defaultPrevented||(Wne(Xne(w$(u)),{select:!0}),document.activeElement===y&&ao(u))}return()=>{u.removeEventListener($b,l),setTimeout(()=>{const j=new CustomEvent(Bb,Rk);u.addEventListener(Bb,h),u.dispatchEvent(j),j.defaultPrevented||ao(y??document.body,{select:!0}),u.removeEventListener(Bb,h),Ik.remove(g)},0)}}},[u,l,h,g]);const b=S.useCallback(y=>{if(!r&&!n||g.paused)return;const w=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,j=document.activeElement;if(w&&j){const O=y.currentTarget,[E,A]=Hne(O);E&&A?!y.shiftKey&&j===A?(y.preventDefault(),r&&ao(E,{select:!0})):y.shiftKey&&j===E&&(y.preventDefault(),r&&ao(A,{select:!0})):j===O&&y.preventDefault()}},[r,n,g.paused]);return d.jsx(Ue.div,{tabIndex:-1,...s,ref:m,onKeyDown:b})});dm.displayName=Une;function Wne(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(ao(n,{select:t}),document.activeElement!==r)return}function Hne(e){const t=w$(e),r=Mk(t,e),n=Mk(t.reverse(),e);return[r,n]}function w$(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Mk(e,t){for(const r of e)if(!Vne(r,{upTo:t}))return r}function Vne(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 Gne(e){return e instanceof HTMLInputElement&&"select"in e}function ao(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Gne(e)&&t&&e.select()}}var Ik=Kne();function Kne(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Dk(e,t),e.unshift(t)},remove(t){e=Dk(e,t),e[0]?.resume()}}}function Dk(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Xne(e){return e.filter(t=>t.tagName!=="A")}var Yne=Uw[" useId ".trim().toString()]||(()=>{}),Qne=0;function Jn(e){const[t,r]=S.useState(Yne());return Lt(()=>{r(n=>n??String(Qne++))},[e]),e||(t?`radix-${t}`:"")}const Zne=["top","right","bottom","left"],po=Math.min,Xr=Math.max,vp=Math.round,hd=Math.floor,ei=e=>({x:e,y:e}),Jne={left:"right",right:"left",bottom:"top",top:"bottom"},eie={start:"end",end:"start"};function _w(e,t,r){return Xr(e,po(t,r))}function ki(e,t){return typeof e=="function"?e(t):e}function Ri(e){return e.split("-")[0]}function ul(e){return e.split("-")[1]}function a_(e){return e==="x"?"y":"x"}function s_(e){return e==="y"?"height":"width"}const tie=new Set(["top","bottom"]);function Yn(e){return tie.has(Ri(e))?"y":"x"}function l_(e){return a_(Yn(e))}function rie(e,t,r){r===void 0&&(r=!1);const n=ul(e),i=l_(e),o=s_(i);let s=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=gp(s)),[s,gp(s)]}function nie(e){const t=gp(e);return[jw(e),t,jw(t)]}function jw(e){return e.replace(/start|end/g,t=>eie[t])}const Lk=["left","right"],$k=["right","left"],iie=["top","bottom"],oie=["bottom","top"];function aie(e,t,r){switch(e){case"top":case"bottom":return r?t?$k:Lk:t?Lk:$k;case"left":case"right":return t?iie:oie;default:return[]}}function sie(e,t,r,n){const i=ul(e);let o=aie(Ri(e),r==="start",n);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(jw)))),o}function gp(e){return e.replace(/left|right|bottom|top/g,t=>Jne[t])}function lie(e){return{top:0,right:0,bottom:0,left:0,...e}}function S$(e){return typeof e!="number"?lie(e):{top:e,right:e,bottom:e,left:e}}function yp(e){const{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function Bk(e,t,r){let{reference:n,floating:i}=e;const o=Yn(t),s=l_(t),u=s_(s),f=Ri(t),l=o==="y",h=n.x+n.width/2-i.width/2,p=n.y+n.height/2-i.height/2,m=n[u]/2-i[u]/2;let g;switch(f){case"top":g={x:h,y:n.y-i.height};break;case"bottom":g={x:h,y:n.y+n.height};break;case"right":g={x:n.x+n.width,y:p};break;case"left":g={x:n.x-i.width,y:p};break;default:g={x:n.x,y:n.y}}switch(ul(t)){case"start":g[s]-=m*(r&&l?-1:1);break;case"end":g[s]+=m*(r&&l?-1:1);break}return g}async function cie(e,t){var r;t===void 0&&(t={});const{x:n,y:i,platform:o,rects:s,elements:u,strategy:f}=e,{boundary:l="clippingAncestors",rootBoundary:h="viewport",elementContext:p="floating",altBoundary:m=!1,padding:g=0}=ki(t,e),b=S$(g),w=u[m?p==="floating"?"reference":"floating":p],j=yp(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(w)))==null||r?w:w.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(u.floating)),boundary:l,rootBoundary:h,strategy:f})),O=p==="floating"?{x:n,y:i,width:s.floating.width,height:s.floating.height}:s.reference,E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u.floating)),A=await(o.isElement==null?void 0:o.isElement(E))?await(o.getScale==null?void 0:o.getScale(E))||{x:1,y:1}:{x:1,y:1},N=yp(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:O,offsetParent:E,strategy:f}):O);return{top:(j.top-N.top+b.top)/A.y,bottom:(N.bottom-j.bottom+b.bottom)/A.y,left:(j.left-N.left+b.left)/A.x,right:(N.right-j.right+b.right)/A.x}}const uie=async(e,t,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:o=[],platform:s}=r,u=o.filter(Boolean),f=await(s.isRTL==null?void 0:s.isRTL(t));let l=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:h,y:p}=Bk(l,n,f),m=n,g={},b=0;for(let w=0;w({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:i,rects:o,platform:s,elements:u,middlewareData:f}=t,{element:l,padding:h=0}=ki(e,t)||{};if(l==null)return{};const p=S$(h),m={x:r,y:n},g=l_(i),b=s_(g),y=await s.getDimensions(l),w=g==="y",j=w?"top":"left",O=w?"bottom":"right",E=w?"clientHeight":"clientWidth",A=o.reference[b]+o.reference[g]-m[g]-o.floating[b],N=m[g]-o.reference[g],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l));let T=C?C[E]:0;(!T||!await(s.isElement==null?void 0:s.isElement(C)))&&(T=u.floating[E]||o.floating[b]);const R=A/2-N/2,I=T/2-y[b]/2-1,F=po(p[j],I),L=po(p[O],I),$=F,U=T-y[b]-L,G=T/2-y[b]/2+R,q=_w($,G,U),H=!f.arrow&&ul(i)!=null&&G!==q&&o.reference[b]/2-(G<$?F:L)-y[b]/2<0,V=H?G<$?G-$:G-U:0;return{[g]:m[g]+V,data:{[g]:q,centerOffset:G-q-V,...H&&{alignmentOffset:V}},reset:H}}}),die=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:i,middlewareData:o,rects:s,initialPlacement:u,platform:f,elements:l}=t,{mainAxis:h=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:y=!0,...w}=ki(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const j=Ri(i),O=Yn(u),E=Ri(u)===u,A=await(f.isRTL==null?void 0:f.isRTL(l.floating)),N=m||(E||!y?[gp(u)]:nie(u)),C=b!=="none";!m&&C&&N.push(...sie(u,y,b,A));const T=[u,...N],R=await f.detectOverflow(t,w),I=[];let F=((n=o.flip)==null?void 0:n.overflows)||[];if(h&&I.push(R[j]),p){const G=rie(i,s,A);I.push(R[G[0]],R[G[1]])}if(F=[...F,{placement:i,overflows:I}],!I.every(G=>G<=0)){var L,$;const G=(((L=o.flip)==null?void 0:L.index)||0)+1,q=T[G];if(q&&(!(p==="alignment"?O!==Yn(q):!1)||F.every(D=>Yn(D.placement)===O?D.overflows[0]>0:!0)))return{data:{index:G,overflows:F},reset:{placement:q}};let H=($=F.filter(V=>V.overflows[0]<=0).sort((V,D)=>V.overflows[1]-D.overflows[1])[0])==null?void 0:$.placement;if(!H)switch(g){case"bestFit":{var U;const V=(U=F.filter(D=>{if(C){const Z=Yn(D.placement);return Z===O||Z==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(Z=>Z>0).reduce((Z,J)=>Z+J,0)]).sort((D,Z)=>D[1]-Z[1])[0])==null?void 0:U[0];V&&(H=V);break}case"initialPlacement":H=u;break}if(i!==H)return{reset:{placement:H}}}return{}}}};function Fk(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zk(e){return Zne.some(t=>e[t]>=0)}const hie=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:i="referenceHidden",...o}=ki(e,t);switch(i){case"referenceHidden":{const s=await n.detectOverflow(t,{...o,elementContext:"reference"}),u=Fk(s,r.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:zk(u)}}}case"escaped":{const s=await n.detectOverflow(t,{...o,altBoundary:!0}),u=Fk(s,r.floating);return{data:{escapedOffsets:u,escaped:zk(u)}}}default:return{}}}}},_$=new Set(["left","top"]);async function pie(e,t){const{placement:r,platform:n,elements:i}=e,o=await(n.isRTL==null?void 0:n.isRTL(i.floating)),s=Ri(r),u=ul(r),f=Yn(r)==="y",l=_$.has(s)?-1:1,h=o&&f?-1:1,p=ki(t,e);let{mainAxis:m,crossAxis:g,alignmentAxis:b}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof b=="number"&&(g=u==="end"?b*-1:b),f?{x:g*h,y:m*l}:{x:m*l,y:g*h}}const mie=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:i,y:o,placement:s,middlewareData:u}=t,f=await pie(t,e);return s===((r=u.offset)==null?void 0:r.placement)&&(n=u.arrow)!=null&&n.alignmentOffset?{}:{x:i+f.x,y:o+f.y,data:{...f,placement:s}}}}},vie=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:i,platform:o}=t,{mainAxis:s=!0,crossAxis:u=!1,limiter:f={fn:j=>{let{x:O,y:E}=j;return{x:O,y:E}}},...l}=ki(e,t),h={x:r,y:n},p=await o.detectOverflow(t,l),m=Yn(Ri(i)),g=a_(m);let b=h[g],y=h[m];if(s){const j=g==="y"?"top":"left",O=g==="y"?"bottom":"right",E=b+p[j],A=b-p[O];b=_w(E,b,A)}if(u){const j=m==="y"?"top":"left",O=m==="y"?"bottom":"right",E=y+p[j],A=y-p[O];y=_w(E,y,A)}const w=f.fn({...t,[g]:b,[m]:y});return{...w,data:{x:w.x-r,y:w.y-n,enabled:{[g]:s,[m]:u}}}}}},gie=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:i,rects:o,middlewareData:s}=t,{offset:u=0,mainAxis:f=!0,crossAxis:l=!0}=ki(e,t),h={x:r,y:n},p=Yn(i),m=a_(p);let g=h[m],b=h[p];const y=ki(u,t),w=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(f){const E=m==="y"?"height":"width",A=o.reference[m]-o.floating[E]+w.mainAxis,N=o.reference[m]+o.reference[E]-w.mainAxis;gN&&(g=N)}if(l){var j,O;const E=m==="y"?"width":"height",A=_$.has(Ri(i)),N=o.reference[p]-o.floating[E]+(A&&((j=s.offset)==null?void 0:j[p])||0)+(A?0:w.crossAxis),C=o.reference[p]+o.reference[E]+(A?0:((O=s.offset)==null?void 0:O[p])||0)-(A?w.crossAxis:0);bC&&(b=C)}return{[m]:g,[p]:b}}}},yie=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:i,rects:o,platform:s,elements:u}=t,{apply:f=()=>{},...l}=ki(e,t),h=await s.detectOverflow(t,l),p=Ri(i),m=ul(i),g=Yn(i)==="y",{width:b,height:y}=o.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 O=y-h.top-h.bottom,E=b-h.left-h.right,A=po(y-h[w],O),N=po(b-h[j],E),C=!t.middlewareData.shift;let T=A,R=N;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(R=E),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(T=O),C&&!m){const F=Xr(h.left,0),L=Xr(h.right,0),$=Xr(h.top,0),U=Xr(h.bottom,0);g?R=b-2*(F!==0||L!==0?F+L:Xr(h.left,h.right)):T=y-2*($!==0||U!==0?$+U:Xr(h.top,h.bottom))}await f({...t,availableWidth:R,availableHeight:T});const I=await s.getDimensions(u.floating);return b!==I.width||y!==I.height?{reset:{rects:!0}}:{}}}};function hm(){return typeof window<"u"}function fl(e){return j$(e)?(e.nodeName||"").toLowerCase():"#document"}function Jr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function si(e){var t;return(t=(j$(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function j$(e){return hm()?e instanceof Node||e instanceof Jr(e).Node:!1}function Ln(e){return hm()?e instanceof Element||e instanceof Jr(e).Element:!1}function ni(e){return hm()?e instanceof HTMLElement||e instanceof Jr(e).HTMLElement:!1}function qk(e){return!hm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Jr(e).ShadowRoot}const xie=new Set(["inline","contents"]);function Ou(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=$n(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!xie.has(i)}const bie=new Set(["table","td","th"]);function wie(e){return bie.has(fl(e))}const Sie=[":popover-open",":modal"];function pm(e){return Sie.some(t=>{try{return e.matches(t)}catch{return!1}})}const _ie=["transform","translate","scale","rotate","perspective"],jie=["transform","translate","scale","rotate","perspective","filter"],Oie=["paint","layout","strict","content"];function c_(e){const t=u_(),r=Ln(e)?$n(e):e;return _ie.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)||jie.some(n=>(r.willChange||"").includes(n))||Oie.some(n=>(r.contain||"").includes(n))}function Eie(e){let t=mo(e);for(;ni(t)&&!Xs(t);){if(c_(t))return t;if(pm(t))return null;t=mo(t)}return null}function u_(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Pie=new Set(["html","body","#document"]);function Xs(e){return Pie.has(fl(e))}function $n(e){return Jr(e).getComputedStyle(e)}function mm(e){return Ln(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function mo(e){if(fl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||qk(e)&&e.host||si(e);return qk(t)?t.host:t}function O$(e){const t=mo(e);return Xs(t)?e.ownerDocument?e.ownerDocument.body:e.body:ni(t)&&Ou(t)?t:O$(t)}function uu(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=O$(e),o=i===((n=e.ownerDocument)==null?void 0:n.body),s=Jr(i);if(o){const u=Ow(s);return t.concat(s,s.visualViewport||[],Ou(i)?i:[],u&&r?uu(u):[])}return t.concat(i,uu(i,[],r))}function Ow(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function E$(e){const t=$n(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=ni(e),o=i?e.offsetWidth:r,s=i?e.offsetHeight:n,u=vp(r)!==o||vp(n)!==s;return u&&(r=o,n=s),{width:r,height:n,$:u}}function f_(e){return Ln(e)?e:e.contextElement}function ms(e){const t=f_(e);if(!ni(t))return ei(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:o}=E$(t);let s=(o?vp(r.width):r.width)/n,u=(o?vp(r.height):r.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!u||!Number.isFinite(u))&&(u=1),{x:s,y:u}}const Nie=ei(0);function P$(e){const t=Jr(e);return!u_()||!t.visualViewport?Nie:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Aie(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Jr(e)?!1:t}function la(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),o=f_(e);let s=ei(1);t&&(n?Ln(n)&&(s=ms(n)):s=ms(e));const u=Aie(o,r,n)?P$(o):ei(0);let f=(i.left+u.x)/s.x,l=(i.top+u.y)/s.y,h=i.width/s.x,p=i.height/s.y;if(o){const m=Jr(o),g=n&&Ln(n)?Jr(n):n;let b=m,y=Ow(b);for(;y&&n&&g!==b;){const w=ms(y),j=y.getBoundingClientRect(),O=$n(y),E=j.left+(y.clientLeft+parseFloat(O.paddingLeft))*w.x,A=j.top+(y.clientTop+parseFloat(O.paddingTop))*w.y;f*=w.x,l*=w.y,h*=w.x,p*=w.y,f+=E,l+=A,b=Jr(y),y=Ow(b)}}return yp({width:h,height:p,x:f,y:l})}function vm(e,t){const r=mm(e).scrollLeft;return t?t.left+r:la(si(e)).left+r}function N$(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-vm(e,r),i=r.top+t.scrollTop;return{x:n,y:i}}function Cie(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const o=i==="fixed",s=si(n),u=t?pm(t.floating):!1;if(n===s||u&&o)return r;let f={scrollLeft:0,scrollTop:0},l=ei(1);const h=ei(0),p=ni(n);if((p||!p&&!o)&&((fl(n)!=="body"||Ou(s))&&(f=mm(n)),ni(n))){const g=la(n);l=ms(n),h.x=g.x+n.clientLeft,h.y=g.y+n.clientTop}const m=s&&!p&&!o?N$(s,f):ei(0);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-f.scrollLeft*l.x+h.x+m.x,y:r.y*l.y-f.scrollTop*l.y+h.y+m.y}}function Tie(e){return Array.from(e.getClientRects())}function kie(e){const t=si(e),r=mm(e),n=e.ownerDocument.body,i=Xr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=Xr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-r.scrollLeft+vm(e);const u=-r.scrollTop;return $n(n).direction==="rtl"&&(s+=Xr(t.clientWidth,n.clientWidth)-i),{width:i,height:o,x:s,y:u}}const Uk=25;function Rie(e,t){const r=Jr(e),n=si(e),i=r.visualViewport;let o=n.clientWidth,s=n.clientHeight,u=0,f=0;if(i){o=i.width,s=i.height;const h=u_();(!h||h&&t==="fixed")&&(u=i.offsetLeft,f=i.offsetTop)}const l=vm(n);if(l<=0){const h=n.ownerDocument,p=h.body,m=getComputedStyle(p),g=h.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,b=Math.abs(n.clientWidth-p.clientWidth-g);b<=Uk&&(o-=b)}else l<=Uk&&(o+=l);return{width:o,height:s,x:u,y:f}}const Mie=new Set(["absolute","fixed"]);function Iie(e,t){const r=la(e,!0,t==="fixed"),n=r.top+e.clientTop,i=r.left+e.clientLeft,o=ni(e)?ms(e):ei(1),s=e.clientWidth*o.x,u=e.clientHeight*o.y,f=i*o.x,l=n*o.y;return{width:s,height:u,x:f,y:l}}function Wk(e,t,r){let n;if(t==="viewport")n=Rie(e,r);else if(t==="document")n=kie(si(e));else if(Ln(t))n=Iie(t,r);else{const i=P$(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return yp(n)}function A$(e,t){const r=mo(e);return r===t||!Ln(r)||Xs(r)?!1:$n(r).position==="fixed"||A$(r,t)}function Die(e,t){const r=t.get(e);if(r)return r;let n=uu(e,[],!1).filter(u=>Ln(u)&&fl(u)!=="body"),i=null;const o=$n(e).position==="fixed";let s=o?mo(e):e;for(;Ln(s)&&!Xs(s);){const u=$n(s),f=c_(s);!f&&u.position==="fixed"&&(i=null),(o?!f&&!i:!f&&u.position==="static"&&!!i&&Mie.has(i.position)||Ou(s)&&!f&&A$(e,s))?n=n.filter(h=>h!==s):i=u,s=mo(s)}return t.set(e,n),n}function Lie(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const s=[...r==="clippingAncestors"?pm(t)?[]:Die(t,this._c):[].concat(r),n],u=s[0],f=s.reduce((l,h)=>{const p=Wk(t,h,i);return l.top=Xr(p.top,l.top),l.right=po(p.right,l.right),l.bottom=po(p.bottom,l.bottom),l.left=Xr(p.left,l.left),l},Wk(t,u,i));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function $ie(e){const{width:t,height:r}=E$(e);return{width:t,height:r}}function Bie(e,t,r){const n=ni(t),i=si(t),o=r==="fixed",s=la(e,!0,o,t);let u={scrollLeft:0,scrollTop:0};const f=ei(0);function l(){f.x=vm(i)}if(n||!n&&!o)if((fl(t)!=="body"||Ou(i))&&(u=mm(t)),n){const g=la(t,!0,o,t);f.x=g.x+t.clientLeft,f.y=g.y+t.clientTop}else i&&l();o&&!n&&i&&l();const h=i&&!n&&!o?N$(i,u):ei(0),p=s.left+u.scrollLeft-f.x-h.x,m=s.top+u.scrollTop-f.y-h.y;return{x:p,y:m,width:s.width,height:s.height}}function Fb(e){return $n(e).position==="static"}function Hk(e,t){if(!ni(e)||$n(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return si(e)===r&&(r=r.ownerDocument.body),r}function C$(e,t){const r=Jr(e);if(pm(e))return r;if(!ni(e)){let i=mo(e);for(;i&&!Xs(i);){if(Ln(i)&&!Fb(i))return i;i=mo(i)}return r}let n=Hk(e,t);for(;n&&wie(n)&&Fb(n);)n=Hk(n,t);return n&&Xs(n)&&Fb(n)&&!c_(n)?r:n||Eie(e)||r}const Fie=async function(e){const t=this.getOffsetParent||C$,r=this.getDimensions,n=await r(e.floating);return{reference:Bie(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function zie(e){return $n(e).direction==="rtl"}const qie={convertOffsetParentRelativeRectToViewportRelativeRect:Cie,getDocumentElement:si,getClippingRect:Lie,getOffsetParent:C$,getElementRects:Fie,getClientRects:Tie,getDimensions:$ie,getScale:ms,isElement:Ln,isRTL:zie};function T$(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Uie(e,t){let r=null,n;const i=si(e);function o(){var u;clearTimeout(n),(u=r)==null||u.disconnect(),r=null}function s(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),o();const l=e.getBoundingClientRect(),{left:h,top:p,width:m,height:g}=l;if(u||t(),!m||!g)return;const b=hd(p),y=hd(i.clientWidth-(h+m)),w=hd(i.clientHeight-(p+g)),j=hd(h),E={rootMargin:-b+"px "+-y+"px "+-w+"px "+-j+"px",threshold:Xr(0,po(1,f))||1};let A=!0;function N(C){const T=C[0].intersectionRatio;if(T!==f){if(!A)return s();T?s(!1,T):n=setTimeout(()=>{s(!1,1e-7)},1e3)}T===1&&!T$(l,e.getBoundingClientRect())&&s(),A=!1}try{r=new IntersectionObserver(N,{...E,root:i.ownerDocument})}catch{r=new IntersectionObserver(N,E)}r.observe(e)}return s(!0),o}function Wie(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:f=!1}=n,l=f_(e),h=i||o?[...l?uu(l):[],...uu(t)]:[];h.forEach(j=>{i&&j.addEventListener("scroll",r,{passive:!0}),o&&j.addEventListener("resize",r)});const p=l&&u?Uie(l,r):null;let m=-1,g=null;s&&(g=new ResizeObserver(j=>{let[O]=j;O&&O.target===l&&g&&(g.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var E;(E=g)==null||E.observe(t)})),r()}),l&&!f&&g.observe(l),g.observe(t));let b,y=f?la(e):null;f&&w();function w(){const j=la(e);y&&!T$(y,j)&&r(),y=j,b=requestAnimationFrame(w)}return r(),()=>{var j;h.forEach(O=>{i&&O.removeEventListener("scroll",r),o&&O.removeEventListener("resize",r)}),p?.(),(j=g)==null||j.disconnect(),g=null,f&&cancelAnimationFrame(b)}}const Hie=mie,Vie=vie,Gie=die,Kie=yie,Xie=hie,Vk=fie,Yie=gie,Qie=(e,t,r)=>{const n=new Map,i={platform:qie,...r},o={...i.platform,_c:n};return uie(e,t,{...i,platform:o})};var Zie=typeof document<"u",Jie=function(){},rh=Zie?S.useLayoutEffect:Jie;function xp(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,i;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(!xp(e[n],t[n]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,i[n]))return!1;for(n=r;n--!==0;){const o=i[n];if(!(o==="_owner"&&e.$$typeof)&&!xp(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function k$(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Gk(e,t){const r=k$(e);return Math.round(t*r)/r}function zb(e){const t=S.useRef(e);return rh(()=>{t.current=e}),t}function eoe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:o,floating:s}={},transform:u=!0,whileElementsMounted:f,open:l}=e,[h,p]=S.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,g]=S.useState(n);xp(m,n)||g(n);const[b,y]=S.useState(null),[w,j]=S.useState(null),O=S.useCallback(D=>{D!==C.current&&(C.current=D,y(D))},[]),E=S.useCallback(D=>{D!==T.current&&(T.current=D,j(D))},[]),A=o||b,N=s||w,C=S.useRef(null),T=S.useRef(null),R=S.useRef(h),I=f!=null,F=zb(f),L=zb(i),$=zb(l),U=S.useCallback(()=>{if(!C.current||!T.current)return;const D={placement:t,strategy:r,middleware:m};L.current&&(D.platform=L.current),Qie(C.current,T.current,D).then(Z=>{const J={...Z,isPositioned:$.current!==!1};G.current&&!xp(R.current,J)&&(R.current=J,pu.flushSync(()=>{p(J)}))})},[m,t,r,L,$]);rh(()=>{l===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,p(D=>({...D,isPositioned:!1})))},[l]);const G=S.useRef(!1);rh(()=>(G.current=!0,()=>{G.current=!1}),[]),rh(()=>{if(A&&(C.current=A),N&&(T.current=N),A&&N){if(F.current)return F.current(A,N,U);U()}},[A,N,U,F,I]);const q=S.useMemo(()=>({reference:C,floating:T,setReference:O,setFloating:E}),[O,E]),H=S.useMemo(()=>({reference:A,floating:N}),[A,N]),V=S.useMemo(()=>{const D={position:r,left:0,top:0};if(!H.floating)return D;const Z=Gk(H.floating,h.x),J=Gk(H.floating,h.y);return u?{...D,transform:"translate("+Z+"px, "+J+"px)",...k$(H.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:Z,top:J}},[r,u,H.floating,h.x,h.y]);return S.useMemo(()=>({...h,update:U,refs:q,elements:H,floatingStyles:V}),[h,U,q,H,V])}const toe=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:i}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?Vk({element:n.current,padding:i}).fn(r):{}:n?Vk({element:n,padding:i}).fn(r):{}}}},roe=(e,t)=>({...Hie(e),options:[e,t]}),noe=(e,t)=>({...Vie(e),options:[e,t]}),ioe=(e,t)=>({...Yie(e),options:[e,t]}),ooe=(e,t)=>({...Gie(e),options:[e,t]}),aoe=(e,t)=>({...Kie(e),options:[e,t]}),soe=(e,t)=>({...Xie(e),options:[e,t]}),loe=(e,t)=>({...toe(e),options:[e,t]});var coe="Arrow",R$=S.forwardRef((e,t)=>{const{children:r,width:n=10,height:i=5,...o}=e;return d.jsx(Ue.svg,{...o,ref:t,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});R$.displayName=coe;var uoe=R$;function d_(e){const[t,r]=S.useState(void 0);return Lt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,u;if("borderBoxSize"in o){const f=o.borderBoxSize,l=Array.isArray(f)?f[0]:f;s=l.inlineSize,u=l.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 h_="Popper",[M$,dl]=Bn(h_),[foe,I$]=M$(h_),D$=e=>{const{__scopePopper:t,children:r}=e,[n,i]=S.useState(null);return d.jsx(foe,{scope:t,anchor:n,onAnchorChange:i,children:r})};D$.displayName=h_;var L$="PopperAnchor",$$=S.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...i}=e,o=I$(L$,r),s=S.useRef(null),u=Ze(t,s),f=S.useRef(null);return S.useEffect(()=>{const l=f.current;f.current=n?.current||s.current,l!==f.current&&o.onAnchorChange(f.current)}),n?null:d.jsx(Ue.div,{...i,ref:u})});$$.displayName=L$;var p_="PopperContent",[doe,hoe]=M$(p_),B$=S.forwardRef((e,t)=>{const{__scopePopper:r,side:n="bottom",sideOffset:i=0,align:o="center",alignOffset:s=0,arrowPadding:u=0,avoidCollisions:f=!0,collisionBoundary:l=[],collisionPadding:h=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:b,...y}=e,w=I$(p_,r),[j,O]=S.useState(null),E=Ze(t,K=>O(K)),[A,N]=S.useState(null),C=d_(A),T=C?.width??0,R=C?.height??0,I=n+(o!=="center"?"-"+o:""),F=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},L=Array.isArray(l)?l:[l],$=L.length>0,U={padding:F,boundary:L.filter(moe),altBoundary:$},{refs:G,floatingStyles:q,placement:H,isPositioned:V,middlewareData:D}=eoe({strategy:"fixed",placement:I,whileElementsMounted:(...K)=>Wie(...K,{animationFrame:g==="always"}),elements:{reference:w.anchor},middleware:[roe({mainAxis:i+R,alignmentAxis:s}),f&&noe({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?ioe():void 0,...U}),f&&ooe({...U}),aoe({...U,apply:({elements:K,rects:ce,availableWidth:te,availableHeight:le})=>{const{width:ge,height:Y}=ce.reference,_e=K.floating.style;_e.setProperty("--radix-popper-available-width",`${te}px`),_e.setProperty("--radix-popper-available-height",`${le}px`),_e.setProperty("--radix-popper-anchor-width",`${ge}px`),_e.setProperty("--radix-popper-anchor-height",`${Y}px`)}}),A&&loe({element:A,padding:u}),voe({arrowWidth:T,arrowHeight:R}),m&&soe({strategy:"referenceHidden",...U})]}),[Z,J]=q$(H),M=fr(b);Lt(()=>{V&&M?.()},[V,M]);const B=D.arrow?.x,ee=D.arrow?.y,ae=D.arrow?.centerOffset!==0,[ie,fe]=S.useState();return Lt(()=>{j&&fe(window.getComputedStyle(j).zIndex)},[j]),d.jsx("div",{ref:G.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:V?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[D.transformOrigin?.x,D.transformOrigin?.y].join(" "),...D.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(doe,{scope:r,placedSide:Z,onArrowChange:N,arrowX:B,arrowY:ee,shouldHideArrow:ae,children:d.jsx(Ue.div,{"data-side":Z,"data-align":J,...y,ref:E,style:{...y.style,animation:V?void 0:"none"}})})})});B$.displayName=p_;var F$="PopperArrow",poe={top:"bottom",right:"left",bottom:"top",left:"right"},z$=S.forwardRef(function(t,r){const{__scopePopper:n,...i}=t,o=hoe(F$,n),s=poe[o.placedSide];return d.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:d.jsx(uoe,{...i,ref:r,style:{...i.style,display:"block"}})})});z$.displayName=F$;function moe(e){return e!==null}var voe=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:i}=t,s=i.arrow?.centerOffset!==0,u=s?0:e.arrowWidth,f=s?0:e.arrowHeight,[l,h]=q$(r),p={start:"0%",center:"50%",end:"100%"}[h],m=(i.arrow?.x??0)+u/2,g=(i.arrow?.y??0)+f/2;let b="",y="";return l==="bottom"?(b=s?p:`${m}px`,y=`${-f}px`):l==="top"?(b=s?p:`${m}px`,y=`${n.floating.height+f}px`):l==="right"?(b=`${-f}px`,y=s?p:`${g}px`):l==="left"&&(b=`${n.floating.width+f}px`,y=s?p:`${g}px`),{data:{x:b,y}}}});function q$(e){const[t,r="center"]=e.split("-");return[t,r]}var m_=D$,gm=$$,v_=B$,g_=z$,goe="Portal",Eu=S.forwardRef((e,t)=>{const{container:r,...n}=e,[i,o]=S.useState(!1);Lt(()=>o(!0),[]);const s=r||i&&globalThis?.document?.body;return s?$6.createPortal(d.jsx(Ue.div,{...n,ref:t}),s):null});Eu.displayName=goe;function yoe(e){const t=xoe(e),r=S.forwardRef((n,i)=>{const{children:o,...s}=n,u=S.Children.toArray(o),f=u.find(woe);if(f){const l=f.props.children,h=u.map(p=>p===f?S.Children.count(l)>1?S.Children.only(null):S.isValidElement(l)?l.props.children:null:p);return d.jsx(t,{...s,ref:i,children:S.isValidElement(l)?S.cloneElement(l,void 0,h):null})}return d.jsx(t,{...s,ref:i,children:o})});return r.displayName=`${e}.Slot`,r}function xoe(e){const t=S.forwardRef((r,n)=>{const{children:i,...o}=r;if(S.isValidElement(i)){const s=_oe(i),u=Soe(o,i.props);return i.type!==S.Fragment&&(u.ref=n?ha(n,s):s),S.cloneElement(i,u)}return S.Children.count(i)>1?S.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var boe=Symbol("radix.slottable");function woe(e){return S.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===boe}function Soe(e,t){const r={...t};for(const n in t){const i=e[n],o=t[n];/^on[A-Z]/.test(n)?i&&o?r[n]=(...u)=>{const f=o(...u);return i(...u),f}:i&&(r[n]=i):n==="style"?r[n]={...i,...o}:n==="className"&&(r[n]=[i,o].filter(Boolean).join(" "))}return{...e,...r}}function _oe(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 joe=Uw[" useInsertionEffect ".trim().toString()]||Lt;function Mi({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[i,o,s]=Ooe({defaultProp:t,onChange:r}),u=e!==void 0,f=u?e:i;{const h=S.useRef(e!==void 0);S.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 l=S.useCallback(h=>{if(u){const p=Eoe(h)?h(e):h;p!==e&&s.current?.(p)}else o(h)},[u,e,o,s]);return[f,l]}function Ooe({defaultProp:e,onChange:t}){const[r,n]=S.useState(e),i=S.useRef(r),o=S.useRef(t);return joe(()=>{o.current=t},[t]),S.useEffect(()=>{i.current!==r&&(o.current?.(r),i.current=r)},[r,i]),[r,n,o]}function Eoe(e){return typeof e=="function"}function y_(e){const t=S.useRef({value:e,previous:e});return S.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var U$=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"}),Poe="VisuallyHidden",W$=S.forwardRef((e,t)=>d.jsx(Ue.span,{...e,ref:t,style:{...U$,...e.style}}));W$.displayName=Poe;var Noe=W$,Aoe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Za=new WeakMap,pd=new WeakMap,md={},qb=0,H$=function(e){return e&&(e.host||H$(e.parentNode))},Coe=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=H$(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})},Toe=function(e,t,r,n){var i=Coe(t,Array.isArray(e)?e:[e]);md[r]||(md[r]=new WeakMap);var o=md[r],s=[],u=new Set,f=new Set(i),l=function(p){!p||u.has(p)||(u.add(p),l(p.parentNode))};i.forEach(l);var h=function(p){!p||f.has(p)||Array.prototype.forEach.call(p.children,function(m){if(u.has(m))h(m);else try{var g=m.getAttribute(n),b=g!==null&&g!=="false",y=(Za.get(m)||0)+1,w=(o.get(m)||0)+1;Za.set(m,y),o.set(m,w),s.push(m),y===1&&b&&pd.set(m,!0),w===1&&m.setAttribute(r,"true"),b||m.setAttribute(n,"true")}catch(j){console.error("aria-hidden: cannot operate on ",m,j)}})};return h(t),u.clear(),qb++,function(){s.forEach(function(p){var m=Za.get(p)-1,g=o.get(p)-1;Za.set(p,m),o.set(p,g),m||(pd.has(p)||p.removeAttribute(n),pd.delete(p)),g||p.removeAttribute(r)}),qb--,qb||(Za=new WeakMap,Za=new WeakMap,pd=new WeakMap,md={})}},x_=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=Aoe(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),Toe(n,i,r,"aria-hidden")):function(){return null}},Kn=function(){return Kn=Object.assign||function(t){for(var r,n=1,i=arguments.length;n"u")return Koe;var t=Xoe(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])}},Qoe=X$(),vs="data-scroll-locked",Zoe=function(e,t,r,n){var i=e.left,o=e.top,s=e.right,u=e.gap;return r===void 0&&(r="margin"),` - .`.concat(Roe,` { - overflow: hidden `).concat(n,`; - padding-right: `).concat(u,"px ").concat(n,`; - } - body[`).concat(vs,`] { - overflow: hidden `).concat(n,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&` - padding-left: `.concat(i,`px; - padding-top: `).concat(o,`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(nh,` { - right: `).concat(u,"px ").concat(n,`; - } - - .`).concat(ih,` { - margin-right: `).concat(u,"px ").concat(n,`; - } - - .`).concat(nh," .").concat(nh,` { - right: 0 `).concat(n,`; - } - - .`).concat(ih," .").concat(ih,` { - margin-right: 0 `).concat(n,`; - } - - body[`).concat(vs,`] { - `).concat(Moe,": ").concat(u,`px; - } -`)},Xk=function(){var e=parseInt(document.body.getAttribute(vs)||"0",10);return isFinite(e)?e:0},Joe=function(){S.useEffect(function(){return document.body.setAttribute(vs,(Xk()+1).toString()),function(){var e=Xk()-1;e<=0?document.body.removeAttribute(vs):document.body.setAttribute(vs,e.toString())}},[])},eae=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;Joe();var o=S.useMemo(function(){return Yoe(i)},[i]);return S.createElement(Qoe,{styles:Zoe(o,!t,i,r?"":"!important")})},Ew=!1;if(typeof window<"u")try{var vd=Object.defineProperty({},"passive",{get:function(){return Ew=!0,!0}});window.addEventListener("test",vd,vd),window.removeEventListener("test",vd,vd)}catch{Ew=!1}var Ja=Ew?{passive:!1}:!1,tae=function(e){return e.tagName==="TEXTAREA"},Y$=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!tae(e)&&r[t]==="visible")},rae=function(e){return Y$(e,"overflowY")},nae=function(e){return Y$(e,"overflowX")},Yk=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=Q$(e,n);if(i){var o=Z$(e,n),s=o[1],u=o[2];if(s>u)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},iae=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},oae=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Q$=function(e,t){return e==="v"?rae(t):nae(t)},Z$=function(e,t){return e==="v"?iae(t):oae(t)},aae=function(e,t){return e==="h"&&t==="rtl"?-1:1},sae=function(e,t,r,n,i){var o=aae(e,window.getComputedStyle(t).direction),s=o*n,u=r.target,f=t.contains(u),l=!1,h=s>0,p=0,m=0;do{if(!u)break;var g=Z$(e,u),b=g[0],y=g[1],w=g[2],j=y-w-o*b;(b||j)&&Q$(e,u)&&(p+=j,m+=b);var O=u.parentNode;u=O&&O.nodeType===Node.DOCUMENT_FRAGMENT_NODE?O.host:O}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(h&&Math.abs(p)<1||!h&&Math.abs(m)<1)&&(l=!0),l},gd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Qk=function(e){return[e.deltaX,e.deltaY]},Zk=function(e){return e&&"current"in e?e.current:e},lae=function(e,t){return e[0]===t[0]&&e[1]===t[1]},cae=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},uae=0,es=[];function fae(e){var t=S.useRef([]),r=S.useRef([0,0]),n=S.useRef(),i=S.useState(uae++)[0],o=S.useState(X$)[0],s=S.useRef(e);S.useEffect(function(){s.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var y=koe([e.lockRef.current],(e.shards||[]).map(Zk),!0).filter(Boolean);return y.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),y.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var u=S.useCallback(function(y,w){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!s.current.allowPinchZoom;var j=gd(y),O=r.current,E="deltaX"in y?y.deltaX:O[0]-j[0],A="deltaY"in y?y.deltaY:O[1]-j[1],N,C=y.target,T=Math.abs(E)>Math.abs(A)?"h":"v";if("touches"in y&&T==="h"&&C.type==="range")return!1;var R=window.getSelection(),I=R&&R.anchorNode,F=I?I===C||I.contains(C):!1;if(F)return!1;var L=Yk(T,C);if(!L)return!0;if(L?N=T:(N=T==="v"?"h":"v",L=Yk(T,C)),!L)return!1;if(!n.current&&"changedTouches"in y&&(E||A)&&(n.current=N),!N)return!0;var $=n.current||N;return sae($,w,y,$==="h"?E:A)},[]),f=S.useCallback(function(y){var w=y;if(!(!es.length||es[es.length-1]!==o)){var j="deltaY"in w?Qk(w):gd(w),O=t.current.filter(function(N){return N.name===w.type&&(N.target===w.target||w.target===N.shadowParent)&&lae(N.delta,j)})[0];if(O&&O.should){w.cancelable&&w.preventDefault();return}if(!O){var E=(s.current.shards||[]).map(Zk).filter(Boolean).filter(function(N){return N.contains(w.target)}),A=E.length>0?u(w,E[0]):!s.current.noIsolation;A&&w.cancelable&&w.preventDefault()}}},[]),l=S.useCallback(function(y,w,j,O){var E={name:y,delta:w,target:j,should:O,shadowParent:dae(j)};t.current.push(E),setTimeout(function(){t.current=t.current.filter(function(A){return A!==E})},1)},[]),h=S.useCallback(function(y){r.current=gd(y),n.current=void 0},[]),p=S.useCallback(function(y){l(y.type,Qk(y),y.target,u(y,e.lockRef.current))},[]),m=S.useCallback(function(y){l(y.type,gd(y),y.target,u(y,e.lockRef.current))},[]);S.useEffect(function(){return es.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",f,Ja),document.addEventListener("touchmove",f,Ja),document.addEventListener("touchstart",h,Ja),function(){es=es.filter(function(y){return y!==o}),document.removeEventListener("wheel",f,Ja),document.removeEventListener("touchmove",f,Ja),document.removeEventListener("touchstart",h,Ja)}},[]);var g=e.removeScrollBar,b=e.inert;return S.createElement(S.Fragment,null,b?S.createElement(o,{styles:cae(i)}):null,g?S.createElement(eae,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function dae(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const hae=zoe(K$,fae);var xm=S.forwardRef(function(e,t){return S.createElement(ym,Kn({},e,{ref:t,sideCar:hae}))});xm.classNames=ym.classNames;var pae=[" ","Enter","ArrowUp","ArrowDown"],mae=[" ","Enter"],ca="Select",[bm,wm,vae]=y$(ca),[hl]=Bn(ca,[vae,dl]),Sm=dl(),[gae,bo]=hl(ca),[yae,xae]=hl(ca),J$=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:i,onOpenChange:o,value:s,defaultValue:u,onValueChange:f,dir:l,name:h,autoComplete:p,disabled:m,required:g,form:b}=e,y=Sm(t),[w,j]=S.useState(null),[O,E]=S.useState(null),[A,N]=S.useState(!1),C=Ep(l),[T,R]=Mi({prop:n,defaultProp:i??!1,onChange:o,caller:ca}),[I,F]=Mi({prop:s,defaultProp:u,onChange:f,caller:ca}),L=S.useRef(null),$=w?b||!!w.closest("form"):!0,[U,G]=S.useState(new Set),q=Array.from(U).map(H=>H.props.value).join(";");return d.jsx(m_,{...y,children:d.jsxs(gae,{required:g,scope:t,trigger:w,onTriggerChange:j,valueNode:O,onValueNodeChange:E,valueNodeHasChildren:A,onValueNodeHasChildrenChange:N,contentId:Jn(),value:I,onValueChange:F,open:T,onOpenChange:R,dir:C,triggerPointerDownPosRef:L,disabled:m,children:[d.jsx(bm.Provider,{scope:t,children:d.jsx(yae,{scope:e.__scopeSelect,onNativeOptionAdd:S.useCallback(H=>{G(V=>new Set(V).add(H))},[]),onNativeOptionRemove:S.useCallback(H=>{G(V=>{const D=new Set(V);return D.delete(H),D})},[]),children:r})}),$?d.jsxs(w3,{"aria-hidden":!0,required:g,tabIndex:-1,name:h,autoComplete:p,value:I,onChange:H=>F(H.target.value),disabled:m,form:b,children:[I===void 0?d.jsx("option",{value:""}):null,Array.from(U)]},q):null]})})};J$.displayName=ca;var e3="SelectTrigger",t3=S.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...i}=e,o=Sm(r),s=bo(e3,r),u=s.disabled||n,f=Ze(t,s.onTriggerChange),l=wm(r),h=S.useRef("touch"),[p,m,g]=_3(y=>{const w=l().filter(E=>!E.disabled),j=w.find(E=>E.value===s.value),O=j3(w,y,j);O!==void 0&&s.onValueChange(O.value)}),b=y=>{u||(s.onOpenChange(!0),g()),y&&(s.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)})};return d.jsx(gm,{asChild:!0,...o,children:d.jsx(Ue.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":S3(s.value)?"":void 0,...i,ref:f,onClick:Ie(i.onClick,y=>{y.currentTarget.focus(),h.current!=="mouse"&&b(y)}),onPointerDown:Ie(i.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"&&(b(y),y.preventDefault())}),onKeyDown:Ie(i.onKeyDown,y=>{const w=p.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&m(y.key),!(w&&y.key===" ")&&pae.includes(y.key)&&(b(),y.preventDefault())})})})});t3.displayName=e3;var r3="SelectValue",n3=S.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:i,children:o,placeholder:s="",...u}=e,f=bo(r3,r),{onValueNodeHasChildrenChange:l}=f,h=o!==void 0,p=Ze(t,f.onValueNodeChange);return Lt(()=>{l(h)},[l,h]),d.jsx(Ue.span,{...u,ref:p,style:{pointerEvents:"none"},children:S3(f.value)?d.jsx(d.Fragment,{children:s}):o})});n3.displayName=r3;var bae="SelectIcon",i3=S.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...i}=e;return d.jsx(Ue.span,{"aria-hidden":!0,...i,ref:t,children:n||"▼"})});i3.displayName=bae;var wae="SelectPortal",o3=e=>d.jsx(Eu,{asChild:!0,...e});o3.displayName=wae;var ua="SelectContent",a3=S.forwardRef((e,t)=>{const r=bo(ua,e.__scopeSelect),[n,i]=S.useState();if(Lt(()=>{i(new DocumentFragment)},[]),!r.open){const o=n;return o?pu.createPortal(d.jsx(s3,{scope:e.__scopeSelect,children:d.jsx(bm.Slot,{scope:e.__scopeSelect,children:d.jsx("div",{children:e.children})})}),o):null}return d.jsx(l3,{...e,ref:t})});a3.displayName=ua;var Cn=10,[s3,wo]=hl(ua),Sae="SelectContentImpl",_ae=yoe("SelectContent.RemoveScroll"),l3=S.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:u,sideOffset:f,align:l,alignOffset:h,arrowPadding:p,collisionBoundary:m,collisionPadding:g,sticky:b,hideWhenDetached:y,avoidCollisions:w,...j}=e,O=bo(ua,r),[E,A]=S.useState(null),[N,C]=S.useState(null),T=Ze(t,K=>A(K)),[R,I]=S.useState(null),[F,L]=S.useState(null),$=wm(r),[U,G]=S.useState(!1),q=S.useRef(!1);S.useEffect(()=>{if(E)return x_(E)},[E]),o_();const H=S.useCallback(K=>{const[ce,...te]=$().map(Y=>Y.ref.current),[le]=te.slice(-1),ge=document.activeElement;for(const Y of K)if(Y===ge||(Y?.scrollIntoView({block:"nearest"}),Y===ce&&N&&(N.scrollTop=0),Y===le&&N&&(N.scrollTop=N.scrollHeight),Y?.focus(),document.activeElement!==ge))return},[$,N]),V=S.useCallback(()=>H([R,E]),[H,R,E]);S.useEffect(()=>{U&&V()},[U,V]);const{onOpenChange:D,triggerPointerDownPosRef:Z}=O;S.useEffect(()=>{if(E){let K={x:0,y:0};const ce=le=>{K={x:Math.abs(Math.round(le.pageX)-(Z.current?.x??0)),y:Math.abs(Math.round(le.pageY)-(Z.current?.y??0))}},te=le=>{K.x<=10&&K.y<=10?le.preventDefault():E.contains(le.target)||D(!1),document.removeEventListener("pointermove",ce),Z.current=null};return Z.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",te,{capture:!0})}}},[E,D,Z]),S.useEffect(()=>{const K=()=>D(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[D]);const[J,M]=_3(K=>{const ce=$().filter(ge=>!ge.disabled),te=ce.find(ge=>ge.ref.current===document.activeElement),le=j3(ce,K,te);le&&setTimeout(()=>le.ref.current.focus())}),B=S.useCallback((K,ce,te)=>{const le=!q.current&&!te;(O.value!==void 0&&O.value===ce||le)&&(I(K),le&&(q.current=!0))},[O.value]),ee=S.useCallback(()=>E?.focus(),[E]),ae=S.useCallback((K,ce,te)=>{const le=!q.current&&!te;(O.value!==void 0&&O.value===ce||le)&&L(K)},[O.value]),ie=n==="popper"?Pw:c3,fe=ie===Pw?{side:u,sideOffset:f,align:l,alignOffset:h,arrowPadding:p,collisionBoundary:m,collisionPadding:g,sticky:b,hideWhenDetached:y,avoidCollisions:w}:{};return d.jsx(s3,{scope:r,content:E,viewport:N,onViewportChange:C,itemRefCallback:B,selectedItem:R,onItemLeave:ee,itemTextRefCallback:ae,focusSelectedItem:V,selectedItemText:F,position:n,isPositioned:U,searchRef:J,children:d.jsx(xm,{as:_ae,allowPinchZoom:!0,children:d.jsx(dm,{asChild:!0,trapped:O.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:Ie(i,K=>{O.trigger?.focus({preventScroll:!0}),K.preventDefault()}),children:d.jsx(ju,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>O.onOpenChange(!1),children:d.jsx(ie,{role:"listbox",id:O.contentId,"data-state":O.open?"open":"closed",dir:O.dir,onContextMenu:K=>K.preventDefault(),...j,...fe,onPlaced:()=>G(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...j.style},onKeyDown:Ie(j.onKeyDown,K=>{const ce=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!ce&&K.key.length===1&&M(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let le=$().filter(ge=>!ge.disabled).map(ge=>ge.ref.current);if(["ArrowUp","End"].includes(K.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const ge=K.target,Y=le.indexOf(ge);le=le.slice(Y+1)}setTimeout(()=>H(le)),K.preventDefault()}})})})})})})});l3.displayName=Sae;var jae="SelectItemAlignedPosition",c3=S.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...i}=e,o=bo(ua,r),s=wo(ua,r),[u,f]=S.useState(null),[l,h]=S.useState(null),p=Ze(t,T=>h(T)),m=wm(r),g=S.useRef(!1),b=S.useRef(!0),{viewport:y,selectedItem:w,selectedItemText:j,focusSelectedItem:O}=s,E=S.useCallback(()=>{if(o.trigger&&o.valueNode&&u&&l&&y&&w&&j){const T=o.trigger.getBoundingClientRect(),R=l.getBoundingClientRect(),I=o.valueNode.getBoundingClientRect(),F=j.getBoundingClientRect();if(o.dir!=="rtl"){const ge=F.left-R.left,Y=I.left-ge,_e=T.left-Y,Oe=T.width+_e,Ve=Math.max(Oe,R.width),nt=window.innerWidth-Cn,lt=e1(Y,[Cn,Math.max(Cn,nt-Ve)]);u.style.minWidth=Oe+"px",u.style.left=lt+"px"}else{const ge=R.right-F.right,Y=window.innerWidth-I.right-ge,_e=window.innerWidth-T.right-Y,Oe=T.width+_e,Ve=Math.max(Oe,R.width),nt=window.innerWidth-Cn,lt=e1(Y,[Cn,Math.max(Cn,nt-Ve)]);u.style.minWidth=Oe+"px",u.style.right=lt+"px"}const L=m(),$=window.innerHeight-Cn*2,U=y.scrollHeight,G=window.getComputedStyle(l),q=parseInt(G.borderTopWidth,10),H=parseInt(G.paddingTop,10),V=parseInt(G.borderBottomWidth,10),D=parseInt(G.paddingBottom,10),Z=q+H+U+D+V,J=Math.min(w.offsetHeight*5,Z),M=window.getComputedStyle(y),B=parseInt(M.paddingTop,10),ee=parseInt(M.paddingBottom,10),ae=T.top+T.height/2-Cn,ie=$-ae,fe=w.offsetHeight/2,K=w.offsetTop+fe,ce=q+H+K,te=Z-ce;if(ce<=ae){const ge=L.length>0&&w===L[L.length-1].ref.current;u.style.bottom="0px";const Y=l.clientHeight-y.offsetTop-y.offsetHeight,_e=Math.max(ie,fe+(ge?ee:0)+Y+V),Oe=ce+_e;u.style.height=Oe+"px"}else{const ge=L.length>0&&w===L[0].ref.current;u.style.top="0px";const _e=Math.max(ae,q+y.offsetTop+(ge?B:0)+fe)+te;u.style.height=_e+"px",y.scrollTop=ce-ae+y.offsetTop}u.style.margin=`${Cn}px 0`,u.style.minHeight=J+"px",u.style.maxHeight=$+"px",n?.(),requestAnimationFrame(()=>g.current=!0)}},[m,o.trigger,o.valueNode,u,l,y,w,j,o.dir,n]);Lt(()=>E(),[E]);const[A,N]=S.useState();Lt(()=>{l&&N(window.getComputedStyle(l).zIndex)},[l]);const C=S.useCallback(T=>{T&&b.current===!0&&(E(),O?.(),b.current=!1)},[E,O]);return d.jsx(Eae,{scope:r,contentWrapper:u,shouldExpandOnScrollRef:g,onScrollButtonChange:C,children:d.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:A},children:d.jsx(Ue.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});c3.displayName=jae;var Oae="SelectPopperPosition",Pw=S.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:i=Cn,...o}=e,s=Sm(r);return d.jsx(v_,{...s,...o,ref:t,align:n,collisionPadding:i,style:{boxSizing:"border-box",...o.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)"}})});Pw.displayName=Oae;var[Eae,b_]=hl(ua,{}),Nw="SelectViewport",u3=S.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...i}=e,o=wo(Nw,r),s=b_(Nw,r),u=Ze(t,o.onViewportChange),f=S.useRef(0);return d.jsxs(d.Fragment,{children:[d.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}),d.jsx(bm.Slot,{scope:r,children:d.jsx(Ue.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Ie(i.onScroll,l=>{const h=l.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=s;if(m?.current&&p){const g=Math.abs(f.current-h.scrollTop);if(g>0){const b=window.innerHeight-Cn*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")}}}f.current=h.scrollTop})})})]})});u3.displayName=Nw;var f3="SelectGroup",[Pae,Nae]=hl(f3),Aae=S.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,i=Jn();return d.jsx(Pae,{scope:r,id:i,children:d.jsx(Ue.div,{role:"group","aria-labelledby":i,...n,ref:t})})});Aae.displayName=f3;var d3="SelectLabel",Cae=S.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,i=Nae(d3,r);return d.jsx(Ue.div,{id:i.id,...n,ref:t})});Cae.displayName=d3;var bp="SelectItem",[Tae,h3]=hl(bp),p3=S.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:i=!1,textValue:o,...s}=e,u=bo(bp,r),f=wo(bp,r),l=u.value===n,[h,p]=S.useState(o??""),[m,g]=S.useState(!1),b=Ze(t,O=>f.itemRefCallback?.(O,n,i)),y=Jn(),w=S.useRef("touch"),j=()=>{i||(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 d.jsx(Tae,{scope:r,value:n,disabled:i,textId:y,isSelected:l,onItemTextChange:S.useCallback(O=>{p(E=>E||(O?.textContent??"").trim())},[]),children:d.jsx(bm.ItemSlot,{scope:r,value:n,disabled:i,textValue:h,children:d.jsx(Ue.div,{role:"option","aria-labelledby":y,"data-highlighted":m?"":void 0,"aria-selected":l&&m,"data-state":l?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...s,ref:b,onFocus:Ie(s.onFocus,()=>g(!0)),onBlur:Ie(s.onBlur,()=>g(!1)),onClick:Ie(s.onClick,()=>{w.current!=="mouse"&&j()}),onPointerUp:Ie(s.onPointerUp,()=>{w.current==="mouse"&&j()}),onPointerDown:Ie(s.onPointerDown,O=>{w.current=O.pointerType}),onPointerMove:Ie(s.onPointerMove,O=>{w.current=O.pointerType,i?f.onItemLeave?.():w.current==="mouse"&&O.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ie(s.onPointerLeave,O=>{O.currentTarget===document.activeElement&&f.onItemLeave?.()}),onKeyDown:Ie(s.onKeyDown,O=>{f.searchRef?.current!==""&&O.key===" "||(mae.includes(O.key)&&j(),O.key===" "&&O.preventDefault())})})})})});p3.displayName=bp;var yc="SelectItemText",m3=S.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:i,...o}=e,s=bo(yc,r),u=wo(yc,r),f=h3(yc,r),l=xae(yc,r),[h,p]=S.useState(null),m=Ze(t,j=>p(j),f.onItemTextChange,j=>u.itemTextRefCallback?.(j,f.value,f.disabled)),g=h?.textContent,b=S.useMemo(()=>d.jsx("option",{value:f.value,disabled:f.disabled,children:g},f.value),[f.disabled,f.value,g]),{onNativeOptionAdd:y,onNativeOptionRemove:w}=l;return Lt(()=>(y(b),()=>w(b)),[y,w,b]),d.jsxs(d.Fragment,{children:[d.jsx(Ue.span,{id:f.textId,...o,ref:m}),f.isSelected&&s.valueNode&&!s.valueNodeHasChildren?pu.createPortal(o.children,s.valueNode):null]})});m3.displayName=yc;var v3="SelectItemIndicator",g3=S.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return h3(v3,r).isSelected?d.jsx(Ue.span,{"aria-hidden":!0,...n,ref:t}):null});g3.displayName=v3;var Aw="SelectScrollUpButton",y3=S.forwardRef((e,t)=>{const r=wo(Aw,e.__scopeSelect),n=b_(Aw,e.__scopeSelect),[i,o]=S.useState(!1),s=Ze(t,n.onScrollButtonChange);return Lt(()=>{if(r.viewport&&r.isPositioned){let u=function(){const l=f.scrollTop>0;o(l)};const f=r.viewport;return u(),f.addEventListener("scroll",u),()=>f.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),i?d.jsx(b3,{...e,ref:s,onAutoScroll:()=>{const{viewport:u,selectedItem:f}=r;u&&f&&(u.scrollTop=u.scrollTop-f.offsetHeight)}}):null});y3.displayName=Aw;var Cw="SelectScrollDownButton",x3=S.forwardRef((e,t)=>{const r=wo(Cw,e.__scopeSelect),n=b_(Cw,e.__scopeSelect),[i,o]=S.useState(!1),s=Ze(t,n.onScrollButtonChange);return Lt(()=>{if(r.viewport&&r.isPositioned){let u=function(){const l=f.scrollHeight-f.clientHeight,h=Math.ceil(f.scrollTop)f.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),i?d.jsx(b3,{...e,ref:s,onAutoScroll:()=>{const{viewport:u,selectedItem:f}=r;u&&f&&(u.scrollTop=u.scrollTop+f.offsetHeight)}}):null});x3.displayName=Cw;var b3=S.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...i}=e,o=wo("SelectScrollButton",r),s=S.useRef(null),u=wm(r),f=S.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return S.useEffect(()=>()=>f(),[f]),Lt(()=>{u().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[u]),d.jsx(Ue.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Ie(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(n,50))}),onPointerMove:Ie(i.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(n,50))}),onPointerLeave:Ie(i.onPointerLeave,()=>{f()})})}),kae="SelectSeparator",Rae=S.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return d.jsx(Ue.div,{"aria-hidden":!0,...n,ref:t})});Rae.displayName=kae;var Tw="SelectArrow",Mae=S.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,i=Sm(r),o=bo(Tw,r),s=wo(Tw,r);return o.open&&s.position==="popper"?d.jsx(g_,{...i,...n,ref:t}):null});Mae.displayName=Tw;var Iae="SelectBubbleInput",w3=S.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const i=S.useRef(null),o=Ze(n,i),s=y_(t);return S.useEffect(()=>{const u=i.current;if(!u)return;const f=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(f,"value").set;if(s!==t&&h){const p=new Event("change",{bubbles:!0});h.call(u,t),u.dispatchEvent(p)}},[s,t]),d.jsx(Ue.select,{...r,style:{...U$,...r.style},ref:o,defaultValue:t})});w3.displayName=Iae;function S3(e){return e===""||e===void 0}function _3(e){const t=fr(e),r=S.useRef(""),n=S.useRef(0),i=S.useCallback(s=>{const u=r.current+s;t(u),(function f(l){r.current=l,window.clearTimeout(n.current),l!==""&&(n.current=window.setTimeout(()=>f(""),1e3))})(u)},[t]),o=S.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return S.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,i,o]}function j3(e,t,r){const i=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let s=Dae(e,Math.max(o,0));i.length===1&&(s=s.filter(l=>l!==r));const f=s.find(l=>l.textValue.toLowerCase().startsWith(i.toLowerCase()));return f!==r?f:void 0}function Dae(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Lae=J$,$ae=t3,Bae=n3,Fae=i3,zae=o3,qae=a3,Uae=u3,Wae=p3,Hae=m3,Vae=g3,Gae=y3,Kae=x3;function Je({...e}){return d.jsx(Lae,{"data-slot":"select",...e})}function et({...e}){return d.jsx(Bae,{"data-slot":"select-value",...e})}function tt({className:e,size:t="default",children:r,...n}){return d.jsxs($ae,{"data-slot":"select-trigger","data-size":t,className:Re("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,d.jsx(Fae,{asChild:!0,children:d.jsx(xs,{className:"size-4 opacity-50"})})]})}function rt({className:e,children:t,position:r="popper",...n}){return d.jsx(zae,{children:d.jsxs(qae,{"data-slot":"select-content",className:Re("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:[d.jsx(Xae,{}),d.jsx(Uae,{className:Re("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),d.jsx(Yae,{})]})})}function Ee({className:e,children:t,...r}){return d.jsxs(Wae,{"data-slot":"select-item",className:Re("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:[d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(Vae,{children:d.jsx(cM,{className:"size-4"})})}),d.jsx(Hae,{children:t})]})}function Xae({className:e,...t}){return d.jsx(Gae,{"data-slot":"select-scroll-up-button",className:Re("flex cursor-default items-center justify-center py-1",e),...t,children:d.jsx(V8,{className:"size-4"})})}function Yae({className:e,...t}){return d.jsx(Kae,{"data-slot":"select-scroll-down-button",className:Re("flex cursor-default items-center justify-center py-1",e),...t,children:d.jsx(xs,{className:"size-4"})})}function Qae(){const e=[{id:1,location:"Location A",labelCategory:"Prep",productCategory:"Meat",product:"Chicken",template:'2"x2" Basic',labelType:"Defrost",lastEdited:"2025.12.03.11:45",hasError:!1},{id:2,location:"Location A",labelCategory:"Prep",productCategory:"Meat",product:"Chicken",template:'2"x2" Basic',labelType:"Opened/Preped",lastEdited:"2025.12.03.11:45",hasError:!1},{id:3,location:"Location A",labelCategory:"Prep",productCategory:"Meat",product:"Chicken",template:'2"x2" Basic',labelType:"Heated",lastEdited:"2025.12.03.11:45",hasError:!1},{id:4,location:"Location A",labelCategory:"Grab'n'Go",productCategory:"Sandwich",product:"Chicken Sandwich",template:`2"x6" G'n'G`,labelType:"",lastEdited:"2025.12.03.11:45",hasError:!0}];return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[d.jsx(Se,{placeholder:"Search",style:{height:40,boxSizing:"border-box"},className:"bg-white border border-gray-300 rounded-md w-40 shrink-0 text-gray-900 placeholder:text-gray-500"}),d.jsxs(Je,{defaultValue:"all",children:[d.jsx(tt,{className:"bg-white border border-gray-300 rounded-md w-[200px] shrink-0 text-gray-900",style:{height:40,boxSizing:"border-box"},children:d.jsx(et,{placeholder:"Location"})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"all",children:"All Locations"}),d.jsx(Ee,{value:"loc-a",children:"Location A"}),d.jsx(Ee,{value:"loc-b",children:"Location B"})]})]}),d.jsxs("div",{className:"flex rounded-md border border-gray-300 bg-white h-10 overflow-hidden shrink-0",children:[d.jsx("button",{type:"button",className:"px-4 h-full border-r border-gray-200 text-sm font-medium text-gray-900 hover:bg-gray-50 transition-colors",children:"Bulk Import"}),d.jsx("button",{type:"button",className:"px-4 h-full border-r border-gray-200 text-sm font-medium text-gray-900 hover:bg-gray-50 transition-colors",children:"Bulk Export"}),d.jsx("button",{type:"button",className:"px-4 h-full text-sm font-medium text-gray-900 hover:bg-gray-50 transition-colors",children:"Bulk Edit"})]}),d.jsxs(we,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0 ml-auto",children:["New Label ",d.jsx(Rr,{className:"ml-1 h-4 w-4"})]})]}),d.jsx("div",{className:"text-red-600 font-bold italic text-lg",children:"One or more of your labels are missing fields from their templates (! ! ! 1 in total)."}),d.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:d.jsxs(br,{children:[d.jsx(wr,{children:d.jsxs(Ge,{className:"bg-gray-50 hover:bg-gray-50",children:[d.jsx(ye,{className:"font-bold text-gray-900 w-[120px]",children:"Location"}),d.jsx(ye,{className:"font-bold text-gray-900 w-[140px]",children:"Label Category"}),d.jsx(ye,{className:"font-bold text-gray-900 w-[140px]",children:"Product Category"}),d.jsx(ye,{className:"font-bold text-gray-900",children:"Product"}),d.jsx(ye,{className:"font-bold text-gray-900",children:"Template"}),d.jsx(ye,{className:"font-bold text-gray-900",children:"Label Type"}),d.jsx(ye,{className:"font-bold text-gray-900",children:"Last Edited"})]})}),d.jsx(Sr,{children:e.map(t=>d.jsxs(Ge,{className:"hover:bg-gray-50",children:[d.jsx(ue,{className:"font-medium",children:t.location}),d.jsx(ue,{children:t.labelCategory}),d.jsx(ue,{children:t.productCategory}),d.jsx(ue,{children:t.product}),d.jsxs(ue,{className:"font-medium",children:[t.template,t.hasError&&d.jsx("span",{className:"text-red-600 font-bold ml-2",children:"! ! !"})]}),d.jsx(ue,{children:t.labelType||"-"}),d.jsx(ue,{className:"text-gray-500 tabular-nums font-numeric",children:t.lastEdited})]},t.id))})]})})]})}function Zae(){const e=[{id:1,category:"Prep",count:54,photo:"XXX",lastEdited:"2025.12.03.11:45"},{id:2,category:"Green",count:33,photo:"XXX",lastEdited:"2025.12.03.11:45"},{id:3,category:"Red",count:44,photo:"XXX",lastEdited:"2025.12.03.11:45"}];return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[d.jsx(Se,{placeholder:"Search",style:{height:40,boxSizing:"border-box"},className:"bg-white border border-gray-300 rounded-md w-40 shrink-0 placeholder:text-gray-500"}),d.jsx("span",{className:"text-sm font-medium text-gray-900 whitespace-nowrap shrink-0",children:"Search"}),d.jsxs(Je,{defaultValue:"all",children:[d.jsx(tt,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:d.jsx(et,{placeholder:"Location"})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"all",children:"All Locations"}),d.jsx(Ee,{value:"loc-a",children:"Location A"}),d.jsx(Ee,{value:"loc-b",children:"Location B"})]})]}),d.jsx("span",{className:"text-sm font-medium text-gray-900 whitespace-nowrap shrink-0",children:"Location"}),d.jsxs(we,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0 ml-auto",children:["New Label Category ",d.jsx(Rr,{className:"ml-1 h-4 w-4"})]})]}),d.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:d.jsxs(br,{children:[d.jsx(wr,{children:d.jsxs(Ge,{className:"bg-gray-50 hover:bg-gray-50",children:[d.jsx(ye,{className:"font-bold text-gray-900 w-[250px]",children:"Label Category"}),d.jsx(ye,{className:"font-bold text-gray-900 w-[200px]",children:"No. of Labels"}),d.jsx(ye,{className:"font-bold text-gray-900 w-[200px]",children:"Category Photo"}),d.jsx(ye,{className:"font-bold text-gray-900",children:"Last Edited"})]})}),d.jsx(Sr,{children:e.map(t=>d.jsxs(Ge,{className:"hover:bg-gray-50",children:[d.jsx(ue,{className:"font-medium",children:t.category}),d.jsx(ue,{className:"font-numeric",children:t.count}),d.jsx(ue,{className:"text-gray-500",children:t.photo}),d.jsx(ue,{className:"text-gray-500 tabular-nums font-numeric",children:t.lastEdited})]},t.id))})]})})]})}function Jae(){const e=[{id:1,type:"Defrost",count:54,lastEdited:"2025.12.03.11:45"},{id:2,type:"Thawed",count:33,lastEdited:"2025.12.03.11:45"},{id:3,type:"Opened",count:44,lastEdited:"2025.12.03.11:45"},{id:4,type:"Preped",count:17,lastEdited:"2025.12.03.11:45"},{id:5,type:"Heated",count:67,lastEdited:"2025.12.03.11:45"}];return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[d.jsx(Se,{placeholder:"Search",style:{height:40,boxSizing:"border-box"},className:"bg-white border border-gray-300 rounded-md w-40 shrink-0 placeholder:text-gray-500"}),d.jsx("span",{className:"text-sm font-medium text-gray-900 whitespace-nowrap shrink-0",children:"Search"}),d.jsxs(Je,{defaultValue:"all",children:[d.jsx(tt,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:d.jsx(et,{placeholder:"Location"})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"all",children:"all"}),d.jsx(Ee,{value:"loc-a",children:"Location A"}),d.jsx(Ee,{value:"loc-b",children:"Location B"})]})]}),d.jsx("span",{className:"text-sm font-medium text-gray-900 whitespace-nowrap shrink-0",children:"Location"}),d.jsxs(we,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0 ml-auto",children:["New Label Type ",d.jsx(Rr,{className:"ml-1 h-4 w-4"})]})]}),d.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:d.jsxs(br,{children:[d.jsx(wr,{children:d.jsxs(Ge,{className:"bg-gray-50 hover:bg-gray-50",children:[d.jsx(ye,{className:"font-bold text-gray-900 w-[250px]",children:"Label Types"}),d.jsx(ye,{className:"font-bold text-gray-900 w-[200px]",children:"No. of Labels"}),d.jsx(ye,{className:"font-bold text-gray-900",children:"Last Edited"})]})}),d.jsx(Sr,{children:e.map(t=>d.jsxs(Ge,{className:"hover:bg-gray-50",children:[d.jsx(ue,{className:"font-medium",children:t.type}),d.jsx(ue,{className:"font-numeric",children:t.count}),d.jsx(ue,{className:"text-gray-500 tabular-nums font-numeric",children:t.lastEdited})]},t.id))})]})})]})}const ese="label-template-",tse="label-template-ids";function O3(e){return`${ese}${e}`}function E3(){return tse}function rse(){return`template-${Date.now()}`}function nse(){return`el-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function ise(e){return{id:e??rse(),name:"未命名模板",labelType:"PRICE",unit:"cm",width:6,height:4,appliedLocation:"ALL",showRuler:!0,showGrid:!0,elements:[]}}const Vb=[{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 ose(e,t=20,r=20){const n=nse(),o={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:o.width,height:o.height,rotation:"horizontal",border:"none",config:{...o.config}}}function P3(){try{const e=localStorage.getItem(E3());if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function N3(e){try{const t=localStorage.getItem(O3(e));return t?JSON.parse(t):null}catch{return null}}function Jk(){const e=P3(),t=[];for(const r of e){const n=N3(r);n&&t.push(n)}return t.sort((r,n)=>n.id>r.id?1:-1)}function ase(e){localStorage.setItem(E3(),JSON.stringify(e))}function sse(e){const t=O3(e.id);localStorage.setItem(t,JSON.stringify(e));const r=P3();r.includes(e.id)||(r.push(e.id),ase(r))}function lse(e){const t=cse(e),r=S.forwardRef((n,i)=>{const{children:o,...s}=n,u=S.Children.toArray(o),f=u.find(fse);if(f){const l=f.props.children,h=u.map(p=>p===f?S.Children.count(l)>1?S.Children.only(null):S.isValidElement(l)?l.props.children:null:p);return d.jsx(t,{...s,ref:i,children:S.isValidElement(l)?S.cloneElement(l,void 0,h):null})}return d.jsx(t,{...s,ref:i,children:o})});return r.displayName=`${e}.Slot`,r}function cse(e){const t=S.forwardRef((r,n)=>{const{children:i,...o}=r;if(S.isValidElement(i)){const s=hse(i),u=dse(o,i.props);return i.type!==S.Fragment&&(u.ref=n?ha(n,s):s),S.cloneElement(i,u)}return S.Children.count(i)>1?S.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var use=Symbol("radix.slottable");function fse(e){return S.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===use}function dse(e,t){const r={...t};for(const n in t){const i=e[n],o=t[n];/^on[A-Z]/.test(n)?i&&o?r[n]=(...u)=>{const f=o(...u);return i(...u),f}:i&&(r[n]=i):n==="style"?r[n]={...i,...o}:n==="className"&&(r[n]=[i,o].filter(Boolean).join(" "))}return{...e,...r}}function hse(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 _m="Dialog",[A3]=Bn(_m),[pse,zn]=A3(_m),C3=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:o,modal:s=!0}=e,u=S.useRef(null),f=S.useRef(null),[l,h]=Mi({prop:n,defaultProp:i??!1,onChange:o,caller:_m});return d.jsx(pse,{scope:t,triggerRef:u,contentRef:f,contentId:Jn(),titleId:Jn(),descriptionId:Jn(),open:l,onOpenChange:h,onOpenToggle:S.useCallback(()=>h(p=>!p),[h]),modal:s,children:r})};C3.displayName=_m;var T3="DialogTrigger",mse=S.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=zn(T3,r),o=Ze(t,i.triggerRef);return d.jsx(Ue.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":__(i.open),...n,ref:o,onClick:Ie(e.onClick,i.onOpenToggle)})});mse.displayName=T3;var w_="DialogPortal",[vse,k3]=A3(w_,{forceMount:void 0}),R3=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:i}=e,o=zn(w_,t);return d.jsx(vse,{scope:t,forceMount:r,children:S.Children.map(n,s=>d.jsx(Mr,{present:r||o.open,children:d.jsx(Eu,{asChild:!0,container:i,children:s})}))})};R3.displayName=w_;var wp="DialogOverlay",M3=S.forwardRef((e,t)=>{const r=k3(wp,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,o=zn(wp,e.__scopeDialog);return o.modal?d.jsx(Mr,{present:n||o.open,children:d.jsx(yse,{...i,ref:t})}):null});M3.displayName=wp;var gse=lse("DialogOverlay.RemoveScroll"),yse=S.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=zn(wp,r);return d.jsx(xm,{as:gse,allowPinchZoom:!0,shards:[i.contentRef],children:d.jsx(Ue.div,{"data-state":__(i.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),fa="DialogContent",I3=S.forwardRef((e,t)=>{const r=k3(fa,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,o=zn(fa,e.__scopeDialog);return d.jsx(Mr,{present:n||o.open,children:o.modal?d.jsx(xse,{...i,ref:t}):d.jsx(bse,{...i,ref:t})})});I3.displayName=fa;var xse=S.forwardRef((e,t)=>{const r=zn(fa,e.__scopeDialog),n=S.useRef(null),i=Ze(t,r.contentRef,n);return S.useEffect(()=>{const o=n.current;if(o)return x_(o)},[]),d.jsx(D3,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ie(e.onCloseAutoFocus,o=>{o.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Ie(e.onPointerDownOutside,o=>{const s=o.detail.originalEvent,u=s.button===0&&s.ctrlKey===!0;(s.button===2||u)&&o.preventDefault()}),onFocusOutside:Ie(e.onFocusOutside,o=>o.preventDefault())})}),bse=S.forwardRef((e,t)=>{const r=zn(fa,e.__scopeDialog),n=S.useRef(!1),i=S.useRef(!1);return d.jsx(D3,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(n.current||r.triggerRef.current?.focus(),o.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;r.triggerRef.current?.contains(s)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),D3=S.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,u=zn(fa,r),f=S.useRef(null),l=Ze(t,f);return o_(),d.jsxs(d.Fragment,{children:[d.jsx(dm,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:o,children:d.jsx(ju,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":__(u.open),...s,ref:l,onDismiss:()=>u.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(wse,{titleId:u.titleId}),d.jsx(_se,{contentRef:f,descriptionId:u.descriptionId})]})]})}),S_="DialogTitle",L3=S.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=zn(S_,r);return d.jsx(Ue.h2,{id:i.titleId,...n,ref:t})});L3.displayName=S_;var $3="DialogDescription",B3=S.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=zn($3,r);return d.jsx(Ue.p,{id:i.descriptionId,...n,ref:t})});B3.displayName=$3;var F3="DialogClose",z3=S.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=zn(F3,r);return d.jsx(Ue.button,{type:"button",...n,ref:t,onClick:Ie(e.onClick,()=>i.onOpenChange(!1))})});z3.displayName=F3;function __(e){return e?"open":"closed"}var q3="DialogTitleWarning",[Afe,U3]=Y6(q3,{contentName:fa,titleName:S_,docsSlug:"dialog"}),wse=({titleId:e})=>{const t=U3(q3),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 S.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Sse="DialogDescriptionWarning",_se=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${U3(Sse).contentName}}.`;return S.useEffect(()=>{const i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},jse=C3,Ose=R3,Ese=M3,Pse=I3,Nse=L3,Ase=B3,Cse=z3;function _r({...e}){return d.jsx(jse,{"data-slot":"dialog",...e})}function Tse({...e}){return d.jsx(Ose,{"data-slot":"dialog-portal",...e})}const W3=S.forwardRef(({className:e,...t},r)=>d.jsx(Ese,{ref:r,"data-slot":"dialog-overlay",className:Re("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}));W3.displayName="DialogOverlay";const dr=S.forwardRef(({className:e,children:t,...r},n)=>d.jsxs(Tse,{"data-slot":"dialog-portal",children:[d.jsx(W3,{}),d.jsxs(Pse,{ref:n,"data-slot":"dialog-content",className:Re("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,d.jsxs(Cse,{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:[d.jsx(xc,{}),d.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));dr.displayName="DialogContent";function jr({className:e,...t}){return d.jsx("div",{"data-slot":"dialog-header",className:Re("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Dr({className:e,...t}){return d.jsx("div",{"data-slot":"dialog-footer",className:Re("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function Or({className:e,...t}){return d.jsx(Nse,{"data-slot":"dialog-title",className:Re("text-lg leading-none font-semibold",e),...t})}function xn({className:e,...t}){return d.jsx(Ase,{"data-slot":"dialog-description",className:Re("text-muted-foreground text-sm",e),...t})}const kse=[{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"}}]}];function Rse({onAddElement:e}){return d.jsxs("div",{className:"w-44 shrink-0 border-r border-gray-200 bg-white flex flex-col h-full",children:[d.jsx("div",{className:"px-2 py-2 border-b border-gray-200 font-semibold text-gray-800 text-sm",children:"Elements"}),d.jsx(_s,{className:"flex-1",children:d.jsx("div",{className:"p-1.5 space-y-3",children:kse.map(t=>d.jsxs("div",{children:[d.jsx("div",{className:"px-2 py-1 text-xs font-medium text-gray-500 uppercase tracking-wide",children:t.title}),t.subtitle&&d.jsx("div",{className:"px-2 py-0.5 text-[10px] text-gray-400",children:t.subtitle}),d.jsx("div",{className:"grid grid-cols-2 gap-1 mt-0.5",children:t.items.map((r,n)=>d.jsx("button",{type:"button",onClick:()=>e(r.type,r.config),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 yd={},cc={},xd={},eR;function en(){if(eR)return xd;eR=1,Object.defineProperty(xd,"__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,i){e(this,r),this.data=n,this.text=i.text||n,this.options=i};return xd.default=t,xd}var tR;function Mse(){if(tR)return cc;tR=1,Object.defineProperty(cc,"__esModule",{value:!0}),cc.CODE39=void 0;var e=(function(){function y(w,j){for(var O=0;O=200){w=m.shift()-105;var j=n.SWAP[w];j!==void 0?y=h.next(m,g+1,j):((b===n.SET_A||b===n.SET_B)&&w===n.SHIFT&&(m[0]=b===n.SET_A?m[0]>95?m[0]-96:m[0]:m[0]<32?m[0]+96:m[0]),y=h.next(m,g+1,b))}else w=h.correctIndex(m,b),y=h.next(m,g+1,b);var O=h.getBar(w),E=w*g;return{result:O+y.result,checksum:E+y.checksum}}}]),h})(r.default);return wd.default=f,wd}var Sd={},iR;function Ise(){if(iR)return Sd;iR=1,Object.defineProperty(Sd,"__esModule",{value:!0});var e=Pu(),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 i(s,u){var f=u?e.A_CHARS:e.B_CHARS,l=s.match(new RegExp("^("+f+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(l)return l[1]+"Ì"+o(s.substring(l[1].length));var h=s.match(new RegExp("^"+f+"+"))[0];return h.length===s.length?s:h+String.fromCharCode(u?205:206)+i(s.substring(h.length),!u)}function o(s){var u=n(s),f=u.length;if(f===s.length)return s;s=s.substring(f);var l=t(s)>=r(s);return u+String.fromCharCode(l?206:205)+i(s,l)}return Sd.default=function(s){var u=void 0,f=n(s).length;if(f>=2)u=e.C_START_CHAR+o(s);else{var l=t(s)>r(s);u=(l?e.A_START_CHAR:e.B_START_CHAR)+i(s,l)}return u.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(h,p){return"Ë"+p})},Sd}var oR;function Dse(){if(oR)return bd;oR=1,Object.defineProperty(bd,"__esModule",{value:!0});var e=jm(),t=i(e),r=Ise(),n=i(r);function i(l){return l&&l.__esModule?l:{default:l}}function o(l,h){if(!(l instanceof h))throw new TypeError("Cannot call a class as a function")}function s(l,h){if(!l)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h&&(typeof h=="object"||typeof h=="function")?h:l}function u(l,h){if(typeof h!="function"&&h!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof h);l.prototype=Object.create(h&&h.prototype,{constructor:{value:l,enumerable:!1,writable:!0,configurable:!0}}),h&&(Object.setPrototypeOf?Object.setPrototypeOf(l,h):l.__proto__=h)}var f=(function(l){u(h,l);function h(p,m){if(o(this,h),/^[\x00-\x7F\xC8-\xD3]+$/.test(p))var g=s(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,(0,n.default)(p),m));else var g=s(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,p,m));return s(g)}return h})(t.default);return bd.default=f,bd}var _d={},aR;function Lse(){if(aR)return _d;aR=1,Object.defineProperty(_d,"__esModule",{value:!0});var e=(function(){function l(h,p){for(var m=0;mb.width*10?b.width*10:b.fontSize,y.guardHeight=b.height+y.fontSize/2+b.textMargin,y}return e(m,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(b,y){return this.text.substr(b,y)}},{key:"leftEncode",value:function(b,y){return(0,n.default)(b,y)}},{key:"rightText",value:function(b,y){return this.text.substr(b,y)}},{key:"rightEncode",value:function(b,y){return(0,n.default)(b,y)}},{key:"encodeGuarded",value:function(){var b={fontSize:this.fontSize},y={height:this.guardHeight};return[{data:t.SIDE_BIN,options:y},{data:this.leftEncode(),text:this.leftText(),options:b},{data:t.MIDDLE_BIN,options:y},{data:this.rightEncode(),text:this.rightText(),options:b},{data:t.SIDE_BIN,options:y}]}},{key:"encodeFlat",value:function(){var b=[t.SIDE_BIN,this.leftEncode(),t.MIDDLE_BIN,this.rightEncode(),t.SIDE_BIN];return{data:b.join(""),text:this.text}}}]),m})(o.default);return Pd.default=h,Pd}var hR;function zse(){if(hR)return Ed;hR=1,Object.defineProperty(Ed,"__esModule",{value:!0});var e=(function(){function p(m,g){for(var b=0;bb.width*10?y.fontSize=b.width*10:y.fontSize=b.fontSize,y.guardHeight=b.height+y.fontSize/2+b.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 b="";return b+="101",b+=(0,r.default)(this.data.substr(0,6),"LLLLLL"),b+="01010",b+=(0,r.default)(this.data.substr(6,6),"RRRRRR"),b+="101",{data:b,text:this.text}}},{key:"guardedEncoding",value:function(){var b=[];return this.displayValue&&b.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),b.push({data:"101"+(0,r.default)(this.data[0],"L"),options:{height:this.guardHeight}}),b.push({data:(0,r.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),b.push({data:"01010",options:{height:this.guardHeight}}),b.push({data:(0,r.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),b.push({data:(0,r.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&b.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),b}}]),m})(i.default);function h(p){var m=0,g;for(g=1;g<11;g+=2)m+=parseInt(p[g]);for(g=0;g<11;g+=2)m+=parseInt(p[g])*3;return(10-m%10)%10}return uc.default=l,uc}var kd={},yR;function Hse(){if(yR)return kd;yR=1,Object.defineProperty(kd,"__esModule",{value:!0});var e=(function(){function b(y,w){for(var j=0;jj.width*10?O.fontSize=j.width*10:O.fontSize=j.fontSize,O.guardHeight=j.height+O.fontSize/2+j.textMargin,O}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],O=this.upcA[this.upcA.length-1],E=p[parseInt(O)][parseInt(j)];return(0,r.default)(this.middleDigits,E)}}]),y})(i.default);function g(b,y){for(var w=parseInt(b[b.length-1]),j=h[w],O="",E=0,A=0;A=3&&this.number<=131070}}]),l})(r.default);return dc.pharmacode=u,dc}var hc={},kR;function rle(){if(kR)return hc;kR=1,Object.defineProperty(hc,"__esModule",{value:!0}),hc.codabar=void 0;var e=(function(){function f(l,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"]}),rs}var MR;function K3(){if(MR)return Fd;MR=1,Object.defineProperty(Fd,"__esModule",{value:!0});var e=(function(){function l(h,p){for(var m=0;m0?h.fontSize+h.textMargin:0)+h.marginTop+h.marginBottom}function i(l,h,p){if(p.displayValue&&hh&&(h=l[p].height);return h}function f(l,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 g=m.measureText(l);if(!g)return 0;var b=g.width;return b}return qr.getMaximumHeightOfEncodings=u,qr.getEncodingHeight=n,qr.getBarcodePadding=i,qr.calculateEncodingAttributes=o,qr.getTotalWidthOfEncodings=s,qr}var VR;function fle(){if(VR)return Yd;VR=1,Object.defineProperty(Yd,"__esModule",{value:!0});var e=(function(){function u(f,l){for(var h=0;h0?(g=0,p.textAlign="left"):l.textAlign=="right"?(g=h.width-1,p.textAlign="right"):(g=h.width/2,p.textAlign="center"),p.fillText(h.text,g,b)}}},{key:"moveCanvasDrawing",value:function(l){var h=this.canvas.getContext("2d");h.translate(l.width,0)}},{key:"restoreCanvas",value:function(){var l=this.canvas.getContext("2d");l.restore()}}]),u})();return Yd.default=s,Yd}var Qd={},GR;function dle(){if(GR)return Qd;GR=1,Object.defineProperty(Qd,"__esModule",{value:!0});var e=(function(){function f(l,h){for(var p=0;p0&&(this.drawRect(w-p.width*y,b,p.width*y,p.height,h),y=0);y>0&&this.drawRect(w-p.width*(y-1),b,p.width*y,p.height,h)}},{key:"drawSVGText",value:function(h,p,m){var g=this.document.createElementNS(s,"text");if(p.displayValue){var b,y;g.setAttribute("font-family",p.font),g.setAttribute("font-size",p.fontSize),p.fontOptions.includes("bold")&&g.setAttribute("font-weight","bold"),p.fontOptions.includes("italic")&&g.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?(b=0,g.setAttribute("text-anchor","start")):p.textAlign=="right"?(b=m.width-1,g.setAttribute("text-anchor","end")):(b=m.width/2,g.setAttribute("text-anchor","middle")),g.setAttribute("x",b),g.setAttribute("y",y),g.appendChild(this.document.createTextNode(m.text)),h.appendChild(g)}}},{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 g=this.document.createElementNS(s,"g");return g.setAttribute("transform","translate("+h+", "+p+")"),m.appendChild(g),g}},{key:"setGroupOptions",value:function(h,p){h.setAttribute("fill",p.lineColor)}},{key:"drawRect",value:function(h,p,m,g,b){var y=this.document.createElementNS(s,"rect");return y.setAttribute("x",h),y.setAttribute("y",p),y.setAttribute("width",m),y.setAttribute("height",g),b.appendChild(y),y}}]),f})();return Qd.default=u,Qd}var Zd={},KR;function hle(){if(KR)return Zd;KR=1,Object.defineProperty(Zd,"__esModule",{value:!0});var e=(function(){function n(i,o){for(var s=0;s"u"?"undefined":e(h))==="object"&&!h.nodeName)return{element:h,renderer:i.default.ObjectRenderer};throw new o.InvalidElementException}}function f(h){var p=document.querySelectorAll(h);if(p.length!==0){for(var m=[],g=0;g"u")throw Error("No element to render on was provided.");return U._renderProperties=(0,l.default)(F),U._encodings=[],U._options=w.default,U._errorHandler=new g.default(U),typeof L<"u"&&($=$||{},$.format||($.format=T()),U.options($)[$.format](L,$).render()),U};E.getModule=function(I){return t.default[I]};for(var A in t.default)t.default.hasOwnProperty(A)&&N(t.default,A);function N(I,F){O.prototype[F]=O.prototype[F.toUpperCase()]=O.prototype[F.toLowerCase()]=function(L,$){var U=this;return U._errorHandler.wrapBarcodeCall(function(){$.text=typeof $.text>"u"?void 0:""+$.text;var G=(0,n.default)(U._options,$);G=(0,p.default)(G);var q=I[F],H=C(L,q,G);return U._encodings.push(H),U})}}function C(I,F,L){I=""+I;var $=new F(I,L);if(!$.valid())throw new b.InvalidInputException($.constructor.name,I);var U=$.encode();U=(0,o.default)(U);for(var G=0;Gt in e?ble(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,kw=(e,t)=>{for(var r in t||(t={}))J3.call(t,r)&&eM(e,r,t[r]);if(Sp)for(var r of Sp(t))e4.call(t,r)&&eM(e,r,t[r]);return e},Rw=(e,t)=>{var r={};for(var n in e)J3.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Sp)for(var n of Sp(e))t.indexOf(n)<0&&e4.call(e,n)&&(r[n]=e[n]);return r};/** - * @license QR Code generator library (TypeScript) - * Copyright (c) Project Nayuki. - * SPDX-License-Identifier: MIT - */var da;(e=>{const t=class Ye{constructor(f,l,h,p){if(this.version=f,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],fYe.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=f*4+17;let m=[];for(let b=0;b7)throw new RangeError("Invalid value");let b,y;for(b=h;;b++){const E=Ye.getNumDataCodewords(b,l)*8,A=s.getTotalBits(f,b);if(A<=E){y=A;break}if(b>=p)throw new RangeError("Data too long")}for(const E of[Ye.Ecc.MEDIUM,Ye.Ecc.QUARTILE,Ye.Ecc.HIGH])g&&y<=Ye.getNumDataCodewords(b,E)*8&&(l=E);let w=[];for(const E of f){r(E.mode.modeBits,4,w),r(E.numChars,E.mode.numCharCountBits(b),w);for(const A of E.getData())w.push(A)}i(w.length==y);const j=Ye.getNumDataCodewords(b,l)*8;i(w.length<=j),r(0,Math.min(4,j-w.length),w),r(0,(8-w.length%8)%8,w),i(w.length%8==0);for(let E=236;w.lengthO[A>>>3]|=E<<7-(A&7)),new Ye(b,l,O,m)}getModule(f,l){return 0<=f&&f>>9)*1335;const p=(l<<10|h)^21522;i(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 f=this.version;for(let h=0;h<12;h++)f=f<<1^(f>>>11)*7973;const l=this.version<<12|f;i(l>>>18==0);for(let h=0;h<18;h++){const p=n(l,h),m=this.size-11+h%3,g=Math.floor(h/3);this.setFunctionModule(m,g,p),this.setFunctionModule(g,m,p)}}drawFinderPattern(f,l){for(let h=-4;h<=4;h++)for(let p=-4;p<=4;p++){const m=Math.max(Math.abs(p),Math.abs(h)),g=f+p,b=l+h;0<=g&&g{(E!=y-m||N>=b)&&O.push(A[E])});return i(O.length==g),O}drawCodewords(f){if(f.length!=Math.floor(Ye.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=0;for(let h=this.size-1;h>=1;h-=2){h==6&&(h=5);for(let p=0;p>>3],7-(l&7)),l++)}}i(l==f.length*8)}applyMask(f){if(f<0||f>7)throw new RangeError("Mask value out of range");for(let l=0;l5&&f++):(this.finderPenaltyAddHistory(b,y),g||(f+=this.finderPenaltyCountPatterns(y)*Ye.PENALTY_N3),g=this.modules[m][w],b=1);f+=this.finderPenaltyTerminateAndCount(g,b,y)*Ye.PENALTY_N3}for(let m=0;m5&&f++):(this.finderPenaltyAddHistory(b,y),g||(f+=this.finderPenaltyCountPatterns(y)*Ye.PENALTY_N3),g=this.modules[w][m],b=1);f+=this.finderPenaltyTerminateAndCount(g,b,y)*Ye.PENALTY_N3}for(let m=0;mg+(b?1:0),l);const h=this.size*this.size,p=Math.ceil(Math.abs(l*20-h*10)/h)-1;return i(0<=p&&p<=9),f+=p*Ye.PENALTY_N4,i(0<=f&&f<=2568888),f}getAlignmentPatternPositions(){if(this.version==1)return[];{const f=Math.floor(this.version/7)+2,l=this.version==32?26:Math.ceil((this.version*4+4)/(f*2-2))*2;let h=[6];for(let p=this.size-7;h.lengthYe.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*f+128)*f+64;if(f>=2){const h=Math.floor(f/7)+2;l-=(25*h-10)*h-55,f>=7&&(l-=36)}return i(208<=l&&l<=29648),l}static getNumDataCodewords(f,l){return Math.floor(Ye.getNumRawDataModules(f)/8)-Ye.ECC_CODEWORDS_PER_BLOCK[l.ordinal][f]*Ye.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][f]}static reedSolomonComputeDivisor(f){if(f<1||f>255)throw new RangeError("Degree out of range");let l=[];for(let p=0;p0);for(const p of f){const m=p^h.shift();h.push(0),l.forEach((g,b)=>h[b]^=Ye.reedSolomonMultiply(g,m))}return h}static reedSolomonMultiply(f,l){if(f>>>8||l>>>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^=(l>>>p&1)*f;return i(h>>>8==0),h}finderPenaltyCountPatterns(f){const l=f[1];i(l<=this.size*3);const h=l>0&&f[2]==l&&f[3]==l*3&&f[4]==l&&f[5]==l;return(h&&f[0]>=l*4&&f[6]>=l?1:0)+(h&&f[6]>=l*4&&f[0]>=l?1:0)}finderPenaltyTerminateAndCount(f,l,h){return f&&(this.finderPenaltyAddHistory(l,h),l=0),l+=this.size,this.finderPenaltyAddHistory(l,h),this.finderPenaltyCountPatterns(h)}finderPenaltyAddHistory(f,l){l[0]==0&&(f+=this.size),l.pop(),l.unshift(f)}};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,f,l){if(f<0||f>31||u>>>f)throw new RangeError("Value out of range");for(let h=f-1;h>=0;h--)l.push(u>>>h&1)}function n(u,f){return(u>>>f&1)!=0}function i(u){if(!u)throw new Error("Assertion error")}const o=class At{constructor(f,l,h){if(this.mode=f,this.numChars=l,this.bitData=h,l<0)throw new RangeError("Invalid argument");this.bitData=h.slice()}static makeBytes(f){let l=[];for(const h of f)r(h,8,l);return new At(At.Mode.BYTE,f.length,l)}static makeNumeric(f){if(!At.isNumeric(f))throw new RangeError("String contains non-numeric characters");let l=[];for(let h=0;h=1<{(t=>{const r=class{constructor(i,o){this.ordinal=i,this.formatBits=o}};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={}))})(da||(da={}));(e=>{(t=>{const r=class{constructor(i,o){this.modeBits=i,this.numBitsCharCount=o}numCharCountBits(i){return this.numBitsCharCount[Math.floor((i+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={}))})(da||(da={}));var us=da;/** - * @license qrcode.react - * Copyright (c) Paul O'Shannessy - * SPDX-License-Identifier: ISC - */var wle={L:us.QrCode.Ecc.LOW,M:us.QrCode.Ecc.MEDIUM,Q:us.QrCode.Ecc.QUARTILE,H:us.QrCode.Ecc.HIGH},t4=128,r4="L",n4="#FFFFFF",i4="#000000",o4=!1,a4=1,Sle=4,_le=0,jle=.1;function s4(e,t=0){const r=[];return e.forEach(function(n,i){let o=null;n.forEach(function(s,u){if(!s&&o!==null){r.push(`M${o+t} ${i+t}h${u-o}v1H${o+t}z`),o=null;return}if(u===n.length-1){if(!s)return;o===null?r.push(`M${u+t},${i+t} h1v1H${u+t}z`):r.push(`M${o+t},${i+t} h${u+1-o}v1H${o+t}z`);return}s&&o===null&&(o=u)})}),r.join("")}function l4(e,t){return e.slice().map((r,n)=>n=t.y+t.h?r:r.map((i,o)=>o=t.x+t.w?i:!1))}function Ole(e,t,r,n){if(n==null)return null;const i=e.length+r*2,o=Math.floor(t*jle),s=i/t,u=(n.width||o)*s,f=(n.height||o)*s,l=n.x==null?e.length/2-u/2:n.x*s,h=n.y==null?e.length/2-f/2:n.y*s,p=n.opacity==null?1:n.opacity;let m=null;if(n.excavate){let b=Math.floor(l),y=Math.floor(h),w=Math.ceil(u+l-b),j=Math.ceil(f+h-y);m={x:b,y,w,h:j}}const g=n.crossOrigin;return{x:l,y:h,h:f,w:u,excavation:m,opacity:p,crossOrigin:g}}function Ele(e,t){return t!=null?Math.max(Math.floor(t),0):e?Sle:_le}function c4({value:e,level:t,minVersion:r,includeMargin:n,marginSize:i,imageSettings:o,size:s,boostLevel:u}){let f=z.useMemo(()=>{const b=(Array.isArray(e)?e:[e]).reduce((y,w)=>(y.push(...us.QrSegment.makeSegments(w)),y),[]);return us.QrCode.encodeSegments(b,wle[t],r,void 0,void 0,u)},[e,t,r,u]);const{cells:l,margin:h,numCells:p,calculatedImageSettings:m}=z.useMemo(()=>{let g=f.getModules();const b=Ele(n,i),y=g.length+b*2,w=Ole(g,s,b,o);return{cells:g,margin:b,numCells:y,calculatedImageSettings:w}},[f,s,o,n,i]);return{qrcode:f,margin:h,cells:l,numCells:p,calculatedImageSettings:m}}var Ple=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Nle=z.forwardRef(function(t,r){const n=t,{value:i,size:o=t4,level:s=r4,bgColor:u=n4,fgColor:f=i4,includeMargin:l=o4,minVersion:h=a4,boostLevel:p,marginSize:m,imageSettings:g}=n,y=Rw(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:w}=y,j=Rw(y,["style"]),O=g?.src,E=z.useRef(null),A=z.useRef(null),N=z.useCallback(G=>{E.current=G,typeof r=="function"?r(G):r&&(r.current=G)},[r]),[C,T]=z.useState(!1),{margin:R,cells:I,numCells:F,calculatedImageSettings:L}=c4({value:i,level:s,minVersion:h,boostLevel:p,includeMargin:l,marginSize:m,imageSettings:g,size:o});z.useEffect(()=>{if(E.current!=null){const G=E.current,q=G.getContext("2d");if(!q)return;let H=I;const V=A.current,D=L!=null&&V!==null&&V.complete&&V.naturalHeight!==0&&V.naturalWidth!==0;D&&L.excavation!=null&&(H=l4(I,L.excavation));const Z=window.devicePixelRatio||1;G.height=G.width=o*Z;const J=o/F*Z;q.scale(J,J),q.fillStyle=u,q.fillRect(0,0,F,F),q.fillStyle=f,Ple?q.fill(new Path2D(s4(H,R))):I.forEach(function(M,B){M.forEach(function(ee,ae){ee&&q.fillRect(ae+R,B+R,1,1)})}),L&&(q.globalAlpha=L.opacity),D&&q.drawImage(V,L.x+R,L.y+R,L.w,L.h)}}),z.useEffect(()=>{T(!1)},[O]);const $=kw({height:o,width:o},w);let U=null;return O!=null&&(U=z.createElement("img",{src:O,key:O,style:{display:"none"},onLoad:()=>{T(!0)},ref:A,crossOrigin:L?.crossOrigin})),z.createElement(z.Fragment,null,z.createElement("canvas",kw({style:$,height:o,width:o,ref:N,role:"img"},j)),U)});Nle.displayName="QRCodeCanvas";var u4=z.forwardRef(function(t,r){const n=t,{value:i,size:o=t4,level:s=r4,bgColor:u=n4,fgColor:f=i4,includeMargin:l=o4,minVersion:h=a4,boostLevel:p,title:m,marginSize:g,imageSettings:b}=n,y=Rw(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:w,cells:j,numCells:O,calculatedImageSettings:E}=c4({value:i,level:s,minVersion:h,boostLevel:p,includeMargin:l,marginSize:g,imageSettings:b,size:o});let A=j,N=null;b!=null&&E!=null&&(E.excavation!=null&&(A=l4(j,E.excavation)),N=z.createElement("image",{href:b.src,height:E.h,width:E.w,x:E.x+w,y:E.y+w,preserveAspectRatio:"none",opacity:E.opacity,crossOrigin:E.crossOrigin}));const C=s4(A,w);return z.createElement("svg",kw({height:o,width:o,viewBox:`0 0 ${O} ${O}`,ref:r,role:"img"},y),!!m&&z.createElement("title",null,m),z.createElement("path",{fill:u,d:`M0,0 h${O}v${O}H0z`,shapeRendering:"crispEdges"}),z.createElement("path",{fill:f,d:C,shapeRendering:"crispEdges"}),N)});u4.displayName="QRCodeSVG";function Ale({data:e,width:t,height:r,showText:n,orientation:i="horizontal"}){const o=S.useRef(null),s=i==="vertical",u=Math.max(20,(s?t:r)-(n?14:4));S.useEffect(()=>{if(o.current&&e)try{xle(o.current,e,{format:"CODE128",width:1,height:u,displayValue:n!==!1,margin:2,fontOptions:"",fontSize:10})}catch{}},[e,u,n]);const f=d.jsx("svg",{ref:o,className:"w-full h-full min-h-0",style:{maxHeight:s?t:r}});return s?d.jsx("div",{className:"w-full h-full flex items-center justify-center",children:d.jsx("div",{style:{transform:"rotate(-90deg)",transformOrigin:"center center",width:r,height:t,display:"flex",alignItems:"center",justifyContent:"center"},children:f})}):f}const Pc=8;function is(e){return Math.round(e/Pc)*Pc}function _p(e,t){return t==="cm"?e*37.8:e*96}function tM(e,t){return t==="cm"?e/37.8:e/96}function f4({el:e}){const t=e.config,r=e.type,n={fontSize:t?.fontSize??14,fontFamily:t?.fontFamily??"Arial",fontWeight:t?.fontWeight??"normal",textAlign:t?.textAlign??"left",color:t?.color??"#000"},i=t?.inputType;if(r==="TEXT_STATIC"){const o=t?.text??"文本";return i==="number"?d.jsx("input",{type:"number",readOnly:!0,value:t?.text??"0",className:"w-full h-full min-w-0 border border-gray-300 bg-white rounded px-1 pointer-events-none",style:{...n,textAlign:"right"}}):i==="options"?d.jsxs("div",{className:"w-full h-full min-w-0 border border-gray-300 bg-white rounded px-1 flex items-center pointer-events-none text-gray-500",style:n,children:[d.jsx("span",{className:"truncate flex-1",children:o||"请选择..."}),d.jsx("span",{className:"ml-auto text-gray-400",children:"▼"})]}):i==="text"?d.jsx("input",{type:"text",readOnly:!0,value:o,className:"w-full h-full min-w-0 border border-gray-300 bg-white rounded px-1 pointer-events-none",style:n}):d.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-pre-wrap break-all leading-tight",style:n,children:o})}if(r==="TEXT_PRODUCT"){const o=t?.text??"商品名";return d.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-pre-wrap break-all leading-tight",style:n,children:o})}if(r==="TEXT_PRICE"){const o=t?.prefix??"¥",s=t?.text??"0.00";return d.jsxs("div",{className:"w-full h-full px-1 overflow-hidden flex items-center",style:{...n,justifyContent:n.textAlign==="center"?"center":n.textAlign==="right"?"flex-end":"flex-start"},children:[d.jsx("span",{children:o}),d.jsx("span",{children:s})]})}if(r==="BARCODE"){const o=t?.data??"123456789",s=t?.showText!==!1,u=t?.orientation==="vertical"?"vertical":"horizontal";return d.jsx("div",{className:"flex flex-col items-center justify-center w-full h-full overflow-hidden p-0.5",children:d.jsx("div",{className:"flex-1 w-full min-h-0 flex items-center justify-center",children:d.jsx(Ale,{data:o,width:e.width,height:e.height,showText:s,orientation:u})})})}if(r==="QRCODE"){const o=t?.data??"https://example.com",s=Math.min(e.width,e.height)-4;return d.jsx("div",{className:"w-full h-full flex items-center justify-center p-0.5",children:d.jsx(u4,{value:o,size:Math.max(20,s),level:"M",includeMargin:!1})})}if(r==="IMAGE"){const o=t?.src;return o?d.jsx("img",{src:o,alt:"",className:"w-full h-full object-contain"}):d.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:d.jsx("span",{className:"font-medium",children:"Logo"})})}if(r==="DATE"){const s=(t?.format??"YYYY-MM-DD").replace("YYYY","2025").replace("MM","02").replace("DD","01");return t?.inputType==="datetime"||t?.inputType==="date"?d.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:n}):d.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:n,children:s})}if(r==="TIME"){const s=(t?.format??"HH:mm").replace("HH","12").replace("mm","30");return d.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:n,children:s})}if(r==="DURATION")return d.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:n,children:"保质期 2025-02-04"});if(r==="WEIGHT"){const o=t?.value??500,s=t?.unit??"g";return d.jsxs("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:n,children:[o,s]})}if(r==="WEIGHT_PRICE"){const o=t?.unitPrice??10,s=t?.weight??.5,u=t?.currency??"¥";return d.jsxs("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:n,children:[u,(o*s).toFixed(2)]})}if(r==="NUTRITION"){const o=t?.calories??120;return d.jsxs("div",{className:"text-[8px] p-0.5 w-full h-full overflow-hidden flex flex-col",children:[d.jsx("div",{className:"font-semibold border-b border-black",children:"Nutrition Facts"}),d.jsxs("div",{children:["Calories ",o]})]})}return r==="BLANK"?d.jsx("div",{className:"w-full h-full border border-dashed border-gray-200"}):d.jsx("div",{className:"text-gray-500 text-[10px] px-1 truncate w-full flex items-center justify-center",children:e.type.replace(/_/g," ")})}function Cle({template:e,selectedId:t,onSelect:r,onUpdateElement:n,onDeleteElement:i,onTemplateChange:o,scale:s=1,onZoomIn:u,onZoomOut:f,onPreview:l}){const h=S.useRef(null),p=S.useRef(null),m=S.useRef(null),g=S.useRef(null),b=S.useRef(null),y=S.useRef(null),w=S.useRef(null),[j,O]=z.useState(!1),[E,A]=z.useState(!1),N=S.useRef(null),[C,T]=z.useState({x:0,y:0}),R=S.useRef(null),I=_p(e.width,e.unit),F=_p(e.height,e.unit),L=e.showGrid!==!1,$=S.useCallback((M,B)=>{if(j||M.button===1)return;M.stopPropagation(),r(B),p.current?.focus();const ee=e.elements.find(ie=>ie.id===B);if(!ee)return;const ae=document.getElementById(`element-${B}`);ae&&(ae.classList.add("z-50","opacity-90","shadow-xl","ring-2","ring-blue-400","ring-offset-2"),ae.style.cursor="grabbing"),m.current={id:B,startX:M.clientX,startY:M.clientY,elX:ee.x,elY:ee.y},y.current={id:B,x:ee.x,y:ee.y},M.currentTarget.setPointerCapture?.(M.pointerId)},[e.elements,r,j]),U=S.useCallback(M=>{w.current!==null&&cancelAnimationFrame(w.current),w.current=requestAnimationFrame(()=>{M(),w.current=null})},[]),G=S.useCallback(M=>{if(E&&R.current){const B=M.clientX-R.current.startX,ee=M.clientY-R.current.startY;T({x:R.current.x+B,y:R.current.y+ee});return}if(E&&N.current&&h.current){const B=M.clientX-N.current.x,ee=M.clientY-N.current.y;h.current.scrollLeft=N.current.scrollLeft-B,h.current.scrollTop=N.current.scrollTop-ee;return}if(m.current){const{id:B,startX:ee,startY:ae,elX:ie,elY:fe}=m.current,K=M.clientX,ce=M.clientY;U(()=>{const te=(K-ee)/s,le=(ce-ae)/s,ge=Math.max(0,ie+te),Y=Math.max(0,fe+le),_e=is(ge),Oe=is(Y),Ve=document.getElementById(`element-${B}`);Ve&&(Ve.style.left=`${_e}px`,Ve.style.top=`${Oe}px`),y.current={id:B,x:_e,y:Oe}})}if(g.current){const{id:B,corner:ee,startX:ae,startY:ie,w:fe,h:K,elX:ce,elY:te}=g.current,le=M.clientX,ge=M.clientY;U(()=>{const Y=(le-ae)/s,_e=(ge-ie)/s;let Oe=fe,Ve=K,nt=ce,lt=te;ee.includes("e")&&(Oe=Math.max(20,fe+Y)),ee.includes("w")&&(Oe=Math.max(20,fe-Y),nt=ce+Y),ee.includes("s")&&(Ve=Math.max(12,K+_e)),ee.includes("n")&&(Ve=Math.max(12,K-_e),lt=te+_e);const nr=is(Oe),ir=is(Ve),hr=is(nt),Rt=is(lt),$t=document.getElementById(`element-${B}`);$t&&($t.style.width=`${nr}px`,$t.style.height=`${ir}px`,$t.style.left=`${hr}px`,$t.style.top=`${Rt}px`),y.current={id:B,width:nr,height:ir,x:hr,y:Rt}})}if(b.current&&o){const{edge:B,startX:ee,startY:ae,startW:ie,startH:fe}=b.current,K=M.clientX,ce=M.clientY;U(()=>{const te=(K-ee)/s,le=(ce-ae)/s,ge=tM(te,e.unit),Y=tM(le,e.unit);if(B==="bottom"){const _e=Math.max(1,fe+Y);o({height:_e})}else{const _e=Math.max(1,ie+ge);o({width:_e})}})}},[E,o,s,e.unit,U]),q=S.useCallback(()=>{E&&(A(!1),N.current=null,R.current=null),w.current!==null&&(cancelAnimationFrame(w.current),w.current=null);const M=m.current?.id||g.current?.id;if(M){const B=document.getElementById(`element-${M}`);B&&(B.classList.remove("z-50","opacity-90","shadow-xl","ring-2","ring-blue-400","ring-offset-2"),B.style.cursor="")}if(y.current){const{id:B,...ee}=y.current;n(B,ee),y.current=null}m.current=null,g.current=null,b.current=null},[n]);S.useEffect(()=>{const M=ee=>{ee.code==="Space"&&!ee.repeat&&O(!0)},B=ee=>{ee.code==="Space"&&(O(!1),A(!1),N.current=null,R.current=null)};return window.addEventListener("keydown",M),window.addEventListener("keyup",B),()=>{window.removeEventListener("keydown",M),window.removeEventListener("keyup",B)}},[]),S.useEffect(()=>{const M=h.current;if(!M)return;const B=()=>{M.scrollLeft=Math.max(0,(M.scrollWidth-M.clientWidth)/2),M.scrollTop=Math.max(0,(M.scrollHeight-M.clientHeight)/2)},ee=requestAnimationFrame(B),ae=setTimeout(B,100);return()=>{cancelAnimationFrame(ee),clearTimeout(ae)}},[s,I,F]);const H=S.useCallback(M=>{if(!t)return;if(M.key==="Delete"||M.key==="Backspace"){M.preventDefault();const fe=e.elements.findIndex(K=>K.id===t);if(fe>=0){const K=e.elements.filter(ce=>ce.id!==t);i(t),r(K[fe]?.id??K[fe-1]?.id??null)}return}const B=e.elements.find(fe=>fe.id===t);if(!B)return;const ee=M.shiftKey?1:Pc;let ae=0,ie=0;switch(M.key){case"ArrowLeft":ae=-ee;break;case"ArrowRight":ae=ee;break;case"ArrowUp":ie=-ee;break;case"ArrowDown":ie=-ee;break;default:return}M.key==="ArrowDown"&&(ie=ee),M.preventDefault(),n(B.id,{x:Math.max(0,B.x+ae),y:Math.max(0,B.y+ie)})},[t,e.elements,n,i,r]),V=()=>r(null),D=M=>{(j||M.button===1)&&(M.preventDefault(),A(!0),N.current={x:M.clientX,y:M.clientY,scrollLeft:h.current?.scrollLeft||0,scrollTop:h.current?.scrollTop||0},M.currentTarget.setPointerCapture(M.pointerId))},Z=M=>{if(E&&N.current&&h.current){const B=M.clientX-N.current.x,ee=M.clientY-N.current.y;h.current.scrollLeft=N.current.scrollLeft-B,h.current.scrollTop=N.current.scrollTop-ee}},J=M=>{E&&(A(!1),N.current=null)};return d.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden bg-gray-100",children:[d.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:[d.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Label Preview"}),d.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l&&d.jsx("button",{type:"button",onClick:l,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:"预览"}),o&&d.jsxs(d.Fragment,{children:[d.jsxs(Je,{value:(()=>{const M=Vb.findIndex(B=>B.width===e.width&&B.height===e.height&&B.unit===e.unit);return M>=0?String(M):"custom"})(),onValueChange:M=>{if(M==="custom")return;const B=Vb[Number(M)];B&&o({width:B.width,height:B.height,unit:B.unit})},children:[d.jsx(tt,{className:"h-8 w-[130px] text-xs",children:d.jsx(et,{placeholder:"画布大小"})}),d.jsxs(rt,{children:[Vb.map((M,B)=>d.jsx(Ee,{value:String(B),className:"text-xs",children:M.name},B)),d.jsx(Ee,{value:"custom",className:"text-xs text-gray-500",children:"自定义"})]})]}),d.jsx("button",{type:"button",onClick:()=>o({showGrid:!L}),className:Re("h-8 px-3 rounded border text-xs font-medium shadow-sm transition-colors",L?"border-gray-300 bg-white text-gray-700 hover:bg-gray-50":"border-gray-300 bg-gray-100 text-gray-500"),children:L?"隐藏网格":"显示网格"})]}),d.jsxs("div",{className:"flex items-center gap-1 bg-white rounded border border-gray-300 p-0.5 shadow-sm h-8",children:[d.jsx("button",{type:"button",onClick:f,disabled:!f,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:"−"}),d.jsxs("span",{className:"min-w-[3rem] text-center text-xs text-gray-600 font-medium",children:[Math.round(s*100),"%"]}),d.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:"+"})]})]})]}),d.jsx("div",{ref:h,className:Re("flex-1 overflow-auto bg-gray-100 relative",j?"cursor-grab active:cursor-grabbing":""),onClick:V,onPointerDown:D,onPointerMove:Z,onPointerUp:J,onPointerLeave:J,children:d.jsx("div",{style:{minWidth:"100%",minHeight:"100%",width:"fit-content",height:"fit-content",display:"flex",padding:50,boxSizing:"border-box",transform:`translate(${C.x}px, ${C.y}px)`},children:d.jsxs("div",{ref:p,tabIndex:0,className:Re("relative bg-white shadow-lg border border-dashed border-gray-300 origin-top-left outline-none m-auto",E?"cursor-grabbing":"cursor-grab"),style:{width:I,height:F,transform:`scale(${s})`,backgroundImage:L?`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:L?`${Pc}px ${Pc}px`:void 0,pointerEvents:j?"none":"auto"},onPointerDown:M=>{const B=M.target,ee=B.closest('[id^="element-"]'),ae=B.closest('[title*="拖拽拉高"]')||B.closest('[title*="拖拽拉宽"]');p.current?.contains(B)&&!ee&&!ae&&!m.current&&!g.current&&(M.preventDefault(),M.stopPropagation(),A(!0),R.current={x:C.x,y:C.y,startX:M.clientX,startY:M.clientY},N.current={x:M.clientX,y:M.clientY,scrollLeft:h.current?.scrollLeft??0,scrollTop:h.current?.scrollTop??0},M.currentTarget.setPointerCapture?.(M.pointerId))},onPointerMove:G,onPointerUp:q,onKeyDown:H,children:[e.showRuler&&d.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]}),o&&d.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:M=>{M.stopPropagation(),b.current={edge:"bottom",startX:M.clientX,startY:M.clientY,startW:e.width,startH:e.height},M.target.setPointerCapture?.(M.pointerId)},children:"⋮"}),o&&d.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:M=>{M.stopPropagation(),b.current={edge:"right",startX:M.clientX,startY:M.clientY,startW:e.width,startH:e.height},M.target.setPointerCapture?.(M.pointerId)},children:"⋮"}),e.elements.map(M=>d.jsxs("div",{id:`element-${M.id}`,className:Re("absolute box-border cursor-move overflow-hidden transition-shadow",M.border==="line"&&"border border-gray-400",M.border==="dotted"&&"border border-dotted border-gray-400",t===M.id&&"ring-2 ring-blue-500 ring-offset-1 z-10"),style:{left:M.x,top:M.y,width:M.width,height:M.height},onClick:B=>{B.stopPropagation(),r(M.id)},onPointerDown:B=>$(B,M.id),children:[d.jsx(f4,{el:M}),t===M.id&&d.jsxs(d.Fragment,{children:[["nw","ne","sw","se"].map(B=>d.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:B.startsWith("n")?-6:void 0,bottom:B.startsWith("s")?-6:void 0,left:B.endsWith("w")?-6:void 0,right:B.endsWith("e")?-6:void 0},onPointerDown:ee=>{ee.stopPropagation();const ae=e.elements.find(ie=>ie.id===M.id);g.current={id:M.id,corner:B,startX:ee.clientX,startY:ee.clientY,w:ae.width,h:ae.height,elX:ae.x,elY:ae.y},ee.currentTarget.setPointerCapture?.(ee.pointerId)}},B)),["n","s","w","e"].map(B=>d.jsx("div",{className:"absolute bg-blue-500/50 border border-white/50 rounded-sm z-10 shadow-sm hover:bg-blue-600",style:{cursor:B==="n"||B==="s"?"ns-resize":"ew-resize",width:B==="n"||B==="s"?"20px":"6px",height:B==="n"||B==="s"?"6px":"20px",top:B==="n"?-3:B==="s"?void 0:"50%",bottom:B==="s"?-3:void 0,left:B==="w"?-3:B==="e"?void 0:"50%",right:B==="e"?-3:void 0,transform:B==="n"||B==="s"?"translateX(-50%)":"translateY(-50%)"},onPointerDown:ee=>{ee.stopPropagation();const ae=e.elements.find(fe=>fe.id===M.id),ie=document.getElementById(`element-${M.id}`);ie&&ie.classList.add("z-50","opacity-90"),g.current={id:M.id,corner:B,startX:ee.clientX,startY:ee.clientY,w:ae.width,h:ae.height,elX:ae.x,elY:ae.y},ee.currentTarget.setPointerCapture?.(ee.pointerId)}},B))]})]},M.id))]})})})]})}function Tle({template:e,maxWidth:t=480}){const r=_p(e.width,e.unit),n=_p(e.height,e.unit),i=t?Math.min(t/r,t/n,2):1,o=r*i,s=n*i;return d.jsx("div",{className:"flex items-center justify-center p-4 bg-gray-100 rounded",children:d.jsx("div",{style:{width:o,height:s},className:"relative bg-white shadow-lg overflow-hidden",children:d.jsx("div",{className:"origin-top-left",style:{position:"absolute",left:0,top:0,width:r,height:n,transform:`scale(${i})`,transformOrigin:"0 0"},children:e.elements.map(u=>d.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:d.jsx(f4,{el:u})},u.id))})})})}var kle=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rle=kle.reduce((e,t)=>{const r=Zw(`Primitive.${t}`),n=S.forwardRef((i,o)=>{const{asChild:s,...u}=i,f=s?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(f,{...u,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Mle="Label",d4=S.forwardRef((e,t)=>d.jsx(Rle.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));d4.displayName=Mle;var Ile=d4;function me({className:e,...t}){return d.jsx(Ile,{"data-slot":"label",className:Re("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 Pm="Switch",[Dle]=Bn(Pm),[Lle,$le]=Dle(Pm),h4=S.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:i,defaultChecked:o,required:s,disabled:u,value:f="on",onCheckedChange:l,form:h,...p}=e,[m,g]=S.useState(null),b=Ze(t,E=>g(E)),y=S.useRef(!1),w=m?h||!!m.closest("form"):!0,[j,O]=Mi({prop:i,defaultProp:o??!1,onChange:l,caller:Pm});return d.jsxs(Lle,{scope:r,checked:j,disabled:u,children:[d.jsx(Ue.button,{type:"button",role:"switch","aria-checked":j,"aria-required":s,"data-state":g4(j),"data-disabled":u?"":void 0,disabled:u,value:f,...p,ref:b,onClick:Ie(e.onClick,E=>{O(A=>!A),w&&(y.current=E.isPropagationStopped(),y.current||E.stopPropagation())})}),w&&d.jsx(v4,{control:m,bubbles:!y.current,name:n,value:f,checked:j,required:s,disabled:u,form:h,style:{transform:"translateX(-100%)"}})]})});h4.displayName=Pm;var p4="SwitchThumb",m4=S.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=$le(p4,r);return d.jsx(Ue.span,{"data-state":g4(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});m4.displayName=p4;var Ble="SwitchBubbleInput",v4=S.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...i},o)=>{const s=S.useRef(null),u=Ze(s,o),f=y_(r),l=d_(t);return S.useEffect(()=>{const h=s.current;if(!h)return;const p=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(p,"checked").set;if(f!==r&&g){const b=new Event("click",{bubbles:n});g.call(h,r),h.dispatchEvent(b)}},[f,r,n]),d.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:u,style:{...i.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});v4.displayName=Ble;function g4(e){return e?"checked":"unchecked"}var Fle=h4,zle=m4;function mn({className:e,...t}){return d.jsx(Fle,{"data-slot":"switch",className:Re("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:d.jsx(zle,{"data-slot":"switch-thumb",className:Re("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 qle({template:e,selectedElement:t,onTemplateChange:r,onElementChange:n,onDeleteElement:i}){return t?d.jsxs("div",{className:"w-72 shrink-0 border-l border-gray-200 bg-white flex flex-col h-full",children:[d.jsx("div",{className:"px-3 py-2 border-b border-gray-200 font-semibold text-gray-800",children:"Properties (Element)"}),d.jsx(_s,{className:"flex-1",children:d.jsxs("div",{className:"p-3 space-y-3",children:[d.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"X"}),d.jsx(Se,{type:"number",value:t.x,onChange:o=>n(t.id,{x:Number(o.target.value)||0}),className:"h-8 text-sm"})]}),d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Y"}),d.jsx(Se,{type:"number",value:t.y,onChange:o=>n(t.id,{y:Number(o.target.value)||0}),className:"h-8 text-sm"})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Width"}),d.jsx(Se,{type:"number",value:t.width,onChange:o=>n(t.id,{width:Math.max(1,Number(o.target.value)||0)}),className:"h-8 text-sm"})]}),d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Height"}),d.jsx(Se,{type:"number",value:t.height,onChange:o=>n(t.id,{height:Math.max(1,Number(o.target.value)||0)}),className:"h-8 text-sm"})]})]}),d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Rotation"}),d.jsxs(Je,{value:t.rotation,onValueChange:o=>n(t.id,{rotation:o}),children:[d.jsx(tt,{className:"h-8 text-sm",children:d.jsx(et,{})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"horizontal",children:"horizontal"}),d.jsx(Ee,{value:"vertical",children:"vertical"})]})]})]}),d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Border"}),d.jsxs(Je,{value:t.border,onValueChange:o=>n(t.id,{border:o}),children:[d.jsx(tt,{className:"h-8 text-sm",children:d.jsx(et,{})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"none",children:"none"}),d.jsx(Ee,{value:"line",children:"line"}),d.jsx(Ee,{value:"dotted",children:"dotted"})]})]})]}),d.jsx(Ule,{element:t,onChange:o=>n(t.id,{config:{...t.config,...o}})}),i&&d.jsx("div",{className:"pt-4 border-t border-gray-100",children:d.jsx(we,{variant:"destructive",className:"w-full",onClick:()=>i(t.id),children:"Delete Element"})})]})})]}):d.jsxs("div",{className:"w-72 shrink-0 border-l border-gray-200 bg-white flex flex-col h-full",children:[d.jsx("div",{className:"px-3 py-2 border-b border-gray-200 font-semibold text-gray-800",children:"Properties (Template)"}),d.jsx(_s,{className:"flex-1",children:d.jsxs("div",{className:"p-3 space-y-3",children:[d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Template Name"}),d.jsx(Se,{value:e.name,onChange:o=>r({name:o.target.value}),className:"h-8 text-sm mt-1"})]}),d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Label Type"}),d.jsxs(Je,{value:e.labelType,onValueChange:o=>r({labelType:o}),children:[d.jsx(tt,{className:"h-8 text-sm mt-1",children:d.jsx(et,{})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"PRICE",children:"PRICE"}),d.jsx(Ee,{value:"NUTRITION",children:"NUTRITION"}),d.jsx(Ee,{value:"SHIPPING",children:"SHIPPING"})]})]})]}),d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Applied Location"}),d.jsxs(Je,{value:e.appliedLocation,onValueChange:o=>r({appliedLocation:o}),children:[d.jsx(tt,{className:"h-8 text-sm mt-1",children:d.jsx(et,{})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"ALL",children:"All Locations"}),d.jsx(Ee,{value:"loc-a",children:"Location A"}),d.jsx(Ee,{value:"loc-b",children:"Location B"})]})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Width"}),d.jsx(Se,{type:"number",value:e.width,onChange:o=>r({width:Math.max(.1,Number(o.target.value)||0)}),className:"h-8 text-sm"})]}),d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Height"}),d.jsx(Se,{type:"number",value:e.height,onChange:o=>r({height:Math.max(.1,Number(o.target.value)||0)}),className:"h-8 text-sm"})]})]}),d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Unit"}),d.jsxs(Je,{value:e.unit,onValueChange:o=>r({unit:o}),children:[d.jsx(tt,{className:"h-8 text-sm mt-1",children:d.jsx(et,{})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"cm",children:"cm"}),d.jsx(Ee,{value:"inch",children:"inch"})]})]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(mn,{checked:e.showRuler,onCheckedChange:o=>r({showRuler:o})}),d.jsx(me,{className:"text-xs",children:"Show Ruler"})]})]})})]})}function Ule({element:e,onChange:t}){const r=e.config,n=(i,o)=>t({[i]:o});switch(e.type){case"TEXT_STATIC":case"TEXT_PRODUCT":case"TEXT_PRICE":return d.jsxs(d.Fragment,{children:[d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Text"}),d.jsx(Se,{value:r.text??"",onChange:i=>n("text",i.target.value),className:"h-8 text-sm mt-1"})]}),d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Font Size"}),d.jsx(Se,{type:"number",value:r.fontSize??14,onChange:i=>n("fontSize",Number(i.target.value)||14),className:"h-8 text-sm mt-1"})]}),d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Text Align"}),d.jsxs(Je,{value:r.textAlign??"left",onValueChange:i=>n("textAlign",i),children:[d.jsx(tt,{className:"h-8 text-sm mt-1",children:d.jsx(et,{})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"left",children:"Left"}),d.jsx(Ee,{value:"center",children:"Center"}),d.jsx(Ee,{value:"right",children:"Right"})]})]})]})]});case"BARCODE":return d.jsxs(d.Fragment,{children:[d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Data"}),d.jsx(Se,{value:r.data??"",onChange:i=>n("data",i.target.value),className:"h-8 text-sm mt-1"})]}),d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"方向"}),d.jsxs(Je,{value:r.orientation??"horizontal",onValueChange:i=>n("orientation",i),children:[d.jsx(tt,{className:"h-8 text-sm mt-1",children:d.jsx(et,{})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"horizontal",children:"水平"}),d.jsx(Ee,{value:"vertical",children:"竖排"})]})]})]})]});case"QRCODE":return d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Data (URL)"}),d.jsx(Se,{value:r.data??"",onChange:i=>n("data",i.target.value),className:"h-8 text-sm mt-1"})]});case"WEIGHT":return d.jsxs("div",{children:[d.jsx(me,{className:"text-xs",children:"Value"}),d.jsx(Se,{type:"number",value:r.value??0,onChange:i=>n("value",Number(i.target.value)||0),className:"h-8 text-sm mt-1"})]});default:return d.jsxs("div",{className:"text-xs text-gray-500",children:["Config for ",e.type," (edit in code if needed)"]})}}const Wle=.5,Hle=2,rM=.25,Vle=1;function Gle({templateId:e,initialTemplate:t,onClose:r,onSaved:n}){const[i,o]=S.useState(()=>t?{...t}:ise(e??void 0)),[s,u]=S.useState(null),[f,l]=S.useState(Vle),[h,p]=S.useState(!1),m=i.elements.find(E=>E.id===s)??null,g=S.useCallback((E,A)=>{const N=ose(E,30,30);A&&Object.keys(A).length>0&&(N.config={...N.config,...A}),o(C=>({...C,elements:[...C.elements,N]})),u(N.id)},[]),b=S.useCallback((E,A)=>{o(N=>({...N,elements:N.elements.map(C=>C.id===E?{...C,...A}:C)}))},[]),y=S.useCallback(E=>{o(A=>({...A,elements:A.elements.filter(N=>N.id!==E)})),u(null)},[]),w=S.useCallback(E=>{o(A=>({...A,...E}))},[]),j=S.useCallback(()=>{sse(i),n(),r()},[i,n,r]),O=S.useCallback(()=>{const E=new Blob([JSON.stringify(i,null,2)],{type:"application/json"}),A=URL.createObjectURL(E),N=document.createElement("a");N.href=A,N.download=`label-template-${i.id}.json`,N.click(),URL.revokeObjectURL(A)},[i]);return d.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[d.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200 bg-white shrink-0",children:[d.jsxs(we,{variant:"outline",size:"sm",onClick:r,children:[d.jsx(T8,{className:"w-4 h-4 mr-1"}),"Back"]}),d.jsx("span",{className:"text-sm font-medium text-gray-700 truncate flex-1",children:i.name}),d.jsxs(we,{size:"sm",onClick:O,variant:"outline",children:[d.jsx(Ww,{className:"w-4 h-4 mr-1"}),"Export JSON"]}),d.jsxs(we,{size:"sm",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:j,children:[d.jsx(jF,{className:"w-4 h-4 mr-1"}),"Save"]})]}),d.jsxs("div",{className:"flex flex-1 min-h-0",children:[d.jsx(Rse,{onAddElement:g}),d.jsx(Cle,{template:i,selectedId:s,onSelect:u,onUpdateElement:b,onDeleteElement:y,onTemplateChange:w,scale:f,onZoomIn:()=>l(E=>Math.min(Hle,E+rM)),onZoomOut:()=>l(E=>Math.max(Wle,E-rM)),onPreview:()=>p(!0)}),d.jsx(_r,{open:h,onOpenChange:p,children:d.jsxs(dr,{className:"max-w-[90vw] max-h-[90vh] overflow-auto",children:[d.jsx(jr,{children:d.jsx(Or,{children:"标签预览"})}),d.jsx(Tle,{template:i,maxWidth:500})]})}),d.jsx(qle,{template:i,selectedElement:m,onTemplateChange:w,onElementChange:b,onDeleteElement:y})]})]})}function Kle(){const[e,t]=S.useState(()=>Jk()),[r,n]=S.useState("list"),[i,o]=S.useState(null),[s,u]=S.useState(""),[f,l]=S.useState("all"),h=S.useCallback(()=>{t(Jk())},[]);S.useEffect(()=>{r==="list"&&h()},[r,h]);const p=e.filter(y=>{const w=!s||y.name.toLowerCase().includes(s.toLowerCase()),j=f==="all"||y.appliedLocation===f;return w&&j}),m=()=>{},g=y=>{o(y),n("editor")},b=()=>{n("list"),o(null)};if(r==="editor"){const y=i?N3(i):null;return d.jsx("div",{className:"h-[calc(100vh-8rem)] min-h-[500px] flex flex-col",children:d.jsx(Gle,{templateId:i,initialTemplate:y,onClose:b,onSaved:h})})}return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[d.jsx(Se,{placeholder:"Search",style:{height:40,boxSizing:"border-box"},className:"bg-white border border-gray-300 rounded-md w-40 shrink-0 placeholder:text-gray-500",value:s,onChange:y=>u(y.target.value)}),d.jsxs(Je,{value:f,onValueChange:l,children:[d.jsx(tt,{className:"bg-white border border-gray-300 rounded-md w-[200px] shrink-0",style:{height:40,boxSizing:"border-box"},children:d.jsx(et,{placeholder:"Location"})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"all",children:"All Locations"}),d.jsx(Ee,{value:"ALL",children:"ALL"}),d.jsx(Ee,{value:"loc-a",children:"Location A"}),d.jsx(Ee,{value:"loc-b",children:"Location B"})]})]}),d.jsxs(we,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0 ml-auto",onClick:m,children:["New Label Template ",d.jsx(Rr,{className:"ml-1 w-4 h-4"})]})]}),d.jsxs("div",{className:"text-red-600 font-bold italic text-sm md:text-base",children:["***One or more templates have incomplete labels attached to them.",d.jsx("br",{}),"Go to Labels view to see which labels are missing fields."]}),d.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:d.jsxs(br,{children:[d.jsx(wr,{children:d.jsxs(Ge,{className:"bg-gray-50 hover:bg-gray-50",children:[d.jsx(ye,{className:"font-bold text-gray-900 w-[180px]",children:"Label Template"}),d.jsx(ye,{className:"font-bold text-gray-900 w-[120px]",children:"Location"}),d.jsx(ye,{className:"font-bold text-gray-900",children:"Contents"}),d.jsx(ye,{className:"font-bold text-gray-900 w-[150px]",children:"Size"}),d.jsx(ye,{className:"font-bold text-gray-900 w-[100px]",children:"Actions"})]})}),d.jsx(Sr,{children:p.length===0?d.jsx(Ge,{children:d.jsx(ue,{colSpan:5,className:"text-center text-gray-500 py-8",children:'No templates yet. Click "New Label Template" to create one.'})}):p.map(y=>d.jsxs(Ge,{className:"hover:bg-gray-50 cursor-pointer",onClick:()=>g(y.id),children:[d.jsx(ue,{className:"font-medium",children:y.name}),d.jsx(ue,{children:y.appliedLocation}),d.jsxs(ue,{className:"text-sm text-gray-600",children:[y.elements.length," element(s)"]}),d.jsxs(ue,{children:[y.width,"×",y.height," ",y.unit]}),d.jsx(ue,{onClick:w=>w.stopPropagation(),children:d.jsxs(we,{variant:"outline",size:"sm",onClick:()=>g(y.id),children:[d.jsx(eh,{className:"w-3 h-3 mr-1"}),"Edit"]})})]},y.id))})]})})]})}function Xle(){const e=[{id:1,name:"Prepped By",contents:"A. Smith; B. Doe; C. Borne",lastEdited:"2025.12.03.11:45"},{id:2,name:"Checked By",contents:"D. Manager; E. Supervisor",lastEdited:"2025.12.04.09:30"},{id:3,name:"Allergens",contents:"Peanuts; Dairy; Gluten; Soy",lastEdited:"2025.12.05.14:15"}];return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[d.jsx(Se,{placeholder:"Search",style:{height:40,boxSizing:"border-box"},className:"bg-white border border-gray-300 rounded-md w-40 shrink-0 placeholder:text-gray-500"}),d.jsxs(Je,{defaultValue:"all",children:[d.jsx(tt,{className:"bg-white border border-gray-300 rounded-md w-[200px] shrink-0",style:{height:40,boxSizing:"border-box"},children:d.jsx(et,{placeholder:"Location"})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"all",children:"All Locations"}),d.jsx(Ee,{value:"loc-a",children:"Location A"}),d.jsx(Ee,{value:"loc-b",children:"Location B"})]})]}),d.jsxs(we,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0 ml-auto",children:["New Multiple Options ",d.jsx(Rr,{className:"ml-1 h-4 w-4"})]})]}),d.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:d.jsxs(br,{children:[d.jsx(wr,{children:d.jsxs(Ge,{className:"bg-gray-50 hover:bg-gray-50",children:[d.jsx(ye,{className:"font-bold text-gray-900 w-[200px]",children:"Multiple Option Name"}),d.jsx(ye,{className:"font-bold text-gray-900",children:"Contents"}),d.jsx(ye,{className:"font-bold text-gray-900 w-[180px]",children:"Last Edited"})]})}),d.jsx(Sr,{children:e.map(t=>d.jsxs(Ge,{className:"hover:bg-gray-50",children:[d.jsx(ue,{className:"font-medium",children:t.name}),d.jsx(ue,{className:"text-gray-600",children:t.contents}),d.jsx(ue,{className:"text-gray-500 tabular-nums font-numeric",children:t.lastEdited})]},t.id))})]})})]})}function Yle({currentView:e="Labels",onViewChange:t}){const r=["Labels","Label Categories","Label Types","Label Templates","Multiple Options"],n=i=>{t&&t(i)};return d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"w-full border-b border-gray-200",children:d.jsx("div",{className:"flex overflow-x-auto bg-white",children:r.map(i=>d.jsx("div",{onClick:()=>n(i),style:e===i?{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===i?"text-blue-600":"border-b-2 border-b-transparent text-gray-600 hover:text-gray-800"}`,children:i},i))})}),d.jsxs("div",{className:"min-h-[400px]",children:[e==="Labels"&&d.jsx(Qae,{}),e==="Label Categories"&&d.jsx(Zae,{}),e==="Label Types"&&d.jsx(Jae,{}),e==="Label Templates"&&d.jsx(Kle,{}),e==="Multiple Options"&&d.jsx(Xle,{}),!["Labels","Label Categories","Label Types","Label Templates","Multiple Options"].includes(e)&&d.jsxs("div",{className:"flex items-center justify-center h-64 text-gray-400",children:[e," content coming soon..."]})]})]})}function Qle(){const[e,t]=S.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=i=>{t(o=>o.map(s=>s.id===i?{...s,isOpen:!s.isOpen}:s))},n=(i,o)=>{t(s=>s.map(u=>u.id!==i?u:{...u,subcategories:u.subcategories.map(f=>f.id===o?{...f,isOpen:!f.isOpen}:f)}))};return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Se,{className:"bg-white border border-black rounded-md h-10 w-[150px]"}),d.jsx("span",{className:"text-sm text-black whitespace-nowrap",children:"Search"})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Je,{defaultValue:"all",children:[d.jsx(tt,{className:"bg-white border border-black rounded-md h-10 w-[100px]",children:d.jsx(et,{placeholder:"Location"})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"all",children:"all"}),d.jsx(Ee,{value:"loc-a",children:"Location A"})]})]}),d.jsx("span",{className:"text-sm text-black whitespace-nowrap",children:"Location"})]})]}),d.jsxs("div",{className:"bg-gray-100 p-2 flex justify-between items-center border-b border-gray-200",children:[d.jsx("h1",{className:"text-xl font-medium text-gray-700",children:"Information"}),d.jsxs("div",{className:"flex items-center gap-4 text-gray-600",children:[d.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"}),d.jsx(TF,{className:"h-5 w-5"}),d.jsx("span",{className:"font-medium",children:"55789"})]})]}),d.jsxs("div",{className:"space-y-4",children:[d.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:[d.jsx(Rr,{className:"h-4 w-4"}),"New Category",d.jsx(oh,{className:"h-4 w-4 opacity-70"})]}),d.jsx("div",{className:"space-y-4",children:e.map(i=>d.jsxs("div",{className:"border border-gray-300 rounded-sm overflow-hidden",children:[d.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:[d.jsxs("button",{onClick:()=>r(i.id),className:"flex items-center gap-2 text-gray-700 font-medium text-sm flex-1 text-left",children:[i.isOpen?d.jsx(xs,{className:"h-4 w-4 text-[#2c7bb6]"}):d.jsx(bs,{className:"h-4 w-4 text-[#2c7bb6]"}),i.name]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{className:"text-gray-400 hover:text-gray-600",children:d.jsx(eh,{className:"h-4 w-4"})}),d.jsx("button",{className:"text-red-400 hover:text-red-600",children:d.jsx(xc,{className:"h-4 w-4"})})]})]}),i.isOpen&&d.jsxs("div",{className:"p-2 space-y-3 bg-white",children:[d.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:[d.jsx(Rr,{className:"h-4 w-4"}),"New Subcategory",d.jsx(oh,{className:"h-4 w-4 opacity-70"})]}),d.jsxs("div",{className:"space-y-3",children:[i.subcategories.map(o=>d.jsxs("div",{className:"border border-gray-200 rounded-sm",children:[d.jsxs("div",{className:"bg-white border-b border-gray-200 p-2 flex items-center justify-between",children:[d.jsxs("button",{onClick:()=>n(i.id,o.id),className:"flex items-center gap-2 text-gray-700 font-medium text-sm flex-1 text-left",children:[o.isOpen?d.jsx(xs,{className:"h-4 w-4 text-[#2c7bb6]"}):d.jsx(bs,{className:"h-4 w-4 text-[#2c7bb6]"}),o.name]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{className:"text-gray-400 hover:text-gray-600",children:d.jsx(eh,{className:"h-4 w-4"})}),d.jsx("button",{className:"text-red-400 hover:text-red-600",children:d.jsx(xc,{className:"h-4 w-4"})})]})]}),o.isOpen&&d.jsxs("div",{className:"p-3 bg-gray-50/50",children:[d.jsx("div",{className:"mb-2 text-xs font-bold text-gray-500 uppercase tracking-wide",children:"Files"}),d.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 justify-end",children:[d.jsx(we,{size:"sm",className:"h-8 bg-[#4CAF50] hover:bg-[#43a047] text-white text-xs border-none rounded-sm",children:"Upload Your Own File(s)"}),d.jsx(we,{size:"sm",className:"h-8 bg-[#4CAF50] hover:bg-[#43a047] text-white text-xs border-none rounded-sm",children:"Create A Custom File"}),d.jsx(we,{size:"sm",className:"h-8 bg-[#2c7bb6] hover:bg-[#256b9e] text-white text-xs border-none rounded-sm",children:"Edit File Permissions"}),d.jsxs(we,{size:"sm",className:"h-8 bg-[#2c7bb6] hover:bg-[#256b9e] text-white text-xs border-none rounded-sm gap-1",children:["Sort (A-Z) ",d.jsx(R8,{className:"h-3 w-3"})]})]}),d.jsx("div",{className:"space-y-1",children:o.files.length>0?o.files.map(s=>d.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:[d.jsx("div",{className:"flex-shrink-0 mr-3",children:s.type==="image"?d.jsx(Jo,{className:"h-5 w-5 text-[#2c7bb6]"}):d.jsx(ws,{className:"h-5 w-5 text-[#2c7bb6]"})}),d.jsx("div",{className:"flex-1 min-w-0",children:d.jsx("div",{className:"font-medium text-gray-700 truncate",children:s.name})}),d.jsx("div",{className:"text-xs text-gray-500 mr-4 whitespace-nowrap",children:s.date}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("button",{className:"p-1 text-gray-400 hover:text-gray-600 bg-white border border-gray-300 rounded-sm",children:d.jsx(ws,{className:"h-3 w-3"})}),d.jsx("button",{className:"p-1 text-gray-400 hover:text-gray-600 bg-white border border-gray-300 rounded-sm",children:d.jsx(eh,{className:"h-3 w-3"})}),d.jsx("button",{className:"p-1 text-red-400 hover:text-red-600 bg-white border border-gray-300 rounded-sm",children:d.jsx(xc,{className:"h-3 w-3"})})]})]},s.id)):d.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"})})]})]},o.id)),i.subcategories.length===0&&d.jsx("div",{className:"p-2 text-sm text-gray-400 italic",children:"No subcategories"})]})]})]},i.id))})]})]})}const Zle=[{id:1,title:"Coffee - 2 hrs",subtitle:"1 min - Completes at 12:05 PM",totalTime:7200,remainingTime:0,status:"expired",icon:Q8},{id:2,title:"Clean Tablet",subtitle:"1 hrs - Completes at 12:37 PM",totalTime:3600,remainingTime:237,status:"running",icon:MF},{id:3,title:"Replace Sanitizer Towels",subtitle:"1 hrs - Completes at 12:37 PM",totalTime:3600,remainingTime:238,status:"running",icon:Nc},{id:4,title:"Take Out Trash",subtitle:"1 hrs - Completes at 01:03 PM",totalTime:3600,remainingTime:58,status:"running",icon:Nc},{id:5,title:"Change Utensils",subtitle:"1 hrs - Completes at 01:03 PM",totalTime:3600,remainingTime:58,status:"running",icon:KF},{id:6,title:"Sanitize Surfaces",subtitle:"1 hrs - Completes at 02:00 PM",totalTime:3600,remainingTime:2157,status:"running",icon:Ag},{id:7,title:"Check Temperatures",subtitle:"1 hrs - Completes at 02:00 PM",totalTime:3600,remainingTime:2158,status:"running",icon:Ag},{id:8,title:"Ranch 4 hrs",subtitle:"4 hrs - Completes at 04:04 PM",totalTime:14400,remainingTime:2158,status:"running",icon:Ag}];function Jle({timer:e}){const t=(e.totalTime-e.remainingTime)/e.totalTime*100,r=e.remainingTime===0,n=i=>{if(i<=0)return"0s";const o=Math.floor(i/60),s=i%60;return`${o.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`};return d.jsxs("div",{className:"bg-gray-200 rounded-xl p-4 flex flex-col items-center relative shadow-sm h-[280px]",children:[d.jsxs("div",{className:"text-center mb-2",children:[d.jsx("h3",{className:"text-lg font-medium text-gray-800 leading-tight",children:e.title}),d.jsx("p",{className:"text-xs text-gray-500 mt-1",children:e.subtitle})]}),d.jsxs("div",{className:"relative w-32 h-32 my-auto flex items-center justify-center",children:[d.jsxs("svg",{className:"w-full h-full transform -rotate-90",children:[d.jsx("circle",{cx:"64",cy:"64",r:"56",stroke:"white",strokeWidth:"12",fill:"transparent"}),d.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"})]}),d.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[d.jsx("span",{className:Re("text-3xl font-bold",r?"text-red-500":"text-gray-800"),children:r?"0s":n(e.remainingTime)}),d.jsx("span",{className:Re("text-[10px] font-medium uppercase mt-1",r?"text-red-400":"text-gray-400"),children:"Remaining"})]})]}),d.jsxs("div",{className:"w-full flex justify-between items-end mt-2",children:[d.jsx(yF,{className:"w-5 h-5 text-blue-700 fill-current"}),d.jsx("div",{className:"flex flex-col items-center",children:d.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:d.jsx(e.icon,{className:"w-5 h-5"})})}),d.jsx("div",{className:"flex flex-col items-end",children:d.jsx("span",{className:"text-xs text-blue-600 font-bold mb-2 cursor-pointer",children:"EDIT"})})]}),d.jsx("button",{className:"absolute bottom-12 right-4 bg-blue-600 rounded-full p-1 text-white hover:bg-blue-700 shadow-md",children:d.jsx(xc,{className:"w-4 h-4"})})]})}function ece(){const[e,t]=S.useState(!0);return d.jsxs("div",{className:"h-full flex flex-col bg-gray-50 relative",children:[d.jsxs("div",{className:"bg-white border-b border-gray-200 px-4 py-3 flex items-center justify-between shadow-sm z-10",children:[d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsxs("button",{className:"flex items-center text-blue-500 text-lg font-medium",children:[d.jsx(uM,{className:"w-6 h-6"}),"Back"]}),d.jsx(hF,{className:"w-6 h-6 text-gray-500"})]}),d.jsxs("div",{className:"flex flex-col items-center",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"bg-blue-600 p-1.5 rounded-md",children:d.jsx(LF,{className:"w-5 h-5 text-white"})}),d.jsx("h1",{className:"text-xl font-bold text-blue-900",children:"Timers"})]}),d.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 font-medium",children:[d.jsx("span",{children:"86016"}),d.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"})]})]}),d.jsxs("div",{className:"flex items-center gap-4 text-blue-500 font-medium",children:[d.jsx(HF,{className:"w-6 h-6 text-gray-400"}),d.jsxs("button",{className:"flex items-center gap-1",children:[d.jsx(Rr,{className:"w-5 h-5"}),"Add Timer"]})]})]}),d.jsxs("div",{className:"bg-gray-700 text-white px-6 py-2 flex items-center justify-between",children:[d.jsx("div",{className:"flex-1"})," ",d.jsx("div",{className:"font-medium",children:"Today, December 15"}),d.jsxs("div",{className:"flex-1 flex justify-end items-center gap-4",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(nF,{className:"w-5 h-5 text-gray-300"}),d.jsx(lF,{className:"w-5 h-5 text-gray-500"})]}),d.jsx(P8,{className:"w-5 h-5 text-blue-400"})]})]}),d.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:d.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Zle.map(r=>d.jsx(Jle,{timer:r},r.id))})}),e&&d.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-[1px]",children:d.jsx("div",{className:"bg-black text-white rounded-xl shadow-2xl w-[600px] max-w-full overflow-hidden border border-gray-800",children:d.jsxs("div",{className:"p-8 text-center space-y-6",children:[d.jsx("h2",{className:"text-3xl font-medium text-blue-500",children:"Coffee - 2 hrs"}),d.jsxs("div",{className:"space-y-4 py-4",children:[d.jsx("p",{className:"text-2xl font-light",children:"Timer expired at 12:05 PM"}),d.jsx("p",{className:"text-2xl font-light",children:"Please discard the coffee"})]}),d.jsx("div",{className:"flex justify-end",children:d.jsx("span",{className:"bg-gray-200 text-black text-[10px] px-1 rounded-sm opacity-50",children:"TACT_Img_Timer-Notification@2x"})}),d.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-8",children:[d.jsx(we,{onClick:()=>t(!1),className:"bg-blue-700 hover:bg-blue-600 text-white h-14 text-xl font-medium rounded-lg",children:"Mute"}),d.jsx(we,{onClick:()=>t(!1),className:"bg-blue-600 hover:bg-blue-500 text-white h-14 text-xl font-medium rounded-lg",children:"Restart"}),d.jsx(we,{onClick:()=>t(!1),className:"bg-blue-800 hover:bg-blue-700 text-white h-14 text-xl font-medium rounded-lg",children:"Acknowledge"})]})]})})})]})}var Kb="rovingFocusGroup.onEntryFocus",tce={bubbles:!1,cancelable:!0},Tu="RovingFocusGroup",[Mw,y4,rce]=y$(Tu),[nce,x4]=Bn(Tu,[rce]),[ice,oce]=nce(Tu),b4=S.forwardRef((e,t)=>d.jsx(Mw.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(Mw.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(ace,{...e,ref:t})})}));b4.displayName=Tu;var ace=S.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:f,onEntryFocus:l,preventScrollOnEntryFocus:h=!1,...p}=e,m=S.useRef(null),g=Ze(t,m),b=Ep(o),[y,w]=Mi({prop:s,defaultProp:u??null,onChange:f,caller:Tu}),[j,O]=S.useState(!1),E=fr(l),A=y4(r),N=S.useRef(!1),[C,T]=S.useState(0);return S.useEffect(()=>{const R=m.current;if(R)return R.addEventListener(Kb,E),()=>R.removeEventListener(Kb,E)},[E]),d.jsx(ice,{scope:r,orientation:n,dir:b,loop:i,currentTabStopId:y,onItemFocus:S.useCallback(R=>w(R),[w]),onItemShiftTab:S.useCallback(()=>O(!0),[]),onFocusableItemAdd:S.useCallback(()=>T(R=>R+1),[]),onFocusableItemRemove:S.useCallback(()=>T(R=>R-1),[]),children:d.jsx(Ue.div,{tabIndex:j||C===0?-1:0,"data-orientation":n,...p,ref:g,style:{outline:"none",...e.style},onMouseDown:Ie(e.onMouseDown,()=>{N.current=!0}),onFocus:Ie(e.onFocus,R=>{const I=!N.current;if(R.target===R.currentTarget&&I&&!j){const F=new CustomEvent(Kb,tce);if(R.currentTarget.dispatchEvent(F),!F.defaultPrevented){const L=A().filter(H=>H.focusable),$=L.find(H=>H.active),U=L.find(H=>H.id===y),q=[$,U,...L].filter(Boolean).map(H=>H.ref.current);_4(q,h)}}N.current=!1}),onBlur:Ie(e.onBlur,()=>O(!1))})})}),w4="RovingFocusGroupItem",S4=S.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:o,children:s,...u}=e,f=Jn(),l=o||f,h=oce(w4,r),p=h.currentTabStopId===l,m=y4(r),{onFocusableItemAdd:g,onFocusableItemRemove:b,currentTabStopId:y}=h;return S.useEffect(()=>{if(n)return g(),()=>b()},[n,g,b]),d.jsx(Mw.ItemSlot,{scope:r,id:l,focusable:n,active:i,children:d.jsx(Ue.span,{tabIndex:p?0:-1,"data-orientation":h.orientation,...u,ref:t,onMouseDown:Ie(e.onMouseDown,w=>{n?h.onItemFocus(l):w.preventDefault()}),onFocus:Ie(e.onFocus,()=>h.onItemFocus(l)),onKeyDown:Ie(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){h.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const j=cce(w,h.orientation,h.dir);if(j!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let E=m().filter(A=>A.focusable).map(A=>A.ref.current);if(j==="last")E.reverse();else if(j==="prev"||j==="next"){j==="prev"&&E.reverse();const A=E.indexOf(w.currentTarget);E=h.loop?uce(E,A+1):E.slice(A+1)}setTimeout(()=>_4(E))}}),children:typeof s=="function"?s({isCurrentTabStop:p,hasTabStop:y!=null}):s})})});S4.displayName=w4;var sce={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function lce(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function cce(e,t,r){const n=lce(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return sce[n]}function _4(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function uce(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var fce=b4,dce=S4,Nm="Tabs",[hce]=Bn(Nm,[x4]),j4=x4(),[pce,j_]=hce(Nm),O4=S.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:u,activationMode:f="automatic",...l}=e,h=Ep(u),[p,m]=Mi({prop:n,onChange:i,defaultProp:o??"",caller:Nm});return d.jsx(pce,{scope:r,baseId:Jn(),value:p,onValueChange:m,orientation:s,dir:h,activationMode:f,children:d.jsx(Ue.div,{dir:h,"data-orientation":s,...l,ref:t})})});O4.displayName=Nm;var E4="TabsList",P4=S.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...i}=e,o=j_(E4,r),s=j4(r);return d.jsx(fce,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:n,children:d.jsx(Ue.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});P4.displayName=E4;var N4="TabsTrigger",A4=S.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:i=!1,...o}=e,s=j_(N4,r),u=j4(r),f=k4(s.baseId,n),l=R4(s.baseId,n),h=n===s.value;return d.jsx(dce,{asChild:!0,...u,focusable:!i,active:h,children:d.jsx(Ue.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":l,"data-state":h?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:f,...o,ref:t,onMouseDown:Ie(e.onMouseDown,p=>{!i&&p.button===0&&p.ctrlKey===!1?s.onValueChange(n):p.preventDefault()}),onKeyDown:Ie(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&s.onValueChange(n)}),onFocus:Ie(e.onFocus,()=>{const p=s.activationMode!=="manual";!h&&!i&&p&&s.onValueChange(n)})})})});A4.displayName=N4;var C4="TabsContent",T4=S.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:i,children:o,...s}=e,u=j_(C4,r),f=k4(u.baseId,n),l=R4(u.baseId,n),h=n===u.value,p=S.useRef(h);return S.useEffect(()=>{const m=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(m)},[]),d.jsx(Mr,{present:i||h,children:({present:m})=>d.jsx(Ue.div,{"data-state":h?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":f,hidden:!m,id:l,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:m&&o})})});T4.displayName=C4;function k4(e,t){return`${e}-trigger-${t}`}function R4(e,t){return`${e}-content-${t}`}var mce=O4,vce=P4,gce=A4,yce=T4;function M4({className:e,...t}){return d.jsx(mce,{"data-slot":"tabs",className:Re("flex flex-col gap-2",e),...t})}function I4({className:e,...t}){return d.jsx(vce,{"data-slot":"tabs-list",className:Re("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-xl p-[3px] flex",e),...t})}function gs({className:e,...t}){return d.jsx(gce,{"data-slot":"tabs-trigger",className:Re("data-[state=active]:bg-card dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-xl border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function ys({className:e,...t}){return d.jsx(yce,{"data-slot":"tabs-content",className:Re("flex-1 outline-none",e),...t})}const xce=[{id:"cat1",name:"Dairy",type:"color",value:"#bfdbfe",status:"active"},{id:"cat2",name:"Meat",type:"image",value:"meat.png",status:"active"},{id:"cat3",name:"Bakery",type:"text",value:"Bakery",status:"active"}],bce=[{id:"prod1",locationId:"12345",categoryId:"cat1",categoryName:"Dairy",name:"Whole Milk",productId:"2222222",barcode:"123456789",barcodeType:"EAN-13",status:"active",appearance:{type:"text",value:"Whole Milk"}},{id:"prod2",locationId:"12345",categoryId:"cat2",categoryName:"Meat",name:"Ground Beef",productId:"3333333",barcode:"113456789",barcodeType:"UPC-A",status:"active",appearance:{type:"color",value:"#ef4444"}},{id:"prod3",locationId:"67890",categoryId:"cat3",categoryName:"Bakery",name:"Croissant",productId:"4444444",barcode:"998877665",barcodeType:"EAN-8",status:"inactive",appearance:{type:"image",value:"croissant.jpg"}}];function wce(){const[e,t]=S.useState("products"),[r,n]=S.useState(bce),[i,o]=S.useState(xce),[s,u]=S.useState(!1),[f,l]=S.useState(!1);return d.jsxs("div",{className:"h-full flex flex-col",children:[d.jsxs("div",{className:"pb-4",children:[d.jsxs("div",{className:"flex flex-nowrap items-center gap-3 flex-wrap",children:[d.jsxs("div",{className:"flex items-center w-40 shrink-0 rounded-md border border-gray-300 bg-white overflow-hidden",style:{height:40},children:[d.jsx(Vw,{className:"h-4 w-4 text-gray-400 shrink-0 ml-2.5 pointer-events-none"}),d.jsx(Se,{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 placeholder:text-gray-500"})]}),d.jsxs(Je,{defaultValue:"partner-a",children:[d.jsx(tt,{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:d.jsx(et,{placeholder:"Partner"})}),d.jsx(rt,{children:d.jsx(Ee,{value:"partner-a",children:"Partner A"})})]}),d.jsxs(Je,{defaultValue:"group-b",children:[d.jsx(tt,{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:d.jsx(et,{placeholder:"Group"})}),d.jsx(rt,{children:d.jsx(Ee,{value:"group-b",children:"Group B"})})]}),d.jsxs(Je,{defaultValue:"loc-12345",children:[d.jsx(tt,{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:d.jsx(et,{placeholder:"Location"})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"loc-12345",children:"Location 12345"}),d.jsx(Ee,{value:"all",children:"All Locations"})]})]}),d.jsxs(Je,{children:[d.jsx(tt,{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:d.jsx(et,{placeholder:"Category"})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"all",children:"All Categories"}),i.map(h=>d.jsx(Ee,{value:h.id,children:h.name},h.id))]})]}),d.jsx("div",{className:"flex-1 min-w-2"}),d.jsxs(we,{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:[d.jsx(UF,{className:"w-4 h-4"})," Bulk Import"]}),d.jsxs(we,{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:[d.jsx(Ww,{className:"w-4 h-4"})," Bulk Export"]}),d.jsxs(we,{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:[d.jsx(co,{className:"w-4 h-4"})," Bulk Edit"]}),e==="products"?d.jsxs(we,{className:"h-10 rounded-md bg-blue-600 text-white hover:bg-blue-700 font-medium gap-1 shrink-0",onClick:()=>u(!0),children:["New Product ",d.jsx(Rr,{className:"w-4 h-4"})]}):d.jsxs(we,{className:"h-10 rounded-md bg-blue-600 text-white hover:bg-blue-700 font-medium gap-1 shrink-0",onClick:()=>l(!0),children:["New Category ",d.jsx(Rr,{className:"w-4 h-4"})]})]}),d.jsx("div",{className:"w-full border-b border-gray-200 mt-4",children:d.jsxs("div",{className:"flex overflow-x-auto w-fit",children:[d.jsx("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"}),d.jsx("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"})]})})]}),d.jsx("div",{className:"flex-1 overflow-auto pt-6",children:e==="products"?d.jsx("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden",children:d.jsxs(br,{children:[d.jsx(wr,{children:d.jsxs(Ge,{className:"bg-gray-100 hover:bg-gray-100",children:[d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Location ID"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Product Category"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Product"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Product ID"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Product Barcode"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Status"}),d.jsx(ye,{className:"text-gray-900 font-bold text-center",children:"Actions"})]})}),d.jsx(Sr,{children:r.map(h=>d.jsxs(Ge,{children:[d.jsx(ue,{className:"border-r font-numeric",children:h.locationId}),d.jsx(ue,{className:"border-r text-gray-900 font-medium",children:h.categoryName}),d.jsx(ue,{className:"border-r text-gray-900 font-medium",children:d.jsxs("div",{className:"flex items-center gap-2",children:[h.appearance.type==="color"&&d.jsx("div",{className:"w-4 h-4 rounded-full border border-gray-300 shadow-sm",style:{backgroundColor:h.appearance.value}}),h.appearance.type==="image"&&d.jsx(Jo,{className:"w-4 h-4 text-gray-500"}),h.name]})}),d.jsx(ue,{className:"border-r font-numeric text-gray-600",children:h.productId}),d.jsx(ue,{className:"border-r font-numeric",children:d.jsxs("div",{className:"flex flex-col",children:[d.jsx("span",{className:"text-xs text-gray-400",children:h.barcodeType}),d.jsx("span",{children:h.barcode})]})}),d.jsx(ue,{className:"border-r",children:d.jsx(Gn,{variant:h.status==="active"?"default":"secondary",className:h.status==="active"?"bg-green-600":"bg-gray-400",children:h.status})}),d.jsx(ue,{className:"text-center",children:d.jsx(we,{variant:"ghost",size:"icon",className:"h-8 w-8",children:d.jsx(Hw,{className:"h-4 w-4"})})})]},h.id))})]})}):d.jsx("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden",children:d.jsxs(br,{children:[d.jsx(wr,{children:d.jsxs(Ge,{className:"bg-gray-100 hover:bg-gray-100",children:[d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Category Name"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Display Type"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Preview"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Status"}),d.jsx(ye,{className:"text-gray-900 font-bold text-center",children:"Actions"})]})}),d.jsx(Sr,{children:i.map(h=>d.jsxs(Ge,{children:[d.jsx(ue,{className:"border-r font-medium",children:h.name}),d.jsx(ue,{className:"border-r capitalize",children:h.type}),d.jsxs(ue,{className:"border-r",children:[h.type==="color"&&d.jsx("div",{className:"w-8 h-8 rounded-md border border-gray-200 shadow-sm",style:{backgroundColor:h.value}}),h.type==="image"&&d.jsx("div",{className:"w-8 h-8 bg-gray-100 flex items-center justify-center rounded-md border border-gray-200",children:d.jsx(Jo,{className:"w-4 h-4 text-gray-500"})}),h.type==="text"&&d.jsx("div",{className:"w-auto px-2 py-1 bg-gray-100 rounded-md border border-gray-200 text-xs font-medium inline-block",children:h.value})]}),d.jsx(ue,{className:"border-r",children:d.jsx(Gn,{variant:h.status==="active"?"default":"secondary",className:h.status==="active"?"bg-green-600":"bg-gray-400",children:h.status})}),d.jsx(ue,{className:"text-center",children:d.jsx(we,{variant:"ghost",size:"icon",className:"h-8 w-8",children:d.jsx(co,{className:"h-4 w-4"})})})]},h.id))})]})})}),d.jsx(Sce,{open:s,onOpenChange:u,categories:i}),d.jsx(_ce,{open:f,onOpenChange:l})]})}function Sce({open:e,onOpenChange:t,categories:r}){const[n,i]=S.useState("text");return d.jsx(_r,{open:e,onOpenChange:t,children:d.jsxs(dr,{className:"sm:max-w-[600px] max-h-[90vh] overflow-y-auto",children:[d.jsxs(jr,{children:[d.jsx(Or,{children:"Add New Product"}),d.jsx(xn,{children:"Create a new product. Fill in the details below."})]}),d.jsxs("div",{className:"grid gap-6 py-4",children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Product Category"}),d.jsxs(Je,{children:[d.jsx(tt,{children:d.jsx(et,{placeholder:"Select Category"})}),d.jsx(rt,{children:r.map(o=>d.jsx(Ee,{value:o.id,children:o.name},o.id))})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Product Name"}),d.jsx(Se,{placeholder:"e.g. Whole Milk"})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Product ID"}),d.jsx(Se,{placeholder:"Internal ID"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Status"}),d.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[d.jsx(mn,{defaultChecked:!0}),d.jsx("span",{className:"text-sm text-gray-500",children:"Active"})]})]})]}),d.jsxs("div",{className:"space-y-3 p-4 bg-gray-50 rounded-md border border-gray-100",children:[d.jsxs(me,{className:"flex items-center gap-2",children:[d.jsx(D8,{className:"w-4 h-4"})," Barcode Settings"]}),d.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[d.jsx("div",{className:"col-span-1",children:d.jsxs(Je,{defaultValue:"ean13",children:[d.jsx(tt,{children:d.jsx(et,{placeholder:"Format"})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"ean13",children:"EAN-13"}),d.jsx(Ee,{value:"upc-a",children:"UPC-A"}),d.jsx(Ee,{value:"code128",children:"Code 128"}),d.jsx(Ee,{value:"qr",children:"QR Code"})]})]})}),d.jsx("div",{className:"col-span-2",children:d.jsx(Se,{placeholder:"Barcode Value"})})]}),d.jsx(we,{variant:"link",className:"px-0 text-xs h-auto",children:"+ Add another barcode standard"})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsx(me,{children:"App Appearance"}),d.jsxs(M4,{value:n,onValueChange:i,className:"w-full",children:[d.jsxs(I4,{className:"grid w-full grid-cols-3",children:[d.jsxs(gs,{value:"text",className:"flex items-center gap-2",children:[d.jsx(Op,{className:"w-3 h-3"})," Text"]}),d.jsxs(gs,{value:"color",className:"flex items-center gap-2",children:[d.jsx(pM,{className:"w-3 h-3"})," Color"]}),d.jsxs(gs,{value:"image",className:"flex items-center gap-2",children:[d.jsx(Jo,{className:"w-3 h-3"})," Image"]})]}),d.jsxs(ys,{value:"text",className:"mt-4 space-y-2",children:[d.jsx(me,{children:"Display Text"}),d.jsx(Se,{placeholder:"Text to display on button"})]}),d.jsxs(ys,{value:"color",className:"mt-4 space-y-2",children:[d.jsx(me,{children:"Select Color"}),d.jsxs("div",{className:"flex gap-2 flex-wrap",children:[["#ef4444","#f97316","#f59e0b","#84cc16","#10b981","#06b6d4","#3b82f6","#6366f1","#a855f7","#ec4899"].map(o=>d.jsx("button",{className:"w-8 h-8 rounded-full border border-gray-200 shadow-sm hover:scale-110 transition-transform",style:{backgroundColor:o}},o)),d.jsx("button",{className:"w-8 h-8 rounded-full border border-dashed border-gray-400 flex items-center justify-center hover:bg-gray-50",children:d.jsx(Rr,{className:"w-4 h-4 text-gray-400"})})]})]}),d.jsxs(ys,{value:"image",className:"mt-4 space-y-2",children:[d.jsx(me,{children:"Upload Image"}),d.jsxs("div",{className:"border-2 border-dashed border-gray-300 rounded-md p-6 flex flex-col items-center justify-center text-gray-500 hover:bg-gray-50 cursor-pointer",children:[d.jsx(Jo,{className:"w-8 h-8 mb-2 opacity-50"}),d.jsx("span",{className:"text-xs",children:"Click to upload or drag and drop"})]})]})]})]}),d.jsxs("div",{className:"space-y-3 pt-2 border-t border-gray-100",children:[d.jsx(me,{children:"Store Availability"}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx("input",{type:"radio",id:"all-stores",name:"scope",className:"text-blue-600 focus:ring-blue-500",defaultChecked:!0}),d.jsx("label",{htmlFor:"all-stores",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"All Stores in Group"})]}),d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx("input",{type:"radio",id:"specific-stores",name:"scope",className:"text-blue-600 focus:ring-blue-500"}),d.jsx("label",{htmlFor:"specific-stores",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Specific Location(s)"})]})]}),d.jsx("div",{className:"pl-6 pt-2",children:d.jsx(Je,{disabled:!0,children:d.jsx(tt,{className:"h-8 text-sm",children:d.jsx(et,{placeholder:"Select Locations..."})})})})]})]}),d.jsxs(Dr,{children:[d.jsx(we,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),d.jsx(we,{onClick:()=>t(!1),className:"bg-blue-600 hover:bg-blue-700 text-white",children:"Create Product"})]})]})})}function _ce({open:e,onOpenChange:t}){const[r,n]=S.useState("text");return d.jsx(_r,{open:e,onOpenChange:t,children:d.jsxs(dr,{className:"sm:max-w-[500px]",children:[d.jsxs(jr,{children:[d.jsx(Or,{children:"Add New Category"}),d.jsx(xn,{children:"Create a product category to organize your items."})]}),d.jsxs("div",{className:"grid gap-6 py-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Category Name"}),d.jsx(Se,{placeholder:"e.g. Dairy, Meat, Bakery"})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsx(me,{children:"Button Appearance"}),d.jsxs(M4,{value:r,onValueChange:n,className:"w-full",children:[d.jsxs(I4,{className:"grid w-full grid-cols-3",children:[d.jsxs(gs,{value:"text",className:"flex items-center gap-2",children:[d.jsx(Op,{className:"w-3 h-3"})," Text"]}),d.jsxs(gs,{value:"color",className:"flex items-center gap-2",children:[d.jsx(pM,{className:"w-3 h-3"})," Color"]}),d.jsxs(gs,{value:"image",className:"flex items-center gap-2",children:[d.jsx(Jo,{className:"w-3 h-3"})," Image"]})]}),d.jsxs(ys,{value:"text",className:"mt-4 space-y-2",children:[d.jsx(me,{children:"Display Text"}),d.jsx(Se,{placeholder:"Category Name"})]}),d.jsxs(ys,{value:"color",className:"mt-4 space-y-2",children:[d.jsx(me,{children:"Select Color"}),d.jsxs("div",{className:"flex gap-2 flex-wrap",children:[["#bfdbfe","#bbf7d0","#fecaca","#ddd6fe","#fde68a"].map(i=>d.jsx("button",{className:"w-8 h-8 rounded-full border border-gray-200 shadow-sm hover:scale-110 transition-transform",style:{backgroundColor:i}},i)),d.jsx("button",{className:"w-8 h-8 rounded-full border border-dashed border-gray-400 flex items-center justify-center hover:bg-gray-50",children:d.jsx(Rr,{className:"w-4 h-4 text-gray-400"})})]})]}),d.jsxs(ys,{value:"image",className:"mt-4 space-y-2",children:[d.jsx(me,{children:"Upload Icon/Image"}),d.jsxs("div",{className:"border-2 border-dashed border-gray-300 rounded-md p-6 flex flex-col items-center justify-center text-gray-500 hover:bg-gray-50 cursor-pointer",children:[d.jsx(Jo,{className:"w-8 h-8 mb-2 opacity-50"}),d.jsx("span",{className:"text-xs",children:"Click to upload"})]})]})]})]}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Status"}),d.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[d.jsx(mn,{defaultChecked:!0}),d.jsx("span",{className:"text-sm text-gray-500",children:"Active"})]})]})}),d.jsxs("div",{className:"space-y-3 pt-2 border-t border-gray-100",children:[d.jsx(me,{children:"Store Availability"}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx("input",{type:"radio",id:"cat-all-stores",name:"cat-scope",className:"text-blue-600 focus:ring-blue-500",defaultChecked:!0}),d.jsx("label",{htmlFor:"cat-all-stores",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"All Stores in Group"})]}),d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx("input",{type:"radio",id:"cat-specific-stores",name:"cat-scope",className:"text-blue-600 focus:ring-blue-500"}),d.jsx("label",{htmlFor:"cat-specific-stores",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Specific Location(s)"})]})]})]})]}),d.jsxs(Dr,{children:[d.jsx(we,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),d.jsx(we,{onClick:()=>t(!1),className:"bg-blue-600 hover:bg-blue-700 text-white",children:"Create Category"})]})]})})}function Iw({className:e,...t}){return d.jsx("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:Re("mx-auto flex w-full justify-center",e),...t})}function Dw({className:e,...t}){return d.jsx("ul",{"data-slot":"pagination-content",className:Re("flex flex-row items-center gap-1",e),...t})}function Si({...e}){return d.jsx("li",{"data-slot":"pagination-item",...e})}function fu({className:e,isActive:t,size:r="icon",...n}){return d.jsx("a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:Re(HM({variant:t?"outline":"ghost",size:r}),e),...n})}function Lw({className:e,...t}){return d.jsxs(fu,{"aria-label":"Go to previous page",size:"default",className:Re("gap-1 px-2.5 sm:pl-2.5",e),...t,children:[d.jsx(uM,{}),d.jsx("span",{className:"hidden sm:block",children:"Previous"})]})}function $w({className:e,...t}){return d.jsxs(fu,{"aria-label":"Go to next page",size:"default",className:Re("gap-1 px-2.5 sm:pr-2.5",e),...t,children:[d.jsx("span",{className:"hidden sm:block",children:"Next"}),d.jsx(bs,{})]})}var Am="Checkbox",[jce]=Bn(Am),[Oce,O_]=jce(Am);function Ece(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:i,disabled:o,form:s,name:u,onCheckedChange:f,required:l,value:h="on",internal_do_not_use_render:p}=e,[m,g]=Mi({prop:r,defaultProp:i??!1,onChange:f,caller:Am}),[b,y]=S.useState(null),[w,j]=S.useState(null),O=S.useRef(!1),E=b?!!s||!!b.closest("form"):!0,A={checked:m,disabled:o,setChecked:g,control:b,setControl:y,name:u,form:s,value:h,hasConsumerStoppedPropagationRef:O,required:l,defaultChecked:ho(i)?!1:i,isFormControl:E,bubbleInput:w,setBubbleInput:j};return d.jsx(Oce,{scope:t,...A,children:Pce(p)?p(A):n})}var D4="CheckboxTrigger",L4=S.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},i)=>{const{control:o,value:s,disabled:u,checked:f,required:l,setControl:h,setChecked:p,hasConsumerStoppedPropagationRef:m,isFormControl:g,bubbleInput:b}=O_(D4,e),y=Ze(i,h),w=S.useRef(f);return S.useEffect(()=>{const j=o?.form;if(j){const O=()=>p(w.current);return j.addEventListener("reset",O),()=>j.removeEventListener("reset",O)}},[o,p]),d.jsx(Ue.button,{type:"button",role:"checkbox","aria-checked":ho(f)?"mixed":f,"aria-required":l,"data-state":U4(f),"data-disabled":u?"":void 0,disabled:u,value:s,...n,ref:y,onKeyDown:Ie(t,j=>{j.key==="Enter"&&j.preventDefault()}),onClick:Ie(r,j=>{p(O=>ho(O)?!0:!O),b&&g&&(m.current=j.isPropagationStopped(),m.current||j.stopPropagation())})})});L4.displayName=D4;var $4=S.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:i,defaultChecked:o,required:s,disabled:u,value:f,onCheckedChange:l,form:h,...p}=e;return d.jsx(Ece,{__scopeCheckbox:r,checked:i,defaultChecked:o,disabled:u,required:s,onCheckedChange:l,name:n,form:h,value:f,internal_do_not_use_render:({isFormControl:m})=>d.jsxs(d.Fragment,{children:[d.jsx(L4,{...p,ref:t,__scopeCheckbox:r}),m&&d.jsx(q4,{__scopeCheckbox:r})]})})});$4.displayName=Am;var B4="CheckboxIndicator",F4=S.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...i}=e,o=O_(B4,r);return d.jsx(Mr,{present:n||ho(o.checked)||o.checked===!0,children:d.jsx(Ue.span,{"data-state":U4(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});F4.displayName=B4;var z4="CheckboxBubbleInput",q4=S.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:s,required:u,disabled:f,name:l,value:h,form:p,bubbleInput:m,setBubbleInput:g}=O_(z4,e),b=Ze(r,g),y=y_(o),w=d_(n);S.useEffect(()=>{const O=m;if(!O)return;const E=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(E,"checked").set,C=!i.current;if(y!==o&&N){const T=new Event("click",{bubbles:C});O.indeterminate=ho(o),N.call(O,ho(o)?!1:o),O.dispatchEvent(T)}},[m,y,o,i]);const j=S.useRef(ho(o)?!1:o);return d.jsx(Ue.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??j.current,required:u,disabled:f,name:l,value:h,form:p,...t,tabIndex:-1,ref:b,style:{...t.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});q4.displayName=z4;function Pce(e){return typeof e=="function"}function ho(e){return e==="indeterminate"}function U4(e){return ho(e)?"indeterminate":e?"checked":"unchecked"}function W4({className:e,...t}){return d.jsx($4,{"data-slot":"checkbox",className:Re("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:d.jsx(F4,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:d.jsx(cM,{className:"size-3.5"})})})}function Nce(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))}Array(12).fill(0);let Bw=1;class Ace{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,...i}=t,o=typeof t?.id=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:Bw++,s=this.toasts.find(f=>f.id===o),u=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),s?this.toasts=this.toasts.map(f=>f.id===o?(this.publish({...f,...t,id:o,title:n}),{...f,...t,id:o,dismissible:u,title:n}):f):this.addToast({title:n,...i,dismissible:u,id:o}),o},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 i=Promise.resolve(t instanceof Function?t():t);let o=n!==void 0,s;const u=i.then(async l=>{if(s=["resolve",l],z.isValidElement(l))o=!1,this.create({id:n,type:"default",message:l});else if(Tce(l)&&!l.ok){o=!1;const p=typeof r.error=="function"?await r.error(`HTTP error! status: ${l.status}`):r.error,m=typeof r.description=="function"?await r.description(`HTTP error! status: ${l.status}`):r.description,b=typeof p=="object"&&!z.isValidElement(p)?p:{message:p};this.create({id:n,type:"error",description:m,...b})}else if(l instanceof Error){o=!1;const p=typeof r.error=="function"?await r.error(l):r.error,m=typeof r.description=="function"?await r.description(l):r.description,b=typeof p=="object"&&!z.isValidElement(p)?p:{message:p};this.create({id:n,type:"error",description:m,...b})}else if(r.success!==void 0){o=!1;const p=typeof r.success=="function"?await r.success(l):r.success,m=typeof r.description=="function"?await r.description(l):r.description,b=typeof p=="object"&&!z.isValidElement(p)?p:{message:p};this.create({id:n,type:"success",description:m,...b})}}).catch(async l=>{if(s=["reject",l],r.error!==void 0){o=!1;const h=typeof r.error=="function"?await r.error(l):r.error,p=typeof r.description=="function"?await r.description(l):r.description,g=typeof h=="object"&&!z.isValidElement(h)?h:{message:h};this.create({id:n,type:"error",description:p,...g})}}).finally(()=>{o&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),f=()=>new Promise((l,h)=>u.then(()=>s[0]==="reject"?h(s[1]):l(s[1])).catch(h));return typeof n!="string"&&typeof n!="number"?{unwrap:f}:Object.assign(n,{unwrap:f})},this.custom=(t,r)=>{const n=r?.id||Bw++;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 fn=new Ace,Cce=(e,t)=>{const r=t?.id||Bw++;return fn.addToast({title:e,...t,id:r}),r},Tce=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",kce=Cce,Rce=()=>fn.toasts,Mce=()=>fn.getActiveToasts(),Qe=Object.assign(kce,{success:fn.success,info:fn.info,warning:fn.warning,error:fn.error,custom:fn.custom,message:fn.message,promise:fn.promise,dismiss:fn.dismiss,loading:fn.loading},{getHistory:Rce,getToasts:Mce});Nce("[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%)}");class Ice extends Error{status;payload;constructor(t,r,n){super(t),this.name="ApiError",this.status=r,this.payload=n}}function Dce(e,t){if(!e)return t;const r=e.endsWith("/")?e.slice(0,-1):e,n=t.startsWith("/")?t:`/${t}`;return`${r}${n}`}function Lce(e){const t=new URLSearchParams;for(const[n,i]of Object.entries(e))if(!(i==null||i==="")){if(typeof i=="boolean"){t.set(n,i?"true":"false");continue}t.set(n,String(i))}const r=t.toString();return r?`?${r}`:""}function $ce(e){const r=e?.error?.message?.trim();return r||null}function nM(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;return r&&!n?{...t,totalCount:t.TotalCount,items:t.Items}:!("items"in t)&&Array.isArray(t.data)&&typeof t.totalCount=="number"?{...t,items:t.data}:!("items"in t)&&Array.isArray(t.Data)&&typeof t.TotalCount=="number"?{...t,totalCount:t.TotalCount,items:t.Data}:e}function pl(e={}){const t=e.baseUrl??"http://192.168.31.87:19001"??"http://localhost:19001",r=e.getToken;async function n(i){const o=i.prefix??"/api/app",s=Dce(t,`${o}${i.path}${Lce(i.query??{})}`),u={"Content-Type":"application/json"},f=r?.();f&&(u.Authorization=`Bearer ${f}`);const l=await fetch(s,{method:i.method,headers:u,body:i.body===void 0?void 0:JSON.stringify(i.body),signal:i.signal}),m=(l.headers.get("content-type")??"").includes("application/json")?await l.json().catch(()=>null):await l.text().catch(()=>"");if(!l.ok){const b=$ce(m)??(typeof m=="string"&&m.trim()?m:"Request failed.");throw new Ice(b,l.status,m)}return m&&typeof m=="object"&&"data"in m?nM(m.data??null):nM(m)}return{requestJson:n}}const ku=pl({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Ru="/rbac-menu";function du(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 Bce(e){if(Array.isArray(e))return{items:e.map(du),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(du),totalCount:n}}async function H4(e,t){const r=await ku.requestJson({path:Ru,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword},signal:t});return Bce(r)}function Fw(e){const t=du(e),r=e,n=r?.children??r?.Children,i=Array.isArray(n)?n.map(Fw):void 0;return{...t,children:i}}function Fce(e){if(Array.isArray(e))return e.map(Fw);if(!e||typeof e!="object")return[];const t=e,r=t.items??t.Items??t.data??t.Data;return Array.isArray(r)?r.map(Fw):[]}async function zce(e){const t=await ku.requestJson({path:`${Ru}/tree`,method:"GET",signal:e});return Fce(t)}async function qce(e){const t=new Map;let r=1;const n=500;for(;;){const o=(await H4({skipCount:r,maxResultCount:n},e)).items??[];for(const s of o)s.menuType!==0||!s.id||t.has(s.id)||t.set(s.id,s);if(o.length100))break}return Array.from(t.values()).sort((i,o)=>(i.orderNum??0)-(o.orderNum??0))}async function Uce(e){const t=await ku.requestJson({path:Ru,method:"POST",body:e});return du(t)}async function Wce(e,t){const r=await ku.requestJson({path:`${Ru}/${encodeURIComponent(e)}`,method:"PUT",body:t});return du(r)}async function Hce(e){e.length&&await ku.requestJson({path:Ru,method:"DELETE",body:e})}async function Vce(e){await Hce([e])}const V4=pl({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),G4="/rbac-role-menu";async function Gce(e){await V4.requestJson({path:`${G4}/set`,method:"POST",body:e})}async function Kce(e){await V4.requestJson({path:G4,method:"DELETE",body:e})}const Xce=pl({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Yce="/role";async function K4(e,t){return Xce.requestJson({path:Yce,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,RoleName:e.roleName,RoleCode:e.roleCode,State:e.state},signal:t})}const Cm=pl({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Tm="/rbac-role";async function Qce(e){return Cm.requestJson({path:Tm,method:"POST",body:e})}async function Zce(e,t){return Cm.requestJson({path:`${Tm}/${encodeURIComponent(e)}`,method:"PUT",body:t})}function Jce(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 o=n,s=Array.isArray(o.menuIds)?o.menuIds:Array.isArray(o.MenuIds)?o.MenuIds:void 0;if(s)return s.map(String)}const i=Array.isArray(t.roleMenus)?t.roleMenus:Array.isArray(t.RoleMenus)?t.RoleMenus:void 0;if(Array.isArray(i)){const o=[];for(const s of i){if(!s||typeof s!="object")continue;const u=s,f=u.menuId??u.MenuId??u.id??u.Id;f&&o.push(String(f))}return o}return[]}async function eue(e){e.length&&await Cm.requestJson({path:Tm,method:"DELETE",body:e})}async function tue(e){await eue([e])}async function rue(e,t){const r=await Cm.requestJson({path:`${Tm}/${encodeURIComponent(e)}`,method:"GET",signal:t});return Jce(r)}const km=pl({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}});async function X4(e,t){return km.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 nue(e){return km.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 iue(e,t){return km.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 oue(e){await km.requestJson({path:`/location/${encodeURIComponent(e)}`,method:"DELETE"})}const Mu=pl({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Iu="/team-member";function aue(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,i=n.id??n.Id??n.locationId??n.LocationId??n.location_id??n.locationID;i!=null&&t.push(String(i))}}return t}function sue(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,i=n.locationCode??n.LocationCode??n.code??n.Code??n.location_code??n.locationCodeId,o=n.locationName??n.LocationName??n.name??n.Name??n.location_name,s=n.id??n.Id??n.locationId??n.LocationId,u=i==null?"":String(i).trim(),f=o==null?"":String(o).trim(),l=s==null?"":String(s).trim();u&&f?t.push(`${u} - ${f}`):f?t.push(f):u?t.push(u):l&&t.push(l)}}return t}function Rm(e){if(!e||typeof e!="object")return{id:""};const t=e,r=String(t.id??t.Id??t.userId??t.UserId??""),n=t.fullName??t.FullName??t.name??t.Name,i=t.userName??t.UserName??t.username??t.UserName,o=t.email??t.Email,s=t.phone??t.Phone;let u=t.roleId??t.RoleId,f=t.roleName??t.RoleName??t.roleName??t.Role;const l=t.role??t.Role;if((!u||!f)&&l&&typeof l=="object"){const w=l;u=w.id??w.Id??w.roleId??w.RoleId??u,f=w.roleName??w.RoleName??w.name??w.Name??w.role??w.Role??f}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 g=aue(m);const b=t.locations??t.Locations??t.assignedLocations??t.AssignedLocations??t.locationNames??t.LocationNames;let y=sue(b);if(g.length===0&&Array.isArray(b)){const w=[];for(const j of b){if(typeof j!="object"||!j)continue;const O=j,E=O.id??O.Id??O.locationId??O.LocationId;E!=null&&w.push(String(E))}w.length&&(g=w)}return{id:r,fullName:n,userName:i,email:o,phone:s,roleId:u,roleName:f,locationIds:g,locations:y,state:p??(t.status?String(t.status).toLowerCase()==="active":void 0)}}async function lue(e,t){const r=await Mu.requestJson({path:Iu,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(Rm)}}async function cue(e,t){const r=await Mu.requestJson({path:`${Iu}/${encodeURIComponent(e)}`,method:"GET",signal:t});return Rm(r)}function uue(e){return{fullName:e.fullName,userName:e.userName,password:e.password,email:e.email??null,phone:e.phone??null,roleId:e.roleId,locationIds:e.locationIds,locations:e.locationIds,state:e.state}}function fue(e){const t={fullName:e.fullName,userName:e.userName,email:e.email??null,phone:e.phone??null,roleId:e.roleId,locationIds:e.locationIds,locations:e.locationIds,state:e.state};return e.password&&(t.password=e.password),t}async function due(e){const t=await Mu.requestJson({path:Iu,method:"POST",body:uue(e)});return Rm(t)}async function hue(e,t){const r=await Mu.requestJson({path:`${Iu}/${encodeURIComponent(e)}`,method:"PUT",body:fue(t)});return Rm(r)}async function pue(e){await Mu.requestJson({path:`${Iu}/${encodeURIComponent(e)}`,method:"DELETE"})}const Y4=[{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"}],mue=[{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 vue(){const[e,t]=S.useState("Roles"),[r,n]=S.useState([]),[i,o]=S.useState(0),[s,u]=S.useState(!1),[f,l]=S.useState(0),[h,p]=S.useState(1),[m,g]=S.useState(10),b=Math.max(1,Math.ceil(i/m)),y=S.useRef(null),[w,j]=S.useState(""),O=S.useRef(null),[E,A]=S.useState(""),[N,C]=S.useState(Y4),[T,R]=S.useState(mue),[I,F]=S.useState([]),[L,$]=S.useState(!1),[U,G]=S.useState(0),[q,H]=S.useState(0),[V,D]=S.useState(1),[Z,J]=S.useState(10),M=Math.max(1,Math.ceil(U/Z)),B=S.useRef(null),[ee,ae]=S.useState(""),ie=S.useRef(null),[fe,K]=S.useState(""),[ce,te]=S.useState(null),[le,ge]=S.useState(!1),[Y,_e]=S.useState(null),[Oe,Ve]=S.useState(!1),[nt,lt]=S.useState(null),[nr,ir]=S.useState(!1),[hr,Rt]=S.useState(null),[$t,li]=S.useState(!1),[_o,Bi]=S.useState(null),[$u,ba]=S.useState(!1),[wa,ml]=S.useState(!1),[jo,ci]=S.useState(!1),Lm=()=>{alert(`Exporting ${e} list to PDF...`)};S.useEffect(()=>(O.current&&window.clearTimeout(O.current),O.current=window.setTimeout(()=>A(w.trim()),300),()=>{O.current&&window.clearTimeout(O.current)}),[w]),S.useEffect(()=>(ie.current&&window.clearTimeout(ie.current),ie.current=window.setTimeout(()=>K(ee.trim()),300),()=>{ie.current&&window.clearTimeout(ie.current)}),[ee]),S.useEffect(()=>{p(1)},[E,m]),S.useEffect(()=>{D(1)},[fe,Z]),S.useEffect(()=>e!=="Roles"?void 0:((async()=>{y.current?.abort();const dt=new AbortController;y.current=dt,u(!0);try{const Jt=await K4({skipCount:Math.max(1,h),maxResultCount:m,roleName:E||void 0},dt.signal);n(Jt.items??[]),o(Jt.totalCount??0)}catch(Jt){if(Jt?.name==="AbortError")return;Qe.error("Failed to load roles.",{description:Jt?.message?String(Jt.message):"Please try again."}),n([]),o(0)}finally{u(!1)}})(),()=>y.current?.abort()),[e,E,h,m,f]),S.useEffect(()=>e!=="Team Member"?void 0:((async()=>{B.current?.abort();const dt=new AbortController;B.current=dt,$(!0);try{const Jt=await lue({skipCount:Math.max(1,V),maxResultCount:Z,keyword:fe||void 0},dt.signal);F(Jt.items??[]),G(Jt.totalCount??0)}catch(Jt){if(Jt?.name==="AbortError")return;Qe.error("Failed to load team members.",{description:Jt?.message?String(Jt.message):"Please try again."}),F([]),G(0)}finally{$(!1)}})(),()=>B.current?.abort()),[e,fe,V,Z,q]);const Bu=()=>{switch(e){case"Roles":lt(null),Ve(!0);break;case"Partner":ba(!0);break;case"Group":ml(!0);break;case"Team Member":te(null),ci(!0);break}},Fu=()=>{const ve=e==="Team Member";return d.jsxs("div",{className:"flex flex-col gap-4 pb-4",children:[d.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[d.jsx(Se,{placeholder:"Search",value:e==="Roles"?w:e==="Team Member"?ee:"",onChange:dt=>{e==="Roles"&&j(dt.target.value),e==="Team Member"&&ae(dt.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"}),d.jsx("div",{className:"flex-1"}),ve&&d.jsxs(d.Fragment,{children:[d.jsx(we,{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"}),d.jsx(we,{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"})]}),d.jsx(we,{variant:"outline",onClick:Lm,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)"}),d.jsx(we,{className:"h-10 bg-blue-600 hover:bg-blue-700 text-white rounded-md px-6 font-medium shrink-0",onClick:Bu,children:"New+"})]}),d.jsx("div",{className:"w-full border-b border-gray-200",children:d.jsx("div",{className:"flex overflow-x-auto w-fit",children:["Roles","Partner","Group","Team Member"].map(dt=>d.jsx("button",{onClick:()=>t(dt),style:e===dt?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:Re("px-4 py-2.5 text-sm font-medium whitespace-nowrap cursor-pointer transition-colors -mb-px border-b-2",e===dt?"text-blue-600":"border-b-transparent text-gray-600 hover:text-gray-800"),children:dt},dt))})})]})},$m=()=>{switch(e){case"Roles":return d.jsxs("div",{className:"flex flex-col",children:[d.jsxs(br,{children:[d.jsx(wr,{children:d.jsxs(Ge,{className:"bg-gray-100",children:[d.jsx(ye,{className:"font-bold text-black border-r",children:"Role Name"}),d.jsx(ye,{className:"font-bold text-black border-r",children:"Role Code"}),d.jsx(ye,{className:"font-bold text-black border-r",children:"Status"}),d.jsx(ye,{className:"font-bold text-black border-r",children:"Order"}),d.jsx(ye,{className:"font-bold text-black text-center",children:"Actions"})]})}),d.jsx(Sr,{children:r.length===0?d.jsx(Ge,{children:d.jsx(ue,{colSpan:5,className:"text-center text-sm text-gray-500 py-10",children:s?"Loading...":"No data"})}):r.map(ve=>d.jsxs(Ge,{children:[d.jsx(ue,{className:"font-medium border-r",children:ve.roleName??"N/A"}),d.jsx(ue,{className:"border-r text-gray-600",children:ve.roleCode??"N/A"}),d.jsx(ue,{className:"border-r",children:d.jsx(Gn,{className:ve.state?"bg-green-600":"bg-gray-400",children:ve.state?"Active":"Inactive"})}),d.jsx(ue,{className:"border-r text-gray-600",children:ve.orderNum??"N/A"}),d.jsxs(ue,{className:"text-center",children:[d.jsx(we,{variant:"ghost",size:"sm",onClick:()=>{Rt(ve),ir(!0)},title:"Menu Permissions",children:d.jsx(NF,{className:"w-4 h-4 text-blue-600"})}),d.jsx(we,{variant:"ghost",size:"sm",onClick:()=>{lt(ve),Ve(!0)},children:d.jsx(co,{className:"w-4 h-4 text-gray-500"})}),d.jsx(we,{variant:"ghost",size:"sm",onClick:async()=>{Bi(ve),li(!0)},title:"Delete role",children:d.jsx(Nc,{className:"w-4 h-4 text-red-600"})})]})]},ve.id))})]}),d.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 bg-white flex flex-wrap items-center justify-between gap-3",children:[d.jsxs("div",{className:"text-sm text-gray-600",children:["Showing ",i===0?0:(h-1)*m+1,"-",Math.min(h*m,i)," of ",i]}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs(Je,{value:String(m),onValueChange:ve=>g(Number(ve)),children:[d.jsx(tt,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:d.jsx(et,{})}),d.jsx(rt,{children:[10,20,50].map(ve=>d.jsxs(Ee,{value:String(ve),children:[ve," / page"]},ve))})]}),d.jsx(Iw,{className:"mx-0 w-auto justify-end",children:d.jsxs(Dw,{children:[d.jsx(Si,{children:d.jsx(Lw,{href:"#",size:"default",onClick:ve=>{ve.preventDefault(),p(dt=>Math.max(1,dt-1))},"aria-disabled":h<=1,className:h<=1?"pointer-events-none opacity-50":""})}),d.jsx(Si,{children:d.jsxs(fu,{href:"#",isActive:!0,size:"default",onClick:ve=>ve.preventDefault(),children:["Page ",h," / ",b]})}),d.jsx(Si,{children:d.jsx($w,{href:"#",size:"default",onClick:ve=>{ve.preventDefault(),p(dt=>Math.min(b,dt+1))},"aria-disabled":h>=b,className:h>=b?"pointer-events-none opacity-50":""})})]})})]})]})]});case"Partner":return d.jsxs(br,{children:[d.jsx(wr,{children:d.jsxs(Ge,{className:"bg-gray-100",children:[d.jsx(ye,{className:"font-bold text-black border-r",children:"Partner Name"}),d.jsx(ye,{className:"font-bold text-black border-r",children:"Contact"}),d.jsx(ye,{className:"font-bold text-black border-r",children:"Phone"}),d.jsx(ye,{className:"font-bold text-black border-r",children:"Status"}),d.jsx(ye,{className:"font-bold text-black text-center",children:"Actions"})]})}),d.jsx(Sr,{children:N.map(ve=>d.jsxs(Ge,{children:[d.jsx(ue,{className:"font-medium border-r",children:ve.name}),d.jsx(ue,{className:"border-r",children:ve.contact}),d.jsx(ue,{className:"border-r text-gray-600",children:ve.phone}),d.jsx(ue,{className:"border-r",children:d.jsx(Gn,{className:ve.status==="active"?"bg-green-600":"bg-gray-400",children:ve.status})}),d.jsx(ue,{className:"text-center",children:d.jsx(we,{variant:"ghost",size:"sm",children:d.jsx(co,{className:"w-4 h-4 text-gray-500"})})})]},ve.id))})]});case"Group":return d.jsxs(br,{children:[d.jsx(wr,{children:d.jsxs(Ge,{className:"bg-gray-100",children:[d.jsx(ye,{className:"font-bold text-black border-r",children:"Group Name"}),d.jsx(ye,{className:"font-bold text-black border-r",children:"Parent Partner"}),d.jsx(ye,{className:"font-bold text-black border-r",children:"Status"}),d.jsx(ye,{className:"font-bold text-black text-center",children:"Actions"})]})}),d.jsx(Sr,{children:T.map(ve=>d.jsxs(Ge,{children:[d.jsx(ue,{className:"font-medium border-r",children:ve.name}),d.jsx(ue,{className:"border-r",children:ve.partner}),d.jsx(ue,{className:"border-r",children:d.jsx(Gn,{className:ve.status==="active"?"bg-green-600":"bg-gray-400",children:ve.status})}),d.jsx(ue,{className:"text-center",children:d.jsx(we,{variant:"ghost",size:"sm",children:d.jsx(co,{className:"w-4 h-4 text-gray-500"})})})]},ve.id))})]});case"Team Member":return d.jsxs(d.Fragment,{children:[d.jsxs(br,{children:[d.jsx(wr,{children:d.jsxs(Ge,{className:"bg-gray-100",children:[d.jsx(ye,{className:"font-bold text-black border-r",children:"Name"}),d.jsx(ye,{className:"font-bold text-black border-r",children:"Email"}),d.jsx(ye,{className:"font-bold text-black border-r",children:"Phone"}),d.jsx(ye,{className:"font-bold text-black border-r",children:"Role"}),d.jsx(ye,{className:"font-bold text-black border-r",children:"Assigned Locations"}),d.jsx(ye,{className:"font-bold text-black border-r",children:"Status"}),d.jsx(ye,{className:"font-bold text-black text-center",children:"Actions"})]})}),d.jsx(Sr,{children:L?d.jsx(Ge,{children:d.jsx(ue,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):I.length===0?d.jsx(Ge,{children:d.jsx(ue,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):I.map(ve=>d.jsxs(Ge,{children:[d.jsx(ue,{className:"font-medium border-r",children:ve.fullName??ve.userName??"N/A"}),d.jsx(ue,{className:"border-r text-gray-600",children:ve.email??"N/A"}),d.jsx(ue,{className:"border-r text-gray-600",children:ve.phone??"N/A"}),d.jsx(ue,{className:"border-r",children:d.jsx(Gn,{variant:"outline",className:"font-normal",children:ve.roleName??ve.roleId??"N/A"})}),d.jsx(ue,{className:"border-r",children:d.jsxs("div",{className:"flex flex-col gap-1",children:[(ve.locations?.length?ve.locations:ve.locationIds??[]).map(dt=>d.jsxs("div",{className:"flex items-center gap-1 text-xs text-gray-600",children:[d.jsx(Zs,{className:"w-3 h-3"})," ",dt]},dt)),!ve.locations?.length&&!(ve.locationIds?.length??0)&&d.jsx("div",{className:"text-xs text-gray-500",children:"无"})]})}),d.jsx(ue,{className:"border-r",children:d.jsx(Gn,{className:ve.state?"bg-green-600":"bg-gray-400",children:ve.state?"Active":"Inactive"})}),d.jsx(ue,{className:"text-center",children:d.jsxs("div",{className:"flex items-center justify-center gap-2",children:[d.jsx(we,{variant:"ghost",size:"sm",onClick:()=>{te(ve),ci(!0)},title:"Edit",children:d.jsx(co,{className:"w-4 h-4 text-gray-500"})}),d.jsx(we,{variant:"ghost",size:"sm",onClick:()=>{_e(ve),ge(!0)},title:"Delete",children:d.jsx(Nc,{className:"w-4 h-4 text-red-600"})})]})})]},ve.id))})]}),d.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 bg-white flex flex-wrap items-center justify-between gap-3",children:[d.jsxs("div",{className:"text-sm text-gray-600",children:["Showing ",U===0?0:(V-1)*Z+1,"-",Math.min(V*Z,U)," of ",U]}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs(Je,{value:String(Z),onValueChange:ve=>J(Number(ve)),children:[d.jsx(tt,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:d.jsx(et,{})}),d.jsx(rt,{children:[10,20,50].map(ve=>d.jsxs(Ee,{value:String(ve),children:[ve," / page"]},ve))})]}),d.jsx(Iw,{className:"mx-0 w-auto justify-end",children:d.jsxs(Dw,{children:[d.jsx(Si,{children:d.jsx(Lw,{href:"#",size:"default",onClick:ve=>{ve.preventDefault(),D(dt=>Math.max(1,dt-1))},"aria-disabled":V<=1,className:V<=1?"pointer-events-none opacity-50":""})}),d.jsx(Si,{children:d.jsxs(fu,{href:"#",isActive:!0,size:"default",onClick:ve=>ve.preventDefault(),children:["Page ",V," / ",M]})}),d.jsx(Si,{children:d.jsx($w,{href:"#",size:"default",onClick:ve=>{ve.preventDefault(),D(dt=>Math.min(M,dt+1))},"aria-disabled":V>=M,className:V>=M?"pointer-events-none opacity-50":""})})]})})]})]})]})}};return d.jsxs("div",{className:"h-full flex flex-col",children:[Fu(),d.jsx("div",{className:"flex-1 overflow-auto pt-6",children:d.jsx("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md",children:$m()})}),d.jsx(gue,{open:Oe,role:nt,onOpenChange:ve=>{Ve(ve),ve||lt(null)},onSaved:()=>{p(1),l(ve=>ve+1)}}),d.jsx(yue,{open:nr,role:hr,onOpenChange:ve=>{ir(ve),ve||Rt(null)}}),d.jsx(xue,{open:$t,role:_o,onOpenChange:ve=>{li(ve),ve||Bi(null)},onDeleted:()=>l(ve=>ve+1)}),d.jsx(bue,{open:$u,onOpenChange:ba}),d.jsx(wue,{open:wa,onOpenChange:ml}),d.jsx(Sue,{open:jo,member:ce,onOpenChange:ve=>{ci(ve),ve||te(null)},onSaved:()=>{D(1),H(ve=>ve+1)}}),d.jsx(_ue,{open:le,member:Y,onOpenChange:ve=>{ge(ve),ve||_e(null)},onDeleted:()=>{H(ve=>ve+1)}})]})}function gue({open:e,role:t,onOpenChange:r,onSaved:n}){const i=!!t?.id,[o,s]=S.useState(!1),[u,f]=S.useState(""),[l,h]=S.useState(""),[p,m]=S.useState(""),[g,b]=S.useState(""),[y,w]=S.useState(!0);S.useEffect(()=>{e&&(s(!1),f(t?.roleName??""),h(t?.roleCode??""),m(t?.remark??""),b(t?.orderNum===null||t?.orderNum===void 0?"":String(t.orderNum)),w(t?.state??!0))},[e,t]);const j=S.useMemo(()=>!!(u.trim()&&l.trim()),[u,l]),O=A=>{const N=A.trim();if(!N)return null;const C=Number.parseInt(N,10);return Number.isFinite(C)?C:null},E=async()=>{if(!j){Qe.error("Please fill in required fields.",{description:"Role Name and Role Code are required."});return}s(!0);try{const A={roleName:u.trim(),roleCode:l.trim(),remark:p.trim()?p.trim():null,state:!!y,orderNum:O(g)};i&&t?.id?(await Zce(t.id,A),Qe.success("Role updated.",{description:"Role fields have been saved successfully."})):(await Qce(A),Qe.success("Role created.",{description:"A new role has been created successfully."})),r(!1),n()}catch(A){Qe.error(i?"Failed to update role.":"Failed to create role.",{description:A?.message?String(A.message):"Please try again."})}finally{s(!1)}};return d.jsx(_r,{open:e,onOpenChange:r,children:d.jsxs(dr,{className:"sm:max-w-[600px]",children:[d.jsxs(jr,{children:[d.jsx(Or,{children:i?"Edit Role":"Create Role"}),d.jsx(xn,{children:i?"Update role fields and save changes.":"Fill out the form to create a new role."})]}),d.jsxs("div",{className:"space-y-4 py-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Role Name *"}),d.jsx(Se,{value:u,onChange:A=>f(A.target.value),placeholder:"e.g. Inventory Specialist"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Role Code *"}),d.jsx(Se,{value:l,onChange:A=>h(A.target.value),placeholder:"e.g. inventory_specialist"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Remark"}),d.jsx(Se,{value:p,onChange:A=>m(A.target.value),placeholder:"Optional"})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Order"}),d.jsx(Se,{value:g,onChange:A=>b(A.target.value),placeholder:"e.g. 10"})]}),d.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[d.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),d.jsx(mn,{checked:y,onCheckedChange:w})]})]})]}),d.jsxs(Dr,{children:[d.jsx(we,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),d.jsx(we,{disabled:o,onClick:E,className:"bg-blue-600 text-white hover:bg-blue-700",children:o?"Saving...":"Save"})]})]})})}function yue({open:e,role:t,onOpenChange:r}){const n=t?.id??"",i=t?.roleName??"",[o,s]=S.useState(!1),[u,f]=S.useState([]),[l,h]=S.useState(new Set),[p,m]=S.useState(new Set),[g,b]=S.useState(!1),y=S.useRef(null),[w,j]=S.useState(""),O=S.useRef(null),[E,A]=S.useState("");S.useEffect(()=>(O.current&&window.clearTimeout(O.current),O.current=window.setTimeout(()=>A(w.trim()),300),()=>{O.current&&window.clearTimeout(O.current)}),[w]),S.useEffect(()=>e?(s(!1),m(new Set),h(new Set),(async()=>{y.current?.abort();const H=new AbortController;y.current=H,b(!0);try{const V=await zce(H.signal);if(f(V??[]),n){const D=await rue(n,H.signal);m(new Set(D))}}catch(V){if(V?.name==="AbortError")return;Qe.error("Failed to load menus.",{description:V?.message?String(V.message):"Please try again."}),f([]),m(new Set)}finally{b(!1)}})(),()=>y.current?.abort()):void 0,[e,n]);const N=S.useMemo(()=>{const q=H=>H.reduce((V,D)=>V+1+(D.children?q(D.children):0),0);return q(u)},[u]),C=S.useMemo(()=>{const q=E.trim().toLowerCase();if(!q)return u;const H=D=>{const Z=(D.menuName??"").toLowerCase(),J=(D.routeUrl??"").toLowerCase();return Z.includes(q)||J.includes(q)},V=D=>{const Z=[];for(const J of D){const M=J.children?V(J.children):[];(H(J)||M.length)&&Z.push({...J,children:M.length?M:void 0})}return Z};return V(u)},[u,E]);S.useEffect(()=>{if(!E.trim())return;const H=new Set,V=D=>{for(const Z of D)Z.children?.length&&H.add(Z.id),Z.children?.length&&V(Z.children)};V(C),h(H)},[E,C]);const T=q=>{const H=[],V=D=>{D.id&&H.push(D.id),D.children?.length&&D.children.forEach(V)};return V(q),H},R=q=>{const H=T(q);if(!H.length)return{checked:!1,indeterminate:!1};let V=0;for(const D of H)p.has(D)&&(V+=1);return V===0?{checked:!1,indeterminate:!1}:V===H.length?{checked:!0,indeterminate:!1}:{checked:!1,indeterminate:!0}},I=(q,H)=>{m(V=>{const D=new Set(V),Z=T(q);return H?Z.forEach(J=>D.add(J)):Z.forEach(J=>D.delete(J)),D})},F=q=>{h(H=>{const V=new Set(H);return V.has(q)?V.delete(q):V.add(q),V})},L=q=>{const H=E.trim(),V=q??"";if(!H)return V||"N/A";const D=V.toLowerCase().indexOf(H.toLowerCase());if(D<0)return V||"N/A";const Z=V.slice(0,D),J=V.slice(D,D+H.length),M=V.slice(D+H.length);return d.jsxs("span",{children:[Z,d.jsx("span",{className:"bg-yellow-200 rounded px-0.5",children:J}),M]})},$=({node:q,depth:H})=>{const V=!!q.children?.length,D=l.has(q.id),{checked:Z,indeterminate:J}=R(q);return d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-2 py-1",style:{paddingLeft:H*16},children:[d.jsx("button",{type:"button",className:Re("h-6 w-6 flex items-center justify-center rounded hover:bg-gray-100",!V&&"opacity-0 pointer-events-none"),onClick:()=>V&&F(q.id),"aria-label":V?D?"Collapse":"Expand":"No children",children:V?D?d.jsx(xs,{className:"h-4 w-4"}):d.jsx(bs,{className:"h-4 w-4"}):null}),d.jsx(W4,{id:`perm-menu-${q.id}`,checked:J?"indeterminate":Z,onCheckedChange:M=>I(q,!!M)}),d.jsx("label",{htmlFor:`perm-menu-${q.id}`,className:"text-sm leading-none cursor-pointer select-none",children:L(q.menuName??q.routeUrl??q.id)})]}),V&&D&&d.jsx("div",{children:q.children.map(M=>d.jsx($,{node:M,depth:H+1},M.id))})]})},U=async()=>{if(n){s(!0);try{await Gce({roleId:n,menuIds:Array.from(p)}),Qe.success("Role menu permissions saved.",{description:"Menu permissions have been updated successfully."}),r(!1)}catch(q){Qe.error("Failed to save menu permissions.",{description:q?.message?String(q.message):"Please try again."})}finally{s(!1)}}},G=async()=>{if(!(!n||p.size===0)){s(!0);try{await Kce({roleId:n,menuIds:Array.from(p)}),m(new Set),Qe.success("Role menu permissions cleared.",{description:"Selected permissions have been removed."})}catch(q){Qe.error("Failed to delete menu permissions.",{description:q?.message?String(q.message):"Please try again."})}finally{s(!1)}}};return d.jsx(_r,{open:e,onOpenChange:r,children:d.jsxs(dr,{className:"sm:max-w-none",style:{width:"50%"},children:[d.jsxs(jr,{children:[d.jsx(Or,{children:"Menu Permissions"}),d.jsx(xn,{children:i?`Set menu permissions for role: ${i}`:"Set menu permissions for this role."})]}),d.jsx("div",{className:"space-y-4 py-4",children:d.jsxs("div",{className:"rounded border border-gray-200 bg-white",children:[d.jsx("div",{className:"px-3 py-2 text-xs text-gray-500 border-b border-gray-200",children:d.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[d.jsx("div",{children:g?"Loading menus...":`Total ${N} menus`}),d.jsx(Se,{value:w,onChange:q=>j(q.target.value),placeholder:"Search menus",className:"h-8 w-44 bg-white"})]})}),d.jsx(_s,{className:"h-72",children:d.jsxs("div",{className:"p-3 space-y-2",children:[C.map(q=>d.jsx($,{node:q,depth:0},q.id)),!g&&C.length===0&&d.jsx("div",{className:"text-sm text-gray-500 py-6 text-center",children:"No menus."})]})})]})}),d.jsxs(Dr,{className:"flex flex-row justify-end gap-2",children:[d.jsx(we,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),d.jsx(we,{variant:"destructive",disabled:o||p.size===0||!n,onClick:G,children:"Delete Selected"}),d.jsx(we,{disabled:o||!n,onClick:U,className:"bg-blue-600 text-white hover:bg-blue-700",children:o?"Saving...":"Save"})]})]})})}function xue({open:e,role:t,onOpenChange:r,onDeleted:n}){const[i,o]=S.useState(!1),s=S.useMemo(()=>(t?.roleName??"").trim()||t?.roleCode||t?.id||"this role",[t]),u=async()=>{if(t?.id){o(!0);try{await tue(t.id),Qe.success("Role deleted.",{description:"The role has been removed successfully."}),r(!1),n()}catch(f){Qe.error("Failed to delete role.",{description:f?.message?String(f.message):"Please try again."})}finally{o(!1)}}};return d.jsx(_r,{open:e,onOpenChange:r,children:d.jsxs(dr,{className:"sm:max-w-none",style:{width:"30%"},children:[d.jsxs(jr,{children:[d.jsx(Or,{children:"Delete Role"}),d.jsx(xn,{children:"This action cannot be undone."})]}),d.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",d.jsx("span",{className:"font-medium",children:s}),"?"]}),d.jsxs(Dr,{className:"flex-row flex-wrap justify-end",children:[d.jsx(we,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),d.jsx(we,{className:"min-w-24",variant:"destructive",disabled:i,onClick:u,children:i?"Deleting...":"Delete"})]})]})})}function bue({open:e,onOpenChange:t}){return d.jsx(_r,{open:e,onOpenChange:t,children:d.jsxs(dr,{children:[d.jsx(jr,{children:d.jsx(Or,{children:"Create New Partner"})}),d.jsxs("div",{className:"space-y-4 py-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Partner Name"}),d.jsx(Se,{placeholder:"Company Name"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Contact Email"}),d.jsx(Se,{placeholder:"admin@partner.com"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Phone Number"}),d.jsx(Se,{type:"tel",placeholder:"+1 (555) 000-0000"})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(mn,{id:"partner-status",defaultChecked:!0}),d.jsx(me,{htmlFor:"partner-status",children:"Active"})]})]}),d.jsxs(Dr,{children:[d.jsx(we,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),d.jsx(we,{onClick:()=>t(!1),className:"bg-blue-600 text-white hover:bg-blue-700",children:"Save Partner"})]})]})})}function wue({open:e,onOpenChange:t}){return d.jsx(_r,{open:e,onOpenChange:t,children:d.jsxs(dr,{children:[d.jsx(jr,{children:d.jsx(Or,{children:"Create New Group"})}),d.jsxs("div",{className:"space-y-4 py-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Group Name"}),d.jsx(Se,{placeholder:"e.g. West Coast Region"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Assign to Partner"}),d.jsxs(Je,{children:[d.jsx(tt,{children:d.jsx(et,{placeholder:"Select Partner"})}),d.jsx(rt,{children:Y4.map(r=>d.jsx(Ee,{value:r.id,children:r.name},r.id))})]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(mn,{id:"group-status",defaultChecked:!0}),d.jsx(me,{htmlFor:"group-status",children:"Active"})]})]}),d.jsxs(Dr,{children:[d.jsx(we,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),d.jsx(we,{onClick:()=>t(!1),className:"bg-blue-600 text-white hover:bg-blue-700",children:"Save Group"})]})]})})}function Sue({open:e,member:t,onOpenChange:r,onSaved:n}){const i=!!t?.id,[o,s]=S.useState(!1),[u,f]=S.useState(""),[l,h]=S.useState(""),[p,m]=S.useState(""),[g,b]=S.useState(""),[y,w]=S.useState(""),[j,O]=S.useState(""),[E,A]=S.useState(!0),[N,C]=S.useState(new Set),[T,R]=S.useState([]),[I,F]=S.useState(!1),[L,$]=S.useState([]),[U,G]=S.useState(!1),[q,H]=S.useState(""),V=S.useRef(null),D=()=>{f(""),h(""),m(""),b(""),w(""),O(""),A(!0),C(new Set)},Z=async ie=>{const fe=[];let K=1;const ce=100;for(;;){const le=await K4({skipCount:K,maxResultCount:ce},ie);if(fe.push(...le.items??[]),!le.items||le.items.length200))break}const te=new Map;for(const le of fe)le.id&&!te.has(le.id)&&te.set(le.id,le);return Array.from(te.values())},J=async ie=>{const fe=[];let K=1;const ce=200;for(;;){const le=await X4({skipCount:K,maxResultCount:ce},ie);if(fe.push(...le.items??[]),!le.items||le.items.length200))break}const te=new Map;for(const le of fe)le.id&&!te.has(le.id)&&te.set(le.id,le);return Array.from(te.values())};S.useEffect(()=>{if(!e)return;V.current?.abort();const ie=new AbortController;return V.current=ie,s(!1),D(),F(!0),G(!0),(async()=>{try{const[K,ce]=await Promise.all([Z(ie.signal),J(ie.signal)]);if(R(K),$(ce),t?.id){const te=await cue(t.id,ie.signal);f(te.fullName??""),h(te.userName??""),b(te.email??""),w(te.phone??"");let le=te.roleId??"";if(!le&&te.roleName){const Y=String(te.roleName).trim(),_e=K.find(Oe=>String(Oe.id).trim()===Y||String(Oe.roleName??"").trim()===Y||String(Oe.roleCode??"").trim()===Y);_e?.id&&(le=_e.id)}O(le),A(!!te.state);const ge=te.locationIds&&te.locationIds.length?te.locationIds:[];if(ge.length)C(new Set(ge));else if(te.locations?.length){const Y=new Set(te.locations),_e=new Set;for(const Oe of ce){const Ve=`${(Oe.locationCode??"").trim()} - ${(Oe.locationName??"").trim()}`.trim(),nt=(Oe.locationName??"").trim(),lt=(Oe.locationCode??"").trim();(Y.has(Ve)||Y.has(nt)||Y.has(lt))&&_e.add(Oe.id)}C(_e)}}}catch(K){K?.name!=="AbortError"&&Qe.error("Failed to load user form.",{description:K?.message?String(K.message):"Please try again."})}finally{F(!1),G(!1)}})(),()=>ie.abort()},[e,t?.id]),S.useMemo(()=>!(!u.trim()||!l.trim()||!j.trim()||N.size===0||!i&&!p.trim()),[u,l,j,N,i,p]);const M=(ie,fe)=>{C(K=>{const ce=new Set(K);return fe?ce.add(ie):ce.delete(ie),ce})},B=async()=>{s(!0);try{const ie=[];if(u.trim()||ie.push("Full Name"),l.trim()||ie.push("User Name"),j.trim()||ie.push("Role"),N.size===0&&ie.push("Locations"),!i&&!p.trim()&&ie.push("Password"),ie.length){Qe.error("Missing required fields.",{description:`Please fill: ${ie.join("、")}.`});return}const fe=Array.from(N);if(i&&t?.id)await hue(t.id,{fullName:u.trim(),userName:l.trim(),password:p.trim()?p.trim():null,email:g.trim()?g.trim():null,phone:y.trim()?y.trim():null,roleId:j.trim(),locationIds:fe,state:E}),Qe.success("User updated.",{description:"Changes have been saved successfully."});else{const K={fullName:u.trim(),userName:l.trim(),password:p.trim(),email:g.trim()?g.trim():null,phone:y.trim()?y.trim():null,roleId:j.trim(),locationIds:fe,state:E};await due(K),Qe.success("User created.",{description:"A new user has been created successfully."})}r(!1),n()}catch(ie){Qe.error(i?"Failed to update user.":"Failed to create user.",{description:ie?.message?String(ie.message):"Please try again."})}finally{s(!1)}},ee=ie=>{const fe=(ie.locationCode??"").trim(),K=(ie.locationName??"").trim();return fe&&K?`${fe} - ${K}`:K||fe||ie.id},ae=S.useMemo(()=>{const ie=q.trim().toLowerCase();return ie?L.filter(fe=>ee(fe).toLowerCase().includes(ie)):L},[L,q]);return d.jsx(_r,{open:e,onOpenChange:r,children:d.jsxs(dr,{className:"sm:max-w-none",style:{width:"50%"},children:[d.jsxs(jr,{children:[d.jsx(Or,{children:i?"Edit User":"New User"}),d.jsx(xn,{children:"Role is single-select; Locations is multi-select."})]}),d.jsxs("div",{className:"space-y-4 py-4 max-h-[70vh] overflow-y-auto pr-1",children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Full Name *"}),d.jsx(Se,{value:u,onChange:ie=>f(ie.target.value),placeholder:"John Doe"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"User Name *"}),d.jsx(Se,{value:l,onChange:ie=>h(ie.target.value),placeholder:"username"})]})]}),!i&&d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Password *"}),d.jsx(Se,{type:"password",value:p,onChange:ie=>m(ie.target.value),placeholder:"Enter password",autoComplete:"new-password",className:"w-full"})]}),i&&d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Password (Optional)"}),d.jsx(Se,{type:"password",value:p,onChange:ie=>m(ie.target.value),placeholder:"Enter new password (optional)",autoComplete:"new-password",className:"w-full"})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Email"}),d.jsx(Se,{type:"email",value:g,onChange:ie=>b(ie.target.value),placeholder:"john@example.com"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Phone"}),d.jsx(Se,{type:"tel",value:y,onChange:ie=>w(ie.target.value),placeholder:"+1 (555) 000-0000"})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Role *"}),d.jsxs(Je,{value:j,onValueChange:O,disabled:I,children:[d.jsx(tt,{className:"h-10 rounded-md border border-gray-200 bg-white",children:d.jsx(et,{placeholder:I?"Loading roles...":"Select role"})}),d.jsx(rt,{children:T.map(ie=>d.jsx(Ee,{value:ie.id,children:ie.roleName??ie.roleCode??ie.id},ie.id))})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Locations *"}),d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsx(Se,{value:q,onChange:ie=>H(ie.target.value),placeholder:"Search locations",className:"h-9"}),d.jsxs("div",{className:"text-xs text-gray-500 shrink-0",children:[N.size," selected"]})]}),d.jsx(_s,{className:"h-[180px] w-full border rounded-md p-2",children:d.jsx("div",{className:"space-y-2",children:U?d.jsx("div",{className:"text-sm text-gray-500 py-2",children:"Loading..."}):ae.map(ie=>d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(W4,{id:`loc-${ie.id}`,checked:N.has(ie.id),onCheckedChange:fe=>M(ie.id,!!fe)}),d.jsx("label",{htmlFor:`loc-${ie.id}`,className:"text-sm cursor-pointer w-full hover:bg-gray-50 p-1 rounded",children:ee(ie)})]},ie.id))})}),d.jsx("p",{className:"text-xs text-gray-500",children:"* Users must be assigned to at least one location."})]}),d.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[d.jsx(mn,{id:"member-status",checked:E,onCheckedChange:A}),d.jsx(me,{htmlFor:"member-status",children:E?"Active":"Inactive"})]})]}),d.jsxs(Dr,{children:[d.jsx(we,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),d.jsx(we,{disabled:o,onClick:B,className:"bg-blue-600 text-white hover:bg-blue-700",children:o?"Saving...":i?"Save":"Create"})]})]})})}function _ue({open:e,member:t,onOpenChange:r,onDeleted:n}){const[i,o]=S.useState(!1),s=S.useMemo(()=>{const f=(t?.fullName??"").trim(),l=(t?.userName??"").trim();return f||l||"this user"},[t?.fullName,t?.userName]),u=async()=>{if(t?.id){o(!0);try{await pue(t.id),Qe.success("User deleted.",{description:"The user has been removed successfully."}),r(!1),n()}catch(f){Qe.error("Failed to delete user.",{description:f?.message?String(f.message):"Please try again."})}finally{o(!1)}}};return d.jsx(_r,{open:e,onOpenChange:r,children:d.jsxs(dr,{className:"sm:max-w-none",style:{width:"30%"},children:[d.jsxs(jr,{children:[d.jsx(Or,{children:"Delete User"}),d.jsx(xn,{children:"This action cannot be undone."})]}),d.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",d.jsx("span",{className:"font-medium",children:s}),"?"]}),d.jsxs(Dr,{className:"flex-row flex-wrap justify-end",children:[d.jsx(we,{variant:"outline",className:"min-w-24",onClick:()=>r(!1),children:"Cancel"}),d.jsx(we,{variant:"destructive",className:"min-w-24",disabled:i,onClick:u,children:i?"Deleting...":"Delete"})]})]})})}const jue=[{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"}],Oue=[{name:"Dairy",count:450},{name:"Meat",count:320},{name:"Bakery",count:280},{name:"Deli",count:190},{name:"Produce",count:150},{name:"Beverage",count:120}],Eue=[{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 Pue(){const[e,t]=S.useState("print-log"),r=n=>{Qe.success(`Reprinting label ${n}`,{description:"Watermark 'RePrint' applied."})};return d.jsxs("div",{className:"h-full flex flex-col",children:[d.jsxs("div",{className:"pb-4",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[d.jsxs(Je,{defaultValue:"partner-a",children:[d.jsx(tt,{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:d.jsx(et,{placeholder:"Partner"})}),d.jsx(rt,{children:d.jsx(Ee,{value:"partner-a",children:"Partner A"})})]}),d.jsxs(Je,{defaultValue:"group-b",children:[d.jsx(tt,{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:d.jsx(et,{placeholder:"Group"})}),d.jsx(rt,{children:d.jsx(Ee,{value:"group-b",children:"Group B"})})]}),d.jsxs(Je,{defaultValue:"loc-12345",children:[d.jsx(tt,{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:d.jsx(et,{placeholder:"Location"})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"loc-12345",children:"Downtown Store"}),d.jsx(Ee,{value:"all",children:"All Locations"})]})]}),d.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[d.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Period Search:"}),d.jsxs("div",{className:"flex items-center bg-white border border-gray-300 rounded-md h-10 px-2",style:{minHeight:40},children:[d.jsx($8,{className:"w-4 h-4 text-gray-500 mr-2 shrink-0"}),d.jsx("input",{type:"date",className:"text-sm outline-none w-32 bg-transparent"}),d.jsx("span",{className:"mx-2 text-gray-400",children:"-"}),d.jsx("input",{type:"date",className:"text-sm outline-none w-32 bg-transparent"})]})]}),d.jsxs("div",{className:"flex items-center w-64 rounded-md border border-gray-300 bg-white overflow-hidden shrink-0",style:{height:40},children:[d.jsx(Vw,{className:"h-4 w-4 text-gray-400 shrink-0 ml-3 pointer-events-none"}),d.jsx(Se,{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"})]}),d.jsx("div",{className:"flex-1 min-w-2"}),d.jsxs(we,{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:[d.jsx(Ww,{className:"w-4 h-4"})," Export Report"]})]}),d.jsx("div",{className:"w-full border-b border-gray-200 mt-4",children:d.jsxs("div",{className:"flex overflow-x-auto w-fit",children:[d.jsx("button",{onClick:()=>t("print-log"),style:e==="print-log"?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:Re("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"}),d.jsx("button",{onClick:()=>t("label-report"),style:e==="label-report"?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:Re("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"})]})})]}),d.jsxs("div",{className:"flex-1 overflow-auto pt-6",children:[e==="print-log"&&d.jsx("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden",children:d.jsxs(br,{children:[d.jsx(wr,{children:d.jsxs(Ge,{className:"bg-gray-100 hover:bg-gray-100",children:[d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Label ID"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Product Name"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Category"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Template"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Printed At"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Printed By"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Location"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Expiry Date"}),d.jsx(ye,{className:"text-gray-900 font-bold text-center",children:"Action"})]})}),d.jsx(Sr,{children:jue.map(n=>d.jsxs(Ge,{children:[d.jsx(ue,{className:"border-r font-numeric text-gray-600",children:n.id}),d.jsx(ue,{className:"border-r font-medium",children:n.productName}),d.jsx(ue,{className:"border-r",children:d.jsx(Gn,{variant:"secondary",className:"bg-blue-50 text-blue-700 hover:bg-blue-50 border-blue-200",children:n.category})}),d.jsx(ue,{className:"border-r text-gray-600 text-sm",children:(()=>{const i=n.template.endsWith(" !!!"),o=i?n.template.slice(0,-4):n.template,s=o.lastIndexOf(" "),u=o.slice(0,s+1),f=o.slice(s+1);return d.jsxs(d.Fragment,{children:[u,d.jsx("span",{className:"font-bold text-gray-900",children:f}),i&&d.jsx("span",{className:"text-red-600",children:" !!!"})]})})()}),d.jsx(ue,{className:"border-r text-gray-600 text-sm font-numeric",children:n.printedAt}),d.jsx(ue,{className:"border-r text-gray-600 text-sm",children:n.printedBy}),d.jsx(ue,{className:"border-r text-gray-600 text-sm font-numeric",children:n.location}),d.jsx(ue,{className:"border-r",children:d.jsx("span",{className:Re("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})}),d.jsx(ue,{className:"text-center",children:d.jsxs(we,{size:"sm",variant:"outline",className:"h-8 gap-1 hover:bg-gray-100 border-gray-300",onClick:()=>r(n.id),children:[d.jsx(mM,{className:"w-3 h-3"})," Reprint"]})})]},n.id))})]})}),e==="label-report"&&d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[d.jsxs(Vr,{children:[d.jsxs(Tn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[d.jsx(kn,{className:"text-sm font-medium",children:"Total Labels Printed"}),d.jsx(ws,{className:"h-4 w-4 text-muted-foreground"})]}),d.jsxs(dn,{children:[d.jsx("div",{className:"text-2xl font-bold",children:"2,543"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"+20.1% from last month"})]})]}),d.jsxs(Vr,{children:[d.jsxs(Tn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[d.jsx(kn,{className:"text-sm font-medium",children:"Most Printed Category"}),d.jsx(F8,{className:"h-4 w-4 text-muted-foreground"})]}),d.jsxs(dn,{children:[d.jsx("div",{className:"text-2xl font-bold",children:"Dairy"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"450 labels generated"})]})]}),d.jsxs(Vr,{children:[d.jsxs(Tn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[d.jsx(kn,{className:"text-sm font-medium",children:"Top Product"}),d.jsx(lM,{className:"h-4 w-4 text-muted-foreground"})]}),d.jsxs(dn,{children:[d.jsx("div",{className:"text-2xl font-bold",children:"Whole Milk"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"182 labels generated"})]})]}),d.jsxs(Vr,{children:[d.jsxs(Tn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[d.jsx(kn,{className:"text-sm font-medium",children:"Avg. Daily Prints"}),d.jsx(SF,{className:"h-4 w-4 text-muted-foreground"})]}),d.jsxs(dn,{children:[d.jsx("div",{className:"text-2xl font-bold",children:"85"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"+12% from last week"})]})]})]}),d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[d.jsxs(Vr,{className:"col-span-1",children:[d.jsxs(Tn,{children:[d.jsx(kn,{children:"Labels by Category"}),d.jsx(hh,{children:"Distribution of printed labels across product categories."})]}),d.jsx(dn,{className:"h-[300px]",children:d.jsx(Oh,{width:"100%",height:"100%",children:d.jsxs(jne,{data:Oue,children:[d.jsx(fp,{strokeDasharray:"3 3",vertical:!1}),d.jsx(aa,{dataKey:"name",fontSize:12,tickLine:!1,axisLine:!1}),d.jsx(sa,{fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:n=>`${n}`}),d.jsx(Gr,{}),d.jsx(xa,{dataKey:"count",fill:"#facc15",radius:[4,4,0,0]})]})})})]}),d.jsxs(Vr,{className:"col-span-1",children:[d.jsxs(Tn,{children:[d.jsx(kn,{children:"Print Volume Trends"}),d.jsx(hh,{children:"Daily label printing volume for the last 7 days."})]}),d.jsx(dn,{className:"h-[300px]",children:d.jsx(Oh,{width:"100%",height:"100%",children:d.jsxs(g$,{data:Eue,children:[d.jsx(fp,{strokeDasharray:"3 3",vertical:!1}),d.jsx(aa,{dataKey:"date",fontSize:12,tickLine:!1,axisLine:!1}),d.jsx(sa,{fontSize:12,tickLine:!1,axisLine:!1}),d.jsx(Gr,{}),d.jsx(cl,{type:"monotone",dataKey:"count",stroke:"#dc2626",strokeWidth:2,dot:{r:4},activeDot:{r:6}})]})})})]})]}),d.jsxs(Vr,{children:[d.jsx(Tn,{children:d.jsx(kn,{children:"Most Used Products"})}),d.jsx(dn,{children:d.jsxs(br,{children:[d.jsx(wr,{children:d.jsxs(Ge,{children:[d.jsx(ye,{children:"Product Name"}),d.jsx(ye,{children:"Category"}),d.jsx(ye,{className:"text-right",children:"Total Printed"}),d.jsx(ye,{className:"text-right",children:"Usage %"})]})}),d.jsxs(Sr,{children:[d.jsxs(Ge,{children:[d.jsx(ue,{className:"font-medium",children:"Whole Milk"}),d.jsx(ue,{children:"Dairy"}),d.jsx(ue,{className:"text-right",children:"182"}),d.jsx(ue,{className:"text-right",children:"7.2%"})]}),d.jsxs(Ge,{children:[d.jsx(ue,{className:"font-medium",children:"Ground Beef 80/20"}),d.jsx(ue,{children:"Meat"}),d.jsx(ue,{className:"text-right",children:"145"}),d.jsx(ue,{className:"text-right",children:"5.7%"})]}),d.jsxs(Ge,{children:[d.jsx(ue,{className:"font-medium",children:"Chicken Breast"}),d.jsx(ue,{children:"Meat"}),d.jsx(ue,{className:"text-right",children:"132"}),d.jsx(ue,{className:"text-right",children:"5.2%"})]}),d.jsxs(Ge,{children:[d.jsx(ue,{className:"font-medium",children:"Sliced Ham"}),d.jsx(ue,{children:"Deli"}),d.jsx(ue,{className:"text-right",children:"98"}),d.jsx(ue,{className:"text-right",children:"3.8%"})]})]})]})})]})]})]})]})}var Nue=Symbol("radix.slottable");function Aue(e){const t=({children:r})=>d.jsx(d.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Nue,t}var[Mm]=Bn("Tooltip",[dl]),Im=dl(),Q4="TooltipProvider",Cue=700,zw="tooltip.open",[Tue,E_]=Mm(Q4),Z4=e=>{const{__scopeTooltip:t,delayDuration:r=Cue,skipDelayDuration:n=300,disableHoverableContent:i=!1,children:o}=e,s=S.useRef(!0),u=S.useRef(!1),f=S.useRef(0);return S.useEffect(()=>{const l=f.current;return()=>window.clearTimeout(l)},[]),d.jsx(Tue,{scope:t,isOpenDelayedRef:s,delayDuration:r,onOpen:S.useCallback(()=>{window.clearTimeout(f.current),s.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>s.current=!0,n)},[n]),isPointerInTransitRef:u,onPointerInTransitChange:S.useCallback(l=>{u.current=l},[]),disableHoverableContent:i,children:o})};Z4.displayName=Q4;var hu="Tooltip",[kue,Du]=Mm(hu),J4=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:i,onOpenChange:o,disableHoverableContent:s,delayDuration:u}=e,f=E_(hu,e.__scopeTooltip),l=Im(t),[h,p]=S.useState(null),m=Jn(),g=S.useRef(0),b=s??f.disableHoverableContent,y=u??f.delayDuration,w=S.useRef(!1),[j,O]=Mi({prop:n,defaultProp:i??!1,onChange:T=>{T?(f.onOpen(),document.dispatchEvent(new CustomEvent(zw))):f.onClose(),o?.(T)},caller:hu}),E=S.useMemo(()=>j?w.current?"delayed-open":"instant-open":"closed",[j]),A=S.useCallback(()=>{window.clearTimeout(g.current),g.current=0,w.current=!1,O(!0)},[O]),N=S.useCallback(()=>{window.clearTimeout(g.current),g.current=0,O(!1)},[O]),C=S.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{w.current=!0,O(!0),g.current=0},y)},[y,O]);return S.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]),d.jsx(m_,{...l,children:d.jsx(kue,{scope:t,contentId:m,open:j,stateAttribute:E,trigger:h,onTriggerChange:p,onTriggerEnter:S.useCallback(()=>{f.isOpenDelayedRef.current?C():A()},[f.isOpenDelayedRef,C,A]),onTriggerLeave:S.useCallback(()=>{b?N():(window.clearTimeout(g.current),g.current=0)},[N,b]),onOpen:A,onClose:N,disableHoverableContent:b,children:r})})};J4.displayName=hu;var qw="TooltipTrigger",e5=S.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=Du(qw,r),o=E_(qw,r),s=Im(r),u=S.useRef(null),f=Ze(t,u,i.onTriggerChange),l=S.useRef(!1),h=S.useRef(!1),p=S.useCallback(()=>l.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),d.jsx(gm,{asChild:!0,...s,children:d.jsx(Ue.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...n,ref:f,onPointerMove:Ie(e.onPointerMove,m=>{m.pointerType!=="touch"&&!h.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),h.current=!0)}),onPointerLeave:Ie(e.onPointerLeave,()=>{i.onTriggerLeave(),h.current=!1}),onPointerDown:Ie(e.onPointerDown,()=>{i.open&&i.onClose(),l.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Ie(e.onFocus,()=>{l.current||i.onOpen()}),onBlur:Ie(e.onBlur,i.onClose),onClick:Ie(e.onClick,i.onClose)})})});e5.displayName=qw;var P_="TooltipPortal",[Rue,Mue]=Mm(P_,{forceMount:void 0}),t5=e=>{const{__scopeTooltip:t,forceMount:r,children:n,container:i}=e,o=Du(P_,t);return d.jsx(Rue,{scope:t,forceMount:r,children:d.jsx(Mr,{present:r||o.open,children:d.jsx(Eu,{asChild:!0,container:i,children:n})})})};t5.displayName=P_;var Ys="TooltipContent",r5=S.forwardRef((e,t)=>{const r=Mue(Ys,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...o}=e,s=Du(Ys,e.__scopeTooltip);return d.jsx(Mr,{present:n||s.open,children:s.disableHoverableContent?d.jsx(n5,{side:i,...o,ref:t}):d.jsx(Iue,{side:i,...o,ref:t})})}),Iue=S.forwardRef((e,t)=>{const r=Du(Ys,e.__scopeTooltip),n=E_(Ys,e.__scopeTooltip),i=S.useRef(null),o=Ze(t,i),[s,u]=S.useState(null),{trigger:f,onClose:l}=r,h=i.current,{onPointerInTransitChange:p}=n,m=S.useCallback(()=>{u(null),p(!1)},[p]),g=S.useCallback((b,y)=>{const w=b.currentTarget,j={x:b.clientX,y:b.clientY},O=Bue(j,w.getBoundingClientRect()),E=Fue(j,O),A=zue(y.getBoundingClientRect()),N=Uue([...E,...A]);u(N),p(!0)},[p]);return S.useEffect(()=>()=>m(),[m]),S.useEffect(()=>{if(f&&h){const b=w=>g(w,h),y=w=>g(w,f);return f.addEventListener("pointerleave",b),h.addEventListener("pointerleave",y),()=>{f.removeEventListener("pointerleave",b),h.removeEventListener("pointerleave",y)}}},[f,h,g,m]),S.useEffect(()=>{if(s){const b=y=>{const w=y.target,j={x:y.clientX,y:y.clientY},O=f?.contains(w)||h?.contains(w),E=!que(j,s);O?m():E&&(m(),l())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[f,h,s,l,m]),d.jsx(n5,{...e,ref:o})}),[Due,Lue]=Mm(hu,{isInside:!1}),$ue=Aue("TooltipContent"),n5=S.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...u}=e,f=Du(Ys,r),l=Im(r),{onClose:h}=f;return S.useEffect(()=>(document.addEventListener(zw,h),()=>document.removeEventListener(zw,h)),[h]),S.useEffect(()=>{if(f.trigger){const p=m=>{m.target?.contains(f.trigger)&&h()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[f.trigger,h]),d.jsx(ju,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:p=>p.preventDefault(),onDismiss:h,children:d.jsxs(v_,{"data-state":f.stateAttribute,...l,...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:[d.jsx($ue,{children:n}),d.jsx(Due,{scope:r,isInside:!0,children:d.jsx(Noe,{id:f.contentId,role:"tooltip",children:i||n})})]})})});r5.displayName=Ys;var i5="TooltipArrow",o5=S.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=Im(r);return Lue(i5,r).isInside?null:d.jsx(g_,{...i,...n,ref:t})});o5.displayName=i5;function Bue(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,i,o)){case o:return"left";case i:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function Fue(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 zue(e){const{top:t,right:r,bottom:n,left:i}=e;return[{x:i,y:t},{x:r,y:t},{x:r,y:n},{x:i,y:n}]}function que(e,t){const{x:r,y:n}=e;let i=!1;for(let o=0,s=t.length-1;on!=m>n&&r<(p-l)*(n-h)/(m-h)+l&&(i=!i)}return i}function Uue(e){const t=e.slice();return t.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),Wue(t)}function Wue(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=2;){const o=t[t.length-1],s=t[t.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))t.pop();else break}t.push(i)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const i=e[n];for(;r.length>=2;){const o=r[r.length-1],s=r[r.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))r.pop();else break}r.push(i)}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 Hue=Z4,Vue=J4,Gue=e5,Kue=t5,Xue=r5,Yue=o5;function Que({delayDuration:e=0,...t}){return d.jsx(Hue,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Xb({...e}){return d.jsx(Que,{children:d.jsx(Vue,{"data-slot":"tooltip",...e})})}function Yb({...e}){return d.jsx(Gue,{"data-slot":"tooltip-trigger",...e})}function Qb({className:e,sideOffset:t=0,children:r,...n}){return d.jsx(Kue,{children:d.jsxs(Xue,{"data-slot":"tooltip-content",sideOffset:t,className:Re("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,d.jsx(Yue,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function Zue(e){const t=Jue(e),r=S.forwardRef((n,i)=>{const{children:o,...s}=n,u=S.Children.toArray(o),f=u.find(tfe);if(f){const l=f.props.children,h=u.map(p=>p===f?S.Children.count(l)>1?S.Children.only(null):S.isValidElement(l)?l.props.children:null:p);return d.jsx(t,{...s,ref:i,children:S.isValidElement(l)?S.cloneElement(l,void 0,h):null})}return d.jsx(t,{...s,ref:i,children:o})});return r.displayName=`${e}.Slot`,r}function Jue(e){const t=S.forwardRef((r,n)=>{const{children:i,...o}=r;if(S.isValidElement(i)){const s=nfe(i),u=rfe(o,i.props);return i.type!==S.Fragment&&(u.ref=n?ha(n,s):s),S.cloneElement(i,u)}return S.Children.count(i)>1?S.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var efe=Symbol("radix.slottable");function tfe(e){return S.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===efe}function rfe(e,t){const r={...t};for(const n in t){const i=e[n],o=t[n];/^on[A-Z]/.test(n)?i&&o?r[n]=(...u)=>{const f=o(...u);return i(...u),f}:i&&(r[n]=i):n==="style"?r[n]={...i,...o}:n==="className"&&(r[n]=[i,o].filter(Boolean).join(" "))}return{...e,...r}}function nfe(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 Dm="Popover",[a5]=Bn(Dm,[dl]),Lu=dl(),[ife,So]=a5(Dm),s5=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:i,onOpenChange:o,modal:s=!1}=e,u=Lu(t),f=S.useRef(null),[l,h]=S.useState(!1),[p,m]=Mi({prop:n,defaultProp:i??!1,onChange:o,caller:Dm});return d.jsx(m_,{...u,children:d.jsx(ife,{scope:t,contentId:Jn(),triggerRef:f,open:p,onOpenChange:m,onOpenToggle:S.useCallback(()=>m(g=>!g),[m]),hasCustomAnchor:l,onCustomAnchorAdd:S.useCallback(()=>h(!0),[]),onCustomAnchorRemove:S.useCallback(()=>h(!1),[]),modal:s,children:r})})};s5.displayName=Dm;var l5="PopoverAnchor",ofe=S.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,i=So(l5,r),o=Lu(r),{onCustomAnchorAdd:s,onCustomAnchorRemove:u}=i;return S.useEffect(()=>(s(),()=>u()),[s,u]),d.jsx(gm,{...o,...n,ref:t})});ofe.displayName=l5;var c5="PopoverTrigger",u5=S.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,i=So(c5,r),o=Lu(r),s=Ze(t,i.triggerRef),u=d.jsx(Ue.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":m5(i.open),...n,ref:s,onClick:Ie(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?u:d.jsx(gm,{asChild:!0,...o,children:u})});u5.displayName=c5;var N_="PopoverPortal",[afe,sfe]=a5(N_,{forceMount:void 0}),f5=e=>{const{__scopePopover:t,forceMount:r,children:n,container:i}=e,o=So(N_,t);return d.jsx(afe,{scope:t,forceMount:r,children:d.jsx(Mr,{present:r||o.open,children:d.jsx(Eu,{asChild:!0,container:i,children:n})})})};f5.displayName=N_;var Qs="PopoverContent",d5=S.forwardRef((e,t)=>{const r=sfe(Qs,e.__scopePopover),{forceMount:n=r.forceMount,...i}=e,o=So(Qs,e.__scopePopover);return d.jsx(Mr,{present:n||o.open,children:o.modal?d.jsx(cfe,{...i,ref:t}):d.jsx(ufe,{...i,ref:t})})});d5.displayName=Qs;var lfe=Zue("PopoverContent.RemoveScroll"),cfe=S.forwardRef((e,t)=>{const r=So(Qs,e.__scopePopover),n=S.useRef(null),i=Ze(t,n),o=S.useRef(!1);return S.useEffect(()=>{const s=n.current;if(s)return x_(s)},[]),d.jsx(xm,{as:lfe,allowPinchZoom:!0,children:d.jsx(h5,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ie(e.onCloseAutoFocus,s=>{s.preventDefault(),o.current||r.triggerRef.current?.focus()}),onPointerDownOutside:Ie(e.onPointerDownOutside,s=>{const u=s.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0,l=u.button===2||f;o.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:Ie(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),ufe=S.forwardRef((e,t)=>{const r=So(Qs,e.__scopePopover),n=S.useRef(!1),i=S.useRef(!1);return d.jsx(h5,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(n.current||r.triggerRef.current?.focus(),o.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;r.triggerRef.current?.contains(s)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),h5=S.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:l,onInteractOutside:h,...p}=e,m=So(Qs,r),g=Lu(r);return o_(),d.jsx(dm,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:o,children:d.jsx(ju,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:h,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:l,onDismiss:()=>m.onOpenChange(!1),children:d.jsx(v_,{"data-state":m5(m.open),role:"dialog",id:m.contentId,...g,...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",ffe=S.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,i=So(p5,r);return d.jsx(Ue.button,{type:"button",...n,ref:t,onClick:Ie(e.onClick,()=>i.onOpenChange(!1))})});ffe.displayName=p5;var dfe="PopoverArrow",hfe=S.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,i=Lu(r);return d.jsx(g_,{...i,...n,ref:t})});hfe.displayName=dfe;function m5(e){return e?"open":"closed"}var pfe=s5,mfe=u5,vfe=f5,gfe=d5;function v5({...e}){return d.jsx(pfe,{"data-slot":"popover",...e})}function g5({...e}){return d.jsx(mfe,{"data-slot":"popover-trigger",...e})}function y5({className:e,align:t="center",sideOffset:r=4,...n}){return d.jsx(vfe,{children:d.jsx(gfe,{"data-slot":"popover-content",align:t,sideOffset:r,className:Re("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})})}function An(e){const t=(e??"").trim();return t||"N/A"}function yfe(e,t){return e==null||t===null||t===void 0||!Number.isFinite(e)||!Number.isFinite(t)?"N/A":`${e}, ${t}`}function xfe(){const[e,t]=S.useState(!1),[r,n]=S.useState(!1),[i,o]=S.useState(!1),[s,u]=S.useState(null),[f,l]=S.useState(null),[h,p]=S.useState([]),[m,g]=S.useState(!1),[b,y]=S.useState(0),[w,j]=S.useState(0),[O,E]=S.useState(null),[A,N]=S.useState(""),[C,T]=S.useState("all"),[R,I]=S.useState("all"),[F,L]=S.useState("all"),[$,U]=S.useState(1),[G,q]=S.useState(10),H=S.useRef(null),V=S.useRef(null),[D,Z]=S.useState("");S.useEffect(()=>(V.current&&window.clearTimeout(V.current),V.current=window.setTimeout(()=>Z(A.trim()),300),()=>{V.current&&window.clearTimeout(V.current)}),[A]);const J=S.useMemo(()=>{const K=new Set;for(const ce of h){const te=(ce.partner??"").trim();te&&K.add(te)}return["all",...Array.from(K).sort((ce,te)=>ce.localeCompare(te))]},[h]),M=S.useMemo(()=>{const K=new Set;for(const ce of h){const te=(ce.groupName??"").trim();te&&K.add(te)}return["all",...Array.from(K).sort((ce,te)=>ce.localeCompare(te))]},[h]),B=S.useMemo(()=>{const K=new Set;for(const ce of h){const te=(ce.locationCode??"").trim();te&&K.add(te)}return["all",...Array.from(K).sort((ce,te)=>ce.localeCompare(te))]},[h]),ee=Math.max(1,Math.ceil(b/G));S.useEffect(()=>{U(1)},[D,C,R,F,G]),S.useEffect(()=>((async()=>{H.current?.abort();const ce=new AbortController;H.current=ce,g(!0);try{const te=Math.max(1,$),ge=await X4({skipCount:te,maxResultCount:G,keyword:(F!=="all"?F:D)||void 0,partner:C!=="all"?C:void 0,groupName:R!=="all"?R:void 0},ce.signal);p(ge.items??[]),y(ge.totalCount??0)}catch(te){if(te?.name==="AbortError")return;Qe.error("Failed to load locations.",{description:te?.message?String(te.message):"Please try again."}),p([]),y(0)}finally{g(!1)}})(),()=>H.current?.abort()),[D,C,R,F,$,G,w]);const ae=()=>j(K=>K+1),ie=K=>{E(null),u(K),n(!0)},fe=K=>{E(null),l(K),o(!0)};return d.jsxs("div",{className:"h-full flex flex-col",children:[d.jsx("div",{className:"pb-4",children:d.jsx("div",{className:"flex flex-col gap-4",children:d.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[d.jsx(Se,{placeholder:"Search",value:A,onChange:K=>N(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"}),d.jsxs(Je,{value:C,onValueChange:T,children:[d.jsx(tt,{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:d.jsx(et,{placeholder:"Partner"})}),d.jsx(rt,{children:J.map(K=>d.jsx(Ee,{value:K,children:K==="all"?"Partner (All)":K},K))})]}),d.jsxs(Je,{value:R,onValueChange:I,children:[d.jsx(tt,{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:d.jsx(et,{placeholder:"Group"})}),d.jsx(rt,{children:M.map(K=>d.jsx(Ee,{value:K,children:K==="all"?"Group (All)":K},K))})]}),d.jsxs(Je,{value:F,onValueChange:L,children:[d.jsx(tt,{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:d.jsx(et,{placeholder:"Location"})}),d.jsx(rt,{children:B.map(K=>d.jsx(Ee,{value:K,children:K==="all"?"All Locations":K},K))})]}),d.jsx("div",{className:"flex-1"}),d.jsxs(Xb,{children:[d.jsx(Yb,{asChild:!0,children:d.jsx("span",{children:d.jsx(we,{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"})})}),d.jsx(Qb,{children:"Not supported yet"})]}),d.jsxs(Xb,{children:[d.jsx(Yb,{asChild:!0,children:d.jsx("span",{children:d.jsx(we,{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"})})}),d.jsx(Qb,{children:"Not supported yet"})]}),d.jsxs(Xb,{children:[d.jsx(Yb,{asChild:!0,children:d.jsx("span",{children:d.jsx(we,{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"})})}),d.jsx(Qb,{children:"Not supported yet"})]}),d.jsx(we,{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"})]})})}),d.jsx("div",{className:"flex-1 overflow-auto pt-6",children:d.jsx("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden",children:d.jsxs(br,{children:[d.jsx(wr,{children:d.jsxs(Ge,{className:"bg-gray-100 hover:bg-gray-100",children:[d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Partner"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Group"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Location ID"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Location Name"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Street"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"City"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"State"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Country"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Zip Code"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Phone"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Email"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"GPS"}),d.jsx(ye,{className:"text-gray-900 font-bold border-r",children:"Active"}),d.jsx(ye,{className:"text-gray-900 font-bold text-center",children:"Actions"})]})}),d.jsx(Sr,{children:m?d.jsx(Ge,{children:d.jsx(ue,{colSpan:14,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):h.length===0?d.jsx(Ge,{children:d.jsx(ue,{colSpan:14,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):h.map(K=>d.jsxs(Ge,{children:[d.jsx(ue,{className:"border-r text-gray-600 max-w-[140px] truncate",children:An(K.partner)}),d.jsx(ue,{className:"border-r text-gray-600 max-w-[140px] truncate",children:An(K.groupName)}),d.jsx(ue,{className:"border-r font-numeric text-gray-600",children:An(K.locationCode??K.id)}),d.jsx(ue,{className:"border-r font-medium text-black",children:An(K.locationName)}),d.jsx(ue,{className:"border-r text-gray-600 max-w-[140px] truncate",children:An(K.street)}),d.jsx(ue,{className:"border-r text-gray-600",children:An(K.city)}),d.jsx(ue,{className:"border-r text-gray-600",children:An(K.stateCode)}),d.jsx(ue,{className:"border-r text-gray-600",children:An(K.country)}),d.jsx(ue,{className:"border-r text-gray-600 font-numeric",children:An(K.zipCode)}),d.jsx(ue,{className:"border-r text-gray-600 whitespace-nowrap",children:An(K.phone)}),d.jsx(ue,{className:"border-r text-gray-600 text-sm max-w-[180px] truncate",children:An(K.email)}),d.jsx(ue,{className:"border-r text-gray-500 font-numeric text-xs",children:yfe(K.latitude,K.longitude)}),d.jsx(ue,{className:"border-r",children:d.jsx(Gn,{className:K.state?"bg-green-600":"bg-gray-400",children:K.state?"Yes":"No"})}),d.jsx(ue,{className:"text-center",children:d.jsxs(v5,{open:O===K.id,onOpenChange:ce=>E(ce?K.id:null),children:[d.jsx(g5,{asChild:!0,children:d.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:d.jsx(Hw,{className:"h-4 w-4 text-gray-500"})})}),d.jsxs(y5,{align:"end",className:"w-40 p-1",children:[d.jsxs(we,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>ie(K),children:[d.jsx(co,{className:"w-4 h-4"}),"Edit"]}),d.jsx(we,{type:"button",variant:"ghost",className:"w-full justify-start h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>fe(K),children:"Delete"})]})]})})]},K.id))})]})})}),d.jsx("div",{className:"pt-4",children:d.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[d.jsxs("div",{children:["Showing ",b===0?0:($-1)*G+1,"-",Math.min($*G,b)," of ",b]}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs(Je,{value:String(G),onValueChange:K=>q(Number(K)),children:[d.jsx(tt,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:d.jsx(et,{})}),d.jsx(rt,{children:[10,20,50].map(K=>d.jsxs(Ee,{value:String(K),children:[K," / page"]},K))})]}),d.jsx(Iw,{className:"mx-0 w-auto justify-end",children:d.jsxs(Dw,{children:[d.jsx(Si,{children:d.jsx(Lw,{href:"#",size:"default",onClick:K=>{K.preventDefault(),U(ce=>Math.max(1,ce-1))},"aria-disabled":$<=1,className:$<=1?"pointer-events-none opacity-50":""})}),d.jsx(Si,{children:d.jsxs(fu,{href:"#",isActive:!0,size:"default",onClick:K=>K.preventDefault(),children:["Page ",$," / ",ee]})}),d.jsx(Si,{children:d.jsx($w,{href:"#",size:"default",onClick:K=>{K.preventDefault(),U(ce=>Math.min(ee,ce+1))},"aria-disabled":$>=ee,className:$>=ee?"pointer-events-none opacity-50":""})})]})})]})]})}),d.jsx(bfe,{open:e,onOpenChange:t,onCreated:()=>{U(1),ae()}}),d.jsx(Sfe,{open:r,location:s,onOpenChange:K=>{n(K),K||u(null)},onUpdated:()=>{ae()}}),d.jsx(_fe,{open:i,location:f,onOpenChange:K=>{o(K),K||l(null)},onDeleted:()=>{ae()}})]})}function bfe({open:e,onOpenChange:t,onCreated:r}){const[n,i]=S.useState(!1),[o,s]=S.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})};S.useEffect(()=>{e||(u(),i(!1))},[e]);const f=S.useMemo(()=>o.locationCode.trim().length>0&&o.locationName.trim().length>0,[o.locationCode,o.locationName]),l=async()=>{if(!f){Qe.error("Please fill in required fields.",{description:"Location ID and Location Name are required."});return}i(!0);try{await nue({...o,locationCode:o.locationCode.trim(),locationName:o.locationName.trim(),partner:o.partner?.trim()?o.partner.trim():null,groupName:o.groupName?.trim()?o.groupName.trim():null,street:o.street?.trim()?o.street.trim():null,city:o.city?.trim()?o.city.trim():null,stateCode:o.stateCode?.trim()?o.stateCode.trim():null,country:o.country?.trim()?o.country.trim():null,zipCode:o.zipCode?.trim()?o.zipCode.trim():null,phone:o.phone?.trim()?o.phone.trim():null,email:o.email?.trim()?o.email.trim():null}),Qe.success("Location created.",{description:"The location has been added successfully."}),t(!1),r()}catch(h){Qe.error("Failed to create location.",{description:h?.message?String(h.message):"Please try again."})}finally{i(!1)}};return d.jsx(_r,{open:e,onOpenChange:t,children:d.jsxs(dr,{className:"sm:max-w-[600px]",children:[d.jsxs(jr,{children:[d.jsx(Or,{children:"Add New Location"}),d.jsx(xn,{children:"Enter the details for the new store location."})]}),d.jsxs("div",{className:"grid gap-4 py-4",children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Partner"}),d.jsx(Se,{placeholder:"e.g. Global Foods Inc.",value:o.partner??"",onChange:h=>s(p=>({...p,partner:h.target.value}))})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Group"}),d.jsx(Se,{placeholder:"e.g. East Coast Region",value:o.groupName??"",onChange:h=>s(p=>({...p,groupName:h.target.value}))})]})]}),d.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[d.jsxs("div",{className:"space-y-2 col-span-1",children:[d.jsx(me,{children:"Location ID"}),d.jsx(Se,{placeholder:"e.g. 12345",value:o.locationCode,onChange:h=>s(p=>({...p,locationCode:h.target.value}))})]}),d.jsxs("div",{className:"space-y-2 col-span-2",children:[d.jsx(me,{children:"Location Name"}),d.jsx(Se,{placeholder:"e.g. Downtown Store",value:o.locationName,onChange:h=>s(p=>({...p,locationName:h.target.value}))})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Street"}),d.jsx(Se,{placeholder:"e.g. 123 Main St",value:o.street??"",onChange:h=>s(p=>({...p,street:h.target.value}))})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"City"}),d.jsx(Se,{placeholder:"e.g. New York",value:o.city??"",onChange:h=>s(p=>({...p,city:h.target.value}))})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"State"}),d.jsx(Se,{placeholder:"e.g. NY",value:o.stateCode??"",onChange:h=>s(p=>({...p,stateCode:h.target.value}))})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Country"}),d.jsx(Se,{placeholder:"e.g. USA",value:o.country??"",onChange:h=>s(p=>({...p,country:h.target.value}))})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Zip Code"}),d.jsx(Se,{placeholder:"e.g. 10001",value:o.zipCode??"",onChange:h=>s(p=>({...p,zipCode:h.target.value}))})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Phone Number"}),d.jsx(Se,{placeholder:"+1 (555) 000-0000",value:o.phone??"",onChange:h=>s(p=>({...p,phone:h.target.value}))})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Email"}),d.jsx(Se,{placeholder:"store@example.com",value:o.email??"",onChange:h=>s(p=>({...p,email:h.target.value}))})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs(me,{className:"flex items-center gap-2",children:[d.jsx(Zs,{className:"w-4 h-4"})," GPS Coordinates"]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Se,{placeholder:"Latitude (e.g. 40.7128)",value:o.latitude===null||o.latitude===void 0?"":String(o.latitude),onChange:h=>{const p=h.target.value.trim();s(m=>({...m,latitude:p?Number(p):null}))}}),d.jsx(Se,{placeholder:"Longitude (e.g. -74.0060)",value:o.longitude===null||o.longitude===void 0?"":String(o.longitude),onChange:h=>{const p=h.target.value.trim();s(m=>({...m,longitude:p?Number(p):null}))}})]})]}),d.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[d.jsx(mn,{id:"loc-status",checked:!!o.state,onCheckedChange:h=>s(p=>({...p,state:h}))}),d.jsx(me,{htmlFor:"loc-status",children:"Active Location"})]})]}),d.jsxs(Dr,{children:[d.jsx(we,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),d.jsx(we,{disabled:n,onClick:l,className:"bg-blue-600 text-white hover:bg-blue-700",children:n?"Creating...":"Create Location"})]})]})})}function wfe(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 Sfe({open:e,location:t,onOpenChange:r,onUpdated:n}){const[i,o]=S.useState(!1),[s,u]=S.useState({partner:"",groupName:"",locationCode:"",locationName:"",street:"",city:"",stateCode:"",country:"",zipCode:"",phone:"",email:"",latitude:null,longitude:null,state:!0});S.useEffect(()=>{e&&t&&(u(wfe(t)),o(!1)),e||o(!1)},[e,t]);const f=S.useMemo(()=>s.locationCode.trim().length>0&&s.locationName.trim().length>0,[s.locationCode,s.locationName]),l=async()=>{if(t?.id){if(!f){Qe.error("Please fill in required fields.",{description:"Location ID and Location Name are required."});return}o(!0);try{await iue(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()?s.street.trim():null,city:s.city?.trim()?s.city.trim():null,stateCode:s.stateCode?.trim()?s.stateCode.trim():null,country:s.country?.trim()?s.country.trim():null,zipCode:s.zipCode?.trim()?s.zipCode.trim():null,phone:s.phone?.trim()?s.phone.trim():null,email:s.email?.trim()?s.email.trim():null}),Qe.success("Location updated.",{description:"The changes have been saved successfully."}),r(!1),n()}catch(h){Qe.error("Failed to update location.",{description:h?.message?String(h.message):"Please try again."})}finally{o(!1)}}};return d.jsx(_r,{open:e,onOpenChange:r,children:d.jsxs(dr,{className:"sm:max-w-[600px]",children:[d.jsxs(jr,{children:[d.jsx(Or,{children:"Edit Location"}),d.jsx(xn,{children:"Update the details for this store location."})]}),d.jsxs("div",{className:"grid gap-4 py-4",children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Partner"}),d.jsx(Se,{placeholder:"e.g. Global Foods Inc.",value:s.partner??"",onChange:h=>u(p=>({...p,partner:h.target.value}))})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Group"}),d.jsx(Se,{placeholder:"e.g. East Coast Region",value:s.groupName??"",onChange:h=>u(p=>({...p,groupName:h.target.value}))})]})]}),d.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[d.jsxs("div",{className:"space-y-2 col-span-1",children:[d.jsx(me,{children:"Location ID"}),d.jsx(Se,{placeholder:"e.g. 12345",value:s.locationCode,onChange:h=>u(p=>({...p,locationCode:h.target.value}))})]}),d.jsxs("div",{className:"space-y-2 col-span-2",children:[d.jsx(me,{children:"Location Name"}),d.jsx(Se,{placeholder:"e.g. Downtown Store",value:s.locationName,onChange:h=>u(p=>({...p,locationName:h.target.value}))})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Street"}),d.jsx(Se,{placeholder:"e.g. 123 Main St",value:s.street??"",onChange:h=>u(p=>({...p,street:h.target.value}))})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"City"}),d.jsx(Se,{placeholder:"e.g. New York",value:s.city??"",onChange:h=>u(p=>({...p,city:h.target.value}))})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"State"}),d.jsx(Se,{placeholder:"e.g. NY",value:s.stateCode??"",onChange:h=>u(p=>({...p,stateCode:h.target.value}))})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Country"}),d.jsx(Se,{placeholder:"e.g. USA",value:s.country??"",onChange:h=>u(p=>({...p,country:h.target.value}))})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Zip Code"}),d.jsx(Se,{placeholder:"e.g. 10001",value:s.zipCode??"",onChange:h=>u(p=>({...p,zipCode:h.target.value}))})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Phone Number"}),d.jsx(Se,{placeholder:"+1 (555) 000-0000",value:s.phone??"",onChange:h=>u(p=>({...p,phone:h.target.value}))})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Email"}),d.jsx(Se,{placeholder:"store@example.com",value:s.email??"",onChange:h=>u(p=>({...p,email:h.target.value}))})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs(me,{className:"flex items-center gap-2",children:[d.jsx(Zs,{className:"w-4 h-4"})," GPS Coordinates"]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Se,{placeholder:"Latitude (e.g. 40.7128)",value:s.latitude===null||s.latitude===void 0?"":String(s.latitude),onChange:h=>{const p=h.target.value.trim();u(m=>({...m,latitude:p?Number(p):null}))}}),d.jsx(Se,{placeholder:"Longitude (e.g. -74.0060)",value:s.longitude===null||s.longitude===void 0?"":String(s.longitude),onChange:h=>{const p=h.target.value.trim();u(m=>({...m,longitude:p?Number(p):null}))}})]})]}),d.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[d.jsx(mn,{id:"loc-status-edit",checked:!!s.state,onCheckedChange:h=>u(p=>({...p,state:h}))}),d.jsx(me,{htmlFor:"loc-status-edit",children:"Active Location"})]})]}),d.jsxs(Dr,{children:[d.jsx(we,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),d.jsx(we,{disabled:i,onClick:l,className:"bg-blue-600 text-white hover:bg-blue-700",children:i?"Saving...":"Save Changes"})]})]})})}function _fe({open:e,location:t,onOpenChange:r,onDeleted:n}){const[i,o]=S.useState(!1),s=S.useMemo(()=>{const f=(t?.locationCode??"").trim(),l=(t?.locationName??"").trim();return f&&l?`${f} - ${l}`:f||l||"this location"},[t?.locationCode,t?.locationName]),u=async()=>{if(t?.id){o(!0);try{await oue(t.id),Qe.success("Location deleted.",{description:"The location has been removed successfully."}),r(!1),n()}catch(f){Qe.error("Failed to delete location.",{description:f?.message?String(f.message):"Please try again."})}finally{o(!1)}}};return d.jsx(_r,{open:e,onOpenChange:r,children:d.jsxs(dr,{className:"sm:max-w-none",style:{width:"30%"},children:[d.jsxs(jr,{children:[d.jsx(Or,{children:"Delete Location"}),d.jsx(xn,{children:"This action cannot be undone."})]}),d.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",d.jsx("span",{className:"font-medium",children:s}),"?"]}),d.jsxs(Dr,{className:"flex-row flex-wrap justify-end",children:[d.jsx(we,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),d.jsx(we,{className:"min-w-24",variant:"destructive",disabled:i,onClick:u,children:i?"Deleting...":"Delete"})]})]})})}function jfe({className:e,...t}){return d.jsx("textarea",{"data-slot":"textarea",className:Re("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 iM={Settings:sh,LayoutDashboard:hM,Tag:lh,MapPin:Zs,Users:Gw,Package:ah,FileText:ws,HelpCircle:oh,Layers:dM,Type:Op,FileBox:fM};function Zb(e){const t=(e??"").trim();return t||"N/A"}function Ofe(e){const t=e.trim();if(!t)return null;const r=Number.parseInt(t,10);return Number.isFinite(r)?r:null}function Efe(){const[e,t]=S.useState([]),[r,n]=S.useState(!1),[i,o]=S.useState(0),[s,u]=S.useState(null),[f,l]=S.useState(""),h=S.useRef(null),[p,m]=S.useState(""),[g,b]=S.useState(!1),[y,w]=S.useState(!1),[j,O]=S.useState(!1),[E,A]=S.useState(null),[N,C]=S.useState(null),T=S.useRef(null);S.useEffect(()=>(h.current&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>m(f.trim()),300),()=>{h.current&&window.clearTimeout(h.current)}),[f]),S.useEffect(()=>((async()=>{T.current?.abort();const $=new AbortController;T.current=$,n(!0);try{const U=await H4({skipCount:1,maxResultCount:5e3,keyword:p||void 0},$.signal);t(U.items??[])}catch(U){if(U?.name==="AbortError")return;Qe.error("Failed to load system menus.",{description:U?.message?String(U.message):"Please try again."}),t([])}finally{n(!1)}})(),()=>T.current?.abort()),[p,i]);const R=()=>o(L=>L+1),I=L=>{u(null),A(L),w(!0)},F=L=>{u(null),C(L),O(!0)};return d.jsxs("div",{className:"h-full flex flex-col",children:[d.jsx("div",{className:"pb-4",children:d.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[d.jsx(Se,{placeholder:"Search",value:f,onChange:L=>l(L.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"}),d.jsx("div",{className:"flex-1"}),d.jsxs(we,{className:"bg-blue-600 text-white hover:bg-blue-700",onClick:()=>b(!0),children:[d.jsx(Rr,{className:"w-4 h-4 mr-2"}),"New Menu"]})]})}),d.jsx("div",{className:"flex-1 flex flex-col min-h-0 bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden",children:d.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:d.jsxs(br,{children:[d.jsx(wr,{className:"bg-gray-50 sticky top-0 z-10",children:d.jsxs(Ge,{className:"hover:bg-gray-50",children:[d.jsx(ye,{className:"font-semibold text-gray-900",children:"Menu Name"}),d.jsx(ye,{className:"font-semibold text-gray-900",children:"Route URL"}),d.jsx(ye,{className:"font-semibold text-gray-900",children:"Router Name"}),d.jsx(ye,{className:"font-semibold text-gray-900",children:"Type"}),d.jsx(ye,{className:"font-semibold text-gray-900",children:"Order"}),d.jsx(ye,{className:"font-semibold text-gray-900",children:"Visible"}),d.jsx(ye,{className:"font-semibold text-gray-900",children:"Enabled"}),d.jsx(ye,{className:"font-semibold text-gray-900 w-16 text-right",children:"Actions"})]})}),d.jsx(Sr,{children:e.length===0?d.jsx(Ge,{children:d.jsx(ue,{colSpan:8,className:"text-center py-10 text-gray-500",children:r?"Loading...":"No data"})}):e.map(L=>d.jsxs(Ge,{className:"hover:bg-gray-50",children:[d.jsx(ue,{className:"font-medium text-gray-900",children:Zb(L.menuName)}),d.jsx(ue,{className:"text-gray-700",children:Zb(L.routeUrl)}),d.jsx(ue,{className:"text-gray-700",children:Zb(L.routerName)}),d.jsx(ue,{className:"text-gray-700",children:L.menuType??"N/A"}),d.jsx(ue,{className:"text-gray-700",children:L.orderNum??"N/A"}),d.jsx(ue,{className:"text-gray-700",children:L.isShow?"Yes":"No"}),d.jsx(ue,{className:"text-gray-700",children:L.state?"Yes":"No"}),d.jsx(ue,{className:"text-right",children:d.jsxs(v5,{open:s===L.id,onOpenChange:$=>u($?L.id:null),children:[d.jsx(g5,{asChild:!0,children:d.jsx(we,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:d.jsx(Hw,{className:"h-4 w-4"})})}),d.jsx(y5,{className:"w-44 p-2",align:"end",children:d.jsxs("div",{className:"flex flex-col",children:[d.jsxs(we,{variant:"ghost",className:"justify-start",onClick:()=>I(L),children:[d.jsx(co,{className:"w-4 h-4 mr-2"}),"Edit"]}),d.jsxs(we,{variant:"ghost",className:"justify-start text-red-600 hover:text-red-700",onClick:()=>F(L),children:[d.jsx(Nc,{className:"w-4 h-4 mr-2"}),"Delete"]})]})})]})})]},L.id))})]})})}),d.jsx(oM,{mode:"create",open:g,menu:null,onOpenChange:b,onSaved:R}),d.jsx(oM,{mode:"edit",open:y,menu:E,onOpenChange:w,onSaved:R}),d.jsx(Pfe,{open:j,menu:N,onOpenChange:O,onDeleted:R})]})}function oM({mode:e,open:t,menu:r,onOpenChange:n,onSaved:i}){const o=e==="edit",[s,u]=S.useState(!1),[f,l]=S.useState(""),[h,p]=S.useState(""),[m,g]=S.useState(""),[b,y]=S.useState("menu"),[w,j]=S.useState(""),[O,E]=S.useState(""),[A,N]=S.useState([]),[C,T]=S.useState(!1),[R,I]=S.useState(""),[F,L]=S.useState(""),[$,U]=S.useState(""),[G,q]=S.useState(""),[H,V]=S.useState(""),[D,Z]=S.useState(""),[J,M]=S.useState(!1),[B,ee]=S.useState(!0),[ae,ie]=S.useState(!0);S.useEffect(()=>{if(!t)return;u(!1),l(r?.menuName??""),p(r?.routerName??""),g(r?.routeUrl??""),y(r?.menuType===0?"directory":"menu"),j(r?.permissionCode??"");const Y=String(r?.parentId??"").trim();E(!Y||Y==="00000000-0000-0000-0000-000000000000"?"":Y),I(r?.menuIcon??""),L(r?.orderNum===null||r?.orderNum===void 0?"":String(r.orderNum)),U(r?.link??""),q(r?.component??""),V(r?.query??""),Z(r?.remark??""),M(!!r?.isCache),ee(r?.isShow??!0),ie(r?.state??!0)},[t,r]);const fe="__parent_root__";S.useEffect(()=>{if(!t)return;let Y=!1;return T(!0),qce().then(_e=>{Y||N(_e)}).catch(()=>{Y||N([])}).finally(()=>{Y||T(!1)}),()=>{Y=!0}},[t]);const K=Y=>!Y.trim()||Y==="00000000-0000-0000-0000-000000000000",ce=S.useMemo(()=>{const Y=A.filter(Oe=>Oe.id&&Oe.id!==r?.id),_e=(O||"").trim();return _e&&!K(_e)&&!Y.some(Oe=>Oe.id===_e)?[...Y,{id:_e,menuName:`(Current parent) ${_e}`}]:Y},[A,O,r?.id]),te=K(O)?fe:O,le=S.useMemo(()=>!!(f.trim()&&m.trim()),[f,m]),ge=async()=>{if(!le){Qe.error("Please fill in required fields.",{description:"Menu Name and Route URL are required."});return}u(!0);try{const Y={menuName:f.trim(),routerName:h.trim()?h.trim():null,routeUrl:m.trim(),menuType:b==="directory"?0:1,permissionCode:w.trim()?w.trim():null,parentId:K(O)?null:O.trim(),menuIcon:R||null,orderNum:Ofe(F),link:$.trim()?$.trim():null,component:G.trim()?G.trim():null,query:H.trim()?H.trim():null,remark:D.trim()?D.trim():null,isCache:J,isShow:B,state:ae};if(o){if(!r?.id)throw new Error("Missing id.");await Wce(r.id,Y),Qe.success("Menu updated.",{description:"Changes have been saved successfully."})}else await Uce(Y),Qe.success("Menu created.",{description:"A new menu has been created successfully."});n(!1),i()}catch(Y){Qe.error(o?"Failed to update menu.":"Failed to create menu.",{description:Y?.message?String(Y.message):"Please try again."})}finally{u(!1)}};return d.jsx(_r,{open:t,onOpenChange:n,children:d.jsxs(dr,{className:"sm:max-w-none",style:{width:"70%"},children:[d.jsxs(jr,{children:[d.jsx(Or,{children:o?"Edit System Menu":"New System Menu"}),d.jsx(xn,{children:o?"Update system menu fields and save changes.":"Fill out the form to create a new system menu."})]}),d.jsxs("div",{className:"grid grid-cols-3 gap-6 py-2",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Menu Name *"}),d.jsx(Se,{value:f,onChange:Y=>l(Y.target.value),placeholder:"e.g. Location Manager"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Route URL *"}),d.jsx(Se,{value:m,onChange:Y=>g(Y.target.value),placeholder:"e.g. /location"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Router Name"}),d.jsx(Se,{value:h,onChange:Y=>p(Y.target.value),placeholder:"e.g. location"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Menu Type"}),d.jsxs(Je,{value:b,onValueChange:Y=>y(Y),children:[d.jsx(tt,{className:"h-10 rounded-md border border-gray-200 bg-white",children:d.jsx(et,{})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"directory",children:"Directory"}),d.jsx(Ee,{value:"menu",children:"Menu"})]})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Permission Code"}),d.jsx(Se,{value:w,onChange:Y=>j(Y.target.value),placeholder:"e.g. sys:menu"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Parent"}),d.jsxs(Je,{value:te,disabled:C,onValueChange:Y=>E(Y===fe?"":Y),children:[d.jsx(tt,{className:"h-10 rounded-md border border-gray-200 bg-white",children:d.jsx(et,{placeholder:C?"Loading…":"Select parent directory"})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:fe,children:"Root (no parent)"}),ce.map(Y=>d.jsx(Ee,{value:Y.id,children:Y.menuName?.trim()||Y.id},Y.id))]})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Menu Icon"}),d.jsxs(Je,{value:R||"none",onValueChange:Y=>I(Y==="none"?"":Y),children:[d.jsx(tt,{className:"h-10 rounded-md border border-gray-200 bg-white",children:d.jsx(et,{placeholder:"Select an icon"})}),d.jsxs(rt,{children:[d.jsx(Ee,{value:"none",children:"None"}),Object.keys(iM).map(Y=>{const _e=iM[Y];return d.jsx(Ee,{value:Y,children:d.jsxs("span",{className:"flex items-center gap-2",children:[d.jsx(_e,{className:"h-4 w-4"}),Y]})},Y)})]})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Order"}),d.jsx(Se,{value:F,onChange:Y=>L(Y.target.value),placeholder:"e.g. 10"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Link"}),d.jsx(Se,{value:$,onChange:Y=>U(Y.target.value),placeholder:"Optional"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Component"}),d.jsx(Se,{value:G,onChange:Y=>q(Y.target.value),placeholder:"Optional"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Query"}),d.jsx(Se,{value:H,onChange:Y=>V(Y.target.value),placeholder:"Optional"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(me,{children:"Remark"}),d.jsx(jfe,{value:D,onChange:Y=>Z(Y.target.value),placeholder:"Optional"})]}),d.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[d.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Cache"}),d.jsx(mn,{checked:J,onCheckedChange:M})]}),d.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[d.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Visible"}),d.jsx(mn,{checked:B,onCheckedChange:ee})]}),d.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[d.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),d.jsx(mn,{checked:ae,onCheckedChange:ie})]})]}),d.jsxs(Dr,{className:"flex-row flex-wrap justify-end",children:[d.jsx(we,{className:"min-w-24",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),d.jsx(we,{className:"min-w-24 bg-blue-600 text-white hover:bg-blue-700",disabled:s,onClick:ge,children:s?"Saving...":o?"Save Changes":"Create"})]})]})})}function Pfe({open:e,menu:t,onOpenChange:r,onDeleted:n}){const[i,o]=S.useState(!1),s=S.useMemo(()=>{const f=(t?.menuName??"").trim(),l=(t?.routeUrl??"").trim();return f&&l?`${f} (${l})`:f||l||"this menu"},[t?.menuName,t?.routeUrl]),u=async()=>{if(t?.id){o(!0);try{await Vce(t.id),Qe.success("Menu deleted.",{description:"The menu has been removed successfully."}),r(!1),n()}catch(f){Qe.error("Failed to delete menu.",{description:f?.message?String(f.message):"Please try again."})}finally{o(!1)}}};return d.jsx(_r,{open:e,onOpenChange:r,children:d.jsxs(dr,{className:"sm:max-w-none",style:{width:"30%"},children:[d.jsxs(jr,{children:[d.jsx(Or,{children:"Delete System Menu"}),d.jsx(xn,{children:"This action cannot be undone."})]}),d.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",d.jsx("span",{className:"font-medium",children:s}),"?"]}),d.jsxs(Dr,{className:"flex-row flex-wrap justify-end",children:[d.jsx(we,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),d.jsx(we,{className:"min-w-24",variant:"destructive",disabled:i,onClick:u,children:i?"Deleting...":"Delete"})]})]})})}function Nfe(){const[e,t]=S.useState("Dashboard"),r=()=>{switch(e){case"Dashboard":return d.jsx(Nne,{});case"Training":return d.jsx(Qle,{});case"Alerts":return d.jsx(ece,{});case"Menu Management":return d.jsx(wce,{});case"System Menu":return d.jsx(Efe,{});case"Account Management":return d.jsx(vue,{});case"Reports":return d.jsx(Pue,{});case"Location Manager":return d.jsx(xfe,{});case"Labels":case"Label Categories":case"Label Types":case"Label Templates":case"Multiple Options":return d.jsx(Yle,{currentView:e,onViewChange:t});default:return d.jsx(Ane,{title:e})}};return d.jsx(zz,{currentView:e,setCurrentView:t,children:r()})}w8.createRoot(document.getElementById("root")).render(d.jsx(Nfe,{})); diff --git a/美国版/Food Labeling Management Platform/build/assets/index-hS5-bp4f.js b/美国版/Food Labeling Management Platform/build/assets/index-hS5-bp4f.js new file mode 100644 index 0000000..8296a2f --- /dev/null +++ b/美国版/Food Labeling Management Platform/build/assets/index-hS5-bp4f.js @@ -0,0 +1,453 @@ +function tz(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 o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).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 xf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ry={exports:{}},pc={},ny={exports:{}},tt={};/** + * @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 KC;function rz(){if(KC)return tt;KC=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"),o=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(I){return I===null||typeof I!="object"?null:(I=p&&I[p]||I["@@iterator"],typeof I=="function"?I:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,y={};function S(I,D,Z){this.props=I,this.context=D,this.refs=y,this.updater=Z||v}S.prototype.isReactComponent={},S.prototype.setState=function(I,D){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,D,"setState")},S.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function _(){}_.prototype=S.prototype;function N(I,D,Z){this.props=I,this.context=D,this.refs=y,this.updater=Z||v}var O=N.prototype=new _;O.constructor=N,x(O,S.prototype),O.isPureReactComponent=!0;var A=Array.isArray,C=Object.prototype.hasOwnProperty,E={current:null},T={key:!0,ref:!0,__self:!0,__source:!0};function R(I,D,Z){var ie,oe={},ne=null,K=null;if(D!=null)for(ie in D.ref!==void 0&&(K=D.ref),D.key!==void 0&&(ne=""+D.key),D)C.call(D,ie)&&!T.hasOwnProperty(ie)&&(oe[ie]=D[ie]);var J=arguments.length-2;if(J===1)oe.children=Z;else if(1>>1,D=$[I];if(0>>1;Ia(oe,k))nea(K,oe)?($[I]=K,$[ne]=k,I=ne):($[I]=oe,$[ie]=k,I=ie);else if(nea(K,k))$[I]=K,$[ne]=k,I=ne;else break e}}return Q}function a($,Q){var k=$.sortIndex-Q.sortIndex;return k!==0?k:$.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,u=o.now();e.unstable_now=function(){return o.now()-u}}var d=[],c=[],h=1,p=null,m=3,v=!1,x=!1,y=!1,S=typeof setTimeout=="function"?setTimeout:null,_=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 O($){for(var Q=r(c);Q!==null;){if(Q.callback===null)n(c);else if(Q.startTime<=$)n(c),Q.sortIndex=Q.expirationTime,t(d,Q);else break;Q=r(c)}}function A($){if(y=!1,O($),!x)if(r(d)!==null)x=!0,G(C);else{var Q=r(c);Q!==null&&U(A,Q.startTime-$)}}function C($,Q){x=!1,y&&(y=!1,_(R),R=-1),v=!0;var k=m;try{for(O(Q),p=r(d);p!==null&&(!(p.expirationTime>Q)||$&&!F());){var I=p.callback;if(typeof I=="function"){p.callback=null,m=p.priorityLevel;var D=I(p.expirationTime<=Q);Q=e.unstable_now(),typeof D=="function"?p.callback=D:p===r(d)&&n(d),O(Q)}else n(d);p=r(d)}if(p!==null)var Z=!0;else{var ie=r(c);ie!==null&&U(A,ie.startTime-Q),Z=!1}return Z}finally{p=null,m=k,v=!1}}var E=!1,T=null,R=-1,L=5,z=-1;function F(){return!(e.unstable_now()-z$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return r(d)},e.unstable_next=function($){switch(m){case 1:case 2:case 3:var Q=3;break;default:Q=m}var k=m;m=Q;try{return $()}finally{m=k}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,Q){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var k=m;m=$;try{return Q()}finally{m=k}},e.unstable_scheduleCallback=function($,Q,k){var I=e.unstable_now();switch(typeof k=="object"&&k!==null?(k=k.delay,k=typeof k=="number"&&0I?($.sortIndex=k,t(c,$),r(d)===null&&$===r(c)&&(y?(_(R),R=-1):y=!0,U(A,k-I))):($.sortIndex=D,t(d,$),x||v||(x=!0,G(C))),$},e.unstable_shouldYield=F,e.unstable_wrapCallback=function($){var Q=m;return function(){var k=m;m=Q;try{return $.apply(this,arguments)}finally{m=k}}}})(oy)),oy}var ZC;function oz(){return ZC||(ZC=1,iy.exports=iz()),iy.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 eO;function sz(){if(eO)return Mr;eO=1;var e=Gp(),t=oz();function r(s){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+s,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(s){return d.call(p,s)?!0:d.call(h,s)?!1:c.test(s)?p[s]=!0:(h[s]=!0,!1)}function v(s,f,g,w){if(g!==null&&g.type===0)return!1;switch(typeof f){case"function":case"symbol":return!0;case"boolean":return w?!1:g!==null?!g.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function x(s,f,g,w){if(f===null||typeof f>"u"||v(s,f,g,w))return!0;if(w)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(s,f,g,w,j,P,M){this.acceptsBooleans=f===2||f===3||f===4,this.attributeName=w,this.attributeNamespace=j,this.mustUseProperty=g,this.propertyName=s,this.type=f,this.sanitizeURL=P,this.removeEmptyString=M}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){S[s]=new y(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var f=s[0];S[f]=new y(f,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){S[s]=new y(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){S[s]=new y(s,2,!1,s,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(s){S[s]=new y(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){S[s]=new y(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){S[s]=new y(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){S[s]=new y(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){S[s]=new y(s,5,!1,s.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function N(s){return s[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(s){var f=s.replace(_,N);S[f]=new y(f,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var f=s.replace(_,N);S[f]=new y(f,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var f=s.replace(_,N);S[f]=new y(f,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){S[s]=new y(s,1,!1,s.toLowerCase(),null,!1,!1)}),S.xlinkHref=new y("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){S[s]=new y(s,1,!1,s.toLowerCase(),null,!0,!0)});function O(s,f,g,w){var j=S.hasOwnProperty(f)?S[f]:null;(j!==null?j.type!==0:w||!(2Y||j[M]!==P[Y]){var te=` +`+j[M].replace(" at new "," at ");return s.displayName&&te.includes("")&&(te=te.replace("",s.displayName)),te}while(1<=M&&0<=Y);break}}}finally{Z=!1,Error.prepareStackTrace=g}return(s=s?s.displayName||s.name:"")?D(s):""}function oe(s){switch(s.tag){case 5:return D(s.type);case 16:return D("Lazy");case 13:return D("Suspense");case 19:return D("SuspenseList");case 0:case 2:case 15:return s=ie(s.type,!1),s;case 11:return s=ie(s.type.render,!1),s;case 1:return s=ie(s.type,!0),s;default:return""}}function ne(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case T:return"Fragment";case E:return"Portal";case L:return"Profiler";case R:return"StrictMode";case q:return"Suspense";case H:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case F:return(s.displayName||"Context")+".Consumer";case z:return(s._context.displayName||"Context")+".Provider";case B:var f=s.render;return s=s.displayName,s||(s=f.displayName||f.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case V:return f=s.displayName||null,f!==null?f:ne(s.type)||"Memo";case G:f=s._payload,s=s._init;try{return ne(s(f))}catch{}}return null}function K(s){var f=s.type;switch(s.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 s=f.render,s=s.displayName||s.name||"",f.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return f;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ne(f);case 8:return f===R?"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 J(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function ee(s){var f=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(f==="checkbox"||f==="radio")}function ce(s){var f=ee(s)?"checked":"value",g=Object.getOwnPropertyDescriptor(s.constructor.prototype,f),w=""+s[f];if(!s.hasOwnProperty(f)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var j=g.get,P=g.set;return Object.defineProperty(s,f,{configurable:!0,get:function(){return j.call(this)},set:function(M){w=""+M,P.call(this,M)}}),Object.defineProperty(s,f,{enumerable:g.enumerable}),{getValue:function(){return w},setValue:function(M){w=""+M},stopTracking:function(){s._valueTracker=null,delete s[f]}}}}function pe(s){s._valueTracker||(s._valueTracker=ce(s))}function W(s){if(!s)return!1;var f=s._valueTracker;if(!f)return!0;var g=f.getValue(),w="";return s&&(w=ee(s)?s.checked?"true":"false":s.value),s=w,s!==g?(f.setValue(s),!0):!1}function _e(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function Ce(s,f){var g=f.checked;return k({},f,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:g??s._wrapperState.initialChecked})}function qe(s,f){var g=f.defaultValue==null?"":f.defaultValue,w=f.checked!=null?f.checked:f.defaultChecked;g=J(f.value!=null?f.value:g),s._wrapperState={initialChecked:w,initialValue:g,controlled:f.type==="checkbox"||f.type==="radio"?f.checked!=null:f.value!=null}}function De(s,f){f=f.checked,f!=null&&O(s,"checked",f,!1)}function nt(s,f){De(s,f);var g=J(f.value),w=f.type;if(g!=null)w==="number"?(g===0&&s.value===""||s.value!=g)&&(s.value=""+g):s.value!==""+g&&(s.value=""+g);else if(w==="submit"||w==="reset"){s.removeAttribute("value");return}f.hasOwnProperty("value")?Ut(s,f.type,g):f.hasOwnProperty("defaultValue")&&Ut(s,f.type,J(f.defaultValue)),f.checked==null&&f.defaultChecked!=null&&(s.defaultChecked=!!f.defaultChecked)}function kt(s,f,g){if(f.hasOwnProperty("value")||f.hasOwnProperty("defaultValue")){var w=f.type;if(!(w!=="submit"&&w!=="reset"||f.value!==void 0&&f.value!==null))return;f=""+s._wrapperState.initialValue,g||f===s.value||(s.value=f),s.defaultValue=f}g=s.name,g!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,g!==""&&(s.name=g)}function Ut(s,f,g){(f!=="number"||_e(s.ownerDocument)!==s)&&(g==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+g&&(s.defaultValue=""+g))}var lr=Array.isArray;function Rt(s,f,g,w){if(s=s.options,f){f={};for(var j=0;j"+f.valueOf().toString()+"",f=Do.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;f.firstChild;)s.appendChild(f.firstChild)}});function Li(s,f){if(f){var g=s.firstChild;if(g&&g===s.lastChild&&g.nodeType===3){g.nodeValue=f;return}}s.textContent=f}var xa={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},mg=["Webkit","ms","Moz","O"];Object.keys(xa).forEach(function(s){mg.forEach(function(f){f=f+s.charAt(0).toUpperCase()+s.substring(1),xa[f]=xa[s]})});function cd(s,f,g){return f==null||typeof f=="boolean"||f===""?"":g||typeof f!="number"||f===0||xa.hasOwnProperty(s)&&xa[s]?(""+f).trim():f+"px"}function ud(s,f){s=s.style;for(var g in f)if(f.hasOwnProperty(g)){var w=g.indexOf("--")===0,j=cd(g,f[g],w);g==="float"&&(g="cssFloat"),w?s.setProperty(g,j):s[g]=j}}var gg=k({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 we(s,f){if(f){if(gg[s]&&(f.children!=null||f.dangerouslySetInnerHTML!=null))throw Error(r(137,s));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 ht(s,f){if(s.indexOf("-")===-1)return typeof f.is=="string";switch(s){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 cr=null;function vg(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var yg=null,Lo=null,$o=null;function d_(s){if(s=Zl(s)){if(typeof yg!="function")throw Error(r(280));var f=s.stateNode;f&&(f=Rd(f),yg(s.stateNode,s.type,f))}}function f_(s){Lo?$o?$o.push(s):$o=[s]:Lo=s}function h_(){if(Lo){var s=Lo,f=$o;if($o=Lo=null,d_(s),f)for(s=0;s>>=0,s===0?32:31-(vB(s)/yB|0)|0}var md=64,gd=4194304;function Ml(s){switch(s&-s){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 s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function vd(s,f){var g=s.pendingLanes;if(g===0)return 0;var w=0,j=s.suspendedLanes,P=s.pingedLanes,M=g&268435455;if(M!==0){var Y=M&~j;Y!==0?w=Ml(Y):(P&=M,P!==0&&(w=Ml(P)))}else M=g&~j,M!==0?w=Ml(M):P!==0&&(w=Ml(P));if(w===0)return 0;if(f!==0&&f!==w&&(f&j)===0&&(j=w&-w,P=f&-f,j>=P||j===16&&(P&4194240)!==0))return f;if((w&4)!==0&&(w|=g&16),f=s.entangledLanes,f!==0)for(s=s.entanglements,f&=w;0g;g++)f.push(s);return f}function Dl(s,f,g){s.pendingLanes|=f,f!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,f=31-Cn(f),s[f]=g}function SB(s,f){var g=s.pendingLanes&~f;s.pendingLanes=f,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=f,s.mutableReadLanes&=f,s.entangledLanes&=f,f=s.entanglements;var w=s.eventTimes;for(s=s.expirationTimes;0=Vl),z_=" ",q_=!1;function U_(s,f){switch(s){case"keyup":return YB.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function V_(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var zo=!1;function QB(s,f){switch(s){case"compositionend":return V_(f);case"keypress":return f.which!==32?null:(q_=!0,z_);case"textInput":return s=f.data,s===z_&&q_?null:s;default:return null}}function ZB(s,f){if(zo)return s==="compositionend"||!Dg&&U_(s,f)?(s=M_(),Sd=Ag=Za=null,zo=!1,s):null;switch(s){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-s};s=w}e:{for(;g;){if(g.nextSibling){g=g.nextSibling;break e}g=g.parentNode}g=void 0}g=J_(g)}}function Z_(s,f){return s&&f?s===f?!0:s&&s.nodeType===3?!1:f&&f.nodeType===3?Z_(s,f.parentNode):"contains"in s?s.contains(f):s.compareDocumentPosition?!!(s.compareDocumentPosition(f)&16):!1:!1}function eN(){for(var s=window,f=_e();f instanceof s.HTMLIFrameElement;){try{var g=typeof f.contentWindow.location.href=="string"}catch{g=!1}if(g)s=f.contentWindow;else break;f=_e(s.document)}return f}function Bg(s){var f=s&&s.nodeName&&s.nodeName.toLowerCase();return f&&(f==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||f==="textarea"||s.contentEditable==="true")}function lF(s){var f=eN(),g=s.focusedElem,w=s.selectionRange;if(f!==g&&g&&g.ownerDocument&&Z_(g.ownerDocument.documentElement,g)){if(w!==null&&Bg(g)){if(f=w.start,s=w.end,s===void 0&&(s=f),"selectionStart"in g)g.selectionStart=f,g.selectionEnd=Math.min(s,g.value.length);else if(s=(f=g.ownerDocument||document)&&f.defaultView||window,s.getSelection){s=s.getSelection();var j=g.textContent.length,P=Math.min(w.start,j);w=w.end===void 0?P:Math.min(w.end,j),!s.extend&&P>w&&(j=w,w=P,P=j),j=Q_(g,P);var M=Q_(g,w);j&&M&&(s.rangeCount!==1||s.anchorNode!==j.node||s.anchorOffset!==j.offset||s.focusNode!==M.node||s.focusOffset!==M.offset)&&(f=f.createRange(),f.setStart(j.node,j.offset),s.removeAllRanges(),P>w?(s.addRange(f),s.extend(M.node,M.offset)):(f.setEnd(M.node,M.offset),s.addRange(f)))}}for(f=[],s=g;s=s.parentNode;)s.nodeType===1&&f.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g=document.documentMode,qo=null,Fg=null,Kl=null,zg=!1;function tN(s,f,g){var w=g.window===g?g.document:g.nodeType===9?g:g.ownerDocument;zg||qo==null||qo!==_e(w)||(w=qo,"selectionStart"in w&&Bg(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focusNode:w.focusNode,focusOffset:w.focusOffset}),Kl&&Gl(Kl,w)||(Kl=w,w=Ad(Fg,"onSelect"),0Go||(s.current=Zg[Go],Zg[Go]=null,Go--)}function wt(s,f){Go++,Zg[Go]=s.current,s.current=f}var ni={},hr=ri(ni),Ar=ri(!1),Fi=ni;function Ko(s,f){var g=s.type.contextTypes;if(!g)return ni;var w=s.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===f)return w.__reactInternalMemoizedMaskedChildContext;var j={},P;for(P in g)j[P]=f[P];return w&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=f,s.__reactInternalMemoizedMaskedChildContext=j),j}function Tr(s){return s=s.childContextTypes,s!=null}function Id(){Ot(Ar),Ot(hr)}function gN(s,f,g){if(hr.current!==ni)throw Error(r(168));wt(hr,f),wt(Ar,g)}function vN(s,f,g){var w=s.stateNode;if(f=f.childContextTypes,typeof w.getChildContext!="function")return g;w=w.getChildContext();for(var j in w)if(!(j in f))throw Error(r(108,K(s)||"Unknown",j));return k({},g,w)}function Md(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||ni,Fi=hr.current,wt(hr,s),wt(Ar,Ar.current),!0}function yN(s,f,g){var w=s.stateNode;if(!w)throw Error(r(169));g?(s=vN(s,f,Fi),w.__reactInternalMemoizedMergedChildContext=s,Ot(Ar),Ot(hr),wt(hr,s)):Ot(Ar),wt(Ar,g)}var wa=null,Dd=!1,ev=!1;function xN(s){wa===null?wa=[s]:wa.push(s)}function bF(s){Dd=!0,xN(s)}function ai(){if(!ev&&wa!==null){ev=!0;var s=0,f=pt;try{var g=wa;for(pt=1;s>=M,j-=M,Sa=1<<32-Cn(f)+j|g<Ve?(ar=$e,$e=null):ar=$e.sibling;var ot=ge(ae,$e,se[Ve],Se);if(ot===null){$e===null&&($e=ar);break}s&&$e&&ot.alternate===null&&f(ae,$e),re=P(ot,re,Ve),Le===null?Me=ot:Le.sibling=ot,Le=ot,$e=ar}if(Ve===se.length)return g(ae,$e),Pt&&qi(ae,Ve),Me;if($e===null){for(;VeVe?(ar=$e,$e=null):ar=$e.sibling;var hi=ge(ae,$e,ot.value,Se);if(hi===null){$e===null&&($e=ar);break}s&&$e&&hi.alternate===null&&f(ae,$e),re=P(hi,re,Ve),Le===null?Me=hi:Le.sibling=hi,Le=hi,$e=ar}if(ot.done)return g(ae,$e),Pt&&qi(ae,Ve),Me;if($e===null){for(;!ot.done;Ve++,ot=se.next())ot=be(ae,ot.value,Se),ot!==null&&(re=P(ot,re,Ve),Le===null?Me=ot:Le.sibling=ot,Le=ot);return Pt&&qi(ae,Ve),Me}for($e=w(ae,$e);!ot.done;Ve++,ot=se.next())ot=Oe($e,ae,Ve,ot.value,Se),ot!==null&&(s&&ot.alternate!==null&&$e.delete(ot.key===null?Ve:ot.key),re=P(ot,re,Ve),Le===null?Me=ot:Le.sibling=ot,Le=ot);return s&&$e.forEach(function(ez){return f(ae,ez)}),Pt&&qi(ae,Ve),Me}function zt(ae,re,se,Se){if(typeof se=="object"&&se!==null&&se.type===T&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case C:e:{for(var Me=se.key,Le=re;Le!==null;){if(Le.key===Me){if(Me=se.type,Me===T){if(Le.tag===7){g(ae,Le.sibling),re=j(Le,se.props.children),re.return=ae,ae=re;break e}}else if(Le.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===G&&NN(Me)===Le.type){g(ae,Le.sibling),re=j(Le,se.props),re.ref=ec(ae,Le,se),re.return=ae,ae=re;break e}g(ae,Le);break}else f(ae,Le);Le=Le.sibling}se.type===T?(re=Yi(se.props.children,ae.mode,Se,se.key),re.return=ae,ae=re):(Se=df(se.type,se.key,se.props,null,ae.mode,Se),Se.ref=ec(ae,re,se),Se.return=ae,ae=Se)}return M(ae);case E:e:{for(Le=se.key;re!==null;){if(re.key===Le)if(re.tag===4&&re.stateNode.containerInfo===se.containerInfo&&re.stateNode.implementation===se.implementation){g(ae,re.sibling),re=j(re,se.children||[]),re.return=ae,ae=re;break e}else{g(ae,re);break}else f(ae,re);re=re.sibling}re=Jv(se,ae.mode,Se),re.return=ae,ae=re}return M(ae);case G:return Le=se._init,zt(ae,re,Le(se._payload),Se)}if(lr(se))return Te(ae,re,se,Se);if(Q(se))return Ie(ae,re,se,Se);Fd(ae,se)}return typeof se=="string"&&se!==""||typeof se=="number"?(se=""+se,re!==null&&re.tag===6?(g(ae,re.sibling),re=j(re,se),re.return=ae,ae=re):(g(ae,re),re=Yv(se,ae.mode,Se),re.return=ae,ae=re),M(ae)):g(ae,re)}return zt}var Qo=CN(!0),ON=CN(!1),zd=ri(null),qd=null,Zo=null,ov=null;function sv(){ov=Zo=qd=null}function lv(s){var f=zd.current;Ot(zd),s._currentValue=f}function cv(s,f,g){for(;s!==null;){var w=s.alternate;if((s.childLanes&f)!==f?(s.childLanes|=f,w!==null&&(w.childLanes|=f)):w!==null&&(w.childLanes&f)!==f&&(w.childLanes|=f),s===g)break;s=s.return}}function es(s,f){qd=s,ov=Zo=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&f)!==0&&(kr=!0),s.firstContext=null)}function cn(s){var f=s._currentValue;if(ov!==s)if(s={context:s,memoizedValue:f,next:null},Zo===null){if(qd===null)throw Error(r(308));Zo=s,qd.dependencies={lanes:0,firstContext:s}}else Zo=Zo.next=s;return f}var Ui=null;function uv(s){Ui===null?Ui=[s]:Ui.push(s)}function EN(s,f,g,w){var j=f.interleaved;return j===null?(g.next=g,uv(f)):(g.next=j.next,j.next=g),f.interleaved=g,_a(s,w)}function _a(s,f){s.lanes|=f;var g=s.alternate;for(g!==null&&(g.lanes|=f),g=s,s=s.return;s!==null;)s.childLanes|=f,g=s.alternate,g!==null&&(g.childLanes|=f),g=s,s=s.return;return g.tag===3?g.stateNode:null}var ii=!1;function dv(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function PN(s,f){s=s.updateQueue,f.updateQueue===s&&(f.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function Na(s,f){return{eventTime:s,lane:f,tag:0,payload:null,callback:null,next:null}}function oi(s,f,g){var w=s.updateQueue;if(w===null)return null;if(w=w.shared,(it&2)!==0){var j=w.pending;return j===null?f.next=f:(f.next=j.next,j.next=f),w.pending=f,_a(s,g)}return j=w.interleaved,j===null?(f.next=f,uv(w)):(f.next=j.next,j.next=f),w.interleaved=f,_a(s,g)}function Ud(s,f,g){if(f=f.updateQueue,f!==null&&(f=f.shared,(g&4194240)!==0)){var w=f.lanes;w&=s.pendingLanes,g|=w,f.lanes=g,Ng(s,g)}}function AN(s,f){var g=s.updateQueue,w=s.alternate;if(w!==null&&(w=w.updateQueue,g===w)){var j=null,P=null;if(g=g.firstBaseUpdate,g!==null){do{var M={eventTime:g.eventTime,lane:g.lane,tag:g.tag,payload:g.payload,callback:g.callback,next:null};P===null?j=P=M:P=P.next=M,g=g.next}while(g!==null);P===null?j=P=f:P=P.next=f}else j=P=f;g={baseState:w.baseState,firstBaseUpdate:j,lastBaseUpdate:P,shared:w.shared,effects:w.effects},s.updateQueue=g;return}s=g.lastBaseUpdate,s===null?g.firstBaseUpdate=f:s.next=f,g.lastBaseUpdate=f}function Vd(s,f,g,w){var j=s.updateQueue;ii=!1;var P=j.firstBaseUpdate,M=j.lastBaseUpdate,Y=j.shared.pending;if(Y!==null){j.shared.pending=null;var te=Y,le=te.next;te.next=null,M===null?P=le:M.next=le,M=te;var ye=s.alternate;ye!==null&&(ye=ye.updateQueue,Y=ye.lastBaseUpdate,Y!==M&&(Y===null?ye.firstBaseUpdate=le:Y.next=le,ye.lastBaseUpdate=te))}if(P!==null){var be=j.baseState;M=0,ye=le=te=null,Y=P;do{var ge=Y.lane,Oe=Y.eventTime;if((w&ge)===ge){ye!==null&&(ye=ye.next={eventTime:Oe,lane:0,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null});e:{var Te=s,Ie=Y;switch(ge=f,Oe=g,Ie.tag){case 1:if(Te=Ie.payload,typeof Te=="function"){be=Te.call(Oe,be,ge);break e}be=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ie.payload,ge=typeof Te=="function"?Te.call(Oe,be,ge):Te,ge==null)break e;be=k({},be,ge);break e;case 2:ii=!0}}Y.callback!==null&&Y.lane!==0&&(s.flags|=64,ge=j.effects,ge===null?j.effects=[Y]:ge.push(Y))}else Oe={eventTime:Oe,lane:ge,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},ye===null?(le=ye=Oe,te=be):ye=ye.next=Oe,M|=ge;if(Y=Y.next,Y===null){if(Y=j.shared.pending,Y===null)break;ge=Y,Y=ge.next,ge.next=null,j.lastBaseUpdate=ge,j.shared.pending=null}}while(!0);if(ye===null&&(te=be),j.baseState=te,j.firstBaseUpdate=le,j.lastBaseUpdate=ye,f=j.shared.interleaved,f!==null){j=f;do M|=j.lane,j=j.next;while(j!==f)}else P===null&&(j.shared.lanes=0);Wi|=M,s.lanes=M,s.memoizedState=be}}function TN(s,f,g){if(s=f.effects,f.effects=null,s!==null)for(f=0;fg?g:4,s(!0);var w=gv.transition;gv.transition={};try{s(!1),f()}finally{pt=g,gv.transition=w}}function YN(){return un().memoizedState}function _F(s,f,g){var w=ui(s);if(g={lane:w,action:g,hasEagerState:!1,eagerState:null,next:null},JN(s))QN(f,g);else if(g=EN(s,f,g,w),g!==null){var j=wr();kn(g,s,w,j),ZN(g,f,w)}}function NF(s,f,g){var w=ui(s),j={lane:w,action:g,hasEagerState:!1,eagerState:null,next:null};if(JN(s))QN(f,j);else{var P=s.alternate;if(s.lanes===0&&(P===null||P.lanes===0)&&(P=f.lastRenderedReducer,P!==null))try{var M=f.lastRenderedState,Y=P(M,g);if(j.hasEagerState=!0,j.eagerState=Y,On(Y,M)){var te=f.interleaved;te===null?(j.next=j,uv(f)):(j.next=te.next,te.next=j),f.interleaved=j;return}}catch{}finally{}g=EN(s,f,j,w),g!==null&&(j=wr(),kn(g,s,w,j),ZN(g,f,w))}}function JN(s){var f=s.alternate;return s===Mt||f!==null&&f===Mt}function QN(s,f){ac=Gd=!0;var g=s.pending;g===null?f.next=f:(f.next=g.next,g.next=f),s.pending=f}function ZN(s,f,g){if((g&4194240)!==0){var w=f.lanes;w&=s.pendingLanes,g|=w,f.lanes=g,Ng(s,g)}}var Yd={readContext:cn,useCallback:pr,useContext:pr,useEffect:pr,useImperativeHandle:pr,useInsertionEffect:pr,useLayoutEffect:pr,useMemo:pr,useReducer:pr,useRef:pr,useState:pr,useDebugValue:pr,useDeferredValue:pr,useTransition:pr,useMutableSource:pr,useSyncExternalStore:pr,useId:pr,unstable_isNewReconciler:!1},CF={readContext:cn,useCallback:function(s,f){return Qn().memoizedState=[s,f===void 0?null:f],s},useContext:cn,useEffect:qN,useImperativeHandle:function(s,f,g){return g=g!=null?g.concat([s]):null,Kd(4194308,4,HN.bind(null,f,s),g)},useLayoutEffect:function(s,f){return Kd(4194308,4,s,f)},useInsertionEffect:function(s,f){return Kd(4,2,s,f)},useMemo:function(s,f){var g=Qn();return f=f===void 0?null:f,s=s(),g.memoizedState=[s,f],s},useReducer:function(s,f,g){var w=Qn();return f=g!==void 0?g(f):f,w.memoizedState=w.baseState=f,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:f},w.queue=s,s=s.dispatch=_F.bind(null,Mt,s),[w.memoizedState,s]},useRef:function(s){var f=Qn();return s={current:s},f.memoizedState=s},useState:FN,useDebugValue:jv,useDeferredValue:function(s){return Qn().memoizedState=s},useTransition:function(){var s=FN(!1),f=s[0];return s=jF.bind(null,s[1]),Qn().memoizedState=s,[f,s]},useMutableSource:function(){},useSyncExternalStore:function(s,f,g){var w=Mt,j=Qn();if(Pt){if(g===void 0)throw Error(r(407));g=g()}else{if(g=f(),nr===null)throw Error(r(349));(Hi&30)!==0||MN(w,f,g)}j.memoizedState=g;var P={value:g,getSnapshot:f};return j.queue=P,qN(LN.bind(null,w,P,s),[s]),w.flags|=2048,sc(9,DN.bind(null,w,P,g,f),void 0,null),g},useId:function(){var s=Qn(),f=nr.identifierPrefix;if(Pt){var g=ja,w=Sa;g=(w&~(1<<32-Cn(w)-1)).toString(32)+g,f=":"+f+"R"+g,g=ic++,0<\/script>",s=s.removeChild(s.firstChild)):typeof w.is=="string"?s=M.createElement(g,{is:w.is}):(s=M.createElement(g),g==="select"&&(M=s,w.multiple?M.multiple=!0:w.size&&(M.size=w.size))):s=M.createElementNS(s,g),s[Yn]=f,s[Ql]=w,xC(s,f,!1,!1),f.stateNode=s;e:{switch(M=ht(g,w),g){case"dialog":Ct("cancel",s),Ct("close",s),j=w;break;case"iframe":case"object":case"embed":Ct("load",s),j=w;break;case"video":case"audio":for(j=0;jis&&(f.flags|=128,w=!0,lc(P,!1),f.lanes=4194304)}else{if(!w)if(s=Hd(M),s!==null){if(f.flags|=128,w=!0,g=s.updateQueue,g!==null&&(f.updateQueue=g,f.flags|=4),lc(P,!0),P.tail===null&&P.tailMode==="hidden"&&!M.alternate&&!Pt)return mr(f),null}else 2*Ft()-P.renderingStartTime>is&&g!==1073741824&&(f.flags|=128,w=!0,lc(P,!1),f.lanes=4194304);P.isBackwards?(M.sibling=f.child,f.child=M):(g=P.last,g!==null?g.sibling=M:f.child=M,P.last=M)}return P.tail!==null?(f=P.tail,P.rendering=f,P.tail=f.sibling,P.renderingStartTime=Ft(),f.sibling=null,g=It.current,wt(It,w?g&1|2:g&1),f):(mr(f),null);case 22:case 23:return Gv(),w=f.memoizedState!==null,s!==null&&s.memoizedState!==null!==w&&(f.flags|=8192),w&&(f.mode&1)!==0?(Ur&1073741824)!==0&&(mr(f),f.subtreeFlags&6&&(f.flags|=8192)):mr(f),null;case 24:return null;case 25:return null}throw Error(r(156,f.tag))}function IF(s,f){switch(rv(f),f.tag){case 1:return Tr(f.type)&&Id(),s=f.flags,s&65536?(f.flags=s&-65537|128,f):null;case 3:return ts(),Ot(Ar),Ot(hr),mv(),s=f.flags,(s&65536)!==0&&(s&128)===0?(f.flags=s&-65537|128,f):null;case 5:return hv(f),null;case 13:if(Ot(It),s=f.memoizedState,s!==null&&s.dehydrated!==null){if(f.alternate===null)throw Error(r(340));Jo()}return s=f.flags,s&65536?(f.flags=s&-65537|128,f):null;case 19:return Ot(It),null;case 4:return ts(),null;case 10:return lv(f.type._context),null;case 22:case 23:return Gv(),null;case 24:return null;default:return null}}var ef=!1,gr=!1,MF=typeof WeakSet=="function"?WeakSet:Set,Ee=null;function ns(s,f){var g=s.ref;if(g!==null)if(typeof g=="function")try{g(null)}catch(w){Dt(s,f,w)}else g.current=null}function Mv(s,f,g){try{g()}catch(w){Dt(s,f,w)}}var SC=!1;function DF(s,f){if(Gg=bd,s=eN(),Bg(s)){if("selectionStart"in s)var g={start:s.selectionStart,end:s.selectionEnd};else e:{g=(g=s.ownerDocument)&&g.defaultView||window;var w=g.getSelection&&g.getSelection();if(w&&w.rangeCount!==0){g=w.anchorNode;var j=w.anchorOffset,P=w.focusNode;w=w.focusOffset;try{g.nodeType,P.nodeType}catch{g=null;break e}var M=0,Y=-1,te=-1,le=0,ye=0,be=s,ge=null;t:for(;;){for(var Oe;be!==g||j!==0&&be.nodeType!==3||(Y=M+j),be!==P||w!==0&&be.nodeType!==3||(te=M+w),be.nodeType===3&&(M+=be.nodeValue.length),(Oe=be.firstChild)!==null;)ge=be,be=Oe;for(;;){if(be===s)break t;if(ge===g&&++le===j&&(Y=M),ge===P&&++ye===w&&(te=M),(Oe=be.nextSibling)!==null)break;be=ge,ge=be.parentNode}be=Oe}g=Y===-1||te===-1?null:{start:Y,end:te}}else g=null}g=g||{start:0,end:0}}else g=null;for(Kg={focusedElem:s,selectionRange:g},bd=!1,Ee=f;Ee!==null;)if(f=Ee,s=f.child,(f.subtreeFlags&1028)!==0&&s!==null)s.return=f,Ee=s;else for(;Ee!==null;){f=Ee;try{var Te=f.alternate;if((f.flags&1024)!==0)switch(f.tag){case 0:case 11:case 15:break;case 1:if(Te!==null){var Ie=Te.memoizedProps,zt=Te.memoizedState,ae=f.stateNode,re=ae.getSnapshotBeforeUpdate(f.elementType===f.type?Ie:Pn(f.type,Ie),zt);ae.__reactInternalSnapshotBeforeUpdate=re}break;case 3:var se=f.stateNode.containerInfo;se.nodeType===1?se.textContent="":se.nodeType===9&&se.documentElement&&se.removeChild(se.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Se){Dt(f,f.return,Se)}if(s=f.sibling,s!==null){s.return=f.return,Ee=s;break}Ee=f.return}return Te=SC,SC=!1,Te}function cc(s,f,g){var w=f.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var j=w=w.next;do{if((j.tag&s)===s){var P=j.destroy;j.destroy=void 0,P!==void 0&&Mv(f,g,P)}j=j.next}while(j!==w)}}function tf(s,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var g=f=f.next;do{if((g.tag&s)===s){var w=g.create;g.destroy=w()}g=g.next}while(g!==f)}}function Dv(s){var f=s.ref;if(f!==null){var g=s.stateNode;switch(s.tag){case 5:s=g;break;default:s=g}typeof f=="function"?f(s):f.current=s}}function jC(s){var f=s.alternate;f!==null&&(s.alternate=null,jC(f)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(f=s.stateNode,f!==null&&(delete f[Yn],delete f[Ql],delete f[Qg],delete f[yF],delete f[xF])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function _C(s){return s.tag===5||s.tag===3||s.tag===4}function NC(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||_C(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Lv(s,f,g){var w=s.tag;if(w===5||w===6)s=s.stateNode,f?g.nodeType===8?g.parentNode.insertBefore(s,f):g.insertBefore(s,f):(g.nodeType===8?(f=g.parentNode,f.insertBefore(s,g)):(f=g,f.appendChild(s)),g=g._reactRootContainer,g!=null||f.onclick!==null||(f.onclick=kd));else if(w!==4&&(s=s.child,s!==null))for(Lv(s,f,g),s=s.sibling;s!==null;)Lv(s,f,g),s=s.sibling}function $v(s,f,g){var w=s.tag;if(w===5||w===6)s=s.stateNode,f?g.insertBefore(s,f):g.appendChild(s);else if(w!==4&&(s=s.child,s!==null))for($v(s,f,g),s=s.sibling;s!==null;)$v(s,f,g),s=s.sibling}var ur=null,An=!1;function si(s,f,g){for(g=g.child;g!==null;)CC(s,f,g),g=g.sibling}function CC(s,f,g){if(Xn&&typeof Xn.onCommitFiberUnmount=="function")try{Xn.onCommitFiberUnmount(pd,g)}catch{}switch(g.tag){case 5:gr||ns(g,f);case 6:var w=ur,j=An;ur=null,si(s,f,g),ur=w,An=j,ur!==null&&(An?(s=ur,g=g.stateNode,s.nodeType===8?s.parentNode.removeChild(g):s.removeChild(g)):ur.removeChild(g.stateNode));break;case 18:ur!==null&&(An?(s=ur,g=g.stateNode,s.nodeType===8?Jg(s.parentNode,g):s.nodeType===1&&Jg(s,g),zl(s)):Jg(ur,g.stateNode));break;case 4:w=ur,j=An,ur=g.stateNode.containerInfo,An=!0,si(s,f,g),ur=w,An=j;break;case 0:case 11:case 14:case 15:if(!gr&&(w=g.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){j=w=w.next;do{var P=j,M=P.destroy;P=P.tag,M!==void 0&&((P&2)!==0||(P&4)!==0)&&Mv(g,f,M),j=j.next}while(j!==w)}si(s,f,g);break;case 1:if(!gr&&(ns(g,f),w=g.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=g.memoizedProps,w.state=g.memoizedState,w.componentWillUnmount()}catch(Y){Dt(g,f,Y)}si(s,f,g);break;case 21:si(s,f,g);break;case 22:g.mode&1?(gr=(w=gr)||g.memoizedState!==null,si(s,f,g),gr=w):si(s,f,g);break;default:si(s,f,g)}}function OC(s){var f=s.updateQueue;if(f!==null){s.updateQueue=null;var g=s.stateNode;g===null&&(g=s.stateNode=new MF),f.forEach(function(w){var j=HF.bind(null,s,w);g.has(w)||(g.add(w),w.then(j,j))})}}function Tn(s,f){var g=f.deletions;if(g!==null)for(var w=0;wj&&(j=M),w&=~P}if(w=j,w=Ft()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*$F(w/1960))-w,10s?16:s,ci===null)var w=!1;else{if(s=ci,ci=null,sf=0,(it&6)!==0)throw Error(r(331));var j=it;for(it|=4,Ee=s.current;Ee!==null;){var P=Ee,M=P.child;if((Ee.flags&16)!==0){var Y=P.deletions;if(Y!==null){for(var te=0;teFt()-zv?Ki(s,0):Fv|=g),Ir(s,f)}function FC(s,f){f===0&&((s.mode&1)===0?f=1:(f=gd,gd<<=1,(gd&130023424)===0&&(gd=4194304)));var g=wr();s=_a(s,f),s!==null&&(Dl(s,f,g),Ir(s,g))}function VF(s){var f=s.memoizedState,g=0;f!==null&&(g=f.retryLane),FC(s,g)}function HF(s,f){var g=0;switch(s.tag){case 13:var w=s.stateNode,j=s.memoizedState;j!==null&&(g=j.retryLane);break;case 19:w=s.stateNode;break;default:throw Error(r(314))}w!==null&&w.delete(f),FC(s,g)}var zC;zC=function(s,f,g){if(s!==null)if(s.memoizedProps!==f.pendingProps||Ar.current)kr=!0;else{if((s.lanes&g)===0&&(f.flags&128)===0)return kr=!1,kF(s,f,g);kr=(s.flags&131072)!==0}else kr=!1,Pt&&(f.flags&1048576)!==0&&bN(f,$d,f.index);switch(f.lanes=0,f.tag){case 2:var w=f.type;Zd(s,f),s=f.pendingProps;var j=Ko(f,hr.current);es(f,g),j=yv(null,f,w,s,j,g);var P=xv();return f.flags|=1,typeof j=="object"&&j!==null&&typeof j.render=="function"&&j.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,Tr(w)?(P=!0,Md(f)):P=!1,f.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,dv(f),j.updater=Jd,f.stateNode=j,j._reactInternals=f,Nv(f,w,s,g),f=Pv(null,f,w,!0,P,g)):(f.tag=0,Pt&&P&&tv(f),br(null,f,j,g),f=f.child),f;case 16:w=f.elementType;e:{switch(Zd(s,f),s=f.pendingProps,j=w._init,w=j(w._payload),f.type=w,j=f.tag=GF(w),s=Pn(w,s),j){case 0:f=Ev(null,f,w,s,g);break e;case 1:f=hC(null,f,w,s,g);break e;case 11:f=lC(null,f,w,s,g);break e;case 14:f=cC(null,f,w,Pn(w.type,s),g);break e}throw Error(r(306,w,""))}return f;case 0:return w=f.type,j=f.pendingProps,j=f.elementType===w?j:Pn(w,j),Ev(s,f,w,j,g);case 1:return w=f.type,j=f.pendingProps,j=f.elementType===w?j:Pn(w,j),hC(s,f,w,j,g);case 3:e:{if(pC(f),s===null)throw Error(r(387));w=f.pendingProps,P=f.memoizedState,j=P.element,PN(s,f),Vd(f,w,null,g);var M=f.memoizedState;if(w=M.element,P.isDehydrated)if(P={element:w,isDehydrated:!1,cache:M.cache,pendingSuspenseBoundaries:M.pendingSuspenseBoundaries,transitions:M.transitions},f.updateQueue.baseState=P,f.memoizedState=P,f.flags&256){j=rs(Error(r(423)),f),f=mC(s,f,w,g,j);break e}else if(w!==j){j=rs(Error(r(424)),f),f=mC(s,f,w,g,j);break e}else for(qr=ti(f.stateNode.containerInfo.firstChild),zr=f,Pt=!0,En=null,g=ON(f,null,w,g),f.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling;else{if(Jo(),w===j){f=Ca(s,f,g);break e}br(s,f,w,g)}f=f.child}return f;case 5:return kN(f),s===null&&av(f),w=f.type,j=f.pendingProps,P=s!==null?s.memoizedProps:null,M=j.children,Xg(w,j)?M=null:P!==null&&Xg(w,P)&&(f.flags|=32),fC(s,f),br(s,f,M,g),f.child;case 6:return s===null&&av(f),null;case 13:return gC(s,f,g);case 4:return fv(f,f.stateNode.containerInfo),w=f.pendingProps,s===null?f.child=Qo(f,null,w,g):br(s,f,w,g),f.child;case 11:return w=f.type,j=f.pendingProps,j=f.elementType===w?j:Pn(w,j),lC(s,f,w,j,g);case 7:return br(s,f,f.pendingProps,g),f.child;case 8:return br(s,f,f.pendingProps.children,g),f.child;case 12:return br(s,f,f.pendingProps.children,g),f.child;case 10:e:{if(w=f.type._context,j=f.pendingProps,P=f.memoizedProps,M=j.value,wt(zd,w._currentValue),w._currentValue=M,P!==null)if(On(P.value,M)){if(P.children===j.children&&!Ar.current){f=Ca(s,f,g);break e}}else for(P=f.child,P!==null&&(P.return=f);P!==null;){var Y=P.dependencies;if(Y!==null){M=P.child;for(var te=Y.firstContext;te!==null;){if(te.context===w){if(P.tag===1){te=Na(-1,g&-g),te.tag=2;var le=P.updateQueue;if(le!==null){le=le.shared;var ye=le.pending;ye===null?te.next=te:(te.next=ye.next,ye.next=te),le.pending=te}}P.lanes|=g,te=P.alternate,te!==null&&(te.lanes|=g),cv(P.return,g,f),Y.lanes|=g;break}te=te.next}}else if(P.tag===10)M=P.type===f.type?null:P.child;else if(P.tag===18){if(M=P.return,M===null)throw Error(r(341));M.lanes|=g,Y=M.alternate,Y!==null&&(Y.lanes|=g),cv(M,g,f),M=P.sibling}else M=P.child;if(M!==null)M.return=P;else for(M=P;M!==null;){if(M===f){M=null;break}if(P=M.sibling,P!==null){P.return=M.return,M=P;break}M=M.return}P=M}br(s,f,j.children,g),f=f.child}return f;case 9:return j=f.type,w=f.pendingProps.children,es(f,g),j=cn(j),w=w(j),f.flags|=1,br(s,f,w,g),f.child;case 14:return w=f.type,j=Pn(w,f.pendingProps),j=Pn(w.type,j),cC(s,f,w,j,g);case 15:return uC(s,f,f.type,f.pendingProps,g);case 17:return w=f.type,j=f.pendingProps,j=f.elementType===w?j:Pn(w,j),Zd(s,f),f.tag=1,Tr(w)?(s=!0,Md(f)):s=!1,es(f,g),tC(f,w,j),Nv(f,w,j,g),Pv(null,f,w,!0,s,g);case 19:return yC(s,f,g);case 22:return dC(s,f,g)}throw Error(r(156,f.tag))};function qC(s,f){return w_(s,f)}function WF(s,f,g,w){this.tag=s,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=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fn(s,f,g,w){return new WF(s,f,g,w)}function Xv(s){return s=s.prototype,!(!s||!s.isReactComponent)}function GF(s){if(typeof s=="function")return Xv(s)?1:0;if(s!=null){if(s=s.$$typeof,s===B)return 11;if(s===V)return 14}return 2}function fi(s,f){var g=s.alternate;return g===null?(g=fn(s.tag,f,s.key,s.mode),g.elementType=s.elementType,g.type=s.type,g.stateNode=s.stateNode,g.alternate=s,s.alternate=g):(g.pendingProps=f,g.type=s.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=s.flags&14680064,g.childLanes=s.childLanes,g.lanes=s.lanes,g.child=s.child,g.memoizedProps=s.memoizedProps,g.memoizedState=s.memoizedState,g.updateQueue=s.updateQueue,f=s.dependencies,g.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},g.sibling=s.sibling,g.index=s.index,g.ref=s.ref,g}function df(s,f,g,w,j,P){var M=2;if(w=s,typeof s=="function")Xv(s)&&(M=1);else if(typeof s=="string")M=5;else e:switch(s){case T:return Yi(g.children,j,P,f);case R:M=8,j|=8;break;case L:return s=fn(12,g,f,j|2),s.elementType=L,s.lanes=P,s;case q:return s=fn(13,g,f,j),s.elementType=q,s.lanes=P,s;case H:return s=fn(19,g,f,j),s.elementType=H,s.lanes=P,s;case U:return ff(g,j,P,f);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case z:M=10;break e;case F:M=9;break e;case B:M=11;break e;case V:M=14;break e;case G:M=16,w=null;break e}throw Error(r(130,s==null?s:typeof s,""))}return f=fn(M,g,f,j),f.elementType=s,f.type=w,f.lanes=P,f}function Yi(s,f,g,w){return s=fn(7,s,w,f),s.lanes=g,s}function ff(s,f,g,w){return s=fn(22,s,w,f),s.elementType=U,s.lanes=g,s.stateNode={isHidden:!1},s}function Yv(s,f,g){return s=fn(6,s,null,f),s.lanes=g,s}function Jv(s,f,g){return f=fn(4,s.children!==null?s.children:[],s.key,f),f.lanes=g,f.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},f}function KF(s,f,g,w,j){this.tag=f,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=_g(0),this.expirationTimes=_g(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_g(0),this.identifierPrefix=w,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function Qv(s,f,g,w,j,P,M,Y,te){return s=new KF(s,f,g,Y,te),f===1?(f=1,P===!0&&(f|=8)):f=0,P=fn(3,null,null,f),s.current=P,P.stateNode=s,P.memoizedState={element:w,isDehydrated:g,cache:null,transitions:null,pendingSuspenseBoundaries:null},dv(P),s}function XF(s,f,g){var w=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ay.exports=sz(),ay.exports}var rO;function lz(){if(rO)return bf;rO=1;var e=KI();return bf.createRoot=e.createRoot,bf.hydrateRoot=e.hydrateRoot,bf}var cz=lz(),b=Gp();const X=ct(b),NS=tz({__proto__:null,default:X},[b]);/** + * @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=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),dz=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),nO=e=>{const t=dz(e);return t.charAt(0).toUpperCase()+t.slice(1)},XI=(...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 fz={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 hz=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:i,iconNode:o,...u},d)=>b.createElement("svg",{ref:d,...fz,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:XI("lucide",a),...u},[...o.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 ze=(e,t)=>{const r=b.forwardRef(({className:n,...a},i)=>b.createElement(hz,{ref:i,iconNode:t,className:XI(`lucide-${uz(nO(e))}`,`lucide-${e}`,n),...a}));return r.displayName=nO(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 pz=[["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"}]],mz=ze("arrow-down-a-z",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 gz=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],vz=ze("arrow-down-right",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 yz=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],xz=ze("arrow-left",yz);/** + * @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=[["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"}]],wz=ze("arrow-up-down",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 Sz=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],YI=ze("arrow-up-right",Sz);/** + * @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:"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"}]],_z=ze("calendar",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:"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"}]],Cz=ze("chart-column",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 Oz=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],JI=ze("check",Oz);/** + * @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:"m6 9 6 6 6-6",key:"qrunsl"}]],Is=ze("chevron-down",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:"m15 18-6-6 6-6",key:"1wnfg3"}]],QI=ze("chevron-left",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 Az=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ms=ze("chevron-right",Az);/** + * @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:"m18 15-6-6-6 6",key:"153udz"}]],kz=ze("chevron-up",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 Rz=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],ZI=ze("chevrons-up-down",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=[["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"}]],Ph=ze("circle-help",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=[["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"}]],Dz=ze("circle-user",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:"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"}]],$z=ze("coffee",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 Bz=[["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"}]],CS=ze("download",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 Fz=[["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"}]],Ei=ze("ellipsis",Fz);/** + * @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:"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"}]],eM=ze("file-box",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 qz=[["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"}]],Ds=ze("file-text",qz);/** + * @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=[["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"}]],Vz=ze("grid-3x3",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=[["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"}]],Wz=ze("image",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 Gz=[["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"}]],tM=ze("layers",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=[["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"}]],rM=ze("layout-dashboard",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=[["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"}]],Yz=ze("list",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=[["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"}]],Qz=ze("log-out",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:"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"}]],hl=ze("map-pin",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 e8=[["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"}]],t8=ze("menu",e8);/** + * @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 r8=[["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"}]],Vc=ze("package",r8);/** + * @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 n8=[["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"}]],_h=ze("pencil",n8);/** + * @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 a8=[["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"}]],i8=ze("pin",a8);/** + * @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 o8=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],wn=ze("plus",o8);/** + * @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 s8=[["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"}]],nM=ze("printer",s8);/** + * @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 l8=[["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"}]],c8=ze("refresh-cw",l8);/** + * @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:"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"}]],d8=ze("save",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 f8=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Kp=ze("search",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 h8=[["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"}]],Ah=ze("settings",h8);/** + * @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 p8=[["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"}]],m8=ze("shield",p8);/** + * @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:"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"}]],xn=ze("square-pen",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 v8=[["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"}]],y8=ze("store",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 x8=[["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"}]],sy=ze("syringe",x8);/** + * @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 b8=[["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"}]],w8=ze("tablet",b8);/** + * @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 S8=[["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"}]],Th=ze("tag",S8);/** + * @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=[["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"}]],_8=ze("timer",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 N8=[["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"}]],Hc=ze("trash-2",N8);/** + * @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 C8=[["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"}]],O8=ze("trending-up",C8);/** + * @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 E8=[["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"}]],aM=ze("type",E8);/** + * @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 P8=[["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"}]],A8=ze("upload",P8);/** + * @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 T8=[["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"}]],k8=ze("user",T8);/** + * @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 R8=[["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"}]],OS=ze("users",R8);/** + * @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 I8=[["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"}]],M8=ze("utensils",I8);/** + * @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 D8=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],uo=ze("x",D8);function iM(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}),kh="-",aO=[],B8="arbitrary..",F8=e=>{const t=q8(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return z8(o);const u=o.split(kh),d=u[0]===""&&u.length>1?1:0;return sM(u,d,t)},getConflictingClassGroupIds:(o,u)=>{if(u){const d=n[o],c=r[o];return d?c?L8(c,d):d:c||aO}return r[o]||aO}}},sM=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const a=e[t],i=r.nextPart.get(a);if(i){const c=sM(e,t+1,i);if(c)return c}const o=r.validators;if(o===null)return;const u=t===0?e.join(kh):e.slice(t).join(kh),d=o.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?B8+n:void 0})(),q8=e=>{const{theme:t,classGroups:r}=e;return U8(r,t)},U8=(e,t)=>{const r=oM();for(const n in e){const a=e[n];ES(a,r,n,t)}return r},ES=(e,t,r,n)=>{const a=e.length;for(let i=0;i{if(typeof e=="string"){H8(e,t,r);return}if(typeof e=="function"){W8(e,t,r,n);return}G8(e,t,r,n)},H8=(e,t,r)=>{const n=e===""?t:lM(t,e);n.classGroupId=r},W8=(e,t,r,n)=>{if(K8(e)){ES(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push($8(r,e))},G8=(e,t,r,n)=>{const a=Object.entries(e),i=a.length;for(let o=0;o{let r=e;const n=t.split(kh),a=n.length;for(let i=0;i"isThemeGetter"in e&&e.isThemeGetter===!0,X8=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(i,o)=>{r[i]=o,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(i){let o=r[i];if(o!==void 0)return o;if((o=n[i])!==void 0)return a(i,o),o},set(i,o){i in r?r[i]=o:a(i,o)}}},M1="!",iO=":",Y8=[],oO=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),J8=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const i=[];let o=0,u=0,d=0,c;const h=a.length;for(let y=0;yd?c-d:void 0;return oO(i,v,m,x)};if(t){const a=t+iO,i=n;n=o=>o.startsWith(a)?i(o.slice(a.length)):oO(Y8,!1,o,void 0,!0)}if(r){const a=n;n=i=>r({className:i,parseClassName:a})}return n},Q8=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(o)):a.push(o)}return a.length>0&&(a.sort(),n.push(...a)),n}},Z8=e=>({cache:X8(e.cacheSize),parseClassName:J8(e),sortModifiers:Q8(e),...F8(e)}),e6=/\s+/,t6=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],u=e.trim().split(e6);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 S=!!y,_=n(S?x.substring(0,y):x);if(!_){if(!S){d=h+(d.length>0?" "+d:d);continue}if(_=n(x),!_){d=h+(d.length>0?" "+d:d);continue}S=!1}const N=m.length===0?"":m.length===1?m[0]:i(m).join(":"),O=v?N+M1:N,A=O+_;if(o.indexOf(A)>-1)continue;o.push(A);const C=a(_,S);for(let E=0;E0?" "+d:d)}return d},r6=(...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 o=d=>{const c=t.reduce((h,p)=>p(h),e());return r=Z8(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=t6(d,r);return a(d,h),h};return i=o,(...d)=>i(r6(...d))},a6=[],Yt=e=>{const t=r=>r[e]||a6;return t.isThemeGetter=!0,t},uM=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,dM=/^\((?:(\w[\w-]*):)?(.+)\)$/i,i6=/^\d+\/\d+$/,o6=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,s6=/\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$/,l6=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,c6=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,u6=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ss=e=>i6.test(e),et=e=>!!e&&!Number.isNaN(Number(e)),pi=e=>!!e&&Number.isInteger(Number(e)),ly=e=>e.endsWith("%")&&et(e.slice(0,-1)),Ea=e=>o6.test(e),d6=()=>!0,f6=e=>s6.test(e)&&!l6.test(e),fM=()=>!1,h6=e=>c6.test(e),p6=e=>u6.test(e),m6=e=>!ke(e)&&!Re(e),g6=e=>pl(e,mM,fM),ke=e=>uM.test(e),Ji=e=>pl(e,gM,f6),cy=e=>pl(e,w6,et),sO=e=>pl(e,hM,fM),v6=e=>pl(e,pM,p6),wf=e=>pl(e,vM,h6),Re=e=>dM.test(e),mc=e=>ml(e,gM),y6=e=>ml(e,S6),lO=e=>ml(e,hM),x6=e=>ml(e,mM),b6=e=>ml(e,pM),Sf=e=>ml(e,vM,!0),pl=(e,t,r)=>{const n=uM.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},ml=(e,t,r=!1)=>{const n=dM.exec(e);return n?n[1]?t(n[1]):r:!1},hM=e=>e==="position"||e==="percentage",pM=e=>e==="image"||e==="url",mM=e=>e==="length"||e==="size"||e==="bg-size",gM=e=>e==="length",w6=e=>e==="number",S6=e=>e==="family-name",vM=e=>e==="shadow",j6=()=>{const e=Yt("color"),t=Yt("font"),r=Yt("text"),n=Yt("font-weight"),a=Yt("tracking"),i=Yt("leading"),o=Yt("breakpoint"),u=Yt("container"),d=Yt("spacing"),c=Yt("radius"),h=Yt("shadow"),p=Yt("inset-shadow"),m=Yt("text-shadow"),v=Yt("drop-shadow"),x=Yt("blur"),y=Yt("perspective"),S=Yt("aspect"),_=Yt("ease"),N=Yt("animate"),O=()=>["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"],C=()=>[...A(),Re,ke],E=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],R=()=>[Re,ke,d],L=()=>[ss,"full","auto",...R()],z=()=>[pi,"none","subgrid",Re,ke],F=()=>["auto",{span:["full",pi,Re,ke]},pi,Re,ke],B=()=>[pi,"auto",Re,ke],q=()=>["auto","min","max","fr",Re,ke],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...R()],U=()=>[ss,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],$=()=>[e,Re,ke],Q=()=>[...A(),lO,sO,{position:[Re,ke]}],k=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",x6,g6,{size:[Re,ke]}],D=()=>[ly,mc,Ji],Z=()=>["","none","full",c,Re,ke],ie=()=>["",et,mc,Ji],oe=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[et,ly,lO,sO],J=()=>["","none",x,Re,ke],ee=()=>["none",et,Re,ke],ce=()=>["none",et,Re,ke],pe=()=>[et,Re,ke],W=()=>[ss,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ea],breakpoint:[Ea],color:[d6],container:[Ea],"drop-shadow":[Ea],ease:["in","out","in-out"],font:[m6],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ea],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ea],shadow:[Ea],spacing:["px",et],text:[Ea],"text-shadow":[Ea],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ss,ke,Re,S]}],container:["container"],columns:[{columns:[et,ke,Re,u]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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:C()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[pi,"auto",Re,ke]}],basis:[{basis:[ss,"full","auto",u,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[et,ss,"auto","initial","none",ke]}],grow:[{grow:["",et,Re,ke]}],shrink:[{shrink:["",et,Re,ke]}],order:[{order:[pi,"first","last","none",Re,ke]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:F()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:F()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":q()}],"auto-rows":[{"auto-rows":q()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],w:[{w:[u,"screen",...U()]}],"min-w":[{"min-w":[u,"screen","none",...U()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[o]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",r,mc,Ji]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Re,cy]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ly,ke]}],"font-family":[{font:[y6,ke,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,Re,ke]}],"line-clamp":[{"line-clamp":[et,"none",Re,cy]}],leading:[{leading:[i,...R()]}],"list-image":[{"list-image":["none",Re,ke]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Re,ke]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:$()}],"text-color":[{text:$()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[et,"from-font","auto",Re,Ji]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[et,"auto",Re,ke]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Re,ke]}],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",Re,ke]}],"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:k()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},pi,Re,ke],radial:["",Re,ke],conic:[pi,Re,ke]},b6,v6]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:D()}],"gradient-via-pos":[{via:D()}],"gradient-to-pos":[{to:D()}],"gradient-from":[{from:$()}],"gradient-via":[{via:$()}],"gradient-to":[{to:$()}],rounded:[{rounded:Z()}],"rounded-s":[{"rounded-s":Z()}],"rounded-e":[{"rounded-e":Z()}],"rounded-t":[{"rounded-t":Z()}],"rounded-r":[{"rounded-r":Z()}],"rounded-b":[{"rounded-b":Z()}],"rounded-l":[{"rounded-l":Z()}],"rounded-ss":[{"rounded-ss":Z()}],"rounded-se":[{"rounded-se":Z()}],"rounded-ee":[{"rounded-ee":Z()}],"rounded-es":[{"rounded-es":Z()}],"rounded-tl":[{"rounded-tl":Z()}],"rounded-tr":[{"rounded-tr":Z()}],"rounded-br":[{"rounded-br":Z()}],"rounded-bl":[{"rounded-bl":Z()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:$()}],"border-color-x":[{"border-x":$()}],"border-color-y":[{"border-y":$()}],"border-color-s":[{"border-s":$()}],"border-color-e":[{"border-e":$()}],"border-color-t":[{"border-t":$()}],"border-color-r":[{"border-r":$()}],"border-color-b":[{"border-b":$()}],"border-color-l":[{"border-l":$()}],"divide-color":[{divide:$()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[et,Re,ke]}],"outline-w":[{outline:["",et,mc,Ji]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",h,Sf,wf]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",p,Sf,wf]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[et,Ji]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",m,Sf,wf]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[et,Re,ke]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":[et]}],"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":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"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":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"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":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"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":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"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":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"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":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"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":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[Re,ke]}],"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":$()}],"mask-image-radial-to-color":[{"mask-radial-to":$()}],"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":[et]}],"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":$()}],"mask-image-conic-to-color":[{"mask-conic-to":$()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:k()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Re,ke]}],filter:[{filter:["","none",Re,ke]}],blur:[{blur:J()}],brightness:[{brightness:[et,Re,ke]}],contrast:[{contrast:[et,Re,ke]}],"drop-shadow":[{"drop-shadow":["","none",v,Sf,wf]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",et,Re,ke]}],"hue-rotate":[{"hue-rotate":[et,Re,ke]}],invert:[{invert:["",et,Re,ke]}],saturate:[{saturate:[et,Re,ke]}],sepia:[{sepia:["",et,Re,ke]}],"backdrop-filter":[{"backdrop-filter":["","none",Re,ke]}],"backdrop-blur":[{"backdrop-blur":J()}],"backdrop-brightness":[{"backdrop-brightness":[et,Re,ke]}],"backdrop-contrast":[{"backdrop-contrast":[et,Re,ke]}],"backdrop-grayscale":[{"backdrop-grayscale":["",et,Re,ke]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[et,Re,ke]}],"backdrop-invert":[{"backdrop-invert":["",et,Re,ke]}],"backdrop-opacity":[{"backdrop-opacity":[et,Re,ke]}],"backdrop-saturate":[{"backdrop-saturate":[et,Re,ke]}],"backdrop-sepia":[{"backdrop-sepia":["",et,Re,ke]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Re,ke]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[et,"initial",Re,ke]}],ease:[{ease:["linear","initial",_,Re,ke]}],delay:[{delay:[et,Re,ke]}],animate:[{animate:["none",N,Re,ke]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[y,Re,ke]}],"perspective-origin":[{"perspective-origin":C()}],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:pe()}],"skew-x":[{"skew-x":pe()}],"skew-y":[{"skew-y":pe()}],transform:[{transform:[Re,ke,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:W()}],"translate-x":[{"translate-x":W()}],"translate-y":[{"translate-y":W()}],"translate-z":[{"translate-z":W()}],"translate-none":["translate-none"],accent:[{accent:$()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$()}],"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",Re,ke]}],"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":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",Re,ke]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[et,mc,Ji,cy]}],stroke:[{stroke:["none",...$()]}],"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"]}},_6=n6(j6);function Ae(...e){return _6(Ze(e))}var ku=KI();const N6=ct(ku);function cO(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Sn(...e){return t=>{let r=!1;const n=e.map(a=>{const i=cO(a,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let a=0;a{const{children:i,...o}=n,u=b.Children.toArray(i),d=u.find(P6);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 l.jsx(t,{...o,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,h):null})}return l.jsx(t,{...o,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function O6(e){const t=b.forwardRef((r,n)=>{const{children:a,...i}=r;if(b.isValidElement(a)){const o=T6(a),u=A6(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Sn(n,o):o),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var E6=Symbol("radix.slottable");function P6(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===E6}function A6(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 T6(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 k6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],We=k6.reduce((e,t)=>{const r=C6(`Primitive.${t}`),n=b.forwardRef((a,i)=>{const{asChild:o,...u}=a,d=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(d,{...u,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function R6(e,t){e&&ku.flushSync(()=>e.dispatchEvent(t))}var Gt=globalThis?.document?b.useLayoutEffect:()=>{};function I6(e,t){return b.useReducer((r,n)=>t[r][n]??r,e)}var nn=e=>{const{present:t,children:r}=e,n=M6(t),a=typeof r=="function"?r({present:n.isPresent}):b.Children.only(r),i=at(n.ref,D6(a));return typeof r=="function"||n.isPresent?b.cloneElement(a,{ref:i}):null};nn.displayName="Presence";function M6(e){const[t,r]=b.useState(),n=b.useRef(null),a=b.useRef(e),i=b.useRef("none"),o=e?"mounted":"unmounted",[u,d]=I6(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const c=jf(n.current);i.current=u==="mounted"?c:"none"},[u]),Gt(()=>{const c=n.current,h=a.current;if(h!==e){const m=i.current,v=jf(c);e?d("MOUNT"):v==="none"||c?.display==="none"?d("UNMOUNT"):d(h&&m!==v?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,d]),Gt(()=>{if(t){let c;const h=t.ownerDocument.defaultView??window,p=v=>{const y=jf(n.current).includes(CSS.escape(v.animationName));if(v.target===t&&y&&(d("ANIMATION_END"),!a.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",c=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},m=v=>{v.target===t&&(i.current=jf(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 jf(e){return e?.animationName||"none"}function D6(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 L6(e,t){const r=b.createContext(t),n=i=>{const{children:o,...u}=i,d=b.useMemo(()=>u,Object.values(u));return l.jsx(r.Provider,{value:d,children:o})};n.displayName=e+"Provider";function a(i){const o=b.useContext(r);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[n,a]}function Ua(e,t=[]){let r=[];function n(i,o){const u=b.createContext(o),d=r.length;r=[...r,o];const c=p=>{const{scope:m,children:v,...x}=p,y=m?.[e]?.[d]||u,S=b.useMemo(()=>x,Object.values(x));return l.jsx(y.Provider,{value:S,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(o!==void 0)return o;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[c,h]}const a=()=>{const i=r.map(o=>b.createContext(o));return function(u){const d=u?.[e]||i;return b.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return a.scopeName=e,[n,$6(a,...t)]}function $6(...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 o=n.reduce((u,{useScope:d,scopeName:c})=>{const p=d(i)[`__scope${c}`];return{...u,...p}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function jr(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>(...r)=>t.current?.(...r),[])}var B6=b.createContext(void 0);function yM(e){const t=b.useContext(B6);return e||t||"ltr"}function D1(e,[t,r]){return Math.min(r,Math.max(t,e))}function Ge(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e?.(a),r===!1||!a.defaultPrevented)return t?.(a)}}function F6(e,t){return b.useReducer((r,n)=>t[r][n]??r,e)}var PS="ScrollArea",[xM]=Ua(PS),[z6,_n]=xM(PS),bM=b.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:i=600,...o}=e,[u,d]=b.useState(null),[c,h]=b.useState(null),[p,m]=b.useState(null),[v,x]=b.useState(null),[y,S]=b.useState(null),[_,N]=b.useState(0),[O,A]=b.useState(0),[C,E]=b.useState(!1),[T,R]=b.useState(!1),L=at(t,F=>d(F)),z=yM(a);return l.jsx(z6,{scope:r,type:n,dir:z,scrollHideDelay:i,scrollArea:u,viewport:c,onViewportChange:h,content:p,onContentChange:m,scrollbarX:v,onScrollbarXChange:x,scrollbarXEnabled:C,onScrollbarXEnabledChange:E,scrollbarY:y,onScrollbarYChange:S,scrollbarYEnabled:T,onScrollbarYEnabledChange:R,onCornerWidthChange:N,onCornerHeightChange:A,children:l.jsx(We.div,{dir:z,...o,ref:L,style:{position:"relative","--radix-scroll-area-corner-width":_+"px","--radix-scroll-area-corner-height":O+"px",...e.style}})})});bM.displayName=PS;var wM="ScrollAreaViewport",SM=b.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:a,...i}=e,o=_n(wM,r),u=b.useRef(null),d=at(t,u,o.onViewportChange);return l.jsxs(l.Fragment,{children:[l.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}),l.jsx(We.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});SM.displayName=wM;var da="ScrollAreaScrollbar",jM=b.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=_n(da,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=a,u=e.orientation==="horizontal";return b.useEffect(()=>(u?i(!0):o(!0),()=>{u?i(!1):o(!1)}),[u,i,o]),a.type==="hover"?l.jsx(q6,{...n,ref:t,forceMount:r}):a.type==="scroll"?l.jsx(U6,{...n,ref:t,forceMount:r}):a.type==="auto"?l.jsx(_M,{...n,ref:t,forceMount:r}):a.type==="always"?l.jsx(AS,{...n,ref:t}):null});jM.displayName=da;var q6=b.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=_n(da,e.__scopeScrollArea),[i,o]=b.useState(!1);return b.useEffect(()=>{const u=a.scrollArea;let d=0;if(u){const c=()=>{window.clearTimeout(d),o(!0)},h=()=>{d=window.setTimeout(()=>o(!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]),l.jsx(nn,{present:r||i,children:l.jsx(_M,{"data-state":i?"visible":"hidden",...n,ref:t})})}),U6=b.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=_n(da,e.__scopeScrollArea),i=e.orientation==="horizontal",o=Yp(()=>d("SCROLL_END"),100),[u,d]=F6("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"),o()),p=v};return c.addEventListener("scroll",m),()=>c.removeEventListener("scroll",m)}},[a.viewport,i,d,o]),l.jsx(nn,{present:r||u!=="hidden",children:l.jsx(AS,{"data-state":u==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:Ge(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Ge(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),_M=b.forwardRef((e,t)=>{const r=_n(da,e.__scopeScrollArea),{forceMount:n,...a}=e,[i,o]=b.useState(!1),u=e.orientation==="horizontal",d=Yp(()=>{if(r.viewport){const c=r.viewport.offsetWidth{const{orientation:r="vertical",...n}=e,a=_n(da,e.__scopeScrollArea),i=b.useRef(null),o=b.useRef(0),[u,d]=b.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=PM(u.viewport,u.content),h={...n,sizes:u,onSizesChange:d,hasThumb:c>0&&c<1,onThumbChange:m=>i.current=m,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:m=>o.current=m};function p(m,v){return X6(m,o.current,u,v)}return r==="horizontal"?l.jsx(V6,{...h,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollLeft,v=uO(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"?l.jsx(H6,{...h,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollTop,v=uO(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}),V6=b.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,i=_n(da,e.__scopeScrollArea),[o,u]=b.useState(),d=b.useRef(null),c=at(t,d,i.onScrollbarXChange);return b.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),l.jsx(CM,{"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":Xp(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),TM(m,p)&&h.preventDefault()}},onResize:()=>{d.current&&i.viewport&&o&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Ih(o.paddingLeft),paddingEnd:Ih(o.paddingRight)}})}})}),H6=b.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,i=_n(da,e.__scopeScrollArea),[o,u]=b.useState(),d=b.useRef(null),c=at(t,d,i.onScrollbarYChange);return b.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),l.jsx(CM,{"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":Xp(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),TM(m,p)&&h.preventDefault()}},onResize:()=>{d.current&&i.viewport&&o&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Ih(o.paddingTop),paddingEnd:Ih(o.paddingBottom)}})}})}),[W6,NM]=xM(da),CM=b.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:u,onThumbPositionChange:d,onDragScroll:c,onWheelScroll:h,onResize:p,...m}=e,v=_n(da,r),[x,y]=b.useState(null),S=at(t,L=>y(L)),_=b.useRef(null),N=b.useRef(""),O=v.viewport,A=n.content-n.viewport,C=jr(h),E=jr(d),T=Yp(p,10);function R(L){if(_.current){const z=L.clientX-_.current.left,F=L.clientY-_.current.top;c({x:z,y:F})}}return b.useEffect(()=>{const L=z=>{const F=z.target;x?.contains(F)&&C(z,A)};return document.addEventListener("wheel",L,{passive:!1}),()=>document.removeEventListener("wheel",L,{passive:!1})},[O,x,A,C]),b.useEffect(E,[n,E]),Ls(x,T),Ls(v.content,T),l.jsx(W6,{scope:r,scrollbar:x,hasThumb:a,onThumbChange:jr(i),onThumbPointerUp:jr(o),onThumbPositionChange:E,onThumbPointerDown:jr(u),children:l.jsx(We.div,{...m,ref:S,style:{position:"absolute",...m.style},onPointerDown:Ge(e.onPointerDown,L=>{L.button===0&&(L.target.setPointerCapture(L.pointerId),_.current=x.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),R(L))}),onPointerMove:Ge(e.onPointerMove,R),onPointerUp:Ge(e.onPointerUp,L=>{const z=L.target;z.hasPointerCapture(L.pointerId)&&z.releasePointerCapture(L.pointerId),document.body.style.webkitUserSelect=N.current,v.viewport&&(v.viewport.style.scrollBehavior=""),_.current=null})})})}),Rh="ScrollAreaThumb",OM=b.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=NM(Rh,e.__scopeScrollArea);return l.jsx(nn,{present:r||a.hasThumb,children:l.jsx(G6,{ref:t,...n})})}),G6=b.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...a}=e,i=_n(Rh,r),o=NM(Rh,r),{onThumbPositionChange:u}=o,d=at(t,p=>o.onThumbChange(p)),c=b.useRef(void 0),h=Yp(()=>{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=Y6(p,u);c.current=v,u()}};return u(),p.addEventListener("scroll",m),()=>p.removeEventListener("scroll",m)}},[i.viewport,h,u]),l.jsx(We.div,{"data-state":o.hasThumb?"visible":"hidden",...a,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Ge(e.onPointerDownCapture,p=>{const v=p.target.getBoundingClientRect(),x=p.clientX-v.left,y=p.clientY-v.top;o.onThumbPointerDown({x,y})}),onPointerUp:Ge(e.onPointerUp,o.onThumbPointerUp)})});OM.displayName=Rh;var TS="ScrollAreaCorner",EM=b.forwardRef((e,t)=>{const r=_n(TS,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?l.jsx(K6,{...e,ref:t}):null});EM.displayName=TS;var K6=b.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,a=_n(TS,r),[i,o]=b.useState(0),[u,d]=b.useState(0),c=!!(i&&u);return Ls(a.scrollbarX,()=>{const h=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(h),d(h)}),Ls(a.scrollbarY,()=>{const h=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(h),o(h)}),c?l.jsx(We.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 Ih(e){return e?parseInt(e,10):0}function PM(e,t){const r=e/t;return isNaN(r)?0:r}function Xp(e){const t=PM(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function X6(e,t,r,n="ltr"){const a=Xp(r),i=a/2,o=t||i,u=a-o,d=r.scrollbar.paddingStart+o,c=r.scrollbar.size-r.scrollbar.paddingEnd-u,h=r.content-r.viewport,p=n==="ltr"?[0,h]:[h*-1,0];return AM([d,c],p)(e)}function uO(e,t,r="ltr"){const n=Xp(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-a,o=t.content-t.viewport,u=i-n,d=r==="ltr"?[0,o]:[o*-1,0],c=D1(e,d);return AM([0,o],[0,u])(c)}function AM(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 TM(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},o=r.left!==i.left,u=r.top!==i.top;(o||u)&&t(),r=i,n=window.requestAnimationFrame(a)})(),()=>window.cancelAnimationFrame(n)};function Yp(e,t){const r=jr(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 Ls(e,t){const r=jr(t);Gt(()=>{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 J6=bM,Q6=SM,Z6=EM;function $s({className:e,children:t,...r}){return l.jsxs(J6,{"data-slot":"scroll-area",className:Ae("relative",e),...r,children:[l.jsx(Q6,{"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}),l.jsx(eq,{}),l.jsx(Z6,{})]})}function eq({className:e,orientation:t="vertical",...r}){return l.jsx(jM,{"data-slot":"scroll-area-scrollbar",orientation:t,className:Ae("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:l.jsx(OM,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}const tq="/assets/773f0c39e1986271e9144596caac519f934a6ae6-Cou8J2R8.png";function rq({currentView:e,setCurrentView:t}){const[r,n]=b.useState(!0),a=[{name:"Dashboard",icon:rM,type:"item"},{type:"header",name:"MODULES"},{name:"Labeling",icon:Th,type:"sub",isOpen:r,toggle:()=>n(!r),children:[{name:"Labels",icon:Th},{name:"Label Categories",icon:tM},{name:"Label Types",icon:aM},{name:"Label Templates",icon:eM},{name:"Multiple Options",icon:Ah}]},{type:"header",name:"MANAGEMENT"},{name:"Location Manager",icon:hl,type:"item"},{type:"header",name:"SYSTEM MANAGEMENT"},{name:"Account Management",icon:OS,type:"item"},{name:"Menu Management",icon:Vc,type:"item"},{name:"System Menu",icon:Ah,type:"item"},{name:"Reports",icon:Ds,type:"item"},{name:"Support",icon:Ph,type:"item"},{name:"Log Out",icon:Qz,type:"item"}];return l.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:[l.jsx("div",{className:"flex items-center justify-center border-b border-blue-800/50 bg-white px-4 shrink-0",style:{height:90},children:l.jsx("img",{src:tq,alt:"MedVantage",className:"h-16 w-auto object-contain"})}),l.jsx($s,{className:"flex-1 py-4",children:l.jsx("div",{className:"px-3 space-y-1",children:a.map((i,o)=>i.type==="header"?l.jsx("div",{className:"px-4 py-2 mt-4 text-xs font-semibold text-blue-300 uppercase tracking-wider",children:i.name},o):i.type==="sub"?l.jsxs("div",{className:"space-y-1",children:[l.jsxs("button",{onClick:i.toggle,className:Ae("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:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(i.icon,{className:"w-4 h-4"}),i.name]}),i.isOpen?l.jsx(Is,{className:"w-4 h-4"}):l.jsx(Ms,{className:"w-4 h-4"})]}),i.isOpen&&l.jsx("div",{className:"pl-4 space-y-1",children:i.children?.map((u,d)=>l.jsxs("button",{onClick:()=>t(u.name),className:Ae("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:[l.jsx("div",{className:"w-1 h-1 rounded-full bg-current"}),u.name]},d))})]},o):l.jsxs("button",{onClick:()=>t(i.name),className:Ae("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:[l.jsx(i.icon,{className:"w-4 h-4"}),i.name]},o))})})]})}function me({className:e,type:t,...r}){return l.jsx("input",{type:t,"data-slot":"input",className:Ae("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 nq=Symbol.for("react.lazy"),Mh=NS[" use ".trim().toString()];function aq(e){return typeof e=="object"&&e!==null&&"then"in e}function kM(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===nq&&"_payload"in e&&aq(e._payload)}function kS(e){const t=iq(e),r=b.forwardRef((n,a)=>{let{children:i,...o}=n;kM(i)&&typeof Mh=="function"&&(i=Mh(i._payload));const u=b.Children.toArray(i),d=u.find(sq);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 l.jsx(t,{...o,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,h):null})}return l.jsx(t,{...o,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}var RM=kS("Slot");function iq(e){const t=b.forwardRef((r,n)=>{let{children:a,...i}=r;if(kM(a)&&typeof Mh=="function"&&(a=Mh(a._payload)),b.isValidElement(a)){const o=cq(a),u=lq(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Sn(n,o):o),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var oq=Symbol("radix.slottable");function sq(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===oq}function lq(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 cq(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 dO=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,fO=Ze,IM=(e,t)=>r=>{var n;if(t?.variants==null)return fO(e,r?.class,r?.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(c=>{const h=r?.[c],p=i?.[c];if(h===null)return null;const m=dO(h)||dO(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,S]=x;return Array.isArray(S)?S.includes({...i,...u}[y]):{...i,...u}[y]===S})?[...c,p,m]:c},[]);return fO(e,o,d,r?.class,r?.className)},MM=IM("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"}}),fe=b.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...a},i)=>{const o=n?RM:"button";return l.jsx(o,{ref:i,"data-slot":"button",className:Ae(MM({variant:t,size:r,className:e})),...a})});fe.displayName="Button";function uq(e,t=[]){let r=[];function n(i,o){const u=b.createContext(o);u.displayName=i+"Context";const d=r.length;r=[...r,o];const c=p=>{const{scope:m,children:v,...x}=p,y=m?.[e]?.[d]||u,S=b.useMemo(()=>x,Object.values(x));return l.jsx(y.Provider,{value:S,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(o!==void 0)return o;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[c,h]}const a=()=>{const i=r.map(o=>b.createContext(o));return function(u){const d=u?.[e]||i;return b.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return a.scopeName=e,[n,dq(a,...t)]}function dq(...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 o=n.reduce((u,{useScope:d,scopeName:c})=>{const p=d(i)[`__scope${c}`];return{...u,...p}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var fq=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],RS=fq.reduce((e,t)=>{const r=kS(`Primitive.${t}`),n=b.forwardRef((a,i)=>{const{asChild:o,...u}=a,d=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(d,{...u,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),uy={exports:{}},dy={};/** + * @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 hO;function hq(){if(hO)return dy;hO=1;var e=Gp();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,o=e.useDebugValue;function u(p,m){var v=m(),x=n({inst:{value:v,getSnapshot:m}}),y=x[0].inst,S=x[1];return i(function(){y.value=v,y.getSnapshot=m,d(y)&&S({inst:y})},[p,v,m]),a(function(){return d(y)&&S({inst:y}),p(function(){d(y)&&S({inst:y})})},[p]),o(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 dy.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,dy}var pO;function pq(){return pO||(pO=1,uy.exports=hq()),uy.exports}var mq=pq();function gq(){return mq.useSyncExternalStore(vq,()=>!0,()=>!1)}function vq(){return()=>{}}var IS="Avatar",[yq]=uq(IS),[xq,DM]=yq(IS),LM=b.forwardRef((e,t)=>{const{__scopeAvatar:r,...n}=e,[a,i]=b.useState("idle");return l.jsx(xq,{scope:r,imageLoadingStatus:a,onImageLoadingStatusChange:i,children:l.jsx(RS.span,{...n,ref:t})})});LM.displayName=IS;var $M="AvatarImage",BM=b.forwardRef((e,t)=>{const{__scopeAvatar:r,src:n,onLoadingStatusChange:a=()=>{},...i}=e,o=DM($M,r),u=bq(n,i),d=jr(c=>{a(c),o.onImageLoadingStatusChange(c)});return Gt(()=>{u!=="idle"&&d(u)},[u,d]),u==="loaded"?l.jsx(RS.img,{...i,ref:t,src:n}):null});BM.displayName=$M;var FM="AvatarFallback",zM=b.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:n,...a}=e,i=DM(FM,r),[o,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]),o&&i.imageLoadingStatus!=="loaded"?l.jsx(RS.span,{...a,ref:t}):null});zM.displayName=FM;function mO(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function bq(e,{referrerPolicy:t,crossOrigin:r}){const n=gq(),a=b.useRef(null),i=n?(a.current||(a.current=new window.Image),a.current):null,[o,u]=b.useState(()=>mO(i,e));return Gt(()=>{u(mO(i,e))},[i,e]),Gt(()=>{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]),o}var wq=LM,Sq=BM,jq=zM;function _q({className:e,...t}){return l.jsx(wq,{"data-slot":"avatar",className:Ae("relative flex size-10 shrink-0 overflow-hidden rounded-full",e),...t})}function Nq({className:e,...t}){return l.jsx(Sq,{"data-slot":"avatar-image",className:Ae("aspect-square size-full",e),...t})}function Cq({className:e,...t}){return l.jsx(jq,{"data-slot":"avatar-fallback",className:Ae("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}function Oq({title:e}){const t=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});return l.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:[l.jsxs("div",{children:[l.jsxs("h1",{className:"text-2xl font-bold",style:{color:"rgb(43, 50, 143)"},children:[e," Overview"]}),l.jsxs("p",{className:"text-sm text-gray-500 mt-1 flex items-center gap-2",children:[t," | Last updated: Just now"]})]}),l.jsxs("div",{className:"flex items-center gap-4",children:[l.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:[l.jsx(Kp,{className:"h-4 w-4 text-gray-400 shrink-0 ml-3 pointer-events-none"}),l.jsx(me,{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"})]}),l.jsx(fe,{variant:"ghost",size:"icon",className:"text-gray-500 hover:text-gray-700",children:l.jsx(Ah,{className:"w-5 h-5"})}),l.jsx("div",{className:"h-8 w-px bg-gray-200 mx-2"}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("div",{className:"text-right hidden md:block",children:[l.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Admin User"}),l.jsx("div",{className:"text-xs text-gray-500",children:"Administrator"})]}),l.jsxs(_q,{className:"h-10 w-10 border border-gray-200",children:[l.jsx(Nq,{src:"https://github.com/shadcn.png"}),l.jsx(Cq,{children:"AD"})]})]})]})]})}function Eq({children:e,currentView:t,setCurrentView:r}){return l.jsxs("div",{className:"flex h-screen bg-gray-50 overflow-hidden font-sans",children:[l.jsx(rq,{currentView:t,setCurrentView:r}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[l.jsx(Oq,{title:t}),l.jsx("div",{className:"px-8 mt-8 shrink-0",children:l.jsxs("nav",{className:"flex items-center gap-2 text-sm font-normal","aria-label":"Breadcrumb",children:[l.jsx("button",{type:"button",onClick:()=>r("Dashboard"),className:"text-gray-500 hover:text-gray-700 transition-colors",children:"Home"}),l.jsx(Ms,{className:"w-4 h-4 text-gray-500 shrink-0"}),l.jsx("span",{style:{color:"rgb(43, 50, 143)"},children:t})]})}),l.jsx("main",{className:"flex-1 overflow-y-auto p-8",children:l.jsx("div",{className:"w-full h-full",children:e})})]})]})}function Xr({className:e,...t}){return l.jsx("div",{"data-slot":"card",className:Ae("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border",e),...t})}function Ln({className:e,...t}){return l.jsx("div",{"data-slot":"card-header",className:Ae("@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 $n({className:e,...t}){return l.jsx("h4",{"data-slot":"card-title",className:Ae("leading-none",e),...t})}function Dh({className:e,...t}){return l.jsx("p",{"data-slot":"card-description",className:Ae("text-muted-foreground",e),...t})}function vn({className:e,...t}){return l.jsx("div",{"data-slot":"card-content",className:Ae("px-6 [&:last-child]:pb-6",e),...t})}const Pq=IM("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 xr({className:e,variant:t,asChild:r=!1,...n}){const a=r?RM:"span";return l.jsx(a,{"data-slot":"badge",className:Ae(Pq({variant:t}),e),...n})}var fy,gO;function $r(){if(gO)return fy;gO=1;var e=Array.isArray;return fy=e,fy}var hy,vO;function qM(){if(vO)return hy;vO=1;var e=typeof xf=="object"&&xf&&xf.Object===Object&&xf;return hy=e,hy}var py,yO;function fa(){if(yO)return py;yO=1;var e=qM(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return py=r,py}var my,xO;function Ru(){if(xO)return my;xO=1;var e=fa(),t=e.Symbol;return my=t,my}var gy,bO;function Aq(){if(bO)return gy;bO=1;var e=Ru(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,a=e?e.toStringTag:void 0;function i(o){var u=r.call(o,a),d=o[a];try{o[a]=void 0;var c=!0}catch{}var h=n.call(o);return c&&(u?o[a]=d:delete o[a]),h}return gy=i,gy}var vy,wO;function Tq(){if(wO)return vy;wO=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return vy=r,vy}var yy,SO;function Va(){if(SO)return yy;SO=1;var e=Ru(),t=Aq(),r=Tq(),n="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?a:n:i&&i in Object(u)?t(u):r(u)}return yy=o,yy}var xy,jO;function Ha(){if(jO)return xy;jO=1;function e(t){return t!=null&&typeof t=="object"}return xy=e,xy}var by,_O;function gl(){if(_O)return by;_O=1;var e=Va(),t=Ha(),r="[object Symbol]";function n(a){return typeof a=="symbol"||t(a)&&e(a)==r}return by=n,by}var wy,NO;function MS(){if(NO)return wy;NO=1;var e=$r(),t=gl(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(i,o){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)||o!=null&&i in Object(o)}return wy=a,wy}var Sy,CO;function Pi(){if(CO)return Sy;CO=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Sy=e,Sy}var jy,OO;function DS(){if(OO)return jy;OO=1;var e=Va(),t=Pi(),r="[object AsyncFunction]",n="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function o(u){if(!t(u))return!1;var d=e(u);return d==n||d==a||d==r||d==i}return jy=o,jy}var _y,EO;function kq(){if(EO)return _y;EO=1;var e=fa(),t=e["__core-js_shared__"];return _y=t,_y}var Ny,PO;function Rq(){if(PO)return Ny;PO=1;var e=kq(),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 Ny=r,Ny}var Cy,AO;function UM(){if(AO)return Cy;AO=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 Cy=r,Cy}var Oy,TO;function Iq(){if(TO)return Oy;TO=1;var e=DS(),t=Rq(),r=Pi(),n=UM(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,d=o.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 Oy=p,Oy}var Ey,kO;function Mq(){if(kO)return Ey;kO=1;function e(t,r){return t?.[r]}return Ey=e,Ey}var Py,RO;function Po(){if(RO)return Py;RO=1;var e=Iq(),t=Mq();function r(n,a){var i=t(n,a);return e(i)?i:void 0}return Py=r,Py}var Ay,IO;function Jp(){if(IO)return Ay;IO=1;var e=Po(),t=e(Object,"create");return Ay=t,Ay}var Ty,MO;function Dq(){if(MO)return Ty;MO=1;var e=Jp();function t(){this.__data__=e?e(null):{},this.size=0}return Ty=t,Ty}var ky,DO;function Lq(){if(DO)return ky;DO=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return ky=e,ky}var Ry,LO;function $q(){if(LO)return Ry;LO=1;var e=Jp(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function a(i){var o=this.__data__;if(e){var u=o[i];return u===t?void 0:u}return n.call(o,i)?o[i]:void 0}return Ry=a,Ry}var Iy,$O;function Bq(){if($O)return Iy;$O=1;var e=Jp(),t=Object.prototype,r=t.hasOwnProperty;function n(a){var i=this.__data__;return e?i[a]!==void 0:r.call(i,a)}return Iy=n,Iy}var My,BO;function Fq(){if(BO)return My;BO=1;var e=Jp(),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 My=r,My}var Dy,FO;function zq(){if(FO)return Dy;FO=1;var e=Dq(),t=Lq(),r=$q(),n=Bq(),a=Fq();function i(o){var u=-1,d=o==null?0:o.length;for(this.clear();++u-1}return qy=t,qy}var Uy,GO;function Wq(){if(GO)return Uy;GO=1;var e=Qp();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 Uy=t,Uy}var Vy,KO;function Zp(){if(KO)return Vy;KO=1;var e=qq(),t=Uq(),r=Vq(),n=Hq(),a=Wq();function i(o){var u=-1,d=o==null?0:o.length;for(this.clear();++u0?1:-1},oo=function(t){return po(t)&&t.indexOf("%")===t.length-1},je=function(t){return mU(t)&&!Iu(t)},gU=function(t){return Qe(t)},er=function(t){return je(t)||po(t)},vU=0,yl=function(t){var r=++vU;return"".concat(t||"").concat(r)},Nr=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(!je(t)&&!po(t))return n;var i;if(oo(t)){var o=t.indexOf("%");i=r*parseFloat(t.slice(0,o))/100}else i=+t;return Iu(i)&&(i=n),a&&i>r&&(i=r),i},vi=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},yU=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 NU(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 $1(e){"@babel/helpers - typeof";return $1=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},$1(e)}var SE={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"},Ma=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},jE=null,g0=null,US=function e(t){if(t===jE&&Array.isArray(g0))return g0;var r=[];return b.Children.forEach(t,function(n){Qe(n)||(dU.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),g0=r,jE=t,r};function tn(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(a){return Ma(a)}):n=[Ma(t)],US(e).forEach(function(a){var i=en(a,"type.displayName")||en(a,"type.name");n.indexOf(i)!==-1&&r.push(a)}),r}function Kr(e,t){var r=tn(e,t);return r&&r[0]}var _E=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,a=r.height;return!(!je(n)||n<=0||!je(a)||a<=0)},CU=["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"],OU=function(t){return t&&t.type&&po(t.type)&&CU.indexOf(t.type)>=0},EU=function(t){return t&&$1(t)==="object"&&"clipDot"in t},PU=function(t,r,n,a){var i,o=(i=m0?.[a])!==null&&i!==void 0?i:[];return r.startsWith("data-")||!He(t)&&(a&&o.includes(r)||wU.includes(r))||n&&qS.includes(r)},Fe=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(b.isValidElement(t)&&(a=t.props),!vl(a))return null;var i={};return Object.keys(a).forEach(function(o){var u;PU((u=a)===null||u===void 0?void 0:u[o],o,r,n)&&(i[o]=a[o])}),i},B1=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 NE(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 IU(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 z1(e){var t=e.children,r=e.width,n=e.height,a=e.viewBox,i=e.className,o=e.style,u=e.title,d=e.desc,c=RU(e,kU),h=a||{width:r,height:n,x:0,y:0},p=Ze("recharts-surface",i);return X.createElement("svg",F1({},Fe(c,!0,"svg"),{className:p,width:r,height:n,style:o,viewBox:"".concat(h.x," ").concat(h.y," ").concat(h.width," ").concat(h.height)}),X.createElement("title",null,u),X.createElement("desc",null,d),t)}var MU=["children","className"];function q1(){return q1=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 LU(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 st=X.forwardRef(function(e,t){var r=e.children,n=e.className,a=DU(e,MU),i=Ze("recharts-layer",n);return X.createElement("g",q1({className:i},Fe(a,!0),{ref:t}),r)}),Vn=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 o=Array(i);++a=i?r:e(r,n,a)}return y0=t,y0}var x0,PE;function XM(){if(PE)return x0;PE=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",a=t+r+n,i="\\ufe0e\\ufe0f",o="\\u200d",u=RegExp("["+o+e+a+i+"]");function d(c){return u.test(c)}return x0=d,x0}var b0,AE;function FU(){if(AE)return b0;AE=1;function e(t){return t.split("")}return b0=e,b0}var w0,TE;function zU(){if(TE)return w0;TE=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",a=t+r+n,i="\\ufe0e\\ufe0f",o="["+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+"]?",S="(?:"+v+"(?:"+[h,p,m].join("|")+")"+y+x+")*",_=y+x+S,N="(?:"+[h+u+"?",u,p,m,o].join("|")+")",O=RegExp(d+"(?="+d+")|"+N+_,"g");function A(C){return C.match(O)||[]}return w0=A,w0}var S0,kE;function qU(){if(kE)return S0;kE=1;var e=FU(),t=XM(),r=zU();function n(a){return t(a)?r(a):e(a)}return S0=n,S0}var j0,RE;function UU(){if(RE)return j0;RE=1;var e=BU(),t=XM(),r=qU(),n=HM();function a(i){return function(o){o=n(o);var u=t(o)?r(o):void 0,d=u?u[0]:o.charAt(0),c=u?e(u,1).join(""):o.slice(1);return d[i]()+c}}return j0=a,j0}var _0,IE;function VU(){if(IE)return _0;IE=1;var e=UU(),t=e("toUpperCase");return _0=t,_0}var HU=VU();const rm=ct(HU);function jt(e){return function(){return e}}const YM=Math.cos,Bh=Math.sin,Gn=Math.sqrt,Fh=Math.PI,nm=2*Fh,U1=Math.PI,V1=2*U1,no=1e-6,WU=V1-no;function JM(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return JM;const r=10**t;return function(n){this._+=n[0];for(let a=1,i=n.length;ano)if(!(Math.abs(p*d-c*h)>no)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let v=n-o,x=a-u,y=d*d+c*c,S=v*v+x*x,_=Math.sqrt(y),N=Math.sqrt(m),O=i*Math.tan((U1-Math.acos((y+m-S)/(2*_*N)))/2),A=O/N,C=O/_;Math.abs(A-1)>no&&this._append`L${t+A*h},${r+A*p}`,this._append`A${i},${i},0,0,${+(p*v>h*x)},${this._x1=t+C*d},${this._y1=r+C*c}`}}arc(t,r,n,a,i,o){if(t=+t,r=+r,n=+n,o=!!o,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^o,m=o?a-i:i-a;this._x1===null?this._append`M${c},${h}`:(Math.abs(this._x1-c)>no||Math.abs(this._y1-h)>no)&&this._append`L${c},${h}`,n&&(m<0&&(m=m%V1+V1),m>WU?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>no&&this._append`A${n},${n},0,${+(m>=U1)},${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 VS(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 KU(t)}function HS(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function QM(e){this._context=e}QM.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 am(e){return new QM(e)}function ZM(e){return e[0]}function eD(e){return e[1]}function tD(e,t){var r=jt(!0),n=null,a=am,i=null,o=VS(u);e=typeof e=="function"?e:e===void 0?ZM:jt(e),t=typeof t=="function"?t:t===void 0?eD:jt(t);function u(d){var c,h=(d=HS(d)).length,p,m=!1,v;for(n==null&&(i=a(v=o())),c=0;c<=h;++c)!(c=v;--x)u.point(O[x],A[x]);u.lineEnd(),u.areaEnd()}_&&(O[m]=+e(S,m,p),A[m]=+t(S,m,p),u.point(n?+n(S,m,p):O[m],r?+r(S,m,p):A[m]))}if(N)return u=null,N+""||null}function h(){return tD().defined(a).curve(o).context(i)}return c.x=function(p){return arguments.length?(e=typeof p=="function"?p:jt(+p),n=null,c):e},c.x0=function(p){return arguments.length?(e=typeof p=="function"?p:jt(+p),c):e},c.x1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:jt(+p),c):n},c.y=function(p){return arguments.length?(t=typeof p=="function"?p:jt(+p),r=null,c):t},c.y0=function(p){return arguments.length?(t=typeof p=="function"?p:jt(+p),c):t},c.y1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:jt(+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:jt(!!p),c):a},c.curve=function(p){return arguments.length?(o=p,i!=null&&(u=o(i)),c):o},c.context=function(p){return arguments.length?(p==null?i=u=null:u=o(i=p),c):i},c}class rD{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 XU(e){return new rD(e,!0)}function YU(e){return new rD(e,!1)}const WS={draw(e,t){const r=Gn(t/Fh);e.moveTo(r,0),e.arc(0,0,r,0,nm)}},JU={draw(e,t){const r=Gn(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()}},nD=Gn(1/3),QU=nD*2,ZU={draw(e,t){const r=Gn(t/QU),n=r*nD;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},e9={draw(e,t){const r=Gn(t),n=-r/2;e.rect(n,n,r,r)}},t9=.8908130915292852,aD=Bh(Fh/10)/Bh(7*Fh/10),r9=Bh(nm/10)*aD,n9=-YM(nm/10)*aD,a9={draw(e,t){const r=Gn(t*t9),n=r9*r,a=n9*r;e.moveTo(0,-r),e.lineTo(n,a);for(let i=1;i<5;++i){const o=nm*i/5,u=YM(o),d=Bh(o);e.lineTo(d*r,-u*r),e.lineTo(u*n-d*a,d*n+u*a)}e.closePath()}},N0=Gn(3),i9={draw(e,t){const r=-Gn(t/(N0*3));e.moveTo(0,r*2),e.lineTo(-N0*r,-r),e.lineTo(N0*r,-r),e.closePath()}},hn=-.5,pn=Gn(3)/2,H1=1/Gn(12),o9=(H1/2+1)*3,s9={draw(e,t){const r=Gn(t/o9),n=r/2,a=r*H1,i=n,o=r*H1+r,u=-i,d=o;e.moveTo(n,a),e.lineTo(i,o),e.lineTo(u,d),e.lineTo(hn*n-pn*a,pn*n+hn*a),e.lineTo(hn*i-pn*o,pn*i+hn*o),e.lineTo(hn*u-pn*d,pn*u+hn*d),e.lineTo(hn*n+pn*a,hn*a-pn*n),e.lineTo(hn*i+pn*o,hn*o-pn*i),e.lineTo(hn*u+pn*d,hn*d-pn*u),e.closePath()}};function l9(e,t){let r=null,n=VS(a);e=typeof e=="function"?e:jt(e||WS),t=typeof t=="function"?t:jt(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:jt(i),a):e},a.size=function(i){return arguments.length?(t=typeof i=="function"?i:jt(+i),a):t},a.context=function(i){return arguments.length?(r=i??null,a):r},a}function zh(){}function qh(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 iD(e){this._context=e}iD.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:qh(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:qh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function c9(e){return new iD(e)}function oD(e){this._context=e}oD.prototype={areaStart:zh,areaEnd:zh,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:qh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function u9(e){return new oD(e)}function sD(e){this._context=e}sD.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:qh(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function d9(e){return new sD(e)}function lD(e){this._context=e}lD.prototype={areaStart:zh,areaEnd:zh,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 f9(e){return new lD(e)}function ME(e){return e<0?-1:1}function DE(e,t,r){var n=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(n||a<0&&-0),o=(r-e._y1)/(a||n<0&&-0),u=(i*a+o*n)/(n+a);return(ME(i)+ME(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(u))||0}function LE(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function C0(e,t,r){var n=e._x0,a=e._y0,i=e._x1,o=e._y1,u=(i-n)/3;e._context.bezierCurveTo(n+u,a+u*t,i-u,o-u*r,i,o)}function Uh(e){this._context=e}Uh.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:C0(this,this._t0,LE(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,C0(this,LE(this,r=DE(this,e,t)),r);break;default:C0(this,this._t0,r=DE(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function cD(e){this._context=new uD(e)}(cD.prototype=Object.create(Uh.prototype)).point=function(e,t){Uh.prototype.point.call(this,t,e)};function uD(e){this._context=e}uD.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 h9(e){return new Uh(e)}function p9(e){return new cD(e)}function dD(e){this._context=e}dD.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=$E(e),a=$E(t),i=0,o=1;o=0;--t)a[t]=(o[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 g9(e){return new im(e,.5)}function v9(e){return new im(e,0)}function y9(e){return new im(e,1)}function Bs(e,t){if((o=e.length)>1)for(var r=1,n,a,i=e[t[0]],o,u=i.length;r=0;)r[t]=t;return r}function x9(e,t){return e[t]}function b9(e){const t=[];return t.key=e,t}function w9(){var e=jt([]),t=W1,r=Bs,n=x9;function a(i){var o=Array.from(e.apply(this,arguments),b9),u,d=o.length,c=-1,h;for(const p of i)for(u=0,++c;u0){for(var r,n,a=0,i=e[0].length,o;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,o;n=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}var fD={symbolCircle:WS,symbolCross:JU,symbolDiamond:ZU,symbolSquare:e9,symbolStar:a9,symbolTriangle:i9,symbolWye:s9},T9=Math.PI/180,k9=function(t){var r="symbol".concat(rm(t));return fD[r]||WS},R9=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*T9;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}},I9=function(t,r){fD["symbol".concat(rm(t))]=r},GS=function(t){var r=t.type,n=r===void 0?"circle":r,a=t.size,i=a===void 0?64:a,o=t.sizeType,u=o===void 0?"area":o,d=P9(t,N9),c=FE(FE({},d),{},{type:n,size:i,sizeType:u}),h=function(){var S=k9(n),_=l9().type(S).size(R9(i,u,n));return _()},p=c.className,m=c.cx,v=c.cy,x=Fe(c,!0);return m===+m&&v===+v&&i===+i?X.createElement("path",G1({},x,{className:Ze("recharts-symbols",p),transform:"translate(".concat(m,", ").concat(v,")"),d:h()})):null};GS.registerSymbol=I9;function Fs(e){"@babel/helpers - typeof";return Fs=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},Fs(e)}function K1(){return K1=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var N=v.inactive?c:v.color;return X.createElement("li",K1({className:S,style:p,key:"legend-item-".concat(x)},mo(n.props,v,x)),X.createElement(z1,{width:o,height:o,viewBox:h,style:m},n.renderIcon(v)),X.createElement("span",{className:"recharts-legend-item-text",style:{color:N}},y?y(_,v,x):_))})}},{key:"render",value:function(){var n=this.props,a=n.payload,i=n.layout,o=n.align;if(!a||!a.length)return null;var u={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return X.createElement("ul",{className:"recharts-default-legend",style:u},this.renderItems())}}])})(b.PureComponent);Gc(KS,"displayName","Legend");Gc(KS,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var O0,qE;function V9(){if(qE)return O0;qE=1;var e=Zp();function t(){this.__data__=new e,this.size=0}return O0=t,O0}var E0,UE;function H9(){if(UE)return E0;UE=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return E0=e,E0}var P0,VE;function W9(){if(VE)return P0;VE=1;function e(t){return this.__data__.get(t)}return P0=e,P0}var A0,HE;function G9(){if(HE)return A0;HE=1;function e(t){return this.__data__.has(t)}return A0=e,A0}var T0,WE;function K9(){if(WE)return T0;WE=1;var e=Zp(),t=$S(),r=BS(),n=200;function a(i,o){var u=this.__data__;if(u instanceof e){var d=u.__data__;if(!t||d.lengthv))return!1;var y=p.get(o),S=p.get(u);if(y&&S)return y==u&&S==o;var _=-1,N=!0,O=d&a?new e:void 0;for(p.set(o,u),p.set(u,o);++_-1&&n%1==0&&n-1&&r%1==0&&r<=e}return Z0=t,Z0}var ex,gP;function s7(){if(gP)return ex;gP=1;var e=Va(),t=QS(),r=Ha(),n="[object Arguments]",a="[object Array]",i="[object Boolean]",o="[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]",S="[object ArrayBuffer]",_="[object DataView]",N="[object Float32Array]",O="[object Float64Array]",A="[object Int8Array]",C="[object Int16Array]",E="[object Int32Array]",T="[object Uint8Array]",R="[object Uint8ClampedArray]",L="[object Uint16Array]",z="[object Uint32Array]",F={};F[N]=F[O]=F[A]=F[C]=F[E]=F[T]=F[R]=F[L]=F[z]=!0,F[n]=F[a]=F[S]=F[i]=F[_]=F[o]=F[u]=F[d]=F[c]=F[h]=F[p]=F[m]=F[v]=F[x]=F[y]=!1;function B(q){return r(q)&&t(q.length)&&!!F[e(q)]}return ex=B,ex}var tx,vP;function SD(){if(vP)return tx;vP=1;function e(t){return function(r){return t(r)}}return tx=e,tx}var Rc={exports:{}};Rc.exports;var yP;function l7(){return yP||(yP=1,(function(e,t){var r=qM(),n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===n,o=i&&r.process,u=(function(){try{var d=a&&a.require&&a.require("util").types;return d||o&&o.binding&&o.binding("util")}catch{}})();e.exports=u})(Rc,Rc.exports)),Rc.exports}var rx,xP;function jD(){if(xP)return rx;xP=1;var e=s7(),t=SD(),r=l7(),n=r&&r.isTypedArray,a=n?t(n):e;return rx=a,rx}var nx,bP;function c7(){if(bP)return nx;bP=1;var e=a7(),t=YS(),r=$r(),n=wD(),a=JS(),i=jD(),o=Object.prototype,u=o.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,S=y?e(c.length,String):[],_=S.length;for(var N in c)(h||u.call(c,N))&&!(y&&(N=="length"||v&&(N=="offset"||N=="parent")||x&&(N=="buffer"||N=="byteLength"||N=="byteOffset")||a(N,_)))&&S.push(N);return S}return nx=d,nx}var ax,wP;function u7(){if(wP)return ax;wP=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,a=typeof n=="function"&&n.prototype||e;return r===a}return ax=t,ax}var ix,SP;function _D(){if(SP)return ix;SP=1;function e(t,r){return function(n){return t(r(n))}}return ix=e,ix}var ox,jP;function d7(){if(jP)return ox;jP=1;var e=_D(),t=e(Object.keys,Object);return ox=t,ox}var sx,_P;function f7(){if(_P)return sx;_P=1;var e=u7(),t=d7(),r=Object.prototype,n=r.hasOwnProperty;function a(i){if(!e(i))return t(i);var o=[];for(var u in Object(i))n.call(i,u)&&u!="constructor"&&o.push(u);return o}return sx=a,sx}var lx,NP;function Mu(){if(NP)return lx;NP=1;var e=DS(),t=QS();function r(n){return n!=null&&t(n.length)&&!e(n)}return lx=r,lx}var cx,CP;function om(){if(CP)return cx;CP=1;var e=c7(),t=f7(),r=Mu();function n(a){return r(a)?e(a):t(a)}return cx=n,cx}var ux,OP;function h7(){if(OP)return ux;OP=1;var e=e7(),t=n7(),r=om();function n(a){return e(a,r,t)}return ux=n,ux}var dx,EP;function p7(){if(EP)return dx;EP=1;var e=h7(),t=1,r=Object.prototype,n=r.hasOwnProperty;function a(i,o,u,d,c,h){var p=u&t,m=e(i),v=m.length,x=e(o),y=x.length;if(v!=y&&!p)return!1;for(var S=v;S--;){var _=m[S];if(!(p?_ in o:n.call(o,_)))return!1}var N=h.get(i),O=h.get(o);if(N&&O)return N==o&&O==i;var A=!0;h.set(i,o),h.set(o,i);for(var C=p;++S-1}return Lx=t,Lx}var $x,tA;function I7(){if(tA)return $x;tA=1;function e(t,r,n){for(var a=-1,i=t==null?0:t.length;++a=o){var _=c?null:a(d);if(_)return i(_);x=!1,m=n,S=new e}else S=c?[]:y;e:for(;++p=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function X7(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 Y7(e){return e.value}function J7(e,t){if(X.isValidElement(e))return X.cloneElement(e,t);if(typeof e=="function")return X.createElement(e,t);t.ref;var r=K7(t,F7);return X.createElement(KS,r)}var cA=1,Ps=(function(e){function t(){var r;z7(this,t);for(var n=arguments.length,a=new Array(n),i=0;icA||Math.abs(a.height-this.lastBoundingBox.height)>cA)&&(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?Pa({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var a=this.props,i=a.layout,o=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(o==="center"&&i==="vertical"){var v=this.getBBoxSnapshot();p={left:((c||0)-v.width)/2}}else p=o==="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 Pa(Pa({},p),m)}},{key:"render",value:function(){var n=this,a=this.props,i=a.content,o=a.width,u=a.height,d=a.wrapperStyle,c=a.payloadUniqBy,h=a.payload,p=Pa(Pa({position:"absolute",width:o||"auto",height:u||"auto"},this.getDefaultPosition(d)),d);return X.createElement("div",{className:"recharts-legend-wrapper",style:p,ref:function(v){n.wrapperNode=v}},J7(i,Pa(Pa({},this.props),{},{payload:PD(h,c,Y7)})))}}],[{key:"getWithHeight",value:function(n,a){var i=Pa(Pa({},this.defaultProps),n.props),o=i.layout;return o==="vertical"&&je(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||a}:null}}])})(b.PureComponent);sm(Ps,"displayName","Legend");sm(Ps,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var Ux,uA;function Q7(){if(uA)return Ux;uA=1;var e=Ru(),t=YS(),r=$r(),n=e?e.isConcatSpreadable:void 0;function a(i){return r(i)||t(i)||!!(n&&i&&i[n])}return Ux=a,Ux}var Vx,dA;function kD(){if(dA)return Vx;dA=1;var e=bD(),t=Q7();function r(n,a,i,o,u){var d=-1,c=n.length;for(i||(i=t),u||(u=[]);++d0&&i(h)?a>1?r(h,a-1,i,o,u):e(u,h):o||(u[u.length]=h)}return u}return Vx=r,Vx}var Hx,fA;function Z7(){if(fA)return Hx;fA=1;function e(t){return function(r,n,a){for(var i=-1,o=Object(r),u=a(r),d=u.length;d--;){var c=u[t?d:++i];if(n(o[c],c,o)===!1)break}return r}}return Hx=e,Hx}var Wx,hA;function eV(){if(hA)return Wx;hA=1;var e=Z7(),t=e();return Wx=t,Wx}var Gx,pA;function RD(){if(pA)return Gx;pA=1;var e=eV(),t=om();function r(n,a){return n&&e(n,a,t)}return Gx=r,Gx}var Kx,mA;function tV(){if(mA)return Kx;mA=1;var e=Mu();function t(r,n){return function(a,i){if(a==null)return a;if(!e(a))return r(a,i);for(var o=a.length,u=n?o:-1,d=Object(a);(n?u--:++un||u&&d&&h&&!c&&!p||i&&d&&h||!a&&h||!o)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 Zx=t,Zx}var eb,wA;function iV(){if(wA)return eb;wA=1;var e=FS(),t=zS(),r=ha(),n=ID(),a=rV(),i=SD(),o=aV(),u=xl(),d=$r();function c(h,p,m){p.length?p=e(p,function(y){return d(y)?function(S){return t(S,y.length===1?y[0]:y)}:y}):p=[u];var v=-1;p=e(p,i(r));var x=n(h,function(y,S,_){var N=e(p,function(O){return O(y)});return{criteria:N,index:++v,value:y}});return a(x,function(y,S){return o(y,S,m)})}return eb=c,eb}var tb,SA;function oV(){if(SA)return tb;SA=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 tb=e,tb}var rb,jA;function sV(){if(jA)return rb;jA=1;var e=oV(),t=Math.max;function r(n,a,i){return a=t(a===void 0?n.length-1:a,0),function(){for(var o=arguments,u=-1,d=t(o.length-a,0),c=Array(d);++u0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return ob=n,ob}var sb,EA;function dV(){if(EA)return sb;EA=1;var e=cV(),t=uV(),r=t(e);return sb=r,sb}var lb,PA;function fV(){if(PA)return lb;PA=1;var e=xl(),t=sV(),r=dV();function n(a,i){return r(t(a,i,e),a+"")}return lb=n,lb}var cb,AA;function lm(){if(AA)return cb;AA=1;var e=LS(),t=Mu(),r=JS(),n=Pi();function a(i,o,u){if(!n(u))return!1;var d=typeof o;return(d=="number"?t(u)&&r(o,u.length):d=="string"&&o in u)?e(u[o],i):!1}return cb=a,cb}var ub,TA;function hV(){if(TA)return ub;TA=1;var e=kD(),t=iV(),r=fV(),n=lm(),a=r(function(i,o){if(i==null)return[];var u=o.length;return u>1&&n(i,o[0],o[1])?o=[]:u>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),t(i,e(o,1),[])});return ub=a,ub}var pV=hV();const tj=ct(pV);function Kc(e){"@babel/helpers - typeof";return Kc=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},Kc(e)}function J1(){return J1=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(gc,"-left"),je(r)&&t&&je(t.x)&&r=t.y),"".concat(gc,"-top"),je(n)&&t&&je(t.y)&&ny?Math.max(h,d[n]):Math.max(p,d[n])}function PV(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 AV(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,a=e.position,i=e.reverseDirection,o=e.tooltipBox,u=e.useTranslate3d,d=e.viewBox,c,h,p;return o.height>0&&o.width>0&&r?(h=IA({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:a,reverseDirection:i,tooltipDimension:o.width,viewBox:d,viewBoxDimension:d.width}),p=IA({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:a,reverseDirection:i,tooltipDimension:o.height,viewBox:d,viewBoxDimension:d.height}),c=PV({translateX:h,translateY:p,useTranslate3d:u})):c=OV,{cssProperties:c,cssClasses:EV({translateX:h,translateY:p,coordinate:r})}}function qs(e){"@babel/helpers - typeof";return qs=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},qs(e)}function MA(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 DA(e){for(var t=1;tLA||Math.abs(n.height-this.state.lastBoundingBox.height)>LA)&&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,o=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,S=a.useTranslate3d,_=a.viewBox,N=a.wrapperStyle,O=AV({allowEscapeViewBox:o,coordinate:h,offsetTopLeft:v,position:x,reverseDirection:y,tooltipBox:this.state.lastBoundingBox,useTranslate3d:S,viewBox:_}),A=O.cssClasses,C=O.cssProperties,E=DA(DA({transition:m&&i?"transform ".concat(u,"ms ").concat(d):void 0},C),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&p?"visible":"hidden",position:"absolute",top:0,left:0},N);return X.createElement("div",{tabIndex:-1,className:A,style:E,ref:function(R){n.wrapperNode=R}},c)}}])})(b.PureComponent),FV=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Ao={isSsr:FV()};function Us(e){"@babel/helpers - typeof";return Us=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},Us(e)}function $A(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 BA(e){for(var t=1;t0;return X.createElement(BV,{allowEscapeViewBox:o,animationDuration:u,animationEasing:d,isAnimationActive:m,active:i,coordinate:h,hasPayload:E,offset:v,position:S,reverseDirection:_,useTranslate3d:N,viewBox:O,wrapperStyle:A},YV(c,BA(BA({},this.props),{},{payload:C})))}}])})(b.PureComponent);rj(Yr,"displayName","Tooltip");rj(Yr,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Ao.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 fb,FA;function JV(){if(FA)return fb;FA=1;var e=fa(),t=function(){return e.Date.now()};return fb=t,fb}var hb,zA;function QV(){if(zA)return hb;zA=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return hb=t,hb}var pb,qA;function ZV(){if(qA)return pb;qA=1;var e=QV(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return pb=r,pb}var mb,UA;function FD(){if(UA)return mb;UA=1;var e=ZV(),t=Pi(),r=gl(),n=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^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||o.test(c)?u(c.slice(2),p?2:8):a.test(c)?n:+c}return mb=d,mb}var gb,VA;function eH(){if(VA)return gb;VA=1;var e=Pi(),t=JV(),r=FD(),n="Expected a function",a=Math.max,i=Math.min;function o(u,d,c){var h,p,m,v,x,y,S=0,_=!1,N=!1,O=!0;if(typeof u!="function")throw new TypeError(n);d=r(d)||0,e(c)&&(_=!!c.leading,N="maxWait"in c,m=N?a(r(c.maxWait)||0,d):m,O="trailing"in c?!!c.trailing:O);function A(q){var H=h,V=p;return h=p=void 0,S=q,v=u.apply(V,H),v}function C(q){return S=q,x=setTimeout(R,d),_?A(q):v}function E(q){var H=q-y,V=q-S,G=d-H;return N?i(G,m-V):G}function T(q){var H=q-y,V=q-S;return y===void 0||H>=d||H<0||N&&V>=m}function R(){var q=t();if(T(q))return L(q);x=setTimeout(R,E(q))}function L(q){return x=void 0,O&&h?A(q):(h=p=void 0,v)}function z(){x!==void 0&&clearTimeout(x),S=0,h=y=p=x=void 0}function F(){return x===void 0?v:L(t())}function B(){var q=t(),H=T(q);if(h=arguments,p=this,y=q,H){if(x===void 0)return C(y);if(N)return clearTimeout(x),x=setTimeout(R,d),A(y)}return x===void 0&&(x=setTimeout(R,d)),v}return B.cancel=z,B.flush=F,B}return gb=o,gb}var vb,HA;function tH(){if(HA)return vb;HA=1;var e=eH(),t=Pi(),r="Expected a function";function n(a,i,o){var u=!0,d=!0;if(typeof a!="function")throw new TypeError(r);return t(o)&&(u="leading"in o?!!o.leading:u,d="trailing"in o?!!o.trailing:d),e(a,i,{leading:u,maxWait:i,trailing:d})}return vb=n,vb}var rH=tH();const zD=ct(rH);function Yc(e){"@babel/helpers - typeof";return Yc=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},Yc(e)}function WA(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 Cf(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(q=zD(q,y,{trailing:!0,leading:!1}));var H=new ResizeObserver(q),V=C.current.getBoundingClientRect(),G=V.width,U=V.height;return F(G,U),H.observe(C.current),function(){H.disconnect()}},[F,y]);var B=b.useMemo(function(){var q=L.containerWidth,H=L.containerHeight;if(q<0||H<0)return null;Vn(oo(o)||oo(d),`The width(%s) and height(%s) are both fixed numbers, + maybe you don't need to use a ResponsiveContainer.`,o,d),Vn(!r||r>0,"The aspect(%s) must be greater than zero.",r);var V=oo(o)?q:o,G=oo(d)?H:d;r&&r>0&&(V?G=V/r:G&&(V=G*r),m&&G>m&&(G=m)),Vn(V>0||G>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.`,V,G,o,d,h,p,r);var U=!Array.isArray(v)&&Ma(v.type).endsWith("Chart");return X.Children.map(v,function($){return X.isValidElement($)?b.cloneElement($,Cf({width:V,height:G},U?{style:Cf({height:"100%",width:"100%",maxHeight:G,maxWidth:V},$.props.style)}:{})):$})},[r,v,d,m,p,h,L,o]);return X.createElement("div",{id:S?"".concat(S):void 0,className:Ze("recharts-responsive-container",_),style:Cf(Cf({},A),{},{width:o,height:d,minWidth:h,minHeight:p,maxHeight:m}),ref:C},B)}),cm=function(t){return null};cm.displayName="Cell";function Jc(e){"@babel/helpers - typeof";return Jc=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},Jc(e)}function KA(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 tw(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Ao.isSsr)return{width:0,height:0};var n=gH(r),a=JSON.stringify({text:t,copyStyle:n});if(ls.widthCache[a])return ls.widthCache[a];try{var i=document.getElementById(XA);i||(i=document.createElement("span"),i.setAttribute("id",XA),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=tw(tw({},mH),n);Object.assign(i.style,o),i.textContent="".concat(t);var u=i.getBoundingClientRect(),d={width:u.width,height:u.height};return ls.widthCache[a]=d,++ls.cacheCount>pH&&(ls.cacheCount=0,ls.widthCache={}),d}catch{return{width:0,height:0}}},vH=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Qc(e){"@babel/helpers - typeof";return Qc=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},Qc(e)}function Xh(e,t){return wH(e)||bH(e,t)||xH(e,t)||yH()}function yH(){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 xH(e,t){if(e){if(typeof e=="string")return YA(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 YA(e,t)}}function YA(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 MH(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 r2(e,t){return BH(e)||$H(e,t)||LH(e,t)||DH()}function DH(){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 LH(e,t){if(e){if(typeof e=="string")return n2(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 n2(e,t)}}function n2(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 V.reduce(function(G,U){var $=U.word,Q=U.width,k=G[G.length-1];if(k&&(a==null||i||k.width+Q+nU.width?G:U})};if(!h)return v;for(var y="…",S=function(V){var G=p.slice(0,V),U=HD({breakAll:c,style:d,children:G+y}).wordsWithComputedWidth,$=m(U),Q=$.length>o||x($).width>Number(a);return[Q,$]},_=0,N=p.length-1,O=0,A;_<=N&&O<=p.length-1;){var C=Math.floor((_+N)/2),E=C-1,T=S(E),R=r2(T,2),L=R[0],z=R[1],F=S(C),B=r2(F,1),q=B[0];if(!L&&!q&&(_=C+1),L&&q&&(N=C-1),!L&&q){A=z;break}O++}return A||v},a2=function(t){var r=Qe(t)?[]:t.toString().split(VD);return[{words:r}]},zH=function(t){var r=t.width,n=t.scaleToFit,a=t.children,i=t.style,o=t.breakAll,u=t.maxLines;if((r||n)&&!Ao.isSsr){var d,c,h=HD({breakAll:o,children:a,style:i});if(h){var p=h.wordsWithComputedWidth,m=h.spaceWidth;d=p,c=m}else return a2(a);return FH({breakAll:o,children:a,maxLines:u,style:i},d,c,r,n)}return a2(a)},i2="#808080",go=function(t){var r=t.x,n=r===void 0?0:r,a=t.y,i=a===void 0?0:a,o=t.lineHeight,u=o===void 0?"1em":o,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,S=t.fill,_=S===void 0?i2:S,N=t2(t,RH),O=b.useMemo(function(){return zH({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,C=N.dy,E=N.angle,T=N.className,R=N.breakAll,L=t2(N,IH);if(!er(n)||!er(i))return null;var z=n+(je(A)?A:0),F=i+(je(C)?C:0),B;switch(y){case"start":B=yb("calc(".concat(c,")"));break;case"middle":B=yb("calc(".concat((O.length-1)/2," * -").concat(u," + (").concat(c," / 2))"));break;default:B=yb("calc(".concat(O.length-1," * -").concat(u,")"));break}var q=[];if(p){var H=O[0].width,V=N.width;q.push("scale(".concat((je(V)?V/H:1)/H,")"))}return E&&q.push("rotate(".concat(E,", ").concat(z,", ").concat(F,")")),q.length&&(L.transform=q.join(" ")),X.createElement("text",rw({},Fe(L,!0),{x:z,y:F,className:Ze("recharts-text",T),textAnchor:v,fill:_.includes("url")?i2:_}),O.map(function(G,U){var $=G.words.join(R?"":" ");return X.createElement("tspan",{x:z,dy:U===0?B:u,key:"".concat($,"-").concat(U)},$)}))};function xi(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function qH(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function nj(e){let t,r,n;e.length!==2?(t=xi,r=(u,d)=>xi(e(u),d),n=(u,d)=>e(u)-d):(t=e===xi||e===qH?e:UH,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:o,right:i}}function UH(){return 0}function WD(e){return e===null?NaN:+e}function*VH(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const HH=nj(xi),Du=HH.right;nj(WD).center;class o2 extends Map{constructor(t,r=KH){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(s2(this,t))}has(t){return super.has(s2(this,t))}set(t,r){return super.set(WH(this,t),r)}delete(t){return super.delete(GH(this,t))}}function s2({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function WH({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function GH({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function KH(e){return e!==null&&typeof e=="object"?e.valueOf():e}function XH(e=xi){if(e===xi)return GD;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 GD(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const YH=Math.sqrt(50),JH=Math.sqrt(10),QH=Math.sqrt(2);function Yh(e,t,r){const n=(t-e)/Math.max(0,r),a=Math.floor(Math.log10(n)),i=n/Math.pow(10,a),o=i>=YH?10:i>=JH?5:i>=QH?2:1;let u,d,c;return a<0?(c=Math.pow(10,-a)/o,u=Math.round(e*c),d=Math.round(t*c),u/ct&&--d,c=-c):(c=Math.pow(10,a)*o,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(o<0)for(let c=0;c=n)&&(r=n);return r}function c2(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function KD(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?GD:XH(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));KD(e,t,v,x,a)}const i=e[t];let o=r,u=n;for(vc(e,r,t),a(e[n],i)>0&&vc(e,r,n);o0;)--u}a(e[r],i)===0?vc(e,r,u):(++u,vc(e,u,n)),u<=t&&(r=u+1),t<=u&&(n=u-1)}return e}function vc(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function ZH(e,t,r){if(e=Float64Array.from(VH(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return c2(e);if(t>=1)return l2(e);var n,a=(n-1)*t,i=Math.floor(a),o=l2(KD(e,i).subarray(0,i+1)),u=c2(e.subarray(i+1));return o+(u-o)*(a-i)}}function eW(e,t,r=WD){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),o=+r(e[i],i,e),u=+r(e[i+1],i+1,e);return o+(u-o)*(a-i)}}function tW(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?Ef(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Ef(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=nW.exec(e))?new Dr(t[1],t[2],t[3],1):(t=aW.exec(e))?new Dr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=iW.exec(e))?Ef(t[1],t[2],t[3],t[4]):(t=oW.exec(e))?Ef(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=sW.exec(e))?g2(t[1],t[2]/100,t[3]/100,1):(t=lW.exec(e))?g2(t[1],t[2]/100,t[3]/100,t[4]):u2.hasOwnProperty(e)?h2(u2[e]):e==="transparent"?new Dr(NaN,NaN,NaN,0):null}function h2(e){return new Dr(e>>16&255,e>>8&255,e&255,1)}function Ef(e,t,r,n){return n<=0&&(e=t=r=NaN),new Dr(e,t,r,n)}function dW(e){return e instanceof Lu||(e=ru(e)),e?(e=e.rgb(),new Dr(e.r,e.g,e.b,e.opacity)):new Dr}function sw(e,t,r,n){return arguments.length===1?dW(e):new Dr(e,t,r,n??1)}function Dr(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}ij(Dr,sw,YD(Lu,{brighter(e){return e=e==null?Jh:Math.pow(Jh,e),new Dr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?eu:Math.pow(eu,e),new Dr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Dr(fo(this.r),fo(this.g),fo(this.b),Qh(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:p2,formatHex:p2,formatHex8:fW,formatRgb:m2,toString:m2}));function p2(){return`#${so(this.r)}${so(this.g)}${so(this.b)}`}function fW(){return`#${so(this.r)}${so(this.g)}${so(this.b)}${so((isNaN(this.opacity)?1:this.opacity)*255)}`}function m2(){const e=Qh(this.opacity);return`${e===1?"rgb(":"rgba("}${fo(this.r)}, ${fo(this.g)}, ${fo(this.b)}${e===1?")":`, ${e})`}`}function Qh(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 so(e){return e=fo(e),(e<16?"0":"")+e.toString(16)}function g2(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new qn(e,t,r,n)}function JD(e){if(e instanceof qn)return new qn(e.h,e.s,e.l,e.opacity);if(e instanceof Lu||(e=ru(e)),!e)return new qn;if(e instanceof qn)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),o=NaN,u=i-a,d=(i+a)/2;return u?(t===i?o=(r-n)/u+(r0&&d<1?0:o,new qn(o,u,d,e.opacity)}function hW(e,t,r,n){return arguments.length===1?JD(e):new qn(e,t,r,n??1)}function qn(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}ij(qn,hW,YD(Lu,{brighter(e){return e=e==null?Jh:Math.pow(Jh,e),new qn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?eu:Math.pow(eu,e),new qn(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 Dr(xb(e>=240?e-240:e+120,a,n),xb(e,a,n),xb(e<120?e+240:e-120,a,n),this.opacity)},clamp(){return new qn(v2(this.h),Pf(this.s),Pf(this.l),Qh(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=Qh(this.opacity);return`${e===1?"hsl(":"hsla("}${v2(this.h)}, ${Pf(this.s)*100}%, ${Pf(this.l)*100}%${e===1?")":`, ${e})`}`}}));function v2(e){return e=(e||0)%360,e<0?e+360:e}function Pf(e){return Math.max(0,Math.min(1,e||0))}function xb(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 oj=e=>()=>e;function pW(e,t){return function(r){return e+r*t}}function mW(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 gW(e){return(e=+e)==1?QD:function(t,r){return r-t?mW(t,r,e):oj(isNaN(t)?r:t)}}function QD(e,t){var r=t-e;return r?pW(e,r):oj(isNaN(e)?t:e)}const y2=(function e(t){var r=gW(t);function n(a,i){var o=r((a=sw(a)).r,(i=sw(i)).r),u=r(a.g,i.g),d=r(a.b,i.b),c=QD(a.opacity,i.opacity);return function(h){return a.r=o(h),a.g=u(h),a.b=d(h),a.opacity=c(h),a+""}}return n.gamma=e,n})(1);function vW(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[o]?u[o]+=i:u[++o]=i),(n=n[0])===(a=a[0])?u[o]?u[o]+=a:u[++o]=a:(u[++o]=null,d.push({i:o,x:Zh(n,a)})),r=bb.lastIndex;return rt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function EW(e,t,r){var n=e[0],a=e[1],i=t[0],o=t[1];return a2?PW:EW,d=c=null,p}function p(m){return m==null||isNaN(m=+m)?i:(d||(d=u(e.map(n),t,r)))(n(o(m)))}return p.invert=function(m){return o(a((c||(c=u(t,e.map(n),Zh)))(m)))},p.domain=function(m){return arguments.length?(e=Array.from(m,ep),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=sj,h()},p.clamp=function(m){return arguments.length?(o=m?!0:Cr,h()):o!==Cr},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 lj(){return um()(Cr,Cr)}function AW(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function tp(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 Vs(e){return e=tp(Math.abs(e)),e?e[1]:NaN}function TW(e,t){return function(r,n){for(var a=r.length,i=[],o=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[o=(o+1)%e.length];return i.reverse().join(t)}}function kW(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var RW=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function nu(e){if(!(t=RW.exec(e)))throw new Error("invalid format: "+e);var t;return new cj({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]})}nu.prototype=cj.prototype;function cj(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+""}cj.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 IW(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 rp;function MW(e,t){var r=tp(e,t);if(!r)return rp=void 0,e.toPrecision(t);var n=r[0],a=r[1],i=a-(rp=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,o=n.length;return i===o?n:i>o?n+new Array(i-o+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+tp(e,Math.max(0,t+i-1))[0]}function b2(e,t){var r=tp(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 w2={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:AW,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)=>b2(e*100,t),r:b2,s:MW,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function S2(e){return e}var j2=Array.prototype.map,_2=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function DW(e){var t=e.grouping===void 0||e.thousands===void 0?S2:TW(j2.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?S2:kW(j2.call(e.numerals,String)),o=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=nu(p);var v=p.fill,x=p.align,y=p.sign,S=p.symbol,_=p.zero,N=p.width,O=p.comma,A=p.precision,C=p.trim,E=p.type;E==="n"?(O=!0,E="g"):w2[E]||(A===void 0&&(A=12),C=!0,E="g"),(_||v==="0"&&x==="=")&&(_=!0,v="0",x="=");var T=(m&&m.prefix!==void 0?m.prefix:"")+(S==="$"?r:S==="#"&&/[boxX]/.test(E)?"0"+E.toLowerCase():""),R=(S==="$"?n:/[%p]/.test(E)?o:"")+(m&&m.suffix!==void 0?m.suffix:""),L=w2[E],z=/[defgprs%]/.test(E);A=A===void 0?6:/[gprs]/.test(E)?Math.max(1,Math.min(21,A)):Math.max(0,Math.min(20,A));function F(B){var q=T,H=R,V,G,U;if(E==="c")H=L(B)+H,B="";else{B=+B;var $=B<0||1/B<0;if(B=isNaN(B)?d:L(Math.abs(B),A),C&&(B=IW(B)),$&&+B==0&&y!=="+"&&($=!1),q=($?y==="("?y:u:y==="-"||y==="("?"":y)+q,H=(E==="s"&&!isNaN(B)&&rp!==void 0?_2[8+rp/3]:"")+H+($&&y==="("?")":""),z){for(V=-1,G=B.length;++VU||U>57){H=(U===46?a+B.slice(V+1):B.slice(V))+H,B=B.slice(0,V);break}}}O&&!_&&(B=t(B,1/0));var Q=q.length+B.length+H.length,k=Q>1)+q+B+H+k.slice(Q);break;default:B=k+q+B+H;break}return i(B)}return F.toString=function(){return p+""},F}function h(p,m){var v=Math.max(-8,Math.min(8,Math.floor(Vs(m)/3)))*3,x=Math.pow(10,-v),y=c((p=nu(p),p.type="f",p),{suffix:_2[8+v/3]});return function(S){return y(x*S)}}return{format:c,formatPrefix:h}}var Af,uj,ZD;LW({thousands:",",grouping:[3],currency:["$",""]});function LW(e){return Af=DW(e),uj=Af.format,ZD=Af.formatPrefix,Af}function $W(e){return Math.max(0,-Vs(Math.abs(e)))}function BW(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Vs(t)/3)))*3-Vs(Math.abs(e)))}function FW(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Vs(t)-Vs(e))+1}function eL(e,t,r,n){var a=iw(e,t,r),i;switch(n=nu(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=BW(a,o))&&(n.precision=i),ZD(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=FW(a,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=$W(a))&&(n.precision=i-(n.type==="%")*2);break}}return uj(n)}function Ai(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 eL(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,o=n[a],u=n[i],d,c,h=10;for(u0;){if(c=aw(o,u,r),c===d)return n[a]=o,n[i]=u,t(n);if(c>0)o=Math.floor(o/c)*c,u=Math.ceil(u/c)*c;else if(c<0)o=Math.ceil(o*c)/c,u=Math.floor(u*c)/c;else break;d=c}return e},e}function np(){var e=lj();return e.copy=function(){return $u(e,np())},Nn.apply(e,arguments),Ai(e)}function tL(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,ep),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return tL(e).unknown(t)},e=arguments.length?Array.from(e,ep):[0,1],Ai(r)}function rL(e,t){e=e.slice();var r=0,n=e.length-1,a=e[r],i=e[n],o;return iMath.pow(e,t)}function HW(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 O2(e){return(t,r)=>-e(-t,r)}function dj(e){const t=e(N2,C2),r=t.domain;let n=10,a,i;function o(){return a=HW(n),i=VW(n),r()[0]<0?(a=O2(a),i=O2(i),e(zW,qW)):e(N2,C2),t}return t.base=function(u){return arguments.length?(n=+u,o()):n},t.domain=function(u){return arguments.length?(r(u),o()):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;_.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;_.push(y)}_.length*2{if(u==null&&(u=10),d==null&&(d=n===10?"s":","),typeof d!="function"&&(!(n%1)&&(d=nu(d)).precision==null&&(d.trim=!0),d=uj(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(rL(r(),{floor:u=>i(Math.floor(a(u))),ceil:u=>i(Math.ceil(a(u)))})),t}function nL(){const e=dj(um()).domain([1,10]);return e.copy=()=>$u(e,nL()).base(e.base()),Nn.apply(e,arguments),e}function E2(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function P2(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function fj(e){var t=1,r=e(E2(t),P2(t));return r.constant=function(n){return arguments.length?e(E2(t=+n),P2(t)):t},Ai(r)}function aL(){var e=fj(um());return e.copy=function(){return $u(e,aL()).constant(e.constant())},Nn.apply(e,arguments)}function A2(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function WW(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function GW(e){return e<0?-e*e:e*e}function hj(e){var t=e(Cr,Cr),r=1;function n(){return r===1?e(Cr,Cr):r===.5?e(WW,GW):e(A2(r),A2(1/r))}return t.exponent=function(a){return arguments.length?(r=+a,n()):r},Ai(t)}function pj(){var e=hj(um());return e.copy=function(){return $u(e,pj()).exponent(e.exponent())},Nn.apply(e,arguments),e}function KW(){return pj.apply(null,arguments).exponent(.5)}function T2(e){return Math.sign(e)*e*e}function XW(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function iL(){var e=lj(),t=[0,1],r=!1,n;function a(i){var o=XW(e(i));return isNaN(o)?n:r?Math.round(o):o}return a.invert=function(i){return e.invert(T2(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,ep)).map(T2)),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 iL(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Nn.apply(a,arguments),Ai(a)}function oL(){var e=[],t=[],r=[],n;function a(){var o=0,u=Math.max(1,t.length);for(r=new Array(u-1);++o0?r[u-1]:e[0],u=r?[n[r-1],t]:[n[c-1],n[c]]},o.unknown=function(d){return arguments.length&&(i=d),o},o.thresholds=function(){return n.slice()},o.copy=function(){return sL().domain([e,t]).range(a).unknown(i)},Nn.apply(Ai(o),arguments)}function lL(){var e=[.5],t=[0,1],r,n=1;function a(i){return i!=null&&i<=i?t[Du(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 o=t.indexOf(i);return[e[o-1],e[o]]},a.unknown=function(i){return arguments.length?(r=i,a):r},a.copy=function(){return lL().domain(e).range(t).unknown(r)},Nn.apply(a,arguments)}const wb=new Date,Sb=new Date;function tr(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 o=a(i),u=a.ceil(i);return i-o(t(i=new Date(+i),o==null?1:Math.floor(o)),i),a.range=(i,o,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(ctr(o=>{if(o>=o)for(;e(o),!i(o);)o.setTime(o-1)},(o,u)=>{if(o>=o)if(u<0)for(;++u<=0;)for(;t(o,-1),!i(o););else for(;--u>=0;)for(;t(o,1),!i(o););}),r&&(a.count=(i,o)=>(wb.setTime(+i),Sb.setTime(+o),e(wb),e(Sb),Math.floor(r(wb,Sb))),a.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?a.filter(n?o=>n(o)%i===0:o=>a.count(0,o)%i===0):a)),a}const ap=tr(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);ap.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?tr(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):ap);ap.range;const ka=1e3,bn=ka*60,Ra=bn*60,$a=Ra*24,mj=$a*7,k2=$a*30,jb=$a*365,lo=tr(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*ka)},(e,t)=>(t-e)/ka,e=>e.getUTCSeconds());lo.range;const gj=tr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ka)},(e,t)=>{e.setTime(+e+t*bn)},(e,t)=>(t-e)/bn,e=>e.getMinutes());gj.range;const vj=tr(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*bn)},(e,t)=>(t-e)/bn,e=>e.getUTCMinutes());vj.range;const yj=tr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ka-e.getMinutes()*bn)},(e,t)=>{e.setTime(+e+t*Ra)},(e,t)=>(t-e)/Ra,e=>e.getHours());yj.range;const xj=tr(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Ra)},(e,t)=>(t-e)/Ra,e=>e.getUTCHours());xj.range;const Bu=tr(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*bn)/$a,e=>e.getDate()-1);Bu.range;const dm=tr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/$a,e=>e.getUTCDate()-1);dm.range;const cL=tr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/$a,e=>Math.floor(e/$a));cL.range;function To(e){return tr(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())*bn)/mj)}const fm=To(0),ip=To(1),YW=To(2),JW=To(3),Hs=To(4),QW=To(5),ZW=To(6);fm.range;ip.range;YW.range;JW.range;Hs.range;QW.range;ZW.range;function ko(e){return tr(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)/mj)}const hm=ko(0),op=ko(1),eG=ko(2),tG=ko(3),Ws=ko(4),rG=ko(5),nG=ko(6);hm.range;op.range;eG.range;tG.range;Ws.range;rG.range;nG.range;const bj=tr(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 wj=tr(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 Ba=tr(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());Ba.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:tr(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)});Ba.range;const Fa=tr(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());Fa.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:tr(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)});Fa.range;function uL(e,t,r,n,a,i){const o=[[lo,1,ka],[lo,5,5*ka],[lo,15,15*ka],[lo,30,30*ka],[i,1,bn],[i,5,5*bn],[i,15,15*bn],[i,30,30*bn],[a,1,Ra],[a,3,3*Ra],[a,6,6*Ra],[a,12,12*Ra],[n,1,$a],[n,2,2*$a],[r,1,mj],[t,1,k2],[t,3,3*k2],[e,1,jb]];function u(c,h,p){const m=hS).right(o,m);if(v===o.length)return e.every(iw(c/jb,h/jb,p));if(v===0)return ap.every(Math.max(iw(c,h,p),1));const[x,y]=o[m/o[v-1][2]53)return null;"w"in W||(W.w=1),"Z"in W?(Ce=Nb(yc(W.y,0,1)),qe=Ce.getUTCDay(),Ce=qe>4||qe===0?op.ceil(Ce):op(Ce),Ce=dm.offset(Ce,(W.V-1)*7),W.y=Ce.getUTCFullYear(),W.m=Ce.getUTCMonth(),W.d=Ce.getUTCDate()+(W.w+6)%7):(Ce=_b(yc(W.y,0,1)),qe=Ce.getDay(),Ce=qe>4||qe===0?ip.ceil(Ce):ip(Ce),Ce=Bu.offset(Ce,(W.V-1)*7),W.y=Ce.getFullYear(),W.m=Ce.getMonth(),W.d=Ce.getDate()+(W.w+6)%7)}else("W"in W||"U"in W)&&("w"in W||(W.w="u"in W?W.u%7:"W"in W?1:0),qe="Z"in W?Nb(yc(W.y,0,1)).getUTCDay():_b(yc(W.y,0,1)).getDay(),W.m=0,W.d="W"in W?(W.w+6)%7+W.W*7-(qe+5)%7:W.w+W.U*7-(qe+6)%7);return"Z"in W?(W.H+=W.Z/100|0,W.M+=W.Z%100,Nb(W)):_b(W)}}function R(ee,ce,pe,W){for(var _e=0,Ce=ce.length,qe=pe.length,De,nt;_e=qe)return-1;if(De=ce.charCodeAt(_e++),De===37){if(De=ce.charAt(_e++),nt=C[De in R2?ce.charAt(_e++):De],!nt||(W=nt(ee,pe,W))<0)return-1}else if(De!=pe.charCodeAt(W++))return-1}return W}function L(ee,ce,pe){var W=c.exec(ce.slice(pe));return W?(ee.p=h.get(W[0].toLowerCase()),pe+W[0].length):-1}function z(ee,ce,pe){var W=v.exec(ce.slice(pe));return W?(ee.w=x.get(W[0].toLowerCase()),pe+W[0].length):-1}function F(ee,ce,pe){var W=p.exec(ce.slice(pe));return W?(ee.w=m.get(W[0].toLowerCase()),pe+W[0].length):-1}function B(ee,ce,pe){var W=_.exec(ce.slice(pe));return W?(ee.m=N.get(W[0].toLowerCase()),pe+W[0].length):-1}function q(ee,ce,pe){var W=y.exec(ce.slice(pe));return W?(ee.m=S.get(W[0].toLowerCase()),pe+W[0].length):-1}function H(ee,ce,pe){return R(ee,t,ce,pe)}function V(ee,ce,pe){return R(ee,r,ce,pe)}function G(ee,ce,pe){return R(ee,n,ce,pe)}function U(ee){return o[ee.getDay()]}function $(ee){return i[ee.getDay()]}function Q(ee){return d[ee.getMonth()]}function k(ee){return u[ee.getMonth()]}function I(ee){return a[+(ee.getHours()>=12)]}function D(ee){return 1+~~(ee.getMonth()/3)}function Z(ee){return o[ee.getUTCDay()]}function ie(ee){return i[ee.getUTCDay()]}function oe(ee){return d[ee.getUTCMonth()]}function ne(ee){return u[ee.getUTCMonth()]}function K(ee){return a[+(ee.getUTCHours()>=12)]}function J(ee){return 1+~~(ee.getUTCMonth()/3)}return{format:function(ee){var ce=E(ee+="",O);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=E(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 R2={"-":"",_:" ",0:"0"},sr=/^\s*\d+/,cG=/^%/,uG=/[\\^$*+?|[\]().{}]/g;function lt(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i[t.toLowerCase(),r]))}function fG(e,t,r){var n=sr.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function hG(e,t,r){var n=sr.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function pG(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function mG(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function gG(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function I2(e,t,r){var n=sr.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function M2(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function vG(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 yG(e,t,r){var n=sr.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function xG(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function D2(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function bG(e,t,r){var n=sr.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function L2(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function wG(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function SG(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function jG(e,t,r){var n=sr.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function _G(e,t,r){var n=sr.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function NG(e,t,r){var n=cG.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function CG(e,t,r){var n=sr.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function OG(e,t,r){var n=sr.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function $2(e,t){return lt(e.getDate(),t,2)}function EG(e,t){return lt(e.getHours(),t,2)}function PG(e,t){return lt(e.getHours()%12||12,t,2)}function AG(e,t){return lt(1+Bu.count(Ba(e),e),t,3)}function dL(e,t){return lt(e.getMilliseconds(),t,3)}function TG(e,t){return dL(e,t)+"000"}function kG(e,t){return lt(e.getMonth()+1,t,2)}function RG(e,t){return lt(e.getMinutes(),t,2)}function IG(e,t){return lt(e.getSeconds(),t,2)}function MG(e){var t=e.getDay();return t===0?7:t}function DG(e,t){return lt(fm.count(Ba(e)-1,e),t,2)}function fL(e){var t=e.getDay();return t>=4||t===0?Hs(e):Hs.ceil(e)}function LG(e,t){return e=fL(e),lt(Hs.count(Ba(e),e)+(Ba(e).getDay()===4),t,2)}function $G(e){return e.getDay()}function BG(e,t){return lt(ip.count(Ba(e)-1,e),t,2)}function FG(e,t){return lt(e.getFullYear()%100,t,2)}function zG(e,t){return e=fL(e),lt(e.getFullYear()%100,t,2)}function qG(e,t){return lt(e.getFullYear()%1e4,t,4)}function UG(e,t){var r=e.getDay();return e=r>=4||r===0?Hs(e):Hs.ceil(e),lt(e.getFullYear()%1e4,t,4)}function VG(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+lt(t/60|0,"0",2)+lt(t%60,"0",2)}function B2(e,t){return lt(e.getUTCDate(),t,2)}function HG(e,t){return lt(e.getUTCHours(),t,2)}function WG(e,t){return lt(e.getUTCHours()%12||12,t,2)}function GG(e,t){return lt(1+dm.count(Fa(e),e),t,3)}function hL(e,t){return lt(e.getUTCMilliseconds(),t,3)}function KG(e,t){return hL(e,t)+"000"}function XG(e,t){return lt(e.getUTCMonth()+1,t,2)}function YG(e,t){return lt(e.getUTCMinutes(),t,2)}function JG(e,t){return lt(e.getUTCSeconds(),t,2)}function QG(e){var t=e.getUTCDay();return t===0?7:t}function ZG(e,t){return lt(hm.count(Fa(e)-1,e),t,2)}function pL(e){var t=e.getUTCDay();return t>=4||t===0?Ws(e):Ws.ceil(e)}function eK(e,t){return e=pL(e),lt(Ws.count(Fa(e),e)+(Fa(e).getUTCDay()===4),t,2)}function tK(e){return e.getUTCDay()}function rK(e,t){return lt(op.count(Fa(e)-1,e),t,2)}function nK(e,t){return lt(e.getUTCFullYear()%100,t,2)}function aK(e,t){return e=pL(e),lt(e.getUTCFullYear()%100,t,2)}function iK(e,t){return lt(e.getUTCFullYear()%1e4,t,4)}function oK(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Ws(e):Ws.ceil(e),lt(e.getUTCFullYear()%1e4,t,4)}function sK(){return"+0000"}function F2(){return"%"}function z2(e){return+e}function q2(e){return Math.floor(+e/1e3)}var cs,mL,gL;lK({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 lK(e){return cs=lG(e),mL=cs.format,cs.parse,gL=cs.utcFormat,cs.utcParse,cs}function cK(e){return new Date(e)}function uK(e){return e instanceof Date?+e:+new Date(+e)}function Sj(e,t,r,n,a,i,o,u,d,c){var h=lj(),p=h.invert,m=h.domain,v=c(".%L"),x=c(":%S"),y=c("%I:%M"),S=c("%I %p"),_=c("%a %d"),N=c("%b %d"),O=c("%B"),A=c("%Y");function C(E){return(d(E)t(a/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(a,i)=>ZH(e,i/n))},r.copy=function(){return bL(t).domain(e)},Wa.apply(r,arguments)}function mm(){var e=0,t=.5,r=1,n=1,a,i,o,u,d,c=Cr,h,p=!1,m;function v(y){return isNaN(y=+y)?m:(y=.5+((y=+h(y))-i)*(n*yr}return Ob=e,Ob}var Eb,W2;function mK(){if(W2)return Eb;W2=1;var e=gm(),t=_L(),r=xl();function n(a){return a&&a.length?e(a,r,t):void 0}return Eb=n,Eb}var gK=mK();const vm=ct(gK);var Pb,G2;function NL(){if(G2)return Pb;G2=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};Pe.decimalPlaces=Pe.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*Et;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};Pe.dividedBy=Pe.div=function(e){return Da(this,new this.constructor(e))};Pe.dividedToIntegerBy=Pe.idiv=function(e){var t=this,r=t.constructor;return bt(Da(t,new r(e),0,1),r.precision)};Pe.equals=Pe.eq=function(e){return!this.cmp(e)};Pe.exponent=function(){return Wt(this)};Pe.greaterThan=Pe.gt=function(e){return this.cmp(e)>0};Pe.greaterThanOrEqualTo=Pe.gte=function(e){return this.cmp(e)>=0};Pe.isInteger=Pe.isint=function(){return this.e>this.d.length-2};Pe.isNegative=Pe.isneg=function(){return this.s<0};Pe.isPositive=Pe.ispos=function(){return this.s>0};Pe.isZero=function(){return this.s===0};Pe.lessThan=Pe.lt=function(e){return this.cmp(e)<0};Pe.lessThanOrEqualTo=Pe.lte=function(e){return this.cmp(e)<1};Pe.logarithm=Pe.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(Zr))throw Error(jn+"NaN");if(r.s<1)throw Error(jn+(r.s?"NaN":"-Infinity"));return r.eq(Zr)?new n(0):(Tt=!1,t=Da(au(r,i),au(e,i),i),Tt=!0,bt(t,a))};Pe.minus=Pe.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?PL(t,e):OL(t,(e.s=-e.s,e))};Pe.modulo=Pe.mod=function(e){var t,r=this,n=r.constructor,a=n.precision;if(e=new n(e),!e.s)throw Error(jn+"NaN");return r.s?(Tt=!1,t=Da(r,e,0,1).times(e),Tt=!0,r.minus(t)):bt(new n(r),a)};Pe.naturalExponential=Pe.exp=function(){return EL(this)};Pe.naturalLogarithm=Pe.ln=function(){return au(this)};Pe.negated=Pe.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Pe.plus=Pe.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?OL(t,e):PL(t,(e.s=-e.s,e))};Pe.precision=Pe.sd=function(e){var t,r,n,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ho+e);if(t=Wt(a)+1,n=a.d.length-1,r=n*Et+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};Pe.squareRoot=Pe.sqrt=function(){var e,t,r,n,a,i,o,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(jn+"NaN")}for(e=Wt(u),Tt=!1,a=Math.sqrt(+u),a==0||a==1/0?(t=ta(u.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=Sl((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=o=r+3;;)if(i=n,n=i.plus(Da(u,i,o+2)).times(.5),ta(i.d).slice(0,o)===(t=ta(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),a==o&&t=="4999"){if(bt(i,r+1,0),i.times(i).eq(u)){n=i;break}}else if(t!="9999")break;o+=4}return Tt=!0,bt(n,r)};Pe.times=Pe.mul=function(e){var t,r,n,a,i,o,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%ir|0,t=u/ir|0;i[a]=(i[a]+t)%ir|0}for(;!i[--o];)i.pop();return t?++r:i.shift(),e.d=i,e.e=r,Tt?bt(e,p.precision):e};Pe.toDecimalPlaces=Pe.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(sa(e,0,wl),t===void 0?t=n.rounding:sa(t,0,8),bt(r,e+Wt(r)+1,t))};Pe.toExponential=function(e,t){var r,n=this,a=n.constructor;return e===void 0?r=vo(n,!0):(sa(e,0,wl),t===void 0?t=a.rounding:sa(t,0,8),n=bt(new a(n),e+1,t),r=vo(n,!0,e+1)),r};Pe.toFixed=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?vo(a):(sa(e,0,wl),t===void 0?t=i.rounding:sa(t,0,8),n=bt(new i(a),e+Wt(a)+1,t),r=vo(n.abs(),!1,e+Wt(n)+1),a.isneg()&&!a.isZero()?"-"+r:r)};Pe.toInteger=Pe.toint=function(){var e=this,t=e.constructor;return bt(new t(e),Wt(e)+1,t.rounding)};Pe.toNumber=function(){return+this};Pe.toPower=Pe.pow=function(e){var t,r,n,a,i,o,u=this,d=u.constructor,c=12,h=+(e=new d(e));if(!e.s)return new d(Zr);if(u=new d(u),!u.s){if(e.s<1)throw Error(jn+"Infinity");return u}if(u.eq(Zr))return u;if(n=d.precision,e.eq(Zr))return bt(u,n);if(t=e.e,r=e.d.length-1,o=t>=r,i=u.s,o){if((r=h<0?-h:h)<=CL){for(a=new d(Zr),t=Math.ceil(n/Et+4),Tt=!1;r%2&&(a=a.times(u),Z2(a.d,t)),r=Sl(r/2),r!==0;)u=u.times(u),Z2(u.d,t);return Tt=!0,e.s<0?new d(Zr).div(a):bt(a,n)}}else if(i<0)throw Error(jn+"NaN");return i=i<0&&e.d[Math.max(t,r)]&1?-1:1,u.s=1,Tt=!1,a=e.times(au(u,n+c)),Tt=!0,a=EL(a),a.s=i,a};Pe.toPrecision=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?(r=Wt(a),n=vo(a,r<=i.toExpNeg||r>=i.toExpPos)):(sa(e,1,wl),t===void 0?t=i.rounding:sa(t,0,8),a=bt(new i(a),e,t),r=Wt(a),n=vo(a,e<=r||r<=i.toExpNeg,e)),n};Pe.toSignificantDigits=Pe.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(sa(e,1,wl),t===void 0?t=n.rounding:sa(t,0,8)),bt(new n(r),e,t)};Pe.toString=Pe.valueOf=Pe.val=Pe.toJSON=Pe[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Wt(e),r=e.constructor;return vo(e,t<=r.toExpNeg||t>=r.toExpPos)};function OL(e,t){var r,n,a,i,o,u,d,c,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s||(t=new h(e)),Tt?bt(t,p):t;if(d=e.d,c=t.d,o=e.e,a=t.e,d=d.slice(),i=o-a,i){for(i<0?(n=d,i=-i,u=c.length):(n=c,a=o,u=d.length),o=Math.ceil(p/Et),u=o>u?o+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)/ir|0,d[i]%=ir;for(r&&(d.unshift(r),++a),u=d.length;d[--u]==0;)d.pop();return t.d=d,t.e=a,Tt?bt(t,p):t}function sa(e,t,r){if(e!==~~e||er)throw Error(ho+e)}function ta(e){var t,r,n,a=e.length-1,i="",o=e[0];if(a>0){for(i+=o,t=1;to?1:-1;else for(u=d=0;ua[u]?1:-1;break}return d}function r(n,a,i){for(var o=0;i--;)n[i]-=o,o=n[i]1;)n.shift()}return function(n,a,i,o){var u,d,c,h,p,m,v,x,y,S,_,N,O,A,C,E,T,R,L=n.constructor,z=n.s==a.s?1:-1,F=n.d,B=a.d;if(!n.s)return new L(n);if(!a.s)throw Error(jn+"Division by zero");for(d=n.e-a.e,T=B.length,C=F.length,v=new L(z),x=v.d=[],c=0;B[c]==(F[c]||0);)++c;if(B[c]>(F[c]||0)&&--d,i==null?N=i=L.precision:o?N=i+(Wt(n)-Wt(a))+1:N=i,N<0)return new L(0);if(N=N/Et+2|0,c=0,T==1)for(h=0,B=B[0],N++;(c1&&(B=e(B,h),F=e(F,h),T=B.length,C=F.length),A=T,y=F.slice(0,T),S=y.length;S=ir/2&&++E;do h=0,u=t(B,y,T,S),u<0?(_=y[0],T!=S&&(_=_*ir+(y[1]||0)),h=_/E|0,h>1?(h>=ir&&(h=ir-1),p=e(B,h),m=p.length,S=y.length,u=t(p,y,m,S),u==1&&(h--,r(p,T16)throw Error(Nj+Wt(e));if(!e.s)return new h(Zr);for(Tt=!1,u=p,o=new h(.03125);e.abs().gte(.1);)e=e.times(o),c+=5;for(n=Math.log(ao(2,c))/Math.LN10*2+5|0,u+=n,r=a=i=new h(Zr),h.precision=u;;){if(a=bt(a.times(e),u),r=r.times(++d),o=i.plus(Da(a,r,u)),ta(o.d).slice(0,u)===ta(i.d).slice(0,u)){for(;c--;)i=bt(i.times(i),u);return h.precision=p,t==null?(Tt=!0,bt(i,p)):i}i=o}}function Wt(e){for(var t=e.e*Et,r=e.d[0];r>=10;r/=10)t++;return t}function Ib(e,t,r){if(t>e.LN10.sd())throw Tt=!0,r&&(e.precision=r),Error(jn+"LN10 precision limit exceeded");return bt(new e(e.LN10),t)}function gi(e){for(var t="";e--;)t+="0";return t}function au(e,t){var r,n,a,i,o,u,d,c,h,p=1,m=10,v=e,x=v.d,y=v.constructor,S=y.precision;if(v.s<1)throw Error(jn+(v.s?"NaN":"-Infinity"));if(v.eq(Zr))return new y(0);if(t==null?(Tt=!1,c=S):c=t,v.eq(10))return t==null&&(Tt=!0),Ib(y,c);if(c+=m,y.precision=c,r=ta(x),n=r.charAt(0),i=Wt(v),Math.abs(i)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)v=v.times(e),r=ta(v.d),n=r.charAt(0),p++;i=Wt(v),n>1?(v=new y("0."+r),i++):v=new y(n+"."+r.slice(1))}else return d=Ib(y,c+2,S).times(i+""),v=au(new y(n+"."+r.slice(1)),c-m).plus(d),y.precision=S,t==null?(Tt=!0,bt(v,S)):v;for(u=o=v=Da(v.minus(Zr),v.plus(Zr),c),h=bt(v.times(v),c),a=3;;){if(o=bt(o.times(h),c),d=u.plus(Da(o,new y(a),c)),ta(d.d).slice(0,c)===ta(u.d).slice(0,c))return u=u.times(2),i!==0&&(u=u.plus(Ib(y,c+2,S).times(i+""))),u=Da(u,new y(p),c),y.precision=S,t==null?(Tt=!0,bt(u,S)):u;u=d,a+=2}}function Q2(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=Sl(r/Et),e.d=[],n=(r+1)%Et,r<0&&(n+=Et),nsp||e.e<-sp))throw Error(Nj+r)}else e.s=0,e.e=0,e.d=[0];return e}function bt(e,t,r){var n,a,i,o,u,d,c,h,p=e.d;for(o=1,i=p[0];i>=10;i/=10)o++;if(n=t-o,n<0)n+=Et,a=t,c=p[h=0];else{if(h=Math.ceil((n+1)/Et),i=p.length,h>=i)return e;for(c=i=p[h],o=1;i>=10;i/=10)o++;n%=Et,a=n-Et+o}if(r!==void 0&&(i=ao(10,o-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/ao(10,o-a):0:p[h-1])%10&1||r==(e.s<0?8:7))),t<1||!p[0])return d?(i=Wt(e),p.length=1,t=t-i-1,p[0]=ao(10,(Et-t%Et)%Et),e.e=Sl(-t/Et)||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=ao(10,Et-n),p[h]=a>0?(c/ao(10,o-a)%ao(10,a)|0)*i:0),d)for(;;)if(h==0){(p[0]+=i)==ir&&(p[0]=1,++e.e);break}else{if(p[h]+=i,p[h]!=ir)break;p[h--]=0,i=1}for(n=p.length;p[--n]===0;)p.pop();if(Tt&&(e.e>sp||e.e<-sp))throw Error(Nj+Wt(e));return e}function PL(e,t){var r,n,a,i,o,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),Tt?bt(t,v):t;if(d=e.d,p=t.d,n=t.e,c=e.e,d=d.slice(),o=c-n,o){for(h=o<0,h?(r=d,o=-o,u=p.length):(r=p,n=c,u=d.length),a=Math.max(Math.ceil(v/Et),u)+2,o>a&&(o=a,r.length=1),r.reverse(),a=o;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>o;){if(d[--a]0?i=i.charAt(0)+"."+i.slice(1)+gi(n):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+gi(-a-1)+i,r&&(n=r-o)>0&&(i+=gi(n))):a>=o?(i+=gi(a+1-o),r&&(n=r-a-1)>0&&(i=i+"."+gi(n))):((n=a+1)0&&(a+1===o&&(i+="."),i+=gi(n))),e.s<0?"-"+i:i}function Z2(e,t){if(e.length>t)return e.length=t,!0}function AL(e){var t,r,n;function a(i){var o=this;if(!(o instanceof a))return new a(i);if(o.constructor=a,i instanceof a){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(ho+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return Q2(o,i.toString())}else if(typeof i!="string")throw Error(ho+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,CK.test(i))Q2(o,i);else throw Error(ho+i)}if(a.prototype=Pe,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=AL,a.config=a.set=OK,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(ho+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(ho+r+": "+n);return this}var Cj=AL(NK);Zr=new Cj(1);const yt=Cj;function EK(e){return kK(e)||TK(e)||AK(e)||PK()}function PK(){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 AK(e,t){if(e){if(typeof e=="string")return uw(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 uw(e,t)}}function TK(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function kK(e){if(Array.isArray(e))return uw(e)}function uw(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-o,eT(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 o=e[Symbol.iterator](),u;!(n=(u=o.next()).done)&&(r.push(u.value),!(t&&r.length===t));n=!0);}catch(d){a=!0,i=d}finally{try{!n&&o.return!=null&&o.return()}finally{if(a)throw i}}return r}}function GK(e){if(Array.isArray(e))return e}function ML(e){var t=iu(e,2),r=t[0],n=t[1],a=r,i=n;return r>n&&(a=n,i=r),[a,i]}function DL(e,t,r){if(e.lte(0))return new yt(0);var n=bm.getDigitCount(e.toNumber()),a=new yt(10).pow(n),i=e.div(a),o=n!==1?.05:.1,u=new yt(Math.ceil(i.div(o).toNumber())).add(r).mul(o),d=u.mul(a);return t?d:new yt(Math.ceil(d))}function KK(e,t,r){var n=1,a=new yt(e);if(!a.isint()&&r){var i=Math.abs(e);i<1?(n=new yt(10).pow(bm.getDigitCount(e)-1),a=new yt(Math.floor(a.div(n).toNumber())).mul(n)):i>1&&(a=new yt(Math.floor(e)))}else e===0?a=new yt(Math.floor((t-1)/2)):r||(a=new yt(Math.floor(e)));var o=Math.floor((t-1)/2),u=DK(MK(function(d){return a.add(new yt(d-o).mul(n)).toNumber()}),dw);return u(0,t)}function LL(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 yt(0),tickMin:new yt(0),tickMax:new yt(0)};var i=DL(new yt(t).sub(e).div(r-1),n,a),o;e<=0&&t>=0?o=new yt(0):(o=new yt(e).add(t).div(2),o=o.sub(new yt(o).mod(i)));var u=Math.ceil(o.sub(e).div(i).toNumber()),d=Math.ceil(new yt(t).sub(o).div(i).toNumber()),c=u+d+1;return c>r?LL(e,t,r,n,a+1):(c0?d+(r-c):d,u=t>0?u:u+(r-c)),{step:i,tickMin:o.sub(new yt(u).mul(i)),tickMax:o.add(new yt(d).mul(i))})}function XK(e){var t=iu(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,o=Math.max(a,2),u=ML([r,n]),d=iu(u,2),c=d[0],h=d[1];if(c===-1/0||h===1/0){var p=h===1/0?[c].concat(hw(dw(0,a-1).map(function(){return 1/0}))):[].concat(hw(dw(0,a-1).map(function(){return-1/0})),[h]);return r>n?fw(p):p}if(c===h)return KK(c,a,i);var m=LL(c,h,o,i),v=m.step,x=m.tickMin,y=m.tickMax,S=bm.rangeStep(x,y.add(new yt(.1).mul(v)),v);return r>n?fw(S):S}function YK(e,t){var r=iu(e,2),n=r[0],a=r[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=ML([n,a]),u=iu(o,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=DL(new yt(c).sub(d).div(h-1),i,0),m=[].concat(hw(bm.rangeStep(new yt(d),new yt(c).sub(new yt(.99).mul(p)),p)),[c]);return n>a?fw(m):m}var JK=RL(XK),QK=RL(YK),ZK="Invariant failed";function yo(e,t){throw new Error(ZK)}var eX=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Gs(e){"@babel/helpers - typeof";return Gs=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},Gs(e)}function lp(){return lp=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 sX(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 lX(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cX(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,o=-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(_r(p-h)!==_r(m-p)){var x=[];if(_r(m-p)===_r(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 S=m+d[1]-d[0];x[0]=Math.min(p,(S+p)/2),x[1]=Math.max(p,(S+p)/2)}var _=[Math.min(p,(v+p)/2),Math.max(p,(v+p)/2)];if(t>_[0]&&t<=_[1]||t>=x[0]&&t<=x[1]){o=a[c].index;break}}else{var N=Math.min(h,m),O=Math.max(h,m);if(t>(N+p)/2&&t<=(O+p)/2){o=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){o=n[A].index;break}return o},Oj=function(t){var r,n=t,a=n.type.displayName,i=(r=t.type)!==null&&r!==void 0&&r.defaultProps?Bt(Bt({},t.type.defaultProps),t.props):t.props,o=i.stroke,u=i.fill,d;switch(a){case"Line":d=o;break;case"Area":case"Radar":d=o&&o!=="none"?o:u;break;default:d=u;break}return d},CX=function(t){var r=t.barSize,n=t.totalSize,a=t.stackGroups,i=a===void 0?{}:a;if(!i)return{};for(var o={},u=Object.keys(i),d=0,c=u.length;d=0});if(_&&_.length){var N=_[0].type.defaultProps,O=N!==void 0?Bt(Bt({},N),_[0].props):_[0].props,A=O.barSize,C=O[S];o[C]||(o[C]=[]);var E=Qe(A)?r:A;o[C].push({item:_[0],stackList:_.slice(1),barSize:Qe(E)?void 0:Nr(E,n,0)})}}return o},OX=function(t){var r=t.barGap,n=t.barCategoryGap,a=t.bandSize,i=t.sizeList,o=i===void 0?[]:i,u=t.maxBarSize,d=o.length;if(d<1)return null;var c=Nr(r,a,0,!0),h,p=[];if(o[0].barSize===+o[0].barSize){var m=!1,v=a/d,x=o.reduce(function(A,C){return A+C.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,S={offset:y-c,size:0};h=o.reduce(function(A,C){var E={item:C.item,position:{offset:S.offset+S.size+c,size:m?v:C.barSize}},T=[].concat(nT(A),[E]);return S=T[T.length-1].position,C.stackList&&C.stackList.length&&C.stackList.forEach(function(R){T.push({item:R,position:S})}),T},p)}else{var _=Nr(n,a,0,!0);a-2*_-(d-1)*c<=0&&(c=0);var N=(a-2*_-(d-1)*c)/d;N>1&&(N>>=0);var O=u===+u?Math.min(N,u):N;h=o.reduce(function(A,C,E){var T=[].concat(nT(A),[{item:C.item,position:{offset:_+(N+c)*E+(N-O)/2,size:O}}]);return C.stackList&&C.stackList.length&&C.stackList.forEach(function(R){T.push({item:R,position:T[T.length-1].position})}),T},p)}return h},EX=function(t,r,n,a){var i=n.children,o=n.width,u=n.margin,d=o-(u.left||0)-(u.right||0),c=zL({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"&&je(t[v]))return Bt(Bt({},t),{},Ts({},v,t[v]+(p||0)));if((y==="horizontal"||y==="vertical"&&v==="center")&&x!=="middle"&&je(t[x]))return Bt(Bt({},t),{},Ts({},x,t[x]+(m||0)))}return t},PX=function(t,r,n){return Qe(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},qL=function(t,r,n,a,i){var o=r.props.children,u=tn(o,zu).filter(function(c){return PX(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=Zt(h,n);if(Qe(p))return c;var m=Array.isArray(p)?[ym(p),vm(p)]:[p,p],v=d.reduce(function(x,y){var S=Zt(h,y,0),_=m[0]-Math.abs(Array.isArray(S)?S[0]:S),N=m[1]+Math.abs(Array.isArray(S)?S[1]:S);return[Math.min(_,x[0]),Math.max(N,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},AX=function(t,r,n,a,i){var o=r.map(function(u){return qL(t,u,n,i,a)}).filter(function(u){return!Qe(u)});return o&&o.length?o.reduce(function(u,d){return[Math.min(u[0],d[0]),Math.max(u[1],d[1])]},[1/0,-1/0]):null},UL=function(t,r,n,a,i){var o=r.map(function(d){var c=d.props.dataKey;return n==="number"&&c&&qL(t,d,c,a)||$c(t,c,n,i)});if(n==="number")return o.reduce(function(d,c){return[Math.min(d[0],c[0]),Math.max(d[1],c[1])]},[1/0,-1/0]);var u={};return o.reduce(function(d,c){for(var h=0,p=c.length;h=2?_r(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!Iu(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}})},Mb=new WeakMap,Tf=function(t,r){if(typeof r!="function")return t;Mb.has(t)||Mb.set(t,new WeakMap);var n=Mb.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},WL=function(t,r,n){var a=t.scale,i=t.type,o=t.layout,u=t.axisType;if(a==="auto")return o==="radial"&&u==="radiusAxis"?{scale:Zc(),realScaleType:"band"}:o==="radial"&&u==="angleAxis"?{scale:np(),realScaleType:"linear"}:i==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:Lc(),realScaleType:"point"}:i==="category"?{scale:Zc(),realScaleType:"band"}:{scale:np(),realScaleType:"linear"};if(po(a)){var d="scale".concat(rm(a));return{scale:(U2[d]||Lc)(),realScaleType:U2[d]?d:"point"}}return He(a)?{scale:a}:{scale:Lc(),realScaleType:"point"}},iT=1e-4,GL=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])-iT,o=Math.max(a[0],a[1])+iT,u=t(r[0]),d=t(r[n-1]);(uo||do)&&t.domain([r[0],r[n-1]])}},TX=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]=o,t[u][n][1]=o+d,o=t[u][n][1])}},IX=function(t){var r=t.length;if(!(r<=0))for(var n=0,a=t[0].length;n=0?(t[o][n][0]=i,t[o][n][1]=i+u,i=t[o][n][1]):(t[o][n][0]=0,t[o][n][1]=0)}},MX={sign:RX,expand:S9,none:Bs,silhouette:j9,wiggle:_9,positive:IX},DX=function(t,r,n){var a=r.map(function(u){return u.props.dataKey}),i=MX[n],o=w9().keys(a).value(function(u,d){return+Zt(u,d,0)}).order(W1).offset(i);return o(t)},LX=function(t,r,n,a,i,o){if(!t)return null;var u=o?r.reverse():r,d={},c=u.reduce(function(p,m){var v,x=(v=m.type)!==null&&v!==void 0&&v.defaultProps?Bt(Bt({},m.type.defaultProps),m.props):m.props,y=x.stackId,S=x.hide;if(S)return p;var _=x[n],N=p[_]||{hasStack:!1,stackGroups:{}};if(er(y)){var O=N.stackGroups[y]||{numericAxisId:n,cateAxisId:a,items:[]};O.items.push(m),N.hasStack=!0,N.stackGroups[y]=O}else N.stackGroups[yl("_stackId_")]={numericAxisId:n,cateAxisId:a,items:[m]};return Bt(Bt({},p),{},Ts({},_,N))},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,S){var _=v.stackGroups[S];return Bt(Bt({},y),{},Ts({},S,{numericAxisId:n,cateAxisId:a,items:_.items,stackedData:DX(t,_.items,i)}))},x)}return Bt(Bt({},p),{},Ts({},m,v))},h)},KL=function(t,r){var n=r.realScaleType,a=r.type,i=r.tickCount,o=r.originalDomain,u=r.allowDecimals,d=n||r.scale;if(d!=="auto"&&d!=="linear")return null;if(i&&a==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var c=t.domain();if(!c.length)return null;var h=JK(c,i,u);return t.domain([ym(h),vm(h)]),{niceTicks:h}}if(i&&a==="number"){var p=t.domain(),m=QK(p,i,u);return{niceTicks:m}}return null};function oT(e){var t=e.axis,r=e.ticks,n=e.bandSize,a=e.entry,i=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Qe(a[t.dataKey])){var u=Lh(r,"value",a[t.dataKey]);if(u)return u.coordinate+n/2}return r[i]?r[i].coordinate+n/2:null}var d=Zt(a,Qe(o)?t.dataKey:o);return Qe(d)?null:t.scale(d)}var sT=function(t){var r=t.axis,n=t.ticks,a=t.offset,i=t.bandSize,o=t.entry,u=t.index;if(r.type==="category")return n[u]?n[u].coordinate+a:null;var d=Zt(o,r.dataKey,r.domain[u]);return Qe(d)?null:r.scale(d)-i/2+a},$X=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]},BX=function(t,r){var n,a=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Bt(Bt({},t.type.defaultProps),t.props):t.props,i=a.stackId;if(er(i)){var o=r[i];if(o){var u=o.items.indexOf(t);return u>=0?o.stackedData[u]:null}}return null},FX=function(t){return t.reduce(function(r,n){return[ym(n.concat([r[0]]).filter(je)),vm(n.concat([r[1]]).filter(je))]},[1/0,-1/0])},XL=function(t,r,n){return Object.keys(t).reduce(function(a,i){var o=t[i],u=o.stackedData,d=u.reduce(function(c,h){var p=FX(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})},lT=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,cT=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,vw=function(t,r,n){if(He(t))return t(r,n);if(!Array.isArray(t))return r;var a=[];if(je(t[0]))a[0]=n?t[0]:Math.min(t[0],r[0]);else if(lT.test(t[0])){var i=+lT.exec(t[0])[1];a[0]=r[0]-i}else He(t[0])?a[0]=t[0](r[0]):a[0]=r[0];if(je(t[1]))a[1]=n?t[1]:Math.max(t[1],r[1]);else if(cT.test(t[1])){var o=+cT.exec(t[1])[1];a[1]=r[1]+o}else He(t[1])?a[1]=t[1](r[1]):a[1]=r[1];return a},up=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=tj(r,function(p){return p.coordinate}),o=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},XX=function(t,r,n,a,i){var o=t.width,u=t.height,d=t.startAngle,c=t.endAngle,h=Nr(t.cx,o,o/2),p=Nr(t.cy,u,u/2),m=QL(o,u,n),v=Nr(t.innerRadius,m,0),x=Nr(t.outerRadius,m,m*.8),y=Object.keys(r);return y.reduce(function(S,_){var N=r[_],O=N.domain,A=N.reversed,C;if(Qe(N.range))a==="angleAxis"?C=[d,c]:a==="radiusAxis"&&(C=[v,x]),A&&(C=[C[1],C[0]]);else{C=N.range;var E=C,T=UX(E,2);d=T[0],c=T[1]}var R=WL(N,i),L=R.realScaleType,z=R.scale;z.domain(O).range(C),GL(z);var F=KL(z,Ta(Ta({},N),{},{realScaleType:L})),B=Ta(Ta(Ta({},N),F),{},{range:C,radius:x,realScaleType:L,scale:z,cx:h,cy:p,innerRadius:v,outerRadius:x,startAngle:d,endAngle:c});return Ta(Ta({},S),{},JL({},_,B))},{})},YX=function(t,r){var n=t.x,a=t.y,i=r.x,o=r.y;return Math.sqrt(Math.pow(n-i,2)+Math.pow(a-o,2))},JX=function(t,r){var n=t.x,a=t.y,i=r.cx,o=r.cy,u=YX({x:n,y:a},{x:i,y:o});if(u<=0)return{radius:u};var d=(n-i)/u,c=Math.acos(d);return a>o&&(c=2*Math.PI-c),{radius:u,angle:KX(c),angleInRadian:c}},QX=function(t){var r=t.startAngle,n=t.endAngle,a=Math.floor(r/360),i=Math.floor(n/360),o=Math.min(a,i);return{startAngle:r-o*360,endAngle:n-o*360}},ZX=function(t,r){var n=r.startAngle,a=r.endAngle,i=Math.floor(n/360),o=Math.floor(a/360),u=Math.min(i,o);return t+u*360},hT=function(t,r){var n=t.x,a=t.y,i=JX({x:n,y:a},r),o=i.radius,u=i.angle,d=r.innerRadius,c=r.outerRadius;if(oc)return!1;if(o===0)return!0;var h=QX(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?Ta(Ta({},r),{},{radius:o,angle:ZX(v,r)}):null},ZL=function(t){return!b.isValidElement(t)&&!He(t)&&typeof t!="boolean"?t.className:""};function cu(e){"@babel/helpers - typeof";return cu=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},cu(e)}var eY=["offset"];function tY(e){return iY(e)||aY(e)||nY(e)||rY()}function rY(){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 nY(e,t){if(e){if(typeof e=="string")return yw(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 yw(e,t)}}function aY(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function iY(e){if(Array.isArray(e))return yw(e)}function yw(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 sY(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){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 Qt(e){for(var t=1;t=0?1:-1,O,A;a==="insideStart"?(O=v+N*o,A=y):a==="insideEnd"?(O=x-N*o,A=!y):a==="end"&&(O=x+N*o,A=y),A=_<=0?A:!A;var C=_t(c,h,S,O),E=_t(c,h,S,O+(A?1:-1)*359),T="M".concat(C.x,",").concat(C.y,` + A`).concat(S,",").concat(S,",0,1,").concat(A?0:1,`, + `).concat(E.x,",").concat(E.y),R=Qe(t.id)?yl("recharts-radial-line-"):t.id;return X.createElement("text",uu({},n,{dominantBaseline:"central",className:Ze("recharts-radial-bar-label",u)}),X.createElement("defs",null,X.createElement("path",{id:R,d:T})),X.createElement("textPath",{xlinkHref:"#".concat(R)},r))},pY=function(t){var r=t.viewBox,n=t.offset,a=t.position,i=r,o=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=_t(o,u,c+n,m),x=v.x,y=v.y;return{x,y,textAnchor:x>=o?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:o,y:u,textAnchor:"middle",verticalAnchor:"end"};var S=(d+c)/2,_=_t(o,u,S,m),N=_.x,O=_.y;return{x:N,y:O,textAnchor:"middle",verticalAnchor:"middle"}},mY=function(t){var r=t.viewBox,n=t.parentViewBox,a=t.offset,i=t.position,o=r,u=o.x,d=o.y,c=o.width,h=o.height,p=h>=0?1:-1,m=p*a,v=p>0?"end":"start",x=p>0?"start":"end",y=c>=0?1:-1,S=y*a,_=y>0?"end":"start",N=y>0?"start":"end";if(i==="top"){var O={x:u+c/2,y:d-p*a,textAnchor:"middle",verticalAnchor:v};return Qt(Qt({},O),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 Qt(Qt({},A),n?{height:Math.max(n.y+n.height-(d+h),0),width:c}:{})}if(i==="left"){var C={x:u-S,y:d+h/2,textAnchor:_,verticalAnchor:"middle"};return Qt(Qt({},C),n?{width:Math.max(C.x-n.x,0),height:h}:{})}if(i==="right"){var E={x:u+c+S,y:d+h/2,textAnchor:N,verticalAnchor:"middle"};return Qt(Qt({},E),n?{width:Math.max(n.x+n.width-E.x,0),height:h}:{})}var T=n?{width:c,height:h}:{};return i==="insideLeft"?Qt({x:u+S,y:d+h/2,textAnchor:N,verticalAnchor:"middle"},T):i==="insideRight"?Qt({x:u+c-S,y:d+h/2,textAnchor:_,verticalAnchor:"middle"},T):i==="insideTop"?Qt({x:u+c/2,y:d+m,textAnchor:"middle",verticalAnchor:x},T):i==="insideBottom"?Qt({x:u+c/2,y:d+h-m,textAnchor:"middle",verticalAnchor:v},T):i==="insideTopLeft"?Qt({x:u+S,y:d+m,textAnchor:N,verticalAnchor:x},T):i==="insideTopRight"?Qt({x:u+c-S,y:d+m,textAnchor:_,verticalAnchor:x},T):i==="insideBottomLeft"?Qt({x:u+S,y:d+h-m,textAnchor:N,verticalAnchor:v},T):i==="insideBottomRight"?Qt({x:u+c-S,y:d+h-m,textAnchor:_,verticalAnchor:v},T):vl(i)&&(je(i.x)||oo(i.x))&&(je(i.y)||oo(i.y))?Qt({x:u+Nr(i.x,c),y:d+Nr(i.y,h),textAnchor:"end",verticalAnchor:"end"},T):Qt({x:u+c/2,y:d+h/2,textAnchor:"middle",verticalAnchor:"middle"},T)},gY=function(t){return"cx"in t&&je(t.cx)};function or(e){var t=e.offset,r=t===void 0?5:t,n=oY(e,eY),a=Qt({offset:r},n),i=a.viewBox,o=a.position,u=a.value,d=a.children,c=a.content,h=a.className,p=h===void 0?"":h,m=a.textBreakAll;if(!i||Qe(u)&&Qe(d)&&!b.isValidElement(c)&&!He(c))return null;if(b.isValidElement(c))return b.cloneElement(c,a);var v;if(He(c)){if(v=b.createElement(c,a),b.isValidElement(v))return v}else v=dY(a);var x=gY(i),y=Fe(a,!0);if(x&&(o==="insideStart"||o==="insideEnd"||o==="end"))return hY(a,v,y);var S=x?pY(a):mY(a);return X.createElement(go,uu({className:Ze("recharts-label",p)},y,S,{breakAll:m}),v)}or.displayName="Label";var e$=function(t){var r=t.cx,n=t.cy,a=t.angle,i=t.startAngle,o=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,S=t.height,_=t.clockWise,N=t.labelViewBox;if(N)return N;if(je(y)&&je(S)){if(je(p)&&je(m))return{x:p,y:m,width:y,height:S};if(je(v)&&je(x))return{x:v,y:x,width:y,height:S}}return je(p)&&je(m)?{x:p,y:m,width:0,height:0}:je(r)&&je(n)?{cx:r,cy:n,startAngle:i||a||0,endAngle:o||a||0,innerRadius:c||0,outerRadius:h||d||u||0,clockWise:_}:t.viewBox?t.viewBox:{}},vY=function(t,r){return t?t===!0?X.createElement(or,{key:"label-implicit",viewBox:r}):er(t)?X.createElement(or,{key:"label-implicit",viewBox:r,value:t}):b.isValidElement(t)?t.type===or?b.cloneElement(t,{key:"label-implicit",viewBox:r}):X.createElement(or,{key:"label-implicit",content:t,viewBox:r}):He(t)?X.createElement(or,{key:"label-implicit",content:t,viewBox:r}):vl(t)?X.createElement(or,uu({viewBox:r},t,{key:"label-implicit"})):null:null},yY=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=e$(t),o=tn(a,or).map(function(d,c){return b.cloneElement(d,{viewBox:r||i,key:"label-".concat(c)})});if(!n)return o;var u=vY(t.label,r||i);return[u].concat(tY(o))};or.parseViewBox=e$;or.renderCallByParent=yY;var Db,mT;function xY(){if(mT)return Db;mT=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return Db=e,Db}var bY=xY();const wY=ct(bY);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)}var SY=["valueAccessor"],jY=["data","dataKey","clockWise","id","textBreakAll"];function _Y(e){return EY(e)||OY(e)||CY(e)||NY()}function NY(){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 CY(e,t){if(e){if(typeof e=="string")return xw(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 xw(e,t)}}function OY(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function EY(e){if(Array.isArray(e))return xw(e)}function xw(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 kY(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 RY=function(t){return Array.isArray(t.value)?wY(t.value):t.value};function La(e){var t=e.valueAccessor,r=t===void 0?RY:t,n=yT(e,SY),a=n.data,i=n.dataKey,o=n.clockWise,u=n.id,d=n.textBreakAll,c=yT(n,jY);return!a||!a.length?null:X.createElement(st,{className:"recharts-label-list"},a.map(function(h,p){var m=Qe(i)?r(h,p):Zt(h&&h.payload,i),v=Qe(u)?{}:{id:"".concat(u,"-").concat(p)};return X.createElement(or,fp({},Fe(h,!0),c,v,{parentViewBox:h.parentViewBox,value:m,textBreakAll:d,viewBox:or.parseViewBox(Qe(o)?h:vT(vT({},h),{},{clockWise:o})),key:"label-".concat(p),index:p}))}))}La.displayName="LabelList";function IY(e,t){return e?e===!0?X.createElement(La,{key:"labelList-implicit",data:t}):X.isValidElement(e)||He(e)?X.createElement(La,{key:"labelList-implicit",data:t,content:e}):vl(e)?X.createElement(La,fp({data:t},e,{key:"labelList-implicit"})):null:null}function MY(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=tn(n,La).map(function(o,u){return b.cloneElement(o,{data:t,key:"labelList-".concat(u)})});if(!r)return a;var i=IY(e.label,t);return[i].concat(_Y(a))}La.renderCallByParent=MY;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 bw(){return bw=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(o>c),`, + `).concat(p.x,",").concat(p.y,` + `);if(a>0){var v=_t(r,n,a,o),x=_t(r,n,a,c);m+="L ".concat(x.x,",").concat(x.y,` + A `).concat(a,",").concat(a,`,0, + `).concat(+(Math.abs(d)>180),",").concat(+(o<=c),`, + `).concat(v.x,",").concat(v.y," Z")}else m+="L ".concat(r,",").concat(n," Z");return m},FY=function(t){var r=t.cx,n=t.cy,a=t.innerRadius,i=t.outerRadius,o=t.cornerRadius,u=t.forceCornerRadius,d=t.cornerIsExternal,c=t.startAngle,h=t.endAngle,p=_r(h-c),m=kf({cx:r,cy:n,radius:i,angle:c,sign:p,cornerRadius:o,cornerIsExternal:d}),v=m.circleTangency,x=m.lineTangency,y=m.theta,S=kf({cx:r,cy:n,radius:i,angle:h,sign:-p,cornerRadius:o,cornerIsExternal:d}),_=S.circleTangency,N=S.lineTangency,O=S.theta,A=d?Math.abs(c-h):Math.abs(c-h)-y-O;if(A<0)return u?"M ".concat(x.x,",").concat(x.y,` + a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0 + a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0 + `):t$({cx:r,cy:n,innerRadius:a,outerRadius:i,startAngle:c,endAngle:h});var C="M ".concat(x.x,",").concat(x.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(p<0),",").concat(v.x,",").concat(v.y,` + A`).concat(i,",").concat(i,",0,").concat(+(A>180),",").concat(+(p<0),",").concat(_.x,",").concat(_.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(p<0),",").concat(N.x,",").concat(N.y,` + `);if(a>0){var E=kf({cx:r,cy:n,radius:a,angle:c,sign:p,isExternal:!0,cornerRadius:o,cornerIsExternal:d}),T=E.circleTangency,R=E.lineTangency,L=E.theta,z=kf({cx:r,cy:n,radius:a,angle:h,sign:-p,isExternal:!0,cornerRadius:o,cornerIsExternal:d}),F=z.circleTangency,B=z.lineTangency,q=z.theta,H=d?Math.abs(c-h):Math.abs(c-h)-L-q;if(H<0&&o===0)return"".concat(C,"L").concat(r,",").concat(n,"Z");C+="L".concat(B.x,",").concat(B.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(p<0),",").concat(F.x,",").concat(F.y,` + A`).concat(a,",").concat(a,",0,").concat(+(H>180),",").concat(+(p>0),",").concat(T.x,",").concat(T.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(p<0),",").concat(R.x,",").concat(R.y,"Z")}else C+="L".concat(r,",").concat(n,"Z");return C},zY={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},r$=function(t){var r=bT(bT({},zY),t),n=r.cx,a=r.cy,i=r.innerRadius,o=r.outerRadius,u=r.cornerRadius,d=r.forceCornerRadius,c=r.cornerIsExternal,h=r.startAngle,p=r.endAngle,m=r.className;if(o0&&Math.abs(h-p)<360?S=FY({cx:n,cy:a,innerRadius:i,outerRadius:o,cornerRadius:Math.min(y,x/2),forceCornerRadius:d,cornerIsExternal:c,startAngle:h,endAngle:p}):S=t$({cx:n,cy:a,innerRadius:i,outerRadius:o,startAngle:h,endAngle:p}),X.createElement("path",bw({},Fe(r,!0),{className:v,d:S,role:"img"}))};function hu(e){"@babel/helpers - typeof";return hu=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},hu(e)}function ww(){return ww=Object.assign?Object.assign.bind():function(e){for(var t=1;tZY.call(e,t));function Ro(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const rJ="__v",nJ="__o",aJ="_owner",{getOwnPropertyDescriptor:ET,keys:PT}=Object;function iJ(e,t){return e.byteLength===t.byteLength&&pp(new Uint8Array(e),new Uint8Array(t))}function oJ(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 sJ(e,t){return e.byteLength===t.byteLength&&pp(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function lJ(e,t){return Ro(e.getTime(),t.getTime())}function cJ(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function uJ(e,t){return e===t}function AT(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 o,u,d=0;for(;(o=i.next())&&!o.done;){const c=t.entries();let h=!1,p=0;for(;(u=c.next())&&!u.done;){if(a[p]){p++;continue}const m=o.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 dJ=Ro;function fJ(e,t,r){const n=PT(e);let a=n.length;if(PT(t).length!==a)return!1;for(;a-- >0;)if(!n$(e,t,r,n[a]))return!1;return!0}function jc(e,t,r){const n=OT(e);let a=n.length;if(OT(t).length!==a)return!1;let i,o,u;for(;a-- >0;)if(i=n[a],!n$(e,t,r,i)||(o=ET(e,i),u=ET(t,i),(o||u)&&(!o||!u||o.configurable!==u.configurable||o.enumerable!==u.enumerable||o.writable!==u.writable)))return!1;return!0}function hJ(e,t){return Ro(e.valueOf(),t.valueOf())}function pJ(e,t){return e.source===t.source&&e.flags===t.flags}function TT(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 o,u;for(;(o=i.next())&&!o.done;){const d=t.values();let c=!1,h=0;for(;(u=d.next())&&!u.done;){if(!a[h]&&r.equals(o.value,u.value,o.value,u.value,e,t,r)){c=a[h]=!0;break}h++}if(!c)return!1}return!0}function pp(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 mJ(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 n$(e,t,r,n){return(n===aJ||n===nJ||n===rJ)&&(e.$$typeof||t.$$typeof)?!0:tJ(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}const gJ="[object ArrayBuffer]",vJ="[object Arguments]",yJ="[object Boolean]",xJ="[object DataView]",bJ="[object Date]",wJ="[object Error]",SJ="[object Map]",jJ="[object Number]",_J="[object Object]",NJ="[object RegExp]",CJ="[object Set]",OJ="[object String]",EJ={"[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},PJ="[object URL]",AJ=Object.prototype.toString;function TJ({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:u,areObjectsEqual:d,arePrimitiveWrappersEqual:c,areRegExpsEqual:h,areSetsEqual:p,areTypedArraysEqual:m,areUrlsEqual:v,unknownTagComparators:x}){return function(S,_,N){if(S===_)return!0;if(S==null||_==null)return!1;const O=typeof S;if(O!==typeof _)return!1;if(O!=="object")return O==="number"?u(S,_,N):O==="function"?i(S,_,N):!1;const A=S.constructor;if(A!==_.constructor)return!1;if(A===Object)return d(S,_,N);if(Array.isArray(S))return t(S,_,N);if(A===Date)return n(S,_,N);if(A===RegExp)return h(S,_,N);if(A===Map)return o(S,_,N);if(A===Set)return p(S,_,N);const C=AJ.call(S);if(C===bJ)return n(S,_,N);if(C===NJ)return h(S,_,N);if(C===SJ)return o(S,_,N);if(C===CJ)return p(S,_,N);if(C===_J)return typeof S.then!="function"&&typeof _.then!="function"&&d(S,_,N);if(C===PJ)return v(S,_,N);if(C===wJ)return a(S,_,N);if(C===vJ)return d(S,_,N);if(EJ[C])return m(S,_,N);if(C===gJ)return e(S,_,N);if(C===xJ)return r(S,_,N);if(C===yJ||C===jJ||C===OJ)return c(S,_,N);if(x){let E=x[C];if(!E){const T=eJ(S);T&&(E=x[T])}if(E)return E(S,_,N)}return!1}}function kJ({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:iJ,areArraysEqual:r?jc:oJ,areDataViewsEqual:sJ,areDatesEqual:lJ,areErrorsEqual:cJ,areFunctionsEqual:uJ,areMapsEqual:r?Fb(AT,jc):AT,areNumbersEqual:dJ,areObjectsEqual:r?jc:fJ,arePrimitiveWrappersEqual:hJ,areRegExpsEqual:pJ,areSetsEqual:r?Fb(TT,jc):TT,areTypedArraysEqual:r?Fb(pp,jc):pp,areUrlsEqual:mJ,unknownTagComparators:void 0};if(t&&(n=Object.assign({},n,t(n))),e){const a=If(n.areArraysEqual),i=If(n.areMapsEqual),o=If(n.areObjectsEqual),u=If(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:u})}return n}function RJ(e){return function(t,r,n,a,i,o,u){return e(t,r,u)}}function IJ({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 MJ=ki();ki({strict:!0});ki({circular:!0});ki({circular:!0,strict:!0});ki({createInternalComparator:()=>Ro});ki({strict:!0,createInternalComparator:()=>Ro});ki({circular:!0,createInternalComparator:()=>Ro});ki({circular:!0,createInternalComparator:()=>Ro,strict:!0});function ki(e={}){const{circular:t=!1,createInternalComparator:r,createState:n,strict:a=!1}=e,i=kJ(e),o=TJ(i),u=r?r(o):RJ(o);return IJ({circular:t,comparator:o,createState:n,equals:u,strict:a})}function DJ(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):DJ(a)};requestAnimationFrame(n)}function Sw(e){"@babel/helpers - typeof";return Sw=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},Sw(e)}function LJ(e){return zJ(e)||FJ(e)||BJ(e)||$J()}function $J(){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 BJ(e,t){if(e){if(typeof e=="string")return RT(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 RT(e,t)}}function RT(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:_<0?0:_},y=function(_){for(var N=_>1?1:_,O=N,A=0;A<8;++A){var C=p(O)-N,E=v(O);if(Math.abs(C-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,o=t.dt,u=o===void 0?17:o,d=function(h,p,m){var v=-(h-p)*n,x=m*i,y=m+(v-x)*u/1e3,S=m*u/1e3+h;return Math.abs(S-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 yQ(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 zb(e){return SQ(e)||wQ(e)||bQ(e)||xQ()}function xQ(){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 bQ(e,t){if(e){if(typeof e=="string")return Ow(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 Ow(e,t)}}function wQ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function SQ(e){if(Array.isArray(e))return Ow(e)}function Ow(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 vp(e){return vp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},vp(e)}var la=(function(e){OQ(r,e);var t=EQ(r);function r(n,a){var i;jQ(this,r),i=t.call(this,n,a);var o=i.props,u=o.isActive,d=o.attributeName,c=o.from,h=o.to,p=o.steps,m=o.children,v=o.duration;if(i.handleStyleChange=i.handleStyleChange.bind(Aw(i)),i.changeStyle=i.changeStyle.bind(Aw(i)),!u||v<=0)return i.state={style:{}},typeof m=="function"&&(i.state={style:h}),Pw(i);if(p&&p.length)i.state={style:p[0].style};else if(c){if(typeof m=="function")return i.state={style:c},Pw(i);i.state={style:d?Ic({},d,c):c}}else i.state={style:{}};return i}return NQ(r,[{key:"componentDidMount",value:function(){var a=this.props,i=a.isActive,o=a.canBegin;this.mounted=!0,!(!i||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(a){var i=this.props,o=i.isActive,u=i.canBegin,d=i.attributeName,c=i.shouldReAnimate,h=i.to,p=i.from,m=this.state.style;if(u){if(!o){var v={style:d?Ic({},d,h):h};this.state&&m&&(d&&m[d]!==h||!d&&m!==h)&&this.setState(v);return}if(!(MJ(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 S={style:d?Ic({},d,y):y};(d&&m[d]!==y||!d&&m!==y)&&this.setState(S)}this.runAnimation(Rn(Rn({},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,o=a.from,u=a.to,d=a.duration,c=a.easing,h=a.begin,p=a.onAnimationEnd,m=a.onAnimationStart,v=mQ(o,u,aQ(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,o=a.steps,u=a.begin,d=a.onAnimationStart,c=o[0],h=c.style,p=c.duration,m=p===void 0?0:p,v=function(y,S,_){if(_===0)return y;var N=S.duration,O=S.easing,A=O===void 0?"ease":O,C=S.style,E=S.properties,T=S.onAnimationEnd,R=_>0?o[_-1]:S,L=E||Object.keys(C);if(typeof A=="function"||A==="spring")return[].concat(zb(y),[i.runJSAnimation.bind(i,{from:R.style,to:C,duration:N,easing:A}),N]);var z=DT(L,N,A),F=Rn(Rn(Rn({},R.style),C),{},{transition:z});return[].concat(zb(y),[F,N,T]).filter(WJ)};return this.manager.start([d].concat(zb(o.reduce(v,[h,Math.max(m,u)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=qJ());var i=a.begin,o=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?Ic({},u,d):d,S=DT(Object.keys(y),o,c);x.start([h,i,Rn(Rn({},y),{},{transition:S}),o,p])}},{key:"render",value:function(){var a=this.props,i=a.children;a.begin;var o=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=vQ(a,gQ),c=b.Children.count(i),h=this.state.style;if(typeof i=="function")return i(h);if(!u||c===0||o<=0)return i;var p=function(v){var x=v.props,y=x.style,S=y===void 0?{}:y,_=x.className,N=b.cloneElement(v,Rn(Rn({},d),{},{style:Rn(Rn({},S),h),className:_}));return N};return c===1?p(b.Children.only(i)):X.createElement("div",null,b.Children.map(i,function(m){return p(m)}))}}]),r})(b.PureComponent);la.displayName="Animate";la.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};la.propTypes={from:dt.oneOfType([dt.object,dt.string]),to:dt.oneOfType([dt.object,dt.string]),attributeName:dt.string,duration:dt.number,begin:dt.number,easing:dt.oneOfType([dt.string,dt.func]),steps:dt.arrayOf(dt.shape({duration:dt.number.isRequired,style:dt.object.isRequired,easing:dt.oneOfType([dt.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),dt.func]),properties:dt.arrayOf("string"),onAnimationEnd:dt.func})),children:dt.oneOfType([dt.node,dt.func]),isActive:dt.bool,canBegin:dt.bool,onAnimationEnd:dt.func,shouldReAnimate:dt.bool,onAnimationStart:dt.func,onAnimationReStart:dt.func};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 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);r=0?1:-1,d=n>=0?1:-1,c=a>=0&&n>=0||a<0&&n<0?1:0,h;if(o>0&&i instanceof Array){for(var p=[0,0,0,0],m=0,v=4;mo?o: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(o>0&&i===+i&&i>0){var x=Math.min(o,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},$Q=function(t,r){if(!t||!r)return!1;var n=t.x,a=t.y,i=r.x,o=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(o,o+d),m=Math.max(o,o+d);return n>=c&&n<=h&&a>=p&&a<=m}return!1},BQ={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Ej=function(t){var r=VT(VT({},BQ),t),n=b.useRef(),a=b.useState(-1),i=AQ(a,2),o=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,S=r.animationBegin,_=r.isAnimationActive,N=r.isUpdateAnimationActive;if(d!==+d||c!==+c||h!==+h||p!==+p||h===0||p===0)return null;var O=Ze("recharts-rectangle",v);return N?X.createElement(la,{canBegin:o>0,from:{width:h,height:p,x:d,y:c},to:{width:h,height:p,x:d,y:c},duration:y,animationEasing:x,isActive:N},function(A){var C=A.width,E=A.height,T=A.x,R=A.y;return X.createElement(la,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:S,duration:y,isActive:_,easing:x},X.createElement("path",yp({},Fe(r,!0),{className:O,d:HT(T,R,C,E,m),ref:n})))}):X.createElement("path",yp({},Fe(r,!0),{className:O,d:HT(d,c,h,p,m)}))},FQ=["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 qQ(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 WT(e){return WQ(e)||HQ(e)||VQ(e)||UQ()}function UQ(){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 VQ(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 HQ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function WQ(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);r0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(n){GT(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),GT(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},Fc=function(t,r){var n=GQ(t);r&&(n=[n.reduce(function(i,o){return[].concat(WT(i),WT(o))},[])]);var a=n.map(function(i){return i.reduce(function(o,u,d){return"".concat(o).concat(d===0?"M":"L").concat(u.x,",").concat(u.y)},"")}).join("");return n.length===1?"".concat(a,"Z"):a},KQ=function(t,r,n){var a=Fc(t,n);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(Fc(r.reverse(),n).slice(1))},XQ=function(t){var r=t.points,n=t.className,a=t.baseLinePoints,i=t.connectNulls,o=zQ(t,FQ);if(!r||!r.length)return null;var u=Ze("recharts-polygon",n);if(a&&a.length){var d=o.stroke&&o.stroke!=="none",c=KQ(r,a,i);return X.createElement("g",{className:u},X.createElement("path",js({},Fe(o,!0),{fill:c.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:c})),d?X.createElement("path",js({},Fe(o,!0),{fill:"none",d:Fc(r,i)})):null,d?X.createElement("path",js({},Fe(o,!0),{fill:"none",d:Fc(a,i)})):null)}var h=Fc(r,i);return X.createElement("path",js({},Fe(o,!0),{fill:h.slice(-1)==="Z"?o.fill:"none",className:u,d:h}))};function kw(){return kw=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 rZ(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 nZ=function(t,r,n,a,i,o){return"M".concat(t,",").concat(i,"v").concat(a,"M").concat(o,",").concat(r,"h").concat(n)},aZ=function(t){var r=t.x,n=r===void 0?0:r,a=t.y,i=a===void 0?0:a,o=t.top,u=o===void 0?0:o,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=tZ(t,YQ),S=JQ({x:n,y:i,top:u,left:c,width:p,height:v},y);return!je(n)||!je(i)||!je(p)||!je(v)||!je(u)||!je(c)?null:X.createElement("path",Rw({},Fe(S,!0),{className:Ze("recharts-cross",x),d:nZ(n,i,p,v,u,c)}))},qb,XT;function iZ(){if(XT)return qb;XT=1;var e=gm(),t=_L(),r=ha();function n(a,i){return a&&a.length?e(a,r(i,2),t):void 0}return qb=n,qb}var oZ=iZ();const sZ=ct(oZ);var Ub,YT;function lZ(){if(YT)return Ub;YT=1;var e=gm(),t=ha(),r=NL();function n(a,i){return a&&a.length?e(a,t(i,2),r):void 0}return Ub=n,Ub}var cZ=lZ();const uZ=ct(cZ);var dZ=["cx","cy","angle","ticks","axisLine"],fZ=["ticks","tick","angle","tickFormatter","stroke"];function Xs(e){"@babel/helpers - typeof";return Xs=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},Xs(e)}function zc(){return zc=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 hZ(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 pZ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ZT(e,t){for(var r=0;rrk?o=a==="outer"?"start":"end":i<-rk?o=a==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var n=this.props,a=n.cx,i=n.cy,o=n.radius,u=n.axisLine,d=n.axisLineType,c=eo(eo({},Fe(this.props,!1)),{},{fill:"none"},Fe(u,!1));if(d==="circle")return X.createElement(wm,io({className:"recharts-polar-angle-axis-line"},c,{cx:a,cy:i,r:o}));var h=this.props.ticks,p=h.map(function(m){return _t(a,i,o,m.coordinate)});return X.createElement(XQ,io({className:"recharts-polar-angle-axis-line"},c,{points:p}))}},{key:"renderTicks",value:function(){var n=this,a=this.props,i=a.ticks,o=a.tick,u=a.tickLine,d=a.tickFormatter,c=a.stroke,h=Fe(this.props,!1),p=Fe(o,!1),m=eo(eo({},h),{},{fill:"none"},Fe(u,!1)),v=i.map(function(x,y){var S=n.getTickLineCoord(x),_=n.getTickTextAnchor(x),N=eo(eo(eo({textAnchor:_},h),{},{stroke:"none",fill:c},p),{},{index:y,payload:x,x:S.x2,y:S.y2});return X.createElement(st,io({className:Ze("recharts-polar-angle-axis-tick",ZL(o)),key:"tick-".concat(x.coordinate)},mo(n.props,x,y)),u&&X.createElement("line",io({className:"recharts-polar-angle-axis-tick-line"},m,S)),o&&t.renderTickItem(o,N,d?d(x.value,y):x.value))});return X.createElement(st,{className:"recharts-polar-angle-axis-ticks"},v)}},{key:"render",value:function(){var n=this.props,a=n.ticks,i=n.radius,o=n.axisLine;return i<=0||!a||!a.length?null:X.createElement(st,{className:Ze("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,a,i){var o;return X.isValidElement(n)?o=X.cloneElement(n,a):He(n)?o=n(a):o=X.createElement(go,io({},a,{className:"recharts-polar-angle-axis-tick-value"}),i),o}}])})(b.PureComponent);_m(Nm,"displayName","PolarAngleAxis");_m(Nm,"axisType","angleAxis");_m(Nm,"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 Vb,nk;function PZ(){if(nk)return Vb;nk=1;var e=_D(),t=e(Object.getPrototypeOf,Object);return Vb=t,Vb}var Hb,ak;function AZ(){if(ak)return Hb;ak=1;var e=Va(),t=PZ(),r=Ha(),n="[object Object]",a=Function.prototype,i=Object.prototype,o=a.toString,u=i.hasOwnProperty,d=o.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&&o.call(m)==d}return Hb=c,Hb}var TZ=AZ();const kZ=ct(TZ);var Wb,ik;function RZ(){if(ik)return Wb;ik=1;var e=Va(),t=Ha(),r="[object Boolean]";function n(a){return a===!0||a===!1||t(a)&&e(a)==r}return Wb=n,Wb}var IZ=RZ();const MZ=ct(IZ);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 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);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:_},function(O){var A=O.upperWidth,C=O.lowerWidth,E=O.height,T=O.x,R=O.y;return X.createElement(la,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:S,duration:y,easing:x},X.createElement("path",wp({},Fe(r,!0),{className:N,d:ck(T,R,A,C,E),ref:n})))}):X.createElement("g",null,X.createElement("path",wp({},Fe(r,!0),{className:N,d:ck(d,c,h,p,m)})))},WZ=["option","shapeType","propTransformer","activeClassName","isActive"];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 GZ(e,t){if(e==null)return{};var r=KZ(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 KZ(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 uk(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 Sp(e){for(var t=1;t0?en(O,"paddingAngle",0):0;if(C){var T=Jr(C.endAngle-C.startAngle,O.endAngle-O.startAngle),R=St(St({},O),{},{startAngle:N+E,endAngle:N+T(y)+E});S.push(R),N=R.endAngle}else{var L=O.endAngle,z=O.startAngle,F=Jr(0,L-z),B=F(y),q=St(St({},O),{},{startAngle:N+E,endAngle:N+B+E});S.push(q),N=q.endAngle}}),X.createElement(st,null,n.renderSectorsStatically(S))})}},{key:"attachKeyboardHandlers",value:function(n){var a=this;n.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var o=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[o].focus(),a.setState({sectorToFocus:o});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,o=this.state.prevSectors;return i&&a&&a.length&&(!o||!Fu(o,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,o=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||!o||!o.length||!je(c)||!je(h)||!je(p)||!je(m))return null;var y=Ze("recharts-pie",u);return X.createElement(st,{tabIndex:this.props.rootTabIndex,className:y,ref:function(_){n.pieRef=_}},this.renderSectors(),d&&this.renderLabels(o),or.renderCallByParent(this.props,null,!1),(!v||x)&&La.renderCallByParent(this.props,o,!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=S-N*v-O,C=a.reduce(function(R,L){var z=Zt(L,_,0);return R+(je(z)?z:0)},0),E;if(C>0){var T;E=a.map(function(R,L){var z=Zt(R,_,0),F=Zt(R,h,L),B=(je(z)?z:0)/C,q;L?q=T.endAngle+_r(y)*d*(z!==0?1:0):q=o;var H=q+_r(y)*((z!==0?v:0)+B*A),V=(q+H)/2,G=(x.innerRadius+x.outerRadius)/2,U=[{name:F,value:z,payload:R,dataKey:_,type:m}],$=_t(x.cx,x.cy,G,V);return T=St(St(St({percent:B,cornerRadius:i,name:F,tooltipPayload:U,midAngle:V,middleRadius:G,tooltipPosition:$},R),x),{},{value:Zt(R,_),startAngle:q,endAngle:H,payload:R,paddingAngle:_r(y)*d}),T})}return St(St({},x),{},{sectors:E,data:a})});var Gb,pk;function mee(){if(pk)return Gb;pk=1;var e=Math.ceil,t=Math.max;function r(n,a,i,o){for(var u=-1,d=t(e((a-n)/(i||1)),0),c=Array(d);d--;)c[o?d:++u]=n,n+=i;return c}return Gb=r,Gb}var Kb,mk;function v$(){if(mk)return Kb;mk=1;var e=FD(),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 Kb=n,Kb}var Xb,gk;function gee(){if(gk)return Xb;gk=1;var e=mee(),t=lm(),r=v$();function n(a){return function(i,o,u){return u&&typeof u!="number"&&t(i,o,u)&&(o=u=void 0),i=r(i),o===void 0?(o=i,i=0):o=r(o),u=u===void 0?i0&&n.handleDrag(a.changedTouches[0])}),Gr(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=n.props,i=a.endIndex,o=a.onDragEnd,u=a.startIndex;o?.({endIndex:i,startIndex:u})}),n.detachDragEndListener()}),Gr(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),Gr(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),Gr(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),Gr(n,"handleSlideDragStart",function(a){var i=Sk(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 Eee(t,e),_ee(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,o=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(o,p),x=t.getIndexInRange(o,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,o=a.tickFormatter,u=a.dataKey,d=Zt(i[n],u,n);return He(o)?o(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,o=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-o):y<0&&(y=Math.max(y,c-o,c-u));var S=this.getIndex({startX:o+y,endX:u+y});(S.startIndex!==m||S.endIndex!==v)&&x&&x(S),this.setState({startX:o+y,endX:u+y,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,a){var i=Sk(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,o=a.movingTravellerId,u=a.endX,d=a.startX,c=this.state[o],h=this.props,p=h.x,m=h.width,v=h.travellerWidth,x=h.onChange,y=h.gap,S=h.data,_={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)),_[o]=c+N;var O=this.getIndex(_),A=O.startIndex,C=O.endIndex,E=function(){var R=S.length-1;return o==="startX"&&(u>d?A%y===0:C%y===0)||ud?C%y===0:A%y===0)||u>d&&C===R};this.setState(Gr(Gr({},o,c+N),"brushMoveStartX",n.pageX),function(){x&&E()&&x(O)})}},{key:"handleTravellerMoveKeyboard",value:function(n,a){var i=this,o=this.state,u=o.scaleValues,d=o.startX,c=o.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(Gr({},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,o=n.width,u=n.height,d=n.fill,c=n.stroke;return X.createElement("rect",{stroke:c,fill:d,x:a,y:i,width:o,height:u})}},{key:"renderPanorama",value:function(){var n=this.props,a=n.x,i=n.y,o=n.width,u=n.height,d=n.data,c=n.children,h=n.padding,p=b.Children.only(c);return p?X.cloneElement(p,{x:a,y:i,width:o,height:u,margin:h,compact:!0,data:d}):null}},{key:"renderTravellerLayer",value:function(n,a){var i,o,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,S=d.endIndex,_=Math.max(n,this.props.x),N=Jb(Jb({},Fe(this.props,!1)),{},{x:_,y:c,width:h,height:p}),O=v||"Min value: ".concat((i=x[y])===null||i===void 0?void 0:i.name,", Max value: ").concat((o=x[S])===null||o===void 0?void 0:o.name);return X.createElement(st,{tabIndex:0,role:"slider","aria-label":O,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(C){["ArrowLeft","ArrowRight"].includes(C.key)&&(C.preventDefault(),C.stopPropagation(),u.handleTravellerMoveKeyboard(C.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,o=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 X.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:o,width:p,height:u})}},{key:"renderText",value:function(){var n=this.props,a=n.startIndex,i=n.endIndex,o=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 X.createElement(st,{className:"recharts-brush-texts"},X.createElement(go,Np({textAnchor:"end",verticalAnchor:"middle",x:Math.min(p,m)-v,y:o+u/2},x),this.getTextOfTick(a)),X.createElement(go,Np({textAnchor:"start",verticalAnchor:"middle",x:Math.max(p,m)+d+v,y:o+u/2},x),this.getTextOfTick(i)))}},{key:"render",value:function(){var n=this.props,a=n.data,i=n.className,o=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,S=m.isSlideMoving,_=m.isTravellerMoving,N=m.isTravellerFocused;if(!a||!a.length||!je(u)||!je(d)||!je(c)||!je(h)||c<=0||h<=0)return null;var O=Ze("recharts-brush",i),A=X.Children.count(o)===1,C=See("userSelect","none");return X.createElement(st,{className:O,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:C},this.renderBackground(),A&&this.renderPanorama(),this.renderSlide(v,x),this.renderTravellerLayer(v,"startX"),this.renderTravellerLayer(x,"endX"),(y||S||_||N||p)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var a=n.x,i=n.y,o=n.width,u=n.height,d=n.stroke,c=Math.floor(i+u/2)-1;return X.createElement(X.Fragment,null,X.createElement("rect",{x:a,y:i,width:o,height:u,fill:d,stroke:"none"}),X.createElement("line",{x1:a+1,y1:c,x2:a+o-1,y2:c,fill:"none",stroke:"#fff"}),X.createElement("line",{x1:a+1,y1:c+2,x2:a+o-1,y2:c+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,a){var i;return X.isValidElement(n)?i=X.cloneElement(n,a):He(n)?i=n(a):i=t.renderDefaultTraveller(a),i}},{key:"getDerivedStateFromProps",value:function(n,a){var i=n.data,o=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 Jb({prevData:i,prevTravellerWidth:d,prevUpdateId:c,prevX:u,prevWidth:o},i&&i.length?Aee({data:i,width:o,x:u,travellerWidth:d,startIndex:h,endIndex:p}):{scale:null,scaleValues:null});if(a.scale&&(o!==a.prevWidth||u!==a.prevX||d!==a.prevTravellerWidth)){a.scale.range([u,u+o-d]);var m=a.scale.domain().map(function(v){return a.scale(v)});return{prevData:i,prevTravellerWidth:d,prevUpdateId:c,prevX:u,prevWidth:o,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,o=0,u=i-1;u-o>1;){var d=Math.floor((o+u)/2);n[d]>a?u=d:o=d}return a>=n[u]?u:o}}])})(b.PureComponent);Gr(Zs,"displayName","Brush");Gr(Zs,"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 Qb,jk;function Tee(){if(jk)return Qb;jk=1;var e=ej();function t(r,n){var a;return e(r,function(i,o,u){return a=n(i,o,u),!a}),!!a}return Qb=t,Qb}var Zb,_k;function kee(){if(_k)return Zb;_k=1;var e=vD(),t=ha(),r=Tee(),n=$r(),a=lm();function i(o,u,d){var c=n(o)?e:r;return d&&a(o,u,d)&&(u=void 0),c(o,t(u,3))}return Zb=i,Zb}var Ree=kee();const Iee=ct(Ree);var ia=function(t,r){var n=t.alwaysShow,a=t.ifOverflow;return n&&(a="extendDomain"),a===r},e1,Nk;function Mee(){if(Nk)return e1;Nk=1;var e=MD();function t(r,n,a){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):r[n]=a}return e1=t,e1}var t1,Ck;function Dee(){if(Ck)return t1;Ck=1;var e=Mee(),t=RD(),r=ha();function n(a,i){var o={};return i=r(i,3),t(a,function(u,d,c){e(o,d,i(u,d,c))}),o}return t1=n,t1}var Lee=Dee();const $ee=ct(Lee);var r1,Ok;function Bee(){if(Ok)return r1;Ok=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 Kee(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){var r=e.x,n=e.y,a=Gee(e,Uee),i="".concat(r),o=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 _c(_c(_c(_c(_c({},t),a),o?{x:o}:{}),d?{y:d}:{}),{},{height:h,width:m,name:t.name,radius:t.radius})}function Tk(e){return X.createElement(p$,$w({shapeType:"rectangle",propTransformer:Xee,activeClassName:"recharts-active-bar"},e))}var Yee=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=je(n)||gU(n);return i?t(n,a):(i||yo(),r)}},Jee=["value","background"],S$;function el(e){"@babel/helpers - typeof";return el=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},el(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 Op(){return Op=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(V)0&&Math.abs(H)0&&(q=Math.min((ie||0)-(H[oe-1]||0),q))}),Number.isFinite(q)){var V=q/B,G=y.layout==="vertical"?n.height:n.width;if(y.padding==="gap"&&(T=V*G/2),y.padding==="no-gap"){var U=Nr(t.barCategoryGap,V*G),$=V*G/2;T=$-U-($-U)/G*U}}}a==="xAxis"?R=[n.left+(O.left||0)+(T||0),n.left+n.width-(O.right||0)-(T||0)]:a==="yAxis"?R=d==="horizontal"?[n.top+n.height-(O.bottom||0),n.top+(O.top||0)]:[n.top+(O.top||0)+(T||0),n.top+n.height-(O.bottom||0)-(T||0)]:R=y.range,C&&(R=[R[1],R[0]]);var Q=WL(y,i,m),k=Q.scale,I=Q.realScaleType;k.domain(_).range(R),GL(k);var D=KL(k,Bn(Bn({},y),{},{realScaleType:I}));a==="xAxis"?(F=S==="top"&&!A||S==="bottom"&&A,L=n.left,z=p[E]-F*y.height):a==="yAxis"&&(F=S==="left"&&!A||S==="right"&&A,L=p[E]-F*y.width,z=n.top);var Z=Bn(Bn(Bn({},y),D),{},{realScaleType:I,x:L,y:z,scale:k,width:a==="xAxis"?n.width:y.width,height:a==="yAxis"?n.height:y.height});return Z.bandSize=up(Z,D),!y.hide&&a==="xAxis"?p[E]+=(F?-1:1)*Z.height:y.hide||(p[E]+=(F?-1:1)*Z.width),Bn(Bn({},v),{},Em({},x,Z))},{})},O$=function(t,r){var n=t.x,a=t.y,i=r.x,o=r.y;return{x:Math.min(n,i),y:Math.min(a,o),width:Math.abs(i-n),height:Math.abs(o-a)}},ute=function(t){var r=t.x1,n=t.y1,a=t.x2,i=t.y2;return O$({x:r,y:n},{x:a,y:i})},E$=(function(){function e(t){ste(this,e),this.scale=t}return lte(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 o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}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)}}])})();Em(E$,"EPS",1e-4);var Pj=function(t){var r=Object.keys(t).reduce(function(n,a){return Bn(Bn({},n),{},Em({},a,E$.create(t[a])))},{});return Bn(Bn({},r),{},{apply:function(a){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.bandAware,u=i.position;return $ee(a,function(d,c){return r[c].apply(d,{bandAware:o,position:u})})},isInRange:function(a){return w$(a,function(i,o){return r[o].isInRange(i)})}})};function dte(e){return(e%180+180)%180}var fte=function(t){var r=t.width,n=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=dte(a),o=i*Math.PI/180,u=Math.atan(n/r),d=o>u&&o-1?d[c?i[h]:h]:void 0}}return i1=n,i1}var o1,Lk;function pte(){if(Lk)return o1;Lk=1;var e=v$();function t(r){var n=e(r),a=n%1;return n===n?a?n-a:n:0}return o1=t,o1}var s1,$k;function mte(){if($k)return s1;$k=1;var e=ED(),t=ha(),r=pte(),n=Math.max;function a(i,o,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(o,3),c)}return s1=a,s1}var l1,Bk;function gte(){if(Bk)return l1;Bk=1;var e=hte(),t=mte(),r=e(t);return l1=r,l1}var vte=gte();const yte=ct(vte);var xte=VM();const bte=ct(xte);var wte=bte(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("")}),Aj=b.createContext(void 0),Tj=b.createContext(void 0),P$=b.createContext(void 0),A$=b.createContext({}),T$=b.createContext(void 0),k$=b.createContext(0),R$=b.createContext(0),Fk=function(t){var r=t.state,n=r.xAxisMap,a=r.yAxisMap,i=r.offset,o=t.clipPathId,u=t.children,d=t.width,c=t.height,h=wte(i);return X.createElement(Aj.Provider,{value:n},X.createElement(Tj.Provider,{value:a},X.createElement(A$.Provider,{value:i},X.createElement(P$.Provider,{value:h},X.createElement(T$.Provider,{value:o},X.createElement(k$.Provider,{value:c},X.createElement(R$.Provider,{value:d},u)))))))},Ste=function(){return b.useContext(T$)},I$=function(t){var r=b.useContext(Aj);r==null&&yo();var n=r[t];return n==null&&yo(),n},jte=function(){var t=b.useContext(Aj);return vi(t)},_te=function(){var t=b.useContext(Tj),r=yte(t,function(n){return w$(n.domain,Number.isFinite)});return r||vi(t)},M$=function(t){var r=b.useContext(Tj);r==null&&yo();var n=r[t];return n==null&&yo(),n},Nte=function(){var t=b.useContext(P$);return t},Cte=function(){return b.useContext(A$)},kj=function(){return b.useContext(R$)},Rj=function(){return b.useContext(k$)};function tl(e){"@babel/helpers - typeof";return tl=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},tl(e)}function Ote(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ete(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 cre(e,t){return q$(e,t+1)}function ure(e,t,r,n,a){for(var i=(n||[]).slice(),o=t.start,u=t.end,d=0,c=1,h=o,p=function(){var x=n?.[d];if(x===void 0)return{v:q$(n,c)};var y=d,S,_=function(){return S===void 0&&(S=r(x,y)),S},N=x.coordinate,O=d===0||kp(e,N,_,h,u);O||(d=0,h=o,c+=1),O&&(h=N+e*(_()/2+a),d+=c)},m;c<=i.length;)if(m=p(),m)return m.v;return[]}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 Kk(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 vr(e){for(var t=1;t0?v.coordinate-S*e:v.coordinate})}else i[m]=v=vr(vr({},v),{},{tickCoord:v.coordinate});var _=kp(e,v.tickCoord,y,u,d);_&&(d=v.tickCoord-e*(y()/2+a),i[m]=vr(vr({},v),{},{isShow:!0}))},h=o-1;h>=0;h--)c(h);return i}function mre(e,t,r,n,a,i){var o=(n||[]).slice(),u=o.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);o[u-1]=h=vr(vr({},h),{},{tickCoord:m>0?h.coordinate-m*e:h.coordinate});var v=kp(e,h.tickCoord,function(){return p},d,c);v&&(c=h.tickCoord-e*(p/2+a),o[u-1]=vr(vr({},h),{},{isShow:!0}))}for(var x=i?u-1:u,y=function(N){var O=o[N],A,C=function(){return A===void 0&&(A=r(O,N)),A};if(N===0){var E=e*(O.coordinate-e*C()/2-d);o[N]=O=vr(vr({},O),{},{tickCoord:E<0?O.coordinate-E*e:O.coordinate})}else o[N]=O=vr(vr({},O),{},{tickCoord:O.coordinate});var T=kp(e,O.tickCoord,C,d,c);T&&(d=O.tickCoord+e*(C()/2+a),o[N]=vr(vr({},O),{},{isShow:!0}))},S=0;S=2?_r(a[1].coordinate-a[0].coordinate):1,_=lre(i,S,v);return d==="equidistantPreserveStart"?ure(S,_,y,a,o):(d==="preserveStart"||d==="preserveStartEnd"?m=mre(S,_,y,a,o,d==="preserveStartEnd"):m=pre(S,_,y,a,o),m.filter(function(N){return N.isShow}))}var gre=["viewBox"],vre=["viewBox"],yre=["ticks"];function al(e){"@babel/helpers - typeof";return al=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},al(e)}function Ns(){return Ns=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 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){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yk(e,t){for(var r=0;r0?d(this.props):d(v)),o<=0||u<=0||!x||!x.length?null:X.createElement(st,{className:Ze("recharts-cartesian-axis",c),ref:function(S){n.layerReference=S}},i&&this.renderAxisLine(),this.renderTicks(x,this.state.fontSize,this.state.letterSpacing),or.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,a,i){var o,u=Ze(a.className,"recharts-cartesian-axis-tick-value");return X.isValidElement(n)?o=X.cloneElement(n,Jt(Jt({},a),{},{className:u})):He(n)?o=n(Jt(Jt({},a),{},{className:u})):o=X.createElement(go,Ns({},a,{className:"recharts-cartesian-axis-tick-value"}),i),o}}])})(b.Component);Lj(jl,"displayName","CartesianAxis");Lj(jl,"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 Ore=["x1","y1","x2","y2","key"],Ere=["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 Jk(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 yr(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function kre(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 Rre=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,a=t.x,i=t.y,o=t.width,u=t.height,d=t.ry;return X.createElement("rect",{x:a,y:i,ry:d,width:o,height:u,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function H$(e,t){var r;if(X.isValidElement(e))r=X.cloneElement(e,t);else if(He(e))r=e(t);else{var n=t.x1,a=t.y1,i=t.x2,o=t.y2,u=t.key,d=Qk(t,Ore),c=Fe(d,!1);c.offset;var h=Qk(c,Ere);r=X.createElement("line",co({},h,{x1:n,y1:a,x2:i,y2:o,fill:"none",key:u}))}return r}function Ire(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 o=i.map(function(u,d){var c=yr(yr({},e),{},{x1:t,y1:u,x2:t+r,y2:u,key:"line-".concat(d),index:d});return H$(a,c)});return X.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function Mre(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 o=i.map(function(u,d){var c=yr(yr({},e),{},{x1:u,y1:t,x2:u,y2:t+r,key:"line-".concat(d),index:d});return H$(a,c)});return X.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function Dre(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,a=e.y,i=e.width,o=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+o-m:h[v+1]-m;if(y<=0)return null;var S=v%t.length;return X.createElement("rect",{key:"react-".concat(v),y:m,x:n,height:y,width:i,stroke:"none",fill:t[S],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return X.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},p)}function Lre(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,a=e.fillOpacity,i=e.x,o=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 S=v%n.length;return X.createElement("rect",{key:"react-".concat(v),x:m,y:o,width:y,height:d,stroke:"none",fill:n[S],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return X.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},p)}var $re=function(t,r){var n=t.xAxis,a=t.width,i=t.height,o=t.offset;return HL(Dj(yr(yr(yr({},jl.defaultProps),n),{},{ticks:Ia(n,!0),viewBox:{x:0,y:0,width:a,height:i}})),o.left,o.left+o.width,r)},Bre=function(t,r){var n=t.yAxis,a=t.width,i=t.height,o=t.offset;return HL(Dj(yr(yr(yr({},jl.defaultProps),n),{},{ticks:Ia(n,!0),viewBox:{x:0,y:0,width:a,height:i}})),o.top,o.top+o.height,r)},us={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Ip(e){var t,r,n,a,i,o,u=kj(),d=Rj(),c=Cte(),h=yr(yr({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:us.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:us.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:us.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:us.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:us.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:us.verticalFill,x:je(e.x)?e.x:c.left,y:je(e.y)?e.y:c.top,width:je(e.width)?e.width:c.width,height:je(e.height)?e.height:c.height}),p=h.x,m=h.y,v=h.width,x=h.height,y=h.syncWithTicks,S=h.horizontalValues,_=h.verticalValues,N=jte(),O=_te();if(!je(v)||v<=0||!je(x)||x<=0||!je(p)||p!==+p||!je(m)||m!==+m)return null;var A=h.verticalCoordinatesGenerator||$re,C=h.horizontalCoordinatesGenerator||Bre,E=h.horizontalPoints,T=h.verticalPoints;if((!E||!E.length)&&He(C)){var R=S&&S.length,L=C({yAxis:O?yr(yr({},O),{},{ticks:R?S:O.ticks}):void 0,width:u,height:d,offset:c},R?!0:y);Vn(Array.isArray(L),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(xo(L),"]")),Array.isArray(L)&&(E=L)}if((!T||!T.length)&&He(A)){var z=_&&_.length,F=A({xAxis:N?yr(yr({},N),{},{ticks:z?_:N.ticks}):void 0,width:u,height:d,offset:c},z?!0:y);Vn(Array.isArray(F),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(xo(F),"]")),Array.isArray(F)&&(T=F)}return X.createElement("g",{className:"recharts-cartesian-grid"},X.createElement(Rre,{fill:h.fill,fillOpacity:h.fillOpacity,x:h.x,y:h.y,width:h.width,height:h.height,ry:h.ry}),X.createElement(Ire,co({},h,{offset:c,horizontalPoints:E,xAxis:N,yAxis:O})),X.createElement(Mre,co({},h,{offset:c,verticalPoints:T,xAxis:N,yAxis:O})),X.createElement(Dre,co({},h,{horizontalPoints:E})),X.createElement(Lre,co({},h,{verticalPoints:T})))}Ip.displayName="CartesianGrid";var Fre=["type","layout","connectNulls","ref"],zre=["key"];function il(e){"@babel/helpers - typeof";return il=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},il(e)}function Zk(e,t){if(e==null)return{};var r=qre(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 qre(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 qc(){return qc=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(ds(d.slice(0,x)),[p-y]);break}var S=v.length%2===0?[0,m]:[m];return[].concat(ds(t.repeat(d,h)),ds(v),S).map(function(_){return"".concat(_,"px")}).join(", ")}),Fn(r,"id",yl("recharts-line-")),Fn(r,"pathRef",function(o){r.mainCurve=o}),Fn(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),Fn(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return Qre(t,e),Kre(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,o=i.points,u=i.xAxis,d=i.yAxis,c=i.layout,h=i.children,p=tn(h,zu);if(!p)return null;var m=function(y,S){return{x:y.x,y:y.y,value:y.value,errorVal:Zt(y.payload,S)}},v={clipPath:n?"url(#clipPath-".concat(a,")"):null};return X.createElement(st,v,p.map(function(x){return X.cloneElement(x,{key:"bar-".concat(x.props.dataKey),data:o,xAxis:u,yAxis:d,layout:c,dataPointFormatter:m})}))}},{key:"renderDots",value:function(n,a,i){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var u=this.props,d=u.dot,c=u.points,h=u.dataKey,p=Fe(this.props,!1),m=Fe(d,!0),v=c.map(function(y,S){var _=Wr(Wr(Wr({key:"dot-".concat(S),r:3},p),m),{},{index:S,cx:y.x,cy:y.y,value:y.value,dataKey:h,payload:y.payload,points:c});return t.renderDotItem(d,_)}),x={clipPath:n?"url(#clipPath-".concat(a?"":"dots-").concat(i,")"):null};return X.createElement(st,qc({className:"recharts-line-dots",key:"dots"},x),v)}},{key:"renderCurveStatically",value:function(n,a,i,o){var u=this.props,d=u.type,c=u.layout,h=u.connectNulls;u.ref;var p=Zk(u,Fre),m=Wr(Wr(Wr({},Fe(p,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:a?"url(#clipPath-".concat(i,")"):null,points:n},o),{},{type:d,layout:c,connectNulls:h});return X.createElement(hp,qc({},m,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,a){var i=this,o=this.props,u=o.points,d=o.strokeDasharray,c=o.isAnimationActive,h=o.animationBegin,p=o.animationDuration,m=o.animationEasing,v=o.animationId,x=o.animateNewValues,y=o.width,S=o.height,_=this.state,N=_.prevPoints,O=_.totalLength;return X.createElement(la,{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 C=A.t;if(N){var E=N.length/u.length,T=u.map(function(B,q){var H=Math.floor(q*E);if(N[H]){var V=N[H],G=Jr(V.x,B.x),U=Jr(V.y,B.y);return Wr(Wr({},B),{},{x:G(C),y:U(C)})}if(x){var $=Jr(y*2,B.x),Q=Jr(S/2,B.y);return Wr(Wr({},B),{},{x:$(C),y:Q(C)})}return Wr(Wr({},B),{},{x:B.x,y:B.y})});return i.renderCurveStatically(T,n,a)}var R=Jr(0,O),L=R(C),z;if(d){var F="".concat(d).split(/[,\s]+/gim).map(function(B){return parseFloat(B)});z=i.getStrokeDasharray(L,O,F)}else z=i.generateSimpleStrokeDasharray(O,L);return i.renderCurveStatically(u,n,a,{strokeDasharray:z})})}},{key:"renderCurve",value:function(n,a){var i=this.props,o=i.points,u=i.isAnimationActive,d=this.state,c=d.prevPoints,h=d.totalLength;return u&&o&&o.length&&(!c&&h>0||!Fu(c,o))?this.renderCurveWithAnimation(n,a):this.renderCurveStatically(o,n,a)}},{key:"render",value:function(){var n,a=this.props,i=a.hide,o=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,S=a.id;if(i||!u||!u.length)return null;var _=this.state.isAnimationFinished,N=u.length===1,O=Ze("recharts-line",d),A=c&&c.allowDataOverflow,C=h&&h.allowDataOverflow,E=A||C,T=Qe(S)?this.id:S,R=(n=Fe(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},L=R.r,z=L===void 0?3:L,F=R.strokeWidth,B=F===void 0?2:F,q=EU(o)?o:{},H=q.clipDot,V=H===void 0?!0:H,G=z*2+B;return X.createElement(st,{className:O},A||C?X.createElement("defs",null,X.createElement("clipPath",{id:"clipPath-".concat(T)},X.createElement("rect",{x:A?m:m-v/2,y:C?p:p-x/2,width:A?v:v*2,height:C?x:x*2})),!V&&X.createElement("clipPath",{id:"clipPath-dots-".concat(T)},X.createElement("rect",{x:m-G/2,y:p-G/2,width:v+G,height:x+G}))):null,!N&&this.renderCurve(E,T),this.renderErrorBar(E,T),(N||o)&&this.renderDots(E,V,T),(!y||_)&&La.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(ds(n),[0]):n,o=[],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 qne(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 Une(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vne(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?o:t&&t.length&&je(a)&&je(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,o=t.tooltipAxis,u=Rm(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(o.dataKey&&!o.allowDuplicatedCategory){var v=p===void 0?u:p;m=Lh(v,o.dataKey,a)}else m=p&&p[n]||u[n];return m?[].concat(cl(d),[YL(c,m)]):d},[])},lR=function(t,r,n,a){var i=a||{x:t.chartX,y:t.chartY},o=rae(i,n),u=t.orderedTooltipTicks,d=t.tooltipAxis,c=t.tooltipTicks,h=NX(o,u,c,d);if(h>=0&&c){var p=c[h]&&c[h].value,m=nS(t,r,h,p),v=nae(n,u,h,i);return{activeTooltipIndex:h,activeLabel:p,activePayload:m,activeCoordinate:v}}return null},aae=function(t,r){var n=r.axes,a=r.graphicalItems,i=r.axisType,o=r.axisIdKey,u=r.stackGroups,d=r.dataStartIndex,c=r.dataEndIndex,h=t.layout,p=t.children,m=t.stackOffset,v=VL(h,i);return n.reduce(function(x,y){var S,_=y.type.defaultProps!==void 0?he(he({},y.type.defaultProps),y.props):y.props,N=_.type,O=_.dataKey,A=_.allowDataOverflow,C=_.allowDuplicatedCategory,E=_.scale,T=_.ticks,R=_.includeHidden,L=_[o];if(x[L])return x;var z=Rm(t.data,{graphicalItems:a.filter(function(D){var Z,ie=o in D.props?D.props[o]:(Z=D.type.defaultProps)===null||Z===void 0?void 0:Z[o];return ie===L}),dataStartIndex:d,dataEndIndex:c}),F=z.length,B,q,H;Ane(_.domain,A,N)&&(B=vw(_.domain,null,A),v&&(N==="number"||E!=="auto")&&(H=$c(z,O,"category")));var V=o4(N);if(!B||B.length===0){var G,U=(G=_.domain)!==null&&G!==void 0?G:V;if(O){if(B=$c(z,O,N),N==="category"&&v){var $=yU(B);C&&$?(q=B,B=_p(0,F)):C||(B=uT(U,B,y).reduce(function(D,Z){return D.indexOf(Z)>=0?D:[].concat(cl(D),[Z])},[]))}else if(N==="category")C?B=B.filter(function(D){return D!==""&&!Qe(D)}):B=uT(U,B,y).reduce(function(D,Z){return D.indexOf(Z)>=0||Z===""||Qe(Z)?D:[].concat(cl(D),[Z])},[]);else if(N==="number"){var Q=AX(z,a.filter(function(D){var Z,ie,oe=o in D.props?D.props[o]:(Z=D.type.defaultProps)===null||Z===void 0?void 0:Z[o],ne="hide"in D.props?D.props.hide:(ie=D.type.defaultProps)===null||ie===void 0?void 0:ie.hide;return oe===L&&(R||!ne)}),O,i,h);Q&&(B=Q)}v&&(N==="number"||E!=="auto")&&(H=$c(z,O,"category"))}else v?B=_p(0,F):u&&u[L]&&u[L].hasStack&&N==="number"?B=m==="expand"?[0,1]:XL(u[L].stackGroups,d,c):B=UL(z,a.filter(function(D){var Z=o in D.props?D.props[o]:D.type.defaultProps[o],ie="hide"in D.props?D.props.hide:D.type.defaultProps.hide;return Z===L&&(R||!ie)}),N,h,!0);if(N==="number")B=eS(p,B,L,i,T),U&&(B=vw(U,B,A));else if(N==="category"&&U){var k=U,I=B.every(function(D){return k.indexOf(D)>=0});I&&(B=k)}}return he(he({},x),{},Ue({},L,he(he({},_),{},{axisType:i,domain:B,categoricalDomain:H,duplicateDomain:q,originalDomain:(S=_.domain)!==null&&S!==void 0?S:V,isCategorical:v,layout:h})))},{})},iae=function(t,r){var n=r.graphicalItems,a=r.Axis,i=r.axisType,o=r.axisIdKey,u=r.stackGroups,d=r.dataStartIndex,c=r.dataEndIndex,h=t.layout,p=t.children,m=Rm(t.data,{graphicalItems:n,dataStartIndex:d,dataEndIndex:c}),v=m.length,x=VL(h,i),y=-1;return n.reduce(function(S,_){var N=_.type.defaultProps!==void 0?he(he({},_.type.defaultProps),_.props):_.props,O=N[o],A=o4("number");if(!S[O]){y++;var C;return x?C=_p(0,v):u&&u[O]&&u[O].hasStack?(C=XL(u[O].stackGroups,d,c),C=eS(p,C,O,i)):(C=vw(A,UL(m,n.filter(function(E){var T,R,L=o in E.props?E.props[o]:(T=E.type.defaultProps)===null||T===void 0?void 0:T[o],z="hide"in E.props?E.props.hide:(R=E.type.defaultProps)===null||R===void 0?void 0:R.hide;return L===O&&!z}),"number",h),a.defaultProps.allowDataOverflow),C=eS(p,C,O,i)),he(he({},S),{},Ue({},O,he(he({axisType:i},a.defaultProps),{},{hide:!0,orientation:en(eae,"".concat(i,".").concat(y%2),null),domain:C,originalDomain:A,isCategorical:x,layout:h})))}return S},{})},oae=function(t,r){var n=r.axisType,a=n===void 0?"xAxis":n,i=r.AxisComp,o=r.graphicalItems,u=r.stackGroups,d=r.dataStartIndex,c=r.dataEndIndex,h=t.children,p="".concat(a,"Id"),m=tn(h,i),v={};return m&&m.length?v=aae(t,{axes:m,graphicalItems:o,axisType:a,axisIdKey:p,stackGroups:u,dataStartIndex:d,dataEndIndex:c}):o&&o.length&&(v=iae(t,{Axis:i,graphicalItems:o,axisType:a,axisIdKey:p,stackGroups:u,dataStartIndex:d,dataEndIndex:c})),v},sae=function(t){var r=vi(t),n=Ia(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:tj(n,function(a){return a.coordinate}),tooltipAxis:r,tooltipAxisBandSize:up(r,n)}},cR=function(t){var r=t.children,n=t.defaultShowTooltip,a=Kr(r,Zs),i=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),a&&a.props&&(a.props.startIndex>=0&&(i=a.props.startIndex),a.props.endIndex>=0&&(o=a.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},lae=function(t){return!t||!t.length?!1:t.some(function(r){var n=Ma(r&&r.type);return n&&n.indexOf("Bar")>=0})},uR=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"}},cae=function(t,r){var n=t.props,a=t.graphicalItems,i=t.xAxisMap,o=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=Kr(p,Zs),x=Kr(p,Ps),y=Object.keys(d).reduce(function(C,E){var T=d[E],R=T.orientation;return!T.mirror&&!T.hide?he(he({},C),{},Ue({},R,C[R]+T.width)):C},{left:m.left||0,right:m.right||0}),S=Object.keys(o).reduce(function(C,E){var T=o[E],R=T.orientation;return!T.mirror&&!T.hide?he(he({},C),{},Ue({},R,en(C,"".concat(R))+T.height)):C},{top:m.top||0,bottom:m.bottom||0}),_=he(he({},S),y),N=_.bottom;v&&(_.bottom+=v.props.height||Zs.defaultProps.height),x&&r&&(_=EX(_,a,n,r));var O=c-_.left-_.right,A=h-_.top-_.bottom;return he(he({brushBottom:N},_),{},{width:Math.max(O,0),height:Math.max(A,0)})},uae=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},$j=function(t){var r=t.chartName,n=t.GraphicalChild,a=t.defaultTooltipEventType,i=a===void 0?"axis":a,o=t.validateTooltipEventTypes,u=o===void 0?["axis"]:o,d=t.axisComponents,c=t.legendContent,h=t.formatAxisMap,p=t.defaultProps,m=function(_,N){var O=N.graphicalItems,A=N.stackGroups,C=N.offset,E=N.updateId,T=N.dataStartIndex,R=N.dataEndIndex,L=_.barSize,z=_.layout,F=_.barGap,B=_.barCategoryGap,q=_.maxBarSize,H=uR(z),V=H.numericAxisName,G=H.cateAxisName,U=lae(O),$=[];return O.forEach(function(Q,k){var I=Rm(_.data,{graphicalItems:[Q],dataStartIndex:T,dataEndIndex:R}),D=Q.type.defaultProps!==void 0?he(he({},Q.type.defaultProps),Q.props):Q.props,Z=D.dataKey,ie=D.maxBarSize,oe=D["".concat(V,"Id")],ne=D["".concat(G,"Id")],K={},J=d.reduce(function(Rt,Br){var ya=N["".concat(Br.axisType,"Map")],Di=D["".concat(Br.axisType,"Id")];ya&&ya[Di]||Br.axisType==="zAxis"||yo();var Ka=ya[Di];return he(he({},Rt),{},Ue(Ue({},Br.axisType,Ka),"".concat(Br.axisType,"Ticks"),Ia(Ka)))},K),ee=J[G],ce=J["".concat(G,"Ticks")],pe=A&&A[oe]&&A[oe].hasStack&&BX(Q,A[oe].stackGroups),W=Ma(Q.type).indexOf("Bar")>=0,_e=up(ee,ce),Ce=[],qe=U&&CX({barSize:L,stackGroups:A,totalSize:uae(J,G)});if(W){var De,nt,kt=Qe(ie)?q:ie,Ut=(De=(nt=up(ee,ce,!0))!==null&&nt!==void 0?nt:kt)!==null&&De!==void 0?De:0;Ce=OX({barGap:F,barCategoryGap:B,bandSize:Ut!==_e?Ut:_e,sizeList:qe[ne],maxBarSize:kt}),Ut!==_e&&(Ce=Ce.map(function(Rt){return he(he({},Rt),{},{position:he(he({},Rt.position),{},{offset:Rt.position.offset-Ut/2})})}))}var lr=Q&&Q.type&&Q.type.getComposedData;lr&&$.push({props:he(he({},lr(he(he({},J),{},{displayedData:I,props:_,dataKey:Z,item:Q,bandSize:_e,barPosition:Ce,offset:C,stackedData:pe,layout:z,dataStartIndex:T,dataEndIndex:R}))),{},Ue(Ue(Ue({key:Q.key||"item-".concat(k)},V,J[V]),G,J[G]),"animationId",E)),childIndex:TU(Q,_.children),item:Q})}),$},v=function(_,N){var O=_.props,A=_.dataStartIndex,C=_.dataEndIndex,E=_.updateId;if(!_E({props:O}))return null;var T=O.children,R=O.layout,L=O.stackOffset,z=O.data,F=O.reverseStackOrder,B=uR(R),q=B.numericAxisName,H=B.cateAxisName,V=tn(T,n),G=LX(z,V,"".concat(q,"Id"),"".concat(H,"Id"),L,F),U=d.reduce(function(D,Z){var ie="".concat(Z.axisType,"Map");return he(he({},D),{},Ue({},ie,oae(O,he(he({},Z),{},{graphicalItems:V,stackGroups:Z.axisType===q&&G,dataStartIndex:A,dataEndIndex:C}))))},{}),$=cae(he(he({},U),{},{props:O,graphicalItems:V}),N?.legendBBox);Object.keys(U).forEach(function(D){U[D]=h(O,U[D],$,D.replace("Map",""),r)});var Q=U["".concat(H,"Map")],k=sae(Q),I=m(O,he(he({},U),{},{dataStartIndex:A,dataEndIndex:C,updateId:E,graphicalItems:V,stackGroups:G,offset:$}));return he(he({formattedGraphicalItems:I,graphicalItems:V,offset:$,stackGroups:G},k),U)},x=(function(S){function _(N){var O,A,C;return Une(this,_),C=Wne(this,_,[N]),Ue(C,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Ue(C,"accessibilityManager",new Pne),Ue(C,"handleLegendBBoxUpdate",function(E){if(E){var T=C.state,R=T.dataStartIndex,L=T.dataEndIndex,z=T.updateId;C.setState(he({legendBBox:E},v({props:C.props,dataStartIndex:R,dataEndIndex:L,updateId:z},he(he({},C.state),{},{legendBBox:E}))))}}),Ue(C,"handleReceiveSyncEvent",function(E,T,R){if(C.props.syncId===E){if(R===C.eventEmitterSymbol&&typeof C.props.syncMethod!="function")return;C.applySyncEvent(T)}}),Ue(C,"handleBrushChange",function(E){var T=E.startIndex,R=E.endIndex;if(T!==C.state.dataStartIndex||R!==C.state.dataEndIndex){var L=C.state.updateId;C.setState(function(){return he({dataStartIndex:T,dataEndIndex:R},v({props:C.props,dataStartIndex:T,dataEndIndex:R,updateId:L},C.state))}),C.triggerSyncEvent({dataStartIndex:T,dataEndIndex:R})}}),Ue(C,"handleMouseEnter",function(E){var T=C.getMouseInfo(E);if(T){var R=he(he({},T),{},{isTooltipActive:!0});C.setState(R),C.triggerSyncEvent(R);var L=C.props.onMouseEnter;He(L)&&L(R,E)}}),Ue(C,"triggeredAfterMouseMove",function(E){var T=C.getMouseInfo(E),R=T?he(he({},T),{},{isTooltipActive:!0}):{isTooltipActive:!1};C.setState(R),C.triggerSyncEvent(R);var L=C.props.onMouseMove;He(L)&&L(R,E)}),Ue(C,"handleItemMouseEnter",function(E){C.setState(function(){return{isTooltipActive:!0,activeItem:E,activePayload:E.tooltipPayload,activeCoordinate:E.tooltipPosition||{x:E.cx,y:E.cy}}})}),Ue(C,"handleItemMouseLeave",function(){C.setState(function(){return{isTooltipActive:!1}})}),Ue(C,"handleMouseMove",function(E){E.persist(),C.throttleTriggeredAfterMouseMove(E)}),Ue(C,"handleMouseLeave",function(E){C.throttleTriggeredAfterMouseMove.cancel();var T={isTooltipActive:!1};C.setState(T),C.triggerSyncEvent(T);var R=C.props.onMouseLeave;He(R)&&R(T,E)}),Ue(C,"handleOuterEvent",function(E){var T=AU(E),R=en(C.props,"".concat(T));if(T&&He(R)){var L,z;/.*touch.*/i.test(T)?z=C.getMouseInfo(E.changedTouches[0]):z=C.getMouseInfo(E),R((L=z)!==null&&L!==void 0?L:{},E)}}),Ue(C,"handleClick",function(E){var T=C.getMouseInfo(E);if(T){var R=he(he({},T),{},{isTooltipActive:!0});C.setState(R),C.triggerSyncEvent(R);var L=C.props.onClick;He(L)&&L(R,E)}}),Ue(C,"handleMouseDown",function(E){var T=C.props.onMouseDown;if(He(T)){var R=C.getMouseInfo(E);T(R,E)}}),Ue(C,"handleMouseUp",function(E){var T=C.props.onMouseUp;if(He(T)){var R=C.getMouseInfo(E);T(R,E)}}),Ue(C,"handleTouchMove",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&C.throttleTriggeredAfterMouseMove(E.changedTouches[0])}),Ue(C,"handleTouchStart",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&C.handleMouseDown(E.changedTouches[0])}),Ue(C,"handleTouchEnd",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&C.handleMouseUp(E.changedTouches[0])}),Ue(C,"handleDoubleClick",function(E){var T=C.props.onDoubleClick;if(He(T)){var R=C.getMouseInfo(E);T(R,E)}}),Ue(C,"handleContextMenu",function(E){var T=C.props.onContextMenu;if(He(T)){var R=C.getMouseInfo(E);T(R,E)}}),Ue(C,"triggerSyncEvent",function(E){C.props.syncId!==void 0&&d1.emit(f1,C.props.syncId,E,C.eventEmitterSymbol)}),Ue(C,"applySyncEvent",function(E){var T=C.props,R=T.layout,L=T.syncMethod,z=C.state.updateId,F=E.dataStartIndex,B=E.dataEndIndex;if(E.dataStartIndex!==void 0||E.dataEndIndex!==void 0)C.setState(he({dataStartIndex:F,dataEndIndex:B},v({props:C.props,dataStartIndex:F,dataEndIndex:B,updateId:z},C.state)));else if(E.activeTooltipIndex!==void 0){var q=E.chartX,H=E.chartY,V=E.activeTooltipIndex,G=C.state,U=G.offset,$=G.tooltipTicks;if(!U)return;if(typeof L=="function")V=L($,E);else if(L==="value"){V=-1;for(var Q=0;Q<$.length;Q++)if($[Q].value===E.activeLabel){V=Q;break}}var k=he(he({},U),{},{x:U.left,y:U.top}),I=Math.min(q,k.x+k.width),D=Math.min(H,k.y+k.height),Z=$[V]&&$[V].value,ie=nS(C.state,C.props.data,V),oe=$[V]?{x:R==="horizontal"?$[V].coordinate:I,y:R==="horizontal"?D:$[V].coordinate}:i4;C.setState(he(he({},E),{},{activeLabel:Z,activeCoordinate:oe,activePayload:ie,activeTooltipIndex:V}))}else C.setState(E)}),Ue(C,"renderCursor",function(E){var T,R=C.state,L=R.isTooltipActive,z=R.activeCoordinate,F=R.activePayload,B=R.offset,q=R.activeTooltipIndex,H=R.tooltipAxisBandSize,V=C.getTooltipEventType(),G=(T=E.props.active)!==null&&T!==void 0?T:L,U=C.props.layout,$=E.key||"_recharts-cursor";return X.createElement(Dne,{key:$,activeCoordinate:z,activePayload:F,activeTooltipIndex:q,chartName:r,element:E,isActive:G,layout:U,offset:B,tooltipAxisBandSize:H,tooltipEventType:V})}),Ue(C,"renderPolarAxis",function(E,T,R){var L=en(E,"type.axisType"),z=en(C.state,"".concat(L,"Map")),F=E.type.defaultProps,B=F!==void 0?he(he({},F),E.props):E.props,q=z&&z[B["".concat(L,"Id")]];return b.cloneElement(E,he(he({},q),{},{className:Ze(L,q.className),key:E.key||"".concat(T,"-").concat(R),ticks:Ia(q,!0)}))}),Ue(C,"renderPolarGrid",function(E){var T=E.props,R=T.radialLines,L=T.polarAngles,z=T.polarRadius,F=C.state,B=F.radiusAxisMap,q=F.angleAxisMap,H=vi(B),V=vi(q),G=V.cx,U=V.cy,$=V.innerRadius,Q=V.outerRadius;return b.cloneElement(E,{polarAngles:Array.isArray(L)?L:Ia(V,!0).map(function(k){return k.coordinate}),polarRadius:Array.isArray(z)?z:Ia(H,!0).map(function(k){return k.coordinate}),cx:G,cy:U,innerRadius:$,outerRadius:Q,key:E.key||"polar-grid",radialLines:R})}),Ue(C,"renderLegend",function(){var E=C.state.formattedGraphicalItems,T=C.props,R=T.children,L=T.width,z=T.height,F=C.props.margin||{},B=L-(F.left||0)-(F.right||0),q=zL({children:R,formattedGraphicalItems:E,legendWidth:B,legendContent:c});if(!q)return null;var H=q.item,V=oR(q,Lne);return b.cloneElement(H,he(he({},V),{},{chartWidth:L,chartHeight:z,margin:F,onBBoxUpdate:C.handleLegendBBoxUpdate}))}),Ue(C,"renderTooltip",function(){var E,T=C.props,R=T.children,L=T.accessibilityLayer,z=Kr(R,Yr);if(!z)return null;var F=C.state,B=F.isTooltipActive,q=F.activeCoordinate,H=F.activePayload,V=F.activeLabel,G=F.offset,U=(E=z.props.active)!==null&&E!==void 0?E:B;return b.cloneElement(z,{viewBox:he(he({},G),{},{x:G.left,y:G.top}),active:U,label:V,payload:U?H:[],coordinate:q,accessibilityLayer:L})}),Ue(C,"renderBrush",function(E){var T=C.props,R=T.margin,L=T.data,z=C.state,F=z.offset,B=z.dataStartIndex,q=z.dataEndIndex,H=z.updateId;return b.cloneElement(E,{key:E.key||"_recharts-brush",onChange:Tf(C.handleBrushChange,E.props.onChange),data:L,x:je(E.props.x)?E.props.x:F.left,y:je(E.props.y)?E.props.y:F.top+F.height+F.brushBottom-(R.bottom||0),width:je(E.props.width)?E.props.width:F.width,startIndex:B,endIndex:q,updateId:"brush-".concat(H)})}),Ue(C,"renderReferenceElement",function(E,T,R){if(!E)return null;var L=C,z=L.clipPathId,F=C.state,B=F.xAxisMap,q=F.yAxisMap,H=F.offset,V=E.type.defaultProps||{},G=E.props,U=G.xAxisId,$=U===void 0?V.xAxisId:U,Q=G.yAxisId,k=Q===void 0?V.yAxisId:Q;return b.cloneElement(E,{key:E.key||"".concat(T,"-").concat(R),xAxis:B[$],yAxis:q[k],viewBox:{x:H.left,y:H.top,width:H.width,height:H.height},clipPathId:z})}),Ue(C,"renderActivePoints",function(E){var T=E.item,R=E.activePoint,L=E.basePoint,z=E.childIndex,F=E.isRange,B=[],q=T.props.key,H=T.item.type.defaultProps!==void 0?he(he({},T.item.type.defaultProps),T.item.props):T.item.props,V=H.activeDot,G=H.dataKey,U=he(he({index:z,dataKey:G,cx:R.x,cy:R.y,r:4,fill:Oj(T.item),strokeWidth:2,stroke:"#fff",payload:R.payload,value:R.value},Fe(V,!1)),$h(V));return B.push(_.renderActiveDot(V,U,"".concat(q,"-activePoint-").concat(z))),L?B.push(_.renderActiveDot(V,he(he({},U),{},{cx:L.x,cy:L.y}),"".concat(q,"-basePoint-").concat(z))):F&&B.push(null),B}),Ue(C,"renderGraphicChild",function(E,T,R){var L=C.filterFormatItem(E,T,R);if(!L)return null;var z=C.getTooltipEventType(),F=C.state,B=F.isTooltipActive,q=F.tooltipAxis,H=F.activeTooltipIndex,V=F.activeLabel,G=C.props.children,U=Kr(G,Yr),$=L.props,Q=$.points,k=$.isRange,I=$.baseLine,D=L.item.type.defaultProps!==void 0?he(he({},L.item.type.defaultProps),L.item.props):L.item.props,Z=D.activeDot,ie=D.hide,oe=D.activeBar,ne=D.activeShape,K=!!(!ie&&B&&U&&(Z||oe||ne)),J={};z!=="axis"&&U&&U.props.trigger==="click"?J={onClick:Tf(C.handleItemMouseEnter,E.props.onClick)}:z!=="axis"&&(J={onMouseLeave:Tf(C.handleItemMouseLeave,E.props.onMouseLeave),onMouseEnter:Tf(C.handleItemMouseEnter,E.props.onMouseEnter)});var ee=b.cloneElement(E,he(he({},L.props),J));function ce(Br){return typeof q.dataKey=="function"?q.dataKey(Br.payload):null}if(K)if(H>=0){var pe,W;if(q.dataKey&&!q.allowDuplicatedCategory){var _e=typeof q.dataKey=="function"?ce:"payload.".concat(q.dataKey.toString());pe=Lh(Q,_e,V),W=k&&I&&Lh(I,_e,V)}else pe=Q?.[H],W=k&&I&&I[H];if(ne||oe){var Ce=E.props.activeIndex!==void 0?E.props.activeIndex:H;return[b.cloneElement(E,he(he(he({},L.props),J),{},{activeIndex:Ce})),null,null]}if(!Qe(pe))return[ee].concat(cl(C.renderActivePoints({item:L,activePoint:pe,basePoint:W,childIndex:H,isRange:k})))}else{var qe,De=(qe=C.getItemByXY(C.state.activeCoordinate))!==null&&qe!==void 0?qe:{graphicalItem:ee},nt=De.graphicalItem,kt=nt.item,Ut=kt===void 0?E:kt,lr=nt.childIndex,Rt=he(he(he({},L.props),J),{},{activeIndex:lr});return[b.cloneElement(Ut,Rt),null,null]}return k?[ee,null,null]:[ee,null]}),Ue(C,"renderCustomized",function(E,T,R){return b.cloneElement(E,he(he({key:"recharts-customized-".concat(R)},C.props),C.state))}),Ue(C,"renderMap",{CartesianGrid:{handler:Df,once:!0},ReferenceArea:{handler:C.renderReferenceElement},ReferenceLine:{handler:Df},ReferenceDot:{handler:C.renderReferenceElement},XAxis:{handler:Df},YAxis:{handler:Df},Brush:{handler:C.renderBrush,once:!0},Bar:{handler:C.renderGraphicChild},Line:{handler:C.renderGraphicChild},Area:{handler:C.renderGraphicChild},Radar:{handler:C.renderGraphicChild},RadialBar:{handler:C.renderGraphicChild},Scatter:{handler:C.renderGraphicChild},Pie:{handler:C.renderGraphicChild},Funnel:{handler:C.renderGraphicChild},Tooltip:{handler:C.renderCursor,once:!0},PolarGrid:{handler:C.renderPolarGrid,once:!0},PolarAngleAxis:{handler:C.renderPolarAxis},PolarRadiusAxis:{handler:C.renderPolarAxis},Customized:{handler:C.renderCustomized}}),C.clipPathId="".concat((O=N.id)!==null&&O!==void 0?O:yl("recharts"),"-clip"),C.throttleTriggeredAfterMouseMove=zD(C.triggeredAfterMouseMove,(A=N.throttleDelay)!==null&&A!==void 0?A:1e3/60),C.state={},C}return Xne(_,S),Hne(_,[{key:"componentDidMount",value:function(){var O,A;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(O=this.props.margin.left)!==null&&O!==void 0?O: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 O=this.props,A=O.children,C=O.data,E=O.height,T=O.layout,R=Kr(A,Yr);if(R){var L=R.props.defaultIndex;if(!(typeof L!="number"||L<0||L>this.state.tooltipTicks.length-1)){var z=this.state.tooltipTicks[L]&&this.state.tooltipTicks[L].value,F=nS(this.state,C,L,z),B=this.state.tooltipTicks[L].coordinate,q=(this.state.offset.top+E)/2,H=T==="horizontal",V=H?{x:B,y:q}:{y:B,x:q},G=this.state.formattedGraphicalItems.find(function($){var Q=$.item;return Q.type.name==="Scatter"});G&&(V=he(he({},V),G.props.points[L].tooltipPosition),F=G.props.points[L].tooltipPayload);var U={activeTooltipIndex:L,isTooltipActive:!0,activeLabel:z,activePayload:F,activeCoordinate:V};this.setState(U),this.renderCursor(R),this.accessibilityManager.setIndex(L)}}}},{key:"getSnapshotBeforeUpdate",value:function(O,A){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==A.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==O.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==O.margin){var C,E;this.accessibilityManager.setDetails({offset:{left:(C=this.props.margin.left)!==null&&C!==void 0?C:0,top:(E=this.props.margin.top)!==null&&E!==void 0?E:0}})}return null}},{key:"componentDidUpdate",value:function(O){B1([Kr(O.children,Yr)],[Kr(this.props.children,Yr)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var O=Kr(this.props.children,Yr);if(O&&typeof O.props.shared=="boolean"){var A=O.props.shared?"axis":"item";return u.indexOf(A)>=0?A:i}return i}},{key:"getMouseInfo",value:function(O){if(!this.container)return null;var A=this.container,C=A.getBoundingClientRect(),E=vH(C),T={chartX:Math.round(O.pageX-E.left),chartY:Math.round(O.pageY-E.top)},R=C.width/A.offsetWidth||1,L=this.inRange(T.chartX,T.chartY,R);if(!L)return null;var z=this.state,F=z.xAxisMap,B=z.yAxisMap,q=this.getTooltipEventType(),H=lR(this.state,this.props.data,this.props.layout,L);if(q!=="axis"&&F&&B){var V=vi(F).scale,G=vi(B).scale,U=V&&V.invert?V.invert(T.chartX):null,$=G&&G.invert?G.invert(T.chartY):null;return he(he({},T),{},{xValue:U,yValue:$},H)}return H?he(he({},T),H):null}},{key:"inRange",value:function(O,A){var C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,E=this.props.layout,T=O/C,R=A/C;if(E==="horizontal"||E==="vertical"){var L=this.state.offset,z=T>=L.left&&T<=L.left+L.width&&R>=L.top&&R<=L.top+L.height;return z?{x:T,y:R}:null}var F=this.state,B=F.angleAxisMap,q=F.radiusAxisMap;if(B&&q){var H=vi(B);return hT({x:T,y:R},H)}return null}},{key:"parseEventsOfWrapper",value:function(){var O=this.props.children,A=this.getTooltipEventType(),C=Kr(O,Yr),E={};C&&A==="axis"&&(C.props.trigger==="click"?E={onClick:this.handleClick}:E={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=$h(this.props,this.handleOuterEvent);return he(he({},T),E)}},{key:"addListener",value:function(){d1.on(f1,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){d1.removeListener(f1,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(O,A,C){for(var E=this.state.formattedGraphicalItems,T=0,R=E.length;Tl.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:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.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)}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-semibold text-gray-900",children:e.product}),l.jsxs("p",{className:"text-xs text-gray-500",children:[e.id," • ",e.user]})]})]}),l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("span",{className:"text-xs text-gray-500 font-medium",children:e.time}),l.jsx(xr,{variant:"secondary",className:e.status==="expired"?"bg-red-100 text-red-700":"bg-green-100 text-green-700",children:e.status})]})]},e.id))})})]})]}),l.jsx("div",{className:"space-y-6",children:l.jsxs(Xr,{className:"shadow-sm border-gray-200",children:[l.jsx(Ln,{children:l.jsxs($n,{className:"text-base font-bold text-gray-800 flex items-center gap-2",children:[l.jsx(Vc,{className:"w-5 h-5 text-gray-500"}),"By Category"]})}),l.jsxs(vn,{children:[l.jsxs("div",{className:"h-[200px] relative",children:[l.jsx(Kh,{width:"100%",height:"100%",children:l.jsxs(fae,{children:[l.jsx(Ga,{data:p1,cx:"50%",cy:"50%",innerRadius:60,outerRadius:80,paddingAngle:5,dataKey:"value",children:p1.map((e,t)=>l.jsx(cm,{fill:e.color},`cell-${t}`))}),l.jsx(Yr,{})]})}),l.jsxs("div",{className:"absolute inset-0 flex items-center justify-center flex-col pointer-events-none",children:[l.jsx("span",{className:"text-2xl font-bold text-gray-900",children:"1000"}),l.jsx("span",{className:"text-xs text-gray-500",children:"Total"})]})]}),l.jsx("div",{className:"mt-4 space-y-2",children:p1.map(e=>l.jsxs("div",{className:"flex items-center justify-between text-sm",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:e.color}}),l.jsx("span",{className:"text-gray-600",children:e.name})]}),l.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:o}){return l.jsx(Xr,{className:"border-gray-200 shadow-sm hover:shadow-md transition-shadow",children:l.jsxs(vn,{className:"p-6",children:[l.jsxs("div",{className:"flex justify-between items-start",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-gray-500 mb-1",children:e}),l.jsx("h3",{className:"text-2xl font-bold text-gray-900",children:t})]}),l.jsx("div",{className:`p-2 rounded-lg ${o}`,children:l.jsx(a,{className:`w-5 h-5 ${i}`})})]}),l.jsxs("div",{className:"mt-4 flex items-center text-sm",children:[n?l.jsx(YI,{className:"w-4 h-4 text-green-500 mr-1"}):l.jsx(vz,{className:"w-4 h-4 text-red-500 mr-1"}),l.jsx("span",{className:n?"text-green-600 font-medium":"text-red-600 font-medium",children:r}),l.jsx("span",{className:"text-gray-400 ml-1",children:"Vs. last period"})]})]})})}function gae({title:e}){return l.jsxs("div",{className:"space-y-6",children:[l.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[1,2,3,4].map(t=>l.jsxs(Xr,{children:[l.jsx(Ln,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:l.jsxs($n,{className:"text-sm font-medium",children:["Metric ",t]})}),l.jsxs(vn,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"000"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"+0.0% from last month"})]})]},t))}),l.jsx(Xr,{className:"min-h-[400px] flex items-center justify-center border-dashed",children:l.jsxs("div",{className:"text-center text-muted-foreground",children:[l.jsxs("h3",{className:"text-lg font-medium",children:[e," Module"]}),l.jsx("p",{children:"This module is currently under development."})]})})]})}function Or({className:e,...t}){return l.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:l.jsx("table",{"data-slot":"table",className:Ae("w-full caption-bottom text-sm",e),...t})})}function Er({className:e,...t}){return l.jsx("thead",{"data-slot":"table-header",className:Ae("[&_tr]:border-b",e),...t})}function Pr({className:e,...t}){return l.jsx("tbody",{"data-slot":"table-body",className:Ae("[&_tr:last-child]:border-0",e),...t})}function Be({className:e,...t}){return l.jsx("tr",{"data-slot":"table-row",className:Ae("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function ve({className:e,...t}){return l.jsx("th",{"data-slot":"table-head",className:Ae("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 de({className:e,...t}){return l.jsx("td",{"data-slot":"table-cell",className:Ae("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function dR(e){const t=vae(e),r=b.forwardRef((n,a)=>{const{children:i,...o}=n,u=b.Children.toArray(i),d=u.find(xae);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 l.jsx(t,{...o,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,h):null})}return l.jsx(t,{...o,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function vae(e){const t=b.forwardRef((r,n)=>{const{children:a,...i}=r;if(b.isValidElement(a)){const o=wae(a),u=bae(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Sn(n,o):o),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var yae=Symbol("radix.slottable");function xae(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===yae}function bae(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 wae(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 Sae(e){const t=e+"CollectionProvider",[r,n]=Ua(t),[a,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:S,children:_}=y,N=X.useRef(null),O=X.useRef(new Map).current;return l.jsx(a,{scope:S,itemMap:O,collectionRef:N,children:_})};o.displayName=t;const u=e+"CollectionSlot",d=dR(u),c=X.forwardRef((y,S)=>{const{scope:_,children:N}=y,O=i(u,_),A=at(S,O.collectionRef);return l.jsx(d,{ref:A,children:N})});c.displayName=u;const h=e+"CollectionItemSlot",p="data-radix-collection-item",m=dR(h),v=X.forwardRef((y,S)=>{const{scope:_,children:N,...O}=y,A=X.useRef(null),C=at(S,A),E=i(h,_);return X.useEffect(()=>(E.itemMap.set(A,{ref:A,...O}),()=>void E.itemMap.delete(A))),l.jsx(m,{[p]:"",ref:C,children:N})});v.displayName=h;function x(y){const S=i(e+"CollectionConsumer",y);return X.useCallback(()=>{const N=S.collectionRef.current;if(!N)return[];const O=Array.from(N.querySelectorAll(`[${p}]`));return Array.from(S.itemMap.values()).sort((E,T)=>O.indexOf(E.ref.current)-O.indexOf(T.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:o,Slot:c,ItemSlot:v},x,n]}function jae(e,t=globalThis?.document){const r=jr(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 _ae="DismissableLayer",aS="dismissableLayer.update",Nae="dismissableLayer.pointerDownOutside",Cae="dismissableLayer.focusOutside",fR,l4=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qu=b.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:u,...d}=e,c=b.useContext(l4),[h,p]=b.useState(null),m=h?.ownerDocument??globalThis?.document,[,v]=b.useState({}),x=at(t,T=>p(T)),y=Array.from(c.layers),[S]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),_=y.indexOf(S),N=h?y.indexOf(h):-1,O=c.layersWithOutsidePointerEventsDisabled.size>0,A=N>=_,C=Pae(T=>{const R=T.target,L=[...c.branches].some(z=>z.contains(R));!A||L||(a?.(T),o?.(T),T.defaultPrevented||u?.())},m),E=Aae(T=>{const R=T.target;[...c.branches].some(z=>z.contains(R))||(i?.(T),o?.(T),T.defaultPrevented||u?.())},m);return jae(T=>{N===c.layers.size-1&&(n?.(T),!T.defaultPrevented&&u&&(T.preventDefault(),u()))},m),b.useEffect(()=>{if(h)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(fR=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(h)),c.layers.add(h),hR(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=fR)}},[h,m,r,c]),b.useEffect(()=>()=>{h&&(c.layers.delete(h),c.layersWithOutsidePointerEventsDisabled.delete(h),hR())},[h,c]),b.useEffect(()=>{const T=()=>v({});return document.addEventListener(aS,T),()=>document.removeEventListener(aS,T)},[]),l.jsx(We.div,{...d,ref:x,style:{pointerEvents:O?A?"auto":"none":void 0,...e.style},onFocusCapture:Ge(e.onFocusCapture,E.onFocusCapture),onBlurCapture:Ge(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Ge(e.onPointerDownCapture,C.onPointerDownCapture)})});qu.displayName=_ae;var Oae="DismissableLayerBranch",Eae=b.forwardRef((e,t)=>{const r=b.useContext(l4),n=b.useRef(null),a=at(t,n);return b.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),l.jsx(We.div,{...e,ref:a})});Eae.displayName=Oae;function Pae(e,t=globalThis?.document){const r=jr(e),n=b.useRef(!1),a=b.useRef(()=>{});return b.useEffect(()=>{const i=u=>{if(u.target&&!n.current){let d=function(){c4(Nae,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},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Aae(e,t=globalThis?.document){const r=jr(e),n=b.useRef(!1);return b.useEffect(()=>{const a=i=>{i.target&&!n.current&&c4(Cae,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 hR(){const e=new CustomEvent(aS);document.dispatchEvent(e)}function c4(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?R6(a,i):a.dispatchEvent(i)}var m1=0;function Bj(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??pR()),document.body.insertAdjacentElement("beforeend",e[1]??pR()),m1++,()=>{m1===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),m1--}},[])}function pR(){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 g1="focusScope.autoFocusOnMount",v1="focusScope.autoFocusOnUnmount",mR={bubbles:!1,cancelable:!0},Tae="FocusScope",Im=b.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=e,[u,d]=b.useState(null),c=jr(a),h=jr(i),p=b.useRef(null),m=at(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(O){if(v.paused||!u)return;const A=O.target;u.contains(A)?p.current=A:mi(p.current,{select:!0})},S=function(O){if(v.paused||!u)return;const A=O.relatedTarget;A!==null&&(u.contains(A)||mi(p.current,{select:!0}))},_=function(O){if(document.activeElement===document.body)for(const C of O)C.removedNodes.length>0&&mi(u)};document.addEventListener("focusin",y),document.addEventListener("focusout",S);const N=new MutationObserver(_);return u&&N.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),N.disconnect()}}},[n,u,v.paused]),b.useEffect(()=>{if(u){vR.add(v);const y=document.activeElement;if(!u.contains(y)){const _=new CustomEvent(g1,mR);u.addEventListener(g1,c),u.dispatchEvent(_),_.defaultPrevented||(kae(Lae(u4(u)),{select:!0}),document.activeElement===y&&mi(u))}return()=>{u.removeEventListener(g1,c),setTimeout(()=>{const _=new CustomEvent(v1,mR);u.addEventListener(v1,h),u.dispatchEvent(_),_.defaultPrevented||mi(y??document.body,{select:!0}),u.removeEventListener(v1,h),vR.remove(v)},0)}}},[u,c,h,v]);const x=b.useCallback(y=>{if(!r&&!n||v.paused)return;const S=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,_=document.activeElement;if(S&&_){const N=y.currentTarget,[O,A]=Rae(N);O&&A?!y.shiftKey&&_===A?(y.preventDefault(),r&&mi(O,{select:!0})):y.shiftKey&&_===O&&(y.preventDefault(),r&&mi(A,{select:!0})):_===N&&y.preventDefault()}},[r,n,v.paused]);return l.jsx(We.div,{tabIndex:-1,...o,ref:m,onKeyDown:x})});Im.displayName=Tae;function kae(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(mi(n,{select:t}),document.activeElement!==r)return}function Rae(e){const t=u4(e),r=gR(t,e),n=gR(t.reverse(),e);return[r,n]}function u4(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 gR(e,t){for(const r of e)if(!Iae(r,{upTo:t}))return r}function Iae(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 Mae(e){return e instanceof HTMLInputElement&&"select"in e}function mi(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Mae(e)&&t&&e.select()}}var vR=Dae();function Dae(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=yR(e,t),e.unshift(t)},remove(t){e=yR(e,t),e[0]?.resume()}}}function yR(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Lae(e){return e.filter(t=>t.tagName!=="A")}var $ae=NS[" useId ".trim().toString()]||(()=>{}),Bae=0;function Lr(e){const[t,r]=b.useState($ae());return Gt(()=>{r(n=>n??String(Bae++))},[e]),e||(t?`radix-${t}`:"")}const Fae=["top","right","bottom","left"],wi=Math.min,Qr=Math.max,Bp=Math.round,Lf=Math.floor,oa=e=>({x:e,y:e}),zae={left:"right",right:"left",bottom:"top",top:"bottom"},qae={start:"end",end:"start"};function iS(e,t,r){return Qr(e,wi(t,r))}function za(e,t){return typeof e=="function"?e(t):e}function qa(e){return e.split("-")[0]}function Nl(e){return e.split("-")[1]}function Fj(e){return e==="x"?"y":"x"}function zj(e){return e==="y"?"height":"width"}const Uae=new Set(["top","bottom"]);function ra(e){return Uae.has(qa(e))?"y":"x"}function qj(e){return Fj(ra(e))}function Vae(e,t,r){r===void 0&&(r=!1);const n=Nl(e),a=qj(e),i=zj(a);let o=a==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=Fp(o)),[o,Fp(o)]}function Hae(e){const t=Fp(e);return[oS(e),t,oS(t)]}function oS(e){return e.replace(/start|end/g,t=>qae[t])}const xR=["left","right"],bR=["right","left"],Wae=["top","bottom"],Gae=["bottom","top"];function Kae(e,t,r){switch(e){case"top":case"bottom":return r?t?bR:xR:t?xR:bR;case"left":case"right":return t?Wae:Gae;default:return[]}}function Xae(e,t,r,n){const a=Nl(e);let i=Kae(qa(e),r==="start",n);return a&&(i=i.map(o=>o+"-"+a),t&&(i=i.concat(i.map(oS)))),i}function Fp(e){return e.replace(/left|right|bottom|top/g,t=>zae[t])}function Yae(e){return{top:0,right:0,bottom:0,left:0,...e}}function d4(e){return typeof e!="number"?Yae(e):{top:e,right:e,bottom:e,left:e}}function zp(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 wR(e,t,r){let{reference:n,floating:a}=e;const i=ra(t),o=qj(t),u=zj(o),d=qa(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(Nl(t)){case"start":v[o]-=m*(r&&c?-1:1);break;case"end":v[o]+=m*(r&&c?-1:1);break}return v}async function Jae(e,t){var r;t===void 0&&(t={});const{x:n,y:a,platform:i,rects:o,elements:u,strategy:d}=e,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:p="floating",altBoundary:m=!1,padding:v=0}=za(t,e),x=d4(v),S=u[m?p==="floating"?"reference":"floating":p],_=zp(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(S)))==null||r?S:S.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(u.floating)),boundary:c,rootBoundary:h,strategy:d})),N=p==="floating"?{x:n,y:a,width:o.floating.width,height:o.floating.height}:o.reference,O=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),A=await(i.isElement==null?void 0:i.isElement(O))?await(i.getScale==null?void 0:i.getScale(O))||{x:1,y:1}:{x:1,y:1},C=zp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:N,offsetParent:O,strategy:d}):N);return{top:(_.top-C.top+x.top)/A.y,bottom:(C.bottom-_.bottom+x.bottom)/A.y,left:(_.left-C.left+x.left)/A.x,right:(C.right-_.right+x.right)/A.x}}const Qae=async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:i=[],platform:o}=r,u=i.filter(Boolean),d=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:h,y:p}=wR(c,n,d),m=n,v={},x=0;for(let S=0;S({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:i,platform:o,elements:u,middlewareData:d}=t,{element:c,padding:h=0}=za(e,t)||{};if(c==null)return{};const p=d4(h),m={x:r,y:n},v=qj(a),x=zj(v),y=await o.getDimensions(c),S=v==="y",_=S?"top":"left",N=S?"bottom":"right",O=S?"clientHeight":"clientWidth",A=i.reference[x]+i.reference[v]-m[v]-i.floating[x],C=m[v]-i.reference[v],E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let T=E?E[O]:0;(!T||!await(o.isElement==null?void 0:o.isElement(E)))&&(T=u.floating[O]||i.floating[x]);const R=A/2-C/2,L=T/2-y[x]/2-1,z=wi(p[_],L),F=wi(p[N],L),B=z,q=T-y[x]-F,H=T/2-y[x]/2+R,V=iS(B,H,q),G=!d.arrow&&Nl(a)!=null&&H!==V&&i.reference[x]/2-(HH<=0)){var F,B;const H=(((F=i.flip)==null?void 0:F.index)||0)+1,V=T[H];if(V&&(!(p==="alignment"?N!==ra(V):!1)||z.every($=>ra($.placement)===N?$.overflows[0]>0:!0)))return{data:{index:H,overflows:z},reset:{placement:V}};let G=(B=z.filter(U=>U.overflows[0]<=0).sort((U,$)=>U.overflows[1]-$.overflows[1])[0])==null?void 0:B.placement;if(!G)switch(v){case"bestFit":{var q;const U=(q=z.filter($=>{if(E){const Q=ra($.placement);return Q===N||Q==="y"}return!0}).map($=>[$.placement,$.overflows.filter(Q=>Q>0).reduce((Q,k)=>Q+k,0)]).sort(($,Q)=>$[1]-Q[1])[0])==null?void 0:q[0];U&&(G=U);break}case"initialPlacement":G=u;break}if(a!==G)return{reset:{placement:G}}}return{}}}};function SR(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function jR(e){return Fae.some(t=>e[t]>=0)}const tie=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...i}=za(e,t);switch(a){case"referenceHidden":{const o=await n.detectOverflow(t,{...i,elementContext:"reference"}),u=SR(o,r.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:jR(u)}}}case"escaped":{const o=await n.detectOverflow(t,{...i,altBoundary:!0}),u=SR(o,r.floating);return{data:{escapedOffsets:u,escaped:jR(u)}}}default:return{}}}}},f4=new Set(["left","top"]);async function rie(e,t){const{placement:r,platform:n,elements:a}=e,i=await(n.isRTL==null?void 0:n.isRTL(a.floating)),o=qa(r),u=Nl(r),d=ra(r)==="y",c=f4.has(o)?-1:1,h=i&&d?-1:1,p=za(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 nie=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:i,placement:o,middlewareData:u}=t,d=await rie(t,e);return o===((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:o}}}}},aie=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:o=!0,crossAxis:u=!1,limiter:d={fn:_=>{let{x:N,y:O}=_;return{x:N,y:O}}},...c}=za(e,t),h={x:r,y:n},p=await i.detectOverflow(t,c),m=ra(qa(a)),v=Fj(m);let x=h[v],y=h[m];if(o){const _=v==="y"?"top":"left",N=v==="y"?"bottom":"right",O=x+p[_],A=x-p[N];x=iS(O,x,A)}if(u){const _=m==="y"?"top":"left",N=m==="y"?"bottom":"right",O=y+p[_],A=y-p[N];y=iS(O,y,A)}const S=d.fn({...t,[v]:x,[m]:y});return{...S,data:{x:S.x-r,y:S.y-n,enabled:{[v]:o,[m]:u}}}}}},iie=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:i,middlewareData:o}=t,{offset:u=0,mainAxis:d=!0,crossAxis:c=!0}=za(e,t),h={x:r,y:n},p=ra(a),m=Fj(p);let v=h[m],x=h[p];const y=za(u,t),S=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(d){const O=m==="y"?"height":"width",A=i.reference[m]-i.floating[O]+S.mainAxis,C=i.reference[m]+i.reference[O]-S.mainAxis;vC&&(v=C)}if(c){var _,N;const O=m==="y"?"width":"height",A=f4.has(qa(a)),C=i.reference[p]-i.floating[O]+(A&&((_=o.offset)==null?void 0:_[p])||0)+(A?0:S.crossAxis),E=i.reference[p]+i.reference[O]+(A?0:((N=o.offset)==null?void 0:N[p])||0)-(A?S.crossAxis:0);xE&&(x=E)}return{[m]:v,[p]:x}}}},oie=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:i,platform:o,elements:u}=t,{apply:d=()=>{},...c}=za(e,t),h=await o.detectOverflow(t,c),p=qa(a),m=Nl(a),v=ra(a)==="y",{width:x,height:y}=i.floating;let S,_;p==="top"||p==="bottom"?(S=p,_=m===(await(o.isRTL==null?void 0:o.isRTL(u.floating))?"start":"end")?"left":"right"):(_=p,S=m==="end"?"top":"bottom");const N=y-h.top-h.bottom,O=x-h.left-h.right,A=wi(y-h[S],N),C=wi(x-h[_],O),E=!t.middlewareData.shift;let T=A,R=C;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(R=O),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(T=N),E&&!m){const z=Qr(h.left,0),F=Qr(h.right,0),B=Qr(h.top,0),q=Qr(h.bottom,0);v?R=x-2*(z!==0||F!==0?z+F:Qr(h.left,h.right)):T=y-2*(B!==0||q!==0?B+q:Qr(h.top,h.bottom))}await d({...t,availableWidth:R,availableHeight:T});const L=await o.getDimensions(u.floating);return x!==L.width||y!==L.height?{reset:{rects:!0}}:{}}}};function Mm(){return typeof window<"u"}function Cl(e){return h4(e)?(e.nodeName||"").toLowerCase():"#document"}function rn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pa(e){var t;return(t=(h4(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function h4(e){return Mm()?e instanceof Node||e instanceof rn(e).Node:!1}function Hn(e){return Mm()?e instanceof Element||e instanceof rn(e).Element:!1}function ca(e){return Mm()?e instanceof HTMLElement||e instanceof rn(e).HTMLElement:!1}function _R(e){return!Mm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof rn(e).ShadowRoot}const sie=new Set(["inline","contents"]);function Uu(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Wn(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!sie.has(a)}const lie=new Set(["table","td","th"]);function cie(e){return lie.has(Cl(e))}const uie=[":popover-open",":modal"];function Dm(e){return uie.some(t=>{try{return e.matches(t)}catch{return!1}})}const die=["transform","translate","scale","rotate","perspective"],fie=["transform","translate","scale","rotate","perspective","filter"],hie=["paint","layout","strict","content"];function Uj(e){const t=Vj(),r=Hn(e)?Wn(e):e;return die.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)||fie.some(n=>(r.willChange||"").includes(n))||hie.some(n=>(r.contain||"").includes(n))}function pie(e){let t=Si(e);for(;ca(t)&&!ul(t);){if(Uj(t))return t;if(Dm(t))return null;t=Si(t)}return null}function Vj(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const mie=new Set(["html","body","#document"]);function ul(e){return mie.has(Cl(e))}function Wn(e){return rn(e).getComputedStyle(e)}function Lm(e){return Hn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Si(e){if(Cl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||_R(e)&&e.host||pa(e);return _R(t)?t.host:t}function p4(e){const t=Si(e);return ul(t)?e.ownerDocument?e.ownerDocument.body:e.body:ca(t)&&Uu(t)?t:p4(t)}function Ou(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const a=p4(e),i=a===((n=e.ownerDocument)==null?void 0:n.body),o=rn(a);if(i){const u=sS(o);return t.concat(o,o.visualViewport||[],Uu(a)?a:[],u&&r?Ou(u):[])}return t.concat(a,Ou(a,[],r))}function sS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function m4(e){const t=Wn(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=ca(e),i=a?e.offsetWidth:r,o=a?e.offsetHeight:n,u=Bp(r)!==i||Bp(n)!==o;return u&&(r=i,n=o),{width:r,height:n,$:u}}function Hj(e){return Hn(e)?e:e.contextElement}function ks(e){const t=Hj(e);if(!ca(t))return oa(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:i}=m4(t);let o=(i?Bp(r.width):r.width)/n,u=(i?Bp(r.height):r.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!u||!Number.isFinite(u))&&(u=1),{x:o,y:u}}const gie=oa(0);function g4(e){const t=rn(e);return!Vj()||!t.visualViewport?gie:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function vie(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==rn(e)?!1:t}function So(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const a=e.getBoundingClientRect(),i=Hj(e);let o=oa(1);t&&(n?Hn(n)&&(o=ks(n)):o=ks(e));const u=vie(i,r,n)?g4(i):oa(0);let d=(a.left+u.x)/o.x,c=(a.top+u.y)/o.y,h=a.width/o.x,p=a.height/o.y;if(i){const m=rn(i),v=n&&Hn(n)?rn(n):n;let x=m,y=sS(x);for(;y&&n&&v!==x;){const S=ks(y),_=y.getBoundingClientRect(),N=Wn(y),O=_.left+(y.clientLeft+parseFloat(N.paddingLeft))*S.x,A=_.top+(y.clientTop+parseFloat(N.paddingTop))*S.y;d*=S.x,c*=S.y,h*=S.x,p*=S.y,d+=O,c+=A,x=rn(y),y=sS(x)}}return zp({width:h,height:p,x:d,y:c})}function $m(e,t){const r=Lm(e).scrollLeft;return t?t.left+r:So(pa(e)).left+r}function v4(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-$m(e,r),a=r.top+t.scrollTop;return{x:n,y:a}}function yie(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const i=a==="fixed",o=pa(n),u=t?Dm(t.floating):!1;if(n===o||u&&i)return r;let d={scrollLeft:0,scrollTop:0},c=oa(1);const h=oa(0),p=ca(n);if((p||!p&&!i)&&((Cl(n)!=="body"||Uu(o))&&(d=Lm(n)),ca(n))){const v=So(n);c=ks(n),h.x=v.x+n.clientLeft,h.y=v.y+n.clientTop}const m=o&&!p&&!i?v4(o,d):oa(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 xie(e){return Array.from(e.getClientRects())}function bie(e){const t=pa(e),r=Lm(e),n=e.ownerDocument.body,a=Qr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=Qr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+$m(e);const u=-r.scrollTop;return Wn(n).direction==="rtl"&&(o+=Qr(t.clientWidth,n.clientWidth)-a),{width:a,height:i,x:o,y:u}}const NR=25;function wie(e,t){const r=rn(e),n=pa(e),a=r.visualViewport;let i=n.clientWidth,o=n.clientHeight,u=0,d=0;if(a){i=a.width,o=a.height;const h=Vj();(!h||h&&t==="fixed")&&(u=a.offsetLeft,d=a.offsetTop)}const c=$m(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<=NR&&(i-=x)}else c<=NR&&(i+=c);return{width:i,height:o,x:u,y:d}}const Sie=new Set(["absolute","fixed"]);function jie(e,t){const r=So(e,!0,t==="fixed"),n=r.top+e.clientTop,a=r.left+e.clientLeft,i=ca(e)?ks(e):oa(1),o=e.clientWidth*i.x,u=e.clientHeight*i.y,d=a*i.x,c=n*i.y;return{width:o,height:u,x:d,y:c}}function CR(e,t,r){let n;if(t==="viewport")n=wie(e,r);else if(t==="document")n=bie(pa(e));else if(Hn(t))n=jie(t,r);else{const a=g4(e);n={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return zp(n)}function y4(e,t){const r=Si(e);return r===t||!Hn(r)||ul(r)?!1:Wn(r).position==="fixed"||y4(r,t)}function _ie(e,t){const r=t.get(e);if(r)return r;let n=Ou(e,[],!1).filter(u=>Hn(u)&&Cl(u)!=="body"),a=null;const i=Wn(e).position==="fixed";let o=i?Si(e):e;for(;Hn(o)&&!ul(o);){const u=Wn(o),d=Uj(o);!d&&u.position==="fixed"&&(a=null),(i?!d&&!a:!d&&u.position==="static"&&!!a&&Sie.has(a.position)||Uu(o)&&!d&&y4(e,o))?n=n.filter(h=>h!==o):a=u,o=Si(o)}return t.set(e,n),n}function Nie(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const o=[...r==="clippingAncestors"?Dm(t)?[]:_ie(t,this._c):[].concat(r),n],u=o[0],d=o.reduce((c,h)=>{const p=CR(t,h,a);return c.top=Qr(p.top,c.top),c.right=wi(p.right,c.right),c.bottom=wi(p.bottom,c.bottom),c.left=Qr(p.left,c.left),c},CR(t,u,a));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function Cie(e){const{width:t,height:r}=m4(e);return{width:t,height:r}}function Oie(e,t,r){const n=ca(t),a=pa(t),i=r==="fixed",o=So(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const d=oa(0);function c(){d.x=$m(a)}if(n||!n&&!i)if((Cl(t)!=="body"||Uu(a))&&(u=Lm(t)),n){const v=So(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?v4(a,u):oa(0),p=o.left+u.scrollLeft-d.x-h.x,m=o.top+u.scrollTop-d.y-h.y;return{x:p,y:m,width:o.width,height:o.height}}function y1(e){return Wn(e).position==="static"}function OR(e,t){if(!ca(e)||Wn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return pa(e)===r&&(r=r.ownerDocument.body),r}function x4(e,t){const r=rn(e);if(Dm(e))return r;if(!ca(e)){let a=Si(e);for(;a&&!ul(a);){if(Hn(a)&&!y1(a))return a;a=Si(a)}return r}let n=OR(e,t);for(;n&&cie(n)&&y1(n);)n=OR(n,t);return n&&ul(n)&&y1(n)&&!Uj(n)?r:n||pie(e)||r}const Eie=async function(e){const t=this.getOffsetParent||x4,r=this.getDimensions,n=await r(e.floating);return{reference:Oie(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Pie(e){return Wn(e).direction==="rtl"}const Aie={convertOffsetParentRelativeRectToViewportRelativeRect:yie,getDocumentElement:pa,getClippingRect:Nie,getOffsetParent:x4,getElementRects:Eie,getClientRects:xie,getDimensions:Cie,getScale:ks,isElement:Hn,isRTL:Pie};function b4(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Tie(e,t){let r=null,n;const a=pa(e);function i(){var u;clearTimeout(n),(u=r)==null||u.disconnect(),r=null}function o(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=Lf(p),y=Lf(a.clientWidth-(h+m)),S=Lf(a.clientHeight-(p+v)),_=Lf(h),O={rootMargin:-x+"px "+-y+"px "+-S+"px "+-_+"px",threshold:Qr(0,wi(1,d))||1};let A=!0;function C(E){const T=E[0].intersectionRatio;if(T!==d){if(!A)return o();T?o(!1,T):n=setTimeout(()=>{o(!1,1e-7)},1e3)}T===1&&!b4(c,e.getBoundingClientRect())&&o(),A=!1}try{r=new IntersectionObserver(C,{...O,root:a.ownerDocument})}catch{r=new IntersectionObserver(C,O)}r.observe(e)}return o(!0),i}function kie(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=n,c=Hj(e),h=a||i?[...c?Ou(c):[],...Ou(t)]:[];h.forEach(_=>{a&&_.addEventListener("scroll",r,{passive:!0}),i&&_.addEventListener("resize",r)});const p=c&&u?Tie(c,r):null;let m=-1,v=null;o&&(v=new ResizeObserver(_=>{let[N]=_;N&&N.target===c&&v&&(v.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var O;(O=v)==null||O.observe(t)})),r()}),c&&!d&&v.observe(c),v.observe(t));let x,y=d?So(e):null;d&&S();function S(){const _=So(e);y&&!b4(y,_)&&r(),y=_,x=requestAnimationFrame(S)}return r(),()=>{var _;h.forEach(N=>{a&&N.removeEventListener("scroll",r),i&&N.removeEventListener("resize",r)}),p?.(),(_=v)==null||_.disconnect(),v=null,d&&cancelAnimationFrame(x)}}const Rie=nie,Iie=aie,Mie=eie,Die=oie,Lie=tie,ER=Zae,$ie=iie,Bie=(e,t,r)=>{const n=new Map,a={platform:Aie,...r},i={...a.platform,_c:n};return Qae(e,t,{...a,platform:i})};var Fie=typeof document<"u",zie=function(){},Ch=Fie?b.useLayoutEffect:zie;function qp(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(!qp(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)&&!qp(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function w4(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function PR(e,t){const r=w4(e);return Math.round(t*r)/r}function x1(e){const t=b.useRef(e);return Ch(()=>{t.current=e}),t}function qie(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:i,floating:o}={},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);qp(m,n)||v(n);const[x,y]=b.useState(null),[S,_]=b.useState(null),N=b.useCallback($=>{$!==E.current&&(E.current=$,y($))},[]),O=b.useCallback($=>{$!==T.current&&(T.current=$,_($))},[]),A=i||x,C=o||S,E=b.useRef(null),T=b.useRef(null),R=b.useRef(h),L=d!=null,z=x1(d),F=x1(a),B=x1(c),q=b.useCallback(()=>{if(!E.current||!T.current)return;const $={placement:t,strategy:r,middleware:m};F.current&&($.platform=F.current),Bie(E.current,T.current,$).then(Q=>{const k={...Q,isPositioned:B.current!==!1};H.current&&!qp(R.current,k)&&(R.current=k,ku.flushSync(()=>{p(k)}))})},[m,t,r,F,B]);Ch(()=>{c===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,p($=>({...$,isPositioned:!1})))},[c]);const H=b.useRef(!1);Ch(()=>(H.current=!0,()=>{H.current=!1}),[]),Ch(()=>{if(A&&(E.current=A),C&&(T.current=C),A&&C){if(z.current)return z.current(A,C,q);q()}},[A,C,q,z,L]);const V=b.useMemo(()=>({reference:E,floating:T,setReference:N,setFloating:O}),[N,O]),G=b.useMemo(()=>({reference:A,floating:C}),[A,C]),U=b.useMemo(()=>{const $={position:r,left:0,top:0};if(!G.floating)return $;const Q=PR(G.floating,h.x),k=PR(G.floating,h.y);return u?{...$,transform:"translate("+Q+"px, "+k+"px)",...w4(G.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:Q,top:k}},[r,u,G.floating,h.x,h.y]);return b.useMemo(()=>({...h,update:q,refs:V,elements:G,floatingStyles:U}),[h,q,V,G,U])}const Uie=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?ER({element:n.current,padding:a}).fn(r):{}:n?ER({element:n,padding:a}).fn(r):{}}}},Vie=(e,t)=>({...Rie(e),options:[e,t]}),Hie=(e,t)=>({...Iie(e),options:[e,t]}),Wie=(e,t)=>({...$ie(e),options:[e,t]}),Gie=(e,t)=>({...Mie(e),options:[e,t]}),Kie=(e,t)=>({...Die(e),options:[e,t]}),Xie=(e,t)=>({...Lie(e),options:[e,t]}),Yie=(e,t)=>({...Uie(e),options:[e,t]});var Jie="Arrow",S4=b.forwardRef((e,t)=>{const{children:r,width:n=10,height:a=5,...i}=e;return l.jsx(We.svg,{...i,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});S4.displayName=Jie;var Qie=S4;function Wj(e){const[t,r]=b.useState(void 0);return Gt(()=>{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 o,u;if("borderBoxSize"in i){const d=i.borderBoxSize,c=Array.isArray(d)?d[0]:d;o=c.inlineSize,u=c.blockSize}else o=e.offsetWidth,u=e.offsetHeight;r({width:o,height:u})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var Gj="Popper",[j4,Ol]=Ua(Gj),[Zie,_4]=j4(Gj),N4=e=>{const{__scopePopper:t,children:r}=e,[n,a]=b.useState(null);return l.jsx(Zie,{scope:t,anchor:n,onAnchorChange:a,children:r})};N4.displayName=Gj;var C4="PopperAnchor",O4=b.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...a}=e,i=_4(C4,r),o=b.useRef(null),u=at(t,o),d=b.useRef(null);return b.useEffect(()=>{const c=d.current;d.current=n?.current||o.current,c!==d.current&&i.onAnchorChange(d.current)}),n?null:l.jsx(We.div,{...a,ref:u})});O4.displayName=C4;var Kj="PopperContent",[eoe,toe]=j4(Kj),E4=b.forwardRef((e,t)=>{const{__scopePopper:r,side:n="bottom",sideOffset:a=0,align:i="center",alignOffset:o=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,S=_4(Kj,r),[_,N]=b.useState(null),O=at(t,K=>N(K)),[A,C]=b.useState(null),E=Wj(A),T=E?.width??0,R=E?.height??0,L=n+(i!=="center"?"-"+i:""),z=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},F=Array.isArray(c)?c:[c],B=F.length>0,q={padding:z,boundary:F.filter(noe),altBoundary:B},{refs:H,floatingStyles:V,placement:G,isPositioned:U,middlewareData:$}=qie({strategy:"fixed",placement:L,whileElementsMounted:(...K)=>kie(...K,{animationFrame:v==="always"}),elements:{reference:S.anchor},middleware:[Vie({mainAxis:a+R,alignmentAxis:o}),d&&Hie({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Wie():void 0,...q}),d&&Gie({...q}),Kie({...q,apply:({elements:K,rects:J,availableWidth:ee,availableHeight:ce})=>{const{width:pe,height:W}=J.reference,_e=K.floating.style;_e.setProperty("--radix-popper-available-width",`${ee}px`),_e.setProperty("--radix-popper-available-height",`${ce}px`),_e.setProperty("--radix-popper-anchor-width",`${pe}px`),_e.setProperty("--radix-popper-anchor-height",`${W}px`)}}),A&&Yie({element:A,padding:u}),aoe({arrowWidth:T,arrowHeight:R}),m&&Xie({strategy:"referenceHidden",...q})]}),[Q,k]=T4(G),I=jr(x);Gt(()=>{U&&I?.()},[U,I]);const D=$.arrow?.x,Z=$.arrow?.y,ie=$.arrow?.centerOffset!==0,[oe,ne]=b.useState();return Gt(()=>{_&&ne(window.getComputedStyle(_).zIndex)},[_]),l.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:U?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[$.transformOrigin?.x,$.transformOrigin?.y].join(" "),...$.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(eoe,{scope:r,placedSide:Q,onArrowChange:C,arrowX:D,arrowY:Z,shouldHideArrow:ie,children:l.jsx(We.div,{"data-side":Q,"data-align":k,...y,ref:O,style:{...y.style,animation:U?void 0:"none"}})})})});E4.displayName=Kj;var P4="PopperArrow",roe={top:"bottom",right:"left",bottom:"top",left:"right"},A4=b.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,i=toe(P4,n),o=roe[i.placedSide];return l.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]: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:l.jsx(Qie,{...a,ref:r,style:{...a.style,display:"block"}})})});A4.displayName=P4;function noe(e){return e!==null}var aoe=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,o=a.arrow?.centerOffset!==0,u=o?0:e.arrowWidth,d=o?0:e.arrowHeight,[c,h]=T4(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=o?p:`${m}px`,y=`${-d}px`):c==="top"?(x=o?p:`${m}px`,y=`${n.floating.height+d}px`):c==="right"?(x=`${-d}px`,y=o?p:`${v}px`):c==="left"&&(x=`${n.floating.width+d}px`,y=o?p:`${v}px`),{data:{x,y}}}});function T4(e){const[t,r="center"]=e.split("-");return[t,r]}var Xj=N4,Bm=O4,Yj=E4,Jj=A4,ioe="Portal",Vu=b.forwardRef((e,t)=>{const{container:r,...n}=e,[a,i]=b.useState(!1);Gt(()=>i(!0),[]);const o=r||a&&globalThis?.document?.body;return o?N6.createPortal(l.jsx(We.div,{...n,ref:t}),o):null});Vu.displayName=ioe;function ooe(e){const t=soe(e),r=b.forwardRef((n,a)=>{const{children:i,...o}=n,u=b.Children.toArray(i),d=u.find(coe);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 l.jsx(t,{...o,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,h):null})}return l.jsx(t,{...o,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function soe(e){const t=b.forwardRef((r,n)=>{const{children:a,...i}=r;if(b.isValidElement(a)){const o=doe(a),u=uoe(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Sn(n,o):o),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var loe=Symbol("radix.slottable");function coe(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===loe}function uoe(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 doe(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 foe=NS[" useInsertionEffect ".trim().toString()]||Gt;function jo({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,i,o]=hoe({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=poe(h)?h(e):h;p!==e&&o.current?.(p)}else i(h)},[u,e,i,o]);return[d,c]}function hoe({defaultProp:e,onChange:t}){const[r,n]=b.useState(e),a=b.useRef(r),i=b.useRef(t);return foe(()=>{i.current=t},[t]),b.useEffect(()=>{a.current!==r&&(i.current?.(r),a.current=r)},[r,a]),[r,n,i]}function poe(e){return typeof e=="function"}function Qj(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 k4=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"}),moe="VisuallyHidden",R4=b.forwardRef((e,t)=>l.jsx(We.span,{...e,ref:t,style:{...k4,...e.style}}));R4.displayName=moe;var goe=R4,voe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},hs=new WeakMap,$f=new WeakMap,Bf={},b1=0,I4=function(e){return e&&(e.host||I4(e.parentNode))},yoe=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=I4(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})},xoe=function(e,t,r,n){var a=yoe(t,Array.isArray(e)?e:[e]);Bf[r]||(Bf[r]=new WeakMap);var i=Bf[r],o=[],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=(hs.get(m)||0)+1,S=(i.get(m)||0)+1;hs.set(m,y),i.set(m,S),o.push(m),y===1&&x&&$f.set(m,!0),S===1&&m.setAttribute(r,"true"),x||m.setAttribute(n,"true")}catch(_){console.error("aria-hidden: cannot operate on ",m,_)}})};return h(t),u.clear(),b1++,function(){o.forEach(function(p){var m=hs.get(p)-1,v=i.get(p)-1;hs.set(p,m),i.set(p,v),m||($f.has(p)||p.removeAttribute(n),$f.delete(p)),v||p.removeAttribute(r)}),b1--,b1||(hs=new WeakMap,hs=new WeakMap,$f=new WeakMap,Bf={})}},Zj=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=voe(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),xoe(n,a,r,"aria-hidden")):function(){return null}},ea=function(){return ea=Object.assign||function(t){for(var r,n=1,a=arguments.length;n"u")return Doe;var t=Loe(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])}},Boe=$4(),Rs="data-scroll-locked",Foe=function(e,t,r,n){var a=e.left,i=e.top,o=e.right,u=e.gap;return r===void 0&&(r="margin"),` + .`.concat(woe,` { + overflow: hidden `).concat(n,`; + padding-right: `).concat(u,"px ").concat(n,`; + } + body[`).concat(Rs,`] { + 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(o,`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(Oh,` { + right: `).concat(u,"px ").concat(n,`; + } + + .`).concat(Eh,` { + margin-right: `).concat(u,"px ").concat(n,`; + } + + .`).concat(Oh," .").concat(Oh,` { + right: 0 `).concat(n,`; + } + + .`).concat(Eh," .").concat(Eh,` { + margin-right: 0 `).concat(n,`; + } + + body[`).concat(Rs,`] { + `).concat(Soe,": ").concat(u,`px; + } +`)},TR=function(){var e=parseInt(document.body.getAttribute(Rs)||"0",10);return isFinite(e)?e:0},zoe=function(){b.useEffect(function(){return document.body.setAttribute(Rs,(TR()+1).toString()),function(){var e=TR()-1;e<=0?document.body.removeAttribute(Rs):document.body.setAttribute(Rs,e.toString())}},[])},qoe=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=n===void 0?"margin":n;zoe();var i=b.useMemo(function(){return $oe(a)},[a]);return b.createElement(Boe,{styles:Foe(i,!t,a,r?"":"!important")})},lS=!1;if(typeof window<"u")try{var Ff=Object.defineProperty({},"passive",{get:function(){return lS=!0,!0}});window.addEventListener("test",Ff,Ff),window.removeEventListener("test",Ff,Ff)}catch{lS=!1}var ps=lS?{passive:!1}:!1,Uoe=function(e){return e.tagName==="TEXTAREA"},B4=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!Uoe(e)&&r[t]==="visible")},Voe=function(e){return B4(e,"overflowY")},Hoe=function(e){return B4(e,"overflowX")},kR=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=F4(e,n);if(a){var i=z4(e,n),o=i[1],u=i[2];if(o>u)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Woe=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},Goe=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},F4=function(e,t){return e==="v"?Voe(t):Hoe(t)},z4=function(e,t){return e==="v"?Woe(t):Goe(t)},Koe=function(e,t){return e==="h"&&t==="rtl"?-1:1},Xoe=function(e,t,r,n,a){var i=Koe(e,window.getComputedStyle(t).direction),o=i*n,u=r.target,d=t.contains(u),c=!1,h=o>0,p=0,m=0;do{if(!u)break;var v=z4(e,u),x=v[0],y=v[1],S=v[2],_=y-S-i*x;(x||_)&&F4(e,u)&&(p+=_,m+=x);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(h&&Math.abs(p)<1||!h&&Math.abs(m)<1)&&(c=!0),c},zf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},RR=function(e){return[e.deltaX,e.deltaY]},IR=function(e){return e&&"current"in e?e.current:e},Yoe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Joe=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},Qoe=0,ms=[];function Zoe(e){var t=b.useRef([]),r=b.useRef([0,0]),n=b.useRef(),a=b.useState(Qoe++)[0],i=b.useState($4)[0],o=b.useRef(e);b.useEffect(function(){o.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var y=boe([e.lockRef.current],(e.shards||[]).map(IR),!0).filter(Boolean);return y.forEach(function(S){return S.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),y.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var u=b.useCallback(function(y,S){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!o.current.allowPinchZoom;var _=zf(y),N=r.current,O="deltaX"in y?y.deltaX:N[0]-_[0],A="deltaY"in y?y.deltaY:N[1]-_[1],C,E=y.target,T=Math.abs(O)>Math.abs(A)?"h":"v";if("touches"in y&&T==="h"&&E.type==="range")return!1;var R=window.getSelection(),L=R&&R.anchorNode,z=L?L===E||L.contains(E):!1;if(z)return!1;var F=kR(T,E);if(!F)return!0;if(F?C=T:(C=T==="v"?"h":"v",F=kR(T,E)),!F)return!1;if(!n.current&&"changedTouches"in y&&(O||A)&&(n.current=C),!C)return!0;var B=n.current||C;return Xoe(B,S,y,B==="h"?O:A)},[]),d=b.useCallback(function(y){var S=y;if(!(!ms.length||ms[ms.length-1]!==i)){var _="deltaY"in S?RR(S):zf(S),N=t.current.filter(function(C){return C.name===S.type&&(C.target===S.target||S.target===C.shadowParent)&&Yoe(C.delta,_)})[0];if(N&&N.should){S.cancelable&&S.preventDefault();return}if(!N){var O=(o.current.shards||[]).map(IR).filter(Boolean).filter(function(C){return C.contains(S.target)}),A=O.length>0?u(S,O[0]):!o.current.noIsolation;A&&S.cancelable&&S.preventDefault()}}},[]),c=b.useCallback(function(y,S,_,N){var O={name:y,delta:S,target:_,should:N,shadowParent:ese(_)};t.current.push(O),setTimeout(function(){t.current=t.current.filter(function(A){return A!==O})},1)},[]),h=b.useCallback(function(y){r.current=zf(y),n.current=void 0},[]),p=b.useCallback(function(y){c(y.type,RR(y),y.target,u(y,e.lockRef.current))},[]),m=b.useCallback(function(y){c(y.type,zf(y),y.target,u(y,e.lockRef.current))},[]);b.useEffect(function(){return ms.push(i),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",d,ps),document.addEventListener("touchmove",d,ps),document.addEventListener("touchstart",h,ps),function(){ms=ms.filter(function(y){return y!==i}),document.removeEventListener("wheel",d,ps),document.removeEventListener("touchmove",d,ps),document.removeEventListener("touchstart",h,ps)}},[]);var v=e.removeScrollBar,x=e.inert;return b.createElement(b.Fragment,null,x?b.createElement(i,{styles:Joe(a)}):null,v?b.createElement(qoe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ese(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const tse=Poe(L4,Zoe);var zm=b.forwardRef(function(e,t){return b.createElement(Fm,ea({},e,{ref:t,sideCar:tse}))});zm.classNames=Fm.classNames;var rse=[" ","Enter","ArrowUp","ArrowDown"],nse=[" ","Enter"],_o="Select",[qm,Um,ase]=Sae(_o),[El]=Ua(_o,[ase,Ol]),Vm=Ol(),[ise,Ri]=El(_o),[ose,sse]=El(_o),q4=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:a,onOpenChange:i,value:o,defaultValue:u,onValueChange:d,dir:c,name:h,autoComplete:p,disabled:m,required:v,form:x}=e,y=Vm(t),[S,_]=b.useState(null),[N,O]=b.useState(null),[A,C]=b.useState(!1),E=yM(c),[T,R]=jo({prop:n,defaultProp:a??!1,onChange:i,caller:_o}),[L,z]=jo({prop:o,defaultProp:u,onChange:d,caller:_o}),F=b.useRef(null),B=S?x||!!S.closest("form"):!0,[q,H]=b.useState(new Set),V=Array.from(q).map(G=>G.props.value).join(";");return l.jsx(Xj,{...y,children:l.jsxs(ise,{required:v,scope:t,trigger:S,onTriggerChange:_,valueNode:N,onValueNodeChange:O,valueNodeHasChildren:A,onValueNodeHasChildrenChange:C,contentId:Lr(),value:L,onValueChange:z,open:T,onOpenChange:R,dir:E,triggerPointerDownPosRef:F,disabled:m,children:[l.jsx(qm.Provider,{scope:t,children:l.jsx(ose,{scope:e.__scopeSelect,onNativeOptionAdd:b.useCallback(G=>{H(U=>new Set(U).add(G))},[]),onNativeOptionRemove:b.useCallback(G=>{H(U=>{const $=new Set(U);return $.delete(G),$})},[]),children:r})}),B?l.jsxs(u3,{"aria-hidden":!0,required:v,tabIndex:-1,name:h,autoComplete:p,value:L,onChange:G=>z(G.target.value),disabled:m,form:x,children:[L===void 0?l.jsx("option",{value:""}):null,Array.from(q)]},V):null]})})};q4.displayName=_o;var U4="SelectTrigger",V4=b.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...a}=e,i=Vm(r),o=Ri(U4,r),u=o.disabled||n,d=at(t,o.onTriggerChange),c=Um(r),h=b.useRef("touch"),[p,m,v]=f3(y=>{const S=c().filter(O=>!O.disabled),_=S.find(O=>O.value===o.value),N=h3(S,y,_);N!==void 0&&o.onValueChange(N.value)}),x=y=>{u||(o.onOpenChange(!0),v()),y&&(o.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)})};return l.jsx(Bm,{asChild:!0,...i,children:l.jsx(We.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":d3(o.value)?"":void 0,...a,ref:d,onClick:Ge(a.onClick,y=>{y.currentTarget.focus(),h.current!=="mouse"&&x(y)}),onPointerDown:Ge(a.onPointerDown,y=>{h.current=y.pointerType;const S=y.target;S.hasPointerCapture(y.pointerId)&&S.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&y.pointerType==="mouse"&&(x(y),y.preventDefault())}),onKeyDown:Ge(a.onKeyDown,y=>{const S=p.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&m(y.key),!(S&&y.key===" ")&&rse.includes(y.key)&&(x(),y.preventDefault())})})})});V4.displayName=U4;var H4="SelectValue",W4=b.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,children:i,placeholder:o="",...u}=e,d=Ri(H4,r),{onValueNodeHasChildrenChange:c}=d,h=i!==void 0,p=at(t,d.onValueNodeChange);return Gt(()=>{c(h)},[c,h]),l.jsx(We.span,{...u,ref:p,style:{pointerEvents:"none"},children:d3(d.value)?l.jsx(l.Fragment,{children:o}):i})});W4.displayName=H4;var lse="SelectIcon",G4=b.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...a}=e;return l.jsx(We.span,{"aria-hidden":!0,...a,ref:t,children:n||"▼"})});G4.displayName=lse;var cse="SelectPortal",K4=e=>l.jsx(Vu,{asChild:!0,...e});K4.displayName=cse;var No="SelectContent",X4=b.forwardRef((e,t)=>{const r=Ri(No,e.__scopeSelect),[n,a]=b.useState();if(Gt(()=>{a(new DocumentFragment)},[]),!r.open){const i=n;return i?ku.createPortal(l.jsx(Y4,{scope:e.__scopeSelect,children:l.jsx(qm.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),i):null}return l.jsx(J4,{...e,ref:t})});X4.displayName=No;var Dn=10,[Y4,Ii]=El(No),use="SelectContentImpl",dse=ooe("SelectContent.RemoveScroll"),J4=b.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:u,sideOffset:d,align:c,alignOffset:h,arrowPadding:p,collisionBoundary:m,collisionPadding:v,sticky:x,hideWhenDetached:y,avoidCollisions:S,..._}=e,N=Ri(No,r),[O,A]=b.useState(null),[C,E]=b.useState(null),T=at(t,K=>A(K)),[R,L]=b.useState(null),[z,F]=b.useState(null),B=Um(r),[q,H]=b.useState(!1),V=b.useRef(!1);b.useEffect(()=>{if(O)return Zj(O)},[O]),Bj();const G=b.useCallback(K=>{const[J,...ee]=B().map(W=>W.ref.current),[ce]=ee.slice(-1),pe=document.activeElement;for(const W of K)if(W===pe||(W?.scrollIntoView({block:"nearest"}),W===J&&C&&(C.scrollTop=0),W===ce&&C&&(C.scrollTop=C.scrollHeight),W?.focus(),document.activeElement!==pe))return},[B,C]),U=b.useCallback(()=>G([R,O]),[G,R,O]);b.useEffect(()=>{q&&U()},[q,U]);const{onOpenChange:$,triggerPointerDownPosRef:Q}=N;b.useEffect(()=>{if(O){let K={x:0,y:0};const J=ce=>{K={x:Math.abs(Math.round(ce.pageX)-(Q.current?.x??0)),y:Math.abs(Math.round(ce.pageY)-(Q.current?.y??0))}},ee=ce=>{K.x<=10&&K.y<=10?ce.preventDefault():O.contains(ce.target)||$(!1),document.removeEventListener("pointermove",J),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",J),document.addEventListener("pointerup",ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",J),document.removeEventListener("pointerup",ee,{capture:!0})}}},[O,$,Q]),b.useEffect(()=>{const K=()=>$(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[$]);const[k,I]=f3(K=>{const J=B().filter(pe=>!pe.disabled),ee=J.find(pe=>pe.ref.current===document.activeElement),ce=h3(J,K,ee);ce&&setTimeout(()=>ce.ref.current.focus())}),D=b.useCallback((K,J,ee)=>{const ce=!V.current&&!ee;(N.value!==void 0&&N.value===J||ce)&&(L(K),ce&&(V.current=!0))},[N.value]),Z=b.useCallback(()=>O?.focus(),[O]),ie=b.useCallback((K,J,ee)=>{const ce=!V.current&&!ee;(N.value!==void 0&&N.value===J||ce)&&F(K)},[N.value]),oe=n==="popper"?cS:Q4,ne=oe===cS?{side:u,sideOffset:d,align:c,alignOffset:h,arrowPadding:p,collisionBoundary:m,collisionPadding:v,sticky:x,hideWhenDetached:y,avoidCollisions:S}:{};return l.jsx(Y4,{scope:r,content:O,viewport:C,onViewportChange:E,itemRefCallback:D,selectedItem:R,onItemLeave:Z,itemTextRefCallback:ie,focusSelectedItem:U,selectedItemText:z,position:n,isPositioned:q,searchRef:k,children:l.jsx(zm,{as:dse,allowPinchZoom:!0,children:l.jsx(Im,{asChild:!0,trapped:N.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:Ge(a,K=>{N.trigger?.focus({preventScroll:!0}),K.preventDefault()}),children:l.jsx(qu,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:l.jsx(oe,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:K=>K.preventDefault(),..._,...ne,onPlaced:()=>H(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",..._.style},onKeyDown:Ge(_.onKeyDown,K=>{const J=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!J&&K.key.length===1&&I(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let ce=B().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);if(["ArrowUp","End"].includes(K.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const pe=K.target,W=ce.indexOf(pe);ce=ce.slice(W+1)}setTimeout(()=>G(ce)),K.preventDefault()}})})})})})})});J4.displayName=use;var fse="SelectItemAlignedPosition",Q4=b.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...a}=e,i=Ri(No,r),o=Ii(No,r),[u,d]=b.useState(null),[c,h]=b.useState(null),p=at(t,T=>h(T)),m=Um(r),v=b.useRef(!1),x=b.useRef(!0),{viewport:y,selectedItem:S,selectedItemText:_,focusSelectedItem:N}=o,O=b.useCallback(()=>{if(i.trigger&&i.valueNode&&u&&c&&y&&S&&_){const T=i.trigger.getBoundingClientRect(),R=c.getBoundingClientRect(),L=i.valueNode.getBoundingClientRect(),z=_.getBoundingClientRect();if(i.dir!=="rtl"){const pe=z.left-R.left,W=L.left-pe,_e=T.left-W,Ce=T.width+_e,qe=Math.max(Ce,R.width),De=window.innerWidth-Dn,nt=D1(W,[Dn,Math.max(Dn,De-qe)]);u.style.minWidth=Ce+"px",u.style.left=nt+"px"}else{const pe=R.right-z.right,W=window.innerWidth-L.right-pe,_e=window.innerWidth-T.right-W,Ce=T.width+_e,qe=Math.max(Ce,R.width),De=window.innerWidth-Dn,nt=D1(W,[Dn,Math.max(Dn,De-qe)]);u.style.minWidth=Ce+"px",u.style.right=nt+"px"}const F=m(),B=window.innerHeight-Dn*2,q=y.scrollHeight,H=window.getComputedStyle(c),V=parseInt(H.borderTopWidth,10),G=parseInt(H.paddingTop,10),U=parseInt(H.borderBottomWidth,10),$=parseInt(H.paddingBottom,10),Q=V+G+q+$+U,k=Math.min(S.offsetHeight*5,Q),I=window.getComputedStyle(y),D=parseInt(I.paddingTop,10),Z=parseInt(I.paddingBottom,10),ie=T.top+T.height/2-Dn,oe=B-ie,ne=S.offsetHeight/2,K=S.offsetTop+ne,J=V+G+K,ee=Q-J;if(J<=ie){const pe=F.length>0&&S===F[F.length-1].ref.current;u.style.bottom="0px";const W=c.clientHeight-y.offsetTop-y.offsetHeight,_e=Math.max(oe,ne+(pe?Z:0)+W+U),Ce=J+_e;u.style.height=Ce+"px"}else{const pe=F.length>0&&S===F[0].ref.current;u.style.top="0px";const _e=Math.max(ie,V+y.offsetTop+(pe?D:0)+ne)+ee;u.style.height=_e+"px",y.scrollTop=J-ie+y.offsetTop}u.style.margin=`${Dn}px 0`,u.style.minHeight=k+"px",u.style.maxHeight=B+"px",n?.(),requestAnimationFrame(()=>v.current=!0)}},[m,i.trigger,i.valueNode,u,c,y,S,_,i.dir,n]);Gt(()=>O(),[O]);const[A,C]=b.useState();Gt(()=>{c&&C(window.getComputedStyle(c).zIndex)},[c]);const E=b.useCallback(T=>{T&&x.current===!0&&(O(),N?.(),x.current=!1)},[O,N]);return l.jsx(pse,{scope:r,contentWrapper:u,shouldExpandOnScrollRef:v,onScrollButtonChange:E,children:l.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:A},children:l.jsx(We.div,{...a,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});Q4.displayName=fse;var hse="SelectPopperPosition",cS=b.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:a=Dn,...i}=e,o=Vm(r);return l.jsx(Yj,{...o,...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)"}})});cS.displayName=hse;var[pse,e_]=El(No,{}),uS="SelectViewport",Z4=b.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...a}=e,i=Ii(uS,r),o=e_(uS,r),u=at(t,i.onViewportChange),d=b.useRef(0);return l.jsxs(l.Fragment,{children:[l.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}),l.jsx(qm.Slot,{scope:r,children:l.jsx(We.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Ge(a.onScroll,c=>{const h=c.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=o;if(m?.current&&p){const v=Math.abs(d.current-h.scrollTop);if(v>0){const x=window.innerHeight-Dn*2,y=parseFloat(p.style.minHeight),S=parseFloat(p.style.height),_=Math.max(y,S);if(_0?A:0,p.style.justifyContent="flex-end")}}}d.current=h.scrollTop})})})]})});Z4.displayName=uS;var e3="SelectGroup",[mse,gse]=El(e3),vse=b.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=Lr();return l.jsx(mse,{scope:r,id:a,children:l.jsx(We.div,{role:"group","aria-labelledby":a,...n,ref:t})})});vse.displayName=e3;var t3="SelectLabel",yse=b.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=gse(t3,r);return l.jsx(We.div,{id:a.id,...n,ref:t})});yse.displayName=t3;var Up="SelectItem",[xse,r3]=El(Up),n3=b.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:a=!1,textValue:i,...o}=e,u=Ri(Up,r),d=Ii(Up,r),c=u.value===n,[h,p]=b.useState(i??""),[m,v]=b.useState(!1),x=at(t,N=>d.itemRefCallback?.(N,n,a)),y=Lr(),S=b.useRef("touch"),_=()=>{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 l.jsx(xse,{scope:r,value:n,disabled:a,textId:y,isSelected:c,onItemTextChange:b.useCallback(N=>{p(O=>O||(N?.textContent??"").trim())},[]),children:l.jsx(qm.ItemSlot,{scope:r,value:n,disabled:a,textValue:h,children:l.jsx(We.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,...o,ref:x,onFocus:Ge(o.onFocus,()=>v(!0)),onBlur:Ge(o.onBlur,()=>v(!1)),onClick:Ge(o.onClick,()=>{S.current!=="mouse"&&_()}),onPointerUp:Ge(o.onPointerUp,()=>{S.current==="mouse"&&_()}),onPointerDown:Ge(o.onPointerDown,N=>{S.current=N.pointerType}),onPointerMove:Ge(o.onPointerMove,N=>{S.current=N.pointerType,a?d.onItemLeave?.():S.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ge(o.onPointerLeave,N=>{N.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Ge(o.onKeyDown,N=>{d.searchRef?.current!==""&&N.key===" "||(nse.includes(N.key)&&_(),N.key===" "&&N.preventDefault())})})})})});n3.displayName=Up;var Mc="SelectItemText",a3=b.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,...i}=e,o=Ri(Mc,r),u=Ii(Mc,r),d=r3(Mc,r),c=sse(Mc,r),[h,p]=b.useState(null),m=at(t,_=>p(_),d.onItemTextChange,_=>u.itemTextRefCallback?.(_,d.value,d.disabled)),v=h?.textContent,x=b.useMemo(()=>l.jsx("option",{value:d.value,disabled:d.disabled,children:v},d.value),[d.disabled,d.value,v]),{onNativeOptionAdd:y,onNativeOptionRemove:S}=c;return Gt(()=>(y(x),()=>S(x)),[y,S,x]),l.jsxs(l.Fragment,{children:[l.jsx(We.span,{id:d.textId,...i,ref:m}),d.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ku.createPortal(i.children,o.valueNode):null]})});a3.displayName=Mc;var i3="SelectItemIndicator",o3=b.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return r3(i3,r).isSelected?l.jsx(We.span,{"aria-hidden":!0,...n,ref:t}):null});o3.displayName=i3;var dS="SelectScrollUpButton",s3=b.forwardRef((e,t)=>{const r=Ii(dS,e.__scopeSelect),n=e_(dS,e.__scopeSelect),[a,i]=b.useState(!1),o=at(t,n.onScrollButtonChange);return Gt(()=>{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?l.jsx(c3,{...e,ref:o,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=r;u&&d&&(u.scrollTop=u.scrollTop-d.offsetHeight)}}):null});s3.displayName=dS;var fS="SelectScrollDownButton",l3=b.forwardRef((e,t)=>{const r=Ii(fS,e.__scopeSelect),n=e_(fS,e.__scopeSelect),[a,i]=b.useState(!1),o=at(t,n.onScrollButtonChange);return Gt(()=>{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?l.jsx(c3,{...e,ref:o,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=r;u&&d&&(u.scrollTop=u.scrollTop+d.offsetHeight)}}):null});l3.displayName=fS;var c3=b.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...a}=e,i=Ii("SelectScrollButton",r),o=b.useRef(null),u=Um(r),d=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>d(),[d]),Gt(()=>{u().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[u]),l.jsx(We.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Ge(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(n,50))}),onPointerMove:Ge(a.onPointerMove,()=>{i.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(n,50))}),onPointerLeave:Ge(a.onPointerLeave,()=>{d()})})}),bse="SelectSeparator",wse=b.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return l.jsx(We.div,{"aria-hidden":!0,...n,ref:t})});wse.displayName=bse;var hS="SelectArrow",Sse=b.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=Vm(r),i=Ri(hS,r),o=Ii(hS,r);return i.open&&o.position==="popper"?l.jsx(Jj,{...a,...n,ref:t}):null});Sse.displayName=hS;var jse="SelectBubbleInput",u3=b.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const a=b.useRef(null),i=at(n,a),o=Qj(t);return b.useEffect(()=>{const u=a.current;if(!u)return;const d=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(d,"value").set;if(o!==t&&h){const p=new Event("change",{bubbles:!0});h.call(u,t),u.dispatchEvent(p)}},[o,t]),l.jsx(We.select,{...r,style:{...k4,...r.style},ref:i,defaultValue:t})});u3.displayName=jse;function d3(e){return e===""||e===void 0}function f3(e){const t=jr(e),r=b.useRef(""),n=b.useRef(0),a=b.useCallback(o=>{const u=r.current+o;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 h3(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 o=_se(e,Math.max(i,0));a.length===1&&(o=o.filter(c=>c!==r));const d=o.find(c=>c.textValue.toLowerCase().startsWith(a.toLowerCase()));return d!==r?d:void 0}function _se(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Nse=q4,Cse=V4,Ose=W4,Ese=G4,Pse=K4,Ase=X4,Tse=Z4,kse=n3,Rse=a3,Ise=o3,Mse=s3,Dse=l3;function Ke({...e}){return l.jsx(Nse,{"data-slot":"select",...e})}function Xe({...e}){return l.jsx(Ose,{"data-slot":"select-value",...e})}function Ye({className:e,size:t="default",children:r,...n}){return l.jsxs(Cse,{"data-slot":"select-trigger","data-size":t,className:Ae("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,l.jsx(Ese,{asChild:!0,children:l.jsx(Is,{className:"size-4 opacity-50"})})]})}function Je({className:e,children:t,position:r="popper",...n}){return l.jsx(Pse,{children:l.jsxs(Ase,{"data-slot":"select-content",className:Ae("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:[l.jsx(Lse,{}),l.jsx(Tse,{className:Ae("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),l.jsx($se,{})]})})}function Ne({className:e,children:t,...r}){return l.jsxs(kse,{"data-slot":"select-item",className:Ae("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:[l.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:l.jsx(Ise,{children:l.jsx(JI,{className:"size-4"})})}),l.jsx(Rse,{children:t})]})}function Lse({className:e,...t}){return l.jsx(Mse,{"data-slot":"select-scroll-up-button",className:Ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(kz,{className:"size-4"})})}function $se({className:e,...t}){return l.jsx(Dse,{"data-slot":"select-scroll-down-button",className:Ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Is,{className:"size-4"})})}function Bse(e){const t=Fse(e),r=b.forwardRef((n,a)=>{const{children:i,...o}=n,u=b.Children.toArray(i),d=u.find(qse);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 l.jsx(t,{...o,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,h):null})}return l.jsx(t,{...o,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 o=Vse(a),u=Use(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Sn(n,o):o),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var zse=Symbol("radix.slottable");function qse(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===zse}function Use(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 Vse(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 Hm="Dialog",[p3]=Ua(Hm),[Hse,Kn]=p3(Hm),m3=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:a,onOpenChange:i,modal:o=!0}=e,u=b.useRef(null),d=b.useRef(null),[c,h]=jo({prop:n,defaultProp:a??!1,onChange:i,caller:Hm});return l.jsx(Hse,{scope:t,triggerRef:u,contentRef:d,contentId:Lr(),titleId:Lr(),descriptionId:Lr(),open:c,onOpenChange:h,onOpenToggle:b.useCallback(()=>h(p=>!p),[h]),modal:o,children:r})};m3.displayName=Hm;var g3="DialogTrigger",Wse=b.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Kn(g3,r),i=at(t,a.triggerRef);return l.jsx(We.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":n_(a.open),...n,ref:i,onClick:Ge(e.onClick,a.onOpenToggle)})});Wse.displayName=g3;var t_="DialogPortal",[Gse,v3]=p3(t_,{forceMount:void 0}),y3=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:a}=e,i=Kn(t_,t);return l.jsx(Gse,{scope:t,forceMount:r,children:b.Children.map(n,o=>l.jsx(nn,{present:r||i.open,children:l.jsx(Vu,{asChild:!0,container:a,children:o})}))})};y3.displayName=t_;var Vp="DialogOverlay",x3=b.forwardRef((e,t)=>{const r=v3(Vp,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,i=Kn(Vp,e.__scopeDialog);return i.modal?l.jsx(nn,{present:n||i.open,children:l.jsx(Xse,{...a,ref:t})}):null});x3.displayName=Vp;var Kse=Bse("DialogOverlay.RemoveScroll"),Xse=b.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Kn(Vp,r);return l.jsx(zm,{as:Kse,allowPinchZoom:!0,shards:[a.contentRef],children:l.jsx(We.div,{"data-state":n_(a.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),Co="DialogContent",b3=b.forwardRef((e,t)=>{const r=v3(Co,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,i=Kn(Co,e.__scopeDialog);return l.jsx(nn,{present:n||i.open,children:i.modal?l.jsx(Yse,{...a,ref:t}):l.jsx(Jse,{...a,ref:t})})});b3.displayName=Co;var Yse=b.forwardRef((e,t)=>{const r=Kn(Co,e.__scopeDialog),n=b.useRef(null),a=at(t,r.contentRef,n);return b.useEffect(()=>{const i=n.current;if(i)return Zj(i)},[]),l.jsx(w3,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ge(e.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Ge(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,u=o.button===0&&o.ctrlKey===!0;(o.button===2||u)&&i.preventDefault()}),onFocusOutside:Ge(e.onFocusOutside,i=>i.preventDefault())})}),Jse=b.forwardRef((e,t)=>{const r=Kn(Co,e.__scopeDialog),n=b.useRef(!1),a=b.useRef(!1);return l.jsx(w3,{...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 o=i.target;r.triggerRef.current?.contains(o)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),w3=b.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=e,u=Kn(Co,r),d=b.useRef(null),c=at(t,d);return Bj(),l.jsxs(l.Fragment,{children:[l.jsx(Im,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:i,children:l.jsx(qu,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":n_(u.open),...o,ref:c,onDismiss:()=>u.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(Qse,{titleId:u.titleId}),l.jsx(ele,{contentRef:d,descriptionId:u.descriptionId})]})]})}),r_="DialogTitle",S3=b.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Kn(r_,r);return l.jsx(We.h2,{id:a.titleId,...n,ref:t})});S3.displayName=r_;var j3="DialogDescription",_3=b.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Kn(j3,r);return l.jsx(We.p,{id:a.descriptionId,...n,ref:t})});_3.displayName=j3;var N3="DialogClose",C3=b.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Kn(N3,r);return l.jsx(We.button,{type:"button",...n,ref:t,onClick:Ge(e.onClick,()=>a.onOpenChange(!1))})});C3.displayName=N3;function n_(e){return e?"open":"closed"}var O3="DialogTitleWarning",[phe,E3]=L6(O3,{contentName:Co,titleName:r_,docsSlug:"dialog"}),Qse=({titleId:e})=>{const t=E3(O3),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},Zse="DialogDescriptionWarning",ele=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${E3(Zse).contentName}}.`;return b.useEffect(()=>{const a=e.current?.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},P3=m3,A3=y3,T3=x3,k3=b3,tle=S3,rle=_3,nle=C3;function mt({...e}){return l.jsx(P3,{"data-slot":"dialog",...e})}function ale({...e}){return l.jsx(A3,{"data-slot":"dialog-portal",...e})}const R3=b.forwardRef(({className:e,...t},r)=>l.jsx(T3,{ref:r,"data-slot":"dialog-overlay",className:Ae("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}));R3.displayName="DialogOverlay";const ft=b.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(ale,{"data-slot":"dialog-portal",children:[l.jsx(R3,{}),l.jsxs(k3,{ref:n,"data-slot":"dialog-content",className:Ae("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,l.jsxs(nle,{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:[l.jsx(uo,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ft.displayName="DialogContent";function gt({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:Ae("flex flex-col gap-2 text-center sm:text-left",e),...t})}function xt({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-footer",className:Ae("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function vt({className:e,...t}){return l.jsx(tle,{"data-slot":"dialog-title",className:Ae("text-lg leading-none font-semibold",e),...t})}function Nt({className:e,...t}){return l.jsx(rle,{"data-slot":"dialog-description",className:Ae("text-muted-foreground text-sm",e),...t})}var ile=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ole=ile.reduce((e,t)=>{const r=kS(`Primitive.${t}`),n=b.forwardRef((a,i)=>{const{asChild:o,...u}=a,d=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(d,{...u,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),sle="Label",I3=b.forwardRef((e,t)=>l.jsx(ole.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));I3.displayName=sle;var lle=I3;function ue({className:e,...t}){return l.jsx(lle,{"data-slot":"label",className:Ae("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 Wm="Switch",[cle]=Ua(Wm),[ule,dle]=cle(Wm),M3=b.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:a,defaultChecked:i,required:o,disabled:u,value:d="on",onCheckedChange:c,form:h,...p}=e,[m,v]=b.useState(null),x=at(t,O=>v(O)),y=b.useRef(!1),S=m?h||!!m.closest("form"):!0,[_,N]=jo({prop:a,defaultProp:i??!1,onChange:c,caller:Wm});return l.jsxs(ule,{scope:r,checked:_,disabled:u,children:[l.jsx(We.button,{type:"button",role:"switch","aria-checked":_,"aria-required":o,"data-state":B3(_),"data-disabled":u?"":void 0,disabled:u,value:d,...p,ref:x,onClick:Ge(e.onClick,O=>{N(A=>!A),S&&(y.current=O.isPropagationStopped(),y.current||O.stopPropagation())})}),S&&l.jsx($3,{control:m,bubbles:!y.current,name:n,value:d,checked:_,required:o,disabled:u,form:h,style:{transform:"translateX(-100%)"}})]})});M3.displayName=Wm;var D3="SwitchThumb",L3=b.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,a=dle(D3,r);return l.jsx(We.span,{"data-state":B3(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});L3.displayName=D3;var fle="SwitchBubbleInput",$3=b.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...a},i)=>{const o=b.useRef(null),u=at(o,i),d=Qj(r),c=Wj(t);return b.useEffect(()=>{const h=o.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]),l.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}})});$3.displayName=fle;function B3(e){return e?"checked":"unchecked"}var hle=M3,ple=L3;function qt({className:e,...t}){return l.jsx(hle,{"data-slot":"switch",className:Ae("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:l.jsx(ple,{"data-slot":"switch-thumb",className:Ae("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 mle(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))}Array(12).fill(0);let pS=1;class gle{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:pS++,o=this.toasts.find(d=>d.id===i),u=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),o?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,o;const u=a.then(async c=>{if(o=["resolve",c],X.isValidElement(c))i=!1,this.create({id:n,type:"default",message:c});else if(yle(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"&&!X.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"&&!X.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"&&!X.isValidElement(p)?p:{message:p};this.create({id:n,type:"success",description:m,...x})}}).catch(async c=>{if(o=["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"&&!X.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(()=>o[0]==="reject"?h(o[1]):c(o[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||pS++;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 gn=new gle,vle=(e,t)=>{const r=t?.id||pS++;return gn.addToast({title:e,...t,id:r}),r},yle=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",xle=vle,ble=()=>gn.toasts,wle=()=>gn.getActiveToasts(),xe=Object.assign(xle,{success:gn.success,info:gn.info,warning:gn.warning,error:gn.error,custom:gn.custom,message:gn.message,promise:gn.promise,dismiss:gn.dismiss,loading:gn.loading},{getHistory:ble,getToasts:wle});mle("[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 Sle(e){const t=jle(e),r=b.forwardRef((n,a)=>{const{children:i,...o}=n,u=b.Children.toArray(i),d=u.find(Nle);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 l.jsx(t,{...o,ref:a,children:b.isValidElement(c)?b.cloneElement(c,void 0,h):null})}return l.jsx(t,{...o,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function jle(e){const t=b.forwardRef((r,n)=>{const{children:a,...i}=r;if(b.isValidElement(a)){const o=Ole(a),u=Cle(i,a.props);return a.type!==b.Fragment&&(u.ref=n?Sn(n,o):o),b.cloneElement(a,u)}return b.Children.count(a)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _le=Symbol("radix.slottable");function Nle(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_le}function Cle(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 Ole(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 Gm="Popover",[F3]=Ua(Gm,[Ol]),Hu=Ol(),[Ele,Mi]=F3(Gm),z3=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:a,onOpenChange:i,modal:o=!1}=e,u=Hu(t),d=b.useRef(null),[c,h]=b.useState(!1),[p,m]=jo({prop:n,defaultProp:a??!1,onChange:i,caller:Gm});return l.jsx(Xj,{...u,children:l.jsx(Ele,{scope:t,contentId:Lr(),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:o,children:r})})};z3.displayName=Gm;var q3="PopoverAnchor",Ple=b.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Mi(q3,r),i=Hu(r),{onCustomAnchorAdd:o,onCustomAnchorRemove:u}=a;return b.useEffect(()=>(o(),()=>u()),[o,u]),l.jsx(Bm,{...i,...n,ref:t})});Ple.displayName=q3;var U3="PopoverTrigger",V3=b.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Mi(U3,r),i=Hu(r),o=at(t,a.triggerRef),u=l.jsx(We.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":X3(a.open),...n,ref:o,onClick:Ge(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?u:l.jsx(Bm,{asChild:!0,...i,children:u})});V3.displayName=U3;var a_="PopoverPortal",[Ale,Tle]=F3(a_,{forceMount:void 0}),H3=e=>{const{__scopePopover:t,forceMount:r,children:n,container:a}=e,i=Mi(a_,t);return l.jsx(Ale,{scope:t,forceMount:r,children:l.jsx(nn,{present:r||i.open,children:l.jsx(Vu,{asChild:!0,container:a,children:n})})})};H3.displayName=a_;var dl="PopoverContent",W3=b.forwardRef((e,t)=>{const r=Tle(dl,e.__scopePopover),{forceMount:n=r.forceMount,...a}=e,i=Mi(dl,e.__scopePopover);return l.jsx(nn,{present:n||i.open,children:i.modal?l.jsx(Rle,{...a,ref:t}):l.jsx(Ile,{...a,ref:t})})});W3.displayName=dl;var kle=Sle("PopoverContent.RemoveScroll"),Rle=b.forwardRef((e,t)=>{const r=Mi(dl,e.__scopePopover),n=b.useRef(null),a=at(t,n),i=b.useRef(!1);return b.useEffect(()=>{const o=n.current;if(o)return Zj(o)},[]),l.jsx(zm,{as:kle,allowPinchZoom:!0,children:l.jsx(G3,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ge(e.onCloseAutoFocus,o=>{o.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:Ge(e.onPointerDownOutside,o=>{const u=o.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,c=u.button===2||d;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Ge(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Ile=b.forwardRef((e,t)=>{const r=Mi(dl,e.__scopePopover),n=b.useRef(!1),a=b.useRef(!1);return l.jsx(G3,{...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 o=i.target;r.triggerRef.current?.contains(o)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),G3=b.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:c,onInteractOutside:h,...p}=e,m=Mi(dl,r),v=Hu(r);return Bj(),l.jsx(Im,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:i,children:l.jsx(qu,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:h,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:c,onDismiss:()=>m.onOpenChange(!1),children:l.jsx(Yj,{"data-state":X3(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)"}})})})}),K3="PopoverClose",Mle=b.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Mi(K3,r);return l.jsx(We.button,{type:"button",...n,ref:t,onClick:Ge(e.onClick,()=>a.onOpenChange(!1))})});Mle.displayName=K3;var Dle="PopoverArrow",Lle=b.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Hu(r);return l.jsx(Jj,{...a,...n,ref:t})});Lle.displayName=Dle;function X3(e){return e?"open":"closed"}var $le=z3,Ble=V3,Fle=H3,zle=W3;function ma({...e}){return l.jsx($le,{"data-slot":"popover",...e})}function ga({...e}){return l.jsx(Ble,{"data-slot":"popover-trigger",...e})}function va({className:e,align:t="center",sideOffset:r=4,...n}){return l.jsx(Fle,{children:l.jsx(zle,{"data-slot":"popover-content",align:t,sideOffset:r,className:Ae("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 Km="Checkbox",[qle]=Ua(Km),[Ule,i_]=qle(Km);function Vle(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:a,disabled:i,form:o,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:Km}),[x,y]=b.useState(null),[S,_]=b.useState(null),N=b.useRef(!1),O=x?!!o||!!x.closest("form"):!0,A={checked:m,disabled:i,setChecked:v,control:x,setControl:y,name:u,form:o,value:h,hasConsumerStoppedPropagationRef:N,required:c,defaultChecked:bi(a)?!1:a,isFormControl:O,bubbleInput:S,setBubbleInput:_};return l.jsx(Ule,{scope:t,...A,children:Hle(p)?p(A):n})}var Y3="CheckboxTrigger",J3=b.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},a)=>{const{control:i,value:o,disabled:u,checked:d,required:c,setControl:h,setChecked:p,hasConsumerStoppedPropagationRef:m,isFormControl:v,bubbleInput:x}=i_(Y3,e),y=at(a,h),S=b.useRef(d);return b.useEffect(()=>{const _=i?.form;if(_){const N=()=>p(S.current);return _.addEventListener("reset",N),()=>_.removeEventListener("reset",N)}},[i,p]),l.jsx(We.button,{type:"button",role:"checkbox","aria-checked":bi(d)?"mixed":d,"aria-required":c,"data-state":n5(d),"data-disabled":u?"":void 0,disabled:u,value:o,...n,ref:y,onKeyDown:Ge(t,_=>{_.key==="Enter"&&_.preventDefault()}),onClick:Ge(r,_=>{p(N=>bi(N)?!0:!N),x&&v&&(m.current=_.isPropagationStopped(),m.current||_.stopPropagation())})})});J3.displayName=Y3;var Q3=b.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:a,defaultChecked:i,required:o,disabled:u,value:d,onCheckedChange:c,form:h,...p}=e;return l.jsx(Vle,{__scopeCheckbox:r,checked:a,defaultChecked:i,disabled:u,required:o,onCheckedChange:c,name:n,form:h,value:d,internal_do_not_use_render:({isFormControl:m})=>l.jsxs(l.Fragment,{children:[l.jsx(J3,{...p,ref:t,__scopeCheckbox:r}),m&&l.jsx(r5,{__scopeCheckbox:r})]})})});Q3.displayName=Km;var Z3="CheckboxIndicator",e5=b.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...a}=e,i=i_(Z3,r);return l.jsx(nn,{present:n||bi(i.checked)||i.checked===!0,children:l.jsx(We.span,{"data-state":n5(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});e5.displayName=Z3;var t5="CheckboxBubbleInput",r5=b.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:a,checked:i,defaultChecked:o,required:u,disabled:d,name:c,value:h,form:p,bubbleInput:m,setBubbleInput:v}=i_(t5,e),x=at(r,v),y=Qj(i),S=Wj(n);b.useEffect(()=>{const N=m;if(!N)return;const O=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(O,"checked").set,E=!a.current;if(y!==i&&C){const T=new Event("click",{bubbles:E});N.indeterminate=bi(i),C.call(N,bi(i)?!1:i),N.dispatchEvent(T)}},[m,y,i,a]);const _=b.useRef(bi(i)?!1:i);return l.jsx(We.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??_.current,required:u,disabled:d,name:c,value:h,form:p,...t,tabIndex:-1,ref:x,style:{...t.style,...S,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});r5.displayName=t5;function Hle(e){return typeof e=="function"}function bi(e){return e==="indeterminate"}function n5(e){return bi(e)?"indeterminate":e?"checked":"unchecked"}function Eu({className:e,...t}){return l.jsx(Q3,{"data-slot":"checkbox",className:Ae("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:l.jsx(e5,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:l.jsx(JI,{className:"size-3.5"})})})}var MR=1,Wle=.9,Gle=.8,Kle=.17,_1=.1,N1=.999,Xle=.9999,Yle=.99,Jle=/[\\\/_+.#"@\[\(\{&]/,Qle=/[\\\/_+.#"@\[\(\{&]/g,Zle=/[\s-]/,a5=/[\s-]/g;function mS(e,t,r,n,a,i,o){if(i===t.length)return a===e.length?MR:Yle;var u=`${a},${i}`;if(o[u]!==void 0)return o[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,o),p>h&&(c===a?p*=MR:Jle.test(e.charAt(c-1))?(p*=Gle,v=e.slice(a,c-1).match(Qle),v&&a>0&&(p*=Math.pow(N1,v.length))):Zle.test(e.charAt(c-1))?(p*=Wle,x=e.slice(a,c-1).match(a5),x&&a>0&&(p*=Math.pow(N1,x.length))):(p*=Kle,a>0&&(p*=Math.pow(N1,c-a))),e.charAt(c)!==t.charAt(i)&&(p*=Xle)),(p<_1&&r.charAt(c-1)===n.charAt(i+1)||n.charAt(i+1)===n.charAt(i)&&r.charAt(c-1)!==n.charAt(i))&&(m=mS(e,t,r,n,c+1,i+2,o),m*_1>p&&(p=m*_1)),p>h&&(h=p),c=r.indexOf(d,c+1);return o[u]=h,h}function DR(e){return e.toLowerCase().replace(a5," ")}function ece(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,mS(e,t,DR(e),DR(t),0,0,{})}var Nc='[cmdk-group=""]',C1='[cmdk-group-items=""]',tce='[cmdk-group-heading=""]',i5='[cmdk-item=""]',LR=`${i5}:not([aria-disabled="true"])`,gS="cmdk-item-select",bs="data-value",rce=(e,t,r)=>ece(e,t,r),o5=b.createContext(void 0),Wu=()=>b.useContext(o5),s5=b.createContext(void 0),o_=()=>b.useContext(s5),l5=b.createContext(void 0),c5=b.forwardRef((e,t)=>{let r=ws(()=>{var D,Z;return{search:"",value:(Z=(D=e.value)!=null?D:e.defaultValue)!=null?Z:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=ws(()=>new Set),a=ws(()=>new Map),i=ws(()=>new Map),o=ws(()=>new Set),u=u5(e),{label:d,children:c,value:h,onValueChange:p,filter:m,shouldFilter:v,loop:x,disablePointerSelection:y=!1,vimBindings:S=!0,..._}=e,N=Lr(),O=Lr(),A=Lr(),C=b.useRef(null),E=hce();Oo(()=>{if(h!==void 0){let D=h.trim();r.current.value=D,T.emit()}},[h]),Oo(()=>{E(6,q)},[]);let T=b.useMemo(()=>({subscribe:D=>(o.current.add(D),()=>o.current.delete(D)),snapshot:()=>r.current,setState:(D,Z,ie)=>{var oe,ne,K,J;if(!Object.is(r.current[D],Z)){if(r.current[D]=Z,D==="search")B(),z(),E(1,F);else if(D==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ee=document.getElementById(A);ee?ee.focus():(oe=document.getElementById(N))==null||oe.focus()}if(E(7,()=>{var ee;r.current.selectedItemId=(ee=H())==null?void 0:ee.id,T.emit()}),ie||E(5,q),((ne=u.current)==null?void 0:ne.value)!==void 0){let ee=Z??"";(J=(K=u.current).onValueChange)==null||J.call(K,ee);return}}T.emit()}},emit:()=>{o.current.forEach(D=>D())}}),[]),R=b.useMemo(()=>({value:(D,Z,ie)=>{var oe;Z!==((oe=i.current.get(D))==null?void 0:oe.value)&&(i.current.set(D,{value:Z,keywords:ie}),r.current.filtered.items.set(D,L(Z,ie)),E(2,()=>{z(),T.emit()}))},item:(D,Z)=>(n.current.add(D),Z&&(a.current.has(Z)?a.current.get(Z).add(D):a.current.set(Z,new Set([D]))),E(3,()=>{B(),z(),r.current.value||F(),T.emit()}),()=>{i.current.delete(D),n.current.delete(D),r.current.filtered.items.delete(D);let ie=H();E(4,()=>{B(),ie?.getAttribute("id")===D&&F(),T.emit()})}),group:D=>(a.current.has(D)||a.current.set(D,new Set),()=>{i.current.delete(D),a.current.delete(D)}),filter:()=>u.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>u.current.disablePointerSelection,listId:N,inputId:A,labelId:O,listInnerRef:C}),[]);function L(D,Z){var ie,oe;let ne=(oe=(ie=u.current)==null?void 0:ie.filter)!=null?oe:rce;return D?ne(D,r.current.search,Z):0}function z(){if(!r.current.search||u.current.shouldFilter===!1)return;let D=r.current.filtered.items,Z=[];r.current.filtered.groups.forEach(oe=>{let ne=a.current.get(oe),K=0;ne.forEach(J=>{let ee=D.get(J);K=Math.max(ee,K)}),Z.push([oe,K])});let ie=C.current;V().sort((oe,ne)=>{var K,J;let ee=oe.getAttribute("id"),ce=ne.getAttribute("id");return((K=D.get(ce))!=null?K:0)-((J=D.get(ee))!=null?J:0)}).forEach(oe=>{let ne=oe.closest(C1);ne?ne.appendChild(oe.parentElement===ne?oe:oe.closest(`${C1} > *`)):ie.appendChild(oe.parentElement===ie?oe:oe.closest(`${C1} > *`))}),Z.sort((oe,ne)=>ne[1]-oe[1]).forEach(oe=>{var ne;let K=(ne=C.current)==null?void 0:ne.querySelector(`${Nc}[${bs}="${encodeURIComponent(oe[0])}"]`);K?.parentElement.appendChild(K)})}function F(){let D=V().find(ie=>ie.getAttribute("aria-disabled")!=="true"),Z=D?.getAttribute(bs);T.setState("value",Z||void 0)}function B(){var D,Z,ie,oe;if(!r.current.search||u.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let ne=0;for(let K of n.current){let J=(Z=(D=i.current.get(K))==null?void 0:D.value)!=null?Z:"",ee=(oe=(ie=i.current.get(K))==null?void 0:ie.keywords)!=null?oe:[],ce=L(J,ee);r.current.filtered.items.set(K,ce),ce>0&&ne++}for(let[K,J]of a.current)for(let ee of J)if(r.current.filtered.items.get(ee)>0){r.current.filtered.groups.add(K);break}r.current.filtered.count=ne}function q(){var D,Z,ie;let oe=H();oe&&(((D=oe.parentElement)==null?void 0:D.firstChild)===oe&&((ie=(Z=oe.closest(Nc))==null?void 0:Z.querySelector(tce))==null||ie.scrollIntoView({block:"nearest"})),oe.scrollIntoView({block:"nearest"}))}function H(){var D;return(D=C.current)==null?void 0:D.querySelector(`${i5}[aria-selected="true"]`)}function V(){var D;return Array.from(((D=C.current)==null?void 0:D.querySelectorAll(LR))||[])}function G(D){let Z=V()[D];Z&&T.setState("value",Z.getAttribute(bs))}function U(D){var Z;let ie=H(),oe=V(),ne=oe.findIndex(J=>J===ie),K=oe[ne+D];(Z=u.current)!=null&&Z.loop&&(K=ne+D<0?oe[oe.length-1]:ne+D===oe.length?oe[0]:oe[ne+D]),K&&T.setState("value",K.getAttribute(bs))}function $(D){let Z=H(),ie=Z?.closest(Nc),oe;for(;ie&&!oe;)ie=D>0?dce(ie,Nc):fce(ie,Nc),oe=ie?.querySelector(LR);oe?T.setState("value",oe.getAttribute(bs)):U(D)}let Q=()=>G(V().length-1),k=D=>{D.preventDefault(),D.metaKey?Q():D.altKey?$(1):U(1)},I=D=>{D.preventDefault(),D.metaKey?G(0):D.altKey?$(-1):U(-1)};return b.createElement(We.div,{ref:t,tabIndex:-1,..._,"cmdk-root":"",onKeyDown:D=>{var Z;(Z=_.onKeyDown)==null||Z.call(_,D);let ie=D.nativeEvent.isComposing||D.keyCode===229;if(!(D.defaultPrevented||ie))switch(D.key){case"n":case"j":{S&&D.ctrlKey&&k(D);break}case"ArrowDown":{k(D);break}case"p":case"k":{S&&D.ctrlKey&&I(D);break}case"ArrowUp":{I(D);break}case"Home":{D.preventDefault(),G(0);break}case"End":{D.preventDefault(),Q();break}case"Enter":{D.preventDefault();let oe=H();if(oe){let ne=new Event(gS);oe.dispatchEvent(ne)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:R.inputId,id:R.labelId,style:mce},d),Xm(e,D=>b.createElement(s5.Provider,{value:T},b.createElement(o5.Provider,{value:R},D))))}),nce=b.forwardRef((e,t)=>{var r,n;let a=Lr(),i=b.useRef(null),o=b.useContext(l5),u=Wu(),d=u5(e),c=(n=(r=d.current)==null?void 0:r.forceMount)!=null?n:o?.forceMount;Oo(()=>{if(!c)return u.item(a,o?.id)},[c]);let h=d5(a,i,[e.value,e.children,i],e.keywords),p=o_(),m=ji(E=>E.value&&E.value===h.current),v=ji(E=>c||u.filter()===!1?!0:E.search?E.filtered.items.get(a)>0:!0);b.useEffect(()=>{let E=i.current;if(!(!E||e.disabled))return E.addEventListener(gS,x),()=>E.removeEventListener(gS,x)},[v,e.onSelect,e.disabled]);function x(){var E,T;y(),(T=(E=d.current).onSelect)==null||T.call(E,h.current)}function y(){p.setState("value",h.current,!0)}if(!v)return null;let{disabled:S,value:_,onSelect:N,forceMount:O,keywords:A,...C}=e;return b.createElement(We.div,{ref:Sn(i,t),...C,id:a,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!m,"data-disabled":!!S,"data-selected":!!m,onPointerMove:S||u.getDisablePointerSelection()?void 0:y,onClick:S?void 0:x},e.children)}),ace=b.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:a,...i}=e,o=Lr(),u=b.useRef(null),d=b.useRef(null),c=Lr(),h=Wu(),p=ji(v=>a||h.filter()===!1?!0:v.search?v.filtered.groups.has(o):!0);Oo(()=>h.group(o),[]),d5(o,u,[e.value,e.heading,d]);let m=b.useMemo(()=>({id:o,forceMount:a}),[a]);return b.createElement(We.div,{ref:Sn(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),Xm(e,v=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?c:void 0},b.createElement(l5.Provider,{value:m},v))))}),ice=b.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,a=b.useRef(null),i=ji(o=>!o.search);return!r&&!i?null:b.createElement(We.div,{ref:Sn(a,t),...n,"cmdk-separator":"",role:"separator"})}),oce=b.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,a=e.value!=null,i=o_(),o=ji(c=>c.search),u=ji(c=>c.selectedItemId),d=Wu();return b.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),b.createElement(We.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:o,onChange:c=>{a||i.setState("search",c.target.value),r?.(c.target.value)}})}),sce=b.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...a}=e,i=b.useRef(null),o=b.useRef(null),u=ji(c=>c.selectedItemId),d=Wu();return b.useEffect(()=>{if(o.current&&i.current){let c=o.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(We.div,{ref:Sn(i,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":u,"aria-label":n,id:d.listId},Xm(e,c=>b.createElement("div",{ref:Sn(o,d.listInnerRef),"cmdk-list-sizer":""},c)))}),lce=b.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:a,contentClassName:i,container:o,...u}=e;return b.createElement(P3,{open:r,onOpenChange:n},b.createElement(A3,{container:o},b.createElement(T3,{"cmdk-overlay":"",className:a}),b.createElement(k3,{"aria-label":e.label,"cmdk-dialog":"",className:i},b.createElement(c5,{ref:t,...u}))))}),cce=b.forwardRef((e,t)=>ji(r=>r.filtered.count===0)?b.createElement(We.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),uce=b.forwardRef((e,t)=>{let{progress:r,children:n,label:a="Loading...",...i}=e;return b.createElement(We.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Xm(e,o=>b.createElement("div",{"aria-hidden":!0},o)))}),Pl=Object.assign(c5,{List:sce,Item:nce,Input:oce,Group:ace,Separator:ice,Dialog:lce,Empty:cce,Loading:uce});function dce(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function fce(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function u5(e){let t=b.useRef(e);return Oo(()=>{t.current=e}),t}var Oo=typeof window>"u"?b.useEffect:b.useLayoutEffect;function ws(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function ji(e){let t=o_(),r=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,r,r)}function d5(e,t,r,n=[]){let a=b.useRef(),i=Wu();return Oo(()=>{var o;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),(o=t.current)==null||o.setAttribute(bs,u),a.current=u}),a}var hce=()=>{let[e,t]=b.useState(),r=ws(()=>new Map);return Oo(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,a)=>{r.current.set(n,a),t({})}};function pce(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Xm({asChild:e,children:t},r){return e&&b.isValidElement(t)?b.cloneElement(pce(t),{ref:t.ref},r(t.props.children)):r(t)}var mce={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function f5({className:e,...t}){return l.jsx(Pl,{"data-slot":"command",className:Ae("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function h5({className:e,...t}){return l.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[l.jsx(Kp,{className:"size-4 shrink-0 opacity-50"}),l.jsx(Pl.Input,{"data-slot":"command-input",className:Ae("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 p5({className:e,...t}){return l.jsx(Pl.List,{"data-slot":"command-list",className:Ae("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function m5({...e}){return l.jsx(Pl.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function vS({className:e,...t}){return l.jsx(Pl.Group,{"data-slot":"command-group",className:Ae("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 yS({className:e,...t}){return l.jsx(Pl.Item,{"data-slot":"command-item",className:Ae("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 na({value:e,onValueChange:t,options:r,placeholder:n="Select…",searchPlaceholder:a="Search…",emptyText:i="No matching results.",disabled:o,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 l.jsxs(ma,{open:d,onOpenChange:c,children:[l.jsx(ga,{asChild:!0,children:l.jsxs(fe,{type:"button",variant:"outline",role:"combobox","aria-expanded":d,disabled:o,className:Ae("w-full justify-between h-10 px-3 font-normal border border-gray-300 bg-white",u),children:[l.jsx("span",{className:Ae("truncate text-left text-sm",!p&&"text-gray-500"),children:p??n}),l.jsx(ZI,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),l.jsxs(va,{className:"p-0 w-[var(--radix-popover-trigger-width)] max-w-[min(100vw-2rem,400px)]",align:"start",children:[l.jsxs(f5,{children:[l.jsx(h5,{placeholder:a}),l.jsxs(p5,{children:[l.jsx(m5,{children:i}),l.jsx(vS,{children:r.map(m=>l.jsx(yS,{value:`${m.label} ${m.value}`,onSelect:()=>{t(m.value),c(!1)},className:Ae("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:l.jsx("span",{className:"truncate",children:m.label})},m.value))})]})]}),e?l.jsx("div",{className:"border-t border-gray-100 px-2 py-1.5",children:l.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 _i({className:e,...t}){return l.jsx("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:Ae("mx-auto flex w-full justify-center",e),...t})}function Ni({className:e,...t}){return l.jsx("ul",{"data-slot":"pagination-content",className:Ae("flex flex-row items-center gap-1",e),...t})}function At({...e}){return l.jsx("li",{"data-slot":"pagination-item",...e})}function ua({className:e,isActive:t,size:r="icon",...n}){return l.jsx("a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:Ae(MM({variant:t?"outline":"ghost",size:r}),e),...n})}function Ci({className:e,...t}){return l.jsxs(ua,{"aria-label":"Go to previous page",size:"default",className:Ae("gap-1 px-2.5 sm:pl-2.5",e),...t,children:[l.jsx(QI,{}),l.jsx("span",{className:"hidden sm:block",children:"Previous"})]})}function Oi({className:e,...t}){return l.jsxs(ua,{"aria-label":"Go to next page",size:"default",className:Ae("gap-1 px-2.5 sm:pr-2.5",e),...t,children:[l.jsx("span",{className:"hidden sm:block",children:"Next"}),l.jsx(Ms,{})]})}class gce extends Error{status;payload;constructor(t,r,n){super(t),this.name="ApiError",this.status=r,this.payload=n}}function vce(e,t){if(!e)return t;const r=e.endsWith("/")?e.slice(0,-1):e,n=t.startsWith("/")?t:`/${t}`;return`${r}${n}`}function yce(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 xce(e){const r=e?.error?.message?.trim();return r||null}function $R(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 an(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",o=vce(t,`${i}${a.path}${yce(a.query??{})}`),u={"Content-Type":"application/json"},d=r?.();d&&(u.Authorization=`Bearer ${d}`);const c=await fetch(o,{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=xce(m)??(typeof m=="string"&&m.trim()?m:"Request failed.");throw new gce(x,c.status,m)}return m&&typeof m=="object"&&"data"in m?$R(m.data??null):$R(m)}return{requestJson:n}}const Gu=an({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Ku="/label";async function bce(e,t){return Gu.requestJson({path:Ku,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 wce(e,t){return Gu.requestJson({path:`${Ku}/${encodeURIComponent(e)}`,method:"GET",signal:t})}async function Sce(e){return Gu.requestJson({path:Ku,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 jce(e,t){return Gu.requestJson({path:`${Ku}/${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 _ce(e){await Gu.requestJson({path:`${Ku}/${encodeURIComponent(e)}`,method:"DELETE"})}const Ym=an({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}});async function Al(e,t){return Ym.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 Nce(e){return Ym.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 Cce(e,t){return Ym.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 Oce(e){await Ym.requestJson({path:`/location/${encodeURIComponent(e)}`,method:"DELETE"})}const Jm=an({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Qm="/label-category";async function s_(e,t){return Jm.requestJson({path:Qm,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,State:e.state},signal:t})}async function Ece(e){return Jm.requestJson({path:Qm,method:"POST",body:{categoryCode:e.categoryCode,categoryName:e.categoryName,categoryPhotoUrl:e.categoryPhotoUrl,state:e.state??!0,orderNum:e.orderNum}})}async function Pce(e,t){return Jm.requestJson({path:`${Qm}/${encodeURIComponent(e)}`,method:"PUT",body:{categoryCode:t.categoryCode,categoryName:t.categoryName,categoryPhotoUrl:t.categoryPhotoUrl,state:t.state??!0,orderNum:t.orderNum}})}async function Ace(e){await Jm.requestJson({path:`${Qm}/${encodeURIComponent(e)}`,method:"DELETE"})}const Zm=an({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),eg="/label-type";async function g5(e,t){return Zm.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 Tce(e){return Zm.requestJson({path:eg,method:"POST",body:{typeCode:e.typeCode,typeName:e.typeName,state:e.state??!0,orderNum:e.orderNum}})}async function kce(e,t){return Zm.requestJson({path:`${eg}/${encodeURIComponent(e)}`,method:"PUT",body:{typeCode:t.typeCode,typeName:t.typeName,state:t.state??!0,orderNum:t.orderNum}})}async function Rce(e){await Zm.requestJson({path:`${eg}/${encodeURIComponent(e)}`,method:"DELETE"})}const Xu=an({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Yu="/label-template";function Ice(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 tg(e){const t=e,n=((Array.isArray(t.appliedLocationIds)?t.appliedLocationIds:null)??(Array.isArray(t.AppliedLocationIds)?t.AppliedLocationIds:null)??[]).map(v=>String(v)),a=Ice(e),i=t.templateName??t.TemplateName,o=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 o=="string"?o: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:Array.isArray(t.elements)?t.elements:[]}}async function v5(e,t){const r=await Xu.requestJson({path:Yu,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=>tg(a));return{...r,items:n}}async function Mce(e,t){const r=await Xu.requestJson({path:`${Yu}/${encodeURIComponent(e)}`,method:"GET",signal:t});return tg(r)}async function Dce(e){const t=await Xu.requestJson({path:Yu,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 tg(t)}async function Lce(e,t){const r=await Xu.requestJson({path:`${Yu}/${encodeURIComponent(e)}`,method:"PUT",body:{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??[]}});return tg(r)}async function $ce(e){await Xu.requestJson({path:`${Yu}/${encodeURIComponent(e)}`,method:"DELETE"})}const Ju=an({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),Qu="/product";function rg(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,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 xS(e,t){const r=await Ju.requestJson({path:Qu,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=>rg(n))}}async function Bce(e,t){const r=await Ju.requestJson({path:`${Qu}/${encodeURIComponent(e)}`,method:"GET",signal:t});return rg(r)}async function Fce(e){const t=await Ju.requestJson({path:Qu,method:"POST",body:{productCode:e.productCode,productName:e.productName,categoryName:e.categoryName??null,productImageUrl:e.productImageUrl??null,state:e.state??!0}});return rg(t)}async function zce(e,t){const r=await Ju.requestJson({path:`${Qu}/${encodeURIComponent(e)}`,method:"PUT",body:{productCode:t.productCode,productName:t.productName,categoryName:t.categoryName??null,productImageUrl:t.productImageUrl??null,state:t.state??!0}});return rg(r)}async function qce(e){await Ju.requestJson({path:`${Qu}/${encodeURIComponent(e)}`,method:"DELETE"})}function Un(e){const t=(e??"").trim();return t||"None"}function Uce(e){return(e.labelCode??e.id??"").trim()||"None"}function Vce(e){const t=(e.productName??"").trim();if(t)return t;const r=e.productIds?.length??0;return r>0?`${r} product(s)`:"None"}function Hce(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 BR(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 Pu(e){return(e.templateCode??e.id??"").trim()}function y5(e){const t=(e.templateName??e.name??"").trim()||"None",r=Pu(e)||"None";return`${t} (${r})`}function x5(e){const[t,r]=b.useState(!1),[n,a]=b.useState([]),[i,o]=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,S,_,N,O]=await Promise.all([v5({skipCount:0,maxResultCount:500}),Al({skipCount:0,maxResultCount:500}),s_({skipCount:0,maxResultCount:500}),g5({skipCount:0,maxResultCount:500}),xS({skipCount:0,maxResultCount:500})]);if(x)return;a(y.items??[]),o(S.items??[]),d(_.items??[]),h(N.items??[]),m(O.items??[])}catch(y){x||(xe.error("Failed to load options",{description:y?.message?String(y.message):"Check network or sign-in."}),a([]),o([]),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 b5({value:e,onChange:t,disabled:r,productOptions:n}){const[a,i]=b.useState(!1),o=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 l.jsxs(ma,{open:a,onOpenChange:i,children:[l.jsx(ga,{asChild:!0,children:l.jsxs(fe,{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:[l.jsx("span",{className:"truncate text-left text-sm",children:o}),l.jsx(ZI,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),l.jsx(va,{className:"w-[var(--radix-popover-trigger-width)] max-w-[min(100vw-2rem,400px)] p-0",align:"start",children:l.jsxs(f5,{children:[l.jsx(h5,{placeholder:"Search products…"}),l.jsxs(p5,{children:[l.jsx(m5,{children:"No matching products."}),l.jsxs(vS,{children:[n.map(c=>l.jsxs(yS,{value:`${c.name} ${c.id}`,onSelect:()=>{u(c.id,!e.includes(c.id))},className:"cursor-pointer",children:[l.jsx(Eu,{className:"pointer-events-none",checked:e.includes(c.id)}),l.jsxs("span",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"font-medium",children:c.name}),l.jsx("span",{className:"block text-xs text-gray-400 truncate",children:c.id})]})]},c.id)),d.length>0?l.jsx(vS,{heading:"Linked (not in current list, can deselect)",children:d.map(c=>l.jsxs(yS,{value:c,onSelect:()=>{u(c,!e.includes(c))},className:"cursor-pointer",children:[l.jsx(Eu,{className:"pointer-events-none",checked:e.includes(c)}),l.jsx("span",{className:"text-xs font-mono truncate",children:c})]},c))}):null]})]})]})})]})}function Wce(){const[e,t]=b.useState(!1),[r,n]=b.useState(!1),[a,i]=b.useState(!1),[o,u]=b.useState(null),[d,c]=b.useState(null),[h,p]=b.useState([]),[m,v]=b.useState(!1),[x,y]=b.useState(0),[S,_]=b.useState(0),[N,O]=b.useState(null),[A,C]=b.useState(""),[E,T]=b.useState("all"),[R,L]=b.useState("all"),[z,F]=b.useState("all"),[B,q]=b.useState("all"),[H,V]=b.useState("all"),[G,U]=b.useState(1),[$,Q]=b.useState(10),k=b.useRef(null),I=b.useRef(null),[D,Z]=b.useState("");b.useEffect(()=>(I.current&&window.clearTimeout(I.current),I.current=window.setTimeout(()=>Z(A.trim()),300),()=>{I.current&&window.clearTimeout(I.current)}),[A]);const ie=Math.max(1,Math.ceil(x/$));b.useEffect(()=>{U(1)},[D,E,R,z,B,H,$]),b.useEffect(()=>((async()=>{k.current?.abort();const ee=new AbortController;k.current=ee,v(!0);try{const ce=(G-1)*$,pe=await bce({skipCount:ce,maxResultCount:$,keyword:D||void 0,locationId:E!=="all"?E:void 0,labelCategoryId:R!=="all"?R:void 0,labelTypeId:z!=="all"?z:void 0,templateCode:B!=="all"?B:void 0,state:H==="all"?void 0:H==="true"},ee.signal);p(pe.items??[]),y(pe.totalCount??0)}catch(ce){if(ce?.name==="AbortError")return;xe.error("Failed to load labels.",{description:ce?.message?String(ce.message):"Please try again."}),p([]),y(0)}finally{v(!1)}})(),()=>k.current?.abort()),[D,E,R,z,B,H,G,$,S]);const oe=()=>_(J=>J+1),ne=J=>{O(null),u(J),n(!0)},K=J=>{O(null),c(J),i(!0)};return l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsx("div",{className:"pb-4",children:l.jsx("div",{className:"flex flex-col gap-4",children:l.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[l.jsx(me,{placeholder:"Search",value:A,onChange:J=>C(J.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"}),l.jsxs(Ke,{value:E,onValueChange:T,children:[l.jsx(Ye,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:l.jsx(Xe,{placeholder:"Location"})}),l.jsx(Je,{children:l.jsx(Ne,{value:"all",children:"All Locations"})})]}),l.jsxs(Ke,{value:R,onValueChange:L,children:[l.jsx(Ye,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:l.jsx(Xe,{placeholder:"Category"})}),l.jsx(Je,{children:l.jsx(Ne,{value:"all",children:"All Categories"})})]}),l.jsxs(Ke,{value:z,onValueChange:F,children:[l.jsx(Ye,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:l.jsx(Xe,{placeholder:"Type"})}),l.jsx(Je,{children:l.jsx(Ne,{value:"all",children:"All Types"})})]}),l.jsxs(Ke,{value:H,onValueChange:V,children:[l.jsx(Ye,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:l.jsx(Xe,{placeholder:"State"})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"all",children:"All States"}),l.jsx(Ne,{value:"true",children:"Active"}),l.jsx(Ne,{value:"false",children:"Inactive"})]})]}),l.jsx("div",{className:"flex-1"}),l.jsxs(fe,{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 ",l.jsx(wn,{className:"ml-1 h-4 w-4"})]})]})})}),l.jsx("div",{className:"flex-1 overflow-auto pt-6",children:l.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:l.jsxs(Or,{children:[l.jsx(Er,{children:l.jsxs(Be,{className:"bg-gray-50 hover:bg-gray-50",children:[l.jsx(ve,{className:"font-bold text-gray-900 w-[120px]",children:"Label Code"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[140px]",children:"Label Name"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[120px]",children:"Location"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[140px]",children:"Category"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[140px]",children:"Type"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[120px]",children:"Template"}),l.jsx(ve,{className:"font-bold text-gray-900",children:"Products"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[100px]",children:"State"}),l.jsx(ve,{className:"font-bold text-gray-900",children:"Last Edited"}),l.jsx(ve,{className:"font-bold text-gray-900 text-center w-[100px]",children:"Actions"})]})}),l.jsx(Pr,{children:m?l.jsx(Be,{children:l.jsx(de,{colSpan:10,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):h.length===0?l.jsx(Be,{children:l.jsx(de,{colSpan:10,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):h.map(J=>l.jsxs(Be,{className:"hover:bg-gray-50",children:[l.jsx(de,{className:"font-medium whitespace-nowrap",children:Uce(J)}),l.jsx(de,{className:"whitespace-nowrap",children:Un(J.labelName)}),l.jsx(de,{className:"text-gray-600 whitespace-nowrap",children:Un(J.locationName??J.locationId)}),l.jsx(de,{className:"text-gray-600 whitespace-nowrap",children:Un(J.labelCategoryName??J.labelCategoryId)}),l.jsx(de,{className:"text-gray-600 whitespace-nowrap",children:Un(J.labelTypeName??J.labelTypeId)}),l.jsx(de,{className:"text-gray-600 whitespace-nowrap",children:Un(J.templateName??J.templateCode)}),l.jsx(de,{className:"text-gray-600 whitespace-nowrap",children:Vce(J)}),l.jsx(de,{children:l.jsx(xr,{className:J.state===!0?"bg-green-600":"bg-gray-400",children:J.state===!0?"Active":"Inactive"})}),l.jsx(de,{className:"text-gray-500 tabular-nums font-numeric whitespace-nowrap",children:Hce(J)}),l.jsx(de,{className:"text-center",children:l.jsxs(ma,{open:N===J.id,onOpenChange:ee=>O(ee?J.id:null),children:[l.jsx(ga,{asChild:!0,children:l.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:l.jsx(Ei,{className:"h-4 w-4 text-gray-500"})})}),l.jsxs(va,{align:"end",className:"w-40 p-1",children:[l.jsxs(fe,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>ne(J),children:[l.jsx(xn,{className:"w-4 h-4"}),"Edit"]}),l.jsx(fe,{type:"button",variant:"ghost",className:"w-full justify-start h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>K(J),children:"Delete"})]})]})})]},J.id))})]})})}),l.jsx("div",{className:"pt-4",children:l.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[l.jsxs("div",{children:["Showing ",x===0?0:(G-1)*$+1,"-",Math.min(G*$,x)," of ",x]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs(Ke,{value:String($),onValueChange:J=>Q(Number(J)),children:[l.jsx(Ye,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:l.jsx(Xe,{})}),l.jsx(Je,{children:[10,20,50].map(J=>l.jsxs(Ne,{value:String(J),children:[J," / page"]},J))})]}),l.jsx(_i,{className:"mx-0 w-auto justify-end",children:l.jsxs(Ni,{children:[l.jsx(At,{children:l.jsx(Ci,{href:"#",size:"default",onClick:J=>{J.preventDefault(),U(ee=>Math.max(1,ee-1))},"aria-disabled":G<=1,className:G<=1?"pointer-events-none opacity-50":""})}),l.jsx(At,{children:l.jsxs(ua,{href:"#",isActive:!0,size:"default",onClick:J=>J.preventDefault(),children:["Page ",G," / ",ie]})}),l.jsx(At,{children:l.jsx(Oi,{href:"#",size:"default",onClick:J=>{J.preventDefault(),U(ee=>Math.min(ie,ee+1))},"aria-disabled":G>=ie,className:G>=ie?"pointer-events-none opacity-50":""})})]})})]})]})}),l.jsx(Gce,{open:e,onOpenChange:t,onCreated:()=>{U(1),oe()}}),l.jsx(Kce,{open:r,label:o,onOpenChange:J=>{n(J),J||u(null)},onUpdated:oe}),l.jsx(Xce,{open:a,label:d,onOpenChange:J=>{i(J),J||c(null)},onDeleted:oe})]})}function Gce({open:e,onOpenChange:t,onCreated:r}){const{loading:n,templates:a,locations:i,categories:o,types:u,productOptions:d}=x5(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()){xe.error("Validation failed",{description:"Fill all required fields and select template, location, category, and type."});return}if(p.productIds.length===0){xe.error("Validation failed",{description:"Select at least one product."});return}h(!0);try{await Sce(p),xe.success("Label created.",{description:"The label has been created successfully."}),t(!1),r()}catch(O){xe.error("Failed to create label.",{description:O?.message?String(O.message):"Please try again."})}finally{h(!1)}},y=b.useMemo(()=>a.filter(O=>Pu(O)).map(O=>({value:Pu(O),label:y5(O)})),[a]),S=b.useMemo(()=>i.map(O=>({value:O.id,label:Un(O.locationName??O.locationCode??O.id)})),[i]),_=b.useMemo(()=>o.map(O=>({value:O.id,label:Un(O.categoryName??O.categoryCode??O.id)})),[o]),N=b.useMemo(()=>u.map(O=>({value:O.id,label:Un(O.typeName??O.typeCode??O.id)})),[u]);return l.jsx(mt,{open:e,onOpenChange:t,children:l.jsxs(ft,{className:"sm:max-w-[600px]",children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Add New Label"}),l.jsx(Nt,{children:"Enter the details for the new label."})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Label Code *"}),l.jsx(me,{className:"h-10",placeholder:"e.g. LBL_TEST_001",value:p.labelCode,onChange:O=>m(A=>({...A,labelCode:O.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Label Name *"}),l.jsx(me,{className:"h-10",placeholder:"e.g. Breakfast label",value:p.labelName,onChange:O=>m(A=>({...A,labelName:O.target.value}))})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Label Template *"}),l.jsx(na,{value:p.templateCode,onValueChange:O=>m(A=>({...A,templateCode:O})),options:y,placeholder:"Select template",searchPlaceholder:"Search template…",emptyText:"No templates found.",disabled:n})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Location *"}),l.jsx(na,{value:p.locationId,onValueChange:O=>m(A=>({...A,locationId:O})),options:S,placeholder:"Select location",searchPlaceholder:"Search location…",emptyText:"No locations found.",disabled:n})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Label Category *"}),l.jsx(na,{value:p.labelCategoryId,onValueChange:O=>m(A=>({...A,labelCategoryId:O})),options:_,placeholder:"Select category",searchPlaceholder:"Search category…",emptyText:"No categories found.",disabled:n})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Label Type *"}),l.jsx(na,{value:p.labelTypeId,onValueChange:O=>m(A=>({...A,labelTypeId:O})),options:N,placeholder:"Select type",searchPlaceholder:"Search type…",emptyText:"No types found.",disabled:n})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Product * (multi-select)"}),l.jsx(b5,{value:p.productIds,onChange:O=>m(A=>({...A,productIds:O})),disabled:n,productOptions:d})]}),l.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[l.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),l.jsx(qt,{checked:p.state,onCheckedChange:O=>m(A=>({...A,state:O}))})]})]}),l.jsxs(xt,{children:[l.jsx(fe,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),l.jsx(fe,{disabled:c||n,onClick:x,children:c?"Creating…":"Create"})]})]})})}function Kce({open:e,label:t,onOpenChange:r,onUpdated:n}){const{loading:a,templates:i,locations:o,categories:u,types:d,productOptions:c}=x5(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 C=t.id;y(BR(t));const E=new AbortController;let T=!1;return v(!0),(async()=>{try{const R=await wce(C,E.signal);if(T)return;y(BR(R))}catch(R){if(T||R?.name==="AbortError")return;xe.error("Failed to load label details.",{description:R?.message?String(R.message):"Form shows list data only; check network."})}finally{T||v(!1)}})(),()=>{T=!0,E.abort()}},[e,t]);const S=async()=>{if(t?.id){if(!x.labelName.trim()||!x.templateCode.trim()||!x.locationId.trim()||!x.labelCategoryId.trim()||!x.labelTypeId.trim()){xe.error("Validation failed",{description:"Fill all required fields and select template, location, category, and type."});return}if(x.productIds.length===0){xe.error("Validation failed",{description:"Select at least one product."});return}p(!0);try{await jce(t.id,x),xe.success("Label updated.",{description:"The label has been updated successfully."}),r(!1),n()}catch(C){xe.error("Failed to update label.",{description:C?.message?String(C.message):"Please try again."})}finally{p(!1)}}},_=b.useMemo(()=>{const C=i.filter(T=>Pu(T)).map(T=>({value:Pu(T),label:y5(T)})),E=x.templateCode;return E&&!C.some(T=>T.value===E)?[{value:E,label:`${E} (current)`},...C]:C},[i,x.templateCode]),N=b.useMemo(()=>{const C=o.map(T=>({value:T.id,label:Un(T.locationName??T.locationCode??T.id)})),E=x.locationId;return E&&!C.some(T=>T.value===E)?[{value:E,label:`${E} (current)`},...C]:C},[o,x.locationId]),O=b.useMemo(()=>{const C=u.map(T=>({value:T.id,label:Un(T.categoryName??T.categoryCode??T.id)})),E=x.labelCategoryId;return E&&!C.some(T=>T.value===E)?[{value:E,label:`${E} (current)`},...C]:C},[u,x.labelCategoryId]),A=b.useMemo(()=>{const C=d.map(T=>({value:T.id,label:Un(T.typeName??T.typeCode??T.id)})),E=x.labelTypeId;return E&&!C.some(T=>T.value===E)?[{value:E,label:`${E} (current)`},...C]:C},[d,x.labelTypeId]);return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-[600px]",children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Edit Label"}),l.jsx(Nt,{children:m?"Loading label details…":"Update the label details."})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Label Name *"}),l.jsx(me,{className:"h-10",placeholder:"e.g. Breakfast label",value:x.labelName,onChange:C=>y(E=>({...E,labelName:C.target.value})),disabled:m})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Label Template *"}),l.jsx(na,{value:x.templateCode,onValueChange:C=>y(E=>({...E,templateCode:C})),options:_,placeholder:"Select template",searchPlaceholder:"Search template…",emptyText:"No templates found.",disabled:a||m})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Location *"}),l.jsx(na,{value:x.locationId,onValueChange:C=>y(E=>({...E,locationId:C})),options:N,placeholder:"Select location",searchPlaceholder:"Search location…",emptyText:"No locations found.",disabled:a||m})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Label Category *"}),l.jsx(na,{value:x.labelCategoryId,onValueChange:C=>y(E=>({...E,labelCategoryId:C})),options:O,placeholder:"Select category",searchPlaceholder:"Search category…",emptyText:"No categories found.",disabled:a||m})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Label Type *"}),l.jsx(na,{value:x.labelTypeId,onValueChange:C=>y(E=>({...E,labelTypeId:C})),options:A,placeholder:"Select type",searchPlaceholder:"Search type…",emptyText:"No types found.",disabled:a||m})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Product * (multi-select)"}),l.jsx(b5,{value:x.productIds,onChange:C=>y(E=>({...E,productIds:C})),disabled:a||m,productOptions:c})]}),l.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[l.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),l.jsx(qt,{checked:x.state,onCheckedChange:C=>y(E=>({...E,state:C})),disabled:m})]})]}),l.jsxs(xt,{children:[l.jsx(fe,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{disabled:h||a||m,onClick:S,children:h?"Updating…":"Update"})]})]})})}function Xce({open:e,label:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),o=b.useMemo(()=>(t?.labelName??"").trim()||t?.labelCode||t?.id||"this label",[t]),u=async()=>{if(t?.id){i(!0);try{await _ce(t.id),xe.success("Label deleted.",{description:"The label has been removed successfully."}),r(!1),n()}catch(d){xe.error("Failed to delete label.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-none",style:{width:"30%"},children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Delete Label"}),l.jsx(Nt,{children:"This action cannot be undone."})]}),l.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",l.jsx("span",{className:"font-medium",children:o}),"?"]}),l.jsxs(xt,{className:"flex-row flex-wrap justify-end",children:[l.jsx(fe,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{className:"min-w-24",variant:"destructive",disabled:a,onClick:u,children:a?"Deleting...":"Delete"})]})]})})}function O1(e){const t=(e??"").trim();return t||"None"}function Yce(){const[e,t]=b.useState(!1),[r,n]=b.useState(!1),[a,i]=b.useState(!1),[o,u]=b.useState(null),[d,c]=b.useState(null),[h,p]=b.useState([]),[m,v]=b.useState(!1),[x,y]=b.useState(0),[S,_]=b.useState(0),[N,O]=b.useState(null),[A,C]=b.useState(""),[E,T]=b.useState("all"),[R,L]=b.useState(1),[z,F]=b.useState(10),B=b.useRef(null),q=b.useRef(null),[H,V]=b.useState("");b.useEffect(()=>(q.current&&window.clearTimeout(q.current),q.current=window.setTimeout(()=>V(A.trim()),300),()=>{q.current&&window.clearTimeout(q.current)}),[A]);const G=Math.max(1,Math.ceil(x/z));b.useEffect(()=>{L(1)},[H,E,z]),b.useEffect(()=>((async()=>{B.current?.abort();const I=new AbortController;B.current=I,v(!0);try{const D=(R-1)*z,Z=await s_({skipCount:D,maxResultCount:z,keyword:H||void 0,state:E==="all"?void 0:E==="true"},I.signal);p(Z.items??[]),y(Z.totalCount??0)}catch(D){if(D?.name==="AbortError")return;xe.error("Failed to load label categories.",{description:D?.message?String(D.message):"Please try again."}),p([]),y(0)}finally{v(!1)}})(),()=>B.current?.abort()),[H,E,R,z,S]);const U=()=>_(k=>k+1),$=k=>{O(null),u(k),n(!0)},Q=k=>{O(null),c(k),i(!0)};return l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsx("div",{className:"pb-4",children:l.jsx("div",{className:"flex flex-col gap-4",children:l.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[l.jsx(me,{placeholder:"Search",value:A,onChange:k=>C(k.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"}),l.jsxs(Ke,{value:E,onValueChange:T,children:[l.jsx(Ye,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:l.jsx(Xe,{placeholder:"State"})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"all",children:"All States"}),l.jsx(Ne,{value:"true",children:"Active"}),l.jsx(Ne,{value:"false",children:"Inactive"})]})]}),l.jsx("div",{className:"flex-1"}),l.jsxs(fe,{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 ",l.jsx(wn,{className:"ml-1 h-4 w-4"})]})]})})}),l.jsx("div",{className:"flex-1 overflow-auto pt-6",children:l.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:l.jsxs(Or,{children:[l.jsx(Er,{children:l.jsxs(Be,{className:"bg-gray-50 hover:bg-gray-50",children:[l.jsx(ve,{className:"font-bold text-gray-900 w-[250px]",children:"Label Category"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[200px]",children:"Category Code"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[200px]",children:"Category Photo"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[100px]",children:"State"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[100px]",children:"Order"}),l.jsx(ve,{className:"font-bold text-gray-900",children:"Last Edited"}),l.jsx(ve,{className:"font-bold text-gray-900 text-center w-[100px]",children:"Actions"})]})}),l.jsx(Pr,{children:m?l.jsx(Be,{children:l.jsx(de,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):h.length===0?l.jsx(Be,{children:l.jsx(de,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):h.map(k=>l.jsxs(Be,{className:"hover:bg-gray-50",children:[l.jsx(de,{className:"font-medium",children:O1(k.categoryName)}),l.jsx(de,{className:"text-gray-600",children:O1(k.categoryCode)}),l.jsx(de,{className:"text-gray-500",children:O1(k.categoryPhotoUrl)}),l.jsx(de,{children:l.jsx(xr,{className:k.state?"bg-green-600":"bg-gray-400",children:k.state?"Active":"Inactive"})}),l.jsx(de,{className:"font-numeric",children:k.orderNum??"None"}),l.jsx(de,{className:"text-gray-500 tabular-nums font-numeric",children:k.creationTime?new Date(k.creationTime).toLocaleString():"None"}),l.jsx(de,{className:"text-center",children:l.jsxs(ma,{open:N===k.id,onOpenChange:I=>O(I?k.id:null),children:[l.jsx(ga,{asChild:!0,children:l.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:l.jsx(Ei,{className:"h-4 w-4 text-gray-500"})})}),l.jsxs(va,{align:"end",className:"w-40 p-1",children:[l.jsxs(fe,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>$(k),children:[l.jsx(xn,{className:"w-4 h-4"}),"Edit"]}),l.jsx(fe,{type:"button",variant:"ghost",className:"w-full justify-start h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>Q(k),children:"Delete"})]})]})})]},k.id))})]})})}),l.jsx("div",{className:"pt-4",children:l.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[l.jsxs("div",{children:["Showing ",x===0?0:(R-1)*z+1,"-",Math.min(R*z,x)," of ",x]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs(Ke,{value:String(z),onValueChange:k=>F(Number(k)),children:[l.jsx(Ye,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:l.jsx(Xe,{})}),l.jsx(Je,{children:[10,20,50].map(k=>l.jsxs(Ne,{value:String(k),children:[k," / page"]},k))})]}),l.jsx(_i,{className:"mx-0 w-auto justify-end",children:l.jsxs(Ni,{children:[l.jsx(At,{children:l.jsx(Ci,{href:"#",size:"default",onClick:k=>{k.preventDefault(),L(I=>Math.max(1,I-1))},"aria-disabled":R<=1,className:R<=1?"pointer-events-none opacity-50":""})}),l.jsx(At,{children:l.jsxs(ua,{href:"#",isActive:!0,size:"default",onClick:k=>k.preventDefault(),children:["Page ",R," / ",G]})}),l.jsx(At,{children:l.jsx(Oi,{href:"#",size:"default",onClick:k=>{k.preventDefault(),L(I=>Math.min(G,I+1))},"aria-disabled":R>=G,className:R>=G?"pointer-events-none opacity-50":""})})]})})]})]})}),l.jsx(Jce,{open:e,onOpenChange:t,onCreated:()=>{L(1),U()}}),l.jsx(Qce,{open:r,category:o,onOpenChange:k=>{n(k),k||u(null)},onUpdated:U}),l.jsx(Zce,{open:a,category:d,onOpenChange:k=>{i(k),k||c(null)},onDeleted:U})]})}function Jce({open:e,onOpenChange:t,onCreated:r}){const[n,a]=b.useState(!1),[i,o]=b.useState({categoryCode:"",categoryName:"",categoryPhotoUrl:null,state:!0,orderNum:null}),u=()=>{o({categoryCode:"",categoryName:"",categoryPhotoUrl:null,state:!0,orderNum:null})};b.useEffect(()=>{e||u()},[e]);const d=async()=>{if(!i.categoryCode.trim()||!i.categoryName.trim()){xe.error("Validation failed",{description:"Category Code and Category Name are required."});return}a(!0);try{await Ece(i),xe.success("Label category created.",{description:"The label category has been created successfully."}),t(!1),r()}catch(c){xe.error("Failed to create label category.",{description:c?.message?String(c.message):"Please try again."})}finally{a(!1)}};return l.jsx(mt,{open:e,onOpenChange:t,children:l.jsxs(ft,{className:"sm:max-w-[600px]",children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Add New Label Category"}),l.jsx(Nt,{children:"Enter the details for the new label category."})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Category Code *"}),l.jsx(me,{placeholder:"e.g. CAT_PREP",value:i.categoryCode,onChange:c=>o(h=>({...h,categoryCode:c.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Category Name *"}),l.jsx(me,{placeholder:"e.g. Prep",value:i.categoryName,onChange:c=>o(h=>({...h,categoryName:c.target.value}))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Category Photo URL"}),l.jsx(me,{placeholder:"https://cdn.example.com/cat-prep.png",value:i.categoryPhotoUrl??"",onChange:c=>o(h=>({...h,categoryPhotoUrl:c.target.value||null}))})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Order"}),l.jsx(me,{type:"number",placeholder:"e.g. 1",value:i.orderNum??"",onChange:c=>o(h=>({...h,orderNum:c.target.value?Number(c.target.value):null}))})]}),l.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[l.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),l.jsx(qt,{checked:i.state,onCheckedChange:c=>o(h=>({...h,state:c}))})]})]})]}),l.jsxs(xt,{children:[l.jsx(fe,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),l.jsx(fe,{disabled:n,onClick:d,children:n?"Creating...":"Create"})]})]})})}function Qce({open:e,category:t,onOpenChange:r,onUpdated:n}){const[a,i]=b.useState(!1),[o,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()){xe.error("Validation failed",{description:"Category Code and Category Name are required."});return}i(!0);try{await Pce(t.id,d),xe.success("Label category updated.",{description:"The label category has been updated successfully."}),r(!1),n()}catch(p){xe.error("Failed to update label category.",{description:p?.message?String(p.message):"Please try again."})}finally{i(!1)}}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-[600px]",children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Edit Label Category"}),l.jsx(Nt,{children:"Update the label category details."})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Category Code *"}),l.jsx(me,{placeholder:"e.g. CAT_PREP",value:d.categoryCode,onChange:p=>c(m=>({...m,categoryCode:p.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Category Name *"}),l.jsx(me,{placeholder:"e.g. Prep",value:d.categoryName,onChange:p=>c(m=>({...m,categoryName:p.target.value}))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Category Photo URL"}),l.jsx(me,{placeholder:"https://cdn.example.com/cat-prep.png",value:d.categoryPhotoUrl??"",onChange:p=>c(m=>({...m,categoryPhotoUrl:p.target.value||null}))})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Order"}),l.jsx(me,{type:"number",placeholder:"e.g. 1",value:d.orderNum??"",onChange:p=>c(m=>({...m,orderNum:p.target.value?Number(p.target.value):null}))})]}),l.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[l.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),l.jsx(qt,{checked:d.state,onCheckedChange:p=>c(m=>({...m,state:p}))})]})]})]}),l.jsxs(xt,{children:[l.jsx(fe,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{disabled:a,onClick:h,children:a?"Updating...":"Update"})]})]})})}function Zce({open:e,category:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),o=b.useMemo(()=>(t?.categoryName??"").trim()||t?.categoryCode||"this category",[t]),u=async()=>{if(t?.id){i(!0);try{await Ace(t.id),xe.success("Label category deleted.",{description:"The label category has been removed successfully."}),r(!1),n()}catch(d){xe.error("Failed to delete label category.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-none",style:{width:"30%"},children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Delete Label Category"}),l.jsx(Nt,{children:"This action cannot be undone."})]}),l.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",l.jsx("span",{className:"font-medium",children:o}),"?"]}),l.jsxs(xt,{className:"flex-row flex-wrap justify-end",children:[l.jsx(fe,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{className:"min-w-24",variant:"destructive",disabled:a,onClick:u,children:a?"Deleting...":"Delete"})]})]})})}function FR(e){const t=(e??"").trim();return t||"None"}function eue(){const[e,t]=b.useState(!1),[r,n]=b.useState(!1),[a,i]=b.useState(!1),[o,u]=b.useState(null),[d,c]=b.useState(null),[h,p]=b.useState([]),[m,v]=b.useState(!1),[x,y]=b.useState(0),[S,_]=b.useState(0),[N,O]=b.useState(null),[A,C]=b.useState(""),[E,T]=b.useState("all"),[R,L]=b.useState(1),[z,F]=b.useState(10),B=b.useRef(null),q=b.useRef(null),[H,V]=b.useState("");b.useEffect(()=>(q.current&&window.clearTimeout(q.current),q.current=window.setTimeout(()=>V(A.trim()),300),()=>{q.current&&window.clearTimeout(q.current)}),[A]);const G=Math.max(1,Math.ceil(x/z));b.useEffect(()=>{L(1)},[H,E,z]),b.useEffect(()=>((async()=>{B.current?.abort();const I=new AbortController;B.current=I,v(!0);try{const D=(R-1)*z,Z=await g5({skipCount:D,maxResultCount:z,keyword:H||void 0,state:E==="all"?void 0:E==="true"},I.signal);p(Z.items??[]),y(Z.totalCount??0)}catch(D){if(D?.name==="AbortError")return;xe.error("Failed to load label types.",{description:D?.message?String(D.message):"Please try again."}),p([]),y(0)}finally{v(!1)}})(),()=>B.current?.abort()),[H,E,R,z,S]);const U=()=>_(k=>k+1),$=k=>{O(null),u(k),n(!0)},Q=k=>{O(null),c(k),i(!0)};return l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsx("div",{className:"pb-4",children:l.jsx("div",{className:"flex flex-col gap-4",children:l.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[l.jsx(me,{placeholder:"Search",value:A,onChange:k=>C(k.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"}),l.jsxs(Ke,{value:E,onValueChange:T,children:[l.jsx(Ye,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:l.jsx(Xe,{placeholder:"State"})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"all",children:"All States"}),l.jsx(Ne,{value:"true",children:"Active"}),l.jsx(Ne,{value:"false",children:"Inactive"})]})]}),l.jsx("div",{className:"flex-1"}),l.jsxs(fe,{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 ",l.jsx(wn,{className:"ml-1 h-4 w-4"})]})]})})}),l.jsx("div",{className:"flex-1 overflow-auto pt-6",children:l.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:l.jsxs(Or,{children:[l.jsx(Er,{children:l.jsxs(Be,{className:"bg-gray-50 hover:bg-gray-50",children:[l.jsx(ve,{className:"font-bold text-gray-900 w-[250px]",children:"Label Types"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[200px]",children:"Type Code"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[100px]",children:"State"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[100px]",children:"Order"}),l.jsx(ve,{className:"font-bold text-gray-900",children:"Last Edited"}),l.jsx(ve,{className:"font-bold text-gray-900 text-center w-[100px]",children:"Actions"})]})}),l.jsx(Pr,{children:m?l.jsx(Be,{children:l.jsx(de,{colSpan:6,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):h.length===0?l.jsx(Be,{children:l.jsx(de,{colSpan:6,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):h.map(k=>l.jsxs(Be,{className:"hover:bg-gray-50",children:[l.jsx(de,{className:"font-medium",children:FR(k.typeName)}),l.jsx(de,{className:"text-gray-600",children:FR(k.typeCode)}),l.jsx(de,{children:l.jsx(xr,{className:k.state?"bg-green-600":"bg-gray-400",children:k.state?"Active":"Inactive"})}),l.jsx(de,{className:"font-numeric",children:k.orderNum??"None"}),l.jsx(de,{className:"text-gray-500 tabular-nums font-numeric",children:k.creationTime?new Date(k.creationTime).toLocaleString():"None"}),l.jsx(de,{className:"text-center",children:l.jsxs(ma,{open:N===k.id,onOpenChange:I=>O(I?k.id:null),children:[l.jsx(ga,{asChild:!0,children:l.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:l.jsx(Ei,{className:"h-4 w-4 text-gray-500"})})}),l.jsxs(va,{align:"end",className:"w-40 p-1",children:[l.jsxs(fe,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>$(k),children:[l.jsx(xn,{className:"w-4 h-4"}),"Edit"]}),l.jsx(fe,{type:"button",variant:"ghost",className:"w-full justify-start h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>Q(k),children:"Delete"})]})]})})]},k.id))})]})})}),l.jsx("div",{className:"pt-4",children:l.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[l.jsxs("div",{children:["Showing ",x===0?0:(R-1)*z+1,"-",Math.min(R*z,x)," of ",x]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs(Ke,{value:String(z),onValueChange:k=>F(Number(k)),children:[l.jsx(Ye,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:l.jsx(Xe,{})}),l.jsx(Je,{children:[10,20,50].map(k=>l.jsxs(Ne,{value:String(k),children:[k," / page"]},k))})]}),l.jsx(_i,{className:"mx-0 w-auto justify-end",children:l.jsxs(Ni,{children:[l.jsx(At,{children:l.jsx(Ci,{href:"#",size:"default",onClick:k=>{k.preventDefault(),L(I=>Math.max(1,I-1))},"aria-disabled":R<=1,className:R<=1?"pointer-events-none opacity-50":""})}),l.jsx(At,{children:l.jsxs(ua,{href:"#",isActive:!0,size:"default",onClick:k=>k.preventDefault(),children:["Page ",R," / ",G]})}),l.jsx(At,{children:l.jsx(Oi,{href:"#",size:"default",onClick:k=>{k.preventDefault(),L(I=>Math.min(G,I+1))},"aria-disabled":R>=G,className:R>=G?"pointer-events-none opacity-50":""})})]})})]})]})}),l.jsx(tue,{open:e,onOpenChange:t,onCreated:()=>{L(1),U()}}),l.jsx(rue,{open:r,type:o,onOpenChange:k=>{n(k),k||u(null)},onUpdated:U}),l.jsx(nue,{open:a,type:d,onOpenChange:k=>{i(k),k||c(null)},onDeleted:U})]})}function tue({open:e,onOpenChange:t,onCreated:r}){const[n,a]=b.useState(!1),[i,o]=b.useState({typeCode:"",typeName:"",state:!0,orderNum:null}),u=()=>{o({typeCode:"",typeName:"",state:!0,orderNum:null})};b.useEffect(()=>{e||u()},[e]);const d=async()=>{if(!i.typeCode.trim()||!i.typeName.trim()){xe.error("Validation failed",{description:"Type Code and Type Name are required."});return}a(!0);try{await Tce(i),xe.success("Label type created.",{description:"The label type has been created successfully."}),t(!1),r()}catch(c){xe.error("Failed to create label type.",{description:c?.message?String(c.message):"Please try again."})}finally{a(!1)}};return l.jsx(mt,{open:e,onOpenChange:t,children:l.jsxs(ft,{className:"sm:max-w-[600px]",children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Add New Label Type"}),l.jsx(Nt,{children:"Enter the details for the new label type."})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Type Code *"}),l.jsx(me,{placeholder:"e.g. TYPE_DEFROST",value:i.typeCode,onChange:c=>o(h=>({...h,typeCode:c.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Type Name *"}),l.jsx(me,{placeholder:"e.g. Defrost",value:i.typeName,onChange:c=>o(h=>({...h,typeName:c.target.value}))})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Order"}),l.jsx(me,{type:"number",placeholder:"e.g. 1",value:i.orderNum??"",onChange:c=>o(h=>({...h,orderNum:c.target.value?Number(c.target.value):null}))})]}),l.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[l.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),l.jsx(qt,{checked:i.state,onCheckedChange:c=>o(h=>({...h,state:c}))})]})]})]}),l.jsxs(xt,{children:[l.jsx(fe,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),l.jsx(fe,{disabled:n,onClick:d,children:n?"Creating...":"Create"})]})]})})}function rue({open:e,type:t,onOpenChange:r,onUpdated:n}){const[a,i]=b.useState(!1),[o,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(!o.typeCode.trim()||!o.typeName.trim()){xe.error("Validation failed",{description:"Type Code and Type Name are required."});return}i(!0);try{await kce(t.id,o),xe.success("Label type updated.",{description:"The label type has been updated successfully."}),r(!1),n()}catch(c){xe.error("Failed to update label type.",{description:c?.message?String(c.message):"Please try again."})}finally{i(!1)}}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-[600px]",children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Edit Label Type"}),l.jsx(Nt,{children:"Update the label type details."})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Type Code *"}),l.jsx(me,{placeholder:"e.g. TYPE_DEFROST",value:o.typeCode,onChange:c=>u(h=>({...h,typeCode:c.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Type Name *"}),l.jsx(me,{placeholder:"e.g. Defrost",value:o.typeName,onChange:c=>u(h=>({...h,typeName:c.target.value}))})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Order"}),l.jsx(me,{type:"number",placeholder:"e.g. 1",value:o.orderNum??"",onChange:c=>u(h=>({...h,orderNum:c.target.value?Number(c.target.value):null}))})]}),l.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[l.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),l.jsx(qt,{checked:o.state,onCheckedChange:c=>u(h=>({...h,state:c}))})]})]})]}),l.jsxs(xt,{children:[l.jsx(fe,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{disabled:a,onClick:d,children:a?"Updating...":"Update"})]})]})})}function nue({open:e,type:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),o=b.useMemo(()=>(t?.typeName??"").trim()||t?.typeCode||"this type",[t]),u=async()=>{if(t?.id){i(!0);try{await Rce(t.id),xe.success("Label type deleted.",{description:"The label type has been removed successfully."}),r(!1),n()}catch(d){xe.error("Failed to delete label type.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-none",style:{width:"30%"},children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Delete Label Type"}),l.jsx(Nt,{children:"This action cannot be undone."})]}),l.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",l.jsx("span",{className:"font-medium",children:o}),"?"]}),l.jsxs(xt,{className:"flex-row flex-wrap justify-end",children:[l.jsx(fe,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{className:"min-w-24",variant:"destructive",disabled:a,onClick:u,children:a?"Deleting...":"Delete"})]})]})})}function aue(){return`template-${Date.now()}`}function iue(){return`el-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function oue(e){return{id:e??aue(),name:"未命名模板",labelType:"PRICE",unit:"cm",width:6,height:4,appliedLocation:"ALL",appliedLocationIds:[],showRuler:!0,showGrid:!0,elements:[]}}const E1=[{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 zR(e,t=20,r=20){const n=iue(),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 w5(e){const t=String(e.appliedLocation??"").trim().toUpperCase();return t==="ALL"?"ALL":t==="SPECIFIED"||(e.appliedLocationIds?.length??0)>0?"SPECIFIED":"ALL"}function sue(e){switch(e){case"TEXT_PRODUCT":return"PRODUCT";case"TEXT_PRICE":return"PRICE";default:return"FIXED"}}const lue=[{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"}}]}];function cue({onAddElement:e}){return l.jsxs("div",{className:"w-44 shrink-0 border-r border-gray-200 bg-white flex flex-col h-full",children:[l.jsx("div",{className:"px-2 py-2 border-b border-gray-200 font-semibold text-gray-800 text-sm",children:"Elements"}),l.jsx($s,{className:"flex-1",children:l.jsx("div",{className:"p-1.5 space-y-3",children:lue.map(t=>l.jsxs("div",{children:[l.jsx("div",{className:"px-2 py-1 text-xs font-medium text-gray-500 uppercase tracking-wide",children:t.title}),t.subtitle&&l.jsx("div",{className:"px-2 py-0.5 text-[10px] text-gray-400",children:t.subtitle}),l.jsx("div",{className:"grid grid-cols-2 gap-1 mt-0.5",children:t.items.map((r,n)=>l.jsx("button",{type:"button",onClick:()=>e(r.type,r.config),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 qf={},Cc={},Uf={},qR;function on(){if(qR)return Uf;qR=1,Object.defineProperty(Uf,"__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 Uf.default=t,Uf}var UR;function uue(){if(UR)return Cc;UR=1,Object.defineProperty(Cc,"__esModule",{value:!0}),Cc.CODE39=void 0;var e=(function(){function y(S,_){for(var N=0;N<_.length;N++){var O=_[N];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(S,O.key,O)}}return function(S,_,N){return _&&y(S.prototype,_),N&&y(S,N),S}})(),t=on(),r=n(t);function n(y){return y&&y.__esModule?y:{default:y}}function a(y,S){if(!(y instanceof S))throw new TypeError("Cannot call a class as a function")}function i(y,S){if(!y)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:y}function o(y,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);y.prototype=Object.create(S&&S.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(y,S):y.__proto__=S)}var u=(function(y){o(S,y);function S(_,N){return a(this,S),_=_.toUpperCase(),N.mod43&&(_+=m(x(_))),i(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,_,N))}return e(S,[{key:"encode",value:function(){for(var N=h("*"),O=0;O=200){S=m.shift()-105;var _=n.SWAP[S];_!==void 0?y=h.next(m,v+1,_):((x===n.SET_A||x===n.SET_B)&&S===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 S=h.correctIndex(m,x),y=h.next(m,v+1,x);var N=h.getBar(S),O=S*v;return{result:N+y.result,checksum:O+y.checksum}}}]),h})(r.default);return Hf.default=d,Hf}var Wf={},WR;function due(){if(WR)return Wf;WR=1,Object.defineProperty(Wf,"__esModule",{value:!0});var e=Zu(),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(o,u){var d=u?e.A_CHARS:e.B_CHARS,c=o.match(new RegExp("^("+d+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(c)return c[1]+"Ì"+i(o.substring(c[1].length));var h=o.match(new RegExp("^"+d+"+"))[0];return h.length===o.length?o:h+String.fromCharCode(u?205:206)+a(o.substring(h.length),!u)}function i(o){var u=n(o),d=u.length;if(d===o.length)return o;o=o.substring(d);var c=t(o)>=r(o);return u+String.fromCharCode(c?206:205)+a(o,c)}return Wf.default=function(o){var u=void 0,d=n(o).length;if(d>=2)u=e.C_START_CHAR+i(o);else{var c=t(o)>r(o);u=(c?e.A_START_CHAR:e.B_START_CHAR)+a(o,c)}return u.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(h,p){return"Ë"+p})},Wf}var GR;function fue(){if(GR)return Vf;GR=1,Object.defineProperty(Vf,"__esModule",{value:!0});var e=ng(),t=a(e),r=due(),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 o(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=o(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,(0,n.default)(p),m));else var v=o(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,p,m));return o(v)}return h})(t.default);return Vf.default=d,Vf}var Gf={},KR;function hue(){if(KR)return Gf;KR=1,Object.defineProperty(Gf,"__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 Jf.default=h,Jf}var tI;function vue(){if(tI)return Yf;tI=1,Object.defineProperty(Yf,"__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 Oc.default=c,Oc}var rh={},oI;function wue(){if(oI)return rh;oI=1,Object.defineProperty(rh,"__esModule",{value:!0});var e=(function(){function x(y,S){for(var _=0;__.width*10?N.fontSize=_.width*10:N.fontSize=_.fontSize,N.guardHeight=_.height+N.fontSize/2+_.textMargin,N}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 _="";return _+="101",_+=this.encodeMiddleDigits(),_+="010101",{data:_,text:this.text}}},{key:"guardedEncoding",value:function(){var _=[];return this.displayValue&&_.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),_.push({data:"101",options:{height:this.guardHeight}}),_.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),_.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&_.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),_}},{key:"encodeMiddleDigits",value:function(){var _=this.upcA[0],N=this.upcA[this.upcA.length-1],O=p[parseInt(N)][parseInt(_)];return(0,r.default)(this.middleDigits,O)}}]),y})(a.default);function v(x,y){for(var S=parseInt(x[x.length-1]),_=h[S],N="",O=0,A=0;A<_.length;A++){var C=_[A];C==="X"?N+=x[O++]:N+=C}return N=""+y+N,""+N+(0,i.checksum)(N)}return rh.default=m,rh}var sI;function Sue(){if(sI)return Sr;sI=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.UPCE=Sr.UPC=Sr.EAN2=Sr.EAN5=Sr.EAN8=Sr.EAN13=void 0;var e=vue(),t=m(e),r=yue(),n=m(r),a=xue(),i=m(a),o=bue(),u=m(o),d=j5(),c=m(d),h=wue(),p=m(h);function m(v){return v&&v.__esModule?v:{default:v}}return Sr.EAN13=t.default,Sr.EAN8=n.default,Sr.EAN5=i.default,Sr.EAN2=u.default,Sr.UPC=c.default,Sr.UPCE=p.default,Sr}var to={},nh={},gs={},lI;function jue(){return lI||(lI=1,Object.defineProperty(gs,"__esModule",{value:!0}),gs.START_BIN="1010",gs.END_BIN="11101",gs.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),gs}var cI;function _5(){if(cI)return nh;cI=1,Object.defineProperty(nh,"__esModule",{value:!0});var e=(function(){function c(h,p){for(var m=0;m=3&&this.number<=131070}}]),c})(r.default);return Pc.pharmacode=u,Pc}var Ac={},bI;function kue(){if(bI)return Ac;bI=1,Object.defineProperty(Ac,"__esModule",{value:!0}),Ac.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"]}),vs}var SI;function N5(){if(SI)return uh;SI=1,Object.defineProperty(uh,"__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 Hr.getMaximumHeightOfEncodings=u,Hr.getEncodingHeight=n,Hr.getBarcodePadding=a,Hr.calculateEncodingAttributes=i,Hr.getTotalWidthOfEncodings=o,Hr}var II;function zue(){if(II)return bh;II=1,Object.defineProperty(bh,"__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 bh.default=o,bh}var wh={},MI;function que(){if(MI)return wh;MI=1,Object.defineProperty(wh,"__esModule",{value:!0});var e=(function(){function d(c,h){for(var p=0;p0&&(this.drawRect(S-p.width*y,x,p.width*y,p.height,h),y=0);y>0&&this.drawRect(S-p.width*(y-1),x,p.width*y,p.height,h)}},{key:"drawSVGText",value:function(h,p,m){var v=this.document.createElementNS(o,"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",o),m.setAttribute("version","1.1")}},{key:"createGroup",value:function(h,p,m){var v=this.document.createElementNS(o,"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(o,"rect");return y.setAttribute("x",h),y.setAttribute("y",p),y.setAttribute("width",m),y.setAttribute("height",v),x.appendChild(y),y}}]),d})();return wh.default=u,wh}var Sh={},DI;function Uue(){if(DI)return Sh;DI=1,Object.defineProperty(Sh,"__esModule",{value:!0});var e=(function(){function n(a,i){for(var o=0;o"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 q._renderProperties=(0,c.default)(z),q._encodings=[],q._options=S.default,q._errorHandler=new v.default(q),typeof F<"u"&&(B=B||{},B.format||(B.format=T()),q.options(B)[B.format](F,B).render()),q};O.getModule=function(L){return t.default[L]};for(var A in t.default)t.default.hasOwnProperty(A)&&C(t.default,A);function C(L,z){N.prototype[z]=N.prototype[z.toUpperCase()]=N.prototype[z.toLowerCase()]=function(F,B){var q=this;return q._errorHandler.wrapBarcodeCall(function(){B.text=typeof B.text>"u"?void 0:""+B.text;var H=(0,n.default)(q._options,B);H=(0,p.default)(H);var V=L[z],G=E(F,V,H);return q._encodings.push(G),q})}}function E(L,z,F){L=""+L;var B=new z(L,F);if(!B.valid())throw new x.InvalidInputException(B.constructor.name,L);var q=B.encode();q=(0,i.default)(q);for(var H=0;Ht in e?Yue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,bS=(e,t)=>{for(var r in t||(t={}))A5.call(t,r)&&qI(e,r,t[r]);if(Hp)for(var r of Hp(t))T5.call(t,r)&&qI(e,r,t[r]);return e},wS=(e,t)=>{var r={};for(var n in e)A5.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Hp)for(var n of Hp(e))t.indexOf(n)<0&&T5.call(e,n)&&(r[n]=e[n]);return r};/** + * @license QR Code generator library (TypeScript) + * Copyright (c) Project Nayuki. + * SPDX-License-Identifier: MIT + */var Eo;(e=>{const t=class rt{constructor(d,c,h,p){if(this.version=d,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],drt.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 O=rt.getNumDataCodewords(x,c)*8,A=o.getTotalBits(d,x);if(A<=O){y=A;break}if(x>=p)throw new RangeError("Data too long")}for(const O of[rt.Ecc.MEDIUM,rt.Ecc.QUARTILE,rt.Ecc.HIGH])v&&y<=rt.getNumDataCodewords(x,O)*8&&(c=O);let S=[];for(const O of d){r(O.mode.modeBits,4,S),r(O.numChars,O.mode.numCharCountBits(x),S);for(const A of O.getData())S.push(A)}a(S.length==y);const _=rt.getNumDataCodewords(x,c)*8;a(S.length<=_),r(0,Math.min(4,_-S.length),S),r(0,(8-S.length%8)%8,S),a(S.length%8==0);for(let O=236;S.length<_;O^=253)r(O,8,S);let N=[];for(;N.length*8N[A>>>3]|=O<<7-(A&7)),new rt(x,c,N,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{(O!=y-m||C>=x)&&N.push(A[O])});return a(N.length==v),N}drawCodewords(d){if(d.length!=Math.floor(rt.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)*rt.PENALTY_N3),v=this.modules[m][S],x=1);d+=this.finderPenaltyTerminateAndCount(v,x,y)*rt.PENALTY_N3}for(let m=0;m5&&d++):(this.finderPenaltyAddHistory(x,y),v||(d+=this.finderPenaltyCountPatterns(y)*rt.PENALTY_N3),v=this.modules[S][m],x=1);d+=this.finderPenaltyTerminateAndCount(v,x,y)*rt.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*rt.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.lengthrt.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(rt.getNumRawDataModules(d)/8)-rt.ECC_CODEWORDS_PER_BLOCK[c.ordinal][d]*rt.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]^=rt.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 $t{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 $t($t.Mode.BYTE,d.length,c)}static makeNumeric(d){if(!$t.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={}))})(Eo||(Eo={}));(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={}))})(Eo||(Eo={}));var Os=Eo;/** + * @license qrcode.react + * Copyright (c) Paul O'Shannessy + * SPDX-License-Identifier: ISC + */var Jue={L:Os.QrCode.Ecc.LOW,M:Os.QrCode.Ecc.MEDIUM,Q:Os.QrCode.Ecc.QUARTILE,H:Os.QrCode.Ecc.HIGH},k5=128,R5="L",I5="#FFFFFF",M5="#000000",D5=!1,L5=1,Que=4,Zue=0,ede=.1;function $5(e,t=0){const r=[];return e.forEach(function(n,a){let i=null;n.forEach(function(o,u){if(!o&&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(!o)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}o&&i===null&&(i=u)})}),r.join("")}function B5(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 tde(e,t,r,n){if(n==null)return null;const a=e.length+r*2,i=Math.floor(t*ede),o=a/t,u=(n.width||i)*o,d=(n.height||i)*o,c=n.x==null?e.length/2-u/2:n.x*o,h=n.y==null?e.length/2-d/2:n.y*o,p=n.opacity==null?1:n.opacity;let m=null;if(n.excavate){let x=Math.floor(c),y=Math.floor(h),S=Math.ceil(u+c-x),_=Math.ceil(d+h-y);m={x,y,w:S,h:_}}const v=n.crossOrigin;return{x:c,y:h,h:d,w:u,excavation:m,opacity:p,crossOrigin:v}}function rde(e,t){return t!=null?Math.max(Math.floor(t),0):e?Que:Zue}function F5({value:e,level:t,minVersion:r,includeMargin:n,marginSize:a,imageSettings:i,size:o,boostLevel:u}){let d=X.useMemo(()=>{const x=(Array.isArray(e)?e:[e]).reduce((y,S)=>(y.push(...Os.QrSegment.makeSegments(S)),y),[]);return Os.QrCode.encodeSegments(x,Jue[t],r,void 0,void 0,u)},[e,t,r,u]);const{cells:c,margin:h,numCells:p,calculatedImageSettings:m}=X.useMemo(()=>{let v=d.getModules();const x=rde(n,a),y=v.length+x*2,S=tde(v,o,x,i);return{cells:v,margin:x,numCells:y,calculatedImageSettings:S}},[d,o,i,n,a]);return{qrcode:d,margin:h,cells:c,numCells:p,calculatedImageSettings:m}}var nde=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),ade=X.forwardRef(function(t,r){const n=t,{value:a,size:i=k5,level:o=R5,bgColor:u=I5,fgColor:d=M5,includeMargin:c=D5,minVersion:h=L5,boostLevel:p,marginSize:m,imageSettings:v}=n,y=wS(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:S}=y,_=wS(y,["style"]),N=v?.src,O=X.useRef(null),A=X.useRef(null),C=X.useCallback(H=>{O.current=H,typeof r=="function"?r(H):r&&(r.current=H)},[r]),[E,T]=X.useState(!1),{margin:R,cells:L,numCells:z,calculatedImageSettings:F}=F5({value:a,level:o,minVersion:h,boostLevel:p,includeMargin:c,marginSize:m,imageSettings:v,size:i});X.useEffect(()=>{if(O.current!=null){const H=O.current,V=H.getContext("2d");if(!V)return;let G=L;const U=A.current,$=F!=null&&U!==null&&U.complete&&U.naturalHeight!==0&&U.naturalWidth!==0;$&&F.excavation!=null&&(G=B5(L,F.excavation));const Q=window.devicePixelRatio||1;H.height=H.width=i*Q;const k=i/z*Q;V.scale(k,k),V.fillStyle=u,V.fillRect(0,0,z,z),V.fillStyle=d,nde?V.fill(new Path2D($5(G,R))):L.forEach(function(I,D){I.forEach(function(Z,ie){Z&&V.fillRect(ie+R,D+R,1,1)})}),F&&(V.globalAlpha=F.opacity),$&&V.drawImage(U,F.x+R,F.y+R,F.w,F.h)}}),X.useEffect(()=>{T(!1)},[N]);const B=bS({height:i,width:i},S);let q=null;return N!=null&&(q=X.createElement("img",{src:N,key:N,style:{display:"none"},onLoad:()=>{T(!0)},ref:A,crossOrigin:F?.crossOrigin})),X.createElement(X.Fragment,null,X.createElement("canvas",bS({style:B,height:i,width:i,ref:C,role:"img"},_)),q)});ade.displayName="QRCodeCanvas";var z5=X.forwardRef(function(t,r){const n=t,{value:a,size:i=k5,level:o=R5,bgColor:u=I5,fgColor:d=M5,includeMargin:c=D5,minVersion:h=L5,boostLevel:p,title:m,marginSize:v,imageSettings:x}=n,y=wS(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:S,cells:_,numCells:N,calculatedImageSettings:O}=F5({value:a,level:o,minVersion:h,boostLevel:p,includeMargin:c,marginSize:v,imageSettings:x,size:i});let A=_,C=null;x!=null&&O!=null&&(O.excavation!=null&&(A=B5(_,O.excavation)),C=X.createElement("image",{href:x.src,height:O.h,width:O.w,x:O.x+S,y:O.y+S,preserveAspectRatio:"none",opacity:O.opacity,crossOrigin:O.crossOrigin}));const E=$5(A,S);return X.createElement("svg",bS({height:i,width:i,viewBox:`0 0 ${N} ${N}`,ref:r,role:"img"},y),!!m&&X.createElement("title",null,m),X.createElement("path",{fill:u,d:`M0,0 h${N}v${N}H0z`,shapeRendering:"crispEdges"}),X.createElement("path",{fill:d,d:E,shapeRendering:"crispEdges"}),C)});z5.displayName="QRCodeSVG";function ide({data:e,width:t,height:r,showText:n,orientation:a="horizontal"}){const i=b.useRef(null),o=a==="vertical",u=Math.max(20,(o?t:r)-(n?14:4));b.useEffect(()=>{if(i.current&&e)try{Xue(i.current,e,{format:"CODE128",width:1,height:u,displayValue:n!==!1,margin:2,fontOptions:"",fontSize:10})}catch{}},[e,u,n]);const d=l.jsx("svg",{ref:i,className:"w-full h-full min-h-0",style:{maxHeight:o?t:r}});return o?l.jsx("div",{className:"w-full h-full flex items-center justify-center",children:l.jsx("div",{style:{transform:"rotate(-90deg)",transformOrigin:"center center",width:r,height:t,display:"flex",alignItems:"center",justifyContent:"center"},children:d})}):d}const Uc=8;function xs(e){return Math.round(e/Uc)*Uc}function Wp(e,t){return t==="cm"?e*37.8:e*96}function UI(e,t){return t==="cm"?e/37.8:e/96}function q5({el:e}){const t=e.config,r=e.type,n={fontSize:t?.fontSize??14,fontFamily:t?.fontFamily??"Arial",fontWeight:t?.fontWeight??"normal",textAlign:t?.textAlign??"left",color:t?.color??"#000"},a=t?.inputType;if(r==="TEXT_STATIC"){const i=t?.text??"文本";return a==="number"?l.jsx("input",{type:"number",readOnly:!0,value:t?.text??"0",className:"w-full h-full min-w-0 border border-gray-300 bg-white rounded px-1 pointer-events-none",style:{...n,textAlign:"right"}}):a==="options"?l.jsxs("div",{className:"w-full h-full min-w-0 border border-gray-300 bg-white rounded px-1 flex items-center pointer-events-none text-gray-500",style:n,children:[l.jsx("span",{className:"truncate flex-1",children:i||"请选择..."}),l.jsx("span",{className:"ml-auto text-gray-400",children:"▼"})]}):a==="text"?l.jsx("input",{type:"text",readOnly:!0,value:i,className:"w-full h-full min-w-0 border border-gray-300 bg-white rounded px-1 pointer-events-none",style:n}):l.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-pre-wrap break-all leading-tight",style:n,children:i})}if(r==="TEXT_PRODUCT"){const i=t?.text??"商品名";return l.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-pre-wrap break-all leading-tight",style:n,children:i})}if(r==="TEXT_PRICE"){const i=t?.prefix??"¥",o=t?.text??"0.00";return l.jsxs("div",{className:"w-full h-full px-1 overflow-hidden flex items-center",style:{...n,justifyContent:n.textAlign==="center"?"center":n.textAlign==="right"?"flex-end":"flex-start"},children:[l.jsx("span",{children:i}),l.jsx("span",{children:o})]})}if(r==="BARCODE"){const i=t?.data??"123456789",o=t?.showText!==!1,u=t?.orientation==="vertical"?"vertical":"horizontal";return l.jsx("div",{className:"flex flex-col items-center justify-center w-full h-full overflow-hidden p-0.5",children:l.jsx("div",{className:"flex-1 w-full min-h-0 flex items-center justify-center",children:l.jsx(ide,{data:i,width:e.width,height:e.height,showText:o,orientation:u})})})}if(r==="QRCODE"){const i=t?.data??"https://example.com",o=Math.min(e.width,e.height)-4;return l.jsx("div",{className:"w-full h-full flex items-center justify-center p-0.5",children:l.jsx(z5,{value:i,size:Math.max(20,o),level:"M",includeMargin:!1})})}if(r==="IMAGE"){const i=t?.src;return i?l.jsx("img",{src:i,alt:"",className:"w-full h-full object-contain"}):l.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:l.jsx("span",{className:"font-medium",children:"Logo"})})}if(r==="DATE"){const o=(t?.format??"YYYY-MM-DD").replace("YYYY","2025").replace("MM","02").replace("DD","01");return t?.inputType==="datetime"||t?.inputType==="date"?l.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:n}):l.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:n,children:o})}if(r==="TIME"){const o=(t?.format??"HH:mm").replace("HH","12").replace("mm","30");return l.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:n,children:o})}if(r==="DURATION")return l.jsx("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:n,children:"保质期 2025-02-04"});if(r==="WEIGHT"){const i=t?.value??500,o=t?.unit??"g";return l.jsxs("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:n,children:[i,o]})}if(r==="WEIGHT_PRICE"){const i=t?.unitPrice??10,o=t?.weight??.5,u=t?.currency??"¥";return l.jsxs("div",{className:"w-full h-full px-1 overflow-hidden whitespace-nowrap",style:n,children:[u,(i*o).toFixed(2)]})}if(r==="NUTRITION"){const i=t?.calories??120;return l.jsxs("div",{className:"text-[8px] p-0.5 w-full h-full overflow-hidden flex flex-col",children:[l.jsx("div",{className:"font-semibold border-b border-black",children:"Nutrition Facts"}),l.jsxs("div",{children:["Calories ",i]})]})}return r==="BLANK"?l.jsx("div",{className:"w-full h-full border border-dashed border-gray-200"}):l.jsx("div",{className:"text-gray-500 text-[10px] px-1 truncate w-full flex items-center justify-center",children:e.type.replace(/_/g," ")})}function ode({template:e,selectedId:t,onSelect:r,onUpdateElement:n,onDeleteElement:a,onTemplateChange:i,scale:o=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),S=b.useRef(null),[_,N]=X.useState(!1),[O,A]=X.useState(!1),C=b.useRef(null),[E,T]=X.useState({x:0,y:0}),R=b.useRef(null),L=Wp(e.width,e.unit),z=Wp(e.height,e.unit),F=e.showGrid!==!1,B=b.useCallback((k,I)=>{if(_||k.button===1)return;k.stopPropagation(),r(I),p.current?.focus();const D=e.elements.find(ie=>ie.id===I);if(!D)return;const Z=document.getElementById(`element-${I}`);Z&&(Z.classList.add("z-50","opacity-90","shadow-xl","ring-2","ring-blue-400","ring-offset-2"),Z.style.cursor="grabbing"),m.current={id:I,startX:k.clientX,startY:k.clientY,elX:D.x,elY:D.y},y.current={id:I,x:D.x,y:D.y},k.currentTarget.setPointerCapture?.(k.pointerId)},[e.elements,r,_]),q=b.useCallback(k=>{S.current!==null&&cancelAnimationFrame(S.current),S.current=requestAnimationFrame(()=>{k(),S.current=null})},[]),H=b.useCallback(k=>{if(O&&R.current){const I=k.clientX-R.current.startX,D=k.clientY-R.current.startY;T({x:R.current.x+I,y:R.current.y+D});return}if(O&&C.current&&h.current){const I=k.clientX-C.current.x,D=k.clientY-C.current.y;h.current.scrollLeft=C.current.scrollLeft-I,h.current.scrollTop=C.current.scrollTop-D;return}if(m.current){const{id:I,startX:D,startY:Z,elX:ie,elY:oe}=m.current,ne=k.clientX,K=k.clientY;q(()=>{const J=(ne-D)/o,ee=(K-Z)/o,ce=Math.max(0,ie+J),pe=Math.max(0,oe+ee),W=xs(ce),_e=xs(pe),Ce=document.getElementById(`element-${I}`);Ce&&(Ce.style.left=`${W}px`,Ce.style.top=`${_e}px`),y.current={id:I,x:W,y:_e}})}if(v.current){const{id:I,corner:D,startX:Z,startY:ie,w:oe,h:ne,elX:K,elY:J}=v.current,ee=k.clientX,ce=k.clientY;q(()=>{const pe=(ee-Z)/o,W=(ce-ie)/o;let _e=oe,Ce=ne,qe=K,De=J;D.includes("e")&&(_e=Math.max(20,oe+pe)),D.includes("w")&&(_e=Math.max(20,oe-pe),qe=K+pe),D.includes("s")&&(Ce=Math.max(12,ne+W)),D.includes("n")&&(Ce=Math.max(12,ne-W),De=J+W);const nt=xs(_e),kt=xs(Ce),Ut=xs(qe),lr=xs(De),Rt=document.getElementById(`element-${I}`);Rt&&(Rt.style.width=`${nt}px`,Rt.style.height=`${kt}px`,Rt.style.left=`${Ut}px`,Rt.style.top=`${lr}px`),y.current={id:I,width:nt,height:kt,x:Ut,y:lr}})}if(x.current&&i){const{edge:I,startX:D,startY:Z,startW:ie,startH:oe}=x.current,ne=k.clientX,K=k.clientY;q(()=>{const J=(ne-D)/o,ee=(K-Z)/o,ce=UI(J,e.unit),pe=UI(ee,e.unit);if(I==="bottom"){const W=Math.max(1,oe+pe);i({height:W})}else{const W=Math.max(1,ie+ce);i({width:W})}})}},[O,i,o,e.unit,q]),V=b.useCallback(()=>{O&&(A(!1),C.current=null,R.current=null),S.current!==null&&(cancelAnimationFrame(S.current),S.current=null);const k=m.current?.id||v.current?.id;if(k){const I=document.getElementById(`element-${k}`);I&&(I.classList.remove("z-50","opacity-90","shadow-xl","ring-2","ring-blue-400","ring-offset-2"),I.style.cursor="")}if(y.current){const{id:I,...D}=y.current;n(I,D),y.current=null}m.current=null,v.current=null,x.current=null},[n]);b.useEffect(()=>{const k=D=>{D.code==="Space"&&!D.repeat&&N(!0)},I=D=>{D.code==="Space"&&(N(!1),A(!1),C.current=null,R.current=null)};return window.addEventListener("keydown",k),window.addEventListener("keyup",I),()=>{window.removeEventListener("keydown",k),window.removeEventListener("keyup",I)}},[]),b.useEffect(()=>{const k=h.current;if(!k)return;const I=()=>{k.scrollLeft=Math.max(0,(k.scrollWidth-k.clientWidth)/2),k.scrollTop=Math.max(0,(k.scrollHeight-k.clientHeight)/2)},D=requestAnimationFrame(I),Z=setTimeout(I,100);return()=>{cancelAnimationFrame(D),clearTimeout(Z)}},[o,L,z]);const G=b.useCallback(k=>{if(!t)return;if(k.key==="Delete"||k.key==="Backspace"){k.preventDefault();const oe=e.elements.findIndex(ne=>ne.id===t);if(oe>=0){const ne=e.elements.filter(K=>K.id!==t);a(t),r(ne[oe]?.id??ne[oe-1]?.id??null)}return}const I=e.elements.find(oe=>oe.id===t);if(!I)return;const D=k.shiftKey?1:Uc;let Z=0,ie=0;switch(k.key){case"ArrowLeft":Z=-D;break;case"ArrowRight":Z=D;break;case"ArrowUp":ie=-D;break;case"ArrowDown":ie=-D;break;default:return}k.key==="ArrowDown"&&(ie=D),k.preventDefault(),n(I.id,{x:Math.max(0,I.x+Z),y:Math.max(0,I.y+ie)})},[t,e.elements,n,a,r]),U=k=>{(_||k.button===1)&&(k.preventDefault(),A(!0),C.current={x:k.clientX,y:k.clientY,scrollLeft:h.current?.scrollLeft||0,scrollTop:h.current?.scrollTop||0},k.currentTarget.setPointerCapture(k.pointerId))},$=k=>{if(O&&C.current&&h.current){const I=k.clientX-C.current.x,D=k.clientY-C.current.y;h.current.scrollLeft=C.current.scrollLeft-I,h.current.scrollTop=C.current.scrollTop-D}},Q=k=>{O&&(A(!1),C.current=null)};return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden bg-gray-100",children:[l.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:[l.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Label Preview"}),l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c&&l.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&&l.jsxs(l.Fragment,{children:[l.jsxs(Ke,{value:(()=>{const k=E1.findIndex(I=>I.width===e.width&&I.height===e.height&&I.unit===e.unit);return k>=0?String(k):"custom"})(),onValueChange:k=>{if(k==="custom")return;const I=E1[Number(k)];I&&i({width:I.width,height:I.height,unit:I.unit})},children:[l.jsx(Ye,{className:"h-8 w-[130px] text-xs",children:l.jsx(Xe,{placeholder:"画布大小"})}),l.jsxs(Je,{children:[E1.map((k,I)=>l.jsx(Ne,{value:String(I),className:"text-xs",children:k.name},I)),l.jsx(Ne,{value:"custom",className:"text-xs text-gray-500",children:"自定义"})]})]}),l.jsx("button",{type:"button",onClick:()=>i({showGrid:!F}),className:Ae("h-8 px-3 rounded border text-xs font-medium shadow-sm transition-colors",F?"border-gray-300 bg-white text-gray-700 hover:bg-gray-50":"border-gray-300 bg-gray-100 text-gray-500"),children:F?"隐藏网格":"显示网格"})]}),l.jsxs("div",{className:"flex items-center gap-1 bg-white rounded border border-gray-300 p-0.5 shadow-sm h-8",children:[l.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:"−"}),l.jsxs("span",{className:"min-w-[3rem] text-center text-xs text-gray-600 font-medium",children:[Math.round(o*100),"%"]}),l.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:"+"})]})]})]}),l.jsx("div",{ref:h,className:Ae("flex-1 overflow-auto bg-gray-100 relative",_?"cursor-grab active:cursor-grabbing":""),onPointerDown:U,onPointerMove:$,onPointerUp:Q,onPointerLeave:Q,children:l.jsx("div",{style:{minWidth:"100%",minHeight:"100%",width:"fit-content",height:"fit-content",display:"flex",padding:50,boxSizing:"border-box",transform:`translate(${E.x}px, ${E.y}px)`},children:l.jsxs("div",{ref:p,tabIndex:0,className:Ae("relative bg-white shadow-lg border border-dashed border-gray-300 origin-top-left outline-none m-auto",O?"cursor-grabbing":"cursor-grab"),style:{width:L,height:z,transform:`scale(${o})`,backgroundImage:F?`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:F?`${Uc}px ${Uc}px`:void 0,pointerEvents:_?"none":"auto"},onClick:k=>{const I=k.target,D=I.closest('[id^="element-"]'),Z=I.closest('[title*="拖拽拉高"]')||I.closest('[title*="拖拽拉宽"]');!D&&!Z&&r(null)},onPointerDown:k=>{const I=k.target,D=I.closest('[id^="element-"]'),Z=I.closest('[title*="拖拽拉高"]')||I.closest('[title*="拖拽拉宽"]');p.current?.contains(I)&&!D&&!Z&&!m.current&&!v.current&&(_||k.button===1)&&(k.preventDefault(),k.stopPropagation(),A(!0),R.current={x:E.x,y:E.y,startX:k.clientX,startY:k.clientY},C.current={x:k.clientX,y:k.clientY,scrollLeft:h.current?.scrollLeft??0,scrollTop:h.current?.scrollTop??0},k.currentTarget.setPointerCapture?.(k.pointerId))},onPointerMove:H,onPointerUp:V,onKeyDown:G,children:[e.showRuler&&l.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&&l.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:k=>{k.stopPropagation(),x.current={edge:"bottom",startX:k.clientX,startY:k.clientY,startW:e.width,startH:e.height},k.target.setPointerCapture?.(k.pointerId)},children:"⋮"}),i&&l.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:k=>{k.stopPropagation(),x.current={edge:"right",startX:k.clientX,startY:k.clientY,startW:e.width,startH:e.height},k.target.setPointerCapture?.(k.pointerId)},children:"⋮"}),e.elements.map(k=>l.jsxs("div",{id:`element-${k.id}`,className:Ae("absolute box-border cursor-move overflow-hidden transition-shadow",k.border==="line"&&"border border-gray-400",k.border==="dotted"&&"border border-dotted border-gray-400",t===k.id&&"ring-2 ring-blue-500 ring-offset-1 z-10"),style:{left:k.x,top:k.y,width:k.width,height:k.height},onClick:I=>{I.stopPropagation(),r(k.id)},onPointerDown:I=>B(I,k.id),children:[l.jsx(q5,{el:k}),t===k.id&&l.jsxs(l.Fragment,{children:[["nw","ne","sw","se"].map(I=>l.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:D=>{D.stopPropagation();const Z=e.elements.find(ie=>ie.id===k.id);v.current={id:k.id,corner:I,startX:D.clientX,startY:D.clientY,w:Z.width,h:Z.height,elX:Z.x,elY:Z.y},D.currentTarget.setPointerCapture?.(D.pointerId)}},I)),["n","s","w","e"].map(I=>l.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:D=>{D.stopPropagation();const Z=e.elements.find(oe=>oe.id===k.id),ie=document.getElementById(`element-${k.id}`);ie&&ie.classList.add("z-50","opacity-90"),v.current={id:k.id,corner:I,startX:D.clientX,startY:D.clientY,w:Z.width,h:Z.height,elX:Z.x,elY:Z.y},D.currentTarget.setPointerCapture?.(D.pointerId)}},I))]})]},k.id))]})})})]})}function sde({template:e,maxWidth:t=480}){const r=Wp(e.width,e.unit),n=Wp(e.height,e.unit),a=t?Math.min(t/r,t/n,2):1,i=r*a,o=n*a;return l.jsx("div",{className:"flex items-center justify-center p-4 bg-gray-100 rounded",children:l.jsx("div",{style:{width:i,height:o},className:"relative bg-white shadow-lg overflow-hidden",children:l.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=>l.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:l.jsx(q5,{el:u})},u.id))})})})}function lde({template:e,selectedElement:t,onTemplateChange:r,onElementChange:n,onDeleteElement:a,locations:i=[],readOnlyTemplateCode:o=!1}){return t?l.jsxs("div",{className:"w-72 shrink-0 border-l border-gray-200 bg-white flex flex-col h-full",children:[l.jsx("div",{className:"px-3 py-2 border-b border-gray-200 font-semibold text-gray-800",children:"Properties (Element)"}),l.jsx($s,{className:"flex-1",children:l.jsxs("div",{className:"p-3 space-y-3",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"X"}),l.jsx(me,{type:"number",value:t.x,onChange:u=>n(t.id,{x:Number(u.target.value)||0}),className:"h-8 text-sm"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Y"}),l.jsx(me,{type:"number",value:t.y,onChange:u=>n(t.id,{y:Number(u.target.value)||0}),className:"h-8 text-sm"})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Width"}),l.jsx(me,{type:"number",value:t.width,onChange:u=>n(t.id,{width:Math.max(1,Number(u.target.value)||0)}),className:"h-8 text-sm"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Height"}),l.jsx(me,{type:"number",value:t.height,onChange:u=>n(t.id,{height:Math.max(1,Number(u.target.value)||0)}),className:"h-8 text-sm"})]})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Rotation"}),l.jsxs(Ke,{value:t.rotation,onValueChange:u=>n(t.id,{rotation:u}),children:[l.jsx(Ye,{className:"h-8 text-sm",children:l.jsx(Xe,{})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"horizontal",children:"horizontal"}),l.jsx(Ne,{value:"vertical",children:"vertical"})]})]})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Border"}),l.jsxs(Ke,{value:t.border,onValueChange:u=>n(t.id,{border:u}),children:[l.jsx(Ye,{className:"h-8 text-sm",children:l.jsx(Xe,{})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"none",children:"none"}),l.jsx(Ne,{value:"line",children:"line"}),l.jsx(Ne,{value:"dotted",children:"dotted"})]})]})]}),l.jsx(cde,{element:t,onChange:u=>n(t.id,{config:{...t.config,...u}})}),a&&l.jsx("div",{className:"pt-4 border-t border-gray-100",children:l.jsx(fe,{variant:"destructive",className:"w-full",onClick:()=>a(t.id),children:"Delete Element"})})]})})]}):l.jsxs("div",{className:"w-72 shrink-0 border-l border-gray-200 bg-white flex flex-col h-full",children:[l.jsx("div",{className:"px-3 py-2 border-b border-gray-200 font-semibold text-gray-800",children:"Properties (Template)"}),l.jsx($s,{className:"flex-1",children:l.jsxs("div",{className:"p-3 space-y-3",children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Template Code"}),l.jsx(me,{value:e.id,disabled:o,onChange:u=>r({id:u.target.value.trim()}),className:"h-8 text-sm mt-1",placeholder:"e.g. TPL_TEST_001"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Template Name"}),l.jsx(me,{value:e.name,onChange:u=>r({name:u.target.value}),className:"h-8 text-sm mt-1"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Label Type"}),l.jsxs(Ke,{value:e.labelType,onValueChange:u=>r({labelType:u}),children:[l.jsx(Ye,{className:"h-8 text-sm mt-1",children:l.jsx(Xe,{})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"PRICE",children:"PRICE"}),l.jsx(Ne,{value:"NUTRITION",children:"NUTRITION"}),l.jsx(Ne,{value:"SHIPPING",children:"SHIPPING"})]})]})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Applied Location"}),l.jsxs(Ke,{value:e.appliedLocation,onValueChange:u=>{r(u==="ALL"?{appliedLocation:u,appliedLocationIds:[]}:{appliedLocation:u})},children:[l.jsx(Ye,{className:"h-8 text-sm mt-1",children:l.jsx(Xe,{})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"ALL",children:"All locations"}),l.jsx(Ne,{value:"SPECIFIED",children:"Specified locations"})]})]})]}),e.appliedLocation==="SPECIFIED"&&l.jsxs("div",{className:"rounded-md border border-gray-200 p-2 max-h-40 overflow-y-auto space-y-2",children:[l.jsx(ue,{className:"text-xs text-gray-600",children:"Select locations"}),i.length===0?l.jsx("p",{className:"text-xs text-gray-500",children:"No locations loaded."}):i.map(u=>{const d=(e.appliedLocationIds??[]).includes(u.id);return l.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[l.jsx(Eu,{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)})}}),l.jsx("span",{className:"truncate",children:(u.locationName??u.locationCode??u.id).trim()||u.id})]},u.id)})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Width"}),l.jsx(me,{type:"number",value:e.width,onChange:u=>r({width:Math.max(.1,Number(u.target.value)||0)}),className:"h-8 text-sm"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Height"}),l.jsx(me,{type:"number",value:e.height,onChange:u=>r({height:Math.max(.1,Number(u.target.value)||0)}),className:"h-8 text-sm"})]})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Unit"}),l.jsxs(Ke,{value:e.unit,onValueChange:u=>r({unit:u}),children:[l.jsx(Ye,{className:"h-8 text-sm mt-1",children:l.jsx(Xe,{})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"cm",children:"cm"}),l.jsx(Ne,{value:"inch",children:"inch"})]})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(qt,{checked:e.showRuler,onCheckedChange:u=>r({showRuler:u})}),l.jsx(ue,{className:"text-xs",children:"Show Ruler"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(qt,{checked:e.showGrid??!0,onCheckedChange:u=>r({showGrid:u})}),l.jsx(ue,{className:"text-xs",children:"Show Grid"})]})]})})]})}function cde({element:e,onChange:t}){const r=e.config,n=(a,i)=>t({[a]:i});switch(e.type){case"TEXT_STATIC":case"TEXT_PRODUCT":case"TEXT_PRICE":return l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Text"}),l.jsx(me,{value:r.text??"0.00",onChange:a=>n("text",a.target.value),className:"h-8 text-sm mt-1"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Prefix"}),l.jsx(me,{value:r.prefix??"¥",onChange:a=>n("prefix",a.target.value),className:"h-8 text-sm mt-1"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Font Size"}),l.jsx(me,{type:"number",value:r.fontSize??14,onChange:a=>n("fontSize",Number(a.target.value)||14),className:"h-8 text-sm mt-1"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Text Align"}),l.jsxs(Ke,{value:r.textAlign??"right",onValueChange:a=>n("textAlign",a),children:[l.jsx(Ye,{className:"h-8 text-sm mt-1",children:l.jsx(Xe,{})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"left",children:"Left"}),l.jsx(Ne,{value:"center",children:"Center"}),l.jsx(Ne,{value:"right",children:"Right"})]})]})]})]});case"BARCODE":return l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Data"}),l.jsx(me,{value:r.data??"123456789",onChange:a=>n("data",a.target.value),className:"h-8 text-sm mt-1"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"方向"}),l.jsxs(Ke,{value:r.orientation??"horizontal",onValueChange:a=>n("orientation",a),children:[l.jsx(Ye,{className:"h-8 text-sm mt-1",children:l.jsx(Xe,{})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"horizontal",children:"水平"}),l.jsx(Ne,{value:"vertical",children:"竖排"})]})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(qt,{checked:r.showText!==!1,onCheckedChange:a=>n("showText",a)}),l.jsx(ue,{className:"text-xs",children:"Show Text"})]})]});case"QRCODE":return l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Data (URL)"}),l.jsx(me,{value:r.data??"https://example.com",onChange:a=>n("data",a.target.value),className:"h-8 text-sm mt-1"})]});case"IMAGE":return l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Image URL"}),l.jsx(me,{value:r.src??"",onChange:a=>n("src",a.target.value),className:"h-8 text-sm mt-1",placeholder:"输入图片URL或路径"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Scale Mode"}),l.jsxs(Ke,{value:r.scaleMode??"contain",onValueChange:a=>n("scaleMode",a),children:[l.jsx(Ye,{className:"h-8 text-sm mt-1",children:l.jsx(Xe,{})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"contain",children:"Contain"}),l.jsx(Ne,{value:"cover",children:"Cover"}),l.jsx(Ne,{value:"fill",children:"Fill"})]})]})]})]});case"DATE":return l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Format"}),l.jsx(me,{value:r.format??"YYYY-MM-DD",onChange:a=>n("format",a.target.value),className:"h-8 text-sm mt-1",placeholder:"YYYY-MM-DD"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Offset Days"}),l.jsx(me,{type:"number",value:r.offsetDays??0,onChange:a=>n("offsetDays",Number(a.target.value)||0),className:"h-8 text-sm mt-1"})]})]});case"TIME":return l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Format"}),l.jsx(me,{value:r.format??"HH:mm",onChange:a=>n("format",a.target.value),className:"h-8 text-sm mt-1",placeholder:"HH:mm"})]});case"DURATION":return l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Format"}),l.jsx(me,{value:r.format??"YYYY-MM-DD",onChange:a=>n("format",a.target.value),className:"h-8 text-sm mt-1",placeholder:"YYYY-MM-DD"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Offset Days"}),l.jsx(me,{type:"number",value:r.offsetDays??3,onChange:a=>n("offsetDays",Number(a.target.value)||3),className:"h-8 text-sm mt-1"})]})]});case"WEIGHT":return l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Value"}),l.jsx(me,{type:"number",value:r.value??500,onChange:a=>n("value",Number(a.target.value)||0),className:"h-8 text-sm mt-1"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Unit"}),l.jsxs(Ke,{value:r.unit??"g",onValueChange:a=>n("unit",a),children:[l.jsx(Ye,{className:"h-8 text-sm mt-1",children:l.jsx(Xe,{})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"g",children:"g"}),l.jsx(Ne,{value:"kg",children:"kg"}),l.jsx(Ne,{value:"oz",children:"oz"}),l.jsx(Ne,{value:"lb",children:"lb"})]})]})]})]});case"WEIGHT_PRICE":return l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Unit Price"}),l.jsx(me,{type:"number",value:r.unitPrice??10,onChange:a=>n("unitPrice",Number(a.target.value)||0),className:"h-8 text-sm mt-1"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Weight"}),l.jsx(me,{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"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Currency"}),l.jsx(me,{value:r.currency??"¥",onChange:a=>n("currency",a.target.value),className:"h-8 text-sm mt-1"})]})]});case"NUTRITION":return l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Calories"}),l.jsx(me,{type:"number",value:r.calories??120,onChange:a=>n("calories",Number(a.target.value)||0),className:"h-8 text-sm mt-1"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Fat"}),l.jsx(me,{value:r.fat??"5g",onChange:a=>n("fat",a.target.value),className:"h-8 text-sm mt-1"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Protein"}),l.jsx(me,{value:r.protein??"3g",onChange:a=>n("protein",a.target.value),className:"h-8 text-sm mt-1"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"Carbs"}),l.jsx(me,{value:r.carbs??"10g",onChange:a=>n("carbs",a.target.value),className:"h-8 text-sm mt-1"})]})]});case"BLANK":return l.jsx("div",{className:"text-xs text-gray-500",children:"Blank spacer; no configuration needed."});default:return l.jsxs("div",{className:"text-xs text-gray-500",children:["Config for ",e.type," (edit in code if needed)"]})}}const ude=.5,dde=2,VI=.25,fde=1;function hde({templateId:e,initialTemplate:t,onClose:r,onSaved:n}){const[a,i]=b.useState(()=>t?{...t}:oue(e??void 0)),[o,u]=b.useState(null),[d,c]=b.useState(fde),[h,p]=b.useState(!1),[m,v]=b.useState([]);b.useEffect(()=>{let C=!1;return(async()=>{try{const E=await Al({skipCount:0,maxResultCount:500});C||v(E.items??[])}catch{C||v([])}})(),()=>{C=!0}},[]);const x=a.elements.find(C=>C.id===o)??null,y=b.useCallback((C,E)=>{const T=(U,$)=>$==="cm"?U*37.8:U*96,R=T(a.width,a.unit),L=T(a.height,a.unit),z=zR(C,0,0),F=8,B=U=>Math.round(U/F)*F;let q=(R-z.width)/2,H=(L-z.height)/2;const V=(U,$,Q,k)=>a.elements.some(I=>{const D=I.x+I.width,Z=I.y+I.height,ie=U+Q,oe=$+k;return!(U>=D||ie<=I.x||$>=Z||oe<=I.y)});if(V(q,H,z.width,z.height)){const U=F*2;let $=!1;for(let Q=H;Q=0&&!$;Q-=U)for(let k=q;k>=0&&!$;k-=U)if(!V(k,Q,z.width,z.height)){q=k,H=Q,$=!0;break}}}const G=zR(C,Math.max(0,B(q)),Math.max(0,B(H)));E&&Object.keys(E).length>0&&(G.config={...G.config,...E}),i(U=>({...U,elements:[...U.elements,G]})),u(G.id)},[a.width,a.height,a.unit,a.elements]),S=b.useCallback((C,E)=>{i(T=>({...T,elements:T.elements.map(R=>R.id===C?{...R,...E}:R)}))},[]),_=b.useCallback(C=>{i(E=>({...E,elements:E.elements.filter(T=>T.id!==C)})),u(null)},[]),N=b.useCallback(C=>{i(E=>({...E,...C}))},[]),O=b.useCallback(async()=>{try{const C=(a.id??"").trim();if(!C){xe.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)){xe.error("Locations required.",{description:"When using specified locations, select at least one location."});return}const E={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:a.elements.map((T,R)=>({id:T.id,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:T.valueSourceType??sue(T.type),isRequiredInput:T.isRequiredInput??!1,config:T.config})),appliedLocationIds:a.appliedLocation==="ALL"?[]:a.appliedLocationIds??[]};e?(await Lce(C,E),xe.success("Template updated.",{description:"The template has been updated successfully."})):(await Dce(E),xe.success("Template created.",{description:"The template has been created successfully."})),n(),r()}catch(C){xe.error("Failed to save template.",{description:C?.message?String(C.message):"Please try again."})}},[a,e,n,r]),A=b.useCallback(()=>{const C=new Blob([JSON.stringify(a,null,2)],{type:"application/json"}),E=URL.createObjectURL(C),T=document.createElement("a");T.href=E,T.download=`label-template-${a.id}.json`,T.click(),URL.revokeObjectURL(E)},[a]);return l.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200 bg-white shrink-0",children:[l.jsxs(fe,{variant:"outline",size:"sm",onClick:r,children:[l.jsx(xz,{className:"w-4 h-4 mr-1"}),"Back"]}),l.jsx("span",{className:"text-sm font-medium text-gray-700 truncate flex-1",children:a.name}),l.jsxs(fe,{size:"sm",onClick:A,variant:"outline",children:[l.jsx(CS,{className:"w-4 h-4 mr-1"}),"Export JSON"]}),l.jsxs(fe,{size:"sm",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:O,children:[l.jsx(d8,{className:"w-4 h-4 mr-1"}),"Save"]})]}),l.jsxs("div",{className:"flex flex-1 min-h-0",children:[l.jsx(cue,{onAddElement:y}),l.jsx(ode,{template:a,selectedId:o,onSelect:u,onUpdateElement:S,onDeleteElement:_,onTemplateChange:N,scale:d,onZoomIn:()=>c(C=>Math.min(dde,C+VI)),onZoomOut:()=>c(C=>Math.max(ude,C-VI)),onPreview:()=>p(!0)}),l.jsx(mt,{open:h,onOpenChange:p,children:l.jsxs(ft,{className:"max-w-[90vw] max-h-[90vh] overflow-auto",children:[l.jsx(gt,{children:l.jsx(vt,{children:"标签预览"})}),l.jsx(sde,{template:a,maxWidth:500})]})}),l.jsx(lde,{template:a,selectedElement:x,onTemplateChange:N,onElementChange:S,onDeleteElement:_,locations:m,readOnlyTemplateCode:!!e})]})]})}function A1(e){const t=(e??"").trim();return t||"None"}function pde(e,t){if(w5(e)==="ALL")return"All";const n=e.appliedLocationIds??[];if(n.length===0)return"Specified (0)";const a=n.map(i=>t.find(o=>o.id===i)?.locationName?.trim()||i);return a.length<=2?a.join(", "):`${a.slice(0,2).join(", ")} +${a.length-2}`}function mde(e){const t=(e.templateName??e.name??"").trim();return t||"None"}function gde(e){const t=(e.templateCode??e.id??"").trim();return t||"None"}function vde(e,t){const r=(e.locationText??"").trim();return r||pde(e,t)}function yde(e){return typeof e.contentsCount=="number"?e.contentsCount:e.elements?.length??0}function xde(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 bde(){const[e,t]=b.useState([]),[r,n]=b.useState("list"),[a,i]=b.useState(null),[o,u]=b.useState(null),[d,c]=b.useState(!1),[h,p]=b.useState(0),[m,v]=b.useState(0),[x,y]=b.useState(null),[S,_]=b.useState(!1),[N,O]=b.useState(null),[A,C]=b.useState(""),[E,T]=b.useState("all"),[R,L]=b.useState("all"),[z,F]=b.useState("all"),[B,q]=b.useState(1),[H,V]=b.useState(10),[G,U]=b.useState([]),$=b.useRef(null),Q=b.useRef(null),[k,I]=b.useState("");b.useEffect(()=>(Q.current&&window.clearTimeout(Q.current),Q.current=window.setTimeout(()=>I(A.trim()),300),()=>{Q.current&&window.clearTimeout(Q.current)}),[A]);const D=Math.max(1,Math.ceil(h/H));b.useEffect(()=>{let J=!1;return(async()=>{try{const ee=await Al({skipCount:0,maxResultCount:500});J||U(ee.items??[])}catch{J||U([])}})(),()=>{J=!0}},[]),b.useEffect(()=>{q(1)},[k,E,R,z,H]),b.useEffect(()=>r!=="list"?void 0:((async()=>{$.current?.abort();const ee=new AbortController;$.current=ee,c(!0);try{const ce=(B-1)*H,pe=await v5({skipCount:ce,maxResultCount:H,keyword:k||void 0,locationId:E!=="all"?E:void 0,labelType:R!=="all"?R:void 0,state:z==="all"?void 0:z==="true"},ee.signal);t(pe.items??[]),p(pe.totalCount??0)}catch(ce){if(ce?.name==="AbortError")return;xe.error("Failed to load label templates.",{description:ce?.message?String(ce.message):"Please try again."}),t([]),p(0)}finally{c(!1)}})(),()=>$.current?.abort()),[k,E,R,z,B,H,m,r]);const Z=()=>v(J=>J+1),ie=()=>{i(null),u(null),n("editor")},oe=async J=>{i(J),c(!0);try{const ee=await Mce(J),ce={id:ee.id,name:(ee.name??ee.templateName??"").trim()||"未命名模板",labelType:ee.labelType??"PRICE",unit:ee.unit??"cm",width:ee.width??6,height:ee.height??4,appliedLocation:w5(ee),appliedLocationIds:[...ee.appliedLocationIds??[]],showRuler:ee.showRuler??!0,showGrid:ee.showGrid??!0,elements:ee.elements??[]};u(ce),n("editor")}catch(ee){xe.error("Failed to load template.",{description:ee?.message?String(ee.message):"Please try again."})}finally{c(!1)}},ne=()=>{n("list"),i(null),u(null)},K=J=>{y(null),O(J),_(!0)};return r==="editor"?l.jsx("div",{className:"h-[calc(100vh-8rem)] min-h-[500px] flex flex-col",children:l.jsx(hde,{templateId:a,initialTemplate:o,onClose:ne,onSaved:Z})}):l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsx("div",{className:"pb-4",children:l.jsx("div",{className:"flex flex-col gap-4",children:l.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[l.jsx(me,{placeholder:"Search",value:A,onChange:J=>C(J.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"}),l.jsxs(Ke,{value:E,onValueChange:T,children:[l.jsx(Ye,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:l.jsx(Xe,{placeholder:"Location"})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"all",children:"All Locations"}),G.map(J=>l.jsx(Ne,{value:J.id,children:A1(J.locationName??J.locationCode??J.id)},J.id))]})]}),l.jsxs(Ke,{value:R,onValueChange:L,children:[l.jsx(Ye,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:l.jsx(Xe,{placeholder:"Label Type"})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"all",children:"All Types"}),l.jsx(Ne,{value:"PRICE",children:"PRICE"}),l.jsx(Ne,{value:"NUTRITION",children:"NUTRITION"}),l.jsx(Ne,{value:"SHIPPING",children:"SHIPPING"})]})]}),l.jsxs(Ke,{value:z,onValueChange:F,children:[l.jsx(Ye,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:l.jsx(Xe,{placeholder:"State"})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"all",children:"All States"}),l.jsx(Ne,{value:"true",children:"Active"}),l.jsx(Ne,{value:"false",children:"Inactive"})]})]}),l.jsx("div",{className:"flex-1"}),l.jsxs(fe,{className:"bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-md h-10 px-6 shrink-0",onClick:ie,children:["New Label Template ",l.jsx(wn,{className:"ml-1 w-4 h-4"})]})]})})}),l.jsx("div",{className:"flex-1 overflow-auto pt-6",children:l.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:l.jsxs(Or,{children:[l.jsx(Er,{children:l.jsxs(Be,{className:"bg-gray-50 hover:bg-gray-50",children:[l.jsx(ve,{className:"font-bold text-gray-900 w-[180px]",children:"Label Template"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[120px]",children:"Template Code"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[120px]",children:"Location"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[100px]",children:"Label Type"}),l.jsx(ve,{className:"font-bold text-gray-900",children:"Contents"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[150px]",children:"Size"}),l.jsx(ve,{className:"font-bold text-gray-900 text-center w-[100px]",children:"Actions"})]})}),l.jsx(Pr,{children:d?l.jsx(Be,{children:l.jsx(de,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):e.length===0?l.jsx(Be,{children:l.jsx(de,{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(J=>l.jsxs(Be,{className:"hover:bg-gray-50",children:[l.jsx(de,{className:"font-medium whitespace-nowrap overflow-hidden text-ellipsis max-w-[180px]",children:mde(J)}),l.jsx(de,{className:"text-gray-600 whitespace-nowrap overflow-hidden text-ellipsis max-w-[140px]",children:gde(J)}),l.jsx(de,{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[140px]",children:A1(vde(J,G))}),l.jsx(de,{className:"whitespace-nowrap",children:A1(J.labelType)}),l.jsxs(de,{className:"text-sm text-gray-600 whitespace-nowrap",children:[yde(J)," element(s)"]}),l.jsx(de,{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[160px]",children:xde(J)}),l.jsx(de,{className:"text-center",children:l.jsxs(ma,{open:x===J.id,onOpenChange:ee=>y(ee?J.id:null),children:[l.jsx(ga,{asChild:!0,children:l.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:l.jsx(Ei,{className:"h-4 w-4 text-gray-500"})})}),l.jsxs(va,{align:"end",className:"w-40 p-1",children:[l.jsxs(fe,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>oe(J.id),children:[l.jsx(_h,{className:"w-4 h-4"}),"Edit"]}),l.jsx(fe,{type:"button",variant:"ghost",className:"w-full justify-start h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>K(J),children:"Delete"})]})]})})]},J.id))})]})})}),l.jsx("div",{className:"pt-4",children:l.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[l.jsxs("div",{children:["Showing ",h===0?0:(B-1)*H+1,"-",Math.min(B*H,h)," of ",h]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs(Ke,{value:String(H),onValueChange:J=>V(Number(J)),children:[l.jsx(Ye,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:l.jsx(Xe,{})}),l.jsx(Je,{children:[10,20,50].map(J=>l.jsxs(Ne,{value:String(J),children:[J," / page"]},J))})]}),l.jsx(_i,{className:"mx-0 w-auto justify-end",children:l.jsxs(Ni,{children:[l.jsx(At,{children:l.jsx(Ci,{href:"#",size:"default",onClick:J=>{J.preventDefault(),q(ee=>Math.max(1,ee-1))},"aria-disabled":B<=1,className:B<=1?"pointer-events-none opacity-50":""})}),l.jsx(At,{children:l.jsxs(ua,{href:"#",isActive:!0,size:"default",onClick:J=>J.preventDefault(),children:["Page ",B," / ",D]})}),l.jsx(At,{children:l.jsx(Oi,{href:"#",size:"default",onClick:J=>{J.preventDefault(),q(ee=>Math.min(D,ee+1))},"aria-disabled":B>=D,className:B>=D?"pointer-events-none opacity-50":""})})]})})]})]})}),l.jsx(wde,{open:S,template:N,onOpenChange:J=>{_(J),J||O(null)},onDeleted:Z})]})}function wde({open:e,template:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),o=b.useMemo(()=>(t?.templateName??t?.name??"").trim()||(t?.templateCode??t?.id??"").trim()||"this template",[t]),u=async()=>{if(t?.id){i(!0);try{await $ce(t.id),xe.success("Label template deleted.",{description:"The label template has been removed successfully."}),r(!1),n()}catch(d){xe.error("Failed to delete label template.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-none",style:{width:"30%"},children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Delete Label Template"}),l.jsx(Nt,{children:"This action cannot be undone."})]}),l.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",l.jsx("span",{className:"font-medium",children:o}),"?"]}),l.jsxs(xt,{className:"flex-row flex-wrap justify-end",children:[l.jsx(fe,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{className:"min-w-24",variant:"destructive",disabled:a,onClick:u,children:a?"Deleting...":"Delete"})]})]})})}const og=an({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),sg="/label-multiple-option";function Sde(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 l_(e){return{...e,optionValuesJson:Sde(e.optionValuesJson)}}function jde(e){return{totalCount:e.totalCount??0,items:(e.items??[]).map(l_)}}function U5(e){return JSON.stringify(e)}async function _de(e,t){const r=await og.requestJson({path:sg,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword,State:e.state},signal:t});return jde(r)}async function Nde(e){const t=await og.requestJson({path:sg,method:"POST",body:{optionCode:e.optionCode,optionName:e.optionName,optionValuesJson:U5(e.optionValuesJson),state:e.state??!0,orderNum:e.orderNum}});return l_(t)}async function Cde(e,t){const r=await og.requestJson({path:`${sg}/${encodeURIComponent(e)}`,method:"PUT",body:{optionCode:t.optionCode,optionName:t.optionName,optionValuesJson:U5(t.optionValuesJson),state:t.state??!0,orderNum:t.orderNum}});return l_(r)}async function Ode(e){await og.requestJson({path:`${sg}/${encodeURIComponent(e)}`,method:"DELETE"})}function HI(e){const t=(e??"").trim();return t||"None"}function Ede(){const[e,t]=b.useState(!1),[r,n]=b.useState(!1),[a,i]=b.useState(!1),[o,u]=b.useState(null),[d,c]=b.useState(null),[h,p]=b.useState([]),[m,v]=b.useState(!1),[x,y]=b.useState(0),[S,_]=b.useState(0),[N,O]=b.useState(null),[A,C]=b.useState(""),[E,T]=b.useState("all"),[R,L]=b.useState(1),[z,F]=b.useState(10),B=b.useRef(null),q=b.useRef(null),[H,V]=b.useState("");b.useEffect(()=>(q.current&&window.clearTimeout(q.current),q.current=window.setTimeout(()=>V(A.trim()),300),()=>{q.current&&window.clearTimeout(q.current)}),[A]);const G=Math.max(1,Math.ceil(x/z));b.useEffect(()=>{L(1)},[H,E,z]),b.useEffect(()=>((async()=>{B.current?.abort();const I=new AbortController;B.current=I,v(!0);try{const D=(R-1)*z,Z=await _de({skipCount:D,maxResultCount:z,keyword:H||void 0,state:E==="all"?void 0:E==="true"},I.signal);p(Z.items??[]),y(Z.totalCount??0)}catch(D){if(D?.name==="AbortError")return;xe.error("Failed to load multiple options.",{description:D?.message?String(D.message):"Please try again."}),p([]),y(0)}finally{v(!1)}})(),()=>B.current?.abort()),[H,E,R,z,S]);const U=()=>_(k=>k+1),$=k=>{O(null),u(k),n(!0)},Q=k=>{O(null),c(k),i(!0)};return l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsx("div",{className:"pb-4",children:l.jsx("div",{className:"flex flex-col gap-4",children:l.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[l.jsx(me,{placeholder:"Search",value:A,onChange:k=>C(k.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"}),l.jsxs(Ke,{value:E,onValueChange:T,children:[l.jsx(Ye,{className:"bg-white border border-gray-300 rounded-md w-[150px] shrink-0",style:{height:40,boxSizing:"border-box"},children:l.jsx(Xe,{placeholder:"State"})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"all",children:"All States"}),l.jsx(Ne,{value:"true",children:"Active"}),l.jsx(Ne,{value:"false",children:"Inactive"})]})]}),l.jsx("div",{className:"flex-1"}),l.jsxs(fe,{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 ",l.jsx(wn,{className:"ml-1 h-4 w-4"})]})]})})}),l.jsx("div",{className:"flex-1 overflow-auto pt-6",children:l.jsx("div",{className:"rounded-md border bg-white shadow-sm",children:l.jsxs(Or,{children:[l.jsx(Er,{children:l.jsxs(Be,{className:"bg-gray-50 hover:bg-gray-50",children:[l.jsx(ve,{className:"font-bold text-gray-900 w-[200px]",children:"Multiple Option Name"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[200px]",children:"Option Code"}),l.jsx(ve,{className:"font-bold text-gray-900",children:"Contents"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[100px]",children:"State"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[100px]",children:"Order"}),l.jsx(ve,{className:"font-bold text-gray-900 w-[180px]",children:"Last Edited"}),l.jsx(ve,{className:"font-bold text-gray-900 text-center w-[100px]",children:"Actions"})]})}),l.jsx(Pr,{children:m?l.jsx(Be,{children:l.jsx(de,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):h.length===0?l.jsx(Be,{children:l.jsx(de,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):h.map(k=>l.jsxs(Be,{className:"hover:bg-gray-50",children:[l.jsx(de,{className:"font-medium",children:HI(k.optionName)}),l.jsx(de,{className:"text-gray-600",children:HI(k.optionCode)}),l.jsx(de,{className:"text-gray-600",children:k.optionValuesJson&&k.optionValuesJson.length>0?k.optionValuesJson.join("; "):"None"}),l.jsx(de,{children:l.jsx(xr,{className:k.state?"bg-green-600":"bg-gray-400",children:k.state?"Active":"Inactive"})}),l.jsx(de,{className:"font-numeric",children:k.orderNum??"None"}),l.jsx(de,{className:"text-gray-500 tabular-nums font-numeric",children:k.creationTime?new Date(k.creationTime).toLocaleString():"None"}),l.jsx(de,{className:"text-center",children:l.jsxs(ma,{open:N===k.id,onOpenChange:I=>O(I?k.id:null),children:[l.jsx(ga,{asChild:!0,children:l.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:l.jsx(Ei,{className:"h-4 w-4 text-gray-500"})})}),l.jsxs(va,{align:"end",className:"w-40 p-1",children:[l.jsxs(fe,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>$(k),children:[l.jsx(xn,{className:"w-4 h-4"}),"Edit"]}),l.jsx(fe,{type:"button",variant:"ghost",className:"w-full justify-start h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>Q(k),children:"Delete"})]})]})})]},k.id))})]})})}),l.jsx("div",{className:"pt-4",children:l.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[l.jsxs("div",{children:["Showing ",x===0?0:(R-1)*z+1,"-",Math.min(R*z,x)," of ",x]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs(Ke,{value:String(z),onValueChange:k=>F(Number(k)),children:[l.jsx(Ye,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:l.jsx(Xe,{})}),l.jsx(Je,{children:[10,20,50].map(k=>l.jsxs(Ne,{value:String(k),children:[k," / page"]},k))})]}),l.jsx(_i,{className:"mx-0 w-auto justify-end",children:l.jsxs(Ni,{children:[l.jsx(At,{children:l.jsx(Ci,{href:"#",size:"default",onClick:k=>{k.preventDefault(),L(I=>Math.max(1,I-1))},"aria-disabled":R<=1,className:R<=1?"pointer-events-none opacity-50":""})}),l.jsx(At,{children:l.jsxs(ua,{href:"#",isActive:!0,size:"default",onClick:k=>k.preventDefault(),children:["Page ",R," / ",G]})}),l.jsx(At,{children:l.jsx(Oi,{href:"#",size:"default",onClick:k=>{k.preventDefault(),L(I=>Math.min(G,I+1))},"aria-disabled":R>=G,className:R>=G?"pointer-events-none opacity-50":""})})]})})]})]})}),l.jsx(Pde,{open:e,onOpenChange:t,onCreated:()=>{L(1),U()}}),l.jsx(Ade,{open:r,option:o,onOpenChange:k=>{n(k),k||u(null)},onUpdated:U}),l.jsx(Tde,{open:a,option:d,onOpenChange:k=>{i(k),k||c(null)},onDeleted:U})]})}function Pde({open:e,onOpenChange:t,onCreated:r}){const[n,a]=b.useState(!1),[i,o]=b.useState({optionCode:"",optionName:"",optionValuesJson:[],state:!0,orderNum:null}),[u,d]=b.useState(""),c=()=>{o({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)){xe.error("Duplicate value",{description:"This value already exists."});return}o(x=>({...x,optionValuesJson:[...x.optionValuesJson,v]})),d("")}},p=v=>{o(x=>({...x,optionValuesJson:x.optionValuesJson.filter((y,S)=>S!==v)}))},m=async()=>{if(!i.optionCode.trim()||!i.optionName.trim()){xe.error("Validation failed",{description:"Option Code and Option Name are required."});return}if(i.optionValuesJson.length===0){xe.error("Validation failed",{description:"At least one option value is required."});return}a(!0);try{await Nde(i),xe.success("Multiple option created.",{description:"The multiple option has been created successfully."}),t(!1),r()}catch(v){xe.error("Failed to create multiple option.",{description:v?.message?String(v.message):"Please try again."})}finally{a(!1)}};return l.jsx(mt,{open:e,onOpenChange:t,children:l.jsxs(ft,{className:"sm:max-w-[600px]",children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Add New Multiple Option"}),l.jsx(Nt,{children:"Enter the details for the new multiple option."})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Option Code *"}),l.jsx(me,{placeholder:"e.g. OPT_ALLERGENS",value:i.optionCode,onChange:v=>o(x=>({...x,optionCode:v.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Option Name *"}),l.jsx(me,{placeholder:"e.g. Allergens",value:i.optionName,onChange:v=>o(x=>({...x,optionName:v.target.value}))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Option Values *"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(me,{placeholder:"Enter a value and press Add",value:u,onChange:v=>d(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),h())}}),l.jsx(fe,{type:"button",onClick:h,variant:"outline",children:"Add"})]}),i.optionValuesJson.length>0&&l.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:i.optionValuesJson.map((v,x)=>l.jsxs(xr,{variant:"secondary",className:"flex items-center gap-1",children:[v,l.jsx("button",{type:"button",onClick:()=>p(x),className:"ml-1 hover:text-red-600",children:l.jsx(uo,{className:"h-3 w-3"})})]},x))})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Order"}),l.jsx(me,{type:"number",placeholder:"e.g. 1",value:i.orderNum??"",onChange:v=>o(x=>({...x,orderNum:v.target.value?Number(v.target.value):null}))})]}),l.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[l.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),l.jsx(qt,{checked:i.state,onCheckedChange:v=>o(x=>({...x,state:v}))})]})]})]}),l.jsxs(xt,{children:[l.jsx(fe,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),l.jsx(fe,{disabled:n,onClick:m,children:n?"Creating...":"Create"})]})]})})}function Ade({open:e,option:t,onOpenChange:r,onUpdated:n}){const[a,i]=b.useState(!1),[o,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(o.optionValuesJson.includes(v)){xe.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,S)=>S!==v)}))},m=async()=>{if(t?.id){if(!o.optionCode.trim()||!o.optionName.trim()){xe.error("Validation failed",{description:"Option Code and Option Name are required."});return}if(o.optionValuesJson.length===0){xe.error("Validation failed",{description:"At least one option value is required."});return}i(!0);try{await Cde(t.id,o),xe.success("Multiple option updated.",{description:"The multiple option has been updated successfully."}),r(!1),n()}catch(v){xe.error("Failed to update multiple option.",{description:v?.message?String(v.message):"Please try again."})}finally{i(!1)}}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-[600px]",children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Edit Multiple Option"}),l.jsx(Nt,{children:"Update the multiple option details."})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Option Code *"}),l.jsx(me,{placeholder:"e.g. OPT_ALLERGENS",value:o.optionCode,onChange:v=>u(x=>({...x,optionCode:v.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Option Name *"}),l.jsx(me,{placeholder:"e.g. Allergens",value:o.optionName,onChange:v=>u(x=>({...x,optionName:v.target.value}))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Option Values *"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(me,{placeholder:"Enter a value and press Add",value:d,onChange:v=>c(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),h())}}),l.jsx(fe,{type:"button",onClick:h,variant:"outline",children:"Add"})]}),o.optionValuesJson.length>0&&l.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:o.optionValuesJson.map((v,x)=>l.jsxs(xr,{variant:"secondary",className:"flex items-center gap-1",children:[v,l.jsx("button",{type:"button",onClick:()=>p(x),className:"ml-1 hover:text-red-600",children:l.jsx(uo,{className:"h-3 w-3"})})]},x))})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Order"}),l.jsx(me,{type:"number",placeholder:"e.g. 1",value:o.orderNum??"",onChange:v=>u(x=>({...x,orderNum:v.target.value?Number(v.target.value):null}))})]}),l.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[l.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),l.jsx(qt,{checked:o.state,onCheckedChange:v=>u(x=>({...x,state:v}))})]})]})]}),l.jsxs(xt,{children:[l.jsx(fe,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{disabled:a,onClick:m,children:a?"Updating...":"Update"})]})]})})}function Tde({open:e,option:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),o=b.useMemo(()=>(t?.optionName??"").trim()||t?.optionCode||"this option",[t]),u=async()=>{if(t?.id){i(!0);try{await Ode(t.id),xe.success("Multiple option deleted.",{description:"The multiple option has been removed successfully."}),r(!1),n()}catch(d){xe.error("Failed to delete multiple option.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-none",style:{width:"30%"},children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Delete Multiple Option"}),l.jsx(Nt,{children:"This action cannot be undone."})]}),l.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",l.jsx("span",{className:"font-medium",children:o}),"?"]}),l.jsxs(xt,{className:"flex-row flex-wrap justify-end",children:[l.jsx(fe,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{className:"min-w-24",variant:"destructive",disabled:a,onClick:u,children:a?"Deleting...":"Delete"})]})]})})}function kde({currentView:e="Labels",onViewChange:t}){const r=["Labels","Label Categories","Label Types","Label Templates","Multiple Options"],n=a=>{t&&t(a)};return l.jsxs("div",{className:"space-y-6",children:[l.jsx("div",{className:"w-full border-b border-gray-200",children:l.jsx("div",{className:"flex overflow-x-auto bg-white",children:r.map(a=>l.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))})}),l.jsxs("div",{className:"min-h-[400px]",children:[e==="Labels"&&l.jsx(Wce,{}),e==="Label Categories"&&l.jsx(Yce,{}),e==="Label Types"&&l.jsx(eue,{}),e==="Label Templates"&&l.jsx(bde,{}),e==="Multiple Options"&&l.jsx(Ede,{}),!["Labels","Label Categories","Label Types","Label Templates","Multiple Options"].includes(e)&&l.jsxs("div",{className:"flex items-center justify-center h-64 text-gray-400",children:[e," content coming soon..."]})]})]})}function Rde(){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(o=>o.id===a?{...o,isOpen:!o.isOpen}:o))},n=(a,i)=>{t(o=>o.map(u=>u.id!==a?u:{...u,subcategories:u.subcategories.map(d=>d.id===i?{...d,isOpen:!d.isOpen}:d)}))};return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(me,{className:"bg-white border border-black rounded-md h-10 w-[150px]"}),l.jsx("span",{className:"text-sm text-black whitespace-nowrap",children:"Search"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(Ke,{defaultValue:"all",children:[l.jsx(Ye,{className:"bg-white border border-black rounded-md h-10 w-[100px]",children:l.jsx(Xe,{placeholder:"Location"})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"all",children:"all"}),l.jsx(Ne,{value:"loc-a",children:"Location A"})]})]}),l.jsx("span",{className:"text-sm text-black whitespace-nowrap",children:"Location"})]})]}),l.jsxs("div",{className:"bg-gray-100 p-2 flex justify-between items-center border-b border-gray-200",children:[l.jsx("h1",{className:"text-xl font-medium text-gray-700",children:"Information"}),l.jsxs("div",{className:"flex items-center gap-4 text-gray-600",children:[l.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"}),l.jsx(y8,{className:"h-5 w-5"}),l.jsx("span",{className:"font-medium",children:"55789"})]})]}),l.jsxs("div",{className:"space-y-4",children:[l.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:[l.jsx(wn,{className:"h-4 w-4"}),"New Category",l.jsx(Ph,{className:"h-4 w-4 opacity-70"})]}),l.jsx("div",{className:"space-y-4",children:e.map(a=>l.jsxs("div",{className:"border border-gray-300 rounded-sm overflow-hidden",children:[l.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:[l.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?l.jsx(Is,{className:"h-4 w-4 text-[#2c7bb6]"}):l.jsx(Ms,{className:"h-4 w-4 text-[#2c7bb6]"}),a.name]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{className:"text-gray-400 hover:text-gray-600",children:l.jsx(_h,{className:"h-4 w-4"})}),l.jsx("button",{className:"text-red-400 hover:text-red-600",children:l.jsx(uo,{className:"h-4 w-4"})})]})]}),a.isOpen&&l.jsxs("div",{className:"p-2 space-y-3 bg-white",children:[l.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:[l.jsx(wn,{className:"h-4 w-4"}),"New Subcategory",l.jsx(Ph,{className:"h-4 w-4 opacity-70"})]}),l.jsxs("div",{className:"space-y-3",children:[a.subcategories.map(i=>l.jsxs("div",{className:"border border-gray-200 rounded-sm",children:[l.jsxs("div",{className:"bg-white border-b border-gray-200 p-2 flex items-center justify-between",children:[l.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?l.jsx(Is,{className:"h-4 w-4 text-[#2c7bb6]"}):l.jsx(Ms,{className:"h-4 w-4 text-[#2c7bb6]"}),i.name]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{className:"text-gray-400 hover:text-gray-600",children:l.jsx(_h,{className:"h-4 w-4"})}),l.jsx("button",{className:"text-red-400 hover:text-red-600",children:l.jsx(uo,{className:"h-4 w-4"})})]})]}),i.isOpen&&l.jsxs("div",{className:"p-3 bg-gray-50/50",children:[l.jsx("div",{className:"mb-2 text-xs font-bold text-gray-500 uppercase tracking-wide",children:"Files"}),l.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 justify-end",children:[l.jsx(fe,{size:"sm",className:"h-8 bg-[#4CAF50] hover:bg-[#43a047] text-white text-xs border-none rounded-sm",children:"Upload Your Own File(s)"}),l.jsx(fe,{size:"sm",className:"h-8 bg-[#4CAF50] hover:bg-[#43a047] text-white text-xs border-none rounded-sm",children:"Create A Custom File"}),l.jsx(fe,{size:"sm",className:"h-8 bg-[#2c7bb6] hover:bg-[#256b9e] text-white text-xs border-none rounded-sm",children:"Edit File Permissions"}),l.jsxs(fe,{size:"sm",className:"h-8 bg-[#2c7bb6] hover:bg-[#256b9e] text-white text-xs border-none rounded-sm gap-1",children:["Sort (A-Z) ",l.jsx(wz,{className:"h-3 w-3"})]})]}),l.jsx("div",{className:"space-y-1",children:i.files.length>0?i.files.map(o=>l.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:[l.jsx("div",{className:"flex-shrink-0 mr-3",children:o.type==="image"?l.jsx(Wz,{className:"h-5 w-5 text-[#2c7bb6]"}):l.jsx(Ds,{className:"h-5 w-5 text-[#2c7bb6]"})}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx("div",{className:"font-medium text-gray-700 truncate",children:o.name})}),l.jsx("div",{className:"text-xs text-gray-500 mr-4 whitespace-nowrap",children:o.date}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{className:"p-1 text-gray-400 hover:text-gray-600 bg-white border border-gray-300 rounded-sm",children:l.jsx(Ds,{className:"h-3 w-3"})}),l.jsx("button",{className:"p-1 text-gray-400 hover:text-gray-600 bg-white border border-gray-300 rounded-sm",children:l.jsx(_h,{className:"h-3 w-3"})}),l.jsx("button",{className:"p-1 text-red-400 hover:text-red-600 bg-white border border-gray-300 rounded-sm",children:l.jsx(uo,{className:"h-3 w-3"})})]})]},o.id)):l.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&&l.jsx("div",{className:"p-2 text-sm text-gray-400 italic",children:"No subcategories"})]})]})]},a.id))})]})]})}const Ide=[{id:1,title:"Coffee - 2 hrs",subtitle:"1 min - Completes at 12:05 PM",totalTime:7200,remainingTime:0,status:"expired",icon:$z},{id:2,title:"Clean Tablet",subtitle:"1 hrs - Completes at 12:37 PM",totalTime:3600,remainingTime:237,status:"running",icon:w8},{id:3,title:"Replace Sanitizer Towels",subtitle:"1 hrs - Completes at 12:37 PM",totalTime:3600,remainingTime:238,status:"running",icon:Hc},{id:4,title:"Take Out Trash",subtitle:"1 hrs - Completes at 01:03 PM",totalTime:3600,remainingTime:58,status:"running",icon:Hc},{id:5,title:"Change Utensils",subtitle:"1 hrs - Completes at 01:03 PM",totalTime:3600,remainingTime:58,status:"running",icon:M8},{id:6,title:"Sanitize Surfaces",subtitle:"1 hrs - Completes at 02:00 PM",totalTime:3600,remainingTime:2157,status:"running",icon:sy},{id:7,title:"Check Temperatures",subtitle:"1 hrs - Completes at 02:00 PM",totalTime:3600,remainingTime:2158,status:"running",icon:sy},{id:8,title:"Ranch 4 hrs",subtitle:"4 hrs - Completes at 04:04 PM",totalTime:14400,remainingTime:2158,status:"running",icon:sy}];function Mde({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),o=a%60;return`${i.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`};return l.jsxs("div",{className:"bg-gray-200 rounded-xl p-4 flex flex-col items-center relative shadow-sm h-[280px]",children:[l.jsxs("div",{className:"text-center mb-2",children:[l.jsx("h3",{className:"text-lg font-medium text-gray-800 leading-tight",children:e.title}),l.jsx("p",{className:"text-xs text-gray-500 mt-1",children:e.subtitle})]}),l.jsxs("div",{className:"relative w-32 h-32 my-auto flex items-center justify-center",children:[l.jsxs("svg",{className:"w-full h-full transform -rotate-90",children:[l.jsx("circle",{cx:"64",cy:"64",r:"56",stroke:"white",strokeWidth:"12",fill:"transparent"}),l.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"})]}),l.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[l.jsx("span",{className:Ae("text-3xl font-bold",r?"text-red-500":"text-gray-800"),children:r?"0s":n(e.remainingTime)}),l.jsx("span",{className:Ae("text-[10px] font-medium uppercase mt-1",r?"text-red-400":"text-gray-400"),children:"Remaining"})]})]}),l.jsxs("div",{className:"w-full flex justify-between items-end mt-2",children:[l.jsx(i8,{className:"w-5 h-5 text-blue-700 fill-current"}),l.jsx("div",{className:"flex flex-col items-center",children:l.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:l.jsx(e.icon,{className:"w-5 h-5"})})}),l.jsx("div",{className:"flex flex-col items-end",children:l.jsx("span",{className:"text-xs text-blue-600 font-bold mb-2 cursor-pointer",children:"EDIT"})})]}),l.jsx("button",{className:"absolute bottom-12 right-4 bg-blue-600 rounded-full p-1 text-white hover:bg-blue-700 shadow-md",children:l.jsx(uo,{className:"w-4 h-4"})})]})}function Dde(){const[e,t]=b.useState(!0);return l.jsxs("div",{className:"h-full flex flex-col bg-gray-50 relative",children:[l.jsxs("div",{className:"bg-white border-b border-gray-200 px-4 py-3 flex items-center justify-between shadow-sm z-10",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("button",{className:"flex items-center text-blue-500 text-lg font-medium",children:[l.jsx(QI,{className:"w-6 h-6"}),"Back"]}),l.jsx(t8,{className:"w-6 h-6 text-gray-500"})]}),l.jsxs("div",{className:"flex flex-col items-center",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"bg-blue-600 p-1.5 rounded-md",children:l.jsx(_8,{className:"w-5 h-5 text-white"})}),l.jsx("h1",{className:"text-xl font-bold text-blue-900",children:"Timers"})]}),l.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 font-medium",children:[l.jsx("span",{children:"86016"}),l.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"})]})]}),l.jsxs("div",{className:"flex items-center gap-4 text-blue-500 font-medium",children:[l.jsx(k8,{className:"w-6 h-6 text-gray-400"}),l.jsxs("button",{className:"flex items-center gap-1",children:[l.jsx(wn,{className:"w-5 h-5"}),"Add Timer"]})]})]}),l.jsxs("div",{className:"bg-gray-700 text-white px-6 py-2 flex items-center justify-between",children:[l.jsx("div",{className:"flex-1"})," ",l.jsx("div",{className:"font-medium",children:"Today, December 15"}),l.jsxs("div",{className:"flex-1 flex justify-end items-center gap-4",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Vz,{className:"w-5 h-5 text-gray-300"}),l.jsx(Yz,{className:"w-5 h-5 text-gray-500"})]}),l.jsx(mz,{className:"w-5 h-5 text-blue-400"})]})]}),l.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Ide.map(r=>l.jsx(Mde,{timer:r},r.id))})}),e&&l.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-[1px]",children:l.jsx("div",{className:"bg-black text-white rounded-xl shadow-2xl w-[600px] max-w-full overflow-hidden border border-gray-800",children:l.jsxs("div",{className:"p-8 text-center space-y-6",children:[l.jsx("h2",{className:"text-3xl font-medium text-blue-500",children:"Coffee - 2 hrs"}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsx("p",{className:"text-2xl font-light",children:"Timer expired at 12:05 PM"}),l.jsx("p",{className:"text-2xl font-light",children:"Please discard the coffee"})]}),l.jsx("div",{className:"flex justify-end",children:l.jsx("span",{className:"bg-gray-200 text-black text-[10px] px-1 rounded-sm opacity-50",children:"TACT_Img_Timer-Notification@2x"})}),l.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-8",children:[l.jsx(fe,{onClick:()=>t(!1),className:"bg-blue-700 hover:bg-blue-600 text-white h-14 text-xl font-medium rounded-lg",children:"Mute"}),l.jsx(fe,{onClick:()=>t(!1),className:"bg-blue-600 hover:bg-blue-500 text-white h-14 text-xl font-medium rounded-lg",children:"Restart"}),l.jsx(fe,{onClick:()=>t(!1),className:"bg-blue-800 hover:bg-blue-700 text-white h-14 text-xl font-medium rounded-lg",children:"Acknowledge"})]})]})})})]})}const lg=an({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),cg="/product-location";function Lde(e){const t=e;return{id:t?.id??t?.Id,locationId:t?.locationId??t?.LocationId,productId:t?.productId??t?.ProductId}}async function $de(e,t){const r=await lg.requestJson({path:cg,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=>Lde(n))}}async function V5(e,t){const r=await lg.requestJson({path:`${cg}/${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 H5(e){return lg.requestJson({path:cg,method:"POST",body:{locationId:e.locationId,productIds:e.productIds}})}async function Bde(e,t){return lg.requestJson({path:`${cg}/${encodeURIComponent(e)}`,method:"PUT",body:{productIds:t.productIds}})}function zn(e){const t=(e??"").trim();return t||"—"}async function Fde(e){const t=new Map;try{const r=await $de({skipCount:0,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 o=t.get(a);o.includes(i)||o.push(i)}}catch{}return t}async function zde(e,t,r){const n=[...new Set(r.filter(Boolean))];for(const a of n){if(a===t)continue;const i=await V5(a);i.includes(e)&&await Bde(a,{productIds:i.filter(o=>o!==e)})}t.trim()&&await H5({locationId:t,productIds:[e]})}function qde(){const[e,t]=b.useState("products"),[r,n]=b.useState([]),[a,i]=b.useState(0),[o,u]=b.useState(!1),[d,c]=b.useState(new Map),[h,p]=b.useState([]),[m,v]=b.useState([]),[x,y]=b.useState(""),[S,_]=b.useState(""),N=b.useRef(null),[O,A]=b.useState("all"),[C,E]=b.useState("all"),[T,R]=b.useState("all"),[L,z]=b.useState(1),[F,B]=b.useState(10),[q,H]=b.useState(0),V=b.useRef(null),[G,U]=b.useState(!1),[$,Q]=b.useState(!1),[k,I]=b.useState(null),[D,Z]=b.useState(null),[ie,oe]=b.useState(null);b.useEffect(()=>(N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>_(x.trim()),300),()=>{N.current&&window.clearTimeout(N.current)}),[x]),b.useEffect(()=>{let W=!1;return(async()=>{try{const[_e,Ce]=await Promise.all([Al({skipCount:0,maxResultCount:500}),s_({skipCount:0,maxResultCount:500})]);if(W)return;p(_e.items??[]),v(Ce.items??[])}catch{W||(p([]),v([]))}})(),()=>{W=!0}},[]),b.useEffect(()=>{z(1)},[S,O,C,T,F]);const ne=O!=="all"||C!=="all";b.useEffect(()=>e!=="products"?void 0:((async()=>{V.current?.abort();const _e=new AbortController;V.current=_e,u(!0);try{const Ce=await Fde(_e.signal);if(_e.signal.aborted)return;if(c(Ce),ne){const qe=await xS({skipCount:0,maxResultCount:500,keyword:S||void 0,state:T==="all"?void 0:T==="true"},_e.signal);if(_e.signal.aborted)return;let De=qe.items??[];if(O!=="all"){const Ut=new Set(await V5(O));De=De.filter(lr=>Ut.has(lr.id))}C!=="all"&&(De=De.filter(Ut=>(Ut.categoryName??"").trim()===C));const nt=De.length;i(nt);const kt=(L-1)*F;n(De.slice(kt,kt+F))}else{const qe=(L-1)*F,De=await xS({skipCount:qe,maxResultCount:F,keyword:S||void 0,state:T==="all"?void 0:T==="true"},_e.signal);if(_e.signal.aborted)return;n(De.items??[]),i(De.totalCount??0)}}catch(Ce){if(Ce?.name==="AbortError")return;xe.error("Failed to load products",{description:Ce?.message?String(Ce.message):"Please try again."}),n([]),i(0)}finally{_e.signal.aborted||u(!1)}})(),()=>V.current?.abort()),[e,S,O,C,T,L,F,q,ne]);const K=()=>H(W=>W+1),J=b.useMemo(()=>h.map(W=>({value:W.id,label:zn(W.locationName??W.locationCode??W.id)})),[h]),ee=b.useMemo(()=>m.map(W=>({value:(W.categoryName??W.categoryCode??W.id??"").trim(),label:zn(W.categoryName??W.categoryCode??W.id)})).filter(W=>W.value),[m]),ce=Math.max(1,Math.ceil(a/F)),pe=b.useCallback(W=>{const _e=h.find(Ce=>Ce.id===W);return zn(_e?.locationName??_e?.locationCode??W)},[h]);return l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"pb-4",children:[l.jsxs("div",{className:"flex flex-nowrap items-center gap-3 flex-wrap",children:[l.jsxs("div",{className:"flex items-center w-40 shrink-0 rounded-md border border-gray-300 bg-white overflow-hidden",style:{height:40},children:[l.jsx(Kp,{className:"h-4 w-4 text-gray-400 shrink-0 ml-2.5 pointer-events-none"}),l.jsx(me,{placeholder:"Search...",value:x,onChange:W=>y(W.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"})]}),l.jsxs(Ke,{value:"all",disabled:!0,children:[l.jsx(Ye,{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:l.jsx(Xe,{placeholder:"Partner"})}),l.jsx(Je,{children:l.jsx(Ne,{value:"all",children:"All partners"})})]}),l.jsxs(Ke,{value:"all",disabled:!0,children:[l.jsx(Ye,{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:l.jsx(Xe,{placeholder:"Group"})}),l.jsx(Je,{children:l.jsx(Ne,{value:"all",children:"All groups"})})]}),l.jsxs(Ke,{value:O,onValueChange:A,children:[l.jsx(Ye,{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:l.jsx(Xe,{placeholder:"Location"})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"all",children:"All Locations"}),h.map(W=>l.jsx(Ne,{value:W.id,children:zn(W.locationName??W.locationCode??W.id)},W.id))]})]}),l.jsxs(Ke,{value:C,onValueChange:E,children:[l.jsx(Ye,{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:l.jsx(Xe,{placeholder:"Category"})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"all",children:"All Categories"}),ee.map(W=>l.jsx(Ne,{value:W.value,children:W.label},W.value))]})]}),l.jsxs(Ke,{value:T,onValueChange:R,children:[l.jsx(Ye,{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:l.jsx(Xe,{placeholder:"State"})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"all",children:"All states"}),l.jsx(Ne,{value:"true",children:"Active"}),l.jsx(Ne,{value:"false",children:"Inactive"})]})]}),l.jsx("div",{className:"flex-1 min-w-2"}),l.jsxs(fe,{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:[l.jsx(A8,{className:"w-4 h-4"})," Bulk Import"]}),l.jsxs(fe,{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:[l.jsx(CS,{className:"w-4 h-4"})," Bulk Export"]}),l.jsxs(fe,{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:[l.jsx(xn,{className:"w-4 h-4"})," Bulk Edit"]}),e==="products"?l.jsxs(fe,{className:"h-10 rounded-md bg-blue-600 text-white hover:bg-blue-700 font-medium gap-1 shrink-0",onClick:()=>{I(null),U(!0)},children:["New Product ",l.jsx(wn,{className:"w-4 h-4"})]}):l.jsxs(fe,{className:"h-10 rounded-md bg-blue-600 text-white hover:bg-blue-700 font-medium gap-1 shrink-0",onClick:()=>Q(!0),children:["New Category ",l.jsx(wn,{className:"w-4 h-4"})]})]}),l.jsx("div",{className:"w-full border-b border-gray-200 mt-4",children:l.jsxs("div",{className:"flex overflow-x-auto w-fit",children:[l.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"}),l.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"})]})})]}),l.jsx("div",{className:"flex-1 overflow-auto pt-6",children:e==="products"?l.jsxs("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden",children:[l.jsxs(Or,{children:[l.jsx(Er,{children:l.jsxs(Be,{className:"bg-gray-100 hover:bg-gray-100",children:[l.jsx(ve,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Location"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Product Category"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Product"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Product ID"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Product Code"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r whitespace-nowrap",children:"Status"}),l.jsx(ve,{className:"text-gray-900 font-bold text-center whitespace-nowrap",children:"Actions"})]})}),l.jsx(Pr,{children:o?l.jsx(Be,{children:l.jsx(de,{colSpan:7,className:"text-center text-gray-500 py-10",children:"Loading..."})}):r.length===0?l.jsx(Be,{children:l.jsx(de,{colSpan:7,className:"text-center text-gray-500 py-10",children:"No products found."})}):r.map(W=>{const _e=d.get(W.id)??[],Ce=_e.length===0?"—":_e.map(De=>pe(De)).join(", "),qe=W.state!==!1;return l.jsxs(Be,{children:[l.jsx(de,{className:"border-r text-sm max-w-[200px] truncate",title:Ce,children:Ce}),l.jsx(de,{className:"border-r text-gray-900 font-medium whitespace-nowrap",children:zn(W.categoryName)}),l.jsx(de,{className:"border-r text-gray-900 font-medium",children:l.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[W.productImageUrl?l.jsx("img",{src:W.productImageUrl,alt:"",className:"w-8 h-8 rounded object-cover border border-gray-200 shrink-0"}):l.jsx(Vc,{className:"w-4 h-4 text-gray-400 shrink-0"}),l.jsx("span",{className:"truncate",children:zn(W.productName)})]})}),l.jsx(de,{className:"border-r font-mono text-sm text-gray-600 whitespace-nowrap",children:W.id}),l.jsx(de,{className:"border-r font-mono text-sm text-gray-600 whitespace-nowrap",children:zn(W.productCode)}),l.jsx(de,{className:"border-r whitespace-nowrap",children:l.jsx(xr,{variant:qe?"default":"secondary",className:qe?"bg-green-600":"bg-gray-400",children:qe?"active":"inactive"})}),l.jsx(de,{className:"text-center whitespace-nowrap",children:l.jsxs(ma,{open:ie===W.id,onOpenChange:De=>oe(De?W.id:null),children:[l.jsx(ga,{asChild:!0,children:l.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",children:l.jsx(Ei,{className:"h-4 w-4"})})}),l.jsxs(va,{align:"end",className:"w-36 p-1",children:[l.jsxs(fe,{type:"button",variant:"ghost",className:"w-full justify-start h-9 px-2 font-normal",onClick:async()=>{oe(null);try{const De=await Bce(W.id);I(De),U(!0)}catch(De){xe.error("Failed to load product",{description:De?.message?String(De.message):""})}},children:[l.jsx(xn,{className:"w-4 h-4 mr-2"}),"Edit"]}),l.jsx(fe,{type:"button",variant:"ghost",className:"w-full justify-start h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>{oe(null),Z(W)},children:"Delete"})]})]})})]},W.id)})})]}),l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 text-sm text-gray-600 border-t border-gray-100",children:[l.jsxs("span",{children:["Showing ",a===0?0:(L-1)*F+1,"-",Math.min(L*F,a)," of ",a]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(Ke,{value:String(F),onValueChange:W=>B(Number(W)),children:[l.jsx(Ye,{className:"w-[100px] h-9",children:l.jsx(Xe,{})}),l.jsx(Je,{children:[10,20,50].map(W=>l.jsxs(Ne,{value:String(W),children:[W," / page"]},W))})]}),l.jsx(fe,{type:"button",variant:"outline",size:"sm",disabled:L<=1,onClick:()=>z(W=>Math.max(1,W-1)),children:"Prev"}),l.jsxs("span",{className:"text-xs tabular-nums",children:["Page ",L," / ",ce]}),l.jsx(fe,{type:"button",variant:"outline",size:"sm",disabled:L>=ce,onClick:()=>z(W=>Math.min(ce,W+1)),children:"Next"})]})]})]}):l.jsx(Ude,{categories:m})}),l.jsx(Vde,{open:G,onOpenChange:W=>{U(W),W||I(null)},editing:k,locationOptions:J,categoryOptions:ee,locationMap:d,onSaved:()=>{K(),U(!1),I(null)}}),l.jsx(Hde,{open:!!D,product:D,onOpenChange:W=>{W||Z(null)},onDeleted:K}),l.jsx(Wde,{open:$,onOpenChange:Q})]})}function Ude({categories:e}){return l.jsx("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden",children:l.jsxs(Or,{children:[l.jsx(Er,{children:l.jsxs(Be,{className:"bg-gray-100 hover:bg-gray-100",children:[l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Category Name"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Code"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Status"})]})}),l.jsx(Pr,{children:e.length===0?l.jsx(Be,{children:l.jsx(de,{colSpan:3,className:"text-center text-gray-500 py-8",children:"No categories loaded. Use Labeling → Label Categories to manage."})}):e.map(t=>l.jsxs(Be,{children:[l.jsx(de,{className:"border-r font-medium",children:zn(t.categoryName)}),l.jsx(de,{className:"border-r text-gray-600",children:zn(t.categoryCode)}),l.jsx(de,{className:"border-r",children:l.jsx(xr,{variant:t.state!==!1?"default":"secondary",children:t.state!==!1?"active":"inactive"})})]},t.id))})]})})}function Vde({open:e,onOpenChange:t,editing:r,locationOptions:n,categoryOptions:a,locationMap:i,onSaved:o}){const[u,d]=b.useState(!1),[c,h]=b.useState(""),[p,m]=b.useState(""),[v,x]=b.useState(""),[y,S]=b.useState(""),[_,N]=b.useState(!0),[O,A]=b.useState("");b.useEffect(()=>{if(e)if(r){h(r.productCode??""),m(r.productName??""),x((r.categoryName??"").trim()),S(r.productImageUrl??""),N(r.state!==!1);const E=i.get(r.id)??[];A(E[0]??"")}else h(""),m(""),x(""),S(""),N(!0),A("")},[e,r,i]);const C=async()=>{if(!c.trim()||!p.trim()){xe.error("Validation",{description:"Product code and name are required."});return}if(!O.trim()){xe.error("Validation",{description:"Select a store to bind this product."});return}const E={productCode:c.trim(),productName:p.trim(),categoryName:v.trim()||null,productImageUrl:y.trim()||null,state:_};d(!0);try{if(r){await zce(r.id,E);const T=i.get(r.id)??[];await zde(r.id,O.trim(),T)}else{const T=await Fce(E);await H5({locationId:O.trim(),productIds:[T.id]})}xe.success(r?"Product updated.":"Product created."),o()}catch(T){xe.error(r?"Update failed":"Create failed",{description:T?.message?String(T.message):""})}finally{d(!1)}};return l.jsx(mt,{open:e,onOpenChange:t,children:l.jsxs(ft,{className:"w-[min(50%,calc(100vw-2rem))] max-w-none sm:max-w-none max-h-[90vh] overflow-y-auto",children:[l.jsxs(gt,{children:[l.jsx(vt,{children:r?"Edit Product":"Add New Product"}),l.jsx(Nt,{children:r?"Update product and store binding.":"Create a product and bind it to a store."})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Product code *"}),l.jsx(me,{className:"h-10",value:c,onChange:E=>h(E.target.value),placeholder:"e.g. PRD_TEST_001"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Product name *"}),l.jsx(me,{className:"h-10",value:p,onChange:E=>m(E.target.value),placeholder:"e.g. Chicken"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Category name"}),l.jsx(na,{value:v,onValueChange:x,options:a,placeholder:"Select category (optional)",searchPlaceholder:"Search category…",emptyText:"No categories."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Image URL"}),l.jsx(me,{className:"h-10",value:y,onChange:E=>S(E.target.value),placeholder:"https://..."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Bind to store *"}),l.jsx(na,{value:O,onValueChange:A,options:n,placeholder:"Select location",searchPlaceholder:"Search location…",emptyText:"No locations."})]}),l.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 h-10 bg-white",children:[l.jsx("span",{className:"text-sm font-medium",children:"Enabled"}),l.jsx(qt,{checked:_,onCheckedChange:N})]})]}),l.jsxs(xt,{children:[l.jsx(fe,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),l.jsx(fe,{type:"button",disabled:u,onClick:C,className:"bg-blue-600 hover:bg-blue-700 text-white",children:u?"Saving…":r?"Save":"Create"})]})]})})}function Hde({open:e,product:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),o=async()=>{if(t?.id){i(!0);try{await qce(t.id),xe.success("Product deleted."),r(!1),n()}catch(u){xe.error("Delete failed",{description:u?.message?String(u.message):""})}finally{i(!1)}}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-md",children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Delete product"}),l.jsx(Nt,{children:"This cannot be undone."})]}),l.jsxs("p",{className:"text-sm text-gray-700 py-2",children:["Delete ",l.jsx("span",{className:"font-medium",children:zn(t?.productName)})," (",zn(t?.productCode),")?"]}),l.jsxs(xt,{children:[l.jsx(fe,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{type:"button",variant:"destructive",disabled:a,onClick:o,children:a?"Deleting…":"Delete"})]})]})})}function Wde({open:e,onOpenChange:t}){return l.jsx(mt,{open:e,onOpenChange:t,children:l.jsxs(ft,{className:"sm:max-w-md",children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Categories"}),l.jsxs(Nt,{children:["Manage categories under ",l.jsx("span",{className:"font-medium",children:"Labeling → Label Categories"})," (label module API)."]})]}),l.jsx(xt,{children:l.jsx(fe,{type:"button",onClick:()=>t(!1),children:"OK"})})]})})}const nd=an({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),ad="/rbac-menu";function Au(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 Gde(e){if(Array.isArray(e))return{items:e.map(Au),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(Au),totalCount:n}}async function W5(e,t){const r=await nd.requestJson({path:ad,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,Sorting:e.sorting,Keyword:e.keyword},signal:t});return Gde(r)}function SS(e){const t=Au(e),r=e,n=r?.children??r?.Children,a=Array.isArray(n)?n.map(SS):void 0;return{...t,children:a}}function Kde(e){if(Array.isArray(e))return e.map(SS);if(!e||typeof e!="object")return[];const t=e,r=t.items??t.Items??t.data??t.Data;return Array.isArray(r)?r.map(SS):[]}async function Xde(e){const t=await nd.requestJson({path:`${ad}/tree`,method:"GET",signal:e});return Kde(t)}async function Yde(e){const t=new Map;let r=1;const n=500;for(;;){const i=(await W5({skipCount:r,maxResultCount:n},e)).items??[];for(const o of i)o.menuType!==0||!o.id||t.has(o.id)||t.set(o.id,o);if(i.length100))break}return Array.from(t.values()).sort((a,i)=>(a.orderNum??0)-(i.orderNum??0))}async function Jde(e){const t=await nd.requestJson({path:ad,method:"POST",body:e});return Au(t)}async function Qde(e,t){const r=await nd.requestJson({path:`${ad}/${encodeURIComponent(e)}`,method:"PUT",body:t});return Au(r)}async function Zde(e){e.length&&await nd.requestJson({path:ad,method:"DELETE",body:e})}async function efe(e){await Zde([e])}const G5=an({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),K5="/rbac-role-menu";async function tfe(e){await G5.requestJson({path:`${K5}/set`,method:"POST",body:e})}async function rfe(e){await G5.requestJson({path:K5,method:"DELETE",body:e})}const nfe=an({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),afe="/role";async function X5(e,t){return nfe.requestJson({path:afe,method:"GET",query:{SkipCount:e.skipCount,MaxResultCount:e.maxResultCount,RoleName:e.roleName,RoleCode:e.roleCode,State:e.state},signal:t})}const ug=an({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),dg="/rbac-role";async function ife(e){return ug.requestJson({path:dg,method:"POST",body:e})}async function ofe(e,t){return ug.requestJson({path:`${dg}/${encodeURIComponent(e)}`,method:"PUT",body:t})}function sfe(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,o=Array.isArray(i.menuIds)?i.menuIds:Array.isArray(i.MenuIds)?i.MenuIds:void 0;if(o)return o.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 o of a){if(!o||typeof o!="object")continue;const u=o,d=u.menuId??u.MenuId??u.id??u.Id;d&&i.push(String(d))}return i}return[]}async function lfe(e){e.length&&await ug.requestJson({path:dg,method:"DELETE",body:e})}async function cfe(e){await lfe([e])}async function ufe(e,t){const r=await ug.requestJson({path:`${dg}/${encodeURIComponent(e)}`,method:"GET",signal:t});return sfe(r)}const id=an({getToken:()=>{try{return localStorage.getItem("access_token")??localStorage.getItem("token")??null}catch{return null}}}),od="/team-member";function dfe(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 ffe(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,o=n.id??n.Id??n.locationId??n.LocationId,u=a==null?"":String(a).trim(),d=i==null?"":String(i).trim(),c=o==null?"":String(o).trim();u&&d?t.push(`${u} - ${d}`):d?t.push(d):u?t.push(u):c&&t.push(c)}}return t}function fg(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,o=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 S=c;u=S.id??S.Id??S.roleId??S.RoleId??u,d=S.roleName??S.RoleName??S.name??S.Name??S.role??S.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=dfe(m);const x=t.locations??t.Locations??t.assignedLocations??t.AssignedLocations??t.locationNames??t.LocationNames;let y=ffe(x);if(v.length===0&&Array.isArray(x)){const S=[];for(const _ of x){if(typeof _!="object"||!_)continue;const N=_,O=N.id??N.Id??N.locationId??N.LocationId;O!=null&&S.push(String(O))}S.length&&(v=S)}return{id:r,fullName:n,userName:a,email:i,phone:o,roleId:u,roleName:d,locationIds:v,locations:y,state:p??(t.status?String(t.status).toLowerCase()==="active":void 0)}}async function hfe(e,t){const r=await id.requestJson({path:od,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(fg)}}async function pfe(e,t){const r=await id.requestJson({path:`${od}/${encodeURIComponent(e)}`,method:"GET",signal:t});return fg(r)}function Y5(e){if(e==null||e==="")return null;const t=String(e).trim();return t?Number(t.replace(/\D/g,""))||0:null}function mfe(e){const t=e.phone!=null&&e.phone!==""?Y5(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 gfe(e){const t=e.phone!=null&&e.phone!==""?Y5(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 vfe(e){const t=await id.requestJson({path:od,method:"POST",body:mfe(e)});return fg(t)}async function yfe(e,t){const r=await id.requestJson({path:`${od}/${encodeURIComponent(e)}`,method:"PUT",body:gfe(t)});return fg(r)}async function xfe(e){await id.requestJson({path:`${od}/${encodeURIComponent(e)}`,method:"DELETE"})}const J5=[{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"}],bfe=[{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 wfe(){const[e,t]=b.useState("Roles"),[r,n]=b.useState([]),[a,i]=b.useState(0),[o,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),[S,_]=b.useState(""),N=b.useRef(null),[O,A]=b.useState(""),[C,E]=b.useState(J5),[T,R]=b.useState(bfe),[L,z]=b.useState([]),[F,B]=b.useState(!1),[q,H]=b.useState(0),[V,G]=b.useState(0),[U,$]=b.useState(1),[Q,k]=b.useState(10),I=Math.max(1,Math.ceil(q/Q)),D=b.useRef(null),[Z,ie]=b.useState(""),oe=b.useRef(null),[ne,K]=b.useState(""),[J,ee]=b.useState(null),[ce,pe]=b.useState(!1),[W,_e]=b.useState(null),[Ce,qe]=b.useState(!1),[De,nt]=b.useState(null),[kt,Ut]=b.useState(!1),[lr,Rt]=b.useState(null),[Br,ya]=b.useState(!1),[Di,Ka]=b.useState(null),[ld,Mo]=b.useState(!1),[Do,Tl]=b.useState(!1),[Li,xa]=b.useState(!1),mg=()=>{alert(`Exporting ${e} list to PDF...`)};b.useEffect(()=>(N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>A(S.trim()),300),()=>{N.current&&window.clearTimeout(N.current)}),[S]),b.useEffect(()=>(oe.current&&window.clearTimeout(oe.current),oe.current=window.setTimeout(()=>K(Z.trim()),300),()=>{oe.current&&window.clearTimeout(oe.current)}),[Z]),b.useEffect(()=>{p(1)},[O,m]),b.useEffect(()=>{$(1)},[ne,Q]),b.useEffect(()=>e!=="Roles"?void 0:((async()=>{y.current?.abort();const ht=new AbortController;y.current=ht,u(!0);try{const cr=await X5({skipCount:Math.max(1,h),maxResultCount:m,roleName:O||void 0},ht.signal);n(cr.items??[]),i(cr.totalCount??0)}catch(cr){if(cr?.name==="AbortError")return;xe.error("Failed to load roles.",{description:cr?.message?String(cr.message):"Please try again."}),n([]),i(0)}finally{u(!1)}})(),()=>y.current?.abort()),[e,O,h,m,d]),b.useEffect(()=>e!=="Team Member"?void 0:((async()=>{D.current?.abort();const ht=new AbortController;D.current=ht,B(!0);try{const cr=await hfe({skipCount:Math.max(1,U),maxResultCount:Q,keyword:ne||void 0},ht.signal);z(cr.items??[]),H(cr.totalCount??0)}catch(cr){if(cr?.name==="AbortError")return;xe.error("Failed to load team members.",{description:cr?.message?String(cr.message):"Please try again."}),z([]),H(0)}finally{B(!1)}})(),()=>D.current?.abort()),[e,ne,U,Q,V]);const cd=()=>{switch(e){case"Roles":nt(null),qe(!0);break;case"Partner":Mo(!0);break;case"Group":Tl(!0);break;case"Team Member":ee(null),xa(!0);break}},ud=()=>{const we=e==="Team Member";return l.jsxs("div",{className:"flex flex-col gap-4 pb-4",children:[l.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[l.jsx(me,{placeholder:"Search",value:e==="Roles"?S:e==="Team Member"?Z:"",onChange:ht=>{e==="Roles"&&_(ht.target.value),e==="Team Member"&&ie(ht.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"}),l.jsx("div",{className:"flex-1"}),we&&l.jsxs(l.Fragment,{children:[l.jsx(fe,{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"}),l.jsx(fe,{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"})]}),l.jsx(fe,{variant:"outline",onClick:mg,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)"}),l.jsx(fe,{className:"h-10 bg-blue-600 hover:bg-blue-700 text-white rounded-md px-6 font-medium shrink-0",onClick:cd,children:"New+"})]}),l.jsx("div",{className:"w-full border-b border-gray-200",children:l.jsx("div",{className:"flex overflow-x-auto w-fit",children:["Roles","Partner","Group","Team Member"].map(ht=>l.jsx("button",{onClick:()=>t(ht),style:e===ht?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:Ae("px-4 py-2.5 text-sm font-medium whitespace-nowrap cursor-pointer transition-colors -mb-px border-b-2",e===ht?"text-blue-600":"border-b-transparent text-gray-600 hover:text-gray-800"),children:ht},ht))})})]})},gg=()=>{switch(e){case"Roles":return l.jsxs("div",{className:"flex flex-col",children:[l.jsxs(Or,{children:[l.jsx(Er,{children:l.jsxs(Be,{className:"bg-gray-100",children:[l.jsx(ve,{className:"font-bold text-black border-r",children:"Role Name"}),l.jsx(ve,{className:"font-bold text-black border-r",children:"Role Code"}),l.jsx(ve,{className:"font-bold text-black border-r",children:"Status"}),l.jsx(ve,{className:"font-bold text-black border-r",children:"Order"}),l.jsx(ve,{className:"font-bold text-black text-center",children:"Actions"})]})}),l.jsx(Pr,{children:r.length===0?l.jsx(Be,{children:l.jsx(de,{colSpan:5,className:"text-center text-sm text-gray-500 py-10",children:o?"Loading...":"No data"})}):r.map(we=>l.jsxs(Be,{children:[l.jsx(de,{className:"font-medium border-r",children:we.roleName??"N/A"}),l.jsx(de,{className:"border-r text-gray-600",children:we.roleCode??"N/A"}),l.jsx(de,{className:"border-r",children:l.jsx(xr,{className:we.state?"bg-green-600":"bg-gray-400",children:we.state?"Active":"Inactive"})}),l.jsx(de,{className:"border-r text-gray-600",children:we.orderNum??"N/A"}),l.jsxs(de,{className:"text-center",children:[l.jsx(fe,{variant:"ghost",size:"sm",onClick:()=>{Rt(we),Ut(!0)},title:"Menu Permissions",children:l.jsx(m8,{className:"w-4 h-4 text-blue-600"})}),l.jsx(fe,{variant:"ghost",size:"sm",onClick:()=>{nt(we),qe(!0)},children:l.jsx(xn,{className:"w-4 h-4 text-gray-500"})}),l.jsx(fe,{variant:"ghost",size:"sm",onClick:async()=>{Ka(we),ya(!0)},title:"Delete role",children:l.jsx(Hc,{className:"w-4 h-4 text-red-600"})})]})]},we.id))})]}),l.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 bg-white flex flex-wrap items-center justify-between gap-3",children:[l.jsxs("div",{className:"text-sm text-gray-600",children:["Showing ",a===0?0:(h-1)*m+1,"-",Math.min(h*m,a)," of ",a]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs(Ke,{value:String(m),onValueChange:we=>v(Number(we)),children:[l.jsx(Ye,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:l.jsx(Xe,{})}),l.jsx(Je,{children:[10,20,50].map(we=>l.jsxs(Ne,{value:String(we),children:[we," / page"]},we))})]}),l.jsx(_i,{className:"mx-0 w-auto justify-end",children:l.jsxs(Ni,{children:[l.jsx(At,{children:l.jsx(Ci,{href:"#",size:"default",onClick:we=>{we.preventDefault(),p(ht=>Math.max(1,ht-1))},"aria-disabled":h<=1,className:h<=1?"pointer-events-none opacity-50":""})}),l.jsx(At,{children:l.jsxs(ua,{href:"#",isActive:!0,size:"default",onClick:we=>we.preventDefault(),children:["Page ",h," / ",x]})}),l.jsx(At,{children:l.jsx(Oi,{href:"#",size:"default",onClick:we=>{we.preventDefault(),p(ht=>Math.min(x,ht+1))},"aria-disabled":h>=x,className:h>=x?"pointer-events-none opacity-50":""})})]})})]})]})]});case"Partner":return l.jsxs(Or,{children:[l.jsx(Er,{children:l.jsxs(Be,{className:"bg-gray-100",children:[l.jsx(ve,{className:"font-bold text-black border-r",children:"Partner Name"}),l.jsx(ve,{className:"font-bold text-black border-r",children:"Contact"}),l.jsx(ve,{className:"font-bold text-black border-r",children:"Phone"}),l.jsx(ve,{className:"font-bold text-black border-r",children:"Status"}),l.jsx(ve,{className:"font-bold text-black text-center",children:"Actions"})]})}),l.jsx(Pr,{children:C.map(we=>l.jsxs(Be,{children:[l.jsx(de,{className:"font-medium border-r",children:we.name}),l.jsx(de,{className:"border-r",children:we.contact}),l.jsx(de,{className:"border-r text-gray-600",children:we.phone}),l.jsx(de,{className:"border-r",children:l.jsx(xr,{className:we.status==="active"?"bg-green-600":"bg-gray-400",children:we.status})}),l.jsx(de,{className:"text-center",children:l.jsx(fe,{variant:"ghost",size:"sm",children:l.jsx(xn,{className:"w-4 h-4 text-gray-500"})})})]},we.id))})]});case"Group":return l.jsxs(Or,{children:[l.jsx(Er,{children:l.jsxs(Be,{className:"bg-gray-100",children:[l.jsx(ve,{className:"font-bold text-black border-r",children:"Group Name"}),l.jsx(ve,{className:"font-bold text-black border-r",children:"Parent Partner"}),l.jsx(ve,{className:"font-bold text-black border-r",children:"Status"}),l.jsx(ve,{className:"font-bold text-black text-center",children:"Actions"})]})}),l.jsx(Pr,{children:T.map(we=>l.jsxs(Be,{children:[l.jsx(de,{className:"font-medium border-r",children:we.name}),l.jsx(de,{className:"border-r",children:we.partner}),l.jsx(de,{className:"border-r",children:l.jsx(xr,{className:we.status==="active"?"bg-green-600":"bg-gray-400",children:we.status})}),l.jsx(de,{className:"text-center",children:l.jsx(fe,{variant:"ghost",size:"sm",children:l.jsx(xn,{className:"w-4 h-4 text-gray-500"})})})]},we.id))})]});case"Team Member":return l.jsxs(l.Fragment,{children:[l.jsxs(Or,{children:[l.jsx(Er,{children:l.jsxs(Be,{className:"bg-gray-100",children:[l.jsx(ve,{className:"font-bold text-black border-r",children:"Name"}),l.jsx(ve,{className:"font-bold text-black border-r",children:"Email"}),l.jsx(ve,{className:"font-bold text-black border-r",children:"Phone"}),l.jsx(ve,{className:"font-bold text-black border-r",children:"Role"}),l.jsx(ve,{className:"font-bold text-black border-r",children:"Assigned Locations"}),l.jsx(ve,{className:"font-bold text-black border-r",children:"Status"}),l.jsx(ve,{className:"font-bold text-black text-center",children:"Actions"})]})}),l.jsx(Pr,{children:F?l.jsx(Be,{children:l.jsx(de,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):L.length===0?l.jsx(Be,{children:l.jsx(de,{colSpan:7,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):L.map(we=>l.jsxs(Be,{children:[l.jsx(de,{className:"font-medium border-r",children:we.fullName??we.userName??"N/A"}),l.jsx(de,{className:"border-r text-gray-600",children:we.email??"N/A"}),l.jsx(de,{className:"border-r text-gray-600",children:we.phone??"N/A"}),l.jsx(de,{className:"border-r",children:l.jsx(xr,{variant:"outline",className:"font-normal",children:we.roleName??we.roleId??"N/A"})}),l.jsx(de,{className:"border-r",children:l.jsxs("div",{className:"flex flex-col gap-1",children:[(we.locations?.length?we.locations:we.locationIds??[]).map(ht=>l.jsxs("div",{className:"flex items-center gap-1 text-xs text-gray-600",children:[l.jsx(hl,{className:"w-3 h-3"})," ",ht]},ht)),!we.locations?.length&&!(we.locationIds?.length??0)&&l.jsx("div",{className:"text-xs text-gray-500",children:"None"})]})}),l.jsx(de,{className:"border-r",children:l.jsx(xr,{className:we.state?"bg-green-600":"bg-gray-400",children:we.state?"Active":"Inactive"})}),l.jsx(de,{className:"text-center",children:l.jsxs("div",{className:"flex items-center justify-center gap-2",children:[l.jsx(fe,{variant:"ghost",size:"sm",onClick:()=>{ee(we),xa(!0)},title:"Edit",children:l.jsx(xn,{className:"w-4 h-4 text-gray-500"})}),l.jsx(fe,{variant:"ghost",size:"sm",onClick:()=>{_e(we),pe(!0)},title:"Delete",children:l.jsx(Hc,{className:"w-4 h-4 text-red-600"})})]})})]},we.id))})]}),l.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 bg-white flex flex-wrap items-center justify-between gap-3",children:[l.jsxs("div",{className:"text-sm text-gray-600",children:["Showing ",q===0?0:(U-1)*Q+1,"-",Math.min(U*Q,q)," of ",q]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs(Ke,{value:String(Q),onValueChange:we=>k(Number(we)),children:[l.jsx(Ye,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:l.jsx(Xe,{})}),l.jsx(Je,{children:[10,20,50].map(we=>l.jsxs(Ne,{value:String(we),children:[we," / page"]},we))})]}),l.jsx(_i,{className:"mx-0 w-auto justify-end",children:l.jsxs(Ni,{children:[l.jsx(At,{children:l.jsx(Ci,{href:"#",size:"default",onClick:we=>{we.preventDefault(),$(ht=>Math.max(1,ht-1))},"aria-disabled":U<=1,className:U<=1?"pointer-events-none opacity-50":""})}),l.jsx(At,{children:l.jsxs(ua,{href:"#",isActive:!0,size:"default",onClick:we=>we.preventDefault(),children:["Page ",U," / ",I]})}),l.jsx(At,{children:l.jsx(Oi,{href:"#",size:"default",onClick:we=>{we.preventDefault(),$(ht=>Math.min(I,ht+1))},"aria-disabled":U>=I,className:U>=I?"pointer-events-none opacity-50":""})})]})})]})]})]})}};return l.jsxs("div",{className:"h-full flex flex-col",children:[ud(),l.jsx("div",{className:"flex-1 overflow-auto pt-6",children:l.jsx("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md",children:gg()})}),l.jsx(Sfe,{open:Ce,role:De,onOpenChange:we=>{qe(we),we||nt(null)},onSaved:()=>{p(1),c(we=>we+1)}}),l.jsx(jfe,{open:kt,role:lr,onOpenChange:we=>{Ut(we),we||Rt(null)}}),l.jsx(_fe,{open:Br,role:Di,onOpenChange:we=>{ya(we),we||Ka(null)},onDeleted:()=>c(we=>we+1)}),l.jsx(Nfe,{open:ld,onOpenChange:Mo}),l.jsx(Cfe,{open:Do,onOpenChange:Tl}),l.jsx(Ofe,{open:Li,member:J,onOpenChange:we=>{xa(we),we||ee(null)},onSaved:()=>{$(1),G(we=>we+1)}}),l.jsx(Efe,{open:ce,member:W,onOpenChange:we=>{pe(we),we||_e(null)},onDeleted:()=>{G(we=>we+1)}})]})}function Sfe({open:e,role:t,onOpenChange:r,onSaved:n}){const a=!!t?.id,[i,o]=b.useState(!1),[u,d]=b.useState(""),[c,h]=b.useState(""),[p,m]=b.useState(""),[v,x]=b.useState(""),[y,S]=b.useState(!0);b.useEffect(()=>{e&&(o(!1),d(t?.roleName??""),h(t?.roleCode??""),m(t?.remark??""),x(t?.orderNum===null||t?.orderNum===void 0?"":String(t.orderNum)),S(t?.state??!0))},[e,t]);const _=b.useMemo(()=>!!(u.trim()&&c.trim()),[u,c]),N=A=>{const C=A.trim();if(!C)return null;const E=Number.parseInt(C,10);return Number.isFinite(E)?E:null},O=async()=>{if(console.log("submit",t),!_){xe.error("Please fill in required fields.",{description:"Role Name and Role Code are required."});return}o(!0);try{const A={roleName:u.trim(),roleCode:c.trim(),remark:p.trim()?p.trim():null,state:!!y,orderNum:N(v)};a&&t?.id?(await ofe(t.id,A),xe.success("Role updated.",{description:"Role fields have been saved successfully."})):(await ife(A),xe.success("Role created.",{description:"A new role has been created successfully."})),r(!1),n()}catch(A){xe.error(a?"Failed to update role.":"Failed to create role.",{description:A?.message?String(A.message):"Please try again."})}finally{o(!1)}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-[600px]",children:[l.jsxs(gt,{children:[l.jsx(vt,{children:a?"Edit Role":"Create Role"}),l.jsx(Nt,{children:a?"Update role fields and save changes.":"Fill out the form to create a new role."})]}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Role Name *"}),l.jsx(me,{value:u,onChange:A=>d(A.target.value),placeholder:"e.g. Inventory Specialist"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Role Code *"}),l.jsx(me,{value:c,onChange:A=>h(A.target.value),placeholder:"e.g. inventory_specialist"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Remark"}),l.jsx(me,{value:p,onChange:A=>m(A.target.value),placeholder:"Optional"})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Order"}),l.jsx(me,{value:v,onChange:A=>x(A.target.value),placeholder:"e.g. 10"})]}),l.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[l.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),l.jsx(qt,{checked:y,onCheckedChange:S})]})]})]}),l.jsxs(xt,{children:[l.jsx(fe,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{disabled:i,onClick:O,className:"bg-blue-600 text-white hover:bg-blue-700",children:i?"Saving...":"Save"})]})]})})}function jfe({open:e,role:t,onOpenChange:r}){const n=t?.id??"",a=t?.roleName??"",[i,o]=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),[S,_]=b.useState(""),N=b.useRef(null),[O,A]=b.useState("");b.useEffect(()=>(N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>A(S.trim()),300),()=>{N.current&&window.clearTimeout(N.current)}),[S]),b.useEffect(()=>e?(o(!1),m(new Set),h(new Set),(async()=>{y.current?.abort();const G=new AbortController;y.current=G,x(!0);try{const U=await Xde(G.signal);if(d(U??[]),n){const $=await ufe(n,G.signal);m(new Set($))}}catch(U){if(U?.name==="AbortError")return;xe.error("Failed to load menus.",{description:U?.message?String(U.message):"Please try again."}),d([]),m(new Set)}finally{x(!1)}})(),()=>y.current?.abort()):void 0,[e,n]);const C=b.useMemo(()=>{const V=G=>G.reduce((U,$)=>U+1+($.children?V($.children):0),0);return V(u)},[u]),E=b.useMemo(()=>{const V=O.trim().toLowerCase();if(!V)return u;const G=$=>{const Q=($.menuName??"").toLowerCase(),k=($.routeUrl??"").toLowerCase();return Q.includes(V)||k.includes(V)},U=$=>{const Q=[];for(const k of $){const I=k.children?U(k.children):[];(G(k)||I.length)&&Q.push({...k,children:I.length?I:void 0})}return Q};return U(u)},[u,O]);b.useEffect(()=>{if(!O.trim())return;const G=new Set,U=$=>{for(const Q of $)Q.children?.length&&G.add(Q.id),Q.children?.length&&U(Q.children)};U(E),h(G)},[O,E]);const T=V=>{const G=[],U=$=>{$.id&&G.push($.id),$.children?.length&&$.children.forEach(U)};return U(V),G},R=V=>{const G=T(V);if(!G.length)return{checked:!1,indeterminate:!1};let U=0;for(const $ of G)p.has($)&&(U+=1);return U===0?{checked:!1,indeterminate:!1}:U===G.length?{checked:!0,indeterminate:!1}:{checked:!1,indeterminate:!0}},L=(V,G)=>{m(U=>{const $=new Set(U),Q=T(V);return G?Q.forEach(k=>$.add(k)):Q.forEach(k=>$.delete(k)),$})},z=V=>{h(G=>{const U=new Set(G);return U.has(V)?U.delete(V):U.add(V),U})},F=V=>{const G=O.trim(),U=V??"";if(!G)return U||"N/A";const $=U.toLowerCase().indexOf(G.toLowerCase());if($<0)return U||"N/A";const Q=U.slice(0,$),k=U.slice($,$+G.length),I=U.slice($+G.length);return l.jsxs("span",{children:[Q,l.jsx("span",{className:"bg-yellow-200 rounded px-0.5",children:k}),I]})},B=({node:V,depth:G})=>{const U=!!V.children?.length,$=c.has(V.id),{checked:Q,indeterminate:k}=R(V);return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 py-1",style:{paddingLeft:G*16},children:[l.jsx("button",{type:"button",className:Ae("h-6 w-6 flex items-center justify-center rounded hover:bg-gray-100",!U&&"opacity-0 pointer-events-none"),onClick:()=>U&&z(V.id),"aria-label":U?$?"Collapse":"Expand":"No children",children:U?$?l.jsx(Is,{className:"h-4 w-4"}):l.jsx(Ms,{className:"h-4 w-4"}):null}),l.jsx(Eu,{id:`perm-menu-${V.id}`,checked:k?"indeterminate":Q,onCheckedChange:I=>L(V,!!I)}),l.jsx("label",{htmlFor:`perm-menu-${V.id}`,className:"text-sm leading-none cursor-pointer select-none",children:F(V.menuName??V.routeUrl??V.id)})]}),U&&$&&l.jsx("div",{children:V.children.map(I=>l.jsx(B,{node:I,depth:G+1},I.id))})]})},q=async()=>{if(console.log("submit",t),!!n){o(!0);try{await tfe({roleId:n,menuIds:Array.from(p)}),xe.success("Role menu permissions saved.",{description:"Menu permissions have been updated successfully."}),r(!1)}catch(V){xe.error("Failed to save menu permissions.",{description:V?.message?String(V.message):"Please try again."})}finally{o(!1)}}},H=async()=>{if(!(!n||p.size===0)){o(!0);try{await rfe({roleId:n,menuIds:Array.from(p)}),m(new Set),xe.success("Role menu permissions cleared.",{description:"Selected permissions have been removed."})}catch(V){xe.error("Failed to delete menu permissions.",{description:V?.message?String(V.message):"Please try again."})}finally{o(!1)}}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-none",style:{width:"50%"},children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Menu Permissions"}),l.jsx(Nt,{children:a?`Set menu permissions for role: ${a}`:"Set menu permissions for this role."})]}),l.jsx("div",{className:"space-y-4 py-4",children:l.jsxs("div",{className:"rounded border border-gray-200 bg-white",children:[l.jsx("div",{className:"px-3 py-2 text-xs text-gray-500 border-b border-gray-200",children:l.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[l.jsx("div",{children:v?"Loading menus...":`Total ${C} menus`}),l.jsx(me,{value:S,onChange:V=>_(V.target.value),placeholder:"Search menus",className:"h-8 w-44 bg-white"})]})}),l.jsx($s,{className:"h-72",children:l.jsxs("div",{className:"p-3 space-y-2",children:[E.map(V=>l.jsx(B,{node:V,depth:0},V.id)),!v&&E.length===0&&l.jsx("div",{className:"text-sm text-gray-500 py-6 text-center",children:"No menus."})]})})]})}),l.jsxs(xt,{className:"flex flex-row justify-end gap-2",children:[l.jsx(fe,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{variant:"destructive",disabled:i||p.size===0||!n,onClick:H,children:"Delete Selected"}),l.jsx(fe,{disabled:i||!n,onClick:q,className:"bg-blue-600 text-white hover:bg-blue-700",children:i?"Saving...":"Save"})]})]})})}function _fe({open:e,role:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),o=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 cfe(t.id),xe.success("Role deleted.",{description:"The role has been removed successfully."}),r(!1),n()}catch(d){xe.error("Failed to delete role.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-none",style:{width:"30%"},children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Delete Role"}),l.jsx(Nt,{children:"This action cannot be undone."})]}),l.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",l.jsx("span",{className:"font-medium",children:o}),"?"]}),l.jsxs(xt,{className:"flex-row flex-wrap justify-end",children:[l.jsx(fe,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{className:"min-w-24",variant:"destructive",disabled:a,onClick:u,children:a?"Deleting...":"Delete"})]})]})})}function Nfe({open:e,onOpenChange:t}){return l.jsx(mt,{open:e,onOpenChange:t,children:l.jsxs(ft,{children:[l.jsx(gt,{children:l.jsx(vt,{children:"Create New Partner"})}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Partner Name"}),l.jsx(me,{placeholder:"Company Name"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Contact Email"}),l.jsx(me,{placeholder:"admin@partner.com"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Phone Number"}),l.jsx(me,{type:"tel",placeholder:"+1 (555) 000-0000"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(qt,{id:"partner-status",defaultChecked:!0}),l.jsx(ue,{htmlFor:"partner-status",children:"Active"})]})]}),l.jsxs(xt,{children:[l.jsx(fe,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),l.jsx(fe,{onClick:()=>t(!1),className:"bg-blue-600 text-white hover:bg-blue-700",children:"Save Partner"})]})]})})}function Cfe({open:e,onOpenChange:t}){return l.jsx(mt,{open:e,onOpenChange:t,children:l.jsxs(ft,{children:[l.jsx(gt,{children:l.jsx(vt,{children:"Create New Group"})}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Group Name"}),l.jsx(me,{placeholder:"e.g. West Coast Region"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Assign to Partner"}),l.jsxs(Ke,{children:[l.jsx(Ye,{children:l.jsx(Xe,{placeholder:"Select Partner"})}),l.jsx(Je,{children:J5.map(r=>l.jsx(Ne,{value:r.id,children:r.name},r.id))})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(qt,{id:"group-status",defaultChecked:!0}),l.jsx(ue,{htmlFor:"group-status",children:"Active"})]})]}),l.jsxs(xt,{children:[l.jsx(fe,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),l.jsx(fe,{onClick:()=>t(!1),className:"bg-blue-600 text-white hover:bg-blue-700",children:"Save Group"})]})]})})}function Ofe({open:e,member:t,onOpenChange:r,onSaved:n}){const a=!!t?.id,[i,o]=b.useState(!1),[u,d]=b.useState(""),[c,h]=b.useState(""),[p,m]=b.useState(""),[v,x]=b.useState(""),[y,S]=b.useState(""),[_,N]=b.useState(""),[O,A]=b.useState(!0),[C,E]=b.useState(new Set),[T,R]=b.useState([]),[L,z]=b.useState(!1),[F,B]=b.useState([]),[q,H]=b.useState(!1),[V,G]=b.useState(""),U=b.useRef(null),$=()=>{d(""),h(""),m(""),x(""),S(""),N(""),A(!0),E(new Set)},Q=async ne=>{const K=[];let J=1;const ee=100;for(;;){const pe=await X5({skipCount:J,maxResultCount:ee},ne);if(K.push(...pe.items??[]),!pe.items||pe.items.length200))break}const ce=new Map;for(const pe of K)pe.id&&!ce.has(pe.id)&&ce.set(pe.id,pe);return Array.from(ce.values())},k=async ne=>{const K=[];let J=1;const ee=200;for(;;){const pe=await Al({skipCount:J,maxResultCount:ee},ne);if(K.push(...pe.items??[]),!pe.items||pe.items.length200))break}const ce=new Map;for(const pe of K)pe.id&&!ce.has(pe.id)&&ce.set(pe.id,pe);return Array.from(ce.values())};b.useEffect(()=>{if(!e)return;U.current?.abort();const ne=new AbortController;return U.current=ne,o(!1),$(),z(!0),H(!0),(async()=>{try{const[J,ee]=await Promise.all([Q(ne.signal),k(ne.signal)]);if(R(J),B(ee),t?.id){const ce=await pfe(t.id,ne.signal);d(ce.fullName??""),h(ce.userName??""),x(ce.email??""),S(ce.phone!=null?String(ce.phone):"");let pe=(ce.roleId??"").toString().trim();if(!pe&&ce.roleName){const _e=String(ce.roleName).trim().toLowerCase(),Ce=J.find(qe=>{const De=String(qe.roleName??"").trim().toLowerCase(),nt=String(qe.roleCode??"").trim().toLowerCase(),kt=String(qe.id??"").trim().toLowerCase();return De===_e||nt===_e||kt===_e});Ce?.id&&(pe=Ce.id)}N(pe),A(!!ce.state);const W=ce.locationIds&&ce.locationIds.length?ce.locationIds:[];if(W.length)E(new Set(W));else if(ce.locations?.length){const _e=new Set(ce.locations),Ce=new Set;for(const qe of ee){const De=`${(qe.locationCode??"").trim()} - ${(qe.locationName??"").trim()}`.trim(),nt=(qe.locationName??"").trim(),kt=(qe.locationCode??"").trim();(_e.has(De)||_e.has(nt)||_e.has(kt))&&Ce.add(qe.id)}E(Ce)}}}catch(J){J?.name!=="AbortError"&&xe.error("Failed to load user form.",{description:J?.message?String(J.message):"Please try again."})}finally{z(!1),H(!1)}})(),()=>ne.abort()},[e,t?.id]);const I=b.useMemo(()=>!(!u.trim()||!c.trim()||!_.trim()||C.size===0||!a&&!p.trim()),[u,c,_,C,a,p]),D=(ne,K)=>{E(J=>{const ee=new Set(J);return K?ee.add(ne):ee.delete(ne),ee})},Z=async ne=>{if(ne?.preventDefault(),ne?.stopPropagation(),console.log("[MemberDialog] submit called",{isEdit:a,memberId:t?.id,canSubmit:I,roleId:_,fullName:u,userName:c,selectedLocationIds:C.size}),!I){const K=[];u.trim()||K.push("Full Name"),c.trim()||K.push("User Name"),_.trim()||K.push("Role"),C.size===0&&K.push("Locations"),!a&&!p.trim()&&K.push("Password"),xe.error("Missing required fields.",{description:`Please fill: ${K.join("、")}.`});return}if(!a&&!t?.id){o(!0);try{const K=Array.from(C);console.log("[MemberDialog] Creating user",{fullName:u,userName:c,roleId:_,locationIds:K}),await vfe({fullName:u.trim(),userName:c.trim(),password:p.trim(),email:v.trim()?v.trim():null,phone:y!=null&&String(y).trim()?String(y).trim():null,roleId:_.trim(),locationIds:K,state:O}),xe.success("User created.",{description:"A new user has been created successfully."}),r(!1),n()}catch(K){console.error("[MemberDialog] Create error",K),xe.error("Failed to create user.",{description:K?.message?String(K.message):"Please try again."})}finally{o(!1)}}else if(a&&t?.id){o(!0);try{const K=Array.from(C);console.log("[MemberDialog] Updating user",{id:t.id,fullName:u,userName:c,roleId:_,locationIds:K}),await yfe(t.id,{fullName:u.trim(),userName:c.trim(),password:p.trim()?p.trim():null,email:v.trim()?v.trim():null,phone:y!=null&&String(y).trim()?String(y).trim():null,roleId:_.trim(),locationIds:K,state:O}),xe.success("User updated.",{description:"Changes have been saved successfully."}),r(!1),n()}catch(K){console.error("[MemberDialog] Update error",K),xe.error("Failed to update user.",{description:K?.message?String(K.message):"Please try again."})}finally{o(!1)}}else console.error("[MemberDialog] Invalid state",{isEdit:a,memberId:t?.id}),xe.error("Invalid form state.",{description:"Please refresh and try again."})},ie=ne=>{const K=(ne.locationCode??"").trim(),J=(ne.locationName??"").trim();return K&&J?`${K} - ${J}`:J||K||ne.id},oe=b.useMemo(()=>{const ne=V.trim().toLowerCase();return ne?F.filter(K=>ie(K).toLowerCase().includes(ne)):F},[F,V]);return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-none",style:{width:"50%"},children:[l.jsxs(gt,{children:[l.jsx(vt,{children:a?"Edit User":"New User"}),l.jsx(Nt,{children:"Role is single-select; Locations is multi-select."})]}),l.jsxs("div",{className:"space-y-4 py-4 max-h-[70vh] overflow-y-auto pr-1",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Full Name *"}),l.jsx(me,{value:u,onChange:ne=>d(ne.target.value),placeholder:"John Doe"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"User Name *"}),l.jsx(me,{value:c,onChange:ne=>h(ne.target.value),placeholder:"username"})]})]}),!a&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Password *"}),l.jsx(me,{type:"password",value:p,onChange:ne=>m(ne.target.value),placeholder:"Enter password",autoComplete:"new-password",className:"w-full"})]}),a&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Password (Optional)"}),l.jsx(me,{type:"password",value:p,onChange:ne=>m(ne.target.value),placeholder:"Enter new password (optional)",autoComplete:"new-password",className:"w-full"})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Email"}),l.jsx(me,{type:"email",value:v,onChange:ne=>x(ne.target.value),placeholder:"john@example.com"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Phone"}),l.jsx(me,{type:"tel",value:y,onChange:ne=>S(ne.target.value),placeholder:"+1 (555) 000-0000"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Role *"}),l.jsxs(Ke,{value:_||"",onValueChange:ne=>{const K=ne&&ne.trim()?ne.trim():"";console.log("[MemberDialog] Role changed",{old:_,new:K,v:ne}),N(K)},disabled:L,children:[l.jsx(Ye,{className:"h-10 rounded-md border border-gray-200 bg-white",children:l.jsx(Xe,{placeholder:L?"Loading roles...":"Select role"})}),l.jsx(Je,{children:T.map(ne=>l.jsx(Ne,{value:ne.id,children:ne.roleName??ne.roleCode??ne.id},ne.id))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Locations *"}),l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx(me,{value:V,onChange:ne=>G(ne.target.value),placeholder:"Search locations",className:"h-9"}),l.jsxs("div",{className:"text-xs text-gray-500 shrink-0",children:[C.size," selected"]})]}),l.jsx($s,{className:"h-[180px] w-full border rounded-md p-2",children:l.jsx("div",{className:"space-y-2",children:q?l.jsx("div",{className:"text-sm text-gray-500 py-2",children:"Loading..."}):oe.map(ne=>l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Eu,{id:`loc-${ne.id}`,checked:C.has(ne.id),onCheckedChange:K=>D(ne.id,!!K)}),l.jsx("label",{htmlFor:`loc-${ne.id}`,className:"text-sm cursor-pointer w-full hover:bg-gray-50 p-1 rounded",children:ie(ne)})]},ne.id))})}),l.jsx("p",{className:"text-xs text-gray-500",children:"* Users must be assigned to at least one location."})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[l.jsx(qt,{id:"member-status",checked:O,onCheckedChange:A}),l.jsx(ue,{htmlFor:"member-status",children:O?"Active":"Inactive"})]})]}),l.jsxs(xt,{children:[l.jsx(fe,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{disabled:i||!I,onClick:ne=>{ne.preventDefault(),ne.stopPropagation(),Z(ne)},className:"bg-blue-600 text-white hover:bg-blue-700",children:i?"Saving...":a?"Save":"Create"})]})]})})}function Efe({open:e,member:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),o=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 xfe(t.id),xe.success("User deleted.",{description:"The user has been removed successfully."}),r(!1),n()}catch(d){xe.error("Failed to delete user.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-none",style:{width:"30%"},children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Delete User"}),l.jsx(Nt,{children:"This action cannot be undone."})]}),l.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",l.jsx("span",{className:"font-medium",children:o}),"?"]}),l.jsxs(xt,{className:"flex-row flex-wrap justify-end",children:[l.jsx(fe,{variant:"outline",className:"min-w-24",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{variant:"destructive",className:"min-w-24",disabled:a,onClick:u,children:a?"Deleting...":"Delete"})]})]})})}const Pfe=[{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"}],Afe=[{name:"Dairy",count:450},{name:"Meat",count:320},{name:"Bakery",count:280},{name:"Deli",count:190},{name:"Produce",count:150},{name:"Beverage",count:120}],Tfe=[{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 kfe(){const[e,t]=b.useState("print-log"),r=n=>{xe.success(`Reprinting label ${n}`,{description:"Watermark 'RePrint' applied."})};return l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"pb-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[l.jsxs(Ke,{defaultValue:"partner-a",children:[l.jsx(Ye,{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:l.jsx(Xe,{placeholder:"Partner"})}),l.jsx(Je,{children:l.jsx(Ne,{value:"partner-a",children:"Partner A"})})]}),l.jsxs(Ke,{defaultValue:"group-b",children:[l.jsx(Ye,{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:l.jsx(Xe,{placeholder:"Group"})}),l.jsx(Je,{children:l.jsx(Ne,{value:"group-b",children:"Group B"})})]}),l.jsxs(Ke,{defaultValue:"loc-12345",children:[l.jsx(Ye,{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:l.jsx(Xe,{placeholder:"Location"})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"loc-12345",children:"Downtown Store"}),l.jsx(Ne,{value:"all",children:"All Locations"})]})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Period Search:"}),l.jsxs("div",{className:"flex items-center bg-white border border-gray-300 rounded-md h-10 px-2",style:{minHeight:40},children:[l.jsx(_z,{className:"w-4 h-4 text-gray-500 mr-2 shrink-0"}),l.jsx("input",{type:"date",className:"text-sm outline-none w-32 bg-transparent"}),l.jsx("span",{className:"mx-2 text-gray-400",children:"-"}),l.jsx("input",{type:"date",className:"text-sm outline-none w-32 bg-transparent"})]})]}),l.jsxs("div",{className:"flex items-center w-64 rounded-md border border-gray-300 bg-white overflow-hidden shrink-0",style:{height:40},children:[l.jsx(Kp,{className:"h-4 w-4 text-gray-400 shrink-0 ml-3 pointer-events-none"}),l.jsx(me,{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"})]}),l.jsx("div",{className:"flex-1 min-w-2"}),l.jsxs(fe,{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:[l.jsx(CS,{className:"w-4 h-4"})," Export Report"]})]}),l.jsx("div",{className:"w-full border-b border-gray-200 mt-4",children:l.jsxs("div",{className:"flex overflow-x-auto w-fit",children:[l.jsx("button",{onClick:()=>t("print-log"),style:e==="print-log"?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:Ae("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"}),l.jsx("button",{onClick:()=>t("label-report"),style:e==="label-report"?{borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:"#2563eb"}:void 0,className:Ae("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"})]})})]}),l.jsxs("div",{className:"flex-1 overflow-auto pt-6",children:[e==="print-log"&&l.jsx("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden",children:l.jsxs(Or,{children:[l.jsx(Er,{children:l.jsxs(Be,{className:"bg-gray-100 hover:bg-gray-100",children:[l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Label ID"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Product Name"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Category"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Template"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Printed At"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Printed By"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Location"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Expiry Date"}),l.jsx(ve,{className:"text-gray-900 font-bold text-center",children:"Action"})]})}),l.jsx(Pr,{children:Pfe.map(n=>l.jsxs(Be,{children:[l.jsx(de,{className:"border-r font-numeric text-gray-600",children:n.id}),l.jsx(de,{className:"border-r font-medium",children:n.productName}),l.jsx(de,{className:"border-r",children:l.jsx(xr,{variant:"secondary",className:"bg-blue-50 text-blue-700 hover:bg-blue-50 border-blue-200",children:n.category})}),l.jsx(de,{className:"border-r text-gray-600 text-sm",children:(()=>{const a=n.template.endsWith(" !!!"),i=a?n.template.slice(0,-4):n.template,o=i.lastIndexOf(" "),u=i.slice(0,o+1),d=i.slice(o+1);return l.jsxs(l.Fragment,{children:[u,l.jsx("span",{className:"font-bold text-gray-900",children:d}),a&&l.jsx("span",{className:"text-red-600",children:" !!!"})]})})()}),l.jsx(de,{className:"border-r text-gray-600 text-sm font-numeric",children:n.printedAt}),l.jsx(de,{className:"border-r text-gray-600 text-sm",children:n.printedBy}),l.jsx(de,{className:"border-r text-gray-600 text-sm font-numeric",children:n.location}),l.jsx(de,{className:"border-r",children:l.jsx("span",{className:Ae("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})}),l.jsx(de,{className:"text-center",children:l.jsxs(fe,{size:"sm",variant:"outline",className:"h-8 gap-1 hover:bg-gray-100 border-gray-300",onClick:()=>r(n.id),children:[l.jsx(nM,{className:"w-3 h-3"})," Reprint"]})})]},n.id))})]})}),e==="label-report"&&l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[l.jsxs(Xr,{children:[l.jsxs(Ln,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx($n,{className:"text-sm font-medium",children:"Total Labels Printed"}),l.jsx(Ds,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(vn,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"2,543"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"+20.1% from last month"})]})]}),l.jsxs(Xr,{children:[l.jsxs(Ln,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx($n,{className:"text-sm font-medium",children:"Most Printed Category"}),l.jsx(Cz,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(vn,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"Dairy"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"450 labels generated"})]})]}),l.jsxs(Xr,{children:[l.jsxs(Ln,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx($n,{className:"text-sm font-medium",children:"Top Product"}),l.jsx(YI,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(vn,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"Whole Milk"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"182 labels generated"})]})]}),l.jsxs(Xr,{children:[l.jsxs(Ln,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx($n,{className:"text-sm font-medium",children:"Avg. Daily Prints"}),l.jsx(c8,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(vn,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"85"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"+12% from last week"})]})]})]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsxs(Xr,{className:"col-span-1",children:[l.jsxs(Ln,{children:[l.jsx($n,{children:"Labels by Category"}),l.jsx(Dh,{children:"Distribution of printed labels across product categories."})]}),l.jsx(vn,{className:"h-[300px]",children:l.jsx(Kh,{width:"100%",height:"100%",children:l.jsxs(dae,{data:Afe,children:[l.jsx(Ip,{strokeDasharray:"3 3",vertical:!1}),l.jsx(bo,{dataKey:"name",fontSize:12,tickLine:!1,axisLine:!1}),l.jsx(wo,{fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:n=>`${n}`}),l.jsx(Yr,{}),l.jsx(Io,{dataKey:"count",fill:"#facc15",radius:[4,4,0,0]})]})})})]}),l.jsxs(Xr,{className:"col-span-1",children:[l.jsxs(Ln,{children:[l.jsx($n,{children:"Print Volume Trends"}),l.jsx(Dh,{children:"Daily label printing volume for the last 7 days."})]}),l.jsx(vn,{className:"h-[300px]",children:l.jsx(Kh,{width:"100%",height:"100%",children:l.jsxs(s4,{data:Tfe,children:[l.jsx(Ip,{strokeDasharray:"3 3",vertical:!1}),l.jsx(bo,{dataKey:"date",fontSize:12,tickLine:!1,axisLine:!1}),l.jsx(wo,{fontSize:12,tickLine:!1,axisLine:!1}),l.jsx(Yr,{}),l.jsx(_l,{type:"monotone",dataKey:"count",stroke:"#dc2626",strokeWidth:2,dot:{r:4},activeDot:{r:6}})]})})})]})]}),l.jsxs(Xr,{children:[l.jsx(Ln,{children:l.jsx($n,{children:"Most Used Products"})}),l.jsx(vn,{children:l.jsxs(Or,{children:[l.jsx(Er,{children:l.jsxs(Be,{children:[l.jsx(ve,{children:"Product Name"}),l.jsx(ve,{children:"Category"}),l.jsx(ve,{className:"text-right",children:"Total Printed"}),l.jsx(ve,{className:"text-right",children:"Usage %"})]})}),l.jsxs(Pr,{children:[l.jsxs(Be,{children:[l.jsx(de,{className:"font-medium",children:"Whole Milk"}),l.jsx(de,{children:"Dairy"}),l.jsx(de,{className:"text-right",children:"182"}),l.jsx(de,{className:"text-right",children:"7.2%"})]}),l.jsxs(Be,{children:[l.jsx(de,{className:"font-medium",children:"Ground Beef 80/20"}),l.jsx(de,{children:"Meat"}),l.jsx(de,{className:"text-right",children:"145"}),l.jsx(de,{className:"text-right",children:"5.7%"})]}),l.jsxs(Be,{children:[l.jsx(de,{className:"font-medium",children:"Chicken Breast"}),l.jsx(de,{children:"Meat"}),l.jsx(de,{className:"text-right",children:"132"}),l.jsx(de,{className:"text-right",children:"5.2%"})]}),l.jsxs(Be,{children:[l.jsx(de,{className:"font-medium",children:"Sliced Ham"}),l.jsx(de,{children:"Deli"}),l.jsx(de,{className:"text-right",children:"98"}),l.jsx(de,{className:"text-right",children:"3.8%"})]})]})]})})]})]})]})]})}var Rfe=Symbol("radix.slottable");function Ife(e){const t=({children:r})=>l.jsx(l.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Rfe,t}var[hg]=Ua("Tooltip",[Ol]),pg=Ol(),Q5="TooltipProvider",Mfe=700,jS="tooltip.open",[Dfe,c_]=hg(Q5),Z5=e=>{const{__scopeTooltip:t,delayDuration:r=Mfe,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:i}=e,o=b.useRef(!0),u=b.useRef(!1),d=b.useRef(0);return b.useEffect(()=>{const c=d.current;return()=>window.clearTimeout(c)},[]),l.jsx(Dfe,{scope:t,isOpenDelayedRef:o,delayDuration:r,onOpen:b.useCallback(()=>{window.clearTimeout(d.current),o.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>o.current=!0,n)},[n]),isPointerInTransitRef:u,onPointerInTransitChange:b.useCallback(c=>{u.current=c},[]),disableHoverableContent:a,children:i})};Z5.displayName=Q5;var Tu="Tooltip",[Lfe,sd]=hg(Tu),eB=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:a,onOpenChange:i,disableHoverableContent:o,delayDuration:u}=e,d=c_(Tu,e.__scopeTooltip),c=pg(t),[h,p]=b.useState(null),m=Lr(),v=b.useRef(0),x=o??d.disableHoverableContent,y=u??d.delayDuration,S=b.useRef(!1),[_,N]=jo({prop:n,defaultProp:a??!1,onChange:T=>{T?(d.onOpen(),document.dispatchEvent(new CustomEvent(jS))):d.onClose(),i?.(T)},caller:Tu}),O=b.useMemo(()=>_?S.current?"delayed-open":"instant-open":"closed",[_]),A=b.useCallback(()=>{window.clearTimeout(v.current),v.current=0,S.current=!1,N(!0)},[N]),C=b.useCallback(()=>{window.clearTimeout(v.current),v.current=0,N(!1)},[N]),E=b.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{S.current=!0,N(!0),v.current=0},y)},[y,N]);return b.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),l.jsx(Xj,{...c,children:l.jsx(Lfe,{scope:t,contentId:m,open:_,stateAttribute:O,trigger:h,onTriggerChange:p,onTriggerEnter:b.useCallback(()=>{d.isOpenDelayedRef.current?E():A()},[d.isOpenDelayedRef,E,A]),onTriggerLeave:b.useCallback(()=>{x?C():(window.clearTimeout(v.current),v.current=0)},[C,x]),onOpen:A,onClose:C,disableHoverableContent:x,children:r})})};eB.displayName=Tu;var _S="TooltipTrigger",tB=b.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=sd(_S,r),i=c_(_S,r),o=pg(r),u=b.useRef(null),d=at(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]),l.jsx(Bm,{asChild:!0,...o,children:l.jsx(We.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:d,onPointerMove:Ge(e.onPointerMove,m=>{m.pointerType!=="touch"&&!h.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),h.current=!0)}),onPointerLeave:Ge(e.onPointerLeave,()=>{a.onTriggerLeave(),h.current=!1}),onPointerDown:Ge(e.onPointerDown,()=>{a.open&&a.onClose(),c.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Ge(e.onFocus,()=>{c.current||a.onOpen()}),onBlur:Ge(e.onBlur,a.onClose),onClick:Ge(e.onClick,a.onClose)})})});tB.displayName=_S;var u_="TooltipPortal",[$fe,Bfe]=hg(u_,{forceMount:void 0}),rB=e=>{const{__scopeTooltip:t,forceMount:r,children:n,container:a}=e,i=sd(u_,t);return l.jsx($fe,{scope:t,forceMount:r,children:l.jsx(nn,{present:r||i.open,children:l.jsx(Vu,{asChild:!0,container:a,children:n})})})};rB.displayName=u_;var fl="TooltipContent",nB=b.forwardRef((e,t)=>{const r=Bfe(fl,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...i}=e,o=sd(fl,e.__scopeTooltip);return l.jsx(nn,{present:n||o.open,children:o.disableHoverableContent?l.jsx(aB,{side:a,...i,ref:t}):l.jsx(Ffe,{side:a,...i,ref:t})})}),Ffe=b.forwardRef((e,t)=>{const r=sd(fl,e.__scopeTooltip),n=c_(fl,e.__scopeTooltip),a=b.useRef(null),i=at(t,a),[o,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 S=x.currentTarget,_={x:x.clientX,y:x.clientY},N=Vfe(_,S.getBoundingClientRect()),O=Hfe(_,N),A=Wfe(y.getBoundingClientRect()),C=Kfe([...O,...A]);u(C),p(!0)},[p]);return b.useEffect(()=>()=>m(),[m]),b.useEffect(()=>{if(d&&h){const x=S=>v(S,h),y=S=>v(S,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(o){const x=y=>{const S=y.target,_={x:y.clientX,y:y.clientY},N=d?.contains(S)||h?.contains(S),O=!Gfe(_,o);N?m():O&&(m(),c())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[d,h,o,c,m]),l.jsx(aB,{...e,ref:i})}),[zfe,qfe]=hg(Tu,{isInside:!1}),Ufe=Ife("TooltipContent"),aB=b.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:o,...u}=e,d=sd(fl,r),c=pg(r),{onClose:h}=d;return b.useEffect(()=>(document.addEventListener(jS,h),()=>document.removeEventListener(jS,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]),l.jsx(qu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:p=>p.preventDefault(),onDismiss:h,children:l.jsxs(Yj,{"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:[l.jsx(Ufe,{children:n}),l.jsx(zfe,{scope:r,isInside:!0,children:l.jsx(goe,{id:d.contentId,role:"tooltip",children:a||n})})]})})});nB.displayName=fl;var iB="TooltipArrow",oB=b.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=pg(r);return qfe(iB,r).isInside?null:l.jsx(Jj,{...a,...n,ref:t})});oB.displayName=iB;function Vfe(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 Hfe(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 Wfe(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 Gfe(e,t){const{x:r,y:n}=e;let a=!1;for(let i=0,o=t.length-1;in!=m>n&&r<(p-c)*(n-h)/(m-h)+c&&(a=!a)}return a}function Kfe(e){const t=e.slice();return t.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),Xfe(t)}function Xfe(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(a.y-o.y)>=(i.y-o.y)*(a.x-o.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],o=r[r.length-2];if((i.x-o.x)*(a.y-o.y)>=(i.y-o.y)*(a.x-o.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 Yfe=Z5,Jfe=eB,Qfe=tB,Zfe=rB,ehe=nB,the=oB;function rhe({delayDuration:e=0,...t}){return l.jsx(Yfe,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function T1({...e}){return l.jsx(rhe,{children:l.jsx(Jfe,{"data-slot":"tooltip",...e})})}function k1({...e}){return l.jsx(Qfe,{"data-slot":"tooltip-trigger",...e})}function R1({className:e,sideOffset:t=0,children:r,...n}){return l.jsx(Zfe,{children:l.jsxs(ehe,{"data-slot":"tooltip-content",sideOffset:t,className:Ae("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,l.jsx(the,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function Mn(e){const t=(e??"").trim();return t||"N/A"}function nhe(e,t){return e==null||t===null||t===void 0||!Number.isFinite(e)||!Number.isFinite(t)?"N/A":`${e}, ${t}`}function ahe(){const[e,t]=b.useState(!1),[r,n]=b.useState(!1),[a,i]=b.useState(!1),[o,u]=b.useState(null),[d,c]=b.useState(null),[h,p]=b.useState([]),[m,v]=b.useState(!1),[x,y]=b.useState(0),[S,_]=b.useState(0),[N,O]=b.useState(null),[A,C]=b.useState(""),[E,T]=b.useState("all"),[R,L]=b.useState("all"),[z,F]=b.useState("all"),[B,q]=b.useState(1),[H,V]=b.useState(10),G=b.useRef(null),U=b.useRef(null),[$,Q]=b.useState("");b.useEffect(()=>(U.current&&window.clearTimeout(U.current),U.current=window.setTimeout(()=>Q(A.trim()),300),()=>{U.current&&window.clearTimeout(U.current)}),[A]);const k=b.useMemo(()=>{const K=new Set;for(const J of h){const ee=(J.partner??"").trim();ee&&K.add(ee)}return["all",...Array.from(K).sort((J,ee)=>J.localeCompare(ee))]},[h]),I=b.useMemo(()=>{const K=new Set;for(const J of h){const ee=(J.groupName??"").trim();ee&&K.add(ee)}return["all",...Array.from(K).sort((J,ee)=>J.localeCompare(ee))]},[h]),D=b.useMemo(()=>{const K=new Set;for(const J of h){const ee=(J.locationCode??"").trim();ee&&K.add(ee)}return["all",...Array.from(K).sort((J,ee)=>J.localeCompare(ee))]},[h]),Z=Math.max(1,Math.ceil(x/H));b.useEffect(()=>{q(1)},[$,E,R,z,H]),b.useEffect(()=>((async()=>{G.current?.abort();const J=new AbortController;G.current=J,v(!0);try{const ee=Math.max(1,B),pe=await Al({skipCount:ee,maxResultCount:H,keyword:(z!=="all"?z:$)||void 0,partner:E!=="all"?E:void 0,groupName:R!=="all"?R:void 0},J.signal);p(pe.items??[]),y(pe.totalCount??0)}catch(ee){if(ee?.name==="AbortError")return;xe.error("Failed to load locations.",{description:ee?.message?String(ee.message):"Please try again."}),p([]),y(0)}finally{v(!1)}})(),()=>G.current?.abort()),[$,E,R,z,B,H,S]);const ie=()=>_(K=>K+1),oe=K=>{O(null),u(K),n(!0)},ne=K=>{O(null),c(K),i(!0)};return l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsx("div",{className:"pb-4",children:l.jsx("div",{className:"flex flex-col gap-4",children:l.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[l.jsx(me,{placeholder:"Search",value:A,onChange:K=>C(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"}),l.jsxs(Ke,{value:E,onValueChange:T,children:[l.jsx(Ye,{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:l.jsx(Xe,{placeholder:"Partner"})}),l.jsx(Je,{children:k.map(K=>l.jsx(Ne,{value:K,children:K==="all"?"Partner (All)":K},K))})]}),l.jsxs(Ke,{value:R,onValueChange:L,children:[l.jsx(Ye,{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:l.jsx(Xe,{placeholder:"Group"})}),l.jsx(Je,{children:I.map(K=>l.jsx(Ne,{value:K,children:K==="all"?"Group (All)":K},K))})]}),l.jsxs(Ke,{value:z,onValueChange:F,children:[l.jsx(Ye,{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:l.jsx(Xe,{placeholder:"Location"})}),l.jsx(Je,{children:D.map(K=>l.jsx(Ne,{value:K,children:K==="all"?"All Locations":K},K))})]}),l.jsx("div",{className:"flex-1"}),l.jsxs(T1,{children:[l.jsx(k1,{asChild:!0,children:l.jsx("span",{children:l.jsx(fe,{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"})})}),l.jsx(R1,{children:"Not supported yet"})]}),l.jsxs(T1,{children:[l.jsx(k1,{asChild:!0,children:l.jsx("span",{children:l.jsx(fe,{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"})})}),l.jsx(R1,{children:"Not supported yet"})]}),l.jsxs(T1,{children:[l.jsx(k1,{asChild:!0,children:l.jsx("span",{children:l.jsx(fe,{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"})})}),l.jsx(R1,{children:"Not supported yet"})]}),l.jsx(fe,{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"})]})})}),l.jsx("div",{className:"flex-1 overflow-auto pt-6",children:l.jsx("div",{className:"bg-white border border-gray-200 shadow-sm rounded-md overflow-hidden",children:l.jsxs(Or,{children:[l.jsx(Er,{children:l.jsxs(Be,{className:"bg-gray-100 hover:bg-gray-100",children:[l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Partner"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Group"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Location ID"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Location Name"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Street"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"City"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"State"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Country"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Zip Code"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Phone"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Email"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"GPS"}),l.jsx(ve,{className:"text-gray-900 font-bold border-r",children:"Active"}),l.jsx(ve,{className:"text-gray-900 font-bold text-center",children:"Actions"})]})}),l.jsx(Pr,{children:m?l.jsx(Be,{children:l.jsx(de,{colSpan:14,className:"text-center text-sm text-gray-500 py-10",children:"Loading..."})}):h.length===0?l.jsx(Be,{children:l.jsx(de,{colSpan:14,className:"text-center text-sm text-gray-500 py-10",children:"No results."})}):h.map(K=>l.jsxs(Be,{children:[l.jsx(de,{className:"border-r text-gray-600 max-w-[140px] truncate",children:Mn(K.partner)}),l.jsx(de,{className:"border-r text-gray-600 max-w-[140px] truncate",children:Mn(K.groupName)}),l.jsx(de,{className:"border-r font-numeric text-gray-600",children:Mn(K.locationCode??K.id)}),l.jsx(de,{className:"border-r font-medium text-black",children:Mn(K.locationName)}),l.jsx(de,{className:"border-r text-gray-600 max-w-[140px] truncate",children:Mn(K.street)}),l.jsx(de,{className:"border-r text-gray-600",children:Mn(K.city)}),l.jsx(de,{className:"border-r text-gray-600",children:Mn(K.stateCode)}),l.jsx(de,{className:"border-r text-gray-600",children:Mn(K.country)}),l.jsx(de,{className:"border-r text-gray-600 font-numeric",children:Mn(K.zipCode)}),l.jsx(de,{className:"border-r text-gray-600 whitespace-nowrap",children:Mn(K.phone)}),l.jsx(de,{className:"border-r text-gray-600 text-sm max-w-[180px] truncate",children:Mn(K.email)}),l.jsx(de,{className:"border-r text-gray-500 font-numeric text-xs",children:nhe(K.latitude,K.longitude)}),l.jsx(de,{className:"border-r",children:l.jsx(xr,{className:K.state?"bg-green-600":"bg-gray-400",children:K.state?"Yes":"No"})}),l.jsx(de,{className:"text-center",children:l.jsxs(ma,{open:N===K.id,onOpenChange:J=>O(J?K.id:null),children:[l.jsx(ga,{asChild:!0,children:l.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:l.jsx(Ei,{className:"h-4 w-4 text-gray-500"})})}),l.jsxs(va,{align:"end",className:"w-40 p-1",children:[l.jsxs(fe,{type:"button",variant:"ghost",className:"w-full justify-start gap-2 h-9 px-2 font-normal",onClick:()=>oe(K),children:[l.jsx(xn,{className:"w-4 h-4"}),"Edit"]}),l.jsx(fe,{type:"button",variant:"ghost",className:"w-full justify-start h-9 px-2 font-normal text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>ne(K),children:"Delete"})]})]})})]},K.id))})]})})}),l.jsx("div",{className:"pt-4",children:l.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[l.jsxs("div",{children:["Showing ",x===0?0:(B-1)*H+1,"-",Math.min(B*H,x)," of ",x]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs(Ke,{value:String(H),onValueChange:K=>V(Number(K)),children:[l.jsx(Ye,{className:"w-[110px] h-9 rounded-md border border-gray-300 bg-white text-gray-900",children:l.jsx(Xe,{})}),l.jsx(Je,{children:[10,20,50].map(K=>l.jsxs(Ne,{value:String(K),children:[K," / page"]},K))})]}),l.jsx(_i,{className:"mx-0 w-auto justify-end",children:l.jsxs(Ni,{children:[l.jsx(At,{children:l.jsx(Ci,{href:"#",size:"default",onClick:K=>{K.preventDefault(),q(J=>Math.max(1,J-1))},"aria-disabled":B<=1,className:B<=1?"pointer-events-none opacity-50":""})}),l.jsx(At,{children:l.jsxs(ua,{href:"#",isActive:!0,size:"default",onClick:K=>K.preventDefault(),children:["Page ",B," / ",Z]})}),l.jsx(At,{children:l.jsx(Oi,{href:"#",size:"default",onClick:K=>{K.preventDefault(),q(J=>Math.min(Z,J+1))},"aria-disabled":B>=Z,className:B>=Z?"pointer-events-none opacity-50":""})})]})})]})]})}),l.jsx(ihe,{open:e,onOpenChange:t,onCreated:()=>{q(1),ie()}}),l.jsx(she,{open:r,location:o,onOpenChange:K=>{n(K),K||u(null)},onUpdated:()=>{ie()}}),l.jsx(lhe,{open:a,location:d,onOpenChange:K=>{i(K),K||c(null)},onDeleted:()=>{ie()}})]})}function ihe({open:e,onOpenChange:t,onCreated:r}){const[n,a]=b.useState(!1),[i,o]=b.useState({partner:"",groupName:"",locationCode:"",locationName:"",street:"",city:"",stateCode:"",country:"",zipCode:"",phone:"",email:"",latitude:null,longitude:null,state:!0}),u=()=>{o({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=b.useMemo(()=>i.locationCode.trim().length>0&&i.locationName.trim().length>0,[i.locationCode,i.locationName]),c=async()=>{if(!d){xe.error("Please fill in required fields.",{description:"Location ID and Location Name are required."});return}a(!0);try{await Nce({...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()?i.street.trim():null,city:i.city?.trim()?i.city.trim():null,stateCode:i.stateCode?.trim()?i.stateCode.trim():null,country:i.country?.trim()?i.country.trim():null,zipCode:i.zipCode?.trim()?i.zipCode.trim():null,phone:i.phone?.trim()?i.phone.trim():null,email:i.email?.trim()?i.email.trim():null}),xe.success("Location created.",{description:"The location has been added successfully."}),t(!1),r()}catch(h){xe.error("Failed to create location.",{description:h?.message?String(h.message):"Please try again."})}finally{a(!1)}};return l.jsx(mt,{open:e,onOpenChange:t,children:l.jsxs(ft,{className:"sm:max-w-[600px]",children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Add New Location"}),l.jsx(Nt,{children:"Enter the details for the new store location."})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Partner"}),l.jsx(me,{placeholder:"e.g. Global Foods Inc.",value:i.partner??"",onChange:h=>o(p=>({...p,partner:h.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Group"}),l.jsx(me,{placeholder:"e.g. East Coast Region",value:i.groupName??"",onChange:h=>o(p=>({...p,groupName:h.target.value}))})]})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[l.jsxs("div",{className:"space-y-2 col-span-1",children:[l.jsx(ue,{children:"Location ID"}),l.jsx(me,{placeholder:"e.g. 12345",value:i.locationCode,onChange:h=>o(p=>({...p,locationCode:h.target.value}))})]}),l.jsxs("div",{className:"space-y-2 col-span-2",children:[l.jsx(ue,{children:"Location Name"}),l.jsx(me,{placeholder:"e.g. Downtown Store",value:i.locationName,onChange:h=>o(p=>({...p,locationName:h.target.value}))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Street"}),l.jsx(me,{placeholder:"e.g. 123 Main St",value:i.street??"",onChange:h=>o(p=>({...p,street:h.target.value}))})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"City"}),l.jsx(me,{placeholder:"e.g. New York",value:i.city??"",onChange:h=>o(p=>({...p,city:h.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"State"}),l.jsx(me,{placeholder:"e.g. NY",value:i.stateCode??"",onChange:h=>o(p=>({...p,stateCode:h.target.value}))})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Country"}),l.jsx(me,{placeholder:"e.g. USA",value:i.country??"",onChange:h=>o(p=>({...p,country:h.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Zip Code"}),l.jsx(me,{placeholder:"e.g. 10001",value:i.zipCode??"",onChange:h=>o(p=>({...p,zipCode:h.target.value}))})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Phone Number"}),l.jsx(me,{placeholder:"+1 (555) 000-0000",value:i.phone??"",onChange:h=>o(p=>({...p,phone:h.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Email"}),l.jsx(me,{placeholder:"store@example.com",value:i.email??"",onChange:h=>o(p=>({...p,email:h.target.value}))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(ue,{className:"flex items-center gap-2",children:[l.jsx(hl,{className:"w-4 h-4"})," GPS Coordinates"]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsx(me,{placeholder:"Latitude (e.g. 40.7128)",value:i.latitude===null||i.latitude===void 0?"":String(i.latitude),onChange:h=>{const p=h.target.value.trim();o(m=>({...m,latitude:p?Number(p):null}))}}),l.jsx(me,{placeholder:"Longitude (e.g. -74.0060)",value:i.longitude===null||i.longitude===void 0?"":String(i.longitude),onChange:h=>{const p=h.target.value.trim();o(m=>({...m,longitude:p?Number(p):null}))}})]})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[l.jsx(qt,{id:"loc-status",checked:!!i.state,onCheckedChange:h=>o(p=>({...p,state:h}))}),l.jsx(ue,{htmlFor:"loc-status",children:"Active Location"})]})]}),l.jsxs(xt,{children:[l.jsx(fe,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),l.jsx(fe,{disabled:n,onClick:c,className:"bg-blue-600 text-white hover:bg-blue-700",children:n?"Creating...":"Create Location"})]})]})})}function ohe(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 she({open:e,location:t,onOpenChange:r,onUpdated:n}){const[a,i]=b.useState(!1),[o,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(ohe(t)),i(!1)),e||i(!1)},[e,t]);const d=b.useMemo(()=>o.locationCode.trim().length>0&&o.locationName.trim().length>0,[o.locationCode,o.locationName]),c=async()=>{if(t?.id){if(!d){xe.error("Please fill in required fields.",{description:"Location ID and Location Name are required."});return}i(!0);try{await Cce(t.id,{...o,locationCode:o.locationCode.trim(),locationName:o.locationName.trim(),partner:o.partner?.trim()?o.partner.trim():null,groupName:o.groupName?.trim()?o.groupName.trim():null,street:o.street?.trim()?o.street.trim():null,city:o.city?.trim()?o.city.trim():null,stateCode:o.stateCode?.trim()?o.stateCode.trim():null,country:o.country?.trim()?o.country.trim():null,zipCode:o.zipCode?.trim()?o.zipCode.trim():null,phone:o.phone?.trim()?o.phone.trim():null,email:o.email?.trim()?o.email.trim():null}),xe.success("Location updated.",{description:"The changes have been saved successfully."}),r(!1),n()}catch(h){xe.error("Failed to update location.",{description:h?.message?String(h.message):"Please try again."})}finally{i(!1)}}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-[600px]",children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Edit Location"}),l.jsx(Nt,{children:"Update the details for this store location."})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Partner"}),l.jsx(me,{placeholder:"e.g. Global Foods Inc.",value:o.partner??"",onChange:h=>u(p=>({...p,partner:h.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Group"}),l.jsx(me,{placeholder:"e.g. East Coast Region",value:o.groupName??"",onChange:h=>u(p=>({...p,groupName:h.target.value}))})]})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[l.jsxs("div",{className:"space-y-2 col-span-1",children:[l.jsx(ue,{children:"Location ID"}),l.jsx(me,{placeholder:"e.g. 12345",value:o.locationCode,onChange:h=>u(p=>({...p,locationCode:h.target.value}))})]}),l.jsxs("div",{className:"space-y-2 col-span-2",children:[l.jsx(ue,{children:"Location Name"}),l.jsx(me,{placeholder:"e.g. Downtown Store",value:o.locationName,onChange:h=>u(p=>({...p,locationName:h.target.value}))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Street"}),l.jsx(me,{placeholder:"e.g. 123 Main St",value:o.street??"",onChange:h=>u(p=>({...p,street:h.target.value}))})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"City"}),l.jsx(me,{placeholder:"e.g. New York",value:o.city??"",onChange:h=>u(p=>({...p,city:h.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"State"}),l.jsx(me,{placeholder:"e.g. NY",value:o.stateCode??"",onChange:h=>u(p=>({...p,stateCode:h.target.value}))})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Country"}),l.jsx(me,{placeholder:"e.g. USA",value:o.country??"",onChange:h=>u(p=>({...p,country:h.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Zip Code"}),l.jsx(me,{placeholder:"e.g. 10001",value:o.zipCode??"",onChange:h=>u(p=>({...p,zipCode:h.target.value}))})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Phone Number"}),l.jsx(me,{placeholder:"+1 (555) 000-0000",value:o.phone??"",onChange:h=>u(p=>({...p,phone:h.target.value}))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Email"}),l.jsx(me,{placeholder:"store@example.com",value:o.email??"",onChange:h=>u(p=>({...p,email:h.target.value}))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(ue,{className:"flex items-center gap-2",children:[l.jsx(hl,{className:"w-4 h-4"})," GPS Coordinates"]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsx(me,{placeholder:"Latitude (e.g. 40.7128)",value:o.latitude===null||o.latitude===void 0?"":String(o.latitude),onChange:h=>{const p=h.target.value.trim();u(m=>({...m,latitude:p?Number(p):null}))}}),l.jsx(me,{placeholder:"Longitude (e.g. -74.0060)",value:o.longitude===null||o.longitude===void 0?"":String(o.longitude),onChange:h=>{const p=h.target.value.trim();u(m=>({...m,longitude:p?Number(p):null}))}})]})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[l.jsx(qt,{id:"loc-status-edit",checked:!!o.state,onCheckedChange:h=>u(p=>({...p,state:h}))}),l.jsx(ue,{htmlFor:"loc-status-edit",children:"Active Location"})]})]}),l.jsxs(xt,{children:[l.jsx(fe,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{disabled:a,onClick:c,className:"bg-blue-600 text-white hover:bg-blue-700",children:a?"Saving...":"Save Changes"})]})]})})}function lhe({open:e,location:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),o=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 Oce(t.id),xe.success("Location deleted.",{description:"The location has been removed successfully."}),r(!1),n()}catch(d){xe.error("Failed to delete location.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-none",style:{width:"30%"},children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Delete Location"}),l.jsx(Nt,{children:"This action cannot be undone."})]}),l.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",l.jsx("span",{className:"font-medium",children:o}),"?"]}),l.jsxs(xt,{className:"flex-row flex-wrap justify-end",children:[l.jsx(fe,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{className:"min-w-24",variant:"destructive",disabled:a,onClick:u,children:a?"Deleting...":"Delete"})]})]})})}function che({className:e,...t}){return l.jsx("textarea",{"data-slot":"textarea",className:Ae("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 WI={Settings:Ah,LayoutDashboard:rM,Tag:Th,MapPin:hl,Users:OS,Package:Vc,FileText:Ds,HelpCircle:Ph,Layers:tM,Type:aM,FileBox:eM};function I1(e){const t=(e??"").trim();return t||"N/A"}function uhe(e){const t=e.trim();if(!t)return null;const r=Number.parseInt(t,10);return Number.isFinite(r)?r:null}function dhe(){const[e,t]=b.useState([]),[r,n]=b.useState(!1),[a,i]=b.useState(0),[o,u]=b.useState(null),[d,c]=b.useState(""),h=b.useRef(null),[p,m]=b.useState(""),[v,x]=b.useState(!1),[y,S]=b.useState(!1),[_,N]=b.useState(!1),[O,A]=b.useState(null),[C,E]=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 B=new AbortController;T.current=B,n(!0);try{const q=await W5({skipCount:1,maxResultCount:5e3,keyword:p||void 0},B.signal);t(q.items??[])}catch(q){if(q?.name==="AbortError")return;xe.error("Failed to load system menus.",{description:q?.message?String(q.message):"Please try again."}),t([])}finally{n(!1)}})(),()=>T.current?.abort()),[p,a]);const R=()=>i(F=>F+1),L=F=>{u(null),A(F),S(!0)},z=F=>{u(null),E(F),N(!0)};return l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsx("div",{className:"pb-4",children:l.jsxs("div",{className:"flex flex-nowrap items-center gap-3",children:[l.jsx(me,{placeholder:"Search",value:d,onChange:F=>c(F.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"}),l.jsx("div",{className:"flex-1"}),l.jsxs(fe,{className:"bg-blue-600 text-white hover:bg-blue-700",onClick:()=>x(!0),children:[l.jsx(wn,{className:"w-4 h-4 mr-2"}),"New Menu"]})]})}),l.jsx("div",{className:"flex-1 flex flex-col min-h-0 bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden",children:l.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:l.jsxs(Or,{children:[l.jsx(Er,{className:"bg-gray-50 sticky top-0 z-10",children:l.jsxs(Be,{className:"hover:bg-gray-50",children:[l.jsx(ve,{className:"font-semibold text-gray-900",children:"Menu Name"}),l.jsx(ve,{className:"font-semibold text-gray-900",children:"Route URL"}),l.jsx(ve,{className:"font-semibold text-gray-900",children:"Router Name"}),l.jsx(ve,{className:"font-semibold text-gray-900",children:"Type"}),l.jsx(ve,{className:"font-semibold text-gray-900",children:"Order"}),l.jsx(ve,{className:"font-semibold text-gray-900",children:"Visible"}),l.jsx(ve,{className:"font-semibold text-gray-900",children:"Enabled"}),l.jsx(ve,{className:"font-semibold text-gray-900 w-16 text-right",children:"Actions"})]})}),l.jsx(Pr,{children:e.length===0?l.jsx(Be,{children:l.jsx(de,{colSpan:8,className:"text-center py-10 text-gray-500",children:r?"Loading...":"No data"})}):e.map(F=>l.jsxs(Be,{className:"hover:bg-gray-50",children:[l.jsx(de,{className:"font-medium text-gray-900",children:I1(F.menuName)}),l.jsx(de,{className:"text-gray-700",children:I1(F.routeUrl)}),l.jsx(de,{className:"text-gray-700",children:I1(F.routerName)}),l.jsx(de,{className:"text-gray-700",children:F.menuType??"N/A"}),l.jsx(de,{className:"text-gray-700",children:F.orderNum??"N/A"}),l.jsx(de,{className:"text-gray-700",children:F.isShow?"Yes":"No"}),l.jsx(de,{className:"text-gray-700",children:F.state?"Yes":"No"}),l.jsx(de,{className:"text-right",children:l.jsxs(ma,{open:o===F.id,onOpenChange:B=>u(B?F.id:null),children:[l.jsx(ga,{asChild:!0,children:l.jsx(fe,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Row actions",children:l.jsx(Ei,{className:"h-4 w-4"})})}),l.jsx(va,{className:"w-44 p-2",align:"end",children:l.jsxs("div",{className:"flex flex-col",children:[l.jsxs(fe,{variant:"ghost",className:"justify-start",onClick:()=>L(F),children:[l.jsx(xn,{className:"w-4 h-4 mr-2"}),"Edit"]}),l.jsxs(fe,{variant:"ghost",className:"justify-start text-red-600 hover:text-red-700",onClick:()=>z(F),children:[l.jsx(Hc,{className:"w-4 h-4 mr-2"}),"Delete"]})]})})]})})]},F.id))})]})})}),l.jsx(GI,{mode:"create",open:v,menu:null,onOpenChange:x,onSaved:R}),l.jsx(GI,{mode:"edit",open:y,menu:O,onOpenChange:S,onSaved:R}),l.jsx(fhe,{open:_,menu:C,onOpenChange:N,onDeleted:R})]})}function GI({mode:e,open:t,menu:r,onOpenChange:n,onSaved:a}){const i=e==="edit",[o,u]=b.useState(!1),[d,c]=b.useState(""),[h,p]=b.useState(""),[m,v]=b.useState(""),[x,y]=b.useState("menu"),[S,_]=b.useState(""),[N,O]=b.useState(""),[A,C]=b.useState([]),[E,T]=b.useState(!1),[R,L]=b.useState(""),[z,F]=b.useState(""),[B,q]=b.useState(""),[H,V]=b.useState(""),[G,U]=b.useState(""),[$,Q]=b.useState(""),[k,I]=b.useState(!1),[D,Z]=b.useState(!0),[ie,oe]=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"),_(r?.permissionCode??"");const W=String(r?.parentId??"").trim();O(!W||W==="00000000-0000-0000-0000-000000000000"?"":W),L(r?.menuIcon??""),F(r?.orderNum===null||r?.orderNum===void 0?"":String(r.orderNum)),q(r?.link??""),V(r?.component??""),U(r?.query??""),Q(r?.remark??""),I(!!r?.isCache),Z(r?.isShow??!0),oe(r?.state??!0)},[t,r]);const ne="__parent_root__";b.useEffect(()=>{if(!t)return;let W=!1;return T(!0),Yde().then(_e=>{W||C(_e)}).catch(()=>{W||C([])}).finally(()=>{W||T(!1)}),()=>{W=!0}},[t]);const K=W=>!W.trim()||W==="00000000-0000-0000-0000-000000000000",J=b.useMemo(()=>{const W=A.filter(Ce=>Ce.id&&Ce.id!==r?.id),_e=(N||"").trim();return _e&&!K(_e)&&!W.some(Ce=>Ce.id===_e)?[...W,{id:_e,menuName:`(Current parent) ${_e}`}]:W},[A,N,r?.id]),ee=K(N)?ne:N,ce=b.useMemo(()=>!!(d.trim()&&m.trim()),[d,m]),pe=async()=>{if(!ce){xe.error("Please fill in required fields.",{description:"Menu Name and Route URL are required."});return}u(!0);try{const W={menuName:d.trim(),routerName:h.trim()?h.trim():null,routeUrl:m.trim(),menuType:x==="directory"?0:1,permissionCode:S.trim()?S.trim():null,parentId:K(N)?null:N.trim(),menuIcon:R||null,orderNum:uhe(z),link:B.trim()?B.trim():null,component:H.trim()?H.trim():null,query:G.trim()?G.trim():null,remark:$.trim()?$.trim():null,isCache:k,isShow:D,state:ie};if(i){if(!r?.id)throw new Error("Missing id.");await Qde(r.id,W),xe.success("Menu updated.",{description:"Changes have been saved successfully."})}else await Jde(W),xe.success("Menu created.",{description:"A new menu has been created successfully."});n(!1),a()}catch(W){xe.error(i?"Failed to update menu.":"Failed to create menu.",{description:W?.message?String(W.message):"Please try again."})}finally{u(!1)}};return l.jsx(mt,{open:t,onOpenChange:n,children:l.jsxs(ft,{className:"sm:max-w-none",style:{width:"70%"},children:[l.jsxs(gt,{children:[l.jsx(vt,{children:i?"Edit System Menu":"New System Menu"}),l.jsx(Nt,{children:i?"Update system menu fields and save changes.":"Fill out the form to create a new system menu."})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-6 py-2",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Menu Name *"}),l.jsx(me,{value:d,onChange:W=>c(W.target.value),placeholder:"e.g. Location Manager"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Route URL *"}),l.jsx(me,{value:m,onChange:W=>v(W.target.value),placeholder:"e.g. /location"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Router Name"}),l.jsx(me,{value:h,onChange:W=>p(W.target.value),placeholder:"e.g. location"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Menu Type"}),l.jsxs(Ke,{value:x,onValueChange:W=>y(W),children:[l.jsx(Ye,{className:"h-10 rounded-md border border-gray-200 bg-white",children:l.jsx(Xe,{})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"directory",children:"Directory"}),l.jsx(Ne,{value:"menu",children:"Menu"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Permission Code"}),l.jsx(me,{value:S,onChange:W=>_(W.target.value),placeholder:"e.g. sys:menu"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Parent"}),l.jsxs(Ke,{value:ee,disabled:E,onValueChange:W=>O(W===ne?"":W),children:[l.jsx(Ye,{className:"h-10 rounded-md border border-gray-200 bg-white",children:l.jsx(Xe,{placeholder:E?"Loading…":"Select parent directory"})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:ne,children:"Root (no parent)"}),J.map(W=>l.jsx(Ne,{value:W.id,children:W.menuName?.trim()||W.id},W.id))]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Menu Icon"}),l.jsxs(Ke,{value:R||"none",onValueChange:W=>L(W==="none"?"":W),children:[l.jsx(Ye,{className:"h-10 rounded-md border border-gray-200 bg-white",children:l.jsx(Xe,{placeholder:"Select an icon"})}),l.jsxs(Je,{children:[l.jsx(Ne,{value:"none",children:"None"}),Object.keys(WI).map(W=>{const _e=WI[W];return l.jsx(Ne,{value:W,children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(_e,{className:"h-4 w-4"}),W]})},W)})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Order"}),l.jsx(me,{value:z,onChange:W=>F(W.target.value),placeholder:"e.g. 10"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Link"}),l.jsx(me,{value:B,onChange:W=>q(W.target.value),placeholder:"Optional"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Component"}),l.jsx(me,{value:H,onChange:W=>V(W.target.value),placeholder:"Optional"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Query"}),l.jsx(me,{value:G,onChange:W=>U(W.target.value),placeholder:"Optional"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"Remark"}),l.jsx(che,{value:$,onChange:W=>Q(W.target.value),placeholder:"Optional"})]}),l.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[l.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Cache"}),l.jsx(qt,{checked:k,onCheckedChange:I})]}),l.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[l.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Visible"}),l.jsx(qt,{checked:D,onCheckedChange:Z})]}),l.jsxs("div",{className:"flex items-center justify-between border border-gray-200 rounded-md px-3 bg-white",style:{height:40},children:[l.jsx("div",{className:"text-sm font-medium text-gray-900",children:"Enabled"}),l.jsx(qt,{checked:ie,onCheckedChange:oe})]})]}),l.jsxs(xt,{className:"flex-row flex-wrap justify-end",children:[l.jsx(fe,{className:"min-w-24",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),l.jsx(fe,{className:"min-w-24 bg-blue-600 text-white hover:bg-blue-700",disabled:o,onClick:pe,children:o?"Saving...":i?"Save Changes":"Create"})]})]})})}function fhe({open:e,menu:t,onOpenChange:r,onDeleted:n}){const[a,i]=b.useState(!1),o=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 efe(t.id),xe.success("Menu deleted.",{description:"The menu has been removed successfully."}),r(!1),n()}catch(d){xe.error("Failed to delete menu.",{description:d?.message?String(d.message):"Please try again."})}finally{i(!1)}}};return l.jsx(mt,{open:e,onOpenChange:r,children:l.jsxs(ft,{className:"sm:max-w-none",style:{width:"30%"},children:[l.jsxs(gt,{children:[l.jsx(vt,{children:"Delete System Menu"}),l.jsx(Nt,{children:"This action cannot be undone."})]}),l.jsxs("div",{className:"text-sm text-gray-700",children:["Are you sure you want to delete ",l.jsx("span",{className:"font-medium",children:o}),"?"]}),l.jsxs(xt,{className:"flex-row flex-wrap justify-end",children:[l.jsx(fe,{className:"min-w-24",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsx(fe,{className:"min-w-24",variant:"destructive",disabled:a,onClick:u,children:a?"Deleting...":"Delete"})]})]})})}function hhe(){const[e,t]=b.useState("Dashboard"),r=()=>{switch(e){case"Dashboard":return l.jsx(mae,{});case"Training":return l.jsx(Rde,{});case"Alerts":return l.jsx(Dde,{});case"Menu Management":return l.jsx(qde,{});case"System Menu":return l.jsx(dhe,{});case"Account Management":return l.jsx(wfe,{});case"Reports":return l.jsx(kfe,{});case"Location Manager":return l.jsx(ahe,{});case"Labels":case"Label Categories":case"Label Types":case"Label Templates":case"Multiple Options":return l.jsx(kde,{currentView:e,onViewChange:t});default:return l.jsx(gae,{title:e})}};return l.jsx(Eq,{currentView:e,setCurrentView:t,children:r()})}cz.createRoot(document.getElementById("root")).render(l.jsx(hhe,{})); diff --git a/美国版/Food Labeling Management Platform/build/index.html b/美国版/Food Labeling Management Platform/build/index.html index e712b3d..1a006c1 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/LabelCategoriesView.tsx b/美国版/Food Labeling Management Platform/src/components/labels/LabelCategoriesView.tsx index 09940af..d1a0faf 100755 --- a/美国版/Food Labeling Management Platform/src/components/labels/LabelCategoriesView.tsx +++ b/美国版/Food Labeling Management Platform/src/components/labels/LabelCategoriesView.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect, useMemo, useRef, useState } from 'react'; import { Table, TableBody, @@ -16,82 +16,666 @@ import { SelectTrigger, SelectValue, } from "../ui/select"; -import { Plus } from "lucide-react"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from "../ui/dialog"; +import { Label } from "../ui/label"; +import { Switch } from "../ui/switch"; +import { Badge } from "../ui/badge"; +import { Plus, Edit, MoreHorizontal } from "lucide-react"; +import { toast } from "sonner"; +import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover"; +import { + Pagination, + PaginationContent, + PaginationItem, + PaginationLink, + PaginationNext, + PaginationPrevious, +} from "../ui/pagination"; +import { + getLabelCategories, + getLabelCategory, + createLabelCategory, + updateLabelCategory, + deleteLabelCategory, +} from "../../services/labelCategoryService"; +import type { + LabelCategoryDto, + LabelCategoryCreateInput, + LabelCategoryUpdateInput, +} from "../../types/labelCategory"; + +function toDisplay(v: string | null | undefined): string { + const s = (v ?? "").trim(); + return s ? s : "None"; +} export function LabelCategoriesView() { - const categories = [ - { - id: 1, - category: 'Prep', - count: 54, - photo: 'XXX', - lastEdited: '2025.12.03.11:45', - }, - { - id: 2, - category: 'Green', - count: 33, - photo: 'XXX', - lastEdited: '2025.12.03.11:45', - }, - { - id: 3, - category: 'Red', - count: 44, - photo: 'XXX', - lastEdited: '2025.12.03.11:45', - }, - ]; + const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false); + const [isEditDialogOpen, setIsEditDialogOpen] = useState(false); + const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false); + const [editingCategory, setEditingCategory] = useState(null); + const [deletingCategory, setDeletingCategory] = useState(null); + const [categories, setCategories] = useState([]); + const [loading, setLoading] = useState(false); + const [total, setTotal] = useState(0); + const [refreshSeq, setRefreshSeq] = useState(0); + const [actionsOpenForId, setActionsOpenForId] = useState(null); + + const [keyword, setKeyword] = useState(""); + const [stateFilter, setStateFilter] = useState("all"); + + const [pageIndex, setPageIndex] = useState(1); + const [pageSize, setPageSize] = useState(10); + + const abortRef = useRef(null); + const keywordTimerRef = useRef(null); + const [debouncedKeyword, setDebouncedKeyword] = useState(""); + + useEffect(() => { + if (keywordTimerRef.current) window.clearTimeout(keywordTimerRef.current); + keywordTimerRef.current = window.setTimeout(() => setDebouncedKeyword(keyword.trim()), 300); + return () => { + if (keywordTimerRef.current) window.clearTimeout(keywordTimerRef.current); + }; + }, [keyword]); + + const totalPages = Math.max(1, Math.ceil(total / pageSize)); + + useEffect(() => { + setPageIndex(1); + }, [debouncedKeyword, stateFilter, pageSize]); + + useEffect(() => { + const run = async () => { + abortRef.current?.abort(); + const ac = new AbortController(); + abortRef.current = ac; + + setLoading(true); + try { + // skipCount 从 0 开始,前端分页从 1 开始,需要转换 + const skipCount = (pageIndex - 1) * pageSize; + const res = await getLabelCategories( + { + skipCount, + maxResultCount: pageSize, + keyword: debouncedKeyword || undefined, + state: stateFilter === "all" ? undefined : stateFilter === "true", + }, + ac.signal, + ); + + setCategories(res.items ?? []); + setTotal(res.totalCount ?? 0); + } catch (e: any) { + if (e?.name === "AbortError") return; + toast.error("Failed to load label categories.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + setCategories([]); + setTotal(0); + } finally { + setLoading(false); + } + }; + + run(); + return () => abortRef.current?.abort(); + }, [debouncedKeyword, stateFilter, pageIndex, pageSize, refreshSeq]); + + const refreshList = () => setRefreshSeq((x) => x + 1); + + const openEdit = (cat: LabelCategoryDto) => { + setActionsOpenForId(null); + setEditingCategory(cat); + setIsEditDialogOpen(true); + }; + + const openDelete = (cat: LabelCategoryDto) => { + setActionsOpenForId(null); + setDeletingCategory(cat); + setIsDeleteDialogOpen(true); + }; return ( -
- {/* Search, Location, New Label Category - single row */} -
- - Search - - Location - +
+
+
+
+ setKeyword(e.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" + /> + +
+ +
+
- {/* Table */} -
- - - - Label Category - No. of Labels - Category Photo - Last Edited - - - - {categories.map((item) => ( - - {item.category} - {item.count} - {item.photo} - {item.lastEdited} +
+
+
+ + + Label Category + Category Code + Category Photo + State + Order + Last Edited + Actions - ))} - -
+ + + {loading ? ( + + + Loading... + + + ) : categories.length === 0 ? ( + + + No results. + + + ) : ( + categories.map((item) => ( + + {toDisplay(item.categoryName)} + {toDisplay(item.categoryCode)} + {toDisplay(item.categoryPhotoUrl)} + + + {item.state ? "Active" : "Inactive"} + + + {item.orderNum ?? "None"} + + {item.creationTime ? new Date(item.creationTime).toLocaleString() : "None"} + + + setActionsOpenForId(open ? item.id : null)} + > + + + + + + + + + + + )) + )} + + +
+ +
+
+
+ Showing {total === 0 ? 0 : (pageIndex - 1) * pageSize + 1}- + {Math.min(pageIndex * pageSize, total)} of {total} +
+
+ + + + + { + e.preventDefault(); + setPageIndex((p) => Math.max(1, p - 1)); + }} + aria-disabled={pageIndex <= 1} + className={pageIndex <= 1 ? "pointer-events-none opacity-50" : ""} + /> + + + e.preventDefault()} + > + Page {pageIndex} / {totalPages} + + + + { + e.preventDefault(); + setPageIndex((p) => Math.min(totalPages, p + 1)); + }} + aria-disabled={pageIndex >= totalPages} + className={pageIndex >= totalPages ? "pointer-events-none opacity-50" : ""} + /> + + + +
+
+
+ + { + setPageIndex(1); + refreshList(); + }} + /> + + { + setIsEditDialogOpen(open); + if (!open) setEditingCategory(null); + }} + onUpdated={refreshList} + /> + + { + setIsDeleteDialogOpen(open); + if (!open) setDeletingCategory(null); + }} + onDeleted={refreshList} + />
); } + +function CreateLabelCategoryDialog({ + open, + onOpenChange, + onCreated, +}: { + open: boolean; + onOpenChange: (open: boolean) => void; + onCreated: () => void; +}) { + const [submitting, setSubmitting] = useState(false); + const [form, setForm] = useState({ + categoryCode: "", + categoryName: "", + categoryPhotoUrl: null, + state: true, + orderNum: null, + }); + + const resetForm = () => { + setForm({ + categoryCode: "", + categoryName: "", + categoryPhotoUrl: null, + state: true, + orderNum: null, + }); + }; + + useEffect(() => { + if (!open) { + resetForm(); + } + }, [open]); + + const submit = async () => { + if (!form.categoryCode.trim() || !form.categoryName.trim()) { + toast.error("Validation failed", { + description: "Category Code and Category Name are required.", + }); + return; + } + + setSubmitting(true); + try { + await createLabelCategory(form); + toast.success("Label category created.", { + description: "The label category has been created successfully.", + }); + onOpenChange(false); + onCreated(); + } catch (e: any) { + toast.error("Failed to create label category.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + } finally { + setSubmitting(false); + } + }; + + return ( + + + + Add New Label Category + + Enter the details for the new label category. + + + +
+
+
+ + setForm((p) => ({ ...p, categoryCode: e.target.value }))} + /> +
+
+ + setForm((p) => ({ ...p, categoryName: e.target.value }))} + /> +
+
+ +
+ + setForm((p) => ({ ...p, categoryPhotoUrl: e.target.value || null }))} + /> +
+ +
+
+ + setForm((p) => ({ ...p, orderNum: e.target.value ? Number(e.target.value) : null }))} + /> +
+
+
Enabled
+ setForm((p) => ({ ...p, state: checked }))} /> +
+
+
+ + + + + +
+
+ ); +} + +function EditLabelCategoryDialog({ + open, + category, + onOpenChange, + onUpdated, +}: { + open: boolean; + category: LabelCategoryDto | null; + onOpenChange: (open: boolean) => void; + onUpdated: () => void; +}) { + const [submitting, setSubmitting] = useState(false); + const [loading, setLoading] = useState(false); + const [form, setForm] = useState({ + categoryCode: "", + categoryName: "", + categoryPhotoUrl: null, + state: true, + orderNum: null, + }); + + useEffect(() => { + if (open && category) { + setForm({ + categoryCode: category.categoryCode ?? "", + categoryName: category.categoryName ?? "", + categoryPhotoUrl: category.categoryPhotoUrl ?? null, + state: category.state ?? true, + orderNum: category.orderNum ?? null, + }); + } + }, [open, category]); + + const submit = async () => { + if (!category?.id) return; + if (!form.categoryCode.trim() || !form.categoryName.trim()) { + toast.error("Validation failed", { + description: "Category Code and Category Name are required.", + }); + return; + } + + setSubmitting(true); + try { + await updateLabelCategory(category.id, form); + toast.success("Label category updated.", { + description: "The label category has been updated successfully.", + }); + onOpenChange(false); + onUpdated(); + } catch (e: any) { + toast.error("Failed to update label category.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + } finally { + setSubmitting(false); + } + }; + + return ( + + + + Edit Label Category + + Update the label category details. + + + +
+
+
+ + setForm((p) => ({ ...p, categoryCode: e.target.value }))} + /> +
+
+ + setForm((p) => ({ ...p, categoryName: e.target.value }))} + /> +
+
+ +
+ + setForm((p) => ({ ...p, categoryPhotoUrl: e.target.value || null }))} + /> +
+ +
+
+ + setForm((p) => ({ ...p, orderNum: e.target.value ? Number(e.target.value) : null }))} + /> +
+
+
Enabled
+ setForm((p) => ({ ...p, state: checked }))} /> +
+
+
+ + + + + +
+
+ ); +} + +function DeleteLabelCategoryDialog({ + open, + category, + onOpenChange, + onDeleted, +}: { + open: boolean; + category: LabelCategoryDto | null; + onOpenChange: (open: boolean) => void; + onDeleted: () => void; +}) { + const [submitting, setSubmitting] = useState(false); + + const name = useMemo(() => { + const n = (category?.categoryName ?? "").trim(); + return n || category?.categoryCode || "this category"; + }, [category]); + + const submit = async () => { + if (!category?.id) return; + setSubmitting(true); + try { + await deleteLabelCategory(category.id); + toast.success("Label category deleted.", { + description: "The label category has been removed successfully.", + }); + onOpenChange(false); + onDeleted(); + } catch (e: any) { + toast.error("Failed to delete label category.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + } finally { + setSubmitting(false); + } + }; + + return ( + + + + Delete Label Category + This action cannot be undone. + + +
+ Are you sure you want to delete {name}? +
+ + + + + +
+
+ ); +} diff --git a/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/LabelCanvas.tsx b/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/LabelCanvas.tsx index 2a42e10..2a8e18c 100644 --- a/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/LabelCanvas.tsx +++ b/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/LabelCanvas.tsx @@ -933,7 +933,7 @@ export function LabelCanvas({ ); } -/** 仅用于预览:无网格、无标尺、无拖拽,按比例缩放 */ +/** Preview only: no grid, no rulers, no drag; scale to fit. */ export function LabelPreviewOnly({ template, maxWidth = 480, diff --git a/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/PropertiesPanel.tsx b/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/PropertiesPanel.tsx index 929f08c..05f660c 100644 --- a/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/PropertiesPanel.tsx +++ b/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/PropertiesPanel.tsx @@ -18,7 +18,10 @@ import type { Unit, Rotation, Border, + AppliedLocation, } from '../../../types/labelTemplate'; +import type { LocationDto } from '../../../types/location'; +import { Checkbox } from '../../ui/checkbox'; interface PropertiesPanelProps { template: LabelTemplate; @@ -26,6 +29,10 @@ interface PropertiesPanelProps { onTemplateChange: (patch: Partial) => void; onElementChange: (id: string, patch: Partial) => void; onDeleteElement?: (id: string) => void; + /** 门店列表:appliedLocation=SPECIFIED 时勾选 */ + locations?: LocationDto[]; + /** 编辑已有模板时禁止修改 Template Code */ + readOnlyTemplateCode?: boolean; } export function PropertiesPanel({ @@ -34,6 +41,8 @@ export function PropertiesPanel({ onTemplateChange, onElementChange, onDeleteElement, + locations = [], + readOnlyTemplateCode = false, }: PropertiesPanelProps) { if (selectedElement) { return ( @@ -165,6 +174,16 @@ export function PropertiesPanel({
+ + onTemplateChange({ id: e.target.value.trim() })} + className="h-8 text-sm mt-1" + placeholder="e.g. TPL_TEST_001" + /> +
+
Applied Location
+ {template.appliedLocation === "SPECIFIED" && ( +
+ + {locations.length === 0 ? ( +

No locations loaded.

+ ) : ( + locations.map((loc) => { + const checked = (template.appliedLocationIds ?? []).includes(loc.id); + return ( + + ); + }) + )} +
+ )}
@@ -250,6 +306,13 @@ export function PropertiesPanel({ />
+
+ onTemplateChange({ showGrid: v })} + /> + +
@@ -554,7 +617,7 @@ function ElementConfigFields({ case 'BLANK': return (
- 空白占位元素,无需配置 + Blank spacer; no configuration needed.
); default: diff --git a/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/index.tsx b/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/index.tsx index d3e2e9a..f0a2db5 100644 --- a/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/index.tsx +++ b/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplateEditor/index.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useState } from 'react'; +import React, { useCallback, useEffect, useState } from 'react'; import { Button } from '../../ui/button'; import { ArrowLeft, Save, Download } from 'lucide-react'; import { @@ -8,11 +8,18 @@ import { DialogTitle, } from '../../ui/dialog'; import type { LabelTemplate, LabelElement } from '../../../types/labelTemplate'; -import { createDefaultTemplate, createDefaultElement } from '../../../types/labelTemplate'; +import { + createDefaultTemplate, + createDefaultElement, + defaultValueSourceTypeForElement, +} from '../../../types/labelTemplate'; +import type { LocationDto } from '../../../types/location'; +import { getLocations } from '../../../services/locationService'; import { ElementsPanel } from './ElementsPanel'; import { LabelCanvas, LabelPreviewOnly } from './LabelCanvas'; import { PropertiesPanel } from './PropertiesPanel'; -import { saveTemplate } from '../../../lib/labelTemplateStorage'; +import { createLabelTemplate, updateLabelTemplate } from '../../../services/labelTemplateService'; +import { toast } from 'sonner'; const MIN_SCALE = 0.5; const MAX_SCALE = 2; @@ -40,6 +47,22 @@ export function LabelTemplateEditor({ const [selectedId, setSelectedId] = useState(null); const [scale, setScale] = useState(DEFAULT_SCALE); const [previewOpen, setPreviewOpen] = useState(false); + const [locations, setLocations] = useState([]); + + useEffect(() => { + let cancelled = false; + (async () => { + try { + const res = await getLocations({ skipCount: 0, maxResultCount: 500 }); + if (!cancelled) setLocations(res.items ?? []); + } catch { + if (!cancelled) setLocations([]); + } + })(); + return () => { + cancelled = true; + }; + }, []); const selectedElement = template.elements.find((el) => el.id === selectedId) ?? null; @@ -141,11 +164,74 @@ export function LabelTemplateEditor({ setTemplate((prev) => ({ ...prev, ...patch })); }, []); - const handleSave = useCallback(() => { - saveTemplate(template); - onSaved(); - onClose(); - }, [template, onSaved, onClose]); + const handleSave = useCallback(async () => { + try { + const code = (template.id ?? "").trim(); + if (!code) { + toast.error("Template code is required.", { + description: "Please enter a template code (e.g. TPL_TEST_001).", + }); + return; + } + if (template.appliedLocation === "SPECIFIED" && !(template.appliedLocationIds?.length ?? 0)) { + toast.error("Locations required.", { + description: "When using specified locations, select at least one location.", + }); + return; + } + + // 转换 LabelTemplate 到 API 需要的格式(对齐 LabelTemplateCreateInputVo) + const apiInput = { + id: code, + name: template.name, + labelType: template.labelType, + unit: template.unit, + width: template.width, + height: template.height, + appliedLocation: template.appliedLocation, + showRuler: template.showRuler, + showGrid: template.showGrid ?? true, + state: true, + elements: template.elements.map((el, index) => ({ + id: el.id, + type: el.type, + x: el.x, + y: el.y, + width: el.width, + height: el.height, + rotation: el.rotation, + border: el.border, + zIndex: el.zIndex ?? index + 1, + orderNum: el.orderNum ?? index + 1, + valueSourceType: el.valueSourceType ?? defaultValueSourceTypeForElement(el.type), + isRequiredInput: el.isRequiredInput ?? false, + config: el.config, + })), + appliedLocationIds: + template.appliedLocation === "ALL" ? [] : (template.appliedLocationIds ?? []), + }; + + if (templateId) { + // 编辑模式:使用 TemplateCode 作为 id + await updateLabelTemplate(code, apiInput); + toast.success("Template updated.", { + description: "The template has been updated successfully.", + }); + } else { + // 新建模式 + await createLabelTemplate(apiInput); + toast.success("Template created.", { + description: "The template has been created successfully.", + }); + } + onSaved(); + onClose(); + } catch (e: any) { + toast.error("Failed to save template.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + } + }, [template, templateId, onSaved, onClose]); const handleExport = useCallback(() => { const blob = new Blob([JSON.stringify(template, null, 2)], { @@ -213,6 +299,8 @@ export function LabelTemplateEditor({ onTemplateChange={handleTemplateChange} onElementChange={updateElement} onDeleteElement={deleteElement} + locations={locations} + readOnlyTemplateCode={!!templateId} />
diff --git a/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplatesView.tsx b/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplatesView.tsx index 8dd785b..3359dd4 100755 --- a/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplatesView.tsx +++ b/美国版/Food Labeling Management Platform/src/components/labels/LabelTemplatesView.tsx @@ -1,4 +1,4 @@ -import React, { useState, useCallback, useEffect } from 'react'; +import React, { useState, useCallback, useEffect, useRef, useMemo } from 'react'; import { Table, TableBody, @@ -16,52 +16,231 @@ import { SelectTrigger, SelectValue, } from '../ui/select'; -import { Plus, Pencil } from 'lucide-react'; -import { getTemplateList, getTemplate } from '../../lib/labelTemplateStorage'; -import type { LabelTemplate } from '../../types/labelTemplate'; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from '../ui/dialog'; +import { Plus, Pencil, MoreHorizontal } from 'lucide-react'; +import { toast } from 'sonner'; +import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'; +import { + Pagination, + PaginationContent, + PaginationItem, + PaginationLink, + PaginationNext, + PaginationPrevious, +} from '../ui/pagination'; +import { getLabelTemplates, getLabelTemplate, deleteLabelTemplate } from '../../services/labelTemplateService'; +import { getLocations } from '../../services/locationService'; +import { appliedLocationToEditor, type LabelTemplateDto } from '../../types/labelTemplate'; import { LabelTemplateEditor } from './LabelTemplateEditor'; +import type { LabelTemplate } from '../../types/labelTemplate'; +import type { LocationDto } from '../../types/location'; + +function toDisplay(v: string | null | undefined): string { + const s = (v ?? "").trim(); + return s ? s : "None"; +} + +function locationColumnText(t: LabelTemplateDto, locations: LocationDto[]): string { + const mode = appliedLocationToEditor(t); + if (mode === "ALL") return "All"; + const ids = t.appliedLocationIds ?? []; + if (ids.length === 0) return "Specified (0)"; + const names = ids.map( + (id) => locations.find((l) => l.id === id)?.locationName?.trim() || id, + ); + if (names.length <= 2) return names.join(", "); + return `${names.slice(0, 2).join(", ")} +${names.length - 2}`; +} + +/** 列表行:名称列 ← templateName / name */ +function templateListDisplayName(t: LabelTemplateDto): string { + const n = (t.templateName ?? t.name ?? "").trim(); + return n ? n : "None"; +} + +/** 列表行:模板编码列 ← templateCode / id */ +function templateListDisplayCode(t: LabelTemplateDto): string { + const c = (t.templateCode ?? t.id ?? "").trim(); + return c ? c : "None"; +} + +/** 列表行:门店展示 ← locationText,缺省时再推导 */ +function templateListDisplayLocation(t: LabelTemplateDto, locations: LocationDto[]): string { + const lt = (t.locationText ?? "").trim(); + if (lt) return lt; + return locationColumnText(t, locations); +} + +/** 列表行:元素数量 ← contentsCount / elements.length */ +function templateListContentsCount(t: LabelTemplateDto): number { + if (typeof t.contentsCount === "number") return t.contentsCount; + return t.elements?.length ?? 0; +} + +/** 列表行:尺寸 ← sizeText,缺省时用 width×height unit */ +function templateListDisplaySize(t: LabelTemplateDto): string { + const st = (t.sizeText ?? "").trim(); + if (st) return st; + const w = t.width; + const h = t.height; + const u = t.unit; + if (w != null && h != null && u) return `${w}×${h} ${u}`; + return "None"; +} export function LabelTemplatesView() { - const [templates, setTemplates] = useState(() => getTemplateList()); + const [templates, setTemplates] = useState([]); const [viewMode, setViewMode] = useState<'list' | 'editor'>('list'); const [editingTemplateId, setEditingTemplateId] = useState(null); - const [search, setSearch] = useState(''); + const [initialTemplate, setInitialTemplate] = useState(null); + const [loading, setLoading] = useState(false); + const [total, setTotal] = useState(0); + const [refreshSeq, setRefreshSeq] = useState(0); + const [actionsOpenForId, setActionsOpenForId] = useState(null); + const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false); + const [deletingTemplate, setDeletingTemplate] = useState(null); + + const [keyword, setKeyword] = useState(''); const [locationFilter, setLocationFilter] = useState('all'); + const [labelTypeFilter, setLabelTypeFilter] = useState('all'); + const [stateFilter, setStateFilter] = useState('all'); + + const [pageIndex, setPageIndex] = useState(1); + const [pageSize, setPageSize] = useState(10); + const [locations, setLocations] = useState([]); - const refreshList = useCallback(() => { - setTemplates(getTemplateList()); + const abortRef = useRef(null); + const keywordTimerRef = useRef(null); + const [debouncedKeyword, setDebouncedKeyword] = useState(''); + + useEffect(() => { + if (keywordTimerRef.current) window.clearTimeout(keywordTimerRef.current); + keywordTimerRef.current = window.setTimeout(() => setDebouncedKeyword(keyword.trim()), 300); + return () => { + if (keywordTimerRef.current) window.clearTimeout(keywordTimerRef.current); + }; + }, [keyword]); + + const totalPages = Math.max(1, Math.ceil(total / pageSize)); + + useEffect(() => { + let cancelled = false; + (async () => { + try { + const res = await getLocations({ skipCount: 0, maxResultCount: 500 }); + if (!cancelled) setLocations(res.items ?? []); + } catch { + if (!cancelled) setLocations([]); + } + })(); + return () => { + cancelled = true; + }; }, []); useEffect(() => { - if (viewMode === 'list') refreshList(); - }, [viewMode, refreshList]); + setPageIndex(1); + }, [debouncedKeyword, locationFilter, labelTypeFilter, stateFilter, pageSize]); - const filtered = templates.filter((t) => { - const matchSearch = - !search || t.name.toLowerCase().includes(search.toLowerCase()); - const matchLoc = - locationFilter === 'all' || t.appliedLocation === locationFilter; - return matchSearch && matchLoc; - }); + useEffect(() => { + if (viewMode !== 'list') return; + + const run = async () => { + abortRef.current?.abort(); + const ac = new AbortController(); + abortRef.current = ac; + + setLoading(true); + try { + const skipCount = (pageIndex - 1) * pageSize; + const res = await getLabelTemplates( + { + skipCount, + maxResultCount: pageSize, + keyword: debouncedKeyword || undefined, + locationId: locationFilter !== 'all' ? locationFilter : undefined, + labelType: labelTypeFilter !== 'all' ? (labelTypeFilter as any) : undefined, + state: stateFilter === 'all' ? undefined : stateFilter === 'true', + }, + ac.signal, + ); + + setTemplates(res.items ?? []); + setTotal(res.totalCount ?? 0); + } catch (e: any) { + if (e?.name === 'AbortError') return; + toast.error('Failed to load label templates.', { + description: e?.message ? String(e.message) : 'Please try again.', + }); + setTemplates([]); + setTotal(0); + } finally { + setLoading(false); + } + }; + + run(); + return () => abortRef.current?.abort(); + }, [debouncedKeyword, locationFilter, labelTypeFilter, stateFilter, pageIndex, pageSize, refreshSeq, viewMode]); + + const refreshList = () => setRefreshSeq((x) => x + 1); const handleNewTemplate = () => { setEditingTemplateId(null); + setInitialTemplate(null); setViewMode('editor'); }; - const handleEditTemplate = (id: string) => { - setEditingTemplateId(id); - setViewMode('editor'); + const handleEditTemplate = async (templateCode: string) => { + setEditingTemplateId(templateCode); + setLoading(true); + try { + const apiTemplate = await getLabelTemplate(templateCode); + // 转换 API 返回的 DTO 到编辑器需要的格式 + const editorTemplate: LabelTemplate = { + id: apiTemplate.id, + name: (apiTemplate.name ?? apiTemplate.templateName ?? '').trim() || '未命名模板', + labelType: (apiTemplate.labelType as any) ?? 'PRICE', + unit: (apiTemplate.unit as any) ?? 'cm', + width: apiTemplate.width ?? 6, + height: apiTemplate.height ?? 4, + appliedLocation: appliedLocationToEditor(apiTemplate), + appliedLocationIds: [...(apiTemplate.appliedLocationIds ?? [])], + showRuler: apiTemplate.showRuler ?? true, + showGrid: apiTemplate.showGrid ?? true, + elements: (apiTemplate.elements ?? []) as LabelTemplate['elements'], + }; + setInitialTemplate(editorTemplate); + setViewMode('editor'); + } catch (e: any) { + toast.error('Failed to load template.', { + description: e?.message ? String(e.message) : 'Please try again.', + }); + } finally { + setLoading(false); + } }; const handleCloseEditor = () => { setViewMode('list'); setEditingTemplateId(null); + setInitialTemplate(null); + }; + + const openDelete = (template: LabelTemplateDto) => { + setActionsOpenForId(null); + setDeletingTemplate(template); + setIsDeleteDialogOpen(true); }; if (viewMode === 'editor') { - const initialTemplate = - editingTemplateId ? getTemplate(editingTemplateId) : null; return (
- {/* Top Controls - single row, style consistent with other Label views */} -
- setSearch(e.target.value)} - /> - - -
- - {/* Warning Banner */} -
- ***One or more templates have incomplete labels attached to them. -
- Go to Labels view to see which labels are missing fields. +
+
+
+
+ setKeyword(e.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" + /> + + + +
+ +
+
- {/* Table */} -
- - - - - Label Template - - - Location - - Contents - - Size - - - Actions - - - - - {filtered.length === 0 ? ( - - - No templates yet. Click "New Label Template" to create one. - +
+
+
+ + + Label Template + Template Code + Location + Label Type + Contents + Size + Actions - ) : ( - filtered.map((t) => ( - handleEditTemplate(t.id)} - > - {t.name} - {t.appliedLocation} - - {t.elements.length} element(s) - - - {t.width}×{t.height} {t.unit} + + + {loading ? ( + + + Loading... - e.stopPropagation()}> - + + ) : templates.length === 0 ? ( + + + No templates yet. Click "New Label Template" to create one. - )) - )} - -
+ ) : ( + templates.map((t) => ( + + + {templateListDisplayName(t)} + + + {templateListDisplayCode(t)} + + + {toDisplay(templateListDisplayLocation(t, locations))} + + {toDisplay(t.labelType)} + + {templateListContentsCount(t)} element(s) + + + {templateListDisplaySize(t)} + + + setActionsOpenForId(open ? t.id : null)} + > + + + + + + + + + + + )) + )} + + +
+ +
+
+
+ Showing {total === 0 ? 0 : (pageIndex - 1) * pageSize + 1}- + {Math.min(pageIndex * pageSize, total)} of {total} +
+
+ + + + + { + e.preventDefault(); + setPageIndex((p) => Math.max(1, p - 1)); + }} + aria-disabled={pageIndex <= 1} + className={pageIndex <= 1 ? "pointer-events-none opacity-50" : ""} + /> + + + e.preventDefault()} + > + Page {pageIndex} / {totalPages} + + + + { + e.preventDefault(); + setPageIndex((p) => Math.min(totalPages, p + 1)); + }} + aria-disabled={pageIndex >= totalPages} + className={pageIndex >= totalPages ? "pointer-events-none opacity-50" : ""} + /> + + + +
+
+
+ + { + setIsDeleteDialogOpen(open); + if (!open) setDeletingTemplate(null); + }} + onDeleted={refreshList} + />
); } + +function DeleteLabelTemplateDialog({ + open, + template, + onOpenChange, + onDeleted, +}: { + open: boolean; + template: LabelTemplateDto | null; + onOpenChange: (open: boolean) => void; + onDeleted: () => void; +}) { + const [submitting, setSubmitting] = useState(false); + + const name = useMemo(() => { + const n = (template?.templateName ?? template?.name ?? "").trim(); + return n || (template?.templateCode ?? template?.id ?? "").trim() || "this template"; + }, [template]); + + const submit = async () => { + if (!template?.id) return; + setSubmitting(true); + try { + await deleteLabelTemplate(template.id); + toast.success("Label template deleted.", { + description: "The label template has been removed successfully.", + }); + onOpenChange(false); + onDeleted(); + } catch (e: any) { + toast.error("Failed to delete label template.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + } finally { + setSubmitting(false); + } + }; + + return ( + + + + Delete Label Template + This action cannot be undone. + + +
+ Are you sure you want to delete {name}? +
+ + + + + +
+
+ ); +} diff --git a/美国版/Food Labeling Management Platform/src/components/labels/LabelTypesView.tsx b/美国版/Food Labeling Management Platform/src/components/labels/LabelTypesView.tsx index 5fe111a..4150fb8 100755 --- a/美国版/Food Labeling Management Platform/src/components/labels/LabelTypesView.tsx +++ b/美国版/Food Labeling Management Platform/src/components/labels/LabelTypesView.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect, useMemo, useRef, useState } from 'react'; import { Table, TableBody, @@ -16,89 +16,640 @@ import { SelectTrigger, SelectValue, } from "../ui/select"; -import { Plus } from "lucide-react"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from "../ui/dialog"; +import { Label } from "../ui/label"; +import { Switch } from "../ui/switch"; +import { Badge } from "../ui/badge"; +import { Plus, Edit, MoreHorizontal } from "lucide-react"; +import { toast } from "sonner"; +import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover"; +import { + Pagination, + PaginationContent, + PaginationItem, + PaginationLink, + PaginationNext, + PaginationPrevious, +} from "../ui/pagination"; +import { + getLabelTypes, + getLabelType, + createLabelType, + updateLabelType, + deleteLabelType, +} from "../../services/labelTypeService"; +import type { + LabelTypeDto, + LabelTypeCreateInput, + LabelTypeUpdateInput, +} from "../../types/labelType"; + +function toDisplay(v: string | null | undefined): string { + const s = (v ?? "").trim(); + return s ? s : "None"; +} export function LabelTypesView() { - const types = [ - { - id: 1, - type: 'Defrost', - count: 54, - lastEdited: '2025.12.03.11:45', - }, - { - id: 2, - type: 'Thawed', - count: 33, - lastEdited: '2025.12.03.11:45', - }, - { - id: 3, - type: 'Opened', - count: 44, - lastEdited: '2025.12.03.11:45', - }, - { - id: 4, - type: 'Preped', - count: 17, - lastEdited: '2025.12.03.11:45', - }, - { - id: 5, - type: 'Heated', - count: 67, - lastEdited: '2025.12.03.11:45', - }, - ]; + const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false); + const [isEditDialogOpen, setIsEditDialogOpen] = useState(false); + const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false); + const [editingType, setEditingType] = useState(null); + const [deletingType, setDeletingType] = useState(null); + const [types, setTypes] = useState([]); + const [loading, setLoading] = useState(false); + const [total, setTotal] = useState(0); + const [refreshSeq, setRefreshSeq] = useState(0); + const [actionsOpenForId, setActionsOpenForId] = useState(null); + + const [keyword, setKeyword] = useState(""); + const [stateFilter, setStateFilter] = useState("all"); + + const [pageIndex, setPageIndex] = useState(1); + const [pageSize, setPageSize] = useState(10); + + const abortRef = useRef(null); + const keywordTimerRef = useRef(null); + const [debouncedKeyword, setDebouncedKeyword] = useState(""); + + useEffect(() => { + if (keywordTimerRef.current) window.clearTimeout(keywordTimerRef.current); + keywordTimerRef.current = window.setTimeout(() => setDebouncedKeyword(keyword.trim()), 300); + return () => { + if (keywordTimerRef.current) window.clearTimeout(keywordTimerRef.current); + }; + }, [keyword]); + + const totalPages = Math.max(1, Math.ceil(total / pageSize)); + + useEffect(() => { + setPageIndex(1); + }, [debouncedKeyword, stateFilter, pageSize]); + + useEffect(() => { + const run = async () => { + abortRef.current?.abort(); + const ac = new AbortController(); + abortRef.current = ac; + + setLoading(true); + try { + const skipCount = (pageIndex - 1) * pageSize; + const res = await getLabelTypes( + { + skipCount, + maxResultCount: pageSize, + keyword: debouncedKeyword || undefined, + state: stateFilter === "all" ? undefined : stateFilter === "true", + }, + ac.signal, + ); + + setTypes(res.items ?? []); + setTotal(res.totalCount ?? 0); + } catch (e: any) { + if (e?.name === "AbortError") return; + toast.error("Failed to load label types.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + setTypes([]); + setTotal(0); + } finally { + setLoading(false); + } + }; + + run(); + return () => abortRef.current?.abort(); + }, [debouncedKeyword, stateFilter, pageIndex, pageSize, refreshSeq]); + + const refreshList = () => setRefreshSeq((x) => x + 1); + + const openEdit = (type: LabelTypeDto) => { + setActionsOpenForId(null); + setEditingType(type); + setIsEditDialogOpen(true); + }; + + const openDelete = (type: LabelTypeDto) => { + setActionsOpenForId(null); + setDeletingType(type); + setIsDeleteDialogOpen(true); + }; return ( -
- {/* Search, Location, New Label Type - single row */} -
- - Search - - Location - +
+
+
+
+ setKeyword(e.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" + /> + +
+ +
+
- {/* Table */} -
- - - - Label Types - No. of Labels - Last Edited - - - - {types.map((item) => ( - - {item.type} - {item.count} - {item.lastEdited} +
+
+
+ + + Label Types + Type Code + State + Order + Last Edited + Actions - ))} - -
+ + + {loading ? ( + + + Loading... + + + ) : types.length === 0 ? ( + + + No results. + + + ) : ( + types.map((item) => ( + + {toDisplay(item.typeName)} + {toDisplay(item.typeCode)} + + + {item.state ? "Active" : "Inactive"} + + + {item.orderNum ?? "None"} + + {item.creationTime ? new Date(item.creationTime).toLocaleString() : "None"} + + + setActionsOpenForId(open ? item.id : null)} + > + + + + + + + + + + + )) + )} + + +
+ +
+
+
+ Showing {total === 0 ? 0 : (pageIndex - 1) * pageSize + 1}- + {Math.min(pageIndex * pageSize, total)} of {total} +
+
+ + + + + { + e.preventDefault(); + setPageIndex((p) => Math.max(1, p - 1)); + }} + aria-disabled={pageIndex <= 1} + className={pageIndex <= 1 ? "pointer-events-none opacity-50" : ""} + /> + + + e.preventDefault()} + > + Page {pageIndex} / {totalPages} + + + + { + e.preventDefault(); + setPageIndex((p) => Math.min(totalPages, p + 1)); + }} + aria-disabled={pageIndex >= totalPages} + className={pageIndex >= totalPages ? "pointer-events-none opacity-50" : ""} + /> + + + +
+
+
+ + { + setPageIndex(1); + refreshList(); + }} + /> + + { + setIsEditDialogOpen(open); + if (!open) setEditingType(null); + }} + onUpdated={refreshList} + /> + + { + setIsDeleteDialogOpen(open); + if (!open) setDeletingType(null); + }} + onDeleted={refreshList} + />
); } + +function CreateLabelTypeDialog({ + open, + onOpenChange, + onCreated, +}: { + open: boolean; + onOpenChange: (open: boolean) => void; + onCreated: () => void; +}) { + const [submitting, setSubmitting] = useState(false); + const [form, setForm] = useState({ + typeCode: "", + typeName: "", + state: true, + orderNum: null, + }); + + const resetForm = () => { + setForm({ + typeCode: "", + typeName: "", + state: true, + orderNum: null, + }); + }; + + useEffect(() => { + if (!open) { + resetForm(); + } + }, [open]); + + const submit = async () => { + if (!form.typeCode.trim() || !form.typeName.trim()) { + toast.error("Validation failed", { + description: "Type Code and Type Name are required.", + }); + return; + } + + setSubmitting(true); + try { + await createLabelType(form); + toast.success("Label type created.", { + description: "The label type has been created successfully.", + }); + onOpenChange(false); + onCreated(); + } catch (e: any) { + toast.error("Failed to create label type.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + } finally { + setSubmitting(false); + } + }; + + return ( + + + + Add New Label Type + + Enter the details for the new label type. + + + +
+
+
+ + setForm((p) => ({ ...p, typeCode: e.target.value }))} + /> +
+
+ + setForm((p) => ({ ...p, typeName: e.target.value }))} + /> +
+
+ +
+
+ + setForm((p) => ({ ...p, orderNum: e.target.value ? Number(e.target.value) : null }))} + /> +
+
+
Enabled
+ setForm((p) => ({ ...p, state: checked }))} /> +
+
+
+ + + + + +
+
+ ); +} + +function EditLabelTypeDialog({ + open, + type, + onOpenChange, + onUpdated, +}: { + open: boolean; + type: LabelTypeDto | null; + onOpenChange: (open: boolean) => void; + onUpdated: () => void; +}) { + const [submitting, setSubmitting] = useState(false); + const [form, setForm] = useState({ + typeCode: "", + typeName: "", + state: true, + orderNum: null, + }); + + useEffect(() => { + if (open && type) { + setForm({ + typeCode: type.typeCode ?? "", + typeName: type.typeName ?? "", + state: type.state ?? true, + orderNum: type.orderNum ?? null, + }); + } + }, [open, type]); + + const submit = async () => { + if (!type?.id) return; + if (!form.typeCode.trim() || !form.typeName.trim()) { + toast.error("Validation failed", { + description: "Type Code and Type Name are required.", + }); + return; + } + + setSubmitting(true); + try { + await updateLabelType(type.id, form); + toast.success("Label type updated.", { + description: "The label type has been updated successfully.", + }); + onOpenChange(false); + onUpdated(); + } catch (e: any) { + toast.error("Failed to update label type.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + } finally { + setSubmitting(false); + } + }; + + return ( + + + + Edit Label Type + + Update the label type details. + + + +
+
+
+ + setForm((p) => ({ ...p, typeCode: e.target.value }))} + /> +
+
+ + setForm((p) => ({ ...p, typeName: e.target.value }))} + /> +
+
+ +
+
+ + setForm((p) => ({ ...p, orderNum: e.target.value ? Number(e.target.value) : null }))} + /> +
+
+
Enabled
+ setForm((p) => ({ ...p, state: checked }))} /> +
+
+
+ + + + + +
+
+ ); +} + +function DeleteLabelTypeDialog({ + open, + type, + onOpenChange, + onDeleted, +}: { + open: boolean; + type: LabelTypeDto | null; + onOpenChange: (open: boolean) => void; + onDeleted: () => void; +}) { + const [submitting, setSubmitting] = useState(false); + + const name = useMemo(() => { + const n = (type?.typeName ?? "").trim(); + return n || type?.typeCode || "this type"; + }, [type]); + + const submit = async () => { + if (!type?.id) return; + setSubmitting(true); + try { + await deleteLabelType(type.id); + toast.success("Label type deleted.", { + description: "The label type has been removed successfully.", + }); + onOpenChange(false); + onDeleted(); + } catch (e: any) { + toast.error("Failed to delete label type.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + } finally { + setSubmitting(false); + } + }; + + return ( + + + + Delete Label Type + This action cannot be undone. + + +
+ Are you sure you want to delete {name}? +
+ + + + + +
+
+ ); +} diff --git a/美国版/Food Labeling Management Platform/src/components/labels/LabelsList.tsx b/美国版/Food Labeling Management Platform/src/components/labels/LabelsList.tsx index 9ce5d56..c107da6 100755 --- a/美国版/Food Labeling Management Platform/src/components/labels/LabelsList.tsx +++ b/美国版/Food Labeling Management Platform/src/components/labels/LabelsList.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect, useMemo, useRef, useState, useCallback } from 'react'; import { Table, TableBody, @@ -16,130 +16,1164 @@ import { SelectTrigger, SelectValue, } from "../ui/select"; -import { Plus } from "lucide-react"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from "../ui/dialog"; +import { Label } from "../ui/label"; +import { Switch } from "../ui/switch"; +import { Badge } from "../ui/badge"; +import { Plus, Edit, MoreHorizontal, ChevronsUpDown } from "lucide-react"; +import { toast } from "sonner"; +import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover"; +import { Checkbox } from "../ui/checkbox"; +import { SearchableSelect } from "../ui/searchable-select"; +import { + Command, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList, +} from "../ui/command"; +import { + Pagination, + PaginationContent, + PaginationItem, + PaginationLink, + PaginationNext, + PaginationPrevious, +} from "../ui/pagination"; +import { getLabels, getLabel, createLabel, updateLabel, deleteLabel } from "../../services/labelService"; +import type { LabelDto, LabelCreateInput, LabelUpdateInput } from "../../types/label"; +import { getLocations } from "../../services/locationService"; +import { getLabelCategories } from "../../services/labelCategoryService"; +import { getLabelTypes } from "../../services/labelTypeService"; +import { getLabelTemplates } from "../../services/labelTemplateService"; +import { getProducts } from "../../services/productService"; +import type { LocationDto } from "../../types/location"; +import type { LabelCategoryDto } from "../../types/labelCategory"; +import type { LabelTypeDto } from "../../types/labelType"; +import type { LabelTemplateDto } from "../../types/labelTemplate"; +import type { ProductDto } from "../../types/product"; -export function LabelsList() { - const labels = [ - { - id: 1, - location: 'Location A', - labelCategory: 'Prep', - productCategory: 'Meat', - product: 'Chicken', - template: '2"x2" Basic', - labelType: 'Defrost', - lastEdited: '2025.12.03.11:45', - hasError: false - }, - { - id: 2, - location: 'Location A', - labelCategory: 'Prep', - productCategory: 'Meat', - product: 'Chicken', - template: '2"x2" Basic', - labelType: 'Opened/Preped', - lastEdited: '2025.12.03.11:45', - hasError: false - }, - { - id: 3, - location: 'Location A', - labelCategory: 'Prep', - productCategory: 'Meat', - product: 'Chicken', - template: '2"x2" Basic', - labelType: 'Heated', - lastEdited: '2025.12.03.11:45', - hasError: false - }, - { - id: 4, - location: 'Location A', - labelCategory: "Grab'n'Go", - productCategory: 'Sandwich', - product: 'Chicken Sandwich', - template: '2"x6" G\'n\'G', - labelType: '', - lastEdited: '2025.12.03.11:45', - hasError: true +function toDisplay(v: string | null | undefined): string { + const s = (v ?? "").trim(); + return s ? s : "None"; +} + +/** 列表行:标签编码(接口可能只返回 id 为 LabelCode) */ +function labelRowCode(item: LabelDto): string { + const c = (item.labelCode ?? item.id ?? "").trim(); + return c || "None"; +} + +/** 列表行:产品列(优先展示名称,否则展示绑定数量) */ +function labelRowProductsText(item: LabelDto): string { + const pn = (item.productName ?? "").trim(); + if (pn) return pn; + const n = item.productIds?.length ?? 0; + if (n > 0) return `${n} product(s)`; + return "None"; +} + +/** 列表行:最后编辑时间 */ +function labelRowLastEdited(item: LabelDto): string { + const le = (item.lastEdited ?? "").trim(); + if (le) return le; + const ct = item.creationTime; + if (ct) { + try { + return new Date(ct).toLocaleString(); + } catch { + return String(ct); + } + } + return "None"; +} + +/** 详情 / 列表行 → 编辑表单(列表接口可能缺 ID 字段,需再以 GET 详情补全) */ +function labelDtoToUpdateForm(d: LabelDto): LabelUpdateInput { + const ids = d.productIds; + return { + labelName: d.labelName ?? "", + templateCode: d.templateCode ?? "", + locationId: d.locationId ?? "", + labelCategoryId: d.labelCategoryId ?? "", + labelTypeId: d.labelTypeId ?? "", + productIds: Array.isArray(ids) ? [...ids] : [], + labelInfoJson: d.labelInfoJson ?? null, + state: d.state ?? true, + }; +} + +type ProductOptionRow = { id: string; name: string }; + +function templateListCode(t: LabelTemplateDto): string { + return (t.templateCode ?? t.id ?? "").trim(); +} + +function templateListLabel(t: LabelTemplateDto): string { + const name = (t.templateName ?? t.name ?? "").trim() || "None"; + const code = templateListCode(t) || "None"; + return `${name} (${code})`; +} + +function useLabelFormReferenceData(open: boolean) { + const [loading, setLoading] = useState(false); + const [templates, setTemplates] = useState([]); + const [locations, setLocations] = useState([]); + const [categories, setCategories] = useState([]); + const [types, setTypes] = useState([]); + const [products, setProducts] = useState([]); + + useEffect(() => { + if (!open) return; + let cancelled = false; + (async () => { + setLoading(true); + try { + const [tplRes, locRes, catRes, typeRes, prodRes] = await Promise.all([ + getLabelTemplates({ skipCount: 0, maxResultCount: 500 }), + getLocations({ skipCount: 0, maxResultCount: 500 }), + getLabelCategories({ skipCount: 0, maxResultCount: 500 }), + getLabelTypes({ skipCount: 0, maxResultCount: 500 }), + getProducts({ skipCount: 0, maxResultCount: 500 }), + ]); + if (cancelled) return; + setTemplates(tplRes.items ?? []); + setLocations(locRes.items ?? []); + setCategories(catRes.items ?? []); + setTypes(typeRes.items ?? []); + setProducts(prodRes.items ?? []); + } catch (e: any) { + if (!cancelled) { + toast.error("Failed to load options", { + description: e?.message ? String(e.message) : "Check network or sign-in.", + }); + setTemplates([]); + setLocations([]); + setCategories([]); + setTypes([]); + setProducts([]); + } + } finally { + if (!cancelled) setLoading(false); + } + })(); + return () => { + cancelled = true; + }; + }, [open]); + + const productOptions: ProductOptionRow[] = useMemo( + () => + products.map((p) => { + const name = + (p.productName ?? p.productCode ?? "").trim() || p.id; + return { id: p.id, name }; + }), + [products], + ); + + return { loading, templates, locations, categories, types, productOptions }; +} + +function ProductMultiSelectField({ + value, + onChange, + disabled, + productOptions, +}: { + value: string[]; + onChange: (next: string[]) => void; + disabled?: boolean; + productOptions: ProductOptionRow[]; +}) { + const [open, setOpen] = useState(false); + const summary = useMemo(() => { + if (value.length === 0) return "Select products (multi-select)"; + const names = value + .map((id) => productOptions.find((p) => p.id === id)?.name ?? id) + .slice(0, 2); + const more = value.length > 2 ? `, ${value.length} total` : ""; + return `${names.join(", ")}${more}`; + }, [value, productOptions]); + + const toggle = useCallback( + (id: string, checked: boolean) => { + const set = new Set(value); + if (checked) set.add(id); + else set.delete(id); + onChange(Array.from(set)); }, - ]; + [value, onChange], + ); + + const extraProductIds = useMemo( + () => value.filter((id) => !productOptions.some((p) => p.id === id)), + [value, productOptions], + ); return ( -
- {/* Toolbar: Search, All Locations, Bulk group (single rounded box), New Label */} -
- - -
- - - -
- -
+ + + + + + No matching products. + + {productOptions.map((p) => ( + { + toggle(p.id, !value.includes(p.id)); + }} + className="cursor-pointer" + > + + + {p.name} + {p.id} + + + ))} + {extraProductIds.length > 0 ? ( + + {extraProductIds.map((id) => ( + { + toggle(id, !value.includes(id)); + }} + className="cursor-pointer" + > + + {id} + + ))} + + ) : null} + + + + + + ); +} + +export function LabelsList() { + const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false); + const [isEditDialogOpen, setIsEditDialogOpen] = useState(false); + const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false); + const [editingLabel, setEditingLabel] = useState(null); + const [deletingLabel, setDeletingLabel] = useState(null); + const [labels, setLabels] = useState([]); + const [loading, setLoading] = useState(false); + const [total, setTotal] = useState(0); + const [refreshSeq, setRefreshSeq] = useState(0); + const [actionsOpenForId, setActionsOpenForId] = useState(null); + + const [keyword, setKeyword] = useState(""); + const [locationFilter, setLocationFilter] = useState("all"); + const [labelCategoryFilter, setLabelCategoryFilter] = useState("all"); + const [labelTypeFilter, setLabelTypeFilter] = useState("all"); + const [templateFilter, setTemplateFilter] = useState("all"); + const [stateFilter, setStateFilter] = useState("all"); + + const [pageIndex, setPageIndex] = useState(1); + const [pageSize, setPageSize] = useState(10); + + const abortRef = useRef(null); + const keywordTimerRef = useRef(null); + const [debouncedKeyword, setDebouncedKeyword] = useState(""); + + useEffect(() => { + if (keywordTimerRef.current) window.clearTimeout(keywordTimerRef.current); + keywordTimerRef.current = window.setTimeout(() => setDebouncedKeyword(keyword.trim()), 300); + return () => { + if (keywordTimerRef.current) window.clearTimeout(keywordTimerRef.current); + }; + }, [keyword]); + + const totalPages = Math.max(1, Math.ceil(total / pageSize)); + + useEffect(() => { + setPageIndex(1); + }, [debouncedKeyword, locationFilter, labelCategoryFilter, labelTypeFilter, templateFilter, stateFilter, pageSize]); - {/* Warning Text */} -
- One or more of your labels are missing fields from their templates (! ! ! 1 in total). + useEffect(() => { + const run = async () => { + abortRef.current?.abort(); + const ac = new AbortController(); + abortRef.current = ac; + + setLoading(true); + try { + const skipCount = (pageIndex - 1) * pageSize; + const res = await getLabels( + { + skipCount, + maxResultCount: pageSize, + keyword: debouncedKeyword || undefined, + locationId: locationFilter !== "all" ? locationFilter : undefined, + labelCategoryId: labelCategoryFilter !== "all" ? labelCategoryFilter : undefined, + labelTypeId: labelTypeFilter !== "all" ? labelTypeFilter : undefined, + templateCode: templateFilter !== "all" ? templateFilter : undefined, + state: stateFilter === "all" ? undefined : stateFilter === "true", + }, + ac.signal, + ); + + setLabels(res.items ?? []); + setTotal(res.totalCount ?? 0); + } catch (e: any) { + if (e?.name === "AbortError") return; + toast.error("Failed to load labels.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + setLabels([]); + setTotal(0); + } finally { + setLoading(false); + } + }; + + run(); + return () => abortRef.current?.abort(); + }, [debouncedKeyword, locationFilter, labelCategoryFilter, labelTypeFilter, templateFilter, stateFilter, pageIndex, pageSize, refreshSeq]); + + const refreshList = () => setRefreshSeq((x) => x + 1); + + const openEdit = (label: LabelDto) => { + setActionsOpenForId(null); + setEditingLabel(label); + setIsEditDialogOpen(true); + }; + + const openDelete = (label: LabelDto) => { + setActionsOpenForId(null); + setDeletingLabel(label); + setIsDeleteDialogOpen(true); + }; + + return ( +
+
+
+
+ setKeyword(e.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" + /> + + + + +
+ +
+
- {/* Table */} -
- - - - Location - Label Category - Product Category - Product - Template - Label Type - Last Edited - - - - {labels.map((label) => ( - - {label.location} - {label.labelCategory} - {label.productCategory} - {label.product} - - {label.template} - {label.hasError && ( - ! ! ! - )} - - {label.labelType || '-'} - {label.lastEdited} +
+
+
+ + + Label Code + Label Name + Location + Category + Type + Template + Products + State + Last Edited + Actions - ))} - -
+ + + {loading ? ( + + + Loading... + + + ) : labels.length === 0 ? ( + + + No results. + + + ) : ( + labels.map((item) => ( + + {labelRowCode(item)} + {toDisplay(item.labelName)} + + {toDisplay(item.locationName ?? item.locationId)} + + + {toDisplay(item.labelCategoryName ?? item.labelCategoryId)} + + + {toDisplay(item.labelTypeName ?? item.labelTypeId)} + + + {toDisplay(item.templateName ?? item.templateCode)} + + {labelRowProductsText(item)} + + + {item.state === true ? "Active" : "Inactive"} + + + + {labelRowLastEdited(item)} + + + setActionsOpenForId(open ? item.id : null)} + > + + + + + + + + + + + )) + )} + + +
+ +
+
+
+ Showing {total === 0 ? 0 : (pageIndex - 1) * pageSize + 1}- + {Math.min(pageIndex * pageSize, total)} of {total} +
+
+ + + + + { + e.preventDefault(); + setPageIndex((p) => Math.max(1, p - 1)); + }} + aria-disabled={pageIndex <= 1} + className={pageIndex <= 1 ? "pointer-events-none opacity-50" : ""} + /> + + + e.preventDefault()} + > + Page {pageIndex} / {totalPages} + + + + { + e.preventDefault(); + setPageIndex((p) => Math.min(totalPages, p + 1)); + }} + aria-disabled={pageIndex >= totalPages} + className={pageIndex >= totalPages ? "pointer-events-none opacity-50" : ""} + /> + + + +
+
+
+ + { + setPageIndex(1); + refreshList(); + }} + /> + + { + setIsEditDialogOpen(open); + if (!open) setEditingLabel(null); + }} + onUpdated={refreshList} + /> + + { + setIsDeleteDialogOpen(open); + if (!open) setDeletingLabel(null); + }} + onDeleted={refreshList} + />
); } + +function CreateLabelDialog({ + open, + onOpenChange, + onCreated, +}: { + open: boolean; + onOpenChange: (open: boolean) => void; + onCreated: () => void; +}) { + const { loading: refLoading, templates, locations, categories, types, productOptions } = + useLabelFormReferenceData(open); + const [submitting, setSubmitting] = useState(false); + const [form, setForm] = useState({ + labelCode: "", + labelName: "", + templateCode: "", + locationId: "", + labelCategoryId: "", + labelTypeId: "", + productIds: [], + labelInfoJson: null, + state: true, + }); + + const resetForm = () => { + setForm({ + labelCode: "", + labelName: "", + templateCode: "", + locationId: "", + labelCategoryId: "", + labelTypeId: "", + productIds: [], + labelInfoJson: null, + state: true, + }); + }; + + useEffect(() => { + if (!open) { + resetForm(); + } + }, [open]); + + const submit = async () => { + if (!form.labelCode.trim() || !form.labelName.trim() || !form.templateCode.trim() || !form.locationId.trim() || !form.labelCategoryId.trim() || !form.labelTypeId.trim()) { + toast.error("Validation failed", { + description: "Fill all required fields and select template, location, category, and type.", + }); + return; + } + if (form.productIds.length === 0) { + toast.error("Validation failed", { + description: "Select at least one product.", + }); + return; + } + + setSubmitting(true); + try { + await createLabel(form); + toast.success("Label created.", { + description: "The label has been created successfully.", + }); + onOpenChange(false); + onCreated(); + } catch (e: any) { + toast.error("Failed to create label.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + } finally { + setSubmitting(false); + } + }; + + const templateOptions = useMemo( + () => + templates + .filter((t) => templateListCode(t)) + .map((t) => ({ + value: templateListCode(t), + label: templateListLabel(t), + })), + [templates], + ); + + const locationOptions = useMemo( + () => + locations.map((loc) => ({ + value: loc.id, + label: toDisplay(loc.locationName ?? loc.locationCode ?? loc.id), + })), + [locations], + ); + + const categoryOptions = useMemo( + () => + categories.map((c) => ({ + value: c.id, + label: toDisplay(c.categoryName ?? c.categoryCode ?? c.id), + })), + [categories], + ); + + const typeOptions = useMemo( + () => + types.map((ty) => ({ + value: ty.id, + label: toDisplay(ty.typeName ?? ty.typeCode ?? ty.id), + })), + [types], + ); + + return ( + + + + Add New Label + Enter the details for the new label. + + +
+
+
+ + setForm((p) => ({ ...p, labelCode: e.target.value }))} + /> +
+
+ + setForm((p) => ({ ...p, labelName: e.target.value }))} + /> +
+
+ +
+
+ + setForm((p) => ({ ...p, templateCode: v }))} + options={templateOptions} + placeholder="Select template" + searchPlaceholder="Search template…" + emptyText="No templates found." + disabled={refLoading} + /> +
+
+ + setForm((p) => ({ ...p, locationId: v }))} + options={locationOptions} + placeholder="Select location" + searchPlaceholder="Search location…" + emptyText="No locations found." + disabled={refLoading} + /> +
+
+ +
+
+ + setForm((p) => ({ ...p, labelCategoryId: v }))} + options={categoryOptions} + placeholder="Select category" + searchPlaceholder="Search category…" + emptyText="No categories found." + disabled={refLoading} + /> +
+
+ + setForm((p) => ({ ...p, labelTypeId: v }))} + options={typeOptions} + placeholder="Select type" + searchPlaceholder="Search type…" + emptyText="No types found." + disabled={refLoading} + /> +
+
+ +
+ + setForm((p) => ({ ...p, productIds: next }))} + disabled={refLoading} + productOptions={productOptions} + /> +
+ +
+
Enabled
+ setForm((p) => ({ ...p, state: checked }))} /> +
+
+ + + + + +
+
+ ); +} + +function EditLabelDialog({ + open, + label, + onOpenChange, + onUpdated, +}: { + open: boolean; + label: LabelDto | null; + onOpenChange: (open: boolean) => void; + onUpdated: () => void; +}) { + const { loading: refLoading, templates, locations, categories, types, productOptions } = + useLabelFormReferenceData(open); + const [submitting, setSubmitting] = useState(false); + const [detailLoading, setDetailLoading] = useState(false); + const [form, setForm] = useState({ + labelName: "", + templateCode: "", + locationId: "", + labelCategoryId: "", + labelTypeId: "", + productIds: [], + labelInfoJson: null, + state: true, + }); + + useEffect(() => { + if (!open || !label?.id) return; + + const id = label.id; + setForm(labelDtoToUpdateForm(label)); + + const ac = new AbortController(); + let cancelled = false; + setDetailLoading(true); + (async () => { + try { + const detail = await getLabel(id, ac.signal); + if (cancelled) return; + setForm(labelDtoToUpdateForm(detail)); + } catch (e: any) { + if (cancelled || e?.name === "AbortError") return; + toast.error("Failed to load label details.", { + description: e?.message ? String(e.message) : "Form shows list data only; check network.", + }); + } finally { + if (!cancelled) setDetailLoading(false); + } + })(); + + return () => { + cancelled = true; + ac.abort(); + }; + }, [open, label]); + + const submit = async () => { + if (!label?.id) return; + if (!form.labelName.trim() || !form.templateCode.trim() || !form.locationId.trim() || !form.labelCategoryId.trim() || !form.labelTypeId.trim()) { + toast.error("Validation failed", { + description: "Fill all required fields and select template, location, category, and type.", + }); + return; + } + if (form.productIds.length === 0) { + toast.error("Validation failed", { + description: "Select at least one product.", + }); + return; + } + + setSubmitting(true); + try { + await updateLabel(label.id, form); + toast.success("Label updated.", { + description: "The label has been updated successfully.", + }); + onOpenChange(false); + onUpdated(); + } catch (e: any) { + toast.error("Failed to update label.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + } finally { + setSubmitting(false); + } + }; + + const editTemplateOptions = useMemo(() => { + const base = templates + .filter((t) => templateListCode(t)) + .map((t) => ({ + value: templateListCode(t), + label: templateListLabel(t), + })); + const c = form.templateCode; + if (c && !base.some((o) => o.value === c)) { + return [{ value: c, label: `${c} (current)` }, ...base]; + } + return base; + }, [templates, form.templateCode]); + + const editLocationOptions = useMemo(() => { + const base = locations.map((loc) => ({ + value: loc.id, + label: toDisplay(loc.locationName ?? loc.locationCode ?? loc.id), + })); + const id = form.locationId; + if (id && !base.some((o) => o.value === id)) { + return [{ value: id, label: `${id} (current)` }, ...base]; + } + return base; + }, [locations, form.locationId]); + + const editCategoryOptions = useMemo(() => { + const base = categories.map((c) => ({ + value: c.id, + label: toDisplay(c.categoryName ?? c.categoryCode ?? c.id), + })); + const id = form.labelCategoryId; + if (id && !base.some((o) => o.value === id)) { + return [{ value: id, label: `${id} (current)` }, ...base]; + } + return base; + }, [categories, form.labelCategoryId]); + + const editTypeOptions = useMemo(() => { + const base = types.map((ty) => ({ + value: ty.id, + label: toDisplay(ty.typeName ?? ty.typeCode ?? ty.id), + })); + const id = form.labelTypeId; + if (id && !base.some((o) => o.value === id)) { + return [{ value: id, label: `${id} (current)` }, ...base]; + } + return base; + }, [types, form.labelTypeId]); + + return ( + + + + Edit Label + + {detailLoading ? "Loading label details…" : "Update the label details."} + + + +
+
+ + setForm((p) => ({ ...p, labelName: e.target.value }))} + disabled={detailLoading} + /> +
+ +
+
+ + setForm((p) => ({ ...p, templateCode: v }))} + options={editTemplateOptions} + placeholder="Select template" + searchPlaceholder="Search template…" + emptyText="No templates found." + disabled={refLoading || detailLoading} + /> +
+
+ + setForm((p) => ({ ...p, locationId: v }))} + options={editLocationOptions} + placeholder="Select location" + searchPlaceholder="Search location…" + emptyText="No locations found." + disabled={refLoading || detailLoading} + /> +
+
+ +
+
+ + setForm((p) => ({ ...p, labelCategoryId: v }))} + options={editCategoryOptions} + placeholder="Select category" + searchPlaceholder="Search category…" + emptyText="No categories found." + disabled={refLoading || detailLoading} + /> +
+
+ + setForm((p) => ({ ...p, labelTypeId: v }))} + options={editTypeOptions} + placeholder="Select type" + searchPlaceholder="Search type…" + emptyText="No types found." + disabled={refLoading || detailLoading} + /> +
+
+ +
+ + setForm((p) => ({ ...p, productIds: next }))} + disabled={refLoading || detailLoading} + productOptions={productOptions} + /> +
+ +
+
Enabled
+ setForm((p) => ({ ...p, state: checked }))} + disabled={detailLoading} + /> +
+
+ + + + + +
+
+ ); +} + +function DeleteLabelDialog({ + open, + label, + onOpenChange, + onDeleted, +}: { + open: boolean; + label: LabelDto | null; + onOpenChange: (open: boolean) => void; + onDeleted: () => void; +}) { + const [submitting, setSubmitting] = useState(false); + + const name = useMemo(() => { + const n = (label?.labelName ?? "").trim(); + return n || label?.labelCode || label?.id || "this label"; + }, [label]); + + const submit = async () => { + if (!label?.id) return; + setSubmitting(true); + try { + await deleteLabel(label.id); + toast.success("Label deleted.", { + description: "The label has been removed successfully.", + }); + onOpenChange(false); + onDeleted(); + } catch (e: any) { + toast.error("Failed to delete label.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + } finally { + setSubmitting(false); + } + }; + + return ( + + + + Delete Label + This action cannot be undone. + + +
+ Are you sure you want to delete {name}? +
+ + + + + +
+
+ ); +} diff --git a/美国版/Food Labeling Management Platform/src/components/labels/MultipleOptionsView.tsx b/美国版/Food Labeling Management Platform/src/components/labels/MultipleOptionsView.tsx index 062396a..343fa06 100755 --- a/美国版/Food Labeling Management Platform/src/components/labels/MultipleOptionsView.tsx +++ b/美国版/Food Labeling Management Platform/src/components/labels/MultipleOptionsView.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect, useMemo, useRef, useState } from 'react'; import { Table, TableBody, @@ -16,75 +16,784 @@ import { SelectTrigger, SelectValue, } from "../ui/select"; -import { Plus } from "lucide-react"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from "../ui/dialog"; +import { Label } from "../ui/label"; +import { Switch } from "../ui/switch"; +import { Badge } from "../ui/badge"; +import { Plus, Edit, MoreHorizontal, X } from "lucide-react"; +import { toast } from "sonner"; +import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover"; +import { + Pagination, + PaginationContent, + PaginationItem, + PaginationLink, + PaginationNext, + PaginationPrevious, +} from "../ui/pagination"; +import { + getLabelMultipleOptions, + getLabelMultipleOption, + createLabelMultipleOption, + updateLabelMultipleOption, + deleteLabelMultipleOption, +} from "../../services/labelMultipleOptionService"; +import type { + LabelMultipleOptionDto, + LabelMultipleOptionCreateInput, + LabelMultipleOptionUpdateInput, +} from "../../types/labelMultipleOption"; + +function toDisplay(v: string | null | undefined): string { + const s = (v ?? "").trim(); + return s ? s : "None"; +} export function MultipleOptionsView() { - const options = [ - { - id: 1, - name: 'Prepped By', - contents: 'A. Smith; B. Doe; C. Borne', - lastEdited: '2025.12.03.11:45', - }, - { - id: 2, - name: 'Checked By', - contents: 'D. Manager; E. Supervisor', - lastEdited: '2025.12.04.09:30', - }, - { - id: 3, - name: 'Allergens', - contents: 'Peanuts; Dairy; Gluten; Soy', - lastEdited: '2025.12.05.14:15', - }, - ]; + const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false); + const [isEditDialogOpen, setIsEditDialogOpen] = useState(false); + const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false); + const [editingOption, setEditingOption] = useState(null); + const [deletingOption, setDeletingOption] = useState(null); + const [options, setOptions] = useState([]); + const [loading, setLoading] = useState(false); + const [total, setTotal] = useState(0); + const [refreshSeq, setRefreshSeq] = useState(0); + const [actionsOpenForId, setActionsOpenForId] = useState(null); + + const [keyword, setKeyword] = useState(""); + const [stateFilter, setStateFilter] = useState("all"); + + const [pageIndex, setPageIndex] = useState(1); + const [pageSize, setPageSize] = useState(10); + + const abortRef = useRef(null); + const keywordTimerRef = useRef(null); + const [debouncedKeyword, setDebouncedKeyword] = useState(""); + + useEffect(() => { + if (keywordTimerRef.current) window.clearTimeout(keywordTimerRef.current); + keywordTimerRef.current = window.setTimeout(() => setDebouncedKeyword(keyword.trim()), 300); + return () => { + if (keywordTimerRef.current) window.clearTimeout(keywordTimerRef.current); + }; + }, [keyword]); + + const totalPages = Math.max(1, Math.ceil(total / pageSize)); + + useEffect(() => { + setPageIndex(1); + }, [debouncedKeyword, stateFilter, pageSize]); + + useEffect(() => { + const run = async () => { + abortRef.current?.abort(); + const ac = new AbortController(); + abortRef.current = ac; + + setLoading(true); + try { + const skipCount = (pageIndex - 1) * pageSize; + const res = await getLabelMultipleOptions( + { + skipCount, + maxResultCount: pageSize, + keyword: debouncedKeyword || undefined, + state: stateFilter === "all" ? undefined : stateFilter === "true", + }, + ac.signal, + ); + + setOptions(res.items ?? []); + setTotal(res.totalCount ?? 0); + } catch (e: any) { + if (e?.name === "AbortError") return; + toast.error("Failed to load multiple options.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + setOptions([]); + setTotal(0); + } finally { + setLoading(false); + } + }; + + run(); + return () => abortRef.current?.abort(); + }, [debouncedKeyword, stateFilter, pageIndex, pageSize, refreshSeq]); + + const refreshList = () => setRefreshSeq((x) => x + 1); + + const openEdit = (opt: LabelMultipleOptionDto) => { + setActionsOpenForId(null); + setEditingOption(opt); + setIsEditDialogOpen(true); + }; + + const openDelete = (opt: LabelMultipleOptionDto) => { + setActionsOpenForId(null); + setDeletingOption(opt); + setIsDeleteDialogOpen(true); + }; return ( -
- {/* Top Controls - single row, style consistent with other Label views */} -
- - - +
+
+
+
+ setKeyword(e.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" + /> + +
+ +
+
- {/* Table */} -
- - - - Multiple Option Name - Contents - Last Edited - - - - {options.map((item) => ( - - {item.name} - {item.contents} - {item.lastEdited} +
+
+
+ + + Multiple Option Name + Option Code + Contents + State + Order + Last Edited + Actions - ))} - -
+ + + {loading ? ( + + + Loading... + + + ) : options.length === 0 ? ( + + + No results. + + + ) : ( + options.map((item) => ( + + {toDisplay(item.optionName)} + {toDisplay(item.optionCode)} + + {item.optionValuesJson && item.optionValuesJson.length > 0 + ? item.optionValuesJson.join("; ") + : "None"} + + + + {item.state ? "Active" : "Inactive"} + + + {item.orderNum ?? "None"} + + {item.creationTime ? new Date(item.creationTime).toLocaleString() : "None"} + + + setActionsOpenForId(open ? item.id : null)} + > + + + + + + + + + + + )) + )} + + +
+
+ +
+
+
+ Showing {total === 0 ? 0 : (pageIndex - 1) * pageSize + 1}- + {Math.min(pageIndex * pageSize, total)} of {total} +
+
+ + + + + { + e.preventDefault(); + setPageIndex((p) => Math.max(1, p - 1)); + }} + aria-disabled={pageIndex <= 1} + className={pageIndex <= 1 ? "pointer-events-none opacity-50" : ""} + /> + + + e.preventDefault()} + > + Page {pageIndex} / {totalPages} + + + + { + e.preventDefault(); + setPageIndex((p) => Math.min(totalPages, p + 1)); + }} + aria-disabled={pageIndex >= totalPages} + className={pageIndex >= totalPages ? "pointer-events-none opacity-50" : ""} + /> + + + +
+
+ + { + setPageIndex(1); + refreshList(); + }} + /> + + { + setIsEditDialogOpen(open); + if (!open) setEditingOption(null); + }} + onUpdated={refreshList} + /> + + { + setIsDeleteDialogOpen(open); + if (!open) setDeletingOption(null); + }} + onDeleted={refreshList} + />
); } + +function CreateMultipleOptionDialog({ + open, + onOpenChange, + onCreated, +}: { + open: boolean; + onOpenChange: (open: boolean) => void; + onCreated: () => void; +}) { + const [submitting, setSubmitting] = useState(false); + const [form, setForm] = useState({ + optionCode: "", + optionName: "", + optionValuesJson: [], + state: true, + orderNum: null, + }); + const [newValue, setNewValue] = useState(""); + + const resetForm = () => { + setForm({ + optionCode: "", + optionName: "", + optionValuesJson: [], + state: true, + orderNum: null, + }); + setNewValue(""); + }; + + useEffect(() => { + if (!open) { + resetForm(); + } + }, [open]); + + const addValue = () => { + const trimmed = newValue.trim(); + if (!trimmed) return; + if (form.optionValuesJson.includes(trimmed)) { + toast.error("Duplicate value", { + description: "This value already exists.", + }); + return; + } + setForm((p) => ({ + ...p, + optionValuesJson: [...p.optionValuesJson, trimmed], + })); + setNewValue(""); + }; + + const removeValue = (index: number) => { + setForm((p) => ({ + ...p, + optionValuesJson: p.optionValuesJson.filter((_, i) => i !== index), + })); + }; + + const submit = async () => { + if (!form.optionCode.trim() || !form.optionName.trim()) { + toast.error("Validation failed", { + description: "Option Code and Option Name are required.", + }); + return; + } + if (form.optionValuesJson.length === 0) { + toast.error("Validation failed", { + description: "At least one option value is required.", + }); + return; + } + + setSubmitting(true); + try { + await createLabelMultipleOption(form); + toast.success("Multiple option created.", { + description: "The multiple option has been created successfully.", + }); + onOpenChange(false); + onCreated(); + } catch (e: any) { + toast.error("Failed to create multiple option.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + } finally { + setSubmitting(false); + } + }; + + return ( + + + + Add New Multiple Option + + Enter the details for the new multiple option. + + + +
+
+
+ + setForm((p) => ({ ...p, optionCode: e.target.value }))} + /> +
+
+ + setForm((p) => ({ ...p, optionName: e.target.value }))} + /> +
+
+ +
+ +
+ setNewValue(e.target.value)} + onKeyDown={(e) => { + if (e.key === "Enter") { + e.preventDefault(); + addValue(); + } + }} + /> + +
+ {form.optionValuesJson.length > 0 && ( +
+ {form.optionValuesJson.map((val, idx) => ( + + {val} + + + ))} +
+ )} +
+ +
+
+ + setForm((p) => ({ ...p, orderNum: e.target.value ? Number(e.target.value) : null }))} + /> +
+
+
Enabled
+ setForm((p) => ({ ...p, state: checked }))} /> +
+
+
+ + + + + +
+
+ ); +} + +function EditMultipleOptionDialog({ + open, + option, + onOpenChange, + onUpdated, +}: { + open: boolean; + option: LabelMultipleOptionDto | null; + onOpenChange: (open: boolean) => void; + onUpdated: () => void; +}) { + const [submitting, setSubmitting] = useState(false); + const [form, setForm] = useState({ + optionCode: "", + optionName: "", + optionValuesJson: [], + state: true, + orderNum: null, + }); + const [newValue, setNewValue] = useState(""); + + useEffect(() => { + if (open && option) { + setForm({ + optionCode: option.optionCode ?? "", + optionName: option.optionName ?? "", + optionValuesJson: option.optionValuesJson ?? [], + state: option.state ?? true, + orderNum: option.orderNum ?? null, + }); + setNewValue(""); + } + }, [open, option]); + + const addValue = () => { + const trimmed = newValue.trim(); + if (!trimmed) return; + if (form.optionValuesJson.includes(trimmed)) { + toast.error("Duplicate value", { + description: "This value already exists.", + }); + return; + } + setForm((p) => ({ + ...p, + optionValuesJson: [...p.optionValuesJson, trimmed], + })); + setNewValue(""); + }; + + const removeValue = (index: number) => { + setForm((p) => ({ + ...p, + optionValuesJson: p.optionValuesJson.filter((_, i) => i !== index), + })); + }; + + const submit = async () => { + if (!option?.id) return; + if (!form.optionCode.trim() || !form.optionName.trim()) { + toast.error("Validation failed", { + description: "Option Code and Option Name are required.", + }); + return; + } + if (form.optionValuesJson.length === 0) { + toast.error("Validation failed", { + description: "At least one option value is required.", + }); + return; + } + + setSubmitting(true); + try { + await updateLabelMultipleOption(option.id, form); + toast.success("Multiple option updated.", { + description: "The multiple option has been updated successfully.", + }); + onOpenChange(false); + onUpdated(); + } catch (e: any) { + toast.error("Failed to update multiple option.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + } finally { + setSubmitting(false); + } + }; + + return ( + + + + Edit Multiple Option + + Update the multiple option details. + + + +
+
+
+ + setForm((p) => ({ ...p, optionCode: e.target.value }))} + /> +
+
+ + setForm((p) => ({ ...p, optionName: e.target.value }))} + /> +
+
+ +
+ +
+ setNewValue(e.target.value)} + onKeyDown={(e) => { + if (e.key === "Enter") { + e.preventDefault(); + addValue(); + } + }} + /> + +
+ {form.optionValuesJson.length > 0 && ( +
+ {form.optionValuesJson.map((val, idx) => ( + + {val} + + + ))} +
+ )} +
+ +
+
+ + setForm((p) => ({ ...p, orderNum: e.target.value ? Number(e.target.value) : null }))} + /> +
+
+
Enabled
+ setForm((p) => ({ ...p, state: checked }))} /> +
+
+
+ + + + + +
+
+ ); +} + +function DeleteMultipleOptionDialog({ + open, + option, + onOpenChange, + onDeleted, +}: { + open: boolean; + option: LabelMultipleOptionDto | null; + onOpenChange: (open: boolean) => void; + onDeleted: () => void; +}) { + const [submitting, setSubmitting] = useState(false); + + const name = useMemo(() => { + const n = (option?.optionName ?? "").trim(); + return n || option?.optionCode || "this option"; + }, [option]); + + const submit = async () => { + if (!option?.id) return; + setSubmitting(true); + try { + await deleteLabelMultipleOption(option.id); + toast.success("Multiple option deleted.", { + description: "The multiple option has been removed successfully.", + }); + onOpenChange(false); + onDeleted(); + } catch (e: any) { + toast.error("Failed to delete multiple option.", { + description: e?.message ? String(e.message) : "Please try again.", + }); + } finally { + setSubmitting(false); + } + }; + + return ( + + + + Delete Multiple Option + This action cannot be undone. + + +
+ Are you sure you want to delete {name}? +
+ + + + + +
+
+ ); +} diff --git a/美国版/Food Labeling Management Platform/src/components/people/PeopleView.tsx b/美国版/Food Labeling Management Platform/src/components/people/PeopleView.tsx index d5c6ae7..c2ee1eb 100755 --- a/美国版/Food Labeling Management Platform/src/components/people/PeopleView.tsx +++ b/美国版/Food Labeling Management Platform/src/components/people/PeopleView.tsx @@ -614,7 +614,7 @@ export function PeopleView() {
))} {(!m.locations?.length && !(m.locationIds?.length ?? 0)) && ( -
+
None
)}
@@ -1489,7 +1489,7 @@ function MemberDialog({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [open, member?.id]); - // 与新增一致:只判断必填项是否有值,有值即可点保存;无值则提交时弹提示 + // Same as create: Save enabled when required fields are filled; empty values show error on submit. const canSubmit = useMemo(() => { if (!fullName.trim()) return false; if (!userName.trim()) return false; diff --git a/美国版/Food Labeling Management Platform/src/components/products/ProductsView.tsx b/美国版/Food Labeling Management Platform/src/components/products/ProductsView.tsx index 1555db9..bfc092b 100755 --- a/美国版/Food Labeling Management Platform/src/components/products/ProductsView.tsx +++ b/美国版/Food Labeling Management Platform/src/components/products/ProductsView.tsx @@ -1,21 +1,5 @@ -import React, { useState } from 'react'; -import { - Search, - Plus, - Download, - Upload, - Edit, - Filter, - MoreHorizontal, - Check, - X, - Image as ImageIcon, - Type, - Palette, - Store, - Globe, - Barcode -} from 'lucide-react'; +import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import { Search, Plus, Download, Upload, Edit, MoreHorizontal, Image as ImageIcon, Package } from "lucide-react"; import { Button } from "../ui/button"; import { Input } from "../ui/input"; import { @@ -33,7 +17,6 @@ import { DialogFooter, DialogHeader, DialogTitle, - DialogTrigger, } from "../ui/dialog"; import { Select, @@ -42,160 +25,391 @@ import { SelectTrigger, SelectValue, } from "../ui/select"; -import { Tabs, TabsContent, TabsList, TabsTrigger } from "../ui/tabs"; import { Label } from "../ui/label"; import { Switch } from "../ui/switch"; import { Badge } from "../ui/badge"; -import { Checkbox } from "../ui/checkbox"; -import { ScrollArea } from "../ui/scroll-area"; - -// --- Mock Data --- - -const MOCK_LOCATIONS = [ - { id: '12345', name: 'Location 12345 - Downtown' }, - { id: '67890', name: 'Location 67890 - Uptown' }, - { id: '11111', name: 'Location 11111 - Airport' }, -]; - -const MOCK_CATEGORIES = [ - { id: 'cat1', name: 'Dairy', type: 'color', value: '#bfdbfe', status: 'active' }, - { id: 'cat2', name: 'Meat', type: 'image', value: 'meat.png', status: 'active' }, - { id: 'cat3', name: 'Bakery', type: 'text', value: 'Bakery', status: 'active' }, -]; - -const MOCK_PRODUCTS = [ - { - id: 'prod1', - locationId: '12345', - categoryId: 'cat1', - categoryName: 'Dairy', - name: 'Whole Milk', - productId: '2222222', - barcode: '123456789', - barcodeType: 'EAN-13', - status: 'active', - appearance: { type: 'text', value: 'Whole Milk' } - }, - { - id: 'prod2', - locationId: '12345', - categoryId: 'cat2', - categoryName: 'Meat', - name: 'Ground Beef', - productId: '3333333', - barcode: '113456789', - barcodeType: 'UPC-A', - status: 'active', - appearance: { type: 'color', value: '#ef4444' } - }, - { - id: 'prod3', - locationId: '67890', - categoryId: 'cat3', - categoryName: 'Bakery', - name: 'Croissant', - productId: '4444444', - barcode: '998877665', - barcodeType: 'EAN-8', - status: 'inactive', - appearance: { type: 'image', value: 'croissant.jpg' } - }, -]; - -// --- Components --- +import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover"; +import { toast } from "sonner"; +import { getLocations } from "../../services/locationService"; +import { getLabelCategories } from "../../services/labelCategoryService"; +import { + createProduct, + deleteProduct, + getProduct, + getProducts, + updateProduct, +} from "../../services/productService"; +import { + createProductLocation, + getProductIdsByLocation, + getProductLocations, + updateProductLocation, +} from "../../services/productLocationService"; +import type { LocationDto } from "../../types/location"; +import type { LabelCategoryDto } from "../../types/labelCategory"; +import type { ProductDto, ProductCreateInput, ProductUpdateInput } from "../../types/product"; +import { SearchableSelect } from "../ui/searchable-select"; + +function toDisplay(v: string | null | undefined): string { + const s = (v ?? "").trim(); + return s ? s : "—"; +} + +/** productId -> locationIds(用于列表展示与编辑前绑定) */ +async function buildProductLocationMap(signal?: AbortSignal): Promise> { + const map = new Map(); + try { + const res = await getProductLocations({ skipCount: 0, maxResultCount: 2000 }, signal); + for (const row of res.items ?? []) { + const pid = (row.productId ?? "").trim(); + const lid = (row.locationId ?? "").trim(); + if (!pid || !lid) continue; + if (!map.has(pid)) map.set(pid, []); + const arr = map.get(pid)!; + if (!arr.includes(lid)) arr.push(lid); + } + } catch { + /* 列表仍展示,门店列显示 — */ + } + return map; +} + +async function syncProductStoreBinding( + productId: string, + newLocationId: string, + previousLocationIds: string[], +): Promise { + const prev = [...new Set(previousLocationIds.filter(Boolean))]; + for (const locId of prev) { + if (locId === newLocationId) continue; + const current = await getProductIdsByLocation(locId); + if (current.includes(productId)) { + await updateProductLocation(locId, { + productIds: current.filter((x) => x !== productId), + }); + } + } + if (newLocationId.trim()) { + await createProductLocation({ locationId: newLocationId, productIds: [productId] }); + } +} export function ProductsView() { - const [activeTab, setActiveTab] = useState('products'); - const [products, setProducts] = useState(MOCK_PRODUCTS); - const [categories, setCategories] = useState(MOCK_CATEGORIES); - - // Dialog States + const [activeTab, setActiveTab] = useState<"products" | "categories">("products"); + const [products, setProducts] = useState([]); + const [total, setTotal] = useState(0); + const [loading, setLoading] = useState(false); + const [locationMap, setLocationMap] = useState>(new Map()); + const [locations, setLocations] = useState([]); + const [labelCategories, setLabelCategories] = useState([]); + + const [keyword, setKeyword] = useState(""); + const [debouncedKeyword, setDebouncedKeyword] = useState(""); + const keywordTimer = useRef(null); + const [locationFilter, setLocationFilter] = useState("all"); + const [categoryFilter, setCategoryFilter] = useState("all"); + const [stateFilter, setStateFilter] = useState("all"); + const [pageIndex, setPageIndex] = useState(1); + const [pageSize, setPageSize] = useState(10); + const [refreshSeq, setRefreshSeq] = useState(0); + + const abortRef = useRef(null); + const [isProductDialogOpen, setIsProductDialogOpen] = useState(false); const [isCategoryDialogOpen, setIsCategoryDialogOpen] = useState(false); + const [editingProduct, setEditingProduct] = useState(null); + const [deletingProduct, setDeletingProduct] = useState(null); + const [actionsOpenId, setActionsOpenId] = useState(null); + + useEffect(() => { + if (keywordTimer.current) window.clearTimeout(keywordTimer.current); + keywordTimer.current = window.setTimeout(() => setDebouncedKeyword(keyword.trim()), 300); + return () => { + if (keywordTimer.current) window.clearTimeout(keywordTimer.current); + }; + }, [keyword]); + + useEffect(() => { + let c = false; + (async () => { + try { + const [locRes, catRes] = await Promise.all([ + getLocations({ skipCount: 0, maxResultCount: 500 }), + getLabelCategories({ skipCount: 0, maxResultCount: 500 }), + ]); + if (c) return; + setLocations(locRes.items ?? []); + setLabelCategories(catRes.items ?? []); + } catch { + if (!c) { + setLocations([]); + setLabelCategories([]); + } + } + })(); + return () => { + c = true; + }; + }, []); + + useEffect(() => { + setPageIndex(1); + }, [debouncedKeyword, locationFilter, categoryFilter, stateFilter, pageSize]); + + const needClientFilter = locationFilter !== "all" || categoryFilter !== "all"; + + useEffect(() => { + if (activeTab !== "products") return; + + const run = async () => { + abortRef.current?.abort(); + const ac = new AbortController(); + abortRef.current = ac; + + setLoading(true); + try { + const map = await buildProductLocationMap(ac.signal); + if (ac.signal.aborted) return; + setLocationMap(map); + + if (needClientFilter) { + const res = await getProducts( + { + skipCount: 0, + maxResultCount: 500, + keyword: debouncedKeyword || undefined, + state: stateFilter === "all" ? undefined : stateFilter === "true", + }, + ac.signal, + ); + if (ac.signal.aborted) return; + let list = res.items ?? []; + if (locationFilter !== "all") { + const allowed = new Set(await getProductIdsByLocation(locationFilter)); + list = list.filter((p) => allowed.has(p.id)); + } + if (categoryFilter !== "all") { + list = list.filter((p) => (p.categoryName ?? "").trim() === categoryFilter); + } + const t = list.length; + setTotal(t); + const start = (pageIndex - 1) * pageSize; + setProducts(list.slice(start, start + pageSize)); + } else { + const skip = (pageIndex - 1) * pageSize; + const res = await getProducts( + { + skipCount: skip, + maxResultCount: pageSize, + keyword: debouncedKeyword || undefined, + state: stateFilter === "all" ? undefined : stateFilter === "true", + }, + ac.signal, + ); + if (ac.signal.aborted) return; + setProducts(res.items ?? []); + setTotal(res.totalCount ?? 0); + } + } catch (e: any) { + if (e?.name === "AbortError") return; + toast.error("Failed to load products", { + description: e?.message ? String(e.message) : "Please try again.", + }); + setProducts([]); + setTotal(0); + } finally { + if (!ac.signal.aborted) setLoading(false); + } + }; + + run(); + return () => abortRef.current?.abort(); + }, [ + activeTab, + debouncedKeyword, + locationFilter, + categoryFilter, + stateFilter, + pageIndex, + pageSize, + refreshSeq, + needClientFilter, + ]); + + const refresh = () => setRefreshSeq((x) => x + 1); + + const locationOptions = useMemo( + () => + locations.map((loc) => ({ + value: loc.id, + label: toDisplay(loc.locationName ?? loc.locationCode ?? loc.id), + })), + [locations], + ); + + const categoryNameOptions = useMemo( + () => + labelCategories.map((c) => ({ + value: (c.categoryName ?? c.categoryCode ?? c.id ?? "").trim(), + label: toDisplay(c.categoryName ?? c.categoryCode ?? c.id), + })).filter((o) => o.value), + [labelCategories], + ); + + const totalPages = Math.max(1, Math.ceil(total / pageSize)); + + const locationLabel = useCallback( + (id: string) => { + const loc = locations.find((l) => l.id === id); + return toDisplay(loc?.locationName ?? loc?.locationCode ?? id); + }, + [locations], + ); return (
- {/* Toolbar + Filters - one row, style consistent with Labels / Location Manager */}
-
+
setKeyword(e.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" />
- + - Partner A + All partners - + - Group B + All groups - + - Location 12345 All Locations + {locations.map((loc) => ( + + {toDisplay(loc.locationName ?? loc.locationCode ?? loc.id)} + + ))} - + All Categories - {categories.map(c => ( - {c.name} + {categoryNameOptions.map((o) => ( + + {o.label} + ))} +
- - - - {activeTab === 'products' ? ( - ) : ( - )}
- {/* Tabs - underline spans full width */}
@@ -203,366 +417,480 @@ export function ProductsView() {
- {/* Content Area - same padding as Labels */}
- {activeTab === 'products' ? ( + {activeTab === "products" ? (
- +
- Location ID - Product Category - Product - Product ID - Product Barcode - Status - Actions + Location + Product Category + Product + Product ID + Product Code + Status + Actions - {products.map((product) => ( - - {product.locationId} - {product.categoryName} - -
- {product.appearance.type === 'color' && ( -
- )} - {product.appearance.type === 'image' && ( - - )} - {product.name} -
- - {product.productId} - -
- {product.barcodeType} - {product.barcode} -
-
- - - {product.status} - - - - + {loading ? ( + + + Loading... - ))} - -
-
- ) : ( -
- - - - Category Name - Display Type - Preview - Status - Actions - - - - {categories.map((category) => ( - - {category.name} - {category.type} - - {category.type === 'color' && ( -
- )} - {category.type === 'image' && ( -
- -
- )} - {category.type === 'text' && ( -
- {category.value} -
- )} - - - - {category.status} - - - - + ) : products.length === 0 ? ( + + + No products found. - ))} + ) : ( + products.map((p) => { + const locIds = locationMap.get(p.id) ?? []; + const locText = + locIds.length === 0 + ? "—" + : locIds.map((id) => locationLabel(id)).join(", "); + const active = p.state !== false; + return ( + + + {locText} + + + {toDisplay(p.categoryName)} + + +
+ {p.productImageUrl ? ( + + ) : ( + + )} + {toDisplay(p.productName)} +
+
+ + {p.id} + + + {toDisplay(p.productCode)} + + + + {active ? "active" : "inactive"} + + + + setActionsOpenId(open ? p.id : null)} + > + + + + + + + + + +
+ ); + }) + )}
+
+ + Showing {total === 0 ? 0 : (pageIndex - 1) * pageSize + 1}- + {Math.min(pageIndex * pageSize, total)} of {total} + +
+ + + + Page {pageIndex} / {totalPages} + + +
+
+ ) : ( + )}
- {/* --- Modals --- */} - { + setIsProductDialogOpen(o); + if (!o) setEditingProduct(null); + }} + editing={editingProduct} + locationOptions={locationOptions} + categoryOptions={categoryNameOptions} + locationMap={locationMap} + onSaved={() => { + refresh(); + setIsProductDialogOpen(false); + setEditingProduct(null); + }} /> - - { + if (!o) setDeletingProduct(null); + }} + onDeleted={refresh} /> + + +
+ ); +} + +function CategoriesPlaceholderTab({ categories }: { categories: LabelCategoryDto[] }) { + return ( +
+ + + + Category Name + Code + Status + + + + {categories.length === 0 ? ( + + + No categories loaded. Use Labeling → Label Categories to manage. + + + ) : ( + categories.map((c) => ( + + {toDisplay(c.categoryName)} + {toDisplay(c.categoryCode)} + + + {c.state !== false ? "active" : "inactive"} + + + + )) + )} + +
); } -// --- Sub-components for Dialogs --- +function ProductFormDialog({ + open, + onOpenChange, + editing, + locationOptions, + categoryOptions, + locationMap, + onSaved, +}: { + open: boolean; + onOpenChange: (o: boolean) => void; + editing: ProductDto | null; + locationOptions: { value: string; label: string }[]; + categoryOptions: { value: string; label: string }[]; + locationMap: Map; + onSaved: () => void; +}) { + const [submitting, setSubmitting] = useState(false); + const [productCode, setProductCode] = useState(""); + const [productName, setProductName] = useState(""); + const [categoryName, setCategoryName] = useState(""); + const [productImageUrl, setProductImageUrl] = useState(""); + const [state, setState] = useState(true); + const [locationId, setLocationId] = useState(""); + + useEffect(() => { + if (!open) return; + if (editing) { + setProductCode(editing.productCode ?? ""); + setProductName(editing.productName ?? ""); + setCategoryName((editing.categoryName ?? "").trim()); + setProductImageUrl(editing.productImageUrl ?? ""); + setState(editing.state !== false); + const lids = locationMap.get(editing.id) ?? []; + setLocationId(lids[0] ?? ""); + } else { + setProductCode(""); + setProductName(""); + setCategoryName(""); + setProductImageUrl(""); + setState(true); + setLocationId(""); + } + }, [open, editing, locationMap]); + + const submit = async () => { + if (!productCode.trim() || !productName.trim()) { + toast.error("Validation", { description: "Product code and name are required." }); + return; + } + if (!locationId.trim()) { + toast.error("Validation", { description: "Select a store to bind this product." }); + return; + } + + const body: ProductCreateInput = { + productCode: productCode.trim(), + productName: productName.trim(), + categoryName: categoryName.trim() || null, + productImageUrl: productImageUrl.trim() || null, + state, + }; + + setSubmitting(true); + try { + if (editing) { + await updateProduct(editing.id, body as ProductUpdateInput); + const prev = locationMap.get(editing.id) ?? []; + await syncProductStoreBinding(editing.id, locationId.trim(), prev); + } else { + const created = await createProduct(body); + await createProductLocation({ locationId: locationId.trim(), productIds: [created.id] }); + } + toast.success(editing ? "Product updated." : "Product created."); + onSaved(); + } catch (e: any) { + toast.error(editing ? "Update failed" : "Create failed", { + description: e?.message ? String(e.message) : "", + }); + } finally { + setSubmitting(false); + } + }; -function CreateProductDialog({ open, onOpenChange, categories }: { open: boolean; onOpenChange: (open: boolean) => void; categories: any[] }) { - const [appearanceType, setAppearanceType] = useState('text'); - return ( - + - Add New Product + {editing ? "Edit Product" : "Add New Product"} - Create a new product. Fill in the details below. + {editing ? "Update product and store binding." : "Create a product and bind it to a store."} - -
- - {/* Basic Info */} -
-
- - -
-
- - -
-
+
- - + + setProductCode(e.target.value)} + placeholder="e.g. PRD_TEST_001" + />
- -
- - Active -
+ + setProductName(e.target.value)} + placeholder="e.g. Chicken" + />
- - {/* Barcode Section */} -
- -
-
- -
-
- -
-
- +
+ +
- - {/* Appearance Section */} -
- - - - Text - Color - Image - - - - - - - - - -
- {['#ef4444', '#f97316', '#f59e0b', '#84cc16', '#10b981', '#06b6d4', '#3b82f6', '#6366f1', '#a855f7', '#ec4899'].map(color => ( - -
-
- - - -
- - Click to upload or drag and drop -
-
-
+
+ + setProductImageUrl(e.target.value)} + placeholder="https://..." + />
- - {/* Scope Assignment */} -
- -
-
- - -
-
- - -
-
- {/* Mock Location Selector if specific is chosen */} -
- -
+
+ + +
+
+ Enabled +
-
- - + +
); } -function CreateCategoryDialog({ open, onOpenChange }: { open: boolean; onOpenChange: (open: boolean) => void }) { - const [appearanceType, setAppearanceType] = useState('text'); +function DeleteProductDialog({ + open, + product, + onOpenChange, + onDeleted, +}: { + open: boolean; + product: ProductDto | null; + onOpenChange: (o: boolean) => void; + onDeleted: () => void; +}) { + const [submitting, setSubmitting] = useState(false); + + const submit = async () => { + if (!product?.id) return; + setSubmitting(true); + try { + await deleteProduct(product.id); + toast.success("Product deleted."); + onOpenChange(false); + onDeleted(); + } catch (e: any) { + toast.error("Delete failed", { description: e?.message ? String(e.message) : "" }); + } finally { + setSubmitting(false); + } + }; + + return ( + + + + Delete product + This cannot be undone. + +

+ Delete {toDisplay(product?.productName)} ({toDisplay(product?.productCode)})? +

+ + + + +
+
+ ); +} +function CreateCategoryPlaceholderDialog({ + open, + onOpenChange, +}: { + open: boolean; + onOpenChange: (o: boolean) => void; +}) { return ( - + - Add New Category + Categories - Create a product category to organize your items. + Manage categories under Labeling → Label Categories (label module API). - -
-
- - -
- - {/* Appearance Section */} -
- - - - Text - Color - Image - - - - - - - - - -
- {['#bfdbfe', '#bbf7d0', '#fecaca', '#ddd6fe', '#fde68a'].map(color => ( - -
-
- - - -
- - Click to upload -
-
-
-
- -
-
- -
- - Active -
-
-
- - {/* Scope Assignment */} -
- -
-
- - -
-
- - -
-
-
- -
- - - +
diff --git a/美国版/Food Labeling Management Platform/src/components/ui/searchable-select.tsx b/美国版/Food Labeling Management Platform/src/components/ui/searchable-select.tsx new file mode 100644 index 0000000..a6b9a90 --- /dev/null +++ b/美国版/Food Labeling Management Platform/src/components/ui/searchable-select.tsx @@ -0,0 +1,120 @@ +"use client"; + +import * as React from "react"; +import { useState } from "react"; +import { ChevronsUpDown } from "lucide-react"; +import { cn } from "./utils"; +import { Button } from "./button"; +import { + Command, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList, +} from "./command"; +import { Popover, PopoverContent, PopoverTrigger } from "./popover"; + +export type SearchableSelectOption = { + value: string; + label: string; +}; + +export function SearchableSelect({ + value, + onValueChange, + options, + placeholder = "Select…", + searchPlaceholder = "Search…", + emptyText = "No matching results.", + disabled, + className, +}: { + /** 空字符串表示未选择 */ + value: string; + onValueChange: (next: string) => void; + options: SearchableSelectOption[]; + placeholder?: string; + searchPlaceholder?: string; + emptyText?: string; + disabled?: boolean; + className?: string; +}) { + const [open, setOpen] = useState(false); + const hit = value ? options.find((o) => o.value === value) : undefined; + const selectedLabel = value ? hit?.label ?? value : null; + + return ( + + + + + + + + + {emptyText} + + {options.map((opt) => ( + { + onValueChange(opt.value); + setOpen(false); + }} + className={cn( + "cursor-pointer rounded-md px-2 py-2 transition-colors", + "hover:bg-gray-100 hover:text-gray-900", + "data-[selected=true]:bg-gray-100", + value === opt.value && + "bg-blue-50 text-gray-900 font-medium data-[selected=true]:bg-blue-100", + )} + > + {opt.label} + + ))} + + + + {value ? ( +
+ +
+ ) : null} +
+
+ ); +} diff --git a/美国版/Food Labeling Management Platform/src/lib/apiClient.ts b/美国版/Food Labeling Management Platform/src/lib/apiClient.ts index 4b6d086..2830a4a 100644 --- a/美国版/Food Labeling Management Platform/src/lib/apiClient.ts +++ b/美国版/Food Labeling Management Platform/src/lib/apiClient.ts @@ -66,7 +66,7 @@ function getAbpErrorMessage(payload: unknown): string | null { } function normalizePagedResultShape(x: unknown): unknown { - // 部分接口直接把列表放在 data 里(无 items/totalCount) + // Some APIs return the list directly in `data` (no items/totalCount). if (Array.isArray(x)) { return { items: x, totalCount: x.length }; } @@ -99,6 +99,14 @@ function normalizePagedResultShape(x: unknown): unknown { items: (o as any).Data, }; } + // 有 items 但 totalCount 缺失时,避免分页总数恒为 0 + if (Array.isArray(o.items) && typeof o.totalCount !== "number") { + const tc = o.TotalCount; + return { + ...o, + totalCount: typeof tc === "number" ? tc : o.items.length, + }; + } return x; } diff --git a/美国版/Food Labeling Management Platform/src/services/labelCategoryService.ts b/美国版/Food Labeling Management Platform/src/services/labelCategoryService.ts new file mode 100644 index 0000000..8236c99 --- /dev/null +++ b/美国版/Food Labeling Management Platform/src/services/labelCategoryService.ts @@ -0,0 +1,78 @@ +import { createApiClient } from "../lib/apiClient"; +import type { + LabelCategoryCreateInput, + LabelCategoryDto, + LabelCategoryGetListInput, + LabelCategoryUpdateInput, + PagedResultDto, +} from "../types/labelCategory"; + +const api = createApiClient({ + getToken: () => { + try { + return localStorage.getItem("access_token") ?? localStorage.getItem("token") ?? null; + } catch { + return null; + } + }, +}); + +const PATH = "/label-category"; + +export async function getLabelCategories(input: LabelCategoryGetListInput, signal?: AbortSignal): Promise> { + return api.requestJson>({ + path: PATH, + method: "GET", + query: { + SkipCount: input.skipCount, + MaxResultCount: input.maxResultCount, + Sorting: input.sorting, + Keyword: input.keyword, + State: input.state, + }, + signal, + }); +} + +export async function getLabelCategory(id: string, signal?: AbortSignal): Promise { + return api.requestJson({ + path: `${PATH}/${encodeURIComponent(id)}`, + method: "GET", + signal, + }); +} + +export async function createLabelCategory(input: LabelCategoryCreateInput): Promise { + return api.requestJson({ + path: PATH, + method: "POST", + body: { + categoryCode: input.categoryCode, + categoryName: input.categoryName, + categoryPhotoUrl: input.categoryPhotoUrl, + state: input.state ?? true, + orderNum: input.orderNum, + }, + }); +} + +export async function updateLabelCategory(id: string, input: LabelCategoryUpdateInput): Promise { + return api.requestJson({ + path: `${PATH}/${encodeURIComponent(id)}`, + method: "PUT", + body: { + categoryCode: input.categoryCode, + categoryName: input.categoryName, + categoryPhotoUrl: input.categoryPhotoUrl, + state: input.state ?? true, + orderNum: input.orderNum, + }, + }); +} + +export async function deleteLabelCategory(id: string): Promise { + await api.requestJson({ + path: `${PATH}/${encodeURIComponent(id)}`, + method: "DELETE", + }); +} diff --git a/美国版/Food Labeling Management Platform/src/services/labelMultipleOptionService.ts b/美国版/Food Labeling Management Platform/src/services/labelMultipleOptionService.ts new file mode 100644 index 0000000..860f73f --- /dev/null +++ b/美国版/Food Labeling Management Platform/src/services/labelMultipleOptionService.ts @@ -0,0 +1,120 @@ +import { createApiClient } from "../lib/apiClient"; +import type { + LabelMultipleOptionCreateInput, + LabelMultipleOptionDto, + LabelMultipleOptionGetListInput, + LabelMultipleOptionUpdateInput, + PagedResultDto, +} from "../types/labelMultipleOption"; + +const api = createApiClient({ + getToken: () => { + try { + return localStorage.getItem("access_token") ?? localStorage.getItem("token") ?? null; + } catch { + return null; + } + }, +}); + +const PATH = "/label-multiple-option"; + +/** 接口存的是 JSON 字符串;列表/详情可能返回 string 或已反序列化的 array */ +function parseOptionValuesJsonField(raw: unknown): string[] { + if (raw == null) return []; + if (Array.isArray(raw)) return raw.map((x) => String(x)); + if (typeof raw === "string") { + const t = raw.trim(); + if (!t) return []; + try { + const p = JSON.parse(t) as unknown; + if (Array.isArray(p)) return p.map((x) => String(x)); + return []; + } catch { + return []; + } + } + return []; +} + +function normalizeLabelMultipleOptionDto(item: LabelMultipleOptionDto): LabelMultipleOptionDto { + const raw = item as LabelMultipleOptionDto & { optionValuesJson?: unknown }; + return { + ...item, + optionValuesJson: parseOptionValuesJsonField(raw.optionValuesJson), + }; +} + +function normalizePaged(res: PagedResultDto): PagedResultDto { + return { + totalCount: res.totalCount ?? 0, + items: (res.items ?? []).map(normalizeLabelMultipleOptionDto), + }; +} + +/** 创建/更新 Body:`optionValuesJson` 须为 string[] 的 JSON 字符串 */ +function optionValuesJsonToApiBody(values: string[]): string { + return JSON.stringify(values); +} + +export async function getLabelMultipleOptions(input: LabelMultipleOptionGetListInput, signal?: AbortSignal): Promise> { + const res = await api.requestJson>({ + path: PATH, + method: "GET", + query: { + SkipCount: input.skipCount, + MaxResultCount: input.maxResultCount, + Sorting: input.sorting, + Keyword: input.keyword, + State: input.state, + }, + signal, + }); + return normalizePaged(res); +} + +export async function getLabelMultipleOption(id: string, signal?: AbortSignal): Promise { + const d = await api.requestJson({ + path: `${PATH}/${encodeURIComponent(id)}`, + method: "GET", + signal, + }); + return normalizeLabelMultipleOptionDto(d); +} + +export async function createLabelMultipleOption(input: LabelMultipleOptionCreateInput): Promise { + const d = await api.requestJson({ + path: PATH, + method: "POST", + body: { + optionCode: input.optionCode, + optionName: input.optionName, + optionValuesJson: optionValuesJsonToApiBody(input.optionValuesJson), + state: input.state ?? true, + orderNum: input.orderNum, + }, + }); + return normalizeLabelMultipleOptionDto(d); +} + +export async function updateLabelMultipleOption(id: string, input: LabelMultipleOptionUpdateInput): Promise { + const d = await api.requestJson({ + path: `${PATH}/${encodeURIComponent(id)}`, + method: "PUT", + body: { + optionCode: input.optionCode, + optionName: input.optionName, + optionValuesJson: optionValuesJsonToApiBody(input.optionValuesJson), + state: input.state ?? true, + orderNum: input.orderNum, + }, + }); + return normalizeLabelMultipleOptionDto(d); +} + +export async function deleteLabelMultipleOption(id: string): Promise { + await api.requestJson({ + path: `${PATH}/${encodeURIComponent(id)}`, + method: "DELETE", + }); +} diff --git a/美国版/Food Labeling Management Platform/src/services/labelService.ts b/美国版/Food Labeling Management Platform/src/services/labelService.ts new file mode 100644 index 0000000..14cdc61 --- /dev/null +++ b/美国版/Food Labeling Management Platform/src/services/labelService.ts @@ -0,0 +1,90 @@ +import { createApiClient } from "../lib/apiClient"; +import type { + LabelCreateInput, + LabelDto, + LabelGetListInput, + LabelUpdateInput, + PagedResultDto, +} from "../types/label"; + +const api = createApiClient({ + getToken: () => { + try { + return localStorage.getItem("access_token") ?? localStorage.getItem("token") ?? null; + } catch { + return null; + } + }, +}); + +const PATH = "/label"; + +export async function getLabels(input: LabelGetListInput, signal?: AbortSignal): Promise> { + return api.requestJson>({ + path: PATH, + method: "GET", + query: { + SkipCount: input.skipCount, + MaxResultCount: input.maxResultCount, + Sorting: input.sorting, + Keyword: input.keyword, + LocationId: input.locationId, + ProductId: input.productId, + LabelCategoryId: input.labelCategoryId, + LabelTypeId: input.labelTypeId, + TemplateCode: input.templateCode, + State: input.state, + }, + signal, + }); +} + +export async function getLabel(labelCode: string, signal?: AbortSignal): Promise { + return api.requestJson({ + path: `${PATH}/${encodeURIComponent(labelCode)}`, + method: "GET", + signal, + }); +} + +export async function createLabel(input: LabelCreateInput): Promise { + return api.requestJson({ + path: PATH, + method: "POST", + body: { + labelCode: input.labelCode, + labelName: input.labelName, + templateCode: input.templateCode, + locationId: input.locationId, + labelCategoryId: input.labelCategoryId, + labelTypeId: input.labelTypeId, + productIds: input.productIds, + labelInfoJson: input.labelInfoJson, + state: input.state ?? true, + }, + }); +} + +export async function updateLabel(labelCode: string, input: LabelUpdateInput): Promise { + return api.requestJson({ + path: `${PATH}/${encodeURIComponent(labelCode)}`, + method: "PUT", + body: { + labelName: input.labelName, + templateCode: input.templateCode, + locationId: input.locationId, + labelCategoryId: input.labelCategoryId, + labelTypeId: input.labelTypeId, + productIds: input.productIds, + labelInfoJson: input.labelInfoJson, + state: input.state ?? true, + }, + }); +} + +export async function deleteLabel(labelCode: string): Promise { + await api.requestJson({ + path: `${PATH}/${encodeURIComponent(labelCode)}`, + method: "DELETE", + }); +} diff --git a/美国版/Food Labeling Management Platform/src/services/labelTemplateService.ts b/美国版/Food Labeling Management Platform/src/services/labelTemplateService.ts new file mode 100644 index 0000000..312c2b1 --- /dev/null +++ b/美国版/Food Labeling Management Platform/src/services/labelTemplateService.ts @@ -0,0 +1,142 @@ +import { createApiClient } from "../lib/apiClient"; +import type { + LabelTemplateCreateInput, + LabelTemplateDto, + LabelTemplateGetListInput, + LabelTemplateUpdateInput, + PagedResultDto, +} from "../types/labelTemplate"; + +const api = createApiClient({ + getToken: () => { + try { + return localStorage.getItem("access_token") ?? localStorage.getItem("token") ?? null; + } catch { + return null; + } + }, +}); + +const PATH = "/label-template"; + +function normalizeTemplateCode(raw: unknown): string { + const r = raw as Record | null | undefined; + if (!r || typeof r !== "object") return ""; + const id = r.id ?? r.templateCode ?? r.TemplateCode; + return typeof id === "string" ? id.trim() : String(id ?? "").trim(); +} + +function normalizeLabelTemplateDto(raw: unknown): LabelTemplateDto { + const r = raw as Record; + const ids = + (Array.isArray(r.appliedLocationIds) ? r.appliedLocationIds : null) ?? + (Array.isArray(r.AppliedLocationIds) ? r.AppliedLocationIds : null) ?? + []; + const appliedLocationIds = ids.map((x) => String(x)); + const id = normalizeTemplateCode(raw); + + const templateNameVo = r.templateName ?? r.TemplateName; + const templateCodeVo = r.templateCode ?? r.TemplateCode; + const locationTextVo = r.locationText ?? r.LocationText; + const sizeTextVo = r.sizeText ?? r.SizeText; + const ccRaw = r.contentsCount ?? r.ContentsCount; + const contentsCountVo = typeof ccRaw === "number" ? ccRaw : undefined; + const lastEditedVo = r.lastEdited ?? r.LastEdited; + + const nameFromList = + (typeof r.name === "string" && r.name.trim() ? r.name : null) ?? + (typeof templateNameVo === "string" && String(templateNameVo).trim() ? String(templateNameVo) : null); + + return { + ...(r as object), + id, + name: nameFromList ?? (r.name as LabelTemplateDto["name"]), + templateName: (typeof templateNameVo === "string" ? templateNameVo : null) ?? (r.templateName as string | null), + templateCode: (typeof templateCodeVo === "string" ? templateCodeVo : null) ?? (r.templateCode as string | null), + locationText: (typeof locationTextVo === "string" ? locationTextVo : null) ?? (r.locationText as string | null), + sizeText: (typeof sizeTextVo === "string" ? sizeTextVo : null) ?? (r.sizeText as string | null), + contentsCount: contentsCountVo ?? (r.contentsCount as number | null), + lastEdited: (typeof lastEditedVo === "string" ? lastEditedVo : null) ?? (r.lastEdited as string | null), + appliedLocationIds, + elements: Array.isArray(r.elements) ? (r.elements as LabelTemplateDto["elements"]) : [], + } as LabelTemplateDto; +} + +export async function getLabelTemplates(input: LabelTemplateGetListInput, signal?: AbortSignal): Promise> { + const res = await api.requestJson>({ + path: PATH, + method: "GET", + query: { + SkipCount: input.skipCount, + MaxResultCount: input.maxResultCount, + Sorting: input.sorting, + Keyword: input.keyword, + LocationId: input.locationId, + LabelType: input.labelType, + State: input.state, + }, + signal, + }); + const items = (res.items ?? []).map((x) => normalizeLabelTemplateDto(x)); + return { ...res, items }; +} + +export async function getLabelTemplate(templateCode: string, signal?: AbortSignal): Promise { + const raw = await api.requestJson({ + path: `${PATH}/${encodeURIComponent(templateCode)}`, + method: "GET", + signal, + }); + return normalizeLabelTemplateDto(raw); +} + +export async function createLabelTemplate(input: LabelTemplateCreateInput): Promise { + const created = await api.requestJson({ + path: PATH, + method: "POST", + body: { + id: input.id, + name: input.name, + labelType: input.labelType, + unit: input.unit, + width: input.width, + height: input.height, + appliedLocation: input.appliedLocation, + showRuler: input.showRuler ?? true, + showGrid: input.showGrid ?? true, + state: input.state ?? true, + elements: input.elements, + appliedLocationIds: input.appliedLocationIds ?? [], + }, + }); + return normalizeLabelTemplateDto(created); +} + +export async function updateLabelTemplate(templateCode: string, input: LabelTemplateUpdateInput): Promise { + const updated = await api.requestJson({ + path: `${PATH}/${encodeURIComponent(templateCode)}`, + method: "PUT", + body: { + id: input.id, + name: input.name, + labelType: input.labelType, + unit: input.unit, + width: input.width, + height: input.height, + appliedLocation: input.appliedLocation, + showRuler: input.showRuler ?? true, + showGrid: input.showGrid ?? true, + state: input.state ?? true, + elements: input.elements, + appliedLocationIds: input.appliedLocationIds ?? [], + }, + }); + return normalizeLabelTemplateDto(updated); +} + +export async function deleteLabelTemplate(templateCode: string): Promise { + await api.requestJson({ + path: `${PATH}/${encodeURIComponent(templateCode)}`, + method: "DELETE", + }); +} diff --git a/美国版/Food Labeling Management Platform/src/services/labelTypeService.ts b/美国版/Food Labeling Management Platform/src/services/labelTypeService.ts new file mode 100644 index 0000000..4345340 --- /dev/null +++ b/美国版/Food Labeling Management Platform/src/services/labelTypeService.ts @@ -0,0 +1,76 @@ +import { createApiClient } from "../lib/apiClient"; +import type { + LabelTypeCreateInput, + LabelTypeDto, + LabelTypeGetListInput, + LabelTypeUpdateInput, + PagedResultDto, +} from "../types/labelType"; + +const api = createApiClient({ + getToken: () => { + try { + return localStorage.getItem("access_token") ?? localStorage.getItem("token") ?? null; + } catch { + return null; + } + }, +}); + +const PATH = "/label-type"; + +export async function getLabelTypes(input: LabelTypeGetListInput, signal?: AbortSignal): Promise> { + return api.requestJson>({ + path: PATH, + method: "GET", + query: { + SkipCount: input.skipCount, + MaxResultCount: input.maxResultCount, + Sorting: input.sorting, + Keyword: input.keyword, + State: input.state, + }, + signal, + }); +} + +export async function getLabelType(id: string, signal?: AbortSignal): Promise { + return api.requestJson({ + path: `${PATH}/${encodeURIComponent(id)}`, + method: "GET", + signal, + }); +} + +export async function createLabelType(input: LabelTypeCreateInput): Promise { + return api.requestJson({ + path: PATH, + method: "POST", + body: { + typeCode: input.typeCode, + typeName: input.typeName, + state: input.state ?? true, + orderNum: input.orderNum, + }, + }); +} + +export async function updateLabelType(id: string, input: LabelTypeUpdateInput): Promise { + return api.requestJson({ + path: `${PATH}/${encodeURIComponent(id)}`, + method: "PUT", + body: { + typeCode: input.typeCode, + typeName: input.typeName, + state: input.state ?? true, + orderNum: input.orderNum, + }, + }); +} + +export async function deleteLabelType(id: string): Promise { + await api.requestJson({ + path: `${PATH}/${encodeURIComponent(id)}`, + method: "DELETE", + }); +} diff --git a/美国版/Food Labeling Management Platform/src/services/productLocationService.ts b/美国版/Food Labeling Management Platform/src/services/productLocationService.ts new file mode 100644 index 0000000..8e383eb --- /dev/null +++ b/美国版/Food Labeling Management Platform/src/services/productLocationService.ts @@ -0,0 +1,96 @@ +import { createApiClient } from "../lib/apiClient"; +import type { + ProductLocationByStoreDto, + ProductLocationCreateInput, + ProductLocationGetListInput, + ProductLocationLinkDto, + ProductLocationUpdateInput, + PagedResultDto, +} from "../types/productLocation"; + +const api = createApiClient({ + getToken: () => { + try { + return localStorage.getItem("access_token") ?? localStorage.getItem("token") ?? null; + } catch { + return null; + } + }, +}); + +const PATH = "/product-location"; + +function normalizeLink(raw: unknown): ProductLocationLinkDto { + const r = raw as Record; + return { + id: (r?.id ?? r?.Id) as string | undefined, + locationId: (r?.locationId ?? r?.LocationId) as string | null | undefined, + productId: (r?.productId ?? r?.ProductId) as string | null | undefined, + }; +} + +export async function getProductLocations( + input: ProductLocationGetListInput, + signal?: AbortSignal, +): Promise> { + const res = await api.requestJson>({ + path: PATH, + method: "GET", + query: { + SkipCount: input.skipCount, + MaxResultCount: input.maxResultCount, + Sorting: input.sorting, + LocationId: input.locationId, + ProductId: input.productId, + }, + signal, + }); + return { + ...res, + items: (res.items ?? []).map((x) => normalizeLink(x)), + }; +} + +/** 门店下已关联的产品(文档 7.2) */ +export async function getProductIdsByLocation(locationId: string, signal?: AbortSignal): Promise { + const raw = await api.requestJson({ + path: `${PATH}/${encodeURIComponent(locationId)}`, + method: "GET", + signal, + }); + if (Array.isArray(raw?.productIds)) return raw.productIds.map(String); + if (Array.isArray(raw?.items)) { + return (raw.items ?? []) + .map((x) => x?.productId) + .filter((x): x is string => typeof x === "string" && x.length > 0); + } + return []; +} + +export async function createProductLocation(input: ProductLocationCreateInput): Promise { + return api.requestJson({ + path: PATH, + method: "POST", + body: { + locationId: input.locationId, + productIds: input.productIds, + }, + }); +} + +export async function updateProductLocation(locationId: string, input: ProductLocationUpdateInput): Promise { + return api.requestJson({ + path: `${PATH}/${encodeURIComponent(locationId)}`, + method: "PUT", + body: { + productIds: input.productIds, + }, + }); +} + +export async function deleteProductLocation(locationId: string): Promise { + await api.requestJson({ + path: `${PATH}/${encodeURIComponent(locationId)}`, + method: "DELETE", + }); +} diff --git a/美国版/Food Labeling Management Platform/src/services/productService.ts b/美国版/Food Labeling Management Platform/src/services/productService.ts new file mode 100644 index 0000000..41f4d6a --- /dev/null +++ b/美国版/Food Labeling Management Platform/src/services/productService.ts @@ -0,0 +1,104 @@ +import { createApiClient } from "../lib/apiClient"; +import type { + ProductCreateInput, + ProductDto, + ProductGetListInput, + ProductUpdateInput, + PagedResultDto, +} from "../types/product"; + +const api = createApiClient({ + getToken: () => { + try { + return localStorage.getItem("access_token") ?? localStorage.getItem("token") ?? null; + } catch { + return null; + } + }, +}); + +const PATH = "/product"; + +function normalizeProductDto(raw: unknown): ProductDto { + const r = raw as Record; + const id = String(r?.id ?? r?.Id ?? "").trim(); + return { + ...(r as object), + id, + productCode: (r?.productCode ?? r?.ProductCode) as string | null | undefined, + productName: (r?.productName ?? r?.ProductName) as string | null | undefined, + categoryName: (r?.categoryName ?? r?.CategoryName) as string | null | undefined, + productImageUrl: (r?.productImageUrl ?? r?.ProductImageUrl) as string | null | undefined, + state: + typeof r?.state === "boolean" + ? r.state + : typeof r?.State === "boolean" + ? (r.State as boolean) + : null, + } as ProductDto; +} + +export async function getProducts(input: ProductGetListInput, signal?: AbortSignal): Promise> { + const res = await api.requestJson>({ + path: PATH, + method: "GET", + query: { + SkipCount: input.skipCount, + MaxResultCount: input.maxResultCount, + Sorting: input.sorting, + Keyword: input.keyword, + State: input.state, + }, + signal, + }); + return { + ...res, + items: (res.items ?? []).map((x) => normalizeProductDto(x)), + }; +} + +export async function getProduct(id: string, signal?: AbortSignal): Promise { + const raw = await api.requestJson({ + path: `${PATH}/${encodeURIComponent(id)}`, + method: "GET", + signal, + }); + return normalizeProductDto(raw); +} + +export async function createProduct(input: ProductCreateInput): Promise { + const raw = await api.requestJson({ + path: PATH, + method: "POST", + body: { + productCode: input.productCode, + productName: input.productName, + categoryName: input.categoryName ?? null, + productImageUrl: input.productImageUrl ?? null, + state: input.state ?? true, + }, + }); + return normalizeProductDto(raw); +} + +export async function updateProduct(id: string, input: ProductUpdateInput): Promise { + const raw = await api.requestJson({ + path: `${PATH}/${encodeURIComponent(id)}`, + method: "PUT", + body: { + productCode: input.productCode, + productName: input.productName, + categoryName: input.categoryName ?? null, + productImageUrl: input.productImageUrl ?? null, + state: input.state ?? true, + }, + }); + return normalizeProductDto(raw); +} + +export async function deleteProduct(id: string): Promise { + await api.requestJson({ + path: `${PATH}/${encodeURIComponent(id)}`, + method: "DELETE", + }); +} diff --git a/美国版/Food Labeling Management Platform/src/types/label.ts b/美国版/Food Labeling Management Platform/src/types/label.ts new file mode 100644 index 0000000..84a4043 --- /dev/null +++ b/美国版/Food Labeling Management Platform/src/types/label.ts @@ -0,0 +1,68 @@ +export type LabelDto = { + id: string; // LabelCode + labelCode?: string | null; + labelName?: string | null; + templateCode?: string | null; + locationId?: string | null; + labelCategoryId?: string | null; + labelTypeId?: string | null; + productIds?: string[] | null; + labelInfoJson?: Record | null; + state?: boolean | null; + creationTime?: string | null; + /** 列表接口:门店展示名 */ + locationName?: string | null; + /** 列表接口:标签类别展示名 */ + labelCategoryName?: string | null; + /** 列表接口:标签类型展示名 */ + labelTypeName?: string | null; + /** 列表接口:模板展示名 */ + templateName?: string | null; + /** 列表接口:关联产品展示名(按产品展开时可能为单条) */ + productName?: string | null; + /** 列表接口:产品类别展示名 */ + productCategoryName?: string | null; + /** 列表接口:最后编辑时间(后端已格式化字符串) */ + lastEdited?: string | null; +}; + +export type PagedResultDto = { + totalCount: number; + items: T[]; +}; + +export type LabelGetListInput = { + skipCount: number; + maxResultCount: number; + sorting?: string; + keyword?: string; + locationId?: string; + productId?: string; + labelCategoryId?: string; + labelTypeId?: string; + templateCode?: string; + state?: boolean; +}; + +export type LabelCreateInput = { + labelCode: string; + labelName: string; + templateCode: string; + locationId: string; + labelCategoryId: string; + labelTypeId: string; + productIds: string[]; // 至少 1 个 + labelInfoJson?: Record | null; + state?: boolean; +}; + +export type LabelUpdateInput = { + labelName: string; + templateCode: string; + locationId: string; + labelCategoryId: string; + labelTypeId: string; + productIds: string[]; // 至少 1 个 + labelInfoJson?: Record | null; + state?: boolean; +}; diff --git a/美国版/Food Labeling Management Platform/src/types/labelCategory.ts b/美国版/Food Labeling Management Platform/src/types/labelCategory.ts new file mode 100644 index 0000000..a540f4a --- /dev/null +++ b/美国版/Food Labeling Management Platform/src/types/labelCategory.ts @@ -0,0 +1,32 @@ +export type LabelCategoryDto = { + id: string; + categoryCode?: string | null; + categoryName?: string | null; + categoryPhotoUrl?: string | null; + state?: boolean | null; + orderNum?: number | null; + creationTime?: string | null; +}; + +export type PagedResultDto = { + totalCount: number; + items: T[]; +}; + +export type LabelCategoryGetListInput = { + skipCount: number; + maxResultCount: number; + sorting?: string; + keyword?: string; + state?: boolean; +}; + +export type LabelCategoryCreateInput = { + categoryCode: string; + categoryName: string; + categoryPhotoUrl?: string | null; + state?: boolean; + orderNum?: number | null; +}; + +export type LabelCategoryUpdateInput = LabelCategoryCreateInput; diff --git a/美国版/Food Labeling Management Platform/src/types/labelMultipleOption.ts b/美国版/Food Labeling Management Platform/src/types/labelMultipleOption.ts new file mode 100644 index 0000000..df0c9d2 --- /dev/null +++ b/美国版/Food Labeling Management Platform/src/types/labelMultipleOption.ts @@ -0,0 +1,34 @@ +export type LabelMultipleOptionDto = { + id: string; + optionCode?: string | null; + optionName?: string | null; + /** 业务层统一为 string[];接口传输为 JSON 字符串,由 service 解析/序列化 */ + optionValuesJson?: string[] | null; + state?: boolean | null; + orderNum?: number | null; + creationTime?: string | null; +}; + +export type PagedResultDto = { + totalCount: number; + items: T[]; +}; + +export type LabelMultipleOptionGetListInput = { + skipCount: number; + maxResultCount: number; + sorting?: string; + keyword?: string; + state?: boolean; +}; + +export type LabelMultipleOptionCreateInput = { + optionCode: string; + optionName: string; + /** 表单用 string[];POST/PUT 时序列化为 JSON 字符串再提交 */ + optionValuesJson: string[]; + state?: boolean; + orderNum?: number | null; +}; + +export type LabelMultipleOptionUpdateInput = LabelMultipleOptionCreateInput; diff --git a/美国版/Food Labeling Management Platform/src/types/labelTemplate.ts b/美国版/Food Labeling Management Platform/src/types/labelTemplate.ts index 7053e6b..7426937 100644 --- a/美国版/Food Labeling Management Platform/src/types/labelTemplate.ts +++ b/美国版/Food Labeling Management Platform/src/types/labelTemplate.ts @@ -4,7 +4,8 @@ export type LabelType = 'PRICE' | 'NUTRITION' | 'SHIPPING'; export type Unit = 'cm' | 'inch'; -export type AppliedLocation = 'ALL' | string; +/** 与接口文档一致:ALL=全部门店,SPECIFIED=指定门店(需 appliedLocationIds) */ +export type AppliedLocation = 'ALL' | 'SPECIFIED'; export type Rotation = 'horizontal' | 'vertical'; export type Border = 'none' | 'line' | 'dotted'; @@ -31,6 +32,8 @@ export interface LabelTemplate { width: number; height: number; appliedLocation: AppliedLocation; + /** 当 appliedLocation=SPECIFIED 时必填,至少一个门店 Id */ + appliedLocationIds?: string[]; showRuler: boolean; /** 是否显示画布网格,默认 true */ showGrid?: boolean; @@ -46,6 +49,11 @@ export interface LabelElement { height: number; rotation: Rotation; border: Border; + /** 与后端 editor JSON 对齐的可选字段 */ + orderNum?: number; + zIndex?: number; + valueSourceType?: string; + isRequiredInput?: boolean; config: Record; } @@ -97,6 +105,7 @@ export function createDefaultTemplate(id?: string): LabelTemplate { width: 6, height: 4, appliedLocation: 'ALL', + appliedLocationIds: [], showRuler: true, showGrid: true, elements: [], @@ -148,3 +157,90 @@ export function createDefaultElement(type: ElementType, x = 20, y = 20): LabelEl config: { ...d.config }, }; } + +// ========== API 相关类型定义 ========== + +export type LabelTemplateDto = { + id: string; // TemplateCode(兼容后端 templateCode) + name?: string | null; + /** 列表接口常见展示名(与 name 二选一或并存) */ + templateName?: string | null; + /** 列表接口模板编码(与 id 一致时可省略) */ + templateCode?: string | null; + /** 列表接口:适用门店展示文案 */ + locationText?: string | null; + /** 列表接口:尺寸展示文案,如 6.00x4.00cm */ + sizeText?: string | null; + /** List API: element count (when no `elements` array). */ + contentsCount?: number | null; + /** 列表接口:最近编辑时间 */ + lastEdited?: string | null; + labelType?: LabelType | null; + unit?: Unit | null; + width?: number | null; + height?: number | null; + appliedLocation?: AppliedLocation | string | null; + showRuler?: boolean | null; + showGrid?: boolean | null; + state?: boolean | null; + versionNo?: number | null; + elements?: LabelElement[] | null; + appliedLocationIds?: string[] | null; + creationTime?: string | null; +}; + +export type PagedResultDto = { + totalCount: number; + items: T[]; +}; + +export type LabelTemplateGetListInput = { + skipCount: number; + maxResultCount: number; + sorting?: string; + keyword?: string; + locationId?: string; + labelType?: LabelType; + state?: boolean; +}; + +export type LabelTemplateCreateInput = { + id: string; // TemplateCode + name: string; + labelType: LabelType; + unit: Unit; + width: number; + height: number; + appliedLocation: AppliedLocation; + showRuler?: boolean; + showGrid?: boolean; + state?: boolean; + elements: LabelElement[]; + appliedLocationIds?: string[]; // 当 appliedLocation=SPECIFIED 时必填 +}; + +export type LabelTemplateUpdateInput = LabelTemplateCreateInput; + +/** 将列表/详情 DTO 的 appliedLocation 规范为编辑器使用的 ALL | SPECIFIED */ +export function appliedLocationToEditor(dto: { + appliedLocation?: string | null; + appliedLocationIds?: string[] | null; +}): AppliedLocation { + const raw = String(dto.appliedLocation ?? "").trim().toUpperCase(); + if (raw === "ALL") return "ALL"; + if (raw === "SPECIFIED") return "SPECIFIED"; + if ((dto.appliedLocationIds?.length ?? 0) > 0) return "SPECIFIED"; + return "ALL"; +} + +/** 文档示例中的 valueSourceType,保存时缺省则按元素类型推断 */ +export function defaultValueSourceTypeForElement(type: ElementType): string { + switch (type) { + case "TEXT_PRODUCT": + return "PRODUCT"; + case "TEXT_PRICE": + return "PRICE"; + default: + return "FIXED"; + } +} diff --git a/美国版/Food Labeling Management Platform/src/types/labelType.ts b/美国版/Food Labeling Management Platform/src/types/labelType.ts new file mode 100644 index 0000000..8760233 --- /dev/null +++ b/美国版/Food Labeling Management Platform/src/types/labelType.ts @@ -0,0 +1,30 @@ +export type LabelTypeDto = { + id: string; + typeCode?: string | null; + typeName?: string | null; + state?: boolean | null; + orderNum?: number | null; + creationTime?: string | null; +}; + +export type PagedResultDto = { + totalCount: number; + items: T[]; +}; + +export type LabelTypeGetListInput = { + skipCount: number; + maxResultCount: number; + sorting?: string; + keyword?: string; + state?: boolean; +}; + +export type LabelTypeCreateInput = { + typeCode: string; + typeName: string; + state?: boolean; + orderNum?: number | null; +}; + +export type LabelTypeUpdateInput = LabelTypeCreateInput; diff --git a/美国版/Food Labeling Management Platform/src/types/product.ts b/美国版/Food Labeling Management Platform/src/types/product.ts new file mode 100644 index 0000000..1ada56e --- /dev/null +++ b/美国版/Food Labeling Management Platform/src/types/product.ts @@ -0,0 +1,32 @@ +export type ProductDto = { + id: string; + productCode?: string | null; + productName?: string | null; + categoryName?: string | null; + productImageUrl?: string | null; + state?: boolean | null; + creationTime?: string | null; +}; + +export type PagedResultDto = { + totalCount: number; + items: T[]; +}; + +export type ProductGetListInput = { + skipCount: number; + maxResultCount: number; + sorting?: string; + keyword?: string; + state?: boolean; +}; + +export type ProductCreateInput = { + productCode: string; + productName: string; + categoryName?: string | null; + productImageUrl?: string | null; + state?: boolean; +}; + +export type ProductUpdateInput = ProductCreateInput; diff --git a/美国版/Food Labeling Management Platform/src/types/productLocation.ts b/美国版/Food Labeling Management Platform/src/types/productLocation.ts new file mode 100644 index 0000000..0738f11 --- /dev/null +++ b/美国版/Food Labeling Management Platform/src/types/productLocation.ts @@ -0,0 +1,34 @@ +export type ProductLocationLinkDto = { + id?: string | null; + locationId?: string | null; + productId?: string | null; +}; + +export type PagedResultDto = { + totalCount: number; + items: T[]; +}; + +export type ProductLocationGetListInput = { + skipCount: number; + maxResultCount: number; + sorting?: string; + locationId?: string; + productId?: string; +}; + +export type ProductLocationCreateInput = { + locationId: string; + productIds: string[]; +}; + +export type ProductLocationUpdateInput = { + productIds: string[]; +}; + +/** GET /product-location/{locationId} — 以后端实际字段为准 */ +export type ProductLocationByStoreDto = { + locationId?: string | null; + productIds?: string[] | null; + items?: { productId?: string | null }[] | null; +};